Files
laws_weilai/jero-web/src/views/processCenter/components/evaluatorFeedback.vue
T
2022-10-19 14:46:06 +08:00

465 lines
16 KiB
Java

<template>
<div class="box">
<div class="box-text">
<div class="header-text">
{{title}}
</div>
</div>
<div class="content-text-text">
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="!disabled">*</span>
<span class="title-text-text" :title="$t('complianceResults')">{{$t('complianceResults')}}</span>
</div>
<div class="title-text-right" v-if="disabled">
{{formInline.complianceResult == 'Compliance'?$t('accord'):$t('nonConformity')}}
</div>
<a-form-model-item class="itemModel" v-if="!disabled" :prop="!disabled?'complianceResult':''">
<a-radio-group style="margin-top: 2px" class="box-input"
v-model="formInline.complianceResult">
<a-radio value="Compliance">
{{$t('accord')}}
</a-radio>
<a-radio value="Non-Compliance">
{{$t('nonConformity')}}
</a-radio>
</a-radio-group>
</a-form-model-item>
</div>
</a-col>
</a-row>
<div v-for="(item,index) in formInline.dataList" :key="index">
<div class="feedbackPoint">
{{$t('feedbackPoint')+(index+1)}}
<a-icon class="icon-size"
@click="addData"
v-if="(formInline.dataList.length-1) == index && !disabled"
type="plus-circle"/>
<a-icon class="icon-size"
@click="deleteData"
v-if="formInline.dataList.length > 1 && (formInline.dataList.length - 1) == index && !disabled"
type="minus-circle"/>
</div>
<a-row :gutter="24" v-if="!disabled">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="!disabled">*</span>
<span class="title-text-text" :title="$t('relevantSections')">{{$t('relevantSections')}}</span>
</div>
<div class="title-text-right" :title="item.relatedSection" v-if="disabled">
{{item.relatedSection}}
</div>
<a-form-model-item class="itemModel" v-if="!disabled"
:prop="'dataList.'+index+'.relatedSection'"
:rules="[{ required: true, message: $t('relevantSections') + $t('cannotEmpty'), trigger: 'blur'},
{max: 300,message: $t('relevantSections') + $t('cannotExceed') + 300 + $t('Characters'),trigger: 'blur'
}]">
<a-input class="box-input"
:disabled="disabled"
v-model.trim="item.relatedSection"
:placeholder="$t('PleaseEnter')+$t('relevantSections')"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="!disabled">*</span>
<span class="title-text-text"
:title="$t('problemDescription')">{{$t('problemDescription')}}</span>
</div>
<div class="title-text-right" :title="item.issueOrSuggest" v-if="disabled">
{{item.issueOrSuggest}}
</div>
<a-form-model-item class="itemModel" :prop="'dataList.'+index+'.issueOrSuggest'" v-if="!disabled"
:rules="[{ required: true, message: $t('problemDescription') + $t('cannotEmpty'), trigger: 'blur'},
{max: 300,message: $t('problemDescription') + $t('cannotExceed') + 300 + $t('Characters'),trigger: 'blur'
}]">
<a-input class="box-input"
:disabled="disabled"
v-model.trim="item.issueOrSuggest"
:placeholder="$t('PleaseEnter')+$t('problemDescription')"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24" v-if="!disabled">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('enclosure')">{{$t('enclosure')}}</span>
</div>
<div class="title-text-right" v-if="disabled">
<span style="color: #21c9cc;cursor: pointer"
v-if="item.accessoryFile" @click="viewUploadedFilesClick(item.accessoryFile)">
{{$t('viewFile')}}
</span>
<span v-else>
--
</span>
</div>
<a-form-model-item class="itemModel" prop="accessoryFile" v-if="!disabled">
<a-button type="primary" class="button-text"
@click="clickButtonToUpload('accessoryFile',index)">
{{ (item.accessoryFile === 'null' || item.accessoryFile === '' ||
item.accessoryFile == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24" v-if="disabled">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('relevantSections')">{{$t('relevantSections')}}</span>
</div>
<div class="title-text-right" :class="{'title-text-right-text':disabled}" :title="item.relatedSection">
{{item.relatedSection}}
</div>
</div>
</a-col>
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"
:title="$t('problemDescription')">{{$t('problemDescription')}}</span>
</div>
<div class="title-text-right" :class="{'title-text-right-text':disabled}" :title="item.issueOrSuggest">
{{item.issueOrSuggest}}
</div>
</div>
</a-col>
</a-row>
<a-row :gutter="24" v-if="disabled">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('enclosure')">{{$t('enclosure')}}</span>
</div>
<div class="title-text-right">
<span style="color: #21c9cc;cursor: pointer"
v-if="item.accessoryFile" @click="viewUploadedFilesClick(item.accessoryFile)">
{{$t('viewFile')}}
</span>
<span v-else>
--
</span>
</div>
</div>
</a-col>
</a-row>
</div>
<div class="box-text" style="margin-top: 10px" v-if="disabled && $route.query.taskDefinitionKey == 'fqrsc'">
<div class="header-text">
{{$t('sponsorReview')}}
</div>
</div>
<a-row :gutter="24" v-if="disabled && $route.query.taskDefinitionKey == 'fqrsc' && !isTrue">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('reviewComments')">{{$t('reviewComments')}}</span>
</div>
<a-form-model-item class="itemModel" prop="approvalOpinion">
<a-textarea :placeholder="$t('pleaseEnter')+$t('reviewComments')" v-model="formInline.approvalOpinion"
:rows="4"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24" v-if="disabled && $route.query.taskDefinitionKey == 'fqrsc' && isTrue">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('reviewComments')">{{$t('reviewComments')}}</span>
</div>
<div class="title-text-right" :class="{'title-text-right-text':disabled}" :title="formInline.approvalOpinion">
{{formInline.approvalOpinion}}
</div>
</div>
</a-col>
</a-row>
</a-form-model>
</div>
<uploadFile ref="uploadFile" :disabled="disabled" @uploadSuccess="uploadSuccess"></uploadFile>
<viewFileModel ref="viewFileModelRef"/>
</div>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import uploadFile from '@/components/uploadFile/file'
import viewFileModel from '@/components/viewFileModel/index'
export default {
name: 'evaluatorFeedback',
components: {
uploadFile,
viewFileModel
},
props: {
title: {
type: String,
default: ''
},
feedbackDataList: {
type: Array,
default: (() => {
return []
})
},
complianceResult: {
type: Object,
default: {}
}
},
data() {
return {
formInline: {},
rules: {
complianceResult: [
{
required: true,
message: this.$t('complianceResults') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
approvalOpinion: [
{
required: true,
message: this.$t('reviewComments') + this.$t('cannotEmpty'),
trigger: 'blur'
},
{
max: 1000,
message: this.$t('reviewComments') + this.$t('cannotExceed') + 1000 + this.$t('Characters'),
trigger: 'blur'
}
],
relatedSection: [
{
required: true,
message: this.$t('relevantSections') + this.$t('cannotEmpty'),
trigger: 'blur'
},
{
max: 300,
message: this.$t('relevantSections') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
],
issueOrSuggest: [
{
required: true,
message: this.$t('problemDescription') + this.$t('cannotEmpty'),
trigger: 'blur'
},
{
max: 300,
message: this.$t('problemDescription') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
]
},
disabled: false,
uploadIndex: '',
dataList: [],
isTrue:false,
}
},
mounted() {
this.$nextTick(() => {
if (this.feedbackDataList && this.feedbackDataList.length > 0) {
this.formInline.dataList = this.feedbackDataList
} else {
this.formInline.dataList = [
{
relatedSection: '',
issueOrSuggest: '',
reason: '',
accessoryFile: ''
}
]
}
if (this.complianceResult.complianceResult) {
this.formInline.complianceResult = this.complianceResult.complianceResult
}
this.formInline = { ...this.formInline }
})
if (this.$route.query.taskDefinitionKey == 'pgrqr') {
this.disabled = false
if (this.$route.query.isDisabled) {
this.disabled = JSON.parse(this.$route.query.isDisabled)
}
} else {
this.disabled = true
if (this.$route.query.isDisabled) {
this.isTrue = JSON.parse(this.$route.query.isDisabled)
}
}
},
methods: {
clickButtonToUpload(item, index) {
this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true
this.uploadName = item
this.uploadIndex = index
getAction('sys/common/getFileInfos', { id: this.formInline.dataList[this.uploadIndex][this.uploadName] }).then((res) => {
if (res.success) {
this.$refs.uploadFile.perentHandleFunc(res.result)
} else {
this.$refs.uploadFile.perentHandleFunc()
}
})
},
/** 上传文件的回调 */
uploadSuccess(data) {
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline.dataList[this.uploadIndex][this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
viewUploadedFilesClick(item) {
this.$refs.viewFileModelRef.clickButtonToUpload(item)
},
addData() {
this.formInline.dataList.push({
relatedSection: '',
issueOrSuggest: '',
reason: '',
accessoryFile: ''
})
this.formInline = { ...this.formInline }
},
deleteData() {
this.formInline.dataList.pop()
this.formInline = { ...this.formInline }
},
submitData(callBack) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
callBack && callBack(this.formInline)
}
})
},
preservationData(callBack) {
callBack && callBack(this.formInline)
}
}
}
</script>
<style scoped lang="less">
.box {
padding: 0 24px 24px 24px;
box-sizing: border-box;
}
.box-text {
display: flex;
justify-content: space-between;
height: 60px;
line-height: 40px;
.header-text {
font-size: 16px;
font-weight: 400;
color: #000F16;
}
}
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 88px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 48px;
color: #000F16;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 110px);
display: inline-block;
margin-top: 2px;
margin-bottom: 12px;
}
.title-text-right {
display: inline-block;
width: calc(100% - 130px);
padding-top: 12px;
font-size: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #000F16;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.button-text {
height: 38px;
width: calc(100% - 100px);
line-height: 38px;
background: #fff;
border: 1px #00B3BE solid;
color: #00B3BE;
}
.feedbackPoint {
font-size: 16px;
font-weight: 400;
color: #000F16;
margin-bottom: 10px;
}
.icon-size {
font-size: 18px;
margin-left: 8px;
cursor: pointer;
}
.title-text-right-text {
overflow: visible;
white-space: normal;
word-break: break-all;
}
</style>