|
|
|
|
@ -50,7 +50,7 @@ export default { |
|
|
|
|
selection: true, |
|
|
|
|
viewBtn: true, |
|
|
|
|
dialogClickModal: false, |
|
|
|
|
menu: true, |
|
|
|
|
menu: false, |
|
|
|
|
printBtn: false, |
|
|
|
|
refreshBtn: false, |
|
|
|
|
gridBtn: false, |
|
|
|
|
@ -61,6 +61,7 @@ export default { |
|
|
|
|
menuAlign: "left", |
|
|
|
|
searchMenuPosition: "right", |
|
|
|
|
menuWidth: 80, |
|
|
|
|
selectable: (row, index) => row.num !== 0, |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "存货编号", |
|
|
|
|
@ -84,7 +85,7 @@ export default { |
|
|
|
|
{ |
|
|
|
|
label: "类别", |
|
|
|
|
prop: "type", |
|
|
|
|
search: true, |
|
|
|
|
search: false, |
|
|
|
|
type: "select", |
|
|
|
|
headerAlign: "center", |
|
|
|
|
align: "center", |
|
|
|
|
@ -112,6 +113,9 @@ export default { |
|
|
|
|
prop: "num", |
|
|
|
|
headerAlign: "center", |
|
|
|
|
align: "center", |
|
|
|
|
// selectDisabled: (row) => { |
|
|
|
|
// return row.num === 0 || row.num === null || row.num === undefined; |
|
|
|
|
// }, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "单价", |
|
|
|
|
@ -119,12 +123,12 @@ export default { |
|
|
|
|
headerAlign: "center", |
|
|
|
|
align: "center", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "金额", |
|
|
|
|
prop: "amount", |
|
|
|
|
headerAlign: "center", |
|
|
|
|
align: "center", |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// label: "金额", |
|
|
|
|
// prop: "amount", |
|
|
|
|
// headerAlign: "center", |
|
|
|
|
// align: "center", |
|
|
|
|
// }, |
|
|
|
|
{ |
|
|
|
|
label: "描述", |
|
|
|
|
prop: "remark", |
|
|
|
|
@ -250,11 +254,85 @@ export default { |
|
|
|
|
this.$refs.crud.toggleSelection(); |
|
|
|
|
}, |
|
|
|
|
handleRowChange(row, index, data) { |
|
|
|
|
console.log('Selected data:', data); |
|
|
|
|
console.log('select row', row) |
|
|
|
|
// 切换页面要判断当前页面数据是否在已勾选的数据中,如果在则勾选,否则不勾选 |
|
|
|
|
|
|
|
|
|
// 切换页面保持勾选状态(仅保留有效行) |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
const currentPageData = this.data |
|
|
|
|
console.log(this.data,0) |
|
|
|
|
this.$refs.crud.toggleAllSelection(false); |
|
|
|
|
currentPageData.forEach((item) => { |
|
|
|
|
// 仅勾选数量非0的行 |
|
|
|
|
const isSelected = this.allSelectedList.some(selectedItem => |
|
|
|
|
selectedItem.id === item.id && !(item.num === 0 || item.num === null || item.num === undefined || item.num === '') |
|
|
|
|
); |
|
|
|
|
if (isSelected) { |
|
|
|
|
this.$refs.crud.toggleRowSelection(item, true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// handleRowChange(row, index, data) { |
|
|
|
|
// // 切换页面要判断当前页面数据是否在已勾选的数据中,如果在则勾选,否则不勾选 |
|
|
|
|
// this.$nextTick(() => { |
|
|
|
|
// // 获取当前页面的所有数据 |
|
|
|
|
// const currentPageData = this.data || []; |
|
|
|
|
// // 清除当前页面的选中状态 |
|
|
|
|
// this.$refs.crud.toggleAllSelection(false); |
|
|
|
|
|
|
|
|
|
// // 遍历当前页面的数据,检查是否在 allSelectedList 中 |
|
|
|
|
// currentPageData.forEach((item, index) => { |
|
|
|
|
// const isSelected = this.allSelectedList.some(selectedItem => |
|
|
|
|
// selectedItem.id === item.id |
|
|
|
|
// ); |
|
|
|
|
// // 如果该项已经被选中,则勾选它 |
|
|
|
|
// if (isSelected) { |
|
|
|
|
// this.$refs.crud.toggleRowSelection(item, true); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// }); |
|
|
|
|
// }, |
|
|
|
|
// currentChange(currentPage) { |
|
|
|
|
// console.log(currentPage, 1); |
|
|
|
|
// this.page.currentPage = currentPage; |
|
|
|
|
// // 切换页面时重新加载数据,会触发 onLoad,从而调用 handleRowChange |
|
|
|
|
// this.onLoad(this.page, this.query); |
|
|
|
|
// }, |
|
|
|
|
// onLoad(page, params = {}) { |
|
|
|
|
// this.loading = true; |
|
|
|
|
// console.log(this.query, 2); |
|
|
|
|
// getList( |
|
|
|
|
// page.currentPage, |
|
|
|
|
// page.pageSize, |
|
|
|
|
// Object.assign(params, this.query) |
|
|
|
|
|
|
|
|
|
// ).then((res) => { |
|
|
|
|
// this.data = res.data.result.list; |
|
|
|
|
// this.loading = false; |
|
|
|
|
// this.page.total = res.data.result.total; |
|
|
|
|
|
|
|
|
|
// // 数据加载完成后,更新当前页面的勾选状态 |
|
|
|
|
// this.$nextTick(() => { |
|
|
|
|
// this.updateCurrentPageSelection(); |
|
|
|
|
// }); |
|
|
|
|
// }); |
|
|
|
|
// this.loading = false; |
|
|
|
|
// }, |
|
|
|
|
// // 添加一个新方法来更新当前页面的选中状态 |
|
|
|
|
// updateCurrentPageSelection() { |
|
|
|
|
// if (!this.$refs.crud) return; |
|
|
|
|
|
|
|
|
|
// const currentPageData = this.data || []; |
|
|
|
|
|
|
|
|
|
// currentPageData.forEach((item) => { |
|
|
|
|
// const isSelected = this.allSelectedList.some(selectedItem => |
|
|
|
|
// selectedItem.id === item.id |
|
|
|
|
// ); |
|
|
|
|
|
|
|
|
|
// if (isSelected) { |
|
|
|
|
// this.$refs.crud.toggleRowSelection(item, true); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
|
currentChange(currentPage) { |
|
|
|
|
console.log(currentPage, 1) |
|
|
|
|
this.handleRowChange() |
|
|
|
|
@ -283,8 +361,6 @@ export default { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
::v-deep.el-dialog__footer { |
|
|
|
|
|