diff --git a/src/api/iot/recipePlanDetail/index.ts b/src/api/iot/recipePlanDetail/index.ts new file mode 100644 index 00000000..8f1b039f --- /dev/null +++ b/src/api/iot/recipePlanDetail/index.ts @@ -0,0 +1,38 @@ +import request from '@/config/axios' + +export interface RecipePlanDetailVO { + id?: number + code?: string + name?: string + recipeId?: number | string + recipeName?: string + planId?: number | string + planCode?: string + creator?: string + createTime?: string + source?: string + isEnable?: string | number | boolean +} + +export const RecipePlanDetailApi = { + getRecipePlanDetailPage: async (params: any) => { + return await request.get({ url: `/iot/recipe-plan-detail/page`, params }) + }, + + createRecipePlanDetail: async (data: Partial) => { + return await request.post({ url: `/iot/recipe-plan-detail/create`, data }) + }, + + updateRecipePlanDetail: async (data: Partial) => { + return await request.put({ url: `/iot/recipe-plan-detail/update`, data }) + }, + + deleteRecipePlanDetail: async (id: number) => { + return await request.delete({ url: `/iot/recipe-plan-detail/delete?id=` + id }) + }, + + exportRecipePlanDetail: async (params: any) => { + return await request.download({ url: `/iot/recipe-plan-detail/export-excel`, params }) + } +} + diff --git a/src/api/iot/recipePoint/index.ts b/src/api/iot/recipePoint/index.ts index 2185218a..4ac050a3 100644 --- a/src/api/iot/recipePoint/index.ts +++ b/src/api/iot/recipePoint/index.ts @@ -1,31 +1,21 @@ import request from '@/config/axios' export interface RecipePointVO { - id: number - recipeId: string | number + id?: number + recipeId?: number | string name?: string - max?: string | number - min?: string | number - dataType?: string + refer?: string dataUnit?: string remark?: string + max?: string + min?: string + dataType?: string createTime?: string } export const RecipePointApi = { getRecipePointPage: async (params: any) => { return await request.get({ url: `/iot/recipe-point/page`, params }) - }, - - createRecipePoint: async (params: Partial) => { - return await request.post({ url: `/iot/recipe-point/create`, data: params }) - }, - - updateRecipePoint: async (params: Partial) => { - return await request.put({ url: `/iot/recipe-point/update`, data: params }) - }, - - deleteRecipePoint: async (id: number) => { - return await request.delete({ url: `/iot/recipe-point/delete`, params: { id } }) } } + diff --git a/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue new file mode 100644 index 00000000..3e36ae51 --- /dev/null +++ b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/views/formula/formulaLibrary/index.vue b/src/views/formula/formulaLibrary/index.vue index 3a62fd9b..18e996be 100644 --- a/src/views/formula/formulaLibrary/index.vue +++ b/src/views/formula/formulaLibrary/index.vue @@ -111,6 +111,7 @@ @@ -129,6 +130,8 @@ + + @@ -165,8 +168,10 @@ import download from '@/utils/download' import { dateFormatter } from '@/utils/formatTime' import { RecipePlanDetailApi, RecipePlanDetailVO } from '@/api/iot/recipePlanDetail' import { RecipeConfigApi } from '@/api/iot/recipeConfig' +import { RecipePointApi } from '@/api/iot/recipePoint' import { PlanApi } from '@/api/mes/plan' import FormulaLibraryDetailTabs from './components/FormulaLibraryDetailTabs.vue' +import FormulaLibraryReadDialog from './components/FormulaLibraryReadDialog.vue' type SelectOption = { label: string; value: T } @@ -341,6 +346,17 @@ const openDialog = async (type: 'create' | 'update', row?: RecipePlanDetailVO) = } } +const readDialogRef = ref>() + +const handleRead = async (row: RecipePlanDetailVO) => { + const recipeId = row?.recipeId + if (!recipeId) return + const recipeName = row?.recipeName + const data = await RecipePointApi.getRecipePointPage({ pageNo: 1, pageSize: 10, recipeId: String(recipeId) }) + if (!data?.list?.length) return + await readDialogRef.value?.open({ recipeId, recipeName, initialData: data }) +} + const submitDialog = async () => { await dialogFormRef.value.validate() dialogLoading.value = true