提交 768eeacf 编写于 作者: zhentian.jia's avatar zhentian.jia

fix bug

上级 42c552a8
//求并集
export function getUnion(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,...set2]));
}
return null;
}
//求差集
export function 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;
}
//求交集
export function getIntersect(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;
}
//获取id的list
export function getIdList(data) {
let list = [];
for(let i=0;i<data.length;i++) {
list.push(data[i].id);
}
return list;
}
//区域
export function getAdministrative(data) {
let list = data.split('|');
//for(let i)
......@@ -13,24 +49,66 @@ export function getLevelList(data) {
}
level.push(obj);
}
console.log(level);
//console.log(level);
return level;
}
function recursiveTraverse (node) {
function inTags(id,tags) {
let flag = false;
for(let i = 0;i<tags.length;i++) {
if(tags[i].key == id) {
flag = true;
}
}
return flag;
}
export function inOrganization(list,id) {
let flag = false;
if(list.length == 0) {
flag = true;
}
for(let i=0;i<list.length;i++) {
if(list[i].id != id) {
flag = true;
}
}
return flag;
}
function recursiveTraverse (node,tags) {
let afterTree = [];
let add = 0;
node.forEach(function(item, index) {
let obj = {
value: item.id,
label: item.label,
}
afterTree.push(obj);
if(inTags(item.id,tags)) {
afterTree[add] = obj;
add++;
} else if(item.children.length > 0) {
afterTree[add] = obj;
afterTree[add].children = [];
add++;
let add2 = 0;
item.children.forEach(function(item2, index2) {
let obj = {
value: item2.id,
label: item2.label,
}
console.log(afterTree[add],add2)
//afterTree[add].children[add2] = obj;
});
}
});
return afterTree;
}
//拼装选择的tree
export function getTreeData(data) {
console.log('allTree', data, data.length);
let afterTree = recursiveTraverse(data.children);
export function getTreeData(data,tags) {
console.log('allTree', data.children,'tags',tags);
console.log(JSON.stringify(data.children));
console.log(JSON.stringify(tags));
let afterTree = recursiveTraverse(data.children,tags);
console.log('afterTree ',afterTree);
let options = [
{
......@@ -230,3 +308,14 @@ export function getTreeData(data) {
}];
return afterTree;
}
export function organizationList(data) {
let list = [];
for(let i=0;i<data.length;i++) {
let obj = {
value: data[i].key,
label: data[i].name,
}
list.push(obj);
}
return list;
}
\ No newline at end of file
......@@ -113,7 +113,12 @@
<p class="upload-message" v-if="uploadImgMessage">请选择列表图片</p>
</div>
<el-form-item label="封面类型:">
<el-radio-group size="mini" v-model="formData.type" @change="changeCover" :disabled="peopleLevel == 'L3'">
<el-radio-group
size="mini"
v-model="formData.type"
@change="changeCover"
:disabled="peopleLevel == 'L3'"
>
<el-radio :label="1">图片</el-radio>
<el-radio :label="2">视频</el-radio>
</el-radio-group>
......@@ -232,19 +237,20 @@
<el-tab-pane label="设定机构" name="second">
<el-form :inline="true" :model="formOrganization" class="demo-form-inline">
<el-form-item label>
<!-- <el-select size="mini" v-model="formOrganization.region" placeholder="全部地区">
<el-select size="mini" v-model="formOrganization.region" placeholder="全部地区">
<el-option
v-for="(item, index) in organizationRegion"
:key="index"
:label="item.label"
:value="item.id"
></el-option>
</el-select>-->
<el-cascader
</el-select>
<!-- <el-cascader
size="mini"
expand-trigger="hover"
:options="organizationRegion"
v-model="formOrganization.region"
></el-cascader>
></el-cascader>-->
</el-form-item>
<el-form-item>
<el-select size="mini" v-model="formOrganization.grade" placeholder="全部医院级别">
......@@ -284,8 +290,9 @@
tooltip-effect="dark"
style="width: 100%"
@selection-change="selectionChangeOrganization"
:row-key="getRowKeys"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="selection" width="55" :reserve-selection="true"></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>
......@@ -380,8 +387,9 @@
tooltip-effect="dark"
style="width: 100%"
@selection-change="selectionChangePerson"
:row-key="getRowKeysPerson"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="selection" width="55" :reserve-selection="true"></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>
......@@ -567,6 +575,9 @@ export default {
treeData: [],
tagsRegion: [],
//设定机构 数据
getRowKeys(row) {
return row.id;
},
checkTableState: {
multipleOrganization: true,
multipleDepartment: true,
......@@ -589,7 +600,7 @@ export default {
currentOrganization: 1,
totalOrganization: 10,
pageSizeOrganization: 2,
changedOrganization: {},
changedOrganization: [],
//设定科室 数据
firstDepartment: true,
formDepartment: {
......@@ -600,6 +611,9 @@ export default {
updatedDepartment: false,
changedDepartment: {},
//设定人员 数据
getRowKeysPerson(row) {
return row.id;
},
formPerson: {
hospital: "",
department: "",
......@@ -614,7 +628,7 @@ export default {
pageSizePerson: 2,
totalPerson: 10,
updatedPerson: false,
changedPerson: {},
changedPerson: [],
//选择项目组件 数据
optionsComponent: [],
optionsCertificate: [],
......@@ -961,6 +975,7 @@ export default {
} else if (active == 1) {
this.stepData = [false, true, false];
this.initRange();
this.getDepartment();
} else if (active == 2) {
this.stepData = [false, false, true];
}
......@@ -993,10 +1008,11 @@ export default {
};
vm.GET("portal/portalInfo/checkProjectName", param).then(res => {
//console.log(res);
this.$message.info(res.message);
if (res.code == "000000") {
//移动到第二页 选择范围
this.insertOrUpdate("storage");
} else {
this.$message.info(res.message);
}
});
} else {
......@@ -1400,16 +1416,18 @@ export default {
} else if (tabName == "fourth") {
//设定人员
this.departmentList = this.getDepartmentList();
console.log(this.tableDepartment);
console.log(this.departmentList);
//console.log(this.tableDepartment);
//console.log(this.departmentList);
this.getPeople();
}
},
//获取勾选树
getCheckedTree() {
let allTree = Object.assign({}, this.treeData[0].children);
//this.organizationRegion = operationData.getTreeData(this.treeData[0]);
//console.log('allTree',this.treeData[0]);
//this.organizationRegion =
//operationData.getTreeData(this.treeData[0],this.tagsRegion);
//改
this.organizationRegion = operationData.organizationList(this.tagsRegion);
},
//初始化范围树
setTreeData(administrative) {
......@@ -1611,52 +1629,27 @@ export default {
}
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;
},
//获取医院等级
listLevels() {
let req = {};
vm.GET("contents/courseDoctor/listLevels?sysCode=10", req).then(res => {
if (res.code == "000000") {
console.log(res);
// console.log(res);
this.organizationRank = operationData.getLevelList(res.data.list);
}
});
},
//改变 设定机构选项
selectionChangeOrganization(val) {
this.multipleSelectionOrganization = val;
//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);
selectionChangeOrganization(rows) {
this.changedOrganization = [];
if (rows) {
rows.forEach(row => {
if (row) {
this.changedOrganization.push(row.id);
}
});
}
console.log(this.changedOrganization);
},
//改变机构 table 的check状态
selectionChangeDepartment(val) {
......@@ -1664,37 +1657,24 @@ export default {
//console.log(this.multipleSelectionDepartment);
},
//改变人员 table的check状态
selectionChangePerson(val) {
this.multipleSelectionPerson = val;
//console.log(this.multipleSelectionPerson);
if (
val.length != 0 &&
val.length != this.formPerson.pageSize &&
this.updatedPerson == false
) {
this.updatedPerson = true;
console.log("人员被更新", this.updatedPerson);
}
if (this.updatedPerson == true) {
this.changedPerson[this.formPerson.pageNum] = [];
this.changedPerson[
this.formPerson.pageNum
][0] = this.multipleSelectionPerson;
let reverse = this.getDifference(
this.tablePerson,
this.multipleSelectionPerson
);
this.changedPerson[this.formPerson.pageNum][1] = reverse;
console.log("check人员:", this.changedPerson);
selectionChangePerson(rows) {
this.changedPerson = [];
if (rows) {
rows.forEach(row => {
if (row) {
this.changedPerson.push(row.id);
}
});
}
console.log(this.changedPerson);
},
//设定机构table全选
checkAll(flag, name) {
//console.log(flag + " " + name);
if (name == "multipleOrganization") {
this.changedOrganization = {};
this.changedOrganization = [];
} else if (name == "multiplePerson") {
this.changedPerson = {};
this.changedPerson = [];
}
if (flag === true) {
if (this.checkTableState[name] === false) {
......@@ -1710,7 +1690,7 @@ export default {
getKind(type) {
let kind = 0;
if (type == "administrative") {
console.log("this.updatedTree", this.updatedTree);
//console.log("this.updatedTree", this.updatedTree);
if (this.tagsRegion.length > 0 && this.updatedTree == true) {
kind = 3;
}
......@@ -1722,20 +1702,16 @@ export default {
if (this.checkTableState.multipleOrganization == true) {
//设置机构类别0:无 1:全选 2:去掉 3:选中
kind = 1;
for (let key in this.changedOrganization) {
if (this.changedOrganization[key][1].length > 0) {
if (this.changedOrganization.length > 0) {
kind = 2;
}
}
} else {
//全部不选
kind = 0;
for (let key in this.changedOrganization) {
if (this.changedOrganization[key][0].length > 0) {
if (this.changedOrganization.length > 0) {
kind = 3;
}
}
}
} else if (type == "department") {
if (this.multipleSelectionDepartment.length > 0) {
kind = 3;
......@@ -1744,21 +1720,17 @@ export default {
if (this.checkTableState.multiplePerson == true) {
//设置机构类别0:无 1:全选 2:去掉 3:选中
kind = 1;
for (let key in this.changedPerson) {
if (this.changedPerson[key][1].length > 0) {
if (this.changedPerson.length > 0) {
kind = 2;
}
}
} else {
//全部不选
kind = 0;
for (let key in this.changedPerson) {
if (this.changedPerson[key][0].length > 0) {
if (this.changedPerson.length > 0) {
kind = 3;
}
}
}
}
return kind;
},
//设定的行政范围内容
......@@ -1798,8 +1770,7 @@ export default {
initOrganizationStatus() {
let tableStatus = this.tableOrganization;
tableStatus.forEach(row => {
//console.log("row", row);
if (row.status == 0) {
if (row.status == 1) {
this.$nextTick(function() {
this.$refs.multipleOrganization.toggleRowSelection(row);
});
......@@ -1825,66 +1796,12 @@ export default {
//console.log(res.data);
this.tableOrganization = res.data.organizationList;
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的status
//机构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();
//table的status
//console.log("changedOrganization", this.changedOrganization);
let idList = operationData.getIdList(this.tableOrganization);
let intersect = operationData.getIntersect(idList,this.changedOrganization);
if(intersect.length == 0) {
this.initOrganizationStatus();
}
} 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);
});
});
} else {
this.initOrganizationStatus();
}
}
}
});
},
......@@ -1911,20 +1828,9 @@ export default {
//获取机构id列表
getScopeOrganization(type) {
let scope = "";
if (type == 2) {
for (let key in this.changedOrganization) {
let organizationItem = this.changedOrganization[key][1];
console.log("organizationItem:", organizationItem);
for (let i = 0; i < organizationItem.length; i++) {
scope += organizationItem[i].id + "|";
}
}
} else if (type == 3) {
for (let key in this.changedOrganization) {
let organizationItem = this.changedOrganization[key][0];
for (let i = 0; i < organizationItem.length; i++) {
scope += organizationItem[i].id + "|";
}
if (type == 2 || type == 3) {
for (let i = 0; i < this.changedOrganization.length; i++) {
scope += this.changedOrganization[i] + "|";
}
}
scope = scope.substring(0, scope.length - 1);
......@@ -1934,20 +1840,9 @@ export default {
//获取人员id列表
getScopePeople(type) {
let scope = "";
if (type == 2) {
for (let key in this.changedPerson) {
let peopleItem = this.changedPerson[key][1];
//console.log("peopleItem:", peopleItem);
for (let i = 0; i < peopleItem.length; i++) {
scope += peopleItem[i].id + "|";
}
}
} else if (type == 3) {
for (let key in this.changedPerson) {
let peopleItem = this.changedPerson[key][0];
for (let i = 0; i < peopleItem.length; i++) {
scope += peopleItem[i].id + "|";
}
if (type == 2 || type == 3) {
for (let i = 0; i < this.changedPerson.length; i++) {
scope += this.changedPerson[i] + "|";
}
}
scope = scope.substring(0, scope.length - 1);
......@@ -1995,52 +1890,6 @@ export default {
this.tablePerson = res.data.people;
this.totalPerson = res.data.total;
if (this.checkTableState.multiplePerson == true) {
//全选
if (
this.updatedPerson == true &&
this.changedPerson[this.formPerson.pageNum] != undefined
) {
//机构table 勾选被更新过
let rowCheck = this.changedPerson[this.formPerson.pageNum][0];
//console.log("rowCheck:",rowCheck);
rowCheck.forEach(row => {
// console.log("row", row);
let rowItem = {};
for (let i = 0; i < this.tablePerson.length; i++) {
if (this.tablePerson[i].id == row.id) {
rowItem = this.tablePerson[i];
}
}
this.$nextTick(function() {
this.$refs.multiplePerson.toggleRowSelection(rowItem);
});
});
} else {
this.$refs.multiplePerson.toggleAllSelection();
}
} else {
//person 全不选
if (
this.updatedPerson == true &&
this.changedPerson[this.formPerson.pageNum] != undefined
) {
let rowCheck = this.changedPerson[this.formPerson.pageNum][0];
//console.log("rowCheck:",rowCheck);
rowCheck.forEach(row => {
// console.log("row", row);
let rowItem = {};
for (let i = 0; i < this.tablePerson.length; i++) {
if (this.tablePerson[i].id == row.id) {
rowItem = this.tablePerson[i];
}
}
this.$nextTick(function() {
this.$refs.multiplePerson.toggleRowSelection(rowItem);
});
});
}
}
}
});
},
......
......@@ -197,7 +197,8 @@ export default {
full: false
},
dialogFull: false,
scopeRow: {}
scopeRow: {},
activeUser: '',
};
},
created() {
......@@ -230,7 +231,8 @@ export default {
if (res.code == "000000") {
vm.tableData = res.data.projectRoleInfoModels;
vm.totalRows = res.data.total;
vm.activeUser = res.data.activeUser;
console.log('activeUser',vm.activeUser);
//this.roleList = setRoleList(res.data.roleList);
this.organizationList = res.data.organizationList;
this.departmentsList = res.data.departmentsList;
......@@ -287,7 +289,8 @@ export default {
//按钮展示情况
showButton(row, projeceRole) {
let flag = false;
//console.log("当前等级 " + row.projeceRole + " 改变成等级 " + projeceRole);
if(vm.activeUser == "L1") {
//当前内部管理员
if (row.projeceRole == "L2") {
if (projeceRole == "L0") {
flag = true;
......@@ -301,6 +304,25 @@ export default {
flag = true;
}
}
} else if (vm.activeUser == "L2") {
//当前项目负责人
if (row.projeceRole == "L3") {
if (projeceRole == "L2" || projeceRole == "L0") {
flag = true;
}
} else if (row.projeceRole == "L0") {
if (projeceRole == "L2" || projeceRole == "L3") {
flag = true;
}
}
} else if (vm.activeUser == "L3") {
//当前次级负责人
if (row.projeceRole == "L0") {
if (projeceRole == "L3") {
flag = true;
}
}
}
return flag;
},
//打开弹出框
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册