import { n as e } from "./chunk-TYymryXo.mjs";
import { i as t } from "./guanlihoutailiuchengrenwushili-B2SkD7uU.mjs";
import { a as n, r } from "./enum-B6bAjZjy.mjs";
import { a as i } from "./enum-DwLgP6qZ.mjs";
import { t as a } from "./drawerHandle-CxkWBtaG.mjs";
import { useUserStore as o } from "pubinfo";
import { createBlock as s, createCommentVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, openBlock as f, ref as p, unref as m, withCtx as h } from "vue";
import { useRoute as g } from "vue-router";
import { Button as _, Space as v } from "ant-design-vue/es";
//#region src/pages/flow-manage/components/operateButton.vue?vue&type=script&setup=true&lang.ts
var y = /* @__PURE__ */ d({
	name: "OperateButton",
	__name: "operateButton",
	emits: ["refresh"],
	setup(e, { expose: d, emit: y }) {
		let b = y, x = p(), S = o(), C = p(null), w = p(null), T = p(null);
		function E(e) {
			let t = !1;
			return (r.APPROVE === e || r.REJECT === e || r.CANCEL === e) && (t = !0), t;
		}
		function D(e) {
			let t = !0;
			return C.value?.buttonsSetting && C.value?.buttonsSetting[e] && (t = C.value.buttonsSetting[e].enable), t;
		}
		function O() {
			let e = !1;
			return n.RUNNING === C.value?.status && (e = !0), e;
		}
		let k = g();
		function A() {
			let e = k.query.taskId;
			t({ id: e }).then((e) => {
				b("refresh");
			});
		}
		function j(e, t, n) {
			x.value?.open(e, t, n);
		}
		function M(e) {
			C.value = e;
		}
		function N(e) {
			w.value = e;
		}
		function P(e) {
			T.value = e;
		}
		return d({
			loadTodoTask: M,
			loadProcessInstance: N,
			loadProcessDefinition: P
		}), (e, t) => {
			let n = _, r = v;
			return f(), s(r, null, {
				default: h(() => [
					C.value && O() && D(m(i).APPROVE) ? (f(), s(n, {
						key: 0,
						type: "primary",
						onClick: t[0] ||= (e) => j(m(i).APPROVE, C.value)
					}, {
						default: h(() => [...t[10] ||= [l(" 通过 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value && O() && D(m(i).REJECT) ? (f(), s(n, {
						key: 1,
						danger: "",
						onClick: t[1] ||= (e) => j(m(i).REJECT, C.value)
					}, {
						default: h(() => [...t[11] ||= [l(" 拒绝 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value && O() && D(m(i).COPY) ? (f(), s(n, {
						key: 2,
						type: "text",
						onClick: t[2] ||= (e) => j(m(i).COPY, C.value)
					}, {
						default: h(() => [...t[12] ||= [l(" 抄送 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value && O() && D(m(i).TRANSFER) ? (f(), s(n, {
						key: 3,
						type: "text",
						onClick: t[3] ||= (e) => j(m(i).TRANSFER, C.value)
					}, {
						default: h(() => [...t[13] ||= [l(" 转办 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value && O() && D(m(i).DELEGATE) ? (f(), s(n, {
						key: 4,
						type: "text",
						onClick: t[4] ||= (e) => j(m(i).DELEGATE, C.value)
					}, {
						default: h(() => [...t[14] ||= [l(" 委派 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value && O() && D(m(i).ADD_SIGN) ? (f(), s(n, {
						key: 5,
						type: "text",
						onClick: t[5] ||= (e) => j(m(i).ADD_SIGN, C.value)
					}, {
						default: h(() => [...t[15] ||= [l(" 加签 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value?.children?.length > 0 ? (f(), s(n, {
						key: 6,
						type: "text",
						onClick: t[6] ||= (e) => j(m(i).DELETE_SIGN, C.value)
					}, {
						default: h(() => [...t[16] ||= [l(" 减签 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value && O() && D(m(i).RETURN) ? (f(), s(n, {
						key: 7,
						type: "text",
						onClick: t[7] ||= (e) => j(m(i).RETURN, C.value)
					}, {
						default: h(() => [...t[17] ||= [l(" 退回 ", -1)]]),
						_: 1
					})) : c("", !0),
					C.value && C.value.needClaim ? (f(), s(n, {
						key: 8,
						size: "small",
						type: "primary",
						onClick: A
					}, {
						default: h(() => [...t[18] ||= [l(" 签收 ", -1)]]),
						_: 1
					})) : c("", !0),
					m(S).user.userId === w.value?.startUser?.id && !E(w.value?.status) ? (f(), s(n, {
						key: 9,
						type: "text",
						onClick: t[8] ||= (e) => j(m(i).CANCEL, C.value, w.value)
					}, {
						default: h(() => [...t[19] ||= [l(" 取消 ", -1)]]),
						_: 1
					})) : c("", !0),
					u(a, {
						ref_key: "drawerHandleRef",
						ref: x,
						onSubmit: t[9] ||= (e) => {
							b("refresh");
						}
					}, null, 512)
				]),
				_: 1
			});
		};
	}
}), b = /* @__PURE__ */ e({ default: () => x }), x = y;
//#endregion
export { b as n, x as t };
