resolver-egretimp-plus 0.1.113 → 0.1.115

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 (219) hide show
  1. package/dist/h5/index.js +1 -1
  2. package/dist/theme/element/index.css +1 -1
  3. package/dist/theme/element/src/components/common.scss +4 -0
  4. package/dist/theme/element/src/components/text.scss +17 -0
  5. package/dist/web/index.js +2 -2
  6. package/package.json +1 -1
  7. package/src/analysisComponent.jsx +2 -1
  8. package/src/components/helper/table.jsx +26 -23
  9. package/src/components/packages-H5/CustomComponentCollapseH5.vue +6 -2
  10. package/src/components/packages-web/ElText.jsx +0 -1
  11. package/src/theme/element/components/common.scss +4 -0
  12. package/src/theme/element/components/text.scss +17 -0
  13. package/src-bak/analysisComponent.jsx +343 -0
  14. package/src-bak/api/builtIn.js +10 -0
  15. package/src-bak/bpm/bpmInstance.js +388 -0
  16. package/src-bak/bpm/udc-sdk-esm/cjs/impl/application.js +8 -0
  17. package/src-bak/bpm/udc-sdk-esm/cjs/impl/component.js +97 -0
  18. package/src-bak/bpm/udc-sdk-esm/cjs/impl/datasource.js +88 -0
  19. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/index.js +3 -0
  20. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/UdcComponent.js +76 -0
  21. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/index.js +201 -0
  22. package/src-bak/bpm/udc-sdk-esm/cjs/impl/index.js +69 -0
  23. package/src-bak/bpm/udc-sdk-esm/cjs/impl/page.js +56 -0
  24. package/src-bak/bpm/udc-sdk-esm/cjs/impl/utils.js +76 -0
  25. package/src-bak/bpm/udc-sdk-esm/cjs/index.js +46 -0
  26. package/src-bak/bpm/udc-sdk-esm/cjs/utils.js +21 -0
  27. package/src-bak/components/childDialog/index.js +39 -0
  28. package/src-bak/components/childDialog/src/index.vue +185 -0
  29. package/src-bak/components/cmiFormItem/index.js +1 -0
  30. package/src-bak/components/cmiFormItem/src/index.vue +112 -0
  31. package/src-bak/components/confirmInstance-H5/index.js +53 -0
  32. package/src-bak/components/confirmInstance-H5/src/index.vue +54 -0
  33. package/src-bak/components/helper/FormPolyfill.jsx +25 -0
  34. package/src-bak/components/helper/calcTooltip.jsx +134 -0
  35. package/src-bak/components/helper/dock.js +141 -0
  36. package/src-bak/components/helper/eventOrchestration.js +763 -0
  37. package/src-bak/components/helper/resolver.js +163 -0
  38. package/src-bak/components/helper/table.jsx +103 -0
  39. package/src-bak/components/icons/date.vue +33 -0
  40. package/src-bak/components/icons/info.vue +62 -0
  41. package/src-bak/components/icons/loading.vue +19 -0
  42. package/src-bak/components/icons/question-filled.vue +8 -0
  43. package/src-bak/components/loading/index.js +6 -0
  44. package/src-bak/components/loading/loading.js +98 -0
  45. package/src-bak/components/loading/loading.scss +74 -0
  46. package/src-bak/components/loading/loading.vue +89 -0
  47. package/src-bak/components/loadingComponent/LoadingComponent.vue +33 -0
  48. package/src-bak/components/modal/index.js +9 -0
  49. package/src-bak/components/modal/modal.scss +195 -0
  50. package/src-bak/components/modal/modal.vue +201 -0
  51. package/src-bak/components/options/OptionsDefault.vue +47 -0
  52. package/src-bak/components/packages-H5/CmiButton.vue +120 -0
  53. package/src-bak/components/packages-H5/CmiCalendar.vue +152 -0
  54. package/src-bak/components/packages-H5/CmiCell.vue +87 -0
  55. package/src-bak/components/packages-H5/CmiCheckbox.vue +82 -0
  56. package/src-bak/components/packages-H5/CmiDatetimePicker.vue +98 -0
  57. package/src-bak/components/packages-H5/CmiDivider.vue +30 -0
  58. package/src-bak/components/packages-H5/CmiDropdownMenu.vue +58 -0
  59. package/src-bak/components/packages-H5/CmiInput.vue +69 -0
  60. package/src-bak/components/packages-H5/CmiLink.vue +28 -0
  61. package/src-bak/components/packages-H5/CmiPicker.vue +229 -0
  62. package/src-bak/components/packages-H5/CmiRadio.vue +29 -0
  63. package/src-bak/components/packages-H5/CmiSearch.vue +39 -0
  64. package/src-bak/components/packages-H5/CmiSelect.vue +84 -0
  65. package/src-bak/components/packages-H5/CustomComponentCardH5.vue +129 -0
  66. package/src-bak/components/packages-H5/CustomComponentColH5.vue +8 -0
  67. package/src-bak/components/packages-H5/CustomComponentCollapseH5.vue +137 -0
  68. package/src-bak/components/packages-H5/CustomComponentFormLayoutH5.vue +54 -0
  69. package/src-bak/components/packages-H5/CustomComponentTabPaneH5.vue +38 -0
  70. package/src-bak/components/packages-H5/CustomComponentTableH5.vue +352 -0
  71. package/src-bak/components/packages-H5/CustomComponentTabsH5.vue +170 -0
  72. package/src-bak/components/packages-web/CustomComponentCard.vue +40 -0
  73. package/src-bak/components/packages-web/CustomComponentCol.vue +66 -0
  74. package/src-bak/components/packages-web/CustomComponentCollapse.vue +164 -0
  75. package/src-bak/components/packages-web/CustomComponentCycle.vue +95 -0
  76. package/src-bak/components/packages-web/CustomComponentCycleTabPane.vue +155 -0
  77. package/src-bak/components/packages-web/CustomComponentDialog.vue +192 -0
  78. package/src-bak/components/packages-web/CustomComponentEditor.vue +50 -0
  79. package/src-bak/components/packages-web/CustomComponentFileExport.vue +60 -0
  80. package/src-bak/components/packages-web/CustomComponentFileImport.vue +60 -0
  81. package/src-bak/components/packages-web/CustomComponentFormLayout.vue +65 -0
  82. package/src-bak/components/packages-web/CustomComponentGrid.vue +29 -0
  83. package/src-bak/components/packages-web/CustomComponentGridCol.vue +29 -0
  84. package/src-bak/components/packages-web/CustomComponentInputDialog.vue +144 -0
  85. package/src-bak/components/packages-web/CustomComponentNativeTabPane.vue +84 -0
  86. package/src-bak/components/packages-web/CustomComponentPlain.vue +243 -0
  87. package/src-bak/components/packages-web/CustomComponentRow.vue +83 -0
  88. package/src-bak/components/packages-web/CustomComponentSelectEmployees.vue +203 -0
  89. package/src-bak/components/packages-web/CustomComponentSendMail.vue +62 -0
  90. package/src-bak/components/packages-web/CustomComponentSteps.vue +41 -0
  91. package/src-bak/components/packages-web/CustomComponentTabPane.vue +20 -0
  92. package/src-bak/components/packages-web/CustomComponentTable.jsx +813 -0
  93. package/src-bak/components/packages-web/CustomComponentTabs.vue +126 -0
  94. package/src-bak/components/packages-web/CustomComponentTree.vue +28 -0
  95. package/src-bak/components/packages-web/ElButton.vue +146 -0
  96. package/src-bak/components/packages-web/ElCheckbox.vue +97 -0
  97. package/src-bak/components/packages-web/ElDatePicker.vue +93 -0
  98. package/src-bak/components/packages-web/ElInput copy.jsx +393 -0
  99. package/src-bak/components/packages-web/ElInput.jsx +312 -0
  100. package/src-bak/components/packages-web/ElInputNumber.vue +81 -0
  101. package/src-bak/components/packages-web/ElPagination.vue +61 -0
  102. package/src-bak/components/packages-web/ElRadio.vue +47 -0
  103. package/src-bak/components/packages-web/ElSelect.jsx +249 -0
  104. package/src-bak/components/packages-web/ElSelect_bak.vue +155 -0
  105. package/src-bak/components/packages-web/ElText.jsx +187 -0
  106. package/src-bak/components/packages-web/ElTextaa.vue +169 -0
  107. package/src-bak/components/packages-web/ElTimePicker.vue +39 -0
  108. package/src-bak/components/patchComponents-H5.js +46 -0
  109. package/src-bak/components/patchComponents-web.js +46 -0
  110. package/src-bak/components/simpleFormItemPc/index.js +1 -0
  111. package/src-bak/components/simpleFormItemPc/src/index.vue +94 -0
  112. package/src-bak/components/table/index.ts +29 -0
  113. package/src-bak/components/table/src/composables/use-scrollbar.ts +30 -0
  114. package/src-bak/components/table/src/config.ts +256 -0
  115. package/src-bak/components/table/src/filter-panel.vue +260 -0
  116. package/src-bak/components/table/src/h-helper.ts +34 -0
  117. package/src-bak/components/table/src/layout-observer.ts +78 -0
  118. package/src-bak/components/table/src/store/current.ts +85 -0
  119. package/src-bak/components/table/src/store/expand.ts +76 -0
  120. package/src-bak/components/table/src/store/helper.ts +74 -0
  121. package/src-bak/components/table/src/store/index.ts +246 -0
  122. package/src-bak/components/table/src/store/tree.ts +230 -0
  123. package/src-bak/components/table/src/store/watcher.ts +543 -0
  124. package/src-bak/components/table/src/table/defaults.ts +402 -0
  125. package/src-bak/components/table/src/table/key-render-helper.ts +27 -0
  126. package/src-bak/components/table/src/table/style-helper.ts +378 -0
  127. package/src-bak/components/table/src/table/utils-helper.ts +47 -0
  128. package/src-bak/components/table/src/table-body/defaults.ts +52 -0
  129. package/src-bak/components/table/src/table-body/events-helper.ts +203 -0
  130. package/src-bak/components/table/src/table-body/index.ts +119 -0
  131. package/src-bak/components/table/src/table-body/render-helper.ts +283 -0
  132. package/src-bak/components/table/src/table-body/styles-helper.ts +164 -0
  133. package/src-bak/components/table/src/table-column/defaults.ts +237 -0
  134. package/src-bak/components/table/src/table-column/index.ts +202 -0
  135. package/src-bak/components/table/src/table-column/render-helper.ts +214 -0
  136. package/src-bak/components/table/src/table-column/watcher-helper.ts +88 -0
  137. package/src-bak/components/table/src/table-footer/index.ts +128 -0
  138. package/src-bak/components/table/src/table-footer/mapState-helper.ts +33 -0
  139. package/src-bak/components/table/src/table-footer/style-helper.ts +51 -0
  140. package/src-bak/components/table/src/table-header/event-helper.ts +213 -0
  141. package/src-bak/components/table/src/table-header/index.ts +244 -0
  142. package/src-bak/components/table/src/table-header/style.helper.ts +119 -0
  143. package/src-bak/components/table/src/table-header/utils-helper.ts +94 -0
  144. package/src-bak/components/table/src/table-layout.ts +259 -0
  145. package/src-bak/components/table/src/table.vue +389 -0
  146. package/src-bak/components/table/src/tableColumn.ts +3 -0
  147. package/src-bak/components/table/src/tokens.ts +5 -0
  148. package/src-bak/components/table/src/util.ts +521 -0
  149. package/src-bak/components/table/style/css.ts +5 -0
  150. package/src-bak/components/table/style/index.ts +5 -0
  151. package/src-bak/components/tabs/index.js +8 -0
  152. package/src-bak/components/tabs/src/constants.js +23 -0
  153. package/src-bak/components/tabs/src/tab-bar.js +8 -0
  154. package/src-bak/components/tabs/src/tab-bar.vue +92 -0
  155. package/src-bak/components/tabs/src/tab-nav.jsx +424 -0
  156. package/src-bak/components/tabs/src/tab-pane.js +16 -0
  157. package/src-bak/components/tabs/src/tab-pane.vue +80 -0
  158. package/src-bak/components/tabs/src/tabs.jsx +223 -0
  159. package/src-bak/components/tabs/style/css.js +2 -0
  160. package/src-bak/components/tabs/style/index.js +2 -0
  161. package/src-bak/components/thirdPartyFrame/index.js +32 -0
  162. package/src-bak/components/thirdPartyFrame/src/ThirdPartyFrame.vue +125 -0
  163. package/src-bak/enums/index.js +16 -0
  164. package/src-bak/hooks/configLoad.js +45 -0
  165. package/src-bak/hooks/index.js +189 -0
  166. package/src-bak/hooks/mock.js +6960 -0
  167. package/src-bak/hooks/pageConfig.js +127 -0
  168. package/src-bak/index.jsx +440 -0
  169. package/src-bak/renderer.jsx +77 -0
  170. package/src-bak/resolver-H5.vue +88 -0
  171. package/src-bak/resolver-common.vue +129 -0
  172. package/src-bak/resolver-web.vue +91 -0
  173. package/src-bak/rules/eventsSupplement.js +573 -0
  174. package/src-bak/rules/parseCondition.js +378 -0
  175. package/src-bak/rules/ruleUtils.js +273 -0
  176. package/src-bak/rules/rulesDriver.js +118 -0
  177. package/src-bak/rulesImp/events.js +588 -0
  178. package/src-bak/rulesImp/index.js +33 -0
  179. package/src-bak/rulesImp/ruleInstance.js +231 -0
  180. package/src-bak/rulesImp/ruleUtils.js +124 -0
  181. package/src-bak/theme/element/components/button.scss +122 -0
  182. package/src-bak/theme/element/components/card.scss +8 -0
  183. package/src-bak/theme/element/components/checkbox.scss +19 -0
  184. package/src-bak/theme/element/components/collapse.scss +174 -0
  185. package/src-bak/theme/element/components/common.scss +30 -0
  186. package/src-bak/theme/element/components/cycle.scss +0 -0
  187. package/src-bak/theme/element/components/date.scss +13 -0
  188. package/src-bak/theme/element/components/dialog.scss +44 -0
  189. package/src-bak/theme/element/components/form.scss +104 -0
  190. package/src-bak/theme/element/components/index.scss +55 -0
  191. package/src-bak/theme/element/components/input.scss +36 -0
  192. package/src-bak/theme/element/components/message.scss +48 -0
  193. package/src-bak/theme/element/components/pagination.scss +47 -0
  194. package/src-bak/theme/element/components/popper.scss +3 -0
  195. package/src-bak/theme/element/components/radio.scss +40 -0
  196. package/src-bak/theme/element/components/scrollbar.scss +14 -0
  197. package/src-bak/theme/element/components/select.scss +82 -0
  198. package/src-bak/theme/element/components/steps.scss +6 -0
  199. package/{src/components/styles/CustomComponenTable.scss → src-bak/theme/element/components/table.scss} +90 -13
  200. package/src-bak/theme/element/components/tabs.scss +128 -0
  201. package/src-bak/theme/element/components/tag.scss +6 -0
  202. package/{src/components/styles → src-bak/theme/element/components}/text.scss +3 -3
  203. package/src-bak/theme/element/components/textarea.scss +3 -0
  204. package/src-bak/theme/element/components/tree.scss +0 -0
  205. package/src-bak/theme/element/index.scss +55 -0
  206. package/src-bak/utils/cipher.js +141 -0
  207. package/src-bak/utils/common.js +664 -0
  208. package/src-bak/utils/const.js +259 -0
  209. package/src-bak/utils/defaultVal.js +92 -0
  210. package/src-bak/utils/dom.js +36 -0
  211. package/src-bak/utils/format.js +19 -0
  212. package/src-bak/utils/index.js +4 -0
  213. package/src-bak/utils/is.js +74 -0
  214. package/src-bak/utils/loadModule.js +75 -0
  215. package/src-bak/utils/preserveFunc.js +33 -0
  216. package/src-bak/utils/render.jsx +1138 -0
  217. package/src-bak/utils/request.js +136 -0
  218. package/src-bak/utils/respone.js +70 -0
  219. package/src-bak/utils/valid.js +89 -0
