From e637c7f1cb8b2ba27f896d92d476ebe7e84084b6 Mon Sep 17 00:00:00 2001
From: taozi <1362265981@qq.com>
Date: Tue, 6 Jan 2026 11:01:43 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E7=BA=A7=E5=BA=93=E5=87=BA=E5=BA=93?=
=?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/batchSelectionDialog.vue | 6 +-
.../components/consumableDialog.vue | 106 ++++++++--
src/views/firstOrder/components/outDialog.vue | 196 +++++++++---------
src/views/materials/expend.vue | 30 ++-
src/views/secondOrder/inbound.vue | 7 +
src/views/secondOrder/list.vue | 24 +--
6 files changed, 237 insertions(+), 132 deletions(-)
diff --git a/src/views/firstOrder/components/batchSelectionDialog.vue b/src/views/firstOrder/components/batchSelectionDialog.vue
index f0eb431..d1a9b74 100644
--- a/src/views/firstOrder/components/batchSelectionDialog.vue
+++ b/src/views/firstOrder/components/batchSelectionDialog.vue
@@ -43,7 +43,7 @@
-
+
确认选择
@@ -107,7 +107,7 @@ export default {
// 监听嵌套表格的勾选事件
handleSelectionChange(selection, parentRow) {
console.log('666666',selection, parentRow)
- // 为勾选的数据补充父行关联信息(可选,根据业务需要)
+ // 为勾选的数据补充父行关联信息
const selectionWithParent = selection.map(item => ({
...item,
parentMaterialId: parentRow.materialId, // 关联父行的物料ID
@@ -148,9 +148,7 @@ export default {
// this.$emit('handleCloseDetail')
this.$emit('selectionChange', this.selectedRows);
-
},
-
},
mounted() {
diff --git a/src/views/firstOrder/components/consumableDialog.vue b/src/views/firstOrder/components/consumableDialog.vue
index d66afe6..2071594 100644
--- a/src/views/firstOrder/components/consumableDialog.vue
+++ b/src/views/firstOrder/components/consumableDialog.vue
@@ -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()
@@ -273,7 +351,7 @@ export default {
page.currentPage,
page.pageSize,
Object.assign(params, this.query)
-
+
).then((res) => {
this.data = res.data.result.list
this.loading = false;
@@ -283,8 +361,6 @@ export default {
},
},
}
-
-