@ibiz-template/runtime 0.2.2 → 0.2.5
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/dist/index.esm.js +294 -129
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/controller/common/control/control.controller.d.ts.map +1 -1
- package/out/controller/common/control/control.controller.js +7 -0
- package/out/controller/control/dashboard/dashboard.controller.d.ts.map +1 -1
- package/out/controller/control/dashboard/dashboard.controller.js +4 -0
- package/out/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.d.ts +5 -0
- package/out/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.d.ts.map +1 -0
- package/out/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.js +3 -0
- package/out/controller/control/dashboard/portlet/chart-portlet/index.d.ts +2 -0
- package/out/controller/control/dashboard/portlet/chart-portlet/index.d.ts.map +1 -0
- package/out/controller/control/dashboard/portlet/chart-portlet/index.js +1 -0
- package/out/controller/control/dashboard/portlet/index.d.ts +1 -0
- package/out/controller/control/dashboard/portlet/index.d.ts.map +1 -1
- package/out/controller/control/dashboard/portlet/index.js +1 -0
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.controller.js +6 -2
- package/out/controller/control/form/form/form.controller.d.ts +9 -1
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +20 -1
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts +32 -3
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.js +84 -8
- package/out/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.d.ts +1 -1
- package/out/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.js +2 -2
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts +1 -1
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-item/form-item.controller.js +2 -2
- package/out/interface/service/i-data-entity/i-data-entity.d.ts +19 -2
- package/out/interface/service/i-data-entity/i-data-entity.d.ts.map +1 -1
- package/out/interface/service/service/i-app-de.service.d.ts +11 -0
- package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
- package/out/logic-scheduler/scheduler/control-logic-scheduler.js +2 -2
- package/out/logic-scheduler/trigger/timer-trigger.d.ts.map +1 -1
- package/out/logic-scheduler/trigger/timer-trigger.js +4 -1
- package/out/service/app-data-entity/app-data-entity.d.ts +3 -3
- package/out/service/app-data-entity/app-data-entity.d.ts.map +1 -1
- package/out/service/app-data-entity/app-data-entity.js +13 -12
- package/out/service/service/entity/de.service.d.ts +15 -3
- package/out/service/service/entity/de.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.js +20 -4
- package/out/service/vo/control.vo.d.ts +12 -4
- package/out/service/vo/control.vo.d.ts.map +1 -1
- package/out/service/vo/control.vo.js +88 -52
- package/package.json +3 -3
- package/src/controller/common/control/control.controller.ts +11 -0
- package/src/controller/control/dashboard/dashboard.controller.ts +4 -0
- package/src/controller/control/dashboard/portlet/chart-portlet/chart-portlet.controller.ts +4 -0
- package/src/controller/control/dashboard/portlet/chart-portlet/index.ts +1 -0
- package/src/controller/control/dashboard/portlet/index.ts +1 -0
- package/src/controller/control/form/edit-form/edit-form.controller.ts +7 -2
- package/src/controller/control/form/form/form.controller.ts +26 -2
- package/src/controller/control/form/form-detail/form-detail/form-detail.controller.ts +102 -8
- package/src/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.ts +2 -2
- package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +2 -2
- package/src/interface/service/i-data-entity/i-data-entity.ts +22 -2
- package/src/interface/service/service/i-app-de.service.ts +16 -0
- package/src/logic-scheduler/scheduler/control-logic-scheduler.ts +2 -2
- package/src/logic-scheduler/trigger/timer-trigger.ts +4 -1
- package/src/service/app-data-entity/app-data-entity.ts +21 -16
- package/src/service/service/entity/de.service.ts +29 -5
- package/src/service/vo/control.vo.ts +101 -60
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-data-entity.d.ts","sourceRoot":"","sources":["../../../src/service/app-data-entity/app-data-entity.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"app-data-entity.d.ts","sourceRoot":"","sources":["../../../src/service/app-data-entity/app-data-entity.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,WAAW;IAC/C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B,UAAkB,KAAK,EAAE,KAAK,CAAC;IAE/B,UAAkB,OAAO,EAAE,cAAc,CAAC;IAElC,OAAO,EAAE,MAAM,CAAC;IAEhB,aAAa,EAAE,MAAM,CAAC;IAEtB,WAAW,EAAE,MAAM,CAAC;IAEpB,aAAa,EAAE,MAAM,CAAC;IAEtB,MAAM,EAAE,MAAM,CAAC;IAEf,YAAY,EAAE,MAAM,CAAC;IAErB,UAAU,EAAE,MAAM,CAAC;IAE3B,IAAI,KAAK,IAAI,KAAK,CAEjB;IAED;;;;;;;OAOG;gBACS,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,GAAG,aAAa;IAiF/D;;;;;;OAMG;IACH,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAgClC;;;;;;OAMG;IACH,KAAK,IAAI,aAAa;IAMtB;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,EAAE,KAAK,GAAG,aAAa,GAAG,aAAa;IASlD;;;;;;;;OAQG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO;CAyB5E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clone, isNil } from 'ramda';
|
|
2
2
|
import { DataTypes } from '@ibiz-template/core';
|
|
3
|
+
import { createUUID } from 'qx-util';
|
|
3
4
|
import { Srfuf } from '../constant';
|
|
4
5
|
import { findModelChild } from '../../model';
|
|
5
6
|
/**
|
|
@@ -12,7 +13,7 @@ import { findModelChild } from '../../model';
|
|
|
12
13
|
*/
|
|
13
14
|
export class AppDataEntity {
|
|
14
15
|
get srfuf() {
|
|
15
|
-
return this.srfkey ? Srfuf.UPDATE : Srfuf.CREATE;
|
|
16
|
+
return this.srfkey === this.tempsrfkey ? Srfuf.UPDATE : Srfuf.CREATE;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Creates an instance of AppDataEntity.
|
|
@@ -23,7 +24,6 @@ export class AppDataEntity {
|
|
|
23
24
|
* @param {(IData | AppDataEntity)} data
|
|
24
25
|
*/
|
|
25
26
|
constructor(entity, data) {
|
|
26
|
-
let _srfkey;
|
|
27
27
|
Object.defineProperty(this, '_entity', {
|
|
28
28
|
enumerable: false,
|
|
29
29
|
configurable: true,
|
|
@@ -44,23 +44,16 @@ export class AppDataEntity {
|
|
|
44
44
|
return entity.codeName;
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
|
+
// 主键属性相关
|
|
47
48
|
const keyAppField = findModelChild(entity.appDEFields || [], entity.keyAppDEFieldId);
|
|
48
49
|
if (keyAppField) {
|
|
49
50
|
const key = keyAppField.codeName.toLowerCase();
|
|
50
|
-
Object.defineProperty(this, '
|
|
51
|
+
Object.defineProperty(this, 'srfkeyfield', {
|
|
51
52
|
get() {
|
|
52
53
|
return key;
|
|
53
54
|
},
|
|
54
55
|
});
|
|
55
56
|
Object.defineProperty(this, 'srfkey', {
|
|
56
|
-
set(val) {
|
|
57
|
-
_srfkey = val;
|
|
58
|
-
},
|
|
59
|
-
get() {
|
|
60
|
-
return this._data[key] || _srfkey;
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
Object.defineProperty(this, 'srfsourcekey', {
|
|
64
57
|
set(val) {
|
|
65
58
|
this._data[key] = val;
|
|
66
59
|
},
|
|
@@ -73,9 +66,10 @@ export class AppDataEntity {
|
|
|
73
66
|
ibiz.log.warn(`实体[${entity.codeName}]未配置主键字段`);
|
|
74
67
|
}
|
|
75
68
|
const majorAppField = findModelChild(entity.appDEFields || [], entity.majorAppDEFieldId);
|
|
69
|
+
// 主文本属性相关
|
|
76
70
|
if (majorAppField) {
|
|
77
71
|
const major = majorAppField.codeName.toLowerCase();
|
|
78
|
-
Object.defineProperty(this, '
|
|
72
|
+
Object.defineProperty(this, 'srfmajorfield', {
|
|
79
73
|
get() {
|
|
80
74
|
return major;
|
|
81
75
|
},
|
|
@@ -92,6 +86,13 @@ export class AppDataEntity {
|
|
|
92
86
|
else {
|
|
93
87
|
ibiz.log.warn(`实体[${entity.codeName}]未配置主文本字段`);
|
|
94
88
|
}
|
|
89
|
+
// 设置临时主键
|
|
90
|
+
Object.defineProperty(this, 'tempsrfkey', {
|
|
91
|
+
enumerable: false,
|
|
92
|
+
configurable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
value: isNil(this.srfkey) ? createUUID() : this.srfkey,
|
|
95
|
+
});
|
|
95
96
|
this.defineProperties();
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
@@ -113,14 +113,26 @@ export declare class DEService implements IAppDEService {
|
|
|
113
113
|
*/
|
|
114
114
|
aiChatSse(onmessage: (data: IPortalAsyncAction) => void, context: IParams, params?: IParams, data?: IData): Promise<void>;
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
116
|
+
* 获取 AI 聊天会话历史记录
|
|
117
117
|
*
|
|
118
118
|
* @author chitanda
|
|
119
|
-
* @date 2023-10-
|
|
119
|
+
* @date 2023-10-26 14:10:58
|
|
120
|
+
* @param {IParams} context
|
|
121
|
+
* @param {IParams} [params={}]
|
|
122
|
+
* @param {IData} [data={}]
|
|
123
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
124
|
+
*/
|
|
125
|
+
aiChatHistory(context: IParams, params?: IParams, data?: IData): Promise<IHttpResponse>;
|
|
126
|
+
/**
|
|
127
|
+
* 计算 AI 请求路径
|
|
128
|
+
*
|
|
129
|
+
* @author chitanda
|
|
130
|
+
* @date 2023-10-26 14:10:25
|
|
120
131
|
* @protected
|
|
121
132
|
* @param {IParams} context
|
|
133
|
+
* @param {boolean} [isHistories=false]
|
|
122
134
|
* @return {*} {string}
|
|
123
135
|
*/
|
|
124
|
-
protected calcSsePath(context: IParams): string;
|
|
136
|
+
protected calcSsePath(context: IParams, isHistories?: boolean): string;
|
|
125
137
|
}
|
|
126
138
|
//# sourceMappingURL=de.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.service.d.ts","sourceRoot":"","sources":["../../../../src/service/service/entity/de.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,aAAa,EACb,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;;;;;;GAOG;AACH,qBAAa,SAAU,YAAW,aAAa;IAsDjC,SAAS,CAAC,KAAK,EAAE,cAAc;IArD3C;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IAEpC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAC;IAE7B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAE9D;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAiB;IAExC;;;;;;OAMG;gBACmB,KAAK,EAAE,cAAc;IAU3C;;;;;;;;;OASG;IACH,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,OAAe,GAAG,MAAM;IA6BhE;;;;;;;;;;OAUG;IACH,IAAI,CACF,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,aAAa,CAAC;IAQzB;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,EACxB,OAAO,GAAE,OAAY,GACpB,OAAO,CAAC,aAAa,CAAC;IAQzB;;;;;;;;;;OAUG;IACH,SAAS,CACP,SAAS,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,EAC7C,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,IAAI,CAAC;IA6BhB
|
|
1
|
+
{"version":3,"file":"de.service.d.ts","sourceRoot":"","sources":["../../../../src/service/service/entity/de.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,aAAa,EACb,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;;;;;;GAOG;AACH,qBAAa,SAAU,YAAW,aAAa;IAsDjC,SAAS,CAAC,KAAK,EAAE,cAAc;IArD3C;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IAEpC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAC;IAE7B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAE9D;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAiB;IAExC;;;;;;OAMG;gBACmB,KAAK,EAAE,cAAc;IAU3C;;;;;;;;;OASG;IACH,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,OAAe,GAAG,MAAM;IA6BhE;;;;;;;;;;OAUG;IACH,IAAI,CACF,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,aAAa,CAAC;IAQzB;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,EACxB,OAAO,GAAE,OAAY,GACpB,OAAO,CAAC,aAAa,CAAC;IAQzB;;;;;;;;;;OAUG;IACH,SAAS,CACP,SAAS,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,EAC7C,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,IAAI,CAAC;IA6BhB;;;;;;;;;OASG;IACH,aAAa,CACX,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,aAAa,CAAC;IAMzB;;;;;;;;;OASG;IACH,SAAS,CAAC,WAAW,CACnB,OAAO,EAAE,OAAO,EAChB,WAAW,GAAE,OAAe,GAC3B,MAAM;CAQV"}
|
|
@@ -154,17 +154,33 @@ export class DEService {
|
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
157
|
+
* 获取 AI 聊天会话历史记录
|
|
158
158
|
*
|
|
159
159
|
* @author chitanda
|
|
160
|
-
* @date 2023-10-
|
|
160
|
+
* @date 2023-10-26 14:10:58
|
|
161
|
+
* @param {IParams} context
|
|
162
|
+
* @param {IParams} [params={}]
|
|
163
|
+
* @param {IData} [data={}]
|
|
164
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
165
|
+
*/
|
|
166
|
+
aiChatHistory(context, params = {}, data = {}) {
|
|
167
|
+
const app = ibiz.hub.getApp(this.model.appId);
|
|
168
|
+
const path = this.calcSsePath(context, true);
|
|
169
|
+
return app.net.post(path, data, Object.assign({ srfactag: 'AIChat' }, params));
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* 计算 AI 请求路径
|
|
173
|
+
*
|
|
174
|
+
* @author chitanda
|
|
175
|
+
* @date 2023-10-26 14:10:25
|
|
161
176
|
* @protected
|
|
162
177
|
* @param {IParams} context
|
|
178
|
+
* @param {boolean} [isHistories=false]
|
|
163
179
|
* @return {*} {string}
|
|
164
180
|
*/
|
|
165
|
-
calcSsePath(context) {
|
|
181
|
+
calcSsePath(context, isHistories = false) {
|
|
166
182
|
const srfkey = context[this.model.codeName.toLowerCase()];
|
|
167
|
-
const curPath = `/${this.model.codeName2.toLowerCase()}/ssechatcompletion${srfkey ? `/${srfkey}` : ''}`;
|
|
183
|
+
const curPath = `/${this.model.codeName2.toLowerCase()}/ssechatcompletion${isHistories ? '/histories' : ''}${srfkey ? `/${srfkey}` : ''}`;
|
|
168
184
|
const resPath = calcResPath(context, this.model);
|
|
169
185
|
return resPath + curPath;
|
|
170
186
|
}
|
|
@@ -43,7 +43,15 @@ export declare class ControlVO {
|
|
|
43
43
|
* @date 2022-09-07 19:09:42
|
|
44
44
|
* @type {string}
|
|
45
45
|
*/
|
|
46
|
-
srfkey
|
|
46
|
+
srfkey?: string;
|
|
47
|
+
/**
|
|
48
|
+
* 临时主键
|
|
49
|
+
*
|
|
50
|
+
* @author lxm
|
|
51
|
+
* @date 2022-09-07 19:09:42
|
|
52
|
+
* @type {string}
|
|
53
|
+
*/
|
|
54
|
+
tempsrfkey: string;
|
|
47
55
|
/**
|
|
48
56
|
* 主信息
|
|
49
57
|
*
|
|
@@ -51,7 +59,7 @@ export declare class ControlVO {
|
|
|
51
59
|
* @date 2022-09-07 19:09:42
|
|
52
60
|
* @type {string}
|
|
53
61
|
*/
|
|
54
|
-
srfmajortext
|
|
62
|
+
srfmajortext?: string;
|
|
55
63
|
/**
|
|
56
64
|
* 实体模型标识
|
|
57
65
|
*
|
|
@@ -75,7 +83,7 @@ export declare class ControlVO {
|
|
|
75
83
|
* @date 2022-09-07 19:09:42
|
|
76
84
|
* @type {string}
|
|
77
85
|
*/
|
|
78
|
-
|
|
86
|
+
srfkeyfield: string;
|
|
79
87
|
/**
|
|
80
88
|
* 实体主信息属性
|
|
81
89
|
*
|
|
@@ -83,7 +91,7 @@ export declare class ControlVO {
|
|
|
83
91
|
* @date 2022-09-07 19:09:42
|
|
84
92
|
* @type {string}
|
|
85
93
|
*/
|
|
86
|
-
|
|
94
|
+
srfmajorfield: string;
|
|
87
95
|
/**
|
|
88
96
|
* Creates an instance of ControlVO.
|
|
89
97
|
* @author lxm
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.vo.d.ts","sourceRoot":"","sources":["../../../src/service/vo/control.vo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"control.vo.d.ts","sourceRoot":"","sources":["../../../src/service/vo/control.vo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAa5C;;;;;;;GAOG;AACH,qBAAa,SAAS;IAEpB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B;;;;;;;OAOG;IACK,OAAO,EAAE,KAAK,CAAC;IAEvB;;;;;;;OAOG;IACK,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAE5C;;;;;;OAMG;IACK,KAAK,EAAE,KAAK,CAAC;IAErB;;;;;;OAMG;IACK,MAAM,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACK,UAAU,EAAE,MAAM,CAAC;IAE3B;;;;;;OAMG;IACK,YAAY,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;OAMG;IACK,OAAO,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACK,aAAa,EAAE,MAAM,CAAC;IAE9B;;;;;;OAMG;IACK,WAAW,EAAE,MAAM,CAAC;IAE5B;;;;;;OAMG;IACK,aAAa,EAAE,MAAM,CAAC;IAE9B;;;;;;OAMG;gBAED,OAAO,GAAE,KAAU,EACnB,UAAU,GAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAa;IAkHjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,YAAY;IAqCpB;;;;;;OAMG;IACH,SAAS,IAAI,KAAK;IAIlB;;;;;;OAMG;IACH,SAAS,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI;IAIxC;;;;;;OAMG;IACH,KAAK,IAAI,SAAS;CAQnB"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
import { createUUID } from 'qx-util';
|
|
1
2
|
import { clone, isNil } from 'ramda';
|
|
2
3
|
import { Srfuf } from '../constant';
|
|
3
|
-
const
|
|
4
|
+
const BuildInKeys = [
|
|
5
|
+
'srfkey',
|
|
6
|
+
'srfmajortext',
|
|
7
|
+
'srfmajorfield',
|
|
8
|
+
'srfkeyfield',
|
|
9
|
+
'tempsrfkey',
|
|
10
|
+
'srfuf',
|
|
11
|
+
'srfdeid',
|
|
12
|
+
'srfdecodename',
|
|
13
|
+
];
|
|
4
14
|
/**
|
|
5
15
|
* 部件UI显示层数据转换
|
|
6
16
|
*
|
|
@@ -18,6 +28,7 @@ export class ControlVO {
|
|
|
18
28
|
* @param {Map<string, string>} dataUIMap 转换映射map,key为转换后的属性,value为映射字段描述信息
|
|
19
29
|
*/
|
|
20
30
|
constructor($origin = {}, $dataUIMap = new Map()) {
|
|
31
|
+
// 自身的属性
|
|
21
32
|
Object.defineProperty(this, '$origin', {
|
|
22
33
|
enumerable: false,
|
|
23
34
|
configurable: true,
|
|
@@ -28,57 +39,85 @@ export class ControlVO {
|
|
|
28
39
|
configurable: true,
|
|
29
40
|
value: $dataUIMap || new Map(),
|
|
30
41
|
});
|
|
42
|
+
// 可读写的预置属性,主键属性和主文本属性
|
|
43
|
+
['srfkey', 'srfmajortext'].forEach(key => {
|
|
44
|
+
if (Object.prototype.hasOwnProperty.call(this.$origin, key)) {
|
|
45
|
+
Object.defineProperty(this, key, {
|
|
46
|
+
get() {
|
|
47
|
+
return this.$origin.srfkey;
|
|
48
|
+
},
|
|
49
|
+
set(val) {
|
|
50
|
+
this.$origin.srfkey = val;
|
|
51
|
+
},
|
|
52
|
+
enumerable: false,
|
|
53
|
+
configurable: true,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else if (this.$dataUIMap.has(key)) {
|
|
57
|
+
const { dataKey } = this.$dataUIMap.get(key);
|
|
58
|
+
Object.defineProperty(this, key, {
|
|
59
|
+
get() {
|
|
60
|
+
return this.$origin[dataKey];
|
|
61
|
+
},
|
|
62
|
+
set(val) {
|
|
63
|
+
this.$origin[dataKey] = val;
|
|
64
|
+
},
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
Object.defineProperty(this, key, {
|
|
71
|
+
enumerable: false,
|
|
72
|
+
configurable: true,
|
|
73
|
+
writable: true,
|
|
74
|
+
value: null,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// tempsrfkey临时主键
|
|
79
|
+
if (Object.prototype.hasOwnProperty.call(this.$origin, 'tempsrfkey')) {
|
|
80
|
+
// $origin有的操作$origin的属性
|
|
81
|
+
Object.defineProperty(this, 'tempsrfkey', {
|
|
82
|
+
get() {
|
|
83
|
+
return this.$origin.tempsrfkey;
|
|
84
|
+
},
|
|
85
|
+
set(val) {
|
|
86
|
+
this.$origin.tempsrfkey = val;
|
|
87
|
+
},
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// $$origin没有的自己赋值
|
|
94
|
+
Object.defineProperty(this, 'tempsrfkey', {
|
|
95
|
+
enumerable: false,
|
|
96
|
+
configurable: true,
|
|
97
|
+
writable: true,
|
|
98
|
+
value: isNil(this.srfkey) ? createUUID() : this.srfkey,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// srfuf纯计算属性,不可修改
|
|
31
102
|
Object.defineProperty(this, 'srfuf', {
|
|
32
103
|
get() {
|
|
33
|
-
if (
|
|
34
|
-
return this.
|
|
104
|
+
if (Object.prototype.hasOwnProperty.call(this.$origin, 'srfuf')) {
|
|
105
|
+
return this.$origin.srfuf;
|
|
35
106
|
}
|
|
36
|
-
return this
|
|
37
|
-
},
|
|
38
|
-
enumerable: false,
|
|
39
|
-
configurable: true,
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(this, 'srfkey', {
|
|
42
|
-
get() {
|
|
43
|
-
return this.$origin.srfkey;
|
|
44
|
-
},
|
|
45
|
-
enumerable: false,
|
|
46
|
-
configurable: true,
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(this, 'srfmajortext', {
|
|
49
|
-
get() {
|
|
50
|
-
return this.$origin.srfmajortext;
|
|
107
|
+
return this.srfkey === this.tempsrfkey ? Srfuf.UPDATE : Srfuf.CREATE;
|
|
51
108
|
},
|
|
52
109
|
enumerable: false,
|
|
53
110
|
configurable: true,
|
|
54
111
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return this.$origin.srfdecodename;
|
|
65
|
-
},
|
|
66
|
-
enumerable: false,
|
|
67
|
-
configurable: true,
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperty(this, 'srfkeyfile', {
|
|
70
|
-
get() {
|
|
71
|
-
return this.$origin.srfkeyfile;
|
|
72
|
-
},
|
|
73
|
-
enumerable: false,
|
|
74
|
-
configurable: true,
|
|
75
|
-
});
|
|
76
|
-
Object.defineProperty(this, 'srfmajorfile', {
|
|
77
|
-
get() {
|
|
78
|
-
return this.$origin.srfmajorfile;
|
|
79
|
-
},
|
|
80
|
-
enumerable: false,
|
|
81
|
-
configurable: true,
|
|
112
|
+
// 只读的预置属性
|
|
113
|
+
['srfdeid', 'srfdecodename', 'srfkeyfield', 'srfmajorfield'].forEach(key => {
|
|
114
|
+
Object.defineProperty(this, key, {
|
|
115
|
+
get() {
|
|
116
|
+
return this.$origin[key];
|
|
117
|
+
},
|
|
118
|
+
enumerable: false,
|
|
119
|
+
configurable: true,
|
|
120
|
+
});
|
|
82
121
|
});
|
|
83
122
|
// 先转换映射的属性
|
|
84
123
|
this.$dataUIMap.forEach((mapField, key) => {
|
|
@@ -108,21 +147,18 @@ export class ControlVO {
|
|
|
108
147
|
*/
|
|
109
148
|
linkProperty(uiKey, dataKey, mapField) {
|
|
110
149
|
const isOriginField = mapField ? mapField.isOriginField : true;
|
|
111
|
-
//
|
|
112
|
-
if (uiKey
|
|
150
|
+
// 预置的属性不做处理
|
|
151
|
+
if (BuildInKeys.includes(uiKey)) {
|
|
113
152
|
return;
|
|
114
153
|
}
|
|
115
154
|
// 后台数据存在$origin里,其他存在ControlVo上
|
|
116
155
|
if (isOriginField ||
|
|
117
156
|
Object.prototype.hasOwnProperty.call(this.$origin, uiKey)) {
|
|
118
157
|
Object.defineProperty(this, uiKey, {
|
|
119
|
-
enumerable:
|
|
158
|
+
enumerable: true,
|
|
120
159
|
configurable: true,
|
|
121
160
|
get() {
|
|
122
|
-
|
|
123
|
-
return uiKey === 'srfkey'
|
|
124
|
-
? this.$origin[dataKey] || this.$origin[uiKey]
|
|
125
|
-
: this.$origin[dataKey];
|
|
161
|
+
return this.$origin[dataKey];
|
|
126
162
|
},
|
|
127
163
|
set(val) {
|
|
128
164
|
// 有mapField的走它的转换
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "chitanda",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ibiz-template/core": "^0.2.
|
|
32
|
+
"@ibiz-template/core": "^0.2.4",
|
|
33
33
|
"@ibiz/model-core": "^0.0.19",
|
|
34
34
|
"@types/path-browserify": "^1.0.0",
|
|
35
35
|
"@types/qs": "^6.9.8",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"qx-util": "^0.4.8",
|
|
60
60
|
"ramda": "^0.29.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "fab2e0edf52082dcbd450b48716dac8b63809b3f"
|
|
63
63
|
}
|
|
@@ -145,6 +145,17 @@ export class ControlController<
|
|
|
145
145
|
this.handleControlParams();
|
|
146
146
|
// 部件逻辑初始化
|
|
147
147
|
this.initControlScheduler(this.model.controlLogics);
|
|
148
|
+
|
|
149
|
+
// 监听部件所有事件触发部件逻辑
|
|
150
|
+
if (this.scheduler?.hasControlEventTrigger) {
|
|
151
|
+
this._evt.onAll((eventName, event) => {
|
|
152
|
+
this.scheduler!.triggerControlEvent(
|
|
153
|
+
event.targetName,
|
|
154
|
+
event.eventName,
|
|
155
|
+
event,
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
protected async onMounted(): Promise<void> {
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
IDBContainerPortletPart,
|
|
4
4
|
IDBPortletPart,
|
|
5
5
|
} from '@ibiz/model-core';
|
|
6
|
+
import { ControlType } from '../../../constant';
|
|
6
7
|
import {
|
|
7
8
|
IDashboardState,
|
|
8
9
|
IDashboardEvent,
|
|
@@ -85,6 +86,9 @@ export class DashboardController
|
|
|
85
86
|
}
|
|
86
87
|
await Promise.all(
|
|
87
88
|
portletModels.map(async portlet => {
|
|
89
|
+
if (portlet.controlType === ControlType.CHART) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
88
92
|
const provider = await getPortletProvider(portlet);
|
|
89
93
|
if (provider) {
|
|
90
94
|
this.providers[portlet.id!] = provider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './chart-portlet.controller';
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from '@ibiz-template/core';
|
|
8
8
|
import { IAppDEEditView, IDEEditForm } from '@ibiz/model-core';
|
|
9
9
|
import { debounce } from 'lodash-es';
|
|
10
|
+
import { createUUID } from 'qx-util';
|
|
10
11
|
import { clone } from 'ramda';
|
|
11
12
|
import {
|
|
12
13
|
IEditFormState,
|
|
@@ -160,7 +161,9 @@ export class EditFormController
|
|
|
160
161
|
await this.endLoading();
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
// 清空主键,重置临时主键
|
|
165
|
+
res.data.srfkey = undefined;
|
|
166
|
+
res.data.tempsrfkey = createUUID();
|
|
164
167
|
|
|
165
168
|
this.state.modified = false;
|
|
166
169
|
this.state.data = res.data;
|
|
@@ -260,9 +263,11 @@ export class EditFormController
|
|
|
260
263
|
} finally {
|
|
261
264
|
await this.endLoading();
|
|
262
265
|
}
|
|
263
|
-
|
|
266
|
+
|
|
267
|
+
// 保存结束后合并修改临时主键
|
|
264
268
|
if (res.data) {
|
|
265
269
|
mergeInLeft(this.data, res.data);
|
|
270
|
+
this.data.tempsrfkey = this.data.srfkey;
|
|
266
271
|
}
|
|
267
272
|
this.state.modified = false;
|
|
268
273
|
await this.evt.emit('onSaveSuccess', undefined);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
|
-
import { debounceAndAsyncMerge } from '@ibiz-template/core';
|
|
3
|
-
import { IDEForm, IDEFormDetail } from '@ibiz/model-core';
|
|
2
|
+
import { debounceAndAsyncMerge, recursiveIterate } from '@ibiz-template/core';
|
|
3
|
+
import { IControlLogic, IDEForm, IDEFormDetail } from '@ibiz/model-core';
|
|
4
4
|
import {
|
|
5
5
|
IFormState,
|
|
6
6
|
IFormEvent,
|
|
@@ -272,4 +272,28 @@ export abstract class FormController<
|
|
|
272
272
|
): void {
|
|
273
273
|
super.actionNotification(tag, { data: this.data, ...(opts || {}) });
|
|
274
274
|
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 初始化部件逻辑调度器
|
|
278
|
+
* @author lxm
|
|
279
|
+
* @date 2023-08-21 11:53:37
|
|
280
|
+
* @param {IControlLogic[]} logics
|
|
281
|
+
* @return {*} {void}
|
|
282
|
+
*/
|
|
283
|
+
protected initControlScheduler(logics: IControlLogic[] = []): void {
|
|
284
|
+
const actualLogics = [...logics];
|
|
285
|
+
// 遍历所有的项,如果有逻辑的话加入
|
|
286
|
+
recursiveIterate(
|
|
287
|
+
this.model,
|
|
288
|
+
(item: IDEFormDetail) => {
|
|
289
|
+
if (item.controlLogics) {
|
|
290
|
+
actualLogics.push(...item.controlLogics);
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
childrenFields: ['deformPages', 'deformTabPages', 'deformDetails'],
|
|
295
|
+
},
|
|
296
|
+
);
|
|
297
|
+
super.initControlScheduler(actualLogics);
|
|
298
|
+
}
|
|
275
299
|
}
|