|
@@ -50,35 +50,17 @@
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</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 }"
|
|
: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.no"
|
|
|
|
+ :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :data-source="dealerList"
|
|
|
|
+ @change="handlePage"
|
|
|
|
+ ></a-table>
|
|
</a-spin>
|
|
</a-spin>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -120,67 +102,57 @@ export default {
|
|
citySn: undefined,
|
|
citySn: undefined,
|
|
districtSn: undefined
|
|
districtSn: undefined
|
|
},
|
|
},
|
|
|
|
+ pagination: {
|
|
|
|
+ total: 0
|
|
|
|
+ },
|
|
pageFlag: false,
|
|
pageFlag: false,
|
|
chooseInfo: [],
|
|
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,
|
|
tableHeight: 0,
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
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: {
|
|
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 () {
|
|
selectCount () {
|
|
- return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
|
|
|
|
|
|
+ return this.selectedRowKeys && this.selectedRowKeys.length
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ onSelectChange (selectedRowKeys) {
|
|
|
|
+ console.log('selectedRowKeys changed: ', selectedRowKeys)
|
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
|
+ },
|
|
|
|
+ handlePage (pagination) {
|
|
|
|
+ console.log('22222222222', pagination)
|
|
|
|
+ this.pagination = pagination
|
|
|
|
+ this.loadData({ results: pagination.pageSize, pageNo: pagination.current, pageSize: 20 })
|
|
|
|
+ },
|
|
|
|
+ loadData (params = { results: 20, pageNo: 1, pageSize: 20 }) {
|
|
|
|
+ this.spinning = true
|
|
|
|
+ dealerQueryList(Object.assign(params, this.queryParam)).then(res => {
|
|
|
|
+ let data
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ data = res.data
|
|
|
|
+ this.pagination.total = data.pages
|
|
|
|
+ const no = 0
|
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ this.dealerList = data.list
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 表格选中项
|
|
// 表格选中项
|
|
rowSelectionFun (obj) {
|
|
rowSelectionFun (obj) {
|
|
this.rowSelectionInfo = obj || null
|
|
this.rowSelectionInfo = obj || null
|
|
@@ -267,7 +239,7 @@ export default {
|
|
_this.setTableH()
|
|
_this.setTableH()
|
|
})
|
|
})
|
|
this.chooseInfo = data || []
|
|
this.chooseInfo = data || []
|
|
- this.resetSearchForm()
|
|
|
|
|
|
+ this.loadData()
|
|
},
|
|
},
|
|
setTableH () {
|
|
setTableH () {
|
|
const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
const tableSearchH = this.$refs.tableSearch.offsetHeight
|