tianheng-ui 0.1.28 → 0.1.29

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.
@@ -5,8 +5,8 @@
5
5
  v-if="searchConfig.show"
6
6
  :data="searchData"
7
7
  :options="searchConfig.options"
8
- @on-search="requestListData"
9
- @on-reset="requestListData"
8
+ @search="requestListData"
9
+ @reset="requestListData"
10
10
  />
11
11
 
12
12
  <!-- 菜单栏 -->
@@ -17,11 +17,13 @@
17
17
  batchDelete: tableSelectionData.length === 0,
18
18
  export: tableSelectionData.length === 0
19
19
  }"
20
- @on-click="handleToolsClick"
20
+ @click="handleToolsClick"
21
21
  />
22
22
 
23
+ <STable v-if="tableConfig" :data="tableData" :config="tableConfig"></STable>
24
+
23
25
  <!-- 表格 -->
24
- <th-table
26
+ <!-- <th-table
25
27
  v-if="tableConfig.options.length"
26
28
  ref="tableRef"
27
29
  :data="tableData"
@@ -53,7 +55,7 @@
53
55
  >
54
56
  </th-table-action>
55
57
  </template>
56
- </th-table>
58
+ </th-table> -->
57
59
 
58
60
  <!-- 表单 -->
59
61
  <th-dialog
@@ -88,11 +90,11 @@
88
90
  <script>
89
91
  import Search from "./custom/items/search";
90
92
  import Tools from "./custom/items/tools";
91
- import { toolsItemConfig } from "./util/index";
93
+ import STable from "./custom/items/table";
92
94
  import * as Axios from "lib/theme-chalk/js/axios";
93
95
  export default {
94
96
  name: "thTableGenerate",
95
- components: { Search, Tools },
97
+ components: { Search, Tools, STable },
96
98
  props: {
97
99
  config: Object,
98
100
  oauthConfig: {
@@ -136,8 +138,17 @@ export default {
136
138
  searchConfig: { show: false, options: [] },
137
139
  searchData: {},
138
140
  toolsConfig: { show: false, options: [] },
139
- tableConfig: { options: [], pageInfo: {} },
140
- tableData: [],
141
+ tableConfig: null,
142
+ tableData: [
143
+ { id: 1 },
144
+ { id: 2 },
145
+ { id: 3 },
146
+ { id: 4 },
147
+ { id: 5 },
148
+ { id: 6 },
149
+ { id: 7 },
150
+ { id: 8 }
151
+ ],
141
152
  tableSelectionData: [],
142
153
  dialog: { show: false, data: {}, action: {} },
143
154
  formConfig: null,
@@ -195,19 +206,14 @@ export default {
195
206
 
196
207
  // 搜索栏
197
208
  this.searchConfig = this.tableJson.search;
198
- if (this.searchConfig.show) {
199
- this.searchConfig.options.map(item => {
200
- this.$set(this.searchData, item.prop, item.defaultValue || "");
201
- });
202
- }
209
+ this.searchConfig.options.map(item => {
210
+ this.$set(this.searchData, item.prop, item.defaultValue || "");
211
+ });
203
212
 
204
213
  // table
205
- for (let i = 0; i < this.tableJson.table.options.length; i++) {
206
- const element = this.tableJson.table.options[i];
207
- delete element.type;
208
- }
209
- if (this.tableJson.table.sequence) {
210
- this.tableJson.table.options.unshift({
214
+ this.tableConfig = this.tableJson.table;
215
+ if (this.tableConfig.sequence) {
216
+ this.tableConfig.options.unshift({
211
217
  type: "index",
212
218
  label: "序号"
213
219
  });
@@ -220,32 +226,28 @@ export default {
220
226
  actions: []
221
227
  };
222
228
 
229
+ // tools
230
+ this.toolsConfig = { show: false, options: [] };
223
231
  // 按position处理按钮,1:公共区,2:行内区
224
- for (const key in this.tableJson.tools) {
225
- if (Object.hasOwnProperty.call(this.tableJson.tools, key)) {
226
- const element = this.tableJson.tools[key];
227
- if (!element.show) continue;
228
- if (key === "batchDelete") {
229
- this.tableJson.table.options.unshift({
230
- type: "selection"
231
- });
232
- }
233
- const dic = toolsItemConfig(key, element);
234
- dic.form = element.form;
235
- if (element.position === 1 || element.position === "header") {
236
- this.toolsConfig.show = true;
237
- this.toolsConfig.options.push(dic);
238
- } else if (element.position === 2 || element.position === "row") {
239
- action.hide = false;
240
- action.actions.push(dic);
241
- }
232
+ Object.values(this.tableJson.tools).map(item => {
233
+ if (!item.show) return;
234
+ if (item.type === "batchDelete") {
235
+ this.tableConfig.options.unshift({
236
+ type: "selection"
237
+ });
242
238
  }
243
- }
239
+ if (item.position === 1 || item.position === "header") {
240
+ this.toolsConfig.show = true;
241
+ this.toolsConfig.options.push(item);
242
+ } else if (item.position === 2 || item.position === "row") {
243
+ action.hide = false;
244
+ action.actions.push(item);
245
+ }
246
+ });
244
247
  action.width = action.actions.length * 60 + 20;
245
- this.tableJson.table.options.push(action);
248
+ if (!action.hide) this.tableConfig.options.push(action);
246
249
 
247
- this.tableConfig = this.tableJson.table;
248
- this.requestListData();
250
+ // this.requestListData();
249
251
  },
250
252
  requestListData() {
251
253
  if (!this.networkConfig.mounted) return;
@@ -396,7 +398,7 @@ export default {
396
398
  },
397
399
  handleToolsClick(action) {
398
400
  console.log("handleToolsClick =>", action);
399
- switch (action.act) {
401
+ switch (action.type) {
400
402
  case "add":
401
403
  this.dialog = { show: true, data: {}, action: action };
402
404
  this.requestFormConfigData(action);
@@ -606,7 +606,7 @@ export default {
606
606
  label: item.note || item.name,
607
607
  alias: item.name,
608
608
  prop: item.name,
609
- type: "input",
609
+ elType: "input",
610
610
  align: "left"
611
611
  };
612
612
  });
@@ -31,11 +31,10 @@
31
31
  <div class="table-item-custom drag">
32
32
  <i class="iconfont icon-drag drag-widget"></i>
33
33
  </div>
34
- <div>{{ item.label }}</div>
35
- <!-- <div>{{ item.prop }}</div> -->
34
+ <el-input v-model="item.label" size="mini"></el-input>
36
35
  <div>
37
36
  <el-select
38
- v-model="item.type"
37
+ v-model="item.elType"
39
38
  placeholder="请选择"
40
39
  size="mini"
41
40
  disabled
@@ -103,8 +102,7 @@
103
102
  <div class="table-item-custom drag">
104
103
  <i class="iconfont icon-drag drag-widget"></i>
105
104
  </div>
106
- <div>{{ item.label }}</div>
107
- <!-- <div>{{ item.prop }}</div> -->
105
+ <el-input v-model="item.label" size="mini"></el-input>
108
106
  <div>
109
107
  <el-select v-model="item.align" placeholder="请选择" size="mini">
110
108
  <el-option