From 4bd9ecdb092c88d050e58d5a150b62e5e90b65b0 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期五, 14 三月 2025 16:10:14 +0800 Subject: [PATCH] 删除无用代码 --- src/views/CNAS/systemManagement/documentControl/components/FileList.vue | 90 ++++++++++++++++++++------------------------ 1 files changed, 41 insertions(+), 49 deletions(-) diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileList.vue b/src/views/CNAS/systemManagement/documentControl/components/FileList.vue index b3d2158..3720194 100644 --- a/src/views/CNAS/systemManagement/documentControl/components/FileList.vue +++ b/src/views/CNAS/systemManagement/documentControl/components/FileList.vue @@ -21,8 +21,9 @@ <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> </div> <div class="btns" style="padding-left: 30px;"> - <el-upload :action="action" :multiple="false" accept='.xls,.xlsx' :headers="headers" :on-change="beforeUpload" - :on-error="onError" ref='upload' :on-success="handleSuccessUp" :show-file-list="false"> + <el-upload :action="action" :multiple="false" accept='.xls,.xlsx' :headers="uploadHeader" + :on-change="beforeUpload" :on-error="onError" ref='upload' :on-success="handleSuccessUp" + :show-file-list="false"> <el-button size="small" type="primary" :loading="upLoading">瀵煎叆</el-button></el-upload> </div> </div> @@ -96,7 +97,6 @@ delManageDocumentList, doManageDocumentList, } from '@/api/cnas/systemManagement/documentControl.js' -import { getToken } from "@/utils/auth"; export default { components: { UpPdfStamp, @@ -121,10 +121,18 @@ { label: "绫诲埆", prop: "type", width: "120px", dataType: "tag", formatData: (params) => { - return this.fileType.find((m) => m.value == params).label; + if (this.fileType.find((m) => m.value == params)) { + return this.fileType.find((m) => m.value == params).label; + } else { + return null + } }, formatType: (params) => { - return this.fileType.find((m) => m.value == params).type; + if (this.fileType.find((m) => m.value == params)) { + return this.fileType.find((m) => m.value == params).type; + } else { + return null + } }, }, { @@ -137,10 +145,18 @@ { label: "鏂囦欢鐘舵��", prop: "state", dataType: "tag", formatData: (params) => { - return this.fileState.find((m) => m.value == params).label; + if (this.fileState.find((m) => m.value == params)) { + return this.fileState.find((m) => m.value == params).label; + } else { + return null + } }, formatType: (params) => { - return this.fileState.find((m) => m.value == params).type; + if (this.fileState.find((m) => m.value == params)) { + return this.fileState.find((m) => m.value == params).type; + } else { + return null + } }, }, { @@ -201,11 +217,6 @@ }, // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� computed: { - headers() { - return { - 'Authorization': "Bearer " + getToken() - } - }, action() { return this.javaApi + '/manageDocumentList/exportManageDocumentList' } @@ -257,38 +268,13 @@ // 涓嬭浇鏂囦欢 handleDown(row) { if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�') - let url = this.javaApi + '/word/' + row.url - this.$download.saveAs(url, row.url); + this.$download.saveAs(row.url, row.url); }, // 鏌ョ湅鏂囦欢 handleLook(row) { if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�') this.currentInfo = row this.lookDialogVisible = true - }, - getPower() { - let power = JSON.parse(sessionStorage.getItem('power')) - let up = false - let upFile = false - let add = false - for (var i = 0; i < power.length; i++) { - if (power[i].menuMethod == 'doManageDocumentList') { - up = true - } - if (power[i].menuMethod == 'exportManageDocumentList') { - add = true - } - if (power[i].menuMethod == 'uploadFileManageDocumentList') { - upFile = true - } - } - if (!upFile) { - this.componentData.do.splice(1, 1) - } - if (!up) { - this.componentData.do.splice(0, 1) - } - this.addPower = add }, // 涓婁紶鏂囦欢 handleUp(row) { @@ -322,6 +308,8 @@ if (response.code == 200) { this.$message.success('涓婁紶鎴愬姛'); this.refreshTable() + }else { + this.$message.error(response.msg); } }, selectEnumByCategory() { @@ -339,17 +327,22 @@ formData.append('file', pdfBlob, fileName); // 鏂囦欢瀛楁 formData.append('id', this.currentInfo.id); // 鏂囦欢鍚嶅瓧娈� - let res = await uploadFileManageDocumentList(formData) - this.addLoading = false - if (res.code == 200) { - this.$message({ message: '涓婁紶鎴愬姛', type: 'success' }); - this.addDialogVisible = false; - this.refreshTable() - return true - } else { - this.$message({ message: '涓婁紶澶辫触', type: 'error' }); - return false + try { + let res = await uploadFileManageDocumentList(formData) + this.addLoading = false + if (res.code == 200) { + this.$message({ message: '涓婁紶鎴愬姛', type: 'success' }); + this.addDialogVisible = false; + this.refreshTable() + return true + } else { + this.$message({ message: '涓婁紶澶辫触', type: 'error' }); + return false + } + } catch (e) { + this.addLoading = false } + }, handleDelete(row) { this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { @@ -359,7 +352,6 @@ }) .then(() => { delManageDocumentList({ id: row.id }).then((res) => { - if (res.code == 201) return; this.$message.success("鍒犻櫎鎴愬姛"); this.refresh(); }); -- Gitblit v1.9.3