vue2-client 1.4.2 → 1.4.3

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.
Files changed (99) hide show
  1. package/.env +15 -15
  2. package/.eslintrc.js +82 -82
  3. package/index.js +30 -30
  4. package/package.json +78 -78
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  6. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +113 -113
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +244 -244
  8. package/src/base-client/components/common/CitySelect/index.js +3 -3
  9. package/src/base-client/components/common/CitySelect/index.md +109 -109
  10. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +589 -543
  11. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  12. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +310 -310
  13. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  14. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  15. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  16. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +210 -210
  17. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  18. package/src/base-client/components/common/Upload/index.js +3 -3
  19. package/src/base-client/components/common/XAddForm/XAddForm.vue +354 -354
  20. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  21. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  22. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  23. package/src/base-client/components/common/XForm/XFormItem.vue +389 -389
  24. package/src/base-client/components/common/XFormTable/index.md +96 -96
  25. package/src/base-client/components/common/XTable/XTable.vue +259 -259
  26. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  27. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  28. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  29. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  30. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  31. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  32. package/src/base-client/plugins/AppData.js +69 -69
  33. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  34. package/src/base-client/plugins/PagedList.js +177 -177
  35. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  36. package/src/base-client/plugins/i18n-extend.js +32 -32
  37. package/src/components/Ellipsis/index.md +38 -38
  38. package/src/components/NumberInfo/index.md +43 -43
  39. package/src/components/STable/README.md +341 -341
  40. package/src/components/STable/index.js +318 -318
  41. package/src/components/Trend/index.md +45 -45
  42. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  43. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  44. package/src/components/exception/ExceptionPage.vue +70 -70
  45. package/src/components/form/FormRow.vue +52 -52
  46. package/src/components/index.js +36 -36
  47. package/src/components/menu/SideMenu.vue +62 -62
  48. package/src/components/menu/menu.js +273 -273
  49. package/src/components/setting/Setting.vue +235 -235
  50. package/src/components/table/StandardTable.vue +141 -141
  51. package/src/components/table/advance/ActionColumns.vue +158 -158
  52. package/src/components/table/advance/SearchArea.vue +355 -355
  53. package/src/components/tool/AStepItem.vue +60 -60
  54. package/src/components/tool/AvatarList.vue +68 -68
  55. package/src/components/tool/Drawer.vue +142 -142
  56. package/src/components/tool/TagSelect.vue +83 -83
  57. package/src/components/transition/PageToggleTransition.vue +97 -97
  58. package/src/config/CreateQueryConfig.js +307 -307
  59. package/src/config/replacer/resolve.config.js +67 -67
  60. package/src/layouts/AdminLayout.vue +174 -174
  61. package/src/layouts/header/AdminHeader.vue +104 -104
  62. package/src/layouts/header/HeaderNotice.vue +167 -167
  63. package/src/layouts/header/HeaderSearch.vue +67 -67
  64. package/src/layouts/header/InstitutionDetail.vue +181 -181
  65. package/src/layouts/tabs/TabsHead.vue +190 -190
  66. package/src/layouts/tabs/TabsView.vue +379 -379
  67. package/src/mock/goods/index.js +108 -108
  68. package/src/pages/CreateQueryPage.vue +65 -65
  69. package/src/pages/report/ReportTable.js +124 -124
  70. package/src/pages/report/ReportTableHome.vue +28 -28
  71. package/src/pages/resourceManage/orgListManage.vue +98 -98
  72. package/src/pages/system/dictionary/index.vue +43 -43
  73. package/src/pages/system/file/index.vue +317 -317
  74. package/src/pages/system/queryParams/index.vue +43 -43
  75. package/src/router/async/config.async.js +27 -27
  76. package/src/router/async/router.map.js +2 -0
  77. package/src/router/index.js +27 -27
  78. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  79. package/src/services/api/LogDetailsViewApi.js +10 -10
  80. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  81. package/src/services/api/TicketDetailsViewApi.js +34 -34
  82. package/src/services/api/commonTempTable.js +10 -10
  83. package/src/services/api/index.js +17 -17
  84. package/src/services/api/manage.js +8 -8
  85. package/src/services/api/restTools.js +24 -24
  86. package/src/store/mutation-types.js +2 -2
  87. package/src/theme/default/nprogress.less +76 -76
  88. package/src/theme/default/style.less +47 -47
  89. package/src/utils/colors.js +103 -103
  90. package/src/utils/excel/Blob.js +180 -180
  91. package/src/utils/excel/Export2Excel.js +141 -141
  92. package/src/utils/formatter.js +68 -68
  93. package/src/utils/i18n.js +80 -80
  94. package/src/utils/request.js +225 -225
  95. package/src/utils/routerUtil.js +364 -364
  96. package/src/utils/theme-color-replacer-extend.js +91 -91
  97. package/src/utils/themeUtil.js +100 -100
  98. package/src/utils/util.js +230 -230
  99. package/vue.config.js +2 -2
