cloud-web-corejs 1.0.54-dev.626 → 1.0.54-dev.628

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.626",
4
+ "version": "1.0.54-dev.628",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -1,27 +1,35 @@
1
1
  <template>
2
2
  <div>
3
- <div class="slide-wrap" v-if="$attrs.showNav!==false">
3
+ <div class="slide-wrap" v-if="$attrs.showNav !== false">
4
4
  <template v-for="(item, index) in navList">
5
- <div :key="index" v-show="item.visible!==false">
6
- <a href="javascript:void(0)" class="slide-nav" @click="handleChange(index)">
5
+ <div :key="index" v-show="item.visible !== false">
6
+ <a
7
+ href="javascript:void(0)"
8
+ class="slide-nav"
9
+ @click="handleChange(index)"
10
+ >
7
11
  <p>{{ item.label }}</p>
8
12
  </a>
9
13
  </div>
10
14
  </template>
11
15
  </div>
12
- <div class="d-cont">
16
+ <div class="d-cont" :class="{ 'full-width': $attrs.showNav === false }">
13
17
  <slot></slot>
14
18
  </div>
15
19
  </div>
16
20
  </template>
17
21
 
18
22
  <script>
19
- import {baseTabsMixin} from './mixins.js';
23
+ import { baseTabsMixin } from "./mixins.js";
20
24
 
21
25
  export default {
22
- name: 'baseTabs',
23
- mixins: [baseTabsMixin]
26
+ name: "baseTabs",
27
+ mixins: [baseTabsMixin],
24
28
  };
25
29
  </script>
26
30
 
27
- <style></style>
31
+ <style>
32
+ div.d-cont.full-width .d-item {
33
+ padding-right: 16px !important;
34
+ }
35
+ </style>
@@ -4,10 +4,10 @@ import Sortable from "sortablejs";
4
4
  import tableConfig from "./config.js";
5
5
  import customConfig from "./customConfig.js";
6
6
  import Vue from "vue";
7
- import {extendDeeply} from "../../utils/index.js";
7
+ import { extendDeeply } from "../../utils/index.js";
8
8
  import corejsConfig from "@/corejsConfig";
9
9
  import settingConfig from "@/settings.js";
10
- import {getCellValue, createParams} from "./util/index";
10
+ import { getCellValue, createParams } from "./util/index";
11
11
 
