inl-ui 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -1087
- package/dist/index.js.map +1 -1
- package/dist/src/pageComponent/views/data-center/components/chart.d.ts +1 -1
- package/dist/src/pageComponent/views/projectManager/utils/index.d.ts +1 -1
- package/dist/src/tpInit/index.d.ts +3 -3
- package/package.json +1 -1
- package/src/pageComponent/views/thingInstance/index.tsx +4 -1
- package/dist/components/index.cjs +0 -683
- package/dist/components/index.d.ts +0 -84
- package/dist/components/index.js +0 -672
- package/dist/directives/index.cjs +0 -74
- package/dist/directives/index.d.ts +0 -15
- package/dist/directives/index.js +0 -69
- package/dist/hooks/index.cjs +0 -133
- package/dist/hooks/index.d.ts +0 -50
- package/dist/hooks/index.js +0 -121
- package/dist/iconfont.js +0 -69
- package/dist/index.cjs +0 -1068
- package/dist/index.d.ts +0 -241
- package/dist/src/pageComponent/views/projectManager/hooks/useTreeSearch.d.ts +0 -3105
- package/dist/utils/index.cjs +0 -181
- package/dist/utils/index.d.ts +0 -72
- package/dist/utils/index.js +0 -167
package/dist/index.cjs
DELETED
|
@@ -1,1068 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var qiankun = require('vite-plugin-qiankun');
|
|
6
|
-
var renderWithQiankun = require('vite-plugin-qiankun/dist/helper');
|
|
7
|
-
var vue = require('vue');
|
|
8
|
-
var axios = require('axios');
|
|
9
|
-
var antDesignVue = require('ant-design-vue');
|
|
10
|
-
var _ = require('lodash');
|
|
11
|
-
var core = require('@vueuse/core');
|
|
12
|
-
var dayjs = require('dayjs');
|
|
13
|
-
var iconsVue = require('@ant-design/icons-vue');
|
|
14
|
-
var vueRouter = require('vue-router');
|
|
15
|
-
var qiankun$1 = require('qiankun');
|
|
16
|
-
var appList = require('@/micro-apps/apps');
|
|
17
|
-
|
|
18
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var qiankun__default = /*#__PURE__*/_interopDefaultLegacy(qiankun);
|
|
21
|
-
var renderWithQiankun__default = /*#__PURE__*/_interopDefaultLegacy(renderWithQiankun);
|
|
22
|
-
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
23
|
-
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
24
|
-
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
25
|
-
var appList__default = /*#__PURE__*/_interopDefaultLegacy(appList);
|
|
26
|
-
|
|
27
|
-
var version = "0.1.0-rc.17";
|
|
28
|
-
|
|
29
|
-
const setTheme = theme => {
|
|
30
|
-
if (theme === "dark") {
|
|
31
|
-
document.getElementsByTagName("html")[0].setAttribute("data-doc-theme", "dark");
|
|
32
|
-
document.getElementsByTagName("body")[0].setAttribute("data-theme", "dark");
|
|
33
|
-
document.getElementsByTagName("html")[0].style.colorScheme = "dark";
|
|
34
|
-
} else {
|
|
35
|
-
document.getElementsByTagName("html")[0].setAttribute("data-doc-theme", "light");
|
|
36
|
-
document.getElementsByTagName("body")[0].setAttribute("data-theme", "light");
|
|
37
|
-
document.getElementsByTagName("html")[0].style.colorScheme = "light";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var changeTheme = {
|
|
41
|
-
set(theme) {
|
|
42
|
-
window.localStorage.setItem("theme", theme);
|
|
43
|
-
setTheme(theme);
|
|
44
|
-
},
|
|
45
|
-
settingTheme(theme) {
|
|
46
|
-
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
47
|
-
theme = theme || window.localStorage.getItem("theme") || systemTheme;
|
|
48
|
-
setTheme(theme);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const setRem = opt => {
|
|
53
|
-
const fontSize = opt.fontSize || 14;
|
|
54
|
-
const designSize = opt.designSize || 1920;
|
|
55
|
-
const scale = document.documentElement.clientWidth / designSize;
|
|
56
|
-
document.documentElement.style.fontSize = `${fontSize * Math.min(scale, 2)}px`;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const isMicroApp = renderWithQiankun.qiankunWindow.__POWERED_BY_QIANKUN__;
|
|
60
|
-
const transformRoutes = (appName, routes) => {
|
|
61
|
-
if (isMicroApp) {
|
|
62
|
-
let addBase = function (rs) {
|
|
63
|
-
for (const r of rs) {
|
|
64
|
-
r.path = `/${appName}${r.path}`;
|
|
65
|
-
if (r.children?.length) {
|
|
66
|
-
addBase(r.children);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const newRoutes = routes.filter(item => item.name !== "login" && item.path !== "/login");
|
|
71
|
-
addBase(routes);
|
|
72
|
-
newRoutes.push({
|
|
73
|
-
path: "/:pathMatch(.*)*",
|
|
74
|
-
component: {
|
|
75
|
-
render: () => ""
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return newRoutes;
|
|
79
|
-
}
|
|
80
|
-
return routes;
|
|
81
|
-
};
|
|
82
|
-
function microAppPlugin(name) {
|
|
83
|
-
return qiankun__default["default"](name, {
|
|
84
|
-
useDevMode: true
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function render(AppRoot, rootEl, configApp) {
|
|
88
|
-
let app;
|
|
89
|
-
const _render = (props = {}) => {
|
|
90
|
-
const {
|
|
91
|
-
container
|
|
92
|
-
} = props;
|
|
93
|
-
const root = container ? container.querySelector(rootEl) : rootEl;
|
|
94
|
-
app = vue.createApp(AppRoot);
|
|
95
|
-
configApp(app, props);
|
|
96
|
-
app.mount(root);
|
|
97
|
-
};
|
|
98
|
-
const initQianKun = () => {
|
|
99
|
-
renderWithQiankun__default["default"]({
|
|
100
|
-
bootstrap() {
|
|
101
|
-
console.log("\u5FAE\u5E94\u7528\uFF1Abootstrap");
|
|
102
|
-
},
|
|
103
|
-
mount(props) {
|
|
104
|
-
console.log("\u5FAE\u5E94\u7528\uFF1Amount", props);
|
|
105
|
-
_render(props);
|
|
106
|
-
},
|
|
107
|
-
unmount(props) {
|
|
108
|
-
console.log("\u5FAE\u5E94\u7528\uFF1Aunmount", props);
|
|
109
|
-
app.unmount();
|
|
110
|
-
},
|
|
111
|
-
update(props) {
|
|
112
|
-
console.log("\u5FAE\u5E94\u7528\uFF1Aupdate", props);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
isMicroApp ? initQianKun() : _render();
|
|
117
|
-
}
|
|
118
|
-
const microAppUtils = {
|
|
119
|
-
isMicroApp,
|
|
120
|
-
transformRoutes,
|
|
121
|
-
microAppPlugin,
|
|
122
|
-
render
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const config = {
|
|
126
|
-
prefix: "inl",
|
|
127
|
-
requestOmitParams: ["createDt", "createUser", "updateDt", "updateUser"]
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const getToken = () => sessionStorage.getItem("token");
|
|
131
|
-
const getCorpId = () => sessionStorage.getItem("corpId");
|
|
132
|
-
const getUserinfo = () => {
|
|
133
|
-
const jsonString = sessionStorage.getItem("userinfo");
|
|
134
|
-
if (jsonString) {
|
|
135
|
-
return JSON.parse(jsonString);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
class ApiInstance {
|
|
139
|
-
instance;
|
|
140
|
-
config;
|
|
141
|
-
constructor(config$1) {
|
|
142
|
-
this.config = config$1;
|
|
143
|
-
this.instance = axios__default["default"].create(config$1);
|
|
144
|
-
this.instance.interceptors.request.use(config2 => {
|
|
145
|
-
const userinfo = getUserinfo();
|
|
146
|
-
const token = getToken();
|
|
147
|
-
const corpId = getCorpId();
|
|
148
|
-
if (!_.isEmpty(config2.data)) {
|
|
149
|
-
config2.data = _.omit(config2.data, ...config.requestOmitParams);
|
|
150
|
-
}
|
|
151
|
-
config2.headers.token = token;
|
|
152
|
-
config2.headers.userId = userinfo?.userId;
|
|
153
|
-
config2.headers.userName = userinfo?.userName;
|
|
154
|
-
config2.headers.corpId = corpId;
|
|
155
|
-
return config2;
|
|
156
|
-
}, err => {
|
|
157
|
-
return Promise.reject(err);
|
|
158
|
-
});
|
|
159
|
-
this.instance.interceptors.response.use(res => {
|
|
160
|
-
return new Promise((resolve, reject) => {
|
|
161
|
-
if (res.config.responseType === "blob") {
|
|
162
|
-
resolve(res.data);
|
|
163
|
-
}
|
|
164
|
-
if (res.data.code === "M0000") {
|
|
165
|
-
resolve(res.data);
|
|
166
|
-
} else if (res.data.code === "M4003") {
|
|
167
|
-
this.config.onTokenExpired?.(res);
|
|
168
|
-
reject(res);
|
|
169
|
-
} else {
|
|
170
|
-
const alertMessage = res.data.message ?? "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458";
|
|
171
|
-
antDesignVue.message.error(alertMessage, alertMessage.length > 10 ? 10 : 3);
|
|
172
|
-
reject(res.data);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}, err => {
|
|
176
|
-
return Promise.reject(err);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const utils = {
|
|
182
|
-
changeTheme,
|
|
183
|
-
setRem,
|
|
184
|
-
microAppUtils,
|
|
185
|
-
ApiInstance
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const focusDirective = {
|
|
189
|
-
mounted(el, {
|
|
190
|
-
value
|
|
191
|
-
}) {
|
|
192
|
-
if (value !== false) {
|
|
193
|
-
el.focus();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const autoScroll = {
|
|
199
|
-
mounted(el, {
|
|
200
|
-
value = "ant-table-body",
|
|
201
|
-
modifiers
|
|
202
|
-
}) {
|
|
203
|
-
let timer;
|
|
204
|
-
let timer2;
|
|
205
|
-
let hover = false;
|
|
206
|
-
let wait = false;
|
|
207
|
-
const {
|
|
208
|
-
self
|
|
209
|
-
} = modifiers;
|
|
210
|
-
const _baseWidth = window.innerWidth / window.innerHeight > 2 ? 7200 : 2880;
|
|
211
|
-
const step = Math.ceil(_baseWidth / window.innerWidth);
|
|
212
|
-
const onmouseenter = () => hover = true;
|
|
213
|
-
const onmouseleave = () => hover = false;
|
|
214
|
-
const scrollEl = self ? el : el.querySelector(`.${value}`);
|
|
215
|
-
if (!scrollEl) return;
|
|
216
|
-
const startScroll = () => {
|
|
217
|
-
if (!document.contains(el)) {
|
|
218
|
-
timer && clearInterval(timer);
|
|
219
|
-
el.removeEventListener("mouseenter", onmouseenter);
|
|
220
|
-
el.removeEventListener("mouseleave", onmouseleave);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (hover) return;
|
|
224
|
-
const scrollElHeight = scrollEl.getBoundingClientRect().height;
|
|
225
|
-
if (scrollElHeight >= scrollEl.scrollHeight) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (!hover && scrollEl.scrollTop + scrollElHeight > scrollEl.scrollHeight - step) {
|
|
229
|
-
if (timer2) return;
|
|
230
|
-
timer2 = setTimeout(() => {
|
|
231
|
-
if (!hover) {
|
|
232
|
-
scrollEl.scrollTop = 0;
|
|
233
|
-
}
|
|
234
|
-
setTimeout(() => {
|
|
235
|
-
if (!hover) {
|
|
236
|
-
wait = false;
|
|
237
|
-
}
|
|
238
|
-
}, 1e3);
|
|
239
|
-
timer2 = null;
|
|
240
|
-
}, 1e3);
|
|
241
|
-
wait = true;
|
|
242
|
-
} else {
|
|
243
|
-
if (!wait) {
|
|
244
|
-
scrollEl.scrollTo({
|
|
245
|
-
top: scrollEl.scrollTop + step
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
timer = setInterval(startScroll, 100);
|
|
251
|
-
el.addEventListener("mouseenter", onmouseenter);
|
|
252
|
-
el.addEventListener("mouseleave", onmouseleave);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
var directives = /*#__PURE__*/Object.freeze({
|
|
257
|
-
__proto__: null,
|
|
258
|
-
focusDirective: focusDirective,
|
|
259
|
-
autoScroll: autoScroll
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
function useNow(pattern) {
|
|
263
|
-
const now = vue.ref();
|
|
264
|
-
const updateNow = () => {
|
|
265
|
-
const nowDayjs = dayjs__default["default"]();
|
|
266
|
-
now.value = pattern ? nowDayjs.format(pattern) : nowDayjs;
|
|
267
|
-
};
|
|
268
|
-
core.useIntervalFn(updateNow, 1e3, {
|
|
269
|
-
immediate: false,
|
|
270
|
-
immediateCallback: true
|
|
271
|
-
});
|
|
272
|
-
return now;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function useTableList(getData, listProp, totalName = "totalCount") {
|
|
276
|
-
const tableList = vue.ref([]);
|
|
277
|
-
const isLoading = vue.ref(false);
|
|
278
|
-
const total = vue.ref(0);
|
|
279
|
-
const refresh = async () => {
|
|
280
|
-
isLoading.value = true;
|
|
281
|
-
try {
|
|
282
|
-
const {
|
|
283
|
-
data
|
|
284
|
-
} = await getData();
|
|
285
|
-
if (listProp) {
|
|
286
|
-
tableList.value = data[listProp];
|
|
287
|
-
total.value = data[totalName];
|
|
288
|
-
} else {
|
|
289
|
-
tableList.value = data;
|
|
290
|
-
}
|
|
291
|
-
} finally {
|
|
292
|
-
isLoading.value = false;
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
const refreshDebounced = _.debounce(refresh, 200);
|
|
296
|
-
const currPage = vue.ref(1);
|
|
297
|
-
const handlePageChange = page => {
|
|
298
|
-
currPage.value = page;
|
|
299
|
-
refresh();
|
|
300
|
-
};
|
|
301
|
-
vue.watch(total, () => {
|
|
302
|
-
const pageCount = Math.ceil(total.value / pageSize.value);
|
|
303
|
-
if (currPage.value > 1 && currPage.value > pageCount) {
|
|
304
|
-
currPage.value = pageCount;
|
|
305
|
-
refresh();
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
const pageSize = vue.ref(10);
|
|
309
|
-
const hanldePageSizeChange = size => {
|
|
310
|
-
currPage.value = 1;
|
|
311
|
-
pageSize.value = size;
|
|
312
|
-
refresh();
|
|
313
|
-
};
|
|
314
|
-
const pagination = vue.reactive({
|
|
315
|
-
current: currPage,
|
|
316
|
-
pageSize,
|
|
317
|
-
total,
|
|
318
|
-
showSizeChanger: true,
|
|
319
|
-
showQuickJumper: true,
|
|
320
|
-
showTotal: total2 => `\u5171 ${total2} \u6761`,
|
|
321
|
-
"onUpdate:current": handlePageChange,
|
|
322
|
-
"onUpdate:pageSize": hanldePageSizeChange
|
|
323
|
-
});
|
|
324
|
-
return {
|
|
325
|
-
isLoading,
|
|
326
|
-
tableList,
|
|
327
|
-
currPage,
|
|
328
|
-
handlePageChange,
|
|
329
|
-
pageSize,
|
|
330
|
-
hanldePageSizeChange,
|
|
331
|
-
total,
|
|
332
|
-
refresh: refreshDebounced,
|
|
333
|
-
pagination
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function useModalVisible(defaultVisible = false) {
|
|
338
|
-
const visible = vue.ref(defaultVisible);
|
|
339
|
-
const record = vue.ref();
|
|
340
|
-
const onToggle = r => {
|
|
341
|
-
if (r) {
|
|
342
|
-
record.value = r;
|
|
343
|
-
}
|
|
344
|
-
visible.value = !visible.value;
|
|
345
|
-
};
|
|
346
|
-
return [visible, onToggle, record];
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
function useQianKunState(action) {
|
|
350
|
-
let isSync = false;
|
|
351
|
-
const state = vue.ref({});
|
|
352
|
-
if (___default["default"].isEmpty(action)) {
|
|
353
|
-
return state;
|
|
354
|
-
}
|
|
355
|
-
const {
|
|
356
|
-
onGlobalStateChange,
|
|
357
|
-
offGlobalStateChange,
|
|
358
|
-
setGlobalState
|
|
359
|
-
} = action;
|
|
360
|
-
const handleGlobalStateChange = value => {
|
|
361
|
-
isSync = true;
|
|
362
|
-
state.value = value;
|
|
363
|
-
vue.nextTick(() => isSync = false);
|
|
364
|
-
};
|
|
365
|
-
vue.watch(state, val => {
|
|
366
|
-
if (!isSync) {
|
|
367
|
-
setGlobalState(val);
|
|
368
|
-
}
|
|
369
|
-
}, {
|
|
370
|
-
deep: true
|
|
371
|
-
});
|
|
372
|
-
vue.onMounted(() => onGlobalStateChange(handleGlobalStateChange, true));
|
|
373
|
-
vue.onBeforeUnmount(() => offGlobalStateChange());
|
|
374
|
-
return state;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
var hooks = /*#__PURE__*/Object.freeze({
|
|
378
|
-
__proto__: null,
|
|
379
|
-
useNow: useNow,
|
|
380
|
-
useTableList: useTableList,
|
|
381
|
-
useModalVisible: useModalVisible,
|
|
382
|
-
useQianKunState: useQianKunState
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
const {
|
|
386
|
-
prefix
|
|
387
|
-
} = config;
|
|
388
|
-
function installComponent(component, name, withPrefix = true) {
|
|
389
|
-
component.install = app => {
|
|
390
|
-
name = withPrefix ? `${prefix}-${name}` : name;
|
|
391
|
-
app.component(name, component);
|
|
392
|
-
};
|
|
393
|
-
return component;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
const Demo = vue.defineComponent({
|
|
397
|
-
props: {
|
|
398
|
-
name: {
|
|
399
|
-
type: String,
|
|
400
|
-
default: "\u5F20\u4E09"
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
setup(props) {
|
|
404
|
-
return () => vue.createVNode("div", {
|
|
405
|
-
"class": "Demo"
|
|
406
|
-
}, ["\u6211\u662Fdemo, ", props.name]);
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
var index$3 = installComponent(Demo, "demo");
|
|
410
|
-
|
|
411
|
-
const IconFont = iconsVue.createFromIconfontCN();
|
|
412
|
-
var index$2 = installComponent(IconFont, "icon-font", false);
|
|
413
|
-
|
|
414
|
-
function getMenuByKeyPath(menuList, keyPath, keyProp = "id") {
|
|
415
|
-
function getMenuByKey2(list2, key) {
|
|
416
|
-
return list2.find(item => item[keyProp] && item[keyProp] === key);
|
|
417
|
-
}
|
|
418
|
-
let list = menuList;
|
|
419
|
-
for (let i = 0; i < keyPath.length; i++) {
|
|
420
|
-
const menu = getMenuByKey2(list, keyPath[i]);
|
|
421
|
-
if (!menu) return;
|
|
422
|
-
if (i === keyPath.length - 1) {
|
|
423
|
-
return menu;
|
|
424
|
-
}
|
|
425
|
-
list = menu.subList;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
function flattenMenu(menuList) {
|
|
429
|
-
const res = [];
|
|
430
|
-
for (const menu of menuList) {
|
|
431
|
-
res.push(menu);
|
|
432
|
-
res.push(...menu.subList);
|
|
433
|
-
}
|
|
434
|
-
return res;
|
|
435
|
-
}
|
|
436
|
-
function getMenuByKey(menuList, key, propName = "id") {
|
|
437
|
-
const flattenMenuList = flattenMenu(menuList);
|
|
438
|
-
return flattenMenuList.find(item => item[propName] && item[propName] === key);
|
|
439
|
-
}
|
|
440
|
-
function getNavByChildKey(navList, key, propName = "id") {
|
|
441
|
-
for (const nav of navList) {
|
|
442
|
-
const menu = getMenuByKey(nav.subList, key, propName);
|
|
443
|
-
if (menu) {
|
|
444
|
-
return nav;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function useActiveMenu(menuList, extraPages, isNav = false, watchOnce = false) {
|
|
450
|
-
const route = vueRouter.useRoute();
|
|
451
|
-
const isMounted = core.useMounted();
|
|
452
|
-
const menu = vue.ref();
|
|
453
|
-
const unwatch = vue.watch([menuList, isMounted, route], ___default["default"].debounce(([list]) => {
|
|
454
|
-
if (list.length && isMounted) {
|
|
455
|
-
watchOnce && unwatch();
|
|
456
|
-
const {
|
|
457
|
-
query,
|
|
458
|
-
path
|
|
459
|
-
} = route;
|
|
460
|
-
const id = "" + query.iframeId;
|
|
461
|
-
if (query.iframeId) {
|
|
462
|
-
menu.value = isNav ? getNavByChildKey(list, id, "id") : getMenuByKey(list, id, "id");
|
|
463
|
-
} else if (query.extraPageKey) {
|
|
464
|
-
const page = extraPages.find(item => item.key === query.extraPageKey);
|
|
465
|
-
menu.value = page;
|
|
466
|
-
} else if (path !== "/") {
|
|
467
|
-
menu.value = isNav ? getNavByChildKey(list, path, "url") : getMenuByKey(list, path, "url");
|
|
468
|
-
} else {
|
|
469
|
-
const getFirstMenu = list2 => {
|
|
470
|
-
if (list2[0].subList?.length) {
|
|
471
|
-
return getFirstMenu(list2[0].subList);
|
|
472
|
-
}
|
|
473
|
-
return list2[0];
|
|
474
|
-
};
|
|
475
|
-
const firstMenu = getFirstMenu(list);
|
|
476
|
-
menu.value = firstMenu;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}, 10, {
|
|
480
|
-
leading: false
|
|
481
|
-
}));
|
|
482
|
-
return menu;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
function _isSlot$1(s) {
|
|
486
|
-
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
487
|
-
}
|
|
488
|
-
const Header = vue.defineComponent({
|
|
489
|
-
emits: ["navSelect"],
|
|
490
|
-
props: {
|
|
491
|
-
menu: {
|
|
492
|
-
type: Array,
|
|
493
|
-
required: true
|
|
494
|
-
},
|
|
495
|
-
logo: {
|
|
496
|
-
type: String
|
|
497
|
-
},
|
|
498
|
-
userInfo: {
|
|
499
|
-
type: Object,
|
|
500
|
-
required: true
|
|
501
|
-
},
|
|
502
|
-
extraPages: {
|
|
503
|
-
type: Array,
|
|
504
|
-
required: true
|
|
505
|
-
},
|
|
506
|
-
messageCount: {
|
|
507
|
-
type: Number
|
|
508
|
-
}
|
|
509
|
-
},
|
|
510
|
-
setup(props, {
|
|
511
|
-
emit
|
|
512
|
-
}) {
|
|
513
|
-
const isMounted = core.useMounted();
|
|
514
|
-
const router = vueRouter.useRouter();
|
|
515
|
-
const searchText = vue.ref("");
|
|
516
|
-
const handleGlobalSearch = () => {
|
|
517
|
-
searchText.value = "";
|
|
518
|
-
};
|
|
519
|
-
const acitveMenuKey = vue.ref([]);
|
|
520
|
-
const handleMenuSelected = ({
|
|
521
|
-
key
|
|
522
|
-
}) => {
|
|
523
|
-
emit("navSelect", key);
|
|
524
|
-
};
|
|
525
|
-
const activeMenu = useActiveMenu(() => props.menu, props.extraPages, true);
|
|
526
|
-
vue.watch(activeMenu, val => {
|
|
527
|
-
if (val && val.id) {
|
|
528
|
-
handleMenuSelected({
|
|
529
|
-
key: val.id
|
|
530
|
-
});
|
|
531
|
-
acitveMenuKey.value = [val.id];
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
const cancleWatch = vue.watch([isMounted, () => props.menu], ([mounted, list]) => {
|
|
535
|
-
if (mounted && list.length) {
|
|
536
|
-
cancleWatch();
|
|
537
|
-
if (!activeMenu.value) {
|
|
538
|
-
const firstNav = list[0];
|
|
539
|
-
emit("navSelect", firstNav.id);
|
|
540
|
-
acitveMenuKey.value = [firstNav.id];
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
const handlePersonalCenter = () => {
|
|
545
|
-
router.push({
|
|
546
|
-
path: "/",
|
|
547
|
-
query: {
|
|
548
|
-
extraPageKey: "personalCenter"
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
};
|
|
552
|
-
return () => {
|
|
553
|
-
let _slot;
|
|
554
|
-
return vue.createVNode("div", {
|
|
555
|
-
"class": "header"
|
|
556
|
-
}, [vue.createVNode("div", {
|
|
557
|
-
"class": "logo"
|
|
558
|
-
}, [vue.createVNode("img", {
|
|
559
|
-
"src": props.logo,
|
|
560
|
-
"alt": ""
|
|
561
|
-
}, null)]), vue.createVNode(antDesignVue.Menu, {
|
|
562
|
-
"class": "menu",
|
|
563
|
-
"mode": "horizontal",
|
|
564
|
-
"selectedKeys": acitveMenuKey.value,
|
|
565
|
-
"onUpdate:selectedKeys": $event => acitveMenuKey.value = $event,
|
|
566
|
-
"onSelect": handleMenuSelected
|
|
567
|
-
}, _isSlot$1(_slot = props.menu.map(item => vue.createVNode(antDesignVue.MenuItem, {
|
|
568
|
-
"key": item.id,
|
|
569
|
-
"icon": vue.createVNode(vue.resolveComponent("icon-font"), {
|
|
570
|
-
"type": item.icon
|
|
571
|
-
}, null)
|
|
572
|
-
}, {
|
|
573
|
-
default: () => [item.name]
|
|
574
|
-
}))) ? _slot : {
|
|
575
|
-
default: () => [_slot]
|
|
576
|
-
}), vue.createVNode(antDesignVue.Input, {
|
|
577
|
-
"class": "search",
|
|
578
|
-
"placeholder": "\u641C\u7D22",
|
|
579
|
-
"allowClear": true,
|
|
580
|
-
"value": searchText.value,
|
|
581
|
-
"onUpdate:value": $event => searchText.value = $event,
|
|
582
|
-
"onPressEnter": handleGlobalSearch
|
|
583
|
-
}, {
|
|
584
|
-
suffix: () => vue.createVNode(iconsVue.SearchOutlined, null, null)
|
|
585
|
-
}), vue.createVNode("div", {
|
|
586
|
-
"class": "user-info"
|
|
587
|
-
}, [vue.createVNode("span", {
|
|
588
|
-
"class": "username"
|
|
589
|
-
}, [props.userInfo.userName]), vue.createVNode("div", {
|
|
590
|
-
"onClick": handlePersonalCenter
|
|
591
|
-
}, [vue.createVNode(antDesignVue.Badge, {
|
|
592
|
-
"dot": !!props.messageCount
|
|
593
|
-
}, {
|
|
594
|
-
default: () => [vue.createVNode(antDesignVue.Avatar, {
|
|
595
|
-
"class": "avatar",
|
|
596
|
-
"src": "https://joeschmoe.io/api/v1/random"
|
|
597
|
-
}, null)]
|
|
598
|
-
})])])]);
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
|
|
603
|
-
function _isSlot(s) {
|
|
604
|
-
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
605
|
-
}
|
|
606
|
-
const renderMenuItem = item => {
|
|
607
|
-
if (item.subList?.length) {
|
|
608
|
-
let _slot;
|
|
609
|
-
return vue.createVNode(antDesignVue.SubMenu, {
|
|
610
|
-
"key": item.id,
|
|
611
|
-
"icon": vue.createVNode(vue.resolveComponent("icon-font"), {
|
|
612
|
-
"type": item.icon
|
|
613
|
-
}, null),
|
|
614
|
-
"title": item.name
|
|
615
|
-
}, _isSlot(_slot = item.subList.map(i => renderMenuItem(i))) ? _slot : {
|
|
616
|
-
default: () => [_slot]
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
return vue.createVNode(antDesignVue.MenuItem, {
|
|
620
|
-
"key": item.id,
|
|
621
|
-
"icon": vue.createVNode(vue.resolveComponent("icon-font"), {
|
|
622
|
-
"type": item.icon
|
|
623
|
-
}, null)
|
|
624
|
-
}, {
|
|
625
|
-
default: () => [item.name]
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
const SideMenu = vue.defineComponent({
|
|
629
|
-
emits: ["menuSelect"],
|
|
630
|
-
props: {
|
|
631
|
-
menu: {
|
|
632
|
-
type: Array,
|
|
633
|
-
required: true
|
|
634
|
-
},
|
|
635
|
-
extraPages: {
|
|
636
|
-
type: Array,
|
|
637
|
-
required: true
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
setup(props, {
|
|
641
|
-
emit
|
|
642
|
-
}) {
|
|
643
|
-
const activeMenu = vue.ref([]);
|
|
644
|
-
const initialMenu = useActiveMenu(() => props.menu, props.extraPages);
|
|
645
|
-
vue.watch(initialMenu, val => {
|
|
646
|
-
if (val?.id) {
|
|
647
|
-
activeMenu.value = [val.id];
|
|
648
|
-
} else {
|
|
649
|
-
activeMenu.value = [];
|
|
650
|
-
}
|
|
651
|
-
});
|
|
652
|
-
const handleMenuSelect = param => {
|
|
653
|
-
const {
|
|
654
|
-
keyPath
|
|
655
|
-
} = param;
|
|
656
|
-
const menu = getMenuByKeyPath(props.menu, keyPath);
|
|
657
|
-
if (menu) {
|
|
658
|
-
emit("menuSelect", menu);
|
|
659
|
-
}
|
|
660
|
-
};
|
|
661
|
-
return () => {
|
|
662
|
-
let _slot2;
|
|
663
|
-
return vue.createVNode(antDesignVue.Menu, {
|
|
664
|
-
"mode": "inline",
|
|
665
|
-
"selectedKeys": activeMenu.value,
|
|
666
|
-
"onUpdate:selectedKeys": $event => activeMenu.value = $event,
|
|
667
|
-
"onSelect": handleMenuSelect
|
|
668
|
-
}, _isSlot(_slot2 = props.menu.map(item => renderMenuItem(item))) ? _slot2 : {
|
|
669
|
-
default: () => [_slot2]
|
|
670
|
-
});
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
function useActiveApp() {
|
|
676
|
-
const route = vueRouter.useRoute();
|
|
677
|
-
const activeAppName = vue.computed(() => {
|
|
678
|
-
return route.path.split("/")[1];
|
|
679
|
-
});
|
|
680
|
-
return activeAppName;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
function useMicroApp() {
|
|
684
|
-
const route = vueRouter.useRoute();
|
|
685
|
-
const activeAppName = useActiveApp();
|
|
686
|
-
const loadAppList = vue.ref([]);
|
|
687
|
-
const handleRouteChange = core.useThrottleFn(async () => {
|
|
688
|
-
const microAppName = activeAppName.value;
|
|
689
|
-
const loadApp = loadAppList.value.find(item => item.name === microAppName);
|
|
690
|
-
if (loadApp) return;
|
|
691
|
-
const microApp = appList__default["default"].find(item => item.name === microAppName);
|
|
692
|
-
if (!microApp) return;
|
|
693
|
-
const domId = `microApp_${microAppName}`;
|
|
694
|
-
const app = qiankun$1.loadMicroApp({
|
|
695
|
-
name: microApp.name,
|
|
696
|
-
entry: microApp.entry,
|
|
697
|
-
container: `#${domId}`
|
|
698
|
-
});
|
|
699
|
-
loadAppList.value.push({
|
|
700
|
-
name: microAppName,
|
|
701
|
-
domId,
|
|
702
|
-
app
|
|
703
|
-
});
|
|
704
|
-
}, 100);
|
|
705
|
-
vue.watch(route, handleRouteChange, {
|
|
706
|
-
immediate: true
|
|
707
|
-
});
|
|
708
|
-
return loadAppList;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
function onAddExtraTabs(handler) {
|
|
712
|
-
const qiankunState = vue.inject("qiankunState");
|
|
713
|
-
vue.watch(() => qiankunState.value.extraTabs, (val = [], prev = []) => {
|
|
714
|
-
if (val.length > prev.length) {
|
|
715
|
-
const added = _.differenceBy(val, prev, item => item.key);
|
|
716
|
-
handler(added);
|
|
717
|
-
}
|
|
718
|
-
}, {
|
|
719
|
-
deep: true,
|
|
720
|
-
immediate: true
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
const TabList = vue.defineComponent({
|
|
725
|
-
emits: ["update:activeKey", "update:list", "tabSelect"],
|
|
726
|
-
props: {
|
|
727
|
-
list: {
|
|
728
|
-
type: Array,
|
|
729
|
-
default: () => []
|
|
730
|
-
},
|
|
731
|
-
activeKey: {
|
|
732
|
-
type: String
|
|
733
|
-
}
|
|
734
|
-
},
|
|
735
|
-
setup(props, {
|
|
736
|
-
emit
|
|
737
|
-
}) {
|
|
738
|
-
const qiankunState = vue.inject("qiankunState");
|
|
739
|
-
const tabContainerRef = vue.ref();
|
|
740
|
-
const tabList = core.useVModel(props, "list", emit);
|
|
741
|
-
const activeTabKey = core.useVModel(props, "activeKey", emit);
|
|
742
|
-
const scrollLeft = val => {
|
|
743
|
-
if (!tabContainerRef.value) return;
|
|
744
|
-
tabContainerRef.value.scrollTo({
|
|
745
|
-
left: tabContainerRef.value.scrollLeft + val,
|
|
746
|
-
behavior: "smooth"
|
|
747
|
-
});
|
|
748
|
-
};
|
|
749
|
-
const handleScroll = e => {
|
|
750
|
-
if (!e.deltaX) {
|
|
751
|
-
scrollLeft(e.deltaY < 0 ? -300 : 300);
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
const handleRemove = async (e, tab, index) => {
|
|
755
|
-
e.stopPropagation();
|
|
756
|
-
if (tab.key === activeTabKey.value) {
|
|
757
|
-
const next = tabList.value[index + 1];
|
|
758
|
-
const prev = tabList.value[index - 1];
|
|
759
|
-
if (next) {
|
|
760
|
-
activeTabKey.value = next.key;
|
|
761
|
-
emit("tabSelect", next);
|
|
762
|
-
} else if (prev) {
|
|
763
|
-
activeTabKey.value = prev.key;
|
|
764
|
-
emit("tabSelect", prev);
|
|
765
|
-
} else {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
tabList.value.splice(index, 1);
|
|
770
|
-
};
|
|
771
|
-
const closeToRight = index => tabList.value = tabList.value.filter((_2, i) => i <= index);
|
|
772
|
-
const closeToLeft = index => tabList.value = tabList.value.filter((_2, i) => i >= index);
|
|
773
|
-
const closeOther = index => {
|
|
774
|
-
activeTabKey.value = tabList.value[index].key;
|
|
775
|
-
tabList.value = tabList.value.filter((_2, i) => i === index);
|
|
776
|
-
};
|
|
777
|
-
core.watchArray(tabList, (val, prev, added, removed) => {
|
|
778
|
-
for (const tab of removed) {
|
|
779
|
-
if (tab.isExtraTab) {
|
|
780
|
-
const idx = qiankunState.value.extraTabs.find(item => item.key === tab.key);
|
|
781
|
-
idx !== -1 && qiankunState.value.extraTabs.splice(idx, 1);
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
}, {
|
|
785
|
-
deep: true
|
|
786
|
-
});
|
|
787
|
-
return () => vue.createVNode("div", {
|
|
788
|
-
"class": "tab-list"
|
|
789
|
-
}, [vue.createVNode("div", {
|
|
790
|
-
"class": "handle",
|
|
791
|
-
"onClick": () => scrollLeft(-150)
|
|
792
|
-
}, [vue.createVNode(iconsVue.LeftOutlined, null, null)]), vue.createVNode("div", {
|
|
793
|
-
"class": "tabs-container",
|
|
794
|
-
"ref": tabContainerRef,
|
|
795
|
-
"onWheel": handleScroll
|
|
796
|
-
}, [tabList.value.map((item, index) => vue.createVNode(antDesignVue.Dropdown, {
|
|
797
|
-
"placement": "bottomLeft",
|
|
798
|
-
"trigger": ["contextmenu"]
|
|
799
|
-
}, {
|
|
800
|
-
default: () => [vue.createVNode("div", {
|
|
801
|
-
"key": item.id,
|
|
802
|
-
"class": ["tab", {
|
|
803
|
-
active: item.key === activeTabKey.value
|
|
804
|
-
}],
|
|
805
|
-
"onClick": () => emit("tabSelect", item)
|
|
806
|
-
}, [vue.createVNode(vue.resolveComponent("icon-font"), {
|
|
807
|
-
"class": "icon",
|
|
808
|
-
"type": item.icon
|
|
809
|
-
}, null), vue.createVNode("span", {
|
|
810
|
-
"class": "tab-name"
|
|
811
|
-
}, [item.name]), tabList.value.length > 1 && vue.createVNode(iconsVue.CloseOutlined, {
|
|
812
|
-
"class": "close",
|
|
813
|
-
"onClick": e => handleRemove(e, item, index)
|
|
814
|
-
}, null)])],
|
|
815
|
-
overlay: () => vue.createVNode(antDesignVue.Menu, null, {
|
|
816
|
-
default: () => [vue.createVNode(antDesignVue.MenuItem, {
|
|
817
|
-
"key": "right",
|
|
818
|
-
"onClick": () => closeToRight(index)
|
|
819
|
-
}, {
|
|
820
|
-
default: () => ["\u5173\u95ED\u53F3\u4FA7"]
|
|
821
|
-
}), vue.createVNode(antDesignVue.MenuItem, {
|
|
822
|
-
"key": "left",
|
|
823
|
-
"onClick": () => closeToLeft(index)
|
|
824
|
-
}, {
|
|
825
|
-
default: () => ["\u5173\u95ED\u5DE6\u4FA7"]
|
|
826
|
-
}), vue.createVNode(antDesignVue.MenuItem, {
|
|
827
|
-
"key": "other",
|
|
828
|
-
"onClick": () => closeOther(index)
|
|
829
|
-
}, {
|
|
830
|
-
default: () => ["\u5173\u95ED\u5176\u4ED6"]
|
|
831
|
-
})]
|
|
832
|
-
})
|
|
833
|
-
}))]), vue.createVNode("div", {
|
|
834
|
-
"class": "handle",
|
|
835
|
-
"onClick": () => scrollLeft(150)
|
|
836
|
-
}, [vue.createVNode(iconsVue.RightOutlined, null, null)])]);
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
const PageContent = vue.defineComponent({
|
|
841
|
-
props: {
|
|
842
|
-
currMenu: {
|
|
843
|
-
type: Object
|
|
844
|
-
},
|
|
845
|
-
menu: {
|
|
846
|
-
type: Array,
|
|
847
|
-
default: () => []
|
|
848
|
-
},
|
|
849
|
-
extraPages: {
|
|
850
|
-
type: Array,
|
|
851
|
-
required: true
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
setup(props, {
|
|
855
|
-
emit
|
|
856
|
-
}) {
|
|
857
|
-
const router = vueRouter.useRouter();
|
|
858
|
-
const qiankunState = vue.inject("qiankunState");
|
|
859
|
-
const activeKey = vue.ref();
|
|
860
|
-
const tabList = vue.ref([]);
|
|
861
|
-
const activeAppName = useActiveApp();
|
|
862
|
-
const loadAppList = useMicroApp();
|
|
863
|
-
const iframeList = vue.ref([]);
|
|
864
|
-
const extraPageList = vue.ref([]);
|
|
865
|
-
const handleMenuChange = ___default["default"].throttle(val => {
|
|
866
|
-
if (!val) return;
|
|
867
|
-
if (val.isExtra) {
|
|
868
|
-
const exist = extraPageList.value.find(item => item.key === val.key);
|
|
869
|
-
if (!exist) {
|
|
870
|
-
tabList.value.push(val);
|
|
871
|
-
extraPageList.value.push(val);
|
|
872
|
-
}
|
|
873
|
-
router.push(`/?extraPageKey=${val.key}`);
|
|
874
|
-
activeKey.value = val.key;
|
|
875
|
-
return;
|
|
876
|
-
}
|
|
877
|
-
const {
|
|
878
|
-
key,
|
|
879
|
-
id,
|
|
880
|
-
mode = 0,
|
|
881
|
-
url
|
|
882
|
-
} = val;
|
|
883
|
-
const isOpened = tabList.value.find(item => item.id === id);
|
|
884
|
-
const tab = ___default["default"].cloneDeep(val);
|
|
885
|
-
switch (mode) {
|
|
886
|
-
case 0:
|
|
887
|
-
if (!isOpened) tabList.value.push({
|
|
888
|
-
...tab,
|
|
889
|
-
key: key ?? id
|
|
890
|
-
});
|
|
891
|
-
router.push(url);
|
|
892
|
-
break;
|
|
893
|
-
case 1:
|
|
894
|
-
window.open(url);
|
|
895
|
-
break;
|
|
896
|
-
case 2:
|
|
897
|
-
if (!isOpened) {
|
|
898
|
-
iframeList.value.push(val);
|
|
899
|
-
tabList.value.push({
|
|
900
|
-
...tab,
|
|
901
|
-
key: id
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
router.push({
|
|
905
|
-
path: "/",
|
|
906
|
-
query: {
|
|
907
|
-
iframeId: id
|
|
908
|
-
}
|
|
909
|
-
});
|
|
910
|
-
break;
|
|
911
|
-
}
|
|
912
|
-
activeKey.value = key ?? id;
|
|
913
|
-
}, 100, {
|
|
914
|
-
trailing: false
|
|
915
|
-
});
|
|
916
|
-
const activeMenu = useActiveMenu(() => props.menu, props.extraPages);
|
|
917
|
-
vue.watch(activeMenu, handleMenuChange);
|
|
918
|
-
vue.watch(() => props.currMenu, handleMenuChange, {
|
|
919
|
-
immediate: true
|
|
920
|
-
});
|
|
921
|
-
vue.watch(activeKey, val => qiankunState.value.activeTabKey = val, {
|
|
922
|
-
immediate: true
|
|
923
|
-
});
|
|
924
|
-
vue.watch(() => qiankunState.value.activeTabKey, val => activeKey.value = val);
|
|
925
|
-
onAddExtraTabs(added => {
|
|
926
|
-
tabList.value.push(...added);
|
|
927
|
-
});
|
|
928
|
-
return () => vue.createVNode("div", {
|
|
929
|
-
"class": "page-content"
|
|
930
|
-
}, [vue.createVNode(TabList, {
|
|
931
|
-
"activeKey": activeKey.value,
|
|
932
|
-
"onUpdate:activeKey": $event => activeKey.value = $event,
|
|
933
|
-
"list": tabList.value,
|
|
934
|
-
"onUpdate:list": $event => tabList.value = $event,
|
|
935
|
-
"onTabSelect": handleMenuChange
|
|
936
|
-
}, null), vue.createVNode("div", {
|
|
937
|
-
"class": "page-container"
|
|
938
|
-
}, [loadAppList.value.map(item => vue.withDirectives(vue.createVNode("div", {
|
|
939
|
-
"id": item.domId
|
|
940
|
-
}, null), [[vue.vShow, item.name === activeAppName.value]])), iframeList.value.map(item => vue.withDirectives(vue.createVNode("iframe", {
|
|
941
|
-
"src": item.url,
|
|
942
|
-
"width": "100%",
|
|
943
|
-
"height": "100%",
|
|
944
|
-
"frameborder": "0"
|
|
945
|
-
}, null), [[vue.vShow, item.id === activeKey.value]])), extraPageList.value.map(item => vue.withDirectives(vue.createVNode("div", {
|
|
946
|
-
"style": {
|
|
947
|
-
height: "100%"
|
|
948
|
-
}
|
|
949
|
-
}, [vue.createVNode(item.component, null, null)]), [[vue.vShow, item.key === activeKey.value]]))])]);
|
|
950
|
-
}
|
|
951
|
-
});
|
|
952
|
-
|
|
953
|
-
const Layout = vue.defineComponent({
|
|
954
|
-
props: {
|
|
955
|
-
userMenu: {
|
|
956
|
-
type: Array,
|
|
957
|
-
required: true
|
|
958
|
-
},
|
|
959
|
-
copyRight: {
|
|
960
|
-
type: String
|
|
961
|
-
},
|
|
962
|
-
userInfo: {
|
|
963
|
-
type: Object,
|
|
964
|
-
required: true
|
|
965
|
-
},
|
|
966
|
-
extraPages: {
|
|
967
|
-
type: Array,
|
|
968
|
-
default: () => []
|
|
969
|
-
},
|
|
970
|
-
messageCount: {
|
|
971
|
-
type: Number,
|
|
972
|
-
default: 0
|
|
973
|
-
},
|
|
974
|
-
logo: {
|
|
975
|
-
type: String
|
|
976
|
-
}
|
|
977
|
-
},
|
|
978
|
-
setup(props, {
|
|
979
|
-
emit
|
|
980
|
-
}) {
|
|
981
|
-
const [isFolder, toggleFolder] = core.useToggle(false);
|
|
982
|
-
const currentNavKey = vue.ref();
|
|
983
|
-
const siderMenu = vue.ref([]);
|
|
984
|
-
const handleNavSelect = id => {
|
|
985
|
-
currentNavKey.value = id;
|
|
986
|
-
};
|
|
987
|
-
vue.watch(currentNavKey, val => {
|
|
988
|
-
if (!val) return;
|
|
989
|
-
const nav = props.userMenu.find(item => item.id === val);
|
|
990
|
-
if (nav) {
|
|
991
|
-
siderMenu.value = nav.subList;
|
|
992
|
-
}
|
|
993
|
-
}, {
|
|
994
|
-
immediate: true,
|
|
995
|
-
flush: "post"
|
|
996
|
-
});
|
|
997
|
-
const currMenu = vue.ref();
|
|
998
|
-
const handleMenuSelect = menu => {
|
|
999
|
-
currMenu.value = menu;
|
|
1000
|
-
};
|
|
1001
|
-
return () => vue.createVNode("div", {
|
|
1002
|
-
"class": "Layout"
|
|
1003
|
-
}, [vue.createVNode(antDesignVue.Layout, null, {
|
|
1004
|
-
default: () => [vue.createVNode(antDesignVue.LayoutHeader, null, {
|
|
1005
|
-
default: () => [vue.createVNode(Header, {
|
|
1006
|
-
"menu": props.userMenu,
|
|
1007
|
-
"onNavSelect": handleNavSelect,
|
|
1008
|
-
"userInfo": props.userInfo,
|
|
1009
|
-
"extraPages": props.extraPages,
|
|
1010
|
-
"messageCount": props.messageCount,
|
|
1011
|
-
"logo": props.logo
|
|
1012
|
-
}, null)]
|
|
1013
|
-
}), vue.createVNode(antDesignVue.Layout, null, {
|
|
1014
|
-
default: () => [vue.createVNode(antDesignVue.LayoutSider, {
|
|
1015
|
-
"width": "10.416vw",
|
|
1016
|
-
"collapsedWidth": "3.125vw",
|
|
1017
|
-
"collapsed": isFolder.value
|
|
1018
|
-
}, {
|
|
1019
|
-
default: () => [vue.createVNode("div", {
|
|
1020
|
-
"class": "folder",
|
|
1021
|
-
"onClick": () => toggleFolder()
|
|
1022
|
-
}, [isFolder.value ? vue.createVNode(iconsVue.MenuUnfoldOutlined, null, null) : vue.createVNode(iconsVue.MenuFoldOutlined, null, null)]), vue.createVNode(SideMenu, {
|
|
1023
|
-
"menu": siderMenu.value,
|
|
1024
|
-
"onMenuSelect": handleMenuSelect,
|
|
1025
|
-
"extraPages": props.extraPages
|
|
1026
|
-
}, null), vue.createVNode("div", {
|
|
1027
|
-
"class": "copyright"
|
|
1028
|
-
}, [props.copyRight])]
|
|
1029
|
-
}), vue.createVNode(antDesignVue.LayoutContent, null, {
|
|
1030
|
-
default: () => [vue.createVNode(PageContent, {
|
|
1031
|
-
"currMenu": currMenu.value,
|
|
1032
|
-
"menu": props.userMenu,
|
|
1033
|
-
"extraPages": props.extraPages
|
|
1034
|
-
}, null)]
|
|
1035
|
-
})]
|
|
1036
|
-
})]
|
|
1037
|
-
})]);
|
|
1038
|
-
}
|
|
1039
|
-
});
|
|
1040
|
-
var index$1 = installComponent(Layout, "layout");
|
|
1041
|
-
|
|
1042
|
-
var components = /*#__PURE__*/Object.freeze({
|
|
1043
|
-
__proto__: null,
|
|
1044
|
-
Demo: index$3,
|
|
1045
|
-
IconFont: index$2,
|
|
1046
|
-
Layout: index$1
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
var index = {
|
|
1050
|
-
install(app) {
|
|
1051
|
-
for (const component of Object.values(components)) {
|
|
1052
|
-
app.use(component);
|
|
1053
|
-
}
|
|
1054
|
-
require("./iconfont.js");
|
|
1055
|
-
},
|
|
1056
|
-
version,
|
|
1057
|
-
utils,
|
|
1058
|
-
directives,
|
|
1059
|
-
hooks,
|
|
1060
|
-
components
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
exports.components = components;
|
|
1064
|
-
exports["default"] = index;
|
|
1065
|
-
exports.directives = directives;
|
|
1066
|
-
exports.hooks = hooks;
|
|
1067
|
-
exports.utils = utils;
|
|
1068
|
-
exports.version = version;
|