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
@@ -352,6 +352,8 @@ export default {
const params = {}
// 业务表信息
params.processEsInspectPlanList = this.$refs.inspectionPlanTable.dataSource
// 获取删除业务信息的ids列表
params.processAllDelIds = this.$refs.inspectionPlanTable.getDelIds()
// 收集所有表单信息
let formDataList = []
if (isValidate) {
@@ -280,24 +280,17 @@ export default {
if (!err) {
// 调整前端存储
const row = Object.assign({}, this.model, values)
if (!row.createByDictText) {
const { realname, username } = this.$store.getters.userInfo
row.createByDictText = `${realname}(${username})`
}
// 用于判断显示的按钮
if (!row.createBy) {
const { username } = this.$store.getters.userInfo
row.createBy = username
}
this.$emit('ok', row, this.index)
this.close()
// const params = Object.assign({
// projectId: this.projectId
// }, this.model, values)
// this.confirmLoading = true
// const fn = params.id ? editInspectPlanTable : addInspectPlanTable
// fn(params).then(res => {
// if (res.success) {
// this.$emit('ok', params)
// this.$message.success(res.message)
// this.close()
// } else {
// this.$message.warn(res.message)
// }
// }).finally(() => {
// this.confirmLoading = false
// })
}
})
},
@@ -18,11 +18,11 @@
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
:rowKey="(row, index) => row.id || index"
:rowKey="(_, index) => index"
:loading="loading"
:pagination="false"
:row-selection="hasTableOperator ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps } : null"
:scroll="{x: '100%'}"
:scroll="{x: '100%', y: '50vh'}"
@change="tableOnChange">
<!-- 企标号、企标名称 -->
@@ -43,14 +43,14 @@
<!-- 操作 -->
<template slot="action" slot-scope="{text, record, index}">
<!-- 编辑 and 删除:节点1 或 节点3 或 节点2且当前登录人是创建人 -->
<template v-if="isInitiateOrLiaisonCollect || (currentNode === EsInspectionPlan.fillInComments.value && $store.getters.userInfo.username === record.createBy)">
<template v-if="isInitiateOrLiaisonCollect || (currentNode === EsInspectionPlan.fillInComments.value && currentUserName === record.createBy)">
<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>
<!-- 意见 or 填写意见:节点2非自己创建的就是意见和填写意见 -->
<template v-else-if="currentNode === EsInspectionPlan.fillInComments.value">
<a v-if="isShowOpinion(record)" @click="handleShowOpinion(record, index)" >{{ $t('workCenter.esInspectionPlan.opinion') }}</a>
<a v-if="isShowOpinion(record)" @click="handleWriteOpinion(record, index)" >{{ $t('workCenter.esInspectionPlan.opinion') }}</a>
<a v-else @click="handleWriteOpinion(record, index)" >{{ $t('workCenter.esInspectionPlan.writeOpinion') }}</a>
</template>
</template>
@@ -111,6 +111,8 @@ export default {
},
model: {},
dataSource: [],
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
allColumns: [
{
title: this.$t('serialNumber'),
@@ -292,17 +294,61 @@ export default {
this.filters.taskId = this.$route.query.taskId
},
methods: {
// 父组件获取删除的ids
getDelIds () {
return Array.from(new Set(this.delIds)).filter(item => item).join(',')
},
// 批量删除
batchDel () {
if (this.selectedRowKeys.length <= 0) {
this.$message.warning(this.$t('selectARecord'))
} else {
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: () => {
// 将删除的id进行收集,提交节点的时候后端进行删除
this.selectedRowKeys.forEach(key => {
if (this.dataSource[key].id) {
this.delIds.push(this.dataSource[key].id)
}
})
this.dataSource = this.dataSource.filter((item, index) => !this.selectedRowKeys.includes(index))
this.onClearSelected()
}
})
}
},
// 删除
handleDelete (index) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
// 将删除的id进行收集,提交节点的时候后端进行删除
if (this.dataSource[index].id) {
this.delIds.push(this.dataSource[index].id)
}
this.dataSource.splice(index, 1)
}
})
},
handleAdd () {
this.$refs.modalForm.add()
this.$refs.modalForm.title = this.$t('newlyAdded')
this.$refs.modalForm.disableSubmit = false
},
// 编辑弹框
handleEdit (record, index) {
this.$refs.modalForm.edit(record, index)
this.$refs.modalForm.title = this.$t('edit')
this.$refs.modalForm.disableSubmit = false
},
// 添加回调
// 添加或编辑回调
handleAddOrEditCallback (row, index) {
console.log(row, index)
console.log('添加或编辑回调', row, index)
// index -1就是添加
if (index === -1) {
if (index === undefined || index === -1) {
this.dataSource.push(row)
} else {
this.dataSource.splice(index, 1, row)
@@ -318,7 +364,7 @@ export default {
const obj = { props: { disabled: false } }
// 第二个节点,只有自己的才能勾选删除
if (this.currentNode === EsInspectionPlan.fillInComments.value) {
obj.props.disabled = record.createBy !== this.$store.getters.userInfo.username
obj.props.disabled = record.createBy !== this.currentUserName
}
return obj
},
@@ -344,16 +390,13 @@ export default {
this.ipagination = pagination
this.getTableList()
},
// 显示意见
handleShowOpinion (record) {
this.$refs.writeOpinionModal.show(record)
},
// 填写意见
handleWriteOpinion (record, index) {
this.$refs.writeOpinionModal.show(record, index)
},
// 填写意见回调
handleWriteOpinionCallback (data, index) {
console.log(data, index)
this.dataSource.splice(index, 1, {
...this.dataSource[index],
// 填写意见的数据
@@ -16,7 +16,7 @@
:can-drag="true"
rowKey="id"
:pagination="false"
:scroll="{x: '100%'}">
:scroll="{x: '100%',y: '50vh'}">
</j-table>
</a-spin>
</j-modal>
@@ -79,7 +79,6 @@ export default {
this.orderBy = sorter.order === 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.ipagination = pagination
this.getTableList()
}
}
}
@@ -45,6 +45,7 @@
<script>
import JTable from '@comp/jero/JTable'
import moment from 'moment'
export default {
name: 'WriteOpinionModal',
components: { JTable },
@@ -115,9 +116,8 @@ export default {
methods: {
show (record, index) {
this.index = index
const list = record.processEsInspectPlanOpinionList || []
// 从数组里找到自己的数据显示,或者前端保存数据的字段
const data = list.find(item => item.createBy === this.$store.getters.userInfo.username) || record.processEsInspectPlanOpinion || {}
// 前端保存数据的字段
const data = record.processEsInspectPlanOpinion || {}
this.formData.opinion = data.opinion
this.dataSource = [record]
this.model = Object.assign({}, record)
@@ -129,24 +129,12 @@ export default {
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
const data = Object.assign({}, this.formData)
const data = Object.assign({}, this.model.processEsInspectPlanOpinion, this.formData)
if (!data.createTime) {
data.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
}
this.$emit('ok', data, this.index)
this.close()
// that.confirmLoading = true
// const formData = Object.assign({}, {
// inspectPlanId: this.model.id
// }, this.formData)
// fillInOpinionInspectPlanTable(formData).then((res) => {
// if (res.success) {
// that.$message.success(res.message)
// that.$emit('ok')
// that.close()
// } else {
// that.$message.warning(res.message)
// }
// }).finally(() => {
// that.confirmLoading = false
// })
} else {
return false
}