var V = Object.defineProperty;
var Z = (e, t, s) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var M = (e, t, s) => (Z(e, typeof t != "symbol" ? t + "" : t, s), s);
import { GridModel as _, ModelUtil as Y, IndexViewModel as J } from "@ibiz-template/model";
import { defineComponent as x, h as i, getCurrentInstance as U, computed as w, ref as g, watch as N, onUnmounted as Q, onMounted as X } from "vue";
import { useNamespace as v, useGridController as K } from "@ibiz-template/vue-util";
import { PluginStaticResource as L } from "@ibiz-template/runtime";
var ee = Object.defineProperty, te = (e, t, s) => t in e ? ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, G = (e, t, s) => (te(e, typeof t != "symbol" ? t + "" : t, s), s);
const se = x({
  name: "WFToolbar",
  props: {
    wfLinks: {
      type: Array,
      required: !0
    }
  },
  setup(e, {
    emit: t
  }) {
    const s = v("wf-toolbar"), n = async (o, u) => {
      t("wf-link-click", o, u);
    };
    return {
      ns: s,
      handleClick: async (o, u) => {
        setTimeout(() => {
          n(o, u);
        }, 30);
      }
    };
  },
  render() {
    const e = this.wfLinks || [];
    return i("div", {
      class: `${this.ns.b()}`
    }, [e.length > 0 && e.map((t) => {
      const s = t.sequenceFlowName.startsWith("驳回") || t.sequenceFlowName.startsWith("取消");
      return i("div", {
        key: t.sequenceFlowId,
        class: [this.ns.e("item"), s ? this.ns.em("item", "reject") : ""]
      }, [i("i-button", {
        attrs: {
          title: t.sequenceFlowName
        },
        on: {
          click: (n) => this.handleClick(t, n)
        }
      }, [t.sequenceFlowName || ""])]);
    })]);
  }
});
function O(e, t) {
  var s, n;
  const o = [];
  e.source.columnType === "GROUPGRIDCOLUMN" && e.children.forEach((l) => {
    o.push(O(l, t));
  });
  const u = {
    title: e.title,
    width: e.source.widthUnit === "STAR" ? void 0 : e.width,
    minWidth: e.width,
    align: ((s = e.source.align) == null ? void 0 : s.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,
    userParams: e.source.userParams,
    className: (n = e.source.getCellPSSysCss()) == null ? void 0 : n.cssName
  };
  return o.length > 0 && Object.assign(u, { children: o }), u;
}
function oe(e) {
  const t = e.model, s = [], n = t.columns.map((o) => O(o, e));
  return t.children.forEach((o) => {
    const u = n.find((l) => l.key === o.codeName);
    u && s.push(u);
  }), e.singleSelect || s.splice(0, 0, { type: "selection", width: 60 }), s;
}
function ne(e) {
  const t = g([]);
  return e.nerve.self.evt.on("created", () => {
    t.value = oe(e);
  }), [w(() => {
    const s = [...t.value];
    if (!s.find((o) => !o.width)) {
      let o = s.length - 1;
      s[o].key === "rowEdit" && (o -= 1), s[o] = {
        ...s[o],
        width: void 0
      };
    }
    const n = s.find((o) => o.columnType === "UAGRIDCOLUMN");
    if (n) {
      const o = n.userParams;
      o && o.fixed === "true" && (n.fixed = "right");
    }
    return s;
  }), t];
}
function ie(e) {
  const t = (l) => e.items.find((d) => d.srfkey === l.srfkey);
  function s(l) {
    const d = t(l);
    if (e.singleSelect) {
      const h = e.selectedData.find(
        (m) => m.srfkey === l.srfkey
      );
      e.onSelectionChange(h ? [] : [d]);
    }
    e.onRowClick(d);
  }
  function n(l) {
    e.onDbRowClick(t(l));
  }
  function o(l) {
    if (!e.singleSelect) {
      const d = [];
      l.forEach((h) => {
        const m = t(h);
        m && d.push(m);
      }), e.onSelectionChange(d);
    }
  }
  function u(l) {
    const { column: d, order: h } = l, m = h === "asc" || h === "desc" ? h : void 0;
    e.setSort(d.fieldName, m), e.load();
  }
  return { onRowClick: s, onDbRowClick: n, onSelectionChange: o, onSortChange: u };
}
function ae(e) {
  function t(o) {
    !o || o === e.curPage || (e.curPage = o, e.load());
  }
  function s(o) {
    !o || o === e.size || (e.size = o, e.curPage === 1 && e.load());
  }
  function n() {
    e.curPage = 1, e.load();
  }
  return { onPageChange: t, onPageSizeChange: s, onPageReset: n };
}
const le = x({
  props: {
    modelData: _,
    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
    } = U(), s = v("grid"), n = K(t, e.modelData, e.context, e.params), [o] = ne(n), {
      onRowClick: u,
      onDbRowClick: l,
      onSelectionChange: d,
      onSortChange: h
    } = ie(n), {
      onPageChange: m,
      onPageReset: E,
      onPageSizeChange: A
    } = ae(n), j = w(() => {
      var a, r;
      const c = (r = (a = e.modelData) == null ? void 0 : a.source.getPSControlParam()) == null ? void 0 : r.ctrlParams;
      return (c == null ? void 0 : c.HIGHLIGHT) !== "false";
    });
    let b = null;
    const B = (a, r) => {
      b != null && window.clearTimeout(b), b = window.setTimeout(() => {
        const c = t.$refs.grid;
        c && (n.selectedData.find((p) => p.srfkey === a.srfkey) && c.clearCurrentRow(), c.toggleSelect && c.toggleSelect(r)), u(a);
      }, 300);
    }, H = (a) => {
      b != null && window.clearTimeout(b);
      const r = t.$refs.grid;
      r && (n.selectedData.find((c) => c.srfkey === a.srfkey) || r.clearCurrentRow()), l(a);
    }, C = g(0), f = g(null), k = g(null);
    let y = null, z = 0;
    const D = () => {
      var a;
      if (f.value && ((a = e.modal) == null ? void 0 : a.mode) !== "EMBED")
        if (n.model.source.enablePagingBar && k.value) {
          const r = k.value.$el, c = r.offsetHeight + parseFloat(window.getComputedStyle(r).paddingTop);
          C.value = f.value.offsetHeight - c;
        } else
          C.value = f.value.offsetHeight;
      n.model.source.height > 0 && (C.value = n.model.source.height);
    };
    N(f, (a, r) => {
      a && a !== r && (D(), window.ResizeObserver && f.value && (y = new ResizeObserver((c) => {
        const p = c[0].contentRect.height;
        p !== z && (D(), z = p);
      }), y.observe(f.value)));
    }), Q(() => {
      y && y.disconnect();
    });
    const W = w(() => [{
      hiddenRow: !0
    }, ...n.items]), S = v("grid-field-column"), $ = v("collaborative-satisfaction-grid"), P = g([]), q = w(() => {
      const a = [...o.value];
      return a.splice(1, 0, ...P.value), a;
    }), R = g([]);
    return N(() => n.items, () => {
      P.value = [], R.value = [], Array.isArray(n.items) && (P.value = n.items.map((a) => {
        const r = a.bpjbm, c = a.type;
        return {
          title: r,
          width: 120,
          minWidth: 120,
          align: "right",
          key: c,
          ellipsis: !0,
          tooltip: !1,
          resizable: !0,
          render: (p, {
            index: F
          }) => {
            const I = R.value[F - 1];
            return i("div", {
              class: [S.b()],
              style: S.cssVarBlock({
                "justify-content": "flex-end"
              })
            }, [i("span", {
              class: S.e("text")
            }, [(I == null ? void 0 : I[c]) || ""])]);
          }
        };
      }), R.value = n.items.map((a) => {
        try {
          const r = JSON.parse(a.pjdbs || "[]");
          if (Array.isArray(r) && r.length) {
            const c = {};
            return r.forEach((p) => {
              c[p.type] = p.pjfs || "";
            }), c;
          }
        } catch (r) {
          ibiz.log.error(`${a.pjdbs} 解析错误`);
        }
        return {};
      }));
    }), {
      c: n,
      ns: s,
      columns: o,
      tableData: W,
      onDbRowClick: l,
      onUIRowClick: B,
      onUIDbRowClick: H,
      onSelectionChange: d,
      onSortChange: h,
      onPageChange: m,
      onPageSizeChange: A,
      onPageReset: E,
      tableHeight: C,
      gridRef: f,
      girdPaginationRef: k,
      highlight: j,
      ns2: S,
      ns3: $,
      tableColumns: q
    };
  },
  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] = ({
        row: n,
        index: o
      }) => {
        const u = this.c.rows[o - 1];
        if (n.hiddenRow)
          return i("span", {
            style: "word-break: break-word;white-space: pre-wrap;"
          }, ["隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列隐藏行的列"]);
        if (u)
          return i(this.c.providers[s].component, {
            props: {
              controller: this.c.columns[s],
              row: u
            },
            key: n.srfkey + s
          });
      };
    }), i("control-layout", {
      attrs: {
        modelData: this.c.model
      }
    }, [i("div", {
      ref: "gridRef",
      class: [this.ns.b(), this.ns.is("show-header", !this.c.model.source.hideHeader), this.ns.is("enable-page", this.c.model.source.enablePagingBar), this.ns3.b()]
    }, [i("i-table", {
      ref: "grid",
      attrs: {
        height: this.tableHeight,
        "show-header": !this.c.model.source.hideHeader,
        "highlight-row": this.c.singleSelect && this.highlight,
        data: this.tableData,
        columns: this.tableColumns,
        "row-class-name": (t) => t.hiddenRow ? "hidden-row" : ""
      },
      class: this.ns.b("content"),
      on: {
        "on-row-click": this.onUIRowClick,
        "on-row-dblclick": this.onUIDbRowClick,
        "on-selection-change": this.onSelectionChange,
        "on-sort-change": this.onSortChange
      },
      scopedSlots: e
    }), this.c.model.source.enablePagingBar && i("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 re {
  constructor() {
    G(this, "component", "IndexView");
  }
}
const ce = new L(import.meta.url);
class ue {
  constructor() {
    G(this, "component", "CollaborativeSatisfactionGrid");
  }
}
const de = {
  mateUrl: import.meta.url,
  install(e) {
    Y.getModelService().then((t) => {
      t.app.userParams.autoWidth === "true" && document.getElementsByClassName("app")[0].classList.add("auto-width");
    }), ce.loadStyle(["/style.css"]), e.component("WfToolbar", se), ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", ibiz.register.view.register(
      "VIEW_CUSTOM_GsIndexCSS",
      new re()
    ), e.component(
      "CollaborativeSatisfactionGrid",
      le
    ), ibiz.register.control.register(
      "CUSTOM_CollaborativeSatisfactionGrid",
      new ue()
    );
  }
};
const he = new L(import.meta.url);
class ge {
  constructor() {
    M(this, "component", "IndexView");
  }
}
function T(e, t) {
  return i("div", {
    class: e.e("logo")
  }, [t.appIconPath ? i("img", {
    class: e.e("logo-img"),
    attrs: {
      src: t.appIconPath
    }
  }) : null, i("div", {
    class: e.e("logo-caption")
  }, [t.caption])]);
}
const me = x({
  name: "UserAppLayout",
  props: {
    model: {
      type: J,
      required: !0
    },
    // 视图是否完成加载
    isComplete: {
      type: Boolean,
      default: !1
    },
    // 是否显示分页导航
    isShowTabPageExp: {
      type: Boolean,
      default: !1
    }
  },
  setup(e, {
    emit: t
  }) {
    const s = v("layout"), {
      proxy: n
    } = U(), o = g(!1), u = () => {
      o.value = !o.value, t("onCollapseChange", o.value);
    }, l = w(() => e.model.source.blankMode === !0), d = g("廉洁风险点提示"), h = g(`风险点名称：<br/>
    1、不合理设定绩效考核指标（SY-ZLGL-C005）<br/>
    2、绩效评分有失公允（SY-ZLGL-C006）<br/>
    3、违规调整绩效考核结果（SY-ZLGL-C007）<br/>
    风险描述：<br/>
    1、在制定战略绩效考核方案时，受其他部门请托，不合理设定绩效考核指标，为本人或相关方谋求不正当利益。<br/>
    2、在绩效考核过程中，受其他部门请托，绩效考核打分时有失公平公正，为本人或相关方谋求不正当利益。<br/>
    3、受其他部门请托，违规调整绩效考核小组、公司领导和公司总经理办公会决定的绩效考核结果，为本人或相关方谋求不正当利益。<br/>
    违规行为处罚措施：<br/>
    制定部门绩效考核计划时、绩效考核过程中、反馈绩效考核结果时，发现违规行为及时纠正，对于情节轻微的，未造成损害后果和不良影响的，给予提醒谈话、批评教育或采取岗位调整等组织处理措施。对于情节严重的，根据《中国共产党纪律处分条例》、《中国移动通信集团有限公司员工违纪违规处分条例》（中移人〔2018〕196号）和《中共中国移动通信集团有限公司党组问责工作管理办法》（中移党组〔2021〕23号）等相关规定进行处罚。`);
    return X(() => {
      n.$Modal.warning({
        title: d.value,
        content: h.value,
        okText: "已阅知",
        width: 1e3
      });
    }), {
      ns: s,
      collapseChange: o,
      isBlank: l,
      collapseMenus: u
    };
  },
  render() {
    return this.isComplete ? i("i-layout", {
      class: [this.ns.b(), this.isBlank ? this.ns.m("blank") : "", this.ns.is("collapse", this.collapseChange), this.ns.is("tab", this.isShowTabPageExp)]
    }, [i("i-sider", {
      attrs: {
        "hide-trigger": !0,
        value: this.collapseChange
      },
      class: [this.ns.b("nav"), this.ns.is("collapse", this.collapseChange)]
    }, [T(this.ns, this.model), this.$slots.menu]), i("i-layout", {
      class: [this.ns.b("content")]
    }, [i("i-header", {
      class: this.ns.b("header")
    }, [i("div", {
      class: this.ns.be("header", "left")
    }, [T(this.ns, this.model), i("div", {
      class: this.ns.be("header", "collapse-icon")
    }, [this.collapseChange ? i("ion-icon", {
      attrs: {
        src: "./assets/img/menu-unfold.svg"
      },
      on: {
        click: () => this.collapseMenus()
      }
    }) : i("ion-icon", {
      attrs: {
        src: "./assets/img/menu-fold.svg"
      },
      on: {
        click: () => this.collapseMenus()
      }
    })]), this.model.source.mainMenuAlign === "TOP" ? i("i-menu", {
      class: this.ns.be("header", "menu"),
      attrs: {
        mode: "horizontal",
        "active-name": "1"
      }
    }) : null]), i("div", {
      class: this.ns.be("header", "right")
    }, [i("app-user")])]), i("i-content", {
      class: this.ns.be("content", "main")
    }, [this.$slots.tabPageExp, this.$slots.default])])]) : null;
  }
});
const Ce = {
  mateUrl: import.meta.url,
  install(e) {
    he.loadStyle(["/style.css"]), e.use(de), ibiz.register.view.register(
      "VIEW_CUSTOM_SyZhbgGsWeb",
      new ge()
    ), e.component("AppLayout", me);
  }
};
export {
  Ce as default
};
