agilebuilder-ui 1.1.58-sit5 → 1.1.58-sit6

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 (92) hide show
  1. package/lib/{401-ea226204.js → 401-ee099dad.js} +1 -1
  2. package/lib/{404-c0ab07f7.js → 404-656a1611.js} +1 -1
  3. package/lib/{_baseUniq-BXtq6_NW-c6f4f75a.js → _baseUniq-BXtq6_NW-052057b3.js} +2 -2
  4. package/lib/{arc-Js_tyW10-7c0d9389.js → arc-Js_tyW10-80c1e870.js} +1 -1
  5. package/lib/architecture-O4VJ6CD3-ZoZ2IAk2-a55a396e.js +11 -0
  6. package/lib/{architectureDiagram-SUXI7LT5-kyYGGrHN-85825d90.js → architectureDiagram-SUXI7LT5-kyYGGrHN-987bd975.js} +8 -8
  7. package/lib/{blockDiagram-6J76NXCF-IAr4zDV3-b5d0ea1d.js → blockDiagram-6J76NXCF-IAr4zDV3-17646a2a.js} +7 -7
  8. package/lib/{c4Diagram-6F6E4RAY-Dv27rXcJ-04a6a12c.js → c4Diagram-6F6E4RAY-Dv27rXcJ-9d36acc3.js} +3 -3
  9. package/lib/{channel-BBZy6zOT-f02c9a4c.js → channel-BBZy6zOT-7dc6c9e8.js} +1 -1
  10. package/lib/{chunk-353BL4L5-Dn_Y_Yna-61165aa5.js → chunk-353BL4L5-Dn_Y_Yna-4051ae5e.js} +1 -1
  11. package/lib/{chunk-67H74DCK-Br5U8bfD-c4e47b0d.js → chunk-67H74DCK-Br5U8bfD-95447665.js} +1 -1
  12. package/lib/{chunk-AACKK3MU-DH_MKxca-256fce72.js → chunk-AACKK3MU-DH_MKxca-656c4d8a.js} +1 -1
  13. package/lib/{chunk-BFAMUDN2-DHLCoYMN-22cc8b67.js → chunk-BFAMUDN2-DHLCoYMN-634df933.js} +1 -1
  14. package/lib/{chunk-E2GYISFI-DQPHyyga-c287edeb.js → chunk-E2GYISFI-DQPHyyga-cff34402.js} +1 -1
  15. package/lib/{chunk-OW32GOEJ-CQOSE6Bn-85b40fb3.js → chunk-OW32GOEJ-CQOSE6Bn-52201d13.js} +3 -3
  16. package/lib/{chunk-SKB7J2MH-BlwHRDiW-356fba19.js → chunk-SKB7J2MH-BlwHRDiW-f0ff45b3.js} +1 -1
  17. package/lib/{chunk-SZ463SBG-DEp8buKJ-4352f1a9.js → chunk-SZ463SBG-DEp8buKJ-6d509490.js} +4 -4
  18. package/lib/{classDiagram-M3E45YP4-D0ySDe-v-d62a9f9d.js → classDiagram-M3E45YP4-D0ySDe-v-45bdad4e.js} +6 -6
  19. package/lib/{classDiagram-v2-YAWTLIQI-D0ySDe-v-d62a9f9d.js → classDiagram-v2-YAWTLIQI-D0ySDe-v-45bdad4e.js} +6 -6
  20. package/lib/{clone-CEJtuQzg-a8543f5d.js → clone-CEJtuQzg-554e246d.js} +1 -1
  21. package/lib/{dagre-JOIXM2OF-5zx0JY2T-25a90589.js → dagre-JOIXM2OF-5zx0JY2T-95d888be.js} +7 -7
  22. package/lib/{diagram-5UYTHUR4-C19nyAKc-a3bc4cfd.js → diagram-5UYTHUR4-C19nyAKc-0270cae3.js} +7 -7
  23. package/lib/{diagram-VMROVX33-DkGwo-hj-374a259a.js → diagram-VMROVX33-DkGwo-hj-85e1adb0.js} +8 -8
  24. package/lib/{diagram-ZTM2IBQH-CBgHCu9L-56d29b25.js → diagram-ZTM2IBQH-CBgHCu9L-af8c9131.js} +7 -7
  25. package/lib/{erDiagram-3M52JZNH-cttdAJXW-7396ea7f.js → erDiagram-3M52JZNH-cttdAJXW-1213335f.js} +5 -5
  26. package/lib/{flowDiagram-KYDEHFYC-9HpsqDdB-8addfe5a.js → flowDiagram-KYDEHFYC-9HpsqDdB-a11787ba.js} +6 -6
  27. package/lib/{ganttDiagram-EK5VF46D-8QB3ofs6-bcece4aa.js → ganttDiagram-EK5VF46D-8QB3ofs6-6b3f0b52.js} +3 -3
  28. package/lib/gitGraph-ZV4HHKMB-BSmtVGRu-3f974836.js +11 -0
  29. package/lib/{gitGraphDiagram-GW3U2K7C-DNzc0Vx_-0ed09191.js → gitGraphDiagram-GW3U2K7C-DNzc0Vx_-18a8fcf7.js} +8 -8
  30. package/lib/{graph-3zJxsO-i-2a8df7c8.js → graph-3zJxsO-i-5394b336.js} +3 -3
  31. package/lib/{iframe-page-9cd27dfb.js → iframe-page-25f721c5.js} +1 -1
  32. package/lib/{index-20147c57.js → index-306f43e3.js} +10 -10
  33. package/lib/info-63CPKGFF-C8sYWczU-238f0781.js +11 -0
  34. package/lib/{infoDiagram-LHK5PUON-C-vFFPTf-4f13ee3e.js → infoDiagram-LHK5PUON-C-vFFPTf-d45448b3.js} +6 -6
  35. package/lib/{journeyDiagram-EWQZEKCU-BJrw4-AG-ffb2c8bc.js → journeyDiagram-EWQZEKCU-BJrw4-AG-cf78d8d2.js} +5 -5
  36. package/lib/{kanban-definition-ZSS6B67P-BptAnqU--193b87ca.js → kanban-definition-ZSS6B67P-BptAnqU--a832bf31.js} +3 -3
  37. package/lib/{layout-sGZIJplX-fb85ed3c.js → layout-sGZIJplX-72ca1067.js} +5 -5
  38. package/lib/{linear-DqgVh5FN-6846d9bb.js → linear-DqgVh5FN-38761045.js} +1 -1
  39. package/lib/{mermaid-parser.core-CH9ryA1K-43b5a0c4.js → mermaid-parser.core-CH9ryA1K-db327852.js} +12 -12
  40. package/lib/{mermaid.core-CAqkCmS1-de36f16a.js → mermaid.core-CAqkCmS1-9b94142a.js} +30 -30
  41. package/lib/{min-BngCxx8g-52e8fadc.js → min-BngCxx8g-487393ff.js} +3 -3
  42. package/lib/{mindmap-definition-6CBA2TL7-Cp_EeEsh-729c5012.js → mindmap-definition-6CBA2TL7-Cp_EeEsh-02014386.js} +2 -2
  43. package/lib/packet-HUATNLJX-bfFWFja0-68852f22.js +11 -0
  44. package/lib/pie-WTHONI2E-QPrWs3SR-440abcf5.js +11 -0
  45. package/lib/{pieDiagram-NIOCPIFQ-C46Y_4C6-5376fd17.js → pieDiagram-NIOCPIFQ-C46Y_4C6-bc52c2f6.js} +8 -8
  46. package/lib/{quadrantDiagram-2OG54O6I-Dgf6d6F_-d9211b6a.js → quadrantDiagram-2OG54O6I-Dgf6d6F_-87fb95d1.js} +3 -3
  47. package/lib/radar-NJJJXTRR-BnUCJhQL-8330072c.js +11 -0
  48. package/lib/{requirementDiagram-QOLK2EJ7-CSF6N7HA-6a3271b2.js → requirementDiagram-QOLK2EJ7-CSF6N7HA-c1970561.js} +4 -4
  49. package/lib/{sankeyDiagram-4UZDY2LN-BAHB7dMS-0bab607a.js → sankeyDiagram-4UZDY2LN-BAHB7dMS-d1f40a7b.js} +2 -2
  50. package/lib/{sequenceDiagram-SKLFT4DO-10gLJ50N-5fcc0610.js → sequenceDiagram-SKLFT4DO-10gLJ50N-a6bd7bd3.js} +4 -4
  51. package/lib/{stateDiagram-MI5ZYTHO-D6p6nCaj-cb4037d0.js → stateDiagram-MI5ZYTHO-D6p6nCaj-50769c19.js} +9 -9
  52. package/lib/{stateDiagram-v2-5AN5P6BG-DaN5hC-t-99a35fb7.js → stateDiagram-v2-5AN5P6BG-DaN5hC-t-04a815e2.js} +5 -5
  53. package/lib/super-ui.css +1 -1
  54. package/lib/super-ui.js +1 -1
  55. package/lib/super-ui.umd.cjs +2 -2
  56. package/lib/{tab-content-iframe-index-4bb00c56.js → tab-content-iframe-index-dd6023c7.js} +1 -1
  57. package/lib/{tab-content-index-593e223b.js → tab-content-index-34a6f736.js} +1 -1
  58. package/lib/{tache-subprocess-history-c9f9409d.js → tache-subprocess-history-91e45a1c.js} +1 -1
  59. package/lib/{timeline-definition-MYPXXCX6-gLqnWxDu-6a396147.js → timeline-definition-MYPXXCX6-gLqnWxDu-f09941ad.js} +3 -3
  60. package/lib/treemap-75Q7IDZK-B2atdfMH-a1f90182.js +11 -0
  61. package/lib/{xychartDiagram-H2YORKM3-Whqa4ezL-12c091c7.js → xychartDiagram-H2YORKM3-Whqa4ezL-ea641e6f.js} +3 -3
  62. package/package.json +1 -1
  63. package/packages/fs-preview/src/fs-preview.vue +12 -4
  64. package/packages/plugins/export-data-new.js +1 -1
  65. package/packages/super-grid/src/search-form.vue +744 -806
  66. package/src/permission.js +2 -2
  67. package/src/styles/_layout-custom-properties.scss +1 -1
  68. package/src/styles/theme/dark-blue/checkbox.scss +5 -1
  69. package/src/styles/theme/dark-blue/index.scss +3 -3
  70. package/src/styles/theme/dark-blue/sidebar.scss +16 -14
  71. package/src/styles/theme/dark-blue/table.scss +7 -2
  72. package/src/styles/theme/forest-green/checkbox.scss +5 -1
  73. package/src/styles/theme/forest-green/index.scss +3 -3
  74. package/src/styles/theme/forest-green/sidebar.scss +1 -1
  75. package/src/styles/theme/forest-green/table.scss +5 -0
  76. package/src/styles/theme/green/checkbox.scss +5 -1
  77. package/src/styles/theme/green/index.scss +3 -3
  78. package/src/styles/theme/green/sidebar.scss +30 -23
  79. package/src/styles/theme/green/table.scss +7 -2
  80. package/src/styles/theme/ocean-blue/checkbox.scss +5 -1
  81. package/src/styles/theme/ocean-blue/index.scss +7 -3
  82. package/src/styles/theme/ocean-blue/sidebar.scss +1 -1
  83. package/src/styles/theme/ocean-blue/table.scss +7 -2
  84. package/src/styles/theme/tiffany-blue-mobile/sidebar.scss +1 -1
  85. package/src/utils/request.js +2 -2
  86. package/lib/architecture-O4VJ6CD3-ZoZ2IAk2-9bcb267f.js +0 -11
  87. package/lib/gitGraph-ZV4HHKMB-BSmtVGRu-434c5315.js +0 -11
  88. package/lib/info-63CPKGFF-C8sYWczU-6912ccc5.js +0 -11
  89. package/lib/packet-HUATNLJX-bfFWFja0-73e9f993.js +0 -11
  90. package/lib/pie-WTHONI2E-QPrWs3SR-29bccd3d.js +0 -11
  91. package/lib/radar-NJJJXTRR-BnUCJhQL-db833aad.js +0 -11
  92. package/lib/treemap-75Q7IDZK-B2atdfMH-298d56fb.js +0 -11
