From 1980a84b1aeabf2fda317b1c8ffd0a3cc1ba2b26 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 12 三月 2024 15:54:54 +0800
Subject: [PATCH] 完成产品追溯,成品库存、成品出库修改

---
 src/views/product/producttraceability/index.vue |  269 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 192 insertions(+), 77 deletions(-)

diff --git a/src/views/product/producttraceability/index.vue b/src/views/product/producttraceability/index.vue
index c24a617..a4b1dd2 100644
--- a/src/views/product/producttraceability/index.vue
+++ b/src/views/product/producttraceability/index.vue
@@ -16,21 +16,21 @@
                 ></tRemoteSelect>
             </el-col>
             <el-col :span="8">
-                <el-select v-model="selBatchNo" class="lmes-select" placeholder="璇烽�夋嫨鎵规鍙�">
-                    <el-option :label="item" :key="index" v-for="(item,index) in selBatchNoList"></el-option>
+                <el-select @change="changePart" v-model="selBatchNo" class="lmes-select" placeholder="璇烽�夋嫨鎵规鍙�">
+                    <el-option :label="item" :value="item" :key="index" v-for="(item,index) in selBatchNoList"></el-option>
                 </el-select>
             </el-col>
         </el-row>
 
       </div>
-      <div style="margin-left:20px;">
+      <!-- <div style="margin-left:20px;">
         <el-radio v-model="traceType" label="posite" @change="changeTraceType"
           >鍙嶅悜杩芥函</el-radio
         >
         <el-radio v-model="traceType" label="negate" @change="changeTraceType"
           >姝e悜杩芥函</el-radio
         >
-      </div>
+      </div> -->
     </div>
     <div class="product-traceability-body-div">
       <div class="product-traceability-relationship-div">
@@ -272,10 +272,10 @@
                   <div>宸ヤ綔绔欙細</div>
                   <div>鎶ュ伐鍗曞彿锛�</div>
                   <div>鎶ュ伐浜哄憳锛�</div>
-                  <div>浜у搧缂栧彿锛�</div>
+                  <div>鎵规鍙凤細</div>
                   <div>闆朵欢鍙凤細</div>
                   <div>鍗曚綅锛�</div>
-                  <div>浜у嚭鏁伴噺锛�</div>
+
                 </div>
                 <div class="product-traceability-producttracking-val-div">
                   <div :title="currProductTracking.workstationName">
@@ -290,7 +290,6 @@
                     {{ currProductTracking.partNo }}
                   </div>
                   <div>{{ currProductTracking.unit }}</div>
-                  <div>{{ currProductTracking.productQty }}</div>
                 </div>
               </div>
               <div class="product-traceability-producttracking-item-div">
@@ -298,19 +297,21 @@
                   <div>鐝粍锛�</div>
                   <div>姹囨姤宸ュ簭锛�</div>
                   <div>姹囨姤鏃堕棿锛�</div>
-                  <div>鎵瑰彿锛�</div>
+                  <!-- <div>鎵瑰彿锛�</div> -->
                   <div>闆朵欢鎻忚堪锛�</div>
                   <div>鐢熶骇鏃ユ湡锛�</div>
+                  <div>浜у嚭鏁伴噺锛�</div>
                 </div>
                 <div class="product-traceability-producttracking-val-div">
                   <div>{{ currProductTracking.crewName }}</div>
                   <div>{{ currProductTracking.operationName }}</div>
                   <div>{{ currProductTracking.trackingTime }}</div>
-                  <div>{{ currProductTracking.systemNo }}</div>
+                  <!-- <div>{{ currProductTracking.systemNo }}</div> -->
                   <div :title="currProductTracking.partName">
                     {{ currProductTracking.partName }}
                   </div>
                   <div>{{ currProductTracking.productDate }}</div>
+                  <div>{{ currProductTracking.productQty }}</div>
                 </div>
               </div>
             </div>
@@ -343,7 +344,110 @@
           </el-tab-pane> -->
           <el-tab-pane label="妫�娴嬩俊鎭�" name="妫�娴嬩俊鎭�">
             <div style="margin-top:10px;">
