From d20654ba067e5c0621d4d7d95915cbe47a10fe87 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 08 八月 2024 17:23:48 +0800
Subject: [PATCH] 1.正清和  增加页面缓存处理

---
 src/views/produceManager/produceOrder.vue |  193 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 154 insertions(+), 39 deletions(-)

diff --git a/src/views/produceManager/produceOrder.vue b/src/views/produceManager/produceOrder.vue
index e81b81f..c4c1b5e 100644
--- a/src/views/produceManager/produceOrder.vue
+++ b/src/views/produceManager/produceOrder.vue
@@ -9,12 +9,28 @@
           @click="syncERP"
         >鍚屾ERP
         </el-button>
-        <el-button
-          v-waves
-          icon="el-icon-switch-button"
-          @click="orderClose"
-        >鍏抽棴璁㈠崟
-        </el-button>
+        <div style="display: flex">
+          <el-button
+            v-waves
+            type="primary"
+            icon="el-icon-bottom"
+            @click="batchHandle"
+          >鎵归噺涓嬭揪
+          </el-button>
+          <!--                  <el-button-->
+          <!--                    v-waves-->
+          <!--                    icon="el-icon-switch-button"-->
+          <!--                    @click="orderClose"-->
+          <!--                  >鍏抽棴璁㈠崟-->
+          <!--                  </el-button>-->
+          <!--                  <el-button-->
+          <!--                    v-waves-->
+          <!--                    icon="el-icon-delete"-->
+          <!--                    @click="orderDel"-->
+          <!--                  >鍒犻櫎璁㈠崟-->
+          <!--                  </el-button>-->
+        </div>
+
       </div>
 
       <div class="bodyTopFormGroup">
@@ -156,25 +172,27 @@
           :header-cell-style="this.$headerCellStyle"
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
-          @row-click="rowClick"
+          @selection-change="handleSelectionChange"
         >
-          <!--          <el-table-column-->
-          <!--            type="selection"-->
-          <!--            width="50"-->
-          <!--          />-->
+          <!--          @row-click="rowClick"-->
           <el-table-column
+            type="selection"
             width="50"
-            fixed
-          >
-            <template slot-scope="{row}">
-              <el-radio
-                v-model="radioSelectedId"
-                :label="row.id"
-                style="color: transparent;padding-left: 10px;"
-              />
-              <!--              @change.native="getCurrentRow(row.id)"-->
-            </template>
-          </el-table-column>
+            :selectable="selected"
+          />
+          <!--          <el-table-column-->
+          <!--            width="50"-->
+          <!--            fixed-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <el-radio-->
+          <!--                v-model="radioSelectedId"-->
+          <!--                :label="row.id"-->
+          <!--                style="color: transparent;padding-left: 10px;"-->
+          <!--              />-->
+          <!--              &lt;!&ndash;              @change.native="getCurrentRow(row.id)"&ndash;&gt;-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
           <el-table-column
             prop="RowNum"
             width="50"
@@ -329,17 +347,35 @@
           <el-table-column
             label="鎿嶄綔"
             fixed="right"
-            width="80"
+            width="120"
           >
             <template slot-scope="{row}">
               <div class="operationClass">
-                <el-tooltip class="item" effect="dark" content="涓嬭揪" placement="top">
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="璁㈠崟涓嬭揪" placement="top">
                   <!--                <el-button v-waves type="text" @click="edit('edit',row)">涓嬭揪</el-button>-->
                   <i
                     class="el-icon-bottom"
                     :style="{color:$store.state.settings.theme}"
                     style="cursor: pointer;margin-left: 5px"
                     @click="edit('edit',row)"
+                  />
+                </el-tooltip>
+
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="璁㈠崟鍏抽棴" placement="top">
+                  <i
+                    class="el-icon-switch-button"
+                    :style="{color:$store.state.settings.theme}"
+                    style="cursor: pointer;margin-left: 15px"
+                    @click="orderClose(row.id)"
+                  />
+                </el-tooltip>
+
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="璁㈠崟鍒犻櫎" placement="top">
+                  <i
+                    class="el-icon-delete"
+                    :style="{color:$store.state.settings.theme}"
+                    style="cursor: pointer;margin-left: 15px"
+                    @click="orderDel(row.id)"
                   />
                 </el-tooltip>
               </div>
@@ -463,7 +499,13 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { ClosedErpOrder, ErpOrderSearch, MarkSaveErpOrder } from '@/api/produceManager'
+import {
+  ClosedErpOrder,
+  DeleteErpOrder,
+  ErpOrderSearch,
+  MarkBatchSaveErpOrder,
+  MarkSaveErpOrder
+} from '@/api/produceManager'
 import { handleDatetime } from '@/utils/global'
 import { SeaveSearchErpOrder } from '@/api/ErpSyncMes'
 import elDragDialog from '@/directive/el-drag-dialog'
@@ -471,7 +513,7 @@
 
 const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
-  name: 'SCDD',
+  name: 'ProduceOrder',
   components: {
     Pagination
   },
@@ -567,7 +609,8 @@
         disabledDate(time) {
           return time.getTime() < Date.now() - 8.64e7
         }
