|
|
@ -101,14 +101,14 @@ |
|
|
|
</a-tab-pane> |
|
|
|
</a-tabs> |
|
|
|
<ns-button style="margin: 20px" type="primary" @click="CancelUser">取消</ns-button> |
|
|
|
<ns-button type="primary" @click="UserSure">{{ disabled2 ? '编辑' : '确定' }}</ns-button> |
|
|
|
<ns-button type="primary" @click="UserSure"> 确定</ns-button> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script lang="ts"> |
|
|
|
import { createVNode, defineComponent, reactive, ref, watch } from 'vue'; |
|
|
|
import { createVNode, defineComponent, reactive, ref, watch, watchEffect } from 'vue'; |
|
|
|
import { Modal } from 'ant-design-vue'; |
|
|
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; |
|
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
@ -142,6 +142,10 @@ |
|
|
|
const apartmentTreeData = ref([]); |
|
|
|
|
|
|
|
const userTreeData = ref([]); |
|
|
|
const getPermissionTree = (params) => { |
|
|
|
return http.post(permission.permissionTree, params); |
|
|
|
}; |
|
|
|
getPermissionTree({ projectId }); |
|
|
|
|
|
|
|
const apartmentAdminTreeData = [ |
|
|
|
{ |
|
|
@ -186,12 +190,16 @@ |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const getUserTree = (params = { deptId: 2 }) => { |
|
|
|
const getUserTree = (params = { deptId: selectRef.value.deptInfo.deptId }) => { |
|
|
|
http.post(department.queryRoleTree, params).then((res) => { |
|
|
|
userTreeData.value = res.data; |
|
|
|
}); |
|
|
|
}; |
|
|
|
getUserTree({ deptId: 2 }); |
|
|
|
// 根据依赖刷新角色树 |
|
|
|
watchEffect(() => { |
|
|
|
if (selectRef.value) getUserTree(); |
|
|
|
}); |
|
|
|
|
|
|
|
const opMap: any = { |
|
|
|
type: 'add', |
|
|
|
fuc: () => {}, |
|
|
@ -234,15 +242,14 @@ |
|
|
|
const addUser = () => { |
|
|
|
disabled2.value = false; |
|
|
|
opMap.type = 'addUser'; |
|
|
|
formData.value = {}; |
|
|
|
formData2.value = {}; |
|
|
|
opMap.fuc = (params) => { |
|
|
|
delete params.roleId; |
|
|
|
return http.post(department.addRole, { |
|
|
|
...params, |
|
|
|
orgId, |
|
|
|
projectId, |
|
|
|
enName: 'leader', |
|
|
|
roleNote: 'wqe', |
|
|
|
deptId: selectRef.value.deptInfo.deptId, |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -250,17 +257,15 @@ |
|
|
|
const addUserSon = () => { |
|
|
|
disabled.value = false; |
|
|
|
opMap.type = 'addUserSon'; |
|
|
|
formData.value = {}; |
|
|
|
formData2.value = {}; |
|
|
|
opMap.fuc = (params) => { |
|
|
|
delete params.roleId; |
|
|
|
delete params.proleId; |
|
|
|
return http.post(department.addRole, { |
|
|
|
...params, |
|
|
|
proleId: 4, |
|
|
|
orgId, |
|
|
|
projectId, |
|
|
|
enName: 'leader', |
|
|
|
roleNote: 'wqe', |
|
|
|
proleId: selectRef2.value.roleId, |
|
|
|
deptId: selectRef.value.deptInfo.deptId, |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -295,7 +300,7 @@ |
|
|
|
content: createVNode('div', { style: 'color:red;' }, ''), |
|
|
|
onOk() { |
|
|
|
http.post(department.delRole, { roleId: selectRef2.value.roleId }).then(() => { |
|
|
|
getUserTree(); |
|
|
|
getUserTree({ deptId: selectRef.value.deptInfo.deptId }); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
@ -322,7 +327,7 @@ |
|
|
|
return http.post(department.deptEdit, params); |
|
|
|
}; |
|
|
|
|
|
|
|
getUserTree({ deptId: selectRef.value.deptInfo.deptId }); |
|
|
|
// getUserTree({ deptId: selectRef.value.deptInfo.deptId }); |
|
|
|
}; |
|
|
|
|
|
|
|
// 角色选择 |
|
|
@ -334,6 +339,10 @@ |
|
|
|
selectKey2.value = selectedKeys[0]; |
|
|
|
selectRef2.value = info.node.dataRef; |
|
|
|
formData2.value = cloneDeep(info.node.dataRef); |
|
|
|
opMap.type = 'editRole'; |
|
|
|
opMap.fuc = (params) => { |
|
|
|
return http.post(department.editRole, params); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
const CancelApartment = () => { |
|
|
@ -377,9 +386,12 @@ |
|
|
|
disabled2.value = !disabled2.value; |
|
|
|
console.log(formData2.value, 'formData2'); |
|
|
|
console.log(opMap.type, 'opMap.type'); |
|
|
|
const typeArr = ['addUserSon', 'addUser']; |
|
|
|
const typeArr = ['addUserSon', 'addUser', 'editRole']; |
|
|
|
if (typeArr.includes(opMap.type)) { |
|
|
|
opMap.fuc && opMap.fuc(formData2.value); |
|
|
|
opMap.fuc && |
|
|
|
opMap.fuc(formData2.value).then(() => { |
|
|
|
getUserTree(); |
|
|
|
}); |
|
|
|
} else if (selectRef2.value && opMap.type === 'addson') |
|
|
|
selectRef2.value['children'] = [ |
|
|
|
{ |
|
|
|