From dab59f7624a2fb8d4114bb67b554ff09d91f810c Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 10 四月 2025 13:07:36 +0800
Subject: [PATCH] Merge branch 'radio-frequency-cable' of http://114.132.189.42:9002/r/lims-ruoyi-before into radio-frequency-cable

---
 src/views/CNAS/process/method/standardMethod/index.vue |  258 +++++++++++++++------------------------------------
 1 files changed, 75 insertions(+), 183 deletions(-)

diff --git a/src/views/CNAS/process/method/standardMethod/index.vue b/src/views/CNAS/process/method/standardMethod/index.vue
index 1b63b97..f13b8ba 100644
--- a/src/views/CNAS/process/method/standardMethod/index.vue
+++ b/src/views/CNAS/process/method/standardMethod/index.vue
@@ -1,25 +1,6 @@
 <style scoped>
 .search {
-  background-color: #fff;
-  height: 80px;
   display: flex;
-  align-items: center;
-}
-
-.search_thing {
-  width: 350px;
-  display: flex;
-  align-items: center;
-}
-
-.search_label {
-  width: 110px;
-  font-size: 14px;
-  text-align: right;
-}
-
-.search_input {
-  width: calc(100% - 110px);
 }
 
 .table {
@@ -32,162 +13,75 @@
 </style>
 
 <template>
-  <div class="standard_method">
+  <div class="capacity-scope">
     <div class="search">
-      <div class="search_thing">
-        <div class="search_label">鏍囧噯缂栧彿锛�</div>
-        <div class="search_input">
-          <el-input
-            size="small"
-            placeholder="璇疯緭鍏�"
-            clearable
-            v-model="queryParams.code"
-            @keyup.enter.native="refreshTable()"
-          ></el-input>
-        </div>
+      <div>
+        <el-form :model="queryParams" ref="queryParams" size="small" :inline="true">
+          <el-form-item label="鏍囧噯缂栧彿" prop="code">
+            <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.code"
+              @keyup.enter.native="refreshTable()"></el-input>
+          </el-form-item>
+          <el-form-item label="鏍囧噯鍚嶇О" prop="name">
+            <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.name"
+              @keyup.enter.native="refreshTable()"></el-input>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" size="mini" @click="refreshTable">鏌ヨ</el-button>
+            <el-button size="mini" @click="refresh">閲嶇疆</el-button>
+          </el-form-item>
+        </el-form>
       </div>
-      <div class="search_thing">
-        <div class="search_label">鏍囧噯鍚嶇О锛�</div>
-        <div class="search_input">
-          <el-input
-            size="small"
-            placeholder="璇疯緭鍏�"
-            clearable
-            v-model="queryParams.name"
-            @keyup.enter.native="refreshTable()"
-          ></el-input>
-        </div>
-      </div>
-      <div class="search_thing" style="padding-left: 30px">
-        <el-button size="small" @click="refresh()">閲� 缃�</el-button>
-        <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
-        >
+      <div class="btn" style="padding-top: 0px;">
+        <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="mini" type="primary">瀵煎叆</el-button>
+        </el-upload>
+        <el-button size="mini" type="primary" @click="openAdd">鏂板</el-button>
       </div>
     </div>
-    <lims-table
-      :tableData="tableData"
-      :column="column"
-      :page="page"
-      :tableLoading="tableLoading"
-      :height="'calc(100vh - 250px)'"
-      style="padding: 20px; padding-top: 0"
-      @pagination="pagination"
-    ></lims-table>
+    <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
+      :height="'calc(100vh - 250px)'" @pagination="pagination"></lims-table>
     <!-- 鏂板/缂栬緫 -->
     <el-dialog :title="title" :visible.sync="addDlog" width="500px">
-      <el-form
-        :model="addForm"
-        ref="addForm"
-        :rules="addRules"
-        label-position="right"
-        label-width="120px"
-      >
+      <el-form :model="addForm" ref="addForm" :rules="addRules" label-position="right" label-width="120px">
         <el-form-item label="棰嗗煙" prop="field">
-          <el-input
-            size="small"
-            placeholder="璇疯緭鍏�"
-            clearable
-            v-model="addForm.field"
-          ></el-input>
+          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addForm.field"></el-input>
         </el-form-item>
         <el-form-item label="鏍囧噯缂栧彿" prop="code">
-          <el-input
-            size="small"
-            placeholder="璇疯緭鍏�"
-            clearable
-            v-model="addForm.code"
-          >
+          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addForm.code">
           </el-input>
         </el-form-item>
         <el-form-item label="妫�楠屽璞�" prop="structureTestObjectId">
-          <el-cascader
-            size="small"
-            :options="tandardTree"
-            v-model="addForm.structureTestObjectId"
-            collapse-tags
-            :props="{ multiple: true, checkStrictly: true }"
-            clearable
-            style="width: 100%"
-          ></el-cascader>
+          <el-cascader size="small" :options="tandardTree" v-model="addForm.structureTestObjectId" collapse-tags
+            :props="{ multiple: true, checkStrictly: true }" clearable style="width: 100%"></el-cascader>
         </el-form-item>
         <el-form-item label="鏍囧噯鎻忚堪" prop="name">
-          <el-input
-            size="small"
-            placeholder="璇疯緭鍏�"
-            clearable
-            v-model="addForm.name"
-          >
+          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addForm.name">
           </el-input>
         </el-form-item>
         <el-form-item label="鏍囧噯鎻忚堪EN" prop="nameEn">
-          <el-input
-            size="small"
-            placeholder="璇疯緭鍏�"
-            clearable
-            v-model="addForm.nameEn"
-          >
+          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addForm.nameEn">
           </el-input>
         </el-form-item>
         <el-form-item label="澶囨敞" prop="remark">
-          <el-input
-            size="small"
-            placeholder="璇疯緭鍏�"
-            clearable
-            v-model="addForm.remark"
-          >
+          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addForm.remark">
           </el-input>
         </el-form-item>
         <el-form-item label="璧勮川" prop="qualificationId">
-          <el-select
-            v-model="addForm.qualificationId"
-            size="small"
-            clearable
-            placeholder="璇烽�夋嫨"
-            style="width: 100%"
-          >
-            <el-option
-              v-for="item in qualificationList"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            >
+          <el-select v-model="addForm.qualificationId" size="small" clearable placeholder="璇烽�夋嫨" style="width: 100%">
+            <el-option v-for="item in qualificationList" :key="item.value" :label="item.label" :value="item.value">
             </el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="鏄惁浜у搧鏍囧噯" prop="isProduct">
-          <el-select
-            v-model="addForm.isProduct"
-            size="small"
-            clearable
-            placeholder="璇烽�夋嫨"
-            style="width: 100%"
-          >
+          <el-select v-model="addForm.isProduct" size="small" clearable placeholder="璇烽�夋嫨" style="width: 100%">
             <el-option label="鍚�" :value="0"> </el-option>
             <el-option label="鏄�" :value="1"> </el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="鏄惁鍚敤" prop="isUse">
-          <el-select
-            v-model="addForm.isUse"
-            size="small"
-            clearable
-            placeholder="璇烽�夋嫨"
-            style="width: 100%"
-          >
+          <el-select v-model="addForm.isUse" size="small" clearable placeholder="璇烽�夋嫨" style="width: 100%">
             <el-option label="鍚�" :value="0"> </el-option>
             <el-option label="鏄�" :value="1"> </el-option>
           </el-select>
@@ -195,12 +89,7 @@
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="addDlog = false">鍙� 娑�</el-button>
-        <el-button
-          :loading="addLoading"
-          type="primary"
-          @click="submitProduct('addForm')"
-          >纭� 璁�</el-button
-        >
+        <el-button :loading="addLoading" type="primary" @click="submitProduct('addForm')">纭� 璁�</el-button>
       </span>
     </el-dialog>
   </div>
@@ -216,11 +105,13 @@
   upStandardMethod,
 } from "@/api/cnas/process/method/standardMethod";
 export default {
+  name: 'StandardMethod',
   components: {
     limsTable,
   },
   data() {
     return {
+      uploadAction: process.env.VUE_APP_BASE_API + '/standardMethod/importStandardDetails',
       addPower: true,
       title: "鏂板",
       inPower: true,
@@ -280,18 +171,12 @@
           dataType: "action",
           fixed: "right",
           label: "鎿嶄綔",
-          width: "120px",
           operation: [
             {
               name: "缂栬緫",
               type: "text",
               clickFun: (row) => {
-                this.title = "缂栬緫";
-                this.addForm = row;
-                this.addForm.structureTestObjectId = JSON.parse(
-                  this.addForm.structureTestObjectId
-                );
-                this.addDlog = true;
+                this.openEdit(row)
               },
             },
             {
@@ -368,34 +253,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) => {
@@ -417,7 +286,7 @@
       });
     },
     cascaderFieldData(val) {
-      if (val.children === undefined) {
+      if (val.children === undefined || !val.children) {
         return;
       } else if (val.children.length == 0) {
         delete val.children;
@@ -469,6 +338,7 @@
         }
       });
     },
+    // 鍒犻櫎
     handleDelete(row) {
       this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
         confirmButtonText: "纭畾",
@@ -477,12 +347,34 @@
       })
         .then(() => {
           delStandardMethod({ id: row.id }).then((res) => {
-            if (res.code == 201) return;
             this.$message.success("鍒犻櫎鎴愬姛");
             this.getList();
           });
         })
-        .catch(() => {});
+        .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()
     },
   },
 };

--
Gitblit v1.9.3