liyg 2 سال پیش
والد
کامیت
6df87b8dab
1فایلهای تغییر یافته به همراه85 افزوده شده و 13 حذف شده
  1. 85 13
      src/views/appoint/components/saleContract/saleOrderSteel.vue

+ 85 - 13
src/views/appoint/components/saleContract/saleOrderSteel.vue

@@ -49,6 +49,20 @@
             v-if="activeName == 'first'"
           >
             <i class="upload2"></i>批量上传
+          </el-button>
+           <el-button
+            type="primary"
+            @click="batchDeleteFirst"
+            v-if="activeName == 'first'"
+          >
+            <i class="upload2"></i>批量删除
+          </el-button>
+           <el-button
+            type="primary"
+            @click="batchDeleteSecond"
+            v-if="activeName == 'second'"
+          >
+            <i class="upload2"></i>批量删除
           </el-button>
           <el-button
             type="primary"
@@ -134,7 +148,7 @@
                 <el-button
                   type="text"
                   size="small"
-                  @click="deleteclick(scope.row.saleOrderId)"
+                  @click="deleteclick(scope.row)"
                   >删除</el-button
                 >
                 <el-button
@@ -214,6 +228,7 @@
           <mergeRowTable
             v-bind.sync="option2"
             ref="table2"
+            @selection-change="selectionChange2"
             :pageSize="200"
             @func="func2"
           >
@@ -286,6 +301,7 @@ export default {
       option2: {
         // 表格请求数据的地址
         requestUrl: '',
+        selectionType: 'select',
         comparison: 'saleNumber',
         columnIndexs: [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
       },
@@ -343,6 +359,7 @@ export default {
       matSum1: null,
       matSum2: null,
       tableData: [],
+      secondList:[],
       saleDateOfReceipt: null,
       //销售订单主表数据
       saleOrderList: [
@@ -1092,7 +1109,13 @@ export default {
       console.log(selection)
       this.batchReportList = []
       this.batchReportList = selection
-      console.log(this.batchReportList)
+      console.log("firstList:",this.batchReportList)
+    },
+    selectionChange2(selection){
+      console.log(selection)
+      this.secondList = []
+      this.secondList = selection
+      console.log("secondList:",this.secondList)
     },
     refresh() {
       this.getRequestUrl()
@@ -1271,7 +1294,6 @@ export default {
     },
     //删除
     deleteclick(scope) {
-      let saleOrderId = scope
       this.$confirm('是否删除', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -1279,10 +1301,67 @@ export default {
         center: true
       })
         .then(() => {
-          this.axios
+         let rows=[];
+         rows.push(scope);
+         this.batchDelete(rows);
+        })
+        .catch(() => {
+          this.$message({
+            type: 'info',
+            message: '取消删除!'
+          })
+        })
+    },
+    batchDeleteFirst(){
+      let rows=this.batchReportList;
+      console.log("rows:",rows);
+      if(!rows || rows.length<=0){
+        this.$message.warning("请选中订单!");
+        return;
+      }
+      this.$confirm('是否删除', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+        center: true
+      })
+        .then(() => {
+         this.batchDelete(rows);
+        })
+        .catch(() => {
+          this.$message({
+            type: 'info',
+            message: '取消删除!'
+          })
+        })
+    },
+    batchDeleteSecond(){
+      let rows=this.secondList;
+      console.log("rows:",rows);
+      if(!rows || rows.length<=0){
+        this.$message.warning("请选中订单!");
+        return;
+      }
+      this.$confirm('是否删除', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+        center: true
+      })
+        .then(() => {
+         this.batchDelete(rows);
+        })
+        .catch(() => {
+          this.$message({
+            type: 'info',
+            message: '取消删除!'
+          })
+        })
+    },
+    batchDelete(rows){
+       this.axios
             .post(
-              '/api/v1/ams/deleteAmsSaleOrderBySaleOrderId?saleOrderId=' +
-                saleOrderId
+              '/api/v1/ams/deleteAmsSaleOrderBySaleOrderId',rows
             )
             .then(res => {
               if (res.data.code == '200') {
@@ -1293,13 +1372,6 @@ export default {
                 this.getRequestUrl()
               }
             })
-        })
-        .catch(() => {
-          this.$message({
-            type: 'info',
-            message: '取消删除!'
-          })
-        })
     }
   }
 }