Browse Source

机构管理接口对接完成

master
aBin 4 years ago
parent
commit
bf21151913
  1. 2
      .env.development
  2. 10
      .env.production
  3. 141
      src/components/RightPage/RightPage.vue
  4. 7
      src/components/RightPage/TreeNode.vue

2
.env.development

@ -4,7 +4,7 @@ VUE_APP_SCENE=flat-car
VUE_APP_BASE_URL=http://101.201.226.163 VUE_APP_BASE_URL=http://101.201.226.163
VUE_APP_API_URL=http://101.201.226.163 VUE_APP_API_URL=http://101.201.226.163
VUE_APP_PROXY_URL=http://101.201.226.163 VUE_APP_PROXY_URL=http://101.201.226.163
VUE_APP_PUBLIC_PATH=/carbasics VUE_APP_PUBLIC_PATH=/management
VUE_APP_MSG_URL=ws://101.201.226.163/websocket/message/v4.0/ws VUE_APP_MSG_URL=ws://101.201.226.163/websocket/message/v4.0/ws
VUE_APP_TITLE=暴风眼Typhoneye机构管理 VUE_APP_TITLE=暴风眼Typhoneye机构管理
VUE_APP_DESCRIPTION=暴风眼Typhoneye机构管理 VUE_APP_DESCRIPTION=暴风眼Typhoneye机构管理

10
.env.production

@ -1,10 +1,10 @@
VUE_APP_MODE=production VUE_APP_MODE=production
VUE_APP_NODE_ENV=production VUE_APP_NODE_ENV=production
VUE_APP_SCENE=flat-car VUE_APP_SCENE=flat-car
VUE_APP_BASE_URL=https://www.tall.wiki/ VUE_APP_BASE_URL=http://101.201.226.163/
VUE_APP_API_URL=https://www.tall.wiki VUE_APP_API_URL=http://101.201.226.163
VUE_APP_PROXY_URL=https://www.tall.wiki VUE_APP_PROXY_URL=http://101.201.226.163
VUE_APP_PUBLIC_PATH=/carbasics VUE_APP_PUBLIC_PATH=/management
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws VUE_APP_MSG_URL=ws://101.201.226.163/websocket/message/v4.0/ws
VUE_APP_TITLE=暴风眼Typhoneye机构管理 VUE_APP_TITLE=暴风眼Typhoneye机构管理
VUE_APP_DESCRIPTION=暴风眼Typhoneye机构管理 VUE_APP_DESCRIPTION=暴风眼Typhoneye机构管理

141
src/components/RightPage/RightPage.vue

