From 379ad4226bc5a3ad175635b5c40e6bf5b68e4069 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 三月 2025 13:30:59 +0800
Subject: [PATCH] 能力范围功能更新70%

---
 src/views/structural/capabilityAndLaboratory/capabilityComponents/bindPartDialog.vue |  175 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 144 insertions(+), 31 deletions(-)

diff --git a/src/views/structural/capabilityAndLaboratory/capabilityComponents/bindPartDialog.vue b/src/views/structural/capabilityAndLaboratory/capabilityComponents/bindPartDialog.vue
index bf2716e..92e3e56 100644
--- a/src/views/structural/capabilityAndLaboratory/capabilityComponents/bindPartDialog.vue
+++ b/src/views/structural/capabilityAndLaboratory/capabilityComponents/bindPartDialog.vue
@@ -1,22 +1,20 @@
 <template>
   <div>
     <el-dialog title="闆朵欢缁戝畾" :visible.sync="isShow" width="800px" @close="$emit('closeBindPartDialog')">
-      <lims-table :tableData="tableData" :column="column" height="460"
-                  :page="page" :tableLoading="tableLoading"></lims-table>
+      <lims-table :tableData="tableData" :column="column" height="460" :page="page" :tableLoading="tableLoading"
+        :key="1"></lims-table>
       <span slot="footer" class="dialog-footer">
         <el-button @click="$emit('closeBindPartDialog')">鍙� 娑�</el-button>
         <el-button type="primary" @click="addBindPart('add')" :loading="addBindLoad">鏂� 澧�</el-button>
       </span>
     </el-dialog>
     <el-dialog :title="dialogTitle" :visible.sync="addBindPartDialog" width="400px" @close="closeBindPartDialog"
-               :close-on-click-modal="false" >
+      :close-on-click-modal="false">
       <div class="body" v-if="addBindPartDialog">
-        <el-form label-position="right" label-width="80px"
-                 ref="bindPartData"
-                 :rules="bindPartDataRules"
-                 :model="bindPartData">
+        <el-form label-position="right" label-width="80px" ref="bindPartData" :rules="bindPartDataRules"
+          :model="bindPartData">
           <el-form-item label="闆朵欢鍙凤細" prop="partNo">
-            <el-input v-model="bindPartData.partNo" size="small"></el-input>
+            <el-input v-model="bindPartData.partNo" size="small" :disabled="dialogTitle == '淇敼闆朵欢缁戝畾'"></el-input>
           </el-form-item>
           <el-form-item label="棰滆壊锛�" prop="color">
             <el-input v-model="bindPartData.color" size="small"></el-input>
@@ -24,12 +22,30 @@
           <el-form-item label="鑹叉爣锛�" prop="colorCode">
             <el-input v-model="bindPartData.colorCode" size="small"></el-input>
           </el-form-item>
+          <el-form-item label="杩涘巶妫�楠岄」锛�" prop="inspectionItem" v-if="currentObj.objectType == '鍘熸潗鏂�'" label-width="100px">
+            <!-- <el-input v-model="bindPartData.inspectionItem" disabled placeholder="閫夋嫨妫�楠岄」" size="small">
+              <template slot="append">
+                <el-button slot="append" icon="el-icon-search" @click="openItems"></el-button>
+              </template>
+</el-input> -->
+            <el-select v-model="bindPartData.inspectionItem" multiple collapse-tags placeholder="璇烽�夋嫨" size="small">
+              <el-option v-for="item in itemList" :key="item.inspectionItem" :label="item.inspectionItem"
+                :value="item.inspectionItem">
+              </el-option>
+            </el-select>
+          </el-form-item>
         </el-form>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="closeBindPartDialog">鍙� 娑�</el-button>
         <el-button type="primary" @click="submitBind" :loading="bindLoad">纭� 璁�</el-button>
       </span>
+    </el-dialog>
+    <el-dialog title="淇敼璁板綍" :visible.sync="editItem" width="600px">
+      <div class="body" v-if="editItem">
+        <lims-table :tableData="editList" :column="editColumn" height="460px" :tableLoading="tableLoading0" :key="2"
+          :page="editPage" @pagination="editPagination"></lims-table>
+      </div>
     </el-dialog>
   </div>
 </template>
@@ -40,14 +56,13 @@
   addProductPart,
   addTestObjectPart, deleteProductPart, deleteTestObjectPart,
   selectByProductId,
-  selectByTestObjectId, updateProductPart, updateTestObjectPart
+  selectByTestObjectId, updateProductPart, updateTestObjectPart, inspectionItems, productPartReview
 } from "@/api/structural/structureTestObjectPart";
