提交 e8df6c45 编写于 作者: alex.zhang's avatar alex.zhang

fix bug

上级 a682ca14
......@@ -10,34 +10,58 @@
closable
:disable-transitions="false"
style="marginTop:10px;"
@close="handleClose(item)">
{{item.name.length > 12 ? item.name.slice(0,12)+'...' : item.name}}
</el-tag>
@close="handleClose(item)"
>{{item.name.length > 12 ? item.name.slice(0,12)+'...' : item.name}}</el-tag>
</div>
</div>
<el-row type="flex" class="btn-left">
<el-button type="primary" size="small" @click="addFn">确定添加</el-button>
<el-button size="small" @click="canclefn">取消</el-button>
</el-row>
</div>
<div class="organization-right">
<el-form :inline="true" :model="formOrganization" class="demo-form-inline" >
<el-form :inline="true" :model="formOrganization" class="demo-form-inline">
<el-form-item label>
<el-input style="width:200px;" size="small" v-model="formOrganization.organization" placeholder="请输入机构名称"></el-input>
<el-input
style="width:200px;"
size="small"
v-model="formOrganization.organization"
placeholder="请输入机构名称"
></el-input>
</el-form-item>
<el-form-item label>
<el-input style="width:200px;" size="small" v-model="formOrganization.name" placeholder="请输入人员名称"></el-input>
<el-input
style="width:200px;"
size="small"
v-model="formOrganization.name"
placeholder="请输入人员名称"
></el-input>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="search()">搜索</el-button>
<el-button size="small" type="primary" @click="searchRefresh()">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button size="small" type="default" @click="searchCancel()">取消搜索</el-button>
</el-form-item>
</el-form>
<el-table class="rim" ref="multipleOrganization" :data="tableOrganization" tooltip-effect="dark" @select-all="selectAllOrganization" @select="selectOrganization" >
<el-table-column type="selection" :selectable="selectableTableList" ></el-table-column>
<el-table
class="rim"
ref="multipleOrganization"
:data="tableOrganization"
tooltip-effect="dark"
@select-all="selectAllOrganization"
@select="selectOrganization"
>
<!-- @cell-mouse-enter="showItemToast"
@cell-mouse-leave="itemMouseOver=false"-->
<el-table-column type="selection" :selectable="selectableTableList">
<template >
<el-popover trigger="hover" placement="top">
<p>{{ "哇米诺" }}</p>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="name" label="人员名称" align="center"></el-table-column>
<el-table-column prop="department" label="所属科室" align="center"></el-table-column>
<el-table-column prop="hospital" label="所属医院" align="center"></el-table-column>
......@@ -47,15 +71,22 @@
<el-table-column prop="townName" label="所属街道" align="center"></el-table-column>
<div slot="empty">
<div class="table-empty">
<img src="../../assets/image/no-content1.png">
<img src="../../assets/image/no-content1.png" />
<p>没有相关信息</p>
</div>
</div>
</el-table>
<div class="pagination">
<el-pagination background @size-change="handleSizeOrganization" @current-change="handleCurrentOrganization"
:current-page="formOrganization.pageNum" :page-sizes="[10, 20, 40]" :page-size="formOrganization.pageSize"
layout="total, sizes, prev, pager, next, jumper" :total="totalOrganization"></el-pagination>
<el-pagination
background
@size-change="handleSizeOrganization"
@current-change="handleCurrentOrganization"
:current-page="formOrganization.pageNum"
:page-sizes="[10, 20, 40]"
:page-size="formOrganization.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalOrganization"
></el-pagination>
</div>
</div>
</div>
......@@ -65,18 +96,23 @@
import { openLoading, closeLoading } from "@/utils/utils";
import { doUpload, getFilePath } from "@/utils/qiniu-util";
import * as operationData from "@/utils/operation";
import { getCircleProvincesReq } from '@/utils/yqrange/rangeApi';
import { moOptionBlackList, moOrgSearch, moSaveBlackList, clearBlackListCacheOrg} from '@/utils/yqrange/memberApi';
import { getCircleProvincesReq } from "@/utils/yqrange/rangeApi";
import {
moOptionBlackList,
moOrgSearch,
moSaveBlackList,
clearBlackListCacheOrg,
} from "@/utils/yqrange/memberApi";
let vm = null;
export default {
props: {
circleId: {
type: Number | String,
default: 1
default: 1,
},
roleType: {
type: Number | String,
default: 1
default: 1,
},
},
data() {
......@@ -87,30 +123,30 @@ export default {
const { level } = node;
if (node.level == 1) {
let req = {
provinceId: node.data.value
provinceId: node.data.value,
};
vm.GET("basic-data/position/cities", req).then(res => {
vm.GET("basic-data/position/cities", req).then((res) => {
let newData = vm.setMoreOption(res.data.cityList, "cities");
resolve(newData);
});
} else if (node.level == 2) {
let req = {
cityId: node.data.value
cityId: node.data.value,
};
vm.GET("basic-data/position/counties", req).then(res => {
vm.GET("basic-data/position/counties", req).then((res) => {
let newData = vm.setMoreOption(res.data.countyList, "counties");
resolve(newData);
});
} else if (node.level == 3) {
let req = {
countyId: node.data.value
countyId: node.data.value,
};
vm.GET("basic-data/position/towns", req).then(res => {
vm.GET("basic-data/position/towns", req).then((res) => {
let newData = vm.setMoreOption(res.data.townList, "towns");
resolve(newData);
});
}
}
},
},
administrativeValue: "",
optionsRegion: [],
......@@ -119,7 +155,7 @@ export default {
currentOrganization: 1,
totalOrganization: 10,
pageSizeOrganization: 2,
selectionList:[],
selectionList: [],
formOrganization: {
name: "",
organization: "",
......@@ -128,10 +164,11 @@ export default {
level: "",
chechAll: true,
pageNum: 1,
pageSize: 10
pageSize: 10,
},
allSelect: []
}
allSelect: [],
itemMouseOver: false,
};
},
created() {
vm = this;
......@@ -141,18 +178,21 @@ export default {
// this.initRange();
//Idtype:1,内部 2.外部
vm.idType = localStorage.getItem("storageIdType");
this.search();
},
methods: {
search() {
console.log("search() enter")
this.searchList();
},
searchRefresh() {
this.formOrganization.pageNum = 1;
this.searchList();
},
searchCancel() {
this.formOrganization.organization = "";
this.formOrganization.name = "";
this.searchList();
this.searchRefresh();
},
searchList() {
console.log("黑名单搜索 " + this.circleId);
......@@ -182,12 +222,14 @@ export default {
});
},
clear() {
console.log("clear() enter")
console.log("clear() enter");
clearBlackListCacheOrg(this.circleId)
.then(()=>{
this.search();
})
.catch((err=>{console.log(err)}))
.then(() => {
this.search();
})
.catch((err) => {
console.log(err);
});
},
// 多级地区
setMoreOption(data, type) {
......@@ -216,43 +258,47 @@ export default {
this.formOrganization.name = "";
this.formOrganization.level = "";
},
//获取地区
//获取地区
getRegionOption() {
openLoading(vm);
let idType = localStorage.getItem("storageIdType");
getCircleProvincesReq(idType).then(res => {
closeLoading(this);
if (res.code == "000000") {
if (idType == 1) {
vm.optionsRegion = operationData.setRegionOption2(
res.data.provinceList
);
}else{
vm.optionsRegion = operationData.setRegionOption3(
res.data.provinceList
);
getCircleProvincesReq(idType)
.then((res) => {
closeLoading(this);
if (res.code == "000000") {
if (idType == 1) {
vm.optionsRegion = operationData.setRegionOption2(
res.data.provinceList
);
} else {
vm.optionsRegion = operationData.setRegionOption3(
res.data.provinceList
);
}
vm.formOrganization.administrativeIdList.push(
vm.optionsRegion[0].value
);
vm.getOrganization();
} else {
this.$message(res.message);
}
vm.formOrganization.administrativeIdList.push(vm.optionsRegion[0].value);
vm.getOrganization();
} else {
this.$message(res.message);
}
}).catch(err => {
this.$message.error('请求失败');
});
})
.catch((err) => {
this.$message.error("请求失败");
});
},
//获取医院等级
listLevels() {
let req = {};
vm.GET("contents/courseDoctor/listLevels?sysCode=10", req).then(res => {
vm.GET("contents/courseDoctor/listLevels?sysCode=10", req).then((res) => {
if (res.code == "000000") {
this.organizationRank = operationData.getLevelList(res.data.list);
} else {
this.organizationRank = [
{
id: "0",
label: "全部医院等级"
}
label: "全部医院等级",
},
];
}
});
......@@ -263,7 +309,7 @@ export default {
let administrativeIdItem = "";
// 如果是外部用户(2),只能看到所在省份的数据
if(idType == 2){
if (idType == 2) {
let optionRegionArray = new Array();
optionRegionArray.push(this.optionsRegion[0].provinceId);
administrativeIdItem = operationData.setAdministrativeId(
......@@ -274,31 +320,33 @@ export default {
let req = {
circleId: this.circleId,
districtIds: administrativeIdItem,
orgLevel:"",
orgLevel: "",
member: this.formOrganization.name,
pageNo: this.formOrganization.pageNum,
pageSize: this.formOrganization.pageSize,
idType: idType,
roleType: this.roleType
roleType: this.roleType,
};
openLoading(vm);
moOrgSearch(req).then(res => {
closeLoading(this);
if (res.code == "000000") {
this.tableOrganization = res.data.orgList;
this.totalOrganization = res.data.total;
vm.initOrganizationStatus();
} else {
this.$message(res.message);
}
}).catch(err => {
this.$message.error('请求失败');
});
moOrgSearch(req)
.then((res) => {
closeLoading(this);
if (res.code == "000000") {
this.tableOrganization = res.data.orgList;
this.totalOrganization = res.data.total;
vm.initOrganizationStatus();
} else {
this.$message(res.message);
}
})
.catch((err) => {
this.$message.error("请求失败");
});
},
// 获取机构列表的机构状态(是否被选中)
initOrganizationStatus() {
let tableStatus = this.tableOrganization;
tableStatus.forEach(row => {
tableStatus.forEach((row) => {
if (row.status == 1 || row.status == 2) {
this.$nextTick(function () {
this.$refs.multipleOrganization.toggleRowSelection(row);
......@@ -312,8 +360,8 @@ export default {
let administrativeIdItem = operationData.setAdministrativeId(
this.formOrganization.administrativeIdList
);
if (administrativeIdItem == "000_0"){
administrativeIdItem=""
if (administrativeIdItem == "000_0") {
administrativeIdItem = "";
}
let idType = localStorage.getItem("storageIdType");
let req = {
......@@ -324,22 +372,24 @@ export default {
pageNo: this.formOrganization.pageNum,
pageSize: this.formOrganization.pageSize,
idType: idType,
roleType: this.roleType
roleType: this.roleType,
};
openLoading(vm);
moOrgSearch(req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
this.tableOrganization = res.data.orgList;
this.totalOrganization = res.data.total;
vm.initOrganizationStatus();
} else {
this.$message(res.message);
}
}).catch(err => {
this.$message.error('请求失败');
});
},
moOrgSearch(req)
.then((res) => {
closeLoading(vm);
if (res.code == "000000") {
this.tableOrganization = res.data.orgList;
this.totalOrganization = res.data.total;
vm.initOrganizationStatus();
} else {
this.$message(res.message);
}
})
.catch((err) => {
this.$message.error("请求失败");
});
},
//选择搜索机构方式
searchOrganization() {
this.formOrganization.pageNum = 1;
......@@ -347,7 +397,7 @@ export default {
if (
searchForm.administrativeId == "0" &&
searchForm.administrativeIdList[
searchForm.administrativeIdList.length - 1
searchForm.administrativeIdList.length - 1
] == "0" &&
searchForm.level == "" &&
searchForm.name == ""
......@@ -369,16 +419,22 @@ export default {
handleCurrentOrganization(val) {
//console.log(`当前页: ${val}`);
this.formOrganization.pageNum = val;
console.log("this.formOrganization.pageNum = " + this.formOrganization.pageNum)
console.log(
"this.formOrganization.pageNum = " + this.formOrganization.pageNum
);
this.search();
},
//机构table中勾选一页
selectAllOrganization(selection) {
//机构table中勾选一页
selectAllOrganization(selection, row) {
this.selectionList = selection;
let setList = [];
let selectList = [];
for (let i = 0; i < vm.tableOrganization.length; i++) {
if (vm.tableOrganization[i].status != 2) {
if (
vm.tableOrganization[i].status != 2 &&
(vm.tableOrganization[i].roleId == null ||
vm.tableOrganization[i].roleId == 0)
) {
setList.push(vm.tableOrganization[i].id);
}
}
......@@ -396,24 +452,26 @@ export default {
let req = {
ids: setList,
circleId: this.circleId,
type: typeStatus
type: typeStatus,
};
openLoading(vm);
moOptionBlackList(req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
this.checkToList(req.type,vm.tableOrganization)
} else {
this.$message(res.message);
}
}).catch(err => {
this.$message.error('请求失败');
});
moOptionBlackList(req)
.then((res) => {
closeLoading(vm);
if (res.code == "000000") {
this.checkToList(req.type, vm.tableOrganization); //vm.tableOrganization
} else {
this.$message(res.message);
}
})
.catch((err) => {
this.$message.error("请求失败");
});
}
},
//机构table中勾选一个
//机构table中勾选一个
selectOrganization(selection, row) {
console.log("selectOrganization() : " + row.name)
console.log("selectOrganization() : " + row.name);
this.selectionList = selection;
let flag = false;
for (let i = 0; i < selection.length; i++) {
......@@ -424,19 +482,21 @@ export default {
let req = {
ids: [row.id],
circleId: this.circleId,
type: flag === false ? 0 : 1
type: flag === false ? 0 : 1,
};
openLoading(vm);
moOptionBlackList(req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
this.checkToList(req.type,row)
} else {
this.$message(res.message);
}
}).catch(err => {
this.$message.error('请求失败');
});
moOptionBlackList(req)
.then((res) => {
closeLoading(vm);
if (res.code == "000000") {
this.checkToList(req.type, row);
} else {
this.$message(res.message);
}
})
.catch((err) => {
this.$message.error("请求失败");
});
},
selectableTableList(row, index) {
// if (this.status4Flag == 1) {
......@@ -448,37 +508,45 @@ export default {
// return true;
},
// 通过check改变展示的已选中的数据列表
checkToList(type,item) {
checkToList(type, item) {
if (type) {
if (Array.isArray(item)) {
this.allSelect = this.unique([...this.allSelect,...item])
this.allSelect = this.unique([...this.allSelect, ...item]);
} else {
this.allSelect.push(item)
this.allSelect.push(item);
}
} else {
if (Array.isArray(item)) {
for(var i = this.allSelect.length -1; i >= 0 ; i--){
for(let j = item.length -1; j >= 0; j--) {
if (this.allSelect[i] && item[j] && this.allSelect[i].id == item[j].id) {
this.allSelect.splice(i,1)
for (var i = this.allSelect.length - 1; i >= 0; i--) {
for (let j = item.length - 1; j >= 0; j--) {
if (
this.allSelect[i] &&
item[j] &&
this.allSelect[i].id == item[j].id
) {
this.allSelect.splice(i, 1);
}
}
}
} else {
for(let i = this.allSelect.length-1; i >=0; i--) {
for (let i = this.allSelect.length - 1; i >= 0; i--) {
if (this.allSelect[i].id == item.id) {
this.allSelect.splice(i,1)
this.allSelect.splice(i, 1);
}
}
}
}
},
// 去重
unique(arr) {
unique(arr) {
let hashTable = {};
let newArr = [];
for(let i=0,l=arr.length;i<l;i++) {
if(!hashTable[arr[i].id] && arr[i].status != 2) {
for (let i = 0, l = arr.length; i < l; i++) {
if (
!hashTable[arr[i].id] &&
arr[i].status != 2 &&
(arr[i].roleId == null || arr[i].roleId == 0)
) {
hashTable[arr[i].id] = true;
newArr.push(arr[i]);
}
......@@ -487,35 +555,42 @@ export default {
},
//删除已选中的tag
handleClose(item) {
this.selectOrganization([],item)
this.selectOrganization([], item);
this.$refs.multipleOrganization.toggleRowSelection(item);
},
// 确定添加
addFn() {
console.log("this.allSelect = " + this.allSelect)
console.log("this.allSelect.length = " + this.allSelect.length)
if (!(this.allSelect&& this.allSelect.length)) {
this.$message.error('已选列表为空');
return
console.log("this.allSelect = " + this.allSelect);
console.log("this.allSelect.length = " + this.allSelect.length);
if (!(this.allSelect && this.allSelect.length)) {
this.$message.error("已选列表为空");
return;
}
let params = {
circleId: this.circleId
}
circleId: this.circleId,
};
moSaveBlackList(params)
.then(() => {
this.$emit('addOrg')
this.$emit("addOrg");
})
.catch(() => {
this.$message.error('保存失败,请重试');
})
this.$message.error("保存失败,请重试");
});
},
// 取消
canclefn() {
console.log("alex do canclefn()")
this.$emit('handleClose')
}
}
}
console.log("alex do canclefn()");
this.$emit("handleClose");
},
showItemToast(row) {
console.log("showItemToast() : " + row.status + ", 管理员不可加入黑名单");
if (row.roleId != null && row.roleId != 0) {
vm.$message.info("管理员不可加入黑名单");
}
this.itemMouseOver = true;
},
},
};
</script>
<style lang="scss" scoped>
......@@ -533,7 +608,7 @@ export default {
.hcd {
flex: 1;
overflow: hidden;
.tag-list {
.tag-list {
margin-top: 20px;
margin-bottom: 40px;
display: table-caption;
......@@ -544,7 +619,7 @@ export default {
}
}
}
.btn-left {
height: 40px;
margin-bottom: 20px;
......@@ -560,13 +635,11 @@ export default {
font-size: 18px;
margin-right: 2px;
}
}
.organization-search {
margin-right: 20px;
text-align: right;
}
}
}
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册