|
|
@ -24,9 +24,6 @@ |
|
|
|
v-if="treeData.length" |
|
|
|
:tree-data="treeData" |
|
|
|
@showAddItem="showAddItem" |
|
|
|
@showEditItem="showEditItem" |
|
|
|
@showAddMember="showAddMember" |
|
|
|
@showEditMember="showEditMember" |
|
|
|
@changeRole="changeRole" |
|
|
|
@editPositionModal="editPositionModal" |
|
|
|
@editDepartmentModal="editDepartmentModal" |
|
|
@ -41,18 +38,13 @@ |
|
|
|
</a-form> |
|
|
|
{{ addId }} |
|
|
|
</a-modal> |
|
|
|
<a-modal :visible="editDepartmentVisible" title="aaa" @cancel="editDepartmentVisible = false" @ok="editDepartment"> |
|
|
|
<a-modal :visible="editDepartmentVisible" title="修改部门信息" @cancel="editDepartmentVisible = false" @ok="editDepartment"> |
|
|
|
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> |
|
|
|
<a-form-item label="部门名称"> |
|
|
|
<a-input v-model="departmentName" placeholder="部门名称" /> |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
</a-modal> |
|
|
|
<a-modal :visible="visible1" title="添加成员" @cancel="visible1 = false" @ok="handleOk"> |
|
|
|
添加成员 |
|
|
|
{{ addId }} |
|
|
|
</a-modal> |
|
|
|
<a-modal :visible="visible3" title="修改成员信息" @cancel="visible3 = false" @ok="handleOk"> 修改成员信息 </a-modal> |
|
|
|
<a-modal :visible="visible4" title="修改医院信息" @cancel="visible4 = false" @ok="editHospInfoApi"> |
|
|
|
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> |
|
|
|
<a-form-item label="省"> |
|
|
@ -80,8 +72,29 @@ |
|
|
|
</a-form> |
|
|
|
</a-modal> |
|
|
|
<a-modal :visible="roleModal" title="修改关联角色" @cancel="roleModal = false" @ok="handleOk"> |
|
|
|
关联角色信息 |
|
|
|
{{ changeRoleId }} |
|
|
|
<div> |
|
|
|
<h2>已选角色:</h2> |
|
|
|
<template v-if="changeRoleInfo.roleList"> |
|
|
|
<a-tag |
|
|
|
class="my-2 mx-2" |
|
|
|
color="#2db7f5" |
|
|
|
closable |
|
|
|
v-for="tagItem in changeRoleInfo.roleList" |
|
|
|
:key="tagItem.rId" |
|
|
|
@close="chooseRole(tagItem.rid, 1, tagItem.rname)" |
|
|
|
> |
|
|
|
{{ tagItem.rname }} |
|
|
|
</a-tag> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<h2>可选角色:</h2> |
|
|
|
<template v-if="roleList.length"> |
|
|
|
<a-tag class="my-2 mx-2" v-for="tagItem in roleList" :key="tagItem.typeId" @click="chooseRole(tagItem.typeId, 0, tagItem.name)"> |
|
|
|
{{ tagItem.name }} |
|
|
|
</a-tag> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</a-modal> |
|
|
|
<a-modal :visible="positionModal" title="修改职位信息" @cancel="positionModal = false" @ok="editPosition"> |
|
|
|
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> |
|
|
@ -89,8 +102,6 @@ |
|
|
|
<a-input v-model="positionName" placeholder="职位名称" /> |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
|
|
|
|
<span v-if="positionInfo">{{ positionInfo.pname }}</span> |
|
|
|
</a-modal> |
|
|
|
<!-- 添加部门/职位 --> |
|
|
|
<a-modal :visible="visibleAddPosition" title="添加部门/职位" @cancel="visibleAddPosition = false" @ok="addPosition"> |
|
|
@ -108,13 +119,22 @@ |
|
|
|
<a-input v-model="positionName" placeholder="职位名称" /> |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
{{ addId }} |
|
|
|
</a-modal> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { mapState } from 'vuex'; |
|
|
|
import { queryHospitalInfo, editHospitalInfo, queryHospitalById, addDepartment, addPosition, updateDepartment, updatePosition } from 'config/api'; |
|
|
|
import { bindPositionType } from 'config/api'; |
|
|
|
|
|
|
|
import { |
|
|
|
queryHospitalInfo, |
|
|
|
editHospitalInfo, |
|
|
|
queryHospitalById, |
|
|
|
addDepartment, |
|
|
|
addPosition, |
|
|
|
updateDepartment, |
|
|
|
updatePosition, |
|
|
|
} from 'config/api'; |
|
|
|
import TreeNode from './TreeNode.vue'; |
|
|
|
|
|
|
|
export default { |
|
|
@ -126,9 +146,6 @@ export default { |
|
|
|
treeData: [], |
|
|
|
isSelect: '', |
|
|
|
visible: false, |
|
|
|
visible1: false, |
|
|
|
visible2: false, |
|
|
|
visible3: false, |
|
|
|
visible4: false, |
|
|
|
roleModal: false, |
|
|
|
positionModal: false, |
|
|
@ -143,7 +160,7 @@ export default { |
|
|
|
cityId: '', |
|
|
|
countyId: '', |
|
|
|
id: '', |
|
|
|
changeRoleId: '', |
|
|
|
changeRoleInfo: {}, |
|
|
|
positionInfo: null, |
|
|
|
departmentInfo: null, |
|
|
|
addType: 'department', |
|
|
@ -154,7 +171,7 @@ export default { |
|
|
|
positionName: '', |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { ...mapState('home', ['hospitalInfo', 'level', 'area']) }, |
|
|
|
computed: { ...mapState('home', ['hospitalInfo', 'level', 'area', 'roleList']) }, |
|
|
|
watch: { |
|
|
|
hospitalInfo() { |
|
|
|
this.getHospitalInfo(); |
|
|
@ -164,6 +181,51 @@ export default { |
|
|
|
this.getHospitalInfo(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 添加关联角色 |
|
|
|
// type: 0(增加) 1(删除) |
|
|
|
async chooseRole(id, type, name) { |
|
|
|
try { |
|
|
|
let positionTypeIdList = []; |
|
|
|
let newRoleArr = []; |
|
|
|
for (let i = 0; i < this.changeRoleInfo.roleList.length; i++) { |
|
|
|
positionTypeIdList.push(this.changeRoleInfo.roleList[i].rid); |
|
|
|
} |
|
|
|
if (type === 0) { |
|
|
|
positionTypeIdList.push(id); |
|
|
|
} else if (type === 1) { |
|
|
|
positionTypeIdList = positionTypeIdList.filter(item => { |
|
|
|
return item !== id; |
|
|
|
}); |
|
|
|
} |
|
|
|
for (let i = 0; i < this.roleList.length; i++) { |
|
|
|
for (let j = 0; j < positionTypeIdList.length; j++) { |
|
|
|
if (this.roleList[i].typeId === positionTypeIdList[j]) { |
|
|
|
const obj = { |
|
|
|
rid: this.roleList[i].typeId, |
|
|
|
rname: this.roleList[i].name, |
|
|
|
}; |
|
|
|
newRoleArr.push(obj); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const params = { |
|
|
|
param: { |
|
|
|
positionId: this.changeRoleInfo.pid, |
|
|
|
positionTypeIdList, |
|
|
|
}, |
|
|
|
}; |
|
|
|
const res = await bindPositionType(params); |
|
|
|
const { code, msg } = res.data; |
|
|
|
if (code === 200) { |
|
|
|
this.changeRoleInfo.roleList = [...newRoleArr]; |
|
|
|
} else { |
|
|
|
this.$message.warning('添加错误:', msg); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.warning('添加错误:', error); |
|
|
|
} |
|
|
|
console.log(id); |
|
|
|
}, |
|
|
|
// 显示修改部门的modal框 |
|
|
|
editDepartmentModal(item) { |
|
|
|
this.departmentInfo = item; |
|
|
@ -206,15 +268,15 @@ export default { |
|
|
|
this.positionModal = false; |
|
|
|
this.getHospitalInfo(); |
|
|
|
} else { |
|
|
|
this.$message.warning(msg) |
|
|
|
this.$message.warning(msg); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
this.$message.error(e); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 显示关联角色modal框 |
|
|
|
changeRole(id) { |
|
|
|
this.changeRoleId = id; |
|
|
|
changeRole(item) { |
|
|
|
this.changeRoleInfo = item; |
|
|
|
this.roleModal = true; |
|
|
|
}, |
|
|
|
//新建职位/子部门 |
|
|
@ -365,7 +427,7 @@ export default { |
|
|
|
this.$message.error('医院详情查询失败:', error); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 添加职位/角色 |
|
|
|
// 关联角色信息点击确定 |
|
|
|
handleOk() { |
|
|
|
this.visible = false; |
|
|
|
}, |
|
|
@ -374,21 +436,6 @@ export default { |
|
|
|
this.addId = id; |
|
|
|
this.visibleAddPosition = true; |
|
|
|
}, |
|
|
|
// 修改部门/职位modal框 |
|
|
|
showEditItem(item) { |
|
|
|
console.log('item: ', item); |
|
|
|
this.visible2 = true; |
|
|
|
}, |
|
|
|
// 添加成员modal框 |
|
|
|
showAddMember(id) { |
|
|
|
this.addId = id; |
|
|
|
this.visible1 = true; |
|
|
|
}, |
|
|
|
// 修改成员modal框 |
|
|
|
showEditMember(item) { |
|
|
|
console.log('item: ', item); |
|
|
|
this.visible3 = true; |
|
|
|
}, |
|
|
|
// 搜索部门/职位/角色 |
|
|
|
onChange(e) { |
|
|
|
const value = e.target.value; |
|
|
|