✨ feat(mes): 新增维修工单确认完成请求及相关逻辑
新增 MesDvRepairConfirmReqVO 类以处理维修工单确认完成请求,更新相关服务和控制器逻辑以支持新的请求格式。确保维修工单名称和完成日期为必填项,增强了数据验证和状态管理。pull/871/MERGE
parent
86e8d62213
commit
da1dfa410b
|
|
@ -63,8 +63,8 @@ export const DvRepairApi = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 确认维修完成(维修中→待验收)
|
// 确认维修完成(维修中→待验收)
|
||||||
confirmRepair: async (id: number) => {
|
confirmRepair: async (data: any) => {
|
||||||
return await request.put({ url: `/mes/dv/repair/confirm?id=` + id })
|
return await request.put({ url: `/mes/dv/repair/confirm`, data })
|
||||||
},
|
},
|
||||||
|
|
||||||
// 完成验收(待验收→已确认)
|
// 完成验收(待验收→已确认)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
v-loading="formLoading"
|
v-loading="formLoading"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="formRules"
|
:rules="formRules"
|
||||||
label-width="100px"
|
label-width="110px"
|
||||||
:disabled="isDetail"
|
:disabled="isDetail"
|
||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
|
|
@ -50,13 +50,24 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" v-if="showFinishFields">
|
<el-col :span="8" v-if="showFinishFields">
|
||||||
<el-form-item label="维修完成日期" prop="finishDate">
|
<!-- TODO @AI:默认把 required 加进去;放到 rules 里; -->
|
||||||
|
<!-- TODO @AI:维修完成时,需要允许修改; -->
|
||||||
|
<el-form-item
|
||||||
|
label="维修完成日期"
|
||||||
|
prop="finishDate"
|
||||||
|
:rules="
|
||||||
|
formType === 'confirm'
|
||||||
|
? [{ required: true, message: '维修完成日期不能为空', trigger: 'change' }]
|
||||||
|
: []
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<!-- TODO @AI:isConfirm 这样; -->
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formData.finishDate"
|
v-model="formData.finishDate"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
value-format="x"
|
value-format="x"
|
||||||
placeholder="选择完成日期"
|
placeholder="选择完成日期"
|
||||||
disabled
|
:disabled="formType !== 'confirm'"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -87,20 +98,12 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" v-if="showFinishFields">
|
<el-col :span="8" v-if="showFinishFields">
|
||||||
<el-form-item label="维修人" prop="acceptedUserId">
|
<el-form-item label="维修人" prop="acceptedUserId">
|
||||||
<UserSelect
|
<UserSelect v-model="formData.acceptedUserId" placeholder="请选择维修人" disabled />
|
||||||
v-model="formData.acceptedUserId"
|
|
||||||
placeholder="请选择维修人"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" v-if="showConfirmFields">
|
<el-col :span="8" v-if="showConfirmFields">
|
||||||
<el-form-item label="验收人" prop="confirmUserId">
|
<el-form-item label="验收人" prop="confirmUserId">
|
||||||
<UserSelect
|
<UserSelect v-model="formData.confirmUserId" placeholder="请选择验收人" disabled />
|
||||||
v-model="formData.confirmUserId"
|
|
||||||
placeholder="请选择验收人"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -148,7 +151,7 @@
|
||||||
type="success"
|
type="success"
|
||||||
:disabled="formLoading"
|
:disabled="formLoading"
|
||||||
>
|
>
|
||||||
通 过
|
验 收 通 过
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="formType === 'finish'"
|
v-if="formType === 'finish'"
|
||||||
|
|
@ -156,7 +159,7 @@
|
||||||
type="warning"
|
type="warning"
|
||||||
:disabled="formLoading"
|
:disabled="formLoading"
|
||||||
>
|
>
|
||||||
不通过
|
不 通 过
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="dialogVisible = false">关 闭</el-button>
|
<el-button @click="dialogVisible = false">关 闭</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -186,23 +189,20 @@ const formType = ref<string>('create') // 表单类型:create / update / confi
|
||||||
const isEditable = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
const isEditable = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
||||||
const isDetail = computed(() => !isEditable.value) // 是否为详情模式(confirm/finish/detail 均只读)
|
const isDetail = computed(() => !isEditable.value) // 是否为详情模式(confirm/finish/detail 均只读)
|
||||||
const isHeaderReadonly = computed(() => !isEditable.value) // 是否只读
|
const isHeaderReadonly = computed(() => !isEditable.value) // 是否只读
|
||||||
|
const showFinishFields = computed(() => {
|
||||||
// DONE @AI;注释在字段后面,对齐上面的标准
|
|
||||||
const showFinishFields = computed(() => { // 维修中(1)及之后显示
|
|
||||||
const status = formData.value.status
|
const status = formData.value.status
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return status >= MesDvRepairStatusEnum.CONFIRMED
|
return status >= MesDvRepairStatusEnum.CONFIRMED
|
||||||
})
|
}) // 维修中(1)及之后显示
|
||||||
const showConfirmFields = computed(() => { // 待验收(2)及之后显示
|
const showConfirmFields = computed(() => {
|
||||||
const status = formData.value.status
|
const status = formData.value.status
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return status >= MesDvRepairStatusEnum.APPROVING
|
return status >= MesDvRepairStatusEnum.APPROVING
|
||||||
})
|
}) // 待验收(2)及之后显示
|
||||||
|
|
||||||
const dialogTitle = computed(() => {
|
const dialogTitle = computed(() => {
|
||||||
const titles: Record<string, string> = {
|
const titles: Record<string, string> = {
|
||||||
create: '新增维修工单',
|
create: '新增维修工单',
|
||||||
|
|
@ -229,6 +229,7 @@ const formData = ref({
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
code: [{ required: true, message: '维修单编码不能为空', trigger: 'blur' }],
|
code: [{ required: true, message: '维修单编码不能为空', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '维修单名称不能为空', trigger: 'blur' }],
|
||||||
machineryId: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
|
machineryId: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
|
||||||
requireDate: [{ required: true, message: '报修日期不能为空', trigger: 'blur' }]
|
requireDate: [{ required: true, message: '报修日期不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
@ -236,9 +237,7 @@ const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
/** 生成维修单编码 */
|
/** 生成维修单编码 */
|
||||||
const generateCode = async () => {
|
const generateCode = async () => {
|
||||||
formData.value.code = await AutoCodeRecordApi.generateAutoCode(
|
formData.value.code = await AutoCodeRecordApi.generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE)
|
||||||
MesAutoCodeRuleCode.DV_REPAIR_CODE
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
|
|
@ -257,7 +256,6 @@ const open = async (type: string, id?: number) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DONE @AI:对齐,是不是应该直接 close 的?
|
|
||||||
/** 提交表单(create/update 模式) */
|
/** 提交表单(create/update 模式) */
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
|
|
@ -281,6 +279,7 @@ const submitForm = async () => {
|
||||||
/** 提交维修工单(草稿→维修中) */
|
/** 提交维修工单(草稿→维修中) */
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
try {
|
try {
|
||||||
|
// TODO @AI: /Users/yunai/Java/yudao-all-in-one/yudao-ui-admin-vue3/src/views/mes/dv/maintenrecord/MaintenRecordForm.vue 参考类似的;
|
||||||
await message.confirm('确认提交该维修工单?提交后将进入维修中状态')
|
await message.confirm('确认提交该维修工单?提交后将进入维修中状态')
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
await DvRepairApi.submitRepair(formData.value.id!)
|
await DvRepairApi.submitRepair(formData.value.id!)
|
||||||
|
|
@ -295,10 +294,14 @@ const handleSubmit = async () => {
|
||||||
|
|
||||||
/** 确认维修完成(维修中→待验收) */
|
/** 确认维修完成(维修中→待验收) */
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
|
await formRef.value.validate()
|
||||||
try {
|
try {
|
||||||
await message.confirm('确认完成维修?完成后将进入待验收状态')
|
await message.confirm('确认完成维修?完成后将进入待验收状态')
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
await DvRepairApi.confirmRepair(formData.value.id!)
|
await DvRepairApi.confirmRepair({
|
||||||
|
id: formData.value.id!,
|
||||||
|
finishDate: formData.value.finishDate
|
||||||
|
})
|
||||||
message.success('操作成功')
|
message.success('操作成功')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
emit('success')
|
emit('success')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue