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_API_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_TITLE=暴风眼Typhoneye机构管理
VUE_APP_DESCRIPTION=暴风眼Typhoneye机构管理

10
.env.production

@ -1,10 +1,10 @@
VUE_APP_MODE=production
VUE_APP_NODE_ENV=production
VUE_APP_SCENE=flat-car
VUE_APP_BASE_URL=https://www.tall.wiki/
VUE_APP_API_URL=https://www.tall.wiki
VUE_APP_PROXY_URL=https://www.tall.wiki
VUE_APP_PUBLIC_PATH=/carbasics
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws
VUE_APP_BASE_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_PUBLIC_PATH=/management
VUE_APP_MSG_URL=ws://101.201.226.163/websocket/message/v4.0/ws
VUE_APP_TITLE=暴风眼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>
<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>
</div>
</div>
@ -71,17 +71,17 @@
</a-form-item>
</a-form>
</a-modal>
<a-modal :visible="roleModal" title="修改关联角色" @cancel="roleModal = false" @ok="handleOk">
<a-modal :visible="roleModal" title="修改关联角色" @cancel="roleModal = false" @ok="changeRoleList">
<div>
<h2>已选角色:</h2>
<template v-if="changeRoleInfo.roleList">
<template v-if="chooseRoleList.length">
<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)"
v-for="tagItem in chooseRoleList"
:key="tagItem.rid"
@close="delRole(tagItem.rid)"
>
{{ tagItem.rname }}
</a-tag>
@ -89,8 +89,8 @@
</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)">
<template v-if="allRoleList.length">
<a-tag class="my-2 mx-2" v-for="tagItem in allRoleList" :key="tagItem.typeId" @click="chooseRole(tagItem.typeId)">
{{ tagItem.name }}
</a-tag>
</template>
@ -169,6 +169,8 @@ export default {
parentId: '',
departmentId: '',
positionName: '',
chooseRoleList: [],
allRoleList: [],
};
},
computed: { ...mapState('home', ['hospitalInfo', 'level', 'area', 'roleList']) },
@ -181,32 +183,78 @@ 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);
//
chooseRole(id) {
const arr = [...this.allRoleList];
const arr1 = [...this.chooseRoleList];
for (let i = 0; i < arr.length; i++) {
if (arr[i].typeId === id) {
const obj = {
rid: arr[i].typeId,
rname: arr[i].name,
};
arr1.push(obj);
arr.splice(i, 1);
}
if (type === 0) {
positionTypeIdList.push(id);
} else if (type === 1) {
positionTypeIdList = positionTypeIdList.filter(item => {
return item !== id;
});
}
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 < 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);
}
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 = {
param: {
@ -217,14 +265,15 @@ export default {
const res = await bindPositionType(params);
const { code, msg } = res.data;
if (code === 200) {
this.changeRoleInfo.roleList = [...newRoleArr];
this.$message.success('修改成功');
this.getHospitalInfo();
this.roleModal = false;
} else {
this.$message.warning('添加错误:', msg);
this.$message.warning('修改错误:', msg);
}
} catch (error) {
this.$message.warning('添加错误:', error);
this.$message.warning('修改错误:', error);
}
console.log(id);
},
// modal
editDepartmentModal(item) {
@ -236,7 +285,13 @@ export default {
//
async editDepartment() {
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 { code, msg, data } = res.data;
if (code === 200) {
@ -252,15 +307,22 @@ export default {
},
// modal
editPositionModal(item) {
editPositionModal(item, did) {
this.positionInfo = item;
this.positionInfo.did = did;
this.positionName = this.positionInfo.pname;
this.positionModal = true;
},
//
async editPosition() {
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 { code, msg, data } = res.data;
if (code === 200) {
@ -274,11 +336,6 @@ export default {
this.$message.error(e);
}
},
// modal
changeRole(item) {
this.changeRoleInfo = item;
this.roleModal = true;
},
///
async addPosition() {
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" />
<template slot="content">
<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
placement="left"
title="确定删除此数据吗?"
@ -152,8 +152,9 @@ export default {
this.$emit('editDepartmentModal', item);
},
//
editPositionModal(item) {
this.$emit('editPositionModal', item);
editPositionModal(item, did) {
console.log('item,pid: ', item, did);
this.$emit('editPositionModal', item, did);
},
//
async delpartment(item) {

Loading…
Cancel
Save