428 lines
14 KiB
Java
428 lines
14 KiB
Java
<template>
|
|
<div>
|
|
<a-drawer
|
|
:title="title"
|
|
:maskClosable="false"
|
|
:width="900"
|
|
placement="right"
|
|
:closable="true"
|
|
@close="handleCancel"
|
|
:visible="visible"
|
|
style="height: 100%;overflow: auto;padding-bottom: 53px;">
|
|
<a-spin :spinning="confirmLoading">
|
|
<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('regulationNo')">{{$t('regulationNo')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="serialNumber">
|
|
<a-input @click.native="serialNumberClick"
|
|
:disabled="disabled"
|
|
class="box-input"
|
|
:title="formInline.serialNumber"
|
|
:placeholder="$t('PleaseSelect')+$t('regulationNo')"
|
|
v-model="formInline.serialNumber"></a-input>
|
|
</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('areaOfResponsibility')">{{$t('areaOfResponsibility')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="dutyTerritory">
|
|
<j-dict-select-tag class="box-input"
|
|
v-model="formInline.dutyTerritory"
|
|
:disabled="disabled"
|
|
:placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
|
|
:type="'select'"
|
|
:triggerChange="false" :dictCode="'duty_territory'"/>
|
|
</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" v-if="!disabled">*</span>
|
|
<span class="title-text-text" :title="'WVTA ID'">WVTA ID</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="wvtaId">
|
|
<a-input class="box-input"
|
|
:disabled="disabled"
|
|
:title="formInline.wvtaId"
|
|
v-model="formInline.wvtaId"
|
|
:placeholder="$t('PleaseEnter')+'WVTA ID'"/>
|
|
</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" v-if="!disabled">*</span>
|
|
<span class="title-text-text" :title="$t('category')">{{$t('category')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="category">
|
|
<a-input class="box-input"
|
|
v-model="formInline.category"
|
|
:disabled="disabled"
|
|
:title="formInline.category"
|
|
:placeholder="$t('PleaseEnter')+$t('category')" />
|
|
</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('inspectionItems')">{{$t('inspectionItems')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="inspectionItem">
|
|
<a-input class="box-input"
|
|
v-model="formInline.inspectionItem"
|
|
:disabled="disabled"
|
|
:title="formInline.inspectionItem"
|
|
:placeholder="$t('PleaseEnter')+$t('inspectionItems')"/>
|
|
</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" v-if="!disabled">*</span>
|
|
<span class="title-text-text" :title="$t('configurationItem')">{{$t('configurationItem')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="configItem">
|
|
<a-input class="box-input"
|
|
v-model="formInline.configItem"
|
|
:title="formInline.configItem"
|
|
:placeholder="$t('PleaseEnter')+$t('configurationItem')"
|
|
:disabled="disabled"
|
|
/>
|
|
</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('typeOfDeliverables')">{{$t('typeOfDeliverables')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel"
|
|
prop="deliverableType"
|
|
:rules="[{ required: true, message: $t('typeOfDeliverables') + $t('cannotEmpty'), trigger: 'change'},]"
|
|
>
|
|
<a-tree-select
|
|
tree-node-filter-prop="title"
|
|
v-model="formInline.deliverableType"
|
|
:maxTagCount="1"
|
|
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
|
class="box-input"
|
|
style="width: 100%"
|
|
:tree-data="DeliverableTreeList"
|
|
:placeholder="$t('PleaseSelect')+$t('typeOfDeliverables')"
|
|
:disabled="disabled"
|
|
/>
|
|
</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('deliverableTemplate')">{{$t('deliverableTemplate')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="deliverableTemplate">
|
|
<a-button type="primary" class="button-text"
|
|
@click="clickButtonToUpload('deliverableTemplate')"
|
|
>
|
|
{{ (formInline.deliverableTemplate === 'null' || formInline.deliverableTemplate === ''
|
|
||
|
|
formInline.deliverableTemplate == null) ? $t('clickUpload') : $t('viewUploadedFiles')
|
|
}}
|
|
</a-button>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form-model>
|
|
</a-spin>
|
|
<div class="drawer-bootom-button" v-if="button">
|
|
<a-button style="margin-right: .8rem" @click="handleCancel">{{$t('cancel')}}</a-button>
|
|
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
|
|
</div>
|
|
</a-drawer>
|
|
<codeNumber ref="codeNumber" @regulation="regulation" />
|
|
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess" :disabled="disabled"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
|
|
import codeNumber from './codeNumber'
|
|
import uploadFile from '@/components/uploadFile/file'
|
|
|
|
export default {
|
|
name:'editModel',
|
|
props: ['url'],
|
|
components:{
|
|
codeNumber,
|
|
uploadFile
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
visible: false,
|
|
button: true,
|
|
confirmLoading: false,
|
|
formInline: {},
|
|
disabled: false,
|
|
DeliverableTreeList: [],
|
|
rules: {
|
|
serialNumber: [
|
|
{
|
|
required: true,
|
|
message: this.$t('regulationNo') + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
dutyTerritory: [
|
|
{
|
|
required: true,
|
|
message: this.$t('areaOfResponsibility') + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
wvtaId: [
|
|
{
|
|
required: true,
|
|
message: 'WVTA ID' + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
category: [
|
|
{
|
|
required: true,
|
|
message: this.$t('category') + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
inspectionItem: [
|
|
{
|
|
required: true,
|
|
message: this.$t('inspectionItems') + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
configItem: [
|
|
{
|
|
required: true,
|
|
message: this.$t('configurationItem') + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
},
|
|
{
|
|
max: 300,
|
|
message: this.$t('configurationItem') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
|
|
trigger: 'blur'
|
|
}
|
|
],
|
|
deliverable: [
|
|
{
|
|
required: true,
|
|
message: this.$t('Deliverables') + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getDeliverableTree()
|
|
},
|
|
methods: {
|
|
handleCancel() {
|
|
this.visible = false
|
|
},
|
|
serialNumberClick(){
|
|
this.$refs.codeNumber.add()
|
|
},
|
|
editModel(item,data) {
|
|
this.visible = true
|
|
this.title = this.$t('edit')
|
|
this.$nextTick(() => {
|
|
this.formInline = item || {}
|
|
if (this.formInline.deliverableType) {
|
|
this.formInline.deliverableType = this.formInline.deliverableType.split(',')
|
|
}
|
|
this.$refs.ruleForm.clearValidate()
|
|
})
|
|
if(data == 1) {
|
|
this.title = this.$t('view')
|
|
this.disabled = true
|
|
this.button = false
|
|
}
|
|
},
|
|
handleSubmit() {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
let formInline = JSON.parse(JSON.stringify(this.formInline))
|
|
Object.keys(formInline).forEach(res => {
|
|
if (formInline[res] && formInline[res] instanceof Array) {
|
|
formInline[res] = formInline[res].join(',')
|
|
}
|
|
})
|
|
this.confirmLoading = true
|
|
postAction(this.url.editModel, formInline).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
this.visible = false
|
|
this.confirmLoading = false
|
|
this.$emit('editModelList')
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
this.confirmLoading = false
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
this.confirmLoading = false
|
|
}
|
|
})
|
|
},
|
|
getDeliverableTree() {
|
|
getAction('/sys/category/getCertificationDeliverableTree', {}).then((res) => {
|
|
if (res.success) {
|
|
this.DeliverableTreeList = res.result
|
|
} else {
|
|
this.DeliverableTreeList = []
|
|
}
|
|
})
|
|
},
|
|
regulation(item,data) {
|
|
this.formInline.serialNumber = item
|
|
this.formInline.bussDocumentLibraryId = data
|
|
this.$nextTick(()=>{
|
|
this.formInline = {... this.formInline}
|
|
this.$refs.ruleForm.validateField(['serialNumber'])
|
|
})
|
|
},
|
|
//交付物模板
|
|
clickButtonToUpload(item, index,isTrue) {
|
|
this.numIndex = index
|
|
this.$refs.uploadFile.perentHandleFunc()
|
|
this.$refs.uploadFile.visible = true
|
|
this.uploadName = item
|
|
let ids = ''
|
|
console.log(index)
|
|
if (isTrue){
|
|
ids = this.formInline.dataList[index][item]
|
|
}else{
|
|
ids = this.formInline[item]
|
|
}
|
|
getAction('sys/common/getFileInfos', { id: ids }).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)
|
|
})
|
|
}
|
|
/** 赋值给当前对应的表单文件 */
|
|
if (this.formInline.id) {
|
|
this.formInline[this.uploadName] = attIdList.join(',')
|
|
} else {
|
|
this.formInline.dataList[this.numIndex][this.uploadName] = attIdList.join(',')
|
|
}
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.box-title-text {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
/*align-items: center;*/
|
|
}
|
|
|
|
.title-text {
|
|
width: 114px;
|
|
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;
|
|
}
|
|
|
|
.box-input {
|
|
display: inline-block;
|
|
height: 38px;
|
|
width: 100%;
|
|
}
|
|
|
|
.itemModel {
|
|
width: calc(100% - 130px);
|
|
display: inline-block;
|
|
margin-top: 2px;
|
|
height: 40px;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.Required {
|
|
color: red;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.drawer-bootom-button {
|
|
position: absolute;
|
|
bottom: 0;
|
|
width: 100%;
|
|
z-index: 100;
|
|
border-top: 1px solid #e8e8e8;
|
|
padding: 10px 16px;
|
|
text-align: right;
|
|
left: 0;
|
|
background: #fff;
|
|
border-radius: 0 0 2px 2px;
|
|
}
|
|
|
|
.button-text {
|
|
height: 38px;
|
|
width: calc(100% - 100px);
|
|
line-height: 38px;
|
|
background: #fff;
|
|
border: 1px #00B3BE solid;
|
|
color: #00B3BE;
|
|
}
|
|
::v-deep .ant-input-disabled{
|
|
color: #040B29;
|
|
}
|
|
::v-deep .ant-select-disabled .ant-select-selection-selected-value{
|
|
color: #040B29!important;
|
|
}
|
|
</style> |