开发法规预警页面

This commit is contained in:
qq787203167
2022-06-21 16:57:52 +08:00
parent e433e4ea1e
commit 7305f365ab
5 changed files with 345 additions and 6 deletions
+116 -3
View File
@@ -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 @@
}
}
</script>
<style>
.box-input .ant-select-selection--single {
height: 38px;
}
.box-input .ant-select-selection--multiple {
height: 38px;
}
.box-input .ant-select-selection__rendered {
line-height: 38px;
height: 38px;
}
.box-input .ant-select-selection--multiple .ant-select-selection__rendered > ul > li {
margin-top: 6px;
}
.box-input .ant-calendar-picker {
line-height: 38px;
height: 38px;
}
.box-input .ant-calendar-picker-input {
height: 38px;
}
.box-input .ant-input-number-input-wrap {
line-height: 38px;
height: 38px;
}
</style>
<style scoped>
.box-title-text {
line-height: 1.4;