|
@@ -88,8 +88,14 @@ export default {
|
|
|
},
|
|
|
expandOption: {
|
|
|
defaultExpandAllRows: false,
|
|
|
+ trigger: 'row',
|
|
|
+ expandedRowKeys: [],
|
|
|
render: ({ row, column, rowIndex }, h) => {
|
|
|
return <ChildTableComp row={row} />
|
|
|
+ },
|
|
|
+ // 重新赋值处理
|
|
|
+ afterExpandRowChange: ({ afterExpandedRowKeys, row, rowIndex }) => {
|
|
|
+ this.changeExpandedRowKeys(afterExpandedRowKeys)
|
|
|
}
|
|
|
},
|
|
|
showEmpty: true,
|
|
@@ -122,13 +128,13 @@ export default {
|
|
|
size="small"
|
|
|
type="link"
|
|
|
class="button-info"
|
|
|
- onClick={() => _this.handleEdit(record)}
|
|
|
+ onClick={(e) => _this.handleEdit(record, e)}
|
|
|
>编辑</a-button>
|
|
|
<a-button
|
|
|
size="small"
|
|
|
type="link"
|
|
|
class="button-error"
|
|
|
- onClick={() => _this.handleDel(record)}
|
|
|
+ onClick={(e) => _this.handleDel(record, e)}
|
|
|
>删除</a-button>
|
|
|
</div>
|
|
|
)
|
|
@@ -138,6 +144,12 @@ export default {
|
|
|
if (_this.isTeyue) {
|
|
|
return (<span>-</span>)
|
|
|
}
|
|
|
+ const hasExpend = _this.expandOption.expandedRowKeys.indexOf(record.id)
|
|
|
+ if (hasExpend >= 0) {
|
|
|
+ return (
|
|
|
+ <span style="cursor:pointer;">收起</span>
|
|
|
+ )
|
|
|
+ }
|
|
|
return (
|
|
|
<span style="cursor:pointer;">展开</span>
|
|
|
)
|
|
@@ -153,6 +165,18 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 给可控属性重新赋值
|
|
|
+ changeExpandedRowKeys (keys) {
|
|
|
+ this.expandOption.expandedRowKeys = keys
|
|
|
+ },
|
|
|
+ // 展开全部
|
|
|
+ expandAll () {
|
|
|
+ this.expandOption.expandedRowKeys = this.list.map((x) => x.id)
|
|
|
+ },
|
|
|
+ // 折叠全部
|
|
|
+ foldAll () {
|
|
|
+ this.expandOption.expandedRowKeys = []
|
|
|
+ },
|
|
|
// 筛选数据
|
|
|
filterData (data, queryParam) {
|
|
|
return data.filter(s => {
|
|
@@ -230,13 +254,15 @@ export default {
|
|
|
this.disabled = false
|
|
|
})
|
|
|
},
|
|
|
- handleEdit (record) {
|
|
|
+ handleEdit (record, e) {
|
|
|
+ console.log(e)
|
|
|
+ e.stopPropagation()
|
|
|
const row = this.dataSource.find(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)
|
|
|
this.$emit('edit', row)
|
|
|
},
|
|
|
- handleDel (record) {
|
|
|
+ handleDel (record, e) {
|
|
|
+ e.stopPropagation()
|
|
|
const _this = this
|
|
|
- console.log(record)
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '删除后,将解除该品类差价设置归属关系。确定删除吗?',
|