imatrix-ui 2.9.18-dw → 2.9.19-boe02

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 (199) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +4 -3
  4. package/src/api/sso-service.js +19 -1
  5. package/src/assets/nonemessage.png +0 -0
  6. package/src/i18n/i18n.js +1 -1
  7. package/src/i18n/langs/cn.js +25 -6
  8. package/src/i18n/langs/en.js +27 -7
  9. package/src/permission.js +2 -2
  10. package/src/plugins.js +3 -3
  11. package/src/router/index.js +10 -0
  12. package/src/store/modules/tab-content.js +6 -0
  13. package/src/store/modules/user.js +32 -2
  14. package/src/styles/display-layout.scss +1 -1
  15. package/src/styles/index.scss +74 -4
  16. package/src/styles/theme/black/font-style.scss +70 -0
  17. package/src/styles/theme/black/index.scss +6 -30
  18. package/src/styles/theme/blue/font-style.scss +37 -0
  19. package/src/styles/theme/blue/index.scss +2 -18
  20. package/src/styles/theme/blue2/font-style.scss +70 -0
  21. package/src/styles/theme/blue2/index.scss +3 -13
  22. package/src/styles/theme/dark-blue/card.scss +4 -6
  23. package/src/styles/theme/dark-blue/form.scss +7 -4
  24. package/src/styles/theme/dark-blue/index.scss +30 -5
  25. package/src/styles/theme/dark-blue/input.scss +4 -1
  26. package/src/styles/theme/dark-blue/message.scss +8 -0
  27. package/src/styles/theme/dark-blue/radio.scss +13 -0
  28. package/src/styles/theme/dark-blue/scrollbar-style.scss +8 -3
  29. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  30. package/src/styles/theme/dark-blue/tab.scss +4 -1
  31. package/src/styles/theme/dark-blue/table.scss +2 -2
  32. package/src/styles/theme/dark-blue/tree.scss +35 -10
  33. package/src/styles/theme/gray/card-style.scss +13 -1
  34. package/src/styles/theme/gray/font-style.scss +38 -0
  35. package/src/styles/theme/gray/index.scss +13 -25
  36. package/src/styles/theme/gray/scrollbar-style.scss +37 -0
  37. package/src/styles/theme/gray/sidebar.scss +7 -14
  38. package/src/utils/auth-api.js +47 -1
  39. package/src/utils/calculator/calculator-util.js +14 -0
  40. package/src/utils/common-util.js +22 -81
  41. package/src/utils/jump-page-utils.js +12 -9
  42. package/src/utils/preview-util.js +32 -0
  43. package/src/utils/range-selector.js +185 -0
  44. package/src/utils/request.js +20 -12
  45. package/src/utils/util.js +13 -11
  46. package/src/utils/workflow-util.js +3 -0
  47. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  48. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  49. package/src/views/dsc-component/Sidebar/index.vue +14 -22
  50. package/src/views/dsc-component/tabs/tab-content.vue +8 -9
  51. package/src/views/layout/EmptyLayout.vue +4 -1
  52. package/src/views/layout/NewLayout.vue +6 -65
  53. package/src/views/layout/components/AppMain.vue +2 -1
  54. package/src/views/layout/components/Breadcrumb/index.vue +1 -1
  55. package/src/views/layout/components/Menubar/Item.vue +23 -7
  56. package/src/views/layout/components/Menubar/Link.vue +11 -2
  57. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  58. package/src/views/layout/components/Menubar/index.vue +51 -16
  59. package/src/views/layout/components/Sidebar/index.vue +2 -2
  60. package/src/views/layout/components/tabs/tab-content.vue +162 -0
  61. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  62. package/src/views/layout/tab-content-index.vue +84 -0
  63. package/src/views/login/index.vue +1 -1
  64. package/packages/breadcrumb/index.js +0 -6
  65. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  66. package/packages/department-tree/index.js +0 -6
  67. package/packages/department-tree/src/department-tree.vue +0 -108
  68. package/packages/department-tree-inline/index.js +0 -6
  69. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -411
  70. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -293
  71. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  72. package/packages/department-tree-inline/src/department-tree-service.js +0 -275
  73. package/packages/department-tree-inline/src/search-result.vue +0 -176
  74. package/packages/department-user-tree/index.js +0 -6
  75. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  76. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  77. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  78. package/packages/department-user-tree-inline/index.js +0 -6
  79. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -639
  80. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -274
  81. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  82. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -248
  83. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -142
  84. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  85. package/packages/directives/prevent-reclick.js +0 -19
  86. package/packages/dynamic-source-select/index.js +0 -6
  87. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  88. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  89. package/packages/dynamic-source-select/src/events.js +0 -55
  90. package/packages/fs-preview/index.js +0 -6
  91. package/packages/fs-preview/src/fs-preview.vue +0 -226
  92. package/packages/fs-upload/index.js +0 -6
  93. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  94. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  95. package/packages/fs-upload/src/fs-upload.vue +0 -189
  96. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  97. package/packages/fs-upload-list/index.js +0 -6
  98. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  99. package/packages/hamburger/index.js +0 -6
  100. package/packages/hamburger/src/hamburger.vue +0 -38
  101. package/packages/index.js +0 -121
  102. package/packages/multipart-upload/index.js +0 -6
  103. package/packages/multipart-upload/src/index.vue +0 -73
  104. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  105. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  106. package/packages/organization-input/index.js +0 -6
  107. package/packages/organization-input/src/organization-input.vue +0 -542
  108. package/packages/plugins/export-data-new.js +0 -466
  109. package/packages/plugins/export-data.js +0 -361
  110. package/packages/plugins/index.js +0 -15
  111. package/packages/plugins/public-method.js +0 -43
  112. package/packages/remove-department/index.js +0 -6
  113. package/packages/remove-department/src/remove-department.vue +0 -172
  114. package/packages/remove-department/src/remove-dept-service.js +0 -20
  115. package/packages/remove-user/index.js +0 -6
  116. package/packages/remove-user/src/remove-user-service.js +0 -20
  117. package/packages/remove-user/src/remove-user.vue +0 -195
  118. package/packages/remove-workgroup/index.js +0 -6
  119. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  120. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  121. package/packages/rich-editor/index.js +0 -7
  122. package/packages/rich-editor/index.vue +0 -278
  123. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  124. package/packages/rich-editor/viewer.vue +0 -103
  125. package/packages/scan-code-input/index.js +0 -6
  126. package/packages/scan-code-input/src/events.js +0 -33
  127. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  128. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  129. package/packages/secret-info/index.js +0 -7
  130. package/packages/secret-info/index.vue +0 -90
  131. package/packages/super-grid/index.js +0 -7
  132. package/packages/super-grid/src/apis.js +0 -820
  133. package/packages/super-grid/src/columns-config.vue +0 -335
  134. package/packages/super-grid/src/custom-formatter.js +0 -278
  135. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  136. package/packages/super-grid/src/eventBus.js +0 -2
  137. package/packages/super-grid/src/events.js +0 -55
  138. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  139. package/packages/super-grid/src/formatter.js +0 -181
  140. package/packages/super-grid/src/group-column.vue +0 -100
  141. package/packages/super-grid/src/header-context-menu.vue +0 -87
  142. package/packages/super-grid/src/index-column.vue +0 -51
  143. package/packages/super-grid/src/normal-column.vue +0 -775
  144. package/packages/super-grid/src/public-methods.js +0 -31
  145. package/packages/super-grid/src/row-operation.vue +0 -161
  146. package/packages/super-grid/src/search-button.vue +0 -66
  147. package/packages/super-grid/src/search-condition-input.vue +0 -61
  148. package/packages/super-grid/src/search-condition-list.vue +0 -59
  149. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -654
  150. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  151. package/packages/super-grid/src/search-form-item.vue +0 -405
  152. package/packages/super-grid/src/search-form-number.vue +0 -38
  153. package/packages/super-grid/src/search-form-open.vue +0 -170
  154. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -196
  155. package/packages/super-grid/src/search-form.vue +0 -642
  156. package/packages/super-grid/src/search-methods.js +0 -448
  157. package/packages/super-grid/src/selection-column.vue +0 -43
  158. package/packages/super-grid/src/store.js +0 -3
  159. package/packages/super-grid/src/super-grid-service.js +0 -593
  160. package/packages/super-grid/src/super-grid.vue +0 -2873
  161. package/packages/super-grid/src/utils.js +0 -772
  162. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  163. package/packages/super-nine-grid/index.js +0 -7
  164. package/packages/super-nine-grid/src/apis.js +0 -103
  165. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  166. package/packages/super-nine-grid/src/formatter.js +0 -132
  167. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  168. package/packages/super-nine-grid/src/search-form.vue +0 -430
  169. package/packages/super-nine-grid/src/search-methods.js +0 -134
  170. package/packages/super-nine-grid/src/store.js +0 -3
  171. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  172. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  173. package/packages/super-nine-grid/src/utils.js +0 -261
  174. package/packages/svg-icon/index.js +0 -6
  175. package/packages/svg-icon/src/svg-icon.vue +0 -43
  176. package/packages/utils/memory-cache-utils.js +0 -90
  177. package/packages/utils/utils.js +0 -152
  178. package/packages/utils/value-set.js +0 -86
  179. package/packages/valid-code/index.js +0 -7
  180. package/packages/valid-code/src/valid-code.vue +0 -95
  181. package/packages/workflow-button/index.js +0 -6
  182. package/packages/workflow-button/src/workflow-button.vue +0 -325
  183. package/packages/workflow-history-list/index.js +0 -6
  184. package/packages/workflow-history-list/src/api.js +0 -7
  185. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  186. package/packages/workgroup-tree/index.js +0 -6
  187. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  188. package/packages/workgroup-tree-inline/index.js +0 -6
  189. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  190. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  191. package/packages/workgroup-user-tree/index.js +0 -6
  192. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  193. package/packages/workgroup-user-tree-inline/index.js +0 -6
  194. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  195. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  196. package/packages/year-range-picker/index.js +0 -6
  197. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  198. package/src/index.js +0 -93
  199. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,466 +0,0 @@
