From 4ff4e1d736dff5434fcd28508df83af99b54a0d4 Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期四, 20 三月 2025 13:26:34 +0800 Subject: [PATCH] 能力范围、实验室能力档案功能变更 --- src/views/CNAS/process/method/standardMethod/index.vue | 74 ++++++++++++++++++++----------------- 1 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/views/CNAS/process/method/standardMethod/index.vue b/src/views/CNAS/process/method/standardMethod/index.vue index ead5404..4dc142a 100644 --- a/src/views/CNAS/process/method/standardMethod/index.vue +++ b/src/views/CNAS/process/method/standardMethod/index.vue @@ -53,10 +53,12 @@ <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> </div> <div class="btn"> - <!-- <el-button size="small" @click="$refs.ValueTable.openUpload()" v-if="inPower"> - <i class="el-icon-upload2" style="color: #3a7bfa"></i> - <span style="color: #3a7bfa">瀵煎叆</span></el-button> --> - <el-button size="small" type="primary" @click="openAdd" v-if="addPower">鏂板</el-button> + <el-upload ref='upload' style="display: inline;margin-right: 8px" :action="uploadAction" + :before-upload="beforeUpload" :headers="uploadHeader" :on-error="onError" :on-success="handleSuccessUp" + :show-file-list="false" accept='.xls,.xlsx'> + <el-button size="small" type="primary">瀵煎叆</el-button> + </el-upload> + <el-button size="small" type="primary" @click="openAdd">鏂板</el-button> </div> </div> <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" @@ -130,6 +132,7 @@ }, data() { return { + uploadAction: process.env.VUE_APP_BASE_API + '/standardMethod/importStandardDetails', addPower: true, title: "鏂板", inPower: true, @@ -194,12 +197,7 @@ name: "缂栬緫", type: "text", clickFun: (row) => { - this.title = "缂栬緫"; - this.addForm = row; - this.addForm.structureTestObjectId = JSON.parse( - this.addForm.structureTestObjectId - ); - this.addDlog = true; + this.openEdit(row) }, }, { @@ -276,34 +274,18 @@ this.queryParams = {}; this.getList(); }, - // 鏉冮檺鍒嗛厤 - getPower() { - let power = JSON.parse(sessionStorage.getItem("power")); - let up = false; - let del = false; - let add = false; - let inPower = false; - for (var i = 0; i < power.length; i++) { - if (power[i].menuMethod == "addStandardMethod") { - add = true; - } - if (power[i].menuMethod == "delStandardMethod") { - del = true; - } - if (power[i].menuMethod == "upStandardMethod") { - up = true; - } - if (power[i].menuMethod == "importStandardDetails") { - inPower = true; - } - } - this.addPower = add; - this.inPower = inPower; - }, openAdd() { this.title = "鏂板"; this.addForm = {}; this.addDlog = true; + }, + openEdit(row) { + this.title = "缂栬緫"; + this.addDlog = true; + this.addForm = this.HaveJson(row) + this.addForm.structureTestObjectId = JSON.parse( + this.addForm.structureTestObjectId + ); }, getQualificationList() { this.getDicts("cnas_method_qualification").then((response) => { @@ -377,6 +359,7 @@ } }); }, + // 鍒犻櫎 handleDelete(row) { this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { confirmButtonText: "纭畾", @@ -391,6 +374,29 @@ }) .catch(() => { }); }, + // 涓婁紶鏂囦欢 + beforeUpload(file, fileList) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + return false; + } else { + return true; + } + }, + onError(err, file, fileList) { + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + handleSuccessUp(response, file, fileList) { + this.$refs.upload.clearFiles() + if (response.code !== 200) { + this.$message.error(response.msg) + return + } + this.$message.success('涓婁紶鎴愬姛') + this.refreshTable() + }, }, }; </script> -- Gitblit v1.9.3