From cdf1613a09dd11faa746aa2c9642d3d2acc27790 Mon Sep 17 00:00:00 2001 From: callmeyan Date: Wed, 30 Jul 2025 20:00:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E8=BE=93=E5=87=BA=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=85=AC=E5=BC=8F=E7=9B=B4=E6=8E=A5=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E7=BB=B4=E6=8A=A4=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/use-result-vars.ts | 83 ++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/src/service/use-result-vars.ts b/src/service/use-result-vars.ts index 3dc8cbf..18f2b0c 100644 --- a/src/service/use-result-vars.ts +++ b/src/service/use-result-vars.ts @@ -1,4 +1,4 @@ -import {getList} from "@/service/api/product.ts"; +import {getAllProductInput, getList} from "@/service/api/product.ts"; import {ref} from "vue"; type InputValue = { @@ -118,18 +118,11 @@ const inputList: InputValue[] = [ {name: '白蛋白', key: 'baidanbai', placeholder: '入液量', unit: 'ml', type: 'vein'}, // 新增 ] -export function getInputValue() { +// {name: '力能', key: 'lineng', placeholder: '入液量', unit: 'ml', type: 'vein'}, +export async function getInputValue() { const list: ResultVarItem[] = []; - inputList.forEach(item => { - - if (item.addition) { - const additionExt = item.addition.placeholder || item.addition.unit - list.push({ - label: `${item.name}${additionExt ? '-' + additionExt : ''}`, - text: `${item.name}${additionExt ? '-' + additionExt : ''}`, - value: `input.${item.addition.key}`, - }) - } + const result = await getAllProductInput() + result.forEach(item=>{ const ext = item.placeholder || item.unit list.push({ text: `${ext?`${ext}(${item.name})`:item.name}`, @@ -137,6 +130,23 @@ export function getInputValue() { value: `input.${item.key}`, }) }) + // inputList.forEach(item => { + // + // if (item.addition) { + // const additionExt = item.addition.placeholder || item.addition.unit + // list.push({ + // label: `${item.name}${additionExt ? '-' + additionExt : ''}`, + // text: `${item.name}${additionExt ? '-' + additionExt : ''}`, + // value: `input.${item.addition.key}`, + // }) + // } + // const ext = item.placeholder || item.unit + // list.push({ + // text: `${ext?`${ext}(${item.name})`:item.name}`, + // label: `${ext?`ruye(${item.name})`:item.name}`, + // value: `input.${item.key}`, + // }) + // }) return list } @@ -173,32 +183,35 @@ export function getAllProduct() { } export function getProductValue() { - const list = ref(getInputValue()) - - getList({ - page: 1, - limit: 10000 - }).then(res => { - const _list: ResultVarItem[] = []; - res.list.forEach(it => { - ValueKeys.forEach(key => { - const label = `${it.name}-${key}` - _list.push({ - label, - value: `${it.alias}.${key}`, - text: label, + const list = ref([]) + getInputValue().then(inputList => { + list.value = inputList + getList({ + page: 1, + limit: 100000 + }).then(res => { + const _list: ResultVarItem[] = []; + res.list.forEach(it => { + ValueKeys.forEach(key => { + const label = `${it.name}-${key}` + _list.push({ + label, + value: `${it.alias}.${key}`, + text: label, + }) + // _list.push({ + // label: `${it.name}.${key}`, + // value: `${it.alias}.${key}`, + // text: label, + // }) }) - // _list.push({ - // label: `${it.name}.${key}`, - // value: `${it.alias}.${key}`, - // text: label, - // }) }) + list.value = [ + ...inputList, + ..._list, + ]; }) - list.value = [ - ...list.value, - ..._list, - ]; }) + return list; } \ No newline at end of file