VIEW-BASE.vue.ftl 2.3 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
<#assign self_content>
    /**
     * 工具栏模型数据
     * 
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public linkModel:Array<any> = [];

    /**
     * 获取工具栏按钮
     * 
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public getWFLinkModel():Promise<any>{
        return new Promise((resolve:any, reject:any) =>{
            let datas: any[] = [];
            let xData: any = this.$refs.form;
            if (xData.getDatas && xData.getDatas instanceof Function) {
                datas = [...xData.getDatas()];
            }
            if(Object.keys(this.viewparams).length > 0){
                Object.assign(datas,{'taskDefinitionKey':this.viewparams.userTaskId});
            }
            this.appEntityService.GetWFLink(JSON.parse(JSON.stringify(this.context)),datas,true).then((response:any) =>{
                if (response && response.status === 200) {
                    this.linkModel = response.data;
                    resolve(response.data);
                }
            }).catch((response: any) => {
                if (response && response.status) {
KK's avatar
KK committed
31
                    this.$notice.error(response.message);
32 33 34
                    return;
                }
                if (!response || !response.status || !response.data) {
KK's avatar
KK committed
35
                    this.$notice.error('系统异常');
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
                    return;
                }
            });
        });
    }

    /**
     * 动态工具栏点击
     * 
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public dynamic_toolbar_click(linkItem:any, $event:any){
        let datas: any[] = [];
        let xData: any = this.$refs.form;
        if (xData.getDatas && xData.getDatas instanceof Function) {
            datas = [...xData.getDatas()];
        }
        xData.wfsubmit(datas,linkItem).then((response: any) => {
            if (!response || response.status !== 200) {
                return;
            }
            const { data: _data } = response;

            if (this.viewdata) {
                this.$emit('viewdataschange', [{ ..._data }]);
                this.$emit('close');
            } else if (this.$tabPageExp) {
                this.$tabPageExp.onClose(this.$route.fullPath);
            }
        });
    }

</#assign>
<#ibizinclude>
../@MACRO/VIEW-BASE.vue.ftl
</#ibizinclude>