Commit 26bd2e0aac4c0abbe481c2fd88afdf44044b6d15

Authored by ww
1 parent d28b93ae

fix: 修复apiSelect配置别名选项时option中无别名无法正确回显

@@ -99,7 +99,7 @@ @@ -99,7 +99,7 @@
99 99
100 .first-text-animation-container svg { 100 .first-text-animation-container svg {
101 display: block; 101 display: block;
102 - font-size: 120px; 102 + font-size: 80px;
103 103
104 /* width: 100vw; 104 /* width: 100vw;
105 height: 100vh; */ 105 height: 100vh; */
@@ -271,9 +271,9 @@ @@ -271,9 +271,9 @@
271 <body class="geEditor"> 271 <body class="geEditor">
272 <div id="geInfo"> 272 <div id="geInfo">
273 <div class="first-text-animation-container"> 273 <div class="first-text-animation-container">
274 - <svg id="first-text-animation" viewBox="0 0 960 300"> 274 + <svg id="first-text-animation" viewBox="0 0 960 100">
275 <symbol id="first-text-animation-text"> 275 <symbol id="first-text-animation-text">
276 - <text text-anchor="middle" x="50%" y="80%"></text> 276 + <text text-anchor="middle" x="50%" y="80%">Scada</text>
277 </symbol> 277 </symbol>
278 <g class="g-ants"> 278 <g class="g-ants">
279 <use xlink:href="#first-text-animation-text" class="text-copy"></use> 279 <use xlink:href="#first-text-animation-text" class="text-copy"></use>
@@ -46,17 +46,21 @@ const emitData = ref<any[]>([]) @@ -46,17 +46,21 @@ const emitData = ref<any[]>([])
46 const [state] = useRuleFormItem(props, 'value', 'change', emitData) 46 const [state] = useRuleFormItem(props, 'value', 'change', emitData)
47 47
48 const getOptions = computed(() => { 48 const getOptions = computed(() => {
49 - const { numberToString, fieldNames } = props  
50 - const { value: valueField = 'value' } = fieldNames 49 + const { numberToString, fieldNames, aliasField } = props
  50 + const { value: valueField = 'value', label: labelField = 'label' } = fieldNames
51 51
52 const data = unref(optionsRef).reduce((prev, next: any) => { 52 const data = unref(optionsRef).reduce((prev, next: any) => {
53 if (next) { 53 if (next) {
54 const value = get(next, valueField) 54 const value = get(next, valueField)
55 55
56 - prev.push({ 56 + const options = {
57 ...next, 57 ...next,
58 [valueField]: numberToString ? `${value}` : value, 58 [valueField]: numberToString ? `${value}` : value,
59 - } as DefaultOptionType) 59 + } as DefaultOptionType
  60 + if (aliasField)
  61 + Object.assign(options, { [aliasField]: options[aliasField] || options[labelField] })
  62 +
  63 + prev.push(options)
60 } 64 }
61 return prev 65 return prev
62 }, [] as DefaultOptionType[]) 66 }, [] as DefaultOptionType[])