|
|
|
|
@ -46,14 +46,14 @@
|
|
|
|
|
/>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane :label="t('RecipeManagement.RecipeLibrary.detailTabManualLabel')" name="manual">
|
|
|
|
|
<!-- <el-form
|
|
|
|
|
<el-form
|
|
|
|
|
class="-mb-15px"
|
|
|
|
|
:model="queryParams"
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
:inline="true"
|
|
|
|
|
label-width="68px"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
|
|
<!-- <el-form-item label="名称" prop="name">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.name"
|
|
|
|
|
placeholder="请输入名称"
|
|
|
|
|
@ -88,16 +88,20 @@
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form-item>-->
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="handleQuery">
|
|
|
|
|
<!-- <el-button @click="handleQuery">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" /> 查询
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button @click="resetQuery">
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
|
|
|
|
</el-button>-->
|
|
|
|
|
<el-button type="primary" plain @click="openCReferDialog()">
|
|
|
|
|
<Icon icon="ep:plus" class="mr-5px" />
|
|
|
|
|
{{ t('RecipeManagement.RecipeLibrary.createButtonText') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form> -->
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id">
|
|
|
|
|
<!-- <el-table-column type="index" :label="t('RecipeManagement.RecipeLibrary.detailIndexColumn')" align="center" width="70" /> -->
|
|
|
|
|
<el-table-column
|
|
|
|
|
@ -155,18 +159,28 @@
|
|
|
|
|
</el-tabs>
|
|
|
|
|
|
|
|
|
|
<Dialog v-model="referDialogVisible" title="补录采集值" width="520px">
|
|
|
|
|
<el-form :model="referForm" label-width="90px">
|
|
|
|
|
<el-form ref="referFormRef" :model="referForm" label-width="90px">
|
|
|
|
|
<el-form-item label="名称">
|
|
|
|
|
<el-input :model-value="referForm.name" disabled />
|
|
|
|
|
<el-input v-model="referForm.name" :disabled="isEdit" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="数据类型">
|
|
|
|
|
<el-input :model-value="referForm.dataType" disabled />
|
|
|
|
|
<el-input v-model="referForm.dataType" :disabled="isEdit" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="单位">
|
|
|
|
|
<el-input :model-value="referForm.dataUnitLabel" disabled />
|
|
|
|
|
<!-- <el-form-item label="单位">
|
|
|
|
|
<el-input v-model="referForm.dataUnitLabel" :disabled="isEdit" />
|
|
|
|
|
</el-form-item>-->
|
|
|
|
|
<el-form-item label="单位" prop="dataUnit">
|
|
|
|
|
<el-select v-model="referForm.dataUnit" :disabled="isEdit" placeholder="请选择单位" class="!w-1/1">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in unitList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注">
|
|
|
|
|
<el-input :model-value="referForm.remark" type="textarea" disabled />
|
|
|
|
|
<el-input v-model="referForm.remark" type="textarea" :disabled="isEdit" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="参考值">
|
|
|
|
|
<el-input v-model="referForm.refer" />
|
|
|
|
|
@ -183,10 +197,12 @@
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import { RecipePointRecordApi } from '@/api/iot/recipepointrecord'
|
|
|
|
|
import {RecipePointRecordApi, RecipePointRecordVO} from '@/api/iot/recipepointrecord'
|
|
|
|
|
import { RecipeDeviceRecordApi } from '@/api/iot/recipeDeviceRecord'
|
|
|
|
|
import { RecipePointVO } from '@/api/iot/recipePoint'
|
|
|
|
|
import { ProductUnitApi, ProductUnitVO } from '@/api/erp/product/unit'
|
|
|
|
|
import {ElMessage} from "element-plus";
|
|
|
|
|
import {ErrorRecordVO} from "@/api/mes/errorrecord";
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'FormulaLibraryDetailTabs' })
|
|
|
|
|
|
|
|
|
|
@ -203,7 +219,7 @@ const props = defineProps({
|
|
|
|
|
const activeTab = ref<'detail' | 'manual'>('detail')
|
|
|
|
|
|
|
|
|
|
const detailList = ref<{ key: string; pointName: string; value: string; unit: string }[]>([])
|
|
|
|
|
|
|
|
|
|
const isEdit = ref(true)
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const list = ref<RecipePointVO[]>([])
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
@ -318,10 +334,10 @@ const resetQuery = () => {
|
|
|
|
|
queryFormRef.value?.resetFields?.()
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const referFormRef = ref()
|
|
|
|
|
const referDialogVisible = ref(false)
|
|
|
|
|
const referSubmitting = ref(false)
|
|
|
|
|
const referForm = reactive({
|
|
|
|
|
const referForm = ref({
|
|
|
|
|
id: '' as string,
|
|
|
|
|
recipeId: '' as string,
|
|
|
|
|
name: '' as string,
|
|
|
|
|
@ -333,10 +349,35 @@ const referForm = reactive({
|
|
|
|
|
remark: '' as string,
|
|
|
|
|
refer: '' as string
|
|
|
|
|
})
|
|
|
|
|
const openCReferDialog = () => {
|
|
|
|
|
isEdit.value = false
|
|
|
|
|
resetDialogForm()
|
|
|
|
|
referDialogVisible.value = true
|
|
|
|
|
}
|
|
|
|
|
const resetDialogForm = () => {
|
|
|
|
|
referForm.value.id= undefined
|
|
|
|
|
referForm.value.recipeId= undefined,
|
|
|
|
|
referForm.value.name= '' as string,
|
|
|
|
|
referForm.value.max= '' as string,
|
|
|
|
|
referForm.value.min='' as string,
|
|
|
|
|
referForm.value.dataType= '' as string,
|
|
|
|
|
referForm.value.dataUnit= '' as string,
|
|
|
|
|
referForm.value.dataUnitLabel= '' as string,
|
|
|
|
|
referForm.value.remark= '' as string,
|
|
|
|
|
referForm.value.refer= '' as string
|
|
|
|
|
/* const form = unref(referFormRef)
|
|
|
|
|
if (!form) {
|
|
|
|
|
ElMessage.warning('表单实例未找到')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 重置表单
|
|
|
|
|
form.resetFields()*/
|
|
|
|
|
//referFormRef.value?.resetFields?.()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const openReferDialog = (row: RecipePointVO) => {
|
|
|
|
|
const id = row?.id === undefined || row?.id === null ? '' : String(row.id)
|
|
|
|
|
referForm.id = id
|
|
|
|
|
/* referForm.id = id
|
|
|
|
|
referForm.recipeId = row?.recipeId === undefined || row?.recipeId === null ? '' : String(row.recipeId)
|
|
|
|
|
referForm.name = row?.name ?? ''
|
|
|
|
|
referForm.max = row?.max ?? ''
|
|
|
|
|
@ -345,27 +386,38 @@ const openReferDialog = (row: RecipePointVO) => {
|
|
|
|
|
referForm.dataUnit = row?.dataUnit ?? ''
|
|
|
|
|
referForm.dataUnitLabel = getUnitLabel(row?.dataUnit)
|
|
|
|
|
referForm.remark = row?.remark ?? ''
|
|
|
|
|
referForm.refer = row?.refer ?? ''
|
|
|
|
|
referForm.refer = row?.refer ?? ''*/
|
|
|
|
|
referForm.value =row
|
|
|
|
|
referForm.value.id = id
|
|
|
|
|
isEdit.value = true
|
|
|
|
|
referDialogVisible.value = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const submitRefer = async () => {
|
|
|
|
|
if (referSubmitting.value) return
|
|
|
|
|
if (!referForm.id) return
|
|
|
|
|
// if (!referForm.id) return
|
|
|
|
|
referSubmitting.value = true
|
|
|
|
|
try {
|
|
|
|
|
if(!referForm.value.id){
|
|
|
|
|
await referFormRef.value.validate()
|
|
|
|
|
referForm.value.recipeId = props.recipeId !== undefined && props.recipeId !== null ? String(props.recipeId) : undefined
|
|
|
|
|
const data = referForm.value as unknown as RecipePointRecordVO
|
|
|
|
|
await RecipePointRecordApi.createRecipePointRecord(data)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
}else{
|
|
|
|
|
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
|
|
|
|
|
id: referForm.value.id,
|
|
|
|
|
recipeId: referForm.value.recipeId ? referForm.value.recipeId : undefined,
|
|
|
|
|
name: referForm.value.name,
|
|
|
|
|
max: referForm.value.max,
|
|
|
|
|
min: referForm.value.min,
|
|
|
|
|
dataType: referForm.value.dataType,
|
|
|
|
|
dataUnit: referForm.value.dataUnit,
|
|
|
|
|
remark: referForm.value.remark,
|
|
|
|
|
refer: referForm.value.refer
|
|
|
|
|
})
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
}
|
|
|
|
|
referDialogVisible.value = false
|
|
|
|
|
await refreshManual()
|
|
|
|
|
} finally {
|
|
|
|
|
@ -380,6 +432,7 @@ watch(
|
|
|
|
|
getList()
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|