diff --git a/src/views/mes/cal/plan/CalPlanForm.vue b/src/views/mes/cal/plan/CalPlanForm.vue
index 2d8c275a8..ea812dafb 100644
--- a/src/views/mes/cal/plan/CalPlanForm.vue
+++ b/src/views/mes/cal/plan/CalPlanForm.vue
@@ -6,7 +6,7 @@
:rules="formRules"
label-width="100px"
v-loading="formLoading"
- :disabled="formType === 'detail'"
+ :disabled="isDetail"
>
@@ -98,6 +98,7 @@
/>
+
@@ -113,16 +114,16 @@
-
+
-
+
-
+
-
+
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { CalPlanApi, CalPlanVO } from '@/api/mes/cal/plan'
-import { generateRandomStr } from '@/utils'
import {
MesCalPlanStatusEnum,
MesCalShiftTypeEnum,
- MesCalShiftMethodEnum
+ MesCalShiftMethodEnum,
+ MesAutoCodeRuleCode
} from '@/views/mes/utils/constants'
+import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
import CalShiftList from './CalShiftList.vue'
import CalPlanTeamList from './CalPlanTeamList.vue'
-// TODO @AI:isDetail,这种 compute 计算;
defineOptions({ name: 'CalPlanForm' })
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // 弹窗的是否展示
-const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中
-const formType = ref('') // 表单的类型:create - 新增;update - 修改
+const formType = ref('') // 表单的类型:create - 新增;update - 修改;detail - 查看
+const isDetail = computed(() => formType.value === 'detail') // 是否为详情模式(只读)
+const dialogTitle = computed(() => {
+ const titles = {
+ create: '新增排班计划',
+ update: '修改排班计划',
+ detail: '查看排班计划'
+ }
+ return titles[formType.value] || formType.value
+}) // 弹窗的标题
const activeTab = ref('shift') // 当前激活的资源 Tab
const formData = ref({
id: undefined,
@@ -189,16 +198,13 @@ const formRules = reactive({
const formRef = ref()
/** 生成计划编码 */
-const generateCode = () => {
- // TODO @AI:接入编码规则;
- formData.value.code = 'PLAN' + generateRandomStr(8)
+const generateCode = async () => {
+ formData.value.code = await AutoCodeRecordApi.generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE)
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
- // TODO @AI:dialogtitle,通过 compute 实现;
- dialogTitle.value = type === 'detail' ? '查看' : t('action.' + type)
formType.value = type
resetForm()
// 修改/查看时,设置数据
diff --git a/src/views/mes/cal/plan/CalPlanTeamList.vue b/src/views/mes/cal/plan/CalPlanTeamList.vue
index af53663a8..1f2233f2c 100644
--- a/src/views/mes/cal/plan/CalPlanTeamList.vue
+++ b/src/views/mes/cal/plan/CalPlanTeamList.vue
@@ -25,7 +25,7 @@
-
+