|
@@ -981,19 +981,32 @@ function setRightData(datas, coolist) {
|
|
|
const newdatas = [];
|
|
|
const reg = /(^GD([a-zA-Z0-9\-]+))|(^([0-9\-]+)$)/;
|
|
|
for (const l of datas) {
|
|
|
+ console.log(l)
|
|
|
if (reg.test(l.code) && l.level <= 4) {
|
|
|
if(l.level === 4 && l.is_leaf === false) {
|
|
|
l.is_leaf = true;
|
|
|
}
|
|
|
- if(l.is_leaf) {
|
|
|
- const coo = _.find(coolist, { 'ledger_id': l.ledger_id, 'user_id': cur_uid });
|
|
|
- if(coo) {
|
|
|
- l.pwd = coo.pwd;
|
|
|
- }
|
|
|
- }
|
|
|
+ // if(l.is_leaf) {
|
|
|
+ // const coo = _.find(coolist, { 'ledger_id': l.ledger_id, 'user_id': cur_uid });
|
|
|
+ // if(coo) {
|
|
|
+ // l.pwd = coo.pwd;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
newdatas.push(l);
|
|
|
}
|
|
|
}
|
|
|
+ for (const nd of newdatas) {
|
|
|
+ const child = _.find(newdatas, { 'ledger_pid': nd.ledger_id });
|
|
|
+ if (!child && !nd.is_leaf) {
|
|
|
+ nd.is_leaf = true;
|
|
|
+ }
|
|
|
+ if(nd.is_leaf) {
|
|
|
+ const coo = _.find(coolist, { 'ledger_id': nd.ledger_id, 'user_id': cur_uid });
|
|
|
+ if(coo) {
|
|
|
+ nd.pwd = coo.pwd;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return newdatas;
|
|
|
}
|
|
|
|