| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // åæ ¼å
¥åºæ¥æºç±»å |
| | | export function findAllQualifiedStockInRecordTypeOptions() { |
| | | return request({ |
| | | url: '/basic/enum/StockInQualifiedRecordTypeEnum', |
| | | method: 'GET' |
| | | }) |
| | | } |
| | | |
| | | // ä¸åæ ¼å
¥åºæ¥æºç±»å |
| | | export function findAllUnQualifiedStockInRecordTypeOptions() { |
| | | return request({ |
| | | url: '/basic/enum/StockInUnQualifiedRecordTypeEnum', |
| | | method: 'GET' |
| | | }) |
| | | } |
| | | |
| | | // åæ ¼åºåºæ¥æºç±»å |
| | | export function findAllQualifiedStockOutRecordTypeOptions() { |
| | | return request({ |
| | | url: '/basic/enum/StockOutQualifiedRecordTypeEnum', |
| | | method: 'GET' |
| | | }) |
| | | } |
| | | |
| | | // ä¸åæ ¼åºåºæ¥æºç±»å |
| | | export function findAllUnQualifiedStockOutRecordTypeOptions() { |
| | | return request({ |
| | | url: '/basic/enum/StockOutUnQualifiedRecordTypeEnum', |
| | | method: 'GET' |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // 产ååå·å页å表ï¼ç¨äºéæ©äº§åï¼ |
| | | export const productModelList = (params) => { |
| | | return request({ |
| | | url: '/basic/product/pageModel', |
| | | method: 'GET', |
| | | params |
| | | }) |
| | | } |
| | | |
| | |
| | | import request from '@/utils/request' |
| | | import request from "@/utils/request"; |
| | | |
| | | // ==================== å·¡æ£ä»»å¡ç®¡ç ==================== |
| | | // ==================== å·¡æ£ä»»å¡ ==================== |
| | | |
| | | /** |
| | | * @desc æ¥è¯¢å·¡æ£ä»»å¡å表 |
| | |
| | | */ |
| | | export function getInspectionTaskList(query) { |
| | | return request({ |
| | | url: '/equipment/inspection/task/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/equipment/inspection/task/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function getInspectionTask(id) { |
| | | return request({ |
| | | url: '/equipment/inspection/task/' + id, |
| | | method: 'get' |
| | | }) |
| | | url: "/equipment/inspection/task/" + id, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function createInspectionTask(data) { |
| | | return request({ |
| | | url: '/equipment/inspection/task', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/task", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function updateInspectionTask(data) { |
| | | return request({ |
| | | url: '/equipment/inspection/task', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/task", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function deleteInspectionTask(id) { |
| | | return request({ |
| | | url: '/equipment/inspection/task/' + id, |
| | | method: 'delete' |
| | | }) |
| | | url: "/equipment/inspection/task/" + id, |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function startInspectionTask(taskId) { |
| | | return request({ |
| | | url: '/equipment/inspection/task/' + taskId + '/start', |
| | | method: 'post' |
| | | }) |
| | | url: "/equipment/inspection/task/" + taskId + "/start", |
| | | method: "post", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function completeInspectionTask(taskId, data) { |
| | | return request({ |
| | | url: '/equipment/inspection/task/' + taskId + '/complete', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/task/" + taskId + "/complete", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ==================== å·¡æ£è®°å½ç®¡ç ==================== |
| | |
| | | */ |
| | | export function submitInspectionRecord(data) { |
| | | return request({ |
| | | url: '/equipment/inspection/record/submit', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/record/submit", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function getInspectionRecordList(query) { |
| | | return request({ |
| | | url: '/equipment/inspection/record/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/equipment/inspection/record/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function getInspectionRecord(id) { |
| | | return request({ |
| | | url: '/equipment/inspection/record/' + id, |
| | | method: 'get' |
| | | }) |
| | | url: "/equipment/inspection/record/" + id, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // ==================== æä»¶ä¸ä¼ ==================== |
| | |
| | | */ |
| | | export function uploadInspectionImage(file) { |
| | | return request({ |
| | | url: '/equipment/inspection/upload/image', |
| | | method: 'post', |
| | | url: "/equipment/inspection/upload/image", |
| | | method: "post", |
| | | data: file, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | }) |
| | | "Content-Type": "multipart/form-data", |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function uploadInspectionVideo(file) { |
| | | return request({ |
| | | url: '/equipment/inspection/upload/video', |
| | | method: 'post', |
| | | url: "/equipment/inspection/upload/video", |
| | | method: "post", |
| | | data: file, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | }) |
| | | "Content-Type": "multipart/form-data", |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function batchUploadFiles(formData) { |
| | | return request({ |
| | | url: '/equipment/inspection/upload/batch', |
| | | method: 'post', |
| | | url: "/equipment/inspection/upload/batch", |
| | | method: "post", |
| | | data: formData, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | }) |
| | | "Content-Type": "multipart/form-data", |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | // ==================== å¼å¸¸æ¥å¤ç®¡ç ==================== |
| | |
| | | */ |
| | | export function reportAbnormalSituation(data) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/report', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/abnormal/report", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function getAbnormalReportList(query) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/equipment/inspection/abnormal/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function getAbnormalReport(id) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/' + id, |
| | | method: 'get' |
| | | }) |
| | | url: "/equipment/inspection/abnormal/" + id, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function handleAbnormalReport(id, data) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/' + id + '/handle', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/abnormal/" + id + "/handle", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function transferAbnormalReport(id, data) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/' + id + '/transfer', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/abnormal/" + id + "/transfer", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function closeAbnormalReport(id, data) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/' + id + '/close', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/inspection/abnormal/" + id + "/close", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ==================== ç»è®¡åæ ==================== |
| | |
| | | */ |
| | | export function getInspectionStats(params) { |
| | | return request({ |
| | | url: '/equipment/inspection/stats', |
| | | method: 'get', |
| | | params: params |
| | | }) |
| | | url: "/equipment/inspection/stats", |
| | | method: "get", |
| | | params: params, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function getAbnormalStats(params) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/stats', |
| | | method: 'get', |
| | | params: params |
| | | }) |
| | | url: "/equipment/inspection/abnormal/stats", |
| | | method: "get", |
| | | params: params, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function exportInspectionReport(params) { |
| | | return request({ |
| | | url: '/equipment/inspection/export/report', |
| | | method: 'get', |
| | | url: "/equipment/inspection/export/report", |
| | | method: "get", |
| | | params: params, |
| | | responseType: 'blob' |
| | | }) |
| | | responseType: "blob", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function exportAbnormalRecords(params) { |
| | | return request({ |
| | | url: '/equipment/inspection/abnormal/export', |
| | | method: 'get', |
| | | url: "/equipment/inspection/abnormal/export", |
| | | method: "get", |
| | | params: params, |
| | | responseType: 'blob' |
| | | }) |
| | | responseType: "blob", |
| | | }); |
| | | } |
| | | |
| | | // ==================== 设å¤äºç»´ç ==================== |
| | |
| | | export function getDeviceQRCode(deviceId) { |
| | | return request({ |
| | | url: `/equipment/device/${deviceId}/qrcode`, |
| | | method: 'get' |
| | | }) |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function verifyDeviceQRCode(data) { |
| | | return request({ |
| | | url: '/equipment/device/qrcode/verify', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | url: "/equipment/device/qrcode/verify", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ==================== 模æ¿ç®¡ç ==================== |
| | |
| | | */ |
| | | export function getInspectionTemplateList(query) { |
| | | return request({ |
| | | url: '/equipment/inspection/template/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/equipment/inspection/template/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function getInspectionTemplate(id) { |
| | | return request({ |
| | | url: '/equipment/inspection/template/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | url: "/equipment/inspection/template/" + id, |
| | | method: "get", |
| | | }); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | // ---------- 设å¤ä¿å
»å®æ¶ä»»å¡ï¼å®æ¶ä»»å¡ç®¡çï¼ ---------- |
| | | /** 设å¤ä¿å
»å®æ¶ä»»å¡å页å表 */ |
| | | export const deviceMaintenanceTaskList = (params) => { |
| | | return request({ |
| | | url: "/deviceMaintenanceTask/listPage", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | /** æ°å¢è®¾å¤ä¿å
»å®æ¶ä»»å¡ */ |
| | | export const deviceMaintenanceTaskAdd = (data) => { |
| | | return request({ |
| | | url: "/deviceMaintenanceTask/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | }; |
| | | |
| | | /** ä¿®æ¹è®¾å¤ä¿å
»å®æ¶ä»»å¡ */ |
| | | export const deviceMaintenanceTaskEdit = (data) => { |
| | | return request({ |
| | | url: "/deviceMaintenanceTask/update", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | }; |
| | | |
| | | /** å é¤è®¾å¤ä¿å
»å®æ¶ä»»å¡ */ |
| | | export const deviceMaintenanceTaskDel = (ids) => { |
| | | return request({ |
| | | url: "/deviceMaintenanceTask/delete", |
| | | method: "delete", |
| | | data: Array.isArray(ids) ? ids : [ids], |
| | | }); |
| | | }; |
| | | |
| | | // æ¥è¯¢å¤ä»¶é项 |
| | | export const getSparePartsOptions = (params) => { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // å
¥åºç®¡ç-å页æ¥è¯¢å
¥åºè®°å½ï¼åæ ¼/ä¸åæ ¼ï¼ |
| | | export const getStockInRecordListPage = (params) => { |
| | | return request({ |
| | | url: '/stockInRecord/listPage', |
| | | method: 'GET', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | // æ ¹æ® id æ¥è¯¢å
¥åºè®°å½è¯¦æ
|
| | | export const getStockInRecordById = (id) => { |
| | | return request({ |
| | | url: '/stockInRecord/' + id, |
| | | method: 'GET' |
| | | }) |
| | | } |
| | | |
| | | // æ¹éå é¤å
¥åºè®°å½ |
| | | export const batchDeleteStockInRecords = (ids) => { |
| | | return request({ |
| | | url: '/stockInRecord', |
| | | method: 'DELETE', |
| | | data: ids |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // åæ ¼åºå-å页æ¥è¯¢ |
| | | export const getStockInventoryListPage = (params) => { |
| | | return request({ |
| | | url: '/stockInventory/pagestockInventory', |
| | | method: 'GET', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢åæ ¼åºå |
| | | export const createStockInventory = (data) => { |
| | | return request({ |
| | | url: '/stockInventory/addstockInventory', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // åºåºï¼åå°åºåï¼ |
| | | export const subtractStockInventory = (data) => { |
| | | return request({ |
| | | url: '/stockInventory/subtractStockInventory', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // å»ç»åºå |
| | | export const frozenStockInventory = (data) => { |
| | | return request({ |
| | | url: '/stockInventory/frozenStock', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // è§£å»åºå |
| | | export const thawStockInventory = (data) => { |
| | | return request({ |
| | | url: '/stockInventory/thawStock', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // åºåæ¥è¡¨-æ¥æ¥/ææ¥ |
| | | export const getStockInventoryReportList = (params) => { |
| | | return request({ |
| | | url: '/stockInventory/stockInventoryPage', |
| | | method: 'GET', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | // åºåæ¥è¡¨-è¿åºå |
| | | export const getStockInventoryInAndOutReportList = (params) => { |
| | | return request({ |
| | | url: '/stockInventory/stockInAndOutRecord', |
| | | method: 'GET', |
| | | params |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // åºåºå°è´¦-å页æ¥è¯¢åºåºè®°å½ï¼åæ ¼/ä¸åæ ¼ï¼ |
| | | export const getStockOutPage = (params) => { |
| | | return request({ |
| | | url: '/stockOutRecord/listPage', |
| | | method: 'GET', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | // å é¤åºåºè®°å½ |
| | | export const delStockOut = (ids) => { |
| | | return request({ |
| | | url: '/stockOutRecord', |
| | | method: 'DELETE', |
| | | data: ids |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // ä¸åæ ¼åºå-å页æ¥è¯¢ |
| | | export const getStockUninventoryListPage = (params) => { |
| | | return request({ |
| | | url: '/stockUninventory/pagestockUninventory', |
| | | method: 'GET', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢ä¸åæ ¼åºå |
| | | export const createStockUnInventory = (data) => { |
| | | return request({ |
| | | url: '/stockUninventory/addstockUninventory', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // é¢ç¨ï¼åå°ä¸åæ ¼åºåï¼ |
| | | export const subtractStockUnInventory = (data) => { |
| | | return request({ |
| | | url: '/stockUninventory/subtractstockUninventory', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // å»ç»ä¸åæ ¼åºå |
| | | export const frozenStockUninventory = (data) => { |
| | | return request({ |
| | | url: '/stockUninventory/frozenStock', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // è§£å»ä¸åæ ¼åºå |
| | | export const thawStockUninventory = (data) => { |
| | | return request({ |
| | | url: '/stockUninventory/thawStock', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/equipmentManagement/upkeepTask/index", |
| | | "style": { |
| | | "navigationBarTitleText": "设å¤ä¿å
»ä»»å¡", |
| | | "navigationStyle": "custom", |
| | | "enablePullDownRefresh": true, |
| | | "backgroundColor": "#f8f8f8" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/equipmentManagement/upkeep/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "ä¿å
»è¯¦æ
", |
| | |
| | | { |
| | | "path": "pages/inspectionManagement/index", |
| | | "style": { |
| | | "navigationBarTitleText": "å·¡æ£ä»»å¡ç®¡ç", |
| | | "navigationBarTitleText": "å·¡æ£ä»»å¡", |
| | | "navigationStyle": "custom", |
| | | "enablePullDownRefresh": true, |
| | | "backgroundColor": "#f8f8f8" |
| | |
| | | { |
| | | "path": "pages/inventoryManagement/receiptManagement/index", |
| | | "style": { |
| | | "navigationBarTitleText": "èªå®ä¹å
¥åº", |
| | | "navigationBarTitleText": "å
¥åºç®¡ç", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/receiptManagement/view", |
| | | "style": { |
| | | "navigationBarTitleText": "å
¥åºè¯¦æ
", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/issueManagement/index", |
| | | "style": { |
| | | "navigationBarTitleText": "èªå®ä¹åºåº", |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/dispatchLog/index", |
| | | "style": { |
| | | "navigationBarTitleText": "åºåºå°è´¦", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/dispatchLog/view", |
| | | "style": { |
| | | "navigationBarTitleText": "åºåºè¯¦æ
", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/stockManagement/index", |
| | | "style": { |
| | | "navigationBarTitleText": "åºå管ç", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/stockManagement/add", |
| | | "style": { |
| | | "navigationBarTitleText": "æ°å¢åºå", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/stockManagement/subtract", |
| | | "style": { |
| | | "navigationBarTitleText": "åºååºåº", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/stockManagement/view", |
| | | "style": { |
| | | "navigationBarTitleText": "åºå详æ
", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/stockReport/index", |
| | | "style": { |
| | | "navigationBarTitleText": "åºåæ¥è¡¨", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/inventoryManagement/stockReport/view", |
| | | "style": { |
| | | "navigationBarTitleText": "åºåæ¥è¡¨è¯¦æ
", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/safeQualifications/index", |
| | | "style": { |
| | | "navigationBarTitleText": "è§ç¨ä¸èµè´¨", |
| | |
| | | <u-form-item label="设å¤åç§°" |
| | | prop="deviceLedgerId" |
| | | required |
| | | border-bottom> |
| | | <u-input v-model="deviceNameText" |
| | | placeholder="è¯·éæ©è®¾å¤åç§°" |
| | | @click="showDevicePicker" |
| | | clearable |
| | | readonly="" /> |
| | | <template #right> |
| | | <u-icon name="scan" |
| | | @click="startScan" |
| | | class="scan-icon" /> |
| | | </template> |
| | | border-bottom |
| | | class="device-name-form-item"> |
| | | <view class="device-picker-wrap"> |
| | | <picker mode="selector" |
| | | class="device-picker-full" |
| | | :range="deviceOptions" |
| | | range-key="deviceName" |
| | | :value="deviceIndex" |
| | | @change="onDevicePickerChange"> |
| | | <view class="picker-input-row"> |
| | | <text class="picker-input-text" |
| | | :class="{ placeholder: !deviceNameText }">{{ deviceNameText || "è¯·éæ©è®¾å¤åç§°" }}</text> |
| | | <view class="picker-input-arrow"><u-icon name="arrow-right" /></view> |
| | | </view> |
| | | </picker> |
| | | </view> |
| | | </u-form-item> |
| | | <u-form-item label="è§æ ¼åå·" |
| | | prop="deviceModel" |
| | |
| | | </template> |
| | | </u-form-item> |
| | | <u-form-item label="æ¥ä¿®ç¶æ" |
| | | prop="repairTime" |
| | | prop="status" |
| | | required |
| | | border-bottom> |
| | | <u-input v-model="repairStatusText" |
| | |
| | | count |
| | | maxlength="200" /> |
| | | </u-form-item> |
| | | <view class="simple-upload-area"> |
| | | <view class="upload-buttons"> |
| | | <u-button type="primary" |
| | | @click="chooseRepairMedia" |
| | | :loading="uploading" |
| | | :disabled="repairFileList.length >= uploadConfig.limit" |
| | | :customStyle="{ marginRight: '10px', flex: 1 }"> |
| | | <u-icon name="camera" |
| | | size="18" |
| | | color="#fff" |
| | | style="margin-right: 5px;"></u-icon> |
| | | {{ uploading ? "ä¸ä¼ ä¸..." : "æç
§" }} |
| | | </u-button> |
| | | </view> |
| | | <view v-if="uploading" |
| | | class="upload-progress"> |
| | | <u-line-progress :percentage="uploadProgress" |
| | | :showText="true" |
| | | activeColor="#409eff"></u-line-progress> |
| | | </view> |
| | | <view v-if="repairFileList.length > 0" |
| | | class="file-list"> |
| | | <view v-for="(file, index) in repairFileList" |
| | | :key="index" |
| | | class="file-item"> |
| | | <view class="file-preview-container"> |
| | | <view class="delete-btn" |
| | | @click="removeRepairFile(index)"> |
| | | <u-icon name="close" |
| | | size="12" |
| | | color="#fff"></u-icon> |
| | | </view> |
| | | <image :src="file.url || file.tempFilePath || file.path || file.downloadUrl" |
| | | class="file-preview" |
| | | mode="aspectFill" /> |
| | | </view> |
| | | <view class="file-info"> |
| | | <text class="file-name">{{ file.bucketFilename || file.name || "å¾ç" }}</text> |
| | | <text class="file-size">{{ formatFileSize(file.size) }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-if="repairFileList.length === 0" |
| | | class="empty-state"> |
| | | <text>è¯·éæ©è¦ä¸ä¼ çç°åºç
§ç</text> |
| | | </view> |
| | | </view> |
| | | </u-cell-group> |
| | | <!-- æäº¤æé® --> |
| | | <view class="footer-btns"> |
| | |
| | | :loading="loading">ä¿å</u-button> |
| | | </view> |
| | | </u-form> |
| | | <!-- 设å¤éæ©å¨ --> |
| | | <up-action-sheet :show="showDevice" |
| | | :actions="deviceActionList" |
| | | title="éæ©è®¾å¤åç§°" |
| | | @select="onDeviceSelect" |
| | | @close="showDevice = false" /> |
| | | <!-- æ¥æéæ©å¨ --> |
| | | <up-datetime-picker :show="showDate" |
| | | v-model="pickerDateValue" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, onMounted, onUnmounted } from "vue"; |
| | | import { ref, computed, onMounted } from "vue"; |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { getDeviceLedger } from "@/api/equipmentManagement/ledger"; |
| | |
| | | editRepair, |
| | | getRepairById, |
| | | } from "@/api/equipmentManagement/repair"; |
| | | import config from "@/config"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import dayjs from "dayjs"; |
| | | import { formatDateToYMD } from "@/utils/ruoyi"; |
| | | const showToast = message => { |
| | |
| | | const formRef = ref(null); |
| | | const operationType = ref("add"); |
| | | const loading = ref(false); |
| | | const showDevice = ref(false); |
| | | const showDate = ref(false); |
| | | const pickerDateValue = ref(Date.now()); |
| | | |
| | | // ä¸ä¼ é
ç½®ï¼ä¸å·¡æ£ä¸è´ï¼ |
| | | const uploadConfig = { |
| | | action: "/file/upload", |
| | | limit: 10, |
| | | }; |
| | | const uploadFileUrl = computed(() => config.baseUrl + uploadConfig.action); |
| | | const repairFileList = ref([]); |
| | | const uploading = ref(false); |
| | | const uploadProgress = ref(0); |
| | | |
| | | // 设å¤é项 |
| | | const deviceOptions = ref([]); |
| | | const deviceNameText = ref(""); |
| | | const deviceActionList = computed(() => { |
| | | return deviceOptions.value.map(item => ({ |
| | | name: item.deviceName, |
| | | value: item.id, |
| | | })); |
| | | const deviceIndex = computed(() => { |
| | | const id = form.value.deviceLedgerId; |
| | | if (id == null || !deviceOptions.value.length) return 0; |
| | | const idx = deviceOptions.value.findIndex(item => item.id === id || item.id == id); |
| | | return idx >= 0 ? idx : 0; |
| | | }); |
| | | |
| | | // æ«ç ç¸å
³ç¶æ |
| | | const isScanning = ref(false); |
| | | const scanTimer = ref(null); |
| | | |
| | | // 表åéªè¯è§å |
| | | const formRules = { |
| | |
| | | ], |
| | | repairTime: [ |
| | | { required: true, trigger: "change", message: "è¯·éæ©æ¥ä¿®æ¥æ" }, |
| | | ], |
| | | status: [ |
| | | { required: true, trigger: "change", message: "è¯·éæ©æ¥ä¿®ç¶æ" }, |
| | | ], |
| | | repairName: [{ required: true, trigger: "blur", message: "请è¾å
¥æ¥ä¿®äºº" }], |
| | | remark: [{ required: true, trigger: "blur", message: "请è¾å
¥æ
éç°è±¡" }], |
| | |
| | | deviceLedgerId: undefined, // 设å¤ID |
| | | deviceModel: undefined, // è§æ ¼åå· |
| | | repairTime: dayjs().format("YYYY-MM-DD"), // æ¥ä¿®æ¥æ |
| | | status: undefined, // æ¥ä¿®ç¶æ |
| | | repairName: undefined, // æ¥ä¿®äºº |
| | | remark: undefined, // æ
éç°è±¡ |
| | | }); |
| | |
| | | form.value.deviceLedgerId = data.deviceLedgerId; |
| | | form.value.deviceModel = data.deviceModel; |
| | | form.value.repairTime = dayjs(data.repairTime).format("YYYY-MM-DD"); |
| | | form.value.status = data.status; |
| | | form.value.repairName = data.repairName; |
| | | form.value.remark = data.remark; |
| | | repairStatusText.value = |
| | |
| | | if (device) { |
| | | deviceNameText.value = device.deviceName; |
| | | } |
| | | // åæ¾éä»¶å表ï¼å端è¿å fileList æ¶ï¼ |
| | | const list = data.fileList || data.commonFileList || []; |
| | | repairFileList.value = (Array.isArray(list) ? list : []).map(f => ({ |
| | | url: f.url || f.downloadUrl, |
| | | name: f.bucketFilename || f.originalFilename || f.name, |
| | | bucketFilename: f.bucketFilename || f.originalFilename || f.name, |
| | | size: f.size || f.byteSize, |
| | | uploadResponse: f, |
| | | })); |
| | | } |
| | | } catch (e) { |
| | | showToast("è·å详æ
失败"); |
| | |
| | | } |
| | | }; |
| | | |
| | | // æ«æäºç»´ç åè½ |
| | | const startScan = () => { |
| | | if (isScanning.value) { |
| | | showToast("æ£å¨æ«æä¸ï¼è¯·ç¨å..."); |
| | | // 䏿æ¡éæ©è®¾å¤ |
| | | const onDevicePickerChange = e => { |
| | | const index = Number(e.detail?.value ?? 0); |
| | | const item = deviceOptions.value[index]; |
| | | if (item) { |
| | | form.value.deviceLedgerId = item.id; |
| | | setDeviceModel(item.id); |
| | | } |
| | | }; |
| | | |
| | | // æ ¼å¼åæä»¶å¤§å° |
| | | const formatFileSize = size => { |
| | | if (!size) return ""; |
| | | if (size < 1024) return size + "B"; |
| | | if (size < 1024 * 1024) return (size / 1024).toFixed(1) + "KB"; |
| | | return (size / (1024 * 1024)).toFixed(1) + "MB"; |
| | | }; |
| | | |
| | | // æç
§éæ©ï¼ä¸å·¡æ£ä¸è´ï¼ |
| | | const chooseRepairMedia = () => { |
| | | if (repairFileList.value.length >= uploadConfig.limit) { |
| | | showToast(`æå¤åªè½éæ©${uploadConfig.limit}个æä»¶`); |
| | | return; |
| | | } |
| | | const remaining = uploadConfig.limit - repairFileList.value.length; |
| | | if (typeof uni.chooseMedia === "function") { |
| | | uni.chooseMedia({ |
| | | count: Math.min(remaining, 9), |
| | | mediaType: ["image"], |
| | | sizeType: ["compressed", "original"], |
| | | sourceType: ["camera", "album"], |
| | | success: res => { |
| | | const files = res?.tempFiles || []; |
| | | files.forEach((tf, idx) => { |
| | | const filePath = tf.tempFilePath || tf.path || ""; |
| | | const file = { |
| | | tempFilePath: filePath, |
| | | path: filePath, |
| | | type: "image", |
| | | name: `repair_${Date.now()}_${idx}.jpg`, |
| | | size: tf.size || 0, |
| | | uid: Date.now() + Math.random() + idx, |
| | | }; |
| | | uploadRepairFile(file); |
| | | }); |
| | | }, |
| | | fail: () => showToast("éæ©å¾ç失败"), |
| | | }); |
| | | } else { |
| | | uni.chooseImage({ |
| | | count: remaining, |
| | | sizeType: ["compressed", "original"], |
| | | sourceType: ["camera", "album"], |
| | | success: res => { |
| | | (res.tempFilePaths || []).forEach((path, idx) => { |
| | | uploadRepairFile({ |
| | | tempFilePath: path, |
| | | path: path, |
| | | type: "image", |
| | | name: `repair_${Date.now()}_${idx}.jpg`, |
| | | size: 0, |
| | | uid: Date.now() + Math.random(), |
| | | }); |
| | | }); |
| | | }, |
| | | fail: () => showToast("éæ©å¾ç失败"), |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // è°ç¨uni-appçæ«ç API |
| | | uni.scanCode({ |
| | | scanType: ["qrCode", "barCode"], |
| | | const uploadRepairFile = file => { |
| | | const filePath = file.tempFilePath || file.path; |
| | | if (!filePath) return; |
| | | uploading.value = true; |
| | | uploadProgress.value = 0; |
| | | const token = getToken(); |
| | | if (!token) { |
| | | showToast("请å
ç»å½"); |
| | | uploading.value = false; |
| | | return; |
| | | } |
| | | const uploadTask = uni.uploadFile({ |
| | | url: uploadFileUrl.value, |
| | | filePath, |
| | | name: "file", |
| | | header: { Authorization: "Bearer " + token }, |
| | | success: res => { |
| | | handleScanResult(res.result); |
| | | try { |
| | | if (res.statusCode === 200) { |
| | | const response = typeof res.data === "string" ? JSON.parse(res.data) : res.data; |
| | | const d = response?.data !== undefined ? response.data : response; |
| | | if (response && (response.code === 200 || response.code === 0) && d) { |
| | | const fileData = { |
| | | ...file, |
| | | id: d.id, |
| | | tempId: d.tempId ?? d.tempFileId ?? d.id, |
| | | url: d.url || d.downloadUrl || filePath, |
| | | bucketFilename: d.bucketFilename || d.originalFilename || file.name, |
| | | downloadUrl: d.downloadUrl || d.url, |
| | | size: d.size ?? d.byteSize ?? file.size, |
| | | uploadResponse: response, |
| | | }; |
| | | repairFileList.value.push(fileData); |
| | | } else { |
| | | showToast(response?.msg || "ä¸ä¼ 失败"); |
| | | } |
| | | } else { |
| | | showToast("ä¸ä¼ 失败"); |
| | | } |
| | | } catch (e) { |
| | | showToast("ä¸ä¼ 失败"); |
| | | } |
| | | uploading.value = false; |
| | | uploadProgress.value = 0; |
| | | }, |
| | | fail: err => { |
| | | console.error("æ«ç 失败:", err); |
| | | showToast("æ«ç 失败ï¼è¯·éè¯"); |
| | | fail: () => { |
| | | showToast("ä¸ä¼ 失败"); |
| | | uploading.value = false; |
| | | uploadProgress.value = 0; |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | // å¤çæ«ç ç»æ |
| | | const handleScanResult = scanResult => { |
| | | if (!scanResult) { |
| | | showToast("æ«ç ç»æä¸ºç©º"); |
| | | return; |
| | | } |
| | | |
| | | isScanning.value = true; |
| | | showToast("æ«ç æå"); |
| | | |
| | | // 3ç§åå¤çæ«ç ç»æ |
| | | scanTimer.value = setTimeout(() => { |
| | | processScanResult(scanResult); |
| | | isScanning.value = false; |
| | | }, 100); |
| | | }; |
| | | function getDeviceIdByRegExp(url) { |
| | | // å¹é
deviceId=åé¢çæ°å |
| | | const reg = /deviceId=(\d+)/; |
| | | const match = url.match(reg); |
| | | // 妿å¹é
å°ç»æï¼è¿åæ°åç±»åï¼å¦åè¿ånull |
| | | return match ? Number(match[1]) : null; |
| | | } |
| | | |
| | | // å¤çæ«ç ç»æå¹¶å¹é
è®¾å¤ |
| | | const processScanResult = scanResult => { |
| | | const deviceId = getDeviceIdByRegExp(scanResult); |
| | | const matchedDevice = deviceOptions.value.find(item => item.id == deviceId); |
| | | |
| | | if (matchedDevice) { |
| | | // æ¾å°å¹é
ç设å¤ï¼èªå¨å¡«å
|
| | | form.value.deviceLedgerId = matchedDevice.id; |
| | | deviceNameText.value = matchedDevice.deviceName; |
| | | form.value.deviceModel = matchedDevice.deviceModel; |
| | | showToast("设å¤ä¿¡æ¯å·²èªå¨å¡«å
"); |
| | | } else { |
| | | // æªæ¾å°å¹é
çè®¾å¤ |
| | | showToast("æªæ¾å°å¹é
ç设å¤ï¼è¯·æå¨éæ©"); |
| | | if (uploadTask && uploadTask.onProgressUpdate) { |
| | | uploadTask.onProgressUpdate(e => { |
| | | uploadProgress.value = e.progress; |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // æ¾ç¤ºè®¾å¤éæ©å¨ |
| | | const showDevicePicker = () => { |
| | | showDevice.value = true; |
| | | }; |
| | | |
| | | // 确认设å¤éæ© |
| | | const onDeviceSelect = e => { |
| | | form.value.deviceLedgerId = e.value; |
| | | setDeviceModel(e.value); |
| | | showDevice.value = false; |
| | | const removeRepairFile = index => { |
| | | repairFileList.value.splice(index, 1); |
| | | }; |
| | | |
| | | // æ¾ç¤ºæ¥æéæ©å¨ |
| | |
| | | }); |
| | | |
| | | // ç»ä»¶å¸è½½æ¶æ¸
ç宿¶å¨ |
| | | onUnmounted(() => { |
| | | if (scanTimer.value) { |
| | | clearTimeout(scanTimer.value); |
| | | } |
| | | }); |
| | | |
| | | // æäº¤è¡¨å |
| | | const sendForm = async () => { |
| | |
| | | } else if (!form.value.repairTime || form.value.repairTime.trim() === "") { |
| | | isValid = false; |
| | | errorMessage = "è¯·éæ©æ¥ä¿®æ¥æ"; |
| | | } else if (form.value.status === undefined || form.value.status === null || form.value.status === "") { |
| | | isValid = false; |
| | | errorMessage = "è¯·éæ©æ¥ä¿®ç¶æ"; |
| | | } else if (!form.value.repairName || form.value.repairName.trim() === "") { |
| | | isValid = false; |
| | | errorMessage = "请è¾å
¥æ¥ä¿®äºº"; |
| | |
| | | loading.value = true; |
| | | const id = getPageId(); |
| | | |
| | | // åå¤æäº¤æ°æ® |
| | | // éä»¶æ°ç»ï¼ä¸ä¼ æ¥å£è¿åçéä»¶ä¿¡æ¯ï¼ä¸å·¡æ£ä¸è´ä¼ fileListï¼ |
| | | const fileList = repairFileList.value.map(f => { |
| | | const d = f.uploadResponse?.data !== undefined ? f.uploadResponse.data : f.uploadResponse; |
| | | return d ? { ...d } : null; |
| | | }).filter(Boolean); |
| | | const submitData = { ...form.value }; |
| | | if (fileList.length) submitData.fileList = fileList; |
| | | |
| | | const { code } = id |
| | | ? await editRepair({ id: id, ...submitData }) |
| | |
| | | color: #888; |
| | | } |
| | | |
| | | .scan-icon { |
| | | color: #1989fa; |
| | | font-size: 18px; |
| | | margin-left: 8px; |
| | | cursor: pointer; |
| | | :deep(.device-name-form-item .u-form-item__content) { |
| | | justify-content: flex-start !important; |
| | | } |
| | | |
| | | .device-picker-wrap { |
| | | width: 100%; |
| | | flex: 1; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .device-picker-full { |
| | | display: block; |
| | | width: 100%; |
| | | } |
| | | |
| | | .picker-input-row { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | width: 100%; |
| | | min-height: 36px; |
| | | padding: 0; |
| | | } |
| | | |
| | | .picker-input-text { |
| | | flex: 1; |
| | | min-width: 0; |
| | | font-size: 15px; |
| | | color: #333; |
| | | line-height: 36px; |
| | | margin-right: 8px; |
| | | } |
| | | |
| | | .picker-input-arrow { |
| | | flex-shrink: 0; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .picker-input-text.placeholder { |
| | | color: #c0c4cc; |
| | | } |
| | | |
| | | .simple-upload-area { |
| | | padding: 15px 20px; |
| | | } |
| | | |
| | | .upload-buttons { |
| | | display: flex; |
| | | gap: 10px; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .upload-progress { |
| | | margin: 15px 0; |
| | | padding: 0 10px; |
| | | } |
| | | |
| | | .file-list { |
| | | margin-top: 15px; |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 12px; |
| | | } |
| | | |
| | | .file-item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 8px; |
| | | border: 1px solid #e9ecef; |
| | | width: calc(50% - 6px); |
| | | min-width: 120px; |
| | | } |
| | | |
| | | .file-preview-container { |
| | | position: relative; |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | .file-preview { |
| | | width: 80px; |
| | | height: 80px; |
| | | border-radius: 8px; |
| | | object-fit: cover; |
| | | border: 2px solid #f0f0f0; |
| | | } |
| | | |
| | | .delete-btn { |
| | | position: absolute; |
| | | top: -6px; |
| | | right: -6px; |
| | | width: 20px; |
| | | height: 20px; |
| | | background: #ff4757; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | z-index: 1; |
| | | } |
| | | |
| | | .file-info { |
| | | text-align: center; |
| | | width: 100%; |
| | | } |
| | | |
| | | .file-name { |
| | | font-size: 12px; |
| | | color: #333; |
| | | display: block; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | max-width: 100px; |
| | | } |
| | | |
| | | .file-size { |
| | | font-size: 10px; |
| | | color: #999; |
| | | margin-top: 2px; |
| | | display: block; |
| | | } |
| | | |
| | | .empty-state { |
| | | text-align: center; |
| | | padding: 24px 16px; |
| | | color: #999; |
| | | font-size: 14px; |
| | | background: #f8f9fa; |
| | | border-radius: 8px; |
| | | border: 2px dashed #ddd; |
| | | } |
| | | </style> |
| | |
| | | <text class="detail-value">{{ formatDate(item.repairTime) || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ¥ä¿®äºº</text> |
| | | <text class="detail-label">维修人</text> |
| | | <text class="detail-value">{{ item.repairName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | |
| | | <text class="detail-value">{{ item.remark || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">维修人</text> |
| | | <text class="detail-label">æ¥ä¿®äºº</text> |
| | | <text class="detail-value">{{ item.maintenanceName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | |
| | | @click="edit(item.id)" |
| | | > |
| | | ç¼è¾ |
| | | </u-button> |
| | | <u-button |
| | | type="success" |
| | | size="small" |
| | | class="action-btn" |
| | | @click="viewAttachments(item)" |
| | | > |
| | | æ¥çéä»¶ |
| | | </u-button> |
| | | <u-button |
| | | type="warning" |
| | |
| | | <view v-else class="no-data"> |
| | | <text>ææ è®¾å¤æ¥ä¿®æ°æ®</text> |
| | | </view> |
| | | <!-- æ¥çéä»¶å¼¹çª --> |
| | | <view v-if="showAttachmentDialog" class="custom-modal-overlay" @click="closeAttachmentDialog"> |
| | | <view class="custom-modal-container" @click.stop> |
| | | <view class="attachment-popup-content"> |
| | | <view class="attachment-popup-header"> |
| | | <text class="attachment-popup-title">æ¥çéä»¶ - {{ currentViewRepair?.deviceName || 'æ¥ä¿®' }}</text> |
| | | <view class="close-btn-attachment" @click="closeAttachmentDialog"> |
| | | <u-icon name="close" size="16" color="#666"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="attachment-popup-body"> |
| | | <view class="attachment-content"> |
| | | <view v-if="attachmentList.length > 0" class="attachment-list"> |
| | | <view |
| | | v-for="(file, index) in attachmentList" |
| | | :key="index" |
| | | class="attachment-item" |
| | | @click="previewAttachment(file)" |
| | | > |
| | | <view class="attachment-preview-container"> |
| | | <image |
| | | v-if="isImageFile(file)" |
| | | :src="formatFileUrl(file.url || file.downloadUrl)" |
| | | class="attachment-preview" |
| | | mode="aspectFill" |
| | | /> |
| | | <view v-else class="attachment-video-preview"> |
| | | <u-icon name="video" size="24" color="#409eff"></u-icon> |
| | | <text class="video-text">è§é¢</text> |
| | | </view> |
| | | </view> |
| | | <view class="attachment-info"> |
| | | <text class="attachment-name">{{ file.originalFilename || file.bucketFilename || file.name || 'éä»¶' }}</text> |
| | | <text class="attachment-size">{{ formatFileSize(file.byteSize || file.size) }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="attachment-empty"> |
| | | <text>ææ éä»¶</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- è§é¢é¢è§å¼¹çª --> |
| | | <view v-if="showVideoDialog" class="video-modal-overlay" @click="closeVideoPreview"> |
| | | <view class="video-modal-container" @click.stop> |
| | | <view class="video-modal-header"> |
| | | <text class="video-modal-title">{{ currentVideoFile?.originalFilename || currentVideoFile?.bucketFilename || 'è§é¢é¢è§' }}</text> |
| | | <view class="close-btn-video" @click="closeVideoPreview"> |
| | | <u-icon name="close" size="16" color="#fff"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="video-modal-body"> |
| | | <video |
| | | v-if="currentVideoFile" |
| | | :src="currentVideoFile.url || currentVideoFile.downloadUrl" |
| | | class="video-player" |
| | | controls |
| | | autoplay |
| | | @error="handleVideoError" |
| | | ></video> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- æµ®å¨æä½æé® --> |
| | | <view class="fab-button" @click="addRepair"> |
| | | <up-icon name="plus" size="24" color="#ffffff"></up-icon> |
| | |
| | | import { ref, onMounted } from 'vue' |
| | | import { onShow } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { getRepairPage, delRepair } from '@/api/equipmentManagement/repair' |
| | | import { getRepairPage, delRepair, getRepairById } from '@/api/equipmentManagement/repair' |
| | | import config from '@/config' |
| | | import useUserStore from "@/store/modules/user" |
| | | |
| | | const showToast = (message) => { |
| | |
| | | |
| | | // è®¾å¤æ¥ä¿®æ°æ® |
| | | const repairList = ref([]) |
| | | |
| | | // æ¥çéä»¶ |
| | | const showAttachmentDialog = ref(false) |
| | | const attachmentList = ref([]) |
| | | const currentViewRepair = ref(null) |
| | | const showVideoDialog = ref(false) |
| | | const currentVideoFile = ref(null) |
| | | |
| | | const filePreviewBase = config.fileUrl || config.baseUrl || '' |
| | | |
| | | const formatFileUrl = (url) => { |
| | | if (!url) return '' |
| | | if (url.startsWith('http://') || url.startsWith('https://')) return url |
| | | const base = (filePreviewBase || '').replace(/\/$/, '') |
| | | const path = (url || '').replace(/^\/+/, '') |
| | | return path ? `${base}/${path}` : base |
| | | } |
| | | |
| | | const isImageFile = (file) => { |
| | | if (file?.contentType && file.contentType.startsWith('image/')) return true |
| | | if (file?.type === 'image') return true |
| | | const name = file?.bucketFilename || file?.originalFilename || file?.name || '' |
| | | const ext = name.split('.').pop()?.toLowerCase() |
| | | return ['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(ext) |
| | | } |
| | | |
| | | const formatFileSize = (size) => { |
| | | if (!size) return '' |
| | | if (size < 1024) return size + 'B' |
| | | if (size < 1024 * 1024) return (size / 1024).toFixed(1) + 'KB' |
| | | return (size / (1024 * 1024)).toFixed(1) + 'MB' |
| | | } |
| | | |
| | | const viewAttachments = async (item) => { |
| | | try { |
| | | currentViewRepair.value = item |
| | | const { code, data } = await getRepairById(item.id) |
| | | if (code === 200 && data) { |
| | | attachmentList.value = Array.isArray(data.fileList) ? data.fileList : (Array.isArray(data.commonFileList) ? data.commonFileList : []) |
| | | showAttachmentDialog.value = true |
| | | } else { |
| | | showToast('è·åé件失败') |
| | | } |
| | | } catch (e) { |
| | | showToast('è·åé件失败') |
| | | } |
| | | } |
| | | |
| | | const closeAttachmentDialog = () => { |
| | | showAttachmentDialog.value = false |
| | | currentViewRepair.value = null |
| | | attachmentList.value = [] |
| | | } |
| | | |
| | | const previewAttachment = (file) => { |
| | | if (isImageFile(file)) { |
| | | const urls = attachmentList.value.filter((f) => isImageFile(f)).map((f) => formatFileUrl(f.url || f.downloadUrl)) |
| | | uni.previewImage({ |
| | | urls, |
| | | current: formatFileUrl(file.url || file.downloadUrl) |
| | | }) |
| | | } else { |
| | | currentVideoFile.value = file |
| | | showVideoDialog.value = true |
| | | } |
| | | } |
| | | |
| | | const closeVideoPreview = () => { |
| | | showVideoDialog.value = false |
| | | currentVideoFile.value = null |
| | | } |
| | | |
| | | const handleVideoError = () => { |
| | | uni.showToast({ title: 'è§é¢ææ¾å¤±è´¥', icon: 'none' }) |
| | | } |
| | | |
| | | // è¿åä¸ä¸é¡µ |
| | | const goBack = () => { |
| | |
| | | .action-buttons { |
| | | gap: 8px; // ä¸å
Œ
±æ ·å¼ä¸ç 12px ä¸å |
| | | } |
| | | |
| | | /* æ¥çéä»¶å¼¹çª */ |
| | | .custom-modal-overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background: rgba(0, 0, 0, 0.5); |
| | | z-index: 100; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 20px; |
| | | } |
| | | |
| | | .custom-modal-container { |
| | | width: 100%; |
| | | max-width: 500px; |
| | | max-height: 80vh; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .attachment-popup-content { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | width: 100%; |
| | | min-height: 300px; |
| | | max-height: 70vh; |
| | | overflow: hidden; |
| | | display: flex; |
| | | flex-direction: column; |
| | | box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); |
| | | } |
| | | |
| | | .attachment-popup-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 15px 20px; |
| | | border-bottom: 1px solid #eee; |
| | | background: #f8f9fa; |
| | | } |
| | | |
| | | .attachment-popup-title { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | color: #333; |
| | | } |
| | | |
| | | .close-btn-attachment { |
| | | width: 28px; |
| | | height: 28px; |
| | | border-radius: 50%; |
| | | background: #f5f5f5; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .attachment-popup-body { |
| | | flex: 1; |
| | | padding: 15px 20px; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .attachment-content { |
| | | min-height: 200px; |
| | | } |
| | | |
| | | .attachment-list { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 12px; |
| | | } |
| | | |
| | | .attachment-item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 8px; |
| | | border: 1px solid #e9ecef; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); |
| | | width: calc(33.33% - 8px); |
| | | min-width: 100px; |
| | | } |
| | | |
| | | .attachment-preview-container { |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | .attachment-preview { |
| | | width: 80px; |
| | | height: 80px; |
| | | border-radius: 8px; |
| | | object-fit: cover; |
| | | border: 2px solid #f0f0f0; |
| | | } |
| | | |
| | | .attachment-video-preview { |
| | | width: 80px; |
| | | height: 80px; |
| | | background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); |
| | | border-radius: 8px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border: 2px solid #f0f0f0; |
| | | } |
| | | |
| | | .attachment-info { |
| | | text-align: center; |
| | | width: 100%; |
| | | } |
| | | |
| | | .attachment-name { |
| | | font-size: 12px; |
| | | color: #333; |
| | | display: block; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | max-width: 80px; |
| | | } |
| | | |
| | | .attachment-size { |
| | | font-size: 10px; |
| | | color: #999; |
| | | margin-top: 2px; |
| | | display: block; |
| | | } |
| | | |
| | | .attachment-empty { |
| | | text-align: center; |
| | | padding: 60px 20px; |
| | | color: #999; |
| | | font-size: 14px; |
| | | background: #f8f9fa; |
| | | border-radius: 8px; |
| | | border: 2px dashed #ddd; |
| | | } |
| | | |
| | | /* è§é¢é¢è§å¼¹çª */ |
| | | .video-modal-overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background: rgba(0, 0, 0, 0.8); |
| | | z-index: 10001; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 20px; |
| | | } |
| | | |
| | | .video-modal-container { |
| | | width: 90%; |
| | | max-width: 800px; |
| | | max-height: 80vh; |
| | | background: #000; |
| | | border-radius: 12px; |
| | | overflow: hidden; |
| | | box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); |
| | | } |
| | | |
| | | .video-modal-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 15px 20px; |
| | | background: rgba(0, 0, 0, 0.7); |
| | | color: #fff; |
| | | } |
| | | |
| | | .video-modal-title { |
| | | font-size: 16px; |
| | | color: #fff; |
| | | } |
| | | |
| | | .close-btn-video { |
| | | width: 28px; |
| | | height: 28px; |
| | | border-radius: 50%; |
| | | background: rgba(255, 255, 255, 0.2); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .video-modal-body { |
| | | background: #000; |
| | | } |
| | | |
| | | .video-player { |
| | | width: 100%; |
| | | height: auto; |
| | | max-height: 60vh; |
| | | display: block; |
| | | } |
| | | |
| | | .video-text { |
| | | font-size: 12px; |
| | | color: #666; |
| | | margin-top: 4px; |
| | | } |
| | | </style> |
| | |
| | | <u-cell-group title="维修信æ¯" |
| | | inset> |
| | | <u-form-item prop="maintenanceName" |
| | | label="维修人" |
| | | label="æ¥ä¿®äºº" |
| | | required> |
| | | <u-input v-model="form.maintenanceName" |
| | | placeholder="请è¾å
¥ç»´ä¿®äºº" |
| | | placeholder="请è¾å
¥æ¥ä¿®äºº" |
| | | clearable /> |
| | | </u-form-item> |
| | | <u-form-item prop="maintenanceResult" |
| | |
| | | // 表åéªè¯è§å |
| | | const formRules = { |
| | | maintenanceName: [ |
| | | { required: true, trigger: "blur", message: "请è¾å
¥ç»´ä¿®äºº" }, |
| | | { required: true, trigger: "blur", message: "请è¾å
¥æ¥ä¿®äºº" }, |
| | | ], |
| | | maintenanceResult: [ |
| | | { required: true, trigger: "blur", message: "请è¾å
¥ç»´ä¿®ç»æ" }, |
| | |
| | | // åå§åè¡¨åæ°æ® |
| | | const initForm = () => { |
| | | form.value.status = "1"; |
| | | // 设置维修人为å½åç¨æ·æµç§° |
| | | // 设置æ¥ä¿®äººä¸ºå½åç¨æ·æµç§° |
| | | form.value.maintenanceName = userStore.nickName || ""; |
| | | // 设置å½åæ¥æï¼åªå
å«å¹´ææ¥ï¼ |
| | | form.value.maintenanceTime = dayjs().format("YYYY-MM-DD HH:mm:ss"); |
| | |
| | | <text class="detail-value">{{ task.faultDescription }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ¥ä¿®äºº</text> |
| | | <text class="detail-label">维修人</text> |
| | | <text class="detail-value">{{ task.reporterName }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | |
| | | <template> |
| | | <view class="sales-account"> |
| | | <!-- 使ç¨éç¨é¡µé¢å¤´é¨ç»ä»¶ --> |
| | | <view class="upkeep-page"> |
| | | <PageHeader title="设å¤ä¿å
»" |
| | | @back="goBack" /> |
| | | <!-- æç´¢åºå --> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <up-input class="search-text" |
| | | placeholder="请è¾å
¥è®¾å¤åç§°æç´¢" |
| | | v-model="searchKeyword" |
| | | @change="getList" |
| | | clearable /> |
| | | </view> |
| | | <view class="filter-button" |
| | | @click="getList"> |
| | | <up-icon name="search" |
| | | size="24" |
| | | color="#999"></up-icon> |
| | | <view class="toolbar"> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <up-input class="search-text" |
| | | placeholder="请è¾å
¥è®¾å¤åç§°æç´¢" |
| | | v-model="searchKeyword" |
| | | clearable /> |
| | | </view> |
| | | <view class="search-button" |
| | | @click="handleQuery"> |
| | | <up-icon name="search" |
| | | size="24" |
| | | color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="meta-bar"> |
| | | <text class="meta-text">å
± {{ total }} æ¡</text> |
| | | </view> |
| | | </view> |
| | | <!-- 设å¤ä¿å
»å表 --> |
| | | <view class="ledger-list" |
| | | v-if="upkeepList.length > 0"> |
| | | <view class="list-section"> |
| | | <view v-for="(item, index) in upkeepList" |
| | | :key="index"> |
| | | <view class="ledger-item" |
| | | @click="toggleSelection(item)"> |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="document-icon"> |
| | | <up-icon name="file-text" |
| | | size="16" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="item-id">设å¤åç§°ï¼{{ item.deviceName }}</text> |
| | | :key="item.id || index" |
| | | class="ledger-item"> |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="document-icon"> |
| | | <up-icon name="file-text" |
| | | size="14" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <view class="status-tag"> |
| | | <u-tag v-if="item.status === 1" |
| | | type="success">å®ç»</u-tag> |
| | | <u-tag v-if="item.status === 0" |
| | | type="warning">å¾
ä¿å
»</u-tag> |
| | | <u-tag v-if="item.status === 2" |
| | | type="error">失败</u-tag> |
| | | </view> |
| | | <text class="item-id">{{ item.deviceName || "--" }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <u-tag v-if="item.status === 1" |
| | | type="success">å®ç»</u-tag> |
| | | <u-tag v-if="item.status === 0" |
| | | type="warning">å¾
ä¿å
»</u-tag> |
| | | <u-tag v-if="item.status === 2" |
| | | type="error">失败</u-tag> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">è§æ ¼åå·</text> |
| | | <text class="detail-value">{{ item.deviceModel || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">计åä¿å
»æ¥æ</text> |
| | | <text class="detail-value">{{ formatDate(item.maintenancePlanTime) || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å½å
¥äºº</text> |
| | | <text class="detail-value">{{ item.createUserName || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å½å
¥æ¥æ</text> |
| | | <text class="detail-value">{{ formatDateTime(item.createTime) || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å®é
ä¿å
»äºº</text> |
| | | <text class="detail-value">{{ item.maintenanceActuallyName || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å®é
ä¿å
»æ¥æ</text> |
| | | <text class="detail-value">{{ formatDateTime(item.maintenanceActuallyTime) || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ä¿å
ȍȾ</text> |
| | | <text class="detail-value">{{ item.maintenanceResult || "--" }}</text> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">è§æ ¼åå·</text> |
| | | <text class="detail-value">{{ item.deviceModel || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">计åä¿å
»æ¥æ</text> |
| | | <text class="detail-value">{{ formatDate(item.maintenancePlanTime) || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å½å
¥äºº</text> |
| | | <text class="detail-value">{{ item.createUserName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å½å
¥æ¥æ</text> |
| | | <text class="detail-value">{{ formatDateTime(item.createTime) || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å®é
ä¿å
»äºº</text> |
| | | <text class="detail-value">{{ item.maintenanceActuallyName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å®é
ä¿å
»æ¥æ</text> |
| | | <text class="detail-value">{{ formatDateTime(item.maintenanceActuallyTime) || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ä¿å
ȍȾ</text> |
| | | <text class="detail-value">{{item.maintenanceResult || '-'}} |
| | | </text> |
| | | </view> |
| | | </view> |
| | | <!-- æé®åºå --> |
| | | <view class="action-buttons"> |
| | | <!-- <u-button type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | | :disabled="item.status === 1" |
| | | @click.stop="edit(item.id)"> |
| | | ç¼è¾ |
| | | </u-button> --> |
| | | <view class="card-actions"> |
| | | <u-button type="warning" |
| | | size="small" |
| | | class="action-btn" |
| | |
| | | @click.stop="viewDetail(item)"> |
| | | 详æ
|
| | | </u-button> |
| | | <!-- <u-button type="warning" |
| | | size="small" |
| | | class="action-btn" |
| | | @click.stop="addFile(item.id)"> |
| | | éä»¶ |
| | | </u-button> --> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-if="!loading && upkeepList.length === 0" |
| | | class="no-data"> |
| | | <text>ææ è®¾å¤ä¿å
»æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | <view v-else |
| | | class="no-data"> |
| | | <text>ææ è®¾å¤ä¿å
»æ°æ®</text> |
| | | </view> |
| | | <!-- æµ®å¨æ°å¢æé® --> |
| | | <view class="fab-button" |
| | | @click="addPlan"> |
| | | <up-icon name="plus" |
| | |
| | | // 设å¤ä¿å
»æ°æ® |
| | | const upkeepList = ref([]); |
| | | |
| | | // å¤éå表 |
| | | const total = ref(0); |
| | | const loading = ref(false); |
| | | |
| | | // å¤éå表ï¼ä¿å
»æé®æªä¼ id æ¶ç¨ï¼ |
| | | const multipleList = ref([]); |
| | | |
| | | // è¿åä¸ä¸é¡µ |
| | |
| | | return dayjs(dateStr).format("YYYY-MM-DD HH:mm:ss"); |
| | | }; |
| | | |
| | | const handleQuery = () => { |
| | | getList(); |
| | | }; |
| | | |
| | | // æ¥è¯¢å表 |
| | | const getList = () => { |
| | | showLoadingToast("å è½½ä¸..."); |
| | | loading.value = true; |
| | | const params = { |
| | | current: -1, |
| | | size: -1, |
| | |
| | | }; |
| | | getUpkeepPage(params) |
| | | .then(res => { |
| | | // 妿res.data䏿¯æ°ç»ï¼è®¾ç½®ä¸ºç©ºæ°ç» |
| | | upkeepList.value = res.records || res.data?.records || []; |
| | | closeToast(); |
| | | const records = res?.records ?? res?.data?.records ?? []; |
| | | upkeepList.value = records; |
| | | total.value = Array.isArray(records) ? records.length : Number(res?.total ?? res?.data?.total ?? 0); |
| | | }) |
| | | .catch(() => { |
| | | closeToast(); |
| | | upkeepList.value = []; |
| | | showToast("è·åæ°æ®å¤±è´¥"); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | // æ°å¢éä»¶ - 跳转å°éä»¶é¡µé¢ |
| | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/styles/sales-common.scss"; |
| | | |
| | | // 设å¤ä¿å
»ç¹ææ ·å¼ |
| | | .sales-account { |
| | | padding-bottom: 80px; // ä¸ºæµ®å¨æé®çåºç©ºé´ |
| | | .upkeep-page { |
| | | min-height: 100vh; |
| | | background: #f6f7fb; |
| | | } |
| | | |
| | | .action-section { |
| | | padding: 10px 20px; |
| | | .toolbar { |
| | | padding: 20rpx 24rpx; |
| | | background: #fff; |
| | | border-bottom: 1rpx solid #f0f0f0; |
| | | position: sticky; |
| | | top: 0; |
| | | z-index: 10; |
| | | } |
| | | |
| | | .search-section { |
| | | margin-top: 0; |
| | | } |
| | | |
| | | .search-bar { |
| | | display: flex; |
| | | align-items: center; |
| | | background: #f7f8fa; |
| | | border-radius: 14rpx; |
| | | padding: 8rpx 12rpx 8rpx 16rpx; |
| | | border: 1rpx solid #eef1f5; |
| | | } |
| | | |
| | | .search-input { |
| | | flex: 1; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .search-text { |
| | | background: transparent !important; |
| | | } |
| | | |
| | | :deep(.search-text .u-input__content), |
| | | :deep(.search-text .up-input__content) { |
| | | background: transparent !important; |
| | | padding: 0 !important; |
| | | } |
| | | |
| | | .search-button { |
| | | width: 64rpx; |
| | | height: 64rpx; |
| | | border-radius: 12rpx; |
| | | background: #ffffff; |
| | | border-bottom: 1px solid #f0f0f0; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .action-section .action-buttons { |
| | | gap: 8px; // ä¸å
Œ
±æ ·å¼ä¸ç 12px ä¸å |
| | | justify-content: flex-start; |
| | | .meta-bar { |
| | | margin-top: 16rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | background: #f7f9fc; |
| | | border-radius: 12rpx; |
| | | padding: 10rpx 16rpx; |
| | | } |
| | | |
| | | .checkbox-wrapper { |
| | | .meta-text { |
| | | color: #5c6b8a; |
| | | font-size: 22rpx; |
| | | } |
| | | |
| | | .list-section { |
| | | padding: 20rpx 24rpx; |
| | | padding-bottom: calc(132rpx + env(safe-area-inset-bottom)); |
| | | } |
| | | |
| | | .ledger-item { |
| | | background: #ffffff; |
| | | border-radius: 20rpx; |
| | | margin-bottom: 16rpx; |
| | | overflow: hidden; |
| | | box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.05); |
| | | padding: 0 20rpx; |
| | | } |
| | | |
| | | .item-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 22rpx 0; |
| | | } |
| | | |
| | | .item-left { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 10rpx; |
| | | flex: 1; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .item-right { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .status-tag { |
| | | .document-icon { |
| | | width: 38rpx; |
| | | height: 38rpx; |
| | | border-radius: 8rpx; |
| | | background: #2979ff; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .item-id { |
| | | font-size: 28rpx; |
| | | color: #1f1f1f; |
| | | font-weight: 600; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .item-details { |
| | | padding: 18rpx 0 20rpx; |
| | | } |
| | | |
| | | .detail-row { |
| | | display: flex; |
| | | align-items: flex-end; |
| | | justify-content: space-between; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | |
| | | .detail-label { |
| | | min-width: 80px; // ä¸å
Œ
±æ ·å¼ä¸ç 60px ä¸å |
| | | min-width: 160rpx; |
| | | color: #777; |
| | | font-size: 24rpx; |
| | | } |
| | | |
| | | .detail-value { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | flex: 1; |
| | | color: #333; |
| | | font-size: 24rpx; |
| | | text-align: right; |
| | | word-break: break-all; |
| | | margin-left: 12rpx; |
| | | } |
| | | |
| | | .ledger-item .action-buttons { |
| | | gap: 8px; // ä¸å
Œ
±æ ·å¼ä¸ç 12px ä¸å |
| | | .card-actions { |
| | | padding-top: 8rpx; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | flex-wrap: wrap; |
| | | gap: 12rpx; |
| | | } |
| | | |
| | | .action-btn { |
| | | min-width: 100rpx; |
| | | } |
| | | |
| | | .fab-button { |
| | | position: fixed; |
| | | bottom: calc(30px + env(safe-area-inset-bottom)); |
| | | right: 30px; |
| | | width: 56px; |
| | | height: 56px; |
| | | background: #2979ff; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3); |
| | | z-index: 1000; |
| | | } |
| | | |
| | | .no-data { |
| | | padding: 40rpx 0; |
| | | text-align: center; |
| | | color: #999; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <u-popup :show="dialogVisitable" |
| | | mode="center" |
| | | :round="12" |
| | | :zIndex="900" |
| | | @close="cancel"> |
| | | <view class="popup-content"> |
| | | <view class="popup-title">{{ operationType === "add" ? "æ°å¢ä¿å
»ä»»å¡" : "ç¼è¾ä¿å
»ä»»å¡" }}</view> |
| | | <view class="form-body"> |
| | | <view class="form-item"> |
| | | <text class="label">ä»»å¡åç§°</text> |
| | | <up-input v-model="form.taskName" |
| | | placeholder="请è¾å
¥ä»»å¡åç§°" |
| | | border="none" |
| | | customStyle="background: #f7f8fa; padding: 0 20rpx; min-height: 72rpx; border-radius: 12rpx;" /> |
| | | </view> |
| | | <view class="form-item"> |
| | | <text class="label">设å¤</text> |
| | | <view class="picker-value inspector-picker" |
| | | @click="openDevicePopup"> |
| | | <text>{{ deviceNamesText || "è¯·éæ©è®¾å¤" }}</text> |
| | | <u-icon name="arrow-right" |
| | | size="14" |
| | | color="#999" /> |
| | | </view> |
| | | <view class="inspector-tags" |
| | | v-if="form.deviceIds?.length"> |
| | | <view v-for="id in form.deviceIds" |
| | | :key="id" |
| | | class="inspector-tag" |
| | | @click="toggleDevice(id)"> |
| | | <text>{{ getDeviceName(id) }}</text> |
| | | <u-icon name="close" |
| | | size="11" |
| | | color="#1677ff" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="form-item"> |
| | | <text class="label">å½å
¥äºº</text> |
| | | <picker mode="selector" |
| | | :range="userList" |
| | | range-key="nickName" |
| | | :value="inspectorIndex" |
| | | @change="onInspectorChange"> |
| | | <view class="picker-value">{{ form.registrant || "è¯·éæ©å½å
¥äºº" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item"> |
| | | <text class="label">ç»è®°æ¶é´</text> |
| | | <picker mode="date" |
| | | :value="form.registrationDate || todayStr" |
| | | @change="onRegistrationDateChange"> |
| | | <view class="picker-value">{{ form.registrationDate || "è¯·éæ©ç»è®°æ¶é´" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item"> |
| | | <text class="label">ä»»å¡é¢ç</text> |
| | | <picker mode="selector" |
| | | :range="frequencyOptions" |
| | | range-key="label" |
| | | :value="frequencyIndex" |
| | | @change="onFrequencyChange"> |
| | | <view class="picker-value">{{ currentFrequencyLabel || "è¯·éæ©ä»»å¡é¢ç" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item" |
| | | v-if="form.frequencyType === 'DAILY'"> |
| | | <text class="label">æ¶é´</text> |
| | | <picker mode="time" |
| | | :value="form.frequencyDetail || '08:00'" |
| | | @change="onDailyTimeChange"> |
| | | <view class="picker-value">{{ form.frequencyDetail || "è¯·éæ©æ¶é´" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item" |
| | | v-if="form.frequencyType === 'WEEKLY'"> |
| | | <text class="label">æ¯å¨æ¥æ</text> |
| | | <picker mode="selector" |
| | | :range="weekOptions" |
| | | range-key="label" |
| | | :value="weekIndex" |
| | | @change="onWeekChange"> |
| | | <view class="picker-value">{{ currentWeekLabel || "è¯·éæ©ææ" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item" |
| | | v-if="form.frequencyType === 'WEEKLY'"> |
| | | <text class="label">æ¯å¨æ¶é´</text> |
| | | <picker mode="time" |
| | | :value="form.time || '08:00'" |
| | | @change="onWeekTimeChange"> |
| | | <view class="picker-value">{{ form.time || "è¯·éæ©æ¶é´" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item" |
| | | v-if="form.frequencyType === 'MONTHLY'"> |
| | | <text class="label">æ¯ææ¥æä¸æ¶é´</text> |
| | | <picker mode="date" |
| | | fields="day" |
| | | :value="monthlyDate" |
| | | @change="onMonthlyDateChange"> |
| | | <view class="picker-value">{{ monthlyDate || "è¯·éæ©æ¥æ" }}</view> |
| | | </picker> |
| | | <picker mode="time" |
| | | :value="monthlyTime" |
| | | @change="onMonthlyTimeChange"> |
| | | <view class="picker-value">{{ monthlyTime || "è¯·éæ©æ¶é´" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item" |
| | | v-if="form.frequencyType === 'QUARTERLY'"> |
| | | <text class="label">å£åº¦æ¥æä¸æ¶é´</text> |
| | | <picker mode="date" |
| | | :value="quarterlyDate" |
| | | @change="onQuarterlyDateChange"> |
| | | <view class="picker-value">{{ quarterlyDate || "è¯·éæ©æ¥æ" }}</view> |
| | | </picker> |
| | | <picker mode="time" |
| | | :value="quarterlyTime" |
| | | @change="onQuarterlyTimeChange"> |
| | | <view class="picker-value">{{ quarterlyTime || "è¯·éæ©æ¶é´" }}</view> |
| | | </picker> |
| | | </view> |
| | | <view class="form-item"> |
| | | <text class="label">夿³¨</text> |
| | | <u-textarea v-model="form.remarks" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | :height="80" |
| | | count /> |
| | | </view> |
| | | </view> |
| | | <view class="popup-footer"> |
| | | <u-button @click="cancel">åæ¶</u-button> |
| | | <u-button type="primary" |
| | | @click="submitForm">ä¿å</u-button> |
| | | </view> |
| | | </view> |
| | | </u-popup> |
| | | <u-popup :show="showDevicePopup" |
| | | mode="bottom" |
| | | :round="16" |
| | | :zIndex="1100" |
| | | @close="closeDevicePopup"> |
| | | <view class="inspector-popup"> |
| | | <view class="inspector-header"> |
| | | <text class="inspector-title">éæ©è®¾å¤</text> |
| | | </view> |
| | | <scroll-view scroll-y |
| | | class="inspector-list"> |
| | | <view v-for="item in deviceOptions" |
| | | :key="item.id" |
| | | class="inspector-row" |
| | | @click="toggleDevice(item.id)"> |
| | | <text class="inspector-name">{{ item.deviceName }}</text> |
| | | <u-icon v-if="(form.deviceIds || []).includes(item.id)" |
| | | name="checkmark-circle-fill" |
| | | color="#1677ff" |
| | | size="20" /> |
| | | <u-icon v-else |
| | | name="" |
| | | color="#d5d8de" |
| | | size="20" /> |
| | | </view> |
| | | </scroll-view> |
| | | <view class="inspector-footer"> |
| | | <u-button @click="closeDevicePopup">ç¡®å®</u-button> |
| | | </view> |
| | | </view> |
| | | </u-popup> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, reactive, ref } from "vue"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { |
| | | deviceMaintenanceTaskAdd, |
| | | deviceMaintenanceTaskEdit, |
| | | } from "@/api/equipmentManagement/upkeep.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { getDeviceLedger } from "@/api/equipmentManagement/ledger.js"; |
| | | |
| | | const emit = defineEmits(["closeDia"]); |
| | | const userStore = useUserStore(); |
| | | const dialogVisitable = ref(false); |
| | | const operationType = ref("add"); |
| | | const deviceOptions = ref([]); |
| | | const userList = ref([]); |
| | | const showDevicePopup = ref(false); |
| | | |
| | | const todayStr = ref(""); |
| | | try { |
| | | const d = new Date(); |
| | | todayStr.value = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`; |
| | | } catch (e) {} |
| | | |
| | | const defaultForm = () => ({ |
| | | id: undefined, |
| | | taskName: "", |
| | | deviceIds: [], |
| | | registrantId: undefined, |
| | | registrant: "", |
| | | registrationDate: "", |
| | | remarks: "", |
| | | frequencyType: "", |
| | | frequencyDetail: "", |
| | | week: "", |
| | | time: "", |
| | | }); |
| | | |
| | | const form = reactive(defaultForm()); |
| | | |
| | | const frequencyOptions = [ |
| | | { label: "æ¯æ¥", value: "DAILY" }, |
| | | { label: "æ¯å¨", value: "WEEKLY" }, |
| | | { label: "æ¯æ", value: "MONTHLY" }, |
| | | { label: "å£åº¦", value: "QUARTERLY" }, |
| | | ]; |
| | | |
| | | const weekOptions = [ |
| | | { label: "å¨ä¸", value: "MON" }, |
| | | { label: "å¨äº", value: "TUE" }, |
| | | { label: "å¨ä¸", value: "WED" }, |
| | | { label: "å¨å", value: "THU" }, |
| | | { label: "å¨äº", value: "FRI" }, |
| | | { label: "å¨å
", value: "SAT" }, |
| | | { label: "卿¥", value: "SUN" }, |
| | | ]; |
| | | |
| | | const monthlyDate = ref(""); |
| | | const monthlyTime = ref(""); |
| | | const quarterlyDate = ref(""); |
| | | const quarterlyTime = ref(""); |
| | | |
| | | const frequencyIndex = computed(() => { |
| | | const index = frequencyOptions.findIndex(item => item.value === form.frequencyType); |
| | | return index >= 0 ? index : 0; |
| | | }); |
| | | |
| | | const weekIndex = computed(() => { |
| | | const index = weekOptions.findIndex(item => item.value === form.week); |
| | | return index >= 0 ? index : 0; |
| | | }); |
| | | |
| | | const currentFrequencyLabel = computed(() => { |
| | | return frequencyOptions.find(item => item.value === form.frequencyType)?.label || ""; |
| | | }); |
| | | |
| | | const currentWeekLabel = computed(() => { |
| | | return weekOptions.find(item => item.value === form.week)?.label || ""; |
| | | }); |
| | | |
| | | const inspectorIndex = computed(() => { |
| | | const index = userList.value.findIndex(item => String(item.userId) === String(form.registrantId)); |
| | | return index >= 0 ? index : 0; |
| | | }); |
| | | |
| | | const deviceNamesText = computed(() => { |
| | | if (!form.deviceIds?.length) return ""; |
| | | return form.deviceIds |
| | | .map(id => getDeviceName(id)) |
| | | .filter(Boolean) |
| | | .join("ã"); |
| | | }); |
| | | |
| | | function getDeviceName(id) { |
| | | const d = deviceOptions.value.find(item => String(item.id) === String(id)); |
| | | return d?.deviceName || ""; |
| | | } |
| | | |
| | | const resetForm = () => { |
| | | Object.assign(form, defaultForm()); |
| | | monthlyDate.value = ""; |
| | | monthlyTime.value = ""; |
| | | quarterlyDate.value = ""; |
| | | quarterlyTime.value = ""; |
| | | showDevicePopup.value = false; |
| | | }; |
| | | |
| | | const normalizeIdList = val => { |
| | | if (!val) return []; |
| | | if (Array.isArray(val)) return val.map(v => (Number.isNaN(Number(v)) ? v : Number(v))); |
| | | if (typeof val === "string") { |
| | | const s = val.trim(); |
| | | if (s.startsWith("[") && s.endsWith("]")) { |
| | | try { |
| | | const arr = JSON.parse(s); |
| | | return Array.isArray(arr) ? arr : []; |
| | | } catch { |
| | | return []; |
| | | } |
| | | } |
| | | return s.split(",").map(v => v.trim()).filter(Boolean).map(v => (Number.isNaN(Number(v)) ? v : Number(v))); |
| | | } |
| | | return []; |
| | | }; |
| | | |
| | | const parseWeeklyDetail = detail => { |
| | | if (!detail || typeof detail !== "string" || !detail.includes(",")) return; |
| | | const [week, time] = detail.split(","); |
| | | form.week = week || ""; |
| | | form.time = time || ""; |
| | | }; |
| | | |
| | | const parseMonthlyDetail = detail => { |
| | | if (!detail || typeof detail !== "string" || !detail.includes(",")) return; |
| | | const [day, time] = detail.split(","); |
| | | if (day) { |
| | | const y = new Date().getFullYear(); |
| | | const m = new Date().getMonth() + 1; |
| | | monthlyDate.value = `${y}-${String(m).padStart(2, "0")}-${String(day).padStart(2, "0")}`; |
| | | } |
| | | if (time) monthlyTime.value = time; |
| | | }; |
| | | |
| | | const parseQuarterlyDetail = detail => { |
| | | if (!detail || typeof detail !== "string") return; |
| | | const parts = detail.split(","); |
| | | if (parts.length >= 3) { |
| | | const [mm, dd, time] = parts; |
| | | const y = new Date().getFullYear(); |
| | | quarterlyDate.value = `${y}-${String(mm).padStart(2, "0")}-${String(dd).padStart(2, "0")}`; |
| | | quarterlyTime.value = time || ""; |
| | | } |
| | | }; |
| | | |
| | | const openDialog = async (type, row) => { |
| | | operationType.value = type; |
| | | dialogVisitable.value = true; |
| | | resetForm(); |
| | | try { |
| | | const [userRes, deviceRes] = await Promise.all([ |
| | | userListNoPageByTenantId(), |
| | | getDeviceLedger(), |
| | | ]); |
| | | userList.value = userRes?.data || []; |
| | | deviceOptions.value = deviceRes?.data || []; |
| | | if (type === "edit" && row) { |
| | | Object.assign(form, { |
| | | ...defaultForm(), |
| | | ...row, |
| | | deviceIds: normalizeIdList(row.deviceIds ?? row.taskIds ?? row.deviceIds), |
| | | }); |
| | | if (!form.registrationDate && row.registrationDate) form.registrationDate = row.registrationDate; |
| | | if (row.registrantId) form.registrantId = row.registrantId; |
| | | if (row.registrant) form.registrant = row.registrant; |
| | | if (form.frequencyType === "WEEKLY") parseWeeklyDetail(form.frequencyDetail); |
| | | if (form.frequencyType === "MONTHLY") parseMonthlyDetail(form.frequencyDetail); |
| | | if (form.frequencyType === "QUARTERLY") parseQuarterlyDetail(form.frequencyDetail); |
| | | } else { |
| | | form.registrationDate = todayStr.value; |
| | | const userInfo = await userStore.getInfo(); |
| | | if (userInfo?.user?.userId) { |
| | | form.registrantId = userInfo.user.userId; |
| | | form.registrant = userInfo.user.nickName || userInfo.user.userName || ""; |
| | | } |
| | | } |
| | | } catch (error) { |
| | | uni.showToast({ |
| | | title: "åå§å失败", |
| | | icon: "none", |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const openDevicePopup = () => { |
| | | showDevicePopup.value = true; |
| | | }; |
| | | |
| | | const closeDevicePopup = () => { |
| | | showDevicePopup.value = false; |
| | | }; |
| | | |
| | | const toggleDevice = id => { |
| | | const ids = form.deviceIds || []; |
| | | if (ids.includes(id)) { |
| | | form.deviceIds = ids.filter(i => i !== id); |
| | | } else { |
| | | form.deviceIds = [...ids, id]; |
| | | } |
| | | }; |
| | | |
| | | const onInspectorChange = e => { |
| | | const index = Number(e?.detail?.value ?? 0); |
| | | const user = userList.value[index]; |
| | | if (user) { |
| | | form.registrantId = user.userId; |
| | | form.registrant = user.nickName || ""; |
| | | } |
| | | }; |
| | | |
| | | const onRegistrationDateChange = e => { |
| | | form.registrationDate = e?.detail?.value || ""; |
| | | }; |
| | | |
| | | const onFrequencyChange = e => { |
| | | const index = Number(e?.detail?.value ?? 0); |
| | | const selected = frequencyOptions[index]; |
| | | form.frequencyType = selected?.value || ""; |
| | | form.frequencyDetail = ""; |
| | | form.week = ""; |
| | | form.time = ""; |
| | | monthlyDate.value = ""; |
| | | monthlyTime.value = ""; |
| | | quarterlyDate.value = ""; |
| | | quarterlyTime.value = ""; |
| | | }; |
| | | |
| | | const onDailyTimeChange = e => { |
| | | form.frequencyDetail = e?.detail?.value || ""; |
| | | }; |
| | | |
| | | const onWeekChange = e => { |
| | | const index = Number(e?.detail?.value ?? 0); |
| | | const selected = weekOptions[index]; |
| | | form.week = selected?.value || ""; |
| | | }; |
| | | |
| | | const onWeekTimeChange = e => { |
| | | form.time = e?.detail?.value || ""; |
| | | }; |
| | | |
| | | const onMonthlyDateChange = e => { |
| | | monthlyDate.value = e?.detail?.value || ""; |
| | | }; |
| | | |
| | | const onMonthlyTimeChange = e => { |
| | | monthlyTime.value = e?.detail?.value || ""; |
| | | }; |
| | | |
| | | const onQuarterlyDateChange = e => { |
| | | quarterlyDate.value = e?.detail?.value || ""; |
| | | }; |
| | | |
| | | const onQuarterlyTimeChange = e => { |
| | | quarterlyTime.value = e?.detail?.value || ""; |
| | | }; |
| | | |
| | | const validateForm = () => { |
| | | if (!form.taskName?.trim()) { |
| | | uni.showToast({ title: "请è¾å
¥ä»»å¡åç§°", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (!form.deviceIds?.length) { |
| | | uni.showToast({ title: "è¯·éæ©è®¾å¤", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (!form.registrantId && !form.registrant) { |
| | | uni.showToast({ title: "è¯·éæ©å½å
¥äºº", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (!form.registrationDate) { |
| | | uni.showToast({ title: "è¯·éæ©ç»è®°æ¶é´", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (!form.frequencyType) { |
| | | uni.showToast({ title: "è¯·éæ©ä»»å¡é¢ç", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (form.frequencyType === "DAILY" && !form.frequencyDetail) { |
| | | uni.showToast({ title: "è¯·éæ©æ¶é´", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (form.frequencyType === "WEEKLY" && (!form.week || !form.time)) { |
| | | uni.showToast({ title: "è¯·éæ©æ¯å¨æ¥æåæ¶é´", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (form.frequencyType === "MONTHLY" && (!monthlyDate.value || !monthlyTime.value)) { |
| | | uni.showToast({ title: "è¯·éæ©æ¯ææ¥æåæ¶é´", icon: "none" }); |
| | | return false; |
| | | } |
| | | if (form.frequencyType === "QUARTERLY" && (!quarterlyDate.value || !quarterlyTime.value)) { |
| | | uni.showToast({ title: "è¯·éæ©å£åº¦æ¥æåæ¶é´", icon: "none" }); |
| | | return false; |
| | | } |
| | | return true; |
| | | }; |
| | | |
| | | const buildFrequencyDetail = () => { |
| | | if (form.frequencyType === "WEEKLY") return `${form.week},${form.time}`; |
| | | if (form.frequencyType === "MONTHLY") { |
| | | const day = monthlyDate.value.split("-")[2] || ""; |
| | | return `${day},${monthlyTime.value}`; |
| | | } |
| | | if (form.frequencyType === "QUARTERLY") { |
| | | const [y, m, d] = (quarterlyDate.value || "").split("-"); |
| | | return `${m},${d},${quarterlyTime.value}`; |
| | | } |
| | | return form.frequencyDetail || ""; |
| | | }; |
| | | |
| | | const submitForm = async () => { |
| | | if (!validateForm()) return; |
| | | try { |
| | | const payload = { |
| | | id: form.id, |
| | | taskName: form.taskName.trim(), |
| | | deviceIds: JSON.stringify(form.deviceIds || []), |
| | | registrantId: form.registrantId, |
| | | registrant: form.registrant, |
| | | registrationDate: form.registrationDate, |
| | | frequencyType: form.frequencyType, |
| | | frequencyDetail: buildFrequencyDetail(), |
| | | remarks: form.remarks || "", |
| | | status: "0", |
| | | active: true, |
| | | deleted: 0, |
| | | }; |
| | | if (operationType.value === "edit" && form.id) { |
| | | await deviceMaintenanceTaskEdit(payload); |
| | | } else { |
| | | delete payload.id; |
| | | await deviceMaintenanceTaskAdd(payload); |
| | | } |
| | | uni.showToast({ |
| | | title: "æäº¤æå", |
| | | icon: "success", |
| | | }); |
| | | cancel(); |
| | | } catch (error) { |
| | | uni.showToast({ |
| | | title: "æäº¤å¤±è´¥ï¼è¯·éè¯", |
| | | icon: "none", |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const cancel = () => { |
| | | dialogVisitable.value = false; |
| | | resetForm(); |
| | | emit("closeDia"); |
| | | }; |
| | | |
| | | defineExpose({ openDialog }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | :deep(.uni-picker-container) { |
| | | z-index: 1200 !important; |
| | | } |
| | | |
| | | .popup-content { |
| | | width: 88vw; |
| | | max-height: 80vh; |
| | | background: #fff; |
| | | border-radius: 20rpx; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .popup-title { |
| | | text-align: center; |
| | | font-size: 32rpx; |
| | | color: #1f1f1f; |
| | | font-weight: 600; |
| | | padding: 24rpx 20rpx; |
| | | border-bottom: 1rpx solid #f0f0f0; |
| | | } |
| | | |
| | | .form-body { |
| | | padding: 24rpx; |
| | | max-height: 56vh; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .form-item { |
| | | margin-bottom: 20rpx; |
| | | } |
| | | |
| | | .label { |
| | | display: block; |
| | | margin-bottom: 10rpx; |
| | | font-size: 24rpx; |
| | | color: #666; |
| | | } |
| | | |
| | | .picker-value { |
| | | min-height: 72rpx; |
| | | background: #f7f8fa; |
| | | border-radius: 12rpx; |
| | | padding: 0 20rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | color: #333; |
| | | font-size: 26rpx; |
| | | } |
| | | |
| | | .inspector-picker { |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .inspector-tags { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | margin-top: 10rpx; |
| | | gap: 10rpx; |
| | | } |
| | | |
| | | .inspector-tag { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8rpx; |
| | | background: #edf3ff; |
| | | color: #1677ff; |
| | | font-size: 22rpx; |
| | | border-radius: 999rpx; |
| | | padding: 6rpx 14rpx; |
| | | } |
| | | |
| | | .popup-footer { |
| | | display: flex; |
| | | gap: 16rpx; |
| | | padding: 20rpx 24rpx 24rpx; |
| | | border-top: 1rpx solid #f0f0f0; |
| | | } |
| | | |
| | | .inspector-popup { |
| | | background: #fff; |
| | | border-radius: 24rpx 24rpx 0 0; |
| | | overflow: hidden; |
| | | max-height: 70vh; |
| | | padding-bottom: env(safe-area-inset-bottom); |
| | | } |
| | | |
| | | .inspector-header { |
| | | padding: 24rpx; |
| | | text-align: center; |
| | | border-bottom: 1rpx solid #f0f0f0; |
| | | } |
| | | |
| | | .inspector-title { |
| | | color: #1f1f1f; |
| | | font-size: 30rpx; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .inspector-list { |
| | | max-height: 46vh; |
| | | padding: 0 24rpx; |
| | | } |
| | | |
| | | .inspector-row { |
| | | min-height: 82rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | border-bottom: 1rpx solid #f5f5f5; |
| | | } |
| | | |
| | | .inspector-name { |
| | | font-size: 26rpx; |
| | | color: #333; |
| | | } |
| | | |
| | | .inspector-footer { |
| | | display: flex; |
| | | gap: 16rpx; |
| | | padding: 20rpx 24rpx 24rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="upkeep-task-page"> |
| | | <PageHeader title="宿¶ä»»å¡ç®¡ç" |
| | | @back="goBack" /> |
| | | <view class="toolbar"> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <up-input class="search-text" |
| | | placeholder="请è¾å
¥ä¿å
»ä»»å¡åç§°" |
| | | v-model="queryParams.taskName" |
| | | clearable /> |
| | | </view> |
| | | <view class="search-button" |
| | | @click="handleQuery"> |
| | | <up-icon name="search" |
| | | size="24" |
| | | color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="meta-bar"> |
| | | <text class="meta-text">å
± {{ total }} æ¡</text> |
| | | </view> |
| | | </view> |
| | | <view class="list-section"> |
| | | <uni-swipe-action> |
| | | <uni-swipe-action-item v-for="item in tableData" |
| | | :key="item.id" |
| | | :right-options="swipeOptions" |
| | | @click="onSwipeActionClick($event, item)"> |
| | | <view class="ledger-item"> |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="document-icon"> |
| | | <up-icon name="file-text" |
| | | size="14" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="item-id">{{ item.taskName || "--" }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <u-tag :type="getFrequencyTagType(item.frequencyType)" |
| | | :text="formatFrequency(item.frequencyType) || 'æªç¥é¢æ¬¡'" /> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ä»»å¡ç¼å·</text> |
| | | <text class="detail-value">{{ item.id || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">设å¤</text> |
| | | <text class="detail-value">{{ item.deviceName || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å¼å§æ¥æä¸æ¶é´</text> |
| | | <text class="detail-value highlight">{{ formatFrequencyDetail(item.frequencyDetail) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ç»è®°äºº</text> |
| | | <text class="detail-value">{{ item.registrant || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ç»è®°æ¥æ</text> |
| | | <text class="detail-value">{{ item.registrationDate || item.createTime || "--" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">夿³¨</text> |
| | | <text class="detail-value">{{ item.remarks || "æ " }}</text> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="card-actions"> |
| | | <u-button type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | | @click.stop="handleAdd(item)">ç¼è¾</u-button> |
| | | <u-button type="error" |
| | | size="small" |
| | | plain |
| | | class="action-btn" |
| | | @click.stop="deleteOne(item)">å é¤</u-button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </uni-swipe-action-item> |
| | | </uni-swipe-action> |
| | | <uni-load-more :status="loadMoreStatus"></uni-load-more> |
| | | <view v-if="!loading && tableData.length === 0" |
| | | class="no-data"> |
| | | <text>ææ æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | <view class="fab-button" |
| | | @click="handleAdd()"> |
| | | <up-icon name="plus" |
| | | size="24" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <form-dia ref="formDia" |
| | | @closeDia="handleQuery" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, nextTick } from "vue"; |
| | | import { onShow, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FormDia from "@/pages/equipmentManagement/upkeepTask/components/formDia.vue"; |
| | | import { |
| | | deviceMaintenanceTaskDel, |
| | | deviceMaintenanceTaskList, |
| | | } from "@/api/equipmentManagement/upkeep.js"; |
| | | |
| | | const formDia = ref(); |
| | | const queryParams = reactive({ |
| | | taskName: "", |
| | | }); |
| | | const pageParams = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }); |
| | | const total = ref(0); |
| | | const loading = ref(false); |
| | | const tableData = ref([]); |
| | | const swipeOptions = [ |
| | | { |
| | | text: "å é¤", |
| | | style: { |
| | | backgroundColor: "#ee0a24", |
| | | }, |
| | | }, |
| | | ]; |
| | | |
| | | const noMore = computed(() => tableData.value.length >= total.value); |
| | | const loadMoreStatus = computed(() => { |
| | | if (loading.value) return "loading"; |
| | | if (noMore.value) return "noMore"; |
| | | return "more"; |
| | | }); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const formatFrequency = value => { |
| | | if (value === "DAILY") return "æ¯æ¥"; |
| | | if (value === "WEEKLY") return "æ¯å¨"; |
| | | if (value === "MONTHLY") return "æ¯æ"; |
| | | if (value === "QUARTERLY") return "å£åº¦"; |
| | | return ""; |
| | | }; |
| | | |
| | | const getFrequencyTagType = value => { |
| | | if (value === "DAILY") return "success"; |
| | | if (value === "WEEKLY") return "primary"; |
| | | if (value === "MONTHLY") return "warning"; |
| | | return "info"; |
| | | }; |
| | | |
| | | const formatFrequencyDetail = value => { |
| | | if (!value || typeof value !== "string") return "--"; |
| | | return value.replace( |
| | | /MON|TUE|WED|THU|FRI|SAT|SUN/g, |
| | | item => |
| | | ({ |
| | | MON: "å¨ä¸", |
| | | TUE: "å¨äº", |
| | | WED: "å¨ä¸", |
| | | THU: "å¨å", |
| | | FRI: "å¨äº", |
| | | SAT: "å¨å
", |
| | | SUN: "卿¥", |
| | | })[item] || item |
| | | ); |
| | | }; |
| | | |
| | | const getList = async () => { |
| | | if (loading.value) return; |
| | | loading.value = true; |
| | | try { |
| | | const params = { |
| | | ...queryParams, |
| | | current: pageParams.current, |
| | | size: pageParams.size, |
| | | }; |
| | | const res = await deviceMaintenanceTaskList(params); |
| | | const records = res?.data?.records || res?.records || []; |
| | | if (pageParams.current === 1) { |
| | | tableData.value = records; |
| | | } else { |
| | | tableData.value = [...tableData.value, ...records]; |
| | | } |
| | | total.value = Number(res?.data?.total ?? res?.total ?? 0); |
| | | } catch (error) { |
| | | if (pageParams.current === 1) { |
| | | tableData.value = []; |
| | | } |
| | | uni.showToast({ |
| | | title: "è·åæ°æ®å¤±è´¥", |
| | | icon: "none", |
| | | }); |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | const handleQuery = () => { |
| | | pageParams.current = 1; |
| | | total.value = 0; |
| | | getList(); |
| | | }; |
| | | |
| | | const loadMore = () => { |
| | | if (loading.value || noMore.value) return; |
| | | pageParams.current += 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const handleAdd = row => { |
| | | nextTick(() => { |
| | | formDia.value?.openDialog(row ? "edit" : "add", row); |
| | | }); |
| | | }; |
| | | |
| | | const deleteOne = async row => { |
| | | if (!row?.id) return; |
| | | const canDelete = await new Promise(resolve => { |
| | | uni.showModal({ |
| | | title: "æç¤º", |
| | | content: "æ¯å¦ç¡®è®¤å é¤è¯¥ä¿å
»ä»»å¡ï¼", |
| | | success: modalRes => resolve(Boolean(modalRes.confirm)), |
| | | fail: () => resolve(false), |
| | | }); |
| | | }); |
| | | if (!canDelete) return; |
| | | try { |
| | | await deviceMaintenanceTaskDel([row.id]); |
| | | uni.showToast({ |
| | | title: "å 餿å", |
| | | icon: "success", |
| | | }); |
| | | handleQuery(); |
| | | } catch (error) { |
| | | uni.showToast({ |
| | | title: "å é¤å¤±è´¥", |
| | | icon: "none", |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const onSwipeActionClick = (event, row) => { |
| | | if (event?.position !== "right") return; |
| | | deleteOne(row); |
| | | }; |
| | | |
| | | onShow(() => { |
| | | handleQuery(); |
| | | }); |
| | | |
| | | onReachBottom(() => { |
| | | loadMore(); |
| | | }); |
| | | |
| | | onPullDownRefresh(() => { |
| | | handleQuery(); |
| | | uni.stopPullDownRefresh(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .upkeep-task-page { |
| | | min-height: 100vh; |
| | | background: #f6f7fb; |
| | | } |
| | | |
| | | .toolbar { |
| | | padding: 20rpx 24rpx; |
| | | background: #fff; |
| | | border-bottom: 1rpx solid #f0f0f0; |
| | | position: sticky; |
| | | top: 0; |
| | | z-index: 10; |
| | | } |
| | | |
| | | .search-section { |
| | | margin-top: 0; |
| | | } |
| | | |
| | | .search-bar { |
| | | display: flex; |
| | | align-items: center; |
| | | background: #f7f8fa; |
| | | border-radius: 14rpx; |
| | | padding: 8rpx 12rpx 8rpx 16rpx; |
| | | border: 1rpx solid #eef1f5; |
| | | } |
| | | |
| | | .search-input { |
| | | flex: 1; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .search-text { |
| | | background: transparent !important; |
| | | } |
| | | |
| | | :deep(.search-text .u-input__content), |
| | | :deep(.search-text .up-input__content) { |
| | | background: transparent !important; |
| | | padding: 0 !important; |
| | | } |
| | | |
| | | .search-button { |
| | | width: 64rpx; |
| | | height: 64rpx; |
| | | border-radius: 12rpx; |
| | | background: #ffffff; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .meta-bar { |
| | | margin-top: 16rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | background: #f7f9fc; |
| | | border-radius: 12rpx; |
| | | padding: 10rpx 16rpx; |
| | | } |
| | | |
| | | .meta-text { |
| | | color: #5c6b8a; |
| | | font-size: 22rpx; |
| | | } |
| | | |
| | | .list-section { |
| | | padding: 20rpx 24rpx; |
| | | padding-bottom: calc(132rpx + env(safe-area-inset-bottom)); |
| | | } |
| | | |
| | | .ledger-item { |
| | | background: #ffffff; |
| | | border-radius: 20rpx; |
| | | margin-bottom: 16rpx; |
| | | overflow: hidden; |
| | | box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.05); |
| | | padding: 0 20rpx; |
| | | } |
| | | |
| | | .item-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 22rpx 0; |
| | | } |
| | | |
| | | .item-left { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 10rpx; |
| | | flex: 1; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .item-right { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .document-icon { |
| | | width: 38rpx; |
| | | height: 38rpx; |
| | | border-radius: 8rpx; |
| | | background: #2979ff; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .item-id { |
| | | font-size: 28rpx; |
| | | color: #1f1f1f; |
| | | font-weight: 600; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .item-details { |
| | | padding: 18rpx 0 20rpx; |
| | | } |
| | | |
| | | .detail-row { |
| | | display: flex; |
| | | align-items: flex-end; |
| | | justify-content: space-between; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | |
| | | .detail-label { |
| | | min-width: 160rpx; |
| | | color: #777; |
| | | font-size: 24rpx; |
| | | } |
| | | |
| | | .detail-value { |
| | | flex: 1; |
| | | color: #333; |
| | | font-size: 24rpx; |
| | | text-align: right; |
| | | word-break: break-all; |
| | | margin-left: 12rpx; |
| | | } |
| | | |
| | | .detail-value.highlight { |
| | | color: #2979ff; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .card-actions { |
| | | padding-top: 8rpx; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .action-btn { |
| | | min-width: 140rpx; |
| | | } |
| | | |
| | | .fab-button { |
| | | position: fixed; |
| | | bottom: calc(30px + env(safe-area-inset-bottom)); |
| | | right: 30px; |
| | | width: 56px; |
| | | height: 56px; |
| | | background: #2979ff; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3); |
| | | z-index: 1000; |
| | | } |
| | | |
| | | .no-data { |
| | | padding: 40rpx 0; |
| | | text-align: center; |
| | | color: #999; |
| | | } |
| | | </style> |
| | |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | <!-- ä»å¨ç©æµæ¨¡å --> |
| | | <view class="common-module warehouse-logistics-module" |
| | | v-if="hasWarehouseLogisticsItems"> |
| | | <view class="module-header"> |
| | | <view class="module-title-container"> |
| | | <text class="module-title">ä»å¨ç©æµ</text> |
| | | </view> |
| | | </view> |
| | | <view class="module-content"> |
| | | <up-grid :border="false" |
| | | col="4"> |
| | | <up-grid-item v-for="(item, index) in warehouseLogisticsItems" |
| | | :key="index" |
| | | @click="handleCommonItemClick(item)"> |
| | | <view class="icon-container" |
| | | :style="{ background: item.bgColor }"> |
| | | <up-icon :name="item.icon" |
| | | :size="58" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="item-label">{{item.label}}</text> |
| | | </up-grid-item> |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xunjianshangchuan@2x.png", |
| | | label: "å·¡æ£ç®¡ç", |
| | | label: "å·¡æ£ä»»å¡", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xunjianshangchuan@2x.png", |
| | | label: "å·¡æ£ä»»å¡ç®¡ç", |
| | | } |
| | | label: "å·¡æ£ç®¡ç", |
| | | }, |
| | | ]); |
| | | |
| | | // ä»å¨ç©æµåè½æ°æ® |
| | | const warehouseLogisticsItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/caigoutaizhang@2x.png", |
| | | label: "å
¥åºç®¡ç", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/caigoutaizhang@2x.png", |
| | | label: "åºåºå°è´¦", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/caigoutaizhang@2x.png", |
| | | label: "åºå管ç", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/caigoutaizhang@2x.png", |
| | | label: "åºåæ¥è¡¨", |
| | | }, |
| | | ]); |
| | | |
| | | // å¤ç常ç¨åè½ç¹å» |
| | |
| | | url: "/pages/equipmentManagement/repair/index", |
| | | }); |
| | | break; |
| | | case "设å¤ä¿å
»ä»»å¡": |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/upkeepTask/index", |
| | | }); |
| | | break; |
| | | case "设å¤ä¿å
»": |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/upkeep/index", |
| | |
| | | url: "/pages/inspectionUpload/index", |
| | | }); |
| | | break; |
| | | case "å·¡æ£ä»»å¡ç®¡ç": |
| | | case "å·¡æ£ä»»å¡": |
| | | uni.navigateTo({ |
| | | url: "/pages/inspectionManagement/index", |
| | | }); |
| | |
| | | case "åå管ç": |
| | | uni.navigateTo({ |
| | | url: "/pages/humanResources/contractManagement/index", |
| | | }); |
| | | break; |
| | | case "å
¥åºç®¡ç": |
| | | uni.navigateTo({ |
| | | url: "/pages/inventoryManagement/receiptManagement/index", |
| | | }); |
| | | break; |
| | | case "åºåºå°è´¦": |
| | | uni.navigateTo({ |
| | | url: "/pages/inventoryManagement/dispatchLog/index", |
| | | }); |
| | | break; |
| | | case "åºå管ç": |
| | | uni.navigateTo({ |
| | | url: "/pages/inventoryManagement/stockManagement/index", |
| | | }); |
| | | break; |
| | | case "åºåæ¥è¡¨": |
| | | uni.navigateTo({ |
| | | url: "/pages/inventoryManagement/stockReport/index", |
| | | }); |
| | | break; |
| | | default: |
| | |
| | | const originalEquipment = [ |
| | | { icon: "/static/images/icon/shbeibaoxiu@2x.png", label: "è¿è¡ç®¡ç" }, |
| | | { icon: "/static/images/icon/shbeibaoxiu@2x.png", label: "è®¾å¤æ¥ä¿®" }, |
| | | { icon: "/static/images/icon/shbeibaoyang@2x.png", label: "设å¤ä¿å
»ä»»å¡" }, |
| | | { icon: "/static/images/icon/shbeibaoyang@2x.png", label: "设å¤ä¿å
»" }, |
| | | { icon: "/static/images/icon/xunjianshangchuan@2x.png", label: "å·¡æ£ä»»å¡" }, |
| | | { icon: "/static/images/icon/xunjianshangchuan@2x.png", label: "å·¡æ£ç®¡ç" }, |
| | | { icon: "/static/images/icon/xunjianshangchuan@2x.png", label: "å·¡æ£ä»»å¡ç®¡ç" }, |
| | | ]; |
| | | const filteredEquipment = originalEquipment.filter(item => { |
| | | return allowedMenuTitles.has(item.label); |
| | | }); |
| | | if (filteredEquipment.some(i => i.label === "设å¤ä¿å
»")) { |
| | | const upkeepTask = originalEquipment.find(i => i.label === "设å¤ä¿å
»ä»»å¡"); |
| | | if (upkeepTask && !filteredEquipment.some(i => i.label === "设å¤ä¿å
»ä»»å¡")) { |
| | | const upkeepIndex = filteredEquipment.findIndex(i => i.label === "设å¤ä¿å
»"); |
| | | filteredEquipment.splice(upkeepIndex, 0, upkeepTask); |
| | | } |
| | | } |
| | | if (filteredEquipment.some(i => i.label === "å·¡æ£ç®¡ç")) { |
| | | const task = originalEquipment.find(i => i.label === "å·¡æ£ä»»å¡ç®¡ç"); |
| | | if (task && !filteredEquipment.some(i => i.label === "å·¡æ£ä»»å¡ç®¡ç")) { |
| | | filteredEquipment.push(task); |
| | | const task = originalEquipment.find(i => i.label === "å·¡æ£ä»»å¡"); |
| | | if (task && !filteredEquipment.some(i => i.label === "å·¡æ£ä»»å¡")) { |
| | | const manageIndex = filteredEquipment.findIndex(i => i.label === "å·¡æ£ç®¡ç"); |
| | | filteredEquipment.splice(manageIndex, 0, task); |
| | | } |
| | | } |
| | | equipmentItems.splice(0, equipmentItems.length, ...filteredEquipment); |
| | | |
| | | // è¿æ»¤ä»å¨ç©æµèå |
| | | const originalWarehouseLogistics = [ |
| | | { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "å
¥åºç®¡ç" }, |
| | | { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "åºåºå°è´¦" }, |
| | | { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "åºå管ç" }, |
| | | { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "åºåæ¥è¡¨" }, |
| | | ]; |
| | | const filteredWarehouseLogistics = originalWarehouseLogistics.filter( |
| | | item => allowedMenuTitles.has(item.label) |
| | | ); |
| | | warehouseLogisticsItems.splice( |
| | | 0, |
| | | warehouseLogisticsItems.length, |
| | | ...filteredWarehouseLogistics |
| | | ); |
| | | }; |
| | | |
| | | // æ£æ¥æ¨¡åæ¯å¦æèå项éè¦æ¾ç¤º |
| | |
| | | const hasHumanResourcesItems = computed(() => humanResourcesItems.length > 0); |
| | | const hasProductionItems = computed(() => productionItems.length > 0); |
| | | const hasEquipmentItems = computed(() => equipmentItems.length > 0); |
| | | const hasWarehouseLogisticsItems = computed( |
| | | () => warehouseLogisticsItems.length > 0 |
| | | ); |
| | | |
| | | onMounted(() => { |
| | | // æ¯æ¬¡è¿å
¥é¦é¡µé½å¼ºå¶å·æ°ç¨æ·ä¿¡æ¯åè·¯ç±æéï¼ä¸åæ¬å°ç¼å夿 |
| | |
| | | url: "/pages/equipmentManagement/repair/index", |
| | | }); |
| | | break; |
| | | case "设å¤ä¿å
»ä»»å¡": |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/upkeepTask/index", |
| | | }); |
| | | break; |
| | | case "设å¤ä¿å
»": |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/upkeep/index", |
| | |
| | | <template> |
| | | <view class="inspection-management-page"> |
| | | <PageHeader title="å·¡æ£ä»»å¡ç®¡ç" |
| | | <PageHeader title="宿¶ä»»å¡ç®¡ç" |
| | | @back="goBack" /> |
| | | <view class="toolbar"> |
| | | <view class="tab-wrap"> |
| | | <view v-for="tab in tabs" |
| | | :key="tab.name" |
| | | class="tab-item" |
| | | :class="{ active: activeTab === tab.name }" |
| | | @click="switchTab(tab.name)"> |
| | | {{ tab.label }} |
| | | </view> |
| | | </view> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | |
| | | <uni-swipe-action> |
| | | <uni-swipe-action-item v-for="item in tableData" |
| | | :key="item.id" |
| | | :right-options="activeTab === 'taskManage' ? swipeOptions : []" |
| | | :disabled="activeTab !== 'taskManage'" |
| | | :right-options="swipeOptions" |
| | | @click="onSwipeActionClick($event, item)"> |
| | | <view class="ledger-item"> |
| | | <view class="item-header"> |
| | |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="card-actions"> |
| | | <u-button v-if="activeTab === 'taskManage'" |
| | | type="primary" |
| | | <u-button type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | | @click.stop="handleAdd(item)">ç¼è¾</u-button> |
| | | <u-button v-else |
| | | type="success" |
| | | <u-button type="error" |
| | | size="small" |
| | | plain |
| | | class="action-btn" |
| | | @click.stop="viewFile(item)">æ¥çéä»¶</u-button> |
| | | @click.stop="deleteOne(item)">å é¤</u-button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <text>ææ æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | <view v-if="activeTab === 'taskManage'" |
| | | class="fab-button" |
| | | <view class="fab-button" |
| | | @click="handleAdd()"> |
| | | <up-icon name="plus" |
| | | size="24" |
| | |
| | | </view> |
| | | <form-dia ref="formDia" |
| | | @closeDia="handleQuery" /> |
| | | <view-files ref="viewFiles" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import { onShow, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FormDia from "@/pages/inspectionManagement/components/formDia.vue"; |
| | | import ViewFiles from "@/pages/inspectionManagement/components/viewFiles.vue"; |
| | | import { |
| | | delTimingTask, |
| | | inspectionTaskList, |
| | | timingTaskList, |
| | | } from "@/api/inspectionManagement/index.js"; |
| | | |
| | | const formDia = ref(); |
| | | const viewFiles = ref(); |
| | | const activeTab = ref("taskManage"); |
| | | const tabs = [ |
| | | { name: "taskManage", label: "宿¶ä»»å¡ç®¡ç" }, |
| | | { name: "task", label: "宿¶ä»»å¡è®°å½" }, |
| | | ]; |
| | | const queryParams = reactive({ |
| | | taskName: "", |
| | | }); |
| | |
| | | return [String(val)]; |
| | | }; |
| | | |
| | | const switchTab = tabName => { |
| | | if (activeTab.value === tabName) return; |
| | | activeTab.value = tabName; |
| | | handleQuery(); |
| | | }; |
| | | |
| | | const getList = async () => { |
| | | if (loading.value) return; |
| | | loading.value = true; |
| | |
| | | current: pageParams.current, |
| | | size: pageParams.size, |
| | | }; |
| | | const request = activeTab.value === "task" ? inspectionTaskList : timingTaskList; |
| | | const res = await request(params); |
| | | const res = await timingTaskList(params); |
| | | const records = res?.data?.records || []; |
| | | const normalized = records.map(item => ({ |
| | | ...item, |
| | |
| | | }); |
| | | }; |
| | | |
| | | const viewFile = row => { |
| | | nextTick(() => { |
| | | viewFiles.value?.openDialog(row); |
| | | }); |
| | | }; |
| | | |
| | | const deleteOne = async row => { |
| | | if (!row?.id) return; |
| | | const canDelete = await new Promise(resolve => { |
| | |
| | | }; |
| | | |
| | | const onSwipeActionClick = (event, row) => { |
| | | if (activeTab.value !== "taskManage") return; |
| | | if (event?.position !== "right") return; |
| | | deleteOne(row); |
| | | }; |
| | |
| | | z-index: 10; |
| | | } |
| | | |
| | | .tab-wrap { |
| | | display: flex; |
| | | background: #f4f5f8; |
| | | border-radius: 16rpx; |
| | | padding: 6rpx; |
| | | } |
| | | |
| | | .tab-item { |
| | | flex: 1; |
| | | text-align: center; |
| | | padding: 14rpx 0; |
| | | font-size: 26rpx; |
| | | color: #666; |
| | | border-radius: 12rpx; |
| | | } |
| | | |
| | | .tab-item.active { |
| | | background: #1677ff; |
| | | color: #fff; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .search-section { |
| | | margin-top: 20rpx; |
| | | margin-top: 0; |
| | | } |
| | | |
| | | .search-bar { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="dispatch-page"> |
| | | <PageHeader title="åºåºå°è´¦" @back="goBack" /> |
| | | |
| | | <!-- æ ç¾ï¼åæ ¼åºåº / ä¸åæ ¼åºåº --> |
| | | <view class="tabs-wrap"> |
| | | <view |
| | | v-for="tab in tabs" |
| | | :key="tab.name" |
| | | class="tab-item" |
| | | :class="{ active: activeTab === tab.name }" |
| | | @click="activeTab = tab.name" |
| | | > |
| | | <text>{{ tab.label }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- æç´¢åºå --> |
| | | <view class="search-section"> |
| | | <view class="search-row"> |
| | | <view class="search-input-wrap"> |
| | | <up-input |
| | | v-model="searchForm.productName" |
| | | placeholder="产å大类" |
| | | clearable |
| | | /> |
| | | </view> |
| | | <view class="btn-search" @click="handleQuery"> |
| | | <view class="btn-search-inner"> |
| | | <up-icon name="search" size="22" color="#fff"></up-icon> |
| | | <text>æç´¢</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å表 --> |
| | | <view class="list-section"> |
| | | <view v-if="tableData.length > 0"> |
| | | <view |
| | | v-for="(item, index) in tableData" |
| | | :key="item.id || index" |
| | | class="card-item" |
| | | > |
| | | <view class="card-click" @click="goDetail(item)"> |
| | | <view class="card-header"> |
| | | <view class="header-main"> |
| | | <text class="product-name">{{ item.productName }}</text> |
| | | <text class="outbound-date">{{ item.createTime }}</text> |
| | | </view> |
| | | </view> |
| | | <up-divider /> |
| | | <view class="card-body"> |
| | | <view class="row"><text class="l">è§æ ¼åå·</text><text class="r">{{ item.model }}</text></view> |
| | | <view class="row"><text class="l">åä½</text><text class="r">{{ item.unit }}</text></view> |
| | | <view class="row"><text class="l">åºåºæ°é</text><text class="r highlight">{{ item.stockOutNum }}</text></view> |
| | | <view class="row"><text class="l">åºåºäºº</text><text class="r">{{ item.createBy }}</text></view> |
| | | <view class="row" v-if="item.recordType !== undefined"><text class="l">æ¥æº</text><text class="r">{{ getRecordType(item.recordType) || item.recordType }}</text></view> |
| | | <view class="row"><text class="l">æ¯é(å¨)</text><text class="r">{{ item.grossWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">ç®é(å¨)</text><text class="r">{{ item.tareWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">åé(å¨)</text><text class="r">{{ item.netWeight ?? '-' }}</text></view> |
| | | <view class="row"><text class="l">è¿ç£
æ¥æ</text><text class="r">{{ item.weighingDate || '-' }}</text></view> |
| | | <view class="row"><text class="l">è¿ç£
å</text><text class="r">{{ item.weighingOperator || '-' }}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="card-actions"> |
| | | <view class="btn-delete" @click.stop="handleDeleteSingle(item)">å é¤</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="no-data">ææ æ°æ®</view> |
| | | </view> |
| | | <!-- å è½½æ´å¤ --> |
| | | <view class="load-more-wrap" v-if="tableData.length > 0"> |
| | | <u-loadmore :status="loadStatus" @loadmore="loadMore" /> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, watch } from 'vue' |
| | | import { onShow, onReachBottom } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { getStockOutPage, delStockOut } from '@/api/inventoryManagement/stockOutRecord.js' |
| | | import { |
| | | findAllQualifiedStockOutRecordTypeOptions, |
| | | findAllUnQualifiedStockOutRecordTypeOptions |
| | | } from '@/api/basicData/enum.js' |
| | | |
| | | const activeTab = ref('qualified') |
| | | const stockRecordTypeOptions = ref([]) |
| | | const tabs = [ |
| | | { label: 'åæ ¼åºåº', name: 'qualified', type: '0' }, |
| | | { label: 'ä¸åæ ¼åºåº', name: 'unqualified', type: '1' } |
| | | ] |
| | | const tableData = ref([]) |
| | | const total = ref(0) |
| | | const loadStatus = ref('loadmore') |
| | | const page = reactive({ current: 1, size: 20 }) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | productName: '' |
| | | } |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | const currentType = () => tabs.find(t => t.name === activeTab.value)?.type || '0' |
| | | |
| | | function getRecordType(recordType) { |
| | | if (recordType == null || recordType === '') return '' |
| | | return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || '' |
| | | } |
| | | |
| | | function fetchRecordTypeOptions() { |
| | | const api = currentType() === '1' |
| | | ? findAllUnQualifiedStockOutRecordTypeOptions |
| | | : findAllQualifiedStockOutRecordTypeOptions |
| | | api() |
| | | .then(res => { |
| | | const list = res.data != null ? res.data : res |
| | | stockRecordTypeOptions.value = Array.isArray(list) ? list : [] |
| | | }) |
| | | .catch(() => { |
| | | stockRecordTypeOptions.value = [] |
| | | }) |
| | | } |
| | | |
| | | const getList = () => { |
| | | const isFirstPage = page.current === 1 |
| | | if (isFirstPage) { |
| | | uni.showLoading({ title: 'å è½½ä¸...', mask: true }) |
| | | } |
| | | getStockOutPage({ |
| | | ...page, |
| | | type: currentType(), |
| | | productName: searchForm.value.productName |
| | | }) |
| | | .then(res => { |
| | | uni.hideLoading() |
| | | const records = res.data?.records || [] |
| | | const totalCount = res.data?.total || 0 |
| | | if (isFirstPage) { |
| | | tableData.value = records |
| | | fetchRecordTypeOptions() |
| | | } else { |
| | | tableData.value = [...tableData.value, ...records] |
| | | } |
| | | total.value = totalCount |
| | | if (tableData.value.length >= totalCount || totalCount === 0) { |
| | | loadStatus.value = 'nomore' |
| | | } else { |
| | | loadStatus.value = 'loadmore' |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | uni.hideLoading() |
| | | loadStatus.value = 'error' |
| | | if (isFirstPage) { |
| | | uni.showToast({ title: 'å 载失败', icon: 'none' }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const loadMore = () => { |
| | | if (loadStatus.value === 'nomore' || loadStatus.value === 'loading') return |
| | | loadStatus.value = 'loading' |
| | | page.current++ |
| | | getList() |
| | | } |
| | | |
| | | watch(activeTab, () => { |
| | | page.current = 1 |
| | | loadStatus.value = 'loadmore' |
| | | stockRecordTypeOptions.value = [] |
| | | getList() |
| | | }) |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | loadStatus.value = 'loadmore' |
| | | getList() |
| | | } |
| | | |
| | | const goDetail = (item) => { |
| | | if (!item.id) return |
| | | try { |
| | | uni.setStorageSync('dispatchDetailItem', JSON.stringify({ |
| | | item, |
| | | type: currentType() |
| | | })) |
| | | } catch (e) {} |
| | | uni.navigateTo({ |
| | | url: '/pages/inventoryManagement/dispatchLog/view?id=' + item.id |
| | | }) |
| | | } |
| | | |
| | | const handleDeleteSingle = (item) => { |
| | | uni.showModal({ |
| | | title: 'å é¤', |
| | | content: '确认å é¤è¯¥æ¡åºåºè®°å½ï¼', |
| | | success: res => { |
| | | if (res.confirm) { |
| | | delStockOut([item.id]) |
| | | .then(() => { |
| | | uni.showToast({ title: 'å 餿å', icon: 'success' }) |
| | | getList() |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: 'å é¤å¤±è´¥', icon: 'none' }) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | |
| | | onShow(() => getList()) |
| | | onReachBottom(() => loadMore()) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .dispatch-page { |
| | | min-height: 100vh; |
| | | background: #f5f5f5; |
| | | padding-bottom: 40rpx; |
| | | } |
| | | .tabs-wrap { |
| | | display: flex; |
| | | background: #fff; |
| | | padding: 24rpx; |
| | | gap: 24rpx; |
| | | } |
| | | .tab-item { |
| | | flex: 1; |
| | | text-align: center; |
| | | padding: 20rpx; |
| | | border-radius: 12rpx; |
| | | background: #f0f0f0; |
| | | font-size: 28rpx; |
| | | color: #666; |
| | | } |
| | | .tab-item.active { |
| | | background: #2979ff; |
| | | color: #fff; |
| | | } |
| | | .search-section { |
| | | background: #fff; |
| | | margin: 24rpx; |
| | | padding: 24rpx; |
| | | border-radius: 16rpx; |
| | | } |
| | | .search-row { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .search-input-wrap { flex: 1; margin-right: 20rpx; min-width: 0; } |
| | | .btn-search { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 180rpx; |
| | | min-height: 72rpx; |
| | | flex-shrink: 0; |
| | | padding: 20rpx 24rpx; |
| | | background: #2979ff; |
| | | color: #fff; |
| | | border-radius: 12rpx; |
| | | font-size: 28rpx; |
| | | box-sizing: border-box; |
| | | text-align: center; |
| | | } |
| | | .btn-search-inner { |
| | | display: flex; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | justify-content: center; |
| | | gap: 8rpx; |
| | | } |
| | | .btn-search text { line-height: 1; vertical-align: middle; } |
| | | :deep(.btn-search-inner > *), |
| | | :deep(.btn-search > *) { |
| | | flex-shrink: 0; |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .list-section { padding: 0 24rpx; } |
| | | .card-item { |
| | | background: #fff; |
| | | border-radius: 16rpx; |
| | | padding: 24rpx; |
| | | margin-bottom: 24rpx; |
| | | box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); |
| | | } |
| | | .card-header { padding: 8rpx 0; } |
| | | .header-main { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 8rpx; |
| | | } |
| | | .product-name { font-size: 30rpx; font-weight: 500; color: #333; } |
| | | .outbound-date { font-size: 24rpx; color: #999; } |
| | | .card-body .row { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | padding: 12rpx 0; |
| | | font-size: 26rpx; |
| | | } |
| | | .card-body .l { color: #666; } |
| | | .card-body .r { color: #333; } |
| | | .card-body .r.highlight { color: #2979ff; font-weight: 500; } |
| | | .card-actions { |
| | | margin-top: 16rpx; |
| | | padding-top: 16rpx; |
| | | border-top: 1rpx solid #eee; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | .btn-delete { |
| | | font-size: 28rpx; |
| | | color: #f56c6c; |
| | | padding: 12rpx 32rpx; |
| | | } |
| | | .no-data { |
| | | text-align: center; |
| | | padding: 80rpx 0; |
| | | color: #999; |
| | | font-size: 28rpx; |
| | | } |
| | | .load-more-wrap { padding: 24rpx 0 40rpx; } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="detail-page"> |
| | | <PageHeader title="åºåºè¯¦æ
" @back="goBack" /> |
| | | <view v-if="loading" class="loading-wrap"> |
| | | <text class="loading-text">å è½½ä¸...</text> |
| | | </view> |
| | | <view v-else-if="detail" class="detail-wrap"> |
| | | <!-- åºç¡ä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">åºç¡ä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">åºå·</text> |
| | | <text class="value">{{ detail.index ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åºåºæ¹æ¬¡</text> |
| | | <text class="value value-strong">{{ detail.outboundBatches || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åºåºæ¶é´</text> |
| | | <text class="value">{{ detail.createTime || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">产å大类</text> |
| | | <text class="value value-strong">{{ detail.productName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è§æ ¼åå·</text> |
| | | <text class="value">{{ detail.model || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åä½</text> |
| | | <text class="value">{{ detail.unit || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row detail-row-highlight"> |
| | | <text class="label">åºåºæ°é</text> |
| | | <text class="value value-num">{{ detail.stockOutNum ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åºåºäºº</text> |
| | | <text class="value">{{ detail.createBy || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">æ¥æº</text> |
| | | <text class="value">{{ getRecordType(detail.recordType) || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- åºåºä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">åºåºä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">车çå·</text> |
| | | <text class="value">{{ detail.licensePlateNo || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">æ¯é(å¨)</text> |
| | | <text class="value">{{ detail.grossWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">ç®é(å¨)</text> |
| | | <text class="value">{{ detail.tareWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åé(å¨)</text> |
| | | <text class="value">{{ detail.netWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è¿ç£
æ¥æ</text> |
| | | <text class="value">{{ detail.weighingDate || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è¿ç£
å</text> |
| | | <text class="value">{{ detail.weighingOperator || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="empty"> |
| | | <text class="empty-text">ææ è¯¦æ
æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { |
| | | findAllQualifiedStockOutRecordTypeOptions, |
| | | findAllUnQualifiedStockOutRecordTypeOptions |
| | | } from '@/api/basicData/enum.js' |
| | | |
| | | const detail = ref(null) |
| | | const loading = ref(true) |
| | | const stockRecordTypeOptions = ref([]) |
| | | |
| | | function normalizeDetail(raw) { |
| | | if (!raw) return null |
| | | const d = typeof raw === 'object' ? raw : {} |
| | | return { |
| | | index: d.index ?? 1, |
| | | outboundBatches: d.outboundBatches, |
| | | createTime: d.createTime, |
| | | productName: d.productName, |
| | | model: d.model, |
| | | unit: d.unit, |
| | | stockOutNum: d.stockOutNum, |
| | | createBy: d.createBy, |
| | | recordType: d.recordType, |
| | | licensePlateNo: d.licensePlateNo, |
| | | grossWeight: d.grossWeight, |
| | | tareWeight: d.tareWeight, |
| | | netWeight: d.netWeight, |
| | | weighingDate: d.weighingDate, |
| | | weighingOperator: d.weighingOperator |
| | | } |
| | | } |
| | | |
| | | function getRecordType(recordType) { |
| | | if (recordType == null || recordType === '') return '' |
| | | return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || '' |
| | | } |
| | | |
| | | function fetchRecordTypeOptions(type) { |
| | | const api = type === '1' |
| | | ? findAllUnQualifiedStockOutRecordTypeOptions |
| | | : findAllQualifiedStockOutRecordTypeOptions |
| | | api() |
| | | .then(res => { |
| | | const data = res.data != null ? res.data : res |
| | | stockRecordTypeOptions.value = Array.isArray(data) ? data : [] |
| | | }) |
| | | .catch(() => { |
| | | stockRecordTypeOptions.value = [] |
| | | }) |
| | | } |
| | | |
| | | onLoad(() => { |
| | | const cached = uni.getStorageSync('dispatchDetailItem') |
| | | if (cached) { |
| | | try { |
| | | const payload = typeof cached === 'string' ? JSON.parse(cached) : cached |
| | | const item = payload && payload.item != null ? payload.item : payload |
| | | const type = payload && payload.type != null ? payload.type : '0' |
| | | detail.value = normalizeDetail({ ...item, index: 1 }) |
| | | fetchRecordTypeOptions(type) |
| | | uni.removeStorageSync('dispatchDetailItem') |
| | | } catch (e) { |
| | | uni.removeStorageSync('dispatchDetailItem') |
| | | } |
| | | } |
| | | loading.value = false |
| | | }) |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .detail-page { |
| | | min-height: 100vh; |
| | | background: linear-gradient(180deg, #e8eef7 0%, #f2f5fa 100%); |
| | | padding-bottom: 48rpx; |
| | | } |
| | | .loading-wrap { |
| | | padding: 120rpx 48rpx; |
| | | text-align: center; |
| | | } |
| | | .loading-text { |
| | | color: #8c9aa8; |
| | | font-size: 28rpx; |
| | | } |
| | | .empty { |
| | | padding: 120rpx 48rpx; |
| | | text-align: center; |
| | | } |
| | | .empty-text { |
| | | color: #8c9aa8; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-wrap { |
| | | padding: 24rpx 24rpx 32rpx; |
| | | } |
| | | .section-card { |
| | | background: #fff; |
| | | border-radius: 24rpx; |
| | | overflow: hidden; |
| | | margin-bottom: 28rpx; |
| | | box-shadow: 0 8rpx 32rpx rgba(41, 121, 255, 0.06); |
| | | border: 1rpx solid rgba(41, 121, 255, 0.06); |
| | | } |
| | | .section-head { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 28rpx 32rpx; |
| | | background: linear-gradient(135deg, #f8fbff 0%, #f0f6ff 100%); |
| | | border-bottom: 1rpx solid #eef3fa; |
| | | } |
| | | .section-dot { |
| | | width: 8rpx; |
| | | height: 8rpx; |
| | | border-radius: 50%; |
| | | background: #2979ff; |
| | | margin-right: 16rpx; |
| | | } |
| | | .section-title { |
| | | font-size: 30rpx; |
| | | font-weight: 600; |
| | | color: #1e3a5f; |
| | | letter-spacing: 0.5rpx; |
| | | } |
| | | .section-body { |
| | | padding: 8rpx 32rpx 24rpx; |
| | | } |
| | | .detail-row { |
| | | display: flex; |
| | | align-items: center; |
| | | min-height: 96rpx; |
| | | padding: 0 16rpx; |
| | | border-radius: 12rpx; |
| | | font-size: 28rpx; |
| | | margin-bottom: 4rpx; |
| | | } |
| | | .detail-row .label { |
| | | width: 200rpx; |
| | | flex-shrink: 0; |
| | | color: #6b7c93; |
| | | font-size: 26rpx; |
| | | } |
| | | .detail-row .value { |
| | | flex: 1; |
| | | color: #2c3e50; |
| | | text-align: right; |
| | | word-break: break-all; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-row .value-strong { |
| | | color: #1e3a5f; |
| | | font-weight: 500; |
| | | } |
| | | .detail-row .value-num { |
| | | color: #2979ff; |
| | | font-weight: 600; |
| | | font-size: 32rpx; |
| | | } |
| | | .detail-row-highlight { |
| | | background: linear-gradient(90deg, rgba(41, 121, 255, 0.06) 0%, transparent 100%); |
| | | margin: 12rpx -16rpx 4rpx; |
| | | padding: 20rpx 16rpx; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <view class="stock-in-page"> |
| | | <PageHeader title="èªå®ä¹å
¥åº" @back="goBack" /> |
| | | |
| | | <view class="receipt-page"> |
| | | <PageHeader title="å
¥åºç®¡ç" @back="goBack" /> |
| | | |
| | | <!-- æ ç¾ï¼åæ ¼å
¥åº / ä¸åæ ¼å
¥åº --> |
| | | <view class="tabs-wrap"> |
| | | <view |
| | | v-for="tab in tabs" |
| | | :key="tab.name" |
| | | class="tab-item" |
| | | :class="{ active: activeTab === tab.name }" |
| | | @click="activeTab = tab.name" |
| | | > |
| | | <text>{{ tab.label }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- æç´¢åºå --> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <view class="search-row"> |
| | | <view class="search-input-wrap"> |
| | | <up-input |
| | | v-model="searchForm.supplierName" |
| | | placeholder="请è¾å
¥ä¾åºååç§°" |
| | | v-model="searchForm.productName" |
| | | placeholder="产å大类" |
| | | clearable |
| | | /> |
| | | </view> |
| | | <view class="search-button" @click="handleQuery"> |
| | | <up-icon name="search" size="24" color="#999"></up-icon> |
| | | <view class="btn-search" @click="handleQuery"> |
| | | <view class="btn-search-inner"> |
| | | <up-icon name="search" size="22" color="#fff"></up-icon> |
| | | <text>æç´¢</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="date-filter" @click="openDatePickerHandler"> |
| | | <text class="date-text">{{ searchForm.timeStr || 'éæ©æ¥æ' }}</text> |
| | | <up-icon name="calendar" size="18" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å表 --> |
| | | <view class="stock-list" v-if="tableData.length > 0"> |
| | | <view v-for="(item, index) in tableData" :key="index" class="stock-item"> |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="batch-icon"> |
| | | <up-icon name="file-text" size="16" color="#ffffff"></up-icon> |
| | | |
| | | <!-- å表ï¼åæ ¼/ä¸åæ ¼å
±ç¨æ¥å£ type åºåï¼ --> |
| | | <view class="list-section" v-if="activeTab !== 'custom'"> |
| | | <view v-if="tableData.length > 0"> |
| | | <view |
| | | v-for="(item, index) in tableData" |
| | | :key="item.id || index" |
| | | class="card-item" |
| | | > |
| | | <view class="card-click" @click="goDetail(item)"> |
| | | <view class="card-header"> |
| | | <view class="header-main"> |
| | | <text class="product-name">{{ item.productName }}</text> |
| | | <text class="inbound-date">{{ item.createTime || item.inboundDate }}</text> |
| | | </view> |
| | | </view> |
| | | <text class="batch-text">{{ item.inboundBatches }}</text> |
| | | <up-divider /> |
| | | <view class="card-body"> |
| | | <view class="row"><text class="l">è§æ ¼åå·</text><text class="r">{{ item.model }}</text></view> |
| | | <view class="row"><text class="l">åä½</text><text class="r">{{ item.unit }}</text></view> |
| | | <view class="row"><text class="l">å
¥åºæ°é</text><text class="r highlight">{{ item.stockInNum }}</text></view> |
| | | <view class="row"><text class="l">å
¥åºäºº</text><text class="r">{{ item.createBy }}</text></view> |
| | | <view class="row" v-if="item.recordType !== undefined"><text class="l">æ¥æº</text><text class="r">{{ getRecordType(item.recordType) || item.recordType }}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="item-right"> |
| | | <text class="time-text">{{ item.inboundDate }}</text> |
| | | <view class="card-actions"> |
| | | <view class="btn-delete" @click.stop="handleDeleteSingle(item)">å é¤</view> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ä¾åºååç§°</text> |
| | | <text class="detail-value">{{ item.supplierName }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">产å大类</text> |
| | | <text class="detail-value">{{ item.productCategory }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">è§æ ¼åå·</text> |
| | | <text class="detail-value">{{ item.specificationModel }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ç©åç±»å</text> |
| | | <text class="detail-value">{{ item.itemType }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å
¥åºæ°é</text> |
| | | <text class="detail-value highlight">{{ item.inboundNum }} {{ item.unit }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å«ç¨åä»·</text> |
| | | <text class="detail-value">Â¥{{ item.taxInclusiveUnitPrice }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å«ç¨æ»ä»·</text> |
| | | <text class="detail-value price">Â¥{{ item.taxInclusiveTotalPrice }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ç¨ç</text> |
| | | <text class="detail-value">{{ item.taxRate }}%</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å
¥åºäºº</text> |
| | | <text class="detail-value">{{ item.createBy }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="item-actions"> |
| | | <u-button type="primary" size="small" @click="handleEdit(item)">ç¼è¾</u-button> |
| | | <u-button type="error" size="small" plain @click="handleDeleteSingle(item)">å é¤</u-button> |
| | | </view> |
| | | </view> |
| | | <view v-else class="no-data">ææ æ°æ®</view> |
| | | </view> |
| | | |
| | | <view v-else class="no-data"> |
| | | <text>ææ æ°æ®</text> |
| | | <!-- å è½½æ´å¤ --> |
| | | <view class="load-more-wrap" v-if="tableData.length > 0"> |
| | | <u-loadmore :status="loadStatus" @loadmore="loadMore" /> |
| | | </view> |
| | | |
| | | <!-- æµ®å¨æä½æé® --> |
| | | <view class="fab-button" @click="handleAdd"> |
| | | <up-icon name="plus" size="24" color="#ffffff"></up-icon> |
| | | </view> |
| | | |
| | | <!-- æ¥æéæ©å¨ --> |
| | | <up-popup :show="showDatePicker" mode="bottom" @close="showDatePicker = false"> |
| | | <up-datetime-picker |
| | | :show="true" |
| | | v-model="dateValue" |
| | | @confirm="onDateConfirm" |
| | | @cancel="showDatePicker = false" |
| | | mode="date" |
| | | /> |
| | | </up-popup> |
| | | |
| | | <!-- 表åå¼¹çª --> |
| | | <form-dia-manual ref="formDiaManual" @close="getList" @success="getList" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, onMounted } from 'vue' |
| | | import { onShow } from '@dcloudio/uni-app' |
| | | import dayjs from 'dayjs' |
| | | import { ref, reactive, toRefs, watch } from 'vue' |
| | | import { onShow, onReachBottom } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import FormDiaManual from './components/formDiaManual.vue' |
| | | import useUserStore from '@/store/modules/user' |
| | | import { formatDateToYMD } from '@/utils/ruoyi' |
| | | import { |
| | | getInPageByCustom, |
| | | delStockInCustom |
| | | } from "@/api/inventoryManagement/stockIn.js" |
| | | getStockInRecordListPage, |
| | | batchDeleteStockInRecords |
| | | } from '@/api/inventoryManagement/stockInRecord.js' |
| | | import { |
| | | findAllQualifiedStockInRecordTypeOptions, |
| | | findAllUnQualifiedStockInRecordTypeOptions |
| | | } from '@/api/basicData/enum.js' |
| | | |
| | | const userStore = useUserStore() |
| | | const activeTab = ref('qualified') |
| | | const stockRecordTypeOptions = ref([]) |
| | | const tabs = [ |
| | | { label: 'åæ ¼å
¥åº', name: 'qualified', type: '0' }, |
| | | { label: 'ä¸åæ ¼å
¥åº', name: 'unqualified', type: '1' } |
| | | ] |
| | | |
| | | const tableData = ref([]) |
| | | const showDatePicker = ref(false) |
| | | const dateValue = ref(new Date().getTime()) |
| | | const formDiaManual = ref(null) |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 20, |
| | | }) |
| | | const total = ref(0) |
| | | const loadStatus = ref('loadmore') // loadmore | loading | nomore | error |
| | | |
| | | const page = reactive({ current: 1, size: 4 }) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: '', |
| | | timeStr: '', |
| | | }, |
| | | productName: '' |
| | | } |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | // ç»ä¸ç¨ dayjs è¾åº YYYY-MM-DD |
| | | const formatYMDLocal = (ts) => dayjs(Number(ts)).format('YYYY-MM-DD') |
| | | const currentType = () => tabs.find(t => t.name === activeTab.value)?.type || '0' |
| | | |
| | | // è¿åä¸ä¸é¡µ |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | function getRecordType(recordType) { |
| | | if (recordType == null || recordType === '') return '' |
| | | return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || '' |
| | | } |
| | | |
| | | // æ¥è¯¢å表 |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | function fetchRecordTypeOptions() { |
| | | const api = currentType() === '1' |
| | | ? findAllUnQualifiedStockInRecordTypeOptions |
| | | : findAllQualifiedStockInRecordTypeOptions |
| | | api() |
| | | .then(res => { |
| | | const data = res.data != null ? res.data : res |
| | | stockRecordTypeOptions.value = Array.isArray(data) ? data : [] |
| | | }) |
| | | .catch(() => { |
| | | stockRecordTypeOptions.value = [] |
| | | }) |
| | | } |
| | | |
| | | const getList = () => { |
| | | uni.showLoading({ |
| | | title: 'å è½½ä¸...', |
| | | mask: true |
| | | }) |
| | | |
| | | if (activeTab.value === 'custom') return |
| | | const isFirstPage = page.current === 1 |
| | | if (isFirstPage) { |
| | | uni.showLoading({ title: 'å è½½ä¸...', mask: true }) |
| | | } |
| | | const params = { |
| | | ...page, |
| | | supplierName: searchForm.value.supplierName, |
| | | timeStr: searchForm.value.timeStr |
| | | type: currentType(), |
| | | productName: searchForm.value.productName |
| | | } |
| | | |
| | | getInPageByCustom(params).then(res => { |
| | | uni.hideLoading() |
| | | tableData.value = res.data.records || [] |
| | | total.value = res.data.total || 0 |
| | | }).catch(() => { |
| | | uni.hideLoading() |
| | | uni.showToast({ |
| | | title: 'å 载失败', |
| | | icon: 'none' |
| | | getStockInRecordListPage(params) |
| | | .then(res => { |
| | | uni.hideLoading() |
| | | const records = res.data?.records || [] |
| | | const totalCount = res.data?.total || 0 |
| | | if (isFirstPage) { |
| | | tableData.value = records |
| | | fetchRecordTypeOptions() |
| | | } else { |
| | | tableData.value = [...tableData.value, ...records] |
| | | } |
| | | total.value = totalCount |
| | | if (tableData.value.length >= totalCount || totalCount === 0) { |
| | | loadStatus.value = 'nomore' |
| | | } else { |
| | | loadStatus.value = 'loadmore' |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | uni.hideLoading() |
| | | loadStatus.value = 'error' |
| | | if (isFirstPage) { |
| | | uni.showToast({ title: 'å 载失败', icon: 'none' }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const loadMore = () => { |
| | | if (loadStatus.value === 'nomore' || loadStatus.value === 'loading') return |
| | | loadStatus.value = 'loading' |
| | | page.current++ |
| | | getList() |
| | | } |
| | | |
| | | watch(activeTab, () => { |
| | | page.current = 1 |
| | | loadStatus.value = 'loadmore' |
| | | stockRecordTypeOptions.value = [] |
| | | getList() |
| | | }) |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | loadStatus.value = 'loadmore' |
| | | getList() |
| | | } |
| | | |
| | | const goDetail = (item) => { |
| | | if (!item.id) return |
| | | try { |
| | | uni.setStorageSync('receiptDetailItem', JSON.stringify({ |
| | | item, |
| | | type: currentType() |
| | | })) |
| | | } catch (e) {} |
| | | uni.navigateTo({ |
| | | url: '/pages/inventoryManagement/receiptManagement/view?id=' + item.id |
| | | }) |
| | | } |
| | | |
| | | // æå¼æ¥æéæ©å¨ï¼ç®åå¯é ï¼ |
| | | const openDatePickerHandler = () => { |
| | | // è¥å·²æé䏿¥æï¼ç¨å®åå§åï¼å¦åç¨ä»å¤© |
| | | dateValue.value = searchForm.value.timeStr |
| | | ? dayjs(searchForm.value.timeStr, 'YYYY-MM-DD').valueOf() |
| | | : Date.now() |
| | | showDatePicker.value = true |
| | | } |
| | | |
| | | // æ¥æéæ©ç¡®è®¤ï¼ä¸å
¶ä»é¡µä¸è´ï¼æ¿æ¶é´æ³ -> YYYY-MM-DDï¼ |
| | | const onDateConfirm = (e) => { |
| | | searchForm.value.timeStr = formatDateToYMD(e.value) |
| | | showDatePicker.value = false |
| | | handleQuery() |
| | | } |
| | | |
| | | // æ°å¢å
¥åº |
| | | const handleAdd = () => { |
| | | formDiaManual.value?.openDialog('add') |
| | | } |
| | | |
| | | // ç¼è¾ |
| | | const handleEdit = (item) => { |
| | | formDiaManual.value?.openDialog('edit', item) |
| | | } |
| | | |
| | | // å é¤åæ¡ |
| | | const handleDeleteSingle = (item) => { |
| | | // æ£æ¥æ¯å¦æ¯æ¬äººå建 |
| | | if (item.createBy !== userStore.nickName) { |
| | | uni.showToast({ |
| | | title: 'ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | uni.showModal({ |
| | | title: 'å é¤', |
| | | content: '确认å é¤è¯¥å
¥åºè®°å½åï¼', |
| | | success: (res) => { |
| | | content: '确认å é¤è¯¥æ¡å
¥åºè®°å½ï¼', |
| | | success: res => { |
| | | if (res.confirm) { |
| | | delStockInCustom({ ids: [item.id] }).then(() => { |
| | | uni.showToast({ |
| | | title: 'å 餿å', |
| | | icon: 'success' |
| | | batchDeleteStockInRecords([item.id]) |
| | | .then(() => { |
| | | uni.showToast({ title: 'å 餿å', icon: 'success' }) |
| | | getList() |
| | | }) |
| | | getList() |
| | | }).catch(() => { |
| | | uni.showToast({ |
| | | title: 'å é¤å¤±è´¥', |
| | | icon: 'none' |
| | | .catch(() => { |
| | | uni.showToast({ title: 'å é¤å¤±è´¥', icon: 'none' }) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | |
| | | onShow(() => { |
| | | getList() |
| | | if (activeTab.value !== 'custom') getList() |
| | | }) |
| | | |
| | | onReachBottom(() => { |
| | | loadMore() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .stock-in-page { |
| | | <style lang="scss" scoped> |
| | | .receipt-page { |
| | | min-height: 100vh; |
| | | background: #f5f5f5; |
| | | padding-bottom: 80px; |
| | | padding-bottom: 40rpx; |
| | | } |
| | | |
| | | .tabs-wrap { |
| | | display: flex; |
| | | background: #fff; |
| | | padding: 24rpx; |
| | | gap: 24rpx; |
| | | } |
| | | .tab-item { |
| | | flex: 1; |
| | | text-align: center; |
| | | padding: 20rpx; |
| | | border-radius: 12rpx; |
| | | background: #f0f0f0; |
| | | font-size: 28rpx; |
| | | color: #666; |
| | | } |
| | | .tab-item.active { |
| | | background: #2979ff; |
| | | color: #fff; |
| | | } |
| | | .search-section { |
| | | background: #fff; |
| | | padding: 16px; |
| | | margin-bottom: 12px; |
| | | margin: 24rpx; |
| | | padding: 24rpx; |
| | | border-radius: 16rpx; |
| | | } |
| | | |
| | | .search-bar { |
| | | .search-row { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 12px; |
| | | margin-bottom: 12px; |
| | | margin-bottom: 20rpx; |
| | | } |
| | | |
| | | .search-input { |
| | | flex: 1; |
| | | } |
| | | |
| | | .search-button { |
| | | width: 44px; |
| | | height: 44px; |
| | | .search-input-wrap { flex: 1; margin-right: 20rpx; min-width: 0; } |
| | | .btn-search { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background: #f5f5f5; |
| | | border-radius: 8px; |
| | | } |
| | | |
| | | .date-filter { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 12px 16px; |
| | | background: #f5f5f5; |
| | | border-radius: 8px; |
| | | } |
| | | |
| | | .date-text { |
| | | font-size: 14px; |
| | | color: #666; |
| | | } |
| | | |
| | | .stock-list { |
| | | padding: 0 16px; |
| | | } |
| | | |
| | | .stock-item { |
| | | background: #fff; |
| | | border-radius: 12px; |
| | | padding: 16px; |
| | | margin-bottom: 12px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); |
| | | } |
| | | |
| | | .item-header { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .item-left { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | } |
| | | |
| | | .batch-icon { |
| | | width: 32px; |
| | | height: 32px; |
| | | width: 180rpx; |
| | | min-height: 72rpx; |
| | | flex-shrink: 0; |
| | | padding: 20rpx 24rpx; |
| | | background: #2979ff; |
| | | border-radius: 8px; |
| | | color: #fff; |
| | | border-radius: 12rpx; |
| | | font-size: 28rpx; |
| | | box-sizing: border-box; |
| | | text-align: center; |
| | | } |
| | | .btn-search-inner { |
| | | display: flex; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | justify-content: center; |
| | | gap: 8rpx; |
| | | } |
| | | .btn-search text { |
| | | line-height: 1; |
| | | vertical-align: middle; |
| | | } |
| | | /* æé®å
徿 䏿ååç´æ°´å¹³é½å±
ä¸ */ |
| | | :deep(.btn-search-inner > *), |
| | | :deep(.btn-search > *) { |
| | | flex-shrink: 0; |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .batch-text { |
| | | font-size: 14px; |
| | | .list-section { |
| | | padding: 0 24rpx; |
| | | } |
| | | .card-item { |
| | | background: #fff; |
| | | border-radius: 16rpx; |
| | | padding: 24rpx; |
| | | margin-bottom: 24rpx; |
| | | box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); |
| | | } |
| | | .card-header { |
| | | padding: 8rpx 0; |
| | | } |
| | | .header-main { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 8rpx; |
| | | } |
| | | .product-name { |
| | | font-size: 30rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | } |
| | | |
| | | .time-text { |
| | | font-size: 12px; |
| | | .inbound-date { |
| | | font-size: 24rpx; |
| | | color: #999; |
| | | } |
| | | |
| | | .item-details { |
| | | margin: 12px 0; |
| | | } |
| | | |
| | | .detail-row { |
| | | .card-body .row { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 8px 0; |
| | | padding: 12rpx 0; |
| | | font-size: 26rpx; |
| | | } |
| | | |
| | | .detail-label { |
| | | font-size: 14px; |
| | | color: #666; |
| | | } |
| | | |
| | | .detail-value { |
| | | font-size: 14px; |
| | | color: #333; |
| | | text-align: right; |
| | | flex: 1; |
| | | margin-left: 12px; |
| | | } |
| | | |
| | | .detail-value.highlight { |
| | | color: #2979ff; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .detail-value.price { |
| | | color: #ff6b00; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .item-actions { |
| | | .card-body .l { color: #666; } |
| | | .card-body .r { color: #333; } |
| | | .card-body .r.highlight { color: #2979ff; font-weight: 500; } |
| | | .card-actions { |
| | | margin-top: 16rpx; |
| | | padding-top: 16rpx; |
| | | border-top: 1rpx solid #eee; |
| | | display: flex; |
| | | gap: 12px; |
| | | margin-top: 12px; |
| | | padding-top: 12px; |
| | | border-top: 1px solid #f5f5f5; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | |
| | | .btn-delete { |
| | | font-size: 28rpx; |
| | | color: #f56c6c; |
| | | padding: 12rpx 32rpx; |
| | | } |
| | | .no-data { |
| | | text-align: center; |
| | | padding: 60px 0; |
| | | padding: 80rpx 0; |
| | | color: #999; |
| | | font-size: 14px; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .fab-button { |
| | | position: fixed; |
| | | right: 20px; |
| | | bottom: 80px; |
| | | width: 56px; |
| | | height: 56px; |
| | | background: #2979ff; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 4px 12px rgba(41, 121, 255, 0.4); |
| | | z-index: 999; |
| | | .load-more-wrap { |
| | | padding: 24rpx 0 40rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="detail-page"> |
| | | <PageHeader title="å
¥åºè¯¦æ
" @back="goBack" /> |
| | | <view v-if="loading" class="loading-wrap"> |
| | | <text class="loading-text">å è½½ä¸...</text> |
| | | </view> |
| | | <view v-else-if="detail" class="detail-wrap"> |
| | | <!-- åºç¡ä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">åºç¡ä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">åºå·</text> |
| | | <text class="value">{{ detail.index ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">å
¥åºæ¹æ¬¡</text> |
| | | <text class="value value-strong">{{ detail.inboundBatches || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">å
¥åºæ¶é´</text> |
| | | <text class="value">{{ detail.createTime || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">产å大类</text> |
| | | <text class="value value-strong">{{ detail.productName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è§æ ¼åå·</text> |
| | | <text class="value">{{ detail.model || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åä½</text> |
| | | <text class="value">{{ detail.unit || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row detail-row-highlight"> |
| | | <text class="label">å
¥åºæ°é</text> |
| | | <text class="value value-num">{{ detail.stockInNum ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">å
¥åºäºº</text> |
| | | <text class="value">{{ detail.createBy || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">æ¥æº</text> |
| | | <text class="value">{{ getRecordType(detail.recordType) || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- å
¥åºä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">å
¥åºä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">车çå·</text> |
| | | <text class="value">{{ detail.licensePlateNo || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">æ¯é(å¨)</text> |
| | | <text class="value">{{ detail.grossWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">ç®é(å¨)</text> |
| | | <text class="value">{{ detail.tareWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åé(å¨)</text> |
| | | <text class="value">{{ detail.netWeight ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è¿ç£
æ¥æ</text> |
| | | <text class="value">{{ detail.weighingDate || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è¿ç£
å</text> |
| | | <text class="value">{{ detail.weighingOperator || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="empty"> |
| | | <text class="empty-text">ææ è¯¦æ
æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { |
| | | findAllQualifiedStockInRecordTypeOptions, |
| | | findAllUnQualifiedStockInRecordTypeOptions |
| | | } from '@/api/basicData/enum.js' |
| | | |
| | | const detail = ref(null) |
| | | const loading = ref(true) |
| | | const stockRecordTypeOptions = ref([]) |
| | | |
| | | // ä¸åè el-table-column ç prop ä¿æä¸è´ï¼inboundBatches, createTime, productName, model, unit, stockInNum, licensePlateNo, grossWeight, tareWeight, netWeight, createBy, recordType, weighingDate, weighingOperator |
| | | function normalizeDetail(raw) { |
| | | if (!raw) return null |
| | | const d = typeof raw === 'object' ? raw : {} |
| | | return { |
| | | index: d.index ?? 1, |
| | | inboundBatches: d.inboundBatches, |
| | | createTime: d.createTime, |
| | | productName: d.productName, |
| | | model: d.model, |
| | | unit: d.unit, |
| | | stockInNum: d.stockInNum, |
| | | createBy: d.createBy, |
| | | recordType: d.recordType, |
| | | licensePlateNo: d.licensePlateNo, |
| | | grossWeight: d.grossWeight, |
| | | tareWeight: d.tareWeight, |
| | | netWeight: d.netWeight, |
| | | weighingDate: d.weighingDate, |
| | | weighingOperator: d.weighingOperator |
| | | } |
| | | } |
| | | |
| | | function getRecordType(recordType) { |
| | | if (recordType == null || recordType === '') return '' |
| | | return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || '' |
| | | } |
| | | |
| | | function fetchRecordTypeOptions(type) { |
| | | const api = type === '1' |
| | | ? findAllUnQualifiedStockInRecordTypeOptions |
| | | : findAllQualifiedStockInRecordTypeOptions |
| | | api() |
| | | .then(res => { |
| | | const data = res.data != null ? res.data : res |
| | | stockRecordTypeOptions.value = Array.isArray(data) ? data : [] |
| | | }) |
| | | .catch(() => { |
| | | stockRecordTypeOptions.value = [] |
| | | }) |
| | | } |
| | | |
| | | onLoad(() => { |
| | | const cached = uni.getStorageSync('receiptDetailItem') |
| | | if (cached) { |
| | | try { |
| | | const payload = typeof cached === 'string' ? JSON.parse(cached) : cached |
| | | const item = payload && payload.item != null ? payload.item : payload |
| | | const type = payload && payload.type != null ? payload.type : '0' |
| | | detail.value = normalizeDetail({ ...item, index: 1 }) |
| | | fetchRecordTypeOptions(type) |
| | | uni.removeStorageSync('receiptDetailItem') |
| | | } catch (e) { |
| | | uni.removeStorageSync('receiptDetailItem') |
| | | } |
| | | } |
| | | loading.value = false |
| | | }) |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .detail-page { |
| | | min-height: 100vh; |
| | | background: linear-gradient(180deg, #e8eef7 0%, #f2f5fa 100%); |
| | | padding-bottom: 48rpx; |
| | | } |
| | | .loading-wrap { |
| | | padding: 120rpx 48rpx; |
| | | text-align: center; |
| | | } |
| | | .loading-text { |
| | | color: #8c9aa8; |
| | | font-size: 28rpx; |
| | | } |
| | | .empty { |
| | | padding: 120rpx 48rpx; |
| | | text-align: center; |
| | | } |
| | | .empty-text { |
| | | color: #8c9aa8; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-wrap { |
| | | padding: 24rpx 24rpx 32rpx; |
| | | } |
| | | .section-card { |
| | | background: #fff; |
| | | border-radius: 24rpx; |
| | | overflow: hidden; |
| | | margin-bottom: 28rpx; |
| | | box-shadow: 0 8rpx 32rpx rgba(41, 121, 255, 0.06); |
| | | border: 1rpx solid rgba(41, 121, 255, 0.06); |
| | | } |
| | | .section-head { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 28rpx 32rpx; |
| | | background: linear-gradient(135deg, #f8fbff 0%, #f0f6ff 100%); |
| | | border-bottom: 1rpx solid #eef3fa; |
| | | } |
| | | .section-dot { |
| | | width: 8rpx; |
| | | height: 8rpx; |
| | | border-radius: 50%; |
| | | background: #2979ff; |
| | | margin-right: 16rpx; |
| | | } |
| | | .section-title { |
| | | font-size: 30rpx; |
| | | font-weight: 600; |
| | | color: #1e3a5f; |
| | | letter-spacing: 0.5rpx; |
| | | } |
| | | .section-body { |
| | | padding: 8rpx 32rpx 24rpx; |
| | | } |
| | | .detail-row { |
| | | display: flex; |
| | | align-items: center; |
| | | min-height: 96rpx; |
| | | padding: 0 16rpx; |
| | | border-radius: 12rpx; |
| | | font-size: 28rpx; |
| | | margin-bottom: 4rpx; |
| | | } |
| | | .detail-row .label { |
| | | width: 200rpx; |
| | | flex-shrink: 0; |
| | | color: #6b7c93; |
| | | font-size: 26rpx; |
| | | } |
| | | .detail-row .value { |
| | | flex: 1; |
| | | color: #2c3e50; |
| | | text-align: right; |
| | | word-break: break-all; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-row .value-strong { |
| | | color: #1e3a5f; |
| | | font-weight: 500; |
| | | } |
| | | .detail-row .value-num { |
| | | color: #2979ff; |
| | | font-weight: 600; |
| | | font-size: 32rpx; |
| | | } |
| | | .detail-row-highlight { |
| | | background: linear-gradient(90deg, rgba(41, 121, 255, 0.06) 0%, transparent 100%); |
| | | margin: 12rpx -16rpx 4rpx; |
| | | padding: 20rpx 16rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="add-stock-page"> |
| | | <PageHeader title="æ°å¢åºå" @back="goBack" /> |
| | | |
| | | <scroll-view scroll-y class="content-scroll"> |
| | | <view class="form-section"> |
| | | <view class="form-row"> |
| | | <text class="form-label required">产ååç§°</text> |
| | | <view class="selector-trigger" @click="openProductSelector"> |
| | | <text class="selector-text" :class="{ placeholder: !form.productName }"> |
| | | {{ form.productName || 'è¯·éæ©äº§å' }} |
| | | </text> |
| | | <up-icon name="arrow-right" size="16" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">è§æ ¼</text> |
| | | <up-input v-model="form.productModelName" disabled placeholder="è¯·éæ©äº§ååèªå¨å¸¦åº" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">åä½</text> |
| | | <up-input v-model="form.unit" disabled placeholder="è¯·éæ©äº§ååèªå¨å¸¦åº" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- åæ ¼åºåæ¶æ¾ç¤ºè¿ç£
ç¸å
³å段 --> |
| | | <view v-if="isQualified" class="form-section"> |
| | | <view class="section-title">è¿ç£
ä¿¡æ¯</view> |
| | | <view class="form-row"> |
| | | <text class="form-label">车çå·</text> |
| | | <up-input v-model="form.licensePlateNo" placeholder="请è¾å
¥è½¦çå·" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">æ¯é(å¨)</text> |
| | | <up-input |
| | | v-model="form.grossWeight" |
| | | type="number" |
| | | placeholder="请è¾å
¥æ¯é" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">ç®é(å¨)</text> |
| | | <up-input |
| | | v-model="form.tareWeight" |
| | | type="number" |
| | | placeholder="请è¾å
¥ç®é" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">åé(å¨)</text> |
| | | <up-input |
| | | v-model="form.netWeight" |
| | | type="number" |
| | | disabled |
| | | placeholder="èªå¨è®¡ç®" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">è¿ç£
æ¥æ</text> |
| | | <view class="selector-trigger" @click="openWeighingDatePicker"> |
| | | <text class="selector-text" :class="{ placeholder: !form.weighingDate }"> |
| | | {{ form.weighingDate || 'è¯·éæ©è¿ç£
æ¥æ' }} |
| | | </text> |
| | | <up-icon name="calendar" size="16" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">è¿ç£
å</text> |
| | | <up-input v-model="form.weighingOperator" placeholder="请è¾å
¥è¿ç£
å" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="form-section"> |
| | | <!-- <view class="form-row"> |
| | | <text class="form-label required">æ°é</text> |
| | | <up-input v-model="form.qualitity" type="number" placeholder="请è¾å
¥æ°é" /> |
| | | </view> --> |
| | | <view class="form-row"> |
| | | <text class="form-label">夿³¨</text> |
| | | <up-input v-model="form.remark" type="textarea" placeholder="éå¡«" /> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | |
| | | <!-- æäº¤æé® --> |
| | | <view class="bottom-bar"> |
| | | <view class="btn-submit" @click="handleSubmit">æäº¤</view> |
| | | </view> |
| | | |
| | | <!-- 产å鿩弹çªï¼ç®åç ProductSelectDialogï¼ --> |
| | | <up-popup :show="showProductPopup" mode="bottom" @close="showProductPopup = false"> |
| | | <view class="product-popup"> |
| | | <view class="popup-header"> |
| | | <text class="popup-title">éæ©äº§å</text> |
| | | </view> |
| | | <view class="popup-search"> |
| | | <up-input |
| | | v-model="productQuery.productName" |
| | | placeholder="产å大类" |
| | | clearable |
| | | /> |
| | | <up-input |
| | | v-model="productQuery.model" |
| | | placeholder="åå·åç§°" |
| | | clearable |
| | | /> |
| | | <view class="popup-search-btn" @click="loadProductList">æç´¢</view> |
| | | </view> |
| | | <scroll-view scroll-y class="product-list"> |
| | | <view |
| | | v-for="item in productList" |
| | | :key="item.id" |
| | | class="product-item" |
| | | @click="selectProduct(item)" |
| | | > |
| | | <view class="product-name-row"> |
| | | <text class="product-name">{{ item.productName }}</text> |
| | | <text class="product-unit">{{ item.unit }}</text> |
| | | </view> |
| | | <view class="product-model">åå·ï¼{{ item.model }}</view> |
| | | </view> |
| | | <view v-if="!productLoading && productList.length === 0" class="no-data"> |
| | | ææ æ°æ® |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | </up-popup> |
| | | |
| | | <!-- è¿ç£
æ¥æéæ©å¨ --> |
| | | <up-popup :show="showWeighingDatePicker" mode="bottom" @close="showWeighingDatePicker = false"> |
| | | <up-datetime-picker |
| | | :show="true" |
| | | v-model="weighingDateValue" |
| | | mode="datetime" |
| | | @confirm="onWeighingDateConfirm" |
| | | @cancel="showWeighingDatePicker = false" |
| | | /> |
| | | </up-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, watch } from 'vue' |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import dayjs from 'dayjs' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { createStockInventory } from '@/api/inventoryManagement/stockInventory.js' |
| | | import { createStockUnInventory } from '@/api/inventoryManagement/stockUninventory.js' |
| | | import { productModelList } from '@/api/basicData/productModel.js' |
| | | |
| | | const form = reactive({ |
| | | productId: undefined, |
| | | productModelId: undefined, |
| | | productName: '', |
| | | productModelName: '', |
| | | unit: '', |
| | | productType: undefined, |
| | | licensePlateNo: '', |
| | | grossWeight: '', |
| | | tareWeight: '', |
| | | netWeight: '', |
| | | weighingDate: '', |
| | | weighingOperator: '', |
| | | qualitity: '', |
| | | remark: '' |
| | | }) |
| | | |
| | | const type = ref('0') // 0 åæ ¼åºåï¼1 ä¸åæ ¼åºå |
| | | const isQualified = computed(() => type.value === '0') |
| | | |
| | | const showProductPopup = ref(false) |
| | | const productQuery = reactive({ |
| | | productName: '', |
| | | model: '' |
| | | }) |
| | | const productList = ref([]) |
| | | const productLoading = ref(false) |
| | | |
| | | const showWeighingDatePicker = ref(false) |
| | | const weighingDateValue = ref(Date.now()) |
| | | |
| | | onLoad((options) => { |
| | | if (options && options.type != null) { |
| | | type.value = options.type |
| | | } |
| | | }) |
| | | |
| | | const openProductSelector = () => { |
| | | showProductPopup.value = true |
| | | if (productList.value.length === 0) { |
| | | loadProductList() |
| | | } |
| | | } |
| | | |
| | | const loadProductList = () => { |
| | | productLoading.value = true |
| | | productModelList({ |
| | | productName: productQuery.productName || '', |
| | | model: productQuery.model || '', |
| | | current: 1, |
| | | size: 20 |
| | | }) |
| | | .then(res => { |
| | | const data = res?.records || res?.data?.records || [] |
| | | productList.value = Array.isArray(data) ? data : [] |
| | | }) |
| | | .finally(() => { |
| | | productLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const selectProduct = (item) => { |
| | | form.productId = item.productId || item.id |
| | | form.productModelId = item.id |
| | | form.productName = item.productName |
| | | form.productModelName = item.model |
| | | form.unit = item.unit |
| | | form.productType = item.productType |
| | | showProductPopup.value = false |
| | | } |
| | | |
| | | // åé = æ¯é - ç®é |
| | | const computeNetWeight = () => { |
| | | const gross = Number(form.grossWeight) |
| | | const tare = Number(form.tareWeight) |
| | | if (!isNaN(gross) && !isNaN(tare)) { |
| | | const net = Number((gross - tare).toFixed(2)) |
| | | form.netWeight = net > 0 ? net : 0 |
| | | } else { |
| | | form.netWeight = '' |
| | | } |
| | | } |
| | | |
| | | // ç嬿¯éãç®éååï¼èªå¨è®¡ç®åé |
| | | watch( |
| | | () => [form.grossWeight, form.tareWeight], |
| | | () => { |
| | | computeNetWeight() |
| | | } |
| | | ) |
| | | |
| | | const openWeighingDatePicker = () => { |
| | | weighingDateValue.value = form.weighingDate |
| | | ? dayjs(form.weighingDate, 'YYYY-MM-DD HH:mm:ss').valueOf() |
| | | : Date.now() |
| | | showWeighingDatePicker.value = true |
| | | } |
| | | |
| | | const onWeighingDateConfirm = (e) => { |
| | | const ts = e?.value ?? weighingDateValue.value |
| | | form.weighingDate = dayjs(ts).format('YYYY-MM-DD HH:mm:ss') |
| | | showWeighingDatePicker.value = false |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | if (!form.productName || !form.productModelId) { |
| | | uni.showToast({ title: 'è¯·éæ©äº§å', icon: 'none' }) |
| | | return |
| | | } |
| | | // if (!form.qualitity || Number(form.qualitity) <= 0) { |
| | | // uni.showToast({ title: '请è¾å
¥æ°é', icon: 'none' }) |
| | | // return |
| | | // } |
| | | const payload = { |
| | | productId: form.productId, |
| | | productModelId: form.productModelId, |
| | | productName: form.productName, |
| | | productModelName: form.productModelName, |
| | | unit: form.unit, |
| | | productType: form.productType, |
| | | licensePlateNo: form.licensePlateNo, |
| | | grossWeight: form.grossWeight, |
| | | tareWeight: form.tareWeight, |
| | | netWeight: form.netWeight, |
| | | weighingDate: form.weighingDate, |
| | | weighingOperator: form.weighingOperator, |
| | | remark: form.remark |
| | | } |
| | | const api = isQualified.value ? createStockInventory : createStockUnInventory |
| | | api(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: 'æ°å¢æå', icon: 'success' }) |
| | | setTimeout(() => { |
| | | uni.navigateBack() |
| | | }, 400) |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: 'æ°å¢å¤±è´¥', icon: 'none' }) |
| | | }) |
| | | } |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .add-stock-page { |
| | | min-height: 100vh; |
| | | background: #f5f5f5; |
| | | padding-bottom: 100rpx; |
| | | } |
| | | .content-scroll { |
| | | height: calc(100vh - 100rpx); |
| | | } |
| | | .form-section { |
| | | background: #fff; |
| | | margin: 24rpx; |
| | | padding: 24rpx; |
| | | border-radius: 16rpx; |
| | | } |
| | | .section-title { |
| | | font-size: 28rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | .form-row { |
| | | margin-bottom: 24rpx; |
| | | } |
| | | .form-label { |
| | | display: block; |
| | | font-size: 26rpx; |
| | | color: #666; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | .form-label.required::after { |
| | | content: '*'; |
| | | color: #f56c6c; |
| | | margin-left: 6rpx; |
| | | } |
| | | .selector-trigger { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 20rpx 24rpx; |
| | | background: #f5f5f5; |
| | | border-radius: 12rpx; |
| | | } |
| | | .selector-text { |
| | | font-size: 28rpx; |
| | | color: #333; |
| | | } |
| | | .selector-text.placeholder { |
| | | color: #999; |
| | | } |
| | | .bottom-bar { |
| | | position: fixed; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom)); |
| | | background: #fff; |
| | | box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04); |
| | | } |
| | | .btn-submit { |
| | | height: 88rpx; |
| | | border-radius: 999rpx; |
| | | background: #2979ff; |
| | | color: #fff; |
| | | font-size: 30rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .product-popup { |
| | | background: #fff; |
| | | border-radius: 24rpx 24rpx 0 0; |
| | | padding-bottom: env(safe-area-inset-bottom); |
| | | } |
| | | .popup-header { |
| | | padding: 24rpx; |
| | | border-bottom: 1rpx solid #eee; |
| | | } |
| | | .popup-title { |
| | | font-size: 30rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | } |
| | | .popup-search { |
| | | padding: 16rpx 24rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 12rpx; |
| | | } |
| | | .popup-search-btn { |
| | | margin-top: 8rpx; |
| | | align-self: flex-end; |
| | | padding: 12rpx 32rpx; |
| | | border-radius: 999rpx; |
| | | background: #2979ff; |
| | | color: #fff; |
| | | font-size: 26rpx; |
| | | } |
| | | .product-list { |
| | | max-height: 600rpx; |
| | | padding: 0 24rpx 24rpx; |
| | | } |
| | | .product-item { |
| | | padding: 20rpx 0; |
| | | border-bottom: 1rpx solid #f0f0f0; |
| | | } |
| | | .product-name-row { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 8rpx; |
| | | } |
| | | .product-name { |
| | | font-size: 28rpx; |
| | | color: #333; |
| | | } |
| | | .product-unit { |
| | | font-size: 24rpx; |
| | | color: #999; |
| | | } |
| | | .product-model { |
| | | font-size: 24rpx; |
| | | color: #666; |
| | | } |
| | | .no-data { |
| | | text-align: center; |
| | | padding: 40rpx 0; |
| | | color: #999; |
| | | font-size: 26rpx; |
| | | } |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="stock-mgmt-page"> |
| | | <PageHeader title="åºå管ç" @back="goBack" /> |
| | | |
| | | <!-- æ ç¾ï¼åæ ¼åºå / ä¸åæ ¼åºå --> |
| | | <view class="tabs-wrap"> |
| | | <view |
| | | v-for="tab in tabs" |
| | | :key="tab.name" |
| | | class="tab-item" |
| | | :class="{ active: activeTab === tab.name }" |
| | | @click="activeTab = tab.name" |
| | | > |
| | | <text>{{ tab.label }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- æç´¢åºå --> |
| | | <view class="search-section"> |
| | | <view class="search-row"> |
| | | <view class="search-input-wrap"> |
| | | <up-input |
| | | v-model="searchForm.productName" |
| | | placeholder="产å大类" |
| | | clearable |
| | | /> |
| | | </view> |
| | | <view class="btn-search" @click="handleQuery"> |
| | | <view class="btn-search-inner"> |
| | | <up-icon name="search" size="22" color="#fff"></up-icon> |
| | | <text>æç´¢</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å表 + æ»å¨å页 --> |
| | | <view class="list-section"> |
| | | <view v-if="tableData.length > 0"> |
| | | <view |
| | | v-for="(item, index) in tableData" |
| | | :key="item.id || index" |
| | | class="card-item" |
| | | > |
| | | <view class="card-click" @click="goDetail(item)"> |
| | | <view class="card-header"> |
| | | <view class="header-main"> |
| | | <text class="product-name">{{ item.productName }}</text> |
| | | <text class="sub-title">{{ item.model || item.updateTime }}</text> |
| | | </view> |
| | | </view> |
| | | <up-divider /> |
| | | <view class="card-body"> |
| | | <view class="row"><text class="l">è§æ ¼åå·</text><text class="r">{{ item.model }}</text></view> |
| | | <view class="row"><text class="l">åä½</text><text class="r">{{ item.unit }}</text></view> |
| | | <view class="row"><text class="l">æ»åºåæ°</text><text class="r highlight">{{ item.qualitity }}</text></view> |
| | | <view class="row"><text class="l">å»ç»æ°é</text><text class="r">{{ item.lockedQuantity || 0 }}</text></view> |
| | | <view class="row"><text class="l">å¯ç¨åºå</text><text class="r">{{ item.unLockedQuantity ?? (item.qualitity - (item.lockedQuantity || 0)) }}</text></view> |
| | | <view class="row"><text class="l">æè¿æ´æ°æ¶é´</text><text class="r">{{ item.updateTime }}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="card-actions"> |
| | | <view |
| | | class="btn-link btn-link-primary" |
| | | :class="{ disabled: !(item.unLockedQuantity > 0) }" |
| | | @click="openSubtract(item)" |
| | | >åºåº</view> |
| | | <view |
| | | class="btn-link btn-link-warn" |
| | | v-if="item.unLockedQuantity > 0" |
| | | @click="openFrozen(item)" |
| | | >å»ç»</view> |
| | | <view |
| | | class="btn-link btn-link-plain" |
| | | v-if="(item.lockedQuantity || 0) > 0" |
| | | @click="openThaw(item)" |
| | | >è§£å»</view> |
| | | </view> |
| | | </view> |
| | | <view class="load-more-wrap"> |
| | | <u-loadmore :status="loadStatus" @loadmore="loadMore" /> |
| | | </view> |
| | | </view> |
| | | <view v-else class="no-data">ææ æ°æ®</view> |
| | | </view> |
| | | |
| | | <!-- åºåº/å»ç»/è§£å»å¼¹çª --> |
| | | <up-popup :show="showQuantityPopup" mode="center" round="16" @close="closeQuantityPopup"> |
| | | <view class="popup-inner"> |
| | | <view class="popup-title">{{ quantityTitle }}</view> |
| | | <view class="form-row"> |
| | | <text class="form-label">æ°é</text> |
| | | <up-input v-model="quantityForm.num" type="number" :placeholder="'æå¤§' + maxQuantity" /> |
| | | </view> |
| | | <view class="popup-footer"> |
| | | <view class="btn-cancel" @click="closeQuantityPopup">åæ¶</view> |
| | | <view class="btn-ok" @click="submitQuantity">ç¡®å®</view> |
| | | </view> |
| | | </view> |
| | | </up-popup> |
| | | |
| | | <!-- å³ä¸è§æ°å¢æé®ï¼è¿å
¥æ°å¢åºåé¡µé¢ --> |
| | | <view class="fab-button" @click="goAdd"> |
| | | <up-icon name="plus" size="24" color="#ffffff"></up-icon> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, watch, computed } from 'vue' |
| | | import { onShow, onReachBottom } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { |
| | | getStockInventoryListPage, |
| | | createStockInventory, |
| | | subtractStockInventory, |
| | | frozenStockInventory, |
| | | thawStockInventory |
| | | } from '@/api/inventoryManagement/stockInventory.js' |
| | | import { |
| | | getStockUninventoryListPage, |
| | | createStockUnInventory, |
| | | subtractStockUnInventory, |
| | | frozenStockUninventory, |
| | | thawStockUninventory |
| | | } from '@/api/inventoryManagement/stockUninventory.js' |
| | | |
| | | const activeTab = ref('qualified') |
| | | const tabs = [ |
| | | { label: 'åæ ¼åºå', name: 'qualified' }, |
| | | { label: 'ä¸åæ ¼åºå', name: 'unqualified' } |
| | | ] |
| | | const tableData = ref([]) |
| | | const total = ref(0) |
| | | const loadStatus = ref('loadmore') // loadmore | loading | nomore | error |
| | | const showQuantityPopup = ref(false) |
| | | const quantityOp = ref('') // subtract | frozen | thaw |
| | | const currentRecord = ref(null) |
| | | const page = reactive({ current: 1, size: 20 }) |
| | | const data = reactive({ |
| | | searchForm: { productName: '' }, |
| | | quantityForm: { num: '' } |
| | | }) |
| | | const { searchForm, quantityForm } = toRefs(data) |
| | | |
| | | const isQualified = () => activeTab.value === 'qualified' |
| | | const getList = () => { |
| | | const isFirstPage = page.current === 1 |
| | | if (isFirstPage) { |
| | | uni.showLoading({ title: 'å è½½ä¸...', mask: true }) |
| | | } |
| | | const params = { ...page, productName: searchForm.value.productName } |
| | | const api = isQualified() ? getStockInventoryListPage : getStockUninventoryListPage |
| | | api(params) |
| | | .then(res => { |
| | | uni.hideLoading() |
| | | const records = res.data?.records || [] |
| | | const totalCount = res.data?.total || 0 |
| | | if (isFirstPage) { |
| | | tableData.value = records |
| | | } else { |
| | | tableData.value = [...tableData.value, ...records] |
| | | } |
| | | total.value = totalCount |
| | | if (tableData.value.length >= totalCount || totalCount === 0) { |
| | | loadStatus.value = 'nomore' |
| | | } else { |
| | | loadStatus.value = 'loadmore' |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | uni.hideLoading() |
| | | loadStatus.value = 'error' |
| | | if (isFirstPage) { |
| | | uni.showToast({ title: 'å 载失败', icon: 'none' }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const loadMore = () => { |
| | | if (loadStatus.value === 'nomore' || loadStatus.value === 'loading') return |
| | | loadStatus.value = 'loading' |
| | | page.current++ |
| | | getList() |
| | | } |
| | | |
| | | watch(activeTab, () => { |
| | | page.current = 1 |
| | | loadStatus.value = 'loadmore' |
| | | getList() |
| | | }) |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | loadStatus.value = 'loadmore' |
| | | getList() |
| | | } |
| | | |
| | | const goAdd = () => { |
| | | const type = isQualified() ? '0' : '1' |
| | | uni.navigateTo({ |
| | | url: `/pages/inventoryManagement/stockManagement/add?type=${type}` |
| | | }) |
| | | } |
| | | |
| | | const quantityTitle = computed(() => { |
| | | if (quantityOp.value === 'frozen') return 'å»ç»åºå' |
| | | if (quantityOp.value === 'thaw') return 'è§£å»åºå' |
| | | return '' |
| | | }) |
| | | const maxQuantity = computed(() => { |
| | | if (!currentRecord.value) return 0 |
| | | if (quantityOp.value === 'frozen') return currentRecord.value.unLockedQuantity || 0 |
| | | if (quantityOp.value === 'thaw') return currentRecord.value.lockedQuantity || 0 |
| | | return 0 |
| | | }) |
| | | |
| | | const openSubtract = (row) => { |
| | | if (!(row.unLockedQuantity > 0)) return |
| | | try { |
| | | uni.setStorageSync('stockSubtractRecord', JSON.stringify({ |
| | | item: row, |
| | | type: isQualified() ? '0' : '1' |
| | | })) |
| | | } catch (e) {} |
| | | const typeParam = isQualified() ? '0' : '1' |
| | | uni.navigateTo({ |
| | | url: `/pages/inventoryManagement/stockManagement/subtract?type=${typeParam}&id=${row.id}` |
| | | }) |
| | | } |
| | | const openFrozen = (row) => { |
| | | quantityOp.value = 'frozen' |
| | | currentRecord.value = row |
| | | quantityForm.value.num = '' |
| | | showQuantityPopup.value = true |
| | | } |
| | | const openThaw = (row) => { |
| | | quantityOp.value = 'thaw' |
| | | currentRecord.value = row |
| | | quantityForm.value.num = '' |
| | | showQuantityPopup.value = true |
| | | } |
| | | const closeQuantityPopup = () => { |
| | | showQuantityPopup.value = false |
| | | currentRecord.value = null |
| | | quantityOp.value = '' |
| | | } |
| | | const submitQuantity = () => { |
| | | const num = Number(quantityForm.value.num) |
| | | if (!num || num <= 0 || num > maxQuantity.value) { |
| | | uni.showToast({ title: `请è¾å
¥ 1~${maxQuantity.value} ä¹é´çæ°é`, icon: 'none' }) |
| | | return |
| | | } |
| | | const id = currentRecord.value?.id |
| | | if (!id) return |
| | | const base = { id, lockedQuantity: num } |
| | | let promise |
| | | if (quantityOp.value === 'frozen') { |
| | | promise = isQualified() ? frozenStockInventory(base) : frozenStockUninventory(base) |
| | | } else { |
| | | promise = isQualified() ? thawStockInventory(base) : thawStockUninventory(base) |
| | | } |
| | | promise.then(() => { |
| | | uni.showToast({ title: 'æä½æå', icon: 'success' }) |
| | | closeQuantityPopup() |
| | | getList() |
| | | }).catch(() => uni.showToast({ title: 'æä½å¤±è´¥', icon: 'none' })) |
| | | } |
| | | |
| | | const goDetail = (item) => { |
| | | if (!item) return |
| | | try { |
| | | uni.setStorageSync('stockDetailItem', JSON.stringify({ |
| | | item, |
| | | type: isQualified() ? '0' : '1' |
| | | })) |
| | | } catch (e) {} |
| | | if (!item.id) { |
| | | uni.navigateTo({ url: '/pages/inventoryManagement/stockManagement/view' }) |
| | | } else { |
| | | uni.navigateTo({ url: '/pages/inventoryManagement/stockManagement/view?id=' + item.id }) |
| | | } |
| | | } |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | onShow(() => getList()) |
| | | onReachBottom(() => { |
| | | loadMore() |
| | | }) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .stock-mgmt-page { |
| | | min-height: 100vh; |
| | | background: #f5f5f5; |
| | | padding-bottom: 120rpx; |
| | | } |
| | | .tabs-wrap { |
| | | display: flex; |
| | | background: #fff; |
| | | padding: 24rpx; |
| | | gap: 24rpx; |
| | | } |
| | | .tab-item { |
| | | flex: 1; |
| | | text-align: center; |
| | | padding: 20rpx; |
| | | border-radius: 12rpx; |
| | | background: #f0f0f0; |
| | | font-size: 28rpx; |
| | | color: #666; |
| | | } |
| | | .tab-item.active { |
| | | background: #2979ff; |
| | | color: #fff; |
| | | } |
| | | .search-section { |
| | | background: #fff; |
| | | margin: 24rpx; |
| | | padding: 24rpx; |
| | | border-radius: 16rpx; |
| | | } |
| | | .search-row { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .search-input-wrap { flex: 1; margin-right: 20rpx; min-width: 0; } |
| | | .btn-search { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 180rpx; |
| | | min-height: 72rpx; |
| | | flex-shrink: 0; |
| | | padding: 20rpx 24rpx; |
| | | background: #2979ff; |
| | | color: #fff; |
| | | border-radius: 12rpx; |
| | | font-size: 28rpx; |
| | | box-sizing: border-box; |
| | | text-align: center; |
| | | } |
| | | .btn-search-inner { |
| | | display: flex; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | justify-content: center; |
| | | gap: 8rpx; |
| | | } |
| | | .btn-search text { line-height: 1; vertical-align: middle; } |
| | | :deep(.btn-search-inner > *), |
| | | :deep(.btn-search > *) { |
| | | flex-shrink: 0; |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .list-section { padding: 0 24rpx; } |
| | | .card-item { |
| | | background: #fff; |
| | | border-radius: 16rpx; |
| | | padding: 24rpx; |
| | | margin-bottom: 24rpx; |
| | | box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); |
| | | } |
| | | .card-header { padding: 8rpx 0; } |
| | | .header-main { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 8rpx; |
| | | } |
| | | .product-name { font-size: 30rpx; font-weight: 500; color: #333; } |
| | | .sub-title { font-size: 24rpx; color: #999; } |
| | | .card-body .row { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | padding: 12rpx 0; |
| | | font-size: 26rpx; |
| | | } |
| | | .card-body .l { color: #666; } |
| | | .card-body .r { color: #333; } |
| | | .card-body .r.highlight { color: #2979ff; font-weight: 500; } |
| | | .card-actions { |
| | | display: flex; |
| | | gap: 16rpx; |
| | | margin-top: 16rpx; |
| | | padding-top: 16rpx; |
| | | border-top: 1rpx solid #eee; |
| | | justify-content: flex-end; |
| | | } |
| | | .btn-link { |
| | | min-width: 120rpx; |
| | | padding: 10rpx 20rpx; |
| | | border-radius: 24rpx; |
| | | font-size: 26rpx; |
| | | text-align: center; |
| | | border-width: 1rpx; |
| | | border-style: solid; |
| | | } |
| | | .btn-link-primary { |
| | | color: #ffffff; |
| | | background: #2979ff; |
| | | border-color: #2979ff; |
| | | } |
| | | .btn-link-warn { |
| | | color: #ff9f1a; |
| | | background: rgba(255, 159, 26, 0.08); |
| | | border-color: rgba(255, 159, 26, 0.6); |
| | | } |
| | | .btn-link-plain { |
| | | color: #666666; |
| | | background: #f5f5f5; |
| | | border-color: #e0e0e0; |
| | | } |
| | | .btn-link.disabled { |
| | | color: #cccccc; |
| | | background: #f5f5f5; |
| | | border-color: #e0e0e0; |
| | | } |
| | | .no-data { text-align: center; padding: 80rpx 0; color: #999; font-size: 28rpx; } |
| | | |
| | | /* å³ä¸è§æµ®å¨æ°å¢æé® */ |
| | | .fab-button { |
| | | position: fixed; |
| | | bottom: calc(30px + env(safe-area-inset-bottom)); |
| | | right: 30px; |
| | | width: 56px; |
| | | height: 56px; |
| | | background: #2979ff; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3); |
| | | z-index: 1000; |
| | | } |
| | | |
| | | .popup-inner { padding: 40rpx; min-width: 560rpx; background: #fff; } |
| | | .popup-title { font-size: 32rpx; font-weight: 500; margin-bottom: 32rpx; } |
| | | .form-row { margin-bottom: 24rpx; } |
| | | .form-row .form-label { display: block; font-size: 26rpx; color: #666; margin-bottom: 12rpx; } |
| | | .date-picker-trigger { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 20rpx 24rpx; |
| | | background: #f5f5f5; |
| | | border-radius: 12rpx; |
| | | font-size: 28rpx; |
| | | } |
| | | .date-picker-text { color: #333; } |
| | | .date-picker-text.placeholder { color: #999; } |
| | | .popup-footer { display: flex; gap: 24rpx; margin-top: 40rpx; } |
| | | .btn-cancel { flex: 1; text-align: center; padding: 24rpx; background: #f0f0f0; border-radius: 12rpx; } |
| | | .btn-ok { flex: 1; text-align: center; padding: 24rpx; background: #2979ff; color: #fff; border-radius: 12rpx; } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="subtract-page"> |
| | | <PageHeader title="åºååºåº" @back="goBack" /> |
| | | |
| | | <scroll-view scroll-y class="content-scroll"> |
| | | <view class="form-section"> |
| | | <view class="form-row"> |
| | | <text class="form-label">产ååç§°</text> |
| | | <up-input v-model="form.productName" disabled /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">è§æ ¼</text> |
| | | <up-input v-model="form.model" disabled /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">åä½</text> |
| | | <up-input v-model="form.unit" disabled /> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="form-section"> |
| | | <view class="section-title">åºåº/è¿ç£
ä¿¡æ¯</view> |
| | | <view class="form-row"> |
| | | <text class="form-label">车çå·</text> |
| | | <up-input v-model="form.licensePlateNo" placeholder="请è¾å
¥è½¦çå·" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">æ¯é(å¨)</text> |
| | | <up-input |
| | | v-model="form.grossWeight" |
| | | type="number" |
| | | placeholder="请è¾å
¥æ¯é" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">ç®é(å¨)</text> |
| | | <up-input |
| | | v-model="form.tareWeight" |
| | | type="number" |
| | | placeholder="请è¾å
¥ç®é" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">åé(å¨)</text> |
| | | <up-input |
| | | v-model="form.netWeight" |
| | | type="number" |
| | | disabled |
| | | placeholder="èªå¨è®¡ç®" |
| | | /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">è¿ç£
æ¥æ</text> |
| | | <view class="selector-trigger" @click="openWeighingDatePicker"> |
| | | <text class="selector-text" :class="{ placeholder: !form.weighingDate }"> |
| | | {{ form.weighingDate || 'è¯·éæ©è¿ç£
æ¥æ' }} |
| | | </text> |
| | | <up-icon name="calendar" size="16" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">è¿ç£
å</text> |
| | | <up-input v-model="form.weighingOperator" placeholder="请è¾å
¥è¿ç£
å" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label">夿³¨</text> |
| | | <up-input v-model="form.remark" type="textarea" placeholder="éå¡«" /> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | |
| | | <view class="bottom-bar"> |
| | | <view class="btn-submit" @click="handleSubmit">åºåº</view> |
| | | </view> |
| | | |
| | | <!-- è¿ç£
æ¥æéæ©å¨ --> |
| | | <up-popup :show="showWeighingDatePicker" mode="bottom" @close="showWeighingDatePicker = false"> |
| | | <up-datetime-picker |
| | | :show="true" |
| | | v-model="weighingDateValue" |
| | | mode="datetime" |
| | | @confirm="onWeighingDateConfirm" |
| | | @cancel="showWeighingDatePicker = false" |
| | | /> |
| | | </up-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, watch } from 'vue' |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import dayjs from 'dayjs' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { subtractStockInventory } from '@/api/inventoryManagement/stockInventory.js' |
| | | import { subtractStockUnInventory } from '@/api/inventoryManagement/stockUninventory.js' |
| | | |
| | | const form = reactive({ |
| | | id: undefined, |
| | | // 产åååºååºç¡ä¿¡æ¯ï¼æ¥èªå表记å½ï¼ |
| | | productId: undefined, |
| | | productModelId: undefined, |
| | | parentId: undefined, |
| | | parentName: '', |
| | | productName: '', |
| | | model: '', |
| | | unit: '', |
| | | qualitity: undefined, |
| | | lockedQuantity: undefined, |
| | | unLockedQuantity: undefined, |
| | | warnNum: undefined, |
| | | currentStock: undefined, |
| | | totalStockIn: undefined, |
| | | totalStockOut: undefined, |
| | | createTime: '', |
| | | updateTime: '', |
| | | version: undefined, |
| | | // åºåº/è¿ç£
ä¿¡æ¯ |
| | | licensePlateNo: '', |
| | | grossWeight: '', |
| | | tareWeight: '', |
| | | netWeight: '', |
| | | weighingDate: '', |
| | | weighingOperator: '', |
| | | remark: '' |
| | | }) |
| | | |
| | | const type = ref('0') // 0 åæ ¼åºåï¼1 ä¸åæ ¼åºå |
| | | const showWeighingDatePicker = ref(false) |
| | | const weighingDateValue = ref(Date.now()) |
| | | |
| | | onLoad((options) => { |
| | | if (options && options.type != null) { |
| | | type.value = options.type |
| | | } |
| | | const cached = uni.getStorageSync('stockSubtractRecord') |
| | | if (cached) { |
| | | try { |
| | | const payload = typeof cached === 'string' ? JSON.parse(cached) : cached |
| | | const item = payload && payload.item ? payload.item : payload |
| | | // å°å表记å½ç宿´å段æ·è´å°è¡¨åä¸ï¼ä¿æä¸ PC 端 Subtract.vue ä¸è´ |
| | | Object.assign(form, item) |
| | | uni.removeStorageSync('stockSubtractRecord') |
| | | } catch (e) { |
| | | uni.removeStorageSync('stockSubtractRecord') |
| | | } |
| | | } |
| | | }) |
| | | |
| | | // åé = æ¯é - ç®é |
| | | const computeNetWeight = () => { |
| | | const gross = Number(form.grossWeight) |
| | | const tare = Number(form.tareWeight) |
| | | if (!isNaN(gross) && !isNaN(tare)) { |
| | | const net = Number((gross - tare).toFixed(2)) |
| | | form.netWeight = net > 0 ? net : 0 |
| | | } else { |
| | | form.netWeight = '' |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => [form.grossWeight, form.tareWeight], |
| | | () => { |
| | | computeNetWeight() |
| | | } |
| | | ) |
| | | |
| | | const openWeighingDatePicker = () => { |
| | | weighingDateValue.value = form.weighingDate |
| | | ? dayjs(form.weighingDate, 'YYYY-MM-DD HH:mm:ss').valueOf() |
| | | : Date.now() |
| | | showWeighingDatePicker.value = true |
| | | } |
| | | |
| | | const onWeighingDateConfirm = (e) => { |
| | | const ts = e?.value ?? weighingDateValue.value |
| | | form.weighingDate = dayjs(ts).format('YYYY-MM-DD HH:mm:ss') |
| | | showWeighingDatePicker.value = false |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | if (!form.id) { |
| | | uni.showToast({ title: 'è®°å½ä¿¡æ¯ç¼ºå¤±ï¼æ æ³åºåº', icon: 'none' }) |
| | | return |
| | | } |
| | | const payload = { ...form } |
| | | const api = type.value === '0' ? subtractStockInventory : subtractStockUnInventory |
| | | api(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: 'åºåºæå', icon: 'success' }) |
| | | setTimeout(() => { |
| | | uni.navigateBack() |
| | | }, 400) |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: 'åºåºå¤±è´¥', icon: 'none' }) |
| | | }) |
| | | } |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .subtract-page { |
| | | min-height: 100vh; |
| | | background: #f5f5f5; |
| | | padding-bottom: 100rpx; |
| | | } |
| | | .content-scroll { |
| | | height: calc(100vh - 100rpx); |
| | | } |
| | | .form-section { |
| | | background: #fff; |
| | | margin: 24rpx; |
| | | padding: 24rpx; |
| | | border-radius: 16rpx; |
| | | } |
| | | .section-title { |
| | | font-size: 28rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | .form-row { |
| | | margin-bottom: 24rpx; |
| | | } |
| | | .form-label { |
| | | display: block; |
| | | font-size: 26rpx; |
| | | color: #666; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | .selector-trigger { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 20rpx 24rpx; |
| | | background: #f5f5f5; |
| | | border-radius: 12rpx; |
| | | } |
| | | .selector-text { |
| | | font-size: 28rpx; |
| | | color: #333; |
| | | } |
| | | .selector-text.placeholder { |
| | | color: #999; |
| | | } |
| | | .bottom-bar { |
| | | position: fixed; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom)); |
| | | background: #fff; |
| | | box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04); |
| | | } |
| | | .btn-submit { |
| | | height: 88rpx; |
| | | border-radius: 999rpx; |
| | | background: #2979ff; |
| | | color: #fff; |
| | | font-size: 30rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="detail-page"> |
| | | <PageHeader title="åºå详æ
" @back="goBack" /> |
| | | <view v-if="loading" class="loading-wrap"> |
| | | <text class="loading-text">å è½½ä¸...</text> |
| | | </view> |
| | | <view v-else-if="detail" class="detail-wrap"> |
| | | <!-- åºç¡ä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">åºç¡ä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">åºå·</text> |
| | | <text class="value">{{ detail.index ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">产å大类</text> |
| | | <text class="value value-strong">{{ detail.productName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è§æ ¼åå·</text> |
| | | <text class="value">{{ detail.model || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åä½</text> |
| | | <text class="value">{{ detail.unit || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- åºåä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">åºåä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">æ»åºåæ°</text> |
| | | <text class="value value-num">{{ detail.qualitity ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">å»ç»æ°é</text> |
| | | <text class="value">{{ detail.lockedQuantity ?? 0 }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">å¯ç¨åºå</text> |
| | | <text class="value">{{ detail.unLockedQuantity ?? (detail.qualitity - (detail.lockedQuantity || 0)) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">æè¿æ´æ°æ¶é´</text> |
| | | <text class="value">{{ detail.updateTime || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="empty"> |
| | | <text class="empty-text">ææ è¯¦æ
æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | |
| | | const detail = ref(null) |
| | | const loading = ref(true) |
| | | |
| | | function normalizeDetail(raw) { |
| | | if (!raw) return null |
| | | const d = typeof raw === 'object' ? raw : {} |
| | | return { |
| | | index: d.index ?? 1, |
| | | productName: d.productName, |
| | | model: d.model, |
| | | unit: d.unit, |
| | | qualitity: d.qualitity, |
| | | lockedQuantity: d.lockedQuantity, |
| | | unLockedQuantity: d.unLockedQuantity, |
| | | updateTime: d.updateTime |
| | | } |
| | | } |
| | | |
| | | onLoad(() => { |
| | | const cached = uni.getStorageSync('stockDetailItem') |
| | | if (cached) { |
| | | try { |
| | | const payload = typeof cached === 'string' ? JSON.parse(cached) : cached |
| | | const item = payload && payload.item != null ? payload.item : payload |
| | | detail.value = normalizeDetail({ ...item, index: 1 }) |
| | | uni.removeStorageSync('stockDetailItem') |
| | | } catch (e) { |
| | | uni.removeStorageSync('stockDetailItem') |
| | | } |
| | | } |
| | | loading.value = false |
| | | }) |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .detail-page { |
| | | min-height: 100vh; |
| | | background: linear-gradient(180deg, #e8eef7 0%, #f2f5fa 100%); |
| | | padding-bottom: 48rpx; |
| | | } |
| | | .loading-wrap { |
| | | padding: 120rpx 48rpx; |
| | | text-align: center; |
| | | } |
| | | .loading-text { |
| | | color: #8c9aa8; |
| | | font-size: 28rpx; |
| | | } |
| | | .empty { |
| | | padding: 120rpx 48rpx; |
| | | text-align: center; |
| | | } |
| | | .empty-text { |
| | | color: #8c9aa8; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-wrap { |
| | | padding: 24rpx 24rpx 32rpx; |
| | | } |
| | | .section-card { |
| | | background: #fff; |
| | | border-radius: 24rpx; |
| | | overflow: hidden; |
| | | margin-bottom: 28rpx; |
| | | box-shadow: 0 8rpx 32rpx rgba(41, 121, 255, 0.06); |
| | | border: 1rpx solid rgba(41, 121, 255, 0.06); |
| | | } |
| | | .section-head { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 28rpx 32rpx; |
| | | background: linear-gradient(135deg, #f8fbff 0%, #f0f6ff 100%); |
| | | border-bottom: 1rpx solid #eef3fa; |
| | | } |
| | | .section-dot { |
| | | width: 8rpx; |
| | | height: 8rpx; |
| | | border-radius: 50%; |
| | | background: #2979ff; |
| | | margin-right: 16rpx; |
| | | } |
| | | .section-title { |
| | | font-size: 30rpx; |
| | | font-weight: 600; |
| | | color: #1e3a5f; |
| | | letter-spacing: 0.5rpx; |
| | | } |
| | | .section-body { |
| | | padding: 8rpx 32rpx 24rpx; |
| | | } |
| | | .detail-row { |
| | | display: flex; |
| | | align-items: center; |
| | | min-height: 96rpx; |
| | | padding: 0 16rpx; |
| | | border-radius: 12rpx; |
| | | font-size: 28rpx; |
| | | margin-bottom: 4rpx; |
| | | } |
| | | .detail-row .label { |
| | | width: 220rpx; |
| | | flex-shrink: 0; |
| | | color: #6b7c93; |
| | | font-size: 26rpx; |
| | | } |
| | | .detail-row .value { |
| | | flex: 1; |
| | | color: #2c3e50; |
| | | text-align: right; |
| | | word-break: break-all; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-row .value-strong { |
| | | color: #1e3a5f; |
| | | font-weight: 500; |
| | | } |
| | | .detail-row .value-num { |
| | | color: #2979ff; |
| | | font-weight: 600; |
| | | font-size: 32rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="report-page"> |
| | | <PageHeader title="åºåæ¥è¡¨" @back="goBack" /> |
| | | |
| | | <!-- æ¥è¡¨ç±»å --> |
| | | <view class="tabs-wrap"> |
| | | <view |
| | | v-for="t in reportTypes" |
| | | :key="t.value" |
| | | class="tab-item" |
| | | :class="{ active: searchForm.reportType === t.value }" |
| | | @click="searchForm.reportType = t.value" |
| | | > |
| | | <text>{{ t.label }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- æ¶é´éæ©åºåå·²å»é¤ï¼ä½¿ç¨é»è®¤æ¥æé»è¾ --> |
| | | |
| | | <!-- å表 + æ»å¨å页 --> |
| | | <view class="list-section"> |
| | | <view class="section-header"> |
| | | <text class="table-title">{{ tableTitle }}</text> |
| | | </view> |
| | | <view v-if="tableData.length > 0"> |
| | | <view v-for="(item, index) in tableData" :key="index" class="card-item"> |
| | | <view class="card-header"> |
| | | <view class="header-main"> |
| | | <text class="product-name">{{ item.productName }}</text> |
| | | <text class="sub-title">{{ item.model }}</text> |
| | | </view> |
| | | </view> |
| | | <up-divider /> |
| | | <view class="card-body"> |
| | | <view class="row"><text class="l">åä½</text><text class="r">{{ item.unit }}</text></view> |
| | | <view class="row" v-if="searchForm.reportType !== 'inout'"><text class="l">å
¥åºæ¶é´</text><text class="r">{{ item.createTime }}</text></view> |
| | | <view class="row" v-if="searchForm.reportType !== 'inout'"><text class="l">å
¥åºæ¹æ¬¡</text><text class="r">{{ item.inboundBatches }}</text></view> |
| | | <view class="row"><text class="l">å
¥åºæ°é</text><text class="r">{{ item.totalStockIn ?? item.stockInNum }}</text></view> |
| | | <view class="row" v-if="searchForm.reportType === 'inout'"><text class="l">åºåºæ°é</text><text class="r">{{ item.totalStockOut }}</text></view> |
| | | <view class="row"><text class="l">ç°å¨åºå</text><text class="r highlight">{{ item.currentStock }}</text></view> |
| | | <view class="row" v-if="item.createBy"><text class="l">å
¥åºäºº</text><text class="r">{{ item.createBy }}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="load-more-wrap"> |
| | | <u-loadmore :status="loadStatus" @loadmore="loadMore" /> |
| | | </view> |
| | | </view> |
| | | <view v-else class="no-data">ææ æ°æ®</view> |
| | | </view> |
| | | |
| | | <up-popup :show="showDatePicker" mode="bottom" @close="showDatePicker = false"> |
| | | <up-datetime-picker |
| | | v-model="dateValue" |
| | | :mode="datePickerMode" |
| | | @confirm="onDateConfirm" |
| | | @cancel="showDatePicker = false" |
| | | /> |
| | | </up-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, computed, watch } from 'vue' |
| | | import dayjs from 'dayjs' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { formatDateToYMD } from '@/utils/ruoyi' |
| | | import { onShow, onReachBottom } from '@dcloudio/uni-app' |
| | | import { |
| | | getStockInventoryReportList, |
| | | getStockInventoryInAndOutReportList |
| | | } from '@/api/inventoryManagement/stockInventory.js' |
| | | |
| | | const reportTypes = [ |
| | | { label: 'æ¥æ¥', value: 'daily' }, |
| | | { label: 'ææ¥', value: 'monthly' }, |
| | | { label: 'è¿åºåæ¥è¡¨', value: 'inout' } |
| | | ] |
| | | const tableData = ref([]) |
| | | const showDatePicker = ref(false) |
| | | const dateValue = ref(Date.now()) |
| | | const datePickerTarget = ref('') // single | startMonth | endMonth |
| | | const loadStatus = ref('loadmore') // loadmore | loading | nomore | error |
| | | const page = reactive({ current: 1, size: 20 }) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | reportType: 'daily', |
| | | singleDate: '', |
| | | startMonth: '', |
| | | endMonth: '', |
| | | startDate: '', |
| | | endDate: '' |
| | | } |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | const datePickerMode = computed(() => { |
| | | if (datePickerTarget.value === 'startMonth' || datePickerTarget.value === 'endMonth') return 'month' |
| | | return 'date' |
| | | }) |
| | | |
| | | const tableTitle = computed(() => { |
| | | const m = { daily: 'æ¥æ¥è¯¦ç»æ°æ®', monthly: 'ææ¥è¯¦ç»æ°æ®', inout: 'è¿åºåæ¥è¡¨è¯¦ç»æ°æ®' } |
| | | return m[searchForm.value.reportType] || 'æ¥è¡¨æ°æ®' |
| | | }) |
| | | |
| | | const getQueryParams = () => { |
| | | const p = { |
| | | reportType: searchForm.value.reportType, |
| | | current: page.current, |
| | | size: page.size |
| | | } |
| | | if (searchForm.value.reportType === 'daily') { |
| | | p.reportDate = searchForm.value.singleDate |
| | | } else if (searchForm.value.reportType === 'monthly') { |
| | | p.startMonth = searchForm.value.startMonth |
| | | p.endMonth = searchForm.value.endMonth |
| | | } else if (searchForm.value.reportType === 'monthly') { |
| | | p.startMonth = searchForm.value.startMonth |
| | | p.endMonth = searchForm.value.endMonth |
| | | } else { |
| | | p.startDate = searchForm.value.startDate |
| | | p.endDate = searchForm.value.endDate |
| | | } |
| | | return p |
| | | } |
| | | |
| | | const getList = () => { |
| | | const isFirstPage = page.current === 1 |
| | | if (isFirstPage) { |
| | | uni.showLoading({ title: 'æ¥è¯¢ä¸...', mask: true }) |
| | | } |
| | | const params = getQueryParams() |
| | | const isInout = searchForm.value.reportType === 'inout' |
| | | const api = isInout ? getStockInventoryInAndOutReportList : getStockInventoryReportList |
| | | api(params) |
| | | .then(res => { |
| | | uni.hideLoading() |
| | | const records = res.data?.records || [] |
| | | const total = res.data?.total || records.length |
| | | if (isFirstPage) { |
| | | tableData.value = records |
| | | } else { |
| | | tableData.value = [...tableData.value, ...records] |
| | | } |
| | | if (tableData.value.length >= total || total === 0) { |
| | | loadStatus.value = 'nomore' |
| | | } else { |
| | | loadStatus.value = 'loadmore' |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | uni.hideLoading() |
| | | loadStatus.value = 'error' |
| | | if (isFirstPage) { |
| | | uni.showToast({ title: 'æ¥è¯¢å¤±è´¥', icon: 'none' }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | loadStatus.value = 'loadmore' |
| | | getList() |
| | | } |
| | | |
| | | const loadMore = () => { |
| | | if (loadStatus.value === 'nomore' || loadStatus.value === 'loading') return |
| | | loadStatus.value = 'loading' |
| | | page.current++ |
| | | getList() |
| | | } |
| | | |
| | | const openDatePicker = (target) => { |
| | | datePickerTarget.value = target |
| | | let val = '' |
| | | if (target === 'single') val = searchForm.value.singleDate |
| | | else if (target === 'startMonth') val = searchForm.value.startMonth |
| | | else if (target === 'endMonth') val = searchForm.value.endMonth |
| | | dateValue.value = val ? new Date(val).getTime() : Date.now() |
| | | showDatePicker.value = true |
| | | } |
| | | |
| | | const onDateConfirm = (e) => { |
| | | const isMonth = datePickerTarget.value === 'startMonth' || datePickerTarget.value === 'endMonth' |
| | | const str = isMonth ? dayjs(e.value).format('YYYY-MM') : formatDateToYMD(e.value) |
| | | if (datePickerTarget.value === 'single') searchForm.value.singleDate = str |
| | | else if (datePickerTarget.value === 'startMonth') searchForm.value.startMonth = str |
| | | else if (datePickerTarget.value === 'endMonth') searchForm.value.endMonth = str |
| | | showDatePicker.value = false |
| | | handleQuery() |
| | | } |
| | | |
| | | // åå§åï¼æ¥æ¥é»è®¤ä»å¤©ï¼ææ¥é»è®¤æ¬æï¼è¿åºåé»è®¤æè¿7天 |
| | | const initDefaultDates = () => { |
| | | const today = dayjs() |
| | | if (!searchForm.value.singleDate) { |
| | | searchForm.value.singleDate = today.format('YYYY-MM-DD') |
| | | } |
| | | if (!searchForm.value.startMonth || !searchForm.value.endMonth) { |
| | | const startOfMonth = today.startOf('month').format('YYYY-MM-DD') |
| | | const endOfMonth = today.endOf('month').format('YYYY-MM-DD') |
| | | searchForm.value.startMonth = startOfMonth |
| | | searchForm.value.endMonth = endOfMonth |
| | | } |
| | | if (!searchForm.value.startDate || !searchForm.value.endDate) { |
| | | searchForm.value.endDate = today.format('YYYY-MM-DD') |
| | | searchForm.value.startDate = today.subtract(6, 'day').format('YYYY-MM-DD') |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => searchForm.value.reportType, |
| | | () => { |
| | | // 忢æ¥è¡¨ç±»åæ¶ä¿çå·²ç®å¥½çé»è®¤æ¶é´ï¼åªéæ¥ |
| | | handleQuery() |
| | | } |
| | | ) |
| | | |
| | | onShow(() => { |
| | | initDefaultDates() |
| | | handleQuery() |
| | | }) |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .report-page { min-height: 100vh; background: #f5f5f5; padding-bottom: 40rpx; } |
| | | .tabs-wrap { display: flex; background: #fff; padding: 24rpx; gap: 24rpx; } |
| | | .tab-item { flex: 1; text-align: center; padding: 20rpx; border-radius: 12rpx; background: #f0f0f0; font-size: 28rpx; color: #666; } |
| | | .tab-item.active { background: #2979ff; color: #fff; } |
| | | .search-section { background: #fff; margin: 24rpx; padding: 24rpx; border-radius: 16rpx; } |
| | | .search-row { display: flex; align-items: center; margin-bottom: 0; flex-wrap: wrap; } |
| | | .search-row .label { width: 140rpx; font-size: 26rpx; color: #666; } |
| | | .search-row .label.end { margin-left: 24rpx; } |
| | | .date-picker { flex: 1; min-width: 200rpx; padding: 20rpx; background: #f5f5f5; border-radius: 12rpx; font-size: 28rpx; } |
| | | .btn-row { display: flex; gap: 24rpx; margin-top: 24rpx; } |
| | | .btn-query { flex: 1; text-align: center; padding: 24rpx; background: #2979ff; color: #fff; border-radius: 12rpx; } |
| | | .btn-reset { flex: 1; text-align: center; padding: 24rpx; background: #e0e0e0; border-radius: 12rpx; } |
| | | .list-section { margin: 24rpx; } |
| | | .section-header { |
| | | margin-bottom: 16rpx; |
| | | padding: 16rpx 20rpx; |
| | | } |
| | | .table-title { font-size: 30rpx; font-weight: 500; color: #333; } |
| | | .card-item { |
| | | background: #fff; |
| | | border-radius: 16rpx; |
| | | padding: 20rpx 24rpx; |
| | | margin-bottom: 20rpx; |
| | | box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); |
| | | } |
| | | .card-header { |
| | | padding: 4rpx 0 12rpx; |
| | | } |
| | | .header-main { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 6rpx; |
| | | } |
| | | .product-name { |
| | | font-size: 30rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | } |
| | | .sub-title { |
| | | font-size: 24rpx; |
| | | color: #999; |
| | | } |
| | | .card-body .row { display: flex; justify-content: space-between; padding: 6rpx 0; font-size: 26rpx; } |
| | | .card-body .l { color: #666; } .card-body .r { color: #333; } .card-body .r.highlight { color: #2979ff; font-weight: 500; } |
| | | .no-data { text-align: center; padding: 60rpx 0; color: #999; font-size: 28rpx; } |
| | | .load-more-wrap { padding: 24rpx 0 8rpx; } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="detail-page"> |
| | | <PageHeader title="åºåæ¥è¡¨è¯¦æ
" @back="goBack" /> |
| | | <view v-if="detail" class="detail-wrap"> |
| | | <!-- åºç¡ä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">åºç¡ä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row"> |
| | | <text class="label">åºå·</text> |
| | | <text class="value">{{ detail.index ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">产å大类</text> |
| | | <text class="value value-strong">{{ detail.productName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">è§æ ¼åå·</text> |
| | | <text class="value">{{ detail.model || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">åä½</text> |
| | | <text class="value">{{ detail.unit || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- æ¥è¡¨ä¿¡æ¯ --> |
| | | <view class="section-card"> |
| | | <view class="section-head"> |
| | | <view class="section-dot"></view> |
| | | <text class="section-title">æ¥è¡¨ä¿¡æ¯</text> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="detail-row" v-if="type !== 'inout'"> |
| | | <text class="label">å
¥åºæ¶é´</text> |
| | | <text class="value">{{ detail.createTime || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row" v-if="type !== 'inout'"> |
| | | <text class="label">å
¥åºæ¹æ¬¡</text> |
| | | <text class="value">{{ detail.inboundBatches || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="label">å
¥åºæ°é</text> |
| | | <text class="value">{{ detail.totalStockIn ?? detail.stockInNum ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row" v-if="type === 'inout'"> |
| | | <text class="label">åºåºæ°é</text> |
| | | <text class="value">{{ detail.totalStockOut ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row detail-row-highlight"> |
| | | <text class="label">ç°å¨åºå</text> |
| | | <text class="value value-num">{{ detail.currentStock ?? '-' }}</text> |
| | | </view> |
| | | <view class="detail-row" v-if="detail.createBy"> |
| | | <text class="label">å
¥åºäºº</text> |
| | | <text class="value">{{ detail.createBy }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="empty"> |
| | | <text class="empty-text">ææ è¯¦æ
æ°æ®</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | |
| | | const detail = ref(null) |
| | | const type = ref('daily') |
| | | |
| | | onLoad(() => { |
| | | const cached = uni.getStorageSync('stockReportDetail') |
| | | if (cached) { |
| | | try { |
| | | const payload = typeof cached === 'string' ? JSON.parse(cached) : cached |
| | | type.value = payload?.type || 'daily' |
| | | detail.value = payload?.item || null |
| | | uni.removeStorageSync('stockReportDetail') |
| | | } catch (e) { |
| | | uni.removeStorageSync('stockReportDetail') |
| | | } |
| | | } |
| | | }) |
| | | |
| | | const goBack = () => uni.navigateBack() |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .detail-page { |
| | | min-height: 100vh; |
| | | background: #f5f5f5; |
| | | padding-bottom: 40rpx; |
| | | } |
| | | .detail-wrap { |
| | | padding: 24rpx; |
| | | } |
| | | .empty { |
| | | padding: 120rpx 48rpx; |
| | | text-align: center; |
| | | } |
| | | .empty-text { |
| | | color: #8c9aa8; |
| | | font-size: 28rpx; |
| | | } |
| | | .section-card { |
| | | background: #fff; |
| | | border-radius: 16rpx; |
| | | margin-bottom: 20rpx; |
| | | box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); |
| | | overflow: hidden; |
| | | } |
| | | .section-head { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 20rpx 24rpx; |
| | | border-bottom: 1rpx solid #eee; |
| | | } |
| | | .section-dot { |
| | | width: 8rpx; |
| | | height: 8rpx; |
| | | border-radius: 50%; |
| | | background: #2979ff; |
| | | margin-right: 12rpx; |
| | | } |
| | | .section-title { |
| | | font-size: 30rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | } |
| | | .section-body { |
| | | padding: 12rpx 24rpx 20rpx; |
| | | } |
| | | .detail-row { |
| | | display: flex; |
| | | align-items: center; |
| | | min-height: 80rpx; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-row .label { |
| | | width: 200rpx; |
| | | flex-shrink: 0; |
| | | color: #6b7c93; |
| | | font-size: 26rpx; |
| | | } |
| | | .detail-row .value { |
| | | flex: 1; |
| | | color: #2c3e50; |
| | | text-align: right; |
| | | word-break: break-all; |
| | | font-size: 28rpx; |
| | | } |
| | | .detail-row .value-strong { |
| | | color: #1e3a5f; |
| | | font-weight: 500; |
| | | } |
| | | .detail-row .value-num { |
| | | color: #2979ff; |
| | | font-weight: 600; |
| | | font-size: 32rpx; |
| | | } |
| | | .detail-row-highlight { |
| | | margin-top: 8rpx; |
| | | } |
| | | </style> |
| | | |
| | |
| | | count |
| | | :autoHeight="true" /> |
| | | </u-form-item> |
| | | <u-form-item label="鿣å
·ä½ä½ç½®" |
| | | prop="location" |
| | | required |
| | | border-bottom> |
| | | <u-input v-model="form.location" |
| | | placeholder="请è¾å
¥éæ£å
·ä½ä½ç½®" /> |
| | | </u-form-item> |
| | | <u-form-item label="æ´æ¹å®ææé" |
| | | prop="rectifyTime" |
| | | required |
| | |
| | | type: "", |
| | | riskLevel: "", |
| | | hiddenDesc: "", |
| | | location: "", |
| | | rectifyTime: "", |
| | | rectifyUserName: "", |
| | | rectifyUserMobile: "", |
| | |
| | | |
| | | if (!form.value.hiddenDesc) { |
| | | showToast("请è¾å
¥éæ£æè¿°"); |
| | | return; |
| | | } |
| | | |
| | | if (!form.value.location) { |
| | | showToast("请è¾å
¥éæ£å
·ä½ä½ç½®"); |
| | | return; |
| | | } |
| | | |