From 8d1f60e54adb75d9c252b514174f287a2cbd7864 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 04 六月 2024 16:28:28 +0800
Subject: [PATCH] 完成检验下单、检验任务优化

---
 src/components/do/b1-ins-order/add.vue                 |   96 ++++++++++++++++++++++++++++++-
 src/main.js                                            |    4 
 src/components/do/b1-inspect-order-plan/Inspection.vue |   34 +++++++----
 src/components/do/b1-ins-order/fiberoptic-config.vue   |    1 
 src/components/view/person-manage.vue                  |   22 ++++++-
 src/assets/api/controller.js                           |    1 
 6 files changed, 136 insertions(+), 22 deletions(-)

diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js
index 607bb11..46df052 100644
--- a/src/assets/api/controller.js
+++ b/src/assets/api/controller.js
@@ -177,6 +177,7 @@
   verifyPlan: "/insOrderPlan/verifyPlan", //澶嶆牳妫�楠屼换鍔�
   submitPlan: "/insOrderPlan/submitPlan", //妫�楠屼换鍔℃彁浜�
   inspectionOrderDetailsTaskSwitching: "/insOrderPlan/inspectionOrderDetailsTaskSwitching", // 妫�楠屽崟璇︽儏-浠诲姟鍒囨崲
+  getInsProduct: "/insOrderPlan/getInsProduct", // 鑾峰彇妫�楠岄」鐩拰妯℃澘鍐呭
 }
 
 const systemLog = {
diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index 1d19dd8..f712e9b 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -94,7 +94,7 @@
   <div class="ins_order_add">
     <div v-show="!configShow">
       <el-row class="title">
-        <el-col :span="6" style="padding-left: 20px;">濮旀墭鍗曚俊鎭�</el-col>
+        <el-col :span="6" style="padding-left: 20px;">濮旀墭鍗曚俊鎭�&nbsp;&nbsp;&nbsp;鎬讳环锛�<span style="color: #3A7BFA">锟{total}}</span></el-col>
         <el-col :span="18" style="text-align: right;">
           <el-select v-model="template" size="medium" placeholder="涓嬪崟妯℃澘" style="margin-right: 10px;" v-show="active==1"
             @change="selectInsOrderTemplateById">
@@ -467,7 +467,9 @@
         </el-row>
       </span>
     </el-dialog>
-    <fiberOpticConfig :currentId="currentId" v-if="configShow" :active="active" />
+    <fiberOpticConfig :currentId="currentId"
+    @saveFiberopticConfig="getTotal()"
+     v-if="configShow" :active="active" />
     <el-dialog title="妫�娴嬪埌鐗规畩椤癸紝璇蜂綔鍑轰互涓嬮�夋嫨" :visible.sync="bsm1Dia" width="500px" :show-close="false" :before-close="beforeClose">
       <div class="body" style="max-height: 60vh;">
         <el-row v-if="bsm1">
@@ -627,13 +629,37 @@
         bsmRow: null,
         bsm1: false,
         bsm1Val: null,
-        bsm1Dia: false
+        bsm1Dia: false,
+        total:0,
       }
     },
     watch: {
       sampleList() {
         this.addObj.method = null
         this.productList = []
+      },
+      productList:{
+        deep:true,
+        handler(val){
+          if(val&&val.length>0){
+            let arr = [];
+            val.forEach(item => {
+              if(item.sonLaboratory&&!arr.find(a=>a.value==item.sonLaboratory)){
+                arr.push({
+                  text: item.sonLaboratory,
+                  value: item.sonLaboratory
+                })
+              }
+            })
+            this.filters = arr
+          }
+        }
+      },
+      sampleList:{
+        deep:true,
+        handler(val){
+          this.getTotal()
+        }
       }
     },
     mounted() {
@@ -645,7 +671,7 @@
       this.selectEnumByCategoryForUnit()
       this.selectStandardMethods()
       this.selectEnumByCategoryForOrderType()
-      this.selectEnumByCategoryForSonLaboratory()
+      // this.selectEnumByCategoryForSonLaboratory()
       this.selectEnumByCategoryForSampleForm()
       if (this.active != 1) {
         // 鏌ョ湅/瀹℃牳娴佺▼
@@ -1324,6 +1350,68 @@
           }
         }
         done()
