sohelp-eleplus 1.1.13

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 (191) hide show
  1. package/README.md +7 -0
  2. package/cache/DictCache.js +58 -0
  3. package/cache/ModuleCache.js +352 -0
  4. package/components.js +45 -0
  5. package/core-export.js +4 -0
  6. package/http/CrudHttp.js +115 -0
  7. package/http/DictHttp.js +12 -0
  8. package/http/ModuleHttp.js +68 -0
  9. package/http/SohelpHttp.js +125 -0
  10. package/index.js +6 -0
  11. package/installer.js +8 -0
  12. package/lang/en_US.js +4 -0
  13. package/lang/zh_CN.js +4 -0
  14. package/lang/zh_TW.js +4 -0
  15. package/package.json +9 -0
  16. package/sohelp-ace-editor/index.vue +198 -0
  17. package/sohelp-application-select/index.vue +15 -0
  18. package/sohelp-autocode/index.vue +53 -0
  19. package/sohelp-calendar-view/index.vue +11 -0
  20. package/sohelp-card-view/index.vue +11 -0
  21. package/sohelp-condition/index.vue +210 -0
  22. package/sohelp-cry-input/index.vue +64 -0
  23. package/sohelp-date/index.vue +27 -0
  24. package/sohelp-datetime/index.vue +44 -0
  25. package/sohelp-datetime-picker/index.vue +86 -0
  26. package/sohelp-datetime-range/index.vue +59 -0
  27. package/sohelp-dict/index.vue +207 -0
  28. package/sohelp-dict/props.js +68 -0
  29. package/sohelp-drawer/index.vue +31 -0
  30. package/sohelp-drop-card/index.vue +94 -0
  31. package/sohelp-drop-card/props.js +68 -0
  32. package/sohelp-dyn-select/index.vue +99 -0
  33. package/sohelp-dyn-select/props.js +67 -0
  34. package/sohelp-dyn-tree/index.vue +82 -0
  35. package/sohelp-dyn-tree-select/index.vue +114 -0
  36. package/sohelp-entity-form/index.vue +524 -0
  37. package/sohelp-entity-grid/index.vue +30 -0
  38. package/sohelp-file-upload/index.vue +218 -0
  39. package/sohelp-filter-scheme/components/condition.vue +102 -0
  40. package/sohelp-filter-scheme/components/filter.vue +45 -0
  41. package/sohelp-filter-scheme/components/keywords.vue +15 -0
  42. package/sohelp-filter-scheme/components/scheme.vue +49 -0
  43. package/sohelp-filter-scheme/index.vue +113 -0
  44. package/sohelp-grid/SohelpGridConfig.js~ +408 -0
  45. package/sohelp-grid/components/filter-condition-item.vue +298 -0
  46. package/sohelp-grid/index.vue +1886 -0
  47. package/sohelp-grid/js/ConditionType.js +101 -0
  48. package/sohelp-grid/js/DefaultGridOptions.js +141 -0
  49. package/sohelp-grid/js/DefaultProps.js +27 -0
  50. package/sohelp-grid/js/SohelpConfigFunction.js +0 -0
  51. package/sohelp-grid/js/SohelpGridConfig.js +101 -0
  52. package/sohelp-grid/js/useSohelpGridConfig.js +519 -0
  53. package/sohelp-grid-select/index.vue +245 -0
  54. package/sohelp-grid-view/filter/config/grid-filter-condition.vue +221 -0
  55. package/sohelp-grid-view/filter/config/grid-filter-config.vue +27 -0
  56. package/sohelp-grid-view/filter/config/grid-filter-field.vue +378 -0
  57. package/sohelp-grid-view/filter/config/grid-filter-keywords.vue +310 -0
  58. package/sohelp-grid-view/filter/config/grid-filter-list.vue +313 -0
  59. package/sohelp-grid-view/filter/config/grid-filter-scheme.vue +264 -0
  60. package/sohelp-grid-view/filter/config/grid-filter-sort.vue +310 -0
  61. package/sohelp-grid-view/filter/config/index.vue +206 -0
  62. package/sohelp-grid-view/filter/filter-form.vue +427 -0
  63. package/sohelp-grid-view/filter/filter-toolbar.vue +110 -0
  64. package/sohelp-grid-view/filter/index.vue +160 -0
  65. package/sohelp-grid-view/index.vue +379 -0
  66. package/sohelp-grid-view-select/index.vue +141 -0
  67. package/sohelp-group-view/index.vue +11 -0
  68. package/sohelp-icon-select/index.vue +96 -0
  69. package/sohelp-icon-select/vxeui-icon.js +90 -0
  70. package/sohelp-image-upload/index.vue +286 -0
  71. package/sohelp-input/index.vue +39 -0
  72. package/sohelp-modal/index.vue +49 -0
  73. package/sohelp-module/index.vue +54 -0
  74. package/sohelp-module/useModalManager.js +89 -0
  75. package/sohelp-module/useSohelpModule.js +66 -0
  76. package/sohelp-number-input/index.vue +32 -0
  77. package/sohelp-number-range/index.vue +135 -0
  78. package/sohelp-org-select/index.vue +30 -0
  79. package/sohelp-org-tree/index.vue +18 -0
  80. package/sohelp-org-tree-select/index.vue +93 -0
  81. package/sohelp-org-user-tree/index.vue +26 -0
  82. package/sohelp-org-user-tree-select/index.vue +11 -0
  83. package/sohelp-pagination/index.vue +11 -0
  84. package/sohelp-power/index.vue +105 -0
  85. package/sohelp-pro-form/components/pro-form-footer.vue +44 -0
  86. package/sohelp-pro-form/components/pro-form-item.vue +1133 -0
  87. package/sohelp-pro-form/index.vue +257 -0
  88. package/sohelp-pro-form/util.js +140 -0
  89. package/sohelp-pro-layout/index.vue +11 -0
  90. package/sohelp-pro-table/index.vue +14 -0
  91. package/sohelp-process/index.vue +216 -0
  92. package/sohelp-rate/index.vue +56 -0
  93. package/sohelp-rate/props.js +71 -0
  94. package/sohelp-relation/index.vue +11 -0
  95. package/sohelp-rich-text/index.vue +242 -0
  96. package/sohelp-rich-text/util.js +231 -0
  97. package/sohelp-richtext/index.vue +10 -0
  98. package/sohelp-role-select/index.vue +33 -0
  99. package/sohelp-search/components/search-config.vue +0 -0
  100. package/sohelp-search/index.vue +49 -0
  101. package/sohelp-search-pro-form/index.vue +11 -0
  102. package/sohelp-select/index.vue +120 -0
  103. package/sohelp-split-panel/index.vue +15 -0
  104. package/sohelp-switch/index.vue +56 -0
  105. package/sohelp-table/index.vue +151 -0
  106. package/sohelp-tenant-select/index.vue +128 -0
  107. package/sohelp-text/index.vue +14 -0
  108. package/sohelp-textarea-input/index.vue +36 -0
  109. package/sohelp-time/index.vue +10 -0
  110. package/sohelp-tree/index.vue +37 -0
  111. package/sohelp-tree-select/index.vue +18 -0
  112. package/sohelp-user-select/index.vue +44 -0
  113. package/sohelp-user-select/index.vue~ +53 -0
  114. package/sohelp-user-select/props.js +71 -0
  115. package/sohelp-user-tag/index.vue +12 -0
  116. package/sohelp-user-tree/index.vue +11 -0
  117. package/sohelp-vform-drawer/index.vue +40 -0
  118. package/sohelp-vform-eleplus/favicon.ico +0 -0
  119. package/sohelp-vform-eleplus/index.vue +297 -0
  120. package/sohelp-vform-eleplus/preview.html +91 -0
  121. package/sohelp-vform-eleplus/render.es.js +72433 -0
  122. package/sohelp-vform-eleplus/render.style.css +16 -0
  123. package/sohelp-vform-eleplus/render.umd.js +57 -0
  124. package/sohelp-vform-eleplus/tinymce/langs/zh_CN.js +462 -0
  125. package/sohelp-vform-eleplus/tinymce/langs/zh_TW.js +419 -0
  126. package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.css +72 -0
  127. package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.min.css +7 -0
  128. package/sohelp-vform-eleplus/tinymce/skins/content/default/content.css +67 -0
  129. package/sohelp-vform-eleplus/tinymce/skins/content/default/content.min.css +7 -0
  130. package/sohelp-vform-eleplus/tinymce/skins/content/document/content.css +72 -0
  131. package/sohelp-vform-eleplus/tinymce/skins/content/document/content.min.css +7 -0
  132. package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.css +68 -0
  133. package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.min.css +7 -0
  134. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.css +732 -0
  135. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.css +726 -0
  136. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.min.css +7 -0
  137. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.min.css +7 -0
  138. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.css +29 -0
  139. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.min.css +7 -0
  140. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
  141. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.css +3047 -0
  142. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.min.css +7 -0
  143. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.css +673 -0
  144. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.min.css +7 -0
  145. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.css +37 -0
  146. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.min.css +7 -0
  147. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.css +714 -0
  148. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.css +726 -0
  149. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.min.css +7 -0
  150. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.min.css +7 -0
  151. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.css +29 -0
  152. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.min.css +7 -0
  153. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
  154. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.css +3047 -0
  155. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.min.css +7 -0
  156. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.css +673 -0
  157. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +7 -0
  158. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +37 -0
  159. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +7 -0
  160. package/sohelp-vform-modal/index.vue +41 -0
  161. package/sohelp-vform-select/index.vue +11 -0
  162. package/sohelp-vform-vant/favicon.ico +0 -0
  163. package/sohelp-vform-vant/render.es.js +14608 -0
  164. package/sohelp-vform-vant/render.style.css +1 -0
  165. package/sohelp-vform-vant/render.umd.js +22 -0
  166. package/sohelp-vxe-grid/DefaultGridOptions.js +102 -0
  167. package/sohelp-vxe-grid/DefaultProps.js +37 -0
  168. package/sohelp-vxe-grid/SohelpGridConfig.js +142 -0
  169. package/sohelp-vxe-grid/index.vue +518 -0
  170. package/sohelp-vxe-grid-select/index.vue +148 -0
  171. package/sohelp-vxe-table/index.vue +184 -0
  172. package/sohelp-workflow/index.vue +495 -0
  173. package/sohelp-workflow/nodeWrap.vue +53 -0
  174. package/sohelp-workflow/nodes/addNode.vue +27 -0
  175. package/sohelp-workflow/nodes/approver.vue +125 -0
  176. package/sohelp-workflow/nodes/branch.vue +434 -0
  177. package/sohelp-workflow/nodes/promoter.vue +80 -0
  178. package/sohelp-workflow/nodes/send.vue +95 -0
  179. package/sohelp-workflow-drawer/components/approval-modal.vue +182 -0
  180. package/sohelp-workflow-drawer/components/draw-box.vue +141 -0
  181. package/sohelp-workflow-drawer/components/form.vue +79 -0
  182. package/sohelp-workflow-drawer/components/table.vue +153 -0
  183. package/sohelp-workflow-drawer/components/timeline.vue +189 -0
  184. package/sohelp-workflow-drawer/components/workflow.vue +68 -0
  185. package/sohelp-workflow-drawer/index.vue +311 -0
  186. package/sohelp-workflow-drawer/js/index.js +119 -0
  187. package/style/index.scss +0 -0
  188. package/utils/ProFormConvertUtil.js +76 -0
  189. package/utils/core.js +310 -0
  190. package/utils/use-form-data.js +48 -0
  191. package/utils/use-mobile.js +43 -0
