|
@@ -118,21 +118,34 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
<el-card class="operate-container" shadow="never">
|
|
|
- <i class="el-icon-tickets"></i>
|
|
|
- <span>数据列表</span>
|
|
|
+ <div style="display: flex; align-items: center;"><div>
|
|
|
+ <i class="el-icon-tickets"></i>
|
|
|
+ <span>数据列表</span>
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ style="margin-left: 15px;"
|
|
|
+ type="primary"
|
|
|
+ @click="handleBatchOperate()"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ 批量发货
|
|
|
+ </el-button></div>
|
|
|
</el-card>
|
|
|
<div class="table-container">
|
|
|
+ <!-- @selection-change="handleSelectionChange" -->
|
|
|
<el-table
|
|
|
ref="orderTable"
|
|
|
:data="list"
|
|
|
style="width: 100%"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
+ @select="onTableSelect"
|
|
|
+ @select-all="onTableSelectALL"
|
|
|
v-loading="listLoading"
|
|
|
border
|
|
|
>
|
|
|
<el-table-column
|
|
|
type="selection"
|
|
|
- width="60"
|
|
|
+ width="55"
|
|
|
+ :selectable="checkSelectable"
|
|
|
align="center"
|
|
|
></el-table-column>
|
|
|
<el-table-column label="编号" width="80" align="center">
|
|
@@ -331,7 +344,7 @@ export default {
|
|
|
listLoading: true,
|
|
|
list: null,
|
|
|
total: null,
|
|
|
- operateType: null,
|
|
|
+ operateType: 1, // 默认批量发货
|
|
|
multipleSelection: [],
|
|
|
closeOrder: {
|
|
|
dialogVisible: false,
|
|
@@ -467,6 +480,9 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ checkSelectable(row) {
|
|
|
+ return row.status === 1 ? true : false;
|
|
|
+ },
|
|
|
handleResetSearch() {
|
|
|
this.listQuery = Object.assign({}, defaultListQuery);
|
|
|
},
|
|
@@ -474,8 +490,69 @@ export default {
|
|
|
this.listQuery.pageNum = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
- handleSelectionChange(val) {
|
|
|
- this.multipleSelection = val;
|
|
|
+ // handleSelectionChange(val) {
|
|
|
+ // console.log(val, 'val')
|
|
|
+ // this.multipleSelection = val;
|
|
|
+ // },
|
|
|
+ onTableSelectALL(val) {
|
|
|
+ const list = this.list || []
|
|
|
+
|
|
|
+ if(val.length > 0) {
|
|
|
+ const sIds = this.multipleSelection.map((item) => {
|
|
|
+ return item.id
|
|
|
+ })
|
|
|
+ val.forEach((item) => {
|
|
|
+ if(sIds.indexOf(item.id) == -1) {
|
|
|
+ this.multipleSelection.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const ids = list.map((item) => {
|
|
|
+ return item.id
|
|
|
+ })
|
|
|
+
|
|
|
+ const sIds = this.multipleSelection.map((item) => {
|
|
|
+ return item.id
|
|
|
+ })
|
|
|
+
|
|
|
+ const removeIds = []
|
|
|
+ ids.forEach((item) => {
|
|
|
+ if(sIds.indexOf(item) !== -1) {
|
|
|
+ removeIds.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(ids, sIds, 'sids', removeIds)
|
|
|
+ const temp = []
|
|
|
+ this.multipleSelection.forEach((item) => {
|
|
|
+ if(removeIds.indexOf(item.id) === -1) {
|
|
|
+ temp.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.multipleSelection = temp
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onTableSelect(rows, row) {
|
|
|
+ let idList = this.multipleSelection.map((group) => {
|
|
|
+ return group.id;
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ let inIdList = rows.map((group) => {
|
|
|
+ return group.id;
|
|
|
+ });
|
|
|
+ const isAdd = inIdList.indexOf(row.id) === -1 ? false : true
|
|
|
+
|
|
|
+ if(isAdd) {
|
|
|
+ if(idList.indexOf(row.id) === -1) {
|
|
|
+ this.multipleSelection.push(row)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(idList.indexOf(row.id) !== -1) {
|
|
|
+ this.multipleSelection.splice(idList.indexOf(row.id), 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
handleViewOrder(index, row) {
|
|
|
this.$router.push({ path: "/oms/orderDetail", query: { id: row.id } });
|
|
@@ -553,6 +630,7 @@ export default {
|
|
|
list.push(this.covertOrder(this.multipleSelection[i]));
|
|
|
}
|
|
|
}
|
|
|
+ //
|
|
|
if (list.length === 0) {
|
|
|
this.$message({
|
|
|
message: "选中订单中没有可以发货的订单",
|
|
@@ -640,9 +718,29 @@ export default {
|
|
|
endTime: endTime,
|
|
|
...res
|
|
|
}).then((response) => {
|
|
|
- this.listLoading = false;
|
|
|
+ // this.listLoading = false;
|
|
|
this.list = response.data.list;
|
|
|
this.total = response.data.total;
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.multipleSelection) {
|
|
|
+ let idList = this.multipleSelection.map((item, index) => {
|
|
|
+ return item.id;
|
|
|
+ });
|
|
|
+ this.list.forEach((item, index) => {
|
|
|
+ if (idList.indexOf(item.id) != -1) {
|
|
|
+ // 判断当前选中的是否为已发货数据
|
|
|
+ if(item.status === 1) {
|
|
|
+ this.$refs.orderTable.toggleRowSelection(item, true);
|
|
|
+ } else {
|
|
|
+ const mId = this.multipleSelection.findIndex((c) => c.id === item.id)
|
|
|
+ this.multipleSelection.splice(mId, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.listLoading = false;
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
deleteOrder(ids) {
|
|
@@ -681,6 +779,7 @@ export default {
|
|
|
address: address,
|
|
|
deliveryCompany: null,
|
|
|
deliverySn: null,
|
|
|
+ isError: false
|
|
|
};
|
|
|
return listItem;
|
|
|
},
|