From bd5c073e28f11235fe0ed7754ead4c0b52bc2ef0 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 28 五月 2024 18:01:06 +0800
Subject: [PATCH] 完善光纤配置功能

---
 src/components/do/b1-ins-order/fiberoptic-config.vue |  192 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 171 insertions(+), 21 deletions(-)

diff --git a/src/components/do/b1-ins-order/fiberoptic-config.vue b/src/components/do/b1-ins-order/fiberoptic-config.vue
index dc83943..e0f9d2f 100644
--- a/src/components/do/b1-ins-order/fiberoptic-config.vue
+++ b/src/components/do/b1-ins-order/fiberoptic-config.vue
@@ -63,26 +63,34 @@
         <el-col :span="15">
           <div class="grid-content">
             <h5>妫�娴嬮」淇℃伅</h5>
-            <el-table ref="table1" :data="tableData" tooltip-effect="dark" style="width: 100%" height="282px"
-              size="small" @selection-change="handleSelectionChange">
-              <el-table-column type="selection" width="55">
+            <el-table ref="table1" :data="detectionItems" tooltip-effect="dark" style="width: 100%"
+            :row-class-name="tableRowClassName"
+            :header-cell-class-name="setClassName"
+            height="283px"
+              size="small" @selection-change="handleSelectionChange2"
+              @select-all="handleAll"
+              @select="upProductSelect"
+              >
+              <el-table-column type="selection" width="55"
+              :selectable="()=>(currentDetectionItems||this.multiFiberList.length > 0)">
               </el-table-column>
-              <el-table-column label="瀹為獙瀹�" show-overflow-tooltip>
-                <template slot-scope="scope">{{ scope.row.date }}</template>
+              <el-table-column label="瀹為獙瀹�" show-overflow-tooltip prop="sonLaboratory" ></el-table-column>
+              <el-table-column prop="inspectionItem" label="妫�楠岄」" show-overflow-tooltip>
               </el-table-column>
-              <el-table-column prop="name" label="妫�娴嬮」鐩�" show-overflow-tooltip>
+              <el-table-column prop="inspectionItemSubclass" label="妫�楠岄」瀛愰」" show-overflow-tooltip width="100px">
               </el-table-column>
-              <el-table-column prop="address" label="璇曢獙鏂规硶" show-overflow-tooltip>
+              <el-table-column prop="methodS" label="璇曢獙鏂规硶" show-overflow-tooltip>
               </el-table-column>
-              <el-table-column prop="address" label="鍗曚环" width="70" show-overflow-tooltip>
+              <el-table-column prop="price" label="鍗曚环" width="70" show-overflow-tooltip>
               </el-table-column>
-              <el-table-column prop="address" label="鍗曚綅" width="70" show-overflow-tooltip>
+              <el-table-column prop="unit" label="鍗曚綅" width="70" show-overflow-tooltip>
               </el-table-column>
-              <el-table-column prop="address" label="棰勮鏃堕棿" show-overflow-tooltip>
+              <el-table-column prop="manDay" label="棰勮鏃堕棿" show-overflow-tooltip>
               </el-table-column>
-              <el-table-column prop="address" label="妫�娴嬫爣鍑�" show-overflow-tooltip>
-              </el-table-column>
-              <el-table-column prop="address" label="妫�娴嬭姹�" show-overflow-tooltip>
+              <el-table-column prop="ask" label="妫�娴嬭姹�" show-overflow-tooltip width="200px">
+                <template slot-scope="scope">
+                  <el-input v-model="scope.row.ask" placeholder="璇疯緭鍏�" size="small"></el-input>
+                </template>
               </el-table-column>
             </el-table>
           </div>
@@ -110,7 +118,7 @@
               </div>
             </div>
             <el-table ref="table2" :data="tableData" tooltip-effect="dark" style="width: 100%" height="270px"
-              size="small" @selection-change="handleSelectionChange">
+              size="small" @selection-change="handleSelectionChange3">
               <el-table-column type="selection" width="55">
               </el-table-column>
               <el-table-column label="鍏夌氦甯︾紪鍙�" show-overflow-tooltip>
@@ -140,6 +148,7 @@
               <div class="search-item" style="width: 50%;">
                 <label style="width: 80px;">鍙傝�冩爣鍑�</label>
                 <el-select v-model="mireStandard" placeholder="璇烽�夋嫨" size="small" style="width: 100%;" :disabled="mireModel===null"
+                :loading="mireStandardLoading"
                 @focus="selectsStandardMethodByFLSSM()" @change="(value)=>methodChange(value)">
                   <el-option v-for="item in mireStandards" :key="item.id" :label="item.code" :value="item.id">
                   </el-option>
@@ -147,7 +156,8 @@
               </div>
             </div>
             <el-table ref="table3" :data="fiberList" tooltip-effect="dark" style="width: 100%" height="270px"
-              size="small" @selection-change="handleSelectionChange">
+              size="small" @selection-change="handleSelectionChange4"
+              @row-click="rowClickFiber">
               <el-table-column type="selection" width="55">
               </el-table-column>
               <el-table-column prop="bushColor" label="绠″鑹叉爣" width="90" align="center">
@@ -199,7 +209,36 @@
         mireStandards: null,
         selectBushing: [],
         productList: [],
