From a00f2386cd0e504892abb4af6cfe2f5c8502105f Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期三, 07 八月 2024 13:40:46 +0800
Subject: [PATCH] 1.递交

---
 src/views/workOrder/workOrderList.vue |  540 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 403 insertions(+), 137 deletions(-)

diff --git a/src/views/workOrder/workOrderList.vue b/src/views/workOrder/workOrderList.vue
index 94ff178..ab7f027 100644
--- a/src/views/workOrder/workOrderList.vue
+++ b/src/views/workOrder/workOrderList.vue
@@ -135,6 +135,8 @@
           :data="tableData"
           :height="isExpandForm?tableHeight:(tableHeight+80)+'px'"
           border
+          :summary-method="getSummaries"
+          show-summary
           :row-class-name="tableRowClassName"
           :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px'}"
           highlight-current-row
@@ -357,7 +359,7 @@
                     v-if="mesSetting.workOrder"
                     class="el-icon-files"
                     style="cursor: pointer;color:#42b983;margin-right: 15px"
-                    @click="pre(row,1)"
+                    @click.stop="pre(row,1)"
                   />
                 </el-tooltip>
 
@@ -765,6 +767,91 @@
           :cell-style="this.$cellStyle"
           row-key="stepcode"
         >
+          <el-table-column type="expand">
+            <template slot-scope="props">
+
+              <el-table
+                :data="props.row.children"
+                style="width: 96%;margin: auto;"
+                border
+                :row-class-name="tableRowClassName"
+              >
+                <el-table-column
+                  prop="eqp_code"
+                  label="璁惧/寰�鏉ョ紪鐮�"
+                  min-width="120"
+                />
+                <el-table-column
+                  prop="eqp_name"
+                  label="璁惧/寰�鏉ュ悕绉�"
+                  min-width="120"
+                />
+                <el-table-column
+                  prop="eqp_value"
+                  label="璁惧鑺傛媿"
+                  min-width="150"
+                >
+                  <template slot-scope="{row}">
+                    <div style="display: flex;align-items: center">
+                      <el-input
+                        v-model="row.eqp_value"
+                        placeholder="璇疯緭鍏�"
+                        oninput="value=value.replace(/[^0-9.]/g,'')"
+                        @change="val=>eqpValueChange(val,row)"
+                      />
+                      <div style="margin-left: 5px">绉�</div>
+                    </div>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="stand_value"
+                  label="鐢熶骇鑺傛媿"
+                  min-width="120"
+                >
+                  <template slot-scope="{row}">
+                    <div>{{ row.stand_value + ' ' + '绉�/娆�' }}</div>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="cavity_qty"
+                  label="鑵斿瀷鏁�"
+                  min-width="120"
+                >
+                  <template slot-scope="{row}">
+                    <el-input
+                      v-model="row.cavity_qty"
+                      placeholder="璇疯緭鍏�"
+                      oninput="value=value.replace(/[^0-9.]/g,'')"
+                      @change="val=>cavityQtyChange(val,row)"
+                    />
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="unprice"
+                  label="宸ュ簭宸ヤ环"
+                  min-width="120"
+                >
+                  <template slot-scope="{row}">
+                    <el-input v-model="row.unprice" oninput="value=value.replace(/[^0-9.]/g,'')" />
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="enable"
+                  label="鏄惁鍚敤"
+                  min-width="150"
+                >
+                  <template slot-scope="{row}">
+                    <el-switch
+                      v-model="row.enable"
+                      inactive-value="N"
+                      active-value="Y"
+                    />
+                  </template>
+                </el-table-column>
+              </el-table>
+            </template>
+          </el-table-column>
+
           <el-table-column
             type="index"
             label="搴忓彿"
@@ -791,7 +878,6 @@
                 placeholder="璇疯緭鍏ュ伐搴忓崟浠�"
                 oninput="value=value.replace(/[^0-9.]/g,'')"
                 style="width: 100%"
-                @click.stop=""
               />
             </template>
           </el-table-column>
@@ -1310,6 +1396,7 @@
     <el-dialog
       v-el-drag-dialog
       title=""
