VIEW-BASE.vue.ftl 3.5 KB
Newer Older
KK's avatar
KK committed
1 2 3
<#assign import_block>
import { toastController, alertController } from '@ionic/core';
</#assign>
4
<#assign self_content>
KK's avatar
KK committed
5 6 7 8 9
    /**
     * 工作流审批意见控件绑定值
     *
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
KK's avatar
KK committed
10
    public srfwfmemo: string = "";
zcdtk's avatar
zcdtk committed
11

12 13
    /**
     * 工具栏模型数据
zcdtk's avatar
zcdtk committed
14 15
     *
     * @type {Array<any>}
16 17
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
zcdtk's avatar
zcdtk committed
18
    public linkModel: Array<any> = [];
19 20 21

    /**
     * 获取工具栏按钮
zcdtk's avatar
zcdtk committed
22 23
     *
     * @returns {Promise<any>}
24 25
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
zcdtk's avatar
zcdtk committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    public async getWFLinkModel(): Promise<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 });
        }
        const response: any = await this.appEntityService.GetWFLink({ ...this.context }, datas);
        if (response && response.status === 200) {
            this.linkModel = response.data;
        } else {
            const { data: _data } = response;
            this.$notice.error(_data.message);
        }
        return response;
43 44 45 46
    }

    /**
     * 动态工具栏点击
zcdtk's avatar
zcdtk committed
47 48 49
     *
     * @param {*} linkItem
     * @param {*} $event
50 51
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
KK's avatar
KK committed
52
    public async dynamic_toolbar_click(linkItem: any, $event: any) {
KK's avatar
KK committed
53
        let datas: any;
54 55
        let xData: any = this.$refs.form;
        if (xData.getDatas && xData.getDatas instanceof Function) {
KK's avatar
KK committed
56 57
            datas = xData.getDatas()[0];
        }
KK's avatar
KK committed
58
        let falg = await this.openSrfwfmemo(linkItem);
KK's avatar
KK committed
59 60 61
        if(!falg){
            return
        }
KK's avatar
KK committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75
        let res = await xData.save();
        if (!res || res.status !== 200) {
            return;
        }
        let response = await xData.wfsubmit(this.context,linkItem,datas);
        if (!response || response.status !== 200) {
            return;
        }
        const { data: _data } = response;
        if (this.viewparams) {
            this.$emit('viewdataschange', [{ ..._data }]);
            this.$emit('close');
        } else if (this.$tabPageExp) {
            this.$tabPageExp.onClose(this.$route.fullPath);
76 77 78
        }
    }

KK's avatar
KK committed
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
    /**
     * 工作流审批意见
     *
     * @protected
     * @param {*} linkItem
     * @returns {Promise<any>}
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public async openSrfwfmemo(linkItem:any) :Promise<any>{
        let falg = false;
        const alert = await alertController.create({
        header: linkItem.sequenceFlowName,
        buttons: [{
                        text: '取消',
                    },
                    {
                        text: '提交',
                        handler: () => {
                            falg = true
                        }
                    },],
        inputs : [{
                    name: 'srfwfmemo',
                    id: 'srfwfmemo',
                    type: 'textarea',
                    placeholder: '请输入'+linkItem.sequenceFlowName+"意见(非必填)",
                    value:this.srfwfmemo
                },]});
        await alert.present();
        let reData =  await alert.onDidDismiss();
        this.srfwfmemo = reData.data.values.srfwfmemo;
        return falg;
    }

113 114 115 116
</#assign>
<#ibizinclude>
../@MACRO/VIEW-BASE.vue.ftl
</#ibizinclude>