-import {delProduct} from "@/api/structural/capability";
 
 export default {
   name: "bindPartDialog",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
-  components: {limsTable},
+  components: { limsTable },
   props: {
     bindPartDialog: {
       type: Boolean,
@@ -57,10 +72,14 @@
       type: Number,
       default: () => null
     },
-    currentRow : { // 閫夋嫨鏈潯鏁版嵁鐨勪俊鎭�
+    currentRow: { // 閫夋嫨鏈潯鏁版嵁鐨勪俊鎭�
       type: Object,
-      default: () => {}
-    }
+      default: () => { }
+    },
+    currentObj: {//褰撳墠瀵硅薄
+      type: Object,
+      default: () => { }
+    },
   },
   data() {
     // 杩欓噷瀛樻斁鏁版嵁
@@ -71,9 +90,20 @@
       tableData: [],
       tableLoading: false,
       column: [
-        {label: '闆朵欢鍙�', prop: 'partNo'},
-        {label: '棰滆壊', prop: 'color'},
-        {label: '鑹叉爣', prop: 'colorCode'},
+        { label: '闆朵欢鍙�', prop: 'partNo' },
+        { label: '棰滆壊', prop: 'color' },
+        { label: '鑹叉爣', prop: 'colorCode' },
+        {
+          label: '鐘舵��', prop: 'review',
+          dataType: "tag",
+          formatType: (params) => {
+            if (params == '寰呭鏍�') {
+              return 'danger'
+            } else {
+              return 'success'
+            }
+          },
+        },
         {
           dataType: 'action',
           fixed: 'right',
@@ -93,13 +123,40 @@
                 this.delete(row);
               },
             },
+            {
+              name: '澶嶆牳',
+              type: 'text',
+              clickFun: (row) => {
+                this.$confirm("鏄惁澶嶆牳閫氳繃?", "澶嶆牳", {
+                  confirmButtonText: "纭畾",
+                  cancelButtonText: "鍙栨秷",
+                  type: "warning",
+                })
+                  .then(() => {
+                    productPartReview({ id: row.id }).then((res) => {
+                      if (res.code == 200) {
+                        this.$message.success("澶嶆牳閫氳繃");
+                        this.getList()();
+                      }
+                    });
+                  })
+                  .catch(() => { });
+              },
+            },
+            {
+              name: '璁板綍',
+              type: 'text',
+              clickFun: (row) => {
+                this.lookList(row);
+              },
+            },
           ]
         }
       ],
       page: {
-        total:0,
-        size:10,
-        current:1,
+        total: 0,
+        size: 10,
+        current: 1,
         layout: 'total, prev, pager, next'
       },
       bindPartComponent: {
@@ -135,6 +192,7 @@
         partNo: '', // 闆朵欢鍙�
         color: '', // 棰滆壊
         colorCode: '', // 鑹叉爣
+        inspectionItem: [],//鍘熸潗鏂欒繘鍘傛楠屽璞″垪琛�
       },
       bindPartDataRules: {
         partNo: [
@@ -143,19 +201,60 @@
       },
       bindLoad: false,
       upIndex: 0,
+
       addBindLoad: false,
+      itemList: [],//鍘熸潗鏂欒繘鍘傛楠屽璞″垪琛�
+      editItem: false,
+      editList: [],
+      editColumn: [
+        { label: '闆朵欢鍙�', prop: 'inspectionItem' },
+        { label: '棰滆壊', prop: 'inspectionItemSubclass' },
+        { label: '鑹叉爣', prop: 'ask' },
+        { label: '杩涘巶妫�楠岄」', prop: 'askTell' },
+        { label: '淇敼鏃堕棿', prop: 'method' },
+        { label: '淇敼浜�', prop: 'method' },
+      ],
+      editPage: {
+        total: 0,
+        size: 10,
+        current: 0,
+      },
+      tableLoading0: false,
+      // mutilSelect: []
     }
   },
   mounted() {
     this.getList()
+    this.getItemList()
   },
   // 鏂规硶闆嗗悎
   methods: {
+    getItemList() {
+      // this.tableLoading0 = true;
+      inspectionItems({
+        sample: this.currentObj.specimenName,
+        productName: this.type == 0 ? null : this.currentRow.name
+      }).then(res => {
+        this.itemList = res.data
+        // this.tableLoading0 = false;
+      })
+    },
+    // 淇敼璁板綍
+    lookList() {
+      this.editItem = true;
+      this.getEditList()
+    },
+    getEditList() { },
+    editPagination() {
+      this.editPage.current = page;
+      this.editPage.size = limit;
+      this.getEditList();
+    },
     getList() {
       this.tableLoading = true
       // 鏍规嵁绫诲瀷鍒ゆ柇鏄楠屽璞¢浂浠剁粦瀹氳繕鏄骇鍝佺淮鎶ら浂浠剁粦瀹�
       if (this.type === 0) {
-        selectByTestObjectId({testObjectId: this.currentRow.id}).then(res => {
+        selectByTestObjectId({ testObjectId: this.currentRow.id }).then(res => {
           this.tableLoading = false
           if (res.code === 200) {
             this.tableData = res.data.records
@@ -165,7 +264,7 @@
           this.tableLoading = false
         })
       } else {
-        selectByProductId({productId: this.currentRow.id}).then(res => {
+        selectByProductId({ productId: this.currentRow.id }).then(res => {
           this.tableLoading = false
           if (res.code === 200) {
             this.tableData = res.data.records
@@ -176,16 +275,17 @@
         })
       }
     },
-    addBindPart (type, row) {
+    addBindPart(type, row) {
       this.addBindPartDialog = true
       this.dialogTitle = type === 'add' ? '鏂板闆朵欢缁戝畾' : '淇敼闆朵欢缁戝畾'
       this.operationType = type
       if (type === 'edit') {
         this.bindPartData = this.HaveJson(row)
+        this.bindPartData.inspectionItem = this.bindPartData.inspectionItem ? this.bindPartData.inspectionItem.split(',') : []
       }
     },
     // 鎻愪氦闆朵欢缁戝畾
-    submitBind () {
+    submitBind() {
       this.$refs['bindPartData'].validate((valid) => {
         if (valid) {
           // 鏍规嵁绫诲瀷鍒ゆ柇鏄楠屽璞¢浂浠剁粦瀹氳繕鏄骇鍝佺淮鎶ら浂浠剁粦瀹�
@@ -194,16 +294,19 @@
             color: this.bindPartData.color,
             colorCode: this.bindPartData.colorCode,
             partNo: this.bindPartData.partNo,
-            } : {
+            inspectionItem: this.bindPartData.inspectionItem && this.bindPartData.inspectionItem.length > 0 ? this.bindPartData.inspectionItem.join(',') : ''
+          } : {
             productId: this.currentRow.id,
             color: this.bindPartData.color,
             colorCode: this.bindPartData.colorCode,
             partNo: this.bindPartData.partNo,
+            inspectionItem: this.bindPartData.inspectionItem && this.bindPartData.inspectionItem.length > 0 ? this.bindPartData.inspectionItem.join(',') : ''
           }
           this.bindLoad = true
           if (this.operationType === 'add') {
             if (this.type === 0) {
               addTestObjectPart(params).then(res => {
+                this.bindLoad = false
                 if (res.code === 200) {
                   this.resetForm('bindPartData')
                   this.addBindPartDialog = false
@@ -260,21 +363,21 @@
         }
       })
     },
-    delete (row) {
+    delete(row) {
       this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
         if (this.type === 0) {
-          deleteTestObjectPart({id:row.id}).then(res => {
+          deleteTestObjectPart({ id: row.id }).then(res => {
             if (res.code === 200) {
               this.$message.success('鍒犻櫎鎴愬姛')
               this.getList();
             }
           })
         } else {
-          deleteProductPart({id:row.id}).then(res => {
+          deleteProductPart({ id: row.id }).then(res => {
             if (res.code === 200) {
               this.$message.success('鍒犻櫎鎴愬姛')
               this.getList();
@@ -288,13 +391,23 @@
         });
       })
     },
-    closeBindPartDialog () {
+    closeBindPartDialog() {
       this.resetForm('bindPartData')
       this.addBindPartDialog = false
     },
+    // openItems() {
+    //   this.mutilSelect = this.bindPartData.inspectionItem ? this.bindPartData.inspectionItem.split(',') : []
+    //   this.$refs.itemTable.toggleRowSelection(this.mutilSelect)
+    //   this.addBindItem = true;
+    // },
+    // submitBindItem() {
+    //   this.bindPartData.inspectionItem = this.mutilSelect.join(',')
+    // },
+    // handleSelectionChange(val) {
+    //   this.mutilSelect = val
+    // }
   },
 }
 </script>
 
-<style scoped>
-</style>
+<style scoped></style>

--
Gitblit v1.9.3