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"; import {ref} from "vue";
type InputValue = { type InputValue = {
@ -118,18 +118,11 @@ const inputList: InputValue[] = [
{name: '白蛋白', key: 'baidanbai', placeholder: '入液量', unit: 'ml', type: 'vein'}, // 新增 {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[] = []; const list: ResultVarItem[] = [];
inputList.forEach(item => { const result = await getAllProductInput()
result.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 const ext = item.placeholder || item.unit
list.push({ list.push({
text: `${ext?`${ext}(${item.name})`:item.name}`, text: `${ext?`${ext}(${item.name})`:item.name}`,
@ -137,6 +130,23 @@ export function getInputValue() {
value: `input.${item.key}`, 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 return list
} }
@ -173,11 +183,12 @@ export function getAllProduct() {
} }
export function getProductValue() { export function getProductValue() {
const list = ref<ResultVarItem[]>(getInputValue()) const list = ref<ResultVarItem[]>([])
getInputValue().then(inputList => {
list.value = inputList
getList({ getList({
page: 1, page: 1,
limit: 10000 limit: 100000
}).then(res => { }).then(res => {
const _list: ResultVarItem[] = []; const _list: ResultVarItem[] = [];
res.list.forEach(it => { res.list.forEach(it => {
@ -196,9 +207,11 @@ export function getProductValue() {
}) })
}) })
list.value = [ list.value = [
...list.value, ...inputList,
..._list, ..._list,
]; ];
}) })
})
return list; return list;
} }