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,378 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * rule
4
+ * {
5
+ "eventId": "0",
6
+ "relId": "100000000000006",
7
+ "targetEventId": "0",
8
+ "targetObj": "--",
9
+ "targetObjVal": null,
10
+ "updateTime": "2023-04-13 20:14:13",
11
+ "updateOperId": "72523",
12
+ "targetMsg": null,
13
+ "eventRefValue": null,
14
+ "createTime": "2023-04-13 20:14:13",
15
+ "targetMsgEn": null,
16
+ "state": "0",
17
+ "ruleId": "100000000000006",
18
+ "createOperId": "72523",
19
+ "eventCode": null,
20
+ "eventName": null,
21
+ "remark": null,
22
+ "id": null,
23
+ "ruleType": "1",
24
+ "eventExpress": "{\"relation\":1,\"conditions\":[{\"refCode\":\"xiangmuxinxi->CustomerName\",\"refName\":\"项目信息->客户名称\",\"refNameEn\":\"xiangmuxinxi->Customer Name\",\"symbol\":1,\"type\":1,\"targetValue\":\"xiangmuxinxi->Businesstype\",\"targetName\":\"项目信息->业务类型\",\"targetNameEn\":\"xiangmuxinxi->Business type\"}]}",
25
+ "eventType": null,
26
+ "pmRuleTargetEventVoList": [
27
+ {
28
+ "targetEventId": "1002",
29
+ "relId": "100000000000006",
30
+ "eventId": "0",
31
+ "eventCode": null,
32
+ "actionType": "0",
33
+ "targetObj": "xiangmuxinxi->dutyparagraph",
34
+ "targetObjVal": null,
35
+ "targetMsg": null,
36
+ "targetMsgEn": null,
37
+ "state": "1",
38
+ "createTime": "2023-04-13 20:14:13",
39
+ "createOperId": "72523",
40
+ "updateTime": "2023-04-13 20:14:13",
41
+ "updateOperId": "72523"
42
+ }
43
+ ]
44
+ }
45
+
46
+ eventExpress
47
+ * {
48
+ relation: 1, // 1: 与;2: 或
49
+ conditions: [
50
+ {
51
+ refCode: '', // 这个表格引用的字段,这边是使用->连接code
52
+ refName: 'aa', // 这边表示引用的字段描述,主要是配置化工具那边的展示
53
+ symbol: 1, // 1: >;2: >=; 3: <;4: <=;5: ==;6: !=;
54
+ type: 1, // 1: 组件;2: 系统参数; 3: 手动输入
55
+ targetValue: 'bb', // 这边是对比的值,可以跟refCode一样的值,也可以是具体的值,根据type进行生效
56
+ targetName: 'cc' // 这边在targetValue跟refcode一样时,跟refName一样的效果
57
+ targetName_en: 'cc' // // 这边在targetValue跟refcode一样时,跟refName一样的效果
58
+ },
59
+ {
60
+ refCode: '',
61
+ refName: '22',
62
+ symbol: 1, // 1: >;2: >=; 3: <;4: <=;5: ==;6: !=; 7: include; 8: no include
63
+ type: 3, // 1: 组件;2: 系统参数; 3: 手动输入
64
+ targetValue: '33',
65
+ targetName: 'c44c'
66
+ targetName_en: 'c44c'
67
+ }
68
+ ]
69
+ }
70
+ */
71
+ import { getConfigValue, getCurrentComp, parseRules } from './ruleUtils'
72
+ import {formatDate, isArray} from '../utils/index'
73
+
74
+ export const rulesTypes = {
75
+ constrast: '1',
76
+ nonNull: '2',
77
+ regular: '3',
78
+ enumeration: '4',
79
+ event: '5'
80
+ }
81
+ export const conditionType = {
82
+ COMPONENT: 1, // 1: 组件
83
+ SYSTEM: 2, // 2: 系统参数
84
+ SELF: 3, // 3: 手动输入
85
+ COMPONENT_ENMU: 4, // 组件枚举
86
+ NULL: 5 // 空
87
+ }
88
+
89
+ const calcConditionValue = {
90
+ [conditionType.COMPONENT] ({tabpanelCode, value}) {
91
+ // const labelInfos = getCurrentComp.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${value}`)
92
+ // // if (!labelInfos || labelInfos.length !== 1) {
93
+ // // return false
94
+ // // }
95
+ let refVal = getConfigValue.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${value}`)
96
+ return refVal
97
+ },
98
+ [conditionType.SYSTEM]: ({value}) => {
99
+ return getSystemArgVal(value)
100
+ },
101
+ [conditionType.SELF]: ({value}) => {
102
+ return value
103
+ },
104
+ [conditionType.COMPONENT_ENMU]: ({value}) => {
105
+ return value
106
+ },
107
+ [conditionType.NULL]: () => {
108
+ return null
109
+ }
110
+ }
111
+
112
+ export function parseCondition(rule) {
113
+ const { eventExpress, pmRuleTargetEventVoList: eventList, ruleType, tabpanelCode } = rule || {}
114
+ if (!eventExpress) return false
115
+
116
+ const expressObj = JSON.parse(eventExpress)
117
+ const { relation, conditions } = expressObj
118
+ let conditionsRet = []
119
+ let isIllegalSymbol = false
120
+ // 不同规则对应不同解析
121
+ // 如果ruleType有值,表示是配置化平台的的交付体验规则类型
122
+ // debugger
123
+ // if (ruleType) {
124
+ // switch (ruleType) {
125
+ // case rulesTypes.constrast:
126
+ // case rulesTypes.enumeration:
127
+ // conditionsRet = conditions.map(condition => {
128
+ // const labelInfos = getCurrentComp.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${condition.refCode || condition.refValue}`)
129
+ // // if (condition.refCode.indexOf('custType') > -1) {
130
+ // // console.log('conditions==:', conditions)
131
+ // // debugger
132
+ // // }
133
+ // if (!labelInfos || labelInfos.length !== 1) {
134
+ // return false
135
+ // }
136
+ // let refVal = getConfigValue.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${condition.refCode || condition.refValue}`)
137
+ // let targetVal = condition.targetValue
138
+ // if (rulesTypes.constrast === ruleType) {
139
+ // targetVal = getTraget.call(this, condition, tabpanelCode)
140
+ // }
141
+ // refVal = (refVal === undefined || refVal === null) ? '' : refVal
142
+ // targetVal = (targetVal === undefined || targetVal === null) ? '' : targetVal
143
+ // switch (condition.symbol) {
144
+ // case 1:
145
+ // return refVal > targetVal
146
+ // case 2:
147
+ // return refVal >= targetVal
148
+ // case 3:
149
+ // return refVal < targetVal
150
+ // case 4:
151
+ // return refVal <= targetVal
152
+ // case 5:
153
+ // return refVal == targetVal || (!targetVal && isArray(refVal) && !refVal.length)
154
+ // case 6:
155
+ // return refVal != targetVal
156
+ // case 7:
157
+ // if (typeof refVal === 'number') refVal = `${refVal}`
158
+ // if (Array.isArray(refVal) || typeof refVal === 'string') {
159
+ // return refVal.indexOf(targetVal) > -1
160
+ // }
161
+ // return false
162
+ // case 8:
163
+ // if (typeof refVal === 'number') refVal = `${refVal}`
164
+ // if (Array.isArray(refVal) || typeof refVal === 'string') {
165
+ // return refVal.indexOf(targetVal) === -1
166
+ // }
167
+ // return false
168
+ // default:
169
+ // isIllegalSymbol = true
170
+ // }
171
+ // })
172
+ // break
173
+ // case rulesTypes.nonNull:
174
+ // conditionsRet = conditions.map(condition => {
175
+ // const labelInfos = getCurrentComp.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${condition.refCode || condition.refValue}`)
176
+ // if (!labelInfos || labelInfos.length !== 1) {
177
+ // return false
178
+ // }
179
+ // const refVal = getConfigValue.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${condition.refCode || condition.refValue}`)
180
+ // return !refVal || (isArray(refVal) && !refVal.length)
181
+ // })
182
+ // break
183
+ // case rulesTypes.regular:
184
+ // conditionsRet = conditions.map(condition => {
185
+ // const labelInfos = getCurrentComp.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${condition.refCode || condition.refValue}`)
186
+ // if (!labelInfos || labelInfos.length !== 1) {
187
+ // return false
188
+ // }
189
+ // const refVal = getConfigValue.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${condition.refCode || condition.refValue}`)
190
+ // if (!condition.targetValue) return false
191
+ // const reg = new RegExp(condition.targetValue)
192
+ // return reg.test(refVal)
193
+ // })
194
+ // break
195
+ // default:
196
+ // return false
197
+ // }
198
+ // if (isIllegalSymbol) return false
199
+ // } else {
200
+ conditionsRet = conditions.map(condition => {
201
+ const { refType, refValue, targetType, targetValue } = condition
202
+ if (conditionType.COMPONENT == refType) {
203
+ const labelInfos = getCurrentComp.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${refValue}`)
204
+ if (!labelInfos || labelInfos.length !== 1) {
205
+ return false
206
+ }
207
+ }
208
+ // if (refValue?.indexOf('itemId') > -1) {
209
+ // debugger
210
+ // }
211
+ if (!calcConditionValue[refType]) return false
212
+ let refVal = calcConditionValue[refType].call(this, {tabpanelCode, value: refValue})
213
+
214
+ if (conditionType.COMPONENT == targetType) {
215
+ const labelInfos = getCurrentComp.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${targetValue}`)
216
+ if (!labelInfos || labelInfos.length !== 1) {
217
+ return false
218
+ }
219
+ }
220
+ if (!calcConditionValue[targetType]) return false
221
+ let targetVal = calcConditionValue[targetType].call(this, {tabpanelCode, value: targetValue})
222
+
223
+ refVal = (refVal === undefined || refVal === null) ? '' : refVal
224
+ targetVal = (targetVal === undefined || targetVal === null) ? '' : targetVal
225
+
226
+ let formatRefVal = refVal
227
+ let formatTargetVal = targetVal
228
+ if (refVal == Number(refVal) && targetVal == Number(targetVal)) {
229
+ formatRefVal = Number(refVal)
230
+ formatTargetVal = Number(targetVal)
231
+ }
232
+ switch (condition.symbol) {
233
+ case 1:
234
+ return formatRefVal > formatTargetVal
235
+ case 2:
236
+ return formatRefVal >= formatTargetVal
237
+ case 3:
238
+ return formatRefVal < formatTargetVal
239
+ case 4:
240
+ return formatRefVal <= formatTargetVal
241
+ case 5:
242
+ return refVal == targetVal || (!targetVal && isArray(refVal) && !refVal.length)
243
+ case 6:
244
+ return refVal != targetVal
245
+ case 7:
246
+ if (typeof refVal === 'number') refVal = `${refVal}`
247
+ if (Array.isArray(refVal) || typeof refVal === 'string') {
248
+ return refVal.indexOf(targetVal) > -1
249
+ }
250
+ return false
251
+ case 8:
252
+ if (['string', 'number'].includes(typeof targetVal)) {
253
+ const reg = new RegExp(targetVal)
254
+ return reg.test(refVal)
255
+ }
256
+ return false
257
+ default:
258
+ return false
259
+ }
260
+ })
261
+ // }
262
+ const ret = conditionsRet[relation == 1 ? 'every' : 'some'](item => item)
263
+ return ret
264
+ }
265
+
266
+ function getTraget(condition, tabpanelCode) {
267
+ switch (condition.type) {
268
+ case 1:
269
+ return getConfigValue.call(this, `${tabpanelCode ? tabpanelCode + '->' : ''}${condition.refCode || condition.refValue}`)
270
+ case 2:
271
+ return getSystemArgVal(condition.targetValue)
272
+ case 3:
273
+ return condition.targetValue
274
+ default:
275
+ return ''
276
+ }
277
+ }
278
+
279
+ export function parseRuleForRefCodeAndEvents(rule) {
280
+ const codeRules = []
281
+ const { eventExpress, pmRuleTargetEventVoList: eventList, tabpanelCode } = rule || {}
282
+ if (!eventExpress) return false
283
+ const expressObj = JSON.parse(eventExpress)
284
+ const { conditions = [] } = expressObj
285
+ conditions.forEach(condition => {
286
+ if (condition.refType == conditionType.COMPONENT || condition.targetType == conditionType.COMPONENT) {
287
+ if (condition.refType == conditionType.COMPONENT) {
288
+ codeRules.push({
289
+ key: tabpanelCode ? `${tabpanelCode}->${condition.refCode || condition.refValue}` : condition.refCode || condition.refValue,
290
+ rules: [rule]
291
+ })
292
+ }
293
+ if (condition.targetType == conditionType.COMPONENT) {
294
+ codeRules.push({
295
+ key: tabpanelCode ? `${tabpanelCode}->${condition.targetValue}` : condition.targetValue,
296
+ rules: [rule]
297
+ })
298
+ }
299
+ } else {
300
+
301
+ }
302
+ });
303
+ return codeRules
304
+ }
305
+
306
+ export function getCodeMapRules(config) {
307
+ const rules = parseRules(config)
308
+ return codeMapRules(rules)
309
+ }
310
+
311
+ export function codeMapRules(rules = []) {
312
+ const mapObj = {}
313
+ rules.forEach(rule => {
314
+ const keyEvents = parseRuleForRefCodeAndEvents(rule)
315
+ if (keyEvents && keyEvents.length) {
316
+ keyEvents.forEach(keyEvent => {
317
+ const { key = '', rules = [] } = keyEvent
318
+ if (mapObj[key]) {
319
+ rules.forEach(rule => {
320
+ if (!mapObj[key]?.some(itemR => itemR?.relId === rule?.relId)) {
321
+ mapObj[key].push(rule)
322
+ }
323
+ })
324
+ } else {
325
+ mapObj[key] = rules
326
+ }
327
+ })
328
+ }
329
+ })
330
+ return mapObj
331
+ }
332
+
333
+
334
+ // 事件添加动作,判断当前点击的item是否出发事件
335
+ export function assertEventConditionsRef (rule, refCode) {
336
+ const { eventExpress, pmRuleTargetEventVoList: eventList, ruleType } = rule || {}
337
+ if (!eventExpress) return false
338
+ const expressObj = JSON.parse(eventExpress)
339
+ const { relation, conditions } = expressObj
340
+ const conditionsRet = conditions.map(condition => {
341
+ return condition.refCode == refCode
342
+ })
343
+ return conditionsRet[relation == 1 ? 'every' : 'some'](item => item)
344
+ }
345
+
346
+ const systemFlag = {
347
+ currentDate: '1', // 获取当前日期
348
+ currentTimestamp: '2', // 获取当前时间戳
349
+ CurrentYear: '3', // 当前年
350
+ CurrentMonth: '4', // 当前月
351
+ CurrentDay: '5', // 当前日
352
+ CurrentAfter30Day: '6', // 当前后30天
353
+ CurrentBefore30Day: '7' // 当前前30天
354
+ }
355
+
356
+ function getSystemArgVal(flag) {
357
+ const now = new Date()
358
+ switch (flag) {
359
+ case systemFlag.currentDate:
360
+ return formatDate(new Date(),"yyyy-MM-dd")
361
+ case systemFlag.currentTimestamp:
362
+ return new Date().getTime()
363
+ case systemFlag.CurrentYear:
364
+ return formatDate(new Date(),"yyyy")
365
+ case systemFlag.CurrentMonth:
366
+ return formatDate(new Date(),"MM")
367
+ case systemFlag.CurrentDay:
368
+ return formatDate(new Date(),"dd")
369
+ case systemFlag.CurrentAfter30Day:
370
+ now.setDate(now.getDate() + 30);
371
+ return formatDate(now, "yyyy-MM-dd")
372
+ case systemFlag.CurrentBefore30Day:
373
+ now.setDate(now.getDate() - 30);
374
+ return formatDate(now, "yyyy-MM-dd")
375
+ default:
376
+ return flag
377
+ }
378
+ }
@@ -0,0 +1,273 @@
1
+ /* eslint-disable */
2
+ import { hasOwn, isPlainObject } from "../utils"
3
+ import { formatSelectVal } from "../utils/defaultVal"
4
+ import { MULTI_PAGE_META_LIST_TYPES, findComponent } from '../utils/index'
5
+
6
+ const pmPageMetaListTypeList = ['setShow', 'setHidden']
7
+ // 这边是一些组件在执行规则的时候,如果还没有加载出来,规则会走不动,这边就是存储没走通的规则,等组件加载完之后,再去执行
8
+ export const penddingRules = {}
9
+
10
+ export function getConfigValue(codesStr = '', refVal) {
11
+ if (!codesStr) return ''
12
+ const { config, dynamicMapComp } = this
13
+ const { hireRelat = '', dynamicHireRelat = '' } = config
14
+ if (hireRelat === codesStr) {
15
+ // 如果走到这里,表示是触发条件中的一个条件是当前的配置项(config)
16
+ return config.bindValue
17
+ }
18
+
19
+ // 如果没有循环渲染组件,可以直接获对应的config返回上面的bindValue====start====
20
+ // const codes = codesStr.split('->')
21
+ // const circulConfigFlags = codes.map((code, idx) => {
22
+ // return findComponent(MULTI_PAGE_META_LIST_TYPES, code) !== -1
23
+ // })
24
+ // if (!circulConfigFlags.some(flag => flag)) {
25
+ // return dynamicMapComp?.[codesStr]?.bindValue
26
+ // }
27
+ // 如果没有循环渲染组件,可以直接获对应的config返回上面的bindValue====end====
28
+
29
+ const configs = getRelateConfigs.call(this, codesStr, config)
30
+ if (configs.length !== 1) {
31
+ return null
32
+ }
33
+ const retVal = refVal ? configs[0]?.refValue : configs[0]?.bindValue
34
+ return retVal
35
+ }
36
+ // 设置对应的值
37
+ export function setFormVal(pathStr, val) {
38
+ if (!pathStr) {
39
+ return
40
+ }
41
+ if (isPlainObject(pathStr)) {
42
+ hasOwn(pathStr, 'refValue') && (pathStr.refValue = val)
43
+ return
44
+ }
45
+ const { config } = this
46
+ const configs = getRelateConfigs.call(this, pathStr, config)
47
+ configs.forEach(cg => {
48
+ if (hasOwn(cg, 'refValue')) {
49
+ if (cg.metaType === 'ElSelect') {
50
+ val = formatSelectVal({config: cg, val: val, isActive: true})
51
+ }
52
+ cg.refValue = val
53
+ } else {
54
+ const { _mapComp } = this
55
+ if (_mapComp?.value?.[cg.hireRelat]) {
56
+ if (!penddingRules[cg.hireRelat]) {
57
+ penddingRules[cg.hireRelat] = []
58
+ }
59
+ if (!penddingRules[cg.hireRelat].some((item) => item?.rules === this?.rules && item?.config === this?.config)) {
60
+ penddingRules[cg.hireRelat].push(this)
61
+ }
62
+ }
63
+ }
64
+ })
65
+ }
66
+
67
+ function getRelateConfigs(codesStr, config, type) {
68
+ const { dynamicHireRelat = '' } = config
69
+ // 这边逻辑目前主要是为了兼容日志的时候,也可以正常使用规则========start=====
70
+ let normalDynamicHireRelat = dynamicHireRelat
71
+ let preFlagStr = ''
72
+ // 这个规则是因为在日志直接拷贝配置的时候,在analysisComponent组件中会在前面额外加上 这个 标识 所以需要转换一下
73
+ const preFlagStrReg = /(__@__[^(->)]*__)$/
74
+ const preFlagStrMatchs = dynamicHireRelat?.match(preFlagStrReg)
75
+ if (preFlagStrMatchs) {
76
+ preFlagStr = preFlagStrMatchs[1]
77
+ normalDynamicHireRelat = normalDynamicHireRelat?.replace(preFlagStrReg, '')
78
+ }
79
+ // 这边逻辑目前主要是为了兼容日志的时候,也可以正常使用规则========end=====
80
+
81
+ // 组装成此数据结果,用于后续的获取对应字段=====start====
82
+ const dynamicCodeInfos = normalDynamicHireRelat.split('->').map(code => {
83
+ const matchs = code?.match(/^(\w+)\[(\d+)\]$/)
84
+ if (matchs) {
85
+ return {
86
+ idx: parseInt(matchs[2]),
87
+ code: matchs[1]
88
+ }
89
+ } else {
90
+ return {
91
+ idx: -1,
92
+ code,
93
+ }
94
+ }
95
+ })
96
+ // 组装成此数据结果,用于后续的获取对应字段=====end====
97
+
98
+ let diffIdx = -1 // 次标识表示,是从那个所以开始,code不一样了
99
+ const codes = codesStr.split('->')
100
+
101
+ for (let i = 0; i < codes.length; i ++) {
102
+ const code = codes[i]
103
+ const dynamicCodeInfo = dynamicCodeInfos[i]
104
+ if (dynamicCodeInfo.code !== code) {
105
+ diffIdx = i
106
+ break
107
+ }
108
+ }
109
+
110
+ const diffCodes = codes.slice(diffIdx)
111
+ const sameCodesStr = dynamicCodeInfos.slice(0, diffIdx).map(({idx, code}) => {
112
+ return idx !== -1 ? `${code}[${idx}]` : code
113
+ }).join('->')
114
+ let sameStr = sameCodesStr
115
+ let sameIdx = null
116
+ const sameMatchs = sameCodesStr.match(/^([\w\W]*)\[(\d*)\]$/)
117
+ // 这边是在出现a->c->c[0]这种情况的时候,可以正常获取的组件config
118
+ if (sameMatchs) {
119
+ sameStr = sameMatchs[1]
120
+ sameIdx = sameMatchs[2]
121
+ }
122
+ const { dynamicMapComp, _mapComp } = this
123
+ let retConfigs = []
124
+ if (sameStr) {
125
+ retConfigs = [dynamicMapComp[`${sameStr}${preFlagStr}`]]
126
+ } else {
127
+ const code = diffCodes.shift()
128
+ retConfigs = [dynamicMapComp[`${code}${preFlagStr}`]]
129
+ }
130
+ while (diffCodes.length) {
131
+ const code = diffCodes.shift()
132
+ const list = []
133
+ retConfigs.forEach(cg => {
134
+ // multiPmPageMetaList有值,表示为数据循环渲染子组件
135
+ if (cg.multiPmPageMetaList) {
136
+ if (sameIdx !== null) {
137
+ const childCgList = cg.multiPmPageMetaList[sameIdx]
138
+ const fincCg = childCgList && childCgList.find(childCg => childCg.metaCode === code)
139
+ if (!fincCg) return
140
+ list.push(fincCg)
141
+ sameIdx = null
142
+ } else {
143
+ if (pmPageMetaListTypeList.includes(type)) {
144
+ const fincCg = cg?.pmPageMetaList?.find(childCg => childCg.metaCode === code)
145
+ if (!fincCg) return
146
+ list.push(fincCg)
147
+ }
148
+ cg.multiPmPageMetaList.forEach(childCgList => {
149
+ const fincCg = childCgList.find(childCg => childCg.metaCode === code)
150
+ if (!fincCg) return
151
+ list.push(fincCg)
152
+ })
153
+ }
154
+ } else {
155
+ const fincCg = cg?.pmPageMetaList?.find(childCg => childCg.metaCode === code)
156
+ if (!fincCg) return
157
+ list.push(fincCg)
158
+ }
159
+ })
160
+ retConfigs = list
161
+ }
162
+ if (_mapComp?.value?.[codesStr] && !retConfigs.length) {
163
+ if (!penddingRules[codesStr]) {
164
+ penddingRules[codesStr] = []
165
+ }
166
+ if (!penddingRules[codesStr].some((item) => item?.rules === this?.rules && item?.config === this?.config)) {
167
+ penddingRules[codesStr].push(this)
168
+ }
169
+ }
170
+ return retConfigs
171
+ }
172
+
173
+ export function greaterThan(val, targ) {
174
+ const valCanTran = canTransNumber(val)
175
+ const tragCanTran = canTransNumber(targ)
176
+ if (valCanTran && tragCanTran) {
177
+ return Number(val) > Number(targ)
178
+ } else {
179
+ return val + '' > targ + ''
180
+ }
181
+ }
182
+
183
+ export function lessThan(val, targ) {
184
+ const valCanTran = canTransNumber(val)
185
+ const tragCanTran = canTransNumber(targ)
186
+ if (valCanTran && tragCanTran) {
187
+ return Number(val) < Number(targ)
188
+ } else {
189
+ return val + '' < targ + ''
190
+ }
191
+ }
192
+
193
+ export function canTransNumber(val) {
194
+ return !isNaN(Number(val))
195
+ }
196
+
197
+ /**
198
+ * 根据code path 获取到对应的组件或者label
199
+ */
200
+ export function getCurrentComp(codesStr, type) {
201
+ if (!codesStr) return null
202
+ const { config } = this
203
+ return getRelateConfigs.call(this, codesStr, config, type)
204
+ }
205
+
206
+ export function parseRules(config) {
207
+ if (!config) return []
208
+ const retRules = []
209
+ const { pmRuleDefVoList, pmRuleDefVOList } = config
210
+ const ruleDefVoList = (pmRuleDefVoList || pmRuleDefVOList?.filter(item => item?.ruleType == '1') || [])
211
+ ruleDefVoList.forEach(ruleTypeItem => {
212
+ const pmRuleEventRelVoList = ruleTypeItem.pmRuleEventRelVOList || ruleTypeItem.pmRuleEventRelVoList || []
213
+ const itemRulesFlat = pmRuleEventRelVoList.map(item => ({
214
+ ...item,
215
+ ruleType: ruleTypeItem.ruleType
216
+ }))
217
+ retRules.push(...itemRulesFlat)
218
+ })
219
+ return retRules
220
+ }
221
+
222
+ // 解析最原始的配置数据,生成Code链对应的配置信息
223
+ export function generateConfigsHireRelat(configs, hireRelat = '', retObj = {}) {
224
+ if (!configs) return
225
+ const list = Array.isArray(configs) ? configs : [configs]
226
+ list.forEach(config => {
227
+ let currentHireRelat = hireRelat
228
+ if (hasOwn(config, 'pmTabpanelInfoVoList')) {
229
+ currentHireRelat = ''
230
+ generateConfigsHireRelat(config.pmTabpanelInfoVoList, currentHireRelat, retObj)
231
+ } else if (hasOwn(config, 'pmComponentInfoVoList')) {
232
+ currentHireRelat += currentHireRelat ? `->${config.tabpanelCode}` : config.tabpanelCode
233
+ generateConfigsHireRelat(config.pmComponentInfoVoList, currentHireRelat, retObj)
234
+ } else if (hasOwn(config, 'pmLabelInfoVoList') || hasOwn(config, 'subComponentInfoVo')) {
235
+ currentHireRelat += currentHireRelat ? `->${config.componentCode}` : config.componentCode
236
+ generateConfigsHireRelat(config.pmLabelInfoVoList, currentHireRelat, retObj)
237
+ generateConfigsHireRelat(config.subComponentInfoVo, currentHireRelat, retObj)
238
+ } else {
239
+ currentHireRelat += currentHireRelat ? `->${config.labelCode}` : config.labelCode
240
+ }
241
+ if (currentHireRelat) {
242
+ config.nativeHireRelat = currentHireRelat
243
+ retObj[currentHireRelat] = config
244
+ }
245
+ })
246
+ return retObj
247
+ }
248
+
249
+ export function getRelateConfigKeys(keys = [], path = '', relatePath = '') {
250
+ const pathArr = path ? path.split('->') : []
251
+ const relatePathArr = relatePath ? relatePath.split('->') : []
252
+ let diffIdx = -1 // 此标识表示,是从那个所以开始,code不一样了
253
+ let currentIdx = 0
254
+ while(diffIdx === -1 && currentIdx < pathArr.length && currentIdx < relatePathArr.length) {
255
+ const pathCode = pathArr[currentIdx]
256
+ const pathCodeReg = new RegExp(`^${pathCode}(\\[\\d+\\])?$`)
257
+ const relateCode = relatePathArr[currentIdx]
258
+ if (pathCodeReg.test(relateCode)) {
259
+ pathArr.splice(currentIdx, 1, relateCode)
260
+ currentIdx++
261
+ } else {
262
+ diffIdx = currentIdx
263
+ }
264
+ }
265
+ const normalPath = pathArr.reduce((ret, pathCode) => {
266
+ const noramlPathCode = pathCode.replace(/([\[\]]{1})/g, (_,b) => {return `\\${b}`})
267
+ return ret + (ret ? `->${noramlPathCode}(\\[\\d+\\])?` : `${noramlPathCode}(\\[\\d+\\])?`)
268
+ }, '')
269
+ const normalPathReg = new RegExp(`^${normalPath}$`)
270
+ return keys.filter(code => {
271
+ return normalPathReg.test(code)
272
+ })
273
+ }