update 稽查计划&稽查流程 调整前端存储
This commit is contained in:
+56
-13
@@ -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],
|
||||
// 填写意见的数据
|
||||
|
||||
Reference in New Issue
Block a user