import { n as e } from "./chunk-TYymryXo.mjs";
import { t } from "./dist-BWeVpZNn.mjs";
import { t as n } from "./enum-B85EHrfY.mjs";
import { n as r, o as i } from "./bpMliuchengfenleikongzhiqi-BXcBcxU0.mjs";
import { createBlock as a, createTextVNode as o, createVNode as s, defineComponent as c, isRef as l, openBlock as u, reactive as d, ref as f, unref as p, withCtx as m } from "vue";
import { Button as h, Drawer as g, Form as _, FormItem as v, Input as y, InputNumber as b, Radio as x, RadioGroup as S, Space as C, Textarea as w } from "ant-design-vue/es";
import { message as T } from "ant-design-vue";
//#region src/pages/flow-create/flow-type/drawerFlowType.vue?vue&type=script&setup=true&lang.ts
var E = /* @__PURE__ */ c({
	name: "DrawerFlowType",
	__name: "drawerFlowType",
	emits: ["submit"],
	setup(e, { expose: c, emit: E }) {
		let D = E, O = f(), k = {
			name: [{
				required: !0,
				message: "请输入分类名字",
				trigger: "blur"
			}],
			code: [{
				required: !0,
				message: "请输入分类标志",
				trigger: "blur"
			}],
			status: [{
				required: !0,
				message: "请选择状态",
				trigger: "change"
			}],
			sort: [{
				required: !0,
				message: "请输入分类排序",
				trigger: "blur"
			}]
		}, [A, j] = t(!1), M = f(), N = d({ type: "" });
		async function P(e, t) {
			N.type = e, j(!0), e === n.ADD ? O.value = { status: 0 } : e === n.EDIT && t && (O.value = { ...t });
		}
		let [F, I] = t(!1);
		function L() {
			M.value?.validate().then(() => {
				I(!0);
				let e = { ...O.value };
				(N.type === n.ADD ? r : i)(e).then((e) => {
					e.success && (T.success("操作成功！"), j(!1), D("submit"));
				}).finally(() => {
					I(!1);
				});
			});
		}
		function R() {
			j(!1);
		}
		return c({ open: P }), (e, t) => {
			let n = y, r = v, i = w, c = x, d = S, f = b, T = _, E = h, D = C, j = g;
			return u(), a(j, {
				open: p(A),
				"onUpdate:open": t[5] ||= (e) => l(A) ? A.value = e : null,
				title: "流程分类",
				placement: "right",
				width: 520,
				"destroy-on-close": "",
				"footer-style": { textAlign: "right" },
				onClose: R
			}, {
				footer: m(() => [s(D, null, {
					default: m(() => [s(E, { onClick: R }, {
						default: m(() => [...t[8] ||= [o(" 取消 ", -1)]]),
						_: 1
					}), s(E, {
						type: "primary",
						loading: p(F),
						onClick: L
					}, {
						default: m(() => [...t[9] ||= [o(" 提交 ", -1)]]),
						_: 1
					}, 8, ["loading"])]),
					_: 1
				})]),
				default: m(() => [s(T, {
					ref_key: "formRef",
					ref: M,
					model: p(O),
					rules: k,
					"label-col": { span: 5 }
				}, {
					default: m(() => [
						s(r, {
							label: "分类名称",
							name: "name"
						}, {
							default: m(() => [s(n, {
								value: p(O).name,
								"onUpdate:value": t[0] ||= (e) => p(O).name = e,
								maxlength: 30,
								placeholder: "请输入分类名称"
							}, null, 8, ["value"])]),
							_: 1
						}),
						s(r, {
							label: "分类标志",
							name: "code"
						}, {
							default: m(() => [s(n, {
								value: p(O).code,
								"onUpdate:value": t[1] ||= (e) => p(O).code = e,
								maxlength: 30,
								placeholder: "请输入分类标志"
							}, null, 8, ["value"])]),
							_: 1
						}),
						s(r, {
							label: "分类描述",
							name: "description"
						}, {
							default: m(() => [s(i, {
								value: p(O).description,
								"onUpdate:value": t[2] ||= (e) => p(O).description = e,
								placeholder: "请输入分类描述",
								"allow-clear": ""
							}, null, 8, ["value"])]),
							_: 1
						}),
						s(r, {
							label: "状态",
							name: "status"
						}, {
							default: m(() => [s(d, {
								value: p(O).status,
								"onUpdate:value": t[3] ||= (e) => p(O).status = e
							}, {
								default: m(() => [s(c, { value: 1 }, {
									default: m(() => [...t[6] ||= [o(" 开启 ", -1)]]),
									_: 1
								}), s(c, { value: 0 }, {
									default: m(() => [...t[7] ||= [o(" 关闭 ", -1)]]),
									_: 1
								})]),
								_: 1
							}, 8, ["value"])]),
							_: 1
						}),
						s(r, {
							label: "分类排序",
							name: "sort"
						}, {
							default: m(() => [s(f, {
								value: p(O).sort,
								"onUpdate:value": t[4] ||= (e) => p(O).sort = e,
								min: 1,
								max: 100
							}, null, 8, ["value"])]),
							_: 1
						})
					]),
					_: 1
				}, 8, ["model"])]),
				_: 1
			}, 8, ["open"]);
		};
	}
}), D = /* @__PURE__ */ e({ default: () => O }), O = E;
//#endregion
export { D as n, O as t };
