haiwei-ui 1.0.3 → 1.0.4

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 (109) hide show
  1. package/README.md +10 -0
  2. package/package.json +1 -1
  3. package/packages/components/box/index.vue +116 -125
  4. package/packages/components/box-col/index.vue +30 -33
  5. package/packages/components/box-row/index.vue +17 -17
  6. package/packages/components/box-small/index.vue +38 -38
  7. package/packages/components/button/index.vue +29 -42
  8. package/packages/components/button-copy/index.vue +46 -62
  9. package/packages/components/button-delete/index.vue +64 -77
  10. package/packages/components/button-delete-batch/index.vue +82 -95
  11. package/packages/components/button-has/index.vue +29 -42
  12. package/packages/components/checkbox-group/index.vue +85 -85
  13. package/packages/components/color-picker/index.vue +41 -50
  14. package/packages/components/container/index.vue +8 -8
  15. package/packages/components/date-range-picker/index.vue +92 -103
  16. package/packages/components/details/index.vue +72 -79
  17. package/packages/components/dialog/index.vue +281 -294
  18. package/packages/components/drag-sort/index.vue +36 -36
  19. package/packages/components/drag-sort-dialog/index.vue +58 -58
  20. package/packages/components/drawer/index.vue +157 -166
  21. package/packages/components/enums/sex/index.vue +1 -1
  22. package/packages/components/flex/index.vue +33 -33
  23. package/packages/components/form/index.vue +123 -138
  24. package/packages/components/form-dialog/index.vue +184 -217
  25. package/packages/components/form-page/index.vue +134 -151
  26. package/packages/components/icon/index.vue +6 -6
  27. package/packages/components/icon-picker/index.vue +30 -30
  28. package/packages/components/icon-picker/panel.vue +58 -58
  29. package/packages/components/label/index.vue +22 -30
  30. package/packages/components/list/components/export/index.vue +101 -99
  31. package/packages/components/list/components/footer/index.vue +42 -51
  32. package/packages/components/list/components/header/index.vue +34 -34
  33. package/packages/components/list/components/querybar/index.vue +144 -144
  34. package/packages/components/list/components/select-column/index.vue +30 -30
  35. package/packages/components/list/components/table/index.vue +169 -188
  36. package/packages/components/list/index.vue +337 -391
  37. package/packages/components/list-agile/index.vue +145 -145
  38. package/packages/components/list-dialog/index.vue +70 -84
  39. package/packages/components/listbox/index.vue +48 -48
  40. package/packages/components/login-default/index.vue +107 -107
  41. package/packages/components/login-neon/index.vue +104 -104
  42. package/packages/components/map/index.vue +229 -229
  43. package/packages/components/map-coord-picking/index.vue +220 -219
  44. package/packages/components/map-search/index.vue +75 -72
  45. package/packages/components/scrollbar/index.vue +11 -11
  46. package/packages/components/select-whether/index.vue +30 -30
  47. package/packages/components/split/index.vue +141 -141
  48. package/packages/components/split/trigger.vue +15 -15
  49. package/packages/components/tabnav/index.vue +125 -89
  50. package/packages/components/tabs/index.vue +31 -31
  51. package/packages/components/toolbar/components/fullscreen/index.vue +10 -10
  52. package/packages/components/toolbar/components/logout/index.vue +13 -13
  53. package/packages/components/toolbar/components/skin-toggle/form.vue +59 -59
  54. package/packages/components/toolbar/components/skin-toggle/index.vue +12 -12
  55. package/packages/components/toolbar/components/userInfo/index.vue +18 -18
  56. package/packages/components/toolbar/index.vue +12 -12
  57. package/packages/components/tree-select/mixins.vue +261 -270
  58. package/packages/components/txt/index.vue +17 -17
  59. package/packages/components/update-password/index.vue +45 -57
  60. package/packages/layout.vue +18 -18
  61. package/packages/mixins/components/checkbox.vue +71 -82
  62. package/packages/mixins/components/radio.vue +69 -69
  63. package/packages/page/403/index.vue +32 -28
  64. package/packages/page/404/index.vue +32 -28
  65. package/packages/page/default/index.vue +17 -13
  66. package/packages/page/iframe/index.vue +6 -6
  67. package/packages/page/login/index.vue +9 -9
  68. package/packages/page/userInfo/index.vue +5 -5
  69. package/packages/router/index.js +1 -9
  70. package/packages/skins/pretty/components/header/components/breadcrumb/index.vue +29 -29
  71. package/packages/skins/pretty/components/header/components/theme/index.vue +22 -21
  72. package/packages/skins/pretty/components/header/index.vue +12 -12
  73. package/packages/skins/pretty/components/main/index.vue +27 -27
  74. package/packages/skins/pretty/components/menus/index.vue +28 -28
  75. package/packages/skins/pretty/components/menus/item.vue +23 -23
  76. package/packages/skins/pretty/components/sidebar/index.vue +7 -7
  77. package/packages/skins/pretty/index.vue +6 -6
  78. package/packages/skins/pretty/styles/themes/blue-light/_index.scss +2 -2
  79. package/packages/skins/pretty/styles/themes/default/_index.scss +1 -1
  80. package/packages/skins/pretty/styles/themes/green/_index.scss +2 -2
  81. package/packages/skins/pretty/styles/themes/green-light/_index.scss +2 -2
  82. package/packages/styles/_mixins.scss +24 -25
  83. package/packages/styles/animation/_index.scss +22 -23
  84. package/packages/styles/animation/breadcrumb.scss +6 -6
  85. package/packages/styles/animation/fade.scss +11 -11
  86. package/packages/styles/animation/move.scss +98 -98
  87. package/packages/styles/components/box-small/_index.scss +58 -58
  88. package/packages/styles/components/button/_index.scss +7 -7
  89. package/packages/styles/components/container/_index.scss +26 -26
  90. package/packages/styles/components/date-range-picker/_index.scss +4 -4
  91. package/packages/styles/components/details/_index.scss +66 -67
  92. package/packages/styles/components/details-dialog/_index.scss +13 -13
  93. package/packages/styles/components/drag-sort/_index.scss +20 -20
  94. package/packages/styles/components/drag-sort-dialog/_index.scss +7 -7
  95. package/packages/styles/components/flex/_index.scss +56 -56
  96. package/packages/styles/components/form-dialog/_index.scss +11 -11
  97. package/packages/styles/components/icon/_index.scss +6 -6
  98. package/packages/styles/components/label/_index.scss +245 -245
  99. package/packages/styles/components/listbox/_index.scss +47 -47
  100. package/packages/styles/components/split/_index.scss +102 -102
  101. package/packages/styles/components/toolbar/_index.scss +98 -98
  102. package/packages/styles/components/txt/_index.scss +13 -13
  103. package/packages/styles/components/upload-dialog/_index.scss +44 -44
  104. package/packages/styles/components/upload-multiple/_index.scss +19 -19
  105. package/packages/styles/components/upload-single/_index.scss +16 -16
  106. package/packages/utils/resize-event.js +3 -3
  107. package/packages/vuter/attributes.json +30 -40
  108. package/packages/vuter/tags.json +11 -27
  109. package/public/lib/font/iconfont.js +47 -1
