tianheng-ui 0.1.45 → 0.1.47
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 +4 -4
- package/package.json +1 -1
- package/packages/FormMaking/GenerateFormItem.vue +1 -1
- package/packages/FormMaking/WidgetConfig.vue +27 -13
- package/packages/FormMaking/WidgetTools.vue +3 -29
- package/packages/FormMaking/custom/configs/checkbox.vue +8 -1
- package/packages/FormMaking/custom/configs/radio.vue +8 -1
- package/packages/FormMaking/custom/configs/select.vue +8 -1
- package/packages/FormMaking/custom/configs/tabs.vue +8 -1
- package/packages/FormMaking/custom/configs/upload.vue +9 -1
- package/packages/FormMaking/index.vue +21 -8
- package/packages/TableMaking/WidgetTools.vue +47 -22
- package/packages/TableMaking/custom/items/table/index-h5.vue +7 -11
- package/packages/TableMaking/generateList.vue +18 -6
- package/packages/TableMaking/generateTable.vue +2 -2
- package/packages/TableMaking/index.vue +18 -40
- package/packages/TableMaking/widgetConfig.vue +88 -41
package/package.json
CHANGED
@@ -506,10 +506,16 @@ export default {
|
|
506
506
|
},
|
507
507
|
watch: {
|
508
508
|
"config.fields.api"(val) {
|
509
|
+
this.handleFieldsApiChange(val, true);
|
510
|
+
},
|
511
|
+
"config.mounted.api"(val) {
|
512
|
+
this.handleFieldsApiChange(val);
|
513
|
+
},
|
514
|
+
"data.options.remoteFunc"(val) {
|
509
515
|
this.handleFieldsApiChange(val);
|
510
516
|
},
|
511
517
|
apiOptions() {
|
512
|
-
this.handleFieldsApiChange(this.config.fields.api);
|
518
|
+
this.handleFieldsApiChange(this.config.fields.api, true);
|
513
519
|
}
|
514
520
|
},
|
515
521
|
created() {
|
@@ -569,17 +575,18 @@ export default {
|
|
569
575
|
const config = deepClone(this.compsData[val].config);
|
570
576
|
this.$emit("update", config);
|
571
577
|
},
|
572
|
-
handleFieldsApiChange(apiId) {
|
573
|
-
if (
|
574
|
-
|
578
|
+
handleFieldsApiChange(apiId, isFields) {
|
579
|
+
if (isFields) this.fieldsData = { inParams: [], outParams: [] };
|
580
|
+
|
581
|
+
if (!this.apiOptions.length || !this.config.fields.api || !apiId) {
|
575
582
|
return;
|
576
583
|
}
|
577
584
|
const api = this.apiOptions.filter(item => {
|
578
585
|
return item.id === apiId;
|
579
586
|
})[0];
|
587
|
+
|
580
588
|
if (!api) {
|
581
|
-
this.$message.warning("
|
582
|
-
this.fieldsData = { inParams: [], outParams: [] };
|
589
|
+
this.$message.warning("未知的接口名,请检查配置信息");
|
583
590
|
return;
|
584
591
|
}
|
585
592
|
|
@@ -593,21 +600,28 @@ export default {
|
|
593
600
|
}
|
594
601
|
});
|
595
602
|
};
|
603
|
+
|
596
604
|
if (this.config.fields.remote) {
|
597
605
|
const callback = res => {
|
598
606
|
api.inParams = res.inParams;
|
599
607
|
api.outParams = res.outParams;
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
608
|
+
if (isFields) {
|
609
|
+
this.fieldsData.inParams = deepClone(res.inParams || []);
|
610
|
+
initParams(this.fieldsData.inParams);
|
611
|
+
this.fieldsData.outParams = deepClone(res.outParams || []);
|
612
|
+
initParams(this.fieldsData.outParams);
|
613
|
+
}
|
604
614
|
};
|
605
615
|
this.$emit("remote-params", apiId, callback);
|
606
|
-
|
607
|
-
|
616
|
+
return;
|
617
|
+
}
|
618
|
+
|
619
|
+
if (isFields) {
|
620
|
+
this.fieldsData.inParams = deepClone(api.inParams || []);
|
608
621
|
initParams(this.fieldsData.inParams);
|
609
|
-
this.fieldsData.outParams = deepClone(api.outParams
|
622
|
+
this.fieldsData.outParams = deepClone(api.outParams || []);
|
610
623
|
initParams(this.fieldsData.outParams);
|
624
|
+
return;
|
611
625
|
}
|
612
626
|
},
|
613
627
|
formValidate() {
|
@@ -166,9 +166,8 @@
|
|
166
166
|
v-if="dialog.show"
|
167
167
|
:config="formData"
|
168
168
|
:oauthConfig="oauthConfig"
|
169
|
-
:remoteData="remoteData"
|
170
169
|
:slotKeys="slotKeys"
|
171
|
-
@
|
170
|
+
@change="handleDataChange"
|
172
171
|
@button-submit="handleButtonSubmit"
|
173
172
|
ref="generateForm"
|
174
173
|
>
|
@@ -189,9 +188,7 @@
|
|
189
188
|
class="box"
|
190
189
|
:config="formData"
|
191
190
|
:oauthConfig="oauthConfig"
|
192
|
-
|
193
|
-
insite="true"
|
194
|
-
@on-change="handleDataChange"
|
191
|
+
@change="handleDataChange"
|
195
192
|
@button-submit="handleButtonSubmit"
|
196
193
|
ref="generateForm"
|
197
194
|
>
|
@@ -258,29 +255,6 @@ export default {
|
|
258
255
|
generateJson: "生成JSON",
|
259
256
|
generateCode: "生成代码"
|
260
257
|
},
|
261
|
-
remoteData: {
|
262
|
-
func_test(resolve) {
|
263
|
-
setTimeout(() => {
|
264
|
-
const options = [
|
265
|
-
{ id: "1", name: "1111" },
|
266
|
-
{ id: "2", name: "2222" },
|
267
|
-
{ id: "3", name: "3333" }
|
268
|
-
];
|
269
|
-
|
270
|
-
resolve(options);
|
271
|
-
}, 2000);
|
272
|
-
},
|
273
|
-
funcGetToken(resolve) {
|
274
|
-
request
|
275
|
-
.get("http://tools-server.making.link/api/uptoken")
|
276
|
-
.then(res => {
|
277
|
-
resolve(res.uptoken);
|
278
|
-
});
|
279
|
-
},
|
280
|
-
upload_callback(response, file, fileList) {
|
281
|
-
console.log("callback", response, file, fileList);
|
282
|
-
}
|
283
|
-
},
|
284
258
|
slotKeys: ["blank_1681093126000_96387"]
|
285
259
|
};
|
286
260
|
},
|
@@ -506,7 +480,7 @@ export default {
|
|
506
480
|
});
|
507
481
|
} else if (item.type === "table" || item.type === "tableH5") {
|
508
482
|
initList(item.options.columns);
|
509
|
-
} else if (item.options.remote) {
|
483
|
+
} else if (item.options.remote || item.options.remoteFunc) {
|
510
484
|
fieldsApi[item.model] = item.options.remoteFunc;
|
511
485
|
}
|
512
486
|
}
|
@@ -45,7 +45,14 @@
|
|
45
45
|
</el-form-item>
|
46
46
|
|
47
47
|
<el-form-item label="数据类型">
|
48
|
-
<el-radio-group
|
48
|
+
<el-radio-group
|
49
|
+
v-model="widget.options.remote"
|
50
|
+
@input="
|
51
|
+
val => {
|
52
|
+
if (!val) widget.options.remoteFunc = '';
|
53
|
+
}
|
54
|
+
"
|
55
|
+
>
|
49
56
|
<el-radio-button :label="false">静态数据</el-radio-button>
|
50
57
|
<el-radio-button :label="true">远端数据</el-radio-button>
|
51
58
|
</el-radio-group>
|
@@ -32,7 +32,14 @@
|
|
32
32
|
</el-form-item>
|
33
33
|
|
34
34
|
<el-form-item label="数据类型">
|
35
|
-
<el-radio-group
|
35
|
+
<el-radio-group
|
36
|
+
v-model="widget.options.remote"
|
37
|
+
@input="
|
38
|
+
val => {
|
39
|
+
if (!val) widget.options.remoteFunc = '';
|
40
|
+
}
|
41
|
+
"
|
42
|
+
>
|
36
43
|
<el-radio-button :label="false">静态数据</el-radio-button>
|
37
44
|
<el-radio-button :label="true">远端数据</el-radio-button>
|
38
45
|
</el-radio-group>
|
@@ -29,7 +29,14 @@
|
|
29
29
|
</el-form-item>
|
30
30
|
|
31
31
|
<el-form-item label="数据类型">
|
32
|
-
<el-radio-group
|
32
|
+
<el-radio-group
|
33
|
+
v-model="widget.options.remote"
|
34
|
+
@input="
|
35
|
+
val => {
|
36
|
+
if (!val) widget.options.remoteFunc = '';
|
37
|
+
}
|
38
|
+
"
|
39
|
+
>
|
33
40
|
<el-radio-button :label="false">静态数据</el-radio-button>
|
34
41
|
<el-radio-button :label="true">远端数据</el-radio-button>
|
35
42
|
</el-radio-group>
|
@@ -41,7 +41,14 @@
|
|
41
41
|
</el-form-item>
|
42
42
|
|
43
43
|
<el-form-item label="数据类型">
|
44
|
-
<el-radio-group
|
44
|
+
<el-radio-group
|
45
|
+
v-model="widget.options.remote"
|
46
|
+
@input="
|
47
|
+
val => {
|
48
|
+
if (!val) widget.options.remoteFunc = '';
|
49
|
+
}
|
50
|
+
"
|
51
|
+
>
|
45
52
|
<el-radio-button :label="false">静态数据</el-radio-button>
|
46
53
|
<el-radio-button :label="true">远端数据</el-radio-button>
|
47
54
|
</el-radio-group>
|
@@ -61,7 +61,15 @@
|
|
61
61
|
</el-form-item>
|
62
62
|
|
63
63
|
<el-form-item label="上传地址" :required="true">
|
64
|
-
<el-radio-group
|
64
|
+
<el-radio-group
|
65
|
+
v-model="widget.options.remote"
|
66
|
+
size="mini"
|
67
|
+
@input="
|
68
|
+
val => {
|
69
|
+
if (!val) widget.options.remoteFunc = '';
|
70
|
+
}
|
71
|
+
"
|
72
|
+
>
|
65
73
|
<el-radio-button :label="false">静态接口</el-radio-button>
|
66
74
|
<el-radio-button :label="true">远端接口</el-radio-button>
|
67
75
|
</el-radio-group>
|
@@ -134,6 +134,7 @@
|
|
134
134
|
:config="formConfig.config"
|
135
135
|
:apiOptions="apiOptions"
|
136
136
|
ref="configRef"
|
137
|
+
@remote-params="handleRemoteParams"
|
137
138
|
@update="handleWidgetConfigUpdate"
|
138
139
|
>
|
139
140
|
</widget-config>
|
@@ -260,10 +261,10 @@ export default {
|
|
260
261
|
},
|
261
262
|
config(val) {
|
262
263
|
this.setConfig(val);
|
263
|
-
this.handleNetworkConfig();
|
264
|
+
this.handleNetworkConfig(true);
|
264
265
|
},
|
265
266
|
apiOptions(val) {
|
266
|
-
this.handleNetworkConfig();
|
267
|
+
this.handleNetworkConfig(true);
|
267
268
|
}
|
268
269
|
},
|
269
270
|
created() {
|
@@ -277,7 +278,7 @@ export default {
|
|
277
278
|
}
|
278
279
|
},
|
279
280
|
mounted() {
|
280
|
-
this.handleNetworkConfig();
|
281
|
+
this.handleNetworkConfig(true);
|
281
282
|
},
|
282
283
|
methods: {
|
283
284
|
// 初始化组件配置
|
@@ -304,7 +305,7 @@ export default {
|
|
304
305
|
});
|
305
306
|
}
|
306
307
|
},
|
307
|
-
handleNetworkConfig() {
|
308
|
+
handleNetworkConfig(isGetParams) {
|
308
309
|
if (!this.apiOptions.length || !this.formConfig.config) {
|
309
310
|
this.formConfig.config.network = {};
|
310
311
|
return;
|
@@ -321,7 +322,7 @@ export default {
|
|
321
322
|
});
|
322
323
|
} else if (item.type === "table" || item.type === "tableH5") {
|
323
324
|
initList(item.options.columns);
|
324
|
-
} else if (item.options.remote) {
|
325
|
+
} else if (item.options.remote || item.options.remoteFunc) {
|
325
326
|
fieldsApi[item.model] = item.options.remoteFunc;
|
326
327
|
}
|
327
328
|
}
|
@@ -329,8 +330,18 @@ export default {
|
|
329
330
|
initList(this.formConfig.list);
|
330
331
|
const apis = Object.values(fieldsApi);
|
331
332
|
const network = {};
|
332
|
-
this.apiOptions.map(
|
333
|
-
if (apis.includes(
|
333
|
+
this.apiOptions.map(api => {
|
334
|
+
if (apis.includes(api.id)) {
|
335
|
+
// 初始化接口参数
|
336
|
+
if (this.formConfig.config.fields.remote && isGetParams) {
|
337
|
+
const callback = res => {
|
338
|
+
api.inParams = res.inParams;
|
339
|
+
api.outParams = res.outParams;
|
340
|
+
};
|
341
|
+
this.$emit("remote-params", api.id, callback);
|
342
|
+
}
|
343
|
+
network[api.id] = api;
|
344
|
+
}
|
334
345
|
});
|
335
346
|
this.formConfig.config.network = network;
|
336
347
|
},
|
@@ -344,7 +355,6 @@ export default {
|
|
344
355
|
this.widgetFormSelect = {};
|
345
356
|
},
|
346
357
|
handleWidgetToolsChange(val, data) {
|
347
|
-
console.log(val, data);
|
348
358
|
switch (val) {
|
349
359
|
case "import-excel":
|
350
360
|
case "import-json":
|
@@ -361,6 +371,9 @@ export default {
|
|
361
371
|
handleWidgetConfigUpdate(val) {
|
362
372
|
this.widgetFormSelect = Object.assign(this.widgetFormSelect, val);
|
363
373
|
},
|
374
|
+
handleRemoteParams(val, callback) {
|
375
|
+
this.$emit("remote-params", val, callback);
|
376
|
+
},
|
364
377
|
clear() {
|
365
378
|
this.handleClear();
|
366
379
|
},
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<slot> </slot>
|
5
5
|
</div>
|
6
6
|
<div class="right">
|
7
|
-
<el-button
|
7
|
+
<!-- <el-button
|
8
8
|
v-if="permissions.includes('clearable')"
|
9
9
|
style="margin-left:10px;"
|
10
10
|
type="text"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
disabled
|
14
14
|
@click="handleClick('clear')"
|
15
15
|
>重置
|
16
|
-
</el-button>
|
16
|
+
</el-button> -->
|
17
17
|
<el-popover style="margin-left:10px;" placement="bottom" trigger="hover">
|
18
18
|
<el-button
|
19
19
|
v-if="permissions.includes('preview')"
|
@@ -131,10 +131,14 @@
|
|
131
131
|
@on-affirm="handleDialogAffirm"
|
132
132
|
>
|
133
133
|
<template v-if="dialog.action === 'previewPc'">
|
134
|
-
<th-table-generate :config="deepClone(
|
134
|
+
<th-table-generate :config="deepClone(tableConfig)">
|
135
|
+
</th-table-generate>
|
135
136
|
</template>
|
136
137
|
<template v-if="dialog.action === 'previewH5'">
|
137
|
-
<th-list-generate
|
138
|
+
<th-list-generate
|
139
|
+
:data="[{ id: new Date().getTime() }]"
|
140
|
+
:config="deepClone(tableConfig)"
|
141
|
+
>
|
138
142
|
</th-list-generate>
|
139
143
|
</template>
|
140
144
|
<template v-else-if="dialog.action === 'importJson'">
|
@@ -142,17 +146,11 @@
|
|
142
146
|
type="info"
|
143
147
|
title="JSON格式如下,直接复制生成的json覆盖此处代码点击确定即可"
|
144
148
|
></el-alert>
|
145
|
-
<th-code-editor
|
146
|
-
v-model="dialog.data.config"
|
147
|
-
ref="codeEditor"
|
148
|
-
></th-code-editor>
|
149
|
+
<th-code-editor v-model="dialog.data" ref="codeEditor"></th-code-editor>
|
149
150
|
</template>
|
150
151
|
<template v-else-if="dialog.action === 'importTemplate'"></template>
|
151
152
|
<template v-else-if="dialog.action === 'generateJson'">
|
152
|
-
<th-code-editor
|
153
|
-
v-model="dialog.data.config"
|
154
|
-
ref="codeEditor"
|
155
|
-
></th-code-editor>
|
153
|
+
<th-code-editor v-model="dialog.data" ref="codeEditor"></th-code-editor>
|
156
154
|
</template>
|
157
155
|
<template v-else-if="dialog.action === 'generateCode'"></template>
|
158
156
|
</th-dialog>
|
@@ -165,10 +163,12 @@ import { deepClone } from "./util";
|
|
165
163
|
export default {
|
166
164
|
props: {
|
167
165
|
config: Object,
|
166
|
+
apiOptions: Array,
|
168
167
|
permissions: Array
|
169
168
|
},
|
170
169
|
data() {
|
171
170
|
return {
|
171
|
+
tableConfig: this.config,
|
172
172
|
dialog: {
|
173
173
|
show: false,
|
174
174
|
action: "",
|
@@ -184,23 +184,48 @@ export default {
|
|
184
184
|
}
|
185
185
|
};
|
186
186
|
},
|
187
|
+
watch: {
|
188
|
+
config(val) {
|
189
|
+
this.tableConfig = val;
|
190
|
+
},
|
191
|
+
tableConfig(val) {
|
192
|
+
this.$emit("update:config", val);
|
193
|
+
}
|
194
|
+
},
|
187
195
|
created() {},
|
188
196
|
mounted() {},
|
189
197
|
methods: {
|
190
198
|
deepClone: deepClone,
|
191
|
-
|
192
|
-
|
199
|
+
handleNetworkConfig() {
|
200
|
+
const apis = [];
|
201
|
+
if (this.tableConfig.table.mounted.api)
|
202
|
+
apis.push(this.tableConfig.table.mounted.api);
|
203
|
+
const toolsArr = Object.values(this.tableConfig.tools);
|
204
|
+
for (const item of toolsArr) {
|
205
|
+
if (item.api && item.show) apis.push(item.api);
|
206
|
+
}
|
207
|
+
|
208
|
+
const network = {};
|
209
|
+
this.apiOptions.map(api => {
|
210
|
+
if (apis.includes(api.id)) {
|
211
|
+
network[api.id] = api;
|
212
|
+
}
|
213
|
+
});
|
214
|
+
this.tableConfig.network = network;
|
193
215
|
},
|
194
216
|
handleDialogOpen(action, data = {}) {
|
195
|
-
// if (action === "preview") {
|
196
|
-
// const { href } = this.$router.resolve({ path: "" });
|
197
|
-
// window.open(href, "_blank");
|
198
|
-
// return;
|
199
|
-
// }
|
200
217
|
switch (action) {
|
201
218
|
case "generateJson":
|
202
|
-
|
203
|
-
data
|
219
|
+
this.handleNetworkConfig();
|
220
|
+
data = JSON.stringify(this.tableConfig, null, 2);
|
221
|
+
break;
|
222
|
+
case "importJson":
|
223
|
+
data = "";
|
224
|
+
break;
|
225
|
+
case "previewPc":
|
226
|
+
case "previewH5":
|
227
|
+
case "generateCode":
|
228
|
+
this.handleNetworkConfig();
|
204
229
|
break;
|
205
230
|
|
206
231
|
default:
|
@@ -220,7 +245,7 @@ export default {
|
|
220
245
|
const action = this.dialog.action;
|
221
246
|
switch (action) {
|
222
247
|
case "importJson":
|
223
|
-
this.
|
248
|
+
this.tableConfig = JSON.parse(this.dialog.data);
|
224
249
|
break;
|
225
250
|
|
226
251
|
default:
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="generateTable-table">
|
3
3
|
<div
|
4
|
-
v-for="
|
4
|
+
v-for="(groupItem, groupIndex) in data"
|
5
5
|
class="table-list-item"
|
6
6
|
:style="cellStyle"
|
7
|
-
:key="
|
8
|
-
@click="
|
7
|
+
:key="groupItem.id"
|
8
|
+
@click="handleClick({ type: 'listClick' }, groupItem, groupIndex)"
|
9
9
|
>
|
10
10
|
<div
|
11
11
|
v-for="(column, index) in getList"
|
@@ -16,7 +16,7 @@
|
|
16
16
|
{{ column.label }}
|
17
17
|
</div>
|
18
18
|
<div class="table-list-item-row-value" :style="valueStyle">
|
19
|
-
{{
|
19
|
+
{{ groupItem[column.prop] != null ? groupItem[column.prop] : "" }}
|
20
20
|
</div>
|
21
21
|
</div>
|
22
22
|
<div class="table-list-item-tools">
|
@@ -29,7 +29,7 @@
|
|
29
29
|
:round="button.style.round"
|
30
30
|
:circle="button.style.circle"
|
31
31
|
:size="button.style.size"
|
32
|
-
@click="
|
32
|
+
@click.stop="handleClick(button, groupItem, groupIndex)"
|
33
33
|
>{{ button.text }}</el-button
|
34
34
|
>
|
35
35
|
</div>
|
@@ -76,12 +76,8 @@ export default {
|
|
76
76
|
}
|
77
77
|
},
|
78
78
|
methods: {
|
79
|
-
|
80
|
-
|
81
|
-
this.$emit("click", item);
|
82
|
-
},
|
83
|
-
handleActionClick(action, item) {
|
84
|
-
this.$emit("action", action, item);
|
79
|
+
handleClick(action, item, index) {
|
80
|
+
this.$emit("click", action, item, index);
|
85
81
|
},
|
86
82
|
initStyle(style) {
|
87
83
|
let styleText = "";
|
@@ -6,6 +6,7 @@
|
|
6
6
|
v-if="tableData.length"
|
7
7
|
:data="tableData"
|
8
8
|
:config="tableConfig"
|
9
|
+
@click="handleListClick"
|
9
10
|
></list>
|
10
11
|
<th-empty v-else style="padding:100px 0;">
|
11
12
|
<img
|
@@ -15,7 +16,7 @@
|
|
15
16
|
alt=""
|
16
17
|
/>
|
17
18
|
</th-empty>
|
18
|
-
<tools :config="toolsConfig" @click="
|
19
|
+
<tools :config="toolsConfig" @click="handleListClick"></tools>
|
19
20
|
</div>
|
20
21
|
</template>
|
21
22
|
|
@@ -77,11 +78,22 @@ export default {
|
|
77
78
|
handleSearchChange(data) {
|
78
79
|
this.$emit("search", data);
|
79
80
|
},
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
handleListClick(action, data, index) {
|
82
|
+
if (action.type === "listClick") {
|
83
|
+
this.$emit("click", data, index);
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
switch (action.type) {
|
87
|
+
case "add":
|
88
|
+
this.tableData.push({ id: new Date().getTime() });
|
89
|
+
break;
|
90
|
+
case "delete":
|
91
|
+
this.tableData.splice(index, 1);
|
92
|
+
break;
|
93
|
+
|
94
|
+
default:
|
95
|
+
break;
|
96
|
+
}
|
85
97
|
this.$emit("action", action, data);
|
86
98
|
}
|
87
99
|
}
|
@@ -400,7 +400,7 @@ export default {
|
|
400
400
|
let params = {};
|
401
401
|
switch (actionType) {
|
402
402
|
case "list":
|
403
|
-
for (let key of Object.keys(config.
|
403
|
+
for (let key of Object.keys(config.inParams)) {
|
404
404
|
params[key] = paramsData[key] || this.query[key];
|
405
405
|
}
|
406
406
|
if (this.tableConfig.pageInfo.show) {
|
@@ -411,7 +411,7 @@ export default {
|
|
411
411
|
case "add":
|
412
412
|
case "edit":
|
413
413
|
case "delete":
|
414
|
-
for (let key of Object.keys(config.
|
414
|
+
for (let key of Object.keys(config.inParams)) {
|
415
415
|
params[key] = paramsData[key];
|
416
416
|
}
|
417
417
|
break;
|
@@ -2,10 +2,9 @@
|
|
2
2
|
<div class="th-tableMaking th-flex_box">
|
3
3
|
<div class="th-fiex_content">
|
4
4
|
<widget-tools
|
5
|
-
:config="tableConfig"
|
6
|
-
:
|
5
|
+
:config.sync="tableConfig"
|
6
|
+
:apiOptions="apiOptions"
|
7
7
|
:permissions="permissions"
|
8
|
-
@click="handleToolsClick"
|
9
8
|
>
|
10
9
|
<slot name="action"></slot>
|
11
10
|
</widget-tools>
|
@@ -83,66 +82,49 @@ export default {
|
|
83
82
|
data() {
|
84
83
|
this.baseConfig = deepClone(baseConfig);
|
85
84
|
return {
|
86
|
-
tableConfig: this.baseConfig
|
87
|
-
client: "monitor"
|
85
|
+
tableConfig: this.baseConfig
|
88
86
|
};
|
89
87
|
},
|
90
88
|
watch: {
|
91
89
|
apiOptions(val) {
|
92
|
-
this.
|
90
|
+
this.handleNetworkConfig();
|
93
91
|
},
|
94
92
|
config(val) {
|
95
93
|
this.tableConfig = Object.assign(this.baseConfig, val);
|
96
|
-
this.
|
94
|
+
this.handleNetworkConfig();
|
97
95
|
},
|
98
96
|
tableConfig: {
|
99
97
|
deep: true,
|
100
98
|
handler: function(val) {
|
101
99
|
this.$emit("update:config", val);
|
102
100
|
}
|
103
|
-
},
|
104
|
-
"tableConfig.table.mounted.api"(val) {
|
105
|
-
this.handleNetwork();
|
106
|
-
},
|
107
|
-
"tableConfig.tools.add.api"(val) {
|
108
|
-
this.handleNetwork();
|
109
|
-
},
|
110
|
-
"tableConfig.tools.edit.api"(val) {
|
111
|
-
this.handleNetwork();
|
112
|
-
},
|
113
|
-
"tableConfig.tools.look.api"(val) {
|
114
|
-
this.handleNetwork();
|
115
|
-
},
|
116
|
-
"tableConfig.tools.delete.api"(val) {
|
117
|
-
this.handleNetwork();
|
118
|
-
},
|
119
|
-
"tableConfig.tools.batchDelete.api"(val) {
|
120
|
-
this.handleNetwork();
|
121
|
-
},
|
122
|
-
"tableConfig.tools.export.api"(val) {
|
123
|
-
this.handleNetwork();
|
124
|
-
},
|
125
|
-
"tableConfig.tools.import.api"(val) {
|
126
|
-
this.handleNetwork();
|
127
101
|
}
|
128
102
|
},
|
129
103
|
mounted() {
|
130
104
|
this.tableConfig = Object.assign(this.baseConfig, this.config);
|
131
105
|
},
|
132
106
|
methods: {
|
133
|
-
|
107
|
+
handleNetworkConfig() {
|
134
108
|
const apis = [];
|
135
109
|
if (this.tableConfig.table.mounted.api)
|
136
110
|
apis.push(this.tableConfig.table.mounted.api);
|
137
111
|
const toolsArr = Object.values(this.tableConfig.tools);
|
138
112
|
for (const item of toolsArr) {
|
139
|
-
if (item.api) apis.push(item.api);
|
113
|
+
if (item.api && item.show) apis.push(item.api);
|
140
114
|
}
|
141
115
|
|
142
116
|
const network = {};
|
143
|
-
this.apiOptions.map(
|
144
|
-
if (apis.includes(
|
145
|
-
|
117
|
+
this.apiOptions.map(api => {
|
118
|
+
if (apis.includes(api.id)) {
|
119
|
+
// 初始化接口参数
|
120
|
+
// if (this.tableConfig.table.fields.remote) {
|
121
|
+
// const callback = res => {
|
122
|
+
// api.inParams = res.inParams;
|
123
|
+
// api.outParams = res.outParams;
|
124
|
+
// };
|
125
|
+
// this.$emit("remote-params", api.id, callback);
|
126
|
+
// }
|
127
|
+
network[api.id] = api;
|
146
128
|
}
|
147
129
|
});
|
148
130
|
this.tableConfig.network = network;
|
@@ -152,10 +134,6 @@ export default {
|
|
152
134
|
case "import-json":
|
153
135
|
this.tableConfig = data;
|
154
136
|
break;
|
155
|
-
case "monitor":
|
156
|
-
case "mobile":
|
157
|
-
this.client = action;
|
158
|
-
break;
|
159
137
|
|
160
138
|
default:
|
161
139
|
break;
|