394 lines
15 KiB
Vue
394 lines
15 KiB
Vue
<template>
|
|
<j-modal
|
|
:title="title"
|
|
:width="drawerWidth"
|
|
:visible="visible"
|
|
:confirmLoading="confirmLoading"
|
|
switchFullscreen
|
|
@ok="handleOk"
|
|
@cancel="handleCancel"
|
|
:cancelText="$t('close')">
|
|
<a-spin :spinning="confirmLoading">
|
|
<a-form-model ref="form" :model="form" :rules="rules">
|
|
<!-- 章节条款 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
prop="inspectContentId"
|
|
:label="$t('workCenter.esInspectionProcess.sectionClause')">
|
|
<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>
|
|
</a-select>
|
|
</a-form-model-item>
|
|
<!-- 标准内容或要求 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
prop="standardRequire"
|
|
:label="$t('workCenter.esInspectionProcess.standardContentOrDemand')">
|
|
<a-input :maxLength="500"
|
|
type="textarea"
|
|
:rows="4"
|
|
v-model="form.standardRequire"
|
|
:placeholder="$t('pleaseEnter') + $t('workCenter.esInspectionProcess.sectionNumber')"
|
|
disabled />
|
|
</a-form-model-item>
|
|
<!-- 执行情况 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
prop="executionStatus"
|
|
:label="$t('workCenter.esInspectionProcess.implementation')">
|
|
<a-input :max-length="50" v-model="form.executionStatus" disabled
|
|
:placeholder="$t('pleaseEnter') + $t('workCenter.esInspectionProcess.implementation')" />
|
|
</a-form-model-item>
|
|
<!-- 附件 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.file')"
|
|
prop="attachment">
|
|
<a-button type="primary" class="button-text" @click="clickButtonToUpload">
|
|
{{
|
|
(form.attachment === 'null' || form.attachment === '' || form.attachment === null || form.attachment === undefined)
|
|
? $t('uploadFile.clickUpload')
|
|
: $t('uploadFile.viewUploadedFiles')
|
|
}}
|
|
</a-button>
|
|
</a-form-model-item>
|
|
<!-- 评分 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.score')"
|
|
prop="evaluateScore">
|
|
<a-input-number v-model="form.evaluateScore" :min="0" :max="100" disabled
|
|
:placeholder="$t('pleaseEnter') + $t('workCenter.esInspectionProcess.score')"
|
|
style="width: 100%" :formatter="limitNumber" :parser="limitNumber" />
|
|
</a-form-model-item>
|
|
<!-- 是否需要整改 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.isNeedRectification')"
|
|
prop="isRectify">
|
|
<j-dict-select-tag :placeholder="$t('pleaseSelect') + $t('workCenter.esInspectionProcess.isNeedRectification')"
|
|
type="radio"
|
|
dictCode="yn"
|
|
@change="changeIsNeedRectification"
|
|
v-model="form.isRectify" />
|
|
</a-form-model-item>
|
|
<!-- 不符合项描述 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.nonCompliantDescription')"
|
|
prop="issue">
|
|
<a-textarea :placeholder="$t('pleaseEnter') + $t('workCenter.esInspectionProcess.nonCompliantDescription')"
|
|
:maxLength="500"
|
|
:rows="4"
|
|
v-model="form.issue"/>
|
|
</a-form-model-item>
|
|
<template v-if="isNeedRectification">
|
|
<!-- 整改措施 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.rectificationMeasures')"
|
|
prop="rectifyMeasure">
|
|
<a-textarea :placeholder="$t('pleaseEnter') + $t('workCenter.esInspectionProcess.rectificationMeasures')"
|
|
:maxLength="500"
|
|
:rows="4"
|
|
v-model="form.rectifyMeasure"/>
|
|
</a-form-model-item>
|
|
<!-- 整改单位 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.rectificationUnit')"
|
|
prop="responseDepart">
|
|
<j-select-depart :placeholder="$t('pleaseSelect') + $t('workCenter.esInspectionProcess.rectificationUnit')"
|
|
v-model="form.responseDepart" />
|
|
</a-form-model-item>
|
|
<!-- 整改负责人 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.rectificationDirector')"
|
|
prop="responseUser">
|
|
<user-selection :placeholder="$t('pleaseSelect') + $t('workCenter.esInspectionProcess.rectificationDirector')"
|
|
@nameChange="nameChangeCallback($event, 'responseUserDictText')"
|
|
type="radio" v-model="form.responseUser" :nameStr="form.responseUserDictText" />
|
|
</a-form-model-item>
|
|
<!-- 计划完成日期 -->
|
|
<a-form-model-item
|
|
:labelCol="labelCol"
|
|
:wrapperCol="wrapperCol"
|
|
:label="$t('workCenter.esInspectionProcess.planDoneDate')"
|
|
prop="planCompleteDate">
|
|
<a-date-picker :placeholder="$t('pleaseSelect') + $t('workCenter.esInspectionProcess.planDoneDate')"
|
|
style="width: 100%"
|
|
value-format="YYYY-MM-DD hh:mm:ss"
|
|
v-model="form.planCompleteDate" />
|
|
</a-form-model-item>
|
|
</template>
|
|
</a-form-model>
|
|
</a-spin>
|
|
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false" disabled></upload-file>
|
|
</j-modal>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import UploadFile from '@comp/UploadFile'
|
|
import UserSelection from '@comp/selection/UserSelection'
|
|
import moment from 'moment'
|
|
import { getInspectProcessProjectId } from '@api/workCenter'
|
|
import { getDictItemsFromCache } from '@api/api'
|
|
export default {
|
|
name: 'InspectionProcessRectificationPlanModal',
|
|
components: { UserSelection, UploadFile },
|
|
props: {
|
|
// 临时的数据,如果不提交就不保存
|
|
tempDataSource: {
|
|
type: Array,
|
|
default: () => []
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
title: this.$t('workCenter.esInspectionProcess.inspectionPlanEs'),
|
|
drawerWidth: 600,
|
|
visible: false,
|
|
form: {},
|
|
// 父表中当前行
|
|
data: {},
|
|
// 当前表中当前行
|
|
model: {},
|
|
confirmLoading: false,
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 7 }
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 16 }
|
|
},
|
|
// 章节条款下拉
|
|
sectionClauseList: [],
|
|
// 是否需要整改(布尔值或null)
|
|
isNeedRectification: null,
|
|
index: -1, // 编辑的表格的下标
|
|
rules: {
|
|
inspectContentId: [
|
|
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.esInspectionProcess.sectionClause'), trigger: 'change' }
|
|
],
|
|
// 是否需要整改
|
|
isRectify: [
|
|
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.esInspectionProcess.isNeedRectification'), trigger: 'change' }
|
|
],
|
|
// 不符合项描述
|
|
issue: [
|
|
{ required: false, message: this.$t('pleaseEnter') + this.$t('workCenter.esInspectionProcess.nonCompliantDescription'), trigger: 'blur' }
|
|
],
|
|
// 整改措施
|
|
rectifyMeasure: [
|
|
{ required: true, message: this.$t('pleaseEnter') + this.$t('workCenter.esInspectionProcess.rectificationMeasures'), trigger: 'blur' }
|
|
],
|
|
// 整改单位
|
|
responseDepart: [
|
|
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.esInspectionProcess.rectificationUnit'), trigger: 'change' }
|
|
],
|
|
// 整改负责人
|
|
responseUser: [
|
|
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.esInspectionProcess.rectificationDirector'), trigger: 'change' }
|
|
],
|
|
// 计划完成日期
|
|
planCompleteDate: [
|
|
{ required: true, message: this.$t('pleaseSelect') + this.$t('workCenter.esInspectionProcess.planDoneDate'), trigger: 'change' }
|
|
]
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
// 是否需要整改 改变时,修改 不符合项描述 必填状态
|
|
isNeedRectification (val) {
|
|
this.rules.issue[0].required = val
|
|
}
|
|
},
|
|
methods: {
|
|
add (data) {
|
|
this.edit(data, {})
|
|
},
|
|
edit (data, record, index) {
|
|
this.data = Object.assign({}, data)
|
|
this.model = Object.assign({}, record)
|
|
this.index = index
|
|
// 获取章节条款下拉
|
|
this.initSectionClauseList()
|
|
const { inspectContentId, standardRequire, executionStatus, attachment, evaluateScore } = record.enterpriseStandardInspectReport || {}
|
|
this.form = Object.assign({}, record, {
|
|
inspectContentId,
|
|
standardRequire,
|
|
executionStatus,
|
|
attachment,
|
|
evaluateScore
|
|
})
|
|
this.changeIsNeedRectification(record.isRectify)
|
|
// this.changeSectionClause(record.inspectContentId)
|
|
this.visible = true
|
|
},
|
|
// 确定
|
|
handleOk () {
|
|
this.$refs.form.validate(valid => {
|
|
if (valid) {
|
|
const params = Object.assign({}, this.model, this.form)
|
|
if (!params.processEsInspectId) {
|
|
params.processEsInspectId = this.data.id
|
|
}
|
|
// 是否整改isRectify 1是 0否
|
|
// 判断整改状态rectifyStatus 1整改中 4无需整改
|
|
const dictList = getDictItemsFromCache('inspect_rectify_status')
|
|
switch (params.isRectify + '') {
|
|
case '0':
|
|
params.rectifyStatus = '4'
|
|
params.rectifyStatus_dictText = (dictList.find(item => item.value === '4')).text
|
|
break
|
|
case '1':
|
|
params.rectifyStatus = '1'
|
|
params.rectifyStatus_dictText = (dictList.find(item => item.value === '1')).text
|
|
break
|
|
}
|
|
if (!params.createTime) {
|
|
params.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
|
|
}
|
|
if (params.id) {
|
|
this.$emit('ok', params, this.index)
|
|
this.close()
|
|
return
|
|
}
|
|
this.confirmLoading = true
|
|
getInspectProcessProjectId().then(res => {
|
|
params.id = res + ''
|
|
this.$emit('ok', params, this.index)
|
|
this.close()
|
|
}).finally(() => {
|
|
this.confirmLoading = false
|
|
})
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
// this.close()
|
|
},
|
|
// 关闭
|
|
handleCancel () {
|
|
this.close()
|
|
},
|
|
filterOption (input, option) {
|
|
return (
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
)
|
|
},
|
|
close () {
|
|
this.index = -1
|
|
this.$emit('close')
|
|
this.visible = false
|
|
},
|
|
// 选择用户名字修改回调
|
|
nameChangeCallback (name, field) {
|
|
this.form[field] = name
|
|
},
|
|
// 点击点击上传按钮
|
|
clickButtonToUpload () {
|
|
this.$refs.uploadFile.open(this.form.attachment)
|
|
// this.uploadName = item.dbFieldName
|
|
},
|
|
// 修改事件:是否需要整改
|
|
changeIsNeedRectification (val) {
|
|
if (val === '1') {
|
|
this.isNeedRectification = true
|
|
} else if (val === '2') {
|
|
this.isNeedRectification = false
|
|
} else {
|
|
this.isNeedRectification = null
|
|
}
|
|
},
|
|
// 文件上传改变后的回调
|
|
uploadFileChange (data) {
|
|
const attIdList = []
|
|
if (data && data.length > 0) {
|
|
data.map(item => {
|
|
attIdList.push(item.id)
|
|
})
|
|
}
|
|
/** 赋值给当前对应的表单文件 */
|
|
this.form.attachment = attIdList.join(',')
|
|
},
|
|
// 正则替换小数点
|
|
limitNumber (value) {
|
|
if (typeof value === 'string') {
|
|
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
|
|
} else if (typeof value === 'number') {
|
|
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
|
|
} else {
|
|
return 0
|
|
}
|
|
},
|
|
// 初始化章节条款下拉
|
|
initSectionClauseList () {
|
|
// 过滤已经被选择的下拉
|
|
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) {
|
|
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.id
|
|
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.standardRequire = undefined
|
|
this.form.executionStatus = undefined
|
|
this.form.attachment = undefined
|
|
this.form.evaluateScore = undefined
|
|
this.form.enterpriseStandardInspectReport = undefined
|
|
}
|
|
this.$forceUpdate()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
// 无边框无背景
|
|
.readonly-transparent {
|
|
background-color: transparent;
|
|
border-color: transparent;
|
|
&:hover {
|
|
cursor: default;
|
|
background-color: transparent;
|
|
border-color: transparent;
|
|
}
|
|
}
|
|
</style>
|