From c14090cb2ec502aca8b6c3c8355654625473d289 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 31 八月 2023 17:05:54 +0800
Subject: [PATCH] 1.ERP订单  新增删除功能

---
 src/views/produceManager/produceOrder.vue |   56 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/src/views/produceManager/produceOrder.vue b/src/views/produceManager/produceOrder.vue
index e81b81f..dea6122 100644
--- a/src/views/produceManager/produceOrder.vue
+++ b/src/views/produceManager/produceOrder.vue
@@ -9,12 +9,21 @@
           @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
+            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">
@@ -463,7 +472,7 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { ClosedErpOrder, ErpOrderSearch, MarkSaveErpOrder } from '@/api/produceManager'
+import { ClosedErpOrder, DeleteErpOrder, ErpOrderSearch, MarkSaveErpOrder } from '@/api/produceManager'
 import { handleDatetime } from '@/utils/global'
 import { SeaveSearchErpOrder } from '@/api/ErpSyncMes'
 import elDragDialog from '@/directive/el-drag-dialog'
@@ -659,6 +668,8 @@
         //     this.$message.error('鍚屾澶辫触锛�')
         //   }, 10000)
         // }
+      }).catch(e => {
+        loading.close()
       })
     },
     // 鏌ヨ
@@ -685,6 +696,35 @@
     },
     rowClick(row) {
       this.radioSelectedId = row.id
+    },
+
+    // 璁㈠崟鍒犻櫎
+    orderDel() {
+      if (this.radioSelectedId.length < 1) {
+        return this.$message.info('璇峰厛閫夋嫨璁㈠崟锛�')
+      }
+      this.tableData.forEach(item => {
+        if (item.id === this.radioSelectedId) {
+          if (item.status === 'CLOSED') {
+            return this.$message.info('姝よ鍗曞凡鍏抽棴锛屾棤娉曞垹闄わ紒')
+          } else {
+            this.$confirm('鏄惁纭鍏抽棴璁㈠崟?', '鎻愮ず', {
+              confirmButtonText: '纭畾',
+              cancelButtonText: '鍙栨秷',
+              type: 'warning'
+            }).then(() => {
+              DeleteErpOrder({ erpordercode: item.wo, erporderid: this.radioSelectedId }).then(res => {
+                if (res.code === '200') {
+                  this.$message.success('璁㈠崟鍒犻櫎鎴愬姛!')
+                  this.getErpOrderSearch()
+                }
+              })
+            }).catch(() => {
+              this.$message.info('宸插彇娑堝垹闄わ紒')
+            })
+          }
+        }
+      })
     },
     // 璁㈠崟鍏抽棴
     async orderClose() {
@@ -721,7 +761,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('姝ゅ伐鍗曞凡鍏ㄩ儴涓嬭揪锛�')
       }
 

--
Gitblit v1.9.3