@@ -1,845 +1,783 @@
1
1
  <template>
2
- <div class="amb-agilebuilder-search-form-view">
3
- <el-drawer v-if="isMobile" v-model="isShowMobileForm" :close-on-click-modal="false" :close-on-press-escape="false" direction="rtl" size="50%" @close="closeMobileSearch()">
4
- <div class="search-condition-mobile">
5
- <search-condition-list
6
- v-if="searchConditions.length > 0"
7
- ref="searchConditionList"
8
- :search-conditions="searchConditions"
9
- :search-type="searchType"
10
- @remove-condition="removeCondition"
11
- @select-condition="selectCondition"
12
- />
13
- </div>
14
- <search-form-mobile
15
- v-if="isMobile && searchType === 'normal'"
16
- ref="searchFormMobile"
17
- :code="code"
18
- :is-sql="isSql"
19
- :load-complete-query="loadCompleteQuery"
20
- :query="query"
21
- :rules="rules"
22
- :search-form="searchForm"
23
- :searchable-columns="searchableColumns"
24
- @submit-form="submitForm('searchForm')"
25
- @reset-form="resetForm('searchForm')"
26
- @save-condition="saveCondition()"
27
- />
28
- </el-drawer>
29
- <template v-else>
30
- <search-condition-list
31
- v-if="searchConditions.length > 0"
32
- ref="searchConditionList"
33
- :search-conditions="searchConditions"
34
- :search-type="searchType"
35
- @remove-condition="removeCondition"
36
- @select-condition="selectCondition"
37
- />
38
- <search-form-ordinary-search
39
- v-if="searchType === 'normal'"
40
- ref="searchFormOrdinarySearch"
41
- :code="code"
42
- :field-num="fieldNum"
43
- :is-sql="isSql"
44
- :label-width="labelWidth"
45
- :load-complete-query="loadCompleteQuery"
46
- :query="query"
47
- :row-num="rowNum"
48
- :rules="rules"
49
- :search-form="searchForm"
50
- :searchable-columns="searchableColumns"
51
- :span-num="spanNum"
52
- @submit-form="submitForm('searchForm')"
53
- @reset-form="resetForm('searchForm')"
54
- @save-condition="saveCondition()"
55
- @open-fold="openFold"
56
- />
57
- <search-form-advanced-query
58
- v-if="searchType === 'advanced'"
59
- ref="searchFormAdvancedQuery"
60
- :code="code"
61
- :is-sql="isSql"
62
- :prop-map="propMap"
63
- :search-form-list="searchFormList"
64
- :searchable-columns="advancedQueryColumns"
65
- style="padding-bottom: 10px"
66
- @resetForm="resetSearchFormList"
67
- />
68
- <div
69
- v-if="searchType === 'advanced'"
70
- style="padding-top: 10px; padding-bottom: 10px; text-align: center"
71
- >
72
- <el-button
73
- :loading="loading"
74
- size="default"
75
- type="primary"
76
- @click="submitForm('searchForm')"
77
- >
78
- {{ $t('imatrixUIPublicModel.sure') }}
79
- </el-button>
80
- <el-button
81
- :loading="loading"
82
- size="default"
83
- @click="resetForm('searchForm')"
84
- >
85
- {{ $t('imatrixUIPublicModel.reset') }}
86
- </el-button>
87
- <el-button size="default" @click="saveCondition">
88
- {{ $t('superGrid.saveCondition') }}
89
- </el-button>
90
- <span
91
- v-if="
92
- advancedQuery !== null &&
93
- advancedQuery !== undefined &&
94
- advancedQuery === true &&
95
- normalQuery !== null &&
96
- normalQuery !== undefined &&
97
- normalQuery === true
98
- "
99
- style="margin-left: 10px"
100
- >
101
- <el-button
102
- v-if="searchType === 'advanced'"
103
- size="default"
104
- @click="searchType = 'normal'"
105
- >
106
- {{ $t('imatrixUIPublicModel.switchToNormalQuery') }}
107
- </el-button>
108
- <el-button
109
- v-if="searchType === 'normal'"
110
- size="default"
111
- @click="searchType = 'advanced'"
112
- >
113
- {{ $t('imatrixUIPublicModel.switchToAdvancedQuery') }}
114
- </el-button>
115
- </span>
116
- </div>
117
- </template>
118
- <search-condition-input
119
- v-if="isShowSearchCondition"
120
- @close="saveConditionValue"
121
- />
122
- </div>
2
+ <div class="amb-agilebuilder-search-form-view">
3
+ <el-drawer
4
+ v-if="isMobile"
5
+ v-model="isShowMobileForm"
6
+ :close-on-click-modal="false"
7
+ :close-on-press-escape="false"
8
+ direction="rtl"
9
+ size="50%"
10
+ @close="closeMobileSearch()"
11
+ >
12
+ <div class="search-condition-mobile">
13
+ <search-condition-list
14
+ v-if="searchConditions.length > 0"
15
+ ref="searchConditionList"
16
+ :search-conditions="searchConditions"
17
+ :search-type="searchType"
18
+ @remove-condition="removeCondition"
19
+ @select-condition="selectCondition"
20
+ />
21
+ </div>
22
+ <search-form-mobile
23
+ v-if="isMobile && searchType === 'normal'"
24
+ ref="searchFormMobile"
25
+ :code="code"
26
+ :is-sql="isSql"
27
+ :load-complete-query="loadCompleteQuery"
28
+ :query="query"
29
+ :rules="rules"
30
+ :search-form="searchForm"
31
+ :searchable-columns="searchableColumns"
32
+ @submit-form="submitForm('searchForm')"
33
+ @reset-form="resetForm('searchForm')"
34
+ @save-condition="saveCondition()"
35
+ />
36
+ </el-drawer>
37
+ <template v-else>
38
+ <search-condition-list
39
+ v-if="searchConditions.length > 0"
40
+ ref="searchConditionList"
41
+ :search-conditions="searchConditions"
42
+ :search-type="searchType"
43
+ @remove-condition="removeCondition"
44
+ @select-condition="selectCondition"
45
+ />
46
+ <search-form-ordinary-search
47
+ v-if="searchType === 'normal'"
48
+ ref="searchFormOrdinarySearch"
49
+ :code="code"
50
+ :field-num="fieldNum"
51
+ :is-sql="isSql"
52
+ :label-width="labelWidth"
53
+ :load-complete-query="loadCompleteQuery"
54
+ :query="query"
55
+ :row-num="rowNum"
56
+ :rules="rules"
57
+ :search-form="searchForm"
58
+ :searchable-columns="searchableColumns"
59
+ :span-num="spanNum"
60
+ @submit-form="submitForm('searchForm')"
61
+ @reset-form="resetForm('searchForm')"
62
+ @save-condition="saveCondition()"
63
+ @open-fold="openFold"
64
+ />
65
+ <search-form-advanced-query
66
+ v-if="searchType === 'advanced'"
67
+ ref="searchFormAdvancedQuery"
68
+ :code="code"
69
+ :is-sql="isSql"
70
+ :prop-map="propMap"
71
+ :search-form-list="searchFormList"
72
+ :searchable-columns="advancedQueryColumns"
73
+ style="padding-bottom: 10px"
74
+ @resetForm="resetSearchFormList"
75
+ />
76
+ <div v-if="searchType === 'advanced'" style="padding-top: 10px; padding-bottom: 10px; text-align: center">
77
+ <el-button :loading="loading" size="default" type="primary" @click="submitForm('searchForm')">
78
+ {{ $t('imatrixUIPublicModel.sure') }}
79
+ </el-button>
80
+ <el-button :loading="loading" size="default" @click="resetForm('searchForm')">
81
+ {{ $t('imatrixUIPublicModel.reset') }}
82
+ </el-button>
83
+ <el-button size="default" @click="saveCondition">
84
+ {{ $t('superGrid.saveCondition') }}
85
+ </el-button>
86
+ <span
87
+ v-if="
88
+ advancedQuery !== null &&
89
+ advancedQuery !== undefined &&
90
+ advancedQuery === true &&
91
+ normalQuery !== null &&
92
+ normalQuery !== undefined &&
93
+ normalQuery === true
94
+ "
95
+ style="margin-left: 10px"
96
+ >
97
+ <el-button v-if="searchType === 'advanced'" size="default" @click="searchType = 'normal'">
98
+ {{ $t('imatrixUIPublicModel.switchToNormalQuery') }}
99
+ </el-button>
100
+ <el-button v-if="searchType === 'normal'" size="default" @click="searchType = 'advanced'">
101
+ {{ $t('imatrixUIPublicModel.switchToAdvancedQuery') }}
102
+ </el-button>
103
+ </span>
104
+ </div>
105
+ </template>
106
+ <search-condition-input v-if="isShowSearchCondition" @close="saveConditionValue" />
107
+ </div>
123
108
  </template>
