| | |
| | | }; |
| | | } |
| | | |
| | | export async function queryEquipmentInspection(vueCtx, { machineNo, year }, options = {}) { |
| | | export async function queryEquipmentInspection(vueCtx, { machineNo, date }, options = {}) { |
| | | const { mock = true, showLoading = false } = options; |
| | | const params = { |
| | | url: '/EquipmentInspection/Query', |
| | | data: { machineNo, year }, |
| | | data: { machineNo, date }, |
| | | showLoading |
| | | }; |
| | | |
| | |
| | | } |
| | | |
| | | if (mock) { |
| | | // 从 date (yyyy-MM) 提取年份用于缓存key |
| | | const year = date ? date.split('-')[0] : new Date().getFullYear(); |
| | | const cacheKey = buildStorageKey(machineNo, year); |
| | | const cache = uni.getStorageSync(cacheKey); |
| | | if (cache) { |
| | |
| | | return buildDefaultRecord(); |
| | | } |
| | | |
| | | export async function saveEquipmentInspection(vueCtx, { machineNo, year, dailyChecks, monthlyChecks }, options = {}) { |
| | | export async function saveEquipmentInspection(vueCtx, { machineNo, date, dailyChecks, monthlyChecks }, options = {}) { |
| | | const { mock = true, showLoading = true } = options; |
| | | const payload = { |
| | | machineNo, |
| | | year, |
| | | date, |
| | | dailyChecks, |
| | | monthlyChecks |
| | | }; |
| | |
| | | |
| | | if (mock) { |
| | | // 本地缓存模拟保存,便于前端演示与联调 |
| | | // 从 date (yyyy-MM) 提取年份用于缓存key |
| | | const year = date ? date.split('-')[0] : new Date().getFullYear(); |
| | | const cacheKey = buildStorageKey(machineNo, year); |
| | | uni.setStorageSync(cacheKey, JSON.stringify(payload)); |
| | | return { success: true, message: '已保存至本地缓存' }; |