sohelp-eleplus 1.1.26 → 1.1.28

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 (205) hide show
  1. package/components.js +1 -0
  2. package/icons/flag/README.md +2 -2
  3. package/icons/flag/index.js +0 -1
  4. package/package.json +1 -1
  5. package/sohelp-ace-editor/README.md +32 -42
  6. package/sohelp-ace-editor/index.vue +166 -156
  7. package/sohelp-api-doc/README.md +36 -0
  8. package/sohelp-api-doc/index.vue +160 -0
  9. package/sohelp-application-select/README.md +9 -7
  10. package/sohelp-application-select/index.vue +10 -13
  11. package/sohelp-autocode/README.md +14 -26
  12. package/sohelp-calendar-view/README.md +9 -7
  13. package/sohelp-calendar-view/index.vue +10 -9
  14. package/sohelp-card/README.md +15 -17
  15. package/sohelp-card/index.vue +1 -1
  16. package/sohelp-card-view/README.md +9 -7
  17. package/sohelp-card-view/index.vue +10 -9
  18. package/sohelp-condition/README.md +29 -49
  19. package/sohelp-condition/index.vue +2 -1
  20. package/sohelp-country-select/README.md +15 -123
  21. package/sohelp-country-select/index.vue +1 -1
  22. package/sohelp-cry-input/README.md +19 -195
  23. package/sohelp-cry-input/index.vue +6 -2
  24. package/sohelp-date/README.md +12 -15
  25. package/sohelp-datetime/README.md +15 -17
  26. package/sohelp-datetime-picker/README.md +18 -18
  27. package/sohelp-datetime-picker/index.vue +11 -4
  28. package/sohelp-datetime-range/README.md +20 -23
  29. package/sohelp-demo-block/README.md +43 -0
  30. package/sohelp-demo-block/index.vue +229 -0
  31. package/sohelp-dict/README.md +28 -23
  32. package/sohelp-dict/index.vue +17 -17
  33. package/sohelp-drawer/README.md +28 -26
  34. package/sohelp-drop-card/README.md +29 -28
  35. package/sohelp-drop-card/index.vue +0 -1
  36. package/sohelp-dyn-select/README.md +31 -16
  37. package/sohelp-dyn-select/index.vue +65 -67
  38. package/sohelp-dyn-tree/README.md +26 -20
  39. package/sohelp-dyn-tree/index.vue +2 -2
  40. package/sohelp-dyn-tree-select/README.md +28 -19
  41. package/sohelp-dyn-tree-select/index.vue +23 -7
  42. package/sohelp-entity-form/README.md +65 -30
  43. package/sohelp-entity-form/index.vue +3 -2
  44. package/sohelp-entity-grid/README.md +13 -11
  45. package/sohelp-entity-grid/index.vue +1 -1
  46. package/sohelp-file-upload/README.md +25 -27
  47. package/sohelp-file-upload/index.vue +1 -1
  48. package/sohelp-filter-scheme/README.md +34 -30
  49. package/sohelp-filter-scheme/index.vue +2 -2
  50. package/sohelp-grid/README.md +52 -33
  51. package/sohelp-grid/index.vue +41 -39
  52. package/sohelp-grid/js/SohelpGridConfig.js +3 -3
  53. package/sohelp-grid/js/useSohelpGridConfig.js +4 -6
  54. package/sohelp-grid-select/README.md +32 -27
  55. package/sohelp-grid-select/index.vue +6 -5
  56. package/sohelp-grid-view/README.md +51 -22
  57. package/sohelp-grid-view-select/README.md +33 -25
  58. package/sohelp-grid-view-select/index.vue +2 -1
  59. package/sohelp-group-view/README.md +14 -4
  60. package/sohelp-group-view/index.vue +10 -9
  61. package/sohelp-icon-select/README.md +14 -12
  62. package/sohelp-image-upload/README.md +27 -27
  63. package/sohelp-image-upload/index.vue +2 -2
  64. package/sohelp-import/README.md +25 -24
  65. package/sohelp-input/README.md +27 -11
  66. package/sohelp-input/index.vue +15 -2
  67. package/sohelp-input-tag/README.md +53 -0
  68. package/sohelp-input-tag/index.vue +337 -0
  69. package/sohelp-modal/README.md +42 -16
  70. package/sohelp-modal/index.vue +21 -4
  71. package/sohelp-modal-select/README.md +745 -0
  72. package/sohelp-modal-select/index.vue +705 -0
  73. package/sohelp-module/README.md +24 -13
  74. package/sohelp-number-input/README.md +15 -8
  75. package/sohelp-number-input/index.vue +3 -0
  76. package/sohelp-number-range/README.md +22 -12
  77. package/sohelp-number-range/index.vue +3 -11
  78. package/sohelp-org-modal-select/README.md +47 -0
  79. package/sohelp-org-modal-select/index.vue +411 -0
  80. package/sohelp-org-select/README.md +23 -10
  81. package/sohelp-org-select/index.vue +41 -24
  82. package/sohelp-org-tree/README.md +19 -7
  83. package/sohelp-org-tree/index.vue +1 -2
  84. package/sohelp-org-tree-select/README.md +22 -11
  85. package/sohelp-org-tree-select/index.vue +1 -2
  86. package/sohelp-org-user-tree/README.md +19 -7
  87. package/sohelp-org-user-tree/index.vue +1 -2
  88. package/sohelp-org-user-tree-select/README.md +8 -3
  89. package/sohelp-org-user-tree-select/index.vue +8 -7
  90. package/sohelp-page/README.md +20 -11
  91. package/sohelp-page/index.vue +1 -1
  92. package/sohelp-pagination/README.md +14 -6
  93. package/sohelp-pagination/index.vue +1 -1
  94. package/sohelp-power/README.md +34 -19
  95. package/sohelp-power/index.vue +2 -2
  96. package/sohelp-pro-form/README.md +64 -21
  97. package/sohelp-pro-layout/README.md +10 -4
  98. package/sohelp-pro-layout/index.vue +8 -7
  99. package/sohelp-pro-table/README.md +30 -6
  100. package/sohelp-process/README.md +26 -13
  101. package/sohelp-process/index.vue +6 -6
  102. package/sohelp-rate/README.md +24 -12
  103. package/sohelp-rate/index.vue +5 -1
  104. package/sohelp-relation/README.md +10 -4
  105. package/sohelp-relation/index.vue +8 -7
  106. package/sohelp-relation-modal-select/README.md +41 -0
  107. package/sohelp-relation-modal-select/index.vue +70 -0
  108. package/sohelp-rich-text/README.md +29 -11
  109. package/sohelp-rich-text/index.vue +21 -20
  110. package/sohelp-richtext/README.md +12 -2
  111. package/sohelp-richtext/index.vue +8 -6
  112. package/sohelp-role-modal-select/README.md +45 -0
  113. package/sohelp-role-modal-select/index.vue +111 -0
  114. package/sohelp-role-select/README.md +18 -10
  115. package/sohelp-role-select/index.vue +36 -27
  116. package/sohelp-search/README.md +12 -4
  117. package/sohelp-search/index.vue +2 -2
  118. package/sohelp-search-pro-form/README.md +15 -1
  119. package/sohelp-search-pro-form/index.vue +2 -1
  120. package/sohelp-select/README.md +31 -30
  121. package/sohelp-select/index.vue +79 -84
  122. package/sohelp-split-panel/README.md +17 -18
  123. package/sohelp-switch/README.md +21 -19
  124. package/sohelp-switch/index.vue +34 -33
  125. package/sohelp-table/README.md +35 -27
  126. package/sohelp-table/index.vue +110 -109
  127. package/sohelp-table-select/README.md +55 -0
  128. package/sohelp-tenant-select/README.md +19 -18
  129. package/sohelp-tenant-select/index.vue +105 -109
  130. package/sohelp-text/README.md +16 -10
  131. package/sohelp-text/index.vue +5 -5
  132. package/sohelp-textarea-input/README.md +19 -12
  133. package/sohelp-time/README.md +11 -10
  134. package/sohelp-tree/README.md +24 -19
  135. package/sohelp-tree/index.vue +21 -23
  136. package/sohelp-tree-select/README.md +23 -10
  137. package/sohelp-user-modal-select/README.md +739 -0
  138. package/sohelp-user-modal-select/index.vue +87 -0
  139. package/sohelp-user-select/README.md +26 -15
  140. package/sohelp-user-select/index.vue +6 -2
  141. package/sohelp-user-tag/README.md +5 -7
  142. package/sohelp-user-tag/index.vue +8 -8
  143. package/sohelp-user-tree/README.md +5 -8
  144. package/sohelp-user-tree/index.vue +8 -7
  145. package/sohelp-vform-drawer/README.md +36 -18
  146. package/sohelp-vform-drawer/index.vue +2 -2
  147. package/sohelp-vform-eleplus/README.md +33 -31
  148. package/sohelp-vform-eleplus/index.vue +2 -2
  149. package/sohelp-vform-eleplus/tinymce/langs/zh_CN.js +461 -461
  150. package/sohelp-vform-eleplus/tinymce/langs/zh_TW.js +418 -418
  151. package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.css +72 -72
  152. package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.min.css +7 -7
  153. package/sohelp-vform-eleplus/tinymce/skins/content/default/content.css +67 -67
  154. package/sohelp-vform-eleplus/tinymce/skins/content/default/content.min.css +7 -7
  155. package/sohelp-vform-eleplus/tinymce/skins/content/document/content.css +72 -72
  156. package/sohelp-vform-eleplus/tinymce/skins/content/document/content.min.css +7 -7
  157. package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.css +68 -68
  158. package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.min.css +7 -7
  159. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.css +732 -732
  160. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.css +726 -726
  161. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.min.css +7 -7
  162. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.min.css +7 -7
  163. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.css +29 -29
  164. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.min.css +7 -7
  165. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.css +3047 -3047
  166. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.min.css +7 -7
  167. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.css +673 -673
  168. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.min.css +7 -7
  169. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.css +37 -37
  170. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.min.css +7 -7
  171. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.css +714 -714
  172. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.css +726 -726
  173. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.min.css +7 -7
  174. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.min.css +7 -7
  175. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.css +29 -29
  176. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.min.css +7 -7
  177. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.css +3047 -3047
  178. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.min.css +7 -7
  179. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.css +673 -673
  180. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +7 -7
  181. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +37 -37
  182. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +7 -7
  183. package/sohelp-vform-modal/README.md +36 -18
  184. package/sohelp-vform-modal/index.vue +2 -2
  185. package/sohelp-vform-select/README.md +9 -7
  186. package/sohelp-vform-select/index.vue +8 -7
  187. package/sohelp-vxe-grid/DefaultGridOptions.js +5 -3
  188. package/sohelp-vxe-grid/DefaultProps.js +0 -1
  189. package/sohelp-vxe-grid/README.md +540 -35
  190. package/sohelp-vxe-grid/SohelpGridConfig.js +8 -6
  191. package/sohelp-vxe-grid/index.vue +141 -94
  192. package/sohelp-vxe-grid-select/README.md +41 -26
  193. package/sohelp-vxe-table/README.md +23 -20
  194. package/sohelp-vxe-table/index.vue +5 -4
  195. package/sohelp-workflow/README.md +21 -17
  196. package/sohelp-workflow/index.vue +25 -22
  197. package/sohelp-workflow-drawer/README.md +41 -28
  198. package/sohelp-workflow-drawer/components/table.vue +7 -1
  199. package/sohelp-workflow-drawer/index.vue +86 -71
  200. package/sohelp-workflow-drawer/js/index.js +15 -13
  201. package/style/index.scss +0 -0
  202. package/utils/safe-eval.js +89 -0
  203. package/sohelp-dyn-select/props.js +0 -67
  204. package/sohelp-user-select/index.vue~ +0 -53
  205. package/sohelp-user-select/props.js +0 -71
