tianheng-ui 0.1.76 → 0.1.77

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.1.76",
4
+ "version": "0.1.77",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -45,6 +45,7 @@ export default {
45
45
  name: "thFormGenerate",
46
46
  components: { GenetateFormItem },
47
47
  props: {
48
+ businessId: String,
48
49
  formId: String,
49
50
  query: Object,
50
51
  oauthConfig: {
@@ -194,7 +195,7 @@ export default {
194
195
  const requestConfig = {
195
196
  url: api.url,
196
197
  method: api.method,
197
- headers: api.headers
198
+ headers: { ...api.headers, businessId: this.businessId }
198
199
  };
199
200
 
200
201
  // 因为是组件的远端接口,优先级:默认值 > 路由参数
@@ -255,7 +256,7 @@ export default {
255
256
  const requestConfig = {
256
257
  url: api.url,
257
258
  method: api.method,
258
- headers: api.headers
259
+ headers: { ...api.headers, businessId: this.businessId }
259
260
  };
260
261
  const params = {};
261
262
  for (let e of api.inParams) {
@@ -317,7 +318,8 @@ export default {
317
318
  method: api.method,
318
319
  headers: {
319
320
  ...api.headers,
320
- formId: this.formId
321
+ formId: this.formId,
322
+ businessId: this.businessId
321
323
  }
322
324
  };
323
325
  if (["get", "delete"].includes(api.method.toLowerCase()))
@@ -102,6 +102,10 @@ export default {
102
102
  mounted() {},
103
103
  methods: {
104
104
  getProperty: getProperty,
105
+ clearSelection() {
106
+ this.multipleSelection = [];
107
+ this.$refs.elTableRef.clearSelection();
108
+ },
105
109
  handleSelectionChange(val) {
106
110
  this.multipleSelection = val;
107
111
  },
@@ -115,10 +119,6 @@ export default {
115
119
  },
116
120
  handlePaginationChange() {
117
121
  this.$emit("change", this.config.pageInfo.options);
118
- },
119
- clearSelection() {
120
- this.multipleSelection = [];
121
- this.$refs.elTableRef.clearSelection();
122
122
  }
123
123
  }
124
124
  };
@@ -127,5 +127,8 @@ export default {
127
127
  <style lang="scss" scoped>
128
128
  .generateTable-table {
129
129
  width: 100%;
130
+ .el-pagination {
131
+ margin-top: 10px;
132
+ }
130
133
  }
131
134
  </style>
@@ -43,7 +43,7 @@
43
43
  <th-empty
44
44
  v-else
45
45
  :image="require('@/assets/images/notData.png')"
46
- :description="errorMessage || empty.description"
46
+ :description="empty.description"
47
47
  >
48
48
  <th-button type="primary" @click="initConfig">刷新</th-button>
49
49
  </th-empty>
@@ -59,10 +59,12 @@ import appConfig from "./config/index";
59
59
  import { deepClone, getProperty } from "./util";
60
60
  import * as Axios from "./network/axios";
61
61
  import * as XLSX from "xlsx/xlsx.mjs";
62
+ import { setProperty } from "../FormMaking/util";
62
63
  export default {
63
64
  name: "thTableGenerate",
64
65
  components: { Search, Tools, STable, Actions },
65
66
  props: {
67
+ businessId: String,
66
68
  config: Object,
67
69
  oauthConfig: {
68
70
  type: Object,
@@ -77,23 +79,6 @@ export default {
77
79
  description: "暂无数据"
78
80
  };
79
81
  }
80
- },
81
- network: {
82
- type: Object,
83
- default: () => {
84
- return {
85
- page: {
86
- url: "/api/lc/viewManage/getOne",
87
- method: "POST",
88
- params: {}
89
- },
90
- form: {
91
- url: "/api/lc/formConfig/getById",
92
- method: "get",
93
- params: {}
94
- }
95
- };
96
- }
97
82
  }
98
83
  },
99
84
  data() {
@@ -108,9 +93,6 @@ export default {
108
93
  tableConfig: null,
109
94
  tableData: [],
110
95
  tableSelectionData: [],
111
- tableActionsConfig: {},
112
- formConfig: null,
113
- errorMessage: "",
114
96
  query: {}
115
97
  };
116
98
  },
@@ -280,30 +262,20 @@ export default {
280
262
  type: "warning"
281
263
  })
282
264
  .then(() => {
283
- this.dialog.action.loading = true;
284
-
265
+ action.loading = true;
285
266
  this.axios(requestConfig)
286
267
  .then(res => {
287
268
  callback(true);
288
- this.dialog.action.loading = false;
269
+ action.loading = false;
289
270
  this.requestListData();
290
271
  })
291
272
  .catch(err => {
292
- this.dialog.action.loading = false;
273
+ action.loading = false;
293
274
  });
294
275
  })
295
276
  .catch(() => {});
296
277
  },
297
278
 
298
- // 通用请求
299
- requestApi(request, callback) {
300
- if (!request) return;
301
-
302
- this.axios(request)
303
- .then(res => {})
304
- .catch(err => {});
305
- },
306
-
307
279
  // 请求拦截器,返回请求体
308
280
  requestInterceptors(queryParams, networkId, action) {
309
281
  const api = this.networkConfig[networkId];
@@ -315,13 +287,14 @@ export default {
315
287
  const request = {
316
288
  url: api.url,
317
289
  method: api.method,
318
- headers: api.headers
290
+ headers: { ...api.headers, businessId: this.businessId }
319
291
  };
320
292
  let params = {};
321
293
  switch (action) {
322
294
  case "list":
323
295
  for (const item of api.inParams) {
324
- params[item.pAlias] = queryParams[item.pAlias] || null;
296
+ const value = getProperty(queryParams, item.pAlias) || null;
297
+ setProperty(params, item.pAlias, value);
325
298
  }
326
299
  if (this.tableConfig.pageInfo.show) {
327
300
  const pageInfo = this.tableConfig.pageInfo.options;
@@ -332,8 +305,11 @@ export default {
332
305
  break;
333
306
  case "delete":
334
307
  for (const item of api.inParams) {
335
- params[item.pAlias] =
336
- queryParams[item.pAlias] || this.query[item.pAlias];
308
+ const value =
309
+ getProperty(queryParams, item.pAlias) ||
310
+ getProperty(this.query, item.pAlias) ||
311
+ null;
312
+ setProperty(params, item.pAlias, value);
337
313
  }
338
314
  break;
339
315
  case "batchDelete":
@@ -414,17 +390,12 @@ export default {
414
390
  }
415
391
  },
416
392
 
393
+ // 导出
417
394
  handleExportExcelByTable(rows, fileName = "example") {
418
395
  const ws = XLSX.utils.json_to_sheet(rows);
419
396
  const wb = XLSX.utils.book_new();
420
397
  XLSX.utils.book_append_sheet(wb, ws, fileName);
421
398
  XLSX.writeFileXLSX(wb, `${fileName}.xlsx`);
422
- },
423
-
424
- // 表单提交按钮事件回调
425
- handleFormButtonSubmit() {
426
- this.handleDialogClose();
427
- this.requestListData();
428
399
  }
429
400
  }
430
401
  };
@@ -13,10 +13,24 @@
13
13
  </div>
14
14
  <div v-if="activeTab.value === 'field'" class="configItem fieldsView">
15
15
  <template
16
- v-if="fieldsData.inParams.length || fieldsData.outParams.length"
16
+ v-if="
17
+ fieldsData.inParams.length ||
18
+ fieldsData.outParams.length ||
19
+ config.table.fields.type === 'custom'
20
+ "
17
21
  >
18
22
  <el-collapse v-model="collapseValue">
19
- <el-collapse-item title="查询字段" name="group-fields_search">
23
+ <el-collapse-item name="group-fields_search">
24
+ <div slot="title" style="width:100%;">
25
+ <span>查询字段</span>
26
+ <!-- <el-button
27
+ v-if="config.table.fields.type === 'custom'"
28
+ style="float:right;padding:12px 10px;"
29
+ type="text"
30
+ @click="handleParamsAdd('in')"
31
+ >新增</el-button
32
+ > -->
33
+ </div>
20
34
  <el-tree
21
35
  ref="fieldsSearchTreeRef"
22
36
  :data="fieldsData.inParams"
@@ -30,7 +44,17 @@
30
44
  >
31
45
  </el-tree>
32
46
  </el-collapse-item>
33
- <el-collapse-item title="列表字段" name="group-fields_table">
47
+ <el-collapse-item name="group-fields_table">
48
+ <div slot="title" style="width:100%;">
49
+ <span>列表字段</span>
50
+ <!-- <el-button
51
+ v-if="config.table.fields.type === 'custom'"
52
+ style="float:right;padding:12px 10px;"
53
+ type="text"
54
+ @click="handleParamsAdd('out')"
55
+ >新增</el-button
56
+ > -->
57
+ </div>
34
58
  <el-tree
35
59
  ref="fieldsTableTreeRef"
36
60
  :data="fieldsData.outParams"
@@ -69,13 +93,15 @@
69
93
  <span style="color: #409EFF;">字段类型</span>
70
94
  </el-tooltip>
71
95
  <el-radio-group v-model="config.table.fields.type">
72
- <el-radio-button label="custom" disabled
73
- >自定义</el-radio-button
74
- >
96
+ <el-radio-button label="custom">自定义</el-radio-button>
75
97
  <el-radio-button label="api">接口导入</el-radio-button>
76
98
  </el-radio-group>
77
99
  </el-form-item>
78
- <el-form-item required prop="table.mounted.api">
100
+ <el-form-item
101
+ v-if="config.table.fields.type === 'api'"
102
+ required
103
+ prop="table.mounted.api"
104
+ >
79
105
  <el-tooltip
80
106
  slot="label"
81
107
  effect="light"
@@ -917,6 +943,7 @@ export default {
917
943
  this.config.table.options = nodes;
918
944
  }
919
945
  },
946
+ handleParamsAdd(action) {},
920
947
  // 对外暴露表单校验
921
948
  formValidate() {
922
949
  return new Promise((resolve, reject) => {
@@ -1,6 +1,15 @@
1
1
  <template>
2
2
  <div class="widgetTable">
3
- <div class="table-title">查询字段</div>
3
+ <div class="table-title">
4
+ <span>查询字段</span>
5
+ <el-button
6
+ v-if="config.table.fields.type === 'custom'"
7
+ style="float:right;padding:0px 10px;"
8
+ type="text"
9
+ @click="handleParamsAdd('in')"
10
+ >新增</el-button
11
+ >
12
+ </div>
4
13
  <div
5
14
  class="tableList searchList"
6
15
  v-loading="!config.search.show"
@@ -95,7 +104,16 @@
95
104
  </draggable>
96
105
  <div v-else class="search-content"></div>
97
106
  </div>
98
- <div class="table-title">列表字段</div>
107
+ <div class="table-title">
108
+ <span>列表字段</span>
109
+ <el-button
110
+ v-if="config.table.fields.type === 'custom'"
111
+ style="float:right;padding:0px 10px;"
112
+ type="text"
113
+ @click="handleParamsAdd('out')"
114
+ >新增</el-button
115
+ >
116
+ </div>
99
117
  <div class="tableList" style="height: calc(100% - 350px);">
100
118
  <div class="table-item table-header">
101
119
  <div class="table-item-custom">拖动</div>
@@ -246,6 +264,20 @@ export default {
246
264
  handleDialogAffirm() {
247
265
  this.dialog.data.staticData = this.codeEditorValue;
248
266
  this.dialog = { visible: false, title: "", data: null };
267
+ },
268
+ handleParamsAdd(action) {
269
+ if (action === "in") {
270
+ this.config.search.options.push({
271
+ alias: "",
272
+ align: "left",
273
+ elType: "input",
274
+ id: new Date().getTime(),
275
+ javaType: "String",
276
+ label: "字段名",
277
+ pAlias: "",
278
+ prop: ""
279
+ });
280
+ }
249
281
  }
250
282
  }
251
283
  };
@@ -259,8 +291,10 @@ export default {
259
291
  overflow-y: overlay;
260
292
 
261
293
  .table-title {
294
+ display: flex;
295
+ align-items: center;
296
+ justify-content: space-between;
262
297
  height: 25px;
263
- line-height: 25px;
264
298
  }
265
299
  .searchList {
266
300
  margin: 10px 0;