From 6d0940ea0ac1ee4263fe10071210bba39d30d313 Mon Sep 17 00:00:00 2001 From: jishenghua <752718920@qq.com> Date: Thu, 24 Apr 2025 16:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=92=8C=E9=94=80=E5=94=AE=E5=87=BA=E5=BA=93=E5=8D=95=E6=8D=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B5=8C=E5=A5=97=E5=AD=90=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jshERP-web/src/mixins/JeecgListMixin.js | 6 +- jshERP-web/src/views/bill/PurchaseInList.vue | 2 + jshERP-web/src/views/bill/SaleOutList.vue | 2 + .../src/views/bill/mixins/BillListMixin.js | 147 +++++++++++------- 4 files changed, 95 insertions(+), 62 deletions(-) diff --git a/jshERP-web/src/mixins/JeecgListMixin.js b/jshERP-web/src/mixins/JeecgListMixin.js index ff5ed860..ae3e9ea0 100644 --- a/jshERP-web/src/mixins/JeecgListMixin.js +++ b/jshERP-web/src/mixins/JeecgListMixin.js @@ -469,13 +469,13 @@ export const JeecgListMixin = { header: { cell: (h, props, children) => { const { key, ...restProps } = props + // 父表格列宽拖拽逻辑 const col = column.find((col) => { const k = col.dataIndex || col.key return k === key }) - if (!col || !col.width) { - return h('th', { ...restProps }, [...children]) + return h('th', { ...restProps }, children) } const dragProps = { @@ -496,7 +496,7 @@ export const JeecgListMixin = { }, } const drag = h(VueDraggableResizable, { ...dragProps }) - return h('th', { ...restProps, class: 'resize-table-th' }, [...children, drag]) + return h('th', { ...restProps, class: 'resize-table-th' }, [children, drag]) }, } } diff --git a/jshERP-web/src/views/bill/PurchaseInList.vue b/jshERP-web/src/views/bill/PurchaseInList.vue index 640348fe..d4fee2c7 100644 --- a/jshERP-web/src/views/bill/PurchaseInList.vue +++ b/jshERP-web/src/views/bill/PurchaseInList.vue @@ -164,6 +164,7 @@ :scroll="scroll" :loading="loading" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + :expandedRowKeys="expandedRowKeys" @expand="onExpand" @change="handleTableChange"> @@ -201,6 +202,7 @@ :loading="record.loading" :columns="detailColumns" :dataSource="record.childrens" + :row-key="record => record.id" :pagination="false"> diff --git a/jshERP-web/src/views/bill/SaleOutList.vue b/jshERP-web/src/views/bill/SaleOutList.vue index 0bc45dc4..c1c78441 100644 --- a/jshERP-web/src/views/bill/SaleOutList.vue +++ b/jshERP-web/src/views/bill/SaleOutList.vue @@ -165,6 +165,7 @@ :scroll="scroll" :loading="loading" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + :expandedRowKeys="expandedRowKeys" @expand="onExpand" @change="handleTableChange"> @@ -202,6 +203,7 @@ :loading="record.loading" :columns="detailColumns" :dataSource="record.childrens" + :row-key="record => record.id" :pagination="false"> diff --git a/jshERP-web/src/views/bill/mixins/BillListMixin.js b/jshERP-web/src/views/bill/mixins/BillListMixin.js index b937a978..b4caff72 100644 --- a/jshERP-web/src/views/bill/mixins/BillListMixin.js +++ b/jshERP-web/src/views/bill/mixins/BillListMixin.js @@ -26,12 +26,14 @@ export const BillListMixin = { accountList: [], // 实际索引 settingDataIndex: [], + // 存储展开的行key + expandedRowKeys: [], // 实际列 columns:[], // 明细表头 detailColumns:[], // 列定义 - defColumns: [], + defDetailColumns: [], retailOutColumns: [ { title: '仓库名称', dataIndex: 'depotName'}, { title: '条码', dataIndex: 'barCode'}, @@ -420,6 +422,28 @@ export const BillListMixin = { this.isShowExcel = Vue.ls.get('isShowExcel'); }, methods: { + loadData(arg) { + // 重置展开状态 + this.expandedRowKeys = [] + if (arg === 1) { + this.ipagination.current = 1 + } + let params = this.getQueryParams() //查询条件 + this.loading = true + getAction(this.url.list, params).then((res) => { + if (res.code===200) { + this.dataSource = res.data.rows + this.ipagination.total = res.data.total + this.tableAddTotalRow(this.columns, this.dataSource) + } else if(res.code===510){ + this.$message.warning(res.data) + } else { + this.$message.warning(res.data.message) + } + this.loading = false + this.onClearSelected() + }) + }, myHandleAdd() { this.$refs.modalForm.action = "add"; if(this.btnEnableList.indexOf(2)===-1) { @@ -549,7 +573,7 @@ export const BillListMixin = { endTime: getFormatDate(), createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())] } - this.loadData(1); + this.loadData(1) }, onDateChange: function (value, dateString) { this.queryParam.beginTime=dateString[0] @@ -681,30 +705,35 @@ export const BillListMixin = { }, // 展开/折叠行 onExpand(expanded, record) { - let showType = 'basic' - if(record.subType === '采购' || record.subType === '采购退货' || record.subType === '销售' || record.subType === '销售退货') { - if (record.status === '3') { - showType = 'other' + if (expanded) { + this.expandedRowKeys = [...new Set([...this.expandedRowKeys, record.id])] + let showType = 'basic' + if(record.subType === '采购' || record.subType === '采购退货' || record.subType === '销售' || record.subType === '销售退货') { + if (record.status === '3') { + showType = 'other' + } + } else { + if (record.status === '3') { + showType = 'basic' + } else if (record.purchaseStatus === '3') { + showType = 'purchase' + } } + let isReadOnly = '1' + if(record.subType === '组装单' || record.subType === '拆卸单') { + isReadOnly = '0' + } + let params = { + headerId: record.id, + mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性 + linkType: showType, + isReadOnly: isReadOnly + } + let url = '/depotItem/getDetailList' + this.requestSubTableData(record, url, params) } else { - if (record.status === '3') { - showType = 'basic' - } else if (record.purchaseStatus === '3') { - showType = 'purchase' - } + this.expandedRowKeys = this.expandedRowKeys.filter(key => key !== record.id) } - let isReadOnly = '1' - if(record.subType === '组装单' || record.subType === '拆卸单') { - isReadOnly = '0' - } - let params = { - headerId: record.id, - mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性 - linkType: showType, - isReadOnly: isReadOnly - } - let url = '/depotItem/getDetailList' - this.requestSubTableData(record, url, params) }, requestSubTableData(record, url, params, success) { record.loading = true @@ -721,35 +750,35 @@ export const BillListMixin = { }, initSetting(record, ds) { if (this.prefixNo === 'LSCK') { - this.defColumns = this.retailOutColumns + this.defDetailColumns = this.retailOutColumns } else if (this.prefixNo === 'LSTH') { - this.defColumns = this.retailBackColumns + this.defDetailColumns = this.retailBackColumns } else if (this.prefixNo === 'QGD') { - this.defColumns = this.purchaseApplyColumns + this.defDetailColumns = this.purchaseApplyColumns } else if (this.prefixNo === 'CGDD') { - this.defColumns = this.purchaseOrderColumns + this.defDetailColumns = this.purchaseOrderColumns } else if (this.prefixNo === 'CGRK') { - this.defColumns = this.purchaseInColumns + this.defDetailColumns = this.purchaseInColumns } else if (this.prefixNo === 'CGTH') { - this.defColumns = this.purchaseBackColumns + this.defDetailColumns = this.purchaseBackColumns } else if (this.prefixNo === 'XSDD') { - this.defColumns = this.saleOrderColumns + this.defDetailColumns = this.saleOrderColumns } else if (this.prefixNo === 'XSCK') { - this.defColumns = this.saleOutColumns + this.defDetailColumns = this.saleOutColumns } else if (this.prefixNo === 'XSTH') { - this.defColumns = this.saleBackColumns + this.defDetailColumns = this.saleBackColumns } else if (this.prefixNo === 'QTRK') { - this.defColumns = this.otherInColumns + this.defDetailColumns = this.otherInColumns } else if (this.prefixNo === 'QTCK') { - this.defColumns = this.otherOutColumns + this.defDetailColumns = this.otherOutColumns } else if (this.prefixNo === 'DBCK') { - this.defColumns = this.allocationOutColumns + this.defDetailColumns = this.allocationOutColumns } else if (this.prefixNo === 'ZZD') { - this.defColumns = this.assembleColumns + this.defDetailColumns = this.assembleColumns } else if (this.prefixNo === 'CXD') { - this.defColumns = this.disassembleColumns + this.defDetailColumns = this.disassembleColumns } else if (this.prefixNo === 'PDFP') { - this.defColumns = this.stockCheckReplayColumns + this.defDetailColumns = this.stockCheckReplayColumns } //动态替换扩展字段 this.handleChangeOtherField() @@ -784,51 +813,51 @@ export const BillListMixin = { let currentCol = [] if(record.status === '3') { //部分采购|部分销售的时候显示全部列 - for(let i=0; i-1) { + if(needAddkeywords.indexOf(this.defDetailColumns[i].dataIndex)>-1) { let info = {} - info.title = this.defColumns[i].title - info.dataIndex = this.defColumns[i].dataIndex - if(this.defColumns[i].width) { - info.width = this.defColumns[i].width + info.title = this.defDetailColumns[i].title + info.dataIndex = this.defDetailColumns[i].dataIndex + if(this.defDetailColumns[i].width) { + info.width = this.defDetailColumns[i].width } currentCol.push(info) }