From 90e8eda30ad7283a2d39d973e467baadfb155f0e Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 15 十月 2024 13:19:30 +0800
Subject: [PATCH] 新增功率特殊项目,工时填写

---
 src/components/do/b1-inspect-order-plan/humidity.vue       |    7 
 src/components/do/b1-ins-order/add.vue                     |   69 +++++++++++
 src/components/do/b1-inspect-order-plan/power-capacity.vue |  164 +++++++++++++++++++++++++++
 src/components/do/b1-inspect-order-plan/Inspection.vue     |  105 ++++++++++++++---
 src/components/view/b1-inspect-order-plan.vue              |    2 
 src/components/view/b1-sample.vue                          |    2 
 6 files changed, 323 insertions(+), 26 deletions(-)

diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index 0744bff..c235e47 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -996,6 +996,44 @@
         <el-button type="primary" @click="spliceTemperatureTest">淇濆瓨</el-button>
       </span>
     </el-dialog>
+    <!-- 鍔熺巼瀹归噺--濉啓绔彛 -->
+    <el-dialog title="濉啓绔彛" :visible.sync="powerShow"
+      :close-on-click-modal="false" :close-on-press-escape="false"
+      width="50%">
+      <el-table
+        :data="powerTable"
+        border
+        style="width: 100%">
+        <el-table-column
+          fixed
+          prop="sample"
+          label="鏍峰搧"
+          min-width="150">
+        </el-table-column>
+        <el-table-column
+          prop="model"
+          label="鍨嬪彿"
+          min-width="120">
+        </el-table-column>
+        <el-table-column
+          prop="inspectionItem"
+          label="妫�楠岄」"
+          min-width="120">
+        </el-table-column>
+        <el-table-column
+          prop="ask"
+          label="绔彛"
+          min-width="120">
+          <template slot-scope="scope">
+            <el-input-number v-model="scope.row.ask" :min="1" :max="100" label="绔彛" size="small"></el-input-number>
+          </template>
+        </el-table-column>
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="powerShow=false">鍙栨秷</el-button>
+        <el-button type="primary" @click="savePowerTest">淇濆瓨</el-button>
+      </span>
+    </el-dialog>
     <el-dialog
       title="鏂囦欢棰勮"
       :visible.sync="lookFileVisible"
@@ -1270,7 +1308,9 @@
         ruleInfo:{
           rule:null,
           num:null,
-        }
+        },
+        powerShow:false,
+        powerTable:[]
       }
     },
     watch: {
@@ -1547,6 +1587,24 @@
           return
         }
         this.spliceTemperatureTest()
+      },
+      savePowerTest(){
+        if(!this.powerTable.every(m=>m.ask))
+        {
+          this.$message.error('璇峰~鍐欏畬鏁存暟鎹�')
+        }
+        let num = 0;
+        let sampleList = this.HaveJson(this.sampleList)
+        sampleList.forEach(item=>{
+          item.insProduct.forEach(m=>{
+            if(m.inspectionItem.includes('鍔熺巼璇曢獙')&&m.state==1){
+              m.ask = '绔彛鏁�:'+this.powerTable[num].ask
+              num++
+            }
+          })
+        })
+        this.saveMethod(sampleList)
+        this.powerShow = false;
       },
       cleanTemperatureTest () {
         this.temperatureTest = []
@@ -1867,6 +1925,15 @@
               this.bsm3Dia = true;
               return
             }
+            let isPower = this.totalArr.find(a => a.inspectionItem.includes('鍔熺巼璇曢獙')&&a.state==1)
+            if (isPower) {
+              this.powerTable = this.totalArr.filter(a => a.inspectionItem.includes('鍔熺巼璇曢獙')&&a.state==1)
+              this.powerTable.forEach(a => {
+                a.ask = null
+              })
+              this.powerShow = true;
+              return
+            }
             this.saveMethod(sampleList)
           }
         }
diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index 178322a..15a7f7b 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -347,7 +347,7 @@
         </div> -->
       </div>
       <!-- 甯歌妫�楠屽師濮嬭褰� -->
-      <div class="center-box" id="nav" v-loading="tableLoading" v-if="!tableLists.find(m=>m.templateId==currentTable)||(!tableLists.find(m=>m.templateId==currentTable).templateName.includes('鐢佃矾璇曢獙')&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('娓╂箍搴﹁瘯楠�'))">
+      <div class="center-box" id="nav" v-loading="tableLoading" v-if="!tableLists.find(m=>m.templateId==currentTable)||(!tableLists.find(m=>m.templateId==currentTable).templateName.includes('鐢佃矾璇曢獙')&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('娓╂箍搴﹁瘯楠�')&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('鍔熺巼瀹归噺'))">
         <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index+currentTable+currentSample.id">
           <tbody>
             <tr v-for="(m,i) in item.arr" :key="i">
