From 17d4d31461a0933914695e144b38aa61853afe2d Mon Sep 17 00:00:00 2001 From: xjs <1294405880@qq.com> Date: Fri, 18 Feb 2022 16:10:22 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=89=8D=E7=AB=AF=E5=B0=81=E8=A3=85?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E6=97=A5=E6=9C=9F=E7=BB=84=E4=BB=B6=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=97=A5=E6=9C=9Fmixins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/layout/mixin/PickerOptions.js | 52 +++++++++++++++++++ .../src/views/business/english/word/index.vue | 3 ++ .../src/views/business/log/apilog/index.vue | 13 +++-- .../views/business/log/reptilelog/index.vue | 7 ++- .../business/openapi/topsearch/index.vue | 25 +++++---- .../business/webmagic/sina/sinaNews/index.vue | 50 ++++-------------- 6 files changed, 94 insertions(+), 56 deletions(-) create mode 100644 ruoyi-ui/src/layout/mixin/PickerOptions.js diff --git a/ruoyi-ui/src/layout/mixin/PickerOptions.js b/ruoyi-ui/src/layout/mixin/PickerOptions.js new file mode 100644 index 00000000..209a656c --- /dev/null +++ b/ruoyi-ui/src/layout/mixin/PickerOptions.js @@ -0,0 +1,52 @@ +export const pickerOptions = { + + data() { + return { + //日期组件 + pickerOptions: { + shortcuts: [{ + text: '今天', + onClick(picker) { + const end = new Date(); + const start = new Date(); + end.setTime(start.getTime() + 3600 * 1000 * 24); + picker.$emit('pick', [start, end]); + } + }, { + text: '昨天', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24); + picker.$emit('pick', [start, end]); + } + }, { + text: '最近一周', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); + picker.$emit('pick', [start, end]); + } + }, { + text: '最近一个月', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); + picker.$emit('pick', [start, end]); + } + }, { + text: '最近三个月', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); + picker.$emit('pick', [start, end]); + } + }] + }, + } + }, + +} diff --git a/ruoyi-ui/src/views/business/english/word/index.vue b/ruoyi-ui/src/views/business/english/word/index.vue index c01c52a7..d930d610 100644 --- a/ruoyi-ui/src/views/business/english/word/index.vue +++ b/ruoyi-ui/src/views/business/english/word/index.vue @@ -28,6 +28,7 @@ style="width: 240px" value-format="yyyy-MM-dd" type="daterange" + :picker-options="pickerOptions" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @@ -267,10 +268,12 @@