From adfe1ca87e734e564b56a42c6fc5d015b4858eb3 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 04 六月 2024 20:37:49 +0800
Subject: [PATCH] 修改任务检验

---
 src/components/do/b1-ins-order/add.vue |  214 +++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 183 insertions(+), 31 deletions(-)

diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index f1cfa3f..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">
@@ -107,7 +107,8 @@
           <el-button size="medium" @click="templateDia=true" v-show="active==1">
             <span style="color: #3A7BFA;">淇濆瓨妯℃澘</span>
           </el-button>
-          <el-button size="medium" type="primary" @click="openConfig">鍏夌氦閰嶇疆</el-button>
+          <el-button size="medium" type="primary" @click="openConfig"
+            v-if="this.addObj.sampleType==='鍏夌紗'">鍏夌氦閰嶇疆</el-button>
           <el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-show="active==1">鎻愪氦</el-button>
           <!-- 瀹℃牳 -->
           <el-button size="medium" @click="upInsOrderOfState(2)" :loading="saveLoad" v-show="active==3"
@@ -137,7 +138,7 @@
           </div>
         </el-col>
         <el-col class="search_thing" :span="6">
-          <div class="search_label"><span class="required-span">* </span>濮旀墭瀹㈡埛锛�</div>
+          <div class="search_label"><span class="required-span">* </span>濮旀墭浜猴細</div>
           <div class="search_input">
             <el-input readonly size="small" v-model="addObj.custom">
               <template slot="append"><el-button slot="append" icon="el-icon-search" @click="selectUserDia = true"
@@ -148,7 +149,7 @@
         <el-col class="search_thing" :span="6">
           <div class="search_label"><span class="required-span">* </span>濮旀墭鍗曚綅锛�</div>
           <div class="search_input">
-            <el-input size="small" placeholder="閫夋嫨濮旀墭瀹㈡埛" clearable disabled v-model="addObj.company"></el-input>
+            <el-input size="small" placeholder="鈫愰�夋嫨濮旀墭瀹㈡埛" clearable disabled v-model="addObj.company"></el-input>
           </div>
         </el-col>
         <el-col class="search_thing" :span="6">
@@ -174,12 +175,12 @@
             </el-input>
           </div>
         </el-col>
-        <el-col class="search_thing" :span="6">
+        <!-- <el-col class="search_thing" :span="6">
           <div class="search_label"><span class="required-span">* </span>鏍峰搧绫诲瀷锛�</div>
           <div class="search_input">
             <el-input size="small" clearable disabled v-model="addObj.sampleType"></el-input>
           </div>
-        </el-col>
+        </el-col> -->
         <el-col class="search_thing" :span="6">
           <div class="search_label"><span class="required-span">* </span>鏍峰搧鏁伴噺锛�</div>
           <div class="search_input">
@@ -324,21 +325,6 @@
             </el-select>
           </template>
         </el-table-column>
-        <!-- <el-table-column prop="unit" label="鍗曚綅" align="center" min-width="100">
-          <template slot-scope="scope">
-            <el-select v-model="scope.row.unit" clearable size="small" style="width: 100%;" :disabled="active>1">
-              <el-option v-for="(a, i) in units" :key="i" :label="a.label" :value="a.value"></el-option>
-            </el-select>
-          </template>
-        </el-table-column> -->
-        <!-- <el-table-column prop="isLeave" label="鏄惁鐣欐牱" align="center" min-width="100">
-          <template slot-scope="scope">
-            <el-select v-model="scope.row.isLeave" size="small" :disabled="active>1">
-              <el-option label="鐣欐牱" :value="1"></el-option>
-              <el-option label="涓嶇暀鏍�" :value="0"></el-option>
-            </el-select>
-          </template>
-        </el-table-column> -->
         <el-table-column prop="joinName" label="閰嶅鏍峰搧鍚嶇О" width="140" align="center" v-if="addObj.mating==1">
           <template slot-scope="scope">
             <el-input size="small" type="textarea" :autosize="{ minRows: 1, maxRows: 1}"
