This commit is contained in:
zhouz
2024-05-17 17:02:49 +08:00
23 changed files with 179 additions and 132 deletions

View File

@@ -155,6 +155,8 @@ export default {
previousSelection: [],
// 存储搜索后的选中状态
currentSelection: [],
// 上面表格选中的
upSelection: [],
// 取消选中
cancelSelection: [],
multipleSelection: [],
@@ -200,7 +202,9 @@ export default {
methods: {
handleSearch() {
debugger
this.multipleSelection = this.multipleSelection.filter(i => { return this.$refs.dis_table.selection.includes(i) })
this.multipleSelection = this.multipleSelection.filter(i => {
return this.$refs.dis_table.selection.includes(i)
})
this.currentSelection = [...this.$refs.dis_table.selection]
},
handleSelectionChange(selection) {
@@ -256,17 +260,16 @@ export default {
this.clearSearch1()
},
table2RowStyle({ row }) {
// if(this.cancelSelection.includes(row))
// {
// return {background: 'white'}; // 修改颜色
// }
if (this.currentSelection.includes(row)) {
return { background: 'orange' } // 修改颜色
if (row.box_group !== '0') {
return { background: 'orange' } // 修改颜色
}
}
if (this.multipleSelection.includes(row)) {
return { background: 'orange' } // 修改颜色
if (row.box_group !== '0') {
return { background: 'orange' } // 修改颜色
}
}
return {}
},
getMultipleSelection(multipleSelection) {
return multipleSelection.reduce((acc, item) => {
@@ -295,10 +298,11 @@ export default {
},
// 表格1的行点击事件
handleRowClick(scope) {
debugger
const table2 = this.$refs.dis_table
const table2Data = Array.from(this.openParam)
const groupValue = scope.box_group === 0 ? scope.container_name : scope.box_group
const selectedRows = table2Data.filter(row => row.box_group === groupValue && row.box_group !== null && row.box_group !== 0)
const groupValue = scope.box_group === '0' ? scope.container_name : scope.box_group
const selectedRows = table2Data.filter(row => (row.container_name == groupValue) || (row.box_group === groupValue && row.box_group !== null && row.box_group !== '0'))
table2.clearSelection()
selectedRows.forEach(row => table2.toggleRowSelection(row))
},
@@ -325,20 +329,18 @@ export default {
tableRowClassName({ row, rowIndex }) {
row.index = rowIndex
},
tableChanged(row) {
async tableChanged(row) {
debugger
this.form.tableMater = this.currentSelection
this.form.checked = row.material_code
debugger
this.form.sale_order_name = this.sale_order_name
crudPackagerelation.updateEntityList(this.form).then(res => {
crudSubpackagerelation.queryContainerization({ 'sale_order_name': this.sale_order_name }).then(res => {
this.openParam = res.content
this.$emit('childEvent')
this.clearSelection()
})
this.form.tableMater = []
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
await crudPackagerelation.updateEntityList(this.form)
const res = crudSubpackagerelation.queryContainerization({ 'sale_order_name': this.sale_order_name })
this.openParam = res.content
this.clearSelection()
this.form.tableMater = []
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.$emit('childEvent')
},
divStruct() {
if (this.currentSelection.length > 0 && this.$refs.dis_table.selection.length > 0) {

View File

@@ -85,7 +85,6 @@
size="mini"
@select="handleSelectionChange"
@selection-change="crud.selectionChangeHandler"
@row-dblclick="handleRowDblClick"
>
<el-table-column type="selection" />
<el-table-column
@@ -125,7 +124,13 @@
<!--分页组件-->
<pagination />
</div>
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :sale_order_name="this.sale_order_name" @childEvent="handleChildEvent" @AddChanged="querytable" />
<DivDialog
:dialog-show.sync="divShow"
:open-param="openParam"
:sale_order_name="this.sale_order_name"
@childEvent="handleChildEvent"
@AddChanged="querytable"
/>
</div>
</template>
@@ -218,20 +223,12 @@ export default {
this.query.status = tab.name === 'first' ? '99' : '0'
this.crud.toQuery()
},
// 表格双击事件
handleRowDblClick(row, column, event) {
// 双击事件的处理逻辑
this.divOpen(row)
},
// 双击
divOpen(row) {
async divOpen() {
debugger
this.sale_order_name = row.sale_order_name
crudSubpackagerelation.queryContainerization({ 'sale_order_name': row.sale_order_name }).then(res => {
debugger
this.openParam = res.content
this.divShow = true
})
this.sale_order_name = this.currentRow.sale_order_name
const res = await crudSubpackagerelation.queryContainerization({ 'sale_order_name': this.currentRow.sale_order_name })
this.openParam = res.content
// this.divShow = true
},
divOpen1() {
debugger
@@ -298,9 +295,11 @@ export default {
.custom-tabs {
margin-bottom: 0px; /* 调整垂直间距,根据需要调整数值 */
}
.custom-table {
margin-top: 0px; /* 调整垂直间距,根据需要调整数值 */
}
.tableAuto.el-table .cell {
white-space: nowrap;
}