+      top="7vh"
       :visible.sync="dialogVisibleApprove"
       width="812px"
       class="dialogVisibleConfirmClass"
@@ -1319,132 +1406,265 @@
     >
       <!-- 瑕佹墦鍗扮殑鍖哄煙 -->
       <div id="printMe" style="padding: 30px">
-        <div style="font-size: 26px; text-align: center">娴佺▼鍗�</div>
+        <!--        <div v-for="(item,index) in tableDataPrint" :key="index">-->
+        <div>
+          <div style="font-size: 26px; text-align: center">娴佺▼鍗�</div>
 
-        <div style="display: flex;justify-content: space-around;margin-top: 20px; position: relative;">
-          <div style="width: 78%">
-            <el-form
-              ref="formApprove"
-              :model="formApprove"
-              label-width="80px"
-              inline
-              style="display: flex;justify-content: space-between"
+          <div style="display: flex;justify-content: space-around;margin-top: 20px; position: relative;">
+            <div style="width: 78%">
+              <el-form
+                ref="formApprove"
+                :model="formApprove"
+                label-width="80px"
+                inline
+                style="display: flex;justify-content: space-between"
+              >
+                <div class="elForm">
+                  <el-form-item label="閿�鍞崟鍙�:" class="formContent">
+                    {{ formApprove.saleOrderCode ?formApprove.saleOrderCode :'/' }}
+                  </el-form-item>
+                  <el-form-item label="宸ュ崟缂栧彿:" class="formContent">
+                    {{ formApprove.mesordercode }}
+                  </el-form-item>
+                  <el-form-item label="婧愬崟鍗曞彿:" class="formContent">
+                    {{ formApprove.m_po }}
+                  </el-form-item>
+                  <el-form-item label="浜у搧缂栫爜:" class="formContent">
+                    {{ formApprove.partcode }}
+                  </el-form-item>
+                  <el-form-item label="浜у搧鍚嶇О:" class="formContent">
+                    {{ formApprove.partname }}
+                  </el-form-item>
+                  <el-form-item label="浜у搧瑙勬牸:" class="formContent">
+                    {{ formApprove.partspec }}
+                  </el-form-item>
+                  <el-form-item label="宸ュ崟鏁伴噺:" class="formContent">
+                    {{ formApprove.plan_qty }}
+                  </el-form-item>
+                  <!--                <el-form-item label="宸ヨ壓璺嚎:" class="formContent">-->
+                  <!--                  {{ formApprove.routename }}-->
+                  <!--                </el-form-item>-->
+                  <el-form-item label="鎵撳嵃浜哄憳:" class="formContent">
+                    <!--                  {{ localStorage.getItem('username') }}-->
+                    {{ formApprove.routename }}
+                  </el-form-item>
+                  <el-form-item label="鎵撳嵃鏃堕棿:" class="formContent">
+                    {{ formApprove.lm_date }}
+                  </el-form-item>
+                </div>
+              </el-form>
+            </div>
+            <div
+              id="qrCode0"
+              style="width: 22%;height:90px;
+                        margin-top: 20px;
+                        overflow-y: scroll;display: flex;
+                        justify-content: center;
+                        position: relative;"
             >
