吉安感知网项目-前端
shuishen
2026-01-29 0ef47a49fa6dce546be2d0f23b4949734e6a0cf9
applications/drone-command/src/views/basicManage/maintainRecord/FormDiaLog.vue
@@ -4,8 +4,8 @@
 * @LastEditors  : yuan
 * @LastEditTime : 2026-01-20 16:38:55
 * @FilePath     : \applications\drone-command\src\views\basicManage\maintainRecord\FormDiaLog.vue
 * @Description  :
 * Copyright 2026 OBKoro1, All Rights Reserved.
 * @Description  :
 * Copyright 2026 OBKoro1, All Rights Reserved.
 * 2026-01-20 14:04:02
-->
<template>
@@ -102,11 +102,36 @@
               </el-form-item>
            </el-col>
            <el-col :span="12">
               <el-form-item label="维护计划时间" prop="planCycleValue">
                  <el-date-picker class="command-date-picker" popper-class="command-date-picker-popper"
                     v-model="formData.planCycleValue" type="date" placeholder="请选择" clearable
                     value-format="YYYY-MM-DD" :format="planCycleDateFormat" :disabled="!formData.planCycleType"
                     :disabled-date="getPlanCycleDisabledDate" :editable="false" />
               <el-form-item label="维护计划时间" prop="planCycleValue" >
                  <el-date-picker
                     v-if="formData.planCycleType === '1'"
                     :disabled="!formData.planCycleType"
                     class="command-date-picker"
                     popper-class="command-date-picker-popper"
                     v-model="formData.planCycleValue"
                     type="date"
                     placeholder="请选择"
                     clearable
                     value-format="YYYY-MM-DD"
                     :format="planCycleDateFormat"
                     :disabled-date="getPlanCycleDisabledDate"
                     :editable="false" />
                  <el-select
                     v-else
                     :disabled="!formData.planCycleType"
                     class="command-select"
                     popper-class="command-select-popper"
                     v-model="formData.planCycleValue"
                     placeholder="请选择"
                     clearable
                  >
                     <el-option
                        v-for="item in planCycleValueOptions"
                        :key="item.value"
                        :label="item.value"
                        :value="item.value"
                     />
                  </el-select>
               </el-form-item>
            </el-col>
         </el-row>
@@ -145,6 +170,7 @@
dayjs.locale('zh-cn')
const planCycleOptions = inject('planCycleOptions')
const planCycleValueOptions = ref([])
const emit = defineEmits(['success'])
const formRef = ref(null) // 表单实例
@@ -186,6 +212,29 @@
   visible.value = false
}
watch(
   () => formData.value?.planCycleType,
   type => {
      planCycleValueOptions.value = []
      if (!type) return
      if (type === '1') {
         ;[...Array(12)].forEach((item, index) => {
            ;[...Array(31)].forEach((item1, index1) => {
               planCycleValueOptions.value.push({ value: `${index + 1}月${index1 + 1}号` })
            })
         })
      } else if (type === '2') {
         ;[...Array(31)].forEach((item, index) => {
            planCycleValueOptions.value.push({ value: `${index + 1}号` })
         })
      } else if (type === '3') {
         ;['一', '二', '三', '四', '五', '六', '日'].forEach((item, index) => {
            planCycleValueOptions.value.push({ value: `星期${item}` })
         })
      }
   }
)
// 提交新增/编辑
async function handleSubmit () {
   const isValid = await formRef.value?.validate().catch(() => false)