LIST_VIEW.vue.ftl 6.1 KB
Newer Older
1 2 3 4 5

<#ibizinclude>
./LAYOUTPANEL_VIEW.template.ftl
</#ibizinclude>

6
<#assign import_block>
7
import CodeListService from "@/codelist/codelist-service";
8 9 10 11 12 13
<#if view.getPSSysCounterRef?? && view.getPSSysCounterRef()?? && view.getPSSysCounterRef().getPSAppCounter()??>
<#assign appCounter = view.getPSSysCounterRef().getPSAppCounter() />
import  ${srfclassname('${appCounter.getCodeName()}')}CounterService  from '@/counter/${srffilepath2(appCounter.getCodeName())}/${srffilepath2(appCounter.getCodeName())}-counter';
</#if>
</#assign>

14 15 16 17
<#ibizinclude>
./VIEW_HEADER-BASE.vue.ftl
</#ibizinclude>

18 19 20 21
<#assign mounted_block>
<#if view.isEnableQuickGroup()>_this.loadQuickGroupModel();</#if>
</#assign>

22 23 24 25 26 27 28 29 30
<#ibizinclude>
./VIEW_CONTENT-BASE.vue.ftl
</#ibizinclude>
    /**
     * 搜索值
     *
     * @type {string}
     * @memberof ${srfclassname('${view.name}')}
     */
31
    public query: string = '';
32

33 34 35 36 37 38 39 40
    /**
     * 视图类型
     *
     * @type {string}
     * @memberof ${srfclassname('${view.name}')}
     */
    public controlType: string = "view";

41 42 43 44 45 46
    /**
     * 是否展开搜索表单
     *
     * @type {boolean}
     * @memberof ${srfclassname('${view.name}')}
     */
47
    public isExpandSearchForm: boolean = ${view.isExpandSearchForm()?c};
48 49 50 51 52 53 54

    /**
     * 快速搜索
     *
     * @param {*} $event
     * @memberof ${srfclassname('${view.name}')}
     */
55
    public onSearch($event: any): void {
56 57 58 59 60 61
        const refs: any = this.$refs;
        if (refs.list) {
            refs.list.load({});
        }
    }

tony001's avatar
tony001 committed
62
    <#if view.getPSSysCounterRef?? && view.getPSSysCounterRef()?? && view.getPSSysCounterRef().getPSAppCounter()??>
63 64 65 66 67 68 69
    <#assign appCounter = view.getPSSysCounterRef().getPSAppCounter() />
    /**
     * ${srfclassname('${appCounter.getCodeName()}')}CounterService计数器服务对象
     *
     * @type {${srfclassname('${appCounter.getCodeName()}')}CounterService}
     * @memberof ${srfclassname('${view.name}')}Base
     */
RedPig97's avatar
RedPig97 committed
70
    public ${appCounter.getCodeName()?lower_case}counterservice: ${srfclassname('${appCounter.getCodeName()}')}CounterService = new ${srfclassname('${appCounter.getCodeName()}')}CounterService({ context:this.context,viewparams:this.viewparams });
71 72 73 74 75 76 77 78 79 80
    </#if>

<#if view.isEnableQuickGroup()>

    /**
     * 代码表服务对象
     *
     * @type {CodeListService}
     * @memberof ${srfclassname('${view.name}')}Base
     */  
RedPig97's avatar
RedPig97 committed
81
    public codeListService:CodeListService = new CodeListService();
82 83 84 85 86 87

    /**
     * 快速分组数据对象
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
88
    public quickGroupData:any;
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

    /**
     * 快速分组是否有抛值
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
    public isEmitQuickGroupValue:boolean = false;

    /**
     * 快速分组模型
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
    public quickGroupModel:Array<any> = [];

104 105 106 107 108 109 110
    /**
     * 是否单选
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
    public isSingleSelect:boolean = true;

111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
    /**
     * 加载快速分组模型
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
    public loadQuickGroupModel(){
        <#if view.getQuickGroupPSCodeList()??>
        <#assign codelist=view.getQuickGroupPSCodeList() />
        let quickGroupCodeList:any = {tag:'${codelist.codeName}',codelistType:'${codelist.getCodeListType()}'};
        if(quickGroupCodeList.tag && Object.is(quickGroupCodeList.codelistType,"STATIC")){
            const codelist = this.$store.getters.getCodeList(quickGroupCodeList.tag);
            if (codelist) {
                this.quickGroupModel = [...this.handleDynamicData(JSON.parse(JSON.stringify(codelist.items)))];
            } else {
                <#noparse>console.log(`----${quickGroupCodeList.tag}----代码表不存在`);</#noparse>
            }
        }else if(quickGroupCodeList.tag && Object.is(quickGroupCodeList.codelistType,"DYNAMIC")){
            this.codeListService.getItems(quickGroupCodeList.tag,{},{}).then((res:any) => {
                this.quickGroupModel = res;
            }).catch((error:any) => {
                <#noparse>console.log(`----${quickGroupCodeList.tag}----代码表不存在`);</#noparse>
            });
        }
        </#if>
    }

    /**
     * 处理快速分组模型动态数据部分(%xxx%)
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
    public handleDynamicData(inputArray:Array<any>){
        if(inputArray.length >0){
            inputArray.forEach((item:any) =>{
               if(item.data && Object.keys(item.data).length >0){
                   Object.keys(item.data).forEach((name:any) =>{
                        let value: any = item.data[name];
                        if (value && typeof(value)=='string' && value.startsWith('%') && value.endsWith('%')) {
                            const key = (value.substring(1, value.length - 1)).toLowerCase();
                            if (this.context[key]) {
                                value = this.context[key];
                            } else if(this.viewparams[key]){
                                value = this.viewparams[key];
                            }
                        }
                        item.data[name] = value;
                   })
               }
            })
        }
        return inputArray;
    }

    /**
     * 快速分组值变化
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
169
    public quickGroupValueChange($event:any){
170
        if($event){
171
            this.quickGroupData = $event.data;
172 173 174 175 176 177 178 179 180 181 182 183 184 185
            if(this.isEmitQuickGroupValue){
                this.onSearch($event);
            }
        }
        this.isEmitQuickGroupValue = true;
    }
</#if>
<#if view.getQuickPSDESearchForm()??>

    /**
     * 快速搜索栏数据对象
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
186
    public quickFormData:any;
187 188 189 190 191 192

    /**
     * 快速搜索栏值变化
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
193 194
    public quickFormValueChange($event:any){
        this.quickFormData = $event;
195 196 197 198
        this.onSearch($event);
    }
</#if>

199 200 201 202 203 204 205
<#ibizinclude>
./VIEW_BOTTOM-BASE.vue.ftl
</#ibizinclude>

<#ibizinclude>
./VIEW-BASE.style.ftl
</#ibizinclude>