-              <div class="elForm">
-                <el-form-item label="閿�鍞崟鍙�:" class="formContent">
-                  {{ formApprove.saleOrderCode ?formApprove.saleOrderCode :'/' }}
-                </el-form-item>
-                <el-form-item label="宸ュ崟缂栧彿:" class="formContent">
-                  {{ formApprove.mesordercode }}
-                </el-form-item>
-                <el-form-item label="婧愬崟鍗曞彿:" class="formContent">
-                  {{ formApprove.m_po }}
-                </el-form-item>
-                <el-form-item label="浜у搧缂栫爜:" class="formContent">
-                  {{ formApprove.partcode }}
-                </el-form-item>
-                <el-form-item label="浜у搧鍚嶇О:" class="formContent">
-                  {{ formApprove.partname }}
-                </el-form-item>
-                <el-form-item label="浜у搧瑙勬牸:" class="formContent">
-                  {{ formApprove.partspec }}
-                </el-form-item>
-                <el-form-item label="宸ュ崟鏁伴噺:" class="formContent">
-                  {{ formApprove.plan_qty }}
-                </el-form-item>
-                <!--                <el-form-item label="宸ヨ壓璺嚎:" class="formContent">-->
-                <!--                  {{ formApprove.routename }}-->
-                <!--                </el-form-item>-->
-                <el-form-item label="鎵撳嵃浜哄憳:" class="formContent">
-                  <!--                  {{ localStorage.getItem('username') }}-->
-                  {{ formApprove.routename }}
-                </el-form-item>
-                <el-form-item label="鎵撳嵃鏃堕棿:" class="formContent">
-                  {{ formApprove.lm_date }}
-                </el-form-item>
-              </div>
-            </el-form>
+              <div id="qrCode00" ref="qrCodeDiv00" />
+            </div>
+            <div style="background-color: #fff;width: 20px;height:120px; position: absolute;right: 0" />
+            <div
+              style="z-index: 10;background-color:transparent;width: 120px;height:120px; position: absolute;right: 21px"
+            />
           </div>
-          <div
-            id="qrCode"
-            style="width: 22%;height:90px;
-            margin-top: 20px;
-            overflow-y: scroll;display: flex;
-            justify-content: center;
-            position: relative;"
+
+          <el-table
+            id="table"
+            :data="tableDataPrint[0]"
+            border
+            class="tableDataPrint"
+            :header-cell-style="{ background: '#c0c0c0',textAlign:'center',color:'#000',borderColor:'#000'}"
+            :cell-style="{textAlign: 'center',color:'#000',borderColor:'#000'}"
+            style="width: 100%;margin-top: 20px;text-align: center;border-color: #000"
           >
-            <div id="qrCode0" ref="qrCodeDiv0" />
-          </div>
-          <div style="background-color: #fff;width: 20px;height:120px; position: absolute;right: 0" />
-          <div
-            style="z-index: 10;background-color:transparent;width: 120px;height:120px; position: absolute;right: 21px"
-          />
+            <el-table-column
+              id="column0"
+              prop="seq"
+              label="宸ュ簭鍙�"
+              width="70"
+              align="center"
+            />
+            <el-table-column
+              id="column1"
+              prop="stepqrcode"
+              label="宸ュ簭浜岀淮鐮�"
+              width="100"
+              align="center"
+            >
+              <template slot-scope="{row}">
+
+                <div :id="'qrCode'+row.seq" :ref="'qrCodeDiv'+row.seq" :key="'qrCodeDiv'+row.seq" class="tableColumn" />
+              </template>
+            </el-table-column>
+            <el-table-column
+              id="column2"
+              prop="stepname"
+              label="宸ュ簭"
+              width="120"
+              align="center"
+            />
+            <el-table-column
+              id="column3"
+              prop="plan_qty"
+              label="鍔犲伐鏁伴噺"
+              width="100"
+              align="center"
+            />
+            <el-table-column
+              id="column4"
+              prop="good_qty"
+              width="100"
+              align="center"
+              label="鍚堟牸鏁伴噺"
+            />
+            <el-table-column
+              id="column5"
+              width="100"
+              prop="ng_qty"
+              align="center"
+              label="涓嶈壇鏁伴噺"
+            />
+            <el-table-column
+              id="column6"
+              prop="desc"
+              align="center"
+              width="120"
+              label="澶囨敞"
+            />
+          </el-table>
         </div>
 
