给采购入库和销售出库单据优化嵌套子表格的功能
This commit is contained in:
@@ -469,13 +469,13 @@ export const JeecgListMixin = {
|
|||||||
header: {
|
header: {
|
||||||
cell: (h, props, children) => {
|
cell: (h, props, children) => {
|
||||||
const { key, ...restProps } = props
|
const { key, ...restProps } = props
|
||||||
|
// 父表格列宽拖拽逻辑
|
||||||
const col = column.find((col) => {
|
const col = column.find((col) => {
|
||||||
const k = col.dataIndex || col.key
|
const k = col.dataIndex || col.key
|
||||||
return k === key
|
return k === key
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!col || !col.width) {
|
if (!col || !col.width) {
|
||||||
return h('th', { ...restProps }, [...children])
|
return h('th', { ...restProps }, children)
|
||||||
}
|
}
|
||||||
|
|
||||||
const dragProps = {
|
const dragProps = {
|
||||||
@@ -496,7 +496,7 @@ export const JeecgListMixin = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
const drag = h(VueDraggableResizable, { ...dragProps })
|
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])
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,6 +164,7 @@
|
|||||||
:scroll="scroll"
|
:scroll="scroll"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||||
|
:expandedRowKeys="expandedRowKeys"
|
||||||
@expand="onExpand"
|
@expand="onExpand"
|
||||||
@change="handleTableChange">
|
@change="handleTableChange">
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
@@ -201,6 +202,7 @@
|
|||||||
:loading="record.loading"
|
:loading="record.loading"
|
||||||
:columns="detailColumns"
|
:columns="detailColumns"
|
||||||
:dataSource="record.childrens"
|
:dataSource="record.childrens"
|
||||||
|
:row-key="record => record.id"
|
||||||
:pagination="false">
|
:pagination="false">
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-table>
|
</a-table>
|
||||||
|
|||||||
@@ -165,6 +165,7 @@
|
|||||||
:scroll="scroll"
|
:scroll="scroll"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||||
|
:expandedRowKeys="expandedRowKeys"
|
||||||
@expand="onExpand"
|
@expand="onExpand"
|
||||||
@change="handleTableChange">
|
@change="handleTableChange">
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
@@ -202,6 +203,7 @@
|
|||||||
:loading="record.loading"
|
:loading="record.loading"
|
||||||
:columns="detailColumns"
|
:columns="detailColumns"
|
||||||
:dataSource="record.childrens"
|
:dataSource="record.childrens"
|
||||||
|
:row-key="record => record.id"
|
||||||
:pagination="false">
|
:pagination="false">
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-table>
|
</a-table>
|
||||||
|
|||||||
@@ -26,12 +26,14 @@ export const BillListMixin = {
|
|||||||
accountList: [],
|
accountList: [],
|
||||||
// 实际索引
|
// 实际索引
|
||||||
settingDataIndex: [],
|
settingDataIndex: [],
|
||||||
|
// 存储展开的行key
|
||||||
|
expandedRowKeys: [],
|
||||||
// 实际列
|
// 实际列
|
||||||
columns:[],
|
columns:[],
|
||||||
// 明细表头
|
// 明细表头
|
||||||
detailColumns:[],
|
detailColumns:[],
|
||||||
// 列定义
|
// 列定义
|
||||||
defColumns: [],
|
defDetailColumns: [],
|
||||||
retailOutColumns: [
|
retailOutColumns: [
|
||||||
{ title: '仓库名称', dataIndex: 'depotName'},
|
{ title: '仓库名称', dataIndex: 'depotName'},
|
||||||
{ title: '条码', dataIndex: 'barCode'},
|
{ title: '条码', dataIndex: 'barCode'},
|
||||||
@@ -420,6 +422,28 @@ export const BillListMixin = {
|
|||||||
this.isShowExcel = Vue.ls.get('isShowExcel');
|
this.isShowExcel = Vue.ls.get('isShowExcel');
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
myHandleAdd() {
|
||||||
this.$refs.modalForm.action = "add";
|
this.$refs.modalForm.action = "add";
|
||||||
if(this.btnEnableList.indexOf(2)===-1) {
|
if(this.btnEnableList.indexOf(2)===-1) {
|
||||||
@@ -549,7 +573,7 @@ export const BillListMixin = {
|
|||||||
endTime: getFormatDate(),
|
endTime: getFormatDate(),
|
||||||
createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())]
|
createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())]
|
||||||
}
|
}
|
||||||
this.loadData(1);
|
this.loadData(1)
|
||||||
},
|
},
|
||||||
onDateChange: function (value, dateString) {
|
onDateChange: function (value, dateString) {
|
||||||
this.queryParam.beginTime=dateString[0]
|
this.queryParam.beginTime=dateString[0]
|
||||||
@@ -681,6 +705,8 @@ export const BillListMixin = {
|
|||||||
},
|
},
|
||||||
// 展开/折叠行
|
// 展开/折叠行
|
||||||
onExpand(expanded, record) {
|
onExpand(expanded, record) {
|
||||||
|
if (expanded) {
|
||||||
|
this.expandedRowKeys = [...new Set([...this.expandedRowKeys, record.id])]
|
||||||
let showType = 'basic'
|
let showType = 'basic'
|
||||||
if(record.subType === '采购' || record.subType === '采购退货' || record.subType === '销售' || record.subType === '销售退货') {
|
if(record.subType === '采购' || record.subType === '采购退货' || record.subType === '销售' || record.subType === '销售退货') {
|
||||||
if (record.status === '3') {
|
if (record.status === '3') {
|
||||||
@@ -705,6 +731,9 @@ export const BillListMixin = {
|
|||||||
}
|
}
|
||||||
let url = '/depotItem/getDetailList'
|
let url = '/depotItem/getDetailList'
|
||||||
this.requestSubTableData(record, url, params)
|
this.requestSubTableData(record, url, params)
|
||||||
|
} else {
|
||||||
|
this.expandedRowKeys = this.expandedRowKeys.filter(key => key !== record.id)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
requestSubTableData(record, url, params, success) {
|
requestSubTableData(record, url, params, success) {
|
||||||
record.loading = true
|
record.loading = true
|
||||||
@@ -721,35 +750,35 @@ export const BillListMixin = {
|
|||||||
},
|
},
|
||||||
initSetting(record, ds) {
|
initSetting(record, ds) {
|
||||||
if (this.prefixNo === 'LSCK') {
|
if (this.prefixNo === 'LSCK') {
|
||||||
this.defColumns = this.retailOutColumns
|
this.defDetailColumns = this.retailOutColumns
|
||||||
} else if (this.prefixNo === 'LSTH') {
|
} else if (this.prefixNo === 'LSTH') {
|
||||||
this.defColumns = this.retailBackColumns
|
this.defDetailColumns = this.retailBackColumns
|
||||||
} else if (this.prefixNo === 'QGD') {
|
} else if (this.prefixNo === 'QGD') {
|
||||||
this.defColumns = this.purchaseApplyColumns
|
this.defDetailColumns = this.purchaseApplyColumns
|
||||||
} else if (this.prefixNo === 'CGDD') {
|
} else if (this.prefixNo === 'CGDD') {
|
||||||
this.defColumns = this.purchaseOrderColumns
|
this.defDetailColumns = this.purchaseOrderColumns
|
||||||
} else if (this.prefixNo === 'CGRK') {
|
} else if (this.prefixNo === 'CGRK') {
|
||||||
this.defColumns = this.purchaseInColumns
|
this.defDetailColumns = this.purchaseInColumns
|
||||||
} else if (this.prefixNo === 'CGTH') {
|
} else if (this.prefixNo === 'CGTH') {
|
||||||
this.defColumns = this.purchaseBackColumns
|
this.defDetailColumns = this.purchaseBackColumns
|
||||||
} else if (this.prefixNo === 'XSDD') {
|
} else if (this.prefixNo === 'XSDD') {
|
||||||
this.defColumns = this.saleOrderColumns
|
this.defDetailColumns = this.saleOrderColumns
|
||||||
} else if (this.prefixNo === 'XSCK') {
|
} else if (this.prefixNo === 'XSCK') {
|
||||||
this.defColumns = this.saleOutColumns
|
this.defDetailColumns = this.saleOutColumns
|
||||||
} else if (this.prefixNo === 'XSTH') {
|
} else if (this.prefixNo === 'XSTH') {
|
||||||
this.defColumns = this.saleBackColumns
|
this.defDetailColumns = this.saleBackColumns
|
||||||
} else if (this.prefixNo === 'QTRK') {
|
} else if (this.prefixNo === 'QTRK') {
|
||||||
this.defColumns = this.otherInColumns
|
this.defDetailColumns = this.otherInColumns
|
||||||
} else if (this.prefixNo === 'QTCK') {
|
} else if (this.prefixNo === 'QTCK') {
|
||||||
this.defColumns = this.otherOutColumns
|
this.defDetailColumns = this.otherOutColumns
|
||||||
} else if (this.prefixNo === 'DBCK') {
|
} else if (this.prefixNo === 'DBCK') {
|
||||||
this.defColumns = this.allocationOutColumns
|
this.defDetailColumns = this.allocationOutColumns
|
||||||
} else if (this.prefixNo === 'ZZD') {
|
} else if (this.prefixNo === 'ZZD') {
|
||||||
this.defColumns = this.assembleColumns
|
this.defDetailColumns = this.assembleColumns
|
||||||
} else if (this.prefixNo === 'CXD') {
|
} else if (this.prefixNo === 'CXD') {
|
||||||
this.defColumns = this.disassembleColumns
|
this.defDetailColumns = this.disassembleColumns
|
||||||
} else if (this.prefixNo === 'PDFP') {
|
} else if (this.prefixNo === 'PDFP') {
|
||||||
this.defColumns = this.stockCheckReplayColumns
|
this.defDetailColumns = this.stockCheckReplayColumns
|
||||||
}
|
}
|
||||||
//动态替换扩展字段
|
//动态替换扩展字段
|
||||||
this.handleChangeOtherField()
|
this.handleChangeOtherField()
|
||||||
@@ -784,51 +813,51 @@ export const BillListMixin = {
|
|||||||
let currentCol = []
|
let currentCol = []
|
||||||
if(record.status === '3') {
|
if(record.status === '3') {
|
||||||
//部分采购|部分销售的时候显示全部列
|
//部分采购|部分销售的时候显示全部列
|
||||||
for(let i=0; i<this.defColumns.length; i++){
|
for(let i=0; i<this.defDetailColumns.length; i++){
|
||||||
currentCol.push(this.defColumns[i])
|
currentCol.push(this.defDetailColumns[i])
|
||||||
}
|
}
|
||||||
this.detailColumns = currentCol
|
this.detailColumns = currentCol
|
||||||
} else if(record.purchaseStatus === '3') {
|
} else if(record.purchaseStatus === '3') {
|
||||||
//将已出库的标题转为已采购,针对销售订单转采购订单的场景
|
//将已出库的标题转为已采购,针对销售订单转采购订单的场景
|
||||||
for(let i=0; i<this.defColumns.length; i++){
|
for(let i=0; i<this.defDetailColumns.length; i++){
|
||||||
let info = {}
|
let info = {}
|
||||||
info.title = this.defColumns[i].title
|
info.title = this.defDetailColumns[i].title
|
||||||
info.dataIndex = this.defColumns[i].dataIndex
|
info.dataIndex = this.defDetailColumns[i].dataIndex
|
||||||
if(this.defColumns[i].width) {
|
if(this.defDetailColumns[i].width) {
|
||||||
info.width = this.defColumns[i].width
|
info.width = this.defDetailColumns[i].width
|
||||||
}
|
}
|
||||||
if(this.defColumns[i].dataIndex === 'finishNumber') {
|
if(this.defDetailColumns[i].dataIndex === 'finishNumber') {
|
||||||
info.title = '已采购'
|
info.title = '已采购'
|
||||||
}
|
}
|
||||||
if(this.defColumns[i].dataIndex === 'barCode') {
|
if(this.defDetailColumns[i].dataIndex === 'barCode') {
|
||||||
info.scopedSlots = { customRender: 'customBarCode' }
|
info.scopedSlots = { customRender: 'customBarCode' }
|
||||||
}
|
}
|
||||||
currentCol.push(info)
|
currentCol.push(info)
|
||||||
}
|
}
|
||||||
this.detailColumns = currentCol
|
this.detailColumns = currentCol
|
||||||
} else {
|
} else {
|
||||||
for(let i=0; i<this.defColumns.length; i++){
|
for(let i=0; i<this.defDetailColumns.length; i++){
|
||||||
//移除列
|
//移除列
|
||||||
let needRemoveKeywords = ['finishNumber','snList','batchNumber','expirationDate','sku','weight','position','brand','mfrs']
|
let needRemoveKeywords = ['finishNumber','snList','batchNumber','expirationDate','sku','weight','position','brand','mfrs']
|
||||||
if(needRemoveKeywords.indexOf(this.defColumns[i].dataIndex)===-1) {
|
if(needRemoveKeywords.indexOf(this.defDetailColumns[i].dataIndex)===-1) {
|
||||||
let info = {}
|
let info = {}
|
||||||
info.title = this.defColumns[i].title
|
info.title = this.defDetailColumns[i].title
|
||||||
info.dataIndex = this.defColumns[i].dataIndex
|
info.dataIndex = this.defDetailColumns[i].dataIndex
|
||||||
if(this.defColumns[i].width) {
|
if(this.defDetailColumns[i].width) {
|
||||||
info.width = this.defColumns[i].width
|
info.width = this.defDetailColumns[i].width
|
||||||
}
|
}
|
||||||
if(this.defColumns[i].dataIndex === 'barCode') {
|
if(this.defDetailColumns[i].dataIndex === 'barCode') {
|
||||||
info.scopedSlots = { customRender: 'customBarCode' }
|
info.scopedSlots = { customRender: 'customBarCode' }
|
||||||
}
|
}
|
||||||
currentCol.push(info)
|
currentCol.push(info)
|
||||||
}
|
}
|
||||||
//添加有数据的列
|
//添加有数据的列
|
||||||
if(needAddkeywords.indexOf(this.defColumns[i].dataIndex)>-1) {
|
if(needAddkeywords.indexOf(this.defDetailColumns[i].dataIndex)>-1) {
|
||||||
let info = {}
|
let info = {}
|
||||||
info.title = this.defColumns[i].title
|
info.title = this.defDetailColumns[i].title
|
||||||
info.dataIndex = this.defColumns[i].dataIndex
|
info.dataIndex = this.defDetailColumns[i].dataIndex
|
||||||
if(this.defColumns[i].width) {
|
if(this.defDetailColumns[i].width) {
|
||||||
info.width = this.defColumns[i].width
|
info.width = this.defDetailColumns[i].width
|
||||||
}
|
}
|
||||||
currentCol.push(info)
|
currentCol.push(info)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user