MODEL.ts.ftl 3.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
<#ibizinclude>
../@MACRO/MODEL/MODEL_HEADER.ts.ftl
</#ibizinclude>

	/**
	 * 是否是实体数据导出
	 *
	 * @returns {any[]}
	 * @memberof ${srfclassname('${ctrl.getCodeName()}')}${srfclassname('${ctrl.name}')}Mode
	 */
	public isDEExport: boolean = false;

	/**
	 * 获取数据项集合
	 *
	 * @returns {any[]}
	 * @memberof ${srfclassname('${ctrl.getCodeName()}')}${srfclassname('${ctrl.name}')}Mode
	 */
	public getDataItems(): any[] {
    if(this.isDEExport){
		  return [
<#--  实体导出数据项  -->
<#if ctrl.getPSDEDataExport?? && ctrl.getPSDEDataExport()?? && ctrl.getPSDEDataExport().getPSDEDataExportItems()??>
  <#list ctrl.getPSDEDataExport().getPSDEDataExportItems() as dataitem>
        {
          name: '${dataitem.getName()}',
    <#if dataitem.getPSDEField()??>
          prop: '${dataitem.getPSDEField().getCodeName()?lower_case}',
          dataType: '${dataitem.getPSDEField().getDataType()}',
    </#if>
        },
  </#list>
</#if>
      ]
    }else{
		  return [
<#--  表格数据项  -->
<#if ctrl.getPSDEGridDataItems()??>
  <#list ctrl.getPSDEGridDataItems() as dataitem>
        {
          name: '${dataitem.getName()}',
    <#if dataitem.getPSDEField()??>
          prop: '${dataitem.getPSDEField().getCodeName()?lower_case}',
          dataType: '${dataitem.getPSDEField().getDataType()}',
    </#if>
        },
  </#list>
</#if>
<#--  关联主实体的主键  -->
<#if ctrl.getPSAppDataEntity()??>
  <#assign appDataEntity = ctrl.getPSAppDataEntity() />
  <#if appDataEntity.isMajor() == false && appDataEntity.getMinorPSAppDERSs()??>
    <#list appDataEntity.getMinorPSAppDERSs() as minorAppDERSs>
      <#if minorAppDERSs.getMajorPSAppDataEntity()??>
      <#assign majorAppDataEntity = minorAppDERSs.getMajorPSAppDataEntity() />
        {
          name: '${majorAppDataEntity.getCodeName()?lower_case}',
          prop: '${majorAppDataEntity.getKeyPSAppDEField().getCodeName()?lower_case}',
          dataType: 'FONTKEY',
        },
      </#if>
    </#list>
  </#if>
</#if>
<#if ctrl.getPSDEGridDataItems()??>
  <#list ctrl.getPSDEGridDataItems() as dataitem>
	<#-- 界面主键标识 -->
  <#if dataitem.getPSDEField?? && dataitem.getPSDEField()??>
	<#if !P.exists("importService", dataitem.getPSDEField().getId(), "")>
	 	<#if dataitem.getPSDEField().isKeyDEField() == true>
        {
          name: '${ctrl.getPSAppDataEntity().getCodeName()?lower_case}',
          prop: '${dataitem.getPSDEField().getCodeName()?lower_case}',
        },
	 	</#if>
	</#if>
  </#if>
  </#list>
</#if>
<#if view.hasPSControl('searchform')>
${P.getCtrlCode('searchform', 'MODEL_CONTENT.ts').code}
</#if>
        {
          name:'size',
          prop:'size'
        },
        {
          name:'query',
          prop:'query'
        },
        {
          name:'page',
          prop:'page'
        },
        {
          name:'sort',
          prop:'sort'
        },
        {
          name:'srfparentdata',
          prop:'srfparentdata'
        },
        // 前端新增修改标识,新增为"0",修改为"1"或未设值
        {
          name: 'srffrontuf',
          prop: 'srffrontuf',
          dataType: 'TEXT',
        },
      ]
    }
  }

<#ibizinclude>
../@MACRO/MODEL/MODEL_BOTTOM.ts.ftl
</#ibizinclude>