|
|
|
|
@ -9,18 +9,26 @@
|
|
|
|
|
>
|
|
|
|
|
<el-table :data="formData" class="-mt-10px">
|
|
|
|
|
<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 }">
|
|
|
|
|
<el-form-item :prop="`${$index}.productId`" :rules="formRules.productId" class="mb-0px!">
|
|
|
|
|
<el-input v-model="row.productId" placeholder="请输入产品ID" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="单位ID" min-width="150">
|
|
|
|
|
<el-table-column label="单位" min-width="150">
|
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
|
<el-form-item :prop="`${$index}.unitId`" :rules="formRules.unitId" class="mb-0px!">
|
|
|
|
|
<el-input v-model="row.unitId" placeholder="请输入单位ID" />
|
|
|
|
|
<el-select v-model="row.unitId" clearable placeholder="请选择单位" class="w-1/1">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="unit in unitList"
|
|
|
|
|
:key="unit.id"
|
|
|
|
|
:label="unit.name"
|
|
|
|
|
:value="unit.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="用量" min-width="150">
|
|
|
|
|
@ -44,21 +52,6 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="是否启用" min-width="150">
|
|
|
|
|
<template #default="{ row, $index }">
|
|
|
|
|
<el-form-item :prop="`${$index}.isEnable`" :rules="formRules.isEnable" class="mb-0px!">
|
|
|
|
|
<el-radio-group v-model="row.isEnable">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.value"
|
|
|
|
|
>
|
|
|
|
|
{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" fixed="right" label="操作" width="60">
|
|
|
|
|
<template #default="{ $index }">
|
|
|
|
|
<el-button @click="handleDelete($index)" link>—</el-button>
|
|
|
|
|
@ -71,8 +64,10 @@
|
|
|
|
|
</el-row>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
|
|
|
|
|
import { BomApi } from '@/api/mes/bom'
|
|
|
|
|
import { ProductUnitApi, ProductUnitVO } from '@/api/erp/product/unit'
|
|
|
|
|
const unitList = ref<ProductUnitVO[]>([]) // 产品单位列表
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
bomId: undefined // BOM ID(主表的关联字段)
|
|
|
|
|
@ -81,8 +76,7 @@ const formLoading = ref(false) // 表单的加载中
|
|
|
|
|
const formData = ref([])
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
productId: [{ required: true, message: '产品ID不能为空', trigger: 'blur' }],
|
|
|
|
|
unitId: [{ required: true, message: '单位ID不能为空', trigger: 'blur' }],
|
|
|
|
|
bomId: [{ required: true, message: 'BOM ID不能为空', trigger: 'blur' }],
|
|
|
|
|
bomId: [{ required: true, message: 'BOM 不能为空', trigger: 'blur' }],
|
|
|
|
|
usageNumber: [{ required: true, message: '用量不能为空', trigger: 'blur' }]
|
|
|
|
|
})
|
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
@ -103,8 +97,11 @@ watch(
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
// 产品单位
|
|
|
|
|
unitList.value = await ProductUnitApi.getProductUnitSimpleList()
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
|