12
12
  let configUtil = {
13
13
  Sortable,
@@ -29,10 +29,10 @@ function getGrid(that, tableRef) {
29
29
  async function initVxeTable(option) {
30
30
  let tableName = option.tableName;
31
31
  if (
32
- !configUtil.tableConfig.disableTableName
33
- && option.tableNameRequired !== false
34
- && !tableName
35
- && settingConfig.tableStorageDisabled !== true
32
+ !configUtil.tableConfig.disableTableName &&
33
+ option.tableNameRequired !== false &&
34
+ !tableName &&
35
+ settingConfig.tableStorageDisabled !== true
36
36
  ) {
37
37
  return false;
38
38
  }
@@ -58,17 +58,17 @@ async function initVxeTable(option) {
58
58
  option.vue = that;
59
59
 
60
60
  let isQueryAllPage = true;
61
- if (option.isQueryAllPage !== null && option.isQueryAllPage !== undefined) {
61
+ if (option.isQueryAllPage !== null && option.isQueryAllPage !== undefined) {
62
62
  isQueryAllPage = option.isQueryAllPage;
63
63
  }
64
64
 
65
- let searchColumns = null
65
+ let searchColumns = null;
66
66
  if (tableName) {
67
67
  $grid.tableName = tableName;
68
68
  if (option.path) {
69
69
  await getTableData(that, option.tableRef, "isQueryAllPage", (res1) => {
70
70
  let result = res1.objx ? res1.objx.data : null;
71
- if (result !== null && result !== undefined) {
71
+ if (result !== null && result !== undefined) {
72
72
  if (result === "false" || result === false) {
73
73
  isQueryAllPage = false;
74
74
  } else {
@@ -79,7 +79,7 @@ async function initVxeTable(option) {
79
79
  }
80
80
  await getTableJson(tableName, that, (resultMsg) => {
81
81
  let objx = resultMsg.objx;
82
- if (objx !== null && objx !== undefined) {
82
+ if (objx !== null && objx !== undefined) {
83
83
  let jsonStr = objx.data;
84
84
  if (jsonStr) {
85
85
  let json = JSON.parse(decodeURIComponent(jsonStr));
@@ -87,7 +87,10 @@ async function initVxeTable(option) {
87
87
  if (columnData) {
88
88
  option.columns = initColumn(option, columnData);
89
89
  }
90
- searchColumns = initSearchColumns(option.searchColumns, json.searchColumns);
90
+ searchColumns = initSearchColumns(
91
+ option.searchColumns,
92
+ json.searchColumns
93
+ );
91
94
  $grid.searchColumns = searchColumns;
92
95
  initExportColumns($grid, json);
93
96
  }
@@ -102,7 +105,7 @@ async function initVxeTable(option) {
102
105
  $grid.searchColumns = searchColumns;
103
106
  }
104
107
 
105
- if(!!$grid?.$refs?.xTable){
108
+ if (!!$grid?.$refs?.xTable) {
106
109
  $grid.$refs.xTable.getCellValue = getCellValue;
107
110
  $grid.$refs.xTable.createParams = createParams;
108
111
  }
@@ -138,7 +141,7 @@ async function initVxeTable(option) {
138
141
  isQueryAllPage,
139
142
  searchColumns,
140
143
  };
141
- if(!nOption.params)nOption.params = {};
144
+ if (!nOption.params) nOption.params = {};
142
145
  Object.assign(nOption.params, params);
143
146
  return nOption;
144
147
  }
@@ -147,8 +150,8 @@ async function initVxeTable(option) {
147
150
  function handleToolbar($grid, option) {
148
151
  let selfConfig = getSelfConfig();
149
152
  if (
150
- option.bindToolbar
151
- || (option.bindToolbar !== false && selfConfig.bindToolbar)
153
+ option.bindToolbar ||
154
+ (option.bindToolbar !== false && selfConfig.bindToolbar)
152
155
  ) {
153
156
  let loopDo = function (children) {
154
157
  if (children && children.length) {
@@ -171,17 +174,17 @@ function handleToolbar($grid, option) {
171
174
  function handleCustomAlign(option) {
172
175
  let selfConfig = getSelfConfig();
173
176
  // let customAlign = option.customAlign || selfConfig.customAlign || "right";
174
- let customAlign
175
- = selfConfig.customAlign === false
176
- ? false
177
- : selfConfig.customAlign || "right";
178
- customAlign
179
- = option.customAlign === false ? false : option.customAlign || customAlign;
180
-
181
- let customColumnWidth
182
- = option.customColumnWidth || selfConfig.customColumnWidth || 47;
183
- let checkBoxColumnWidth
184
- = option.checkBoxColumnWidth || selfConfig.checkBoxColumnWidth || 48;
177
+ let customAlign =
178
+ selfConfig.customAlign === false
179
+ ? false
180
+ : selfConfig.customAlign || "right";
181
+ customAlign =
182
+ option.customAlign === false ? false : option.customAlign || customAlign;
183
+
184
+ let customColumnWidth =
185
+ option.customColumnWidth || selfConfig.customColumnWidth || 47;
186
+ let checkBoxColumnWidth =
187
+ option.checkBoxColumnWidth || selfConfig.checkBoxColumnWidth || 48;
185
188
 
186
189
  let checkBoxRequired = selfConfig.checkBoxRequired !== false;
187
190
  if (option.checkBoxRequired === false) {
@@ -253,8 +256,9 @@ function columnDrop(t, tableName, tableRef) {
253
256
  ),
254
257
  {
255
258
  handle: ".vxe-header--column:not(.col--fixed)",
256
- onEnd: ({item, newIndex, oldIndex}) => {
257
- const {fullColumn, tableColumn,collectColumn} = $table.getTableColumn();
259
+ onEnd: ({ item, newIndex, oldIndex }) => {
260
+ const { fullColumn, tableColumn, collectColumn } =
261
+ $table.getTableColumn();
258
262
  const targetThElem = item;
259
263
  const wrapperElem = targetThElem.parentNode;
260
264
  const newColumn = tableColumn[newIndex];
@@ -303,23 +307,35 @@ function getSelfConfig() {
303
307
  function initColumnDefaulAttrs(columns, opts) {
304
308
  let tableConfig = configUtil.tableConfig || {};
305
309
  let selfConfig = getSelfConfig();
306
- let lockCheckboxWidth = opts.lockCheckboxWidth !== false ? (opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth) : null;
307
- let filterType = opts.filterType !== false && !opts.treeNodeUrl ? (opts.filterType || selfConfig.filterType || "filterContent") : null;
308
- let sortAll = opts.sortAll === true || (opts.sortAll !== false && !opts.treeNodeUrl);
310
+ let lockCheckboxWidth =
311
+ opts.lockCheckboxWidth !== false
312
+ ? opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth
313
+ : null;
314
+ let filterType =
315
+ opts.filterType !== false && !opts.treeNodeUrl
316
+ ? opts.filterType || selfConfig.filterType || "filterContent"
317
+ : null;
318
+ let sortAll =
319
+ opts.sortAll === true || (opts.sortAll !== false && !opts.treeNodeUrl);
309
320
 
310
321
  columns.forEach((column) => {
311
322
  // 只有最底层的列(没有 children)才设置默认属性
312
323
  if (!column.children || column.children.length === 0) {
313
324
  // 设置 sortable
314
- if (sortAll && column.title && (column.sortable === null || column.sortable === undefined)) {
325
+ if (
326
+ sortAll &&
327
+ column.title &&
328
+ (column.sortable === null || column.sortable === undefined)
329
+ ) {
315
330
  column.sortable = true;
316
331
  }
317
332
 
318
333
  // 设置过滤器
319
334
  if (filterType && column.title && column.field) {
320
335
  if (
321
- column.filterType === "filterContent"
322
- || ((column.filterType === null || column.filterType === undefined) && filterType === "filterContent")
336
+ column.filterType === "filterContent" ||
337
+ ((column.filterType === null || column.filterType === undefined) &&
338
+ filterType === "filterContent")
323
339
  ) {
324
340
  if (!column.filters) {
325
341
  column.filters = [
@@ -334,8 +350,9 @@ function initColumnDefaulAttrs(columns, opts) {
334
350
  };
335
351
  }
336
352
  } else if (
337
- column.filterType === "filterInput"
338
- || ((column.filterType === null || column.filterType === undefined) && filterType === "filterInput")
353
+ column.filterType === "filterInput" ||
354
+ ((column.filterType === null || column.filterType === undefined) &&
355
+ filterType === "filterInput")
339
356
  ) {
340
357
  if (!column.filters) {
341
358
  column.filters = [
@@ -484,8 +501,8 @@ function initOption(opts) {
484
501
  },*/
485
502
  columns: columns,
486
503
  };
487
- let tableDefaultConfig
488
- = corejsConfig?.componentConfig?.table?.defaultConfig || {};
504
+ let tableDefaultConfig =
505
+ corejsConfig?.componentConfig?.table?.defaultConfig || {};
489
506
  defaultOptions = configUtil.extendDeeply(defaultOptions, tableConfig);
490
507
  defaultOptions = configUtil.extendDeeply(defaultOptions, customConfig);
491
508
  defaultOptions = configUtil.extendDeeply(defaultOptions, tableDefaultConfig);
@@ -503,7 +520,7 @@ function initOption(opts) {
503
520
  },
504
521
  ajax: {
505
522
  // 接收 Promise 对象
506
- query: ({page, sorts, filters, form}) => {
523
+ query: ({ page, sorts, filters, form }) => {
507
524
  if (!opts.path) {
508
525
  return;
509
526
  }
@@ -519,7 +536,7 @@ function initOption(opts) {
519
536
  queryParams.order = firstSort.order;
520
537
  }*/
521
538
  // 处理筛选条件
522
- filters.forEach(({property, values}) => {
539
+ filters.forEach(({ property, values }) => {
523
540
  queryParams[property] = values.join(",");
524
541
  });
525
542
  if (page.pageSize !== undefined) {
@@ -535,17 +552,23 @@ function initOption(opts) {
535
552
  }
536
553
 
537
554
  let reqPath = typeof path === "function" ? path() : path;
538
- let addUserForTableEnabled
539
- = settingConfig.addUserForTableDisabled !== true;
540
- let addCreateInfo
541
- = opts.addCreateInfo === true || addUserForTableEnabled;
542
- let queryCreateInfo
543
- = opts.queryCreateInfo === true || addUserForTableEnabled;
555
+ let addUserForTableEnabled =
556
+ settingConfig.addUserForTableDisabled !== true;
557
+ let addCreateInfo =
558
+ opts.addCreateInfo === true || addUserForTableEnabled;
559
+ let queryCreateInfo =
560
+ opts.queryCreateInfo === true || addUserForTableEnabled;
561
+ let reqData = queryParams;
562
+ if (opts.paramHandle) {
563
+ reqData = opts.paramHandle
564
+ ? opts.paramHandle(queryParams) || {}
565
+ : {};
566
+ }
544
567
  that.$commonHttp({
545
568
  aes: opts.aes || false,
546
569
  url: reqPath,
547
570
  method: "post",
548
- data: queryParams,
571
+ data: reqData,
549
572
  addCreateInfo: addCreateInfo,
550
573
  queryCreateInfo: queryCreateInfo,
551
574
  callback: (res) => {
@@ -557,14 +580,14 @@ function initOption(opts) {
557
580
  if (opts.treeNodeUrl) {
558
581
  if (rows.length > 0) {
559
582
  let $t = getGrid(that, opts.tableRef);
560
- let treeConditions = $t.params.originOption.treeConditions || [
561
- "enabled",
562
- ];
583
+ let treeConditions = $t.params.originOption
584
+ .treeConditions || ["enabled"];
563
585
  let treeFiled = Object.keys(formData).some((key) => {
564
586
  return (
565
- !treeConditions.includes(key)
566
- && formData[key] !== null && formData[key] !== undefined
567
- && formData[key] !== ""
587
+ !treeConditions.includes(key) &&
588
+ formData[key] !== null &&
589
+ formData[key] !== undefined &&
590
+ formData[key] !== ""
568
591
  );
569
592
  });
570
593
  if (treeFiled) {
@@ -573,8 +596,8 @@ function initOption(opts) {
573
596
  let isLazy = $t.treeConfig.lazy;
574
597
  $t.treeConfig.lazy = false;
575
598
  $t.setAllTreeExpand(true).then(() => {
576
- let fullAllDataRowMap
577
- = $t.$refs.xTable.fullAllDataRowMap;
599
+ let fullAllDataRowMap =
600
+ $t.$refs.xTable.fullAllDataRowMap;
578
601
  let fullData = $t.getTableData().fullData;
579
602
  fullData.forEach((lineData) => {
580
603
  if (
@@ -672,14 +695,14 @@ function initOption(opts) {
672
695
  hasChild: "hasChild", // 设置是否有子节点标识
673
696
  parentField: "parent",
674
697
  transform: true,
675
- loadMethod({$table, row}) {
698
+ loadMethod({ $table, row }) {
676
699
  // 模拟后台接口
677
700
  return new Promise((resolve, reject) => {
678
701
  let treeNodeParam = opts.treeNodeParam
679
702
  ? opts.treeNodeParam(row) || {}
680
703
  : {
681
- parent: row.id,
682
- };
704
+ parent: row.id,
705
+ };
683
706
  that.$http({
684
707
  aes: opts.aes || false,
685
708
  url: opts.treeNodeUrl,
@@ -730,8 +753,8 @@ function initOption(opts) {
730
753
 
731
754
  function getTableJson(tableName, that, success) {
732
755
  if (
733
- configUtil.tableConfig.disableTableName
734
- || settingConfig.tableStorageDisabled
756
+ configUtil.tableConfig.disableTableName ||
757
+ settingConfig.tableStorageDisabled
735
758
  )
736
759
  return false;
737
760
  if (!tableName) return;
@@ -748,13 +771,12 @@ function getTableJson(tableName, that, success) {
748
771
  });
749
772
  }
750
773
 
751
- function addTableExportJson() {
752
- }
774
+ function addTableExportJson() {}
753
775
 
754
776
  function addTableJson(that, $grid, tableName, columns, success) {
755
777
  if (
756
- configUtil.tableConfig.disableTableName
757
- || settingConfig.tableStorageDisabled
778
+ configUtil.tableConfig.disableTableName ||
779
+ settingConfig.tableStorageDisabled
758
780
  )
759
781
  return false;
760
782
  if (!tableName) return;
@@ -829,7 +851,7 @@ function addTableJson(that, $grid, tableName, columns, success) {
829
851
 
830
852
  function initColumnIndex(columns) {
831
853
  columns.forEach(function (column, index) {
832
- if(!column.params)column.params = {}
854
+ if (!column.params) column.params = {};
833
855
  if (column.params) {
834
856
  column.params._index = index;
835
857
  }
@@ -847,16 +869,20 @@ function initColumn(option, syncColumns) {
847
869
  syncColumns.forEach(function (syncColumn) {
848
870
  let field = syncColumn.field;
849
871
  if (field) {
850
- oldColumns.some(function (oldColumn,index) {
872
+ oldColumns.some(function (oldColumn, index) {
851
873
  let flag = oldColumn.field === field;
852
874
  if (flag) {
853
- if(!oldColumn.params)oldColumn.params = {}
854
- let visibleSync = option.visibleSync !== false && oldColumn.visibleSync !== false;
875
+ if (!oldColumn.params) oldColumn.params = {};
876
+ let visibleSync =
877
+ option.visibleSync !== false && oldColumn.visibleSync !== false;
855
878
  oldColumn.params._visible = oldColumn.visible ?? true;
856
879
  if (visibleSync) {
857
880
  oldColumn.visible = syncColumn.visible;
858
881
  }
859
- if(oldColumn.width !== undefined && oldColumn.width !== undefined){
882
+ if (
883
+ oldColumn.width !== undefined &&
884
+ oldColumn.width !== undefined
885
+ ) {
860
886
  oldColumn.params._width = oldColumn.width;
861
887
  }
862
888
  if (syncColumn.width) oldColumn.width = syncColumn.width;
@@ -886,9 +912,16 @@ function initColumn(option, syncColumns) {
886
912
  let syncParentColumn = syncColumns.find(function (syncCol) {
887
913
  return syncCol.field === newColumn.field;
888
914
  });
889
- if (syncParentColumn && syncParentColumn.children && syncParentColumn.children.length > 0) {
915
+ if (
916
+ syncParentColumn &&
917
+ syncParentColumn.children &&
918
+ syncParentColumn.children.length > 0
919
+ ) {
890
920
  // 递归处理 children
891
- newColumn.children = initColumn({ columns: newColumn.children }, syncParentColumn.children);
921
+ newColumn.children = initColumn(
922
+ { columns: newColumn.children },
923
+ syncParentColumn.children
924
+ );
892
925
  }
893
926
  }
894
927
  });
@@ -953,7 +986,7 @@ function onColumnWitchChange(option) {
953
986
  let tableName = originOption.tableName;
954
987
  if (tableName) {
955
988
  // let columns = $grid.columns;
956
- const {fullColumn, tableColumn} = $grid.getTableColumn();
989
+ const { fullColumn, tableColumn } = $grid.getTableColumn();
957
990
  addTableJson(that, $grid, tableName);
958
991
  }
959
992
  }
@@ -965,17 +998,17 @@ function restoreColumnPosition(currentColumns) {
965
998
  let indexB = b.params?._index ?? 0;
966
999
  return indexA - indexB;
967
1000
  });
968
- console.log("sortedColumns",sortedColumns);
1001
+ console.log("sortedColumns", sortedColumns);
969
1002
 
970
1003
  // 递归处理 children
971
1004
  sortedColumns.forEach((column) => {
972
1005
  if (column.children && column.children.length > 0) {
973
1006
  column.children = restoreColumnPosition(column.children);
974
- }else{
1007
+ } else {
975
1008
  column.visible = column.params?._visible ?? true;
976
- if(column.params?._width !== undefined){
977
- column.width = column.params?._width
978
- }else{
1009
+ if (column.params?._width !== undefined) {
1010
+ column.width = column.params?._width;
1011
+ } else {
979
1012
  // delete column.width;
980
1013
  }
981
1014
  }
@@ -991,7 +1024,7 @@ function customHandle(option) {
991
1024
  if (option.type === "confirm" || option.type === "reset") {
992
1025
  let tableName = originOption.tableName;
993
1026
  if (option.type === "reset") {
994
- const {collectColumn} = $grid.getTableColumn();
1027
+ const { collectColumn } = $grid.getTableColumn();
995
1028
  /* const loopDo = (columns)=>{
996
1029
  columns.forEach((item)=>{
997
1030
  if(item.children && item.children.length){
@@ -1010,7 +1043,7 @@ function customHandle(option) {
1010
1043
  let oldColumns = originOption.columns || [];
1011
1044
  if (oldColumns.length > 0) {
1012
1045
  const restoredColumns = restoreColumnPosition(collectColumn);
1013
- console.log("restoredColumns",restoredColumns);
1046
+ console.log("restoredColumns", restoredColumns);
1014
1047
  $grid.loadColumn(restoredColumns);
1015
1048
  } else {
1016
1049
  $grid.loadColumn(collectColumn);
@@ -1038,8 +1071,8 @@ function changeSelectCount(checked) {
1038
1071
 
1039
1072
  function getTableData(that, tableRef, type, success) {
1040
1073
  if (
1041
- configUtil.tableConfig.disableTableName
1042
- || settingConfig.tableStorageDisabled
1074
+ configUtil.tableConfig.disableTableName ||
1075
+ settingConfig.tableStorageDisabled
1043
1076
  )
1044
1077
  return false;
1045
1078
  let $grid = getGrid(that, tableRef);
@@ -1061,8 +1094,8 @@ function getTableData(that, tableRef, type, success) {
1061
1094
 
1062
1095
  function addTableData(that, tableRef, value, success) {
1063
1096
  if (
1064
- configUtil.tableConfig.disableTableName
1065
- || settingConfig.tableStorageDisabled
1097
+ configUtil.tableConfig.disableTableName ||
1098
+ settingConfig.tableStorageDisabled
1066
1099
  )
1067
1100
  return false;
1068
1101
  let $grid = getGrid(that, tableRef);