imatrix-ui 2.9.10-dw → 2.9.11-boe2

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 (181) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +2 -2
  4. package/src/api/sso-service.js +19 -1
  5. package/src/i18n/i18n.js +1 -1
  6. package/src/i18n/langs/cn.js +14 -4
  7. package/src/i18n/langs/en.js +16 -5
  8. package/src/permission.js +1 -1
  9. package/src/plugins.js +3 -3
  10. package/src/router/index.js +10 -0
  11. package/src/store/modules/tab-content.js +6 -0
  12. package/src/store/modules/user.js +19 -0
  13. package/src/styles/index.scss +74 -4
  14. package/src/styles/theme/black/font-style.scss +70 -0
  15. package/src/styles/theme/black/index.scss +6 -30
  16. package/src/styles/theme/blue/font-style.scss +37 -0
  17. package/src/styles/theme/blue/index.scss +2 -18
  18. package/src/styles/theme/blue2/font-style.scss +70 -0
  19. package/src/styles/theme/blue2/index.scss +3 -13
  20. package/src/styles/theme/dark-blue/index.scss +27 -5
  21. package/src/styles/theme/dark-blue/message.scss +8 -0
  22. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  23. package/src/styles/theme/dark-blue/table.scss +1 -1
  24. package/src/styles/theme/gray/card-style.scss +13 -1
  25. package/src/styles/theme/gray/font-style.scss +38 -0
  26. package/src/styles/theme/gray/index.scss +13 -25
  27. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  28. package/src/styles/theme/gray/sidebar.scss +7 -14
  29. package/src/utils/auth-api.js +45 -1
  30. package/src/utils/common-util.js +21 -81
  31. package/src/utils/range-selector.js +185 -0
  32. package/src/utils/request.js +6 -3
  33. package/src/utils/util.js +12 -10
  34. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  35. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  36. package/src/views/dsc-component/Sidebar/index.vue +12 -20
  37. package/src/views/dsc-component/tabs/tab-content.vue +1 -5
  38. package/src/views/layout/NewLayout.vue +6 -65
  39. package/src/views/layout/components/Menubar/Item.vue +23 -7
  40. package/src/views/layout/components/Menubar/Link.vue +11 -2
  41. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  42. package/src/views/layout/components/Menubar/index.vue +51 -16
  43. package/src/views/layout/components/tabs/tab-content.vue +160 -0
  44. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  45. package/src/views/layout/tab-content-index.vue +85 -0
  46. package/src/views/login/index.vue +1 -1
  47. package/packages/breadcrumb/index.js +0 -6
  48. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  49. package/packages/department-tree/index.js +0 -6
  50. package/packages/department-tree/src/department-tree.vue +0 -108
  51. package/packages/department-tree-inline/index.js +0 -6
  52. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -402
  53. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -284
  54. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  55. package/packages/department-tree-inline/src/department-tree-service.js +0 -245
  56. package/packages/department-tree-inline/src/search-result.vue +0 -176
  57. package/packages/department-user-tree/index.js +0 -6
  58. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  59. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  60. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  61. package/packages/department-user-tree-inline/index.js +0 -6
  62. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -626
  63. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -269
  64. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  65. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -230
  66. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -122
  67. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  68. package/packages/directives/prevent-reclick.js +0 -19
  69. package/packages/dynamic-source-select/index.js +0 -6
  70. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  71. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  72. package/packages/dynamic-source-select/src/events.js +0 -55
  73. package/packages/fs-preview/index.js +0 -6
  74. package/packages/fs-preview/src/fs-preview.vue +0 -226
  75. package/packages/fs-upload/index.js +0 -6
  76. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  77. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  78. package/packages/fs-upload/src/fs-upload.vue +0 -189
  79. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  80. package/packages/fs-upload-list/index.js +0 -6
  81. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  82. package/packages/hamburger/index.js +0 -6
  83. package/packages/hamburger/src/hamburger.vue +0 -38
  84. package/packages/index.js +0 -121
  85. package/packages/multipart-upload/index.js +0 -6
  86. package/packages/multipart-upload/src/index.vue +0 -73
  87. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  88. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  89. package/packages/organization-input/index.js +0 -6
  90. package/packages/organization-input/src/organization-input.vue +0 -542
  91. package/packages/plugins/export-data-new.js +0 -453
  92. package/packages/plugins/export-data.js +0 -361
  93. package/packages/plugins/index.js +0 -15
  94. package/packages/plugins/public-method.js +0 -43
  95. package/packages/remove-department/index.js +0 -6
  96. package/packages/remove-department/src/remove-department.vue +0 -172
  97. package/packages/remove-department/src/remove-dept-service.js +0 -20
  98. package/packages/remove-user/index.js +0 -6
  99. package/packages/remove-user/src/remove-user-service.js +0 -20
  100. package/packages/remove-user/src/remove-user.vue +0 -195
  101. package/packages/remove-workgroup/index.js +0 -6
  102. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  103. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  104. package/packages/rich-editor/index.js +0 -7
  105. package/packages/rich-editor/index.vue +0 -278
  106. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  107. package/packages/rich-editor/viewer.vue +0 -103
  108. package/packages/scan-code-input/index.js +0 -6
  109. package/packages/scan-code-input/src/events.js +0 -33
  110. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  111. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  112. package/packages/secret-info/index.js +0 -7
  113. package/packages/secret-info/index.vue +0 -90
  114. package/packages/super-grid/index.js +0 -7
  115. package/packages/super-grid/src/apis.js +0 -778
  116. package/packages/super-grid/src/columns-config.vue +0 -335
  117. package/packages/super-grid/src/custom-formatter.js +0 -250
  118. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  119. package/packages/super-grid/src/eventBus.js +0 -2
  120. package/packages/super-grid/src/events.js +0 -55
  121. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  122. package/packages/super-grid/src/formatter.js +0 -181
  123. package/packages/super-grid/src/group-column.vue +0 -100
  124. package/packages/super-grid/src/header-context-menu.vue +0 -87
  125. package/packages/super-grid/src/index-column.vue +0 -51
  126. package/packages/super-grid/src/normal-column.vue +0 -769
  127. package/packages/super-grid/src/public-methods.js +0 -31
  128. package/packages/super-grid/src/row-operation.vue +0 -161
  129. package/packages/super-grid/src/search-button.vue +0 -66
  130. package/packages/super-grid/src/search-condition-input.vue +0 -61
  131. package/packages/super-grid/src/search-condition-list.vue +0 -59
  132. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  133. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  134. package/packages/super-grid/src/search-form-item.vue +0 -386
  135. package/packages/super-grid/src/search-form-number.vue +0 -38
  136. package/packages/super-grid/src/search-form-open.vue +0 -162
  137. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -188
  138. package/packages/super-grid/src/search-form.vue +0 -634
  139. package/packages/super-grid/src/search-methods.js +0 -387
  140. package/packages/super-grid/src/selection-column.vue +0 -43
  141. package/packages/super-grid/src/store.js +0 -3
  142. package/packages/super-grid/src/super-grid-service.js +0 -561
  143. package/packages/super-grid/src/super-grid.vue +0 -2829
  144. package/packages/super-grid/src/utils.js +0 -763
  145. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  146. package/packages/super-nine-grid/index.js +0 -7
  147. package/packages/super-nine-grid/src/apis.js +0 -103
  148. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  149. package/packages/super-nine-grid/src/formatter.js +0 -132
  150. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  151. package/packages/super-nine-grid/src/search-form.vue +0 -430
  152. package/packages/super-nine-grid/src/search-methods.js +0 -134
  153. package/packages/super-nine-grid/src/store.js +0 -3
  154. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  155. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  156. package/packages/super-nine-grid/src/utils.js +0 -261
  157. package/packages/svg-icon/index.js +0 -6
  158. package/packages/svg-icon/src/svg-icon.vue +0 -43
  159. package/packages/utils/utils.js +0 -152
  160. package/packages/utils/value-set.js +0 -86
  161. package/packages/valid-code/index.js +0 -7
  162. package/packages/valid-code/src/valid-code.vue +0 -95
  163. package/packages/workflow-button/index.js +0 -6
  164. package/packages/workflow-button/src/workflow-button.vue +0 -325
  165. package/packages/workflow-history-list/index.js +0 -6
  166. package/packages/workflow-history-list/src/api.js +0 -7
  167. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  168. package/packages/workgroup-tree/index.js +0 -6
  169. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  170. package/packages/workgroup-tree-inline/index.js +0 -6
  171. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  172. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  173. package/packages/workgroup-user-tree/index.js +0 -6
  174. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  175. package/packages/workgroup-user-tree-inline/index.js +0 -6
  176. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  177. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  178. package/packages/year-range-picker/index.js +0 -6
  179. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  180. package/src/index.js +0 -93
  181. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,561 +0,0 @@
