tianheng-ui 0.0.85 → 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 +57 -17
- package/packages/TableMaking/util/index.js +4 -3
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>
|
@@ -187,7 +193,14 @@ export default {
|
|
187
193
|
const info = sessionStorage.getItem("th_oauth_info");
|
188
194
|
if (info) {
|
189
195
|
this.requestConfigData();
|
190
|
-
} else {
|
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) {
|
191
204
|
// 模拟授权认证流程
|
192
205
|
this.axios({
|
193
206
|
url: this.config.network.url,
|
@@ -195,15 +208,19 @@ export default {
|
|
195
208
|
data: this.config.network.params,
|
196
209
|
headers: this.config.network.headers
|
197
210
|
}).then(res => {
|
198
|
-
const oauthInfo = { token: res.data, baseUrl:
|
211
|
+
const oauthInfo = { token: res.data, baseUrl: this.config.baseUrl };
|
199
212
|
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
213
|
+
// this.axios.defaults.baseURL = this.config.baseUrl;
|
200
214
|
this.requestConfigData();
|
201
215
|
});
|
202
216
|
}
|
203
217
|
},
|
204
218
|
// 获取配置信息
|
205
|
-
requestConfigData(
|
219
|
+
requestConfigData() {
|
206
220
|
this.tableJson = tableItemConfig(this.id);
|
221
|
+
if (!this.tableJson) {
|
222
|
+
return;
|
223
|
+
}
|
207
224
|
// 网络请求
|
208
225
|
this.networkConfig = this.tableJson.network;
|
209
226
|
|
@@ -310,14 +327,14 @@ export default {
|
|
310
327
|
this.dialog.action.loading = false;
|
311
328
|
});
|
312
329
|
},
|
313
|
-
requestDeleteData(
|
330
|
+
requestDeleteData(callback) {
|
314
331
|
if (!this.networkConfig.delete) return;
|
315
332
|
this.dialog.action.loading = true;
|
316
333
|
const apiInfo = this.networkConfig.delete;
|
317
334
|
this.axios({
|
318
335
|
url: apiInfo.api,
|
319
336
|
method: apiInfo.method,
|
320
|
-
data
|
337
|
+
data: { ids: this.dialog.data.id }
|
321
338
|
})
|
322
339
|
.then(res => {
|
323
340
|
callback(true);
|
@@ -328,6 +345,36 @@ export default {
|
|
328
345
|
this.dialog.action.loading = false;
|
329
346
|
});
|
330
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
|
+
},
|
331
378
|
requestFormConfigData() {
|
332
379
|
setTimeout(() => {
|
333
380
|
const form = this.dialog.action.form;
|
@@ -336,11 +383,9 @@ export default {
|
|
336
383
|
}, 1000);
|
337
384
|
},
|
338
385
|
handleSearchSubmit(val) {
|
339
|
-
console.log("handleSearchSubmit =>", val);
|
340
386
|
this.requestListData();
|
341
387
|
},
|
342
388
|
handleSearchReset(val) {
|
343
|
-
console.log("handleSearchReset =>", val);
|
344
389
|
this.requestListData();
|
345
390
|
},
|
346
391
|
handleToolsClick(action) {
|
@@ -351,12 +396,8 @@ export default {
|
|
351
396
|
this.requestFormConfigData();
|
352
397
|
break;
|
353
398
|
case "batchDelete":
|
354
|
-
|
355
|
-
|
356
|
-
action.loading = false;
|
357
|
-
this.tableSelectionData = [];
|
358
|
-
this.$refs.tableRef.getTable().clearSelection();
|
359
|
-
}, 1000);
|
399
|
+
this.dialog = { show: false, data: {}, action: action };
|
400
|
+
this.requestBatchDeleteData();
|
360
401
|
break;
|
361
402
|
case "export":
|
362
403
|
action.loading = true;
|
@@ -385,7 +426,8 @@ export default {
|
|
385
426
|
this.requestFormConfigData();
|
386
427
|
break;
|
387
428
|
case "delete":
|
388
|
-
this.
|
429
|
+
this.dialog = { show: false, data: item, action: action };
|
430
|
+
this.requestDeleteData(callback);
|
389
431
|
break;
|
390
432
|
|
391
433
|
default:
|
@@ -415,11 +457,9 @@ export default {
|
|
415
457
|
this.formConfig = null;
|
416
458
|
},
|
417
459
|
handlePagingChange(val) {
|
418
|
-
console.log("handlePagingChange =>", val);
|
419
460
|
this.requestListData();
|
420
461
|
},
|
421
462
|
handleSelectionChange(val) {
|
422
|
-
console.log("handleSelectionChange =>", val);
|
423
463
|
this.tableSelectionData = val;
|
424
464
|
}
|
425
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 => {
|
@@ -296,7 +297,7 @@ const tableConfig = {
|
|
296
297
|
add: { show: true, name: "新增", position: 1, form: { id: "1" } },
|
297
298
|
edit: { show: true, name: "编辑", position: 2, form: { id: "1" } },
|
298
299
|
detail: { show: false, name: "查看", position: 2, form: { id: "1" } },
|
299
|
-
delete: { show:
|
300
|
+
delete: { show: true, name: "删除", position: 2 },
|
300
301
|
batchDelete: { show: true, name: "批量删除", position: 1 },
|
301
302
|
export: { show: true, name: "导出", position: 1 },
|
302
303
|
import: { show: true, name: "导入", position: 1 },
|
@@ -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
|
};
|