@@ -0,0 +1,313 @@
1
+ <template>
2
+ <div class="list-box">
3
+ <div class="list-item">
4
+ <ele-card
5
+ bordered
6
+ header="未分配"
7
+ :body-style="{
8
+ padding: '0',
9
+ overflowY: 'auto',
10
+ height: 'calc(100% - 50px)'
11
+ }"
12
+ :header-style="{
13
+ background: '#f7f7f7',
14
+ border: '1px solid #e8e8e8'
15
+ }"
16
+ class="list-card"
17
+ >
18
+ <!-- -->
19
+ <ele-table ref="unAllocatedRef" class="demo-table">
20
+ <thead style="position: sticky; top: 0; z-index: 9">
21
+ <tr>
22
+ <th style="width: 40px"
23
+ ><el-checkbox
24
+ v-model="unAllocatedChecked"
25
+ @change="unAllocatedChange"
26
+ ></el-checkbox
27
+ ></th>
28
+ <th style="width: 40px"></th>
29
+ <th>属性</th>
30
+ <th>属性描述</th>
31
+ </tr>
32
+ </thead>
33
+ <vue-draggable
34
+ tag="tbody"
35
+ item-key="id"
36
+ :animation="300"
37
+ :modelValue="unAllocatedDatasource"
38
+ :force-fallback="true"
39
+ group="demoDragTable"
40
+ handle=".drag-handle"
41
+ :set-data="() => void 0"
42
+ >
43
+ <template #item="{ element }">
44
+ <tr>
45
+ <td
46
+ ><el-checkbox
47
+ v-model="unAllocatedSelection"
48
+ :label="element"
49
+ >
50
+ <template #default></template>
51
+ </el-checkbox
52
+ ></td>
53
+ <td>
54
+ <ele-text
55
+ :icon="DragOutlined"
56
+ type="placeholder"
57
+ class="drag-handle"
58
+ style="cursor: move"
59
+ />
60
+ </td>
61
+ <td>{{ element }}</td>
62
+ <td>{{ propertiesOriginData[element] }}</td>
63
+ </tr>
64
+ </template>
65
+ <template #footer v-if="!unAllocatedDatasource.length">
66
+ <tr>
67
+ <td colspan="4" style="text-align: center; background: none">
68
+ <ele-text type="placeholder">暂无数据</ele-text>
69
+ </td>
70
+ </tr>
71
+ </template>
72
+ </vue-draggable>
73
+ </ele-table>
74
+ </ele-card>
75
+ </div>
76
+ <div class="list-item">
77
+ <el-button
78
+ :icon="ArrowLeft"
79
+ type="primary"
80
+ @click="unAllocatedHandle"
81
+ :disabled="!allocatedSelection.length"
82
+ ></el-button>
83
+ <el-button
84
+ :icon="ArrowRight"
85
+ type="primary"
86
+ @click="allocatedHandle"
87
+ :disabled="!unAllocatedSelection.length"
88
+ ></el-button>
89
+ </div>
90
+ <div class="list-item"
91
+ ><ele-card
92
+ header="已分配"
93
+ bordered
94
+ :body-style="{
95
+ padding: '0',
96
+ overflowY: 'auto',
97
+ height: 'calc(100% - 50px)'
98
+ }"
99
+ :header-style="{
100
+ background: '#f7f7f7',
101
+ border: '1px solid #e8e8e8'
102
+ }"
103
+ class="list-card"
104
+ >
105
+ <ele-table ref="allocatedRef" class="demo-table">
106
+ <thead style="position: sticky; top: 0; z-index: 9">
107
+ <tr>
108
+ <th style="width: 40px">
109
+ <el-checkbox
110
+ v-model="allocatedChecked"
111
+ @change="allocatedChange"
112
+ ></el-checkbox>
113
+ </th>
114
+ <th style="width: 40px"></th>
115
+ <th>属性</th>
116
+ <th>属性描述</th>
117
+ </tr>
118
+ </thead>
119
+ <vue-draggable
120
+ tag="tbody"
121
+ item-key="id"
122
+ :animation="300"
123
+ :modelValue="modelValue"
124
+ :force-fallback="true"
125
+ group="demoDragTable"
126
+ handle=".drag-handle"
127
+ :set-data="() => void 0"
128
+ @update:modelValue="(value) => updateAllocated(value)"
129
+ >
130
+ <template #item="{ element }">
131
+ <tr>
132
+ <td
133
+ ><el-checkbox
134
+ v-model="allocatedSelection"
135
+ :label="element"
136
+ ><template #default></template></el-checkbox
137
+ ></td>
138
+ <td>
139
+ <ele-text
140
+ :icon="DragOutlined"
141
+ type="placeholder"
142
+ class="drag-handle"
143
+ style="cursor: move"
144
+ />
145
+ </td>
146
+ <td>{{ element }}</td>
147
+ <td>{{ propertiesOriginData[element] }}</td>
148
+ </tr>
149
+ </template>
150
+ <template #footer v-if="!modelValue.length">
151
+ <tr>
152
+ <td colspan="4" style="text-align: center; background: none">
153
+ <ele-text type="placeholder">暂无数据</ele-text>
154
+ </td>
155
+ </tr>
156
+ </template>
157
+ </vue-draggable>
158
+ </ele-table>
159
+ </ele-card>
160
+ </div>
161
+ </div>
162
+ </template>
163
+
164
+ <script setup>
165
+ import { ref, watch, computed } from 'vue';
166
+ import VueDraggable from 'vuedraggable';
167
+ import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';
168
+ import { DragOutlined } from '@/components/icons';
169
+
170
+ const props = defineProps({
171
+ modelValue: {
172
+ type: Array,
173
+ default: () => []
174
+ },
175
+ properties: {
176
+ type: Array,
177
+ default: () => []
178
+ }
179
+ });
180
+
181
+ const emit = defineEmits(['update:modelValue']);
182
+
183
+ // 未分配
184
+ const unAllocatedChecked = ref(false);
185
+ const unAllocatedRef = ref(null);
186
+ const unAllocatedSelection = ref([]);
187
+
188
+ const propertiesData = ref([]);
189
+ const propertiesOriginData = ref({});
190
+
191
+ const unAllocatedDatasource = computed(() => {
192
+ return propertiesData.value.filter(
193
+ (item) => !props.modelValue.includes(item)
194
+ );
195
+ });
196
+
197
+ // 已分配
198
+ const allocatedChecked = ref(false);
199
+ const allocatedRef = ref(null);
200
+ const allocatedSelection = ref([]);
201
+
202
+ // 未分配全选
203
+ const unAllocatedChange = (val) => {
204
+ unAllocatedSelection.value = val ? unAllocatedDatasource.value : [];
205
+ };
206
+ // 已分配全选
207
+ const allocatedChange = (val) => {
208
+ allocatedSelection.value = val ? props.modelValue : [];
209
+ };
210
+
211
+ const updateAllocated = (value) => {
212
+ emit('update:modelValue', value);
213
+ };
214
+
215
+ const allocatedHandle = () => {
216
+ if (unAllocatedSelection.value.length > 0) {
217
+ emit('update:modelValue', [
218
+ ...props.modelValue,
219
+ ...unAllocatedSelection.value
220
+ ]);
221
+ unAllocatedSelection.value = [];
222
+ }
223
+ unAllocatedChecked.value = false;
224
+ };
225
+
226
+ const unAllocatedHandle = () => {
227
+ if (allocatedSelection.value.length > 0) {
228
+ emit(
229
+ 'update:modelValue',
230
+ props.modelValue.filter(
231
+ (item) => !allocatedSelection.value.includes(item)
232
+ )
233
+ );
234
+ allocatedSelection.value = [];
235
+ }
236
+ allocatedChecked.value = false;
237
+ };
238
+
239
+ watch(
240
+ () => props.properties,
241
+ (val) => {
242
+ if (val?.length > 0) {
243
+ propertiesData.value = val.filter(item=>item.name!='_operation').map((item) => item.name);
244
+ propertiesOriginData.value = val.reduce((acc, item) => {
245
+ acc[item.name] = item.label;
246
+ return acc;
247
+ }, {});
248
+ }
249
+ },
250
+ {
251
+ immediate: true
252
+ }
253
+ );
254
+ </script>
255
+
256
+ <style lang="scss" scoped>
257
+ .list-box {
258
+ width: 1000px;
259
+ height: calc(100% - 2px);
260
+ overflow-x: auto;
261
+ overflow-y: hidden;
262
+ display: flex;
263
+ gap: 10px;
264
+
265
+ .list-item {
266
+ height: 100%;
267
+ width: 47%;
268
+ overflow: hidden;
269
+ max-width: 500px;
270
+ .list-card {
271
+ height: 100%;
272
+ overflow: hidden;
273
+ }
274
+ }
275
+
276
+ .list-item:nth-child(2) {
277
+ width: 6%;
278
+ min-width: 60px;
279
+ display: flex;
280
+ flex-direction: column;
281
+ align-items: center;
282
+ justify-content: center;
283
+ }
284
+ }
285
+
286
+ .el-button {
287
+ margin: 10px 0!important;
288
+ }
289
+
290
+ .demo-table {
291
+ .drag-handle {
292
+ color: #333;
293
+ }
294
+
295
+ tr.sortable-chosen {
296
+ user-select: none;
297
+ }
298
+
299
+ tr.sortable-ghost {
300
+ opacity: 0;
301
+ }
302
+
303
+ tr.sortable-fallback {
304
+ opacity: 1 !important;
305
+ display: table !important;
306
+
307
+ td {
308
+ background: var(--el-color-primary-light-8);
309
+ border-radius: 0 !important;
310
+ }
311
+ }
312
+ }
313
+ </style>
@@ -0,0 +1,264 @@
1
+ <template>
2
+ <div class="grid-filter-scheme-box">
3
+ <vxe-grid
4
+ ref="vxeGridRef"
5
+ v-bind="gridOptions"
6
+ @checkbox-all="selectChangeEvent"
7
+ @checkbox-change="selectChangeEvent"
8
+ @toolbar-button-click="toolClick"
9
+ @cell-click="handleCurrentChange"
10
+ @row-dragend="handleDragEnd"
11
+ style="width: 380px"
12
+ >
13
+ <template #label="{ row }">
14
+ <vxe-input v-model="row.label"></vxe-input>
15
+ </template>
16
+ </vxe-grid>
17
+
18
+ <div class="mt-10 condition-wrap" style="width: 500px" v-if="currentRow >= 0">
19
+ <ele-text>筛选标签</ele-text>
20
+ <el-input
21
+ ref="inputRef"
22
+ style="max-width: 500px"
23
+ class="mb-10"
24
+ v-model="gridOptions.data[currentRow].label"
25
+ placeholder="请输入标签名称"
26
+ clearable
27
+ @blur="handleBlur"
28
+ />
29
+ <ele-text>条件配置</ele-text>
30
+
31
+ <div class="condition-box">
32
+ <filter-condition
33
+ v-if="currentRow >= 0"
34
+ :key="currentRow"
35
+ :fields="properties"
36
+ v-model="gridOptions.data[currentRow].config"
37
+ :value="gridOptions.data[currentRow].config"
38
+ />
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </template>
43
+
44
+ <script setup>
45
+ import { ref, reactive, nextTick, watch } from 'vue';
46
+ import FilterCondition from './grid-filter-condition.vue';
47
+
48
+ const props = defineProps({
49
+ modelValue: {
50
+ type: Array,
51
+ default: () => []
52
+ },
53
+ properties: {
54
+ type: Array,
55
+ default: () => []
56
+ }
57
+ });
58
+
59
+ const emit = defineEmits(['update:modelValue']);
60
+
61
+ const selectedRows = ref([]);
62
+
63
+ const vxeGridRef = ref();
64
+ const gridOptions = reactive({
65
+ border: true,
66
+ minHeight: '99%',
67
+ maxHeight: '100%',
68
+ checkboxConfig: {
69
+ checkField: 'checked'
70
+ },
71
+ toolbarConfig: {
72
+ buttons: [
73
+ { code: 'add', name: '插入', status: 'primary' },
74
+ { code: 'del', name: '删除', status: 'danger', disabled: true }
75
+ ]
76
+ },
77
+
78
+ rowConfig: {
79
+ isHover: true,
80
+ isCurrent: true,
81
+ isFollowSelected: true,
82
+ drag: true,
83
+ useKey: true //sortabled 排序用,必须
84
+ },
85
+
86
+ columnConfig: {
87
+ resizable: true
88
+ },
89
+ columns: [
90
+ { type: 'checkbox', width: 50, align: 'center' },
91
+ { type: 'seq', width: 50, fixed: 'left', align: 'center' },
92
+ {
93
+ field: 'label',
94
+ title: '标签',
95
+ dragSort: true,
96
+ minWidth: 260
97
+ }
98
+ ],
99
+ data: []
100
+ });
101
+
102
+ const inputRef = ref(null);
103
+ const currentRow = ref(-1);
104
+
105
+ const handleCurrentChange = ({ rowIndex }) => {
106
+ currentRow.value = rowIndex;
107
+ };
108
+
109
+ const selectChangeEvent = () => {
110
+ const $grid = vxeGridRef.value;
111
+ if ($grid) {
112
+ selectedRows.value = $grid.getCheckboxRecords();
113
+ }
114
+
115
+ const delTool = gridOptions.toolbarConfig.buttons.find((tool) => tool.code === 'del');
116
+
117
+ delTool.disabled = selectedRows.value.length ? false : true;
118
+ };
119
+
120
+ // 工具栏点击事件
121
+ const toolClick = ({ code }) => {
122
+ switch (code) {
123
+ case 'add':
124
+ insertData();
125
+ break;
126
+ case 'del':
127
+ removeEvent();
128
+ break;
129
+ }
130
+ };
131
+
132
+ // 插入
133
+ const insertData = () => {
134
+ vxeGridRef.value
135
+ .insertAt({
136
+ label: '',
137
+ config: {
138
+ children: [],
139
+ type: 'and'
140
+ }
141
+ })
142
+ .then(({ row }) => {
143
+ gridOptions.data.unshift(row);
144
+
145
+ nextTick(() => {
146
+ vxeGridRef.value.setCurrentRow(row);
147
+ currentRow.value = 0;
148
+ inputRef.value?.focus();
149
+ });
150
+ });
151
+ };
152
+
153
+ // 删除
154
+ const removeEvent = () => {
155
+ vxeGridRef.value.remove(selectedRows.value);
156
+ let rowKey = gridOptions.data[currentRow.value]._X_ROW_KEY;
157
+
158
+ selectedRows.value.forEach((item) => {
159
+ gridOptions.data.splice(gridOptions.data.indexOf(item), 1);
160
+ });
161
+
162
+ if (selectedRows.value.some((item) => item._X_ROW_KEY === rowKey)) {
163
+ currentRow.value = -1;
164
+ } else {
165
+ let index = gridOptions.data.findIndex((item) => item._X_ROW_KEY === rowKey);
166
+ currentRow.value = index;
167
+ vxeGridRef.value.setCurrentRow(gridOptions.data[index]);
168
+ }
169
+
170
+ selectedRows.value = [];
171
+ };
172
+
173
+ // reload
174
+ const reloadData = (data) => {
175
+ vxeGridRef.value?.reloadData(data);
176
+ };
177
+
178
+ // 获取数据
179
+ const getData = () => {
180
+ const { fullData } = getTableData();
181
+ return fullData || [];
182
+ };
183
+
184
+ // 获取表格数据
185
+ const getTableData = () => {
186
+ return vxeGridRef.value?.getTableData();
187
+ };
188
+
189
+ const handleBlur = (v) => {
190
+ let value = v.target.value;
191
+ if (value) {
192
+ let arr = gridOptions.data.filter((item) => item.label === value);
193
+ if (arr.length > 2) {
194
+ gridOptions.data[currentRow.value].label = '';
195
+ }
196
+ }
197
+ };
198
+
199
+ const handleFocus = () => {
200
+ if (currentRow.value === -1) {
201
+ inputRef.value.value = '';
202
+ }
203
+ };
204
+
205
+ const handleDragEnd = ({ $table, newRow }) => {
206
+ currentRow.value = gridOptions.data.indexOf(newRow);
207
+ const fullData = $table.getFullData();
208
+ gridOptions.data = fullData;
209
+ emit('update:modelValue', fullData);
210
+ };
211
+
212
+ watch(
213
+ () => props.modelValue,
214
+ (val) => {
215
+ selectedRows.value = [];
216
+ gridOptions.data = val;
217
+ },
218
+ {
219
+ immediate: true
220
+ }
221
+ );
222
+ </script>
223
+ <style>
224
+ .grid-filter-scheme-box {
225
+ display: flex;
226
+ align-items: flex-start;
227
+ justify-content: flex-start;
228
+ gap: 20px;
229
+
230
+ min-width: 900px;
231
+ height: 100%;
232
+ }
233
+
234
+ .drag-btn {
235
+ cursor: move;
236
+ font-size: 12px;
237
+ }
238
+ .vxe-body--row.sortable-ghost,
239
+ .vxe-body--row.sortable-chosen {
240
+ background-color: #dfecfb;
241
+ }
242
+
243
+ .condition-wrap {
244
+ height: 92%;
245
+ display: flex;
246
+ flex-direction: column;
247
+ overflow: hidden;
248
+ }
249
+
250
+ .condition-header {
251
+ height: 40px;
252
+ line-height: 40px;
253
+ padding: 0 10px;
254
+ }
255
+
256
+ .condition-body {
257
+ flex: 1;
258
+ }
259
+
260
+ .condition-box {
261
+ flex: 1;
262
+ height: 100%;
263
+ }
264
+ </style>