tianheng-ui 0.1.25 → 0.1.28
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/FormMaking/FormConfig.vue +31 -21
- package/packages/FormMaking/GenerateForm.vue +2 -2
- package/packages/FormMaking/WidgetConfig.vue +2 -2
- package/packages/FormMaking/WidgetForm.vue +1 -1
- package/packages/FormMaking/custom/config.js +28 -25
- package/packages/FormMaking/index.vue +62 -29
- package/packages/TableMaking/WidgetTools.vue +3 -2
- package/packages/TableMaking/generateTable.vue +68 -90
- package/packages/TableMaking/index.vue +10 -12
- package/packages/TableMaking/widgetConfig.vue +5 -1
package/package.json
CHANGED
@@ -5,10 +5,12 @@
|
|
5
5
|
label-position="left"
|
6
6
|
label-width="80px"
|
7
7
|
size="small"
|
8
|
+
:rules="formRules"
|
9
|
+
ref="formRef"
|
8
10
|
>
|
9
11
|
<el-collapse v-model="collapseValue">
|
10
12
|
<el-collapse-item title="表单配置" name="group-form">
|
11
|
-
<el-form-item required>
|
13
|
+
<el-form-item prop="fieldsType" required>
|
12
14
|
<el-tooltip
|
13
15
|
slot="label"
|
14
16
|
effect="dark"
|
@@ -22,7 +24,11 @@
|
|
22
24
|
<el-radio-button label="fieldsApi">接口导入</el-radio-button>
|
23
25
|
</el-radio-group>
|
24
26
|
</el-form-item>
|
25
|
-
<el-form-item
|
27
|
+
<el-form-item
|
28
|
+
v-if="config.fieldsType === 'fieldsApi'"
|
29
|
+
prop="fieldsApi"
|
30
|
+
required
|
31
|
+
>
|
26
32
|
<el-tooltip
|
27
33
|
slot="label"
|
28
34
|
effect="dark"
|
@@ -40,7 +46,7 @@
|
|
40
46
|
@change="handleFieldsApiChange"
|
41
47
|
>
|
42
48
|
<el-option
|
43
|
-
v-for="item in
|
49
|
+
v-for="item in apiOptions"
|
44
50
|
:key="item.id"
|
45
51
|
:label="item.label"
|
46
52
|
:value="item.id"
|
@@ -48,7 +54,7 @@
|
|
48
54
|
</el-option>
|
49
55
|
</el-select>
|
50
56
|
</el-form-item>
|
51
|
-
<el-form-item label="表单标题" required>
|
57
|
+
<el-form-item label="表单标题" prop="title" required>
|
52
58
|
<el-input
|
53
59
|
v-model="config.title"
|
54
60
|
placeholder="请输入"
|
@@ -121,7 +127,7 @@
|
|
121
127
|
|
122
128
|
<script>
|
123
129
|
export default {
|
124
|
-
props: ["config"],
|
130
|
+
props: ["config", "apiOptions"],
|
125
131
|
data() {
|
126
132
|
return {
|
127
133
|
collapseValue: [
|
@@ -129,26 +135,30 @@ export default {
|
|
129
135
|
"group-resultData",
|
130
136
|
"group-label",
|
131
137
|
"group-attributes"
|
132
|
-
]
|
138
|
+
],
|
139
|
+
formRules: {
|
140
|
+
fieldsType: [
|
141
|
+
{ required: true, message: "请选择字段类型", trigger: "change" }
|
142
|
+
],
|
143
|
+
fieldsApi: [
|
144
|
+
{ required: true, message: "请选择字段类型", trigger: "change" }
|
145
|
+
],
|
146
|
+
title: [
|
147
|
+
{ required: true, message: "请选择字段类型", trigger: "change" }
|
148
|
+
]
|
149
|
+
}
|
133
150
|
};
|
134
151
|
},
|
135
152
|
methods: {
|
136
|
-
handleFieldsApiChange(
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
label: item.note || item.name,
|
144
|
-
alias: item.name,
|
145
|
-
prop: item.name,
|
146
|
-
type: "input",
|
147
|
-
align: "left"
|
148
|
-
};
|
153
|
+
handleFieldsApiChange() {
|
154
|
+
this.$emit("fieldsChange");
|
155
|
+
},
|
156
|
+
formValidate() {
|
157
|
+
return new Promise((resolve, reject) => {
|
158
|
+
this.$refs.formRef.validate(valid => {
|
159
|
+
resolve(valid);
|
149
160
|
});
|
150
|
-
|
151
|
-
} else this.$emit("fieldsChange", []);
|
161
|
+
});
|
152
162
|
}
|
153
163
|
}
|
154
164
|
};
|
@@ -117,7 +117,7 @@ export default {
|
|
117
117
|
},
|
118
118
|
watch: {
|
119
119
|
config(val) {
|
120
|
-
this.
|
120
|
+
this.setConfig(val);
|
121
121
|
},
|
122
122
|
formJson: {
|
123
123
|
handler(val) {
|
@@ -262,7 +262,7 @@ export default {
|
|
262
262
|
onInputChange(value, field) {
|
263
263
|
this.$emit("on-change", field, value, this.models);
|
264
264
|
},
|
265
|
-
|
265
|
+
setConfig(json) {
|
266
266
|
this.formJson = json;
|
267
267
|
this.generateModle(this.formJson.list);
|
268
268
|
}
|
@@ -66,12 +66,12 @@
|
|
66
66
|
<el-tooltip
|
67
67
|
slot="label"
|
68
68
|
effect="dark"
|
69
|
-
content="
|
69
|
+
content="表单提交时的入参名,对应数据表中的字段,非必要不修改!"
|
70
70
|
placement="top"
|
71
71
|
>
|
72
72
|
<span style="color: #409EFF;">字段标识</span>
|
73
73
|
</el-tooltip>
|
74
|
-
<el-input v-model="data.model"
|
74
|
+
<el-input v-model="data.model"></el-input>
|
75
75
|
</el-form-item>
|
76
76
|
</el-collapse-item>
|
77
77
|
|
@@ -772,29 +772,32 @@ export const layoutComponents = [
|
|
772
772
|
export const templateComponents = [];
|
773
773
|
|
774
774
|
export const baseConfig = {
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
{
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
775
|
+
list: [],
|
776
|
+
config: {
|
777
|
+
fieldsType: "fieldsApi",
|
778
|
+
fieldsApi: "",
|
779
|
+
ui: "element",
|
780
|
+
title: "",
|
781
|
+
width: "",
|
782
|
+
labelWidth: 100,
|
783
|
+
labelPosition: "right",
|
784
|
+
labelSuffix: ":",
|
785
|
+
size: "small",
|
786
|
+
disabled: false,
|
787
|
+
hideLabel: false,
|
788
|
+
mounted: { api: "" },
|
789
|
+
eventScript: [
|
790
|
+
{
|
791
|
+
id: "mounted",
|
792
|
+
label: "mounted",
|
793
|
+
value: ""
|
794
|
+
},
|
795
|
+
{
|
796
|
+
id: "refresh",
|
797
|
+
label: "refresh",
|
798
|
+
value: ""
|
799
|
+
}
|
800
|
+
],
|
801
|
+
network: []
|
802
|
+
}
|
800
803
|
};
|
@@ -158,7 +158,9 @@
|
|
158
158
|
<form-config
|
159
159
|
v-if="configTab == 'form'"
|
160
160
|
:config="formConfig.config"
|
161
|
+
:apiOptions="apiOptions"
|
161
162
|
@fieldsChange="handleFieldsChange"
|
163
|
+
ref="formConfigRef"
|
162
164
|
></form-config>
|
163
165
|
</el-main>
|
164
166
|
</el-container>
|
@@ -196,12 +198,7 @@ export default {
|
|
196
198
|
GenerateForm
|
197
199
|
},
|
198
200
|
props: {
|
199
|
-
config:
|
200
|
-
type: Object,
|
201
|
-
default: () => {
|
202
|
-
return { config: {}, list: [] };
|
203
|
-
}
|
204
|
-
},
|
201
|
+
config: Object,
|
205
202
|
oauthConfig: {
|
206
203
|
type: Object,
|
207
204
|
default: () => {
|
@@ -260,7 +257,7 @@ export default {
|
|
260
257
|
this.layoutComponents = layoutComponents;
|
261
258
|
this.baseConfig = deepClone(baseConfig);
|
262
259
|
return {
|
263
|
-
formConfig: this.
|
260
|
+
formConfig: this.baseConfig,
|
264
261
|
widgetFormSelect: {},
|
265
262
|
widgetValue: {},
|
266
263
|
configTab: "form",
|
@@ -293,27 +290,18 @@ export default {
|
|
293
290
|
deep: true,
|
294
291
|
handler: function(val) {
|
295
292
|
this.$emit("update:config", val);
|
296
|
-
// this.$emit("on-change", val);
|
297
293
|
}
|
298
294
|
},
|
299
295
|
config(val) {
|
300
|
-
|
301
|
-
val.config = Object.assign(this.baseConfig, val.config);
|
302
|
-
}
|
303
|
-
this.setJSON(val);
|
296
|
+
this.setConfig(val);
|
304
297
|
},
|
305
|
-
apiOptions(
|
306
|
-
|
307
|
-
this.formConfig.config.network = val;
|
308
|
-
}
|
298
|
+
apiOptions() {
|
299
|
+
this.handleFieldsChange();
|
309
300
|
}
|
310
301
|
},
|
311
302
|
created() {
|
312
303
|
this.initConfig();
|
313
|
-
this.formConfig
|
314
|
-
this.baseConfig,
|
315
|
-
this.formConfig.config
|
316
|
-
);
|
304
|
+
this.formConfig = Object.assign(this.baseConfig, this.config);
|
317
305
|
|
318
306
|
if (this.formConfig.list && this.formConfig.list.length) {
|
319
307
|
this.widgetFormSelect = this.formConfig.list[0];
|
@@ -371,7 +359,7 @@ export default {
|
|
371
359
|
case "import-excel":
|
372
360
|
case "import-json":
|
373
361
|
case "import-template":
|
374
|
-
this.
|
362
|
+
this.setConfig(data);
|
375
363
|
break;
|
376
364
|
case "clear":
|
377
365
|
this.handleClear();
|
@@ -384,24 +372,69 @@ export default {
|
|
384
372
|
handleWidgetConfigUpdate(val) {
|
385
373
|
this.widgetFormSelect = Object.assign(this.widgetFormSelect, val);
|
386
374
|
},
|
387
|
-
handleFieldsChange(
|
388
|
-
this.
|
375
|
+
handleFieldsChange() {
|
376
|
+
const dataArr = this.apiOptions.filter(item => {
|
377
|
+
return item.id === this.formConfig.config.fieldsApi;
|
378
|
+
});
|
379
|
+
if (dataArr.length && dataArr[0].paramsOut) {
|
380
|
+
this.fields = dataArr[0].paramsOut.map(item => {
|
381
|
+
return {
|
382
|
+
label: item.note || item.name,
|
383
|
+
alias: item.name,
|
384
|
+
prop: item.name,
|
385
|
+
type: "input",
|
386
|
+
align: "left"
|
387
|
+
};
|
388
|
+
});
|
389
|
+
} else this.fields = [];
|
389
390
|
},
|
390
391
|
clear() {
|
391
392
|
this.handleClear();
|
392
393
|
},
|
393
|
-
|
394
|
-
|
394
|
+
getConfig() {
|
395
|
+
if (this.$refs.formConfigRef) {
|
396
|
+
return new Promise((resolve, reject) =>
|
397
|
+
this.$refs.formConfigRef.formValidate().then(res => {
|
398
|
+
if (res) {
|
399
|
+
const data = deepClone(this.formConfig);
|
400
|
+
data.config.network = this.apiOptions;
|
401
|
+
resolve(data);
|
402
|
+
} else {
|
403
|
+
reject();
|
404
|
+
}
|
405
|
+
})
|
406
|
+
);
|
407
|
+
} else {
|
408
|
+
return new Promise((resolve, reject) => {
|
409
|
+
if (!this.formConfig.config.fieldsType) {
|
410
|
+
this.$message.warning("请选择字段类型");
|
411
|
+
return reject();
|
412
|
+
}
|
413
|
+
if (!this.formConfig.config.fieldsApi) {
|
414
|
+
this.$message.warning("请选择字段接口");
|
415
|
+
return reject();
|
416
|
+
}
|
417
|
+
if (!this.formConfig.config.title) {
|
418
|
+
this.$message.warning("请填写表单标题");
|
419
|
+
return reject();
|
420
|
+
}
|
421
|
+
const data = deepClone(this.formConfig);
|
422
|
+
data.config.network = this.apiOptions;
|
423
|
+
resolve(data);
|
424
|
+
});
|
425
|
+
}
|
395
426
|
},
|
396
427
|
getHtml() {
|
397
428
|
return generateCode(JSON.stringify(this.formConfig));
|
398
429
|
},
|
399
|
-
|
400
|
-
this.formConfig =
|
430
|
+
setConfig(val) {
|
431
|
+
this.formConfig = Object.assign(this.baseConfig, val);
|
401
432
|
|
402
|
-
if (
|
403
|
-
this.widgetFormSelect =
|
433
|
+
if (this.formConfig.list.length > 0) {
|
434
|
+
this.widgetFormSelect = this.formConfig.list[0];
|
404
435
|
}
|
436
|
+
|
437
|
+
this.handleFieldsChange();
|
405
438
|
}
|
406
439
|
}
|
407
440
|
};
|
@@ -35,7 +35,6 @@
|
|
35
35
|
type="text"
|
36
36
|
size="medium"
|
37
37
|
icon="el-icon-view"
|
38
|
-
disabled
|
39
38
|
@click="handleDialogOpen('preview')"
|
40
39
|
>预览
|
41
40
|
</el-button>
|
@@ -129,7 +128,9 @@
|
|
129
128
|
@on-close="handleDialogClose"
|
130
129
|
@on-affirm="handleDialogAffirm"
|
131
130
|
>
|
132
|
-
<template v-if="dialog.action === 'preview'"
|
131
|
+
<template v-if="dialog.action === 'preview'">
|
132
|
+
<th-table-generate :config="config"> </th-table-generate>
|
133
|
+
</template>
|
133
134
|
<template v-else-if="dialog.action === 'importJson'">
|
134
135
|
<el-alert
|
135
136
|
type="info"
|
@@ -94,6 +94,7 @@ export default {
|
|
94
94
|
name: "thTableGenerate",
|
95
95
|
components: { Search, Tools },
|
96
96
|
props: {
|
97
|
+
config: Object,
|
97
98
|
oauthConfig: {
|
98
99
|
type: Object,
|
99
100
|
default: () => {
|
@@ -144,17 +145,25 @@ export default {
|
|
144
145
|
errorMessage: ""
|
145
146
|
};
|
146
147
|
},
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
148
|
+
watch: {
|
149
|
+
config(val) {
|
150
|
+
this.tableJson = val;
|
151
|
+
this.initConfig();
|
152
|
+
},
|
153
|
+
oauthConfig(val) {
|
154
|
+
this.initAxios();
|
155
|
+
}
|
156
|
+
},
|
157
|
+
created() {},
|
158
|
+
mounted() {
|
159
|
+
this.tableJson = this.config;
|
160
|
+
this.initAxios();
|
151
161
|
this.initConfig();
|
152
162
|
},
|
153
|
-
mounted() {},
|
154
163
|
methods: {
|
155
|
-
//
|
156
|
-
|
157
|
-
this.
|
164
|
+
// 初始组件网络
|
165
|
+
initAxios() {
|
166
|
+
this.axios = Axios.init(this.oauthConfig);
|
158
167
|
|
159
168
|
if (this.oauthConfig.token) {
|
160
169
|
const oauthInfo = {
|
@@ -162,11 +171,6 @@ export default {
|
|
162
171
|
baseUrl: this.oauthConfig.baseUrl
|
163
172
|
};
|
164
173
|
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
165
|
-
}
|
166
|
-
|
167
|
-
const info = sessionStorage.getItem("th_oauth_info");
|
168
|
-
if (info) {
|
169
|
-
this.requestConfigData();
|
170
174
|
} else if (this.oauthConfig.oauth) {
|
171
175
|
// 模拟授权认证流程
|
172
176
|
this.axios({
|
@@ -181,93 +185,67 @@ export default {
|
|
181
185
|
};
|
182
186
|
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
183
187
|
// this.axios.defaults.baseURL = this.oauthConfig.baseUrl;
|
184
|
-
this.requestConfigData();
|
185
188
|
});
|
186
|
-
} else {
|
187
|
-
this.requestConfigData();
|
188
189
|
}
|
189
190
|
},
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
// 获取配置信息
|
195
|
-
requestConfigData() {
|
196
|
-
this.axios({
|
197
|
-
url: this.network.page.url,
|
198
|
-
method: this.network.page.method,
|
199
|
-
headers: this.network.page.headers,
|
200
|
-
data: { ...this.network.page.params, moduleId: this.id }
|
201
|
-
})
|
202
|
-
.then(res => {
|
203
|
-
const resultData = res.data;
|
204
|
-
if (!resultData) {
|
205
|
-
this.tableJson = null;
|
206
|
-
return;
|
207
|
-
}
|
208
|
-
this.tableJson = JSON.parse(resultData.pageConfig);
|
209
|
-
// 网络请求
|
210
|
-
this.networkConfig = this.tableJson.network;
|
191
|
+
// 处理配置信息
|
192
|
+
initConfig() {
|
193
|
+
// 网络请求
|
194
|
+
this.networkConfig = this.tableJson.network;
|
211
195
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
196
|
+
// 搜索栏
|
197
|
+
this.searchConfig = this.tableJson.search;
|
198
|
+
if (this.searchConfig.show) {
|
199
|
+
this.searchConfig.options.map(item => {
|
200
|
+
this.$set(this.searchData, item.prop, item.defaultValue || "");
|
201
|
+
});
|
202
|
+
}
|
219
203
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
204
|
+
// table
|
205
|
+
for (let i = 0; i < this.tableJson.table.options.length; i++) {
|
206
|
+
const element = this.tableJson.table.options[i];
|
207
|
+
delete element.type;
|
208
|
+
}
|
209
|
+
if (this.tableJson.table.sequence) {
|
210
|
+
this.tableJson.table.options.unshift({
|
211
|
+
type: "index",
|
212
|
+
label: "序号"
|
213
|
+
});
|
214
|
+
}
|
215
|
+
const action = {
|
216
|
+
label: "操作",
|
217
|
+
hide: true,
|
218
|
+
slot: "action",
|
219
|
+
fixed: "right",
|
220
|
+
actions: []
|
221
|
+
};
|
222
|
+
|
223
|
+
// 按position处理按钮,1:公共区,2:行内区
|
224
|
+
for (const key in this.tableJson.tools) {
|
225
|
+
if (Object.hasOwnProperty.call(this.tableJson.tools, key)) {
|
226
|
+
const element = this.tableJson.tools[key];
|
227
|
+
if (!element.show) continue;
|
228
|
+
if (key === "batchDelete") {
|
226
229
|
this.tableJson.table.options.unshift({
|
227
|
-
type: "
|
228
|
-
label: "序号"
|
230
|
+
type: "selection"
|
229
231
|
});
|
230
232
|
}
|
231
|
-
const
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
// 按position处理按钮,1:公共区,2:行内区
|
240
|
-
for (const key in this.tableJson.tools) {
|
241
|
-
if (Object.hasOwnProperty.call(this.tableJson.tools, key)) {
|
242
|
-
const element = this.tableJson.tools[key];
|
243
|
-
if (!element.show) continue;
|
244
|
-
if (key === "batchDelete") {
|
245
|
-
this.tableJson.table.options.unshift({
|
246
|
-
type: "selection"
|
247
|
-
});
|
248
|
-
}
|
249
|
-
const dic = toolsItemConfig(key, element);
|
250
|
-
dic.form = element.form;
|
251
|
-
if (element.position === 1 || element.position === 'header') {
|
252
|
-
this.toolsConfig.show = true;
|
253
|
-
this.toolsConfig.options.push(dic);
|
254
|
-
} else if (element.position === 2 || element.position === 'row') {
|
255
|
-
action.hide = false;
|
256
|
-
action.actions.push(dic);
|
257
|
-
}
|
258
|
-
}
|
233
|
+
const dic = toolsItemConfig(key, element);
|
234
|
+
dic.form = element.form;
|
235
|
+
if (element.position === 1 || element.position === "header") {
|
236
|
+
this.toolsConfig.show = true;
|
237
|
+
this.toolsConfig.options.push(dic);
|
238
|
+
} else if (element.position === 2 || element.position === "row") {
|
239
|
+
action.hide = false;
|
240
|
+
action.actions.push(dic);
|
259
241
|
}
|
260
|
-
|
261
|
-
|
242
|
+
}
|
243
|
+
}
|
244
|
+
action.width = action.actions.length * 60 + 20;
|
245
|
+
this.tableJson.table.options.push(action);
|
262
246
|
|
263
|
-
|
264
|
-
|
265
|
-
})
|
266
|
-
.catch(err => {
|
267
|
-
this.errorMessage = err.message;
|
268
|
-
this.tableJson = null;
|
269
|
-
this.$emit("error");
|
270
|
-
});
|
247
|
+
this.tableConfig = this.tableJson.table;
|
248
|
+
this.requestListData();
|
271
249
|
},
|
272
250
|
requestListData() {
|
273
251
|
if (!this.networkConfig.mounted) return;
|
@@ -30,18 +30,13 @@
|
|
30
30
|
import WidgetTools from "./WidgetTools.vue";
|
31
31
|
import WidgetTable from "./widgetTable.vue";
|
32
32
|
import WidgetConfig from "./widgetConfig.vue";
|
33
|
-
import { deepClone
|
33
|
+
import { deepClone } from "./util/index";
|
34
34
|
import { baseConfig } from "./custom/config";
|
35
35
|
export default {
|
36
36
|
name: "ThTableMaking",
|
37
37
|
components: { WidgetTools, WidgetTable, WidgetConfig },
|
38
38
|
props: {
|
39
|
-
config:
|
40
|
-
type: Object,
|
41
|
-
default: () => {
|
42
|
-
return deepClone(baseConfig);
|
43
|
-
}
|
44
|
-
},
|
39
|
+
config: Object,
|
45
40
|
|
46
41
|
/**
|
47
42
|
* 表单配置列表。
|
@@ -86,8 +81,9 @@ export default {
|
|
86
81
|
}
|
87
82
|
},
|
88
83
|
data() {
|
84
|
+
this.baseConfig = deepClone(baseConfig);
|
89
85
|
return {
|
90
|
-
tableConfig: this.
|
86
|
+
tableConfig: this.baseConfig,
|
91
87
|
client: "monitor"
|
92
88
|
};
|
93
89
|
},
|
@@ -99,14 +95,16 @@ export default {
|
|
99
95
|
}
|
100
96
|
},
|
101
97
|
config(val) {
|
102
|
-
this.tableConfig = val;
|
98
|
+
this.tableConfig = Object.assign(this.baseConfig, val);
|
103
99
|
this.handleNetwork();
|
104
100
|
},
|
105
101
|
apiOptions(val) {
|
106
102
|
this.handleNetwork();
|
107
103
|
}
|
108
104
|
},
|
109
|
-
mounted() {
|
105
|
+
mounted() {
|
106
|
+
this.tableConfig = Object.assign(this.baseConfig, this.config);
|
107
|
+
},
|
110
108
|
methods: {
|
111
109
|
handleNetwork() {
|
112
110
|
const network = {};
|
@@ -129,10 +127,10 @@ export default {
|
|
129
127
|
break;
|
130
128
|
}
|
131
129
|
},
|
132
|
-
|
130
|
+
getConfig() {
|
133
131
|
return new Promise((resolve, reject) =>
|
134
132
|
this.$refs.configRef
|
135
|
-
.
|
133
|
+
.formValidate()
|
136
134
|
.then(res => {
|
137
135
|
if (res) {
|
138
136
|
const data = deepClone(this.tableConfig);
|
@@ -490,10 +490,14 @@ export default {
|
|
490
490
|
},
|
491
491
|
watch: {
|
492
492
|
config(val) {
|
493
|
+
this.handleFieldsApiChange(val.table.mounted.api)
|
493
494
|
this.handleFields();
|
494
495
|
},
|
495
496
|
fields(val) {
|
496
497
|
this.handleFields();
|
498
|
+
},
|
499
|
+
apiOptions(){
|
500
|
+
this.handleFieldsApiChange(this.config.table.mounted.api)
|
497
501
|
}
|
498
502
|
},
|
499
503
|
computed: {
|
@@ -609,7 +613,7 @@ export default {
|
|
609
613
|
this.fields = fields;
|
610
614
|
} else this.fields = [];
|
611
615
|
},
|
612
|
-
|
616
|
+
formValidate() {
|
613
617
|
return new Promise((resolve, reject) => {
|
614
618
|
if (this.$refs.formRef) {
|
615
619
|
this.$refs.formRef.validate(valid => {
|