From 06206329d0c2a7d806d70f3b8c9f7840d82200e2 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 21 八月 2024 15:10:06 +0800
Subject: [PATCH] 修改下单逻辑

---
 src/components/do/b1-ins-order/add.vue |  111 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 57 insertions(+), 54 deletions(-)

diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index 28aeca3..8c9f4b5 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -207,6 +207,14 @@
               <el-input size="small" placeholder="閫夋嫨濮旀墭瀹㈡埛" clearable :readonly="active>1" v-model="addObj.phone"></el-input>
             </div>
           </el-col>
+          <el-col class="search_thing" :span="6" v-if="addObj.orderType=='C'">
+            <div class="search_label"><span class="required-span">* </span>涓嬪崟鑷筹細</div>
+            <div class="search_input">
+              <el-select size="small" style="width: 100%;" clearable v-model="addObj.departmentLimsId" :disabled="active>1" placeholder="閮ㄩ棬">
+                <el-option v-for="(a, ai) in deaprtEnum" :key="ai" :value="a.id" :label="a.name"></el-option>
+              </el-select>
+            </div>
+          </el-col>
           <el-col class="search_thing" :span="6">
             <div class="search_label"><span class="required-span">* </span>绱ф�ョ▼搴︼細</div>
             <div class="search_input">
@@ -465,17 +473,17 @@
             <template slot-scope="scope">
               <el-input size="small" placeholder="瑕佹眰鎻忚堪" v-model="scope.row.tell" clearable type="textarea"
                 :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'tell')"
-                v-if="active==1&&isAskOnlyRead"></el-input>
+                v-if="active==1"></el-input>
               <span v-else>
                 <template >{{ scope.row.tell }}</template>
               </span>
             </template>
           </el-table-column>
-          <el-table-column prop="ask" label="瑕佹眰鍊�" min-width="220px" v-if="isAskOnlyRead">
+          <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"
                 :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'ask')"
-                v-if="active==1&&isAskOnlyRead&&scope.row.inspectionValueType!='5'"></el-input>
+                v-if="active==1&&scope.row.inspectionValueType!='5'"></el-input>
               <span v-else>
                 <!-- <template v-if="(scope.row.ask.indexOf('D')>-1
                 ||scope.row.ask.indexOf('W')>-1
@@ -523,7 +531,7 @@
         <el-button type="primary" @click="selectUser">纭� 瀹�</el-button>
       </span>
     </el-dialog>
-    <el-dialog title="閫夋嫨鏍峰搧" :visible.sync="selectStandardTree" width="400px">
+    <el-dialog title="閫夋嫨鏍峰搧" :visible.sync="selectStandardTree" width="500px">
       <div class="body" style="height: 60vh;overflow-y: auto;user-select: none;" v-if="selectStandardTree">
         <el-row>
           <el-col :span="24">
@@ -920,7 +928,6 @@
 import equipConfig from './equip-config.vue'
 import cableConfig from './cable-config.vue'
 import Vue from 'vue'
