303 lines
9.8 KiB
Java
303 lines
9.8 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">
|
|
<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">
|
|
<a-col :span="12">
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="Required">*</span>
|
|
<span class="title-text-text" :title="$t('relevantSections')">{{$t('relevantSections')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel"
|
|
: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="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="title-text-text" :title="$t('enclosure')">{{$t('enclosure')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="accessoryFile">
|
|
<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">
|
|
<a-col :span="12">
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="Required">*</span>
|
|
<span class="title-text-text"
|
|
:title="$t('questionsSuggestions')">{{$t('questionsSuggestions')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" :prop="'dataList.'+index+'.issueOrSuggest'"
|
|
:rules="[{ required: true, message: $t('questionsSuggestions') + $t('cannotEmpty'), trigger: 'blur'},
|
|
{max: 300,message: $t('questionsSuggestions') + $t('cannotExceed') + 300 + $t('Characters'),trigger: 'blur'
|
|
}]">
|
|
<a-textarea :placeholder="$t('PleaseEnter')+$t('questionsSuggestions')"
|
|
:disabled="disabled"
|
|
v-model="item.issueOrSuggest" :rows="4"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
<a-col :span="12">
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="Required">*</span>
|
|
<span class="title-text-text" :title="$t('reason')">{{$t('reason')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel"
|
|
:prop="'dataList.'+index+'.reason'"
|
|
:rules="[
|
|
{ required: true, message: $t('reason') + $t('cannotEmpty'), trigger: 'blur'},
|
|
{max: 300,message: $t('reason') + $t('cannotExceed') + 300 + $t('Characters'),trigger: 'blur'
|
|
}]">
|
|
<a-textarea :placeholder="$t('PleaseEnter')+$t('reason')"
|
|
:disabled="disabled"
|
|
v-model="item.reason" :rows="4"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
<a-row :gutter="24">
|
|
<a-col :span="12">
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('clauseContent')">{{$t('clauseContent')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel"
|
|
:prop="'dataList.'+index+'.clauseContent'"
|
|
:rules="[
|
|
{max: 300,message: $t('clauseContent') + $t('cannotExceed') + 300 + $t('Characters'),trigger: 'blur'
|
|
}]">
|
|
<a-textarea :placeholder="$t('PleaseEnter')+$t('clauseContent')"
|
|
:disabled="disabled"
|
|
v-model="item.clauseContent" :rows="4"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
</div>
|
|
</a-form-model>
|
|
</div>
|
|
<uploadFile ref="uploadFile" :disabled="disabled" @uploadSuccess="uploadSuccess"></uploadFile>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getAction, postAction } from '@/api/manage'
|
|
import uploadFile from '@/components/uploadFile/file'
|
|
|
|
export default {
|
|
name: 'feedbackInformation',
|
|
components: {
|
|
uploadFile
|
|
},
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
feedbackDataList: {
|
|
type: Array,
|
|
default: (() => {
|
|
return []
|
|
})
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
formInline: {},
|
|
disabled: false,
|
|
rules: {},
|
|
uploadIndex: '',
|
|
dataList: []
|
|
}
|
|
},
|
|
mounted() {
|
|
this.$nextTick(() => {
|
|
if (this.feedbackDataList && this.feedbackDataList.length > 0) {
|
|
this.formInline.dataList = this.feedbackDataList
|
|
this.formInline = { ...this.formInline }
|
|
} else {
|
|
this.formInline.dataList = [
|
|
{
|
|
relatedSection: '',
|
|
issueOrSuggest: '',
|
|
reason: '',
|
|
accessoryFile: ''
|
|
}
|
|
]
|
|
}
|
|
this.formInline = { ...this.formInline }
|
|
})
|
|
if (this.$route.query.isDisabled) {
|
|
this.disabled = 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 }
|
|
},
|
|
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.dataList)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</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% - 130px);
|
|
display: inline-block;
|
|
margin-top: 2px;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.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: 14px;
|
|
font-weight: 400;
|
|
color: #000F16;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.icon-size {
|
|
font-size: 18px;
|
|
margin-left: 8px;
|
|
cursor: pointer;
|
|
}
|
|
</style> |