imatrix-ui 2.8.21-dw → 2.8.21

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 (181) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +4 -2
  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 +402 -0
  10. package/packages/department-tree-inline/src/department-single-tree-inline.vue +284 -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 +245 -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 +626 -0
  20. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +269 -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 +230 -0
  23. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +122 -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 +70 -0
  28. package/packages/dynamic-source-select/src/dynamic-source-select.vue +440 -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 +453 -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 +763 -0
  73. package/packages/super-grid/src/columns-config.vue +335 -0
  74. package/packages/super-grid/src/custom-formatter.js +250 -0
  75. package/packages/super-grid/src/dynamic-input.vue +1279 -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 +769 -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 +653 -0
  90. package/packages/super-grid/src/search-form-dialog.vue +79 -0
  91. package/packages/super-grid/src/search-form-item.vue +386 -0
  92. package/packages/super-grid/src/search-form-number.vue +38 -0
  93. package/packages/super-grid/src/search-form-open.vue +162 -0
  94. package/packages/super-grid/src/search-form-ordinarySearch.vue +188 -0
  95. package/packages/super-grid/src/search-form.vue +634 -0
  96. package/packages/super-grid/src/search-methods.js +387 -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 +561 -0
  100. package/packages/super-grid/src/super-grid.vue +2793 -0
  101. package/packages/super-grid/src/utils.js +763 -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 +132 -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 +91 -0
  112. package/packages/super-nine-grid/src/super-nine-grid.vue +872 -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/utils.js +152 -0
  117. package/packages/utils/value-set.js +86 -0
  118. package/packages/valid-code/index.js +7 -0
  119. package/packages/valid-code/src/valid-code.vue +95 -0
  120. package/packages/workflow-button/index.js +6 -0
  121. package/packages/workflow-button/src/workflow-button.vue +325 -0
  122. package/packages/workflow-history-list/index.js +6 -0
  123. package/packages/workflow-history-list/src/api.js +7 -0
  124. package/packages/workflow-history-list/src/workflow-history-list.vue +185 -0
  125. package/packages/workgroup-tree/index.js +6 -0
  126. package/packages/workgroup-tree/src/workgroup-tree.vue +76 -0
  127. package/packages/workgroup-tree-inline/index.js +6 -0
  128. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +317 -0
  129. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +43 -0
  130. package/packages/workgroup-user-tree/index.js +6 -0
  131. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +100 -0
  132. package/packages/workgroup-user-tree-inline/index.js +6 -0
  133. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +163 -0
  134. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +436 -0
  135. package/packages/year-range-picker/index.js +6 -0
  136. package/packages/year-range-picker/src/year-range-picker.vue +51 -0
  137. package/src/i18n/i18n.js +1 -1
  138. package/src/i18n/langs/cn.js +4 -2
  139. package/src/i18n/langs/en.js +4 -2
  140. package/src/index.js +93 -0
  141. package/src/permission.js +7 -3
  142. package/src/plugins.js +3 -3
  143. package/src/router/index.js +24 -0
  144. package/src/store/getters.js +2 -1
  145. package/src/store/modules/app.js +10 -1
  146. package/src/styles/display-layout.scss +34 -0
  147. package/src/styles/index.scss +32 -4
  148. package/src/styles/theme/dark-blue/button.scss +9 -0
  149. package/src/styles/theme/dark-blue/card.scss +64 -0
  150. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  151. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  152. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  153. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  154. package/src/styles/theme/dark-blue/font.scss +71 -0
  155. package/src/styles/theme/dark-blue/form.scss +51 -0
  156. package/src/styles/theme/dark-blue/index.scss +247 -0
  157. package/src/styles/theme/dark-blue/input.scss +15 -0
  158. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  159. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  160. package/src/styles/theme/dark-blue/sidebar.scss +296 -0
  161. package/src/styles/theme/dark-blue/tab.scss +83 -0
  162. package/src/styles/theme/dark-blue/table.scss +60 -0
  163. package/src/styles/theme/dark-blue/tree.scss +31 -0
  164. package/src/styles/theme/dark-blue/var.scss +1028 -0
  165. package/src/styles/theme/gray/form-style.scss +2 -2
  166. package/src/styles/theme/gray/input-style.scss +8 -0
  167. package/src/utils/auth-api.js +115 -0
  168. package/src/utils/auth.js +34 -42
  169. package/src/utils/calculator/calculator-factory.js +2 -2
  170. package/src/utils/common-util.js +34 -0
  171. package/src/utils/jump-page-utils.js +29 -5
  172. package/src/utils/menu.js +19 -0
  173. package/src/utils/permission.js +4 -0
  174. package/src/utils/request.js +18 -2
  175. package/src/utils/util.js +7 -3
  176. package/src/views/dsc-component/Sidebar/Item.vue +4 -4
  177. package/src/views/dsc-component/Sidebar/Link.vue +11 -2
  178. package/src/views/dsc-component/Sidebar/SidebarItem.vue +36 -20
  179. package/src/views/dsc-component/Sidebar/index.vue +24 -12
  180. package/src/views/dsc-component/tabs/tab-content.vue +16 -1
  181. package/src/views/login/index.vue +1 -1
