var ce = Object.defineProperty;
var de = (e, t, s) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var U = (e, t, s) => (de(e, typeof t != "symbol" ? t + "" : t, s), s);
import { IndexViewModel as ue, GridModel as he, ViewType as me, ModelUtil as pe } from "@ibiz-template/model";
import { GridFieldColumnController as Z, GridRowController as X, WFStepTraceViewController as fe, UploadEditorController as J, GridController as ge, GridNotifyState as we, WFDynaEditView3Controller as ve } from "@ibiz-template/controller";
import { defineComponent as L, computed as D, h as c, getCurrentInstance as A, ref as g, watch as P, toRefs as $, onUnmounted as be } from "vue";
import { useNamespace as E, useViewController as Q, usePropsWatch as B, getUploadProps as ye, getEditorEmits as K, getGridUploadProps as z, getGridEditorEmits as _, useClickOutside as Ce, useEventListener as xe, getInputProps as ke, getGridInputProps as Fe, useGridCellEditor as Se, useControlController as Le, useWFStepTraceViewController as Ee, useEditView3Controller as Ue } from "@ibiz-template/vue-util";
import { colorBlend as Pe, HttpError as Y, isImage as Ne, uploadFile as Ie, RuntimeError as Te } from "@ibiz-template/core";
import { getCookie as De, createUUID as W } from "qx-util";
import { debounce as Me } from "lodash-es";
import { ViewMode as ee, UIActionHandler as te, PluginStaticResource as Re } from "@ibiz-template/runtime";
const Ae = L({
  name: "CodeListGridColumn",
  props: {
    controller: {
      type: Z,
      required: !0
    },
    row: {
      type: X,
      required: !0
    }
  },
  setup(e) {
    const t = E("grid-field-column"), s = D(() => {
      var r;
      if (e.controller.model.source.cLConvertMode !== "FRONT")
        return [];
      const n = e.row.data[e.controller.model.codeName];
      return (r = e.controller.codeListItems) != null && r.length && n ? n.split(",").map((m) => {
        const p = e.controller.codeListItems.find((f) => f.value === m);
        if (p) {
          const f = p.color || "#515a6e";
          return {
            text: p.text,
            colorStyle: t.cssVarBlock({
              color: f,
              "border-color": f,
              "bg-color": Pe(f, "#fff")
            })
          };
        }
      }).filter(Boolean) : [];
    }), o = (n) => {
      e.controller.isLinkColumn && e.controller.openLinkView(e.row, n);
    }, i = D(() => {
      let n = "";
      switch (e.controller.model.align) {
        case "LEFT":
          n = "flex-start";
          break;
        case "RIGHT":
          n = "flex-end";
          break;
        default:
          n = "center";
          break;
      }
      return t.cssVarBlock({
        "justify-content": n
      });
    });
    return {
      ns: t,
      alignStyle: i,
      selectedItems: s,
      onCellClick: o
    };
  },
  render() {
    const e = this.controller, t = this.row.data[e.model.codeName];
    return c("div", {
      class: [this.ns.b(), e.isLinkColumn && this.ns.m("link-column")],
      style: this.alignStyle,
      on: {
        click: this.onCellClick
      }
    }, [this.selectedItems.length > 0 ? this.selectedItems.map((s) => c("span", {
      class: this.ns.e("code-list-item"),
      style: s.colorStyle
    }, [s.text])) : c("span", {
      class: this.ns.e("text")
    }, [t])]);
  }
});
class Ge extends fe {
  constructor() {
    super(...arguments);
    /**
     * 流程图url
     *
     * @type {string}
     * @memberof PresetWFChartViewController
     */
    U(this, "imgSrc");
  }
  async getUIData() {
    const s = Object.assign(this.context.clone(), this.params), o = await this.entityService.wf.getWFProcessDiagram(s), i = new Blob([o.data], {
      type: "image/svg+xml"
    });
    this.imgSrc = URL.createObjectURL(i);
  }
}
const Oe = L({
  name: "PresetWFChartView",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const t = E("preset-wf-chart-view"), {
      proxy: s
    } = A(), o = Q(s, (i, n) => new Ge(e.modelPath, i, n));
    return B(s, "deName", o.setDeName.bind(o)), {
      c: o,
      ns: t
    };
  },
  render() {
    return c("div", {
      class: this.ns.b()
    }, [c("img", {
      attrs: {
        src: this.c.imgSrc
      }
    })]);
  }
});
const $e = L({
  name: "WFToolbar",
  props: {
    wfLinks: {
      type: Array,
      required: !0
    }
  },
  setup(e, {
    emit: t
  }) {
    const s = E("wf-toolbar"), o = async (n, r) => {
      t("wf-link-click", n, r);
    };
    return {
      ns: s,
      handleClick: async (n, r) => {
        setTimeout(() => {
          o(n, r);
        }, 30);
      }
    };
  },
  render() {
    const e = this.wfLinks || [];
    return c("div", {
      class: `${this.ns.b()}`
    }, [e.length > 0 && e.map((t) => {
      const s = t.sequenceFlowName == "驳回" || t.sequenceFlowName == "取消", o = t.sequenceFlowName.startsWith("保存") || t.sequenceFlowName.startsWith("关闭") || t.sequenceFlowName.startsWith("保存并关闭");
      return c("div", {
        key: t.sequenceFlowId,
        class: [this.ns.e("item"), o ? this.ns.em("item", "plain") : "", s ? this.ns.em("item", "reject") : ""]
      }, [c("i-button", {
        attrs: {
          title: t.sequenceFlowName
        },
        on: {
          click: (i) => this.handleClick(t, i)
        }
      }, [t.sequenceFlowName || ""])]);
    })]);
  }
}), Be = typeof btoa == "function", j = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
const V = typeof TextEncoder == "function" ? new TextEncoder() : void 0, ze = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", R = Array.prototype.slice.call(ze);
((e) => {
  let t = {};
  return e.forEach((s, o) => t[s] = o), t;
})(R);
const T = String.fromCharCode.bind(String);
typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
const _e = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), je = (e) => {
  let t, s, o, i, n = "";
  const r = e.length % 3;
  for (let a = 0; a < e.length; ) {
    if ((s = e.charCodeAt(a++)) > 255 || (o = e.charCodeAt(a++)) > 255 || (i = e.charCodeAt(a++)) > 255)
      throw new TypeError("invalid character found");
    t = s << 16 | o << 8 | i, n += R[t >> 18 & 63] + R[t >> 12 & 63] + R[t >> 6 & 63] + R[t & 63];
  }
  return r ? n.slice(0, r - 3) + "===".substring(r) : n;
}, se = Be ? (e) => btoa(e) : j ? (e) => Buffer.from(e, "binary").toString("base64") : je, We = j ? (e) => Buffer.from(e).toString("base64") : (e) => {
  let s = [];
  for (let o = 0, i = e.length; o < i; o += 4096)
    s.push(T.apply(null, e.subarray(o, o + 4096)));
  return se(s.join(""));
}, Ve = (e) => {
  if (e.length < 2) {
    var t = e.charCodeAt(0);
    return t < 128 ? e : t < 2048 ? T(192 | t >>> 6) + T(128 | t & 63) : T(224 | t >>> 12 & 15) + T(128 | t >>> 6 & 63) + T(128 | t & 63);
  } else {
    var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
    return T(240 | t >>> 18 & 7) + T(128 | t >>> 12 & 63) + T(128 | t >>> 6 & 63) + T(128 | t & 63);
  }
}, qe = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, He = (e) => e.replace(qe, Ve), q = j ? (e) => Buffer.from(e, "utf8").toString("base64") : V ? (e) => We(V.encode(e)) : (e) => se(He(e)), oe = (e, t = !1) => t ? _e(q(e)) : q(e);
function Ze(e, t, s) {
  var k;
  const o = g([]), i = g({
    Authorization: `Bearer ${De("access_token")}`
  }), n = g(""), r = g(""), a = {
    count: 0,
    cacheFiles: []
    // iview上传过程中不能改default-file-list,所以需要缓存
  }, d = (k = s.editorParams) == null ? void 0 : k.blackList;
  let m = [];
  d && typeof d == "string" && (m = d.split(",")), P(
    () => e.value,
    (l) => {
      o.value = l ? JSON.parse(l) : [];
    },
    { immediate: !0 }
  ), P(
    () => e.data,
    (l) => {
      if (l) {
        const h = s.calcBaseUrl(l);
        n.value = h.uploadUrl, r.value = h.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), P(
    o,
    (l) => {
      l != null && l.length && r.value && l.forEach((h) => {
        h.url = h.url || r.value.replace("%fileId%", h.id);
      });
    },
    { immediate: !0 }
  ), P(
    r,
    (l) => {
      l && o.value.length && o.value.forEach((h) => {
        h.url = r.value.replace("%fileId%", h.id);
      });
    },
    { immediate: !0 }
  );
  const p = () => {
    const l = [...o.value, ...a.cacheFiles], h = l.length > 0 ? JSON.stringify(l.map((b) => ({ name: b.name, id: b.id }))) : null;
    a.cacheFiles = [], t(h);
  }, f = (l) => {
    const h = l.name.trim().toLowerCase();
    if (m.some((C) => h.endsWith(`.${C}`)))
      return ibiz.message.error(`不可上传 ${m.join("、")}类型的文件！`), !1;
    a.count += 1;
  }, F = (l) => {
    l && (a.cacheFiles.push({
      name: l.filename,
      id: l.fileid
    }), a.count -= 1, a.count === 0 && p());
  }, y = (l, h) => {
    throw a.count -= 1, new Y({
      response: { data: h, status: l.status }
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
    });
  }, x = (l) => {
    if (e.disabled)
      return;
    const h = o.value.findIndex((b) => b.id === l.id);
    h !== -1 && o.value.splice(h, 1), p();
  }, w = (l) => {
    const b = (s.parent.form || s.parent.grid).model.appEntity.deName, C = `${l.id}|${b}|${e.data.srfkey}|${s.context.srfpersonid || s.context.srfuserid}`, M = l.url || r.value.replace("%fileId%", l.id);
    s.fileDownload({
      url: `${M}?key=${window.btoa(C)}${Math.floor(
        1e3 + Math.random() * 9e3
      )}`,
      name: l.name
    });
  }, u = g(!1), v = g(""), N = g("");
  return {
    uploadUrl: n,
    downloadUrl: r,
    headers: i,
    files: o,
    onDownload: w,
    onError: y,
    onRemove: x,
    onSuccess: F,
    beforeUpload: f,
    showModal: u,
    modalTitle: v,
    iframeUrl: N,
    onModalCancel: () => {
      u.value = !1, v.value = "", N.value = "";
    },
    previewFile: (l) => {
      u.value = !0, v.value = l.name;
      const h = window.Environment.previewFileUrl;
      if (h) {
        const b = encodeURIComponent(
          oe(
            `${window.location.origin}${l.url}?fullfilename=${l.name}`
          )
        );
        N.value = `${h}/onlinePreview?url=${b}`;
      }
    }
  };
}
const Xe = L({
  name: "SyFileUpload",
  props: ye(),
  emits: K(),
  setup(e, {
    emit: t
  }) {
    const s = E("sy-file-upload"), o = e.controller, {
      uploadUrl: i,
      headers: n,
      files: r,
      onDownload: a,
      onError: d,
      onRemove: m,
      onSuccess: p,
      beforeUpload: f,
      showModal: F,
      modalTitle: y,
      iframeUrl: x,
      onModalCancel: w,
      previewFile: u
    } = Ze(e, (I) => {
      t("change", I);
    }, o), v = D(() => o.editorParams.showPreview ? o.editorParams.showPreview === "true" : window.Environment.kkviewon);
    return {
      ns: s,
      c: o,
      uploadUrl: i,
      headers: n,
      files: r,
      onDownload: a,
      onError: d,
      onRemove: m,
      onSuccess: p,
      beforeUpload: f,
      showModal: F,
      modalTitle: y,
      iframeUrl: x,
      onModalCancel: w,
      onPreview: (I) => {
        v.value && u(I);
      },
      showPreview: v
    };
  },
  render(e) {
    return e("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [e("IUpload", {
      ref: "fileUpload",
      props: {
        action: this.uploadUrl,
        headers: this.headers,
        disabled: this.disabled,
        "default-file-list": this.files,
        multiple: this.c.model.multiple,
        type: this.c.model.isDrag ? "drag" : "select",
        accept: this.c.model.accept,
        "before-upload": this.beforeUpload,
        "on-success": this.onSuccess,
        "on-error": this.onError,
        "on-remove": this.onRemove,
        "on-preview": this.onDownload,
        "show-upload-list": !1
      }
    }, [this.c.model.isDrag ? e("div", {
      class: this.ns.bm("box", "drag")
    }, [e("i-icon", {
      attrs: {
        type: "md-cloud-upload"
      }
    }), e("div", {
      class: this.ns.be("box", "title")
    }, [e("span", ["将文件拖到此处，或"]), e("span", ["点击上传"])])]) : e("i-button", {
      class: this.ns.bm("box", "select")
    }, [e("svg", {
      attrs: {
        xmlns: "http://www.w3.org/2000/svg",
        viewBox: "0 0 1024 1024"
      }
    }, [e("path", {
      attrs: {
        fill: "currentColor",
        d: "M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z"
      }
    })]), e("span", ["上传文件"])]), this.c.uploadDescription && e("div", {
      class: this.ns.b("accept-description")
    }, [this.c.uploadDescription])]), e("div", {
      class: this.ns.b("file-list")
    }, [this.files.map((t) => e("div", {
      class: this.ns.b("file-item"),
      key: t.id
    }, [e("div", {
      class: this.ns.b("file-item-right")
    }, [e("div", {
      class: this.ns.b("file-item-right-icon")
    }, [e("svg", {
      attrs: {
        viewBox: "0 0 16 16",
        version: "1.1"
      }
    }, [e("g", {
      attrs: {
        id: "基础组件",
        stroke: "none",
        "stroke-width": "1",
        fill: "none",
        "fill-rule": "evenodd"
      }
    }, [e("g", {
      attrs: {
        id: "Upload上传",
        transform: "translate(-128.000000, -1899.000000)",
        "fill-rule": "nonzero"
      }
    }, [e("g", {
      attrs: {
        id: "关联",
        transform: "translate(128.000000, 1899.000000)"
      }
    }, [e("rect", {
      attrs: {
        id: "矩形备份-20",
        x: "0",
        y: "0",
        width: "16",
        height: "16"
      }
    }), e("path", {
      attrs: {
        d: "M8,6.25590375 C9.72432306,6.25590375 11.1277921,7.62964308 11.175675,9.34238963 L11.1769379,9.43284162 L11.1769379,12.7456325 C11.1769379,14.5002069 9.75457434,15.9225704 8,15.9225704 C6.27567694,15.9225704 4.8722079,14.5488311 4.824325,12.8360845 L4.82306213,12.7456325 L4.82306213,10.7559037 C4.82306213,10.4797614 5.04691975,10.2559037 5.32306213,10.2559037 C5.58296083,10.2559037 5.79654502,10.4541998 5.82077327,10.7077504 L5.82306213,10.7559037 L5.82306213,12.7456325 C5.82306213,13.9479221 6.79771041,14.9225704 8,14.9225704 C9.17615286,14.9225704 10.1344543,13.9898375 10.1755637,12.8237123 L10.1769379,12.7456325 L10.1769379,9.43284162 C10.1769379,8.23055203 9.20228959,7.25590375 8,7.25590375 C7.72385763,7.25590375 7.5,7.03204612 7.5,6.75590375 C7.5,6.47976137 7.72385763,6.25590375 8,6.25590375 Z M8,0.0774295852 C9.72432306,0.0774295852 11.1277921,1.45116892 11.175675,3.16391546 L11.1769379,3.25436746 L11.1769379,5.24409625 C11.1769379,5.52023863 10.9530802,5.74409625 10.6769379,5.74409625 C10.4170392,5.74409625 10.203455,5.54580022 10.1792267,5.29224959 L10.1769379,5.24409625 L10.1769379,3.25436746 C10.1769379,2.05207787 9.20228959,1.07742959 8,1.07742959 C6.82384714,1.07742959 5.86554572,2.01016247 5.82443628,3.17628769 L5.82306213,3.25436746 L5.82306213,6.56715838 C5.82306213,7.76944797 6.79771041,8.74409625 8,8.74409625 C8.27614237,8.74409625 8.5,8.96795388 8.5,9.24409625 C8.5,9.52023863 8.27614237,9.74409625 8,9.74409625 C6.27567694,9.74409625 4.8722079,8.37035692 4.824325,6.65761037 L4.82306213,6.56715838 L4.82306213,3.25436746 C4.82306213,1.49979312 6.24542566,0.0774295852 8,0.0774295852 Z",
        id: "形状结合",
        fill: "currentColor",
        transform: "translate(8.000000, 8.000000) rotate(-315.000000) translate(-8.000000, -8.000000) "
      }
    })])])])])]), e("div", {
      class: this.ns.b("file-item-right-title"),
      on: {
        click: () => this.onPreview(t)
      }
    }, [t.name]), e("div", {
      class: this.ns.b("file-item-right-action")
    }, [e("span", {
      class: this.ns.e("icon-download"),
      on: {
        click: () => this.onDownload(t)
      }
    }, [e("svg", {
      attrs: {
        width: "16px",
        height: "16px",
        viewBox: "0 0 16 16",
        version: "1.1",
        fill: "currentColor"
      }
    }, [e("g", {
      attrs: {
        id: "icon",
        stroke: "none",
        "stroke-width": "1",
        "fill-rule": "evenodd"
      }
    }, [e("g", {
      attrs: {
        id: "编组"
      }
    }, [e("path", {
      attrs: {
        d: "M7.33333333,8.77086667 L7.33333333,1.66666667 L8.66666667,1.66666667 L8.66666667,8.7716 L10.5526333,6.88563333 L11.4954333,7.82843333 L8.00036667,11.3235333 L4.50526667,7.82843333 L5.44806667,6.88563333 L7.33333333,8.77086667 Z M2,13 L2,14.3333333 L14,14.3333333 L14,13 L2,13 Z",
        id: "形状",
        fill: "currentColor",
        "fill-rule": "nonzero"
      }
    }), e("rect", {
      attrs: {
        id: "矩形",
        fill: "#000000",
        "fill-rule": "nonzero",
        opacity: "0",
        x: "0",
        y: "0",
        width: "16",
        height: "16"
      }
    })])])])]), this.showPreview ? e("span", {
      class: this.ns.e("icon-preview"),
      on: {
        click: () => this.onPreview(t)
      }
    }, [e("svg", {
      attrs: {
        width: "16px",
        height: "17px",
        viewBox: "0 0 16 17",
        version: "1.1",
        fill: "currentColor",
        xmlns: "http://www.w3.org/2000/svg"
      }
    }, [e("g", {
      attrs: {
        id: "icon",
        stroke: "none",
        "stroke-width": "1",
        fill: "none",
        "fill-rule": "evenodd"
      }
    }, [e("g", {
      attrs: {
        id: "eye",
        transform: "translate(-7.9982, -7.6008)",
        fill: "currentColor"
      }
    }, [e("g", {
      attrs: {
        transform: "translate(8, 8)",
        id: "编组"
      }
    }, [e("path", {
      attrs: {
        d: "M1.43340667,7.64873333 C3.27632667,4.67586667 5.45346667,3 8.00003333,3 C10.5466,3 12.7237333,4.67586667 14.5666667,7.64873333 L14.7844,8 L14.5666667,8.35126667 C12.7237333,11.3241333 10.5466,13 8.00003333,13 C5.45346667,13 3.27632667,11.3241333 1.43340667,8.35126667 L1.21565667,8 L1.43340667,7.64873333 Z M2.79026333,8 C4.4615,10.5552333 6.2084,11.6666667 8.00003333,11.6666667 C9.79166667,11.6666667 11.5385667,10.5552333 13.2098,8 C11.5385667,5.44476667 9.79166667,4.33333333 8.00003333,4.33333333 C6.2084,4.33333333 4.4615,5.44476667 2.79026333,8 Z M8.00003333,7 C7.44773333,7 7.00003333,7.4477 7.00003333,8 C7.00003333,8.5523 7.44773333,9 8.00003333,9 C8.5523,9 9.00003333,8.5523 9.00003333,8 C9.00003333,7.4477 8.5523,7 8.00003333,7 Z M5.6667,8 C5.6667,6.71133333 6.71136667,5.66666667 8.00003333,5.66666667 C9.2887,5.66666667 10.3333667,6.71133333 10.3333667,8 C10.3333667,9.28866667 9.2887,10.3333333 8.00003333,10.3333333 C6.71136667,10.3333333 5.6667,9.28866667 5.6667,8 Z",
        id: "形状",
        "fill-rule": "nonzero"
      }
    }), e("rect", {
      attrs: {
        id: "矩形",
        "fill-rule": "nonzero",
        opacity: "0",
        x: "0",
        y: "0",
        width: "16",
        height: "16"
      }
    })])])])])]) : null, this.disabled || this.readonly ? null : e("span", {
      class: this.ns.e("icon-remove"),
      on: {
        click: () => this.onRemove(t)
      }
    }, [e("svg", {
      attrs: {
        width: "16px",
        height: "16px",
        viewBox: "0 0 16 16",
        version: "1.1",
        fill: "currentColor"
      }
    }, [e("g", {
      attrs: {
        id: "基础组件",
        stroke: "none",
        "stroke-width": "1",
        fill: "none",
        "fill-rule": "evenodd"
      }
    }, [e("g", {
      attrs: {
        id: "Upload上传",
        transform: "translate(-544.000000, -930.000000)",
        "fill-rule": "nonzero"
      }
    }, [e("g", {
      attrs: {
        id: "删除",
        transform: "translate(544.000000, 930.000000)"
      }
    }, [e("rect", {
      attrs: {
        id: "矩形备份-12",
        x: "0",
        y: "0",
        width: "16",
        height: "16"
      }
    }), e("path", {
      attrs: {
        d: "M14.484375,2.84895833 C14.7609375,2.84895833 14.984375,3.07239583 14.984375,3.34895833 C14.984375,3.62552083 14.7609375,3.84895833 14.484375,3.84895833 L13,3.84895833 L13,14.1822917 C13,14.5504815 12.7015232,14.8489583 12.3333333,14.8489583 L3.66666667,14.8489583 C3.29847683,14.8489583 3,14.5504815 3,14.1822917 L3,3.84895833 L3,3.84895833 L1.5,3.84895833 C1.2234375,3.84895833 1,3.62552083 1,3.34895833 C1,3.07239583 1.2234375,2.84895833 1.5,2.84895833 L14.484375,2.84895833 Z M12,3.84895833 L4,3.84895833 L4,13.8489583 L12,13.8489583 L12,3.84895833 Z M6.5,5.84895833 C6.7765625,5.84895833 7,6.07239583 7,6.34895833 L7,11.3458333 C7,11.6223958 6.775,11.8458333 6.5,11.8458333 C6.2234375,11.8458333 6,11.6223958 6,11.3458333 L6,6.34895833 C6,6.07239583 6.2234375,5.84895833 6.5,5.84895833 Z M9.5,5.84895833 C9.7765625,5.84895833 10,6.07239583 10,6.34895833 L10,11.3458333 C10,11.6223958 9.775,11.8458333 9.5,11.8458333 C9.2234375,11.8458333 9,11.6223958 9,11.3458333 L9,6.34895833 C9,6.07239583 9.2234375,5.84895833 9.5,5.84895833 Z M10.5,0.847395833 C10.7765625,0.847395833 11,1.07083333 11,1.34739583 C11,1.62395833 10.7765625,1.84739583 10.5,1.84739583 L5.484375,1.84739583 C5.2078125,1.84739583 4.984375,1.62395833 4.984375,1.34739583 C4.984375,1.07083333 5.2078125,0.847395833 5.484375,0.847395833 L10.5,0.847395833 Z",
        id: "形状结合",
        fill: "currentColor"
      }
    })])])])])])])])]))]), e("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [e("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
});
function O(e, t) {
  if (e.url = t.replace("%fileId%", e.id), e.status || (e.status = "finished"), !e.fileName) {
    const s = e.name.lastIndexOf(".");
    e.fileName = e.name.substring(0, s), e.fileExt = e.name.substring(s), e.isImage = Ne(e.name);
  }
  return e;
}
function ie(e) {
  const t = g(""), s = g(""), o = g([]);
  return P(
    e.data,
    (i) => {
      if (i) {
        const n = e.controller.value.calcBaseUrl(i);
        t.value = n.uploadUrl, s.value = n.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), P(
    e.value,
    (i) => {
      o.value = i ? JSON.parse(i) : [], o.value.length && s.value && o.value.forEach((n) => {
        O(n, s.value);
      });
    },
    { immediate: !0 }
  ), P(
    s,
    (i) => {
      i && o.value.length && o.value.forEach((n) => {
        O(n, i);
      });
    },
    { immediate: !0 }
  ), {
    downloadUrl: s,
    uploadUrl: t,
    valueList: o
  };
}
function ne(e) {
  var S, k;
  const t = g("undo"), s = g([]), { downloadUrl: o, value: i, uploadUrl: n, controller: r } = e, a = (k = (S = r == null ? void 0 : r.value) == null ? void 0 : S.editorParams) == null ? void 0 : k.blackList;
  let d = [];
  a && typeof a == "string" && (d = a.split(",")), P(
    i,
    (l) => {
      l.length > 0 && (s.value = [], l.forEach((h) => {
        s.value.push(O(h, o.value));
      }));
    },
    {
      immediate: !0,
      deep: !0
    }
  );
  const m = (l, h) => {
    const b = [];
    return h.forEach((C, M) => {
      const G = C.name.trim().toLowerCase();
      if (d.some((le) => G.endsWith(`.${le}`))) {
        b.push(M);
        return;
      }
      s.value.push({
        name: C.name,
        status: C.status,
        percentage: C.percentage,
        id: C.uid,
        url: ""
      });
    }), b.length === h.length ? (ibiz.message.error(`不可上传 ${d.join("、")}类型的文件！`), !1) : (b.length && (b.forEach((C) => {
      l.splice(C, 1), h.splice(C, 1);
    }), ibiz.message.error(`不可上传 ${d.join("、")}类型的文件！`)), !0);
  }, p = (l) => {
    l.forEach((h) => {
      s.value.find((b) => b.id === h.uid ? (b.percentage = h.percentage, !0) : !1);
    });
  }, f = (l, h) => {
    l.forEach((b) => {
      s.value.find((C) => C.id === b.uid ? (C.status = b.status, C.id = h.data.fileid, C.name = h.data.filename, O(C, o.value), !0) : !1);
    });
  }, F = (l, h) => {
    var C;
    l.forEach((M) => {
      s.value.find((G) => G.id === M.uid ? (G.status = M.status, !0) : !1);
    });
    const b = new Y(h);
    ibiz.notification.error({
      title: (C = b.status) == null ? void 0 : C.toString(),
      desc: b.message,
      duration: 10
    });
  }, y = (l) => {
    s.value = s.value.filter((h) => h.status === "finished"), t.value = "done";
  }, x = () => {
    Ie({
      multiple: e.multiple,
      accept: e.accept,
      uploadUrl: n.value,
      beforeUpload: m,
      progress: p,
      success: f,
      error: F,
      finish: y
    });
  }, w = g(!1), u = g(""), v = g("");
  return {
    selectFile: x,
    fileList: s,
    uploadState: t,
    showModal: w,
    modalTitle: u,
    iframeUrl: v,
    onModalCancel: () => {
      w.value = !1, u.value = "", v.value = "";
    },
    previewFile: (l) => {
      w.value = !0, u.value = l.name;
      const h = window.Environment.previewFileUrl;
      if (h) {
        const b = encodeURIComponent(
          oe(
            `${window.location.origin}${l.url}?fullfilename=${l.name}`
          )
        );
        v.value = `${h}/onlinePreview?url=${b}`;
      }
    }
  };
}
const Je = L({
  name: "SyGridFileUpload",
  props: z(),
  setup(e) {
    const t = E("sy-grid-file-upload"), {
      value: s,
      data: o,
      controller: i
    } = $(e), {
      downloadUrl: n,
      uploadUrl: r,
      valueList: a
    } = ie({
      value: s,
      data: o,
      controller: i
    }), {
      fileList: d,
      showModal: m,
      modalTitle: p,
      iframeUrl: f,
      previewFile: F,
      onModalCancel: y
    } = ne({
      downloadUrl: n,
      uploadUrl: r,
      value: a,
      controller: i
    }), x = (u) => {
      const v = e.controller, I = v.parent.grid.model.appEntity.deName, S = `${u.id}|${I}|${o.value.srfkey}|${v.context.srfpersonid || v.context.srfuserid}`, k = u.url || n.value.replace("%fileId%", u.id);
      v.fileDownload({
        url: `${k}?key=${window.btoa(S)}${Math.floor(1e3 + Math.random() * 9e3)}`,
        name: u.name
      });
    }, w = D(() => e.controller.editorParams.showPreview ? e.controller.editorParams.showPreview === "true" : window.Environment.kkviewon);
    return {
      ns: t,
      fileList: d,
      showModal: m,
      modalTitle: p,
      iframeUrl: f,
      showPreview: w,
      downloadFile: x,
      previewFile: F,
      onModalCancel: y
    };
  },
  render() {
    return c("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.downloadFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [this.showPreview ? c("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(e)
      }
    }) : null])]))]), c("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [c("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
}), Qe = L({
  name: "SyGridFileUploadContainer",
  props: z(),
  emits: _(),
  render(e) {
    return this.disabled || this.readonly ? e("SyGridFileUpload", {
      props: {
        ...this.$props
      }
    }) : e("SyEditGridFileUpload", {
      props: {
        ...this.$props
      },
      on: {
        change: (t, s) => {
          this.$emit("change", t, s);
        },
        rowSave: () => {
          this.$emit("rowSave");
        }
      }
    });
  }
});
const Ke = L({
  name: "SyEditGridFileUploadPopover",
  props: {
    uploadUrl: {
      type: String,
      required: !0
    },
    downloadUrl: {
      type: String,
      required: !0
    },
    value: {
      type: Array,
      required: !0
    },
    controller: {
      type: J,
      required: !0
    },
    data: {
      type: Object,
      required: !0
    }
  },
  emits: {
    close: (e) => !0
  },
  setup(e, {
    emit: t
  }) {
    const s = E("sy-edit-grid-file-upload-popover"), {
      downloadUrl: o,
      value: i,
      uploadUrl: n,
      controller: r
    } = $(e), {
      fileList: a,
      uploadState: d,
      selectFile: m
    } = ne({
      downloadUrl: o,
      value: i,
      uploadUrl: n,
      controller: r
    }), p = g(), f = g(!1), F = Ce(p, async (w) => {
      t("close", {
        isModified: f.value,
        resultFiles: a.value
      });
    });
    return P(d, (w) => {
      w === "done" ? (f.value = !0, F.proceed()) : w === "loading" && F.pause();
    }), {
      ns: s,
      componentRef: p,
      fileList: a,
      deleteFile: (w) => {
        const u = a.value.findIndex((v) => v.id === w.id);
        a.value.splice(u, 1), f.value = !0;
      },
      selectFile: m,
      downloadFile: (w) => {
        const u = e.controller, N = u.parent.grid.model.appEntity.deName, I = `${w.id}|${N}|${e.data.srfkey}|${u.context.srfpersonid || u.context.srfuserid}`, S = w.url || o.value.replace("%fileId%", w.id);
        u.fileDownload({
          url: `${S}?key=${window.btoa(I)}${Math.floor(1e3 + Math.random() * 9e3)}`,
          name: w.name
        });
      }
    };
  },
  render() {
    return c("div", {
      ref: "componentRef",
      style: "width:300px",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.downloadFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [c("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.deleteFile(e)
      }
    })])]))]), c("div", {
      on: {
        click: () => this.selectFile()
      },
      class: this.ns.e("button")
    }, [c("i-icon", {
      attrs: {
        type: "md-add"
      }
    }), "添加文件"])]);
  }
});
const Ye = L({
  name: "SyEditGridFileUpload",
  props: z(),
  emits: _(),
  setup(e, {
    emit: t
  }) {
    const s = E("sy-edit-grid-file-upload"), {
      value: o,
      data: i,
      controller: n
    } = $(e), {
      downloadUrl: r,
      uploadUrl: a,
      valueList: d
    } = ie({
      value: o,
      data: i,
      controller: n
    }), m = g(), p = async () => {
      if (!m.value)
        throw new Te("容器元素不存在");
      const f = m.value.$el, F = f.offsetHeight, y = ibiz.overlay.createPopover((u) => u(Ke, {
        props: {
          value: d.value,
          data: i.value,
          uploadUrl: a.value,
          downloadUrl: r.value,
          controller: n.value
        },
        on: {
          close: (v) => {
            y.dismiss(v);
          }
        }
      }), void 0, {
        noArrow: !0,
        placement: "bottom-start",
        offsetOpts: {
          mainAxis: -F,
          crossAxis: 0
        }
      });
      await y.present(f);
      const {
        isModified: x,
        resultFiles: w
      } = await y.onWillDismiss();
      if (x) {
        const u = w.length > 0 ? JSON.stringify(w.map((v) => ({
          name: v.name,
          id: v.id
        }))) : null;
        t("change", u), t("rowSave");
      }
    };
    return xe(m, "click", (f) => {
      e.disabled || p();
    }), {
      ns: s,
      valueList: d,
      componentRef: m
    };
  },
  render() {
    return c("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.valueList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title")
    }, [e.name])]))])]);
  }
});
L({
  name: "SyInput",
  props: ke(),
  emits: K(),
  setup(e, {
    emit: t
  }) {
    const s = E("input"), i = e.controller.model, n = g(), r = g(2);
    i.editorType === "TEXTAREA_10" && (r.value = 10);
    const a = D(() => {
      switch (i.editorType) {
        case "TEXTBOX":
          return "text";
        case "PASSWORD":
          return "password";
        case "TEXTAREA":
        case "TEXTAREA_10":
          return "textarea";
        default:
          return "string";
      }
    }), d = g("");
    P(() => e.value, (u, v) => {
      u !== v && (u ? d.value = u : d.value = "");
    }, {
      immediate: !0
    });
    let m = !1, p, f;
    const F = Me((u) => {
      f !== u.target.value && t("change", u.target.value), f = void 0, m = !1, p && p();
    }, 300, {
      leading: !0
    }), y = (u) => {
      m = !0, F(u);
    }, x = (u) => {
      u && u.code === "Enter" && m && (p = () => {
        n.value.$el.dispatchEvent(u);
      });
    }, w = () => {
      f = n.value.currentValue, t("change", f);
    };
    return e.autoFocus && P(n, (u) => {
      u && u.$el.getElementsByTagName("input")[0].focus();
    }), {
      ns: s,
      rows: r,
      type: a,
      currentVal: d,
      handleChange: y,
      handleKeyUp: x,
      handleBlur: w,
      inputRef: n
    };
  },
  render() {
    return c("div", {
      class: [this.ns.b(), this.ns.b("sy-input"), this.ns.is("textarea", Object.is(this.type, "textarea")), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [this.readonly ? this.currentVal : c("i-input", {
      ref: "inputRef",
      attrs: {
        value: this.currentVal,
        placeholder: this.controller.placeHolder,
        type: this.type,
        rows: this.rows,
        disabled: this.disabled,
        autosize: Object.is(this.type, "textarea")
      },
      on: {
        "on-change": this.handleChange,
        "on-blur": this.handleBlur
      },
      nativeOn: {
        keyup: this.handleKeyUp
      },
      class: this.ns.b("input")
    }, [this.controller.model.unitName && c("i", {
      class: this.ns.e("unit"),
      slot: "suffix"
    }, [this.controller.model.unitName])])]);
  }
});
L({
  name: "SyGridInput",
  props: Fe(),
  emits: _(),
  setup(e, {
    emit: t
  }) {
    const s = E("grid-input"), {
      isInfoMode: o,
      autoFocus: i,
      componentRef: n,
      onOperateChange: r,
      onChange: a
    } = Se(e, {
      emit: t
    });
    return {
      ns: s,
      isInfoMode: o,
      autoFocus: i,
      componentRef: n,
      onOperateChange: r,
      onChange: a
    };
  },
  render(e) {
    return e("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: `${this.ns.b()}`
    }, [e("SyInput", {
      props: {
        ...this.$props,
        readonly: this.isInfoMode,
        disabled: this.disabled,
        autoFocus: this.autoFocus
      },
      on: {
        change: this.onChange,
        operate: this.onOperateChange
      }
    })]);
  }
});
function H(e, t) {
  return c("div", {
    class: e.e("logo")
  }, [t.appIconPath ? c("img", {
    class: e.e("logo-img"),
    attrs: {
      src: t.appIconPath
    }
  }) : null, c("div", {
    class: e.e("logo-caption")
  }, [t.caption])]);
}
const et = L({
  name: "UserAppLayout",
  props: {
    model: {
      type: ue,
      required: !0
    },
    // 视图是否完成加载
    isComplete: {
      type: Boolean,
      default: !1
    },
    // 是否显示分页导航
    isShowTabPageExp: {
      type: Boolean,
      default: !1
    }
  },
  setup(e, {
    emit: t
  }) {
    const s = E("layout"), o = g(!1), i = () => {
      o.value = !o.value, t("onCollapseChange", o.value);
    }, n = D(() => e.model.source.blankMode === !0), r = D(() => !!(window.Environment.manualdownloadurl || ibiz.env.manualdownloadurl));
    return {
      ns: s,
      collapseChange: o,
      isBlank: n,
      collapseMenus: i,
      isShowDownload: r,
      downloadUserBook: () => {
        const d = window.Environment.manualdownloadurl || ibiz.env.manualdownloadurl;
        d ? window.open(d) : console.log("环境变量里没有manualdownloadurl");
      }
    };
  },
  render() {
    return this.isComplete ? c("i-layout", {
      class: [this.ns.b(), this.isBlank ? this.ns.m("blank") : "", this.ns.is("collapse", this.collapseChange), this.ns.is("tab", this.isShowTabPageExp), "user-layout"]
    }, [c("i-sider", {
      attrs: {
        "hide-trigger": !0,
        value: this.collapseChange
      },
      class: [this.ns.b("nav"), this.ns.is("collapse", this.collapseChange)]
    }, [H(this.ns, this.model), this.$slots.menu]), c("i-layout", {
      class: [this.ns.b("content")]
    }, [c("i-header", {
      class: this.ns.b("header")
    }, [c("div", {
      class: this.ns.be("header", "left")
    }, [H(this.ns, this.model), c("div", {
      class: this.ns.be("header", "collapse-icon")
    }, [this.collapseChange ? c("ion-icon", {
      attrs: {
        src: "./assets/img/menu-unfold.svg"
      },
      on: {
        click: () => this.collapseMenus()
      }
    }) : c("ion-icon", {
      attrs: {
        src: "./assets/img/menu-fold.svg"
      },
      on: {
        click: () => this.collapseMenus()
      }
    })]), this.model.source.mainMenuAlign === "TOP" ? c("i-menu", {
      class: this.ns.be("header", "menu"),
      attrs: {
        mode: "horizontal",
        "active-name": "1"
      }
    }) : null]), c("div", {
      class: this.ns.be("header", "right")
    }, [this.isShowDownload && c("div", {
      class: "user-download",
      on: {
        click: () => this.downloadUserBook()
      }
    }, ["用户手册下载"]), c("app-user")])]), c("i-content", {
      class: this.ns.be("content", "main")
    }, [this.$slots.tabPageExp, this.$slots.default])])]) : null;
  }
});
function re(e, t) {
  var n;
  const s = t.firstColName, o = [];
  e.source.columnType === "GROUPGRIDCOLUMN" && e.children.forEach((r) => {
    o.push(re(r, t));
  });
  const i = {
    title: e.title,
    width: e.source.widthUnit === "STAR" ? void 0 : e.width,
    minWidth: e.width,
    align: ((n = e.source.align) == null ? void 0 : n.toLowerCase()) || "center",
    slot: e.codeName,
    key: e.codeName,
    fieldName: e.deFieldName,
    ellipsis: !0,
    tooltip: !1,
    // todo 表格提示用title
    resizable: !0,
    sortable: !t.noSort && e.source.enableSort ? "custom" : !1,
    columnType: e.source.columnType,
    tree: e.codeName === s,
    className: e.codeName === s ? "grid-group-grid-column" : ""
  };
  return o.length > 0 && Object.assign(i, { children: o }), i;
}
function tt(e) {
  const t = e.model, s = [], o = t.columns.map((i) => re(i, e));
  return t.children.forEach((i) => {
    const n = o.find((a) => a.key === i.codeName), r = e.groupField;
    n && i.codeName !== r && s.push(n);
  }), e.singleSelect || s.splice(0, 0, { type: "selection", width: 60 }), s;
}
function st(e) {
  const t = g([]);
  return e.nerve.self.evt.on("created", () => {
    t.value = tt(e);
  }), [D(() => {
    const o = [...t.value];
    if (!o.find((r) => !r.width)) {
      let r = o.length - 1;
      o[r].key === "rowEdit" && (r -= 1), o[r] = {
        ...o[r],
        width: void 0
      };
    }
    const n = o.find((r) => r.columnType === "UAGRIDCOLUMN");
    return n && (n.fixed = "right"), o;
  }), t];
}
function ot(e) {
  const t = (r) => e.items.find((a) => a.srfkey === r.srfkey);
  function s(r) {
    const a = t(r);
    e.singleSelect && e.onSelectionChange([a]), e.onRowClick(a);
  }
  function o(r) {
    e.onDbRowClick(t(r));
  }
  function i(r) {
    if (!e.singleSelect) {
      const a = [];
      r.forEach((d) => {
        const m = t(d);
        m && a.push(m);
      }), e.onSelectionChange(a);
    }
  }
  function n(r) {
    const { column: a, order: d } = r, m = d === "asc" || d === "desc" ? d : void 0;
    e.setSort(a.fieldName, m), e.load();
  }
  return { onRowClick: s, onDbRowClick: o, onSelectionChange: i, onSortChange: n };
}
function it(e) {
  function t(i) {
    !i || i === e.curPage || (e.curPage = i, e.load());
  }
  function s(i) {
    !i || i === e.size || (e.size = i, e.curPage === 1 && e.load());
  }
  function o() {
    e.curPage = 1, e.load();
  }
  return { onPageChange: t, onPageSizeChange: s, onPageReset: o };
}
class nt extends ge {
  constructor() {
    super(...arguments);
    /**
     * 分组数据
     * @return {*}
     * @author: zhujiamin
     * @Date: 2023-10-09 14:00:38
     */
    U(this, "groups", []);
    /**
     * 分组名称属性
     *
     * @author zhanghengfeng
     * @date 2024-12-19 10:12:56
     * @type {string}
     */
    U(this, "groupField", "");
    /**
     * 第一列名称
     *
     * @author zhanghengfeng
     * @date 2024-12-19 10:12:30
     * @type {string}
     */
    U(this, "firstColName", "");
  }
  async onInit() {
    const s = this.model.columns.find(
      (i) => {
        var n;
        return (n = i.source) == null ? void 0 : n.groupItem;
      }
    );
    s && (this.groupField = s.codeName);
    const o = this.model.columns.find((i) => i.codeName !== this.groupField && !i.source.hideDefault && !i.source.hiddenDataItem);
    o && (this.firstColName = o.codeName), await super.onInit();
  }
  /**
   * 部件加载后处理
   *
   * @author lxm
   * @date 2022-08-19 14:08:50
   */
  async afterLoad(s) {
    return await Promise.allSettled(
      Object.values(this.fieldColumns).map(async (o) => {
        await o.loadCodeList();
      })
    ), this.rows = s.map((o) => {
      const i = new X(o, this);
      return this.gridStateNotify(i, we.LOAD), i;
    }), this.handleGroup(s), s;
  }
  /**
   * 处理分组数据
   * @param {ControlVO} items
   * @return {*}
   * @author: zhujiamin
   * @Date: 2023-10-09 14:03:17
   */
  handleGroup(s) {
    const o = /* @__PURE__ */ new Map();
    s.forEach((i) => {
      const n = i[this.groupField];
      o.has(n) || o.set(n, []), o.has(n) && o.get(n).push(i);
    }), this.groups = [], o.forEach((i, n) => {
      this.groups.push({
        caption: `${n}`,
        key: n,
        children: i
      });
    });
  }
}
function rt(e, t, s, o = {}) {
  return Le(e, () => {
    const i = new nt(t, s, o);
    return B(e, "gridRowActiveMode", i.setGridRowActiveMode.bind(i)), i;
  });
}
const at = L({
  props: {
    modelData: he,
    context: {
      type: Object,
      required: !0
    },
    params: {
      type: Object,
      default: () => ({})
    },
    /**
     * 表格行数据默认激活模式
     * - 0 不激活
     * - 1 单击激活
     * - 2 双击激活(默认值)
     *
     * @type {(number | 0 | 1 | 2)}
     */
    gridRowActiveMode: {
      type: Number,
      default: 2
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = A(), s = E("grid"), o = rt(t, e.modelData, e.context, e.params), [i] = st(o), {
      onRowClick: n,
      onDbRowClick: r,
      onSelectionChange: a,
      onSortChange: d
    } = ot(o), {
      onPageChange: m,
      onPageReset: p,
      onPageSizeChange: f
    } = it(o), F = (S, k) => {
      const l = t.$refs.grid;
      l && (l.toggleSelect && l.toggleSelect(k), l.highlightCurrentRow && l.highlightCurrentRow(k)), n(S);
    }, y = g(0), x = g(null), w = g(null);
    let u = null, v = 0;
    const N = () => {
      var S;
      if (x.value && ((S = e.modal) == null ? void 0 : S.mode) !== "EMBED")
        if (o.model.source.enablePagingBar && w.value) {
          const k = w.value.$el, l = k.offsetHeight + parseFloat(window.getComputedStyle(k).paddingTop);
          y.value = x.value.offsetHeight - l;
        } else
          y.value = x.value.offsetHeight;
      o.model.source.height > 0 && (y.value = o.model.source.height);
    };
    P(x, (S, k) => {
      S && S !== k && (N(), window.ResizeObserver && x.value && (u = new ResizeObserver((l) => {
        const h = l[0].contentRect.height;
        h !== v && (N(), v = h);
      }), u.observe(x.value)));
    }), be(() => {
      u && u.disconnect();
    });
    const I = D(() => {
      const S = [];
      return o.groups.forEach((k) => {
        if (!k.children.length)
          return;
        const h = [...k.children].shift();
        S.push({
          srfkey: k.caption,
          isGroupData: !0,
          first: h,
          children: k.children,
          _showChildren: !0
        });
      }), S;
    });
    return {
      c: o,
      ns: s,
      columns: i,
      tableData: I,
      onDbRowClick: r,
      onUIRowClick: F,
      onSelectionChange: a,
      onSortChange: d,
      onPageChange: m,
      onPageSizeChange: f,
      onPageReset: p,
      tableHeight: y,
      gridRef: x,
      girdPaginationRef: w
    };
  },
  render() {
    if (!this.c.complete)
      return;
    const e = {};
    return this.c.model.columns.forEach((t) => {
      if (t.source.columnType === "GROUPGRIDCOLUMN")
        return;
      const s = t.codeName;
      e[s] = (o) => {
        const {
          row: i,
          column: n
        } = o;
        if (i.isGroupData && n.key === this.c.firstColName)
          return c("div", {
            class: this.ns.b("sum"),
            attrs: {
              title: i.first[this.c.groupField]
            }
          }, [c("span", [i.first[this.c.groupField]])]);
        const r = this.c.rows.find((a) => a.data.srfkey === i.srfkey);
        if (r)
          return c(this.c.providers[s].component, {
            props: {
              controller: this.c.columns[s],
              row: r
            },
            key: i.srfkey + s
          });
      };
    }), c("control-layout", {
      attrs: {
        modelData: this.c.model
      }
    }, [c("div", {
      ref: "gridRef",
      class: [this.ns.b(), this.ns.b("group-grid"), this.ns.is("show-header", !this.c.model.source.hideHeader), this.ns.is("enable-page", this.c.model.source.enablePagingBar)]
    }, [this.c.groups.length > 0 && c("i-table", {
      ref: "grid",
      attrs: {
        height: this.tableHeight,
        "show-header": !this.c.model.source.hideHeader,
        "highlight-row": !0,
        data: this.tableData,
        columns: this.columns,
        "row-key": "srfkey"
      },
      class: this.ns.b("content"),
      on: {
        "on-row-click": this.onUIRowClick,
        "on-row-dblclick": this.onDbRowClick,
        "on-selection-change": this.onSelectionChange,
        "on-sort-change": this.onSortChange
      },
      scopedSlots: e
    }), this.c.model.source.enablePagingBar && c("app-grid-pagination", {
      ref: "girdPaginationRef",
      attrs: {
        total: this.c.total,
        curPage: this.c.curPage,
        size: this.c.size
      },
      on: {
        change: this.onPageChange,
        "page-size-change": this.onPageSizeChange,
        "page-reset": this.onPageReset
      }
    })])]);
  }
});
class lt {
  constructor() {
    U(this, "component", Oe);
  }
}
class ct {
  constructor() {
    U(this, "component", Ae);
  }
  async createController(t, s) {
    const o = new Z(t, s);
    return await o.init(), o;
  }
}
class dt {
  constructor() {
    U(this, "component", "IndexView");
  }
}
const ae = L({
  name: "WFStepTraceGrid",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const {
      proxy: t
    } = A(), s = Ee(t, e.modelPath);
    B(t, "deName", s.setDeName.bind(s));
    const o = E("wf-step-trace-grid"), i = g([]), n = (a, d, m = !1) => {
      a.identitylinks.length > 0 || a.comments.length > 0 && a.comments.forEach((p) => {
        var f, F, y;
        m && p.type === "启动流程" || d.push({
          id: W(),
          nodeName: a.userTaskName,
          personName: (f = p.authorName) == null ? void 0 : f.replace(/\([^)]*\)[^(]*$/, ""),
          deptName: ((y = (F = p.authorName) == null ? void 0 : F.match(/.*\(([^)]*)\)[^(]*$/)) == null ? void 0 : y[1]) || "",
          time: p.time,
          content: p.type,
          comment: p.fullMessage
        });
      });
    };
    s.nerve.self.evt.on("mounted", () => {
      var a;
      s.data && ((a = s.data.usertasks) == null || a.forEach((d) => {
        if (d.usertasks && d.usertasks.length > 0) {
          const m = [];
          d.usertasks.forEach((p) => {
            n(p, m, !0);
          }), i.value.push({
            id: W(),
            nodeName: `${d.userTaskName}`,
            personName: "",
            deptName: "",
            time: "",
            content: "",
            comment: "",
            children: m,
            _showChildren: !0
          });
        } else
          n(d, i.value);
      }), i.value.sort((d, m) => Date.parse(d.time) - Date.parse(m.time)));
    });
    const r = g([{
      title: "序号",
      key: "index",
      width: 60,
      resizable: !0,
      render: (a, d) => i.value.findIndex((p) => p.id === d.row.id) === -1 ? null : a("span", {
        style: {
          textAlign: "center"
        }
      }, d.index + 1)
    }, {
      title: "审批人",
      key: "personName",
      width: 180,
      tree: !0,
      resizable: !0
    }, {
      title: "审批部门",
      key: "deptName",
      width: 170,
      resizable: !0
    }, {
      title: "处理环节",
      key: "nodeName",
      width: 200,
      resizable: !0,
      className: "clhj"
    }, {
      title: "审批(递交时间)",
      key: "time",
      width: 170,
      resizable: !0
    }, {
      title: "审批动作",
      key: "content",
      width: 150,
      resizable: !0
    }, {
      title: "审批意见",
      key: "comment",
      width: 100
    }]);
    return {
      c: s,
      ns: o,
      gridData: i,
      columns: r
    };
  },
  render() {
    return c("div", {
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.e("title")
    }, ["审批信息"]), c("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData,
        "row-key": "id"
      },
      class: this.ns.e("grid")
    })]);
  }
});
class ut extends ve {
  async calcWfToolbar() {
    await super.calcWfToolbar(), this.isEditable && this.wfLinks.unshift({
      sequenceFlowName: "保存",
      type: "FORM_SAVE"
    });
  }
  async onLinkClick(t) {
    t.type === "FORM_SAVE" ? await this.save() : super.onLinkClick(t);
  }
}
L({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = A(), s = Q(t, (r, a) => new ut(e.modelPath, r, a)), o = E(`view-${me.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), i = g(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (r) => {
        i.value.includes(r) || i.value.push(r);
      },
      lazyList: i
    };
  },
  render(e) {
    const t = [];
    if (this.c.complete) {
      const {
        activeForm: s
      } = this.c;
      s && this.c.providers[s.name] && t.push(e(this.c.providers[s.name].component, {
        props: {
          modelData: s,
          context: this.c.context,
          params: this.c.params
        },
        style: {
          height: "auto"
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit("form")
        }
      }));
    }
    if (this.c.complete && this.c.model.drTab.pages[0]) {
      const s = this.c.model.drTab.pages[0], o = this.c.drPages[s.source.name];
      t.push(e(ae, {
        attrs: {
          context: o.context,
          params: o.params,
          deName: this.c.model.appEntity.source.codeName,
          modal: this.modal,
          modelPath: s.embedView.source.modelPath
        }
      }));
    }
    return e("view-base", {
      attrs: {
        controller: this.c
      },
      scopedSlots: {
        toolbar: () => this.c.complete ? [this.c.wfLinks.length > 0 && e("wf-toolbar", {
          attrs: {
            wfLinks: this.c.wfLinks
          },
          on: {
            "wf-link-click": (s) => {
              this.c.onLinkClick(s);
            }
          }
        })] : null
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [t]), this.c.model.drTab.pages.map((s) => {
      const o = this.c.drPages[s.source.name];
      return e("i-tab-pane", {
        class: this.ns.be("", "tab-item"),
        attrs: {
          tab: this.c.model.drTab.source.name,
          disabled: this.c.isNewData,
          label: s.source.caption,
          name: s.source.name
        }
      }, [!this.c.isNewData && this.lazyList.includes(s.source.name) && e("ViewShell", {
        attrs: {
          context: o.context,
          params: o.params,
          modal: {
            mode: ee.EMBED
          },
          modelPath: s.embedView.source.modelPath,
          // 流程跟踪视图用
          deName: this.c.model.appEntity.source.codeName
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(s.source.name)
        },
        key: o.key
      })]);
    })])]);
  }
});
L({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = A(), s = Ue(t, e.modelPath), o = E("view-deeditview3"), i = g(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (r) => {
        i.value.includes(r) || i.value.push(r);
      },
      lazyList: i
    };
  },
  render(e) {
    return e("view-base", {
      attrs: {
        controller: this.c
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [e("edit-form-control", {
      attrs: {
        modelData: this.c.model.form,
        context: this.c.context,
        params: this.c.params
      },
      style: {
        height: "auto"
      },
      on: {
        neuronInit: this.c.nerve.onNeuronInit(this.c.model.form.source.name)
      }
    }), e(ae, {
      attrs: {
        context: this.c.drPages[this.c.model.drTab.pages[0].source.name].context,
        params: this.c.drPages[this.c.model.drTab.pages[0].source.name].params,
        deName: this.c.model.appEntity.source.codeName,
        modal: this.modal,
        modelPath: this.c.model.drTab.pages[0].embedView.source.modelPath
      }
    })]), this.c.model.drTab.pages.map((t) => {
      const s = this.c.drPages[t.source.name];
      if (s)
        return e("i-tab-pane", {
          class: this.ns.be("", "tab-item"),
          attrs: {
            tab: this.c.model.drTab.source.name,
            disabled: this.c.isNewData,
            label: t.source.caption,
            name: t.source.name
          }
        }, [!this.c.isNewData && this.lazyList.includes(t.source.name) && e("ViewShell", {
          attrs: {
            context: s.context,
            params: s.params,
            modal: {
              mode: ee.EMBED
            },
            modelPath: t.embedView.source.modelPath,
            // 流程跟踪视图用
            deName: this.c.model.appEntity.source.codeName
          },
          on: {
            neuronInit: this.c.nerve.onNeuronInit(t.source.name)
          },
          key: s.key
        })]);
    })])]);
  }
});
class ht {
  constructor() {
    U(this, "formEditor", "SyFileUpload");
    U(this, "gridEditor", "SyGridFileUploadContainer");
  }
  async createController(t, s) {
    const o = new J(t, s);
    return await o.init(), o;
  }
}
class mt extends te {
  async execAction(t, s, o, i, n) {
    if (o && o.length > 0) {
      const a = (await ibiz.entityService.getService("XQFBXQPS", s)).local.getList(s);
      o.forEach((d) => {
        const m = a.find((p) => p.srfkey === d.srfkey);
        m && (m.psjg = "10", d.psjg = "10");
      });
    }
    return {
      refresh: !1,
      closeView: !1
    };
  }
}
class pt {
  constructor() {
    U(this, "handler");
  }
  async getHandler() {
    return this.handler || (this.handler = new mt()), this.handler;
  }
}
class ft extends te {
  async execAction(t, s, o, i, n) {
    if (o && o.length > 0) {
      const a = (await ibiz.entityService.getService("XQFBXQPS", s)).local.getList(s);
      o.forEach((d) => {
        const m = a.find((p) => p.srfkey === d.srfkey);
        m && (m.psjg = "20", d.psjg = "20");
      });
    }
    return {
      refresh: !1,
      closeView: !1
    };
  }
}
class gt {
  constructor() {
    U(this, "handler");
  }
  async getHandler() {
    return this.handler || (this.handler = new ft()), this.handler;
  }
}
class wt {
  constructor() {
    U(this, "component", "GroupGrid");
  }
}
const vt = new Re(import.meta.url), Pt = {
  mateUrl: import.meta.url,
  install(e) {
    pe.getModelService().then((t) => {
      var o;
      ((o = t.app.userParams) == null ? void 0 : o.autoWidth) === "true" && document.getElementsByClassName("app")[0].classList.add("auto-width");
    }), vt.loadStyle(["/style.css"]), ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", e.component("WfToolbar", $e), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWebIndexView",
      new dt()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_PresetWFChartView",
      new lt()
    ), ibiz.register.gridColumn.register(
      "GRID_COLRENDER_CodeListGridColumn",
      new ct()
    ), e.component("SyFileUpload", Xe), e.component("SyGridFileUpload", Je), e.component("SyEditGridFileUpload", Ye), e.component("SyGridFileUploadContainer", Qe), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_SyFileUpload",
      new ht()
    ), e.component("AppLayout", et), ibiz.register.uiAction.register(
      "DEUIACTION_BatchApprovalOrdersId",
      new pt()
    ), ibiz.register.uiAction.register(
      "DEUIACTION_BatchNoApprovalOrdersId",
      new gt()
    ), e.component("GroupGrid", at), ibiz.register.control.register(
      "GRID_RENDER_GROUP_GRID",
      new wt()
    );
  }
};
export {
  Pt as default
};