@@ -1,35 +1,14 @@
1
1
  <template>
2
2
  <section :class="class_" v-loading="showLoading" :element-loading-text="loadingText || loadingText_" :element-loading-background="loadingBackground" :element-loading-spinner="loadingSpinner">
3
3
  <!--header-->
4
- <query-header
5
- v-if="!noHeader"
6
- :title="title"
7
- :icon="icon"
8
- :no-fullscreen="noFullscreen"
9
- :fullscreen="fullscreen"
10
- :no-refresh="noRefresh"
11
- :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation !== 'querybar'"
12
- :exportBtnCode="exportOptions_.btnCode"
13
- >
4
+ <query-header v-if="!noHeader" :title="title" :icon="icon" :no-fullscreen="noFullscreen" :fullscreen="fullscreen" :no-refresh="noRefresh" :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation !== 'querybar'" :exportBtnCode="exportOptions_.btnCode">
14
5
  <template v-slot:toolbar>
15
6
  <slot name="header-toolbar" :total="total" :selection="selection" />
16
7
  </template>
17
8
  </query-header>
18
9
 
19
10
  <!--查询栏-->
20
- <querybar
21
- ref="querybar"
22
- v-if="!noQuerybar"
23
- :model="model"
24
- :rules="rules"
25
- :input-width="inputWidth"
26
- :advanced="advanced"
27
- :no-search="noSearch"
28
- :no-reset="noReset"
29
- :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation === 'querybar'"
30
- :export-btn-code="exportOptions_.btnCode"
31
- @reset="onQueryBarReset"
32
- >
11
+ <querybar ref="querybar" v-if="!noQuerybar" :model="model" :rules="rules" :input-width="inputWidth" :advanced="advanced" :no-search="noSearch" :no-reset="noReset" :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation === 'querybar'" :export-btn-code="exportOptions_.btnCode" @reset="onQueryBarReset">
33
12
  <template v-slot>
