From 7f9fa06dc3c1ebf612393974904f544bd8abe252 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期四, 26 十二月 2024 14:33:11 +0800
Subject: [PATCH] 历史记录也不能编辑删除
---
src/components/do/a6-facilities-environment/facilities-environmental-conditions/lightning-protection-detection.vue | 56 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/src/components/do/a6-facilities-environment/facilities-environmental-conditions/lightning-protection-detection.vue b/src/components/do/a6-facilities-environment/facilities-environmental-conditions/lightning-protection-detection.vue
index c99a0d4..90ab5ed 100644
--- a/src/components/do/a6-facilities-environment/facilities-environmental-conditions/lightning-protection-detection.vue
+++ b/src/components/do/a6-facilities-environment/facilities-environmental-conditions/lightning-protection-detection.vue
@@ -96,11 +96,11 @@
class="upload-demo"
drag
action="#"
- :on-remove="handleRemove"
:http-request="httpRequest"
:file-list="form.fileList"
:on-exceed="handleExceed"
:limit="1"
+ :accept="'.jpg,.jpeg,.png'"
multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
@@ -119,7 +119,7 @@
</template>
<script>
-
+import fileDownload from '../../../../util/file'
export default {
data() {
return {
@@ -154,13 +154,33 @@
downLoadPost() {
this.$axios.get(this.$api.facilitiesAndEnvironment.exportOfLightningProtectionDetection,{responseType: "blob"}).then(res => {
this.outLoading = false
- this.$message.success('瀵煎嚭鎴愬姛')
const blob = new Blob([res],{ type: 'application/msword' });
- const url = URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = '闃查浄妫�娴嬪鍑�' + '.xlsx';
- link.click();
+ //灏咮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('瀵煎嚭鎴愬姛')
+ }
+ }
})
},
initData() {
@@ -187,6 +207,7 @@
},
// 瑕嗙洊榛樿鐨勪笂浼犺涓猴紝鍙互鑷畾涔変笂浼犵殑瀹炵幇锛屽皢涓婁紶鐨勬枃浠朵緷娆℃坊鍔犲埌fileList鏁扮粍涓�,鏀寔澶氫釜鏂囦欢
httpRequest(option) {
+ this.form.fileData = []
this.form.fileData.push(option)
},
addImport() {
@@ -234,25 +255,10 @@
})
})
},
- handleRemove(file) {
- this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + file.name).then(res => {
- if (res.code === 201) return;
- this.$message.success('鍒犻櫎鎴愬姛锛�')
- let index = this.form.fileList.indexOf(fileName)
- if (index != -1) {
- this.successFileList.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();
+ url = this.javaApi + '/img/' + row.systemFileName
+ fileDownload.downloadIamge(url, row.fileName)
}
}
}
--
Gitblit v1.9.3