feat(mes): 添加物料和盘点数量字段的展示与校验逻辑

pull/871/MERGE
YunaiV 2026-03-12 01:19:24 +08:00
parent 523866f044
commit 1ec78b1bbb
2 changed files with 42 additions and 36 deletions

View File

@ -1,6 +1,7 @@
<!-- MES 盘点任务行列表子组件 -->
<template>
<div>
<!-- 添加物料按钮 -->
<el-button
v-if="!isReadOnly"
v-hasPermi="['mes:wm-stock-taking-task:update']"
@ -143,20 +144,20 @@ const props = defineProps<{
formType?: string
}>()
const { t } = useI18n()
const message = useMessage()
const { t } = useI18n() //
const message = useMessage() //
const isReadOnly = computed(() => props.formType !== 'update')
const isReadOnly = computed(() => props.formType !== 'update') //
// ==================== ====================
const loading = ref(false)
const list = ref<StockTakingTaskLineVO[]>([])
const total = ref(0)
const loading = ref(false) //
const list = ref<StockTakingTaskLineVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
taskId: undefined as number | undefined
})
}) //
/** 查询行列表 */
const getList = async () => {
@ -183,10 +184,10 @@ const handleDelete = async (id: number) => {
}
// ==================== / ====================
const dialogVisible = ref(false)
const dialogTitle = ref('')
const formLoading = ref(false)
const dialogFormType = ref('')
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const dialogFormType = ref('') // create - update -
const formData = ref({
id: undefined,
taskId: undefined as number | undefined,
@ -197,7 +198,7 @@ const formData = ref({
quantity: undefined,
status: undefined,
remark: undefined
})
}) //
const formRules = reactive({
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'change' }],
@ -205,8 +206,8 @@ const formRules = reactive({
areaId: [{ required: true, message: '库位不能为空', trigger: 'change' }],
quantity: [{ required: true, message: '在库数量不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态不能为空', trigger: 'change' }]
})
const formRef = ref()
}) //
const formRef = ref() // Ref
/** 打开表单弹窗 */
const openForm = async (type: string, id?: number) => {

View File

@ -1,6 +1,7 @@
<!-- MES 盘点任务结果列表子组件 -->
<template>
<div>
<!-- 新增按钮 -->
<el-button
v-if="!isReadOnly"
v-hasPermi="['mes:wm-stock-taking-task:update']"
@ -28,6 +29,7 @@
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
@ -45,16 +47,16 @@
label-width="110px"
v-loading="formLoading"
>
<!-- 执行盘点模式选择盘点清单行 -->
<el-row v-if="isExecute && dialogFormType === 'create'">
<!-- 执行盘点模式选择盘点清单行可选选择后自动带出信息 -->
<el-row>
<el-col :span="24">
<el-form-item label="盘点清单" prop="lineId">
<!-- TODO @AI无论什么时候都展示只是说create 的时候可以操作其他时候是 readoly -->
<el-select
v-model="formData.lineId"
placeholder="请选择盘点清单(可选)"
class="!w-full"
clearable
:disabled="dialogFormType !== 'create'"
@change="handleLineChange"
@clear="handleLineClear"
>
@ -68,7 +70,7 @@
</el-form-item>
</el-col>
</el-row>
<!-- 物料批次编码差异数量 -->
<!-- 物料批次编码盘点数量 -->
<el-row>
<el-col :span="8">
<el-form-item label="物料" prop="itemId">
@ -169,28 +171,31 @@ const props = defineProps<{
formType?: string
}>()
const { t } = useI18n()
const message = useMessage()
const { t } = useI18n() //
const message = useMessage() //
const isReadOnly = computed(() => props.formType === 'detail')
const isExecute = computed(() => props.formType === 'execute')
const isReadOnly = computed(() => props.formType === 'detail') //
const isExecute = computed(() => props.formType === 'execute') //
//
const isFieldsDisabled = computed(() => {
return isExecute.value && dialogFormType.value === 'create' && !!formData.value.lineId
})
// ==================== ====================
const loading = ref(false)
const list = ref<StockTakingResultVO[]>([])
const total = ref(0)
const loading = ref(false) //
const list = ref<StockTakingResultVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
taskId: undefined as number | undefined
})
}) //
/** 查询列表 */
const getList = async () => {
if (!props.taskId) return
if (!props.taskId) {
return
}
loading.value = true
try {
queryParams.taskId = props.taskId
@ -213,11 +218,11 @@ const handleDelete = async (id: number) => {
}
// ==================== / ====================
const dialogVisible = ref(false)
const dialogTitle = ref('')
const formLoading = ref(false)
const dialogFormType = ref('')
const taskLineList = ref<StockTakingTaskLineVO[]>([])
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const dialogFormType = ref('') // create - update -
const taskLineList = ref<StockTakingTaskLineVO[]>([]) //
const formData = ref({
id: undefined as number | undefined,
taskId: undefined as number | undefined,
@ -231,15 +236,15 @@ const formData = ref({
areaId: undefined as number | undefined,
takingQuantity: undefined as number | undefined,
remark: undefined as string | undefined
})
}) //
const formRules = reactive({
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'change' }],
locationId: [{ required: true, message: '库区不能为空', trigger: 'change' }],
areaId: [{ required: true, message: '库位不能为空', trigger: 'change' }],
takingQuantity: [{ required: true, message: '盘点数量不能为空', trigger: 'blur' }]
})
const formRef = ref()
}) //
const formRef = ref() // Ref
/** 打开表单弹窗 */
const openForm = async (type: string, id?: number) => {
@ -248,7 +253,7 @@ const openForm = async (type: string, id?: number) => {
dialogFormType.value = type
resetForm()
//
if (isExecute.value && !id) {
if (isExecute.value) {
formLoading.value = true
try {
taskLineList.value = await StockTakingTaskLineApi.getStockTakingTaskLineSimpleList(