+      },
+      getTotal(){
+        let arr = []
+        this.total = 0;
+        this.sampleList.forEach(item=>{
+          if(item.insProduct&&item.insProduct.length>0){
+            item.insProduct.forEach(a=>{
+              arr.push(a)
+            })
+          }
+          if(item.bushing&&item.bushing.length>0){
+            item.bushing.forEach(a=>{
+              if(a.fiber&&a.fiber.length>0){
+                a.fiber.forEach(b=>{
+                  if(b.productList&&b.productList.length>0){
+                    b.productList.forEach(c=>{
+                      arr.push(c)
+                    })
+                  }
+                })
+              }
+              if(a.fibers&&a.fibers.length>0){
+                a.fibers.forEach(b=>{
+                  if(b.productList&&b.productList.length>0){
+                    b.productList.forEach(c=>{
+                      arr.push(c)
+                    })
+                  }
+                  if(b.fiber&&b.fiber.length>0){
+                    b.fiber.forEach(c=>{
+                      if(c.productList&&c.productList.length>0){
+                        c.productList.forEach(d=>{
+                          arr.push(d)
+                        })
+                      }
+                    })
+                  }
+                })
+              }
+            })
+          }
+        })
+        let mySet = new Set();
+        let arr0 = arr.filter(item=>{
+          if(item.state == 1){
+            let num1= mySet.size
+            if(item.manHourGroup===''||!item.manHourGroup){
+              return true
+            }else{
+              mySet.add(item.manHourGroup)
+              let num2= mySet.size
+              if(num2 > num1){
+                return true
+              }else{
+                return false
+              }
+            }
+          }
+        })
+        arr0.forEach(item=>{
+          this.total += Number(item.price)
+        })
       }
     }
   }
diff --git a/src/components/do/b1-ins-order/fiberoptic-config.vue b/src/components/do/b1-ins-order/fiberoptic-config.vue
index 859813e..4066118 100644
--- a/src/components/do/b1-ins-order/fiberoptic-config.vue
+++ b/src/components/do/b1-ins-order/fiberoptic-config.vue
@@ -690,6 +690,7 @@
           a.bushing = this.bushing
         })
         this.$message.success('宸蹭繚瀛�')
+        this.$emit('saveFiberopticConfig')
       }
     }
   }
diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index b3ed844..936331e 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -224,7 +224,7 @@
             size="small">{{ item.templateName }}</el-radio-button>
         </el-radio-group>
       </div>
-      <div class="center-box" id="nav">
+      <div class="center-box" id="nav" v-loading="tableLoading">
         <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index">
           <tbody>
             <tr v-for="(m,i) in item.arr" :key="i">
@@ -470,6 +470,7 @@
         currentFiberOpticTape:null,//褰撳墠鍏夌氦甯�
         currentFiberOptic:null,//褰撳墠鍏夌氦
         currentBushing:null,//褰撳墠濂楃
+        tableLoading:false,
       }
     },
     created() {
@@ -542,6 +543,12 @@
       }
     },
     methods: {
+      async getCurrentProduct(id,type){
+        this.tableLoading = true;
+        let res = await this.$axios.post(this.$api.insOrderPlan.getInsProduct+'?id='+id+'&type='+type+'&laboratory='+this.sonLaboratory)
+        this.tableLoading = false;
+        return res.data
+      },
       handleChangeBushing(row, column, event){
         this.currentBushing = row;
         this.fiberOpticTape = []
@@ -557,7 +564,7 @@
         }
         this.bushingVisible = false;
       },
-      handleChangeOptic(row, column, event){
+      async handleChangeOptic(row, column, event){
         this.currentFiberOptic = row;
         this.currentFiberOptic.productList.forEach(a => {
           this.param[a.id] = {
@@ -569,11 +576,12 @@
             insResult: null
           }
         })
-        this.getTableLists0(row)
         this.fiberOpticVisible = false;
+        let list = await this.getCurrentProduct(row.id,2)
+        this.getTableLists0(list)
         this.currentKey = row.index
       },
-      handleChangeTape(row, column, event){
+      async handleChangeTape(row, column, event){
         this.currentFiberOpticTape = row;
         this.param = {}
         this.fiberOptic = []
@@ -588,15 +596,16 @@
             insResult: null
           }
         })
-        this.getTableLists0(row)
+        this.fiberOpticTapeVisible = false;
+        let list = await this.getCurrentProduct(row.id,1)
+        this.getTableLists0(list)
         if(row.fiber&&row.fiber.length>0){
           // 閰嶇疆鍏夌氦
           this.fiberOptic = row.fiber;
         }
-        this.fiberOpticTapeVisible = false;
         this.currentKey = row.index
       },
