|
@@ -14,37 +14,15 @@
|
|
|
<div class="table-page-search-wrapper">
|
|
|
<a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
<a-row :gutter="15">
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
+ <a-col :md="8" :sm="24">
|
|
|
<a-form-item label="客户名称">
|
|
|
<a-input id="chooseCustomer-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客户名称"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="12" :sm="24">
|
|
|
- <a-row>
|
|
|
- <a-form-item label="地区">
|
|
|
- <a-col span="7">
|
|
|
- <a-form-item prop="provinceSn" style="margin: 0;">
|
|
|
- <a-select v-model="queryParam.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
|
|
|
- <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col span="7" offset="1">
|
|
|
- <a-form-item prop="citySn" style="margin: 0;">
|
|
|
- <a-select v-model="queryParam.citySn" allowClear @change="getAreaList" placeholder="请选择市">
|
|
|
- <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col span="7" offset="1">
|
|
|
- <a-form-item prop="districtSn" style="margin: 0;">
|
|
|
- <a-select v-model="queryParam.districtSn" allowClear placeholder="请选择区/县">
|
|
|
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- </a-form-item>
|
|
|
- </a-row>
|
|
|
+ <a-col :md="8" :sm="24">
|
|
|
+ <a-form-model-item label="地区">
|
|
|
+ <AreaList id="chooseCustomer-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
|
|
|
+ </a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
<a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
|
|
@@ -91,11 +69,11 @@
|
|
|
|
|
|
<script>
|
|
|
import { STable } from '@/components'
|
|
|
-import { getArea } from '@/api/data'
|
|
|
+import AreaList from '@/views/common/areaList.js'
|
|
|
import { dealerQueryList } from '@/api/dealer'
|
|
|
export default {
|
|
|
name: 'ChooseCustomerModal',
|
|
|
- components: { STable },
|
|
|
+ components: { STable, AreaList },
|
|
|
props: {
|
|
|
openModal: { // 弹框显示状态
|
|
|
type: Boolean,
|
|
@@ -141,9 +119,6 @@ export default {
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- addrProvinceList: [], // 省下拉
|
|
|
- addrCityList: [], // 市下拉
|
|
|
- addrDistrictList: [], // 区下拉
|
|
|
rowSelectionInfo: null
|
|
|
}
|
|
|
},
|
|
@@ -162,8 +137,12 @@ export default {
|
|
|
this.queryParam.provinceSn = undefined
|
|
|
this.queryParam.citySn = undefined
|
|
|
this.queryParam.districtSn = undefined
|
|
|
- this.addrCityList = []
|
|
|
- this.addrDistrictList = []
|
|
|
+ this.$refs.areaList.clearData()
|
|
|
+ },
|
|
|
+ areaChange(val){
|
|
|
+ this.queryParam.provinceSn = val[0] ? val[0] : ''
|
|
|
+ this.queryParam.citySn = val[1] ? val[1] : ''
|
|
|
+ this.queryParam.districtSn = val[2] ? val[2] : ''
|
|
|
},
|
|
|
// 确定
|
|
|
handleSubmit () {
|
|
@@ -174,52 +153,6 @@ export default {
|
|
|
this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys)
|
|
|
this.isShow = false
|
|
|
},
|
|
|
- // 获取城市列表
|
|
|
- getCityList (val) {
|
|
|
- this.addrCityList = []
|
|
|
- this.addrDistrictList = []
|
|
|
- this.queryParam.citySn = undefined
|
|
|
- this.queryParam.districtSn = undefined
|
|
|
- if (val) {
|
|
|
- this.getArea('city', val)
|
|
|
- }
|
|
|
- },
|
|
|
- // 获取区县列表
|
|
|
- getAreaList (val) {
|
|
|
- this.addrDistrictList = []
|
|
|
- this.queryParam.districtSn = undefined
|
|
|
- if (val) {
|
|
|
- this.getArea('district', val)
|
|
|
- }
|
|
|
- },
|
|
|
- // 省/市/区
|
|
|
- getArea (leve, sn) {
|
|
|
- let params
|
|
|
- if (leve == 'province') {
|
|
|
- params = { type: '2' }
|
|
|
- } else {
|
|
|
- params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
|
|
|
- }
|
|
|
- getArea(params).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- if (leve == 'province') {
|
|
|
- this.addrProvinceList = res.data || []
|
|
|
- } else if (leve == 'city') {
|
|
|
- this.addrCityList = res.data || []
|
|
|
- } else if (leve == 'district') {
|
|
|
- this.addrDistrictList = res.data || []
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (leve == 'province') {
|
|
|
- this.addrProvinceList = []
|
|
|
- } else if (leve == 'city') {
|
|
|
- this.addrCityList = []
|
|
|
- } else if (leve == 'district') {
|
|
|
- this.addrDistrictList = []
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
},
|
|
|
watch: {
|
|
|
// 父页面传过来的弹框状态
|
|
@@ -232,9 +165,6 @@ export default {
|
|
|
this.$emit('close')
|
|
|
this.resetData()
|
|
|
} else {
|
|
|
- if (this.addrProvinceList.length == 0) {
|
|
|
- this.getArea('province')
|
|
|
- }
|
|
|
const _this = this
|
|
|
this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
_this.$refs.table.refresh(true)
|