修改禅道已知bug
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
<a-select v-else-if="tagType=='select'" :getPopupContainer = "getPopupContainer" :placeholder="placeholder" :disabled="disabled" :value="getValueSting" @change="handleInput">
|
<a-select v-else-if="tagType=='select'" :getPopupContainer = "getPopupContainer" :placeholder="placeholder" :disabled="disabled" :value="getValueSting" @change="handleInput">
|
||||||
<!-- <a-select-option :value="null">{{$t('pleaseSelect')}}</a-select-option>-->
|
<!-- <a-select-option :value="null">{{$t('pleaseSelect')}}</a-select-option>-->
|
||||||
<a-select-option v-for="(item, key) in dictOptionsValue" :key="key" :value="item.value">
|
<a-select-option v-for="(item, key) in dictOptionsValue" :key="key" :value="item.value">
|
||||||
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
|
<span class="itemOption" :title=" item.text || item.label ">
|
||||||
{{ item.text || item.label }}
|
{{ item.text || item.label }}
|
||||||
</span>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
@@ -118,4 +118,12 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.itemOption {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
-o-text-overflow:ellipsis;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-checkbox-group v-if="tagType=='checkbox'" @change="onChange" :value="arrayValue" :disabled="disabled">
|
<a-checkbox-group v-if="tagType=='checkbox'" @change="onChange" :value="arrayValue" :disabled="disabled">
|
||||||
<a-checkbox v-for="(item, key) in dictOptions" :key="key" :value="item.value">{{ item.text || item.label }}</a-checkbox>
|
<a-checkbox v-for="(item, key) in dictOptions" :key="key" :value="item.value">{{ item.text || item.label }}
|
||||||
|
</a-checkbox>
|
||||||
</a-checkbox-group>
|
</a-checkbox-group>
|
||||||
|
|
||||||
<a-select
|
<a-select
|
||||||
@@ -13,14 +14,14 @@
|
|||||||
:maxTagTextLength="2"
|
:maxTagTextLength="2"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:getPopupContainer="getParentContainer"
|
:getPopupContainer="getParentContainer"
|
||||||
:maxTagPlaceholder="content+'...'"
|
:maxTagPlaceholder="content"
|
||||||
optionFilterProp="children"
|
optionFilterProp="children"
|
||||||
:filterOption="filterOption">
|
:filterOption="filterOption">
|
||||||
<a-select-option
|
<a-select-option
|
||||||
v-for="(item,index) in dictOptions"
|
v-for="(item,index) in dictOptions"
|
||||||
:key="index"
|
:key="index"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
<span style="display: inline-block;width: 100%" :title="item.text || item.label">
|
<span class="itemOption" :title="item.text || item.label">
|
||||||
{{ item.text || item.label }}
|
{{ item.text || item.label }}
|
||||||
</span>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
@@ -29,7 +30,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {ajaxGetDictItems,getDictItemsFromCache} from '@/api/api'
|
import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'JMultiSelectTag',
|
name: 'JMultiSelectTag',
|
||||||
props: {
|
props: {
|
||||||
@@ -37,124 +39,124 @@
|
|||||||
placeholder: String,
|
placeholder: String,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
value: String,
|
value: String,
|
||||||
db_field_name:String,
|
db_field_name: String,
|
||||||
type: String,
|
type: String,
|
||||||
options:Array,
|
options: Array,
|
||||||
spliter:{
|
spliter: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: ','
|
default: ','
|
||||||
},
|
},
|
||||||
popContainer:{
|
popContainer: {
|
||||||
type:String,
|
type: String,
|
||||||
default:'',
|
default: '',
|
||||||
required:false
|
required: false
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dictOptions: [],
|
dictOptions: [],
|
||||||
tagType:"",
|
tagType: '',
|
||||||
arrayValue:!this.value?[]:this.value.split(this.spliter),
|
arrayValue: !this.value ? [] : this.value.split(this.spliter),
|
||||||
content:''
|
content: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if(!this.type || this.type==="list_multi"){
|
if (!this.type || this.type === 'list_multi') {
|
||||||
this.tagType = "select"
|
this.tagType = 'select'
|
||||||
}else{
|
} else {
|
||||||
this.tagType = this.type
|
this.tagType = this.type
|
||||||
}
|
}
|
||||||
//获取字典数据
|
//获取字典数据
|
||||||
//this.initDictData();
|
//this.initDictData();
|
||||||
},
|
},
|
||||||
watch:{
|
watch: {
|
||||||
options: function(val){
|
options: function(val) {
|
||||||
this.setCurrentDictOptions(val);
|
this.setCurrentDictOptions(val)
|
||||||
},
|
},
|
||||||
dictCode:{
|
dictCode: {
|
||||||
immediate:true,
|
immediate: true,
|
||||||
handler() {
|
handler() {
|
||||||
this.initDictData()
|
this.initDictData()
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
value (val) {
|
value(val) {
|
||||||
if(!val){
|
if (!val) {
|
||||||
this.arrayValue = []
|
this.arrayValue = []
|
||||||
}else{
|
} else {
|
||||||
this.arrayValue = this.value.split(this.spliter)
|
this.arrayValue = this.value.split(this.spliter)
|
||||||
let arrayValue=JSON.parse(JSON.stringify(this.arrayValue))
|
let arrayValue = JSON.parse(JSON.stringify(this.arrayValue))
|
||||||
let item = []
|
let item = []
|
||||||
this.dictOptions.forEach(res=>{
|
this.dictOptions.forEach(res => {
|
||||||
arrayValue.forEach((val,index)=>{
|
arrayValue.forEach((val, index) => {
|
||||||
if (res.value == val&&index!=0){
|
if (res.value == val && index != 0) {
|
||||||
item.push(res.text || res.label)
|
item.push(res.text || res.label)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
this.content=item.join(',')
|
this.content = item.join(',')
|
||||||
})
|
})
|
||||||
let arrayLabel = []
|
let arrayLabel = []
|
||||||
this.dictOptions.forEach((item) => {
|
this.dictOptions.forEach((item) => {
|
||||||
this.arrayValue.forEach((val) => {
|
this.arrayValue.forEach((val) => {
|
||||||
if(item.value === val) {
|
if (item.value === val) {
|
||||||
arrayLabel.push(item)
|
arrayLabel.push(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.$emit('changelabel', arrayLabel);
|
this.$emit('changelabel', arrayLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initDictData() {
|
initDictData() {
|
||||||
if(this.options && this.options.length>0){
|
if (this.options && this.options.length > 0) {
|
||||||
this.dictOptions = [...this.options]
|
this.dictOptions = [...this.options]
|
||||||
}else{
|
} else {
|
||||||
//优先从缓存中读取字典配置
|
//优先从缓存中读取字典配置
|
||||||
let cacheOption = getDictItemsFromCache(this.dictCode)
|
let cacheOption = getDictItemsFromCache(this.dictCode)
|
||||||
if(cacheOption && cacheOption.length>0){
|
if (cacheOption && cacheOption.length > 0) {
|
||||||
this.dictOptions = cacheOption
|
this.dictOptions = cacheOption
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//根据字典Code, 初始化字典数组
|
//根据字典Code, 初始化字典数组
|
||||||
ajaxGetDictItems(this.dictCode, null).then((res) => {
|
ajaxGetDictItems(this.dictCode, null).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.dictOptions = res.result;
|
this.dictOptions = res.result
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onChange (selectedValue) {
|
onChange(selectedValue) {
|
||||||
let content = []
|
let content = []
|
||||||
let item = []
|
let item = []
|
||||||
this.dictOptions.forEach(res=>{
|
this.dictOptions.forEach(res => {
|
||||||
selectedValue.forEach((val,index)=>{
|
selectedValue.forEach((val, index) => {
|
||||||
if (res.value == val){
|
if (res.value == val) {
|
||||||
content.push(res.text || res.label)
|
content.push(res.text || res.label)
|
||||||
if(index!=0){
|
if (index != 0) {
|
||||||
item.push(res.text || res.label)
|
item.push(res.text || res.label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
this.content=item.join(',')
|
this.content = item.join(',')
|
||||||
})
|
})
|
||||||
this.$emit('change', selectedValue.join(this.spliter));
|
this.$emit('change', selectedValue.join(this.spliter))
|
||||||
this.$emit('changeQuery', content.join(this.spliter),this.db_field_name);
|
this.$emit('changeQuery', content.join(this.spliter), this.db_field_name)
|
||||||
},
|
},
|
||||||
setCurrentDictOptions(dictOptions){
|
setCurrentDictOptions(dictOptions) {
|
||||||
this.dictOptions = dictOptions
|
this.dictOptions = dictOptions
|
||||||
|
|
||||||
},
|
},
|
||||||
getCurrentDictOptions(){
|
getCurrentDictOptions() {
|
||||||
return this.dictOptions
|
return this.dictOptions
|
||||||
},
|
},
|
||||||
getParentContainer(node){
|
getParentContainer(node) {
|
||||||
if(!this.popContainer){
|
if (!this.popContainer) {
|
||||||
return node.parentNode
|
return node.parentNode
|
||||||
}else{
|
} else {
|
||||||
return document.querySelector(this.popContainer)
|
return document.querySelector(this.popContainer)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -170,8 +172,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.itemOption {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
-o-text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<style>
|
<style>
|
||||||
.ant-select-selection__choice{
|
/*.ant-select-selection__choice{*/
|
||||||
max-width: 50% !important;
|
/* max-width: 50% !important;*/
|
||||||
|
/*}*/
|
||||||
|
.ant-select-selection--multiple {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-select-selection__rendered ul {
|
||||||
|
word-break: break-all;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
float: left;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user