import { t as e } from "./enum-Dkr8RUaO.mjs";
import { t } from "./_plugin-vue_export-helper-C_T2la-V.mjs";
import { r as n } from "./enum-B6bAjZjy.mjs";
import { t as r } from "./bpMliuchengdingyidexinxibiaokongzhiqi-DHqibwmz.mjs";
import { r as i, s as a } from "./guanlihoutailiuchengshili-C0b2OnM9.mjs";
import { Fragment as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
import { ProTable as y } from "@pubinfo/pro-components";
import { useRouter as b } from "vue-router";
import { Modal as x, Space as S, Textarea as C } from "ant-design-vue/es";
import { message as w } from "ant-design-vue";
import './myProcess.css';//#region src/pages/flow-center/myProcess/index.vue?vue&type=script&setup=true&lang.tsx
var T = {
	"py-10px": "",
	"px-10px": "",
	"w-full": "",
	"h-full": ""
}, E = {
	key: 0,
	class: "flex flex-col"
}, D = { key: 0 }, O = { key: 1 }, k = {
	key: 0,
	class: "green"
}, A = {
	key: 1,
	class: "red"
}, j = {
	key: 2,
	class: "grey"
}, M = ["onClick"], N = { class: "ml-4px" }, P = {
	key: 0,
	class: "flex items-center hover:opacity-80"
}, F = ["onClick"], I = {
	key: 1,
	class: "flex items-center hover:opacity-80"
}, L = ["onClick"], R = /* @__PURE__ */ t(/* @__PURE__ */ f({
	name: "MyProcessList",
	__name: "index",
	setup(t) {
		let f = m();
		async function R(e) {
			let { current: t, pageSize: n, ...r } = e, i = await a({
				doSearchTotal: !0,
				currentPage: t,
				pageSize: n,
				...r
			});
			return {
				success: i.success,
				data: i.data?.records ?? [],
				total: i.data?.total ?? 0
			};
		}
		let z = [
			{
				valueType: "a-input",
				bind: "value",
				title: "流程名称",
				dataIndex: "name",
				ellipsis: !0,
				fieldProps: {
					placeholder: "请输入流程名称",
					allowClear: !0
				}
			},
			{
				hideInSearch: !0,
				title: "摘要",
				dataIndex: "summary",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "流程分类",
				dataIndex: "categoryName",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "流程状态",
				dataIndex: "status",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "发起时间",
				dataIndex: "startTime",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "结束时间",
				dataIndex: "endTime",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				width: 200,
				title: "操作",
				dataIndex: "action",
				fixed: "right"
			}
		];
		function B() {
			f.value?.reload();
		}
		let V = b(), H = m(""), U = m(!1), W = m("");
		function G() {
			i({
				id: H.value,
				reason: W.value
			}).then((e) => {
				e.success && (w.success("流程已取消"), U.value = !1, W.value = "", B());
			});
		}
		function K(t, n) {
			switch (t) {
				case e.DETAIL:
					V.push({
						name: "myProcessDetail",
						params: { processInstanceId: n.id }
					});
					break;
				case e.CANCEL:
					H.value = n.id, U.value = !0;
					break;
				case e.RESTART:
					q(n);
					break;
			}
		}
		async function q(e) {
			if (e?.id && (await r({ id: e.processDefinitionId })).data?.formType === 20) {
				w.error("重新发起流程失败，原因：该流程使用业务表单，不支持重新发起");
				return;
			}
			await V.push({
				name: "QingJia",
				params: { id: e.processDefinitionId },
				query: { processInstanceId: e?.id }
			});
		}
		function J(e) {
			if (e.length === 0) return "";
			for (let t = 0; t < e.length; t++) if (e[t].assigneeUser) return e[t].assigneeUser.nickname;
		}
		return (t, r) => {
			let i = S, a = C, m = x;
			return p(), l("div", T, [d(_(y), {
				ref_key: "tableRef",
				ref: f,
				"row-key": "id",
				request: R,
				columns: z,
				"auto-height": "",
				scroll: { x: 1100 }
			}, {
				bodyCell: v(({ column: t, record: r }) => [
					t.dataIndex === "summary" ? (p(), l(o, { key: 0 }, [r.summary && r.summary.length > 0 ? (p(), l("div", E, [(p(!0), l(o, null, h(r.summary, (e, t) => (p(), l("div", { key: t }, g(e.key) + " : " + g(e.value), 1))), 128))])) : c("", !0)], 64)) : c("", !0),
					t.dataIndex === "status" ? (p(), l(o, { key: 1 }, [r.status === _(n).RUNNING && r.tasks?.length > 0 ? (p(), l(o, { key: 0 }, [r.tasks.length === 1 ? (p(), l("span", D, g(r.tasks[0].assigneeUser?.nickname) + " (" + g(r.tasks[0].name) + ") 审批中 ", 1)) : (p(), l("span", O, g(J(r.tasks)) + " 等 " + g(r.tasks.length) + " 人 (" + g(r.tasks[0].name) + ")审批中 ", 1))], 64)) : (p(), l(o, { key: 1 }, [r.status === _(n).APPROVE ? (p(), l("span", k, " 审批通过 ")) : r.status === _(n).REJECT ? (p(), l("span", A, " 审批不通过 ")) : (p(), l("span", j, " 已取消 "))], 64))], 64)) : c("", !0),
					t.dataIndex === "action" ? (p(), s(i, { key: 2 }, {
						default: v(() => [u("a", {
							class: "flex items-center",
							onClick: (t) => K(_(e).DETAIL, r)
						}, [u("span", N, g(_(e).DETAIL), 1)], 8, M), r.status === _(n).RUNNING ? (p(), l("a", P, [u("span", {
							class: "ml-4px text-red-500!",
							onClick: (t) => K(_(e).CANCEL, r)
						}, g(_(e).CANCEL), 9, F)])) : (p(), l("a", I, [u("span", {
							class: "ml-4px",
							onClick: (t) => K(_(e).RESTART, r)
						}, g(_(e).RESTART), 9, L)]))]),
						_: 2
					}, 1024)) : c("", !0)
				]),
				_: 1
			}, 512), d(m, {
				open: U.value,
				"onUpdate:open": r[1] ||= (e) => U.value = e,
				title: "取消流程",
				onOk: G
			}, {
				default: v(() => [r[2] ||= u("div", null, "原因：", -1), d(a, {
					value: W.value,
					"onUpdate:value": r[0] ||= (e) => W.value = e,
					placeholder: "请输入取消原因"
				}, null, 8, ["value"])]),
				_: 1
			}, 8, ["open"])]);
		};
	}
}), [["__scopeId", "data-v-e5aab97d"]]);
//#endregion
export { R as default };
