UNPKG

dldiscuss

Version:

#### 介绍 {**以下是 Gitee 平台说明,您可以替换此简介** Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}

610 lines (609 loc) 23.4 kB
import { defineComponent as le, mergeModels as te, useModel as de, resolveComponent as B, openBlock as g, createBlock as T, withCtx as O, createElementVNode as W, createTextVNode as V, createVNode as G, pushScopeId as ue, popScopeId as he, computed as fe, ref as z, reactive as se, provide as ne, onActivated as pe, resolveDirective as re, createElementBlock as A, toDisplayString as ie, Fragment as Z, createCommentVNode as F, withDirectives as oe, unref as D } from "vue"; import { useRoute as we } from "vue-router"; import { useStore as me } from "vuex"; import { ElMessage as ee } from "element-plus"; import { _ as ce, u as ge, c as Ie, e as ae, r as ve, f as _e, g as ye, l as We, h as be, i as xe } from "./discussCom-BiaeqCV0.mjs"; import { g as Ne } from "./_commonjsHelpers-DaMA6jEr.mjs"; const ke = (w) => (ue("data-v-bbe61a7d"), w = w(), he(), w), Oe = { class: "sour" }, Se = /* @__PURE__ */ ke(() => /* @__PURE__ */ W("span", { class: "sour-text" }, "确认意见:", -1)), Ce = /* @__PURE__ */ le({ __name: "affirm", props: /* @__PURE__ */ te({ show: { type: Boolean, default: !1 } }, { title: {}, titleModifiers: {} }), emits: /* @__PURE__ */ te(["saved", "canceled"], ["update:title"]), setup(w, { emit: I }) { const d = w, l = I, h = de(w, "title"), M = async () => { l("saved", 1); }, U = () => { l("canceled"); }; return (v, _) => { const b = B("el-input"), $ = B("dl-edit"); return g(), T($, { show: d.show, title: "确认", width: "30%", onCancel: U, onSave: M }, { default: O(() => [ W("div", Oe, [ Se, V(), G(b, { modelValue: h.value, "onUpdate:modelValue": _[0] || (_[0] = (k) => h.value = k), class: "title" }, null, 8, ["modelValue"]) ]) ]), _: 1 }, 8, ["show"]); }; } }), Me = /* @__PURE__ */ ce(Ce, [["__scopeId", "data-v-bbe61a7d"]]); var De = function(w) { var I = {}; function d(l) { if (I[l]) return I[l].exports; var h = I[l] = { i: l, l: !1, exports: {} }; return w[l].call(h.exports, h, h.exports, d), h.l = !0, h.exports; } return d.m = w, d.c = I, d.d = function(l, h, M) { d.o(l, h) || Object.defineProperty(l, h, { configurable: !1, enumerable: !0, get: M }); }, d.r = function(l) { Object.defineProperty(l, "__esModule", { value: !0 }); }, d.n = function(l) { var h = l && l.__esModule ? function() { return l.default; } : function() { return l; }; return d.d(h, "a", h), h; }, d.o = function(l, h) { return Object.prototype.hasOwnProperty.call(l, h); }, d.p = "/dist/", d(d.s = 1); }([function(w, I, d) { d.r(I); var l = { equal: 0, delete: 1, insert: 2, none: 3, replace: 4 }; class h { constructor(t, e, s) { this.startInOld = t, this.startInNew = e, this.size = s; } get endInOld() { return this.startInOld + this.size; } get endInNew() { return this.startInNew + this.size; } } class M { constructor() { this.blockSize = 0, this.repeatingWordsAccuracy = 0, this.ignoreWhitespaceDifferences = !1; } } const U = /^\s*<\/?[^>]+>\s*$/, v = /<[^\s>]+/, _ = /^(\s|&nbsp;)+$/, b = /[\w\#@]+/, $ = ["<img"]; function k(n) { return !$.some((t) => n !== null && n.startsWith(t)) && U.test(n); } function Q(n, t, e) { return ["<", t, ' class="', e, '">', n, "</", t, ">"].join(""); } function u(n) { return n === "<"; } function S(n) { return n === "&"; } function q(n) { return n === ";"; } function x(n) { return _.test(n); } function X(n) { return k(n) ? function(t) { return t = v.exec(t)[0] + (t.endsWith("/>") ? "/>" : ">"); }(n) : n; } function L(n) { return b.test(n); } function J(n, t, e) { return n.push(t), n.length > e && n.shift(), n.length !== e ? null : n.join(""); } class Y { constructor(t, e, s, i, a, o, r) { this.oldWords = t, this.newWords = e, this.startInOld = s, this.endInOld = i, this.startInNew = a, this.endInNew = o, this.options = r; } indexNewWords() { this.wordIndices = /* @__PURE__ */ new Map(); let t = []; for (let e = this.startInNew; e < this.endInNew; e++) { let s = J(t, this.normalizeForIndex(this.newWords[e]), this.options.blockSize); s !== null && (this.wordIndices.has(s) ? this.wordIndices.get(s).push(e) : this.wordIndices.set(s, [e])); } } normalizeForIndex(t) { return t = X(t), this.options.IgnoreWhiteSpaceDifferences && x(t) ? " " : t; } findMatch() { if (this.indexNewWords(), this.removeRepeatingWords(), this.wordIndices.length === 0) return null; let t = this.startInOld, e = this.startInNew, s = 0, i = /* @__PURE__ */ new Map(); const a = this.options.blockSize; let o = []; for (let r = this.startInOld; r < this.endInOld; r++) { let f = J(o, this.normalizeForIndex(this.oldWords[r]), a); if (f === null) continue; let p = /* @__PURE__ */ new Map(); if (this.wordIndices.has(f)) { for (let y of this.wordIndices.get(f)) { let N = (i.has(y - 1) ? i.get(y - 1) : 0) + 1; p.set(y, N), N > s && (t = r - N - a + 2, e = y - N - a + 2, s = N); } i = p; } else i = p; } return s !== 0 ? new h(t, e, s + a - 1) : null; } removeRepeatingWords() { let t = this.newWords.length + this.options.repeatingWordsAccuracy, e = Array.from(this.wordIndices.entries()).filter((s) => s[1].length > t).map((s) => s[0]); for (let s of e) this.wordIndices.delete(s); } } class j { constructor(t, e, s, i, a) { this.action = t, this.startInOld = e, this.endInOld = s, this.startInNew = i, this.endInNew = a; } } var c = { character: 0, tag: 1, whitespace: 2, entity: 3 }; function E(n, t) { let e = { mode: c.character, currentWord: [], words: [] }, s = function(f, p) { let y = /* @__PURE__ */ new Map(); if (p === null) return y; for (let N of p) { let P; for (; (P = N.exec(f)) !== null; ) { if (y.has(P.index)) throw new Error("One or more block expressions result in a text sequence that overlaps. Current expression: " + N.toString()); y.set(P.index, P.index + P[0].length); } } return y; }(n, t), i = !!s.size, a = !1, o = -1; for (let f = 0; f < n.length; f++) { var r = n[f]; if (i && (o === index && (o = -1, a = !1), s.has(index) && (a = !0, o = s.get(index)), a)) { e.currentWord.push(r), e.mode = c.character; continue; } switch (e.mode) { case c.character: u(r) ? m(e, "<", c.tag) : S(r) ? m(e, r, c.entity) : x(r) ? m(e, r, c.whitespace) : L(r) && (e.currentWord.length === 0 || L(e.currentWord[e.currentWord.length - 1])) ? e.currentWord.push(r) : m(e, r, c.character); break; case c.tag: r === ">" ? (e.currentWord.push(r), e.words.push(e.currentWord.join("")), e.currentWord = [], e.mode = x(r) ? c.whitespace : c.character) : e.currentWord.push(r); break; case c.whitespace: u(r) ? m(e, r, c.tag) : S(r) ? m(e, r, c.entity) : x(r) ? e.currentWord.push(r) : m(e, r, c.character); break; case c.entity: if (u(r)) m(e, r, c.tag); else if (x(r)) m(e, r, c.whitespace); else if (q(r)) { let p = !0; if (e.currentWord.length !== 0 && (e.currentWord.push(r), e.words.push(e.currentWord.join("")), e.words.length > 2 && x(e.words[e.words.length - 2]) && x(e.words[e.words.length - 1]))) { let y = e.words[e.words.length - 2], N = e.words[e.words.length - 1]; e.words.splice(e.words.length - 2, 2), e.currentWord = [(y + N).split()], e.mode = c.whitespace, p = !1; } p && (e.currentWord = [], e.mode = c.character); } else L(r) ? e.currentWord.push(r) : m(e, r, c.character); } } return e.currentWord.length !== 0 && e.words.push(e.currentWord.join("")), e.words; } function m(n, t, e) { n.currentWord.length !== 0 && n.words.push(n.currentWord.join("")), n.currentWord = [t], n.mode = e; } const R = 4, C = /* @__PURE__ */ new Map([["</strong>", 0], ["</em>", 0], ["</b>", 0], ["</i>", 0], ["</big>", 0], ["</small>", 0], ["</u>", 0], ["</sub>", 0], ["</strike>", 0], ["</s>", 0]]), K = /<((strong)|(b)|(i)|(em)|(big)|(small)|(u)|(sub)|(sup)|(strike)|(s))[\>\s]+/gi; class H { constructor(t, e) { this.content = [], this.newText = e, this.oldText = t, this.specialTagDiffStack = [], this.newWords = [], this.oldWords = [], this.matchGranularity = 0, this.blockExpressions = [], this.repeatingWordsAccuracy = 1, this.ignoreWhiteSpaceDifferences = !1, this.orphanMatchThreshold = 0; } build() { if (this.oldText === this.newText) return this.newText; this.splitInputsIntoWords(), this.matchGranularity = Math.min(R, this.oldWords.length, this.newWords.length); let t = this.operations(); for (let e of t) this.performOperation(e); return this.content.join(""); } addBlockExpression(t) { this.blockExpressions.push(t); } splitInputsIntoWords() { this.oldWords = E(this.oldText, this.blockExpressions), this.oldText = null, this.newWords = E(this.newText, this.blockExpressions), this.newText = null; } performOperation(t) { switch (t.action) { case l.equal: this.processEqualOperation(t); break; case l.delete: this.processDeleteOperation(t, "diffdel"); break; case l.insert: this.processInsertOperation(t, "diffins"); break; case l.none: break; case l.replace: this.processReplaceOperation(t); } } processReplaceOperation(t) { this.processDeleteOperation(t, "diffmod"), this.processInsertOperation(t, "diffmod"); } processInsertOperation(t, e) { let s = this.newWords.filter((i, a) => a >= t.startInNew && a < t.endInNew); this.insertTag("ins", e, s); } processDeleteOperation(t, e) { let s = this.oldWords.filter((i, a) => a >= t.startInOld && a < t.endInOld); this.insertTag("del", e, s); } processEqualOperation(t) { let e = this.newWords.filter((s, i) => i >= t.startInNew && i < t.endInNew); this.content.push(e.join("")); } insertTag(t, e, s) { for (; s.length; ) { let i = this.extractConsecutiveWords(s, (r) => !k(r)), a = "", o = !1; if (i.length !== 0) { let r = Q(i.join(""), t, e); this.content.push(r); } else { if (K.test(s[0])) { if (this.specialTagDiffStack.push(s[0]), a = '<ins class="mod">', t === "del") for (s.shift(); s.length > 0 && K.test(s[0]); ) s.shift(); } else if (C.has(s[0])) { let r = this.specialTagDiffStack.length === 0 ? null : this.specialTagDiffStack.pop(); if (r !== null && r === s[0].replace(/\//g, "") && (a = "</ins>", o = !0), t === "del") for (s.shift(); s.length > 0 && C.has(s[0]); ) s.shift(); } if (s.length === 0 && a.length === 0) break; o ? this.content.push(a + this.extractConsecutiveWords(s, k).join("")) : this.content.push(this.extractConsecutiveWords(s, k).join("") + a); } } } extractConsecutiveWords(t, e) { let s = null; for (let i = 0; i < t.length; i++) { let a = t[i]; if (i === 0 && a === " " && (t[i] = "&nbsp;"), !e(a)) { s = i; break; } } if (s !== null) { let i = t.filter((a, o) => o >= 0 && o < s); return s > 0 && t.splice(0, s), i; } { let i = t.filter((a, o) => o >= 0 && o < t.length); return t.splice(0, t.length), i; } } operations() { let t = 0, e = 0, s = [], i = this.matchingBlocks(); i.push(new h(this.oldWords.length, this.newWords.length, 0)); let a = this.removeOrphans(i); for (let o of a) { let r, f = t === o.startInOld, p = e === o.startInNew; (r = f || p ? f && !p ? l.insert : f ? l.none : l.delete : l.replace) !== l.none && s.push(new j(r, t, o.startInOld, e, o.startInNew)), o.length !== 0 && s.push(new j(l.equal, o.startInOld, o.endInOld, o.startInNew, o.endInNew)), t = o.endInOld, e = o.endInNew; } return s; } *removeOrphans(t) { let e = null, s = null; for (let i of t) { if (s === null) { e = new h(0, 0, 0), s = i; continue; } if (e.endInOld === s.startInOld && e.endInNew === s.startInNew || s.endInOld === i.startInOld && s.endInNew === i.startInNew) { yield s, e = s, s = i; continue; } let a = (f, p) => f + p.length, o = this.oldWords.slice(e.endInOld, i.startInOld).reduce(a, 0), r = this.newWords.slice(e.endInNew, i.startInNew).reduce(a, 0); this.newWords.slice(s.startInNew, s.endInNew).reduce(a, 0) > Math.max(o, r) * this.orphanMatchThreshold && (yield s), e = s, s = i; } yield s; } matchingBlocks() { let t = []; return this.findMatchingBlocks(0, this.oldWords.length, 0, this.newWords.length, t), t; } findMatchingBlocks(t, e, s, i, a) { let o = this.findMatch(t, e, s, i); o !== null && (t < o.startInOld && s < o.startInNew && this.findMatchingBlocks(t, o.startInOld, s, o.startInNew, a), a.push(o), o.endInOld < e && o.endInNew < i && this.findMatchingBlocks(o.endInOld, e, o.endInNew, i, a)); } findMatch(t, e, s, i) { for (let a = this.matchGranularity; a > 0; a--) { let o = new M(); o.blockSize = a, o.repeatingWordsAccuracy = this.repeatingWordsAccuracy, o.ignoreWhitespaceDifferences = this.ignoreWhiteSpaceDifferences; let r = new Y(this.oldWords, this.newWords, t, e, s, i, o).findMatch(); if (r !== null) return r; } return null; } } H.execute = function(n, t) { return new H(n, t).build(); }, I.default = H; }, function(w, I, d) { w.exports = d(0); }]); const Te = /* @__PURE__ */ Ne(De), je = { class: "discuss-progress" }, Ee = { class: "progress" }, ze = { class: "header flex flex-between padding-10" }, Ae = { class: "name" }, Fe = { class: "btns" }, Ve = { class: "content" }, Be = { key: 0, class: "left" }, Ue = { class: "custom-tree-node" }, $e = { class: "dis-main-page" }, qe = { class: "dis-log-box" }, Le = /* @__PURE__ */ le({ __name: "index", setup(w) { const { lastInstanceState: I } = ge(), { viewAffirmState: d, viewAffirmCanceled: l, initNum: h } = Ie(), M = we(), U = me(), v = M.params.id, _ = fe(() => U.state.userInfo.id), b = z(), $ = (n) => { if (console.log(n), Object.keys(u.pageNumObj).length) { const e = u.pageNumObj; if (["sy", "fj"].includes(n.type)) { if (setTimeout(() => { var s; (s = document.querySelector(e[n.id] ? `.A4-box-${e[n.id]}` : `.clause-content-item-${n.id}`)) == null || s.scrollIntoView({ behavior: "smooth", block: "nearest" }); }, 100), n.pid === 0) return; } else setTimeout(() => { var s; (s = document.querySelector(`.A4-box-${e[n.id]}`)) == null || s.scrollIntoView({ behavior: "smooth", block: "nearest" }); }, 100); } else { var t = document.querySelector(`[discuss-id="${n["discuss-id"]}"]`); t == null || t.scrollIntoView({ behavior: "smooth", block: "nearest" }); } }, k = z(!1), Q = async () => { X(), await x(); }, u = se({ idsName: "", menu: [], pageNumObj: {}, content: "", finalStatus: "0", sourceModuleName: "", status: 0, reviewStatus: "" }), S = z(!1); let q = ""; const x = async () => { const n = await ae({ id: v }), t = L(n.menu); t && (u.menu = (t.menu || t).map((e) => ({ ...e, id: e.id || e["discuss-id"] })), u.pageNumObj = t.pageNumObj || {}), u.idsName = n.idsName, u.content = n.content, u.finalStatus = n.finalStatus, u.sourceModuleName = n.sourceModuleName, u.status = n.status, b.value.innerHTML = n.content, u.sourceName = n.sourceName, q = n.content, u.sourceName === "蜜蜂合议" ? b.value.style.padding = "25mm" : b.value.childNodes[0].style.margin = "0", k.value = _.value === n.createUser, n.status === 0 ? (c.isFinal = n.finalStatus !== "0", c.isEnd = !1) : (c.isFinal = !1, c.isEnd = !0), S.value = n.reviewSysUserIdList ? n.reviewSysUserIdList.includes(_.value) : !0; }; ne("getDiscussContent", x); const X = async () => { await ve({ disInfoId: v, sysUserId: _.value }); }, L = (n) => { try { return JSON.parse(n); } catch (t) { return console.log(t), !1; } }, J = async () => { if (await E(), c.isFinal || c.isEnd) { ee.error("合议状态发生变更,请刷新页面"); return; } I.show = !0; }, Y = async () => { if (await E(), c.isEnd || !S.value) { ee.error("合议状态发生变更,请刷新页面"); return; } d.show = !0; }, j = () => { _e({ disInfoId: v }).then((n) => { u.reviewStatus = n.reviewStatus; }); }; ne("reviewStatus", j); const c = se({ isFinal: !1, // 是否是终审 isEnd: !1 // 是否已经结束 }), E = async () => { let n; n = await ae({ id: v }), n.status === 0 ? (c.isFinal = n.finalStatus !== "0", c.isEnd = !1) : (c.isFinal = !1, c.isEnd = !0), S.value = n.reviewSysUserIdList ? n.reviewSysUserIdList.includes(_.value) : !0; }, m = async (n) => { if (await E(), c.isEnd || !S.value) { ee.error("合议状态发生变更,请刷新页面"); return; } let t = { sysUserId: _.value, disInfoId: v, reviewStatus: n }; n === 1 && (t.confirmOpinion = d.opinion), ye(t).then((e) => { We({ disInfoId: v, sysUserId: _.value, content: n === 1 ? "确认条款" : "取消确认条款", sourceTabName: "团队动态+合议记录", logDate: be() }), h.value++, j(), l(); }); }, R = z(!0), C = z(!1), K = async () => { C.value = !0; const t = (await xe({ id: v })).fileKeyOriginal, e = q, s = Te.execute(t, e); b.value.innerHTML = s, R.value = !1, C.value = !1; }, H = () => { R.value = !0, b.value.innerHTML = q; }; return z(), pe(async () => { await Q(), j(); }), (n, t) => { const e = B("el-button"), s = B("el-tree"), i = B("el-scrollbar"), a = B("DiscussCom"), o = re("discuss"), r = re("loading"); return g(), A("div", je, [ W("div", Ee, [ W("div", ze, [ W("div", Ae, ie(u.idsName), 1), W("div", Fe, [ u.sourceName !== "蜜蜂合议" ? (g(), A(Z, { key: 0 }, [ R.value ? (g(), T(e, { key: 0, type: "primary", size: "small", disabled: C.value, loading: C.value, onClick: K }, { default: O(() => [ V(" 查看修订 ") ]), _: 1 }, 8, ["disabled", "loading"])) : (g(), T(e, { key: 1, type: "primary", size: "small", onClick: H }, { default: O(() => [ V(" 隐藏修订 ") ]), _: 1 })) ], 64)) : F("", !0), u.status === 0 ? (g(), A(Z, { key: 1 }, [ u.finalStatus === "0" && k.value ? (g(), T(e, { key: 0, type: "primary", size: "small", onClick: J }, { default: O(() => [ V(" 发起终审 ") ]), _: 1 })) : F("", !0), u.finalStatus !== "0" && S.value ? (g(), A(Z, { key: 1 }, [ u.reviewStatus === 0 ? (g(), T(e, { key: 0, type: "primary", size: "small", onClick: Y }, { default: O(() => [ V(" 确认 ") ]), _: 1 })) : (g(), T(e, { key: 1, type: "primary", size: "small", onClick: t[0] || (t[0] = (f) => m(0)) }, { default: O(() => [ V(" 取消 ") ]), _: 1 })) ], 64)) : F("", !0) ], 64)) : F("", !0) ]) ]), W("div", Ve, [ u.menu.length ? (g(), A("div", Be, [ G(i, { style: { height: "calc(100% - 40px)", "margin-top": "10px" } }, { default: O(() => [ G(s, { ref: "treeRef", class: "clause-tree", data: u.menu, "expand-on-click-node": !1, "highlight-current": "", "node-key": "id", onNodeClick: $ }, { default: O(({ data: f }) => [ W("div", Ue, [ W("span", null, ie(f.content), 1) ]) ]), _: 1 }, 8, ["data"]) ]), _: 1 }) ])) : F("", !0), oe((g(), A("div", $e, [ G(i, null, { default: O(() => [ oe(W("div", { ref_key: "page", ref: b, class: "dis-page" }, null, 512), [ [o] ]) ]), _: 1 }) ])), [ [r, C.value] ]) ]) ]), W("div", qe, [ G(a, { id: D(v) }, null, 8, ["id"]) ]), D(d).show ? (g(), T(Me, { key: 0, id: D(v), title: D(d).opinion, "onUpdate:title": t[1] || (t[1] = (f) => D(d).opinion = f), show: D(d).show, onCanceled: D(l), onSaved: m }, null, 8, ["id", "title", "show", "onCanceled"])) : F("", !0) ]); }; } }), Qe = /* @__PURE__ */ ce(Le, [["__scopeId", "data-v-5802d207"]]); export { Qe as default };