257 lines
7.7 KiB
Java
257 lines
7.7 KiB
Java
<template>
|
|
<a-modal
|
|
:title="$t('addComparison')"
|
|
:width="700"
|
|
:height="500"
|
|
:visible="visible"
|
|
:confirm-loading="confirmLoading"
|
|
:maskClosable="false"
|
|
@ok="handleOk"
|
|
@cancel="handleCancel"
|
|
>
|
|
<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">
|
|
<span class="title-text-text"
|
|
:title="$t('applicableMarket')">{{$t('applicableMarket')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="applicableMarket">
|
|
<j-dict-select-tag class="box-input" v-model="formInline.applyMarket"
|
|
:disabled="true"
|
|
:placeholder="$t('PleaseSelect')+$t('applicableMarket')"
|
|
:type="'select'"
|
|
:triggerChange="false" :dictCode="'region'"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
<a-row :gutter="24" v-for="(item,index) in formInline.dataList">
|
|
<a-col :span="24">
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('comparisonMarket')+(index+1)">{{$t('comparisonMarket')+(index+1)}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" style="width: calc(100% - 220px)" prop="comparisonMarket">
|
|
<a-select :placeholder="$t('PleaseSelect')+$t('applicableMarket')"
|
|
:disabled="false"
|
|
@change="applyMarketChange"
|
|
v-model="item.applyMarket">
|
|
<a-select-option v-for="(item, key) in item.applyMarketList"
|
|
:key="key"
|
|
:value="item.applyMarket">
|
|
<span style="display: inline-block;width: 100%" :title=" item.applyMarket_dictText ">
|
|
{{ item.applyMarket_dictText}}
|
|
</span>
|
|
</a-select-option>
|
|
</a-select>
|
|
</a-form-model-item>
|
|
|
|
<a-icon class="icon-size"
|
|
style="margin-left: 8px"
|
|
@click="addData"
|
|
v-if="(formInline.dataList.length-1) == index && formInline.dataList.length < 5"
|
|
type="plus-circle"/>
|
|
<a-icon class="icon-size"
|
|
style="margin-left: 8px"
|
|
@click="deleteData"
|
|
v-if="formInline.dataList.length > 1 && (formInline.dataList.length - 1) == index"
|
|
type="minus-circle"/>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form-model>
|
|
</a-modal>
|
|
</template>
|
|
|
|
<script>
|
|
import { getAction, postAction, downloadFile } from '@/api/manage'
|
|
|
|
export default {
|
|
name: 'countryCardViewAd',
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
confirmLoading: false,
|
|
formInline: {},
|
|
applyMarketList: [],
|
|
url: {
|
|
getInfoList: '/problemKnowledgeBase/countryCardManageReleaseEO/list'
|
|
},
|
|
rules: {
|
|
personChargeName: [
|
|
{
|
|
required: true,
|
|
message: this.$t('personCharge') + this.$t('cannotEmpty'),
|
|
trigger: 'change'
|
|
},
|
|
{
|
|
max: 100,
|
|
message: this.$t('personCharge') + this.$t('cannotExceed') + 100 + this.$t('Characters'),
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
problemLabel: [
|
|
{
|
|
required: true,
|
|
message: this.$t('problemLabel') + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
},
|
|
{
|
|
max: 100,
|
|
message: this.$t('problemLabel') + this.$t('cannotExceed') + 100 + this.$t('Characters'),
|
|
trigger: 'blur'
|
|
}
|
|
]
|
|
},
|
|
title: ''
|
|
}
|
|
},
|
|
mounted() {
|
|
},
|
|
methods: {
|
|
add(data) {
|
|
this.visible = true
|
|
console.log(data)
|
|
this.$nextTick(() => {
|
|
this.formInline = {}
|
|
this.formInline.applyMarket = this.$route.query.applyMarket
|
|
if (data && data.length > 0) {
|
|
this.formInline.dataList = JSON.parse(JSON.stringify(data))
|
|
} else {
|
|
this.formInline.dataList = [{
|
|
applyMarket: ''
|
|
}]
|
|
}
|
|
this.getList()
|
|
this.formInline = { ...this.formInline }
|
|
this.$refs.ruleForm.clearValidate()
|
|
})
|
|
},
|
|
PersonnelSelectionChange(value, id) {
|
|
this.formInline[value] = id
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
handleOk() {
|
|
this.$emit('countryCardViewAddForm', JSON.parse(JSON.stringify(this.formInline.dataList)))
|
|
this.visible = false
|
|
},
|
|
handleCancel() {
|
|
this.visible = false
|
|
},
|
|
addData() {
|
|
this.formInline.dataList.push({
|
|
applyMarket: ''
|
|
})
|
|
this.consolidateData()
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
deleteData() {
|
|
this.formInline.dataList.pop()
|
|
this.consolidateData()
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
getList() {
|
|
let query = {
|
|
releaseStatus: 'Have released'
|
|
}
|
|
getAction(this.url.getInfoList, query).then((res) => {
|
|
if (res.success) {
|
|
this.applyMarketList = res.result
|
|
this.consolidateData()
|
|
} else {
|
|
this.applyMarketList = []
|
|
}
|
|
})
|
|
},
|
|
consolidateData() {
|
|
let content = []
|
|
content.push(this.$route.query.applyMarket)
|
|
content = content.join(',')
|
|
this.applyMarketList = this.applyMarketList.filter(res => {
|
|
return !content.includes(res.applyMarket)
|
|
})
|
|
let contentIndex = []
|
|
if (this.formInline.dataList && this.formInline.dataList.length > 0) {
|
|
this.formInline.dataList.forEach(res => {
|
|
contentIndex.push(res.applyMarket)
|
|
res.applyMarketList = []
|
|
this.applyMarketList.forEach(val => {
|
|
res.applyMarketList.push(val)
|
|
})
|
|
})
|
|
}
|
|
contentIndex = contentIndex.join(',')
|
|
for (let i = 0; i < this.formInline.dataList.length; i++) {
|
|
for (let j = 0; j < this.formInline.dataList[i].applyMarketList.length; j++) {
|
|
if (contentIndex.includes(this.formInline.dataList[i].applyMarketList[j].applyMarket)
|
|
&& this.formInline.dataList[i].applyMarket != this.formInline.dataList[i].applyMarketList[j].applyMarket) {
|
|
this.formInline.dataList[i].applyMarketList.splice(j, 1)
|
|
j--
|
|
}
|
|
}
|
|
}
|
|
this.formInline = { ...this.formInline }
|
|
},
|
|
applyMarketChange() {
|
|
this.consolidateData()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
.ant-select-disabled {
|
|
color: rgba(0, 0, 0, 0.65) !important;
|
|
}
|
|
</style>
|
|
<style scoped>
|
|
.box-title-text {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
}
|
|
|
|
.title-text {
|
|
width: 84px;
|
|
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: 42px;
|
|
}
|
|
|
|
.box-input {
|
|
display: inline-block;
|
|
height: 38px;
|
|
width: 100%;
|
|
}
|
|
|
|
.itemModel {
|
|
width: calc(100% - 130px);
|
|
display: inline-block;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.title-text-text {
|
|
margin-top: 9px;
|
|
}
|
|
|
|
.formAdd {
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.Required {
|
|
color: red;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.icon-size {
|
|
font-size: 18px;
|
|
margin-top: 14px;
|
|
}
|
|
</style> |