import typesBill from '../components-control/typesBill.vue';
import { getUUID } from "./util/lib.js";
import {setQueryTag} from './util/queryTag.js';
export default {
    execute(context, param) {
        if (!param.billId || !param.viewName) {
            context.dom.$Message.info("请配置跳转页面的参数");
            return;
        }
        const uuid = getUUID();
        const templateName = context.selects[0][param.viewName];
        const index = context.selects[0]._index||(context.selects[0]._serialIndex)*1-1;

        setQueryTag(context.currentDataQueryConditionSet,index,templateName,uuid);//上张下张用 
        if (
            window.osConfig.appOpenMode &&
            window.osConfig.appOpenMode == "apploader"
        ) {
            GMS.$hideContainer.$portalAPI.emit(
                "open-new-page", //打开一个新的页签
                uuid,
                "runner-bill-form",
                {
                    templateName: templateName,
                    id: context.selects[0][param.billId],
                    state: 'readOnly',
                    hideButtonGroup: param.hideButton? true: false
                },
                {
                    openWay: "FUNCTAB",
                    title: param.displayName || "单据详情",
                }
            );
        } else {
            GMS.$hideContainer.addComponent(typesBill, {}, function (c) {
                c.templateName = templateName;
                c.billId = context.selects[0][param.billId];
                c.init = true;
                c.modal_visible = true;
                c.isReadOnly = true
                c.state = 'readOnly'
                c.hideButtonGroup = param.hideButton? true: false
            })
        }
    }
}