feat(mes): 优化设备编码生成与表单交互逻辑

增强设备编码输入的交互体验,禁用生成按钮在更新状态下,确保用户操作的准确性。同时,添加了 TODO 注释以便后续功能实现的对接。
pull/871/MERGE
YunaiV 2026-04-02 23:24:46 +08:00
parent 3db2347f67
commit 2ddfb9b722
2 changed files with 16 additions and 11 deletions

View File

@ -11,9 +11,15 @@
<el-row>
<el-col :span="8">
<el-form-item label="设备编码" prop="code">
<el-input v-model="formData.code" placeholder="请输入设备编码">
<el-input
v-model="formData.code"
placeholder="请输入设备编码"
:disabled="formType === 'update'"
>
<template #append>
<el-button @click="generateCode"> </el-button>
<el-button @click="generateCode" :disabled="formType === 'update'">
生成
</el-button>
</template>
</el-input>
</el-form-item>
@ -31,6 +37,7 @@
</el-row>
<el-row>
<el-col :span="8">
<!-- TODO @AI抽成一个独立的 components type 模块里然后只允许选择子节点你看看有分类实现了这个功能的 -->
<el-form-item label="设备类型" prop="machineryTypeId">
<el-tree-select
v-model="formData.machineryTypeId"
@ -67,6 +74,7 @@
<el-input v-model="formData.spec" placeholder="请输入规格型号" />
</el-form-item>
</el-col>
<!-- TODO @AI最近 xx 两个字段仅详情时展示然后不需要 placeholder -->
<el-col :span="8">
<el-form-item label="最近点检时间" prop="lastCheckTime">
<el-date-picker
@ -104,15 +112,15 @@
<!-- 编辑时显示子资源 Tab -->
<el-tabs v-if="formType === 'update'" v-model="activeTab" class="mt-10px">
<el-tab-pane label="点检记录" name="check">
<!-- TODO 等点检模块实现后对接 -->
<!-- TODO TODO @AI等点检模块实现后对接 -->
<el-empty description="暂无点检记录" />
</el-tab-pane>
<el-tab-pane label="保养记录" name="mainten">
<!-- TODO 等保养模块实现后对接 -->
<!-- TODO TODO @AI 等保养模块实现后对接 -->
<el-empty description="暂无保养记录" />
</el-tab-pane>
<el-tab-pane label="维修工单" name="repair">
<!-- TODO 等维修模块实现后对接 -->
<!-- TODO TODO @AI 等维修模块实现后对接 -->
<el-empty description="暂无维修工单" />
</el-tab-pane>
</el-tabs>
@ -129,10 +137,7 @@ import { DvMachineryTypeApi } from '@/api/mes/dv/machinery/type'
import MdWorkshopSelect from '@/views/mes/md/workstation/components/MdWorkshopSelect.vue'
import { defaultProps, handleTree } from '@/utils/tree'
import {
MesDvMachineryStatusEnum,
MesAutoCodeRuleCode
} from '@/views/mes/utils/constants'
import { MesDvMachineryStatusEnum, MesAutoCodeRuleCode } from '@/views/mes/utils/constants'
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
defineOptions({ name: 'MachineryForm' })
@ -168,7 +173,6 @@ const formRules = reactive({
const formRef = ref() // Ref
const machineryTypeTree = ref<any[]>([]) //
/** 生成设备编码 */
const generateCode = async () => {
formData.value.code = await AutoCodeRecordApi.generateAutoCode(
@ -190,7 +194,6 @@ const open = async (type: string, id?: number) => {
formLoading.value = true
try {
formData.value = await DvMachineryApi.getMachinery(id)
} finally {
formLoading.value = false
}

View File

@ -80,6 +80,7 @@
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<!-- TODO @AI导入的 mysql 权限标识没插入你处理下 -->
<el-button
type="warning"
plain
@ -104,6 +105,7 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<!-- TODO @AI点击设备编码查看详情对标其他界面的交互 -->
<el-table-column label="设备编码" align="center" prop="code" width="120" />
<el-table-column label="设备名称" align="center" prop="name" min-width="150" />
<el-table-column label="品牌" align="center" prop="brand" width="100" />