import typesBill from "../components-control/typesBill.vue";
import {getUUID} from './util/lib.js'
export default {
  execute(context, param) {
    GMS.queryObject = {//上张下张用
      currentDataQueryConditionSet: context.currentDataQueryConditionSet,
      index:  -1,
      templateName:param.viewName,
      isReadOnly:false
    }
    let templateName = null;
    if (Object.prototype.toString.call(param) === "[object Array]") {
      templateName = param[0];
    } else {
      templateName = param.viewName;
    }
    if (
      window.osConfig.appOpenMode &&
      window.osConfig.appOpenMode == "apploader"
    ) {
      GMS.$hideContainer.$portalAPI.emit(
        "open-new-page", //打开一个新的页签
        getUUID(),
        "runner-bill-form",
        {
          templateName: templateName,
        },
        {
          openWay: "FUNCTAB",
          title: "创建单据",
        }
      );
    }else{
      GMS.$hideContainer.addComponent(typesBill, {}, function (c) {
        c.templateName = templateName
        c.init = true;
        c.modal_visible = true;
        c.state = ''
      })
    }
  },
 
};
