var R = Object.defineProperty;
var N = (t, a, s) => a in t ? R(t, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[a] = s;
var v = (t, a, s) => (N(t, typeof a != "symbol" ? a + "" : a, s), s);
import { PluginStaticResource as O, ViewMode as T } from "@ibiz-template/runtime";
import { ref as g, watch as k, defineComponent as x, getCurrentInstance as q, onMounted as D, computed as L, h as o, toRefs as I, reactive as F, toRef as K } from "vue";
import { useRouter as B, useRoute as U, useIndexViewController as Y, useNamespace as b, useControlController as W, usePropsWatch as H, useListController as J, useListExpViewController as G, useRouteKey as Q } from "@ibiz-template/vue-util";
import { IndexViewModel as X, PortletPartModel as Z, ViewPortletModel as ee, ListModel as V } from "@ibiz-template/model";
import M from "dayjs";
import { CustomPortletController as te, ViewPortletController as se, EditFormController as ae, ListController as ne } from "@ibiz-template/controller";
import { init as E, registerMap as re } from "echarts";
import { mergeDeepLeft as oe } from "ramda";
import { Treeselect as ie } from "@riophae/vue-treeselect";
const S = new O(import.meta.url);
class le {
  constructor() {
    v(this, "component", "UserIndexView");
  }
}
const ce = (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}`;
}, de = (t) => {
  const { view1: a, appContext: s } = t.params;
  return `/${s}/${a}/${ibiz.env.routePlaceholder}`;
};
function ue(t, a) {
  const s = B(t), e = g(""), n = g(""), r = g([]), p = g([]), y = (h) => {
    h.forEach((u) => {
      const d = r.value.indexOf(u);
      if (d !== -1) {
        r.value.splice(d, 1);
        const l = p.value.findIndex((f) => f.key === u);
        p.value.splice(l, 1);
      }
    });
  };
  return k(
    () => t.$route.path,
    (h, u) => {
      if (h !== u) {
        const d = U(t);
        d.matched.length <= 2 && y(r.value.splice(0)), e.value = ce(d), n.value = de(d);
        const l = p.value.find(
          (f) => f.key === e.value
        );
        if (l)
          l.fullPath = d.fullPath;
        else {
          if (h === n.value)
            return;
          p.value.push({
            key: e.value,
            fullPath: d.fullPath,
            modelPath: "",
            caption: ""
          });
        }
      }
    },
    { deep: !0, immediate: !0 }
  ), k(
    e,
    (h, u) => {
      if (h !== u && h) {
        const d = r.value.indexOf(h);
        d === -1 || r.value.splice(d, 1), r.value.unshift(h);
      }
    },
    { immediate: !0 }
  ), {
    currentKey: e,
    keyHistory: r,
    routeMsgs: p,
    updateRouteMsg: (h, u) => {
      const d = p.value.find((l) => l.key === e.value);
      d && (u.caption && (d.caption = u.caption), u.modelPath && (d.modelPath = u.modelPath));
    },
    closeView: (h = e.value) => {
      y([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 d = p.value.find((l) => l.key === u);
        s.push(d.fullPath);
      }
    },
    deleteRouteCache: y
  };
}
const he = /* @__PURE__ */ x({
  __name: "index-view",
  props: {
    context: null,
    params: { default: () => ({}) },
    modelPath: null
  },
  setup(t) {
    const a = t, { proxy: s } = q(), e = Y(s, a.modelPath), {
      currentKey: n,
      keyHistory: r,
      routeMsgs: p,
      updateRouteMsg: y,
      closeView: i,
      deleteRouteCache: c
    } = ue(s, e), h = (m) => {
      const C = n.value;
      m.evt.on("closeView", () => {
        i(C);
      }), m.evt.on("setTitle", (w) => {
        y(C, { caption: w });
      });
    };
    D(() => {
      setTimeout(() => {
        const m = document.querySelector(".app-loading-x");
        m && (m.style.display = "none");
      }, 300);
    });
    const u = (m) => {
      y(n.value, m);
    }, d = (m) => {
      e.collapseChange = m;
    }, l = () => {
      c(r.value.slice(1));
    };
    window.onpopstate = () => {
      c([r.value[1]]);
    };
    const f = L(() => {
      const m = p.value.find((C) => C.key === n.value);
      return (m == null ? void 0 : m.modelPath) || "";
    });
    return { __sfc: !0, props: a, proxy: s, c: e, currentKey: n, keyHistory: r, routeMsgs: p, updateRouteMsg: y, closeView: i, deleteRouteCache: c, onCreated: h, onViewFound: u, collapseChange: d, onMenuRouteChange: l, currentPath: f };
  }
});
function pe(t, a, s, e, n, r, p, y) {
  var i = typeof t == "function" ? t.options : t;
  a && (i.render = a, i.staticRenderFns = s, i._compiled = !0), e && (i.functional = !0), r && (i._scopeId = "data-v-" + r);
  var c;
  if (p ? (c = function(d) {
    d = d || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !d && typeof __VUE_SSR_CONTEXT__ < "u" && (d = __VUE_SSR_CONTEXT__), n && n.call(this, d), d && d._registeredComponents && d._registeredComponents.add(p);
  }, i._ssrRegister = c) : n && (c = y ? function() {
    n.call(
      this,
      (i.functional ? this.parent : this).$root.$options.shadowRoot
    );
  } : n), c)
    if (i.functional) {
      i._injectStyles = c;
      var h = i.render;
      i.render = function(l, f) {
        return c.call(f), h(l, f);
      };
    } else {
      var u = i.beforeCreate;
      i.beforeCreate = u ? [].concat(u, c) : [c];
    }
  return {
    exports: t,
    options: i
  };
}
var me = 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);
}, fe = [], ye = /* @__PURE__ */ pe(
  he,
  me,
  fe,
  !1,
  null,
  null,
  null,
  null
);
const ve = ye.exports;
function z(t, a) {
  return o("div", {
    class: t.e("logo")
  }, [o("img", {
    class: t.e("logo-img"),
    attrs: {
      src: S.dir("/assets/img/jh.png")
    }
  }), o("div", {
    class: t.e("logo-caption")
  }, [a.caption])]);
}
const ge = x({
  name: "UserAppLayout",
  props: {
    model: {
      type: X,
      required: !0
    },
    isComplete: {
      type: Boolean,
      default: !1
    }
  },
  setup(t, {
    emit: a
  }) {
    const s = b("layout"), e = g(!1), n = () => {
      e.value = !e.value, a("onCollapseChange", e.value);
    }, r = L(() => 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)]
    }, [z(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")
    }, [z(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: S.dir("/assets/img/xs.svg")
      }
    }), o("img", {
      class: this.ns.e("sz"),
      attrs: {
        src: S.dir("/assets/img/sz.svg")
      }
    })])]), o("i-content", {
      class: this.ns.be("content", "main")
    }, [this.$slots.default])])]) : null;
  }
});
class $ extends te {
  constructor() {
    super(...arguments);
    v(this, "options", []);
    v(this, "kqrq", "");
    v(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 = M().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 Ce = x({
  name: "PortletSearchHeader",
  props: {
    modelData: {
      type: Z,
      required: !0
    },
    controller: {
      type: $,
      required: !0
    }
  },
  setup(t) {
    const a = b("portal-search-header"), s = g([]), e = g(new Date()), n = (i) => {
      s.value = i, t.controller.rylx = i.join(","), t.controller.changeViewParams();
    }, r = (i) => {
      e.value = i, t.controller.kqrq = i ? M(i).format("YYYY-MM-DD") : "", t.controller.changeViewParams();
    };
    e.value = new Date(t.controller.kqrq), s.value = t.controller.rylx.split(",");
    const p = M();
    return {
      ns: a,
      selectArray: s,
      selectDate: e,
      options: {
        disabledDate: (i) => {
          const c = M(i);
          return p.isSame(c, "day") || p.isBefore(c, "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 xe {
  constructor() {
    v(this, "component", Ce);
  }
  async createController(a, s, e) {
    const n = new $(
      a,
      s,
      e
    );
    return await n.init(), n;
  }
}
class j extends se {
  constructor() {
    super(...arguments);
    v(this, "data", {});
    v(this, "mapData", []);
    v(this, "pointData", []);
    v(this, "form");
    v(this, "hasLoad", !1);
    v(this, "isloading", !1);
    v(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 ae(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 P = x({
  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 = g();
    let e;
    const n = L(() => {
      const c = 100 / t.colors.length, h = Math.round(t.percent / c);
      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(c) {
            return [`{a|${`${c.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"
          }
        }]
      }]
    });
    D(() => {
      e = E(s.value), e.setOption(r());
    });
    const {
      percent: p,
      colors: y,
      text: i
    } = I(t);
    return k([p, y, i], () => {
      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"
    });
  }
}), be = ["#FF0700", "#FFF400", "#73A0FA"], we = {
  strMapCode: !0,
  visualMap: {
    text: ["\u9AD8", "\u4F4E"],
    min: 0,
    max: 100,
    rangeColor: be
  }
}, ke = "/assets/json/map/jiangsu/{id}.json";
async function Se(t) {
  return (await ibiz.net.axios({
    url: S.dir(ke.replace("{id}", t))
  })).data;
}
function De(t, a) {
  const s = /* @__PURE__ */ new Map(), e = g(""), n = g([]);
  let r;
  const p = g(), y = (l) => {
    const f = {
      cityNames: {},
      noChild: l.features.length === 1
    };
    return l.features.forEach((m) => {
      const { adcode: C, name: w } = m.properties;
      f.cityNames[C] = w;
    }), f;
  }, i = async (l) => {
    if (s.has(l))
      return;
    const f = await Se(l);
    s.set(l, y(f)), re(l, f);
  }, c = (l) => {
    const f = s.get(e.value);
    if (f)
      return f.cityNames[l];
  }, h = () => {
    const l = t(e.value);
    r.setOption(l), r.resize();
  }, u = async (l, f = !1) => {
    f || a("mapChange", { name: l }), s.has(l) || await i(l), e.value = l, n.value.push(l), h();
  }, d = () => {
    if (n.value.length > 1) {
      n.value.pop();
      const l = n.value.pop();
      u(l);
    }
  };
  return D(() => {
    r = E(p.value), window.addEventListener("resize", () => {
      r == null || r.resize();
    }), r.on("click", (l) => {
      l.name !== e.value && u(l.name);
    });
  }), {
    chartRef: p,
    historyNames: n,
    currenName: e,
    changeMap: u,
    getCityName: c,
    goBack: d,
    refresh: h
  };
}
const Pe = x({
  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 = L(() => oe(we, t.options)), {
      chartRef: n,
      historyNames: r,
      changeMap: p,
      getCityName: y,
      goBack: i,
      refresh: c
    } = De((d) => {
      const {
        visualMap: l
      } = e.value, f = {
        geo: {
          map: d
        },
        tooltip: {
          trigger: "item",
          textStyle: {
            color: "#fff",
            fontSize: 12
          },
          backgroundColor: "rgba(0, 0, 0, 0.47)",
          borderWidth: 0,
          extraCssText: "backdrop-filter: blur(3px);"
        },
        visualMap: {
          min: l.min,
          max: l.max,
          text: l.text,
          realtime: !1,
          inRange: {
            color: l.rangeColor
          }
        },
        series: [
          {
            type: "map",
            map: d,
            nameProperty: e.value.strMapCode ? "adcodeStr" : "adcode",
            tooltip: {
              formatter: (m) => {
                const C = y(m.name), w = t.mapData.find((A) => A.name == m.name);
                if (!!w)
                  return `
                      <div style='display:flex;justify-content: space-between;'>
                        <span>${C}</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: (m) => y(m.name)
            },
            select: {
              disabled: !0
            },
            data: t.mapData.map((m) => ({
              name: m.name,
              value: m.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: (m) => m.data.title,
          position: "left",
          offset: [10, -15]
        },
        tooltip: {
          formatter: (m) => {
            const C = m.data;
            return `
                    <div style='display:flex;justify-content: space-between;'>
                      <span>${C.title}</span>
                      <span>${C.zcrs}</span>
                    </div>
                    <div style='display:flex;justify-content: space-between;'>
                      <span>\u6B63\u5E38\u7387\uFF1A</span>
                      <span>${C.zcl}</span>
                    </div>
                  `;
          }
        },
        data: t.pointData.map((m) => ({
          ...m,
          value: [Number(m.jd), Number(m.wd)],
          visualMap: !1
        }))
      }), f;
    }, (d, l) => {
      d === "mapChange" && a("mapChange", l.name);
    });
    D(() => {
      p(t.defaultMapName, !0);
    });
    const {
      mapData: h,
      pointData: u
    } = I(t);
    return k([h, u], () => {
      c();
    }), {
      ns: s,
      chartRef: n,
      historyNames: r,
      goBack: i
    };
  },
  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"])]);
  }
}), Me = x({
  name: "PortalMapArea",
  props: {
    modelData: {
      type: ee,
      required: !0
    },
    controller: {
      type: j,
      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(P, {
      attrs: {
        percent: this.c.data.zcl,
        text: `\u6B63\u5E38\u6570 ${this.c.data.zcrs}`
      }
    }), o(P, {
      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(Pe, {
      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(P, {
      attrs: {
        percent: this.c.data.qjl,
        text: `\u8BF7\u5047\u4EBA\u6570 ${this.c.data.qjrs}`
      }
    }), o(P, {
      attrs: {
        percent: this.c.data.xjl,
        text: `\u4F11\u5047\u4EBA\u6570 ${this.c.data.xjrs}`
      }
    })])]);
  }
});
class qe {
  constructor() {
    v(this, "component", Me);
  }
  async createController(a, s, e) {
    const n = new j(
      a,
      s,
      e
    );
    return await n.init(), n;
  }
}
class Le extends ne {
  constructor() {
    super(...arguments);
    v(this, "unit", "");
    v(this, "isPercent", !1);
    v(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 _e(t, a, s, e = {}) {
  return W(t, () => {
    const n = new Le(a, s, e);
    return H(t, "mdCtrlActiveMode", n.setMdCtrlActiveMode.bind(n)), n;
  });
}
function ze(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 Ie = x({
  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
    } = q(), s = b("kqqk-list"), e = _e(a, t.modelData, t.context, t.params), {
      handleClick: n,
      handleDblClick: r
    } = ze(e), p = (i, c) => {
      const h = e.selectedData.findIndex((d) => d.srfkey === i.srfkey), u = [s.b("item"), s.is("active", h !== -1)];
      return o("div", {
        class: u,
        key: i.srfkey + c,
        on: {
          click: () => n(i),
          dblclick: () => r(i)
        }
      }, [o("span", {
        class: s.be("item", "title")
      }, [i.title]), o("div", {
        class: s.be("item", "progress")
      }, [o("span", {
        style: `width:${i.percent}%;`,
        class: s.be("item", "progress-bar")
      }), o("span", {
        class: s.be("item", "progress-text")
      }, [i.num, e.unit])])]);
    };
    return {
      c: e,
      ns: s,
      renderListContent: () => e.items.map((i, c) => p(i, c))
    };
  },
  render() {
    return o("control-layout", {
      class: this.ns.b(),
      attrs: {
        modelData: this.c.model
      }
    }, [this.c.complete && [this.renderListContent()]]);
  }
});
class Ve {
  constructor() {
    v(this, "component", Ie);
  }
}
function Ee(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 _ = x({
  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
    } = q(), s = b("control-list"), e = J(a, t.modelData, t.context, t.params), {
      handleClick: n,
      handleDblClick: r
    } = Ee(e);
    D(() => {
      k(() => e, (c, h) => {
        if (t.isExpView && c && c !== h) {
          let u = e.items[0];
          if (t.defaultSelectKeys && t.defaultSelectKeys.length > 0) {
            const d = e.items.find((l) => l.srfkey === t.defaultSelectKeys[0]);
            d && (u = d);
          }
          u && e.onSelectionChange([u]);
        }
      }, {
        immediate: !0
      }), k(() => e.items.length, (c) => {
        t.isExpView && c && e.onSelectionChange([e.items[0]]);
      }, {
        immediate: !0,
        deep: !0
      });
    });
    const p = (c) => {
      const h = e.selectedData.findIndex((d) => d.srfkey === c.srfkey), u = [s.b("item"), s.is("active", h !== -1)];
      return o("div", {
        class: u,
        on: {
          click: () => n(c),
          dblclick: () => r(c)
        }
      }, [e.layoutPanelProvider ? o(e.layoutPanelProvider.component, {
        props: {
          modelData: e.model,
          context: e.context,
          params: e.params,
          inputData: c
        }
      }) : `${c.deptname}`]);
    };
    return {
      c: e,
      ns: s,
      renderListContent: () => e.model.source.enableGroup ? o("el-collapse") : e.items.map((c) => p(c)),
      renderLoadMore: () => Object.is(e.total, e.items.length) ? null : o("div", {
        class: s.e("no-data")
      }, [o("div", ["\u6682\u65E0\u6570\u636E"])])
    };
  },
  render() {
    return o("control-layout", {
      class: [this.ns.b()],
      attrs: {
        modelData: this.c.model
      }
    }, [this.c.complete && [this.renderListContent(), this.renderLoadMore()]]);
  }
});
const $e = x({
  name: "ListExpSelectTreeView",
  components: {
    Treeselect: ie,
    ListExpControl: _
  },
  props: {
    context: Object,
    params: {
      type: Object
    },
    srfnav: String,
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(t) {
    const {
      proxy: a
    } = q(), s = G(a, t.modelPath), e = g(""), n = g([]), 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]), Q(K(s.navItem, "key"), a, e);
    });
    const p = [`${s.context.srforgid}`];
    s.context.srforgid && Object.assign(s.params, {
      n_orgid_eq: s.context.srforgid
    });
    const y = (u) => ({
      id: u.id,
      label: u.text,
      children: u.children
    }), i = (u) => {
      Object.assign(s.params, {
        n_orgid_eq: u
      }), s.nerve.list.call.load();
    }, c = g(!1);
    return {
      c: s,
      defaultSelectKeys: n,
      routeViewKey: e,
      normalizer: y,
      input: i,
      dataItems: [],
      isLoadCodeList: c,
      value: p,
      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 (p) => {
          this.dataItems = await ibiz.codeListService.get(p, 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(_, {
            attrs: {
              modelData: s,
              context: this.c.context,
              params: this.c.params,
              isExpView: !0,
              isSelectFirstDefault: !0,
              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: {
              input: this.input
            }
          })]) : 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 je {
  constructor() {
    v(this, "component", "ListExpSelectTreeView");
  }
}
class Ae {
  constructor() {
    v(this, "component", "BYQKEditView");
  }
}
const He = {
  mateUrl: import.meta.url,
  install(t) {
    t.component("UserIndexView", ve), t.component("UserAppLayout", ge), t.component("ListExpSelectTreeView", $e), t.component("ListExpControl", _), t.component(
      "BYQKEditView",
      () => import("./byqk-edit-view.fea98c06.js")
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_JskqIndexView",
      new le()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_ListExpSelectTreeView",
      new je()
    ), S.loadStyle(["/style.css"]), ibiz.register.portletPart.register(
      "PORTLET_CUSTOM_JskqWebPortalSearchHeader",
      new xe()
    ), ibiz.register.portletPart.register(
      "PORTLET_CUSTOM_jskqWebPortalMapArea",
      new qe()
    ), ibiz.register.control.register(
      "LIST_RENDER_JskqWebKqqkList",
      new Ve()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_ByqkCustomEditView",
      new Ae()
    );
  }
};
export {
  He as default
};
