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,1886 @@
1
+ <script setup>
2
+ import { Filter, Search, Sort, SortDown, SortUp } from "@element-plus/icons-vue";
3
+ import { useMobile } from "@/utils/use-mobile";
4
+ import { usePermission } from "@/utils/use-permission";
5
+ import DefaultProps from "./js/DefaultProps";
6
+ import { computed, nextTick, reactive, ref, watch } from "vue";
7
+ import DefaultGridOptions from "./js/DefaultGridOptions";
8
+ import { calcSummary, switchGridValue } from "./js/SohelpGridConfig";
9
+ import { EleMessage } from "@/components/ele-admin-plus/components";
10
+ import { ElMessageBox } from "element-plus/es";
11
+ import { useFormData } from "@/utils/use-form-data";
12
+ import { CrudHttp, resetCommonConfig, updateCommonConfig } from "@/components/sohelp-eleplus";
13
+ import ApprovalModal from "@/views/user/todo/components/approval-modal.vue";
14
+ import WorkflowDrawer from "@/views/user/todo/components/workflow-drawer.vue";
15
+ import SohelpTextareaInput from "@/components/sohelp-eleplus/sohelp-textarea-input/index.vue";
16
+ import SohelpPower from "@/components/sohelp-eleplus/sohelp-power/index.vue";
17
+ import FilterConditionItem from "@/components/sohelp-eleplus/sohelp-grid/components/filter-condition-item.vue";
18
+ import { useSohelpGridConfig } from "./js/useSohelpGridConfig.js";
19
+ import { useI18n } from "vue-i18n";
20
+ import SohelpEntityForm from "@/components/sohelp-eleplus/sohelp-entity-form/index.vue";
21
+
22
+ const { initial, isConfigDone } = useSohelpGridConfig();
23
+ const { t } = useI18n();
24
+ const { mobile } = useMobile();
25
+ const permission = usePermission();
26
+ const props = defineProps({ ...JSON.parse(JSON.stringify(DefaultProps)) });
27
+ const emit = defineEmits(["resetFilter", "checkboxAll", "checkboxChange", "toolbarButtonClick", "operationButtonClick", "menuRightClick", "showFilter", "editClosed", "currentColumnChange"]);
28
+ const drawerKey = ref(0);
29
+ const todoDrawerRef = ref(null);
30
+ const drawerVisible = ref(false);
31
+ const drawerData = ref(null);
32
+ const current = ref(null);
33
+ const isPage = ref(false);
34
+ const approvalModalVisible = ref(false);
35
+ const approvalData = ref({});
36
+
37
+ //报表打印
38
+ const currentReportValue = ref(null);
39
+ const visibleReport = ref(false);
40
+ const reportData = ref([]);
41
+ const currentRow = ref(null);
42
+ const loadReport = () => {
43
+ SohelpHttp.get("/engine/web/report/list", { refid: props.refid }).then(res => {
44
+ if (res.meta.success) {
45
+ reportData.value = res.data.map(item => ({
46
+ value: item.refid,
47
+ refid: item.refid,
48
+ name: item.name,
49
+ createDate: item.createDate
50
+ }));
51
+ if (reportData.value.length > 0) {
52
+ currentReportValue.value = reportData.value[0].refid;
53
+ }
54
+ } else {
55
+ EleMessage.error(res.meta.message);
56
+ }
57
+ });
58
+ };
59
+
60
+ const designReport = () => {
61
+ if (!currentReportValue.value || !currentRow?.value?.id) {
62
+ EleMessage.error("请选择报表模板或报表数据!");
63
+ return;
64
+ }
65
+ const baseURl = SohelpHttp.getBaseUrl();
66
+ const url = baseURl.endsWith("/") ? baseURl : baseURl + "/";
67
+ window.open(url + `ureport/designer?_u=${currentReportValue.value}&id=${currentRow?.value?.id}&refid=${currentReportValue?.value}`);
68
+ };
69
+ const openReport = () => {
70
+ if (!currentReportValue.value || !currentRow?.value?.id) {
71
+ EleMessage.error("请选择报表模板或报表数据!");
72
+ return;
73
+ }
74
+ const baseURl = SohelpHttp.getBaseUrl();
75
+ const url = baseURl.endsWith("/") ? baseURl : baseURl + "/";
76
+ window.open(url + `ureport/preview?_u=${currentReportValue.value}&id=${currentRow?.value?.id}&refid=${currentReportValue?.value}`);
77
+ };
78
+ const closeReport = () => {
79
+ visibleReport.value = false;
80
+ };
81
+
82
+ const loading = ref(false);
83
+ //显示实体表单
84
+ const visibleEntityForm = ref(false);
85
+ //当前工具栏配置信息
86
+ const toolbarButtonParams = ref({});
87
+ const entityFormRef = ref(null);
88
+ const entityFormData = ref({});
89
+ const entityFormValue = ref({});
90
+ const entityFormConfig = ref({});
91
+ const closeEntityForm = () => {
92
+ visibleEntityForm.value = false;
93
+ };
94
+ const saveEntityForm = () => {
95
+ loading.value = true;
96
+ entityFormRef.value.save({}, (res) => {
97
+ loading.value = false;
98
+ if (res.meta.success) {
99
+ refresh();
100
+ visibleEntityForm.value = false;
101
+ } else {
102
+ EleMessage.error(res.meta.message);
103
+ }
104
+ });
105
+ };
106
+
107
+
108
+ //配置加载状态
109
+ // Grid配置
110
+ const sohelpConfig = defineModel("config");
111
+ // 过滤条件数据
112
+ const filterValue = defineModel("filterValue", {
113
+ type: Object,
114
+ default: () => ({
115
+ keywords: "",
116
+ power: 0,
117
+ filter: [],
118
+ scheme: "",
119
+ sort: "",
120
+ order: ""
121
+ })
122
+ });
123
+
124
+ // 属性映射
125
+ const propertiesMap = defineModel("propertiesMap");
126
+
127
+ // Grid实例
128
+ const sohelpVxeGridRef = ref(null);
129
+ // GridOptions配置
130
+ const gridOptions = reactive(JSON.parse(JSON.stringify(DefaultGridOptions)));
131
+ const batchButtonsIndex = ref(2);
132
+ const sortValue = ref("");
133
+ /**
134
+ * 缓存网格列表数据
135
+ * @type {UnwrapNestedRefs<*[]>}
136
+ */
137
+ const gridData = reactive([]);
138
+ /**
139
+ * 记忆原始过虑条件数据
140
+ * @type {Ref<UnwrapRef<string>>}
141
+ */
142
+ const originFilterValue = ref("");
143
+
144
+ /**
145
+ * 选中数据庥
146
+ * @type {Ref<UnwrapRef<*[]>>}
147
+ */
148
+ const selections = ref([]);
149
+ /**
150
+ * 网格列表底部数据
151
+ * @type {UnwrapNestedRefs<*[]>}
152
+ */
153
+ const footerData = reactive([]);
154
+ /**
155
+ * 定义计算公式
156
+ * @type {UnwrapNestedRefs<{}>}
157
+ */
158
+ const formulaMap = reactive({});
159
+ /**
160
+ * 定义合计数据
161
+ * @type {UnwrapNestedRefs<{}>}
162
+ */
163
+ const summaryData = reactive({});
164
+
165
+ /**
166
+ * 查看范围
167
+ * @type 类型
168
+ * @users 用户列表
169
+ */
170
+ const changePower = (type, users) => {
171
+ filterValue.value.power = type;
172
+ if (type == 9) {
173
+ filterValue.value.powerUsers = users;
174
+ }
175
+ filter();
176
+ };
177
+
178
+
179
+ const getCellValue = (rowIndex, name) => {
180
+ return (gridData[rowIndex] && gridData[rowIndex][name]) ? gridData[rowIndex][name] : "";
181
+ };
182
+
183
+ /**
184
+ * 获取关键字描述
185
+ */
186
+ const getKeywordsPlaceholder = computed(() => {
187
+ if (sohelpConfig.value?.filter?.keywords?.length) {
188
+ return t("grid.toolbar.keywords") + ",【" + sohelpConfig.value.filter?.keywords?.filter(key => propertiesMap.value[key]).map(key => t(propertiesMap.value[key].i18n) || propertiesMap.value[key].label).join("/") + "】";
189
+ }
190
+ return t("grid.toolbar.keywords");
191
+ });
192
+
193
+
194
+ /**
195
+ * SohelpTextareaInput弹窗标题
196
+ */
197
+ const getCurrentFieldLabel = computed(() => {
198
+ return (propertiesMap.value[textareaState["field"]]?.label || "") + "修改";
199
+ });
200
+
201
+ const keywordsChange = (val) => {
202
+ filterValue.value = {
203
+ ...filterValue.value,
204
+ keywords: val
205
+ };
206
+ };
207
+
208
+ /**
209
+ * 获取当前筛选
210
+ * @param field
211
+ */
212
+ const getCurrentFilter = (field) => {
213
+ return computed({
214
+ get: () => {
215
+ return filterValue.value.filter?.find(f => f.name === field);
216
+ },
217
+ set: (newValue) => {
218
+ const newFilters = [...(filterValue.value.filter || [])];
219
+ const index = newFilters.findIndex(f => f.name === field);
220
+ if (index >= 0) {
221
+ newFilters[index] = { ...newFilters[index], ...newValue };
222
+ }
223
+ filterValue.value = { ...filterValue.value, filter: newFilters };
224
+ }
225
+ });
226
+ };
227
+
228
+ /**
229
+ *获取外键标签
230
+ */
231
+ const getTableSelectLabel = (val, index, field, column) => {
232
+ if (!gridData[index] || !gridData[index][field]) {
233
+ return "";
234
+ }
235
+ let obj = gridData[index][field];
236
+ if (obj && typeof obj === "object") {
237
+ if (!Array.isArray(obj)) {
238
+ obj = [obj];
239
+ }
240
+ const { labelField = "label", valueField = "id" } = column.editRender;
241
+ const arr = Array.isArray(val) ? val : [val];
242
+ return obj.filter(item => arr.includes(item.id))?.map(row => row[labelField]).filter(Boolean).join(",");
243
+
244
+ } else {
245
+ return "";
246
+ }
247
+ };
248
+
249
+ /**
250
+ * 获取排序数据
251
+ */
252
+ const sortList = computed(() => {
253
+ return sohelpConfig.value.filter?.sort?.map((field) => {
254
+ let p = propertiesMap.value[field];
255
+ return {
256
+ title: p?.label || field,
257
+ field: field
258
+ };
259
+ });
260
+ });
261
+
262
+ /**
263
+ * 排序点击事件
264
+ */
265
+ const sortCommand = (field, order) => {
266
+ if (sohelpVxeGridRef.value) {
267
+ sohelpVxeGridRef.value.setSort({ field, order });
268
+ }
269
+ closeSortDropCard();
270
+ };
271
+
272
+ const isActiveSort = computed(() => {
273
+ return (field, order) => {
274
+ return sortValue.value === field + "!" + order ? "primary" : "";
275
+ };
276
+ });
277
+
278
+ /**
279
+ *
280
+ * @param val 监听高级筛选值变化
281
+ */
282
+ const filterValueChange = (val) => {
283
+ //console.log('v', val);
284
+ };
285
+
286
+ /**
287
+ * 初始化数据
288
+ */
289
+ const loadConfig = (param = {}) => {
290
+ initial(!props.isEntityGrid, props.refid)
291
+ .then((config) => {
292
+ /**配置刷新功能 */
293
+ config.gridOptions = {
294
+ ...config.gridOptions,
295
+ toolbarConfig: {
296
+ ...config.gridOptions?.toolbarConfig,
297
+ refresh: true,
298
+ zoom: true
299
+ },
300
+ proxyConfig: {
301
+ autoLoad: false,
302
+ ajax: {
303
+ query: () => refresh()
304
+ }
305
+ }
306
+ };
307
+
308
+ //工具栏按钮权限
309
+ Object.assign(formulaMap, config.formulaMap);
310
+ Object.assign(gridOptions, config.gridOptions);
311
+ // 过滤位置
312
+ config.sohelpConfig.filter.config._visibleFilter = config.sohelpConfig?.filter.config.visibleFilter || false;
313
+ sohelpConfig.value = { ...config.sohelpConfig };
314
+
315
+ Object.assign(propertiesMap.value, config.propertiesMap);
316
+
317
+ Object.assign(footerData, config.footerData);
318
+ batchButtonsIndex.value = config.batchButtonsIndex;
319
+ sohelpConfig.value.list = config.sohelpConfig.list;
320
+
321
+ if (!filterValue.value.filter) {
322
+ filterValue.value.filter = [];
323
+ }
324
+
325
+ Object.assign(filterValue.value.filter, config.sohelpConfig.filter?.field || []);
326
+ //存储原始查询数据,用于重置
327
+ originFilterValue.value = JSON.stringify(filterValue.value);
328
+
329
+ nextTick(() => {
330
+ if (sohelpVxeGridRef.value && props.autoLoad === true) {
331
+ sohelpVxeGridRef.value.commitProxy("query");
332
+ }
333
+ });
334
+ })
335
+ .catch((e) => {
336
+ console.error("Initial Configuration Error:", e);
337
+ EleMessage.error(e.message);
338
+ });
339
+ };
340
+
341
+
342
+ const gridValue = ref();
343
+
344
+
345
+ const load = async (params = {}, callback) => {
346
+ //清空选中
347
+ selections.value = [];
348
+ gridOptions.loading = true;
349
+ gridOptions.params = params;
350
+ await isConfigDone();
351
+ const $grid = sohelpVxeGridRef.value;
352
+ if ($grid) {
353
+ const url = props.url || sohelpConfig.value.requestValue;
354
+ if (sohelpConfig.value.requestType != "crud" && !url) {
355
+ gridOptions.loading = false;
356
+ return { results: [], total: 0 };
357
+ }
358
+
359
+ let pageConfig = {};
360
+ // 是否分页
361
+ if (gridOptions.pagerConfig?.enabled) {
362
+ pageConfig.page = gridOptions.pagerConfig?.currentPage ?? 1;
363
+ pageConfig.limit = gridOptions.pagerConfig?.pageSize ?? 50;
364
+ }
365
+
366
+ //过滤条件筛选
367
+ params["filter"] = filterValue.value.filter?.filter(item => (item.comparison === "EMPTY" || item.comparison === "NOT_EMPTY") || item.value?.length > 0);
368
+ const res = await SohelpHttp.get(url, {
369
+ refid: props.refid,
370
+ ...filterValue.value,
371
+ ...params,
372
+ ...pageConfig
373
+ });
374
+
375
+
376
+ if (res?.meta?.success) {
377
+ if (res.data) {
378
+ gridOptions.pagerConfig.total = Number(res.data.total);
379
+ Object.assign(gridData, JSON.parse(JSON.stringify(res.data.results)));
380
+ gridValue.value = switchGridValue(res.data.results);
381
+ $grid.loadData(gridValue.value);
382
+ Object.assign(summaryData, res.data?.summary || {});
383
+ updateColumnsFilter();
384
+ gridOptions.loading = false;
385
+ //统计
386
+ if (footerData.length > 0) {
387
+ gridOptions.footerData = updateSummary(res.data.results, res.data?.summary || {});
388
+ $grid?.refreshColumn();
389
+ }
390
+ }
391
+ } else {
392
+ EleMessage.error(res.meta.message);
393
+ }
394
+ gridOptions.loading = false;
395
+ //回调方法
396
+ if (callback && typeof callback === "function") {
397
+ callback(res);
398
+ }
399
+ }
400
+ };
401
+
402
+ /**
403
+ * 重新加载数据
404
+ */
405
+ const reload = async (params = {}) => {
406
+ Object.assign(gridOptions.params, params);
407
+ load(gridOptions.params);
408
+ };
409
+
410
+
411
+ /**
412
+ * 单元格点击更新 表尾统计
413
+ */
414
+ const cellClick = () => {
415
+ const data = sohelpVxeGridRef.value?.getFullData();
416
+ gridOptions.footerData = updateSummary(data, summaryData);
417
+ };
418
+
419
+ /**
420
+ * 统计
421
+ */
422
+ const updateSummary = (data, summaryMap = {}) => {
423
+ const arr = footerData.map(item => {
424
+ const field = data.map(f => {
425
+ let val = Number(f[item.field]);
426
+ return isNaN(val) ? 0 : val;
427
+ });
428
+
429
+ let value = calcSummary(field, item.type);
430
+ if (item.type === "remotesum") {
431
+ value = summaryMap[item.field] || "";
432
+ }
433
+
434
+ if (item.summaryRender) {
435
+ try {
436
+ const func = new Function("return " + item.summaryRender)();
437
+ value = func.call(sohelpVxeGridRef, value);
438
+ } catch (e) {
439
+ console.error("函数执行错误:", e);
440
+ }
441
+ }
442
+
443
+ return {
444
+ [item.field]: value
445
+ };
446
+ });
447
+
448
+ arr.unshift({ _seq: "统计" });
449
+ return [Object.assign({}, ...arr)];
450
+ };
451
+
452
+
453
+ /**
454
+ * 分页事件
455
+ */
456
+ const pageChangeEvent = (page) => {
457
+ isPage.value = true;
458
+ gridOptions.pagerConfig.currentPage = page.currentPage;
459
+ gridOptions.pagerConfig.pageSize = page.pageSize;
460
+ reload();
461
+ };
462
+
463
+
464
+ /**
465
+ * 获取Common类型操作栏 并根据flw_id判断是否显示
466
+ * @param row
467
+ */
468
+ const getOperationButtonsByType = (row, type = "common") => {
469
+ let common = getOperationToolbars.value?.[type] || [];
470
+ if (common.length > 0) {
471
+ if (row.hasOwnProperty("flw_id")) {
472
+ const field = row.flw_id === "0" ? "workflow.view" : "workflow.submit";
473
+ common = common.filter(f => f.code != field);
474
+ } else {
475
+ common = common.filter(f => (f.code != "workflow.submit" || f.code != "workflow.view"));
476
+ }
477
+ return common;
478
+ }
479
+ return [];
480
+ };
481
+
482
+ /**
483
+ * 获取操作栏
484
+ */
485
+ const getOperationToolbars = computed(() => {
486
+ const buttonsMap = {};
487
+ sohelpConfig.value.operationToolbars?.filter(f => !f.authority || permission.hasPermission(f.authority)).map(button => {
488
+ const type = button.buttonType || "common";
489
+ const code = button.type === "custom" ? button.id : button.type;
490
+ if (!buttonsMap[type]) {
491
+ buttonsMap[type] = [];
492
+ }
493
+ const title = (button.type === "custom") ? button.title : t("grid.toolbar." + button.type?.replaceAll(".", "-"));
494
+ let params = button.params || {};
495
+ if (button.params && typeof button.params === "string") {
496
+ try {
497
+ params = JSON.parse(button.params);
498
+ } catch (e) {
499
+ params = {};
500
+ EleMessage.error("button.params配置JSON参数格式错误");
501
+ }
502
+ }
503
+ buttonsMap[type].push({
504
+ title: title || button.title,
505
+ "id": button.id,
506
+ code: code,
507
+ handler: button.handler,
508
+ icon: button.iconCls,
509
+ params: params,
510
+ refid: button.refid,
511
+ openType: button.openType
512
+ });
513
+ });
514
+ return buttonsMap;
515
+ });
516
+
517
+
518
+ /**
519
+ * 行操作栏点击事件
520
+ * @param row
521
+ * @param item
522
+ */
523
+ const operationHandler = ({ item, row, $grid }) => {
524
+ //操作栏事件执行
525
+ if (item.handler && typeof item.handler === "string") {
526
+ try {
527
+ const func = new Function("row", "$grid", `return (async () => { ${item.handler} })()`);
528
+ (async () => {
529
+ const context = {
530
+ $message: EleMessage,
531
+ $SohelpModule: window.$SohelpModule,
532
+ $SohelpHttp: window.$SohelpHttp,
533
+ $confirm: (title, callback) => {
534
+ ElMessageBox.confirm(title, "提示", {
535
+ confirmButtonText: "确定",
536
+ cancelButtonText: "取消",
537
+ type: "warning"
538
+ }).then(() => {
539
+ callback && callback();
540
+ }).catch(() => {
541
+ });
542
+ }
543
+ };
544
+ await func.call(context, row, $grid); // 显式传递所有参数
545
+ })();
546
+ } catch (e) {
547
+ EleMessage.error(`操作栏事件出错:${e.message}`);
548
+ }
549
+ } else if (item.refid) {
550
+ if (item.openType === "tab") {
551
+ window.$SohelpModule.openTab(item.refid, { id: row.id }, item.params || {});
552
+ } else if (item.openType === "drawer") {
553
+ console.error("item", item.params);
554
+ window.$SohelpModule.openDrawer(item.refid, { id: row.id }, item.params || {});
555
+ } else {
556
+ window.$SohelpModule.openModal(item.refid, { id: row.id }, item.params || {});
557
+ }
558
+ } else {
559
+ switch (item.code) {
560
+ case "crud.edit":
561
+ visibleEntityForm.value = true;
562
+ toolbarButtonParams.value = item.params || {};
563
+ if (!toolbarButtonParams.value["title"]) {
564
+ toolbarButtonParams.value["title"] = t("grid.toolbar.edit");
565
+ }
566
+ loading.value = true;
567
+ CrudHttp.detail(props.refid, { id: row.id }).then(res => {
568
+ if (res.meta.success) {
569
+ setTimeout(() => {
570
+ entityFormRef.value.setFormData(res.data);
571
+ }, 10);
572
+ } else {
573
+ EleMessage.error(res.meta.message);
574
+ }
575
+ loading.value = false;
576
+ }).catch(e => {
577
+ loading.value = false;
578
+ });
579
+
580
+ break;
581
+ case "crud.view":
582
+ visibleEntityForm.value = true;
583
+ toolbarButtonParams.value = item.params || {};
584
+ if (!toolbarButtonParams.value["title"]) {
585
+ toolbarButtonParams.value["title"] = t("grid.toolbar.view");
586
+ }
587
+ toolbarButtonParams.value["readonly"] = true;
588
+ CrudHttp.detail(props.refid, { id: row.id }, (res) => {
589
+ if (res.meta.success) {
590
+ setTimeout(() => {
591
+ entityFormRef.value.setFormData(res.data);
592
+ }, 10);
593
+ } else {
594
+ EleMessage.error(res.meta.message);
595
+ }
596
+ });
597
+ break;
598
+ case "crud.delete" :
599
+ remove({ id: [row.id] });
600
+ break;
601
+ case "workflow.submit":
602
+ submitWorkflow({ id: [row.id] });
603
+ break;
604
+ case "workflow.view" :
605
+ viewWorkflow(row.id);
606
+ break;
607
+ case "report.print" :
608
+ visibleReport.value = true;
609
+ currentRow.value = row;
610
+ loadReport();
611
+ break;
612
+ default:
613
+ break;
614
+ }
615
+ }
616
+ emit("operationButtonClick", { item, row, $grid });
617
+ };
618
+
619
+ /**
620
+ * 获取表格数据
621
+ */
622
+ const getTableData = () => {
623
+ return sohelpVxeGridRef.value?.getTableData();
624
+ };
625
+
626
+ /**
627
+ * 获取处理过的数据
628
+ */
629
+ const getData = () => {
630
+ const { tableData } = getTableData();
631
+ return tableData;
632
+ };
633
+
634
+ /**
635
+ * 更新
636
+ */
637
+ const updateValue = () => {
638
+ emit("update:modelValue", getData());
639
+ emit("change", getData());
640
+ };
641
+ /**
642
+ * 指定index位置插入数据
643
+ * @param data
644
+ * @param index
645
+ */
646
+ const insertField = (data, index = -1) => {
647
+ if (sohelpVxeGridRef.value) {
648
+ sohelpVxeGridRef.value.insertAt(data, index);
649
+ sohelpVxeGridRef.value.clearEdit();
650
+ }
651
+ updateValue();
652
+ };
653
+
654
+
655
+ /**
656
+ * 刷新列表
657
+ */
658
+ const refresh = () => {
659
+ if (!isPage.value) {
660
+ if (gridOptions.pagerConfig && gridOptions.pagerConfig.enabled) {
661
+ gridOptions.pagerConfig.currentPage = 1;
662
+ }
663
+ emit("refresh");
664
+ }
665
+ isPage.value = false;
666
+ reload({ ...gridOptions.params });
667
+ };
668
+
669
+ /**
670
+ * 列表头右键菜单事件
671
+ * @param column
672
+ */
673
+ const headerCellMenu = ({ column }) => {
674
+ if (column.editRender?.edit && gridOptions.menuConfig.header.options.length > 0) {
675
+ // 只对特定类型的列显示菜单项
676
+ const visible = column && (column.type === "SohelpSwitch" || column.type === "SohelpCheckbox");
677
+ // 设置每个菜单项的可见性
678
+ gridOptions.menuConfig.header.options[0].forEach(item => {
679
+ item.visible = visible;
680
+ });
681
+ }
682
+ };
683
+
684
+ /**
685
+ * 右键菜单点击事件
686
+ * @param menu 菜单项
687
+ * @param row 行数据
688
+ * @param column 列配置
689
+ * @param rowIndex 行索引
690
+ */
691
+ const menuRightClick = async ({ menu, row, column, rowIndex }) => {
692
+ const $grid = sohelpVxeGridRef.value;
693
+ if ($grid) {
694
+ $grid.setCurrentRow(row);
695
+ const { fullData } = $grid.getTableData();
696
+ switch (menu.code) {
697
+ case "insert":
698
+ await $grid.insertAt({ role_name: "sales user" }, rowIndex);
699
+ break;
700
+ case "all-select":
701
+ fullData.forEach(row => {
702
+ row[column.field] = ["0", 0, "1", 1].includes(row[column.field]) ? 1 : true;
703
+ });
704
+ break;
705
+ case "revert-select":
706
+ fullData.forEach(row => {
707
+ if (["0", 0, "1", 1].includes(row[column.field])) {
708
+ row[column.field] = 1 - row[column.field];
709
+ } else {
710
+ row[column.field] = !row[column.field];
711
+ }
712
+ });
713
+ break;
714
+ default:
715
+ break;
716
+ }
717
+ }
718
+
719
+ // 执行右击事件
720
+ emit("menuRightClick", { menu, row, column, rowIndex });
721
+ };
722
+
723
+ const sohelpSortRef = ref(null);
724
+ const closeSortDropCard = () => {
725
+ if (sohelpSortRef.value) {
726
+ sohelpSortRef.value.close();
727
+ }
728
+ };
729
+
730
+ /**
731
+ * 获取用户数据源
732
+ */
733
+ const userDatasource = computed(async () => {
734
+ return await SohelpHttp.get("/engine/web/user/list")
735
+ .then((res) => {
736
+ if (res.data) {
737
+ return [...res.data];
738
+ }
739
+ })
740
+ .catch((err) => {
741
+ EleMessage.error(err.message || "error");
742
+ });
743
+ });
744
+
745
+ /**
746
+ * SohelpTextareaInput 弹窗
747
+ */
748
+ const [textareaState, resetTextareaState, setTextareaState] = useFormData({
749
+ visible: false,
750
+ value: "",
751
+ row: null,
752
+ field: ""
753
+ });
754
+
755
+ /**
756
+ * 显示 SohelpTextareaInput 弹窗
757
+ */
758
+ const showTextareaModal = (column, field, row) => {
759
+ if (column?.editRender?.enabled) {
760
+ setTextareaState({
761
+ visible: true,
762
+ value: row[field],
763
+ row,
764
+ field
765
+ });
766
+ }
767
+ };
768
+
769
+ /**
770
+ * 取消 SohelpTextareaInput 弹窗
771
+ */
772
+ const textareaCancel = () => {
773
+ resetTextareaState();
774
+ };
775
+
776
+ /**
777
+ * checkbox复选框
778
+ */
779
+ const onCheckboxChange = () => {
780
+ selections.value = sohelpVxeGridRef.value?.getCheckboxRecords() || [];
781
+ emit("checkbox-change", selections.value);
782
+ };
783
+
784
+
785
+ /**
786
+ * 确定 SohelpTextareaInput 弹窗
787
+ */
788
+ const textareaConfirm = () => {
789
+ const $grid = sohelpVxeGridRef.value;
790
+ if ($grid) {
791
+ $grid.setRow(textareaState.row, {
792
+ ...textareaState.row,
793
+ [textareaState.field]: textareaState.value
794
+ });
795
+ }
796
+ textareaCancel();
797
+ };
798
+
799
+ /**
800
+ * 获取组织数据源
801
+ */
802
+ const orgDatasource = computed(async () => {
803
+ return await SohelpHttp.get("/engine/web/org/list")
804
+ .then((res) => {
805
+ if (res.data) {
806
+ return [...res.data];
807
+ }
808
+ })
809
+ .catch((err) => {
810
+ EleMessage.error(err.message || "error");
811
+ });
812
+ });
813
+ /**
814
+ * 根据引擎表格获取更新数据
815
+ * @returns {{inserted: {}, deleted: {}, updated: {}}}
816
+ */
817
+ const getCrudUpdater = () => {
818
+ const $grid = sohelpVxeGridRef.value;
819
+ return {
820
+ "inserted": $grid?.getInsertRecords().map(item => {
821
+ return { ...item };
822
+ }) || [],
823
+ "updated": $grid?.getUpdateRecords(),
824
+ "deleted": $grid?.getRemoveRecords().map(item => item.id) || []
825
+ };
826
+ };
827
+
828
+ /**
829
+ * 删除记录
830
+ */
831
+ const remove = (params) => {
832
+ ElMessageBox.confirm("确定要删除吗?", "提示").then(() => {
833
+ CrudHttp.delete(props.refid, params, (res) => {
834
+ if (res.meta.success) {
835
+ EleMessage.success(res.meta.message);
836
+ refresh();
837
+ } else {
838
+ EleMessage.error(res.meta.message);
839
+ }
840
+ });
841
+ }).catch(() => {
842
+ });
843
+ };
844
+
845
+ /**
846
+ *
847
+ * @param handler
848
+ */
849
+ const executeToolbarCustomHandler = (button) => {
850
+ const $grid = sohelpVxeGridRef.value;
851
+ try {
852
+ let isRows = button.code.includes("batch.");
853
+ const func = new Function(isRows ? "rows" : "row", "$grid", `return (async () => { ${button.handler} })()`);
854
+ (async () => {
855
+ const context = {
856
+ $message: EleMessage,
857
+ $confirm: (title, callback) => {
858
+ ElMessageBox.confirm(title, "提示", {
859
+ confirmButtonText: "确定",
860
+ cancelButtonText: "取消",
861
+ type: "warning"
862
+ }).then(() => {
863
+ callback && callback();
864
+ }).catch(() => {
865
+ });
866
+ },
867
+ $grid: $grid,
868
+ getCrudUpdater: getCrudUpdater
869
+ };
870
+ $grid.refresh = refresh;
871
+ await func.call(context, isRows ? selections.value : current, $grid); // 显式传递所有参数
872
+ })();
873
+ } catch (e) {
874
+ EleMessage.error(`${e.message}`);
875
+ }
876
+ };
877
+ /**
878
+ * 工具栏点击事件
879
+ * @param param0
880
+ */
881
+ const toolbarClick = async ({ button }) => {
882
+ const $grid = sohelpVxeGridRef.value;
883
+ let rowIndex = -1;
884
+ const row = {};
885
+
886
+
887
+ const current = $grid?.getCurrentRecord();
888
+ if (current) {
889
+ rowIndex = $grid?.getVTRowIndex(current);
890
+ }
891
+
892
+ //工具栏事件执行
893
+ if (button?.handler) {
894
+ executeToolbarCustomHandler(button);
895
+ } else if (button.refid) {
896
+ if (button.openType === "tab") {
897
+ window.$SohelpModule.openTab(button.refid, {}, button.params || {});
898
+ } else if (button.openType === "drawer") {
899
+ window.$SohelpModule.openDrawer(button.refid, {}, button.params || {});
900
+ } else {
901
+ window.$SohelpModule.openModal(button.refid, {}, button.params || {});
902
+ }
903
+ } else {
904
+ switch (button.code) {
905
+ case "row.add":
906
+ insertField(row, -1);
907
+ break;
908
+ case "row.copy":
909
+ if (current) {
910
+ Object.assign(row, { ...current });
911
+ if (row?.name) {
912
+ row.name = "";
913
+ }
914
+ delete row._X_ROW_KEY;
915
+ }
916
+ break;
917
+ case "row.insert":
918
+ rowIndex = getData()?.length > 0 ? rowIndex : -1;
919
+ insertField(row, rowIndex);
920
+ break;
921
+ case "row.delete":
922
+ $grid.removeCheckboxRow();
923
+ break;
924
+ case "crud.create":
925
+ visibleEntityForm.value = true;
926
+ toolbarButtonParams.value = button.params || {};
927
+ if (!toolbarButtonParams.value["title"]) {
928
+ toolbarButtonParams.value["title"] = t("grid.toolbar.create");
929
+ }
930
+ CrudHttp.initial(props.refid, { id: row.id }, (res) => {
931
+ if (res.meta.success) {
932
+ setTimeout(() => {
933
+ entityFormRef.value.setFormData(res.data);
934
+ }, 10);
935
+ } else {
936
+ EleMessage.error(res.meta.message);
937
+ }
938
+ });
939
+ break;
940
+ case "crud.save":
941
+ CrudHttp.save(props.refid, { "default": getCrudUpdater() }, (res) => {
942
+ if (res.meta.success) {
943
+ EleMessage.success(res.meta.message);
944
+ refresh();
945
+ } else {
946
+ EleMessage.error(res.meta.message);
947
+ }
948
+ });
949
+ break;
950
+ case "crud.view":
951
+ break;
952
+ case "crud.delete":
953
+ remove({ id: selections.value.map(item => item.id) });
954
+ break;
955
+ case "workflow.submit":
956
+ submitWorkflow({ id: selections.value.map(item => item.id) });
957
+ break;
958
+ case "report.print":
959
+ break;
960
+ case "batch.import":
961
+ break;
962
+ case "batch.delete":
963
+ break;
964
+ case "batch.export":
965
+ break;
966
+ case "batch.print":
967
+ break;
968
+ default:
969
+ break;
970
+ }
971
+
972
+ }
973
+ };
974
+
975
+ /**
976
+ * grid事件
977
+ * 排序
978
+ */
979
+ const gridEvents = {
980
+ sortChange({ field = "", order = "" }) {
981
+ if (!order) {
982
+ field = order = "";
983
+ }
984
+ sortValue.value = field + "!" + order;
985
+ filterValue.value.sort = field;
986
+ filterValue.value.order = order;
987
+ filter({});
988
+ },
989
+
990
+ toolbarButtonClick(config) {
991
+ toolbarClick(config);
992
+ emit("toolbarButtonClick", config);
993
+ }
994
+
995
+ };
996
+
997
+ /**
998
+ * 查询
999
+ * param type:'filter' | 'column', default(filter) 区分是高级筛选,还是列筛选
1000
+ */
1001
+ const filter = (param = {}) => {
1002
+ gridOptions.pagerConfig.currentPage = 1;
1003
+ reload();
1004
+ };
1005
+
1006
+
1007
+ /**
1008
+ * 重置
1009
+ */
1010
+ const resetFilter = () => {
1011
+ filterValue.value = JSON.parse(originFilterValue.value);
1012
+ //重置列筛选
1013
+ if (sohelpVxeGridRef.value) {
1014
+ sohelpVxeGridRef.value.clearFilter();
1015
+ }
1016
+ filter();
1017
+ };
1018
+
1019
+ /**
1020
+ * 筛选弹窗
1021
+ */
1022
+ const showFilter = () => {
1023
+ if (sohelpConfig.value.filter?.config.filterPosition === "NONE") {
1024
+ sohelpConfig.value.filter.config.filterPosition = "TOP";
1025
+ sohelpConfig.value.filter.config.visibleFilter = false;
1026
+ }
1027
+ emit("showFilter", sohelpConfig.value.filter.config.filterPosition);
1028
+ };
1029
+
1030
+
1031
+ /**
1032
+ * 打开提交工作流界面
1033
+ */
1034
+ const submitWorkflow = (ids) => {
1035
+ approvalData.value = {
1036
+ refid: props.refid,
1037
+ ...ids
1038
+ };
1039
+ approvalModalVisible.value = true;
1040
+ };
1041
+
1042
+ /**
1043
+ * 查看工作流
1044
+ * @param row
1045
+ */
1046
+ const viewWorkflow = (id) => {
1047
+ drawerData.value = {
1048
+ id: id,
1049
+ refid: props.refid
1050
+ };
1051
+ drawerVisible.value = true;
1052
+ };
1053
+
1054
+ /**
1055
+ * 筛选
1056
+ */
1057
+ const changeNameFilter = (option, val, column) => {
1058
+ console.log("option", option, val, column);
1059
+ const $grid = sohelpVxeGridRef.value;
1060
+ if ($grid) {
1061
+ $grid.setFilter(column.field, [{
1062
+ data: val?.value || "",
1063
+ value: val.value || "",
1064
+ checked: true
1065
+ }]);
1066
+ $grid.updateFilterOptionStatus(option, true);
1067
+ }
1068
+ };
1069
+
1070
+ const filterVisible = ({ column, field, visible }) => {
1071
+ if (visible) {
1072
+ const hasField = filterValue.value.filter?.find(f => f.name === field);
1073
+ if (!hasField) {
1074
+ filterValue.value.filter = [...filterValue.value.filter, {
1075
+ comparison: "LIKE",
1076
+ name: field,
1077
+ value: ""
1078
+ }];
1079
+ }
1080
+ const $grid = sohelpVxeGridRef.value;
1081
+ if ($grid) {
1082
+ $grid.setFilter(field, [{
1083
+ data: "",
1084
+ value: "",
1085
+ checked: true
1086
+ }]);
1087
+ }
1088
+
1089
+ // $grid.updateFilterOptionStatus({
1090
+ // label: field,
1091
+ // value: "123",
1092
+ // data: 456
1093
+ // }, true);
1094
+
1095
+
1096
+ }
1097
+ };
1098
+
1099
+ /**
1100
+ *列筛选
1101
+ */
1102
+ const handleFilterChange = ({ field, datas }) => {
1103
+ filter();
1104
+ //重置功能 重置要清空filterValue.filter对象的项
1105
+ if (!datas?.length) {
1106
+ const map = new Map(filterValue.value.filter?.map(item => [item.name, item]));
1107
+ if (map.get(field)) {
1108
+ map.get(field).value = "";
1109
+ }
1110
+ }
1111
+ };
1112
+
1113
+ /**
1114
+ * 过滤掉对象中_开头的属性 _sqe、_checkbox、_operation
1115
+ * @param obj
1116
+ */
1117
+ const filterUnderscoreProps = (obj = {}) => {
1118
+ if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
1119
+ return {};
1120
+ }
1121
+ return Object.entries(obj).reduce((acc, [key, value]) => {
1122
+ const filterKey = ["_checkbox", "_seq"];
1123
+ if (!filterKey.includes(key)) {
1124
+ acc[key] = typeof value === "object" ? filterUnderscoreProps(value) : value;
1125
+ }
1126
+ return acc;
1127
+ }, {});
1128
+ };
1129
+
1130
+
1131
+ /**
1132
+ * 根据 obj 对象的值修改 properties 数组中对应项的指定属性
1133
+ * @param {Object} obj
1134
+ * @param {Array} properties
1135
+ * @param {string} key
1136
+ */
1137
+ const updateProperties = (obj, properties, key, propertiesMap) => {
1138
+ if (!obj || Object.keys(obj).length === 0) return;
1139
+ const map = propertiesMap || new Map(properties.map((item, index) => [item.name, index]));
1140
+ Object.entries(obj).forEach(([name, value]) => {
1141
+ const index = map.get(name);
1142
+ if (index !== undefined && properties[index]) {
1143
+ properties[index][key] = value;
1144
+ //fixed
1145
+ if (key === "lockAlign") {
1146
+ properties[index]["lock"] = value ? true : false;
1147
+ }
1148
+ }
1149
+ });
1150
+ };
1151
+
1152
+
1153
+ /**
1154
+ * 属性根据sortData排序
1155
+ * @param {Array} properties
1156
+ * @param {Object} sortData
1157
+ */
1158
+ const sortPropertiesInPlace = (properties, sortData) => {
1159
+ const sortOrder = {};
1160
+ Object.entries(sortData)
1161
+ .sort((a, b) => a[1] - b[1])
1162
+ .forEach(([key], index) => {
1163
+ sortOrder[key] = index;
1164
+ });
1165
+
1166
+ properties.sort((a, b) => {
1167
+ const aOrder = sortOrder[a.name];
1168
+ const bOrder = sortOrder[b.name];
1169
+
1170
+ if (aOrder !== undefined && bOrder !== undefined) {
1171
+ return aOrder - bOrder;
1172
+ }
1173
+ if (aOrder !== undefined) return -1;
1174
+ if (bOrder !== undefined) return 1;
1175
+ return 0;
1176
+ });
1177
+ };
1178
+
1179
+ /**
1180
+ * 列设置操作
1181
+ */
1182
+ const handleCustom = async ({ type, $grid }) => {
1183
+ // 恢复默认
1184
+ if (type === "reset") {
1185
+ const loading = EleMessage.loading("恢复默认中..");
1186
+ const message = await resetCommonConfig({ refid: props.refid }).catch(err => {
1187
+ EleMessage.error(err.message);
1188
+ loading.close();
1189
+ });
1190
+ if (message) {
1191
+ EleMessage.success(message);
1192
+ }
1193
+ loading.close();
1194
+ }
1195
+
1196
+ //确认
1197
+ if (type === "confirm") {
1198
+ //获取当前列配置
1199
+ const { sortData, ...columnsData } = filterUnderscoreProps($grid?.getCustomStoreData());
1200
+ const properties = JSON.parse(JSON.stringify([...sohelpConfig.value.properties])).map(item => {
1201
+ return {
1202
+ ...item,
1203
+ list: sohelpConfig.value.list.includes(item.name)
1204
+ };
1205
+ });
1206
+
1207
+ const propertiesMap = new Map(properties.map((item, index) => [item.name, index]));
1208
+
1209
+
1210
+ //修改对应的field
1211
+ const fieldMapping = {
1212
+ fixedData: "lockAlign",
1213
+ resizableData: "width",
1214
+ visibleData: "list"
1215
+ };
1216
+ // 修改属性
1217
+ Object.entries(columnsData).forEach(([key, value]) => {
1218
+ updateProperties(value, properties, fieldMapping[key], propertiesMap);
1219
+ });
1220
+ //根据sortData排序
1221
+ sortPropertiesInPlace(properties, sortData);
1222
+ const loading = EleMessage.loading("保存配置中..");
1223
+
1224
+ const message = await updateCommonConfig({
1225
+ refid: props.refid,
1226
+ properties: properties.map(item => {
1227
+ return {
1228
+ name: item.name,
1229
+ width: item.width,
1230
+ list: item.list,
1231
+ lockAlign: item.lockAlign,
1232
+ lock: item.lock
1233
+ };
1234
+ })
1235
+ }).catch(err => {
1236
+ EleMessage.error(err.message);
1237
+ loading.close();
1238
+ });
1239
+ if (message) {
1240
+ EleMessage.success(message);
1241
+ }
1242
+
1243
+ localStorage.setItem("VXE_CUSTOM_STORE", "");
1244
+ loading.close();
1245
+ }
1246
+ };
1247
+
1248
+
1249
+ /**
1250
+ * 更新columns过滤状态
1251
+ */
1252
+ const updateColumnsFilter = () => {
1253
+ const $grid = sohelpVxeGridRef.value;
1254
+ if ($grid && filterValue.value.filter?.length) {
1255
+ filterValue.value.filter?.forEach((item) => {
1256
+ $grid.setFilter(item.name, [
1257
+ {
1258
+ checked: item.value?.length > 0
1259
+ }
1260
+ ]);
1261
+ });
1262
+ }
1263
+ };
1264
+
1265
+
1266
+ /**
1267
+ * 计算公式
1268
+ * @param row
1269
+ * @param column
1270
+ */
1271
+ const editClosed = (props) => {
1272
+ const { row, column } = props;
1273
+ Object.entries(formulaMap).forEach(([key, value]) => {
1274
+ try {
1275
+ const formulaValue = formulaMap[key]["formulaValue"];
1276
+ if (formulaValue.indexOf(column.field) > 0) {
1277
+ const str = formulaValue.replace(/\s+/g, "")
1278
+ .replace(/\${/g, "row.")
1279
+ .replace(/}/g, "");
1280
+ const v = new Function("row", `return ${str}`)(row);
1281
+ if (!Number.isNaN(v)) {
1282
+ row[key] = v;
1283
+ }
1284
+ }
1285
+ } catch (e) {
1286
+ console.error("计算公式错误:", e);
1287
+ EleMessage.error("计算公式错误:", e.message);
1288
+ }
1289
+ nextTick(() => {
1290
+ if (row[column.property] && row[column.property].toString().trim() !== "") {
1291
+ sohelpVxeGridRef.value?.clearValidate([column.property]);
1292
+ }
1293
+ });
1294
+ });
1295
+ emit("editClosed", props);
1296
+ };
1297
+
1298
+ const validate = async () => {
1299
+ const $grid = sohelpVxeGridRef.value;
1300
+ if ($grid) {
1301
+ const errMap = await $grid.fullValidate(true);
1302
+ return errMap || false;
1303
+ }
1304
+ };
1305
+
1306
+ const currentColumnChange = (props) => {
1307
+ emit("currentColumnChange", props);
1308
+ };
1309
+
1310
+ /**
1311
+ * 监听是否被选中,更新工具栏批量操作
1312
+ */
1313
+ watch(
1314
+ () => selections.value,
1315
+ (val) => {
1316
+ const isDisabled = val.length < 1;
1317
+ if (batchButtonsIndex.value?.length > 0) {
1318
+ batchButtonsIndex.value.forEach(idx => {
1319
+ gridOptions.toolbarConfig.buttons[idx].disabled = isDisabled;
1320
+ });
1321
+ }
1322
+ }
1323
+ );
1324
+
1325
+ watch(
1326
+ () => props.refid, (refid) => {
1327
+ //加载列表配置
1328
+ loadConfig();
1329
+ }, {
1330
+ immediate: true
1331
+ });
1332
+
1333
+ defineExpose({
1334
+ getData,
1335
+ getCrudUpdater,
1336
+ resetFilter,
1337
+ refresh,
1338
+ loadConfig,
1339
+ reload,
1340
+ load,
1341
+ validate,
1342
+ selections
1343
+ });
1344
+ </script>
1345
+
1346
+ <template>
1347
+ <vxe-grid
1348
+ v-bind="gridOptions"
1349
+ ref="sohelpVxeGridRef"
1350
+ @menuClick="menuRightClick"
1351
+ @checkboxChange="onCheckboxChange"
1352
+ @checkboxAll="onCheckboxChange"
1353
+ class="sohelp-grid-view"
1354
+ id="sohelp-grid"
1355
+ v-on="gridEvents"
1356
+ @filter-change="handleFilterChange"
1357
+ @custom="handleCustom"
1358
+ @cellClick="cellClick"
1359
+ @editClosed="editClosed"
1360
+ @header-cell-menu="headerCellMenu"
1361
+ :key="sohelpConfig.uuid"
1362
+ :keep-source="true"
1363
+ @currentColumnChange="currentColumnChange"
1364
+ @filter-visible="filterVisible"
1365
+ >
1366
+ <!--定义国际化I18n-->
1367
+ <template
1368
+ v-for="item in sohelpConfig?.properties?.map(item => item)"
1369
+ v-slot:[`header_${item.name}`]="{ column, rowIndex }"
1370
+ :key="item.name"
1371
+ >
1372
+ {{ item.i18n ? t(item.i18n) : item.label }}
1373
+ </template>
1374
+
1375
+ <!--自定义定义分页--->
1376
+ <template #pager>
1377
+ <vxe-pager
1378
+ v-if="gridOptions.pagerConfig.enabled"
1379
+ v-model:currentPage="gridOptions.pagerConfig.currentPage"
1380
+ v-model:pageSize="gridOptions.pagerConfig.pageSize"
1381
+ :total="gridOptions.pagerConfig.total"
1382
+ @page-change="pageChangeEvent">
1383
+ </vxe-pager>
1384
+ </template>
1385
+
1386
+ <!-- 高级筛选 -->
1387
+ <template v-for="field in Object.values(propertiesMap).filter(item => item.query)" :key="field.name"
1388
+ #[`filter_${field.name}`]="{ column }">
1389
+ <div v-for="(option, index) in column.filters" :key="index" class="condition-box">
1390
+ <filter-condition-item
1391
+ :key="field.name"
1392
+ v-model="getCurrentFilter(field.name).value"
1393
+ :properties="propertiesMap[field.name]"
1394
+ :teleported="false"
1395
+ />
1396
+ </div>
1397
+ </template>
1398
+
1399
+ <!-- 工具栏 -->
1400
+ <template #toolbarTools>
1401
+ <div class="toolbar-box">
1402
+ <!-- 查看范围 -->
1403
+ <div class="power-box">
1404
+ <sohelp-power @change="changePower" v-if="sohelpConfig?.filter?.config?.visibleDataRange"></sohelp-power>
1405
+ </div>
1406
+
1407
+ <div class="search-box" v-if="sohelpConfig?.filter?.config?.visibleKeywords">
1408
+ <!-- 关键字 -->
1409
+ <ele-tooltip :content="getKeywordsPlaceholder" placement="top" :offset="3">
1410
+ <sohelp-input :model-value="filterValue.keywords" @update:model-value="keywordsChange"
1411
+ :placeholder="getKeywordsPlaceholder" clearable
1412
+ @keyup.enter="filter" size="small" style="width: 160px;">
1413
+ <template #append>
1414
+ <el-button :icon="Search" @click="filter" size="small" />
1415
+ </template>
1416
+ </sohelp-input>
1417
+ </ele-tooltip>
1418
+ <el-button size="small" @click="resetFilter">{{ t("grid.toolbar.reset") }}</el-button>
1419
+ </div>
1420
+
1421
+ <div class="tools-btns">
1422
+ <sohelp-drop-card :title="t('grid.toolbar.sort')" :icon="Sort" ref="sohelpSortRef"
1423
+ v-if="sohelpConfig?.filter?.config?.visibleSort && sortList.length > 0">
1424
+ <div class="sort-list">
1425
+ <ele-card v-for="item in sortList" :key="item.title" :header="item.title"
1426
+ :bodyStyle="{padding: '0'}"
1427
+ :headerStyle="{fontSize: '14px', fontWeight: 'normal', padding: '5px 0'}">
1428
+ <template #extra>
1429
+ <ele-text :icon="SortUp" style="cursor: pointer;" :underline="false" size="sm"
1430
+ @click="sortCommand(item.field,'asc')" plain :type="isActiveSort(item.field,'asc')">
1431
+ t("grid.toolbar.asc")
1432
+ </ele-text>
1433
+ <ele-text :icon="SortDown" style="cursor: pointer;margin-left:5px!important" :underline="false"
1434
+ size="sm" @click="sortCommand(item.field,'desc')" plain
1435
+ :type="isActiveSort(item.field,'desc')">t("grid.toolbar.desc")
1436
+ </ele-text>
1437
+ </template>
1438
+ </ele-card>
1439
+ </div>
1440
+ </sohelp-drop-card>
1441
+ <el-button :icon="Filter" size="small" @click="showFilter()"
1442
+ :type="(sohelpConfig?.filter?.config?.visibleFilter && sohelpConfig?.filter?.config?.filterPosition !== 'NONE')?'primary':''"
1443
+ v-if="sohelpConfig?.filter?.config?._visibleFilter">
1444
+ </el-button>
1445
+ </div>
1446
+ </div>
1447
+ </template>
1448
+
1449
+
1450
+ <!-- 未编辑状态 -->
1451
+ <template
1452
+ v-for="name in sohelpConfig?.properties?.map(item => item.name)"
1453
+ v-slot:[`default_${name}`]="{ row, column, rowIndex }"
1454
+ :key="name"
1455
+ >
1456
+
1457
+ <sohelp-dict
1458
+ type="text"
1459
+ v-model="row[name]"
1460
+ v-if="column.type === 'SohelpDict'"
1461
+ v-bind="column.editRender"
1462
+ />
1463
+
1464
+ <!-- 图片 -->
1465
+ <sohelp-image-upload v-else-if="column.type === 'SohelpImageUpload'"
1466
+ v-model="row[name]"
1467
+ v-bind="column.editRender"
1468
+ :data="getCellValue(rowIndex,name)"
1469
+ :readonly="!column.editRender.edit">
1470
+ </sohelp-image-upload>
1471
+ <!-- 附件 -->
1472
+ <sohelp-file-upload
1473
+ v-else-if="column.type === 'SohelpFileUpload'"
1474
+ v-model="row[name]"
1475
+ v-bind="column.editRender"
1476
+ :data="getCellValue(rowIndex,name)"
1477
+ :readonly="!column.editRender.edit">
1478
+ </sohelp-file-upload>
1479
+
1480
+ <!-- 下拉选择表格 -->
1481
+ <div v-else-if="column.type === 'SohelpTableSelect' || column.type === 'ORG' || column.type ==='USER'">
1482
+ <span>{{ getTableSelectLabel(row[name], rowIndex, name, column) }}</span>
1483
+ </div>
1484
+
1485
+ <!-- 评分 -->
1486
+ <sohelp-rate
1487
+ v-else-if="column.type==='SohelpRate'"
1488
+ v-model="row[name]"
1489
+ v-bind="column.editRender"
1490
+ :disabled="!column.editRender.edit"
1491
+ show-score
1492
+ score-template="{value} 分"
1493
+ style="width: 100%;"
1494
+ />
1495
+
1496
+ <!-- 进度 -->
1497
+ <sohelp-process
1498
+ v-else-if="column.type==='SohelpProcess'"
1499
+ v-model="row[name]"
1500
+ v-bind="column.editRender"
1501
+ style="width: 100%"
1502
+ :readonly="!column.editRender.edit"
1503
+ ></sohelp-process>
1504
+
1505
+
1506
+ <!-- 下拉用户选择 -->
1507
+ <div v-else-if="column.type === 'SohelpUserSelect'">
1508
+ {{ gridData[rowIndex][name]?.["user_name"] }}
1509
+ </div>
1510
+
1511
+ <!-- 下拉组织选择 -->
1512
+ <div v-else-if="column.type === 'SohelpOrgTreeSelect'">
1513
+ {{ gridData[rowIndex][name]?.["org_name"] }}
1514
+ </div>
1515
+
1516
+ <!-- 开关 -->
1517
+ <div v-else-if="column.type==='SohelpSwitch' || column.type === 'SohelpCheckbox'">
1518
+ <span v-if="!column.editRender.edit">
1519
+ {{ !!row[name] ? "V" : "" }}
1520
+ </span>
1521
+ <sohelp-switch
1522
+ v-model="row[name]"
1523
+ v-bind="column.editRender"
1524
+ style="width: 100%;"
1525
+ v-else
1526
+ :activeValue="1"
1527
+ :inactiveValue="0"
1528
+ />
1529
+ </div>
1530
+
1531
+ <!-- 文本域 -->
1532
+ <p style="margin: 0;"
1533
+ class="textarea-reference"
1534
+ @click="showTextareaModal(column, name, row)"
1535
+ v-bind="column.editRender"
1536
+ v-else-if="column.type === 'SohelpTextarea'"
1537
+ >{{ row[name] }}
1538
+ </p>
1539
+
1540
+ <!-- 外键关联 -->
1541
+ <div v-else-if="column.type === 'RELATION' || column.type === 'SohelpTableSelect'">
1542
+ {{ gridData[rowIndex][name]?.[column?.editRender?.labelField] || "" }}
1543
+ </div>
1544
+
1545
+ <!-- 富文本 -->
1546
+ <div v-else-if="column.type === 'SohelpRichText'" v-html="row[name]"></div>
1547
+
1548
+ <div v-else>
1549
+ {{ row[name] }}
1550
+ </div>
1551
+
1552
+ </template>
1553
+
1554
+ <!-- 可编辑状态 -->
1555
+ <template
1556
+ v-for="name in sohelpConfig?.properties?.map(item => item.name)"
1557
+ v-slot:[`edit_${name}`]="{ row, column, rowIndex }"
1558
+ :key="name"
1559
+ >
1560
+ <div v-if="column.editRender.enabled">
1561
+ <!-- 字典 -->
1562
+ <!-- <sohelp-dict-->
1563
+ <!-- v-model="row[name]"-->
1564
+ <!-- :code="column.dict"-->
1565
+ <!-- v-if="column.type === 'SohelpDict'"-->
1566
+ <!-- v-bind="column.editRender"-->
1567
+ <!-- style="width: 100%;"-->
1568
+ <!-- :visible="true"-->
1569
+ <!-- />-->
1570
+ <div v-if="column.type === 'SohelpDict'">
1571
+ {{ column }}
1572
+ </div>
1573
+
1574
+ <!-- 下拉用户选择 -->
1575
+ <sohelp-number-input
1576
+ v-model="row[name]"
1577
+ v-else-if="column.type==='SohelpInputNumber'"
1578
+ v-bind="column.editRender"
1579
+ style="width: 100%;"
1580
+ />
1581
+
1582
+ <!-- 日期、日期时间 -->
1583
+ <sohelp-datetime
1584
+ v-model="row[name]"
1585
+ v-else-if="column.type==='SohelpDatetime' || column.type==='SohelpDate'"
1586
+ v-bind="column.editRender"
1587
+ style="width: 100%;"
1588
+ :focus="true"
1589
+ />
1590
+
1591
+ <!-- 下拉用户选择 -->
1592
+ <sohelp-user-select
1593
+ v-else-if="column.type==='SohelpUserSelect'"
1594
+ v-model="row[name]"
1595
+ v-bind="column.editRender"
1596
+ :datasource="userDatasource"
1597
+ />
1598
+
1599
+ <!-- 下拉组织机构 -->
1600
+ <sohelp-org-tree-select
1601
+ v-else-if="column.type==='SohelpOrgTreeSelect'"
1602
+ v-model="row[name]"
1603
+ v-bind="column.editRender"
1604
+ :datasource="orgDatasource"
1605
+ />
1606
+
1607
+ <!-- 外键关联 -->
1608
+ <sohelp-table-select v-else-if="column.type==='SohelpTableSelect'"
1609
+ v-model:value="row[name]"
1610
+ v-model:data="gridData[rowIndex][name]"
1611
+ v-bind="column.editRender"
1612
+ ></sohelp-table-select>
1613
+
1614
+ <!-- 数值 -->
1615
+ <sohelp-number-input
1616
+ v-model="row[name]"
1617
+ v-else-if="column.type==='SohelpNumberInput'"
1618
+ v-bind="column.editRender"
1619
+ style="width: 100%;"
1620
+ :autoFocus="true"
1621
+ />
1622
+
1623
+ <!-- 其他 -->
1624
+ <sohelp-input
1625
+ v-model="row[name]"
1626
+ v-bind="column.editRender"
1627
+ :autoFocus="true"
1628
+ v-else
1629
+ style="width: 100%;"
1630
+ :show-word-limit="false"
1631
+ />
1632
+ </div>
1633
+ </template>
1634
+
1635
+ <!-- 操作栏 -->
1636
+ <template #_operation="{ row }">
1637
+ <div class="flex gap-10 justify-center" style="padding: 0 10px;">
1638
+ <template v-if="getOperationButtonsByType(row)?.length > 0">
1639
+ <el-link
1640
+ v-for="item in getOperationButtonsByType(row)"
1641
+ :key="item.code"
1642
+ :type="item.code === 'crud.delete' ? 'danger' : 'primary'"
1643
+ v-bind="item.params"
1644
+ :icon="item.icon"
1645
+ @click="operationHandler({item:item, row:row,$grid:sohelpVxeGridRef})"
1646
+ >
1647
+ {{ item.title }}
1648
+ </el-link>
1649
+ </template>
1650
+ <!-- 更多 -->
1651
+ <template v-if="getOperationButtonsByType(row,'more')?.length > 0">
1652
+ <el-dropdown>
1653
+ <el-link :underline="false">
1654
+ <span>更多</span>
1655
+ <el-icon style="margin-left: 4px;">
1656
+ <arrow-down />
1657
+ </el-icon>
1658
+ </el-link>
1659
+ <template #dropdown>
1660
+ <el-dropdown-menu>
1661
+ <el-dropdown-item v-for="item in getOperationButtonsByType(row,'more')" :key="item.code"
1662
+ @click="operationHandler({item:item, row:row,$grid:sohelpVxeGridRef})"
1663
+ v-bind="item.props">
1664
+ <el-icon :size="16" style="margin-right: 6px; vertical-align: -5px" v-if="item.icon">
1665
+ <component :is="eleIcons[item.icon]" />
1666
+ </el-icon>
1667
+ {{ item.title }}
1668
+ </el-dropdown-item>
1669
+ </el-dropdown-menu>
1670
+ </template>
1671
+ </el-dropdown>
1672
+ </template>
1673
+
1674
+ <slot name="_operation" :row="row"></slot>
1675
+ </div>
1676
+ </template>
1677
+
1678
+ <!-- 统计 -->
1679
+ <template
1680
+ v-for="field in footerData"
1681
+ v-slot:[`footer_${field["field"]}`]="{ row, column,rowIndex}"
1682
+ :key="field['field']"
1683
+ >
1684
+ <div v-html="row[column.field]"></div>
1685
+ </template>
1686
+
1687
+ <!-- 验证 -->
1688
+ <template #valid_slot="{content}">
1689
+ {{ content }}
1690
+ </template>
1691
+ </vxe-grid>
1692
+
1693
+ <!-- workflow -->
1694
+ <workflow-drawer
1695
+ :data="drawerData"
1696
+ v-model="drawerVisible"
1697
+ :showOpera="false"
1698
+ ref="todoDrawerRef"
1699
+ :key="drawerKey"
1700
+ ></workflow-drawer>
1701
+
1702
+ <!-- 提交审批 -->
1703
+ <approval-modal
1704
+ v-model="approvalModalVisible"
1705
+ type="submit"
1706
+ :data="approvalData"
1707
+ @confirm="reload"
1708
+ ></approval-modal>
1709
+
1710
+ <!-- SohelpTextareaInput 编辑弹窗 -->
1711
+ <ele-modal :width="460" v-model="textareaState['visible']" :title="getCurrentFieldLabel">
1712
+ <sohelp-textarea-input v-model="textareaState['value']" :rows="6"></sohelp-textarea-input>
1713
+ <template #footer>
1714
+ <el-button @click="textareaCancel">{{ t("common.cancel") }}</el-button>
1715
+ <el-button type="primary" @click="textareaConfirm(row, column)">{{ t("common.save") }}</el-button>
1716
+ </template>
1717
+ </ele-modal>
1718
+
1719
+ <!--实体表单-->
1720
+ <ele-modal :title="toolbarButtonParams?.title || ''"
1721
+ :width="toolbarButtonParams?.width || 860"
1722
+ v-model="visibleEntityForm" v-loading="loading">
1723
+ <sohelp-entity-form ref="entityFormRef"
1724
+ :refid="props.refid"
1725
+ v-model="entityFormValue"
1726
+ :data="entityFormData"
1727
+ :config="entityFormConfig"
1728
+ :readonly="toolbarButtonParams?.readonly"
1729
+ ></sohelp-entity-form>
1730
+ <template #footer v-if="!toolbarButtonParams?.readonly">
1731
+ <el-button @click="closeEntityForm()">{{ t("common.close") }}</el-button>
1732
+ <el-button type="primary" @click="saveEntityForm()" v-loading="loading">{{ t("common.save") }}</el-button>
1733
+ </template>
1734
+ </ele-modal>
1735
+ <!--打印报表-->
1736
+ <ele-modal :title="toolbarButtonParams?.title|| t('grid.report.title')" :width="toolbarButtonParams?.width|| 600"
1737
+ v-model="visibleReport">
1738
+
1739
+ <ele-check-card v-model="currentReportValue" :items="reportData" :row="{ gutter: 2 }">
1740
+ <template #item="{ item }">
1741
+ <ele-text size="md" style="padding:10px;">{{ item.name }}</ele-text>
1742
+ </template>
1743
+ </ele-check-card>
1744
+
1745
+ <template #footer>
1746
+ <el-button @click="closeReport()">{{ t("common.close") }}</el-button>
1747
+ <el-button @click="designReport()" v-if="reportData && reportData.length>0">{{ t("common.design") }}</el-button>
1748
+ <el-button type="primary" @click="openReport()" v-if="reportData && reportData.length>0">{{ t("common.print") }}
1749
+ </el-button>
1750
+ </template>
1751
+ </ele-modal>
1752
+ </template>
1753
+
1754
+ <style scoped lang="scss">
1755
+ .sohelp-grid-view {
1756
+ padding: 0px;
1757
+ display: flex;
1758
+ height: 100%;
1759
+ flex-direction: column;
1760
+
1761
+ :deep(.vxe-grid--table-wrapper) {
1762
+ .vxe-table {
1763
+ height: 100%;
1764
+ }
1765
+ }
1766
+
1767
+
1768
+ .toolbar-box {
1769
+ display: flex;
1770
+ gap: 10px;
1771
+ flex-wrap: wrap;
1772
+
1773
+ .tools-btns {
1774
+ display: flex;
1775
+ gap: 10px;
1776
+ margin-right: 10px;
1777
+
1778
+ :deep(.el-button) {
1779
+ margin-left: 0 !important;
1780
+ }
1781
+ }
1782
+ }
1783
+
1784
+ .ele-split-panel {
1785
+ :deep(.ele-split-panel-side) {
1786
+ border: none !important;
1787
+ }
1788
+ }
1789
+
1790
+ .vxe-grid {
1791
+ height: 100%;
1792
+
1793
+ :deep(.vxe-grid--layout-body-content-wrapper) {
1794
+ display: flex;
1795
+ flex-direction: column;
1796
+
1797
+ .vxe-grid--table-container {
1798
+ flex: 1;
1799
+ }
1800
+ }
1801
+
1802
+ :deep(.col--SohelpImageUpload) {
1803
+ .vxe-cell--wrapper {
1804
+ overflow: initial !important;
1805
+ }
1806
+ }
1807
+
1808
+ :deep(.vxe-table--render-default) {
1809
+ .vxe-body--row.row--stripe > .vxe-body--column {
1810
+ // background-color: transparent;
1811
+ }
1812
+ }
1813
+
1814
+ }
1815
+ }
1816
+
1817
+ .sort-list :deep(.el-button:focus),
1818
+ .sort-list :deep(.el-button:hover) {
1819
+ background-color: #e8f1ff !important;
1820
+ color: #1677ff !important;
1821
+ }
1822
+
1823
+ .filter-header {
1824
+ border-bottom: 1px solid #ddd;
1825
+ display: flex;
1826
+ width: 100%;
1827
+ height: 35px;
1828
+ line-height: 40px;
1829
+ box-sizing: border-box;
1830
+ margin: 0 0 0 10px;
1831
+ }
1832
+
1833
+ .sohelp-grid-view.right {
1834
+ .ele-split-panel {
1835
+ :deep(.ele-split-panel-side) {
1836
+ height: 100% !important;
1837
+ border: 0;
1838
+ display: flex;
1839
+ flex-direction: column;
1840
+ border-left: 1px solid #ddd !important;
1841
+ }
1842
+ }
1843
+ }
1844
+
1845
+ :deep(.tooltip-btn) {
1846
+ margin-left: 5px;
1847
+ height: 22px;
1848
+ line-height: 22px;
1849
+ margin-top: 2px;
1850
+ padding: 0px 5px !important;
1851
+ }
1852
+
1853
+ :deep(.vxe-cell--wrapper) {
1854
+ height: 100%;
1855
+ }
1856
+
1857
+ .textarea-reference {
1858
+ display: flex;
1859
+ height: 100%;
1860
+ }
1861
+
1862
+ :deep(.ele-split-panel.is-vertical) {
1863
+ .ele-split-panel-wrap > .ele-split-panel-space .ele-split-resize-line::after {
1864
+ background: #eee;
1865
+ }
1866
+ }
1867
+
1868
+ .condition-box {
1869
+ padding: 10px;
1870
+ }
1871
+
1872
+ .sohelp-filter-card.right {
1873
+ height: 100%;
1874
+ overflow: hidden;
1875
+
1876
+ :deep(.ele-card-header) {
1877
+ min-width: 230px;
1878
+ }
1879
+
1880
+ :deep(.ele-card-body) {
1881
+ height: 100% !important;
1882
+ }
1883
+ }
1884
+
1885
+
1886
+ </style>