cloud-web-corejs 1.0.196 → 1.0.198
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 +1 -1
- package/src/components/code-editor/index.vue +136 -51
- package/src/components/excelExport/index.js +1 -43
- package/src/components/excelExport/mixins.js +1 -964
- package/src/components/excelImport/index.js +1 -62
- package/src/components/excelImport/mixins.js +1 -774
- package/src/components/fileLibrary/mixins/categoryMoveDialogMixins.js +1 -1
- package/src/components/fileLibrary/mixins/fileCategoryDialogMixins.js +1 -1
- package/src/components/fileLibrary/mixins/fileHistoryDialogMixins.js +2 -2
- package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +350 -202
- package/src/components/fileLibrary/mixins/fileObjAuthEditDialogMixin.js +33 -26
- package/src/components/fileLibrary/mixins/fileObjAuthEditMixin.js +5 -5
- package/src/components/fileLibrary/mixins/indexMixins.js +250 -106
- package/src/components/fileLibrary/mixins/propertiesDialogMixins.js +64 -4
- package/src/components/fileLibrary/mixins/recycleBinDialogMixins.js +3 -4
- package/src/components/onlineTalk/index.vue +327 -5
- package/src/components/table/CellSlot.vue +29 -2
- package/src/components/table/config.js +1 -74
- package/src/components/table/vxeFilter/index.js +1 -153
- package/src/components/table/vxeFilter/mixin.js +1 -301
- package/src/components/table/config - hx5.0.js +0 -79
- package/src/components/table/index - hx5.0.js +0 -958
|
@@ -1,958 +0,0 @@
|
|
|
1
|
-
/**version-hx1.0*/
|
|
2
|
-
let modules = {};
|
|
3
|
-
import Sortable from 'sortablejs';
|
|
4
|
-
import tableConfig from './config.js';
|
|
5
|
-
import Vue from 'vue';
|
|
6
|
-
import CellSlot from "../../components/table/CellSlot.vue";
|
|
7
|
-
import {extendDeeply} from "../../utils/index.js";
|
|
8
|
-
|
|
9
|
-
let configUtil = {
|
|
10
|
-
Sortable,
|
|
11
|
-
extendDeeply,
|
|
12
|
-
tableConfig,
|
|
13
|
-
Vue,
|
|
14
|
-
CellSlot
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
function getGrid(that, tableRef) {
|
|
18
|
-
var $grid;
|
|
19
|
-
if (Array.isArray(that.$refs[tableRef])) {
|
|
20
|
-
$grid = that.$refs[tableRef][0];
|
|
21
|
-
} else {
|
|
22
|
-
$grid = that.$refs[tableRef];
|
|
23
|
-
}
|
|
24
|
-
return $grid;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function initVxeTable(option) {
|
|
28
|
-
let tableName = option.tableName;
|
|
29
|
-
if (!configUtil.tableConfig.disableTableName && option.tableNameRequired !== false && !tableName) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
var that = option.vue;
|
|
33
|
-
if (!that.$refs[option.tableRef]) {
|
|
34
|
-
await that.$nextTick();
|
|
35
|
-
}
|
|
36
|
-
var $grid = getGrid(that, option.tableRef);
|
|
37
|
-
if (!$grid) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
$grid.originOption = option;
|
|
41
|
-
|
|
42
|
-
var isQueryAllPage = true;
|
|
43
|
-
if (option.isQueryAllPage != null) {
|
|
44
|
-
isQueryAllPage = option.isQueryAllPage;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (tableName) {
|
|
48
|
-
$grid.tableName = tableName;
|
|
49
|
-
if (option.path) {
|
|
50
|
-
await getTableData(that, option.tableRef, "isQueryAllPage", res1 => {
|
|
51
|
-
let result = res1.objx ? res1.objx.data : null;
|
|
52
|
-
if (result != null) {
|
|
53
|
-
if (result === "false" || result == false) {
|
|
54
|
-
isQueryAllPage = false;
|
|
55
|
-
} else {
|
|
56
|
-
isQueryAllPage = true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
await getTableJson(tableName, that, resultMsg => {
|
|
62
|
-
var objx = resultMsg.objx;
|
|
63
|
-
if (objx != null) {
|
|
64
|
-
var columnData = objx.data;
|
|
65
|
-
if (columnData) {
|
|
66
|
-
option.columns = initColumn(option.columns, JSON.parse(decodeURIComponent(
|
|
67
|
-
columnData)));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
$grid.$refs.xTable.getCellValue = getCellValue;
|
|
74
|
-
$grid.getCellValue = getCellValue;
|
|
75
|
-
$grid.$refs.xTable.createParams = createParams;
|
|
76
|
-
$grid.createParams = createParams;
|
|
77
|
-
|
|
78
|
-
option.isQueryAllPage = isQueryAllPage;
|
|
79
|
-
var nOption = initOption(option);
|
|
80
|
-
|
|
81
|
-
$grid.isQueryAllPage = isQueryAllPage;
|
|
82
|
-
|
|
83
|
-
if (tableName) {
|
|
84
|
-
nOption.tableName = tableName;
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
var h1 = that.$el.offsetHeight;
|
|
88
|
-
var h2 = that.$el.parentElement.offsetHeight;
|
|
89
|
-
var tableContainter = $grid.$parent.$el;
|
|
90
|
-
var h3 = tableContainter.offsetHeight;
|
|
91
|
-
if (tableContainter.className.indexOf("el-dialog__wrapper") >= 0) {
|
|
92
|
-
let ah = $grid.$el.parentElement.parentElement.offsetHeight - 45;
|
|
93
|
-
let bh = ah + 3;
|
|
94
|
-
|
|
95
|
-
nOption.containterHeight = ah;
|
|
96
|
-
nOption.treeHeight = bh;
|
|
97
|
-
} else if (true || h2 > h1) {
|
|
98
|
-
let ah = (h3 + (h2 - h1) - 86);
|
|
99
|
-
let bh = (h3 + (h2 - h1) - 83);
|
|
100
|
-
|
|
101
|
-
nOption.containterHeight = ah;
|
|
102
|
-
nOption.treeHeight = bh;
|
|
103
|
-
}
|
|
104
|
-
} catch (ex) {
|
|
105
|
-
nOption.containterHeight = "";
|
|
106
|
-
nOption.treeHeight = "";
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
nOption.vue = that;
|
|
110
|
-
columnDrop(that, tableName, option.tableRef);
|
|
111
|
-
return nOption;
|
|
112
|
-
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
function columnDrop(t, tableName, tableRef) {
|
|
116
|
-
var that = t;
|
|
117
|
-
const $table = getGrid(that, tableRef);
|
|
118
|
-
if (!$table) {
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
if ($table.sortable) {
|
|
122
|
-
$table.sortable.destroy();
|
|
123
|
-
}
|
|
124
|
-
$table.sortable = configUtil.Sortable.create($table.$el.querySelector(
|
|
125
|
-
'.body--wrapper>.vxe-table--header .vxe-header--row'), {
|
|
126
|
-
handle: '.vxe-header--column:not(.col--fixed)',
|
|
127
|
-
onEnd: ({
|
|
128
|
-
item,
|
|
129
|
-
newIndex,
|
|
130
|
-
oldIndex
|
|
131
|
-
}) => {
|
|
132
|
-
const {
|
|
133
|
-
fullColumn,
|
|
134
|
-
tableColumn
|
|
135
|
-
} = $table.getTableColumn();
|
|
136
|
-
const targetThElem = item;
|
|
137
|
-
const wrapperElem = targetThElem.parentNode;
|
|
138
|
-
const newColumn = fullColumn[newIndex];
|
|
139
|
-
if (newColumn.fixed) {
|
|
140
|
-
// 错误的移动
|
|
141
|
-
if (newIndex > oldIndex) {
|
|
142
|
-
wrapperElem.insertBefore(targetThElem, wrapperElem.children[oldIndex]);
|
|
143
|
-
} else {
|
|
144
|
-
wrapperElem.insertBefore(wrapperElem.children[oldIndex], targetThElem);
|
|
145
|
-
}
|
|
146
|
-
return;
|
|
147
|
-
/* return that.$XModal.message({
|
|
148
|
-
content: '固定列不允许拖动!',
|
|
149
|
-
status: 'error'
|
|
150
|
-
}) */
|
|
151
|
-
}
|
|
152
|
-
// 转换真实索引
|
|
153
|
-
const oldColumnIndex = $table.getColumnIndex(tableColumn[oldIndex]);
|
|
154
|
-
const newColumnIndex = $table.getColumnIndex(tableColumn[newIndex]);
|
|
155
|
-
// 移动到目标列
|
|
156
|
-
const currRow = fullColumn.splice(oldColumnIndex, 1)[0];
|
|
157
|
-
fullColumn.splice(newColumnIndex, 0, currRow);
|
|
158
|
-
|
|
159
|
-
$table.loadColumn(fullColumn);
|
|
160
|
-
|
|
161
|
-
addTableJson(that, tableName, fullColumn);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
function initOption(opts) {
|
|
167
|
-
let result = {};
|
|
168
|
-
var that = opts.vue;
|
|
169
|
-
var $grid = getGrid(that, opts.tableRef);
|
|
170
|
-
|
|
171
|
-
let path = opts.path || '';
|
|
172
|
-
// let columns = JSON.parse(JSON.stringify(opts.columns || []));
|
|
173
|
-
let columns = opts.columns || [];
|
|
174
|
-
let isQueryAllPage = opts.isQueryAllPage;
|
|
175
|
-
var pagerLayouts = getPagerConfigLayouts(isQueryAllPage);
|
|
176
|
-
let config = opts.config || {};
|
|
177
|
-
|
|
178
|
-
if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
|
|
179
|
-
for (let i = 0; i < columns.length; i++) {
|
|
180
|
-
if (columns[i].title && columns[i].sortable == null) {
|
|
181
|
-
columns[i].sortable = true;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
let tableConfig = configUtil.tableConfig || {};
|
|
187
|
-
let selfConfig = tableConfig.selfConfig || {};
|
|
188
|
-
//hx
|
|
189
|
-
/* if (opts.filterType !== false && !opts.treeNodeUrl) {
|
|
190
|
-
let filterType = opts.filterType || selfConfig.filterType || "filterContent";
|
|
191
|
-
if (filterType) {
|
|
192
|
-
columns.forEach(column => {
|
|
193
|
-
if (column.title && column.field) {
|
|
194
|
-
if (column.filterType == "filterContent" || (column.filterType == null && filterType ==
|
|
195
|
-
"filterContent")) {
|
|
196
|
-
if (!column.filters) {
|
|
197
|
-
column.filters = [{
|
|
198
|
-
data: {}
|
|
199
|
-
}];
|
|
200
|
-
}
|
|
201
|
-
if (!column.filterRender) {
|
|
202
|
-
column.filterRender = {
|
|
203
|
-
name: 'FilterContent'
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
} else if (column.filterType === "filterInput" || (column.filterType == null &&
|
|
207
|
-
filterType == "filterInput")) {
|
|
208
|
-
if (!column.filters) {
|
|
209
|
-
column.filters = [{
|
|
210
|
-
data: ''
|
|
211
|
-
}];
|
|
212
|
-
}
|
|
213
|
-
if (!column.filterRender) {
|
|
214
|
-
column.filterRender = {
|
|
215
|
-
name: 'FilterInput'
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
} */
|
|
224
|
-
|
|
225
|
-
let defaultOptions = {
|
|
226
|
-
columnKey: true,
|
|
227
|
-
resizable: true,
|
|
228
|
-
showOverflow: true,
|
|
229
|
-
highlightHoverRow: true,
|
|
230
|
-
border: 'inner',
|
|
231
|
-
height: 'auto',
|
|
232
|
-
// maxHeight:"1000px",
|
|
233
|
-
// rowId: 'id',
|
|
234
|
-
emptyText: " ",
|
|
235
|
-
sortConfig: {
|
|
236
|
-
trigger: 'cell',
|
|
237
|
-
remote: false
|
|
238
|
-
},
|
|
239
|
-
filterConfig: {
|
|
240
|
-
remote: false
|
|
241
|
-
},
|
|
242
|
-
pagerConfig: {
|
|
243
|
-
autoHidden: true,
|
|
244
|
-
perfect: true,
|
|
245
|
-
pageSize: 200,
|
|
246
|
-
//pageSizes: [5, 15, 20, 50, 100, 200, 500, 1000],
|
|
247
|
-
layouts: pagerLayouts,
|
|
248
|
-
slots: {
|
|
249
|
-
left: (obj, b, c) => {
|
|
250
|
-
var $grid = obj.$grid;
|
|
251
|
-
let k = $grid.$data;
|
|
252
|
-
let tableDataInfo = $grid.getTableData();
|
|
253
|
-
let data = tableDataInfo.fullData;
|
|
254
|
-
// return ['本页记录数 ' + data.length+ ' 条']
|
|
255
|
-
let h = $grid.$createElement;
|
|
256
|
-
|
|
257
|
-
let proxyInfo = $grid.getProxyInfo();
|
|
258
|
-
let pager = proxyInfo ? proxyInfo.pager : null;
|
|
259
|
-
|
|
260
|
-
let celems = [h('span', '本页记录数'),
|
|
261
|
-
h('span', {
|
|
262
|
-
attrs: {
|
|
263
|
-
class: 'f-red'
|
|
264
|
-
}
|
|
265
|
-
}, ' ' + tableDataInfo.visibleData.length + ' ')
|
|
266
|
-
];
|
|
267
|
-
if (pager && $grid.isQueryAllPage) {
|
|
268
|
-
celems.push(h('span', ',总记录数'));
|
|
269
|
-
celems.push(h('span', {
|
|
270
|
-
attrs: {
|
|
271
|
-
class: 'f-red'
|
|
272
|
-
}
|
|
273
|
-
}, ' ' + pager.total + ' '));
|
|
274
|
-
}
|
|
275
|
-
let elem = h('span', {}, celems);
|
|
276
|
-
return [elem];
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
exportConfig: {
|
|
281
|
-
// 默认选中类型
|
|
282
|
-
type: 'xlsx',
|
|
283
|
-
// 局部自定义类型
|
|
284
|
-
types: ['xlsx', 'csv', 'html', 'xml', 'txt'],
|
|
285
|
-
// 自定义数据量列表
|
|
286
|
-
modes: ['current', 'all']
|
|
287
|
-
},
|
|
288
|
-
radioConfig: {
|
|
289
|
-
labelField: 'id',
|
|
290
|
-
reserve: true,
|
|
291
|
-
highlight: true
|
|
292
|
-
},
|
|
293
|
-
checkboxConfig: {
|
|
294
|
-
highlight: true
|
|
295
|
-
},
|
|
296
|
-
customConfig: {
|
|
297
|
-
storage: false
|
|
298
|
-
},
|
|
299
|
-
columns: columns
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
defaultOptions = configUtil.extendDeeply(defaultOptions, tableConfig);
|
|
303
|
-
|
|
304
|
-
if (opts.path) {
|
|
305
|
-
// defaultOptions.filterInput = true;
|
|
306
|
-
defaultOptions.pagerConfig.autoHidden = false;
|
|
307
|
-
defaultOptions.proxyConfig = {
|
|
308
|
-
seq: true, // 启用动态序号代理
|
|
309
|
-
sort: true, // 启用排序代理
|
|
310
|
-
filter: true, // 启用筛选代理
|
|
311
|
-
props: {
|
|
312
|
-
result: 'objx.records', // 配置响应结果列表字段
|
|
313
|
-
total: 'objx.total' // 配置响应结果总页数字段
|
|
314
|
-
},
|
|
315
|
-
ajax: {
|
|
316
|
-
// 接收 Promise 对象
|
|
317
|
-
query: ({
|
|
318
|
-
page,
|
|
319
|
-
sorts,
|
|
320
|
-
filters,
|
|
321
|
-
form
|
|
322
|
-
}) => {
|
|
323
|
-
if (!opts.path) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
let formData = opts.param ? (opts.param() || {}) : {};
|
|
328
|
-
const queryParams = Object.assign({}, formData);
|
|
329
|
-
|
|
330
|
-
// 处理排序条件
|
|
331
|
-
const firstSort = sorts[0];
|
|
332
|
-
if (firstSort) {
|
|
333
|
-
queryParams.sort = firstSort.property;
|
|
334
|
-
queryParams.order = firstSort.order;
|
|
335
|
-
}
|
|
336
|
-
// 处理筛选条件
|
|
337
|
-
filters.forEach(({
|
|
338
|
-
property,
|
|
339
|
-
values
|
|
340
|
-
}) => {
|
|
341
|
-
queryParams[property] = values.join(',');
|
|
342
|
-
});
|
|
343
|
-
queryParams['size'] = `${page.pageSize}`;
|
|
344
|
-
queryParams['current'] = `${page.currentPage}`;
|
|
345
|
-
var $grid = getGrid(that, opts.tableRef);
|
|
346
|
-
let isQueryAllPage = $grid.isQueryAllPage;
|
|
347
|
-
let pathStr1 = '';
|
|
348
|
-
if (isQueryAllPage === false) {
|
|
349
|
-
/* pathStr1 = "searchCount=false"; */
|
|
350
|
-
queryParams.searchCount = false;
|
|
351
|
-
}
|
|
352
|
-
var reqPath = path;
|
|
353
|
-
/* var reqPath = '';
|
|
354
|
-
if (path.indexOf("?") >= 0) {
|
|
355
|
-
reqPath = path + "&" + pathStr1;
|
|
356
|
-
} else {
|
|
357
|
-
reqPath = path + "?" + pathStr1;
|
|
358
|
-
} */
|
|
359
|
-
//return XEAjax.get(`https://api.xuliangzhan.com:10443/demo/api/pub/page/list/${page.pageSize}/${page.currentPage}`, queryParams)
|
|
360
|
-
//return request.post(`/user/position/listPage`, queryParams)
|
|
361
|
-
|
|
362
|
-
return new Promise((resolve, reject) => {
|
|
363
|
-
that.$http({
|
|
364
|
-
url: reqPath,
|
|
365
|
-
method: 'post',
|
|
366
|
-
data: queryParams,
|
|
367
|
-
callback: res => {
|
|
368
|
-
resolve(res);
|
|
369
|
-
if (res.type == "success") {
|
|
370
|
-
let rows = res.objx ? (res.objx.records || res.objx || []) : [];
|
|
371
|
-
if (opts.treeNodeUrl) {
|
|
372
|
-
if (res.objx && res.objx.records == null) {
|
|
373
|
-
rows = res.objx || [];
|
|
374
|
-
}
|
|
375
|
-
if (rows.length > 0) {
|
|
376
|
-
let row = rows[0];
|
|
377
|
-
if (row[result.treeConfig.hasChild]) {
|
|
378
|
-
that.$nextTick(() => {
|
|
379
|
-
setTimeout(function() {
|
|
380
|
-
let $t = getGrid(
|
|
381
|
-
that, opts
|
|
382
|
-
.tableRef);
|
|
383
|
-
$t.setTreeExpand(
|
|
384
|
-
row, true);
|
|
385
|
-
}, 0);
|
|
386
|
-
})
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (opts.callback) {
|
|
391
|
-
that.$nextTick(() => {
|
|
392
|
-
setTimeout(function() {
|
|
393
|
-
opts.callback(rows);
|
|
394
|
-
}, 0);
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
},
|
|
399
|
-
error: error => {
|
|
400
|
-
reject(error);
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
},
|
|
406
|
-
// 被某些特殊功能所触发,例如:导出数据 mode=all 时,会触发该方法并对返回的数据进行导出
|
|
407
|
-
queryAll: () => fetch(path || '').then(response => response
|
|
408
|
-
.json())
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
} else {
|
|
412
|
-
if (!$grid.height && (!opts.config || !opts.config.height)) {
|
|
413
|
-
defaultOptions.maxHeight = "528px";
|
|
414
|
-
}
|
|
415
|
-
defaultOptions.scrollY = {
|
|
416
|
-
gt: 200
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (opts.editSaveUrl) {
|
|
421
|
-
defaultOptions.keepSource = true,
|
|
422
|
-
defaultOptions.editConfig = {
|
|
423
|
-
trigger: 'manual',
|
|
424
|
-
mode: 'row',
|
|
425
|
-
showStatus: true,
|
|
426
|
-
autoClear: false,
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
if (opts.treeNodeUrl) {
|
|
430
|
-
defaultOptions.proxyConfig.props.result = 'objx';
|
|
431
|
-
defaultOptions.pagerConfig.autoHidden = true;
|
|
432
|
-
defaultOptions.treeConfig = {
|
|
433
|
-
lazy: true,
|
|
434
|
-
children: 'children',
|
|
435
|
-
hasChild: 'hasChild', // 设置是否有子节点标识
|
|
436
|
-
parentField: "parent",
|
|
437
|
-
transform: true,
|
|
438
|
-
loadMethod({
|
|
439
|
-
$table,
|
|
440
|
-
row
|
|
441
|
-
}) {
|
|
442
|
-
// 模拟后台接口
|
|
443
|
-
return new Promise((resolve, reject) => {
|
|
444
|
-
let treeNodeParam = opts.treeNodeParam ? (opts.treeNodeParam(row) || {}) : {
|
|
445
|
-
parent: row.id
|
|
446
|
-
};
|
|
447
|
-
that.$http({
|
|
448
|
-
url: opts.treeNodeUrl,
|
|
449
|
-
method: 'post',
|
|
450
|
-
data: treeNodeParam,
|
|
451
|
-
callback: res => {
|
|
452
|
-
if (res.type == "success") {
|
|
453
|
-
resolve(res.objx || []);
|
|
454
|
-
} else {
|
|
455
|
-
reject(res);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
result = configUtil.extendDeeply(defaultOptions, config);
|
|
465
|
-
return result;
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
function getTableJson(tableName, that, success) {
|
|
469
|
-
if (configUtil.tableConfig.disableTableName) return false;
|
|
470
|
-
if (!tableName) return;
|
|
471
|
-
var url = '/user/table_column/getTableJson';
|
|
472
|
-
var data = {
|
|
473
|
-
tableName: tableName
|
|
474
|
-
};
|
|
475
|
-
var json = null;
|
|
476
|
-
return that.$http({
|
|
477
|
-
url: url,
|
|
478
|
-
method: 'post',
|
|
479
|
-
data: data,
|
|
480
|
-
success: success
|
|
481
|
-
});
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
function addTableJson(that, tableName, columns, success) {
|
|
485
|
-
if (configUtil.tableConfig.disableTableName) return false;
|
|
486
|
-
if (!tableName) return;
|
|
487
|
-
let saveColumn = [];
|
|
488
|
-
columns.forEach(function(item, index) {
|
|
489
|
-
saveColumn.push({
|
|
490
|
-
field: item.field || item.property,
|
|
491
|
-
title: item.title,
|
|
492
|
-
visible: item.visible,
|
|
493
|
-
width: item.renderWidth || item.width,
|
|
494
|
-
});
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
var url = '/user/table_column/addTableJson';
|
|
498
|
-
var data = {
|
|
499
|
-
tableName: tableName,
|
|
500
|
-
json: encodeURIComponent(JSON.stringify(saveColumn))
|
|
501
|
-
};
|
|
502
|
-
that.$http({
|
|
503
|
-
url: url,
|
|
504
|
-
method: 'post',
|
|
505
|
-
data: data,
|
|
506
|
-
success: success
|
|
507
|
-
});
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
function initColumn(oldColumns, syncColumns) {
|
|
511
|
-
let newColumns = [];
|
|
512
|
-
if (syncColumns) {
|
|
513
|
-
let fields = [];
|
|
514
|
-
syncColumns.forEach(function(syncColumn) {
|
|
515
|
-
let field = syncColumn.field;
|
|
516
|
-
if (field) {
|
|
517
|
-
oldColumns.some(function(oldColumn) {
|
|
518
|
-
let flag = oldColumn.field === field;
|
|
519
|
-
if (flag) {
|
|
520
|
-
oldColumn.visible = syncColumn.visible;
|
|
521
|
-
if (syncColumn.width) oldColumn.width = syncColumn.width;
|
|
522
|
-
newColumns.push(oldColumn);
|
|
523
|
-
fields.push(field);
|
|
524
|
-
}
|
|
525
|
-
return flag;
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
oldColumns.forEach(function(oldColumn, index) {
|
|
530
|
-
let field = oldColumn.field;
|
|
531
|
-
if (field) {
|
|
532
|
-
if (!fields.includes(field)) {
|
|
533
|
-
newColumns.splice(index, 0, oldColumn);
|
|
534
|
-
}
|
|
535
|
-
} else {
|
|
536
|
-
newColumns.splice(index, 0, oldColumn);
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
} else {
|
|
540
|
-
newColumns = oldColumns;
|
|
541
|
-
}
|
|
542
|
-
return newColumns;
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
/* function initColumn2(oldColumns, syncColumns) {
|
|
546
|
-
if (syncColumns) {
|
|
547
|
-
syncColumns.forEach(function(syncColumn, index1) {
|
|
548
|
-
let field = syncColumn.field;
|
|
549
|
-
var oldIndex = null;
|
|
550
|
-
if (field) {
|
|
551
|
-
oldColumns.every(function(oldColumn, index2) {
|
|
552
|
-
let flag = true;
|
|
553
|
-
if (oldColumn.field === field) {
|
|
554
|
-
oldIndex = index2;
|
|
555
|
-
flag = false;
|
|
556
|
-
}
|
|
557
|
-
return flag;
|
|
558
|
-
});
|
|
559
|
-
if (oldIndex != null) {
|
|
560
|
-
if (index1 != oldIndex) {
|
|
561
|
-
let lsColum = oldColumns.splice(oldIndex, 1)[0];
|
|
562
|
-
lsColum.visible = syncColumn.visible;
|
|
563
|
-
if (syncColumn.width) lsColum.width = syncColumn.width,
|
|
564
|
-
oldColumns.splice(index1, 0, lsColum);
|
|
565
|
-
} else {
|
|
566
|
-
oldColumns[index1].visible = syncColumn.visible;
|
|
567
|
-
if (syncColumn.width) oldColumns[index1].width = syncColumn.width;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
return oldColumns;
|
|
574
|
-
}; */
|
|
575
|
-
|
|
576
|
-
function onColumnWitchChange(option) {
|
|
577
|
-
var that = option.$grid.$parent;
|
|
578
|
-
var $grid = option.$grid;
|
|
579
|
-
var originOption = $grid.originOption;
|
|
580
|
-
let tableName = originOption.tableName;
|
|
581
|
-
if (tableName) {
|
|
582
|
-
// let columns = $grid.columns;
|
|
583
|
-
const {
|
|
584
|
-
fullColumn,
|
|
585
|
-
tableColumn
|
|
586
|
-
} = $grid.getTableColumn();
|
|
587
|
-
addTableJson(that, tableName, fullColumn);
|
|
588
|
-
}
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
function customHandle(option) {
|
|
592
|
-
if (option.type == "confirm" || option.type == "reset") {
|
|
593
|
-
let that = option.$grid.$parent;
|
|
594
|
-
let $grid = option.$grid;
|
|
595
|
-
var originOption = $grid.originOption;
|
|
596
|
-
let tableName = originOption.tableName;
|
|
597
|
-
// $grid.columns = originOption.columns;
|
|
598
|
-
if (tableName) {
|
|
599
|
-
const {
|
|
600
|
-
fullColumn,
|
|
601
|
-
tableColumn
|
|
602
|
-
} = $grid.getTableColumn();
|
|
603
|
-
addTableJson(that, tableName, fullColumn);
|
|
604
|
-
}
|
|
605
|
-
if (option && option.$event && option.$event.preventDefault) {
|
|
606
|
-
option.$event.preventDefault(); // 取消事件的默认行为
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
function changeSelectCount(checked) {
|
|
612
|
-
var checkedLength = checked.records.length;
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
function getTableData(that, tableRef, type, success) {
|
|
616
|
-
if (configUtil.tableConfig.disableTableName) return false;
|
|
617
|
-
var $grid = getGrid(that, tableRef);
|
|
618
|
-
var tableName = $grid.tableName;
|
|
619
|
-
var url = "/user/table_column/getTableData";
|
|
620
|
-
var param = {
|
|
621
|
-
tableName: tableName,
|
|
622
|
-
type: type
|
|
623
|
-
};
|
|
624
|
-
var data = null;
|
|
625
|
-
return that.$http({
|
|
626
|
-
async: false,
|
|
627
|
-
url: url,
|
|
628
|
-
method: "post",
|
|
629
|
-
data: param,
|
|
630
|
-
success: success
|
|
631
|
-
});
|
|
632
|
-
};
|
|
633
|
-
|
|
634
|
-
function addTableData(that, tableRef, value, success) {
|
|
635
|
-
if (configUtil.tableConfig.disableTableName) return false;
|
|
636
|
-
var $grid = getGrid(that, tableRef);
|
|
637
|
-
var tableName = $grid.tableName;
|
|
638
|
-
if (tableName) {
|
|
639
|
-
that.$http({
|
|
640
|
-
method: "post",
|
|
641
|
-
url: "/user/table_column/addTableData",
|
|
642
|
-
data: {
|
|
643
|
-
tableName: tableName,
|
|
644
|
-
type: "isQueryAllPage",
|
|
645
|
-
data: value,
|
|
646
|
-
success: success
|
|
647
|
-
},
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
function checkQueryTotal(that, tableRef, value) {
|
|
653
|
-
var $grid = getGrid(that, tableRef);
|
|
654
|
-
$grid.isQueryAllPage = value;
|
|
655
|
-
var tableName = $grid.tableName;
|
|
656
|
-
var option = $grid.getProxyInfo();
|
|
657
|
-
var config = $grid.pagerConfig;
|
|
658
|
-
$grid.pagerConfig.layouts = getPagerConfigLayouts(value);
|
|
659
|
-
addTableData(that, tableRef, value);
|
|
660
|
-
$grid.commitProxy('query');
|
|
661
|
-
};
|
|
662
|
-
|
|
663
|
-
function getPagerConfigLayouts(value) {
|
|
664
|
-
return ['PrevPage', 'JumpNumber', 'NextPage'];
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
function getCellValue(obj) {
|
|
668
|
-
let {
|
|
669
|
-
column,
|
|
670
|
-
$table
|
|
671
|
-
} = obj;
|
|
672
|
-
let params = createParams(obj);
|
|
673
|
-
let h = $table.$createElement;
|
|
674
|
-
let that = $table.$xegrid.originOption.vue;
|
|
675
|
-
|
|
676
|
-
let cellValue;
|
|
677
|
-
if (column.slots && column.slots.filterVal) {
|
|
678
|
-
cellValue = column.slots.filterVal(params);
|
|
679
|
-
} else {
|
|
680
|
-
let result = column.renderCell(h, params);
|
|
681
|
-
cellValue = vNodeRender(result);
|
|
682
|
-
}
|
|
683
|
-
return cellValue + '';
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
function createParams(obj) {
|
|
687
|
-
let $xetable = obj.$table;
|
|
688
|
-
let {
|
|
689
|
-
column,
|
|
690
|
-
row
|
|
691
|
-
} = obj;
|
|
692
|
-
let fixedType = $xetable.$refs.tableBody.fixedType,
|
|
693
|
-
afterFullData = $xetable.afterFullData,
|
|
694
|
-
tableData = $xetable.tableData;
|
|
695
|
-
var columnIndex = $xetable.getColumnIndex(column);
|
|
696
|
-
let items = tableData;
|
|
697
|
-
|
|
698
|
-
var _columnIndex = $xetable.getVTColumnIndex(column);
|
|
699
|
-
|
|
700
|
-
let overflowX = $xetable.overflowX;
|
|
701
|
-
var fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
|
|
702
|
-
|
|
703
|
-
let tableColumn = $xetable.tableColumn,
|
|
704
|
-
scrollXLoad = $xetable.scrollXLoad,
|
|
705
|
-
scrollYLoad = $xetable.scrollYLoad,
|
|
706
|
-
allColumnOverflow = $xetable.showOverflow,
|
|
707
|
-
isAllOverflow = $xetable.isAllOverflow,
|
|
708
|
-
mergeList = $xetable.mergeList,
|
|
709
|
-
spanMethod = $xetable.spanMethod,
|
|
710
|
-
keyboardConfig = $xetable.keyboardConfig,
|
|
711
|
-
keyboardOpts = $xetable.keyboardOpts,
|
|
712
|
-
fixedColumn = $xetable.$refs.tableBody.fixedColumn,
|
|
713
|
-
visibleColumn = $xetable.visibleColumn;
|
|
714
|
-
|
|
715
|
-
if (obj.tableColumn == null) {
|
|
716
|
-
if (fixedType) {
|
|
717
|
-
if (scrollXLoad || scrollYLoad || (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
|
|
718
|
-
if (!mergeList.length && !spanMethod && !(keyboardConfig && keyboardOpts.isMerge)) {
|
|
719
|
-
tableColumn = fixedColumn;
|
|
720
|
-
} else {
|
|
721
|
-
tableColumn = visibleColumn; // 检查固定列是否被合并,合并范围是否超出固定列
|
|
722
|
-
// if (mergeList.length && !isMergeLeftFixedExceeded && fixedType === 'left') {
|
|
723
|
-
// tableColumn = fixedColumn
|
|
724
|
-
// } else if (mergeList.length && !isMergeRightFixedExceeded && fixedType === 'right') {
|
|
725
|
-
// tableColumn = fixedColumn
|
|
726
|
-
// } else {
|
|
727
|
-
// tableColumn = visibleColumn
|
|
728
|
-
// }
|
|
729
|
-
}
|
|
730
|
-
} else {
|
|
731
|
-
tableColumn = visibleColumn;
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
} else {
|
|
735
|
-
tableColumn = obj.tableColumn;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
var rowid = $xetable.getRowid(row);
|
|
739
|
-
let fullAllDataRowIdData = $xetable.fullAllDataRowIdData;
|
|
740
|
-
var rest = fullAllDataRowIdData[rowid];
|
|
741
|
-
var rowLevel = rest ? rest.level : 0;
|
|
742
|
-
var seq = rest ? rest.seq : -1;
|
|
743
|
-
var renderType = 'body';
|
|
744
|
-
|
|
745
|
-
let $rowIndex = obj.$rowIndex;
|
|
746
|
-
if ($rowIndex == null) {
|
|
747
|
-
tableData.some(function(item, index) {
|
|
748
|
-
let flag = rowid == $xetable.getRowid(item);
|
|
749
|
-
if (flag) {
|
|
750
|
-
$rowIndex = index;
|
|
751
|
-
}
|
|
752
|
-
return flag;
|
|
753
|
-
})
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
let $columnIndex = obj.$columnIndex;
|
|
757
|
-
if ($columnIndex == null) {
|
|
758
|
-
tableColumn.some(function(item, index) {
|
|
759
|
-
let flag = column.id == item.id;
|
|
760
|
-
if (flag) {
|
|
761
|
-
$columnIndex = index;
|
|
762
|
-
}
|
|
763
|
-
return flag;
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
var _rowIndex = $xetable.getVTRowIndex(row); // 确保任何情况下 rowIndex 都精准指向真实 data 索引
|
|
768
|
-
var rowIndex = $xetable.getRowIndex(row); // 事件绑定
|
|
769
|
-
var params = {
|
|
770
|
-
$table: $xetable,
|
|
771
|
-
seq: seq,
|
|
772
|
-
rowid: rowid,
|
|
773
|
-
row: row,
|
|
774
|
-
rowIndex: rowIndex,
|
|
775
|
-
$rowIndex: $rowIndex,
|
|
776
|
-
_rowIndex: _rowIndex,
|
|
777
|
-
column: column,
|
|
778
|
-
columnIndex: columnIndex,
|
|
779
|
-
$columnIndex: $columnIndex,
|
|
780
|
-
_columnIndex: _columnIndex,
|
|
781
|
-
fixed: fixedType,
|
|
782
|
-
type: renderType,
|
|
783
|
-
isHidden: fixedHiddenColumn,
|
|
784
|
-
level: rowLevel,
|
|
785
|
-
visibleData: afterFullData,
|
|
786
|
-
data: tableData,
|
|
787
|
-
items: items
|
|
788
|
-
};
|
|
789
|
-
return params;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
function vNodeRender(vNodes) {
|
|
793
|
-
if (vNodes == null) {
|
|
794
|
-
return null;
|
|
795
|
-
}
|
|
796
|
-
let type = typeof(vNodes);
|
|
797
|
-
if (type == 'string' || type == 'number') {
|
|
798
|
-
return vNodes;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
let loop = function(item) {
|
|
802
|
-
if (item && item.children && item.children.length > 0) {
|
|
803
|
-
let arr = [];
|
|
804
|
-
item.children.forEach(child => {
|
|
805
|
-
let text = loop(child);
|
|
806
|
-
if (text != null) {
|
|
807
|
-
arr.push(text);
|
|
808
|
-
}
|
|
809
|
-
});
|
|
810
|
-
return arr.join('');
|
|
811
|
-
} else {
|
|
812
|
-
if (item.text != null) {
|
|
813
|
-
return item.text;
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
let contents = [];
|
|
819
|
-
let TempSoltConstructor = configUtil.Vue.extend(configUtil.CellSlot);
|
|
820
|
-
let instance = new TempSoltConstructor();
|
|
821
|
-
vNodes.forEach(vNode => {
|
|
822
|
-
if (vNode.componentOptions) {
|
|
823
|
-
instance.$slots.default = vNode;
|
|
824
|
-
instance.$mount();
|
|
825
|
-
let cellValue = '';
|
|
826
|
-
if (vNode.componentInstance && vNode.componentInstance.$el) {
|
|
827
|
-
cellValue = domRender(vNode.componentInstance.$el);
|
|
828
|
-
}
|
|
829
|
-
contents.push(cellValue);
|
|
830
|
-
} else {
|
|
831
|
-
if (vNode && vNode.children && vNode.children.length > 0) {
|
|
832
|
-
let text = loop(vNode);
|
|
833
|
-
if (text != null) {
|
|
834
|
-
contents.push(text);
|
|
835
|
-
}
|
|
836
|
-
} else {
|
|
837
|
-
if (vNode.text != null) {
|
|
838
|
-
contents.push(vNode.text);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
});
|
|
843
|
-
return contents.join('').trim();
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
function groupDomRender(dom) {
|
|
847
|
-
let contents = [];
|
|
848
|
-
let loop = function(item) {
|
|
849
|
-
if (item && item.children && item.children.length > 0) {
|
|
850
|
-
let arr = [];
|
|
851
|
-
Array.from(item.children).forEach(child => {
|
|
852
|
-
let text = loop(child);
|
|
853
|
-
if (text != null) {
|
|
854
|
-
arr.push(text);
|
|
855
|
-
}
|
|
856
|
-
});
|
|
857
|
-
return arr.join('');
|
|
858
|
-
} else {
|
|
859
|
-
var style = window.getComputedStyle(item); //el即DOM元素
|
|
860
|
-
let classList = Array.from(item.classList);
|
|
861
|
-
if (style.display === 'none') {} else if (item.nodeName == "INPUT") {
|
|
862
|
-
if (item.type == 'radio') {
|
|
863
|
-
if (item.checked && classList.includes("el-radio__original")) {
|
|
864
|
-
let value = item.parentNode.parentNode.innerText || '';
|
|
865
|
-
if (value) {
|
|
866
|
-
contents.push(value);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
} else if (item.type == 'checkbox') {
|
|
870
|
-
if (item.checked && classList.includes("el-checkbox__original")) {
|
|
871
|
-
let value = item.parentNode.parentNode.innerText || '';
|
|
872
|
-
if (value) {
|
|
873
|
-
contents.push(value);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
loop(dom);
|
|
881
|
-
return contents.join(",");
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
function selectGroupRender(dom) {
|
|
885
|
-
let ul = dom.querySelector(".el-select-dropdown__list");
|
|
886
|
-
if (ul) {
|
|
887
|
-
let lis = ul.children;
|
|
888
|
-
if (lis) {
|
|
889
|
-
return Array.from(lis).filter(li => {
|
|
890
|
-
let classList = Array.from(li.classList);
|
|
891
|
-
return classList.includes("selected");
|
|
892
|
-
}).map(li => {
|
|
893
|
-
return li.innerText;
|
|
894
|
-
}).join(",");
|
|
895
|
-
} else {
|
|
896
|
-
return '';
|
|
897
|
-
}
|
|
898
|
-
} else {
|
|
899
|
-
return '';
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
function domRender(dom) {
|
|
904
|
-
let loop = function(item) {
|
|
905
|
-
var style = window.getComputedStyle(item); //el即DOM元素
|
|
906
|
-
let role = item.getAttribute("role");
|
|
907
|
-
let classList = Array.from(item.classList);
|
|
908
|
-
|
|
909
|
-
if (style.display === 'none') {
|
|
910
|
-
return '';
|
|
911
|
-
} else if (role == "group") {
|
|
912
|
-
return groupDomRender(item);
|
|
913
|
-
} else if (role == "radiogroup") {
|
|
914
|
-
return groupDomRender(item);
|
|
915
|
-
} else if (classList.includes('el-select') && item['@@clickoutsideContext']) {
|
|
916
|
-
return selectGroupRender(item);
|
|
917
|
-
} else if (item && item.children && item.children.length > 0) {
|
|
918
|
-
let arr = [];
|
|
919
|
-
Array.from(item.children).forEach(child => {
|
|
920
|
-
let text = loop(child);
|
|
921
|
-
if (text != null) {
|
|
922
|
-
arr.push(text);
|
|
923
|
-
}
|
|
924
|
-
});
|
|
925
|
-
return arr.join('');
|
|
926
|
-
} else {
|
|
927
|
-
if (item.nodeName == "INPUT") {
|
|
928
|
-
return item.value;
|
|
929
|
-
} else if (item.innerText != null && item.innerText != '') {
|
|
930
|
-
return item.innerText;
|
|
931
|
-
} else {
|
|
932
|
-
return "";
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
let res = loop(dom).trim();
|
|
937
|
-
return res;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
modules = {
|
|
941
|
-
initVxeTable,
|
|
942
|
-
columnDrop,
|
|
943
|
-
initOption,
|
|
944
|
-
getTableJson,
|
|
945
|
-
addTableJson,
|
|
946
|
-
onColumnWitchChange,
|
|
947
|
-
customHandle,
|
|
948
|
-
changeSelectCount,
|
|
949
|
-
getTableData,
|
|
950
|
-
addTableData,
|
|
951
|
-
checkQueryTotal,
|
|
952
|
-
getCellValue,
|
|
953
|
-
createParams
|
|
954
|
-
};
|
|
955
|
-
|
|
956
|
-
if (!configUtil.Vue.prototype.$vxeTableUtil) configUtil.Vue.prototype.$vxeTableUtil = modules;
|
|
957
|
-
|
|
958
|
-
export default modules;
|