34
13
  <slot name="querybar" />
35
14
  </template>
@@ -42,20 +21,7 @@
42
21
  </querybar>
43
22
 
44
23
  <section class="nm-list-body">
45
- <query-table
46
- ref="table"
47
- :rows="rows"
48
- :cols="cols"
49
- :span-method="spanMethod"
50
- :selection="selection"
51
- :row-key="rowKey"
52
- :tree-props="treeProps"
53
- :default-expand-all="defaultExpandAll"
54
- :no-clear-selection="noClearSelection"
55
- :show-summary="showSummary"
56
- :sum-text="sumText"
57
- :summary-method="summaryMethod"
58
- >
24
+ <query-table ref="table" :rows="rows" :cols="cols" :span-method="spanMethod" :selection="selection" :row-key="rowKey" :tree-props="treeProps" :default-expand-all="defaultExpandAll" :no-clear-selection="noClearSelection" :show-summary="showSummary" :sum-text="sumText" :summary-method="summaryMethod">
59
25
  <!-- 多选 -->
60
26
  <el-table-column v-if="multiple" fixed="left" align="center" type="selection" width="55" />
61
27
 
@@ -73,18 +39,7 @@
73
39
 
74
40
  <!-- 自动生成列 -->
75
41
  <template v-for="(col, i) in columns">
76
- <el-table-column
77
- v-if="col.show"
78
- :key="i"
79
- :prop="col.name"
80
- :width="col.width"
81
- :sortable="col.sortable"
82
- :type="col.type"
83
- :fixed="col.fixed"
84
- :align="col.align"
85
- :header-align="col.headerAlign"
86
- :show-overflow-tooltip="col.showOverflowTooltip"
87
- >
42
+ <el-table-column v-if="col.show" :key="i" :prop="col.name" :width="col.width" :sortable="col.sortable" :type="col.type" :fixed="col.fixed" :align="col.align" :header-align="col.headerAlign" :show-overflow-tooltip="col.showOverflowTooltip">
88
43
  <!--自定义头-->
89
44
  <template v-slot:header>
90
45
  <slot :name="`col-${col.name}-header`">
@@ -114,16 +69,7 @@
114
69
  </section>
115
70
 
116
71
  <!--footer-->
117
- <query-footer
118
- v-if="!noFooter"
119
- v-model="page"
120
- :page-sizes="pageSizes"
121
- :total="total"
122
- :columns.sync="columns"
123
- :no-select-column="noSelectColumn"
124
- :no-search-button-icon="noSearchButtonIcon"
125
- :reverse="footerReverse"
126
- >
72
+ <query-footer v-if="!noFooter" v-model="page" :page-sizes="pageSizes" :total="total" :columns.sync="columns" :no-select-column="noSelectColumn" :no-search-button-icon="noSearchButtonIcon" :reverse="footerReverse">
127
73
  <slot name="footer" :total="total" :selection="selection" :data="data" />
128
74
  </query-footer>
129
75
  <slot />
@@ -133,363 +79,363 @@
133
79
  </section>
134
80
  </template>
135
81
  <script>
136
- import { mapState } from 'vuex'
137
- import def from './default.js'
138
- import QueryHeader from './components/header'
139
- import Querybar from './components/querybar'
140
- import QueryTable from './components/table'
141
- import QueryFooter from './components/footer'
142
- import QueryExport from './components/export'
82
+ import { mapState } from 'vuex'
83
+ import def from './default.js'
84
+ import QueryHeader from './components/header'
85
+ import Querybar from './components/querybar'
86
+ import QueryTable from './components/table'
87
+ import QueryFooter from './components/footer'
88
+ import QueryExport from './components/export'
143
89
 