@@ -1,341 +1,341 @@
1
- Table 重封装组件说明
2
- ====
3
-
4
-
5
- 封装说明
6
- ----
7
-
8
- > 基础的使用方式与 API 与 [官方版(Table)](https://vuecomponent.github.io/ant-design-vue/components/table-cn/) 本一致,在其基础上,封装了加载数据的方法。
9
- >
10
- > 你无需在你是用表格的页面进行分页逻辑处理,仅需向 Table 组件传递绑定 `:data="Promise"` 对象即可
11
-
12
- 该 `table` 由 [@Saraka](https://github.com/saraka-tsukai) 完成封装
13
-
14
-
15
- 例子1
16
- ----
17
- (基础使用)
18
-
19
- ```vue
20
-
21
- <template>
22
- <s-table
23
- ref="table"
24
- size="default"
25
- :rowKey="(record) => record.data.id"
26
- :columns="columns"
27
- :data="loadData"
28
- :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
29
- >
30
- </s-table>
31
- </template>
32
-
33
- <script>
34
- import STable from '@vue2-client/components'
35
-
36
- export default {
37
- components: {
38
- STable
39
- },
40
- data() {
41
- return {
42
- columns: [
43
- {
44
- title: '规则编号',
45
- dataIndex: 'no'
46
- },
47
- {
48
- title: '描述',
49
- dataIndex: 'description'
50
- },
51
- {
52
- title: '服务调用次数',
53
- dataIndex: 'callNo',
54
- sorter: true,
55
- needTotal: true,
56
- customRender: (text) => text + ' 次'
57
- },
58
- {
59
- title: '状态',
60
- dataIndex: 'status',
61
- needTotal: true
62
- },
63
- {
64
- title: '更新时间',
65
- dataIndex: 'updatedAt',
66
- sorter: true
67
- }
68
- ],
69
- // 查询条件参数
70
- queryParam: {},
71
- // 加载数据方法 必须为 Promise 对象
72
- loadData: parameter => {
73
- return this.$http.get('/service', {
74
- params: Object.assign(parameter, this.queryParam)
75
- }).then(res => {
76
- return res.result
77
- })
78
- },
79
- selectedRowKeys: [],
80
- selectedRows: []
81
- }
82
- },
83
- methods: {
84
- onSelectChange (selectedRowKeys, selectedRows) {
85
- this.selectedRowKeys = selectedRowKeys
86
- this.selectedRows = selectedRows
87
- }
88
- }
89
- }
90
- </script>
91
-
92
- ```
93
-
94
-
95
-
96
- 例子2
97
- ----
98
-
99
- (简单的表格,最后一列是各种操作)
100
-
101
- ```vue
102
- <template>
103
- <s-table
104
- ref="table"
105
- size="default"
106
- :columns="columns"
107
- :data="loadData"
108
- >
109
- <span slot="action" slot-scope="text, record">
110
- <a>编辑</a>
111
- <a-divider type="vertical"/>
112
- <a-dropdown>
113
- <a class="ant-dropdown-link">
114
- 更多 <a-icon type="down"/>
115
- </a>
116
- <a-menu slot="overlay">
117
- <a-menu-item>
118
- <a href="javascript:;">1st menu item</a>
119
- </a-menu-item>
120
- <a-menu-item>
121
- <a href="javascript:;">2nd menu item</a>
122
- </a-menu-item>
123
- <a-menu-item>
124
- <a href="javascript:;">3rd menu item</a>
125
- </a-menu-item>
126
- </a-menu>
127
- </a-dropdown>
128
- </span>
129
- </s-table>
130
- </template>
131
-
132
- <script>
133
- import STable from '@vue2-client/components/table/'
134
-
135
- export default {
136
- components: {
137
- STable
138
- },
139
- data() {
140
- return {
141
- columns: [
142
- {
143
- title: '规则编号',
144
- dataIndex: 'no'
145
- },
146
- {
147
- title: '描述',
148
- dataIndex: 'description'
149
- },
150
- {
151
- title: '服务调用次数',
152
- dataIndex: 'callNo',
153
- },
154
- {
155
- title: '状态',
156
- dataIndex: 'status',
157
- },
158
- {
159
- title: '更新时间',
160
- dataIndex: 'updatedAt',
161
- },
162
- {
163
- table: '操作',
164
- dataIndex: 'action',
165
- scopedSlots: {customRender: 'action'},
166
- }
167
- ],
168
- // 查询条件参数
169
- queryParam: {},
170
- // 加载数据方法 必须为 Promise 对象
171
- loadData: parameter => {
172
- return this.$http.get('/service', {
173
- params: Object.assign(parameter, this.queryParam)
174
- }).then(res => {
175
- return res.result
176
- })
177
- },
178
- }
179
- },
180
- methods: {
181
- edit(row) {
182
- // axios 发送数据到后端 修改数据成功后
183
- // 调用 refresh() 重新加载列表数据
184
- // 这里 setTimeout 模拟发起请求的网络延迟..
185
- setTimeout(() => {
186
- this.$refs.table.refresh() // refresh() 不传参默认值 false 不刷新到分页第一页
187
- }, 1500)
188
-
189
- }
190
- }
191
- }
192
- </script>
193
- ```
194
-
195
-
196
-
197
- 内置方法
198
- ----
199
-
200
- 通过 `this.$refs.table` 调用
201
-
202
- `this.$refs.table.refresh(true)` 刷新列表 (用户新增/修改数据后,重载列表数据)
203
-
204
- > 注意:要调用 `refresh(bool)` 需要给表格组件设定 `ref` 值
205
- >
206
- > `refresh()` 方法可以传一个 `bool` 值,当有传值 或值为 `true` 时,则刷新时会强制刷新到第一页(常用户页面 搜索 按钮进行搜索时,结果从第一页开始分页)
207
-
208
-
209
- 内置属性
210
- ----
211
- > 除去 `a-table` 自带属性外,还而外提供了一些额外属性属性
212
-
213
-
214
- | 属性 | 说明 | 类型 | 默认值 |
215
- |----------------|----------------------------------|-------------------|-------------------|
216
- | alert | 设置是否显示表格信息栏 | [object, boolean] | null |
217
- | showPagination | 显示分页选择器,可传 'auto' \ | boolean | [string, boolean] | 'auto' |
218
- | data | 加载数据方法 必须为 `Promise` 对象 **必须绑定** | Promise | - |
219
-
220
-
221
- `alert` 属性对象:
222
-
223
- ```javascript
224
- alert: {
225
- show: Boolean,
226
- clear: [Function, Boolean]
227
- }
228
- ```
229
-
230
- 注意事项
231
- ----
232
-
233
- > 你可能需要为了与后端提供的接口返回结果一致而去修改以下代码:
234
- > (需要注意的是,这里的修改是全局性的,意味着整个项目所有使用该 table 组件都需要遵守这个返回结果定义的字段。)
235
- >
236
- > 文档中的结构有可能由于组件 bug 进行修正而改动。实际修改请以当时最新版本为准
237
-
238
- 修改 `@/components/table/index.js` 第 156 行起
239
-
240
-
241
-
242
- ```javascript
243
- result.then(r => {
244
- this.localPagination = this.showPagination && Object.assign({}, this.localPagination, {
245
- current: r.pageNo, // 返回结果中的当前分页数
246
- total: r.totalCount, // 返回结果中的总记录数
247
- showSizeChanger: this.showSizeChanger,
248
- pageSize: (pagination && pagination.pageSize) ||
249
- this.localPagination.pageSize
250
- }) || false
251
- // 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
252
- if (r.data.length === 0 && this.showPagination && this.localPagination.current > 1) {
253
- this.localPagination.current--
254
- this.loadData()
255
- return
256
- }
257
-
258
- // 这里用于判断接口是否有返回 r.totalCount 且 this.showPagination = true 且 pageNo 和 pageSize 存在 且 totalCount 小于等于 pageNo * pageSize 的大小
259
- // 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
260
- try {
261
- if ((['auto', true].includes(this.showPagination) && r.totalCount <= (r.pageNo * this.localPagination.pageSize))) {
262
- this.localPagination.hideOnSinglePage = true
263
- }
264
- } catch (e) {
265
- this.localPagination = false
266
- }
267
- console.log('loadData -> this.localPagination', this.localPagination)
268
- this.localDataSource = r.data // 返回结果中的数组数据
269
- this.localLoading = false
270
- })
271
- ```
272
- 返回 JSON 例子:
273
- ```json
274
- {
275
- "message": "",
276
- "result": {
277
- "data": [{
278
- "id": 1,
279
- "cover": "https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png",
280
- "title": "Alipay",
281
- "description": "那是一种内在的东西, 他们到达不了,也无法触及的",
282
- "status": 1,
283
- "updatedAt": "2018-07-26 00:00:00"
284
- },
285
- {
286
- "id": 2,
287
- "cover": "https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png",
288
- "title": "Angular",
289
- "description": "希望是一个好东西,也许是最好的,好东西是不会消亡的",
290
- "status": 1,
291
- "updatedAt": "2018-07-26 00:00:00"
292
- },
293
- {
294
- "id": 3,
295
- "cover": "https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png",
296
- "title": "Ant Design",
297
- "description": "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
298
- "status": 1,
299
- "updatedAt": "2018-07-26 00:00:00"
300
- },
301
- {
302
- "id": 4,
303
- "cover": "https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png",
304
- "title": "Ant Design Pro",
305
- "description": "那时候我只会想自己想要什么,从不想自己拥有什么",
306
- "status": 1,
307
- "updatedAt": "2018-07-26 00:00:00"
308
- },
309
- {
310
- "id": 5,
311
- "cover": "https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png",
312
- "title": "Bootstrap",
313
- "description": "凛冬将至",
314
- "status": 1,
315
- "updatedAt": "2018-07-26 00:00:00"
316
- },
317
- {
318
- "id": 6,
319
- "cover": "https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png",
320
- "title": "Vue",
321
- "description": "生命就像一盒巧克力,结果往往出人意料",
322
- "status": 1,
323
- "updatedAt": "2018-07-26 00:00:00"
324
- }
325
- ],
326
- "pageSize": 10,
327
- "pageNo": 0,
328
- "totalPage": 6,
329
- "totalCount": 57
330
- },
331
- "status": 200,
332
- "timestamp": 1534955098193
333
- }
334
- ```
335
-
336
-
337
-
338
- 更新时间
339
- ----
340
-
341
- 该文档最后更新于: 2019-06-23 PM 17:19
1
+ Table 重封装组件说明
2
+ ====
3
+
4
+
5
+ 封装说明
6
+ ----
7
+
8
+ > 基础的使用方式与 API 与 [官方版(Table)](https://vuecomponent.github.io/ant-design-vue/components/table-cn/) 本一致,在其基础上,封装了加载数据的方法。
9
+ >
10
+ > 你无需在你是用表格的页面进行分页逻辑处理,仅需向 Table 组件传递绑定 `:data="Promise"` 对象即可
11
+
12
+ 该 `table` 由 [@Saraka](https://github.com/saraka-tsukai) 完成封装
13
+
14
+
15
+ 例子1
16
+ ----
17
+ (基础使用)
18
+
19
+ ```vue
20
+
21
+ <template>
22
+ <s-table
23
+ ref="table"
24
+ size="default"
25
+ :rowKey="(record) => record.data.id"
26
+ :columns="columns"
27
+ :data="loadData"
28
+ :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
29
+ >
30
+ </s-table>
31
+ </template>
32
+
33
+ <script>
34
+ import STable from '@vue2-client/components'
35
+
36
+ export default {
37
+ components: {
38
+ STable
39
+ },
40
+ data() {
41
+ return {
42
+ columns: [
43
+ {
44
+ title: '规则编号',
45
+ dataIndex: 'no'
46
+ },
47
+ {
48
+ title: '描述',
49
+ dataIndex: 'description'
50
+ },
51
+ {
52
+ title: '服务调用次数',
53
+ dataIndex: 'callNo',
54
+ sorter: true,
55
+ needTotal: true,
56
+ customRender: (text) => text + ' 次'
57
+ },
58
+ {
59
+ title: '状态',
60
+ dataIndex: 'status',
61
+ needTotal: true
62
+ },
63
+ {
64
+ title: '更新时间',
65
+ dataIndex: 'updatedAt',
66
+ sorter: true
67
+ }
68
+ ],
69
+ // 查询条件参数
70
+ queryParam: {},
71
+ // 加载数据方法 必须为 Promise 对象
72
+ loadData: parameter => {
73
+ return this.$http.get('/service', {
74
+ params: Object.assign(parameter, this.queryParam)
75
+ }).then(res => {
76
+ return res.result
77
+ })
78
+ },
79
+ selectedRowKeys: [],
80
+ selectedRows: []
81
+ }
82
+ },
83
+ methods: {
84
+ onSelectChange (selectedRowKeys, selectedRows) {
85
+ this.selectedRowKeys = selectedRowKeys
86
+ this.selectedRows = selectedRows
87
+ }
88
+ }
89
+ }
90
+ </script>
91
+
92
+ ```
93
+
94
+
95
+
96
+ 例子2
97
+ ----
98
+
99
+ (简单的表格,最后一列是各种操作)
100
+
101
+ ```vue
102
+ <template>
103
+ <s-table
104
+ ref="table"
105
+ size="default"
106
+ :columns="columns"
107
+ :data="loadData"
108
+ >
109
+ <span slot="action" slot-scope="text, record">
110
+ <a>编辑</a>
111
+ <a-divider type="vertical"/>
112
+ <a-dropdown>
113
+ <a class="ant-dropdown-link">
114
+ 更多 <a-icon type="down"/>
115
+ </a>
116
+ <a-menu slot="overlay">
117
+ <a-menu-item>
118
+ <a href="javascript:;">1st menu item</a>
119
+ </a-menu-item>
120
+ <a-menu-item>
121
+ <a href="javascript:;">2nd menu item</a>
122
+ </a-menu-item>
123
+ <a-menu-item>
124
+ <a href="javascript:;">3rd menu item</a>
125
+ </a-menu-item>
126
+ </a-menu>
127
+ </a-dropdown>
128
+ </span>
129
+ </s-table>
130
+ </template>
131
+
132
+ <script>
133
+ import STable from '@vue2-client/components/table/'
134
+
135
+ export default {
136
+ components: {
137
+ STable
138
+ },
139
+ data() {
140
+ return {
141
+ columns: [
142
+ {
143
+ title: '规则编号',
144
+ dataIndex: 'no'
145
+ },
146
+ {
147
+ title: '描述',
148
+ dataIndex: 'description'
149
+ },
150
+ {
151
+ title: '服务调用次数',
152
+ dataIndex: 'callNo',
153
+ },
154
+ {
155
+ title: '状态',
156
+ dataIndex: 'status',
157
+ },
158
+ {
159
+ title: '更新时间',
160
+ dataIndex: 'updatedAt',
161
+ },
162
+ {
163
+ table: '操作',
164
+ dataIndex: 'action',
165
+ scopedSlots: {customRender: 'action'},
166
+ }
167
+ ],
168
+ // 查询条件参数
169
+ queryParam: {},
170
+ // 加载数据方法 必须为 Promise 对象
171
+ loadData: parameter => {
172
+ return this.$http.get('/service', {
173
+ params: Object.assign(parameter, this.queryParam)
174
+ }).then(res => {
175
+ return res.result
176
+ })
177
+ },
178
+ }
179
+ },
180
+ methods: {
181
+ edit(row) {
182
+ // axios 发送数据到后端 修改数据成功后
183
+ // 调用 refresh() 重新加载列表数据
184
+ // 这里 setTimeout 模拟发起请求的网络延迟..
185
+ setTimeout(() => {
186
+ this.$refs.table.refresh() // refresh() 不传参默认值 false 不刷新到分页第一页
187
+ }, 1500)
188
+
189
+ }
190
+ }
191
+ }
192
+ </script>
193
+ ```
194
+
195
+
196
+
197
+ 内置方法
198
+ ----
199
+
200
+ 通过 `this.$refs.table` 调用
201
+
202
+ `this.$refs.table.refresh(true)` 刷新列表 (用户新增/修改数据后,重载列表数据)
203
+
204
+ > 注意:要调用 `refresh(bool)` 需要给表格组件设定 `ref` 值
205
+ >
206
+ > `refresh()` 方法可以传一个 `bool` 值,当有传值 或值为 `true` 时,则刷新时会强制刷新到第一页(常用户页面 搜索 按钮进行搜索时,结果从第一页开始分页)
207
+
208
+
209
+ 内置属性
210
+ ----
211
+ > 除去 `a-table` 自带属性外,还而外提供了一些额外属性属性
212
+
213
+
214
+ | 属性 | 说明 | 类型 | 默认值 |
215
+ |----------------|----------------------------------|-------------------|-------------------|
216
+ | alert | 设置是否显示表格信息栏 | [object, boolean] | null |
217
+ | showPagination | 显示分页选择器,可传 'auto' \ | boolean | [string, boolean] | 'auto' |
218
+ | data | 加载数据方法 必须为 `Promise` 对象 **必须绑定** | Promise | - |
219
+
220
+
221
+ `alert` 属性对象:
222
+
223
+ ```javascript
224
+ alert: {
225
+ show: Boolean,
226
+ clear: [Function, Boolean]
227
+ }
228
+ ```
229
+
230
+ 注意事项
231
+ ----
232
+
233
+ > 你可能需要为了与后端提供的接口返回结果一致而去修改以下代码:
234
+ > (需要注意的是,这里的修改是全局性的,意味着整个项目所有使用该 table 组件都需要遵守这个返回结果定义的字段。)
235
+ >
236
+ > 文档中的结构有可能由于组件 bug 进行修正而改动。实际修改请以当时最新版本为准
237
+
238
+ 修改 `@/components/table/index.js` 第 156 行起
239
+
240
+
241
+
242
+ ```javascript
243
+ result.then(r => {
244
+ this.localPagination = this.showPagination && Object.assign({}, this.localPagination, {
245
+ current: r.pageNo, // 返回结果中的当前分页数
246
+ total: r.totalCount, // 返回结果中的总记录数
247
+ showSizeChanger: this.showSizeChanger,
248
+ pageSize: (pagination && pagination.pageSize) ||
249
+ this.localPagination.pageSize
250
+ }) || false
251
+ // 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
252
+ if (r.data.length === 0 && this.showPagination && this.localPagination.current > 1) {
253
+ this.localPagination.current--
254
+ this.loadData()
255
+ return
256
+ }
257
+
258
+ // 这里用于判断接口是否有返回 r.totalCount 且 this.showPagination = true 且 pageNo 和 pageSize 存在 且 totalCount 小于等于 pageNo * pageSize 的大小
259
+ // 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
260
+ try {
261
+ if ((['auto', true].includes(this.showPagination) && r.totalCount <= (r.pageNo * this.localPagination.pageSize))) {
262
+ this.localPagination.hideOnSinglePage = true
263
+ }
264
+ } catch (e) {
265
+ this.localPagination = false
266
+ }
267
+ console.log('loadData -> this.localPagination', this.localPagination)
268
+ this.localDataSource = r.data // 返回结果中的数组数据
269
+ this.localLoading = false
270
+ })
271
+ ```
272
+ 返回 JSON 例子:
273
+ ```json
274
+ {
275
+ "message": "",
276
+ "result": {
277
+ "data": [{
278
+ "id": 1,
279
+ "cover": "https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png",
280
+ "title": "Alipay",
281
+ "description": "那是一种内在的东西, 他们到达不了,也无法触及的",
282
+ "status": 1,
283
+ "updatedAt": "2018-07-26 00:00:00"
284
+ },
285
+ {
286
+ "id": 2,
287
+ "cover": "https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png",
288
+ "title": "Angular",
289
+ "description": "希望是一个好东西,也许是最好的,好东西是不会消亡的",
290
+ "status": 1,
291
+ "updatedAt": "2018-07-26 00:00:00"
292
+ },
293
+ {
294
+ "id": 3,
295
+ "cover": "https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png",
296
+ "title": "Ant Design",
297
+ "description": "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
298
+ "status": 1,
299
+ "updatedAt": "2018-07-26 00:00:00"
300
+ },
301
+ {
302
+ "id": 4,
303
+ "cover": "https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png",
304
+ "title": "Ant Design Pro",
305
+ "description": "那时候我只会想自己想要什么,从不想自己拥有什么",
306
+ "status": 1,
307
+ "updatedAt": "2018-07-26 00:00:00"
308
+ },
309
+ {
310
+ "id": 5,
311
+ "cover": "https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png",
312
+ "title": "Bootstrap",
313
+ "description": "凛冬将至",
314
+ "status": 1,
315
+ "updatedAt": "2018-07-26 00:00:00"
316
+ },
317
+ {
318
+ "id": 6,
319
+ "cover": "https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png",
320
+ "title": "Vue",
321
+ "description": "生命就像一盒巧克力,结果往往出人意料",
322
+ "status": 1,
323
+ "updatedAt": "2018-07-26 00:00:00"
324
+ }
325
+ ],
326
+ "pageSize": 10,
327
+ "pageNo": 0,
328
+ "totalPage": 6,
329
+ "totalCount": 57
330
+ },
331
+ "status": 200,
332
+ "timestamp": 1534955098193
333
+ }
334
+ ```
335
+
336
+
337
+
338
+ 更新时间
339
+ ----
340
+
341
+ 该文档最后更新于: 2019-06-23 PM 17:19