import { t as e } from "./_plugin-vue_export-helper-C_T2la-V.mjs";
import { a as t, t as n } from "./enum-B85EHrfY.mjs";
import { n as r, r as i } from "./bpMliuchengjiantingqibiaokongzhiqi-BzQz5DIR.mjs";
import { t as a } from "./drawerListener-DHRRd3X_.mjs";
import { Fragment as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, normalizeClass as m, openBlock as h, ref as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
import { ProTable as b } from "@pubinfo/pro-components";
import { Badge as x, Button as S, Space as C } from "ant-design-vue/es";
import { Modal as w, message as T } from "ant-design-vue";
import { PlusCircleOutlined as E } from "@ant-design/icons-vue";
import './listeners.css';//#region src/pages/flow-create/listeners/index.vue?vue&type=script&setup=true&lang.tsx
var D = {
	"py-10px": "",
	"px-10px": "",
	"w-full": "",
	"h-full": ""
}, O = {
	key: 0,
	class: "green"
}, k = {
	key: 1,
	class: "grey"
}, A = {
	key: 2,
	class: "blue"
}, j = ["onClick"], M = { class: "ml-4px" }, N = ["onClick"], P = { class: "ml-4px text-red-500!" }, F = /* @__PURE__ */ e(/* @__PURE__ */ p({
	name: "ListenerListPage",
	__name: "index",
	setup(e) {
		let p = g(), F = g();
		async function I(e) {
			let { current: t, pageSize: n, ...r } = e, a = await i({
				doSearchTotal: !0,
				currentPage: t,
				pageSize: n,
				...r
			});
			return {
				success: a.success,
				data: a.data?.records ?? [],
				total: a.data?.total ?? 0
			};
		}
		let L = [
			{
				hideInSearch: !0,
				title: "编号",
				dataIndex: "id",
				ellipsis: !0
			},
			{
				valueType: "a-input",
				bind: "value",
				title: "名字",
				dataIndex: "name",
				ellipsis: !0,
				fieldProps: {
					placeholder: "请输入名字",
					allowClear: !0
				}
			},
			{
				valueType: "a-select",
				title: "类型",
				dataIndex: "type",
				ellipsis: !0,
				fieldProps: {
					placeholder: "请选择类型",
					allowClear: !0,
					options: t
				}
			},
			{
				hideInSearch: !0,
				title: "状态",
				dataIndex: "status",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "事件",
				dataIndex: "event",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "值类型",
				dataIndex: "valueType",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "值",
				dataIndex: "value",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "创建时间",
				dataIndex: "createTime",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				width: 200,
				title: "操作",
				dataIndex: "action",
				fixed: "right"
			}
		];
		function R() {
			F.value?.reload();
		}
		function z(e, t) {
			switch (e) {
				case n.ADD:
					p.value?.open(n.ADD);
					break;
				case n.EDIT:
					p.value?.open(n.EDIT, t);
					break;
				case n.REMOVE:
					w.confirm({
						title: "确定删除该监听器吗?",
						okText: "确认",
						okType: "danger",
						cancelText: "取消",
						onOk() {
							r({ id: t.id }).then((e) => {
								e.success && (T.success("删除成功！"), R());
							});
						},
						onCancel() {}
					});
					break;
			}
		}
		return (e, t) => {
			let r = E, i = S, g = x, w = C;
			return h(), l("div", D, [f(v(b), {
				ref_key: "tableRef",
				ref: F,
				"row-key": "id",
				request: I,
				columns: L,
				"auto-height": "",
				scroll: { x: 1100 }
			}, {
				toolbar: y(() => [f(i, {
					type: "primary",
					onClick: t[0] ||= (e) => z(v(n).ADD)
				}, {
					default: y(() => [f(r), d(" " + _(v(n).ADD), 1)]),
					_: 1
				})]),
				bodyCell: y(({ column: e, record: t }) => [
					e.dataIndex === "type" ? (h(), l("span", {
						key: 0,
						class: m([t.type === "task" ? "green" : "blue"])
					}, _(t.type === "task" ? "任务监听器" : "执行监听器"), 3)) : c("", !0),
					e.dataIndex === "status" ? (h(), l(o, { key: 1 }, [t.status === 0 ? (h(), s(g, {
						key: 0,
						status: "success",
						text: "开启"
					})) : (h(), s(g, {
						key: 1,
						status: "default",
						text: "关闭"
					}))], 64)) : c("", !0),
					e.dataIndex === "valueType" ? (h(), l(o, { key: 2 }, [
						t.valueType === "expression" ? (h(), l("span", O, " 表达式 ")) : c("", !0),
						t.valueType === "delegateExpression" ? (h(), l("span", k, " 代理表达式 ")) : c("", !0),
						t.valueType === "class" ? (h(), l("span", A, " Java类 ")) : c("", !0)
					], 64)) : c("", !0),
					e.dataIndex === "action" ? (h(), s(w, { key: 3 }, {
						default: y(() => [u("a", {
							class: "flex items-center",
							onClick: (e) => z(v(n).EDIT, t)
						}, [u("span", M, _(v(n).EDIT), 1)], 8, j), u("a", {
							class: "flex items-center hover:opacity-80",
							onClick: (e) => z(v(n).REMOVE, t)
						}, [u("span", P, _(v(n).REMOVE), 1)], 8, N)]),
						_: 2
					}, 1024)) : c("", !0)
				]),
				_: 1
			}, 512), f(a, {
				ref_key: "drawerListenerRef",
				ref: p,
				onSubmit: R
			}, null, 512)]);
		};
	}
}), [["__scopeId", "data-v-3a48bebf"]]);
//#endregion
export { F as default };