1
- import {
2
- Message
3
- } from 'element-ui'
4
- import Vue from 'vue'
5
- import {
6
- getI18n
7
- } from '../../src/utils/util'
8
- import store from '../super-grid/src/store'
9
- import {
10
- getExtraParam
11
- } from '../super-grid/src/utils'
12
- import nineGridStore from '../super-nine-grid/src/store'
13
- import {
14
- packageEnumAndBeanColumnValueSets
15
- } from '../utils/value-set'
16
- /**
17
- *
18
- * @param {*} dataParam
19
- * @param {*} excelName
20
- * @param {*} listCode 如果是九宫格组件导出时,如果页面中有多个九宫格时,该属性需要传“listCode~gridId”,例如:
21
- * @param {*} exportOptions
22
- */
23
- function exportData(dataParam, excelName, listCode, functionCode, uuid, exportOptions, isAsync, pageCode) {
24
- return new Promise((resolve, reject) => {
25
- exportResultData(dataParam, excelName, listCode, exportOptions, functionCode, uuid, isAsync, pageCode).then(result => {
26
- // 表示导出成功,需要执行导出成功回调方法
27
- if (isHasTheOption('afterExport', exportOptions) && typeof (exportOptions.afterExport) === 'function') {
28
- exportOptions.afterExport.call(this)
29
- }
30
- resolve(result)
31
- }).catch(error => {
32
- if (isHasTheOption('exportError', exportOptions) && typeof (exportOptions.exportError) === 'function') {
33
- exportOptions.exportError.call(this)
34
- }
35
- reject(error)
36
- })
37
- })
38
- }
39
- /**
40
- * 导出数据
41
- */
42
- function exportResultData(dataParam, excelName, listCode, exportOptions, functionCode, uuid, isAsync, pageCode) {
43
- return new Promise((resolve, reject) => {
44
- // 从store缓存中取出列表信息
45
- if (store.get(listCode + 'basicInfo')) {
46
- const basicInfo = store.get(listCode + 'basicInfo')
47
- if (basicInfo && basicInfo.i18nLable) {
48
- excelName = basicInfo.i18nLable
49
- }
50
- }
51
- let isCanExport = true
52
- if (isHasTheOption('beforeExport', exportOptions) && typeof (exportOptions.beforeExport) === 'function') {
53
- isCanExport = exportOptions.beforeExport.call(this)
54
- }
55
- if (!isCanExport) {
56
- resolve(false)
57
- } else {
58
- if (dataParam && dataParam.hasOwnProperty('url')) {
59
- // 导出url对应的数据
60
- exportUrlData(dataParam, excelName, listCode).then((result) => {
61
- resolve(result)
62
- }).catch(error => {
63
- reject(error)
64
- })
65
- } else {
66
- // const dataIds = []
67
- if (dataParam && dataParam.hasOwnProperty('data')) {
68
- // 导出选中行
69
- console.log('data', dataParam.data)
70
- // dataParam.data.forEach(item => {
71
- // if (item.id) {
72
- // dataIds.push(item.id)
73
- // } else if (item.ID) {
74
- // dataIds.push(item.ID)
75
- // }
76
- // })
77
- }
78
- // 导出台账数据,有查询条件则导出查询条件对应的数据,没有查询条件则导出所有记录
79
- exportListData(excelName, listCode, dataParam.data, functionCode, uuid, isAsync, pageCode).then((result) => {
80
- resolve(result)
81
- }).catch(error => {
82
- reject(error)
83
- })
84
- }
85
- }
86
- })
87
- }
88
- // 导出的后台单独重写
89
- function exportUrlData(dataParam, excelName, listCode) {
90
- return new Promise((resolve, reject) => {
91
- const listCodeStore = getListCode(listCode)
92
- let param = getExportParamByGridParam(listCode)
93
- const url = dataParam.url
94
- if (dataParam.hasOwnProperty('param')) {
95
- param = Object.assign(param, dataParam.param)
96
- }
97
- Vue.prototype.$http.post(url, param).then(data => {
98
- let exportSheetData
99
- // console.log('data===', data)
100
- if (data instanceof Array) {
101
- // 是数组,表示返回的是list记录集合
102
- const result = {}
103
- // console.log('_data', data)
104
- result['_data'] = data
105
- exportSheetData = JSON.stringify(result)
106
- } else {
107
- // 表示返回的是{_data:{},_styles:{}}
108
- exportSheetData = JSON.stringify(data)
109
- }
110
- return exportMyData(exportSheetData, excelName, listCodeStore)
111
- }).then((result) => {
112
- resolve(result)
113
- }).catch(error => {
114
- reject(error)
115
- })
116
- })
117
- }
118
-
119
- function getListCode(listCode) {
120
- if (listCode !== null && listCode !== undefined && listCode !== '') {
121
- return listCode
122
- }
123
- let listCodeStore = listCode
124
- if (!listCode || listCode === null || listCode === '') {
125
- listCodeStore = store.get('_list_code')
126
- }
127
- if (listCodeStore === undefined || listCodeStore === null || listCodeStore === '') {
128
- listCodeStore = nineGridStore.get('_nine_list_code')
129
- if (listCodeStore && listCodeStore.indexOf('~') < 0) {
130
- // 拼接默认的九宫格gridId
131
- listCodeStore = listCodeStore + '~' + '_nineGrid'
132
- }
133
- }
134
- if (listCodeStore && listCodeStore.indexOf('~') > 0) {
135
- listCodeStore = listCodeStore.substring(0, listCodeStore.indexOf('~'))
136
- }
137
- return listCodeStore
138
- }
139
-
140
- function getGridParams(listCode) {
141
- let gridParams = null
142
- let listCodeStore = listCode
143
- if (!listCode || listCode === null || listCode === '') {
144
- listCodeStore = store.get('_list_code')
145
- }
146
- gridParams = store.get(listCodeStore)
147
- if (gridParams === undefined || gridParams === null) {
148
- if (!listCode || listCode === null || listCode === '') {
149
- listCodeStore = nineGridStore.get('_nine_list_code')
150
- }
151
- if (listCodeStore && listCodeStore.indexOf('~') < 0) {
152
- // 拼接默认的九宫格gridId
153
- listCodeStore = listCodeStore + '~' + '_nineGrid'
154
- }
155
- gridParams = nineGridStore.get(listCodeStore)
156
- }
157
- return gridParams
158
- }
159
-
160
- function getExportParamByGridParam(listCode) {
161
- let param = {}
162
- const gridParams = getGridParams(listCode)
163
- if (gridParams !== undefined && gridParams !== null) {
164
- const searchParam = Object.assign({}, gridParams.searchParam)
165
- const pagination = {
166
- 'currentPage': 1,
167
- 'pageSize': 99999999,
168
- 'showTotal': false
169
- }
170
- param = searchParam
171
- searchParam.pagination = pagination
172
- if (gridParams.options.extraParam) {
173
- // 当前有附加参数时,处理附加参数
174
- param = getExtraParam(searchParam, gridParams)
175
- let parentProp
176
- const parentPropSetting = gridParams.options.parentProp
177
- if (
178
- typeof parentPropSetting !== 'undefined' &&
179
- parentPropSetting !== '' &&
180
- parentPropSetting !== null
181
- ) {
182
- parentProp = parentPropSetting
183
- }
184
- if (parentProp && searchParam && searchParam.searchForm && searchParam.searchForm.length > 0) {
185
- // 表示有查询条件时,不支持树形结构显示数据
186
- param.listViewTreeSetting = null
187
- }
188
- }
189
- }
190
- return param
191
- }
192
- // 导出当前台账数据
193
- function exportListData(excelName, listCode, data, functionCode, uuid, isAsync, pageCode) {
194
- return new Promise((resolve, reject) => {
195
- const gridParams = getGridParams(listCode)
196
- if (gridParams === undefined || gridParams === null) {
197
- reject('导出失败')
198
- } else {
199
- const param = getExportParamByGridParam(listCode)
200
- param.data = data
201
- if (gridParams.columns) {
202
- param.exportColumns = getExportColumnsByStore(gridParams.columns)
203
- }
204
- param.exportData = {
205
- excelName: excelName
206
- }
207
- if (!excelName || excelName === null || excelName === '') {
208
- excelName = 'default.xlsx'
209
- } else {
210
- excelName = excelName + '.xlsx'
211
- }
212
- if (functionCode) {
213
- param.functionCode = functionCode
214
- } else {
215
- Message({
216
- message: getI18n().t('imatrixUIMessage.theButtonIsNotBoundToAResource'),
217
- type: 'error',
218
- showClose: true
219
- })
220
- return
221
- }
222
-
223
- if (uuid) {
224
- param.uuid = uuid
225
- }
226
- // 用来控制按钮禁止编辑的
227
- localStorage.setItem(uuid, 'start')
228
- // 是否异步
229
- param['async'] = isAsync
230
- // 页面编码
231
- param['pageCode'] = pageCode
232
- Vue.prototype.$http.post(Vue.prototype.baseURL + '/dsc/commons/export-list-data', param).then(data => {
233
- if (isAsync) {
234
- Message({
235
- message: getI18n().t('imatrixUIMessage.asyncExport'),
236
- type: 'success',
237
- showClose: true
238
- })
239
- localStorage.setItem(uuid, 'ok')
240
- } else {
241
- if (data.indexOf('~~') >= 0) {
242
- localStorage.setItem(uuid, 'ok')
243
- return download(Vue.prototype.baseAPI + '/component/super-grids/downloads?fileName=' + encodeURI(data) + '&_t=' + new Date().getTime(), excelName)
244
- } else {
245
- getFileUuid(data, param, excelName)
246
- }
247
- }
248
- // return download(Vue.prototype.baseAPI + '/component/super-grids/downloads?fileName=' + encodeURI(fileName) + '&_t=' + new Date().getTime(), excelName)
249
- }).then((result) => {
250
- resolve(result)
251
- }).catch(error => {
252
- // 用来控制按钮禁止编辑的
253
- localStorage.setItem(uuid, 'error')
254
- reject(error)
255
- })
256
- }
257
- })
258
- }
259
- /**
260
- * 根据uuid获取导出情况
261
- * @param {*} uuid
262
- * @param {*} param
263
- * @param {*} excelName
264
- */
265
- function getFileUuid(uuid, param, excelName) {
266
- setTimeout(() => {
267
- Vue.prototype.$http.post(Vue.prototype.baseURL + '/dsc/commons/get-file-uuid/' + uuid, param).then(data => {
268
- if (data) {
269
- if (data.code && (data.code === 'ok' || data.code === 'error')) {
270
- if (data.code === 'ok') {
271
- // 用来控制按钮禁止编辑的
272
- localStorage.setItem(uuid, 'ok')
273
- return download(Vue.prototype.baseAPI + '/component/super-grids/downloads?fileName=' + encodeURI(data.fileName) + '&uuid=' + uuid + '&_t=' + new Date().getTime(), excelName)
274
- } else {
275
- localStorage.setItem(uuid, 'error')
276
- Message({
277
- message: data.message,
278
- type: 'error',
279
- showClose: true
280
- })
281
- }
282
- } else {
283
- getFileUuid(uuid, param, excelName)
284
- }
285
- } else {
286
- localStorage.setItem(uuid, 'ok')
287
- }
288
- }).catch(() => {
289
- // 用来控制按钮禁止编辑的
290
- localStorage.setItem(uuid, 'error')
291
- })
292
- }, 5000)
293
- }
294
- function exportMyData(data, excelName, listCode) {
295
- return new Promise((resolve, reject) => {
296
- const gridParams = getGridParams(listCode)
297
- if (gridParams !== undefined) {
298
- if (gridParams.columns) {
299
- // console.log('exportMyData--grid--gridParams.columns.length=', gridParams.columns)
300
- const columnInfoArr = getExportColumnsByStore(gridParams.columns)
301
- // console.log('exportMyData--grid--columnInfoArr.length=', columnInfoArr.length)
302
- if (columnInfoArr.length === 0) {
303
- Message({
304
- message: getI18n().t('imatrixUIMessage.noExportColumnsConfigured'),
305
- type: 'warning',
306
- showClose: true
307
- })
308
- resolve(false)
309
- } else {
310
- exportColumns(getExportInfo(data, excelName, listCode, columnInfoArr)).then((result) => {
311
- resolve(result)
312
- }).catch(error => {
313
- reject(error)
314
- })
315
- }
316
- } else {
317
- Message({
318
- message: getI18n().t('imatrixUIMessage.noExportColumnsConfigured'),
319
- type: 'warning',
320
- showClose: true
321
- })
322
- resolve(false)
323
- }
324
- } else {
325
- exportOtherListData(data, excelName, listCode).then(result => {
326
- resolve(result)
327
- }).catch(error => {
328
- reject(error)
329
- })
330
- }
331
- })
332
- }
333
-
334
- /**
335
- * 导出非台账列表数据
336
- * @param {*}} data
337
- * @param {*} excelName
338
- * @param {*} listCode
339
- */
340
- function exportOtherListData(data, excelName, listCode, additionalParameterStr) {
341
- return new Promise((resolve, reject) => {
342
- const params = {}
343
- if (additionalParameterStr && additionalParameterStr !== '') {
344
- params.additionalParamMap = additionalParameterStr
345
- }
346
- Vue.prototype.$http.post(Vue.prototype.baseAPI + '/component/super-grids/' + listCode + '/export-columns', params).then(columnInfoArr => {
347
- packageEnumAndBeanColumnValueSets(columnInfoArr, listCode).then(() => {
348
- if (columnInfoArr.length === 0) {
349
- Message({
350
- message: getI18n().t('imatrixUIMessage.noExportColumnsConfigured'),
351
- type: 'warning',
352
- showClose: true
353
- })
354
- resolve(false)
355
- } else {
356
- exportColumns(getExportInfo(data, excelName, listCode, columnInfoArr)).then((result) => {
357
- resolve(result)
358
- }).catch(error => {
359
- reject(error)
360
- })
361
- }
362
- }).catch(error => {
363
- reject(error)
364
- })
365
- }).catch(error => {
366
- reject(error)
367
- })
368
- })
369
- }
370
-
371
- /**
372
- * @param {exportInfo} Object 导出的字段配置集合及导出的数据信息
373
- */
374
- function exportColumns(exportInfo) {
375
- return new Promise((resolve, reject) => {
376
- let excelName = exportInfo.exportData.excelName
377
- if (!excelName || excelName === null || excelName === '') {
378
- excelName = 'default.xlsx'
379
- } else {
380
- excelName = excelName + '.xlsx'
381
- }
382
- Vue.prototype.$http.post(Vue.prototype.baseAPI + '/component/super-grids/exports', exportInfo).then(fileName => {
383
- // window.location.href = Vue.prototype.baseAPI + '/component/super-grids/downloads?fileName=' + encodeURI(fileName)
384
- return download(Vue.prototype.baseAPI + '/component/super-grids/downloads?fileName=' + encodeURI(fileName) + '&_t=' + new Date().getTime(), excelName)
385
- }).then((result) => {
386
- resolve(result)
387
- }).catch(error => {
388
- reject(error)
389
- })
390
- })
391
- }
392
-
393
- function getExportColumnsByStore(columns) {
394
- let exportColumns = []
395
- columns.forEach(column => {
396
- if (column.children && column.children.length > 0) {
397
- // 解决组合表头时没有导出的问题
398
- exportColumns = exportColumns.concat(getExportColumnsByStore(column.children))
399
- } else {
400
- if (column.exportable && column.exportable === true) {
401
- exportColumns.push(column)
402
- }
403
- }
404
- })
405
- return exportColumns
406
- }
407
-
408
- function getExportInfo(data, excelName, listCode, columnInfoArr) {
409
- if (!excelName || excelName === null || excelName === '') {
410
- excelName = listCode
411
- }
412
- return {
413
- exportColumns: columnInfoArr,
414
- exportData: getExportData(data, excelName)
415
- }
416
- }
417
-
418
- function getExportData(data, excelName) {
419
- return {
420
- excelName: excelName,
421
- exportSheetData: [{
422
- data: data,
423
- sheetName: excelName
424
- }]
425
- }
426
- }
427
-
428
- function isHasTheOption(event, exportOptions) {
429
- if (exportOptions !== null && typeof (exportOptions) !== 'undefined' && typeof (exportOptions[event]) !== 'undefined') {
430
- return true
431
- }
432
- return false
433
- }
434
-
435
- function download(url, fileName) {
436
- return new Promise((resolve, reject) => {
437
- Vue.prototype.$http({
438
- method: 'GET',
439
- url: url,
440
- responseType: 'blob'
441
- }).then(res => {
442
- const blob = new Blob([res])
443
- if (window.navigator.msSaveOrOpenBlob) {
444
- navigator.msSaveBlob(blob, fileName)
445
- } else {
446
- const link = document.createElement('a')
447
- const evt = document.createEvent('HTMLEvents')
448
- evt.initEvent('click', false, false)
449
- link.href = URL.createObjectURL(blob)
450
- link.download = fileName
451
- link.style.display = 'none'
452
- document.body.appendChild(link)
453
- link.click()
454
- window.URL.revokeObjectURL(link.href)
455
- }
456
- resolve(true)
457
- }).catch(error => {
458
- reject(error)
459
- })
460
- })
461
- }
462
-
463
- export default {
464
- exportData,
465
- download
466
- }