@@ -0,0 +1,430 @@
1
+ <template>
2
+ <el-form v-if="searchableColumns.length > 0" ref="searchForm" :model="searchForm" :rules="rules" :label-width="labelWidth" :label-position="query.queryLabelPosition" class="grid-search-form" size="mini">
3
+ <table>
4
+ <tr v-for="r of rowNum" :key="r">
5
+ <td v-for="n of getColumnNumPerRow(r,searchableColumns.length)" :key="n">
6
+ <el-form-item :prop="searchableColumns[fieldNum*(r-1)+(n-1)].prop" :label-width="searchableColumns[fieldNum*(r-1)+(n-1)].searchLabelWidth?searchableColumns[fieldNum*(r-1)+(n-1)].searchLabelWidth:'80px'" :style="{paddingLeft:'10px',minWidth:'200px'}">
7
+ <template slot="label">
8
+ <span v-if="searchableColumns[fieldNum*(r-1)+(n-1)].searchLabel && searchableColumns[fieldNum*(r-1)+(n-1)].searchLabel !== ''" v-html="searchableColumns[fieldNum*(r-1)+(n-1)].searchLabel.replace(/\\n/g, '</br>')" />
9
+ <span v-else v-html="searchableColumns[fieldNum*(r-1)+(n-1)].label.replace(/\\n/g, '</br>')" />
10
+ </template>
11
+ <el-date-picker
12
+ v-if="searchableColumns[fieldNum*(r-1)+(n-1)].dataType === 'DATE' || searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='date' "
13
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
14
+ type="daterange"
15
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
16
+ :range-separator="$t('imatrixUIPublicModel.to')"
17
+ unlink-panels
18
+ :start-placeholder="$t('imatrixUIMessage.startDate')"
19
+ :end-placeholder="$t('imatrixUIMessage.endDate')"
20
+ value-format="yyyy-MM-dd"
21
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
22
+ />
23
+
24
+ <el-date-picker
25
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='dateTimePicker'"
26
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
27
+ type="datetimerange"
28
+ :range-separator="$t('imatrixUIPublicModel.to')"
29
+ unlink-panels
30
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
31
+ :start-placeholder="$t('imatrixUIMessage.startDate')"
32
+ :end-placeholder="$t('imatrixUIMessage.endDate')"
33
+ value-format="yyyy-MM-dd HH:mm:ss"
34
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
35
+ />
36
+
37
+ <el-date-picker
38
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].dataType === 'TIME' && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='timepicker'"
39
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
40
+ type="datetimerange"
41
+ :range-separator="$t('imatrixUIPublicModel.to')"
42
+ unlink-panels
43
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
44
+ :start-placeholder="$t('imatrixUIMessage.startDate')"
45
+ :end-placeholder="$t('imatrixUIMessage.endDate')"
46
+ value-format="HH:mm:ss"
47
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
48
+ />
49
+
50
+ <el-time-picker
51
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='timepicker' && searchableColumns[fieldNum*(r-1)+(n-1)].dataType !== 'TIME' && searchableColumns[fieldNum*(r-1)+(n-1)].dataType !== 'DATE' "
52
+ type="fixed-time"
53
+ :placeholder="$t('imatrixUIMessage.selectTime')"
54
+ style="width: 100%;"
55
+ value-format="HH:mm:ss"
56
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
57
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
58
+ />
59
+ <el-select
60
+ v-else-if="(searchableColumns[fieldNum*(r-1)+(n-1)].componentType && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='select') || searchableColumns[fieldNum*(r-1)+(n-1)].dataType === 'BOOLEAN'"
61
+ clearable
62
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
63
+ :placeholder="$t('imatrixUIMessage.pleaseSelect')"
64
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
65
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
66
+ >
67
+ <el-option
68
+ v-for="item in searchableColumns[fieldNum*(r-1)+(n-1)].valueSet"
69
+ :key="item.value"
70
+ :label="item.label"
71
+ :value="item.value"
72
+ />
73
+ </el-select>
74
+ <el-select
75
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='multiselect'"
76
+ clearable
77
+ multiple
78
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
79
+ collapse-tags
80
+ :placeholder="$t('imatrixUIMessage.pleaseSelect')"
81
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
82
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
83
+ >
84
+ <el-option
85
+ v-for="item in searchableColumns[fieldNum*(r-1)+(n-1)].valueSet"
86
+ :key="item.value"
87
+ :label="item.label"
88
+ :value="item.value"
89
+ />
90
+ </el-select>
91
+ <!--
92
+ <el-input-number
93
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='inputNumber'"
94
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
95
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
96
+ /> -->
97
+
98
+ <search-form-number
99
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='inputNumber'"
100
+ :r="r"
101
+ :n="n"
102
+ @setValue="setNumberValue"
103
+ />
104
+
105
+ <el-switch
106
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='switch'"
107
+ active-color="#13ce66"
108
+ inactive-color="#ff4949"
109
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
110
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
111
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
112
+ />
113
+ <el-slider
114
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='slider'"
115
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
116
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
117
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
118
+ />
119
+
120
+ <el-rate
121
+ v-else-if="searchableColumns[fieldNum*(r-1)+(n-1)].componentType && searchableColumns[fieldNum*(r-1)+(n-1)].componentType==='rate'"
122
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
123
+ :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth"
124
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
125
+ />
126
+ <span v-else-if="customComponent(searchableColumns[fieldNum*(r-1)+(n-1)]) === true">
127
+ <component
128
+ :is="searchableColumns[fieldNum*(r-1)+(n-1)].componentName"
129
+ :ref="searchableColumns[fieldNum*(r-1)+(n-1)].componentName"
130
+ class="customComponent"
131
+ :prop="searchableColumns[fieldNum*(r-1)+(n-1)].prop"
132
+ :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)"
133
+ @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)"
134
+ />
135
+ </span>
136
+ <el-input v-else :value="getFormItemValue(searchableColumns[fieldNum*(r-1)+(n-1)].prop)" :style="searchableColumns[fieldNum*(r-1)+(n-1)].searchControlWidth" @keyup.enter.native="submitForm('searchForm')" @input="setValueToModelProp(searchableColumns[fieldNum*(r-1)+(n-1)].prop,$event)" />
137
+ </el-form-item>
138
+ </td>
139
+ </tr>
140
+ </table>
141
+
142
+ <el-form-item class="search-btn">
143
+ <el-button :loading="loading" type="primary" size="mini" @click="submitForm('searchForm')">
144
+ {{ $t('imatrixUIPublicModel.sure') }}
145
+ </el-button>
146
+ <el-button :loading="loading" size="mini" @click="resetForm('searchForm')">
147
+ {{ $t('imatrixUIPublicModel.reset') }}
148
+ </el-button>
149
+ </el-form-item>
150
+ </el-form>
151
+ </template>
152
+ <style scoped>
153
+ .grid-search-form{
154
+ overflow: auto;
155
+ }
156
+ .grid-search-form >>> .el-form-item{
157
+ margin-bottom: 0px;
158
+ }
159
+
160
+ .grid-search-form >>> .search-btn{
161
+ margin-bottom: 5px;
162
+ text-align: center;
163
+ }
164
+ .grid-search-form >>> .el-select,.grid-search-form >>> .customComponent{
165
+ width: 100%;
166
+ }
167
+ </style>
168
+ <script>
169
+ import searchMethods from './search-methods'
170
+ import searchFormNumber from './search-form-number'
171
+ import store from './store'
172
+ // import { isOptionFunction, getSearchObject } from './utils'
173
+ import { addDynamicProp } from './utils'
174
+ import Vue from 'vue'
175
+ export default {
176
+ name: 'SearchForm',
177
+ components: {
178
+ searchFormNumber
179
+ },
180
+ props: {
181
+ columns: {
182
+ type: Array,
183
+ default: null
184
+ },
185
+ code: {
186
+ type: String,
187
+ default: null
188
+ },
189
+ url: {
190
+ type: String,
191
+ default: null
192
+ },
193
+ pagination: {
194
+ type: Object,
195
+ default: null
196
+ },
197
+ query: {
198
+ type: Object,
199
+ default: null
200
+ },
201
+ searchParam: {
202
+ type: Object,
203
+ default: null
204
+ },
205
+ initSearchProps: {
206
+ type: Array,
207
+ default: null
208
+ },
209
+ // 九宫格组件的id
210
+ gridId: {
211
+ type: String,
212
+ default: '_nineGrid'
213
+ }
214
+
215
+ },
216
+ data() {
217
+ const storeId = this.code + '~' + this.gridId
218
+ const customComponentNames = new Set()
219
+ const gridParams = store.get(storeId)
220
+ let searchForm = {}
221
+ if (this.searchParam !== null) {
222
+ searchForm = JSON.parse(JSON.stringify(this.searchParam))
223
+ // searchForm = this.searchParam
224
+ }
225
+ console.log('searchForm=', searchForm)
226
+ const searchColumns = this.getSearchableColumns()
227
+ if (this.initSearchProps === undefined || this.initSearchProps === null) {
228
+ this.initSearchProps = []
229
+ }
230
+ searchColumns.forEach(column => {
231
+ if (this.initSearchProps.indexOf(column.prop) < 0) {
232
+ // 表示没有默认初始查询字段
233
+ if (column.prop.indexOf('.') > 0) {
234
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
235
+ addDynamicProp(searchForm, column.prop)
236
+ } else {
237
+ searchForm[column.prop] = null
238
+ }
239
+ }
240
+ })
241
+
242
+ const spanNum = this.getSpanNum(storeId)
243
+ const fieldNum = this.getFieldNumPerRow(storeId)
244
+ const rowNum = Math.ceil(searchColumns.length / fieldNum)
245
+ // console.log('searchColumns.length=' + searchColumns.length + ',fieldNum=' + fieldNum + ',rowNum=' + rowNum)
246
+ // // -2是把
247
+ // const dateSpanNum = (spanNum - 2) / 2
248
+
249
+ return {
250
+ searchForm,
251
+ rules: {
252
+
253
+ },
254
+ searchParams: [],
255
+ labelWidth: gridParams.options.search && gridParams.options.search.labelWidth ? gridParams.options.search.labelWidth : '80px',
256
+ customComponentNames: customComponentNames,
257
+ componentName: '',
258
+ spanNum: spanNum,
259
+ fieldNum: fieldNum, // 每行放的字段个数
260
+ rowNum: rowNum, // 一共有几行
261
+ loading: false, // 是否正在查询,默认时否
262
+ storeId // 缓存的列表id
263
+ }
264
+ },
265
+ computed: {
266
+ searchableColumns() {
267
+ return this.getSearchableColumns()
268
+ }
269
+ },
270
+ methods: {
271
+ ...searchMethods,
272
+ // 获得每行排放的字段个数
273
+ getColumnNumPerRow(rowIndex, searchColumnsLength) {
274
+ let columnNumPerRow = this.fieldNum
275
+ if (this.fieldNum * rowIndex > searchColumnsLength) {
276
+ // 表示字段无法填满最后一行
277
+ columnNumPerRow = searchColumnsLength - (this.fieldNum * (rowIndex - 1))
278
+ }
279
+ return columnNumPerRow
280
+ },
281
+ // 每行放的字段个数
282
+ getFieldNumPerRow(storeId) {
283
+ const gridParams = store.get(storeId)
284
+ return gridParams.options.search && gridParams.options.search.fieldNum ? gridParams.options.search.fieldNum : 4
285
+ },
286
+ // 根据每行显示的字段个数,确定栅栏个数,默认是4个字段。最多就只能放6个字段
287
+ getSpanNum(storeId) {
288
+ const fieldNum = this.getFieldNumPerRow(storeId)
289
+ if (fieldNum === 1) {
290
+ return 14
291
+ } else if (fieldNum === 2) {
292
+ return 10
293
+ } else if (fieldNum === 3) {
294
+ return 8
295
+ } else if (fieldNum === 4) {
296
+ return 6
297
+ } else {
298
+ // 6个字段
299
+ return 4
300
+ }
301
+ },
302
+ setValueToModelProp(prop, value) {
303
+ if (prop.indexOf('.') > 0) {
304
+ const parentOjbect = this.getParentObject(prop)
305
+ // 嵌套属性中的最后一个属性是属于这个中间父对象的,所有要通过中间父对象来赋值
306
+ parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)] = value
307
+ } else {
308
+ this.searchForm[prop] = value
309
+ }
310
+ },
311
+ getSearchableColumns(columns, searchColumns) {
312
+ if (!this.customComponentNames) {
313
+ this.customComponentNames = new Set()
314
+ }
315
+ if (!searchColumns) {
316
+ searchColumns = []
317
+ }
318
+ if (!columns) {
319
+ columns = this.columns
320
+ }
321
+ for (let i = 0; i < columns.length; i++) {
322
+ const column = columns[i]
323
+ if (column.prop === '$index' || column.prop === '$selection' || column.dynamic) {
324
+ // 序号和复选框列、动态列 不属于该组件的查询字段
325
+ continue
326
+ }
327
+ if (column.groupHeader) {
328
+ // 组合表头中子表头的字段查询
329
+ this.getSearchableColumns(column.children, searchColumns)
330
+ } else {
331
+ if (column.queryType === 'normal' && !column.custom && column.prop !== '') {
332
+ // 表示是普通查询,且不是占位符列,是查询字段
333
+ if (typeof (column.componentType) === 'undefined' || column.componentType === '') {
334
+ column.componentType = 'input'
335
+ }
336
+ if (column.querySetting && column.querySetting !== '') {
337
+ const querySetting = JSON.parse(column.querySetting)
338
+ if (querySetting.width) {
339
+ column.searchControlWidth = 'width:' + querySetting.width + 'px'
340
+ }
341
+ if (querySetting.labelWidth) {
342
+ column.searchLabelWidth = querySetting.labelWidth + 'px'
343
+ }
344
+ if (querySetting.label) {
345
+ column.searchLabel = querySetting.label
346
+ }
347
+ }
348
+ // 行编辑时自定义编辑组件
349
+ if (column.componentType.indexOf('custom:') >= 0) {
350
+ column.componentName = column.componentType.substring(column.componentType.indexOf(':') + 1)
351
+ this.customComponentNames.add(column.componentName)
352
+ } else {
353
+ column.componentName = ''
354
+ }
355
+ searchColumns.push(column)
356
+ }
357
+ }
358
+ }
359
+ return searchColumns
360
+ },
361
+ customComponent(column) {
362
+ const gridParams = store.get(this.storeId)
363
+ if (column.componentName && column.componentName !== '') {
364
+ this.customComponentNames.add(column.componentName)
365
+ return true
366
+ }
367
+ if ((!column.componentName || column.componentName === '') &&
368
+ gridParams.options &&
369
+ gridParams.options.search &&
370
+ gridParams.options.search.customSearchElements) {
371
+ // 定义了自定义查询组件
372
+ const propSearchEle = gridParams.options.search.customSearchElements[column.prop]
373
+ // console.log('customComponent-customSearchElements-propSearchEle-', column.prop)
374
+ if (propSearchEle) {
375
+ column.componentName = 'custom-' + column.prop
376
+ const component = propSearchEle.call(this, column)
377
+ // console.log('customComponent-customSearchElements-')
378
+ if (component) {
379
+ this.customComponentNames.add(column.componentName)
380
+ Vue.component(column.componentName, component)
381
+ return true
382
+ }
383
+ }
384
+ }
385
+ return false
386
+ },
387
+ submitForm(formName) {
388
+ this.$refs[formName].validate((valid) => {
389
+ if (valid) {
390
+ // const searchDemo = [
391
+ // { leftBracket: '', propName: 'name', enumName: '', operator: 'contain', propValue: '系统', rightBracket: '', joinSign: 'and', dataType: 'TEXT' },
392
+ // { leftBracket: '', propName: 'createdTime', enumName: '', operator: 'eq', startValue: '2019-01-29', endValue: '2019-01-30', propValue: '2019-01-30', rightBracket: '', joinSign: 'and', dataType: 'DATE' },
393
+ // { leftBracket: '', propName: 'enabledState', enumName: 'tech.imatrix.enumeration.MenuState', operator: 'eq', propValue: 'ENABLE', rightBracket: '', joinSign: 'and', dataType: 'ENUM' }
394
+ // ]
395
+ this.loading = true
396
+ this.searchParams = this.packageSearchParam()
397
+ this.$emit('search', this.searchParams, true)
398
+ } else {
399
+ // console.log('error submit!!')
400
+ return false
401
+ }
402
+ })
403
+ },
404
+
405
+ resetForm(formName) {
406
+ // console.log('customComponentNames=', this.customComponentNames)
407
+ for (const componentName of this.customComponentNames) { // 遍历
408
+ this.$refs[componentName][0].resetField()
409
+ }
410
+ // this.$refs[formName].resetFields()
411
+
412
+ this.searchableColumns.forEach(column => {
413
+ // 表示没有默认初始查询字段
414
+ if (column.prop.indexOf('.') > 0) {
415
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
416
+ addDynamicProp(this.searchForm, column.prop)
417
+ } else {
418
+ this.searchForm[column.prop] = null
419
+ }
420
+ })
421
+ this.$emit('reset')
422
+ },
423
+ setNumberValue(value, r, n) {
424
+ let itemValue = this.getFormItemValue(this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop)
425
+ itemValue = value
426
+ this.setValueToModelProp(this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop, itemValue)
427
+ }
428
+ }
429
+ }
430
+ </script>
@@ -0,0 +1,134 @@
1
+ const searchMethods = {
2
+ packageSearchParam() {
3
+ const searchParams = []
4
+ this.searchableColumns.forEach(column => {
5
+ const param = { leftBracket: '', rightBracket: '', joinSign: 'and' }
6
+ // 布尔型字段时prop中去掉了is字符,查询时返回带有is的属性字段,
7
+ // 否则会导致查询布尔型报500错误
8
+ let orgProp = column.orgProp
9
+ // sql查询时,会把点“.”改为两个下划线"__"
10
+ const replaceDot = '__'
11
+ if (orgProp.indexOf(replaceDot) > 0) {
12
+ // 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
13
+ orgProp = orgProp.replace(replaceDot, '.')
14
+ }
15
+ param.columnProp = column.prop
16
+ param.propName = orgProp
17
+ param.enumName = column.enumName
18
+ param.operator = this.getOperator(column)
19
+ param.dataType = column.dataType
20
+ if (column.dataType === 'DATE' || column.dataType === 'TIME') {
21
+ // 日期 或 时间类型
22
+ const values = this.getFormItemValue(column.prop)
23
+ // console.log('values==', values, column.prop)
24
+ if (values !== null && values.length === 2 && values[0] !== null && values[1] !== null) {
25
+ param.startValue = values[0]
26
+ param.endValue = values[1]
27
+ searchParams.push(param)
28
+ }
29
+ } else if (column.dataType === 'INTEGER' || column.dataType === 'LONG') {
30
+ // 日期 或 时间类型
31
+ const values1 = this.getFormItemValue(column.prop)
32
+ if (values1) {
33
+ if (!Array.isArray(values1) || values1.length < 2 || values1[0] === null && values1[1] === null) {
34
+ // 填写了一个有效值
35
+ if (!Array.isArray(values1)) {
36
+ param.propValue = values1
37
+ searchParams.push(param)
38
+ } else if (values1.length < 2) {
39
+ param.propValue = values1[0]
40
+ searchParams.push(param)
41
+ } else if (values1[0] === null) {
42
+ param.propValue = values1[1]
43
+ searchParams.push(param)
44
+ } else if (values1[1] === null) {
45
+ param.propValue = values1[0]
46
+ searchParams.push(param)
47
+ }
48
+ } else {
49
+ // 填写了两个有效值
50
+ param.startValue = values1[0]
51
+ param.endValue = values1[1]
52
+ searchParams.push(param)
53
+ }
54
+ }
55
+ } else {
56
+ if (column.componentType === 'multiselect') {
57
+ // 表示是多选下拉框选择器选择的值
58
+ const values = this.getFormItemValue(column.prop)
59
+ // console.log('values==', values, column.prop)
60
+ this.packageValueWithArray(values, searchParams, param)
61
+ } else {
62
+ const propValue = this.getFormItemValue(column.prop)
63
+ this.packageValueWithArray(propValue, searchParams, param)
64
+ }
65
+ }
66
+ })
67
+ return searchParams
68
+ },
69
+ getOperator(column) {
70
+ if ((column.dataType === 'TEXT' || column.dataType === 'CLOB') && column.fuzzy) {
71
+ // 是否是文本类型的字段,且启用了模糊查询,则表示操作符为contains模糊查询
72
+ return 'CONTAIN'
73
+ } else {
74
+ // 否则就是等于
75
+ return 'EQ'
76
+ }
77
+ },
78
+ getFormItemValue(prop) {
79
+ if (prop.indexOf('.') > 0) {
80
+ const parentOjbect = this.getParentObject(prop)
81
+ return parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)]
82
+ } else {
83
+ return this.searchForm[prop]
84
+ }
85
+ },
86
+ getParentObject(prop) {
87
+ const nestedProp = prop.split('.')
88
+ // 属性只有一个时父对象就是searchForm
89
+ if (nestedProp.length === 1) {
90
+ return this.searchForm
91
+ } else {
92
+ let parentObject
93
+ // 属性超过2个时先找到最后一层属性的父对象
94
+ for (let i = 0; i < nestedProp.length - 1; i++) {
95
+ parentObject = this.searchForm[nestedProp[i]]
96
+ }
97
+ return parentObject
98
+ }
99
+ },
100
+ // 处理多选下拉框时获得的值
101
+ // 处理非多选下拉框的值
102
+ packageValueWithArray(value, searchParams, param) {
103
+ if (value && Array.isArray(value)) {
104
+ const selectValues = value
105
+ // if (!Array.isArray(values)) {
106
+ // selectValues = values.split(',')
107
+ // }
108
+ let num = 0
109
+ selectValues.forEach(val => {
110
+ const selectParam = Object.assign({}, param)
111
+ selectParam.joinSign = 'or'// 将条件连接符修改为or,否则无法查询到值
112
+ if (num === 0) {
113
+ selectParam.leftBracket = '1' // 左边有1个括号
114
+ }
115
+ if (num === selectValues.length - 1) {
116
+ // 说明是最后一个条件
117
+ selectParam.rightBracket = '1'// 右边有1个括号
118
+ selectParam.joinSign = 'and' // 最后一个条件的连接符需要修改为and
119
+ }
120
+ selectParam.propValue = val
121
+ selectParam.operator = 'EQ'
122
+ if (val) {
123
+ searchParams.push(selectParam)
124
+ }
125
+ num++
126
+ })
127
+ } else if (typeof (value) !== 'undefined' && value !== '' && value !== null && !Array.isArray(value)) {
128
+ // 不是数组
129
+ param.propValue = value
130
+ searchParams.push(param)
131
+ }
132
+ }
133
+ }
134
+ export default searchMethods
@@ -0,0 +1,3 @@
1
+ // 用于存放表格的控制属性,控制表格的编辑状态、存储表格的数据便于使用等等
2
+ const store = new Map()
3
+ export default store
@@ -0,0 +1,91 @@
1
+ /* eslint-disable no-undef */
2
+ import Vue from 'vue'
3
+ import store from './store'
4
+ import { packageEnumAndBeanColumnValueSets } from '../../utils/value-set'
5
+ import { isHasOptionFunction } from './utils'
6
+ const superGridService = {
7
+ initialize() {
8
+ const url = Vue.prototype.baseAPI + '/component/super-grids/' + this.code
9
+ const param = {}
10
+ const isSqlSetting = this.options.isSql
11
+ if (this.options && typeof (isSqlSetting) !== 'undefined') {
12
+ this.isSql = isSqlSetting
13
+ param.isSql = isSqlSetting + ''
14
+ }
15
+ this.isLoading = true
16
+ // 初始化组件时先获取元信息再获取数据,以后翻页、排序、查询不再去获取元数据了
17
+ this.$http.post(url, param).then(data => {
18
+ // console.log('自定义显示数量1:' + data)
19
+ // console.log('initialize--grid--data.columns.length=', data.columns.length)
20
+ if (this.options.pageSizes && data.pagination) {
21
+ // 组件的options属性配置中配置“可选行数”,已该配置为准
22
+ let pageSizeArr = null
23
+ const pageSizeStrs = this.options.pageSizes.split(',')
24
+ if (pageSizeStrs && pageSizeStrs.length > 0) {
25
+ pageSizeArr = []
26
+ for (var i = 0; i < pageSizeStrs.length; i++) {
27
+ pageSizeArr.push(pageSizeStrs[i] * 1)
28
+ }
29
+ data.pagination.pageSize = pageSizeArr[0]
30
+ }
31
+ data.pagination.layout = 'total, sizes, prev, pager, next, jumper'
32
+ data.pagination.pageSizes = pageSizeArr
33
+ // console.log('自定义显示数量2:' + pageSizeArr)
34
+ // console.log('自定义显示数量3:' + data)
35
+ }
36
+ if (typeof (this.options.initSortInfo) !== 'undefined') {
37
+ // 组件的options属性配置中配置“排序信息”,以该配置为准
38
+ if (Array.isArray(this.options.initSortInfo)) {
39
+ data.sortInfo = this.options.initSortInfo
40
+ } else {
41
+ data.sortInfo = []
42
+ data.sortInfo.push(this.options.initSortInfo)
43
+ }
44
+ }
45
+ Object.assign(this, data)
46
+ const gridParams = store.get(this.code + '~' + this.gridId)
47
+
48
+ // store.listCode = this.code
49
+ // 需要多个组件共享的数据放到store中,避免组件定义一堆props来接收这些共享数据
50
+ packageEnumAndBeanColumnValueSets(this.columns, this.code).then(() => {
51
+ gridParams.isSql = this.isSql
52
+ gridParams.columns = this.columns
53
+ gridParams.lineEdit = this.lineEdit
54
+ gridParams.basicInfo = this.basicInfo
55
+ gridParams.pagination = this.pagination
56
+ gridParams.query = this.query
57
+ this.hasLoadedColumns = true
58
+ let canFetchData = true
59
+ if (isHasOptionFunction('loadBeforeSend', this.storeId)) {
60
+ canFetchData = gridParams.options.loadBeforeSend.call(this, { columns: this.columns, gridParams })
61
+ }
62
+ if (canFetchData === undefined || canFetchData === true) {
63
+ if (typeof (this.options.initSearch) === 'undefined' || this.options.initSearch !== false) {
64
+ // 获得行拖动顺序接口路径
65
+ this.urlToSaveOrder = this.lineEdit && this.lineEdit.urlToSaveOrder ? this.lineEdit.urlToSaveOrder : null
66
+ // 表示初始化时查询记录
67
+ this.fetchData().then(() => {
68
+ this.initSelectData()
69
+ })
70
+ }
71
+ }
72
+ })
73
+ })
74
+ },
75
+ // 单选时默认勾选指定的记录
76
+ initSelectData() {
77
+ if (this.options && this.options.currentIds) {
78
+ // 表示指定了选择的记录
79
+ for (let i = 0; i < this.gridData.length; i++) {
80
+ const record = this.gridData[i]
81
+ if ((record.id || record.ID) && this.options.currentIds.indexOf(record.id ? record.id : record.ID) >= 0) {
82
+ this.changeSelect(record)
83
+ if (this.multiple === false) {
84
+ break
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ export default superGridService