feat(mes): 更新点检结果字段类型为整数,重构相关枚举和状态描述
parent
d033bcaaf5
commit
b8ea0645d3
|
|
@ -4,7 +4,6 @@ import request from '@/config/axios'
|
|||
export interface DvCheckRecordVO {
|
||||
id: number // 编号
|
||||
planId: number // 点检计划编号
|
||||
planType?: number // 计划类型
|
||||
planName?: string // 计划名称
|
||||
machineryId: number // 设备编号
|
||||
machineryCode?: string // 设备编码
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ export interface DvCheckRecordLineVO {
|
|||
subjectName?: string // 项目名称
|
||||
subjectContent?: string // 检查内容
|
||||
subjectStandard?: string // 检查标准
|
||||
// TODO @AI:number
|
||||
checkStatus: string // 点检结果
|
||||
checkStatus: number // 点检结果
|
||||
checkResult?: string // 异常描述
|
||||
remark: string // 备注
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ const formData = ref({
|
|||
machineryId: undefined,
|
||||
checkTime: undefined,
|
||||
userId: undefined,
|
||||
status: undefined,
|
||||
remark: ''
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -139,7 +138,6 @@ const resetForm = () => {
|
|||
machineryId: undefined,
|
||||
checkTime: undefined,
|
||||
userId: undefined,
|
||||
status: undefined,
|
||||
remark: ''
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -38,26 +38,12 @@
|
|||
<Dialog :title="formTitle" v-model="formVisible" width="500px">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||
<el-form-item label="点检项目" prop="subjectId">
|
||||
<el-select
|
||||
v-model="formData.subjectId"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入项目名称搜索"
|
||||
:remote-method="getSubjectOptions"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in subjectOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<DvSubjectSelect v-model="formData.subjectId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点检结果" prop="checkStatus">
|
||||
<el-radio-group v-model="formData.checkStatus">
|
||||
<el-radio
|
||||
v-for="dict in getStrDictOptions(DICT_TYPE.MES_DV_CHECK_RESULT)"
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.MES_DV_CHECK_RESULT)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
>
|
||||
|
|
@ -65,8 +51,7 @@
|
|||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- TODO @AI:checkStatus 改成 int 枚举;然后 constants.ts 里; -->
|
||||
<el-form-item label="异常描述" prop="checkResult" v-if="formData.checkStatus === 'N'">
|
||||
<el-form-item label="异常描述" prop="checkResult" v-if="formData.checkStatus === MesDvCheckResultEnum.ABNORMAL">
|
||||
<el-input v-model="formData.checkResult" type="textarea" placeholder="请输入异常描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
|
|
@ -82,9 +67,10 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { DvCheckRecordLineApi } from '@/api/mes/dv/checkrecord/line'
|
||||
import { DvSubjectApi } from '@/api/mes/dv/subject'
|
||||
import DvSubjectSelect from '@/views/mes/dv/subject/components/DvSubjectSelect.vue'
|
||||
import { MesDvCheckResultEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'CheckRecordLineList' })
|
||||
|
||||
|
|
@ -116,7 +102,6 @@ const formRules = reactive({
|
|||
subjectId: [{ required: true, message: '点检项目不能为空', trigger: 'blur' }],
|
||||
checkStatus: [{ required: true, message: '点检结果不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const subjectOptions = ref<any[]>([]) // 项目选项列表
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
|
|
@ -139,16 +124,12 @@ const openForm = async (type: string, row?: any) => {
|
|||
formData.value = {
|
||||
recordId: props.recordId,
|
||||
subjectId: undefined,
|
||||
checkStatus: 'Y',
|
||||
checkStatus: MesDvCheckResultEnum.NORMAL,
|
||||
checkResult: '',
|
||||
remark: ''
|
||||
}
|
||||
} else {
|
||||
formData.value = { ...row }
|
||||
if (row.subjectId) {
|
||||
const subject = await DvSubjectApi.getSubject(row.subjectId)
|
||||
if (subject) subjectOptions.value = [subject]
|
||||
}
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
|
@ -183,14 +164,6 @@ const handleDelete = async (id: number) => {
|
|||
} catch {}
|
||||
}
|
||||
|
||||
/** 获取项目选项 */
|
||||
const getSubjectOptions = async (query: string) => {
|
||||
try {
|
||||
const data = await DvSubjectApi.getSubjectPage({ name: query, pageNo: 1, pageSize: 20 })
|
||||
subjectOptions.value = data.list
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 监听记录编号变化 */
|
||||
watch(
|
||||
() => props.recordId,
|
||||
|
|
|
|||
|
|
@ -85,31 +85,29 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<!-- TODO @AI:只有草稿,可以编辑; -->
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-if="scope.row.status === MesDvCheckRecordStatusEnum.DRAFT"
|
||||
v-hasPermi="['mes:dv-check-record:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<!-- TODO @AI:10 这些,都换成枚举 -->
|
||||
<el-button
|
||||
link
|
||||
type="success"
|
||||
@click="handleSubmit(scope.row)"
|
||||
v-if="scope.row.status === 10"
|
||||
v-if="scope.row.status === MesDvCheckRecordStatusEnum.DRAFT"
|
||||
v-hasPermi="['mes:dv-check-record:update']"
|
||||
>
|
||||
提交
|
||||
</el-button>
|
||||
<!-- TODO @AI:只有草稿,可以删除; -->
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-if="scope.row.status === 10"
|
||||
v-if="scope.row.status === MesDvCheckRecordStatusEnum.DRAFT"
|
||||
v-hasPermi="['mes:dv-check-record:delete']"
|
||||
>
|
||||
删除
|
||||
|
|
@ -139,6 +137,7 @@ import CheckRecordForm from './CheckRecordForm.vue'
|
|||
import DvMachinerySelect from '@/views/mes/dv/machinery/components/DvMachinerySelect.vue'
|
||||
import DvCheckPlanSelect from '@/views/mes/dv/checkplan/components/DvCheckPlanSelect.vue'
|
||||
import UserSelect from '@/views/system/user/components/UserSelect.vue'
|
||||
import { MesDvCheckRecordStatusEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'MesDvCheckRecord' })
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,18 @@ export const MesDvMaintenStatusEnum = {
|
|||
ABNORMAL: 2 // 异常
|
||||
}
|
||||
|
||||
/** MES 设备点检记录状态枚举 */
|
||||
export const MesDvCheckRecordStatusEnum = {
|
||||
DRAFT: 10, // 草稿
|
||||
FINISHED: 20 // 已完成
|
||||
}
|
||||
|
||||
/** MES 设备点检结果枚举(对应字典 mes_dv_check_result) */
|
||||
export const MesDvCheckResultEnum = {
|
||||
NORMAL: 1, // 正常
|
||||
ABNORMAL: 2 // 异常
|
||||
}
|
||||
|
||||
/** 获取物料/产品标识的标签 */
|
||||
export const getItemOrProductLabel = (value: string): string => {
|
||||
for (const item of Object.values(MesItemOrProductEnum)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue