Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
office-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
office
office-web
Commits
18331636
Commit
18331636
authored
Jan 11, 2019
by
xiaohai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
edf23bf4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
74 deletions
+95
-74
vueSelectEmployee.vue
src/components/common/vueSelectEmployee.vue
+95
-74
No files found.
src/components/common/vueSelectEmployee.vue
View file @
18331636
...
...
@@ -123,84 +123,105 @@
},
methods
:
{
formatGroupData
(
treeData
,
personData
)
{
let
_this
=
this
;
let
data
=
[].
concat
(
JSON
.
parse
(
JSON
.
stringify
(
treeData
)));
let
employees
=
[].
concat
(
JSON
.
parse
(
JSON
.
stringify
(
personData
)));
let
copyData
=
data
.
slice
(
0
);
let
onlyGroup
=
_this
.
onlyGroup
;
this
.
menuData
=
[];
this
.
defaultOpen
=
[];
this
.
menusObj
=
{};
data
.
forEach
(
group
=>
{
group
.
allClerks
=
null
;
group
.
childrens
=
null
;
group
.
label
=
group
.
name
||
""
;
group
.
id
=
group
.
groupId
||
""
;
let
allClerks
=
[];
let
arr
=
[];
if
(
onlyGroup
.
length
>
0
)
{
if
(
onlyGroup
.
indexOf
(
group
.
groupId
)
>
-
1
)
{
group
.
disableOpen
=
false
;
group
.
disabled
=
true
;
}
else
{
group
.
disabled
=
true
;
group
.
disableOpen
=
true
;
}
}
else
{
group
.
disabled
=
_this
.
onlyPerson
?
true
:
group
.
hasPression
==
1
?
false
:
true
;
}
copyData
.
forEach
(
cG
=>
{
cG
.
label
=
cG
.
name
||
""
;
cG
.
id
=
cG
.
groupId
||
""
;
cG
.
disableOpen
=
false
;
if
(
onlyGroup
.
length
>
0
)
{
if
(
onlyGroup
.
indexOf
(
cG
.
groupId
)
>
-
1
)
{
cG
.
disableOpen
=
false
;
cG
.
disabled
=
true
;
if
(
cG
.
parentId
==
group
.
groupId
)
{
arr
.
push
(
cG
);
}
}
else
{
cG
.
disabled
=
true
;
cG
.
disableOpen
=
true
;
}
}
else
{
cG
.
disabled
=
_this
.
onlyPerson
?
true
:
cG
.
hasPression
==
1
?
false
:
true
;
if
(
cG
.
parentId
==
group
.
groupId
)
{
arr
.
push
(
cG
);
}
}
});
if
(
_this
.
treeSet
.
isSelectPerson
&&
group
.
hasPression
==
1
)
employees
.
forEach
(
person
=>
{
person
.
label
=
person
.
name
;
person
.
id
=
person
.
employeeClerkId
;
if
(
person
.
departmentId
==
group
.
groupId
)
{
arr
.
push
(
person
);
allClerks
.
push
(
person
);
}
_this
.
menusObj
[
person
.
id
]
=
person
;
});
if
(
arr
.
length
>
0
)
group
.
childrens
=
arr
;
group
.
allClerks
=
allClerks
;
if
(
onlyGroup
.
length
>
0
)
{
if
(
onlyGroup
.
indexOf
(
group
.
groupId
)
>
-
1
)
{
group
.
hasLoad
=
true
;
_this
.
defaultOpen
.
push
(
group
.
id
);
if
(
onlyGroup
.
indexOf
(
group
.
parentId
)
<
0
)
{
_this
.
menuData
.
push
(
group
);
}
}
let
obj
=
{};
let
arr
=
[];
arr
=
treeData
.
splice
(
0
).
concat
(
personData
.
slice
(
0
));
arr
.
forEach
(
tree
=>
{
if
(
tree
.
employeeClerkId
)
{
tree
.
id
=
tree
.
employeeClerkId
;
tree
.
label
=
tree
.
name
;
obj
[
tree
.
id
]
=
tree
;
}
else
{
if
(
group
.
level
==
0
)
{
group
.
disabled
=
!
(
group
.
childrens
==
null
||
group
.
childrens
.
length
==
0
);
group
.
hasLoad
=
true
;
_this
.
menuData
=
[
group
];
_this
.
defaultOpen
.
push
(
group
.
id
);
}
tree
.
id
=
tree
.
groupId
;
tree
.
label
=
tree
.
name
;
obj
[
tree
.
id
]
=
tree
;
}
_this
.
menusObj
[
group
.
id
]
=
group
;
});
this
.
sortTheGroup
(
obj
);
},
sortTheGroup
(
groups
)
{
console
.
log
(
groups
);
},
// formatGroupData(treeData, personData) {
// console.log(treeData, personData);
// let _this = this;
// let data = treeData.slice(0);
// let employees = personData.slice(0);
// let copyData = data.slice(0);
// let onlyGroup = _this.onlyGroup;
// this.menuData = [];
// this.defaultOpen = [];
// this.menusObj = {};
// data.forEach(group => {
// group.allClerks = null;
// group.childrens = null;
// group.label = group.name || "";
// group.id = group.groupId || "";
// let allClerks = [];
// let arr = [];
// if (onlyGroup.length > 0) {
// if (onlyGroup.indexOf(group.groupId) > -1) {
// group.disableOpen = false;
// group.disabled = true;
// } else {
// group.disabled = true;
// group.disableOpen = true;
// }
// } else {
// group.disabled = _this.onlyPerson ? true : group.hasPression == 1 ? false : true;
// }
// copyData.forEach(cG => {
// cG.label = cG.name || "";
// cG.id = cG.groupId || "";
// cG.disableOpen = false;
// if (onlyGroup.length > 0) {
// if (onlyGroup.indexOf(cG.groupId) > -1) {
// cG.disableOpen = false;
// cG.disabled = true;
// if (cG.parentId == group.groupId) {
// arr.push(cG);
// }
// } else {
// cG.disabled = true;
// cG.disableOpen = true;
// }
// } else {
// cG.disabled = _this.onlyPerson ? true : cG.hasPression == 1 ? false : true;
// if (cG.parentId == group.groupId) {
// arr.push(cG);
// }
// }
// });
// if (_this.treeSet.isSelectPerson && group.hasPression == 1) employees.forEach(person => {
// person.label = person.name;
// person.id = person.employeeClerkId;
// if (person.departmentId == group.groupId) {
// arr.push(person);
// allClerks.push(person);
// }
// _this.menusObj[person.id] = person;
// });
// if (arr.length > 0) group.childrens = arr;
// group.allClerks = allClerks;
// if (onlyGroup.length > 0) {
// if (onlyGroup.indexOf(group.groupId) > -1) {
// group.hasLoad = true;
// _this.defaultOpen.push(group.id);
// if (onlyGroup.indexOf(group.parentId)
<
0
)
{
// _this.menuData.push(group);
// }
// }
// } else {
// if (group.level == 0) {
// group.disabled = !(group.childrens == null || group.childrens.length == 0);
// group.hasLoad = true;
// _this.menuData = [group];
// _this.defaultOpen.push(group.id);
// }
// }
// _this.menusObj[group.id] = group;
// });
// },
/**
* 树形菜单选择
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment