| | |
| | | * @Author : yuan |
| | | * @Date : 2026-01-20 14:04:02 |
| | | * @LastEditors : yuan |
| | | * @LastEditTime : 2026-01-20 14:19:54 |
| | | * @LastEditTime : 2026-01-20 16:38:55 |
| | | * @FilePath : \applications\drone-command\src\views\basicManage\maintainRecord\FormDiaLog.vue |
| | | * @Description : |
| | | * Copyright 2026 OBKoro1, All Rights Reserved. |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div class="label">维护时间</div> |
| | | <div class="val">{{ list?.[0]?.maintainTime }}</div> |
| | | <div class="val">{{ dayjs(list?.[0]?.maintainTime).format('YYYY-MM-DD') }}</div> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div class="label">维护内容</div> |
| | |
| | | <div class="command-table-content"> |
| | | <el-table class="command-table" :data="list"> |
| | | <el-table-column type="index" width="60" label="序号" /> |
| | | <el-table-column prop="maintainTime" label="维护时间" /> |
| | | <el-table-column prop="maintainTime" show-overflow-tooltip label="维护时间"> |
| | | <template v-slot="{ row }"> |
| | | {{ dayjs(row.maintainTime).format('YYYY-MM-DD') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="maintainContent" label="维护内容" /> |
| | | <el-table-column prop="replacePart" label="跟换部件" /> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div class="command-table-pagination"> |
| | | <el-pagination popper-class="command-select-popper" |
| | | v-model:current-page="searchParams.current" v-model:page-size="searchParams.size" |
| | | layout="total, prev, pager, next, sizes" :total="total" @change="getList" /> |
| | | <el-pagination popper-class="command-select-popper" v-model:current-page="searchParams.current" |
| | | v-model:page-size="searchParams.size" layout="total, prev, pager, next, sizes" :total="total" |
| | | @change="getList" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | } |
| | | |
| | | // 获取设备列表 |
| | | function getDeviceList() { |
| | | function getDeviceList () { |
| | | return fwDevicePageApi({ current: 1, size: 999 }).then(res => { |
| | | deviceList.value = res?.data?.data?.records ?? [] |
| | | }) |
| | | } |
| | | |
| | | // 关闭弹框 |
| | | function handleCancel() { |
| | | function handleCancel () { |
| | | visible.value = false |
| | | } |
| | | |
| | | // 提交新增/编辑 |
| | | async function handleSubmit() { |
| | | async function handleSubmit () { |
| | | const isValid = await formRef.value?.validate().catch(() => false) |
| | | if (!isValid) return |
| | | submitting.value = true |
| | |
| | | } |
| | | |
| | | // 加载详情 |
| | | async function loadDetail() { |
| | | async function loadDetail () { |
| | | if (!formData.value.id) return |
| | | const res = await fwDeviceMaintainPlanDetailApi({ id: formData.value.id }) |
| | | const data = res?.data?.data ?? {} |
| | |
| | | } |
| | | |
| | | // 关闭后重置 |
| | | function handleClosed() { |
| | | function handleClosed () { |
| | | formData.value = initForm() |
| | | } |
| | | |
| | |
| | | const total = ref(0) // 总条数 |
| | | const loading = ref(true) // 列表加载中 |
| | | const list = ref([]) // 列表数据 |
| | | async function getList() { |
| | | async function getList () { |
| | | loading.value = true |
| | | try { |
| | | const params = { ...searchParams.value, planId: formData.value.id } |
| | |
| | | } |
| | | |
| | | // 打开弹框 |
| | | async function open({ mode, row } = {}) { |
| | | async function open ({ mode, row } = {}) { |
| | | dialogMode.value = mode || 'add' |
| | | visible.value = true |
| | | await getDeviceList() |
| | |
| | | } |
| | | } |
| | | |
| | | function toDateString(date) { |
| | | function toDateString (date) { |
| | | const year = date.getFullYear() |
| | | const month = String(date.getMonth() + 1).padStart(2, '0') |
| | | const day = String(date.getDate()).padStart(2, '0') |
| | | return `${year}-${month}-${day}` |
| | | } |
| | | |
| | | function formatPlanCycleValue(value, type) { |
| | | function formatPlanCycleValue (value, type) { |
| | | if (typeof value !== 'string') return value |
| | | if (!value.includes('-')) return value |
| | | const date = new Date(value) |
| | |
| | | return value |
| | | } |
| | | |
| | | function normalizePlanCycleValue(value, type) { |
| | | function normalizePlanCycleValue (value, type) { |
| | | if (!value) return '' |
| | | const now = new Date() |
| | | if (typeof value !== 'string') return '' |
| | |
| | | return value |
| | | } |
| | | |
| | | function getWeekRange(date) { |
| | | function getWeekRange (date) { |
| | | const base = new Date(date.getFullYear(), date.getMonth(), date.getDate()) |
| | | const day = base.getDay() |
| | | const diff = day === 0 ? -6 : 1 - day |
| | |
| | | return { start, end } |
| | | } |
| | | |
| | | function getPlanCycleDisabledDate(date) { |
| | | function getPlanCycleDisabledDate (date) { |
| | | const type = formData.value.planCycleType |
| | | if (!type) return false |
| | | const now = new Date() |