From edd5a30abe84ac56716f43f40c1ede47e26ac14a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 05 三月 2025 15:11:51 +0800
Subject: [PATCH] 实验室检测能力档案搬迁

---
 src/api/cnas/process/method/standardMethod.js              |   56 +++++++
 src/views/CNAS/process/method/methodVerification/index.vue |    2 
 src/views/CNAS/process/method/standardMethod/index.vue     |  397 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 454 insertions(+), 1 deletions(-)

diff --git a/src/api/cnas/process/method/standardMethod.js b/src/api/cnas/process/method/standardMethod.js
new file mode 100644
index 0000000..0d64b8b
--- /dev/null
+++ b/src/api/cnas/process/method/standardMethod.js
@@ -0,0 +1,56 @@
+// 瀹為獙瀹ょ殑妫�娴嬭兘鍔涙。妗堢浉鍏虫帴鍙�
+import request from "@/utils/request";
+
+//鑾峰彇鏍囧噯鏂规硶鍒楄〃
+export function selectStandardMethodList(query) {
+  return request({
+    url: "/standardMethod/selectStandardMethodList",
+    method: "get",
+    params: query,
+  });
+}
+
+//鍒犻櫎鏍囧噯鏂规硶
+export function delStandardMethod(query) {
+  return request({
+    url: "/standardMethod/delStandardMethod",
+    method: "delete",
+    params: query,
+  });
+}
+
+// 娣诲姞鏍囧噯鏂规硶
+export function addStandardMethod(data) {
+  return request({
+    url: "/standardMethod/addStandardMethod",
+    method: "post",
+    data: data,
+  });
+}
+
+// 淇敼鏍囧噯鏂规硶
+export function upStandardMethod(data) {
+  return request({
+    url: "/standardMethod/upStandardMethod",
+    method: "post",
+    data: data,
+  });
+}
+
+//鑾峰彇浜у搧鏋舵瀯
+export function getStandardTree2(query) {
+  return request({
+    url: "/standardTree/getStandardTree2",
+    method: "get",
+    params: query,
+  });
+}
+
+// 瀵煎叆鏍囧噯鏄庣粏
+export function importStandardDetails(data) {
+  return request({
+    url: "/standardMethod/importStandardDetails",
+    method: "post",
+    data: data,
+  });
+}
diff --git a/src/views/CNAS/process/method/methodVerification/index.vue b/src/views/CNAS/process/method/methodVerification/index.vue
index cb1e371..096b9ee 100644
--- a/src/views/CNAS/process/method/methodVerification/index.vue
+++ b/src/views/CNAS/process/method/methodVerification/index.vue
@@ -20,7 +20,7 @@
             <template v-slot:table>
               <limsTable :column="tableColumn" :height="'calc(100vh - 17em)'" :table-data="tableData"
                 :table-loading="tableLoading" style="padding: 0 15px;margin-bottom: 16px" :page="page"
-                @pagination="pagination1">
+                @pagination="pagination">
               </limsTable>
             </template>
           </TableCard>
