Browse Source

托书增加按钮

jbb 2 years ago
parent
commit
12ab39290f
1 changed files with 42 additions and 6 deletions
  1. 42 6
      src/views/book/book-list.vue

+ 42 - 6
src/views/book/book-list.vue

@@ -76,6 +76,8 @@
     <a-card :bordered="false" style="marginTop:10px;">
       <div class="table-operator">
         <a-button type="primary" @click="addBookDrawer" icon="plus">新增</a-button>
+        <!-- <a-button type="primary" @click="batchSubmit()"  icon="plus">批量提交</a-button>
+        <a-button type="primary" @click="batchCanaleSubmit()" icon="plus">批量取消提交</a-button> -->
       </div>
 
       <!-- 子表 -->
@@ -86,6 +88,7 @@
         :loading="loading"
         :scroll="{ y: 500 }"
         :pagination="pagination"
+        :row-key="record => record.id"
         :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
         @change="handleTableChange"
       >
@@ -134,8 +137,8 @@
     </a-card>
 
     <!-- 抽屉 -->
-    <addBook-drawer ref="addBookDrawer" :father="aa" @ok="modalFormOk" @back="getBookList"></addBook-drawer>
-    <detailsBook-drawer ref="detailsBookDrawer" :father="bb" @ok="modalFormOk"></detailsBook-drawer>
+    <addBook-drawer ref="addBookDrawer"  @ok="modalFormOk" @back="getBookList"></addBook-drawer>
+    <detailsBook-drawer ref="detailsBookDrawer"  @ok="modalFormOk"></detailsBook-drawer>
     <!-- <editBook-drawer ref="editBookDrawer" :father="cc" @ok="modalFormOk"></editBook-drawer> -->
   </div>
 </template>
@@ -253,6 +256,7 @@ export default {
       ],
       bookListData: [],
       id: '',
+      selectedRowKeys:[],//选中行id
       loading: false, // 表格加载
       pagination:{},
       // 查询条件
@@ -317,7 +321,7 @@ export default {
       this.$nextTick(() => {
         submitPackingList({ id: record.id, type: '1' }).then(res => {
           if (res.success) {
-           record.theDocumentsState = '1'
+          //  record.theDocumentsState = '1'
            this.getBookList()
            this.$message.success('提交成功')
           }else {
@@ -326,6 +330,22 @@ export default {
         })
       })
     },
+    // //批量提交
+    // batchSubmit(){
+    //   this.$nextTick(() => {
+    //     submitPackingList({ id: this.selectedRowKeys, type: '1' }).then(res => {
+    //       if (res.success) {
+    //       //  record.theDocumentsState = '1'
+    //        this.getBookList()
+    //        this.$message.success('提交成功')
+    //        this.selectedRowKeys = []
+    //       }else {
+    //          this.$message.error(res.message);
+    //       }
+    //     })
+    //   })
+
+    // },
     //取消提交
     canaleSubmit(record) {
       this.$nextTick(() => {
@@ -340,6 +360,20 @@ export default {
         })
       })
     },
+    batchCanaleSubmit(){
+      this.$nextTick(() => {
+        submitPackingList({ id: this.selectedRowKeys, type: '2' }).then(res => {
+          if (res.success) {
+           this.$message.success('取消提交成功')
+          //  record.theDocumentsState = '0'
+           this.getBookList()
+           this.selectedRowKeys = []
+          }else {
+             this.$message.error(res.message);
+          }
+        })
+      })
+    },
     // 操作 详情
     details(record) {
       this.$refs.detailsBookDrawer.visible = true
@@ -402,9 +436,11 @@ export default {
       this.queryParam.pageNo = pagination.current
       this.getBookList()
     },
-    aa() {},
-    bb() {},
-    cc() {}
+    // 选中行
+    onSelectChange(keys) {
+      this.selectedRowKeys = keys
+    }
+    
   },
   computed: {},
   mounted() {}