UNPKG

approval-flow-preview1

Version:

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

1,925 lines 60.8 kB
var B = Object.defineProperty; var J = (o, e, i) => e in o ? B(o, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[e] = i; var S = (o, e, i) => (J(o, typeof e != "symbol" ? e + "" : e, i), i); import C from "vue"; function q(o) { return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o; } function N() { return N = Object.assign ? Object.assign.bind() : function(o) { for (var e, i = 1; i < arguments.length; i++) for (var t in e = arguments[i], e) Object.prototype.hasOwnProperty.call(e, t) && (o[t] = e[t]); return o; }, N.apply(this, arguments); } var G = ["attrs", "props", "domProps"], H = ["class", "style", "directives"], X = ["on", "nativeOn"], W = function(o) { return o.reduce(function(e, i) { for (var t in i) if (!e[t]) e[t] = i[t]; else if (G.indexOf(t) !== -1) e[t] = N({}, e[t], i[t]); else if (H.indexOf(t) !== -1) { var r = e[t] instanceof Array ? e[t] : [e[t]], s = i[t] instanceof Array ? i[t] : [i[t]]; e[t] = [].concat(r, s); } else if (X.indexOf(t) !== -1) for (var n in i[t]) if (e[t][n]) { var l = e[t][n] instanceof Array ? e[t][n] : [e[t][n]], a = i[t][n] instanceof Array ? i[t][n] : [i[t][n]]; e[t][n] = [].concat(l, a); } else e[t][n] = i[t][n]; else if (t === "hook") for (var c in i[t]) e[t][c] = e[t][c] ? K(e[t][c], i[t][c]) : i[t][c]; else e[t] = i[t]; return e; }, {}); }, K = function(o, e) { return function() { o && o.apply(this, arguments), e && e.apply(this, arguments); }; }, Q = W; const T = /* @__PURE__ */ q(Q), Y = { start: { type: "start", content: "所有人", properties: { title: "发起人", initiator: "ALL" } }, approver: { type: "approver", content: "请设置审批人", properties: { title: "审批人" } }, copy: { type: "copy", content: "发起人自选", properties: { title: "抄送人", menbers: [], userOptional: !0 } }, condition: { type: "condition", content: "请设置条件", properties: { title: "条件", conditions: [], initiator: null } }, branch: { type: "branch", content: "", properties: {} }, empty: { type: "empty", content: "", properties: {} } }, f = (o) => Array.isArray(o) ? o.length === 0 : !0; class p { /** * 获取最大的节点ID 转换成10进制 * @param {*} data - 整个流程数据 */ static getMaxNodeId(e) { let i = e.nodeId; const t = (n) => { n && (i < n.nodeId && (i = n.nodeId), n.childNode && t(n.childNode), Array.isArray(n.conditionNodes) && n.conditionNodes.forEach((l) => t(l))); }; t(e); const r = "0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz", s = r.length; return i.split("").reduce((n, l, a) => n + r.indexOf(l) * Math.pow(s, a), 0); } /** * 根据自增数生成64进制id * @returns 64进制id字符串 */ static idGenerator() { let e = ++this.globalID; const i = "0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz", t = i.split(""), r = i.length, s = []; do { let n = e % r; e = (e - n) / r, s.push(t[n]); } while (e); return s.join(""); } /** * 判断节点类型 * @param {Node} node - 节点数据 * @returns Boolean */ static isConditionNode(e) { return e && e.type === "condition"; } static isCopyNode(e) { return e && e.type === "copy"; } static isStartNode(e) { return e && e.type === "start"; } static isApproverNode(e) { return e && e.type === "approver"; } /** * 创建指定节点 * @param { String } type - 节点类型 * @param { Object } previousNodeId - 父节点id * @returns { Object } 节点数据 */ static createNode(e, i) { let t = JSON.parse(JSON.stringify(Y[e])); return t.nodeId = this.idGenerator(), t.prevId = i, t; } /** * 获取指定节点的父节点(前一个节点) * @param { String } prevId - 父节点id * @param { Object } processData - 流程图全部数据 * @returns { Object } 父节点 */ static getPreviousNode(e, i) { if (i.nodeId === e) return i; if (i.childNode) { let t = this.getPreviousNode(e, i.childNode); if (t) return t; } if (i.conditionNodes) for (let t of i.conditionNodes) { let r = this.getPreviousNode(e, t); if (r) return r; } } /** * 删除节点 * @param { Object } nodeData - 被删除节点的数据 * @param { Object } processData - 流程图的所有节点数据 */ static deleteNode(e, i, t = !0) { let r = this.getPreviousNode(e.prevId, i); if (t && r.type === "empty") { this.isConditionNode(e) ? this.deleteNode(r, i) : (f(r.conditionNodes) && this.deleteNode(r, i), this.deleteNode(e, i, !1)); return; } let s = (n, l) => { n.childNode = l.childNode, f(n.conditionNodes) && (n.conditionNodes = l.conditionNodes), n.childNode && (n.childNode.prevId = n.nodeId), n.conditionNodes && n.conditionNodes.forEach((a) => a.prevId = n.nodeId); }; if (this.isConditionNode(e)) { let n = r.conditionNodes, l = n.findIndex((a) => a.nodeId === e.nodeId); if (n.length > 2) n.splice(l, 1); else { let a = n[+!l]; if (delete r.conditionNodes, r.childNode) { let c = a; for (; c.childNode; ) c = c.childNode; c.childNode = r.childNode, c.childNode.prevId = c.nodeId; } s(r, a); } n.forEach((a, c) => a.properties.priority = c); return; } s(r, e); } // TODO: // static copyNode ( nodeData, processData ) { // let prevNode = this.getPreviousNode( nodeData.prevId, processData ) // let index = prevNode.conditionNodes.findIndex( c => c.nodeId === nodeData.nodeId ) // } /** * 添加审计节点(普通节点 approver) * @param { Object } data - 目标节点数据,在该数据节点之后添加审计节点 * @param { Object } isBranchAction - 目标节点数据,是否是条件分支 * @param { Object } newChildNode - 传入的新的节点 用户操作均为空 删除操作/添加抄送人 会传入该参数 以模拟添加节点 */ static addApprovalNode(e, i, t = void 0) { let r = e.childNode; t = t || this.createNode("approver", e.nodeId), e.childNode = t, r && (t.childNode = r, r.prevId = t.nodeId); let s = e.conditionNodes; Array.isArray(s) && !i && s.length && (t.conditionNodes = s.map((n) => (n.prevId = t.nodeId, n)), delete e.conditionNodes), r && r.type === "empty" && this.deleteNode(r, e); } /** * 添加空节点 * @param { Object } data - 空节点的父级节点 * @return { Object } emptyNode - 空节点数据 */ static addEmptyNode(e) { let i = this.createNode("empty", e.nodeId); return this.addApprovalNode(e, !0, i), i; } static addCopyNode(e, i) { this.addApprovalNode(e, i, this.createNode("copy", e.nodeId)); } /** * 添加条件节点 condition 通过点击添加条件进入该操作 * @param { Object } data - 目标节点所在分支数据,在该分支最后添加条件节点 */ static appendConditionNode(e) { const i = e.conditionNodes; let t = this.createNode("condition", e.nodeId), r = i.findIndex((s) => s.properties.isDefault); t.properties.priority = i.length, r > -1 ? (i.splice(-1, 0, t), t.properties.priority = i.length - 2, i[i.length - 1].properties.priority = i.length - 1) : i.push(t), this.setDefaultCondition(t, e); } /** * 添加条件分支 branch * @param { Object } data - 目标节点所在节点数据,在该节点最后添加分支节点 */ static appendBranch(e, i) { let t = e; if (Array.isArray(e.conditionNodes) && e.conditionNodes.length) if (i) t = this.addEmptyNode(t, !0); else { let s = this.addEmptyNode(t, !0); s.conditionNodes = t.conditionNodes, s.conditionNodes.forEach((n) => { n.prevId = s.nodeId; }); } let r = [ this.createNode("condition", t.nodeId), this.createNode("condition", t.nodeId) ].map((s, n) => (s.properties.title += n + 1, s.properties.priority = n, s)); t.conditionNodes = r; } /** * 重设节点优先级(条件节点) * @param {Node} cnode - 当前节点 * @param {Number} oldPriority - 替换前的优先级(在数组中的顺序) * @param {Node} processData - 整个流程图节点数据 */ static resortPrioByCNode(e, i, t) { if (e.properties.isDefault) { e.properties.priority = i; return; } let r = this.getPreviousNode(e.prevId, t), s = e.properties.priority; if (r.conditionNodes[s].properties.isDefault) { e.properties.priority = i; return; } let n = r.conditionNodes.splice(s, 1, e)[0]; n.properties.priority = i, r.conditionNodes[i] = n; } /** * 提升条件节点优先级——排序在前 * @param { Object } data - 目标节点数据 * @param { Object } processData - 流程图的所有节点数据 */ static increasePriority(e, i) { if (e.properties.isDefault) return; let r = this.getPreviousNode(e.prevId, i).conditionNodes, s = r.findIndex((n) => n === e); s && (r[s - 1].properties.priority = s, r[s].properties.priority = s - 1, r[s - 1] = r.splice(s, 1, r[s - 1])[0]); } /** * 降低条件节点优先级——排序在后 * @param { Object } data - 目标节点数据 * @param { Object } processData - 流程图的所有节点数据 */ static decreasePriority(e, i) { let r = this.getPreviousNode(e.prevId, i).conditionNodes, s = r.findIndex((n) => n.nodeId === e.nodeId); if (s < r.length - 1) { let n = r[s + 1]; if (n.properties.isDefault) return; n.properties.priority = s, r[s].properties.priority = s + 1, r[s + 1] = r.splice(s, 1, r[s + 1])[0]; } } /** * 当有其他条件节点设置条件后 检查并设置最后一个节点为默认节点 * @param {Node} cnode - 当前节点 * @param {Node} processData - 整个流程图节点数据或父级节点数据 */ static setDefaultCondition(e, i) { const t = "其他情况进入此流程", r = this.getPreviousNode(e.prevId, i).conditionNodes, s = (d) => d.properties && (d.properties.initiator || !f(d.properties.conditions)), n = (d) => { d.properties.isDefault = !1, d.content === t && (d.content = "请设置条件"); }, l = (d) => { d.properties.isDefault = !0, d.content = t; }; let a = 0; r.slice(0, -1).forEach((d) => { s(d) && a++, n(d); }); const c = r[r.length - 1]; a > 0 && !s(c) ? l(c) : n(c); } /** * 校验单个节点必填项完整性 * @param {Node} node - 节点数据 */ static checkNode(e, i) { let t = !0; const r = e.properties; this.isStartNode(e) && !r.initiator && (t = !1), this.isConditionNode(e) && !r.isDefault && !r.initiator && f(r.conditions) && (t = !1); const s = ["myself", "optional", "director"]; return this.isApproverNode(e) && !s.includes(r.assigneeType) && f(r.approvers) && (t = !1), t; } /** * 判断所有节点是否信息完整 * @param {Node} processData - 整个流程图数据 * @returns {Boolean} */ static checkAllNode(e) { let i = !0; const t = (r, s, n) => { !this.checkNode(r, n) && s(), r.childNode && t(r.childNode, s, n), f(r.conditionNodes) || r.conditionNodes.forEach((l) => t(l, s, r)); }; return t(e, () => i = !1), i; } } S(p, "globalID", 1e4); function Z() { let o = p.createNode("start"); return o.childNode = p.createNode("approver", o.nodeId), o; } const ee = (o) => o.type === "condition", te = (o) => Array.isArray(o) && o.length > 0, V = (o) => te(o.conditionNodes), R = (o) => o.stopPropagation(); function ie(o, e, i) { const t = ["flow-path-card"], r = (a, c) => (a && t.push(c), a), s = r(p.isStartNode(e), "start-node"), n = r(p.isApproverNode(e), "approver"), l = r(p.isCopyNode(e), "copy"); return i("section", { class: t.join(" "), on: { click: this.eventLancher.bind(o, "edit", e) } }, [i("header", { class: "header" }, [i("div", { class: "title-box", style: { height: "100%", width: "190px" } }, [n && i("i", { class: "iconfont iconshenpi", style: { fontSize: "12px", color: "white", marginRight: "4px" } }), l && i("i", { class: "el-icon-s-promotion", style: { fontSize: "12px", color: "white", marginRight: "4px" } }), i("span", { class: "title-text" }, [e.properties.title]), !s && !o.readOnly ? i("input", T([{ on: { blur: (a) => { this.$forceUpdate(); }, input: (a) => { a.target.composing || this.$set(e.properties, "title", a.target.value.trim()); }, click: R }, class: "title-input", style: { marginTop: "3px" }, domProps: { value: e.properties.title } }, { directives: [{ name: "model", value: e.properties.title, modifiers: { trim: !0 } }] }])) : ""]), i("div", { class: "actions", style: { marginRight: "4px" } }, [i("i", { class: "el-icon-close icon", on: { click: this.eventLancher.bind(o, "deleteNode", e, o.data) } })])]), i("div", { class: "body" }, [i("span", { class: "text" }, [e.content]), i("div", { class: "icon-wrapper right" }, [i("i", { class: "el-icon-arrow-right icon right-arrow" })])])]); } const g = (...o) => ie.call(o[0], ...o); let $ = { start: g, approver: g, copy: g, empty: (o) => "", condition: function(o, e, i) { return i("section", { class: "flow-path-card condition", on: { click: this.eventLancher.bind(o, "edit", e) } }, [i("header", { class: "header" }, [i("div", { class: "title-box", style: "height: 20px;width:160px;" }, [i("span", { class: "title-text" }, [e.properties.title]), o.readOnly ? "" : i("input", T([{ on: { blur: (t) => { this.$forceUpdate(); }, input: (t) => { t.target.composing || this.$set(e.properties, "title", t.target.value.trim()); }, click: R }, class: "title-input", style: "margin-top:1px;", domProps: { value: e.properties.title } }, { directives: [{ name: "model", value: e.properties.title, modifiers: { trim: !0 } }] }]))]), i("span", { class: "priority" }, ["优先级", e.properties.priority + 1]), i("div", { class: "actions" }, [i("i", { class: "el-icon-close icon", on: { click: this.eventLancher.bind(o, "deleteNode", e, o.data) } })])]), i("div", { class: "body" }, [i("pre", { class: "text" }, [e.content])]), i("div", { class: "icon-wrapper left", on: { click: o.eventLancher.bind(o, "increasePriority", e, o.data) } }, [i("i", { class: "el-icon-arrow-left icon left-arrow" })]), i("div", { class: "icon-wrapper right", on: { click: o.eventLancher.bind(o, "decreasePriority", e, o.data) } }, [i("i", { class: "el-icon-arrow-right icon right-arrow" })])]); } }; function x(o, e, i, t = !1) { return V(e), e.type === "empty" && !t ? "" : i("div", { class: "add-node-btn-box flex justify-center" }, [i("div", { class: "add-node-btn" }, [i("el-popover", { attrs: { placement: "right", trigger: o.readOnly ? "manual" : "click", width: "300" } }, [i("div", { class: "condition-box" }, [i("div", [i("div", { class: "condition-icon", on: { click: o.readOnly ? () => { } : o.eventLancher.bind(o, "addApprovalNode", e, t) } }, [i("i", { class: "iconfont iconshenpi" })]), "审批人"]), i("div", [i("div", { class: "condition-icon", on: { click: o.readOnly ? () => { } : o.eventLancher.bind(o, "addCopyNode", e, t) } }, [i("i", { class: "el-icon-s-promotion iconfont", style: "vertical-align: middle;" })]), "抄送人"]), i("div", [i("div", { class: "condition-icon", on: { click: o.readOnly ? () => { } : o.eventLancher.bind(o, "appendBranch", e, t) } }, [i("i", { class: "iconfont iconcondition" })]), "条件分支"])]), i("button", { class: "btn", attrs: { type: "button", disabled: o.readOnly }, slot: "reference" }, [i("i", { class: "el-icon-plus icon" })])])])]); } function y(o, e, i) { if (!e) return; const t = o.verifyMode && p.checkNode(e) === !1; let r = [], s = "", n = i("div", { class: "node-wrap" }, [i("div", { class: `node-wrap-box ${e.type} ${t ? "error" : ""}` }, [i("el-tooltip", { attrs: { content: "未设置条件", placement: "top", effect: "dark" } }, [i("div", { class: "error-tip", on: { click: this.eventLancher.bind(o, "edit", e) } }, ["!!!"])]), $[e.type] ? $[e.type].call(o, o, e, i) : i("div", ["Invalid node type: ", e.type]), x.call(o, o, e, i)])]); return V(e) && (s = i("div", { class: "branch-wrap" }, [i("div", { class: "branch-box-wrap" }, [i("div", { class: "branch-box flex justify-center relative" }, [i("button", { class: "btn", on: { click: this.eventLancher.bind(o, "appendConditionNode", e) } }, ["添加条件"]), e.conditionNodes.map((l) => y.call(o, o, l, i))])]), x.call(o, o, e, i, !0)])), ee(e) ? i("div", { class: "col-box" }, [i("div", { class: "center-line" }), i("div", { class: "top-cover-line" }), i("div", { class: "bottom-cover-line" }), n, s, y.call(o, o, e.childNode, i)]) : (r.push(n), s && r.push(s), e.childNode && r.push(y.call(o, o, e.childNode, i)), r); } function oe(o) { return o("section", { class: "end-node" }, ["流程结束"]); } const re = { name: "FlowCard", props: { data: { type: Object, required: !0 }, // 点击发布时需要校验节点数据完整性 此时打开校验模式 verifyMode: { type: Boolean, default: !0 }, // 添加只读属性 readOnly: { type: Boolean, default: !1 } }, // data() { // return { // data: this.data, // 流程图数据 // // 校验模式 // verifyMode: this.verifyMode, // // 只读模式 // readOnly: this.readOnly // }; // }, watch: {}, methods: { /** *事件触发器 统筹本组件所有事件并转发到父组件中 * @param { Object } 包含event(事件名)和args(事件参数)两个参数 */ eventLancher(o, ...e) { if (this.readOnly) return; let i = { event: o, args: e.slice(0, -1) }; this.$emit("emits", i); } }, render(o) { return o("div", { style: "display: inline-flex; flex-direction: column; align-items: center;" }, [this.data && y.call(this, this, this.data, o), oe(o)]); } }; function h(o, e, i, t, r, s, n, l) { var a = typeof o == "function" ? o.options : o; e && (a.render = e, a.staticRenderFns = i, a._compiled = !0), t && (a.functional = !0), s && (a._scopeId = "data-v-" + s); var c; if (n ? (c = function(v) { v = v || // cached call this.$vnode && this.$vnode.ssrContext || // stateful this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !v && typeof __VUE_SSR_CONTEXT__ < "u" && (v = __VUE_SSR_CONTEXT__), r && r.call(this, v), v && v._registeredComponents && v._registeredComponents.add(n); }, a._ssrRegister = c) : r && (c = l ? function() { r.call( this, (a.functional ? this.parent : this).$root.$options.shadowRoot ); } : r), c) if (a.functional) { a._injectStyles = c; var d = a.render; a.render = function(U, O) { return c.call(O), d(U, O); }; } else { var k = a.beforeCreate; a.beforeCreate = k ? [].concat(k, c) : [c]; } return { exports: o, options: a }; } let se, ne; const I = {}; var ae = /* @__PURE__ */ h( re, se, ne, !1, le, "7b24cb0e", null, null ); function le(o) { for (let e in I) this[e] = I[e]; } const ce = /* @__PURE__ */ function() { return ae.exports; }(), pe = C.prototype.$isServer, M = function() { return !pe && document.addEventListener ? function(o, e, i) { o && e && i && o.addEventListener(e, i, !1); } : function(o, e, i) { o && e && i && o.attachEvent("on" + e, i); }; }(), m = [], u = "@@clickoutsideContext"; let z, de = 0; !C.prototype.$isServer && M(document, "mousedown", (o) => z = o); !C.prototype.$isServer && M(document, "mouseup", (o) => { m.forEach((e) => e[u].documentHandler(o, z)); }); function w(o, e, i) { return function(t = {}, r = {}) { !i || !i.context || !t.target || !r.target || o.contains(t.target) || o.contains(r.target) || o === t.target || i.context.popperElm && (i.context.popperElm.contains(t.target) || i.context.popperElm.contains(r.target)) || (e.expression && o[u].methodName && i.context[o[u].methodName] ? i.context[o[u].methodName]() : o[u].bindingFn && o[u].bindingFn()); }; } const ue = { bind(o, e, i) { m.push(o); const t = de++; o[u] = { id: t, documentHandler: w(o, e, i), methodName: e.expression, bindingFn: e.value }; }, update(o, e, i) { o[u].documentHandler = w(o, e, i), o[u].methodName = e.expression, o[u].bindingFn = e.value; }, unbind(o) { let e = m.length; for (let i = 0; i < e; i++) if (m[i][u].id === o[u].id) { m.splice(i, 1); break; } delete o[u]; } }; var ve = function(e, i) { var t = i._c; return t("el-row", { staticClass: "cmp-container" }, [t("el-col", { staticClass: "label", attrs: { span: 4 } }, [i._v(i._s(i.props.title))]), t("el-col", { attrs: { span: 18 } }, [i._t("default")], 2), t("el-col", { staticClass: "icon-wrapper", attrs: { span: 2 } }, [i._t("action")], 2)], 1); }, fe = []; const he = {}, F = {}; var me = /* @__PURE__ */ h( he, ve, fe, !0, ye, "70192252", null, null ); function ye(o) { for (let e in F) this[e] = F[e]; } const j = /* @__PURE__ */ function() { return me.exports; }(); var ge = function() { var e = this, i = e.$createElement, t = e._self._c || i; return t("el-row", { attrs: { gutter: 12 } }, [t("el-col", { attrs: { span: e.isRange ? 24 : 12 } }, [t("el-select", { staticStyle: { width: "100%" }, attrs: { size: "small", placeholder: "请选择" }, on: { change: e.onTypeChange }, model: { value: e.cloneData.type, callback: function(s) { e.$set(e.cloneData, "type", s); }, expression: "cloneData.type" } }, [t("el-option", { attrs: { label: "小于", value: "lt" } }), t("el-option", { attrs: { label: "小于等于", value: "lte" } }), t("el-option", { attrs: { label: "大于", value: "gt" } }), t("el-option", { attrs: { label: "大于等于", value: "gte" } }), t("el-option", { attrs: { label: "等于", value: "eq" } }), t("el-option", { attrs: { label: "介于两数之间", value: "bet" } })], 1)], 1), t("el-col", { attrs: { span: e.isRange ? 24 : 12 } }, [e.isRange ? t("div", { staticStyle: { width: "100%", overflow: "hidden", "margin-top": "10px" } }, [t("el-col", { staticStyle: { "padding-left": "0" }, attrs: { span: 6 } }, [t("el-input-number", { staticStyle: { width: "100%" }, attrs: { size: "small", "controls-position": "right" }, on: { change: e.update }, model: { value: e.cloneData.value[0], callback: function(s) { e.$set(e.cloneData.value, 0, s); }, expression: "cloneData.value[0]" } })], 1), t("el-col", { attrs: { span: 4 } }, [t("el-select", { attrs: { size: "small", placeholder: "请选择" }, on: { change: e.update }, model: { value: e.cloneData.value[1], callback: function(s) { e.$set(e.cloneData.value, 1, s); }, expression: "cloneData.value[1]" } }, [t("el-option", { attrs: { label: "<", value: "lt" } }), t("el-option", { attrs: { label: "≤", value: "lte" } })], 1)], 1), t("el-col", { staticClass: "range-title", attrs: { span: 4, title: e.title } }, [e._v(e._s(e.title))]), t("el-col", { attrs: { span: 4 } }, [t("el-select", { attrs: { size: "small", placeholder: "请选择" }, on: { change: e.update }, model: { value: e.cloneData.value[2], callback: function(s) { e.$set(e.cloneData.value, 2, s); }, expression: "cloneData.value[2]" } }, [t("el-option", { attrs: { label: "<", value: "lt" } }), t("el-option", { attrs: { label: "≤", value: "lte" } })], 1)], 1), t("el-col", { staticStyle: { "padding-left": "0" }, attrs: { span: 6 } }, [t("el-input-number", { staticStyle: { width: "100%" }, attrs: { size: "small", "controls-position": "right" }, on: { change: e.update }, model: { value: e.cloneData.value[3], callback: function(s) { e.$set(e.cloneData.value, 3, s); }, expression: "cloneData.value[3]" } })], 1)], 1) : t("el-input-number", { staticStyle: { width: "100%" }, attrs: { size: "small", "controls-position": "right" }, on: { change: e.update }, model: { value: e.cloneData.value, callback: function(s) { e.$set(e.cloneData, "value", s); }, expression: "cloneData.value" } })], 1)], 1); }, _e = []; const be = { model: { prop: "value", event: "update" }, props: ["value", "title"], components: { "row-wrapper": j }, data() { let o = JSON.parse(JSON.stringify(this.value || {})); return o = Object.assign({ type: "gt", value: null }, o), { cloneData: o }; }, computed: { isRange() { return this.cloneData.type === "bet"; } }, mounted() { this.update(); }, methods: { onTypeChange(o) { o === "bet" && (this.cloneData.value = [1, "lt", "lt", 2]), this.update(); }, update() { this.$emit("update", this.cloneData); } } }, D = {}; var Ne = /* @__PURE__ */ h( be, ge, _e, !1, Ce, "a1dc0fc0", null, null ); function Ce(o) { for (let e in D) this[e] = D[e]; } const ke = /* @__PURE__ */ function() { return Ne.exports; }(); var Oe = function() { var e = this, i = e.$createElement, t = e._self._c || i; return e.properties ? t("el-drawer", { staticClass: "drawer", staticStyle: { "text-align": "left" }, attrs: { size: "550px", visible: e.visible, "show-close": !1 }, on: { "update:visible": function(s) { e.visible = s; }, close: e.cancel } }, [e.value && e.value.type == "start" && e.properties.title ? t("header", { staticClass: "header", attrs: { slot: "title" }, slot: "title" }, [e._v(e._s(e.properties.title))]) : t("header", { staticClass: "header", attrs: { slot: "title" }, slot: "title" }, [t("span", { directives: [{ name: "show", rawName: "v-show", value: !e.titleInputVisible, expression: "!titleInputVisible" }], staticStyle: { cursor: "pointer" }, on: { click: function(s) { e.titleInputVisible = !0; } } }, [e._v(" " + e._s(e.properties.title) + " "), t("i", { staticClass: "el-icon-edit" })]), t("el-input", { directives: [{ name: "show", rawName: "v-show", value: e.titleInputVisible, expression: "titleInputVisible" }, { name: "clickoutside", rawName: "v-clickoutside", value: function(s) { return e.titleInputVisible = !1; }, expression: "_ => titleInputVisible=false" }], staticStyle: { "z-index": "9", "max-width": "200px" }, attrs: { size: "mini" }, model: { value: e.properties.title, callback: function(s) { e.$set(e.properties, "title", s); }, expression: "properties.title" } }), e.isConditionNode() ? t("el-select", { staticClass: "priority-select", attrs: { size: "mini" }, model: { value: e.properties.priority, callback: function(s) { e.$set(e.properties, "priority", s); }, expression: "properties.priority" } }, e._l(e.priorityLength, function(r) { return t("el-option", { key: r, attrs: { value: r - 1, label: "优先级" + r } }); }), 1) : e._e()], 1), e.value && e.isConditionNode() ? t("section", { staticClass: "condition-pane" }, [e.showingPCons.includes(-1) ? t("row-wrapper", { attrs: { title: "发起人" } }, [t("fc-org-select", { ref: "condition-org", attrs: { tabList: ["dep&user"] }, model: { value: e.initiator, callback: function(s) { e.initiator = s; }, expression: "initiator" } })], 1) : e._e(), e._l(e.pconditions, function(r, s) { return [e.couldShowIt(r, "el-input-number", "fc-date-duration", "fc-time-duration", "fc-amount", "fc-calculate") ? t("row-wrapper", { key: s, attrs: { title: r.label }, scopedSlots: e._u([{ key: "action", fn: function() { return [t("i", { staticClass: "el-icon-delete", staticStyle: { cursor: "pointer" }, on: { click: function(a) { return e.onDelCondition(r); } } })]; }, proxy: !0 }], null, !0) }, [t("num-input", { key: s, staticStyle: { "padding-right": "6px" }, attrs: { title: e.timeTangeLabel(r) }, model: { value: r.conditionValue, callback: function(l) { e.$set(r, "conditionValue", l); }, expression: "item.conditionValue" } })], 1) : e._e(), e.couldShowIt(r, "el-radio-group") ? t("row-wrapper", { key: s, attrs: { title: r.label }, scopedSlots: e._u([{ key: "action", fn: function() { return [t("i", { staticClass: "el-icon-delete", staticStyle: { cursor: "pointer" }, on: { click: function(a) { return e.onDelCondition(r); } } })]; }, proxy: !0 }], null, !0) }, [t("el-radio-group", { staticClass: "radio-group", model: { value: r.conditionValue, callback: function(l) { e.$set(r, "conditionValue", l); }, expression: "item.conditionValue" } }, e._l(r.options, function(n) { return t("el-radio", { key: n.label, attrs: { label: n.label } }, [e._v(e._s(n.label))]); }), 1)], 1) : e._e(), e.couldShowIt(r, "el-select") ? t("row-wrapper", { key: s, attrs: { title: r.label }, scopedSlots: e._u([{ key: "action", fn: function() { return [t("i", { staticClass: "el-icon-delete", staticStyle: { cursor: "pointer" }, on: { click: function(a) { return e.onDelCondition(r); } } })]; }, proxy: !0 }], null, !0) }, [t("el-select", { attrs: { placeholder: "请选择", size: "small" }, model: { value: r.conditionValue, callback: function(l) { e.$set(r, "conditionValue", l); }, expression: "item.conditionValue" } }, e._l(r.options, function(n) { return t("el-option", { key: n.value, attrs: { label: n.label, value: n.value } }); }), 1)], 1) : e._e(), e.couldShowIt(r, "fc-org-select") ? t("row-wrapper", { key: s, attrs: { title: r.label }, scopedSlots: e._u([{ key: "action", fn: function() { return [t("i", { staticClass: "el-icon-delete", staticStyle: { cursor: "pointer" }, on: { click: function(a) { return e.onDelCondition(r); } } })]; }, proxy: !0 }], null, !0) }, [t("fc-org-select", { ref: "org" + s, refInFor: !0, attrs: { tabList: ["dep"] }, model: { value: r.conditionValue, callback: function(l) { e.$set(r, "conditionValue", l); }, expression: "item.conditionValue" } })], 1) : e._e()]; }), t("div", { staticStyle: { "padding-left": "10px", "margin-top": "2em" } }, [t("el-button", { attrs: { type: "primary", size: "small", icon: "el-icon-plus" }, on: { click: function(s) { e.dialogVisible = !0; } } }, [e._v("添加条件")]), t("span", { staticStyle: { color: "#aaa", "margin-left": "16px" } }, [e._v("还有" + e._s(e.notUseConNum) + "个可用条件")])], 1)], 2) : e._e(), e.value && (e.isApproverNode() || e.isStartNode()) ? t("section", { staticClass: "approver-pane", staticStyle: { height: "100%" } }, [t("el-tabs", { staticClass: "pane-tab", model: { value: e.activeName, callback: function(s) { e.activeName = s; }, expression: "activeName" } }, [t("el-tab-pane", { attrs: { label: "设置" + (e.value.type === "approver" ? "审批人" : "发起人"), name: "config" } }, [e.value.type === "start" ? t("el-row", { staticStyle: { padding: "10px" } }, [t("el-col", { staticStyle: { "font-size": "12px" }, attrs: { span: 4 } }, [e._v("发起人")]), t("el-col", { staticStyle: { "padding-left": "12px" }, attrs: { span: 18 } }, [t("fc-org-select", { ref: "start-org", attrs: { tabList: ["dep&user"] }, model: { value: e.initiator, callback: function(s) { e.initiator = s; }, expression: "initiator" } })], 1)], 1) : e.value.type === "approver" ? t("div", [t("div", { staticStyle: { padding: "12px" } }, [t("el-radio-group", { staticStyle: { "line-height": "32px" }, on: { change: e.resetOrgColl }, model: { value: e.approverForm.assigneeType, callback: function(s) { e.$set(e.approverForm, "assigneeType", s); }, expression: "approverForm.assigneeType" } }, e._l(e.assigneeTypeOptions, function(r) { return t("el-radio", { key: r.value, staticClass: "radio-item", attrs: { label: r.value } }, [e._v(e._s(r.label))]); }), 1)], 1), t("div", { staticStyle: { "border-bottom": "1px solid #e5e5e5", "padding-bottom": "1rem" } }, [e.approverForm.assigneeType === "myself" ? t("div", { staticClass: "option-box", staticStyle: { color: "#a5a5a5" } }, [e._v("发起人自己将作为审批人处理审批单")]) : e.approverForm.assigneeType === "optional" ? t("div", { staticClass: "option-box" }, [t("p", [e._v("可选多人")]), t("el-switch", { attrs: { "active-color": "#13ce66" }, model: { value: e.approverForm.optionalMultiUser, callback: function(s) { e.$set(e.approverForm, "optionalMultiUser", s); }, expression: "approverForm.optionalMultiUser" } }), t("p", [e._v("选择范围")]), t("el-select", { attrs: { size: "mini" }, model: { value: e.approverForm.optionalRange, callback: function(s) { e.$set(e.approverForm, "optionalRange", s); }, expression: "approverForm.optionalRange" } }, e._l(e.rangeOptions, function(r, s) { return t("el-option", { key: s, attrs: { label: r.label, value: r.value, disabled: r.disabled } }); }), 1)], 1) : e.approverForm.assigneeType === "director" ? t("div", [t("div", { staticStyle: { "font-size": "14px", "padding-left": "1rem" } }, [e._v("发起人的 "), t("el-select", { attrs: { size: "small" }, model: { value: e.directorLevel, callback: function(s) { e.directorLevel = s; }, expression: "directorLevel" } }, e._l(5, function(r) { return t("el-option", { key: r, attrs: { label: r === 1 ? "直接主管" : "第".concat(r, "级主管"), value: r } }); }), 1), t("br"), t("el-checkbox", { staticStyle: { "margin-top": "1rem" }, model: { value: e.useDirectorProxy, callback: function(s) { e.useDirectorProxy = s; }, expression: "useDirectorProxy" } }, [e._v("找不到主管时,由上级主管代审批")])], 1)]) : t("div", { staticClass: "option-box" }, [t("fc-org-select", { ref: "approver-org", attrs: { buttonType: "button", title: e.getAssignTypeLabel(), tabList: e.fcOrgTabList.includes(e.approverForm.assigneeType) ? [e.approverForm.assigneeType] : ["dep"] }, on: { change: e.onOrgChange }, model: { value: e.orgCollection, callback: function(s) { e.orgCollection = s; }, expression: "orgCollection" } })], 1)]), e.orgCollection[e.approverForm.assigneeType] && e.orgCollection[e.approverForm.assigneeType].length > 1 || ["optional"].includes(e.approverForm.assigneeType) ? t("div", { staticClass: "option-box", staticStyle: { "border-bottom": "1px solid #e5e5e5" } }, [t("p", [e._v("多人审批时采用的审批方式")]), t("el-radio", { staticClass: "radio-item", attrs: { label: !0 }, model: { value: e.approverForm.counterSign, callback: function(s) { e.$set(e.approverForm, "counterSign", s); }, expression: "approverForm.counterSign" } }, [e._v("会签(须所有审批人同意)")]), t("br"), t("el-radio", { staticClass: "radio-item", attrs: { label: !1 }, model: { value: e.approverForm.counterSign, callback: function(s) { e.$set(e.approverForm, "counterSign", s); }, expression: "approverForm.counterSign" } }, [e._v("或签(一名审批人同意或拒绝即可)")])], 1) : e._e()]) : e._e()], 1), t("el-tab-pane", { attrs: { label: "表单权限", name: "formAuth" } }, [t("div", { staticClass: "form-auth-table" }, [t("header", { staticClass: "auth-table-header" }, [t("div", { staticClass: "row" }, [t("div", { staticClass: "label" }, [e._v("表单字段")]), t("el-radio-group", { staticClass: "radio-group", on: { change: e.changeAllFormOperate }, model: { value: e.globalFormOperate, callback: function(s) { e.globalFormOperate = s; }, expression: "globalFormOperate" } }, [t("el-radio", { staticStyle: { "margin-left": "1rem" }, attrs: { label: 2 } }, [e._v("可编辑")]), t("el-radio", { attrs: { label: 1 } }, [e._v("只读")]), t("el-radio", { attrs: { label: 0 } }, [e._v("隐藏")])], 1)], 1)]), t("div", { staticClass: "auth-table-body" }, e._l(e.getFormOperates(), function(r) { return t("div", { key: r.formId, staticClass: "row" }, [t("div", { staticClass: "label" }, [t("span", { directives: [{ name: "show", rawName: "v-show", value: r.required, expression: "item.required" }], staticClass: "required" }, [e._v("*")]), e._v(" " + e._s(r.label) + " ")]), t("el-radio-group", { staticClass: "radio-group", model: { value: r.formOperate, callback: function(n) { e.$set(r, "formOperate", n); }, expression: "item.formOperate" } }, [t("el-radio", { staticStyle: { "margin-left": "1rem" }, attrs: { label: 2 } }, [t("span", { staticStyle: { opacity: "0" } }, [e._v("可编辑")])]), t("el-radio", { attrs: { label: 1 } }, [t("span", { staticStyle: { opacity: "0" } }, [e._v("只读")])]), t("el-radio", { attrs: { label: 0 } }, [t("span", { staticStyle: { opacity: "0" } }, [e._v("隐藏")])])], 1)], 1); }), 0)])])], 1)], 1) : e._e(), e.value && e.isCopyNode() ? t("section", { staticStyle: { "padding-left": "1rem" } }, [t("p", [e._v("抄送人")]), t("fc-org-select", { ref: "copy-org", attrs: { buttonType: "button", title: "抄送人" }, model: { value: e.properties.menbers, callback: function(s) { e.$set(e.properties, "menbers", s); }, expression: "properties.menbers" } }), t("br"), t("el-checkbox", { model: { value: e.properties.userOptional, callback: function(s) { e.$set(e.properties, "userOptional", s); }, expression: "properties.userOptional" } }, [e._v("允许发起人自选抄送人")])], 1) : e._e(), t("el-dialog", { attrs: { title: "选择条件", visible: e.dialogVisible, width: "500px", "append-to-body": !0, "custom-class": "condition-dialog" }, on: { "update:visible": function(s) { e.dialogVisible = s; } } }, [t("el-checkbox-group", { model: { value: e.showingPCons, callback: function(s) { e.showingPCons = s; }, expression: "showingPCons" } }, [t("el-checkbox", { attrs: { label: -1 } }, [e._v("发起人")]), e._l(e.pconditions, function(r, s) { return t("el-checkbox", { key: s, attrs: { label: r.formId } }, [e._v(" " + e._s(r.label) + " ")]); })], 2)], 1), t("div", { staticClass: "actions" }, [t("el-button", { attrs: { size: "small" }, on: { click: e.cancel } }, [e._v("取消")]), t("el-button", { attrs: { size: "small", type: "primary" }, on: { click: e.confirm } }, [e._v("确定")])], 1)], 1) : e._e(); }, Se = []; const _ = { lt: "<", lte: "≤", gt: ">", gte: "≥", eq: "=" }, A = { approvers: [], // 审批人集合 assigneeType: "user", // 指定审批人 formOperates: [], // 表单操作权限集合 counterSign: !0, //是否为会签 // 审批类型为自选 出现 optionalMultiUser optionalRange optionalMultiUser: !1, optionalRange: "ALL" // USER<最多十个> / ALL / ROLE }, $e = { props: [ /*当前节点数据*/ "value", /*整个节点数据*/ "processData" ], data() { return { fcOrgTabList: ["dep", "role", "user", "position"], visible: !1, // 控制面板显隐 globalFormOperate: null, // 统一设置节点表单权限 titleInputVisible: !1, // 是否显示标题输入框 startNode 不显示 activeName: "config", // or formAuth Tab面板key showingPCons: [], // 用户选择了得条件 被选中的才会被展示在面板上编辑 pconditions: [], // 从vuex中获取的可以作为流程图条件的集合 dialogVisible: !1, // 控制流程条件选项Dialog显隐 // 当前节点数据 properties: {}, // 发起人 start节点和condition节点需要 initiator: { "dep&user": [] }, priorityLength: 0, // 当为条件节点时 显示节点优先级选项的数据 orgCollection: { dep: [], role: [], user: [], position: [] }, useDirectorProxy: !0, // 找不到主管时 上级主管代理审批 directorLevel: 1, // 审批主管级别 startForm: { formOperates: [] }, approverForm: JSON.parse(JSON.stringify(A)), optionalOptions: [ { label: "自选一个人", value: !1 }, { label: "自选多个人", value: !0 } ], rangeOptions: [ { label: "全公司", value: "ALL" }, { label: "指定成员", value: "USER" }, { label: "角色", value: "ROLE" } ], assigneeTypeOptions: [ { label: "指定成员", value: "user" }, { label: "主管", value: "director" }, { label: "角色", value: "role" }, { label: "岗位", value: "position" }, { label: "发起人自己", value: "myself" }, { label: "发起人自选", value: "optional" } ] }; }, computed: { // 未使用的条件个数 notUseConNum() { return this.pconditions.length - this.showingPCons.length + 1; }, usedFormItems() { return this.$store.state.formItemList; } }, directives: { Clickoutside: ue }, methods: { getFormOperates() { let o = []; return this.isApproverNode() && (o = this.approverForm.formOperates), this.isStartNode() && (o = this.startForm.formOperates), o; }, resetOrgColl() { for (let o in this.orgCollection) this.$set(this.orgCollection, o, []); }, onOrgChange(o) { }, timeTangeLabel(o) { const e = ["fc-time-duration", "fc-date-duration"].findIndex((i) => i === o.tag); return e > -1 ? "时长" + ["(小时)", "(天)"][e] : o.label; }, getAssignTypeLabel() { const o = this.assigneeTypeOptions.find((e) => e.value === this.approverForm.assigneeType); return o ? o.label : ""; }, changeAllFormOperate(o) { (this.isStartNode() ? this.startForm : this.approverForm).formOperates.forEach((i) => i.formOperate = o); }, // 是否可以显示当前条件组件 couldShowIt(o, ...e) { return e.includes(o.tag) && this.showingPCons.includes(o.formId); }, initFormOperates(o) { const e = o.properties && o.properties.formOperates || [], i = [], t = this.isApproverNode() ? 1 : 2, r = (l) => { const a = e.find((c) => c.formId === l); return a !== void 0 ? a.formOperate : t; }, s = (l, a = "") => l.map((c) => { const d = { formId: c.formId, required: c.required, label: a ? [a, c.label].join(".") : c.label, formOperate: r(c.formId) }; i.push(d), Array.isArray(c.children) && s(c.children, c.label); }), n = this.$store.state.formItemList.filter((l) => l.cmpType !== "custom"); return s(n), i; }, initCopyNode() { this.properties = this.value.properties; }, initStartNodeData() { this.initInitiator(), this.startForm.formOperates = this.initFormOperates(this.value); }, copyNodeConfirm() { this.$emit("confirm", this.properties, this.getOrgSelectLabel("copy") || "发起人自选"), this.visible = !1; }, /** * 条件节点确认保存得回调 */ conditionNodeComfirm() { let o = ""; const e = []; this.showingPCons.map((i) => this.pconditions.find((t) => t.formId === i)).forEach((i) => { if (!i) return; const t = i.conditionValue; if (t == null) return; if (["el-input-number", "fc-date-duration", "fc-time-duration", "fc-amount", "fc-calculate"].includes(i.tag)) if (t.type === "bet") { const n = t.value; o += `[${n[0]} ${_[n[1]]} ${i.label} ${_[n[2]]} ${n[3]}] `; } else o += `[${i.label} ${_[t.type]} ${t.value}] `; else if (i.tag === "fc-org-select") { const n = this.pconditions.findIndex((a) => a.formId === i.formId), l = this.$refs["org" + n][0].selectedLabels; o += `[${i.label} = ${l}] `; } else o += `[${i.label} = ${t}] `; const s = { formId: i.formId, conditionValue: t }; e.push(s); }, []), this.properties.conditions = e, this.properties.initiator = this.initiator["dep&user"], this.initiator["dep&user"] && (o = `[发起人: ${this.getOrgSelectLabel("condition")}] ` + o), this.$emit("confirm", this.properties, o || "请设置条件"), this.visible = !1; }, getOrgSelectLabel(o) { return this.$refs[o + "-org"].selectedLabels; }, /** * 开始节点确认保存 */ startNodeComfirm() { this.properties.initiator = this.initiator["dep&user"]; const o = this.startForm.formOperates.map((e) => ({ formId: e.formId, formOperate: e.formOperate })); Object.assign(this.properties, { formOperates: o }), this.$emit("confirm", this.properties, this.getOrgSelectLabel("start") || "所有人"), this.visible = !1; }, /** * 审批节点确认保存 */ approverNodeComfirm() { const o = this.approverForm.assigneeType; let e = ""; ["optional", "myself"].includes(o) ? e = this.assigneeTypeOptions.find((t) => t.value === o).label : o === "director" ? e = this.directorLevel === 1 ? "直接主管" : `第${this.directorLevel}级主管` : e = this.getOrgSelectLabel("approver"); const i = this.approverForm.formOperates.map((t) => ({ formId: t.formId, formOperate: t.formOperate })); this.approverForm.approvers = this.orgCollection[o], Object.assign(this.properties, this.approverForm, { formOperates: i }), this.$emit("confirm", this.properties, e || "请设置审批人"), this.visible = !1; }, // 确认修改 confirm() { this.isCopyNode() && this.copyNodeConfirm(), this.isStartNode() && this.startNodeComfirm(), this.isApproverNode() && this.approverNodeComfirm(), this.isConditionNode() && this.conditionNodeComfirm(); }, // 关闭抽屉 cancel() { setTimeout(() => { this.$emit("cancel"), this.visible = !1; }, 0); }, /** * 删除流程条件 */ onDelCondition(o) { const e = this.showingPCons.findIndex((i) => i === o.formId); e > -1 && (this.showingPCons.splice(e, 1), this.pconditions.find((i) => i.formId === o.formId).conditionValue = void 0); }, // 配合getPriorityLength 获取前一个节点条件数组长度 用于设置优先级 getPrevData() { return p.getPreviousNode(this.value.prevId, this.processData); }, // 用于获取节点优先级范围 getPriorityLength() { this.priorityLength = this.getPrevData().conditionNodes.length; }, // 判断是否是条件节点 isConditionNode() { return this.value ? p.isConditionNode(this.value) : !1; }, /** 判断是否是审批节点*/ isApproverNode() { return this.value ? p.isApproverNode(this.value) : !1; }, isStartNode() { return this.v