From d2e867966539004b6b5a73ae3566a659ac6f8b6d Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 30 十月 2025 11:55:34 +0800
Subject: [PATCH] 检验任务数据分类查询问题修复
---
src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue | 89 ++++++++++++++++++--------------------------
1 files changed, 36 insertions(+), 53 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue
index 57a7704..aecefa0 100644
--- a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue
+++ b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue
@@ -10,6 +10,7 @@
<el-table
:data="tableData"
height="calc(100vh - 18em)"
+ :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
style="width: 100%">
<el-table-column label="搴忓彿" type="index" width="120">
<template v-slot="scope">
@@ -46,7 +47,7 @@
</el-table>
<el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
:total="search.total" layout="->,total, sizes, prev, pager, next, jumper"
- @size-change="handleSizeChange"
+ @size-change="handleSizeChange" background
@current-change="handleCurrentChange">
</el-pagination>
<el-dialog
@@ -120,11 +121,21 @@
<script>
+import {
+ getLightningProtectionDetection,
+ addLightningProtectionDetection,
+ deleteLightningProtectionDetection,
+ exportOfLightningProtectionDetection
+} from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment'
+
+import axios from 'axios';
+import {deleteCNASFile} from "@/api/cnas/personal/personalList";
+
export default {
data() {
return {
search: {
- size: 20,
+ size: 10,
current: 1,
total: 0
},
@@ -152,42 +163,20 @@
methods: {
// 瀵煎嚭
downLoadPost() {
- this.$axios.get(this.$api.facilitiesAndEnvironment.exportOfLightningProtectionDetection,{responseType: "blob"}).then(res => {
+ exportOfLightningProtectionDetection().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 = '闃查浄妫�娴嬪鍑�' + '.xlsx';
- 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 = '闃查浄妫�娴嬪鍑�' + '.xlsx';
- link.click();
- this.$message.success('瀵煎嚭鎴愬姛')
- }
- }
+ this.$download.saveAs(blob,'闃查浄妫�娴嬪鍑�.xlsx')
})
},
initData() {
- this.$axios.get(this.$api.facilitiesAndEnvironment.getLightningProtectionDetection + '?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;
+ getLightningProtectionDetection({...this.search}).then(res => {
+ if (res.code === 200){
+ this.tableData = res.data.records;
+ this.search.total = res.data.total;
+ }
+
});
},
handleSizeChange(val) {
@@ -223,13 +212,11 @@
if (this.form.fileData.length > 0) {
params.append("file", this.form.fileData[0].file)
}
- this.$axios.post(this.$api.facilitiesAndEnvironment.addLightningProtectionDetection, params, {
- headers: {'Content-Type': 'multipart/form-data;'},
- noQs: true
- }).then(res => {
- if (res.code === 201) return;
- this.dialogVisible = false
- this.initData()
+ addLightningProtectionDetection(params).then(res => {
+ if (res.code === 200){
+ this.dialogVisible = false
+ this.initData()
+ }
});
}
});
@@ -248,31 +235,27 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteLightningProtectionDetection + '?lightningProtectionId=' + row.lightningProtectionId).then(res => {
+ deleteLightningProtectionDetection({lightningProtectionId:row.lightningProtectionId}).then(res => {
this.$message.success('鍒犻櫎鎴愬姛锛�')
this.initData()
})
})
},
handleRemove(file) {
- this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + file.name).then(res => {
- if (res.code === 201) return;
+ deleteCNASFile({fileName: file.name}).then(res => {
this.$message.success('鍒犻櫎鎴愬姛锛�')
- let index = this.form.fileList.indexOf(fileName)
- if (index != -1) {
- this.successFileList.splice(index, 1)
+ let index = this.form.fileList.indexOf(file.name)
+ if (index !== -1) {
+ this.form.fileList.splice(index, 1)
}
})
},
download(row) {
- let url = '';
-
- // fileDownload.downloadIamge(url, row.fileName)
- url = this.javaApi + 'img/' + row.systemFileName
- const link = document.createElement('a');
- link.href = url;
- link.download = row.fileName;
- link.click();
+ if (!row.systemFileName) {
+ this.$message.warning('鏆傛棤鏂囦欢')
+ return
+ }
+ this.$download.saveAs(row.systemFileName, row.fileName)
}
}
}
--
Gitblit v1.9.3