resolver-egretimp-plus 0.1.68 → 0.1.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.1.68",
3
+ "version": "0.1.70",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -2,6 +2,7 @@
2
2
  import { computed, defineProps, inject, ref, useAttrs, watch } from 'vue'
3
3
  import { commonPropsType } from '../../utils/index.js'
4
4
 
5
+ const filterKey = ref('')
5
6
  const pickerRef = ref(null)
6
7
  const selects = inject('selects')
7
8
  const rootForm = inject('rootForm')
@@ -36,28 +37,43 @@ const formatValue = computed({
36
37
  }
37
38
  })
38
39
 
40
+ // 是否为多选
41
+ const isMutiple = computed(() => {
42
+ return props.multiple == '1'
43
+ })
44
+ // 是否开启过滤, todo == 暂时不支持多列
45
+ const isFilter = computed(() => {
46
+ return props.filterable == '1'
47
+ })
39
48
  const calcProps = computed(() => {
40
49
  const ret = {
41
50
  type: props?.config?.displayType,
42
51
  title: lang.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
43
52
  canceltext: props?.config?.canceltext,
44
53
  confirmtext: props?.config?.confirmtext,
45
- bottomhidden: props?.config?.bottomhidden == '1',
46
54
  forbidmaskclick: props?.config?.forbidmaskclick == '1',
47
- fastpick: props?.config?.fastpick == '1',
55
+ fastpick: isFilter.value ? true : (props?.config?.fastpick == '1'),
56
+ bottomhidden: props?.config?.bottomhidden == '1',
48
57
  }
49
58
  return ret
50
59
  })
51
- const getColumns = () => {
60
+ const getColumns = (filterKey) => {
52
61
  const selectKeyArr = props.config?.selectKey?.split?.(',') || []
53
62
  return selectKeyArr.map((key, idx) => {
54
- let index = selects?.value?.[key]?.findIndex(option => option?.columnValue === formatValue.value[idx])
63
+ const values = selects?.value?.[key]?.map(option => ({
64
+ label: lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc,
65
+ value: option.columnValue
66
+ }))?.filter(item => {
67
+ if (filterKey) {
68
+ return item.label?.includes(filterKey)
69
+ } else {
70
+ return true
71
+ }
72
+ }) || []
73
+ let index = values.findIndex(option => option?.value === formatValue.value[idx])
55
74
  return {
56
- defaultIndex: index > -1 ? index : 0,
57
- values: selects?.value?.[key]?.map(option => ({
58
- label: lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc,
59
- value: option.columnValue
60
- }))
75
+ defaultIndex: index > -1 ? index : (isFilter.value ? -1 : 0),
76
+ values,
61
77
  }
62
78
  })
63
79
  }
@@ -113,12 +129,25 @@ const inputProps = computed(() => {
113
129
  }
114
130
  })
115
131
 
132
+ watch(filterKey, (val) => {
133
+ pickerRef.value?.setColumns?.(getColumns(val))
134
+ })
135
+ watch(open, (val) => {
136
+ if (!val) {
137
+ filterKey.value = ''
138
+ }
139
+ }, {
140
+ immediate: true
141
+ })
142
+ function filterChange(e) {
143
+ filterKey.value = e.detail.value
144
+ }
116
145
  </script>
117
146
 
118
147
  <template>
119
148
  <cmi-input :value="modelvalDesc" suffixIcon @focus="onFocus" v-bind="{...attrs, ...inputProps}" >
120
- <div slot="suffix" v-if="suffixIcon">
121
- <component :is="`cmi-icon-${suffixIcon}`" color="#4E5969"></component>
149
+ <div slot="suffix" v-if="suffixIcon" class="suffix-wrap">
150
+ <component @click="() => { ('arrow-down' == suffixIcon) && onFocus();}" :is="`cmi-icon-${suffixIcon}`" color="#4E5969"></component>
122
151
  </div>
123
152
  <span slot="prefix" v-if="prefixIcon">
124
153
  <component :is="`cmi-icon-${prefixIcon}`" color="#4E5969"></component>
@@ -130,5 +159,30 @@ const inputProps = computed(() => {
130
159
  :open="open"
131
160
  @close="onClose"
132
161
  @confirm="onConfirm"
133
- />
162
+ >
163
+ <div v-if="isFilter" slot="header" class="filter-header-wrap">
164
+ <span class="filte-title">{{ calcProps.title }}</span>
165
+ <cmi-input class="filter-input" @change="filterChange" :value="filterKey"></cmi-input>
166
+ </div>
167
+ </cmi-picker>
134
168
  </template>
169
+ <style lang="scss" scoped>
170
+ .suffix-wrap {
171
+ display: flex;
172
+ justify-content: center;
173
+ align-items: center;
174
+ font-size: 16px;
175
+ }
176
+ .filter-header-wrap {
177
+ display: flex;
178
+ justify-content: space-between;
179
+ align-items: center;
180
+ width: 100%;
181
+ .filte-title {
182
+ max-width: 50%;
183
+ }
184
+ .filter-input {
185
+ max-width: 50%;
186
+ }
187
+ }
188
+ </style>
@@ -58,7 +58,7 @@ export function formatSelectVal({
58
58
  if (!isHidden({config}) || isActive) {
59
59
  const valueType = config?.valueType
60
60
  const separator = config?.separator
61
- if (valueType == VALUE_TYPES.STRING) {
61
+ if (valueType !== VALUE_TYPES.LIST && valueType !== VALUE_TYPES.OBJECT) {
62
62
  if (isPlainObject(val) || isArray(val)) {
63
63
  try {
64
64
  retValue = Object.values(val).join(separator)