update 稽查流程完善

This commit is contained in:
danshihao
2024-01-07 11:56:12 +08:00
parent d526a1c4e3
commit 25451fd6c0
5 changed files with 65 additions and 39 deletions
@@ -330,7 +330,22 @@ export default {
}
const params = {}
// 收集表格数据
params.processEsInspectList = this.$refs.inspectionProcessTable.dataSource
params.processEsInspectList = this.$refs.inspectionProcessTable.dataSource.map(item => {
// 如果没有子表格数据,就默认空数组,否则后端报错
// 稽查内容
if (!item.enterpriseStandardInspectContentList) {
item.enterpriseStandardInspectContentList = []
}
// 稽查报告
if (!item.enterpriseStandardInspectReportList) {
item.enterpriseStandardInspectReportList = []
}
// 整改计划
if (!item.enterpriseStandardInspectRectifyPlanList) {
item.enterpriseStandardInspectRectifyPlanList = []
}
return item
})
// 获取删除业务信息的ids列表
params.processAllDelIds = this.$refs.inspectionProcessTable.getDelIds()
// 收集所有表单信息
@@ -48,7 +48,7 @@
</j-table>
</a-spin>
<!-- 新增编辑整改计划 -->
<inspection-process-rectification-plan-modal ref="modalForm" @ok="modalFormOk"/>
<inspection-process-rectification-plan-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/>
</j-modal>
</template>
@@ -149,7 +149,7 @@ export default {
dataSource: [],
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
columns: columns.slice(0, this.disabled ? 6 : 7)
columns: columns.slice(0, this.disabled ? 8 : 9)
}
},
methods: {
@@ -19,6 +19,7 @@
<a-select v-model="form.inspectContentId"
:placeholder="$t('pleaseSelect') + $t('workCenter.esInspectionProcess.sectionClause')"
show-search
allowClear
@change="changeSectionClause"
:filter-option="filterOption">
<a-select-option v-for="item in sectionClauseList" :value="item.id" :key="item.id">{{ item.clause }}</a-select-option>
@@ -145,14 +146,17 @@
import UploadFile from '@comp/UploadFile'
import UserSelection from '@comp/selection/UserSelection'
import {
getInspectionContentTable,
queryByInspectContentId
} from '@api/workCenter'
import moment from 'moment'
export default {
name: 'InspectionProcessRectificationPlanModal',
components: { UserSelection, UploadFile },
props: {
// 临时的数据,如果不提交就不保存
tempDataSource: {
type: Array,
default: () => []
}
},
data () {
return {
title: this.$t('workCenter.esInspectionProcess.inspectionPlanEs'),
@@ -224,10 +228,10 @@ export default {
this.index = index
// 获取章节条款下拉
this.initSectionClauseList()
const { inspectContentId, requirement, executionStatus, attachment, evaluateScore } = record.enterpriseStandardInspectReport || {}
const { standardRequire, executionStatus, attachment, evaluateScore } = record.enterpriseStandardInspectReport || {}
this.form = Object.assign({}, record, {
inspectContentId,
standardRequire: requirement,
// inspectContentId,
standardRequire,
executionStatus,
attachment,
evaluateScore
@@ -317,38 +321,38 @@ export default {
},
// 初始化章节条款下拉
initSectionClauseList () {
getInspectionContentTable({
processEsInspectId: this.data.id
}).then(res => {
if (res.success) {
this.sectionClauseList = res.result || []
}
// 过滤已经被选择的下拉
const contentlist = this.data.enterpriseStandardInspectContentList || []
const planList = this.tempDataSource || []
this.sectionClauseList = contentlist.filter(content => {
// 当前没有被选择过,或者编辑时选择的就是当前数据就显示在下拉
return !planList.find(report => report.inspectContentId === content.id) || this.model.inspectContentId === content.id
})
},
// 章节条款改变
changeSectionClause (val) {
console.log(val)
if (val) {
// const obj = this.sectionClauseList.find(item => item.id === val)
queryByInspectContentId({
inspectContentId: val
}).then(res => {
if (res.success) {
const { id, standardRequire, executionStatus, attachment, evaluateScore } = res.result || {}
this.form.inspectReportId = id
this.form.standardRequire = standardRequire
this.form.executionStatus = executionStatus
this.form.attachment = attachment
this.form.evaluateScore = evaluateScore
this.$forceUpdate()
}
})
console.log(this)
const contentList = this.data.enterpriseStandardInspectContentList || []
const reportList = this.data.enterpriseStandardInspectReportList || []
const content = contentList.find(item => item.id === val) || {}
const report = reportList.find(item => item.inspectContentId === val) || {}
// this.form.inspectReportId = report.inspectReportId
this.form.standardRequire = content.requirement
this.form.executionStatus = report.executionStatus
this.form.attachment = report.attachment
this.form.evaluateScore = report.evaluateScore
this.form.enterpriseStandardInspectReport = report
} else {
this.form.inspectReportId = undefined
// this.form.inspectReportId = undefined
this.form.standardRequire = undefined
this.form.executionStatus = undefined
this.form.attachment = undefined
this.form.evaluateScore = undefined
this.form.enterpriseStandardInspectReport = undefined
}
this.$forceUpdate()
}
}
}
@@ -45,7 +45,7 @@
</j-table>
</a-spin>
<!-- 新增编辑稽查报告 -->
<inspection-process-report-modal ref="modalForm" @ok="modalFormOk"/>
<inspection-process-report-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/>
<!-- 上传回显 -->
<upload-file ref="uploadFile" disabled></upload-file>
</j-modal>
@@ -19,6 +19,7 @@
<a-select v-model="form.inspectContentId"
:placeholder="$t('pleaseSelect') + $t('workCenter.esInspectionProcess.sectionClause')"
show-search
allowClear
@change="changeSectionClause"
:filter-option="filterOption">
<a-select-option v-for="item in sectionClauseList" :value="item.id" :key="item.id">{{ item.clause }}</a-select-option>
@@ -78,11 +79,17 @@
<script>
import UploadFile from '@comp/UploadFile'
import { getInspectionContentTable } from '@api/workCenter'
import moment from 'moment'
export default {
name: 'InspectionProcessReportModal',
components: { UploadFile },
props: {
// 临时的数据,如果不提交就不保存
tempDataSource: {
type: Array,
default: () => []
}
},
data () {
return {
title: this.$t('workCenter.esInspectionProcess.inspectionPlanEs'),
@@ -194,12 +201,12 @@ export default {
},
// 初始化章节条款下拉
initSectionClauseList () {
getInspectionContentTable({
processEsInspectId: this.data.id
}).then(res => {
if (res.success) {
this.sectionClauseList = res.result || []
}
// 过滤已经被选择的下拉
const contentlist = this.data.enterpriseStandardInspectContentList || []
const reportList = this.tempDataSource || []
this.sectionClauseList = contentlist.filter(content => {
// 当前没有被选择过,或者编辑时选择的就是当前数据就显示在下拉
return !reportList.find(report => report.inspectContentId === content.id) || this.model.inspectContentId === content.id
})
},
// 章节条款改变