From defd199567c01189e66c3029465c42f5a9951eba Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 2 Jun 2020 12:07:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20tag=20search=E6=B7=BB=E5=8A=A0=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DateTimePicker/index.vue | 34 ++++++++++++++++++- .../ListTable/TableAction/index.vue | 7 ++-- src/i18n/langs/cn.json | 3 ++ src/i18n/langs/en.json | 3 ++ 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/components/DateTimePicker/index.vue b/src/components/DateTimePicker/index.vue index 39e5ee600..b44a8757d 100644 --- a/src/components/DateTimePicker/index.vue +++ b/src/components/DateTimePicker/index.vue @@ -9,9 +9,12 @@ size="large" :clearable="false" class="datepicker" + :picker-options="pickerOptions" value-format="yyyy-MM-ddThh:mm" :default-time="['12:00:00', '12:00:00']" + v-bind="$attrs" @change="handleDateChange" + v-on="$listeners" /> @@ -24,7 +27,36 @@ export default { components: {}, data() { return { - value: [formatDate((new Date().getTime()) - 432000000), formatDate(new Date().getTime())] + value: [formatDate((new Date().getTime()) - 432000000), formatDate(new Date().getTime())], + pickerOptions: { + shortcuts: [ + { + text: this.$t('common.DateLastWeek'), + onClick(picker) { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) + picker.$emit('pick', [start, end]) + } + }, { + text: this.$t('common.DateLastMonth'), + onClick(picker) { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) + picker.$emit('pick', [start, end]) + } + }, { + text: this.$t('common.DateLast3Months'), + onClick(picker) { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) + picker.$emit('pick', [start, end]) + } + } + ] + } } }, computed: { diff --git a/src/components/ListTable/TableAction/index.vue b/src/components/ListTable/TableAction/index.vue index ef3cae653..7d4384519 100644 --- a/src/components/ListTable/TableAction/index.vue +++ b/src/components/ListTable/TableAction/index.vue @@ -4,13 +4,13 @@
- +
- +
@@ -62,6 +62,7 @@ export default { data() { return { keyword: '' + } }, computed: { @@ -131,7 +132,7 @@ export default { padding: 5px 20px; } .datepicker{ - margin-right: 15px; + margin-left: 10px; } diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index a3753c769..f5019df48 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -136,6 +136,9 @@ "common": { "CrontabHelpTips": "eg:每周日 03:05 执行 <5 3 * * 0>
提示: 使用5位 Linux crontab 表达式 <分 时 日 月 星期> (在线工具
注意: 如果同时设置了定期执行和周期执行,优先使用定期执行", "BadRequestErrorMsg": "请求错误,请检查填写内容", + "DateLastWeek": "最近一周", + "DateLastMonth": "最近一个月", + "DateLast3Months": "最近三个月", "Action": "动作", "Actions": "操作", "Activate": "激活", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 853fff991..1f3432c1e 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -135,6 +135,9 @@ "common": { "CrontabHelpTips": "eg: Every Sunday 03:05 run <5 3 * * 0>
Tips:Using 5 digits linux crontab expressions (Online tools)
Note:If both Regularly perform and Cycle perform are set,give priority to Regularly perform", "BadRequestErrorMsg" : "Bad request, please check again", + "DateLastWeek": "Last week", + "DateLastMonth": "Last month", + "DateLast3Months": "Last 3 months", "Action": "Action", "Actions": "Actions", "Activate": "Activate",