@luzhaoqi/test 0.0.14 → 0.0.15

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 +775 -84
  2. package/package.json +1 -1
package/dist/lib-cjs.js CHANGED
@@ -17506,9 +17506,8 @@ const localCache = {
17506
17506
  function query() {
17507
17507
  const obj = {};
17508
17508
  if (this.queryParams && this.queryParams.constructor === Object) {
17509
- const queryParams = this._.cloneDeep(this.queryParams);
17509
+ const queryParams = _.cloneDeep(this.queryParams);
17510
17510
  Object.keys(queryParams).forEach((item) => {
17511
- console.log(item);
17512
17511
  if (item.startsWith('$')) {
17513
17512
  delete queryParams[item];
17514
17513
  }
@@ -17517,7 +17516,7 @@ function query() {
17517
17516
  }
17518
17517
 
17519
17518
  if (this.pageParams && this.pageParams.constructor === Object) {
17520
- const pageParams = this._.cloneDeep(this.pageParams);
17519
+ const pageParams = _.cloneDeep(this.pageParams);
17521
17520
  delete pageParams.total;
17522
17521
  Object.assign(obj, pageParams);
17523
17522
  }
@@ -17593,7 +17592,7 @@ var variables = {"menuColor":"#bfcbd9","menuLightColor":"rgba(0, 0, 0, 0.7)","me
17593
17592
 
17594
17593
  // import Item from './Item.vue'
17595
17594
 
17596
- var script = {
17595
+ var script$2 = {
17597
17596
  name: 'k-icon',
17598
17597
  data() {
17599
17598
  return {
@@ -17702,10 +17701,10 @@ var normalizeComponent_1 = normalizeComponent;
17702
17701
  var __vue_normalize__ = /*@__PURE__*/getDefaultExportFromCjs(normalizeComponent_1);
17703
17702
 
17704
17703
  /* script */
17705
- const __vue_script__ = script;
17704
+ const __vue_script__$2 = script$2;
17706
17705
 
17707
17706
  /* template */
17708
- var __vue_render__ = function () {
17707
+ var __vue_render__$2 = function () {
17709
17708
  var _vm = this;
17710
17709
  var _h = _vm.$createElement;
17711
17710
  var _c = _vm._self._c || _h;
@@ -17717,17 +17716,17 @@ var __vue_render__ = function () {
17717
17716
  _vm._v("\n " + _vm._s(_vm.variables) + "\n"),
17718
17717
  ])
17719
17718
  };
17720
- var __vue_staticRenderFns__ = [];
17721
- __vue_render__._withStripped = true;
17719
+ var __vue_staticRenderFns__$2 = [];
17720
+ __vue_render__$2._withStripped = true;
17722
17721
 
17723
17722
  /* style */
17724
- const __vue_inject_styles__ = undefined;
17723
+ const __vue_inject_styles__$2 = undefined;
17725
17724
  /* scoped */
17726
- const __vue_scope_id__ = undefined;
17725
+ const __vue_scope_id__$2 = undefined;
17727
17726
  /* module identifier */
17728
- const __vue_module_identifier__ = undefined;
17727
+ const __vue_module_identifier__$2 = undefined;
17729
17728
  /* functional template */
17730
- const __vue_is_functional_template__ = false;
17729
+ const __vue_is_functional_template__$2 = false;
17731
17730
  /* style inject */
17732
17731
 
17733
17732
  /* style inject SSR */
@@ -17736,22 +17735,22 @@ __vue_render__._withStripped = true;
17736
17735
 
17737
17736
 
17738
17737
 
17739
- const __vue_component__ = /*#__PURE__*/__vue_normalize__(
17740
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
17741
- __vue_inject_styles__,
17742
- __vue_script__,
17743
- __vue_scope_id__,
17744
- __vue_is_functional_template__,
17745
- __vue_module_identifier__,
17738
+ const __vue_component__$2 = /*#__PURE__*/__vue_normalize__(
17739
+ { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
17740
+ __vue_inject_styles__$2,
17741
+ __vue_script__$2,
17742
+ __vue_scope_id__$2,
17743
+ __vue_is_functional_template__$2,
17744
+ __vue_module_identifier__$2,
17746
17745
  false,
17747
17746
  undefined,
17748
17747
  undefined,
17749
17748
  undefined
17750
17749
  );
17751
17750
 
17752
- __vue_component__.install = function (Vue, option) {
17751
+ __vue_component__$2.install = function (Vue, option) {
17753
17752
  setGolbalData(Vue, option);
17754
- Vue.component(__vue_component__.name, __vue_component__);
17753
+ Vue.component(__vue_component__$2.name, __vue_component__$2);
17755
17754
  };
17756
17755
 
17757
17756
  var axios$3 = {exports: {}};
@@ -18869,7 +18868,7 @@ var followRedirects = {exports: {}};
18869
18868
 
18870
18869
  var src = {exports: {}};
18871
18870
 
18872
- var browser = {exports: {}};
18871
+ var browser$1 = {exports: {}};
18873
18872
 
18874
18873
  /**
18875
18874
  * Helpers.
@@ -19329,7 +19328,7 @@ function requireCommon () {
19329
19328
  var hasRequiredBrowser;
19330
19329
 
19331
19330
  function requireBrowser () {
19332
- if (hasRequiredBrowser) return browser.exports;
19331
+ if (hasRequiredBrowser) return browser$1.exports;
19333
19332
  hasRequiredBrowser = 1;
19334
19333
  (function (module, exports) {
19335
19334
  /**
@@ -19599,8 +19598,8 @@ function requireBrowser () {
19599
19598
  return '[UnexpectedJSONParseError]: ' + error.message;
19600
19599
  }
19601
19600
  };
19602
- } (browser, browser.exports));
19603
- return browser.exports;
19601
+ } (browser$1, browser$1.exports));
19602
+ return browser$1.exports;
19604
19603
  }
19605
19604
 
19606
19605
  var node = {exports: {}};
@@ -94404,73 +94403,67 @@ function chuli(arr) {
94404
94403
  }
94405
94404
 
94406
94405
  function createRouter(Vue) {
94407
- console.log(Vue._installedPlugins);
94408
-
94406
+ // 判断是否已经use过VueRouter
94409
94407
  const VueRouterObj = Vue._installedPlugins.filter((item) => {
94410
94408
  return item.name === 'VueRouter'
94411
94409
  });
94412
- if (VueRouterObj && VueRouterObj[0]) {
94413
- console.log(111111);
94414
- } else {
94415
- console.log(22222);
94410
+ if (!(VueRouterObj && VueRouterObj[0])) {
94416
94411
  Vue.use(VueRouter);
94417
- }
94418
- console.log(VueRouterObj);
94419
- console.log(33333);
94420
- const $z = Vue.prototype.$z;
94421
- if ($z.router) {
94422
- const defaultConfig = {
94423
- mode: 'history', // 去掉url中的#
94424
- scrollBehavior: () => ({ y: 0 }),
94425
- routes: []
94426
- };
94427
- const routerOption = $z.router || {};
94428
- let { beforeEach, afterEach, whiteList } = routerOption;
94429
- delete $z.router.beforeEach;
94430
- delete $z.router.afterEach;
94431
- Object.assign(defaultConfig, routerOption);
94432
- chuli(defaultConfig.routes);
94433
- const router = new VueRouter(defaultConfig);
94434
- router.beforeEach((to, from, next) => {
94435
- if (beforeEach) {
94436
- beforeEach(to, from, next);
94437
- } else {
94438
- NProgress.start();
94439
- const httpOption = $z.http || {};
94440
- const token = getCookie(httpOption.tokenKey || 'Admin-Token');
94441
- if (!whiteList) {
94442
- whiteList = ['/login', '/register'];
94443
- }
94444
- if (token) {
94445
- if (to.path === '/login') {
94446
- next({ path: '/' });
94447
- NProgress.done();
94412
+ const $z = Vue.prototype.$z;
94413
+ if ($z.router) {
94414
+ const defaultConfig = {
94415
+ mode: 'history', // 去掉url中的#
94416
+ scrollBehavior: () => ({ y: 0 }),
94417
+ routes: []
94418
+ };
94419
+ const routerOption = $z.router || {};
94420
+ let { beforeEach, afterEach, whiteList } = routerOption;
94421
+ delete $z.router.beforeEach;
94422
+ delete $z.router.afterEach;
94423
+ Object.assign(defaultConfig, routerOption);
94424
+ chuli(defaultConfig.routes);
94425
+ const router = new VueRouter(defaultConfig);
94426
+ router.beforeEach((to, from, next) => {
94427
+ if (beforeEach) {
94428
+ beforeEach(to, from, next);
94429
+ } else {
94430
+ NProgress.start();
94431
+ const httpOption = $z.http || {};
94432
+ const token = getCookie(httpOption.tokenKey || 'Admin-Token');
94433
+ if (!whiteList) {
94434
+ whiteList = ['/login', '/register'];
94435
+ }
94436
+ if (token) {
94437
+ if (to.path === '/login') {
94438
+ next({ path: '/' });
94439
+ NProgress.done();
94440
+ } else {
94441
+ // 判断是不是第一次 需要动态加载路由
94442
+ {
94443
+ next();
94444
+ }
94445
+ }
94448
94446
  } else {
94449
- // 判断是不是第一次 需要动态加载路由
94450
- {
94447
+ // 没有token
94448
+ if (whiteList.indexOf(to.path) !== -1) {
94449
+ // 在免登录白名单,直接进入
94451
94450
  next();
94451
+ } else {
94452
+ next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
94453
+ NProgress.done();
94452
94454
  }
94453
94455
  }
94454
- } else {
94455
- // 没有token
94456
- if (whiteList.indexOf(to.path) !== -1) {
94457
- // 在免登录白名单,直接进入
94458
- next();
94459
- } else {
94460
- next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
94461
- NProgress.done();
94462
- }
94463
94456
  }
94464
- }
94465
- });
94466
- router.afterEach(() => {
94467
- if (afterEach) {
94468
- afterEach();
94469
- }
94470
- NProgress.done();
94471
- });
94457
+ });
94458
+ router.afterEach(() => {
94459
+ if (afterEach) {
94460
+ afterEach();
94461
+ }
94462
+ NProgress.done();
94463
+ });
94472
94464
 
94473
- Vue.prototype.$z.router = router;
94465
+ Vue.prototype.$z.router = router;
94466
+ }
94474
94467
  }
94475
94468
  }
94476
94469
 
@@ -94483,10 +94476,706 @@ var RouterZ = {
94483
94476
  install: install$1
94484
94477
  };
94485
94478
 
94479
+ //
94480
+ //
94481
+ //
94482
+ //
94483
+ //
94484
+ //
94485
+ //
94486
+ //
94487
+ //
94488
+ //
94489
+ //
94490
+ //
94491
+ //
94492
+ //
94493
+ //
94494
+ //
94495
+ //
94496
+ //
94497
+ //
94498
+ //
94499
+ //
94500
+ //
94501
+ //
94502
+ //
94503
+ //
94504
+ //
94505
+ //
94506
+ //
94507
+ //
94508
+ //
94509
+ //
94510
+ //
94511
+ //
94512
+ //
94513
+ //
94514
+ //
94515
+ //
94516
+ //
94517
+ //
94518
+ //
94519
+ //
94520
+ //
94521
+ //
94522
+ //
94523
+ //
94524
+ //
94525
+ //
94526
+ //
94527
+ //
94528
+ //
94529
+ //
94530
+ //
94531
+ //
94532
+ //
94533
+ //
94534
+ //
94535
+ //
94536
+ //
94537
+ //
94538
+ //
94539
+ //
94540
+ //
94541
+ //
94542
+ //
94543
+ //
94544
+ //
94545
+ //
94546
+ //
94547
+
94548
+ var script$1 = {
94549
+ name: 'z-table',
94550
+ computed: {
94551
+ globalConfig() {
94552
+ if (!this.pageParamsConfig.isDefault) {
94553
+ return this.pageParamsConfig
94554
+ } else if (this.$z.list) {
94555
+ return this.$z.list
94556
+ }
94557
+ return this.pageParamsConfig
94558
+ }
94559
+ },
94560
+ props: {
94561
+ // 表格配置
94562
+ tableOption: {
94563
+ type: Object,
94564
+ required: true,
94565
+ default() {
94566
+ return {
94567
+ api: function () {
94568
+ return Promise.resolve()
94569
+ },
94570
+ column: []
94571
+ }
94572
+ }
94573
+ },
94574
+ // 表格数据
94575
+ tableData: {
94576
+ type: Array,
94577
+ default: () => {
94578
+ return []
94579
+ }
94580
+ },
94581
+ // 页码配置
94582
+ pageParamsConfig: {
94583
+ type: Object,
94584
+ default: () => {
94585
+ return {
94586
+ pageSize: 'pageSize',
94587
+ pageNum: 'pageNum',
94588
+ isDefault: true
94589
+ }
94590
+ }
94591
+ },
94592
+ // 页码参数
94593
+ pageParams: {
94594
+ type: Object,
94595
+ default: () => {
94596
+ return {
94597
+ pageSize: 10,
94598
+ pageNum: 1
94599
+ }
94600
+ }
94601
+ },
94602
+ total: {
94603
+ type: Number,
94604
+ default: 0
94605
+ },
94606
+ // 禁用
94607
+ disabled: {
94608
+ type: Boolean,
94609
+ default: () => false
94610
+ },
94611
+ // 等待
94612
+ loading: {
94613
+ type: Boolean,
94614
+ default: () => false
94615
+ }
94616
+ },
94617
+ methods: {
94618
+ // 计算序号
94619
+ getIndex(index) {
94620
+ return index + 1 + (this.pageParams[this.globalConfig.pageNum] - 1) * this.pageParams[this.globalConfig.pageSize]
94621
+ },
94622
+ // 分数数量改变
94623
+ handleSizeChange() {
94624
+ this.pageParams[this.globalConfig.pageNum] = 1;
94625
+ this.$emit('getData');
94626
+ },
94627
+ // 页码改变
94628
+ handleCurrentChange() {
94629
+ this.$emit('getData');
94630
+ }
94631
+ }
94632
+ };
94633
+
94634
+ var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
94635
+ function createInjector(context) {
94636
+ return function (id, style) {
94637
+ return addStyle(id, style);
94638
+ };
94639
+ }
94640
+ var HEAD;
94641
+ var styles = {};
94642
+
94643
+ function addStyle(id, css) {
94644
+ var group = isOldIE ? css.media || 'default' : id;
94645
+ var style = styles[group] || (styles[group] = {
94646
+ ids: new Set(),
94647
+ styles: []
94648
+ });
94649
+
94650
+ if (!style.ids.has(id)) {
94651
+ style.ids.add(id);
94652
+ var code = css.source;
94653
+
94654
+ if (css.map) {
94655
+ // https://developer.chrome.com/devtools/docs/javascript-debugging
94656
+ // this makes source maps inside style tags work properly in Chrome
94657
+ code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; // http://stackoverflow.com/a/26603875
94658
+
94659
+ code += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + ' */';
94660
+ }
94661
+
94662
+ if (!style.element) {
94663
+ style.element = document.createElement('style');
94664
+ style.element.type = 'text/css';
94665
+ if (css.media) style.element.setAttribute('media', css.media);
94666
+
94667
+ if (HEAD === undefined) {
94668
+ HEAD = document.head || document.getElementsByTagName('head')[0];
94669
+ }
94670
+
94671
+ HEAD.appendChild(style.element);
94672
+ }
94673
+
94674
+ if ('styleSheet' in style.element) {
94675
+ style.styles.push(code);
94676
+ style.element.styleSheet.cssText = style.styles.filter(Boolean).join('\n');
94677
+ } else {
94678
+ var index = style.ids.size - 1;
94679
+ var textNode = document.createTextNode(code);
94680
+ var nodes = style.element.childNodes;
94681
+ if (nodes[index]) style.element.removeChild(nodes[index]);
94682
+ if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
94683
+ }
94684
+ }
94685
+ }
94686
+
94687
+ var browser = createInjector;
94688
+
94689
+
94690
+ var __vue_create_injector__ = /*@__PURE__*/getDefaultExportFromCjs(browser);
94691
+
94692
+ /* script */
94693
+ const __vue_script__$1 = script$1;
94694
+
94695
+ /* template */
94696
+ var __vue_render__$1 = function () {
94697
+ var _vm = this;
94698
+ var _h = _vm.$createElement;
94699
+ var _c = _vm._self._c || _h;
94700
+ return _c(
94701
+ "div",
94702
+ { staticClass: "z-table-comp" },
94703
+ [
94704
+ _vm.$slots.leftMenu || _vm.$slots.rightMenu
94705
+ ? _c("div", { staticClass: "z-table-header-btn-group" }, [
94706
+ _c("div", { staticClass: "leftMenu" }, [_vm._t("leftMenu")], 2),
94707
+ _vm._v(" "),
94708
+ _c("div", { staticClass: "rightMenu" }, [_vm._t("rightMenu")], 2),
94709
+ ])
94710
+ : _vm._e(),
94711
+ _vm._v(" "),
94712
+ _c(
94713
+ "el-table",
94714
+ {
94715
+ directives: [
94716
+ {
94717
+ name: "loading",
94718
+ rawName: "v-loading",
94719
+ value: _vm.loading,
94720
+ expression: "loading",
94721
+ },
94722
+ ],
94723
+ ref: "table",
94724
+ attrs: { data: _vm.tableData, border: _vm.tableOption.border },
94725
+ },
94726
+ [
94727
+ _vm._l(_vm.tableOption.column, function (o, i) {
94728
+ return [
94729
+ o.type && !o.prop
94730
+ ? _c("el-table-column", {
94731
+ key: "item" + i,
94732
+ attrs: {
94733
+ type: o.type,
94734
+ width: o.width || 60,
94735
+ label: o.label,
94736
+ index: _vm.getIndex(i),
94737
+ align: o.align || "center",
94738
+ },
94739
+ })
94740
+ : o.slot && o.prop === "menu"
94741
+ ? _c("el-table-column", {
94742
+ key: "item" + i,
94743
+ attrs: {
94744
+ align: o.align || "center",
94745
+ label: o.label,
94746
+ width: o.width || null,
94747
+ },
94748
+ scopedSlots: _vm._u(
94749
+ [
94750
+ {
94751
+ key: "default",
94752
+ fn: function (ref) {
94753
+ var row = ref.row;
94754
+ var $index = ref.$index;
94755
+ return [
94756
+ _c(
94757
+ "div",
94758
+ { staticClass: "btn-box" },
94759
+ [
94760
+ _vm._t(o.prop, null, {
94761
+ row: row,
94762
+ $index: $index,
94763
+ }),
94764
+ ],
94765
+ 2
94766
+ ),
94767
+ ]
94768
+ },
94769
+ },
94770
+ ],
94771
+ null,
94772
+ true
94773
+ ),
94774
+ })
94775
+ : o.slot
94776
+ ? _c("el-table-column", {
94777
+ key: "item" + i,
94778
+ attrs: {
94779
+ align: o.align || "center",
94780
+ label: o.label,
94781
+ width: o.width || null,
94782
+ },
94783
+ scopedSlots: _vm._u(
94784
+ [
94785
+ {
94786
+ key: "default",
94787
+ fn: function (ref) {
94788
+ var row = ref.row;
94789
+ var $index = ref.$index;
94790
+ return [
94791
+ _c(
94792
+ "div",
94793
+ { staticClass: "z-cell" },
94794
+ [
94795
+ _vm._t(o.prop, null, {
94796
+ row: row,
94797
+ $index: $index,
94798
+ }),
94799
+ ],
94800
+ 2
94801
+ ),
94802
+ ]
94803
+ },
94804
+ },
94805
+ ],
94806
+ null,
94807
+ true
94808
+ ),
94809
+ })
94810
+ : _c("el-table-column", {
94811
+ key: "item" + i,
94812
+ attrs: {
94813
+ align: o.align || "center",
94814
+ label: o.label,
94815
+ prop: o.prop,
94816
+ width: o.width || null,
94817
+ },
94818
+ }),
94819
+ ]
94820
+ }),
94821
+ ],
94822
+ 2
94823
+ ),
94824
+ _vm._v(" "),
94825
+ _vm.tableOption.pagination || _vm.tableOption.pagination === undefined
94826
+ ? _c(
94827
+ "div",
94828
+ { staticClass: "pagination-box" },
94829
+ [
94830
+ _c("el-pagination", {
94831
+ attrs: {
94832
+ background: "",
94833
+ "page-sizes": [10, 20, 30, 40, 50, 100],
94834
+ "page-size": _vm.pageParams[_vm.globalConfig.pageSize],
94835
+ "current-page": _vm.pageParams[_vm.globalConfig.pageNum],
94836
+ layout: "total, sizes, prev, pager, next, jumper",
94837
+ total: _vm.total,
94838
+ },
94839
+ on: {
94840
+ "size-change": _vm.handleSizeChange,
94841
+ "current-change": _vm.handleCurrentChange,
94842
+ "update:pageSize": function ($event) {
94843
+ return _vm.$set(
94844
+ _vm.pageParams,
94845
+ _vm.globalConfig.pageSize,
94846
+ $event
94847
+ )
94848
+ },
94849
+ "update:page-size": function ($event) {
94850
+ return _vm.$set(
94851
+ _vm.pageParams,
94852
+ _vm.globalConfig.pageSize,
94853
+ $event
94854
+ )
94855
+ },
94856
+ "update:currentPage": function ($event) {
94857
+ return _vm.$set(
94858
+ _vm.pageParams,
94859
+ _vm.globalConfig.pageNum,
94860
+ $event
94861
+ )
94862
+ },
94863
+ "update:current-page": function ($event) {
94864
+ return _vm.$set(
94865
+ _vm.pageParams,
94866
+ _vm.globalConfig.pageNum,
94867
+ $event
94868
+ )
94869
+ },
94870
+ },
94871
+ }),
94872
+ ],
94873
+ 1
94874
+ )
94875
+ : _vm._e(),
94876
+ ],
94877
+ 1
94878
+ )
94879
+ };
94880
+ var __vue_staticRenderFns__$1 = [];
94881
+ __vue_render__$1._withStripped = true;
94882
+
94883
+ /* style */
94884
+ const __vue_inject_styles__$1 = function (inject) {
94885
+ if (!inject) return
94886
+ inject("data-v-7bdbe6c8_0", { source: ".z-table-comp .z-table-header-btn-group[data-v-7bdbe6c8] {\n padding-bottom: 10px;\n display: flex;\n}\n.z-table-comp .z-table-header-btn-group .leftMenu[data-v-7bdbe6c8] {\n flex: 1;\n margin-right: 20px;\n}\n.z-table-comp .btn-box[data-v-7bdbe6c8] {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n}\n.z-table-comp .btn-box[data-v-7bdbe6c8] .el-button {\n padding: 0 !important;\n}\n.z-table-comp .pagination-box[data-v-7bdbe6c8] {\n text-align: right;\n}\n.z-table-comp .pagination-box[data-v-7bdbe6c8] .el-pagination {\n margin-top: 25px;\n}\n\n/*# sourceMappingURL=table.vue.map */", map: {"version":3,"sources":["D:\\workspace-my\\gitee\\rollup-demo\\lib\\packages\\table\\table.vue","table.vue"],"names":[],"mappings":"AA8JA;EACA,oBAAA;EACA,aAAA;AC7JA;AD8JA;EACA,OAAA;EACA,kBAAA;AC5JA;AD+JA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,WAAA;AC7JA;AD8JA;EACA,qBAAA;AC5JA;AD+JA;EACA,iBAAA;AC7JA;AD8JA;EACA,gBAAA;AC5JA;;AAEA,oCAAoC","file":"table.vue","sourcesContent":["<template>\r\n <div class=\"z-table-comp\">\r\n <!-- 头部按钮-->\r\n <div class=\"z-table-header-btn-group\" v-if=\"$slots.leftMenu || $slots.rightMenu\">\r\n <div class=\"leftMenu\">\r\n <slot name=\"leftMenu\"></slot>\r\n </div>\r\n <div class=\"rightMenu\">\r\n <slot name=\"rightMenu\"></slot>\r\n </div>\r\n </div>\r\n <!-- 表格 -->\r\n <el-table v-loading=\"loading\" :data=\"tableData\" ref=\"table\" :border=\"tableOption.border\">\r\n <template v-for=\"(o, i) in tableOption.column\">\r\n <!-- 序号和选中 -->\r\n <el-table-column\r\n :key=\"'item' + i\"\r\n v-if=\"o.type && !o.prop\"\r\n :type=\"o.type\"\r\n :width=\"o.width || 60\"\r\n :label=\"o.label\"\r\n :index=\"getIndex(i)\"\r\n :align=\"o.align || 'center'\"\r\n />\r\n <!-- 操作按钮 -->\r\n <el-table-column\r\n :align=\"o.align || 'center'\"\r\n :key=\"'item' + i\"\r\n v-else-if=\"o.slot && o.prop === 'menu'\"\r\n :label=\"o.label\"\r\n :width=\"o.width || null\"\r\n >\r\n <template #default=\"{ row, $index }\">\r\n <div class=\"btn-box\">\r\n <slot :name=\"o.prop\" :row=\"row\" :$index=\"$index\"></slot>\r\n </div>\r\n </template>\r\n </el-table-column>\r\n <!-- 插槽 -->\r\n <el-table-column :align=\"o.align || 'center'\" :key=\"'item' + i\" v-else-if=\"o.slot\" :label=\"o.label\" :width=\"o.width || null\">\r\n <template #default=\"{ row, $index }\">\r\n <div class=\"z-cell\">\r\n <slot :name=\"o.prop\" :row=\"row\" :$index=\"$index\"></slot>\r\n </div>\r\n </template>\r\n </el-table-column>\r\n <!-- 针对其他默认情况 -->\r\n <el-table-column :align=\"o.align || 'center'\" :key=\"'item' + i\" v-else :label=\"o.label\" :prop=\"o.prop\" :width=\"o.width || null\">\r\n </el-table-column>\r\n </template>\r\n </el-table>\r\n <div class=\"pagination-box\" v-if=\"tableOption.pagination || tableOption.pagination === undefined\">\r\n <!-- hide-on-single-page-->\r\n <el-pagination\r\n background\r\n @size-change=\"handleSizeChange\"\r\n @current-change=\"handleCurrentChange\"\r\n :page-sizes=\"[10, 20, 30, 40, 50, 100]\"\r\n :page-size.sync=\"pageParams[globalConfig.pageSize]\"\r\n :current-page.sync=\"pageParams[globalConfig.pageNum]\"\r\n layout=\"total, sizes, prev, pager, next, jumper\"\r\n :total=\"total\"\r\n >\r\n </el-pagination>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'z-table',\r\n computed: {\r\n globalConfig() {\r\n if (!this.pageParamsConfig.isDefault) {\r\n return this.pageParamsConfig\r\n } else if (this.$z.list) {\r\n return this.$z.list\r\n }\r\n return this.pageParamsConfig\r\n }\r\n },\r\n props: {\r\n // 表格配置\r\n tableOption: {\r\n type: Object,\r\n required: true,\r\n default() {\r\n return {\r\n api: function () {\r\n return Promise.resolve()\r\n },\r\n column: []\r\n }\r\n }\r\n },\r\n // 表格数据\r\n tableData: {\r\n type: Array,\r\n default: () => {\r\n return []\r\n }\r\n },\r\n // 页码配置\r\n pageParamsConfig: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n pageSize: 'pageSize',\r\n pageNum: 'pageNum',\r\n isDefault: true\r\n }\r\n }\r\n },\r\n // 页码参数\r\n pageParams: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n pageSize: 10,\r\n pageNum: 1\r\n }\r\n }\r\n },\r\n total: {\r\n type: Number,\r\n default: 0\r\n },\r\n // 禁用\r\n disabled: {\r\n type: Boolean,\r\n default: () => false\r\n },\r\n // 等待\r\n loading: {\r\n type: Boolean,\r\n default: () => false\r\n }\r\n },\r\n methods: {\r\n // 计算序号\r\n getIndex(index) {\r\n return index + 1 + (this.pageParams[this.globalConfig.pageNum] - 1) * this.pageParams[this.globalConfig.pageSize]\r\n },\r\n // 分数数量改变\r\n handleSizeChange() {\r\n this.pageParams[this.globalConfig.pageNum] = 1\r\n this.$emit('getData')\r\n },\r\n // 页码改变\r\n handleCurrentChange() {\r\n this.$emit('getData')\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n.z-table-comp {\r\n .z-table-header-btn-group {\r\n padding-bottom: 10px;\r\n display: flex;\r\n .leftMenu {\r\n flex: 1;\r\n margin-right: 20px;\r\n }\r\n }\r\n .btn-box {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 100%;\r\n ::v-deep .el-button {\r\n padding: 0 !important;\r\n }\r\n }\r\n .pagination-box {\r\n text-align: right;\r\n ::v-deep .el-pagination {\r\n margin-top: 25px;\r\n }\r\n }\r\n}\r\n</style>\r\n",".z-table-comp .z-table-header-btn-group {\n padding-bottom: 10px;\n display: flex;\n}\n.z-table-comp .z-table-header-btn-group .leftMenu {\n flex: 1;\n margin-right: 20px;\n}\n.z-table-comp .btn-box {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n}\n.z-table-comp .btn-box ::v-deep .el-button {\n padding: 0 !important;\n}\n.z-table-comp .pagination-box {\n text-align: right;\n}\n.z-table-comp .pagination-box ::v-deep .el-pagination {\n margin-top: 25px;\n}\n\n/*# sourceMappingURL=table.vue.map */"]}, media: undefined });
94887
+
94888
+ };
94889
+ /* scoped */
94890
+ const __vue_scope_id__$1 = "data-v-7bdbe6c8";
94891
+ /* module identifier */
94892
+ const __vue_module_identifier__$1 = undefined;
94893
+ /* functional template */
94894
+ const __vue_is_functional_template__$1 = false;
94895
+ /* style inject SSR */
94896
+
94897
+ /* style inject shadow dom */
94898
+
94899
+
94900
+
94901
+ const __vue_component__$1 = /*#__PURE__*/__vue_normalize__(
94902
+ { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
94903
+ __vue_inject_styles__$1,
94904
+ __vue_script__$1,
94905
+ __vue_scope_id__$1,
94906
+ __vue_is_functional_template__$1,
94907
+ __vue_module_identifier__$1,
94908
+ false,
94909
+ __vue_create_injector__,
94910
+ undefined,
94911
+ undefined
94912
+ );
94913
+
94914
+ __vue_component__$1.install = function (Vue, option = {}) {
94915
+ setGolbalData(Vue, option);
94916
+ Vue.component(__vue_component__$1.name, __vue_component__$1);
94917
+ };
94918
+
94919
+ //
94920
+ //
94921
+ //
94922
+ //
94923
+ //
94924
+ //
94925
+ //
94926
+ //
94927
+ //
94928
+ //
94929
+ //
94930
+ //
94931
+ //
94932
+ //
94933
+ //
94934
+ //
94935
+ //
94936
+ //
94937
+ //
94938
+ //
94939
+ //
94940
+ //
94941
+ //
94942
+ //
94943
+
94944
+ var script = {
94945
+ name: 'z-list',
94946
+ props: {
94947
+ // 表格配置
94948
+ tableOption: {
94949
+ type: Object,
94950
+ required: true,
94951
+ default() {
94952
+ return {
94953
+ api: function () {
94954
+ return Promise.resolve()
94955
+ },
94956
+ column: []
94957
+ }
94958
+ }
94959
+ }
94960
+ },
94961
+ computed: {
94962
+ slotArr() {
94963
+ let arr = this.tableOption.column || [];
94964
+ arr = arr.filter((item) => {
94965
+ return item.slot
94966
+ });
94967
+ return arr
94968
+ },
94969
+ globalConfig() {
94970
+ const obj = {
94971
+ pageSize: 'pageSize',
94972
+ pageNum: 'pageNum',
94973
+ total: 'total',
94974
+ res: 'rows'
94975
+ };
94976
+ if (this.$Z && this.$Z.list) {
94977
+ Object.assign(obj, this.$Z.list);
94978
+ }
94979
+ return obj
94980
+ }
94981
+ },
94982
+ data() {
94983
+ return {
94984
+ // 分页参数
94985
+ pageParams: {
94986
+ // pageSize: 10,
94987
+ // pageNum: 1
94988
+ // total: 0
94989
+ },
94990
+ // 搜索参数
94991
+ queryParams: {},
94992
+ // 表格数据
94993
+ tableData: [],
94994
+ loading: false
94995
+ }
94996
+ },
94997
+ created() {
94998
+ this.resetPageParams();
94999
+ },
95000
+ mounted() {
95001
+ this.handleQuery();
95002
+ },
95003
+ methods: {
95004
+ handleQuery() {
95005
+ this.pageParams[this.globalConfig.pageNum] = 1;
95006
+ this.getList();
95007
+ },
95008
+ resetPageParams() {
95009
+ this.pageParams = {
95010
+ [this.globalConfig.pageSize]: 10,
95011
+ [this.globalConfig.pageNum]: 1,
95012
+ [this.globalConfig.total]: 0
95013
+ };
95014
+ },
95015
+ resetQuery() {
95016
+ const data = this.$options.data();
95017
+ this.queryParams = data.queryParams;
95018
+ this.resetPageParams();
95019
+ this.handleQuery();
95020
+ },
95021
+ getList() {
95022
+ // loading 好像有问题
95023
+ this.loading = true;
95024
+ // setTimeout(() => {
95025
+ // 带入隐藏值进行搜索
95026
+ if (this.tableOption.hiddenQuery) {
95027
+ this.queryParams = {
95028
+ ...this.tableOption.hiddenQuery,
95029
+ ...this.queryParams
95030
+ };
95031
+ }
95032
+ this.tableOption
95033
+ .api({
95034
+ [this.globalConfig.pageSize]: this.pageParams[this.globalConfig.pageSize],
95035
+ [this.globalConfig.pageNum]: this.pageParams[this.globalConfig.pageNum],
95036
+ ...this.queryParams
95037
+ })
95038
+ .then((res) => {
95039
+ this.tableData = res[this.globalConfig.res];
95040
+ this.pageParams.total = res[this.globalConfig.total];
95041
+ this.loading = false;
95042
+ });
95043
+ // }, 200)
95044
+ }
95045
+ }
95046
+ };
95047
+
95048
+ /* script */
95049
+ const __vue_script__ = script;
95050
+
95051
+ /* template */
95052
+ var __vue_render__ = function () {
95053
+ var _vm = this;
95054
+ var _h = _vm.$createElement;
95055
+ var _c = _vm._self._c || _h;
95056
+ return _c(
95057
+ "div",
95058
+ { staticClass: "z-list-comp" },
95059
+ [
95060
+ _c(
95061
+ "el-form",
95062
+ { ref: "queryForm", attrs: { model: _vm.queryParams, inline: true } },
95063
+ [
95064
+ _vm._t("form", null, { queryParams: _vm.queryParams }),
95065
+ _vm._v(" "),
95066
+ _c(
95067
+ "el-form-item",
95068
+ [
95069
+ _c(
95070
+ "el-button",
95071
+ {
95072
+ attrs: { type: "primary", icon: "el-icon-search" },
95073
+ on: { click: _vm.handleQuery },
95074
+ },
95075
+ [_vm._v("搜索")]
95076
+ ),
95077
+ _vm._v(" "),
95078
+ _c(
95079
+ "el-button",
95080
+ {
95081
+ attrs: { icon: "el-icon-refresh" },
95082
+ on: { click: _vm.resetQuery },
95083
+ },
95084
+ [_vm._v("重置")]
95085
+ ),
95086
+ ],
95087
+ 1
95088
+ ),
95089
+ ],
95090
+ 2
95091
+ ),
95092
+ _vm._v(" "),
95093
+ _c("z-table", {
95094
+ attrs: {
95095
+ loading: _vm.loading,
95096
+ tableOption: _vm.tableOption,
95097
+ tableData: _vm.tableData,
95098
+ pageParams: _vm.pageParams,
95099
+ },
95100
+ on: { getData: _vm.getList },
95101
+ scopedSlots: _vm._u(
95102
+ [
95103
+ {
95104
+ key: "leftMenu",
95105
+ fn: function () {
95106
+ return [_vm._t("leftMenu")]
95107
+ },
95108
+ proxy: true,
95109
+ },
95110
+ {
95111
+ key: "rightMenu",
95112
+ fn: function () {
95113
+ return [_vm._t("rightMenu")]
95114
+ },
95115
+ proxy: true,
95116
+ },
95117
+ _vm._l(_vm.slotArr, function (o) {
95118
+ return {
95119
+ key: o.prop,
95120
+ fn: function (scope) {
95121
+ return [_vm._t(o.prop, null, null, scope)]
95122
+ },
95123
+ }
95124
+ }),
95125
+ ],
95126
+ null,
95127
+ true
95128
+ ),
95129
+ }),
95130
+ _vm._v(" "),
95131
+ _vm._t("default"),
95132
+ ],
95133
+ 2
95134
+ )
95135
+ };
95136
+ var __vue_staticRenderFns__ = [];
95137
+ __vue_render__._withStripped = true;
95138
+
95139
+ /* style */
95140
+ const __vue_inject_styles__ = function (inject) {
95141
+ if (!inject) return
95142
+ inject("data-v-1ea4cbfa_0", { source: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", map: {"version":3,"sources":[],"names":[],"mappings":"","file":"list.vue"}, media: undefined });
95143
+
95144
+ };
95145
+ /* scoped */
95146
+ const __vue_scope_id__ = "data-v-1ea4cbfa";
95147
+ /* module identifier */
95148
+ const __vue_module_identifier__ = undefined;
95149
+ /* functional template */
95150
+ const __vue_is_functional_template__ = false;
95151
+ /* style inject SSR */
95152
+
95153
+ /* style inject shadow dom */
95154
+
95155
+
95156
+
95157
+ const __vue_component__ = /*#__PURE__*/__vue_normalize__(
95158
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
95159
+ __vue_inject_styles__,
95160
+ __vue_script__,
95161
+ __vue_scope_id__,
95162
+ __vue_is_functional_template__,
95163
+ __vue_module_identifier__,
95164
+ false,
95165
+ __vue_create_injector__,
95166
+ undefined,
95167
+ undefined
95168
+ );
95169
+
95170
+ __vue_component__.install = function (Vue, option = {}) {
95171
+ setGolbalData(Vue, option);
95172
+ Vue.component(__vue_component__.name, __vue_component__);
95173
+ };
95174
+
94486
95175
  if (typeof window !== 'undefined' && window.Vue) {
94487
95176
  install(window.Vue);
94488
95177
  }
94489
- const components = [__vue_component__, RequestZ, RouterZ];
95178
+ const components = [__vue_component__$2, RequestZ, RouterZ, __vue_component__$1, __vue_component__];
94490
95179
  const install = (Vue, option = {}) => {
94491
95180
  setGolbalData(Vue, option);
94492
95181
  components.forEach((component) => {
@@ -94497,7 +95186,9 @@ var index = {
94497
95186
  install
94498
95187
  };
94499
95188
 
94500
- exports.IconZ = __vue_component__;
95189
+ exports.IconZ = __vue_component__$2;
95190
+ exports.ListZ = __vue_component__;
94501
95191
  exports.RequestZ = RequestZ;
94502
95192
  exports.RouterZ = RouterZ;
95193
+ exports.TableZ = __vue_component__$1;
94503
95194
  exports.default = index;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luzhaoqi/test",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "private": false,
5
5
  "main": "dist/lib-cjs.js",
6
6
  "scripts": {