import { r as e, t } from "./enum-B85EHrfY.mjs";
import { a as n, r } from "./bpMliuchengfenleikongzhiqi-BXcBcxU0.mjs";
import { t as i } from "./drawerFlowType-C_uz7gLq.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/flow-type/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: "FlowTypeListPage",
	__name: "index",
	setup(f) {
		let A = m(), j = m();
		async function M(e) {
			let { current: t, pageSize: r, ...i } = e, a = await n({
				doSearchTotal: !0,
				currentPage: t,
				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-input",
				bind: "value",
				title: "分类标志",
				dataIndex: "code",
				ellipsis: !0,
				fieldProps: {
					placeholder: "请输入分类标志",
					allowClear: !0
				}
			},
			{
				hideInSearch: !0,
				title: "分类描述",
				dataIndex: "description",
				ellipsis: !0
			},
			{
				valueType: "a-select",
				title: "状态",
				dataIndex: "status",
				ellipsis: !0,
				fieldProps: {
					placeholder: "请选择状态",
					allowClear: !0,
					options: e
				}
			},
			{
				hideInSearch: !0,
				title: "分类排序",
				dataIndex: "sort",
				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(e, n) {
			switch (e) {
				case t.ADD:
					A.value?.open(t.ADD);
					break;
				case t.EDIT:
					A.value?.open(t.EDIT, n);
					break;
				case t.REMOVE:
					S.confirm({
						title: "确定删除该流程类型吗?",
						okText: "确认",
						okType: "danger",
						cancelText: "取消",
						onOk() {
							r({ id: n.id }).then((e) => {
								e.success && (C.success("删除成功！"), P());
							});
						},
						onCancel() {}
					});
					break;
			}
		}
		return (e, n) => {
			let r = 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: n[0] ||= (e) => F(g(t).ADD)
				}, {
					default: _(() => [d(r), u(" " + h(g(t).ADD), 1)]),
					_: 1
				})]),
				bodyCell: _(({ column: e, record: n }) => [e.dataIndex === "status" ? (p(), c(a, { key: 0 }, [n.status === 1 ? (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(t).EDIT, n)
					}, [l("span", D, h(g(t).EDIT), 1)], 8, E), l("a", {
						class: "flex items-center hover:opacity-80",
						onClick: (e) => F(g(t).REMOVE, n)
					}, [l("span", k, h(g(t).REMOVE), 1)], 8, O)]),
					_: 2
				}, 1024)) : s("", !0)]),
				_: 1
			}, 512), d(i, {
				ref_key: "drawerFlowTypeRef",
				ref: A,
				onSubmit: P
			}, null, 512)]);
		};
	}
});
//#endregion
export { A as default };
