From a62d9ff3b7bebf15f1bee8827ed5c263d9a1776c Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期四, 06 六月 2024 13:47:44 +0800
Subject: [PATCH] 在检验执行的模板渲染进行处理

---
 src/components/do/b1-ins-order/add.vue |  194 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 189 insertions(+), 5 deletions(-)

diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index 1d19dd8..82e3105 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">
@@ -279,6 +279,12 @@
           <div class="search_input">
             <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 2}" size="small" clearable
               v-model="addObj.remark" :readonly="active>1"></el-input>
+          </div>
+        </el-col>
+        <el-col class="search_thing" :span="6" v-if="active==1">
+          <div class="search_label">RTS锛�</div>
+          <div class="search_input">
+            <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="RTS"></el-input>
           </div>
         </el-col>
       </el-row>
@@ -467,7 +473,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 +635,39 @@
         bsmRow: null,
         bsm1: false,
         bsm1Val: null,
-        bsm1Dia: false
+        bsm1Dia: false,
+        total:0,
+        RTS:'',
+        totalArr:[]
       }
     },
     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 +679,7 @@
       this.selectEnumByCategoryForUnit()
       this.selectStandardMethods()
       this.selectEnumByCategoryForOrderType()
-      this.selectEnumByCategoryForSonLaboratory()
+      // this.selectEnumByCategoryForSonLaboratory()
       this.selectEnumByCategoryForSampleForm()
       if (this.active != 1) {
         // 鏌ョ湅/瀹℃牳娴佺▼
@@ -700,6 +734,37 @@
         this.addObj.companyId = selects.id
         this.selectUserDia = false
       },
+      handleAsk(ask){
+        let code = [">","<","=","锛�","锛�","鈮�","鈮�","卤"];
+        if(ask.includes('RTS')){
+          if(ask.includes('&')){
+            // 澶氫釜鏉′欢
+            let arr0 = ask.split('&')
+            let arr1 = []
+            arr0.forEach(m=>{
+                let index = code.findIndex(b=>m.includes(b))
+              if(index>-1){
+                let arr = m.split(code[index]).filter(b=>!!b)
+                let num = eval(this.replaceAll(arr[0],'RTS', this.RTS))
+                m = code[index] + ''+ num
+                arr1.push(m)
+              }
+            })
+            return arr1.join('&')
+          }else{
+            // 鍗曚釜鏉′欢
+            let index = code.findIndex(b=>ask.includes(b))
+            if(index>-1){
+              let arr = ask.split(code[index]).filter(b=>!!b)
+              let num = eval(this.replaceAll(arr[0],'RTS', this.RTS))
+              return code[index] + ''+ num
+            }
+          }
+        }
+      },
+      replaceAll(str, find, replace) {
+        return str.replace(new RegExp(find, 'g'), replace);
+      },
       save() {
         if (!this.addObj.companyId) {
           this.$message.error('鏈�夋嫨瀹㈡埛鍗曚綅')
@@ -723,11 +788,68 @@
           this.$message.error('璇疯緭鍏ユ牱鍝佸瀷鍙�')
         } else if (!this.sampleList.every(m => m.standardMethodListId)) {
           this.$message.error('璇烽�夋嫨妫�楠屾爣鍑�')
+        }else if (this.totalArr.find(a=>a.ask.includes('RTS'))&&!this.RTS) {
+          this.$message.error('璇疯緭鍏TS')
         } else {
+          let sampleList = this.HaveJson(this.sampleList)
+          let isRTS = this.totalArr.find(a=>a.ask.includes('RTS'))
+          if(isRTS){
+            sampleList.forEach(item=>{
+              if(item.insProduct&&item.insProduct.length>0){
+                item.insProduct.forEach(a=>{
+                  let ask = this.handleAsk(a.ask)
+                  if(ask){
+                    a.ask = ask
+                  }
+                })
+              }
+              // 鍏夌氦甯﹂」鐩�
+              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=>{
+                          let ask = this.handleAsk(c.ask)
+                          if(ask){
+                            c.ask = ask
+                          }
+                        })
+                      }
+                    })
+                  }
+                  if(a.fibers&&a.fibers.length>0){
+                    a.fibers.forEach(b=>{
+                      if(b.productList&&b.productList.length>0){
+                        b.productList.forEach(c=>{
+                          let ask = this.handleAsk(c.ask)
+                          if(ask){
+                            c.ask = ask
+                          }
+                        })
+                      }
+                      if(b.fiber&&b.fiber.length>0){
+                        b.fiber.forEach(c=>{
+                          if(c.productList&&c.productList.length>0){
+                            c.productList.forEach(d=>{
+                              let ask = this.handleAsk(d.ask)
+                              if(ask){
+                                d.ask = ask
+                              }
+                            })
+                          }
+                        })
+                      }
+                    })
+                  }
+                })
+              }
+            })
+          }
           this.saveLoad = true
           this.$axios.post(this.$api.insOrder.addInsOrder, {
             insOrder: this.addObj,
-            list: JSON.stringify(this.sampleList.map(a => {
+            list: JSON.stringify(sampleList.map(a => {
               a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : (
                 '-' + a.modelNum))
               return a
@@ -1324,6 +1446,68 @@
           }
         }
         done()
+      },
+      getTotal(){
+        this.totalArr = []
+        this.total = 0;
+        this.sampleList.forEach(item=>{
+          if(item.insProduct&&item.insProduct.length>0){
+            item.insProduct.forEach(a=>{
+               this.totalArr.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=>{
+                       this.totalArr.push(c)
+                    })
+                  }
+                })
+              }
+              if(a.fibers&&a.fibers.length>0){
+                a.fibers.forEach(b=>{
+                  if(b.productList&&b.productList.length>0){
+                    b.productList.forEach(c=>{
+                       this.totalArr.push(c)
+                    })
+                  }
+                  if(b.fiber&&b.fiber.length>0){
+                    b.fiber.forEach(c=>{
+                      if(c.productList&&c.productList.length>0){
+                        c.productList.forEach(d=>{
+                           this.totalArr.push(d)
+                        })
+                      }
+                    })
+                  }
+                })
+              }
+            })
+          }
+        })
+        let mySet = new Set();
+        let arr0 =  this.totalArr.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