imatrix-ui 2.9.0-dw → 2.9.0-dw-tmp3

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