-              <el-tabs type="card">
+                <div class="process" v-if="process">
+                    <el-divider
+                    class="pane-divider"
+                    direction="vertical"
+                    ></el-divider>
+                    <span style="font-size:14px;font-weight:bold"
+                    >杩囩▼妫�</span>
+                    <div style="font-size: 12px;margin-top: 10px;margin-left: 10px;">鏍峰搧鍚嶏細<span style="font-weight: 700;">{{process.sampleName}}</span></div>
+                    <el-table
+                    stripe
+                    :data="process.sampleItem"
+                    :height="paramsTableHeight"
+                    :header-cell-style="paramsTableHeaderStyle0"
+                    :row-class-name="tableRowClassName"
+                    class="taskinfo-params-table"
+                    style="margin: 10px;width: 95%;"
+                  >
+                    <el-table-column
+                      prop="father"
+                      label="椤圭洰"
+                      align="center"
+                      min-width="75px"
+                    />
+                    <el-table-column
+                      prop="name"
+                      label="鎸囨爣"
+                      align="center"
+                      min-width="100px"
+                    />
+                    <el-table-column
+                      prop="result"
+                      label="缁撴灉"
+                      align="center"
+                      min-width="60px"
+                    >
+                      <template slot-scope="scope">
+                        {{
+                          scope.row.isQualified == 0
+                            ? '涓嶅悎鏍�'
+                            : '鍚堟牸'
+                        }}
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                      prop="userName"
+                      label="妫�楠屼汉"
+                      align="center"
+                      min-width="90px"
+                    />
+                  </el-table>
+                </div>
+                <div class="product" v-if="finished" :class="{checkMore:process}">
+                    <el-divider
+                    class="pane-divider"
+                    direction="vertical"
+                    ></el-divider>
+                    <span style="font-size:14px;font-weight:bold"
+                    >浜у搧妫�</span>
+                    <div style="font-size: 12px;margin-top: 10px;margin-left: 10px;">鏍峰搧鍚嶏細<span style="font-weight: 700;">{{finished.sampleName}}</span></div>
+                    <el-table
+                    stripe
+                    :data="finished.sampleItem"
+                    :height="paramsTableHeight"
+                    :header-cell-style="paramsTableHeaderStyle0"
+                    :row-class-name="tableRowClassName"
+                    class="taskinfo-params-table"
+                    style="margin: 10px;width: 95%;"
+                  >
+                    <el-table-column
+                      prop="father"
+                      label="椤圭洰"
+                      align="center"
+                      min-width="75px"
+                    />
+                    <el-table-column
+                      prop="name"
+                      label="鎸囨爣"
+                      align="center"
+                      min-width="100px"
+                    />
+                    <el-table-column
+                      prop="result"
+                      label="缁撴灉"
+                      align="center"
+                      min-width="60px"
+                    >
+                      <template slot-scope="scope">
+                        {{
+                          scope.row.isQualified == 0
+                            ? '涓嶅悎鏍�'
+                            : '鍚堟牸'
+                        }}
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                      prop="userName"
+                      label="妫�楠屼汉"
+                      align="center"
+                      min-width="90px"
+                    />
+                  </el-table>
+                </div>
+                <!-- <p v-show="!process&&!finished">鏆傛棤鏁版嵁</p> -->
+              <!-- <el-tabs type="card">
                 <el-tab-pane
                   v-for="(item, index) in checkItemList"
                   :key="item.reportTypeLabel"
@@ -422,25 +526,7 @@
                     </el-table-column>
                   </el-table>
                 </el-tab-pane>
-                <!--<el-tab-pane label="闄勪欢">
-                  <el-upload
-                    drag
-                    ref="upload"
-                    action="/mes/reportSample/upload"
-                    :headers="headers"
-                    :auto-upload="true"
-                    :file-list="fileList"
-                    list-type="text"
-                    :on-preview="handlePreview"
-                    :with-credentials="true"
-                  >
-                    <i class="el-icon-upload"></i>
-                    <div class="el-upload__text">
-                      灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
-                    </div>
-                  </el-upload>
-                </el-tab-pane>-->
-              </el-tabs>
+              </el-tabs> -->
             </div>
           </el-tab-pane>
           <el-tab-pane label="鐢熶骇璁板綍" name="鐢熶骇璁板綍">
