tianheng-ui 0.0.84 → 0.0.86
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 -0
- package/lib/tianheng-ui.js +12 -12
- package/package.json +1 -1
- package/packages/FormMaking/custom/configs/select.vue +5 -0
- package/packages/FormMaking/index.vue +3 -1
- package/packages/TableMaking/generateTable.vue +63 -22
- package/packages/TableMaking/util/index.js +3 -2
package/package.json
CHANGED
@@ -396,7 +396,6 @@ export default {
|
|
396
396
|
GenerateForm
|
397
397
|
},
|
398
398
|
props: {
|
399
|
-
formName: String,
|
400
399
|
data: {
|
401
400
|
type: Object,
|
402
401
|
default: () => {
|
@@ -531,6 +530,9 @@ export default {
|
|
531
530
|
}
|
532
531
|
},
|
533
532
|
data(val) {
|
533
|
+
if (val && val.config) {
|
534
|
+
val.config = Object.assign(this.widgetFormData.config, val.config);
|
535
|
+
}
|
534
536
|
this.setJSON(val);
|
535
537
|
}
|
536
538
|
},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
<div>
|
2
|
+
<div v-if="tableJson">
|
3
3
|
<!-- 搜索栏 -->
|
4
4
|
<search
|
5
5
|
v-if="searchConfig.show"
|
@@ -73,6 +73,12 @@
|
|
73
73
|
</th-form-generate>
|
74
74
|
</th-dialog>
|
75
75
|
</div>
|
76
|
+
<th-empty
|
77
|
+
v-else
|
78
|
+
:image="require('@/assets/images/notData.png')"
|
79
|
+
description="未获取到配置信息,请联系管理员。"
|
80
|
+
>
|
81
|
+
</th-empty>
|
76
82
|
</template>
|
77
83
|
|
78
84
|
<script>
|
@@ -96,6 +102,7 @@ export default {
|
|
96
102
|
},
|
97
103
|
data() {
|
98
104
|
return {
|
105
|
+
id: "",
|
99
106
|
tableJson: {},
|
100
107
|
axios: null,
|
101
108
|
networkConfig: {},
|
@@ -174,6 +181,8 @@ export default {
|
|
174
181
|
};
|
175
182
|
},
|
176
183
|
created() {
|
184
|
+
const code = this.$route.path.split("/").pop();
|
185
|
+
this.id = code;
|
177
186
|
this.initConfig();
|
178
187
|
},
|
179
188
|
mounted() {},
|
@@ -183,9 +192,15 @@ export default {
|
|
183
192
|
this.axios = Axios.init(this.config);
|
184
193
|
const info = sessionStorage.getItem("th_oauth_info");
|
185
194
|
if (info) {
|
186
|
-
|
187
|
-
|
188
|
-
|
195
|
+
this.requestConfigData();
|
196
|
+
} else if (this.config.token) {
|
197
|
+
const oauthInfo = {
|
198
|
+
token: this.config.token,
|
199
|
+
baseUrl: this.config.baseUrl
|
200
|
+
};
|
201
|
+
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
202
|
+
this.requestConfigData();
|
203
|
+
} else if (this.config.network) {
|
189
204
|
// 模拟授权认证流程
|
190
205
|
this.axios({
|
191
206
|
url: this.config.network.url,
|
@@ -193,16 +208,19 @@ export default {
|
|
193
208
|
data: this.config.network.params,
|
194
209
|
headers: this.config.network.headers
|
195
210
|
}).then(res => {
|
196
|
-
const oauthInfo = { token: res.data, baseUrl:
|
211
|
+
const oauthInfo = { token: res.data, baseUrl: this.config.baseUrl };
|
197
212
|
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
198
|
-
|
199
|
-
this.requestConfigData(
|
213
|
+
// this.axios.defaults.baseURL = this.config.baseUrl;
|
214
|
+
this.requestConfigData();
|
200
215
|
});
|
201
216
|
}
|
202
217
|
},
|
203
218
|
// 获取配置信息
|
204
|
-
requestConfigData(
|
205
|
-
this.tableJson = tableItemConfig(
|
219
|
+
requestConfigData() {
|
220
|
+
this.tableJson = tableItemConfig(this.id);
|
221
|
+
if (!this.tableJson) {
|
222
|
+
return;
|
223
|
+
}
|
206
224
|
// 网络请求
|
207
225
|
this.networkConfig = this.tableJson.network;
|
208
226
|
|
@@ -309,14 +327,14 @@ export default {
|
|
309
327
|
this.dialog.action.loading = false;
|
310
328
|
});
|
311
329
|
},
|
312
|
-
requestDeleteData(
|
330
|
+
requestDeleteData(callback) {
|
313
331
|
if (!this.networkConfig.delete) return;
|
314
332
|
this.dialog.action.loading = true;
|
315
333
|
const apiInfo = this.networkConfig.delete;
|
316
334
|
this.axios({
|
317
335
|
url: apiInfo.api,
|
318
336
|
method: apiInfo.method,
|
319
|
-
data
|
337
|
+
data: { ids: this.dialog.data.id }
|
320
338
|
})
|
321
339
|
.then(res => {
|
322
340
|
callback(true);
|
@@ -327,6 +345,36 @@ export default {
|
|
327
345
|
this.dialog.action.loading = false;
|
328
346
|
});
|
329
347
|
},
|
348
|
+
requestBatchDeleteData() {
|
349
|
+
if (!this.networkConfig.batchDelete) return;
|
350
|
+
this.$confirm("确认删除多条数据吗?", "操作提示", {
|
351
|
+
confirmButtonText: "删除",
|
352
|
+
cancelButtonText: "取消",
|
353
|
+
type: "warning"
|
354
|
+
})
|
355
|
+
.then(() => {
|
356
|
+
this.dialog.action.loading = true;
|
357
|
+
const data = [];
|
358
|
+
for (const item of this.tableSelectionData) {
|
359
|
+
data.push(item.id);
|
360
|
+
}
|
361
|
+
const apiInfo = this.networkConfig.batchDelete;
|
362
|
+
this.axios({
|
363
|
+
url: apiInfo.api,
|
364
|
+
method: apiInfo.method,
|
365
|
+
data
|
366
|
+
})
|
367
|
+
.then(res => {
|
368
|
+
callback(true);
|
369
|
+
this.dialog.action.loading = false;
|
370
|
+
this.requestListData();
|
371
|
+
})
|
372
|
+
.catch(err => {
|
373
|
+
this.dialog.action.loading = false;
|
374
|
+
});
|
375
|
+
})
|
376
|
+
.catch(() => {});
|
377
|
+
},
|
330
378
|
requestFormConfigData() {
|
331
379
|
setTimeout(() => {
|
332
380
|
const form = this.dialog.action.form;
|
@@ -335,11 +383,9 @@ export default {
|
|
335
383
|
}, 1000);
|
336
384
|
},
|
337
385
|
handleSearchSubmit(val) {
|
338
|
-
console.log("handleSearchSubmit =>", val);
|
339
386
|
this.requestListData();
|
340
387
|
},
|
341
388
|
handleSearchReset(val) {
|
342
|
-
console.log("handleSearchReset =>", val);
|
343
389
|
this.requestListData();
|
344
390
|
},
|
345
391
|
handleToolsClick(action) {
|
@@ -350,12 +396,8 @@ export default {
|
|
350
396
|
this.requestFormConfigData();
|
351
397
|
break;
|
352
398
|
case "batchDelete":
|
353
|
-
|
354
|
-
|
355
|
-
action.loading = false;
|
356
|
-
this.tableSelectionData = [];
|
357
|
-
this.$refs.tableRef.getTable().clearSelection();
|
358
|
-
}, 1000);
|
399
|
+
this.dialog = { show: false, data: {}, action: action };
|
400
|
+
this.requestBatchDeleteData();
|
359
401
|
break;
|
360
402
|
case "export":
|
361
403
|
action.loading = true;
|
@@ -384,7 +426,8 @@ export default {
|
|
384
426
|
this.requestFormConfigData();
|
385
427
|
break;
|
386
428
|
case "delete":
|
387
|
-
this.
|
429
|
+
this.dialog = { show: false, data: item, action: action };
|
430
|
+
this.requestDeleteData(callback);
|
388
431
|
break;
|
389
432
|
|
390
433
|
default:
|
@@ -414,11 +457,9 @@ export default {
|
|
414
457
|
this.formConfig = null;
|
415
458
|
},
|
416
459
|
handlePagingChange(val) {
|
417
|
-
console.log("handlePagingChange =>", val);
|
418
460
|
this.requestListData();
|
419
461
|
},
|
420
462
|
handleSelectionChange(val) {
|
421
|
-
console.log("handleSelectionChange =>", val);
|
422
463
|
this.tableSelectionData = val;
|
423
464
|
}
|
424
465
|
}
|
@@ -223,7 +223,8 @@ const formConfig = {
|
|
223
223
|
}
|
224
224
|
]
|
225
225
|
}
|
226
|
-
}
|
226
|
+
},
|
227
|
+
'2':{}
|
227
228
|
};
|
228
229
|
|
229
230
|
export const formItemConfig = key => {
|
@@ -426,6 +427,6 @@ const tableConfig = {
|
|
426
427
|
};
|
427
428
|
|
428
429
|
export const tableItemConfig = key => {
|
429
|
-
const config = tableConfig[key] ||
|
430
|
+
const config = tableConfig[key] || null;
|
430
431
|
return JSON.parse(JSON.stringify(config));
|
431
432
|
};
|