@@ -15,85 +15,83 @@
15
15
  />
16
16
  </div>
17
17
  </template>
18
- <script>
19
- import { computed, reactive, ref, onMounted, watch } from 'vue';
18
+ <script setup>
19
+ import { computed, ref, onMounted, watch } from 'vue';
20
20
  import { ElMessage } from 'element-plus';
21
21
  import SohelpSelect from '../sohelp-select/index.vue';
22
+ import SohelpHttp from '../http/SohelpHttp.js';
22
23
 
23
- export default {
24
- name: 'SohelpDynSelect',
25
- components: { SohelpSelect },
26
- props: {
27
- datasource: {
28
- type: [Array, Function, Promise],
29
- required: true
30
- },
31
- url: {
32
- type: String,
33
- required: true
34
- },
35
- readonly: {
36
- type: Boolean,
37
- default: false
38
- },
39
- labelField: String,
40
- valueField: String,
41
- modelValue: [String, Number, Array, Object]
24
+ const props = defineProps({
25
+ datasource: {
26
+ type: [Array, Function, Promise],
27
+ default: undefined
28
+ },
29
+ url: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ readonly: {
34
+ type: Boolean,
35
+ default: false
42
36
  },
43
- setup(props, { emit, attrs }) {
44
- const value = ref('');
45
- const selectData = ref(null);
37
+ labelField: String,
38
+ valueField: String,
39
+ modelValue: [String, Number, Array, Object]
40
+ });
46
41
 
47
- onMounted(async () => {
48
- if (Array.isArray(props.datasource)) {
49
- selectData.value = props.datasource;
50
- } else if (typeof props.datasource === 'function') {
51
- const result = await props.datasource();
52
- selectData.value = result;
53
- } else if (props.datasource instanceof Promise) {
54
- const result = await props.datasource;
55
- selectData.value = result;
56
- } else {
57
- load();
58
- }
59
- });
42
+ const emit = defineEmits(['update:modelValue']);
60
43
 
61
- const load = async () => {
62
- if (props.url && props?.url?.length > 0) {
63
- const res = await SohelpHttp.get(props?.url, {}).catch((err) => {
64
- ElMessage.error(err.message || 'error');
65
- });
44
+ const value = ref('');
45
+ const selectData = ref(null);
66
46
 
67
- if (res?.data?.length > 0) {
68
- selectData.value = res.data;
69
- }
70
- }
71
- };
47
+ onMounted(async () => {
48
+ if (Array.isArray(props.datasource)) {
49
+ selectData.value = props.datasource;
50
+ } else if (typeof props.datasource === 'function') {
51
+ const result = await props.datasource();
52
+ selectData.value = result;
53
+ } else if (props.datasource instanceof Promise) {
54
+ const result = await props.datasource;
55
+ selectData.value = result;
56
+ } else {
57
+ load();
58
+ }
59
+ });
72
60
 
73
- /**
74
- * 获取label
75
- */
76
- const getLabel = computed(() => {
77
- return selectData.value.find((item) => item.id === props.modelValue)?.[props.labelField];
61
+ const load = async () => {
62
+ if (props.url && props?.url?.length > 0) {
63
+ const res = await SohelpHttp.get(props?.url, {}).catch((err) => {
64
+ ElMessage.error(err.message || 'error');
78
65
  });
66
+ selectData.value = res?.data || [];
67
+ }
68
+ };
79
69
 
80
- watch(
81
- () => props.modelValue,
82
- (val) => {
83
- value.value = val;
84
- },
85
- {
86
- immediate: true,
87
- deep: true
88
- }
89
- );
70
+ /**
71
+ * 获取label
72
+ */
73
+ const getLabel = computed(() => {
74
+ return selectData.value?.find((item) => item[props.valueField] === props.modelValue)?.[props.labelField];
75
+ });
90
76
 
91
- return {
92
- value,
93
- getLabel,
94
- selectData
95
- };
77
+ watch(
78
+ () => props.modelValue,
79
+ (val) => {
80
+ value.value = val;
81
+ },
82
+ {
83
+ immediate: true,
84
+ deep: true
96
85
  }
86
+ );
87
+
88
+ watch(value, (val) => {
89
+ emit('update:modelValue', val);
90
+ });
91
+ </script>
92
+ <script>
93
+ export default {
94
+ name: 'SohelpDynSelect'
97
95
  };
98
96
  </script>
99
97
  <style></style>
@@ -1,31 +1,37 @@
1
- # 动态树 (Dynamic Tree)
1
+ # SohelpDynTree 动态树
2
2
 
3
- 从后端 URL 加载扁平数据并自动转换为树形结构展示的组件。
3
+ 基于 `sohelp-tree` 封装的动态树形组件,通过 URL 从后端加载扁平数据并自动转换为树形结构展示。
4
4
 
5
- ## 属性 (Props)
6
-
7
- | 属性名 | 类型 | 默认值 | 说明 |
8
- | :--- | :--- | :--- | :--- |
9
- | url | String | - | 数据接口 URL (Required)。 |
10
- | valueField | String | 'id' | ID 字段名。 |
11
- | labelField | String | 'org_name' | 显示字段名。 |
12
- | parentField | String | 'parent_id' | 父级 ID 字段名。 |
13
- | ... | - | - | 支持 `sohelp-tree` (el-tree) 的其他属性。 |
14
-
15
- ## 事件 (Events)
16
-
17
- | 事件名 | 说明 | 回调参数 |
18
- | :--- | :--- | :--- |
19
- | node-click | 节点点击事件。 | `data, node, el` |
20
-
21
- ## 使用示例
5
+ ## 基础用法
22
6
 
23
7
  ```vue
24
8
  <template>
25
9
  <sohelp-dyn-tree
26
10
  url="/engine/web/org/list"
27
- labelField="org_name"
11
+ label-field="org_name"
28
12
  @node-click="handleNodeClick"
29
13
  />
30
14
  </template>
15
+
16
+ <script setup>
17
+ const handleNodeClick = (data, node, el) => {
18
+ console.log('点击节点:', data);
19
+ };
20
+ </script>
31
21
  ```
22
+
23
+ ## 属性 (Props)
24
+
25
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 |
26
+ | :--- | :--- | :--- | :--- | :--- |
27
+ | url | String | - | 是 | 数据接口 URL |
28
+ | valueField | String | `id` | 否 | 数据中作为节点唯一标识的字段名 |
29
+ | labelField | String | `org_name` | 否 | 数据中作为节点显示文本的字段名 |
30
+ | parentField | String | `parent_id` | 否 | 数据中作为父级标识的字段名 |
31
+ | ...attrs | - | - | 否 | 支持所有 `sohelp-tree`(el-tree)属性透传 |
32
+
33
+ ## 事件 (Events)
34
+
35
+ | 事件名 | 回调参数 | 说明 |
36
+ | :--- | :--- | :--- |
37
+ | node-click | `(data, node, el)` | 节点被点击时触发 |
@@ -49,8 +49,8 @@
49
49
  id: item[valueField] ?? '',
50
50
  parent_id: item[parentField] ?? ''
51
51
  })),
52
- idField: valueField,
53
- parentIdField: parentField,
52
+ idField: 'id',
53
+ parentIdField: 'parent_id',
54
54
  childrenField: 'children',
55
55
  labelField
56
56
  });