@@ -730,9 +730,13 @@
         <CircuitParameters2 v-if="currentTableState==1" :insProduct="currentSample.insProduct" :orderId="id" :sampleId="currentSample.id" :state="state" :num="currentSample.num1" :isLook="isLook" :currentNum="currentNum"></CircuitParameters2>
       </div>
       <!-- 娓╂箍搴﹁瘯楠� -->
-       <div v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName.includes('娓╂箍搴﹁瘯楠�')">
+      <div v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName.includes('娓╂箍搴﹁瘯楠�')">
         <Humidity :insProduct="currentSample.insProduct" :orderId="id" :sampleId="currentSample.id" :state="state" :isLook="isLook" :num="currentSample.num1"/>
-       </div>
+      </div>
+      <!-- 鍔熺巼璇曢獙 -->
+      <div v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName.includes('鍔熺巼瀹归噺')">
+        <PowerCapacity :insProduct="currentSample.insProduct" :orderId="id" :sampleId="currentSample.id" :state="state" :isLook="isLook" :num="currentSample.num1" />
+      </div>
       <el-upload :action="action"
       :data="{
         orderId:id
@@ -858,20 +862,42 @@
         <el-button type="primary" :loading="versionLoading" @click="saveVersion">纭� 瀹�</el-button>
       </span>
     </el-dialog>
-    <el-dialog title="璇曢獙淇℃伅" :visible.sync="experimentDia" width="400px">
-      <div class="body" style="display: flex;padding: 10px;align-items: center;">
+    <el-dialog title="璇曢獙淇℃伅" :visible.sync="experimentDia" width="50%">
+      <div class="body" style="display: flex;padding: 10px;align-items: center;" v-if="experimentDia0">
         <div class="search_label" style="width: 150px;"><span class="required-span">*</span>瀹為獙闃舵</div>
         <div class="search_input" style="width: 100%;">
           <el-input clearable v-model="experimentInfo.term" size="small" placeholder=""></el-input>
         </div>
       </div>
-      <div class="body" style="display: flex;padding: 10px;align-items: center;">
+      <div class="body" style="display: flex;padding: 10px;align-items: center;" v-if="experimentDia0">
         <div class="search_label" style="width: 150px;"><span class="required-span">*</span>瀹為獙鎿嶄綔</div>
         <div class="search_input" style="width: 100%;">
           <el-input clearable v-model="experimentInfo.note" size="small" placeholder="" type="textarea"
           :rows="2"></el-input>
         </div>
       </div>
+      <table border="1" cellpadding="10" class="thermal-table">
+        <tr style="font-size: 18px;font-weight: 500;background-color: #F0F1F5;padding: 10px 0;box-sizing: border-box;">
+          <td>鏍峰搧</td>
+          <td>鏍峰搧缂栧彿</td>
+          <td>鍨嬪彿</td>
+          <td>妫�楠岄」</td>
+          <td>妫�楠屽瓙椤�</td>
+          <td>宸ユ椂</td>
+        </tr>
+        <template v-for="(item,index) in sampleProduct">
+          <tr>
+            <td :rowspan="item.insProduct.length+1">{{ item.sample }}</td>
+            <td :rowspan="item.insProduct.length+1">{{ item.sampleCode }}</td>
+            <td :rowspan="item.insProduct.length+1">{{ item.model }}</td>
+          </tr>
+          <tr v-for="(m,i) in item.insProduct" :key="item.id+i">
+            <td>{{ m.inspectionItem }}</td>
+            <td>{{ m.inspectionItemSubclass }}</td>
+            <td><el-input-number v-model="m.outputWorkTime" :min="0" :max="100" label="宸ユ椂" size="small"></el-input-number></td>
+          </tr>
+        </template>
+      </table>
       <span slot="footer" class="dialog-footer">
         <el-button @click="experimentDia = false">鍙� 娑�</el-button>
         <el-button type="primary" @click="submit0">纭� 瀹�</el-button>
@@ -895,6 +921,7 @@
   import CircuitParameters1 from './circuit-parameters1.vue'
   import CircuitParameters2 from './circuit-parameters2.vue'
   import Humidity from './humidity.vue'
