resolver-egretimp-plus 0.0.68 → 0.0.70

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -48,6 +48,7 @@ export default {
48
48
  delete ret.onClick
49
49
  return ret
50
50
  })
51
+ const requestTraceId = inject('requestTraceId')
51
52
  const polyfillConfigs = inject('_polyfillConfigs', {})
52
53
  const buttonActions = inject('buttonActions', {})
53
54
  const route = useRoute()
@@ -184,6 +185,7 @@ export default {
184
185
  attrs?.onClick?.call(context, e) // 如果配置中有点击事件
185
186
  executeEventOrchestration({
186
187
  props,
188
+ requestTraceId: requestTraceId?.value,
187
189
  axiosInstance: _axiosInstance?.value,
188
190
  polyfillConfigs,
189
191
  rootValue: rootValue?.value,
@@ -4,16 +4,16 @@ import { getRelateConfigKeys } from "../../rules/ruleUtils"
4
4
  import { RESULT_CODE, resultToast } from "../../utils/respone"
5
5
  import { unionWith } from "../../utils/index"
6
6
 
7
- export async function dispatchClickEvents ({serviceList = [], axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance}) {
7
+ export async function dispatchClickEvents ({serviceList = [], requestTraceId, axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance}) {
8
8
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
9
9
  const mixinServiceConfig = serviceList.find(service => service.serviceType === '1')
10
10
  for (let i = 0; i < serviceList.length; i++) {
11
11
  const service = serviceList[i]
12
- dispatchClickEvent(service, {dynamicMapComp, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance})
12
+ dispatchClickEvent(service, {dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance})
13
13
  }
14
14
  }
15
15
 
16
- export async function dispatchClickEvent(service, { dynamicMapComp, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance }) {
16
+ export async function dispatchClickEvent(service, { dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance }) {
17
17
  let reqData = rootValue || {}
18
18
  let tableConfig = null
19
19
  if (service.transactionType == '1') {
@@ -29,6 +29,7 @@ export async function dispatchClickEvent(service, { dynamicMapComp, mixinService
29
29
  url,
30
30
  method: "post",
31
31
  data: {
32
+ requestTraceId,
32
33
  pmHandleBusinessIdentity: {
33
34
  busiIdentityId: service.busiIdentityId,
34
35
  pageMetaId: service.pageMetaId,
@@ -232,13 +233,14 @@ export function openDailg({
232
233
  }
233
234
 
234
235
  // 数据校验服务
235
- export async function executeDataValid(validConfig, { dynamicMapComp, mixinServiceConfig, rootValue, axiosInstance, lang}) {
236
+ export async function executeDataValid(validConfig, { dynamicMapComp, requestTraceId, mixinServiceConfig, rootValue, axiosInstance, lang}) {
236
237
  let reqData = rootValue || {}
237
238
  const url = DATA_VALID_RULE_EXECUTE
238
239
  const ret = await (axiosInstance && axiosInstance({
239
240
  url,
240
241
  method: "post",
241
242
  data: {
243
+ requestTraceId,
242
244
  pmHandleBusinessIdentity: {
243
245
  busiIdentityId: validConfig.busiIdentityId,
244
246
  pageMetaId: validConfig.pageMetaId,
@@ -303,7 +305,7 @@ function closePage(lcpPageClosedMapVO) {
303
305
  }
304
306
  }
305
307
 
306
- export async function executeEventOrchestration({props, axiosInstance, polyfillConfigs, buttonActions, rootValue, confirmInstance, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
308
+ export async function executeEventOrchestration({props, requestTraceId, axiosInstance, polyfillConfigs, buttonActions, rootValue, confirmInstance, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
307
309
  const lcpPageRuleVOLis = props.config?.lcpPageRuleVOList || []
308
310
  const PageServiceMapVOList = props.config.lcpPageServiceMapVOList || []
309
311
  const mixinServiceConfig = PageServiceMapVOList.find(service => service.serviceType === '1')
@@ -312,6 +314,7 @@ export async function executeEventOrchestration({props, axiosInstance, polyfillC
312
314
  const validConfig = lcpPageRuleVOLis[0]
313
315
  const valid = await executeDataValid(validConfig, {
314
316
  dynamicMapComp,
317
+ requestTraceId,
315
318
  rootValue,
316
319
  axiosInstance,
317
320
  mixinServiceConfig,
@@ -327,6 +330,7 @@ export async function executeEventOrchestration({props, axiosInstance, polyfillC
327
330
  dispatchClickEvents({
328
331
  serviceList: PageServiceMapVOList,
329
332
  axiosInstance,
333
+ requestTraceId,
330
334
  rootValue,
331
335
  dynamicMapComp,
332
336
  dynamicHireRelat,
@@ -1,6 +1,6 @@
1
1
  import { resultToast } from "../../utils/respone"
2
2
 
3
- export async function executeLoadServices(services = [], { axiosInstance, messageInstance, reqData, respCb }) {
3
+ export async function executeLoadServices(services = [], { requestTraceId, axiosInstance, messageInstance, reqData, respCb }) {
4
4
  if (reqData?.notLoad) {
5
5
  return
6
6
  }
@@ -17,6 +17,7 @@ export async function executeLoadServices(services = [], { axiosInstance, messag
17
17
  url,
18
18
  method: "post",
19
19
  data: {
20
+ requestTraceId,
20
21
  pmHandleBusinessIdentity: {
21
22
  busiIdentityId: service.busiIdentityId,
22
23
  pageMetaId: service.pageMetaId,
@@ -62,6 +62,16 @@ const pagenationEvents = computed(() => {
62
62
  }
63
63
  return ret
64
64
  })
65
+ const tableEvents = computed(() => {
66
+ const ret = {
67
+ onRowclick: (e) => {
68
+ if (attrs.onRowclick) {
69
+ attrs.onRowclick?.(e)
70
+ }
71
+ }
72
+ }
73
+ return ret
74
+ })
65
75
  // 是否配置分页功能 ====== start======
66
76
  const pageable = computed(() => {
67
77
  return props.config?.pageable === '1'
@@ -130,7 +140,7 @@ watch(modelValue, (val) => {
130
140
  })
131
141
  </script>
132
142
  <template>
133
- <cmi-table ref="tableRef" :key="`${tableProps.card}${tableProps.display}`" v-bind="tableProps" :data="normalTableData">
143
+ <cmi-table ref="tableRef" :key="`${tableProps.card}${tableProps.display}`" v-bind="tableProps" :data="normalTableData" @rowclick="tableEvents.onRowclick">
134
144
  <cmi-table-column
135
145
  v-for="column in pmPageMetaList" :key="column.metaCode"
136
146
  v-bind="{
@@ -42,7 +42,7 @@ export function usePageConfig() {
42
42
  }
43
43
  }
44
44
 
45
- export function useBuildInData(messageTipInstance, loadingInstance) {
45
+ export function useBuildInData({ messageInstance, loadingInstance, requestTraceId }) {
46
46
  const pageConfig = ref(null)
47
47
  function getPageConfig(reqData, cb) {
48
48
  if (loadingInstance.start && typeof loadingInstance.start === 'function') {
@@ -50,8 +50,8 @@ export function useBuildInData(messageTipInstance, loadingInstance) {
50
50
  } else if (loadingInstance.show && typeof loadingInstance.show === 'function') {
51
51
  loadingInstance.show()
52
52
  }
53
- buildInRequest(QUERY_PAGE_CONFIG_DATA, reqData).then(ret => {
54
- if (resultToast(ret.data, messageTipInstance, { noSuccessIip: true })) {
53
+ buildInRequest(QUERY_PAGE_CONFIG_DATA, {...reqData, requestTraceId}).then(ret => {
54
+ if (resultToast(ret.data, messageInstance, { noSuccessIip: true })) {
55
55
  // pageConfig.value = normalPageConfigs(mock)
56
56
  pageConfig.value = normalPageConfigs(ret.data.result)
57
57
  cb(pageConfig.value)
@@ -77,7 +77,7 @@ export function useBuildInData(messageTipInstance, loadingInstance) {
77
77
  buildInRequest(GET_SYS_PARAM_CACHE, {
78
78
  tenantId
79
79
  }).then(ret => {
80
- if (resultToast(ret.data, messageTipInstance, { noSuccessIip: true })) {
80
+ if (resultToast(ret.data, messageInstance, { noSuccessIip: true })) {
81
81
  selects.value = JSON.parse(ret.data.result || '{}')
82
82
  return
83
83
  } else {
package/src/index.jsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { provide, toRef, watch, computed, ref, defineExpose, reactive, getCurrentInstance } from "vue"
2
2
  import Renderer from './renderer.jsx'
3
3
  // import './style/index.scss'
4
- import { useBuildInData, usePageConfig } from './hooks/pageConfig'
4
+ import { usePageConfig } from './hooks/pageConfig'
5
5
  import { toValidate } from './utils/valid.js'
6
6
  import { MODE } from "./utils/const.js"
7
7
  import { generateRequester } from "./utils/request.js"
@@ -112,6 +112,9 @@ export default {
112
112
  },
113
113
  // 提示语的回调
114
114
  messageCb: Function,
115
+ requestTraceId: {
116
+ type: String,
117
+ }
115
118
  },
116
119
  setup(props, { emit, attrs, expose }) {
117
120
  const rootStore = reactive({})
@@ -154,6 +157,7 @@ export default {
154
157
  executeLoadServices(
155
158
  props.config?.pmPageServiceMapVOList || props.config?.lcpPageServiceMapVOList || [],
156
159
  {
160
+ requestTraceId: props.requestTraceId,
157
161
  messageInstance: toRef(props, 'messageInstance'),
158
162
  axiosInstance,
159
163
  reqData: props.loadEvnetsReq,
@@ -181,6 +185,7 @@ export default {
181
185
  executeLoadServices(
182
186
  props.config?.pmPageServiceMapVOList || [],
183
187
  {
188
+ requestTraceId: props.requestTraceId,
184
189
  messageInstance: toRef(props, 'messageInstance'),
185
190
  axiosInstance,
186
191
  reqData: props.loadEvnetsReq,
@@ -218,6 +223,7 @@ export default {
218
223
  provide('_parentRootValue', props.parentRootValue)
219
224
  provide('_selectionsObj', props.selectionsObj)
220
225
  provide('_polyfillConfigs', props.polyfillConfigs)
226
+ provide('requestTraceId', toRef(props, 'requestTraceId')) // 所有渲染器调用的接口,都需要加次参数(生哥提)
221
227
 
222
228
  const rootForm = ref(null)
223
229
  provide('rootForm', rootForm)
@@ -5,6 +5,7 @@ import Resolver from './resolver-common.vue'
5
5
  import CmiToast from "cmid/lib/toast"
6
6
  import CmiFullLoading from "cmid/lib/fullloading"
7
7
  import { confirmDialog } from './components/confirmInstance-H5/index.js';
8
+ import { generateUniqueId } from './utils/common.js';
8
9
 
9
10
  const props = defineProps({
10
11
  loadingInstance: {
@@ -29,6 +30,10 @@ const props = defineProps({
29
30
  return () => {}
30
31
  }
31
32
  },
33
+ requestTraceId: {
34
+ type: String,
35
+ default: generateUniqueId()
36
+ }
32
37
  })
33
38
 
34
39
  defineOptions({
@@ -67,5 +72,6 @@ defineExpose({
67
72
  :confirmInstance="props.confirmInstance"
68
73
  :openChildDialogInstance="props.openChildDialogInstance"
69
74
  :loadingInstance="props.loadingInstance"
75
+ :requestTraceId="props.requestTraceId"
70
76
  ></Resolver>
71
77
  </template>
@@ -22,13 +22,16 @@ const props = defineProps({
22
22
  type: [Object, Function],
23
23
  default: () => null
24
24
  },
25
+ requestTraceId: {
26
+ type: String,
27
+ }
25
28
  })
26
29
  defineOptions({
27
30
  inheritAttrs: false
28
31
  })
29
32
  const attrs = useAttrs()
30
33
  initInterceptors(props.messageInstance)
31
- const { getPageConfig, pageConfig, selects } = useBuildInData(props.messageInstance, props.loadingInstance)
34
+ const { getPageConfig, pageConfig, selects } = useBuildInData({messageInstance: props.messageInstance, loadingInstance: props.loadingInstance, requestTraceId: props.requestTraceId})
32
35
  getPageConfig({
33
36
  busiIdentityId: props.busiIdentityId,
34
37
  queryPageMeta: '1',
@@ -67,5 +70,14 @@ defineExpose({
67
70
  })
68
71
  </script>
69
72
  <template>
70
- <Resolver ref="resolverRef" v-bind="attrs" :loadingInstance="props.loadingInstance" :messageInstance="props.messageInstance" :getNativeComps="props.getNativeComps" :config="pageConfig || null" :selects="allSelects"></Resolver>
73
+ <Resolver
74
+ ref="resolverRef"
75
+ v-bind="attrs"
76
+ :loadingInstance="props.loadingInstance"
77
+ :messageInstance="props.messageInstance"
78
+ :getNativeComps="props.getNativeComps"
79
+ :config="pageConfig || null"
80
+ :selects="allSelects"
81
+ :requestTraceId="props.requestTraceId"
82
+ ></Resolver>
71
83
  </template>
@@ -5,6 +5,7 @@ import { loadingInstance } from './components/loading'
5
5
  import { computed, ref, useAttrs } from 'vue';
6
6
  import Resolver from './resolver-common.vue'
7
7
  import { openChildDialog } from './components/childDialog';
8
+ import { generateUniqueId } from './utils/common.js';
8
9
 
9
10
  const props = defineProps({
10
11
  loadingInstance: {
@@ -28,6 +29,10 @@ const props = defineProps({
28
29
  return openChildDialog
29
30
  }
30
31
  },
32
+ requestTraceId: {
33
+ type: String,
34
+ default: generateUniqueId()
35
+ }
31
36
  })
32
37
 
33
38
  defineOptions({
@@ -66,5 +71,6 @@ defineExpose({
66
71
  :confirmInstance="props.confirmInstance"
67
72
  :openChildDialogInstance="props.openChildDialogInstance"
68
73
  :loadingInstance="props.loadingInstance"
74
+ :requestTraceId="props.requestTraceId"
69
75
  ></Resolver>
70
76
  </template>
@@ -5,7 +5,7 @@
5
5
  & > .CustomComponentRow {
6
6
  & > div {
7
7
  margin-right: 16px;
8
- margin-bottom: 16px;
8
+ // margin-bottom: 16px;
9
9
  }
10
10
  }
11
11
  }
@@ -227,5 +227,33 @@ export function getDate(...arg) {
227
227
  }
228
228
  // 生成唯一值
229
229
  export function generateUniqueId() {
230
- return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
230
+ return `${formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')}-${getUuid()}`;
231
+ }
232
+
233
+ export function getUuid () {
234
+ if (typeof crypto === 'object') {
235
+ if (typeof crypto.randomUUID === 'function') {
236
+ return crypto.randomUUID();
237
+ }
238
+ if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') {
239
+ const callback = (c) => {
240
+ const num = Number(c);
241
+ return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString(16);
242
+ };
243
+ return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, callback);
244
+ }
245
+ }
246
+ let timestamp = new Date().getTime();
247
+ let perforNow = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0;
248
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
249
+ let random = Math.random() * 16;
250
+ if (timestamp > 0) {
251
+ random = (timestamp + random) % 16 | 0;
252
+ timestamp = Math.floor(timestamp / 16);
253
+ } else {
254
+ random = (perforNow + random) % 16 | 0;
255
+ perforNow = Math.floor(perforNow / 16);
256
+ }
257
+ return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16);
258
+ });
231
259
  }
@@ -268,10 +268,9 @@ function getTableServices(lcpPageServiceMapVOList = [], { dynamicMapComp, dynami
268
268
  }
269
269
  return []
270
270
  }
271
-
272
271
  function parsePolyfillConfigs({ polyfillConfigs, instance, parentRootValue }, config) {
273
272
  const hireRelat = config.hireRelat
274
- const findKeys = Object.keys(polyfillConfigs).filter(key => hireRelat.endsWith(key))
273
+ const findKeys = Object.keys(polyfillConfigs || {}).filter(key => hireRelat.endsWith(key))
275
274
  if (!findKeys.length) {
276
275
  return
277
276
  }