Commit 0f58bd57 by xiaohai

.

parent 1d70ea65
......@@ -252,6 +252,9 @@
this.treeSet.dialogVisible = false;
}
},
mounted() {
console.log(this.$refs, "this");
},
watch: {
searchText(newK, old) {
this.$refs.tree.filter(newK);
......@@ -261,6 +264,7 @@
},
defaultSelection(list) {
this.$nextTick(() => {
console.log(this.$refs, "this");
this.selectedList = list;
this.$refs.tree.setCheckedNodes(list);
list.forEach(li => {
......
......@@ -84,6 +84,11 @@ export const constantRouterMap = [
name: '共享通讯录',
component: _import('contacts','shareContact')
},
{
path: "/shareCode",
name: '共享通讯录',
component: _import('contacts','shareCode')
}
]
},
{
......
......@@ -28,7 +28,7 @@
<el-button @click="cancel">取消</el-button>
</div>
</div>
<vue-select-employee :changed="changed" :defaultSelection="defaultSelection" :treeSet="treeSet" @handleSelectedList="handleSelectedList" :treeData="treeData"></vue-select-employee>
<vue-select-employee :changed="changed" :onlyPerson="onlyPerson" :onlyGroup="onlyGroup" :defaultSelection="defaultSelection" :treeSet="treeSet" @handleSelectedList="handleSelectedList" :treeData="treeData"></vue-select-employee>
</div>
</template>
<script>
......@@ -68,7 +68,9 @@
defaultSelection: [],
defaultParent: [],
selectorType: "parent",
changed: "parent"
changed: "parent",
onlyPerson: false,
onlyGroup: []
};
},
methods: {
......@@ -131,6 +133,7 @@
this.defaultSelection = list;
this.onlyPerson = true;
this.onlyGroup = [this.$route.query.departmentId];
console.log(this.$route.query.departmentId);
this.changed = type;
this.treeSet = {
dialogVisible: true,
......
<template>
<div class="add-department-container">
<div class="setting-cell depart-info">
<p class="title">部门信息</p>
<el-form
class="department-info-form"
label-position="right"
:rules="rules"
:model="departInfo"
ref="departForm"
label-width="120px">
<el-form-item label="部门名称" prop="name">
<el-input v-model="departInfo.name"></el-input>
</el-form-item>
<el-form-item label="部门排序调整" prop="parentId">
<el-input :disabled="disabled" v-model="departInfo.parentName" @focus="callGroupSelector" suffix-icon="el-icon-arrow-down"></el-input>
</el-form-item>
</el-form>
</div>
<vue-select-employee :defaultSelection="defaultSelection" :treeSet="treeSet" @handleSelectedList="handleSelectedList" :treeData="treeData"></vue-select-employee>
</div>
</template>
<script>
import permissionSetting from "components/contacts/permissionSet/permissionSetting";
import vueSelectEmployee from "components/common/vueSelectEmployee";
import { getRequest, postRequest, postJsonRequest } from '@/api/api';
export default {
name: "addDepartment",
components: {
permissionSetting,
vueSelectEmployee
},
data() {
return {
departInfo: {
name: "",
parentName: "",
parentId: ""
},
testList: [],
treeSet: {
isSelectPerson: false,
dialogVisible: false,
isSingle: true // 是否单选
},
rules: {
name: [
{ required: true, message: '请输入部门名称', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
],
parentId: [
{ required: true, message: '请选择父级部门', trigger: 'change' }
]
},
treeData: {},
disabled: true,
defaultSelection: [],
defaultParent: [],
selectorType: "parent",
changed: "parent",
onlyPerson: false,
onlyGroup: []
};
},
methods: {
/**
* 获取部门信息
*/
getDepartInfo() {
let that = this;
let params = {
groupId: that.$route.query.departmentId
};
getRequest("/haoban-manage-web/dept/findDeptById", params)
.then(res => {
if (res.data.errorCode == 1) {
that.departInfo.name = res.data.result.name;
that.departInfo.parentId = res.data.result.parentId;
let chain = res.data.result.chainName.split("/");
let len = chain.length;
if (len == 1) {
that.departInfo.parentName = ""
} else {
that.departInfo.parentName = chain[len - 2];
}
that.defaultParent = [{
label: that.departInfo.parentName,
id: res.data.result.parentId,
groupId: res.data.result.parentId
}];
} else {
that.$message.error({
duration: 1000,
message: res.data.message
});
}
})
.catch(e => {
that.$message.error({
duration: 1000,
message: e.message
});
})
},
/**
* 唤起部门选择器
*/
callGroupSelector() {
this.selectorType = "parent";
this.defaultSelection = this.defaultParent;
this.onlyPerson = false;
this.onlyGroup = [];
this.changed = "parent";
this.treeSet = {
dialogVisible: true,
isSingle: true,
isSelectPerson: false
};
},
callPerSelector(type, list) {
this.selectorType = type;
this.defaultSelection = list;
this.onlyPerson = true;
this.onlyGroup = [this.$route.query.departmentId];
console.log(this.$route.query.departmentId);
this.changed = type;
this.treeSet = {
dialogVisible: true,
isSingle: false,
isSelectPerson: true
};
},
/**
* 处理已选部门
*/
handleSelectedList(group) {
console.log(group);
this.departInfo.parentId = group ? group.id : "";
this.departInfo.parentName = group ? group.label : "";
},
saveEdit(goAhead = "") {
this.$refs.departForm.validate(valid => {
if (!valid) {
return false;
}
let _this = this;
let params = {
parentId: _this.departInfo.parentId,
name: _this.departInfo.name
}
getRequest("/haoban-manage-web/dept/insert", params)
.then(res => {
console.log(res);
if (res.data.errorCode == 1) {
_this.$message.success({
duration: 1000,
message: "操作成功!"
});
console.log(goAhead);
if (goAhead == "continue") {
_this.departInfo = {
name: "",
parentName: "",
parentId: ""
}
_this.disabled = true;
_this.getGroupData();
} else {
window.history.go(-1);
}
} else {
_this.$message.error({
duration: 1000,
message: res.data.message
});
}
})
.catch(e => {
_this.$message.error({
duration: 1000,
message: e.message
});
});
});
},
getGroupData() {
let _this = this;
let params = {
isStoreGroup: 0
};
getRequest("/haoban-manage-web/dept/deptListForCompany", params)
.then(res => {
let treeData = [];
let personData = [];
if (res.data.errorCode == 1) {
treeData = res.data.result.departmentList || [];
personData = res.data.result.searchList || []
}
// _this.formatGroupData(treeData, personData);
_this.treeData = {
treeData,
personData
};
_this.disabled = false;
})
.catch(e => {
console.log(e, "error");
});
},
cancel() {
this.$confirm(" 是否确认取消,取消后当前页面信息将丢失 ?", "提示", {
type: "warning"
}).then(() => {
window.history.go(-1);
}).catch(e => {
console.log(e);
});
}
},
beforeMount() {
this.getGroupData();
if (!this.isAddNew) {
this.getDepartInfo();
}
},
computed: {
isAddNew() {
return !!(this.$route.query.addnew == 1);
}
}
};
</script>
<style lang="scss">
.add-department-container {
.setting-cell {
background: #fff;
margin-bottom: 24px;
.title {
height: 55px;
line-height: 55px;
border-bottom: 1px solid #E4E7ED;
text-indent: 32px;
font-size:16px;
font-weight:500;
color:#303133;
}
.department-info-form {
padding: 24px 32px;
.el-input {
width: 380px;
}
}
.btn-area{
width: 100%;
text-align: center;
padding: 12px;
}
}
}
</style>
<template>
<div class="share-code-div">
<p class="company-name">中国达摩</p>
<p class="word">双方共享的通讯录,选人时可以选到,同时邀请企业建立共享关系</p>
<p class="time-tip">一个二维码只能和一个企业建立共享关系,24小时有效</p>
<img :src="qrCodeContent.data" class="code-img">
<div class="btn-area">
<el-button type="primary">下载<i class="iconfont icon-icon_yunxiazai"></i></el-button>
<el-button>重新生成</el-button>
</div>
<p class="company-name">已建立的共享企业</p>
<div class="share-table">
<div class="company">达摩克里斯之剑</div>
<ul class="list">
<li class="li">
<div class="name">达摩克里斯之剑</div>
<div class="cancel-btn"><a href="" class="a-href">取消共享</a></div>
</li>
<li class="li">
<div class="name">达摩克里斯之剑</div>
<div class="cancel-btn"><a href="" class="a-href">取消共享</a></div>
</li>
<li class="li">
<div class="name">达摩克里斯之剑</div>
<div class="cancel-btn"><a href="" class="a-href">取消共享</a></div>
</li>
</ul>
</div>
</div>
</template>
<script>
import { getRequest, postRequest, postJsonRequest } from '@/api/api';
export default {
name: "shareCode",
data() {
return {
regenerate: false,
qrCodeContent: {}
}
},
methods: {
getCode() {
let _this = this;
let params = {
regenerate: _this.regenerate
}
getRequest("/haoban-manage-web/shared-contact/get-shared-qrcode", params)
.then(res => {
console.log(res, "code");
if (res.data.errorCode == 1) {
_this.qrCodeContent = JSON.parse(res.data.result.qrCodeContent);
} else {
_this.$message.error({
message: res.data.message
});
}
})
.catch(e => {
_this.$message.error({
message: e.message
});
});
},
getShareBrands() {
let _this = this;
let params = {};
getRequest("/haoban-manage-web/shared-contact/find-shared-contact-relation", params)
.then(res => {
console.log(res, "shares");
})
.catch(e => {
_this.$message.error({
message: e.message
});
});
}
},
beforeMount() {
this.getShareBrands();
this.getCode();
}
}
</script>
<style lang="scss">
.share-code-div {
width:100%;
height:538px;
background:rgba(255,255,255,1);
border-radius:2px;
box-sizing: border-box;
padding: 28px;
font-weight: 500;
overflow: auto;
.company-name {
font-size:16px;
color:rgba(48,49,51,1);
}
.word {
font-size:14px;
font-weight:400;
color:rgba(96,98,102,1);
margin-top: 17px;
}
.time-tip {
font-size:14px;
font-weight:400;
margin-top: 25px;
color:rgba(245,108,108,1);
}
.code-img {
width:245px;
height:245px;
margin-top: 20px;
}
.btn-area {
margin-top: 24px;
margin-bottom: 46px;
.iconfont {
margin-left: 5px;
}
}
.share-table {
display: flex;
height:auto;
border:1px solid rgba(235,238,245,1);
margin: 24px 0 48px 0;
.company {
width: 300px;
display: flex;
align-items: center;
justify-content: center;
}
.list {
flex: 1;
.li {
display: flex;
height: 60px;
line-height: 60px;
border-left: 1px solid rgba(235,238,245,1);
border-bottom: 1px solid rgba(235,238,245,1);
font-size: 14px;
&:last-child {
border-bottom: none;
}
.cancel-btn {
width: 220px;
}
.name {
flex: 1;
padding: 0 15px;
}
}
}
}
}
</style>
<template>
<div class="shareContact-wrap">
</div>
<div class="administrative-estrutura-container">
<search-menu
@handleSearchKey="handleSearchKey"
@handleTreeSelection="handleTreeSelection"
:treeData="menuData"
:searchResult="searchResult"
@handleEmployeeSelection="handleEmployeeSelection">
</search-menu>
<employee-info v-if="showEmployee == 'employee'" :info="selectedEmployee"></employee-info>
<div class="af-right-container"
v-loading="loading"
v-else>
<div class="af-right-header">
<span class="title-span">{{groupInfo.groupName}}{{total}}人)</span>
<span class="id-span">部门ID: {{groupInfo.departmentId}}</span>
<span class="handle-area">
<a :href="'#/addDepartment?addnew=1&departmentId='+groupInfo.departmentId" class="J_add-child a-href">添加子部门</a>
<span class="hurdle"></span>
<a :href="'#/addDepartment?departmentId='+groupInfo.departmentId" class="J_edit a-href">编辑</a>
</span>
</div>
<div class="af-right-button-box">
<el-button type="primary">添加成员</el-button>
<el-button type="danger" plain @click="delMembers" :disabled="disabledDel">批量删除</el-button>
<el-button class="J_show-children"><el-checkbox class="m-r-10" v-model="showChildMember" @change="setChildMemberShow"></el-checkbox><a class="a-href">显示子成员</a></el-button>
</div>
<employee-list :employeeList="employeeList" @selectMember="selectMember"></employee-list>
<div class="pagination">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-sizes="[20, 40, 60, 80]"
:page-size="pageSize"
:current-page="currentPage"
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
</div>
</div>
</div>
</template>
<script>
import searchMenu from "components/contacts/searchMenu";
import employeeInfo from "components/contacts/employeeInfo";
import employeeList from "components/contacts/employeeList";
import { getRequest, postRequest, postJsonRequest } from '@/api/api';
export default {
name: "administrativeEstrutura",
components: {
searchMenu,
employeeInfo,
employeeList
},
data() {
return {
showChildMember: false,
setDisabledDel: false,
menuData: [],
pageSize: 20,
currentPage: 1,
selectedList: [],
total: 0,
loading: true,
groupInfo: {
groupName: "",
departmentId: ""
},
employeeList: [],
searchResult: {},
showEmployee: false,
selectedEmployee: {}
};
},
created() {},
beforeMount() {
this.getGroupData();
this.getEmployee();
},
methods: {
handleSizeChange(val) {
this.pageSize = val;
this.getEmployee();
},
handleCurrentChange(val) {
this.currentPage = val;
this.getEmployee();
},
export default {
name: "shareContact",
data() {
return {
/**
* 树形菜单搜索
*/
handleSearchKey(keyWord) {
console.log(keyWord, "searchKey");
let params = {
keyWord
};
getRequest("/haoban-manage-web/emp/searchpage", params)
.then(res => {
console.log(res, "key word search");
this.searchResult = res.data.result;
})
.catch(e => {
console.log(e, "error");
});
},
/**
* 树形菜单选择项处理
*/
handleTreeSelection(obj, node, showEmployee) {
console.log(obj, node, "selection");
this.groupInfo.departmentId = obj.groupId;
this.groupInfo.groupName = obj.name;
this.showEmployee = showEmployee;
this.loading = true;
this.getEmployee();
},
/**
* 树形搜索结果选人处理
*/
handleEmployeeSelection(employee, showEmployee) {
console.log(employee);
this.selectedEmployee = employee;
this.showEmployee = showEmployee;
},
/**
* table选择员工
*/
selectMember(selection) {
this.selectedList = selection;
},
/**
* 批量删除成员
*/
delMembers() {
let _this = this;
_this.$confirm("是否要删除选中的员工?", "提示", {
type: "warning"
}).then(() => {
let arr = [];
_this.selectedList.forEach(li => {
arr.push(li.employeeClerkId);
});
let params = {
ids: arr.push(",")
}
getRequest("/haoban-manage-web/emp/del", params)
.then(res => {
console.log(res, "Del result");
let selected = _this.selectedList;
let originList = _this.employeeList;
let selSet = new Set(selected);
let originSet = new Set(originList);
_this.employeeList = selected.concat(originList).filter(v => !selSet.has(v) || !originSet.has(v)); // 两数组非交集部分即为剔除后剩下的数据
})
.catch(e => {
console.log(e, "error");
});
})
},
}
},
computed: {
},
methods: {
/**
* 设置是否显示子成员
*/
setChildMemberShow() {
console.log(this.showChildMember * 1);
this.getEmployee();
},
},
mounted() {
},
}
/**
* 获取分组架构
*/
getGroupData(fn) {
let _this = this;
let params = {
isStoreGroup: 0
};
getRequest("/haoban-manage-web/shared-contact/find-shared-group", {})
.then(res => {
console.log(res.data.result, "gongxiang");
res.data.result.forEach(li => {
li.groupId = li.sharedContactGroupId;
});
_this.menuData = res.data.result || [];
console.log(_this.menuData, "menudata");
_this.menuData.some(li => {
if (li.level == 0) {
_this.groupInfo.departmentId = li.groupId;
_this.groupInfo.groupName = li.name;
}
return li.level == 0;
});
_this.getEmployee();
})
.catch(e => {
console.log(e, "error");
});
},
/**
* 获取员工列表
*/
getEmployee() {
let _this = this;
let params = {
sharedContactGroupId: _this.groupInfo.departmentId,
findChildren: _this.showChildMember * 1
};
getRequest("/haoban-manage-web/shared-contact/find-shared-member", params)
.then(res => {
console.log(res, "menmers");
let list = [];
let total = 0;
if (res.data.errorCode == 1) {
list = res.data.result.list || [];
total = res.data.result.total || 0;
}
_this.employeeList = list;
_this.total = total;
_this.loading = false;
})
.catch(e => {
console.log(e, "error");
_this.loading = false;
});
}
},
computed: {
disabledDel() {
return this.selectedList.length < 1 && !this.setDisabledDel;
}
}
};
</script>
<style lang="less" scoped>
<style lang="scss">
.administrative-estrutura-container {
display: flex;
.af-right-container {
height: 690px;
background: #fff;
flex: 1;
padding: 0 24px;
.af-right-header {
height: 70px;
line-height: 70px;
font-weight: 400;
font-size: 14px;
color: #606266;
.title-span {
color: #303133;
font-size: 20px;
}
.handle-area {
float: right;
.hurdle {
width:1px;
height:16px;
display: inline-block;
background: #DCDFE6;
margin: 0 10px;
vertical-align: sub;
}
}
}
.af-right-button-box {
padding: 8px 15px;
background: #EBEEF5;
}
.pagination {
margin-top: 30px;
text-align: right;
}
.status-icon {
width: 34px;
height: 32px;
line-height: 32px;
text-align: center;
background: #ECF5FF;
border: 1px solid #D9ECFF;
border-radius: 4px;
&.is-active {
.iconfont {
color: #409EFF;
}
}
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment