imatrix-ui 2.9.13-dw → 2.9.14-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 (186) 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/assets/nonemessage.png +0 -0
  6. package/src/i18n/i18n.js +1 -1
  7. package/src/i18n/langs/cn.js +18 -6
  8. package/src/i18n/langs/en.js +20 -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/index.scss +74 -4
  15. package/src/styles/theme/black/font-style.scss +70 -0
  16. package/src/styles/theme/black/index.scss +6 -30
  17. package/src/styles/theme/blue/font-style.scss +37 -0
  18. package/src/styles/theme/blue/index.scss +2 -18
  19. package/src/styles/theme/blue2/font-style.scss +70 -0
  20. package/src/styles/theme/blue2/index.scss +3 -13
  21. package/src/styles/theme/dark-blue/card.scss +4 -6
  22. package/src/styles/theme/dark-blue/index.scss +28 -3
  23. package/src/styles/theme/dark-blue/message.scss +8 -0
  24. package/src/styles/theme/dark-blue/radio.scss +13 -0
  25. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  26. package/src/styles/theme/dark-blue/table.scss +1 -1
  27. package/src/styles/theme/dark-blue/tree.scss +35 -10
  28. package/src/styles/theme/gray/card-style.scss +13 -1
  29. package/src/styles/theme/gray/font-style.scss +38 -0
  30. package/src/styles/theme/gray/index.scss +13 -25
  31. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  32. package/src/styles/theme/gray/sidebar.scss +7 -14
  33. package/src/utils/auth-api.js +45 -1
  34. package/src/utils/common-util.js +21 -81
  35. package/src/utils/jump-page-utils.js +1 -2
  36. package/src/utils/range-selector.js +185 -0
  37. package/src/utils/request.js +6 -3
  38. package/src/utils/util.js +13 -11
  39. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  40. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  41. package/src/views/dsc-component/Sidebar/index.vue +12 -20
  42. package/src/views/dsc-component/tabs/tab-content.vue +1 -5
  43. package/src/views/layout/NewLayout.vue +6 -65
  44. package/src/views/layout/components/Menubar/Item.vue +23 -7
  45. package/src/views/layout/components/Menubar/Link.vue +11 -2
  46. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  47. package/src/views/layout/components/Menubar/index.vue +51 -16
  48. package/src/views/layout/components/tabs/tab-content.vue +160 -0
  49. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  50. package/src/views/layout/tab-content-index.vue +85 -0
  51. package/src/views/login/index.vue +1 -1
  52. package/packages/breadcrumb/index.js +0 -6
  53. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  54. package/packages/department-tree/index.js +0 -6
  55. package/packages/department-tree/src/department-tree.vue +0 -108
  56. package/packages/department-tree-inline/index.js +0 -6
  57. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -402
  58. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -284
  59. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  60. package/packages/department-tree-inline/src/department-tree-service.js +0 -245
  61. package/packages/department-tree-inline/src/search-result.vue +0 -176
  62. package/packages/department-user-tree/index.js +0 -6
  63. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  64. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  65. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  66. package/packages/department-user-tree-inline/index.js +0 -6
  67. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -626
  68. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -269
  69. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  70. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -230
  71. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -122
  72. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  73. package/packages/directives/prevent-reclick.js +0 -19
  74. package/packages/dynamic-source-select/index.js +0 -6
  75. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  76. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  77. package/packages/dynamic-source-select/src/events.js +0 -55
  78. package/packages/fs-preview/index.js +0 -6
  79. package/packages/fs-preview/src/fs-preview.vue +0 -226
  80. package/packages/fs-upload/index.js +0 -6
  81. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  82. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  83. package/packages/fs-upload/src/fs-upload.vue +0 -189
  84. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  85. package/packages/fs-upload-list/index.js +0 -6
  86. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  87. package/packages/hamburger/index.js +0 -6
  88. package/packages/hamburger/src/hamburger.vue +0 -38
  89. package/packages/index.js +0 -121
  90. package/packages/multipart-upload/index.js +0 -6
  91. package/packages/multipart-upload/src/index.vue +0 -73
  92. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  93. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  94. package/packages/organization-input/index.js +0 -6
  95. package/packages/organization-input/src/organization-input.vue +0 -542
  96. package/packages/plugins/export-data-new.js +0 -466
  97. package/packages/plugins/export-data.js +0 -361
  98. package/packages/plugins/index.js +0 -15
  99. package/packages/plugins/public-method.js +0 -43
  100. package/packages/remove-department/index.js +0 -6
  101. package/packages/remove-department/src/remove-department.vue +0 -172
  102. package/packages/remove-department/src/remove-dept-service.js +0 -20
  103. package/packages/remove-user/index.js +0 -6
  104. package/packages/remove-user/src/remove-user-service.js +0 -20
  105. package/packages/remove-user/src/remove-user.vue +0 -195
  106. package/packages/remove-workgroup/index.js +0 -6
  107. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  108. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  109. package/packages/rich-editor/index.js +0 -7
  110. package/packages/rich-editor/index.vue +0 -278
  111. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  112. package/packages/rich-editor/viewer.vue +0 -103
  113. package/packages/scan-code-input/index.js +0 -6
  114. package/packages/scan-code-input/src/events.js +0 -33
  115. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  116. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  117. package/packages/secret-info/index.js +0 -7
  118. package/packages/secret-info/index.vue +0 -90
  119. package/packages/super-grid/index.js +0 -7
  120. package/packages/super-grid/src/apis.js +0 -808
  121. package/packages/super-grid/src/columns-config.vue +0 -335
  122. package/packages/super-grid/src/custom-formatter.js +0 -250
  123. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  124. package/packages/super-grid/src/eventBus.js +0 -2
  125. package/packages/super-grid/src/events.js +0 -55
  126. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  127. package/packages/super-grid/src/formatter.js +0 -181
  128. package/packages/super-grid/src/group-column.vue +0 -100
  129. package/packages/super-grid/src/header-context-menu.vue +0 -87
  130. package/packages/super-grid/src/index-column.vue +0 -51
  131. package/packages/super-grid/src/normal-column.vue +0 -769
  132. package/packages/super-grid/src/public-methods.js +0 -31
  133. package/packages/super-grid/src/row-operation.vue +0 -161
  134. package/packages/super-grid/src/search-button.vue +0 -66
  135. package/packages/super-grid/src/search-condition-input.vue +0 -61
  136. package/packages/super-grid/src/search-condition-list.vue +0 -59
  137. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  138. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  139. package/packages/super-grid/src/search-form-item.vue +0 -400
  140. package/packages/super-grid/src/search-form-number.vue +0 -38
  141. package/packages/super-grid/src/search-form-open.vue +0 -165
  142. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -191
  143. package/packages/super-grid/src/search-form.vue +0 -637
  144. package/packages/super-grid/src/search-methods.js +0 -454
  145. package/packages/super-grid/src/selection-column.vue +0 -43
  146. package/packages/super-grid/src/store.js +0 -3
  147. package/packages/super-grid/src/super-grid-service.js +0 -562
  148. package/packages/super-grid/src/super-grid.vue +0 -2850
  149. package/packages/super-grid/src/utils.js +0 -762
  150. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  151. package/packages/super-nine-grid/index.js +0 -7
  152. package/packages/super-nine-grid/src/apis.js +0 -103
  153. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  154. package/packages/super-nine-grid/src/formatter.js +0 -132
  155. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  156. package/packages/super-nine-grid/src/search-form.vue +0 -430
  157. package/packages/super-nine-grid/src/search-methods.js +0 -134
  158. package/packages/super-nine-grid/src/store.js +0 -3
  159. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  160. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  161. package/packages/super-nine-grid/src/utils.js +0 -261
  162. package/packages/svg-icon/index.js +0 -6
  163. package/packages/svg-icon/src/svg-icon.vue +0 -43
  164. package/packages/utils/utils.js +0 -152
  165. package/packages/utils/value-set.js +0 -86
  166. package/packages/valid-code/index.js +0 -7
  167. package/packages/valid-code/src/valid-code.vue +0 -95
  168. package/packages/workflow-button/index.js +0 -6
  169. package/packages/workflow-button/src/workflow-button.vue +0 -325
  170. package/packages/workflow-history-list/index.js +0 -6
  171. package/packages/workflow-history-list/src/api.js +0 -7
  172. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  173. package/packages/workgroup-tree/index.js +0 -6
  174. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  175. package/packages/workgroup-tree-inline/index.js +0 -6
  176. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  177. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  178. package/packages/workgroup-user-tree/index.js +0 -6
  179. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  180. package/packages/workgroup-user-tree-inline/index.js +0 -6
  181. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  182. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  183. package/packages/year-range-picker/index.js +0 -6
  184. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  185. package/src/index.js +0 -93
  186. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,637 +0,0 @@
1
- <template>
2
- <div>
3
- <search-condition-list
4
- v-if="searchConditions.length > 0"
5
- ref="searchConditionList"
6
- :search-type="searchType"
7
- :search-conditions="searchConditions"
8
- @remove-condition="removeCondition"
9
- @select-condition="selectCondition"
10
- />
11
- <search-form-ordinarySearch
12
- v-if="searchType === 'normal'"
13
- ref="searchFormOrdinarySearch"
14
- :searchable-columns="searchableColumns"
15
- :search-form="searchForm"
16
- :field-num="fieldNum"
17
- :label-width="labelWidth"
18
- :query="query"
19
- :code="code"
20
- :row-num="rowNum"
21
- :span-num="spanNum"
22
- :rules="rules"
23
- :is-sql="isSql"
24
- @submit-form="submitForm('searchForm')"
25
- @reset-form="resetForm('searchForm')"
26
- @save-condition="saveCondition()"
27
- @open-fold="openFold"
28
- />
29
- <search-form-advancedQuery
30
- v-if="searchType === 'advanced'"
31
- ref="searchFormAdvancedQuery"
32
- style="padding-bottom:10px"
33
- :code="code"
34
- :searchable-columns="advancedQueryColumns"
35
- :search-form-list="searchFormList"
36
- :prop-map="propMap"
37
- :is-sql="isSql"
38
- @resetForm="resetSearchFormList"
39
- />
40
- <div v-if="searchType === 'advanced'" style="padding-top:10px;padding-bottom:10px;text-align: center">
41
- <el-button :loading="loading" type="primary" size="mini" @click="submitForm('searchForm')">
42
- {{ $t('imatrixUIPublicModel.sure') }}
43
- </el-button>
44
- <el-button :loading="loading" size="mini" @click="resetForm('searchForm')">
45
- {{ $t('imatrixUIPublicModel.reset') }}
46
- </el-button>
47
- <el-button size="mini" @click="saveCondition">
48
- {{ $t('superGrid.saveCondition') }}
49
- </el-button>
50
- <span v-if="advancedQuery !== null && advancedQuery!== undefined && advancedQuery === true && normalQuery !== null && normalQuery!== undefined && normalQuery === true" style="margin-left:10px">
51
- <el-button v-if="searchType === 'advanced'" size="mini" @click="searchType = 'normal'">
52
- {{ $t('imatrixUIPublicModel.switchToNormalQuery') }}
53
- </el-button>
54
- <el-button v-if="searchType === 'normal'" size="mini" @click="searchType = 'advanced'">
55
- {{ $t('imatrixUIPublicModel.switchToAdvancedQuery') }}
56
- </el-button>
57
- </span>
58
- </div>
59
- <search-condition-input v-if="isShowSearchCondition" @close="saveConditionValue" />
60
- </div>
61
- </template>
62
- <style scoped>
63
- .grid-search-form{
64
- overflow: auto;
65
- }
66
- .grid-search-form >>> .el-form-item{
67
- margin-bottom: 0px;
68
- }
69
-
70
- .grid-search-form >>> .search-btn{
71
- margin-bottom: 5px;
72
- text-align: center;
73
- }
74
- .grid-search-form >>> .el-select,.grid-search-form >>> .customComponent{
75
- width: 100%;
76
- }
77
- </style>
78
- <script>
79
- import searchMethods from './search-methods'
80
- // import searchFormNumber from './search-form-number'
81
- import searchFormOrdinarySearch from './search-form-ordinarySearch'
82
- // import searchFormAdvancedQuery from './search-form-advancedQuery'
83
- import store from './store'
84
- // import { isOptionFunction, getSearchObject } from './utils'
85
- import { addDynamicProp, addDynamicPropDateSection } from './utils'
86
- import Vue from 'vue'
87
- import SearchConditionInput from './search-condition-input'
88
- import SearchConditionList from './search-condition-list'
89
- export default {
90
- name: 'SearchForm',
91
- components: {
92
- // searchFormNumber,
93
- SearchConditionInput,
94
- SearchConditionList,
95
- searchFormOrdinarySearch
96
- // searchFormAdvancedQuery
97
- },
98
- props: {
99
- columns: {
100
- type: Array,
101
- default: null
102
- },
103
- code: {
104
- type: String,
105
- default: null
106
- },
107
- url: {
108
- type: String,
109
- default: null
110
- },
111
- pagination: {
112
- type: Object,
113
- default: null
114
- },
115
- query: {
116
- type: Object,
117
- default: null
118
- },
119
- searchParam: {
120
- type: Object,
121
- default: null
122
- },
123
- initSearchProps: {
124
- type: Array,
125
- default: null
126
- },
127
- isSql: {
128
- type: Boolean,
129
- default: false
130
- },
131
- searchFormInfo: {
132
- type: Object,
133
- default: () => {
134
- return {}
135
- }
136
- }
137
-
138
- },
139
- data() {
140
- const customComponentNames = new Set()
141
- const gridParams = store.get(this.code)
142
- const propMap = {}
143
- let searchForm = {}
144
- if (this.searchParam !== null) {
145
- searchForm = JSON.parse(JSON.stringify(this.searchParam))
146
- }
147
- const searchColumns = this.getSearchableColumns(null, null, propMap)
148
- if (this.initSearchProps === undefined || this.initSearchProps === null) {
149
- this.initSearchProps = []
150
- }
151
- console.log('searchForm=', searchColumns)
152
- searchColumns.forEach(column => {
153
- // propMap[column.prop] = column
154
- if (this.initSearchProps.indexOf(column.prop) < 0) {
155
- // 表示没有默认初始查询字段
156
- if (column.prop && column.prop.indexOf('.') > 0) {
157
- if (column.componentType === 'dateSection') {
158
- addDynamicPropDateSection(searchForm, column.prop)
159
- } else {
160
- // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
161
- addDynamicProp(searchForm, column.prop)
162
- }
163
- } else {
164
- if (column.componentType === 'dateSection') {
165
- searchForm[column.prop] = [new Date(), new Date()]
166
- } else if (column.componentType === 'yearRange') {
167
- searchForm[column.prop] = ['', '']
168
- } else {
169
- searchForm[column.prop] = null
170
- }
171
- this.setDefaultQueryValue(column, searchForm)
172
- }
173
- }
174
- })
175
- const spanNum = this.getSpanNum()
176
- const fieldNum = this.getFieldNumPerRow()
177
- const rowNum = Math.ceil(searchColumns.length / fieldNum)
178
- const advancedQuery = this.query.advancedQuery
179
- const normalQuery = this.query.normalQuery
180
- // console.log('searchColumns.length=' + searchColumns.length + ',fieldNum=' + fieldNum + ',rowNum=' + rowNum)
181
- // // -2是把
182
- // const dateSpanNum = (spanNum - 2) / 2
183
-
184
- return {
185
- searchForm,
186
- rules: {
187
-
188
- },
189
- searchParams: [],
190
- labelWidth: gridParams.options.search && gridParams.options.search.labelWidth ? gridParams.options.search.labelWidth : '80px',
191
- customComponentNames: customComponentNames,
192
- componentName: '',
193
- spanNum: spanNum,
194
- fieldNum: fieldNum, // 每行放的字段个数
195
- rowNum: rowNum, // 一共有几行
196
- loading: false, // 是否正在查询,默认时否
197
- isShowSearchCondition: false,
198
- searchConditions: [],
199
- propMap,
200
- advancedQuery,
201
- normalQuery,
202
- searchFormList: [],
203
- searchType: null
204
- }
205
- },
206
- computed: {
207
- searchableColumns() {
208
- return this.getSearchableColumns()
209
- },
210
- advancedQueryColumns() {
211
- return this.getAdvancedQueryColumns()
212
- }
213
- },
214
- watch: {
215
- searchForm: {
216
- deep: true,
217
- handler(val) {
218
- this.$set(this.searchFormInfo, 'data', val)
219
- }
220
- }
221
- },
222
- created() {
223
- console.log('加载查询页面', this.searchType)
224
- this.listSearchConditions()
225
- if (this.normalQuery) {
226
- this.searchType = 'normal'
227
- } else if (this.advancedQuery) {
228
- this.searchType = 'advanced'
229
- }
230
- },
231
- methods: {
232
- ...searchMethods,
233
- // 每行放的字段个数
234
- getFieldNumPerRow() {
235
- const gridParams = store.get(this.code)
236
- return gridParams.options.search && gridParams.options.search.fieldNum ? gridParams.options.search.fieldNum : 3
237
- },
238
- // 根据每行显示的字段个数,确定栅栏个数,默认是4个字段。最多就只能放6个字段
239
- getSpanNum() {
240
- const fieldNum = this.getFieldNumPerRow()
241
- if (fieldNum === 1) {
242
- return 22
243
- } else if (fieldNum === 2) {
244
- return 10
245
- } else if (fieldNum === 3) {
246
- return 8
247
- } else if (fieldNum === 4) {
248
- return 6
249
- } else {
250
- // 6个字段
251
- return 4
252
- }
253
- },
254
- setValueToModelProp(prop, value, componentName, index) {
255
- if (prop && prop.indexOf('.') > 0) {
256
- const parentOjbect = this.getParentObject(prop)
257
- // 嵌套属性中的最后一个属性是属于这个中间父对象的,所有要通过中间父对象来赋值
258
- if (index != null && index !== undefined) {
259
- // parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index] = value
260
- this.$set(parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)], index, value)
261
- } else {
262
- parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)] = value
263
- }
264
- } else {
265
- if (index != null && index !== undefined) {
266
- this.$set(this.searchForm[prop], index, value)
267
- } else {
268
- this.searchForm[prop] = value
269
- }
270
- }
271
- },
272
- getAdvancedQueryColumns(columns, searchColumns, propMap) {
273
- if (!this.customComponentNames) {
274
- this.customComponentNames = new Set()
275
- }
276
- if (!searchColumns) {
277
- searchColumns = []
278
- }
279
- if (!columns) {
280
- columns = this.columns
281
- }
282
- for (let i = 0; i < columns.length; i++) {
283
- const column = columns[i]
284
- if (propMap) {
285
- propMap[column.prop] = column
286
- }
287
- if (column.prop === '$index' || column.prop === '$selection' || column.dynamic) {
288
- // 序号和复选框列、动态列 不属于该组件的查询字段
289
- continue
290
- }
291
- if (column.groupHeader) {
292
- // 组合表头中子表头的字段查询
293
- this.getSearchableColumns(column.children, searchColumns, propMap)
294
- } else {
295
- if (column.queryType === 'advanced' && !column.custom && column.prop !== '') {
296
- // 表示是普通查询,且不是占位符列,是查询字段
297
- if (typeof (column.componentType) === 'undefined' || column.componentType === '') {
298
- column.componentType = 'input'
299
- }
300
- if (column.querySetting && column.querySetting !== '') {
301
- const querySetting = JSON.parse(column.querySetting)
302
- if (querySetting.width) {
303
- column.searchControlWidth = 'width:' + querySetting.width + 'px'
304
- }
305
- if (querySetting.labelWidth) {
306
- column.searchLabelWidth = querySetting.labelWidth + 'px'
307
- }
308
- if (querySetting.label) {
309
- column.searchLabel = querySetting.label
310
- }
311
- }
312
- // 行编辑时自定义编辑组件
313
- if (column.componentType && column.componentType.indexOf('custom:') >= 0) {
314
- column.componentName = column.componentType.substring(column.componentType.indexOf(':') + 1)
315
- this.customComponentNames.add(column.componentName)
316
- } else {
317
- column.componentName = ''
318
- }
319
- // this.$set(this.propMap, column.prop, column)
320
- // this.propMap[column.prop] = column
321
- searchColumns.push(column)
322
- }
323
- }
324
- }
325
- return searchColumns
326
- },
327
- getSearchableColumns(columns, searchColumns, propMap) {
328
- if (!this.customComponentNames) {
329
- this.customComponentNames = new Set()
330
- }
331
- if (!searchColumns) {
332
- searchColumns = []
333
- }
334
- if (!columns) {
335
- columns = this.columns
336
- }
337
- for (let i = 0; i < columns.length; i++) {
338
- const column = columns[i]
339
- if (propMap) {
340
- propMap[column.prop] = column
341
- }
342
- if (column.prop === '$index' || column.prop === '$selection' || column.dynamic) {
343
- // 序号和复选框列、动态列 不属于该组件的查询字段
344
- continue
345
- }
346
- if (column.groupHeader) {
347
- // 组合表头中子表头的字段查询
348
- this.getSearchableColumns(column.children, searchColumns, propMap)
349
- } else {
350
- if (column.queryType === 'normal' && !column.custom && column.prop !== '') {
351
- // 表示是普通查询,且不是占位符列,是查询字段
352
- if (typeof (column.componentType) === 'undefined' || column.componentType === '') {
353
- column.componentType = 'input'
354
- }
355
- if (column.querySetting && column.querySetting !== '') {
356
- const querySetting = JSON.parse(column.querySetting)
357
- if (querySetting.width) {
358
- column.searchControlWidth = 'width:' + querySetting.width + 'px'
359
- }
360
- if (querySetting.labelWidth) {
361
- column.searchLabelWidth = querySetting.labelWidth + 'px'
362
- }
363
- if (querySetting.label) {
364
- column.searchLabel = querySetting.label
365
- }
366
- }
367
- // 行编辑时自定义编辑组件
368
- if (column.componentType && column.componentType.indexOf('custom:') >= 0) {
369
- column.componentName = column.componentType.substring(column.componentType.indexOf(':') + 1)
370
- this.customComponentNames.add(column.componentName)
371
- } else {
372
- column.componentName = ''
373
- }
374
- // this.$set(this.propMap, column.prop, column)
375
- // this.propMap[column.prop] = column
376
- searchColumns.push(column)
377
- }
378
- }
379
- }
380
- return searchColumns
381
- },
382
- customComponent(column) {
383
- const gridParams = store.get(this.code)
384
- if (column.componentName && column.componentName !== '') {
385
- this.customComponentNames.add(column.componentName)
386
- return true
387
- }
388
- if ((!column.componentName || column.componentName === '') &&
389
- gridParams.options &&
390
- gridParams.options.search &&
391
- gridParams.options.search.customSearchElements) {
392
- // 定义了自定义查询组件
393
- const propSearchEle = gridParams.options.search.customSearchElements[column.prop]
394
- // console.log('customComponent-customSearchElements-propSearchEle-', column.prop)
395
- if (propSearchEle) {
396
- column.componentName = 'custom-' + column.prop
397
- const component = propSearchEle.call(this, column)
398
- // console.log('customComponent-customSearchElements-')
399
- if (component) {
400
- this.customComponentNames.add(column.componentName)
401
- Vue.component(column.componentName, component)
402
- return true
403
- }
404
- }
405
- }
406
- return false
407
- },
408
- submitForm() {
409
- if (this.searchType === 'normal') {
410
- this.$refs.searchFormOrdinarySearch.validateForm().then(valid => {
411
- if (valid) {
412
- // this.loading = true
413
- this.searchParams = this.packageSearchParam()
414
- this.$emit('search', this.searchParams)
415
- } else {
416
- return false
417
- }
418
- })
419
- } else if (this.searchType === 'advanced') {
420
- this.$refs.searchFormAdvancedQuery.validateForm().then(valid => {
421
- if (valid) {
422
- this.loading = true
423
- this.searchParams = this.packageSearchParam()
424
- this.$emit('search', this.searchParams)
425
- } else {
426
- return false
427
- }
428
- })
429
- }
430
- },
431
- resetForm() {
432
- if (this.$refs.searchConditionList) {
433
- this.$refs.searchConditionList.editConditionId = null
434
- }
435
- if (this.searchType === 'normal') {
436
- this.$refs.searchFormOrdinarySearch.resetForm()
437
- } else if (this.searchType === 'advanced') {
438
- this.$refs.searchFormAdvancedQuery.resetForm()
439
- this.$emit('reset')
440
- }
441
- // 子组件重置完成后调用reset方法 同步执行
442
- // this.$emit('reset')
443
- },
444
- setNumberValue(value, r, n) {
445
- let itemValue = this.getFormItemValue(this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop)
446
- itemValue = value
447
- this.setValueToModelProp(this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop, itemValue)
448
- },
449
- listSearchConditions() {
450
- return new Promise((resolve, reject) => {
451
- this.listSearchCondition(this.code).then((conditions) => {
452
- this.searchConditions = conditions
453
- resolve(conditions)
454
- }).catch(error => {
455
- reject(error)
456
- })
457
- })
458
- },
459
- saveCondition() {
460
- const searchParams = this.packageSearchParam()
461
- if (!searchParams || searchParams.length === 0) {
462
- this.$message({
463
- type: 'warning',
464
- message: this.$t('imatrixUIMessage.pleaseInputSearchCondition'),
465
- showClose: true
466
- })
467
- return
468
- }
469
- this.isShowSearchCondition = true
470
- },
471
- saveConditionValue(conditionName) {
472
- if (conditionName) {
473
- let searchParams
474
- if (this.searchType === 'normal' || this.searchType === '' || this.searchType === null || this.searchType === undefined) {
475
- searchParams = this.packageSearchParam()
476
- } else {
477
- searchParams = this.searchFormList
478
- }
479
- const condition = {
480
- listCode: this.code,
481
- queryType: this.searchType === 'normal' || this.searchType === '' || this.searchType === null || this.searchType === undefined ? 'FIXED' : 'CUSTOM',
482
- name: conditionName,
483
- queryCondition: JSON.stringify(searchParams)
484
- }
485
- this.saveSearchCondition(condition).then((condition) => {
486
- this.$message({
487
- type: 'success',
488
- message: this.$t('imatrixUIMessage.saveSuccessfully'),
489
- showClose: true
490
- })
491
- this.isShowSearchCondition = false
492
- this.listSearchConditions().then(() => {
493
- if (this.$refs.searchConditionList) {
494
- // 选中刚刚保存的条件
495
- this.$refs.searchConditionList.editConditionId = condition.id + ''
496
- }
497
- // 查询条件对应的数据
498
- this.selectCondition(condition.id)
499
- })
500
- })
501
- }
502
- this.isShowSearchCondition = false
503
- },
504
- removeCondition(conditionId) {
505
- if (conditionId) {
506
- this.$confirm(this.$t('imatrixUIMessage.whetherToConfirmDeletion'), this.$t('imatrixUIMessage.tips'), {
507
- confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
508
- cancelButtonText: this.$t('imatrixUIPublicModel.cancel'),
509
- type: 'warning'
510
- }).then(() => {
511
- this.removeSearchCondition(conditionId).then(() => {
512
- this.$message({
513
- type: 'success',
514
- message: this.$t('superGrid.deleteSuccessful'),
515
- showClose: true
516
- })
517
- this.listSearchConditions()
518
- })
519
- })
520
- }
521
- },
522
- selectCondition(conditionId) {
523
- if (conditionId) {
524
- this.getSearchCondition(conditionId).then((searchCondition) => {
525
- if (searchCondition) {
526
- const queryCondition = searchCondition.queryCondition
527
- if (queryCondition) {
528
- if (this.searchType === 'normal' || this.searchType === '' || this.searchType === null || this.searchType === undefined) {
529
- const searchParams = JSON.parse(queryCondition)
530
- const searchForm = this.packageSearchForm(searchParams)
531
- if (searchForm) {
532
- this.searchForm = searchForm
533
- }
534
- // 查询数据
535
- this.loading = true
536
- this.$emit('search', searchParams)
537
- } else {
538
- this.searchFormList = JSON.parse(queryCondition)
539
- // 查询数据
540
- this.loading = true
541
- this.$emit('search', this.packageSearchParam())
542
- }
543
- }
544
- }
545
- })
546
- }
547
- },
548
- // 封装searchForm
549
- packageSearchForm(searchFormArr) {
550
- if (searchFormArr && searchFormArr.length > 0) {
551
- const searchForm = {}
552
- const initSearchProps = []
553
- searchFormArr.forEach(item => {
554
- // 获得的是"isDeleted"
555
- let prop = item.propName
556
- // 获得的是“deleted”
557
- const columnProp = item.columnProp
558
- const dataType = item.dataType
559
- if (dataType && dataType === 'BOOLEAN' && columnProp) {
560
- prop = columnProp
561
- }
562
- if (initSearchProps.indexOf(prop) === -1) {
563
- initSearchProps.push(prop)
564
- }
565
- const propValue = item.propValue
566
- if (prop && prop.indexOf('.') > 0) {
567
- // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
568
- addDynamicProp(searchForm, prop, propValue)
569
- } else {
570
- let isRangeQueryValue = false
571
- if (dataType && (dataType === 'DATE' || dataType === 'TIME')) {
572
- if (item.startValue && item.endValue) {
573
- isRangeQueryValue = true
574
- }
575
- }
576
- if (isRangeQueryValue) {
577
- searchForm[prop] = [new Date(item.startValue), new Date(item.endValue)]
578
- } else {
579
- if (searchForm[prop]) {
580
- if (searchForm[prop] instanceof Array) {
581
- searchForm[prop].push(propValue)
582
- } else {
583
- searchForm[prop] = [searchForm[prop], propValue]
584
- }
585
- } else {
586
- searchForm[prop] = propValue
587
- }
588
- }
589
- }
590
- })
591
-
592
- this.searchableColumns.forEach(column => {
593
- if (initSearchProps) {
594
- if (initSearchProps.indexOf(column.prop) < 0) {
595
- // 表示没有默认初始查询字段
596
- if (column.prop && column.prop.indexOf('.') > 0) {
597
- if (column.componentType === 'dateSection') {
598
- addDynamicPropDateSection(searchForm, column.prop)
599
- } else {
600
- // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
601
- addDynamicProp(searchForm, column.prop)
602
- }
603
- } else {
604
- if (column.componentType === 'dateSection') {
605
- searchForm[column.prop] = [new Date(), new Date()]
606
- } else {
607
- searchForm[column.prop] = null
608
- }
609
- }
610
- } else {
611
- if (column.componentType === 'multiselect' && searchForm[column.prop]) {
612
- if (!(searchForm[column.prop] instanceof Array)) {
613
- searchForm[column.prop] = [searchForm[column.prop]]
614
- }
615
- }
616
- }
617
- }
618
- })
619
-
620
- return searchForm
621
- }
622
- },
623
- resetSearchFormList() {
624
- this.searchFormList = null
625
- },
626
- openFold(isOpen) {
627
- this.$emit('open-fold', isOpen)
628
- },
629
- // 查询完毕
630
- searchComplete() {
631
- if (this.$refs.searchFormOrdinarySearch) {
632
- this.$refs.searchFormOrdinarySearch.searchComplete()
633
- }
634
- }
635
- }
636
- }
637
- </script>