-        <!--          <div style="width:100%;height: 30px;border-bottom: 1px solid #eee;margin-bottom: 20px" />-->
-        <el-table
-          id="table"
-          :data="tableDataPrint"
-          border
-          class="tableDataPrint"
-          :header-cell-style="{ background: '#c0c0c0',textAlign:'center',color:'#000',borderColor:'#000'}"
-          :cell-style="{textAlign: 'center',color:'#000',borderColor:'#000'}"
-          style="width: 100%;margin-top: 20px;text-align: center;border-color: #000"
-        >
-          <el-table-column
-            id="column0"
-            prop="seq"
-            label="宸ュ簭鍙�"
-            width="70"
-            align="center"
-          />
-          <el-table-column
-            id="column1"
-            prop="stepqrcode"
-            label="宸ュ簭浜岀淮鐮�"
-            width="100"
-            align="center"
+        <div v-if="tableDataPrint[1]" style="margin-top: 100px;">
+          <div style="font-size: 26px; text-align: center">娴佺▼鍗�</div>
+
+          <div style="display: flex;justify-content: space-around;margin-top: 20px; position: relative;">
+            <div style="width: 78%">
+              <el-form
+                ref="formApprove"
+                :model="formApprove"
+                label-width="80px"
+                inline
+                style="display: flex;justify-content: space-between"
+              >
+                <div class="elForm">
+                  <el-form-item label="閿�鍞崟鍙�:" class="formContent">
+                    {{ formApprove.saleOrderCode ?formApprove.saleOrderCode :'/' }}
+                  </el-form-item>
+                  <el-form-item label="宸ュ崟缂栧彿:" class="formContent">
+                    {{ formApprove.mesordercode }}
+                  </el-form-item>
+                  <el-form-item label="婧愬崟鍗曞彿:" class="formContent">
+                    {{ formApprove.m_po }}
+                  </el-form-item>
+                  <el-form-item label="浜у搧缂栫爜:" class="formContent">
+                    {{ formApprove.partcode }}
+                  </el-form-item>
+                  <el-form-item label="浜у搧鍚嶇О:" class="formContent">
+                    {{ formApprove.partname }}
+                  </el-form-item>
+                  <el-form-item label="浜у搧瑙勬牸:" class="formContent">
+                    {{ formApprove.partspec }}
+                  </el-form-item>
+                  <el-form-item label="宸ュ崟鏁伴噺:" class="formContent">
+                    {{ formApprove.plan_qty }}
+                  </el-form-item>
+                  <!--                <el-form-item label="宸ヨ壓璺嚎:" class="formContent">-->
+                  <!--                  {{ formApprove.routename }}-->
+                  <!--                </el-form-item>-->
+                  <el-form-item label="鎵撳嵃浜哄憳:" class="formContent">
+                    <!--                  {{ localStorage.getItem('username') }}-->
+                    {{ formApprove.routename }}
+                  </el-form-item>
+                  <el-form-item label="鎵撳嵃鏃堕棿:" class="formContent">
+                    {{ formApprove.lm_date }}
+                  </el-form-item>
+                </div>
+              </el-form>
+            </div>
+            <div
+              id="qrCode1"
+              style="width: 22%;height:90px;
+                        margin-top: 20px;
+                        overflow-y: scroll;display: flex;
+                        justify-content: center;
+                        position: relative;"
+            >
+              <div id="qrCode01" ref="qrCodeDiv01" />
+            </div>
+            <div style="background-color: #fff;width: 20px;height:120px; position: absolute;right: 0" />
+            <div
+              style="z-index: 10;background-color:transparent;width: 120px;height:120px; position: absolute;right: 21px"
+            />
+          </div>
+
+          <el-table
+            id="table"
+            :data="tableDataPrint[1]"
+            border
+            class="tableDataPrint"
+            :header-cell-style="{ background: '#c0c0c0',textAlign:'center',color:'#000',borderColor:'#000'}"
+            :cell-style="{textAlign: 'center',color:'#000',borderColor:'#000'}"
+            style="width: 100%;margin-top: 20px;text-align: center;border-color: #000"
           >