@@ -365,16 +351,16 @@
         <el-table-column prop="inspectionItem" label="妫�楠岄」" min-width="140" show-overflow-tooltip></el-table-column>
         <el-table-column prop="inspectionItemSubclass" label="妫�楠岄」瀛愰」" min-width="140"
           show-overflow-tooltip></el-table-column>
-        <el-table-column prop="sonLaboratory" label="瀛愬疄楠屽" width="130" show-overflow-tooltip :filters="filters"
+        <el-table-column prop="sonLaboratory" label="瀛愬疄楠屽" min-width="130" show-overflow-tooltip :filters="filters"
           :filter-method="filterHandler"></el-table-column>
         <el-table-column prop="methodS" label="璇曢獙鏂规硶" min-width="120" show-overflow-tooltip>
         </el-table-column>
         <el-table-column prop="unit" label="璁¢噺鍗曚綅" width="100" show-overflow-tooltip></el-table-column>
         <el-table-column prop="price" label="鍗曚环" width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="manDay" label="棰勮鏃堕棿(澶�)" width="120" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="manHour" label="宸ユ椂绯绘暟" width="100" show-overflow-tooltip></el-table-column>
+        <!-- <el-table-column prop="manDay" label="棰勮鏃堕棿(澶�)" width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="manHour" label="宸ユ椂绯绘暟" width="100" show-overflow-tooltip></el-table-column> -->
         <!-- <el-table-column prop="deviceGroup" label="璁惧缁�" width="120" show-overflow-tooltip></el-table-column> -->
-        <el-table-column prop="section" label="鍖洪棿" width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="section" label="鍖洪棿" min-width="120" show-overflow-tooltip></el-table-column>
         <el-table-column prop="ask" label="瑕佹眰鍊�" min-width="220px">
           <template slot-scope="scope">
             <el-input size="small" placeholder="瑕佹眰鍊�" v-model="scope.row.ask" clearable type="textarea"
@@ -395,7 +381,7 @@
       </span>
     </el-dialog>
     <el-dialog title="閫夋嫨鏍峰搧" :visible.sync="selectStandardTree" width="400px">
-      <div class="body" style="height: 60vh;overflow-y: auto;" v-if="selectStandardTree">
+      <div class="body" style="height: 60vh;overflow-y: auto;user-select: none;" v-if="selectStandardTree">
         <el-row>
           <el-col :span="24">
             <el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" suffix-icon="el-icon-search" v-model="search" size="small"
@@ -405,7 +391,7 @@
         </el-row>
         <el-tree :data="list" ref="tree" :props="{ children: 'children', label: 'label' }" node-key="label"
           :filter-node-method="filterNode" @node-click="handleNodeClick" highlight-current @node-expand="nodeOpen"
-          @node-collapse="nodeClose" :default-expanded-keys="expandedKeys">
+          @node-collapse="nodeClose" :default-expanded-keys="expandedKeys" @dblclick.native="activeStandardTree">
           <div class="custom-tree-node" slot-scope="{ node, data }">
             <el-row>
               <el-col :span="24">
@@ -481,7 +467,31 @@
         </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">
+          <el-col class="search_thing" :span="22">
+            <div class="search_label"><span class="required-span">* </span>鎶ゅ瀵嗗害锛�</div>
+            <div class="search_input">
+              <el-radio-group v-model="bsm1Val" @input="upBsm1">
+                <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai" :label="a"></el-radio>
+              </el-radio-group>
+            </div>
+          </el-col>
+          <el-col class="search_thing" :span="22">
+            <div class="search_label">瑕佹眰鍊硷細</div>
+            <div class="search_input" v-show="bsm1Val!==null&&bsm1Val!==''">
+              <el-radio-group v-model="bsm1Val" @input="upBsm1">
+                <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai" :label="a">{{JSON.parse(bsmRow.ask)[ai]}}</el-radio>
+              </el-radio-group>
+            </div>
+          </el-col>
+        </el-row>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -615,13 +625,41 @@
         configShow: false,
         currentMethod: null,
         isAskOnlyRead: false,
