tianheng-ui 0.0.82 → 0.0.84
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/{packages/TableMaking/util → lib/theme-chalk/js}/Log.js +0 -0
- package/{packages/TableMaking/util → lib/theme-chalk/js}/axios.js +0 -0
- package/lib/tianheng-ui.js +3 -3
- package/package.json +1 -1
- package/packages/TableMaking/generateTable.vue +14 -14
- package/packages/TableMaking/index.vue +45 -7
- package/packages/TableMaking/util/index.js +3 -21
- package/packages/TableMaking/widgetConfig.vue +7 -6
package/package.json
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
import Search from "./custom/items/search";
|
80
80
|
import Tools from "./custom/items/tools";
|
81
81
|
import { toolsItemConfig, formItemConfig, tableItemConfig } from "./util/index";
|
82
|
-
import * as Axios from "
|
82
|
+
import * as Axios from "lib/theme-chalk/js/axios";
|
83
83
|
export default {
|
84
84
|
name: "thTableGenerate",
|
85
85
|
components: { Search, Tools },
|
@@ -193,7 +193,7 @@ export default {
|
|
193
193
|
data: this.config.network.params,
|
194
194
|
headers: this.config.network.headers
|
195
195
|
}).then(res => {
|
196
|
-
const oauthInfo = { token: res.data };
|
196
|
+
const oauthInfo = { token: res.data, baseUrl: "" };
|
197
197
|
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
198
198
|
const code = this.$route.params.id;
|
199
199
|
this.requestConfigData(code);
|
@@ -327,7 +327,7 @@ export default {
|
|
327
327
|
this.dialog.action.loading = false;
|
328
328
|
});
|
329
329
|
},
|
330
|
-
|
330
|
+
requestFormConfigData() {
|
331
331
|
setTimeout(() => {
|
332
332
|
const form = this.dialog.action.form;
|
333
333
|
const config = formItemConfig(form.id);
|
@@ -347,7 +347,7 @@ export default {
|
|
347
347
|
switch (action.act) {
|
348
348
|
case "add":
|
349
349
|
this.dialog = { show: true, data: {}, action: action };
|
350
|
-
this.
|
350
|
+
this.requestFormConfigData();
|
351
351
|
break;
|
352
352
|
case "batchDelete":
|
353
353
|
action.loading = true;
|
@@ -372,24 +372,16 @@ export default {
|
|
372
372
|
break;
|
373
373
|
}
|
374
374
|
},
|
375
|
-
handlePagingChange(val) {
|
376
|
-
console.log("handlePagingChange =>", val);
|
377
|
-
this.requestListData();
|
378
|
-
},
|
379
|
-
handleSelectionChange(val) {
|
380
|
-
console.log("handleSelectionChange =>", val);
|
381
|
-
this.tableSelectionData = val;
|
382
|
-
},
|
383
375
|
handleActionClick(index, item, action, callback) {
|
384
376
|
console.log("handleActionClick =>", item, action);
|
385
377
|
switch (action.act) {
|
386
378
|
case "edit":
|
387
379
|
this.dialog = { show: true, data: item, action: action };
|
388
|
-
this.
|
380
|
+
this.requestFormConfigData();
|
389
381
|
break;
|
390
382
|
case "detail":
|
391
383
|
this.dialog = { show: true, data: item, action: action };
|
392
|
-
this.
|
384
|
+
this.requestFormConfigData();
|
393
385
|
break;
|
394
386
|
case "delete":
|
395
387
|
this.requestDeleteData({ ids: item.id }, callback);
|
@@ -420,6 +412,14 @@ export default {
|
|
420
412
|
},
|
421
413
|
handleDialogClose() {
|
422
414
|
this.formConfig = null;
|
415
|
+
},
|
416
|
+
handlePagingChange(val) {
|
417
|
+
console.log("handlePagingChange =>", val);
|
418
|
+
this.requestListData();
|
419
|
+
},
|
420
|
+
handleSelectionChange(val) {
|
421
|
+
console.log("handleSelectionChange =>", val);
|
422
|
+
this.tableSelectionData = val;
|
423
423
|
}
|
424
424
|
}
|
425
425
|
};
|
@@ -72,8 +72,13 @@ export default {
|
|
72
72
|
};
|
73
73
|
},
|
74
74
|
watch: {
|
75
|
-
fields
|
76
|
-
|
75
|
+
fields: {
|
76
|
+
handler(val, oldVal) {
|
77
|
+
if (oldVal.length === 0) {
|
78
|
+
this.initConfig();
|
79
|
+
}
|
80
|
+
},
|
81
|
+
deep: true
|
77
82
|
},
|
78
83
|
config(val) {
|
79
84
|
this.initConfig();
|
@@ -84,22 +89,55 @@ export default {
|
|
84
89
|
},
|
85
90
|
methods: {
|
86
91
|
initConfig() {
|
87
|
-
this.
|
92
|
+
if (Object.keys(this.config).length) {
|
93
|
+
this.$refs.configRef.tableConfig = this.config;
|
94
|
+
}
|
95
|
+
|
96
|
+
const searchFields = [];
|
88
97
|
const searchFieldsIndexs = [];
|
89
98
|
if (this.config.search) {
|
90
|
-
const
|
91
|
-
for (const item of
|
99
|
+
const searchOptions = this.config.search.options;
|
100
|
+
for (const item of searchOptions) {
|
92
101
|
for (let i = 0; i < this.fields.length; i++) {
|
93
102
|
const element = this.fields[i];
|
94
103
|
if (element.prop === item.prop) {
|
95
|
-
|
104
|
+
searchFields.push(item);
|
96
105
|
searchFieldsIndexs.push(i);
|
97
106
|
}
|
98
107
|
}
|
99
108
|
}
|
109
|
+
this.searchFields = searchFields;
|
110
|
+
this.$refs.configRef.search = {
|
111
|
+
fields: searchFieldsIndexs,
|
112
|
+
isCheckAll: searchFieldsIndexs.length === this.fields.length,
|
113
|
+
isIndeterminate:
|
114
|
+
searchFieldsIndexs.length > 0 &&
|
115
|
+
searchFieldsIndexs.length < this.fields.length
|
116
|
+
};
|
100
117
|
}
|
101
118
|
|
102
|
-
|
119
|
+
const tableFields = [];
|
120
|
+
const tableFieldsIndexs = [];
|
121
|
+
if (this.config.table) {
|
122
|
+
const tableOptions = this.config.table.options;
|
123
|
+
for (const item of tableOptions) {
|
124
|
+
for (let i = 0; i < this.fields.length; i++) {
|
125
|
+
const element = this.fields[i];
|
126
|
+
if (element.prop === item.prop) {
|
127
|
+
tableFields.push(item);
|
128
|
+
tableFieldsIndexs.push(i);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
this.tableFields = tableFields;
|
133
|
+
this.$refs.configRef.table = {
|
134
|
+
fields: tableFieldsIndexs,
|
135
|
+
isCheckAll: tableFieldsIndexs.length === this.fields.length,
|
136
|
+
isIndeterminate:
|
137
|
+
tableFieldsIndexs.length > 0 &&
|
138
|
+
tableFieldsIndexs.length < this.fields.length
|
139
|
+
};
|
140
|
+
}
|
103
141
|
},
|
104
142
|
handleFieldsChange(val) {
|
105
143
|
const type = val.type;
|
@@ -238,23 +238,12 @@ const tableConfig = {
|
|
238
238
|
options: [
|
239
239
|
{
|
240
240
|
type: "input",
|
241
|
-
label: "
|
241
|
+
label: "平台名称",
|
242
242
|
prop: "name",
|
243
243
|
defaultValue: "",
|
244
244
|
align: "left",
|
245
245
|
width: 0
|
246
246
|
}
|
247
|
-
// {
|
248
|
-
// type: "select",
|
249
|
-
// label: "性别",
|
250
|
-
// prop: "gender",
|
251
|
-
// align: "left",
|
252
|
-
// width: 0,
|
253
|
-
// staticData: [
|
254
|
-
// { label: "男", value: "1" },
|
255
|
-
// { label: "女", value: "0" }
|
256
|
-
// ]
|
257
|
-
// }
|
258
247
|
]
|
259
248
|
},
|
260
249
|
table: {
|
@@ -286,17 +275,10 @@ const tableConfig = {
|
|
286
275
|
sortable: true,
|
287
276
|
align: "left",
|
288
277
|
width: 0
|
289
|
-
},
|
290
|
-
{
|
291
|
-
label: "编辑时间",
|
292
|
-
type: "input",
|
293
|
-
prop: "updateTime",
|
294
|
-
align: "left",
|
295
|
-
width: 0
|
296
278
|
}
|
297
279
|
],
|
298
280
|
pageInfo: {
|
299
|
-
show:
|
281
|
+
show: false,
|
300
282
|
options: {
|
301
283
|
pageCount: 0, // 总页数
|
302
284
|
pageSize: 20, // 每页展示的条数
|
@@ -318,7 +300,7 @@ const tableConfig = {
|
|
318
300
|
batchDelete: { show: true, name: "批量删除", position: 1 },
|
319
301
|
export: { show: true, name: "导出", position: 1 },
|
320
302
|
import: { show: true, name: "导入", position: 1 },
|
321
|
-
key_123456:{}
|
303
|
+
key_123456: {}
|
322
304
|
},
|
323
305
|
network: {
|
324
306
|
mounted: {
|
@@ -50,7 +50,7 @@
|
|
50
50
|
label-width="80px"
|
51
51
|
size="mini"
|
52
52
|
>
|
53
|
-
<el-collapse v-model="tableCollapse"
|
53
|
+
<el-collapse v-model="tableCollapse">
|
54
54
|
<el-collapse-item title="表格配置" name="1">
|
55
55
|
<el-form-item label="高级查询">
|
56
56
|
<el-switch v-model="tableConfig.search.show"> </el-switch>
|
@@ -241,12 +241,13 @@ export default {
|
|
241
241
|
tools: {
|
242
242
|
add: { show: true, name: "新增", position: 1 },
|
243
243
|
edit: { show: true, name: "编辑", position: 2 },
|
244
|
-
detail: { show:
|
244
|
+
detail: { show: false, name: "查看", position: 2 },
|
245
245
|
delete: { show: true, name: "删除", position: 2 },
|
246
|
-
batchDelete: { show:
|
247
|
-
export: { show:
|
248
|
-
import: { show:
|
249
|
-
}
|
246
|
+
batchDelete: { show: false, name: "批量删除", position: 1 },
|
247
|
+
export: { show: false, name: "导出", position: 1 },
|
248
|
+
import: { show: false, name: "导入", position: 1 }
|
249
|
+
},
|
250
|
+
network: {}
|
250
251
|
},
|
251
252
|
sortFieldOptions: [{ label: "创建时间", value: "createTime" }]
|
252
253
|
};
|