@@ -545,7 +631,7 @@
                             </el-table-column>
                           </el-table>
                         </el-tab-pane>
-                        <el-tab-pane label="闄勪欢">
+                        <!-- <el-tab-pane label="闄勪欢">
                           <el-upload
                             ref="upload"
                             action="/mes/operationTask/upload"
@@ -555,7 +641,7 @@
                             :auto-upload="false"
                             list-type="picture"
                           ></el-upload
-                        ></el-tab-pane>
+                        ></el-tab-pane> -->
                       </el-tabs>
                     </div>
                   </div>
@@ -667,7 +753,7 @@
               </el-tabs>
             </div>
           </el-tab-pane>
-          <el-tab-pane label="妯″叿淇℃伅" name="妯″叿淇℃伅">
+          <!-- <el-tab-pane label="妯″叿淇℃伅" name="妯″叿淇℃伅">
             <div style="margin-top:10px;">
               <el-table
                 ref="mouldRecordTable"
@@ -772,7 +858,7 @@
                 </el-table-column>
               </el-table>
             </div>
-          </el-tab-pane>
+          </el-tab-pane> -->
         </el-tabs>
       </div>
     </div>
@@ -980,6 +1066,9 @@
 .taskinfo-params-table >>> td {
   padding: 3px 0px;
 }