diff --git a/src/views/CNAS/process/method/standardMethod/index.vue b/src/views/CNAS/process/method/standardMethod/index.vue
new file mode 100644
index 0000000..bb4602e
--- /dev/null
+++ b/src/views/CNAS/process/method/standardMethod/index.vue
@@ -0,0 +1,397 @@
+<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 {
+  margin-top: 10px;
+  background-color: #fff;
+  width: calc(100% - 40px);
+  height: calc(100% - 60px - 80px - 10px - 40px);
+  padding: 20px;
+}
+</style>
+
+<template>
+  <div class="standard_method">
+    <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>
+      <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>
+    </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>
+    <!-- 鏂板/缂栬緫 -->
+    <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-item label="棰嗗煙" prop="field">
+          <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>
+        </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-form-item>
+        <el-form-item label="鏍囧噯鎻忚堪" prop="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>
+        </el-form-item>
+        <el-form-item label="澶囨敞" prop="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-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-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-option label="鍚�" :value="0"> </el-option>
+            <el-option label="鏄�" :value="1"> </el-option>
+          </el-select>
+        </el-form-item>
+      </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>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+  selectStandardMethodList,
+  getStandardTree2,
+  delStandardMethod,
+  addStandardMethod,
+  upStandardMethod,
+} from "@/api/cnas/process/method/standardMethod";
+export default {
+  name: 'StandardMethod',
+  components: {
+    limsTable,
+  },
+  data() {
+    return {
+      addPower: true,
+      title: "鏂板",
+      inPower: true,
+      queryParams: {},
+      tableData: [],
+      column: [
+        { label: "棰嗗煙", prop: "field", width: "100px" },
+        { label: "鏍囧噯缂栧彿", prop: "code", width: "100px" },
+        { label: "妫�楠屽璞�", prop: "structureTestObjectId", width: "140px" },
+        { label: "鏍囧噯鎻忚堪", prop: "name", width: "100px" },
+        { label: "鏍囧噯鎻忚堪EN", prop: "nameEn", width: "100px" },
+        { label: "澶囨敞", prop: "remark" },
+        { label: "璧勮川", prop: "qualificationId" },
+        {
+          label: "鏄惁浜у搧鏍囧噯",
+          prop: "isProduct",
+          width: "100px",
+          dataType: "tag",
+          formatData: (params) => {
+            if (params == 0) {
+              return "鍚�";
+            } else {
+              return "鏄�";
+            }
+          },
+          formatType: (params) => {
+            if (params == 0) {
+              return "danger";
+            } else {
+              return "primary";
+            }
+          },
+        },
+        {
+          label: "鏄惁鍚敤",
+          prop: "isUse",
+          formatData: (params) => {
+            if (params == 0) {
+              return "鍚�";
+            } else {
+              return "鏄�";
+            }
+          },
+          formatType: (params) => {
+            if (params == 0) {
+              return "danger";
+            } else {
+              return "primary";
+            }
+          },
+        },
+        { label: "鍒涘缓浜�", prop: "createUserName" },
+        { label: "鍒涘缓鏃堕棿", prop: "createTime" },
+        { label: "鏇存柊浜�", prop: "updateUserName" },
+        { label: "鏇存柊鏃堕棿", prop: "updateTime" },
+        {
+          dataType: "action",
+          fixed: "right",
+          label: "鎿嶄綔",
+          operation: [
+            {
+              name: "缂栬緫",
+              type: "text",
+              clickFun: (row) => {
+                this.title = "缂栬緫";
+                this.addForm = row;
+                this.addForm.structureTestObjectId = JSON.parse(
+                  this.addForm.structureTestObjectId
+                );
+                this.addDlog = true;
+              },
+            },
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDelete(row);
+              },
+            },
+          ],
+        },
+      ],
+      page: {
+        total: 0,
+        size: 10,
+        current: 1,
+      },
+      tableLoading: false,
+      addForm: {},
+      addDlog: false,
+      addLoading: false,
+      qualificationList: [],
+      tandardTree: [],
+      addRules: {
+        code: [{ required: true, message: "璇疯緭鍏ユ爣鍑嗙紪鍙�", trigger: "blur" }],
+        name: [{ required: true, message: "璇疯緭鍏ユ爣鍑嗘弿杩�", trigger: "blur" }],
+        nameEn: [
+          { required: true, message: "璇疯緭鍏ユ爣鍑嗘弿杩癊N", trigger: "blur" },
+        ],
+        isProduct: [
+          { required: true, message: "璇烽�夋嫨鏄惁浜у搧鏍囧噯", trigger: "change" },
+        ],
+        isUse: [
+          { required: true, message: "璇烽�夋嫨鏄惁鍚敤", trigger: "change" },
+        ],
+      },
+    };
+  },
+  mounted() {
+    this.getQualificationList();
+    this.selectTestObjectByName();
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.tableLoading = true;
+      let param = { ...this.queryParams, ...this.page };
+      delete param.total;
+      selectStandardMethodList({ ...param })
+        .then((res) => {
+          this.tableLoading = false;
+          if (res.code === 200) {
+            this.tableData = res.data.records;
+            this.page.total = res.data.total;
+          }
+        })
+        .catch((err) => {
+          this.tableLoading = false;
+        });
+    },
+    pagination({ page, limit }) {
+      this.page.current = page;
+      this.page.size = limit;
+      this.getList();
+    },
+    refreshTable() {
+      this.page.current = 1;
+      this.getList();
+      this.selectTestObjectByName();
+    },
+    refresh() {
+      this.selectTestObjectByName();
+      this.page.current = 1;
+      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;
+    },
+    getQualificationList() {
+      this.getDicts("cnas_method_qualification").then((response) => {
+        let arr = response.data.map((m) => {
+          return {
+            label: m.dictLabel,
+            value: m.dictValue,
+          };
+        });
+        this.qualificationList = arr;
+      });
+    },
+    selectTestObjectByName() {
+      getStandardTree2().then((res) => {
+        res.data.forEach((a) => {
+          this.cascaderFieldData(a);
+        });
+        this.tandardTree = res.data;
+      });
+    },
+    cascaderFieldData(val) {
+      if (val.children === undefined) {
+        return;
+      } else if (val.children.length == 0) {
+        delete val.children;
+      } else {
+        val.children.forEach((a) => {
+          this.cascaderFieldData(a);
+        });
+      }
+    },
+    submitProduct(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.addLoading = true;
+          let addForm = JSON.parse(JSON.stringify(this.addForm));
+          addForm.structureTestObjectId = JSON.stringify(
+            addForm.structureTestObjectId
+          );
+          if (this.title == "鏂板") {
+            addStandardMethod(addForm)
+              .then((res) => {
+                this.addLoading = false;
+                if (res.code != 200) {
+                  return;
+                }
+                this.$message.success("鎻愪氦鎴愬姛");
+                this.getList();
+                this.addDlog = false;
+              })
+              .catch((err) => {
+                this.addLoading = false;
+              });
+          } else {
+            upStandardMethod(addForm)
+              .then((res) => {
+                this.addLoading = false;
+                if (res.code != 200) {
+                  return;
+                }
+                this.$message.success("鎻愪氦鎴愬姛");
+                this.getList();
+                this.addDlog = false;
+              })
+              .catch((err) => {
+                this.addLoading = false;
+              });
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+    handleDelete(row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          delStandardMethod({ id: row.id }).then((res) => {
+            if (res.code == 201) return;
+            this.$message.success("鍒犻櫎鎴愬姛");
+            this.getList();
+          });
+        })
+        .catch(() => { });
+    },
+  },
+};
+</script>

--
Gitblit v1.9.3