import { ref as E, h as _, defineComponent as N, reactive as A, computed as R, watch as W, onMounted as S, resolveComponent as k, openBlock as p, createElementBlock as h, unref as c, createVNode as l, withCtx as m, createElementVNode as w, createCommentVNode as M, Fragment as Q, renderList as K, createBlock as L, createTextVNode as P, toDisplayString as V } from "vue";
import { Card as Y, InputSearch as O, Tree as U, Button as Z } from "ant-design-vue";
import { useRouter as j } from "vue-router";
import { g as D, o as G, a as X, C as q, W as z, b as H } from "./index.e7201430.js";
import { W as C, a as J, b as $ } from "./WorkflowBackModal.6c390a74.js";
import "sanzhi-form-design-vue3";
import "axios";
const F = E([]), x = E([]);
function ee() {
  return new Promise((o, r) => {
    D("apis").getCategoryTree({ type: "WORKFLOW", parentId: 0 }).then((t) => {
      const { data: n } = t;
      F.value = n, n.length && x.value.push(n[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: n } = o;
  return r ? { color: "success", text: "\u5DF2\u5F52\u6863" } : t === "END" ? { color: "default", text: "\u5DF2\u7EC8\u6B62" } : n ? { 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: u }) {
          const { flowId: d, instanceId: f, id: e, title: b } = u, g = { flowId: d, instanceId: f, taskId: e };
          return _("span", {
            class: "ant-btn-link pointer",
            onClick: function() {
              G({ 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: "\u6D41\u7A0B\u72B6\u6001",
        dataIndex: "status",
        customRender: function({ record: u }) {
          const d = ae(u);
          return _(C, {
            color: d.color,
            value: d.text
          });
        },
        width: 100
      },
      {
        title: "\u4EFB\u52A1\u72B6\u6001",
        dataIndex: "executeType",
        customRender: function({ record: u }) {
          return _(C, {
            dict: "WORKFLOW_EXECUTE_TYPE",
            value: u.status
          });
        },
        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(u) {
              o.modal.openModal({ data: u });
            }
          }
        ]
      }
    ]
  };
}
function B(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": F,
          "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__ */ P("\u5BFC\u51FA"), de = /* @__PURE__ */ N({
  __name: "SanZhiWorkflowCompleted",
  setup(o) {
    const r = j(), t = {};
    function n(a) {
      t.table = a;
    }
    function u(a) {
      t.modal = a;
    }
    function d(a) {
      t.workflowForm = a;
    }
    function f(a) {
      t.backModal = a;
    }
    const e = A({
      locationQuery: X(),
      keyword: "",
      treeData: F,
      fieldNames: {
        children: "children",
        title: "name",
        key: "id"
      },
      selectedKeys: x,
      formProps: B(),
      tableProps: oe(t, r),
      tabsList: [],
      tableQuery: {
        status: 1,
        instanceStatus: ""
      },
      tableData: {},
      loading: !1,
      currentEdit: {},
      openNoticeModal: !1,
      notice: {},
      openEditModal: !1,
      isEdit: !1,
      flowId: ""
    }), b = R(() => !e.locationQuery.noTree);
    W(
      () => e.selectedKeys,
      (a, s) => {
        const y = a[0] || "";
        e.tableQuery.categoryId = y, t.table.reload();
      },
      { deep: !0 }
    );
    function g() {
      return D("apis").getWorkflowTaskPageList;
    }
    function v() {
      const a = t.table.getParams();
      e.loading = !0, D("apis").getWorkflowTaskExport({ ...a }).then((s) => {
      }).finally(() => {
        e.loading = !1;
      });
    }
    return S(() => {
      te().then((a) => {
        e.tabsList = a;
      }), ee().then(() => {
        e.formProps = B(e);
      });
    }), (a, s) => {
      const y = k("a-radio-button"), T = k("a-radio-group");
      return p(), h("div", re, [
        c(b) ? (p(), h("div", ne, [
          l(c(Y), null, {
            default: m(() => [
              w("div", ue, [
                l(c(O), {
                  value: e.keyword,
                  "onUpdate:value": s[0] || (s[0] = (i) => e.keyword = i),
                  placeholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9"
                }, null, 8, ["value"])
              ]),
              w("div", le, [
                l(c(U), {
                  "tree-data": e.treeData,
                  selectedKeys: e.selectedKeys,
                  "onUpdate:selectedKeys": s[1] || (s[1] = (i) => e.selectedKeys = i),
                  fieldNames: e.fieldNames
                }, null, 8, ["tree-data", "selectedKeys", "fieldNames"])
              ])
            ]),
            _: 1
          })
        ])) : M("", !0),
        w("div", se, [
          l(c(q), {
            api: g(),
            autoGet: !1,
            extraParams: e.tableQuery,
            tableProps: e.tableProps,
            formProps: e.formProps,
            onRegister: n
          }, {
            middle: m(() => [
              l(T, {
                value: e.tableQuery.instanceStatus,
                "onUpdate:value": s[2] || (s[2] = (i) => e.tableQuery.instanceStatus = i),
                onChange: t.table.reload
              }, {
                default: m(() => [
                  (p(!0), h(Q, null, K(e.tabsList, (i, I) => (p(), L(y, {
                    value: i.tabParam,
                    key: I
                  }, {
                    default: m(() => [
                      P(V(i.tabName), 1)
                    ]),
                    _: 2
                  }, 1032, ["value"]))), 128))
                ]),
                _: 1
              }, 8, ["value", "onChange"])
            ]),
            formRight: m(() => [
              l(c(Z), {
                type: "primary",
                onClick: v,
                loading: e.loading
              }, {
                default: m(() => [
                  ie
                ]),
                _: 1
              }, 8, ["loading"])
            ]),
            _: 1
          }, 8, ["api", "extraParams", "tableProps", "formProps"])
        ]),
        l(J, { onRegister: u }),
        l($, { onRegister: f }),
        l(z, { onRegister: d })
      ]);
    };
  }
});
const _e = /* @__PURE__ */ H(de, [["__scopeId", "data-v-5fb2950e"]]);
export {
  _e as default
};
