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/view/b2-standard.vue                    |   20 ++++++
 src/components/do/b1-ins-order/add.vue                 |  111 +++++++++++++++++++------------------
 src/main.js                                            |    4 
 src/components/do/b1-inspect-order-plan/Inspection.vue |   12 +++
 src/assets/api/controller.js                           |    2 
 5 files changed, 89 insertions(+), 60 deletions(-)

diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js
index 6d16d55..077cdc7 100644
--- a/src/assets/api/controller.js
+++ b/src/assets/api/controller.js
@@ -234,6 +234,7 @@
   inExcelOfTree: "/standardTree/inExcelOfTree", //瀵煎叆鏍囧噯搴�
   resetTreeOfPrice: "/standardTree/resetTreeOfPrice", //閲嶇疆鏍囧噯搴撳崟浠�
   resetTreeOfHour: "/standardTree/resetTreeOfHour", //閲嶇疆鏍囧噯搴撳伐鏃剁郴鏁�
+  exportStandTree: "/standardTree/exportStandTree", //閲嶇疆鏍囧噯搴撳伐鏃剁郴鏁�
 }
 
 const standardMethod = {
@@ -289,6 +290,7 @@
   addDepartmentLims: "/department/addDepartmentLims", //娣诲姞閮ㄩ棬
   delDepartmentLims: "/department/delDepartmentLims", //鍒犻櫎閮ㄩ棬
   selectDepartmentEnum: "/department/selectDepartmentEnum", //鑾峰彇缁勭粐鏋舵瀯鏋氫妇
+  selectDepartmentLimsEnum: "/department/selectDepartmentLimsEnum", //鑾峰彇缁勭粐鏋舵瀯鏋氫妇
 }
 
 const report = {
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
+        })
       }
     }
   }
diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index e6886ed..d375aa1 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -258,7 +258,7 @@
         <el-button size="small" type="primary" @click="bushingVisible=true" v-if="bushing.length>0">濂楃鍒囨崲</el-button> -->
         <el-button size="small" type="primary" @click="sampleVisible=true;uploadSample()">鏍峰搧鍒囨崲</el-button>
         <el-button size="small" type="primary" @click="taskVisible=true">浠诲姟鍒囨崲</el-button>
-        <el-button size="small" type="primary" @click="addVerifyDia = true" v-if="state==1"
+        <el-button size="small" type="primary" @click="handleSubmit" v-if="state==1"
           :loading="submitLoading">鎻愪氦</el-button>
         <!-- 澶嶆牳 -->
         <el-button size="medium" type="primary" @click="upInsReview(1)" :loading="reviewLoading"
@@ -1460,7 +1460,7 @@
             }else{
               str0 = i+','+j
             }
-            if(j!='frequency'&&data[i][j]&&typeof data[i][j].result == 'string'){
+            if(j!='frequency'&&data[i][j]&&(!data[i][j].result||typeof data[i][j].result == 'string')){
               // 澶勭悊鏁伴噰淇℃伅鏍煎紡
               this.dataAcquisitionInfo[str0] = {
                 value:data[i][j].result,
@@ -3336,6 +3336,14 @@
           this.$message.error('鏈緭鍏ヤ笉閫氳繃鍘熷洜')
         }
       },
+      handleSubmit(){
+        if(this.insOrder.departmentLims=='妫�娴嬩腑蹇�'&&this.insOrder.orderType=='C'){
+          this.verifyUser = this.insOrder.prepareUserId
+          this.submit()
+        }else{
+          this.addVerifyDia = true
+        }
+      },
       submit() {
         if (this.verifyUser === null || this.verifyUser === '') {
           this.$message.error("璇锋寚瀹氬鏍镐汉鍛�")
diff --git a/src/components/view/b2-standard.vue b/src/components/view/b2-standard.vue
index aabd7fb..3757e89 100644
--- a/src/components/view/b2-standard.vue
+++ b/src/components/view/b2-standard.vue
@@ -5,7 +5,7 @@
   }
 
   .left {
-    width: 270px;
+    width: 330px;
     height: calc(100% - 40px - 10px);
     background-color: white;
     padding: 15px;
@@ -33,7 +33,7 @@
 
   .right {
     margin-left: 5px;
-    width: calc(100% - 305px);
+    width: calc(100% - 365px);
     height: calc(100% - 40px);
   }
 
@@ -208,6 +208,7 @@
     <div class="right">
       <el-row class="title" style="width: 100%;">
         <el-col :span="20" style="font-size: 14px;color: #999;">{{selectTree}}</el-col>
+        <el-button size="small" type="primary" style="position: absolute;right: 170px;top: 1px;" @click="handleDown" v-if="inExcelOfTreePower" :loading="outLoading">瀵煎嚭</el-button>
         <el-button size="small" type="primary" style="position: absolute;right: 100px;top: 1px;" @click="uploadDia = true" v-if="inExcelOfTreePower">瀵煎叆</el-button>
         <el-button size="small" type="primary" @click="handleMore" style="position: absolute;right: 5px;top: 1px;"
           v-if="upStandardProduct">鎵归噺缂栬緫</el-button>
@@ -635,6 +636,7 @@
         inExcelOfTreePower: false,
         uploading: false,
         isEquipment: false,
+        outLoading:false
       }
     },
     watch: {
@@ -1544,6 +1546,20 @@
             })
           }
         }).catch(() => {})
+      },
+      handleDown(){
+        this.outLoading = true
+        this.$axios.get(this.$api.standardTree.exportStandTree,{responseType: 'blob'}).then(res => {
+          this.outLoading = false
+          this.$message.success('瀵煎嚭鎴愬姛')
+          const blob = new Blob([res],{ type: 'application/force-download' });
+          const url = URL.createObjectURL(blob);
+          const link = document.createElement('a');
+          link.href = url;
+          link.download = '妫�楠屾爣鍑�.xlsx';
+          link.click();
+          document.body.removeChild(link)
+        })
       }
     }
   }
diff --git a/src/main.js b/src/main.js
index 435e154..c3b1ea1 100644
--- a/src/main.js
+++ b/src/main.js
@@ -20,10 +20,10 @@
 //鏈湴
 // Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
 // const javaApi = 'http://127.0.0.1:8001';
-// const javaApi = 'http://192.168.0.104:8001';
+const javaApi = 'http://192.168.0.104:8001';
 //浜�
 // Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080";
-const javaApi = 'http://114.132.189.42:1234';
+// const javaApi = 'http://114.132.189.42:1234';
 
 // //妫�娴嬩腑蹇冩寮忓簱
 // Vue.prototype.LOCATIONVUE = "http://10.1.200.86:8080";

--
Gitblit v1.9.3