import { ref as B, h as k, defineComponent as N, reactive as A, computed as W, watch as R, onMounted as M, resolveComponent as F, openBlock as p, createElementBlock as h, createVNode as n, unref as m, withCtx as d, createElementVNode as _, createCommentVNode as Q, Fragment as S, renderList as K, createBlock as L, createTextVNode as P, toDisplayString as V } from "vue";
import { Card as x, InputSearch as Y, Tree as U, Button as Z } from "ant-design-vue";
import { useRouter as j } from "vue-router";
import { C as z } from "./index.18983179.js";
import { d as w, n as H, W as O, h as G, p as q, _ as J } from "./index.14fbe0a4.js";
import { W as X } from "./WorkflowBackModal.d7a7566a.js";
import { W as $ } from "./WorkflowFormRenderDrawer.92087c3d.js";
import "axios";
import "./SanZhiFormRenderOA.6d13345d.js";
const D = B([]), v = B([]);
function ee() {
  return new Promise((o, r) => {
    w("apis").getWorkflowCategoryTree({ type: "WORKFLOW", parentId: 0 }).then((t) => {
      const { data: u } = t;
      D.value = u, u.length && v.value.push(u[0].id), o(t);
    }).catch((t) => {
      r(t);
    });
  });
}
function te() {
  return new Promise((o, r) => {
    o([{
      tabName: "\u5168\u90E8",
      tabParam: "",
      tabTitle: "\u5168\u90E8"
    }, {
      tabName: "\u5DF2\u5B8C\u7ED3",
      tabParam: "1",
      tabTitle: "\u5DF2\u5B8C\u7ED3"
    }, {
      tabName: "\u672A\u5B8C\u7ED3",
      tabParam: "0",
      tabTitle: "\u672A\u5B8C\u7ED3"
    }, {
      tabName: "\u5DF2\u7EC8\u6B62",
      tabParam: "2",
      tabTitle: "\u5168\u90E8\u72B6\u6001"
    }, {
      tabName: "\u5DF2\u5F52\u6863",
      tabParam: "3",
      tabTitle: "\u5DF2\u5F52\u6863"
    }]);
  });
}
function ae(o) {
  const { archiveStatus: r, instanceRunStatus: t, instanceStatus: u } = o;
  return r ? { color: "success", text: "\u5DF2\u5F52\u6863" } : t === "END" ? { color: "default", text: "\u5DF2\u7EC8\u6B62" } : u ? { color: "processing", text: "\u5DF2\u5B8C\u7ED3" } : { color: "warning", text: "\u672A\u5B8C\u7ED3" };
}
function oe(o = {}, r) {
  return {
    columns: [
      {
        title: "\u6807\u9898",
        dataIndex: "title",
        customRender: function({ record: i }) {
          const { flowId: c, instanceId: f, id: e, title: b } = i, g = { flowId: c, instanceId: f, taskId: e };
          return k("span", {
            class: "ant-btn-link pointer",
            onClick: function() {
              H({ params: g, router: r });
            }
          }, b);
        },
        width: 350
      },
      {
        title: "\u6D41\u7A0B",
        dataIndex: "flowName",
        width: 150,
        ellipsis: !0
      },
      {
        title: "\u5F53\u524D\u6B65\u9AA4",
        dataIndex: "stepName",
        width: 100,
        ellipsis: !0
      },
      {
        title: "\u53D1\u8D77\u4EBA",
        dataIndex: "senderName",
        width: 100,
        ellipsis: !0
      },
      {
        title: "\u5904\u7406\u4EBA",
        dataIndex: "receiverName",
        width: 100,
        ellipsis: !0
      },
      {
        title: "\u63A5\u6536\u65E5\u671F",
        dataIndex: "receiveTime",
        width: 190
      },
      {
        title: "\u5904\u7406\u65E5\u671F",
        dataIndex: "completedTime",
        width: 190
      },
      {
        title: "\u6D41\u7A0B\u72B6\u6001",
        dataIndex: "instanceStatus",
        customRender: function({ record: i }) {
          const c = ae(i);
          return k(O, {
            color: c.color,
            value: c.text
          });
        },
        width: 100
      },
      {
        title: "\u64CD\u4F5C",
        dataIndex: "actions",
        width: 60,
        fixed: "right",
        buttons: [
          {
            title: "\u6D41\u7A0B\u8F68\u8FF9",
            icon: "fund-outlined",
            props: {
              type: "primary"
            },
            key: "record",
            onClick: function(i) {
              o.modal.openModal({ data: i });
            }
          }
        ]
      }
    ]
  };
}
function C(o = {}) {
  const r = o.tableQuery && o.tableQuery.categoryId, t = o.locationQuery || {};
  return {
    formProps: {
      baseColAttr: {
        span: 4
      },
      columns: [{
        field: "title",
        label: "\u6807\u9898"
      }, {
        field: "sender",
        label: "\u53D1\u8D77\u4EBA"
      }, {
        field: "timeRange",
        label: "\u65F6\u95F4",
        colAttr: {
          span: 6
        },
        timeRangeFieldNames: {
          startTime: "completedStartTime",
          endTime: "completedEndTime"
        },
        component: "a-range-picker",
        componentProps: {
          style: {
            width: "100%"
          },
          valueFormat: "YYYY-MM-DD"
        }
      }, {
        field: "categoryId",
        label: "\u5DE5\u4F5C\u6D41\u7A0B",
        hide: !t.noTree,
        defaultValue: r || "",
        component: "a-tree-select",
        componentProps: {
          "tree-data": D,
          "field-names": {
            children: "children",
            value: "id",
            label: "name"
          },
          treeDefaultExpandAll: !0
        }
      }]
    }
  };
}
const re = { class: "workflow-manage" }, ne = {
  key: 0,
  class: "left"
}, ue = { class: "input-box" }, le = { class: "tree-box" }, se = { class: "right" }, ie = /* @__PURE__ */ N({
  __name: "SanZhiWorkflowPass",
  setup(o) {
    const r = j(), t = {};
    function u(a) {
      t.table = a;
    }
    function i(a) {
      t.modal = a;
    }
    function c(a) {
      t.workflowForm = a;
    }
    function f(a) {
      t.backModal = a;
    }
    const e = A({
      locationQuery: G(),
      keyword: "",
      treeData: D,
      fieldNames: {
        children: "children",
        title: "name",
        key: "id"
      },
      selectedKeys: v,
      formProps: C(),
      tableProps: oe(t, r),
      tabsList: [],
      tableQuery: {
        status: ""
      },
      tableData: {},
      loading: !1,
      currentEdit: {},
      openNoticeModal: !1,
      notice: {},
      openEditModal: !1,
      isEdit: !1,
      flowId: ""
    }), b = W(() => !e.locationQuery.noTree);
    R(
      () => e.selectedKeys,
      (a, l) => {
        const y = a[0] || "";
        e.tableQuery.categoryId = y, t.table.reload();
      },
      { deep: !0 }
    );
    function g() {
      return w("apis").getWorkflowTaskInstanceHandlePageList;
    }
    function E() {
      const a = t.table.getParams();
      e.loading = !0, w("apis.export").getWorkflowTaskInstanceHandleExportExcel({ ...a }).then((l) => {
      }).finally(() => {
        e.loading = !1;
      });
    }
    return M(() => {
      te().then((a) => {
        e.tabsList = a;
      }), ee().then(() => {
        e.formProps = C(e);
      });
    }), (a, l) => {
      const y = F("a-radio-button"), T = F("a-radio-group");
      return p(), h("div", re, [
        b.value ? (p(), h("div", ne, [
          n(m(x), { size: "small" }, {
            default: d(() => [
              _("div", ue, [
                n(m(Y), {
                  value: e.keyword,
                  "onUpdate:value": l[0] || (l[0] = (s) => e.keyword = s),
                  placeholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9"
                }, null, 8, ["value"])
              ]),
              _("div", le, [
                n(m(U), {
                  "tree-data": e.treeData,
                  selectedKeys: e.selectedKeys,
                  "onUpdate:selectedKeys": l[1] || (l[1] = (s) => e.selectedKeys = s),
                  fieldNames: e.fieldNames
                }, null, 8, ["tree-data", "selectedKeys", "fieldNames"])
              ])
            ]),
            _: 1
          })
        ])) : Q("", !0),
        _("div", se, [
          n(m(x), { size: "small" }, {
            default: d(() => [
              n(m(z), {
                api: g(),
                autoGet: !1,
                extraParams: e.tableQuery,
                tableProps: e.tableProps,
                formProps: e.formProps,
                onRegister: u
              }, {
                middle: d(() => [
                  n(T, {
                    value: e.tableQuery.status,
                    "onUpdate:value": l[2] || (l[2] = (s) => e.tableQuery.status = s),
                    onChange: t.table.reload
                  }, {
                    default: d(() => [
                      (p(!0), h(S, null, K(e.tabsList, (s, I) => (p(), L(y, {
                        value: s.tabParam,
                        key: I
                      }, {
                        default: d(() => [
                          P(V(s.tabName), 1)
                        ]),
                        _: 2
                      }, 1032, ["value"]))), 128))
                    ]),
                    _: 1
                  }, 8, ["value", "onChange"])
                ]),
                formRight: d(() => [
                  n(m(Z), {
                    type: "primary",
                    onClick: E,
                    loading: e.loading
                  }, {
                    default: d(() => [
                      P("\u5BFC\u51FA")
                    ]),
                    _: 1
                  }, 8, ["loading"])
                ]),
                _: 1
              }, 8, ["api", "extraParams", "tableProps", "formProps"])
            ]),
            _: 1
          })
        ]),
        n(q, { onRegister: i }),
        n(X, { onRegister: f }),
        n($, { onRegister: c })
      ]);
    };
  }
});
const _e = /* @__PURE__ */ J(ie, [["__scopeId", "data-v-d315c137"]]);
export {
  _e as default
};
