import { n as e, r as t } from "./bpMliuchengbiaodashibiaokongzhiqi-mDhV8ugm.mjs";
import { r as n, t as r } from "./enum-B85EHrfY.mjs";
import { t as i } from "./drawerExpression-dd1eDJii.mjs";
import { Fragment as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, openBlock as p, ref as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
import { ProTable as v } from "@pubinfo/pro-components";
import { Badge as y, Button as b, Space as x } from "ant-design-vue/es";
import { Modal as S, message as C } from "ant-design-vue";
import { PlusCircleOutlined as w } from "@ant-design/icons-vue";
//#region src/pages/flow-create/expression/index.vue?vue&type=script&setup=true&lang.tsx
var T = {
	"py-10px": "",
	"px-10px": "",
	"w-full": "",
	"h-full": ""
}, E = ["onClick"], D = { class: "ml-4px" }, O = ["onClick"], k = { class: "ml-4px text-red-500!" }, A = /* @__PURE__ */ f({
	name: "ExpressionListPage",
	__name: "index",
	setup(f) {
		let A = m(), j = m();
		async function M(e) {
			let { current: n, pageSize: r, ...i } = e, a = await t({
				doSearchTotal: !0,
				currentPage: n,
				pageSize: r,
				...i
			});
			return {
				success: a.success,
				data: a.data?.records ?? [],
				total: a.data?.total ?? 0
			};
		}
		let N = [
			{
				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: "status",
				ellipsis: !0,
				fieldProps: {
					placeholder: "请选择状态",
					allowClear: !0,
					options: n
				}
			},
			{
				hideInSearch: !0,
				title: "表达式",
				dataIndex: "expression",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				title: "创建时间",
				dataIndex: "createTime",
				ellipsis: !0
			},
			{
				hideInSearch: !0,
				width: 200,
				title: "操作",
				dataIndex: "action",
				fixed: "right"
			}
		];
		function P() {
			j.value?.reload();
		}
		function F(t, n) {
			switch (t) {
				case r.ADD:
					A.value?.open(r.ADD);
					break;
				case r.EDIT:
					A.value?.open(r.EDIT, n);
					break;
				case r.REMOVE:
					S.confirm({
						title: "确定删除该表达式吗?",
						okText: "确认",
						okType: "danger",
						cancelText: "取消",
						onOk() {
							e({ id: n.id }).then((e) => {
								e.success && (C.success("删除成功！"), P());
							});
						},
						onCancel() {}
					});
					break;
			}
		}
		return (e, t) => {
			let n = w, f = b, m = y, S = x;
			return p(), c("div", T, [d(g(v), {
				ref_key: "tableRef",
				ref: j,
				"row-key": "id",
				request: M,
				columns: N,
				"auto-height": "",
				scroll: { x: 1100 }
			}, {
				toolbar: _(() => [d(f, {
					type: "primary",
					onClick: t[0] ||= (e) => F(g(r).ADD)
				}, {
					default: _(() => [d(n), u(" " + h(g(r).ADD), 1)]),
					_: 1
				})]),
				bodyCell: _(({ column: e, record: t }) => [e.dataIndex === "status" ? (p(), c(a, { key: 0 }, [t.status === 0 ? (p(), o(m, {
					key: 0,
					status: "success",
					text: "开启"
				})) : (p(), o(m, {
					key: 1,
					status: "default",
					text: "关闭"
				}))], 64)) : s("", !0), e.dataIndex === "action" ? (p(), o(S, { key: 1 }, {
					default: _(() => [l("a", {
						class: "flex items-center",
						onClick: (e) => F(g(r).EDIT, t)
					}, [l("span", D, h(g(r).EDIT), 1)], 8, E), l("a", {
						class: "flex items-center hover:opacity-80",
						onClick: (e) => F(g(r).REMOVE, t)
					}, [l("span", k, h(g(r).REMOVE), 1)], 8, O)]),
					_: 2
				}, 1024)) : s("", !0)]),
				_: 1
			}, 512), d(i, {
				ref_key: "drawerExpressionRef",
				ref: A,
				onSubmit: P
			}, null, 512)]);
		};
	}
});
//#endregion
export { A as default };
