fix 79617

This commit is contained in:
赵霄
2024-01-03 16:29:04 +08:00
parent bcfab27f9e
commit 43dac1e49f
@@ -9,11 +9,12 @@
</div>
<j-table v-bind="$attrs"
:scroll="{x: '100%'}"
:pagination="false"
:rowKey="(record,index)=>{return index}"
:pagination="ipagination"
rowKey="tableRowKey"
:columns="columns"
:dataSource="realDataSource"
:row-selection="needRowSelection ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange } : null">
:row-selection="needRowSelection ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange } : null"
@change="handleTableChange">
<template v-slot:file="{text, record, index}">
<!--会后资料如果数据从流程来就是查看如果是新增的就正常显示上传-->
@@ -100,13 +101,28 @@ export default {
],
selectedRowKeys: [],
realDataSource: [],
uploadTable: {}
uploadTable: {},
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 5,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
}
}
},
watch: {
dataSource: {
handler (val) {
this.realDataSource = JSON.parse(JSON.stringify(val))
this.realDataSource = JSON.parse(JSON.stringify(val)).map((item, index) => {
item.tableRowKey = index
return item
})
},
immediate: true,
deep: true
@@ -128,7 +144,8 @@ export default {
content: this.$t('areYouSure'),
onOk: () => {
const data = JSON.parse(JSON.stringify(this.realDataSource))
this.selectedRowKeys.forEach(index => {
this.selectedRowKeys.forEach(tableRowKey => {
const index = data.findIndex(tt => tt && tt.tableRowKey === tableRowKey)
data[index] = null
})
this.selectedRowKeys = []
@@ -141,6 +158,7 @@ export default {
this.selectedRowKeys = selectedRowKeys
},
formModalOk (lineData) {
lineData.tableRowKey = this.realDataSource.length
this.realDataSource.push(lineData)
this.$emit('ok', this.realDataSource)
},
@@ -164,6 +182,9 @@ export default {
},
handleView (record) {
this.$refs.formModal.view(record)
},
handleTableChange (pagination) {
this.ipagination = pagination
}
}
}