zet-lib 1.2.16 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/zRole.js +20 -48
- package/lib/zRoute.js +1 -1
- package/package.json +1 -1
package/lib/zRole.js
CHANGED
|
@@ -138,26 +138,6 @@ a.access = (req, res, next) => {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
a.menuValidasi = (res, me, obj) => {
|
|
142
|
-
let jsonArray = []
|
|
143
|
-
obj.children = a.childrenMenu(res, me.children)
|
|
144
|
-
if (obj.children.length) {
|
|
145
|
-
//console.log('children : ',obj.children);
|
|
146
|
-
let count = obj.children.length
|
|
147
|
-
for (let i = 0; i < count; i++) {
|
|
148
|
-
if (obj.children[i].hasOwnProperty('children')) {
|
|
149
|
-
if (obj.children[i].hasOwnProperty('children') > 0) {
|
|
150
|
-
} else {
|
|
151
|
-
jsonArray.push(obj.children[i])
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
jsonArray.push(obj.children[i])
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return jsonArray
|
|
159
|
-
}
|
|
160
|
-
|
|
161
141
|
a.menu = (req, res) => {
|
|
162
142
|
let jsonArray = []
|
|
163
143
|
if (!res.locals.isLogin) return jsonArray
|
|
@@ -170,35 +150,21 @@ a.menu = (req, res) => {
|
|
|
170
150
|
}
|
|
171
151
|
//console.log(JSON.stringify(arr))
|
|
172
152
|
let count = arr.length
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
153
|
+
arr.map((me) => {
|
|
154
|
+
if (a.menuAccess(res, me.href)) {
|
|
155
|
+
let obj = a.addItemMenu(me)
|
|
156
|
+
//console.log(obj)
|
|
157
|
+
if (me.hasOwnProperty('children')) {
|
|
158
|
+
obj.children = a.childrenMenu(res, me.children)
|
|
159
|
+
if (obj.children.length) {
|
|
160
|
+
jsonArray.push(obj)
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
jsonArray.push(obj)
|
|
181
164
|
}
|
|
182
|
-
} else {
|
|
183
|
-
jsonArray.push(obj)
|
|
184
165
|
}
|
|
185
|
-
}
|
|
186
|
-
/* arr.map((me) => {
|
|
187
|
-
if (a.menuAccess(res, me.href)) {
|
|
188
|
-
let obj = a.addItemMenu(me);
|
|
189
|
-
if (me.hasOwnProperty("children")) {
|
|
190
|
-
obj.children = a.childrenMenu(res, me.children);
|
|
191
|
-
if(obj.children.length) {
|
|
192
|
-
jsonArray.push(obj);
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
jsonArray.push(obj);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});*/
|
|
199
|
-
|
|
166
|
+
})
|
|
200
167
|
//console.log(JSON.stringify(jsonArray))
|
|
201
|
-
|
|
202
168
|
return jsonArray
|
|
203
169
|
}
|
|
204
170
|
|
|
@@ -243,7 +209,6 @@ a.menuSystems = (req, res) => {
|
|
|
243
209
|
a.menus = (req, res) => {
|
|
244
210
|
let arr = a.menu(req, res)
|
|
245
211
|
let menus = [...arr, ...a.menuSystems(req, res)]
|
|
246
|
-
//console.log(JSON.stringify(menus));
|
|
247
212
|
return menus
|
|
248
213
|
}
|
|
249
214
|
|
|
@@ -270,11 +235,18 @@ a.childrenMenu = (res, arr) => {
|
|
|
270
235
|
if (item.hasOwnProperty('children') && item.children.length) {
|
|
271
236
|
let child = []
|
|
272
237
|
child.push(a.childrenMenu(res, item.children))
|
|
238
|
+
//console.log('child',child)
|
|
273
239
|
if (child[0]) {
|
|
274
240
|
obj.children = child[0]
|
|
241
|
+
} else {
|
|
242
|
+
delete obj
|
|
275
243
|
}
|
|
276
244
|
}
|
|
277
|
-
|
|
245
|
+
if (obj.hasOwnProperty('children') && obj.children.length == 0) {
|
|
246
|
+
} else {
|
|
247
|
+
myArr.push(obj)
|
|
248
|
+
}
|
|
249
|
+
//console.log('OBJ ===== ', obj)
|
|
278
250
|
}
|
|
279
251
|
})
|
|
280
252
|
}
|
package/lib/zRoute.js
CHANGED
|
@@ -1687,7 +1687,7 @@ zRoute.listDataTable = async (req, res, objData = {}) => {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
let whereArray = []
|
|
1689
1689
|
if (objData.hasOwnProperty('whereArray')) {
|
|
1690
|
-
whereArray
|
|
1690
|
+
whereArray = objData['whereArray']
|
|
1691
1691
|
}
|
|
1692
1692
|
whereArray.push({
|
|
1693
1693
|
field: 'company_id',
|