124
109
 
125
110
  <script>
126
- import {$on, $off, $once, $emit} from '../../utils/gogocodeTransfer'
111
+ import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
127
112
  import searchMethods from './search-methods'
128
113
  // import searchFormNumber from './search-form-number.vue'
129
114
  import searchFormOrdinarySearch from './search-form-ordinarySearch.vue'
130
115
  import searchFormAdvancedQuery from './search-form-advancedQuery.vue'
131
116
  import store from './store'
132
117
  // import { isOptionFunction, getSearchObject } from './utils'
133
- import {addDynamicProp, addDynamicPropDateSection} from './utils'
118
+ import { addDynamicProp, addDynamicPropDateSection } from './utils'
134
119
  import * as Vue from 'vue'
135
120
  import SearchConditionInput from './search-condition-input.vue'
136
121
  import SearchConditionList from './search-condition-list.vue'
137
122
  import SearchFormMobile from './search-form-mobile.vue'
138
- import {isMobileBrowser} from '../../../src/utils/common-util'
123
+ import { isMobileBrowser } from '../../../src/utils/common-util'
139
124
 
140
125
  export default {
141
- name: 'SearchForm',
142
- components: {
143
- // searchFormNumber,
144
- SearchConditionInput,
145
- SearchConditionList,
146
- searchFormOrdinarySearch,
147
- searchFormAdvancedQuery,
148
- SearchFormMobile
149
- },
150
- provide() {
151
- return {
152
- getListToolbarFormData: () => ({
153
- listToolbarFormData: this.listToolbarFormData,
154
- }),
155
- }
156
- },
157
- props: {
158
- columns: {
159
- type: Array,
160
- default: null,
161
- },
162
- code: {
163
- type: String,
164
- default: null,
165
- },
166
- url: {
167
- type: String,
168
- default: null,
169
- },
170
- pagination: {
171
- type: Object,
172
- default: null,
173
- },
174
- query: {
175
- type: Object,
176
- default: null,
177
- },
178
- searchParam: {
179
- type: Object,
180
- default: null,
181
- },
182
- initSearchProps: {
183
- type: Array,
184
- default: null,
185
- },
186
- isSql: {
187
- type: Boolean,
188
- default: false,
189
- },
190
- searchFormInfo: {
191
- type: Object,
192
- default: () => {
193
- return {}
194
- },
195
- },
196
- loadCompleteQuery: {
197
- type: Boolean,
198
- default: false,
199
- },
200
- listToolbarFormData: {
201
- type: Object,
202
- default: null,
203
- },
204
- },
205
- data() {
206
- const customComponentNames = new Set()
207
- const gridParams = store.get(this.code)
208
- const propMap = {}
209
- let searchForm = {}
210
- if (this.searchParam !== null) {
211
- searchForm = JSON.parse(JSON.stringify(this.searchParam))
212
- }
213
- const searchColumns = this.getSearchableColumns(null, null, propMap)
214
- if (this.initSearchProps === undefined || this.initSearchProps === null) {
215
- this.initSearchProps = []
216
- }
217
- searchColumns.forEach((column) => {
218
- // propMap[column.prop] = column
219
- if (this.initSearchProps.indexOf(column.prop) < 0) {
220
- // 表示没有默认初始查询字段
221
- if (column.prop && column.prop.indexOf('.') > 0) {
222
- if (column.componentType === 'dateSection') {
223
- addDynamicPropDateSection(searchForm, column.prop)
224
- } else {
225
- // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
226
- addDynamicProp(searchForm, column.prop)
227
- }
228
- } else {
229
- if (column.componentType === 'dateSection') {
230
- searchForm[column.prop] = [new Date(), new Date()]
231
- } else if (column.componentType === 'yearRange') {
232
- searchForm[column.prop] = ['', '']
233
- } else {
234
- // 去掉该代码,是因为如果有该代码,会导致初始为空的文本框input组件无法输入值
235
- // searchForm[column.prop] = null
236
- }
237
- this.setDefaultQueryValue(column, searchForm)
238
- }
239
- }
240
- })
126
+ name: 'SearchForm',
127
+ components: {
128
+ // searchFormNumber,
129
+ SearchConditionInput,
130
+ SearchConditionList,
131
+ searchFormOrdinarySearch,
132
+ searchFormAdvancedQuery,
133
+ SearchFormMobile
134
+ },
135
+ provide() {
136
+ return {
137
+ getListToolbarFormData: () => ({
138
+ listToolbarFormData: this.listToolbarFormData
139
+ })
140
+ }
141
+ },
142
+ props: {
143
+ columns: {
144
+ type: Array,
145
+ default: null
146
+ },
147
+ code: {
148
+ type: String,
149
+ default: null
150
+ },
151
+ url: {
152
+ type: String,
153
+ default: null
154
+ },
155
+ pagination: {
156
+ type: Object,
157
+ default: null
158
+ },
159
+ query: {
160
+ type: Object,
161
+ default: null
162
+ },
163
+ searchParam: {
164
+ type: Object,
165
+ default: null
166
+ },
167
+ initSearchProps: {
168
+ type: Array,
169
+ default: null
170
+ },
171
+ isSql: {
172
+ type: Boolean,
173
+ default: false
174
+ },
175
+ searchFormInfo: {
176
+ type: Object,
177
+ default: () => {
178
+ return {}
179
+ }
180
+ },
181
+ loadCompleteQuery: {
182
+ type: Boolean,
183
+ default: false
184
+ },
185
+ listToolbarFormData: {
186
+ type: Object,
187
+ default: null
188
+ }
189
+ },
190
+ data() {
191
+ const customComponentNames = new Set()
192
+ const gridParams = store.get(this.code)
193
+ const propMap = {}
194
+ let searchForm = {}
195
+ if (this.searchParam !== null) {
196
+ searchForm = JSON.parse(JSON.stringify(this.searchParam))
197
+ }
198
+ const searchColumns = this.getSearchableColumns(null, null, propMap)
199
+ if (this.initSearchProps === undefined || this.initSearchProps === null) {
200
+ this.initSearchProps = []
201
+ }
202
+ searchColumns.forEach((column) => {
203
+ // propMap[column.prop] = column
204
+ if (this.initSearchProps.indexOf(column.prop) < 0) {
205
+ // 表示没有默认初始查询字段
206
+ if (column.prop && column.prop.indexOf('.') > 0) {
207
+ if (column.componentType === 'dateSection') {
208
+ addDynamicPropDateSection(searchForm, column.prop)
209
+ } else {
210
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
211
+ addDynamicProp(searchForm, column.prop)
212
+ }
213
+ } else {
214
+ if (column.componentType === 'dateSection') {
215
+ searchForm[column.prop] = [new Date(), new Date()]
216
+ } else if (column.componentType === 'yearRange') {
217
+ searchForm[column.prop] = ['', '']
218
+ } else {
219
+ // 去掉该代码,是因为如果有该代码,会导致初始为空的文本框input组件无法输入值
220
+ // searchForm[column.prop] = null
221
+ }
222
+ this.setDefaultQueryValue(column, searchForm)
223
+ }
224
+ }
225
+ })
241
226
 
242
- const isMobile = isMobileBrowser()
243
- let canShowMobileSearch = false
244
- if(isMobile && searchColumns && searchColumns.length > 0){
245
- // 如果是移动端,且有查询字段,则新页面需要显示“查询”按钮
246
- canShowMobileSearch = true
247
- }
248
- const spanNum = this.getSpanNum(searchColumns)
249
- const fieldNum = this.getFieldNumPerRow(searchColumns)
250
- const rowNum = Math.ceil(searchColumns.length / fieldNum)
251
- const advancedQuery = this.query.advancedQuery
252
- const normalQuery = this.query.normalQuery
253
- // console.log('searchColumns.length=' + searchColumns.length + ',fieldNum=' + fieldNum + ',rowNum=' + rowNum)
254
- // // -2是把
255
- // const dateSpanNum = (spanNum - 2) / 2
256
- return {
257
- searchForm,
258
- rules: {},
259
- searchParams: [],
260
- labelWidth:
261
- gridParams.options.search && gridParams.options.search.labelWidth
262
- ? gridParams.options.search.labelWidth
263
- : '80px',
264
- customComponentNames: customComponentNames,
265
- componentName: '',
266
- spanNum: spanNum,
267
- fieldNum: fieldNum, // 每行放的字段个数
268
- rowNum: rowNum, // 一共有几行
269
- loading: false, // 是否正在查询,默认时否
270
- isShowSearchCondition: false,
271
- searchConditions: [],
272
- propMap,
273
- advancedQuery,
274
- normalQuery,
275
- searchFormList: [],
276
- searchType: null,
277
- isMobile, // 是否是移动端
278
- isShowMobileForm: true, // 是否显示表单
279
- canShowMobileSearch
280
- }
281
- },
282
- computed: {
283
- searchableColumns() {
284
- return this.getSearchableColumns()
285
- },
286
- advancedQueryColumns() {
287
- return this.getAdvancedQueryColumns()
288
- },
289
- },
290
- watch: {
291
- searchForm: {
292
- deep: true,
293
- handler(val) {
294
- this.searchFormInfo['data'] = val
295
- },
296
- },
297
- },
298
- created() {
299
- this.listSearchConditions()
300
- if (this.normalQuery) {
301
- this.searchType = 'normal'
302
- } else if (this.advancedQuery) {
303
- this.searchType = 'advanced'
304
- }
305
- console.log('this.canShowMobileSearch----', this.canShowMobileSearch)
306
- if(this.canShowMobileSearch){
307
- // 如果是移动端,且有查询字段,则新页面需要显示“查询”按钮
308
- this.$emit('can-show-mobile-search')
309
- }
310
- },
311
- methods: {
312
- ...searchMethods,
313
- // 每行放的字段个数
314
- getFieldNumPerRow(searchColumns) {
315
- let myFieldNum
316
- if (searchColumns && searchColumns.length === 1) {
317
- myFieldNum = 2
318
- } else {
319
- const gridParams = store.get(this.code)
320
- myFieldNum = gridParams.options.search && gridParams.options.search.fieldNum ? gridParams.options.search.fieldNum : 3
321
- }
322
- return myFieldNum
323
- },
324
- // 根据每行显示的字段个数,确定栅栏个数,默认是4个字段。最多就只能放6个字段
325
- getSpanNum(searchColumns) {
326
- const fieldNum = this.getFieldNumPerRow(searchColumns)
327
- if (fieldNum === 1) {
328
- return 22
329
- } else if (fieldNum === 2) {
330
- return 12
331
- } else if (fieldNum === 3) {
332
- return 8
333
- } else if (fieldNum === 4) {
334
- return 6
335
- } else {
336
- // 6个字段
337
- return 4
338
- }
339
- },
340
- setValueToModelProp(prop, value, componentName, index) {
341
- if (prop && prop.indexOf('.') > 0) {
342
- const parentOjbect = this.getParentObject(prop)
343
- // 嵌套属性中的最后一个属性是属于这个中间父对象的,所有要通过中间父对象来赋值
344
- if (index != null && index !== undefined) {
345
- // parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index] = value
346
- parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index] = value
347
- } else {
348
- parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)] = value
349
- }
350
- } else {
351
- if (index != null && index !== undefined) {
352
- this.searchForm[prop][index] = value
353
- } else {
354
- this.searchForm[prop] = value
355
- }
356
- }
357
- },
358
- getAdvancedQueryColumns(columns, searchColumns, propMap) {
359
- if (!this.customComponentNames) {
360
- this.customComponentNames = new Set()
361
- }
362
- if (!searchColumns) {
363
- searchColumns = []
364
- }
365
- if (!columns) {
366
- columns = this.columns
367
- }
368
- for (let i = 0; i < columns.length; i++) {
369
- const column = columns[i]
370
- if (propMap) {
371
- propMap[column.prop] = column
372
- }
373
- if (
374
- column.prop === '$index' ||
375
- column.prop === '$selection' ||
376
- column.dynamic
377
- ) {
378
- // 序号和复选框列、动态列 不属于该组件的查询字段
379
- continue
380
- }
381
- if (column.groupHeader) {
382
- // 组合表头中子表头的字段查询
383
- this.getSearchableColumns(column.children, searchColumns, propMap)
384
- } else {
385
- if (
386
- column.queryType === 'advanced' &&
387
- !column.custom &&
388
- column.prop !== ''
389
- ) {
390
- // 表示是普通查询,且不是占位符列,是查询字段
391
- if (
392
- typeof column.componentType === 'undefined' ||
393
- column.componentType === ''
394
- ) {
395
- column.componentType = 'input'
396
- }
397
- if (column.querySetting && column.querySetting !== '') {
398
- const querySetting = JSON.parse(column.querySetting)
399
- if (querySetting.width) {
400
- column.searchControlWidth = 'width:' + querySetting.width + 'px'
401
- }
402
- if (querySetting.labelWidth) {
403
- column.searchLabelWidth = querySetting.labelWidth + 'px'
404
- }
405
- if (querySetting.label) {
406
- column.searchLabel = querySetting.label
407
- }
408
- }
409
- // 行编辑时自定义编辑组件
410
- if (
411
- column.componentType &&
412
- column.componentType.indexOf('custom:') >= 0
413
- ) {
414
- column.componentName = column.componentType.substring(
415
- column.componentType.indexOf(':') + 1
416
- )
417
- this.customComponentNames.add(column.componentName)
418
- } else {
419
- column.componentName = ''
420
- }
421
- // this.$set(this.propMap, column.prop, column)
422
- // this.propMap[column.prop] = column
423
- searchColumns.push(column)
424
- }
425
- }
426
- }
427
- return searchColumns
428
- },
429
- getSearchableColumns(columns, searchColumns, propMap) {
430
- if (!this.customComponentNames) {
431
- this.customComponentNames = new Set()
432
- }
433
- if (!searchColumns) {
434
- searchColumns = []
435
- }
436
- if (!columns) {
437
- columns = this.columns
438
- }
439
- for (let i = 0; i < columns.length; i++) {
440
- const column = columns[i]
441
- if (propMap) {
442
- propMap[column.prop] = column
443
- }
444
- if (
445
- column.prop === '$index' ||
446
- column.prop === '$selection' ||
447
- column.dynamic
448
- ) {
449
- // 序号和复选框列、动态列 不属于该组件的查询字段
450
- continue
451
- }
452
- if (column.groupHeader) {
453
- // 组合表头中子表头的字段查询
454
- this.getSearchableColumns(column.children, searchColumns, propMap)
455
- } else {
456
- if (
457
- column.queryType === 'normal' &&
458
- !column.custom &&
459
- column.prop !== ''
460
- ) {
461
- // 表示是普通查询,且不是占位符列,是查询字段
462
- if (
463
- typeof column.componentType === 'undefined' ||
464
- column.componentType === ''
465
- ) {
466
- column.componentType = 'input'
467
- }
468
- if (column.querySetting && column.querySetting !== '') {
469
- const querySetting = JSON.parse(column.querySetting)
470
- if (querySetting.width) {
471
- column.searchControlWidth = 'width:' + querySetting.width + 'px'
472
- }
473
- if (querySetting.labelWidth) {
474
- column.searchLabelWidth = querySetting.labelWidth + 'px'
475
- }
476
- if (querySetting.label) {
477
- column.searchLabel = querySetting.label
478
- }
479
- }
480
- // 行编辑时自定义编辑组件
481
- if (
482
- column.componentType &&
483
- column.componentType.indexOf('custom:') >= 0
484
- ) {
485
- column.componentName = column.componentType.substring(
486
- column.componentType.indexOf(':') + 1
487
- )
488
- this.customComponentNames.add(column.componentName)
489
- } else {
490
- column.componentName = ''
491
- }
492
- // this.$set(this.propMap, column.prop, column)
493
- // this.propMap[column.prop] = column
494
- searchColumns.push(column)
495
- }
496
- }
497
- }
498
- return searchColumns
499
- },
500
- customComponent(column) {
501
- const gridParams = store.get(this.code)
502
- if (column.componentName && column.componentName !== '') {
503
- this.customComponentNames.add(column.componentName)
504
- return true
505
- }
506
- if (
507
- (!column.componentName || column.componentName === '') &&
508
- gridParams.options &&
509
- gridParams.options.search &&
510
- gridParams.options.search.customSearchElements
511
- ) {
512
- // 定义了自定义查询组件
513
- const propSearchEle =
514
- gridParams.options.search.customSearchElements[column.prop]
515
- // console.log('customComponent-customSearchElements-propSearchEle-', column.prop)
516
- if (propSearchEle) {
517
- column.componentName = 'custom-' + column.prop
518
- const component = propSearchEle.call(this, column)
519
- // console.log('customComponent-customSearchElements-')
520
- if (component) {
521
- this.customComponentNames.add(column.componentName)
522
- window.$vueApp.component(column.componentName, component)
523
- return true
524
- }
525
- }
526
- }
527
- return false
528
- },
529
- submitForm() {
530
- if(this.isMobile){
531
- this.$refs.searchFormMobile.validateForm().then((valid) => {
532
- if (valid) {
533
- // this.loading = true
534
- this.searchParams = this.packageSearchParam()
535
- $emit(this, 'search', this.searchParams)
536
- } else {
537
- return false
538
- }
539
- })
540
- }else if (this.searchType === 'normal') {
541
- this.$refs.searchFormOrdinarySearch.validateForm().then((valid) => {
542
- if (valid) {
543
- // this.loading = true
544
- this.searchParams = this.packageSearchParam()
545
- $emit(this, 'search', this.searchParams)
546
- } else {
547
- return false
548
- }
549
- })
550
- } else if (this.searchType === 'advanced') {
551
- this.$refs.searchFormAdvancedQuery.validateForm().then((valid) => {
552
- if (valid) {
553
- this.loading = true
554
- this.searchParams = this.packageSearchParam()
555
- $emit(this, 'search', this.searchParams)
556
- } else {
557
- return false
558
- }
559
- })
560
- }
561
- },
562
- resetForm() {
563
- if (this.$refs.searchConditionList) {
564
- this.$refs.searchConditionList.editConditionId = null
565
- }
566
- if(this.isMobile){
567
- this.$refs.searchFormMobile.resetForm()
568
- } else if (this.searchType === 'normal') {
569
- this.$refs.searchFormOrdinarySearch.resetForm()
570
- } else if (this.searchType === 'advanced') {
571
- this.$refs.searchFormAdvancedQuery.resetForm()
572
- $emit(this, 'reset')
573
- }
574
- // 数值区间组件重置时无法清空值问题
575
- eventBus.$emit('reset')
576
- // 子组件重置完成后调用reset方法 同步执行
577
- // this.$emit('reset')
578
- },
579
- setNumberValue(value, r, n) {
580
- let itemValue = this.getFormItemValue(
581
- this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop
582
- )
583
- itemValue = value
584
- this.setValueToModelProp(
585
- this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop,
586
- itemValue
587
- )
588
- },
589
- listSearchConditions() {
590
- return new Promise((resolve, reject) => {
591
- this.listSearchCondition(this.code)
592
- .then((conditions) => {
593
- this.searchConditions = conditions
594
- resolve(conditions)
595
- })
596
- .catch((error) => {
597
- reject(error)
598
- })
599
- })
600
- },
601
- saveCondition() {
602
- const searchParams = this.packageSearchParam()
603
- if (!searchParams || searchParams.length === 0) {
604
- this.$message({
605
- type: 'warning',
606
- message: this.$t('imatrixUIMessage.pleaseInputSearchCondition'),
607
- showClose: true,
608
- })
609
- return
610
- }
611
- this.isShowSearchCondition = true
612
- },
613
- saveConditionValue(conditionName) {
614
- if (conditionName) {
615
- let searchParams
616
- if (
617
- this.searchType === 'normal' ||
618
- this.searchType === '' ||
619
- this.searchType === null ||
620
- this.searchType === undefined
621
- ) {
622
- searchParams = this.packageSearchParam()
623
- } else {
624
- searchParams = this.searchFormList
625
- }
626
- const condition = {
627
- listCode: this.code,
628
- queryType:
629
- this.searchType === 'normal' ||
630
- this.searchType === '' ||
631
- this.searchType === null ||
632
- this.searchType === undefined
633
- ? 'FIXED'
634
- : 'CUSTOM',
635
- name: conditionName,
636
- queryCondition: JSON.stringify(searchParams),
637
- }
638
- this.saveSearchCondition(condition).then((condition) => {
639
- this.$message({
640
- type: 'success',
641
- message: this.$t('imatrixUIMessage.saveSuccessfully'),
642
- showClose: true,
643
- })
644
- this.isShowSearchCondition = false
645
- this.listSearchConditions().then(() => {
646
- if (this.$refs.searchConditionList) {
647
- // 选中刚刚保存的条件
648
- this.$refs.searchConditionList.editConditionId = condition.id + ''
649
- }
650
- // 查询条件对应的数据
651
- this.selectCondition(condition.id)
652
- })
653
- })
654
- }
655
- this.isShowSearchCondition = false
656
- },
657
- removeCondition(conditionId) {
658
- if (conditionId) {
659
- this.$confirm(
660
- this.$t('imatrixUIMessage.whetherToConfirmDeletion'),
661
- this.$t('imatrixUIMessage.tips'),
662
- {
663
- confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
664
- cancelButtonText: this.$t('imatrixUIPublicModel.cancel'),
665
- type: 'warning',
666
- }
667
- ).then(() => {
668
- this.removeSearchCondition(conditionId).then(() => {
669
- this.$message({
670
- type: 'success',
671
- message: this.$t('superGrid.deleteSuccessful'),
672
- showClose: true,
673
- })
674
- this.listSearchConditions()
675
- })
676
- })
677
- }
678
- },
679
- selectCondition(conditionId) {
680
- if (conditionId) {
681
- this.getSearchCondition(conditionId).then((searchCondition) => {
682
- if (searchCondition) {
683
- const queryCondition = searchCondition.queryCondition
684
- if (queryCondition) {
685
- if (
686
- this.searchType === 'normal' ||
687
- this.searchType === '' ||
688
- this.searchType === null ||
689
- this.searchType === undefined
690
- ) {
691
- const searchParams = JSON.parse(queryCondition)
692
- const searchForm = this.packageSearchForm(searchParams)
693
- if (searchForm) {
694
- this.searchForm = searchForm
695
- }
696
- // 查询数据
697
- this.loading = true
698
- $emit(this, 'search', searchParams)
699
- } else {
700
- this.searchFormList = JSON.parse(queryCondition)
701
- // 查询数据
702
- this.loading = true
703
- $emit(this, 'search', this.packageSearchParam())
704
- }
705
- }
706
- }
707
- })
708
- }
709
- },
710
- // 封装searchForm
711
- packageSearchForm(searchFormArr) {
712
- if (searchFormArr && searchFormArr.length > 0) {
713
- const searchForm = {}
714
- const initSearchProps = []
715
- searchFormArr.forEach((item) => {
716
- // 获得的是"isDeleted"
717
- let prop = item.propName
718
- // 获得的是“deleted”
719
- const columnProp = item.columnProp
720
- const dataType = item.dataType
721
- if (dataType && dataType === 'BOOLEAN' && columnProp) {
722
- prop = columnProp
723
- }
724
- if (initSearchProps.indexOf(prop) === -1) {
725
- initSearchProps.push(prop)
726
- }
727
- const propValue = item.propValue
728
- if (prop && prop.indexOf('.') > 0) {
729
- // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
730
- addDynamicProp(searchForm, prop, propValue)
731
- } else {
732
- let isRangeQueryValue = false
733
- if (dataType && (dataType === 'DATE' || dataType === 'TIME')) {
734
- if (item.startValue && item.endValue) {
735
- isRangeQueryValue = true
736
- }
737
- }
738
- if (isRangeQueryValue) {
739
- searchForm[prop] = [
740
- new Date(item.startValue),
741
- new Date(item.endValue),
742
- ]
743
- } else {
744
- if (searchForm[prop]) {
745
- if (searchForm[prop] instanceof Array) {
746
- searchForm[prop].push(propValue)
747
- } else {
748
- searchForm[prop] = [searchForm[prop], propValue]
749
- }
750
- } else {
751
- searchForm[prop] = propValue
752
- }
753
- }
754
- }
755
- })
227
+ const isMobile = isMobileBrowser()
228
+ let canShowMobileSearch = false
229
+ if (isMobile && searchColumns && searchColumns.length > 0) {
230
+ // 如果是移动端,且有查询字段,则新页面需要显示“查询”按钮
231
+ canShowMobileSearch = true
232
+ }
233
+ const spanNum = this.getSpanNum(searchColumns)
234
+ const fieldNum = this.getFieldNumPerRow(searchColumns)
235
+ const rowNum = Math.ceil(searchColumns.length / fieldNum)
236
+ const advancedQuery = this.query.advancedQuery
237
+ const normalQuery = this.query.normalQuery
238
+ // console.log('searchColumns.length=' + searchColumns.length + ',fieldNum=' + fieldNum + ',rowNum=' + rowNum)
239
+ // // -2是把
240
+ // const dateSpanNum = (spanNum - 2) / 2
241
+ return {
242
+ searchForm,
243
+ rules: {},
244
+ searchParams: [],
245
+ labelWidth:
246
+ gridParams.options.search && gridParams.options.search.labelWidth
247
+ ? gridParams.options.search.labelWidth
248
+ : '80px',
249
+ customComponentNames: customComponentNames,
250
+ componentName: '',
251
+ spanNum: spanNum,
252
+ fieldNum: fieldNum, // 每行放的字段个数
253
+ rowNum: rowNum, // 一共有几行
254
+ loading: false, // 是否正在查询,默认时否
255
+ isShowSearchCondition: false,
256
+ searchConditions: [],
257
+ propMap,
258
+ advancedQuery,
259
+ normalQuery,
260
+ searchFormList: [],
261
+ searchType: null,
262
+ isMobile, // 是否是移动端
263
+ isShowMobileForm: true, // 是否显示表单
264
+ canShowMobileSearch
265
+ }
266
+ },
267
+ computed: {
268
+ searchableColumns() {
269
+ return this.getSearchableColumns()
270
+ },
271
+ advancedQueryColumns() {
272
+ return this.getAdvancedQueryColumns()
273
+ }
274
+ },
275
+ watch: {
276
+ searchForm: {
277
+ deep: true,
278
+ handler(val) {
279
+ this.searchFormInfo['data'] = val
280
+ }
281
+ }
282
+ },
283
+ created() {
284
+ this.listSearchConditions()
285
+ if (this.normalQuery) {
286
+ this.searchType = 'normal'
287
+ } else if (this.advancedQuery) {
288
+ this.searchType = 'advanced'
289
+ }
290
+ console.log('this.canShowMobileSearch----', this.canShowMobileSearch)
291
+ if (this.canShowMobileSearch) {
292
+ // 如果是移动端,且有查询字段,则新页面需要显示“查询”按钮
293
+ this.$emit('can-show-mobile-search')
294
+ }
295
+ },
296
+ methods: {
297
+ ...searchMethods,
298
+ // 每行放的字段个数
299
+ getFieldNumPerRow(searchColumns) {
300
+ let myFieldNum
301
+ if (searchColumns && searchColumns.length === 1) {
302
+ myFieldNum = 2
303
+ } else {
304
+ const gridParams = store.get(this.code)
305
+ myFieldNum =
306
+ gridParams.options.search && gridParams.options.search.fieldNum ? gridParams.options.search.fieldNum : 3
307
+ }
308
+ return myFieldNum
309
+ },
310
+ // 根据每行显示的字段个数,确定栅栏个数,默认是4个字段。最多就只能放6个字段
311
+ getSpanNum(searchColumns) {
312
+ const fieldNum = this.getFieldNumPerRow(searchColumns)
313
+ if (fieldNum === 1) {
314
+ return 22
315
+ } else if (fieldNum === 2) {
316
+ return 12
317
+ } else if (fieldNum === 3) {
318
+ return 8
319
+ } else if (fieldNum === 4) {
320
+ return 6
321
+ } else {
322
+ // 6个字段
323
+ return 4
324
+ }
325
+ },
326
+ setValueToModelProp(prop, value, componentName, index) {
327
+ if (prop && prop.indexOf('.') > 0) {
328
+ const parentOjbect = this.getParentObject(prop)
329
+ // 嵌套属性中的最后一个属性是属于这个中间父对象的,所有要通过中间父对象来赋值
330
+ if (index != null && index !== undefined) {
331
+ // parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index] = value
332
+ parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index] = value
333
+ } else {
334
+ parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)] = value
335
+ }
336
+ } else {
337
+ if (index != null && index !== undefined) {
338
+ this.searchForm[prop][index] = value
339
+ } else {
340
+ this.searchForm[prop] = value
341
+ }
342
+ }
343
+ },
344
+ getAdvancedQueryColumns(columns, searchColumns, propMap) {
345
+ if (!this.customComponentNames) {
346
+ this.customComponentNames = new Set()
347
+ }
348
+ if (!searchColumns) {
349
+ searchColumns = []
350
+ }
351
+ if (!columns) {
352
+ columns = this.columns
353
+ }
354
+ for (let i = 0; i < columns.length; i++) {
355
+ const column = columns[i]
356
+ if (propMap) {
357
+ propMap[column.prop] = column
358
+ }
359
+ if (column.prop === '$index' || column.prop === '$selection' || column.dynamic) {
360
+ // 序号和复选框列、动态列 不属于该组件的查询字段
361
+ continue
362
+ }
363
+ if (column.groupHeader) {
364
+ // 组合表头中子表头的字段查询
365
+ this.getSearchableColumns(column.children, searchColumns, propMap)
366
+ } else {
367
+ if (column.queryType === 'advanced' && !column.custom && column.prop !== '') {
368
+ // 表示是普通查询,且不是占位符列,是查询字段
369
+ if (typeof column.componentType === 'undefined' || column.componentType === '') {
370
+ column.componentType = 'input'
371
+ }
372
+ if (column.querySetting && column.querySetting !== '') {
373
+ const querySetting = JSON.parse(column.querySetting)
374
+ if (querySetting.width) {
375
+ column.searchControlWidth = 'width:' + querySetting.width + 'px'
376
+ }
377
+ if (querySetting.labelWidth) {
378
+ column.searchLabelWidth = querySetting.labelWidth + 'px'
379
+ }
380
+ if (querySetting.label) {
381
+ column.searchLabel = querySetting.label
382
+ }
383
+ }
384
+ // 行编辑时自定义编辑组件
385
+ if (column.componentType && column.componentType.indexOf('custom:') >= 0) {
386
+ column.componentName = column.componentType.substring(column.componentType.indexOf(':') + 1)
387
+ this.customComponentNames.add(column.componentName)
388
+ } else {
389
+ column.componentName = ''
390
+ }
391
+ // this.$set(this.propMap, column.prop, column)
392
+ // this.propMap[column.prop] = column
393
+ searchColumns.push(column)
394
+ }
395
+ }
396
+ }
397
+ return searchColumns
398
+ },
399
+ getSearchableColumns(columns, searchColumns, propMap) {
400
+ if (!this.customComponentNames) {
401
+ this.customComponentNames = new Set()
402
+ }
403
+ if (!searchColumns) {
404
+ searchColumns = []
405
+ }
406
+ if (!columns) {
407
+ columns = this.columns
408
+ }
409
+ for (let i = 0; i < columns.length; i++) {
410
+ const column = columns[i]
411
+ if (propMap) {
412
+ propMap[column.prop] = column
413
+ }
414
+ if (column.prop === '$index' || column.prop === '$selection' || column.dynamic) {
415
+ // 序号和复选框列、动态列 不属于该组件的查询字段
416
+ continue
417
+ }
418
+ if (column.groupHeader) {
419
+ // 组合表头中子表头的字段查询
420
+ this.getSearchableColumns(column.children, searchColumns, propMap)
421
+ } else {
422
+ if (column.queryType === 'normal' && !column.custom && column.prop !== '') {
423
+ // 表示是普通查询,且不是占位符列,是查询字段
424
+ if (typeof column.componentType === 'undefined' || column.componentType === '') {
425
+ column.componentType = 'input'
426
+ }
427
+ if (column.querySetting && column.querySetting !== '') {
428
+ const querySetting = JSON.parse(column.querySetting)
429
+ if (querySetting.width) {
430
+ column.searchControlWidth = 'width:' + querySetting.width + 'px'
431
+ }
432
+ if (querySetting.labelWidth) {
433
+ column.searchLabelWidth = querySetting.labelWidth + 'px'
434
+ }
435
+ if (querySetting.label) {
436
+ column.searchLabel = querySetting.label
437
+ }
438
+ }
439
+ // 行编辑时自定义编辑组件
440
+ if (column.componentType && column.componentType.indexOf('custom:') >= 0) {
441
+ column.componentName = column.componentType.substring(column.componentType.indexOf(':') + 1)
442
+ this.customComponentNames.add(column.componentName)
443
+ } else {
444
+ column.componentName = ''
445
+ }
446
+ // this.$set(this.propMap, column.prop, column)
447
+ // this.propMap[column.prop] = column
448
+ searchColumns.push(column)
449
+ }
450
+ }
451
+ }
452
+ return searchColumns
453
+ },
454
+ customComponent(column) {
455
+ const gridParams = store.get(this.code)
456
+ if (column.componentName && column.componentName !== '') {
457
+ this.customComponentNames.add(column.componentName)
458
+ return true
459
+ }
460
+ if (
461
+ (!column.componentName || column.componentName === '') &&
462
+ gridParams.options &&
463
+ gridParams.options.search &&
464
+ gridParams.options.search.customSearchElements
465
+ ) {
466
+ // 定义了自定义查询组件
467
+ const propSearchEle = gridParams.options.search.customSearchElements[column.prop]
468
+ // console.log('customComponent-customSearchElements-propSearchEle-', column.prop)
469
+ if (propSearchEle) {
470
+ column.componentName = 'custom-' + column.prop
471
+ const component = propSearchEle.call(this, column)
472
+ // console.log('customComponent-customSearchElements-')
473
+ if (component) {
474
+ this.customComponentNames.add(column.componentName)
475
+ window.$vueApp.component(column.componentName, component)
476
+ return true
477
+ }
478
+ }
479
+ }
480
+ return false
481
+ },
482
+ submitForm() {
483
+ if (this.isMobile) {
484
+ this.$refs.searchFormMobile.validateForm().then((valid) => {
485
+ if (valid) {
486
+ // this.loading = true
487
+ this.searchParams = this.packageSearchParam()
488
+ $emit(this, 'search', this.searchParams)
489
+ } else {
490
+ return false
491
+ }
492
+ })
493
+ } else if (this.searchType === 'normal') {
494
+ this.$refs.searchFormOrdinarySearch.validateForm().then((valid) => {
495
+ if (valid) {
496
+ // this.loading = true
497
+ this.searchParams = this.packageSearchParam()
498
+ $emit(this, 'search', this.searchParams)
499
+ } else {
500
+ return false
501
+ }
502
+ })
503
+ } else if (this.searchType === 'advanced') {
504
+ this.$refs.searchFormAdvancedQuery.validateForm().then((valid) => {
505
+ if (valid) {
506
+ this.loading = true
507
+ this.searchParams = this.packageSearchParam()
508
+ $emit(this, 'search', this.searchParams)
509
+ } else {
510
+ return false
511
+ }
512
+ })
513
+ }
514
+ },
515
+ resetForm() {
516
+ if (this.$refs.searchConditionList) {
517
+ this.$refs.searchConditionList.editConditionId = null
518
+ }
519
+ if (this.isMobile) {
520
+ this.$refs.searchFormMobile.resetForm()
521
+ } else if (this.searchType === 'normal') {
522
+ this.$refs.searchFormOrdinarySearch.resetForm()
523
+ } else if (this.searchType === 'advanced') {
524
+ this.$refs.searchFormAdvancedQuery.resetForm()
525
+ $emit(this, 'reset')
526
+ }
527
+ // 数值区间组件重置时无法清空值问题
528
+ eventBus.$emit('reset')
529
+ // 子组件重置完成后调用reset方法 同步执行
530
+ // this.$emit('reset')
531
+ },
532
+ setNumberValue(value, r, n) {
533
+ let itemValue = this.getFormItemValue(this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop)
534
+ itemValue = value
535
+ this.setValueToModelProp(this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop, itemValue)
536
+ },
537
+ listSearchConditions() {
538
+ return new Promise((resolve, reject) => {
539
+ this.listSearchCondition(this.code)
540
+ .then((conditions) => {
541
+ this.searchConditions = conditions
542
+ resolve(conditions)
543
+ })
544
+ .catch((error) => {
545
+ reject(error)
546
+ })
547
+ })
548
+ },
549
+ saveCondition() {
550
+ const searchParams = this.packageSearchParam()
551
+ if (!searchParams || searchParams.length === 0) {
552
+ this.$message({
553
+ type: 'warning',
554
+ message: this.$t('imatrixUIMessage.pleaseInputSearchCondition'),
555
+ showClose: true
556
+ })
557
+ return
558
+ }
559
+ this.isShowSearchCondition = true
560
+ },
561
+ saveConditionValue(conditionName) {
562
+ if (conditionName) {
563
+ let searchParams
564
+ if (
565
+ this.searchType === 'normal' ||
566
+ this.searchType === '' ||
567
+ this.searchType === null ||
568
+ this.searchType === undefined
569
+ ) {
570
+ searchParams = this.packageSearchParam()
571
+ } else {
572
+ searchParams = this.searchFormList
573
+ }
574
+ const condition = {
575
+ listCode: this.code,
576
+ queryType:
577
+ this.searchType === 'normal' ||
578
+ this.searchType === '' ||
579
+ this.searchType === null ||
580
+ this.searchType === undefined
581
+ ? 'FIXED'
582
+ : 'CUSTOM',
583
+ name: conditionName,
584
+ queryCondition: JSON.stringify(searchParams)
585
+ }
586
+ this.saveSearchCondition(condition).then((condition) => {
587
+ this.$message({
588
+ type: 'success',
589
+ message: this.$t('imatrixUIMessage.saveSuccessfully'),
590
+ showClose: true
591
+ })
592
+ this.isShowSearchCondition = false
593
+ this.listSearchConditions().then(() => {
594
+ if (this.$refs.searchConditionList) {
595
+ // 选中刚刚保存的条件
596
+ this.$refs.searchConditionList.editConditionId = condition.id + ''
597
+ }
598
+ // 查询条件对应的数据
599
+ this.selectCondition(condition.id)
600
+ })
601
+ })
602
+ }
603
+ this.isShowSearchCondition = false
604
+ },
605
+ removeCondition(conditionId) {
606
+ if (conditionId) {
607
+ this.$confirm(this.$t('imatrixUIMessage.whetherToConfirmDeletion'), this.$t('imatrixUIMessage.tips'), {
608
+ confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
609
+ cancelButtonText: this.$t('imatrixUIPublicModel.cancel'),
610
+ type: 'warning'
611
+ }).then(() => {
612
+ this.removeSearchCondition(conditionId).then(() => {
613
+ this.$message({
614
+ type: 'success',
615
+ message: this.$t('superGrid.deleteSuccessful'),
616
+ showClose: true
617
+ })
618
+ this.listSearchConditions()
619
+ })
620
+ })
621
+ }
622
+ },
623
+ selectCondition(conditionId) {
624
+ if (conditionId) {
625
+ this.getSearchCondition(conditionId).then((searchCondition) => {
626
+ if (searchCondition) {
627
+ const queryCondition = searchCondition.queryCondition
628
+ if (queryCondition) {
629
+ if (
630
+ this.searchType === 'normal' ||
631
+ this.searchType === '' ||
632
+ this.searchType === null ||
633
+ this.searchType === undefined
634
+ ) {
635
+ const searchParams = JSON.parse(queryCondition)
636
+ const searchForm = this.packageSearchForm(searchParams)
637
+ if (searchForm) {
638
+ this.searchForm = searchForm
639
+ }
640
+ // 查询数据
641
+ this.loading = true
642
+ $emit(this, 'search', searchParams)
643
+ } else {
644
+ this.searchFormList = JSON.parse(queryCondition)
645
+ // 查询数据
646
+ this.loading = true
647
+ $emit(this, 'search', this.packageSearchParam())
648
+ }
649
+ }
650
+ }
651
+ })
652
+ }
653
+ },
654
+ // 封装searchForm
655
+ packageSearchForm(searchFormArr) {
656
+ if (searchFormArr && searchFormArr.length > 0) {
657
+ const searchForm = {}
658
+ const initSearchProps = []
659
+ searchFormArr.forEach((item) => {
660
+ // 获得的是"isDeleted"
661
+ let prop = item.propName
662
+ // 获得的是“deleted”
663
+ const columnProp = item.columnProp
664
+ const dataType = item.dataType
665
+ if (dataType && dataType === 'BOOLEAN' && columnProp) {
666
+ prop = columnProp
667
+ }
668
+ if (initSearchProps.indexOf(prop) === -1) {
669
+ initSearchProps.push(prop)
670
+ }
671
+ const propValue = item.propValue
672
+ if (prop && prop.indexOf('.') > 0) {
673
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
674
+ addDynamicProp(searchForm, prop, propValue)
675
+ } else {
676
+ let isRangeQueryValue = false
677
+ if (dataType && (dataType === 'DATE' || dataType === 'TIME')) {
678
+ if (item.startValue && item.endValue) {
679
+ isRangeQueryValue = true
680
+ }
681
+ }
682
+ if (isRangeQueryValue) {
683
+ searchForm[prop] = [new Date(item.startValue), new Date(item.endValue)]
684
+ } else {
685
+ if (searchForm[prop]) {
686
+ if (searchForm[prop] instanceof Array) {
687
+ searchForm[prop].push(propValue)
688
+ } else {
689
+ searchForm[prop] = [searchForm[prop], propValue]
690
+ }
691
+ } else {
692
+ searchForm[prop] = propValue
693
+ }
694
+ }
695
+ }
696
+ })
756
697
 
757
- this.searchableColumns.forEach((column) => {
758
- if (initSearchProps) {
759
- if (initSearchProps.indexOf(column.prop) < 0) {
760
- // 表示没有默认初始查询字段
761
- if (column.prop && column.prop.indexOf('.') > 0) {
762
- if (column.componentType === 'dateSection') {
763
- addDynamicPropDateSection(searchForm, column.prop)
764
- } else {
765
- // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
766
- addDynamicProp(searchForm, column.prop)
767
- }
768
- } else {
769
- if (column.componentType === 'dateSection') {
770
- searchForm[column.prop] = [new Date(), new Date()]
771
- } else {
772
- searchForm[column.prop] = null
773
- }
774
- }
775
- } else {
776
- if (
777
- column.componentType === 'multiselect' &&
778
- searchForm[column.prop]
779
- ) {
780
- if (!(searchForm[column.prop] instanceof Array)) {
781
- searchForm[column.prop] = [searchForm[column.prop]]
782
- }
783
- }
784
- }
785
- }
786
- })
698
+ this.searchableColumns.forEach((column) => {
699
+ if (initSearchProps) {
700
+ if (initSearchProps.indexOf(column.prop) < 0) {
701
+ // 表示没有默认初始查询字段
702
+ if (column.prop && column.prop.indexOf('.') > 0) {
703
+ if (column.componentType === 'dateSection') {
704
+ addDynamicPropDateSection(searchForm, column.prop)
705
+ } else {
706
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
707
+ addDynamicProp(searchForm, column.prop)
708
+ }
709
+ } else {
710
+ if (column.componentType === 'dateSection') {
711
+ searchForm[column.prop] = [new Date(), new Date()]
712
+ } else {
713
+ searchForm[column.prop] = null
714
+ }
715
+ }
716
+ } else {
717
+ if (column.componentType === 'multiselect' && searchForm[column.prop]) {
718
+ if (!(searchForm[column.prop] instanceof Array)) {
719
+ searchForm[column.prop] = [searchForm[column.prop]]
720
+ }
721
+ }
722
+ }
723
+ }
724
+ })
787
725
 
788
- return searchForm
789
- }
790
- },
791
- resetSearchFormList() {
792
- this.searchFormList = null
793
- },
794
- openFold(isOpen) {
795
- $emit(this, 'open-fold', isOpen)
796
- },
797
- // 查询完毕
798
- searchComplete() {
799
- if(this.isMobile && this.$refs.searchFormMobile){
800
- this.$refs.searchFormMobile.searchComplete()
801
- }else if (this.$refs.searchFormOrdinarySearch) {
802
- this.$refs.searchFormOrdinarySearch.searchComplete()
803
- }
804
- },
805
- closeMobileSearch() {
806
- this.isShowMobileForm = false
807
- $emit(this, 'close-mobile-search')
808
- },
809
- showMobileSearch(){
810
- this.isShowMobileForm = true
811
- }
812
- },
813
- emits: ['search', 'open-fold', 'reset', 'show-mobile-search', 'close-mobile-search'],
726
+ return searchForm
727
+ }
728
+ },
729
+ resetSearchFormList() {
730
+ this.searchFormList = null
731
+ },
732
+ openFold(isOpen) {
733
+ $emit(this, 'open-fold', isOpen)
734
+ },
735
+ // 查询完毕
736
+ searchComplete() {
737
+ if (this.isMobile && this.$refs.searchFormMobile) {
738
+ this.$refs.searchFormMobile.searchComplete()
739
+ } else if (this.$refs.searchFormOrdinarySearch) {
740
+ this.$refs.searchFormOrdinarySearch.searchComplete()
741
+ }
742
+ },
743
+ closeMobileSearch() {
744
+ this.isShowMobileForm = false
745
+ $emit(this, 'close-mobile-search')
746
+ },
747
+ showMobileSearch() {
748
+ this.isShowMobileForm = true
749
+ }
750
+ },
751
+ emits: ['search', 'open-fold', 'reset', 'show-mobile-search', 'close-mobile-search']
814
752
  }
