|
|
@ -28,7 +28,7 @@ |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
<!--表格渲染--> |
|
|
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
|
|
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="selectionChangeHandler" @row-click="clickRowHandler"> |
|
|
|
<el-table-column type="selection" width="55" /> |
|
|
|
<el-table-column prop="dic_name" label="字典名称" /> |
|
|
|
<el-table-column prop="dic_code" label="字典代码" /> |
|
|
@ -110,6 +110,24 @@ export default { |
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
this.crud.query.id = this.dicPid |
|
|
|
return true |
|
|
|
}, |
|
|
|
clickRowHandler(row) { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.toggleRowSelection(row) |
|
|
|
}, |
|
|
|
selectionChangeHandler(val) { |
|
|
|
let finalVal |
|
|
|
if (val.length > 1) { |
|
|
|
// 取出最后val的最后一个返回出来 |
|
|
|
finalVal = val.pop() |
|
|
|
// 清除所有选中 |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
// 给最后一个加上选中 |
|
|
|
this.$refs.table.toggleRowSelection(finalVal) |
|
|
|
} else { |
|
|
|
finalVal = val |
|
|
|
} |
|
|
|
this.crud.selectionChangeHandler(finalVal) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -119,4 +137,7 @@ export default { |
|
|
|
::v-deep .el-input-number .el-input__inner { |
|
|
|
text-align: left; |
|
|
|
} |
|
|
|
::v-deep thead .el-table-column--selection .cell { |
|
|
|
display: none; |
|
|
|
} |
|
|
|
</style> |