resolver-egretimp-plus 0.1.121 → 0.1.123

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.
@@ -63,3 +63,20 @@
63
63
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
64
64
  * @license MIT
65
65
  **/
66
+
67
+ /** @preserve
68
+ * Counter block mode compatible with Dr Brian Gladman fileenc.c
69
+ * derived from CryptoJS.mode.CTR
70
+ * Jan Hruby jhruby.web@gmail.com
71
+ */
72
+
73
+ /** @preserve
74
+ (c) 2012 by Cédric Mesnil. All rights reserved.
75
+
76
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
77
+
78
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
79
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
80
+
81
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
82
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.1.121",
3
+ "version": "0.1.123",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -10,6 +10,7 @@ import { useRouter } from 'vue-router'
10
10
  import { onErrorCaptured } from 'vue'
11
11
  import LoadingComponent from './components/loadingComponent/LoadingComponent.vue'
12
12
  import { useConfigLoad } from './hooks/configLoad.js'
13
+ import { OPEN_DATA_RULES } from './config.js'
13
14
 
14
15
  export default {
15
16
  name: 'AnalysisComponent',
@@ -239,20 +240,21 @@ export default {
239
240
  configLinks.reduce((parent, config) => {
240
241
  definePrivatelyProp(config, 'parent', parent)
241
242
  definePrivatelyProp(config, 'dynamicMapComp', dynamicMapComp)
242
-
243
- // 如果已经有dynamicHireRelat值的时候,就不需要再进行以下赋值了
244
- if (
245
- config?.dynamicHireRelat_bak && !configsSet?.has(config)
246
- // && props.mode !== 'operate'
247
- ) {
248
- definePrivatelyProp(config, 'dynamicHireRelat', `${config.dynamicHireRelat_bak}__@__${props.mode}__`)
249
- } else {
250
- const dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(config, 'rowIndex') ? `[${config.rowIndex}]` : ''}->${(config.metaCode || '')}` : config.metaCode
251
- definePrivatelyProp(config, 'dynamicHireRelat', dynamicHireRelat)
252
- config.dynamicHireRelat_bak = dynamicHireRelat
243
+ if (!OPEN_DATA_RULES) {
244
+ // 如果已经有dynamicHireRelat值的时候,就不需要再进行以下赋值了
245
+ if (
246
+ config?.dynamicHireRelat_bak && !configsSet?.has(config)
247
+ // && props.mode !== 'operate'
248
+ ) {
249
+ definePrivatelyProp(config, 'dynamicHireRelat', `${config.dynamicHireRelat_bak}__@__${props.mode}__`)
250
+ } else {
251
+ const dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(config, 'rowIndex') ? `[${config.rowIndex}]` : ''}->${(config.metaCode || '')}` : config.metaCode
252
+ definePrivatelyProp(config, 'dynamicHireRelat', dynamicHireRelat)
253
+ config.dynamicHireRelat_bak = dynamicHireRelat
254
+ }
255
+ configsSet?.add(config) // 搜集所有的config
256
+ config.dynamicHireRelat && (dynamicMapComp[config.dynamicHireRelat] = config)
253
257
  }
254
- configsSet?.add(config) // 搜集所有的config
255
- config.dynamicHireRelat && (dynamicMapComp[config.dynamicHireRelat] = config)
256
258
  return config
257
259
  })
258
260
 
@@ -47,7 +47,8 @@ export const dynamicLoadScript = (src = { type: 'js', url: '', id: '' }) => {
47
47
  resolve(src.url)
48
48
  }
49
49
  link.onerror = function () {
50
- reject(new Error('Failed to load ' + src.url), link)
50
+ resolve(src.url)
51
+ // reject(new Error('Failed to load ' + src.url), link)
51
52
  }
52
53
  document.head.appendChild(link)
53
54
  }
@@ -595,6 +595,7 @@ export async function executeDataValid(validConfig, {
595
595
  const ret = await buildInRequest(url, {
596
596
  aid_language: lang,
597
597
  requestTraceId,
598
+ busiIdentityId: validConfig.busiIdentityId,
598
599
  ...reqData,
599
600
  ...(builtPolyfillReq || {}),
600
601
  pmHandleBusinessIdentity: {
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <span class="custom-component-plain" :class="classObj" @click.stop.self="clickAction">{{ props.formatter?.(value) ?? value }}</span>
2
+ <span class="custom-component-plain" v-bind="currentPorps" @click.stop.self="clickAction">{{ props.formatter?.(value) ?? value }}</span>
3
3
  </template>
4
4
  <script setup>
5
5
  import { findComponent } from '../../utils/common';
6
6
  import { commonPropsType, PLAIN_TYPE_OPTIONS_COLUMNS } from '../../utils/const' // 这边不能用utils/index去引用,因为这个组件在utils/render.js中被引入了,会造成循环引用
7
- import { computed, defineModel, defineProps, inject, getCurrentInstance, watch, nextTick } from 'vue'
7
+ import { computed, defineModel, defineProps, inject, getCurrentInstance, watch, nextTick, useAttrs } from 'vue'
8
8
  import dayjs from 'dayjs'
9
9
  import { isNaN } from '../../utils/is';
10
10
  import { useFormItem } from 'element-plus'
@@ -13,6 +13,7 @@ defineOptions({
13
13
  inheritAttrs: false
14
14
  })
15
15
 
16
+ const attrs = useAttrs()
16
17
  const { formItem: elFormItem } = useFormItem()
17
18
  const modelValue = defineModel()
18
19
  const props = defineProps({
@@ -144,6 +145,13 @@ const classObj = computed(() => ([
144
145
  }
145
146
  ]))
146
147
 
148
+ const currentPorps = computed(() => {
149
+ return {
150
+ style: attrs.style,
151
+ class: classObj.value
152
+ }
153
+ })
154
+
147
155
 
148
156
  const appContext = getCurrentInstance()?.appContext
149
157
  const buttonActions = inject('buttonActions', {})
@@ -152,7 +152,9 @@ export default {
152
152
  }
153
153
  return porpsObj
154
154
  })
155
-
155
+ const multiPmPageMetaList = computed(() => {
156
+ return props.config.multiPmPageMetaList || []
157
+ })
156
158
  const getCompEvents = (comp) => {
157
159
  let emitKeys = comp.emits || {}
158
160
  if(!Array.isArray(emitKeys)) {
@@ -385,9 +387,6 @@ export default {
385
387
  modelValue.value[idx] = val
386
388
  }
387
389
 
388
- const multiPmPageMetaList = computed(() => {
389
- return props.config.multiPmPageMetaList || []
390
- })
391
390
 
392
391
  /**
393
392
  * 设置 multiPmPageMetaList 的值
@@ -87,6 +87,8 @@ export function useBuildInData({ messageInstance, loadingInstance, requestTraceI
87
87
  }
88
88
  getSelects({
89
89
  tenantId: ret.data.result?.pmBusinessIdentityVO?.tenantId,
90
+ busiIdentityId: reqData.busiIdentityId,
91
+ requestTraceId: requestTraceId,
90
92
  ...(selectPolyReq || {})
91
93
  }, selectsCb)
92
94
  return
@@ -0,0 +1,160 @@
1
+ import { computed, inject, nextTick, reactive, unref } from "vue"
2
+ import rulesDriver from '../rules/rulesDriver'
3
+ import defaultVal from '../utils/defaultVal.js'
4
+ import {assignmentPathVal, definePrivatelyProp, getPathVal, isNonRefType, modelValueDeepMerge } from "../utils"
5
+
6
+ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
7
+ const { hireRelatMapRules, messageInstance, rootValue, ruleExecuter, dataLoad, dynamicMapComp, lang, _mapComp } = this
8
+ const currentRules = hireRelatMapRules.value[config.hireRelat]
9
+ let metaCodeKey = config.metaCode
10
+ if (modelKey !== 'update:modelValue') {
11
+ const matchs = modelKey.match(/^update:(\w+)$/)
12
+ if (!matchs) {
13
+ return
14
+ }
15
+ metaCodeKey = matchs[1]
16
+ const dynamicMapKey = config.dynamicHireRelat.replace(/->\w+$/, `->${metaCodeKey}`)
17
+ config = dynamicMapComp[dynamicMapKey]
18
+ }
19
+ const retModelVale = computed({
20
+ get() {
21
+ if (!config) {
22
+ // 如果使用v-model:[]方式绑定非modelValue,可能会出现没有对应的config
23
+ return
24
+ }
25
+ const val = (metaCodeKey ? props.modelValue?.[metaCodeKey] : props.modelValue) ?? null
26
+ if (modelKey === 'update:modelValue' && (val === undefined || val === null)) {
27
+ defaultVal(config)
28
+ // setTimeout(() => {
29
+ // defaultVal(config)
30
+ // }, 0)
31
+ }
32
+ config && (config.bindValue = val)
33
+ if (config) {
34
+ // 事件初始化执行,在dataLoaded请求完成之后,执行一次事件
35
+ if (dataLoad.value && !config.eventInit && !config.notInit) {
36
+ setTimeout(() => {
37
+ ruleExecuter?.run({
38
+ rootValue,
39
+ rules: currentRules,
40
+ config,
41
+ dynamicMapComp,
42
+ lang,
43
+ messageInstance,
44
+ _mapComp,
45
+ isInit: true,
46
+ })
47
+ rulesDriver.call({
48
+ config,
49
+ dynamicMapComp,
50
+ lang,
51
+ _mapComp,
52
+ messageInstance
53
+ }, currentRules, true)
54
+ definePrivatelyProp(config, 'eventInit', true)
55
+ }, 0)
56
+ }
57
+ }
58
+ return val
59
+ },
60
+ set(val) {
61
+ if (!config) {
62
+ return
63
+ }
64
+ const modelValue = props.modelValue
65
+ const metaCode = metaCodeKey
66
+ // if (!metaCode) return
67
+ if (!modelValue) {
68
+ // frameSet 表示的是一帧之内重复设置对应metaCode的值
69
+ // 一帧之内重复设置metaCode的值需要进行merge,也就是下面modelValueDeepMerge走的逻辑
70
+ //(
71
+ // 原因是因为一帧之后重复设置,如果不走merge,会出现val值直接覆盖原本对应的metaCode的值,
72
+ // 这个在正常情况下没什么问题,但是如果刚开始根数据对应的层级对应出现断层为空,在进行emit(update:modelValue)进行赋值之后
73
+ // 并不能立即更新到对应的props.modelValue下面去,所以会出现 同时通过config.refValue设置同层级,并且是根数据断层的情况下;会出现覆盖
74
+ // )
75
+ config.parent && (config.parent.frameSet = true)
76
+ nextTick(() => {
77
+ config.parent && (config.parent.frameSet = false)
78
+ })
79
+ let updateValue = {
80
+ [metaCode]: val
81
+ }
82
+ if (!metaCode) {
83
+ updateValue = val
84
+ }
85
+ emit('update:modelValue', updateValue)
86
+ } else {
87
+ let updateValue = modelValue?.[metaCode]
88
+ if (config?.frameSet) {
89
+ if (!metaCode) {
90
+ updateValue = modelValue
91
+ }
92
+ if (updateValue) {
93
+ if (typeof updateValue === 'object' || typeof val === 'object') {
94
+ val = modelValueDeepMerge(updateValue, val)
95
+ }
96
+ }
97
+ }
98
+ if (isNonRefType(updateValue) && isNonRefType(val) && updateValue === val) {
99
+ // 这边的值没有变,就不用出触发下面的其他动作了
100
+ return
101
+ }
102
+ try {
103
+ if (!metaCode) {
104
+ props.modelValue = val
105
+ } else {
106
+ props.modelValue[metaCode] = val
107
+ }
108
+ } catch (error) {
109
+ console.log('config', config, metaCode)
110
+ }
111
+ }
112
+ if (config) {
113
+ setTimeout(() => {
114
+ ruleExecuter?.run({
115
+ rootValue,
116
+ rules: currentRules,
117
+ config,
118
+ dynamicMapComp,
119
+ lang,
120
+ messageInstance,
121
+ _mapComp,
122
+ })
123
+ rulesDriver.call({
124
+ config,
125
+ dynamicMapComp,
126
+ lang,
127
+ _mapComp,
128
+ messageInstance
129
+ }, currentRules)
130
+ }, 0)
131
+ }
132
+ }
133
+ })
134
+ return retModelVale
135
+ }
136
+
137
+ export function useVmodels(config) {
138
+ const modelValue = computed({
139
+ get() {
140
+ const {
141
+ _rootValue,
142
+ dynamicHireRelat
143
+ } = config
144
+ return getPathVal(unref(_rootValue), dynamicHireRelat, '->')
145
+ },
146
+ set(val) {
147
+ const {
148
+ _rootValue,
149
+ dynamicHireRelat
150
+ } = config
151
+ return assignmentPathVal(_rootValue, dynamicHireRelat, val, '->')
152
+ }
153
+ })
154
+ return {
155
+ modelValue,
156
+ // vModelObjs,
157
+ // initVmodels
158
+ }
159
+
160
+ }
@@ -13,21 +13,21 @@ export function toWatchRules({
13
13
  }) {
14
14
  const ruleKeys = Object.keys(rules)
15
15
  ruleKeys.forEach(originKey => {
16
+ const keys = originKey.split('->')
16
17
  let comps = []
17
- let key = originKey
18
- while (key) {
19
- const comp = mapComp[key]
18
+ for (let index = 0; index < keys.length; index++) {
19
+ const key = keys[index];
20
+ let comp = null
21
+ if (index === 0) {
22
+ comp = mapComp[key]
23
+ } else {
24
+ comp = comps[comps.length - 1]?.pmPageMetaList?.find(item => item.metaCode === key)
25
+ }
20
26
  if (comp) {
21
- comps.unshift(comp)
22
- const convertkey = key.replace(/->\w*$/, '')
23
- if (convertkey === key) {
24
- key = ''
25
- } else {
26
- key = convertkey
27
- }
27
+ comps.push(comp)
28
28
  } else {
29
- comps = []
30
- key = ''
29
+ comp = null
30
+ break
31
31
  }
32
32
  }
33
33
  if (comps && comps.length) {
@@ -42,23 +42,18 @@ export function toWatchRules({
42
42
  currentPath,
43
43
  })
44
44
  }
45
- watchRuleTrace({comps, rootValue, watchCb})
45
+ watchRuleTrace({comps, originKey, rootValue, watchCb})
46
46
  }
47
47
  })
48
48
  }
49
49
 
50
- function watchRuleTrace({comps, rootValue, watchCb}, prefix = '', idx = 0, unWatchsList = []) {
50
+ function watchRuleTrace({comps, originKey, rootValue, watchCb}, prefix = '', idx = 0, unWatchsList = []) {
51
51
  if (comps && comps.length) {
52
52
  const comp = comps[idx]
53
- try {
54
- prefix += prefix ? `->${comp.metaCode}` : comp.metaCode
55
- } catch (error) {
56
- debugger
57
- }
53
+ prefix += prefix ? `->${comp.metaCode}` : comp.metaCode
58
54
  if (comps.length === (idx + 1)) {
59
55
  const unWatch = watch(() => getPathVal(unref(rootValue), prefix, '->'), (val) => {
60
56
  // 开始执行规则
61
- console.log('watch====:', prefix)
62
57
  watchCb?.(prefix)
63
58
  }, {
64
59
  immediate: true
@@ -70,36 +65,39 @@ function watchRuleTrace({comps, rootValue, watchCb}, prefix = '', idx = 0, unWat
70
65
  return
71
66
  }
72
67
  if (isCycleConfig(comp)) {
73
- const _mapUnWatchs = comp._mapUnWatchs || (comp._mapUnWatchs = Object.create(null))
74
- const _rowMapWatchs = _mapUnWatchs[prefix] || (_mapUnWatchs[prefix] = new Map())
75
- watch(() => getPathVal(unref(rootValue), prefix, '->')?.length, () => {
76
- const list = getPathVal(unref(rootValue), prefix, '->') || []
77
- list.forEach((row, index) => {
78
- if (!_rowMapWatchs.get(row)) {
79
- const childUnWatchs = []
80
- unWatchsList.push(childUnWatchs)
81
- const currentPrefix = `${prefix}[${index}]`
82
- const currentIdx = idx + 1
83
- watchRuleTrace({comps, rootValue, watchCb}, currentPrefix, currentIdx, [...unWatchsList])
84
- _rowMapWatchs.set(row, {key: currentPrefix, childUnWatchs})
85
- }
86
- })
87
- try {
88
- const mapKeys = _rowMapWatchs.keys()
89
- Array.from(mapKeys).forEach(row => {
90
- if (!list.some(row2 => row2 === row)) {
91
- _rowMapWatchs.get(row)?.childUnWatchs?.forEach(un => un?.())
92
- }
93
- })
94
- } catch (error) {
95
- debugger
68
+ const _mapChildUnWatchs = comp._mapChildUnWatchs || (comp._mapChildUnWatchs = Object.create(null))
69
+ const _rowMapWatchs = _mapChildUnWatchs[prefix] || (_mapChildUnWatchs[prefix] = new Map())
70
+
71
+ const _mapUnWatch = comp._mapUnWatch || (comp._mapUnWatch = Object.create(null))
72
+ !_mapUnWatch[prefix] && (_mapUnWatch[prefix] = {cbs: [], unwatch: null})
73
+ _mapUnWatch[prefix].cbs.push(({index}) => {
74
+ if (!_rowMapWatchs.get(`${originKey}__${index}`)) {
75
+ const currentUnWatchsList = [...unWatchsList]
76
+ const childUnWatchs = []
77
+ currentUnWatchsList.push(childUnWatchs)
78
+ const currentPrefix = `${prefix}[${index}]`
79
+ const currentIdx = idx + 1
80
+ watchRuleTrace({comps, originKey, rootValue, watchCb}, currentPrefix, currentIdx, currentUnWatchsList)
81
+ _rowMapWatchs.set(`${originKey}__${index}`, {key: currentPrefix, childUnWatchs})
96
82
  }
97
- }, {
98
- immediate: true
99
83
  })
84
+ if (!_mapUnWatch[prefix].unwatch) {
85
+ _mapUnWatch[prefix].unwatch = watch(() => getPathVal(unref(rootValue), prefix, '->')?.length, (length) => {
86
+
87
+ // 这边只需要根据index进行判断是否生成watch就行了,因为监听数据都是根据index索引来的,
88
+ // 在数组减少的时候,也不需要进行unwatch操作,直接留着,如果数组新增,可以直接用
89
+ for (let index = 0; index < length; index++) {
90
+ _mapUnWatch[prefix].cbs.forEach(cb => {
91
+ cb({index})
92
+ })
93
+ }
94
+ }, {
95
+ immediate: true
96
+ })
97
+ }
100
98
  } else {
101
99
  idx++
102
- watchRuleTrace({comps, rootValue, watchCb}, prefix, idx)
100
+ watchRuleTrace({comps, originKey, rootValue, watchCb}, prefix, idx, unWatchsList)
103
101
  }
104
102
  }
105
103
  }
package/src/index.jsx CHANGED
@@ -309,7 +309,7 @@ export default {
309
309
  instance,
310
310
  dynamicMapComp,
311
311
  isH5: props.isH5,
312
- rootValue: props.modelValue,
312
+ rootValue: toRef(props, 'modelValue'),
313
313
  parentRootValue: props.parentRootValue,
314
314
  parentDynamicMapComp: props.parentDynamicMapComp,
315
315
  axiosInstance: axiosInstance.value,
@@ -331,7 +331,7 @@ export default {
331
331
  instance,
332
332
  dynamicMapComp,
333
333
  isH5: props.isH5,
334
- rootValue: props.modelValue,
334
+ rootValue: toRef(props, 'modelValue'),
335
335
  parentRootValue: props.parentRootValue,
336
336
  parentDynamicMapComp: props.parentDynamicMapComp,
337
337
  axiosInstance: axiosInstance.value,
@@ -422,6 +422,9 @@ export default {
422
422
  messageInstance: props.messageInstance,
423
423
  lang: props.lang,
424
424
  })
425
+ setInterval(() => {
426
+ console.log("dynamicMapComp===:", dynamicMapComp)
427
+ }, 3000);
425
428
  }
426
429
  onMounted(() => {
427
430
  if (props.openBpm) {
@@ -404,14 +404,17 @@ const allInitEvents = {
404
404
  }
405
405
  },
406
406
  limitDataRange({event, rootValue, mapComp, dynamicMapComp, currentPath, messageInstance, isInit}) {
407
- const { targetObj: target, targetObjVal = '' } = event
407
+ let { targetObj: target, targetObjVal = '' } = event
408
408
  if (!target) return
409
409
  const targetObj = `${target}`
410
+ targetObjVal = targetObjVal || ''
410
411
  let range = []
411
- if (targetObjVal?.indexOf('~') > -1) {
412
- range = targetObjVal.split('~')
413
- } else {
414
- range = targetObjVal.split(',')
412
+ if (targetObjVal) {
413
+ if (targetObjVal?.indexOf('~') > -1) {
414
+ range = targetObjVal.split('~')
415
+ } else {
416
+ range = targetObjVal.split(',')
417
+ }
415
418
  }
416
419
  if (range && range.length) {
417
420
  const configs = getCurrentComp({codesStr: targetObj, dynamicMapComp, currentPath})
@@ -1,7 +1,8 @@
1
+ import CryptoJs from 'crypto-js';
1
2
  import { decrypt as aesDecrypt, encrypt as aesEncrypt } from 'crypto-js/aes';
2
3
  import UTF8 from 'crypto-js/enc-utf8';
3
4
  import pkcs7 from 'crypto-js/pad-pkcs7';
4
- import CTR from 'crypto-js/mode-ctr';
5
+ // import CTR from 'crypto-js/mode-ctr';
5
6
  import Base64 from 'crypto-js/enc-base64';
6
7
  import MD5 from 'crypto-js/md5';
7
8
  import SHA256 from 'crypto-js/sha256';
@@ -17,7 +18,7 @@ class AesEncryption {
17
18
 
18
19
  get getOptions() {
19
20
  return {
20
- mode: CTR,
21
+ mode: CryptoJs.mode.CBC,
21
22
  padding: pkcs7,
22
23
  iv: this.iv,
23
24
  };