1
- /* eslint-disable no-undef */
2
- import Vue from 'vue'
3
- import Sortable from 'sortablejs'
4
- import store from './store'
5
- import {
6
- packageEnumAndBeanColumnValueSets
7
- } from '../../utils/value-set'
8
- import {
9
- isHasOptionFunction
10
- } from './utils'
11
- const superGridService = {
12
- initialize() {
13
- const a = new Date().getTime()
14
- return new Promise((resolve, reject) => {
15
- const gridParams = store.get(this.code)
16
- if (this.options.isAdministerListView) {
17
- // 要从配置中实时获取页面的配置
18
- // 根据this.options.showColumns设置显示的字段
19
- this.getShowColumns(this.options.SuperGrid)
20
- Object.assign(this, this.options.SuperGrid)
21
- gridParams.isSql = this.isSql
22
- gridParams.columns = this.columns
23
- gridParams.query = this.query
24
- gridParams.pagination = this.pagination
25
- this.createBackgroundColorMap()
26
- this.hasLoadedColumns = true
27
- this.fetchData(null, null, null, null)
28
- resolve()
29
- } else {
30
- const url = Vue.prototype.baseAPI + '/component/super-grids/' + this.code
31
- const param = {}
32
- const isSqlSetting = this.options.isSql
33
- if (this.options && typeof (isSqlSetting) !== 'undefined') {
34
- this.isSql = isSqlSetting
35
- param.isSql = isSqlSetting + ''
36
- }
37
- if (this.options && typeof (this.options.isAdministerListView) !== 'undefined' && this.options.isAdministerListView) {
38
- param.isAdminister = this.options.isAdministerListView + ''
39
- }
40
- let additionalParams
41
- const additionalParamMap = sessionStorage.getItem('additionalParamMap')
42
- if (additionalParamMap) {
43
- console.log('进入判断', additionalParamMap)
44
- if (additionalParamMap && typeof (additionalParamMap) === 'object') {
45
- additionalParams = JSON.stringify(additionalParamMap)
46
- } else if (additionalParamMap && additionalParamMap !== '') {
47
- additionalParams = additionalParamMap
48
- }
49
- }
50
- if (this.options.additionalParamMap && typeof (this.options.additionalParamMap) === 'object') {
51
- const optionParam = JSON.stringify(this.options.additionalParamMap)
52
- if (additionalParams) {
53
- Object.assign(additionalParams, optionParam)
54
- } else {
55
- additionalParams = optionParam
56
- }
57
- } else if (this.options.additionalParamMap && this.options.additionalParamMap !== '') {
58
- const optionParam = this.options.additionalParamMap
59
- if (additionalParams) {
60
- Object.assign(additionalParams, optionParam)
61
- } else {
62
- additionalParams = optionParam
63
- }
64
- }
65
- if (additionalParams) {
66
- param.additionalParamMap = additionalParams
67
- }
68
- if (this.options.extraParam && this.options.extraParam.entityMap) {
69
- this.parentFormData = this.options.extraParam.entityMap
70
- }
71
- this.isLoading = true
72
- // 初始化组件时先获取元信息再获取数据,以后翻页、排序、查询不再去获取元数据了
73
- this.$http.post(url, param).then(data => {
74
- const p1 = new Date().getTime()
75
- // 行编辑设置所有字段的默认值null时使用,优化行编辑性能
76
- let allColumns = []
77
- allColumns = allColumns.concat(JSON.parse(JSON.stringify(data.columns)))
78
- // 根据this.options.showColumns设置显示的字段
79
- this.getShowColumns(data)
80
- // 将列表信息存入store缓存中,用来导出时获取国际化名
81
- if (data.basicInfo) {
82
- store.set(this.code + 'basicInfo', data.basicInfo)
83
- }
84
- if (this.options.pageSizes && data.pagination) {
85
- // 组件的options属性配置中配置“可选行数”,已该配置为准
86
- let pageSizeArr = null
87
- const pageSizeStrs = this.options.pageSizes.split(',')
88
- if (pageSizeStrs && pageSizeStrs.length > 0) {
89
- pageSizeArr = []
90
- for (var i = 0; i < pageSizeStrs.length; i++) {
91
- pageSizeArr.push(pageSizeStrs[i] * 1)
92
- }
93
- data.pagination.pageSize = pageSizeArr[0]
94
- }
95
- data.pagination.layout = 'total, sizes, prev, pager, next, jumper'
96
- data.pagination.pageSizes = pageSizeArr
97
- }
98
- if (typeof (this.options.initSortInfo) !== 'undefined') {
99
- // 组件的options属性配置中配置“排序信息”,以该配置为准
100
- if (Array.isArray(this.options.initSortInfo)) {
101
- data.sortInfo = this.options.initSortInfo
102
- } else {
103
- data.sortInfo = []
104
- data.sortInfo.push(this.options.initSortInfo)
105
- }
106
- }
107
-
108
- // 需要多个组件共享的数据放到store中,避免组件定义一堆props来接收这些共享数据
109
- packageEnumAndBeanColumnValueSets(data.columns, this.code).then(() => {
110
- return this.getDynamicColumnByBean(additionalParams, data.dynamicColumnInfo, data.columns, gridParams)
111
- }).then((dynamicColumns) => {
112
- const b = new Date().getTime()
113
- let showColumns = []
114
- if (typeof (this.options.showColumns) !== 'undefined') {
115
- showColumns = this.options.showColumns.split(',')
116
- }
117
- let customDynamicColumns = dynamicColumns
118
- if (!customDynamicColumns || customDynamicColumns.length === 0) {
119
- if (this.options.dynamicColumns && this.options.dynamicColumns.length > 0) {
120
- customDynamicColumns = this.options.dynamicColumns
121
- }
122
- }
123
- if (customDynamicColumns && customDynamicColumns.length > 0) {
124
- allColumns = allColumns.concat(JSON.parse(JSON.stringify(customDynamicColumns)))
125
- if (showColumns && showColumns.length > 0) {
126
- for (let i = 0; i < customDynamicColumns.length; i++) {
127
- const prop = customDynamicColumns[i].prop
128
- customDynamicColumns[i].dynamic = true
129
- if (showColumns.indexOf(prop) >= 0) {
130
- customDynamicColumns[i].show = true
131
- } else {
132
- customDynamicColumns[i].show = false
133
- }
134
- }
135
- }
136
- data.columns = data.columns.concat(customDynamicColumns)
137
- // 按照排序字段的值升序排列字段
138
- data.columns = data.columns.sort((col1, col2) => col1.displayOrder - col2.displayOrder)
139
- }
140
- Object.assign(this, data)
141
- if (this.options && typeof (isSqlSetting) === 'undefined') {
142
- // 如果options中没有配置,则以后台传过来的为准,在有动态列配置时,该值会赋值为true
143
- this.isSql = this.basicInfo.sql
144
- }
145
- gridParams.isSql = this.isSql
146
- // 行编辑时使用
147
- gridParams.allColumns = allColumns
148
- gridParams.columns = this.columns
149
- // 存放map,prop-columnOption。方便直接通过prop 获取对应的配置
150
- this.packageColumnOptionMap(gridParams)
151
- // const columnOptionMap = {}
152
- // if (gridParams.columns && gridParams.columns.length > 0) {
153
- // gridParams.columns.forEach(item => {
154
- // if (item && item.prop) {
155
- // columnOptionMap[item.prop] = item
156
- // }
157
- // })
158
- // }
159
- // gridParams.columnOptionMap = columnOptionMap
160
- this.judgeIsFormSubTable()
161
- gridParams.colSetting = this.colSetting
162
- gridParams.lineEdit = this.lineEdit
163
- gridParams.basicInfo = this.basicInfo
164
- gridParams.pagination = this.pagination
165
- if (this.pagination) {
166
- // 监控每行显示多少条变量使用
167
- this.pageSize = this.pagination.pageSize
168
- }
169
- gridParams.query = this.query
170
- gridParams.dynamicColumnInfo = this.dynamicColumnInfo
171
- gridParams.mainDefaultValueColumns = this.mainDefaultValueColumns
172
- gridParams.contextParameter = this.contextParameter
173
- // 是否显示分页区域
174
- this.isShowPage = this.isShowPageArea()
175
- // 子表是否分页
176
- this.isSubTableShowPage = this.isFormSubTable ? this.isShowPage : false
177
- gridParams.isSubTableShowPage = this.isSubTableShowPage
178
- this.hasLoadedColumns = true
179
- let canFetchData = true
180
- if (isHasOptionFunction('loadBeforeSend', this.code)) {
181
- canFetchData = gridParams.options.loadBeforeSend.call(this, {
182
- columns: this.columns,
183
- gridParams
184
- })
185
- }
186
- if (canFetchData === undefined || canFetchData === true) {
187
- // 表示初始化时查询记录
188
- if (this.options.isPageInfo) {
189
- // 表示是页面展示模式
190
- } else if (typeof (this.options.initSearch) === 'undefined') {
191
- if (typeof (gridParams.basicInfo.initializationQuery) === 'undefined' || gridParams.basicInfo.initializationQuery) {
192
- this.fetchData()
193
- }
194
- } else if (this.options.initSearch !== false) {
195
- this.fetchData()
196
- }
197
- }
198
- this.createBackgroundColorMap()
199
- const p2 = new Date().getTime()
200
- console.log('拿到共享数据并存储p2-p1=', p2 - p1)
201
- console.log('拿到共享数据并存储p2-b=', p2 - b)
202
- resolve()
203
- }).catch(error => {
204
- reject(error)
205
- })
206
- }).catch(error => {
207
- reject(error)
208
- })
209
- }
210
- const a1 = new Date().getTime()
211
- console.log('初始化所耗时间', a1 - a)
212
- })
213
- },
214
- packageColumnOptionMap(gridParams) {
215
- const columnOptionMap = {}
216
- if (gridParams.columns && gridParams.columns.length > 0) {
217
- this.packageColumnOptionMapItems(gridParams.columns, columnOptionMap)
218
- }
219
- gridParams.columnOptionMap = columnOptionMap
220
- },
221
- packageColumnOptionMapItems(columns, columnOptionMap) {
222
- columns.forEach(item => {
223
- if (item.children && item.children.length > 0) {
224
- this.packageColumnOptionMapItems(item.children, columnOptionMap)
225
- }
226
- if (item && item.prop) {
227
- columnOptionMap[item.prop] = item
228
- }
229
- })
230
- },
231
- getDynamicColumnByBean(additionalParams, dynamicColumnInfos, columns, gridParams) {
232
- return new Promise((resolve, reject) => {
233
- if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
234
- this.parentFormData = gridParams.options.extraParam.entityMap
235
- }
236
- if (!this.options.isPageInfo && dynamicColumnInfos && dynamicColumnInfos.length > 0) {
237
- const totalDynamicColumns = []
238
- this.getDynamicColumnByBeanWithOneSet(additionalParams, dynamicColumnInfos[0], columns, 0, dynamicColumnInfos, totalDynamicColumns, gridParams).then(totalDynamicColumns => {
239
- resolve(totalDynamicColumns)
240
- }).catch(error => {
241
- reject(error)
242
- })
243
- } else {
244
- resolve([])
245
- }
246
- })
247
- },
248
- getDynamicColumnByBeanWithOneSet(additionalParams, dynamicColumnInfo, columns, index, dynamicColumnInfos, totalDynamicColumns, gridParams) {
249
- return new Promise((resolve, reject) => {
250
- if (dynamicColumnInfo && dynamicColumnInfo.beanName) {
251
- const url = Vue.prototype.baseURL + '/common/dynamic-columns'
252
- const param = {
253
- additionalParams, // 附加参数对象
254
- listCode: this.code,
255
- columns,
256
- beanName: dynamicColumnInfo.beanName
257
- }
258
- if (this.parentFormData) {
259
- // 初始化表单时,加载动态列需要
260
- if (gridParams.dynamicTemp) {
261
- param.parent = gridParams.dynamicTemp.parent
262
- param.watchParentAttrValues = gridParams.dynamicTemp.watchParentAttrValues
263
- } else {
264
- param.parent = this.parentFormData
265
- }
266
- // 监听主表字段的值
267
- if (dynamicColumnInfo.watchParentAttr) {
268
- const watchParentAttrs = dynamicColumnInfo.watchParentAttr.split(',')
269
- watchParentAttrs.forEach(watchParentAttr => {
270
- if (watchParentAttr) {
271
- // 存储属性对应的值
272
- if (!param.watchParentAttrValues) {
273
- param.watchParentAttrValues = {}
274
- }
275
- param.watchParentAttrValues[watchParentAttr] = this.parentFormData[watchParentAttr]
276
- const unWatch = this.$watch('parentFormData.' + watchParentAttr, function(newValue, oldValue) {
277
- // 重新加载表格及表格数据
278
- if (!gridParams.dynamicTemp) {
279
- gridParams.dynamicTemp = {}
280
- }
281
- gridParams.dynamicTemp.parent = this.parentFormData
282
- if (!gridParams.dynamicTemp.watchParentAttrValues) {
283
- gridParams.dynamicTemp.watchParentAttrValues = {}
284
- }
285
- gridParams.dynamicTemp.watchParentAttrValues[watchParentAttr] = newValue
286
- if (this.$refs && this.$refs.superGrid) {
287
- // 手动注销watch,否则会调用多次watch
288
- unWatch()
289
- // 重新加载表格及表格数据
290
- this.$emit('reload-grid')
291
- }
292
- })
293
- }
294
- })
295
- }
296
- }
297
- this.$http.post(url, param).then(dynamicColumns => {
298
- // 给动态列分组。如果是后台接口返回的动态列,保存时要自己实现动态列的保存
299
- dynamicColumnInfo.dynamicColumns = dynamicColumns
300
- totalDynamicColumns = totalDynamicColumns.concat(dynamicColumns)
301
- if (index + 1 < dynamicColumnInfos.length) {
302
- this.getDynamicColumnByBeanWithOneSet(additionalParams, dynamicColumnInfos[index + 1], columns, index + 1, dynamicColumnInfos, totalDynamicColumns)
303
- } else {
304
- resolve(totalDynamicColumns)
305
- }
306
- }).catch(() => {
307
- resolve([])
308
- })
309
- } else {
310
- resolve([])
311
- }
312
- })
313
- },
314
- // 列拖拽
315
- columnDrop() {
316
- const vm = this
317
- // 作用于实际展示列表数据时拖拽列
318
- let isDragColumnFlag = false
319
- if (typeof (this.options.isDragColumnFlag) !== 'undefined' && this.options.isDragColumn != null &&
320
- this.options.isDragColumn === true) {
321
- isDragColumnFlag = true
322
- const wrapperTr = document.querySelector('.el-table__header-wrapper tr')
323
- if (wrapperTr != null) {
324
- this.sortable = Sortable.create(wrapperTr, {
325
- animation: 180,
326
- delay: 0,
327
- onEnd: evt => {
328
- let oldIndex = evt.oldIndex
329
- let newIndex = evt.newIndex
330
- // 判断冻结列,获取真实index
331
- const frozenArr = []
332
- // const columns = this.listColumnList.filter(listColumn => {
333
- // return listColumn.listColumnFixed === 'left' || listColumn.listColumnFixed === 'right'
334
- // })
335
- for (var r = 0; r < vm.columns.length; r++) {
336
- if (vm.columns[r].fixed === 'left' || vm.columns[r].fixed === 'right') {
337
- frozenArr.push(r)
338
- }
339
- }
340
- if (frozenArr && frozenArr.length > 0) {
341
- for (var m = 0; m < frozenArr.length; m++) {
342
- if (frozenArr[m] >= newIndex) {
343
- newIndex--
344
- }
345
- if (frozenArr[m] >= oldIndex) {
346
- oldIndex--
347
- }
348
- }
349
- }
350
- if (oldIndex !== null && oldIndex !== undefined && oldIndex !== -1 && newIndex !== null && newIndex !== undefined && newIndex !== -1) {
351
- if (oldIndex > newIndex) {
352
- // 从后往前
353
- if (vm.columns && vm.columns.length > 0) {
354
- const item = vm.columns[oldIndex]
355
- for (var i = oldIndex - 1; i >= newIndex; i--) {
356
- const col = vm.columns[i]
357
- col.displayOrderType = 'custom'
358
- vm.columns[i + 1] = col
359
- }
360
- vm.columns[newIndex] = item
361
- }
362
- } else {
363
- // 从前往后
364
- if (vm.columns && vm.columns.length > 0) {
365
- const item = vm.columns[oldIndex]
366
- for (var k = oldIndex + 1; k <= newIndex; k++) {
367
- const col = vm.columns[k]
368
- col.displayOrderType = 'custom'
369
- vm.columns[k - 1] = col
370
- }
371
- vm.columns[newIndex] = item
372
- }
373
- }
374
- }
375
- vm.indexAfterTheChangeUpdateDisplayOrder(vm.columns, oldIndex, newIndex, 'displayOrder')
376
- let splitArr = []
377
- if (oldIndex > newIndex) {
378
- // 从后往前
379
- splitArr = vm.columns.slice(newIndex, oldIndex + 1)
380
- } else {
381
- // 从前往后
382
- splitArr = vm.columns.slice(oldIndex, newIndex + 1)
383
- }
384
- const params = {
385
- listCode: vm.code,
386
- columns: splitArr
387
- }
388
- vm.$http.post(Vue.prototype.baseAPI + '/component/super-grids/drag-columns', params).then(data => {
389
- console.log('移动成功')
390
- })
391
- // const oldIndex = evt.oldIndex
392
- // const newIndex = evt.newIndex
393
- // const currentItem = vm.columns[evt.oldIndex]
394
- // const targetItem = vm.columns[evt.newIndex]
395
- // const currentDisplayOrder = vm.getDisplayOrder(currentItem, oldIndex + 1)
396
- // const targetDisplayOrder = vm.getDisplayOrder(targetItem, newIndex + 1)
397
- // const params = {
398
- // 'listCode': vm.code,
399
- // 'oldIndex': currentDisplayOrder,
400
- // 'newIndex': targetDisplayOrder,
401
- // 'currentProp': currentItem.prop, // 当前拖动的列的属性名
402
- // 'targetProp': targetItem.prop // 拖动的列的原属性名
403
- // }
404
- // vm.$http.post(Vue.prototype.baseAPI + '/component/super-grids/drag-columns', params).then(data => {
405
- // vm.columns.splice(oldIndex, 1)
406
- // vm.columns.splice(newIndex, 0, currentItem)
407
- // vm.$set(currentItem, 'displayOrder', targetDisplayOrder)
408
- // vm.$set(currentItem, 'displayOrderType', 'custom')
409
- // vm.$set(targetItem, 'displayOrder', currentDisplayOrder)
410
- // vm.$set(targetItem, 'displayOrderType', 'custom')
411
- // })
412
- }
413
- })
414
- }
415
- }
416
- // 作用于列表管理编辑模式
417
- // 作用于列表管理编辑模式
418
- if (typeof (this.options.isAdministerListView) !== 'undefined' && this.options.isAdministerListView != null &&
419
- this.options.isAdministerListView === true && !isDragColumnFlag) {
420
- const wrapperTr = document.querySelector('.el-table__header-wrapper tr')
421
- if (wrapperTr != null) {
422
- this.sortable = Sortable.create(wrapperTr, {
423
- animation: 180,
424
- delay: 0,
425
- onEnd: evt => {
426
- const oldIndex = evt.oldIndex
427
- const newIndex = evt.newIndex
428
- const oldItem = this.columns[evt.oldIndex]
429
- const that = this
430
- that.columns.splice(oldIndex, 1)
431
- that.columns.splice(newIndex, 0, oldItem)
432
- this.$emit('columnDrop', oldIndex, newIndex)
433
- }
434
- })
435
- }
436
- }
437
- },
438
- // 移动完成后的displayOrder设置
439
- indexAfterTheChangeUpdateDisplayOrder(dataList, oldIndex, newIndex, prop) {
440
- if (dataList && dataList.length > 0) {
441
- if (oldIndex != null && oldIndex !== undefined && oldIndex !== -1) {
442
- if (newIndex !== null && newIndex !== undefined && newIndex !== -1) {
443
- if (prop && prop !== '') {
444
- const selectCol = dataList[newIndex]
445
- if (newIndex > oldIndex) {
446
- // 表示向后移动
447
- // 位置已经移动,所以参数要赋值给原始位置的下一个
448
- const afProp = dataList[newIndex - 1][prop]
449
- const arr = dataList.slice(oldIndex, newIndex)
450
- if (arr && arr.length > 0) {
451
- for (let i = arr.length - 1; i > -1; i--) {
452
- const col = arr[i]
453
- if (i === 0) {
454
- // 紧靠原始位置的上一个
455
- col[prop] = selectCol[prop]
456
- } else {
457
- col[prop] = arr[i - 1][prop]
458
- }
459
- }
460
- }
461
- selectCol[prop] = afProp
462
- } else {
463
- const befProp = dataList[newIndex + 1][prop]
464
- // 表示向前移动
465
- // 位置已经移动,所以参数要赋值给原始位置的上一个
466
- const arr = dataList.slice(newIndex + 1, oldIndex + 1)
467
- if (arr && arr.length > 0) {
468
- for (let i = 0; i < arr.length; i++) {
469
- const col = arr[i]
470
- if (i === arr.length - 1) {
471
- // 紧靠原始位置的上一个
472
- col[prop] = selectCol[prop]
473
- } else {
474
- col[prop] = arr[i + 1][prop]
475
- }
476
- }
477
- }
478
- selectCol[prop] = befProp
479
- }
480
- }
481
- }
482
- }
483
- }
484
- },
485
- getDisplayOrder(column, dragIndex) {
486
- if (column && column.displayOrder !== undefined && column.displayOrder !== null) {
487
- return column.displayOrder
488
- } else {
489
- return dragIndex + 1
490
- }
491
- },
492
- getShowColumns(data) {
493
- let showColumns = []
494
- if (typeof (this.options.showColumns) !== 'undefined') {
495
- showColumns = this.options.showColumns.split(',')
496
- }
497
- if (showColumns.length > 0) {
498
- const columns = []
499
- for (let i = 0; i < data.columns.length; i++) {
500
- const column = data.columns[i]
501
- const prop = column.prop
502
- if (prop === '$index' || prop === '$selection') {
503
- columns.push(column)
504
- continue
505
- }
506
- if (column.hasOwnProperty('children')) {
507
- // 表示是组合表头,需要判断子表头是否显示
508
- const children = this.getChildrenColumns(column.children, showColumns)
509
- column.children = children
510
- if (children.length > 0) {
511
- columns.push(column)
512
- }
513
- } else {
514
- if (showColumns.indexOf(prop) >= 0) {
515
- columns.push(column)
516
- }
517
- }
518
- }
519
- data.columns = columns
520
- }
521
- },
522
- getChildrenColumns(children, showColumns) {
523
- const columns = []
524
- for (let i = 0; i < children.length; i++) {
525
- const column = children[i]
526
- const prop = column.prop
527
- if (column.hasOwnProperty('children')) {
528
- // 表示是组合表头,需要判断子表头是否显示
529
- const children = this.getChildrenColumns(column.children, showColumns)
530
- column.children = children
531
- if (children.length > 0) {
532
- columns.push(column)
533
- }
534
- } else {
535
- if (showColumns.indexOf(prop) >= 0) {
536
- columns.push(column)
537
- }
538
- }
539
- }
540
- return columns
541
- },
542
- // 保存拖动列宽
543
- saveColumnWidth(prop, width) {
544
- return new Promise((resolve, reject) => {
545
- if (width !== undefined) {
546
- const params = {
547
- 'prop': prop,
548
- 'width': width + ''
549
- }
550
- this.$http.post(Vue.prototype.baseAPI + '/component/super-grids/setting-column-widths/' + this.code, params).then(data => {
551
- resolve(width)
552
- }).catch(error => {
553
- reject(error)
554
- })
555
- } else {
556
- resolve()
557
- }
558
- })
559
- }
560
- }
561
- export default superGridService