From 6404e15051c35af4a6a5d54a9e9cc8e6580b268d Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期三, 26 二月 2025 13:52:07 +0800 Subject: [PATCH] 设施和环境条件代码迁移 --- src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue | 78 ++++++++++++++++----------------------- 1 files changed, 32 insertions(+), 46 deletions(-) diff --git a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue index 165feb1..a9c7baa 100644 --- a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue +++ b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue @@ -198,11 +198,23 @@ </template> <script> +import { + getFeLightningProtection, + deviceScopeSearch, + selectUserCondition, + treeDevice, + addFeLightningProtection, + deleteFeLightningProtection, + getFeIlluminationDetectionArea, + deleteFeIlluminationDetectionArea, + exportFeIllumination +} from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment' + export default { data() { return { search: { - size: 20, + size: 10, current: 1, total: 0 }, @@ -251,17 +263,18 @@ } }, edit(row) { - this.$axios.get(this.$api.facilitiesAndEnvironment.getFeIlluminationDetectionArea + "?intensityIlluminationId=" + row.intensityIlluminationId).then(res => { + getFeIlluminationDetectionArea({intensityIlluminationId:row.intensityIlluminationId}).then(res => { this.form = {...row} this.form.illuminationDetectionAreaList = res.data; this.dialogVisible = true }); }, initData() { - this.$axios.get(this.$api.facilitiesAndEnvironment.getFeLightningProtection + '?size=' + this.search.size + '¤t=' + this.search.current).then(res => { - if (res.code === 201) return; - this.tableData = res.data.records; - this.search.total = res.data.total; + getFeLightningProtection({...this.search}).then(res => { + if (res.code === 200){ + this.tableData = res.data.records; + this.search.total = res.data.total; + } }); }, handleSizeChange(val) { @@ -278,7 +291,7 @@ cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeLightningProtection + '?intensityIlluminationId=' + row.intensityIlluminationId).then(res => { + deleteFeLightningProtection({intensityIlluminationId: row.intensityIlluminationId}).then(res => { this.$message.success('鍒犻櫎鎴愬姛锛�') this.initData() }) @@ -286,10 +299,11 @@ }, feMeasuredQuantityListDelete(row, index) { if (row.detectionAreaId) { - this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeIlluminationDetectionArea + '?detectionAreaId=' + row.detectionAreaId).then(res => { - if (res.code === 201) return - this.form.illuminationDetectionAreaList.splice(index, 1) - this.$message.success('鍒犻櫎鎴愬姛锛�') + deleteFeIlluminationDetectionArea({detectionAreaId:row.detectionAreaId}).then(res => { + if (res.code === 200){ + this.form.illuminationDetectionAreaList.splice(index, 1) + this.$message.success('鍒犻櫎鎴愬姛锛�') + } }) } else { this.form.illuminationDetectionAreaList.splice(index, 1) @@ -297,7 +311,7 @@ } }, openDialog() { - this.$axios.get(this.$api.deviceScope.treeDevice).then(res => { + treeDevice().then(res => { this.cascaderList = res.data; }); this.$nextTick(() => { @@ -312,7 +326,7 @@ // 鑾峰彇鎵�鏈夎澶� getEquipOptions() { this.equipOptions = [] - this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => { + deviceScopeSearch({status:'0'}).then(res => { if (res.code === 200 && res.data) { this.equipOptions = res.data } @@ -335,11 +349,7 @@ this.submitLoading = true this.$refs.form.validate((valid) => { if (valid) { - this.$axios.post(this.$api.facilitiesAndEnvironment.addFeLightningProtection, this.form, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { + addFeLightningProtection(this.form).then(res => { this.submitLoading = false if (res.code === 200) { this.initData() @@ -353,7 +363,7 @@ }, // 鑾峰彇璐熻矗浜轰俊鎭帴鍙� getUserList() { - this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { + selectUserCondition().then(res => { if (res.code == 200) { this.responsibleOptions = res.data } @@ -369,35 +379,11 @@ }, // 瀵煎嚭 downLoadPost(row) { - this.$axios.get(this.$api.facilitiesAndEnvironment.exportFeIllumination + '?intensityIlluminationId=' + row.intensityIlluminationId,{responseType: "blob"}).then(res => { + exportFeIllumination({intensityIlluminationId: row.intensityIlluminationId}).then(res => { this.outLoading = false const blob = new Blob([res],{ type: 'application/msword' }); - //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 - let reader = new FileReader(); - reader.readAsText(blob, 'utf-8'); - reader.onload = () => { - try { - let result = JSON.parse(reader.result); - if (result.message) { - this.$message.error(result.message); - } else { - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '鐓у害璁板綍' + '.docx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } catch (err) { - console.log(err); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '鐓у害璁板綍' + '.docx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } + this.$download.saveAs(blob, '鐓у害璁板綍.docx') + this.$message.success('瀵煎嚭鎴愬姛') }) }, } -- Gitblit v1.9.3