-      handleChangeSample(row, column, event) {
+      async handleChangeSample(row, column, event) {
         this.param = {}
         // 娓呯┖鍏夌氦閰嶇疆鐩稿叧鏁版嵁
         this.fiberOpticTape = []
@@ -605,7 +614,9 @@
         this.currentFiberOptic = null;
         this.bushing = []
         this.currentBushing = null;
-        this.currentSample.insProduct = this.HaveJson(row.insProduct)
+        this.sampleVisible = false;
+        let list = await this.getCurrentProduct(row.id,0)
+        this.currentSample.insProduct = this.HaveJson(list)
         this.currentSample.insProduct.forEach(a => {
           this.param[a.id] = {
             insValue: [],
@@ -622,7 +633,6 @@
         }
         // this.handleTableData()
         this.getTableLists();
-        this.sampleVisible = false;
         this.currentKey = row.index
       },
       handleChangeTask(row) {
@@ -714,9 +724,9 @@
         }
       },
       // 鍏夌氦閰嶇疆鐩稿叧妯℃澘table鍒楄〃
-      getTableLists0(obj){
+      getTableLists0(list){
         const mySet1 = new Set();
-        this.tableLists = obj.productList.filter(m => {
+        this.tableLists = list.filter(m => {
           let num0 = mySet1.size;
           if (m.templateId != null&&m.template != null) {
             mySet1.add(JSON.stringify({
@@ -733,7 +743,7 @@
           this.tableList = null;
           this.tableList = [this.tableLists[0]]
           this.currentTable = this.tableLists[0].templateId;
-          this.currentSample.insProduct = this.HaveJson(obj.productList)
+          this.currentSample.insProduct = this.HaveJson(list)
           this.handleTableData()
         }
       },
diff --git a/src/components/view/person-manage.vue b/src/components/view/person-manage.vue
index e74603e..57075db 100644
--- a/src/components/view/person-manage.vue
+++ b/src/components/view/person-manage.vue
@@ -199,9 +199,9 @@
       </span>
     </el-dialog>
     <el-dialog title="鑾峰彇浜轰簨绯荤粺浜哄憳淇℃伅" :visible.sync="addthirdParty" width="70%">
-      <div class="body">
+      <div class="body" v-loading="thirdPartyLoading">
         <el-row>
-          <el-col :span="8" style="height: 70vh;overflow: hidden;">
+          <el-col :span="8" style="height: 70vh;overflow: hidden;" v-if="companiesList.length!=1">
             <el-input placeholder="杈撳叆鍏抽敭瀛楁悳绱�" v-model="search2" size="small" style="width: 90%;padding: 0 5% 10px 5%;"
               clearable @clear="searchFilter2" @keyup.enter.native="searchFilter2()">
             </el-input>
@@ -210,7 +210,7 @@
               highlight-current>
             </el-tree>
           </el-col>
-          <el-col :span="16" style="height: 70vh;padding-left: 8px;">
+          <el-col :span="companiesList.length==1?24:16" style="height: 70vh;padding-left: 8px;">
             <div class="search_thing" style="width: 100%;margin-bottom: 10px;justify-content: right;">
               <div class="search_label" style="width: 200px;">鍛樺伐鍙�/鍛樺伐濮撳悕锛�</div>
               <div class="search_input" style="width: 250px;">
@@ -354,7 +354,8 @@
         companiesList: [],
         currentCompaniesList: [],
         userSearch2: '',
-        searchEmployeeID: null
+        searchEmployeeID: null,
+        thirdPartyLoading:false
       }
     },
     // watch: {
@@ -370,8 +371,21 @@
     methods: {
       openthirdParty() {
         this.addthirdParty = true;
+        this.thirdPartyLoading = true;
         this.$axios.get(this.$api.companies.selectCompaniesList).then(res => {
           this.companiesList = this.HaveJson(res.data);
+          if(this.companiesList.length ==1){
+            this.$axios.post(this.$api.companies.selectSimpleList, {
+              companyId: this.companiesList[0].companyId
+            }).then(res => {
+              this.thirdPartyLoading = false;
+              this.personListCopy = JSON.parse(JSON.stringify(res.data))
+              this.personList = res.data
+              this.$refs.personTable.doLayout()
+            })
+          }else{
+            this.thirdPartyLoading = false;
+          }
           this.datathirdParty = this.tranListToTreeData(res.data, "ROOT");
         })
         if(this.componentData.entity.roleId > 10000)this.$message.warning('鐢变簬鏈�変腑鍏蜂綋瑙掕壊锛屾柊澧炵敤鎴峰皢鎴愪负榛樿瑙掕壊')
diff --git a/src/main.js b/src/main.js
index 314efeb..72b15e5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -13,8 +13,8 @@
 
 //鏈湴
 Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
-// const javaApi = 'http://192.168.11.200:8001';//鏉�
-const javaApi = 'http://192.168.144.249:8001';//寮�
+const javaApi = 'http://192.168.11.200:8001';//鏉�
+// const javaApi = 'http://192.168.11.249:8001';//寮�
 // const javaApi = 'http://172.20.10.3:8001';//濮�
 // const javaApi = 'http://192.168.11.2:8001';//鏌�
 //  const javaApi = 'http://127.0.0.1:8001';//鏅�

--
Gitblit v1.9.3