| | |
| | | <el-option label="每周" value="WEEKLY"/> |
| | | <el-option label="每月" value="MONTHLY"/> |
| | | <el-option label="季度" value="QUARTERLY"/> |
| | | <el-option label="年度保养" value="YEARLY"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" v-if="form.frequencyType === 'YEARLY'"> |
| | | <el-form-item label="执行日期" prop="frequencyDetail"> |
| | | <div style="display: flex; gap: 4px; width: 100%"> |
| | | <el-select v-model="form.yearMonth" placeholder="月" clearable style="flex: 1"> |
| | | <el-option v-for="m in 12" :key="m" :label="m + '月'" :value="m" /> |
| | | </el-select> |
| | | <el-select v-model="form.yearDay" placeholder="日" clearable style="flex: 1"> |
| | | <el-option v-for="d in 31" :key="d" :label="d + '日'" :value="d" /> |
| | | </el-select> |
| | | <el-time-picker v-model="form.yearTime" placeholder="时间" format="HH:mm" value-format="HH:mm" style="flex: 1.2" /> |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | |
| | | frequencyDetail: '', |
| | | week: '', |
| | | time: '', |
| | | yearMonth: undefined, |
| | | yearDay: undefined, |
| | | yearTime: '', |
| | | deviceModel: undefined, // 规格型号 |
| | | registrationDate: '', |
| | | maintenancePerson: '' // 保养人 |
| | |
| | | if (form.value.taskId) { |
| | | setDeviceModel(form.value.taskId); |
| | | } |
| | | // YEARLY 频率回显:解析 月份,日期,时间 |
| | | if (form.value.frequencyType === 'YEARLY' && form.value.frequencyDetail) { |
| | | const parts = String(form.value.frequencyDetail).split(','); |
| | | form.value.yearMonth = Number(parts[0]); |
| | | form.value.yearDay = Number(parts[1]); |
| | | form.value.yearTime = parts[2] || ''; |
| | | } |
| | | } else if (type === 'add') { |
| | | // 新增时设置登记日期为当天 |
| | | form.value.registrationDate = getCurrentDate(); |
| | |
| | | frequencyDetail: '', |
| | | week: '', |
| | | time: '', |
| | | yearMonth: undefined, |
| | | yearDay: undefined, |
| | | yearTime: '', |
| | | deviceModel: undefined, |
| | | registrationDate: '', |
| | | maintenancePerson: '' |
| | |
| | | frequencyDetail = payload.week + ',' + payload.time |
| | | payload.frequencyDetail = frequencyDetail |
| | | } |
| | | |
| | | if (payload.frequencyType === 'YEARLY') { |
| | | const month = Number(payload.yearMonth); |
| | | const day = Number(payload.yearDay); |
| | | const time = payload.yearTime; |
| | | if (!month || month < 1 || month > 12) { |
| | | proxy.$modal.msgError('月份必须在1-12之间'); |
| | | return; |
| | | } |
| | | if (!day || day < 1 || day > 31) { |
| | | proxy.$modal.msgError('日期必须在1-31之间'); |
| | | return; |
| | | } |
| | | if (!time || !/^\d{2}:\d{2}$/.test(time)) { |
| | | proxy.$modal.msgError('时间格式必须为 HH:mm'); |
| | | return; |
| | | } |
| | | payload.frequencyDetail = month + ',' + day + ',' + time; |
| | | } |
| | | |
| | | // 录入日期:直接使用表单里的 registrationDate 字段 |
| | | // 一些默认状态字段 |