提交 9bdee209 编写于 作者: zhentian.jia's avatar zhentian.jia

选择范围关联设定机构 科室 人员的逻辑 fix bug

上级 5cab5727
......@@ -9,7 +9,7 @@ export const envConfig = {
// baseUrl: 'https://test1-sc.yunqueyi.com/',
//baseUrl: 'https://uat-sc.yunqueyi.com/',
baseUrl: 'http://localhost:11905/portal/',
baseUrl: 'http://192.168.110.226:11905/portal/',
qiniuFileUrl: "http://localhost:10201/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
......
......@@ -216,15 +216,15 @@
:data="tableOrganization"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionOrganization"
@selection-change="selectionChangeOrganization"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="name" label="医院名称"></el-table-column>
<el-table-column prop="hospitalLevel" label="医院级别"></el-table-column>
<el-table-column prop="provinceName" label="所属省份"></el-table-column>
<el-table-column prop="cityName" label="所属城市"></el-table-column>
<el-table-column prop="countyName" label="所属区县"></el-table-column>
<el-table-column prop="townName" label="所属街道"></el-table-column>
<el-table-column prop="name" label="医院名称" min-width="100" align="center"></el-table-column>
<el-table-column prop="hospitalLevel" label="医院级别" align="center"></el-table-column>
<el-table-column prop="provinceName" label="所属省份" align="center"></el-table-column>
<el-table-column prop="cityName" label="所属城市" align="center"></el-table-column>
<el-table-column prop="countyName" label="所属区县" align="center"></el-table-column>
<el-table-column prop="townName" label="所属街道" align="center"></el-table-column>
</el-table>
<div class="pagination">
<el-pagination
......@@ -247,10 +247,10 @@
:data="tableDepartment"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange"
@selection-change="selectionChangeDepartment"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="name" label="科室名称"></el-table-column>
<el-table-column prop="name" label="科室名称" align="center"></el-table-column>
</el-table>
</el-col>
</el-tab-pane>
......@@ -300,15 +300,15 @@
:data="tablePerson"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange"
@selection-change="selectionChangePerson"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="name" label="人员名称"></el-table-column>
<el-table-column prop="hospitalName" label="所属医院"></el-table-column>
<el-table-column prop="departmentName" label="所属部门"></el-table-column>
<el-table-column prop="provinceName" label="所属省份"></el-table-column>
<el-table-column prop="cityName" label="所属城市"></el-table-column>
<el-table-column prop="countyName" label="所属区县" show-overflow-tooltip></el-table-column>
<el-table-column prop="name" label="人员名称" align="center"></el-table-column>
<el-table-column prop="hospitalName" label="所属医院" align="center"></el-table-column>
<el-table-column prop="departmentName" label="所属部门" align="center"></el-table-column>
<el-table-column prop="provinceName" label="所属省份" align="center"></el-table-column>
<el-table-column prop="cityName" label="所属城市" align="center"></el-table-column>
<el-table-column prop="countyName" label="所属区县" align="center"></el-table-column>
</el-table>
<div class="pagination">
<el-pagination
......@@ -395,6 +395,7 @@ import BreadCrumb from "../../components/breadcrumb.vue";
import { doUpload, getFilePath } from "../../utils/qiniuUtil";
import { returnData } from "../mock";
import { setTimeout } from "timers";
import { openLoading, closeLoading } from "../../utils/utils";
let vm = null;
export default {
components: {
......@@ -449,11 +450,15 @@ export default {
label: "label",
isLeaf: "isLeaf"
},
//treeData: [],
treeData: [],
tagsRegion: [],
//设定机构 数据
organizationChange: false,
checkTableState: {
multipleOrganization: true,
multipleDepartment: true,
multiplePerson: true
},
updatedOrganization: false,
formOrganization: {
name: "",
region: "",
......@@ -483,17 +488,20 @@ export default {
}
],
hasOrganizationInit: false,
//tableOrganization: Array(10).fill(itemOrganization),
tableOrganization: new Array(),
multipleSelectionOrganization: [],
currentOrganization: 1,
totalOrganization: 10,
pageSizeOrganization: 2,
changedOrganization: {},
//设定科室 数据
formDepartment: {
grade: ""
},
tableDepartment: [],
multipleSelectionDepartment: [],
updatedDepartment: false,
changedDepartment: {},
//设定人员 数据
formPersonnel: {
hospital: "",
......@@ -502,10 +510,12 @@ export default {
pageSize: 10
},
tablePerson: new Array(),
multipleSelectionPerson: [],
currentPerson: 1,
pageSizePerson: 2,
totalPerson: 10,
updatedPersonn: false,
changedPerson: {},
//选择项目组件 数据
optionsComponent: [],
optionsCertificate: [],
......@@ -582,8 +592,8 @@ export default {
},
created() {
vm = this;
this.projectId = vm.getUrlSearch(window.location.href, "projectId"),
this.editManager();
(this.projectId = vm.getUrlSearch(window.location.href, "projectId")),
this.editManager();
this.changeOnStep(this.active);
this.$nextTick(function() {
......@@ -1024,6 +1034,7 @@ export default {
//设定机构
this.getOrganization();
} else if (tabName == "third") {
this.$refs.multipleDepartment.toggleAllSelection();
//设定科室
} else if (tabName == "fourth") {
//设定人员
......@@ -1047,21 +1058,23 @@ export default {
//查询行政范围(树)
getAdministrative() {
let req = {
projectId: 54
projectId: this.projectId
};
openLoading(vm);
vm.GET("scope/v1/administrative", req).then(res => {
if (res.code == "000000") {
//console.log(res.data);
closeLoading(vm);
let administrativeAll = res.data.administrativeAll;
let administrative = res.data.administrative;
this.treeData = [];
this.treeData[0] = administrativeAll;
this.setTreeData(administrative);
console.log("treeData", this.treeData);
//console.log("treeData", this.treeData);
}
});
},
//列举选中地区
initCheckList(allSelectedKeys) {
this.tagsRegion = [];
......@@ -1088,7 +1101,10 @@ export default {
console.log("node:", node);
if (data.children.length == 0) {
let id = data.id + "add";
const newChild = [{ id: id, label: "testtest", children: [] },{ id: id, label: "22", children: [] }];
const newChild = [
{ id: id, label: "testtest", children: [] },
{ id: id, label: "22", children: [] }
];
//data.children.push(newChild);
let req = {
......@@ -1158,7 +1174,7 @@ export default {
this.initCheckList(allSelectedKeys);
//改变行政范围后,更新设定机构和设定人员
this.updateOrganizationAndPerson(allSelectedKeys);
this.organizationChange = true;
this.updatedTree = true;
},
// 递归删除列表中所有子节点
delSubKeysByNode(node, checkedKeys) {
......@@ -1211,58 +1227,186 @@ export default {
this.tagsRegion.splice(this.tagsRegion.indexOf(tag), 1);
this.setCheckedKeys(this.tagsRegion);
},
//获取反选数据
getDifference(a, b) {
if (a.constructor === Array && b.constructor === Array) {
let set1 = new Set(a);
let set2 = new Set(b);
return Array.from(new Set([...set1].filter(x => !set2.has(x))));
}
return null;
},
getReverseData(data, check) {
let reverse = [];
//console.log('data',data,'check',check);
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < check.length; j++) {
if (data[i].id !== check[j].id) {
reverse.push(data[i]);
}
}
}
return reverse;
},
//改变 设定机构选项
handleSelectionOrganization(val) {
selectionChangeOrganization(val) {
this.multipleSelectionOrganization = val;
//console.log(this.multipleSelectionOrganization);
this.updatePerson(this.multipleSelectionOrganization);
//console.log(val.length , this.formOrganization.pageSize , this.updatedOrganization)
if (
val.length != 0 &&
val.length != this.formOrganization.pageSize &&
this.updatedOrganization == false
) {
this.updatedOrganization = true;
console.log('机构被更新',this.updatedOrganization);
}
if(this.updatedOrganization == true) {
this.changedOrganization[this.formOrganization.pageNum] = [];
this.changedOrganization[
this.formOrganization.pageNum
][0] = this.multipleSelectionOrganization;
let reverse = this.getDifference(
this.tableOrganization,
this.multipleSelectionOrganization
);
this.changedOrganization[this.formOrganization.pageNum][1] = reverse;
console.log("check机构:", this.changedOrganization);
}
},
//改变机构 table 的check状态
selectionChangeDepartment(val) {
this.multipleSelectionDepartment = val;
console.log(this.multipleSelectionDepartment);
},
//改变 table的check状态
handleSelectionChange(val) {
this.multipleSelection = val;
//console.log(this.multipleSelection);
//改变人员 table的check状态
selectionChangePerson(val) {
this.multipleSelectionPerson = val;
//console.log(this.multipleSelectionPerson);
},
//设定机构table全选
checkAll(flag, name) {
console.log(flag + " " + name);
//console.log(flag + " " + name);
if (name == "multipleOrganization") {
this.changedOrganization = {};
} else if (name == "multiplePerson") {
this.changedPerson = {};
}
if (flag === true) {
this.$refs[name].toggleAllSelection();
if (this.checkTableState[name] === false) {
this.$refs[name].toggleAllSelection();
this.checkTableState[name] = true;
}
} else {
//this.$refs[name].clearSelection();
this.$refs[name].clearSelection();
this.checkTableState[name] = false;
}
},
//获取用户类型
getKind(type) {
let kind = 0;
if(type == 'organization') {
if(this.organizationChange) {
if (type == "administrative") {
if (this.updatedTree) {
kind = 3;
} else {
kind = 0;
}
} else if(type == '') {
} else if (type == "organization") {
if (this.checkTableState.multipleOrganization == true) {
//机构全选
kind = 1;
for(let key in this.changedOrganization) {
}
} else {
}
}
return kind;
},
//设定的行政范围内容
getScope(type) {
let scope = "";
if (type == "administrative") {
for (let i = 0; i < this.tagsRegion.length; i++) {
scope += this.tagsRegion[i].key;
if (i < this.tagsRegion.length - 1) {
scope += "|";
}
}
}
return scope;
},
//查询机构列表
getOrganization() {
let req = {
projectId: this.projectId,
setKind: this.getKind('organization'),
setKind: this.getKind("administrative"),
// scope: "000_110",
pageNum: this.formOrganization.pageNum,
pageSize: this.formOrganization.pageSize
};
if(req.setKind == 3) {
req.scope = '000_110';
console.log('tagsRegion',this.tagsRegion);
if (req.setKind == 3) {
req.scope = this.getScope("administrative");
}
openLoading(vm);
vm.GET("scope/v1/organization", req).then(res => {
if (res.code == "000000") {
console.log(res.data);
closeLoading(vm);
//console.log(res.data);
this.tableOrganization = res.data.organizationList;
this.$refs.multipleOrganization.toggleAllSelection();
this.totalOrganization = res.data.total;
console.log("changedOrganization", this.changedOrganization);
//console.log('机构状态:'+this.checkTableState.multipleOrganization);
if (this.checkTableState.multipleOrganization == true) {
//全选
if (
this.updatedOrganization == true &&
this.changedOrganization[this.formOrganization.pageNum] !=
undefined
) {
//机构table 勾选被更新过
let rowCheck = this.changedOrganization[
this.formOrganization.pageNum
][0];
//console.log("rowCheck:",rowCheck);
rowCheck.forEach(row => {
// console.log("row", row);
let rowItem = {};
for (let i = 0; i < this.tableOrganization.length; i++) {
if (this.tableOrganization[i].id == row.id) {
rowItem = this.tableOrganization[i];
}
}
this.$nextTick(function() {
this.$refs.multipleOrganization.toggleRowSelection(rowItem);
});
});
} else {
this.$refs.multipleOrganization.toggleAllSelection();
}
} else {
//全不选
if (
this.updatedOrganization == true &&
this.changedOrganization[this.formOrganization.pageNum] !=
undefined
) {
let rowCheck = this.changedOrganization[
this.formOrganization.pageNum
][0];
//console.log("rowCheck:",rowCheck);
rowCheck.forEach(row => {
// console.log("row", row);
let rowItem = {};
for (let i = 0; i < this.tableOrganization.length; i++) {
if (this.tableOrganization[i].id == row.id) {
rowItem = this.tableOrganization[i];
}
}
this.$nextTick(function() {
this.$refs.multipleOrganization.toggleRowSelection(rowItem);
});
});
}
}
}
});
},
......@@ -1280,16 +1424,19 @@ export default {
//查询人员列表
getPeople() {
let req = {
projectId: 1,
setKindOfAdministrative: 3,
scopeOfAdministrative: "000_110",
setKindOfOrganization: 3,
projectId: this.projectId,
setKindOfAdministrative: this.getKind("administrative"),
//scopeOfAdministrative: "000_110",
setKindOfOrganization: this.getKind("organization"),
scopeOfOrganization: "2|3|4|5|6|7",
setKindOfDepartment: 3,
scopeOfDepartment: 54,
pageNum: this.formPersonnel.pageNum,
pageSize: this.formPersonnel.pageSize
};
if (req.setKindOfAdministrative == 3) {
req.scopeOfAdministrative = this.getScope("administrative");
}
vm.GET("scope/v1/people", req).then(res => {
if (res.code == "000000") {
console.log(res.code);
......@@ -1305,7 +1452,7 @@ export default {
this.formOrganization.pageSize = val;
},
handleCurrentOrganization(val) {
console.log(`当前页: ${val}`);
//console.log(`当前页: ${val}`);
this.formOrganization.pageNum = val;
this.getOrganization();
},
......@@ -1447,6 +1594,12 @@ export default {
.el-tree-node__expand-icon {
display: none;
}
.el-table__header-wrapper {
.el-checkbox__inner {
//display: none;
//visibility: hidden;
}
}
.department {
margin-top: 20px;
border: 1px solid #dddddd;
......
......@@ -50,7 +50,7 @@
:data="tableData"
:header-cell-style="{background:'#FAFAFA',color:'#000'}"
>
<el-table-column prop="createdId" label="ID编号" min-width="100" align="center"></el-table-column>
<el-table-column prop="id" label="ID编号" min-width="100" align="center"></el-table-column>
<el-table-column prop="projectName" label="项目名称" min-width="100" align="center"></el-table-column>
<el-table-column prop="createdName" label="创建人" align="center"></el-table-column>
<el-table-column prop="projectIntro" label="项目简介" align="center"></el-table-column>
......
......@@ -232,7 +232,8 @@ export default {
portalProjectId: this.formInline.portalProjectId,
updateL: this.scopeRow.updateL,
userId: this.scopeRow.userId,
numL2: this.numL2
numL2: this.numL2,
nowL: this.scopeRow.projeceRole
};
vm.GET("portalProjectOrRole/roleLevelUpdate", req).then(res => {
this.dialog.show = false;
......
......@@ -33,7 +33,7 @@
:data="tableData"
:header-cell-style="{background:'#FAFAFA',color:'#000'}"
>
<el-table-column prop="createdId" label="ID编号" min-width="100" align="center"></el-table-column>
<el-table-column prop="id" label="ID编号" min-width="100" align="center"></el-table-column>
<el-table-column prop="projectName" label="项目名称" min-width="100" align="center"></el-table-column>
<el-table-column prop="createdName" label="创建人" align="center"></el-table-column>
<el-table-column prop="projectIntro" label="项目简介" align="center"></el-table-column>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册