tianheng-ui 0.1.46 → 0.1.48
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/WidgetConfig.vue +24 -15
- package/packages/FormMaking/WidgetTools.vue +2 -28
- 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 +16 -7
- 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 +90 -41
- package/packages/TableMaking/widgetTable.vue +2 -2
package/package.json
CHANGED
@@ -198,6 +198,7 @@
|
|
198
198
|
style="width:100%"
|
199
199
|
clearable
|
200
200
|
placeholder="请选择"
|
201
|
+
filterable
|
201
202
|
no-data-text="暂无接口,请前往【数据源模块】创建"
|
202
203
|
>
|
203
204
|
<el-option
|
@@ -506,13 +507,16 @@ export default {
|
|
506
507
|
},
|
507
508
|
watch: {
|
508
509
|
"config.fields.api"(val) {
|
510
|
+
this.handleFieldsApiChange(val, true);
|
511
|
+
},
|
512
|
+
"config.mounted.api"(val) {
|
509
513
|
this.handleFieldsApiChange(val);
|
510
514
|
},
|
511
515
|
"data.options.remoteFunc"(val) {
|
512
516
|
this.handleFieldsApiChange(val);
|
513
517
|
},
|
514
518
|
apiOptions() {
|
515
|
-
this.handleFieldsApiChange(this.config.fields.api);
|
519
|
+
this.handleFieldsApiChange(this.config.fields.api, true);
|
516
520
|
}
|
517
521
|
},
|
518
522
|
created() {
|
@@ -572,17 +576,15 @@ export default {
|
|
572
576
|
const config = deepClone(this.compsData[val].config);
|
573
577
|
this.$emit("update", config);
|
574
578
|
},
|
575
|
-
handleFieldsApiChange(apiId) {
|
576
|
-
if (
|
577
|
-
|
578
|
-
|
579
|
-
}
|
579
|
+
handleFieldsApiChange(apiId, isFields) {
|
580
|
+
if (isFields) this.fieldsData = { inParams: [], outParams: [] };
|
581
|
+
if (!this.apiOptions.length || !apiId) return;
|
582
|
+
|
580
583
|
const api = this.apiOptions.filter(item => {
|
581
584
|
return item.id === apiId;
|
582
585
|
})[0];
|
583
586
|
if (!api) {
|
584
|
-
this.$message.warning("
|
585
|
-
this.fieldsData = { inParams: [], outParams: [] };
|
587
|
+
this.$message.warning("未知的接口,请检查配置信息");
|
586
588
|
return;
|
587
589
|
}
|
588
590
|
|
@@ -596,21 +598,28 @@ export default {
|
|
596
598
|
}
|
597
599
|
});
|
598
600
|
};
|
601
|
+
|
599
602
|
if (this.config.fields.remote) {
|
600
603
|
const callback = res => {
|
601
604
|
api.inParams = res.inParams;
|
602
605
|
api.outParams = res.outParams;
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
606
|
+
if (isFields) {
|
607
|
+
this.fieldsData.inParams = deepClone(res.inParams || []);
|
608
|
+
initParams(this.fieldsData.inParams);
|
609
|
+
this.fieldsData.outParams = deepClone(res.outParams || []);
|
610
|
+
initParams(this.fieldsData.outParams);
|
611
|
+
}
|
607
612
|
};
|
608
613
|
this.$emit("remote-params", apiId, callback);
|
609
|
-
|
610
|
-
|
614
|
+
return;
|
615
|
+
}
|
616
|
+
|
617
|
+
if (isFields) {
|
618
|
+
this.fieldsData.inParams = deepClone(api.inParams || []);
|
611
619
|
initParams(this.fieldsData.inParams);
|
612
|
-
this.fieldsData.outParams = deepClone(api.outParams
|
620
|
+
this.fieldsData.outParams = deepClone(api.outParams || []);
|
613
621
|
initParams(this.fieldsData.outParams);
|
622
|
+
return;
|
614
623
|
}
|
615
624
|
},
|
616
625
|
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
|
},
|
@@ -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>
|
@@ -261,10 +261,10 @@ export default {
|
|
261
261
|
},
|
262
262
|
config(val) {
|
263
263
|
this.setConfig(val);
|
264
|
-
this.handleNetworkConfig();
|
264
|
+
this.handleNetworkConfig(true);
|
265
265
|
},
|
266
266
|
apiOptions(val) {
|
267
|
-
this.handleNetworkConfig();
|
267
|
+
this.handleNetworkConfig(true);
|
268
268
|
}
|
269
269
|
},
|
270
270
|
created() {
|
@@ -278,7 +278,7 @@ export default {
|
|
278
278
|
}
|
279
279
|
},
|
280
280
|
mounted() {
|
281
|
-
this.handleNetworkConfig();
|
281
|
+
this.handleNetworkConfig(true);
|
282
282
|
},
|
283
283
|
methods: {
|
284
284
|
// 初始化组件配置
|
@@ -305,7 +305,7 @@ export default {
|
|
305
305
|
});
|
306
306
|
}
|
307
307
|
},
|
308
|
-
handleNetworkConfig() {
|
308
|
+
handleNetworkConfig(isGetParams) {
|
309
309
|
if (!this.apiOptions.length || !this.formConfig.config) {
|
310
310
|
this.formConfig.config.network = {};
|
311
311
|
return;
|
@@ -330,8 +330,18 @@ export default {
|
|
330
330
|
initList(this.formConfig.list);
|
331
331
|
const apis = Object.values(fieldsApi);
|
332
332
|
const network = {};
|
333
|
-
this.apiOptions.map(
|
334
|
-
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
|
+
}
|
335
345
|
});
|
336
346
|
this.formConfig.config.network = network;
|
337
347
|
},
|
@@ -345,7 +355,6 @@ export default {
|
|
345
355
|
this.widgetFormSelect = {};
|
346
356
|
},
|
347
357
|
handleWidgetToolsChange(val, data) {
|
348
|
-
console.log(val, data);
|
349
358
|
switch (val) {
|
350
359
|
case "import-excel":
|
351
360
|
case "import-json":
|
@@ -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;
|