Prechádzať zdrojové kódy

预托书批量提交批量取消提交

jbb 2 rokov pred
rodič
commit
f02eb12406

+ 59 - 23
src/views/advance-packingList/adPaList-clothes.vue

@@ -93,6 +93,7 @@
           <a-button type="primary" icon="import">导入</a-button>
         </a-upload>
         <a-button type="primary" @click="batchSubmit" icon="plus">批量提交</a-button>
+        <a-button type="primary" @click="batchCanelSubmit" icon="plus">批量取消提交</a-button>
         <a-button type="primary" @click="batchPush" icon="plus">批量推送</a-button>
       </div>
 
@@ -139,11 +140,11 @@
                 <a @click="edit(record)">编辑</a>
               </a-menu-item>
 
-              <a-menu-item>
+              <!-- <a-menu-item>
                 <a-popconfirm title="确定提交吗?" ok-text="是" cancel-text="否" @confirm="submit(record)">
                   <a href="javascript:void(0);" style="color:green;">提交</a>
                 </a-popconfirm>
-              </a-menu-item>
+              </a-menu-item> -->
 
               <a-menu-item>
                 <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record)">
@@ -178,11 +179,11 @@
                 <a @click="details(record)">详情</a>
               </a-menu-item>
 
-              <a-menu-item>
+              <!-- <a-menu-item>
                 <a-popconfirm title="确定取消提交吗?" ok-text="是" cancel-text="否" @confirm="cancelSubmit(record)">
                   <a href="javascript:void(0);" style="color:red;">取消提交</a>
                 </a-popconfirm>
-              </a-menu-item>
+              </a-menu-item> -->
 
               <a-menu-item>
                 <a-popconfirm title="确定推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
@@ -229,7 +230,7 @@ import moment from 'moment'
 import addAdpackingDrawer from '@views/advance-packingList/addAdpackingDrawer.vue'
 import detailsAdpackingDrawer from '@views/advance-packingList/detailsAdpackingDrawer.vue'
 
-import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push} from '@api/document/advance-packingList.js'
+import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push,batchCanelSubmit} from '@api/document/advance-packingList.js'
 
 export default {
   productName: 'AdPaListClothes', // 预装箱单-成衣
@@ -645,20 +646,25 @@ export default {
         })
       })
     },
-    // 取消提交
-    cancelSubmit(record){
-      var that = this;
-      this.$nextTick(() => {
-        cancelSubmit({ id: record.id }).then(res => {
-          if (res.success) {
-            record.status=0;
-            that.$message.success('取消提交成功');
-          }else{
-            that.$message.error(res.message);
-          }
-        })
-      })
-    },
+    // // 取消提交
+    // cancelSubmit(record){
+    //   var that = this;
+    //   this.$nextTick(() => {
+    //     if(record.isReference == 2){
+    //       that.$message.error('不可取消提交!');
+    //     }else {
+    //       cancelSubmit({ id: record.id }).then(res => {
+    //       if (res.success) {
+    //         record.status=0;
+    //         that.$message.success('取消提交成功');
+    //       }else{
+    //         that.$message.error(res.message);
+    //       }
+    //      })
+    //     }
+        
+    //   })
+    // },
 
     //批量提交
     batchSubmit(){
@@ -674,18 +680,48 @@ export default {
           var ids = this.selectedRowKeys.toString()
           batchSubmit({ id: ids }).then(res => {
             if (res.success) {
-              this.selectedRows.map(item=>{
-               item.status = 1
-              })
+              this.getadPaListClothes()
               this.$message.success('批量提交成功');
+              this.selectedRowKeys = []
             }else {
              this.$message.error(res.message);
             }
           })
-          this.selectedRowKeys = []
         })
        },
+   //批量取消提交
+   batchCanelSubmit(){
+     this.$nextTick(() => {
+          var record = 0
+          var ids = this.selectedRowKeys.toString()
+          this.selectedRows.map(item =>{
+           if(item.status == 0) {
+             this.$message.error('勾选数据中含有未提交数据,请重新选择!');
+             record = 1
+             return
+           }
+          })
+          if(record == 0){
+            batchCanelSubmit({ ids:ids }).then(res => {
+            if (res.success) {
+              this.getadPaListClothes()
+              this.selectedRowKeys = []
+              this.$message.success('批量提交成功');
+            }else {
+              for(var i=0;i<this.selectedRows.length;i++){
+                if(this.selectedRows[i].id == res.result){
+                   this.$message.error(res.message+'(勾选第'+(i+1) +'行数据)');
+                   return
+                }
+              }
+            }
+          })
+          }
+          
 
+        })
+
+   },
     //批量推送
     batchPush(){
       this.$nextTick(() => {