cloud-web-corejs 1.0.204 → 1.0.206

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.204",
4
+ "version": "1.0.206",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -17,7 +17,7 @@ let configUtil = {
17
17
  };
18
18
 
19
19
  function getGrid(that, tableRef) {
20
- var $grid;
20
+ let $grid;
21
21
  if (Array.isArray(that.$refs[tableRef])) {
22
22
  $grid = that.$refs[tableRef][0];
23
23
  } else {
@@ -36,11 +36,11 @@ async function initVxeTable(option) {
36
36
  ) {
37
37
  return false;
38
38
  }
39
- var that = option.vue;
39
+ let that = option.vue;
40
40
  if (!that.$refs[option.tableRef]) {
41
41
  await that.$nextTick();
42
42
  }
43
- var $grid = getGrid(that, option.tableRef);
43
+ let $grid = getGrid(that, option.tableRef);
44
44
  if (!$grid) {
45
45
  return false;
46
46
  }
@@ -53,8 +53,8 @@ async function initVxeTable(option) {
53
53
  $grid.originOption.vue = that;
54
54
  option.vue = that;
55
55
 
56
- var isQueryAllPage = true;
57
- if (option.isQueryAllPage != null) {
56
+ let isQueryAllPage = true;
57
+ if (option.isQueryAllPage !== null && option.isQueryAllPage !== undefined) {
58
58
  isQueryAllPage = option.isQueryAllPage;
59
59
  }
60
60
 
@@ -63,8 +63,8 @@ async function initVxeTable(option) {
63
63
  if (option.path) {
64
64
  await getTableData(that, option.tableRef, "isQueryAllPage", (res1) => {
65
65
  let result = res1.objx ? res1.objx.data : null;
66
- if (result != null) {
67
- if (result === "false" || result == false) {
66
+ if (result !== null && result !== undefined) {
67
+ if (result === "false" || result === false) {
68
68
  isQueryAllPage = false;
69
69
  } else {
70
70
  isQueryAllPage = true;
@@ -73,8 +73,8 @@ async function initVxeTable(option) {
73
73
  });
74
74
  }
75
75
  await getTableJson(tableName, that, (resultMsg) => {
76
- var objx = resultMsg.objx;
77
- if (objx != null) {
76
+ let objx = resultMsg.objx;
77
+ if (objx !== null && objx !== undefined) {
78
78
  let jsonStr = objx.data;
79
79
  if (jsonStr) {
80
80
  let json = JSON.parse(decodeURIComponent(jsonStr));
@@ -93,6 +93,7 @@ async function initVxeTable(option) {
93
93
  } else {
94
94
  $grid.searchColumns = initSearchColumns(option);
95
95
  }
96
+
96
97
  if(!!$grid?.$refs?.xTable){
97
98
  $grid.$refs.xTable.getCellValue = getCellValue;
98
99
  $grid.$refs.xTable.createParams = createParams;
@@ -130,7 +131,7 @@ function handleToolbar($grid, option) {
130
131
  let loopDo = function (children) {
131
132
  if (children && children.length) {
132
133
  children.forEach((item) => {
133
- if (item.$options.name == "VxeToolbar") {
134
+ if (item.$options.name === "VxeToolbar") {
134
135
  $grid.connect(item);
135
136
  } else {
136
137
  loopDo(item.$children);
@@ -169,7 +170,7 @@ function handleCustomAlign(option) {
169
170
  if (columnSize > 0) {
170
171
  if (checkBoxRequired) {
171
172
  let firstColumn = option.columns[0];
172
- if (firstColumn.type != "checkbox") {
173
+ if (firstColumn.type !== "checkbox") {
173
174
  option.columns.splice(0, 0, {
174
175
  type: "checkbox",
175
176
  width: checkBoxColumnWidth,
@@ -180,8 +181,8 @@ function handleCustomAlign(option) {
180
181
  }
181
182
  if (customAlign !== false) {
182
183
  let lastColumn = option.columns[columnSize - 1];
183
- if (customAlign == "left") {
184
- if (!lastColumn.field && lastColumn.fixed == "right") {
184
+ if (customAlign === "left") {
185
+ if (!lastColumn.field && lastColumn.fixed === "right") {
185
186
  option.columns.splice(columnSize - 1, 1);
186
187
  lastColumn.fixed = "left";
187
188
  option.columns.splice(1, 0, lastColumn);
@@ -195,13 +196,13 @@ function handleCustomAlign(option) {
195
196
  });
196
197
  }
197
198
  }
198
- } else if (customAlign == "right") {
199
+ } else if (customAlign === "right") {
199
200
  let column1 = option.columns[1];
200
- if (!column1.field && column1.fixed == "left") {
201
+ if (!column1.field && column1.fixed === "left") {
201
202
  option.columns.splice(1, 1);
202
203
  column1.fixed = "right";
203
204
  option.columns.push(column1);
204
- } else if (lastColumn.field || lastColumn.fixed != "right") {
205
+ } else if (lastColumn.field || lastColumn.fixed !== "right") {
205
206
  option.columns.push({
206
207
  width: customColumnWidth,
207
208
  fixed: "right",
@@ -216,7 +217,7 @@ function handleCustomAlign(option) {
216
217
 
217
218
  //列位置拖拽
218
219
  function columnDrop(t, tableName, tableRef) {
219
- var that = t;
220
+ let that = t;
220
221
  const $table = getGrid(that, tableRef);
221
222
  if (!$table) {
222
223
  return;
@@ -275,9 +276,9 @@ function getSelfConfig() {
275
276
  }
276
277
 
277
278
  function initColumnDefaulAttrs(columns, opts) {
278
- if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
279
+ if (opts.sortAll === true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
279
280
  for (let i = 0; i < columns.length; i++) {
280
- if (columns[i].title && columns[i].sortable == null) {
281
+ if (columns[i].title && columns[i].sortable === null || columns[i].sortable === undefined) {
281
282
  columns[i].sortable = true;
282
283
  }
283
284
  }
@@ -292,8 +293,8 @@ function initColumnDefaulAttrs(columns, opts) {
292
293
  columns.forEach((column) => {
293
294
  if (column.title && column.field) {
294
295
  if (
295
- column.filterType == "filterContent"
296
- || (column.filterType == null && filterType == "filterContent")
296
+ column.filterType === "filterContent"
297
+ || ((column.filterType === null || column.filterType === undefined) && filterType === "filterContent")
297
298
  ) {
298
299
  if (!column.filters) {
299
300
  column.filters = [
@@ -309,7 +310,7 @@ function initColumnDefaulAttrs(columns, opts) {
309
310
  }
310
311
  } else if (
311
312
  column.filterType === "filterInput"
312
- || (column.filterType == null && filterType == "filterInput")
313
+ || ((column.filterType === null || column.filterType === undefined) && filterType === "filterInput")
313
314
  ) {
314
315
  if (!column.filters) {
315
316
  column.filters = [
@@ -335,7 +336,7 @@ function initColumnDefaulAttrs(columns, opts) {
335
336
  = opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
336
337
  if (lockCheckboxWidth) {
337
338
  columns.forEach((column) => {
338
- if (column.type == "checkbox") {
339
+ if (column.type === "checkbox") {
339
340
  column.width = lockCheckboxWidth;
340
341
  }
341
342
  });
@@ -345,83 +346,18 @@ function initColumnDefaulAttrs(columns, opts) {
345
346
 
346
347
  function initOption(opts) {
347
348
  let result = {};
348
- var that = opts.vue;
349
- var $grid = getGrid(that, opts.tableRef);
349
+ let that = opts.vue;
350
+ let $grid = getGrid(that, opts.tableRef);
350
351
 
351
352
  let path = opts.path || "";
352
353
  // let columns = JSON.parse(JSON.stringify(opts.columns || []));
353
354
  let columns = opts.columns || [];
354
355
  let isQueryAllPage = opts.isQueryAllPage;
355
- var pagerLayouts = getPagerConfigLayouts(opts);
356
+ let pagerLayouts = getPagerConfigLayouts(opts);
356
357
 
357
358
  let config = opts.config || {};
358
359
 
359
360
  initColumnDefaulAttrs(columns, opts);
360
- /*if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
361
- for (let i = 0; i < columns.length; i++) {
362
- if (columns[i].title && columns[i].sortable == null) {
363
- columns[i].sortable = true;
364
- }
365
- }
366
- }
367
-
368
- let tableConfig = configUtil.tableConfig || {};
369
- let selfConfig = getSelfConfig();
370
- if (opts.filterType !== false && !opts.treeNodeUrl) {
371
- let filterType
372
- = opts.filterType || selfConfig.filterType || "filterContent";
373
- if (filterType) {
374
- columns.forEach((column) => {
375
- if (column.title && column.field) {
376
- if (
377
- column.filterType == "filterContent"
378
- || (column.filterType == null && filterType == "filterContent")
379
- ) {
380
- if (!column.filters) {
381
- column.filters = [
382
- {
383
- data: {},
384
- },
385
- ];
386
- }
387
- if (!column.filterRender) {
388
- column.filterRender = {
389
- name: "FilterContent",
390
- };
391
- }
392
- } else if (
393
- column.filterType === "filterInput"
394
- || (column.filterType == null && filterType == "filterInput")
395
- ) {
396
- if (!column.filters) {
397
- column.filters = [
398
- {
399
- data: "",
400
- },
401
- ];
402
- }
403
- if (!column.filterRender) {
404
- column.filterRender = {
405
- name: "FilterInput",
406
- };
407
- }
408
- }
409
- }
410
- });
411
- }
412
- }
413
-
414
- //设置复选框列的锁定宽度
415
- if (opts.lockCheckboxWidth !== false) {
416
- let lockCheckboxWidth = opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
417
- if (lockCheckboxWidth) {
418
- columns.forEach((column) => {
419
- if (column.type == 'checkbox') {
420
- column.width = lockCheckboxWidth;
421
- }
422
- });
423
- }
424
- }*/
425
361
 
426
362
  let defaultOptions = {
427
363
  columnKey: true,
@@ -450,7 +386,7 @@ function initOption(opts) {
450
386
  layouts: pagerLayouts,
451
387
  slots: {
452
388
  left: (obj, b, c) => {
453
- var $grid = obj.$grid;
389
+ let $grid = obj.$grid;
454
390
  let k = $grid.$data;
455
391
  let tableDataInfo = $grid.getTableData();
456
392
  let data = tableDataInfo.fullData;
@@ -568,14 +504,14 @@ function initOption(opts) {
568
504
  queryParams["current"] = page.currentPage;
569
505
  }
570
506
 
571
- var $grid = getGrid(that, opts.tableRef);
507
+ let $grid = getGrid(that, opts.tableRef);
572
508
  let isQueryAllPage = $grid.isQueryAllPage;
573
509
  let pathStr1 = "";
574
510
  if (isQueryAllPage === false) {
575
511
  queryParams.searchCount = false;
576
512
  }
577
513
 
578
- var reqPath = typeof path == "function" ? path() : path;
514
+ let reqPath = typeof path === "function" ? path() : path;
579
515
  let addUserForTableEnabled
580
516
  = settingConfig.addUserForTableDisabled !== true;
581
517
  let addCreateInfo
@@ -591,21 +527,21 @@ function initOption(opts) {
591
527
  queryCreateInfo: queryCreateInfo,
592
528
  callback: (res) => {
593
529
  resolve(res);
594
- if (res.type == "success") {
530
+ if (res.type === "success") {
595
531
  let rows = res.objx
596
532
  ? res.objx.records || res.objx || []
597
533
  : [];
598
534
  if (opts.treeNodeUrl) {
599
535
  if (rows.length > 0) {
600
536
  let $t = getGrid(that, opts.tableRef);
601
- var treeConditions = $t.originOption.treeConditions || [
537
+ let treeConditions = $t.originOption.treeConditions || [
602
538
  "enabled",
603
539
  ];
604
540
  let treeFiled = Object.keys(formData).some((key) => {
605
541
  return (
606
542
  !treeConditions.includes(key)
607
- && formData[key] != null
608
- && formData[key] != ""
543
+ && formData[key] !== null && formData[key] !== undefined
544
+ && formData[key] !== ""
609
545
  );
610
546
  });
611
547
  if (treeFiled) {
@@ -621,7 +557,7 @@ function initOption(opts) {
621
557
  if (
622
558
  $t.$refs.xTable.isTreeExpandByRow(lineData)
623
559
  ) {
624
- var rest = fullAllDataRowMap.get(lineData);
560
+ let rest = fullAllDataRowMap.get(lineData);
625
561
  rest.treeLoaded = true;
626
562
  }
627
563
  });
@@ -644,7 +580,7 @@ function initOption(opts) {
644
580
  if (opts.callback) {
645
581
  that.$nextTick(() => {
646
582
  setTimeout(function () {
647
- opts.callback(rows);
583
+ opts.callback(rows, res);
648
584
  }, 0);
649
585
  });
650
586
  }
@@ -727,7 +663,7 @@ function initOption(opts) {
727
663
  method: "post",
728
664
  data: treeNodeParam,
729
665
  callback: (res) => {
730
- if (res.type == "success") {
666
+ if (res.type === "success") {
731
667
  // let rows = res.objx || [];
732
668
  let rows = res.objx ? res.objx.records || res.objx || [] : [];
733
669
  let hasChildField = $grid.treeConfig.hasChild;
@@ -738,7 +674,7 @@ function initOption(opts) {
738
674
  if (opts.treeCallback) {
739
675
  that.$nextTick(() => {
740
676
  setTimeout(function () {
741
- opts.treeCallback(rows);
677
+ opts.treeCallback(rows, res);
742
678
  }, 0);
743
679
  });
744
680
  }
@@ -776,11 +712,11 @@ function getTableJson(tableName, that, success) {
776
712
  )
777
713
  return false;
778
714
  if (!tableName) return;
779
- var url = USER_PREFIX + "/table_column/getTableJson";
780
- var data = {
715
+ let url = USER_PREFIX + "/table_column/getTableJson";
716
+ let data = {
781
717
  tableName: tableName,
782
718
  };
783
- var json = null;
719
+ let json = null;
784
720
  return that.$http({
785
721
  url: url,
786
722
  method: "post",
@@ -825,8 +761,8 @@ function addTableJson(that, $grid, tableName, columns, success) {
825
761
  }
826
762
  let json = encodeURIComponent(JSON.stringify(jsonData));
827
763
 
828
- var url = USER_PREFIX + "/table_column/addTableJson";
829
- var data = {
764
+ let url = USER_PREFIX + "/table_column/addTableJson";
765
+ let data = {
830
766
  tableName: tableName,
831
767
  // json: encodeURIComponent(JSON.stringify(saveColumn)),
832
768
  json: json,
@@ -850,11 +786,15 @@ function initColumn(option, syncColumns) {
850
786
  oldColumns.some(function (oldColumn) {
851
787
  let flag = oldColumn.field === field;
852
788
  if (flag) {
853
- let visibleSync
854
- = option.visibleSync !== false && oldColumn.visibleSync !== false;
789
+ if(!oldColumn.params)oldColumn.params = {}
790
+ let visibleSync = option.visibleSync !== false && oldColumn.visibleSync !== false;
791
+ oldColumn.params._visible = oldColumn.visible ?? true;
855
792
  if (visibleSync) {
856
793
  oldColumn.visible = syncColumn.visible;
857
794
  }
795
+ if(oldColumn.width !== undefined && oldColumn.width !== undefined){
796
+ oldColumn.params._width = oldColumn.width;
797
+ }
858
798
  if (syncColumn.width) oldColumn.width = syncColumn.width;
859
799
  newColumns.push(oldColumn);
860
800
  fields.push(field);
@@ -927,9 +867,9 @@ function initSearchColumns(option, syncColumns) {
927
867
  }
928
868
 
929
869
  function onColumnWitchChange(option) {
930
- var that = option.$grid.$parent;
931
- var $grid = option.$grid;
932
- var originOption = $grid.originOption;
870
+ let that = option.$grid.$parent;
871
+ let $grid = option.$grid;
872
+ let originOption = $grid.originOption;
933
873
  let tableName = originOption.tableName;
934
874
  if (tableName) {
935
875
  // let columns = $grid.columns;
@@ -941,14 +881,28 @@ function onColumnWitchChange(option) {
941
881
  function customHandle(option) {
942
882
  let that = option.$grid.$parent;
943
883
  let $grid = option.$grid;
944
- var originOption = $grid.originOption;
945
- if (option.type == "confirm" || option.type == "reset") {
884
+ let originOption = $grid.originOption;
885
+ if (option.type === "confirm" || option.type === "reset") {
946
886
  let tableName = originOption.tableName;
947
- if (option.type == "reset") {
948
- let columns = that.$baseLodash.cloneDeep(originOption.columns);
949
- initColumnDefaulAttrs(columns, originOption);
950
- $grid.columns = columns;
951
- // $grid.columns = originOption.columns;
887
+ if (option.type === "reset") {
888
+ const {fullColumn} = $grid.getTableColumn();
889
+ const loopDo = (columns)=>{
890
+ columns.forEach((item)=>{
891
+ if(item.children && item.children.length){
892
+ loopDo(item.children);
893
+ }else{
894
+ if(item.params){
895
+ item.visible = item.params._visible ?? true;
896
+ if(item.params._width !== undefined)item.width = item.params._width;
897
+ }
898
+ }
899
+ })
900
+ }
901
+ loopDo(fullColumn);
902
+ $grid.loadColumn(fullColumn);
903
+ // let columns = that.$baseLodash.cloneDeep(originOption.columns);
904
+ // initColumnDefaulAttrs(columns, originOption);
905
+ // $grid.columns = columns;
952
906
  }
953
907
  if (tableName) {
954
908
  setTimeout(() => {
@@ -965,7 +919,7 @@ function customHandle(option) {
965
919
  }
966
920
 
967
921
  function changeSelectCount(checked) {
968
- var checkedLength = checked.records.length;
922
+ let checkedLength = checked.records.length;
969
923
  }
970
924
 
971
925
  function getTableData(that, tableRef, type, success) {
@@ -974,14 +928,14 @@ function getTableData(that, tableRef, type, success) {
974
928
  || settingConfig.tableStorageDisabled
975
929
  )
976
930
  return false;
977
- var $grid = getGrid(that, tableRef);
978
- var tableName = $grid.tableName;
979
- var url = USER_PREFIX + "/table_column/getTableData";
980
- var param = {
931
+ let $grid = getGrid(that, tableRef);
932
+ let tableName = $grid.tableName;
933
+ let url = USER_PREFIX + "/table_column/getTableData";
934
+ let param = {
981
935
  tableName: tableName,
982
936
  type: type,
983
937
  };
984
- var data = null;
938
+ let data = null;
985
939
  return that.$http({
986
940
  async: false,
987
941
  url: url,
@@ -997,8 +951,8 @@ function addTableData(that, tableRef, value, success) {
997
951
  || settingConfig.tableStorageDisabled
998
952
  )
999
953
  return false;
1000
- var $grid = getGrid(that, tableRef);
1001
- var tableName = $grid.tableName;
954
+ let $grid = getGrid(that, tableRef);
955
+ let tableName = $grid.tableName;
1002
956
  if (tableName) {
1003
957
  that.$http({
1004
958
  method: "post",
@@ -1014,11 +968,11 @@ function addTableData(that, tableRef, value, success) {
1014
968
  }
1015
969
 
1016
970
  function checkQueryTotal(that, tableRef, value) {
1017
- var $grid = getGrid(that, tableRef);
971
+ let $grid = getGrid(that, tableRef);
1018
972
  $grid.isQueryAllPage = value;
1019
- var tableName = $grid.tableName;
1020
- var option = $grid.getProxyInfo();
1021
- var pagerConfig = $grid.pagerConfig;
973
+ let tableName = $grid.tableName;
974
+ let option = $grid.getProxyInfo();
975
+ let pagerConfig = $grid.pagerConfig;
1022
976
 
1023
977
  $grid.pagerConfig.layouts = pagerConfig.layouts || [];
1024
978
  addTableData(that, tableRef, value);