diff --git a/src/views/mes/tm/tool/ToolForm.vue b/src/views/mes/tm/tool/ToolForm.vue
index 298934df2..d653fc5ce 100644
--- a/src/views/mes/tm/tool/ToolForm.vue
+++ b/src/views/mes/tm/tool/ToolForm.vue
@@ -64,7 +64,7 @@
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { TmToolApi, TmToolVO } from '@/api/mes/tm/tool'
-import { TmToolTypeApi, TmToolTypeVO } from '@/api/mes/tm/tooltype'
+import { TmToolTypeApi, TmToolTypeVO } from '@/api/mes/tm/tool/type'
+import { MesToolStatusEnum, MesMaintenTypeEnum } from '@/views/mes/utils/constants'
defineOptions({ name: 'ToolForm' })
@@ -121,19 +122,19 @@ const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formType = ref('') // 表单的类型:create - 新增;update - 修改
const formData = ref({
- id: undefined as unknown as number,
- code: undefined as unknown as string,
- name: undefined as unknown as string,
- brand: undefined as unknown as string,
- spec: undefined as unknown as string,
- toolTypeId: undefined as unknown as number,
- quantity: 1 as number,
- quantityAvailable: 1 as number,
- maintenType: undefined as unknown as number,
- nextMaintenPeriod: undefined as unknown as number,
- nextMaintenDate: undefined as unknown as string,
- status: 1 as number,
- remark: undefined as unknown as string
+ id: undefined,
+ code: undefined,
+ name: undefined,
+ brand: undefined,
+ spec: undefined,
+ toolTypeId: undefined,
+ quantity: 1,
+ quantityAvailable: 1,
+ maintenType: undefined,
+ nextMaintenPeriod: undefined,
+ nextMaintenDate: undefined,
+ status: MesToolStatusEnum.STORE,
+ remark: undefined
})
const formRules = reactive({
name: [{ required: true, message: '工具名称不能为空', trigger: 'blur' }],
@@ -184,20 +185,10 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
const submitForm = async () => {
// 校验表单
await formRef.value.validate()
- // 根据保养类型清空互斥字段
- // TODO @AI:可以忽略,后端处理了。
- if (formData.value.maintenType === 1) {
- formData.value.nextMaintenPeriod = undefined as unknown as number
- } else if (formData.value.maintenType === 2) {
- formData.value.nextMaintenDate = undefined as unknown as string
- } else {
- formData.value.nextMaintenPeriod = undefined as unknown as number
- formData.value.nextMaintenDate = undefined as unknown as string
- }
// 提交请求
formLoading.value = true
try {
- const data = formData.value as unknown as TmToolVO
+ const data = formData.value as unknown as TmToolVO // 提交到后端
if (formType.value === 'create') {
await TmToolApi.createTool(data)
message.success(t('common.createSuccess'))
@@ -215,7 +206,6 @@ const submitForm = async () => {
/** 重置表单 */
const resetForm = () => {
- // TODO @AI:linter 报错;
formData.value = {
id: undefined,
code: undefined,
@@ -228,7 +218,7 @@ const resetForm = () => {
maintenType: undefined,
nextMaintenPeriod: undefined,
nextMaintenDate: undefined,
- status: 1, // TODO @AI:枚举;
+ status: MesToolStatusEnum.STORE,
remark: undefined
}
selectedToolType.value = undefined
diff --git a/src/views/mes/tm/tool/index.vue b/src/views/mes/tm/tool/index.vue
index 37d96ebea..06d80eb44 100644
--- a/src/views/mes/tm/tool/index.vue
+++ b/src/views/mes/tm/tool/index.vue
@@ -102,7 +102,7 @@
-
+
@@ -111,10 +111,10 @@
-
+
{{ scope.row.nextMaintenDate ? formatDate(scope.row.nextMaintenDate) : '-' }}
-
+
{{ scope.row.nextMaintenPeriod != null ? scope.row.nextMaintenPeriod + ' 次' : '-' }}
-
@@ -170,9 +170,10 @@
import { dateFormatter, formatDate } from '@/utils/formatTime'
import download from '@/utils/download'
import { TmToolApi, TmToolVO } from '@/api/mes/tm/tool'
-import { TmToolTypeApi, TmToolTypeVO } from '@/api/mes/tm/tooltype'
+import { TmToolTypeApi, TmToolTypeVO } from '@/api/mes/tm/tool/type'
import ToolForm from './ToolForm.vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
+import { MesMaintenTypeEnum } from '@/views/mes/utils/constants'
defineOptions({ name: 'MesTmTool' })
diff --git a/src/views/mes/tm/tool/type/ToolTypeForm.vue b/src/views/mes/tm/tool/type/ToolTypeForm.vue
index 5b0afaa81..5d4437862 100644
--- a/src/views/mes/tm/tool/type/ToolTypeForm.vue
+++ b/src/views/mes/tm/tool/type/ToolTypeForm.vue
@@ -15,11 +15,10 @@
-
{{ dict.label }}
@@ -44,7 +43,7 @@