|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: zk
|
|
|
* @Date: 2022-02-09 15:47:09
|
|
|
- * @LastEditTime: 2022-02-09 16:51:35
|
|
|
+ * @LastEditTime: 2022-02-11 15:44:58
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: 用户组树
|
|
|
* @FilePath: \Foshan4A4.0\src\components\usergrouptree\index.vue
|
|
@@ -11,9 +11,9 @@
|
|
|
<div class="head">
|
|
|
<p>{{ title }}</p>
|
|
|
</div>
|
|
|
- <div class="content">
|
|
|
+ <div :class="type ? 'radioBg':''" class="content">
|
|
|
<el-scrollbar style="height: 100%">
|
|
|
- <el-tree :data="data" show-checkbox :check-strictly="true" @check-change="currentChange" @node-click="handleNodeClick" :defaultProps="defaultProps" :expand-on-click-node="false" node-key="GroupId" default-expand-all ref="tree" highlight-current>
|
|
|
+ <el-tree :data="data" show-checkbox :check-strictly="true" @check-change="currentChange" :defaultProps="defaultProps" :expand-on-click-node="false" node-key="GroupId" default-expand-all ref="tree" highlight-current>
|
|
|
<span class="custom-tree-node" slot-scope="{ data }">
|
|
|
{{ data.GroupName }}
|
|
|
</span>
|
|
@@ -38,6 +38,10 @@ export default {
|
|
|
type: Array,
|
|
|
default: () => [],
|
|
|
},
|
|
|
+ type: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ }
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
@@ -65,12 +69,18 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
//复选框选中
|
|
|
- currentChange () {
|
|
|
- const arr = this.$refs.tree.getCheckedNodes()
|
|
|
- this.$emit("getTreeData", arr)
|
|
|
- },
|
|
|
- handleNodeClick (data) {
|
|
|
- console.log(data)
|
|
|
+ currentChange (data, isChecked) {
|
|
|
+ if (this.type) {
|
|
|
+ const { GroupId } = data
|
|
|
+ this.$emit("getTreeData", this.$refs.tree.getCheckedNodes())
|
|
|
+ if (isChecked) {
|
|
|
+ const checked = [GroupId]
|
|
|
+ this.$refs.tree.setCheckedKeys(checked)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const arr = this.$refs.tree.getCheckedNodes()
|
|
|
+ this.$emit("getTreeData", arr)
|
|
|
+ }
|
|
|
},
|
|
|
async getGroupTree () {
|
|
|
const result = await GetGroupTree({
|
|
@@ -124,5 +134,18 @@ export default {
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
}
|
|
|
+ ::v-deep .radioBg {
|
|
|
+ .el-checkbox__inner {
|
|
|
+ border-radius: 50%;
|
|
|
+ &::after {
|
|
|
+ width: 5px;
|
|
|
+ height: 5px;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 50%;
|
|
|
+ top: 3px;
|
|
|
+ left: 3px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|