codelist.ts.ftl 2.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
import { MockAdapter } from '../mock-adapter';
const mock = MockAdapter.getInstance();

import Mock from 'mockjs'

// 获取全部数组
mock.onGet('./assets/json/data-dictionary.json').reply((config: any) => {
    let status = MockAdapter.mockStatus(config);
    return [status, [
    <#if app.getAllPSAppCodeLists()??>
    <#list app.getAllPSAppCodeLists() as codelist>
    {
    <#if codelist.getCodeListType() == "STATIC" && codelist.getAllPSCodeItems()??>
tony001's avatar
tony001 committed
17 18
        srfkey: "${codelist.codeName}",
        emptytext: "${codelist.getEmptyText()}",
19 20 21 22 23
        "codelisttype":"static",
        items: [
            <#if codelist.getAllPSCodeItems()??>
            <#list codelist.getAllPSCodeItems() as codeitem>
            {
tony001's avatar
tony001 committed
24 25 26
                id: "${codeitem.getValue()?j_string}",
                label: "${codeitem.getText()?j_string}",
                text: "${codeitem.getText()?j_string}",
tony001's avatar
tony001 committed
27 28 29 30 31 32 33 34 35 36 37 38
                <#if codeitem.getPSSysImage()??>
                <#assign sysimage = codeitem.getPSSysImage()/>
                <#if sysimage.getImagePath() ==  "">
                "iconcls":"${sysimage.getCssClass()}",
                <#else>
                "icon":"${sysimage.getImagePath()}",
                </#if>
                </#if>
                "data":<#if codeitem.getData() != "">${codeitem.getData()}<#else>""</#if>,
                <#if codeitem.getCodeName()??>
                "codename":"${codeitem.getCodeName()}",
                </#if>
39 40 41 42 43 44 45 46
                <#if codeitem.getColor?? && codeitem.getColor()??>
                "color": "${codeitem.getColor()?j_string}",
                </#if>
                <#comment>判断是否为数值代码项</#comment>
                <#if codelist.isCodeItemValueNumber?? && codelist.isCodeItemValueNumber()>
                value: ${codeitem.getValue()?j_string},
                <#if codeitem.getParentCodeItem()??><#assign parentCodeItem = codeitem.getParentCodeItem() />"pvalue": ${parentCodeItem.getValue()?j_string},</#if>
                <#else>
tony001's avatar
tony001 committed
47
                value: "${codeitem.getValue()?j_string}",
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
                <#if codeitem.getParentCodeItem()??><#assign parentCodeItem = codeitem.getParentCodeItem() />"pvalue": "${parentCodeItem.getValue()?j_string}",</#if>
                </#if>
                disabled: <#if codeitem.isDisableSelect()>true<#else>false</#if>,
            },
            </#list>
            </#if>
        ]
    <#else>
        "srfkey": "${codelist.codeName}",
        "emptytext": "${codelist.getEmptyText()}",
        "codelisttype":"dynamic",
        "appdataentity":"<#if codelist.getPSAppDataEntity?? && codelist.getPSAppDataEntity()??>${codelist.getPSAppDataEntity().codeName}</#if>",
        "appdedataset":"<#if codelist.getPSAppDEDataSet?? && codelist.getPSAppDEDataSet()??>${codelist.getPSAppDEDataSet().codeName}</#if>",
        "items": []
    </#if>
    }<#if codelist_has_next>,</#if>
    </#list>
    </#if>
    ]];
});