dldiscuss
Version:
#### 介绍 {**以下是 Gitee 平台说明,您可以替换此简介** Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
454 lines (453 loc) • 13.9 kB
JavaScript
import { defineComponent as y, ref as j, computed as $, getCurrentInstance as U, resolveComponent as a, openBlock as I, createElementBlock as k, createElementVNode as P, createVNode as n, withCtx as r, withModifiers as q, renderSlot as z, createTextVNode as N, onMounted as R, watch as H, Fragment as K, renderList as Y, createBlock as x, normalizeClass as G, toDisplayString as J, createCommentVNode as Q, nextTick as X, unref as M, KeepAlive as Z, resolveDynamicComponent as ee } from "vue";
import { _ as A, o as te, q as se, t as oe, v as le, w as ne, x as ie } from "./discussCom-BiaeqCV0.mjs";
import { useRouter as re, useRoute as ae } from "vue-router";
import { createStore as ce } from "vuex";
import { socket as de } from "dl-components";
const fe = { class: "scroll-pane" }, ue = { class: "close-con" }, F = 4, _e = /* @__PURE__ */ y({
__name: "ScrollPane",
setup(e, { expose: t }) {
var T;
const s = j(), o = $(() => s.value.$el.firstElementChild), g = (i) => {
const p = i.wheelDelta || -i.deltaY * 40, u = o.value;
u.scrollLeft = u.scrollLeft + p / 4;
};
function d(i) {
const p = s.value.$el.offsetWidth, u = o.value.scrollWidth, c = o.value.scrollLeft;
i > 0 ? o.value.scrollLeft = c - i > 0 ? c - i : 0 : o.value.scrollLeft = c + p - i > u ? u - p : c - i;
}
const w = (T = U()) == null ? void 0 : T.parent;
function O(i) {
const u = s.value.$el.offsetWidth, c = o.value, h = w.refs.tag;
let L = null, S = null;
if (h.length > 0 && (L = h[0], S = h[h.length - 1]), L === i)
c.scrollLeft = 0;
else if (S === i)
c.scrollLeft = c.scrollWidth - u;
else {
const E = h.findIndex((f) => f === i), W = h[E - 1], D = h[E + 1], b = D.$el.offsetLeft + D.$el.offsetWidth + F, l = W.$el.offsetLeft - F;
b > c.scrollLeft + u ? c.scrollLeft = b - u : l < c.scrollLeft && (c.scrollLeft = l);
}
}
function C(i) {
i === "others" ? w.exposed.closeOthersTags() : w.exposed.closeAllTags();
}
return t({
moveToTarget: O
}), (i, p) => {
const u = a("arrow-left"), c = a("el-icon"), h = a("el-scrollbar"), L = a("arrow-right"), S = a("circle-close"), E = a("el-dropdown-item"), W = a("el-dropdown-menu"), D = a("el-dropdown");
return I(), k("div", fe, [
P("div", {
class: "move-btn",
onClick: p[0] || (p[0] = (b) => d(100))
}, [
n(c, null, {
default: r(() => [
n(u)
]),
_: 1
})
]),
n(h, {
ref_key: "scrollContainer",
ref: s,
vertical: !1,
class: "scroll-container",
onWheel: q(g, ["prevent"])
}, {
default: r(() => [
z(i.$slots, "default", {}, void 0, !0)
]),
_: 3
}, 512),
P("div", {
class: "move-btn move-btn-right",
onClick: p[1] || (p[1] = (b) => d(-100))
}, [
n(c, null, {
default: r(() => [
n(L)
]),
_: 1
})
]),
P("div", ue, [
n(D, {
size: "small",
trigger: "click",
onCommand: C
}, {
dropdown: r(() => [
n(W, null, {
default: r(() => [
n(E, { command: "others" }, {
default: r(() => [
N("关闭其他")
]),
_: 1
}),
n(E, { command: "all" }, {
default: r(() => [
N("关闭所有")
]),
_: 1
})
]),
_: 1
})
]),
default: r(() => [
n(c, { size: 16 }, {
default: r(() => [
n(S)
]),
_: 1
})
]),
_: 1
})
])
]);
};
}
}), pe = /* @__PURE__ */ A(_e, [["__scopeId", "data-v-39d0c2c1"]]), me = {
visitedViews: []
}, he = {
ADD_VISITED_VIEW: (e, t) => {
e.visitedViews.some((s) => s.path === t.path) || e.visitedViews.push(
Object.assign({}, t, {
title: t.tagName || "no-name"
})
);
},
DEL_VISITED_VIEW: (e, t) => {
for (const [s, o] of e.visitedViews.entries())
if (o.path === t.path) {
e.visitedViews.splice(s, 1);
break;
}
},
DEL_OTHERS_VISITED_VIEWS: (e, t) => {
e.visitedViews = e.visitedViews.filter((s) => s.meta.isDefault || s.path === t.path);
},
DEL_ALL_VISITED_VIEWS: (e) => {
const t = e.visitedViews.filter((s) => s.meta.isDefault);
e.visitedViews = t;
},
UPDATE_VISITED_VIEW: (e, t) => {
for (let s of e.visitedViews)
if (s.path === t.path) {
s = Object.assign(s, t);
break;
}
}
}, ve = {
addView({ commit: e }, t) {
e("ADD_VISITED_VIEW", t);
},
delView({ commit: e, state: t }, s) {
return new Promise((o) => {
e("DEL_VISITED_VIEW", s), o({
visitedViews: [...t.visitedViews]
});
});
},
delOthersViews({ commit: e, state: t }, s) {
return new Promise((o) => {
e("DEL_OTHERS_VISITED_VIEWS", s), o({
visitedViews: [...t.visitedViews]
});
});
},
delAllViews({ commit: e, state: t }, s) {
return new Promise((o) => {
e("DEL_ALL_VISITED_VIEWS"), o({
visitedViews: [...t.visitedViews]
});
});
},
updateVisitedView({ commit: e }, t) {
e("UPDATE_VISITED_VIEW", t);
}
}, ge = {
namespaced: !0,
state: me,
mutations: he,
actions: ve
}, we = {
id: "tags-view-container",
class: "tags-view-container"
}, Ve = /* @__PURE__ */ y({
__name: "index",
props: {
store: {
type: Object,
default: () => {
}
}
},
setup(e, { expose: t }) {
const s = e;
s.store.registerModule(["tagsView"], ge);
let o = re();
const g = $(() => s.store.state.menuList), d = $(() => ae()), w = j([]), O = $(() => s.store.state.tagsView.visitedViews), C = o.options.routes;
function T(l, f = "") {
let _ = [];
return l.forEach((m) => {
if (m.meta && m.meta.isDefault) {
const v = f + m.path;
_.push({
fullPath: v,
path: v,
name: m.name,
meta: { ...m.meta },
tagName: m.meta.tagName
});
}
if (m.children) {
const v = T(m.children, m.path);
v.length >= 1 && (_ = [..._, ...v]);
}
}), _;
}
function i() {
w.value = T(C);
for (const l of w.value)
s.store.dispatch("tagsView/addView", l);
}
function p() {
let l = u(g.value, d.value.path);
return l ? d.value.tagName = l : d.value.tagName = d.value.query.tagName, s.store.dispatch("tagsView/addView", d.value), !1;
}
function u(l, f) {
let _;
for (let m = 0; m < l.length; m++) {
const v = l[m];
if (v.serverUrl === f && (_ = v.serverName), v.children && v.children.length && (_ = u(v.children, f)), _)
return _;
}
}
const c = U(), h = j();
function L() {
const l = c.refs.tag;
X(() => {
for (const f of l)
if (f.to.path === d.value.path) {
h.value.moveToTarget && h.value.moveToTarget(f), f.to.fullPath !== d.value.fullPath && s.store.dispatch("tagsView/updateVisitedView", d.value);
break;
}
});
}
function S(l) {
s.store.dispatch("tagsView/delView", l).then(({ visitedViews: f }) => {
b(l) && D(f);
});
}
function E() {
s.store.dispatch("tagsView/delOthersViews", d.value).then(() => {
L();
});
}
function W() {
const l = d.value;
s.store.dispatch("tagsView/delAllViews").then(({ visitedViews: f }) => {
w.value.some((_) => _.path === l.path) || D(f);
});
}
function D(l, f) {
const _ = l.slice(-1)[0];
_ ? o.push(_.fullPath) : o.push("/");
}
function b(l) {
return l.path === d.value.path;
}
return R(() => {
i(), p();
}), H(
() => d.value.path,
(l, f) => {
p(), L();
}
), t({
closeOthersTags: E,
closeAllTags: W
}), (l, f) => {
const _ = a("Close"), m = a("el-icon"), v = a("router-link");
return I(), k("div", we, [
n(pe, {
ref_key: "scrollPane",
ref: h,
class: "tags-view-wrapper"
}, {
default: r(() => [
(I(!0), k(K, null, Y(O.value, (V) => (I(), x(v, {
ref_for: !0,
ref: "tag",
key: V.path,
class: G([b(V) ? "active" : "", "tags-view-item"]),
to: { path: V.path, query: V.query, fullPath: V.fullPath }
}, {
default: r(() => [
N(J(V.title) + " ", 1),
V.meta.isDefault ? Q("", !0) : (I(), x(m, {
key: 0,
onClick: q((Ee) => S(V), ["prevent", "stop"])
}, {
default: r(() => [
n(_)
]),
_: 2
}, 1032, ["onClick"]))
]),
_: 2
}, 1032, ["class", "to"]))), 128))
]),
_: 1
}, 512)
]);
};
}
}), Ie = /* @__PURE__ */ A(Ve, [["__scopeId", "data-v-c49c7b19"]]), B = ce({
state: {
// 放置变量
menuList: [],
// 菜单栏
userInfo: {},
// 用户信息
isCollapse: !0,
filterObj: {},
downloadFn: te,
previewFn: se
},
mutations: {
// 获取set方法
// 菜单栏的数据
setMenuList: (e) => {
e.menuList = oe();
},
// 用户信息
setUserInfo: (e, t) => {
e.userInfo = t;
},
// 用户信息
setIsCollapse: (e) => {
e.isCollapse = !e.isCollapse;
},
// 添加页面过滤条件
setFilter: (e, { name: t, data: s }) => {
s ? e.filterObj[t] = s : e.filterObj[t] = {
limit: 10,
pageNum: 1,
searchMap: {}
};
},
// 修改某页面过滤条件
setFilterAttr: (e, { name: t, attr: s, val: o }) => {
if (o !== null && typeof o == "object")
for (let g in o)
o[g] != "" ? e.filterObj[t].searchMap[g] = o[g] : delete e.filterObj[t].searchMap[g];
else
o ? e.filterObj[t][s] = o : delete e.filterObj[t][s];
},
// 删除某页面过滤条件
delFilter: (e, t) => {
t ? delete e.filterObj[t] : e.filterObj = {};
}
},
getters: {
getFilterObj: (e) => (t) => (e.filterObj[t] || (e.filterObj[t] = {
limit: 10,
pageNum: 1,
searchMap: {}
}), e.filterObj[t]),
// 获取每个页面的按钮
getBtnList: (e) => (t) => le(t),
// 获取当前用户信息
getUserInfo: (e) => () => {
e.userInfo = {}, ne().then((t) => {
e.userInfo = t;
});
}
},
actions: {},
modules: {}
}), Te = { class: "main" }, Le = /* @__PURE__ */ y({
__name: "index",
setup(e) {
B.commit("setMenuList");
const t = (s) => {
};
return R(() => {
de.init(t);
}), (s, o) => {
const g = a("dl-menu"), d = a("el-aside"), w = a("dl-header"), O = a("el-header"), C = a("router-view"), T = a("el-main"), i = a("el-container"), p = a("el-config-provider");
return I(), k("div", Te, [
n(p, null, {
default: r(() => [
n(i, { class: "main-container" }, {
default: r(() => [
n(d, null, {
default: r(() => [
n(g, { hiddenMenu: [
"产品定价",
"产品条款",
"产品报备材料",
"指标标签库",
"指标分类库",
"假设类别库",
"假设目的库",
"责任给付维度",
"报备材料分类",
"条款版式库",
"条款释义库",
"要素库",
"猎豹定价管理员",
"产品模板库",
"标签规则"
] })
]),
_: 1
}),
n(i, null, {
default: r(() => [
n(O, { height: "50px" }, {
default: r(() => [
n(w, {
title: "蜜蜂合议",
logout: M(ie),
hasOperation: ""
}, null, 8, ["logout"])
]),
_: 1
}),
n(Ie, { store: M(B) }, null, 8, ["store"]),
n(T, null, {
default: r(() => [
n(C, { class: "main-content" }, {
default: r(({ Component: u }) => [
(I(), x(Z, null, [
(I(), x(ee(u), {
key: s.$route.fullPath
}))
], 1024))
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
]);
};
}
}), We = /* @__PURE__ */ A(Le, [["__scopeId", "data-v-5ae8b41b"]]);
export {
We as default
};