From da9257e81bafc0dbb29a0143fac77f51d2a9bbde Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Tue, 7 Nov 2023 14:30:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dbeta=E6=B8=85?= =?UTF-8?q?=E7=90=86=E7=BC=93=E5=AD=98=E7=9A=84=E8=B0=83=E7=94=A8=E5=9C=A8?= =?UTF-8?q?load=20from=20file=E6=97=B6=E4=BC=A0=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?getGammaGated=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spectrumAnalysis/clearSampleCache.js | 30 +++++++++---------- .../components/BetaDetectorCalibration.vue | 3 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/views/spectrumAnalysis/clearSampleCache.js b/src/views/spectrumAnalysis/clearSampleCache.js index 4b15b10..d73971b 100644 --- a/src/views/spectrumAnalysis/clearSampleCache.js +++ b/src/views/spectrumAnalysis/clearSampleCache.js @@ -4,19 +4,19 @@ import Vue from 'vue' /** * 发起请求清理后端对sample的缓存 - * @param {Array} sampleList + * @param {Array} sampleList */ -export const clearSampleCache = (sampleList) => { - sampleList.forEach(sample => { - const { inputFileName: fileName, sampleFileName, qcFileName } = sample - let url = '/gamma/delPHDCache', - params = { fileName } - if (sample.sampleType == 'B') { - url = '/spectrumAnalysis/deleteSpectrumCacheData' - params = { sampleFileName , qcFileName } - } - deleteAction(url, params) - store.commit('REMOVE_SAMPLE_DATA', fileName) - Vue.ls.remove(`calibration-gamma:${fileName}`) - }) -} \ No newline at end of file +export const clearSampleCache = sampleList => { + sampleList.forEach(sample => { + const { inputFileName: fileName } = sample + let url = '/gamma/delPHDCache', + params = { fileName } + if (sample.sampleType == 'B') { + url = '/spectrumAnalysis/deleteSpectrumCacheData' + params = { sampleFileName: fileName } + } + deleteAction(url, params) + store.commit('REMOVE_SAMPLE_DATA', fileName) + Vue.ls.remove(`calibration-gamma:${fileName}`) + }) +} diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue index 4f4ab43..a895bd4 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue @@ -696,7 +696,7 @@ export default { this.cancelLastRequest() const cancelToken = this.createCancelToken() this.isLoadingGammaGated = true - const { sampleId, qcFileName } = this.newSampleData + const { sampleId, qcFileName, inputFileName: sampleFileName } = this.newSampleData const { success, result: { data }, @@ -709,6 +709,7 @@ export default { chartHeight: this.gammaEnergy.length, channelWidth: this.gammaChannelWidth, qcFileName, + sampleFileName }, cancelToken ) From 4e9304ec9d3249b569aa046b97b924c96b55082f Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Tue, 7 Nov 2023 15:40:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=8F=B0=E7=AB=99=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/Scheduling.vue | 196 +++++++++++++++++--------------- 1 file changed, 103 insertions(+), 93 deletions(-) diff --git a/src/views/system/Scheduling.vue b/src/views/system/Scheduling.vue index d8e39ce..bf81bad 100644 --- a/src/views/system/Scheduling.vue +++ b/src/views/system/Scheduling.vue @@ -4,9 +4,7 @@ @@ -50,7 +48,7 @@ - + @@ -116,9 +114,30 @@ @@ -203,9 +210,9 @@ export default { components: { VNodes: { functional: true, - render: (_, ctx) => ctx.props.vnodes + render: (_, ctx) => ctx.props.vnodes, }, - CustomPopoverSearch + CustomPopoverSearch, }, data() { this.dateFormat = dateFormat @@ -222,7 +229,6 @@ export default { isGettingDetail: false, // 编辑时正在获取详情 - originalTreeData: [], // 站点的树状结构 targetKeys: [], isGettingStationList: false, @@ -238,7 +244,8 @@ export default { isChanging: false, dragItem: null, - fromUserId: '' + fromUserId: '', + stationName: '', } }, created() { @@ -265,20 +272,7 @@ export default { this.isGettingStationList = true const { success, result, message } = await getAction('/gardsStations/findPage?pageIndex=1&pageSize=1000') if (success) { - const records = result.records - const set = new Set(records.map(item => item.countryCode)) - this.originalTreeData = Array.from(set).map((countryCode, index) => { - return { - title: countryCode, - key: index.toString(), - disabled: true, - children: records - .filter(item => item.countryCode == countryCode) - .map(item => ({ title: item.stationCode, key: item.stationId.toString(), children: [] })) - } - }) - - this.stationList = records + this.stationList = result.records } else { this.$message.error(message) } @@ -296,9 +290,9 @@ export default { ) if (success) { const records = result.records - this.accountList = records.map(item => ({ + this.accountList = records.map((item) => ({ label: item.username, - value: item.id + value: item.id, })) } else { this.$message.error(message) @@ -331,20 +325,20 @@ export default { if (success) { const selectedStations = [] // 找出已经被选中的站点 const accountTree = [] // 构建右侧的树 - result.forEach(item => { + result.forEach((item) => { const accountItem = { title: item.userName, key: item.userId, - children: [] + children: [], } accountTree.push(accountItem) - item.stationList.forEach(station => { + item.stationList.forEach((station) => { selectedStations.push(station.stationId) accountItem.children.push({ title: station.stationName, key: station.stationId, - isLeaf: true + isLeaf: true, }) }) }) @@ -365,7 +359,7 @@ export default { try { const { success } = await deleteAction('/sysTask/deleteById', { taskId, - userId + userId, }) if (success) { this.$message.success('Delete Success') @@ -389,10 +383,7 @@ export default { this.targetKeys = [] this.accountTreeData = [] - this.rightAccountChildSelectedKeys = [] - this.rightAccountChildExpandedKeys = [] - - this.checkedAccount = '' + this.resetModalState() }, onEdit() { @@ -402,13 +393,17 @@ export default { } this.isAdd = false this.visible = true + this.resetModalState() + this.getScheduleDetail() + }, + resetModalState() { this.rightAccountChildSelectedKeys = [] this.rightAccountChildExpandedKeys = [] this.checkedAccount = '' + this.stationName = '' this.keyword = '' - this.getScheduleDetail() }, async onImport({ file }) { @@ -449,7 +444,7 @@ export default { day: this.currentDate.format('YYYY-MM-DD'), fromUserId: this.fromUserId, toUserId, - stationIds: [this.dragItem.stationId] + stationIds: [this.dragItem.stationId], }) if (success) { this.$message.success('Change Success') @@ -471,7 +466,7 @@ export default { this.$message.warn('Person List Is Empty') return Promise.reject() } - if (!this.accountTreeData.some(accountTreeItem => accountTreeItem.children.length)) { + if (!this.accountTreeData.some((accountTreeItem) => accountTreeItem.children.length)) { this.$message.warn('Every Person Has No Station Assigned') return Promise.reject() } @@ -487,16 +482,16 @@ export default { failMsg = 'Add Fail' } const params = [] - this.accountTreeData.forEach(accountTreeItem => { + this.accountTreeData.forEach((accountTreeItem) => { if (accountTreeItem.children.length) { params.push({ schedulingDate: this.currentDate.format('YYYY-MM-DD HH:mm:ss'), - stationList: accountTreeItem.children.map(child => { + stationList: accountTreeItem.children.map((child) => { return { - stationId: child.key + stationId: child.key, } }), - userId: accountTreeItem.key + userId: accountTreeItem.key, }) } }) @@ -528,7 +523,7 @@ export default { // 处理station列表 handleTreeData(data, targetKeys = [], level) { - data.forEach(item => { + data.forEach((item) => { if (level !== 0) { item.disabled = targetKeys.includes(item.key) } @@ -542,13 +537,13 @@ export default { // 将选中的账号加入到右侧穿梭框 onAddToList(selectedAccount) { const addedAccounts = selectedAccount - .filter(id => !this.accountTreeData.find(account => account.key == id)) // 如果之前没有加过,才加进去 - .map(id => { - const find = this.accountList.find(account => account.value == id) + .filter((id) => !this.accountTreeData.find((account) => account.key == id)) // 如果之前没有加过,才加进去 + .map((id) => { + const find = this.accountList.find((account) => account.value == id) return { title: find.label, key: id, - children: [] + children: [], } }) this.accountTreeData.push(...addedAccounts) @@ -563,7 +558,7 @@ export default { // 将所有右侧的穿梭状态重置 const allChildKeys = this.accountTreeData.reduce( - (prev, curr) => prev.concat(curr.children.map(child => child.key)), + (prev, curr) => prev.concat(curr.children.map((child) => child.key)), [] ) itemSelectAll(allChildKeys, false) @@ -584,14 +579,14 @@ export default { this.$message.warning('Please Select A Person To Assign') return } - const findAccount = this.accountTreeData.find(account => account.key == this.checkedAccount) + const findAccount = this.accountTreeData.find((account) => account.key == this.checkedAccount) if (findAccount) { - const children = moveKeys.map(key => { - const findStation = this.stationList.find(station => station.stationId == key) + const children = moveKeys.map((key) => { + const findStation = this.stationList.find((station) => station.stationId == key) return { isLeaf: true, title: findStation.stationCode, - key + key, } }) findAccount.children.push(...children) @@ -605,7 +600,7 @@ export default { for (const pIndex in this.accountTreeData) { // 找到要移除的Station在右侧列表中的位置 const account = this.accountTreeData[pIndex] - const cIndex = account.children.findIndex(child => child.key == moveKey) + const cIndex = account.children.findIndex((child) => child.key == moveKey) if (-1 !== cIndex) { parentIndex = pIndex childIndex = cIndex @@ -615,19 +610,33 @@ export default { this.accountTreeData[parentIndex].children.splice(childIndex, 1) } this.targetKeys = targetKeys - } + }, }, computed: { treeData() { - return this.handleTreeData(cloneDeep(this.originalTreeData), this.targetKeys, 0) - } + const filterData = this.stationList.filter((station) => + station.stationCode.toLowerCase().includes(this.stationName.toLowerCase()) + ) + const set = new Set(filterData.map((item) => item.countryCode)) + const originalTreeData = Array.from(set).map((countryCode, index) => { + return { + title: countryCode, + key: index.toString(), + disabled: true, + children: filterData + .filter((item) => item.countryCode == countryCode) + .map((item) => ({ title: item.stationCode, key: item.stationId.toString(), children: [] })), + } + }) + return this.handleTreeData(cloneDeep(originalTreeData), this.targetKeys, 0) + }, }, watch: { currentMonth() { this.currentDate = this.currentMonth.clone() this.getList() - } - } + }, + }, }