statistics 页面搜索条件添加校验提示

This commit is contained in:
任珮宇 2024-01-24 18:39:04 +08:00
parent 5c73a26d21
commit e1cdea9222

View File

@ -274,7 +274,7 @@ export default {
stationIds: [], stationIds: [],
queryParams: { queryParams: {
systemType: undefined, systemType: undefined,
nuclideNames: undefined, nuclideNames: [],
dbName: undefined, dbName: undefined,
startDate: moment().subtract(6, 'days').format('YYYY-MM-DD'), startDate: moment().subtract(6, 'days').format('YYYY-MM-DD'),
endDate: moment().format('YYYY-MM-DD'), endDate: moment().format('YYYY-MM-DD'),
@ -373,26 +373,51 @@ export default {
this.queryParams.endDate = dateString this.queryParams.endDate = dateString
}, },
handleSearch() { handleSearch() {
this.isDefault = false
this.chartInitList = [] this.chartInitList = []
this.chartLayout = [] this.chartLayout = []
this.stationIds.forEach((id, index) => { if (this.queryParams.systemType) {
this.chartLayout.push(id) if (this.stationIds.length > 0) {
this.$nextTick(() => { this.isDefault = false
let currChartInit = echarts.init(document.getElementById(`chart_${id}`)) this.stationIds.forEach((id, index) => {
this.chartInitList.push(currChartInit) this.chartLayout.push(id)
let params = { this.$nextTick(() => {
...this.queryParams, let currChartInit = echarts.init(document.getElementById(`chart_${id}`))
stationId: id, this.chartInitList.push(currChartInit)
} let params = {
let options = cloneDeep(commonOptions) ...this.queryParams,
if (this.queryParams.nuclideNames.length > 0) { stationId: id,
this.getChartDate(params, currChartInit, options, id) }
} else { let options = cloneDeep(commonOptions)
this.$message.warning(`Please select nuclide!`)
} if (this.queryParams.nuclideNames.length < 1) {
}) this.$message.warning(`Please select nuclide!`)
}) // this.getChartDate(params, currChartInit, options, id)
}
if (!this.queryParams.dbName) {
this.$message.warning(`Please select Data Source!`)
}
if (!this.queryParams.startDate) {
this.$message.warning(`Please select start Date!`)
}
if (!this.queryParams.endDate) {
this.$message.warning(`Please select end Date!`)
}
if (
this.queryParams.nuclideNames.length > 0 &&
this.queryParams.dbName &&
this.queryParams.startDate &&
this.queryParams.endDate
) {
this.getChartDate(params, currChartInit, options, id)
}
})
})
} else {
this.$message.warning(`Please select stations!`)
}
} else {
this.$message.warning(`Please select type!`)
}
}, },
async getChartDate(params, chart, option, id) { async getChartDate(params, chart, option, id) {
this.spinning = true this.spinning = true