|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-11-29 09:27:43
|
|
|
- * @LastEditTime: 2022-03-18 11:29:32
|
|
|
+ * @LastEditTime: 2022-03-18 16:02:57
|
|
|
* @LastEditors: your name
|
|
|
* @Description: 权限管理
|
|
|
* @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\home.vue
|
|
@@ -229,9 +229,8 @@ export default {
|
|
|
//下级切换状态
|
|
|
childrenRenderChange (data, index) {
|
|
|
const { AuthId, flag, Type } = data
|
|
|
- const Status = flag ? 1 : 0
|
|
|
const isChildren = true
|
|
|
- this.handleChange(AuthId, Status, Type, index, isChildren)
|
|
|
+ this.handleChange(AuthId, flag, Type, index, isChildren)
|
|
|
},
|
|
|
filterNode (value, data) {
|
|
|
if (!value) return true;
|
|
@@ -256,8 +255,7 @@ export default {
|
|
|
// 关闭开启
|
|
|
renderChange (data, index) {
|
|
|
const { AuthId, flag, Type } = data
|
|
|
- const Status = flag ? 1 : 0
|
|
|
- this.handleChange(AuthId, Status, Type, index)
|
|
|
+ this.handleChange(AuthId, flag, Type, index)
|
|
|
},
|
|
|
//删除
|
|
|
remove () {
|
|
@@ -301,12 +299,12 @@ export default {
|
|
|
return arr
|
|
|
},
|
|
|
// 更改下级状态
|
|
|
- setChildrenDisabled(id) {
|
|
|
+ setChildrenStatus(id, flag) {
|
|
|
this.dataArr.forEach(data => {
|
|
|
if (data.UpAuthId === id) {
|
|
|
- data.Status = 0
|
|
|
- data.flag = false
|
|
|
- this.setChildrenDisabled(data.AuthId)
|
|
|
+ data.Status = flag ? 1 : 0
|
|
|
+ data.flag = flag
|
|
|
+ this.setChildrenStatus(data.AuthId, flag)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -344,68 +342,59 @@ export default {
|
|
|
// },
|
|
|
//-----------获取数据------------
|
|
|
//应用状态变更
|
|
|
- async handleChange (id, val, type, index, isChildren = false) {
|
|
|
+ async handleChange (id, flag, type, index, isChildren = false) {
|
|
|
+ const Status = flag ? 1 : 0
|
|
|
try {
|
|
|
let res = null
|
|
|
if (type === 1) {
|
|
|
res = await UpdateAppStatus({
|
|
|
AppId: id,
|
|
|
- Status: val
|
|
|
+ Status: Status
|
|
|
})
|
|
|
} else {
|
|
|
res = await UpdateAuthStatus({
|
|
|
AuthId: id,
|
|
|
- AuthStatus: val
|
|
|
+ AuthStatus: Status
|
|
|
})
|
|
|
}
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success(res.message)
|
|
|
if (!isChildren) {
|
|
|
- this.currDataArr[0].Status = val
|
|
|
+ this.currDataArr[0].Status = Status
|
|
|
} else {
|
|
|
- this.childrenData[index].Status = val
|
|
|
+ this.childrenData[index].Status = Status
|
|
|
}
|
|
|
- if (val) {
|
|
|
- this.dataArr.find(data => {
|
|
|
- if (data.AuthId === id) {
|
|
|
- data.Status = 1
|
|
|
- data.flag = true
|
|
|
- return true
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.dataArr.find(data => {
|
|
|
- if (data.AuthId === id) {
|
|
|
- data.Status = 0
|
|
|
- data.flag = false
|
|
|
- return true
|
|
|
- }
|
|
|
- })
|
|
|
- if (type === 2) {
|
|
|
- if (!isChildren) {
|
|
|
- this.childrenData.forEach(data => {
|
|
|
- data.Status = 0
|
|
|
- data.flag = false
|
|
|
- })
|
|
|
- }
|
|
|
- this.setChildrenDisabled(id)
|
|
|
+ this.dataArr.find(data => {
|
|
|
+ if (data.AuthId === id) {
|
|
|
+ data.Status = Status
|
|
|
+ data.flag = flag
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (type !== 1) {
|
|
|
+ if (!isChildren) {
|
|
|
+ this.childrenData.forEach(data => {
|
|
|
+ data.Status = Status
|
|
|
+ data.flag = flag
|
|
|
+ })
|
|
|
}
|
|
|
+ this.setChildrenStatus(id, flag)
|
|
|
}
|
|
|
//this.getAuthTree()
|
|
|
} else {
|
|
|
this.$message.error(res.message)
|
|
|
if (!isChildren) {
|
|
|
- this.currDataArr[0].flag = !val;
|
|
|
+ this.currDataArr[0].flag = !flag;
|
|
|
} else {
|
|
|
- this.childrenData[index].flag = !val;
|
|
|
+ this.childrenData[index].flag = !flag;
|
|
|
}
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.log('出错了', error)
|
|
|
if (!isChildren) {
|
|
|
- this.currDataArr[0].flag = !val;
|
|
|
+ this.currDataArr[0].flag = !flag;
|
|
|
} else {
|
|
|
- this.childrenData[index].flag = !val;
|
|
|
+ this.childrenData[index].flag = !flag;
|
|
|
}
|
|
|
}
|
|
|
},
|