|
@@ -39,9 +39,27 @@
|
|
|
:expandedRowKeys="expandedRowKeys"
|
|
|
:expandRowByClick="true"
|
|
|
:scroll="{ y: tableHeight }">
|
|
|
- <span slot="expandIcon">
|
|
|
+ <!-- <span slot="expandIcon">
|
|
|
1
|
|
|
- </span>
|
|
|
+ </span> -->
|
|
|
+ <a-table
|
|
|
+ slot="expandedRowRender"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="innerColumns"
|
|
|
+ :data-source="innerData"
|
|
|
+ :pagination="false"
|
|
|
+ >
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
+ <a-button
|
|
|
+ type="link"
|
|
|
+ class="button-error"
|
|
|
+ size="small"
|
|
|
+ icon="close"
|
|
|
+ :id="'chainGroupSetList-delSubItem'+record.id"
|
|
|
+ @click.stop="handleDisassociate(record)">取消关联</a-button>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button
|
|
@@ -58,17 +76,10 @@
|
|
|
icon="edit"
|
|
|
:id="'chainGroupSetList-addSubItem'+record.id"
|
|
|
@click.stop="handleEdit(record)">编辑</a-button>
|
|
|
- <a-button
|
|
|
- type="link"
|
|
|
- class="button-error"
|
|
|
- size="small"
|
|
|
- icon="close"
|
|
|
- :id="'chainGroupSetList-delSubItem'+record.id"
|
|
|
- @click.stop="handleDisassociate(record)">取消关联</a-button>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
<!-- 关联下级 -->
|
|
|
- <associate-modal :openModal="openModal" :nowData="nowData" :itemSn="itemSn" @ok="addItemOk" @close="closeModal" />
|
|
|
+ <associate-modal :openModal="openModal" :itemSn="itemSn" @ok="addItemOk" @close="closeModal" />
|
|
|
<!-- 新增/编辑 -->
|
|
|
<chain-group-edit-modal :openModal="openEditModal" :nowData="nowData" :itemId="itemId" @ok="getList" @close="closeEditModal" />
|
|
|
</a-card>
|
|
@@ -94,7 +105,7 @@ export default {
|
|
|
},
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
columns: [
|
|
|
- { title: '连锁组名称', dataIndex: 'linkageGroupName', align: 'left' },
|
|
|
+ { title: '连锁组名称', dataIndex: 'linkageGroupName', customRender: function (text) { return text || '--' }, ellipsis: true, align: 'left' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, align: 'center' }
|
|
|
],
|
|
|
expandedRowKeys: [],
|
|
@@ -111,6 +122,13 @@ export default {
|
|
|
showSizeChanger: true,
|
|
|
pageSize: 10
|
|
|
},
|
|
|
+ innerColumns: [
|
|
|
+ { title: '关联连锁店名称', dataIndex: 'dealer.name', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '负责人', dataIndex: 'dealer.contactName', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '联系电话', dataIndex: 'dealer.contactPhone', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, align: 'center' }
|
|
|
+ ],
|
|
|
+ innerData: [],
|
|
|
openModal: false, // 新增编辑 弹框
|
|
|
nowData: null, // 当前记录数据
|
|
|
tabInd: '1', // tabs选中项
|
|
@@ -141,21 +159,21 @@ export default {
|
|
|
},
|
|
|
// 获取子节点数据
|
|
|
getSubItem (record) {
|
|
|
- record.children = []
|
|
|
+ this.innerData = []
|
|
|
linkageGroupDetail({ sn: record.linkageGroupSn }).then(res => {
|
|
|
if (res.status == 200 && res.data && res.data.length) {
|
|
|
- record.children = res.data
|
|
|
+ this.innerData = res.data
|
|
|
} else {
|
|
|
- record.children = this.nowData.children
|
|
|
+ this.innerData = []
|
|
|
}
|
|
|
- if (record.children.length == 0) {
|
|
|
+ if (res.data.length == 0) {
|
|
|
this.$message.info('暂无分店,请关联分店')
|
|
|
} else {
|
|
|
this.expandedRowKeys = [record.linkageGroupSn]
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 添加子机成功
|
|
|
+ // 添加子级成功
|
|
|
addItemOk () {
|
|
|
this.getSubItem(this.nowData)
|
|
|
},
|
|
@@ -172,13 +190,11 @@ export default {
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
- data.list[i].children = []
|
|
|
}
|
|
|
this.disabled = false
|
|
|
this.list = data.list
|
|
|
})
|
|
|
},
|
|
|
- handleOk () {},
|
|
|
// 关闭 新增编辑 弹框
|
|
|
closeEditModal () {
|
|
|
this.itemId = ''
|
|
@@ -188,7 +204,7 @@ export default {
|
|
|
// 编辑连锁组
|
|
|
handleEdit (row) {
|
|
|
this.itemId = row.id
|
|
|
- this.nowData = row
|
|
|
+ this.nowData = JSON.parse(JSON.stringify(row)) // 为避免编辑数据未改变无法触发表单赋值
|
|
|
this.openEditModal = true
|
|
|
},
|
|
|
// 重置
|
|
@@ -204,20 +220,22 @@ export default {
|
|
|
},
|
|
|
// 关联下级
|
|
|
handleAssociate (row) {
|
|
|
- this.nowData = row
|
|
|
this.itemSn = row.linkageGroupSn
|
|
|
+ this.nowData = row
|
|
|
+ this.getSubItem(this.nowData)
|
|
|
this.expandedRowKeys = [row.linkageGroupSn]
|
|
|
this.openModal = true
|
|
|
},
|
|
|
// 取消关联
|
|
|
handleDisassociate (row) {
|
|
|
const _this = this
|
|
|
+ _this.nowData = row
|
|
|
_this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '确认要解除关联的关系吗?',
|
|
|
centered: true,
|
|
|
onOk () {
|
|
|
- linkageGroupUnRelation({ sn: row.linkageGroupSn }).then(res => {
|
|
|
+ linkageGroupUnRelation({ sn: row.linkageGroupDetailSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
_this.addItemOk()
|