update 稽查计划&稽查流程 调整前端存储

This commit is contained in:
danshihao
2024-01-04 17:29:16 +08:00
parent 384c0d4a72
commit 9f27d3fff0
16 changed files with 354 additions and 266 deletions
@@ -23,10 +23,10 @@
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:rowKey="(_, index) => index"
:row-selection="null"
:pagination="ipagination"
:scroll="{x: '100%'}"
:scroll="{x: '100%',y: '50vh'}"
@change="tableOnChange">
<!-- 附件 -->
@@ -39,7 +39,7 @@
<template slot="action" slot-scope="{text, record, index}">
<a @click="handleEdit(record, index)" >{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id)" >{{ $t('delete') }}</a>
<a @click="handleDelete(index)" >{{ $t('delete') }}</a>
</template>
</j-table>
@@ -137,22 +137,24 @@ export default {
delete: '/laws.enterprise/EnterpriseStandardInspectReport/delete'
},
dataSource: [],
index: -1,
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
columns: columns.slice(0, this.disabled ? 6 : 7)
}
},
methods: {
show (record) {
this.filters = {
processEsInspectId: record.id
}
this.loadData()
show (record, index) {
const data = record.enterpriseStandardInspectReportList || []
this.dataSource = JSON.parse(JSON.stringify(data))
this.model = Object.assign({}, record)
this.index = index
this.visible = true
},
// 确定
handleOk () {
// console.log(this.selectedRowKeys)
this.$emit('ok')
this.$emit('delIds', this.delIds)
this.$emit('ok', this.dataSource, this.index)
this.close()
},
// 关闭
@@ -160,6 +162,8 @@ export default {
this.close()
},
close () {
this.delIds = []
this.index = -1
this.$emit('close')
this.visible = false
},
@@ -174,11 +178,38 @@ export default {
this.$refs.modalForm.title = this.$t('newlyAdded')
this.$refs.modalForm.disableSubmit = false
},
handleEdit (record) {
this.$refs.modalForm.edit(this.model, record)
handleEdit (record, index) {
this.$refs.modalForm.edit(this.model, record, index)
this.$refs.modalForm.title = this.$t('edit')
this.$refs.modalForm.disableSubmit = false
},
// 删除
handleDelete (index) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
if (this.dataSource[index].id) {
this.delIds.push(this.dataSource[index].id)
}
this.dataSource.splice(index, 1)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (this.ipagination.current > 1 && ((this.ipagination.current - 1) * this.ipagination.pageSize) + 1 === this.ipagination.total) {
this.ipagination.current -= 1
}
}
})
},
// 表单回调
modalFormOk (row, index) {
console.log(row, index)
// 根据下标判断是添加还是编辑
if (index === undefined || index === -1) {
this.dataSource.push(row)
} else {
this.dataSource.splice(index, 1, row)
}
},
// 附件列的查看点击
fileLook (record) {
this.$refs.uploadFile.open(record.attachment)