【update】-来款企业可以多选查询
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:pagination="ipagination"
|
:pagination="ipagination"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: isMultiple ? 'checkbox' : 'radio'}"
|
||||||
@change="handleTableChange"
|
@change="handleTableChange"
|
||||||
class="j-table-force-nowrap">
|
class="j-table-force-nowrap">
|
||||||
<template slot="htmlSlot" slot-scope="text">
|
<template slot="htmlSlot" slot-scope="text">
|
||||||
@@ -71,6 +71,12 @@ export default {
|
|||||||
memberNature: {
|
memberNature: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null
|
default: null
|
||||||
|
},
|
||||||
|
// 是否多选-默认false
|
||||||
|
isMultiple: {
|
||||||
|
type:Boolean,
|
||||||
|
required:false,
|
||||||
|
default:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -134,7 +140,6 @@ export default {
|
|||||||
if (res.result.total) {
|
if (res.result.total) {
|
||||||
this.ipagination.total = res.result.total
|
this.ipagination.total = res.result.total
|
||||||
//清空列表选中
|
//清空列表选中
|
||||||
this.onClearSelected()
|
|
||||||
} else {
|
} else {
|
||||||
this.ipagination.total = 0
|
this.ipagination.total = 0
|
||||||
}
|
}
|
||||||
@@ -158,10 +163,29 @@ export default {
|
|||||||
close() {
|
close() {
|
||||||
this.visible = false
|
this.visible = false
|
||||||
this.selectedCompany = {}
|
this.selectedCompany = {}
|
||||||
|
if (this.isMultiple) {
|
||||||
|
this.selectedCompany = []
|
||||||
|
}
|
||||||
|
this.onClearSelected()
|
||||||
},
|
},
|
||||||
onSelectChange(selectedRowKeys, selectionRows) {
|
onSelectChange(selectedRowKeys, selectionRows) {
|
||||||
this.selectedCompany = selectionRows[0]
|
console.log('---this.selectedCompany----', selectedRowKeys, selectionRows)
|
||||||
|
if(!this.isMultiple) {
|
||||||
|
this.selectedCompany = selectionRows[0]
|
||||||
|
} else {
|
||||||
|
// selectionRows只会返回当前页数据的返回,所以多选的时候需要比对各个数据是否存在,不存在的话就从当前数据中查询推入selectedCompany中
|
||||||
|
let resultArr = []
|
||||||
|
selectionRows.forEach(row => {
|
||||||
|
let ele = this.selectedCompany.find(ele => ele.id === row.id)
|
||||||
|
if(!ele) {
|
||||||
|
resultArr.push(row)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.selectedCompany = [...this.selectedCompany, ...resultArr]
|
||||||
|
// this.selectedCompany = selectionRows
|
||||||
|
}
|
||||||
this.selectedRowKeys = selectedRowKeys
|
this.selectedRowKeys = selectedRowKeys
|
||||||
|
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
* 重写一下查询 之前调用的是混入的查询
|
* 重写一下查询 之前调用的是混入的查询
|
||||||
@@ -175,6 +199,11 @@ export default {
|
|||||||
this.queryParam = {}
|
this.queryParam = {}
|
||||||
this.loadData(1)
|
this.loadData(1)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (this.isMultiple) {
|
||||||
|
this.selectedCompany = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
<div class="company-select">
|
<div class="company-select">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="20">
|
<a-col :span="20">
|
||||||
<a-input @click="chooseBusiness" :value="value[valueKey]" v-bind="$attrs" :readOnly="true" unselectable="on"></a-input>
|
<a-input @click="chooseBusiness" :title="value[valueKey]" :value="value[valueKey]" v-bind="$attrs" :readOnly="true" unselectable="on"></a-input>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="4" class="form-btn" v-if="canAdd">
|
<a-col :span="4" class="form-btn" v-if="canAdd">
|
||||||
<a-button v-bind="$attrs" icon="plus" @click="addCompany"></a-button>
|
<a-button v-bind="$attrs" icon="plus" @click="addCompany"></a-button>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<business-select ref="businessSelect" @ok="handleOk" v-bind="$attrs"></business-select>
|
<business-select ref="businessSelect" @ok="handleOk" v-bind="$attrs" :is-multiple="isMultiple"></business-select>
|
||||||
<business-management-module ref="businessAdd" @ok="addCompanyOk"></business-management-module>
|
<business-management-module ref="businessAdd" @ok="addCompanyOk"></business-management-module>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -50,6 +50,12 @@ export default {
|
|||||||
type:Boolean,
|
type:Boolean,
|
||||||
required:false,
|
required:false,
|
||||||
default:false
|
default:false
|
||||||
|
},
|
||||||
|
// 是否多选-默认false
|
||||||
|
isMultiple: {
|
||||||
|
type:Boolean,
|
||||||
|
required:false,
|
||||||
|
default:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -71,9 +77,22 @@ export default {
|
|||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
handleOk(value) {
|
handleOk(value) {
|
||||||
let company = {
|
console.log('--------value---------', 'value')
|
||||||
id: value.id,
|
let company = {id: undefined, companyName: undefined}
|
||||||
companyName: value.companyName
|
// 多选的时候 全部放在一起,以逗号分隔
|
||||||
|
if (this.isMultiple) {
|
||||||
|
if(value.length > 0) {
|
||||||
|
let ids = [], nameArr = []
|
||||||
|
value.forEach(item => {
|
||||||
|
ids.push(item.id)
|
||||||
|
nameArr.push(item.companyName)
|
||||||
|
})
|
||||||
|
company.id = ids.join()
|
||||||
|
company.companyName= nameArr.join()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
company.id = value.id
|
||||||
|
company.companyName= value.companyName
|
||||||
}
|
}
|
||||||
this.$emit('change', company)
|
this.$emit('change', company)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,9 +13,13 @@
|
|||||||
<a-row v-if="defaultChargeWay">
|
<a-row v-if="defaultChargeWay">
|
||||||
<a-col>
|
<a-col>
|
||||||
<a-form-item label="工作组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
<a-form-item label="工作组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||||
<a-select placeholder="请选择工作组项目"
|
<a-select
|
||||||
v-decorator="['workingGroupId',validatorRules.workingGroupId]"
|
placeholder="请选择工作组项目"
|
||||||
:maxLength='50'>
|
show-search
|
||||||
|
v-decorator="['workingGroupId',validatorRules.workingGroupId]"
|
||||||
|
:maxLength='50'
|
||||||
|
:filter-option="filterOption"
|
||||||
|
>
|
||||||
<a-select-option v-for="item in workingGroupList" :key="item.id" :value="item.id">
|
<a-select-option v-for="item in workingGroupList" :key="item.id" :value="item.id">
|
||||||
{{ item.workingGroupProject }}
|
{{ item.workingGroupProject }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
@@ -971,7 +975,13 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
|
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
// 下拉框的搜索
|
||||||
|
filterOption(input, option) {
|
||||||
|
return (
|
||||||
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||||
|
)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
<a-row>
|
<a-row>
|
||||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
<a-form-item label="来款企业" :labelCol="labelCol" :wrapperCol="wrapperCol" style="margin-bottom: -1px">
|
<a-form-item label="来款企业" :labelCol="labelCol" :wrapperCol="wrapperCol" style="margin-bottom: -1px">
|
||||||
<company-select :can-add="false" placeholder="请选择来款企业"
|
<company-select isMultiple :can-add="false" placeholder="请选择来款企业"
|
||||||
v-model="queryParam.chargeCompany"></company-select>
|
v-model="queryParam.chargeCompany"></company-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|||||||
Reference in New Issue
Block a user