imatrix-ui 2.8.39-dw → 2.8.39-pvtmp

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