Browse Source

字典管理 单选

master
z_yu 3 years ago
parent
commit
aad35b2fd9
  1. 23
      src/views/archivesConfig/dict/dictDetail.vue
  2. 4
      src/views/archivesConfig/dict/index.vue

23
src/views/archivesConfig/dict/dictDetail.vue

@ -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>

4
src/views/archivesConfig/dict/index.vue

@ -24,13 +24,13 @@
<el-card class="box-card">
<crudOperation :permission="permission" />
<!--字典树状结构-->
<el-tree ref="tree" v-loading="crud.loading" :data="crud.data" :props="defaultProps" node-key="id" :default-expand-all="true" :expand-on-click-node="false" style="height:calc(100vh - 240px);" highlight-current @node-click="handleNodeClick" />
<el-tree ref="tree" v-loading="crud.loading" :data="crud.data" :props="defaultProps" node-key="id" :default-expand-all="true" style="height:calc(100vh - 285px);" highlight-current @node-click="handleNodeClick" />
</el-card>
</el-col>
<!-- 字典详情列表 -->
<el-col :xs="24" :sm="24" :md="18" :lg="18" :xl="19">
<el-card class="box-card">
<dictDetail ref="dictDetail" :permission="permission" style="height:calc(100vh - 203px);" :active-add-btn="activeAddBtn" @treeRefresh="treeRefresh" />
<dictDetail ref="dictDetail" :permission="permission" style="height:calc(100vh - 248px);" :active-add-btn="activeAddBtn" @treeRefresh="treeRefresh" />
</el-card>
</el-col>
</el-row>

Loading…
Cancel
Save