diff --git a/src/views/firstOrder/components/batchSelectionDialog.vue b/src/views/firstOrder/components/batchSelectionDialog.vue index 375ca3a..50b233b 100644 --- a/src/views/firstOrder/components/batchSelectionDialog.vue +++ b/src/views/firstOrder/components/batchSelectionDialog.vue @@ -1,50 +1,39 @@ @@ -88,13 +77,13 @@ export default { type: String, default: '物料出库信息' }, - tableData: { + tableData: { type: Array, default: () => [] }, - inBatchForm:{ - type:Object, - default:()=>{} + inBatchForm: { + type: Object, + default: () => { } } }, data() { @@ -106,14 +95,14 @@ export default { methods: { // 监听嵌套表格的勾选事件 handleSelectionChange(selection, parentRow) { - console.log('666666',selection, parentRow) + console.log('666666', selection, parentRow) // 为勾选的数据补充父行关联信息 const selectionWithParent = selection.map(item => ({ ...item, parentMaterialId: parentRow.materialId, // 关联父行的物料ID parentDepartmentName: parentRow.departmentName, // 关联父行的部门信息 applicationQuantity: parentRow.applicationQuantity, - ldDemandEndId:parentRow.ldDemandEndId, + ldDemandEndId: parentRow.ldDemandEndId, // outboundQuantity:parentRow.outboundQuantity, })); @@ -123,14 +112,14 @@ export default { ); // 添加当前勾选的新数据 this.selectedRows.push(...selectionWithParent); - console.log('777777',selection, parentRow,this.selectedRows) + console.log('777777', selection, parentRow, this.selectedRows) // 实时传递给父组件(可选,也可以点击确认后传递) }, // 确认选择按钮 - 主动传递勾选数据给父组件 handleConfirmSelect() { console.log(1222) - console.log(this.selectedRows,'00000') + console.log(this.selectedRows, '00000') // this.$emit('confirm-selection', this.selectedRows); this.batchSelectionVisible = false; @@ -145,16 +134,16 @@ export default { // // 关闭弹窗的处理方法 handleCloseDetail() { // this.$emit('update:batchSelectionVisible', false); - + // this.$emit('handleCloseDetail') this.$emit('selectionChange', this.selectedRows); }, - + }, mounted() { - console.log(9999999,this.inBatchForm) + console.log(9999999, this.inBatchForm) } - + } \ No newline at end of file diff --git a/src/views/firstOrder/components/consumableDialog.vue b/src/views/firstOrder/components/consumableDialog.vue index ff38c39..5ac547a 100644 --- a/src/views/firstOrder/components/consumableDialog.vue +++ b/src/views/firstOrder/components/consumableDialog.vue @@ -45,7 +45,7 @@ export default { calcHeight: 30, tip: false, searchShow: true, - searchMenuSpan: 12, + searchMenuSpan: 18, border: true, index: true, selection: true, @@ -177,17 +177,6 @@ export default { this.consumableVisible = this.consumableVisible }, methods: { - formatTime(row, column, cellValue) { - if (!cellValue) return ''; - const date = new Date(cellValue); - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - const seconds = String(date.getSeconds()).padStart(2, '0'); - return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; - }, async handleLog(row) { this.dialogLogVisible = true; this.currentRow = row; @@ -197,7 +186,7 @@ export default { handleTabClick() { this.loadTransactionData(); }, - + async loadTransactionData() { if (!this.currentRow) return; const params = { @@ -225,26 +214,25 @@ export default { this.loading = false; } }, - + searchReset() { this.query = {}; this.onLoad(this.page); }, - searchChange(params, done) { this.query = params; this.page.currentPage = 1; this.onLoad(this.page, params); done(); }, - + //勾选选中 selectionChange(selection) { // 如果是程序自动更新选择状态,则不执行清理逻辑 if (this.isUpdatingSelection) { return; } - + console.log("勾选选中", selection); const currentPageIds = this.data.map(item => item.id); console.log(currentPageIds, "currentPageIds"); @@ -259,28 +247,27 @@ export default { this.allSelectedList.push(...selection); console.log('所有勾选数据:', this.allSelectedList); }, - + //点击确定 handleConfirm() { console.log(6); console.log(this.allSelectedList, 'chuan'); this.$emit("confirm", this.allSelectedList); }, - + selectionClear() { this.allSelectedList = []; // 清空所有选中的数据 if (this.$refs.crud) { this.$refs.crud.toggleSelection(); // 清空表格选择 } }, - + handleRowChange(row, index, data) { - // 这个方法应该只处理行变化,分页勾选保持应该在 onLoad 中处理 - // 但为了保持当前页面勾选状态,我们保留此逻辑 + this.$nextTick(() => { // 设置标志,表示正在程序化更新选择状态 this.isUpdatingSelection = true; - + const currentPageData = this.data || []; // 清除当前页面的选中状态 this.$refs.crud.toggleSelection(); @@ -295,30 +282,30 @@ export default { this.$refs.crud.toggleRowSelection(item, true); } }); - + // 延迟重置标志 setTimeout(() => { this.isUpdatingSelection = false; }, 100); }); }, - + currentChange(currentPage) { console.log(currentPage, 1); this.page.currentPage = currentPage; // 切换页面时重新加载数据,会触发 onLoad this.onLoad(this.page, this.query); }, - + sizeChange(pageSize) { this.page.pageSize = pageSize; this.onLoad(this.page, this.query); }, - + refreshChange() { this.onLoad(this.page, this.query); }, - + onLoad(page, params = {}) { this.loading = true; console.log(this.query, 2); @@ -340,21 +327,21 @@ export default { this.$message.error('加载数据失败: ' + error.message); }); }, - + // 添加一个新方法来更新当前页面的选中状态 updateCurrentPageSelection() { if (!this.$refs.crud) return; - + // 设置标志,表示正在程序化更新选择状态 this.isUpdatingSelection = true; - + const currentPageData = this.data || []; - + // 先清除所有选择 this.$refs.crud.toggleSelection(); - + currentPageData.forEach((item) => { - const isSelected = this.allSelectedList.some(selectedItem => + const isSelected = this.allSelectedList.some(selectedItem => selectedItem.id === item.id ); @@ -362,7 +349,7 @@ export default { this.$refs.crud.toggleRowSelection(item, true); } }); - + // 延迟重置标志,确保选择状态已完全更新 this.$nextTick(() => { setTimeout(() => { @@ -370,9 +357,10 @@ export default { }, 100); }); }, - + handleCancel() { - this.$emit('handleCloseDetail'); + // this.$emit('handleCloseDetail'); + this.consumableVisible } }, } diff --git a/src/views/firstOrder/components/outDialog.vue b/src/views/firstOrder/components/outDialog.vue index ee6a4fb..67fc123 100644 --- a/src/views/firstOrder/components/outDialog.vue +++ b/src/views/firstOrder/components/outDialog.vue @@ -66,7 +66,7 @@