import { getUUID } from "./util/lib.js";
export default {
  execute(context, param) {
    param.fieldQueryRelation = this.dealWithParam(
      param.fieldQueryRelation,
      context
    );
    if (
      window.osConfig.appOpenMode &&
      window.osConfig.appOpenMode == "apploader"
    ) {
      GMS.$hideContainer.$portalAPI.emit(
        "open-new-page", //打开一个新的页签
        getUUID(),
        "bill-runner-query",
        {
          name: param.queryView,
          param: param,
        },
        {
          openWay: "FUNCTAB",
          title: param.title || "查询穿透",
        }
      );
    } else {
      GMS.$hideContainer.$router.push({
        path: param.queryView,
        query: { param: param }
      });
    }
  },
  dealWithParam(fieldQueryRelation, context) {
    fieldQueryRelation.forEach((v) => {
      v.values = context.selects[0][v.originalField + "_code"];
    });
    return fieldQueryRelation;
  },
};
