|
|
|
@ -1,44 +1,24 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<ContentWrap>
|
|
|
|
<ContentWrap>
|
|
|
|
<el-form
|
|
|
|
<el-form
|
|
|
|
class="-mb-15px recipe-library-filter-form"
|
|
|
|
class="-mb-15px recipe-library-filter-form" :model="queryParams" ref="queryFormRef" :inline="true"
|
|
|
|
:model="queryParams"
|
|
|
|
label-width="auto">
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
|
|
|
:inline="true"
|
|
|
|
|
|
|
|
label-width="auto"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.searchCodeLabel')" prop="code">
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.searchCodeLabel')" prop="code">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.code"
|
|
|
|
v-model="queryParams.code" :placeholder="t('RecipeManagement.RecipeLibrary.searchCodePlaceholder')"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.searchCodePlaceholder')"
|
|
|
|
clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
|
|
clearable
|
|
|
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.searchNameLabel')" prop="name">
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.searchNameLabel')" prop="name">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.name"
|
|
|
|
v-model="queryParams.name" :placeholder="t('RecipeManagement.RecipeLibrary.searchNamePlaceholder')"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.searchNamePlaceholder')"
|
|
|
|
clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
|
|
clearable
|
|
|
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.searchRecipeLabel')" prop="recipeId">
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.searchRecipeLabel')" prop="recipeId">
|
|
|
|
<el-select
|
|
|
|
<el-select
|
|
|
|
v-model="queryParams.recipeId"
|
|
|
|
v-model="queryParams.recipeId"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.searchRecipePlaceholder')"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.searchRecipePlaceholder')" clearable filterable
|
|
|
|
clearable
|
|
|
|
class="!w-240px">
|
|
|
|
filterable
|
|
|
|
<el-option v-for="opt in recipeOptions" :key="String(opt.value)" :label="opt.label" :value="opt.value" />
|
|
|
|
class="!w-240px"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="opt in recipeOptions"
|
|
|
|
|
|
|
|
:key="String(opt.value)"
|
|
|
|
|
|
|
|
:label="opt.label"
|
|
|
|
|
|
|
|
:value="opt.value"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<!-- <el-form-item label="来源" prop="source">
|
|
|
|
<!-- <el-form-item label="来源" prop="source">
|
|
|
|
@ -69,32 +49,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
<ContentWrap>
|
|
|
|
<ContentWrap>
|
|
|
|
<el-table
|
|
|
|
<el-table
|
|
|
|
v-loading="loading"
|
|
|
|
v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id"
|
|
|
|
:data="list"
|
|
|
|
highlight-current-row @row-click="handleRowClick">
|
|
|
|
:stripe="true"
|
|
|
|
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
|
|
|
|
row-key="id"
|
|
|
|
|
|
|
|
highlight-current-row
|
|
|
|
|
|
|
|
@row-click="handleRowClick"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
<el-table-column
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableCodeColumn')"
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableCodeColumn')" align="center" prop="code"
|
|
|
|
align="center"
|
|
|
|
min-width="140" />
|
|
|
|
prop="code"
|
|
|
|
|
|
|
|
min-width="140"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
<el-table-column
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableNameColumn')"
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableNameColumn')" align="center" prop="name"
|
|
|
|
align="center"
|
|
|
|
min-width="140" />
|
|
|
|
prop="name"
|
|
|
|
|
|
|
|
min-width="140"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
<el-table-column
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableRecipeNameColumn')"
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableRecipeNameColumn')" align="center"
|
|
|
|
align="center"
|
|
|
|
prop="recipeName" min-width="160">
|
|
|
|
prop="recipeName"
|
|
|
|
|
|
|
|
min-width="160"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<span>{{ scope.row.recipeName ?? '-' }}</span>
|
|
|
|
<span>{{ scope.row.recipeName ?? '-' }}</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
@ -106,12 +71,8 @@
|
|
|
|
width="120"
|
|
|
|
width="120"
|
|
|
|
/> -->
|
|
|
|
/> -->
|
|
|
|
<el-table-column
|
|
|
|
<el-table-column
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableCreateTimeColumn')"
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableCreateTimeColumn')" align="center"
|
|
|
|
align="center"
|
|
|
|
prop="createTime" :formatter="dateFormatter" width="180" />
|
|
|
|
prop="createTime"
|
|
|
|
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
|
|
|
|
width="180"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- <el-table-column label="来源" align="center" prop="source" width="120">
|
|
|
|
<!-- <el-table-column label="来源" align="center" prop="source" width="120">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-tag v-if="scope.row.source" :type="getSourceTagType(scope.row.source)">{{ scope.row.source }}</el-tag>
|
|
|
|
<el-tag v-if="scope.row.source" :type="getSourceTagType(scope.row.source)">{{ scope.row.source }}</el-tag>
|
|
|
|
@ -119,11 +80,8 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column> -->
|
|
|
|
</el-table-column> -->
|
|
|
|
<el-table-column
|
|
|
|
<el-table-column
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableOperateColumn')"
|
|
|
|
:label="t('RecipeManagement.RecipeLibrary.tableOperateColumn')" align="center" width="180"
|
|
|
|
align="center"
|
|
|
|
fixed="right">
|
|
|
|
width="180"
|
|
|
|
|
|
|
|
fixed="right"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-button link type="primary" @click.stop="handleRead(scope.row)">
|
|
|
|
<el-button link type="primary" @click.stop="handleRead(scope.row)">
|
|
|
|
{{ t('RecipeManagement.RecipeLibrary.tableReadAction') }}
|
|
|
|
{{ t('RecipeManagement.RecipeLibrary.tableReadAction') }}
|
|
|
|
@ -139,11 +97,8 @@
|
|
|
|
</el-table>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
<Pagination
|
|
|
|
<Pagination
|
|
|
|
:total="total"
|
|
|
|
:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
@pagination="getList" />
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</ContentWrap>
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
|
|
<ContentWrap v-if="detailVisible">
|
|
|
|
<ContentWrap v-if="detailVisible">
|
|
|
|
@ -154,37 +109,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="720px">
|
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="720px">
|
|
|
|
<el-form
|
|
|
|
<el-form
|
|
|
|
ref="dialogFormRef"
|
|
|
|
ref="dialogFormRef" :model="dialogForm" :rules="dialogRules" class="recipe-library-dialog-form"
|
|
|
|
:model="dialogForm"
|
|
|
|
label-width="auto" v-loading="dialogLoading">
|
|
|
|
:rules="dialogRules"
|
|
|
|
|
|
|
|
class="recipe-library-dialog-form"
|
|
|
|
|
|
|
|
label-width="auto"
|
|
|
|
|
|
|
|
v-loading="dialogLoading"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.dialogCodeLabel')" prop="code">
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.dialogCodeLabel')" prop="code">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="dialogForm.code"
|
|
|
|
v-model="dialogForm.code" :placeholder="t('RecipeManagement.RecipeLibrary.dialogCodePlaceholder')"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.dialogCodePlaceholder')"
|
|
|
|
clearable :disabled="dialogType == 'update'" />
|
|
|
|
clearable
|
|
|
|
|
|
|
|
:disabled="dialogType == 'update'"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.dialogNameLabel')" prop="name">
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.dialogNameLabel')" prop="name">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="dialogForm.name"
|
|
|
|
v-model="dialogForm.name" :placeholder="t('RecipeManagement.RecipeLibrary.dialogNamePlaceholder')"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.dialogNamePlaceholder')"
|
|
|
|
clearable />
|
|
|
|
clearable
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.dialogRecipeLabel')" prop="recipeId">
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeLibrary.dialogRecipeLabel')" prop="recipeId">
|
|
|
|
<el-select
|
|
|
|
<el-select
|
|
|
|
v-model="dialogForm.recipeId"
|
|
|
|
v-model="dialogForm.recipeId"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.dialogRecipePlaceholder')"
|
|
|
|
:placeholder="t('RecipeManagement.RecipeLibrary.dialogRecipePlaceholder')" clearable filterable
|
|
|
|
clearable
|
|
|
|
class="!w-full" :disabled="dialogType == 'update'">
|
|
|
|
filterable
|
|
|
|
|
|
|
|
class="!w-full"
|
|
|
|
|
|
|
|
:disabled="dialogType == 'update'"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-option v-for="opt in recipeOptions" :key="String(opt.value)" :label="opt.label" :value="opt.value" />
|
|
|
|
<el-option v-for="opt in recipeOptions" :key="String(opt.value)" :label="opt.label" :value="opt.value" />
|
|
|
|
</el-select>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
@ -260,7 +201,7 @@ const sourceOptions: SelectOption<string>[] = [
|
|
|
|
const recipeOptions = ref<SelectOption[]>([])
|
|
|
|
const recipeOptions = ref<SelectOption[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
const ensureOptionsLoaded = async () => {
|
|
|
|
const ensureOptionsLoaded = async () => {
|
|
|
|
const recipeRes = await RecipeConfigApi.getRecipeConfigPage({})
|
|
|
|
const recipeRes = await RecipeConfigApi.getRecipeConfigPage({})
|
|
|
|
recipeOptions.value = (recipeRes?.list ?? []).map((item: any) => {
|
|
|
|
recipeOptions.value = (recipeRes?.list ?? []).map((item: any) => {
|
|
|
|
const label = item.name ? `${item.recipeCode ?? ''}${item.recipeCode ? '-' : ''}${item.name}` : String(item.id)
|
|
|
|
const label = item.name ? `${item.recipeCode ?? ''}${item.recipeCode ? '-' : ''}${item.name}` : String(item.id)
|
|
|
|
return { label, value: item.id }
|
|
|
|
return { label, value: item.id }
|
|
|
|
@ -275,7 +216,7 @@ const buildQueryParams = () => {
|
|
|
|
pageSize: queryParams.pageSize,
|
|
|
|
pageSize: queryParams.pageSize,
|
|
|
|
code: code ? code : undefined,
|
|
|
|
code: code ? code : undefined,
|
|
|
|
name: name ? name : undefined,
|
|
|
|
name: name ? name : undefined,
|
|
|
|
recipeId: queryParams.recipeId ? String(queryParams.recipeId) : undefined,
|
|
|
|
recipeId: queryParams.recipeId ? String(queryParams.recipeId) : undefined,
|
|
|
|
source: queryParams.source ? queryParams.source : undefined
|
|
|
|
source: queryParams.source ? queryParams.source : undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -349,24 +290,24 @@ const dialogFormRef = ref()
|
|
|
|
const dialogType = ref<'create' | 'update'>('create')
|
|
|
|
const dialogType = ref<'create' | 'update'>('create')
|
|
|
|
|
|
|
|
|
|
|
|
const dialogForm = ref<RecipePlanDetailVO>({
|
|
|
|
const dialogForm = ref<RecipePlanDetailVO>({
|
|
|
|
id: undefined,
|
|
|
|
id: undefined,
|
|
|
|
code: '',
|
|
|
|
code: '',
|
|
|
|
name: '',
|
|
|
|
name: '',
|
|
|
|
recipeId: undefined,
|
|
|
|
recipeId: undefined,
|
|
|
|
source: undefined,
|
|
|
|
source: undefined,
|
|
|
|
isEnable: undefined
|
|
|
|
isEnable: undefined
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const dialogRules = reactive({
|
|
|
|
const dialogRules = reactive({
|
|
|
|
code: [
|
|
|
|
code: [
|
|
|
|
{ required: true, message: t('RecipeManagement.RecipeLibrary.validatorCodeRequired'), trigger: 'blur' }
|
|
|
|
{ required: true, message: t('RecipeManagement.RecipeLibrary.validatorCodeRequired'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
],
|
|
|
|
name: [
|
|
|
|
name: [
|
|
|
|
{ required: true, message: t('RecipeManagement.RecipeLibrary.validatorNameRequired'), trigger: 'blur' }
|
|
|
|
{ required: true, message: t('RecipeManagement.RecipeLibrary.validatorNameRequired'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
],
|
|
|
|
recipeId: [
|
|
|
|
recipeId: [
|
|
|
|
{ required: true, message: t('RecipeManagement.RecipeLibrary.validatorRecipeRequired'), trigger: 'change' }
|
|
|
|
{ required: true, message: t('RecipeManagement.RecipeLibrary.validatorRecipeRequired'), trigger: 'change' }
|
|
|
|
]
|
|
|
|
]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const resetDialogForm = () => {
|
|
|
|
const resetDialogForm = () => {
|
|
|
|
@ -374,8 +315,8 @@ const resetDialogForm = () => {
|
|
|
|
id: undefined,
|
|
|
|
id: undefined,
|
|
|
|
code: '',
|
|
|
|
code: '',
|
|
|
|
name: '',
|
|
|
|
name: '',
|
|
|
|
recipeId: undefined,
|
|
|
|
recipeId: undefined,
|
|
|
|
source: undefined
|
|
|
|
source: undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dialogFormRef.value?.resetFields?.()
|
|
|
|
dialogFormRef.value?.resetFields?.()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -391,7 +332,7 @@ const openDialog = async (type: 'create' | 'update', row?: RecipePlanDetailVO) =
|
|
|
|
id: row.id,
|
|
|
|
id: row.id,
|
|
|
|
code: row.code,
|
|
|
|
code: row.code,
|
|
|
|
name: row.name,
|
|
|
|
name: row.name,
|
|
|
|
recipeId: row.recipeId ?? (row as any).recipeId,
|
|
|
|
recipeId: row.recipeId ?? (row as any).recipeId,
|
|
|
|
source: row.source
|
|
|
|
source: row.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -402,7 +343,7 @@ const readDialogRef = ref<InstanceType<typeof FormulaLibraryReadDialog>>()
|
|
|
|
const checkRecipeRecords = async (recipeId: string | number) => {
|
|
|
|
const checkRecipeRecords = async (recipeId: string | number) => {
|
|
|
|
const params = {
|
|
|
|
const params = {
|
|
|
|
pageNo: 1,
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
recipeId: String(recipeId)
|
|
|
|
recipeId: String(recipeId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@ -428,15 +369,18 @@ const handleRead = async (row: RecipePlanDetailVO) => {
|
|
|
|
const recipeId = row?.recipeId
|
|
|
|
const recipeId = row?.recipeId
|
|
|
|
const id = row?.id
|
|
|
|
const id = row?.id
|
|
|
|
if (!recipeId) return
|
|
|
|
if (!recipeId) return
|
|
|
|
|
|
|
|
handleRowClick(row)
|
|
|
|
const recipeName = row?.recipeName
|
|
|
|
const recipeName = row?.recipeName
|
|
|
|
const { hasDeviceRecords, hasManualRecords } = await checkRecipeRecords(recipeId)
|
|
|
|
const { hasDeviceRecords, hasManualRecords } = await checkRecipeRecords(recipeId)
|
|
|
|
const data = await RecipePointApi.getRecipePointList(Number(recipeId))
|
|
|
|
const data = await RecipePointApi.getRecipePointList(Number(recipeId))
|
|
|
|
if (!data?.length) {
|
|
|
|
if (!data?.length) {
|
|
|
|
await message.confirm(t('RecipeManagement.RecipeLibrary.readDeviceConfirmMessage'))
|
|
|
|
await message.confirm(
|
|
|
|
|
|
|
|
`${t('RecipeManagement.RecipeLibrary.readDeviceConfirmMessage')}(${t('RecipeManagement.RecipeLibrary.readDialogOverwriteTip')})`
|
|
|
|
|
|
|
|
)
|
|
|
|
if (id != null) {
|
|
|
|
if (id != null) {
|
|
|
|
await RecipeDeviceRecordApi.createRecipeDeviceRecordBatch(id)
|
|
|
|
await RecipeDeviceRecordApi.createRecipeDeviceRecordBatch(id)
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await readDialogRef.value?.open({
|
|
|
|
await readDialogRef.value?.open({
|
|
|
|
@ -456,7 +400,7 @@ const submitDialog = async () => {
|
|
|
|
id: dialogForm.value.id,
|
|
|
|
id: dialogForm.value.id,
|
|
|
|
code: dialogForm.value.code,
|
|
|
|
code: dialogForm.value.code,
|
|
|
|
name: dialogForm.value.name,
|
|
|
|
name: dialogForm.value.name,
|
|
|
|
recipeId: dialogForm.value.recipeId,
|
|
|
|
recipeId: dialogForm.value.recipeId,
|
|
|
|
source: dialogForm.value.source
|
|
|
|
source: dialogForm.value.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dialogType.value === 'create') {
|
|
|
|
if (dialogType.value === 'create') {
|
|
|
|
@ -474,8 +418,8 @@ const submitDialog = async () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
onMounted(async () => {
|
|
|
|
await ensureOptionsLoaded()
|
|
|
|
await ensureOptionsLoaded()
|
|
|
|
await getList()
|
|
|
|
await getList()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|