+  import PowerCapacity from './power-capacity.vue'
   import filePreview from '../../tool/file-preview.vue'
   export default {
     props: ['sonLaboratory', 'orderId', 'state','inspectorList','version','orderStateId','isLook','num1','noBack'],
@@ -905,11 +932,13 @@
       CircuitParameters2,
       filePreview,
       Humidity,
+      PowerCapacity,
     },
     data() {
       return {
         lookFileVisible:false,//棰勮鏂囦欢
         experimentDia:false,
+        experimentDia0:false,
         experimentInfo:{
           note:'',
           term:''
@@ -3203,15 +3232,30 @@
         }
       },
       submit0(){
-        if(!this.experimentInfo.term){
-          this.$message.error('璇疯緭鍏ュ疄楠岄樁娈�')
-          return
+        if(this.sonLaboratory === '鐢佃矾璇曢獙'){
+          if(!this.experimentInfo.term){
+            this.$message.error('璇疯緭鍏ュ疄楠岄樁娈�')
+            return
+          }
+          if(!this.experimentInfo.note){
+            this.$message.error('璇疯緭鍏ュ疄楠屾搷浣�')
+            return
+          }
         }
-        if(!this.experimentInfo.note){
-          this.$message.error('璇疯緭鍏ュ疄楠屾搷浣�')
+        let num =0
+        this.sampleProduct.forEach(item=>{
+          item.insProduct.forEach(a=>{
+            if(!a.outputWorkTime){
+              num++
+            }
+          })
+        })
+        if(num>0){
+          this.$message.error('璇疯緭鍏ュ畬鎴愬伐鏃�')
           return
         }
         this.experimentDia = false
+        this.experimentDia0 = false
         if(this.insOrder.orderType=='C'){
           this.verifyUser = this.insOrder.prepareUserId
           this.submit()
@@ -3220,15 +3264,10 @@
         }
       },
       handleSubmit(){
+        this.experimentDia = true
+        console.log(6666,this.sampleProduct)
         if (this.sonLaboratory === '鐢佃矾璇曢獙') {
-          this.experimentDia = true
-        } else {
-          if(this.insOrder.orderType=='C'){
-            this.verifyUser = this.insOrder.prepareUserId
-            this.submit()
-          }else{
-            this.addVerifyDia = true
-          }
+          this.experimentDia0 = true
         }
       },
       submit() {
@@ -3243,14 +3282,33 @@
           laboratory: this.sonLaboratory,
         }).then(res => {
           if (res.code === 200) {
+            let auxiliaryOutputWorkingHoursList = []
+            this.sampleProduct.forEach(item=>{
+              item.insProduct.forEach(a=>{
+                let obj = {
+                  inspectionItem:a.inspectionItem,
+                  outputWorkTime:a.outputWorkTime,
+                  inspectionItemSubclass:a.inspectionItemSubclass,
+                  sample:item.id,
+                  insProductId:a.id,
+                  num:item.num
+                }
+                auxiliaryOutputWorkingHoursList.push(obj)
+              })
+            })
             if(!res.data||res.data.length==0){
               this.$axios.post(this.$api.insOrderPlan.submitPlan, {
                 orderId: this.orderId,
                 laboratory: this.sonLaboratory,
                 verifyUser: this.verifyUser,
                 entrustCode: this.insOrder.entrustCode,
+                auxiliaryOutputWorkingHoursList:auxiliaryOutputWorkingHoursList,
                 ...this.experimentInfo
-              }).then(res => {
+              }, {
+      headers: {
+        'Content-Type': 'application/json'
+      },
+      noQs:true}).then(res => {
                 if (res.code === 200) {
                   this.$message.success("鎿嶄綔鎴愬姛")
                   this.$emit('goback')
@@ -3282,8 +3340,13 @@
                   orderId: this.orderId,
                   laboratory: this.sonLaboratory,
                   verifyUser: this.verifyUser,
+                  auxiliaryOutputWorkingHoursList:auxiliaryOutputWorkingHoursList,
                   ...this.experimentInfo
-                }).then( res => {
+                }, {
+      headers: {
+        'Content-Type': 'application/json'
+      },
+      noQs:true}).then( res => {
                   if (res.code === 200) {
                     this.submitLoading = false;
                     this.$message.success("鎿嶄綔鎴愬姛")
diff --git a/src/components/do/b1-inspect-order-plan/humidity.vue b/src/components/do/b1-inspect-order-plan/humidity.vue
index 8bf256a..fc3a1d8 100644
--- a/src/components/do/b1-inspect-order-plan/humidity.vue
+++ b/src/components/do/b1-inspect-order-plan/humidity.vue
@@ -66,10 +66,10 @@
           </el-time-picker>
           </td>
           <td colspan="1">
-            <el-input v-model="m.temperature" placeholder="娓╁害" size="small" @blur	="handleReplace(m,'鈩�','temperature',item)" :disabled="state>1"></el-input>
+            <el-input v-model="m.temperature" placeholder="娓╁害" size="small" @change	="a=>handleReplace(m,'鈩�','temperature',item)" :disabled="state>1"></el-input>
           </td>
           <td colspan="1">
-            <el-input v-model="m.humidity" placeholder="婀垮害" size="small" @blur	="handleReplace(m,'%rh','humidity',item)" :disabled="state>1"></el-input>
+            <el-input v-model="m.humidity" placeholder="婀垮害" size="small" @change	="a=>handleReplace(m,'%rh','humidity',item)" :disabled="state>1"></el-input>
           </td>
           <td colspan="2">
             <el-button icon="el-icon-minus" circle size="mini" type="danger"
@@ -249,4 +249,7 @@
     display: flex;
     align-items: center;
   }
+  >>>.el-input__inner {
+    text-align: center;
+  }
 </style>
diff --git a/src/components/do/b1-inspect-order-plan/power-capacity.vue b/src/components/do/b1-inspect-order-plan/power-capacity.vue
new file mode 100644
index 0000000..19a9d2a
--- /dev/null
+++ b/src/components/do/b1-inspect-order-plan/power-capacity.vue
@@ -0,0 +1,164 @@
+<template>
+  <div>
+    <table border="1" cellpadding="10" class="thermal-table" style="margin-bottom: 20px;">
+      <tr>
+        <td style="font-size: 18px;font-weight: 500;background-color: #F0F1F5;padding: 10px 0;box-sizing: border-box;" colspan="6">{{ currentInfo.inspectionItemSubclass }}</td>
+      </tr>
+      <tr>
+        <td style="font-size: 16px;background-color: #F0F1F5;">瑙勬牸鍨嬪彿</td>
+        <td>{{currentInfo.model}}</td>
+        <td style="font-size: 16px;background-color: #F0F1F5;">璇曢獙鏂规硶</td>
+        <td>{{currentInfo.methodS}}</td>
+        <td style="font-size: 16px;background-color: #F0F1F5;">璁惧缂栧彿</td>
+        <td>
+          <el-select v-model="currentInfo.equipValue" placeholder="璇烽�夋嫨" size="small" :disabled="state>1" @focus="methodFocus(item)" @change="m=>handleEquip(m,currentInfo)">
+            <el-option
+              v-for="item in equipOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </td>
+      </tr>
+      <tr>
+        <td style="font-size: 16px;background-color: #F0F1F5;">璇曢獙瑕佹眰</td>
+        <td colspan="3" style="text-align: left;">{{currentInfo.tell}}</td>
+        <td style="font-size: 16px;background-color: #F0F1F5;">璁惧鍚嶇О</td>
+        <td>{{ currentInfo.equipName }}</td>
+      </tr>
+      <tr>
+        <td style="font-size: 16px;background-color: #F0F1F5;">绔彛</td>
+        <td colspan="3" style="font-size: 16px;background-color: #F0F1F5;">骞冲潎鍔熺巼瀹归噺(W)</td>
+        <td colspan="2" style="font-size: 16px;background-color: #F0F1F5;">宄板�煎姛鐜囧閲�(W)</td>
+      </tr>
+      <tr v-for="(item,index) in currentInfo.list" :key="index">
+        <td>{{index+1}}</td>
+        <td colspan="3">
+          <el-input v-model="item.power" placeholder="" size="small" @change="m=>save(currentInfo)" :disabled="state>1"></el-input>
+        </td>
+        <td colspan="2">
+          <el-input v-model="item.peakPower" placeholder="" size="small" @change="m=>save(currentInfo)" :disabled="state>1"></el-input>
+        </td>
+      </tr>
+    </table>
+  </div>
+</template>
+
+<script>
+export default {
+  props:['insProduct','orderId','sampleId','state','isLook','num'],
+  data() {
+    return {
+      currentInfo:{},
+      equipOptions:[],
+    }
+  },
+  watch: {
+    insProduct:{
+      deep:true,
+      handler(val){
+        this.init()
+      }
+    }
+  },
+  mounted() {
+    this.init()
+  },
+  methods: {
+    init(){
+      this.currentInfo = this.HaveJson(this.insProduct[0])
+      if(!this.currentInfo.insProductResult){
+        // 娌℃湁妫�楠屾椂鍒濆鍖�
+        this.$set(this.currentInfo, 'equipValue', '')
+        this.$set(this.currentInfo, 'equipName', '')
+        let portNum = Number(this.currentInfo.ask.split(':')[1])
+        this.$set(this.currentInfo, 'list', [])
+        for(let i=0;i<portNum;i++){
+          this.$set(this.currentInfo.list,i, {'power':null,'peakPower':null})
+        }
+      }else{
+        // 鏈夋楠屾椂鍒濆鍖�
+        this.$set(this.currentInfo, 'equipValue', this.currentInfo.insProductResult.equipValue)
+        this.$set(this.currentInfo, 'equipName', this.currentInfo.insProductResult.equipName)
+        this.currentInfo.list = JSON.parse(this.currentInfo.insProductResult.insValue)
+      }
+    },
+    async methodFocus(item){
+      this.equipOptions = await this.getEquipOptions(item)
+    },
+    // 鑾峰彇璁惧閫夐」 id:涓烘楠岄」id
+    async getEquipOptions(m) {
+      let arr = []
+      let res = await this.$axios.post(this.$api.deviceScope.selectDeviceByCategory, {
+        inspectionItem: m.inspectionItem,
+        inspectionItemSubclass: m.inspectionItemSubclass
+      })
+      if (res.code === 200 && res.data) {
+        arr = res.data.map(m => {
+          m.value = m.managementNumber
+          m.label = m.deviceName
+          return m
+        })
+      }
+      return arr
+    },/**
+   * 澶勭悊璁惧淇℃伅
+   *
+   * @param {any} m - 鏂扮殑璁惧鍊�
+   * @param {Object} item - 璁惧瀵硅薄
+   */
+    handleEquip(m,item){
+      this.$delete(item, 'equipValue')
+      this.$set(item, 'equipValue', m)
+      this.$delete(item, 'equipName')
+      this.$set(item, 'equipName', this.equipOptions.find(m=>m.value==item.equipValue).label)
+      this.save(item)
+    },
+    save(item){
+      this.$axios.post(this.$api.insOrderPlan.saveInsContext3, {
+        insProductId:item.id,
+        insValue:JSON.stringify(item.list),
+        equipValue:item.equipValue,
+        equipName:item.equipName,
+        num:this.num,
+      }, {
+      headers: {
+        'Content-Type': 'application/json'
+      },
+      noQs:true}).then(res => {
+        if (res.code === 201) {
+          this.$message.error('淇濆瓨澶辫触')
+          return
+        }
+        this.$message.success('宸蹭繚瀛�')
+      }).catch(err => {
+        console.log(err)
+      })
+    }
+  }
+}
+</script>
+
+<style lang="css" scoped>
+.thermal-table{
+    min-width: calc(100% - 10px);
+    margin: 5px 5px 0;
+    table-layout: fixed;
+  }
+  .thermal-table td {
+    min-width: 70px;
+    text-align: center;
+    font-size: 14px;
+    word-wrap: break-word;
+    white-space: normal;
+    padding: 5px;
+  }
+  .thermal-table .el-input{
+    display: flex;
+    align-items: center;
+  }
+  >>>.el-input__inner {
+    text-align: center;
+  }
+</style>
diff --git a/src/components/view/b1-inspect-order-plan.vue b/src/components/view/b1-inspect-order-plan.vue
index b10b282..f57ccbf 100644
--- a/src/components/view/b1-inspect-order-plan.vue
+++ b/src/components/view/b1-inspect-order-plan.vue
@@ -810,7 +810,7 @@
             this.sampleCode = code
           }
         }catch(e){
-          this.$message.error('璇ヤ簩缁寸爜鏈夎')
+          this.$message.error('璇疯皟鑷宠嫳鏂囬敭鐩�')
         }
         this.codeInfo = null
       },
diff --git a/src/components/view/b1-sample.vue b/src/components/view/b1-sample.vue
index 9f7e802..6afb89d 100644
--- a/src/components/view/b1-sample.vue
+++ b/src/components/view/b1-sample.vue
@@ -454,7 +454,7 @@
                 this.sampleCode = code
             }
         }catch(e){
-            this.$message.error('璇ヤ簩缁寸爜鏈夎')
+            this.$message.error('璇疯皟鑷宠嫳鏂囬敭鐩�')
         }
         this.codeInfo = null
       },

--
Gitblit v1.9.3