gaoluyang
2026-05-15 944be786cefe66d7db1bb84904822ac559713841
src/pages/equipmentManagement/upkeep/add.vue
@@ -41,6 +41,22 @@
            </template>
         </u-form-item>
         
         <u-form-item label="保养人" prop="maintenancePerson" border-bottom>
            <u-input
               v-model="form.maintenancePerson"
               placeholder="请输入保养人"
               clearable
            />
         </u-form-item>
         <u-form-item label="保养项目" prop="maintenanceProject" border-bottom>
            <u-input
               v-model="form.maintenanceProject"
               placeholder="请输入保养项目"
               clearable
            />
         </u-form-item>
         <!-- 提交按钮 -->
         <view class="footer-btns">
            <u-button class="cancel-btn" @click="goBack">取消</u-button>
@@ -122,6 +138,8 @@
   deviceLedgerId: undefined, // 设备ID
   deviceModel: undefined, // 规格型号
   maintenancePlanTime: dayjs().format("YYYY-MM-DD"), // 计划保养日期
   maintenancePerson: undefined, // 保养人
   maintenanceProject: undefined, // 保养项目
});
// 加载设备列表
@@ -142,13 +160,15 @@
         const { code, data } = await getUpkeepById(id);
         if (code == 200) {
            form.value.deviceLedgerId = data.deviceLedgerId;
            form.value.deviceModel = data.deviceModel;
            form.value.maintenancePlanTime = dayjs(data.maintenancePlanTime).format("YYYY-MM-DD");
            // 设置设备名称显示
            const device = deviceOptions.value.find(item => item.id === data.deviceLedgerId);
            if (device) {
               form.value.deviceNameText = device.deviceName;
            }
         form.value.deviceModel = data.deviceModel;
         form.value.maintenancePlanTime = dayjs(data.maintenancePlanTime).format("YYYY-MM-DD");
         form.value.maintenancePerson = data.maintenancePerson;
         form.value.maintenanceProject = data.maintenanceProject;
         // 设置设备名称显示
         const device = deviceOptions.value.find(item => item.id === data.deviceLedgerId);
         if (device) {
            form.value.deviceNameText = device.deviceName;
         }
         }
      } catch (e) {
         showToast('获取详情失败');