f
This commit is contained in:
@@ -167,6 +167,21 @@ const resultList = computed(() => {
|
||||
return list
|
||||
})
|
||||
|
||||
const subResultList = computed(() => {
|
||||
if (!result.value || !tool.value?.subResultKey || !tool.value?.subResultLabels)
|
||||
return []
|
||||
const sub = result.value[tool.value.subResultKey]
|
||||
if (!Array.isArray(sub))
|
||||
return []
|
||||
return sub
|
||||
})
|
||||
|
||||
const subResultLabelEntries = computed(() => {
|
||||
if (!tool.value?.subResultLabels)
|
||||
return []
|
||||
return Object.entries(tool.value.subResultLabels)
|
||||
})
|
||||
|
||||
const listLabelEntries = computed(() => {
|
||||
if (!tool.value?.resultLabels)
|
||||
return []
|
||||
@@ -188,9 +203,22 @@ const listLabelEntries = computed(() => {
|
||||
<view v-for="field in tool.fields" :key="field.key" class="field">
|
||||
<text class="field-label">{{ field.label }}</text>
|
||||
|
||||
<!-- 按钮切换 (Radio) -->
|
||||
<view v-if="field.type === 'radio'" class="field-radio-group">
|
||||
<view
|
||||
v-for="opt in field.options"
|
||||
:key="opt.value"
|
||||
class="radio-item"
|
||||
:class="{ active: (form[field.key] ?? field.default) === opt.value }"
|
||||
@tap="form[field.key] = opt.value"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 选择框 -->
|
||||
<picker
|
||||
v-if="field.type === 'select'"
|
||||
v-else-if="field.type === 'select'"
|
||||
mode="selector"
|
||||
:range="field.options.map(opt => opt.label)"
|
||||
:value="getSelectIndex(field, form[field.key])"
|
||||
@@ -286,6 +314,31 @@ const listLabelEntries = computed(() => {
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结果展示 - 子列表型 (如油价明细) -->
|
||||
<view v-if="subResultList.length > 0" class="result-area">
|
||||
<view class="result-title">详细列表</view>
|
||||
<view class="result-card-list">
|
||||
<view
|
||||
v-for="(item, idx) in subResultList"
|
||||
:key="idx"
|
||||
class="result-card-item"
|
||||
>
|
||||
<view
|
||||
v-for="([fieldKey, fieldLabel], fIdx) in subResultLabelEntries"
|
||||
:key="fieldKey"
|
||||
class="card-item-row"
|
||||
>
|
||||
<template v-if="item[fieldKey] !== undefined && item[fieldKey] !== ''">
|
||||
<text v-if="fIdx === 0" class="card-item-index">{{ idx + 1 }}</text>
|
||||
<text v-else class="card-item-index-placeholder" />
|
||||
<text class="card-item-field-label">{{ typeof fieldLabel === 'object' ? fieldLabel.label : fieldLabel }}</text>
|
||||
<text class="card-item-field-value">{{ item[fieldKey] }}</text>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结果展示 - 列表型 -->
|
||||
<view v-if="resultList.length > 0" class="result-area">
|
||||
<view class="result-title">查询结果</view>
|
||||
@@ -386,6 +439,34 @@ const listLabelEntries = computed(() => {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.field-radio-group {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.radio-item {
|
||||
flex: 1;
|
||||
min-width: 140rpx;
|
||||
height: 72rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f7f8fa;
|
||||
border: 1rpx solid #e5e6f0;
|
||||
border-radius: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: #4e5969;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.radio-item.active {
|
||||
background: #e8f3ff;
|
||||
border-color: #1768ff;
|
||||
color: #1768ff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.field-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user