@@ -1,28 +1,37 @@
1
- # 动态树选择 (Dynamic Tree Select)
1
+ # SohelpDynTreeSelect 动态树选择器
2
2
 
3
- 基于 `ele-tree-select`,支持从后端 URL 加载数据并自动转树形结构的选择组件。
3
+ 基于 `ele-tree-select` 封装,通过 URL 从后端加载扁平数据并自动转换为树形结构的下拉选择组件,支持双向绑定。
4
4
 
5
- ## 属性 (Props)
6
-
7
- | 属性名 | 类型 | 默认值 | 说明 |
8
- | :--- | :--- | :--- | :--- |
9
- | modelValue | String/Number/Array | - | 绑定的值 (v-model)。 |
10
- | url | String | '/engine/web/org/list' | 数据接口 URL。 |
11
- | valueField | String | 'id' | ID 字段名。 |
12
- | labelField | String | 'org_name' | 显示字段名。 |
13
- | parentField | String | 'parent_id' | 父级 ID 字段名。 |
14
- | height | String | '255' | 下拉框高度。 |
15
- | checkStrictly | Boolean | false | 是否严格的遵循父子不互相关联。 |
16
- | ... | - | - | 支持 `ele-tree-select` 的其他属性。 |
17
-
18
- ## 使用示例
5
+ ## 基础用法
19
6
 
