From 7305f365abfb3046171072b3fb6d5c2cfa2265cf Mon Sep 17 00:00:00 2001 From: qq787203167 <787203167@qq.com> Date: Tue, 21 Jun 2022 16:57:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=B3=95=E8=A7=84=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jero-web/src/common/lang/en-us.js | 3 +- jero-web/src/common/lang/zh-cn.js | 1 + jero-web/src/components/layouts/Tabcrumbs.vue | 10 +- jero-web/src/components/search/index.vue | 119 +++++++++- .../views/regulatoryEarlyWarning/index.vue | 218 ++++++++++++++++++ 5 files changed, 345 insertions(+), 6 deletions(-) create mode 100644 jero-web/src/views/regulatoryEarlyWarning/index.vue diff --git a/jero-web/src/common/lang/en-us.js b/jero-web/src/common/lang/en-us.js index f8ac2da66..03e856504 100644 --- a/jero-web/src/common/lang/en-us.js +++ b/jero-web/src/common/lang/en-us.js @@ -946,5 +946,6 @@ module.exports = { question: 'Question', ConfirmQuestion: 'Confirm Question', disableInput: 'Disable input', - OnlyOrTaskconfirmationOut: 'Only when the list confirmation status or task confirmation status is to be confirmed can the reminder be carried out' + OnlyOrTaskconfirmationOut: 'Only when the list confirmation status or task confirmation status is to be confirmed can the reminder be carried out', + warningTime:'Warning time', } \ No newline at end of file diff --git a/jero-web/src/common/lang/zh-cn.js b/jero-web/src/common/lang/zh-cn.js index b95f2e589..c1eec6bc4 100644 --- a/jero-web/src/common/lang/zh-cn.js +++ b/jero-web/src/common/lang/zh-cn.js @@ -952,4 +952,5 @@ module.exports = { ConfirmQuestion: '确认催办?', OnlyOrTaskconfirmationOut:'只有清单确认状态或任务确认状态为待确认时才可以进行催办', disableInput:'禁止输入', + warningTime:'预警时间', } \ No newline at end of file diff --git a/jero-web/src/components/layouts/Tabcrumbs.vue b/jero-web/src/components/layouts/Tabcrumbs.vue index 4ff89fb50..42616fa75 100644 --- a/jero-web/src/components/layouts/Tabcrumbs.vue +++ b/jero-web/src/components/layouts/Tabcrumbs.vue @@ -26,7 +26,10 @@ }, watch: { '$route': function(val) { - if (val.meta.title == '首页' || val.meta.title === ' home page') { + if (val.meta.title == '首页' || + val.meta.title === ' Home Page' || + this.$route.meta.title === '法规预警' || + this.$route.meta.title === 'Regulatory Early Warning') { this.Navigation = val.meta.title this.subNavigation = null } else { @@ -36,7 +39,10 @@ }, mounted() { console.log(this.$route.meta) - if (this.$route.meta.title === '首页' || this.$route.meta.title === ' home page') { + if (this.$route.meta.title === '首页' || + this.$route.meta.title === ' Home Page' || + this.$route.meta.title === '法规预警' || + this.$route.meta.title === 'Regulatory Early Warning') { this.Navigation = this.$route.meta.title this.subNavigation = null } else { diff --git a/jero-web/src/components/search/index.vue b/jero-web/src/components/search/index.vue index f8f97fe0e..629ef022d 100644 --- a/jero-web/src/components/search/index.vue +++ b/jero-web/src/components/search/index.vue @@ -165,6 +165,14 @@ flag: { type: String, default: '' + }, + searchQueryList: { + type: Array, + default: [] + }, + isDefault: { + type: Boolean, + default: false } }, data() { @@ -183,6 +191,12 @@ }, searchReset() { this.queryParam = {} + if (this.isDefault) { + let startTime = moment(new Date()).format('YYYY-MM-DD') + let endTime = this.getNewDate('after', 6) + this.queryParam['warningTime'] = [startTime, endTime] + this.queryParam = { ...this.queryParam } + } eventBUs.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam))) }, getSeach() { @@ -192,12 +206,79 @@ getAction(this.url.seachList, params).then((res) => { if (res.success) { this.searchList = res.result + if (this.searchQueryList && this.searchQueryList.length > 0) { + this.searchList = this.searchList.concat(this.searchQueryList) + let startTime = moment(new Date()).format('YYYY-MM-DD') + let endTime = this.getNewDate('after', 6) + this.queryParam['warningTime'] = [startTime, endTime] + this.queryParam = { ...this.queryParam } + } } }) }, - // handleToggleSearch() { - // this.toggleSearchStatus = !this.toggleSearchStatus - // }, + getNewDate(flag, many) { + + const thirtyDays = [4, 6, 9, 11] // 30天的月份 + + const thirtyOneDays = [1, 3, 5, 7, 8, 10, 12] // 31天的月份 + + const currDate = new Date() // 今天日期 + + const year = currDate.getFullYear() + + let month = currDate.getMonth() + 1 + + let targetDateMilli = 0 + + let GMTDate = '' // 中国标准时间 + + let targetYear = '' // 年 + + let targetMonth = '' // 月 + + let targetDate = '' // 日 + + let dealTargetDays = '' // 目标日期 + + const isLeapYear = !!((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) // 是否是闰年 + + let countDays = 0 // 累计天数 + + for (let i = 0; i < many; i++) { + + if (flag === 'before') { + + month = month - 1 <= 0 ? 12 : month - 1 + + } else { + + month = month + 1 > 12 ? 1 : month + 1 + + } + + thirtyDays.includes(month) ? (countDays += 30) : thirtyOneDays.includes(month) ? (countDays += 31) : isLeapYear ? (countDays += 29) : (countDays += 28) + } + + targetDateMilli = currDate.setDate( + currDate.getDate() - (flag === 'before' ? countDays : countDays * -1) + ) + + GMTDate = new Date(targetDateMilli) + + targetYear = GMTDate.getFullYear() + + targetMonth = GMTDate.getMonth() + 1 + + targetDate = GMTDate.getDate() + + targetMonth = targetMonth.toString().padStart(2, '0') + + targetDate = targetDate.toString().padStart(2, '0') + + dealTargetDays = `${targetYear}-${targetMonth}-${targetDate}` + + return dealTargetDays + }, dateChange(item) { this.queryParam[item] = moment(this.queryParam[item]).format('YYYY-MM-DD') }, @@ -216,7 +297,39 @@ } } + \ No newline at end of file