tianheng-ui 0.0.72 → 0.0.74
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/lib/tianheng-ui.js +12 -12
- package/package.json +1 -1
- package/packages/Dialog/index.vue +2 -2
- package/packages/FormMaking/Container.vue +37 -42
- package/packages/FormMaking/WidgetConfig.vue +96 -97
- package/packages/FormMaking/index.js +1 -1
- package/packages/FormMaking/making.js +1 -1
- package/packages/FormMaking/styles/index.scss +4 -0
- package/packages/TableMaking/custom/configs/fieldSearch.vue +17 -0
- package/packages/TableMaking/custom/configs/fieldTable.vue +15 -0
- package/packages/TableMaking/index.vue +126 -0
- package/packages/TableMaking/making.js +5 -0
- package/packages/TableMaking/widgetConfig.vue +263 -0
- package/packages/TableMaking/widgetTable.vue +240 -0
- package/packages/index.js +4 -0
package/package.json
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
<el-button
|
42
42
|
v-if="showAffirm"
|
43
43
|
type="primary"
|
44
|
-
:loading="
|
44
|
+
:loading="affirmLoading"
|
45
45
|
@click="handleAffirm"
|
46
46
|
>{{ affirmText }}</el-button
|
47
47
|
>
|
@@ -61,7 +61,6 @@ export default {
|
|
61
61
|
},
|
62
62
|
props: {
|
63
63
|
visible: Boolean,
|
64
|
-
loading: Boolean,
|
65
64
|
title: { type: String, default: "" },
|
66
65
|
width: { type: String, default: "800px" },
|
67
66
|
fullscreen: { type: Boolean, default: false },
|
@@ -76,6 +75,7 @@ export default {
|
|
76
75
|
destroyOnClose: { type: Boolean, default: false },
|
77
76
|
|
78
77
|
showAffirm: { type: Boolean, default: true },
|
78
|
+
affirmLoading: Boolean,
|
79
79
|
affirmText: { type: String, default: "确 认" },
|
80
80
|
|
81
81
|
showCancel: { type: Boolean, default: true },
|
@@ -117,6 +117,7 @@
|
|
117
117
|
style="margin:0 10px;"
|
118
118
|
>
|
119
119
|
<el-button
|
120
|
+
v-if="tools.includes('upload')"
|
120
121
|
type="text"
|
121
122
|
size="medium"
|
122
123
|
icon="el-icon-upload2"
|
@@ -131,12 +132,9 @@
|
|
131
132
|
:show-file-list="false"
|
132
133
|
:on-change="onExcelFileChange"
|
133
134
|
>
|
134
|
-
<el-button
|
135
|
-
>导入EXCEL
|
136
|
-
</el-button>
|
135
|
+
<el-button type="text" size="medium">导入EXCEL </el-button>
|
137
136
|
</el-upload>
|
138
137
|
<el-button
|
139
|
-
v-if="upload"
|
140
138
|
type="text"
|
141
139
|
size="medium"
|
142
140
|
@click="dialog.import.visible = true"
|
@@ -146,7 +144,7 @@
|
|
146
144
|
</el-popover>
|
147
145
|
|
148
146
|
<el-button
|
149
|
-
v-if="clearable"
|
147
|
+
v-if="tools.includes('clearable')"
|
150
148
|
type="text"
|
151
149
|
size="medium"
|
152
150
|
icon="el-icon-delete"
|
@@ -154,7 +152,7 @@
|
|
154
152
|
>清空
|
155
153
|
</el-button>
|
156
154
|
<el-button
|
157
|
-
v-if="preview"
|
155
|
+
v-if="tools.includes('preview')"
|
158
156
|
type="text"
|
159
157
|
size="medium"
|
160
158
|
icon="el-icon-view"
|
@@ -162,7 +160,7 @@
|
|
162
160
|
>预览
|
163
161
|
</el-button>
|
164
162
|
<el-button
|
165
|
-
v-if="generateJson"
|
163
|
+
v-if="tools.includes('generateJson')"
|
166
164
|
type="text"
|
167
165
|
size="medium"
|
168
166
|
icon="el-icon-tickets"
|
@@ -170,7 +168,7 @@
|
|
170
168
|
>生成JSON</el-button
|
171
169
|
>
|
172
170
|
<el-button
|
173
|
-
v-if="generateCode"
|
171
|
+
v-if="tools.includes('generateCode')"
|
174
172
|
type="text"
|
175
173
|
size="medium"
|
176
174
|
icon="el-icon-document"
|
@@ -368,8 +366,6 @@ import WidgetConfig from "./WidgetConfig";
|
|
368
366
|
import FormConfig from "./FormConfig";
|
369
367
|
import WidgetForm from "./WidgetForm";
|
370
368
|
import GenerateForm from "./GenerateForm";
|
371
|
-
import ThDialog from "ui/Dialog/index.vue";
|
372
|
-
import ThCodeEditor from "ui/CodeEditor/index.vue";
|
373
369
|
import {
|
374
370
|
basicComponents,
|
375
371
|
advanceComponents,
|
@@ -387,30 +383,26 @@ export default {
|
|
387
383
|
WidgetConfig,
|
388
384
|
FormConfig,
|
389
385
|
WidgetForm,
|
390
|
-
GenerateForm
|
391
|
-
ThDialog,
|
392
|
-
ThCodeEditor
|
386
|
+
GenerateForm
|
393
387
|
},
|
394
388
|
props: {
|
395
|
-
|
396
|
-
type:
|
397
|
-
default:
|
398
|
-
|
399
|
-
|
400
|
-
type: Boolean,
|
401
|
-
default: false
|
402
|
-
},
|
403
|
-
generateJson: {
|
404
|
-
type: Boolean,
|
405
|
-
default: false
|
406
|
-
},
|
407
|
-
upload: {
|
408
|
-
type: Boolean,
|
409
|
-
default: false
|
389
|
+
data: {
|
390
|
+
type: Object,
|
391
|
+
default: () => {
|
392
|
+
return { list: [], config: baseConfig };
|
393
|
+
}
|
410
394
|
},
|
411
|
-
|
412
|
-
type:
|
413
|
-
default:
|
395
|
+
tools: {
|
396
|
+
type: Array,
|
397
|
+
default: () => {
|
398
|
+
return [
|
399
|
+
"upload",
|
400
|
+
"clearable",
|
401
|
+
"preview",
|
402
|
+
"generateCode",
|
403
|
+
"generateJson"
|
404
|
+
];
|
405
|
+
}
|
414
406
|
},
|
415
407
|
basicFields: {
|
416
408
|
type: Array,
|
@@ -451,15 +443,12 @@ export default {
|
|
451
443
|
}
|
452
444
|
},
|
453
445
|
data() {
|
446
|
+
this.basicComponents = basicComponents;
|
447
|
+
this.layoutComponents = layoutComponents;
|
448
|
+
this.advanceComponents = advanceComponents;
|
454
449
|
return {
|
455
|
-
|
456
|
-
|
457
|
-
advanceComponents,
|
458
|
-
widgetFormSelect: null,
|
459
|
-
widgetFormData: {
|
460
|
-
list: [],
|
461
|
-
config: baseConfig
|
462
|
-
},
|
450
|
+
widgetFormData: this.data,
|
451
|
+
widgetFormSelect: this.data.list[0],
|
463
452
|
widgetValue: {},
|
464
453
|
configTab: "widget",
|
465
454
|
client: "monitor",
|
@@ -521,8 +510,14 @@ export default {
|
|
521
510
|
widgetFormData: {
|
522
511
|
deep: true,
|
523
512
|
handler: function(val) {
|
524
|
-
|
513
|
+
console.log("widgetFormData =>", val);
|
514
|
+
this.$emit("update:data", val);
|
525
515
|
}
|
516
|
+
},
|
517
|
+
data(val) {
|
518
|
+
console.log("data =>", val);
|
519
|
+
this.setJSON(val);
|
520
|
+
// this.widgetFormData = val;
|
526
521
|
}
|
527
522
|
},
|
528
523
|
mounted() {},
|
@@ -622,9 +617,9 @@ export default {
|
|
622
617
|
const data = this.getComponentsConfig("input");
|
623
618
|
let name = titleDom.innerText;
|
624
619
|
if (name.charAt(0) === "*") {
|
625
|
-
name = name.slice(1)
|
620
|
+
name = name.slice(1);
|
626
621
|
data.options.required = true;
|
627
|
-
data.rules = data.rules || []
|
622
|
+
data.rules = data.rules || [];
|
628
623
|
data.rules.push({
|
629
624
|
required: true,
|
630
625
|
message: "单行文本必须填写"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
<div v-if="show">
|
2
|
+
<div class="widgetConfig" v-if="show">
|
3
3
|
<component
|
4
4
|
:widget="data"
|
5
5
|
:config="config"
|
@@ -12,6 +12,7 @@
|
|
12
12
|
<th-dialog
|
13
13
|
title="动作设置"
|
14
14
|
v-model="eventsDialog.visible"
|
15
|
+
:modal-append-to-body="false"
|
15
16
|
@on-fullscreen="$refs.codeEditor && $refs.codeEditor.resize()"
|
16
17
|
>
|
17
18
|
<div class="eventsSetting">
|
@@ -347,127 +348,125 @@ export default {
|
|
347
348
|
</script>
|
348
349
|
|
349
350
|
<style lang="less" scoped>
|
350
|
-
.
|
351
|
-
|
352
|
-
|
351
|
+
.widgetConfig {
|
352
|
+
.remoteApis {
|
353
|
+
width: 100%;
|
354
|
+
margin-bottom: 6px;
|
353
355
|
|
354
|
-
|
355
|
-
|
356
|
-
|
356
|
+
/deep/ .el-input--prefix .el-input__inner {
|
357
|
+
padding-left: 85px;
|
358
|
+
}
|
357
359
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
360
|
+
/deep/ .el-input__prefix {
|
361
|
+
left: 0;
|
362
|
+
width: 75px;
|
363
|
+
color: #999;
|
364
|
+
}
|
362
365
|
}
|
363
|
-
}
|
364
366
|
|
365
|
-
|
366
|
-
|
367
|
-
}
|
368
|
-
|
369
|
-
.el-dialog__body {
|
370
|
-
padding: 20px;
|
371
|
-
}
|
367
|
+
.el-dialog__body {
|
368
|
+
padding: 20px;
|
369
|
+
}
|
372
370
|
|
373
|
-
.eventsSetting {
|
374
|
-
|
375
|
-
|
376
|
-
|
371
|
+
.eventsSetting {
|
372
|
+
height: 100%;
|
373
|
+
display: flex;
|
374
|
+
border: 1px solid #eee;
|
377
375
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
376
|
+
.list {
|
377
|
+
width: 270px;
|
378
|
+
min-height: 430px;
|
379
|
+
overflow-y: overlay;
|
380
|
+
border-right: 1px solid #eee;
|
383
381
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
382
|
+
.list-header {
|
383
|
+
position: sticky;
|
384
|
+
top: 0;
|
385
|
+
display: flex;
|
386
|
+
align-items: center;
|
387
|
+
justify-content: space-between;
|
388
|
+
padding: 5px;
|
389
|
+
line-height: 30px;
|
390
|
+
border-bottom: 1px solid #eee;
|
391
|
+
background: #f2f6fc;
|
392
|
+
}
|
395
393
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
394
|
+
.list-item {
|
395
|
+
display: flex;
|
396
|
+
// align-items: center;
|
397
|
+
margin: 5px;
|
398
|
+
padding: 10px;
|
399
|
+
border-radius: 3px;
|
400
|
+
border: 1px solid #dcdfe6;
|
401
|
+
transition: 0.25s;
|
404
402
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
403
|
+
.list-item-title {
|
404
|
+
color: var(--th-green);
|
405
|
+
}
|
406
|
+
.list-item-value {
|
407
|
+
flex: 1;
|
408
|
+
padding: 0 5px;
|
409
|
+
}
|
410
|
+
i {
|
411
|
+
cursor: pointer;
|
412
|
+
}
|
414
413
|
}
|
415
|
-
}
|
416
414
|
|
417
|
-
|
418
|
-
|
415
|
+
.list-item:hover {
|
416
|
+
background-color: #f2f6fc;
|
417
|
+
}
|
419
418
|
}
|
420
|
-
}
|
421
419
|
|
422
|
-
|
423
|
-
|
424
|
-
|
420
|
+
.detail {
|
421
|
+
flex: 1;
|
422
|
+
padding: 10px;
|
425
423
|
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
424
|
+
> div:nth-child(1) {
|
425
|
+
position: relative;
|
426
|
+
display: flex;
|
427
|
+
align-items: center;
|
428
|
+
margin-bottom: 20px;
|
429
|
+
padding-left: 10px;
|
432
430
|
|
433
|
-
|
434
|
-
|
435
|
-
|
431
|
+
/deep/ .el-input {
|
432
|
+
flex: 1;
|
433
|
+
margin-left: 10px;
|
434
|
+
}
|
436
435
|
}
|
437
|
-
}
|
438
|
-
|
439
|
-
> div:nth-child(1)::after {
|
440
|
-
content: "*";
|
441
|
-
position: absolute;
|
442
|
-
left: 0;
|
443
|
-
color: red;
|
444
|
-
}
|
445
436
|
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
color:
|
437
|
+
> div:nth-child(1)::after {
|
438
|
+
content: "*";
|
439
|
+
position: absolute;
|
440
|
+
left: 0;
|
441
|
+
color: red;
|
451
442
|
}
|
452
443
|
|
453
|
-
> div:nth-child(
|
454
|
-
|
455
|
-
|
444
|
+
> div:nth-child(2) {
|
445
|
+
height: calc(100% - 48px);
|
446
|
+
> div:nth-child(1) {
|
447
|
+
margin-bottom: 10px;
|
448
|
+
color: var(--th-blue);
|
449
|
+
}
|
450
|
+
|
451
|
+
> div:nth-child(3) {
|
452
|
+
margin-top: 10px;
|
453
|
+
color: var(--th-blue);
|
454
|
+
}
|
456
455
|
}
|
457
456
|
}
|
458
457
|
}
|
459
|
-
|
460
|
-
|
461
|
-
width: 100%;
|
458
|
+
.selectableRange {
|
459
|
+
width: 100%;
|
462
460
|
|
463
|
-
|
464
|
-
|
461
|
+
/deep/ .el-range-separator {
|
462
|
+
width: 20px;
|
463
|
+
}
|
465
464
|
}
|
466
|
-
}
|
467
465
|
|
468
|
-
.functions {
|
469
|
-
|
470
|
-
|
466
|
+
.functions {
|
467
|
+
span {
|
468
|
+
margin: 0 5px;
|
469
|
+
}
|
471
470
|
}
|
472
471
|
}
|
473
472
|
</style>
|
@@ -0,0 +1,126 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="th-table-making">
|
3
|
+
<el-container>
|
4
|
+
<el-container>
|
5
|
+
<el-header>
|
6
|
+
<el-button type="text" size="medium" icon="el-icon-delete">
|
7
|
+
桌面端
|
8
|
+
</el-button>
|
9
|
+
<el-button type="text" size="medium" icon="el-icon-delete">
|
10
|
+
移动端
|
11
|
+
</el-button>
|
12
|
+
</el-header>
|
13
|
+
<el-main>
|
14
|
+
<widget-table
|
15
|
+
:searchFields="searchFields"
|
16
|
+
:tableFields="tableFields"
|
17
|
+
@move="handleMoveChange"
|
18
|
+
></widget-table>
|
19
|
+
</el-main>
|
20
|
+
</el-container>
|
21
|
+
<el-aside width="300px">
|
22
|
+
<widget-config
|
23
|
+
:fields="fields"
|
24
|
+
ref="configRef"
|
25
|
+
@fields-change="handleFieldsChange"
|
26
|
+
></widget-config>
|
27
|
+
</el-aside>
|
28
|
+
</el-container>
|
29
|
+
</div>
|
30
|
+
</template>
|
31
|
+
|
32
|
+
<script>
|
33
|
+
import WidgetTable from "./widgetTable.vue";
|
34
|
+
import WidgetConfig from "./widgetConfig.vue";
|
35
|
+
export default {
|
36
|
+
name: "ThTableMaking",
|
37
|
+
components: { WidgetTable, WidgetConfig },
|
38
|
+
props: {
|
39
|
+
fields: {
|
40
|
+
type: Array,
|
41
|
+
default: () => {
|
42
|
+
return [];
|
43
|
+
}
|
44
|
+
}
|
45
|
+
},
|
46
|
+
data() {
|
47
|
+
return {
|
48
|
+
searchFields: [],
|
49
|
+
tableFields: []
|
50
|
+
};
|
51
|
+
},
|
52
|
+
mounted() {},
|
53
|
+
methods: {
|
54
|
+
handleFieldsChange(val) {
|
55
|
+
console.log("handleFieldsChange =>", val);
|
56
|
+
const type = val.type;
|
57
|
+
const data = val.data;
|
58
|
+
const list = [];
|
59
|
+
data.forEach(i => {
|
60
|
+
list.push(JSON.parse(JSON.stringify(this.fields[i])));
|
61
|
+
});
|
62
|
+
if (type === 0) {
|
63
|
+
this.searchFields = list;
|
64
|
+
} else {
|
65
|
+
this.tableFields = list;
|
66
|
+
}
|
67
|
+
},
|
68
|
+
handleMoveChange(val) {
|
69
|
+
console.log("handleMoveChange =>", val);
|
70
|
+
const type = val.type;
|
71
|
+
const data = val.data;
|
72
|
+
const newIndex = data.newIndex;
|
73
|
+
const oldIndex = data.oldIndex;
|
74
|
+
if (type === "search") {
|
75
|
+
let list = this.$refs.configRef.search.fields;
|
76
|
+
list = this.mobile(list, oldIndex, newIndex);
|
77
|
+
this.$refs.configRef.search.fields = list;
|
78
|
+
this.searchFields = this.mobile(this.searchFields, oldIndex, newIndex)
|
79
|
+
} else {
|
80
|
+
let list = this.$refs.configRef.table.fields;
|
81
|
+
list = this.mobile(list, oldIndex, newIndex);
|
82
|
+
this.$refs.configRef.table.fields = list;
|
83
|
+
this.tableFields = this.mobile(this.tableFields, oldIndex, newIndex)
|
84
|
+
}
|
85
|
+
},
|
86
|
+
mobile(list, oldIndex, newIndex) {
|
87
|
+
const item = JSON.parse(JSON.stringify(list[oldIndex]));
|
88
|
+
if (oldIndex < newIndex) {
|
89
|
+
list.splice(newIndex + 1, 0, item);
|
90
|
+
list.splice(oldIndex, 1);
|
91
|
+
}
|
92
|
+
if (oldIndex > newIndex) {
|
93
|
+
list.splice(newIndex, 0, item);
|
94
|
+
list.splice(oldIndex + 1, 1);
|
95
|
+
}
|
96
|
+
return list;
|
97
|
+
},
|
98
|
+
getJson(){}
|
99
|
+
}
|
100
|
+
};
|
101
|
+
</script>
|
102
|
+
|
103
|
+
<style lang="scss" scoped>
|
104
|
+
.th-table-making {
|
105
|
+
height: 100%;
|
106
|
+
background-color: white;
|
107
|
+
border: 1px solid #dcdfe6;
|
108
|
+
|
109
|
+
.el-container {
|
110
|
+
height: 100%;
|
111
|
+
}
|
112
|
+
.el-header {
|
113
|
+
height: 45px !important;
|
114
|
+
line-height: 45px;
|
115
|
+
border-bottom: 1px solid #dcdfe6;
|
116
|
+
}
|
117
|
+
.el-main {
|
118
|
+
padding: 5px;
|
119
|
+
background-color: #fafafa;
|
120
|
+
}
|
121
|
+
.el-aside {
|
122
|
+
border-left: 1px solid #dcdfe6;
|
123
|
+
box-sizing: border-box;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
</style>
|