-            <template slot-scope="{row}">
-              <div :id="'qrCode'+row.seq" :ref="'qrCodeDiv'+row.seq" class="tableColumn" />
-            </template>
-          </el-table-column>
-          <el-table-column
-            id="column2"
-            prop="stepname"
-            label="宸ュ簭"
-            width="120"
-            align="center"
-          />
-          <el-table-column
-            id="column3"
-            prop="plan_qty"
-            label="鍔犲伐鏁伴噺"
-            width="100"
-            align="center"
-          />
-          <el-table-column
-            id="column4"
-            prop="good_qty"
-            width="100"
-            align="center"
-            label="鍚堟牸鏁伴噺"
-          />
-          <el-table-column
-            id="column5"
-            width="100"
-            prop="ng_qty"
-            align="center"
-            label="涓嶈壇鏁伴噺"
-          />
-          <el-table-column
-            id="column6"
-            prop="desc"
-            align="center"
-            width="120"
-            label="澶囨敞"
-          />
-        </el-table>
+            <el-table-column
+              id="column0"
+              prop="seq"
+              label="宸ュ簭鍙�"
+              width="70"
+              align="center"
+            />
+            <el-table-column
+              id="column1"
+              prop="stepqrcode"
+              label="宸ュ簭浜岀淮鐮�"
+              width="100"
+              align="center"
+            >
+              <template slot-scope="{row}">
+
+                <div :id="'qrCode'+row.seq" :ref="'qrCodeDiv'+row.seq" :key="'qrCodeDiv'+row.seq" class="tableColumn" />
+              </template>
+            </el-table-column>
+            <el-table-column
+              id="column2"
+              prop="stepname"
+              label="宸ュ簭"
+              width="120"
+              align="center"
+            />
+            <el-table-column
+              id="column3"
+              prop="plan_qty"
+              label="鍔犲伐鏁伴噺"
+              width="100"
+              align="center"
+            />
+            <el-table-column
+              id="column4"
+              prop="good_qty"
+              width="100"
+              align="center"
+              label="鍚堟牸鏁伴噺"
+            />
+            <el-table-column
+              id="column5"
+              width="100"
+              prop="ng_qty"
+              align="center"
+              label="涓嶈壇鏁伴噺"
+            />
+            <el-table-column
+              id="column6"
+              prop="desc"
+              align="center"
+              width="120"
+              label="澶囨敞"
+            />
+          </el-table>
+        </div>
+
       </div>
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
@@ -2049,7 +2269,7 @@
     <el-dialog
       v-el-drag-dialog
       class="sop"
-      title="璁惧SOP棰勮"
+      title="SOP棰勮"
       :visible.sync="SopDialogVisible"
       width="800px"
       :close-on-click-modal="false"
@@ -2639,7 +2859,7 @@
       this.operation = operation
       this.dialogVisible = true
       this.dialogForm.data_sources = 'MES'
-
+      this.sourceType = true
       this.$nextTick(() => {
         this.setSort()
       })
@@ -2746,7 +2966,7 @@
       this.dialogForm.mesmaxqty = res.canupdate_qty
 
       if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
-        if (!this.dialogForm.routecode) {
+        if (this.dialogForm.routecode) {
           await this.getPartcodeChangeDialog()
         }
 
@@ -2761,6 +2981,7 @@
             )
           })
           this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+          this.sourceType = true
         } else {
           const data2 = {
             wkshopcode: this.dialogForm.wkshopcode,
@@ -2778,6 +2999,7 @@
               )
             })
             this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+            this.sourceType = false
           }
         }
       } else {
@@ -2792,7 +3014,9 @@
             )
           })
           this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+          this.sourceType = true
         } else {
+          this.sourceType = false
           await this.getBasicProcessData()
         }
       }