20
7
  ```vue
21
8
  <template>
22
9
  <sohelp-dyn-tree-select
23
- v-model="orgId"
24
- url="/api/orgs"
25
- placeholder="选择部门"
10
+ v-model="selectedId"
11
+ url="/engine/web/org/list"
12
+ label-field="org_name"
13
+ placeholder="请选择"
26
14
  />
27
15
  </template>
16
+
17
+ <script setup>
18
+ import { ref } from 'vue';
19
+ const selectedId = ref('');
20
+ </script>
28
21
  ```
22
+
23
+ ## 属性 (Props)
24
+
25
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 |
26
+ | :--- | :--- | :--- | :--- | :--- |
27
+ | modelValue (v-model) | String / Number / Array | - | 是 | 绑定值 |
28
+ | url | String | `/engine/web/org/list` | 是 | 数据接口 URL |
29
+ | valueField | String | `id` | 否 | 数据中作为节点值的字段名 |
30
+ | labelField | String | `org_name` | 否 | 数据中作为节点显示文本的字段名 |
31
+ | parentField | String | `parent_id` | 否 | 数据中作为父级标识的字段名 |
32
+ | highlightCurrent | Boolean | `false` | 否 | 是否高亮当前选中节点 |
33
+ | expandOnClickNode | Boolean | `false` | 否 | 是否在点击节点时展开/收起 |
34
+ | defaultExpandedKeys | Array / String | `[]` | 否 | 默认展开的节点 key 数组(字符串以逗号分隔) |
35
+ | checkStrictly | Boolean | `false` | 否 | 父子节点是否不互相关联 |
36
+ | height | String | `255` | 否 | 下拉面板高度(px) |
37
+ | ...attrs | - | - | 否 | 支持所有 `ele-tree-select` 属性透传 |
@@ -8,7 +8,7 @@
8
8
  />