-        sampleId: null
+        sampleId: null,
+        bsmRow: null,
+        bsm1: false,
+        bsm1Val: null,
+        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() {
@@ -633,7 +671,7 @@
       this.selectEnumByCategoryForUnit()
       this.selectStandardMethods()
       this.selectEnumByCategoryForOrderType()
-      this.selectEnumByCategoryForSonLaboratory()
+      // this.selectEnumByCategoryForSonLaboratory()
       this.selectEnumByCategoryForSampleForm()
       if (this.active != 1) {
         // 鏌ョ湅/瀹℃牳娴佺▼
@@ -812,6 +850,8 @@
           this.addObj.code = selects.code
           this.addObj.phone = selects.phone
           this.addObj.companyId = selects.departId
+          this.addObj.production = '/'
+          this.addObj.productionEn = '/'
         })
       },
       searchFilter() {
@@ -823,7 +863,7 @@
       nodeClose(data, node, el) {
         $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder')
       },
-      handleNodeClick(val, node, el) { //鏍戠殑鍊�
+      handleNodeClick(val, node, el) {
         this.selectTree = ''
         this.models = val.children
         this.getNodeParent(node)
@@ -970,6 +1010,15 @@
       },
       upProductSelect(selection, row) {
         row.state = row.state == 1 ? 0 : 1
+        if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 1) {
+          if(row.section.indexOf('[') > -1){
+            this.bsmRow = this.HaveJson(row)
+          }
+          this.bsm1 = true
+          this.bsm1Dia = true
+        } else if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 0) {
+          this.bsm1 = false
+        }
         this.sampleList.map(item => {
           if (this.sampleIds.indexOf(item.id) > -1) {
             item.insProduct.map(m => {
@@ -1167,6 +1216,17 @@
             return m
           })
         }
+        this.productList.forEach(p=>{
+          if (p.bsm === '1' && p.section !== '' && p.section !== null && p.state === 1) {
+            if(p.section.indexOf('[') > -1){
+              this.bsmRow = this.HaveJson(p)
+            }
+            this.bsm1 = true
+            this.bsm1Dia = true
+          } else if (p.bsm === '1' && p.section !== '' && p.section !== null && p.state === 0) {
+            this.bsm1 = false
+          }
+        })
         if (e.length > 0) {
           this.sampleList.map(item => {
             if (this.sampleIds.indexOf(item.id) > -1) {
@@ -1260,6 +1320,98 @@
             this.configShow = true
           })
         }
+      },
+      upBsm1(val) {
+        let sections = JSON.parse(this.bsmRow.section);
+        let asks = JSON.parse(this.bsmRow.ask);
+        let tells = JSON.parse(this.bsmRow.tell);
+        let manHours = JSON.parse(this.bsmRow.manHour);
+        let prices = JSON.parse(this.bsmRow.price);
+        for (var a in sections) {
+          if(val === sections[a]){
+            this.productList.forEach(p=>{
+              if(p.id === this.bsmRow.id){
+                p.section = sections[a]
+                p.ask = asks[a]
+                p.tell = tells[a]
+                p.manHour = manHours[a]
+                p.price = prices[a]
+              }
+            })
+            break
+          }
+        }
+      },
+      beforeClose(done){
+        if(this.bsm1){
+          if(this.bsm1Val===null || this.bsm1Val === ''){
+            this.$message.error('鐗规畩椤圭洰蹇呴』澶勭悊')
+            return
+          }
+        }
+        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)
+        })
       }
     }
   }

--
Gitblit v1.9.3