q-koa 9.5.3 → 9.6.0
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/core/app.js +10 -6
- package/core/file/plugins/system/service.js +9 -1
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -979,12 +979,16 @@ class APP {
|
|
|
979
979
|
|
|
980
980
|
if (referenceInclude) {
|
|
981
981
|
const _referenceInclude = Object.keys(referenceInclude).map(
|
|
982
|
-
(model) =>
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
982
|
+
(model) => {
|
|
983
|
+
const { required = true, ...rest } = referenceInclude[model]
|
|
984
|
+
return {
|
|
985
|
+
model: app[appName].model[model],
|
|
986
|
+
where: {
|
|
987
|
+
...rest,
|
|
988
|
+
},
|
|
989
|
+
required,
|
|
990
|
+
}
|
|
991
|
+
}
|
|
988
992
|
)
|
|
989
993
|
myInclude = [...myInclude, ..._referenceInclude]
|
|
990
994
|
}
|
|
@@ -255,6 +255,14 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
|
|
|
255
255
|
return {
|
|
256
256
|
...obj,
|
|
257
257
|
setting: obj.setting.map((i) => {
|
|
258
|
+
let reset = true
|
|
259
|
+
if (i.parent_id) {
|
|
260
|
+
const parent = obj.setting.find((s) => s.id === i.parent_id)
|
|
261
|
+
const same = obj.setting.filter((s) => s.code === i.code)
|
|
262
|
+
if (parent && parent.code !== config && same.length > 1) {
|
|
263
|
+
reset = false
|
|
264
|
+
}
|
|
265
|
+
}
|
|
258
266
|
if (i.code === 'is_check' && i.value === false) {
|
|
259
267
|
return {
|
|
260
268
|
...(i.toJSON ? i.toJSON() : i),
|
|
@@ -269,7 +277,7 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
|
|
|
269
277
|
) {
|
|
270
278
|
return {
|
|
271
279
|
...(i.toJSON ? i.toJSON() : i),
|
|
272
|
-
value: target[i.code],
|
|
280
|
+
...(reset ? { value: target[i.code] } : {}),
|
|
273
281
|
}
|
|
274
282
|
}
|
|
275
283
|
return i
|