|
@@ -84,10 +84,17 @@
|
|
|
<div v-else-if="item.children[index+1].dataType==3" style="width:100%">
|
|
|
<el-select v-model="form[item.children[index+1].value]" size="small" multiple filterable collapse-tags placeholder="请选择,可多选" style="width:100%">
|
|
|
<el-option
|
|
|
- v-for="item in item.children[index+1].value=='GJ'?countryList.filter(item=>item.value!='CN'):constants[item.children[index+1].value]"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
+ v-if="item.children[index+1].value=='GJ'"
|
|
|
+ @click.native.stop="selectAll"
|
|
|
+ :label="checked?'取消全选':'全选'"
|
|
|
+ :value="-1">
|
|
|
+ </el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="item1 in item.children[index+1].value=='GJ'?countryList1:constants[item.children[index+1].value]"
|
|
|
+ :key="item1.value"
|
|
|
+ :disabled="item.children[index+1].value=='GJ' && checked"
|
|
|
+ :label="item1.label"
|
|
|
+ :value="item1.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
@@ -153,24 +160,27 @@ export default {
|
|
|
value:3
|
|
|
},
|
|
|
],
|
|
|
+ checked:false,
|
|
|
+ countryList1:[]
|
|
|
}
|
|
|
},
|
|
|
watch:{
|
|
|
DBType(val){
|
|
|
this.dbType = val == 'WD'?'2':'1'
|
|
|
- if(val == 'WD'){
|
|
|
- this.$set(this.form,'GJ',JSON.parse(JSON.stringify(this.selected)))
|
|
|
- }else{
|
|
|
- this.$set(this.form,'GJ',[])
|
|
|
+ this.setGJValue()
|
|
|
+ },
|
|
|
+ 'countryList'(){
|
|
|
+ this.countryList1 = this.countryList.filter(item=>item.value!='CN')
|
|
|
+ },
|
|
|
+ 'selected'(val){
|
|
|
+ if(this.selected){
|
|
|
+ this.setGJValue()
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
- if(this.DBType == 'WD'){
|
|
|
- this.$set(this.form,'GJ',JSON.parse(JSON.stringify(this.selected)))
|
|
|
- }else{
|
|
|
- this.$set(this.form,'GJ',[])
|
|
|
- }
|
|
|
+ this.countryList1 = this.countryList.filter(item=>item.value!='CN')
|
|
|
+ this.setGJValue()
|
|
|
var field=JSON.parse(JSON.stringify(this.$constants.searchField))
|
|
|
this.filedList =[].concat(...field.map(item=>{return item.children}))
|
|
|
if(this.editData && this.editData.component == 'FormSearch'){
|
|
@@ -181,14 +191,28 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ setGJValue(){
|
|
|
+ if(this.DBType == 'WD'){
|
|
|
+ this.$set(this.form,'GJ',JSON.parse(JSON.stringify(this.selected)))
|
|
|
+ if(this.countryList1.length>0){
|
|
|
+ if(this.form.GJ.length == this.countryList1.length){
|
|
|
+ this.checked = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$set(this.form,'GJ',[])
|
|
|
+ }
|
|
|
+ },
|
|
|
selectAll () {
|
|
|
- if (this.form.GJ.length < this.countryList.length) { // 非全选时,点击选择全部
|
|
|
- this.form.GJ = this.countryList.map((item) => {
|
|
|
+ if (this.form.GJ.length < this.countryList1.length) { // 非全选时,点击选择全部
|
|
|
+ this.form.GJ = this.countryList1.map((item) => {
|
|
|
return item.value
|
|
|
})
|
|
|
+ this.checked = true
|
|
|
// this.form.GJ.unshift('-1')
|
|
|
} else { // 全选时,点击置空
|
|
|
this.form.GJ = []
|
|
|
+ this.checked = false
|
|
|
}
|
|
|
},
|
|
|
cancel(){
|
|
@@ -224,7 +248,14 @@ export default {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- }else{
|
|
|
+ }else if(keys[i]=='GJ'){
|
|
|
+ if(this.form[keys[i]].length==1){
|
|
|
+ str1 = str1 + keys[i] + '=(' + this.form[keys[i]][0] +')'
|
|
|
+ }else if(!this.checked){
|
|
|
+ str1 = str1 + keys[i] + '=(' + this.form[keys[i]].join(" OR ") +')'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
// this.form[keys[i]].forEach((item,index)=>{
|
|
|
// if(index<this.form[keys[i]].length-1){
|
|
|
// str1 = str1 + keys[i] + '=' + item + ' AND '
|