提交 113c3481 编写于 作者: bo.dang's avatar bo.dang

Merge remote-tracking branch 'origin/dev-circle-seven-2-20201020' into dev-circle-seven-2-20201020

<template>
<div class="organization-alert">
<div class="organization-left">
<div v-if="checked">已选:{{totalOrganization}}个机构</div>
<div v-if="checked">已选:{{totalOrganizationAll}}个机构</div>
<div v-else>已选:{{allSelect.length}}个机构</div>
<div class="hcd">
<div class="tag-list">
......@@ -39,10 +39,10 @@
<el-input style="width:140px;" size="small" v-model="formOrganization.name" placeholder="请输入机构名称"></el-input>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="searchOrganization()">搜索</el-button>
<el-button size="small" type="primary" @click="searchOrganization()" :disabled="checked">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button size="small" @click="resetOrgOrPerson()">取消搜索</el-button>
<el-button size="small" @click="resetOrgOrPerson()" :disabled="checked">取消搜索</el-button>
</el-form-item>
</el-form>
<el-checkbox v-if="showSelectAll" v-model="checked" @change="handleCheckAllChange" >全部({{ totalOrganization }})</el-checkbox>
......@@ -75,7 +75,7 @@ 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 { moOption, moOrgSearch, moSave, clearCacheOrg} from '@/utils/yqrange/memberApi';
import { moOption, moOptionAll, moOrgSearch, moSave, moSaveAll, clearCacheOrg} from '@/utils/yqrange/memberApi';
let vm = null;
export default {
props: {
......@@ -127,6 +127,7 @@ export default {
tableOrganization: new Array(),
currentOrganization: 1,
totalOrganization: 10,
totalOrganizationAll:0,//全选可以添加机构的总数量
pageSizeOrganization: 2,
selectionList:[],
formOrganization: {
......@@ -138,7 +139,7 @@ export default {
pageNum: 1,
pageSize: 10
},
showSelectAll:true,//只有运营人员显示全部按钮
showSelectAll:false,//只有运营人员显示全部按钮
checked: false,
allSelect: []
}
......@@ -152,11 +153,16 @@ export default {
this.initRange();
//Idtype:1,内部 2.外部
vm.idType = localStorage.getItem("storageIdType");
if (vm.idType == 1) {
//只有内部人员显示全选按钮
vm.showSelectAll = true;
}
},
methods: {
// 选中全部
handleCheckAllChange(){
console.log(this.checked)
this.requestSelectAll();
if (!this.checked){
this.allSelect = [];
this.checked = false;
......@@ -170,6 +176,33 @@ export default {
this.allSelect.push(item)
console.log(this.allSelect)
},
requestSelectAll(){
let administrativeIdItem = operationData.setAdministrativeId(
this.formOrganization.administrativeIdList
);
if (administrativeIdItem == "000_0"){
administrativeIdItem=""
}
let req = {
circleId: this.circleId,
districtIds: administrativeIdItem,
orgLevel: this.formOrganization.level,
orgName: this.formOrganization.name,
type: this.checked === false ? 0 : 1
};
openLoading(vm);
moOptionAll(req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
this.totalOrganizationAll = res.data;
} else {
this.$message(res.message);
}
}).catch(err => {
this.$message.error('请求失败');
});
},
clear() {
clearCacheOrg(this.circleId)
.then(()=>{
......@@ -296,6 +329,9 @@ export default {
},
//机构搜索
getOrganizationChoose() {
if (this.checked) {
return;
}
let administrativeIdItem = operationData.setAdministrativeId(
this.formOrganization.administrativeIdList
);
......@@ -506,6 +542,8 @@ export default {
if (this.checked){
this.allSelect = [];
this.checked = false;
this.requestSelectAll();
return;
}
this.selectOrganization([],item)
this.$refs.multipleOrganization.toggleRowSelection(item);
......@@ -516,7 +554,16 @@ export default {
this.$message.error('已选列表为空');
return
}
let params = {
// 内部人员或者全部选中 且是全选
if (this.idType == 1&&this.checked) {
this.requestaddFnAll();
}else {
this.requestaddFn();
}
},
requestaddFn(){
let params = {
circleId: this.circleId
}
moSave(params)
......@@ -527,6 +574,28 @@ export default {
this.$message.error('保存失败,请重试');
})
},
requestaddFnAll(){
let administrativeIdItem = operationData.setAdministrativeId(
this.formOrganization.administrativeIdList
);
if (administrativeIdItem == "000_0"){
administrativeIdItem=""
}
let req = {
circleId: this.circleId,
districtIds: administrativeIdItem,
orgLevel: this.formOrganization.level,
orgName: this.formOrganization.name,
type: this.checked === false ? 0 : 1
};
moSaveAll(req)
.then(() => {
this.$emit('addOrg')
})
.catch(() => {
this.$message.error('保存失败,请重试');
})
},
// 取消
canclefn() {
this.$emit('handleClose')
......
......@@ -67,7 +67,15 @@ export const moOption = (params) => {
description: '添加机构- 勾选操作',
})
};
export const moOptionAll = (params) => {
return fetch({
headers,
url: getBaseUrl(`circle/memberSelect/org/option/all`),
method: 'post',
data: params,
description: '添加机构- 全选勾选/反选操作',
})
};
export const moOptionBlackList = (params) => {
return fetch({
headers,
......@@ -87,7 +95,15 @@ export const moSave = (params) => {
description: '添加机构-保存',
})
};
export const moSaveAll = (params) => {
return fetch({
headers,
url: getBaseUrl(`circle/memberSelect/org/save/all`),
method: 'post',
data: params,
description: '添加机构- 全选-保存',
})
};
export const moSaveBlackList = (params) => {
return fetch({
headers,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册