resolver-egretimp-plus 0.0.89 → 0.0.91

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.89",
3
+ "version": "0.0.91",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -16,7 +16,7 @@ module.exports = {
16
16
  path: path.resolve(__dirname, '../dist'),
17
17
  filename: '[name]/index.js'
18
18
  },
19
- devtool: 'inline-source-map',
19
+ // devtool: 'inline-source-map',
20
20
  module: {
21
21
  rules: [
22
22
  {
@@ -6,6 +6,7 @@ import rulesDriver from './rules/rulesDriver'
6
6
  import { penddingRules } from './rules/ruleUtils.js'
7
7
  import { useRoute } from 'vue-router'
8
8
  import { executeEventOrchestration } from './components/helper/eventOrchestration.js'
9
+ import { useRouter } from 'vue-router'
9
10
 
10
11
  export default {
11
12
  name: 'AnalysisComponent',
@@ -52,6 +53,7 @@ export default {
52
53
  const requestTraceId = inject('requestTraceId')
53
54
  const polyfillConfigs = inject('_polyfillConfigs', {})
54
55
  const buttonActions = inject('buttonActions', {})
56
+ const router = useRouter()
55
57
  const route = useRoute()
56
58
  const routeQuery= route?.query
57
59
  const hireRelatMapRules = inject('hireRelatMapRules')
@@ -74,6 +76,9 @@ export default {
74
76
  props.config.vm = e
75
77
  }
76
78
  const onVnodeMounted = (e) => {
79
+ props.config.vmIsBind = true
80
+ props.config.router = router
81
+ props.config.route = route
77
82
  props.config.vmIsBind = true
78
83
  if (props.config.onVnodeMounted && typeof props.config.onVnodeMounted === 'function') {
79
84
  props.config.onVnodeMounted(props, e, selects)
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, defineProps, inject, useAttrs } from 'vue'
3
- import { commonPropsType, hasOwn } from '../../utils/index.js'
3
+ import { commonPropsType, formatDate, hasOwn } from '../../utils/index.js'
4
4
 
5
5
  const lang = inject('lang')
6
6
  const modelValue = defineModel()
@@ -16,10 +16,18 @@ const normalVal = computed(() => {
16
16
  return modelValue.value
17
17
  })
18
18
 
19
+ const dateFormat = computed(() => {
20
+ return props.config?.dateFormat
21
+ })
22
+
19
23
  const calcProps = computed(() => {
24
+ let desc = normalVal.value || props.config?.desc
25
+ if (dateFormat.value) {
26
+ desc = formatDate(desc, dateFormat.value)
27
+ }
20
28
  return {
21
29
  title: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
22
- desc: normalVal.value || props.config?.desc,
30
+ desc,
23
31
  content: props.config?.content,
24
32
  to: props.config?.toHref,
25
33
  islink: props.config?.islink === '1',
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
- import { commonPropsType, getConfigOptions, hasOwn } from '../../utils/index.js'
3
- import { computed, inject, reactive, ref, useAttrs, watch } from 'vue'
2
+ import { commonPropsType, formatDate, getConfigOptions, hasOwn } from '../../utils/index.js'
3
+ import { computed, inject, onMounted, reactive, ref, useAttrs, watch } from 'vue'
4
4
 
5
5
  const attrs = useAttrs()
6
6
  const lang = inject('lang')
@@ -9,9 +9,11 @@ const tableRef = ref(null)
9
9
  const props = defineProps({
10
10
  ...commonPropsType,
11
11
  })
12
- const tableData = ref([])
13
12
  const modelValue = defineModel()
14
-
13
+ // 是否配置分页功能 ====== start======
14
+ const pageable = computed(() => {
15
+ return props.config?.pageable == '1'
16
+ })
15
17
  // 移动端默认前端分页
16
18
  const isFrontPage = computed(() => {
17
19
  return hasOwn(props.config, 'frontPageFlag') ? props.config?.frontPageFlag == '1' : true
@@ -35,15 +37,17 @@ const page = reactive({
35
37
 
36
38
  const normalTableData = computed(() => {
37
39
  const orgList = !isFrontPage.value ?
38
- tableData.value :
39
- tableData.value.slice((page.pageNum - 1) * page.pageSize, page.pageNum * page.pageSize)
40
+ (modelValue.value || []) :
41
+ pageable.value ?
42
+ (modelValue.value?.slice?.((page.pageNum - 1) * page.pageSize, page.pageNum * page.pageSize) || []) :
43
+ (modelValue.value || [])
40
44
  return orgList.map(row => {
41
45
  return normalTableRowValue(row)
42
46
  })
43
47
  })
44
48
 
45
49
  const normalPageTotal = computed(() => {
46
- return !isFrontPage.value ? page.total : (tableData.value?.length || 0)
50
+ return !isFrontPage.value ? page.total : (modelValue.value?.length || 0)
47
51
  })
48
52
 
49
53
  const paginationProps = computed(() => {
@@ -79,10 +83,7 @@ const tableEvents = computed(() => {
79
83
  }
80
84
  return ret
81
85
  })
82
- // 是否配置分页功能 ====== start======
83
- const pageable = computed(() => {
84
- return props.config?.pageable == '1'
85
- })
86
+
86
87
  const pageAlign = computed(() => {
87
88
  return props.config?.pageAlign
88
89
  })
@@ -137,23 +138,35 @@ const getTableColumnProps = (config) => {
137
138
  fixed: config.fixed,
138
139
  }
139
140
  }
140
- watch(modelValue, (val) => {
141
- setTimeout(() => {
142
- tableData.value = val || (tableProps.value.card ? [] : [])
143
- }, 100);
144
- tableRef.value?.setTableData((val && val.length) ? val : [{}])
145
- }, {
146
- immediate: true
141
+ const tableKey = computed(() => {
142
+ return `${tableProps.value.card}${tableProps.value.display}${!tableProps.value.card ? page.pageNum : 0}`
143
+ })
144
+
145
+ onMounted(() => {
146
+ watch(() => {
147
+ return {
148
+ val: normalTableData.value,
149
+ pageNum: page.pageNum
150
+ }
151
+ }, ({ val }) => {
152
+ tableRef.value?.setTableData([])
153
+ setTimeout(() => {
154
+ tableRef.value?.setTableData(val)
155
+ }, 100);
156
+ }, {
157
+ immediate: true
158
+ })
147
159
  })
160
+
148
161
  // 这个的监听是因为 table正常形态的时候,改变分页,行高会越来越高,所以就设置了key
149
162
  // 设置key之后需要重新setTableData
150
- watch(() => {
151
- return `${tableProps.value.card}${tableProps.value.display}${!tableProps.value.card ? page.pageNum : 0}`
152
- }, () => {
153
- setTimeout(() => {
154
- tableRef.value?.setTableData(normalTableData.value)
155
- }, 100);
156
- })
163
+ // watch(() => {
164
+ // return `${tableProps.value.card}${tableProps.value.display}${!tableProps.value.card ? page.pageNum : 0}`
165
+ // }, () => {
166
+ // setTimeout(() => {
167
+ // tableRef.value?.setTableData(normalTableData.value)
168
+ // }, 100);
169
+ // })
157
170
 
158
171
  function getOptions(config) {
159
172
  return getConfigOptions(config, selects)
@@ -174,12 +187,15 @@ function normalTableRowValue(row) {
174
187
  }
175
188
  pmPageMetaList.value.forEach(config => {
176
189
  ret[config.metaCode] = normalVal(ret[config.metaCode], getOptions(config))
190
+ if (config?.dateFormat) {
191
+ ret[config.metaCode] = formatDate(ret[config.metaCode], config.dateFormat)
192
+ }
177
193
  })
178
194
  return ret
179
195
  }
180
196
  </script>
181
197
  <template>
182
- <cmi-table ref="tableRef" :key="`${tableProps.card}${tableProps.display}${!tableProps.card ? page.pageNum : 0}`" v-bind="tableProps" :data="normalTableData" @rowclick="tableEvents.onRowclick">
198
+ <cmi-table ref="tableRef" :key="tableKey" v-bind="tableProps" @rowclick="tableEvents.onRowclick">
183
199
  <cmi-table-column
184
200
  v-for="column in pmPageMetaList" :key="column.metaCode"
185
201
  v-bind="{
package/src/index.jsx CHANGED
@@ -9,6 +9,7 @@ import { executeLoadServices } from "./components/helper/resolver.js"
9
9
  import { deepMerge } from "./utils/index.js"
10
10
  import { useRouter } from "vue-router"
11
11
  import { useRoute } from "vue-router"
12
+ import { markRaw } from "vue"
12
13
  export default {
13
14
  name: 'Resolver',
14
15
  props: {
@@ -134,6 +135,8 @@ export default {
134
135
  const nativeDataLoad = ref(false)
135
136
  const router = useRouter()
136
137
  const route = useRoute()
138
+ // const router = {}
139
+ // const route = {}
137
140
  const axiosInstance = ref(props.axiosInstance)
138
141
  watch(() => {
139
142
  return props.axiosConfig
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { intersectionWith, isEqual, mergeWith, unionWith, isArray, cloneDeep } from 'lodash-es'
3
-
3
+ import { isDate } from './is'
4
4
  export {
5
5
  cloneDeep,
6
6
  unionWith
@@ -120,6 +120,9 @@ export function isPlainObject(obj) {
120
120
  }
121
121
 
122
122
  export function formatDate(date, fmt) {
123
+ if (!isDate(date)) {
124
+ date = new Date(date)
125
+ }
123
126
  if (/(y+)/.test(fmt)) {
124
127
  fmt = fmt.replace(RegExp.$1, (`${date.getFullYear()}`).substr(4 - RegExp.$1.length))
125
128
  }
@@ -29,6 +29,7 @@ import QuestionFilled from '../components/icons/question-filled.vue'
29
29
  import { dispatchClickEvent, dispatchClickEvents, getTableConfig } from '../components/helper/eventOrchestration.js'
30
30
  import CmiFormItem from '../components/cmiFormItem'
31
31
  import loadModule from './loadModule.js'
32
+ import { toRaw } from 'vue'
32
33
 
33
34
  // 解析配置中的defStyle属性
34
35
  export function parseDefStyle(defStyle) {
@@ -174,8 +175,8 @@ export function normalConfig({
174
175
  wrapVm: null, // 当前组件的实例(也就是analysisComponent)
175
176
  hireRelat,
176
177
  parent: null, // 这个是执行过程中,动态获取的
177
- router,
178
- route,
178
+ router: router,
179
+ route: route,
179
180
  dynamicHireRelat: '', // 这个也是执行过程中,动态获取的层级
180
181
  }
181
182
 
@@ -195,8 +196,8 @@ export function normalConfig({
195
196
  if (config.pmPageMetaList && config.pmPageMetaList.length) {
196
197
  config.pmPageMetaList = config.pmPageMetaList.map(metaItem => {
197
198
  const { pageConfig } = normalConfig({
198
- route,
199
- router,
199
+ // routeQuery: route?.query,
200
+ // router,
200
201
  cbs,
201
202
  polyfillConfigs,
202
203
  instance,