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,408 @@
1
+ import { reactive } from "vue";
2
+ import { moduleCache } from "../../cache/ModuleCache";
3
+ import _DefaultGridOptions from "./DefaultGridOptions";
4
+ import { useMobile } from "@/utils/use-mobile";
5
+
6
+ const { mobile } = useMobile();
7
+
8
+ function deepClone(obj) {
9
+ return JSON.parse(JSON.stringify(obj));
10
+ }
11
+
12
+ // 动态生成cellStyle函数
13
+ function createDynamicCellStyle(styleConfigs = []) {
14
+ // 预编译条件表达式为函数
15
+ const compiledConfigs = styleConfigs.map((config) => ({
16
+ ...config,
17
+ conditionFn: new Function("row", `return ${config.condition}`)
18
+ }));
19
+
20
+ return function({ row, column }) {
21
+ const _config = compiledConfigs.filter((c) => c.name === column.field);
22
+ if (!_config) return null;
23
+ try {
24
+ for (const config of _config) {
25
+ const conditionFn = new Function("row", `return ${config.condition}`);
26
+ if (conditionFn(row)) {
27
+ return {
28
+ color: config.fontColor,
29
+ backgroundColor: config.bgColor,
30
+ fontWeight: config?.bold ? "bold" : "",
31
+ fontStyle: config.italic ? "italic" : "",
32
+ textDecoration: config.strikethrough ? "line-through" : config.underline ? "underline" : ""
33
+ };
34
+ }
35
+ }
36
+ } catch (e) {
37
+ console.error("条件解析错误:", e);
38
+ }
39
+ return null;
40
+ };
41
+ }
42
+
43
+ // 动态生成RowStyle函数
44
+ function createDynamicRowStyle(styleConfigs = []) {
45
+ // 预编译条件表达式为函数
46
+ const compiledConfigs = styleConfigs.map((config) => ({
47
+ ...config,
48
+ conditionFn: new Function("row", `return ${config.condition}`)
49
+ }));
50
+
51
+ return function({ row }) {
52
+ const style = {};
53
+ for (const config of compiledConfigs) {
54
+ try {
55
+ if (config.conditionFn(row)) {
56
+ Object.assign(style, {
57
+ color: config.fontColor,
58
+ backgroundColor: config.bgColor,
59
+ fontWeight: config?.bold ? "bold" : "",
60
+ fontStyle: config.italic ? "italic" : "",
61
+ textDecoration: config.strikethrough ? "line-through" : config.underline ? "underline" : ""
62
+ });
63
+ }
64
+ } catch (e) {
65
+ console.error(`条件执行错误 [${config.condition}]:`, e);
66
+ }
67
+ }
68
+
69
+ return style;
70
+ };
71
+ }
72
+
73
+ /**列转换*/
74
+ const switchVxeProperty = (property, sortList, f, formulaMap) => {
75
+ let editor = {
76
+ field: property.name,
77
+ title: property.label,
78
+ query: property.query,
79
+ width: property.width || 120,
80
+ type: property.editor || property.type,
81
+ align: property.align || "left",
82
+ showOverflow: true,
83
+ editRender: {
84
+ enabled: property.edit,
85
+ edit: property.edit,
86
+ maxlength: property.length,
87
+ ...property.editorParam
88
+ },
89
+ slots: {
90
+ default: "default_" + property.name
91
+ },
92
+ contentRender: {
93
+ name: property.render,
94
+ props: property.renderParam || {},
95
+ event: "event"
96
+ }
97
+ };
98
+
99
+ // 编辑
100
+ if (property.edit) {
101
+ editor.slots.edit = "edit_" + property.name;
102
+ }
103
+
104
+ if (
105
+ ["SohelpImageUpload", "SohelpFileUpload", "SohelpRate", "SohelpSwitch", "SohelpProcess"].includes(property.editor)
106
+ ) {
107
+ delete editor.slots.edit; //不渲然编辑
108
+ editor.editRender.enabled = false;
109
+ }
110
+
111
+ //筛选项配置
112
+ // if (filterMap[property.name]) {
113
+ if (editor.query) {
114
+ setFilterConfig(editor);
115
+ }
116
+ // }
117
+
118
+ //是否统计
119
+ const isSummary = f.find((item) => item.field === property.name);
120
+
121
+ if (isSummary) {
122
+ editor.slots["footer"] = "footer_" + property.name;
123
+ }
124
+
125
+ // 排序
126
+ if (sortList?.includes(property.name)) {
127
+ editor["sortable"] = true;
128
+ }
129
+
130
+ if (property.name === "id") {
131
+ editor["width"] = 150;
132
+ }
133
+
134
+ return editor;
135
+ };
136
+
137
+ /**
138
+ * 筛选配置
139
+ */
140
+ const setFilterConfig = (editor) => {
141
+ editor.filters = [{ data: "", checked: false }];
142
+ editor.filterRender = {};
143
+ editor.slots = {
144
+ ...editor.slots,
145
+ filter: "filter_" + editor.field
146
+ };
147
+ return editor;
148
+ };
149
+
150
+ /**
151
+ * properties中过滤掉删除的属性
152
+ * @param {*} _filter
153
+ * @returns
154
+ */
155
+ const filterFieldsByProperties = (_data) => {
156
+ const data = { ..._data };
157
+ const properties = new Set(data.properties?.map((item) => item.name).filter(Boolean) || []);
158
+ const filterArray = (list, key) => {
159
+ return Array.isArray(list) ? list.filter((item) => properties.has(key ? item?.[key] : item)) : [];
160
+ };
161
+
162
+ let validProperties = Object.fromEntries(
163
+ data.properties.filter((item) => item.name && !item.hidden)?.map((item) => [item.name, item.label])
164
+ );
165
+
166
+ data.list = filterArray(data.list).filter((item) => {
167
+ return item in validProperties;
168
+ });
169
+
170
+ data.filter.keywords = filterArray(data.filter.keywords);
171
+ data.filter.field = filterArray(data.filter.field, "name");
172
+ //过滤掉不在列表中的sort属性
173
+ data.filter.sort = filterArray(data.filter.sort.filter((item) => data.filter.field.some((f) => f.name === item)));
174
+ data.properties = data.properties.filter((item) => item.name);
175
+ return data;
176
+ };
177
+
178
+ /**初始化配置实例*/
179
+ export async function initial(sohelpVxeGridRef, props, permission) {
180
+ /**商邦网格列表参数*/
181
+ const SohelpConfig = reactive({});
182
+ const propertiesMap = reactive({});
183
+ var batchButtonsIndex = -1;
184
+ const footerData = reactive([]);
185
+ const filterMap = reactive({});
186
+ const formulaMap = reactive({});
187
+ const DefaultGridOptions = reactive(deepClone(_DefaultGridOptions));
188
+ /**获取列表配置*/
189
+ const data = props.isEntityGrid
190
+ ? await moduleCache.getEntityGrid(props.refid)
191
+ : await moduleCache.getGrid(props.refid);
192
+ if (!data) {
193
+ throw new Error("Invalid config data or missing code");
194
+ }
195
+
196
+ try {
197
+ Object.assign(SohelpConfig, filterFieldsByProperties(data));
198
+ Object.assign(
199
+ propertiesMap,
200
+ (data?.properties || [])
201
+ .filter((item) => !item.hidden)
202
+ .reduce((acc, cur) => {
203
+ let param = {};
204
+ if (cur?.editorParam?.length > 0) {
205
+ param = JSON.parse(cur.editorParam);
206
+ }
207
+
208
+ acc[cur.name] = { ...cur, editorParam: param };
209
+ return acc;
210
+ }, {})
211
+ );
212
+
213
+ // 计算公式
214
+ if (data.formula && data.formula.length > 0) {
215
+ Object.assign(formulaMap, data.formula.reduce((a, c) => (a[c.formulaField] || (a[c.formulaField] = c), a), {}));
216
+ }
217
+
218
+ // 筛选
219
+ Object.assign(
220
+ filterMap,
221
+ (SohelpConfig.filter?.field || []).reduce((acc, cur) => {
222
+ acc[cur.name] = cur;
223
+ return acc;
224
+ })
225
+ );
226
+
227
+ // 格式化工具栏
228
+ const getToolbarsButtons = (data) => {
229
+ if (data?.length) {
230
+ const groupedButtons = data.reduce((acc, button) => {
231
+ const { buttonType } = button;
232
+ if (!acc[buttonType]) {
233
+ acc[buttonType] = [];
234
+ }
235
+
236
+ acc[buttonType].push(button);
237
+ return acc;
238
+ }, {});
239
+
240
+ // 按钮格式化
241
+ const formatterButton = (arr, type) => {
242
+ return arr.map((item) => {
243
+ let obj = {
244
+ code: item.type,
245
+ name: item.title,
246
+ pno: item.pno,
247
+ handler: item.handler,
248
+ buttonType: item.buttonType,
249
+ icon: item.iconCls,
250
+ ...JSON.parse(item.params || "{}")
251
+ };
252
+ return obj;
253
+ });
254
+ };
255
+
256
+ const { common = [], more = [], batch = [] } = groupedButtons;
257
+ let arr = [...formatterButton(common)];
258
+ if (more.length > 0) {
259
+ arr.push({
260
+ code: "more",
261
+ name: "更多操作",
262
+ dropdowns: formatterButton(more)
263
+ });
264
+ }
265
+ if (batch.length > 0) {
266
+ arr.push({
267
+ code: "batchMore",
268
+ name: "批量操作",
269
+ dropdowns: formatterButton(batch, "batch"),
270
+ disabled: true
271
+ });
272
+ }
273
+ return arr;
274
+ }
275
+ return [];
276
+ };
277
+
278
+ // 按钮权限过滤
279
+ const buttons = getToolbarsButtons(data.toolbars.filter((f) => !f.pno || permission.hasPermission(f.pno)));
280
+ if (buttons && buttons.length > 0) {
281
+ DefaultGridOptions.toolbarConfig.buttons = buttons;
282
+ // 更多下拉菜单索引
283
+ batchButtonsIndex = buttons.reduce((acc, curr, index) => {
284
+ if (curr.code === "batchMore") acc.push(index);
285
+ return acc;
286
+ }, []);
287
+ }
288
+
289
+ //初始化属性列表配置
290
+ DefaultGridOptions.columns = [
291
+ {
292
+ field: "_checkbox",
293
+ title: "",
294
+ fixed: mobile.value ? false : "left",
295
+ type: "checkbox",
296
+ align: "center",
297
+ width: 40
298
+ },
299
+ { field: "_seq", type: "seq", title: "#", fixed: mobile.value ? false : "left", align: "center", width: 40 }
300
+ ];
301
+
302
+ const isRowDrag = props.rowDrag || data.rowDrag;
303
+ //是否支持拖动
304
+ if (isRowDrag) {
305
+ DefaultGridOptions.columns.unshift({
306
+ title: "",
307
+ fixed: mobile.value ? false : "left",
308
+ width: 40,
309
+ align: "center",
310
+ dragSort: true,
311
+ field: "_drag"
312
+ });
313
+ }
314
+
315
+ //是否开启表尾
316
+ Object.assign(
317
+ footerData,
318
+ (data.properties || [])
319
+ .filter((item) => item.summaryType)
320
+ ?.map((item) => {
321
+ return {
322
+ [item.name]: 0,
323
+ summaryRender: item.summaryRender ? JSON.parse(item.summaryRender) : null,
324
+ field: item.name,
325
+ type: item.summaryType
326
+ };
327
+ })
328
+ );
329
+ DefaultGridOptions.showFooter = footerData?.length > 0;
330
+
331
+ //商邦列转换成Vxe列
332
+ if (SohelpConfig?.list && SohelpConfig.list.length > 0) {
333
+ const requireData = {};
334
+ const columns = [];
335
+ SohelpConfig.list.forEach((name, index) => {
336
+ let item = propertiesMap[name];
337
+ if (item) {
338
+ const row = switchVxeProperty(item, SohelpConfig.filter?.sort, footerData, formulaMap);
339
+ columns.push(row);
340
+ if (item.edit && item.notNull) {
341
+ requireData[item.name] = [
342
+ {
343
+ required: true,
344
+ message: item.label + "不能为空"
345
+ }
346
+ ];
347
+ }
348
+ }
349
+ });
350
+
351
+ DefaultGridOptions.columns.push(...columns);
352
+ DefaultGridOptions.editRules = { ...requireData };
353
+ }
354
+
355
+ //操作栏
356
+ if (data?.operationToolbars?.length) {
357
+ DefaultGridOptions.columns.push({
358
+ field: "_operate",
359
+ title: "操作",
360
+ width: (data.operationToolbars.length + 1) * 80 + "px",
361
+ align: "center",
362
+ fixed: mobile.value ? false : "right",
363
+ slots: {
364
+ default: "operate"
365
+ }
366
+ });
367
+ }
368
+
369
+ // 拦截编辑
370
+ DefaultGridOptions.editConfig.beforeEditMethod = ({ row, column }) => {
371
+ if (column.type === "SohelpTextarea") {
372
+ return false;
373
+ }
374
+ return true;
375
+ };
376
+
377
+ // 设置分页数据
378
+ DefaultGridOptions.pagerConfig.enabled = data.paging;
379
+ DefaultGridOptions.pagerConfig.pageSize = data.limit || 50;
380
+
381
+ // 行列样式
382
+ if (data.colors && data.colors.length > 0) {
383
+ const rowData = data.colors.filter((item) => item.type === "r");
384
+ const cellData = data.colors.filter((item) => item.type === "c");
385
+ if (rowData.length > 0) {
386
+ DefaultGridOptions.rowStyle = createDynamicRowStyle(rowData);
387
+ } else {
388
+ DefaultGridOptions.stripe = true;
389
+ }
390
+ if (cellData.length > 0) {
391
+ DefaultGridOptions.cellStyle = createDynamicCellStyle(cellData);
392
+ }
393
+ }
394
+
395
+ //转化初始化其他参数...
396
+ } catch (error) {
397
+ throw error; //重新抛出错误,以便调用者可以处理它
398
+ }
399
+
400
+ return {
401
+ gridOptions: DefaultGridOptions,
402
+ sohelpConfig: SohelpConfig,
403
+ propertiesMap,
404
+ batchButtonsIndex: batchButtonsIndex,
405
+ footerData: footerData,
406
+ formulaMap
407
+ };
408
+ }
@@ -0,0 +1,298 @@
1
+ <script setup>
2
+ import { reactive, ref, watch } from 'vue';
3
+ import { CaretBottom } from '@element-plus/icons-vue';
4
+ import { comparisonOptions, comparisonType } from '../js/ConditionType.js';
5
+ import { useI18n } from 'vue-i18n';
6
+
7
+ const { t } = useI18n();
8
+
9
+ const props = defineProps({
10
+ modelValue: Object,
11
+ properties: Object,
12
+ teleported: {
13
+ type: Boolean,
14
+ default: true
15
+ }
16
+ });
17
+
18
+ const emit = defineEmits(['update:modelValue', 'change']);
19
+ const condition = reactive({});
20
+
21
+ const dropDownRef = ref(null);
22
+
23
+ const isNumber = (val) => {
24
+ return typeof val === 'number';
25
+ };
26
+
27
+ const getComparisonByEditor = (type) => {
28
+ let data = null;
29
+ if (comparisonType[type]) {
30
+ data = comparisonOptions.filter((option) => comparisonType[type].includes(option.command));
31
+ } else {
32
+ data = comparisonOptions;
33
+ }
34
+ data.forEach((option) => {
35
+ option['title'] = option.i18n ? t(option.i18n) : option.title;
36
+ });
37
+ return data;
38
+ };
39
+
40
+ const conditionChange = (properties) => {
41
+ const { name, editor } = properties;
42
+ if (editor === 'SohelpDatetime' || editor === 'SohelpDate') {
43
+ if (condition.comparison === 'LIKE' || condition.comparison === 'NOT_LIKE') {
44
+ condition.value = [];
45
+ } else {
46
+ condition.value = '';
47
+ }
48
+ }
49
+ };
50
+
51
+ watch(
52
+ () => condition,
53
+ (val) => {
54
+ emit('update:modelValue', val);
55
+ emit('change', val);
56
+ },
57
+ {
58
+ deep: true
59
+ }
60
+ );
61
+
62
+ watch(
63
+ () => props.modelValue,
64
+ (val) => {
65
+ if (!val.comparison) {
66
+ const first = getComparisonByEditor(props?.properties?.editor);
67
+ val.comparison = first?.[0].command || 'LIKE';
68
+ }
69
+ Object.assign(condition, val);
70
+ },
71
+ {
72
+ immediate: true,
73
+ deep: true
74
+ }
75
+ );
76
+ </script>
77
+ <script>
78
+ export default {
79
+ name: 'FilterConditionItem'
80
+ };
81
+ </script>
82
+ <template>
83
+ <div class="sohelp-filter-condition" v-if="properties">
84
+ <el-form-item :label="t(properties.i18n) || properties.label">
85
+ <ele-dropdown
86
+ ref="dropDownRef"
87
+ v-model="condition.comparison"
88
+ trigger="click"
89
+ :items="getComparisonByEditor(properties.editor)"
90
+ :teleported="teleported"
91
+ @change="conditionChange(properties)"
92
+ >
93
+ <template #default="{ selected }">
94
+ <el-button text bg size="small"
95
+ >{{ selected?.title }}
96
+ <el-icon style="margin-left: 3px">
97
+ <CaretBottom />
98
+ </el-icon>
99
+ </el-button>
100
+ </template>
101
+ </ele-dropdown>
102
+ </el-form-item>
103
+
104
+ <!-- 字典 -->
105
+ <sohelp-dict
106
+ v-model="condition.value"
107
+ type="multipleSelect"
108
+ v-if="properties.editor === 'SohelpDict'"
109
+ v-bind="properties.editorParam"
110
+ :readonly="false"
111
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
112
+ :code="properties?.dict || properties.editorParam?.code"
113
+ style="width: 160px"
114
+ :teleported="teleported"
115
+ class="filter-condition"
116
+ />
117
+ <div v-else-if="properties.editor === 'SohelpProcess'">
118
+ <sohelp-number-range
119
+ v-model="condition.value"
120
+ v-bind="properties.editorParam"
121
+ style="width: 160px"
122
+ :readonly="false"
123
+ class="filter-condition"
124
+ :min="0"
125
+ :max="100"
126
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
127
+ v-if="condition.comparison === 'LIKE' || condition.comparison === 'NOT_LIKE'"
128
+ ></sohelp-number-range>
129
+
130
+ <sohelp-process
131
+ v-else
132
+ v-model="condition.value"
133
+ v-bind="properties.editorParam"
134
+ style="width: 160px"
135
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
136
+ class="filter-condition"
137
+ ></sohelp-process>
138
+ </div>
139
+
140
+ <div v-else-if="properties.editor === 'SohelpRate'">
141
+ <sohelp-number-range
142
+ v-model="condition.value"
143
+ v-bind="properties.editorParam"
144
+ style="width: 160px"
145
+ class="filter-condition"
146
+ :min="1"
147
+ :max="5"
148
+ :readonly="false"
149
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
150
+ v-if="condition.comparison === 'LIKE' || condition.comparison === 'NOT_LIKE'"
151
+ ></sohelp-number-range>
152
+ <sohelp-rate
153
+ v-model="condition.value"
154
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
155
+ v-else
156
+ v-bind="properties.editorParam"
157
+ style="width: 160px"
158
+ type="select"
159
+ class="filter-condition"
160
+ />
161
+ </div>
162
+
163
+ <!-- 数字输入框 -->
164
+ <div v-else-if="properties.editor === 'SohelpNumberInput'">
165
+ <sohelp-number-range
166
+ v-model="condition.value"
167
+ v-if="condition.comparison === 'LIKE' || condition.comparison === 'NOT_LIKE'"
168
+ v-bind="properties.editorParam"
169
+ style="width: 160px"
170
+ :readonly="false"
171
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
172
+ class="filter-condition"
173
+ ></sohelp-number-range>
174
+ <el-input
175
+ type="number"
176
+ v-else
177
+ v-model="condition.value"
178
+ v-bind="properties.editorParam"
179
+ :readonly="false"
180
+ style="width: 160px"
181
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
182
+ class="filter-condition"
183
+ ></el-input>
184
+ </div>
185
+
186
+ <!-- 开关 -->
187
+ <div v-else-if="properties.editor === 'SohelpSwitch' || properties.editor === 'SohelpCheckbox'">
188
+ <sohelp-select
189
+ v-model="condition.value"
190
+ v-bind="properties.editorParam"
191
+ :datasource="[
192
+ { label: '是', value: isNumber(condition.value) ? 1 : 'true' },
193
+ { label: '否', value: isNumber(condition.value) ? 0 : 'false' }
194
+ ]"
195
+ style="width: 160px"
196
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
197
+ class="filter-condition"
198
+ :teleported="teleported"
199
+ ></sohelp-select>
200
+ </div>
201
+
202
+ <!-- 日期、日期时间 -->
203
+ <div v-else-if="properties.editor === 'SohelpDatetime' || properties.editor === 'SohelpDate'">
204
+ <sohelp-datetime-picker
205
+ v-model="condition.value"
206
+ v-bind="properties.editorParam"
207
+ style="width: 245px"
208
+ :readonly="false"
209
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
210
+ class="filter-condition"
211
+ type="daterange"
212
+ value-format="YYYY-MM-DD"
213
+ v-if="condition.comparison === 'LIKE' || condition.comparison === 'NOT_LIKE'"
214
+ ></sohelp-datetime-picker>
215
+
216
+ <sohelp-datetime
217
+ v-else
218
+ v-model="condition.value"
219
+ v-bind="properties.editorParam"
220
+ style="width: 245px"
221
+ :readonly="false"
222
+ type="date"
223
+ value-format="YYYY-MM-DD"
224
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
225
+ class="filter-condition"
226
+ ></sohelp-datetime>
227
+ </div>
228
+
229
+ <!-- 文本域 -->
230
+ <sohelp-input
231
+ v-model.trim="condition.value"
232
+ v-else-if="properties.editor === 'SohelpTextarea'"
233
+ style="width: 160px"
234
+ :readonly="false"
235
+ v-bind="properties.editorParam"
236
+ :rows="1"
237
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
238
+ class="filter-condition"
239
+ />
240
+
241
+ <!-- 下拉用户选择 -->
242
+ <sohelp-user-select
243
+ v-else-if="properties.editor === 'SohelpUserSelect'"
244
+ v-model="condition.value"
245
+ v-bind="properties.editorParam"
246
+ :multiple="true"
247
+ :datasource="userDatasource"
248
+ style="width: 160px"
249
+ :readonly="false"
250
+ :teleported="teleported"
251
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
252
+ class="filter-condition"
253
+ />
254
+
255
+ <!-- 下拉组织机构 -->
256
+ <sohelp-org-tree-select
257
+ v-else-if="properties.editor === 'SohelpOrgTreeSelect'"
258
+ v-model="condition.value"
259
+ v-bind="properties.editorParam"
260
+ :multiple="true"
261
+ :datasource="orgDatasource"
262
+ style="width: 160px"
263
+ :teleported="teleported"
264
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
265
+ class="filter-condition"
266
+ />
267
+
268
+ <sohelp-input
269
+ v-model.trim="condition.value"
270
+ v-else
271
+ :readonly="false"
272
+ :disabled="condition.comparison === 'EMPTY' || condition.comparison === 'NOT_EMPTY'"
273
+ v-bind="properties.editorParam"
274
+ :show-word-limit="false"
275
+ style="width: 160px"
276
+ class="filter-condition"
277
+ ></sohelp-input>
278
+ </div>
279
+ </template>
280
+
281
+ <style lang="scss" scoped>
282
+ .sohelp-filter-condition {
283
+ // width: 100%;
284
+ display: flex;
285
+ flex-direction: column;
286
+
287
+ .el-form-item {
288
+ :deep(.el-form-item__label) {
289
+ font-size: 14px !important;
290
+ font-weight: normal;
291
+ color: #000;
292
+ padding-right: 0;
293
+ }
294
+
295
+ margin-bottom: 5px !important;
296
+ }
297
+ }
298
+ </style>