From 392a023504a9d80ba07955ed8664429006d9ce76 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Tue, 25 Jul 2023 20:01:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Modals/LoadFromDBModal.vue | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue index 6be16e6..0b82737 100644 --- a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue @@ -127,18 +127,18 @@ export default { methods: { loadData(arg) { const params = this.getQueryParams() //查询条件 - const { startDate, endDate, menuTypes } = params + const { startDate, endDate, menuTypes } = params if (!menuTypes) { this.$message.warn('Please Select SampleType First') return } - if(!startDate || !endDate) { + if (!startDate || !endDate) { this.$message.warn(`'From' Date And 'To' Date Cannot Be Null`) return } - if(moment(startDate).isAfter(moment(endDate))) { + if (moment(startDate).isAfter(moment(endDate))) { this.$message.warn(`'From' Date Cannot Be Late Than 'To' Date`) return } @@ -148,12 +148,8 @@ export default { this.ipagination.current = 1 } - if (params.checkboxGroup) { - params.checkboxGroup.forEach(item => { - params[item] = true - }) - delete params.checkboxGroup - } + params.AllUsers = this.allUsersValue + delete params.checkboxGroup this.onClearSelected() @@ -191,13 +187,11 @@ export default { // 获取台站和探测器列表 async getStationAndDetectorList(value) { - if (!value) { - return - } - try { const { success, result, message } = await getAction('/spectrumAnalysis/getDBSearchList', { - menuTypes: value + menuTypes: value, + dbName: this.queryParam.dbName, + AllUsers: this.allUsersValue }) if (success) { this.stationList = result.stationCode.map(item => ({ label: item, value: item })) @@ -256,6 +250,11 @@ export default { }, on: { change: event => { + if (!event) { + this.stationList = [] + this.detectorList = [] + return + } this.getStationAndDetectorList(event) } } @@ -389,7 +388,7 @@ export default { name: 'checkboxGroup', props: { options: [ - { label: 'All User', value: 'allUser' }, + { label: 'All User', value: 'AllUsers' }, { label: 'Collect Stop', value: 'CollectStop' }, { label: 'Acq.Start', value: 'AcqStart' } ] @@ -432,6 +431,21 @@ export default { } } ] + }, + + allUsersValue() { + const checkboxGroup = this.queryParam.checkboxGroup + return !!(checkboxGroup && checkboxGroup.includes('AllUsers')) + } + }, + watch: { + // All User 变化时重新获取station 和detector + allUsersValue() { + if (this.queryParam.menuTypes) { + this.stationList = [] + this.detectorList = [] + this.getStationAndDetectorList(this.queryParam.menuTypes) + } } } }