cloud-web-corejs 1.0.54-dev.630 → 1.0.54-dev.633
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 +2 -2
- package/src/api/user.js +54 -46
- package/src/components/onlineTalk/index.vue +1 -1
- package/src/components/onlineTalk/talkUserDialog.vue +280 -0
- package/src/components/table/index.js +106 -88
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1630 -1
- package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +65 -46
- package/src/layout/components/Sidebar/default.vue +226 -67
- package/src/layout/components/langTool.vue +1 -1
- package/src/views/user/position/list.vue +108 -68
|
@@ -26,6 +26,27 @@ function getGrid(that, tableRef) {
|
|
|
26
26
|
return $grid;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/** 是否在列子树中包含目标叶子列(同级 ref 优先,兜底 id) */
|
|
30
|
+
function columnSubtreeContainsLeaf(node, leaf) {
|
|
31
|
+
if (!node || !leaf) return false;
|
|
32
|
+
if (node === leaf) return true;
|
|
33
|
+
if (leaf.id && node.id && String(node.id) === String(leaf.id)) return true;
|
|
34
|
+
if (node.children && node.children.length) {
|
|
35
|
+
return node.children.some((child) =>
|
|
36
|
+
columnSubtreeContainsLeaf(child, leaf)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** leaf 所属的 collectColumn 最顶层节点的下标(-1 表示未找到) */
|
|
43
|
+
function collectTopRootIndex(collectColumn, leaf) {
|
|
44
|
+
if (!collectColumn || !collectColumn.length || !leaf) return -1;
|
|
45
|
+
return collectColumn.findIndex((root) =>
|
|
46
|
+
columnSubtreeContainsLeaf(root, leaf)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
29
50
|
async function initVxeTable(option) {
|
|
30
51
|
let tableName = option.tableName;
|
|
31
52
|
if (
|
|
@@ -247,31 +268,51 @@ function columnDrop(t, tableName, tableRef) {
|
|
|
247
268
|
if (!$table) {
|
|
248
269
|
return;
|
|
249
270
|
}
|
|
271
|
+
// if (!$table.params) $table.params = {};
|
|
250
272
|
if ($table.sortable) {
|
|
251
273
|
$table.sortable.destroy();
|
|
274
|
+
$table.sortable = null;
|
|
252
275
|
}
|
|
276
|
+
|
|
277
|
+
let draggedColId = null;
|
|
278
|
+
let relatedColId = null;
|
|
253
279
|
$table.sortable = configUtil.Sortable.create(
|
|
254
280
|
$table.$el.querySelector(
|
|
255
281
|
".body--wrapper>.vxe-table--header .vxe-header--row"
|
|
256
282
|
),
|
|
257
283
|
{
|
|
258
284
|
handle: ".vxe-header--column:not(.col--fixed)",
|
|
259
|
-
|
|
285
|
+
onMove: ({ dragged, related }) => {
|
|
286
|
+
let tableColumn = $table.getTableColumn().tableColumn;
|
|
287
|
+
draggedColId = dragged.getAttribute("colid");
|
|
288
|
+
relatedColId = related.getAttribute("colid");
|
|
289
|
+
},
|
|
290
|
+
onEnd: ({ item }) => {
|
|
260
291
|
const { fullColumn, tableColumn, collectColumn } =
|
|
261
292
|
$table.getTableColumn();
|
|
262
293
|
const targetThElem = item;
|
|
263
294
|
const wrapperElem = targetThElem.parentNode;
|
|
264
|
-
|
|
265
|
-
|
|
295
|
+
|
|
296
|
+
// 叶子在 fullColumn 中的下标,与 collectColumn 顶层结构的下标不能直接混用
|
|
297
|
+
const oldColumnIndex = fullColumn.findIndex(
|
|
298
|
+
(item) => item.id === draggedColId
|
|
299
|
+
);
|
|
300
|
+
const newColumnIndex = fullColumn.findIndex(
|
|
301
|
+
(item) => item.id === relatedColId
|
|
302
|
+
);
|
|
303
|
+
const oldLeafColumn = fullColumn[oldColumnIndex];
|
|
304
|
+
const newLeafColumn = fullColumn[newColumnIndex];
|
|
305
|
+
|
|
306
|
+
if (newLeafColumn.fixed) {
|
|
266
307
|
// 错误的移动
|
|
267
|
-
if (
|
|
308
|
+
if (newColumnIndex > oldColumnIndex) {
|
|
268
309
|
wrapperElem.insertBefore(
|
|
269
310
|
targetThElem,
|
|
270
|
-
wrapperElem.children[
|
|
311
|
+
wrapperElem.children[oldColumnIndex]
|
|
271
312
|
);
|
|
272
313
|
} else {
|
|
273
314
|
wrapperElem.insertBefore(
|
|
274
|
-
wrapperElem.children[
|
|
315
|
+
wrapperElem.children[oldColumnIndex],
|
|
275
316
|
targetThElem
|
|
276
317
|
);
|
|
277
318
|
}
|
|
@@ -281,18 +322,27 @@ function columnDrop(t, tableName, tableRef) {
|
|
|
281
322
|
status: 'error'
|
|
282
323
|
}) */
|
|
283
324
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
325
|
+
|
|
326
|
+
// let oldLeafTitle = oldLeafColumn.title;
|
|
327
|
+
// let newLeafTitle = newLeafColumn.title;
|
|
328
|
+
if (oldColumnIndex === newColumnIndex) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const oldTopIdx = collectTopRootIndex(collectColumn, oldLeafColumn);
|
|
332
|
+
const newTopIdx = collectTopRootIndex(collectColumn, newLeafColumn);
|
|
333
|
+
if (oldTopIdx === -1 || newTopIdx === -1) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (oldTopIdx !== newTopIdx) {
|
|
337
|
+
let oldTopColumn = collectColumn[oldTopIdx];
|
|
338
|
+
let newTopColumn = collectColumn[newTopIdx];
|
|
339
|
+
let oldTopTitle = oldTopColumn.title;
|
|
340
|
+
let newTopTitle = newTopColumn.title;
|
|
341
|
+
const currRow = collectColumn.splice(oldTopIdx, 1)[0];
|
|
342
|
+
collectColumn.splice(newTopIdx, 0, currRow);
|
|
343
|
+
$table.loadColumn(collectColumn);
|
|
344
|
+
addTableJson(that, $table, tableName, collectColumn);
|
|
345
|
+
}
|
|
296
346
|
},
|
|
297
347
|
}
|
|
298
348
|
);
|
|
@@ -854,6 +904,7 @@ function initColumnIndex(columns) {
|
|
|
854
904
|
if (!column.params) column.params = {};
|
|
855
905
|
if (column.params) {
|
|
856
906
|
column.params._index = index;
|
|
907
|
+
column.params._visible = column.visible ?? true;
|
|
857
908
|
}
|
|
858
909
|
if (column.children && column.children.length > 0) {
|
|
859
910
|
initColumnIndex(column.children);
|
|
@@ -865,43 +916,31 @@ function initColumn(option, syncColumns) {
|
|
|
865
916
|
let oldColumns = option.columns;
|
|
866
917
|
let newColumns = [];
|
|
867
918
|
if (syncColumns) {
|
|
868
|
-
|
|
919
|
+
// 按列对象配对:DB 里同 field 多行时不得反复匹配同一 oldColumn;old 删了重复列时多余 sync 行应丢弃
|
|
920
|
+
const matchedOld = new Set();
|
|
869
921
|
syncColumns.forEach(function (syncColumn) {
|
|
870
|
-
|
|
871
|
-
if (field)
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
) {
|
|
886
|
-
oldColumn.params._width = oldColumn.width;
|
|
887
|
-
}
|
|
888
|
-
if (syncColumn.width) oldColumn.width = syncColumn.width;
|
|
889
|
-
newColumns.push(oldColumn);
|
|
890
|
-
fields.push(field);
|
|
891
|
-
}
|
|
892
|
-
return flag;
|
|
893
|
-
});
|
|
922
|
+
const field = syncColumn.field;
|
|
923
|
+
if (!field) return;
|
|
924
|
+
const oldColumn = oldColumns.find(function (oc) {
|
|
925
|
+
return oc.field === field && !matchedOld.has(oc);
|
|
926
|
+
});
|
|
927
|
+
if (!oldColumn) return;
|
|
928
|
+
matchedOld.add(oldColumn);
|
|
929
|
+
if (!oldColumn.params) oldColumn.params = {};
|
|
930
|
+
const visibleSync =
|
|
931
|
+
option.visibleSync !== false && oldColumn.visibleSync !== false;
|
|
932
|
+
if (visibleSync) {
|
|
933
|
+
oldColumn.visible = syncColumn.visible;
|
|
934
|
+
}
|
|
935
|
+
if (oldColumn.width !== undefined) {
|
|
936
|
+
oldColumn.params._width = oldColumn.width;
|
|
894
937
|
}
|
|
938
|
+
if (syncColumn.width) oldColumn.width = syncColumn.width;
|
|
939
|
+
newColumns.push(oldColumn);
|
|
895
940
|
});
|
|
896
941
|
oldColumns.forEach(function (oldColumn, index) {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
if (!fields.includes(field)) {
|
|
900
|
-
newColumns.splice(index, 0, oldColumn);
|
|
901
|
-
}
|
|
902
|
-
} else {
|
|
903
|
-
newColumns.splice(index, 0, oldColumn);
|
|
904
|
-
}
|
|
942
|
+
if (matchedOld.has(oldColumn)) return;
|
|
943
|
+
newColumns.splice(index, 0, oldColumn);
|
|
905
944
|
});
|
|
906
945
|
|
|
907
946
|
// 处理 children 中的列
|
|
@@ -945,33 +984,28 @@ function initSearchColumns(oriColumns, syncColumns) {
|
|
|
945
984
|
let oldColumns = oriColumns || [];
|
|
946
985
|
let newColumns = [];
|
|
947
986
|
if (syncColumns) {
|
|
948
|
-
|
|
987
|
+
const matchedOld = new Set();
|
|
949
988
|
syncColumns.forEach(function (syncColumn) {
|
|
950
|
-
|
|
951
|
-
if (field)
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
fields.push(field);
|
|
961
|
-
}
|
|
962
|
-
return flag;
|
|
963
|
-
});
|
|
989
|
+
const field = syncColumn.field;
|
|
990
|
+
if (!field) return;
|
|
991
|
+
const oldColumn = oldColumns.find(function (oc) {
|
|
992
|
+
return oc.field === field && !oc.fixed && !matchedOld.has(oc);
|
|
993
|
+
});
|
|
994
|
+
if (!oldColumn) return;
|
|
995
|
+
matchedOld.add(oldColumn);
|
|
996
|
+
oldColumn.common = syncColumn.common || false;
|
|
997
|
+
if (syncColumn.defaultValue !== undefined) {
|
|
998
|
+
oldColumn.defaultValue = syncColumn.defaultValue;
|
|
964
999
|
}
|
|
1000
|
+
newColumns.push(oldColumn);
|
|
965
1001
|
});
|
|
966
1002
|
oldColumns.forEach(function (oldColumn, index) {
|
|
967
|
-
|
|
968
|
-
if (field && !oldColumn.fixed) {
|
|
969
|
-
if (!fields.includes(field)) {
|
|
970
|
-
newColumns.splice(index, 0, oldColumn);
|
|
971
|
-
}
|
|
972
|
-
} else {
|
|
1003
|
+
if (oldColumn.fixed) {
|
|
973
1004
|
newColumns.splice(index, 0, oldColumn);
|
|
1005
|
+
return;
|
|
974
1006
|
}
|
|
1007
|
+
if (matchedOld.has(oldColumn)) return;
|
|
1008
|
+
newColumns.splice(index, 0, oldColumn);
|
|
975
1009
|
});
|
|
976
1010
|
} else {
|
|
977
1011
|
newColumns = oldColumns;
|
|
@@ -1025,19 +1059,6 @@ function customHandle(option) {
|
|
|
1025
1059
|
let tableName = originOption.tableName;
|
|
1026
1060
|
if (option.type === "reset") {
|
|
1027
1061
|
const { collectColumn } = $grid.getTableColumn();
|
|
1028
|
-
/* const loopDo = (columns)=>{
|
|
1029
|
-
columns.forEach((item)=>{
|
|
1030
|
-
if(item.children && item.children.length){
|
|
1031
|
-
loopDo(item.children);
|
|
1032
|
-
}else{
|
|
1033
|
-
if(item.params){
|
|
1034
|
-
item.visible = item.params._visible ?? true;
|
|
1035
|
-
if(item.params._width !== undefined)item.width = item.params._width;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
})
|
|
1039
|
-
}
|
|
1040
|
-
loopDo(collectColumn); */
|
|
1041
1062
|
|
|
1042
1063
|
// 还原列的位置
|
|
1043
1064
|
let oldColumns = originOption.columns || [];
|
|
@@ -1048,9 +1069,6 @@ function customHandle(option) {
|
|
|
1048
1069
|
} else {
|
|
1049
1070
|
$grid.loadColumn(collectColumn);
|
|
1050
1071
|
}
|
|
1051
|
-
// let columns = that.$baseLodash.cloneDeep(originOption.columns);
|
|
1052
|
-
// initColumnDefaulAttrs(columns, originOption);
|
|
1053
|
-
// $grid.columns = columns;
|
|
1054
1072
|
}
|
|
1055
1073
|
if (tableName) {
|
|
1056
1074
|
setTimeout(() => {
|