@ -13,7 +13,7 @@
<div class="cursor-pointer d-flex align-center" @click="open"><a-icon class="mr-2" type="menu-fold" />全部展开</div> <div class="cursor-pointer d-flex align-center" @click="open"><a-icon class="mr-2" type="menu-fold" />全部展开</div>
</div> </div>
<div class="d-flex align-center"> <div class="d-flex align-center">
<a-input-search style="width: 260px" class="mr-4" placeholder="搜索部门/职位/角色" @change="onChange" /> <!-- <a-input-search style="width: 260px" class="mr-4" placeholder="搜索部门/职位/角色" @change="onChange" /> -->
<a-button type="primary" icon="plus" @click="createDepartment">新建部门</a-button> <a-button type="primary" icon="plus" @click="createDepartment">新建部门</a-button>
</div> </div>
</div> </div>
@ -71,17 +71,17 @@
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
<a-modal :visible="roleModal" title="修改关联角色" @cancel="roleModal = false" @ok="handleOk"> <a-modal :visible="roleModal" title="修改关联角色" @cancel="roleModal = false" @ok="changeRoleList">
<div> <div>
<h2>已选角色:</h2> <h2>已选角色:</h2>
<template v-if="changeRoleInfo.roleList"> <template v-if="chooseRoleList.length">
<a-tag <a-tag
class="my-2 mx-2" class="my-2 mx-2"
color="#2db7f5" color="#2db7f5"
closable closable
v-for="tagItem in changeRoleInfo.roleList" v-for="tagItem in chooseRoleList"
:key="tagItem.rId" :key="tagItem.rid"
@close="chooseRole(tagItem.rid, 1, tagItem.rname)" @close="delRole(tagItem.rid)"
> >
{{ tagItem.rname }} {{ tagItem.rname }}
</a-tag> </a-tag>
@ -89,8 +89,8 @@
</div> </div>
<div> <div>
<h2>可选角色:</h2> <h2>可选角色:</h2>
<template v-if="roleList.length"> <template v-if="allRoleList.length">
<a-tag class="my-2 mx-2" v-for="tagItem in roleList" :key="tagItem.typeId" @click="chooseRole(tagItem.typeId, 0, tagItem.name)"> <a-tag class="my-2 mx-2" v-for="tagItem in allRoleList" :key="tagItem.typeId" @click="chooseRole(tagItem.typeId)">
{{ tagItem.name }} {{ tagItem.name }}
</a-tag> </a-tag>
</template> </template>
@ -169,6 +169,8 @@ export default {
parentId: '', parentId: '',
departmentId: '', departmentId: '',
positionName: '', positionName: '',
chooseRoleList: [],
allRoleList: [],
}; };
}, },
computed: { ...mapState('home', ['hospitalInfo', 'level', 'area', 'roleList']) }, computed: { ...mapState('home', ['hospitalInfo', 'level', 'area', 'roleList']) },
@ -181,32 +183,78 @@ export default {
this.getHospitalInfo(); this.getHospitalInfo();
}, },
methods: { methods: {
// //
// type: 0() 1() chooseRole(id) {
async chooseRole(id, type, name) { const arr = [...this.allRoleList];
try { const arr1 = [...this.chooseRoleList];
let positionTypeIdList = []; for (let i = 0; i < arr.length; i++) {
let newRoleArr = []; if (arr[i].typeId === id) {
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 = { const obj = {
rid: this.roleList[i].typeId, rid: arr[i].typeId,
rname: this.roleList[i].name, rname: arr[i].name,
}; };
newRoleArr.push(obj); arr1.push(obj);
arr.splice(i, 1);
}
}
this.allRoleList = [...arr];
this.chooseRoleList = [...arr1];
},
//
delRole(id) {
const arr = [...this.chooseRoleList];
const arr1 = [...this.roleList];
let arr2 = [...this.allRoleList];
for (let i = 0; i < arr.length; i++) {
if (arr[i].rid === id) {
arr.splice(i, 1);
}
}
for (let i = 0; i < arr1.length; i++) {
if (arr1[i].typeId === id) {
arr2.push(arr1[i]);
}
}
this.chooseRoleList = [...arr];
this.allRoleList = [...arr2];
},
// modal
changeRole(item) {
this.changeRoleInfo = item;
this.chooseRoleList = item.roleList;
this.getAllRole();
this.roleModal = true;
},
// ()
getAllRole() {
let newArr = [];
const arr = [...this.roleList];
const arr1 = [...this.chooseRoleList];
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
if (arr1.length) {
for (let j = 0; j < arr1.length; j++) {
const role = arr1[j];
if (item.typeId === role.rid) {
break;
} else if (item.typeId !== role.rid && j === arr1.length - 1) {
newArr.push(item);
} }
} }
} else {
newArr = [...arr];
}
}
this.allRoleList = [...newArr];
},
//
async changeRoleList() {
try {
let positionTypeIdList = [];
if (this.chooseRoleList.length) {
for (let i = 0; i < this.chooseRoleList.length; i++) {
positionTypeIdList.push(this.chooseRoleList[i].rid);
}
} }
const params = { const params = {
param: { param: {
@ -217,14 +265,15 @@ export default {
const res = await bindPositionType(params); const res = await bindPositionType(params);
const { code, msg } = res.data; const { code, msg } = res.data;
if (code === 200) { if (code === 200) {
this.changeRoleInfo.roleList = [...newRoleArr]; this.$message.success('修改成功');
this.getHospitalInfo();
this.roleModal = false;
} else { } else {
this.$message.warning('添加错误:', msg); this.$message.warning('修改错误:', msg);
} }
} catch (error) { } catch (error) {
this.$message.warning('添加错误:', error); this.$message.warning('修改错误:', error);
} }
console.log(id);
}, },
// modal // modal
editDepartmentModal(item) { editDepartmentModal(item) {
@ -236,7 +285,13 @@ export default {
// //
async editDepartment() { async editDepartment() {
try { try {
const params = { param: { did: this.departmentInfo.did, departmentName: this.departmentName } }; const params = {
param: {
did: this.departmentInfo.did,
departmentName: this.departmentName,
oid: this.hospitalInfo.id,
},
};
const res = await updateDepartment(params); const res = await updateDepartment(params);
const { code, msg, data } = res.data; const { code, msg, data } = res.data;
if (code === 200) { if (code === 200) {
@ -252,15 +307,22 @@ export default {
}, },
// modal // modal
editPositionModal(item) { editPositionModal(item, did) {
this.positionInfo = item; this.positionInfo = item;
this.positionInfo.did = did;
this.positionName = this.positionInfo.pname; this.positionName = this.positionInfo.pname;
this.positionModal = true; this.positionModal = true;
}, },
// //
async editPosition() { async editPosition() {
try { try {
const params = { param: { positionId: this.positionInfo.pid, positionName: this.positionName } }; const params = {
param: {
positionId: this.positionInfo.pid,
positionName: this.positionName,
departmentId: this.positionInfo.did,
},
};
const res = await updatePosition(params); const res = await updatePosition(params);
const { code, msg, data } = res.data; const { code, msg, data } = res.data;
if (code === 200) { if (code === 200) {
@ -274,11 +336,6 @@ export default {
this.$message.error(e); this.$message.error(e);
} }
}, },
// modal
changeRole(item) {
this.changeRoleInfo = item;
this.roleModal = true;
},
/// ///
async addPosition() { async addPosition() {
if (this.addType === 'department') { if (this.addType === 'department') {

7
src/components/RightPage/TreeNode.vue

@ -33,7 +33,7 @@
<a-icon class="mr-2" :style="{ fontSize: '20px' }" v-if="isSelect === item.did + itemA.pid" type="more" /> <a-icon class="mr-2" :style="{ fontSize: '20px' }" v-if="isSelect === item.did + itemA.pid" type="more" />
<template slot="content"> <template slot="content">
<div class="d-flex align-center"> <div class="d-flex align-center">
<a-button type="primary" class="mr-2" @click="editPositionModal(itemA)"> 修改 </a-button> <a-button type="primary" class="mr-2" @click="editPositionModal(itemA, item.did)"> 修改 </a-button>
<a-popconfirm <a-popconfirm
placement="left" placement="left"
title="确定删除此数据吗?" title="确定删除此数据吗?"
@ -152,8 +152,9 @@ export default {
this.$emit('editDepartmentModal', item); this.$emit('editDepartmentModal', item);
}, },
// //
editPositionModal(item) { editPositionModal(item, did) {
this.$emit('editPositionModal', item); console.log('item,pid: ', item, did);
this.$emit('editPositionModal', item, did);
}, },
// //
async delpartment(item) { async delpartment(item) {

Loading…
Cancel
Save