Commit 12d1e461 by crushh

Merge branch 'feature/2月迭代' into dev

parents 4491c11c a86a0dd9
......@@ -166,7 +166,7 @@
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="scopeVisible = false">取消</el-button>
<el-button @click="treeDialogCancel">取消</el-button>
<el-button type="primary" @click="addSuitDepartment">确认</el-button>
</div>
</el-dialog>
......@@ -310,6 +310,10 @@ export default {
});
});
},
treeDialogCancel() {
this.scopeVisible = false;
this.filterText = '';
},
addSuitDepartment() {
this.form.suitDepartmentAddList = Object.assign([], this.selectedTreeData);
this.scopeVisible = false;
......@@ -355,7 +359,8 @@ export default {
// 前端搜索部门树
this.treeData = this.treeDataCopy.filter(ele => ele.departmentName.indexOf(this.filterText) != -1);
if (this.selectedTreeData.length) {
this.$refs.tree.setCheckedKeys(this.selectedTreeData.map(item => item.departmentId));
const arr = this.selectedTreeData.map(item => item.departmentId);
this.$refs.tree.setCheckedKeys(arr);
} else {
this.$refs.tree.setCheckedKeys([]);
}
......@@ -363,10 +368,21 @@ export default {
handleCheck(data, arr) {
// 部门树选中时
const { checkedNodes } = arr;
if (this.filterText) {
// 搜索时的树
const arr = this.selectedTreeData.map(item => item.departmentId);
checkedNodes.forEach(item => {
if (!arr.includes(item.departmentId)) {
this.selectedTreeData.push(item);
}
});
} else {
this.selectedTreeData = JSON.parse(JSON.stringify(checkedNodes));
}
},
handleCheckChange(data, checked) {
// 部门树选中变化时
console.log('部门树选中变化时', this.selectedTreeData.length);
const obj = JSON.parse(JSON.stringify(data));
if (!checked) {
this.$nextTick(() => {
......
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