|
@@ -50,35 +50,17 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <s-table
|
|
|
- class="sTable"
|
|
|
- ref="table"
|
|
|
- size="small"
|
|
|
- :rowKey="(record) => record.dealerSn"
|
|
|
- rowKeyName="dealerSn"
|
|
|
- :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: pageType=='viewDealers'?!!record.subareaAreaSn: !!record.chooseId} }) }"
|
|
|
- @rowSelection="rowSelectionFun"
|
|
|
- :columns="columns"
|
|
|
- :data="loadData"
|
|
|
- :defaultLoadData="false"
|
|
|
- :style="{ height: 320+'px' }"
|
|
|
+ <a-table
|
|
|
+ style="height: 320px;"
|
|
|
:scroll="{ y: 230 }"
|
|
|
- bordered>
|
|
|
- <template slot="areas" slot-scope="text, record">
|
|
|
- <span v-if="record.subareaArea">{{ record.subareaArea.subareaName }}>{{ record.subareaArea.subareaAreaName }}</span>
|
|
|
- <span v-else>--</span>
|
|
|
- </template>
|
|
|
- <template slot="action" slot-scope="text, record">
|
|
|
- <a-button
|
|
|
- size="small"
|
|
|
- type="link"
|
|
|
- class="button-error"
|
|
|
- @click="handleAdd(record)"
|
|
|
- v-if="record.subareaAreaSn != parentData.subareaAreaSn"
|
|
|
- id="marketingDivisionSetNew-del-btn">添加</a-button>
|
|
|
- <span style="color:#666" v-else>已添加</span>
|
|
|
- </template>
|
|
|
- </s-table>
|
|
|
+ :bordered="true"
|
|
|
+ :pagination="pagination"
|
|
|
+ :row-key="record => record.dealerSn"
|
|
|
+ :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="dealerList"
|
|
|
+ @change="handlePage"
|
|
|
+ ></a-table>
|
|
|
</a-spin>
|
|
|
</template>
|
|
|
|
|
@@ -86,7 +68,7 @@
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import AreaList from '@/views/common/areaList.js'
|
|
|
-import { dealerQueryList } from '@/api/dealer'
|
|
|
+import { dealerQueryList, getDealerListInfo } from '@/api/dealer'
|
|
|
import subarea from '@/views/common/subarea.js'
|
|
|
export default {
|
|
|
name: 'ChooseDealer',
|
|
@@ -120,67 +102,67 @@ export default {
|
|
|
citySn: undefined,
|
|
|
districtSn: undefined
|
|
|
},
|
|
|
+ pagination: {
|
|
|
+ pageSize: 20,
|
|
|
+ showSizeChanger: true
|
|
|
+ },
|
|
|
pageFlag: false,
|
|
|
chooseInfo: [],
|
|
|
+ selectedRowKeys: [],
|
|
|
+ columns: [
|
|
|
+ { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', 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 || '--' } }
|
|
|
+ ],
|
|
|
+ dealerList: [],
|
|
|
tableHeight: 0,
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
- loading: false, // 批量添加loading
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
- loadData: parameter => {
|
|
|
- this.spinning = true
|
|
|
- return dealerQueryList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
- let data
|
|
|
- const _this = this
|
|
|
- if (res.status == 200) {
|
|
|
- data = res.data
|
|
|
- const no = 0
|
|
|
- const chooseData = []
|
|
|
- for (var i = 0; i < data.list.length; i++) {
|
|
|
- data.list[i].no = no + i + 1
|
|
|
- if (!_this.pageType && _this.chooseInfo && _this.chooseInfo.length > 0) {
|
|
|
- // 回显选中数据
|
|
|
- const flag = _this.chooseInfo.includes(data.list[i].dealerSn)
|
|
|
- if (flag) {
|
|
|
- chooseData.push(data.list[i])
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (!this.pageFlag) {
|
|
|
- this.pageFlag = true
|
|
|
- _this.$refs.table.setTableSelected(_this.chooseInfo, chooseData) // 设置表格选中项
|
|
|
- }
|
|
|
- }
|
|
|
- this.spinning = false
|
|
|
- return data
|
|
|
- })
|
|
|
- },
|
|
|
- rowSelectionInfo: null
|
|
|
+ loading: false // 批量添加loading
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- columns () {
|
|
|
- const _this = this
|
|
|
- const arr = [
|
|
|
- { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
|
- ]
|
|
|
- if (_this.pageType == 'viewDealers') {
|
|
|
- arr.splice(4, 0, { title: '审核状态', dataIndex: 'auditStateDictValue', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
|
|
|
- arr.splice(5, 0, { title: '当前所属区域', scopedSlots: { customRender: 'areas' }, width: '30%', align: 'center' })
|
|
|
- arr.splice(6, 0, { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' })
|
|
|
- } else {
|
|
|
- arr.splice(4, 0, { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
|
|
|
- arr.splice(5, 0, { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
|
|
|
- }
|
|
|
- return arr
|
|
|
- },
|
|
|
selectCount () {
|
|
|
- return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
|
|
|
+ return this.selectedRowKeys && this.selectedRowKeys.length
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ onSelectChange (selectedRowKeys) {
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
+ },
|
|
|
+ handlePage (pagination, filters, sorter) {
|
|
|
+ const pager = { ...this.pagination }
|
|
|
+ pager.current = pagination.current
|
|
|
+ pager.pageSize = pagination.pageSize
|
|
|
+ this.pagination = pager
|
|
|
+
|
|
|
+ this.loadData({ pageNo: pagination.current, pageSize: pagination.pageSize })
|
|
|
+ },
|
|
|
+ loadData (pager) {
|
|
|
+ this.spinning = true
|
|
|
+ const params = { pageSize: 20, pageNo: 1, ...pager }
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ this.dealerList = data.list
|
|
|
+ this.pagination = pagination
|
|
|
+ if (this.chooseInfo && !this.pageFlag) {
|
|
|
+ this.pageFlag = true
|
|
|
+ this.selectedRowKeys = this.chooseInfo
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
+ },
|
|
|
// 表格选中项
|
|
|
rowSelectionFun (obj) {
|
|
|
this.rowSelectionInfo = obj || null
|
|
@@ -190,8 +172,8 @@ export default {
|
|
|
this.queryParam.citySn = val[1] ? val[1] : ''
|
|
|
this.queryParam.districtSn = val[2] ? val[2] : ''
|
|
|
},
|
|
|
- searchForm (flag) {
|
|
|
- this.$refs.table.refresh(flag)
|
|
|
+ searchForm () {
|
|
|
+ this.loadData()
|
|
|
this.spinning = false
|
|
|
},
|
|
|
subareaChange (val) {
|
|
@@ -218,8 +200,13 @@ export default {
|
|
|
} else {
|
|
|
this.$refs.areaList.clearData()
|
|
|
}
|
|
|
- this.$refs.table.clearSelected()
|
|
|
- this.$refs.table.refresh(true)
|
|
|
+ this.pagination = {
|
|
|
+ pageSize: 20,
|
|
|
+ showSizeChanger: true,
|
|
|
+ current: 1
|
|
|
+ }
|
|
|
+ this.selectedRowKeys = []
|
|
|
+ this.loadData()
|
|
|
this.pageFlag = false
|
|
|
},
|
|
|
clearTable () {
|
|
@@ -227,22 +214,15 @@ export default {
|
|
|
this.$refs.table.clearTable()
|
|
|
},
|
|
|
// 批量添加
|
|
|
- handleBatchAudit () {
|
|
|
+ async handleBatchAudit () {
|
|
|
const _this = this
|
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
+ if (_this.selectedRowKeys && _this.selectedRowKeys.length < 1) {
|
|
|
_this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
|
return
|
|
|
}
|
|
|
- const dealerSnList = _this.rowSelectionInfo.selectedRows
|
|
|
- // const newDealerSnList = dealerSnList.map(con => {
|
|
|
- // const obj = {
|
|
|
- // buyerName: con.dealerName,
|
|
|
- // buyerSn: con.dealerSn
|
|
|
- // }
|
|
|
- // return obj
|
|
|
- // })
|
|
|
+ const dealerInfoList = await getDealerListInfo({ dealerSnList: _this.selectedRowKeys })
|
|
|
this.spinning = false
|
|
|
- this.$emit('plAdd', dealerSnList)
|
|
|
+ this.$emit('plAdd', dealerInfoList.data)
|
|
|
},
|
|
|
handleAdd (row) {
|
|
|
if (row.subareaArea) {
|