tianheng-ui 0.1.11 → 0.1.14
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/theme-chalk/js/axios.js +3 -2
- package/lib/theme-chalk/js/util.js +23 -0
- package/lib/theme-chalk/styles/feature.scss +15 -0
- package/lib/tianheng-ui.js +13 -14
- package/package.json +1 -1
- package/packages/FormMaking/GenerateForm.vue +6 -1
- package/packages/FormMaking/GenerateFormItem.vue +9 -5
- package/packages/FormMaking/GenerateFormItemH5.vue +1 -1
- package/packages/FormMaking/WidgetConfig.vue +39 -51
- package/packages/FormMaking/WidgetForm.vue +9 -10
- package/packages/FormMaking/WidgetFormItem.vue +2 -2
- package/packages/FormMaking/WidgetSelect.vue +0 -1
- package/packages/FormMaking/WidgetTools.vue +539 -0
- package/packages/FormMaking/config/index.js +6 -0
- package/packages/FormMaking/custom/config.js +21 -24
- package/packages/FormMaking/custom/configs/button.vue +25 -25
- package/packages/FormMaking/custom/configs/cascader.vue +7 -7
- package/packages/FormMaking/custom/configs/checkbox.vue +23 -22
- package/packages/FormMaking/custom/configs/color.vue +3 -3
- package/packages/FormMaking/custom/configs/date.vue +3 -3
- package/packages/FormMaking/custom/configs/input.vue +3 -3
- package/packages/FormMaking/custom/configs/number.vue +3 -3
- package/packages/FormMaking/custom/configs/radio.vue +23 -19
- package/packages/FormMaking/custom/configs/rate.vue +3 -3
- package/packages/FormMaking/custom/configs/select.vue +25 -20
- package/packages/FormMaking/custom/configs/slider.vue +3 -3
- package/packages/FormMaking/custom/configs/switch.vue +3 -3
- package/packages/FormMaking/custom/configs/tabs.vue +12 -17
- package/packages/FormMaking/custom/configs/textarea.vue +3 -3
- package/packages/FormMaking/custom/configs/time.vue +3 -3
- package/packages/FormMaking/custom/configs/upload.vue +5 -5
- package/packages/FormMaking/custom/items/button.vue +35 -1
- package/packages/FormMaking/custom/items/checkbox.vue +1 -1
- package/packages/FormMaking/custom/items/date.vue +1 -0
- package/packages/FormMaking/custom/items/grid_dev.vue +3 -3
- package/packages/FormMaking/custom/items/tableH5_dev.vue +3 -3
- package/packages/FormMaking/custom/items/table_dev.vue +3 -3
- package/packages/FormMaking/custom/items/tabs_dev.vue +3 -3
- package/packages/FormMaking/custom/mixins/index.js +12 -12
- package/packages/FormMaking/index.vue +93 -469
- package/packages/FormMaking/styles/index.scss +1 -21
- package/packages/FormMaking/util/index.js +24 -0
- package/packages/FormMaking/util/request.js +9 -12
- package/packages/TableMaking/WidgetTools.vue +246 -0
- package/packages/TableMaking/custom/config.js +110 -0
- package/packages/TableMaking/generateTable.vue +2 -2
- package/packages/TableMaking/index.vue +62 -157
- package/packages/TableMaking/util/index.js +54 -1
- package/packages/TableMaking/widgetConfig.vue +261 -178
- package/packages/TableMaking/widgetTable.vue +16 -46
- package/packages/index.js +5 -4
package/package.json
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
:prop="item.type === 'grid' ? '' : item.model"
|
23
23
|
:componentsData="componentsData"
|
24
24
|
@input-change="onInputChange"
|
25
|
+
@button-submit="handleButtonSubmit"
|
25
26
|
>
|
26
27
|
<template v-for="name in slotKeys" :slot="name">
|
27
28
|
<slot :name="name" />
|
@@ -132,6 +133,7 @@ export default {
|
|
132
133
|
}
|
133
134
|
},
|
134
135
|
created() {
|
136
|
+
localStorage.setItem("_TH_OauthConfig", JSON.stringify(this.oauthConfig));
|
135
137
|
this.axios = Axios.init(this.oauthConfig);
|
136
138
|
this.generateModle(this.formJson.list);
|
137
139
|
},
|
@@ -225,7 +227,7 @@ export default {
|
|
225
227
|
|
226
228
|
const remoteFunc = item.options.remoteFunc;
|
227
229
|
this.axios({
|
228
|
-
url: remoteFunc.
|
230
|
+
url: remoteFunc.url,
|
229
231
|
method: remoteFunc.method,
|
230
232
|
headers: remoteFunc.headers,
|
231
233
|
data: { ...remoteFunc.params }
|
@@ -240,6 +242,9 @@ export default {
|
|
240
242
|
});
|
241
243
|
});
|
242
244
|
},
|
245
|
+
handleButtonSubmit(val){
|
246
|
+
this.$emit("button-submit", val);
|
247
|
+
},
|
243
248
|
getData() {
|
244
249
|
return new Promise((resolve, reject) => {
|
245
250
|
this.$refs.generateForm.validate(valid => {
|
@@ -28,6 +28,7 @@
|
|
28
28
|
:prop="prop"
|
29
29
|
:slotKeys="slotKeys"
|
30
30
|
:componentsData="componentsData"
|
31
|
+
@button-submit="handleButtonSubmit"
|
31
32
|
></component>
|
32
33
|
|
33
34
|
<!-- <template v-if="widget.type == 'input'">
|
@@ -169,7 +170,7 @@
|
|
169
170
|
</template>
|
170
171
|
|
171
172
|
<script>
|
172
|
-
import { inputTypeDict } from "./util/index";
|
173
|
+
import { inputTypeDict, deepClone } from "./util/index";
|
173
174
|
import { VueEditor } from "vue2-editor";
|
174
175
|
import compsData from "./custom/register";
|
175
176
|
import FmUpload from "./Upload";
|
@@ -188,7 +189,7 @@ export default {
|
|
188
189
|
components: { FmUpload, VueEditor },
|
189
190
|
data() {
|
190
191
|
return {
|
191
|
-
compsData:
|
192
|
+
compsData: deepClone(compsData),
|
192
193
|
dataModel: this.models[this.widget.model],
|
193
194
|
dialogVisible: false,
|
194
195
|
dialogImageUrl: ""
|
@@ -227,7 +228,7 @@ export default {
|
|
227
228
|
let baseUrl = "";
|
228
229
|
if (info) baseUrl = JSON.parse(info).baseUrl;
|
229
230
|
|
230
|
-
return `${baseUrl}/${this.widget.options.remoteFunc.
|
231
|
+
return `${baseUrl}/${this.widget.options.remoteFunc.url}`;
|
231
232
|
} else {
|
232
233
|
return this.widget.options.action;
|
233
234
|
}
|
@@ -311,6 +312,9 @@ export default {
|
|
311
312
|
handleTableDelete(index) {
|
312
313
|
this.dataModel.splice(index, 1);
|
313
314
|
},
|
315
|
+
handleButtonSubmit(val) {
|
316
|
+
this.$emit("button-submit", val);
|
317
|
+
},
|
314
318
|
|
315
319
|
// 支撑 JavaScript 动态编译
|
316
320
|
handleEventAction(key) {
|
@@ -320,7 +324,7 @@ export default {
|
|
320
324
|
for (let i = 0; i < eventScript.length; i++) {
|
321
325
|
const element = eventScript[i];
|
322
326
|
if (element.key === key) {
|
323
|
-
const func = `(item,value)=>{${element.
|
327
|
+
const func = `(item,value)=>{${element.value}}`;
|
324
328
|
eval(func)(this.widget, this.dataModel);
|
325
329
|
}
|
326
330
|
}
|
@@ -367,7 +371,7 @@ export default {
|
|
367
371
|
}
|
368
372
|
},
|
369
373
|
// 获取数据,仅支持获取当前组件节点下的数据
|
370
|
-
getData() {
|
374
|
+
getData(obj) {
|
371
375
|
return this.models;
|
372
376
|
}
|
373
377
|
}
|
@@ -774,7 +774,7 @@ export default {
|
|
774
774
|
for (let i = 0; i < eventScript.length; i++) {
|
775
775
|
const element = eventScript[i];
|
776
776
|
if (element.key === key) {
|
777
|
-
const func = `(item,value)=>{${element.
|
777
|
+
const func = `(item,value)=>{${element.value}}`;
|
778
778
|
eval(func)(this.widget, this.dataModel);
|
779
779
|
}
|
780
780
|
}
|
@@ -31,7 +31,6 @@
|
|
31
31
|
<component
|
32
32
|
:widget="data"
|
33
33
|
:config="config"
|
34
|
-
:remoteApis="remoteApis"
|
35
34
|
:is="compsData[data.type].content"
|
36
35
|
@events-show="handleEventDialogShow"
|
37
36
|
@events-edit="handleEventsCollapseClick"
|
@@ -45,9 +44,13 @@
|
|
45
44
|
>
|
46
45
|
<div class="eventsSetting">
|
47
46
|
<div class="list">
|
48
|
-
<div class="list-header"
|
47
|
+
<div class="list-header">
|
49
48
|
<div>动作库</div>
|
50
|
-
<el-button
|
49
|
+
<el-button
|
50
|
+
type="text"
|
51
|
+
icon="el-icon-plus"
|
52
|
+
size="mini"
|
53
|
+
@click="handleAddEvent"
|
51
54
|
>添加</el-button
|
52
55
|
>
|
53
56
|
</div>
|
@@ -58,9 +61,9 @@
|
|
58
61
|
@click="eventsDialog.active = item"
|
59
62
|
>
|
60
63
|
<div class="list-item-title">Function</div>
|
61
|
-
<div class="list-item-value">{{ item.
|
64
|
+
<div class="list-item-value">{{ item.label }}</div>
|
62
65
|
<el-popconfirm
|
63
|
-
:title="`是否确定删除方法 ${item.
|
66
|
+
:title="`是否确定删除方法 ${item.label}`"
|
64
67
|
confirm-button-text="删除"
|
65
68
|
confirm-button-type="danger"
|
66
69
|
@confirm="handleEventDialogDelete(item, index)"
|
@@ -73,12 +76,12 @@
|
|
73
76
|
<div>
|
74
77
|
<span>Function Name</span>
|
75
78
|
<el-input
|
76
|
-
v-model="eventsDialog.active.
|
79
|
+
v-model="eventsDialog.active.label"
|
77
80
|
placeholder="请输入动作名称"
|
78
81
|
size="small"
|
79
82
|
:disabled="
|
80
|
-
eventsDialog.active.
|
81
|
-
eventsDialog.active.
|
83
|
+
eventsDialog.active.label === 'mounted' ||
|
84
|
+
eventsDialog.active.label === 'refresh'
|
82
85
|
"
|
83
86
|
></el-input>
|
84
87
|
</div>
|
@@ -86,8 +89,8 @@
|
|
86
89
|
<div>
|
87
90
|
function(
|
88
91
|
{{
|
89
|
-
eventsDialog.active.
|
90
|
-
eventsDialog.active.
|
92
|
+
eventsDialog.active.label !== "mounted" &&
|
93
|
+
eventsDialog.active.label !== "refresh"
|
91
94
|
? "item,value"
|
92
95
|
: ""
|
93
96
|
}}
|
@@ -104,17 +107,21 @@
|
|
104
107
|
slot="reference"
|
105
108
|
class="el-icon-question"
|
106
109
|
></i>
|
107
|
-
<div
|
108
|
-
<div
|
109
|
-
|
110
|
-
|
111
|
-
|
110
|
+
<div>
|
111
|
+
<div
|
112
|
+
style="display: flex;justify-content: space-between;"
|
113
|
+
v-for="item in aceCompletions"
|
114
|
+
:key="item.caption"
|
115
|
+
>
|
116
|
+
<div>{{ item.caption }}</div>
|
117
|
+
<div>{{ item.meta }}</div>
|
118
|
+
</div>
|
112
119
|
</div>
|
113
120
|
</el-popover>
|
114
121
|
</div>
|
115
122
|
<th-code-editor
|
116
123
|
style="height:calc(100% - 48px)"
|
117
|
-
v-model="eventsDialog.active.
|
124
|
+
v-model="eventsDialog.active.value"
|
118
125
|
:completions="aceCompletions"
|
119
126
|
ref="codeEditor"
|
120
127
|
></th-code-editor>
|
@@ -135,6 +142,7 @@
|
|
135
142
|
</template>
|
136
143
|
|
137
144
|
<script>
|
145
|
+
import { deepClone } from "./util/index";
|
138
146
|
import compsData from "./custom/register";
|
139
147
|
export default {
|
140
148
|
props: {
|
@@ -144,12 +152,6 @@ export default {
|
|
144
152
|
return {};
|
145
153
|
}
|
146
154
|
},
|
147
|
-
remoteApis: {
|
148
|
-
type: Array,
|
149
|
-
default: () => {
|
150
|
-
return [];
|
151
|
-
}
|
152
|
-
},
|
153
155
|
config: {
|
154
156
|
type: Object,
|
155
157
|
default: () => {
|
@@ -159,7 +161,7 @@ export default {
|
|
159
161
|
},
|
160
162
|
data() {
|
161
163
|
return {
|
162
|
-
compsData:
|
164
|
+
compsData: deepClone(compsData),
|
163
165
|
validator: {
|
164
166
|
type: null,
|
165
167
|
required: null,
|
@@ -196,6 +198,12 @@ export default {
|
|
196
198
|
caption: "hide",
|
197
199
|
value: "hide([ ])",
|
198
200
|
score: 1
|
201
|
+
},
|
202
|
+
{
|
203
|
+
meta: "跳转页面",
|
204
|
+
caption: "goPage",
|
205
|
+
value: "goPage({path:'',query:{}})",
|
206
|
+
score: 1
|
199
207
|
}
|
200
208
|
]
|
201
209
|
};
|
@@ -317,16 +325,16 @@ export default {
|
|
317
325
|
handleEventDialogShow() {
|
318
326
|
this.eventsDialog = {
|
319
327
|
visible: true,
|
320
|
-
eventScript:
|
328
|
+
eventScript: deepClone(this.config.eventScript),
|
321
329
|
active: null
|
322
330
|
};
|
323
331
|
},
|
324
332
|
handleAddEvent() {
|
325
333
|
const key = new Date().getTime();
|
326
334
|
const dic = {
|
327
|
-
|
328
|
-
|
329
|
-
|
335
|
+
id: key,
|
336
|
+
label: key,
|
337
|
+
value: ""
|
330
338
|
};
|
331
339
|
this.eventsDialog.eventScript.push(dic);
|
332
340
|
this.eventsDialog.active = dic;
|
@@ -365,30 +373,15 @@ export default {
|
|
365
373
|
}
|
366
374
|
},
|
367
375
|
handleTypeChange(val) {
|
368
|
-
const config =
|
376
|
+
const config = deepClone(this.compsData[val].config);
|
369
377
|
this.$emit("update", config);
|
370
378
|
}
|
371
379
|
}
|
372
380
|
};
|
373
381
|
</script>
|
374
382
|
|
375
|
-
<style lang="
|
383
|
+
<style lang="scss" scoped>
|
376
384
|
.widgetConfig {
|
377
|
-
.remoteApis {
|
378
|
-
width: 100%;
|
379
|
-
margin-bottom: 6px;
|
380
|
-
|
381
|
-
/deep/ .el-input--prefix .el-input__inner {
|
382
|
-
padding-left: 85px;
|
383
|
-
}
|
384
|
-
|
385
|
-
/deep/ .el-input__prefix {
|
386
|
-
left: 0;
|
387
|
-
width: 75px;
|
388
|
-
color: #999;
|
389
|
-
}
|
390
|
-
}
|
391
|
-
|
392
385
|
.el-dialog__body {
|
393
386
|
padding: 20px;
|
394
387
|
}
|
@@ -453,7 +446,7 @@ export default {
|
|
453
446
|
margin-bottom: 20px;
|
454
447
|
padding-left: 10px;
|
455
448
|
|
456
|
-
|
449
|
+
.el-input {
|
457
450
|
flex: 1;
|
458
451
|
margin-left: 10px;
|
459
452
|
}
|
@@ -483,16 +476,11 @@ export default {
|
|
483
476
|
.selectableRange {
|
484
477
|
width: 100%;
|
485
478
|
|
486
|
-
|
479
|
+
.el-range-separator {
|
487
480
|
width: 20px;
|
488
481
|
}
|
489
482
|
}
|
490
483
|
|
491
|
-
.functions {
|
492
|
-
span {
|
493
|
-
margin: 0 5px;
|
494
|
-
}
|
495
|
-
}
|
496
484
|
.flexView {
|
497
485
|
display: flex;
|
498
486
|
align-items: center;
|
@@ -44,6 +44,7 @@
|
|
44
44
|
</template>
|
45
45
|
|
46
46
|
<script>
|
47
|
+
import { deepClone } from "./util/index";
|
47
48
|
import Draggable from "vuedraggable";
|
48
49
|
import WidgetFormItem from "./WidgetFormItem.vue";
|
49
50
|
|
@@ -99,18 +100,16 @@ export default {
|
|
99
100
|
},
|
100
101
|
handleWidgetAdd(evt) {
|
101
102
|
const newIndex = evt.newIndex;
|
102
|
-
|
103
|
-
|
103
|
+
let newComponent = deepClone(this.data.list[newIndex]);
|
104
104
|
//为拖拽到容器的元素添加唯一 key
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
this.$set(this.data.list, newIndex, dic);
|
105
|
+
if (!newComponent.key) {
|
106
|
+
const key =
|
107
|
+
Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
|
108
|
+
newComponent.key = key;
|
109
|
+
newComponent.model = newComponent.type + "_" + key;
|
110
|
+
}
|
113
111
|
|
112
|
+
this.$set(this.data.list, newIndex, newComponent);
|
114
113
|
this.selectWidget = this.data.list[newIndex];
|
115
114
|
}
|
116
115
|
}
|
@@ -50,6 +50,7 @@
|
|
50
50
|
</template>
|
51
51
|
|
52
52
|
<script>
|
53
|
+
import { deepClone } from "./util/index";
|
53
54
|
import compsData from "./custom/register";
|
54
55
|
import Draggable from "vuedraggable";
|
55
56
|
import FmUpload from "./Upload";
|
@@ -59,7 +60,7 @@ export default {
|
|
59
60
|
components: { Draggable, FmUpload },
|
60
61
|
data() {
|
61
62
|
return {
|
62
|
-
compsData:
|
63
|
+
compsData: deepClone(compsData),
|
63
64
|
selectWidget: this.select
|
64
65
|
};
|
65
66
|
},
|
@@ -130,7 +131,6 @@ export default {
|
|
130
131
|
)}`;
|
131
132
|
|
132
133
|
item.key = key;
|
133
|
-
item.options.remoteFunc = `func__${key}`;
|
134
134
|
item.model = `${item.type}_${key}`;
|
135
135
|
|
136
136
|
if (["table", "tableH5"].includes(item.type)) {
|