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>
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