feat(mes): 新增工序详情功能及编码生成逻辑

为工序管理模块新增工序详情查看功能,用户可以通过点击工序编码查看详细信息。同时,更新工序编码生成逻辑,支持自动生成编码,提升用户体验。
pull/871/MERGE
YunaiV 2026-04-04 11:34:45 +08:00
parent d18a58f44f
commit aa5cb50d1d
3 changed files with 27 additions and 9 deletions

View File

@ -7,6 +7,7 @@
:rules="formRules"
label-width="100px"
v-loading="formLoading"
:disabled="isDetail"
>
<el-row :gutter="20">
<el-col :span="8">
@ -55,16 +56,19 @@
</template>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submitForm" :loading="formLoading"> </el-button>
<el-button v-if="!isDetail" type="primary" @click="submitForm" :loading="formLoading">
</el-button>
<el-button @click="dialogVisible = false">{{ isDetail ? '关 闭' : '取 消' }}</el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { generateRandomStr } from '@/utils'
import { ProProcessApi, ProProcessVO } from '@/api/mes/pro/process'
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
import { MesAutoCodeRuleCode } from '@/views/mes/utils/constants'
import ProProcessContentList from './ProProcessContentList.vue'
defineOptions({ name: 'ProProcessForm' })
@ -76,7 +80,8 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formType = ref('') // create - update - detail -
const isDetail = computed(() => formType.value === 'detail') //
const formData = ref<ProProcessVO>({
id: undefined,
code: '',
@ -93,14 +98,21 @@ const formRules = reactive({
const formRef = ref() // Ref
/** 生成工序编码 */
const generateCode = () => {
formData.value.code = 'PROC' + generateRandomStr(8)
const generateCode = async () => {
formData.value.code = await AutoCodeRecordApi.generateAutoCode(
MesAutoCodeRuleCode.PRO_PROCESS_CODE
)
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = type === 'create' ? '新增生产工序' : '编辑生产工序'
const titles: Record<string, string> = {
create: '新增生产工序',
update: '编辑生产工序',
detail: '生产工序详情'
}
dialogTitle.value = titles[type] || type
formType.value = type
resetForm()
//

View File

@ -70,8 +70,13 @@
:show-overflow-tooltip="true"
row-key="id"
>
<!-- TODO @AI增加详情操作点击下工序编码 -->
<el-table-column label="工序编码" align="center" prop="code" width="150" />
<el-table-column label="工序编码" align="center" prop="code" width="150">
<template #default="scope">
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
{{ scope.row.code }}
</el-button>
</template>
</el-table-column>
<el-table-column label="工序名称" align="center" prop="name" width="200" />
<el-table-column label="状态" align="center" prop="status" width="100">
<template #default="scope">

View File

@ -454,6 +454,7 @@ export const MesAutoCodeRuleCode = {
DV_CHECK_PLAN_CODE: 'DV_CHECK_PLAN_CODE', // 点检保养方案编码
DV_SUBJECT_CODE: 'DV_SUBJECT_CODE', // 点检保养项目编码
DV_REPAIR_CODE: 'DV_REPAIR_CODE', // 维修单编码
PRO_PROCESS_CODE: 'PRO_PROCESS_CODE', // 工序编码
PRO_WORK_ORDER_CODE: 'PRO_WORK_ORDER_CODE' // 生产工单编码
} as const