|
|
|
@ -9,49 +9,57 @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-table :data="formData" class="-mt-10px">
|
|
|
|
<el-table :data="formData" class="-mt-10px">
|
|
|
|
<el-table-column label="序号" type="index" width="100" />
|
|
|
|
<el-table-column label="序号" type="index" width="100" />
|
|
|
|
<el-table-column label="原料id" min-width="150">
|
|
|
|
<el-table-column label="原料" min-width="150">
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
<el-form-item :prop="`${$index}.itemId`" :rules="formRules.itemId" class="mb-0px!">
|
|
|
|
<el-form-item :prop="`${$index}.itemId`" :rules="formRules.itemId" class="mb-0px!">
|
|
|
|
<el-input v-model="row.itemId" placeholder="请输入原料id" />
|
|
|
|
<el-select
|
|
|
|
</el-form-item>
|
|
|
|
v-model="row.itemId"
|
|
|
|
</template>
|
|
|
|
clearable
|
|
|
|
</el-table-column>
|
|
|
|
filterable
|
|
|
|
<el-table-column label="重量" min-width="150">
|
|
|
|
placeholder="请选择原料"
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
>
|
|
|
|
<el-form-item :prop="`${$index}.weight`" :rules="formRules.weight" class="mb-0px!">
|
|
|
|
<el-option
|
|
|
|
<el-input v-model="row.weight" placeholder="请输入重量" />
|
|
|
|
v-for="item in productList"
|
|
|
|
</el-form-item>
|
|
|
|
:key="item.id"
|
|
|
|
</template>
|
|
|
|
:label="item.name"
|
|
|
|
|
|
|
|
:value="item.id"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="单位" min-width="150">
|
|
|
|
<el-table-column label="单位" min-width="80">
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
<el-form-item :prop="`${$index}.unitId`" :rules="formRules.unitId" class="mb-0px!">
|
|
|
|
<el-form-item :prop="`${$index}.unitId`" :rules="formRules.unitId" class="mb-0px!">
|
|
|
|
<el-input v-model="row.unitId" placeholder="请输入单位" />
|
|
|
|
<el-select
|
|
|
|
</el-form-item>
|
|
|
|
v-model="row.unitId"
|
|
|
|
</template>
|
|
|
|
clearable
|
|
|
|
</el-table-column>
|
|
|
|
filterable
|
|
|
|
<el-table-column label="记录人" min-width="150">
|
|
|
|
placeholder="请选择原料"
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
>
|
|
|
|
<el-form-item :prop="`${$index}.userId`" :rules="formRules.userId" class="mb-0px!">
|
|
|
|
<el-option
|
|
|
|
<el-input v-model="row.userId" placeholder="请输入记录人" />
|
|
|
|
v-for="item in unitList"
|
|
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
|
|
:label="item.name"
|
|
|
|
|
|
|
|
:value="item.id"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="投料时间" min-width="150">
|
|
|
|
<el-table-column label="重量" min-width="150">
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
<el-form-item :prop="`${$index}.feedingTime`" :rules="formRules.feedingTime" class="mb-0px!">
|
|
|
|
<el-form-item :prop="`${$index}.weight`" :rules="formRules.weight" class="mb-0px!">
|
|
|
|
<el-date-picker
|
|
|
|
<el-input-number v-model="row.weight" :min="0" :precision="2" class="!w-1/1" placeholder="请输入重量"
|
|
|
|
v-model="row.feedingTime"
|
|
|
|
|
|
|
|
type="date"
|
|
|
|
|
|
|
|
value-format="x"
|
|
|
|
|
|
|
|
placeholder="选择投料时间"
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column align="center" fixed="right" label="操作" width="60">
|
|
|
|
<el-table-column align="center" fixed="right" label="操作" width="60">
|
|
|
|
<template #default="{ $index }">
|
|
|
|
<template #default="{ $index }">
|
|
|
|
<el-button @click="handleDelete($index)" link>—</el-button>
|
|
|
|
<el-button @click="handleDelete($index)" link type="danger">
|
|
|
|
|
|
|
|
<Icon icon="ep:delete" />
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</el-table>
|
|
|
|
@ -62,6 +70,11 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { FeedingRecordApi } from '@/api/mes/feedingrecord'
|
|
|
|
import { FeedingRecordApi } from '@/api/mes/feedingrecord'
|
|
|
|
|
|
|
|
import { ProductUnitApi, ProductUnitVO } from '@/api/erp/product/unit'
|
|
|
|
|
|
|
|
import {ProductApi, ProductVO} from "@/api/erp/product/product";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const unitList = ref<ProductUnitVO[]>([]) // 单位列表
|
|
|
|
|
|
|
|
const productList = ref<ProductVO[]>([]) // 原料列表
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
const props = defineProps<{
|
|
|
|
recordId: undefined // 记录id(主表的关联字段)
|
|
|
|
recordId: undefined // 记录id(主表的关联字段)
|
|
|
|
@ -69,9 +82,24 @@ const props = defineProps<{
|
|
|
|
const formLoading = ref(false) // 表单的加载中
|
|
|
|
const formLoading = ref(false) // 表单的加载中
|
|
|
|
const formData = ref([])
|
|
|
|
const formData = ref([])
|
|
|
|
const formRules = reactive({
|
|
|
|
const formRules = reactive({
|
|
|
|
|
|
|
|
itemId: [{ required: true, message: '原料不能为空', trigger: 'blur' }],
|
|
|
|
|
|
|
|
unitId: [{ required: true, message: '单位不能为空', trigger: 'blur' }],
|
|
|
|
|
|
|
|
weight: [{ required: true, message: '重量不能为空', trigger: 'blur' }]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 */
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
|
|
// 产品单位
|
|
|
|
|
|
|
|
unitList.value = await ProductUnitApi.getProductUnitSimpleList()
|
|
|
|
|
|
|
|
productList.value = await ProductApi.getItemSimpleList()
|
|
|
|
|
|
|
|
// 默认添加一个
|
|
|
|
|
|
|
|
if (formData.value.length === 0) {
|
|
|
|
|
|
|
|
handleAdd()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
|
|
|
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
|
|
|
watch(
|
|
|
|
watch(
|
|
|
|
() => props.recordId,
|
|
|
|
() => props.recordId,
|
|
|
|
@ -99,7 +127,7 @@ const handleAdd = () => {
|
|
|
|
recordId: undefined,
|
|
|
|
recordId: undefined,
|
|
|
|
itemId: undefined,
|
|
|
|
itemId: undefined,
|
|
|
|
weight: undefined,
|
|
|
|
weight: undefined,
|
|
|
|
unitId: undefined,
|
|
|
|
unitId: 3,
|
|
|
|
userId: undefined,
|
|
|
|
userId: undefined,
|
|
|
|
feedingTime: undefined,
|
|
|
|
feedingTime: undefined,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|