tianheng-ui 0.0.92 → 0.0.93
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 +8 -8
- package/package.json +1 -1
- package/packages/FormMaking/GenerateForm.vue +32 -1
- package/packages/FormMaking/GenerateFormItem.vue +23 -27
- package/packages/FormMaking/custom/config.js +28 -32
- package/packages/FormMaking/custom/configs/button.vue +29 -1
- package/packages/FormMaking/custom/configs/cascader.vue +12 -19
- package/packages/FormMaking/custom/configs/checkbox.vue +18 -21
- package/packages/FormMaking/custom/configs/radio.vue +19 -23
- package/packages/FormMaking/custom/configs/select.vue +17 -25
- package/packages/FormMaking/custom/configs/upload.vue +20 -0
- package/packages/FormMaking/custom/items/upload.vue +25 -6
- package/packages/FormMaking/index.vue +33 -8
- package/packages/TableMaking/generateTable.vue +169 -84
- package/packages/TableMaking/util/index.js +4 -3
package/package.json
CHANGED
@@ -59,12 +59,19 @@
|
|
59
59
|
</template>
|
60
60
|
|
61
61
|
<script>
|
62
|
+
import * as Axios from "lib/theme-chalk/js/axios";
|
62
63
|
import GenetateFormItem from "./GenerateFormItem";
|
63
64
|
|
64
65
|
export default {
|
65
66
|
name: "thFormGenerate",
|
66
67
|
components: { GenetateFormItem },
|
67
68
|
props: {
|
69
|
+
oauthConfig: {
|
70
|
+
type: Object,
|
71
|
+
default: () => {
|
72
|
+
return {};
|
73
|
+
}
|
74
|
+
},
|
68
75
|
data: {
|
69
76
|
type: Object,
|
70
77
|
default: () => {
|
@@ -95,7 +102,8 @@ export default {
|
|
95
102
|
return {
|
96
103
|
formJson: this.data,
|
97
104
|
models: {},
|
98
|
-
componentsData: []
|
105
|
+
componentsData: [],
|
106
|
+
axios: null
|
99
107
|
};
|
100
108
|
},
|
101
109
|
computed: {
|
@@ -124,6 +132,7 @@ export default {
|
|
124
132
|
}
|
125
133
|
},
|
126
134
|
created() {
|
135
|
+
this.axios = Axios.init(this.oauthConfig);
|
127
136
|
this.generateModle(this.formJson.list);
|
128
137
|
},
|
129
138
|
mounted() {},
|
@@ -208,6 +217,28 @@ export default {
|
|
208
217
|
rule.pattern = new RegExp(rule.pattern);
|
209
218
|
}
|
210
219
|
});
|
220
|
+
this.hendleRemoteData(item);
|
221
|
+
},
|
222
|
+
hendleRemoteData(item) {
|
223
|
+
if (!item.options.remote) return;
|
224
|
+
if (item.type === "upload" || item.type === "button") return;
|
225
|
+
|
226
|
+
const remoteFunc = item.options.remoteFunc;
|
227
|
+
this.axios({
|
228
|
+
url: remoteFunc.api,
|
229
|
+
method: remoteFunc.method,
|
230
|
+
headers: remoteFunc.headers,
|
231
|
+
data: { ...remoteFunc.params }
|
232
|
+
}).then(res => {
|
233
|
+
const resultData = res.data.records;
|
234
|
+
item.options.remoteOptions = resultData.map(element => {
|
235
|
+
return {
|
236
|
+
value: element[item.options.props.value || "value"],
|
237
|
+
label: element[item.options.props.label || "label"],
|
238
|
+
children: element[item.options.props.children || "children"]
|
239
|
+
};
|
240
|
+
});
|
241
|
+
});
|
211
242
|
},
|
212
243
|
getData() {
|
213
244
|
return new Promise((resolve, reject) => {
|
@@ -383,21 +383,25 @@
|
|
383
383
|
<template v-if="widget.type == 'upload'">
|
384
384
|
<el-upload
|
385
385
|
class="upload-demo"
|
386
|
-
:action="
|
387
|
-
:
|
388
|
-
|
386
|
+
:action="uploadUrl"
|
387
|
+
:headers="
|
388
|
+
widget.options.remote ? widget.options.remoteFunc.headers : {}
|
389
389
|
"
|
390
|
-
:
|
390
|
+
:data="widget.options.remote ? widget.options.remoteFunc.params : {}"
|
391
391
|
:multiple="widget.options.multiple"
|
392
392
|
:limit="widget.options.length"
|
393
393
|
:width="widget.options.size.width"
|
394
394
|
:height="widget.options.size.height"
|
395
395
|
:list-type="widget.options.listType"
|
396
|
-
:on-change="handleAvatar"
|
397
|
-
:on-error="handleAvatarError"
|
398
396
|
:drag="widget.options.drag"
|
399
397
|
:disabled="widget.options.disabled"
|
400
|
-
:auto-upload="
|
398
|
+
:auto-upload="true"
|
399
|
+
:on-change="handleAvatar"
|
400
|
+
:on-error="handleAvatarError"
|
401
|
+
:on-preview="
|
402
|
+
file => handlePictureCardPreview(file, widget.options.listType)
|
403
|
+
"
|
404
|
+
:on-remove="handleRemove"
|
401
405
|
>
|
402
406
|
<el-button
|
403
407
|
size="small"
|
@@ -725,28 +729,20 @@ export default {
|
|
725
729
|
return `${this.widget.options.labelWidth}px`;
|
726
730
|
|
727
731
|
return "";
|
732
|
+
},
|
733
|
+
uploadUrl() {
|
734
|
+
if (this.widget.options.remote) {
|
735
|
+
const info = sessionStorage.getItem("th_oauth_info");
|
736
|
+
let baseUrl = "";
|
737
|
+
if (info) baseUrl = JSON.parse(info).baseUrl;
|
738
|
+
|
739
|
+
return `${baseUrl}/${this.widget.options.remoteFunc.api}`;
|
740
|
+
} else {
|
741
|
+
return this.widget.options.action;
|
742
|
+
}
|
728
743
|
}
|
729
744
|
},
|
730
|
-
created() {
|
731
|
-
if (this.widget.options.remote) {
|
732
|
-
const remoteData = this.remote[this.widget.model] || [];
|
733
|
-
this.widget.options.remoteOptions = remoteData.map(item => {
|
734
|
-
return {
|
735
|
-
value: item[this.widget.options.props.value],
|
736
|
-
label: item[this.widget.options.props.label],
|
737
|
-
children: item[this.widget.options.props.children]
|
738
|
-
};
|
739
|
-
});
|
740
|
-
}
|
741
|
-
|
742
|
-
if (
|
743
|
-
this.widget.type === "upload" &&
|
744
|
-
this.remote[this.widget.options.remoteFunc]
|
745
|
-
) {
|
746
|
-
const remoteData = this.remote[this.widget.options.remoteFunc] || {};
|
747
|
-
this.widget.options.remoteApi = remoteData;
|
748
|
-
}
|
749
|
-
},
|
745
|
+
created() {},
|
750
746
|
mounted() {
|
751
747
|
this.$nextTick(() => {
|
752
748
|
this.componentsData[this.widget.model] = this.widget;
|
@@ -123,13 +123,14 @@ export const basicComponents = [
|
|
123
123
|
}
|
124
124
|
],
|
125
125
|
required: false,
|
126
|
-
remote: false,
|
127
|
-
remoteOptions: [],
|
128
126
|
props: {
|
129
|
-
value: "
|
130
|
-
label: "
|
127
|
+
value: "id",
|
128
|
+
label: "name",
|
129
|
+
children: "children"
|
131
130
|
},
|
132
|
-
|
131
|
+
remote: false,
|
132
|
+
remoteFunc: {},
|
133
|
+
remoteOptions: [],
|
133
134
|
disabled: false,
|
134
135
|
border: false, //边框
|
135
136
|
buttonType: false //替换成按钮
|
@@ -161,13 +162,14 @@ export const basicComponents = [
|
|
161
162
|
}
|
162
163
|
],
|
163
164
|
required: false,
|
164
|
-
remote: false,
|
165
|
-
remoteOptions: [],
|
166
165
|
props: {
|
167
|
-
value: "
|
168
|
-
label: "
|
166
|
+
value: "id",
|
167
|
+
label: "name",
|
168
|
+
children: "children"
|
169
169
|
},
|
170
|
-
|
170
|
+
remote: false,
|
171
|
+
remoteFunc: {},
|
172
|
+
remoteOptions: [],
|
171
173
|
disabled: false,
|
172
174
|
border: false, //边框
|
173
175
|
buttonType: false, //替换成按钮
|
@@ -265,14 +267,15 @@ export const basicComponents = [
|
|
265
267
|
value: "Option 3"
|
266
268
|
}
|
267
269
|
],
|
268
|
-
remote: false,
|
269
270
|
filterable: false,
|
270
|
-
remoteOptions: [],
|
271
271
|
props: {
|
272
|
-
value: "
|
273
|
-
label: "
|
272
|
+
value: "id",
|
273
|
+
label: "name",
|
274
|
+
children: "children"
|
274
275
|
},
|
275
|
-
|
276
|
+
remote: false,
|
277
|
+
remoteFunc: {},
|
278
|
+
remoteOptions: [],
|
276
279
|
hidden: false,
|
277
280
|
hideLabel: false
|
278
281
|
},
|
@@ -352,9 +355,8 @@ export const basicComponents = [
|
|
352
355
|
buttonCircle: false,
|
353
356
|
buttonIcon: "",
|
354
357
|
textAlign: "center",
|
355
|
-
remoteFunc: "",
|
356
|
-
remoteOption: "",
|
357
358
|
tableColumn: false,
|
359
|
+
remote: false,
|
358
360
|
disabled: false,
|
359
361
|
loading: false,
|
360
362
|
hidden: false,
|
@@ -506,9 +508,9 @@ export const basicComponents = [
|
|
506
508
|
//isDelete: false,
|
507
509
|
min: 0,
|
508
510
|
//isEdit: false,
|
509
|
-
|
511
|
+
remote: false,
|
512
|
+
remoteFunc: {},
|
510
513
|
action: "https://jsonplaceholder.typicode.com/posts/",
|
511
|
-
remoteApi: {},
|
512
514
|
disabled: false,
|
513
515
|
required: false,
|
514
516
|
multiple: false,
|
@@ -546,22 +548,22 @@ export const basicComponents = [
|
|
546
548
|
disabled: false,
|
547
549
|
clearable: false,
|
548
550
|
required: false,
|
549
|
-
remote: true,
|
550
551
|
showAllLevels: false, //只显示最后一级
|
551
552
|
collapseTags: false,
|
552
553
|
filterable: false, //搜索
|
553
554
|
prepend: "",
|
554
555
|
append: "",
|
555
|
-
remoteOptions: [],
|
556
556
|
props: {
|
557
|
-
value: "
|
558
|
-
label: "
|
557
|
+
value: "id",
|
558
|
+
label: "name",
|
559
559
|
children: "children",
|
560
560
|
multiple: false,
|
561
561
|
expandTrigger: "hover",
|
562
562
|
checkStrictly: false //选择任意一级选项
|
563
563
|
},
|
564
|
-
|
564
|
+
remote: true,
|
565
|
+
remoteFunc: {},
|
566
|
+
remoteOptions: [],
|
565
567
|
hidden: false,
|
566
568
|
hideLabel: false
|
567
569
|
},
|
@@ -587,8 +589,6 @@ export const advanceComponents = [
|
|
587
589
|
validator: "",
|
588
590
|
paging: false,
|
589
591
|
pageSize: 5,
|
590
|
-
remoteFunc: "",
|
591
|
-
remoteOption: "",
|
592
592
|
tableColumn: false,
|
593
593
|
hidden: false,
|
594
594
|
hideLabel: false,
|
@@ -618,8 +618,6 @@ export const advanceComponents = [
|
|
618
618
|
validator: "",
|
619
619
|
paging: false,
|
620
620
|
pageSize: 5,
|
621
|
-
remoteFunc: "",
|
622
|
-
remoteOption: "",
|
623
621
|
tableColumn: false,
|
624
622
|
hidden: false,
|
625
623
|
hideLabel: false,
|
@@ -659,8 +657,8 @@ export const advanceComponents = [
|
|
659
657
|
isLabelWidth: false,
|
660
658
|
hideLabel: true,
|
661
659
|
remote: false,
|
662
|
-
remoteFunc:
|
663
|
-
remoteOption:
|
660
|
+
remoteFunc: {},
|
661
|
+
remoteOption: [],
|
664
662
|
tableColumn: false
|
665
663
|
},
|
666
664
|
rules: []
|
@@ -732,8 +730,6 @@ export const layoutComponents = [
|
|
732
730
|
isLabelWidth: false,
|
733
731
|
hideLabel: true,
|
734
732
|
contentPosition: "left",
|
735
|
-
remoteFunc: "",
|
736
|
-
remoteOption: "",
|
737
733
|
tableColumn: false
|
738
734
|
},
|
739
735
|
rules: []
|
@@ -87,7 +87,35 @@
|
|
87
87
|
<span class="title">动作设置</span>
|
88
88
|
<span class="value" @click="handleEventsShow">配置</span>
|
89
89
|
</div>
|
90
|
-
|
90
|
+
|
91
|
+
<el-radio-group
|
92
|
+
style="margin-bottom:10px;"
|
93
|
+
v-model="widget.options.remote"
|
94
|
+
size="mini"
|
95
|
+
>
|
96
|
+
<el-radio-button :label="false">自定义事件</el-radio-button>
|
97
|
+
<el-radio-button :label="true">绑定接口</el-radio-button>
|
98
|
+
</el-radio-group>
|
99
|
+
|
100
|
+
<div v-show="widget.options.remote">
|
101
|
+
<el-select
|
102
|
+
style="width:100%"
|
103
|
+
v-model="widget.options.remoteFunc"
|
104
|
+
value-key="api"
|
105
|
+
placeholder="请选择远端方法"
|
106
|
+
clearable
|
107
|
+
>
|
108
|
+
<el-option
|
109
|
+
v-for="item in remoteApis"
|
110
|
+
:key="item.api"
|
111
|
+
:label="item.name"
|
112
|
+
:value="item"
|
113
|
+
>
|
114
|
+
</el-option>
|
115
|
+
</el-select>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<el-collapse v-show="!widget.options.remote" class="eventsCollapse">
|
91
119
|
<el-collapse-item
|
92
120
|
v-for="event in Object.keys(widget.events)"
|
93
121
|
:key="event"
|
@@ -64,34 +64,27 @@
|
|
64
64
|
<el-select
|
65
65
|
style="width:100%"
|
66
66
|
v-model="widget.options.remoteFunc"
|
67
|
+
value-key="api"
|
67
68
|
placeholder="请选择远端方法"
|
69
|
+
clearable
|
68
70
|
>
|
69
|
-
<el-option
|
70
|
-
v-for="
|
71
|
-
:key="
|
72
|
-
:label="
|
71
|
+
<el-option
|
72
|
+
v-for="item in remoteApis"
|
73
|
+
:key="item.api"
|
74
|
+
:label="item.name"
|
75
|
+
:value="item"
|
73
76
|
>
|
74
|
-
|
75
|
-
v-for="item in group.options"
|
76
|
-
:key="item.value"
|
77
|
-
:label="item.label"
|
78
|
-
:value="item.value"
|
79
|
-
>
|
80
|
-
</el-option>
|
81
|
-
</el-option-group>
|
77
|
+
</el-option>
|
82
78
|
</el-select>
|
79
|
+
|
83
80
|
<el-input v-model="widget.options.props.value">
|
84
|
-
<
|
81
|
+
<div slot="prepend" style="width:50px;">值</div>
|
85
82
|
</el-input>
|
86
83
|
<el-input v-model="widget.options.props.label">
|
87
|
-
<
|
88
|
-
<div style="width:50px">标签</div></template
|
89
|
-
>
|
84
|
+
<div slot="prepend" style="width:50px;">标签</div>
|
90
85
|
</el-input>
|
91
86
|
<el-input v-model="widget.options.props.children">
|
92
|
-
<
|
93
|
-
<div style="width:50px">子选项</div></template
|
94
|
-
>
|
87
|
+
<div slot="prepend" style="width:50px">子选项</div>
|
95
88
|
</el-input>
|
96
89
|
</el-form-item>
|
97
90
|
|
@@ -60,39 +60,36 @@
|
|
60
60
|
<el-radio-button :label="true">远端数据</el-radio-button>
|
61
61
|
</el-radio-group>
|
62
62
|
|
63
|
-
<
|
64
|
-
|
63
|
+
<div v-if="!widget.options.remote">
|
64
|
+
<span>显示标签</span>
|
65
|
+
<el-switch v-model="widget.options.showLabel"> </el-switch>
|
66
|
+
</div>
|
65
67
|
</div>
|
66
68
|
<template v-if="widget.options.remote">
|
67
69
|
<el-select
|
68
|
-
style="width:100
|
70
|
+
style="width:100%"
|
69
71
|
v-model="widget.options.remoteFunc"
|
72
|
+
value-key="api"
|
70
73
|
placeholder="请选择远端方法"
|
74
|
+
clearable
|
71
75
|
>
|
72
|
-
<el-option
|
73
|
-
v-for="
|
74
|
-
:key="
|
75
|
-
:label="
|
76
|
+
<el-option
|
77
|
+
v-for="item in remoteApis"
|
78
|
+
:key="item.api"
|
79
|
+
:label="item.name"
|
80
|
+
:value="item"
|
76
81
|
>
|
77
|
-
|
78
|
-
v-for="item in group.options"
|
79
|
-
:key="item.value"
|
80
|
-
:label="item.label"
|
81
|
-
:value="item.value"
|
82
|
-
>
|
83
|
-
</el-option>
|
84
|
-
</el-option-group>
|
82
|
+
</el-option>
|
85
83
|
</el-select>
|
86
84
|
|
87
85
|
<el-input v-model="widget.options.props.value">
|
88
|
-
<
|
89
|
-
<div style="width:30px;">值</div>
|
90
|
-
</template>
|
86
|
+
<div slot="prepend" style="width:50px;">值</div>
|
91
87
|
</el-input>
|
92
88
|
<el-input v-model="widget.options.props.label">
|
93
|
-
<
|
94
|
-
|
95
|
-
|
89
|
+
<div slot="prepend" style="width:50px;">标签</div>
|
90
|
+
</el-input>
|
91
|
+
<el-input v-model="widget.options.props.children">
|
92
|
+
<div slot="prepend" style="width:50px">子选项</div>
|
96
93
|
</el-input>
|
97
94
|
</template>
|
98
95
|
<template v-else>
|
@@ -44,41 +44,37 @@
|
|
44
44
|
<el-radio-button :label="true">远端数据</el-radio-button>
|
45
45
|
</el-radio-group>
|
46
46
|
|
47
|
-
<
|
48
|
-
|
47
|
+
<div v-if="!widget.options.remote">
|
48
|
+
<span>显示标签</span>
|
49
|
+
<el-switch v-model="widget.options.showLabel"> </el-switch>
|
50
|
+
</div>
|
49
51
|
</div>
|
50
52
|
|
51
53
|
<template v-if="widget.options.remote">
|
52
54
|
<el-select
|
53
|
-
style="width:100
|
55
|
+
style="width:100%"
|
54
56
|
v-model="widget.options.remoteFunc"
|
57
|
+
value-key="api"
|
55
58
|
placeholder="请选择远端方法"
|
56
59
|
clearable
|
57
60
|
>
|
58
|
-
<el-option
|
59
|
-
v-for="
|
60
|
-
:key="
|
61
|
-
:label="
|
61
|
+
<el-option
|
62
|
+
v-for="item in remoteApis"
|
63
|
+
:key="item.api"
|
64
|
+
:label="item.name"
|
65
|
+
:value="item"
|
62
66
|
>
|
63
|
-
|
64
|
-
v-for="item in group.options"
|
65
|
-
:key="item.value"
|
66
|
-
:label="item.label"
|
67
|
-
:value="item.value"
|
68
|
-
>
|
69
|
-
</el-option>
|
70
|
-
</el-option-group>
|
67
|
+
</el-option>
|
71
68
|
</el-select>
|
72
69
|
|
73
|
-
<el-input
|
74
|
-
<
|
75
|
-
|
76
|
-
|
70
|
+
<el-input v-model="widget.options.props.value">
|
71
|
+
<div slot="prepend" style="width:50px;">值</div>
|
72
|
+
</el-input>
|
73
|
+
<el-input v-model="widget.options.props.label">
|
74
|
+
<div slot="prepend" style="width:50px;">标签</div>
|
77
75
|
</el-input>
|
78
|
-
<el-input
|
79
|
-
<
|
80
|
-
<div style="width:30px;">标签</div>
|
81
|
-
</template>
|
76
|
+
<el-input v-model="widget.options.props.children">
|
77
|
+
<div slot="prepend" style="width:50px">子选项</div>
|
82
78
|
</el-input>
|
83
79
|
</template>
|
84
80
|
<template v-else>
|
@@ -41,44 +41,36 @@
|
|
41
41
|
<el-radio-button :label="true">远端数据</el-radio-button>
|
42
42
|
</el-radio-group>
|
43
43
|
|
44
|
-
<
|
45
|
-
|
44
|
+
<div v-if="!widget.options.remote">
|
45
|
+
<span>显示标签</span>
|
46
|
+
<el-switch v-model="widget.options.showLabel"> </el-switch>
|
47
|
+
</div>
|
46
48
|
</div>
|
47
49
|
<template v-if="widget.options.remote">
|
48
50
|
<el-select
|
49
51
|
style="width:100%"
|
50
52
|
v-model="widget.options.remoteFunc"
|
53
|
+
value-key="api"
|
51
54
|
placeholder="请选择远端方法"
|
55
|
+
clearable
|
52
56
|
>
|
53
|
-
<el-option
|
54
|
-
v-for="
|
55
|
-
:key="
|
56
|
-
:label="
|
57
|
+
<el-option
|
58
|
+
v-for="item in remoteApis"
|
59
|
+
:key="item.api"
|
60
|
+
:label="item.name"
|
61
|
+
:value="item"
|
57
62
|
>
|
58
|
-
|
59
|
-
v-for="item in group.options"
|
60
|
-
:key="item.value"
|
61
|
-
:label="item.label"
|
62
|
-
:value="item.value"
|
63
|
-
>
|
64
|
-
</el-option>
|
65
|
-
</el-option-group>
|
63
|
+
</el-option>
|
66
64
|
</el-select>
|
67
|
-
<!-- <el-input
|
68
|
-
v-model="widget.options.remoteFunc"
|
69
|
-
placeholder="请输入远端方法"
|
70
|
-
>
|
71
|
-
</el-input> -->
|
72
65
|
|
73
66
|
<el-input v-model="widget.options.props.value">
|
74
|
-
<
|
75
|
-
<div style="width:30px;">值</div>
|
76
|
-
</template>
|
67
|
+
<div slot="prepend" style="width:50px;">值</div>
|
77
68
|
</el-input>
|
78
69
|
<el-input v-model="widget.options.props.label">
|
79
|
-
<
|
80
|
-
|
81
|
-
|
70
|
+
<div slot="prepend" style="width:50px;">标签</div>
|
71
|
+
</el-input>
|
72
|
+
<el-input v-model="widget.options.props.children">
|
73
|
+
<div slot="prepend" style="width:50px">子选项</div>
|
82
74
|
</el-input>
|
83
75
|
</template>
|
84
76
|
<template v-else>
|
@@ -65,7 +65,27 @@
|
|
65
65
|
</el-form-item>
|
66
66
|
|
67
67
|
<el-form-item label="上传地址" :required="true">
|
68
|
+
<el-radio-group v-model="widget.options.remote" size="mini">
|
69
|
+
<el-radio-button :label="false">静态接口</el-radio-button>
|
70
|
+
<el-radio-button :label="true">远端接口</el-radio-button>
|
71
|
+
</el-radio-group>
|
72
|
+
<el-select
|
73
|
+
v-if="widget.options.remote"
|
74
|
+
style="width:100%"
|
75
|
+
v-model="widget.options.remoteFunc"
|
76
|
+
value-key="api"
|
77
|
+
placeholder="请选择远端方法"
|
78
|
+
>
|
79
|
+
<el-option
|
80
|
+
v-for="item in remoteApis"
|
81
|
+
:key="item.api"
|
82
|
+
:label="item.name"
|
83
|
+
:value="item"
|
84
|
+
>
|
85
|
+
</el-option>
|
86
|
+
</el-select>
|
68
87
|
<el-input
|
88
|
+
v-else
|
69
89
|
v-model.number="widget.options.action"
|
70
90
|
placeholder="请输入上传地址"
|
71
91
|
></el-input>
|
@@ -1,19 +1,22 @@
|
|
1
1
|
<template>
|
2
2
|
<div>
|
3
3
|
<el-upload
|
4
|
-
:action="
|
5
|
-
:
|
6
|
-
|
7
|
-
"
|
8
|
-
:on-remove="handleRemove"
|
4
|
+
:action="uploadUrl"
|
5
|
+
:headers="widget.options.remote ? widget.options.remoteFunc.headers : {}"
|
6
|
+
:data="widget.options.remote ? widget.options.remoteFunc.params : {}"
|
9
7
|
:multiple="widget.options.multiple"
|
10
8
|
:limit="widget.options.length"
|
11
9
|
:list-type="widget.options.listType"
|
12
10
|
:file-list="widget.options.defaultValue"
|
13
11
|
:drag="widget.options.drag"
|
12
|
+
:disabled="widget.options.disabled"
|
14
13
|
:on-change="handleAvatar"
|
14
|
+
:on-success="handleSuccess"
|
15
15
|
:on-error="handleAvatarError"
|
16
|
-
:
|
16
|
+
:on-preview="
|
17
|
+
file => handlePictureCardPreview(file, widget.options.listType)
|
18
|
+
"
|
19
|
+
:on-remove="handleRemove"
|
17
20
|
>
|
18
21
|
<el-button
|
19
22
|
v-if="
|
@@ -60,7 +63,23 @@ export default {
|
|
60
63
|
dialogImageUrl: ""
|
61
64
|
};
|
62
65
|
},
|
66
|
+
computed: {
|
67
|
+
uploadUrl() {
|
68
|
+
if (this.widget.options.remote) {
|
69
|
+
const info = sessionStorage.getItem("th_oauth_info");
|
70
|
+
let baseUrl = "";
|
71
|
+
if (info) baseUrl = JSON.parse(info).baseUrl;
|
72
|
+
|
73
|
+
return `${baseUrl}${this.widget.options.remoteFunc.api}`;
|
74
|
+
} else {
|
75
|
+
return this.widget.options.action;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
63
79
|
methods: {
|
80
|
+
handleSuccess(res) {
|
81
|
+
console.log("handleSuccess =>", res);
|
82
|
+
},
|
64
83
|
handlePictureCardPreview(file, listType) {
|
65
84
|
if (listType === "picture-card") {
|
66
85
|
this.dialogImageUrl = file.url;
|