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