diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index a950262a0674312dfca06db1c467e3e1147b6685..9c3faa01009db78b732282f49a2d4b6876a11dba 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -16,6 +16,7 @@ - 更新部件控制器获取是否静默参数的值写法 - 添加导出文件服务 - 树部件不处于导航栏下但是树节点本身有配置导航视图时,执行打开导航视图行为 +- 多选打印还原为评价模式 ### Added diff --git a/packages/runtime/src/ui-action/provider/front-ui-action-provider.ts b/packages/runtime/src/ui-action/provider/front-ui-action-provider.ts index b74c2be4fd428ba9b57a95e2421d909e9b784d13..fb4f307fcd44254030fb02075af7b8a00963ab73 100644 --- a/packages/runtime/src/ui-action/provider/front-ui-action-provider.ts +++ b/packages/runtime/src/ui-action/provider/front-ui-action-provider.ts @@ -176,76 +176,64 @@ export class FrontUIActionProvider extends UIActionProviderBase { action: IAppDEUIAction, args: IUILogicParams, ): Promise { - const execute = async (data: IData[]): Promise => { - // 处理参数 - const { resultContext, resultParams } = await this.handleParams( - action, - args.context, - data, - args.params, - ); - const appDataEntity = await ibiz.hub.getAppDataEntity( - action.appDataEntityId!, - action.appId, - ); - const appDEPrint = appDataEntity.appDEPrints?.find(print => { - return print.id === action.appDEPrintId; + // 处理参数 + const { resultContext, resultParams } = await this.handleParams( + action, + args.context, + args.data, + args.params, + ); + const appDataEntity = await ibiz.hub.getAppDataEntity( + action.appDataEntityId!, + action.appId, + ); + const appDEPrint = appDataEntity.appDEPrints?.find(print => { + return print.id === action.appDEPrintId; + }); + if (appDEPrint) { + let requestUrl: string = ''; + if ( + resultContext && + resultContext[appDataEntity.codeName!.toLowerCase()] + ) { + // TODO 临时写死printdata, 非标准,后续优化 + const resPath = calcResPath(resultContext, appDataEntity); + requestUrl += `${resPath}/${appDataEntity.deapicodeName2}/printdata/${encodeURIComponent( + resultContext[appDataEntity.codeName!.toLowerCase()], + )}`; + } else { + throw new RuntimeError(ibiz.i18n.t('runtime.uiAction.dataPrimaryKey')); + } + const app = await ibiz.hub.getAppAsync(action.appId); + const res = await app.net.request(requestUrl, { + method: 'get', + responseType: 'blob', + params: { + srfprinttag: appDEPrint.codeName, + ...resultParams, + }, }); - if (appDEPrint) { - let requestUrl: string = ''; - if ( - resultContext && - resultContext[appDataEntity.codeName!.toLowerCase()] - ) { - // TODO 临时写死printdata, 非标准,后续优化 - const resPath = calcResPath(resultContext, appDataEntity); - requestUrl += `${resPath}/${appDataEntity.deapicodeName2}/printdata/${ - resultContext[appDataEntity.codeName!.toLowerCase()] - }`; + if (res.ok) { + // 存在srfcontenttype参数需响应文件 + if (resultParams && resultParams.srfcontenttype) { + const fileName = ibiz.util.file.getFileName(res); + const href = URL.createObjectURL(res.data as Blob); + const a = document.createElement('a'); + a.href = href; + a.download = fileName; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(href); } else { - throw new RuntimeError( - ibiz.i18n.t('runtime.uiAction.dataPrimaryKey'), - ); - } - const app = await ibiz.hub.getAppAsync(action.appId); - const res = await app.net.request(requestUrl, { - method: 'get', - responseType: 'blob', - params: { - srfprinttag: appDEPrint.codeName, - ...resultParams, - }, - }); - if (res.ok) { - // 存在srfcontenttype参数需响应文件 - if (resultParams && resultParams.srfcontenttype) { - const fileName = ibiz.util.file.getFileName(res); - const href = URL.createObjectURL(res.data as Blob); - const a = document.createElement('a'); - a.href = href; - a.download = fileName; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - URL.revokeObjectURL(href); - } else { - const link = window.URL.createObjectURL(res.data as Blob); - window.open(link, '_blank'); - } - } else { - throw new RuntimeError(ibiz.i18n.t('runtime.uiAction.printFailure')); + const link = window.URL.createObjectURL(res.data as Blob); + window.open(link, '_blank'); } } else { - throw new RuntimeError(ibiz.i18n.t('runtime.uiAction.physicalPrint')); + throw new RuntimeError(ibiz.i18n.t('runtime.uiAction.printFailure')); } - }; - const isMultiData = ['MULTIKEY', 'MULTIDATA'].includes( - action.actionTarget!, - ); - if (isMultiData) { - await Promise.all(args.data.map(item => execute([item]))); } else { - await execute(args.data); + throw new RuntimeError(ibiz.i18n.t('runtime.uiAction.physicalPrint')); } }