<#assign import_block> <#if ctrl.getPSSysMapItems?? && ctrl.getPSSysMapItems()??> <#list ctrl.getPSSysMapItems() as mapitem> <#if mapitem.getPSAppDataEntity()??> <#assign _appde = mapitem.getPSAppDataEntity() /> <#if _appde.getId() != appde.getId()> <#if !P.exists("importService", _appde.getId(), "")> import ${srfclassname('${_appde.getCodeName()}')}Service from '@/service/${srffilepath2(_appde.getCodeName())}/${srffilepath2(_appde.getCodeName())}-service'; </#if> </#if> </#if> </#list> </#if> </#assign> <#ibizinclude> ../@MACRO/SERVICE/SERVICE_HEADER.ts.ftl </#ibizinclude> <#if ctrl.getPSSysMapItems?? && ctrl.getPSSysMapItems()??> <#list ctrl.getPSSysMapItems() as mapitem> <#if mapitem.getPSAppDataEntity()??> <#assign _appde = mapitem.getPSAppDataEntity() /> <#if _appde.getId() != appde.getId()> <#if !P.exists("importService", _appde.getId(), "")> /** * ${_appde.getLogicName()}服务对象 * * @type {${srfclassname('${_appde.getCodeName()}')}Service} * @memberof ${srfclassname('${ctrl.codeName}')}Service */ public ${_appde.getCodeName()?lower_case}Service: ${srfclassname('${_appde.getCodeName()}')}Service = new ${srfclassname('${_appde.getCodeName()}')}Service(); </#if> </#if> </#if> </#list> </#if> /** * 地图配置集合 * * @type {*} * @memberof ${srfclassname('${ctrl.codeName}')}Service */ public mapConfig: any[] = [ <#if ctrl.getPSSysMapItems?? && ctrl.getPSSysMapItems()??> <#list ctrl.getPSSysMapItems() as mapitem> { itemName: '${mapitem.getName()}', itemType: '${mapitem.getItemType()}', color : '${mapitem.getBKColor()}', textColor : '${mapitem.getColor()}' }<#if mapitem_has_next>,</#if> </#list> </#if> ]; /** * 查询数据 * * @param {string} action * @param {*} [context={}] * @param {*} [data={}] * @param {boolean} [isloading] * @returns {Promise<any>} * @memberof ${srfclassname('${ctrl.codeName}')}Service */ @Errorlog public search(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> { let _this = this; return new Promise((resolve: any, reject: any) => { let promises:any = []; let tempRequest:any; <#if ctrl.getPSSysMapItems()??> <#list ctrl.getPSSysMapItems() as mapitem> <#if mapitem.getPSAppDataEntity()?? && mapitem.getPSDEDataSet()??> <#assign _appde = mapitem.getPSAppDataEntity() /> <#assign deDataSet = mapitem.getPSDEDataSet() /> <#if !P.exists("importService3", _appde.getId() + deDataSet.getCodeName(), "")> <#if _appde.getId() == appde.getId()> tempRequest = this.handleRequestData(action,context,data,true,"${mapitem.getItemType()}"); promises.push(this.appEntityService.Fetch${deDataSet.getCodeName()}(tempRequest.context, tempRequest.data, isloading)); <#else> tempRequest = this.handleRequestData(action,context,data,true,"${mapitem.getItemType()}"); promises.push(this.${_appde.getCodeName()?lower_case}Service.Fetch${deDataSet.getCodeName()}(tempRequest.context, tempRequest.data, isloading)); </#if> </#if> </#if> </#list> </#if> Promise.all(promises).then((resArray: any) => { let _data:any = []; resArray.forEach((response:any,resIndex:number) => { if (!response || response.status !== 200) { return; } let _response: any = JSON.parse(JSON.stringify(response)); _response.data.forEach((item:any,index:number) =>{ _response.data[index].color = _this.mapConfig[resIndex].color; _response.data[index].textColor = _this.mapConfig[resIndex].textColor; _response.data[index].itemType = _this.mapConfig[resIndex].itemType; }); ; _this.handleResponse(action, _response,false,_this.mapConfig[resIndex].itemType); _data.push(..._response.data); }); let result = {status: 200, data: _data}; resolve(result); }).catch((response: any) => { reject(response); }); }); } /** * 处理request请求数据 * * @param action 行为 * @param data 数据 * @memberof ${srfclassname('${ctrl.codeName}')}Service */ public handleRequestData(action: string,context:any ={},data: any = {},isMerge:boolean = false,itemType:string=""){ let model: any = this.getMode(); model.itemType = itemType; return super.handleRequestData(action,context,data,isMerge); } /** * 处理response返回数据 * * @param {string} action * @param {*} response * @memberof ${srfclassname('${ctrl.codeName}')}Service */ public async handleResponse(action: string, response: any,isCreate:boolean = false,itemType:string=""){ let model: any = this.getMode(); model.itemType = itemType; super.handleResponse(action,response,isCreate); } <#ibizinclude> ../@MACRO/SERVICE/SERVICE_BOTTOM.ts.ftl </#ibizinclude>