815
753
  </script>
816
754
 
817
755
  <style scoped>
818
756
  .grid-search-form :deep(.el-form-item) {
819
- margin-bottom: 0px;
757
+ margin-bottom: 0px;
820
758
  }
821
759
 
822
760
  .grid-search-form :deep(.search-btn) {
823
- margin-bottom: 5px;
824
- text-align: center;
761
+ margin-bottom: 5px;
762
+ text-align: center;
825
763
  }
826
764
 
827
765
  .grid-search-form :deep(.el-select),
828
766
  .grid-search-form :deep(.customComponent) {
829
- width: 100%;
767
+ width: 100%;
830
768
  }
831
769
 
832
770
  .amb-agilebuilder-search-form-view:empty {
833
- display: none;
771
+ display: none;
834
772
  }
835
773
 
836
774
  .search-condition-mobile {
837
- padding-bottom: 10px;
838
- position: fixed;
839
- top: 37px;
840
- background-color: #ffffff;
841
- width: 46%;
842
- height: 40px;
843
- z-index: 1500;
775
+ padding-bottom: 10px;
776
+ position: fixed;
777
+ top: 37px;
778
+ background-color: #ffffff;
779
+ width: 46%;
780
+ height: 40px;
781
+ z-index: 1500;
844
782
  }
845
783
  </style>