var O = Object.defineProperty;
var R = (t, a, s) => a in t ? O(t, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[a] = s;
var y = (t, a, s) => (R(t, typeof a != "symbol" ? a + "" : a, s), s);
import { PluginStaticResource as K, ViewMode as T } from "@ibiz-template/runtime";
import { ref as x, watch as k, defineComponent as C, getCurrentInstance as P, onMounted as _, computed as M, h as o, toRefs as z, reactive as F, nextTick as L, toRef as B } from "vue";
import { useRouter as U, useRoute as Y, useIndexViewController as W, useNamespace as b, useControlController as H, usePropsWatch as J, useListController as G, useListExpViewController as Q, useRouteKey as X, getUploadProps as Z, getEditorEmits as ee } from "@ibiz-template/vue-util";
import { IndexViewModel as te, PortletPartModel as se, ViewPortletModel as ae, ListModel as V } from "@ibiz-template/model";
import S from "dayjs";
import { CustomPortletController as ne, ViewPortletController as re, EditFormController as oe, ListController as ie, UploadEditorController as le } from "@ibiz-template/controller";
import { init as j, registerMap as ce } from "echarts";
import { mergeDeepLeft as de } from "ramda";
import { Treeselect as ue } from "@riophae/vue-treeselect";
const D = new K(import.meta.url);
class pe {
  constructor() {
    y(this, "component", "UserIndexView");
  }
}
const he = (t) => {
  const { view2: a, params2: s, params1: e } = t.params;
  if (!a)
    return "";
  let n = s.replace(
    new RegExp(";srfnav=[^;=]*$|(?<=;)srfnav=[^;=]*;|^srfnav=[^;=]*;|^srfnav=[^;=]*$", "g"),
    ""
  );
  return n = n || ibiz.env.routePlaceholder, `/${e}/${a}/${n}`;
}, me = (t) => {
  const { view1: a, appContext: s } = t.params;
  return `/${s}/${a}/${ibiz.env.routePlaceholder}`;
};
function fe(t, a) {
  const s = U(t), e = x(""), n = x(""), r = x([]), d = x([]), g = (h) => {
    h.forEach((u) => {
      const i = r.value.indexOf(u);
      if (i !== -1) {
        r.value.splice(i, 1);
        const c = d.value.findIndex((f) => f.key === u);
        d.value.splice(c, 1);
      }
    });
  };
  return k(
    () => t.$route.path,
    (h, u) => {
      if (h !== u) {
        const i = Y(t);
        i.matched.length <= 2 && g(r.value.splice(0)), e.value = he(i), n.value = me(i);
        const c = d.value.find(
          (f) => f.key === e.value
        );
        if (c)
          c.fullPath = i.fullPath;
        else {
          if (h === n.value)
            return;
          d.value.push({
            key: e.value,
            fullPath: i.fullPath,
            modelPath: "",
            caption: ""
          });
        }
      }
    },
    { deep: !0, immediate: !0 }
  ), k(
    e,
    (h, u) => {
      if (h !== u && h) {
        const i = r.value.indexOf(h);
        i === -1 || r.value.splice(i, 1), r.value.unshift(h);
      }
    },
    { immediate: !0 }
  ), {
    currentKey: e,
    keyHistory: r,
    routeMsgs: d,
    updateRouteMsg: (h, u) => {
      const i = d.value.find((c) => c.key === e.value);
      i && (u.caption && (i.caption = u.caption), u.modelPath && (i.modelPath = u.modelPath));
    },
    closeView: (h = e.value) => {
      g([h]);
      const u = r.value[0];
      if (!u)
        a.model.source.blankMode ? (window.callback && window.callback(), window.close()) : (e.value = "", s.push(n.value));
      else {
        const i = d.value.find((c) => c.key === u);
        s.push(i.fullPath);
      }
    },
    deleteRouteCache: g
  };
}
const ge = /* @__PURE__ */ C({
  __name: "index-view",
  props: {
    context: null,
    params: { default: () => ({}) },
    modelPath: null
  },
  setup(t) {
    const a = t, { proxy: s } = P(), e = W(s, a.modelPath), {
      currentKey: n,
      keyHistory: r,
      routeMsgs: d,
      updateRouteMsg: g,
      closeView: l,
      deleteRouteCache: m
    } = fe(s, e), h = (p) => {
      const v = n.value;
      p.evt.on("closeView", () => {
        l(v);
      }), p.evt.on("setTitle", (w) => {
        g(v, { caption: w });
      });
    };
    _(() => {
      setTimeout(() => {
        const p = document.querySelector(".app-loading-x");
        p && (p.style.display = "none");
      }, 300);
    });
    const u = (p) => {
      g(n.value, p);
    }, i = (p) => {
      e.collapseChange = p;
    }, c = () => {
      m(r.value.slice(1));
    };
    window.onpopstate = () => {
      m([r.value[1]]);
    };
    const f = M(() => {
      const p = d.value.find((v) => v.key === n.value);
      return (p == null ? void 0 : p.modelPath) || "";
    });
    return { __sfc: !0, props: a, proxy: s, c: e, currentKey: n, keyHistory: r, routeMsgs: d, updateRouteMsg: g, closeView: l, deleteRouteCache: m, onCreated: h, onViewFound: u, collapseChange: i, onMenuRouteChange: c, currentPath: f };
  }
});
function ye(t, a, s, e, n, r, d, g) {
  var l = typeof t == "function" ? t.options : t;
  a && (l.render = a, l.staticRenderFns = s, l._compiled = !0), e && (l.functional = !0), r && (l._scopeId = "data-v-" + r);
  var m;
  if (d ? (m = function(i) {
    i = i || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !i && typeof __VUE_SSR_CONTEXT__ < "u" && (i = __VUE_SSR_CONTEXT__), n && n.call(this, i), i && i._registeredComponents && i._registeredComponents.add(d);
  }, l._ssrRegister = m) : n && (m = g ? function() {
    n.call(
      this,
      (l.functional ? this.parent : this).$root.$options.shadowRoot
    );
  } : n), m)
    if (l.functional) {
      l._injectStyles = m;
      var h = l.render;
      l.render = function(c, f) {
        return m.call(f), h(c, f);
      };
    } else {
      var u = l.beforeCreate;
      l.beforeCreate = u ? [].concat(u, m) : [m];
    }
  return {
    exports: t,
    options: l
  };
}
var ve = function() {
  var a = this, s = a._self._c, e = a._self._setupProxy;
  return s("UserAppLayout", { attrs: { "is-complete": e.c.complete, model: e.c.model }, on: { onCollapseChange: e.collapseChange } }, [e.c.complete ? [e.c.complete ? s("AppMenu", { attrs: { slot: "menu", "current-path": e.currentPath, "model-data": e.c.model.appMenu, context: e.c.context, "collapse-change": e.c.collapseChange }, on: { menuRouteChange: e.onMenuRouteChange }, slot: "menu" }) : a._e(), s("AppKeepAlive", { attrs: { "key-list": e.keyHistory } }, [s("router-view", { key: e.currentKey, on: { neuronInit: e.onCreated, viewFound: e.onViewFound } })], 1)] : a._e()], 2);
}, xe = [], Ce = /* @__PURE__ */ ye(
  ge,
  ve,
  xe,
  !1,
  null,
  null,
  null,
  null
);
const be = Ce.exports;
function E(t, a) {
  return o("div", {
    class: t.e("logo")
  }, [o("img", {
    class: t.e("logo-img"),
    attrs: {
      src: D.dir("/assets/img/jh.png")
    }
  }), o("div", {
    class: t.e("logo-caption")
  }, [a.caption])]);
}
const we = C({
  name: "UserAppLayout",
  props: {
    model: {
      type: te,
      required: !0
    },
    isComplete: {
      type: Boolean,
      default: !1
    }
  },
  setup(t, {
    emit: a
  }) {
    const s = b("layout"), e = x(!1), n = () => {
      e.value = !e.value, a("onCollapseChange", e.value);
    }, r = M(() => t.model.source.blankMode === !0);
    return {
      ns: s,
      collapseChange: e,
      isBlank: r,
      collapseMenus: n
    };
  },
  render() {
    return this.isComplete ? o("i-layout", {
      class: [this.ns.b(), this.isBlank ? this.ns.m("blank") : "", this.ns.is("collapse", this.collapseChange)]
    }, [o("i-sider", {
      attrs: {
        "hide-trigger": !0,
        value: this.collapseChange
      },
      class: [this.ns.b("nav"), this.ns.is("collapse", this.collapseChange)]
    }, [E(this.ns, this.model), this.$slots.menu, o("div", {
      class: this.ns.be("slider", "collapse-icon")
    }, [this.collapseChange ? o("ion-icon", {
      attrs: {
        src: "./assets/img/menu-unfold.svg"
      },
      on: {
        click: () => this.collapseMenus()
      }
    }) : o("ion-icon", {
      attrs: {
        src: "./assets/img/menu-fold.svg"
      },
      on: {
        click: () => this.collapseMenus()
      }
    })])]), o("i-layout", {
      class: [this.ns.b("content")]
    }, [o("i-header", {
      class: this.ns.b("header")
    }, [o("div", {
      class: this.ns.be("header", "left")
    }, [E(this.ns, this.model), this.model.source.mainMenuAlign === "TOP" ? o("i-menu", {
      class: this.ns.be("header", "menu"),
      attrs: {
        mode: "horizontal",
        "active-name": "1"
      }
    }) : null]), o("div", {
      class: this.ns.be("header", "right")
    }, [o("app-user"), o("img", {
      class: this.ns.e("xs"),
      attrs: {
        src: D.dir("/assets/img/xs.svg")
      }
    }), o("img", {
      class: this.ns.e("sz"),
      attrs: {
        src: D.dir("/assets/img/sz.svg")
      }
    })])]), o("i-content", {
      class: this.ns.be("content", "main")
    }, [this.$slots.default])])]) : null;
  }
});
class A extends ne {
  constructor() {
    super(...arguments);
    y(this, "options", []);
    y(this, "kqrq", "");
    y(this, "rylx", "");
  }
  async onInit() {
    await super.onInit(), this.options = await ibiz.codeListService.get(
      "UsrCodeList0402031972",
      this.context,
      this.params
    ), this.context.srforgcode && (this.params.orgcode = this.context.srforgcode), this.kqrq = S().subtract(1, "day").startOf("day").format("YYYY-MM-DD"), this.rylx = this.options.map((s) => s.value).join(","), this.changeViewParams();
  }
  changeViewParams() {
    this.dashboard.setContextOrParams(
      void 0,
      {
        ...this.params,
        kqrq: this.kqrq || null,
        rylx: this.rylx || null
      },
      !0
    );
  }
}
const ke = C({
  name: "PortletSearchHeader",
  props: {
    modelData: {
      type: se,
      required: !0
    },
    controller: {
      type: A,
      required: !0
    }
  },
  setup(t) {
    const a = b("portal-search-header"), s = x([]), e = x(new Date()), n = (l) => {
      s.value = l, t.controller.rylx = l.join(","), t.controller.changeViewParams();
    }, r = (l) => {
      e.value = l, t.controller.kqrq = l ? S(l).format("YYYY-MM-DD") : "", t.controller.changeViewParams();
    };
    e.value = new Date(t.controller.kqrq), s.value = t.controller.rylx.split(",");
    const d = S();
    return {
      ns: a,
      selectArray: s,
      selectDate: e,
      options: {
        disabledDate: (l) => {
          const m = S(l);
          return d.isSame(m, "day") || d.isBefore(m, "day");
        }
      },
      onSelectArrayChange: n,
      onDateChange: r
    };
  },
  render() {
    const t = [this.ns.b(), this.ns.m(this.modelData.modelClass)];
    return o("portlet-layout", {
      attrs: {
        controller: this.controller
      },
      class: t
    }, [o("i-checkbox-group", {
      class: this.ns.e("rylx-checkbox"),
      attrs: {
        value: this.selectArray
      },
      on: {
        "on-change": this.onSelectArrayChange
      }
    }, [this.controller.options.map((a) => o("i-checkbox", {
      attrs: {
        label: a.value
      }
    }, [a.text]))]), o("i-CalendarPicker", {
      class: this.ns.e("date-picker"),
      attrs: {
        type: "date",
        value: this.selectDate,
        clearable: !1,
        placement: "bottom-end",
        options: this.options
      },
      on: {
        "on-change": this.onDateChange
      }
    })]);
  }
});
class De {
  constructor() {
    y(this, "component", ke);
  }
  async createController(a, s, e) {
    const n = new A(
      a,
      s,
      e
    );
    return await n.init(), n;
  }
}
class $ extends re {
  constructor() {
    super(...arguments);
    y(this, "data", {});
    y(this, "mapData", []);
    y(this, "pointData", []);
    y(this, "form");
    y(this, "hasLoad", !1);
    y(this, "isloading", !1);
    y(this, "entityService");
  }
  async onInit() {
    await super.onInit(), await this.model.embedView.init();
    const s = this.model.embedView.form;
    this.entityService = await ibiz.entityService.getService(
      s.appEntity.codeName,
      this.context
    ), this.form = new oe(s, this.context, {
      ...this.params
    }), await this.form.init(), this.dashboard.nerve.self.evt.on("mounted", () => {
      this.load();
    });
  }
  calcPercent(s, e, n = 1) {
    return s ? parseFloat((s * 100 / e).toFixed(n)) : 0;
  }
  calcViewParams() {
    super.calcViewParams(), this.dashboard.complete && (this.form.setContextOrParams(void 0, this.params, !0), this.load());
  }
  async load() {
    this.isloading = !0, this.data = await this.form.load(), this.data.zcrs = this.data.zcrs || 0, this.data.ycrs = this.data.ycrs || 0, this.data.qjrs = this.data.qjrs || 0, this.data.xjrs = this.data.xjrs || 0, this.data.zcl = this.calcPercent(this.data.zcrs, this.data.yzrs), this.data.ycl = this.calcPercent(this.data.ycrs, this.data.yzrs), this.data.qjl = this.calcPercent(this.data.qjrs, this.data.yzrs), this.data.xjl = this.calcPercent(this.data.xjrs, this.data.yzrs), await this.loadMapData(), this.hasLoad = !0, this.isloading = !1;
  }
  async loadMapData() {
    const e = (await this.entityService.exec(
      "FetchMapData",
      this.context,
      this.params
    )).data.map((r) => ({
      name: r.orgcode,
      value: this.calcPercent(Number(r.zcl), 1, 2),
      title: r.orgname,
      zcl: `${this.calcPercent(Number(r.zcl), 1, 2)}%`,
      zcrs: r.zcrs,
      jd: r.jd,
      wd: r.wd
    })), n = e.findIndex(
      (r) => r.name === this.params.orgcode
    );
    n !== -1 && (this.pointData = e.splice(n, 1)), this.mapData = e.length === 0 ? this.pointData : e;
  }
  onMapChange(s) {
    const e = `${s}`;
    this.mapData = [], this.pointData = [], this.dashboard.setContextOrParams(
      void 0,
      {
        ...this.params,
        orgcode: e
      },
      !0
    );
  }
}
const q = C({
  name: "RingChart",
  props: {
    percent: {
      type: Number,
      required: !0
    },
    text: {
      type: String,
      required: !0
    },
    colors: {
      type: Array,
      default: () => ["#ff0700", "#ff5900", "#ff8300", "#ffa700", "#ffc800", "#ffc02f", "#ffb946", "#ffb358", "#ff9482", "#ff87ba", "#d391e9", "#73a0fa"]
    }
  },
  setup(t) {
    const a = b("ring-chart"), s = x();
    let e;
    const n = M(() => {
      const m = 100 / t.colors.length, h = Math.round(t.percent / m);
      return t.colors[h];
    }), r = () => ({
      tooltip: {
        trigger: "item"
      },
      series: [{
        name: "Access From",
        type: "pie",
        radius: ["56%", "70%"],
        center: ["50%", "70%"],
        startAngle: 180,
        avoidLabelOverlap: !1,
        hoverAnimation: !1,
        selectedOffset: 0,
        tooltip: {
          show: !1
        },
        emphasis: {
          disabled: !0
        },
        label: {
          show: !1,
          position: "center",
          formatter(m) {
            return [`{a|${`${m.percent * 2}%`}}`, `{b|${t.text}}`].join(`
`);
          },
          rich: {
            a: {
              color: "#333333",
              fontWeight: "bold",
              fontSize: 24
            },
            b: {
              color: "#666666",
              fontSize: 14,
              padding: [16, 0, 3, 0]
            }
          }
        },
        data: [{
          value: t.percent,
          itemStyle: {
            color: n.value
          },
          label: {
            show: !0
          }
        }, {
          value: 100 - t.percent,
          itemStyle: {
            color: "#EBF4FF"
          }
        }, {
          value: 100,
          itemStyle: {
            color: "none"
          }
        }]
      }]
    });
    _(() => {
      e = j(s.value), e.setOption(r());
    });
    const {
      percent: d,
      colors: g,
      text: l
    } = z(t);
    return k([d, g, l], () => {
      e && (e.setOption(r()), e.resize());
    }), window.addEventListener("resize", () => {
      e == null || e.resize();
    }), {
      ns: a,
      chartRef: s
    };
  },
  render() {
    return o("div", {
      class: this.ns.b(),
      ref: "chartRef"
    });
  }
}), _e = ["#FF0700", "#FFF400", "#73A0FA"], qe = {
  strMapCode: !0,
  visualMap: {
    text: ["\u9AD8", "\u4F4E"],
    min: 0,
    max: 100,
    rangeColor: _e
  }
}, Se = "/assets/json/map/jiangsu/{id}.json";
async function Pe(t) {
  return (await ibiz.net.axios({
    url: D.dir(Se.replace("{id}", t))
  })).data;
}
function Me(t, a) {
  const s = /* @__PURE__ */ new Map(), e = x(""), n = x([]);
  let r;
  const d = x(), g = (c) => {
    const f = {
      cityNames: {},
      noChild: c.features.length === 1
    };
    return c.features.forEach((p) => {
      const { adcode: v, name: w } = p.properties;
      f.cityNames[v] = w;
    }), f;
  }, l = async (c) => {
    if (s.has(c))
      return;
    const f = await Pe(c);
    s.set(c, g(f)), ce(c, f);
  }, m = (c) => {
    const f = s.get(e.value);
    if (f)
      return f.cityNames[c];
  }, h = () => {
    const c = t(e.value);
    r.setOption(c), r.resize();
  }, u = async (c, f = !1) => {
    f || a("mapChange", { name: c }), s.has(c) || await l(c), e.value = c, n.value.push(c), h();
  }, i = () => {
    if (n.value.length > 1) {
      n.value.pop();
      const c = n.value.pop();
      u(c);
    }
  };
  return _(() => {
    r = j(d.value), window.addEventListener("resize", () => {
      r == null || r.resize();
    }), r.on("click", (c) => {
      c.name !== e.value && u(c.name);
    });
  }), {
    chartRef: d,
    historyNames: n,
    currenName: e,
    changeMap: u,
    getCityName: m,
    goBack: i,
    refresh: h
  };
}
const Ie = C({
  name: "MapChart",
  props: {
    mapData: {
      type: Array,
      required: !0
    },
    pointData: {
      type: Array
    },
    options: {
      type: Object,
      default: () => ({})
    },
    defaultMapName: {
      type: String,
      required: !0
    }
  },
  setup(t, {
    emit: a
  }) {
    const s = b("map-chart"), e = M(() => de(qe, t.options)), {
      chartRef: n,
      historyNames: r,
      changeMap: d,
      getCityName: g,
      goBack: l,
      refresh: m
    } = Me((i) => {
      const {
        visualMap: c
      } = e.value, f = {
        geo: {
          map: i
        },
        tooltip: {
          trigger: "item",
          textStyle: {
            color: "#fff",
            fontSize: 12
          },
          backgroundColor: "rgba(0, 0, 0, 0.47)",
          borderWidth: 0,
          extraCssText: "backdrop-filter: blur(3px);"
        },
        visualMap: {
          min: c.min,
          max: c.max,
          text: c.text,
          realtime: !1,
          inRange: {
            color: c.rangeColor
          }
        },
        series: [
          {
            type: "map",
            map: i,
            nameProperty: e.value.strMapCode ? "adcodeStr" : "adcode",
            tooltip: {
              formatter: (p) => {
                const v = g(p.name), w = t.mapData.find((N) => N.name == p.name);
                if (!!w)
                  return `
                      <div style='display:flex;justify-content: space-between;'>
                        <span>${v}</span>
                        <span>${w.zcrs}</span>
                      </div>
                      <div style='display:flex;justify-content: space-between;'>
                        <span>\u6B63\u5E38\u7387\uFF1A</span>
                        <span>${w.zcl}</span>
                      </div>
                    `;
              }
            },
            label: {
              show: !0,
              color: "#000000",
              fontSize: 11,
              formatter: (p) => g(p.name)
            },
            select: {
              disabled: !0
            },
            data: t.mapData.map((p) => ({
              name: p.name,
              value: p.value
            }))
          }
        ]
      };
      return t.pointData && f.series.push({
        type: "scatter",
        coordinateSystem: "geo",
        symbol: "pin",
        symbolSize: 10,
        visualMap: !1,
        itemStyle: {
          color: "#FF1D00"
        },
        label: {
          show: !0,
          color: "#000000",
          fontSize: 10,
          textShadowBlur: 0,
          formatter: (p) => p.data.title,
          position: "left",
          offset: [10, -15]
        },
        tooltip: {
          formatter: (p) => {
            const v = p.data;
            return `
                    <div style='display:flex;justify-content: space-between;'>
                      <span>${v.title}</span>
                      <span>${v.zcrs}</span>
                    </div>
                    <div style='display:flex;justify-content: space-between;'>
                      <span>\u6B63\u5E38\u7387\uFF1A</span>
                      <span>${v.zcl}</span>
                    </div>
                  `;
          }
        },
        data: t.pointData.map((p) => ({
          ...p,
          value: [Number(p.jd), Number(p.wd)],
          visualMap: !1
        }))
      }), f;
    }, (i, c) => {
      i === "mapChange" && a("mapChange", c.name);
    });
    _(() => {
      d(t.defaultMapName, !0);
    });
    const {
      mapData: h,
      pointData: u
    } = z(t);
    return k([h, u], () => {
      m();
    }), {
      ns: s,
      chartRef: n,
      historyNames: r,
      goBack: l
    };
  },
  render() {
    return o("div", {
      class: this.ns.b()
    }, [o("div", {
      class: this.ns.e("chart"),
      ref: "chartRef"
    }), this.historyNames.length > 1 && o("div", {
      class: this.ns.e("goback"),
      on: {
        click: () => {
          this.goBack();
        }
      }
    }, ["\u8FD4\u56DE"])]);
  }
}), Le = C({
  name: "PortalMapArea",
  props: {
    modelData: {
      type: ae,
      required: !0
    },
    controller: {
      type: $,
      required: !0
    }
  },
  setup(t) {
    const a = F(t.controller), s = b("portal-map-area");
    return {
      c: a,
      ns: s
    };
  },
  render() {
    if (!this.c.hasLoad)
      return;
    const t = [this.ns.b(), this.ns.m(this.modelData.modelClass)];
    return o("portlet-layout", {
      attrs: {
        controller: this.controller
      },
      class: t
    }, [this.c.isloading ? o("i-spin", {
      attrs: {
        size: "large",
        fix: !0
      }
    }) : null, o("div", {
      class: this.ns.e("left")
    }, [o(q, {
      attrs: {
        percent: this.c.data.zcl,
        text: `\u6B63\u5E38\u6570 ${this.c.data.zcrs}`
      }
    }), o(q, {
      attrs: {
        percent: this.c.data.ycl,
        text: `\u5F02\u5E38\u6570 ${this.c.data.ycrs}`
      }
    })]), o("div", {
      class: this.ns.e("center")
    }, [o("div", {
      class: this.ns.e("title")
    }, [`${this.c.data.orgname} \u2014 ${this.c.data.yzrs}\u4EBA`]), o(Ie, {
      class: this.ns.e("map"),
      attrs: {
        mapData: this.c.mapData,
        pointData: this.c.pointData,
        defaultMapName: this.c.params.orgcode
      },
      on: {
        mapChange: (a) => {
          this.c.onMapChange(a);
        }
      }
    })]), o("div", {
      class: this.ns.e("right")
    }, [o(q, {
      attrs: {
        percent: this.c.data.qjl,
        text: `\u8BF7\u5047\u4EBA\u6570 ${this.c.data.qjrs}`
      }
    }), o(q, {
      attrs: {
        percent: this.c.data.xjl,
        text: `\u4F11\u5047\u4EBA\u6570 ${this.c.data.xjrs}`
      }
    })])]);
  }
});
class Ee {
  constructor() {
    y(this, "component", Le);
  }
  async createController(a, s, e) {
    const n = new $(
      a,
      s,
      e
    );
    return await n.init(), n;
  }
}
class ze extends ie {
  constructor() {
    super(...arguments);
    y(this, "unit", "");
    y(this, "isPercent", !1);
    y(this, "maxNum", 0);
  }
  async onInit() {
    var s;
    await super.onInit(), (s = this.model.source.getPSDEListDataItems()) == null || s.forEach((e) => {
      e.name === "unit" && (this.unit = e.format), e.name === "percent" && (this.isPercent = !0);
    });
  }
  async afterLoad(s) {
    return super.afterLoad(s), this.items.forEach((e) => {
      this.isPercent ? (e.num = (parseFloat(e.num) * 100).toFixed(2), e.num === "0.00" && (e.num = "0"), e.percent = Number(e.num)) : e.num > this.maxNum && (this.maxNum = e.num);
    }), this.isPercent || this.items.forEach((e) => {
      e.percent = this.maxNum ? e.num * 100 / this.maxNum : 0;
    }), s;
  }
}
function Ve(t, a, s, e = {}) {
  return H(t, () => {
    const n = new ze(a, s, e);
    return J(t, "mdCtrlActiveMode", n.setMdCtrlActiveMode.bind(n)), n;
  });
}
function je(t) {
  return { handleClick: (e) => {
    const n = t.selectedData.findIndex((r) => e.srfkey === r.srfkey);
    if (t.singleSelect)
      n === -1 ? t.onSelectionChange([e]) : t.onSelectionChange([]);
    else {
      const r = t.selectedData;
      n === -1 ? r.push(e) : r.splice(n, 1), t.onSelectionChange(r);
    }
    t.handleClick(e);
  }, handleDblClick: (e) => {
    t.handleDblClick(e);
  } };
}
const Ae = C({
  name: "KqqkListControl",
  props: {
    modelData: {
      type: V,
      required: !0
    },
    context: {
      type: Object,
      required: !0
    },
    params: {
      type: Object,
      default: () => ({})
    },
    mdCtrlActiveMode: {
      type: Number,
      default: 2
    },
    isSelectFirstDefault: {
      type: Boolean,
      required: !1
    },
    defaultSelectKeys: {
      type: Array,
      required: !1
    }
  },
  setup(t) {
    const {
      proxy: a
    } = P(), s = b("kqqk-list"), e = Ve(a, t.modelData, t.context, t.params), {
      handleClick: n,
      handleDblClick: r
    } = je(e), d = (l, m) => {
      const h = e.selectedData.findIndex((i) => i.srfkey === l.srfkey), u = [s.b("item"), s.is("active", h !== -1)];
      return o("div", {
        class: u,
        key: l.srfkey + m,
        on: {
          click: () => n(l),
          dblclick: () => r(l)
        }
      }, [o("span", {
        class: s.be("item", "title")
      }, [l.title]), o("div", {
        class: s.be("item", "progress")
      }, [o("span", {
        style: `width:${l.percent}%;`,
        class: s.be("item", "progress-bar")
      }), o("span", {
        class: s.be("item", "progress-text")
      }, [l.num, e.unit])])]);
    };
    return {
      c: e,
      ns: s,
      renderListContent: () => e.items.map((l, m) => d(l, m))
    };
  },
  render() {
    return o("control-layout", {
      class: this.ns.b(),
      attrs: {
        modelData: this.c.model
      }
    }, [this.c.complete && [this.renderListContent()]]);
  }
});
class $e {
  constructor() {
    y(this, "component", Ae);
  }
}
function Ne(t) {
  return { handleClick: (e) => {
    const n = t.selectedData.findIndex((r) => e.srfkey === r.srfkey);
    if (t.singleSelect)
      n === -1 ? t.onSelectionChange([e]) : t.onSelectionChange([]);
    else {
      const r = t.selectedData;
      n === -1 ? r.push(e) : r.splice(n, 1), t.onSelectionChange(r);
    }
    t.handleClick(e);
  }, handleDblClick: (e) => {
    t.handleDblClick(e);
  } };
}
const I = C({
  name: "ListExpControl",
  props: {
    modelData: {
      type: V,
      required: !0
    },
    context: {
      type: Object,
      required: !0
    },
    params: {
      type: Object,
      default: () => ({})
    },
    mdCtrlActiveMode: {
      type: Number,
      default: 2
    },
    isSelectFirstDefault: {
      type: Boolean,
      required: !0
    },
    defaultSelectKeys: {
      type: Array,
      required: !1
    },
    isExpView: {
      type: Boolean,
      required: !1
    }
  },
  setup(t) {
    const {
      proxy: a
    } = P(), s = b("control-list"), e = G(a, t.modelData, t.context, t.params), {
      handleClick: n,
      handleDblClick: r
    } = Ne(e);
    let d = !0;
    _(() => {
      k(() => e, (i, c) => {
        if (t.isExpView && i && i !== c) {
          let f = e.items[0];
          if (t.defaultSelectKeys && t.defaultSelectKeys.length > 0) {
            const p = e.items.find((v) => v.srfkey === t.defaultSelectKeys[0]);
            p && (f = p);
          }
          f && e.onSelectionChange([f]);
        }
      }, {
        immediate: !0
      }), k(() => e.items.length, (i) => {
        t.isExpView && i && e.onSelectionChange([e.items[0]]);
      }, {
        immediate: !0,
        deep: !0
      });
    });
    const g = (i) => {
      e.selectedData.length === 0 && (e.selectedData = [{
        srfkey: e.items[0].srfkey
      }]);
      const c = e.selectedData.findIndex((v) => v.srfkey === i.srfkey), f = () => {
        d = !1, delete e.context.n_orgid_eq, e.context.calendarCaption = i.deptname, n(i);
      }, p = [s.b("item"), s.is("active", c !== -1 && d === !1)];
      return o("div", {
        class: p,
        on: {
          click: () => f(),
          dblclick: () => r(i)
        }
      }, [e.layoutPanelProvider ? o(e.layoutPanelProvider.component, {
        props: {
          modelData: e.model,
          context: e.context,
          params: e.params,
          inputData: i
        }
      }) : `${i.deptname}`]);
    }, l = () => e.model.source.enableGroup ? o("el-collapse") : e.items.map((i) => g(i)), m = () => Object.is(e.total, e.items.length) ? null : o("div", {
      class: s.e("no-data")
    }, [o("div", ["\u6682\u65E0\u6570\u636E"])]), h = (i) => {
      d = !0, Object.assign(e.context, {
        n_orgid_eq: e.params.n_orgid_eq
      });
      debugger;
      e.context.calendarCaption = i.deptname, n(i);
    }, u = () => {
      const i = [s.b("item"), s.is("active", d === !0)];
      return e.items.length > 0 ? o("div", {
        class: i,
        on: {
          click: () => h({
            deptid: e.params.n_orgid_eq,
            orgid: e.params.n_orgid_eq,
            srfkey: e.params.n_orgid_eq,
            deptname: e.context.selectedDeptName,
            sysdepartment: void 0
          })
        }
      }, ["\u5168\u90E8"]) : null;
    };
    return L(() => {
      d && (h({
        deptid: e.params.n_orgid_eq,
        orgid: e.params.n_orgid_eq,
        srfkey: e.params.n_orgid_eq,
        deptname: e.context.selectedDeptName,
        sysdepartment: void 0
      }), e.selectedData.length = 0);
    }), k(() => e.items, () => {
      L(() => {
        d = !0, Object.assign(e.context, {
          n_orgid_eq: e.params.n_orgid_eq
        }), h({
          deptid: e.params.n_orgid_eq,
          orgid: e.params.n_orgid_eq,
          srfkey: e.params.n_orgid_eq,
          deptname: e.context.selectedDeptName,
          sysdepartment: void 0
        }), e.selectedData.length = 0;
      });
    }, {
      immediate: !0,
      deep: !0
    }), {
      c: e,
      ns: s,
      renderListContent: l,
      renderLoadMore: m,
      renderAll: u,
      renderAllClick: h,
      isSelectAll: d
    };
  },
  render() {
    return o("control-layout", {
      class: [this.ns.b()],
      attrs: {
        modelData: this.c.model
      }
    }, [this.c.complete && [this.renderAll(), this.renderListContent(), this.renderLoadMore()]]);
  }
});
const Oe = C({
  name: "ListExpSelectTreeView",
  components: {
    Treeselect: ue,
    ListExpControl: I
  },
  props: {
    context: Object,
    params: {
      type: Object
    },
    srfnav: String,
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(t) {
    const {
      proxy: a
    } = P(), s = Q(a, t.modelPath), e = x(""), n = x([]), r = b("list-exp-select-tree");
    s.context.isRouter === !0 && s.nerve.self.evt.on("created", () => {
      t.srfnav && (s.navItem.key = t.srfnav, n.value = [t.srfnav]), X(B(s.navItem, "key"), a, e);
    });
    const d = [`${s.context.srforgid}`];
    s.context.srforgid && (s.context.selectedDeptName = s.context.srforgname, Object.assign(s.params, {
      n_orgid_eq: s.context.srforgid
    }));
    const g = (u) => ({
      id: u.id,
      label: u.text,
      children: u.children
    }), l = (u) => {
      s.context.selectedDeptName = u.text, Object.assign(s.params, {
        n_orgid_eq: u.value
      }), s.nerve.list.call.load();
    }, m = x(!1);
    return {
      c: s,
      defaultSelectKeys: n,
      routeViewKey: e,
      normalizer: g,
      select: l,
      dataItems: [],
      isLoadCodeList: m,
      value: d,
      ns: r
    };
  },
  render() {
    if (this.c.complete) {
      const t = this.c.context.isRouter === !0, {
        listExpBar: a
      } = this.c.model, {
        list: s
      } = a, e = this.c.model.codeName;
      if (this.dataItems.length === 0 && e === "SysDepartmentKqAYTJListExp1View") {
        const {
          codeName: n
        } = this.c.model.source.getQuickGroupPSCodeList();
        (async (d) => {
          this.dataItems = await ibiz.codeListService.get(d, this.c.context, {
            size: 1e3
          }), this.isLoadCodeList = !0;
        })(n);
      }
      return o("exp-view-base", {
        class: [this.ns.b()],
        attrs: {
          controller: this.c,
          expBarModel: this.c.model.listExpBar
        },
        scopedSlots: {
          default: () => o(I, {
            attrs: {
              modelData: s,
              context: this.c.context,
              params: this.c.params,
              isExpView: !0,
              isSelectFirstDefault: !1,
              mdCtrlActiveMode: 1,
              defaultSelectKeys: this.defaultSelectKeys
            },
            on: {
              neuronInit: this.c.nerve.onNeuronInit(s.name)
            }
          }),
          searchForm: () => this.isLoadCodeList && e === "SysDepartmentKqAYTJListExp1View" ? o("div", {
            class: "ibiz-selectTree"
          }, [o("treeselect", {
            attrs: {
              value: this.value,
              options: this.dataItems,
              normalizer: this.normalizer,
              clearable: !1,
              "default-expand-level": 1
            },
            on: {
              select: this.select
            }
          })]) : e === "SysDepartmentkqBmtjListExpView" ? o("div", {
            class: "ibiz-bmtj"
          }, [o("div", {
            class: "ibiz-bmyj-content"
          }, [this.c.context.srforgname])]) : null,
          expView: () => s.navView ? t ? this.routeViewKey ? o("router-view", {
            key: this.routeViewKey
          }) : null : o("ViewShell", {
            props: {
              context: this.c.navItem.context,
              params: this.c.navItem.params,
              modal: {
                mode: T.EMBED
              },
              modelPath: s.navView.source.modelPath
            },
            key: this.c.navItem.key
          }) : null
        }
      });
    }
    return null;
  }
});
class Re {
  constructor() {
    y(this, "component", "ListExpSelectTreeView");
  }
}
class Ke {
  constructor() {
    y(this, "component", "BYQKEditView");
  }
}
class Te {
  constructor() {
    y(this, "formEditor", "KqBase64ImageUpload");
    y(this, "gridEditor", "IBizGridFileUpload");
  }
  async createController(a, s) {
    const e = new le(a, s);
    return await e.init(), e;
  }
}
const Fe = C({
  name: "KqBase64ImageUpload",
  props: Z(),
  emits: ee(),
  setup(t) {
    var n, r, d, g;
    const a = b("kq-base64-image-upload"), s = ((r = (n = t.controller) == null ? void 0 : n.model) == null ? void 0 : r.width) || "auto", e = ((g = (d = t.controller) == null ? void 0 : d.model) == null ? void 0 : g.height) || "150px";
    return () => o("div", {
      class: a.b(),
      style: {
        width: s,
        height: e
      }
    }, [o("img", {
      attrs: {
        src: t.value
      },
      class: a.e("image")
    })]);
  }
}), et = {
  mateUrl: import.meta.url,
  install(t) {
    t.component("UserIndexView", be), t.component("UserAppLayout", we), t.component("ListExpSelectTreeView", Oe), t.component("ListExpControl", I), t.component(
      "BYQKEditView",
      () => import("./byqk-edit-view.fea98c06.js")
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_JskqIndexView",
      new pe()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_ListExpSelectTreeView",
      new Re()
    ), D.loadStyle(["/style.css"]), ibiz.register.portletPart.register(
      "PORTLET_CUSTOM_JskqWebPortalSearchHeader",
      new De()
    ), ibiz.register.portletPart.register(
      "PORTLET_CUSTOM_jskqWebPortalMapArea",
      new Ee()
    ), ibiz.register.control.register(
      "LIST_RENDER_JskqWebKqqkList",
      new $e()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_ByqkCustomEditView",
      new Ke()
    ), t.component("KqBase64ImageUpload", Fe), ibiz.register.editor.register(
      "PICTURE_ONE_Base64ImageUpload",
      new Te()
    );
  }
};
export {
  et as default
};
