fix(frontend): 输出计算公式直接使用数据库维护数据

This commit is contained in:
LittleBoy 2025-07-30 20:00:52 +08:00
parent 145ee4e255
commit cdf1613a09

View File

@ -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<ResultVarItem[]>(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<ResultVarItem[]>([])
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;
}