@@ -2869,7 +3093,7 @@
         res.forEach(i => {
           this.stepTableData.push(
             {
-              stepcode: i.step_code,
+              stepcode: i.code,
               // stepname: i.stepname,
               stepprice: i.unprice
             }
@@ -3060,9 +3284,12 @@
       }
       MesOrderPrintSearch(data2).then(res2 => {
         if (res2.code === '200') {
-          const res3 = res2.data.recordset
+          this.dialogVisibleApprove = true
 
-          this.tableDataPrint = res3
+          const res3 = res2.data.recordset
+          // this.tableDataPrint = res3
+          this.tableDataPrint = this.chunkArray(res3, 8)
+
           this.formApprove.mesordercode = res3[0].wo_code
           this.formApprove.m_po = res3[0].m_po || '/'
           this.formApprove.partcode = res3[0].partcode
@@ -3073,17 +3300,20 @@
           this.formApprove.lm_date = res3[0].lm_date
 
           this.$nextTick(() => {
-            res3.forEach(i => {
-              this.bindQRCode(i.seq, i.stepqrcode, 'small')
+            this.tableDataPrint.forEach((item, index) => {
+              item.forEach(i => {
+                this.bindQRCode(i.seq, i.stepqrcode, 'small')
+              })
+              this.bindQRCode(index, this.formApprove.mesordercode, 'big')
+              const div = document.getElementById('qrCode' + index)
+              div.scrollTop = div.scrollHeight // 婊氬姩鏉′綅浜庢渶搴曢儴
             })
-            this.bindQRCode('0', this.formApprove.mesordercode, 'big')
 
-            const div = document.getElementById('qrCode')
-            // 杩欎箞澶氫唬鐮佸彧闇�瑕佽繖涓�鍙ュ疄鐜版垜浠墍闇�瑕佺殑鍔熻兘锛屽畾浣峝iv婊氬姩鏉′綅缃湪搴曢儴锛宻crollHeight璁$畻鍑篸iv鐨勯珮搴︼紝鍐峴crollTop 璁剧疆婊氬姩鏉$殑楂樺害涓哄灏�
-            div.scrollTop = div.scrollHeight // 婊氬姩鏉′綅浜庢渶搴曢儴
-            // div.scrollTop = 0 // 婊氬姩鏉′綅浜庢渶椤堕儴
+          // const div = document.getElementById('qrCode')
+          // 杩欎箞澶氫唬鐮佸彧闇�瑕佽繖涓�鍙ュ疄鐜版垜浠墍闇�瑕佺殑鍔熻兘锛屽畾浣峝iv婊氬姩鏉′綅缃湪搴曢儴锛宻crollHeight璁$畻鍑篸iv鐨勯珮搴︼紝鍐峴crollTop 璁剧疆婊氬姩鏉$殑楂樺害涓哄灏�
+          // div.scrollTop = div.scrollHeight // 婊氬姩鏉′綅浜庢渶搴曢儴
+          // div.scrollTop = 0 // 婊氬姩鏉′綅浜庢渶椤堕儴
           })
-          this.dialogVisibleApprove = true
         }
       })
     },
@@ -3096,6 +3326,15 @@
     // 杩斿洖鎸夐挳
     dialogVisibleBackPreview() {
       this.dialogVisibleApprove = false
+    },
+    chunkArray(array, size) {
+      const chunked = []
+      let i = 0
+      while (i < array.length) {
+        chunked.push(array.slice(i, i + size))
+        i += size
+      }
+      return chunked
     },
     // dialogVisibleConfirmPreview(param) {
     //   this.$refs.dialogForm.validate(valid => {
@@ -3116,8 +3355,7 @@
     // 鐢熸垚浜岀淮鐮�    宸ュ崟鎶ヨ〃浜岀淮鐮�
     bindQRCode(seq, text, size) {
       if (size === 'big') {
-        console.log(text, 1)
-        new QRCode(this.$refs.qrCodeDiv0, {
+        new QRCode(this.$refs['qrCodeDiv0' + seq], {
           text: text,
           width: size === 'big' ? 90 : 60,
           height: size === 'big' ? 90 : 60,
@@ -3509,6 +3747,34 @@
     },
     stepSelectedValueChange(val) {
       // console.log(val, 123)
+    },
+    getSummaries(param) {
+      const { columns, data } = param
+      const sums = []
+      const i = 9
+      columns.forEach((column, index) => {
+        if (index === i) {
+          sums[index] = '鎬绘暟'
+          return
+        }
+        const values = data.map(item => Number(item[column.property]))
+        if (column.property === 'plan_qty') {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr)
+            if (!isNaN(value)) {
+              return prev + curr
+              // return Math.round(prev * 100) / 100 + Math.round(curr * 100) / 100
+            }
+          }, 0)
+
+          sums[index] += ''
+        }
+      })
+
+      this.$nextTick(() => {
+        this.$refs.tableDataRef.doLayout()
+      })
+      return sums
     }
   }
 }

--
Gitblit v1.9.3