vue2-client 1.7.0 → 1.7.1

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 (126) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +31 -1
  3. package/Components.md +60 -0
  4. package/index.js +39 -30
  5. package/package.json +4 -2
  6. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  8. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -667
  9. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -733
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -468
  11. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -508
  12. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -146
  13. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  14. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  15. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -325
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +365 -279
  18. package/src/base-client/components/common/XAddNativeForm/index.md +96 -56
  19. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  20. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -0
  21. package/src/base-client/components/common/XDataDrawer/index.js +3 -0
  22. package/src/base-client/components/common/XDataDrawer/index.md +41 -0
  23. package/src/base-client/components/common/XForm/XForm.vue +178 -180
  24. package/src/base-client/components/common/XForm/XFormItem.vue +521 -513
  25. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  26. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  27. package/src/base-client/components/common/XFormTable/XFormTable.vue +356 -344
  28. package/src/base-client/components/common/XFormTable/index.md +97 -97
  29. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  30. package/src/base-client/components/common/XTable/XTable.vue +519 -506
  31. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  32. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  33. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  34. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  35. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  36. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  37. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  38. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  39. package/src/base-client/plugins/AppData.js +76 -76
  40. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  41. package/src/base-client/plugins/PagedList.js +177 -177
  42. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  43. package/src/base-client/plugins/i18n-extend.js +32 -32
  44. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  45. package/src/components/Ellipsis/index.md +38 -38
  46. package/src/components/NumberInfo/index.md +43 -43
  47. package/src/components/STable/README.md +341 -341
  48. package/src/components/STable/index.js +318 -318
  49. package/src/components/Trend/index.md +45 -45
  50. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  51. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  52. package/src/components/exception/ExceptionPage.vue +70 -70
  53. package/src/components/form/FormRow.vue +52 -52
  54. package/src/components/index.js +36 -36
  55. package/src/components/menu/SideMenu.vue +62 -62
  56. package/src/components/menu/menu.js +273 -273
  57. package/src/components/page/header/index.less +40 -40
  58. package/src/components/setting/Setting.vue +235 -235
  59. package/src/components/table/StandardTable.vue +141 -141
  60. package/src/components/table/advance/ActionColumns.vue +158 -158
  61. package/src/components/table/advance/SearchArea.vue +355 -355
  62. package/src/components/tool/AStepItem.vue +60 -60
  63. package/src/components/tool/AvatarList.vue +68 -68
  64. package/src/components/tool/Drawer.vue +142 -142
  65. package/src/components/tool/TagSelect.vue +83 -83
  66. package/src/components/transition/PageToggleTransition.vue +97 -97
  67. package/src/config/CreateQueryConfig.js +307 -307
  68. package/src/config/default/admin.config.js +18 -18
  69. package/src/config/default/setting.config.js +3 -1
  70. package/src/config/replacer/resolve.config.js +67 -67
  71. package/src/layouts/CommonLayout.vue +42 -42
  72. package/src/layouts/ComponentLayoutOne.vue +47 -47
  73. package/src/layouts/PageLayout.vue +151 -151
  74. package/src/layouts/SinglePageView.vue +116 -116
  75. package/src/layouts/footer/PageFooter.vue +49 -49
  76. package/src/layouts/header/AdminHeader.vue +134 -134
  77. package/src/layouts/header/HeaderAvatar.vue +64 -64
  78. package/src/layouts/header/HeaderNotice.vue +176 -176
  79. package/src/layouts/header/HeaderSearch.vue +67 -67
  80. package/src/layouts/header/InstitutionDetail.vue +181 -181
  81. package/src/layouts/header/index.less +92 -92
  82. package/src/layouts/tabs/TabsHead.vue +190 -190
  83. package/src/layouts/tabs/TabsView.vue +379 -379
  84. package/src/mock/goods/index.js +108 -108
  85. package/src/pages/CreateQueryPage.vue +84 -84
  86. package/src/pages/login/Login.vue +369 -369
  87. package/src/pages/report/ReportTable.js +124 -124
  88. package/src/pages/report/ReportTableHome.vue +28 -28
  89. package/src/pages/resourceManage/orgListManage.vue +98 -98
  90. package/src/pages/system/dictionary/index.vue +43 -43
  91. package/src/pages/system/file/index.vue +317 -317
  92. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  93. package/src/pages/system/monitor/operLog/index.vue +36 -36
  94. package/src/pages/system/settings/index.vue +126 -126
  95. package/src/pages/system/settings/modifyPassword.vue +109 -109
  96. package/src/router/async/config.async.js +28 -28
  97. package/src/router/async/router.map.js +66 -66
  98. package/src/router/guards.js +52 -12
  99. package/src/router/index.js +27 -27
  100. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  101. package/src/services/api/LogDetailsViewApi.js +10 -10
  102. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  103. package/src/services/api/TicketDetailsViewApi.js +34 -34
  104. package/src/services/api/cas.js +79 -79
  105. package/src/services/api/common.js +137 -137
  106. package/src/services/api/commonTempTable.js +10 -10
  107. package/src/services/api/index.js +17 -17
  108. package/src/services/api/logininfor/index.js +6 -6
  109. package/src/services/api/manage.js +8 -8
  110. package/src/services/apiService.js +14 -14
  111. package/src/services/user.js +67 -67
  112. package/src/store/modules/index.js +4 -4
  113. package/src/theme/default/nprogress.less +76 -76
  114. package/src/theme/default/style.less +58 -58
  115. package/src/utils/EncryptUtil.js +53 -53
  116. package/src/utils/colors.js +107 -107
  117. package/src/utils/excel/Blob.js +180 -180
  118. package/src/utils/excel/Export2Excel.js +141 -141
  119. package/src/utils/formatter.js +68 -68
  120. package/src/utils/i18n.js +80 -80
  121. package/src/utils/login.js +138 -0
  122. package/src/utils/map-utils.js +37 -37
  123. package/src/utils/theme-color-replacer-extend.js +91 -91
  124. package/src/utils/themeUtil.js +100 -100
  125. package/src/utils/util.js +230 -230
  126. package/vue.config.js +106 -106
@@ -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