import { n as e } from "./chunk-TYymryXo.mjs";
import { n as t, t as n } from "./selectedInfo-CT8ehCR8.mjs";
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, inject as f, normalizeStyle as p, openBlock as m, reactive as h, ref as g, renderList as _, toDisplayString as v, unref as y, vShow as b, watch as x, withCtx as S, withDirectives as C } from "vue";
import { Button as w, Form as T, FormItem as E, Input as D, Radio as O, RadioGroup as k, Select as A, Switch as j, Table as M, Tag as N } from "ant-design-vue/es";
import { selectUser as P } from "@pubinfo/module-rbac";
//#region src/pages/flow-create/flow-model/createComponents/flow/right-panel/components/customConfiguration.vue?vue&type=script&setup=true&lang.tsx
var F = { "text-14px": "" }, I = /* @__PURE__ */ d({
	name: "CustomConfiguration",
	__name: "customConfiguration",
	setup(e) {
		let d = f("lf"), I = t(), L = n(), R = h({
			display: "flex",
			height: "30px",
			lineHeight: "30px"
		}), z = g({
			approveType: "1",
			rejectHandlerType: "1",
			rejectReturnTaskId: "",
			assignEmptyHandlerType: "1",
			assignEmptyUserIds: [],
			assignStartUserHandlerType: "1",
			buttonsSetting: [],
			fieldsPermission: [],
			signEnable: !1,
			reasonRequire: !1
		}), B = g([]), V = g([]);
		function H() {
			P({
				modelValue: V.value,
				multiple: !0,
				onSubmit(e = []) {
					V.value = e.map((e) => ({
						orgId: e.orgId,
						userId: e.userId,
						userName: e.userName
					}));
				}
			});
		}
		function U(e) {
			V.value = V.value.filter((t) => t.userId !== e.userId);
		}
		x(() => V.value, (e) => {
			z.value.assignEmptyUserIds = e.map((e) => e.userId);
		}, { deep: !0 });
		let W = [
			{
				title: "操作按钮",
				dataIndex: "name",
				key: "name"
			},
			{
				title: "显示名称",
				dataIndex: "displayName",
				key: "displayName"
			},
			{
				title: "启用",
				dataIndex: "enable",
				key: "enable"
			}
		], G = [
			{
				title: "字段名称",
				dataIndex: "name",
				key: "name",
				align: "center"
			},
			{
				title: "只读",
				key: "readonly",
				align: "center"
			},
			{
				title: "可编辑",
				key: "editable",
				align: "center"
			},
			{
				title: "隐藏",
				key: "hidden",
				align: "center"
			}
		], K = i(() => I.getElementById(L.selectId) || {});
		x(K, (e) => {
			z.value = e.customConfiguration || z.value, B.value = q(e).map((e) => ({
				label: e,
				value: e
			}));
		}, {
			immediate: !0,
			deep: !0
		}), x(z, (e) => {
			I.updateElement(L.selectId, { customConfiguration: e }), d.value.setProperties(L.selectId, { customConfiguration: e });
		}, { deep: !0 });
		function q(e) {
			let t = typeof e == "string" ? e : e?.id;
			if (!t) return [];
			let n = /* @__PURE__ */ new Set(), r = [], i = [];
			for ((d.value.getNodeIncomingNode(t) || []).forEach((e) => {
				let n = typeof e == "string" ? e : e?.id, r = typeof e == "object" ? e?.type : void 0;
				n && n !== t && r !== "start-node" && i.push(n);
			}); i.length;) {
				let e = i.pop();
				!e || n.has(e) || (n.add(e), r.push(e), (d.value.getNodeIncomingNode(e) || []).forEach((e) => {
					let r = typeof e == "string" ? e : e?.id, a = typeof e == "object" ? e?.type : void 0;
					r && !n.has(r) && r !== t && a !== "start-node" && i.push(r);
				}));
			}
			return r;
		}
		return (e, t) => {
			let n = O, i = k, d = E, f = A, h = N, g = w, x = D, P = j, I = M, L = T;
			return m(), s("div", null, [u(L, {
				model: y(z),
				name: "basic",
				autocomplete: "off"
			}, {
				default: S(() => [
					u(d, {
						label: "审批类型",
						name: "approveType"
					}, {
						default: S(() => [u(i, {
							value: y(z).approveType,
							"onUpdate:value": t[0] ||= (e) => y(z).approveType = e,
							disabled: y(K).type === "normal-task-node"
						}, {
							default: S(() => [
								u(n, { value: "1" }, {
									default: S(() => [...t[7] ||= [l(" 人工审批 ", -1)]]),
									_: 1
								}),
								u(n, { value: "2" }, {
									default: S(() => [...t[8] ||= [l(" 自动通过 ", -1)]]),
									_: 1
								}),
								u(n, { value: "3" }, {
									default: S(() => [...t[9] ||= [l(" 自动拒绝 ", -1)]]),
									_: 1
								})
							]),
							_: 1
						}, 8, ["value", "disabled"])]),
						_: 1
					}),
					u(d, {
						label: "审批人拒绝时",
						name: "rejectHandlerType"
					}, {
						default: S(() => [u(i, {
							value: y(z).rejectHandlerType,
							"onUpdate:value": t[1] ||= (e) => y(z).rejectHandlerType = e,
							disabled: y(K).type === "normal-task-node"
						}, {
							default: S(() => [u(n, { value: "1" }, {
								default: S(() => [...t[10] ||= [l(" 终止流程 ", -1)]]),
								_: 1
							}), u(n, {
								value: "2",
								disabled: y(B).length === 0
							}, {
								default: S(() => [...t[11] ||= [l(" 驳回到指定节点 ", -1)]]),
								_: 1
							}, 8, ["disabled"])]),
							_: 1
						}, 8, ["value", "disabled"])]),
						_: 1
					}),
					y(z).rejectHandlerType === "2" ? (m(), a(d, {
						key: 0,
						label: "驳回节点",
						name: "rejectReturnTaskId"
					}, {
						default: S(() => [u(f, {
							value: y(z).rejectReturnTaskId,
							"onUpdate:value": t[2] ||= (e) => y(z).rejectReturnTaskId = e,
							style: { width: "100%" },
							placeholder: "请选择驳回节点",
							options: y(B)
						}, null, 8, ["value", "options"])]),
						_: 1
					})) : o("", !0),
					u(d, {
						label: "审批人为空时",
						name: "assignEmptyHandlerType"
					}, {
						default: S(() => [u(i, {
							value: y(z).assignEmptyHandlerType,
							"onUpdate:value": t[3] ||= (e) => y(z).assignEmptyHandlerType = e,
							disabled: y(K).type === "normal-task-node"
						}, {
							default: S(() => [
								u(n, {
									style: p(R),
									value: "1"
								}, {
									default: S(() => [...t[12] ||= [l(" 自动通过 ", -1)]]),
									_: 1
								}, 8, ["style"]),
								u(n, {
									style: p(R),
									value: "2"
								}, {
									default: S(() => [...t[13] ||= [l(" 自动拒绝 ", -1)]]),
									_: 1
								}, 8, ["style"]),
								u(n, {
									style: p(R),
									value: "3"
								}, {
									default: S(() => [...t[14] ||= [l(" 指定用户审批 ", -1)]]),
									_: 1
								}, 8, ["style"]),
								u(n, {
									style: p(R),
									value: "4"
								}, {
									default: S(() => [...t[15] ||= [l(" 转交给流程管理员 ", -1)]]),
									_: 1
								}, 8, ["style"])
							]),
							_: 1
						}, 8, ["value", "disabled"])]),
						_: 1
					}),
					y(z).assignEmptyHandlerType === "3" ? (m(), a(d, {
						key: 1,
						label: "指定用户",
						name: "assignEmptyUserIds"
					}, {
						default: S(() => [(m(!0), s(r, null, _(y(V), (e, t) => (m(), a(h, {
							key: t,
							closable: "",
							onClose: (t) => U(e)
						}, {
							default: S(() => [l(v(e.userName), 1)]),
							_: 2
						}, 1032, ["onClose"]))), 128)), u(g, {
							size: "small",
							type: "primary",
							onClick: H
						}, {
							default: S(() => [...t[16] ||= [l(" 选择人员 ", -1)]]),
							_: 1
						})]),
						_: 1
					})) : o("", !0),
					u(d, {
						label: "审批人与提交人为同一人时",
						name: "assignStartUserHandlerType"
					}, {
						default: S(() => [u(i, {
							value: y(z).assignStartUserHandlerType,
							"onUpdate:value": t[4] ||= (e) => y(z).assignStartUserHandlerType = e,
							disabled: y(K).type === "normal-task-node"
						}, {
							default: S(() => [
								u(n, { value: "1" }, {
									default: S(() => [...t[17] ||= [l(" 由发起人对自己审批 ", -1)]]),
									_: 1
								}),
								u(n, { value: "2" }, {
									default: S(() => [...t[18] ||= [l(" 自动跳转 ", -1)]]),
									_: 1
								}),
								u(n, { value: "3" }, {
									default: S(() => [...t[19] ||= [l(" 转交给部分负责人审批 ", -1)]]),
									_: 1
								})
							]),
							_: 1
						}, 8, ["value", "disabled"])]),
						_: 1
					}),
					t[20] ||= c("div", { "text-14px": "" }, " 操作按钮： ", -1),
					u(I, {
						class: "my-16px",
						size: "small",
						bordered: "",
						columns: W,
						"data-source": y(z).buttonsSetting,
						pagination: !1
					}, {
						bodyCell: S(({ column: e, record: t }) => [e.key === "displayName" ? (m(), a(x, {
							key: 0,
							value: t.displayName,
							"onUpdate:value": (e) => t.displayName = e,
							disabled: y(K).type === "normal-task-node"
						}, null, 8, [
							"value",
							"onUpdate:value",
							"disabled"
						])) : e.key === "enable" ? (m(), a(P, {
							key: 1,
							checked: t.enable,
							"onUpdate:checked": (e) => t.enable = e,
							disabled: y(K).type === "normal-task-node"
						}, null, 8, [
							"checked",
							"onUpdate:checked",
							"disabled"
						])) : o("", !0)]),
						_: 1
					}, 8, ["data-source"]),
					C(c("div", F, " 字段权限： ", 512), [[b, !1]]),
					C(u(I, {
						class: "my-16px",
						size: "small",
						bordered: "",
						columns: G,
						"data-source": y(z).fieldsPermission,
						pagination: !1,
						"row-key": "key"
					}, {
						bodyCell: S(({ column: e, record: t }) => [
							e.key === "editable" ? (m(), a(n, {
								key: 0,
								checked: t.permission === "2",
								disabled: y(K).type === "normal-task-node",
								onChange: (e) => {
									t.permission = "2";
								}
							}, null, 8, [
								"checked",
								"disabled",
								"onChange"
							])) : o("", !0),
							e.key === "readonly" ? (m(), a(n, {
								key: 1,
								checked: t.permission === "1",
								disabled: y(K).type === "normal-task-node",
								onChange: (e) => {
									t.permission = "1";
								}
							}, null, 8, [
								"checked",
								"disabled",
								"onChange"
							])) : o("", !0),
							e.key === "hidden" ? (m(), a(n, {
								key: 2,
								checked: t.permission === "3",
								disabled: y(K).type === "normal-task-node",
								onChange: (e) => {
									t.permission = "3";
								}
							}, null, 8, [
								"checked",
								"disabled",
								"onChange"
							])) : o("", !0)
						]),
						_: 1
					}, 8, ["data-source"]), [[b, !1]]),
					u(d, {
						label: "是否需要签名",
						name: "signEnable"
					}, {
						default: S(() => [u(P, {
							checked: y(z).signEnable,
							"onUpdate:checked": t[5] ||= (e) => y(z).signEnable = e,
							"checked-children": "是",
							"un-checked-children": "否",
							disabled: y(K).type === "normal-task-node"
						}, null, 8, ["checked", "disabled"])]),
						_: 1
					}),
					u(d, {
						label: "审批意见",
						name: "reasonRequire"
					}, {
						default: S(() => [u(P, {
							checked: y(z).reasonRequire,
							"onUpdate:checked": t[6] ||= (e) => y(z).reasonRequire = e,
							"checked-children": "必填",
							"un-checked-children": "非必填",
							disabled: y(K).type === "normal-task-node"
						}, null, 8, ["checked", "disabled"])]),
						_: 1
					})
				]),
				_: 1
			}, 8, ["model"])]);
		};
	}
}), L = /* @__PURE__ */ e({ default: () => R }), R = I;
//#endregion
export { L as n, R as t };