144
- export default {
145
- name: 'List',
146
- components: { QueryHeader, Querybar, QueryTable, QueryFooter, QueryExport },
147
- data() {
148
- return {
149
- loading_: false,
150
- fullscreen: false,
151
- // 分页数据
152
- page: {
153
- index: 1,
154
- size: this.pageSizes[0],
155
- sort: []
156
- },
157
- // 数据列表
158
- rows: [],
159
- // 扩展数据
160
- data: '',
161
- // 总数量
162
- total: 0,
163
- selection: [],
164
- showExport: false,
165
- columns: []
166
- }
167
- },
168
- props: {
169
- /** 标题 */
170
- title: String,
171
- /** 图标 */
172
- icon: String,
173
- // 查询方法
174
- action: {
175
- type: Function,
176
- required: true
177
- },
178
- /** 查询表单输入框宽度 */
179
- inputWidth: String,
180
- // 模型
181
- model: Object,
182
- /** 模型验证规则 */
183
- rules: Object,
184
- /** 高级查询 */
185
- advanced: Object,
186
- // 列数组
187
- cols: {
188
- type: Array,
189
- default() {
190
- return []
191
- }
192
- },
193
- /** 多选 */
194
- multiple: Boolean,
195
- /** 显示序号 */
196
- showNo: {
197
- type: Boolean,
198
- default: true
199
- },
200
- /** 不显示操作列 */
201
- noOperation: Boolean,
202
- /** 操作列宽度 */
203
- operationWidth: [String, Number],
204
- /** 不显示选择列按钮 */
205
- noSelectColumn: Boolean,
206
- /** 不显示查询栏 */
207
- noQuerybar: Boolean,
208
- /** 不显示全屏按钮 */
209
- noFullscreen: Boolean,
210
- /** 不显示刷新按钮 */
211
- noRefresh: Boolean,
212
- /** 不显示头部 */
213
- noHeader: Boolean,
214
- /** 不显示底部 */
215
- noFooter: Boolean,
216
- /** 不包含搜索功能 */
217
- noSearch: Boolean,
218
- /** 不显示查询按钮图标 */
219
- noSearchButtonIcon: Boolean,
220
- /**不显示重置按钮 */
221
- noReset: Boolean,
222
- /** 底部反转 */
223
- footerReverse: Boolean,
224
- /** 合并行列的方法 */
225
- spanMethod: Function,
226
- /** 加载中动画 */
227
- loading: Boolean,
228
- /** 加载中文本 */
229
- loadingText: String,
230
- /** 创建后执行一次查询 */
231
- queryOnCreated: {
232
- type: Boolean,
233
- default: true
234
- },
235
- /**导出配置 */
236
- exportOptions: Object,
237
- /** 页数选择项 */
238
- pageSizes: {
239
- type: Array,
240
- default() {
241
- return [10, 15, 50, 100]
90
+ export default {
91
+ name: 'List',
92
+ components: { QueryHeader, Querybar, QueryTable, QueryFooter, QueryExport },
93
+ data() {
94
+ return {
95
+ loading_: false,
96
+ fullscreen: false,
97
+ // 分页数据
98
+ page: {
99
+ index: 1,
100
+ size: this.pageSizes[0],
101
+ sort: []
102
+ },
103
+ // 数据列表
104
+ rows: [],
105
+ // 扩展数据
106
+ data: '',
107
+ // 总数量
108
+ total: 0,
109
+ selection: [],
110
+ showExport: false,
111
+ columns: []
242
112
  }
243
113
  },
244
- /**渲染嵌套数据的配置选项 */
245
- treeProps: Object,
246
- /*行数据的 Key,用来优化 Table 的渲染;
114
+ props: {
115
+ /** 标题 */
116
+ title: String,
117
+ /** 图标 */
118
+ icon: String,
119
+ // 查询方法
120
+ action: {
121
+ type: Function,
122
+ required: true
123
+ },
124
+ /** 查询表单输入框宽度 */
125
+ inputWidth: String,
126
+ // 模型
127
+ model: Object,
128
+ /** 模型验证规则 */
129
+ rules: Object,
130
+ /** 高级查询 */
131
+ advanced: Object,
132
+ // 列数组
133
+ cols: {
134
+ type: Array,
135
+ default() {
136
+ return []
137
+ }
138
+ },
139
+ /** 多选 */
140
+ multiple: Boolean,
141
+ /** 显示序号 */
142
+ showNo: {
143
+ type: Boolean,
144
+ default: true
145
+ },
146
+ /** 不显示操作列 */
147
+ noOperation: Boolean,
148
+ /** 操作列宽度 */
149
+ operationWidth: [String, Number],
150
+ /** 不显示选择列按钮 */
151
+ noSelectColumn: Boolean,
152
+ /** 不显示查询栏 */
153
+ noQuerybar: Boolean,
154
+ /** 不显示全屏按钮 */
155
+ noFullscreen: Boolean,
156
+ /** 不显示刷新按钮 */
157
+ noRefresh: Boolean,
158
+ /** 不显示头部 */
159
+ noHeader: Boolean,
160
+ /** 不显示底部 */
161
+ noFooter: Boolean,
162
+ /** 不包含搜索功能 */
163
+ noSearch: Boolean,
164
+ /** 不显示查询按钮图标 */
165
+ noSearchButtonIcon: Boolean,
166
+ /**不显示重置按钮 */
167
+ noReset: Boolean,
168
+ /** 底部反转 */
169
+ footerReverse: Boolean,
170
+ /** 合并行列的方法 */
171
+ spanMethod: Function,
172
+ /** 加载中动画 */
173
+ loading: Boolean,
174
+ /** 加载中文本 */
175
+ loadingText: String,
176
+ /** 创建后执行一次查询 */
177
+ queryOnCreated: {
178
+ type: Boolean,
179
+ default: true
180
+ },
181
+ /**导出配置 */
182
+ exportOptions: Object,
183
+ /** 页数选择项 */
184
+ pageSizes: {
185
+ type: Array,
186
+ default() {
187
+ return [10, 15, 50, 100]
188
+ }
189
+ },
190
+ /**渲染嵌套数据的配置选项 */
191
+ treeProps: Object,
192
+ /*行数据的 Key,用来优化 Table 的渲染;
247
193
  在使用 reserve-selection 功能与显示树形数据时,该属性是必填的。
248
194
  类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function。*/
249
- rowKey: [Function, String],
250
- /*是否懒加载子节点数据*/
251
- lazy: Boolean,
252
- /**加载子节点数据的函数,lazy 为 true 时生效,函数第二个参数包含了节点的层级信息 */
253
- load: Function,
254
- /**是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效 */
255
- defaultExpandAll: Boolean,
256
- /**当刷新时不清空已选择数据 */
257
- noClearSelection: Boolean,
258
- /**是否显示合计行 */
259
- showSummary: Boolean,
260
- /**合计行文本 */
261
- sumText: String,
262
- /**合计行自定义逻辑方法 */
263
- summaryMethod: Function
264
- },
265
- computed: {
266
- ...mapState('app/loading', { loadingText_: 'text', loadingBackground: 'background', loadingSpinner: 'spinner' }),
267
- ...mapState('app/config', { serialNumberName: s => s.component.list.serialNumberName }),
268
- class_() {
269
- return ['nm-list', this.fontSize ? `nm-list-${this.fontSize}` : '', this.fullscreen ? 'fullscreen' : '']
270
- },
271
- showLoading() {
272
- return this.loading || this.loading_
195
+ rowKey: [Function, String],
196
+ /*是否懒加载子节点数据*/
197
+ lazy: Boolean,
198
+ /**加载子节点数据的函数,lazy 为 true 时生效,函数第二个参数包含了节点的层级信息 */
199
+ load: Function,
200
+ /**是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效 */
201
+ defaultExpandAll: Boolean,
202
+ /**当刷新时不清空已选择数据 */
203
+ noClearSelection: Boolean,
204
+ /**是否显示合计行 */
205
+ showSummary: Boolean,
206
+ /**合计行文本 */
207
+ sumText: String,
208
+ /**合计行自定义逻辑方法 */
209
+ summaryMethod: Function
273
210
  },
274
- exportOptions_() {
275
- return this.$_.assignIn({ title: this.title }, def.exportOptions, this.exportOptions)
276
- },
277
- exportAdvancedEnabled() {
278
- return this.exportOptions_.enabled && this.exportOptions_.advanced
279
- }
280
- },
281
- methods: {
282
- /** 查询方法 */
283
- query() {
284
- if (this.$refs.querybar) {
285
- this.$refs.querybar.validate(() => {
286
- this.doQuery()
287
- })
288
- } else {
289
- this.doQuery()
211
+ computed: {
212
+ ...mapState('app/loading', { loadingText_: 'text', loadingBackground: 'background', loadingSpinner: 'spinner' }),
213
+ ...mapState('app/config', { serialNumberName: s => s.component.list.serialNumberName }),
214
+ class_() {
215
+ return ['nm-list', this.fontSize ? `nm-list-${this.fontSize}` : '', this.fullscreen ? 'fullscreen' : '']
216
+ },
217
+ showLoading() {
218
+ return this.loading || this.loading_
219
+ },
220
+ exportOptions_() {
221
+ return this.$_.assignIn({ title: this.title }, def.exportOptions, this.exportOptions)
222
+ },
223
+ exportAdvancedEnabled() {
224
+ return this.exportOptions_.enabled && this.exportOptions_.advanced
290
225
  }
291
226
  },
292
- doQuery() {
293
- if (this.loading_) {
294
- return
295
- }
296
- this.loading_ = true
297
- let fullModel = Object.assign({}, this.model)
298
- // 设置分页
299
- fullModel.page = this.page
300
- this.action(fullModel)
301
- .then(data => {
302
- this.rows = data.rows
303
- this.total = data.total
304
- this.data = data.data
305
- // 回到顶部
306
- this.$refs.table.scrollTop()
307
- // 重新绘制布局
308
- this.$refs.table.doLayout()
309
- this.loading_ = false
310
- if (this.noClearSelection) {
311
- this.$nextTick(() => {
312
- this.rows.forEach(m => {
313
- if (!this.selection.every(n => n.id !== m.id)) {
314
- this.$refs.table.toggleRowSelection(m, true)
315
- }
227
+ methods: {
228
+ /** 查询方法 */
229
+ query() {
230
+ if (this.$refs.querybar) {
231
+ this.$refs.querybar.validate(() => {
232
+ this.doQuery()
233
+ })
234
+ } else {
235
+ this.doQuery()
236
+ }
237
+ },
238
+ doQuery() {
239
+ if (this.loading_) {
240
+ return
241
+ }
242
+ this.loading_ = true
243
+ let fullModel = Object.assign({}, this.model)
244
+ // 设置分页
245
+ fullModel.page = this.page
246
+ this.action(fullModel)
247
+ .then(data => {
248
+ this.rows = data.rows
249
+ this.total = data.total
250
+ this.data = data.data
251
+ // 回到顶部
252
+ this.$refs.table.scrollTop()
253
+ // 重新绘制布局
254
+ this.$refs.table.doLayout()
255
+ this.loading_ = false
256
+ if (this.noClearSelection) {
257
+ this.$nextTick(() => {
258
+ this.rows.forEach(m => {
259
+ if (!this.selection.every(n => n.id !== m.id)) {
260
+ this.$refs.table.toggleRowSelection(m, true)
261
+ }
262
+ })
316
263
  })
317
- })
318
- }
319
- // 查询事件
320
- this.$emit('query', data)
321
- })
322
- .catch(() => {
323
- this.loading_ = false
324
- })
325
- },
326
- export_(exportModel) {
327
- if (!exportModel.columns || exportModel.columns.length < 1) {
328
- this._error('请选择要导出的列')
329
- return
330
- }
331
- if (!this.exportOptions_.action) {
332
- this._error('未设置导出方法')
333
- return
334
- }
264
+ }
265
+ // 查询事件
266
+ this.$emit('query', data)
267
+ })
268
+ .catch(() => {
269
+ this.loading_ = false
270
+ })
271
+ },
272
+ export_(exportModel) {
273
+ if (!exportModel.columns || exportModel.columns.length < 1) {
274
+ this._error('请选择要导出的列')
275
+ return
276
+ }
277
+ if (!this.exportOptions_.action) {
278
+ this._error('未设置导出方法')
279
+ return
280
+ }
335
281
 
336
- this._openLoading('正在导出数据,请稍后...')
282
+ this._openLoading('正在导出数据,请稍后...')
337
283
 
338
- let model = Object.assign({}, this.model)
284
+ let model = Object.assign({}, this.model)
339
285
 
340
- // 设置分页
341
- model.page = this.page
342
- //设置导出信息
343
- model.export = exportModel
344
- this.exportOptions_
345
- .action(model)
346
- .then(() => {
347
- this._closeLoading()
348
- })
349
- .catch(() => {
350
- this._closeLoading()
351
- })
352
- },
353
- /** 刷新 */
354
- refresh(goFirst) {
355
- if (goFirst) this.page.index = 1
356
- this.query()
357
- },
358
- /** 查询表单重置 */
359
- reset() {
360
- this.$refs.querybar.reset()
361
- },
362
- /** 获取序号 */
363
- getNo(index) {
364
- return (this.page.index - 1) * this.page.size + index + 1
365
- },
366
- // 重新绘制布局
367
- doLayout() {
368
- this.$refs.table.doLayout()
369
- },
370
- /** 全屏切换 */
371
- triggerFullscreen() {
372
- this.fullscreen ? this.closeFullscreen() : this.openFullscreen()
373
- this.doLayout()
374
- },
375
- /** 开启全屏 */
376
- openFullscreen() {
377
- this.fullscreen = true
378
- this.$emit('fullscreen-change', this.fullscreen)
379
- },
380
- /** 关闭全屏 */
381
- closeFullscreen() {
382
- this.fullscreen = false
383
- this.$emit('fullscreen-change', this.fullscreen)
384
- },
385
- /** 切换导出对话框显示状态 */
386
- triggerExport() {
387
- let exp = this.exportOptions_
388
- //未启用高级,直接执行导出操作
389
- if (!exp.advanced) {
390
- const { format, mode, showTitle, showCopyright, showColName, showExportDate, showExportPeople } = exp
286
+ // 设置分页
287
+ model.page = this.page
288
+ //设置导出信息
289
+ model.export = exportModel
290
+ this.exportOptions_
291
+ .action(model)
292
+ .then(() => {
293
+ this._closeLoading()
294
+ })
295
+ .catch(() => {
296
+ this._closeLoading()
297
+ })
298
+ },
299
+ /** 刷新 */
300
+ refresh(goFirst) {
301
+ if (goFirst) this.page.index = 1
302
+ this.query()
303
+ },
304
+ /** 查询表单重置 */
305
+ reset() {
306
+ this.$refs.querybar.reset()
307
+ },
308
+ /** 获取序号 */
309
+ getNo(index) {
310
+ return (this.page.index - 1) * this.page.size + index + 1
311
+ },
312
+ // 重新绘制布局
313
+ doLayout() {
314
+ this.$refs.table.doLayout()
315
+ },
316
+ /** 全屏切换 */
317
+ triggerFullscreen() {
318
+ this.fullscreen ? this.closeFullscreen() : this.openFullscreen()
319
+ this.doLayout()
320
+ },
321
+ /** 开启全屏 */
322
+ openFullscreen() {
323
+ this.fullscreen = true
324
+ this.$emit('fullscreen-change', this.fullscreen)
325
+ },
326
+ /** 关闭全屏 */
327
+ closeFullscreen() {
328
+ this.fullscreen = false
329
+ this.$emit('fullscreen-change', this.fullscreen)
330
+ },
331
+ /** 切换导出对话框显示状态 */
332
+ triggerExport() {
333
+ let exp = this.exportOptions_
334
+ //未启用高级,直接执行导出操作
335
+ if (!exp.advanced) {
336
+ const { format, mode, showTitle, showCopyright, showColName, showExportDate, showExportPeople } = exp
391
337
 
392
- let model = { format, mode, showTitle, showCopyright, showColName, showExportDate, showExportPeople }
393
- model.title = this.title
394
- model.fileName = `${this.title}_${this.$dayjs().format('YYYYMMDDHHmmss')}`
395
- model.columns = []
338
+ let model = { format, mode, showTitle, showCopyright, showColName, showExportDate, showExportPeople }
339
+ model.title = this.title
340
+ model.fileName = `${this.title}_${this.$dayjs().format('YYYYMMDDHHmmss')}`
341
+ model.columns = []
396
342
 
397
- this.columns.forEach(m => {
398
- if (m.show) {
399
- model.columns.push(this.listCol2ExportCol(m))
400
- }
401
- })
343
+ this.columns.forEach(m => {
344
+ if (m.show) {
345
+ model.columns.push(this.listCol2ExportCol(m))
346
+ }
347
+ })
402
348
 
403
- this.export_(model)
404
- }
349
+ this.export_(model)
350
+ }
405
351
 
406
- this.showExport ? this.closeExport() : this.openExport()
407
- },
408
- /** 打开导出对话框 */
409
- openExport() {
410
- this.showExport = true
411
- this.$emit('export-change', this.showExport)
412
- },
413
- closeExport() {
414
- this.showExport = false
415
- this.$emit('export-change', this.showExport)
416
- },
417
- /** 列表的列转导出的列 */
418
- listCol2ExportCol(m) {
419
- let col = {
420
- name: m.name,
421
- label: m.label,
422
- align: m.align,
423
- format: m.format,
424
- width: 0
425
- }
352
+ this.showExport ? this.closeExport() : this.openExport()
353
+ },
354
+ /** 打开导出对话框 */
355
+ openExport() {
356
+ this.showExport = true
357
+ this.$emit('export-change', this.showExport)
358
+ },
359
+ closeExport() {
360
+ this.showExport = false
361
+ this.$emit('export-change', this.showExport)
362
+ },
363
+ /** 列表的列转导出的列 */
364
+ listCol2ExportCol(m) {
365
+ let col = {
366
+ name: m.name,
367
+ label: m.label,
368
+ align: m.align,
369
+ format: m.format,
370
+ width: 0
371
+ }
426
372
 
427
- //设置导出专属vip配置~
428
- if (m.export.width > 0) {
429
- col.width = m.export.width
430
- } else {
431
- let w = parseInt(m.width)
432
- if (w) col.width = w / 10 + 4 //默认取列表页中设置的宽度,该宽度与导出的Excel的列宽度比例大概10:1,所以这里进行一下转换, 转换后在+4,保可以保证有内边距,不会挤在一起
433
- }
434
- return col
435
- },
436
- /** 查询栏重置事件 */
437
- onQueryBarReset() {
438
- this.$refs.table.clearSort()
439
- this.$emit('reset')
440
- },
441
- /** 删除行 */
442
- removeRow(row) {
443
- for (let i = 0; i < this.rows.length; i++) {
444
- if (this.rows[i] === row) {
445
- this.rows.splice(i, 1)
446
- this.total--
447
- break
373
+ //设置导出专属vip配置~
374
+ if (m.export.width > 0) {
375
+ col.width = m.export.width
376
+ } else {
377
+ let w = parseInt(m.width)
378
+ if (w) col.width = w / 10 + 4 //默认取列表页中设置的宽度,该宽度与导出的Excel的列宽度比例大概10:1,所以这里进行一下转换, 转换后在+4,保可以保证有内边距,不会挤在一起
448
379
  }
449
- }
450
- },
451
- /** 格式化 */
452
- format(row, col) {
453
- const val = row[col.name]
454
- if (!col.format) return val
380
+ return col
381
+ },
382
+ /** 查询栏重置事件 */
383
+ onQueryBarReset() {
384
+ this.$refs.table.clearSort()
385
+ this.$emit('reset')
386
+ },
387
+ /** 删除行 */
388
+ removeRow(row) {
389
+ for (let i = 0; i < this.rows.length; i++) {
390
+ if (this.rows[i] === row) {
391
+ this.rows.splice(i, 1)
392
+ this.total--
393
+ break
394
+ }
395
+ }
396
+ },
397
+ /** 格式化 */
398
+ format(row, col) {
399
+ const val = row[col.name]
400
+ if (!col.format) return val
455
401
 
456
- const format = col.format
402
+ const format = col.format
457
403
 
458
- //性别
459
- if (format === 'sex') {
460
- return val === 0 ? '男' : '女'
461
- }
404
+ //性别
405
+ if (format === 'sex') {
406
+ return val === 0 ? '男' : '女'
407
+ }
462
408
 
463
- //日期
464
- if (format === 'date') {
465
- return this.$dayjs(val).format('YYYY-MM-DD')
466
- }
409
+ //日期
410
+ if (format === 'date') {
411
+ return this.$dayjs(val).format('YYYY-MM-DD')
412
+ }
467
413
 
468
- //自定义函数
469
- if (typeof format === 'function') {
470
- return format(val, row)
471
- }
414
+ //自定义函数
415
+ if (typeof format === 'function') {
416
+ return format(val, row)
417
+ }
472
418
 
473
- //日期
474
- return this.$dayjs(val).format(col.format)
475
- }
476
- },
477
- mounted() {
478
- this.$nextTick(() => {
479
- if (this.queryOnCreated) {
480
- this.query()
419
+ //日期
420
+ return this.$dayjs(val).format(col.format)
481
421
  }
482
- })
483
- },
484
- created() {
485
- if (this.cols) {
486
- this.columns = this.cols.map(col => {
487
- return this.$_.assignIn({}, def.columnInfo, col)
422
+ },
423
+ mounted() {
424
+ this.$nextTick(() => {
425
+ if (this.queryOnCreated) {
426
+ this.query()
427
+ }
488
428
  })
429
+ },
430
+ created() {
431
+ if (this.cols) {
432
+ this.columns = this.cols.map(col => {
433
+ return this.$_.assignIn({}, def.columnInfo, col)
434
+ })
435
+ }
436
+ },
437
+ activated() {
438
+ this.doLayout()
489
439
  }
490
- },
491
- activated() {
492
- this.doLayout()
493
440
  }
494
- }
495
441
  </script>