| | |
| | | <text class="item-id">设备名称:{{ item.deviceName }}</text> |
| | | </view> |
| | | <view class="status-tag"> |
| | | <u-tag v-if="item.status === 1" |
| | | type="success">完结</u-tag> |
| | | <u-tag v-if="item.status === 0" |
| | | type="error">待维修</u-tag> |
| | | <u-tag :type="getStatusType(item.status)" |
| | | size="mini">{{ getStatusLabel(item.status) }}</u-tag> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | |
| | | <text class="detail-value">{{ item.maintenanceName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">验收人</text> |
| | | <text class="detail-value">{{ item.acceptanceName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">维修项目</text> |
| | | <text class="detail-value">{{ item.machineryCategory || '-' }}</text> |
| | | </view> |
| | |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">维修日期</text> |
| | | <text class="detail-value">{{ formatDate(item.maintenanceTime) || '-' }}</text> |
| | | <text class="detail-value">{{ formatDateTime(item.maintenanceTime) || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | <!-- 按钮区域 --> |
| | | <view class="action-buttons"> |
| | | <u-button type="info" |
| | | size="small" |
| | | plain |
| | | class="action-btn" |
| | | @click="goDetail(item)"> |
| | | 详情 |
| | | </u-button> |
| | | <u-button type="success" |
| | | size="small" |
| | | class="action-btn" |
| | | v-if="item.status === 3" |
| | | :disabled="!canAccept(item)" |
| | | @click="goAcceptance(item)"> |
| | | 验收 |
| | | </u-button> |
| | | <u-button type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | |
| | | |
| | | const userStore = useUserStore(); |
| | | |
| | | const STATUS_MAP = { |
| | | 0: { label: "待维修", type: "error" }, |
| | | 1: { label: "完成", type: "success" }, |
| | | 2: { label: "维修失败", type: "warning" }, |
| | | 3: { label: "待验收", type: "primary" }, |
| | | }; |
| | | |
| | | const getStatusLabel = status => STATUS_MAP[status]?.label || "-"; |
| | | const getStatusType = status => STATUS_MAP[status]?.type || "info"; |
| | | |
| | | const canAccept = item => { |
| | | if (item.status !== 3) return false; |
| | | const currentName = userStore.nickName || userStore.name || ""; |
| | | return currentName && item.acceptanceName === currentName; |
| | | }; |
| | | |
| | | // 搜索关键词 |
| | | const searchKeyword = ref(""); |
| | | |
| | |
| | | const month = String(date.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(date.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | }; |
| | | |
| | | const formatDateTime = dateStr => { |
| | | if (!dateStr) return ""; |
| | | const date = new Date(dateStr); |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(date.getDate()).padStart(2, "0"); |
| | | const hours = String(date.getHours()).padStart(2, "0"); |
| | | const minutes = String(date.getMinutes()).padStart(2, "0"); |
| | | const seconds = String(date.getSeconds()).padStart(2, "0"); |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | }; |
| | | |
| | | // 查询列表 |
| | |
| | | showToast("参数错误"); |
| | | return; |
| | | } |
| | | // 使用uni.setStorageSync存储id |
| | | uni.setStorageSync("repairId", id); |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/repair/maintain", |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 编辑 - 跳转到add页面,通过id区分新增还是编辑 |
| | | // 编辑 |
| | | const edit = id => { |
| | | if (!id) return; |
| | | // 使用uni.setStorageSync存储id |
| | | // uni.setStorageSync("repairId", id); |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/repair/add?id=" + id, |
| | | }); |
| | | }; |
| | | |
| | | // 详情 |
| | | const goDetail = item => { |
| | | uni.setStorageSync("repairDetail", JSON.stringify(item)); |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/repair/detail?id=" + item.id, |
| | | }); |
| | | }; |
| | | |
| | | // 验收 |
| | | const goAcceptance = item => { |
| | | if (!canAccept(item)) { |
| | | showToast("仅指定验收人可进行验收"); |
| | | return; |
| | | } |
| | | uni.setStorageSync("repairDetail", JSON.stringify(item)); |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/repair/acceptance?id=" + item.id, |
| | | }); |
| | | }; |
| | | |
| | |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | if (!userStore.nickName) { |
| | | userStore.getInfo().catch(() => {}); |
| | | } |
| | | getList(); |
| | | }); |
| | | |
| | |
| | | <style scoped lang="scss"> |
| | | @import "@/styles/sales-common.scss"; |
| | | |
| | | // 设备维修特有样式 |
| | | .sales-account { |
| | | padding-bottom: 80px; // 为浮动按钮留出空间 |
| | | padding-bottom: 80px; |
| | | } |
| | | |
| | | .status-tag { |
| | |
| | | } |
| | | |
| | | .action-buttons { |
| | | gap: 8px; // 与公共样式中的 12px 不同 |
| | | gap: 8px; |
| | | flex-wrap: wrap; |
| | | } |
| | | </style> |
| | | </style> |