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