@@ -0,0 +1,813 @@
1
+
2
+ import { ElAutoResizer, ElPagination, ElTableV2, formContextKey } from 'element-plus'
3
+ import ElTable, { ElTableColumn } from '../table'
4
+ import Renderer from '../../renderer.jsx'
5
+ import { computed, inject, watch, h, ref, reactive, onMounted, unref } from 'vue'
6
+ import { commonPropsType, TABLE_COLUMN_NOT_RENDER_META_TYPE, DISPLAY_SHOW, compareComponet, isPlainObject, hasOwn, cloneDeep, isPromise, isPlainColumn, generateUniqueId, calcDisable, camelize, capitalize, DISPLAY_HIDDEN, definePrivatelyProp, isArray, eleIsOverflow } from '../../utils/index.js'
7
+ import { getCustomerTableProps, tableValidate } from '../helper/table'
8
+ // import '../styles/CustomComponenTable.scss'
9
+
10
+ export default {
11
+ inheritAttrs: false,
12
+ name: 'CustomComponentTable',
13
+ props: getCustomerTableProps(commonPropsType, ElTableV2, ElTable, ElPagination),
14
+ setup(props, { expose, attrs, emit }) {
15
+ // 虚拟表格列的属性 'hidden'不需要这个属性,额外控制
16
+ const virtualizedColumnPropKeys = ['align', 'class', 'key', 'dataKey', 'fixed', 'flexGrow', 'flexShrink', 'headerClass', 'style', 'sortable', 'title', 'maxWidth', 'minWidth', 'width']
17
+ // 开启虚拟化表格
18
+ const isVirtualized = computed(() => {
19
+ return props.config?.isVirtualized == '1'
20
+ })
21
+ const toopTip = reactive({
22
+ show: false,
23
+ triggerRef: null,
24
+ content: ''
25
+ })
26
+
27
+ // let pageSize = 10 // 默认每页5条
28
+ // if (props.config?.pageSize) {
29
+ // pageSize = parseInt(props.config.pageSize) || 5
30
+ // }
31
+
32
+ const defaultPageablePageSize = computed({
33
+ get() {
34
+ return parseInt(props.config.defaultPageablePageSize) || 10 // 默认每页5条
35
+ },
36
+ set(val) {
37
+ props.config.defaultPageablePageSize = val
38
+ }
39
+ })
40
+ const pageSize = computed({
41
+ get() {
42
+ if (defaultPageable.value) {
43
+ return defaultPageablePageSize.value
44
+ }
45
+ return parseInt(props.config.pageSize) || 5 // 默认每页5条
46
+ },
47
+ set(val) {
48
+ if (defaultPageable.value) {
49
+ defaultPageablePageSize.value = val
50
+ }
51
+ props.config.pageSize = val
52
+ }
53
+ })
54
+ const page = reactive({
55
+ pageNum: 1,
56
+ pageSize,
57
+ total: 0,
58
+ })
59
+
60
+ // 在数据量超过10的话,默认开启分页功能
61
+ const defaultPageable = computed(() => {
62
+ return !(props.config?.frontPageFlag == '1' || props.config?.pageable == '1') && modelValue.value?.length > 10
63
+ })
64
+
65
+ // 开启前端分页
66
+ const isFrontPage = computed(() => {
67
+ return (props.config?.frontPageFlag == '1' || defaultPageable.value) && !isVirtualized.value
68
+ })
69
+
70
+ // 是否开启分页功能 ====== start======
71
+ const pageable = computed(() => {
72
+ return (isFrontPage.value || props.config?.pageable == '1') && !isVirtualized.value
73
+ })
74
+
75
+ // 分页器布局模式
76
+ const pageAlign = computed(() => {
77
+ return props.config?.pageAlign
78
+ })
79
+ const PAGE_LEFT = 'left'
80
+ const PAGE_CENTER = 'center'
81
+ const PAGE_RIGHT = 'right'
82
+ const pageAlignEnmu = {
83
+ [PAGE_LEFT]: 'flex-start',
84
+ [PAGE_RIGHT]: 'flex-end',
85
+ [PAGE_CENTER]: 'center'
86
+ }
87
+ // 表格是否开启单行可选择配置
88
+ const selectable = computed(() => {
89
+ return props.config?.selectable == '1' || props.config?.canSelect
90
+ })
91
+ const formContext = inject(formContextKey, undefined)
92
+ const messageInstance = inject('_messageInstance')
93
+ const indectModeRef = inject('indectModeRef', ref(''))
94
+ const ruleExecuter = inject('_ruleExecuter')
95
+ const dynamicMapComp = inject('dynamicMapComp')
96
+ const parentRootValue = inject('_parentRootValue', {})
97
+ const parentDynamicMapComp = inject('_parentDynamicMapComp', {})
98
+ const selectionsObj = inject('_selectionsObj', {})
99
+ const rootStore = inject('_rootStore', {})
100
+ const lang = inject('lang')
101
+ const rootValue = inject('rootValue')
102
+ const selects = inject('selects')
103
+ const modelValue = computed({
104
+ get() {
105
+ return props.modelValue
106
+ },
107
+ set(val) {
108
+ emit('update:modelValue', val)
109
+ }
110
+ })
111
+ const tableProps = computed(() => {
112
+ const tableComp = isVirtualized.value ? ElTableV2 : ElTable
113
+ const porpsObj = Object.keys(tableComp.props).reduce((ret, key) => {
114
+ if (props[key] !== undefined && props[key] !== null) {
115
+ ret[key] = props[key]
116
+ }
117
+ return ret
118
+ }, {})
119
+ if (!porpsObj.border) {
120
+ porpsObj.border = true
121
+ }
122
+ if (!porpsObj.stripe) {
123
+ porpsObj.stripe = true
124
+ }
125
+ if (isVirtualized.value) {
126
+ const oldHeaderClass = porpsObj.headerClass
127
+ porpsObj.headerClass = function(params) {
128
+ let ret = 'table-v2-common-row'
129
+ const oldVal = typeof oldHeaderClass === 'function' ? oldHeaderClass(params) : oldHeaderClass
130
+ if (oldVal) {
131
+ ret = `${oldVal} ${ret}`
132
+ }
133
+ return ret
134
+ }
135
+ const oldRowClass = porpsObj.rowClass
136
+ porpsObj.rowClass = function(params) {
137
+ const {rowIndex} = params
138
+ let ret = 'table-v2-common-row'
139
+ const oldVal = typeof oldRowClass === 'function' ? oldRowClass(params) : oldRowClass
140
+ if (oldVal) {
141
+ ret = `${oldVal} ${ret}`
142
+ }
143
+ if (rowIndex % 2 === 1) {
144
+ ret = `${ret} table-v2-striped`
145
+ }
146
+ return ret
147
+ }
148
+ }
149
+ return porpsObj
150
+ })
151
+
152
+ const getCompEvents = (comp) => {
153
+ let emitKeys = comp.emits || {}
154
+ if(!Array.isArray(emitKeys)) {
155
+ emitKeys = Object.keys(emitKeys)
156
+ }
157
+ return emitKeys.reduce((ret, key) => {
158
+ const eventKey = `on${capitalize(camelize(key))}`
159
+ if (hasOwn(attrs, eventKey)) {
160
+ ret[eventKey] = attrs[eventKey]
161
+ }
162
+ return ret
163
+ }, {})
164
+ }
165
+
166
+ const tableEvents = computed(() => {
167
+ const tableComp = isVirtualized.value ? ElTableV2 : ElTable
168
+ return getCompEvents(tableComp)
169
+ })
170
+ const sliceTableEvents = computed(() => {
171
+ const ret = {
172
+ ...(tableEvents.value || {})
173
+ }
174
+ delete ret.onSortChange
175
+ return ret
176
+ })
177
+ const pagenationEvents = computed(() => {
178
+ return getCompEvents(ElPagination)
179
+ })
180
+
181
+ const tableColumnFirstMetaCode = ref("")
182
+ const tableColumnConfigs = computed(() => {
183
+ let pmPageMetaList = props.config.pmPageMetaList || []
184
+ return pmPageMetaList.map((config) => {
185
+ if (
186
+ config.displayType !== DISPLAY_HIDDEN &&
187
+ !((props.width == 0 || props.width == '0px' || config.hidden == '1')) &&
188
+ !tableColumnFirstMetaCode.value
189
+ ) {
190
+ tableColumnFirstMetaCode.value = config.metaCode
191
+ }
192
+ return normalColumnConfig(config)
193
+ })
194
+ })
195
+
196
+ const normalPageTotal = computed(() => {
197
+ return !isFrontPage.value ? page.total : ((modelValue.value || [])?.length || 0)
198
+ })
199
+
200
+ const normalTableData = computed(() => {
201
+ return !isFrontPage.value ?
202
+ (modelValue.value || []) :
203
+ (modelValue.value || []).slice((page.pageNum - 1) * page.pageSize, page.pageNum * page.pageSize)
204
+ })
205
+
206
+ /** 自定义排序逻辑 ===start==== */
207
+ const sortObj = ref(null)
208
+ // "ascending", "descending", null
209
+ const onSortChange = ({ prop, order }) => {
210
+ tableEvents.value?.onSortChange?.({ prop, order })
211
+
212
+ sortObj.value = null
213
+ if (order) {
214
+ sortObj.value = {prop, order}
215
+ }
216
+ }
217
+ const sortTable = computed(() => {
218
+ if (!sortObj.value) {
219
+ return []
220
+ }
221
+ const sortList = [sortObj.value]
222
+ const ret = sortList.reduce((ret, item) => {
223
+ ret = ret.sort((a, b) => {
224
+ if (a[item.prop] === '' || a[item.prop] === undefined || a[item.prop] === null) {
225
+ return item.order === 'descending' ? 1 : -1
226
+ }
227
+ if (b[item.prop] === '' || b[item.prop] === undefined || b[item.prop] === null) {
228
+ return item.order === 'descending' ? -1 : 1
229
+ }
230
+ let aVal = a[item.prop]
231
+ let bVal = b[item.prop]
232
+ if (!Number.isNaN(+(a[item.prop])) && !Number.isNaN(+(b[item.prop]))) {
233
+ aVal = +(a[item.prop])
234
+ bVal = +(b[item.prop])
235
+ }
236
+ return (aVal > bVal ? (item.order === 'descending' ? -1 : 1) : aVal === bVal ? 0 : (item.order === 'descending' ? 1 : -1))
237
+ })
238
+ return ret
239
+ }, [...(normalTableData.value || [])])
240
+ return ret
241
+ })
242
+
243
+ const tableData = computed(() => {
244
+ return sortObj.value ? sortTable.value : normalTableData.value
245
+ })
246
+ /** 自定义排序逻辑 ===end==== */
247
+
248
+ // 获取表格列的属性配置
249
+ function getTableColumnProps(config, idx) {
250
+ const nextList = tableColumnConfigs.value.slice(idx + 1)
251
+ // 当前config表格列是最后一个显示列,并且后面有hidden的列
252
+ const isEndConfig = !nextList?.filter(config => {
253
+ return config.displayType != DISPLAY_HIDDEN && !(config.width == 0 || config.width == '0px' || config.hidden == '1')
254
+ })?.length
255
+ const nextConfig = nextList.find(config => config.displayType != DISPLAY_HIDDEN)
256
+ let columnkeys = virtualizedColumnPropKeys
257
+ if (!isVirtualized.value) {
258
+ columnkeys = Object.keys(ElTableColumn.props)
259
+ }
260
+ const retObj = columnkeys.reduce((ret, key) => {
261
+ if (hasOwn(config, key)) {
262
+ ret[key] = config[key]
263
+ }
264
+ return ret
265
+ }, {})
266
+
267
+ if (config.columnWidth) {
268
+ retObj.width = config.columnWidth
269
+ }
270
+ if (!retObj.width) {
271
+ retObj.minWidth = 160
272
+ }
273
+ if (retObj.width == 0 || retObj.width == '0px' || config.hidden == '1') {
274
+ retObj.className = 'hidden-column'
275
+ retObj.width = 1
276
+ }
277
+ if (nextConfig && (nextConfig.width == 0 || nextConfig.width == '0px' || nextConfig.hidden == '1')) {
278
+ retObj.className = `${retObj.className || ''} next-hidden-column`
279
+ }
280
+ if (isEndConfig) {
281
+ retObj.className = `${retObj.className || ''} end-show-column`
282
+ }
283
+ if (config.metaType == 'CustomComponentSelectEmployees') {
284
+ retObj.className = `${retObj.className || ''} clear-index`
285
+ }
286
+ if (!isVirtualized.value) {
287
+ retObj.className = `${retObj.className} cell-col-ellipsis`
288
+ if (!retObj.prop) {
289
+ retObj.prop = config.metaCode
290
+ }
291
+ // table设置show-overflow-tooltip额外的逻辑=====start=====
292
+ if (config.showOverflowTooltip == '1' || config['show-overflow-tooltip'] == '1') {
293
+ retObj['show-overflow-tooltip'] = true
294
+ retObj.showOverflowTooltip = true
295
+ } else {
296
+ retObj['show-overflow-tooltip'] = false
297
+ retObj.showOverflowTooltip = false
298
+ }
299
+ if (
300
+ isPlainColumn({...config, isColumn: true}, true) &&
301
+ config.showOverflowTooltip != '0' &&
302
+ config['show-overflow-tooltip'] != '0'
303
+ ) {
304
+ const showOverflowTooltipFn = (data) => {
305
+ const currentConfig = multiPmPageMetaList.value?.[data.$index]?.[idx]
306
+ if (currentConfig) {
307
+ return isPlainColumn({...currentConfig, isColumn: true}, calcDisable(currentConfig, indectModeRef.value))
308
+ }
309
+ return true
310
+ }
311
+ retObj['show-overflow-tooltip'] = showOverflowTooltipFn
312
+ retObj.showOverflowTooltip = showOverflowTooltipFn
313
+ }
314
+ // table设置show-overflow-tooltip额外的逻辑=====end=====
315
+ if (config.type === 'selection') {
316
+ const orginSelectable = retObj.selectable
317
+ retObj.selectable = (row, index) => {
318
+ let orginRet = true
319
+ if (orginSelectable && typeof orginSelectable === 'function') {
320
+ orginRet = orginSelectable(row, index, {
321
+ tableConfig: props.config,
322
+ rootValue: rootValue,
323
+ parentRootValue,
324
+ parentDynamicMapComp
325
+ })
326
+ }
327
+ let parentSelectionsRet = true
328
+ if (selectionsObj.selections && selectionsObj.selections.length && selectionsObj.primaryKeys && selectionsObj.primaryKeys.length) {
329
+ const hasRow = selectionsObj.selections?.some(selectRow => {
330
+ return selectionsObj.primaryKeys.map(key => key && selectRow[key] == row[key]).every(item => item)
331
+ })
332
+ parentSelectionsRet = !hasRow
333
+ }
334
+ return orginRet && parentSelectionsRet
335
+ }
336
+ }
337
+ }
338
+
339
+ if (isVirtualized.value) {
340
+ let classValue = retObj.className || ''
341
+ if (retObj.width) {
342
+ retObj.width = parseInt(retObj.width)
343
+ } else {
344
+ retObj.width = 160
345
+ classValue = `${classValue} flex-grow-import`
346
+ }
347
+ retObj.class = `${classValue} table-body-cell`
348
+ retObj.headerClass = `${classValue} table-head-cell`
349
+ }
350
+
351
+ return retObj
352
+ }
353
+
354
+ // 获取表格的配置,这边会做一下配置转化,表格中的不需要labelWidth
355
+ function normalColumnConfig(config) {
356
+ return {
357
+ ...config,
358
+ labelHidden: '1'
359
+ }
360
+ }
361
+
362
+ // 列中是否需要展示render渲染
363
+ function tableColumnNotRender(config) {
364
+ if (!config) return true
365
+ // if (config['show-overflow-tooltip'] || config.showOverflowTooltip) return true
366
+ // 'selection', 'index' 是el-table属性type中type的两个枚举,这两个直接使用默认效果
367
+ if (['selection', 'index'].includes(config.type)) {
368
+ return true
369
+ }
370
+ const metaTypeNotRender = TABLE_COLUMN_NOT_RENDER_META_TYPE.some(metaType => compareComponet(metaType, config.metaType)) || !config.metaType
371
+ return !config.renderby && metaTypeNotRender
372
+ }
373
+
374
+ function getValue(idx) {
375
+ return tableData.value?.[idx]
376
+ }
377
+ function onUpdateModelValue(val, idx) {
378
+ if (!modelValue.value) {
379
+ modelValue.value = []
380
+ }
381
+ modelValue.value[idx] = val
382
+ }
383
+
384
+ const multiPmPageMetaList = computed(() => {
385
+ return props.config.multiPmPageMetaList || []
386
+ })
387
+
388
+ /**
389
+ * 设置 multiPmPageMetaList 的值
390
+ * multiPmPageMetaList值主要作用是区分列的每一行都需要有单独的config,接口配置返回的只是列的配置,
391
+ * 所以这边需要单独再坐下处理
392
+ */
393
+ const rowColumnConfgsMap = new Map()
394
+ watch(() => {
395
+ return tableData?.value?.length
396
+ }, (length) => {
397
+ let list = []
398
+ if (length) {
399
+ const newVal = tableData.value
400
+ list = newVal?.map?.((row, idx) => {
401
+ const columnsCgs = rowColumnConfgsMap.get(row)
402
+ if (columnsCgs) {
403
+ columnsCgs.forEach(config => {
404
+ config.rowIndex = idx
405
+ })
406
+ return columnsCgs
407
+ } else {
408
+ const retColumnConfigs = tableColumnConfigs.value.map((config, relIdx) => {
409
+ const ret = cloneDeep(config)
410
+ if (ret.width && !ret.columnWidth) {
411
+ ret.columnWidth = ret.width
412
+ delete ret.width
413
+ }
414
+ ret.columnId = generateUniqueId()
415
+ ret.rowIndex = idx
416
+ ret.isColumn = true
417
+ ret.refConfig = props?.config?.pmPageMetaList?.[relIdx]
418
+ ret.parent = props?.config // 这边手动设置一下,防止组件复用的时候不会刷新,造成parent的丢失
419
+ return ret
420
+ })
421
+ rowColumnConfgsMap.set(row, retColumnConfigs)
422
+ return retColumnConfigs
423
+ }
424
+ })
425
+ }
426
+ definePrivatelyProp(props.config, 'multiPmPageMetaList', list)
427
+ }, {
428
+ immediate: true,
429
+ deep: true,
430
+ })
431
+ // 统计行定义 ====start======
432
+ const totalMetaCodes = computed(() => {
433
+ return props.config?.totalMetaCodes || []
434
+ })
435
+ const normalTotalCodes = computed(() => {
436
+ return totalMetaCodes.value.map(code => {
437
+ if (typeof code === 'string') {
438
+ return {
439
+ code,
440
+ totalFn: defaultTotalFn
441
+ }
442
+ } else {
443
+ if (isPlainObject(code) && hasOwn(code, 'code')) {
444
+ code.totalFn = typeof code.totalFn === 'function' ? code.totalFn : defaultTotalFn
445
+ return code
446
+ }
447
+ return null
448
+ }
449
+ }).filter(codeInfo => !!codeInfo)
450
+ })
451
+ const totalCodeRenders = computed(() => {
452
+ const defaultTotalObj = {
453
+ [tableColumnFirstMetaCode.value]: () => {
454
+ return <div>{lang.value.indexOf('zh') > -1 ? '总计' : 'Total'}</div>
455
+ }
456
+ }
457
+ return normalTotalCodes.value.reduce((ret, codeInfo) => {
458
+ const { code, render } = codeInfo
459
+ if (render && typeof render === 'function') {
460
+ ret[code] = render
461
+ }
462
+ return ret
463
+ }, defaultTotalObj)
464
+ })
465
+ function defaultTotalFn(total, val, row) {
466
+ if (val === undefined || val === null) {
467
+ val = 0
468
+ if (val === undefined) {
469
+ val = ''
470
+ }
471
+ } else {
472
+ const strVal = val.toString()
473
+ const negativeFlag = /^-/.test(strVal)
474
+ val = strVal.replace(/[^\d\.]/g, '')
475
+ if (negativeFlag) {
476
+ val = `-${val}`
477
+ }
478
+ }
479
+ const numFlag = !isNaN(Number(val))
480
+ if (total === null || total === undefined) {
481
+ total = numFlag ? 0 : ''
482
+ }
483
+ return total + (numFlag ? Number(val) : val)
484
+ }
485
+ const totalRow = computed(() => {
486
+ if (!tableData.value?.length || !totalMetaCodes.value.length || !normalTotalCodes.value.length) {
487
+ return []
488
+ }
489
+ // 进行统计的计算
490
+ const row = (tableData.value || []).reduce((total, row) => {
491
+ normalTotalCodes.value.forEach(codeInfo => {
492
+ const { code, totalFn } = codeInfo
493
+ total[code] = totalFn(total[code], row[code], row)
494
+ })
495
+ return total
496
+ }, { totalFlag: true })
497
+ return [row]
498
+ })
499
+ // 统计行定义 ====end======
500
+
501
+ // 开启单行选择配置后需要的逻辑=====start=====
502
+ const selectedRow = ref(null)
503
+ const currentChange = (row) => {
504
+ selectedRow.value = row
505
+ tableEvents?.onCurrentChange?.(row)
506
+ rootStore.tableSelectedInfo = row
507
+ }
508
+ const multipleSelection = ref([])
509
+ const handleSelectionChange = (val) => {
510
+ multipleSelection.value = val
511
+ rootStore.tableSelectedInfo = val
512
+ }
513
+ // 开启单行选择配置后需要的逻辑=====end=====
514
+
515
+ // 获取分页功能属性
516
+ const paginationProps = computed(() => {
517
+ const attrs = Object.keys(ElPagination.props).reduce((ret, key) => {
518
+ if (hasOwn(props.config, key)) {
519
+ ret[key] = props.config[key]
520
+ }
521
+ return ret
522
+ }, {})
523
+ if (!hasOwn(attrs, 'background')) {
524
+ attrs.background = true
525
+ }
526
+ if (!hasOwn(attrs, 'layout')) {
527
+ attrs.layout = 'prev, pager, next, jumper, sizes, total'
528
+ }
529
+ if (!hasOwn(attrs, 'page-sizes') && !hasOwn(attrs, 'pageSizes')) {
530
+ attrs.pageSizes = [5, 10, 20, 40]
531
+ }
532
+ return attrs
533
+ })
534
+
535
+ // 页码变动
536
+ watch(() => page.pageNum, async (val) => {
537
+ if (props.config?.serviceCurrentChangeLoad) {
538
+ return
539
+ }
540
+ const fn = props.config?.currentChange
541
+ const ret = await fn?.(val, props, page)
542
+ if (ret && isArray(ret)) {
543
+ modelValue.value = ret
544
+ }
545
+
546
+ // 以下是配置的点击事件服务所绑定的调用方法 ==== start ======
547
+ const serviceFn = props.config?.serviceCurrentChange
548
+ serviceFn?.(val, props, page)
549
+ // 以下是配置的点击事件服务所绑定的调用方法 ==== end ======
550
+ })
551
+ // 页面大小变动
552
+ watch(() => page.pageSize, async (val) => {
553
+ page.pageSize = val
554
+ const fn = props.config?.sizeChange
555
+ const ret = await fn?.(val, props, page)
556
+ if (ret && isArray(ret)) {
557
+ modelValue.value = ret
558
+ }
559
+
560
+ // 以下是配置的点击事件服务所绑定的调用方法 ==== start ======
561
+ const serviceFn = props.config?.serviceSizeChange
562
+ serviceFn?.(val, props, page)
563
+ // 以下是配置的点击事件服务所绑定的调用方法 ==== end ======
564
+ })
565
+
566
+ const tableExposeKeys = [
567
+ 'clearSelection',
568
+ 'getSelectionRows',
569
+ 'toggleRowSelection',
570
+ 'toggleAllSelection',
571
+ 'toggleRowExpansion',
572
+ 'setCurrentRow',
573
+ 'clearSort',
574
+ 'clearFilter',
575
+ 'doLayout',
576
+ 'sort',
577
+ 'scrollTo',
578
+ 'setScrollTop',
579
+ 'setScrollLeft',
580
+ 'columns'
581
+ ]
582
+ const tableRef = ref(null)
583
+ const tableExpose = tableExposeKeys.reduce((ret, key) => {
584
+ ret[key] = (...arg) => {
585
+ tableRef.value?.[key](...arg)
586
+ }
587
+ return ret
588
+ }, {})
589
+
590
+ function validate() {
591
+ return tableValidate({
592
+ props,
593
+ data: unref(modelValue),
594
+ lang: unref(lang),
595
+ rootValue,
596
+ dynamicMapComp,
597
+ messageInstance: messageInstance?.value,
598
+ isFrontPage: unref(isFrontPage),
599
+ page,
600
+ })
601
+ }
602
+
603
+ const context = reactive({
604
+ prop: props.config.dynamicHireRelat,
605
+ // ...toRefs(props),
606
+ // $el: formItemRef,
607
+ // size: _size,
608
+ // validateState,
609
+ // labelId,
610
+ // inputIds,
611
+ // isGroup,
612
+ // hasLabel,
613
+ // fieldValue,
614
+ // addInputId,
615
+ // removeInputId,
616
+ // resetField,
617
+ // clearValidate,
618
+ validate,
619
+ })
620
+ onMounted(() => {
621
+ formContext?.addField(context)
622
+ })
623
+
624
+ // 是否配置分页功能 ====== end======
625
+ expose({
626
+ multipleSelection,
627
+ selectedRow,
628
+ page,
629
+ changePage: (val, key) => {
630
+ page[key || 'pageNum'] = val
631
+ },
632
+ ...tableExpose
633
+ })
634
+ const dataList = computed(() => {
635
+ return totalRow.value?.length ? [...tableData.value, ...totalRow.value] : tableData.value
636
+ })
637
+
638
+ function cellMouseEnenter(e) {
639
+ const {overflow, content} = eleIsOverflow(e)
640
+ toopTip.show = false
641
+ toopTip.content = ''
642
+ toopTip.triggerRef = null
643
+ if (overflow) {
644
+ toopTip.show = true
645
+ toopTip.content = content
646
+ toopTip.triggerRef = e.target
647
+ }
648
+ }
649
+ function cellMouseout(e) {
650
+ toopTip.show = false
651
+ toopTip.content = ''
652
+ toopTip.triggerRef = null
653
+ }
654
+
655
+ function generateCellSolts(columnConfg, configIdx) {
656
+ let headerKey = 'header'
657
+ let cellKey = 'default'
658
+ if (isVirtualized.value) {
659
+ headerKey = 'headerCellRenderer'
660
+ cellKey = 'cellRenderer'
661
+ }
662
+ return {
663
+ [headerKey]: () => {
664
+ let retVnode = (
665
+ <span className='head-span' title={lang.value.indexOf('zh') > -1 ? columnConfg.metaNameZh : columnConfg.metaNameEn}>
666
+ { columnConfg.requiredFlag == '1' ? <span style="color: rgb(245, 34, 45); margin-right: 3px;">*</span> : '' }
667
+ { columnConfg.headerRender ? columnConfg.headerRender(h, { props, config: columnConfg, lang, rootValue, selects })
668
+ : (lang.value.indexOf('zh') > -1 ? columnConfg.metaNameZh : columnConfg.metaNameEn)
669
+ }
670
+ {
671
+ columnConfg.hintFlag == '1' ? (
672
+ <ElTooltip effect="dark" content={lang.value.indexOf('zh') > -1 ? columnConfg.hintContentZh : columnConfg.hintContentEn} placement="top">
673
+ <elIcon style="fontSize: 16px; verticalAlign: sub; margin-left: 3px;"><QuestionFilled /></elIcon>
674
+ </ElTooltip>
675
+ ) : null
676
+ }
677
+ </span>
678
+ )
679
+ if (isVirtualized.value) {
680
+ retVnode = (
681
+ <div className="table-v2-cell">
682
+ {retVnode}
683
+ </div>
684
+ )
685
+ }
686
+ return retVnode
687
+ },
688
+ [cellKey]: (params) => {
689
+ let row = params.row
690
+ let $index = params.$index
691
+ if (isVirtualized.value) {
692
+ row = params.rowData
693
+ $index = params.rowIndex
694
+ }
695
+ let retVnode = null
696
+ if (row.totalFlag) {
697
+ retVnode = totalCodeRenders.value[columnConfg.metaCode] ? totalCodeRenders.value[columnConfg.metaCode]({
698
+ val: row[columnConfg.metaCode],
699
+ row,
700
+ h
701
+ }) : null
702
+ } else {
703
+ // const config = columnConfg
704
+ const config = multiPmPageMetaList.value?.[$index]?.[configIdx]
705
+ retVnode = (
706
+ tableColumnNotRender(config) ? null :
707
+ <Renderer key={`${config.columnId}-${config.rowIndex}`} class="error-tip-block" rowScope={{row, $index}} modelValue={getValue($index)} onUpdate:modelValue={(val) => { onUpdateModelValue(val, $index) }} config={config}></Renderer>
708
+ )
709
+ }
710
+ if (isVirtualized.value) {
711
+ retVnode = (
712
+ <div className="table-v2-cell" onMouseenter={(e) => cellMouseEnenter(e)} onMouseleave={(e) => cellMouseout(e)}>
713
+ {retVnode}
714
+ </div>
715
+ )
716
+ }
717
+ return retVnode
718
+ }
719
+ }
720
+ }
721
+
722
+ function generateRenderVnode() {
723
+ if (isVirtualized.value) {
724
+ let autoResizerStyle = {
725
+ height: tableProps.height
726
+ }
727
+ if (!dataList.value?.length) {
728
+ autoResizerStyle.height = 100
729
+ } else {
730
+ if (!autoResizerStyle.height) {
731
+ autoResizerStyle.height = Math.min((dataList.value?.length) * 40, 350)
732
+ }
733
+ }
734
+ autoResizerStyle.height = `${parseInt(autoResizerStyle.height)}px`
735
+ return (
736
+ <ElAutoResizer style={autoResizerStyle}>
737
+ {{
738
+ default: ({ height, width }) => {
739
+ const columns = tableColumnConfigs.value.map((columnConfg, configIdx) => {
740
+ return columnConfg.displayType == DISPLAY_HIDDEN ? null : {
741
+ key: columnConfg.requiredFlag + columnConfg.metaCode,
742
+ ...getTableColumnProps(columnConfg, configIdx),
743
+ ...generateCellSolts(columnConfg, configIdx),
744
+ }
745
+ }).filter(item => !!item)
746
+ return (
747
+ <ElTableV2
748
+ {...tableProps.value} {...sliceTableEvents.value}
749
+ class="table-border"
750
+ cache={2}
751
+ data={dataList.value}
752
+ columns={columns}
753
+ fixed
754
+ width={width}
755
+ height={height}
756
+ >
757
+ {{
758
+ empty: () => (<div style={{height: '60px', color: 'var(--el-text-color-secondary)', textAlign: 'center', lineHeight: '60px'}}>
759
+ {lang.value.indexOf('zh') > -1 ? '暂无数据' : 'No Data'}
760
+ </div>)
761
+ }}
762
+ </ElTableV2>
763
+ )
764
+ }
765
+ }}
766
+ </ElAutoResizer>
767
+ )
768
+ }
769
+ return (
770
+ <ElTable {...tableProps.value} {...sliceTableEvents.value}
771
+ ref={(e) => {tableRef.value = e}}
772
+ highlight-current-row={selectable.value || tableProps.value?.highlightCurrentRow ? true : false}
773
+ onCurrentChange={selectable.value || tableProps.value?.highlightCurrentRow ? currentChange : () => {}}
774
+ data={dataList.value}
775
+ onSelectionChange={handleSelectionChange}
776
+ onSortChange={onSortChange}
777
+ >
778
+ {
779
+ tableColumnConfigs.value.map((columnConfg, configIdx) => {
780
+ return columnConfg.displayType == DISPLAY_HIDDEN ? null : (
781
+ <ElTableColumn key={columnConfg.requiredFlag + columnConfg.metaCode} {...getTableColumnProps(columnConfg, configIdx)}>
782
+ {generateCellSolts(columnConfg, configIdx)}
783
+ </ElTableColumn>
784
+ )
785
+ })
786
+ }
787
+ </ElTable>
788
+ )
789
+ }
790
+
791
+ return () => {
792
+ return (
793
+ <div class="custom-component-table">
794
+ <ElTooltip
795
+ placement="top"
796
+ visible={toopTip.show && !!toopTip.triggerRef}
797
+ content={toopTip.content}
798
+ virtualTriggering
799
+ virtualRef={toopTip.triggerRef}
800
+ ></ElTooltip>
801
+ { generateRenderVnode() }
802
+ {
803
+ pageable.value ?
804
+ <div class="pagination-wrap" style={{'justify-content': pageAlignEnmu[pageAlign.value || PAGE_RIGHT]}}>
805
+ <ElPagination style="margin-top: 16px;" { ...paginationProps.value } {...pagenationEvents} v-model:current-page={page.pageNum} v-model:page-size={page.pageSize} total={normalPageTotal.value}></ElPagination>
806
+ </div>
807
+ : null
808
+ }
809
+ </div>
810
+ )
811
+ }
812
+ }
813
+ }