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
+1
View File
@@ -175,6 +175,7 @@ module.exports = {
pleaseEnterAPositiveInteger: '请输入正整数', pleaseEnterAPositiveInteger: '请输入正整数',
pleaseSelectStandard: '请选择标准', pleaseSelectStandard: '请选择标准',
successfullyDelete: '删除成功', successfullyDelete: '删除成功',
cannotAddAgain: '不能重复添加',
// 树右键 // 树右键
treeRight: { treeRight: {
addFolder: 'Create New Folder', addFolder: 'Create New Folder',
+1
View File
@@ -183,6 +183,7 @@ module.exports = {
implementationNeedGreaterThan: '实施日期需要至少比发布日期大15天', implementationNeedGreaterThan: '实施日期需要至少比发布日期大15天',
pleaseSelectStandard: '请选择标准', pleaseSelectStandard: '请选择标准',
successfullyDelete: '删除成功', successfullyDelete: '删除成功',
cannotAddAgain: '不能重复添加',
// 树右键 // 树右键
treeRight: { treeRight: {
addFolder: '新增文件夹', addFolder: '新增文件夹',
@@ -352,6 +352,8 @@ export default {
const params = {} const params = {}
// 业务表信息 // 业务表信息
params.processEsInspectPlanList = this.$refs.inspectionPlanTable.dataSource params.processEsInspectPlanList = this.$refs.inspectionPlanTable.dataSource
// 获取删除业务信息的ids列表
params.processAllDelIds = this.$refs.inspectionPlanTable.getDelIds()
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { if (isValidate) {
@@ -280,24 +280,17 @@ export default {
if (!err) { if (!err) {
// 调整前端存储 // 调整前端存储
const row = Object.assign({}, this.model, values) 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.$emit('ok', row, this.index)
this.close() 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" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:can-drag="true" :can-drag="true"
:rowKey="(row, index) => row.id || index" :rowKey="(_, index) => index"
:loading="loading" :loading="loading"
:pagination="false" :pagination="false"
:row-selection="hasTableOperator ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps } : null" :row-selection="hasTableOperator ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps } : null"
:scroll="{x: '100%'}" :scroll="{x: '100%', y: '50vh'}"
@change="tableOnChange"> @change="tableOnChange">
<!-- 企标号企标名称 --> <!-- 企标号企标名称 -->
@@ -43,14 +43,14 @@
<!-- 操作 --> <!-- 操作 -->
<template slot="action" slot-scope="{text, record, index}"> <template slot="action" slot-scope="{text, record, index}">
<!-- 编辑 and 删除:节点1 节点3 节点2且当前登录人是创建人 --> <!-- 编辑 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 @click="handleEdit(record, index)" >{{ $t('edit') }}</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="handleDelete(record.id)" >{{ $t('delete') }}</a> <a @click="handleDelete(index)" >{{ $t('delete') }}</a>
</template> </template>
<!-- 意见 or 填写意见节点2非自己创建的就是意见和填写意见 --> <!-- 意见 or 填写意见节点2非自己创建的就是意见和填写意见 -->
<template v-else-if="currentNode === EsInspectionPlan.fillInComments.value"> <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> <a v-else @click="handleWriteOpinion(record, index)" >{{ $t('workCenter.esInspectionPlan.writeOpinion') }}</a>
</template> </template>
</template> </template>
@@ -111,6 +111,8 @@ export default {
}, },
model: {}, model: {},
dataSource: [], dataSource: [],
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
allColumns: [ allColumns: [
{ {
title: this.$t('serialNumber'), title: this.$t('serialNumber'),
@@ -292,17 +294,61 @@ export default {
this.filters.taskId = this.$route.query.taskId this.filters.taskId = this.$route.query.taskId
}, },
methods: { 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) { handleEdit (record, index) {
this.$refs.modalForm.edit(record, index) this.$refs.modalForm.edit(record, index)
this.$refs.modalForm.title = this.$t('edit') this.$refs.modalForm.title = this.$t('edit')
this.$refs.modalForm.disableSubmit = false this.$refs.modalForm.disableSubmit = false
}, },
// 添加回调 // 添加或编辑回调
handleAddOrEditCallback (row, index) { handleAddOrEditCallback (row, index) {
console.log(row, index) console.log('添加或编辑回调', row, index)
// index -1就是添加 // index -1就是添加
if (index === -1) { if (index === undefined || index === -1) {
this.dataSource.push(row) this.dataSource.push(row)
} else { } else {
this.dataSource.splice(index, 1, row) this.dataSource.splice(index, 1, row)
@@ -318,7 +364,7 @@ export default {
const obj = { props: { disabled: false } } const obj = { props: { disabled: false } }
// 第二个节点,只有自己的才能勾选删除 // 第二个节点,只有自己的才能勾选删除
if (this.currentNode === EsInspectionPlan.fillInComments.value) { 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 return obj
}, },
@@ -344,16 +390,13 @@ export default {
this.ipagination = pagination this.ipagination = pagination
this.getTableList() this.getTableList()
}, },
// 显示意见
handleShowOpinion (record) {
this.$refs.writeOpinionModal.show(record)
},
// 填写意见 // 填写意见
handleWriteOpinion (record, index) { handleWriteOpinion (record, index) {
this.$refs.writeOpinionModal.show(record, index) this.$refs.writeOpinionModal.show(record, index)
}, },
// 填写意见回调 // 填写意见回调
handleWriteOpinionCallback (data, index) { handleWriteOpinionCallback (data, index) {
console.log(data, index)
this.dataSource.splice(index, 1, { this.dataSource.splice(index, 1, {
...this.dataSource[index], ...this.dataSource[index],
// 填写意见的数据 // 填写意见的数据
@@ -16,7 +16,7 @@
:can-drag="true" :can-drag="true"
rowKey="id" rowKey="id"
:pagination="false" :pagination="false"
:scroll="{x: '100%'}"> :scroll="{x: '100%',y: '50vh'}">
</j-table> </j-table>
</a-spin> </a-spin>
</j-modal> </j-modal>
@@ -79,7 +79,6 @@ export default {
this.orderBy = sorter.order === 'ascend' ? '1' : '2' this.orderBy = sorter.order === 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey this.orderByField = sorter.columnKey
this.ipagination = pagination this.ipagination = pagination
this.getTableList()
} }
} }
} }
@@ -45,6 +45,7 @@
<script> <script>
import JTable from '@comp/jero/JTable' import JTable from '@comp/jero/JTable'
import moment from 'moment'
export default { export default {
name: 'WriteOpinionModal', name: 'WriteOpinionModal',
components: { JTable }, components: { JTable },
@@ -115,9 +116,8 @@ export default {
methods: { methods: {
show (record, index) { show (record, index) {
this.index = index this.index = index
const list = record.processEsInspectPlanOpinionList || [] // 前端保存数据的字段
// 从数组里找到自己的数据显示,或者前端保存数据的字段 const data = record.processEsInspectPlanOpinion || {}
const data = list.find(item => item.createBy === this.$store.getters.userInfo.username) || record.processEsInspectPlanOpinion || {}
this.formData.opinion = data.opinion this.formData.opinion = data.opinion
this.dataSource = [record] this.dataSource = [record]
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
@@ -129,24 +129,12 @@ export default {
// 触发表单验证 // 触发表单验证
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (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.$emit('ok', data, this.index)
this.close() 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 { } else {
return false return false
} }
@@ -190,6 +190,10 @@ export default {
// 是否发起节点 // 是否发起节点
isInitiate () { isInitiate () {
return this.currentNode === EsInspectionProcess.initiate.value return this.currentNode === EsInspectionProcess.initiate.value
},
// 是否上传稽查报告整改计划的节点3
isInputInspectionReport () {
return this.currentNode === EsInspectionProcess.inputInspectionReport.value
} }
}, },
created () { created () {
@@ -245,6 +249,8 @@ export default {
const data = res.result || {} const data = res.result || {}
const processAll = data.processAll || {} const processAll = data.processAll || {}
const processApprovalRecord = data.processApprovalRecord || {} const processApprovalRecord = data.processApprovalRecord || {}
// 回显表格
this.$refs.inspectionProcessTable.setData(data.processEsInspectVOList || [])
this.info = data this.info = data
// 页面回显 // 页面回显
this.processInfoForm && this.processInfoForm.setFieldsValue({ this.processInfoForm && this.processInfoForm.setFieldsValue({
@@ -296,16 +302,37 @@ export default {
async getPageParams (isValidate = true) { async getPageParams (isValidate = true) {
// 去除备注必填 // 去除备注必填
this.validatorRules.remarks.rules[0].required = false this.validatorRules.remarks.rules[0].required = false
if (this.$refs.inspectionProcessTable.dataSource.length === 0) { // 如果需要校验校验表格数据
this.$message.warning(this.$t('addAtLeastOneRowOfData')) if (isValidate) {
throw new Error('base') const list = this.$refs.inspectionProcessTable.dataSource
} if (list.length === 0) {
// fix 79372 稽查内容条数不能为空或0 this.$message.warning(this.$t('addAtLeastOneRowOfData'))
if (this.$refs.inspectionProcessTable.dataSource.some(item => (!item.standardInspectContentCount || item.standardInspectContentCount === '0'))) { throw new Error('base')
this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillInspectionContent')) }
throw new Error('base') /**
* 调整为前端存储
*/
// 节点1:稽查内容条数不能为0
if (this.isInitiate && list.some(item => !(item.enterpriseStandardInspectContentList && item.enterpriseStandardInspectContentList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
throw new Error('base')
}
// 节点3:稽查报告条数不能为0
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectReportList && item.enterpriseStandardInspectReportList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
throw new Error('base')
}
// 节点3:整改计划条数不能为0
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectRectifyPlanList && item.enterpriseStandardInspectRectifyPlanList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
throw new Error('base')
}
} }
const params = {} const params = {}
// 收集表格数据
params.processEsInspectList = this.$refs.inspectionProcessTable.dataSource
// 获取删除业务信息的ids列表
params.processAllDelIds = this.$refs.inspectionProcessTable.getDelIds()
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { if (isValidate) {
@@ -18,23 +18,23 @@
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:can-drag="true" :can-drag="true"
rowKey="id" :rowKey="(_, index) => index"
:loading="loading" :loading="loading"
:row-selection="null" :row-selection="null"
:pagination="ipagination" :pagination="ipagination"
:scroll="{x: '100%'}" :scroll="{x: '100%',y: '50vh'}"
@change="tableOnChange"> @change="tableOnChange">
<!-- 整改部门 --> <!-- 整改部门 -->
<template slot="rectificationDepartment" slot-scope="{text, record}"> <template slot="rectificationDepartment" slot-scope="{text, record}">
<j-select-depart v-model="record.rectificationDepartment" :backDepart="true" @change="changeRowData(record, 'rectificationDepartment')" /> <j-select-depart v-model="record.rectificationDepartment" :backDepart="true" />
</template> </template>
<!-- 操作 --> <!-- 操作 -->
<template slot="action" slot-scope="{text, record, index}"> <template slot="action" slot-scope="{text, record, index}">
<a @click="handleEdit(record, index)" >{{ $t('edit') }}</a> <a @click="handleEdit(record, index)" >{{ $t('edit') }}</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="handleDelete(record.id)" >{{ $t('delete') }}</a> <a @click="handleDelete(index)" >{{ $t('delete') }}</a>
</template> </template>
</j-table> </j-table>
@@ -49,7 +49,6 @@ import JTable from '@comp/jero/JTable'
import { JeroListMixin } from '@/mixins/JeroListMixin' import { JeroListMixin } from '@/mixins/JeroListMixin'
import InspectionProcessContentModal import InspectionProcessContentModal
from '@views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessContentModal' from '@views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessContentModal'
import { editInspectionContentTable } from '@api/workCenter'
export default { export default {
name: 'InspectionProcessContent', name: 'InspectionProcessContent',
@@ -105,35 +104,24 @@ export default {
delete: '/enterprise/InspectContent/delete' delete: '/enterprise/InspectContent/delete'
}, },
dataSource: [], dataSource: [],
columns: columns.slice(0, this.disabled ? 2 : 3) index: -1,
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
columns: columns.slice(0, this.disabled ? 3 : 4)
} }
}, },
methods: { methods: {
show (record) { show (record, index) {
this.filters = { const data = record.enterpriseStandardInspectContentList || []
processEsInspectId: record.id this.dataSource = JSON.parse(JSON.stringify(data))
}
this.loadData()
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.index = index
this.visible = true this.visible = true
}, },
// 整改部门修改
changeRowData (record, field) {
editInspectionContentTable({
id: record.id,
[field]: record[field] || ''
}).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warn(res.message)
}
})
},
// 确定 // 确定
handleOk () { handleOk () {
// console.log(this.selectedRowKeys) this.$emit('delIds', this.delIds)
this.$emit('ok') this.$emit('ok', this.dataSource, this.index)
this.close() this.close()
}, },
// 关闭 // 关闭
@@ -141,7 +129,9 @@ export default {
this.close() this.close()
}, },
close () { close () {
this.delIds = []
this.$emit('close') this.$emit('close')
this.index = -1
this.visible = false this.visible = false
}, },
tableOnChange (pagination, filters, sorter) { tableOnChange (pagination, filters, sorter) {
@@ -156,18 +146,34 @@ export default {
handleEdit (record, index) { handleEdit (record, index) {
this.$refs.inspectionProcessContentModal.title = this.$t('edit') + this.$t('workCenter.esInspectionProcess.opinion') this.$refs.inspectionProcessContentModal.title = this.$t('edit') + this.$t('workCenter.esInspectionProcess.opinion')
this.$refs.inspectionProcessContentModal.edit(this.model, record, index) this.$refs.inspectionProcessContentModal.edit(this.model, record, index)
} },
// 删除
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 (value, index) { modalFormOk (row, index) {
// console.log(value, index) console.log(row, index)
// if (index || index === 0) { // 根据下标判断是添加还是编辑
// // 有下标,说明是编辑 if (index === undefined || index === -1) {
// this.dataSource.splice(index, 1, value) this.dataSource.push(row)
// } else { } else {
// // 没有下标, 是新增 this.dataSource.splice(index, 1, row)
// this.dataSource.push(value) }
// } }
// }
} }
} }
</script> </script>
@@ -59,7 +59,8 @@ import { getFileInfo } from '@/api/api'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { addInspectionContentTable, editInspectionContentTable, getFileByInspectId } from '@api/workCenter' import { getFileByInspectId } from '@api/workCenter'
import moment from 'moment/moment'
const Base64 = require('js-base64').Base64 const Base64 = require('js-base64').Base64
@@ -99,7 +100,7 @@ export default {
validateTrigger: 'blur' validateTrigger: 'blur'
} }
}, },
index: undefined, // 编辑的表格的下标 index: -1, // 编辑的表格的下标
iframeSrc: '' // 左侧预览的路径 iframeSrc: '' // 左侧预览的路径
} }
}, },
@@ -163,7 +164,7 @@ export default {
close () { close () {
this.visible = false this.visible = false
this.model = {} this.model = {}
this.index = undefined this.index = -1
this.iframeSrc = '' this.iframeSrc = ''
}, },
handleCancel () { handleCancel () {
@@ -171,53 +172,26 @@ export default {
}, },
// 提交并新增 // 提交并新增
handleSubmitAddAdd () { handleSubmitAddAdd () {
if (this.confirmLoading) return
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
this.confirmLoading = true
const param = Object.assign({}, this.model, values) const param = Object.assign({}, this.model, values)
if (!param.processEsInspectId) { if (!param.createTime) {
param.processEsInspectId = this.data.id param.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
} }
console.log(param) this.$emit('ok', param, this.index)
const fn = param.id ? editInspectionContentTable : addInspectionContentTable this.form.resetFields()
fn(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok', param, this.index)
this.form.resetFields()
this.model = {}
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
} }
}) })
}, },
handleOk () { handleOk () {
if (this.confirmLoading) return
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
this.confirmLoading = true
const param = Object.assign({}, this.model, values) const param = Object.assign({}, this.model, values)
if (!this.model.processEsInspectId) { if (!param.createTime) {
param.processEsInspectId = this.data.id param.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
} }
console.log(param) this.$emit('ok', param, this.index)
const fn = param.id ? editInspectionContentTable : addInspectionContentTable this.close()
fn(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok', param, this.index)
this.close()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
} }
}) })
} }
@@ -23,10 +23,10 @@
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:can-drag="true" :can-drag="true"
rowKey="id" :rowKey="(_, index) => index"
:row-selection="null" :row-selection="null"
:pagination="ipagination" :pagination="ipagination"
:scroll="{x: '100%'}" :scroll="{x: '100%',y: '50vh'}"
@change="tableOnChange"> @change="tableOnChange">
<!-- 企标号企标名称 --> <!-- 企标号企标名称 -->
@@ -42,7 +42,7 @@
<template slot="action" slot-scope="{text, record, index}"> <template slot="action" slot-scope="{text, record, index}">
<a @click="handleEdit(record, index)" >{{ $t('edit') }}</a> <a @click="handleEdit(record, index)" >{{ $t('edit') }}</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="handleDelete(record.id)" >{{ $t('delete') }}</a> <a @click="handleDelete(index)" >{{ $t('delete') }}</a>
</template> </template>
</j-table> </j-table>
@@ -147,21 +147,22 @@ export default {
delete: '/laws.enterprise/enterpriseStandardInspectRectifyPlan/delete' delete: '/laws.enterprise/enterpriseStandardInspectRectifyPlan/delete'
}, },
dataSource: [], dataSource: [],
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
columns: columns.slice(0, this.disabled ? 6 : 7) columns: columns.slice(0, this.disabled ? 6 : 7)
} }
}, },
methods: { methods: {
show (record) { show (record) {
this.filters = { const data = record.enterpriseStandardInspectRectifyPlanList || []
processEsInspectId: record.id this.dataSource = JSON.parse(JSON.stringify(data))
}
this.loadData()
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.visible = true this.visible = true
}, },
// 确定 // 确定
handleOk () { handleOk () {
console.log(this.selectedRowKeys) this.$emit('delIds', this.delIds)
this.$emit('ok', this.dataSource, this.index)
this.close() this.close()
}, },
// 关闭 // 关闭
@@ -169,6 +170,7 @@ export default {
this.close() this.close()
}, },
close () { close () {
this.delIds = []
this.$emit('close') this.$emit('close')
this.visible = false this.visible = false
}, },
@@ -185,17 +187,43 @@ export default {
this.orderBy = sorter.order === 'ascend' ? '1' : '2' this.orderBy = sorter.order === 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey this.orderByField = sorter.columnKey
this.ipagination = pagination this.ipagination = pagination
this.getTableList()
}, },
handleAdd () { handleAdd () {
this.$refs.modalForm.add(this.model) this.$refs.modalForm.add(this.model)
this.$refs.modalForm.title = this.$t('newlyAdded') this.$refs.modalForm.title = this.$t('newlyAdded')
this.$refs.modalForm.disableSubmit = false this.$refs.modalForm.disableSubmit = false
}, },
handleEdit (record) { handleEdit (record, index) {
this.$refs.modalForm.edit(this.model, record) this.$refs.modalForm.edit(this.model, record, index)
this.$refs.modalForm.title = this.$t('edit') this.$refs.modalForm.title = this.$t('edit')
this.$refs.modalForm.disableSubmit = false 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)
}
} }
} }
} }
@@ -146,10 +146,10 @@
import UploadFile from '@comp/UploadFile' import UploadFile from '@comp/UploadFile'
import UserSelection from '@comp/selection/UserSelection' import UserSelection from '@comp/selection/UserSelection'
import { import {
addInspectionRectificationPlanTable, editInspectionRectificationPlanTable,
getInspectionContentTable, getInspectionContentTable,
queryByInspectContentId queryByInspectContentId
} from '@api/workCenter' } from '@api/workCenter'
import moment from 'moment'
export default { export default {
name: 'InspectionProcessRectificationPlanModal', name: 'InspectionProcessRectificationPlanModal',
components: { UserSelection, UploadFile }, components: { UserSelection, UploadFile },
@@ -176,6 +176,7 @@ export default {
sectionClauseList: [], sectionClauseList: [],
// 是否需要整改(布尔值或null) // 是否需要整改(布尔值或null)
isNeedRectification: null, isNeedRectification: null,
index: -1, // 编辑的表格的下标
rules: { rules: {
inspectContentId: [ inspectContentId: [
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.esInspectionProcess.sectionClause'), trigger: 'change' } { required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.esInspectionProcess.sectionClause'), trigger: 'change' }
@@ -217,9 +218,10 @@ export default {
add (data) { add (data) {
this.edit(data, {}) this.edit(data, {})
}, },
edit (data, record) { edit (data, record, index) {
this.data = Object.assign({}, data) this.data = Object.assign({}, data)
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.index = index
// 获取章节条款下拉 // 获取章节条款下拉
this.initSectionClauseList() this.initSectionClauseList()
const { inspectContentId, requirement, executionStatus, attachment, evaluateScore } = record.enterpriseStandardInspectReport || {} const { inspectContentId, requirement, executionStatus, attachment, evaluateScore } = record.enterpriseStandardInspectReport || {}
@@ -239,7 +241,6 @@ export default {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
const params = Object.assign({}, this.model, this.form) const params = Object.assign({}, this.model, this.form)
const fn = params.id ? editInspectionRectificationPlanTable : addInspectionRectificationPlanTable
if (!params.processEsInspectId) { if (!params.processEsInspectId) {
params.processEsInspectId = this.data.id params.processEsInspectId = this.data.id
} }
@@ -253,18 +254,11 @@ export default {
params.rectifyStatus = '1' params.rectifyStatus = '1'
break break
} }
this.confirmLoading = true if (!params.createTime) {
fn(params).then(res => { params.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
if (res.success) { }
this.$message.success(res.message) this.$emit('ok', params, this.index)
this.$emit('ok') this.close()
this.close()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
} else { } else {
return false return false
} }
@@ -281,6 +275,7 @@ export default {
) )
}, },
close () { close () {
this.index = -1
this.$emit('close') this.$emit('close')
this.visible = false this.visible = false
}, },
@@ -23,10 +23,10 @@
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:can-drag="true" :can-drag="true"
rowKey="id" :rowKey="(_, index) => index"
:row-selection="null" :row-selection="null"
:pagination="ipagination" :pagination="ipagination"
:scroll="{x: '100%'}" :scroll="{x: '100%',y: '50vh'}"
@change="tableOnChange"> @change="tableOnChange">
<!-- 附件 --> <!-- 附件 -->
@@ -39,7 +39,7 @@
<template slot="action" slot-scope="{text, record, index}"> <template slot="action" slot-scope="{text, record, index}">
<a @click="handleEdit(record, index)" >{{ $t('edit') }}</a> <a @click="handleEdit(record, index)" >{{ $t('edit') }}</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="handleDelete(record.id)" >{{ $t('delete') }}</a> <a @click="handleDelete(index)" >{{ $t('delete') }}</a>
</template> </template>
</j-table> </j-table>
@@ -137,22 +137,24 @@ export default {
delete: '/laws.enterprise/EnterpriseStandardInspectReport/delete' delete: '/laws.enterprise/EnterpriseStandardInspectReport/delete'
}, },
dataSource: [], dataSource: [],
index: -1,
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
columns: columns.slice(0, this.disabled ? 6 : 7) columns: columns.slice(0, this.disabled ? 6 : 7)
} }
}, },
methods: { methods: {
show (record) { show (record, index) {
this.filters = { const data = record.enterpriseStandardInspectReportList || []
processEsInspectId: record.id this.dataSource = JSON.parse(JSON.stringify(data))
}
this.loadData()
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.index = index
this.visible = true this.visible = true
}, },
// 确定 // 确定
handleOk () { handleOk () {
// console.log(this.selectedRowKeys) this.$emit('delIds', this.delIds)
this.$emit('ok') this.$emit('ok', this.dataSource, this.index)
this.close() this.close()
}, },
// 关闭 // 关闭
@@ -160,6 +162,8 @@ export default {
this.close() this.close()
}, },
close () { close () {
this.delIds = []
this.index = -1
this.$emit('close') this.$emit('close')
this.visible = false this.visible = false
}, },
@@ -174,11 +178,38 @@ export default {
this.$refs.modalForm.title = this.$t('newlyAdded') this.$refs.modalForm.title = this.$t('newlyAdded')
this.$refs.modalForm.disableSubmit = false this.$refs.modalForm.disableSubmit = false
}, },
handleEdit (record) { handleEdit (record, index) {
this.$refs.modalForm.edit(this.model, record) this.$refs.modalForm.edit(this.model, record, index)
this.$refs.modalForm.title = this.$t('edit') this.$refs.modalForm.title = this.$t('edit')
this.$refs.modalForm.disableSubmit = false 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) { fileLook (record) {
this.$refs.uploadFile.open(record.attachment) this.$refs.uploadFile.open(record.attachment)
@@ -78,7 +78,8 @@
<script> <script>
import UploadFile from '@comp/UploadFile' import UploadFile from '@comp/UploadFile'
import { addInspectionReportTable, editInspectionReportTable, getInspectionContentTable } from '@api/workCenter' import { getInspectionContentTable } from '@api/workCenter'
import moment from 'moment'
export default { export default {
name: 'InspectionProcessReportModal', name: 'InspectionProcessReportModal',
components: { UploadFile }, components: { UploadFile },
@@ -103,6 +104,7 @@ export default {
}, },
// 章节条款下拉 // 章节条款下拉
sectionClauseList: [], sectionClauseList: [],
index: -1, // 编辑的表格的下标
rules: { rules: {
// 章节条款 // 章节条款
inspectContentId: [ inspectContentId: [
@@ -123,10 +125,11 @@ export default {
add (data) { add (data) {
this.edit(data, {}) this.edit(data, {})
}, },
edit (data, record) { edit (data, record, index) {
this.data = Object.assign({}, data) this.data = Object.assign({}, data)
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.form = Object.assign({}, record) this.form = Object.assign({}, record)
this.index = index
// 获取章节条款下拉 // 获取章节条款下拉
this.initSectionClauseList() this.initSectionClauseList()
this.visible = true this.visible = true
@@ -136,22 +139,11 @@ export default {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
const params = Object.assign({}, this.model, this.form) const params = Object.assign({}, this.model, this.form)
const fn = params.id ? editInspectionReportTable : addInspectionReportTable if (!params.createTime) {
if (!params.processEsInspectId) { params.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
params.processEsInspectId = this.data.id
} }
this.confirmLoading = true this.$emit('ok', params, this.index)
fn(params).then(res => { this.close()
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
} else { } else {
return false return false
} }
@@ -168,6 +160,7 @@ export default {
) )
}, },
close () { close () {
this.index = -1
this.$emit('close') this.$emit('close')
this.visible = false this.visible = false
}, },
@@ -10,10 +10,10 @@
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:can-drag="true" :can-drag="true"
rowKey="id" :rowKey="(_, index) => index"
:loading="loading" :loading="loading"
:pagination="false" :pagination="false"
:scroll="{x: '100%'}" :scroll="{x: '100%',y: '50vh'}"
@change="tableOnChange"> @change="tableOnChange">
<!-- 企标号企标名称 --> <!-- 企标号企标名称 -->
@@ -30,12 +30,8 @@
<div class="table-form" v-if="isInputInspectionReport"> <div class="table-form" v-if="isInputInspectionReport">
<a-date-picker :placeholder="$t('pleaseSelect')+$t('date')" <a-date-picker :placeholder="$t('pleaseSelect')+$t('date')"
style="width: 100%" style="width: 100%"
@change="changeRowData(record, 'completeDate')"
value-format="YYYY-MM-DD hh:mm:ss" value-format="YYYY-MM-DD hh:mm:ss"
v-model="record.completeDate" /> v-model="record.completeDate" />
<!--<j-date v-model="record.actualInspectionCompletionDate" showType="day"-->
<!-- @change="changeRowData(record)" value-format="YYYY-MM-DD hh:mm:ss"-->
<!-- style="width: 100%" :getCalendarContainer="(el) => getNumParentNode(el, 5)"></j-date>-->
</div> </div>
<a-tooltip v-else overlay-class-name="tooltip-style"> <a-tooltip v-else overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template> <template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
@@ -47,7 +43,7 @@
<!-- 实际稽查人 --> <!-- 实际稽查人 -->
<template v-slot:actualInspector="{text, record}"> <template v-slot:actualInspector="{text, record}">
<div class="table-form" v-if="isInputInspectionReport"> <div class="table-form" v-if="isInputInspectionReport">
<a-select v-model="record.actualInspectUser" style="width: 100%" allowClear @change="changeRowData(record, 'actualInspectUser')" <a-select v-model="record.actualInspectUser" style="width: 100%" allowClear
:placeholder="$t('pleaseSelect')+$t('workCenter.esInspectionProcess.actualInspector')" :placeholder="$t('pleaseSelect')+$t('workCenter.esInspectionProcess.actualInspector')"
show-search :filter-option="filterOption"> show-search :filter-option="filterOption">
<a-select-option v-for="item in userList" :key="item.id" :value="item.id">{{ item.realname + '(' + item.username + ')' }}</a-select-option> <a-select-option v-for="item in userList" :key="item.id" :value="item.id">{{ item.realname + '(' + item.username + ')' }}</a-select-option>
@@ -66,7 +62,7 @@
<template v-if="isInitiate || isDirectorLeaderApprovalOne"> <template v-if="isInitiate || isDirectorLeaderApprovalOne">
<a @click="handleInspectionContent(record, index)" >{{ $t('workCenter.esInspectionProcess.inspectionContent') + `(${record.standardInspectContentCount || 0}${$t('strip')})` }}</a> <a @click="handleInspectionContent(record, index)" >{{ $t('workCenter.esInspectionProcess.inspectionContent') + `(${record.standardInspectContentCount || 0}${$t('strip')})` }}</a>
<a-divider v-if="isInitiate" type="vertical" /> <a-divider v-if="isInitiate" type="vertical" />
<a v-if="isInitiate" @click="handleDelete(record.id)" >{{ $t('delete') }}</a> <a v-if="isInitiate" @click="handleDelete(index)" >{{ $t('delete') }}</a>
</template> </template>
<!-- 后续节点都显示稽查报告和整改计划 --> <!-- 后续节点都显示稽查报告和整改计划 -->
<template v-else> <template v-else>
@@ -79,13 +75,13 @@
</j-table> </j-table>
</div> </div>
<!-- 添加稽查计划 --> <!-- 添加稽查计划 -->
<inspection-process-table-modal ref="inspectionProcessTableModal" @ok="modalFormOk" v-if="isInitiate"/> <inspection-process-table-modal ref="inspectionProcessTableModal" @ok="handleAddPlanCallback" v-if="isInitiate"/>
<!-- 稽查内容节点2只查看后续不显示 --> <!-- 稽查内容节点2只查看后续不显示 -->
<inspection-process-content ref="inspectionProcessContent" @ok="modalFormOk" :disabled="!isInitiate"/> <inspection-process-content ref="inspectionProcessContent" @ok="handleContentCallback" @delIds="addDelIds" :disabled="!isInitiate"/>
<!-- 稽查报告节点3填写后续只查看 --> <!-- 稽查报告节点3填写后续只查看 -->
<inspection-process-report ref="inspectionProcessReport" @ok="modalFormOk" :disabled="!isInputInspectionReport"/> <inspection-process-report ref="inspectionProcessReport" @ok="handleReportCallback" @delIds="addDelIds" :disabled="!isInputInspectionReport"/>
<!-- 整改计划节点3填写后续只查看 --> <!-- 整改计划节点3填写后续只查看 -->
<inspection-process-rectification-plan ref="inspectionProcessRectificationPlan" @ok="modalFormOk" :disabled="!isInputInspectionReport"/> <inspection-process-rectification-plan ref="inspectionProcessRectificationPlan" @ok="handleRectificationCallback" @delIds="addDelIds" :disabled="!isInputInspectionReport"/>
</div> </div>
</template> </template>
@@ -102,8 +98,6 @@ import InspectionProcessReport
import InspectionProcessRectificationPlan import InspectionProcessRectificationPlan
from '@views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessRectificationPlan' from '@views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessRectificationPlan'
import { EsInspectionProcess } from '@/enums/commonEnums' import { EsInspectionProcess } from '@/enums/commonEnums'
import { editInspectProcessTable } from '@api/workCenter'
import { getAction } from '@api/manage'
export default { export default {
name: 'InspectionProcessTable', name: 'InspectionProcessTable',
components: { InspectionProcessRectificationPlan, InspectionProcessReport, InspectionProcessContent, InspectionProcessTableModal, JTable }, components: { InspectionProcessRectificationPlan, InspectionProcessReport, InspectionProcessContent, InspectionProcessTableModal, JTable },
@@ -130,6 +124,8 @@ export default {
model: {}, model: {},
userList: [], userList: [],
dataSource: [], dataSource: [],
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
allColumns: [ allColumns: [
{ {
title: this.$t('serialNumber'), title: this.$t('serialNumber'),
@@ -278,18 +274,13 @@ export default {
} }
}, },
methods: { methods: {
// 修改:实际稽查完成日期、实际稽查人 // 子表格删除数据事件(将删除id统一收集)
changeRowData (record, field) { addDelIds (list) {
editInspectProcessTable({ this.delIds.push(...list)
id: record.id, },
[field]: record[field] || '' // 父组件获取删除的ids
}).then(res => { getDelIds () {
if (res.success) { return Array.from(new Set(this.delIds)).filter(item => item).join(',')
this.$message.success(res.message)
} else {
this.$message.warn(res.message)
}
})
}, },
// 返回用户列表 // 返回用户列表
getUserList () { getUserList () {
@@ -300,14 +291,40 @@ export default {
}) })
}, },
// 稽查内容 // 稽查内容
handleInspectionContent (record) { handleInspectionContent (record, index) {
this.$refs.inspectionProcessContent.show(record) this.$refs.inspectionProcessContent.show(record, index)
},
// 稽查内容回调
handleContentCallback (data, index) {
console.log('稽查内容回调', data, index)
this.dataSource.splice(index, 1, {
...this.dataSource[index],
enterpriseStandardInspectContentList: data,
standardInspectContentCount: data.length
})
},
handleReportCallback (data, index) {
console.log('稽查报告回调', data, index)
this.dataSource.splice(index, 1, {
...this.dataSource[index],
enterpriseStandardInspectReportList: data
})
},
handleRectificationCallback (data, index) {
console.log('整改计划回调', data, index)
this.dataSource.splice(index, 1, {
...this.dataSource[index],
enterpriseStandardInspectRectifyPlanList: data
})
}, },
// 添加计划 // 添加计划
handleAdd () { handleAdd () {
this.$refs.inspectionProcessTableModal.show({ const selectedIds = this.dataSource.map(item => item.inspectId)
projectId: this.projectId this.$refs.inspectionProcessTableModal.show(selectedIds)
}) },
// 添加稽查计划回调
handleAddPlanCallback (list) {
this.dataSource.push(...list)
}, },
// 跳转详情 // 跳转详情
detailClick (record) { detailClick (record) {
@@ -344,38 +361,24 @@ export default {
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
) )
}, },
loadData (arg) { // 删除
if (!this.url.list) { handleDelete (index) {
this.$message.warning('请设置url.list属性!') this.$confirm({
return title: this.$t('confirmDeletion'),
} content: this.$t('areYouSure'),
// 加载数据 若传入参数1则加载第一页的内容 onOk: () => {
if (arg === 1) { if (this.dataSource[index].id) {
this.ipagination.current = 1 this.delIds.push(this.dataSource[index].id)
}
const params = this.getQueryParams()// 查询条件
this.loading = true
return getAction(this.url.list, params).then((res) => {
if (res.success) {
// update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
const data = res.result.records || res.result
this.dataSource = data.map(item => {
return {
...item,
actualInspectUser: item.actualInspectUser || undefined
}
})
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
} }
// update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ this.dataSource.splice(index, 1)
} else {
this.$message.warning(res.message)
} }
}).finally(() => { })
this.loading = false },
// 设置表格数据
setData (list) {
this.dataSource = list.map(item => {
item.actualInspectUser = item.actualInspectUser || undefined
return item
}) })
} }
} }
@@ -39,7 +39,7 @@
rowKey="id" rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination" :pagination="ipagination"
:scroll="{x: '100%'}" :scroll="{x: '100%',y: '50vh'}"
@change="tableOnChange"> @change="tableOnChange">
<!-- 企标号企标名称 --> <!-- 企标号企标名称 -->
<template v-slot:standard="{text, record}"> <template v-slot:standard="{text, record}">
@@ -57,7 +57,7 @@
<script> <script>
import JTable from '@comp/jero/JTable' import JTable from '@comp/jero/JTable'
import { JeroListMixin } from '@/mixins/JeroListMixin' import { JeroListMixin } from '@/mixins/JeroListMixin'
import { addInspectProcessTable } from '@api/workCenter' import moment from 'moment'
export default { export default {
name: 'InspectionProcessTableModal', name: 'InspectionProcessTableModal',
@@ -74,6 +74,8 @@ export default {
list: '/enterprise/inspect/queryByPage' list: '/enterprise/inspect/queryByPage'
}, },
dataSource: [], dataSource: [],
// 已经选择的ids
selectedIds: [],
columns: [ columns: [
{ // 稽查依据标准号 { // 稽查依据标准号
title: this.$t('workCenter.esInspectionPlan.inspectionBasisStandardNumber'), title: this.$t('workCenter.esInspectionPlan.inspectionBasisStandardNumber'),
@@ -128,11 +130,13 @@ export default {
} }
}, },
methods: { methods: {
show (record) { show (selectedIds) {
// 已经选择的ids(用于验证不能重复选择)
this.selectedIds = selectedIds
this.filters.inspectStatus = '1' this.filters.inspectStatus = '1'
this.filters.inspectUser = this.$store.getters.userInfo.id this.filters.inspectUser = this.$store.getters.userInfo.id
this.loadData() this.loadData()
this.model = Object.assign({}, record) this.model = Object.assign({})
this.visible = true this.visible = true
}, },
// 确定 // 确定
@@ -141,21 +145,21 @@ export default {
this.$message.warn(this.$t('selectARecord')) this.$message.warn(this.$t('selectARecord'))
return return
} }
const params = Object.assign({ // 验证不能重复选择
ids: this.selectedRowKeys.join(',') if (this.selectedRowKeys.some(item => this.selectedIds.includes(item))) {
}, this.model) this.$message.warn(this.$t('cannotAddAgain'))
this.loading = true return
addInspectProcessTable(params).then((res) => { }
if (res.success) { const data = this.selectionRows.map(item => {
this.$message.success(res.message) item.inspectId = item.id
this.$emit('ok') delete item.id
this.close() if (!item.createTime) {
} else { item.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
this.$message.warning(res.message)
} }
}).finally(() => { return item
this.loading = false
}) })
this.$emit('ok', data)
this.close()
}, },
// 关闭 // 关闭
handleCancel () { handleCancel () {