import { t as e } from "./_plugin-vue_export-helper-C_T2la-V.mjs";
import { t } from "./enum-B85EHrfY.mjs";
import { a as n, n as r, o as i, r as a } from "./guanlihoutailiuchengmoxing-BX8VRGil.mjs";
import { t as o } from "./bpMliuchengfenleikongzhiqi-BXcBcxU0.mjs";
import { Fragment as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, onMounted as h, openBlock as g, ref as _, renderList as v, toDisplayString as y, unref as b, withCtx as x, withModifiers as S } from "vue";
import { useRouter as C } from "vue-router";
import { Button as ee, Collapse as te, CollapsePanel as ne, Dropdown as re, Input as ie, Menu as ae, MenuItem as oe, Space as se, Table as w, Tag as T, Tooltip as E } from "ant-design-vue/es";
import { Modal as D, message as O } from "ant-design-vue";
import { CaretRightOutlined as k, PlusCircleOutlined as A, SearchOutlined as j } from "@ant-design/icons-vue";
import './list.css';//#region src/pages/flow-create/flow-model/list.vue?vue&type=script&setup=true&lang.ts
var M = {
	"py-10px": "",
	"px-10px": "",
	"w-full": "",
	"h-full": ""
}, N = {
	"w-full": "",
	"h-full": "",
	bg: "#ffffff",
	"p-10px": "",
	"rounded-8px": "",
	flex: "",
	"flex-col": ""
}, P = { class: "flex items-center justify-between mb-10px border-b border-b-solid border-b-1px border-b-#e8e8e8 pb-10px" }, F = {
	"flex-1": "",
	"h-0px": "",
	"overflow-auto": ""
}, I = {
	"text-16px": "",
	"font-bold": ""
}, L = { key: 0 }, R = { key: 1 }, z = { key: 2 }, ce = { key: 3 }, B = { key: 4 }, V = {
	key: 0,
	class: "blue"
}, H = {
	key: 1,
	class: "green"
}, U = { key: 0 }, W = {
	key: 1,
	flex: "",
	"items-center": ""
}, G = ["onClick"], le = ["onClick"], ue = ["onClick"], de = "background: #f7f7f7;border-radius: 4px;margin-bottom: 24px;border: 0;overflow: hidden", K = /* @__PURE__ */ e(/* @__PURE__ */ m({
	name: "FlowModelList",
	__name: "list",
	setup(e) {
		let m = C(), K = _(""), q = _(["1"]), J = [
			{
				title: "流程名称",
				dataIndex: "name",
				key: "name"
			},
			{
				title: "可见范围",
				dataIndex: "visibleRange",
				key: "visibleRange"
			},
			{
				title: "流程类型",
				dataIndex: "flowType",
				key: "flowType"
			},
			{
				title: "表单信息",
				dataIndex: "formCustomCreatePath",
				key: "formCustomCreatePath"
			},
			{
				title: "最后发布时间",
				dataIndex: "lastPublishTime",
				key: "lastPublishTime"
			},
			{
				title: "操作",
				dataIndex: "action",
				key: "action",
				width: 200
			}
		], Y = _([]), X = _([]), Z = _([]);
		async function Q() {
			let e = await r({ name: K.value });
			e && e.data && (Y.value = e.data);
			let t = await o();
			t && t.data && (X.value = t.data), Z.value = X.value.map((e) => ({
				...e,
				modelList: Y.value.filter((t) => t.categoryName === e.name)
			}));
		}
		h(() => {
			Q();
		});
		function $(e, r) {
			switch (e) {
				case t.ADD:
					m.push({ name: "flowmodelCreate" });
					break;
				case t.EDIT:
					m.push({
						name: "flowmodelUpdate",
						params: {
							type: "edit",
							id: r.id
						}
					});
					break;
				case t.COPY:
					m.push({
						name: "flowmodelUpdate",
						params: {
							type: "copy",
							id: r.id
						}
					});
					break;
				case t.PUBLISH:
					D.confirm({
						title: "发布确认",
						content: "是否确认发布该流程？",
						onOk: () => {
							i({ id: r.id }).then((e) => {
								e.success && (O.success("发布成功"), Q());
							});
						},
						onCancel() {}
					});
					break;
				case t.HISTORY:
					m.push({
						name: "flowmodelDefinition",
						params: { flowKey: r.key }
					});
					break;
				case t.CLEAN:
					D.confirm({
						title: "清理确认",
						content: `是否确认清理流程名字为${r.name}的数据项？`,
						onOk: () => {
							a({ id: r.id }).then((e) => {
								e.success && (O.success("清理成功"), Q());
							});
						},
						onCancel() {}
					});
					break;
				case t.REMOVE:
					D.confirm({
						title: "确定删除该模型吗?",
						okText: "确认",
						okType: "danger",
						cancelText: "取消",
						onOk() {
							n({ id: r.id }).then((e) => {
								e.success && (O.success("删除成功！"), Q());
							});
						},
						onCancel() {}
					});
					break;
			}
		}
		return (e, n) => {
			let r = ie, i = ee, a = E, o = T, m = oe, h = ae, _ = re, C = se, D = w, O = ne, Y = te;
			return g(), u("div", M, [d("div", N, [d("div", P, [p(r, {
				value: K.value,
				"onUpdate:value": n[0] ||= (e) => K.value = e,
				placeholder: "请输入流程模型名关键字，按回车键搜索",
				style: { width: "300px" },
				onPressEnter: Q
			}, {
				prefix: x(() => [p(b(j))]),
				_: 1
			}, 8, ["value"]), p(i, {
				type: "primary",
				onClick: n[1] ||= (e) => $(b(t).ADD)
			}, {
				default: x(() => [p(b(A)), n[4] ||= f(" 新建模型 ", -1)]),
				_: 1
			})]), d("div", F, [p(Y, {
				"active-key": q.value,
				"onUpdate:activeKey": n[3] ||= (e) => q.value = e,
				bordered: !1,
				style: { background: "transparent" }
			}, {
				expandIcon: x((e) => [p(b(k), {
					style: { fontSize: "16px" },
					rotate: e?.isActive ? 90 : 0
				}, null, 8, ["rotate"])]),
				default: x(() => [(g(!0), u(s, null, v(Z.value, (e, r) => (g(), c(O, {
					key: r + 1,
					style: de
				}, {
					header: x(() => [d("span", I, y(`${e.name} (${e.modelList.length})`), 1)]),
					default: x(() => [p(D, {
						columns: J,
						"data-source": e.modelList,
						pagination: !1
					}, {
						bodyCell: x(({ column: e, record: r }) => [
							e.dataIndex === "visibleRange" ? (g(), u(s, { key: 0 }, [!r.startUsers?.length && !r.startDepts?.length ? (g(), u("span", L, " 全部可见 ")) : r.startUsers.length === 1 ? (g(), u("span", R, y(r.startUsers[0].nickname), 1)) : r.startDepts?.length === 1 ? (g(), u("span", z, y(r.startDepts[0].name), 1)) : r.startDepts?.length > 1 ? (g(), u("span", ce, [p(a, null, {
								title: x(() => [f(y(`${r.startDepts.map((e) => e.name).join("、")}`), 1)]),
								default: x(() => [f(" " + y(r.startDepts[0].name) + "等 " + y(r.startDepts.length) + " 个部门可见 ", 1)]),
								_: 2
							}, 1024)])) : (g(), u("span", B, [p(a, null, {
								title: x(() => [f(y(`${r.startUsers.map((e) => e.nickname).join("、")}`), 1)]),
								default: x(() => [f(" " + y(r.startUsers[0].nickname) + "等 " + y(r.startUsers.length) + " 人可见 ", 1)]),
								_: 2
							}, 1024)]))], 64)) : l("", !0),
							e.dataIndex === "flowType" ? (g(), u(s, { key: 1 }, [r.type === 10 ? (g(), u("span", V, " BPMN 设计器 ")) : l("", !0), r.type === 20 ? (g(), u("span", H, " SIMPLE 设计器 ")) : l("", !0)], 64)) : l("", !0),
							e.dataIndex === "lastPublishTime" ? (g(), u(s, { key: 2 }, [r.processDefinition ? (g(), u("div", U, [r.processDefinition?.suspensionState === 2 ? (g(), c(o, {
								key: 0,
								color: "warning"
							}, {
								default: x(() => [...n[5] ||= [f(" 已停用 ", -1)]]),
								_: 1
							})) : (g(), u("div", W, [d("span", null, y(r.processDefinition.deploymentTime), 1), p(o, {
								class: "ml-6px!",
								color: "green"
							}, {
								default: x(() => [f(" v" + y(r.processDefinition.version), 1)]),
								_: 2
							}, 1024)]))])) : (g(), c(o, {
								key: 1,
								color: "warning"
							}, {
								default: x(() => [...n[6] ||= [f(" 未发布 ", -1)]]),
								_: 1
							}))], 64)) : l("", !0),
							e.dataIndex === "action" ? (g(), c(C, {
								key: 3,
								class: "btn-panel"
							}, {
								default: x(() => [
									p(i, {
										type: "link",
										onClick: (e) => $(b(t).EDIT, r)
									}, {
										default: x(() => [f(y(b(t).EDIT), 1)]),
										_: 1
									}, 8, ["onClick"]),
									p(i, {
										type: "link",
										onClick: (e) => $(b(t).COPY, r)
									}, {
										default: x(() => [f(y(b(t).COPY), 1)]),
										_: 1
									}, 8, ["onClick"]),
									p(i, {
										type: "link",
										onClick: (e) => $(b(t).PUBLISH, r)
									}, {
										default: x(() => [f(y(b(t).PUBLISH), 1)]),
										_: 1
									}, 8, ["onClick"]),
									p(_, null, {
										overlay: x(() => [p(h, null, {
											default: x(() => [
												r.processDefinition ? (g(), c(m, { key: 0 }, {
													default: x(() => [d("a", {
														class: "text-[#1677ff]! hover:text-[#69b1ff]!",
														onClick: (e) => $(b(t).HISTORY, r)
													}, y(b(t).HISTORY), 9, G)]),
													_: 2
												}, 1024)) : l("", !0),
												p(m, null, {
													default: x(() => [d("a", {
														class: "text-[#1677ff]! hover:text-[#69b1ff]!",
														onClick: (e) => $(b(t).CLEAN, r)
													}, y(b(t).CLEAN), 9, le)]),
													_: 2
												}, 1024),
												p(m, null, {
													default: x(() => [d("a", {
														class: "text-[#1677ff]! hover:text-[#69b1ff]!",
														onClick: (e) => $(b(t).REMOVE, r)
													}, y(b(t).REMOVE), 9, ue)]),
													_: 2
												}, 1024)
											]),
											_: 2
										}, 1024)]),
										default: x(() => [d("a", {
											class: "ant-dropdown-link",
											onClick: n[2] ||= S(() => {}, ["prevent"])
										}, " 更多 ")]),
										_: 2
									}, 1024)
								]),
								_: 2
							}, 1024)) : l("", !0)
						]),
						_: 1
					}, 8, ["data-source"])]),
					_: 2
				}, 1024))), 128))]),
				_: 1
			}, 8, ["active-key"])])])]);
		};
	}
}), [["__scopeId", "data-v-40bb4894"]]);
//#endregion
export { K as default };
