|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2022-01-08 09:27:43
|
|
|
- * @LastEditTime: 2022-03-10 21:34:47
|
|
|
+ * @LastEditTime: 2022-03-11 14:54:37
|
|
|
* @LastEditors: your name
|
|
|
* @Description: 用户组管理
|
|
|
* @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
|
|
@@ -38,6 +38,7 @@
|
|
|
:filter-node-method="filterNode"
|
|
|
highlight-current
|
|
|
:default-expanded-keys="[currentKey]"
|
|
|
+ :expand-on-click-node="false"
|
|
|
@node-click="handleNodeClick"
|
|
|
>
|
|
|
</el-tree>
|
|
@@ -386,13 +387,13 @@ export default {
|
|
|
renderMember(data) {
|
|
|
this.$message.warning('功能开发中')
|
|
|
},
|
|
|
- // 关闭开启
|
|
|
+ // 切换状态
|
|
|
renderChange(data) {
|
|
|
const { GroupId, flag } = data
|
|
|
const Status = flag ? 1 : 0
|
|
|
this.handleChange(GroupId, Status)
|
|
|
},
|
|
|
- // 下级关闭
|
|
|
+ // 下级切换状态
|
|
|
async childrenRenderChange(data, index) {
|
|
|
const { GroupId, flag } = data
|
|
|
const Status = flag ? 1 : 0
|
|
@@ -404,6 +405,24 @@ export default {
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success(res.message)
|
|
|
this.childrenData[index].Status = Status
|
|
|
+ if (flag) {
|
|
|
+ this.dataArr.find(data => {
|
|
|
+ if (data.GroupId === GroupId) {
|
|
|
+ data.Status = 1
|
|
|
+ data.flag = true
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.dataArr.find(data => {
|
|
|
+ if (data.GroupId === GroupId) {
|
|
|
+ data.Status = 0
|
|
|
+ data.flag = false
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.setChildrenDisabled(GroupId)
|
|
|
+ }
|
|
|
// this.getOrganTree();
|
|
|
} else {
|
|
|
this.$message.error(res.message)
|
|
@@ -444,6 +463,16 @@ export default {
|
|
|
}
|
|
|
return arr
|
|
|
},
|
|
|
+ // 更改下级状态
|
|
|
+ setChildrenDisabled(id) {
|
|
|
+ this.dataArr.forEach(data => {
|
|
|
+ if (data.GroupUpid === id) {
|
|
|
+ data.Status = 0
|
|
|
+ data.flag = false
|
|
|
+ this.setChildrenDisabled(data.GroupId)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// -----------获取数据------------
|
|
|
// 状态变更
|
|
|
async handleChange(id, val) {
|
|
@@ -455,17 +484,28 @@ export default {
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success(res.message)
|
|
|
this.currDataArr[0].Status = val
|
|
|
- if (!val) {
|
|
|
+ if (val) {
|
|
|
+ this.dataArr.find(data => {
|
|
|
+ if (data.GroupId === id) {
|
|
|
+ data.Status = 1
|
|
|
+ data.flag = true
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.dataArr.find(data => {
|
|
|
+ if (data.GroupId === id) {
|
|
|
+ data.Status = 0
|
|
|
+ data.flag = false
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
this.childrenData.forEach(data => {
|
|
|
- data.Status = '2'
|
|
|
+ data.Status = 0
|
|
|
data.flag = false
|
|
|
})
|
|
|
+ this.setChildrenDisabled(id)
|
|
|
}
|
|
|
- this.dataArr.forEach(data => {
|
|
|
- if (data.GroupUpid === id) {
|
|
|
- data.Status = '2'
|
|
|
- }
|
|
|
- })
|
|
|
} else {
|
|
|
this.$message.error(res.message)
|
|
|
this.currDataArr[0].flag = !val
|