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