ol-base-components 2.5.1 → 2.7.0
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/README.md +225 -152
- package/package.json +2 -1
- package/src/App.vue +496 -329
- package/src/api/api.js +30 -44
- package/src/api/run.js +12 -20
- package/src/assets/duojibiaotou.png +0 -0
- package/src/bin/add.js +235 -41
- package/src/bin/initTemplate.js +196 -66
- package/src/package/form/index.js +7 -0
- package/src/package/form/src/index.vue +396 -0
- package/src/package/index.js +4 -2
- package/src/utils/initData.js +84 -0
- package/public/index.js +0 -59941
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ import OlBaseComponents from "ol-base-components"; // 导入组件库
|
|
|
35
35
|
Vue.use(OlBaseComponents);
|
|
36
36
|
|
|
37
37
|
new Vue({
|
|
38
|
-
render:
|
|
38
|
+
render: h => h(App),
|
|
39
39
|
}).$mount("#app");
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -52,11 +52,9 @@ Vue.use(OlBaseComponents);
|
|
|
52
52
|
|
|
53
53
|
//安装,可以在登录
|
|
54
54
|
import { swaggerInstall } from "ol-base-components";
|
|
55
|
-
swaggerInstall("http://192.168.xxx.xxx:20019/swagger/v1/swagger.json").then(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
);
|
|
55
|
+
swaggerInstall("http://192.168.xxx.xxx:20019/swagger/v1/swagger.json").then(() => {
|
|
56
|
+
// 成功获取swagger数据后加载页面, 这里可以写登录接口成功后执行的逻辑
|
|
57
|
+
});
|
|
60
58
|
|
|
61
59
|
// 卸载
|
|
62
60
|
import { swaggerUnload } from "ol-base-components";
|
|
@@ -164,58 +162,58 @@ npx add aaa -p src/view -u /api/app/business-report/stock-bIPaged-result -e /api
|
|
|
164
162
|
</template>
|
|
165
163
|
|
|
166
164
|
<script>
|
|
167
|
-
export default {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
tableSearch: [
|
|
178
|
-
{
|
|
179
|
-
label: "仓库编码",
|
|
180
|
-
value: "WarehouseCode",
|
|
181
|
-
inputType: "text",
|
|
165
|
+
export default {
|
|
166
|
+
data() {
|
|
167
|
+
return {
|
|
168
|
+
formSearchData: {
|
|
169
|
+
reset: true,
|
|
170
|
+
expendShow: false,
|
|
171
|
+
value: {
|
|
172
|
+
WarehouseCode: null,
|
|
173
|
+
WarehouseName: null,
|
|
182
174
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// this.get({
|
|
198
|
-
// url: Basic.getWarehoseList,
|
|
199
|
-
// isLoading: true,
|
|
200
|
-
// data: Object.assign(this.formSearchData.value, {
|
|
201
|
-
// Page: this.paginations.page,
|
|
202
|
-
// MaxResultCount: this.paginations.limit,
|
|
203
|
-
// }),
|
|
204
|
-
// }).then((res) => {
|
|
205
|
-
// this.tableData.rows = res.result.items;
|
|
206
|
-
// this.paginations.total = res.result.totalCount;
|
|
207
|
-
// this.tableData.emptyImg = true;
|
|
208
|
-
// });
|
|
175
|
+
tableSearch: [
|
|
176
|
+
{
|
|
177
|
+
label: "仓库编码",
|
|
178
|
+
value: "WarehouseCode",
|
|
179
|
+
inputType: "text",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
label: "仓库名称",
|
|
183
|
+
value: "WarehouseName",
|
|
184
|
+
inputType: "text",
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
};
|
|
209
189
|
},
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
self.formSearchData.value = { ...from };
|
|
213
|
-
self.paginations.page = 1;
|
|
214
|
-
this.getTable(); // 获取表格数据
|
|
190
|
+
mounted() {
|
|
191
|
+
this.getTable();
|
|
215
192
|
},
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
193
|
+
method: {
|
|
194
|
+
getTable() {
|
|
195
|
+
// this.get({
|
|
196
|
+
// url: Basic.getWarehoseList,
|
|
197
|
+
// isLoading: true,
|
|
198
|
+
// data: Object.assign(this.formSearchData.value, {
|
|
199
|
+
// Page: this.paginations.page,
|
|
200
|
+
// MaxResultCount: this.paginations.limit,
|
|
201
|
+
// }),
|
|
202
|
+
// }).then((res) => {
|
|
203
|
+
// this.tableData.rows = res.result.items;
|
|
204
|
+
// this.paginations.total = res.result.totalCount;
|
|
205
|
+
// this.tableData.emptyImg = true;
|
|
206
|
+
// });
|
|
207
|
+
},
|
|
208
|
+
handleSearch(from) {
|
|
209
|
+
var self = this;
|
|
210
|
+
self.formSearchData.value = { ...from };
|
|
211
|
+
self.paginations.page = 1;
|
|
212
|
+
this.getTable(); // 获取表格数据
|
|
213
|
+
},
|
|
214
|
+
handleReset() {},
|
|
215
|
+
},
|
|
216
|
+
};
|
|
219
217
|
</script>
|
|
220
218
|
```
|
|
221
219
|
|
|
@@ -241,111 +239,109 @@ export default {
|
|
|
241
239
|
@handleindexChange="handleindexChange"
|
|
242
240
|
>
|
|
243
241
|
<template slot="classes" slot-scope="scope">
|
|
244
|
-
<div style="color: #1682e6; cursor: pointer" @click="config(scope)">
|
|
245
|
-
设置
|
|
246
|
-
</div>
|
|
242
|
+
<div style="color: #1682e6; cursor: pointer" @click="config(scope)">设置</div>
|
|
247
243
|
</template>
|
|
248
244
|
</ol-table>
|
|
249
245
|
</div>
|
|
250
246
|
</template>
|
|
251
247
|
|
|
252
248
|
<script>
|
|
253
|
-
export default {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
249
|
+
export default {
|
|
250
|
+
data() {
|
|
251
|
+
return {
|
|
252
|
+
multipleSelection: [],
|
|
253
|
+
tableData: {
|
|
254
|
+
loading: false,
|
|
255
|
+
emptyImg: true,
|
|
256
|
+
options: {
|
|
257
|
+
selection: true, //多选框
|
|
258
|
+
index: null, //序号
|
|
259
|
+
headTool: true, //开启头部工具栏
|
|
260
|
+
refreshBtn: true, //开启表格头部刷新按钮
|
|
261
|
+
downloadBtn: true, //开启表格头部下载按钮
|
|
262
|
+
}, //序号和复选框
|
|
263
|
+
rows: [], //表数据
|
|
264
|
+
columns: [
|
|
265
|
+
{
|
|
266
|
+
label: "",
|
|
267
|
+
minWidth: "",
|
|
268
|
+
type: "selection",
|
|
269
|
+
show: true,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
prop: "warehouseCode",
|
|
273
|
+
label: "仓库编码",
|
|
274
|
+
minWidth: "",
|
|
275
|
+
sortable: false,
|
|
276
|
+
show: true,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
prop: "warehouseName",
|
|
280
|
+
label: "仓库名称",
|
|
281
|
+
minWidth: "",
|
|
282
|
+
sortable: false,
|
|
283
|
+
show: true,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
prop: "enabledDesc",
|
|
287
|
+
label: "状态",
|
|
288
|
+
minWidth: "",
|
|
289
|
+
sortable: false,
|
|
290
|
+
show: true,
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
prop: "createdUser",
|
|
294
|
+
label: "创建人",
|
|
295
|
+
minWidth: "",
|
|
296
|
+
sortable: false,
|
|
297
|
+
show: true,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
prop: "createTime",
|
|
301
|
+
label: "创建时间",
|
|
302
|
+
minWidth: "",
|
|
303
|
+
show: true,
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
prop: "classes",
|
|
307
|
+
label: "班次",
|
|
308
|
+
minWidth: "",
|
|
309
|
+
show: true,
|
|
310
|
+
renderSlot: true,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
prop: "remark",
|
|
314
|
+
label: "备注",
|
|
315
|
+
minWidth: "",
|
|
316
|
+
show: true,
|
|
317
|
+
},
|
|
318
|
+
], //表头
|
|
319
|
+
operates: [], //表格里面的操作按钮
|
|
320
|
+
tableHeightDiff: 300,
|
|
321
|
+
},
|
|
322
|
+
paginations: {
|
|
323
|
+
page: 1, //当前位于那页面
|
|
324
|
+
total: 10, //总数
|
|
325
|
+
limit: 30, //一页显示多少条
|
|
326
|
+
pagetionShow: true,
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
},
|
|
330
|
+
methods: {
|
|
331
|
+
SelectionChange(row) {
|
|
332
|
+
this.multipleSelection = row;
|
|
325
333
|
},
|
|
326
|
-
|
|
327
|
-
page
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
334
|
+
handleSizeChange(val) {
|
|
335
|
+
this.paginations.page = 1;
|
|
336
|
+
this.paginations.limit = val;
|
|
337
|
+
this.getTable();
|
|
338
|
+
},
|
|
339
|
+
handleindexChange(val) {
|
|
340
|
+
this.paginations.page = val;
|
|
341
|
+
this.getTable();
|
|
331
342
|
},
|
|
332
|
-
};
|
|
333
|
-
},
|
|
334
|
-
methods: {
|
|
335
|
-
SelectionChange(row) {
|
|
336
|
-
this.multipleSelection = row;
|
|
337
|
-
},
|
|
338
|
-
handleSizeChange(val) {
|
|
339
|
-
this.paginations.page = 1;
|
|
340
|
-
this.paginations.limit = val;
|
|
341
|
-
this.getTable();
|
|
342
|
-
},
|
|
343
|
-
handleindexChange(val) {
|
|
344
|
-
this.paginations.page = val;
|
|
345
|
-
this.getTable();
|
|
346
343
|
},
|
|
347
|
-
}
|
|
348
|
-
};
|
|
344
|
+
};
|
|
349
345
|
</script>
|
|
350
346
|
```
|
|
351
347
|
|
|
@@ -405,13 +401,90 @@ export default {
|
|
|
405
401
|
url: PublicAggregate.dictionaries,
|
|
406
402
|
fn: this.getTable,
|
|
407
403
|
},
|
|
408
|
-
|
|
404
|
+
}
|
|
409
405
|
};
|
|
410
406
|
},
|
|
411
407
|
};
|
|
412
408
|
</script>
|
|
413
409
|
```
|
|
414
410
|
|
|
411
|
+
# 表格组件多级表头使用说明
|
|
412
|
+
|
|
413
|
+
## 功能简介
|
|
414
|
+
|
|
415
|
+
本表格组件基于 Element-UI,支持:
|
|
416
|
+
|
|
417
|
+
- 多级表头(嵌套 children)
|
|
418
|
+
- 多级表头顺序可通过 `beforeProp` 字段灵活控制
|
|
419
|
+
- 表头字段顺序优先以 `columns` 配置为准,后补充 swagger 字段
|
|
420
|
+
- 目前 `beforeProp` 仅支持多级表头,普通字段暂不支持
|
|
421
|
+
|
|
422
|
+
#### 效果图
|
|
423
|
+
|
|
424
|
+

|
|
425
|
+
|
|
426
|
+
## 1. 多级表头配置方法
|
|
427
|
+
|
|
428
|
+
### 基本结构
|
|
429
|
+
|
|
430
|
+
```js
|
|
431
|
+
tableData: {
|
|
432
|
+
columns: [
|
|
433
|
+
// 普通字段
|
|
434
|
+
{ prop: "unit", show: false },
|
|
435
|
+
// 多级表头
|
|
436
|
+
{
|
|
437
|
+
label: "一级表头",
|
|
438
|
+
beforeProp: "qty", // 该多级表头会插入到 qty 字段之后
|
|
439
|
+
show: true,
|
|
440
|
+
children: [
|
|
441
|
+
{
|
|
442
|
+
label: "二级表头",
|
|
443
|
+
children: [
|
|
444
|
+
{ prop: "creationTime" },
|
|
445
|
+
{ prop: "orginalBillNo" }
|
|
446
|
+
]
|
|
447
|
+
},
|
|
448
|
+
{ prop: "tagNumber" },
|
|
449
|
+
{ prop: "batch" }
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
// 另一个多级表头
|
|
453
|
+
{
|
|
454
|
+
label: "一级表头-1",
|
|
455
|
+
beforeProp: "containerType", // 插入到 containerType 字段之后
|
|
456
|
+
children: [
|
|
457
|
+
{ prop: "regionCode" },
|
|
458
|
+
{ prop: "taskNo" }
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
// ... 其它字段
|
|
462
|
+
],
|
|
463
|
+
rows: [
|
|
464
|
+
// 数据行
|
|
465
|
+
],
|
|
466
|
+
// 其它配置
|
|
467
|
+
}
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### 说明
|
|
471
|
+
|
|
472
|
+
- **多级表头**通过 `children` 字段递归嵌套实现。
|
|
473
|
+
- 每个多级表头对象可包含:
|
|
474
|
+
- `label`:表头名称
|
|
475
|
+
- `beforeProp`:插入到指定字段(prop)之后
|
|
476
|
+
- `show`:是否显示
|
|
477
|
+
- `children`:子表头数组
|
|
478
|
+
- **beforeProp** 仅支持在多级表头对象上设置,用于指定该多级表头插入到哪个字段(prop)之后。
|
|
479
|
+
- 普通字段(非多级表头)暂不支持 `beforeProp`,只能手动在 `columns` 中调整顺序。
|
|
480
|
+
|
|
481
|
+
## 2. 字段顺序规则
|
|
482
|
+
|
|
483
|
+
- 表头字段顺序优先以 `columns` 配置为准。
|
|
484
|
+
- 如果有 swagger 字段未在 `columns` 中出现,会自动补充到表头最后。
|
|
485
|
+
- 多级表头的位置可通过 `beforeProp` 字段灵活调整。
|
|
486
|
+
- 普通字段顺序只能通过手动调整 `columns` 数组顺序实现。
|
|
487
|
+
|
|
415
488
|
## 贡献
|
|
416
489
|
|
|
417
490
|
欢迎任何形式的贡献!如果您有建议或发现问题,请提交 issue 或 pull request。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ol-base-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "src/package/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"element-ui": "^2.15.14",
|
|
22
22
|
"eslint": "^8.57.1",
|
|
23
23
|
"eslint-plugin-vue": "^10.3.0",
|
|
24
|
+
"inquirer": "^8.2.6",
|
|
24
25
|
"swagger-client": "^3.0.1",
|
|
25
26
|
"vue": "^2.6.14"
|
|
26
27
|
},
|