修改测算逻辑

This commit is contained in:
wuweihua
2026-09-18 17:09:43 +08:00
parent e08a36de91
commit bb240746a6
22 changed files with 435 additions and 44 deletions
@@ -8,29 +8,47 @@
>
<div class="drawer-body" v-loading="loading">
<div class="toolbar">
<el-input
<el-select
v-model="query.productKeyword"
filterable
clearable
:placeholder="phProduct"
style="width: 160px"
@keyup.enter="search"
/>
<el-input
:loading="optionsLoading"
style="width: 200px"
>
<el-option v-for="p in optionProducts" :key="p.code" :label="p.label" :value="p.code">
<span class="opt-name">{{ p.name }}</span>
<span class="opt-code">{{ p.code }}</span>
</el-option>
</el-select>
<el-select
v-if="isFixed"
v-model="query.countryKeyword"
filterable
clearable
:placeholder="phCountry"
style="width: 140px"
@keyup.enter="search"
/>
<el-input
:loading="optionsLoading"
style="width: 160px"
>
<el-option v-for="c in optionCountries" :key="c.key" :label="c.label" :value="c.value">
<span class="opt-name">{{ c.name }}</span>
<span class="opt-code">{{ c.code }}</span>
</el-option>
</el-select>
<el-select
v-if="isFixed"
v-model="query.zoneKeyword"
filterable
clearable
:placeholder="phZone"
style="width: 140px"
@keyup.enter="search"
/>
:loading="optionsLoading"
style="width: 160px"
>
<el-option v-for="z in optionZones" :key="z.key" :label="z.label" :value="z.value">
<span class="opt-name">{{ z.name }}</span>
<span class="opt-code">{{ z.code }}</span>
</el-option>
</el-select>
<el-button type="primary" @click="search">查询</el-button>
<el-button @click="reset">重置</el-button>
</div>
@@ -110,7 +128,7 @@
<script setup name="SetVersionDetailDrawer">
import SurchargeTags from '../SurchargeTags.vue'
import { isFixedType } from '../../utils/priceSet'
import { listSetDetail } from '@/api/price/set'
import { listSetDetail, listSetDetailOptions } from '@/api/price/set'
const props = defineProps({
modelValue: { type: Boolean, default: false },
@@ -132,7 +150,48 @@ const query = reactive({
zoneKeyword: ''
})
const phProduct = '产品代码/名称'
// 下拉选项:当前版本内去重后的 产品/国家/分区
const optionsLoading = ref(false)
const optionProducts = ref([])
const optionCountries = ref([])
const optionZones = ref([])
function loadOptions() {
const psvId = props.version && props.version.psvId
if (!psvId) {
optionProducts.value = []
optionCountries.value = []
optionZones.value = []
return
}
optionsLoading.value = true
listSetDetailOptions(psvId).then(res => {
const data = res.data || {}
optionProducts.value = (data.products || []).map(p => ({
code: p.code,
name: p.name || p.code,
label: (p.name && p.name !== p.code) ? `${p.code} ${p.name}` : p.code
}))
optionCountries.value = (data.countries || []).map(c => ({
key: c.code || c.name,
code: c.code || '-',
name: c.name || c.code,
value: c.code || c.name, // 有代码按代码搜,否则按名称搜(后端 code/name 双 LIKE)
label: (c.name && c.code) ? `${c.name} ${c.code}` : (c.name || c.code)
}))
optionZones.value = (data.zones || []).map(z => ({
key: z.code || z.name,
code: z.code || '-',
name: z.name || z.code,
value: z.code || z.name,
label: (z.name && z.code) ? `${z.name} ${z.code}` : (z.name || z.code)
}))
}).finally(() => {
optionsLoading.value = false
})
}
const phProduct = '产品'
const phCountry = '国家'
const phZone = '分区'
const colProduct = '产品'
@@ -205,6 +264,7 @@ watch(
query.productKeyword = ''
query.countryKeyword = ''
query.zoneKeyword = ''
loadOptions()
load()
}
}
@@ -242,6 +302,13 @@ watch(
padding: 0 6px;
}
.p-name { color: #303133; }
.opt-name { margin-right: 8px; }
.opt-code {
float: right;
color: var(--el-text-color-secondary);
font-size: 12px;
font-family: Consolas, Monaco, monospace;
}
.hl { color: #1890ff; font-weight: 600; }
.reg { color: #d48806; font-weight: 600; }
.pct { color: #1890ff; font-weight: 600; }