var de = Object.defineProperty;
var ue = (s, a, t) => a in s ? de(s, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[a] = t;
var C = (s, a, t) => (ue(s, typeof a != "symbol" ? a + "" : a, t), t);
import { EditFormModel as me, FormMDCtrlModel as pe, DefectModelError as he, AppEntityModel as H } from "@ibiz-template/model";
import { useNamespace as R, useControlController as fe, usePropsWatch as ve, getDatePickerProps as ye, getEditorEmits as G, useController as ge, getDataPickerProps as se, useViewController as be, getInputNumberProps as De, getGridInputNumberProps as we, getGridEditorEmits as Ce, useGridCellEditor as Ee } from "@ibiz-template/vue-util";
import { defineComponent as M, getCurrentInstance as W, ref as E, watch as T, h as o, onMounted as Pe, computed as _ } from "vue";
import { createUUID as te, isNilOrEmpty as Ie } from "qx-util";
import { ViewMode as ae, PluginStaticResource as Ne, OpenAppViewCommand as q, UIActionHandler as Ae, FrontUIActionHandler as re } from "@ibiz-template/runtime";
import { EditFormController as Fe, FormMDCtrlController as xe, FormDRUIPartController as Se, EditViewController as ke, TextBoxEditorController as Oe, DatePickerEditorController as Te, UploadEditorController as Me, PickerEditorController as oe } from "@ibiz-template/controller";
import { ControlVO as Re, calcResPath as K } from "@ibiz-template/service";
import $ from "dayjs";
import { RuntimeError as Ue, StringUtil as ne } from "@ibiz-template/core";
class Le extends Fe {
  constructor() {
    super(...arguments);
    /**
     *   基础数据
     *
     * @author fangZhiHao
     * @date 2024-04-26 17:04:49
     * @type {IData}
     */
    C(this, "baseResData", []);
    /**
     *   对比数据
     *
     * @author fangZhiHao
     * @date 2024-04-26 17:04:49
     * @type {IData}
     */
    C(this, "compareResData", []);
    /**
     * 表单旧数据
     *
     * @author zk
     * @date 2023-12-20 11:12:43
     * @protected
     * @type {IData}
     * @memberof FormController
     */
    C(this, "oldData", new Re());
    /**
     * version数据
     *
     * @author fangZhiHao
     * @date 2024-04-26 16:04:37
     * @type {IData[]}
     */
    C(this, "versionData", []);
    /**
     *  对比数据
     *
     * @author fangZhiHao
     * @date 2024-04-26 16:04:37
     * @type {IData[]}
     */
    C(this, "comparisonArr", {});
    /**
     *  基础表格数据
     *
     * @author fangZhiHao
     * @date 2024-05-06 11:05:57
     * @type {IData[]}
     */
    C(this, "gridData", []);
    /**
     *  展示完全数据
     *
     * @author fangZhiHao
     * @date 2024-05-06 11:05:04
     * @type {IData[]}
     */
    C(this, "AllGridData", []);
    /**
     *  去除相同数据
     *
     * @author fangZhiHao
     * @date 2024-05-06 11:05:15
     * @type {IData[]}
     */
    C(this, "removeSameGridData", []);
    /**
     *  关系界面数据
     *
     * @author fangZhiHao
     * @date 2024-04-30 10:04:33
     * @type {IData}
     */
    C(this, "AlldruipartData", /* @__PURE__ */ new Map());
    /**
     *  关系界面数据长度
     *
     * @author fangZhiHao
     * @date 2024-05-06 11:05:56
     * @type {number}
     */
    C(this, "druipartDataSize", 0);
    /**
     *   关系界面实际数据
     *
     * @author fangZhiHao
     * @date 2024-05-06 11:05:13
     * @type {IData}
     */
    C(this, "newDruipartData", {});
  }
  /**
   * 加载数据
   *
   * @return {*}  {Promise<ControlVO>}
   * @memberof FormDataComparisonController
   */
  async loadGridData() {
    await this.startLoading();
    const t = this.model.source.M.getPSControlParam.ctrlParams, { BASEENTITY: e, COMPAREENTITY: i } = t, r = await ibiz.entityService.getService(e), l = await ibiz.entityService.getService(i), v = Object.assign({}, this.context.clone(), {
      [e.toLowerCase()]: this.params.base_version
    }), d = Object.assign({}, this.context.clone(), {
      [i.toLowerCase()]: this.params.compare_version
    }), m = await r.exec("Get", v, this.params), b = await l.exec(
      "Get",
      d,
      this.params
    );
    return this.isLoaded = !0, {
      baseData: m.data.data,
      compareData: b.data.data
    };
  }
  /**
   * 判断值是否为空
   *
   * @param {(string | IData[] | null | undefined)} value
   * @return {*}
   * @memberof FormDataComparisonController
   */
  isFalseyButNotEmpty(t) {
    return t == null || typeof t == "string" && t === "" || Array.isArray(t) && t.length === 0 || typeof t == "object" && Object.keys(t).length === 0;
  }
  /**
   * 比较两个值
   *
   * @param {IData} objA
   * @param {IData} objB
   * @return {*}
   * @memberof FormDataComparisonController
   */
  compareObjectValues(t, e) {
    return JSON.stringify(t) !== JSON.stringify(e);
  }
}
const Ve = M({
  name: "IBizFormDataComparison",
  props: {
    modelData: {
      type: me,
      required: !0
    },
    context: {
      type: Object,
      required: !0
    },
    params: {
      type: Object,
      default: () => ({})
    },
    enableAutoSave: {
      type: Boolean,
      required: !1
    }
  },
  setup(s) {
    const a = R("form-data-comparison"), {
      proxy: t
    } = W(), e = fe(t, () => {
      const n = new Le(s.modelData, s.context, s.params);
      return ve(t, "enableAutoSave", n.setEnableAutoSave.bind(n)), n;
    }), i = E(!0), r = E(!1), l = E({}), v = E({}), d = E([]), m = [], b = E([]), c = E([]), y = E([]), f = /* @__PURE__ */ new Map(), D = E(0), p = (n) => {
      const u = [];
      if (u.push(n), n && n.children) {
        const I = [];
        n.children.forEach((F) => {
          const S = p(F);
          I.push(...S);
        }), u.push(...I);
      }
      return u;
    }, h = p(s.modelData);
    m.push(...h);
    const g = (n) => {
      const u = e.details[n.source.name], I = o("not-supported-editor", {
        attrs: {
          modelData: n.editor
        }
      });
      return o("div", {
        class: [a.e("form-grid-item"), a.is("add", b.value.includes(n.source.name)), a.is("update", y.value.includes(n.source.name)), a.is("delete", c.value.includes(n.source.name))]
      }, [o("div", {
        class: a.em("form-grid-item", "name")
      }, [n.source.caption]), o("div", {
        class: a.em("form-grid-item", "left")
      }, [u.editorProvider ? o(u.editorProvider.formEditor, {
        props: {
          value: v.value[n.source.name],
          data: u.data,
          controller: u.editor,
          disabled: u.disabled,
          readonly: !0
        }
      }) : I]), o("div", {
        class: a.em("form-grid-item", "right")
      }, [u.editorProvider ? o(u.editorProvider.formEditor, {
        props: {
          value: l.value[n.source.name],
          data: u.data,
          controller: u.editor,
          disabled: u.disabled,
          readonly: !0
        }
      }) : I])]);
    }, N = (n, u) => {
      f.set(n.source.id, u), u.evt.on("mounted", () => {
        i.value && e.startLoading(), D.value += 1, u.call.refresh();
      }), u.evt.on("refreshed", () => {
        D.value -= 1, setTimeout(() => {
          i.value && e.endLoading();
        }, 500);
      });
    }, A = (n) => {
      const u = m.find((B) => B.id === `${n.source.id}_srfcopy`), I = n.embedView.source.modelPath, F = u == null ? void 0 : u.embedView.source.modelPath, S = e.context.clone(), k = {
        base_version: s.params.base_version
      }, U = e.context.clone();
      Object.assign(U, {
        gysrlzy_info: s.params.compare_version,
        compare_version: s.params.compare_version
      });
      const j = {
        compare_version: s.params.compare_version
      }, L = l.value[n.source.userTag], V = v.value[u == null ? void 0 : u.source.userTag];
      let J = !1, z = !1, X = !1;
      if (n.source.userTag2) {
        const B = JSON.parse(n.source.userTag2), {
          comparekey: Z,
          comparelist: ce
        } = B;
        L && V && Array.isArray(L) && Array.isArray(V) && (L.length === 0 && V.length !== 0 ? X = !0 : L.length !== 0 && V.length === 0 ? J = !0 : L.length !== 0 && V.length !== 0 && (L.length !== V.length ? z = !0 : L.some((Q) => {
          const ee = V.find((Y) => Q[Z] === Y[Z]);
          return ee ? ce.some((Y) => Q[Y] !== ee[Y] ? (z = !0, !0) : !1) : (z = !0, !0);
        })));
      }
      return o("div", {
        class: [a.e("druipart"), a.is("add", J), a.is("update", z), a.is("delete", X)]
      }, [o("div", {
        class: a.em("druipart", "caption")
      }, [n.source.caption]), o("div", {
        class: a.em("druipart", "left")
      }, [F && o("ViewShell", {
        attrs: {
          context: U,
          params: j,
          modal: {
            mode: ae.EMBED
          },
          modelPath: F,
          noLoadDefault: !0,
          name: u == null ? void 0 : u.source.id
        },
        key: te(),
        on: {
          neuronInit: (B) => N(u, B)
        }
      })]), o("div", {
        class: a.em("druipart", "right")
      }, [I && o("ViewShell", {
        attrs: {
          context: S,
          params: k,
          modal: {
            mode: ae.EMBED
          },
          modelPath: I,
          noLoadDefault: !0,
          name: n.source.id
        },
        key: te(),
        on: {
          neuronInit: (B) => N(n, B)
        }
      })])]);
    }, w = (n) => {
      const u = {
        modelData: n,
        controller: e.details[n.source.name]
      }, I = e.providers[n.source.name], F = o(I.component, {
        props: {
          ...u
        },
        key: n.id
      }), S = o(I.component, {
        props: {
          ...u
        },
        key: `compare_${n.id}`
      });
      return o("div", {
        class: a.e("mdctrl")
      }, [o("div", {
        class: a.em("mdctrl", "caption")
      }, [n.source.caption]), o("div", {
        class: a.em("mdctrl", "left")
      }, [F]), o("div", {
        class: a.em("mdctrl", "right")
      }, [S])]);
    }, P = (n) => {
      i.value = !1;
      const u = d.value.findIndex((I) => I === n.source.name);
      u > -1 ? d.value.splice(u, 1) : d.value.push(n.source.name);
    }, x = (n) => {
      if (!n.source.hidden) {
        if (n.source.detailType === "FORMPAGE")
          return o("div", {
            class: a.e("form-page")
          }, [n.children.map((u) => x(u))]);
        if (n.source.detailType === "FORMITEM") {
          const u = b.value.includes(n.source.name), I = c.value.includes(n.source.name), F = y.value.includes(n.source.name);
          return r.value && !u && !I && !F ? null : g(n);
        }
        if (n.source.detailType === "GROUPPANEL") {
          const u = d.value.includes(n.source.name);
          return o("div", {
            class: a.b("group")
          }, [o("div", {
            class: [a.be("group", "header"), a.is("hide-caption", !n.source.showCaption)]
          }, [o("div", {
            class: a.bem("group", "header", "name")
          }, [u ? o("i-icon", {
            class: a.bem("group", "header", "icon"),
            attrs: {
              type: "ios-arrow-forward",
              title: "展开"
            },
            on: {
              click: () => P(n)
            }
          }) : o("i-icon", {
            class: a.bem("group", "header", "icon"),
            attrs: {
              type: "ios-arrow-down",
              title: "收缩"
            },
            on: {
              click: () => P(n)
            }
          }), o("span", {
            class: a.bem("group", "header", "name-text")
          }, [n.source.caption || n.source.title])]), o("div", ["---"]), o("div", ["---"])]), o("div", {
            class: [a.be("group", "content"), a.is("collapse", u)]
          }, [n.children.map((I) => x(I))])]);
        }
        return n.source.detailType === "DRUIPART" && !n.source.name.endsWith("_srfcopy") ? A(n) : n.source.detailType === "MDCTRL" ? w(n) : null;
      }
    }, O = (n, u) => {
      const I = [], F = [], S = [];
      return Object.keys(u).forEach((k) => {
        const U = n[k], j = u[k];
        e.isFalseyButNotEmpty(U) && !e.isFalseyButNotEmpty(j) && I.push(k), !e.isFalseyButNotEmpty(U) && !e.isFalseyButNotEmpty(j) && e.compareObjectValues(U, j) && F.push(k);
      }), Object.keys(n).forEach((k) => {
        if (!Object.prototype.hasOwnProperty.call(u, k) || e.isFalseyButNotEmpty(u[k])) {
          const U = n[k];
          e.isFalseyButNotEmpty(U) || S.push(k);
        }
      }), {
        added: I,
        modified: F,
        deleted: S
      };
    };
    return T(() => s.params, async () => {
      const n = await e.loadGridData();
      l.value = n.baseData, v.value = n.compareData;
      const {
        added: u,
        modified: I,
        deleted: F
      } = O(v.value, l.value);
      b.value = u, y.value = I, c.value = F;
    }, {
      immediate: !0
    }), {
      ns: a,
      c: e,
      switchValue: r,
      druipartNum: D,
      renderEditor: g,
      renderByDetailType: x
    };
  },
  render() {
    return this.c.complete ? o("control-layout", {
      attrs: {
        modelData: this.c.model
      }
    }, [o("div", {
      class: this.ns.b()
    }, [o("div", {
      class: this.ns.e("top")
    }, [o("div", {
      class: this.ns.e("top-hidesame-content")
    }, [o("div", {
      class: this.ns.e("top-hidesame-content-left")
    }, ["隐藏相同项 ", o("i-switch", {
      model: {
        value: this.switchValue,
        callback: (s) => {
          this.switchValue = s;
        }
      }
    })]), o("div", {
      class: this.ns.e("top-hidesame-content-right")
    }, [o("div", {
      class: this.ns.e("top-hidesame-content-right-item")
    }, ["新增", o("div", {
      class: this.ns.e("top-hidesame-content-right-item-add")
    })]), o("div", {
      class: this.ns.e("top-hidesame-content-right-item")
    }, ["修改", o("div", {
      class: this.ns.e("top-hidesame-content-right-item-change")
    })]), o("div", {
      class: this.ns.e("top-hidesame-content-right-item")
    }, ["删除", o("div", {
      class: this.ns.e("top-hidesame-content-right-item-delete")
    })])])]), o("div", {
      class: this.ns.e("top-content")
    }, [o("div", {
      class: this.ns.em("top-content", "attr")
    }, ["信息项"]), o("div", {
      class: [this.ns.em("top-content", "left")]
    }, ["更新前内容"]), o("div", {
      class: [this.ns.em("top-content", "right")]
    }, ["更新后内容"])])]), o("div", {
      class: this.ns.e("content")
    }, [this.modelData.children.map((s) => this.renderByDetailType(s))])])]) : null;
  }
});
const Be = M({
  name: "CustomDataImport",
  props: {
    templateUrl: {
      type: String,
      required: !0
    },
    importUrl: {
      type: String,
      required: !0
    },
    dismiss: {
      type: Function
    }
  },
  setup(s, {
    emit: a
  }) {
    const t = R("data-import"), e = E(), i = E({
      state: "ready",
      message: "",
      rowError: []
    }), r = E(""), l = async (c) => {
      const y = new FormData(), f = $(r.value).format("YYYY-MM");
      y.append("file", c), y.append("ny", f);
      try {
        const D = await ibiz.net.request(s.importUrl, {
          method: "post",
          data: y,
          headers: {
            "Content-Type": "multipart/form-data"
          }
        });
        i.value.state = "success", i.value.message = "导入成功";
        const {
          errorinfo: p,
          success: h,
          total: g
        } = D.data, N = g ? Number(g) : 0, A = h ? Number(h) : 0, w = g - h;
        i.value.message = `共计导入数据 ${N} 条，错误[${w}]，成功[${A}]`, p && Object.keys(p).length > 0 && (i.value.rowError = [], Object.keys(p).forEach((P) => {
          i.value.rowError.push({
            index: Number(P) + 1,
            info: p[P].errorInfo
          });
        }));
      } catch (D) {
        i.value.state = "fail", i.value.message = `导入失败！${D.message}`;
      }
    }, v = (c) => {
      const y = c.target;
      if (!y.files)
        return;
      const f = y.files[0];
      y.value = null, l(f);
    }, d = async () => {
      var y;
      const c = await ibiz.net.request(s.templateUrl, {
        responseType: "blob"
      });
      if (c.status === 200) {
        let f = ((y = c.headers["content-disposition"].split(";").find((h) => h.indexOf("filename=") !== -1)) == null ? void 0 : y.slice(9)) || "";
        f = decodeURIComponent(f);
        const D = new Blob([c.data], {
          type: "application/vnd.ms-excel"
        }), p = document.createElement("a");
        p.download = f, p.style.display = "none", p.href = URL.createObjectURL(D), document.body.appendChild(p), p.click(), URL.revokeObjectURL(p.href), document.body.removeChild(p);
      }
    }, m = () => {
      e.value.click();
    }, b = () => {
      var c;
      a("close", {
        ok: !1,
        data: {}
      }), (c = s.dismiss) == null || c.call(s, {
        ok: !1,
        data: {}
      });
    };
    return Pe(() => {
      r.value = $().format("YYYY年MM月");
    }), {
      ns: t,
      curDate: r,
      onLinkClick: d,
      selectFile: m,
      onCancelButtonClick: b,
      onFileChange: v,
      inputUpLoad: e,
      message: i
    };
  },
  render() {
    return o("div", {
      class: [this.ns.b(), this.ns.is("custom", !0)]
    }, [o("input", {
      ref: "inputUpLoad",
      attrs: {
        type: "file",
        accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
      },
      style: "display: none",
      on: {
        change: this.onFileChange
      }
    }), o("div", {
      class: this.ns.e("caption")
    }, ["导入数据"]), o("div", {
      class: this.ns.e("date")
    }, [o("span", ["导入数据所属月份"]), o("i-datePicker", {
      attrs: {
        format: "yyyy年MM月",
        type: "month",
        clearable: !1
      },
      model: {
        value: this.curDate,
        callback: (s) => {
          this.curDate = s;
        }
      }
    })]), this.message.state === "ready" ? o("div", {
      class: this.ns.b("upload"),
      on: {
        click: this.selectFile
      }
    }, [o("img", {
      class: this.ns.be("upload", "img"),
      attrs: {
        src: "./assets/img/icon-import.svg"
      }
    }), o("span", {
      class: this.ns.be("upload", "text")
    }, ["单击此区域进行上传"])]) : o("div", {
      class: this.ns.b("message")
    }, [o("div", {
      class: this.ns.be("message", "title")
    }, ["导入结果"]), o("div", {
      class: this.ns.be("message", "content")
    }, [this.message.message]), this.message.rowError.length > 0 && [o("div", {
      class: this.ns.be("message", "title")
    }, ["错误信息"]), o("div", {
      class: this.ns.be("message", "content")
    }, [this.message.rowError.map((s) => o("div", [`第 ${s.index} 行：${s.info}`]))])]]), o("div", {
      class: this.ns.e("template-container")
    }, [o("div", {
      class: this.ns.e("template-description")
    }, ["下载导入模版，并按要求填写："]), o("div", {
      class: this.ns.e("template-link"),
      on: {
        click: this.onLinkClick
      }
    }, [o("i-icon", {
      attrs: {
        type: "ios-link"
      }
    }), "数据导入模板文件"])]), o("div", {
      class: this.ns.e("button-bar")
    }, [this.message.state !== "ready" && o("i-button", {
      on: {
        click: this.selectFile
      }
    }, ["重新上传"])])]);
  }
});
const _e = M({
  name: "YearMonthPicker",
  props: ye(),
  emits: G(),
  setup(s, {
    emit: a
  }) {
    const t = R("date-picker"), e = s.controller, i = e.model, r = E("date"), l = E("yyyy-MM-dd"), v = E(!1);
    switch (i.editorType) {
      case "DATEPICKEREX":
      case "DATEPICKEREX_NOTIME":
        r.value = "date";
        break;
      case "DATEPICKEREX_NODAY":
      case "DATEPICKEREX_NODAY_NOSECOND":
        v.value = !0, r.value = "time";
        break;
      case "DATEPICKEREX_HOUR":
      case "DATEPICKEREX_MINUTE":
      case "DATEPICKEREX_SECOND":
      case "DATEPICKEREX_NOSECOND":
      case "DATEPICKER":
      default:
        r.value = "datetime";
    }
    const d = e.valueFormat;
    if (d) {
      d === "YYYY-MM" ? r.value = "month" : d === "YYYY" && (r.value = "year");
      const f = d.replace("YYYY", "yyyy").replace("DD", "dd");
      l.value = f;
    }
    i.editorParams.formatText && (l.value = i.editorParams.formatText.replace("YYYY", "yyyy").replace("DD", "dd"));
    const m = E();
    T(() => s.value, (f, D) => {
      f && f !== D && (m.value = $(f).format(d));
    }, {
      immediate: !0
    });
    const b = (f, D) => {
      if (f) {
        const p = $(f.replace(/[年月]/g, "-")).format(d);
        a("change", p);
      } else
        a("change", f);
    }, c = (f) => {
      a("operate", f);
    }, y = E();
    return s.autoFocus && T(y, (f) => {
      f && f.$el.getElementsByTagName("input")[0].click();
    }), {
      ns: t,
      c: e,
      editorModel: i,
      type: r,
      format: l,
      formatValue: m,
      handleChange: b,
      onOpenChange: c,
      inputRef: y,
      isTimePicker: v
    };
  },
  render(s) {
    return s("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [[this.readonly && this.formatValue, !this.readonly && this.isTimePicker && s("ITimePicker", {
      ref: "inputRef",
      props: {
        ...this.c.customProps,
        value: this.value,
        type: this.type,
        format: this.format,
        placeholder: this.c.placeHolder,
        disabled: this.disabled,
        transfer: !0
      },
      on: {
        "on-change": this.handleChange,
        "on-open-change": this.onOpenChange
      }
    }), !this.readonly && !this.isTimePicker && s("ICalendarPicker", {
      ref: "inputRef",
      props: {
        ...this.c.customProps,
        value: this.value,
        type: this.type,
        format: this.format,
        placeholder: this.c.placeHolder,
        disabled: this.disabled,
        transfer: !0
      },
      on: {
        "on-change": this.handleChange,
        "on-open-change": this.onOpenChange
      }
    })]]);
  }
});
const ie = new Ne(import.meta.url), je = M({
  name: "DownLoadSafeFile",
  props: {},
  setup() {
    const s = R("download-safe-file"), a = ie.dir("/assets/doc/safe-file.doc");
    return {
      ns: s,
      url: a
    };
  },
  render() {
    return o("div", {
      class: this.ns.b()
    }, [o("a", {
      attrs: {
        download: "网络信息安全承诺书.doc",
        href: this.url
      }
    }, ["网络信息安全承诺书.doc"])]);
  }
});
class le extends xe {
  constructor() {
    super(...arguments);
    /**
     * 激活的分页下标
     *
     * @type {number}
     * @memberof FormMDCtrlFormStyle2Controller
     */
    C(this, "active", 0);
  }
  /**
   * 计算表单更新项信息
   *
   * @param {IPSDEFormItemUpdate} formItemUpdate
   * @return {*}
   * @memberof FormMDCtrlFormStyle2Controller
   */
  calcFormUpdateItem(t) {
    var e, i;
    return {
      methodName: ((e = t.getPSAppDEMethod()) == null ? void 0 : e.codeName) || "",
      itemNames: (i = t.getPSDEFIUpdateDetails()) == null ? void 0 : i.map((r) => r.name),
      model: {
        customCode: t.customCode,
        scriptCode: t.scriptCode
      }
    };
  }
  connect(t, e) {
    this.formNeurons.get(t) || (this.formNeurons.set(t, e), e.evt.on("mounted", () => {
      e.call.load();
    }), e.evt.on("destroyed", () => {
      this.formNeurons.delete(t);
    }), e.evt.on("valueChange", (i) => {
      if (i) {
        const r = this.contentCtrlData.find((l) => l.srfkey === i.srfkey);
        r && Object.assign(r, i), this.force();
      }
    }), e.evt.on("afterSave", async () => {
      const i = this.model.source.M.getPSAppDEField;
      i && await this.form.setDataValue(i.codeName.toLowerCase(), [
        ...this.contentCtrlData
      ]);
      const r = this.model.source.getPSDEFormItemUpdate();
      if (r) {
        const { methodName: l, itemNames: v, model: d } = this.calcFormUpdateItem(r);
        await this.form.updateFormItem(
          l,
          v,
          d
        );
      }
    }));
  }
  /**
   * 校验
   *
   * @return {*}  {Promise<boolean>}
   * @memberof FormMDCtrlFormStyle2Controller
   */
  async validate() {
    const t = [];
    this.formNeurons.forEach((r, l) => {
      const v = r.call.getFormController();
      t.push({ key: l, controller: v });
    });
    let e = "";
    const i = await Promise.all(
      t.map(async (r) => {
        const l = await r.controller.validate();
        return !e && !l && (e = r.key), l;
      })
    );
    if (e) {
      const r = this.contentCtrlData.findIndex((l) => l.srfkey === e);
      r > -1 && (this.active = r);
    }
    return i.findIndex((r) => !r) === -1;
  }
  /**
   * 静默校验
   *
   * @return {*}  {Promise<boolean>}
   * @memberof FormMDCtrlFormStyle2Controller
   */
  async silentValidate() {
    const t = [];
    this.formNeurons.forEach((r, l) => {
      const v = r.call.getFormController();
      t.push({ key: l, controller: v });
    });
    let e = "";
    const i = await Promise.all(
      t.map(async (r) => {
        const l = await r.controller.silentValidate();
        return !e && !l && (e = r.key), l;
      })
    );
    if (e) {
      const r = this.contentCtrlData.findIndex((l) => l.srfkey === e);
      r > -1 && (this.active = r);
    }
    return i.findIndex((r) => !r) === -1;
  }
}
const ze = M({
  name: "FormMDCtrlFormStyle2",
  props: {
    controller: {
      type: le,
      required: !0
    },
    modelData: {
      type: pe,
      required: !0
    }
  },
  setup(s) {
    const a = R("form-mdctrl-form-style2"), t = s.controller, {
      proxy: e
    } = W();
    ge(e, s.controller);
    const i = async (m, b, c) => {
      c.stopPropagation(), c.preventDefault();
      const y = t.contentCtrlData.length;
      await t.handleRemove(m, b), y !== t.contentCtrlData.length && b <= t.active && t.active !== 0 && (t.active -= 1);
    }, r = (m) => {
      t.active = m, t.force();
    }, l = async () => {
      const m = JSON.parse(JSON.stringify(t.contentCtrlData)).length;
      await t.handleAdd(), m < t.contentCtrlData.length && (t.active = t.contentCtrlData.length - 1);
    }, v = () => {
      const m = s.modelData.source.userTag;
      let b = {};
      m && (b = JSON.parse(m));
      const {
        tabtitle: c,
        addtitle: y,
        usermode: f
      } = b;
      return f === "user1" && t.contentCtrlData.some((p) => p.rcrylx === "system") ? o("div", {
        class: a.e("header")
      }, [t.contentCtrlData.map((p, h) => {
        let g = "";
        p.srfmajortext ? g = p.srfmajortext : c && p[c] && (g = p[c]);
        let N = "待确认";
        return p.is_rc === 1 ? N = "确认入场" : p.is_rc === 0 && (N = "放弃入场"), o("div", {
          class: [a.e("header-item"), a.is("actived", h === t.active)],
          on: {
            click: () => r(h)
          }
        }, [o("div", {
          class: a.em("header-item", "title")
        }, [g, "（", N, "）"])]);
      })]) : o("div", {
        class: a.e("header")
      }, [t.contentCtrlData.map((D, p) => {
        let h = `新建${p + 1}`;
        return D.srfmajortext ? h = D.srfmajortext : c && D[c] ? h = D[c] : y && (h = `${y}${p + 1}`), o("div", {
          class: [a.e("header-item"), a.is("actived", p === t.active)],
          on: {
            click: () => r(p)
          }
        }, [o("div", {
          class: a.em("header-item", "title")
        }, [h]), t.enableDelete && o("div", {
          class: a.em("header-item", "delete"),
          attrs: {
            title: "移除"
          },
          on: {
            click: (g) => i(D, p, g)
          }
        }, [o("i", {
          class: "fa fa-close"
        })])]);
      }), t.enableCreate && o("div", {
        class: [a.e("header-item"), a.e("add")],
        attrs: {
          title: "添加"
        },
        on: {
          click: () => l()
        }
      }, [o("span", ["添加"]), o("i", {
        class: "fa fa-plus"
      })])]);
    };
    return T(() => t.form.isLoaded, (m, b) => {
      m !== b && m === !0 && t.loadData();
    }), {
      ns: a,
      rendertanHeader: v,
      renderTabs: () => t.contentCtrlData.map((m, b) => {
        var f;
        let c = null;
        const {
          form: y
        } = t.model;
        if (y && t.providers[y.name] && t.model.appEntity) {
          const D = Object.assign(t.form.context.clone(), {
            [(f = t.model.appEntity.codeName) == null ? void 0 : f.toLowerCase()]: m[t.model.appEntity.keyName]
          });
          c = o(t.providers[y.name].component, {
            props: {
              modelData: y,
              context: D,
              params: t.form.params,
              enableAutoSave: !0,
              silentVerify: !0
            },
            on: {
              neuronInit: t.onNeuronInit(m.srfkey)
            }
          });
        }
        return o("div", {
          class: [a.e("content"), a.is("actived", b === t.active)],
          key: m.srfkey
        }, [c]);
      })
    };
  },
  render() {
    return o("div", {
      class: this.ns.b()
    }, [this.rendertanHeader(), this.renderTabs()]);
  }
}), Ye = M({
  name: "AutoSelectAll",
  props: se(),
  emits: G(),
  setup(s, {
    emit: a
  }) {
    const t = R("mpicker"), e = s.controller, i = E([]), r = E([]), l = E([]), v = E(!1), d = E(!1), m = E(null), b = E([]), c = E(!0), y = _(() => {
      const w = e.editorParams.followitem;
      return w ? s.data[w] : "";
    });
    T(() => s.value, (w) => {
      i.value = [], l.value = [], w && (l.value = JSON.parse(w), l.value.length > 0 && l.value.forEach((P) => {
        r.value.findIndex((O) => Object.is(O.srfkey, P.srfkey)) < 0 && (r.value.push(P), b.value.push(P.srfmajortext)), i.value.push(P.srfkey);
      }));
    }, {
      immediate: !0,
      deep: !0
    });
    const f = async (w) => {
      const P = [];
      if (w && Array.isArray(w))
        for (let O = 0; O < w.length; O++) {
          const n = w[O], u = {
            srfkey: n[e.keyName] || n.srfkey,
            srfmajortext: n[e.textName] || n.srfmajortext
          }, I = await e.calcFillDataItems(n);
          I.length > 0 && I.forEach((S) => {
            Object.assign(u, {
              [S.name]: S.value
            });
          }), P.push(u), r.value.findIndex((S) => Object.is(S[e.keyName], n[e.keyName])) < 0 && r.value.push(u);
        }
      const x = P.length > 0 ? JSON.stringify(P) : "";
      a("change", x);
    }, D = async () => {
      let w;
      l.value.length && (w = JSON.stringify(l.value));
      const P = await e.openPickUpView(s.data, w);
      P && f(P);
    }, p = (w) => {
      const P = [];
      if (w.length > 0) {
        w.forEach((O) => {
          let n = r.value.findIndex((I) => Object.is(I.srfkey, O)), u = null;
          n >= 0 ? u = r.value[n] : (n = l.value.findIndex((I) => Object.is(I.srfkey, O)), n >= 0 && (u = l.value[n])), u && P.push(u);
        });
        const x = P.length > 0 ? JSON.stringify(P) : "";
        a("change", x);
      } else
        a("change", "");
    }, h = async (w) => {
      if (e.model.appDataEntity) {
        d.value = !0;
        try {
          const P = await e.getServiceData(w, s.data);
          d.value = !1, r.value = [], P.data.length > 0 && (r.value = P.data.map((x) => ({
            srfkey: x[e.keyName],
            srfmajortext: x[e.textName]
          })));
        } catch (P) {
          d.value = !1;
        }
      }
    }, g = (w) => {
      v.value = w, a("operate", w), v.value && h("");
    }, N = _(() => l.value.map((w) => w.srfmajortext).join("、")), A = (w) => {
      r.value = w;
    };
    return T(() => y.value, async (w) => {
      if (w) {
        await h("");
        const P = r.value.map((x) => x.srfkey);
        if (c.value && (c.value = !1, s.value))
          return;
        p(P);
      } else
        r.value = [], a("change", "");
    }, {
      immediate: !0
    }), {
      ns: t,
      c: e,
      selectRef: m,
      curValue: i,
      loading: d,
      items: r,
      defaultLabel: b,
      valueText: N,
      onSearch: h,
      onOpenChange: g,
      onSelect: p,
      openPickUpView: D,
      setDefaultOptions: A
    };
  },
  render(s) {
    return s("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [this.readonly && this.valueText, !this.readonly && s("iSelect", {
      ref: "selectRef",
      props: {
        ...this.c.customProps,
        value: this.curValue,
        filterable: !0,
        transfer: !0,
        multiple: !0,
        defaultLabel: this.defaultLabel,
        loading: this.loading,
        placeholder: this.c.placeHolder,
        disabled: this.disabled,
        remoteMethod: this.onSearch
      },
      on: {
        "on-change": this.onSelect,
        "on-open-change": this.onOpenChange
      }
    }, [this.items.map((a) => s("i-option", {
      key: a.srfkey,
      attrs: {
        value: a.srfkey,
        label: a.srfmajortext
      }
    }, [a.srfmajortext]))]), !this.readonly && s("div", {
      class: this.ns.e("buns-position")
    }, [s("div", {
      class: this.ns.e("btns")
    }, [this.c.pickupView ? s("i-button", {
      attrs: {
        icon: "ios-search",
        type: "text"
      },
      on: {
        click: this.openPickUpView
      }
    }) : null])])]);
  }
});
const $e = M({
  name: "MPickerCheckbox",
  props: se(),
  emits: G(),
  setup(s, {
    emit: a
  }) {
    const t = R("checkbox"), e = s.controller, i = E([]), r = E([]), l = E(!0), v = ",", d = e.editorParams.emptyClearItems, m = _({
      get() {
        var h;
        return ((h = s.value) == null ? void 0 : h.split(",")) || [];
      },
      set(h) {
        let g = null;
        const N = [];
        if (i.value.length > 0 && (i.value.forEach((A) => {
          h.findIndex((P) => Object.is(A.value, P)) !== -1 && N.push(A.value);
        }), g = N.join(v)), a("change", g), !g && d) {
          const A = JSON.parse(d);
          for (let w = 0; w < A.length; w++)
            a("change", A[w].value, A[w].key);
        }
      }
    }), b = async (h) => {
      const {
        context: g,
        params: N
      } = e.handlePublicParams(h, e.context, e.params);
      if (e.editorParams.codeTag) {
        let A = [];
        const w = e.editorParams.codeTag;
        return A = await ibiz.codeListService.get(w, g, N), A;
      }
      throw new he(e.model.source, "请配置代码表");
    }, c = (h) => {
      m.value = h;
    }, y = _(() => {
      const h = Array.isArray(m.value) ? m.value : [m.value];
      return i.value.filter((g) => h.includes(g.srfkey)).map((g) => g.srfmajortext).join("、");
    }), f = async (h) => {
      if (e.model.appDataEntity)
        try {
          const g = await e.getServiceData(h, s.data);
          r.value = [], g.data.length > 0 && (r.value = g.data.map((N) => ({
            srfkey: N[e.keyName],
            srfmajortext: N[e.textName]
          })));
        } catch (g) {
          console.error(g);
        }
    }, D = _(() => {
      const h = e.editorParams.followitem;
      return h ? s.data[h] : "";
    }), p = () => {
      const h = [];
      i.value.forEach((g) => {
        r.value.findIndex((A) => A.srfkey === g.value) > -1 && h.push(g.value);
      }), c(h);
    };
    return T(() => D.value, async (h, g) => {
      await b({}).then((N) => {
        i.value = N;
      }), await f(""), !((l.value || h === g) && (l.value = !1, s.value)) && p();
    }, {
      immediate: !0,
      deep: !0
    }), {
      ns: t,
      c: e,
      valueText: y,
      selectArray: m,
      items: i,
      onSearch: f,
      onSelectArrayChange: c
    };
  },
  render(s) {
    return s("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [this.readonly && this.valueText, !this.readonly && s("ICheckboxGroup", {
      props: {
        ...this.c.customProps,
        value: this.selectArray
      },
      on: {
        "on-change": this.onSelectArrayChange
      }
    }, [this.items.map((a, t) => s("i-checkbox", {
      key: t,
      attrs: {
        label: a.value,
        disabled: this.disabled
      }
    }, [s("span", {
      class: this.ns.e("text")
    }, [a.text])]))])]);
  }
});
class Ge extends Se {
  /**
   * 设置嵌入视图的神经元
   *
   * @author lxm
   * @date 2022-09-15 10:09:22
   * @param {ViewNeuron} neuron
   */
  setViewNeuron(a) {
    this.neuron = a, this.neuron.evt.on("refreshed", (t) => {
      if (ibiz.log.debug("接收到关系界面的刷新变更事件", t), this.model.formItemUpdate) {
        const { methodName: e, itemNames: i, model: r } = this.model.formItemUpdate;
        this.form.updateFormItem(
          e,
          i,
          r
        );
      }
    }), this.neuron.evt.on("mounted", () => {
      this.neuron.call.refresh();
    }), this.neuron.evt.on("viewDataChange", async (t) => {
      if (!["LOAD", "LOADDRAFT"].includes(t.type) && (ibiz.log.debug("接收到关系界面的数据变更事件", t.data), this.model.formItemUpdate)) {
        const { methodName: e, itemNames: i, model: r } = this.model.formItemUpdate;
        try {
          this.processState.formItemUpdate = !0, await this.form.updateFormItem(
            e,
            i,
            r
          );
        } finally {
          this.processState.formItemUpdate = !1;
        }
      }
    }), this.neuron.evt.on("destroyed", () => {
      Object.keys(this.processState).forEach((t) => {
        this.processState[t] = !1;
      });
    }), this.neuron.evt.on("viewSaveStart", () => {
      this.processState.viewSave = !0;
    }), this.neuron.evt.on("viewSaveEnd", () => {
      this.processState.viewSave = !1;
    });
  }
}
class He extends ke {
  constructor() {
    super(...arguments);
    /**
     * 自定义行为
     *
     * @type {string}
     * @memberof WfEditViewController
     */
    C(this, "userAction");
  }
  async onInit() {
    await super.onInit(), this.getUserAction();
  }
  /**
   * 工作流启动
   *
   * @author lxm
   * @date 2022-09-29 20:09:27
   * @returns {*}  {Promise<void>}
   */
  async wfStart() {
    var m;
    await this.save(), await this.execUserAction();
    const t = await this.entityService.wf.getWFVersion();
    if (t.data.length === 0)
      throw new Ue("当前工作流版本不存在");
    const e = t.data[0], i = `WFSTART@${e.wfversion}`, r = Object.assign(this.context.clone(), {
      activeForm: e["process-form"]
    }), l = {
      processDefinitionKey: e.definitionkey
    }, v = (m = this.model.source.findPSAppViewRef(i)) == null ? void 0 : m.getRefPSAppView();
    if (!v) {
      await this.nerve.form.call.wfStart(l), await this.closeView();
      return;
    }
    (await ibiz.commands.execute(
      q.TAG,
      v,
      r,
      l
    )).ok && await this.closeView();
  }
  /**
   * 获取自定义行为
   *
   * @memberof EditViewController
   */
  getUserAction() {
    const { form: t } = this.model, e = t.source.getPSControlHandler();
    if (e) {
      const i = e.findPSControlHandlerAction("user");
      i && i.getPSAppDEMethod() && (this.userAction = i.getPSAppDEMethod().codeName);
    }
  }
  /**
   * 执行自定义行为
   *
   * @memberof EditViewController
   */
  async execUserAction() {
    if (this.userAction) {
      const t = this.getData();
      await this.entityService.exec(this.userAction, this.context, t[0]);
    }
  }
}
function We(s, a) {
  return be(
    s,
    (t, e) => new He(a, t, e)
  );
}
const qe = M({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    noLoadDefault: {
      type: Boolean,
      required: !1
    }
  },
  setup(s) {
    const {
      proxy: a
    } = W();
    return {
      c: We(a, s.modelPath)
    };
  },
  render(s) {
    let a = null;
    if (this.c.complete) {
      const {
        form: t
      } = this.c.model;
      this.c.providers[t.name] && (a = s(this.c.providers[t.name].component, {
        props: {
          modelData: t,
          context: this.c.context,
          params: this.c.params
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(t.name)
        }
      }));
    }
    return s("view-base", {
      attrs: {
        controller: this.c
      }
    }, [a]);
  }
});
const Ke = M({
  name: "DynamicLimitNumberInput",
  props: De(),
  emits: G(),
  setup(s, {
    emit: a
  }) {
    const t = R("input-number"), e = s.controller, i = E(-1 / 0), r = E(1 / 0), l = E(""), v = E(), d = E(!1);
    T(() => s.value, (p, h) => {
      if (p !== h) {
        const g = Ie(p) ? null : Number(p);
        l.value = Number.isNaN(g) ? null : g;
      }
    }, {
      immediate: !0
    });
    let m = !1;
    if (e.editorParams && e.editorParams.hiddenupdownbutton)
      try {
        m = JSON.parse(e.editorParams.hiddenupdownbutton);
      } catch (p) {
        m = !1;
      }
    const b = (p) => {
      a("change", p);
    };
    s.autoFocus && T(v, (p) => {
      p && p.$el.getElementsByTagName("input")[0].focus();
    }), T(() => s.data, () => {
      s.data && (e.maxValue && (r.value = Number(s.data[e.maxValue])), e.minValue && (i.value = Number(s.data[e.minValue])));
    }, {
      immediate: !0,
      deep: !0
    });
    const c = _(() => e.model.precision === -1 || d.value ? void 0 : e.model.precision), y = () => {
      d.value = !1;
    }, f = () => {
      d.value = !0;
    }, D = _(() => e.model.precision && e.model.precision !== -1 ? l.value && Number(l.value).toFixed(e.model.precision) : l.value);
    return {
      ns: t,
      c: e,
      currentVal: l,
      handleChange: b,
      inputRef: v,
      hiddenupdownbutton: m,
      minValue: i,
      maxValue: r,
      handleBluer: y,
      handleFocus: f,
      precision: c,
      readOnlyText: D
    };
  },
  render(s) {
    return s("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : "", this.hiddenupdownbutton ? this.ns.m("hiddenupdownbutton") : "", this.controller.model.unitName ? this.ns.m("showUnitName") : ""]
    }, [[this.readonly && this.readOnlyText, !this.readonly && s("IInputNumber", {
      ref: "inputRef",
      props: {
        min: this.minValue,
        max: this.maxValue,
        ...this.c.customProps,
        value: this.currentVal,
        placeholder: this.controller.placeHolder,
        precision: this.precision,
        disabled: this.disabled
      },
      on: {
        "on-change": this.handleChange,
        "on-blur": this.handleBluer,
        "on-focus": this.handleFocus
      }
    }), this.controller.model.unitName && s("i", {
      class: this.ns.e("unit"),
      slot: "suffix"
    }, [this.controller.model.unitName])]]);
  }
});
class Je extends Oe {
  constructor() {
    super(...arguments);
    /**
     * 最大值字段
     *
     * @type {string}
     * @memberof DynamicLimitNumberInputController
     */
    C(this, "maxValue", "");
    /**
     * 最小值字段
     *
     * @type {string}
     * @memberof DynamicLimitNumberInputController
     */
    C(this, "minValue", "");
  }
  async onInit() {
    var t, e;
    await super.onInit(), (t = this.editorParams) != null && t.maxvalueproperty && (this.maxValue = this.editorParams.maxvalueproperty), (e = this.editorParams) != null && e.minvalueproperty && (this.minValue = this.editorParams.minvalueproperty);
  }
}
const Xe = M({
  name: "DynamicLimitGridInputNumber",
  props: we(),
  emits: Ce(),
  setup(s, {
    emit: a
  }) {
    const t = R("grid-input-number"), {
      isInfoMode: e,
      autoFocus: i,
      componentRef: r,
      onOperateChange: l,
      onChange: v
    } = Ee(s, {
      emit: a
    });
    return {
      ns: t,
      isInfoMode: e,
      autoFocus: i,
      componentRef: r,
      onOperateChange: l,
      onChange: v
    };
  },
  render(s) {
    return s("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: `${this.ns.b()}`
    }, [s("DynamicLimitNumberInput", {
      props: {
        ...this.$props,
        readonly: this.isInfoMode,
        disabled: this.disabled,
        autoFocus: this.autoFocus
      },
      on: {
        change: this.onChange,
        operate: this.onOperateChange
      }
    })]);
  }
});
class Ze {
  constructor() {
    C(this, "component", "IBizFormDataComparison");
  }
}
class Qe extends Ae {
  async execAction(a, t, e, i) {
    const r = {}, l = a.getPSAppDataEntity();
    if (l) {
      l.isFill === !1 && await l.fill(!0);
      const v = new H(l);
      await v.init();
      const { resultContext: d } = await this.handleParams(
        a,
        t,
        e,
        i
      ), m = ibiz.resourcePathUtil.calcPaths(
        d,
        v.codeName
      ), b = K(d, m);
      let c = `${b}/${v.deNamePlural}/importtemplate`, y = `${b}/${v.deNamePlural}/importdata2`;
      const f = a.getPSAppDEDataImport();
      f && (c += `?srfimporttag=${f.codeName}`, y += `?srfimporttag=${f.codeName}`);
      const D = ibiz.overlay.createModal(
        "CustomDataImport",
        {
          templateUrl: c,
          importUrl: y,
          dismiss: (p) => {
            D.dismiss(p);
          }
        },
        {
          width: "auto",
          placement: "center"
        }
      );
      return D.present(), await D.onWillDismiss(), {
        refresh: !0
      };
    }
    return r;
  }
}
class et {
  constructor() {
    C(this, "handler");
  }
  async getHandler() {
    return this.handler || (this.handler = new Qe()), this.handler;
  }
}
class tt {
  constructor() {
    C(this, "gridEditor", "YearMonthPicker");
    C(this, "formEditor", "YearMonthPicker");
  }
  async createController(a, t) {
    const e = new Te(a, t);
    return await e.init(), e;
  }
}
class at {
  constructor() {
    C(this, "formEditor", "DownLoadSafeFile");
    C(this, "gridEditor", "DownLoadSafeFile");
  }
  async createController(a, t) {
    const e = new Me(a, t);
    return await e.init(), e;
  }
}
class st extends re {
  async execAction(a, t, e, i, r) {
    const l = {}, { frontProcessType: v } = a;
    if (v === "OPENHTMLPAGE") {
      const d = ne.fill(a.htmlPageUrl, t, e == null ? void 0 : e[0]);
      window.open(d, "_blank");
    }
    if (v === "DATAIMP") {
      const d = a.getPSAppDataEntity();
      if (d) {
        d.isFill === !1 && await d.fill(!0);
        const m = new H(d);
        await m.init();
        const { resultContext: b } = await this.handleParams(
          a,
          t,
          e,
          i
        ), c = ibiz.resourcePathUtil.calcPaths(
          b,
          m.codeName
        ), y = K(b, c);
        let f = `${y}/${m.deNamePlural}/importtemplate`, D = `${y}/${m.deNamePlural}/importdata2`;
        const p = a.getPSAppDEDataImport();
        p && (f += `?srfimporttag=${p.codeName}`, D += `?srfimporttag=${p.codeName}`);
        const h = ibiz.overlay.createModal(
          "DataImport",
          {
            templateUrl: f,
            importUrl: D,
            dismiss: (g) => {
              h.dismiss(g);
            }
          },
          {
            width: "auto",
            placement: "center"
          }
        );
        return h.present(), await h.onWillDismiss(), {
          refresh: !0
        };
      }
    }
    if (["TOP", "WIZARD"].includes(v)) {
      const d = a.getFrontPSAppView();
      if (!d)
        throw new Error("未配置打开视图");
      await d.fill(!0);
      const { resultContext: m, resultParams: b } = await this.handleParams(
        a,
        t,
        e,
        i
      ), c = await ibiz.commands.execute(
        q.TAG,
        d,
        m,
        b,
        r
      );
      (c == null ? void 0 : c.ok) === !1 && (l.closeView = !1, l.refresh = !1, l.cancel = !0), c != null && c.ok && c.data && (l.data = c.data);
    } else if (r) {
      const { neuron: d } = r, b = d.call.getFormController().call.getFormController(), { druipart1: c, druipart2: y, druipart3: f } = b.details;
      [
        {
          message: "服务履历为空",
          neuron: c
        },
        {
          message: "教育经验为空",
          neuron: y
        },
        {
          message: "项目经验为空",
          neuron: f
        }
      ].some((h) => {
        const g = h.neuron.neuron.call.getGridController();
        if (g) {
          const N = g.call.getGridController();
          if (N && N.items && N.items.length > 0)
            return !1;
        }
        return ibiz.message.error(`${h.message}`, 1.5, !0), !0;
      }) || await d.call.wfStart();
    }
    return l;
  }
}
class rt {
  constructor() {
    C(this, "handler");
  }
  async getHandler() {
    return this.handler || (this.handler = new st()), this.handler;
  }
}
class ot {
  constructor() {
    C(this, "component", "FormMDCtrlFormStyle2");
  }
  async createController(a, t, e) {
    const i = new le(a, t, e);
    return await i.init(), i;
  }
}
class nt {
  constructor() {
    C(this, "formEditor", "AutoSelectAll");
    C(this, "gridEditor", "AutoSelectAll");
  }
  async createController(a, t) {
    const e = new oe(a, t);
    return await e.init(), e;
  }
}
class it {
  constructor() {
    C(this, "formEditor", "MPickerCheckbox");
    C(this, "gridEditor", "IBizGridPicker");
  }
  async createController(a, t) {
    const e = new oe(a, t);
    return await e.init(), e;
  }
}
class lt extends re {
  async execAction(a, t, e, i, r) {
    const l = {}, { frontProcessType: v } = a;
    if (v === "OPENHTMLPAGE") {
      const d = ne.fill(a.htmlPageUrl, t, e == null ? void 0 : e[0]);
      window.open(d, "_blank");
    }
    if (v === "DATAIMP") {
      const d = a.getPSAppDataEntity();
      if (d) {
        d.isFill === !1 && await d.fill(!0);
        const m = new H(d);
        await m.init();
        const { resultContext: b } = await this.handleParams(
          a,
          t,
          e,
          i
        ), c = ibiz.resourcePathUtil.calcPaths(
          b,
          m.codeName
        ), y = K(b, c);
        let f = `${y}/${m.deNamePlural}/importtemplate`, D = `${y}/${m.deNamePlural}/importdata2`;
        const p = a.getPSAppDEDataImport();
        p && (f += `?srfimporttag=${p.codeName}`, D += `?srfimporttag=${p.codeName}`);
        const h = ibiz.overlay.createModal(
          "DataImport",
          {
            templateUrl: f,
            importUrl: D,
            dismiss: (g) => {
              h.dismiss(g);
            }
          },
          {
            width: "auto",
            placement: "center"
          }
        );
        return h.present(), await h.onWillDismiss(), {
          refresh: !0
        };
      }
    }
    if (["TOP", "WIZARD"].includes(v)) {
      const d = a.getFrontPSAppView();
      if (!d)
        throw new Error("未配置打开视图");
      await d.fill(!0);
      const { resultContext: m, resultParams: b } = await this.handleParams(
        a,
        t,
        e,
        i
      ), c = await ibiz.commands.execute(
        q.TAG,
        d,
        m,
        b,
        r
      );
      (c == null ? void 0 : c.ok) === !1 && (l.closeView = !1, l.refresh = !1, l.cancel = !0), c != null && c.ok && c.data && (l.data = c.data);
    } else if (e && e.length > 0 && r) {
      const { neuron: d } = r, c = await d.call.getFormController().call.getFormController().autoSave();
      c && c.rcryqd && Array.isArray(c.rcryqd) && c.rcryqd.length > 0 ? await d.call.wfStart() : ibiz.message.error("入场信息为空");
    }
    return l;
  }
}
class ct {
  constructor() {
    C(this, "handler");
  }
  async getHandler() {
    return this.handler || (this.handler = new lt()), this.handler;
  }
}
class dt {
  constructor() {
    C(this, "component", "FormDruipart");
  }
  async createController(a, t, e) {
    const i = new Ge(a, t, e);
    return await i.init(), i;
  }
}
class ut {
  constructor() {
    C(this, "component", "WfEditView");
  }
}
class mt {
  constructor(a) {
    C(this, "formEditor", "IBizInput");
    C(this, "gridEditor", "DynamicLimitGridInputNumber");
    a === "NUMBER" && (this.formEditor = "IBizInputNumber", this.gridEditor = "DynamicLimitGridInputNumber");
  }
  async createController(a, t) {
    const e = new Je(
      a,
      t
    );
    return await e.init(), e;
  }
}
const Et = {
  mateUrl: import.meta.url,
  install(s) {
    ie.loadStyle(["/style.css"]), s.component("IBizFormDataComparison", Ve), s.component("CustomDataImport", Be), s.component("YearMonthPicker", _e), s.component("DownLoadSafeFile", je), s.component("FormMDCtrlFormStyle2", ze), s.component("AutoSelectAll", Ye), s.component("MPickerCheckbox", $e), s.component("WfEditView", qe), s.component("DynamicLimitNumberInput", Ke), s.component("DynamicLimitGridInputNumber", Xe), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_DYNAMIC_LIMIT_NUMBER_INPUT",
      new mt()
    ), ibiz.register.control.register(
      "EDITFORM_RENDER_FORM_DATA_COMPARISON",
      new Ze()
    ), ibiz.register.uiAction.register(
      "DEUIACTION_CUSTOM_IMPORT",
      new et()
    ), ibiz.register.editor.register(
      "DATEPICKEREX_NOTIME_YEAR_MONTH_PICKER",
      new tt()
    ), ibiz.register.editor.register(
      "FILEUPLOADER_ONE_DOWNLOAD_FILE",
      new at()
    ), ibiz.register.uiAction.register(
      "DEUIACTION_JUDEG_ENABLE_UPDATE",
      new rt()
    ), ibiz.register.formDetail.register(
      "FORM_USERCONTROL_MUL_FORM_CARD",
      new ot()
    ), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_AUTO_SELECT_ALL",
      new nt()
    ), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_MULTIPLE_CHECKBOX",
      new it()
    ), ibiz.register.uiAction.register(
      "DEUIACTION_check_rcxx",
      new ct()
    ), ibiz.register.formDetail.register(
      "FORM_USERCONTROL_DRUIPART_ENABLEINITLOAD",
      new dt()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_CUSTOM_WF",
      new ut()
    );
  }
};
export {
  Et as default
};
