style:配方库-手动录入参数可以补录

main
黄伟杰 1 week ago
parent 0e8771c22e
commit 84916bbded

@ -17,5 +17,18 @@ export const RecipePointRecordApi = {
},
getRecipePointRecordPage: async (params: any) => {
return await request.get({ url: `/iot/recipe-point-record/page`, params })
}
},
updateRecipePointRecord: async (params: {
id: string | number
recipeId?: string | number
name?: string
max?: string | number
min?: string | number
dataType?: string | number
dataUnit?: string | number
remark?: string
refer?: string
}) => {
return await request.put({ url: `/iot/recipe-point-record/update`, data:params })
}
}

@ -129,6 +129,11 @@
prop="remark"
min-width="180"
/>
<el-table-column align="center" fixed="right" label="操作" width="120">
<template #default="scope">
<el-button link type="primary" @click="openReferDialog(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<Pagination
:total="total"
@ -138,16 +143,44 @@
/>
</el-tab-pane>
</el-tabs>
<Dialog v-model="referDialogVisible" title="补录采集值" width="520px">
<el-form :model="referForm" label-width="90px">
<el-form-item label="名称">
<el-input :model-value="referForm.name" disabled />
</el-form-item>
<el-form-item label="数据类型">
<el-input :model-value="referForm.dataType" disabled />
</el-form-item>
<el-form-item label="单位">
<el-input :model-value="referForm.dataUnitLabel" disabled />
</el-form-item>
<el-form-item label="备注">
<el-input :model-value="referForm.remark" type="textarea" disabled />
</el-form-item>
<el-form-item label="参考值">
<el-input v-model="referForm.refer" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="referDialogVisible = false" :disabled="referSubmitting">{{ t('common.cancel') }}</el-button>
<el-button type="primary" @click="submitRefer" :loading="referSubmitting" :disabled="referSubmitting">
{{ t('common.ok') }}
</el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { RecipePointRecordApi } from '@/api/iot/recipepointrecord'
import { RecipeDeviceRecordApi } from '@/api/iot/recipeDeviceRecord'
import { RecipePointVO } from '@/api/iot/recipePoint'
import { ProductUnitApi, ProductUnitVO } from '@/api/erp/product/unit'
defineOptions({ name: 'FormulaLibraryDetailTabs' })
const { t } = useI18n()
const message = useMessage()
const props = defineProps({
recipeId: {
@ -257,6 +290,60 @@ const resetQuery = () => {
handleQuery()
}
const referDialogVisible = ref(false)
const referSubmitting = ref(false)
const referForm = reactive({
id: '' as string,
recipeId: '' as string,
name: '' as string,
max: '' as string,
min: '' as string,
dataType: '' as string,
dataUnit: '' as string,
dataUnitLabel: '' as string,
remark: '' as string,
refer: '' as string
})
const openReferDialog = (row: RecipePointVO) => {
const id = row?.id === undefined || row?.id === null ? '' : String(row.id)
referForm.id = id
referForm.recipeId = row?.recipeId === undefined || row?.recipeId === null ? '' : String(row.recipeId)
referForm.name = row?.name ?? ''
referForm.max = row?.max ?? ''
referForm.min = row?.min ?? ''
referForm.dataType = row?.dataType ?? ''
referForm.dataUnit = row?.dataUnit ?? ''
referForm.dataUnitLabel = getUnitLabel(row?.dataUnit)
referForm.remark = row?.remark ?? ''
referForm.refer = row?.refer ?? ''
referDialogVisible.value = true
}
const submitRefer = async () => {
if (referSubmitting.value) return
if (!referForm.id) return
referSubmitting.value = true
try {
await RecipePointRecordApi.updateRecipePointRecord({
id: referForm.id,
recipeId: referForm.recipeId ? referForm.recipeId : undefined,
name: referForm.name,
max: referForm.max,
min: referForm.min,
dataType: referForm.dataType,
dataUnit: referForm.dataUnit,
remark: referForm.remark,
refer: referForm.refer
})
message.success(t('common.updateSuccess'))
referDialogVisible.value = false
await refreshManual()
} finally {
referSubmitting.value = false
}
}
watch(
() => props.recipeId,
() => {

Loading…
Cancel
Save