midway-fatcms 0.0.1-beta.5 → 0.0.1-beta.51
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/.eslintrc.json +14 -0
- package/.prettierrc.js +4 -0
- package/README.md +7 -0
- package/dist/config/config.default.js +25 -13
- package/dist/config/seed/aeskey.txt +1 -1
- package/dist/configuration.d.ts +1 -0
- package/dist/configuration.js +35 -11
- package/dist/controller/base/BaseApiController.d.ts +7 -1
- package/dist/controller/base/BaseApiController.js +32 -6
- package/dist/controller/gateway/AsyncTaskController.d.ts +20 -0
- package/dist/controller/gateway/AsyncTaskController.js +181 -0
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +3 -3
- package/dist/controller/gateway/CrudMtdGatewayController.js +9 -6
- package/dist/controller/gateway/CrudStdGatewayController.js +8 -16
- package/dist/controller/gateway/DocGatewayController.js +14 -9
- package/dist/controller/gateway/FileController.d.ts +3 -2
- package/dist/controller/gateway/PublicApiController.js +4 -6
- package/dist/controller/gateway/StaticController.d.ts +0 -1
- package/dist/controller/gateway/StaticController.js +40 -39
- package/dist/controller/helpers.controller.d.ts +1 -1
- package/dist/controller/home.controller.js +4 -3
- package/dist/controller/manage/AnyApiMangeApi.js +2 -2
- package/dist/controller/manage/AppLogMangeApi.js +2 -2
- package/dist/controller/manage/AppMangeApi.js +2 -2
- package/dist/controller/manage/AppPageMangeApi.js +2 -2
- package/dist/controller/manage/AppSchemaHistoryApi.js +2 -2
- package/dist/controller/manage/CrudMethodsMangeApi.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +9 -1
- package/dist/controller/manage/CrudStandardDesignApi.js +135 -79
- package/dist/controller/manage/DataDictManageApi.d.ts +1 -1
- package/dist/controller/manage/DataDictManageApi.js +1 -1
- package/dist/controller/manage/DeployManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.js +38 -34
- package/dist/controller/manage/DocLibManageApi.js +2 -2
- package/dist/controller/manage/DocManageApi.js +2 -2
- package/dist/controller/manage/FileManageApi.js +1 -1
- package/dist/controller/manage/LowCodeTplManageApi.js +2 -2
- package/dist/controller/manage/MenuManageApi.js +2 -2
- package/dist/controller/manage/ProxyApiMangeApi.js +2 -2
- package/dist/controller/manage/SuperAdminManageApi.d.ts +2 -2
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -1
- package/dist/controller/manage/SysConfigMangeApi.js +8 -6
- package/dist/controller/manage/SystemInfoManageApi.d.ts +1 -1
- package/dist/controller/manage/SystemInfoManageApi.js +7 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +1 -1
- package/dist/controller/manage/UserAccountManageApi.js +9 -4
- package/dist/controller/manage/WorkbenchMangeApi.js +3 -3
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +1 -54
- package/dist/controller/render/AppRenderController.js +12 -5
- package/dist/controller/test.controller.d.ts +1 -1
- package/dist/controller/test.controller.js +5 -5
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/libs/crud-pro/CrudPro.d.ts +1 -0
- package/dist/libs/crud-pro/CrudPro.js +5 -0
- package/dist/libs/crud-pro/defaultConfigs.js +2 -0
- package/dist/libs/crud-pro/interfaces.d.ts +7 -1
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +12 -5
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +8 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +8 -0
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/ResModel.d.ts +16 -0
- package/dist/libs/crud-pro/models/ResModel.js +2 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/Transaction.d.ts +1 -0
- package/dist/libs/crud-pro/models/Transaction.js +7 -0
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +1 -1
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +27 -15
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +17 -19
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +10 -12
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +14 -23
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +7 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +2 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +15 -3
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +32 -7
- package/dist/libs/crud-pro/sql.txt +120 -120
- package/dist/libs/crud-pro/utils/DatabaseName.js +24 -3
- package/dist/libs/crud-pro/utils/MixinUtils.js +1 -1
- package/dist/libs/crud-pro/utils/ValidateUtils.js +1 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.d.ts +3 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.js +22 -0
- package/dist/libs/global-config/global-config.d.ts +60 -0
- package/dist/libs/global-config/global-config.js +35 -0
- package/dist/libs/utils/base64.d.ts +9 -0
- package/dist/libs/utils/base64.js +42 -0
- package/dist/libs/utils/errorToString.d.ts +2 -0
- package/dist/libs/utils/errorToString.js +57 -0
- package/dist/libs/utils/fatcms-request.js +2 -2
- package/dist/libs/utils/functions.d.ts +2 -1
- package/dist/libs/utils/functions.js +12 -3
- package/dist/libs/utils/parseCreateSql.d.ts +6 -1
- package/dist/libs/utils/parseCreateSql.js +2 -1
- package/dist/middleware/forbidden.middleware.js +6 -22
- package/dist/middleware/global.middleware.js +30 -10
- package/dist/middleware/permission.middleware.js +1 -1
- package/dist/middleware/rediscache.middleware.d.ts +3 -0
- package/dist/middleware/rediscache.middleware.js +77 -0
- package/dist/middleware/redislock.middleware.d.ts +7 -0
- package/dist/middleware/redislock.middleware.js +72 -0
- package/dist/models/AsyncTaskModel.d.ts +74 -0
- package/dist/models/AsyncTaskModel.js +31 -0
- package/dist/models/RedisKeys.d.ts +15 -0
- package/dist/models/RedisKeys.js +18 -0
- package/dist/models/SystemEntities.d.ts +8 -1
- package/dist/models/SystemEntities.js +7 -0
- package/dist/models/SystemTables.d.ts +1 -3
- package/dist/models/SystemTables.js +2 -4
- package/dist/models/bizmodels.d.ts +30 -0
- package/dist/models/bizmodels.js +6 -1
- package/dist/models/userSession.d.ts +1 -0
- package/dist/schedule/anonymousContext.d.ts +14 -0
- package/dist/schedule/anonymousContext.js +59 -0
- package/dist/schedule/index.d.ts +4 -3
- package/dist/schedule/index.js +8 -67
- package/dist/schedule/runSchedule.d.ts +12 -0
- package/dist/schedule/runSchedule.js +68 -0
- package/dist/schedule/scheduleNames.d.ts +13 -0
- package/dist/schedule/scheduleNames.js +17 -0
- package/dist/service/AuthService.js +8 -5
- package/dist/service/EnumInfoService.js +9 -5
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.d.ts +1 -1
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/UserSessionService.d.ts +22 -0
- package/dist/service/UserSessionService.js +74 -2
- package/dist/service/VisitStatService.d.ts +1 -1
- package/dist/service/VisitStatService.js +20 -27
- package/dist/service/WorkbenchService.d.ts +33 -0
- package/dist/service/WorkbenchService.js +70 -12
- package/dist/service/anyapi/AnyApiSandboxService.js +12 -12
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +50 -0
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +287 -0
- package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -0
- package/dist/service/asyncTask/AsyncTaskService.js +34 -0
- package/dist/service/asyncTask/handler/ExcelInfoModel.d.ts +10 -0
- package/dist/service/asyncTask/handler/ExcelInfoModel.js +2 -0
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.d.ts +7 -0
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.js +216 -0
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.d.ts +36 -0
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.js +141 -0
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.d.ts +46 -0
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.js +135 -0
- package/dist/service/base/BaseService.d.ts +12 -0
- package/dist/service/base/BaseService.js +22 -0
- package/dist/service/base/RedisCacheService.d.ts +7 -0
- package/dist/service/base/RedisCacheService.js +7 -0
- package/dist/service/crudstd/CrudStdRelationService.js +63 -36
- package/dist/service/crudstd/CrudStdService.d.ts +21 -5
- package/dist/service/crudstd/CrudStdService.js +137 -21
- package/dist/service/curd/CrudProQuick.d.ts +44 -0
- package/dist/service/curd/CrudProQuick.js +147 -0
- package/dist/service/curd/CurdMixByAccountService.d.ts +4 -4
- package/dist/service/curd/CurdMixByAccountService.js +11 -6
- package/dist/service/curd/CurdMixByDictService.d.ts +4 -4
- package/dist/service/curd/CurdMixByDictService.js +10 -7
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +13 -4
- package/dist/service/curd/CurdMixByLinkToCustomService.js +73 -24
- package/dist/service/curd/CurdMixBySysConfigService.d.ts +3 -3
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.d.ts +3 -3
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +16 -5
- package/dist/service/curd/CurdMixService.js +26 -2
- package/dist/service/curd/CurdMixUtils.d.ts +27 -4
- package/dist/service/curd/CurdMixUtils.js +117 -41
- package/dist/service/curd/CurdProService.d.ts +3 -10
- package/dist/service/curd/CurdProService.js +38 -148
- package/dist/service/curd/fixCfgModel.d.ts +3 -0
- package/dist/service/curd/fixCfgModel.js +104 -0
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/dist/service/proxyapi/ProxyApiService.d.ts +1 -0
- package/dist/service/proxyapi/ProxyApiService.js +43 -9
- package/dist/views/404_app.html +31 -31
- package/dist/views/404_workbench.html +34 -34
- package/package.json +28 -24
- package/tsconfig.json +32 -0
- package/src/config/config.default.ts +0 -172
- package/src/config/seed/aeskey.txt +0 -1
- package/src/config/utils.ts +0 -23
- package/src/configuration.ts +0 -83
- package/src/controller/base/BaseApiController.ts +0 -145
- package/src/controller/gateway/AnyApiGatewayController.ts +0 -33
- package/src/controller/gateway/CrudMtdGatewayController.ts +0 -107
- package/src/controller/gateway/CrudStdGatewayController.ts +0 -101
- package/src/controller/gateway/DocGatewayController.ts +0 -165
- package/src/controller/gateway/FileController.ts +0 -110
- package/src/controller/gateway/ProxyApiGatewayController.ts +0 -47
- package/src/controller/gateway/PublicApiController.ts +0 -145
- package/src/controller/gateway/StaticController.ts +0 -328
- package/src/controller/helpers.controller.ts +0 -161
- package/src/controller/home.controller.ts +0 -71
- package/src/controller/manage/AnyApiMangeApi.ts +0 -66
- package/src/controller/manage/AppLogMangeApi.ts +0 -53
- package/src/controller/manage/AppMangeApi.ts +0 -53
- package/src/controller/manage/AppPageMangeApi.ts +0 -52
- package/src/controller/manage/AppSchemaHistoryApi.ts +0 -49
- package/src/controller/manage/CrudMethodsMangeApi.ts +0 -49
- package/src/controller/manage/CrudStandardDesignApi.ts +0 -353
- package/src/controller/manage/DataDictManageApi.ts +0 -78
- package/src/controller/manage/DeployManageApi.ts +0 -179
- package/src/controller/manage/DocLibManageApi.ts +0 -69
- package/src/controller/manage/DocManageApi.ts +0 -99
- package/src/controller/manage/FileManageApi.ts +0 -45
- package/src/controller/manage/LowCodeTplManageApi.ts +0 -52
- package/src/controller/manage/MenuManageApi.ts +0 -63
- package/src/controller/manage/ProxyApiMangeApi.ts +0 -52
- package/src/controller/manage/SuperAdminManageApi.ts +0 -138
- package/src/controller/manage/SysConfigMangeApi.ts +0 -95
- package/src/controller/manage/SystemInfoManageApi.ts +0 -48
- package/src/controller/manage/UserAccountManageApi.ts +0 -88
- package/src/controller/manage/WorkbenchMangeApi.ts +0 -72
- package/src/controller/myinfo/AuthController.ts +0 -174
- package/src/controller/myinfo/MyInfoController.ts +0 -32
- package/src/controller/render/AppRenderController.ts +0 -76
- package/src/controller/test.controller.ts +0 -37
- package/src/filter/default.filter.ts +0 -13
- package/src/filter/notfound.filter.ts +0 -10
- package/src/index.ts +0 -99
- package/src/interface.ts +0 -31
- package/src/libs/crud-pro/CrudPro.ts +0 -158
- package/src/libs/crud-pro/defaultConfigs.ts +0 -13
- package/src/libs/crud-pro/exceptions.ts +0 -124
- package/src/libs/crud-pro/interfaces.ts +0 -183
- package/src/libs/crud-pro/models/ExecuteContext.ts +0 -111
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +0 -86
- package/src/libs/crud-pro/models/FuncContext.ts +0 -21
- package/src/libs/crud-pro/models/RequestCfgModel.ts +0 -141
- package/src/libs/crud-pro/models/RequestModel.ts +0 -141
- package/src/libs/crud-pro/models/ServiceHub.ts +0 -32
- package/src/libs/crud-pro/models/SqlCfgModel.ts +0 -52
- package/src/libs/crud-pro/models/SqlSegArg.ts +0 -13
- package/src/libs/crud-pro/models/Transaction.ts +0 -74
- package/src/libs/crud-pro/models/TransactionMySQL.ts +0 -79
- package/src/libs/crud-pro/models/TransactionPostgres.ts +0 -91
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +0 -107
- package/src/libs/crud-pro/models/keys.ts +0 -159
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +0 -75
- package/src/libs/crud-pro/services/CrudProExecuteFuncService.ts +0 -128
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +0 -279
- package/src/libs/crud-pro/services/CrudProFieldUpdateService.ts +0 -60
- package/src/libs/crud-pro/services/CrudProFieldValidateService.ts +0 -180
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +0 -373
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +0 -202
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +0 -397
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +0 -98
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +0 -59
- package/src/libs/crud-pro/services/CurdProServiceHub.ts +0 -92
- package/src/libs/crud-pro/sql.txt +0 -120
- package/src/libs/crud-pro/utils/CompareUtils.ts +0 -23
- package/src/libs/crud-pro/utils/DatabaseName.ts +0 -40
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +0 -20
- package/src/libs/crud-pro/utils/MemoryRefreshCache.ts +0 -64
- package/src/libs/crud-pro/utils/MessageParseUtils.ts +0 -33
- package/src/libs/crud-pro/utils/MixinUtils.ts +0 -285
- package/src/libs/crud-pro/utils/ModelUtils.ts +0 -55
- package/src/libs/crud-pro/utils/MultiKeyMap.ts +0 -72
- package/src/libs/crud-pro/utils/SqlFuncUtils.ts +0 -29
- package/src/libs/crud-pro/utils/TypeUtils.ts +0 -188
- package/src/libs/crud-pro/utils/ValidateUtils.ts +0 -167
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +0 -20
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +0 -22
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +0 -22
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +0 -26
- package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +0 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +0 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgType.ts +0 -129
- package/src/libs/utils/common-dto.ts +0 -52
- package/src/libs/utils/crypto-utils.ts +0 -52
- package/src/libs/utils/fatcms-request.ts +0 -115
- package/src/libs/utils/functions.ts +0 -67
- package/src/libs/utils/ordernum-utils.ts +0 -18
- package/src/libs/utils/parseConfig.ts +0 -62
- package/src/libs/utils/parseCreateSql.ts +0 -91
- package/src/libs/utils/render-utils.ts +0 -184
- package/src/middleware/forbidden.middleware.ts +0 -71
- package/src/middleware/global.middleware.ts +0 -278
- package/src/middleware/permission.middleware.ts +0 -81
- package/src/middleware/tx.middleware.ts +0 -30
- package/src/models/SystemEntities.ts +0 -115
- package/src/models/SystemPerm.ts +0 -105
- package/src/models/SystemTables.ts +0 -30
- package/src/models/bizmodels.ts +0 -89
- package/src/models/contextLogger.ts +0 -132
- package/src/models/devops.ts +0 -17
- package/src/models/userSession.ts +0 -216
- package/src/schedule/index.ts +0 -73
- package/src/service/AuthService.ts +0 -270
- package/src/service/EnumInfoService.ts +0 -129
- package/src/service/FileCenterService.ts +0 -394
- package/src/service/SysConfigService.ts +0 -34
- package/src/service/UserAccountService.ts +0 -100
- package/src/service/UserSessionService.ts +0 -81
- package/src/service/VisitStatService.ts +0 -179
- package/src/service/WorkbenchService.ts +0 -160
- package/src/service/anyapi/AnyApiSandboxService.ts +0 -121
- package/src/service/anyapi/AnyApiService.ts +0 -184
- package/src/service/base/ApiBaseService.ts +0 -42
- package/src/service/base/ApiRateLimiter.ts +0 -59
- package/src/service/base/BaseService.ts +0 -74
- package/src/service/base/RedisCacheService.ts +0 -38
- package/src/service/crudstd/CrudStdActionService.ts +0 -27
- package/src/service/crudstd/CrudStdConstant.ts +0 -62
- package/src/service/crudstd/CrudStdRelationService.ts +0 -78
- package/src/service/crudstd/CrudStdService.ts +0 -188
- package/src/service/curd/CurdMixByAccountService.ts +0 -83
- package/src/service/curd/CurdMixByDictService.ts +0 -113
- package/src/service/curd/CurdMixByLinkToCustomService.ts +0 -167
- package/src/service/curd/CurdMixBySysConfigService.ts +0 -78
- package/src/service/curd/CurdMixByWorkbenchService.ts +0 -68
- package/src/service/curd/CurdMixService.ts +0 -65
- package/src/service/curd/CurdMixUtils.ts +0 -248
- package/src/service/curd/CurdProService.ts +0 -379
- package/src/service/proxyapi/ProxyApiLoadService.ts +0 -165
- package/src/service/proxyapi/ProxyApiService.ts +0 -262
- package/src/service/proxyapi/ProxyApiUtils.ts +0 -32
- package/src/service/proxyapi/RouteHandler.ts +0 -8
- package/src/service/proxyapi/RouteTrie.ts +0 -74
- package/src/service/proxyapi/WeightedRandom.ts +0 -37
- package/src/service/proxyapi/WeightedRoundRobin.ts +0 -44
- package/src/views/404_app.html +0 -31
- package/src/views/404_workbench.html +0 -34
- package/src/views/static/favicon.ico +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportExcelByInnerHttpHandler = void 0;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
const axios_1 = require("axios");
|
|
6
|
+
const AsyncTaskModel_1 = require("../../../models/AsyncTaskModel");
|
|
7
|
+
const schedule_1 = require("../../../schedule");
|
|
8
|
+
const functions_1 = require("../../../libs/utils/functions");
|
|
9
|
+
const global_config_1 = require("../../../libs/global-config/global-config");
|
|
10
|
+
function pickData(a, key) {
|
|
11
|
+
if (a && typeof a.getResModel === 'function') {
|
|
12
|
+
const s = a.getResModel();
|
|
13
|
+
return s[key];
|
|
14
|
+
}
|
|
15
|
+
if (!a) {
|
|
16
|
+
throw 'ExportExcelByInnerHttpHandler返回数据不存在';
|
|
17
|
+
}
|
|
18
|
+
return _.get(a, `data.${key}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 多实例,每个任务一个实例。
|
|
22
|
+
* 导出Excel。请求任务级别的。
|
|
23
|
+
* 使用内部HTTP接口导出
|
|
24
|
+
*/
|
|
25
|
+
class ExportExcelByInnerHttpHandler {
|
|
26
|
+
constructor(asyncTaskContext, inputParams, ctx) {
|
|
27
|
+
this.ctx = ctx;
|
|
28
|
+
this.inputParams = inputParams;
|
|
29
|
+
this.asyncTaskContext = asyncTaskContext;
|
|
30
|
+
this.appCode = this.inputParams.appCode;
|
|
31
|
+
}
|
|
32
|
+
async getPageSize() {
|
|
33
|
+
const maxPageSizeOfExportExcel = global_config_1.GLOBAL_STATIC_CONFIG.getConfig().maxPageSizeOfExportExcel;
|
|
34
|
+
if (typeof this.inputParams.pageSize === 'number') {
|
|
35
|
+
return Math.min(this.inputParams.pageSize, maxPageSizeOfExportExcel);
|
|
36
|
+
}
|
|
37
|
+
return 1000;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 获取Excel表的表头
|
|
41
|
+
* @returns 表头信息
|
|
42
|
+
*/
|
|
43
|
+
async getExcelHeader() {
|
|
44
|
+
const columns = this.inputParams.columns;
|
|
45
|
+
if (!columns) {
|
|
46
|
+
throw new Error('导出Excel的表头信息不存在');
|
|
47
|
+
}
|
|
48
|
+
if (!Array.isArray(columns) || columns.length === 0) {
|
|
49
|
+
throw new Error('导出Excel的表头信息不是数组');
|
|
50
|
+
}
|
|
51
|
+
return columns
|
|
52
|
+
.map(cc => {
|
|
53
|
+
let { title, dataIndex } = cc;
|
|
54
|
+
if (!dataIndex) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (!title) {
|
|
58
|
+
title = '字段_' + dataIndex;
|
|
59
|
+
}
|
|
60
|
+
return { title, dataIndex };
|
|
61
|
+
})
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
}
|
|
64
|
+
async sendRequest(params) {
|
|
65
|
+
const port = schedule_1.ANONYMOUS_CONTEXT.getApp().getConfig().koa.port;
|
|
66
|
+
let queryApi = this.inputParams.innerHttpUrl; // 以斜杠开头
|
|
67
|
+
if (!queryApi.startsWith('/')) {
|
|
68
|
+
queryApi = '/' + queryApi;
|
|
69
|
+
}
|
|
70
|
+
const asyncTaskId = this.asyncTaskContext.task.id;
|
|
71
|
+
const createdUserSession = (0, functions_1.parseJsonObject)(this.asyncTaskContext.task.created_user_session);
|
|
72
|
+
const workbenchCode = createdUserSession.workbenchCode;
|
|
73
|
+
params[AsyncTaskModel_1.HEADER_KEY_RUN_BY_ASYNC_TASK_ID] = asyncTaskId;
|
|
74
|
+
params[AsyncTaskModel_1.HEADER_KEY_RUN_BY_ASYNC_TASK_WORKBENCH_CODE] = workbenchCode;
|
|
75
|
+
const headers = this.inputParams.headers || {};
|
|
76
|
+
headers[AsyncTaskModel_1.HEADER_KEY_RUN_BY_ASYNC_TASK_ID] = asyncTaskId;
|
|
77
|
+
headers[AsyncTaskModel_1.HEADER_KEY_RUN_BY_ASYNC_TASK_WORKBENCH_CODE] = workbenchCode;
|
|
78
|
+
const response = await (0, axios_1.default)({
|
|
79
|
+
method: 'POST',
|
|
80
|
+
url: `http://127.0.0.1:${port}${queryApi}`,
|
|
81
|
+
data: params,
|
|
82
|
+
headers: headers,
|
|
83
|
+
responseType: 'json',
|
|
84
|
+
validateStatus: () => true,
|
|
85
|
+
});
|
|
86
|
+
if (response.status !== 200) {
|
|
87
|
+
throw new Error('导出Excel请求错误失败,状态码:' + response.status);
|
|
88
|
+
}
|
|
89
|
+
return response.data;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 获取要导出的数量总数
|
|
93
|
+
* @returns 数据总量
|
|
94
|
+
*/
|
|
95
|
+
async getTotalCount() {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
const selectedRowKeys = ((_a = this.inputParams) === null || _a === void 0 ? void 0 : _a.selectedRowKeys) || [];
|
|
98
|
+
if (Array.isArray(selectedRowKeys) && selectedRowKeys.length > 0) {
|
|
99
|
+
return selectedRowKeys.length;
|
|
100
|
+
}
|
|
101
|
+
const lastQueryParams = (_b = this.inputParams) === null || _b === void 0 ? void 0 : _b.lastQueryParams;
|
|
102
|
+
const res = await this.sendRequest({
|
|
103
|
+
condition: (lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.condition) || {},
|
|
104
|
+
orderBy: lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.orderBy,
|
|
105
|
+
pageSize: 1,
|
|
106
|
+
pageNo: 1,
|
|
107
|
+
});
|
|
108
|
+
return pickData(res, 'total_count');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 获取要导出Excel的数据的内容
|
|
112
|
+
* @param pageNo 页号,从1开始
|
|
113
|
+
* @param pageSize 每页数量
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
async getExcelDataList(pageNo, pageSize) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
const selectedRowKeys = ((_a = this.inputParams) === null || _a === void 0 ? void 0 : _a.selectedRowKeys) || [];
|
|
119
|
+
const lastQueryParams = (_b = this.inputParams) === null || _b === void 0 ? void 0 : _b.lastQueryParams;
|
|
120
|
+
const primaryKey = this.inputParams.primaryKey || 'id';
|
|
121
|
+
const params = {
|
|
122
|
+
condition: (lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.condition) || {},
|
|
123
|
+
pageSize: pageSize,
|
|
124
|
+
pageNo: pageNo,
|
|
125
|
+
orderBy: lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.orderBy,
|
|
126
|
+
};
|
|
127
|
+
if (Array.isArray(selectedRowKeys) && selectedRowKeys.length > 0) {
|
|
128
|
+
params.condition[primaryKey] = {
|
|
129
|
+
$in: selectedRowKeys,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const res = await this.sendRequest({
|
|
133
|
+
condition: (lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.condition) || {},
|
|
134
|
+
orderBy: lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.orderBy,
|
|
135
|
+
pageSize: pageSize,
|
|
136
|
+
pageNo: pageNo,
|
|
137
|
+
});
|
|
138
|
+
return pickData(res, 'rows');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.ExportExcelByInnerHttpHandler = ExportExcelByInnerHttpHandler;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { IMidwayKoaContext } from '@midwayjs/koa';
|
|
2
|
+
import { IExcelAsyncTaskHandler, IExcelHeaderInfo } from './ExcelInfoModel';
|
|
3
|
+
import { SysAsyncTaskContext } from '../../../models/AsyncTaskModel';
|
|
4
|
+
import { ICrudStdAppInfo, IStdCrudExportInputParams } from '../../../models/bizmodels';
|
|
5
|
+
/**
|
|
6
|
+
* 多实例,每个任务一个实例。
|
|
7
|
+
* 导出Excel。请求任务级别的。
|
|
8
|
+
* 使用标准CtdCrudApp导出
|
|
9
|
+
*/
|
|
10
|
+
declare class ExportExcelByStdCrudHandler implements IExcelAsyncTaskHandler {
|
|
11
|
+
protected asyncTaskContext: SysAsyncTaskContext;
|
|
12
|
+
protected ctx: IMidwayKoaContext;
|
|
13
|
+
protected inputParams: IStdCrudExportInputParams;
|
|
14
|
+
protected appCode: string;
|
|
15
|
+
protected crudStdAppInfo: ICrudStdAppInfo;
|
|
16
|
+
constructor(asyncTaskContext: SysAsyncTaskContext, inputParams: IStdCrudExportInputParams, ctx: IMidwayKoaContext);
|
|
17
|
+
getPageSize(): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* 获取应用信息
|
|
20
|
+
* @returns CrudStdService服务实例
|
|
21
|
+
*/
|
|
22
|
+
private getCrudStdService;
|
|
23
|
+
/**
|
|
24
|
+
* 获取应用的配置信息
|
|
25
|
+
* @returns 应用的配置信息
|
|
26
|
+
*/
|
|
27
|
+
private getCrudStdAppInfo;
|
|
28
|
+
/**
|
|
29
|
+
* 获取Excel表的表头
|
|
30
|
+
* @returns 表头信息
|
|
31
|
+
*/
|
|
32
|
+
getExcelHeader(): Promise<IExcelHeaderInfo[]>;
|
|
33
|
+
/**
|
|
34
|
+
* 获取要导出的数量总数
|
|
35
|
+
* @returns 数据总量
|
|
36
|
+
*/
|
|
37
|
+
getTotalCount(): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* 获取要导出Excel的数据的内容
|
|
40
|
+
* @param pageNo 页号,从1开始
|
|
41
|
+
* @param pageSize 每页数量
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
getExcelDataList(pageNo: number, pageSize: number): Promise<any[]>;
|
|
45
|
+
}
|
|
46
|
+
export { ExportExcelByStdCrudHandler };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportExcelByStdCrudHandler = void 0;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
const CrudStdService_1 = require("../../../service/crudstd/CrudStdService");
|
|
6
|
+
const keys_1 = require("../../../libs/crud-pro/models/keys");
|
|
7
|
+
const global_config_1 = require("../../../libs/global-config/global-config");
|
|
8
|
+
function pickData(a, key) {
|
|
9
|
+
if (a && typeof a.getResModel === 'function') {
|
|
10
|
+
const s = a.getResModel();
|
|
11
|
+
return s[key];
|
|
12
|
+
}
|
|
13
|
+
if (!a) {
|
|
14
|
+
throw 'executeStdQuery返回数据不存在';
|
|
15
|
+
}
|
|
16
|
+
return _.get(a, `data.${key}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 多实例,每个任务一个实例。
|
|
20
|
+
* 导出Excel。请求任务级别的。
|
|
21
|
+
* 使用标准CtdCrudApp导出
|
|
22
|
+
*/
|
|
23
|
+
class ExportExcelByStdCrudHandler {
|
|
24
|
+
constructor(asyncTaskContext, inputParams, ctx) {
|
|
25
|
+
this.ctx = ctx;
|
|
26
|
+
this.inputParams = inputParams;
|
|
27
|
+
this.asyncTaskContext = asyncTaskContext;
|
|
28
|
+
this.appCode = this.inputParams.appCode;
|
|
29
|
+
}
|
|
30
|
+
async getPageSize() {
|
|
31
|
+
const maxPageSizeOfExportExcel = global_config_1.GLOBAL_STATIC_CONFIG.getConfig().maxPageSizeOfExportExcel;
|
|
32
|
+
if (typeof this.inputParams.pageSize === 'number') {
|
|
33
|
+
return Math.min(this.inputParams.pageSize, maxPageSizeOfExportExcel);
|
|
34
|
+
}
|
|
35
|
+
return 1000;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 获取应用信息
|
|
39
|
+
* @returns CrudStdService服务实例
|
|
40
|
+
*/
|
|
41
|
+
async getCrudStdService() {
|
|
42
|
+
return await this.ctx.requestContext.getAsync(CrudStdService_1.CrudStdService);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 获取应用的配置信息
|
|
46
|
+
* @returns 应用的配置信息
|
|
47
|
+
*/
|
|
48
|
+
async getCrudStdAppInfo() {
|
|
49
|
+
if (!this.crudStdAppInfo) {
|
|
50
|
+
const appCode = this.inputParams.appCode;
|
|
51
|
+
if (!appCode) {
|
|
52
|
+
throw new Error('inputParams appCode is required');
|
|
53
|
+
}
|
|
54
|
+
const service = await this.getCrudStdService();
|
|
55
|
+
this.crudStdAppInfo = await service.getParsedCrudStdAppInfo(appCode);
|
|
56
|
+
}
|
|
57
|
+
return this.crudStdAppInfo;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 获取Excel表的表头
|
|
61
|
+
* @returns 表头信息
|
|
62
|
+
*/
|
|
63
|
+
async getExcelHeader() {
|
|
64
|
+
const crudStdAppInfo = await this.getCrudStdAppInfo();
|
|
65
|
+
const stdCrudCfgObj = crudStdAppInfo.stdCrudCfgObj;
|
|
66
|
+
const tableColumns = stdCrudCfgObj.tableColumns || [];
|
|
67
|
+
return tableColumns.map(cc => {
|
|
68
|
+
return cc;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 获取要导出的数量总数
|
|
73
|
+
* @returns 数据总量
|
|
74
|
+
*/
|
|
75
|
+
async getTotalCount() {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const selectedRowKeys = ((_a = this.inputParams) === null || _a === void 0 ? void 0 : _a.selectedRowKeys) || [];
|
|
78
|
+
if (Array.isArray(selectedRowKeys) && selectedRowKeys.length > 0) {
|
|
79
|
+
return selectedRowKeys.length;
|
|
80
|
+
}
|
|
81
|
+
const lastQueryParams = (_b = this.inputParams) === null || _b === void 0 ? void 0 : _b.lastQueryParams;
|
|
82
|
+
const filterValue = _.get(lastQueryParams, 'filterValue');
|
|
83
|
+
const crudStdService = await this.getCrudStdService();
|
|
84
|
+
const appCode = this.appCode;
|
|
85
|
+
const params = {
|
|
86
|
+
condition: (lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.condition) || {},
|
|
87
|
+
filterValue,
|
|
88
|
+
pageSize: 1,
|
|
89
|
+
pageNo: 1,
|
|
90
|
+
};
|
|
91
|
+
if (!this.ctx.innerHeaders) {
|
|
92
|
+
this.ctx.innerHeaders = {};
|
|
93
|
+
}
|
|
94
|
+
Object.assign(this.ctx.innerHeaders, this.inputParams.headers || {});
|
|
95
|
+
const stdAction = {
|
|
96
|
+
appCode: appCode,
|
|
97
|
+
settingKey: CrudStdService_1.SPECIAL_SETTING_KEY.QUERY_LIST,
|
|
98
|
+
};
|
|
99
|
+
const a = await crudStdService.executeStdQuery(stdAction, params, keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_PAGE);
|
|
100
|
+
return pickData(a, 'total_count');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 获取要导出Excel的数据的内容
|
|
104
|
+
* @param pageNo 页号,从1开始
|
|
105
|
+
* @param pageSize 每页数量
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
async getExcelDataList(pageNo, pageSize) {
|
|
109
|
+
const selectedRowKeys = this.inputParams.selectedRowKeys || [];
|
|
110
|
+
const primaryKey = this.inputParams.primaryKey || 'id';
|
|
111
|
+
const lastQueryParams = this.inputParams.lastQueryParams;
|
|
112
|
+
const filterValue = _.get(lastQueryParams, 'filterValue');
|
|
113
|
+
const crudStdService = await this.getCrudStdService();
|
|
114
|
+
const appCode = this.appCode;
|
|
115
|
+
const params = {
|
|
116
|
+
condition: (lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.condition) || {},
|
|
117
|
+
filterValue: filterValue,
|
|
118
|
+
pageSize: pageSize,
|
|
119
|
+
pageNo: pageNo,
|
|
120
|
+
orderBy: lastQueryParams === null || lastQueryParams === void 0 ? void 0 : lastQueryParams.orderBy,
|
|
121
|
+
};
|
|
122
|
+
if (Array.isArray(selectedRowKeys) && selectedRowKeys.length > 0) {
|
|
123
|
+
params.condition[primaryKey] = {
|
|
124
|
+
$in: selectedRowKeys,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const stdAction = {
|
|
128
|
+
appCode: appCode,
|
|
129
|
+
settingKey: CrudStdService_1.SPECIAL_SETTING_KEY.QUERY_LIST,
|
|
130
|
+
};
|
|
131
|
+
const a = await crudStdService.executeStdQuery(stdAction, params, keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_PAGE);
|
|
132
|
+
return pickData(a, 'rows');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.ExportExcelByStdCrudHandler = ExportExcelByStdCrudHandler;
|
|
@@ -8,6 +8,18 @@ export declare class BaseService {
|
|
|
8
8
|
protected app: koa.Application;
|
|
9
9
|
protected redisService: RedisService;
|
|
10
10
|
protected ossServiceFactory: OSSServiceFactory;
|
|
11
|
+
/**
|
|
12
|
+
* 请求级别的内存缓存
|
|
13
|
+
* @param key
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
protected getFromCtxCache(key: string): any;
|
|
17
|
+
/**
|
|
18
|
+
* 请求级别的内存缓存
|
|
19
|
+
* @param key
|
|
20
|
+
* @param obj
|
|
21
|
+
*/
|
|
22
|
+
protected setToCtxCache(key: string, obj: any): void;
|
|
11
23
|
/**
|
|
12
24
|
* 用户自己上传的文件,使用私有的bucket。
|
|
13
25
|
* @protected
|
|
@@ -17,6 +17,28 @@ const koa = require("@midwayjs/koa");
|
|
|
17
17
|
const contextLogger_1 = require("../../models/contextLogger");
|
|
18
18
|
const fatcms_request_1 = require("../../libs/utils/fatcms-request");
|
|
19
19
|
let BaseService = class BaseService {
|
|
20
|
+
/**
|
|
21
|
+
* 请求级别的内存缓存
|
|
22
|
+
* @param key
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
getFromCtxCache(key) {
|
|
26
|
+
if (!this.ctx.ctxCacheMap) {
|
|
27
|
+
this.ctx.ctxCacheMap = {};
|
|
28
|
+
}
|
|
29
|
+
return this.ctx.ctxCacheMap[key];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 请求级别的内存缓存
|
|
33
|
+
* @param key
|
|
34
|
+
* @param obj
|
|
35
|
+
*/
|
|
36
|
+
setToCtxCache(key, obj) {
|
|
37
|
+
if (!this.ctx.ctxCacheMap) {
|
|
38
|
+
this.ctx.ctxCacheMap = {};
|
|
39
|
+
}
|
|
40
|
+
this.ctx.ctxCacheMap[key] = obj;
|
|
41
|
+
}
|
|
20
42
|
/**
|
|
21
43
|
* 用户自己上传的文件,使用私有的bucket。
|
|
22
44
|
* @protected
|
|
@@ -8,6 +8,13 @@ export declare class RedisCacheService {
|
|
|
8
8
|
protected redisService: RedisService;
|
|
9
9
|
protected ossServiceFactory: OSSServiceFactory;
|
|
10
10
|
getJsonObject(key: string): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* 设置缓存对象
|
|
13
|
+
* @param key
|
|
14
|
+
* @param obj
|
|
15
|
+
* @param expireSecond 过期时间,单位秒
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
11
18
|
setJsonObject(key: string, obj: any, expireSecond: number): Promise<any>;
|
|
12
19
|
removeItem(key: string): Promise<any>;
|
|
13
20
|
}
|
|
@@ -20,6 +20,13 @@ let RedisCacheService = class RedisCacheService {
|
|
|
20
20
|
const str = await this.redisService.get(key);
|
|
21
21
|
return (0, functions_1.parseJsonObject)(str);
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* 设置缓存对象
|
|
25
|
+
* @param key
|
|
26
|
+
* @param obj
|
|
27
|
+
* @param expireSecond 过期时间,单位秒
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
23
30
|
async setJsonObject(key, obj, expireSecond) {
|
|
24
31
|
const str = JSON.stringify(obj);
|
|
25
32
|
return this.redisService.set(key, str, 'EX', expireSecond);
|
|
@@ -10,62 +10,89 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CrudStdRelationService = void 0;
|
|
13
|
+
/* eslint-disable prettier/prettier */
|
|
13
14
|
const core_1 = require("@midwayjs/core");
|
|
14
15
|
const _ = require("lodash");
|
|
15
16
|
const CurdMixService_1 = require("../curd/CurdMixService");
|
|
16
17
|
const BaseService_1 = require("../base/BaseService");
|
|
17
18
|
const CrudStdConstant_1 = require("./CrudStdConstant");
|
|
18
19
|
const CurdMixUtils_1 = require("../curd/CurdMixUtils");
|
|
20
|
+
class ColumnsRelationMaker {
|
|
21
|
+
constructor(cfgModel, appInfo) {
|
|
22
|
+
cfgModel.columnsRelation = [];
|
|
23
|
+
this.cfgModel = cfgModel;
|
|
24
|
+
this.appInfo = appInfo;
|
|
25
|
+
}
|
|
26
|
+
addColumnRelationByAccount(dataIndex) {
|
|
27
|
+
const columnsRelation = this.cfgModel.columnsRelation;
|
|
28
|
+
columnsRelation.push({
|
|
29
|
+
relatedType: CurdMixUtils_1.RelatedType.accountBasic,
|
|
30
|
+
sourceColumn: dataIndex,
|
|
31
|
+
targetColumns: [], // 使用默认
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
addColumnRelationByDictEnumStatus(dataIndex) {
|
|
35
|
+
var _a;
|
|
36
|
+
const appInfo = this.appInfo;
|
|
37
|
+
const tableFields = ((_a = appInfo === null || appInfo === void 0 ? void 0 : appInfo.stdCrudCfgObj) === null || _a === void 0 ? void 0 : _a.tableFields) || [];
|
|
38
|
+
const columnsRelation = this.cfgModel.columnsRelation;
|
|
39
|
+
const fieldCfg = tableFields.find(f => {
|
|
40
|
+
return f.fieldIndex === dataIndex;
|
|
41
|
+
});
|
|
42
|
+
if (fieldCfg && fieldCfg.linkToType === CrudStdConstant_1.fieldLinkToTypes.linkToCustom) {
|
|
43
|
+
columnsRelation.push({
|
|
44
|
+
relatedType: CurdMixUtils_1.RelatedType.linkToCustom,
|
|
45
|
+
relatedCode: fieldCfg.linkToCustom,
|
|
46
|
+
sourceColumn: dataIndex,
|
|
47
|
+
targetColumns: [], // 使用默认
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (fieldCfg && fieldCfg.linkToType === CrudStdConstant_1.fieldLinkToTypes.linkToSysCfgEnum) {
|
|
51
|
+
columnsRelation.push({
|
|
52
|
+
relatedType: CurdMixUtils_1.RelatedType.sysCfgEnum,
|
|
53
|
+
relatedCode: fieldCfg.linkToSysCfgEnumCode,
|
|
54
|
+
sourceColumn: dataIndex,
|
|
55
|
+
targetColumns: [], // 使用默认
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (fieldCfg && fieldCfg.linkToType === CrudStdConstant_1.fieldLinkToTypes.linkToDict) {
|
|
59
|
+
columnsRelation.push({
|
|
60
|
+
relatedType: CurdMixUtils_1.RelatedType.dict,
|
|
61
|
+
relatedCode: fieldCfg.linkToDictCode,
|
|
62
|
+
sourceColumn: dataIndex,
|
|
63
|
+
targetColumns: [], // 使用默认
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
19
68
|
let CrudStdRelationService = class CrudStdRelationService extends BaseService_1.BaseService {
|
|
20
69
|
async addCfgModelColumnsRelation(cfgModel, appInfo) {
|
|
21
|
-
var _a
|
|
70
|
+
var _a;
|
|
22
71
|
const tableColumns = (_a = appInfo === null || appInfo === void 0 ? void 0 : appInfo.stdCrudCfgObj) === null || _a === void 0 ? void 0 : _a.tableColumns;
|
|
23
|
-
|
|
24
|
-
if (!Array.isArray(tableColumns)) {
|
|
72
|
+
if (!Array.isArray(tableColumns) || tableColumns.length === 0) {
|
|
25
73
|
return;
|
|
26
74
|
}
|
|
27
|
-
const
|
|
28
|
-
cfgModel.columnsRelation = columnsRelation;
|
|
75
|
+
const maker = new ColumnsRelationMaker(cfgModel, appInfo);
|
|
29
76
|
for (let i = 0; i < tableColumns.length; i++) {
|
|
30
77
|
const tableColumn = tableColumns[i];
|
|
31
78
|
const dataIndex = _.get(tableColumn, 'dataIndex');
|
|
32
79
|
const componentName = _.get(tableColumn, 'component.componentName');
|
|
33
80
|
// 关联用户信息
|
|
34
81
|
if (componentName === CrudStdConstant_1.tableColumnRenders.RenderUserInfo) {
|
|
35
|
-
|
|
36
|
-
relatedType: CurdMixUtils_1.RelatedType.accountBasic,
|
|
37
|
-
sourceColumn: dataIndex,
|
|
38
|
-
targetColumns: [], // 使用默认
|
|
39
|
-
});
|
|
82
|
+
maker.addColumnRelationByAccount(dataIndex);
|
|
40
83
|
}
|
|
41
84
|
// 关联枚举文案/状态标签颜色
|
|
42
85
|
if (componentName === CrudStdConstant_1.tableColumnRenders.RenderDictEnumText || componentName === CrudStdConstant_1.tableColumnRenders.RenderDictEnumStatus) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (fieldCfg && fieldCfg.linkToType === CrudStdConstant_1.fieldLinkToTypes.linkToSysCfgEnum) {
|
|
55
|
-
columnsRelation.push({
|
|
56
|
-
relatedType: CurdMixUtils_1.RelatedType.sysCfgEnum,
|
|
57
|
-
relatedCode: fieldCfg.linkToSysCfgEnumCode,
|
|
58
|
-
sourceColumn: dataIndex,
|
|
59
|
-
targetColumns: [], // 使用默认
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (fieldCfg && fieldCfg.linkToType === CrudStdConstant_1.fieldLinkToTypes.linkToDict) {
|
|
63
|
-
columnsRelation.push({
|
|
64
|
-
relatedType: CurdMixUtils_1.RelatedType.dict,
|
|
65
|
-
relatedCode: fieldCfg.linkToDictCode,
|
|
66
|
-
sourceColumn: dataIndex,
|
|
67
|
-
targetColumns: [], // 使用默认
|
|
68
|
-
});
|
|
86
|
+
maker.addColumnRelationByDictEnumStatus(dataIndex);
|
|
87
|
+
}
|
|
88
|
+
// 子属性的配置
|
|
89
|
+
const balloonTipFields = _.get(tableColumn, 'component.props.balloonTipFields');
|
|
90
|
+
if (Array.isArray(balloonTipFields) && balloonTipFields.length > 0) {
|
|
91
|
+
for (let j = 0; j < balloonTipFields.length; j++) {
|
|
92
|
+
const { component, name } = balloonTipFields[j] || {};
|
|
93
|
+
if (component === CrudStdConstant_1.tableColumnRenders.RenderUserInfo) {
|
|
94
|
+
maker.addColumnRelationByAccount(name);
|
|
95
|
+
}
|
|
69
96
|
}
|
|
70
97
|
}
|
|
71
98
|
}
|
|
@@ -11,6 +11,14 @@ export declare const SPECIAL_SETTING_KEY: {
|
|
|
11
11
|
QUERY_LIST: string;
|
|
12
12
|
QUERY_ONE: string;
|
|
13
13
|
};
|
|
14
|
+
export interface ICrudStdActionParams {
|
|
15
|
+
appCode: string;
|
|
16
|
+
settingKey?: string;
|
|
17
|
+
buttonSettingKey?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IRequestModelCrudProExt extends IRequestModel {
|
|
20
|
+
filterValue: string | number;
|
|
21
|
+
}
|
|
14
22
|
export declare class CrudStdService extends ApiBaseService {
|
|
15
23
|
protected ctx: Context;
|
|
16
24
|
protected curdMixService: CurdMixService;
|
|
@@ -19,7 +27,7 @@ export declare class CrudStdService extends ApiBaseService {
|
|
|
19
27
|
/**
|
|
20
28
|
* 执行普通CRUD
|
|
21
29
|
*/
|
|
22
|
-
executeStdQuery(
|
|
30
|
+
executeStdQuery(stdAction: ICrudStdActionParams, params: IRequestModelCrudProExt, sqlSimpleName: KeysOfSimpleSQL): Promise<ExecuteContext>;
|
|
23
31
|
/**
|
|
24
32
|
* 获取appInfo 并且拿到当前settingKey相关的信息
|
|
25
33
|
* @param appCode
|
|
@@ -29,22 +37,30 @@ export declare class CrudStdService extends ApiBaseService {
|
|
|
29
37
|
private getParsedCrudStdAppForSettingKey;
|
|
30
38
|
/**
|
|
31
39
|
* 执行动作
|
|
32
|
-
* @param
|
|
33
|
-
* @param settingKey
|
|
40
|
+
* @param stdAction
|
|
34
41
|
* @param params
|
|
35
42
|
*/
|
|
36
|
-
executeStdActionByReq(
|
|
43
|
+
executeStdActionByReq(stdAction: ICrudStdActionParams, params: IRequestModelCrudProExt): Promise<ExecuteContext>;
|
|
37
44
|
/**
|
|
38
45
|
* 查询APP信息
|
|
39
46
|
* @param appCode
|
|
40
47
|
* @private
|
|
41
48
|
*/
|
|
42
49
|
private getCrudStdAppInfo;
|
|
50
|
+
/**
|
|
51
|
+
* 查询APP信息
|
|
52
|
+
* @param appCode
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
getParsedCrudStdAppInfo(appCode: string): Promise<ICrudStdAppInfo>;
|
|
43
56
|
/**
|
|
44
57
|
* 查询APP信息
|
|
45
58
|
* @param appCode
|
|
46
59
|
* @private
|
|
47
60
|
*/
|
|
48
|
-
|
|
61
|
+
private getParsedCrudStdAppInfoPrivate;
|
|
49
62
|
private hasOperationPerm;
|
|
63
|
+
private fixCfgModelByFilterValue;
|
|
64
|
+
private fixSubmitDataByKeepSubmitData;
|
|
65
|
+
private fixDataFieldTypeBySqlTableField;
|
|
50
66
|
}
|