-        fiberList: []
+        fiberList: [],
+        detectionItems:[],
+        currentDetectionItems:null,
+        mireStandardLoading:false,
+        multiFiberList:[]
+      }
+    },
+    computed: {
+      isAllDisabled() {
+        return this.multiFiberList.length > 0||this.currentDetectionItems
+      },
+    },
+    watch: {
+      mireModel(val1,val0) {
+        if(val1!=val0){
+          this.mireStandards = []
+          this.fiberList = []
+          this.multiFiberList = []
+          this.detectionItems = []
+          this.currentDetectionItems = null;
+          this.mireStandard = null;
+        }
+      },
+      mireStandard(val1,val0) {
+        if(val1!=val0){
+          this.fiberList = []
+          this.multiFiberList = []
+          this.detectionItems = []
+          this.currentDetectionItems = null;
+        }
       }
     },
     mounted() {
@@ -222,6 +261,15 @@
       handleSelectionChange(val) {},
       handleSelectionChange1(val){
         this.selectBushing = val
+        this.mireModel = null
+      },
+      handleSelectionChange2(val){},
+      handleSelectionChange3(val){
+        this.detectionItems = this.HaveJson(this.productList)
+      },
+      handleSelectionChange4(val){
+        this.multiFiberList = val
+        this.detectionItems = this.HaveJson(this.productList)
       },
       outConfig(){
         this.$parent.configShow = false
@@ -277,7 +325,10 @@
         }
       },
       getStandTreeBySampleType(){
-        this.$axios.get(this.$api.standardTree.getStandTreeBySampleType).then(res=>{
+        this.$axios.post(this.$api.standardTree.getStandTreeBySampleType,{
+          laboratory: '閫氫俊浜у搧瀹為獙瀹�',
+          sampleType:'鍏夌氦',
+        }).then(res=>{
           this.mireModels = []
           res.data.forEach(a=>{
             this.mireModels.push({
@@ -288,9 +339,12 @@
         })
       },
       selectsStandardMethodByFLSSM() {
+        this.mireStandards = []
+        this.mireStandardLoading = true
         this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
           tree: '涓ぉ绉戞妧妫�娴嬩腑蹇� - 閫氫俊浜у搧瀹為獙瀹� - 鍏夌氦 - ' + this.mireModel
         }).then(res => {
+          this.mireStandardLoading = false
           this.mireStandards = res.data.standardMethodList
         })
       },
@@ -305,10 +359,11 @@
             'Content-Type': 'application/json'
           }
         }).then(res => {
-          res.data.forEach(a => {
+          let arr = res.data.map(a => {
             a.state = 0
+            return a
           })
-          this.productList = res.data
+          this.productList = arr
           setTimeout(() => {
             this.productList.forEach(a => {
               if (a.state == 1) this.toggleSelection(a)
@@ -339,14 +394,104 @@
                 bushColor: a.color,
                 color: colors2[i].label,
                 model: model,
-                standard: standard
+                standard: standard,
+                productList:this.HaveJson(this.productList),
               }
               a.fiber.push(fiber)
               this.fiberList.push(fiber)
             }
           }
         })
-      }
+        console.log(this.productList)
+      },
+      rowClickFiber(row, column, event){
+        this.currentDetectionItems = row
+        this.detectionItems = this.HaveJson(this.productList)
+      },
+      tableRowClassName({
+        row,
+        rowIndex
+      }) {
+        if (row.state === 0) {
+          return 'warning-row';
+        }
+        return '';
+      },
+      handleAll(e) {
+        if (e.length > 0) {
+          this.detectionItems.map(m => {
+            m.state = 1
+            return m
+          })
+        } else {
+          this.detectionItems.map(m => {
+            m.state = 0
+            return m
+          })
+        }
+        if (e.length > 0) {
+          if(this.multiFiberList.length > 0){
+            this.multiFiberList.map(item => {
+              item.productList.map(m=>{
+                m.state = 1;
+                return m;
+              })
+              return item
+            })
+          }else{
+          this.currentDetectionItems.productList.map(m=>{
+              m.state = 1;
+              return m;
+            })
+          }
+        } else {
+          if(this.multiFiberList.length > 0){
+            this.multiFiberList.map(item => {
+              item.productList.map(m=>{
+                m.state = 0;
+                return m;
+              })
+              return item
+            })
+          }else{
+            this.currentDetectionItems.productList.map(m=>{
+              m.state = 0;
+              return m;
+            });
+          }
+        }
+        this.$nextTick(() => {
+          this.$refs.table1.doLayout()
+        })
+        console.log(222,this.currentDetectionItems,this.multiFiberList)
+      },
+      upProductSelect(selection, row) {
+        row.state = row.state == 1 ? 0 : 1
+        if(this.multiFiberList.length > 0){
+          this.multiFiberList.map(item => {
+            item.productList.map(m=>{
+              if(m.id == row.id){
+                m.state = row.state;
+              }
+              return m
+            })
+            return item
+          })
+        }else{
+          this.currentDetectionItems.productList.map(m=>{
+            if(m.id == row.id){
+                m.state = row.state;
+              }
+              return m;
+            });
+        }
+        console.log(1111,this.currentDetectionItems,this.multiFiberList)
+      },
+      setClassName({ column }) {
+        if (column.type == 'selection' && !this.isAllDisabled) {
+          return 'all-disabled'
+        }
+      },
     }
   }
 </script>
@@ -409,4 +554,9 @@
     padding-top: 2px !important;
     padding-bottom: 2px !important;
   }
+  >>>.all-disabled .el-checkbox__input .el-checkbox__inner {
+    background-color: #edf2fc;
+    border-color: #dcdfe6;
+    cursor: not-allowed;
+  }
 </style>

--
Gitblit v1.9.3