Commit ac990eab by 无尘

feat: 增加门店绑定组件

parent 7d25348f
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-07-21 10:10:57
* @LastEditors: 无尘
* @LastEditTime: 2020-07-21 14:15:54
* @LastEditTime: 2020-07-21 17:21:39
-->
<!--
设置成员所在部门(回收站)
......@@ -12,7 +12,7 @@
import storeAuthDialog from '@/components/company/store-auth-dialog.vue';
-->
<template>
<el-dialog width="600px" title="门店绑定" :visible.sync="setVisible" append-to-body :before-close="handleClose">
<el-dialog width="600px" :title="bindType == 1 ? '门店绑定':'门店共享'" :visible.sync="setVisible" append-to-body :before-close="handleClose">
<div class="bind-store-body">
<div class="el-form-item el-form-item--large">
<label for="name" class="el-form-item__label" style="width: 110px;">
......@@ -49,6 +49,10 @@ import errMsg from '@/common/js/error';
import showMsg from '@/common/js/showmsg';
export default {
props: {
bindType: {
type: String,
default: '1'
},
selectData: {
type: [Object, Array],
default () {
......
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-07-21 10:10:57
* @LastEditors: 无尘
* @LastEditTime: 2020-07-21 11:24:14
* @LastEditTime: 2020-07-21 17:19:53
-->
<!--
设置成员所在部门(回收站)
......@@ -100,10 +100,32 @@
/**
* 选择 tree 节点,获取选择节点信息
*/
checkGroup: function(e) {
checkGroup: function(e, checkedKeys) {
const that = this;
that.groupIds = that.$refs.groupTree.getCheckedNodes();
that.$emit('checkGroupIds', that.$refs.groupTree.getCheckedNodes());
if(!!e.children) {
const checkFlag = checkedKeys.checkedKeys.includes(e.id);
that.$refs.groupTree.setChecked(e.id,checkFlag,true)
e.children.forEach(ele => {
that.$refs.groupTree.setChecked(ele.id,checkFlag,true);
if (checkFlag) {
ele.disabled = true;
}else {
ele.disabled = ele.useFlag ? true :false;
}
// 递归子级禁用和选中
});
}
// 这里还要过滤已选的数据,把非禁用的数据过滤出来
const groups = that.$refs.groupTree.getCheckedNodes();
if (!!groups.length) {
let arr = [];
groups.forEach(ele => {
if (!ele.disabled) {
arr.push(ele)
}
})
that.$emit('checkGroupIds', arr);
}
},
/**
* 获取tree 数据
......
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