433 lines
13 KiB
Java
433 lines
13 KiB
Java
<!--常规导出-->
|
||
<template>
|
||
<div>
|
||
<a-modal
|
||
:title="title"
|
||
:maskClosable="false"
|
||
:width="750"
|
||
placement="right"
|
||
:closable="true"
|
||
@cancel="handleCancel"
|
||
:visible="visible"
|
||
style="height: 100%;overflow: auto;padding-bottom: 53px;">
|
||
<a-spin :spinning="confirmLoading">
|
||
<a-form>
|
||
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
|
||
<a-row :gutter="24">
|
||
<a-col :span="24">
|
||
<div class="box-title-text">
|
||
<div class="title-text" :title="$t('certificationCategory')">
|
||
<span class="Required">*</span>
|
||
<span>{{$t('certificationCategory')}}</span>
|
||
</div>
|
||
<a-form-model-item class="itemModel" prop="certCategory">
|
||
<j-dict-select-tag class="box-input" v-model="formInline.certCategory"
|
||
:placeholder="$t('PleaseSelect')+$t('certificationCategory')"
|
||
:type="'select'"
|
||
@input="certCategoryName"
|
||
:triggerChange="false" :dictCode="'cert_category'"/>
|
||
</a-form-model-item>
|
||
|
||
</div>
|
||
</a-col>
|
||
|
||
</a-row>
|
||
<a-row :gutter="24">
|
||
<a-col :span="24">
|
||
<div class="box-title-text">
|
||
<div class="title-text" :title="$t('configure')">
|
||
<span class="Required">*</span>
|
||
<span>{{$t('configure')}}</span>
|
||
</div>
|
||
<a-form-model-item class="itemModel" prop="configIds">
|
||
<!-- <j-multi-select-tag class="box-input" v-model="formInline.configIds"-->
|
||
<!-- :options="dictOptions"-->
|
||
<!-- :placeholder="$t('PleaseSelect')+$t('configure')"-->
|
||
<!-- :type="'select'"-->
|
||
<!-- :triggerChange="false"/>-->
|
||
<a-select v-model="formInline.configIds" class="box-input" mode='multiple' :placeholder="$t('PleaseSelect')+$t('configure')">
|
||
<a-select-option
|
||
v-for="mode in dictOptions"
|
||
:key="mode.value"
|
||
:value="mode.value">
|
||
{{ mode.label }}
|
||
</a-select-option>
|
||
</a-select>
|
||
</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('WhetherMergeParameters')">{{$t('WhetherMergeParameters')}}</span>
|
||
</div>
|
||
<a-form-model-item class="itemModel" prop="combineFlag">
|
||
<a-radio-group style="margin-top: 2px" @change="flagChange" defaultValue='1' class="box-input" v-model="formInline.combineFlag">
|
||
<a-radio value="1">
|
||
{{$t('nonjoinder')}}
|
||
</a-radio>
|
||
<a-radio value="2">
|
||
{{$t('merge')}}
|
||
</a-radio>
|
||
</a-radio-group>
|
||
</a-form-model-item>
|
||
</div>
|
||
</a-col>
|
||
</a-row>
|
||
<a-row :gutter="24" v-if='!required'>
|
||
<a-col :span="24">
|
||
<div class="box-title-text">
|
||
<div class="title-text">
|
||
<span class="Required" >*</span>
|
||
<span class="title-text-text"
|
||
:title="$t('MergeSeparator')">{{$t('MergeSeparator')}}</span>
|
||
</div>
|
||
<a-form-model-item class="itemModel" prop="separator">
|
||
<!-- :disabled="disabled"-->
|
||
<a-input class="box-input"
|
||
v-model="formInline.separator"
|
||
:placeholder="$t('PleaseEnter')+$t('MergeSeparator')"/>
|
||
</a-form-model-item>
|
||
</div>
|
||
</a-col>
|
||
</a-row>
|
||
</a-form-model>
|
||
</a-form>
|
||
</a-spin>
|
||
<div class="drawer-bootom-button">
|
||
<a-button style="margin-right: .8rem" @click="handleCancel">{{$t('cancel')}}</a-button>
|
||
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('export')}}</a-button>
|
||
</div>
|
||
</a-modal>
|
||
<uploadFileChange ref="uploadFile" :accept="'.doc,.doxc,.xls,.xlsx'" @uploadSuccess="uploadSuccess"></uploadFileChange>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import PersonnelSelection from '@/components/PersonnelSelection/index'
|
||
import { getAction, postAction, downloadFile, putAction } from '@/api/manage'
|
||
import uploadFileChange from '@/components/uploadFileChange/file'
|
||
|
||
export default {
|
||
name: 'addModel',
|
||
components: {
|
||
uploadFileChange,
|
||
PersonnelSelection
|
||
},
|
||
props: ['url'],
|
||
data() {
|
||
return {
|
||
formInline: {
|
||
},
|
||
confirmLoading: false,
|
||
description:false,
|
||
dictOptions:[],
|
||
visible: false,
|
||
required:false,
|
||
disabled:false,
|
||
rules: {
|
||
separator:[
|
||
{ required: true, message: this.$t('PleaseEnter')+this.$t('MergeSeparator'), trigger: 'change' },
|
||
{
|
||
pattern: /[`~!@$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]/,
|
||
message: this.$t('punctuationmark'),
|
||
trigger: 'blur'
|
||
}
|
||
],
|
||
certCategory:[
|
||
{ required: true, message: this.$t('PleaseEnter')+this.$t('certificationCategory'), trigger: 'change' },
|
||
// { min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('MergeSeparator'), trigger: 'blur' },
|
||
],
|
||
combineFlag:[
|
||
{ required: true, message: this.$t('PleaseSelect')+this.$t('WhetherMergeParameters'), trigger: 'change' },
|
||
// { min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('MergeSeparator'), trigger: 'blur' },
|
||
],
|
||
configIds:[
|
||
{ required: true, message: this.$t('PleaseSelect')+this.$t('configure'), trigger: 'change' },
|
||
// { min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('MergeSeparator'), trigger: 'blur' },
|
||
],
|
||
description:[
|
||
{ min:1, max: 200, message: this.$t('cantExeed')+'200'+this.$t('characters'), trigger: 'blur' },
|
||
],
|
||
status: [
|
||
{ required: true, message: this.$t('PleaseSelect')+this.$t('status'), trigger: 'change' },
|
||
],
|
||
fileConnectId: [
|
||
{ required: true, message: this.$t('PleaseSelect')+this.$t('attachmentTemplate'), trigger: 'change' },
|
||
],
|
||
},
|
||
projectNameList: [],
|
||
title: ''
|
||
}
|
||
},
|
||
mounted() {
|
||
this.getNameList()
|
||
if(this.formInline.combineFlag == '1'){
|
||
this.required = false
|
||
}else{
|
||
this.required = true
|
||
}
|
||
},
|
||
methods: {
|
||
uploadSuccess(data) {
|
||
let attIdList = []
|
||
if (data && data.length > 0) {
|
||
data.map(item => {
|
||
attIdList.push(item.id || data.name)
|
||
})
|
||
}
|
||
this.$refs.uploadFile.visible = false
|
||
/** 赋值给当前对应的表单文件 */
|
||
this.formInline.fileConnectId = attIdList.join(',')
|
||
this.formInline = { ...this.formInline }
|
||
},
|
||
clickButtonToUpload(item) {
|
||
this.$refs.uploadFile.visible = true
|
||
getAction('sys/common/getFileInfos', { id: this.formInline.fileConnectId }).then((res) => {
|
||
if (res.success) {
|
||
this.$refs.uploadFile.perentHandleFunc(res.result)
|
||
} else {
|
||
this.$refs.uploadFile.perentHandleFunc()
|
||
}
|
||
})
|
||
},
|
||
flagChange(value){
|
||
console.log(value.target.value)
|
||
if(value.target.value == 2){
|
||
this.required = false
|
||
}else{
|
||
this.required = true
|
||
}
|
||
},
|
||
getNameList() {
|
||
getAction('project/projectNameInfoEO/list', {}).then((res) => {
|
||
if (res.success) {
|
||
this.projectNameList = res.result || []
|
||
} else {
|
||
this.projectNameList = []
|
||
}
|
||
})
|
||
},
|
||
addModel() {
|
||
this.visible = true
|
||
this.title = this.$t('ConventionalExport')
|
||
this.formInline = {}
|
||
this.formInline.separator = ','
|
||
this.formInline = {...this.formInline}
|
||
this.getConfigure()
|
||
this.$nextTick(() => {
|
||
this.$refs['ruleForm'].clearValidate()
|
||
})
|
||
},
|
||
getConfigure(){
|
||
let pram = {
|
||
paramsManifestId: this.$route.query.id
|
||
}
|
||
getAction('report/detail/getConfigLabelList', pram).then((res) => {
|
||
if (res.success) {
|
||
console.log(res.result)
|
||
this.dictOptions = res.result
|
||
} else {
|
||
// this.$refs.uploadFile.perentHandleFunc()
|
||
}
|
||
})
|
||
},
|
||
editModel(value) {
|
||
this.visible = true
|
||
this.title = '编辑'
|
||
this.$nextTick(() => {
|
||
this.formInline = value
|
||
})
|
||
},
|
||
handleCancel() {
|
||
this.visible = false
|
||
this.required = false
|
||
this.$refs.ruleForm.resetFields()
|
||
},
|
||
certCategoryName(value){
|
||
getAction('sys/dict/getDictItems/cert_category', { }).then((res) => {
|
||
if (res.success) {
|
||
let tt = ''
|
||
let tten = ''
|
||
res.result.forEach((item) => {
|
||
if(item.value == value){
|
||
tt=item.title
|
||
tten=item.textEn
|
||
}
|
||
})
|
||
let long = localStorage.getItem('language')
|
||
this.cut = ''
|
||
if (long && long === 'zh-cn') {
|
||
this.contentListStart = tt
|
||
} else if (long && long === 'en-us') {
|
||
this.contentListStart = tten
|
||
}
|
||
}
|
||
})
|
||
console.log(value)
|
||
},
|
||
handleSubmit() {
|
||
this.$refs.ruleForm.validate(valid => {
|
||
if (valid) {
|
||
let url = this.url.ConventionalExport
|
||
let Action = getAction
|
||
let query = JSON.parse(JSON.stringify(this.formInline))
|
||
Object.keys(query).forEach(res => {
|
||
if (query[res] && query[res] instanceof Array) {
|
||
query[res] = query[res].join(',')
|
||
}
|
||
})
|
||
if(this.contentListStart){
|
||
query.certCategoryName = this.contentListStart
|
||
}
|
||
query.paramsManifestId = this.$route.query.id
|
||
let long = localStorage.getItem('language')
|
||
if (long && long === 'zh-cn') {
|
||
query.exportName = '常规导出'
|
||
} else if (long && long === 'en-us') {
|
||
query.exportName = 'normal'
|
||
}
|
||
this.confirmLoading = true
|
||
downloadFile('report/detail/exportNormal', query.exportName+'.zip', query)
|
||
this.confirmLoading = false
|
||
}
|
||
})
|
||
},
|
||
handleInput(value) {
|
||
this.$nextTick(() => {
|
||
this.formInline = { ...this.formInline }
|
||
this.$refs.ruleForm.validateField([value])
|
||
})
|
||
},
|
||
PersonnelSelectionChange(value, id) {
|
||
this.formInline[value] = id
|
||
this.formInline = { ...this.formInline }
|
||
},
|
||
projectNameChange(value){
|
||
console.log(value)
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
<style>
|
||
.formAdd .ant-form-item-label {
|
||
width: 130px;
|
||
}
|
||
|
||
.formAdd .ant-form-item-control-wrapper {
|
||
display: inline-block;
|
||
width: 100%;
|
||
}
|
||
|
||
/*.formAdd .ant-form-item {*/
|
||
/* margin-bottom: 20px;*/
|
||
/*}*/
|
||
|
||
.itemModel .ant-form-item-control-wrapper {
|
||
width: 100%;
|
||
}
|
||
|
||
.box-input .ant-select-selection--single {
|
||
height: 38px;
|
||
}
|
||
|
||
.box-input .ant-select-selection--multiple {
|
||
height: 38px;
|
||
}
|
||
|
||
.box-input .ant-select-selection__rendered {
|
||
line-height: 38px;
|
||
height: 38px;
|
||
}
|
||
|
||
.box-input .ant-select-selection--multiple .ant-select-selection__rendered > ul > li {
|
||
margin-top: 6px;
|
||
}
|
||
|
||
.box-input .ant-calendar-picker {
|
||
line-height: 38px;
|
||
height: 38px;
|
||
}
|
||
|
||
.box-input .ant-calendar-picker-input {
|
||
height: 38px;
|
||
}
|
||
|
||
.box-input .ant-input-number-input-wrap {
|
||
line-height: 38px;
|
||
height: 38px;
|
||
}
|
||
</style>
|
||
<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;
|
||
}
|
||
|
||
.Required {
|
||
color: red;
|
||
margin-right: 4px;
|
||
}
|
||
|
||
.title-text-text {
|
||
margin-top: 9px;
|
||
}
|
||
|
||
|
||
.formAdd {
|
||
margin-bottom: 40px;
|
||
}
|
||
|
||
|
||
.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;
|
||
}
|
||
/deep/.add-input{
|
||
min-height: 135px!important;
|
||
}
|
||
</style>
|
||
<style>
|
||
.ant-input-disabled {
|
||
color: rgba(0, 0, 0, 0.65) !important;
|
||
}
|
||
</style> |