@luzhaoqi/test 0.0.22 → 0.0.24

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.
Files changed (2) hide show
  1. package/dist/lib-cjs.js +897 -490
  2. package/package.json +1 -1
package/dist/lib-cjs.js CHANGED
@@ -17576,8 +17576,6 @@ var path$1 = {
17576
17576
  query
17577
17577
  };
17578
17578
 
17579
- const TOKENKEY = 'Admin-Token';
17580
-
17581
17579
  const setGolbalData = (Vue, option) => {
17582
17580
  if (!Vue.prototype.$z) {
17583
17581
  Vue.prototype.$z = option || {};
@@ -28730,7 +28728,7 @@ var ResizeObserver = /** @class */ (function () {
28730
28728
  };
28731
28729
  });
28732
28730
 
28733
- var index$1 = (function () {
28731
+ var index$2 = (function () {
28734
28732
  // Export existing implementation if available.
28735
28733
  if (typeof global$1$1.ResizeObserver !== 'undefined') {
28736
28734
  return global$1$1.ResizeObserver;
@@ -28740,7 +28738,7 @@ var index$1 = (function () {
28740
28738
 
28741
28739
  var ResizeObserver_es = /*#__PURE__*/Object.freeze({
28742
28740
  __proto__: null,
28743
- default: index$1
28741
+ default: index$2
28744
28742
  });
28745
28743
 
28746
28744
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(ResizeObserver_es);
@@ -93730,6 +93728,8 @@ var errorCode = {
93730
93728
  default: '系统未知错误,请反馈给管理员'
93731
93729
  };
93732
93730
 
93731
+ const TOKENKEY = 'Admin-Token';
93732
+
93733
93733
  // 是否显示重新登录
93734
93734
  let isRelogin = { show: false };
93735
93735
 
@@ -93902,14 +93902,14 @@ function createAxios(Vue) {
93902
93902
  }
93903
93903
  }
93904
93904
 
93905
- function install$4(Vue, option = {}) {
93905
+ function install$5(Vue, option = {}) {
93906
93906
  setGolbalData(Vue, option);
93907
93907
  const $http = createAxios(Vue);
93908
93908
  Vue.prototype.$z.$http = $http;
93909
93909
  }
93910
93910
 
93911
93911
  var RequestZ = {
93912
- install: install$4
93912
+ install: install$5
93913
93913
  };
93914
93914
 
93915
93915
  var nprogress = {exports: {}};
@@ -94459,6 +94459,56 @@ function devtoolPlugin (store) {
94459
94459
  }, { prepend: true });
94460
94460
  }
94461
94461
 
94462
+ /**
94463
+ * Get the first item that pass the test
94464
+ * by second argument function
94465
+ *
94466
+ * @param {Array} list
94467
+ * @param {Function} f
94468
+ * @return {*}
94469
+ */
94470
+ function find (list, f) {
94471
+ return list.filter(f)[0]
94472
+ }
94473
+
94474
+ /**
94475
+ * Deep copy the given object considering circular structure.
94476
+ * This function caches all nested objects and its copies.
94477
+ * If it detects circular structure, use cached copy to avoid infinite loop.
94478
+ *
94479
+ * @param {*} obj
94480
+ * @param {Array<Object>} cache
94481
+ * @return {*}
94482
+ */
94483
+ function deepCopy (obj, cache) {
94484
+ if ( cache === void 0 ) cache = [];
94485
+
94486
+ // just return if obj is immutable value
94487
+ if (obj === null || typeof obj !== 'object') {
94488
+ return obj
94489
+ }
94490
+
94491
+ // if obj is hit, it is in circular structure
94492
+ var hit = find(cache, function (c) { return c.original === obj; });
94493
+ if (hit) {
94494
+ return hit.copy
94495
+ }
94496
+
94497
+ var copy = Array.isArray(obj) ? [] : {};
94498
+ // put the copy into cache at first
94499
+ // because we want to refer it in recursive deepCopy
94500
+ cache.push({
94501
+ original: obj,
94502
+ copy: copy
94503
+ });
94504
+
94505
+ Object.keys(obj).forEach(function (key) {
94506
+ copy[key] = deepCopy(obj[key], cache);
94507
+ });
94508
+
94509
+ return copy
94510
+ }
94511
+
94462
94512
  /**
94463
94513
  * forEach for object
94464
94514
  */
@@ -94716,7 +94766,7 @@ var Store = function Store (options) {
94716
94766
  // To allow users to avoid auto-installation in some cases,
94717
94767
  // this code should be placed here. See #731
94718
94768
  if (!Vue && typeof window !== 'undefined' && window.Vue) {
94719
- install$3(window.Vue);
94769
+ install$4(window.Vue);
94720
94770
  }
94721
94771
 
94722
94772
  {
@@ -95255,7 +95305,7 @@ function unifyObjectStyle (type, payload, options) {
95255
95305
  return { type: type, payload: payload, options: options }
95256
95306
  }
95257
95307
 
95258
- function install$3 (_Vue) {
95308
+ function install$4 (_Vue) {
95259
95309
  if (Vue && _Vue === Vue) {
95260
95310
  {
95261
95311
  console.error(
@@ -95304,6 +95354,123 @@ var mapState = normalizeNamespace(function (namespace, states) {
95304
95354
  return res
95305
95355
  });
95306
95356
 
95357
+ /**
95358
+ * Reduce the code which written in Vue.js for committing the mutation
95359
+ * @param {String} [namespace] - Module's namespace
95360
+ * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept another params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function.
95361
+ * @return {Object}
95362
+ */
95363
+ var mapMutations = normalizeNamespace(function (namespace, mutations) {
95364
+ var res = {};
95365
+ if (!isValidMap(mutations)) {
95366
+ console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object');
95367
+ }
95368
+ normalizeMap(mutations).forEach(function (ref) {
95369
+ var key = ref.key;
95370
+ var val = ref.val;
95371
+
95372
+ res[key] = function mappedMutation () {
95373
+ var args = [], len = arguments.length;
95374
+ while ( len-- ) args[ len ] = arguments[ len ];
95375
+
95376
+ // Get the commit method from store
95377
+ var commit = this.$store.commit;
95378
+ if (namespace) {
95379
+ var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
95380
+ if (!module) {
95381
+ return
95382
+ }
95383
+ commit = module.context.commit;
95384
+ }
95385
+ return typeof val === 'function'
95386
+ ? val.apply(this, [commit].concat(args))
95387
+ : commit.apply(this.$store, [val].concat(args))
95388
+ };
95389
+ });
95390
+ return res
95391
+ });
95392
+
95393
+ /**
95394
+ * Reduce the code which written in Vue.js for getting the getters
95395
+ * @param {String} [namespace] - Module's namespace
95396
+ * @param {Object|Array} getters
95397
+ * @return {Object}
95398
+ */
95399
+ var mapGetters = normalizeNamespace(function (namespace, getters) {
95400
+ var res = {};
95401
+ if (!isValidMap(getters)) {
95402
+ console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object');
95403
+ }
95404
+ normalizeMap(getters).forEach(function (ref) {
95405
+ var key = ref.key;
95406
+ var val = ref.val;
95407
+
95408
+ // The namespace has been mutated by normalizeNamespace
95409
+ val = namespace + val;
95410
+ res[key] = function mappedGetter () {
95411
+ if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
95412
+ return
95413
+ }
95414
+ if (!(val in this.$store.getters)) {
95415
+ console.error(("[vuex] unknown getter: " + val));
95416
+ return
95417
+ }
95418
+ return this.$store.getters[val]
95419
+ };
95420
+ // mark vuex getter for devtools
95421
+ res[key].vuex = true;
95422
+ });
95423
+ return res
95424
+ });
95425
+
95426
+ /**
95427
+ * Reduce the code which written in Vue.js for dispatch the action
95428
+ * @param {String} [namespace] - Module's namespace
95429
+ * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.
95430
+ * @return {Object}
95431
+ */
95432
+ var mapActions = normalizeNamespace(function (namespace, actions) {
95433
+ var res = {};
95434
+ if (!isValidMap(actions)) {
95435
+ console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object');
95436
+ }
95437
+ normalizeMap(actions).forEach(function (ref) {
95438
+ var key = ref.key;
95439
+ var val = ref.val;
95440
+
95441
+ res[key] = function mappedAction () {
95442
+ var args = [], len = arguments.length;
95443
+ while ( len-- ) args[ len ] = arguments[ len ];
95444
+
95445
+ // get dispatch function from store
95446
+ var dispatch = this.$store.dispatch;
95447
+ if (namespace) {
95448
+ var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
95449
+ if (!module) {
95450
+ return
95451
+ }
95452
+ dispatch = module.context.dispatch;
95453
+ }
95454
+ return typeof val === 'function'
95455
+ ? val.apply(this, [dispatch].concat(args))
95456
+ : dispatch.apply(this.$store, [val].concat(args))
95457
+ };
95458
+ });
95459
+ return res
95460
+ });
95461
+
95462
+ /**
95463
+ * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
95464
+ * @param {String} namespace
95465
+ * @return {Object}
95466
+ */
95467
+ var createNamespacedHelpers = function (namespace) { return ({
95468
+ mapState: mapState.bind(null, namespace),
95469
+ mapGetters: mapGetters.bind(null, namespace),
95470
+ mapMutations: mapMutations.bind(null, namespace),
95471
+ mapActions: mapActions.bind(null, namespace)
95472
+ }); };
95473
+
95307
95474
  /**
95308
95475
  * Normalize the map
95309
95476
  * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
@@ -95361,6 +95528,109 @@ function getModuleByNamespace (store, helper, namespace) {
95361
95528
  return module
95362
95529
  }
95363
95530
 
95531
+ // Credits: borrowed code from fcomb/redux-logger
95532
+
95533
+ function createLogger (ref) {
95534
+ if ( ref === void 0 ) ref = {};
95535
+ var collapsed = ref.collapsed; if ( collapsed === void 0 ) collapsed = true;
95536
+ var filter = ref.filter; if ( filter === void 0 ) filter = function (mutation, stateBefore, stateAfter) { return true; };
95537
+ var transformer = ref.transformer; if ( transformer === void 0 ) transformer = function (state) { return state; };
95538
+ var mutationTransformer = ref.mutationTransformer; if ( mutationTransformer === void 0 ) mutationTransformer = function (mut) { return mut; };
95539
+ var actionFilter = ref.actionFilter; if ( actionFilter === void 0 ) actionFilter = function (action, state) { return true; };
95540
+ var actionTransformer = ref.actionTransformer; if ( actionTransformer === void 0 ) actionTransformer = function (act) { return act; };
95541
+ var logMutations = ref.logMutations; if ( logMutations === void 0 ) logMutations = true;
95542
+ var logActions = ref.logActions; if ( logActions === void 0 ) logActions = true;
95543
+ var logger = ref.logger; if ( logger === void 0 ) logger = console;
95544
+
95545
+ return function (store) {
95546
+ var prevState = deepCopy(store.state);
95547
+
95548
+ if (typeof logger === 'undefined') {
95549
+ return
95550
+ }
95551
+
95552
+ if (logMutations) {
95553
+ store.subscribe(function (mutation, state) {
95554
+ var nextState = deepCopy(state);
95555
+
95556
+ if (filter(mutation, prevState, nextState)) {
95557
+ var formattedTime = getFormattedTime();
95558
+ var formattedMutation = mutationTransformer(mutation);
95559
+ var message = "mutation " + (mutation.type) + formattedTime;
95560
+
95561
+ startMessage(logger, message, collapsed);
95562
+ logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState));
95563
+ logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation);
95564
+ logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState));
95565
+ endMessage(logger);
95566
+ }
95567
+
95568
+ prevState = nextState;
95569
+ });
95570
+ }
95571
+
95572
+ if (logActions) {
95573
+ store.subscribeAction(function (action, state) {
95574
+ if (actionFilter(action, state)) {
95575
+ var formattedTime = getFormattedTime();
95576
+ var formattedAction = actionTransformer(action);
95577
+ var message = "action " + (action.type) + formattedTime;
95578
+
95579
+ startMessage(logger, message, collapsed);
95580
+ logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction);
95581
+ endMessage(logger);
95582
+ }
95583
+ });
95584
+ }
95585
+ }
95586
+ }
95587
+
95588
+ function startMessage (logger, message, collapsed) {
95589
+ var startMessage = collapsed
95590
+ ? logger.groupCollapsed
95591
+ : logger.group;
95592
+
95593
+ // render
95594
+ try {
95595
+ startMessage.call(logger, message);
95596
+ } catch (e) {
95597
+ logger.log(message);
95598
+ }
95599
+ }
95600
+
95601
+ function endMessage (logger) {
95602
+ try {
95603
+ logger.groupEnd();
95604
+ } catch (e) {
95605
+ logger.log('—— log end ——');
95606
+ }
95607
+ }
95608
+
95609
+ function getFormattedTime () {
95610
+ var time = new Date();
95611
+ return (" @ " + (pad(time.getHours(), 2)) + ":" + (pad(time.getMinutes(), 2)) + ":" + (pad(time.getSeconds(), 2)) + "." + (pad(time.getMilliseconds(), 3)))
95612
+ }
95613
+
95614
+ function repeat (str, times) {
95615
+ return (new Array(times + 1)).join(str)
95616
+ }
95617
+
95618
+ function pad (num, maxLength) {
95619
+ return repeat('0', maxLength - num.toString().length) + num
95620
+ }
95621
+
95622
+ var index$1 = {
95623
+ Store: Store,
95624
+ install: install$4,
95625
+ version: '3.6.2',
95626
+ mapState: mapState,
95627
+ mapMutations: mapMutations,
95628
+ mapGetters: mapGetters,
95629
+ mapActions: mapActions,
95630
+ createNamespacedHelpers: createNamespacedHelpers,
95631
+ createLogger: createLogger
95632
+ };
95633
+
95364
95634
  //
95365
95635
  //
95366
95636
  //
@@ -98322,7 +98592,7 @@ const actions$5 = {
98322
98592
  GenerateRoutes({ commit }, $z) {
98323
98593
  return new Promise((resolve) => {
98324
98594
  const $http = $z.$http;
98325
- const routerOption = $z.router || {};
98595
+ const routerOption = $z.routerConfig || {};
98326
98596
  let api = function () {
98327
98597
  if ($http) {
98328
98598
  return $http.request({
@@ -98342,7 +98612,7 @@ const actions$5 = {
98342
98612
  const sidebarRoutes = filterAsyncRouter(sdata);
98343
98613
  const rewriteRoutes = filterAsyncRouter(rdata, false, true);
98344
98614
  rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true });
98345
- const constantRoutes = $z.router.routes || [];
98615
+ const constantRoutes = $z.routerConfig.routes || [];
98346
98616
 
98347
98617
  commit('SET_ADD_ROUTES', rewriteRoutes);
98348
98618
  commit('SET_ROUTES', constantRoutes.concat(rewriteRoutes));
@@ -98432,13 +98702,19 @@ NProgress.configure({ showSpinner: false });
98432
98702
 
98433
98703
  function createRouter(Vue) {
98434
98704
  // 判断是否已经use过VueRouter
98435
- const VueRouterObj = Vue._installedPlugins.filter((item) => {
98705
+ const VueRouterObj = Vue._installedPlugins.find((item) => {
98436
98706
  return item.name === 'VueRouter'
98437
98707
  });
98438
- if (!(VueRouterObj && VueRouterObj[0])) {
98708
+ const $z = Vue.prototype.$z;
98709
+ const routerOption = $z.routerConfig;
98710
+ if (VueRouterObj) {
98711
+ if ($z.router) {
98712
+ Vue.prototype.$z.$router = $z.router;
98713
+ } else {
98714
+ console.warn('缺少router参数');
98715
+ }
98716
+ } else {
98439
98717
  Vue.use(VueRouter);
98440
- const $z = Vue.prototype.$z;
98441
- const routerOption = $z.router;
98442
98718
  if (routerOption) {
98443
98719
  const defaultConfig = {
98444
98720
  mode: routerOption.mode || 'history', // 去掉url中的#
@@ -98454,7 +98730,7 @@ function createRouter(Vue) {
98454
98730
  NProgress.start();
98455
98731
  const httpOption = $z.http || {};
98456
98732
  const token = getCookie(httpOption.tokenKey || TOKENKEY);
98457
- const store = $z.store;
98733
+ const store = $z.$store;
98458
98734
  if (!routerOption.whiteList) {
98459
98735
  routerOption.whiteList = ['/login', '/register'];
98460
98736
  }
@@ -98500,19 +98776,524 @@ function createRouter(Vue) {
98500
98776
  NProgress.done();
98501
98777
  }
98502
98778
  });
98503
-
98504
98779
  Vue.prototype.$z.$router = router;
98780
+ } else {
98781
+ console.warn('缺少routerConfig参数');
98782
+ }
98783
+ }
98784
+
98785
+ console.log(Vue.prototype.$z);
98786
+ }
98787
+
98788
+ function install$3(Vue, option = {}) {
98789
+ setGolbalData(Vue, option);
98790
+ createRouter(Vue);
98791
+ }
98792
+
98793
+ var RouterZ = {
98794
+ install: install$3
98795
+ };
98796
+
98797
+ var rootStore = {
98798
+ state: {},
98799
+ getters: {},
98800
+ mutations: {},
98801
+ actions: {},
98802
+ modules: {}
98803
+ };
98804
+
98805
+ function createStore(Vue) {
98806
+ // Vue.use(Vuex)
98807
+ // console.log(Vue._installedPlugins)
98808
+ // 判断是否已经use过VueRouter
98809
+ const VueStoreObj = Vue._installedPlugins.find((item) => {
98810
+ return item.Store
98811
+ });
98812
+ const $z = Vue.prototype.$z;
98813
+ const storeOption = $z.storeConfig;
98814
+ if (VueStoreObj) {
98815
+ if ($z.store) {
98816
+ Vue.prototype.$z.$store = $z.store;
98817
+ } else {
98818
+ console.warn('缺少store参数');
98819
+ }
98820
+ } else {
98821
+ Vue.use(index$1);
98822
+ if (storeOption) {
98823
+ const defaultConfig = rootStore;
98824
+ Object.assign(defaultConfig, storeOption);
98825
+ const store = new index$1.Store(defaultConfig);
98826
+ Vue.prototype.$z.$store = store;
98827
+ } else {
98828
+ console.warn('缺少storeConfig参数');
98505
98829
  }
98506
98830
  }
98507
98831
  }
98508
98832
 
98509
98833
  const state$4 = {
98834
+ dict: new Array()
98835
+ };
98836
+ const mutations$4 = {
98837
+ SET_DICT: (state, { key, value }) => {
98838
+ if (key !== null && key !== '') {
98839
+ state.dict.push({
98840
+ key: key,
98841
+ value: value
98842
+ });
98843
+ }
98844
+ },
98845
+ REMOVE_DICT: (state, key) => {
98846
+ try {
98847
+ for (let i = 0; i < state.dict.length; i++) {
98848
+ if (state.dict[i].key == key) {
98849
+ state.dict.splice(i, i);
98850
+ return true
98851
+ }
98852
+ }
98853
+ } catch (e) {
98854
+ console.log(e);
98855
+ }
98856
+ },
98857
+ CLEAN_DICT: (state) => {
98858
+ state.dict = new Array();
98859
+ }
98860
+ };
98861
+
98862
+ const actions$4 = {
98863
+ // 设置字典
98864
+ setDict({ commit }, data) {
98865
+ commit('SET_DICT', data);
98866
+ },
98867
+ // 删除字典
98868
+ removeDict({ commit }, key) {
98869
+ commit('REMOVE_DICT', key);
98870
+ },
98871
+ // 清空字典
98872
+ cleanDict({ commit }) {
98873
+ commit('CLEAN_DICT');
98874
+ }
98875
+ };
98876
+
98877
+ // 为vuex添加模块,存储dict数据
98878
+ function registerStateModule$4(store) {
98879
+ if (!store || !store.hasModule) return
98880
+ if (!store.hasModule('z-dict')) {
98881
+ const statesModule = {
98882
+ namespaced: true,
98883
+ state: state$4,
98884
+ mutations: mutations$4,
98885
+ actions: actions$4
98886
+ };
98887
+ store.registerModule('z-dict', statesModule);
98888
+ }
98889
+ }
98890
+
98891
+ const state$3 = {
98892
+ sidebar: {
98893
+ opened: api.get('sidebarStatus') ? !!+api.get('sidebarStatus') : true,
98894
+ withoutAnimation: false,
98895
+ hide: false
98896
+ },
98897
+ device: 'desktop',
98898
+ size: api.get('size') || 'medium'
98899
+ };
98900
+
98901
+ const mutations$3 = {
98902
+ TOGGLE_SIDEBAR: (state) => {
98903
+ if (state.sidebar.hide) {
98904
+ return false
98905
+ }
98906
+ state.sidebar.opened = !state.sidebar.opened;
98907
+ state.sidebar.withoutAnimation = false;
98908
+ if (state.sidebar.opened) {
98909
+ api.set('sidebarStatus', 1);
98910
+ } else {
98911
+ api.set('sidebarStatus', 0);
98912
+ }
98913
+ },
98914
+ CLOSE_SIDEBAR: (state, withoutAnimation) => {
98915
+ api.set('sidebarStatus', 0);
98916
+ state.sidebar.opened = false;
98917
+ state.sidebar.withoutAnimation = withoutAnimation;
98918
+ },
98919
+ TOGGLE_DEVICE: (state, device) => {
98920
+ state.device = device;
98921
+ },
98922
+ SET_SIZE: (state, size) => {
98923
+ state.size = size;
98924
+ api.set('size', size);
98925
+ },
98926
+ SET_SIDEBAR_HIDE: (state, status) => {
98927
+ state.sidebar.hide = status;
98928
+ }
98929
+ };
98930
+
98931
+ const actions$3 = {
98932
+ toggleSideBar({ commit }) {
98933
+ commit('TOGGLE_SIDEBAR');
98934
+ },
98935
+ closeSideBar({ commit }, { withoutAnimation }) {
98936
+ commit('CLOSE_SIDEBAR', withoutAnimation);
98937
+ },
98938
+ toggleDevice({ commit }, device) {
98939
+ commit('TOGGLE_DEVICE', device);
98940
+ },
98941
+ setSize({ commit }, size) {
98942
+ commit('SET_SIZE', size);
98943
+ },
98944
+ toggleSideBarHide({ commit }, status) {
98945
+ commit('SET_SIDEBAR_HIDE', status);
98946
+ }
98947
+ };
98948
+
98949
+ function registerStateModule$3(store) {
98950
+ if (!store || !store.hasModule) return
98951
+ if (!store.hasModule('z-app')) {
98952
+ const statesModule = {
98953
+ namespaced: true,
98954
+ state: state$3,
98955
+ mutations: mutations$3,
98956
+ actions: actions$3
98957
+ };
98958
+ store.registerModule('z-app', statesModule);
98959
+ }
98960
+ }
98961
+
98962
+ var settings = {
98963
+ /**
98964
+ * 侧边栏主题 深色主题theme-dark,浅色主题theme-light
98965
+ */
98966
+ sideTheme: 'theme-dark',
98967
+
98968
+ /**
98969
+ * 是否系统布局配置
98970
+ */
98971
+ showSettings: false,
98972
+
98973
+ /**
98974
+ * 是否显示顶部导航
98975
+ */
98976
+ topNav: false,
98977
+
98978
+ /**
98979
+ * 是否显示 tagsView
98980
+ */
98981
+ tagsView: true,
98982
+
98983
+ /**
98984
+ * 是否固定头部
98985
+ */
98986
+ fixedHeader: false,
98987
+
98988
+ /**
98989
+ * 是否显示logo
98990
+ */
98991
+ sidebarLogo: true,
98992
+
98993
+ /**
98994
+ * 是否显示动态标题
98995
+ */
98996
+ dynamicTitle: false,
98997
+
98998
+ /**
98999
+ * @type {string | array} 'production' | ['production', 'development']
99000
+ * @description Need show err logs component.
99001
+ * The default is only used in the production env
99002
+ * If you want to also use it in dev, you can pass ['production', 'development']
99003
+ */
99004
+ errorLog: 'production'
99005
+ };
99006
+
99007
+ var defaultSettings = /*@__PURE__*/getDefaultExportFromCjs(settings);
99008
+
99009
+ const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings;
99010
+
99011
+ const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '';
99012
+ const state$2 = {
99013
+ title: '',
99014
+ theme: storageSetting.theme || '#409EFF',
99015
+ sideTheme: storageSetting.sideTheme || sideTheme,
99016
+ showSettings: showSettings,
99017
+ topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
99018
+ tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
99019
+ fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
99020
+ sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
99021
+ dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
99022
+ };
99023
+ const mutations$2 = {
99024
+ CHANGE_SETTING: (state, { key, value }) => {
99025
+ if (state.hasOwnProperty(key)) {
99026
+ state[key] = value;
99027
+ }
99028
+ }
99029
+ };
99030
+
99031
+ const actions$2 = {
99032
+ // 修改布局设置
99033
+ changeSetting({ commit }, data) {
99034
+ commit('CHANGE_SETTING', data);
99035
+ },
99036
+ // 设置网页标题
99037
+ setTitle({ commit }, title) {
99038
+ state$2.title = title;
99039
+ }
99040
+ };
99041
+
99042
+ function registerStateModule$2(store) {
99043
+ if (!store || !store.hasModule) return
99044
+ if (!store.hasModule('z-settings')) {
99045
+ const statesModule = {
99046
+ namespaced: true,
99047
+ state: state$2,
99048
+ mutations: mutations$2,
99049
+ actions: actions$2
99050
+ };
99051
+ store.registerModule('z-settings', statesModule);
99052
+ }
99053
+ }
99054
+
99055
+ const state$1 = {
99056
+ visitedViews: [],
99057
+ cachedViews: [],
99058
+ iframeViews: []
99059
+ };
99060
+
99061
+ const mutations$1 = {
99062
+ ADD_IFRAME_VIEW: (state, view) => {
99063
+ if (state.iframeViews.some((v) => v.path === view.path)) return
99064
+ state.iframeViews.push(
99065
+ Object.assign({}, view, {
99066
+ title: view.meta.title || 'no-name'
99067
+ })
99068
+ );
99069
+ },
99070
+ ADD_VISITED_VIEW: (state, view) => {
99071
+ if (state.visitedViews.some((v) => v.path === view.path)) return
99072
+ state.visitedViews.push(
99073
+ Object.assign({}, view, {
99074
+ title: view.meta.title || 'no-name'
99075
+ })
99076
+ );
99077
+ },
99078
+ ADD_CACHED_VIEW: (state, view) => {
99079
+ if (state.cachedViews.includes(view.name)) return
99080
+ if (view.meta && !view.meta.noCache) {
99081
+ state.cachedViews.push(view.name);
99082
+ }
99083
+ },
99084
+ DEL_VISITED_VIEW: (state, view) => {
99085
+ for (const [i, v] of state.visitedViews.entries()) {
99086
+ if (v.path === view.path) {
99087
+ state.visitedViews.splice(i, 1);
99088
+ break
99089
+ }
99090
+ }
99091
+ state.iframeViews = state.iframeViews.filter((item) => item.path !== view.path);
99092
+ },
99093
+ DEL_IFRAME_VIEW: (state, view) => {
99094
+ state.iframeViews = state.iframeViews.filter((item) => item.path !== view.path);
99095
+ },
99096
+ DEL_CACHED_VIEW: (state, view) => {
99097
+ const index = state.cachedViews.indexOf(view.name);
99098
+ index > -1 && state.cachedViews.splice(index, 1);
99099
+ },
99100
+
99101
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
99102
+ state.visitedViews = state.visitedViews.filter((v) => {
99103
+ return v.meta.affix || v.path === view.path
99104
+ });
99105
+ state.iframeViews = state.iframeViews.filter((item) => item.path === view.path);
99106
+ },
99107
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
99108
+ const index = state.cachedViews.indexOf(view.name);
99109
+ if (index > -1) {
99110
+ state.cachedViews = state.cachedViews.slice(index, index + 1);
99111
+ } else {
99112
+ state.cachedViews = [];
99113
+ }
99114
+ },
99115
+ DEL_ALL_VISITED_VIEWS: (state) => {
99116
+ // keep affix tags
99117
+ const affixTags = state.visitedViews.filter((tag) => tag.meta.affix);
99118
+ state.visitedViews = affixTags;
99119
+ state.iframeViews = [];
99120
+ },
99121
+ DEL_ALL_CACHED_VIEWS: (state) => {
99122
+ state.cachedViews = [];
99123
+ },
99124
+ UPDATE_VISITED_VIEW: (state, view) => {
99125
+ for (let v of state.visitedViews) {
99126
+ if (v.path === view.path) {
99127
+ v = Object.assign(v, view);
99128
+ break
99129
+ }
99130
+ }
99131
+ },
99132
+ DEL_RIGHT_VIEWS: (state, view) => {
99133
+ const index = state.visitedViews.findIndex((v) => v.path === view.path);
99134
+ if (index === -1) {
99135
+ return
99136
+ }
99137
+ state.visitedViews = state.visitedViews.filter((item, idx) => {
99138
+ if (idx <= index || (item.meta && item.meta.affix)) {
99139
+ return true
99140
+ }
99141
+ const i = state.cachedViews.indexOf(item.name);
99142
+ if (i > -1) {
99143
+ state.cachedViews.splice(i, 1);
99144
+ }
99145
+ if (item.meta.link) {
99146
+ const fi = state.iframeViews.findIndex((v) => v.path === item.path);
99147
+ state.iframeViews.splice(fi, 1);
99148
+ }
99149
+ return false
99150
+ });
99151
+ },
99152
+ DEL_LEFT_VIEWS: (state, view) => {
99153
+ const index = state.visitedViews.findIndex((v) => v.path === view.path);
99154
+ if (index === -1) {
99155
+ return
99156
+ }
99157
+ state.visitedViews = state.visitedViews.filter((item, idx) => {
99158
+ if (idx >= index || (item.meta && item.meta.affix)) {
99159
+ return true
99160
+ }
99161
+ const i = state.cachedViews.indexOf(item.name);
99162
+ if (i > -1) {
99163
+ state.cachedViews.splice(i, 1);
99164
+ }
99165
+ if (item.meta.link) {
99166
+ const fi = state.iframeViews.findIndex((v) => v.path === item.path);
99167
+ state.iframeViews.splice(fi, 1);
99168
+ }
99169
+ return false
99170
+ });
99171
+ }
99172
+ };
99173
+
99174
+ const actions$1 = {
99175
+ addView({ dispatch }, view) {
99176
+ dispatch('addVisitedView', view);
99177
+ dispatch('addCachedView', view);
99178
+ },
99179
+ addIframeView({ commit }, view) {
99180
+ commit('ADD_IFRAME_VIEW', view);
99181
+ },
99182
+ addVisitedView({ commit }, view) {
99183
+ commit('ADD_VISITED_VIEW', view);
99184
+ },
99185
+ addCachedView({ commit }, view) {
99186
+ commit('ADD_CACHED_VIEW', view);
99187
+ },
99188
+ delView({ dispatch, state }, view) {
99189
+ return new Promise((resolve) => {
99190
+ dispatch('delVisitedView', view);
99191
+ dispatch('delCachedView', view);
99192
+ resolve({
99193
+ visitedViews: [...state.visitedViews],
99194
+ cachedViews: [...state.cachedViews]
99195
+ });
99196
+ })
99197
+ },
99198
+ delVisitedView({ commit, state }, view) {
99199
+ return new Promise((resolve) => {
99200
+ commit('DEL_VISITED_VIEW', view);
99201
+ resolve([...state.visitedViews]);
99202
+ })
99203
+ },
99204
+ delIframeView({ commit, state }, view) {
99205
+ return new Promise((resolve) => {
99206
+ commit('DEL_IFRAME_VIEW', view);
99207
+ resolve([...state.iframeViews]);
99208
+ })
99209
+ },
99210
+ delCachedView({ commit, state }, view) {
99211
+ return new Promise((resolve) => {
99212
+ commit('DEL_CACHED_VIEW', view);
99213
+ resolve([...state.cachedViews]);
99214
+ })
99215
+ },
99216
+ delOthersViews({ dispatch, state }, view) {
99217
+ return new Promise((resolve) => {
99218
+ dispatch('delOthersVisitedViews', view);
99219
+ dispatch('delOthersCachedViews', view);
99220
+ resolve({
99221
+ visitedViews: [...state.visitedViews],
99222
+ cachedViews: [...state.cachedViews]
99223
+ });
99224
+ })
99225
+ },
99226
+ delOthersVisitedViews({ commit, state }, view) {
99227
+ return new Promise((resolve) => {
99228
+ commit('DEL_OTHERS_VISITED_VIEWS', view);
99229
+ resolve([...state.visitedViews]);
99230
+ })
99231
+ },
99232
+ delOthersCachedViews({ commit, state }, view) {
99233
+ return new Promise((resolve) => {
99234
+ commit('DEL_OTHERS_CACHED_VIEWS', view);
99235
+ resolve([...state.cachedViews]);
99236
+ })
99237
+ },
99238
+ delAllViews({ dispatch, state }, view) {
99239
+ return new Promise((resolve) => {
99240
+ dispatch('delAllVisitedViews', view);
99241
+ dispatch('delAllCachedViews', view);
99242
+ resolve({
99243
+ visitedViews: [...state.visitedViews],
99244
+ cachedViews: [...state.cachedViews]
99245
+ });
99246
+ })
99247
+ },
99248
+ delAllVisitedViews({ commit, state }) {
99249
+ return new Promise((resolve) => {
99250
+ commit('DEL_ALL_VISITED_VIEWS');
99251
+ resolve([...state.visitedViews]);
99252
+ })
99253
+ },
99254
+ delAllCachedViews({ commit, state }) {
99255
+ return new Promise((resolve) => {
99256
+ commit('DEL_ALL_CACHED_VIEWS');
99257
+ resolve([...state.cachedViews]);
99258
+ })
99259
+ },
99260
+ updateVisitedView({ commit }, view) {
99261
+ commit('UPDATE_VISITED_VIEW', view);
99262
+ },
99263
+ delRightTags({ commit }, view) {
99264
+ return new Promise((resolve) => {
99265
+ commit('DEL_RIGHT_VIEWS', view);
99266
+ resolve([...state$1.visitedViews]);
99267
+ })
99268
+ },
99269
+ delLeftTags({ commit }, view) {
99270
+ return new Promise((resolve) => {
99271
+ commit('DEL_LEFT_VIEWS', view);
99272
+ resolve([...state$1.visitedViews]);
99273
+ })
99274
+ }
99275
+ };
99276
+
99277
+ function registerStateModule$1(store) {
99278
+ if (!store || !store.hasModule) return
99279
+ if (!store.hasModule('z-tagsView')) {
99280
+ const statesModule = {
99281
+ namespaced: true,
99282
+ state: state$1,
99283
+ mutations: mutations$1,
99284
+ actions: actions$1
99285
+ };
99286
+ store.registerModule('z-tagsView', statesModule);
99287
+ }
99288
+ }
99289
+
99290
+ const state = {
98510
99291
  token: '',
98511
99292
  userinfo: {},
98512
99293
  roles: [],
98513
99294
  permissions: []
98514
99295
  };
98515
- const mutations$4 = {
99296
+ const mutations = {
98516
99297
  SET_TOKEN: (state, token) => {
98517
99298
  state.token = token;
98518
99299
  },
@@ -98526,7 +99307,7 @@ const mutations$4 = {
98526
99307
  state.permissions = permissions;
98527
99308
  }
98528
99309
  };
98529
- const actions$4 = {
99310
+ const actions = {
98530
99311
  // 登录 todo
98531
99312
  Login({ commit }, userInfo) {},
98532
99313
 
@@ -98534,7 +99315,7 @@ const actions$4 = {
98534
99315
  GetInfo({ commit }, $z) {
98535
99316
  return new Promise((resolve, reject) => {
98536
99317
  const $http = $z.$http;
98537
- const routerOption = $z.router || {};
99318
+ const routerOption = $z.routerConfig || {};
98538
99319
  let api = function () {
98539
99320
  if ($http) {
98540
99321
  return $http.request({
@@ -98572,29 +99353,32 @@ const actions$4 = {
98572
99353
  FedLogOut({ commit }) {}
98573
99354
  };
98574
99355
 
98575
- function registerStateModule$4(store) {
99356
+ function registerStateModule(store) {
98576
99357
  if (!store || !store.hasModule) return
98577
99358
  if (!store.hasModule('z-user')) {
98578
99359
  const statesModule = {
98579
99360
  namespaced: true,
98580
- state: state$4,
98581
- mutations: mutations$4,
98582
- actions: actions$4
99361
+ state,
99362
+ mutations,
99363
+ actions
98583
99364
  };
98584
99365
  store.registerModule('z-user', statesModule);
98585
99366
  }
98586
99367
  }
98587
99368
 
98588
99369
  function install$2(Vue, option = {}) {
98589
- const z = Vue.prototype.$z;
98590
- const store = z.store;
98591
- registerStateModule$4(store);
98592
- registerStateModule$5(store);
98593
99370
  setGolbalData(Vue, option);
98594
- createRouter(Vue);
99371
+ createStore(Vue);
99372
+ const $store = Vue.prototype.$z.$store;
99373
+ registerStateModule$4($store);
99374
+ registerStateModule$3($store);
99375
+ registerStateModule$5($store);
99376
+ registerStateModule$2($store);
99377
+ registerStateModule$1($store);
99378
+ registerStateModule($store);
98595
99379
  }
98596
99380
 
98597
- var RouterZ = {
99381
+ var StoreZ = {
98598
99382
  install: install$2
98599
99383
  };
98600
99384
 
@@ -99480,64 +100264,6 @@ function DataDict (Vue, options) {
99480
100264
  });
99481
100265
  }
99482
100266
 
99483
- const state$3 = {
99484
- dict: new Array()
99485
- };
99486
- const mutations$3 = {
99487
- SET_DICT: (state, { key, value }) => {
99488
- if (key !== null && key !== '') {
99489
- state.dict.push({
99490
- key: key,
99491
- value: value
99492
- });
99493
- }
99494
- },
99495
- REMOVE_DICT: (state, key) => {
99496
- try {
99497
- for (let i = 0; i < state.dict.length; i++) {
99498
- if (state.dict[i].key == key) {
99499
- state.dict.splice(i, i);
99500
- return true
99501
- }
99502
- }
99503
- } catch (e) {
99504
- console.log(e);
99505
- }
99506
- },
99507
- CLEAN_DICT: (state) => {
99508
- state.dict = new Array();
99509
- }
99510
- };
99511
-
99512
- const actions$3 = {
99513
- // 设置字典
99514
- setDict({ commit }, data) {
99515
- commit('SET_DICT', data);
99516
- },
99517
- // 删除字典
99518
- removeDict({ commit }, key) {
99519
- commit('REMOVE_DICT', key);
99520
- },
99521
- // 清空字典
99522
- cleanDict({ commit }) {
99523
- commit('CLEAN_DICT');
99524
- }
99525
- };
99526
-
99527
- // 为vuex添加模块,存储dict数据
99528
- function registerStateModule$3(store) {
99529
- if (!store || !store.hasModule) return
99530
- if (!store.hasModule('z-dict')) {
99531
- const statesModule = {
99532
- namespaced: true,
99533
- state: state$3,
99534
- mutations: mutations$3,
99535
- actions: actions$3
99536
- };
99537
- store.registerModule('z-dict', statesModule);
99538
- }
99539
- }
99540
-
99541
100267
  function searchDictByKey(dict, key) {
99542
100268
  if (key == null && key == '') {
99543
100269
  return null
@@ -99557,11 +100283,7 @@ function install$1(Vue, option = {}) {
99557
100283
  setGolbalData(Vue, option);
99558
100284
  const z = Vue.prototype.$z;
99559
100285
  const dictOption = (z && z.dict) || {};
99560
- const store = z.store;
99561
- if (!store) {
99562
- console.warn('缺少store参数');
99563
- }
99564
- registerStateModule$3(store);
100286
+ const store = z.$store;
99565
100287
  let getDicts = function (dictType) {
99566
100288
  const $http = Vue.prototype.$z.$http;
99567
100289
  if ($http) {
@@ -99969,413 +100691,94 @@ __vue_component__$e.install = function (Vue, option = {}) {
99969
100691
  Vue.component(__vue_component__$e.name, __vue_component__$e);
99970
100692
  };
99971
100693
 
99972
- var settings = {
99973
- /**
99974
- * 侧边栏主题 深色主题theme-dark,浅色主题theme-light
99975
- */
99976
- sideTheme: 'theme-dark',
99977
-
99978
- /**
99979
- * 是否系统布局配置
99980
- */
99981
- showSettings: false,
99982
-
99983
- /**
99984
- * 是否显示顶部导航
99985
- */
99986
- topNav: false,
99987
-
99988
- /**
99989
- * 是否显示 tagsView
99990
- */
99991
- tagsView: true,
99992
-
99993
- /**
99994
- * 是否固定头部
99995
- */
99996
- fixedHeader: false,
99997
-
99998
- /**
99999
- * 是否显示logo
100000
- */
100001
- sidebarLogo: true,
100002
-
100003
- /**
100004
- * 是否显示动态标题
100005
- */
100006
- dynamicTitle: false,
100007
-
100008
- /**
100009
- * @type {string | array} 'production' | ['production', 'development']
100010
- * @description Need show err logs component.
100011
- * The default is only used in the production env
100012
- * If you want to also use it in dev, you can pass ['production', 'development']
100013
- */
100014
- errorLog: 'production'
100694
+ __vue_component__$j.install = function (Vue, option = {}) {
100695
+ setGolbalData(Vue, option);
100696
+ Vue.component(__vue_component__$j.name, __vue_component__$j);
100015
100697
  };
100016
100698
 
100017
- var defaultSettings = /*@__PURE__*/getDefaultExportFromCjs(settings);
100018
-
100019
- const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings;
100020
-
100021
- const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '';
100022
- const state$2 = {
100023
- title: '',
100024
- theme: storageSetting.theme || '#409EFF',
100025
- sideTheme: storageSetting.sideTheme || sideTheme,
100026
- showSettings: showSettings,
100027
- topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
100028
- tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
100029
- fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
100030
- sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
100031
- dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
100032
- };
100033
- const mutations$2 = {
100034
- CHANGE_SETTING: (state, { key, value }) => {
100035
- if (state.hasOwnProperty(key)) {
100036
- state[key] = value;
100037
- }
100038
- }
100039
- };
100040
-
100041
- const actions$2 = {
100042
- // 修改布局设置
100043
- changeSetting({ commit }, data) {
100044
- commit('CHANGE_SETTING', data);
100045
- },
100046
- // 设置网页标题
100047
- setTitle({ commit }, title) {
100048
- state$2.title = title;
100049
- }
100050
- };
100051
-
100052
- function registerStateModule$2(store) {
100053
- if (!store || !store.hasModule) return
100054
- if (!store.hasModule('z-settings')) {
100055
- const statesModule = {
100056
- namespaced: true,
100057
- state: state$2,
100058
- mutations: mutations$2,
100059
- actions: actions$2
100060
- };
100061
- store.registerModule('z-settings', statesModule);
100062
- }
100063
- }
100064
-
100065
- const state$1 = {
100066
- sidebar: {
100067
- opened: api.get('sidebarStatus') ? !!+api.get('sidebarStatus') : true,
100068
- withoutAnimation: false,
100069
- hide: false
100070
- },
100071
- device: 'desktop',
100072
- size: api.get('size') || 'medium'
100073
- };
100074
-
100075
- const mutations$1 = {
100076
- TOGGLE_SIDEBAR: (state) => {
100077
- if (state.sidebar.hide) {
100078
- return false
100079
- }
100080
- state.sidebar.opened = !state.sidebar.opened;
100081
- state.sidebar.withoutAnimation = false;
100082
- if (state.sidebar.opened) {
100083
- api.set('sidebarStatus', 1);
100084
- } else {
100085
- api.set('sidebarStatus', 0);
100086
- }
100087
- },
100088
- CLOSE_SIDEBAR: (state, withoutAnimation) => {
100089
- api.set('sidebarStatus', 0);
100090
- state.sidebar.opened = false;
100091
- state.sidebar.withoutAnimation = withoutAnimation;
100092
- },
100093
- TOGGLE_DEVICE: (state, device) => {
100094
- state.device = device;
100095
- },
100096
- SET_SIZE: (state, size) => {
100097
- state.size = size;
100098
- api.set('size', size);
100099
- },
100100
- SET_SIDEBAR_HIDE: (state, status) => {
100101
- state.sidebar.hide = status;
100102
- }
100103
- };
100104
-
100105
- const actions$1 = {
100106
- toggleSideBar({ commit }) {
100107
- commit('TOGGLE_SIDEBAR');
100108
- },
100109
- closeSideBar({ commit }, { withoutAnimation }) {
100110
- commit('CLOSE_SIDEBAR', withoutAnimation);
100111
- },
100112
- toggleDevice({ commit }, device) {
100113
- commit('TOGGLE_DEVICE', device);
100114
- },
100115
- setSize({ commit }, size) {
100116
- commit('SET_SIZE', size);
100117
- },
100118
- toggleSideBarHide({ commit }, status) {
100119
- commit('SET_SIDEBAR_HIDE', status);
100120
- }
100121
- };
100122
-
100123
- function registerStateModule$1(store) {
100124
- if (!store || !store.hasModule) return
100125
- if (!store.hasModule('z-app')) {
100126
- const statesModule = {
100127
- namespaced: true,
100128
- state: state$1,
100129
- mutations: mutations$1,
100130
- actions: actions$1
100131
- };
100132
- store.registerModule('z-app', statesModule);
100133
- }
100134
- }
100135
-
100136
- const state = {
100137
- visitedViews: [],
100138
- cachedViews: [],
100139
- iframeViews: []
100140
- };
100141
-
100142
- const mutations = {
100143
- ADD_IFRAME_VIEW: (state, view) => {
100144
- if (state.iframeViews.some((v) => v.path === view.path)) return
100145
- state.iframeViews.push(
100146
- Object.assign({}, view, {
100147
- title: view.meta.title || 'no-name'
100148
- })
100149
- );
100150
- },
100151
- ADD_VISITED_VIEW: (state, view) => {
100152
- if (state.visitedViews.some((v) => v.path === view.path)) return
100153
- state.visitedViews.push(
100154
- Object.assign({}, view, {
100155
- title: view.meta.title || 'no-name'
100156
- })
100157
- );
100158
- },
100159
- ADD_CACHED_VIEW: (state, view) => {
100160
- if (state.cachedViews.includes(view.name)) return
100161
- if (view.meta && !view.meta.noCache) {
100162
- state.cachedViews.push(view.name);
100163
- }
100164
- },
100165
- DEL_VISITED_VIEW: (state, view) => {
100166
- for (const [i, v] of state.visitedViews.entries()) {
100167
- if (v.path === view.path) {
100168
- state.visitedViews.splice(i, 1);
100169
- break
100170
- }
100171
- }
100172
- state.iframeViews = state.iframeViews.filter((item) => item.path !== view.path);
100173
- },
100174
- DEL_IFRAME_VIEW: (state, view) => {
100175
- state.iframeViews = state.iframeViews.filter((item) => item.path !== view.path);
100176
- },
100177
- DEL_CACHED_VIEW: (state, view) => {
100178
- const index = state.cachedViews.indexOf(view.name);
100179
- index > -1 && state.cachedViews.splice(index, 1);
100180
- },
100699
+ // import store from '@/store'
100700
+ // import router from '@/router';
100181
100701
 
100182
- DEL_OTHERS_VISITED_VIEWS: (state, view) => {
100183
- state.visitedViews = state.visitedViews.filter((v) => {
100184
- return v.meta.affix || v.path === view.path
100185
- });
100186
- state.iframeViews = state.iframeViews.filter((item) => item.path === view.path);
100187
- },
100188
- DEL_OTHERS_CACHED_VIEWS: (state, view) => {
100189
- const index = state.cachedViews.indexOf(view.name);
100190
- if (index > -1) {
100191
- state.cachedViews = state.cachedViews.slice(index, index + 1);
100192
- } else {
100193
- state.cachedViews = [];
100194
- }
100195
- },
100196
- DEL_ALL_VISITED_VIEWS: (state) => {
100197
- // keep affix tags
100198
- const affixTags = state.visitedViews.filter((tag) => tag.meta.affix);
100199
- state.visitedViews = affixTags;
100200
- state.iframeViews = [];
100201
- },
100202
- DEL_ALL_CACHED_VIEWS: (state) => {
100203
- state.cachedViews = [];
100204
- },
100205
- UPDATE_VISITED_VIEW: (state, view) => {
100206
- for (let v of state.visitedViews) {
100207
- if (v.path === view.path) {
100208
- v = Object.assign(v, view);
100209
- break
100210
- }
100211
- }
100212
- },
100213
- DEL_RIGHT_VIEWS: (state, view) => {
100214
- const index = state.visitedViews.findIndex((v) => v.path === view.path);
100215
- if (index === -1) {
100216
- return
100217
- }
100218
- state.visitedViews = state.visitedViews.filter((item, idx) => {
100219
- if (idx <= index || (item.meta && item.meta.affix)) {
100220
- return true
100702
+ function tab (Vue, option) {
100703
+ console.log(Vue.prototype.$z.$store);
100704
+ console.log(444);
100705
+ const store = Vue.prototype.$z.$store;
100706
+ const router = Vue.prototype.$z.$router;
100707
+ return {
100708
+ // 刷新当前tab页签
100709
+ refreshPage(obj) {
100710
+ const { path, query, matched } = router.currentRoute;
100711
+ if (obj === undefined) {
100712
+ matched.forEach((m) => {
100713
+ if (m.components && m.components.default && m.components.default.name) {
100714
+ if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
100715
+ obj = { name: m.components.default.name, path: path, query: query };
100716
+ }
100717
+ }
100718
+ });
100221
100719
  }
100222
- const i = state.cachedViews.indexOf(item.name);
100223
- if (i > -1) {
100224
- state.cachedViews.splice(i, 1);
100720
+ return store.dispatch('z-tagsView/delCachedView', obj).then(() => {
100721
+ const { path, query } = obj;
100722
+ router.replace({
100723
+ path: '/redirect' + path,
100724
+ query: query
100725
+ });
100726
+ })
100727
+ },
100728
+ // 关闭当前tab页签,打开新页签
100729
+ closeOpenPage(obj) {
100730
+ store.dispatch('z-tagsView/delView', router.currentRoute);
100731
+ if (obj !== undefined) {
100732
+ return router.push(obj)
100225
100733
  }
100226
- if (item.meta.link) {
100227
- const fi = state.iframeViews.findIndex((v) => v.path === item.path);
100228
- state.iframeViews.splice(fi, 1);
100734
+ },
100735
+ // 关闭指定tab页签
100736
+ closePage(obj) {
100737
+ if (obj === undefined) {
100738
+ return store.dispatch('z-tagsView/delView', router.currentRoute).then(({ visitedViews }) => {
100739
+ const latestView = visitedViews.slice(-1)[0];
100740
+ if (latestView) {
100741
+ return router.push(latestView.fullPath)
100742
+ }
100743
+ return router.push('/')
100744
+ })
100229
100745
  }
100230
- return false
100231
- });
100232
- },
100233
- DEL_LEFT_VIEWS: (state, view) => {
100234
- const index = state.visitedViews.findIndex((v) => v.path === view.path);
100235
- if (index === -1) {
100236
- return
100746
+ return store.dispatch('z-tagsView/delView', obj)
100747
+ },
100748
+ // 关闭所有tab页签
100749
+ closeAllPage() {
100750
+ return store.dispatch('z-tagsView/delAllViews')
100751
+ },
100752
+ // 关闭左侧tab页签
100753
+ closeLeftPage(obj) {
100754
+ return store.dispatch('z-tagsView/delLeftTags', obj || router.currentRoute)
100755
+ },
100756
+ // 关闭右侧tab页签
100757
+ closeRightPage(obj) {
100758
+ return store.dispatch('z-tagsView/delRightTags', obj || router.currentRoute)
100759
+ },
100760
+ // 关闭其他tab页签
100761
+ closeOtherPage(obj) {
100762
+ return store.dispatch('z-tagsView/delOthersViews', obj || router.currentRoute)
100763
+ },
100764
+ // 添加tab页签
100765
+ openPage(title, url, params) {
100766
+ var obj = { path: url, meta: { title: title } };
100767
+ store.dispatch('z-tagsView/addView', obj);
100768
+ return router.push({ path: url, query: params })
100769
+ },
100770
+ // 修改tab页签
100771
+ updatePage(obj) {
100772
+ return store.dispatch('z-tagsView/updateVisitedView', obj)
100237
100773
  }
100238
- state.visitedViews = state.visitedViews.filter((item, idx) => {
100239
- if (idx >= index || (item.meta && item.meta.affix)) {
100240
- return true
100241
- }
100242
- const i = state.cachedViews.indexOf(item.name);
100243
- if (i > -1) {
100244
- state.cachedViews.splice(i, 1);
100245
- }
100246
- if (item.meta.link) {
100247
- const fi = state.iframeViews.findIndex((v) => v.path === item.path);
100248
- state.iframeViews.splice(fi, 1);
100249
- }
100250
- return false
100251
- });
100252
- }
100253
- };
100254
-
100255
- const actions = {
100256
- addView({ dispatch }, view) {
100257
- dispatch('addVisitedView', view);
100258
- dispatch('addCachedView', view);
100259
- },
100260
- addIframeView({ commit }, view) {
100261
- commit('ADD_IFRAME_VIEW', view);
100262
- },
100263
- addVisitedView({ commit }, view) {
100264
- commit('ADD_VISITED_VIEW', view);
100265
- },
100266
- addCachedView({ commit }, view) {
100267
- commit('ADD_CACHED_VIEW', view);
100268
- },
100269
- delView({ dispatch, state }, view) {
100270
- return new Promise((resolve) => {
100271
- dispatch('delVisitedView', view);
100272
- dispatch('delCachedView', view);
100273
- resolve({
100274
- visitedViews: [...state.visitedViews],
100275
- cachedViews: [...state.cachedViews]
100276
- });
100277
- })
100278
- },
100279
- delVisitedView({ commit, state }, view) {
100280
- return new Promise((resolve) => {
100281
- commit('DEL_VISITED_VIEW', view);
100282
- resolve([...state.visitedViews]);
100283
- })
100284
- },
100285
- delIframeView({ commit, state }, view) {
100286
- return new Promise((resolve) => {
100287
- commit('DEL_IFRAME_VIEW', view);
100288
- resolve([...state.iframeViews]);
100289
- })
100290
- },
100291
- delCachedView({ commit, state }, view) {
100292
- return new Promise((resolve) => {
100293
- commit('DEL_CACHED_VIEW', view);
100294
- resolve([...state.cachedViews]);
100295
- })
100296
- },
100297
- delOthersViews({ dispatch, state }, view) {
100298
- return new Promise((resolve) => {
100299
- dispatch('delOthersVisitedViews', view);
100300
- dispatch('delOthersCachedViews', view);
100301
- resolve({
100302
- visitedViews: [...state.visitedViews],
100303
- cachedViews: [...state.cachedViews]
100304
- });
100305
- })
100306
- },
100307
- delOthersVisitedViews({ commit, state }, view) {
100308
- return new Promise((resolve) => {
100309
- commit('DEL_OTHERS_VISITED_VIEWS', view);
100310
- resolve([...state.visitedViews]);
100311
- })
100312
- },
100313
- delOthersCachedViews({ commit, state }, view) {
100314
- return new Promise((resolve) => {
100315
- commit('DEL_OTHERS_CACHED_VIEWS', view);
100316
- resolve([...state.cachedViews]);
100317
- })
100318
- },
100319
- delAllViews({ dispatch, state }, view) {
100320
- return new Promise((resolve) => {
100321
- dispatch('delAllVisitedViews', view);
100322
- dispatch('delAllCachedViews', view);
100323
- resolve({
100324
- visitedViews: [...state.visitedViews],
100325
- cachedViews: [...state.cachedViews]
100326
- });
100327
- })
100328
- },
100329
- delAllVisitedViews({ commit, state }) {
100330
- return new Promise((resolve) => {
100331
- commit('DEL_ALL_VISITED_VIEWS');
100332
- resolve([...state.visitedViews]);
100333
- })
100334
- },
100335
- delAllCachedViews({ commit, state }) {
100336
- return new Promise((resolve) => {
100337
- commit('DEL_ALL_CACHED_VIEWS');
100338
- resolve([...state.cachedViews]);
100339
- })
100340
- },
100341
- updateVisitedView({ commit }, view) {
100342
- commit('UPDATE_VISITED_VIEW', view);
100343
- },
100344
- delRightTags({ commit }, view) {
100345
- return new Promise((resolve) => {
100346
- commit('DEL_RIGHT_VIEWS', view);
100347
- resolve([...state.visitedViews]);
100348
- })
100349
- },
100350
- delLeftTags({ commit }, view) {
100351
- return new Promise((resolve) => {
100352
- commit('DEL_LEFT_VIEWS', view);
100353
- resolve([...state.visitedViews]);
100354
- })
100355
- }
100356
- };
100357
-
100358
- function registerStateModule(store) {
100359
- if (!store || !store.hasModule) return
100360
- if (!store.hasModule('z-tagsView')) {
100361
- const statesModule = {
100362
- namespaced: true,
100363
- state,
100364
- mutations,
100365
- actions
100366
- };
100367
- store.registerModule('z-tagsView', statesModule);
100368
100774
  }
100369
100775
  }
100370
100776
 
100371
- __vue_component__$j.install = function (Vue, option = {}) {
100372
- setGolbalData(Vue, option);
100373
- Vue.component(__vue_component__$j.name, __vue_component__$j);
100374
- const z = Vue.prototype.$z;
100375
- const store = z.store;
100376
- registerStateModule$2(store);
100377
- registerStateModule$1(store);
100378
- registerStateModule(store);
100777
+ var PluginsZ = {
100778
+ install(Vue, option = {}) {
100779
+ // 页签操作
100780
+ Vue.prototype.$tab = tab(Vue);
100781
+ }
100379
100782
  };
100380
100783
 
100381
100784
  //
@@ -101377,6 +101780,7 @@ const components = [
101377
101780
  __vue_component__$B,
101378
101781
  __vue_component__,
101379
101782
  RequestZ,
101783
+ StoreZ,
101380
101784
  RouterZ,
101381
101785
  __vue_component__$h,
101382
101786
  __vue_component__$g,
@@ -101396,7 +101800,8 @@ const components = [
101396
101800
  __vue_component__$3,
101397
101801
  __vue_component__$2,
101398
101802
  __vue_component__$1,
101399
- __vue_component__$j
101803
+ __vue_component__$j,
101804
+ PluginsZ
101400
101805
  ];
101401
101806
  const install = (Vue, option = {}) => {
101402
101807
  setGolbalData(Vue, option);
@@ -101425,10 +101830,12 @@ exports.LayoutZ = __vue_component__$j;
101425
101830
  exports.ListZ = __vue_component__$g;
101426
101831
  exports.MainZ = __vue_component__$5;
101427
101832
  exports.OptionZ = __vue_component__$4;
101833
+ exports.PluginsZ = PluginsZ;
101428
101834
  exports.RequestZ = RequestZ;
101429
101835
  exports.RouterZ = RouterZ;
101430
101836
  exports.RowZ = __vue_component__$3;
101431
101837
  exports.SelectZ = __vue_component__$2;
101838
+ exports.StoreZ = StoreZ;
101432
101839
  exports.TableZ = __vue_component__$h;
101433
101840
  exports.UploadZ = __vue_component__$1;
101434
101841
  exports.default = index;