9
9
  </template>
10
10
  <script>
11
- import { reactive, onMounted, ref } from 'vue';
11
+ import { reactive, onMounted, ref, watch } from 'vue';
12
12
  import { toTree } from '../utils/core.js';
13
13
 
14
14
  export default {
@@ -40,8 +40,8 @@
40
40
  default: false
41
41
  },
42
42
  defaultExpandedKeys: {
43
- type: Array,
44
- default: []
43
+ type: [Array, String],
44
+ default: () => []
45
45
  },
46
46
  checkStrictly: {
47
47
  type: Boolean,
@@ -69,7 +69,22 @@
69
69
  nodeKey: 'id'
70
70
  });
71
71
 
72
- const selectedValue = ref();
72
+ const selectedValue = ref(props.modelValue);
73
+
74
+ watch(
75
+ () => props.modelValue,
76
+ (val) => {
77
+ selectedValue.value = val;
78
+ }
79
+ );
80
+
81
+ watch(selectedValue, (val) => {
82
+ emit('update:modelValue', val);
83
+ });
84
+
85
+ const handleChange = (val) => {
86
+ emit('update:modelValue', val);
87
+ };
73
88
 
74
89
  onMounted(async () => {
75
90
  // 初始化树形结构数据
@@ -77,8 +92,8 @@
77
92
  treeProps.expandOnclickNode = props.expandOnClickNode;
78
93
  treeProps.highlightCurrent = props.highlightCurrent;
79
94
  treeProps.checkStrictly = props.checkStrictly;
80
- treeProps.defaultExpandedKeys =
81
- props.defaultExpandedKeys?.length > 0 ? props.defaultExpandedKeys.split(',').filter((item) => item) : [];
95
+ const keys = Array.isArray(props.defaultExpandedKeys) ? props.defaultExpandedKeys : props.defaultExpandedKeys.split(',').filter(item => item);
96
+ treeProps.defaultExpandedKeys = keys;
82
97
 
83
98
  if (props.url && props?.url?.length > 0) {
84
99
  const res = await SohelpHttp.get(props?.url, {}).catch((err) => {
@@ -106,7 +121,8 @@
106
121
 
107
122
  return {
108
123
  treeProps,
109
- selectedValue
124
+ selectedValue,
125
+ handleChange
110
126
  };
111
127
  }
112
128
  };
@@ -1,45 +1,80 @@
1
- # 实体表单 (Entity Form)
1
+ # SohelpEntityForm 实体表单
2
2
 
3
- 基于元数据配置 (`refid`) 自动渲染的表单组件,支持复杂的表单逻辑、公式计算和布局控制。
3
+ 基于实体元数据配置(`refid`)自动渲染的表单组件,内部封装了 `SohelpProForm`,支持公式计算、自动数据加载和 CRUD 操作。
4
4
 
5
- ## 功能特性
6
-
7
- - **元数据驱动**:通过 `refid` 自动加载表单配置。
8
- - **公式计算**:支持字段间的自动计算公式。
9
- - **响应式布局**:支持 `grid` 布局配置。
10
- - **自定义插槽**:支持插槽覆盖特定字段的渲染。
11
-
12
- ## 属性 (Props)
13
-
14
- | 属性名 | 类型 | 默认值 | 说明 |
15
- | :--- | :--- | :--- | :--- |
16
- | modelValue | Object | - | 表单数据对象 (v-model)。 |
17
- | refid | String | - | 实体引用 ID (Required)。 |
18
- | formConfig | Object | - | 表单配置对象 (Required)。 |
19
- | readonly | Boolean | false | 是否只读。 |
20
- | autoLoad | Boolean | true | 是否自动加载数据。 |
21
- | labelWidth | String | 'auto' | 标签宽度。 |
22
- | gridNum | Number | 1 | 列数。 |
23
-
24
- ## 方法 (Exposed Methods)
25
-
26
- 可通过 `ref` 获取实例调用:
27
- - `getRef(name)`: 获取内部字段组件实例。
28
-
29
- ## 使用示例
5
+ ## 基础用法
30
6
 
31
7
  ```vue
32
8
  <template>
33
9
  <sohelp-entity-form
10
+ ref="entityFormRef"
34
11
  v-model="formData"
35
- refid="user_entity"
36
- :formConfig="config"
12
+ refid="module!entity"
13
+ :formConfig="formConfig"
14
+ :gridNum="2"
37
15
  />
38
16
  </template>
39
17
 
40
18
  <script setup>
41
19
  import { ref } from 'vue';
42
20
  const formData = ref({});
43
- const config = { ... }; // 通常由后端获取
21
+ const formConfig = {};
22
+ const entityFormRef = ref();
23
+
24
+ // 加载数据
25
+ entityFormRef.value.load({ id: '1' });
26
+ // 保存数据
27
+ entityFormRef.value.save();
44
28
  </script>
45
29
  ```
30
+
31
+ ## 属性 (Props)
32
+
33
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 |
34
+ | --- | --- | --- | --- | --- |
35
+ | modelValue | Object | - | 否 | 表单数据对象,支持 v-model |
36
+ | data | Object | - | 否 | 表单关联数据对象 |
37
+ | refid | String | - | 是 | 实体引用 ID,用于加载元数据配置 |
38
+ | readonly | Boolean | false | 否 | 是否只读模式 |
39
+ | autoLoad | Boolean | true | 否 | 是否自动加载数据 |
40
+ | formConfig | Object | - | 是 | 表单配置对象 |
41
+ | labelWidth | String | - | 否 | 标签宽度,默认从实体配置读取或 'auto' |
42
+ | gridNum | Number | 1 | 否 | 表单列数 |
43
+ | saveParams | Object | {} | 否 | 保存时附加的额外参数 |
44
+
45
+ ## 事件 (Events)
46
+
47
+ | 事件名 | 回调参数 | 说明 |
48
+ | --- | --- | --- |
49
+ | update:modelValue | (value: Object) | 表单值变化时触发 |
50
+ | update:data | (data: Object) | 表单关联数据变化时触发 |
51
+
52
+ ## 插槽 (Slots)
53
+
54
+ | 插槽名 | 说明 |
55
+ | --- | --- |
56
+ | [动态插槽] | 透传至内部 SohelpProForm 的自定义插槽,可用于覆盖特定字段渲染 |
57
+
58
+ ## 公开方法 (Expose)
59
+
60
+ - `loadConfig(refid?)` - 重新加载实体表单配置
61
+ - `load(params?, callback?)` - 通过引擎根据参数加载表单数据
62
+ - `loadByInitial(params?, callback?)` - 加载表单初始化数据
63
+ - `save(params?, callback?)` - 通过引擎保存表单数据
64
+ - `getFormData()` - 获取表单关联数据对象
65
+ - `getFormValue()` - 获取表单值对象
66
+ - `setFormData(data, params?)` - 设置表单数据
67
+ - `setFormValue(value)` - 设置表单值
68
+ - `setFieldValue(fieldName, fieldValue)` - 设置单个字段值
69
+ - `getFieldValue(fieldName)` - 获取单个字段值
70
+ - `getItemValue(fieldName)` - 获取配置项信息
71
+ - `setItemValue(fieldName, objectValue)` - 修改配置项属性
72
+ - `getCrudUpdater()` - 获取相对初始值变更过的字段(增量更新对象)
73
+ - `resetFormValue()` - 重置表单到默认值
74
+ - `validate()` - 验证表单
75
+ - `clearValidate()` - 清除表单验证信息
76
+ - `getRef(refName)` - 获取内部字段组件实例
77
+ - `proFormRef` - 内部 ProForm 组件引用
78
+ - `labelWidth` - 当前标签宽度
79
+ - `grid` - 当前列数
80
+ - `globalConfig` - 全局配置对象
@@ -37,6 +37,7 @@
37
37
  import { useMobile } from '@/utils/use-mobile';
38
38
  import { useI18n } from 'vue-i18n';
39
39
  import { EleMessage } from '@/components/ele-admin-plus/components';
40
+ import { safeEval } from '../utils/safe-eval.js';
40
41
 
41
42
  const formValue = ref({});
42
43
  const formData = ref({});
@@ -145,8 +146,8 @@
145
146
  /**提取计算公式中涉及的字段 */
146
147
  const extractFields = (list) => {
147
148
  const fieldMap = {};
148
- const regex = /{\s*(\w+)\s*}/g;
149
149
  list.forEach((item) => {
150
+ const regex = /{\s*(\w+)\s*}/g;
150
151
  let match;
151
152
  while ((match = regex.exec(item.formulaValue)) !== null) {
152
153
  const field = match[1];
@@ -477,7 +478,7 @@
477
478
  try {
478
479
  // 公式表达式处理
479
480
  const expr = formula.formulaValue.replace(/\s+/g, '').replace(/\${/g, 'row.').replace(/}/g, '');
480
- val[formula.field] = new Function('row', `return ${expr}`)(val);
481
+ val[formula.field] = safeEval(expr, { row: val });
481
482
  } catch (e) {
482
483
  console.error('计算公式错误', e);
483
484
  EleMessage.error('计算公式错误' + e.message);
@@ -1,18 +1,20 @@
1
- # 实体表格 (Entity Grid)
1
+ # SohelpEntityGrid 实体表格
2
2
 
3
- 基于元数据配置 (`refid`) 自动渲染的表格组件,封装了 `sohelp-grid-view`。
3
+ 基于实体元数据配置(`refid`)自动渲染的表格组件,内部封装了 `SohelpGridView`,并固定 `isEntityGrid` `true`。
4
4
 
5
- ## 属性 (Props)
6
-
7
- | 属性名 | 类型 | 默认值 | 说明 |
8
- | :--- | :--- | :--- | :--- |
9
- | refid | String | - | 实体引用 ID (Required)。 |
10
- | modelValue | Object | - | 绑定的值。 |
11
-
12
- ## 使用示例
5
+ ## 基础用法
13
6
 
14
7
  ```vue
15
8
  <template>
16
- <sohelp-entity-grid refid="user_list_view" />
9
+ <sohelp-entity-grid refid="module!entity" />
17
10
  </template>
18
11
  ```
12
+
13
+ ## 属性 (Props)
14
+
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 |
16
+ | --- | --- | --- | --- | --- |
17
+ | refid | String | - | 是 | 实体引用 ID,用于加载表格配置 |
18
+ | modelValue | Object | - | 否 | 绑定值 |
19
+
20
+ > 组件通过 `v-bind="$attrs"` 将其余属性透传至内部 `SohelpGridView`。
@@ -15,7 +15,7 @@ export default {
15
15
  required: true
16
16
  }
17
17
  },
18
- setup(props, {emits}) {
18
+ setup(props, {emit}) {
19
19
  const sohelpEntityGridRef = ref();
20
20
 
21
21
  return {
@@ -1,35 +1,33 @@
1
- # SohelpFileUpload 文件上传组件
1
+ # SohelpFileUpload 文件上传
2
2
 
3
- 基于 `vxe-upload` 封装的文件上传组件,支持拖拽、粘贴上传、多文件上传、文件大小限制、文件类型限制以及下载功能。
3
+ 基于 `vxe-upload` 封装的文件上传组件,支持拖拽上传、粘贴上传、文件下载和预览,自动对接后端文件接口。
4
4
 
5
5
  ## 基础用法
6
6
 
7
- ```html
8
- <sohelp-file-upload v-model="fileIds" :limit="5" :fileSize="10" />
7
+ ```vue
8
+ <template>
9
+ <sohelp-file-upload v-model="fileId" v-model:data="fileData" refid="myRefId" ref_id="recordId" ref_type="1" />
10
+ </template>
11
+
12
+ <script setup>
13
+ import { ref } from 'vue';
14
+ const fileId = ref('');
15
+ const fileData = ref([]);
16
+ </script>
9
17
  ```
10
18
 
11
19
  ## 属性 (Props)
12
20
 
13
- | 属性名 | 类型 | 默认值 | 说明 |
14
- |Data | Array | [] | 文件对象数组,包含 name, url, id 等信息 |
15
- | modelValue | Array/String | [] | 绑定的文件 ID 集合 |
16
- | limit | Number | - | 最大允许上传个数 |
17
- | fileSize | Number | - | 单个文件大小限制 (MB) |
18
- | fileType | Array | - | 允许上传的文件类型后缀,如 ['jpg', 'png'] |
19
- | drag | Boolean | false | 是否启用拖拽上传 |
20
- | isShowTip | Boolean | true | 是否显示提示信息 |
21
- | readonly | Boolean | false | 是否只读模式 |
22
-
23
- ## 事件 (Events)
24
-
25
- | 事件名 | 说明 | 回调参数 |
26
- | update:modelValue | 更新绑定的 ID 集合 | (ids: Array) |
27
- | update:data | 更新文件对象数组 | (files: Array) |
28
-
29
- ## 功能特性
30
-
31
- - **上传**: 调用后端接口 `/engine/web/file/upload` 上传文件。
32
- - **下载**: 点击文件名可下载文件,调用 `/engine/web/file/download/{id}`。
33
- - **删除**: 支持删除已上传文件。
34
- - **进度**: 显示上传进度。
35
- - **校验**: 校验文件数量、大小和类型。
21
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 |
22
+ | --- | --- | --- | --- | --- |
23
+ | modelValue (v-model) | String / Array | - | | 文件ID,多文件时为数组 |
24
+ | data (v-model:data) | Array | - | | 文件详细数据(含 id 和 filename) |
25
+ | readonly | Boolean | `false` | | 是否只读 |
26
+ | multiple | Boolean | `false` | | 是否支持多文件上传 |
27
+ | limitSize | Number | `1` | | 单个文件大小限制(MB) |
28
+ | moreConfig | Object | `{ maxCount: 1, layout: 'horizontal' }` | | 上传组件额外配置 |
29
+ | refid | String | - | | 业务关联ID |
30
+ | ref_id | String | - | 否 | 引用记录ID |
31
+ | ref_type | String / Number | - | 否 | 引用类型 |
32
+ | drag | Boolean | `true` | 否 | 是否启用拖拽上传 |
33
+ | showButtonText | Boolean | `false` | 否 | 是否显示按钮文字 |
@@ -208,7 +208,7 @@
208
208
  const arr = Array.isArray(val) ? val : [val];
209
209
  const v = Array.isArray(data.value) ? data.value : [data.value];
210
210
  originList.value = arr.map((item) => {
211
- const filename = v?.find((row) => row?.id === item)?.filename || item.id;
211
+ const filename = v?.find((row) => row?.id === item)?.filename || item;
212
212
  return {
213
213
  id: item,
214
214
  name: filename,
@@ -1,41 +1,45 @@
1
- # SohelpFilterScheme 过滤方案组件
1
+ # SohelpFilterScheme 筛选方案
2
2
 
3
- 提供多维度的筛选功能,支持关键字搜索、高级条件筛选以及保存/加载筛选方案。
3
+ 基于 `ele-card` 和 `ele-tabs` 封装的多模式筛选组件,支持快捷筛选(关键字)、高级筛选和场景筛选三种模式。
4
4
 
5
5
  ## 基础用法
6
6
 
7
- ```html
8
- <sohelp-filter-scheme
9
- v-model="filterData"
10
- :config="filterConfig"
11
- @filter="handleFilter"
12
- />
7
+ ```vue
8
+ <template>
9
+ <sohelp-filter-scheme
10
+ v-model="filterData"
11
+ :filterConfig="filterConfig"
12
+ :propertiesMap="propertiesMap"
13
+ refid="myRefId"
14
+ @filter="onFilter"
15
+ />
16
+ </template>
17
+
18
+ <script setup>
19
+ import { ref } from 'vue';
20
+ const filterData = ref({ keywords: '', filter: {}, scheme: '' });
21
+ const filterConfig = ref({ keywords: ['name', 'phone'] });
22
+ const propertiesMap = ref({
23
+ name: { label: '姓名' },
24
+ phone: { label: '电话' }
25
+ });
26
+ const onFilter = () => { /* 执行筛选 */ };
27
+ </script>
13
28
  ```
14
29
 
15
30
  ## 属性 (Props)
16
31
 
17
- | 属性名 | 类型 | 默认值 | 说明 |
18
- | modelValue | Object | {} | 筛选表单数据对象 |
19
- | config | Object | {} | 筛选配置对象,包含字段定义、方案列表等 |
32
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 |
33
+ | --- | --- | --- | --- | --- |
34
+ | modelValue (v-model) | Object | `{ keywords: '', filter: {}, scheme: '' }` | | 筛选表单数据 |
35
+ | filterConfig | Object | `{}` | 是 | 筛选配置,如 `{ keywords: ['field1', 'field2'] }` |
36
+ | propertiesMap | Object | - | 否 | 字段属性映射,用于显示字段标签 |
37
+ | refid | String | - | 否 | 业务关联ID |
20
38
 
21
39
  ## 事件 (Events)
22
40
 
23
- | 事件名 | 说明 | 回调参数 |
24
- | update:modelValue | 筛选数据更新时触发 | (value: Object) |
25
- | filter | 点击查询或重置时触发 | - |
26
-
27
- ## 主要功能
28
-
29
- 1. **关键字搜索**: 提供简单的输入框进行模糊查询。
30
- 2. **高级筛选**: 根据配置的字段生成表单,支持多种输入类型(文本、日期、选择器等)。
31
- 3. **筛选方案**:
32
- - 支持保存当前的筛选条件为方案。
33
- - 支持切换不同的筛选方案。
34
- - 支持设置默认方案。
35
- 4. **常用条件**: 快速选择预设的常用条件。
36
-
37
- ## 内部方法
38
-
39
- - `onFilter`: 触发筛选事件。
40
- - `onReset`: 重置筛选条件为初始值。
41
- - `saveScheme`: 保存当前筛选条件为新方案。
41
+ | 事件名 | 回调参数 | 说明 |
42
+ | --- | --- | --- |
43
+ | update:modelValue | `value: Object` | 筛选数据变更时触发 |
44
+ | filter | - | 点击"筛选"或"重置"按钮时触发 |
45
+ | reset | - | 点击"重置"按钮时触发 |