diff --git a/.env.development b/.env.development
index b3b3992..48a5a2c 100644
--- a/.env.development
+++ b/.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机构管理
diff --git a/.env.production b/.env.production
index 0638ab0..77ad372 100644
--- a/.env.production
+++ b/.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机构管理
diff --git a/src/components/RightPage/RightPage.vue b/src/components/RightPage/RightPage.vue
index f9caf56..f289452 100644
--- a/src/components/RightPage/RightPage.vue
+++ b/src/components/RightPage/RightPage.vue
@@ -13,7 +13,7 @@
@@ -71,17 +71,17 @@
-
+
已选角色:
-
+
{{ tagItem.rname }}
@@ -89,8 +89,8 @@
可选角色:
-
-
+
+
{{ tagItem.name }}
@@ -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') {
diff --git a/src/components/RightPage/TreeNode.vue b/src/components/RightPage/TreeNode.vue
index 82d1589..669367b 100644
--- a/src/components/RightPage/TreeNode.vue
+++ b/src/components/RightPage/TreeNode.vue
@@ -33,7 +33,7 @@