diff --git a/src/views/firstOrder/components/consumableDialog.vue b/src/views/firstOrder/components/consumableDialog.vue
index d354c13..e435564 100644
--- a/src/views/firstOrder/components/consumableDialog.vue
+++ b/src/views/firstOrder/components/consumableDialog.vue
@@ -1,6 +1,6 @@
+ :append-to-body="true" width="70%" @close="handleCancel" fullscreen>
@@ -693,9 +693,12 @@ export default {
//关闭新增弹窗
handleCloseDetail() {
this.outDialogVisible = false;
- this.consumableVisible = false;
+
this.$emit("handleCloseDetail");
},
+ closeDialog() {
+ this.consumableVisible = false;
+ },
// 获取批量需求单列表
async getQuarterList() {
try {
@@ -834,8 +837,8 @@ export default {
getDepartmentName(departmentId) {
const department = this.list.find(
(item) => item.departmentId === departmentId
- );
- return department ? department.department : "";
+ )
+ return department ? department.department : ""
},
//获取单条选择的物资名称列表
async getMaterialList() {
diff --git a/src/views/secondOrder/components/categoryDialog.vue b/src/views/secondOrder/components/categoryDialog.vue
index 7857dae..b58a2b6 100644
--- a/src/views/secondOrder/components/categoryDialog.vue
+++ b/src/views/secondOrder/components/categoryDialog.vue
@@ -11,7 +11,7 @@
@refresh-change="refreshChange" @on-load="onLoad" @row-change="handleRowChange">
@@ -31,7 +31,7 @@ export default {
default: ''
},
departmentId: {
- type: [String, Number],
+ type: String,
default: ''
},
selectionData: {
@@ -174,25 +174,23 @@ export default {
// 更新当前页面的勾选状态
updateCurrentPageSelection() {
if (!this.$refs.crud || !this.data) return;
-
this.isUpdatingSelection = true;
-
- const currentPageData = this.data || [];
-
+ const currentPageData = this.data
// 先清除所有选择
this.$refs.crud.toggleSelection();
-
+
// 检查当前页面的数据中有哪些在 allSelectedList 中
currentPageData.forEach((item) => {
- const isSelected = this.allSelectedList.some(selectedItem =>
+ const isSelected = this.allSelectedList.some(selectedItem =>
selectedItem.id === item.id
);
if (isSelected) {
this.$refs.crud.toggleRowSelection(item, true);
}
+
});
-
+
// 延迟 确保选择状态已完全更新
this.$nextTick(() => {
setTimeout(() => {
@@ -201,40 +199,19 @@ export default {
});
},
- //勾选选中
+
selectionChange(selection) {
- if (this.isUpdatingSelection) {
- return;
- }
-
- console.log('当前选择:', selection)
- console.log('当前页面数据:', this.data)
- console.log('当前全部勾选:', this.allSelectedList)
-
- // 获取当前页面的数据ID
- const currentPageIds = this.data.map(item => item.id);
-
- const otherPageSelected = this.allSelectedList.filter(item =>
- !currentPageIds.includes(item.id)
- );
-
- const currentSelected = selection.map(item => ({
+ console.log(selection,'selection-------')
+ console.log(this.selectionData, '---selectionData')
+ const currentPageIds = this.selectionData.map(item => item.id)
+ let arr = selection.filter(item => !currentPageIds.includes(item.id)) //未选择的数据
+ const selectionWithTwoInventoryId = arr.map(item => ({
...item,
twoInventoryId: item.id
- }));
-
- // 组合所有勾选数据
- const combinedSelection = [
- ...otherPageSelected, // 其他页面的数据
- ...currentSelected // 当前页面新勾选的数据
- ];
-
- // 去重并更新 allSelectedList
- this.allSelectedList = this.uniqueById(combinedSelection)
-
- console.log('更新后的allSelectedList:', this.allSelectedList)
+ }))
+ this.allSelectedList.push(...selectionWithTwoInventoryId);
+ this.allSelectedList = this.uniqueById(this.allSelectedList);
},
-
//去重
uniqueById(arr) {
const uniqueObj = {};
@@ -245,24 +222,24 @@ export default {
});
return Object.values(uniqueObj);
},
-
+
//点击确定
handleConfirm() {
const uniqueList = this.uniqueById(this.allSelectedList)
this.$emit("confirm", uniqueList)
},
-
+
handleCloseDetail() {
this.$emit('handleCloseDetail')
},
-
+
selectionClear() {
this.allSelectedList = []
if (this.$refs.crud) {
this.$refs.crud.toggleSelection()
}
},
-
+
currentChange(currentPage) {
this.page.currentPage = currentPage;
this.onLoad(this.page, this.query)
@@ -272,16 +249,16 @@ export default {
this.page.pageSize = pageSize;
this.onLoad(this.page, this.query)
},
-
+
refreshChange() {
this.onLoad(this.page, this.query)
},
-
+
handleTabClick() {
this.page.currentPage = 1
this.onLoad(this.page)
},
-
+
onLoad(page, params = {}) {
this.loading = true
const requestParams = Object.assign({}, params, this.query, {
@@ -294,7 +271,7 @@ export default {
apiPromise.then((res) => {
this.data = res.data.result.list
this.page.total = res.data.result.total
-
+
// 数据加载完成后,更新当前页面的勾选状态
this.$nextTick(() => {
this.updateCurrentPageSelection()
@@ -305,7 +282,7 @@ export default {
this.loading = false;
})
},
-
+
handleCancel() {
this.categoryVisible = false
}
diff --git a/src/views/secondOrder/components/outDialog.vue b/src/views/secondOrder/components/outDialog.vue
index bdd1459..fa1c0b3 100644
--- a/src/views/secondOrder/components/outDialog.vue
+++ b/src/views/secondOrder/components/outDialog.vue
@@ -137,7 +137,7 @@
+ @confirm="confirm" @handleCloseDetail="closeDialog">