-import {iuCharts} from "../../../util/echarts";
 
 export default {
     components: {
@@ -981,7 +988,9 @@
           production: null,
           productionEn: null,
           companyId: null,
-          prepareUser:null
+          prepareUser:null,
+          departmentLimsId:null,
+          departmentLims:null
         },
         sample: {
           sampleCode: null,
@@ -1118,6 +1127,7 @@
         temId: '',
         sonLaboratoryList:[],
         selectiveEcho: [], // 妫�楠屼笅鍗曠殑鏃跺�欏嬀閫夋楠岄」鐩�,濡傛灉浣跨敤绛涢�夋彁浜ゆ樉绀烘楠岄」鐩负绌� 鍥炴樉鍒楄〃
+        deaprtEnum:[]
       }
     },
     watch: {
@@ -1185,6 +1195,7 @@
       this.selectEnumByCategoryForUnit()
       this.selectStandardMethods()
       this.selectEnumByCategoryForOrderType()
+      this.selectDepartmentEnum()
       // this.selectEnumByCategoryForSonLaboratory()
       this.selectEnumByCategoryForSampleForm()
       if (this.active != 1) {
@@ -1578,6 +1589,15 @@
         return str.replace(find, value);
       },
       save() {
+        if(this.addObj.orderType=='C'&&this.addObj.departmentLimsId){
+          this.addObj.departmentLims = this.deaprtEnum.find(m=>m.id==this.addObj.departmentLimsId).name
+        }else if(this.addObj.orderType&&this.addObj.orderType!='C'&&!this.addObj.departmentLimsId){
+          this.addObj.departmentLims = '妫�娴嬩腑蹇�'
+          this.addObj.departmentLimsId = this.deaprtEnum.find(m=>m.name=='妫�娴嬩腑蹇�').id
+        }else{
+          this.$message.error('璇烽�夋嫨妫�楠岀被鍒�')
+          return
+        }
         if (!this.addObj.companyId) {
           this.$message.error('鏈�夋嫨瀹㈡埛鍗曚綅')
           return
@@ -1592,6 +1612,8 @@
           this.$message.error('璇疯緭鍏ョ敓浜у崟浣�')
         } else if (!this.addObj.productionEn) {
           this.$message.error('璇疯緭鍏ョ敓浜у崟浣岴N')
+        }else if (!this.addObj.departmentLimsId) {
+          this.$message.error('閫夋嫨涓嬪崟鍒板摢涓儴闂�')
         } else if (this.sampleList.length < 1) {
           this.$message.error('璇锋坊鍔犱竴涓牱鍝�')
         } else if (!this.sampleList.every(m => m.sample)) {
@@ -1601,54 +1623,14 @@
         } else if (!this.sampleList.every(m => m.standardMethodListId)) {
           this.$message.error('璇烽�夋嫨妫�楠屾爣鍑�')
         } else {
-          const select = this.selectTree.split(' - ')
-          const productListSelected = this.productListSelected.some(item => item.inspectionItem === '娓╁害寰幆')
-          let isHaveBushing = ''
-          this.sampleList.forEach(item => {
-            if (!item.bushing || item.bushing.length === 0) {
-              isHaveBushing = false
-            }
-          })
-          //杩囨护妫�娴嬮」锛氬幓闄ょ壒娈婇」
-          let filterProductList = this.productListSelected.filter(ele=>ele.bsm==0&&/[0-9]/.test(ele.ask)).filter(ele=>{
-              if(select[1].indexOf('閫氫俊')>=0 && ['鍏夌紗','鍏夌氦'].includes(select[2])){
-                return !['娓╁害寰幆','鍏夌氦鎺ュご鎹熻��'].includes(ele.inspectionItem)
-              }
-              return true
-          }).filter(ele=>{
-              if(select[1].indexOf('鐢靛姏')>=0){
-                return !['娓╁崌璇曢獙','鐑惊鐜�'].includes(ele.inspectionItem)
-              }
-              return true
-          })
           //鏍¢獙妫�楠岄」鐨勮姹傚�煎拰瑕佹眰鎻忚堪,浠呭鎵樿姹�
-          if(this.active==1&&this.isAskOnlyRead){
-            const isTrue = this.checkRequiredValueAndRemark(filterProductList)
-            if(!isTrue){
-              this.$message.error('妫�楠岄」鐨勮姹傚�间笌瑕佹眰鎻忚堪涓嶅尮閰嶏紝 璇锋鏌�')
-              return
-            }
-          }
-
-          // console.log('isHaveBushing===', this.totalArr)
-          let spcialItem = this.totalArr.filter(a => a.state == 1 && a.inspectionItem.includes('鏉惧绠�'))
-          if (productListSelected && select[2] === '鍏夌紗' && isHaveBushing === false&&spcialItem.length==0) {
-            this.$message.error('鍏夌紗娓╁害寰幆椤圭洰蹇呴』杩涜鍏夌氦閰嶇疆')
-            this.$refs.sampleTable.setCurrentRow(this.currentMethod, true)
-            this.rowClick(this.currentMethod)
-            this.sampleIds = [this.currentMethod.id]
-            this.openConfig()
-            return
-          }else if(spcialItem.length>0&& isHaveBushing === false){
-            this.$message.error('鏉惧绠¢」鐩繀椤昏繘琛屽厜绾ら厤缃�')
-            // this.$refs.sampleTable.setCurrentRow(this.currentMethod, true)
-            // this.rowClick(this.currentMethod)
-            spcialItem.forEach(item=>{
-              this.sampleIds.push(item.id)
-            })
-            this.openConfig()
-            return
-          }
+          // if(this.active==1&&this.isAskOnlyRead){
+          //   const isTrue = this.checkRequiredValueAndRemark(filterProductList)
+          //   if(!isTrue){
+          //     this.$message.error('妫�楠岄」鐨勮姹傚�间笌瑕佹眰鎻忚堪涓嶅尮閰嶏紝 璇锋鏌�')
+          //     return
+          //   }
+          // }
           let sampleList = this.HaveJson(this.sampleList)
           let projectNum = this.totalArr.filter(a => a.state == 1).length
           if(projectNum==0){
@@ -1821,7 +1803,7 @@
                         }
                       }
                     }else{
-                      this.$message.error('瑕佹眰鍊间负绌猴紝闇�瑕佸幓鏍囧噯搴撶淮鎶わ紒')
+                      // this.$message.error('瑕佹眰鍊间负绌猴紝闇�瑕佸幓鏍囧噯搴撶淮鎶わ紒')
                     }
                   }
                   // arr.forEach(f => {
@@ -1993,6 +1975,22 @@
         }
       },
       saveMethod(sampleList){
+        let isHaveAsk = this.totalArr.filter(a => (a.ask === null||a.ask=='')&&a.state==1)
+        if (isHaveAsk.length > 0) {
+          this.$message({
+            type: 'error',
+            message: '璇峰~鍐欒姹傚�煎悗鍐嶆彁浜�'
+          })
+          return false;
+        }
+        let isHaveTell = this.totalArr.filter(a => (a.tell == null||a.tell=='')&&a.state==1)
+        if (isHaveTell.length > 0) {
+          this.$message({
+            type: 'error',
+            message: '璇峰~鍐欒姹傛弿杩板悗鍐嶆彁浜�'
+          })
+          return false;
+        }
         this.saveLoad = true
         this.$axios.post(this.$api.insOrder.addInsOrder, {
           str: JSON.stringify({
@@ -3192,6 +3190,11 @@
         if(this.sonLaboratoryList.length>0){
           this.distributeData.sonLaboratory = this.sonLaboratoryList[0].value
         }
+      },
+      selectDepartmentEnum(){
+        this.$axios.get(this.$api.department.selectDepartmentLimsEnum).then(res=>{
+          this.deaprtEnum = res.data
+        })
       }
     }
   }

--
Gitblit v1.9.3