|
@@ -52,26 +52,21 @@
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <s-table
|
|
|
|
- class="sTable fixPagination"
|
|
|
|
- ref="table"
|
|
|
|
|
|
+ <a-table
|
|
style="height: 320px;"
|
|
style="height: 320px;"
|
|
- size="small"
|
|
|
|
- :rowKey="(record) => record.dealerSn"
|
|
|
|
- rowKeyName="dealerSn"
|
|
|
|
|
|
+ :scroll="{ y: 230 }"
|
|
|
|
+ :bordered="true"
|
|
|
|
+ :pagination="pagination"
|
|
|
|
+ :row-key="record => record.dealerSn"
|
|
|
|
+ :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
- :data="loadData"
|
|
|
|
- :pageSize="20"
|
|
|
|
- :row-selection="{ columnWidth: 40,getCheckboxProps: record => ({ props: { disabled:record.isDisabled } }) }"
|
|
|
|
- @rowSelection="rowSelectionFun"
|
|
|
|
- :scroll="{ y: 230}"
|
|
|
|
- :defaultLoadData="false"
|
|
|
|
- bordered>
|
|
|
|
- <!-- 地区 -->
|
|
|
|
|
|
+ :data-source="dealerList"
|
|
|
|
+ @change="handlePage"
|
|
|
|
+ >
|
|
<template slot="addressInfo" slot-scope="text, record">
|
|
<template slot="addressInfo" slot-scope="text, record">
|
|
{{ record.provinceName }}{{ '-'+ record.cityName }}{{ '-'+ record.districtName }}
|
|
{{ record.provinceName }}{{ '-'+ record.cityName }}{{ '-'+ record.districtName }}
|
|
</template>
|
|
</template>
|
|
- </s-table>
|
|
|
|
|
|
+ </a-table>
|
|
</a-spin>
|
|
</a-spin>
|
|
</a-modal>
|
|
</a-modal>
|
|
</template>
|
|
</template>
|
|
@@ -80,25 +75,17 @@
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { commonMixin } from '@/utils/mixin'
|
|
// 组件
|
|
// 组件
|
|
import { STable, VSelect } from '@/components'
|
|
import { STable, VSelect } from '@/components'
|
|
|
|
+import AreaList from '@/views/common/areaList.js'
|
|
import subarea from '@/views/common/subarea.js'
|
|
import subarea from '@/views/common/subarea.js'
|
|
import dealerType from '@/views/common/dealerType.js'
|
|
import dealerType from '@/views/common/dealerType.js'
|
|
// 接口
|
|
// 接口
|
|
-import { dealerQueryList } from '@/api/dealer'
|
|
|
|
|
|
+import { dealerQueryList, getDealerListInfo } from '@/api/dealer'
|
|
export default {
|
|
export default {
|
|
name: 'ChooseDealer',
|
|
name: 'ChooseDealer',
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
- components: { STable, VSelect, subarea, dealerType },
|
|
|
|
|
|
+ components: { STable, VSelect, subarea, AreaList, dealerType },
|
|
props: {
|
|
props: {
|
|
- openModal: { // 弹框显示状态
|
|
|
|
- type: Boolean,
|
|
|
|
- default: false
|
|
|
|
- },
|
|
|
|
- disabledList: {
|
|
|
|
- type: Array,
|
|
|
|
- default: () => {
|
|
|
|
- return []
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -131,53 +118,78 @@ export default {
|
|
{ title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
{ title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
{ title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
{ title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
],
|
|
],
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
|
- loadData: parameter => {
|
|
|
|
- this.disabled = true
|
|
|
|
- this.spinning = true
|
|
|
|
- return dealerQueryList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
|
- let data
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- data = res.data
|
|
|
|
- const no = (data.pageNo - 1) * data.pageSize
|
|
|
|
- const chooseArr = []
|
|
|
|
- for (var i = 0; i < data.list.length; i++) {
|
|
|
|
- data.list[i].no = no + i + 1
|
|
|
|
- if (data.list[i].dealerTypeName1) {
|
|
|
|
- data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
|
|
|
|
- }
|
|
|
|
- if (this.disabledList && this.disabledList.length > 0) {
|
|
|
|
- if (this.disabledList.includes(data.list[i].dealerSn)) {
|
|
|
|
- data.list[i].isDisabled = true
|
|
|
|
- chooseArr.push(data.list[i])
|
|
|
|
- } else {
|
|
|
|
- data.list[i].isDisabled = false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (this.disabledList && chooseArr) {
|
|
|
|
- // 勾选回显
|
|
|
|
- this.$refs.table.setTableSelected(this.disabledList, chooseArr)
|
|
|
|
- }
|
|
|
|
- this.disabled = false
|
|
|
|
- }
|
|
|
|
- this.spinning = false
|
|
|
|
- return data
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ // 分页
|
|
|
|
+ pagination: {
|
|
|
|
+ pageSize: 20,
|
|
|
|
+ showSizeChanger: true,
|
|
|
|
+ pageSizeOptions: ['20', '50', '100', '200', '500']
|
|
|
|
+ },
|
|
|
|
+ pageFlag: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
// 计算选择活动条数
|
|
// 计算选择活动条数
|
|
selectCount () {
|
|
selectCount () {
|
|
- return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys && this.rowSelectionInfo.selectedRowKeys.length
|
|
|
|
|
|
+ return this.selectedRowKeys && this.selectedRowKeys.length
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 已选活动数据
|
|
|
|
+ onSelectChange (selectedRowKeys) {
|
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
|
+ },
|
|
|
|
+ // 分页
|
|
|
|
+ handlePage (pagination, filters, sorter) {
|
|
|
|
+ const pager = { ...this.pagination }
|
|
|
|
+ pager.pageNo = pagination.pageSize != pager.pageSize ? 1 : pagination.current
|
|
|
|
+ pager.pageSize = pagination.pageSize
|
|
|
|
+ pager.current = pager.pageNo
|
|
|
|
+ this.pagination = pager
|
|
|
|
+ this.loadData()
|
|
|
|
+ },
|
|
|
|
+ // 获取列表数据
|
|
|
|
+ loadData () {
|
|
|
|
+ this.spinning = true
|
|
|
|
+ const params = { pageSize: 20, pageNo: 1, ...this.pagination }
|
|
|
|
+ this.queryParam.notDealerSn = this.itemSn ? this.itemSn : undefined
|
|
|
|
+ dealerQueryList(Object.assign(params, this.queryParam)).then(res => {
|
|
|
|
+ let data
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ data = res.data
|
|
|
|
+ const pagination = { ...this.pagination }
|
|
|
|
+ pagination.total = data.count
|
|
|
|
+ const no = 0
|
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
|
+ if (data.list[i].dealerTypeName1) {
|
|
|
|
+ data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.dealerList = data.list
|
|
|
|
+ this.pagination = pagination
|
|
|
|
+ if (this.chooseInfo.length > 0 && !this.pageFlag) {
|
|
|
|
+ this.pageFlag = true
|
|
|
|
+ this.selectedRowKeys = this.chooseInfo
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 表格选中项
|
|
// 表格选中项
|
|
rowSelectionFun (obj) {
|
|
rowSelectionFun (obj) {
|
|
this.rowSelectionInfo = obj || null
|
|
this.rowSelectionInfo = obj || null
|
|
},
|
|
},
|
|
|
|
+ // 地区
|
|
|
|
+ areaChange (val) {
|
|
|
|
+ this.queryParam.provinceSn = val[0] ? val[0] : ''
|
|
|
|
+ this.queryParam.citySn = val[1] ? val[1] : ''
|
|
|
|
+ this.queryParam.districtSn = val[2] ? val[2] : ''
|
|
|
|
+ },
|
|
|
|
+ // 查询
|
|
|
|
+ searchForm () {
|
|
|
|
+ this.loadData()
|
|
|
|
+ this.spinning = false
|
|
|
|
+ },
|
|
// 区域分区
|
|
// 区域分区
|
|
subareaChange (val) {
|
|
subareaChange (val) {
|
|
this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
|
|
this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
|
|
@@ -190,11 +202,12 @@ export default {
|
|
},
|
|
},
|
|
// 重置
|
|
// 重置
|
|
resetSearchForm () {
|
|
resetSearchForm () {
|
|
|
|
+ this.dealerType = []
|
|
this.queryParam = {
|
|
this.queryParam = {
|
|
- nameLike: '',
|
|
|
|
|
|
+ nameLike: '', // 经销商名称/别名
|
|
dealerType1: undefined, // 商户类型
|
|
dealerType1: undefined, // 商户类型
|
|
dealerType2: undefined, // 商户类型
|
|
dealerType2: undefined, // 商户类型
|
|
- dealerLevel: null,
|
|
|
|
|
|
+ dealerLevel: null, // 商户级别
|
|
subareaArea: {
|
|
subareaArea: {
|
|
subareaSn: undefined, // 区域
|
|
subareaSn: undefined, // 区域
|
|
subareaAreaSn: undefined // 分区
|
|
subareaAreaSn: undefined // 分区
|
|
@@ -202,17 +215,40 @@ export default {
|
|
}
|
|
}
|
|
this.dealerType = []
|
|
this.dealerType = []
|
|
this.$refs.subarea.clearData()
|
|
this.$refs.subarea.clearData()
|
|
- this.$refs.table.refresh()
|
|
|
|
|
|
+ this.pagination.pageNo = 1
|
|
|
|
+ this.pagination.current = 1
|
|
|
|
+ this.loadData()
|
|
|
|
+ this.pageFlag = false
|
|
|
|
+ this.selectedRowKeys = []
|
|
},
|
|
},
|
|
// 批量添加
|
|
// 批量添加
|
|
- handleBatchAudit () {
|
|
|
|
|
|
+ async handleBatchAudit () {
|
|
const _this = this
|
|
const _this = this
|
|
- if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys && this.rowSelectionInfo.selectedRowKeys.length < 1) {
|
|
|
|
|
|
+ if (_this.selectedRowKeys && _this.selectedRowKeys.length < 1) {
|
|
_this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
_this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ const dealerInfoList = await getDealerListInfo({ dealerSnList: _this.selectedRowKeys })
|
|
this.spinning = false
|
|
this.spinning = false
|
|
- this.$emit('ok', this.rowSelectionInfo.selectedRows)
|
|
|
|
|
|
+ this.$emit('plAdd', dealerInfoList.data)
|
|
|
|
+ },
|
|
|
|
+ // 确定
|
|
|
|
+ handleAdd (row) {
|
|
|
|
+ if (row.subareaArea) {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '当前经销商已被其他区域分区绑定,确定要更新绑定关系吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.spinning = true
|
|
|
|
+ _this.$emit('add', row)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.spinning = true
|
|
|
|
+ this.$emit('add', row)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -224,7 +260,6 @@ export default {
|
|
isShow (newValue, oldValue) {
|
|
isShow (newValue, oldValue) {
|
|
if (!newValue) {
|
|
if (!newValue) {
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
- this.$refs.table.clearSelected()
|
|
|
|
} else {
|
|
} else {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.resetSearchForm()
|
|
this.resetSearchForm()
|