-      }
+      },
+      multipleSelection: []
 
       // expireTimeOption: {
       //   disabledDate(time) {
@@ -659,6 +702,8 @@
         //     this.$message.error('鍚屾澶辫触锛�')
         //   }, 10000)
         // }
+      }).catch(e => {
+        loading.close()
       })
     },
     // 鏌ヨ
@@ -680,19 +725,42 @@
       this.getErpOrderSearch()
     },
     // 鍗曢�夋閫変腑鑾峰彇褰撳墠琛屼俊鎭�
-    getCurrentRow(id) {
-      this.radioSelectedId = id
-    },
-    rowClick(row) {
-      this.radioSelectedId = row.id
+    // getCurrentRow(id) {
+    //   this.radioSelectedId = id
+    // },
+    // rowClick(row) {
+    //   this.radioSelectedId = row.id
+    // },
+
+    // 璁㈠崟鍒犻櫎
+    orderDel(id) {
+      this.tableData.forEach(item => {
+        if (item.id === id) {
+          if (item.status === 'CLOSED') {
+            return this.$message.info('姝よ鍗曞凡鍏抽棴锛屾棤娉曞垹闄わ紒')
+          } else {
+            this.$confirm('鏄惁纭鍏抽棴璁㈠崟?', '鎻愮ず', {
+              confirmButtonText: '纭畾',
+              cancelButtonText: '鍙栨秷',
+              type: 'warning'
+            }).then(() => {
+              DeleteErpOrder({ erpordercode: item.wo, erporderid: id }).then(res => {
+                if (res.code === '200') {
+                  this.$message.success('璁㈠崟鍒犻櫎鎴愬姛!')
+                  this.getErpOrderSearch()
+                }
+              })
+            }).catch(() => {
+              this.$message.info('宸插彇娑堝垹闄わ紒')
+            })
+          }
+        }
+      })
     },
     // 璁㈠崟鍏抽棴
-    async orderClose() {
-      if (this.radioSelectedId.length < 1) {
-        return this.$message.info('璇峰厛閫夋嫨璁㈠崟锛�')
-      }
+    async orderClose(id) {
       this.tableData.forEach(item => {
-        if (item.id === this.radioSelectedId) {
+        if (item.id === id) {
           if (item.status !== 'NEW') {
             return this.$message.info('姝よ鍗曢潪鏂拌鍗曪紝鏃犳硶鍏抽棴锛�')
           } else {
@@ -701,7 +769,7 @@
               cancelButtonText: '鍙栨秷',
               type: 'warning'
             }).then(() => {
-              ClosedErpOrder({ erpordercode: item.wo, erporderid: this.radioSelectedId }).then(res => {
+              ClosedErpOrder({ erpordercode: item.wo, erporderid: id }).then(res => {
                 if (res.code === '200') {
                   this.$message.success('璁㈠崟鍏抽棴鎴愬姛!')
                   this.getErpOrderSearch()
@@ -721,7 +789,7 @@
     },
     // 淇敼鎸夐挳
     edit(operation, row) {
-      if (parseFloat(row.qty) === parseFloat(row.relse_qty)) {
+      if (parseFloat(row.qty) === parseFloat(row.relse_qty) || row.status === 'CLOSED') {
         return this.$message.info('姝ゅ伐鍗曞凡鍏ㄩ儴涓嬭揪锛�')
       }
 
@@ -826,6 +894,53 @@
         }
       })
     },
+    handleSelectionChange(val) {
+      this.multipleSelection = val
+    },
+    batchHandle() {
+      this.$confirm('鏄惁鎵归噺涓嬭揪?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        if (this.multipleSelection.length === 0) {
+          return this.$message.info('璇峰厛閫夋嫨璁㈠崟锛�')
+        }
+        // console.log(JSON.parse(JSON.stringify(this.multipleSelection)))
+        const data = []
+        this.multipleSelection.forEach(i => {
+          data.push({
+            'erporderid': i.id,
+            'erpordercode': i.wo,
+            'partcode': i.partcode,
+            'wkshopcode': i.wkshp_code,
+            'warehousecode': i.stck_code,
+            'erpqty': i.qty,
+            'markqty': i.qty,
+            'ordernum': 1,
+            'relse_qty': i.qty,
+            'saleordercode': i.saleOrderCode,
+            // 'saleOrderDeliveryDate': i.saleOrderDeliveryDate
+            'saleOrderDeliveryDate': handleDatetime(new Date()) + ' 00:00:00'
+          })
+        })
+        // console.log(data)
+        MarkBatchSaveErpOrder(data).then(res => {
+          if (res.code === '200') {
+            this.multipleSelection = []
+            this.$message.success('鎵归噺涓嬭揪鎴愬姛锛�')
+            this.getErpOrderSearch()
+          } else {
+            this.$message.error('鎵归噺涓嬭揪澶辫触锛�')
+          }
+        })
+      }).catch(() => {
+        this.$message.info('宸插彇娑堜笅杈撅紒')
+      })
+    },
+    selected(row, index) {
+      return row.status === 'NEW'
+    },
     // 鑾峰彇椤甸潰楂樺害
     getHeight() {
       this.$nextTick(() => {

--
Gitblit v1.9.3