imatrix-ui 2.9.15-dw-tmp2 → 2.9.16-boe10

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 (194) 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/display-layout.scss +1 -1
  15. package/src/styles/index.scss +74 -4
  16. package/src/styles/theme/black/font-style.scss +70 -0
  17. package/src/styles/theme/black/index.scss +6 -30
  18. package/src/styles/theme/blue/font-style.scss +37 -0
  19. package/src/styles/theme/blue/index.scss +2 -18
  20. package/src/styles/theme/blue2/font-style.scss +70 -0
  21. package/src/styles/theme/blue2/index.scss +3 -13
  22. package/src/styles/theme/dark-blue/card.scss +4 -6
  23. package/src/styles/theme/dark-blue/form.scss +7 -4
  24. package/src/styles/theme/dark-blue/index.scss +30 -5
  25. package/src/styles/theme/dark-blue/message.scss +8 -0
  26. package/src/styles/theme/dark-blue/radio.scss +13 -0
  27. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  28. package/src/styles/theme/dark-blue/tab.scss +4 -1
  29. package/src/styles/theme/dark-blue/table.scss +1 -1
  30. package/src/styles/theme/dark-blue/tree.scss +35 -10
  31. package/src/styles/theme/gray/card-style.scss +13 -1
  32. package/src/styles/theme/gray/font-style.scss +38 -0
  33. package/src/styles/theme/gray/index.scss +13 -25
  34. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  35. package/src/styles/theme/gray/sidebar.scss +7 -14
  36. package/src/utils/auth-api.js +47 -1
  37. package/src/utils/common-util.js +22 -81
  38. package/src/utils/jump-page-utils.js +8 -10
  39. package/src/utils/range-selector.js +185 -0
  40. package/src/utils/request.js +6 -3
  41. package/src/utils/util.js +13 -11
  42. package/src/utils/workflow-util.js +3 -0
  43. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  44. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  45. package/src/views/dsc-component/Sidebar/index.vue +12 -20
  46. package/src/views/dsc-component/tabs/tab-content.vue +8 -9
  47. package/src/views/layout/EmptyLayout.vue +4 -1
  48. package/src/views/layout/NewLayout.vue +6 -65
  49. package/src/views/layout/components/AppMain.vue +2 -1
  50. package/src/views/layout/components/Menubar/Item.vue +23 -7
  51. package/src/views/layout/components/Menubar/Link.vue +11 -2
  52. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  53. package/src/views/layout/components/Menubar/index.vue +51 -16
  54. package/src/views/layout/components/tabs/tab-content.vue +162 -0
  55. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  56. package/src/views/layout/tab-content-index.vue +85 -0
  57. package/src/views/login/index.vue +1 -1
  58. package/packages/breadcrumb/index.js +0 -6
  59. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  60. package/packages/department-tree/index.js +0 -6
  61. package/packages/department-tree/src/department-tree.vue +0 -108
  62. package/packages/department-tree-inline/index.js +0 -6
  63. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -408
  64. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -290
  65. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  66. package/packages/department-tree-inline/src/department-tree-service.js +0 -273
  67. package/packages/department-tree-inline/src/search-result.vue +0 -176
  68. package/packages/department-user-tree/index.js +0 -6
  69. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  70. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  71. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  72. package/packages/department-user-tree-inline/index.js +0 -6
  73. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -636
  74. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -271
  75. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  76. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -248
  77. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -142
  78. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  79. package/packages/directives/prevent-reclick.js +0 -19
  80. package/packages/dynamic-source-select/index.js +0 -6
  81. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  82. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  83. package/packages/dynamic-source-select/src/events.js +0 -55
  84. package/packages/fs-preview/index.js +0 -6
  85. package/packages/fs-preview/src/fs-preview.vue +0 -226
  86. package/packages/fs-upload/index.js +0 -6
  87. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  88. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  89. package/packages/fs-upload/src/fs-upload.vue +0 -189
  90. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  91. package/packages/fs-upload-list/index.js +0 -6
  92. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  93. package/packages/hamburger/index.js +0 -6
  94. package/packages/hamburger/src/hamburger.vue +0 -38
  95. package/packages/index.js +0 -121
  96. package/packages/multipart-upload/index.js +0 -6
  97. package/packages/multipart-upload/src/index.vue +0 -73
  98. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  99. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  100. package/packages/organization-input/index.js +0 -6
  101. package/packages/organization-input/src/organization-input.vue +0 -542
  102. package/packages/plugins/export-data-new.js +0 -466
  103. package/packages/plugins/export-data.js +0 -361
  104. package/packages/plugins/index.js +0 -15
  105. package/packages/plugins/public-method.js +0 -43
  106. package/packages/remove-department/index.js +0 -6
  107. package/packages/remove-department/src/remove-department.vue +0 -172
  108. package/packages/remove-department/src/remove-dept-service.js +0 -20
  109. package/packages/remove-user/index.js +0 -6
  110. package/packages/remove-user/src/remove-user-service.js +0 -20
  111. package/packages/remove-user/src/remove-user.vue +0 -195
  112. package/packages/remove-workgroup/index.js +0 -6
  113. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  114. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  115. package/packages/rich-editor/index.js +0 -7
  116. package/packages/rich-editor/index.vue +0 -278
  117. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  118. package/packages/rich-editor/viewer.vue +0 -103
  119. package/packages/scan-code-input/index.js +0 -6
  120. package/packages/scan-code-input/src/events.js +0 -33
  121. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  122. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  123. package/packages/secret-info/index.js +0 -7
  124. package/packages/secret-info/index.vue +0 -90
  125. package/packages/super-grid/index.js +0 -7
  126. package/packages/super-grid/src/apis.js +0 -820
  127. package/packages/super-grid/src/columns-config.vue +0 -335
  128. package/packages/super-grid/src/custom-formatter.js +0 -278
  129. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  130. package/packages/super-grid/src/eventBus.js +0 -2
  131. package/packages/super-grid/src/events.js +0 -55
  132. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  133. package/packages/super-grid/src/formatter.js +0 -181
  134. package/packages/super-grid/src/group-column.vue +0 -100
  135. package/packages/super-grid/src/header-context-menu.vue +0 -87
  136. package/packages/super-grid/src/index-column.vue +0 -51
  137. package/packages/super-grid/src/normal-column.vue +0 -771
  138. package/packages/super-grid/src/public-methods.js +0 -31
  139. package/packages/super-grid/src/row-operation.vue +0 -161
  140. package/packages/super-grid/src/search-button.vue +0 -66
  141. package/packages/super-grid/src/search-condition-input.vue +0 -61
  142. package/packages/super-grid/src/search-condition-list.vue +0 -59
  143. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  144. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  145. package/packages/super-grid/src/search-form-item.vue +0 -404
  146. package/packages/super-grid/src/search-form-number.vue +0 -38
  147. package/packages/super-grid/src/search-form-open.vue +0 -170
  148. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -196
  149. package/packages/super-grid/src/search-form.vue +0 -642
  150. package/packages/super-grid/src/search-methods.js +0 -448
  151. package/packages/super-grid/src/selection-column.vue +0 -43
  152. package/packages/super-grid/src/store.js +0 -3
  153. package/packages/super-grid/src/super-grid-service.js +0 -593
  154. package/packages/super-grid/src/super-grid.vue +0 -2882
  155. package/packages/super-grid/src/utils.js +0 -762
  156. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  157. package/packages/super-nine-grid/index.js +0 -7
  158. package/packages/super-nine-grid/src/apis.js +0 -103
  159. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  160. package/packages/super-nine-grid/src/formatter.js +0 -132
  161. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  162. package/packages/super-nine-grid/src/search-form.vue +0 -430
  163. package/packages/super-nine-grid/src/search-methods.js +0 -134
  164. package/packages/super-nine-grid/src/store.js +0 -3
  165. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  166. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  167. package/packages/super-nine-grid/src/utils.js +0 -261
  168. package/packages/svg-icon/index.js +0 -6
  169. package/packages/svg-icon/src/svg-icon.vue +0 -43
  170. package/packages/utils/memory-cache-utils.js +0 -90
  171. package/packages/utils/utils.js +0 -152
  172. package/packages/utils/value-set.js +0 -86
  173. package/packages/valid-code/index.js +0 -7
  174. package/packages/valid-code/src/valid-code.vue +0 -95
  175. package/packages/workflow-button/index.js +0 -6
  176. package/packages/workflow-button/src/workflow-button.vue +0 -325
  177. package/packages/workflow-history-list/index.js +0 -6
  178. package/packages/workflow-history-list/src/api.js +0 -7
  179. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  180. package/packages/workgroup-tree/index.js +0 -6
  181. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  182. package/packages/workgroup-tree-inline/index.js +0 -6
  183. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  184. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  185. package/packages/workgroup-user-tree/index.js +0 -6
  186. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  187. package/packages/workgroup-user-tree-inline/index.js +0 -6
  188. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  189. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  190. package/packages/year-range-picker/index.js +0 -6
  191. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  192. package/report.20190716.140129.216348.001.json +0 -354
  193. package/src/index.js +0 -93
  194. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,642 +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
- :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>