+.checkMore{
+    margin-top: 20px;
+}
 </style>
 <script>
 import {
@@ -1128,7 +1217,9 @@
       traceType: 'posite',
       reportTypeOptions: [],
       checkItemList: [],
-      mouldRecordList: []
+      mouldRecordList: [],
+      finished:null,
+      process:null
     }
   },
   mounted() {
@@ -1138,6 +1229,7 @@
   },
   methods: {
     queryBatchNoData(){
+        this.selBatchNo = null
         queryByCustomerOrderId({customerOrderId : this.systemNo}).then(res=>{
             if(res.status===200){
                 this.selBatchNoList = res.data.data
@@ -1248,10 +1340,12 @@
       } else {
         this.partList = []
       }
+      this.selBatchNo = null
+      this.selBatchNoList = []
     },
     changePart() {
-      if (this.systemNo != null && this.systemNo !== '') {
-        const query = { systemNo: this.systemNo, traceType: this.traceType }
+      if (this.selBatchNo != null && this.selBatchNo !== '') {
+        const query = { systemNo: this.selBatchNo, traceType: this.traceType }
         queryDiagram(query)
           .then((response) => {
             var data = response.data
@@ -1261,15 +1355,15 @@
                 const hasOutNode = data.data.linkDataArray.find((ele) => {
                   return ele.from === item.key
                 })
-                item.batchNo = 'SN鍙�:' + item.batchNo
+                item.batchNo = '鎵规鍙�:' + item.batchNo
                 item.quantity =
                   '鎶曞叆鏁伴噺:' +
                   (hasOutNode ? item.quantity : 0) +
                   ' ' +
                   item.unit
-                item.ifsBatchNo =
-                  'IFS鎵规鍙�:' +
-                  (item.ifsBatchNo == null ? '' : item.ifsBatchNo)
+                // item.ifsBatchNo =
+                //   'IFS鎵规鍙�:' +
+                //   (item.ifsBatchNo == null ? '' : item.ifsBatchNo)
               })
               this.modelData = {
                 nodeDataArray: data.data.nodeDataArray,
@@ -1328,39 +1422,51 @@
                   _that.currProductTracking = {}
                 }
                 // 妫�娴嬩俊鎭�
-                const sampleItemList = data.data.sampleItems
-                if (sampleItemList != null && sampleItemList.length > 0) {
-                  _that.paramValues = sampleItemList
-                  _that.checkItemList = []
-                  sampleItemList.forEach((item) => {
-                    const reportTypeLabel = _that.reportTypeOptions.find(
-                      (el) => {
-                        return item.reportType == el.value
-                      }
-                    )
-                    if (reportTypeLabel) {
-                      const existCheckItem = _that.checkItemList.find(
-                        (checkItem) => {
-                          return (
-                            reportTypeLabel.label == checkItem.reportTypeLabel
-                          )
-                        }
-                      )
-                      if (existCheckItem) {
-                        existCheckItem.itemList.push(item)
-                      } else {
-                        _that.checkItemList.push({
-                          reportTypeLabel: reportTypeLabel.label,
-                          itemList: [item]
-                        })
-                      }
-                    }
-                  })
-                  // reportTypeOptions
-                } else {
-                  _that.paramValues = []
-                  _that.checkItemList = []
+                const sampleItems = data.data.sampleItems
+                // 妫�娴嬩俊鎭�-杩囩▼妫�
+                if(sampleItems&&sampleItems.process&&sampleItems.process.length>0){
+                    _that.process = sampleItems.process[0]
+                }else{
+                    _that.process = null
                 }
+                // 妫�娴嬩俊鎭�-浜у搧妫�
+                if(sampleItems&&sampleItems.finished&&sampleItems.finished.length>0){
+                    _that.finished = sampleItems.finished[0]
+                }else{
+                    _that.finished = null
+                }
+                // if (sampleItemList != null && sampleItemList.length > 0) {
+                //   _that.paramValues = sampleItemList
+                //   _that.checkItemList = []
+                //   sampleItemList.forEach((item) => {
+                //     const reportTypeLabel = _that.reportTypeOptions.find(
+                //       (el) => {
+                //         return item.reportType == el.value
+                //       }
+                //     )
+                //     if (reportTypeLabel) {
+                //       const existCheckItem = _that.checkItemList.find(
+                //         (checkItem) => {
+                //           return (
+                //             reportTypeLabel.label == checkItem.reportTypeLabel
+                //           )
+                //         }
+                //       )
+                //       if (existCheckItem) {
+                //         existCheckItem.itemList.push(item)
+                //       } else {
+                //         _that.checkItemList.push({
+                //           reportTypeLabel: reportTypeLabel.label,
+                //           itemList: [item]
+                //         })
+                //       }
+                //     }
+                //   })
+                //   // reportTypeOptions
+                // } else {
+                //   _that.paramValues = []
+                //   _that.checkItemList = []
+                // }
                 _that.currOperateTask = data.data.operationTask
                 if (_that.currOperateTask == null) {
                   _that.currOperateTask = {
@@ -1388,11 +1494,11 @@
                   _that.productRecordParamValues = []
                   _that.paramTabs = []
                 } else {
-                  // 宸ユ淇℃伅
-                  _that.getStepRecords({
-                    id: _that.currOperateTask.id,
-                    sn: nodeData.batchNo.split('SN鍙�:')[1]
-                  })
+                  // 宸ユ淇℃伅--鎶ラ敊娉ㄩ噴鎺変簡
+                //   _that.getStepRecords({
+                //     id: _that.currOperateTask.id,
+                //     sn: nodeData.batchNo.split('SN鍙�:')[1]
+                //   })
                   // 宸ヨ壓鍙傛暟淇℃伅
                   _that.queryTechnologyInfo(_that.currOperateTask.id)
                   // 鐢熶骇璁板綍
@@ -1612,6 +1718,15 @@
       }
       return headerStyle
     },
+    paramsTableHeaderStyle0({ row, column, rowIndex, columnIndex }) {
+      let headerStyle = 'background:#599ef4;color:#fff;'
+      if (columnIndex === 0) {
+        headerStyle += 'border-radius: 6px 0px 0px 0px;'
+      } else if (columnIndex === 3) {
+        headerStyle += 'border-radius: 0px 6px 0px 0px;'
+      }
+      return headerStyle
+    },
     tableRowClassName({ row, rowIndex }) {
       if (rowIndex % 2 === 1) {
         return 'stripe-row'

--
Gitblit v1.9.3