style:质量管理-检验项目-单位显示转换

main
黄伟杰 2 weeks ago
parent b12d9ad732
commit 196b76f4f0

@ -91,7 +91,11 @@
<el-table-column label="标准值" align="center" prop="standardVal" />
<el-table-column label="上限值" align="center" prop="upperVal" />
<el-table-column label="下限值" align="center" prop="lowerVal" />
<el-table-column label="单位" align="center" prop="unit" />
<el-table-column label="单位" align="center" prop="unit">
<template #default="scope">
{{ getUnitName(scope.row.unit) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column
label="创建时间"
@ -139,7 +143,8 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { ZjItemApi, ZjItemVO } from '@/api/mes/zjitem'
import ZjItemForm from './ZjItemForm.vue'
import {ZjTypeApi, ZjTypeVO} from "@/api/mes/zjtype";
import { ZjTypeApi, ZjTypeVO } from '@/api/mes/zjtype'
import { ProductUnitApi, ProductUnitVO } from '@/api/erp/product/unit'
/** 质量管理-检验项目 列表 */
defineOptions({ name: 'ZjItem' })
@ -148,6 +153,7 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() //
const typeList = ref<ZjTypeVO[]>([]) //
const unitList = ref<ProductUnitVO[]>([]) //
const loading = ref(true) //
const list = ref<ZjItemVO[]>([]) //
const total = ref(0) //
@ -228,8 +234,16 @@ const handleExport = async () => {
/** 初始化 **/
onMounted(async () => {
typeList.value = await ZjTypeApi.getZjTypeList()
unitList.value = await ProductUnitApi.getProductUnitSimpleList()
getList()
})
const getUnitName = (value: any) => {
const v = value === '' || value === null || value === undefined ? undefined : Number(value)
if (!v || !unitList.value.length) return '-'
const item = unitList.value.find((u) => u.id === v)
return item?.name ?? '-'
}
</script>
Loading…
Cancel
Save