湟水峡
1.采购模块不要项目名称
2.加一个有待回款登记的提示
3.回款登记、付款登记改成和销售订单价格关联,并且可以多个一起回款或付款
4.合同管理不要下载合同了,跟合同相关的字段可以去掉了
5.重构生产模块
6.测试流程并修改bug
已添加40个文件
已重命名1个文件
已修改82个文件
已删除1个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request.js"; |
| | | |
| | | export function productModelList(query) { |
| | | return request({ |
| | | url: '/basic/product/pageModel', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // å·¥åºå表å页æ¥è¯¢ |
| | | export function productProcessListPage(query) { |
| | | return request({ |
| | | url: '/productProcess/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢éä»¶å表 |
| | | export function fileListPage(query) { |
| | | return request({ |
| | | url: "/basic/supplierManageFile/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // ä¿åéä»¶å表 |
| | | export function fileAdd(query) { |
| | | return request({ |
| | | url: "/basic/supplierManageFile/add", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | // å é¤éä»¶å表 |
| | | export function fileDel(query) { |
| | | return request({ |
| | | url: "/basic/supplierManageFile/del", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | | } |
| | |
| | | method: 'get', |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢å
¬åç±»åå表 |
| | | export function listNoticeType() { |
| | | return request({ |
| | | url: '/noticeType/list', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢å
¬åç±»å |
| | | export function addNoticeType(data) { |
| | | return request({ |
| | | url: '/noticeType/add', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤å
¬åç±»å |
| | | export function delNoticeType(id) { |
| | | return request({ |
| | | url: '/noticeType/del', |
| | | method: 'delete', |
| | | data: { id } |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // éä»¶å表 |
| | | export function listRuleFiles(query) { |
| | | return request({ |
| | | url: "/rulesRegulationsManagementFile/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢éä»¶ |
| | | export function addRuleFile(data) { |
| | | return request({ |
| | | url: "/rulesRegulationsManagementFile/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤éä»¶ï¼æ¯æä¼ é id æ°ç»ï¼ |
| | | export function delRuleFile(ids) { |
| | | return request({ |
| | | url: "/rulesRegulationsManagementFile/del", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | |
| | | method: "get", |
| | | params: { |
| | | ...page, |
| | | ...query |
| | | ...query, |
| | | }, |
| | | }); |
| | | } |
| | |
| | | return request({ |
| | | url: "/vehicleManagement/add", |
| | | method: "post", |
| | | data: data, |
| | | data, |
| | | }); |
| | | } |
| | | |
| | |
| | | return request({ |
| | | url: "/vehicleManagement/update", |
| | | method: "post", |
| | | data: data, |
| | | data, |
| | | }); |
| | | } |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®idæ¥è¯¢è½¦è¾è¯¦æ
|
| | | // æ ¹æ® id æ¥è¯¢è½¦è¾ |
| | | export function getVehicleById(id) { |
| | | return request({ |
| | | url: "/vehicleManagement/getById/" + id, |
| | | method: "get" |
| | | url: `/vehicleManagement/getById/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | |
| | | return request({ |
| | | url: "/vehicleManagement/useVehicle", |
| | | method: "post", |
| | | data: data, |
| | | data, |
| | | }); |
| | | } |
| | | |
| | |
| | | return request({ |
| | | url: "/vehicleManagement/returnVehicle", |
| | | method: "post", |
| | | data: data, |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // æ¥è¯¢è½¦è¾ä½¿ç¨è®°å½ |
| | | // 使ç¨è®°å½ |
| | | export function getVehicleUsageRecords(page, query) { |
| | | return request({ |
| | | url: "/vehicleManagement/getUsageRecords", |
| | | method: "get", |
| | | params: { |
| | | ...page, |
| | | ...query |
| | | ...query, |
| | | }, |
| | | }); |
| | | } |
| | |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | // å é¤è®°å½ |
| | | export function ledgerRecordDelete(ids) { |
| | | return request({ |
| | | url: "/measuringInstrumentLedgerRecord/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // 计éå¨å
·å°è´¦-æ°å¢ |
| | | // /measuringInstrumentLedger/add |
| | | export function addMeasuringInstrumentLedger(data){ |
| | | return request({ |
| | | url:"/measuringInstrumentLedger/add", |
| | | method:"post", |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // 计éå¨å
·å°è´¦-ç¼è¾ |
| | | // /measuringInstrumentLedger/update |
| | | export function updateMeasuringInstrumentLedger(data){ |
| | | return request({ |
| | | url:"/measuringInstrumentLedger/update", |
| | | method:"post", |
| | | data |
| | | }) |
| | | } |
| | |
| | | method: "delete", |
| | | }); |
| | | }; |
| | | // æ·»å 设å¤ä¿å
»å®æ¶ä»»å¡ |
| | | export const deviceMaintenanceTaskAdd = (params) => { |
| | | return request({ |
| | | url: '/deviceMaintenanceTask/add', |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | }; |
| | | // ä¿®æ¹è®¾å¤ä¿å
»å®æ¶ä»»å¡ |
| | | export const deviceMaintenanceTaskEdit = (params) => { |
| | | return request({ |
| | | url: '/deviceMaintenanceTask/update', |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | }; |
| | | // 设å¤ä¿å
»å®æ¶ä»»å¡å表 |
| | | export const deviceMaintenanceTaskList = (params) => { |
| | | return request({ |
| | | url: '/deviceMaintenanceTask/listPage', |
| | | method: "get", |
| | | params: params, |
| | | }); |
| | | }; |
| | | // 设å¤ä¿å
»å®æ¶ä»»å¡å表 |
| | | export const deviceMaintenanceTaskDel = (params) => { |
| | | return request({ |
| | | url: '/deviceMaintenanceTask/delete', |
| | | method: "delete", |
| | | data: params, |
| | | }); |
| | | }; |
| | |
| | | }); |
| | | }; |
| | | |
| | | // æ¥è¯¢ç产å
¥åºä¿¡æ¯å表 |
| | | export const getStockInPageByProductProduction = (params) => { |
| | | return request({ |
| | | url: "/stockin/listPageByProductProduction", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | // åºåºå°è´¦-æ¥è¯¢èªå®ä¹å
¥åºä¿¡æ¯å表 |
| | | export const getStockInPageByCustom = (params) => { |
| | | return request({ |
| | |
| | | data, |
| | | }); |
| | | }; |
| | | // ä¿®æ¹ææåºåä¿¡æ¯ |
| | | export const updateManagementByCustom = (data) => { |
| | | return request({ |
| | | url: "/stockin/updateManagementByCustom ", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | }; |
| | | |
| | | // æ°å¢ååå
¥åºä¿¡æ¯ |
| | | export function addSutockIn(data) { |
| | |
| | | export function updateStockInCustom(data) { |
| | | return request({ |
| | | url: '/stockin/updateCustom', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | // ç¼è¾æåå
¥åºä¿¡æ¯ |
| | | export function updateProduct(data) { |
| | | return request({ |
| | | url: '/stockin/update', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | |
| | | } |
| | | |
| | | |
| | | // |
| | | //æ¥è¯¢åºåå¾è¡¨æ°æ® |
| | | export function getStockInChartData() { |
| | | return request({ |
| | | url: '/stockin/listReport', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | // æ¥è¯¢æååºåä¿¡æ¯å表 |
| | | export const getStockManageProduction = (params) => { |
| | | return request({ |
| | | url: "/stockin/listPageProductionStock", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | // æ¥è¯¢èªå®ä¹å
¥åºåºåä¿¡æ¯å表 |
| | | export const getStockManagePageByCustom = (params) => { |
| | | return request({ |
| | |
| | | }); |
| | | }; |
| | | |
| | | // åºåºå°è´¦-ç产åºåºæ¥è¯¢åºåºå表 |
| | | export const getStockOutSemiProductPage = (params) => { |
| | | return request({ |
| | | url: "/stockmanagement/listPageBySemiProduct", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | | |
| | | //æ°å¢åºåºä¿¡æ¯ |
| | | export const addStockOut = (data) => { |
| | | return request({ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request.js"; |
| | | |
| | | |
| | | export function findStaffContractListPage(query) { |
| | | return request({ |
| | | url: "/staff/staffContract/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request.js"; |
| | | |
| | | export function findStaffLeaveListPage(query) { |
| | | return request({ |
| | | url: "/staff/staffLeave/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function createStaffLeave(data) { |
| | | return request({ |
| | | url: "/staff/staffLeave", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function updateStaffLeave(id, data) { |
| | | return request({ |
| | | url: "/staff/staffLeave/" + id, |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function batchDeleteStaffLeaves(data) { |
| | | return request({ |
| | | url: "/staff/staffLeave/del", |
| | | method: "delete", |
| | | data: data, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢å¨èåå·¥å°è´¦ |
| | | export function staffOnJobListPage(query) { |
| | | return request({ |
| | | url: '/staff/staffOnJob/listPage', |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | | } |
| | | // æ¥è¯¢åå·¥å
¥èä¿¡æ¯ |
| | | export function staffOnJobInfo(id, query) { |
| | | return request({ |
| | | url: '/staff/staffOnJob/' + id, |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢åå·¥ |
| | | export function createStaffOnJob(params) { |
| | | return request({ |
| | | url: "/staff/staffOnJob", |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹åå·¥ |
| | | export function updateStaffOnJob(id, params) { |
| | | return request({ |
| | | url: "/staff/staffOnJob/" + id, |
| | | method: "put", |
| | | data: params, |
| | | }); |
| | | } |
| | | |
| | | // å é¤åå·¥ |
| | | export function batchDeleteStaffOnJobs(query) { |
| | | return request({ |
| | | url: "/staff/staffOnJob/del", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // ç»ç¾åå |
| | | export function renewContract(id, params) { |
| | | return request({ |
| | | url: "/staff/staffOnJob/renewContract/" + id, |
| | | method: "post", |
| | | data: params, |
| | | }); |
| | | } |
| | |
| | | // æ¥è¯¢å表 |
| | | export function invoiceListPage(query) { |
| | | return request({ |
| | | url: "/purchase/registration/listPage", |
| | | url: "/sales/product/listPagePurchaseLedger", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ¥è¯¢éè´å°è´¦å表 |
| | | export function purchaseListPage(query) { |
| | | return request({ |
| | | url: "/purchase/ledger/listPage", |
| | |
| | | method: "get", |
| | | }); |
| | | } |
| | | export function updateApprovalStatus(query) { |
| | | return request({ |
| | | url: "/purchase/ledger/updateApprovalStatus", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // ä¿åéè´æ¨¡æ¿ |
| | | // /purchase/ledger/addPurchaseTemplate |
| | | export function addPurchaseTemplate(data) { |
| | | return request({ |
| | | url: "/purchase/ledger/addPurchaseTemplate", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // æ¥è¯¢éè´æ¨¡æ¿ |
| | | // /purchase/ledger/getPurchaseTemplateList |
| | | export function getPurchaseTemplateList(query) { |
| | | return request({ |
| | | url: "/purchase/ledger/getPurchaseTemplateList", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å·¥èºè·¯çº¿é¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/processRoute/page", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/processRoute", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: '/processRoute/' + ids, |
| | | method: 'delete', |
| | | }) |
| | | } |
| | | |
| | | export function update(data) { |
| | | return request({ |
| | | url: '/processRoute', |
| | | method: 'put', |
| | | data: data, |
| | | }) |
| | | } |
| | | |
| | | // è·å详æ
|
| | | export function getById(id) { |
| | | return request({ |
| | | url: `/processRoute/${id}`, |
| | | method: 'get', |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å·¥èºè·¯çº¿é¡¹ç®é¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å表æ¥è¯¢ |
| | | export function findProcessRouteItemList(query) { |
| | | return request({ |
| | | url: "/processRouteItem/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function addOrUpdateProcessRouteItem(data) { |
| | | return request({ |
| | | url: "/processRouteItem", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // æåºæ¥å£ |
| | | export function sortProcessRouteItem(data) { |
| | | return request({ |
| | | url: "/processRouteItem/sort", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // æ¹éå 餿¥å£ |
| | | export function batchDeleteProcessRouteItem(ids) { |
| | | // å°idæ°ç»è½¬æ¢ä¸ºéå·åéçåç¬¦ä¸²ï¼æ¼æ¥å°URLåé¢ |
| | | const idsStr = Array.isArray(ids) ? ids.join(",") : ids; |
| | | return request({ |
| | | url: `/processRouteItem/batchDelete/${idsStr}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // 产åBOM页颿¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/productBom/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/productBom/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹ |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/productBom/update", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // æ¹éå é¤ |
| | | export function batchDelete(ids) { |
| | | return request({ |
| | | url: "/productBom/batchDelete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®äº§ååå·IDæ¥è¯¢BOM |
| | | export function getByModel(productModelId) { |
| | | return request({ |
| | | url: "/productBom/getByModel", |
| | | method: "get", |
| | | params: { productModelId }, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å·¥èºè·¯çº¿é¡¹ç®é¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å表æ¥è¯¢ |
| | | export function findProductProcessRouteItemList(query) { |
| | | return request({ |
| | | url: "/productProcessRoute/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function addOrUpdateProductProcessRouteItem(data) { |
| | | return request({ |
| | | url: "/productProcessRoute/updateRouteItem", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ç产订åä¸ï¼æ°å¢å·¥èºè·¯çº¿é¡¹ç® |
| | | export function addRouteItem(data) { |
| | | return request({ |
| | | url: "/productProcessRoute/addRouteItem", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // è·åç产订åå
³èçå·¥èºè·¯çº¿ä¸»ä¿¡æ¯ |
| | | export function listMain(orderId) { |
| | | return request({ |
| | | url: "/productProcessRoute/listMain", |
| | | method: "get", |
| | | params: { orderId }, |
| | | }); |
| | | } |
| | | |
| | | // å é¤å·¥èºè·¯çº¿é¡¹ç®ï¼è·¯ç±åæ¼æ¥ idï¼ |
| | | export function deleteRouteItem(id) { |
| | | return request({ |
| | | url: `/productProcessRoute/deleteRouteItem/${id}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | // ç产订åä¸ï¼æåºå·¥èºè·¯çº¿é¡¹ç® |
| | | export function sortRouteItem(data) { |
| | | return request({ |
| | | url: "/productProcessRoute/sortRouteItem", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // 产åç»æé¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function queryList(id) { |
| | | return request({ |
| | | url: "/productStructure/listBybomId/" + id, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/productStructure", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | |
| | | // å页æ¥è¯¢ |
| | | export function schedulingListPage(query) { |
| | | return request({ |
| | | url: "/productionOrder/listPage", |
| | | url: "/salesLedger/scheduling/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function productOrderListPage(query) { |
| | | return request({ |
| | | url: "/productOrder/page", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // ç产订å-æäº§ååå·æ¥è¯¢å¯ç¨å·¥èºè·¯çº¿å表 |
| | | export function listProcessRoute(query) { |
| | | return request({ |
| | | url: "/productOrder/listProcessRoute", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // ç产订å-ç»å®å·¥èºè·¯çº¿ |
| | | export function bindingRoute(data) { |
| | | return request({ |
| | | url: "/productOrder/bindingRoute", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // ç产订å-æ¥è¯¢äº§åç»æå表 |
| | | export function listProcessBom(query) { |
| | | return request({ |
| | | url: "/productOrder/listProcessBom", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // è·åçæºæ£å¨å·¥ä½éæ°æ® |
| | | export function schedulingList(query) { |
| | | return request({ |
| | | url: "/salesLedger/scheduling/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // ä¿åçæºè®¾ç½® |
| | | export function addSpeculatTrading(data) { |
| | | return request({ |
| | | url: "/salesLedger/scheduling/addSpeculatTrading", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹çæºè®¾ç½® |
| | | export function updateSpeculatTrading(data) { |
| | | return request({ |
| | | url: "/salesLedger/scheduling/updateSpeculatTrading", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ç产派工 |
| | | export function productionDispatch(query) { |
| | | return request({ |
| | |
| | | data: query, |
| | | }); |
| | | } |
| | | // èªå¨æ´¾å·¥ |
| | | export function productionDispatchList(query) { |
| | | return request({ |
| | | url: "/salesLedger/scheduling/productionDispatchList", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ç产订å |
| | | export function addProductionOrder(query) { |
| | | // æ¥è¯¢æèç |
| | | export function getLossRate() { |
| | | return request({ |
| | | url: "/productionOrder/addProductionOrder", |
| | | method: "post", |
| | | data: query, |
| | | url: "/salesLedger/scheduling/loss", |
| | | method: "get", |
| | | }); |
| | | } |
| | | // ä¿®æ¹ç产订å |
| | | export function updateProductionOrder(query) { |
| | | |
| | | // æ°å¢æèç |
| | | export function addLossRate(data) { |
| | | return request({ |
| | | url: "/productionOrder/updateProductionOrder", |
| | | url: "/salesLedger/scheduling/addLoss", |
| | | method: "post", |
| | | data: query, |
| | | data: data, |
| | | }); |
| | | } |
| | | // å é¤ç产订å |
| | | export function deleteProductionOrder(query) { |
| | | |
| | | // ä¿®æ¹æèç |
| | | export function updateLossRate(data) { |
| | | return request({ |
| | | url: "/productionOrder/deleteProductionOrder", |
| | | method: "delete", |
| | | data: query, |
| | | url: "/salesLedger/scheduling/updateLoss", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å·¥åºé¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/productProcess/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function processList(query) { |
| | | return request({ |
| | | url: "/productProcess/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/productProcess", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function del(data) { |
| | | return request({ |
| | | url: '/productProcess/batchDelete', |
| | | method: 'delete', |
| | | data: data, |
| | | }) |
| | | } |
| | | |
| | | export function update(data) { |
| | | return request({ |
| | | url: '/productProcess/update', |
| | | method: 'put', |
| | | data: data, |
| | | }) |
| | | } |
| | | |
| | | // å·¥åºæ¥è¯¢ |
| | | export function list() { |
| | | return request({ |
| | | url: "/productProcess/list", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // 导å
¥æ°æ® |
| | | export function importData(data) { |
| | | return request({ |
| | | url: "/productProcess/importData", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ä¸è½½æ¨¡æ¿ |
| | | export function downloadTemplate() { |
| | | return request({ |
| | | url: "/productProcess/downloadTemplate", |
| | | method: "post", |
| | | responseType: "blob", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ç产æå
¥é¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function productionProductInputListPage(query) { |
| | | return request({ |
| | | url: "/productionProductInput/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ç产æ¥å·¥é¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function productionProductMainListPage(query) { |
| | | return request({ |
| | | url: "/productionProductMain/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ç产产åºé¡µé¢æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function productionProductOutputListPage(query) { |
| | | return request({ |
| | | url: "/productionProductOutput/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | } |
| | | // ç产æ¥å·¥-å é¤ |
| | | export function productionReportDelete(query) { |
| | | return request({ |
| | | url: "/productionProductMain/delete", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | export function productWorkOrderPage(query) { |
| | | return request({ |
| | | url: "/productWorkOrder/page", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | export function updateProductWorkOrder(data) { |
| | | return request({ |
| | | url: "/productWorkOrder/updateProductWorkOrder", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function addProductMain(data) { |
| | | return request({ |
| | | url: "/productionProductMain/addProductMain", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å
Œ
±æä»¶ç®¡çæ¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | // å é¤å
Œ
±æä»¶ |
| | | export function delCommonFile(ids) { |
| | | return request({ |
| | | url: '/commonFile/delCommonFile', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | // å¼ç¥¨å°è´¦æä»¶å é¤ |
| | | export function delCommonFileInvoiceLedger(ids) { |
| | | return request({ |
| | | url: '/invoiceLedger/delFile', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | |
| | | import request from '@/utils/request' |
| | | import request from "@/utils/request"; |
| | | |
| | | // æ¥è¯¢ææ å表 |
| | | export function qualityTestStandardListPage(query) { |
| | | return request({ |
| | | url: '/quality/qualityTestStandard/listPage', |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | | return request({ |
| | | url: "/qualityTestStandard/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ææ å表 |
| | | export function qualityTestStandardAdd(query) { |
| | | return request({ |
| | | url: '/quality/qualityTestStandard/add', |
| | | method: 'post', |
| | | data: query, |
| | | }) |
| | | return request({ |
| | | url: "/qualityTestStandard/add", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹ææ å表 |
| | | export function qualityTestStandardUpdate(query) { |
| | | return request({ |
| | | url: '/quality/qualityTestStandard/update', |
| | | method: 'post', |
| | | data: query, |
| | | }) |
| | | return request({ |
| | | url: "/qualityTestStandard/update", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // å 餿æ å表 |
| | | export function qualityTestStandardDel(query) { |
| | | return request({ |
| | | url: '/quality/qualityTestStandard/del', |
| | | method: 'delete', |
| | | data: query, |
| | | }) |
| | | return request({ |
| | | url: "/qualityTestStandard/del", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // å 餿æ å表 |
| | | export function qualityInspectDetailByProductId(productId) { |
| | | return request({ |
| | | url: '/quality/qualityTestStandard/product/' + productId, |
| | | method: 'get', |
| | | }) |
| | | } |
| | | return request({ |
| | | url: "/qualityTestStandard/product/" + productId, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // å¤å¶æ ååæ° |
| | | export function qualityTestStandardCopyParam(id) { |
| | | return request({ |
| | | url: "/qualityTestStandard/copyParam", |
| | | method: "post", |
| | | data: { id }, |
| | | }); |
| | | } |
| | | |
| | | // æ¹éå®¡æ ¸ï¼ç¶æï¼1=éè¿/æ¹åï¼2=æ¤éï¼ |
| | | // ä¼ åï¼[{ id, state }] |
| | | export function qualityTestStandardAudit(data) { |
| | | return request({ |
| | | url: "/qualityTestStandard/qualityTestStandardAudit", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // æ ååæ°ï¼å表ï¼ä¸åé¡µï¼ |
| | | export function qualityTestStandardParamList(query) { |
| | | return request({ |
| | | url: "/qualityTestStandardParam/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ ååæ°ï¼æ°å¢ |
| | | export function qualityTestStandardParamAdd(data) { |
| | | return request({ |
| | | url: "/qualityTestStandardParam/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // æ ååæ°ï¼ä¿®æ¹ |
| | | export function qualityTestStandardParamUpdate(data) { |
| | | return request({ |
| | | url: "/qualityTestStandardParam/update", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // æ ååæ°ï¼å é¤ï¼ä¼ id æ°ç»ï¼ |
| | | export function qualityTestStandardParamDel(ids) { |
| | | return request({ |
| | | url: "/qualityTestStandardParam/del", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // ç»å®å表ï¼ä¸åé¡µï¼ |
| | | export function qualityTestStandardBindingList(query) { |
| | | return request({ |
| | | url: "/qualityTestStandardBinding/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ç»å®ï¼æ¯ææ¹éï¼ |
| | | export function qualityTestStandardBindingAdd(data) { |
| | | return request({ |
| | | url: "/qualityTestStandardBinding/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤ç»å®ï¼ä¼ id æ°ç»ï¼ |
| | | export function qualityTestStandardBindingDel(ids) { |
| | | return request({ |
| | | url: "/qualityTestStandardBinding/del", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | |
| | | // æ¥è¯¢å·²ç»ç»å®å票çå¼ç¥¨å°è´¦ |
| | | export function bindInvoiceNoRegPage(query) { |
| | | return request({ |
| | | url: '/receiptPayment/bindInvoiceNoRegPage', |
| | | url: '/sales/product/listPageSalesLedger', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | |
| | | })
|
| | | }
|
| | |
|
| | | export function findPostOptions(query) {
|
| | | return request({
|
| | | url: '/system/post/optionselect',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | }
|
| | |
|
| | |
|
| | | // æ¥è¯¢å²ä½è¯¦ç»
|
| | | export function getPost(postId) {
|
| | | return request({
|
| | |
| | | url: '/home/overdueReceivable', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | // åç产订åç宿è¿åº¦ç»è®¡ |
| | | // /home/progressStatistics |
| | | export const getProgressStatistics = ()=>{ |
| | | return request({ |
| | | url: '/home/progressStatistics', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | //å¨å¶åå¨è½¬æ
åµ |
| | | //home/workInProcessTurnover |
| | | export const getWorkInProcessTurnover= ()=>{ |
| | | return request({ |
| | | url: '/home/workInProcessTurnover', |
| | | method: 'get' |
| | | }) |
| | | } |
| | |
| | | :fixed="item.fixed" |
| | | :label="item.label" |
| | | :prop="item.prop" |
| | | show-overflow-tooltip |
| | | :show-overflow-tooltip="item.dataType !== 'action' && item.dataType !== 'slot'" |
| | | :align="item.align" |
| | | :sortable="!!item.sortable" |
| | | :type="item.type" |
| | | :width="item.width" |
| | | > |
| | | <template #header="scope"> |
| | | <div class="pim-table-header-cell"> |
| | | <div class="pim-table-header-title"> |
| | | {{ item.label }} |
| | | </div> |
| | | <div v-if="item.headerSlot" class="pim-table-header-extra"> |
| | | <slot :name="item.headerSlot" :column="scope.column" /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template |
| | | v-if="item.hasOwnProperty('colunmTemplate')" |
| | | #[item.colunmTemplate]="scope" |
| | |
| | | </div> |
| | | |
| | | <!-- æé® --> |
| | | <div v-else-if="item.dataType == 'action'"> |
| | | <div v-else-if="item.dataType == 'action'" @click.stop> |
| | | <template v-for="(o, key) in item.operation" :key="key"> |
| | | <el-button |
| | | v-show="o.type != 'upload'" |
| | |
| | | : o.color, |
| | | }" |
| | | link |
| | | @click="o.clickFun(scope.row)" |
| | | @click.stop="o.clickFun(scope.row)" |
| | | :key="key" |
| | | > |
| | | {{ o.name }} |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | v-if="showPagination" |
| | | v-if="isShowPagination" |
| | | :total="page.total" |
| | | :layout="page.layout" |
| | | :page="page.current" |
| | |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | isShowPagination: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | isShowSummary: { |
| | | type: Boolean, |
| | | default: false, |
| | |
| | | tableStyle: { |
| | | type: [String, Object], |
| | | default: () => ({ width: "100%" }), |
| | | }, |
| | | showPagination: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | }); |
| | | |
| | |
| | | padding-right: 0 !important; |
| | | padding-left: 0 !important; |
| | | } |
| | | |
| | | .pim-table-header-extra :deep(.el-input), |
| | | .pim-table-header-extra :deep(.el-select) { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | <div :class="{ hidden }" class="pagination-container"> |
| | | <el-pagination |
| | | :background="background" |
| | | v-model:currentPage="currentPage" |
| | | v-model:pageSize="pageSize" |
| | | v-model:current-page="currentPage" |
| | | v-model:page-size="pageSize" |
| | | :layout="layout" |
| | | :page-size-options="pageSizes" |
| | | :page-sizes="pageSizes" |
| | | :pager-count="pagerCount" |
| | | :total="total" |
| | | v-bind="$attrs" |
| | |
| | | <breadcrumb v-if="!settingsStore.topNav" id="breadcrumb-container" class="breadcrumb-container" />
|
| | | </div>
|
| | | <!-- <top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" />-->
|
| | | <div class="center-menu">
|
| | | <span class="label">{{ userStore.currentFactoryName }}</span>
|
| | | <el-dropdown @command="handleFactoryChange" class="right-menu-item hover-effect" trigger="click">
|
| | | <div>
|
| | | <el-icon size="20">
|
| | | <Switch />
|
| | | </el-icon>
|
| | | </div>
|
| | | <template #dropdown>
|
| | | <el-dropdown-menu>
|
| | | <el-dropdown-item v-for="item in factoryList" :key="item.deptId" :command="item">
|
| | | {{ item.deptName }}
|
| | | </el-dropdown-item>
|
| | | </el-dropdown-menu>
|
| | | </template>
|
| | | </el-dropdown>
|
| | | </div>
|
| | | <div class="right-menu">
|
| | | <div class="avatar-container">
|
| | | <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
|
| | | <div class="avatar-wrapper">
|
| | |
| | | </el-dropdown>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script setup>
|
| | |
| | | import useAppStore from '@/store/modules/app'
|
| | | import useUserStore from '@/store/modules/user'
|
| | | import useSettingsStore from '@/store/modules/settings'
|
| | | import { userLoginFacotryList } from "@/api/system/user.js"
|
| | | import Cookies from "js-cookie";
|
| | | import { decrypt } from "@/utils/jsencrypt"
|
| | |
|
| | | const appStore = useAppStore()
|
| | | const userStore = useUserStore()
|
| | |
| | | settingsStore.toggleTheme()
|
| | | }
|
| | |
|
| | | function getUserLoginFacotryList() {
|
| | | if (userStore.id) {
|
| | | userLoginFacotryList({ userId: userStore.id }).then(res => {
|
| | | console.log('res', res)
|
| | | factoryList.value = res.data
|
| | | })
|
| | | } else {
|
| | | factoryList.value = []
|
| | | }
|
| | | }
|
| | | // function getUserLoginFacotryList() {
|
| | | // if (userStore.id) {
|
| | | // userLoginFacotryList({ userId: userStore.id }).then(res => {
|
| | | // console.log('res', res)
|
| | | // factoryList.value = res.data
|
| | | // })
|
| | | // } else {
|
| | | // factoryList.value = []
|
| | | // }
|
| | | // }
|
| | |
|
| | | function handleFactoryChange(command) {
|
| | | console.log('command', command)
|
| | |
| | | const timestamp = new Date().getTime();
|
| | | window.location.href = `${currentUrl}?reload=${timestamp}`;
|
| | | }
|
| | |
|
| | | getUserLoginFacotryList();
|
| | | </script>
|
| | |
|
| | | <style lang='scss' scoped>
|
| | |
| | | position: relative;
|
| | | background: var(--navbar-bg);
|
| | | box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
| | |
|
| | | .center-menu {
|
| | | line-height: 50px;
|
| | | position: absolute;
|
| | | left: 50%;
|
| | | transform: translateX(-50%);
|
| | | display: flex;
|
| | | align-items: center;
|
| | |
|
| | | .label {
|
| | | font-weight: bold;
|
| | | font-size: 18px;
|
| | | color: #333333;
|
| | | margin-right: 10px;
|
| | | }
|
| | | }
|
| | |
|
| | | .hamburger-container {
|
| | | line-height: 46px;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | .notification-container {
|
| | | margin-right: 20px;
|
| | | display: flex;
|
| | | align-items: center;
|
| | | cursor: pointer;
|
| | |
|
| | | .notification-badge {
|
| | | :deep(.el-badge__content) {
|
| | | border: none;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | .avatar-container {
|
| | | margin-right: 40px;
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | </style>
|
| | |
|
| | | <style lang="scss">
|
| | | .notification-popover {
|
| | | padding: 0 !important;
|
| | | |
| | | .el-popover__title {
|
| | | display: none;
|
| | | }
|
| | | |
| | | .el-popover__body {
|
| | | padding: 0 !important;
|
| | | }
|
| | | }
|
| | | .el-badge__content.is-fixed{
|
| | | top: 12px;
|
| | | }
|
| | | </style>
|
| | |
| | | export { default as Navbar } from './Navbar'
|
| | | export { default as Settings } from './Settings'
|
| | | export { default as TagsView } from './TagsView/index.vue'
|
| | | // export { default as NotificationCenter } from './NotificationCenter/index.vue'
|
| | |
| | | loginCheckFactory(userInfo) {
|
| | | const username = userInfo.username.trim()
|
| | | const password = userInfo.password
|
| | | const factoryId = userInfo.currentFatoryId
|
| | | return new Promise((resolve, reject) => {
|
| | | loginCheckFactory(username, password, factoryId).then(res => {
|
| | | loginCheckFactory(username, password).then(res => {
|
| | | setToken(res.token)
|
| | | this.token = res.token
|
| | | resolve()
|
| | |
| | | export function isEqual(obj1, obj2) {
|
| | | return JSON.stringify(obj1) === JSON.stringify(obj2);
|
| | | }
|
| | |
|
| | | /**
|
| | | * è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD
|
| | | * @returns {string} æ ¼å¼åçæ¥æå符串
|
| | | */
|
| | | export function getCurrentDate() {
|
| | | const today = new Date();
|
| | | const year = today.getFullYear();
|
| | | const month = String(today.getMonth() + 1).padStart(2, '0'); // æä»½ä»0å¼å§
|
| | | const day = String(today.getDate()).padStart(2, '0');
|
| | | return `${year}-${month}-${day}`;
|
| | | }
|
| | |
|
| | |
| | | }; |
| | | // ä¸å«ç¨æ»ä»·è®¡ç® |
| | | const calculateTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => { |
| | | const taxRateNumber = taxRate?Number(taxRate):0; |
| | | const taxRateDecimal = taxRateNumber / 100; |
| | | const taxRateDecimal = taxRate / 100; |
| | | return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(2); |
| | | }; |
| | | // å«ç¨æ»ä»·è®¡ç® |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客æ·ç±»åï¼" prop="type"> |
| | | <el-form-item label="客æ·ç±»åï¼" prop="customerType"> |
| | | <el-select |
| | | v-model="form.type" |
| | | v-model="form.customerType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | |
| | | }, |
| | | { |
| | | label: "客æ·ç±»å", |
| | | prop: "type", |
| | | prop: "customerType", |
| | | dataType: "tag", |
| | | formatData: (val) => val || "--", |
| | | formatType: (val) => { |
| | | const map = { |
| | | ä¼ä¸: "primary", |
| | | 个人: "success", |
| | | æ¿åº: "warning", |
| | | äºä¸åä½: "info", |
| | | å
¶ä»: "default", |
| | | '䏿¹å': "primary", |
| | | 'ç»ç«¯å': "success", |
| | | }; |
| | | return map[val] || "info"; |
| | | }, |
| | |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainer !== userStore.nickName |
| | | } |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | const tableLoading = ref(false); |
| | | // 客æ·ç±»åé项 |
| | | const customerTypeOptions = ref([ |
| | | { label: "ä¼ä¸", value: "ä¼ä¸" }, |
| | | { label: "个人", value: "个人" }, |
| | | { label: "æ¿åº", value: "æ¿åº" }, |
| | | { label: "äºä¸åä½", value: "äºä¸åä½" }, |
| | | { label: "å
¶ä»", value: "å
¶ä»" }, |
| | | { label: "䏿¹å", value: "䏿¹å" }, |
| | | { label: "ç»ç«¯å", value: "ç»ç«¯å" }, |
| | | ]); |
| | | const page = reactive({ |
| | | current: 1, |
| | |
| | | }, |
| | | form: { |
| | | customerName: "", |
| | | type: "", |
| | | customerType: "", |
| | | companyAddress: "", |
| | | maintainer: "", |
| | | maintenanceTime: "", |
| | | }, |
| | | rules: { |
| | | customerName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | type: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | customerType: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | companyAddress: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | maintainer: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog |
| | | v-model="visible" |
| | | title="éæ©äº§å" |
| | | width="900px" |
| | | destroy-on-close |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-form :inline="true" :model="query" class="mb-2"> |
| | | <el-form-item label="产å大类"> |
| | | <el-input |
| | | v-model="query.productName" |
| | | placeholder="è¾å
¥äº§å大类" |
| | | clearable |
| | | @keyup.enter="onSearch" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="åå·åç§°"> |
| | | <el-input |
| | | v-model="query.model" |
| | | placeholder="è¾å
¥åå·åç§°" |
| | | clearable |
| | | @keyup.enter="onSearch" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button type="primary" @click="onSearch">æç´¢</el-button> |
| | | <el-button @click="onReset">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- å表 --> |
| | | <el-table |
| | | v-loading="loading" |
| | | :data="tableData" |
| | | height="420" |
| | | highlight-current-row |
| | | row-key="id" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column type="index" label="#" width="60"/> |
| | | <el-table-column prop="productName" label="产å大类" min-width="160"/> |
| | | <el-table-column prop="model" label="åå·åç§°" min-width="200"/> |
| | | <el-table-column prop="unit" label="åä½" min-width="160"/> |
| | | </el-table> |
| | | |
| | | <div class="mt-3 flex justify-end"> |
| | | <el-pagination |
| | | background |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total" |
| | | v-model:page-size="page.pageSize" |
| | | v-model:current-page="page.pageNum" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | @size-change="onPageChange" |
| | | @current-change="onPageChange" |
| | | /> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <el-button @click="close()">åæ¶</el-button> |
| | | <el-button type="primary" :disabled="multipleSelection.length === 0" @click="onConfirm"> |
| | | ç¡®å® |
| | | </el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import {computed, onMounted, reactive, ref, watch} from "vue"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {productModelList} from '@/api/basicData/productModel' |
| | | |
| | | export type ProductRow = { |
| | | id: number; |
| | | productName: string; |
| | | model: string; |
| | | unit?: string; |
| | | }; |
| | | |
| | | const props = defineProps<{ |
| | | modelValue: boolean; |
| | | }>(); |
| | | |
| | | const emit = defineEmits(['update:modelValue', 'confirm']); |
| | | |
| | | const visible = computed({ |
| | | get: () => props.modelValue, |
| | | set: (v) => emit("update:modelValue", v), |
| | | }); |
| | | |
| | | const query = reactive({ |
| | | productName: "", |
| | | model: "", |
| | | }); |
| | | |
| | | const page = reactive({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }); |
| | | |
| | | const loading = ref(false); |
| | | const tableData = ref<ProductRow[]>([]); |
| | | const total = ref(0); |
| | | const multipleSelection = ref<ProductRow[]>([]) |
| | | |
| | | function close() { |
| | | visible.value = false; |
| | | } |
| | | |
| | | const handleSelectionChange = (val: ProductRow[]) => { |
| | | multipleSelection.value = val |
| | | } |
| | | |
| | | function onSearch() { |
| | | page.pageNum = 1; |
| | | loadData(); |
| | | } |
| | | |
| | | function onReset() { |
| | | query.productName = ""; |
| | | query.model = ""; |
| | | page.pageNum = 1; |
| | | loadData(); |
| | | } |
| | | |
| | | function onPageChange() { |
| | | loadData(); |
| | | } |
| | | |
| | | function onConfirm() { |
| | | if (multipleSelection.value.length === 0) { |
| | | ElMessage.warning("è¯·éæ©ä¸æ¡äº§å"); |
| | | return; |
| | | } |
| | | emit("confirm", multipleSelection.value); |
| | | close(); |
| | | } |
| | | |
| | | async function loadData() { |
| | | loading.value = true; |
| | | try { |
| | | multipleSelection.value = []; // 翻页/æç´¢åæ¸
ç©ºéæ©æ´ç¬¦å颿 |
| | | const res = await productModelList({ |
| | | productName: query.productName.trim(), |
| | | model: query.model.trim(), |
| | | current: page.pageNum, |
| | | size: page.pageSize, |
| | | }); |
| | | tableData.value = res.records; |
| | | total.value = res.total; |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | } |
| | | |
| | | onMounted(() => { |
| | | loadData() |
| | | }) |
| | | </script> |
| | |
| | | :data="list" |
| | | @node-click="handleNodeClick" |
| | | :expand-on-click-node="false" |
| | | default-expand-all |
| | | :default-expanded-keys="expandedKeys" |
| | | :draggable="true" |
| | | :filter-node-method="filterNode" |
| | | :props="{ children: 'children', label: 'label' }" |
| | | highlight-current |
| | |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainUserName !== userStore.nickName |
| | | } |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-row v-if="!isQuotationApproval"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="审æ¹äºç±ï¼" prop="approveReason"> |
| | | <el-input v-model="form.approveReason" placeholder="请è¾å
¥" clearable type="textarea" disabled/> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <!-- æ¥ä»·å®¡æ¹ï¼å±ç¤ºæ¥ä»·è¯¦æ
ï¼å¤ç¨é宿¥ä»·âæ¥ç详æ
å¯¹è¯æ¡âå
å®¹ç»æï¼ --> |
| | | <div v-if="isQuotationApproval" style="margin: 10px 0 18px;"> |
| | | <el-divider content-position="left">æ¥ä»·è¯¦æ
</el-divider> |
| | | <el-skeleton :loading="quotationLoading" animated> |
| | | <template #template> |
| | | <el-skeleton-item variant="h3" style="width: 30%" /> |
| | | <el-skeleton-item variant="text" style="width: 100%" /> |
| | | <el-skeleton-item variant="text" style="width: 100%" /> |
| | | </template> |
| | | <template #default> |
| | | <el-empty v-if="!currentQuotation || !currentQuotation.quotationNo" description="æªæ¥è¯¢å°å¯¹åºæ¥ä»·è¯¦æ
" /> |
| | | <template v-else> |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="æ¥ä»·åå·">{{ currentQuotation.quotationNo }}</el-descriptions-item> |
| | | <el-descriptions-item label="客æ·åç§°">{{ currentQuotation.customer }}</el-descriptions-item> |
| | | <el-descriptions-item label="ä¸å¡å">{{ currentQuotation.salesperson }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ¥ä»·æ¥æ">{{ currentQuotation.quotationDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="æææè³">{{ currentQuotation.validDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="仿¬¾æ¹å¼">{{ currentQuotation.paymentMethod }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ¥ä»·æ»é¢" :span="2"> |
| | | <span style="font-size: 18px; color: #e6a23c; font-weight: bold;"> |
| | | ¥{{ Number(currentQuotation.totalAmount ?? 0).toFixed(2) }} |
| | | </span> |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | |
| | | <div style="margin-top: 20px;"> |
| | | <h4>产åæç»</h4> |
| | | <el-table :data="currentQuotation.products || []" border style="width: 100%"> |
| | | <el-table-column prop="product" label="产ååç§°" /> |
| | | <el-table-column prop="specification" label="è§æ ¼åå·" /> |
| | | <el-table-column prop="unit" label="åä½" /> |
| | | <el-table-column prop="unitPrice" label="åä»·"> |
| | | <template #default="scope">Â¥{{ Number(scope.row.unitPrice ?? 0).toFixed(2) }}</template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div v-if="currentQuotation.remark" style="margin-top: 20px;"> |
| | | <h4>夿³¨</h4> |
| | | <p>{{ currentQuotation.remark }}</p> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </el-skeleton> |
| | | </div> |
| | | |
| | | <el-form :model="{ activities }" ref="formRef" label-position="top"> |
| | | <el-steps :active="getActiveStep()" finish-status="success" process-status="process" align-center direction="vertical"> |
| | | <el-step |
| | |
| | | <template #footer v-if="operationType === 'approval'"> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm(2)">ä¸éè¿</el-button> |
| | | <el-button type="primary" @click="openSignatureDialog(1)">éè¿</el-button> |
| | | <el-button type="primary" @click="submitForm(1)">éè¿</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- çµåç¾åå¼¹çªï¼vue3-signature-padï¼ --> |
| | | <el-dialog v-model="signatureDialogVisible" title="çµåç¾å" width="600px" append-to-body> |
| | | <vueEsign |
| | | ref="esign" |
| | | class="mySign" |
| | | :width="800" |
| | | :height="300" |
| | | :isCrop="isCrop" |
| | | :lineWidth="lineWidth" |
| | | :lineColor="lineColor" |
| | | /> |
| | | <div style="margin-top:10px;"> |
| | | <el-button @click="clearSignature">æ¸
é¤</el-button> |
| | | <el-button type="primary" @click="confirmSignature">ç¡®å®</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getCurrentInstance, reactive, ref, toRefs } from "vue"; |
| | | import vueEsign from "vue-esign"; |
| | | import { computed, getCurrentInstance, reactive, ref, toRefs } from "vue"; |
| | | import { |
| | | approveProcessDetails, |
| | | getDept, |
| | |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import { WarningFilled, Edit, Check, MoreFilled } from '@element-plus/icons-vue' |
| | | import { getToken } from "@/utils/auth"; |
| | | import { getQuotationList } from "@/api/salesManagement/salesQuotation.js"; |
| | | const emit = defineEmits(['close']) |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | const props = defineProps({ |
| | | approveType: { |
| | | type: [Number, String], |
| | | default: 0 |
| | | } |
| | | }) |
| | | |
| | | const dialogFormVisible = ref(false); |
| | | const operationType = ref('') |
| | |
| | | const userStore = useUserStore() |
| | | const productOptions = ref([]); |
| | | const userList = ref([]) |
| | | const quotationLoading = ref(false) |
| | | const currentQuotation = ref({}) |
| | | const isQuotationApproval = computed(() => Number(props.approveType) === 6) |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | approveTime: "", |
| | |
| | | }, |
| | | }); |
| | | const { form } = toRefs(data); |
| | | const signatureDialogVisible = ref(false); |
| | | const signatureImg = ref(''); |
| | | let submitStatus = null; // 临æ¶åå¨éè¿/ä¸éè¿ç¶æ |
| | | const isCrop = ref(""); |
| | | const esign = ref(null); |
| | | const lineWidth = ref(0); |
| | | const lineColor = ref("#000000"); |
| | | |
| | | // ä¸ä¼ é
ç½® |
| | | const upload = reactive({ |
| | | // ä¸ä¼ çå°å |
| | | url: import.meta.env.VITE_APP_BASE_API + "/file/upload", |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | }); |
| | | |
| | | // èç¹æ é¢ |
| | | const getNodeTitle = (index, len) => { |
| | |
| | | const openDialog = (type, row) => { |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | currentQuotation.value = {} |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | form.value = {...row} |
| | | getProductOptions() |
| | | |
| | | // æ¥ä»·å®¡æ¹ï¼ç¨å®¡æ¹äºç±å段æ¿è½½çâæ¥ä»·åå·â廿¥æ¥ä»·å表 |
| | | if (isQuotationApproval.value) { |
| | | const quotationNo = row?.approveReason; |
| | | if (quotationNo) { |
| | | quotationLoading.value = true |
| | | getQuotationList({ quotationNo }).then((res) => { |
| | | const records = res?.data?.records || [] |
| | | currentQuotation.value = records[0] || {} |
| | | }).finally(() => { |
| | | quotationLoading.value = false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | approveProcessDetails(row.approveId).then((res) => { |
| | | activities.value = res.data |
| | | // å¢å isApprovalåæ®µ |
| | |
| | | productOptions.value = res.data; |
| | | }); |
| | | }; |
| | | // æå¼ç¾åå¼¹çª |
| | | const openSignatureDialog = (status) => { |
| | | submitStatus = status; |
| | | signatureDialogVisible.value = true; |
| | | }; |
| | | // æ¸
é¤ç¾å |
| | | const clearSignature = () => { |
| | | esign.value.reset(); |
| | | }; |
| | | // 确认ç¾å |
| | | const confirmSignature = () => { |
| | | esign.value.generate().then((res) => { |
| | | console.log(res); |
| | | // å°base64转æ¢ä¸ºäºè¿å¶ |
| | | const base64Data = res.split(',')[1]; // ç§»é¤data:image/png;base64,åç¼ |
| | | const binaryString = atob(base64Data); |
| | | const bytes = new Uint8Array(binaryString.length); |
| | | for (let i = 0; i < binaryString.length; i++) { |
| | | bytes[i] = binaryString.charCodeAt(i); |
| | | } |
| | | signatureImg.value = bytes; |
| | | |
| | | // å建æä»¶å¯¹è±¡ç¨äºä¸ä¼ |
| | | const blob = new Blob([bytes], { type: 'image/png' }); |
| | | const file = new File([blob], 'signature.png', { type: 'image/png' }); |
| | | |
| | | // å建FormData |
| | | const formData = new FormData(); |
| | | formData.append('file', file); |
| | | |
| | | // ä¸ä¼ ç¾åå¾ç |
| | | fetch(upload.url, { |
| | | method: 'POST', |
| | | headers: upload.headers, |
| | | body: formData |
| | | }) |
| | | .then(response => response.json()) |
| | | .then(data => { |
| | | if (data.code === 200) { |
| | | console.log('data---', data) |
| | | let tempFileIds = []; |
| | | tempFileIds.push(data.data.tempId); |
| | | signatureDialogVisible.value = false; |
| | | clearSignature(); |
| | | // åªæéè¿æ¶æä¼ éç¾åæä»¶ID |
| | | if (submitStatus === 1) { |
| | | submitForm(submitStatus, tempFileIds); |
| | | } else { |
| | | submitForm(submitStatus); |
| | | } |
| | | } else { |
| | | proxy.$modal.msgError("ç¾åå¾çä¸ä¼ 失败ï¼" + data.msg); |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | console.error('ä¸ä¼ 失败:', error); |
| | | proxy.$modal.msgError("ç¾åå¾çä¸ä¼ 失败"); |
| | | }); |
| | | }).catch((err) => { |
| | | console.log(err); |
| | | proxy.$modal.msgWarning("请å
ç¾åï¼"); |
| | | }) |
| | | }; |
| | | // æäº¤å®¡æ¹ |
| | | const submitForm = (status, tempFileIds) => { |
| | | const submitForm = (status) => { |
| | | const filteredActivities = activities.value.filter(activity => activity.isShen); |
| | | filteredActivities[0].approveNodeStatus = status; |
| | | // åªæéè¿æ¶æéè¦ç¾å |
| | | if (status === 1 && tempFileIds) { |
| | | filteredActivities[0].tempFileIds = tempFileIds; |
| | | } |
| | | // 夿æ¯å¦ä¸ºæå䏿¥ |
| | | const isLast = activities.value.findIndex(a => a.isShen) === activities.value.length-1; |
| | | updateApproveNode({ ...filteredActivities[0], isLast }).then(() => { |
| | |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | quotationLoading.value = false |
| | | currentQuotation.value = {} |
| | | emit('close') |
| | | }; |
| | | defineExpose({ |
| | |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="ç³è¯·é¨é¨ï¼" prop="approveDeptId"> |
| | | <el-form-item label="ç³è¯·é¨é¨ï¼" prop="approveDeptName"> |
| | | <!-- <el-input v-model="form.approveDeptName" placeholder="请è¾å
¥" clearable/>--> |
| | | <el-select |
| | | disabled |
| | | v-model="form.approveDeptId" |
| | | placeholder="éæ©é¨é¨" |
| | | @change="handleDeptChange" |
| | | > |
| | | <el-option |
| | | v-for="user in productOptions" |
| | |
| | | <el-select |
| | | v-model="form.approveUser" |
| | | placeholder="éæ©äººå" |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | > |
| | | <el-option |
| | | v-for="user in userList" |
| | |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['close']) |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import log from "@/views/monitor/job/log.vue"; |
| | | const userStore = useUserStore(); |
| | | |
| | | const dialogFormVisible = ref(false); |
| | |
| | | approveId: "", |
| | | approveUser: "", |
| | | approveDeptId: "", |
| | | approveDeptName: "", |
| | | approveReason: "", |
| | | checkResult: "", |
| | | tempFileIds: [], |
| | |
| | | approveTime: [{ required: false, message: "请è¾å
¥", trigger: "change" },], |
| | | approveId: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | approveUser: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | approveDeptId: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | approveDeptName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | approveReason: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | checkResult: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | startDate: [{ required: true, message: "è¯·éæ©è¯·åå¼å§æ¶é´", trigger: "change" }], |
| | |
| | | function removeApproverNode(index) { |
| | | approverNodes.value.splice(index, 1) |
| | | } |
| | | |
| | | // å¤çé¨é¨éæ©åå |
| | | const handleDeptChange = (deptId) => { |
| | | if (deptId) { |
| | | const selectedDept = productOptions.value.find(dept => dept.deptId === deptId); |
| | | if (selectedDept) { |
| | | form.value.approveDeptName = selectedDept.deptName; |
| | | } |
| | | } else { |
| | | form.value.approveDeptName = ''; |
| | | } |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = (type, row) => { |
| | | operationType.value = type; |
| | |
| | | dialogFormVisible.value = false; |
| | | emit('close') |
| | | }; |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | // ä¸ä¼ åæ ¡æ£ |
| | | function handleBeforeUpload(file) { |
| | |
| | | <template> |
| | | <el-dialog v-model="dialogVisible" title="éä»¶" width="40%" :before-close="handleClose"> |
| | | <el-dialog v-model="dialogVisible" title="éä»¶" width="40%" :before-close="handleClose" draggable> |
| | | <el-table :data="tableData" border height="40vh"> |
| | | <el-table-column label="éä»¶åç§°" prop="name" min-width="400" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" width="100" align="center"> |
| | | <el-table-column fixed="right" label="æä½" width="150" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">ä¸è½½</el-button> |
| | | <el-button link type="primary" size="small" @click="lookFile(scope.row)">é¢è§</el-button> |
| | | <el-button link type="danger" size="small" @click="handleDelete(scope.row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import filePreview from '@/components/filePreview/index.vue' |
| | | import { ElMessageBox, ElMessage } from 'element-plus' |
| | | import { delCommonFile } from '@/api/publicApi/commonFile.js' |
| | | |
| | | const dialogVisible = ref(false) |
| | | const tableData = ref([]) |
| | |
| | | const lookFile = (row) => { |
| | | filePreviewRef.value.open(row.url) |
| | | } |
| | | // å é¤éä»¶ |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm(`确认å é¤éä»¶"${row.name}"åï¼`, 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | delCommonFile([row.id]).then(() => { |
| | | ElMessage.success('å 餿å') |
| | | // ä»å表ä¸ç§»é¤å·²å é¤çéä»¶ |
| | | const index = tableData.value.findIndex(item => item.id === row.id) |
| | | if (index !== -1) { |
| | | tableData.value.splice(index, 1) |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.error('å é¤å¤±è´¥') |
| | | }) |
| | | }).catch(() => { |
| | | ElMessage.info('已忶å é¤') |
| | | }) |
| | | } |
| | | defineExpose({ |
| | | open |
| | | }) |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- æ ç¾é¡µåæ¢ä¸åç审æ¹ç±»å --> |
| | | <el-tabs v-model="activeTab" @tab-change="handleTabChange" class="approval-tabs"> |
| | | <el-tab-pane label="å
¬åºç®¡ç" name="1"></el-tab-pane> |
| | | <el-tab-pane label="请å管ç" name="2"></el-tab-pane> |
| | | <el-tab-pane label="åºå·®ç®¡ç" name="3"></el-tab-pane> |
| | | <el-tab-pane label="æ¥é管ç" name="4"></el-tab-pane> |
| | | <el-tab-pane label="éè´å®¡æ¹" name="5"></el-tab-pane> |
| | | <el-tab-pane label="æ¥ä»·å®¡æ¹" name="6"></el-tab-pane> |
| | | <el-tab-pane label="åºåºå®¡æ¹" name="7"></el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">æµç¨ç¼å·ï¼</span> |
| | |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢</el-button> |
| | | <el-button type="primary" @click="openForm('add')" v-if="currentApproveType !== 6">æ°å¢</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :column="tableColumnCopy" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | |
| | | :total="page.total" |
| | | ></PIMTable> |
| | | </div> |
| | | <info-form-dia ref="infoFormDia" @close="handleQuery" :approveType="approveType"></info-form-dia> |
| | | <approval-dia ref="approvalDia" @close="handleQuery"></approval-dia> |
| | | <info-form-dia ref="infoFormDia" @close="handleQuery" :approveType="currentApproveType"></info-form-dia> |
| | | <approval-dia ref="approvalDia" @close="handleQuery" :approveType="currentApproveType"></approval-dia> |
| | | <FileList ref="fileListRef" /> |
| | | </div> |
| | | </template> |
| | |
| | | <script setup> |
| | | import FileList from "./fileList.vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import {onMounted, ref} from "vue"; |
| | | import {onMounted, ref, computed, reactive, toRefs, nextTick, getCurrentInstance} from "vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import { useRoute } from 'vue-router'; |
| | | import InfoFormDia from "@/views/collaborativeApproval/approvalProcess/components/infoFormDia.vue"; |
| | | import ApprovalDia from "@/views/collaborativeApproval/approvalProcess/components/approvalDia.vue"; |
| | | import {approveProcessDelete, approveProcessListPage} from "@/api/collaborativeApproval/approvalProcess.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | |
| | | // å®ä¹ç»ä»¶æ¥æ¶çprops |
| | | const props = defineProps({ |
| | | approveType: { |
| | | type: [Number, String], |
| | | default: 0 |
| | | } |
| | | const userStore = useUserStore(); |
| | | const route = useRoute(); |
| | | |
| | | // å½åéä¸çæ ç¾é¡µï¼é»è®¤ä¸ºå
¬åºç®¡ç |
| | | const activeTab = ref('1'); |
| | | |
| | | // å½å审æ¹ç±»åï¼æ ¹æ®éä¸çæ ç¾é¡µè®¡ç® |
| | | const currentApproveType = computed(() => { |
| | | return Number(activeTab.value); |
| | | }); |
| | | |
| | | const userStore = useUserStore(); |
| | | // æ ç¾é¡µåæ¢å¤ç |
| | | const handleTabChange = (tabName) => { |
| | | // 忢æ ç¾é¡µæ¶éç½®æç´¢æ¡ä»¶åå页ï¼å¹¶éæ°å è½½æ°æ® |
| | | searchForm.value.approveId = ''; |
| | | searchForm.value.approveStatus = ''; |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | |
| | | const data = reactive({ |
| | |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "审æ¹ç¶æ", |
| | | prop: "approveStatus", |
| | | dataType: "tag", |
| | | width: 100, |
| | | formatData: (params) => { |
| | | if (params == 0) { |
| | | return "å¾
å®¡æ ¸"; |
| | | } else if (params == 1) { |
| | | return "å®¡æ ¸ä¸"; |
| | | } else if (params == 2) { |
| | | return "å®¡æ ¸å®æ"; |
| | | } else if (params == 4) { |
| | | return "已鿰æäº¤"; |
| | | } else { |
| | | return 'ä¸éè¿'; |
| | | } |
| | | |
| | | // å¨æè¡¨æ ¼åé
ç½®ï¼æ ¹æ®å®¡æ¹ç±»åçæå |
| | | const tableColumnCopy = computed(() => { |
| | | const isLeaveType = currentApproveType.value === 2; // 请å管ç |
| | | const isReimburseType = currentApproveType.value === 4; // æ¥é管ç |
| | | const isQuotationType = currentApproveType.value === 6; // æ¥ä»·å®¡æ¹ |
| | | |
| | | // åºç¡åé
ç½® |
| | | const baseColumns = [ |
| | | { |
| | | label: "审æ¹ç¶æ", |
| | | prop: "approveStatus", |
| | | dataType: "tag", |
| | | width: 100, |
| | | formatData: (params) => { |
| | | if (params == 0) { |
| | | return "å¾
å®¡æ ¸"; |
| | | } else if (params == 1) { |
| | | return "å®¡æ ¸ä¸"; |
| | | } else if (params == 2) { |
| | | return "å®¡æ ¸å®æ"; |
| | | } else if (params == 4) { |
| | | return "已鿰æäº¤"; |
| | | } else { |
| | | return 'ä¸éè¿'; |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 0) { |
| | | return "warning"; |
| | | } else if (params == 1) { |
| | | return "primary"; |
| | | } else if (params == 2) { |
| | | return "success"; |
| | | } else if (params == 4) { |
| | | return "info"; |
| | | } else { |
| | | return 'danger'; |
| | | } |
| | | }, |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 0) { |
| | | return "warning"; |
| | | } else if (params == 1) { |
| | | return "primary"; |
| | | } else if (params == 2) { |
| | | return "success"; |
| | | } else if (params == 4) { |
| | | return ""; |
| | | } else { |
| | | return 'danger'; |
| | | } |
| | | { |
| | | label: "æµç¨ç¼å·", |
| | | prop: "approveId", |
| | | width: 170 |
| | | }, |
| | | }, |
| | | { |
| | | label: "æµç¨ç¼å·", |
| | | prop: "approveId", |
| | | width: 170 |
| | | }, |
| | | { |
| | | label: "ç³è¯·é¨é¨", |
| | | prop: "approveDeptName", |
| | | width: 220 |
| | | }, |
| | | { |
| | | label: "审æ¹äºç±", |
| | | prop: "approveReason", |
| | | width: 200 |
| | | }, |
| | | { |
| | | label: "ç³è¯·äºº", |
| | | prop: "approveUserName", |
| | | width: 120 |
| | | }, |
| | | { |
| | | label: "ç³è¯·æ¥æ", |
| | | prop: "approveTime", |
| | | width: 200 |
| | | }, |
| | | { |
| | | label: "ç»ææ¥æ", |
| | | prop: "approveOverTime", |
| | | width: 120 |
| | | }, |
| | | { |
| | | { |
| | | label: "ç³è¯·é¨é¨", |
| | | prop: "approveDeptName", |
| | | width: 220 |
| | | }, |
| | | { |
| | | label: isQuotationType ? "æ¥ä»·åå·" : "审æ¹äºç±", |
| | | prop: "approveReason", |
| | | width: 200 |
| | | }, |
| | | { |
| | | label: "ç³è¯·äºº", |
| | | prop: "approveUserName", |
| | | width: 120 |
| | | } |
| | | ]; |
| | | |
| | | // éé¢åï¼ä»
æ¥éç®¡çæ¾ç¤ºï¼ |
| | | if (isReimburseType) { |
| | | baseColumns.push({ |
| | | label: "éé¢ï¼å
ï¼", |
| | | prop: "price", |
| | | width: 120 |
| | | }); |
| | | } |
| | | |
| | | // æ¥æåï¼æ ¹æ®ç±»å卿é
ç½®ï¼ |
| | | baseColumns.push( |
| | | { |
| | | label: isLeaveType ? "å¼å§æ¥æ" : "ç³è¯·æ¥æ", |
| | | prop: isLeaveType ? "startDate" : "approveTime", |
| | | width: 200 |
| | | }, |
| | | { |
| | | label: "ç»ææ¥æ", |
| | | prop: isLeaveType ? "endDate" : "approveOverTime", |
| | | width: 120 |
| | | } |
| | | ); |
| | | |
| | | // å½å审æ¹äººå |
| | | baseColumns.push({ |
| | | label: "å½å审æ¹äºº", |
| | | prop: "approveUserCurrentName", |
| | | width: 120 |
| | | }, |
| | | { |
| | | }); |
| | | |
| | | // æä½å |
| | | baseColumns.push({ |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => row.approveStatus == 2 || row.approveStatus == 1 || row.approveStatus == 4 |
| | | disabled: (row) => currentApproveType.value === 6 || row.approveStatus == 2 || row.approveStatus == 1 || row.approveStatus == 4 |
| | | }, |
| | | { |
| | | name: "å®¡æ ¸", |
| | |
| | | clickFun: (row) => { |
| | | openApprovalDia("approval", row); |
| | | }, |
| | | disabled: (row) => row.approveUserCurrentId == null || row.approveStatus == 2 || row.approveStatus == 3 || row.approveStatus == 4 || row.approveUserCurrentId !== userStore.id |
| | | disabled: (row) => row.approveUserCurrentId == null || row.approveStatus == 2 || row.approveStatus == 3 || row.approveStatus == 4 || row.approveUserCurrentId !== userStore.id |
| | | }, |
| | | { |
| | | name: "详æ
", |
| | |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | }); |
| | | |
| | | return baseColumns; |
| | | }); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | approveProcessListPage({...page, ...searchForm.value,approveType:props.approveType}).then(res => { |
| | | approveProcessListPage({...page, ...searchForm.value, approveType: currentApproveType.value}).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records |
| | | page.total = res.data.total; |
| | |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | const type = Number(props.approveType || 0) |
| | | const type = currentApproveType.value |
| | | const urlMap = { |
| | | 0: "/approveProcess/exportZero", |
| | | 1: "/approveProcess/exportOne", |
| | |
| | | 3: "/approveProcess/exportThree", |
| | | 4: "/approveProcess/exportFour", |
| | | 5: "/approveProcess/exportFive", |
| | | 6: "/approveProcess/exportSix", |
| | | 7: "/approveProcess/exportSeven", |
| | | } |
| | | const url = urlMap[type] || urlMap[0] |
| | | const nameMap = { |
| | |
| | | 3: "åºå·®ç®¡ç审æ¹è¡¨", |
| | | 4: "æ¥é管ç审æ¹è¡¨", |
| | | 5: "éè´ç³è¯·å®¡æ¹è¡¨", |
| | | 6: "æ¥ä»·å®¡æ¹è¡¨", |
| | | 7: "åºåºå®¡æ¹è¡¨", |
| | | } |
| | | const fileName = nameMap[type] || nameMap[0] |
| | | proxy.download(url, {}, `${fileName}.xlsx`) |
| | |
| | | }); |
| | | }; |
| | | onMounted(() => { |
| | | // æ ¹æ®URLåæ°è®¾ç½®æ ç¾é¡µåæ¥è¯¢æ¡ä»¶ |
| | | const approveType = route.query.approveType; |
| | | const approveId = route.query.approveId; |
| | | |
| | | if (approveType) { |
| | | // 设置æ ç¾é¡µï¼approveType å¯¹åº activeTab ç nameï¼ |
| | | activeTab.value = String(approveType); |
| | | } |
| | | |
| | | if (approveId) { |
| | | // 设置æµç¨ç¼å·æ¥è¯¢æ¡ä»¶ |
| | | searchForm.value.approveId = String(approveId); |
| | | } |
| | | |
| | | // æ¥è¯¢å表 |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| | | <style scoped> |
| | | .approval-tabs { |
| | | margin-bottom: 10px; |
| | | } |
| | | </style> |
| | |
| | | getEmployeeDetail |
| | | } from '@/api/collaborativeApproval/enterpriseBook.js' |
| | | import { getUserProfile } from '@/api/system/user.js' |
| | | import {staffJoinListPage} from "@/api/personnelManagement/onboarding.js"; |
| | | import { |
| | | changeUserStatus, |
| | | listUser, |
| | |
| | | addUser, |
| | | deptTreeSelect, |
| | | } from "@/api/system/user"; |
| | | import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"; |
| | | |
| | | // æ ç¾é¡µç¶æ |
| | | const activeTab = ref('personal') |
| | |
| | | } |
| | | //è·ååå·¥å表 |
| | | const getEmployeeList = async () => { |
| | | staffJoinListPage(publicSearch.value).then(res => { |
| | | staffOnJobListPage(Object.assign({current: -1, size: -1},publicSearch.value)).then(res => { |
| | | console.log(res.data.records) |
| | | EmployeeList.value = res.data.records |
| | | }).catch(err => {}) |
| | |
| | | // è·ååä½é讯å½å表 |
| | | const getCompanyContactsList = async () => { |
| | | loading.value = true |
| | | staffJoinListPage(companySearch.value).then(res => { |
| | | staffOnJobListPage(Object.assign({current: -1, size: -1},companySearch.value)).then(res => { |
| | | // console.log(res.data.records) |
| | | companyContacts.value = res.data.records |
| | | }).catch(err => {}) |
| | |
| | | /> |
| | | <span class="search_title ml10">ç¥è¯ç±»åï¼</span> |
| | | <el-select v-model="searchForm.type" clearable @change="handleQuery" style="width: 240px"> |
| | | <el-option label="ååç¹æ¹" :value="'contract'" /> |
| | | <el-option label="å®¡æ¹æ¡ä¾" :value="'approval'" /> |
| | | <el-option label="è§£å³æ¹æ¡" :value="'solution'" /> |
| | | <el-option label="ç»éªæ»ç»" :value="'experience'" /> |
| | | <el-option label="æä½æå" :value="'guide'" /> |
| | | <el-option |
| | | v-for="item in knowledgeTypeOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | æç´¢ |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¥è¯ç±»å" prop="type"> |
| | | <el-select v-model="form.type" placeholder="è¯·éæ©ç¥è¯ç±»å" style="width: 100%"> |
| | | <el-option label="ååç¹æ¹" value="contract" /> |
| | | <el-option label="å®¡æ¹æ¡ä¾" value="approval" /> |
| | | <el-option label="è§£å³æ¹æ¡" value="solution" /> |
| | | <el-option label="ç»éªæ»ç»" value="experience" /> |
| | | <el-option label="æä½æå" value="guide" /> |
| | | <el-option |
| | | v-for="item in knowledgeTypeOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { listKnowledgeBase, delKnowledgeBase,addKnowledgeBase,updateKnowledgeBase } from "@/api/collaborativeApproval/knowledgeBase.js"; |
| | |
| | | prop: "type", |
| | | dataType: "tag", |
| | | formatData: (params) => { |
| | | const typeMap = { |
| | | contract: "ååç¹æ¹", |
| | | approval: "å®¡æ¹æ¡ä¾", |
| | | solution: "è§£å³æ¹æ¡", |
| | | experience: "ç»éªæ»ç»", |
| | | guide: "æä½æå" |
| | | }; |
| | | return typeMap[params] || params; |
| | | return getKnowledgeTypeLabel(params); |
| | | }, |
| | | formatType: (params) => { |
| | | const typeMap = { |
| | | contract: "success", |
| | | approval: "warning", |
| | | solution: "primary", |
| | | experience: "info", |
| | | guide: "danger" |
| | | }; |
| | | return typeMap[params] || "info"; |
| | | return getKnowledgeTypeTagType(params); |
| | | } |
| | | }, |
| | | { |
| | |
| | | } |
| | | ]); |
| | | |
| | | // æ¨¡ææ°æ® |
| | | // let mockData = [ |
| | | // { |
| | | // id: "1", |
| | | // title: "ç¹æ®ååå®¡æ¹æµç¨ä¼åæ¹æ¡", |
| | | // type: "contract", |
| | | // scenario: "大é¢ååå¿«é审æ¹", |
| | | // efficiency: "high", |
| | | // problem: "大é¢ååå®¡æ¹æµç¨å¤æï¼å®¡æ¹æ¶é´é¿ï¼å½±åä¸å¡è¿å±", |
| | | // solution: "建ç«ç»¿è²ééï¼å¯¹ç¬¦åæ¡ä»¶çååéç¨ç®åå®¡æ¹æµç¨ï¼ç±é¨é¨è´è´£äººç´æ¥å®¡æ¹ï¼å¹³åå®¡æ¹æ¶é´ä»3天缩çè³1天", |
| | | // keyPoints: "绿è²é鿡件,ç®åæµç¨,å®¡æ¹æé,æ¶é´æ§å¶", |
| | | // creator: "å¼ ç»ç", |
| | | // usageCount: 15, |
| | | // createTime: "2024-01-15 10:30:00" |
| | | // }, |
| | | // { |
| | | // id: "2", |
| | | // title: "è·¨é¨é¨åä½å®¡æ¹ç»éªæ»ç»", |
| | | // type: "experience", |
| | | // scenario: "å¤é¨é¨åä½é¡¹ç®", |
| | | // efficiency: "medium", |
| | | // problem: "è·¨é¨é¨é¡¹ç®å®¡æ¹æ¶ï¼åé¨é¨æè§ä¸ç»ä¸ï¼å®¡æ¹è¿åº¦ç¼æ
¢", |
| | | // solution: "建ç«é¡¹ç®åè°æºå¶ï¼æå®é¡¹ç®è´è´£äººï¼å®æå¬å¼åè°ä¼è®®ï¼ç»ä¸åæ¹æè§ååè¿è¡å®¡æ¹", |
| | | // keyPoints: "项ç®åè°,宿ä¼è®®,ç»ä¸æè§,è´è´£äººå¶åº¦", |
| | | // creator: "æä¸»ç®¡", |
| | | // usageCount: 8, |
| | | // createTime: "2024-01-14 15:20:00" |
| | | // }, |
| | | // { |
| | | // id: "3", |
| | | // title: "ç´§æ¥éè´å®¡æ¹æä½æå", |
| | | // type: "guide", |
| | | // scenario: "ç´§æ¥éè´éæ±", |
| | | // efficiency: "high", |
| | | // problem: "ç´§æ¥éè´æ¶å®¡æ¹æµç¨å¤æï¼æ æ³æ»¡è¶³ç´§æ¥éæ±", |
| | | // solution: "å¶å®ç´§æ¥éè´å®¡æ¹æ åï¼æç¡®ç´§æ¥ç¨åº¦å级ï¼ä¸å级å«éç¨ä¸åå®¡æ¹æµç¨ï¼ç¡®ä¿ç´§æ¥éæ±å¾å°åæ¶å¤ç", |
| | | // keyPoints: "ç´§æ¥å级,æ åå¶å®,æµç¨ç®å,åæ¶å¤ç", |
| | | // creator: "çä¸å", |
| | | // usageCount: 12, |
| | | // createTime: "2024-01-13 09:15:00" |
| | | // } |
| | | // ]; |
| | | |
| | | // ç¥è¯æ 颿¨¡æ¿ |
| | | const titleTemplates = [ |
| | | "{type}å®¡æ¹æµç¨ä¼åæ¹æ¡", |
| | | "{scenario}å¤çç»éªæ»ç»", |
| | | "{type}ç¹æ®æ
åµå¤çæå", |
| | | "{scenario}å¿«éå®¡æ¹æ¹æ¡", |
| | | "{type}æ ååæä½æµç¨", |
| | | "{scenario}é®é¢è§£å³æ¹æ¡", |
| | | "{type}æä½³å®è·µæ»ç»", |
| | | "{scenario}æçæåæ¹æ¡" |
| | | ]; |
| | | |
| | | // ç¥è¯ç±»åé
ç½® |
| | | const knowledgeTypes = [ |
| | | { type: "contract", label: "ååç¹æ¹", efficiency: "high" }, |
| | | { type: "approval", label: "å®¡æ¹æ¡ä¾", efficiency: "medium" }, |
| | | { type: "solution", label: "è§£å³æ¹æ¡", efficiency: "high" }, |
| | | { type: "experience", label: "ç»éªæ»ç»", efficiency: "medium" }, |
| | | { type: "guide", label: "æä½æå", efficiency: "low" } |
| | | ]; |
| | | |
| | | // åºæ¯å表 |
| | | const scenarios = ["大é¢åå审æ¹", "è·¨é¨é¨åä½", "ç´§æ¥éè´", "ç¹æ®ç³è¯·", "æµç¨ä¼å", "é®é¢å¤ç", "æ åå建设", "æçæå"]; |
| | | |
| | | // èªå¨çææ°æ°æ® |
| | | const generateNewData = () => { |
| | | const newId = (mockData.length + 1).toString(); |
| | | const now = new Date(); |
| | | const randomType = knowledgeTypes[Math.floor(Math.random() * knowledgeTypes.length)]; |
| | | const randomScenario = scenarios[Math.floor(Math.random() * scenarios.length)]; |
| | | |
| | | // çæéæºæ é¢ |
| | | let title = titleTemplates[Math.floor(Math.random() * titleTemplates.length)]; |
| | | title = title |
| | | .replace('{type}', randomType.label) |
| | | .replace('{scenario}', randomScenario); |
| | | |
| | | const newKnowledge = { |
| | | id: newId, |
| | | title: title, |
| | | type: randomType.type, |
| | | scenario: randomScenario, |
| | | efficiency: randomType.efficiency, |
| | | problem: `å¨${randomScenario}è¿ç¨ä¸éå°çé®é¢æè¿°...`, |
| | | solution: `é对${randomScenario}çè§£å³æ¹æ¡åæä½æ¥éª¤...`, |
| | | keyPoints: "å
³é®è¦ç¹1,å
³é®è¦ç¹2,å
³é®è¦ç¹3,å
³é®è¦ç¹4", |
| | | creator: ["å¼ ç»ç", "æä¸»ç®¡", "çä¸å", "åæ»ç"][Math.floor(Math.random() * 4)], |
| | | usageCount: Math.floor(Math.random() * 20) + 1, |
| | | createTime: now.toLocaleString() |
| | | }; |
| | | |
| | | // æ·»å å°æ°æ®å¼å¤´ |
| | | mockData.unshift(newKnowledge); |
| | | |
| | | // ä¿ææ°æ®éå¨åçèå´å
ï¼æå¤ä¿ç30æ¡ï¼ |
| | | if (mockData.length > 30) { |
| | | mockData = mockData.slice(0, 30); |
| | | } |
| | | |
| | | console.log(`[${new Date().toLocaleString()}] èªå¨çææ°ç¥è¯: ${title}`); |
| | | }; |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | getList(); |
| | |
| | | // å¼å§èªå¨å·æ° |
| | | const startAutoRefresh = () => { |
| | | setInterval(() => { |
| | | generateNewData(); |
| | | getList(); |
| | | }, 600000); // 10åéå·æ°ä¸æ¬¡ (10 * 60 * 1000 = 600000ms) |
| | | }; |
| | |
| | | |
| | | // è·åç±»åæ ç¾ææ¬ |
| | | const getTypeLabel = (type) => { |
| | | const typeMap = { |
| | | contract: "ååç¹æ¹", |
| | | approval: "å®¡æ¹æ¡ä¾", |
| | | solution: "è§£å³æ¹æ¡", |
| | | experience: "ç»éªæ»ç»", |
| | | guide: "æä½æå" |
| | | }; |
| | | return typeMap[type] || type; |
| | | return getKnowledgeTypeLabel(type); |
| | | }; |
| | | |
| | | // è·åæçæ ç¾ç±»å |
| | |
| | | }); |
| | | }; |
| | | |
| | | // æ¶èç¥è¯ |
| | | const markAsFavorite = () => { |
| | | // å¢å ä½¿ç¨æ¬¡æ° |
| | | const index = mockData.findIndex(item => item.id === currentKnowledge.value.id); |
| | | if (index !== -1) { |
| | | mockData[index].usageCount += 1; |
| | | currentKnowledge.value.usageCount += 1; |
| | | } |
| | | |
| | | ElMessage.success("å·²æ¶èï¼ä½¿ç¨æ¬¡æ°+1"); |
| | | }; |
| | | |
| | | // æäº¤ç¥è¯è¡¨å |
| | | const submitForm = async () => { |
| | | try { |
| | |
| | | |
| | | // å¯¼åº |
| | | const { proxy } = getCurrentInstance() |
| | | const { knowledge_type } = proxy.useDict("knowledge_type") |
| | | |
| | | // åå
¸å·¥å
· |
| | | const knowledgeTypeOptions = computed(() => knowledge_type?.value || []) |
| | | const getKnowledgeTypeLabel = (val) => { |
| | | const item = knowledgeTypeOptions.value.find(i => String(i.value) === String(val)) |
| | | return item ? item.label : val |
| | | } |
| | | const getKnowledgeTypeTagType = (val) => { |
| | | const item = knowledgeTypeOptions.value.find(i => String(i.value) === String(val)) |
| | | return item?.elTagType || "info" |
| | | } |
| | | const handleExport = () => { |
| | | proxy.download('/knowledgeBase/export', { ...searchForm.value }, 'ç¥è¯åº.xlsx') |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="tabs-wrapper"> |
| | | <el-tabs |
| | | v-model="activeTab" |
| | | class="meeting-tabs" |
| | | @tab-change="handleTabChange" |
| | | > |
| | | <el-tab-pane label="ä¼è®®è®¾ç½®" name="setting" /> |
| | | <el-tab-pane label="ä¼è®®å表" name="index" /> |
| | | <el-tab-pane label="ä¼è®®ç³è¯·" name="application" /> |
| | | <el-tab-pane label="ä¼è®®å®¡æ¹" name="examine" /> |
| | | <el-tab-pane label="ä¼è®®åå¸" name="publish" /> |
| | | <el-tab-pane label="ä¼è®®æ»ç»" name="summary" /> |
| | | </el-tabs> |
| | | </div> |
| | | |
| | | <div class="tab-content"> |
| | | <keep-alive> |
| | | <component :is="currentComponent" /> |
| | | </keep-alive> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed } from 'vue' |
| | | import MeetSetting from '../notificationManagement/meetSetting/index.vue' |
| | | import MeetIndex from '../notificationManagement/meetIndex/index.vue' |
| | | import MeetApplication from '../notificationManagement/meetApplication/index.vue' |
| | | import MeetExamine from '../notificationManagement/meetExamine/index.vue' |
| | | import MeetPublish from '../notificationManagement/meetPublish/index.vue' |
| | | import MeetSummary from '../notificationManagement/summary/index.vue' |
| | | |
| | | const activeTab = ref('setting') |
| | | |
| | | const tabComponentMap = { |
| | | setting: MeetSetting, |
| | | index: MeetIndex, |
| | | application: MeetApplication, |
| | | examine: MeetExamine, |
| | | publish: MeetPublish, |
| | | summary: MeetSummary |
| | | } |
| | | |
| | | const currentComponent = computed(() => tabComponentMap[activeTab.value] || MeetSetting) |
| | | |
| | | function handleTabChange(name) { |
| | | activeTab.value = name |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | .tabs-wrapper { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .tab-content { |
| | | min-height: 400px; |
| | | } |
| | | </style> |
| | | |
| | |
| | | <div class="search_form"> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢å
Œ</el-button> |
| | | <el-button type="danger" plain @click="handleDelete" :disabled="!selectedIds.length">å é¤</el-button> |
| | | <el-button type="info" @click="openNoticeTypeDialog">å
¬åç±»åé
ç½®</el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- éç¥å
¬åæ¿ --> |
| | | <div class="notice-board"> |
| | | <!-- æ¾åéç¥åºå --> |
| | | <div class="notice-section" v-if="holidayNoticeCount > 0"> |
| | | <div class="section-header"> |
| | | <h3>ð
æ¾åéç¥</h3> |
| | | <span class="section-count">{{ holidayNoticeCount }}æ¡</span> |
| | | </div> |
| | | <div class="notice-cards"> |
| | | <div |
| | | v-for="notice in holidayNotices" |
| | | :key="notice.id" |
| | | class="notice-card holiday-card" |
| | | :class="{ 'urgent': notice.priority === '3' }" |
| | | > |
| | | <div class="card-header"> |
| | | <div class="card-title"> |
| | | <el-icon class="holiday-icon"> |
| | | <Calendar/> |
| | | </el-icon> |
| | | {{ notice.title }} |
| | | </div> |
| | | <div class="card-actions"> |
| | | <el-button link type="primary" @click="handleEdit(notice)" :disabled="isNoticeExpired(notice)">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="handleDelete(notice.id)">å é¤</el-button> |
| | | <el-tabs v-model="activeNoticeTypeTab" @tab-change="handleNoticeTypeTabChange"> |
| | | <el-tab-pane |
| | | v-for="noticeType in noticeTypeList" |
| | | :key="noticeType.id" |
| | | :label="noticeType.noticeType" |
| | | :name="String(noticeType.id)" |
| | | > |
| | | <template #label> |
| | | <span>{{ noticeType.noticeType }} |
| | | <span class="tab-count" v-if="getNoticeCountByType(noticeType.id) > 0"> |
| | | ({{ getNoticeCountByType(noticeType.id) }}) |
| | | </span> |
| | | </span> |
| | | </template> |
| | | |
| | | <div class="notice-section"> |
| | | <div class="notice-cards"> |
| | | <div |
| | | v-for="notice in getNoticesByType(noticeType.id)" |
| | | :key="notice.id" |
| | | class="notice-card" |
| | | :class="{ 'urgent': notice.priority === '3' }" |
| | | > |
| | | <div class="card-header"> |
| | | <div class="card-title"> |
| | | <el-icon class="notice-icon"> |
| | | <Calendar/> |
| | | </el-icon> |
| | | {{ notice.title }} |
| | | </div> |
| | | <div class="card-actions"> |
| | | <el-button link type="primary" @click="handleEdit(notice)" :disabled="isNoticeExpired(notice)" v-if="notice.status !== 1">ç¼è¾</el-button> |
| | | <el-button link type="success" @click="handlePublish(notice)" v-if="notice.status === 0">åå¸</el-button> |
| | | <el-button link type="danger" @click="handleDelete(notice.id)" v-if="notice.status !== 1">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="card-content"> |
| | | <p>{{ notice.content }}</p> |
| | | </div> |
| | | <div class="card-footer"> |
| | | <div class="card-meta"> |
| | | <span class="priority" :class="'priority-' + notice.priority"> |
| | | {{ getPriorityText(notice.priority) }} |
| | | </span> |
| | | <span class="status" :class="'status-' + getNoticeStatus(notice)"> |
| | | {{ getStatusText(getNoticeStatus(notice)) }} |
| | | </span> |
| | | </div> |
| | | <div class="card-info"> |
| | | <span class="creator">{{ notice.createUserName }}</span> |
| | | <span class="expiration" v-if="notice.expirationDate">æªæ¢æ¥æï¼{{ notice.expirationDate }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="card-remark" v-if="notice.remark"> |
| | | <el-icon> |
| | | <InfoFilled/> |
| | | </el-icon> |
| | | <span>{{ notice.remark }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="card-content"> |
| | | <p>{{ notice.content }}</p> |
| | | </div> |
| | | <div class="card-footer"> |
| | | <div class="card-meta"> |
| | | <span class="priority" :class="'priority-' + notice.priority"> |
| | | {{ getPriorityText(notice.priority) }} |
| | | </span> |
| | | <span class="status" :class="'status-' + getNoticeStatus(notice)"> |
| | | {{ getStatusText(getNoticeStatus(notice)) }} |
| | | </span> |
| | | </div> |
| | | <div class="card-info"> |
| | | <span class="creator">{{ notice.createUserName }}</span> |
| | | <span class="expiration" v-if="notice.expirationDate">æªæ¢æ¥æï¼{{ notice.expirationDate }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="card-remark" v-if="notice.remark"> |
| | | <el-icon> |
| | | <InfoFilled/> |
| | | </el-icon> |
| | | <span>{{ notice.remark }}</span> |
| | | |
| | | <pagination |
| | | v-if="getNoticePageByType(noticeType.id).total > 0" |
| | | :total="getNoticePageByType(noticeType.id).total" |
| | | :page="getNoticePageByType(noticeType.id).current" |
| | | :limit="getNoticePageByType(noticeType.id).size" |
| | | @pagination="(val) => handleNoticeCurrentChange(noticeType.id, val)" |
| | | /> |
| | | |
| | | <!-- ç©ºç¶æ --> |
| | | <div class="empty-state" v-if="getNoticesByType(noticeType.id).length === 0"> |
| | | <el-empty description="ææ éç¥å
Œ"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <pagination |
| | | v-if="holidayNoticePage.total > 0" |
| | | :total="holidayNoticePage.total" |
| | | :page="holidayNoticePage.current" |
| | | :limit="holidayNoticePage.size" |
| | | @pagination="handleHolidayNoticeCurrentChange" |
| | | /> |
| | | |
| | | <!-- 设å¤ç»´ä¿®éç¥åºå --> |
| | | <div class="notice-section" v-if="maintenanceNoticeCount > 0"> |
| | | <div class="section-header"> |
| | | <h3>ð§ 设å¤ç»´ä¿®éç¥</h3> |
| | | <span class="section-count">{{ maintenanceNoticeCount }}æ¡</span> |
| | | </div> |
| | | <div class="notice-cards"> |
| | | <div |
| | | v-for="notice in maintenanceNotices" |
| | | :key="notice.id" |
| | | class="notice-card maintenance-card" |
| | | :class="{ 'urgent': notice.priority === '3' }" |
| | | > |
| | | <div class="card-header"> |
| | | <div class="card-title"> |
| | | <el-icon class="maintenance-icon"> |
| | | <Tools/> |
| | | </el-icon> |
| | | {{ notice.title }} |
| | | </div> |
| | | <div class="card-actions"> |
| | | <el-button link type="primary" @click="handleEdit(notice)" :disabled="isNoticeExpired(notice)">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="handleDelete(notice.id)">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="card-content"> |
| | | <p>{{ notice.content }}</p> |
| | | </div> |
| | | <div class="card-footer"> |
| | | <div class="card-meta"> |
| | | <span class="priority" :class="'priority-' + notice.priority"> |
| | | {{ getPriorityText(notice.priority) }} |
| | | </span> |
| | | <span class="status" :class="'status-' + getNoticeStatus(notice)"> |
| | | {{ getStatusText(getNoticeStatus(notice)) }} |
| | | </span> |
| | | </div> |
| | | <div class="card-info"> |
| | | <span class="creator">{{ notice.createUserName }}</span> |
| | | <span class="expiration" v-if="notice.expirationDate">æªæ¢æ¥æï¼{{ notice.expirationDate }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="card-remark" v-if="notice.remark"> |
| | | <el-icon> |
| | | <InfoFilled/> |
| | | </el-icon> |
| | | <span>{{ notice.remark }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <pagination |
| | | v-if="maintenanceNoticePage.total > 0" |
| | | :total="maintenanceNoticePage.total" |
| | | :page="maintenanceNoticePage.current" |
| | | :limit="maintenanceNoticePage.size" |
| | | @pagination="handleMaintenanceNoticeCurrentChange" |
| | | /> |
| | | |
| | | <!-- ç©ºç¶æ --> |
| | | <div class="empty-state" v-if="holidayNotices.length === 0 && maintenanceNotices.length === 0"> |
| | | <el-empty description="ææ éç¥å
Œ"/> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¬åç±»å" prop="type"> |
| | | <el-select v-model="form.type" placeholder="è¯·éæ©å
¬åç±»å" style="width: 100%"> |
| | | <el-option label="æ¾åéç¥" :value="1"/> |
| | | <el-option label="设å¤ç»´ä¿®éç¥" :value="2"/> |
| | | <el-option |
| | | v-for="item in noticeTypeList" |
| | | :key="item.id" |
| | | :label="item.noticeType" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- å
¬åç±»åé
ç½®å¼¹æ¡ --> |
| | | <el-dialog |
| | | v-model="noticeTypeDialogVisible" |
| | | title="å
¬åç±»åé
ç½®" |
| | | width="800px" |
| | | @close="handleNoticeTypeDialogClose" |
| | | > |
| | | <div class="notice-type-container"> |
| | | <div class="notice-type-header"> |
| | | <el-button type="primary" @click="handleAddNoticeType">æ°å¢ç±»å</el-button> |
| | | </div> |
| | | <el-table :data="noticeTypeList" border style="width: 100%"> |
| | | <el-table-column prop="id" label="ID" width="80" align="center"/> |
| | | <el-table-column prop="noticeType" label="å
¬åç±»å" align="center"> |
| | | <template #default="scope"> |
| | | <el-input |
| | | v-if="scope.row.editing" |
| | | v-model="scope.row.noticeType" |
| | | placeholder="请è¾å
¥å
¬åç±»å" |
| | | /> |
| | | <span v-else>{{ scope.row.noticeType }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="200" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | v-if="scope.row.editing" |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="handleSaveNoticeType(scope.row)" |
| | | > |
| | | ä¿å |
| | | </el-button> |
| | | <el-button |
| | | v-if="scope.row.editing" |
| | | link |
| | | type="info" |
| | | size="small" |
| | | @click="handleCancelEdit(scope.row)" |
| | | > |
| | | åæ¶ |
| | | </el-button> |
| | | <el-button |
| | | v-if="!scope.row.editing" |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="handleEditNoticeType(scope.row)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | v-if="!scope.row.editing" |
| | | link |
| | | type="danger" |
| | | size="small" |
| | | @click="handleDeleteNoticeType(scope.row)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {Search, Calendar, Tools, InfoFilled} from "@element-plus/icons-vue"; |
| | | import {Calendar, InfoFilled} from "@element-plus/icons-vue"; |
| | | import {onMounted, ref, reactive, toRefs, computed} from "vue"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import {useRoute} from "vue-router"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { |
| | | addNotice, |
| | | delNotice, |
| | | getCount, |
| | | listNotice, |
| | | updateNotice |
| | | updateNotice, |
| | | listNoticeType, |
| | | addNoticeType, |
| | | delNoticeType |
| | | } from "../../../api/collaborativeApproval/noticeManagement.js"; |
| | | import pagination from "../../../components/PIMTable/Pagination.vue"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const route = useRoute(); |
| | | |
| | | // ååºå¼æ°æ® |
| | | const data = reactive({ |
| | |
| | | // 页é¢ç¶æ |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref(""); |
| | | const selectedIds = ref([]); |
| | | const formRef = ref(); |
| | | |
| | | // å
¬åç±»åé
ç½®ç¸å
³ |
| | | const noticeTypeDialogVisible = ref(false); |
| | | const noticeTypeList = ref([]); |
| | | const activeNoticeTypeTab = ref(''); |
| | | |
| | | // éç¥æ°æ® - ä½¿ç¨ Map åå¨ï¼key 为类å id |
| | | const noticesMap = ref({}); |
| | | const noticePagesMap = ref({}); |
| | | |
| | | |
| | | // 计ç®å±æ§ |
| | |
| | | }); |
| | | }; |
| | | |
| | | const handlePublish = (notice) => { |
| | | ElMessageBox.confirm( |
| | | "确认åå¸è¿æ¡å
¬ååï¼", |
| | | "æç¤º", |
| | | { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "info" |
| | | } |
| | | ).then(() => { |
| | | updateNotice({ |
| | | ...notice, |
| | | status: 1 |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success("å叿å"); |
| | | resetTable() |
| | | } |
| | | }) |
| | | }); |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | |
| | | }); |
| | | }; |
| | | |
| | | const holidayNoticeCount = ref() |
| | | const maintenanceNoticeCount = ref() |
| | | const fetchCount = () => { |
| | | getCount().then(res => { |
| | | holidayNoticeCount.value = res.data.filter(item => { |
| | | return item.type === 1 |
| | | })[0].count; |
| | | maintenanceNoticeCount.value = res.data.filter(item => { |
| | | return item.type === 2 |
| | | })[0].count; |
| | | }); |
| | | } |
| | | // åå§åæä¸ªç±»åçåé¡µæ°æ® |
| | | const initNoticePage = (typeId) => { |
| | | if (!noticePagesMap.value[typeId]) { |
| | | noticePagesMap.value[typeId] = { |
| | | total: 0, |
| | | current: 1, |
| | | size: 10 |
| | | }; |
| | | } |
| | | if (!noticesMap.value[typeId]) { |
| | | noticesMap.value[typeId] = []; |
| | | } |
| | | }; |
| | | |
| | | const holidayNotices = ref([]) |
| | | const maintenanceNotices = ref([]) |
| | | const holidayNoticePage = ref({ |
| | | total: 0, |
| | | current: 1, |
| | | size: 9 |
| | | }) |
| | | // è·åæä¸ªç±»åçéç¥å表 |
| | | const getNoticesByType = (typeId) => { |
| | | return noticesMap.value[typeId] || []; |
| | | }; |
| | | |
| | | const maintenanceNoticePage = ref({ |
| | | total: 0, |
| | | current: 1, |
| | | size: 9 |
| | | }) |
| | | // è·åæä¸ªç±»åçåé¡µæ°æ® |
| | | const getNoticePageByType = (typeId) => { |
| | | return noticePagesMap.value[typeId] || { total: 0, current: 1, size: 10 }; |
| | | }; |
| | | |
| | | const fetchHolidayNotices = () => { |
| | | listNotice({...holidayNoticePage.value, type: 1}).then(res => { |
| | | holidayNotices.value = res.data.records |
| | | holidayNoticePage.value.total = res.data.total |
| | | // è·åæä¸ªç±»åçæ°é |
| | | const getNoticeCountByType = (typeId) => { |
| | | return getNoticePageByType(typeId).total || 0; |
| | | }; |
| | | |
| | | // è·åæä¸ªç±»åçéç¥æ°æ® |
| | | const fetchNoticesByType = (typeId) => { |
| | | initNoticePage(typeId); |
| | | const pageData = noticePagesMap.value[typeId]; |
| | | listNotice({...pageData, type: typeId}).then(res => { |
| | | if (res.code === 200) { |
| | | noticesMap.value[typeId] = res.data.records || []; |
| | | noticePagesMap.value[typeId].total = res.data.total || 0; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const fetchMaintenanceNotices = () => { |
| | | listNotice({...holidayNoticePage.value, type: 2}).then(res => { |
| | | maintenanceNotices.value = res.data.records |
| | | maintenanceNoticePage.value.total = res.data.total |
| | | }); |
| | | // å¤çå页åå |
| | | const handleNoticeCurrentChange = (typeId, val) => { |
| | | initNoticePage(typeId); |
| | | noticePagesMap.value[typeId].size = val.limit; |
| | | noticePagesMap.value[typeId].current = val.page; |
| | | fetchNoticesByType(typeId); |
| | | }; |
| | | |
| | | const handleHolidayNoticeCurrentChange = (val) => { |
| | | holidayNoticePage.value.size = val.limit |
| | | holidayNoticePage.value.current = val.page |
| | | fetchHolidayNotices() |
| | | }; |
| | | |
| | | const handleMaintenanceNoticeCurrentChange = (val) => { |
| | | maintenanceNoticePage.value.size = val.limit |
| | | maintenanceNoticePage.value.current = val.page |
| | | fetchMaintenanceNotices() |
| | | // å¤ç tab 忢 |
| | | const handleNoticeTypeTabChange = (tabName) => { |
| | | activeNoticeTypeTab.value = tabName; |
| | | const typeId = Number(tabName); |
| | | fetchNoticesByType(typeId); |
| | | }; |
| | | |
| | | const resetTable = () => { |
| | | holidayNoticePage.value.current = 1 |
| | | holidayNoticePage.value.size = 9 |
| | | maintenanceNoticePage.value.current = 1 |
| | | maintenanceNoticePage.value.size = 9 |
| | | fetchHolidayNotices() |
| | | fetchMaintenanceNotices() |
| | | fetchCount() |
| | | // éç½®ææç±»åçå页并鿰è·åæ°æ® |
| | | noticeTypeList.value.forEach(type => { |
| | | initNoticePage(type.id); |
| | | noticePagesMap.value[type.id].current = 1; |
| | | noticePagesMap.value[type.id].size = 10; |
| | | fetchNoticesByType(type.id); |
| | | }); |
| | | }; |
| | | |
| | | const resetForm = () => { |
| | | formRef.value?.resetFields(); |
| | | }; |
| | | |
| | | // å
¬åç±»åé
ç½®ç¸å
³æ¹æ³ |
| | | const openNoticeTypeDialog = () => { |
| | | noticeTypeDialogVisible.value = true; |
| | | fetchNoticeTypeList(); |
| | | }; |
| | | |
| | | const fetchNoticeTypeList = () => { |
| | | return listNoticeType().then(res => { |
| | | if (res.code === 200) { |
| | | noticeTypeList.value = res.data.map(item => ({ |
| | | ...item, |
| | | editing: false |
| | | })); |
| | | |
| | | // æ£æ¥è·¯ç±åæ°ä¸ç type |
| | | const routeType = route.query.type; |
| | | let targetTypeId = null; |
| | | |
| | | if (routeType) { |
| | | // å¦æè·¯ç±åæ°ä¸æ typeï¼æ¥æ¾å¯¹åºçç±»å |
| | | const typeId = Number(routeType); |
| | | const foundType = noticeTypeList.value.find(item => item.id === typeId); |
| | | if (foundType) { |
| | | targetTypeId = typeId; |
| | | } |
| | | } |
| | | |
| | | // 妿æç±»åæ°æ® |
| | | if (noticeTypeList.value.length > 0) { |
| | | // å¦æè·¯ç±åæ°æå®äºç±»åä¸åå¨ï¼ä½¿ç¨è·¯ç±åæ°çç±»å |
| | | // å¦åå¦ææ²¡æéä¸ tabï¼é»è®¤éä¸ç¬¬ä¸ä¸ª |
| | | if (targetTypeId !== null) { |
| | | activeNoticeTypeTab.value = String(targetTypeId); |
| | | fetchNoticesByType(targetTypeId); |
| | | } else if (!activeNoticeTypeTab.value) { |
| | | activeNoticeTypeTab.value = String(noticeTypeList.value[0].id); |
| | | fetchNoticesByType(noticeTypeList.value[0].id); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const handleAddNoticeType = () => { |
| | | const newItem = { |
| | | id: undefined, |
| | | noticeType: '', |
| | | editing: true |
| | | }; |
| | | noticeTypeList.value.push(newItem); |
| | | }; |
| | | |
| | | const handleEditNoticeType = (row) => { |
| | | // ä¿ååå§å¼ |
| | | row.originalNoticeType = row.noticeType; |
| | | row.editing = true; |
| | | }; |
| | | |
| | | const handleSaveNoticeType = (row) => { |
| | | if (!row.noticeType || row.noticeType.trim() === '') { |
| | | ElMessage.warning('å
¬åç±»åä¸è½ä¸ºç©º'); |
| | | return; |
| | | } |
| | | |
| | | const data = { |
| | | noticeType: row.noticeType.trim() |
| | | }; |
| | | |
| | | if (row.id) { |
| | | // ç¼è¾æ¨¡å¼ - å
å é¤åæ·»å ï¼å ä¸ºåªæ add å del æ¥å£ï¼ |
| | | delNoticeType(row.id).then(res => { |
| | | if (res.code === 200) { |
| | | addNoticeType(data).then(addRes => { |
| | | if (addRes.code === 200) { |
| | | ElMessage.success('ç¼è¾æå'); |
| | | row.editing = false; |
| | | delete row.originalNoticeType; |
| | | fetchNoticeTypeList().then(() => { |
| | | // 妿å½åéä¸çç±»å被ç¼è¾ï¼éè¦éæ°è·åæ°æ® |
| | | if (activeNoticeTypeTab.value === String(row.id)) { |
| | | fetchNoticesByType(addRes.data?.id || row.id); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ |
| | | addNoticeType(data).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('æ°å¢æå'); |
| | | row.editing = false; |
| | | fetchNoticeTypeList(); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const handleDeleteNoticeType = (row) => { |
| | | // å¦ææ²¡æidï¼è¯´ææ¯æ°å¢ä½æªä¿åçè¡ï¼ç´æ¥ä»å端å é¤ |
| | | if (!row.id) { |
| | | const index = noticeTypeList.value.indexOf(row); |
| | | if (index > -1) { |
| | | noticeTypeList.value.splice(index, 1); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | // 妿æidï¼è°ç¨å端æ¥å£å é¤ |
| | | ElMessageBox.confirm( |
| | | "确认å é¤è¿ä¸ªå
¬åç±»ååï¼", |
| | | "æç¤º", |
| | | { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | } |
| | | ).then(() => { |
| | | delNoticeType(row.id).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | // 妿å é¤çæ¯å½åéä¸çç±»åï¼åæ¢å°ç¬¬ä¸ä¸ªç±»å |
| | | if (activeNoticeTypeTab.value === String(row.id)) { |
| | | fetchNoticeTypeList().then(() => { |
| | | if (noticeTypeList.value.length > 0) { |
| | | activeNoticeTypeTab.value = String(noticeTypeList.value[0].id); |
| | | fetchNoticesByType(noticeTypeList.value[0].id); |
| | | } else { |
| | | activeNoticeTypeTab.value = ''; |
| | | } |
| | | }); |
| | | } else { |
| | | fetchNoticeTypeList(); |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const handleCancelEdit = (row) => { |
| | | if (!row.id) { |
| | | // å¦ææ¯æ°å¢ä½æªä¿åçè¡ï¼ç§»é¤å® |
| | | const index = noticeTypeList.value.indexOf(row); |
| | | if (index > -1) { |
| | | noticeTypeList.value.splice(index, 1); |
| | | } |
| | | } else { |
| | | // 妿æ¯ç¼è¾ä¸çè¡ï¼åæ¶ç¼è¾ç¶æå¹¶æ¢å¤åå¼ |
| | | row.editing = false; |
| | | if (row.originalNoticeType !== undefined) { |
| | | row.noticeType = row.originalNoticeType; |
| | | delete row.originalNoticeType; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const handleNoticeTypeDialogClose = () => { |
| | | // å
³éå¼¹æ¡æ¶ï¼åæ¶ææç¼è¾ç¶æ |
| | | noticeTypeList.value.forEach(item => { |
| | | if (item.editing && !item.id) { |
| | | // å¦ææ¯æ°å¢ä½æªä¿åçè¡ï¼ç§»é¤å® |
| | | const index = noticeTypeList.value.indexOf(item); |
| | | if (index > -1) { |
| | | noticeTypeList.value.splice(index, 1); |
| | | } |
| | | } else if (item.editing) { |
| | | // 妿æ¯ç¼è¾ä¸çè¡ï¼åæ¶ç¼è¾ç¶æå¹¶æ¢å¤åå¼ |
| | | item.editing = false; |
| | | if (item.originalNoticeType !== undefined) { |
| | | item.noticeType = item.originalNoticeType; |
| | | delete item.originalNoticeType; |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | fetchCount() |
| | | fetchHolidayNotices() |
| | | fetchMaintenanceNotices() |
| | | // å
è·åå
¬åç±»åå表ï¼ç¶åæ ¹æ®ç±»åè·åéç¥æ°æ® |
| | | fetchNoticeTypeList(); |
| | | }); |
| | | </script> |
| | | |
| | |
| | | box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); |
| | | } |
| | | |
| | | .holiday-card { |
| | | border-left-color: #67c23a; |
| | | .notice-icon { |
| | | color: #409eff; |
| | | margin-right: 8px; |
| | | font-size: 18px; |
| | | } |
| | | |
| | | .maintenance-card { |
| | | border-left-color: #e6a23c; |
| | | .tab-count { |
| | | color: #909399; |
| | | font-size: 12px; |
| | | margin-left: 4px; |
| | | } |
| | | |
| | | .urgent { |
| | |
| | | flex: 1; |
| | | } |
| | | |
| | | .holiday-icon { |
| | | color: #67c23a; |
| | | margin-right: 8px; |
| | | font-size: 18px; |
| | | } |
| | | |
| | | .maintenance-icon { |
| | | color: #e6a23c; |
| | | margin-right: 8px; |
| | | font-size: 18px; |
| | | } |
| | | |
| | | .card-actions { |
| | | display: flex; |
| | |
| | | color: #606266; |
| | | line-height: 1.6; |
| | | font-size: 14px; |
| | | word-break: break-all; |
| | | white-space: pre-wrap; |
| | | overflow-wrap: break-word; |
| | | } |
| | | |
| | | .card-footer { |
| | |
| | | text-align: right; |
| | | } |
| | | |
| | | .notice-type-container { |
| | | padding: 10px 0; |
| | | } |
| | | |
| | | .notice-type-header { |
| | | margin-bottom: 15px; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | /* ååºå¼è®¾è®¡ */ |
| | | @media (max-width: 768px) { |
| | | .notice-cards { |
| | |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { staffOnJobListPage } from "@/api/personnelManagement/employeeRecord.js"; |
| | | import { staffOnJobListPage } from "@/api/personnelManagement/staffOnJob.js"; |
| | | import { listNotification, addNotification, updateNotification, delNotification,addOnlineMeeting,addFileSharing } from "@/api/collaborativeApproval/notificationManagement.js"; |
| | | import { id } from "element-plus/es/locales.mjs"; |
| | | |
| | |
| | | clickFun: (row) => { |
| | | publishNotification(row); |
| | | }, |
| | | // disabled: (row) => row.status === "published" |
| | | }, |
| | | { |
| | | name: "æ¤å", |
| | |
| | | clickFun: (row) => { |
| | | revokeNotification(row); |
| | | }, |
| | | // disabled: (row) => row.status !== "published" |
| | | } |
| | | ] |
| | | } |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-header"> |
| | | <h2>ä¼è®®ç³è¯·</h2> |
| | | </div> |
| | | <div> |
| | | |
| | | <!-- ç³è¯·ç±»åéæ© --> |
| | | <el-card class="type-card"> |
| | |
| | | <el-option |
| | | v-for="person in employees" |
| | | :key="person.id" |
| | | :label="`${person.staffName} (${person.postJob})`" |
| | | :label="`${person.staffName} (${person.postName})`" |
| | | :value="person.id" |
| | | /> |
| | | </el-select> |
| | |
| | | import {ElMessage} from 'element-plus' |
| | | import {Plus, Document, Promotion, Bell} from '@element-plus/icons-vue' |
| | | import {getRoomEnum, saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js' |
| | | import {getStaffOnJob} from "@/api/personnelManagement/onboarding.js"; |
| | | import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"; |
| | | |
| | | // å½åç³è¯·ç±»å |
| | | const currentType = ref('department') // approval: å®¡æ¹æµç¨, department: é¨é¨çº§, notification: éç¥åå¸ |
| | |
| | | getRoomEnum().then(res => { |
| | | meetingRooms.value = res.data |
| | | }) |
| | | getStaffOnJob().then(res => { |
| | | employees.value = res.data.sort((a, b) => a.postJob.localeCompare(b.postJob)) |
| | | staffOnJobListPage({ |
| | | current: -1, |
| | | size: -1, |
| | | staffState: 1 |
| | | }).then(res => { |
| | | employees.value = res.data.records.sort((a, b) => a.postName.localeCompare(b.postName)) |
| | | }) |
| | | }) |
| | | </script> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-header"> |
| | | <h2>ä¼è®®è稿</h2> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-header"> |
| | | <h2>ä¼è®®å®¡æ¹</h2> |
| | | </div> |
| | | <div> |
| | | |
| | | <!-- æç´¢åºå --> |
| | | <el-card class="search-card"> |
| | | <el-form :model="searchForm" inline> |
| | | <el-form :model="searchForm" inline> |
| | | <el-form-item label="ä¼è®®ä¸»é¢"> |
| | | <el-input v-model="searchForm.title" placeholder="请è¾å
¥ä¼è®®ä¸»é¢" clearable/> |
| | | </el-form-item> |
| | |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- ä¼è®®å®¡æ¹å表 --> |
| | | <el-card> |
| | | <el-table v-loading="loading" :data="approvalList" border> |
| | | <el-table v-loading="loading" :data="approvalList" border :height="tableHeight"> |
| | | <el-table-column prop="title" label="ä¼è®®ä¸»é¢" align="center" min-width="200" show-overflow-tooltip/> |
| | | <el-table-column prop="applicant" label="ç³è¯·äºº" align="center" width="120"/> |
| | | <el-table-column prop="host" label="主ç人" align="center" width="120"/> |
| | |
| | | import {ElMessage, ElMessageBox} from 'element-plus' |
| | | import Pagination from '@/components/Pagination/index.vue' |
| | | import {getRoomEnum, getExamineList,saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js' |
| | | import {getStaffOnJob} from "@/api/personnelManagement/onboarding.js"; |
| | | import dayjs from "dayjs"; |
| | | import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"; |
| | | |
| | | // æ°æ®å表å è½½ç¶æ |
| | | const loading = ref(false) |
| | | |
| | | // æ»æ¡æ° |
| | | const total = ref(0) |
| | | |
| | | // è¡¨æ ¼é«åº¦ï¼æ ¹æ®çªå£é«åº¦èªéåºï¼ |
| | | const tableHeight = ref(window.innerHeight - 380) |
| | | const roomEnum = ref([]) |
| | | const staffList = ref([]) |
| | | // 审æ¹åè¡¨æ°æ® |
| | |
| | | it.participants = staffList.value.filter(staff => staffs.some(id=>id === staff.id)).map(staff => { |
| | | return { |
| | | id: staff.id, |
| | | name: `${staff.staffName}(${staff.postJob})` |
| | | name: `${staff.staffName}(${staff.postName})` |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | // 页é¢å è½½æ¶è·åæ°æ® |
| | | onMounted(async () => { |
| | | const [resp1, resp2]= await Promise.all([getRoomEnum(), getStaffOnJob()]) |
| | | const [resp1, resp2]= await Promise.all([getRoomEnum(), staffOnJobListPage({current: -1, size: -1, staffState: 1})]) |
| | | roomEnum.value = resp1.data |
| | | staffList.value = resp2.data |
| | | staffList.value = resp2.data.records |
| | | |
| | | await getList() |
| | | }) |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-header"> |
| | | <h2>ä¼è®®å®¤ä½¿ç¨æ¥è¯¢</h2> |
| | | </div> |
| | | |
| | | <!-- æ¥è¯¢æ¡ä»¶ --> |
| | | <el-card class="search-card"> |
| | | <el-form :model="queryForm" label-width="80px" inline> |
| | | <div> |
| | | <el-form :model="queryForm" label-width="80px" inline> |
| | | <el-form-item label="æ¥è¯¢æ¥æ"> |
| | | <el-date-picker |
| | | v-model="queryForm.meetingDate" |
| | |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- ä¼è®®å®¤ä½¿ç¨æ
åµ --> |
| | | <el-card class="table-container" :loading="loading"> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-header"> |
| | | <h2>ä¼è®®åå¸</h2> |
| | | </div> |
| | | <div> |
| | | |
| | | <!-- æç´¢åºå --> |
| | | <el-card class="search-card"> |
| | | <el-form :model="searchForm" inline> |
| | | <el-form :model="searchForm" inline> |
| | | <el-form-item label="ä¼è®®ä¸»é¢"> |
| | | <el-input v-model="searchForm.title" placeholder="请è¾å
¥ä¼è®®ä¸»é¢" clearable/> |
| | | </el-form-item> |
| | |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- ä¼è®®åå¸å表 --> |
| | | <el-card> |
| | | <el-table v-loading="loading" :data="approvalList" border> |
| | | <el-table v-loading="loading" :data="approvalList" border :height="tableHeight"> |
| | | <el-table-column prop="title" label="ä¼è®®ä¸»é¢" align="center" min-width="200" show-overflow-tooltip/> |
| | | <el-table-column prop="applicant" label="ç³è¯·äºº" align="center" width="120"/> |
| | | <el-table-column prop="host" label="主ç人" align="center" width="120"/> |
| | |
| | | import {ElMessage, ElMessageBox} from 'element-plus' |
| | | import Pagination from '@/components/Pagination/index.vue' |
| | | import {getRoomEnum, getMeetingPublish,saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js' |
| | | import {getStaffOnJob} from "@/api/personnelManagement/onboarding.js"; |
| | | import dayjs from "dayjs"; |
| | | import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"; |
| | | |
| | | // æ°æ®å表å è½½ç¶æ |
| | | const loading = ref(false) |
| | | |
| | | // æ»æ¡æ° |
| | | const total = ref(0) |
| | | |
| | | // è¡¨æ ¼é«åº¦ï¼æ ¹æ®çªå£é«åº¦èªéåºï¼ |
| | | const tableHeight = ref(window.innerHeight - 380) |
| | | const roomEnum = ref([]) |
| | | const staffList = ref([]) |
| | | // åå¸åè¡¨æ°æ® |
| | |
| | | it.participants = staffList.value.filter(staff => staffs.some(id=>id === staff.id)).map(staff => { |
| | | return { |
| | | id: staff.id, |
| | | name: `${staff.staffName}(${staff.postJob})` |
| | | name: `${staff.staffName}(${staff.postName})` |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | // 页é¢å è½½æ¶è·åæ°æ® |
| | | onMounted(async () => { |
| | | const [resp1, resp2]= await Promise.all([getRoomEnum(), getStaffOnJob()]) |
| | | const [resp1, resp2]= await Promise.all([getRoomEnum(), staffOnJobListPage({current: -1, size: -1, staffState: 1})]) |
| | | roomEnum.value = resp1.data |
| | | staffList.value = resp2.data |
| | | staffList.value = resp2.data.records |
| | | |
| | | await getList() |
| | | }) |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-header"> |
| | | <h2>ä¼è®®å®¤è®¾ç½®</h2> |
| | | <div> |
| | | <el-button @click="handleExport" style="margin-right: 10px">导åº</el-button> |
| | | <el-button type="primary" @click="handleAdd"> |
| | | <el-icon><Plus /></el-icon> |
| | | æ°å¢ä¼è®®å®¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div> |
| | | <!-- æç´¢åºå --> |
| | | <el-card class="search-card"> |
| | | <el-form :model="searchForm" label-width="100px" inline> |
| | | <el-form-item label="ä¼è®®å®¤åç§°"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥ä¼è®®å®¤åç§°" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="ä½ç½®"> |
| | | <el-input v-model="searchForm.location" placeholder="请è¾å
¥ä½ç½®" clearable /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | <el-form :model="searchForm" label-width="100px" class="search-form"> |
| | | <el-form-item label="ä¼è®®å®¤åç§°"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥ä¼è®®å®¤åç§°" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="ä½ç½®"> |
| | | <el-input v-model="searchForm.location" placeholder="请è¾å
¥ä½ç½®" clearable /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item class="search-actions"> |
| | | <el-button @click="handleExport">导åº</el-button> |
| | | <el-button type="primary" @click="handleAdd"> |
| | | <el-icon><Plus /></el-icon> |
| | | æ°å¢ä¼è®®å®¤ |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- ä¼è®®å®¤å表 --> |
| | | <el-card> |
| | | <el-table v-loading="loading" :data="meetingRoomList" border> |
| | | <el-table v-loading="loading" :data="meetingRoomList" border :height="tableHeight"> |
| | | <el-table-column prop="name" label="ä¼è®®å®¤åç§°" align="center" /> |
| | | <el-table-column prop="location" label="ä½ç½®" align="center" /> |
| | | <el-table-column prop="capacity" label="容纳人æ°" align="center" /> |
| | |
| | | |
| | | // æ»æ¡æ° |
| | | const total = ref(0) |
| | | |
| | | // è¡¨æ ¼é«åº¦ï¼æ ¹æ®çªå£é«åº¦èªéåºï¼ |
| | | const tableHeight = ref(window.innerHeight - 380) |
| | | |
| | | // ä¼è®®å®¤åè¡¨æ°æ® |
| | | const meetingRoomList = ref([]) |
| | |
| | | padding: 20px; |
| | | } |
| | | |
| | | .search-form { |
| | | display: flex; |
| | | /* align-items: center; */ |
| | | } |
| | | |
| | | .search-actions { |
| | | margin-left: auto; |
| | | } |
| | | |
| | | .page-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-header"> |
| | | <h2>ä¼è®®çºªè¦</h2> |
| | | </div> |
| | | <div> |
| | | |
| | | <!-- æç´¢åºå --> |
| | | <el-card class="search-card"> |
| | | <el-form :model="searchForm" inline> |
| | | <el-form :model="searchForm" inline> |
| | | <el-form-item label="ä¼è®®ä¸»é¢"> |
| | | <el-input v-model="searchForm.title" placeholder="请è¾å
¥ä¼è®®ä¸»é¢" clearable /> |
| | | </el-form-item> |
| | |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- ä¼è®®å表 --> |
| | | <el-card> |
| | | <el-table v-loading="loading" :data="meetingList" border> |
| | | <el-table v-loading="loading" :data="meetingList" border :height="tableHeight"> |
| | | <el-table-column prop="title" label="ä¼è®®ä¸»é¢" align="center" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="applicant" label="ç³è¯·äºº" align="center" width="120" /> |
| | | <el-table-column prop="host" label="主æäºº" align="center" width="120" /> |
| | |
| | | import Pagination from '@/components/Pagination/index.vue' |
| | | import Editor from '@/components/Editor/index.vue' |
| | | import { getRoomEnum, getMeetingPublish ,getMeetingMinutesByMeetingId,saveMeetingMinutes} from '@/api/collaborativeApproval/meeting.js' |
| | | import { getStaffOnJob } from "@/api/personnelManagement/onboarding.js" |
| | | import dayjs from "dayjs" |
| | | import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"; |
| | | |
| | | // æ°æ®å表å è½½ç¶æ |
| | | const loading = ref(false) |
| | | |
| | | // æ»æ¡æ° |
| | | const total = ref(0) |
| | | |
| | | // è¡¨æ ¼é«åº¦ï¼æ ¹æ®çªå£é«åº¦èªéåºï¼ |
| | | const tableHeight = ref(window.innerHeight - 380) |
| | | const roomEnum = ref([]) |
| | | const staffList = ref([]) |
| | | |
| | |
| | | it.participants = staffList.value.filter(staff => staffs.some(id => id === staff.id)).map(staff => { |
| | | return { |
| | | id: staff.id, |
| | | name: `${staff.staffName}(${staff.postJob})` |
| | | name: `${staff.staffName}(${staff.postName})` |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | // 页é¢å è½½æ¶è·åæ°æ® |
| | | onMounted(async () => { |
| | | const [resp1, resp2] = await Promise.all([getRoomEnum(), getStaffOnJob()]) |
| | | const [resp1, resp2] = await Promise.all([getRoomEnum(), staffOnJobListPage({current: -1, size: -1, staffState: 1})]) |
| | | roomEnum.value = resp1.data |
| | | staffList.value = resp2.data |
| | | staffList.value = resp2.data.records |
| | | |
| | | await getList() |
| | | }) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="ä¾åºååç§°ï¼"> |
| | | <el-input v-model="searchForm.supplierName" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="éè´ååå·ï¼"> |
| | | <el-input |
| | | v-model="searchForm.purchaseContractNumber" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="éå®ååå·ï¼"> |
| | | <el-input v-model="searchForm.salesContractNo" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="项ç®åç§°ï¼"> |
| | | <el-input v-model="searchForm.projectName" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> æç´¢ </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="display: flex;justify-content: flex-end;margin-bottom: 20px;"> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | @expand-change="expandChange" |
| | | height="calc(100vh - 18.5em)" |
| | | :row-class-name="tableRowClassName" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column type="expand"> |
| | | <template #default="props"> |
| | | <el-table |
| | | :data="props.row.children" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" /> |
| | | <el-table-column label="åä½" prop="unit" /> |
| | | <el-table-column label="æ°é" prop="quantity" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column |
| | | label="éè´ååå·" |
| | | prop="purchaseContractNumber" |
| | | width="200" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | width="200" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ä¾åºååç§°" |
| | | width="240" |
| | | prop="supplierName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column label="订åç¶æ" width="100" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag v-if="scope.row.isInvalid" type="danger" size="small">失æ</el-tag> |
| | | <el-tag v-else type="success" size="small">æ£å¸¸</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="项ç®åç§°" |
| | | prop="projectName" |
| | | width="420" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="审æ¹ç¶æ" |
| | | prop="approvalStatus" |
| | | width="200" |
| | | show-overflow-tooltip |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag |
| | | size="small" |
| | | > |
| | | {{ approvalStatusText[scope.row.approvalStatus] || 'æªç¥ç¶æ' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="仿¬¾æ¹å¼" |
| | | width="100" |
| | | prop="paymentMethod" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ååéé¢(å
)" |
| | | prop="contractAmount" |
| | | width="200" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å½å
¥äºº" |
| | | prop="recorderName" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å½å
¥æ¥æ" |
| | | prop="entryDate" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="æä½" |
| | | min-width="150" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="approvePurchase(scope.row)" |
| | | :disabled="scope.row.approvalStatus !== 0" |
| | | >审æ¹</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="rejectPurchase(scope.row)" |
| | | :disabled="scope.row.approvalStatus !== 0" |
| | | >æç»å®¡æ¹</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getToken } from "@/utils/auth"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref, onMounted, reactive, toRefs, getCurrentInstance, nextTick } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { |
| | | getSalesLedgerWithProducts, |
| | | addOrUpdateSalesLedgerProduct, |
| | | delProduct, |
| | | delLedgerFile, |
| | | getProductInfoByContractNo, |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { |
| | | addOrEditPurchase, |
| | | delPurchase, |
| | | getSalesNo, |
| | | purchaseListPage, |
| | | productList, |
| | | getPurchaseById, |
| | | getOptions, |
| | | createPurchaseNo, updateApprovalStatus, |
| | | } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import useFormData from "@/hooks/useFormData.js"; |
| | | import QRCode from "qrcode"; |
| | | |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const productSelectedRows = ref([]); |
| | | const modelOptions = ref([]); |
| | | const userList = ref([]); |
| | | const productOptions = ref([]); |
| | | const salesContractList = ref([]); |
| | | const supplierList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import dayjs from "dayjs"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | |
| | | const userStore = useUserStore(); |
| | | |
| | | // äºç»´ç ç¸å
³åé |
| | | const qrCodeDialogVisible = ref(false); |
| | | const qrCodeUrl = ref(""); |
| | | |
| | | // 订å审æ¹ç¶ææ¾ç¤ºææ¬ |
| | | const approvalStatusText = { |
| | | 0: 'å¾
审æ¹', |
| | | 1: '审æ¹éè¿', |
| | | 2: '审æ¹å¤±è´¥' |
| | | }; |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: "", // ä¾åºååç§° |
| | | purchaseContractNumber: "", // éè´ååç¼å· |
| | | salesContractNo: "", // éå®ååç¼å· |
| | | projectName: "", // 项ç®åç§° |
| | | entryDate: null, // å½å
¥æ¥æ |
| | | entryDateStart: undefined, |
| | | entryDateEnd: undefined, |
| | | }, |
| | | form: { |
| | | purchaseContractNumber: "", |
| | | salesLedgerId: "", |
| | | projectName: "", |
| | | recorderId: "", |
| | | entryDate: "", |
| | | productData: [], |
| | | supplierName: "", |
| | | supplierId: "", |
| | | paymentMethod: "", |
| | | executionDate: "", |
| | | approvalStatus: "0", |
| | | }, |
| | | rules: { |
| | | purchaseContractNumber: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | projectName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | supplierId: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | entryDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | executionDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const { form: searchForm } = useFormData(data.searchForm); |
| | | |
| | | // 产å表åå¼¹æ¡æ°æ® |
| | | const productFormVisible = ref(false); |
| | | const productOperationType = ref(""); |
| | | const productOperationIndex = ref(""); |
| | | const currentId = ref(""); |
| | | const productFormData = reactive({ |
| | | productForm: { |
| | | productId: "", |
| | | productCategory: "", |
| | | productModelId: "", |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: "", |
| | | taxInclusiveUnitPrice: "", |
| | | taxRate: "", |
| | | taxInclusiveTotalPrice: "", |
| | | taxExclusiveTotalPrice: "", |
| | | invoiceType: "", |
| | | warnNum: "", |
| | | }, |
| | | productRules: { |
| | | productId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | productModelId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | unit: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxInclusiveUnitPrice: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | taxRate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | warnNum: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | taxInclusiveTotalPrice: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | taxExclusiveTotalPrice: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | invoiceType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { productForm, productRules } = toRefs(productFormData); |
| | | const upload = reactive({ |
| | | // ä¸ä¼ çå°å |
| | | url: import.meta.env.VITE_APP_BASE_API + "/file/upload", |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | }); |
| | | |
| | | const changeDaterange = (value) => { |
| | | if (value) { |
| | | searchForm.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD"); |
| | | searchForm.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD"); |
| | | } else { |
| | | searchForm.entryDateStart = undefined; |
| | | searchForm.entryDateEnd = undefined; |
| | | } |
| | | handleQuery(); |
| | | }; |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "ticketsNum", |
| | | "ticketsAmount", |
| | | "futureTickets", |
| | | "futureTicketsAmount", |
| | | ], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | } |
| | | ); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const { entryDate, ...rest } = searchForm; |
| | | purchaseListPage({ ...rest, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | // tableData.value = res.data.records; |
| | | // å¤çæ°æ®ï¼æ·»å 失æç¶ææ è®° |
| | | tableData.value = res.data.records.map(record => ({ |
| | | ...record, |
| | | isInvalid: record.isWhite === 1 |
| | | })); |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.data.total; |
| | | expandedRowKeys.value = []; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | const productSelected = (selectedRows) => { |
| | | productSelectedRows.value = selectedRows; |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | productList({ salesLedgerId: row.id, type: 2 }).then((res) => { |
| | | const index = tableData.value.findIndex((item) => item.id === row.id); |
| | | if (index > -1) { |
| | | tableData.value[index].children = res.data; |
| | | } |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = []; |
| | | } |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ["contractAmount"]); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeProTable = (param) => { |
| | | return proxy.summarizeTable(param, [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | productData.value = []; |
| | | fileList.value = []; |
| | | if (operationType.value == "add") { |
| | | createPurchaseNo().then((res) => { |
| | | form.value.purchaseContractNumber = res.data; |
| | | }); |
| | | } |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | getSalesNo().then((res) => { |
| | | salesContractList.value = res; |
| | | }); |
| | | getOptions().then((res) => { |
| | | // ä¾åºåè¿æ»¤åºisWhite=0 çæ°æ® |
| | | supplierList.value = res.data.filter((item) => item.isWhite == 0); |
| | | }); |
| | | form.value.recorderId = userStore.id; |
| | | form.value.entryDate = getCurrentDate(); |
| | | if (type === "edit") { |
| | | currentId.value = row.id; |
| | | getPurchaseById({ id: row.id, type: 2 }).then((res) => { |
| | | form.value = { ...res }; |
| | | productData.value = form.value.productData; |
| | | if (form.value.salesLedgerFiles) { |
| | | fileList.value = form.value.salesLedgerFiles; |
| | | } else { |
| | | fileList.value = []; |
| | | } |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // ä¸ä¼ åæ ¡æ£ |
| | | function handleBeforeUpload(file) { |
| | | // æ ¡æ£æä»¶å¤§å° |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿10MB!"); |
| | | return false; |
| | | } |
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ æä»¶ï¼è¯·ç¨å..."); |
| | | return true; |
| | | } |
| | | // ä¸ä¼ 失败 |
| | | function handleUploadError(err) { |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤±è´¥"); |
| | | proxy.$modal.closeLoading(); |
| | | } |
| | | // ä¸ä¼ æååè° |
| | | function handleUploadSuccess(res, file, uploadFiles) { |
| | | proxy.$modal.closeLoading(); |
| | | if (res.code === 200) { |
| | | file.tempId = res.data.tempId; |
| | | proxy.$modal.msgSuccess("ä¸ä¼ æå"); |
| | | } else { |
| | | proxy.$modal.msgError(res.msg); |
| | | proxy.$refs.fileUpload.handleRemove(file); |
| | | } |
| | | } |
| | | // ç§»é¤æä»¶ |
| | | function handleRemove(file) { |
| | | console.log("handleRemove", file.id); |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | // ä»
å端æ¸
çï¼ä¸è°ç¨å 餿¥å£åæç¤º |
| | | return; |
| | | } |
| | | if (operationType.value === "edit") { |
| | | let ids = []; |
| | | ids.push(file.id); |
| | | delLedgerFile(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }); |
| | | } |
| | | } |
| | | // æäº¤è¡¨å |
| | | const submitForm = (n) => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (productData.value.length > 0) { |
| | | form.value.productData = proxy.HaveJson(productData.value); |
| | | } else { |
| | | proxy.$modal.msgWarning("请添å 产åä¿¡æ¯"); |
| | | return; |
| | | } |
| | | let tempFileIds = []; |
| | | if (fileList.value.length > 0) { |
| | | tempFileIds = fileList.value.map((item) => item.tempId); |
| | | } |
| | | form.value.tempFileIds = tempFileIds; |
| | | form.value.type = 2; |
| | | form.value.approvalStatus = n; |
| | | addOrEditPurchase(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // æå¼äº§åå¼¹æ¡ |
| | | const openProductForm = (type, row, index) => { |
| | | productOperationType.value = type; |
| | | productOperationIndex.value = index; |
| | | productForm.value = {}; |
| | | proxy.resetForm("productFormRef"); |
| | | if (type === "edit") { |
| | | productForm.value = { ...row }; |
| | | } |
| | | productFormVisible.value = true; |
| | | getProductOptions(); |
| | | }; |
| | | const getProductOptions = () => { |
| | | productTreeList().then((res) => { |
| | | productOptions.value = convertIdToValue(res); |
| | | }); |
| | | }; |
| | | const getModels = (value) => { |
| | | if (value) { |
| | | productForm.value.productCategory = findNodeById(productOptions.value, value) || ""; |
| | | modelList({ id: value }).then((res) => { |
| | | modelOptions.value = res; |
| | | }); |
| | | } else { |
| | | productForm.value.productCategory = ""; |
| | | modelOptions.value = []; |
| | | } |
| | | }; |
| | | const getProductModel = (value) => { |
| | | const index = modelOptions.value.findIndex((item) => item.id === value); |
| | | if (index !== -1) { |
| | | productForm.value.specificationModel = modelOptions.value[index].model; |
| | | productForm.value.unit = modelOptions.value[index].unit; |
| | | } else { |
| | | productForm.value.specificationModel = null; |
| | | productForm.value.unit = null; |
| | | } |
| | | }; |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; // æ¾å°èç¹ï¼è¿å该èç¹çlabel |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode; // å¨åèç¹ä¸æ¾å°ï¼ç´æ¥è¿åï¼å·²ç»æ¯labelåç¬¦ä¸²ï¼ |
| | | } |
| | | } |
| | | } |
| | | return null; // æ²¡ææ¾å°èç¹ï¼è¿ånull |
| | | }; |
| | | function convertIdToValue(data) { |
| | | return data.map((item) => { |
| | | const { id, children, ...rest } = item; |
| | | const newItem = { |
| | | ...rest, |
| | | value: id, // å° id æ¹ä¸º value |
| | | }; |
| | | if (children && children.length > 0) { |
| | | newItem.children = convertIdToValue(children); |
| | | } |
| | | |
| | | return newItem; |
| | | }); |
| | | } |
| | | // æäº¤äº§å表å |
| | | const submitProduct = () => { |
| | | proxy.$refs["productFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitProductEdit(); |
| | | } else { |
| | | if (productOperationType.value === "add") { |
| | | productData.value.push({ ...productForm.value }); |
| | | console.log("productData.value---", productData.value); |
| | | } else { |
| | | productData.value[productOperationIndex.value] = { |
| | | ...productForm.value, |
| | | }; |
| | | } |
| | | closeProductDia(); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | const submitProductEdit = () => { |
| | | productForm.value.salesLedgerId = currentId.value; |
| | | productForm.value.type = 2; |
| | | addOrUpdateSalesLedgerProduct(productForm.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeProductDia(); |
| | | getPurchaseById({ id: currentId.value, type: 2 }).then((res) => { |
| | | productData.value = res.productData; |
| | | }); |
| | | }); |
| | | }; |
| | | // å é¤äº§å |
| | | const deleteProduct = () => { |
| | | if (productSelectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | if (operationType.value === "add") { |
| | | productSelectedRows.value.forEach((selectedRow) => { |
| | | const index = productData.value.findIndex( |
| | | (product) => product.id === selectedRow.id |
| | | ); |
| | | if (index !== -1) { |
| | | productData.value.splice(index, 1); |
| | | } |
| | | }); |
| | | } else { |
| | | let ids = []; |
| | | if (productSelectedRows.value.length > 0) { |
| | | ids = productSelectedRows.value.map((item) => item.id); |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delProduct(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | closeProductDia(); |
| | | getSalesLedgerWithProducts({ id: currentId.value, type: 2 }).then( |
| | | (res) => { |
| | | productData.value = res.productData; |
| | | } |
| | | ); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | } |
| | | }; |
| | | // å
³é产åå¼¹æ¡ |
| | | const closeProductDia = () => { |
| | | proxy.resetForm("productFormRef"); |
| | | productFormVisible.value = false; |
| | | }; |
| | | // 审æ¹éè¿æ¹æ³ |
| | | const approvePurchase = (row) => { |
| | | ElMessageBox.confirm(`确认éè¿éè´ååå·ä¸º ${row.purchaseContractNumber} ç审æ¹ï¼`, '审æ¹ç¡®è®¤', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | updateApprovalStatus({ id: row.id, approvalStatus: 1}).then((res)=>{ |
| | | proxy.$modal.msgSuccess('å®¡æ¹æå'); |
| | | getList(); |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg('已忶审æ¹'); |
| | | }); |
| | | }; |
| | | |
| | | // å®¡æ¹æç»æ¹æ³ |
| | | const rejectPurchase = (row) => { |
| | | ElMessageBox.confirm(`确认æç»éè´ååå·ä¸º ${row.purchaseContractNumber} ç审æ¹ï¼`, '审æ¹ç¡®è®¤', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | updateApprovalStatus({ id: row.id, approvalStatus: 2}).then((res)=>{ |
| | | proxy.$modal.msgSuccess('å®¡æ¹æå'); |
| | | getList(); |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg('已忶审æ¹'); |
| | | }); |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/purchase/ledger/export", {}, "éè´å°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter(item => item.recorderName !== userStore.nickName); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delPurchase(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | const mathNum = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请å
éæ©ç¨ç"); |
| | | return; |
| | | } |
| | | if (!productForm.value.taxInclusiveUnitPrice) { |
| | | return; |
| | | } |
| | | if (!productForm.value.quantity) { |
| | | return; |
| | | } |
| | | // å«ç¨æ»ä»·è®¡ç® |
| | | productForm.value.taxInclusiveTotalPrice = |
| | | proxy.calculateTaxIncludeTotalPrice( |
| | | productForm.value.taxInclusiveUnitPrice, |
| | | productForm.value.quantity |
| | | ); |
| | | if (productForm.value.taxRate) { |
| | | // ä¸å«ç¨æ»ä»·è®¡ç® |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | productForm.value.taxInclusiveTotalPrice, |
| | | productForm.value.taxRate |
| | | ); |
| | | } |
| | | }; |
| | | const reverseMathNum = (field) => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请å
éæ©ç¨ç"); |
| | | return; |
| | | } |
| | | const taxRate = Number(productForm.value.taxRate); |
| | | if (!taxRate) return; |
| | | if (field === 'taxInclusiveTotalPrice') { |
| | | // å·²ç¥å«ç¨æ»ä»·åæ°éï¼åç®å«ç¨åä»· |
| | | if (productForm.value.quantity) { |
| | | productForm.value.taxInclusiveUnitPrice = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2); |
| | | } |
| | | // å·²ç¥å«ç¨æ»ä»·åå«ç¨åä»·ï¼åç®æ°é |
| | | else if (productForm.value.taxInclusiveUnitPrice) { |
| | | productForm.value.quantity = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2); |
| | | } |
| | | // åç®ä¸å«ç¨æ»ä»· |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)).toFixed(2); |
| | | } else if (field === 'taxExclusiveTotalPrice') { |
| | | // åç®å«ç¨æ»ä»· |
| | | productForm.value.taxInclusiveTotalPrice = |
| | | (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2); |
| | | // å·²ç¥æ°éï¼åç®å«ç¨åä»· |
| | | if (productForm.value.quantity) { |
| | | productForm.value.taxInclusiveUnitPrice = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2); |
| | | } |
| | | // å·²ç¥å«ç¨åä»·ï¼åç®æ°é |
| | | else if (productForm.value.taxInclusiveUnitPrice) { |
| | | productForm.value.quantity = |
| | | (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2); |
| | | } |
| | | } |
| | | }; |
| | | // éå®ååéæ©æ¹åæ¹æ³ |
| | | const salesLedgerChange = async (row) => { |
| | | console.log("row", row); |
| | | var index = salesContractList.value.findIndex((item) => item.id == row); |
| | | console.log("index", index); |
| | | if (index > -1) { |
| | | form.value.projectName = salesContractList.value[index].projectName; |
| | | await querygProductInfoByContractNo(); |
| | | } |
| | | }; |
| | | |
| | | const querygProductInfoByContractNo = async () => { |
| | | const { code, data } = await getProductInfoByContractNo({ |
| | | contractNo: form.value.salesLedgerId, |
| | | }); |
| | | if (code == 200) { |
| | | productData.value = data; |
| | | } |
| | | }; |
| | | |
| | | // æ¾ç¤ºäºç»´ç |
| | | const showQRCode = async (row) => { |
| | | try { |
| | | // æå»ºäºç»´ç å
容ï¼åªå
å«éè´ååå·ï¼çº¯ææ¬ï¼ |
| | | const qrContent = row.purchaseContractNumber || ''; |
| | | // æ£æ¥å
容æ¯å¦ä¸ºç©º |
| | | if (!qrContent || qrContent.trim() === '') { |
| | | proxy.$modal.msgWarning("è¯¥è¡æ²¡æéè´ååå·ï¼æ æ³çæäºç»´ç "); |
| | | return; |
| | | } |
| | | qrCodeUrl.value = await QRCode.toDataURL(qrContent, { |
| | | width: 200, |
| | | margin: 2, |
| | | color: { |
| | | dark: '#000000', |
| | | light: '#FFFFFF' |
| | | } |
| | | }); |
| | | qrCodeDialogVisible.value = true; |
| | | } catch (error) { |
| | | console.error('çæäºç»´ç 失败:', error); |
| | | proxy.$modal.msgError("çæäºç»´ç 失败ï¼" + error.message); |
| | | } |
| | | }; |
| | | |
| | | // ä¸è½½äºç»´ç |
| | | const downloadQRCode = () => { |
| | | if (!qrCodeUrl.value) { |
| | | proxy.$modal.msgWarning("äºç»´ç æªçæ"); |
| | | return; |
| | | } |
| | | |
| | | const a = document.createElement('a'); |
| | | a.href = qrCodeUrl.value; |
| | | a.download = `éè´ååå·äºç»´ç _${new Date().getTime()}.png`; |
| | | document.body.appendChild(a); |
| | | a.click(); |
| | | document.body.removeChild(a); |
| | | proxy.$modal.msgSuccess("ä¸è½½æå"); |
| | | }; |
| | | |
| | | // æ«ç æ°å¢å¯¹è¯æ¡ç¸å
³åé |
| | | const scanAddDialogVisible = ref(false); |
| | | const scanAddForm = reactive({ |
| | | scanContent: "", |
| | | purchaseContractNumber: "", |
| | | supplierName: "", |
| | | projectName: "", |
| | | contractAmount: "", |
| | | paymentMethod: "", |
| | | recorderName: "", |
| | | scanRemark: "", |
| | | }); |
| | | const scanAddRules = { |
| | | purchaseContractNumber: [{ required: true, message: "请è¾å
¥éè´ååå·", trigger: "blur" }], |
| | | supplierName: [{ required: true, message: "请è¾å
¥ä¾åºååç§°", trigger: "blur" }], |
| | | projectName: [{ required: true, message: "请è¾å
¥é¡¹ç®åç§°", trigger: "blur" }], |
| | | }; |
| | | |
| | | // æ«ç ç»è®°å¯¹è¯æ¡ç¸å
³åé |
| | | const scanDialogVisible = ref(false); |
| | | const scanForm = reactive({ |
| | | purchaseContractNumber: "", |
| | | supplierName: "", |
| | | projectName: "", |
| | | scanTime: "", |
| | | scannerName: "", |
| | | scanStatus: "æªæ«ç ", |
| | | scanRemark: "", |
| | | }); |
| | | const scanRules = { |
| | | scanRemark: [{ required: true, message: "请è¾å
¥æ«ç 夿³¨", trigger: "blur" }], |
| | | }; |
| | | const scanRecords = ref([]); |
| | | |
| | | // æå¼æ«ç æ°å¢å¯¹è¯æ¡ |
| | | const openScanAddDialog = () => { |
| | | scanAddForm.scanContent = ""; |
| | | scanAddForm.purchaseContractNumber = ""; |
| | | scanAddForm.supplierName = ""; |
| | | scanAddForm.projectName = ""; |
| | | scanAddForm.contractAmount = ""; |
| | | scanAddForm.paymentMethod = ""; |
| | | scanAddForm.recorderName = userStore.nickName; |
| | | scanAddForm.scanRemark = ""; |
| | | scanAddDialogVisible.value = true; |
| | | }; |
| | | |
| | | // è§£ææ«ç å
å®¹ï¼æ¨¡æè§£æäºç»´ç æ°æ®ï¼ |
| | | const parseScanContent = (content) => { |
| | | if (!content) return; |
| | | |
| | | // 模æè§£æäºç»´ç å
容ï¼è¿éå¯ä»¥æ ¹æ®å®é
éæ±è°æ´è§£æé»è¾ |
| | | // å设æ«ç å
å®¹æ ¼å¼ä¸ºï¼ååå·|ä¾åºå|项ç®|éé¢|仿¬¾æ¹å¼ |
| | | const parts = content.split('|'); |
| | | if (parts.length >= 3) { |
| | | scanAddForm.purchaseContractNumber = parts[0] || ""; |
| | | scanAddForm.supplierName = parts[1] || ""; |
| | | scanAddForm.projectName = parts[2] || ""; |
| | | scanAddForm.contractAmount = parts[3] || ""; |
| | | scanAddForm.paymentMethod = parts[4] || ""; |
| | | } |
| | | }; |
| | | |
| | | // å
³éæ«ç æ°å¢å¯¹è¯æ¡ |
| | | const closeScanAddDialog = () => { |
| | | scanAddDialogVisible.value = false; |
| | | proxy.resetForm("scanAddFormRef"); |
| | | }; |
| | | |
| | | // æäº¤æ«ç æ°å¢ |
| | | const submitScanAdd = () => { |
| | | proxy.$refs["scanAddFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | // æå»ºæ°å¢æ°æ® |
| | | const newData = { |
| | | purchaseContractNumber: scanAddForm.purchaseContractNumber, |
| | | supplierName: scanAddForm.supplierName, |
| | | projectName: scanAddForm.projectName, |
| | | contractAmount: scanAddForm.contractAmount, |
| | | paymentMethod: scanAddForm.paymentMethod, |
| | | recorderName: scanAddForm.recorderName, |
| | | entryDate: getCurrentDate(), |
| | | remark: scanAddForm.scanRemark, |
| | | type: 2 |
| | | }; |
| | | |
| | | // æ¨¡ææ°å¢æå |
| | | proxy.$modal.msgSuccess("æ«ç æ°å¢æåï¼"); |
| | | closeScanAddDialog(); |
| | | |
| | | // å¯ä»¥éæ©æ¯å¦å·æ°å表 |
| | | // getList(); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // æå¼æ«ç ç»è®°å¯¹è¯æ¡ |
| | | const openScanDialog = (row) => { |
| | | scanForm.purchaseContractNumber = row.purchaseContractNumber; |
| | | scanForm.supplierName = row.supplierName; |
| | | scanForm.projectName = row.projectName; |
| | | scanForm.scanTime = getCurrentDateTime(); |
| | | scanForm.scannerName = userStore.nickName; |
| | | scanForm.scanStatus = "æªæ«ç "; |
| | | scanForm.scanRemark = ""; |
| | | scanRecords.value = []; |
| | | scanDialogVisible.value = true; |
| | | }; |
| | | |
| | | // å
³éæ«ç ç»è®°å¯¹è¯æ¡ |
| | | const closeScanDialog = () => { |
| | | scanDialogVisible.value = false; |
| | | proxy.resetForm("scanFormRef"); |
| | | }; |
| | | |
| | | // æäº¤æ«ç ç»è®° |
| | | const submitScan = () => { |
| | | proxy.$refs["scanFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | // æ·»å æ«ç è®°å½ |
| | | scanRecords.value.push({ |
| | | ...scanForm, |
| | | id: Date.now(), // 模æID |
| | | scanTime: getCurrentDateTime(), |
| | | }); |
| | | scanForm.scanStatus = "å·²æ«ç "; |
| | | scanForm.scanRemark = scanForm.scanRemark || "æ "; |
| | | proxy.$modal.msgSuccess("æ«ç ç»è®°æåï¼"); |
| | | closeScanDialog(); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // è·åå½åæ¥ææ¶é´ |
| | | function getCurrentDateTime() { |
| | | const now = new Date(); |
| | | const year = now.getFullYear(); |
| | | const month = String(now.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(now.getDate()).padStart(2, "0"); |
| | | const hours = String(now.getHours()).padStart(2, "0"); |
| | | const minutes = String(now.getMinutes()).padStart(2, "0"); |
| | | const seconds = String(now.getSeconds()).padStart(2, "0"); |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | } |
| | | |
| | | // æ·»å è¡ç±»åæ¹æ³ |
| | | const tableRowClassName = ({ row }) => { |
| | | return row.isInvalid ? 'invalid-row' : ''; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .invalid-row { |
| | | opacity: 0.6; |
| | | background-color: #f5f7fa; |
| | | } |
| | | </style> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="readCount" label="已读人æ°" width="100" /> |
| | | <el-table-column label="æä½" width="250" fixed="right"> |
| | | <el-table-column label="æä½" width="320" fixed="right"> |
| | | <template #default="scope"> |
| | | <el-button link @click="viewRegulation(scope.row)">æ¥ç</el-button> |
| | | <el-button link type="primary" @click="handleEdit(scope.row)">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="repealEdit(scope.row)">åºå¼</el-button> |
| | | <el-button link type="success" @click="viewVersionHistory(scope.row)">çæ¬åå²</el-button> |
| | | <el-button link type="warning" @click="viewReadStatus(scope.row)">é
è¯»ç¶æ</el-button> |
| | | <el-button link type="primary" @click="openFileDialog(scope.row)">éä»¶</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | |
| | | <!-- ç¨å°ç³è¯·å¯¹è¯æ¡ --> |
| | | <!-- <el-dialog v-model="showSealApplyDialog" title="ç³è¯·ç¨å°" width="600px"> |
| | | <el-form :model="sealForm" :rules="sealRules" ref="sealFormRef" label-width="100px"> |
| | | <el-form-item label="ç³è¯·ç¼å·" prop="applicationNum"> |
| | | <el-input v-model="sealForm.applicationNum" placeholder="请è¾å
¥ç³è¯·ç¼å·" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç³è¯·æ é¢" prop="title"> |
| | | <el-input v-model="sealForm.title" placeholder="请è¾å
¥ç³è¯·æ é¢" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¨å°ç±»å" prop="sealType"> |
| | | <el-select v-model="sealForm.sealType" placeholder="è¯·éæ©ç¨å°ç±»å" style="width: 100%"> |
| | | <el-option label="å
¬ç« " value="official" /> |
| | | <el-option label="ååä¸ç¨ç« " value="contract" /> |
| | | <el-option label="è´¢å¡ä¸ç¨ç« " value="finance" /> |
| | | <el-option label="æ³äººç« " value="legal" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç³è¯·åå " prop="reason"> |
| | | <el-input v-model="sealForm.reason" type="textarea" :rows="4" placeholder="请详ç»è¯´æç¨å°åå " /> |
| | | </el-form-item> |
| | | <el-form-item label="ç´§æ¥ç¨åº¦" prop="urgency"> |
| | | <el-radio-group v-model="sealForm.urgency"> |
| | | <el-radio label="normal">æ®é</el-radio> |
| | | <el-radio label="urgent">ç´§æ¥</el-radio> |
| | | <el-radio label="very-urgent">ç¹æ¥</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="showSealApplyDialog = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="submitSealApplication">æäº¤ç³è¯·</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> --> |
| | | <!-- ç¨å°ç³è¯·å¯¹è¯æ¡ï¼å·²ç§»é¤ï¼ --> |
| | | |
| | | <!-- è§ç« å¶åº¦åå¸å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="showRegulationDialog" :title="operationType === 'add' ? 'åå¸å¶åº¦' : 'ç¼è¾å¶åº¦'" width="800px"> |
| | |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- ç¨å°è¯¦æ
å¯¹è¯æ¡ --> |
| | | <!-- <el-dialog v-model="showSealDetailDialog" title="ç¨å°ç³è¯·è¯¦æ
" width="700px"> |
| | | <div v-if="currentSealDetail" class="mb10"> |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="ç³è¯·ç¼å·">{{ currentSealDetail.id }}</el-descriptions-item> |
| | | <el-descriptions-item label="ç³è¯·æ é¢">{{ currentSealDetail.title }}</el-descriptions-item> |
| | | <el-descriptions-item label="ç³è¯·äºº">{{ currentSealDetail.createUserName }}</el-descriptions-item> |
| | | <el-descriptions-item label="æå±é¨é¨">{{ currentSealDetail.department }}</el-descriptions-item> |
| | | <el-descriptions-item label="ç¨å°ç±»å">{{ getSealTypeText(currentSealDetail.sealType) }}</el-descriptions-item> |
| | | <el-descriptions-item label="ç³è¯·æ¶é´">{{ currentSealDetail.createTime }}</el-descriptions-item> |
| | | <el-descriptions-item label="ç¶æ"> |
| | | <el-tag :type="getStatusType(currentSealDetail.status)"> |
| | | {{ getStatusText(currentSealDetail.status) }} |
| | | </el-tag> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="ç³è¯·åå " :span="2">{{ currentSealDetail.reason }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | </div> |
| | | </el-dialog> --> |
| | | <!-- ç¨å°è¯¦æ
å¯¹è¯æ¡ï¼å·²ç§»é¤ï¼ --> |
| | | |
| | | <!-- è§ç« å¶åº¦è¯¦æ
å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="showRegulationDetailDialog" title="è§ç« å¶åº¦è¯¦æ
" width="800px"> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | |
| | | <FileListDialog |
| | | ref="fileListDialogRef" |
| | | v-model="fileDialogVisible" |
| | | :show-upload-button="true" |
| | | :show-delete-button="true" |
| | | :delete-method="handleAttachmentDelete" |
| | | :rules-regulations-management-id="currentFileRuleId" |
| | | :name-column-label="'éä»¶åç§°'" |
| | | @upload="handleAttachmentUpload" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, getCurrentInstance } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { Plus } from '@element-plus/icons-vue' |
| | | import { listSealApplication, addSealApplication, updateSealApplication,listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement,getReadingStatusByRuleId,getReadingStatusList,addReadingStatus,updateReadingStatus } from '@/api/collaborativeApproval/sealManagement.js' |
| | | import { el } from 'element-plus/es/locales.mjs' |
| | | import { getUserProfile } from '@/api/system/user.js' |
| | | import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { userLoginFacotryList } from "@/api/system/user.js" |
| | | import { listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement,getReadingStatusByRuleId,addReadingStatus,updateReadingStatus } from '@/api/collaborativeApproval/sealManagement.js' |
| | | import FileListDialog from '@/components/Dialog/FileListDialog.vue' |
| | | import { listRuleFiles, delRuleFile, addRuleFile } from '@/api/collaborativeApproval/rulesRegulationsManagementFile.js' |
| | | |
| | | // ååºå¼æ°æ® |
| | | const currentUser = ref(null) |
| | | const activeTab = ref('seal') |
| | | const operationType = ref('add') |
| | | const tableData = ref([]) |
| | | // ç¨å°ç³è¯·ç¸å
³ |
| | | const userStore = useUserStore() |
| | | const showSealApplyDialog = ref(false) |
| | | const tableLoading = ref(false) |
| | | const showSealDetailDialog = ref(false) |
| | | const currentSealDetail = ref(null) |
| | | const sealFormRef = ref() |
| | | const sealForm = reactive({ |
| | | applicationNum: '', |
| | | title: '', |
| | | sealType: '', |
| | | reason: '', |
| | | urgency: 'normal', |
| | | status: 'pending' |
| | | }) |
| | | |
| | | const sealRules = { |
| | | applicationNum: [{ required: true, message: '请è¾å
¥ç³è¯·ç¼å·', trigger: 'blur' }], |
| | | title: [{ required: true, message: '请è¾å
¥ç³è¯·æ é¢', trigger: 'blur' }], |
| | | sealType: [{ required: true, message: 'è¯·éæ©ç¨å°ç±»å', trigger: 'change' }], |
| | | reason: [{ required: true, message: '请è¾å
¥ç³è¯·åå ', trigger: 'blur' }] |
| | | } |
| | | |
| | | const sealSearchForm = reactive({ |
| | | title: '', |
| | | status: '' |
| | | }) |
| | | // å页忰 |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0 |
| | | }) |
| | | // éä»¶å¼¹çª |
| | | const fileDialogVisible = ref(false) |
| | | const fileListDialogRef = ref(null) |
| | | const currentFileRuleId = ref(null) |
| | | const filePage = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0 |
| | |
| | | category: '' |
| | | }) |
| | | |
| | | // åæ°æ® |
| | | const sealApplications = ref([]) |
| | | |
| | | const regulations = ref([]) |
| | | |
| | | const versionHistory = ref([]) |
| | |
| | | // { employee: 'åé
å©·', department: 'ææ¯é¨', readTime: '2025-01-11 14:20:00', confirmTime: '', status: 'unconfirmed' }, |
| | | // { employee: 'ç建å½', department: 'è´¢å¡é¨', readTime: '2025-01-12 09:15:00', confirmTime: '2025-01-12 09:20:00', status: 'confirmed' } |
| | | |
| | | // ç¨å°ç³è¯·ç¶æ |
| | | const getStatusType = (status) => { |
| | | const statusMap = { |
| | | pending: 'warning', |
| | | approved: 'success', |
| | | rejected: 'danger' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | // å¶åº¦ç¶æ |
| | | const getStatusText = (status) => { |
| | | const statusMap = { |
| | | pending: 'å¾
审æ¹', |
| | | approved: 'å·²éè¿', |
| | | rejected: 'å·²æç»' |
| | | } |
| | | return statusMap[status] || 'æªç¥' |
| | | } |
| | | // ç¨å°ç±»å |
| | | const getSealTypeText = (sealType) => { |
| | | const sealTypeMap = { |
| | | official: 'å
¬ç« ', |
| | | contract: 'ååä¸ç¨ç« ', |
| | | finance: 'è´¢å¡ä¸ç¨ç« ', |
| | | tegal: 'ææ¯ä¸ç¨ç« ' |
| | | } |
| | | return sealTypeMap[sealType] || 'æªç¥' |
| | | } |
| | | // å¶åº¦åç±» |
| | | const getCategoryText = (category) => { |
| | | const categoryMap = { |
| | |
| | | tech: 'ææ¯å¶åº¦' |
| | | } |
| | | return categoryMap[category] || 'æªç¥' |
| | | } |
| | | // æç´¢å°ç« ç³è¯· |
| | | const searchSealApplications = () => { |
| | | page.current=1 |
| | | getSealApplicationList() |
| | | |
| | | // ElMessage.success('æç´¢å®æ') |
| | | } |
| | | // éç½®å°ç« ç³è¯·æç´¢ |
| | | const resetSealSearch = () => { |
| | | sealSearchForm.title = '' |
| | | sealSearchForm.status = '' |
| | | searchSealApplications() |
| | | } |
| | | // æç´¢å¶åº¦ |
| | | const searchRegulations = () => { |
| | |
| | | regulationSearchForm.title = '' |
| | | regulationSearchForm.category = '' |
| | | searchRegulations() |
| | | } |
| | | // æäº¤ç¨å°ç³è¯· |
| | | const submitSealApplication = async () => { |
| | | try { |
| | | await sealFormRef.value.validate() |
| | | addSealApplication(sealForm).then(res => { |
| | | if(res.code == 200){ |
| | | ElMessage.success('ç³è¯·æäº¤æå') |
| | | showSealApplyDialog.value = false |
| | | getSealApplicationList() |
| | | Object.assign(sealForm, { |
| | | applicationNum: '', |
| | | title: '', |
| | | sealType: '', |
| | | reason: '', |
| | | urgency: 'normal', |
| | | status: 'pending' |
| | | }) |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error(err.msg) |
| | | }) |
| | | |
| | | } catch (error) { |
| | | ElMessage.error('请å®åç³è¯·ä¿¡æ¯') |
| | | } |
| | | } |
| | | // æ°å¢ |
| | | const handleAdd = () => { |
| | |
| | | } |
| | | |
| | | |
| | | // æ¥çç¨å°ç³è¯·è¯¦æ
|
| | | const viewSealDetail = (row) => { |
| | | currentSealDetail.value = row |
| | | showSealDetailDialog.value = true |
| | | } |
| | | // 审æ¹ç¨å°ç³è¯· |
| | | const approveSeal = (row) => { |
| | | console.log(row) |
| | | ElMessageBox.confirm('确认éè¿è¯¥ç¨å°ç³è¯·ï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | row.status = 'approved' |
| | | updateSealApplication(row).then(res => { |
| | | if(res.code == 200){ |
| | | ElMessage.success('审æ¹éè¿') |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | // æç»ç¨å°ç³è¯· |
| | | const rejectSeal = (row) => { |
| | | ElMessageBox.prompt('请è¾å
¥æç»åå ', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | inputPattern: /\S+/, |
| | | inputErrorMessage: 'æç»åå ä¸è½ä¸ºç©º' |
| | | }).then(({ value }) => { |
| | | row.status = 'rejected' |
| | | updateSealApplication(row).then(res => { |
| | | if(res.code == 200){ |
| | | ElMessage.success('å®¡æ¹æç»') |
| | | } |
| | | }) |
| | | ElMessage.success('å·²æç»ç³è¯·') |
| | | }) |
| | | } |
| | | // è·åå¨èåå·¥å表 |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | //è·åå½åç»å½ç¨æ·ä¿¡æ¯ |
| | | getUserProfile().then(res => { |
| | | if(res.code == 200){ |
| | | console.log(res.data.userName) |
| | | currentUser.value = res.data.userName |
| | | } |
| | | }) |
| | | staffJoinListPage({staffState: 1}).then(res => { |
| | | tableLoading.value = false; |
| | | // tableData.value = res.data.records |
| | | // //çéåºåcurrentUserååç人å |
| | | tableData.value = res.data.records.filter(item => item.staffName === currentUser.value) |
| | | console.log("tableData",tableData.value) |
| | | page.total = res.data.total; |
| | | |
| | | if(tableData.value.length == 0){ |
| | | ElMessage.error('å½åç¨æ·æªå å
¥ä»»ä½é¨é¨') |
| | | } |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | |
| | | |
| | | }; |
| | | |
| | | // æ¥çå¶åº¦çæ¬åå² |
| | | const viewVersionHistory = (row) => { |
| | | showVersionHistoryDialog.value = true |
| | |
| | | } |
| | | // æ¥çå¶åº¦è¯¦æ
|
| | | const viewRegulation = (row) => { |
| | | getList() |
| | | currentRegulationDetail.value = row |
| | | showRegulationDetailDialog.value = true |
| | | getReadingStatusByRuleId(row.id).then(res => { |
| | |
| | | proxy.download('/rulesRegulationsManagement/export', { ...regulationSearchForm }, 'è§ç« å¶åº¦.xlsx') |
| | | } |
| | | |
| | | // è·åå°ç« ç³è¯·åè¡¨æ°æ® |
| | | const getSealApplicationList = async () => { |
| | | tableLoading.value = true |
| | | listSealApplication(page,sealSearchForm) |
| | | .then(res => { |
| | | //è·åå½åç»å½çé¨é¨ä¿¡æ¯ |
| | | // è·åå½åç»å½çé¨é¨ä¿¡æ¯å¹¶è¿æ»¤æ°æ® |
| | | const currentFactoryName = userStore.currentFactoryName |
| | | if (currentFactoryName) { |
| | | // æ ¹æ®currentFactoryNameè¿æ»¤åºdepartmentç¸åçæ°æ® |
| | | sealApplications.value = res.data.records.filter(item => item.department === currentFactoryName) |
| | | // æ´æ°è¿æ»¤åçæ»æ° |
| | | page.value.total = sealApplications.value.length |
| | | } else { |
| | | // å¦ææ²¡æcurrentFactoryNameï¼åæ¾ç¤ºæææ°æ® |
| | | sealApplications.value = res.data.records |
| | | page.value.total = res.data.total |
| | | } |
| | | // sealApplications.value = res.data.records |
| | | // page.value.total = res.data.total; |
| | | tableLoading.value = false; |
| | | |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | // éä»¶ï¼æ¥è¯¢ |
| | | const fetchRuleFiles = async (rulesRegulationsManagementId) => { |
| | | const params = { |
| | | current: filePage.current, |
| | | size: filePage.size, |
| | | rulesRegulationsManagementId |
| | | } |
| | | const res = await listRuleFiles(params) |
| | | const records = res?.data?.records || [] |
| | | filePage.total = res?.data?.total || records.length |
| | | const mapped = records.map(item => ({ |
| | | id: item.id, |
| | | name: item.fileName || item.name, |
| | | url: item.fileUrl || item.url, |
| | | raw: item |
| | | })) |
| | | fileListDialogRef.value?.setList(mapped) |
| | | } |
| | | |
| | | // æå¼éä»¶å¼¹çª |
| | | const openFileDialog = async (row) => { |
| | | currentFileRuleId.value = row.id |
| | | fileDialogVisible.value = true |
| | | await fetchRuleFiles(row.id) |
| | | } |
| | | |
| | | // å·æ°éä»¶å表 |
| | | const refreshFileList = async () => { |
| | | if (!currentFileRuleId.value) return |
| | | await fetchRuleFiles(currentFileRuleId.value) |
| | | } |
| | | |
| | | // ä¸ä¼ éä»¶ï¼ç±åç»ä»¶è§¦åï¼ |
| | | const handleAttachmentUpload = async (filePayload) => { |
| | | if (!currentFileRuleId.value) return |
| | | const payload = { |
| | | name: filePayload?.fileName || filePayload?.name, |
| | | url: filePayload?.fileUrl || filePayload?.url, |
| | | rulesRegulationsManagementId: currentFileRuleId.value |
| | | } |
| | | await addRuleFile(payload) |
| | | ElMessage.success('æä»¶ä¸ä¼ æå') |
| | | await refreshFileList() |
| | | } |
| | | |
| | | // å é¤éä»¶ |
| | | const handleAttachmentDelete = async (row) => { |
| | | if (!row?.id) return false |
| | | try { |
| | | await ElMessageBox.confirm('确认å é¤è¯¥éä»¶ï¼', 'æç¤º', { type: 'warning' }) |
| | | } catch { |
| | | return false |
| | | } |
| | | await delRuleFile([row.id]) |
| | | ElMessage.success('å 餿å') |
| | | await refreshFileList() |
| | | } |
| | | |
| | | // è·åè§ç« å¶åº¦åè¡¨æ°æ® |
| | | const getRegulationList = async () => { |
| | | tableLoading.value = true |
| | |
| | | |
| | | onMounted(() => { |
| | | // åå§å |
| | | getSealApplicationList() |
| | | getRegulationList() |
| | | }) |
| | | </script> |
| | |
| | | <div class="tab-content"> |
| | | <el-row :gutter="20" class="mb-20 "> |
| | | <span class="ml-10">ç¨å°æ é¢ï¼</span> |
| | | <el-col :span="6"> |
| | | <el-col :span="4"> |
| | | <el-input v-model="sealSearchForm.title" placeholder="请è¾å
¥ç³è¯·æ é¢" clearable /> |
| | | </el-col> |
| | | <span class="ml-10">ç¨å°ç¼å·ï¼</span> |
| | | <el-col :span="4"> |
| | | <el-input v-model="sealSearchForm.applicationNum" placeholder="请è¾å
¥ç¨å°ç¼å·" clearable /> |
| | | </el-col> |
| | | <span class="search_title">审æ¹ç¶æï¼</span> |
| | | <el-col :span="6"> |
| | | <el-col :span="4"> |
| | | <el-select v-model="sealSearchForm.status" placeholder="审æ¹ç¶æ" clearable> |
| | | <el-option label="å¾
审æ¹" value="pending" /> |
| | | <el-option label="å·²éè¿" value="approved" /> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="ç³è¯·åå " prop="reason"> |
| | | <el-input v-model="sealForm.reason" type="textarea" :rows="4" placeholder="请详ç»è¯´æç¨å°åå " /> |
| | | </el-form-item> |
| | | <el-form-item label="审æ¹äºº" prop="approveUserId"> |
| | | <el-select v-model="sealForm.approveUserId" placeholder="è¯·éæ©å®¡æ¹äºº" style="width: 100%" filterable> |
| | | <el-option |
| | | v-for="user in userList" |
| | | :key="user.userId" |
| | | :label="user.nickName" |
| | | :value="user.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç´§æ¥ç¨åº¦" prop="urgency"> |
| | | <el-radio-group v-model="sealForm.urgency"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, getCurrentInstance } from 'vue' |
| | | import { ref, reactive, onMounted, getCurrentInstance, watch } from 'vue' |
| | | import { useRoute } from 'vue-router' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { Plus } from '@element-plus/icons-vue' |
| | | import { listSealApplication, addSealApplication, updateSealApplication,listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement,getReadingStatusByRuleId,getReadingStatusList,addReadingStatus,updateReadingStatus } from '@/api/collaborativeApproval/sealManagement.js' |
| | | import { el } from 'element-plus/es/locales.mjs' |
| | | import { getUserProfile } from '@/api/system/user.js' |
| | | import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from '@/api/system/user.js' |
| | | import useUserStore from '@/store/modules/user' |
| | | import { userLoginFacotryList } from "@/api/system/user.js" |
| | | import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"; |
| | | |
| | | // ååºå¼æ°æ® |
| | | const currentUser = ref(null) |
| | |
| | | const tableData = ref([]) |
| | | // ç¨å°ç³è¯·ç¸å
³ |
| | | const userStore = useUserStore() |
| | | const route = useRoute() |
| | | const showSealApplyDialog = ref(false) |
| | | const tableLoading = ref(false) |
| | | const showSealDetailDialog = ref(false) |
| | | const currentSealDetail = ref(null) |
| | | const sealFormRef = ref() |
| | | const userList = ref([]) |
| | | const sealForm = reactive({ |
| | | applicationNum: '', |
| | | title: '', |
| | | sealType: '', |
| | | reason: '', |
| | | approveUserId: '', |
| | | urgency: 'normal', |
| | | status: 'pending' |
| | | }) |
| | |
| | | applicationNum: [{ required: true, message: '请è¾å
¥ç³è¯·ç¼å·', trigger: 'blur' }], |
| | | title: [{ required: true, message: '请è¾å
¥ç³è¯·æ é¢', trigger: 'blur' }], |
| | | sealType: [{ required: true, message: 'è¯·éæ©ç¨å°ç±»å', trigger: 'change' }], |
| | | reason: [{ required: true, message: '请è¾å
¥ç³è¯·åå ', trigger: 'blur' }] |
| | | reason: [{ required: true, message: '请è¾å
¥ç³è¯·åå ', trigger: 'blur' }], |
| | | approveUserId: [{ required: true, message: 'è¯·éæ©å®¡æ¹äºº', trigger: 'change' }] |
| | | } |
| | | |
| | | const sealSearchForm = reactive({ |
| | | title: '', |
| | | status: '' |
| | | status: '', |
| | | applicationNum: '' |
| | | }) |
| | | // å页忰 |
| | | const page = reactive({ |
| | |
| | | const resetSealSearch = () => { |
| | | sealSearchForm.title = '' |
| | | sealSearchForm.status = '' |
| | | sealSearchForm.applicationNum = '' |
| | | searchSealApplications() |
| | | } |
| | | // æç´¢å¶åº¦ |
| | |
| | | title: '', |
| | | sealType: '', |
| | | reason: '', |
| | | approveUserId: '', |
| | | urgency: 'normal', |
| | | status: 'pending' |
| | | }) |
| | |
| | | currentUser.value = res.data.userName |
| | | } |
| | | }) |
| | | staffJoinListPage({staffState: 1, ...page}).then(res => { |
| | | staffOnJobListPage({staffState: 1, ...page}).then(res => { |
| | | tableLoading.value = false; |
| | | // tableData.value = res.data.records |
| | | // //çéåºåcurrentUserååç人å |
| | |
| | | }) |
| | | } |
| | | |
| | | // çå¬å¯¹è¯æ¡æå¼ï¼è·åç¨æ·å表 |
| | | watch(showSealApplyDialog, (newVal) => { |
| | | if (newVal) { |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | // åå§å |
| | | getSealApplicationList() |
| | | // è·¯ç±æºå¸¦ applicationNum æ¶ï¼é¢å¡«å¹¶æ¥è¯¢ |
| | | if (route.query.applicationNum) { |
| | | sealSearchForm.applicationNum = String(route.query.applicationNum) |
| | | page.current = 1 |
| | | getSealApplicationList() |
| | | } else { |
| | | getSealApplicationList() |
| | | } |
| | | getRegulationList() |
| | | }) |
| | | </script> |
| | |
| | | :is-selection="true" |
| | | :border="true" |
| | | :table-loading="tableLoading" |
| | | :table-style="{ width: '100%', height: 'calc(100vh - 21.5em)' }" |
| | | :table-style="{ width: '100%', height: 'calc(100vh - 18.5em)' }" |
| | | :page="{ |
| | | current: page.current, |
| | | size: page.size, |
| | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | |
| | | size: 100, |
| | | }); |
| | | const usageRecordsTotal = ref(0); |
| | | const usageRecordsColumns = ref([ |
| | | { label: "车çå·", prop: "plateNumber", width: "120" }, |
| | | { label: "使ç¨äºº", prop: "userName", width: "120" }, |
| | | { label: "ç®çå°", prop: "destination", width: "150" }, |
| | | { label: "ä½¿ç¨æ¶é´", prop: "useTime", width: "180" }, |
| | | { label: "è¿è½¦æ¶é´", prop: "returnTime", width: "180" }, |
| | | { label: "使ç¨åéç¨(km)", prop: "odometerBefore", width: "130" }, |
| | | { label: "è¿è½¦æ¶éç¨(km)", prop: "odometerAfter", width: "130" }, |
| | | { label: "æ¬æ¬¡è¡é©¶éç¨(km)", prop: "travelDistance", width: "140" }, |
| | | ]); |
| | | const currentVehicleId = ref(null); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | |
| | | }, |
| | | ]); |
| | | |
| | | // 使ç¨è®°å½è¡¨æ ¼åé
ç½® |
| | | const usageRecordsColumns = ref([ |
| | | { label: "车çå·", prop: "plateNumber", width: "120" }, |
| | | { label: "使ç¨äºº", prop: "userName", width: "120" }, |
| | | { label: "ç®çå°", prop: "destination", width: "150" }, |
| | | { label: "ä½¿ç¨æ¶é´", prop: "useTime", width: "180" }, |
| | | { label: "è¿è½¦æ¶é´", prop: "returnTime", width: "180" }, |
| | | { label: "使ç¨åéç¨(km)", prop: "odometerBefore", width: "130" }, |
| | | { label: "è¿è½¦æ¶éç¨(km)", prop: "odometerAfter", width: "130" }, |
| | | { label: "æ¬æ¬¡è¡é©¶éç¨(km)", prop: "travelDistance", width: "140" }, |
| | | ]); |
| | | |
| | | // æ¥è¯¢å表 |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | |
| | | odometer: 0, |
| | | remark: "", |
| | | }; |
| | | |
| | | let userLists = await userListNoPage(); |
| | | |
| | | const userLists = await userListNoPage(); |
| | | userList.value = userLists.data || []; |
| | | |
| | | if (type !== "add") { |
| | | currentId.value = row.id; |
| | | getVehicleById(row.id).then((res) => { |
| | | form.value = { ...res.data || res }; |
| | | form.value = { ...(res.data || res) }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "add") { |
| | | addVehicle(form.value).then((res) => { |
| | | addVehicle(form.value).then(() => { |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | } else { |
| | | form.value.id = currentId.value; |
| | | updateVehicle(form.value).then((res) => { |
| | | updateVehicle(form.value).then(() => { |
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | closeDia(); |
| | | getList(); |
| | |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | |
| | | // æå¼åè´§å¼¹æ¡ |
| | | // æå¼ä½¿ç¨è½¦è¾å¼¹æ¡ |
| | | const openUseForm = async (row) => { |
| | | currentUseRow.value = row; |
| | | useForm.value = { |
| | |
| | | userId: "", |
| | | remark: "", |
| | | }; |
| | | |
| | | let userLists = await userListNoPage(); |
| | | |
| | | const userLists = await userListNoPage(); |
| | | userList.value = userLists.data || []; |
| | | |
| | | |
| | | useFormVisible.value = true; |
| | | }; |
| | | |
| | |
| | | const submitUseForm = () => { |
| | | proxy.$refs["useFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | useVehicle(useForm.value).then((res) => { |
| | | useVehicle(useForm.value).then(() => { |
| | | proxy.$modal.msgSuccess("使ç¨è½¦è¾æå"); |
| | | closeUseDia(); |
| | | getList(); |
| | |
| | | userId: "", |
| | | remark: "", |
| | | }; |
| | | |
| | | let userLists = await userListNoPage(); |
| | | |
| | | const userLists = await userListNoPage(); |
| | | userList.value = userLists.data || []; |
| | | |
| | | |
| | | returnFormVisible.value = true; |
| | | }; |
| | | |
| | |
| | | const submitReturnForm = () => { |
| | | proxy.$refs["returnFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | returnVehicle(returnForm.value).then((res) => { |
| | | returnVehicle(returnForm.value).then(() => { |
| | | proxy.$modal.msgSuccess("è¿è½¦æå"); |
| | | closeReturnDia(); |
| | | getList(); |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delVehicle(ids).then((res) => { |
| | | delVehicle(ids).then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <!-- <el-button type="primary" @click="openForm('add')">æ°å¢</el-button> --> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | <el-button type="primary" plain @click="handlePrint">æå°</el-button> |
| | |
| | | <div v-for="(item, index) in printData" :key="index" class="print-page"> |
| | | <div class="delivery-note"> |
| | | <div class="header"> |
| | | <div class="company-name">éæµ·æ¹æ°´å³¡åä¸å屿éå
¬å¸</div> |
| | | <div class="company-name">é¼è¯çå®ä¸æé责任å
¬å¸</div> |
| | | <div class="document-title">é¶å®åè´§å</div> |
| | | </div> |
| | | |
| | |
| | | |
| | | <script setup> |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue"; |
| | | import { ref } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import { |
| | | getStockOutPage, |
| | | delStockOut, |
| | |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { |
| | | ...page, |
| | | supplierName: searchForm.value.supplierName, |
| | | timeStr: searchForm.value.timeStr |
| | | } |
| | | |
| | | getStockOutPage(params) |
| | | getStockOutPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | |
| | | <div class="print-page"> |
| | | <div class="delivery-note"> |
| | | <div class="header"> |
| | | <div class="company-name">éæµ·æ¹æ°´å³¡åä¸å屿éå
¬å¸</div> |
| | | <div class="company-name">é¼è¯çå®ä¸æé责任å
¬å¸</div> |
| | | <div class="document-title">é¶å®åè´§å</div> |
| | | </div> |
| | | |
| | |
| | | const seconds = String(date.getSeconds()).padStart(2, "0"); |
| | | return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`; |
| | | }; |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | |
| | | <span class="search_title">ä¾åºååç§°ï¼</span> |
| | | <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="请è¾å
¥" @change="handleQuery" |
| | | clearable prefix-icon="Search" /> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <!-- <el-button type="primary" @click="openForm('add')">æ°å¢åºåº</el-button> --> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button> --> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºæ°é" prop="inboundNum" width="90" show-overflow-tooltip /> |
| | | <el-table-column label="åºåæ°é" prop="inboundNum0" width="90" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" show-overflow-tooltip /> |
| | |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue' |
| | | import { ref } from 'vue' |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { |
| | | getStockInPage, |
| | | getStockInPage |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | import { |
| | | stockOut, |
| | | getStockManagePage, |
| | | delStockManage, |
| | | stockOut, |
| | | } from "@/api/inventoryManagement/stockManage.js"; |
| | | |
| | | const userStore = useUserStore() |
| | |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const fileList = ref([]) |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const dialogFormVisible = ref(false) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: '', |
| | | timeStr: '', |
| | | inboundQuantity:'', |
| | | inboundTime:'', |
| | | nickName: '', |
| | | userId: '', |
| | | timeStr: '', |
| | | }, |
| | | form: { |
| | | productrecordId: '', |
| | |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | const params = { |
| | | ...page, |
| | | supplierName: searchForm.value.supplierName, |
| | | timeStr: searchForm.value.timeStr |
| | | } |
| | | |
| | | getStockInPage(params).then(res => { |
| | | getStockInPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | console.log('res', res.data.records) |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; // æ¾å°èç¹ï¼è¿å该èç¹ |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode.label; // å¨åèç¹ä¸æ¾å°ï¼è¿å该èç¹ |
| | | } |
| | | } |
| | | } |
| | | return null; // æ²¡ææ¾å°èç¹ï¼è¿ånull |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | // è¿æ»¤æåæ°æ® |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | console.log('selection', selectedRows.value) |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | | |
| | |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); |
| | | }; |
| | | const currentRowId = ref(null) |
| | | const currentRowId = ref(null) // æ°å¢ï¼åå¨å½åæä½çè¡ID |
| | | |
| | | const currentRowNum = ref(0) |
| | | const salesLedgerProductId = ref(null); |
| | | |
| | |
| | | currentRowNum.value = row.inboundNum0 |
| | | salesLedgerProductId.value = row.salesLedgerProductId |
| | | form.value = {} |
| | | // åå§åè¡¨åæ°æ® |
| | | form.value = { |
| | | productrecordId: '', |
| | | inboundQuantity: '', |
| | | inboundTime: getCurrentDate(), |
| | | nickName: '', |
| | | inboundQuantity: '', // åºåºæ°éæ¸
空 |
| | | inboundTime: getCurrentDate(), // é»è®¤å½åæ¥æ |
| | | nickName: '', // é»è®¤å½åç¨æ· |
| | | } |
| | | console.log('form',form.value) |
| | | // å è½½ç¨æ·å表 |
| | | try { |
| | | const userLists = await userListNoPageByTenantId() |
| | |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid && currentRowId.value) { |
| | | const outData = { |
| | | id: currentRowId.value, |
| | | id: currentRowId.value, // åå§è®°å½ID |
| | | salesLedgerProductId: salesLedgerProductId.value, |
| | | quantity: form.value.inboundQuantity, |
| | | time: form.value.inboundTime, |
| | | userId: form.value.nickName, |
| | | type: 1 // éè´åºåº |
| | | quantity: form.value.inboundQuantity, // åºåºæ°é |
| | | time: form.value.inboundTime, // åºåºæ¶é´ |
| | | userId: form.value.nickName // æä½äºº |
| | | } |
| | | console.log(outData) |
| | | |
| | | stockOut(outData).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | } |
| | | |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, '0'); |
| | | const day = String(today.getDate()).padStart(2, '0'); |
| | | return `${year}-${month}-${day}`; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = [] |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning('è¯·éæ©æ°æ®') |
| | | return |
| | | } |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delStockManage(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getList() |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | } |
| | | onMounted(() => { |
| | | getList() |
| | |
| | | placeholder="è¯·éæ©éè´è®¢åå·" |
| | | clearable |
| | | filterable |
| | | remote |
| | | :remote-method="loadPurchaseOptions" |
| | | :loading="loadingPurchaseOptions" |
| | | @change="handlePurchaseChange" |
| | | :disabled="operationType === 'edit'" |
| | |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" /> |
| | | <el-table-column label="åä½" prop="unit" width="70" /> |
| | | <el-table-column label="ä¾åºå" prop="supplierName" width="100" /> |
| | | <!-- <el-table-column label="ä¾åºå" prop="supplierName" width="100" /> --> |
| | | <el-table-column label="éè´æ°é" prop="quantity" width="100" /> |
| | | <el-table-column label="å¾
å
¥åºæ°é" prop="quantity0" width="100" /> |
| | | <el-table-column label="æ¬æ¬¡å
¥åºæ°é" prop="quantityStock" width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" /> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" @change="() => calculateTotalPrice(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="120" /> |
| | | <el-table-column label="åä»·(å
)" prop="taxInclusiveUnitPrice" width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="() => calculateTotalPrice(scope.row)" :disabled="operationType === 'edit'"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | label="æ»ä»·(å
)" |
| | | :formatter="formattedNumber" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" |
| | | /> |
| | | > |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | |
| | | // è®¡ç®æ»ä»· |
| | | const calculateTotalPrice = (row) => { |
| | | const quantityStock = Number(row?.quantityStock ?? 0); |
| | | const taxInclusiveUnitPrice = Number(row?.taxInclusiveUnitPrice ?? 0); |
| | | |
| | | if (Number.isFinite(quantityStock) && Number.isFinite(taxInclusiveUnitPrice)) { |
| | | row.taxInclusiveTotalPrice = quantityStock * taxInclusiveUnitPrice; |
| | | } else { |
| | | row.taxInclusiveTotalPrice = 0; |
| | | } |
| | | }; |
| | | |
| | | const fetchProductsByContract = async () => { |
| | | if (!form.value.purchaseContractNumber) { |
| | | proxy.$modal.msgWarning('è¯·éæ©ååå·') |
| | |
| | | productList.value = productRes.data.map(item => ({ |
| | | ...item, |
| | | quantityStock: 0, |
| | | taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0), |
| | | taxInclusiveTotalPrice: 0, |
| | | originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? 0), |
| | | })) |
| | | } catch (error) { |
| | |
| | | nickName: userStore.nickName, |
| | | details: selectedRows.value.map(product => ({ |
| | | id: product.id, |
| | | inboundQuantity: Number(product.quantityStock) |
| | | inboundQuantity: Number(product.quantityStock), |
| | | unitPrice: Number(product.taxInclusiveUnitPrice), |
| | | taxRate: Number(product.taxRate), |
| | | taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice) |
| | | })), |
| | | }; |
| | | loading.value = true |
| | |
| | | productList.value = res.data.map(item => ({ |
| | | ...item, |
| | | quantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0), |
| | | taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0), |
| | | taxInclusiveTotalPrice: Number(item?.quantityStock ?? 0) * Number(item?.taxInclusiveUnitPrice ?? 0), |
| | | originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0), |
| | | })) |
| | | selectedRows.value = productList.value |
| | |
| | | |
| | | <style scoped lang="scss"></style> |
| | | |
| | | |
| | | |
| ÎļþÃû´Ó src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue ÐÞ¸Ä |
| | |
| | | <el-input v-model="scope.row.unit" placeholder="请è¾å
¥åä½" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ä¾åºå" prop="supplierName" width="200"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.supplierName" placeholder="请è¾å
¥ä¾åºå" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç©åç±»å" prop="itemType" width="140"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.itemType" placeholder="è¯·éæ©ç©åç±»å" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in itemTypeOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å
¥åºæ°é" prop="inboundNum" width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.inboundNum" @change="() => calculateTotalPrice(scope.row)" /> |
| | |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="150"> |
| | | <el-table-column label="åä»·(å
)" prop="unitPrice" width="150"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.taxRate" placeholder="è¯·éæ©ç¨ç" style="width: 100%" @change="() => calculateExclusivePrice(scope.row)"> |
| | | <el-option |
| | | v-for="item in taxRateOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.unitPrice" @change="() => calculateTotalPrice(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | width="180" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="calculateTotalPrice(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="180" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveTotalPrice" @change="calculateExclusivePrice(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | width="180" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxExclusiveTotalPrice" /> |
| | | </template> |
| | | <el-table-column |
| | | label="æ»ä»·(å
)" |
| | | prop="totalPrice" |
| | | width="150" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="80" v-if="operationType === 'add'"> |
| | | <template #default="scope"> |
| | |
| | | import { ref, reactive, toRefs, getCurrentInstance } from 'vue' |
| | | import useUserStore from '@/store/modules/user' |
| | | import { |
| | | addStockInCustom, |
| | | updateStockInCustom, |
| | | addStockInCustom, updateProduct |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | |
| | | const userStore = useUserStore() |
| | |
| | | itemType: '', |
| | | inboundNum: 0, |
| | | inboundDate: '', |
| | | quantityStock: 0, |
| | | unitPrice: 0, |
| | | totalPrice: 0, |
| | | taxRate: null, |
| | | taxInclusiveUnitPrice: 0, |
| | | taxInclusiveTotalPrice: 0, |
| | | taxExclusiveTotalPrice: 0, |
| | | }); |
| | | }; |
| | |
| | | productList.value.splice(index, 1); |
| | | }; |
| | | |
| | | // 计ç®å«ç¨æ»ä»·ï¼æ ¹æ®åä»·åæ°éï¼ |
| | | // è®¡ç®æ»ä»·ï¼æ ¹æ®æ°éãåä»·åå«ç¨åä»·ï¼ |
| | | const calculateTotalPrice = (row) => { |
| | | const unitPrice = Number(row.taxInclusiveUnitPrice || 0); |
| | | // è®¡ç®æ®éæ»ä»·ï¼inboundNum * unitPrice |
| | | const quantity = Number(row.inboundNum || 0); |
| | | row.taxInclusiveTotalPrice = unitPrice * quantity; |
| | | const unitPrice = Number(row.unitPrice || 0); |
| | | row.totalPrice = quantity * unitPrice; |
| | | calculateExclusivePrice(row); |
| | | }; |
| | | |
| | | // 计ç®ä¸å«ç¨æ»ä»·ï¼æ ¹æ®å«ç¨æ»ä»·åç¨çï¼ |
| | | const calculateExclusivePrice = (row) => { |
| | | const totalPrice = Number(row.taxInclusiveTotalPrice || 0); |
| | | const totalPrice = Number(row.totalPrice || 0); |
| | | const taxRate = Number(row.taxRate || 0); |
| | | row.taxExclusiveTotalPrice = totalPrice / (1 + taxRate / 100); |
| | | }; |
| | |
| | | const product = productList.value[i]; |
| | | if (!product.productCategory || !product.specificationModel || !product.unit) { |
| | | proxy.$modal.msgError(`第${i + 1}è¡äº§åæ°æ®æªå¡«å宿´ï¼äº§å大类ãè§æ ¼åå·ãåä½ä¸ºå¿
å¡«ï¼`) |
| | | return |
| | | } |
| | | if (!product.itemType) { |
| | | proxy.$modal.msgError(`第${i + 1}è¡è¯·éæ©ç©åç±»å`) |
| | | return |
| | | } |
| | | if (!product.inboundDate) { |
| | |
| | | itemType: product.itemType, |
| | | inboundDate: formatDateTime(product.inboundDate, false), |
| | | taxRate: Number(product.taxRate || 0), |
| | | taxInclusiveUnitPrice: Number(product.taxInclusiveUnitPrice || 0), |
| | | taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice || 0), |
| | | taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0), |
| | | unitPrice: Number(product.unitPrice || 0), |
| | | })); |
| | | loading.value = true |
| | | if (operationType.value === 'edit') { |
| | | const editPayload = payloadList[0] |
| | | await updateStockInCustom(editPayload) |
| | | await updateProduct(editPayload) |
| | | } else { |
| | | await addStockInCustom(payloadList) |
| | | } |
| | |
| | | inboundNum: Number(row?.inboundNum ?? row?.inboundQuantity ?? 0), |
| | | inboundDate: row?.inboundDate ?? row?.createTime ?? '', |
| | | taxRate: Number(row?.taxRate ?? 0), |
| | | taxInclusiveUnitPrice: Number(row?.taxInclusiveUnitPrice ?? 0), |
| | | taxInclusiveTotalPrice: Number(row?.taxInclusiveTotalPrice ?? 0), |
| | | unitPrice: Number(row?.unitPrice ?? 0), |
| | | taxExclusiveTotalPrice: Number(row?.taxExclusiveTotalPrice ?? 0), |
| | | }] |
| | | } |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ä¾åºååç§°ï¼</span> |
| | | <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="请è¾å
¥" @change="handleQuery" |
| | | clearable prefix-icon="Search" /> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢å
¥åº</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%" |
| | | :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="å
¥åºæ¶é´" prop="createTime" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºæ¹æ¬¡" prop="inboundBatches" width="160" show-overflow-tooltip /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" width="240" show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" prop="productCategory" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºæ°é" prop="inboundNum" width="90" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºäºº" prop="createBy" width="80" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);" :disabled="scope.row.createUser !== userStore.id">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | |
| | | <form-dia ref="formDia" @close="handleQuery" @success="handleQuery"></form-dia> |
| | | <el-tabs v-model="activeTab" |
| | | @tab-change="handleTabChange"> |
| | | <el-tab-pane label="æåå
¥åº" |
| | | name="production"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery"/> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable/> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢ |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">å é¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55"/> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60"/> |
| | | <el-table-column label="å
¥åºæ¶é´" |
| | | prop="createTime" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | width="180" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="70" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="å
¥åºæ°é" |
| | | prop="inboundNum" |
| | | width="100" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="åä»·(å
)" |
| | | prop="unitPrice" |
| | | width="150"></el-table-column> |
| | | <el-table-column label="æ»ä»·(å
)" |
| | | prop="totalPrice" |
| | | width="150"></el-table-column> |
| | | <!-- <el-table-column fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | | size="small" |
| | | @click="openForm('edit', scope.row, 'production');">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange"/> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="åæå
¥åº" |
| | | name="purchase"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery"/> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable/> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢ |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" |
| | | @click="openForm('add', 'purchase')">æ°å¢å
¥åº |
| | | </el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">å é¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55"/> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60"/> |
| | | <el-table-column label="å
¥åºæ¶é´" |
| | | prop="createTime" |
| | | width="100" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="éè´ååå·" |
| | | prop="purchaseContractNumber" |
| | | width="180" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="ä¾åºååç§°" |
| | | prop="supplierName" |
| | | width="240" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="70" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="å
¥åºæ°é" |
| | | prop="inboundNum" |
| | | width="100" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | width="150"></el-table-column> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="150"></el-table-column> |
| | | <el-table-column label="å
¥åºäºº" |
| | | prop="createBy" |
| | | width="80" |
| | | show-overflow-tooltip/> |
| | | <el-table-column fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | :disabled="scope.row.type == 1" |
| | | type="primary" |
| | | size="small" |
| | | @click="openForm('edit', scope.row, 'purchase');">ç¼è¾ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange"/> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="ç产å
¥åº" |
| | | name="product"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery"/> |
| | | <span class="search_title ml10">产å大类ï¼</span> |
| | | <el-input v-model="searchForm.productCategory" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | clearable/> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢ |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" |
| | | @click="openForm('add', 'purchase')">æ°å¢å
¥åº |
| | | </el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">å é¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55"/> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60"/> |
| | | <el-table-column label="å
¥åºæ¶é´" |
| | | prop="createTime" |
| | | width="100" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="220" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="å
¥åºæ°é" |
| | | prop="inboundNum" |
| | | width="220" |
| | | show-overflow-tooltip/> |
| | | <el-table-column label="å
¥åºäºº" |
| | | prop="createBy" |
| | | width="220" |
| | | show-overflow-tooltip/> |
| | | </el-table> |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="pageProductChange"/> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <form-dia ref="formDia" |
| | | @close="handleQuery" |
| | | @success="handleQuery"></form-dia> |
| | | <form-dia-product ref="formDiaProduct" |
| | | @close="handleQuery" |
| | | @success="handleQuery"></form-dia-product> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance, nextTick } from 'vue' |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { |
| | | getStockInPage, |
| | | delStockIn, |
| | | ref, |
| | | reactive, |
| | | toRefs, |
| | | onMounted, |
| | | getCurrentInstance, |
| | | nextTick, |
| | | } from "vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | | getStockInPage, |
| | | getStockInPageByProduction, |
| | | getStockInPageByProductProduction, |
| | | delStockIn, |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | import FormDia from './components/formDia.vue' |
| | | import FormDia from "./components/formDia.vue"; |
| | | import FormDiaProduct from "./components/formDiaProduct.vue"; |
| | | |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance() |
| | | // è·åå½åæ¥æ |
| | | function getCurrentDate() { |
| | | return dayjs().format("YYYY-MM-DD"); |
| | | } |
| | | |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | const formDia = ref() |
| | | const {proxy} = getCurrentInstance(); |
| | | |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const formDia = ref(); |
| | | const formDiaProduct = ref(); |
| | | const activeTab = ref("production"); // å½åæ¿æ´»ç tab |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | }); |
| | | const total = ref(0); |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: '', |
| | | timeStr: '', |
| | | supplierName: "", |
| | | customerName: "", |
| | | productCategory: "", |
| | | timeStr: "", |
| | | }, |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | }); |
| | | const {searchForm} = toRefs(data); |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | const paginationChange = (obj) => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const pageProductChange = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | const params = { |
| | | ...page, |
| | | supplierName: searchForm.value.supplierName, |
| | | timeStr: searchForm.value.timeStr |
| | | tableLoading.value = true; |
| | | const params = {...page}; |
| | | |
| | | // æ ¹æ®ä¸åç tab ç±»åä¼ éä¸åçæ¥è¯¢åæ° |
| | | if (activeTab.value === "production") { |
| | | params.customerName = searchForm.value.customerName; |
| | | params.timeStr = searchForm.value.timeStr; |
| | | } else { |
| | | params.supplierName = searchForm.value.supplierName; |
| | | params.timeStr = searchForm.value.timeStr; |
| | | } |
| | | |
| | | getStockInPage(params).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | params.productCategory = searchForm.value.productCategory; |
| | | if (activeTab.value === "product") { |
| | | getStockInPageByProductProduction(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | }); |
| | | |
| | | }else { |
| | | // æ ¹æ®ä¸åç tab ç±»åè°ç¨ä¸åçæ¥å£ |
| | | const apiCall = |
| | | activeTab.value === "production" |
| | | ? getStockInPageByProduction(params) |
| | | : getStockInPage(params); |
| | | |
| | | apiCall |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | |
| | | // åç«¯è®¡ç®æ»ä»·ï¼æ»ä»· = unitPrice * inboundNum |
| | | tableData.value = tableData.value.map(item => { |
| | | // 使ç¨å
¥åºæ°éè®¡ç®æ»ä»· |
| | | const inboundNum = Number(item.inboundNum) || 0; |
| | | const unitPrice = Number(item.unitPrice) || 0; |
| | | const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0; |
| | | |
| | | // æ ¹æ®æ ç¾é¡µç±»å计ç®ä¸åçæ»ä»· |
| | | if (activeTab.value === "production") { |
| | | // æååºåï¼æ»ä»· = unitPrice * å
¥åºæ°é |
| | | item.totalPrice = (unitPrice * inboundNum).toFixed(2); |
| | | } else { |
| | | // åæåææåºåï¼å«ç¨æ»ä»· = taxInclusiveUnitPrice * å
¥åºæ°é |
| | | item.taxInclusiveTotalPrice = ( |
| | | taxInclusiveUnitPrice * inboundNum |
| | | ).toFixed(2); |
| | | } |
| | | |
| | | return item; |
| | | }); |
| | | |
| | | total.value = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | } |
| | | |
| | | }; |
| | | |
| | | // 忢 tab |
| | | const handleTabChange = tabName => { |
| | | page.current = 1; |
| | | // 忢 tab æ¶æ¸
空æç´¢æ¡ä»¶ |
| | | searchForm.value.supplierName = ""; |
| | | searchForm.value.customerName = ""; |
| | | searchForm.value.timeStr = ""; |
| | | searchForm.value.productCategory = ""; |
| | | getList(); |
| | | }; |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = async (type, row) => { |
| | | const openForm = async (type, row, tabType) => { |
| | | const currentTab = tabType || activeTab.value; |
| | | await nextTick(() => { |
| | | formDia.value?.openDialog(type, row) |
| | | }) |
| | | } |
| | | if (currentTab === "production") { |
| | | formDiaProduct.value?.openDialog(type, row); |
| | | } else { |
| | | formDia.value?.openDialog(type, row); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection.filter(item => item.id) |
| | | } |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | }; |
| | | |
| | | const expandedRowKeys = ref([]) |
| | | const expandedRowKeys = ref([]); |
| | | |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']) |
| | | } |
| | | const summarizeMainTable = param => { |
| | | return proxy.summarizeTable(param, [ |
| | | "contractAmount", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm('æ¯å¦ç¡®è®¤å¯¼åºï¼', '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | proxy.download("/stockin/export", {}, 'å
¥åºå°è´¦.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | // æ ¹æ®ä¸åç tab ç±»åè°ç¨ä¸åçå¯¼åºæ¥å£ |
| | | let exportUrl = "/stockin/export"; |
| | | if (activeTab.value === "production") { |
| | | exportUrl = "/stockin/exportOne"; |
| | | } |
| | | proxy.download(exportUrl, {}, "å
¥åºå°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning('è¯·éæ©æ°æ®') |
| | | return |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | const ids = selectedRows.value.map(item => item.id); |
| | | |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter(item => item.createBy !== userStore.nickName) |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®") |
| | | return |
| | | } |
| | | |
| | | const ids = selectedRows.value.map(item => item.id) |
| | | |
| | | ElMessageBox.confirm('éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', 'å é¤', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | delStockIn({ ids }).then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getList() |
| | | }).catch(() => { |
| | | proxy.$modal.msgError("å é¤å¤±è´¥") |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | // æ ¹æ®å½å tab ç±»åéæ©ä¸åçå 餿¥å£åtypeåæ° |
| | | let deleteApi, deleteParams; |
| | | |
| | | if (activeTab.value === "production") { |
| | | // æåå é¤ï¼typeä¼ 2 |
| | | deleteApi = delStockIn; |
| | | deleteParams = {ids, type: 2}; |
| | | } else { |
| | | // åæå é¤ï¼typeä¼ 1 |
| | | deleteApi = delStockIn; |
| | | deleteParams = {ids, type: 1}; |
| | | } |
| | | |
| | | deleteApi(deleteParams) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msgError("å é¤å¤±è´¥"); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | |
| | | |
| | | |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ä¾åºååç§°ï¼</span> |
| | | <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="请è¾å
¥" @change="handleQuery" |
| | | clearable prefix-icon="Search" /> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%" |
| | | :row-class-name="tableRowClassName" |
| | | :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="å
¥åºæ¥æ" prop="createTime" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" width="240" show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" prop="productCategory" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="åºåæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å·²åºåºæ°é" prop="totalInboundNum" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å¾
åºåºæ°é" prop="inboundNum0" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="åºåé¢è¦æ°é" prop="warnNum" width="130" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºäºº" prop="createBy" width="80" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);" :disabled="scope.row.createUser !== userStore.id">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ä¾åºååç§°ï¼</span> |
| | | <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="请è¾å
¥" @change="handleQuery" |
| | | clearable prefix-icon="Search" /> |
| | | <span class="search_title ml10">å
¥åºæ¥æï¼</span> |
| | | <el-date-picker |
| | | v-model="searchForm.timeStr" |
| | | type="date" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <!-- <el-button type="primary" @click="openForm('add')">æ°å¢</el-button> --> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%" |
| | | :row-class-name="tableRowClassName" |
| | | :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="å
¥åºæ¥æ" prop="createTime" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" width="240" show-overflow-tooltip /> |
| | | <el-table-column label="产å大类" prop="productCategory" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" show-overflow-tooltip /> |
| | | <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="åºåæ°é" prop="inboundNum0" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="åºåé¢è¦æ°é" prop="warnNum" width="130" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="å
¥åºäºº" prop="createBy" width="80" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢åºå' : 'ç¼è¾åºå'" width="70%" |
| | | @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | |
| | | import useUserStore from '@/store/modules/user' |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { productTreeList,modelList } from "@/api/basicData/product.js" |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import { |
| | | getStockManagePage, |
| | | delStockManage, |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: '', |
| | | timeStr: '', |
| | | timeStr: '', |
| | | }, |
| | | form: { |
| | | supplierId: null, |
| | |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | const buildQueryParams = () => { |
| | | return { |
| | | ...page, |
| | | supplierName: searchForm.value.supplierName, |
| | | timeStr: searchForm.value.timeStr, |
| | | } |
| | | } |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | const params = buildQueryParams() |
| | | getStockManagePage(params).then(res => { |
| | | getStockManagePage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | // æ°æ®å è½½å®æåæ£æ¥åºå |
| | | // checkStockAndCreatePurchase(); |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | const exportParams = buildQueryParams() |
| | | proxy.download("/stockin/exportCopy", exportParams, 'åºåä¿¡æ¯.xlsx') |
| | | proxy.download("/stockin/exportCopy", {}, 'åºåä¿¡æ¯.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | |
| | | let ids = [] |
| | | if (selectedRows.value.length > 0) { |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter(item => item.createBy !== userStore.nickName); |
| | | const unauthorizedData = selectedRows.value.filter(item => item.createUser !== userStore.id); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | } |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, '0'); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, '0'); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | onMounted(() => { |
| | | getList() |
| | |
| | | <template> |
| | | <el-dialog :title="modalOptions.title" v-model="visible" width="70%"> |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="120px" |
| | | label-position="top" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éè´ååå·ï¼" prop="purchaseLedgerNo"> |
| | | <el-input v-model="form.purchaseLedgerNo" disabled placeholder="å¤ååæ¹éå¤çï¼å
·ä½ååå·è§äº§åå表ï¼" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºååç§°ï¼" prop="supplierName"> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票å·ï¼" prop="invoiceNumber"> |
| | | <el-input |
| | | v-model="form.invoiceNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceAmount"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="请è¾å
¥å票éé¢" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥äººï¼" prop="issUer"> |
| | | <el-input |
| | | v-model="form.issUer" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¼ç¥¨æ¥æï¼" prop="entryDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.entryDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥æ¥æï¼" prop="enterDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.enterDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸ä¼ éä»¶"> |
| | | <FileUpload |
| | | :showTip="false" |
| | | accept="*" |
| | | :autoUpload="true" |
| | | :action="action" |
| | | :headers="{ |
| | | <el-dialog :title="modalOptions.title" v-model="visible" width="70%" draggable> |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="120px" |
| | | label-position="top" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éè´ååå·ï¼" prop="purchaseLedgerNo"> |
| | | <el-input v-model="form.purchaseLedgerNo" disabled placeholder="å¤ååæ¹éå¤çï¼å
·ä½ååå·è§äº§åå表ï¼" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éå®ååå·ï¼" prop="salesContractNo"> |
| | | <el-input |
| | | v-model="form.salesContractNo" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºååç§°ï¼" prop="supplierName"> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :span="12">--> |
| | | <!-- <el-form-item label="项ç®åç§°ï¼" prop="projectName">--> |
| | | <!-- <el-input--> |
| | | <!-- v-model="form.projectName"--> |
| | | <!-- placeholder="èªå¨å¡«å
"--> |
| | | <!-- clearable--> |
| | | <!-- disabled--> |
| | | <!-- />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票å·ï¼" prop="invoiceNumber"> |
| | | <el-input |
| | | v-model="form.invoiceNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceAmount"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="请è¾å
¥å票éé¢" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥äººï¼" prop="issUer"> |
| | | <el-input |
| | | v-model="form.issUer" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¼ç¥¨æ¥æï¼" prop="entryDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.entryDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥æ¥æï¼" prop="enterDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.enterDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸ä¼ éä»¶"> |
| | | <FileUpload |
| | | :showTip="false" |
| | | accept="*" |
| | | :autoUpload="true" |
| | | :action="action" |
| | | :headers="{ |
| | | Authorization: 'Bearer ' + getToken(), |
| | | }" |
| | | :limit="10" |
| | | @success="uploadSuccess" |
| | | @remove="removeFile" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼"> </el-form-item> |
| | | <el-table |
| | | :data="form.productData" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable" |
| | | > |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="æå±åå" prop="purchaseLedgerNo" width="200"> |
| | | <template #default="{ row }"> |
| | | <el-tag type="primary">{{ row.purchaseLedgerNo }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="150" /> |
| | | <el-table-column label="åä½" prop="unit" width="70" /> |
| | | <el-table-column label="æ°é" prop="quantity" width="70" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡å¼ç¥¨æ°" prop="ticketsNum" width="180"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.1" :min="0" style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.ticketsNum" |
| | | @change="invoiceNumBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æ¬æ¬¡å¼ç¥¨éé¢(å
)" |
| | | prop="ticketsAmount" |
| | | width="180" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.ticketsAmount" |
| | | @change="invoiceAmountBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | | :limit="10" |
| | | @success="uploadSuccess" |
| | | @remove="removeFile" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼"> </el-form-item> |
| | | <el-table |
| | | :data="form.productData" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable" |
| | | > |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="æå±åå" prop="purchaseLedgerNo" width="200"> |
| | | <template #default="{ row }"> |
| | | <el-tag type="primary">{{ row.purchaseLedgerNo }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="150" /> |
| | | <el-table-column label="åä½" prop="unit" width="70" /> |
| | | <el-table-column label="æ°é" prop="quantity" width="70" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡å¼ç¥¨æ°" prop="ticketsNum" width="180"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.1" :min="0" style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.ticketsNum" |
| | | @change="invoiceNumBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æ¬æ¬¡å¼ç¥¨éé¢(å
)" |
| | | prop="ticketsAmount" |
| | | width="180" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.ticketsAmount" |
| | | @change="invoiceAmountBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨æ°" |
| | | prop="futureTickets" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="æ¬æ¬¡æ¥ç¥¨éé¢(å
)" |
| | | prop="ticketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨æ°" |
| | | prop="futureTickets" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨éé¢(å
)" |
| | | prop="futureTicketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button type="primary" :loading="modalLoading" @click="submitForm"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import FileUpload from "@/components/Upload/FileUpload.vue"; |
| | | import { |
| | | getPurchaseNoById, |
| | | getInfo, |
| | | addOrUpdateRegistration, |
| | | getPurchaseNoById, |
| | | getInfo, |
| | | addOrUpdateRegistration, |
| | | } from "@/api/procurementManagement/invoiceEntry.js"; |
| | | import { getPurchaseById } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { getToken } from "@/utils/auth"; |
| | |
| | | import dayjs from "dayjs"; |
| | | |
| | | defineOptions({ |
| | | name: "æ¥ç¥¨ç»è®°æ¨¡ææ¡", |
| | | name: "æ¥ç¥¨ç»è®°æ¨¡ææ¡", |
| | | }); |
| | | |
| | | const userStore = useUserStore(); |
| | |
| | | const formRef = ref(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const { form } = useFormData({ |
| | | purchaseLedgerNo: undefined, // éè´ååå· |
| | | salesContractNo: undefined, // éå®ååå· |
| | | supplierName: undefined, // ä¾åºååç§° |
| | | invoiceNumber: undefined, // åç¥¨å· |
| | | invoiceAmount: undefined, // å票éé¢(å
) |
| | | issUerId: userStore.id, // å½å
¥äºº |
| | | issUer: userStore.nickName, // å½å
¥äºº |
| | | entryDate: undefined, // å¼ç¥¨æ¥æ |
| | | salesContractNoId: undefined, // å¼ç¥¨æ¥æ |
| | | enterDate: dayjs().format("YYYY-MM-DD"), |
| | | productData: [], // è¡¨æ ¼ |
| | | tempFileIds: [], // æä»¶ |
| | | purchaseLedgerNo: undefined, // éè´ååå· |
| | | salesContractNo: undefined, // éå®ååå· |
| | | supplierName: undefined, // ä¾åºååç§° |
| | | projectName: undefined, // 项ç®åç§° |
| | | invoiceNumber: undefined, // åç¥¨å· |
| | | invoiceAmount: undefined, // å票éé¢(å
) |
| | | issUerId: userStore.id, // å½å
¥äºº |
| | | issUer: userStore.nickName, // å½å
¥äºº |
| | | entryDate: undefined, // å¼ç¥¨æ¥æ |
| | | salesContractNoId: undefined, // å¼ç¥¨æ¥æ |
| | | enterDate: dayjs().format("YYYY-MM-DD"), |
| | | productData: [], // è¡¨æ ¼ |
| | | tempFileIds: [], // æä»¶ |
| | | }); |
| | | |
| | | const selectedContracts = ref([]); // åå¨éä¸çååæ°æ® |
| | | |
| | | const rules = ref({ |
| | | invoiceNumber: [ |
| | | { required: true, message: "请è¾å
¥å票å·", trigger: "blur" }, |
| | | { type: "string" }, |
| | | ], |
| | | invoiceAmount: [ |
| | | { required: true, message: "请è¾å
¥å票éé¢", trigger: "blur" }, |
| | | ], |
| | | entryDate: [{ required: true, message: "è¯·éæ©å¼ç¥¨æ¥æ", trigger: "change" }], |
| | | enterDate: [{ required: true, message: "è¯·éæ©å½å
¥æ¥æ", trigger: "change" }], |
| | | invoiceNumber: [ |
| | | { required: true, message: "请è¾å
¥å票å·", trigger: "blur" }, |
| | | { type: "string" }, |
| | | ], |
| | | invoiceAmount: [ |
| | | { required: true, message: "请è¾å
¥å票éé¢", trigger: "blur" }, |
| | | ], |
| | | entryDate: [{ required: true, message: "è¯·éæ©å¼ç¥¨æ¥æ", trigger: "change" }], |
| | | enterDate: [{ required: true, message: "è¯·éæ©å½å
¥æ¥æ", trigger: "change" }], |
| | | }); |
| | | |
| | | const { |
| | | id, |
| | | visible, |
| | | loading: modalLoading, |
| | | openModal, |
| | | modalOptions, |
| | | handleConfirm, |
| | | closeModal, |
| | | id, |
| | | visible, |
| | | loading: modalLoading, |
| | | openModal, |
| | | modalOptions, |
| | | handleConfirm, |
| | | closeModal, |
| | | } = useModal({ |
| | | title: "æ¥ç¥¨ç»è®°", |
| | | title: "æ¥ç¥¨ç»è®°", |
| | | }); |
| | | |
| | | const emit = defineEmits(['refreshList']); |
| | | |
| | | const columns = [ |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "æ°é", |
| | | prop: "quantity", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "ç¨ç(%)", |
| | | prop: "taxRate", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "å½å
¥æ¥æ", |
| | | prop: "registerDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å«ç¨åä»·(å
)", |
| | | prop: "taxInclusiveUnitPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return val ? parseFloat(val).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å«ç¨æ»ä»·(å
)", |
| | | prop: "taxInclusiveTotalPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "ä¸å«ç¨æ»ä»·(å
)", |
| | | prop: "taxExclusiveTotalPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "æ¬æ¬¡æ¥ç¥¨æ°", |
| | | prop: "ticketsNum", |
| | | dataType: "slot", |
| | | slot: "ticketsNumRef", |
| | | width: 180, |
| | | align: "center", |
| | | }, |
| | | { |
| | | label: "æ¬æ¬¡æ¥ç¥¨éé¢(å
)", |
| | | prop: "ticketsAmount", |
| | | dataType: "slot", |
| | | slot: "ticketsAmountRef", |
| | | width: 180, |
| | | align: "center", |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨æ°", |
| | | prop: "futureTickets", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "æ°é", |
| | | prop: "quantity", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "ç¨ç(%)", |
| | | prop: "taxRate", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "å½å
¥æ¥æ", |
| | | prop: "registerDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å«ç¨åä»·(å
)", |
| | | prop: "taxInclusiveUnitPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return val ? parseFloat(val).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å«ç¨æ»ä»·(å
)", |
| | | prop: "taxInclusiveTotalPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "ä¸å«ç¨æ»ä»·(å
)", |
| | | prop: "taxExclusiveTotalPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "æ¬æ¬¡æ¥ç¥¨æ°", |
| | | prop: "ticketsNum", |
| | | dataType: "slot", |
| | | slot: "ticketsNumRef", |
| | | width: 180, |
| | | align: "center", |
| | | }, |
| | | { |
| | | label: "æ¬æ¬¡æ¥ç¥¨éé¢(å
)", |
| | | prop: "ticketsAmount", |
| | | dataType: "slot", |
| | | slot: "ticketsAmountRef", |
| | | width: 180, |
| | | align: "center", |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨æ°", |
| | | prop: "futureTickets", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨éé¢(å
)", |
| | | prop: "futureTicketsAmount", |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨éé¢(å
)", |
| | | prop: "futureTicketsAmount", |
| | | width: 200, |
| | | }, |
| | | }, |
| | | ]; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (cellValue == 0) { |
| | |
| | | } |
| | | }; |
| | | const getTableData = async (type, selectedRows) => { |
| | | if (type == "add") { |
| | | // æ£æ¥ææéæ©çå忝å¦å
·æç¸åçä¾åºååç§° |
| | | const firstRow = selectedRows[0]; |
| | | const isSameSupplier = selectedRows.every(row => |
| | | row.supplierName === firstRow.supplierName |
| | | ); |
| | | |
| | | if (!isSameSupplier) { |
| | | proxy.$modal.msgError("è¯·éæ©ç¸åä¾åºååç§°çåå"); |
| | | return; |
| | | } |
| | | |
| | | // å
许ä¸åçéè´ååå·æ¹éå¤çï¼æ 鿣æ¥éå¤ |
| | | |
| | | // æ¸
ç©ºè¡¨åæ°æ® |
| | | Object.keys(form).forEach(key => { |
| | | if (key !== 'productData') { |
| | | form[key] = undefined; |
| | | } |
| | | }); |
| | | form.productData = []; |
| | | |
| | | // å è½½ææéä¸ååçäº§åæ°æ® |
| | | const promises = selectedRows.map(row => |
| | | getInfo({ id: row.id }) |
| | | ); |
| | | |
| | | Promise.all(promises).then(results => { |
| | | // åå¹¶ææååçäº§åæ°æ®ï¼å¹¶ä¸ºæ¯ä¸ªäº§åæ·»å 对åºçååä¿¡æ¯ |
| | | const allProductData = []; |
| | | results.forEach((result, index) => { |
| | | const contract = selectedRows[index]; |
| | | const contractId = contract.id; |
| | | if (result.data && result.data.productData) { |
| | | result.data.productData.forEach(item => { |
| | | allProductData.push({ |
| | | ...item, |
| | | id: contractId, // æç¡®è®¾ç½®ååID |
| | | purchaseLedgerNo: contract.purchaseContractNumber, // æ·»å éè´ååå· |
| | | supplierName: contract.supplierName, // æ·»å ä¾åºååç§° |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // è®¾ç½®è¡¨åæ°æ®ï¼ä½¿ç¨ç¬¬ä¸ä¸ªååçåºæ¬ä¿¡æ¯ï¼éè´ååå·çç©ºï¼ |
| | | form.purchaseLedgerNo = ""; // éè´ååå·ç空ï¼å 为ä¼å¨äº§åè¡¨æ ¼ä¸å嫿¾ç¤º |
| | | form.invoiceAmount = 0; |
| | | form.invoiceNumber = ""; |
| | | form.entryDate = dayjs().format("YYYY-MM-DD"); |
| | | form.enterDate = dayjs().format("YYYY-MM-DD"); |
| | | form.salesContractNo = results[0].data.salesContractNo; |
| | | form.supplierName = results[0].data.supplierName; |
| | | // ä¿çå½å
¥äººä¿¡æ¯ |
| | | form.issUerId = userStore.id; |
| | | form.issUer = userStore.nickName; |
| | | |
| | | form.productData = allProductData; |
| | | |
| | | // åå¨éä¸çååæ°æ® |
| | | selectedContracts.value = selectedRows; |
| | | }); |
| | | } else if (type == "edit") { |
| | | const id = Array.isArray(selectedRows) ? selectedRows[0].id : selectedRows; |
| | | const data = await getPurchaseById({ id, type: 2 }); |
| | | form.purchaseLedgerNo = data.purchaseContractNumber; |
| | | form.invoiceAmount = data.invoiceAmount; |
| | | form.invoiceNumber = data.invoiceNumber; |
| | | form.salesContractNo = data.salesContractNo; |
| | | form.projectName = data.projectName; |
| | | form.supplierName = data.supplierName; |
| | | form.entryDate = data.entryDate; |
| | | form.productData = data.productData; |
| | | } |
| | | if (type == "add") { |
| | | // æ£æ¥ææéæ©çå忝å¦å
·æç¸åçä¾åºååç§° |
| | | const firstRow = selectedRows[0]; |
| | | const isSameSupplier = selectedRows.every(row => |
| | | row.supplierName === firstRow.supplierName |
| | | ); |
| | | |
| | | if (!isSameSupplier) { |
| | | proxy.$modal.msgError("è¯·éæ©ç¸åä¾åºååç§°çåå"); |
| | | return; |
| | | } |
| | | |
| | | // å
许ä¸åçéè´ååå·æ¹éå¤çï¼æ 鿣æ¥éå¤ |
| | | |
| | | // æ¸
ç©ºè¡¨åæ°æ® |
| | | Object.keys(form).forEach(key => { |
| | | if (key !== 'productData') { |
| | | form[key] = undefined; |
| | | } |
| | | }); |
| | | form.productData = []; |
| | | |
| | | // å è½½ææéä¸ååçäº§åæ°æ® |
| | | const promises = selectedRows.map(row => |
| | | getInfo({ id: row.id }) |
| | | ); |
| | | |
| | | Promise.all(promises).then(results => { |
| | | // åå¹¶ææååçäº§åæ°æ®ï¼å¹¶ä¸ºæ¯ä¸ªäº§åæ·»å 对åºçååä¿¡æ¯ |
| | | const allProductData = []; |
| | | results.forEach((result, index) => { |
| | | const contract = selectedRows[index]; |
| | | const contractId = contract.id; |
| | | if (result.data && result.data.productData) { |
| | | result.data.productData.forEach(item => { |
| | | allProductData.push({ |
| | | ...item, |
| | | id: contractId, // æç¡®è®¾ç½®ååID |
| | | purchaseLedgerNo: contract.purchaseContractNumber, // æ·»å éè´ååå· |
| | | supplierName: contract.supplierName, // æ·»å ä¾åºååç§° |
| | | projectName: contract.projectName // æ·»å 项ç®åç§° |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // è®¾ç½®è¡¨åæ°æ®ï¼ä½¿ç¨ç¬¬ä¸ä¸ªååçåºæ¬ä¿¡æ¯ï¼éè´ååå·çç©ºï¼ |
| | | form.purchaseLedgerNo = ""; // éè´ååå·ç空ï¼å 为ä¼å¨äº§åè¡¨æ ¼ä¸å嫿¾ç¤º |
| | | form.invoiceNumber = ""; |
| | | form.entryDate = dayjs().format("YYYY-MM-DD"); |
| | | form.enterDate = dayjs().format("YYYY-MM-DD"); |
| | | form.salesContractNo = results[0].data.salesContractNo; |
| | | form.projectName = results[0].data.projectName; |
| | | form.supplierName = results[0].data.supplierName; |
| | | // ä¿çå½å
¥äººä¿¡æ¯ |
| | | form.issUerId = userStore.id; |
| | | form.issUer = userStore.nickName; |
| | | |
| | | // è®¾ç½®äº§åæ°æ®ï¼å¹¶åå§åå¼ç¥¨æ°éåéé¢ |
| | | allProductData.forEach(item => { |
| | | // æ¬æ¬¡å¼ç¥¨æ°é»è®¤ä¸ºæ»æ°é |
| | | item.ticketsNum = Number(item.quantity || 0); |
| | | // æ¬æ¬¡å¼ç¥¨éé¢é»è®¤ä¸ºå«ç¨æ»ä»· |
| | | item.ticketsAmount = Number(item.taxInclusiveTotalPrice || 0); |
| | | // ä¿ååå§æªæ¥ç¥¨æ°åéé¢ï¼ç¨äºè®¡ç®ï¼ |
| | | item.tempFutureTickets = Number(item.quantity || 0); |
| | | item.tempFutureTicketsAmount = Number(item.taxInclusiveTotalPrice || 0); |
| | | // æªæ¥ç¥¨æ°åéé¢åå§ä¸º0ï¼å 为å
¨é¨å¼ç¥¨ï¼ |
| | | item.futureTickets = 0; |
| | | item.futureTicketsAmount = 0; |
| | | }); |
| | | |
| | | form.productData = allProductData; |
| | | |
| | | // 计ç®å票éé¢ï¼ææäº§åçå«ç¨æ»ä»·ä¹å |
| | | const totalAmount = allProductData.reduce((sum, item) => { |
| | | return sum + (Number(item.taxInclusiveTotalPrice) || 0); |
| | | }, 0); |
| | | form.invoiceAmount = totalAmount.toFixed(2); |
| | | |
| | | // åå¨éä¸çååæ°æ® |
| | | selectedContracts.value = selectedRows; |
| | | }); |
| | | } else if (type == "edit") { |
| | | const id = Array.isArray(selectedRows) ? selectedRows[0].id : selectedRows; |
| | | const data = await getPurchaseById({ id, type: 2 }); |
| | | form.purchaseLedgerNo = data.purchaseContractNumber; |
| | | form.invoiceAmount = data.invoiceAmount; |
| | | form.invoiceNumber = data.invoiceNumber; |
| | | form.salesContractNo = data.salesContractNo; |
| | | form.projectName = data.projectName; |
| | | form.supplierName = data.supplierName; |
| | | form.entryDate = data.entryDate; |
| | | form.productData = data.productData; |
| | | } |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | |
| | | }; |
| | | //æ¬æ¬¡æ¥ç¥¨æ°å¤±ç¦æä½ |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.ticketsNum || row.ticketsNum === "") { |
| | | row.ticketsNum = 0; |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.tempFutureTickets)) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°"); |
| | | row.ticketsNum = 0; |
| | | return; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨éé¢ |
| | | row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2) |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) |
| | | calculateinvoiceAmount(); |
| | | if (!row.ticketsNum || row.ticketsNum === "") { |
| | | row.ticketsNum = 0; |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.tempFutureTickets)) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°"); |
| | | row.ticketsNum = 0; |
| | | return; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨éé¢ |
| | | row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2) |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | |
| | | // æ¬æ¬¡æ¥ç¥¨éé¢å¤±ç¦æä½ |
| | | const invoiceAmountBlur = (row) => { |
| | | if (!row.ticketsAmount) { |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¯å¦è¶
è¿æ¥ç¥¨æ»éé¢ |
| | | if (row.ticketsAmount > row.tempFutureTicketsAmount) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡æ¥ç¥¨éé¢ä¸å¾å¤§äºæªæ¥ç¥¨éé¢"); |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨æ° |
| | | row.ticketsNum = Number( |
| | | (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | ); |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) |
| | | calculateinvoiceAmount(); |
| | | if (!row.ticketsAmount) { |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¯å¦è¶
è¿æ¥ç¥¨æ»éé¢ |
| | | if (row.ticketsAmount > row.tempFutureTicketsAmount) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡æ¥ç¥¨éé¢ä¸å¾å¤§äºæªæ¥ç¥¨éé¢"); |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨æ° |
| | | row.ticketsNum = Number( |
| | | (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | ); |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | |
| | | const calculateinvoiceAmount = () => { |
| | | let invoiceAmountTotal = 0; |
| | | form.productData.forEach((item) => { |
| | | if (item.ticketsAmount) { |
| | | invoiceAmountTotal += Number(item.ticketsAmount); |
| | | } |
| | | }); |
| | | form.invoiceAmount = invoiceAmountTotal.toFixed(2); |
| | | let invoiceAmountTotal = 0; |
| | | form.productData.forEach((item) => { |
| | | if (item.ticketsAmount) { |
| | | invoiceAmountTotal += Number(item.ticketsAmount); |
| | | } |
| | | }); |
| | | form.invoiceAmount = invoiceAmountTotal.toFixed(2); |
| | | }; |
| | | |
| | | const open = async (type, selectedRows) => { |
| | | visible.value = true; |
| | | |
| | | // å¦ææ¯æ¹éæä½ï¼è®¾ç½®æ é¢ |
| | | if (Array.isArray(selectedRows) && selectedRows.length > 1) { |
| | | modalOptions.title = `æ¹éæ°å¢ (${selectedRows.length}æ¡)`; |
| | | } else { |
| | | modalOptions.title = type == "add" ? "æ°å¢" : "ç¼è¾"; |
| | | } |
| | | |
| | | // 妿æ¯å个æä½ï¼è·åid |
| | | if (!Array.isArray(selectedRows) || selectedRows.length === 1) { |
| | | const idValue = Array.isArray(selectedRows) ? selectedRows[0].id : selectedRows; |
| | | id.value = idValue; |
| | | } |
| | | |
| | | await getTableData(type, selectedRows); |
| | | visible.value = true; |
| | | |
| | | // å¦ææ¯æ¹éæä½ï¼è®¾ç½®æ é¢ |
| | | if (Array.isArray(selectedRows) && selectedRows.length > 1) { |
| | | modalOptions.title = `æ¹éæ°å¢ (${selectedRows.length}æ¡)`; |
| | | } else { |
| | | modalOptions.title = type === "add" ? "æ°å¢" : "ç¼è¾"; |
| | | } |
| | | |
| | | // 妿æ¯å个æä½ï¼è·åid |
| | | if (!Array.isArray(selectedRows) || selectedRows.length === 1) { |
| | | const idValue = Array.isArray(selectedRows) ? selectedRows[0].id : selectedRows; |
| | | id.value = idValue; |
| | | } |
| | | |
| | | await getTableData(type, selectedRows); |
| | | }; |
| | | |
| | | const uploadSuccess = (response) => { |
| | | form.tempFileIds.push(response.data.tempId); |
| | | console.log(form); |
| | | form.tempFileIds.push(response.data.tempId); |
| | | console.log(form); |
| | | }; |
| | | |
| | | const removeFile = (file) => { |
| | | const { tempId } = file.response.data; |
| | | form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId); |
| | | const { tempId } = file.response.data; |
| | | form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId); |
| | | }; |
| | | |
| | | const closeAndRefresh = () => { |
| | | closeModal(); |
| | | emit('refreshList'); |
| | | closeModal(); |
| | | emit('refreshList'); |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | // ç»ä¸å°ææååçæ°æ®æ¾å¨ä¸ä¸ªæ°ç»éï¼åä¸ªåæ¹éé½ä½¿ç¨æ°ç»æ ¼å¼ |
| | | const submitData = selectedContracts.value.map(contract => { |
| | | // çéåºå±äºå½åååçäº§åæ°æ® |
| | | const contractProductData = form.productData.filter(item => |
| | | item.id === contract.id |
| | | ); |
| | | |
| | | // 为æ¯ä¸ªéè´ååå建ç¬ç«ç对象 |
| | | return { |
| | | // åºç¡è¡¨åæ°æ® |
| | | invoiceNumber: form.invoiceNumber, |
| | | invoiceAmount: form.invoiceAmount, |
| | | entryDate: form.entryDate, |
| | | enterDate: form.enterDate, |
| | | issUerId: form.issUerId, // å½å
¥äººid |
| | | issUer: form.issUer, // å½å
¥äºº |
| | | tempFileIds: form.tempFileIds, |
| | | |
| | | // ååå®é
ä¿¡æ¯ |
| | | purchaseLedgerId: contract.id, // 使ç¨idä½ä¸ºå段åï¼å¼ä¸ºpurchaseLedgerId |
| | | purchaseContractNumber: contract.purchaseContractNumber, // 使ç¨å®é
çéè´ååå· |
| | | salesContractNo: contract.salesContractNo, // 使ç¨å®é
çéå®ååå· |
| | | supplierName: contract.supplierName, // 使ç¨å®é
çä¾åºååç§° |
| | | |
| | | // äº§åæ°æ® |
| | | productData: proxy.HaveJson(contractProductData), |
| | | |
| | | // æ¹éæ è¯ |
| | | isBatch: selectedContracts.value.length > 1, |
| | | type: 4 |
| | | }; |
| | | }); |
| | | |
| | | // ç»ä¸è°ç¨æ¥å£ï¼ä¼ éæ°ç»æ ¼å¼çæ°æ® |
| | | modalLoading.value = true; |
| | | addOrUpdateRegistration(submitData).then((res) => { |
| | | modalLoading.value = false; |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess(selectedContracts.value.length > 1 ? "æ¹éç»è®°æå" : "ç»è®°æå"); |
| | | closeAndRefresh(); |
| | | } |
| | | }).catch(() => { |
| | | modalLoading.value = false; |
| | | proxy.$modal.msgError(selectedContracts.value.length > 1 ? "æ¹éç»è®°å¤±è´¥" : "ç»è®°å¤±è´¥"); |
| | | }); |
| | | } |
| | | }); |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | // å¦ææ¯æ¹éæä½ï¼å°ææååçæ°æ®æ¾å¨ä¸ä¸ªæ°ç»éï¼åªè°ç¨ä¸æ¬¡æ¥å£ |
| | | if (selectedContracts.value.length > 1) { |
| | | // å建å
嫿æååæ°æ®çæ°ç» |
| | | const batchData = selectedContracts.value.map(contract => { |
| | | // çéåºå±äºå½åååçäº§åæ°æ® |
| | | const contractProductData = form.productData.filter(item => |
| | | item.id === contract.id |
| | | ); |
| | | |
| | | // 为æ¯ä¸ªéè´ååå建ç¬ç«ç对象 |
| | | return { |
| | | // åºç¡è¡¨åæ°æ® |
| | | invoiceNumber: form.invoiceNumber, |
| | | invoiceAmount: form.invoiceAmount, |
| | | entryDate: form.entryDate, |
| | | enterDate: form.enterDate, |
| | | issUerId: form.issUerId, // å½å
¥äººid |
| | | issUer: form.issUer, // å½å
¥äºº |
| | | tempFileIds: form.tempFileIds, |
| | | |
| | | // ååå®é
ä¿¡æ¯ |
| | | purchaseLedgerId: contract.id, // 使ç¨idä½ä¸ºå段åï¼å¼ä¸ºpurchaseLedgerId |
| | | purchaseContractNumber: contract.purchaseContractNumber, // 使ç¨å®é
çéè´ååå· |
| | | salesContractNo: contract.salesContractNo, // 使ç¨å®é
çéå®ååå· |
| | | supplierName: contract.supplierName, // 使ç¨å®é
çä¾åºååç§° |
| | | projectName: contract.projectName, // 使ç¨å®é
ç项ç®åç§° |
| | | |
| | | // äº§åæ°æ® |
| | | productData: proxy.HaveJson(contractProductData), |
| | | |
| | | // æ¹éæ è¯ |
| | | isBatch: true, |
| | | type: 4 |
| | | }; |
| | | }); |
| | | |
| | | // åªè°ç¨ä¸æ¬¡æ¥å£ï¼ä¼ éå
嫿æååæ°æ®çæ°ç» |
| | | modalLoading.value = true; |
| | | addOrUpdateRegistration(batchData).then((res) => { |
| | | modalLoading.value = false; |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("æ¹éç»è®°æå"); |
| | | closeAndRefresh(); |
| | | } |
| | | }).catch(() => { |
| | | modalLoading.value = false; |
| | | proxy.$modal.msgError("æ¹éç»è®°å¤±è´¥"); |
| | | }); |
| | | } else { |
| | | // å个ååæäº¤é»è¾ - 以æ°ç»æ ¼å¼ä¼ é |
| | | const singleContract = selectedContracts.value[0]; |
| | | const singleFormArray = [{ |
| | | // åºç¡è¡¨åæ°æ® |
| | | invoiceNumber: form.invoiceNumber, |
| | | invoiceAmount: form.invoiceAmount, |
| | | entryDate: form.entryDate, |
| | | enterDate: form.enterDate, |
| | | issUerId: form.issUerId, // å½å
¥äººid |
| | | issUer: form.issUer, // å½å
¥äºº |
| | | tempFileIds: form.tempFileIds, |
| | | |
| | | // ååå®é
ä¿¡æ¯ |
| | | purchaseLedgerId: singleContract.id, // 使ç¨idä½ä¸ºå段åï¼å¼ä¸ºpurchaseLedgerId |
| | | purchaseContractNumber: singleContract.purchaseContractNumber, // 使ç¨å®é
çéè´ååå· |
| | | salesContractNo: singleContract.salesContractNo, // 使ç¨å®é
çéå®ååå· |
| | | supplierName: singleContract.supplierName, // 使ç¨å®é
çä¾åºååç§° |
| | | projectName: singleContract.projectName, // 使ç¨å®é
ç项ç®åç§° |
| | | |
| | | // äº§åæ°æ® |
| | | productData: proxy.HaveJson(form.productData), |
| | | |
| | | // æ¹éæ è¯ |
| | | isBatch: false, |
| | | type: 4 |
| | | }]; |
| | | |
| | | modalLoading.value = true; |
| | | addOrUpdateRegistration(singleFormArray).then((res) => { |
| | | modalLoading.value = false; |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("ç»è®°æå"); |
| | | closeAndRefresh(); |
| | | } |
| | | }).catch(() => { |
| | | modalLoading.value = false; |
| | | proxy.$modal.msgError("ç»è®°å¤±è´¥"); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | open, |
| | | closeAndRefresh, |
| | | open, |
| | | closeAndRefresh, |
| | | }); |
| | | </script> |
| | | |
| | |
| | | <div> |
| | | <el-button @click="handleExport" style="margin-right: 10px">导åº</el-button> |
| | | <el-button type="primary" @click="handleAdd('add')"> |
| | | æ°å¢ç»è®° |
| | | æ¥ç¥¨ç»è®° |
| | | </el-button> |
| | | <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button>--> |
| | | </div> |
| | |
| | | resetFilters, |
| | | onCurrentChange, |
| | | } = usePaginationApi( |
| | | gePurchaseListPage, |
| | | gePurchaseListPage, |
| | | { |
| | | purchaseContractNumber: undefined, |
| | | isInvoice:1, |
| | | }, |
| | | [ |
| | | { |
| | |
| | | }; |
| | | |
| | | const handleAdd = (type) => { |
| | | if (selectedRows.value.length < 1) { |
| | | proxy.$modal.msgWarning("请è³å°éä¸ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | modalRef.value.open(type, selectedRows.value); |
| | | if (selectedRows.value.length < 1) { |
| | | proxy.$modal.msgWarning("请è³å°éä¸ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | modalRef.value.open(type, selectedRows.value); |
| | | }; |
| | | |
| | | const handleEdit = (type, id) => { |
| | |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item style="float: right; margin-right: unset"> |
| | | <el-button @click="handleExport" style="margin-right: 10px">导åº</el-button> |
| | | <el-button type="primary" @click="openForm()"> |
| | | <el-button type="primary" @click="openForm('add')"> |
| | | æ°å¢ä»æ¬¾ |
| | | </el-button> |
| | | <el-button @click="handleExport" style="margin-right: 10px">导åº</el-button> |
| | | <!-- <el-button type="danger" plain @click="handleDelete">--> |
| | | <!-- å é¤--> |
| | | <!-- </el-button>--> |
| | |
| | | size="small" |
| | | @click="changeEditType(scope.row)" |
| | | v-if="!scope.row.editType" |
| | | :disabled="scope.row.registrant !== userStore.nickName" |
| | | >ç¼è¾</el-button |
| | | > |
| | | <el-button |
| | |
| | | size="small" |
| | | @click="saveReceiptPayment(scope.row)" |
| | | v-if="scope.row.editType" |
| | | :disabled="scope.row.registrant !== userStore.nickName" |
| | | >ä¿å</el-button |
| | | > |
| | | <el-button |
| | |
| | | type="primary" |
| | | size="small" |
| | | @click="handleDelete(scope.row)" |
| | | :disabled="scope.row.registrant !== userStore.nickName" |
| | | >å é¤</el-button |
| | | > |
| | | </template> |
| | |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | <FormDialog |
| | | v-model="dialogFormVisible" |
| | | title="æ°å¢ä»æ¬¾ç»è®°" |
| | | width="80%" |
| | | title="æ°å¢ä»æ¬¾é¡µé¢" |
| | | :width="'90%'" |
| | | @close="closeDia" |
| | | @confirm="submitForm" |
| | | @cancel="closeDia" |
| | | > |
| | | <el-table :data="dialogTableData" border style="width: 100%" max-height="500px"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="éè´ååå·" prop="purchaseContractNumber" show-overflow-tooltip width="200" /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" show-overflow-tooltip width="200" /> |
| | | <el-table-column label="å票å·" prop="invoiceNumber" show-overflow-tooltip width="180" /> |
| | | <el-table-column label="å票éé¢(å
)" prop="invoiceAmount" width="150"> |
| | | <template #default="{ row }"> |
| | | {{ row.invoiceAmount ? parseFloat(row.invoiceAmount).toFixed(2) : "0.00" }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å¾
仿¬¾éé¢(å
)" prop="unPaymentAmountTotal" width="150"> |
| | | <template #default="{ row }"> |
| | | <el-table |
| | | v-if="forms.length" |
| | | :data="forms" |
| | | border |
| | | style="width: 100%" |
| | | size="small" |
| | | > |
| | | <el-table-column type="index" label="åºå·" width="50" align="center"/> |
| | | <el-table-column label="éè´ååå·" prop="purchaseContractNumber" show-overflow-tooltip /> |
| | | <el-table-column label="éå®ååå·" prop="salesContractNo" show-overflow-tooltip /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" show-overflow-tooltip /> |
| | | <el-table-column |
| | | label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip |
| | | width="100" |
| | | /> |
| | | <el-table-column |
| | | label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip |
| | | width="150" |
| | | /> |
| | | <el-table-column |
| | | label="å¾
仿¬¾éé¢(å
)" |
| | | prop="pendingTicketsTotal" |
| | | show-overflow-tooltip |
| | | width="170" |
| | | > |
| | | <template #default="{ row, column }"> |
| | | <el-text type="danger"> |
| | | {{ row.unPaymentAmountTotal ? parseFloat(row.unPaymentAmountTotal).toFixed(2) : "0.00" }} |
| | | {{ formattedNumber(row, column, row.pendingTicketsTotal) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ¬æ¬¡ä»æ¬¾éé¢(å
)" width="180"> |
| | | <template #default="scope"> |
| | | <template #default="{ row }"> |
| | | <el-input-number |
| | | v-model="row.currentPaymentAmount" |
| | | :step="0.01" |
| | | :min="0" |
| | | :max="Number(scope.row.unPaymentAmountTotal || 0)" |
| | | style="width: 100%" |
| | | :max="Number(row.pendingTicketsTotal || 0)" |
| | | :precision="2" |
| | | v-model="scope.row.currentPaymentAmount" |
| | | style="width: 100%" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="仿¬¾æ¹å¼" width="150"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.paymentMethod" placeholder="è¯·éæ©" clearable style="width: 100%"> |
| | | <el-table-column label="仿¬¾æ¹å¼" width="160"> |
| | | <template #default="{ row }"> |
| | | <el-select v-model="row.paymentMethod" placeholder="è¯·éæ©" clearable> |
| | | <el-option label="çµæ±" value="çµæ±" /> |
| | | <el-option label="æ¿å
" value="æ¿å
" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="仿¬¾æ¥æ" width="180"> |
| | | <template #default="scope"> |
| | | <el-table-column label="仿¬¾æ¥æ" width="170"> |
| | | <template #default="{ row }"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="scope.row.paymentDate" |
| | | v-model="row.paymentDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç»è®°äºº" width="120"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.registrant" placeholder="èªå¨å¡«å
" disabled /> |
| | | <el-table-column label="ç»è®°äºº" width="140"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.registrant" disabled /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç»è®°æ¥æ" width="170"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.registrationtDate" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <div v-else class="empty-tip">è¯·éæ©éè¦ä»æ¬¾çè®°å½</div> |
| | | </FormDialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue'; |
| | | import { ref, reactive, toRefs, getCurrentInstance, nextTick, onMounted } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { |
| | | byPurchaseId, |
| | | paymentRegistrationAdd, |
| | | paymentRegistrationDel, |
| | | paymentRegistrationEdit, |
| | | getTicketNo, |
| | | } from "@/api/procurementManagement/paymentEntry.js"; |
| | | import { |
| | | delPaymentRegistration, |
| | |
| | | updatePaymentRegistration |
| | | } from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableColumn = ref([ |
| | |
| | | { |
| | | label: "éè´ååå·", |
| | | prop: "purchaseContractNumber", |
| | | width:160 |
| | | }, |
| | | { |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | width:160 |
| | | }, |
| | | { |
| | | label: "ä¾åºååç§°", |
| | |
| | | { |
| | | label: "仿¬¾ç¶æ", |
| | | prop: "statusName", |
| | | width:110, |
| | | dataType: "tag", |
| | | formatType: (params) => { |
| | | if (params == 'æªå®æä»æ¬¾') { |
| | |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: "å票å·", |
| | | prop: "invoiceNumber", |
| | | width:200 |
| | | }, |
| | | { |
| | | label: "å票éé¢(å
)", |
| | | prop: "invoiceAmount", |
| | | formatData: (params) => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | showOverflowTooltip: true, |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | showOverflowTooltip: true, |
| | | }, |
| | | { |
| | | label: "已仿¬¾éé¢(å
)", |
| | | prop: "paymentAmountTotal", |
| | | prop: "ticketsTotal", |
| | | width: 120, |
| | | formatData: (params) => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å¾
仿¬¾éé¢(å
)", |
| | | prop: "unPaymentAmountTotal", |
| | | prop: "pendingTicketsTotal", |
| | | width: 120, |
| | | formatData: (params) => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å½å
¥äºº", |
| | | prop: "issUer", |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const childrenLoading = ref(false); |
| | | const forms = ref([]); |
| | | const userStore = useUserStore(); |
| | | const page = reactive({ |
| | | current: 1, |
| | |
| | | total: 0, |
| | | }); |
| | | |
| | | // å¼¹æ¡æ°æ® |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const dialogTableData = ref([]); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierNameOrContractNo: "", |
| | |
| | | purchaseLedgerId: "", |
| | | salesContractNo: "", |
| | | supplierName: "", |
| | | invoiceNumber: "", |
| | | invoiceAmount: "", |
| | | taxRate: "", |
| | | currentPaymentAmount: "", |
| | | paymentMethod: "", |
| | |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | paymentMethod: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | invoiceNumber: [ |
| | | { required: true, message: "è¯·éæ©éè´ååå·", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | |
| | | if (!normalized) return 'info'; |
| | | return normalized === 'æªå®æä»æ¬¾' ? 'danger' : 'success'; |
| | | }; |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | const val = Number(cellValue ?? 0); |
| | | return Number.isFinite(val) ? val.toFixed(2) : "0.00"; |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeMainTable1 = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["invoiceAmount", "paymentAmountTotal", "unPaymentAmountTotal"], |
| | | ["ticketsTotal", "pendingTicketsTotal"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | |
| | | tableLoading.value = true; |
| | | invoiceListPage({ ...searchForm, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | page.total = res.total; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | if (expandedRowKeys.value.length > 0) { |
| | | const arr = [] |
| | | const index = tableData.value.findIndex(item => item.id === expandedRowKeys.value[0]); |
| | |
| | | currentPaymentAmount: row.currentPaymentAmount, |
| | | paymentMethod: row.paymentMethod, |
| | | }; |
| | | // å表ç¼è¾ä¿åææ°ç»æäº¤ï¼ä¸æ¹éç»è®°ä¿æä¸è´ï¼ |
| | | updatePaymentRegistration([updateData]).then(() => { |
| | | updatePaymentRegistration(updateData).then((res) => { |
| | | row.editType = !row.editType; |
| | | getList(); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = () => { |
| | | // è³å°éæ©ä¸æ¡æ°æ® |
| | | const openForm = (type, row) => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal?.msgError ? proxy.$modal.msgError("è¯·éæ©æ°æ®") : proxy.$message.error("è¯·éæ©æ°æ®"); |
| | | proxy.$modal.msgError("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | |
| | | // æ ¡éªæ¯å¦ä¸ºç¸åä¾åºååç§° |
| | | const firstSupplierName = selectedRows.value[0].supplierName; |
| | | const isSameSupplier = selectedRows.value.every( |
| | | (item) => item.supplierName === firstSupplierName |
| | | ); |
| | | if (!isSameSupplier) { |
| | | proxy.$modal?.msgError |
| | | ? proxy.$modal.msgError("è¯·éæ©ç¸åä¾åºååç§°çæ°æ®è¿è¡ä»æ¬¾ç»è®°") |
| | | : proxy.$message.error("è¯·éæ©ç¸åä¾åºååç§°çæ°æ®è¿è¡ä»æ¬¾ç»è®°"); |
| | | return; |
| | | } |
| | | |
| | | // è¿æ»¤åºæå¾
仿¬¾éé¢çè®°å½ |
| | | const validRows = selectedRows.value.filter( |
| | | (item) => Number(item.unPaymentAmountTotal) > 0 |
| | | ); |
| | | const validRows = selectedRows.value.filter((item) => Number(item.pendingTicketsTotal || 0) !== 0); |
| | | if (validRows.length === 0) { |
| | | proxy.$modal?.msgWarning |
| | | ? proxy.$modal.msgWarning("æéæ°æ®åæ éå仿¬¾") |
| | | : proxy.$message.warning("æéæ°æ®åæ éå仿¬¾"); |
| | | proxy.$modal.msgWarning("æéè®°å½åæ é仿¬¾"); |
| | | return; |
| | | } |
| | | |
| | | const today = getCurrentDate(); |
| | | dialogTableData.value = validRows.map((row) => { |
| | | return { |
| | | ...row, |
| | | // å端å
³èâæ¥ç¥¨å°è´¦/ç»è®°åâçåæ®µï¼åé»è¾ï¼ticketRegistrationId = row.idï¼ |
| | | ticketRegistrationId: row.id, |
| | | id: null, |
| | | currentPaymentAmount: row.unPaymentAmountTotal || "", |
| | | paymentMethod: "", |
| | | paymentDate: today, |
| | | registrationtDate: today, |
| | | registrant: userStore.nickName || userStore.name, |
| | | }; |
| | | }); |
| | | |
| | | forms.value = validRows.map((row) => ({ |
| | | purchaseContractNumber: row.purchaseContractNumber || "", |
| | | salesContractNo: row.salesContractNo || "", |
| | | supplierName: row.supplierName || "", |
| | | supplierId: row.supplierId, |
| | | productCategory: row.productCategory || "", |
| | | specificationModel: row.specificationModel || "", |
| | | pendingTicketsTotal: Number(row.pendingTicketsTotal || 0), |
| | | currentPaymentAmount: "", |
| | | paymentMethod: "", |
| | | paymentDate: "", |
| | | registrant: userStore.nickName, |
| | | registrationtDate: getCurrentDate(), |
| | | ticketRegistrationId: row.id, |
| | | purchaseLedgerId: row.salesLedgerId, |
| | | salesLedgerProductId: row.id, |
| | | })); |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | // æ ¡éªè¡¨æ ¼æ°æ® |
| | | const invalidRows = dialogTableData.value.filter((row) => { |
| | | return ( |
| | | !row.currentPaymentAmount || |
| | | Number(row.currentPaymentAmount) <= 0 || |
| | | !row.paymentMethod || |
| | | !row.paymentDate |
| | | ); |
| | | }); |
| | | if (invalidRows.length > 0) { |
| | | proxy.$modal?.msgError |
| | | ? proxy.$modal.msgError("请å®åææå¿
填项ï¼ä»æ¬¾éé¢ã仿¬¾æ¹å¼ã仿¬¾æ¥æ") |
| | | : proxy.$message.error("请å®åææå¿
填项ï¼ä»æ¬¾éé¢ã仿¬¾æ¹å¼ã仿¬¾æ¥æ"); |
| | | if (forms.value.length === 0) { |
| | | proxy.$modal.msgError("è¯·éæ©ä»æ¬¾è®°å½"); |
| | | return; |
| | | } |
| | | |
| | | // æ ¡éªä»æ¬¾éé¢ä¸è½è¶
è¿å¾
仿¬¾éé¢ |
| | | const exceedRows = dialogTableData.value.filter((row) => { |
| | | return Number(row.currentPaymentAmount) > Number(row.unPaymentAmountTotal); |
| | | }); |
| | | if (exceedRows.length > 0) { |
| | | proxy.$modal?.msgError |
| | | ? proxy.$modal.msgError("仿¬¾éé¢ä¸è½è¶
è¿å¾
仿¬¾éé¢") |
| | | : proxy.$message.error("仿¬¾éé¢ä¸è½è¶
è¿å¾
仿¬¾éé¢"); |
| | | return; |
| | | for (let i = 0; i < forms.value.length; i++) { |
| | | const item = forms.value[i]; |
| | | const pendingAmount = Number(item.pendingTicketsTotal || 0); |
| | | const currentAmount = Number(item.currentPaymentAmount); |
| | | if (!item.currentPaymentAmount && item.currentPaymentAmount !== 0) { |
| | | proxy.$modal.msgError(`第 ${i + 1} æ¡ï¼è¯·å¡«å仿¬¾éé¢`); |
| | | return; |
| | | } |
| | | if (currentAmount > pendingAmount) { |
| | | proxy.$modal.msgError( |
| | | `第 ${i + 1} æ¡ï¼ä»æ¬¾éé¢ä¸è½è¶
è¿å¾
仿¬¾éé¢ï¼å¾
仿¬¾ï¼${pendingAmount.toFixed( |
| | | 2 |
| | | )}ï¼` |
| | | ); |
| | | return; |
| | | } |
| | | if (!item.paymentMethod) { |
| | | proxy.$modal.msgError(`第 ${i + 1} æ¡ï¼è¯·éæ©ä»æ¬¾æ¹å¼`); |
| | | return; |
| | | } |
| | | if (!item.paymentDate) { |
| | | proxy.$modal.msgError(`第 ${i + 1} æ¡ï¼è¯·éæ©ä»æ¬¾æ¥æ`); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // ç»è£
æ°ç»æ¹éæäº¤ï¼å¦æåç«¯ä¸æ¯ææ°ç»ï¼ä¼èµ°å
åºå¾ªç¯æäº¤ï¼ |
| | | const submitDataList = dialogTableData.value.map((row) => { |
| | | return { |
| | | ticketRegistrationId: row.ticketRegistrationId, |
| | | purchaseLedgerId: row.purchaseLedgerId, |
| | | purchaseContractNumber: row.purchaseContractNumber, |
| | | salesContractNo: row.salesContractNo, |
| | | supplierName: row.supplierName, |
| | | invoiceNumber: row.invoiceNumber, |
| | | invoiceAmount: row.invoiceAmount, |
| | | taxRate: row.taxRate, |
| | | currentPaymentAmount: row.currentPaymentAmount, |
| | | paymentMethod: row.paymentMethod, |
| | | paymentDate: row.paymentDate, |
| | | registrant: row.registrant, |
| | | registrationtDate: row.registrationtDate, |
| | | id: null, |
| | | }; |
| | | paymentRegistrationAdd(forms.value).then(() => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | |
| | | paymentRegistrationAdd(submitDataList) |
| | | .then(() => { |
| | | proxy.$modal?.msgSuccess |
| | | ? proxy.$modal.msgSuccess("æäº¤æå") |
| | | : proxy.$message.success("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }) |
| | | .catch((e) => { |
| | | console.error("æäº¤å¤±è´¥:", e); |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | dialogTableData.value = []; |
| | | forms.value = []; |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å é¤ |
| | |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delPaymentRegistration(row.id) |
| | | delPaymentRegistration([row.id]) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | // å¯¼åº |
| | | const handleExport = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | |
| | | ::v-deep(.el-checkbox__label) { |
| | | font-weight: bold; |
| | | } |
| | | .empty-tip { |
| | | text-align: center; |
| | | padding: 20px 0; |
| | | color: #909399; |
| | | } |
| | | </style> |
| | |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button @click="handleExport">导åº</el-button> |
| | | <el-button |
| | | type="danger" |
| | | :disabled="selectedRows.length === 0" |
| | | @click="handleBatchDelete" |
| | | > |
| | | æ¹éå é¤ ({{ selectedRows.length }}) |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="table_list"> |
| | |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total" |
| | | ></PIMTable> |
| | | > |
| | | <template #operation="{ row }"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="handleDelete(row)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | <script setup> |
| | | import { ref, reactive, getCurrentInstance, onMounted } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { paymentHistoryListPage } from "@/api/procurementManagement/paymentEntry.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { paymentHistoryListPage} from "@/api/procurementManagement/paymentEntry.js"; |
| | | import {delPaymentRegistration } from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import dayjs from "dayjs"; |
| | | |
| | |
| | | { |
| | | label: "ç»è®°æ¥æ", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: "æä½", |
| | | dataType: "slot", |
| | | slot: "operation", |
| | | width: 100, |
| | | align: "center", |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | |
| | | getList(); |
| | | }; |
| | | |
| | | // å é¤ |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delPaymentRegistration([row.id]) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleBatchDelete = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | `ç¡®å®è¦å é¤éä¸ç ${selectedRows.value.length} æ¡æ°æ®åï¼`, |
| | | "å é¤æç¤º", |
| | | { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | } |
| | | ) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | const ids = selectedRows.value.map((item) => item.id); |
| | | delPaymentRegistration(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | selectedRows.value = []; |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleExport = () => { |
| | | const { paymentDate, ...rest } = searchForm; |
| | |
| | | /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" /> |
| | | <el-table-column |
| | | label="å票éé¢(å
)" |
| | | label="ååéé¢(å
)" |
| | | prop="invoiceAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | |
| | | :column="tableColumnSon" |
| | | :tableData="originalTableDataSon" |
| | | :isSelection="false" |
| | | :isShowPagination="false" |
| | | :tableLoading="tableLoadingSon" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | |
| | | </el-text> |
| | | </template> |
| | | </PIMTable> |
| | | <pagination |
| | | v-show="sonTotal > 0" |
| | | :total="sonTotal" |
| | | @pagination="sonPaginationSearch" |
| | | :layout="page.layout" |
| | | :page="sonPage.current" |
| | | :limit="sonPage.size" |
| | | /> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | } from "@/api/procurementManagement/paymentLedger.js"; |
| | | import Pagination from "../../../components/PIMTable/Pagination.vue"; |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ä¾åºååç§°", |
| | | prop: "supplierName", |
| | | width:240 |
| | | }, |
| | | { |
| | | label: "å票éé¢(å
)", |
| | | prop: "invoiceAmount", |
| | | }, |
| | | { |
| | | label: "仿¬¾éé¢(å
)", |
| | | prop: "paymentAmount", |
| | | }, |
| | | { |
| | | label: "åºä»éé¢(å
)", |
| | | prop: "payableAmount", |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const data = reactive({ |
| | |
| | | const tableColumnSon = ref([ |
| | | { |
| | | label: "åçæ¥æ", |
| | | prop: "happenTime", |
| | | prop: "paymentDate", |
| | | width: 110, |
| | | }, |
| | | { |
| | | label: "å票éé¢(å
)", |
| | | label: "éè´ååå·", |
| | | prop: "purchaseContractNumber", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "ååéé¢(å
)", |
| | | prop: "invoiceAmount", |
| | | width: 200, |
| | | formatData: (params) => { |
| | |
| | | }, |
| | | { |
| | | label: "仿¬¾éé¢(å
)", |
| | | prop: "currentPaymentAmount", |
| | | prop: "paymentAmount", |
| | | width: 200, |
| | | formatData: (params) => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | |
| | | const summarizeMainTable1 = (param) => { |
| | | let summarizeTable = proxy.summarizeTable( |
| | | param, |
| | | ["invoiceAmount", "currentPaymentAmount"], |
| | | ["invoiceAmount", "paymentAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | |
| | | paymentLedgerList({ |
| | | ...searchForm.value, |
| | | ...page, |
| | | detailPageNum: detailPageNum.value, // æ°å¢ |
| | | detailPageSize: detailPageSize.value, // æ°å¢ |
| | | }).then((res) => { |
| | | let result = res.data; |
| | | tableLoading.value = false; |
| | |
| | | |
| | | const getPaymenRecordtList = (supplierId) => { |
| | | tableLoadingSon.value = true; |
| | | paymentRecordList(supplierId) |
| | | paymentRecordList({supplierId: supplierId}) |
| | | .then((res) => { |
| | | tableLoadingSon.value = false; |
| | | tableDataSon.value = res.data; |
| | |
| | | type="primary" |
| | | text |
| | | @click="openEdit(row)" |
| | | :disabled="row.issUerId !== userStore.id" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | :disabled="row.issUerId !== userStore.id" |
| | | @click="handleDelete(row)" |
| | | > |
| | | å é¤ |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¯å¦å¼ç¥¨" prop="isInvoice"> |
| | | <el-select v-model="form.isInvoice" placeholder="è¯·éæ©" clearable> |
| | | <el-option label="æ¯" :value="1" /> |
| | | <el-option label="å¦" :value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> |
| | |
| | | supplierId: "", |
| | | paymentMethod: "", |
| | | executionDate: "", |
| | | isInvoice: "", |
| | | }, |
| | | rules: { |
| | | purchaseContractNumber: [ |
| | |
| | | supplierId: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | entryDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | executionDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | isInvoice: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-card class="box-card"> |
| | | <!-- æç´¢åºå --> |
| | | <el-row :gutter="20" class="search-row"> |
| | | <el-col :span="6"> |
| | | <el-input |
| | | v-model="searchForm.productName" |
| | | placeholder="请è¾å
¥äº§ååç§°" |
| | | clearable |
| | | @keyup.enter="handleSearch" |
| | | > |
| | | <template #prefix> |
| | | <el-icon><Search /></el-icon> |
| | | </template> |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-select v-model="searchForm.identifierType" placeholder="è¯·éæ©æ è¯ç±»å" clearable> |
| | | <el-option label="äºç»´ç " value="äºç»´ç "></el-option> |
| | | <el-option label="é²ä¼ªç " value="é²ä¼ªç "></el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-select v-model="searchForm.status" placeholder="è¯·éæ©ç¶æ" clearable> |
| | | <el-option label="å·²çæ" value="å·²çæ"></el-option> |
| | | <el-option label="å·²åé
" value="å·²åé
"></el-option> |
| | | <el-option label="已使ç¨" value="已使ç¨"></el-option> |
| | | <el-option label="å·²ä½åº" value="å·²ä½åº"></el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | <el-button style="float: right;" type="primary" @click="handleAdd"> |
| | | æ°å¢æ è¯ |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- æç´¢åºå --> |
| | | <el-row :gutter="20" |
| | | class="search-row"> |
| | | <el-col :span="6"> |
| | | <el-input v-model="searchForm.productName" |
| | | placeholder="请è¾å
¥äº§ååç§°" |
| | | clearable |
| | | @keyup.enter="handleSearch"> |
| | | <template #prefix> |
| | | <el-icon> |
| | | <Search /> |
| | | </el-icon> |
| | | </template> |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-select v-model="searchForm.identifierType" |
| | | placeholder="è¯·éæ©æ è¯ç±»å" |
| | | clearable> |
| | | <el-option label="äºç»´ç " |
| | | value="äºç»´ç "></el-option> |
| | | <el-option label="é²ä¼ªç " |
| | | value="é²ä¼ªç "></el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-select v-model="searchForm.status" |
| | | placeholder="è¯·éæ©ç¶æ" |
| | | clearable> |
| | | <el-option label="å·²çæ" |
| | | value="å·²çæ"></el-option> |
| | | <el-option label="å·²åé
" |
| | | value="å·²åé
"></el-option> |
| | | <el-option label="已使ç¨" |
| | | value="已使ç¨"></el-option> |
| | | <el-option label="å·²ä½åº" |
| | | value="å·²ä½åº"></el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-button type="primary" |
| | | @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | <el-button style="float: right;" |
| | | type="primary" |
| | | @click="handleAdd"> |
| | | æ°å¢æ è¯ |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- äº§åæ è¯å表 --> |
| | | <el-table |
| | | :data="filteredList" |
| | | style="width: 100%" |
| | | v-loading="loading" |
| | | border |
| | | stripe |
| | | height="calc(100vh - 22em)" |
| | | > |
| | | <el-table-column prop="id" label="ID" width="80" align="center"/> |
| | | <el-table-column prop="productName" label="产ååç§°" width="150" /> |
| | | <el-table-column prop="productCode" label="产åç¼ç " width="120" /> |
| | | <el-table-column prop="batchNo" label="æ¹æ¬¡å·" width="120" /> |
| | | <el-table-column prop="identifierType" label="æ è¯ç±»å" width="100"> |
| | | <el-table :data="filteredList" |
| | | style="width: 100%" |
| | | v-loading="loading" |
| | | border |
| | | stripe |
| | | height="calc(100vh - 22em)"> |
| | | <el-table-column prop="id" |
| | | label="ID" |
| | | width="80" |
| | | align="center" /> |
| | | <el-table-column prop="productName" |
| | | label="产ååç§°" |
| | | width="150" /> |
| | | <el-table-column prop="productCode" |
| | | label="产åç¼ç " |
| | | width="120" /> |
| | | <el-table-column prop="batchNo" |
| | | label="æ¹æ¬¡å·" |
| | | width="120" /> |
| | | <el-table-column prop="identifierType" |
| | | label="æ è¯ç±»å" |
| | | width="100"> |
| | | <template #default="scope"> |
| | | <el-tag :type="getIdentifierTypeType(scope.row.identifierType)"> |
| | | {{ scope.row.identifierType }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="identifierCode" label="æ è¯ç " /> |
| | | <el-table-column prop="status" label="ç¶æ" width="100"> |
| | | <el-table-column prop="identifierCode" |
| | | label="æ è¯ç " /> |
| | | <el-table-column prop="status" |
| | | label="ç¶æ" |
| | | width="100"> |
| | | <template #default="scope"> |
| | | <el-tag :type="getStatusType(scope.row.status)"> |
| | | {{ scope.row.status }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="generateTime" label="çææ¶é´" width="160" /> |
| | | <el-table-column label="æä½" fixed="right" align="center" width="280"> |
| | | <el-table-column prop="generateTime" |
| | | label="çææ¶é´" |
| | | width="160" /> |
| | | <el-table-column label="æä½" |
| | | fixed="right" |
| | | align="center" |
| | | width="280"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="handleView(scope.row)">æ¥ç</el-button> |
| | | <el-button link type="primary" @click="handleEdit(scope.row)">ç¼è¾</el-button> |
| | | <el-button link type="success" @click="generateQRCode(scope.row)">çæäºç»´ç </el-button> |
| | | <el-button link type="primary" @click="handleExport(scope.row)">导åº</el-button> |
| | | <el-button link type="primary" @click="handleReassign(scope.row)" v-if="scope.row.status === 'å·²åé
'">éæ°åé
</el-button> |
| | | <el-button link type="danger" @click="handleDelete(scope.row)">å é¤</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleView(scope.row)">æ¥ç</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleEdit(scope.row)">ç¼è¾</el-button> |
| | | <el-button link |
| | | type="success" |
| | | @click="generateQRCode(scope.row)">çæäºç»´ç </el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleExport(scope.row)">导åº</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleReassign(scope.row)" |
| | | v-if="scope.row.status === 'å·²åé
'">éæ°åé
</el-button> |
| | | <el-button link |
| | | type="danger" |
| | | @click="handleDelete(scope.row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- å页 --> |
| | | <pagination |
| | | :total="pagination.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="pagination.currentPage" |
| | | :limit="pagination.pageSize" |
| | | @pagination="handleCurrentChange" |
| | | /> |
| | | <pagination :total="pagination.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="pagination.currentPage" |
| | | :limit="pagination.pageSize" |
| | | @pagination="handleCurrentChange" /> |
| | | </el-card> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="dialogVisible" :title="dialogTitle" width="700px"> |
| | | <el-form :model="form" :rules="rules" ref="formRef" label-width="100px"> |
| | | <el-dialog v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="700px"> |
| | | <el-form :model="form" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | label-width="100px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产ååç§°" prop="productName"> |
| | | <el-input v-model="form.productName" placeholder="请è¾å
¥äº§ååç§°"></el-input> |
| | | <el-form-item label="产ååç§°" |
| | | prop="productName"> |
| | | <el-input v-model="form.productName" |
| | | placeholder="请è¾å
¥äº§ååç§°"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产åç¼ç " prop="productCode"> |
| | | <el-input v-model="form.productCode" placeholder="请è¾å
¥äº§åç¼ç "></el-input> |
| | | <el-form-item label="产åç¼ç " |
| | | prop="productCode"> |
| | | <el-input v-model="form.productCode" |
| | | placeholder="请è¾å
¥äº§åç¼ç "></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¹æ¬¡å·" prop="batchNo"> |
| | | <el-input v-model="form.batchNo" placeholder="请è¾å
¥æ¹æ¬¡å·"></el-input> |
| | | <el-form-item label="æ¹æ¬¡å·" |
| | | prop="batchNo"> |
| | | <el-input v-model="form.batchNo" |
| | | placeholder="请è¾å
¥æ¹æ¬¡å·"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ è¯ç±»å" prop="identifierType"> |
| | | <el-select v-model="form.identifierType" placeholder="è¯·éæ©æ è¯ç±»å" style="width: 100%"> |
| | | <el-option label="äºç»´ç " value="äºç»´ç "></el-option> |
| | | <el-option label="é²ä¼ªç " value="é²ä¼ªç "></el-option> |
| | | <el-form-item label="æ è¯ç±»å" |
| | | prop="identifierType"> |
| | | <el-select v-model="form.identifierType" |
| | | placeholder="è¯·éæ©æ è¯ç±»å" |
| | | style="width: 100%"> |
| | | <el-option label="äºç»´ç " |
| | | value="äºç»´ç "></el-option> |
| | | <el-option label="é²ä¼ªç " |
| | | value="é²ä¼ªç "></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çææ°é" prop="quantity"> |
| | | <el-input-number v-model="form.quantity" :min="1" :max="10000" style="width: 100%"></el-input-number> |
| | | <el-form-item label="çææ°é" |
| | | prop="quantity"> |
| | | <el-input-number v-model="form.quantity" |
| | | :min="1" |
| | | :max="10000" |
| | | style="width: 100%"></el-input-number> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¶æ" prop="status"> |
| | | <el-select v-model="form.status" placeholder="è¯·éæ©ç¶æ" style="width: 100%"> |
| | | <el-option label="å·²çæ" value="å·²çæ"></el-option> |
| | | <el-option label="å·²åé
" value="å·²åé
"></el-option> |
| | | <el-option label="已使ç¨" value="已使ç¨"></el-option> |
| | | <el-option label="å·²ä½åº" value="å·²ä½åº"></el-option> |
| | | <el-form-item label="ç¶æ" |
| | | prop="status"> |
| | | <el-select v-model="form.status" |
| | | placeholder="è¯·éæ©ç¶æ" |
| | | style="width: 100%"> |
| | | <el-option label="å·²çæ" |
| | | value="å·²çæ"></el-option> |
| | | <el-option label="å·²åé
" |
| | | value="å·²åé
"></el-option> |
| | | <el-option label="已使ç¨" |
| | | value="已使ç¨"></el-option> |
| | | <el-option label="å·²ä½åº" |
| | | value="å·²ä½åº"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input type="textarea" v-model="form.remark" placeholder="请è¾å
¥å¤æ³¨ä¿¡æ¯" rows="3"></el-input> |
| | | <el-form-item label="夿³¨" |
| | | prop="remark"> |
| | | <el-input type="textarea" |
| | | v-model="form.remark" |
| | | placeholder="请è¾å
¥å¤æ³¨ä¿¡æ¯" |
| | | rows="3"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleSubmit">ç¡® å®</el-button> |
| | | <el-button @click="dialogVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit">ç¡® å®</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ è¯çæå¯¹è¯æ¡ --> |
| | | <el-dialog v-model="generateDialogVisible" title="æ è¯çæ" width="500px"> |
| | | <el-dialog v-model="generateDialogVisible" |
| | | title="æ è¯çæ" |
| | | width="500px"> |
| | | <el-form label-width="100px"> |
| | | <el-form-item label="产ååç§°"> |
| | | <span>{{ currentProduct.productName }}</span> |
| | |
| | | <el-form-item label="æ è¯ç±»å"> |
| | | <span>{{ currentProduct.identifierType }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="çææ°é" prop="generateQuantity"> |
| | | <el-input-number v-model="generateQuantity" :min="1" :max="10000" style="width: 100%"></el-input-number> |
| | | <el-form-item label="çææ°é" |
| | | prop="generateQuantity"> |
| | | <el-input-number v-model="generateQuantity" |
| | | :min="1" |
| | | :max="10000" |
| | | style="width: 100%"></el-input-number> |
| | | </el-form-item> |
| | | <el-form-item label="ç¼ç è§å" prop="codeRule"> |
| | | <el-select v-model="codeRule" placeholder="è¯·éæ©ç¼ç è§å" style="width: 100%"> |
| | | <el-option label="产åç¼ç +æ¹æ¬¡å·+åºå·" value="产åç¼ç +æ¹æ¬¡å·+åºå·"></el-option> |
| | | <el-option label="æ¶é´æ³+éæºæ°" value="æ¶é´æ³+éæºæ°"></el-option> |
| | | <el-option label="èªå®ä¹è§å" value="èªå®ä¹è§å"></el-option> |
| | | <el-form-item label="ç¼ç è§å" |
| | | prop="codeRule"> |
| | | <el-select v-model="codeRule" |
| | | placeholder="è¯·éæ©ç¼ç è§å" |
| | | style="width: 100%"> |
| | | <el-option label="产åç¼ç +æ¹æ¬¡å·+åºå·" |
| | | value="产åç¼ç +æ¹æ¬¡å·+åºå·"></el-option> |
| | | <el-option label="æ¶é´æ³+éæºæ°" |
| | | value="æ¶é´æ³+éæºæ°"></el-option> |
| | | <el-option label="èªå®ä¹è§å" |
| | | value="èªå®ä¹è§å"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="èªå®ä¹åç¼" prop="customPrefix" v-if="codeRule === 'èªå®ä¹è§å'"> |
| | | <el-input v-model="customPrefix" placeholder="请è¾å
¥èªå®ä¹åç¼"></el-input> |
| | | <el-form-item label="èªå®ä¹åç¼" |
| | | prop="customPrefix" |
| | | v-if="codeRule === 'èªå®ä¹è§å'"> |
| | | <el-input v-model="customPrefix" |
| | | placeholder="请è¾å
¥èªå®ä¹åç¼"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="generateIdentifiers">ç æ</el-button> |
| | | <el-button @click="generateDialogVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="generateIdentifiers">ç æ</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- éæ°åé
å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="reassignDialogVisible" title="éæ°åé
æ è¯" width="500px"> |
| | | <el-dialog v-model="reassignDialogVisible" |
| | | title="éæ°åé
æ è¯" |
| | | width="500px"> |
| | | <el-form label-width="100px"> |
| | | <el-form-item label="产ååç§°"> |
| | | <span>{{ currentProduct.productName }}</span> |
| | |
| | | <el-form-item label="æ è¯ç "> |
| | | <span>{{ currentProduct.identifierCode }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="æ°æ¹æ¬¡å·" prop="newBatchNo"> |
| | | <el-input v-model="newBatchNo" placeholder="请è¾å
¥æ°æ¹æ¬¡å·"></el-input> |
| | | <el-form-item label="æ°æ¹æ¬¡å·" |
| | | prop="newBatchNo"> |
| | | <el-input v-model="newBatchNo" |
| | | placeholder="请è¾å
¥æ°æ¹æ¬¡å·"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="åé
åå " prop="reassignReason"> |
| | | <el-input type="textarea" v-model="reassignReason" rows="3" placeholder="请è¾å
¥éæ°åé
åå "></el-input> |
| | | <el-form-item label="åé
åå " |
| | | prop="reassignReason"> |
| | | <el-input type="textarea" |
| | | v-model="reassignReason" |
| | | rows="3" |
| | | placeholder="请è¾å
¥éæ°åé
åå "></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="saveReassign">ç¡® å®</el-button> |
| | | <el-button @click="reassignDialogVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="saveReassign">ç¡® å®</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- äºç»´ç é¢è§å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="qrCodeDialogVisible" title="äºç»´ç é¢è§" width="500px" center> |
| | | <el-dialog v-model="qrCodeDialogVisible" |
| | | title="äºç»´ç é¢è§" |
| | | width="500px" |
| | | center> |
| | | <div class="qr-preview-container"> |
| | | <div v-if="qrCodeUrl" class="qr-image-container"> |
| | | <img :src="qrCodeUrl" alt="äºç»´ç " class="qr-image" /> |
| | | <div v-if="qrCodeUrl" |
| | | class="qr-image-container"> |
| | | <img :src="qrCodeUrl" |
| | | alt="äºç»´ç " |
| | | class="qr-image" /> |
| | | <div class="qr-info"> |
| | | <p><strong>产ååç§°ï¼</strong>{{ currentQRProduct.productName }}</p> |
| | | <p><strong>产åç¼ç ï¼</strong>{{ currentQRProduct.productCode }}</p> |
| | |
| | | <p><strong>æ è¯ç±»åï¼</strong>{{ currentQRProduct.identifierType }}</p> |
| | | </div> |
| | | </div> |
| | | <div v-else class="qr-loading"> |
| | | <el-icon class="is-loading"><Loading /></el-icon> |
| | | <div v-else |
| | | class="qr-loading"> |
| | | <el-icon class="is-loading"> |
| | | <Loading /> |
| | | </el-icon> |
| | | <p>æ£å¨çæäºç»´ç ...</p> |
| | | </div> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="qrCodeDialogVisible = false">å
³é</el-button> |
| | | <el-button |
| | | v-if="qrCodeUrl" |
| | | type="primary" |
| | | @click="copyQRContent" |
| | | icon="CopyDocument" |
| | | > |
| | | <el-button v-if="qrCodeUrl" |
| | | type="primary" |
| | | @click="copyQRContent" |
| | | icon="CopyDocument"> |
| | | å¤å¶å
容 |
| | | </el-button> |
| | | <el-button |
| | | v-if="qrCodeUrl" |
| | | type="success" |
| | | @click="downloadQRCode" |
| | | icon="Download" |
| | | > |
| | | <el-button v-if="qrCodeUrl" |
| | | type="success" |
| | | @click="downloadQRCode" |
| | | icon="Download"> |
| | | ä¸è½½äºç»´ç |
| | | </el-button> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { Plus, Search, Loading, Download } from '@element-plus/icons-vue' |
| | | import Pagination from '@/components/PIMTable/Pagination.vue' |
| | | import QRCode from 'qrcode' |
| | | import { ref, reactive, computed } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { Plus, Search, Loading, Download } from "@element-plus/icons-vue"; |
| | | import Pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import QRCode from "qrcode"; |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | const searchForm = reactive({ |
| | | productName: '', |
| | | identifierType: '', |
| | | status: '' |
| | | }) |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false); |
| | | const searchForm = reactive({ |
| | | productName: "", |
| | | identifierType: "", |
| | | status: "", |
| | | }); |
| | | |
| | | const identifierList = ref([ |
| | | { |
| | | id: 1, |
| | | productName: 'å·¥ä¸ä¼ æå¨Aå', |
| | | productCode: 'SENSOR001', |
| | | batchNo: 'B202312001', |
| | | identifierType: 'äºç»´ç ', |
| | | identifierCode: 'QR_SENSOR001_B202312001_001', |
| | | status: 'å·²åé
', |
| | | generateTime: '2023-12-01 10:00:00', |
| | | remark: 'éè¦äº§åæ è¯' |
| | | }, |
| | | { |
| | | id: 2, |
| | | productName: 'æ§å¶é¢æ¿Bå', |
| | | productCode: 'PANEL002', |
| | | batchNo: 'B202312002', |
| | | identifierType: 'é²ä¼ªç ', |
| | | identifierCode: 'SEC_PANEL002_B202312002_001', |
| | | status: 'å·²çæ', |
| | | generateTime: '2023-12-02 14:30:00', |
| | | remark: '常è§äº§åæ è¯' |
| | | }, |
| | | { |
| | | id: 3, |
| | | productName: 'æ°æ®ééå¨Cå', |
| | | productCode: 'COLLECTOR003', |
| | | batchNo: 'B202312003', |
| | | identifierType: 'é²ä¼ªç ', |
| | | identifierCode: 'SEC_COLLECTOR003_B202312003_001', |
| | | status: '已使ç¨', |
| | | generateTime: '2023-12-03 09:15:00', |
| | | remark: 'æµè¯äº§åæ è¯' |
| | | } |
| | | ]) |
| | | const identifierList = ref([ |
| | | { |
| | | id: 1, |
| | | productName: "å·¥ä¸ä¼ æå¨Aå", |
| | | productCode: "SENSOR001", |
| | | batchNo: "B202312001", |
| | | identifierType: "äºç»´ç ", |
| | | identifierCode: "QR_SENSOR001_B202312001_001", |
| | | status: "å·²åé
", |
| | | generateTime: "2023-12-01 10:00:00", |
| | | remark: "éè¦äº§åæ è¯", |
| | | }, |
| | | { |
| | | id: 2, |
| | | productName: "æ§å¶é¢æ¿Bå", |
| | | productCode: "PANEL002", |
| | | batchNo: "B202312002", |
| | | identifierType: "é²ä¼ªç ", |
| | | identifierCode: "SEC_PANEL002_B202312002_001", |
| | | status: "å·²çæ", |
| | | generateTime: "2023-12-02 14:30:00", |
| | | remark: "常è§äº§åæ è¯", |
| | | }, |
| | | { |
| | | id: 3, |
| | | productName: "æ°æ®ééå¨Cå", |
| | | productCode: "COLLECTOR003", |
| | | batchNo: "B202312003", |
| | | identifierType: "é²ä¼ªç ", |
| | | identifierCode: "SEC_COLLECTOR003_B202312003_001", |
| | | status: "已使ç¨", |
| | | generateTime: "2023-12-03 09:15:00", |
| | | remark: "æµè¯äº§åæ è¯", |
| | | }, |
| | | ]); |
| | | |
| | | const pagination = reactive({ |
| | | total: 3, |
| | | currentPage: 1, |
| | | pageSize: 10 |
| | | }) |
| | | const pagination = reactive({ |
| | | total: 3, |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | }); |
| | | |
| | | const dialogVisible = ref(false) |
| | | const dialogTitle = ref('æ°å¢æ è¯') |
| | | const form = reactive({ |
| | | productName: '', |
| | | productCode: '', |
| | | batchNo: '', |
| | | identifierType: '', |
| | | quantity: 1, |
| | | status: 'å·²çæ', |
| | | remark: '' |
| | | }) |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref("æ°å¢æ è¯"); |
| | | const form = reactive({ |
| | | productName: "", |
| | | productCode: "", |
| | | batchNo: "", |
| | | identifierType: "", |
| | | quantity: 1, |
| | | status: "å·²çæ", |
| | | remark: "", |
| | | }); |
| | | |
| | | const rules = { |
| | | productName: [{ required: true, message: '请è¾å
¥äº§ååç§°', trigger: 'blur' }], |
| | | productCode: [{ required: true, message: '请è¾å
¥äº§åç¼ç ', trigger: 'blur' }], |
| | | batchNo: [{ required: true, message: '请è¾å
¥æ¹æ¬¡å·', trigger: 'blur' }], |
| | | identifierType: [{ required: true, message: 'è¯·éæ©æ è¯ç±»å', trigger: 'change' }], |
| | | quantity: [{ required: true, message: '请è¾å
¥çææ°é', trigger: 'blur' }], |
| | | status: [{ required: true, message: 'è¯·éæ©ç¶æ', trigger: 'change' }] |
| | | } |
| | | const rules = { |
| | | productName: [{ required: true, message: "请è¾å
¥äº§ååç§°", trigger: "blur" }], |
| | | productCode: [{ required: true, message: "请è¾å
¥äº§åç¼ç ", trigger: "blur" }], |
| | | batchNo: [{ required: true, message: "请è¾å
¥æ¹æ¬¡å·", trigger: "blur" }], |
| | | identifierType: [ |
| | | { required: true, message: "è¯·éæ©æ è¯ç±»å", trigger: "change" }, |
| | | ], |
| | | quantity: [{ required: true, message: "请è¾å
¥çææ°é", trigger: "blur" }], |
| | | status: [{ required: true, message: "è¯·éæ©ç¶æ", trigger: "change" }], |
| | | }; |
| | | |
| | | const isEdit = ref(false) |
| | | const editId = ref(null) |
| | | const generateDialogVisible = ref(false) |
| | | const reassignDialogVisible = ref(false) |
| | | const currentProduct = ref({}) |
| | | const generateQuantity = ref(1) |
| | | const codeRule = ref('') |
| | | const customPrefix = ref('') |
| | | const newBatchNo = ref('') |
| | | const reassignReason = ref('') |
| | | const formRef = ref() |
| | | const isEdit = ref(false); |
| | | const editId = ref(null); |
| | | const generateDialogVisible = ref(false); |
| | | const reassignDialogVisible = ref(false); |
| | | const currentProduct = ref({}); |
| | | const generateQuantity = ref(1); |
| | | const codeRule = ref(""); |
| | | const customPrefix = ref(""); |
| | | const newBatchNo = ref(""); |
| | | const reassignReason = ref(""); |
| | | const formRef = ref(); |
| | | |
| | | // äºç»´ç ç¸å
³åé |
| | | const qrCodeDialogVisible = ref(false) |
| | | const qrCodeUrl = ref('') |
| | | const currentQRProduct = ref({}) |
| | | // äºç»´ç ç¸å
³åé |
| | | const qrCodeDialogVisible = ref(false); |
| | | const qrCodeUrl = ref(""); |
| | | const currentQRProduct = ref({}); |
| | | |
| | | // 计ç®å±æ§ |
| | | const filteredList = computed(() => { |
| | | let list = identifierList.value |
| | | if (searchForm.productName) { |
| | | list = list.filter(item => item.productName.includes(searchForm.productName)) |
| | | } |
| | | if (searchForm.identifierType) { |
| | | list = list.filter(item => item.identifierType === searchForm.identifierType) |
| | | } |
| | | if (searchForm.status) { |
| | | list = list.filter(item => item.status === searchForm.status) |
| | | } |
| | | return list |
| | | }) |
| | | // 计ç®å±æ§ |
| | | const filteredList = computed(() => { |
| | | let list = identifierList.value; |
| | | if (searchForm.productName) { |
| | | list = list.filter(item => |
| | | item.productName.includes(searchForm.productName) |
| | | ); |
| | | } |
| | | if (searchForm.identifierType) { |
| | | list = list.filter( |
| | | item => item.identifierType === searchForm.identifierType |
| | | ); |
| | | } |
| | | if (searchForm.status) { |
| | | list = list.filter(item => item.status === searchForm.status); |
| | | } |
| | | return list; |
| | | }); |
| | | |
| | | // æ¹æ³ |
| | | const getIdentifierTypeType = (type) => { |
| | | const typeMap = { |
| | | 'äºç»´ç ': 'success', |
| | | 'é²ä¼ªç ': 'warning' |
| | | } |
| | | return typeMap[type] || 'info' |
| | | } |
| | | // æ¹æ³ |
| | | const getIdentifierTypeType = type => { |
| | | const typeMap = { |
| | | äºç»´ç : "success", |
| | | é²ä¼ªç : "warning", |
| | | }; |
| | | return typeMap[type] || "info"; |
| | | }; |
| | | |
| | | const getStatusType = (status) => { |
| | | const statusMap = { |
| | | 'å·²çæ': 'info', |
| | | 'å·²åé
': 'primary', |
| | | '已使ç¨': 'success', |
| | | 'å·²ä½åº': 'danger' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | const getStatusType = status => { |
| | | const statusMap = { |
| | | å·²çæ: "info", |
| | | å·²åé
: "primary", |
| | | 已使ç¨: "success", |
| | | å·²ä½åº: "danger", |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | }; |
| | | |
| | | const handleSearch = () => { |
| | | // æç´¢é»è¾å·²å¨computedä¸å¤ç |
| | | } |
| | | const handleSearch = () => { |
| | | // æç´¢é»è¾å·²å¨computedä¸å¤ç |
| | | }; |
| | | |
| | | const resetSearch = () => { |
| | | searchForm.productName = '' |
| | | searchForm.identifierType = '' |
| | | searchForm.status = '' |
| | | } |
| | | const resetSearch = () => { |
| | | searchForm.productName = ""; |
| | | searchForm.identifierType = ""; |
| | | searchForm.status = ""; |
| | | }; |
| | | |
| | | const handleAdd = () => { |
| | | dialogTitle.value = 'æ°å¢æ è¯' |
| | | isEdit.value = false |
| | | form.productName = '' |
| | | form.productCode = '' |
| | | form.batchNo = '' |
| | | form.identifierType = '' |
| | | form.quantity = 1 |
| | | form.status = 'å·²çæ' |
| | | form.remark = '' |
| | | dialogVisible.value = true |
| | | } |
| | | const handleAdd = () => { |
| | | dialogTitle.value = "æ°å¢æ è¯"; |
| | | isEdit.value = false; |
| | | form.productName = ""; |
| | | form.productCode = ""; |
| | | form.batchNo = ""; |
| | | form.identifierType = ""; |
| | | form.quantity = 1; |
| | | form.status = "å·²çæ"; |
| | | form.remark = ""; |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleView = (row) => { |
| | | // æ¥çæ è¯è¯¦æ
|
| | | ElMessage.info('æ¥çæ è¯è¯¦æ
åè½å¾
å®ç°') |
| | | } |
| | | const handleView = row => { |
| | | // æ¥çæ è¯è¯¦æ
|
| | | ElMessage.info("æ¥çæ è¯è¯¦æ
åè½å¾
å®ç°"); |
| | | }; |
| | | |
| | | const handleEdit = (row) => { |
| | | dialogTitle.value = 'ç¼è¾æ è¯' |
| | | isEdit.value = true |
| | | editId.value = row.id |
| | | Object.assign(form, row) |
| | | dialogVisible.value = true |
| | | } |
| | | const handleEdit = row => { |
| | | dialogTitle.value = "ç¼è¾æ è¯"; |
| | | isEdit.value = true; |
| | | editId.value = row.id; |
| | | Object.assign(form, row); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleExport = (row) => { |
| | | // å¯¼åºæ è¯ |
| | | ElMessage.success(`å·²å¯¼åºæ è¯: ${row.identifierCode}`) |
| | | } |
| | | const handleExport = row => { |
| | | // å¯¼åºæ è¯ |
| | | ElMessage.success(`å·²å¯¼åºæ è¯: ${row.identifierCode}`); |
| | | }; |
| | | |
| | | const handleReassign = (row) => { |
| | | currentProduct.value = row |
| | | newBatchNo.value = '' |
| | | reassignReason.value = '' |
| | | reassignDialogVisible.value = true |
| | | } |
| | | const handleReassign = row => { |
| | | currentProduct.value = row; |
| | | newBatchNo.value = ""; |
| | | reassignReason.value = ""; |
| | | reassignDialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm('确认å é¤è¯¥æ è¯åï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const index = identifierList.value.findIndex(item => item.id === row.id) |
| | | const handleDelete = row => { |
| | | ElMessageBox.confirm("确认å é¤è¯¥æ è¯åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | const index = identifierList.value.findIndex(item => item.id === row.id); |
| | | if (index > -1) { |
| | | identifierList.value.splice(index, 1); |
| | | pagination.total--; |
| | | ElMessage.success("å 餿å"); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // çæäºç»´ç |
| | | const generateQRCode = async row => { |
| | | try { |
| | | // æ£æ¥å¿
è¦å段 |
| | | if (!row.productName || !row.productCode || !row.batchNo) { |
| | | ElMessage.warning("产åä¿¡æ¯ä¸å®æ´ï¼æ æ³çæäºç»´ç "); |
| | | return; |
| | | } |
| | | |
| | | currentQRProduct.value = row; |
| | | qrCodeUrl.value = ""; |
| | | qrCodeDialogVisible.value = true; |
| | | |
| | | // æå»ºäºç»´ç å
容 |
| | | let qrContent = ""; |
| | | if (row.identifierType === "äºç»´ç ") { |
| | | qrContent = `${row.productName}|${row.productCode}|${row.batchNo}|${row.identifierCode}`; |
| | | } else if (row.identifierType === "é²ä¼ªç ") { |
| | | // é²ä¼ªç æ ¼å¼ï¼SEC_产åç¼ç _æ¹æ¬¡å·_æ¶é´æ³_éæºæ° |
| | | const timestamp = Date.now(); |
| | | const random = Math.random().toString(36).substr(2, 8); |
| | | qrContent = `SEC_${row.productCode}_${row.batchNo}_${timestamp}_${random}`; |
| | | } |
| | | |
| | | // çæäºç»´ç |
| | | qrCodeUrl.value = await QRCode.toDataURL(qrContent, { |
| | | width: 256, |
| | | margin: 2, |
| | | color: { |
| | | dark: "#000000", |
| | | light: "#FFFFFF", |
| | | }, |
| | | errorCorrectionLevel: row.identifierType === "é²ä¼ªç " ? "H" : "M", |
| | | }); |
| | | |
| | | ElMessage.success("äºç»´ç çææåï¼"); |
| | | } catch (error) { |
| | | console.error("çæäºç»´ç 失败:", error); |
| | | ElMessage.error("çæäºç»´ç 失败ï¼" + error.message); |
| | | qrCodeDialogVisible.value = false; |
| | | } |
| | | }; |
| | | |
| | | // ä¸è½½äºç»´ç |
| | | const downloadQRCode = () => { |
| | | if (!qrCodeUrl.value) { |
| | | ElMessage.warning("请å
çæäºç»´ç "); |
| | | return; |
| | | } |
| | | |
| | | const a = document.createElement("a"); |
| | | a.href = qrCodeUrl.value; |
| | | a.download = `${currentQRProduct.value.productName}_${ |
| | | currentQRProduct.value.identifierType |
| | | }_${new Date().getTime()}.png`; |
| | | document.body.appendChild(a); |
| | | a.click(); |
| | | document.body.removeChild(a); |
| | | ElMessage.success("ä¸è½½æåï¼"); |
| | | }; |
| | | |
| | | // å¤å¶äºç»´ç å
容 |
| | | const copyQRContent = async () => { |
| | | if (!currentQRProduct.value) { |
| | | ElMessage.warning("没æå¯å¤å¶çå
容"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | let content = ""; |
| | | if (currentQRProduct.value.identifierType === "äºç»´ç ") { |
| | | content = `${currentQRProduct.value.productName}|${currentQRProduct.value.productCode}|${currentQRProduct.value.batchNo}|${currentQRProduct.value.identifierCode}`; |
| | | } else if (currentQRProduct.value.identifierType === "é²ä¼ªç ") { |
| | | const timestamp = Date.now(); |
| | | const random = Math.random().toString(36).substr(2, 8); |
| | | content = `SEC_${currentQRProduct.value.productCode}_${currentQRProduct.value.batchNo}_${timestamp}_${random}`; |
| | | } |
| | | |
| | | await navigator.clipboard.writeText(content); |
| | | ElMessage.success("å
容已å¤å¶å°åªè´´æ¿"); |
| | | } catch (error) { |
| | | // éçº§æ¹æ¡ |
| | | const textArea = document.createElement("textarea"); |
| | | textArea.value = content; |
| | | document.body.appendChild(textArea); |
| | | textArea.select(); |
| | | document.execCommand("copy"); |
| | | document.body.removeChild(textArea); |
| | | ElMessage.success("å
容已å¤å¶å°åªè´´æ¿"); |
| | | } |
| | | }; |
| | | |
| | | const generateIdentifiers = () => { |
| | | if (!codeRule.value) { |
| | | ElMessage.warning("è¯·éæ©ç¼ç è§å"); |
| | | return; |
| | | } |
| | | |
| | | // çææ è¯çé»è¾ |
| | | const newIdentifiers = []; |
| | | for (let i = 1; i <= generateQuantity.value; i++) { |
| | | let identifierCode = ""; |
| | | if (codeRule.value === "产åç¼ç +æ¹æ¬¡å·+åºå·") { |
| | | identifierCode = `${currentProduct.value.productCode}_${ |
| | | currentProduct.value.batchNo |
| | | }_${String(i).padStart(3, "0")}`; |
| | | } else if (codeRule.value === "æ¶é´æ³+éæºæ°") { |
| | | identifierCode = `TS_${Date.now()}_${Math.floor(Math.random() * 1000)}`; |
| | | } else if (codeRule.value === "èªå®ä¹è§å") { |
| | | identifierCode = `${customPrefix.value || "CUSTOM"}_${Date.now()}_${i}`; |
| | | } |
| | | |
| | | newIdentifiers.push({ |
| | | id: Math.max(...identifierList.value.map(item => item.id)) + i, |
| | | productName: currentProduct.value.productName, |
| | | productCode: currentProduct.value.productCode, |
| | | batchNo: currentProduct.value.batchNo, |
| | | identifierType: currentProduct.value.identifierType, |
| | | identifierCode: identifierCode, |
| | | status: "å·²çæ", |
| | | generateTime: new Date().toLocaleString(), |
| | | remark: "æ¹éçæ", |
| | | }); |
| | | } |
| | | |
| | | identifierList.value.push(...newIdentifiers); |
| | | pagination.total += newIdentifiers.length; |
| | | ElMessage.success(`æåçæ ${newIdentifiers.length} 个æ è¯`); |
| | | generateDialogVisible.value = false; |
| | | }; |
| | | |
| | | const saveReassign = () => { |
| | | if (!newBatchNo.value) { |
| | | ElMessage.warning("请è¾å
¥æ°æ¹æ¬¡å·"); |
| | | return; |
| | | } |
| | | |
| | | const index = identifierList.value.findIndex( |
| | | item => item.id === currentProduct.value.id |
| | | ); |
| | | if (index > -1) { |
| | | identifierList.value.splice(index, 1) |
| | | pagination.total-- |
| | | ElMessage.success('å 餿å') |
| | | identifierList.value[index].batchNo = newBatchNo.value; |
| | | identifierList.value[index].status = "å·²åé
"; |
| | | ElMessage.success("æ è¯éæ°åé
æå"); |
| | | reassignDialogVisible.value = false; |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | |
| | | // çæäºç»´ç |
| | | const generateQRCode = async (row) => { |
| | | try { |
| | | // æ£æ¥å¿
è¦å段 |
| | | if (!row.productName || !row.productCode || !row.batchNo) { |
| | | ElMessage.warning('产åä¿¡æ¯ä¸å®æ´ï¼æ æ³çæäºç»´ç ') |
| | | return |
| | | } |
| | | |
| | | currentQRProduct.value = row |
| | | qrCodeUrl.value = '' |
| | | qrCodeDialogVisible.value = true |
| | | |
| | | // æå»ºäºç»´ç å
容 |
| | | let qrContent = '' |
| | | if (row.identifierType === 'äºç»´ç ') { |
| | | qrContent = `${row.productName}|${row.productCode}|${row.batchNo}|${row.identifierCode}` |
| | | } else if (row.identifierType === 'é²ä¼ªç ') { |
| | | // é²ä¼ªç æ ¼å¼ï¼SEC_产åç¼ç _æ¹æ¬¡å·_æ¶é´æ³_éæºæ° |
| | | const timestamp = Date.now() |
| | | const random = Math.random().toString(36).substr(2, 8) |
| | | qrContent = `SEC_${row.productCode}_${row.batchNo}_${timestamp}_${random}` |
| | | } |
| | | |
| | | // çæäºç»´ç |
| | | qrCodeUrl.value = await QRCode.toDataURL(qrContent, { |
| | | width: 256, |
| | | margin: 2, |
| | | color: { |
| | | dark: '#000000', |
| | | light: '#FFFFFF' |
| | | }, |
| | | errorCorrectionLevel: row.identifierType === 'é²ä¼ªç ' ? 'H' : 'M' |
| | | }) |
| | | |
| | | ElMessage.success('äºç»´ç çææåï¼') |
| | | |
| | | } catch (error) { |
| | | console.error('çæäºç»´ç 失败:', error) |
| | | ElMessage.error('çæäºç»´ç 失败ï¼' + error.message) |
| | | qrCodeDialogVisible.value = false |
| | | } |
| | | } |
| | | const handleSubmit = () => { |
| | | formRef.value.validate(valid => { |
| | | if (valid) { |
| | | if (isEdit.value) { |
| | | // ç¼è¾ |
| | | const index = identifierList.value.findIndex( |
| | | item => item.id === editId.value |
| | | ); |
| | | if (index > -1) { |
| | | identifierList.value[index] = { ...form, id: editId.value }; |
| | | ElMessage.success("ç¼è¾æå"); |
| | | } |
| | | } else { |
| | | // æ°å¢ |
| | | const newId = |
| | | Math.max(...identifierList.value.map(item => item.id)) + 1; |
| | | |
| | | // ä¸è½½äºç»´ç |
| | | const downloadQRCode = () => { |
| | | if (!qrCodeUrl.value) { |
| | | ElMessage.warning('请å
çæäºç»´ç ') |
| | | return |
| | | } |
| | | |
| | | const a = document.createElement('a') |
| | | a.href = qrCodeUrl.value |
| | | a.download = `${currentQRProduct.value.productName}_${currentQRProduct.value.identifierType}_${new Date().getTime()}.png` |
| | | document.body.appendChild(a) |
| | | a.click() |
| | | document.body.removeChild(a) |
| | | ElMessage.success('ä¸è½½æåï¼') |
| | | } |
| | | // æ ¹æ®æ è¯ç±»åçæä¸åçæ è¯ç |
| | | let identifierCode = ""; |
| | | if (form.identifierType === "äºç»´ç ") { |
| | | identifierCode = `QR_${form.productCode}_${form.batchNo}_001`; |
| | | } else if (form.identifierType === "é²ä¼ªç ") { |
| | | identifierCode = `SEC_${form.productCode}_${form.batchNo}_001`; |
| | | } |
| | | |
| | | // å¤å¶äºç»´ç å
容 |
| | | const copyQRContent = async () => { |
| | | if (!currentQRProduct.value) { |
| | | ElMessage.warning('没æå¯å¤å¶çå
容') |
| | | return |
| | | } |
| | | |
| | | try { |
| | | let content = '' |
| | | if (currentQRProduct.value.identifierType === 'äºç»´ç ') { |
| | | content = `${currentQRProduct.value.productName}|${currentQRProduct.value.productCode}|${currentQRProduct.value.batchNo}|${currentQRProduct.value.identifierCode}` |
| | | } else if (currentQRProduct.value.identifierType === 'é²ä¼ªç ') { |
| | | const timestamp = Date.now() |
| | | const random = Math.random().toString(36).substr(2, 8) |
| | | content = `SEC_${currentQRProduct.value.productCode}_${currentQRProduct.value.batchNo}_${timestamp}_${random}` |
| | | } |
| | | |
| | | await navigator.clipboard.writeText(content) |
| | | ElMessage.success('å
容已å¤å¶å°åªè´´æ¿') |
| | | } catch (error) { |
| | | // éçº§æ¹æ¡ |
| | | const textArea = document.createElement('textarea') |
| | | textArea.value = content |
| | | document.body.appendChild(textArea) |
| | | textArea.select() |
| | | document.execCommand('copy') |
| | | document.body.removeChild(textArea) |
| | | ElMessage.success('å
容已å¤å¶å°åªè´´æ¿') |
| | | } |
| | | } |
| | | |
| | | const generateIdentifiers = () => { |
| | | if (!codeRule.value) { |
| | | ElMessage.warning('è¯·éæ©ç¼ç è§å') |
| | | return |
| | | } |
| | | |
| | | // çææ è¯çé»è¾ |
| | | const newIdentifiers = [] |
| | | for (let i = 1; i <= generateQuantity.value; i++) { |
| | | let identifierCode = '' |
| | | if (codeRule.value === '产åç¼ç +æ¹æ¬¡å·+åºå·') { |
| | | identifierCode = `${currentProduct.value.productCode}_${currentProduct.value.batchNo}_${String(i).padStart(3, '0')}` |
| | | } else if (codeRule.value === 'æ¶é´æ³+éæºæ°') { |
| | | identifierCode = `TS_${Date.now()}_${Math.floor(Math.random() * 1000)}` |
| | | } else if (codeRule.value === 'èªå®ä¹è§å') { |
| | | identifierCode = `${customPrefix.value || 'CUSTOM'}_${Date.now()}_${i}` |
| | | } |
| | | |
| | | newIdentifiers.push({ |
| | | id: Math.max(...identifierList.value.map(item => item.id)) + i, |
| | | productName: currentProduct.value.productName, |
| | | productCode: currentProduct.value.productCode, |
| | | batchNo: currentProduct.value.batchNo, |
| | | identifierType: currentProduct.value.identifierType, |
| | | identifierCode: identifierCode, |
| | | status: 'å·²çæ', |
| | | generateTime: new Date().toLocaleString(), |
| | | remark: 'æ¹éçæ' |
| | | }) |
| | | } |
| | | |
| | | identifierList.value.push(...newIdentifiers) |
| | | pagination.total += newIdentifiers.length |
| | | ElMessage.success(`æåçæ ${newIdentifiers.length} 个æ è¯`) |
| | | generateDialogVisible.value = false |
| | | } |
| | | |
| | | const saveReassign = () => { |
| | | if (!newBatchNo.value) { |
| | | ElMessage.warning('请è¾å
¥æ°æ¹æ¬¡å·') |
| | | return |
| | | } |
| | | |
| | | const index = identifierList.value.findIndex(item => item.id === currentProduct.value.id) |
| | | if (index > -1) { |
| | | identifierList.value[index].batchNo = newBatchNo.value |
| | | identifierList.value[index].status = 'å·²åé
' |
| | | ElMessage.success('æ è¯éæ°åé
æå') |
| | | reassignDialogVisible.value = false |
| | | } |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | | if (isEdit.value) { |
| | | // ç¼è¾ |
| | | const index = identifierList.value.findIndex(item => item.id === editId.value) |
| | | if (index > -1) { |
| | | identifierList.value[index] = { ...form, id: editId.value } |
| | | ElMessage.success('ç¼è¾æå') |
| | | identifierList.value.push({ |
| | | ...form, |
| | | id: newId, |
| | | identifierCode: identifierCode, |
| | | generateTime: new Date().toLocaleString(), |
| | | }); |
| | | pagination.total++; |
| | | ElMessage.success("æ°å¢æå"); |
| | | } |
| | | } else { |
| | | // æ°å¢ |
| | | const newId = Math.max(...identifierList.value.map(item => item.id)) + 1 |
| | | |
| | | // æ ¹æ®æ è¯ç±»åçæä¸åçæ è¯ç |
| | | let identifierCode = '' |
| | | if (form.identifierType === 'äºç»´ç ') { |
| | | identifierCode = `QR_${form.productCode}_${form.batchNo}_001` |
| | | } else if (form.identifierType === 'é²ä¼ªç ') { |
| | | identifierCode = `SEC_${form.productCode}_${form.batchNo}_001` |
| | | } |
| | | |
| | | identifierList.value.push({ |
| | | ...form, |
| | | id: newId, |
| | | identifierCode: identifierCode, |
| | | generateTime: new Date().toLocaleString() |
| | | }) |
| | | pagination.total++ |
| | | ElMessage.success('æ°å¢æå') |
| | | } |
| | | dialogVisible.value = false |
| | | } |
| | | }) |
| | | } |
| | | dialogVisible.value = false; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const handleCurrentChange = (val) => { |
| | | pagination.currentPage = val.page |
| | | pagination.pageSize = val.limit |
| | | } |
| | | const handleCurrentChange = val => { |
| | | pagination.currentPage = val.page; |
| | | pagination.pageSize = val.limit; |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .search-row { |
| | | margin-bottom: 20px; |
| | | } |
| | | .search-row { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .quick-actions-row { |
| | | margin-bottom: 20px; |
| | | } |
| | | .quick-actions-row { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .quick-actions-row .el-alert { |
| | | margin-bottom: 0; |
| | | } |
| | | .quick-actions-row .el-alert { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .quick-actions-row .el-alert p { |
| | | margin: 5px 0; |
| | | font-size: 14px; |
| | | line-height: 1.5; |
| | | } |
| | | .quick-actions-row .el-alert p { |
| | | margin: 5px 0; |
| | | font-size: 14px; |
| | | line-height: 1.5; |
| | | } |
| | | |
| | | /* äºç»´ç é¢è§æ ·å¼ */ |
| | | .qr-preview-container { |
| | | text-align: center; |
| | | padding: 20px; |
| | | } |
| | | /* äºç»´ç é¢è§æ ·å¼ */ |
| | | .qr-preview-container { |
| | | text-align: center; |
| | | padding: 20px; |
| | | } |
| | | |
| | | .qr-image-container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 20px; |
| | | } |
| | | .qr-image-container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 20px; |
| | | } |
| | | |
| | | .qr-image { |
| | | max-width: 100%; |
| | | height: auto; |
| | | border: 2px solid #e0e0e0; |
| | | border-radius: 8px; |
| | | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); |
| | | } |
| | | .qr-image { |
| | | max-width: 100%; |
| | | height: auto; |
| | | border: 2px solid #e0e0e0; |
| | | border-radius: 8px; |
| | | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .qr-info { |
| | | text-align: left; |
| | | background: #f8f9fa; |
| | | padding: 15px; |
| | | border-radius: 8px; |
| | | min-width: 300px; |
| | | } |
| | | .qr-info { |
| | | text-align: left; |
| | | background: #f8f9fa; |
| | | padding: 15px; |
| | | border-radius: 8px; |
| | | min-width: 300px; |
| | | } |
| | | |
| | | .qr-info p { |
| | | margin: 8px 0; |
| | | color: #666; |
| | | font-size: 14px; |
| | | } |
| | | .qr-info p { |
| | | margin: 8px 0; |
| | | color: #666; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .qr-loading { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 15px; |
| | | padding: 40px 0; |
| | | } |
| | | .qr-loading { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 15px; |
| | | padding: 40px 0; |
| | | } |
| | | |
| | | .qr-loading .el-icon { |
| | | font-size: 32px; |
| | | color: #409EFF; |
| | | } |
| | | .qr-loading .el-icon { |
| | | font-size: 32px; |
| | | color: #409eff; |
| | | } |
| | | |
| | | .qr-loading p { |
| | | color: #666; |
| | | margin: 0; |
| | | } |
| | | .qr-loading p { |
| | | color: #666; |
| | | margin: 0; |
| | | } |
| | | </style> |
| | |
| | | > |
| | | <el-button type="primary" @click="addRow" style="margin-bottom: 10px;">æ°å¢</el-button> |
| | | <span style="font-size: 18px;margin-left: 10px">å¾
æäº§æ°éï¼{{pendingNum}}</span> |
| | | <div style="margin-bottom: 10px; margin-left: 10px;"> |
| | | <el-form-item label="é¢ç¨ï¼" style="margin-bottom: 0;"> |
| | | <el-input v-model="receive" placeholder="请è¾å
¥é¢ç¨" style="width: 200px;" /> |
| | | </el-form-item> |
| | | </div> |
| | | <!-- <div style="margin-bottom: 10px; margin-left: 10px;">--> |
| | | <!-- <el-form-item label="é¢ç¨ï¼" style="margin-bottom: 0;">--> |
| | | <!-- <el-input v-model="receive" placeholder="请è¾å
¥é¢ç¨" style="width: 200px;" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </div>--> |
| | | <el-table :data="tableData" border style="width: 100%" :summary-method="summarizeMainTable" show-summary :row-key="row => row.id"> |
| | | <el-table-column label="åºå·" width="60" align="center"> |
| | | <template #default="scope"> |
| | |
| | | <el-table-column label="å·¥åº" prop="process" width="150"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.process" placeholder="请è¾å
¥å·¥åº" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="产线" prop="productionLine" width="150"> |
| | | <template #default="scope"> |
| | | <el-select |
| | | v-model="scope.row.productionLine" |
| | | placeholder="éæ©äº§çº¿" |
| | | style="width: 100%;" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="line in productionLines" |
| | | :key="line.value" |
| | | :label="line.label" |
| | | :value="line.value" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åä½" prop="unit" width="90"> |
| | |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æè" prop="loss" width="150"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.loss" placeholder="请è¾å
¥æè" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å·¥æ¶å®é¢" width="200" prop="workHours"> |
| | |
| | | v-model="scope.row.schedulingUserId" |
| | | placeholder="éæ©äººå" |
| | | style="width: 100%;" |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | > |
| | | <el-option |
| | | v-for="user in userList" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {ref, getCurrentInstance} from "vue"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {processScheduling} from "@/api/productionManagement/operationScheduling.js"; |
| | | const { proxy } = getCurrentInstance() |
| | |
| | | |
| | | const dialogFormVisible = ref(false); |
| | | const operationType = ref('') |
| | | const tableData = ref([ |
| | | { process: '', schedulingDate: '', schedulingNum: null, schedulingUserId: '', workHours: null, unit: '', remark: '', loss: '', type: '' } |
| | | ]); |
| | | const tableData = ref([]); |
| | | const unitFromRow = ref(''); |
| | | const idFromRow = ref(''); |
| | | const pendingNum = ref(''); |
| | | const specificationModelFromRow = ref(''); |
| | | const pendingNum = ref(0); |
| | | const userList = ref([]) |
| | | const receive = ref('') |
| | | const sunqianUserId = ref('') |
| | | // 产线é项 |
| | | const productionLines = ref([ |
| | | { label: '产线1', value: '产线1' }, |
| | | { label: '产线2', value: '产线2' }, |
| | | { label: '产线3', value: '产线3' }, |
| | | { label: '产线4', value: '产线4' } |
| | | ]) |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = (type, row) => { |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | pendingNum.value = row?.pendingNum ?? 0; |
| | | unitFromRow.value = row?.unit ?? ''; |
| | | idFromRow.value = row?.id ?? ''; |
| | | specificationModelFromRow.value = row?.specificationModel ?? ''; |
| | | |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | // æ¾å°åå©çç¨æ·ID并设置为é»è®¤å¼ |
| | | const sunqianUser = userList.value.find(user => user.nickName === 'åå©'); |
| | | if (sunqianUser) { |
| | | sunqianUserId.value = sunqianUser.userId; |
| | | } |
| | | // å¨ç¨æ·å表å è½½å®æååå»ºè¡æ°æ®ï¼å¹¶å°äº§çº¿æ°æ®å¸¦å
¥ |
| | | tableData.value = [createRow(row)]; |
| | | }); |
| | | pendingNum.value = row.pendingNum |
| | | if (row && row.unit !== undefined) { |
| | | unitFromRow.value = row.unit; |
| | | idFromRow.value = row.id; |
| | | tableData.value.forEach(item => { |
| | | item.unit = row.unit; |
| | | item.id = row.id; |
| | | }); |
| | | } else { |
| | | unitFromRow.value = ''; |
| | | } |
| | | } |
| | | |
| | | const createRow = (row) => ({ |
| | | id: idFromRow.value, |
| | | process: 'å
è£
', |
| | | schedulingDate: '', |
| | | schedulingNum: null, |
| | | schedulingUserId: sunqianUserId.value, // é»è®¤è®¾ç½®ä¸ºåå©çç¨æ·ID |
| | | workHours: null, |
| | | unit: unitFromRow.value, |
| | | remark: '', |
| | | type: specificationModelFromRow.value, |
| | | productionLine: row?.productionLine ?? '', // ä»è¡æ°æ®ä¸è·åäº§çº¿ä¿¡æ¯ |
| | | }); |
| | | |
| | | const submitForm = () => { |
| | | // 1. æ£æ¥æ¯ä¸è¡æ¯å¦å¡«å宿´ |
| | | for (let i = 0; i < tableData.value.length; i++) { |
| | |
| | | row.schedulingNum === '' || row.schedulingNum === null || |
| | | !row.schedulingUserId || |
| | | row.workHours === '' || row.workHours === null || |
| | | !row.unit |
| | | !row.unit || |
| | | !row.productionLine |
| | | ) { |
| | | proxy.$modal.msgError(`第${i + 1}è¡æ°æ®æªå¡«å宿´`); |
| | | return; |
| | |
| | | proxy.$modal.msgError('æäº§æ°éå计ä¸è½è¶
è¿å¾
æäº§æ°é'); |
| | | return; |
| | | } |
| | | // 3. å° receive åæ®µæ·»å å°æ¯æ¡æ°æ®ä¸ |
| | | const submitData = tableData.value.map(row => ({ |
| | | ...row, |
| | | receive: receive.value |
| | | })); |
| | | // 3. å° receive åæ®µæ·»å å°æ¯æ¡æ°æ®ä¸ï¼å¹¶ç§»é¤ loss åæ®µ |
| | | const submitData = tableData.value.map(row => { |
| | | const { loss, ...rest } = row; |
| | | return { |
| | | ...rest, |
| | | receive: receive.value |
| | | }; |
| | | }); |
| | | processScheduling(submitData).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | |
| | | const closeDia = () => { |
| | | dialogFormVisible.value = false; |
| | | receive.value = ''; |
| | | tableData.value = []; |
| | | unitFromRow.value = ''; |
| | | idFromRow.value = ''; |
| | | specificationModelFromRow.value = ''; |
| | | pendingNum.value = 0; |
| | | emit('close') |
| | | }; |
| | | defineExpose({ |
| | |
| | | }); |
| | | |
| | | const addRow = () => { |
| | | tableData.value.push({ id: idFromRow.value, process: '', unit: unitFromRow.value, schedulingNum: null, workHours: null, schedulingDate: '', schedulingUserId: '', remark: '', loss: '', type: '' }); |
| | | tableData.value.push(createRow()); |
| | | }; |
| | | const removeRow = (index) => { |
| | | tableData.value.splice(index, 1); |
| | |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="项ç®åç§°:"> |
| | | <el-input v-model="searchForm.projectName" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | <el-form-item label="ååå·:"> |
| | | <el-input v-model="searchForm.salesContractNo" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="项ç®åç§°:">--> |
| | | <!-- <el-input v-model="searchForm.projectName" placeholder="请è¾å
¥" clearable prefix-icon="Search"--> |
| | | <!-- style="width: 200px;"--> |
| | | <!-- @change="handleQuery" />--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="æ´¾å·¥æ¥æ:"> |
| | | <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange" |
| | | placeholder="è¯·éæ©" clearable @change="changeDaterange" /> |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | staffName: "", |
| | | customerName: "", |
| | | salesContractNo: "", |
| | | status: 1, |
| | | entryDate: null, // å½å
¥æ¥æ |
| | | entryDateStart: undefined, |
| | | entryDateEnd: undefined, |
| | | entryDate: [dayjs().format("YYYY-MM-DD"), dayjs().format("YYYY-MM-DD")], // å½å
¥æ¥æï¼é»è®¤å½å¤© |
| | | entryDateStart: dayjs().format("YYYY-MM-DD"), |
| | | entryDateEnd: dayjs().format("YYYY-MM-DD"), |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | |
| | | { |
| | | label: "æ´¾å·¥æ¥æ", |
| | | prop: "schedulingDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "派工人", |
| | | prop: "schedulingUserName", |
| | | }, |
| | | { |
| | | label: "ååå·", |
| | | prop: "salesContractNo", |
| | | width: 200, |
| | | }, |
| | | // { |
| | | // label: "客æ·ååå·", |
| | | // prop: "customerContractNo", |
| | | // width: 200, |
| | | // }, |
| | | { |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | width: 200, |
| | | }, |
| | | // { |
| | | // label: "项ç®åç§°", |
| | | // prop: "projectName", |
| | | // width:300 |
| | | // }, |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "ç»å®æºå¨", |
| | | prop: "speculativeTradingName", |
| | | width: 220, |
| | | }, |
| | | // { |
| | | // label: "产线", |
| | | // prop: "productionLine", |
| | | // width: 220, |
| | | // }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("åæ¶æäº§æå"); |
| | | getList(); |
| | | }).catch(() => { |
| | | getList(); |
| | | }) |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="ç¼è¾å·¥èºè·¯çº¿" |
| | | width="400" |
| | | @close="closeModal" |
| | | > |
| | | <el-form label-width="140px" :model="formState" label-position="top" ref="formRef"> |
| | | <el-form-item |
| | | label="产ååç§°" |
| | | prop="productModelId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©äº§å', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-button type="primary" @click="showProductSelectDialog = true"> |
| | | {{ formState.productName && formState.productModelName |
| | | ? `${formState.productName} - ${formState.productModelName}` |
| | | : 'éæ©äº§å' }} |
| | | </el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="BOM" |
| | | prop="bomId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©BOM', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select |
| | | v-model="formState.bomId" |
| | | placeholder="è¯·éæ©BOM" |
| | | clearable |
| | | :disabled="!formState.productModelId || bomOptions.length === 0" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in bomOptions" |
| | | :key="item.id" |
| | | :label="item.bomNo || `BOM-${item.id}`" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="夿³¨" prop="description"> |
| | | <el-input v-model="formState.description" type="textarea" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- 产åéæ©å¼¹çª --> |
| | | <ProductSelectDialog |
| | | v-model="showProductSelectDialog" |
| | | @confirm="handleProductSelect" |
| | | single |
| | | /> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, computed, getCurrentInstance, onMounted, nextTick, watch} from "vue"; |
| | | import {update} from "@/api/productionManagement/processRoute.js"; |
| | | import {getByModel} from "@/api/productionManagement/productBom.js"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | |
| | | record: { |
| | | type: Object, |
| | | required: true, |
| | | } |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | // ååºå¼æ°æ®ï¼æ¿ä»£é项å¼ç dataï¼ |
| | | const formState = ref({ |
| | | productId: undefined, |
| | | productModelId: undefined, |
| | | productName: "", |
| | | productModelName: "", |
| | | bomId: undefined, |
| | | description: '', |
| | | }); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | }, |
| | | }); |
| | | |
| | | const showProductSelectDialog = ref(false); |
| | | const bomOptions = ref([]); |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | // è®¾ç½®è¡¨åæ°æ® |
| | | const setFormData = () => { |
| | | if (props.record) { |
| | | formState.value = { |
| | | ...props.record, |
| | | productId: props.record.productId, |
| | | productModelId: props.record.productModelId, |
| | | productName: props.record.productName || "", |
| | | // 注æï¼recordä¸çåæ®µæ¯modelï¼éè¦æ å°å°productModelName |
| | | productModelName: props.record.model || props.record.productModelName || "", |
| | | bomId: props.record.bomId, |
| | | description: props.record.description || '', |
| | | }; |
| | | // 妿æäº§ååå·IDï¼å è½½BOMå表 |
| | | if (props.record.productModelId) { |
| | | loadBomList(props.record.productModelId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å è½½BOMå表 |
| | | const loadBomList = async (productModelId) => { |
| | | if (!productModelId) { |
| | | bomOptions.value = []; |
| | | return; |
| | | } |
| | | try { |
| | | const res = await getByModel(productModelId); |
| | | // å¤çè¿åçBOMæ°æ®ï¼å¯è½æ¯æ°ç»ã对象æå
å«dataåæ®µ |
| | | let bomList = []; |
| | | if (Array.isArray(res)) { |
| | | bomList = res; |
| | | } else if (res && res.data) { |
| | | bomList = Array.isArray(res.data) ? res.data : [res.data]; |
| | | } else if (res && typeof res === 'object') { |
| | | bomList = [res]; |
| | | } |
| | | bomOptions.value = bomList; |
| | | } catch (error) { |
| | | console.error("å è½½BOMå表失败ï¼", error); |
| | | bomOptions.value = []; |
| | | } |
| | | }; |
| | | |
| | | // 产åéæ©å¤ç |
| | | const handleProductSelect = async (products) => { |
| | | if (products && products.length > 0) { |
| | | const product = products[0]; |
| | | // å
æ¥è¯¢BOMå表ï¼å¿
éï¼ |
| | | try { |
| | | const res = await getByModel(product.id); |
| | | // å¤çè¿åçBOMæ°æ®ï¼å¯è½æ¯æ°ç»ã对象æå
å«dataåæ®µ |
| | | let bomList = []; |
| | | if (Array.isArray(res)) { |
| | | bomList = res; |
| | | } else if (res && res.data) { |
| | | bomList = Array.isArray(res.data) ? res.data : [res.data]; |
| | | } else if (res && typeof res === 'object') { |
| | | bomList = [res]; |
| | | } |
| | | |
| | | if (bomList.length > 0) { |
| | | formState.value.productModelId = product.id; |
| | | formState.value.productName = product.productName; |
| | | formState.value.productModelName = product.model; |
| | | // 妿å½åéæ©çBOMä¸å¨æ°å表ä¸ï¼åéç½®BOMéæ© |
| | | const currentBomExists = bomList.some(bom => bom.id === formState.value.bomId); |
| | | if (!currentBomExists) { |
| | | formState.value.bomId = undefined; |
| | | } |
| | | bomOptions.value = bomList; |
| | | showProductSelectDialog.value = false; |
| | | // 触å表åéªè¯æ´æ° |
| | | proxy.$refs["formRef"]?.validateField('productModelId'); |
| | | } else { |
| | | proxy.$modal.msgError("è¯¥äº§åæ²¡æBOMï¼è¯·å
å建BOM"); |
| | | } |
| | | } catch (error) { |
| | | // 妿æ¥å£è¿å404æå
¶ä»é误ï¼è¯´ææ²¡æBOM |
| | | proxy.$modal.msgError("è¯¥äº§åæ²¡æBOMï¼è¯·å
å建BOM"); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | // éªè¯æ¯å¦éæ©äºäº§ååBOM |
| | | if (!formState.value.productModelId) { |
| | | proxy.$modal.msgError("è¯·éæ©äº§å"); |
| | | return; |
| | | } |
| | | if (!formState.value.bomId) { |
| | | proxy.$modal.msgError("è¯·éæ©BOM"); |
| | | return; |
| | | } |
| | | update(formState.value).then(res => { |
| | | // å
³éæ¨¡ææ¡ |
| | | isShow.value = false; |
| | | // åç¥ç¶ç»ä»¶å·²å®æ |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | }) |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | |
| | | |
| | | // çå¬å¼¹çªæå¼ï¼åå§åè¡¨åæ°æ® |
| | | watch(() => props.visible, (visible) => { |
| | | if (visible && props.record) { |
| | | nextTick(() => { |
| | | setFormData(); |
| | | }); |
| | | } |
| | | }, { immediate: true }); |
| | | |
| | | onMounted(() => { |
| | | if (props.visible && props.record) { |
| | | setFormData(); |
| | | } |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="å·¥èºè·¯çº¿é¡¹ç®" |
| | | width="800px" |
| | | @close="closeModal" |
| | | > |
| | | <div class="operate-button"> |
| | | <el-button |
| | | type="primary" |
| | | @click="isShowProductSelectDialog = true" |
| | | class="mb5" |
| | | style="margin-bottom: 10px;" |
| | | > |
| | | éæ©äº§å |
| | | </el-button> |
| | | |
| | | <el-switch |
| | | v-model="isTable" |
| | | inline-prompt |
| | | active-text="è¡¨æ ¼" |
| | | inactive-text="å表" |
| | | @change="handleViewChange" |
| | | /> |
| | | </div> |
| | | |
| | | <el-table |
| | | v-if="isTable" |
| | | ref="multipleTable" |
| | | v-loading="tableLoading" |
| | | border |
| | | :data="routeItems" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | row-key="id" |
| | | tooltip-effect="dark" |
| | | class="lims-table" |
| | | style="cursor: move;" |
| | | > |
| | | <el-table-column align="center" label="åºå·" width="60"> |
| | | <template #default="scope"> |
| | | {{ scope.$index + 1 }} |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | v-for="(item, index) in tableColumn" |
| | | :key="index" |
| | | :label="item.label" |
| | | :width="item.width" |
| | | show-overflow-tooltip |
| | | > |
| | | <template #default="scope" v-if="item.dataType === 'action'"> |
| | | <el-button |
| | | v-for="(op, opIndex) in item.operation" |
| | | :key="opIndex" |
| | | :type="op.type" |
| | | :link="op.link" |
| | | size="small" |
| | | @click.stop="op.clickFun(scope.row)" |
| | | > |
| | | {{ op.name }} |
| | | </el-button> |
| | | </template> |
| | | |
| | | <template #default="scope" v-else> |
| | | <template v-if="item.prop === 'processId'"> |
| | | <el-select |
| | | v-model="scope.row[item.prop]" |
| | | style="width: 100%;" |
| | | @mousedown.stop |
| | | > |
| | | <el-option |
| | | v-for="process in processOptions" |
| | | :key="process.id" |
| | | :label="process.name" |
| | | :value="process.id" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | <template v-else> |
| | | {{ scope.row[item.prop] || '-' }} |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- ä½¿ç¨æ®édivæ¿ä»£el-steps --> |
| | | <div |
| | | v-else |
| | | ref="stepsContainer" |
| | | class="mb5 custom-steps" |
| | | style="padding: 10px 0; display: flex; flex-wrap: nowrap; gap: 20px; align-items: flex-start;" |
| | | > |
| | | <div |
| | | v-for="(item, index) in routeItems" |
| | | :key="item.id" |
| | | class="custom-step draggable-step" |
| | | :data-id="item.id" |
| | | style="cursor: move; flex: 0 0 auto; min-width: 220px;" |
| | | > |
| | | <div class="step-content"> |
| | | <div class="step-number">{{ index + 1 }}</div> |
| | | <el-card |
| | | :header="item.productName" |
| | | class="step-card" |
| | | style="cursor: move;" |
| | | > |
| | | <div class="step-card-content"> |
| | | <p>{{ item.model }}</p> |
| | | <p>{{ item.unit }}</p> |
| | | <el-select |
| | | v-model="item.processId" |
| | | style="width: 100%;" |
| | | @mousedown.stop |
| | | > |
| | | <el-option |
| | | v-for="process in processOptions" |
| | | :key="process.id" |
| | | :label="process.name" |
| | | :value="process.id" |
| | | /> |
| | | </el-select> |
| | | </div> |
| | | <template #footer> |
| | | <div class="step-card-footer"> |
| | | <el-button type="danger" link size="small" @click.stop="removeItemByID(item.id)">å é¤</el-button> |
| | | </div> |
| | | </template> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <ProductSelectDialog |
| | | v-model="isShowProductSelectDialog" |
| | | @confirm="handelSelectProducts" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, getCurrentInstance, onMounted, onUnmounted, nextTick } from "vue"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import { findProcessRouteItemList, addOrUpdateProcessRouteItem } from "@/api/productionManagement/processRouteItem.js"; |
| | | import { processList } from "@/api/productionManagement/productionProcess.js"; |
| | | import Sortable from 'sortablejs'; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | default: false |
| | | }, |
| | | record: { |
| | | type: Object, |
| | | required: true, |
| | | default: () => ({}) |
| | | } |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | const processOptions = ref([]); |
| | | const tableLoading = ref(false); |
| | | const isShowProductSelectDialog = ref(false); |
| | | const routeItems = ref([]); |
| | | let tableSortable = null; |
| | | let stepsSortable = null; |
| | | const multipleTable = ref(null); |
| | | const stepsContainer = ref(null); |
| | | const isTable = ref(true); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | } |
| | | }); |
| | | |
| | | const tableColumn = ref([ |
| | | { label: "产ååç§°", prop: "productName", width: 180 }, |
| | | { label: "è§æ ¼åç§°", prop: "model", width: 150 }, |
| | | { label: "åä½", prop: "unit", width: 80 }, |
| | | { label: "å·¥åºåç§°", prop: "processId", width: 180 }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 100, |
| | | operation: [ |
| | | { |
| | | name: "å é¤", |
| | | type: "danger", |
| | | link: true, |
| | | clickFun: (row) => { |
| | | const idx = routeItems.value.findIndex(item => item.id === row.id); |
| | | if (idx > -1) { |
| | | removeItem(idx) |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | ]); |
| | | |
| | | const removeItem = (index) => { |
| | | routeItems.value.splice(index, 1); |
| | | nextTick(() => initSortable()); |
| | | }; |
| | | |
| | | const removeItemByID = (id) => { |
| | | const idx = routeItems.value.findIndex(item => item.id === id); |
| | | if (idx > -1) { |
| | | routeItems.value.splice(idx, 1); |
| | | nextTick(() => initSortable()); |
| | | } |
| | | }; |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | const handelSelectProducts = (products) => { |
| | | destroySortable(); |
| | | |
| | | const newData = products.map(({ id, ...product }) => ({ |
| | | ...product, |
| | | productModelId: id, |
| | | routeId: props.record.id, |
| | | id: `${Date.now()}-${Math.random().toString(36).slice(2)}`, |
| | | processId: undefined |
| | | })); |
| | | |
| | | console.log('éæ©äº§ååæ°ç»:', routeItems.value); |
| | | routeItems.value.push(...newData); |
| | | routeItems.value = [...routeItems.value]; |
| | | console.log('éæ©äº§ååæ°ç»:', routeItems.value); |
| | | |
| | | // å»¶è¿åå§åï¼ç¡®ä¿DOMå®å
¨æ¸²æ |
| | | nextTick(() => { |
| | | // 强å¶éæ°æ¸²æç»ä»¶ |
| | | if (proxy?.$forceUpdate) { |
| | | proxy.$forceUpdate(); |
| | | } |
| | | |
| | | const temp = [...routeItems.value]; |
| | | routeItems.value = []; |
| | | nextTick(() => { |
| | | routeItems.value = temp; |
| | | initSortable(); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const findProcessRouteItems = () => { |
| | | tableLoading.value = true; |
| | | findProcessRouteItemList({ routeId: props.record.id }) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | routeItems.value = res.data.map(item => ({ |
| | | ...item, |
| | | processId: item.processId === 0 ? undefined : item.processId |
| | | })); |
| | | // å»¶è¿åå§åï¼ç¡®ä¿DOMå®å
¨æ¸²æ |
| | | nextTick(() => { |
| | | setTimeout(() => initSortable(), 100); |
| | | }); |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | | console.error("è·åå表失败ï¼", err); |
| | | }); |
| | | }; |
| | | |
| | | const findProcessList = () => { |
| | | processList({}) |
| | | .then(res => { |
| | | processOptions.value = res.data; |
| | | }) |
| | | .catch(err => { |
| | | console.error("è·åå·¥åºå¤±è´¥ï¼", err); |
| | | }); |
| | | }; |
| | | |
| | | const { proxy } = getCurrentInstance() || {}; |
| | | |
| | | const handleSubmit = () => { |
| | | const hasEmptyProcess = routeItems.value.some(item => !item.processId); |
| | | if (hasEmptyProcess) { |
| | | proxy?.$modal?.msgError("请为ææé¡¹ç®éæ©å·¥åº"); |
| | | return; |
| | | } |
| | | |
| | | addOrUpdateProcessRouteItem({ |
| | | routeId: props.record.id, |
| | | processRouteItem: routeItems.value.map(({ id, ...item }) => item) |
| | | }) |
| | | .then(res => { |
| | | isShow.value = false; |
| | | emit('completed'); |
| | | proxy?.$modal?.msgSuccess("æäº¤æå"); |
| | | }) |
| | | .catch(err => { |
| | | proxy?.$modal?.msgError(`æäº¤å¤±è´¥ï¼${err.msg || "ç½ç»å¼å¸¸"}`); |
| | | }); |
| | | }; |
| | | |
| | | const destroySortable = () => { |
| | | if (tableSortable) { |
| | | tableSortable.destroy(); |
| | | tableSortable = null; |
| | | } |
| | | if (stepsSortable) { |
| | | stepsSortable.destroy(); |
| | | stepsSortable = null; |
| | | } |
| | | }; |
| | | |
| | | const initSortable = () => { |
| | | destroySortable(); |
| | | |
| | | if (isTable.value) { |
| | | if (!multipleTable.value) return; |
| | | const tbody = multipleTable.value.$el.querySelector('.el-table__body tbody') || |
| | | multipleTable.value.$el.querySelector('.el-table__body-wrapper > table > tbody'); |
| | | if (!tbody) return; |
| | | |
| | | tableSortable = new Sortable(tbody, { |
| | | animation: 150, |
| | | ghostClass: 'sortable-ghost', |
| | | handle: '.el-table__row', |
| | | filter: '.el-button, .el-select', |
| | | onEnd: (evt) => { |
| | | if (evt.oldIndex === evt.newIndex || !routeItems.value[evt.oldIndex]) return; |
| | | |
| | | // ä½¿ç¨æ°ç» splice æ¹æ³éæ°æåºï¼ä¸è¡¨æ ¼æ¨¡å¼ä¿æä¸è´ |
| | | const moveItem = routeItems.value.splice(evt.oldIndex, 1)[0]; |
| | | routeItems.value.splice(evt.newIndex, 0, moveItem); |
| | | routeItems.value = [...routeItems.value]; |
| | | console.log('æåºåæ°ç»:', routeItems.value); |
| | | } |
| | | }); |
| | | } else { |
| | | if (!stepsContainer.value) return; |
| | | |
| | | // ä¿®æ¹ï¼ç´æ¥ä½¿ç¨stepsContainer.valueä½ä¸ºææ½å®¹å¨ |
| | | const stepsList = stepsContainer.value; |
| | | if (!stepsList) { |
| | | console.warn('æªæ¾å°æ¥éª¤æ¡ææ½å®¹å¨'); |
| | | return; |
| | | } |
| | | |
| | | // ä¿®æ¹ï¼ç®åææ½é
ç½® |
| | | stepsSortable = new Sortable(stepsList, { |
| | | animation: 150, |
| | | ghostClass: 'sortable-ghost', |
| | | draggable: '.draggable-step', // 坿æ½å
ç´ |
| | | handle: '.draggable-step, .step-card', // ææ½ææ |
| | | filter: '.el-button, .el-select, .el-input', // è¿æ»¤æé®/éæ©å¨ |
| | | forceFallback: true, |
| | | fallbackClass: 'sortable-fallback', |
| | | preventOnFilter: true, |
| | | scroll: true, |
| | | scrollSensitivity: 30, |
| | | scrollSpeed: 10, |
| | | bubbleScroll: true, |
| | | onEnd: (evt) => { |
| | | if (evt.oldIndex === evt.newIndex || !routeItems.value[evt.oldIndex]) return; |
| | | |
| | | // ä½¿ç¨æ°ç» splice æ¹æ³éæ°æåº |
| | | const moveItem = routeItems.value.splice(evt.oldIndex, 1)[0]; |
| | | routeItems.value.splice(evt.newIndex, 0, moveItem); |
| | | routeItems.value = [...routeItems.value]; |
| | | } |
| | | }); |
| | | |
| | | // è°è¯ï¼æå°å®¹å¨åå®ä¾ï¼ç¡®è®¤ç»å®æå |
| | | console.log('æ¥éª¤æ¡ææ½å®¹å¨:', stepsList); |
| | | console.log('Sortableå®ä¾:', stepsSortable); |
| | | } |
| | | }; |
| | | |
| | | const handleViewChange = () => { |
| | | destroySortable(); |
| | | // å»¶è¿åå§åï¼ç¡®ä¿è§å¾åæ¢åDOMå®å
¨æ¸²æ |
| | | nextTick(() => { |
| | | setTimeout(() => initSortable(), 100); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | findProcessRouteItems(); |
| | | findProcessList(); |
| | | }); |
| | | |
| | | onUnmounted(() => { |
| | | destroySortable(); |
| | | }); |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | :deep(.sortable-ghost) { |
| | | opacity: 0.6; |
| | | background-color: #f5f7fa !important; |
| | | } |
| | | |
| | | :deep(.el-table__row) { |
| | | transition: background-color 0.2s; |
| | | } |
| | | |
| | | :deep(.el-table__row:hover) { |
| | | background-color: #f9fafc !important; |
| | | } |
| | | |
| | | :deep(.el-card__footer){ |
| | | padding: 0 !important; |
| | | } |
| | | |
| | | .operate-button { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | /* ä¿®æ¹ï¼èªå®ä¹æ¥éª¤æ¡å®¹å¨æ ·å¼ */ |
| | | .custom-steps { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | align-items: flex-start; |
| | | gap: 20px; |
| | | min-height: 100px; |
| | | } |
| | | |
| | | /* ä¿®æ¹ï¼èªå®ä¹æ¥éª¤é¡¹æ ·å¼ */ |
| | | .custom-step { |
| | | cursor: move !important; |
| | | padding: 8px; |
| | | position: relative; |
| | | transition: all 0.2s ease; |
| | | flex: 0 0 auto; |
| | | min-width: 220px; |
| | | touch-action: none; |
| | | } |
| | | |
| | | /* ææ½æ¬æµ®æ ·å¼ï¼æç¤ºå¯ææ½ */ |
| | | .custom-step:hover { |
| | | background-color: rgba(64, 158, 255, 0.05); |
| | | transform: translateY(-2px); |
| | | } |
| | | |
| | | .sortable-ghost { |
| | | opacity: 0.4; |
| | | background-color: #f5f7fa !important; |
| | | border: 2px dashed #409eff; |
| | | margin: 10px; |
| | | transform: scale(1.02); |
| | | } |
| | | |
| | | .sortable-fallback { |
| | | opacity: 0.9; |
| | | background-color: #f5f7fa; |
| | | border: 1px solid #409eff; |
| | | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); |
| | | transform: rotate(2deg); |
| | | margin: 10px; |
| | | } |
| | | |
| | | .step-card { |
| | | cursor: move !important; |
| | | transition: box-shadow 0.2s ease; |
| | | user-select: none; |
| | | -webkit-user-select: none; |
| | | pointer-events: auto; |
| | | margin: 10px; |
| | | height: 240px; |
| | | } |
| | | |
| | | .step-card:hover { |
| | | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .step-content { |
| | | width: 220px; |
| | | user-select: none; |
| | | } |
| | | |
| | | .step-card-content { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | } |
| | | |
| | | .step-card-footer { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | padding: 10px; |
| | | } |
| | | |
| | | /* èªå®ä¹åºå·æ ·å¼ä¼å */ |
| | | .step-number { |
| | | font-weight: bold; |
| | | text-align: center; |
| | | width: 36px; |
| | | height: 36px; |
| | | line-height: 36px; |
| | | margin: 0 auto 10px; |
| | | background: #409eff; |
| | | color: #fff; |
| | | border-radius: 50%; |
| | | font-size: 14px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="æ°å¢å·¥èºè·¯çº¿" |
| | | width="400" |
| | | @close="closeModal" |
| | | > |
| | | <el-form label-width="140px" :model="formState" label-position="top" ref="formRef"> |
| | | <el-form-item |
| | | label="产ååç§°" |
| | | prop="productModelId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©äº§å', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-button type="primary" @click="showProductSelectDialog = true"> |
| | | {{ formState.productName && formState.productModelName |
| | | ? `${formState.productName} - ${formState.productModelName}` |
| | | : 'éæ©äº§å' }} |
| | | </el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="BOM" |
| | | prop="bomId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©BOM', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select |
| | | v-model="formState.bomId" |
| | | placeholder="è¯·éæ©BOM" |
| | | clearable |
| | | :disabled="!formState.productModelId || bomOptions.length === 0" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in bomOptions" |
| | | :key="item.id" |
| | | :label="item.bomNo || `BOM-${item.id}`" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="夿³¨" prop="description"> |
| | | <el-input v-model="formState.description" type="textarea" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- 产åéæ©å¼¹çª --> |
| | | <ProductSelectDialog |
| | | v-model="showProductSelectDialog" |
| | | @confirm="handleProductSelect" |
| | | single |
| | | /> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, computed, getCurrentInstance} from "vue"; |
| | | import {add} from "@/api/productionManagement/processRoute.js"; |
| | | import {getByModel} from "@/api/productionManagement/productBom.js"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | // ååºå¼æ°æ®ï¼æ¿ä»£é项å¼ç dataï¼ |
| | | const formState = ref({ |
| | | productId: undefined, |
| | | productModelId: undefined, |
| | | productName: "", |
| | | productModelName: "", |
| | | bomId: undefined, |
| | | description: '', |
| | | }); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | }, |
| | | }); |
| | | |
| | | const showProductSelectDialog = ref(false); |
| | | const bomOptions = ref([]); |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | |
| | | const closeModal = () => { |
| | | // éç½®è¡¨åæ°æ® |
| | | formState.value = { |
| | | productId: undefined, |
| | | productModelId: undefined, |
| | | productName: "", |
| | | productModelName: "", |
| | | bomId: undefined, |
| | | description: '', |
| | | }; |
| | | bomOptions.value = []; |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | // 产åéæ©å¤ç |
| | | const handleProductSelect = async (products) => { |
| | | if (products && products.length > 0) { |
| | | const product = products[0]; |
| | | // å
æ¥è¯¢BOMå表ï¼å¿
éï¼ |
| | | try { |
| | | const res = await getByModel(product.id); |
| | | // å¤çè¿åçBOMæ°æ®ï¼å¯è½æ¯æ°ç»ã对象æå
å«dataåæ®µ |
| | | let bomList = []; |
| | | if (Array.isArray(res)) { |
| | | bomList = res; |
| | | } else if (res && res.data) { |
| | | bomList = Array.isArray(res.data) ? res.data : [res.data]; |
| | | } else if (res && typeof res === 'object') { |
| | | bomList = [res]; |
| | | } |
| | | |
| | | if (bomList.length > 0) { |
| | | formState.value.productModelId = product.id; |
| | | formState.value.productName = product.productName; |
| | | formState.value.productModelName = product.model; |
| | | formState.value.bomId = undefined; // éç½®BOMéæ© |
| | | bomOptions.value = bomList; |
| | | showProductSelectDialog.value = false; |
| | | // 触å表åéªè¯æ´æ° |
| | | proxy.$refs["formRef"]?.validateField('productModelId'); |
| | | } else { |
| | | proxy.$modal.msgError("è¯¥äº§åæ²¡æBOMï¼è¯·å
å建BOM"); |
| | | } |
| | | } catch (error) { |
| | | // 妿æ¥å£è¿å404æå
¶ä»é误ï¼è¯´ææ²¡æBOM |
| | | proxy.$modal.msgError("è¯¥äº§åæ²¡æBOMï¼è¯·å
å建BOM"); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | // éªè¯æ¯å¦éæ©äºäº§ååBOM |
| | | if (!formState.value.productModelId) { |
| | | proxy.$modal.msgError("è¯·éæ©äº§å"); |
| | | return; |
| | | } |
| | | if (!formState.value.bomId) { |
| | | proxy.$modal.msgError("è¯·éæ©BOM"); |
| | | return; |
| | | } |
| | | add(formState.value).then(res => { |
| | | // å
³éæ¨¡ææ¡ |
| | | isShow.value = false; |
| | | // åç¥ç¶ç»ä»¶å·²å®æ |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | }) |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="è§æ ¼åç§°:"> |
| | | <el-input v-model="searchForm.model" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" class="mb10"> |
| | | <el-button type="primary" @click="showNewModal">æ°å¢å·¥èºè·¯çº¿</el-button> |
| | | <el-button type="danger" @click="handleDelete" :disabled="selectedRows.length === 0" plain>å é¤å·¥èºè·¯çº¿</el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total" |
| | | /> |
| | | </div> |
| | | <new-process |
| | | v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | @completed="getList" |
| | | /> |
| | | |
| | | <edit-process |
| | | v-if="isShowEditModal" |
| | | v-model:visible="isShowEditModal" |
| | | :record="record" |
| | | @completed="getList" |
| | | /> |
| | | |
| | | <route-item-form |
| | | v-if="isShowItemModal" |
| | | v-model:visible="isShowItemModal" |
| | | :record="record" |
| | | @completed="getList" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {onMounted, ref} from "vue"; |
| | | import NewProcess from "@/views/productionManagement/processRoute/New.vue"; |
| | | import EditProcess from "@/views/productionManagement/processRoute/Edit.vue"; |
| | | import RouteItemForm from "@/views/productionManagement/processRoute/ItemsForm.vue"; |
| | | import {listPage, del} from "@/api/productionManagement/processRoute.js"; |
| | | import { useRouter } from 'vue-router' |
| | | |
| | | const router = useRouter() |
| | | const data = reactive({ |
| | | searchForm: { |
| | | model: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "å·¥èºè·¯çº¿ç¼å·", |
| | | prop: "processRouteCode", |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | }, |
| | | { |
| | | label: "è§æ ¼åç§°", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "BOMç¼å·", |
| | | prop: "bomNo", |
| | | }, |
| | | { |
| | | label: "æè¿°", |
| | | prop: "description", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 280, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | showEditModal(row); |
| | | } |
| | | }, |
| | | { |
| | | name: "路线项ç®", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | showItemModal(row); |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const isShowNewModal = ref(false); |
| | | const isShowEditModal = ref(false); |
| | | const isShowItemModal = ref(false); |
| | | const record = ref({}); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | params.entryDate = undefined |
| | | listPage(params).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records.map(item => ({ |
| | | ...item, |
| | | })); |
| | | page.total = res.data.total; |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // æå¼æ°å¢å¼¹æ¡ |
| | | const showNewModal = () => { |
| | | isShowNewModal.value = true |
| | | }; |
| | | |
| | | const showEditModal = (row) => { |
| | | isShowEditModal.value = true |
| | | record.value = row |
| | | }; |
| | | |
| | | const showItemModal = (row) => { |
| | | router.push({ |
| | | path: '/productionManagement/processRouteItem', |
| | | query: { |
| | | id: row.id, |
| | | processRouteCode: row.processRouteCode || '', |
| | | productName: row.productName || '', |
| | | model: row.model || '', |
| | | bomNo: row.bomNo || '', |
| | | description: row.description || '', |
| | | type: 'route', |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | // å é¤ |
| | | function handleDelete() { |
| | | const ids = selectedRows.value.map((item) => item.id); |
| | | proxy.$modal |
| | | .confirm('æ¯å¦ç¡®è®¤å é¤å·²å¾éçæ°æ®é¡¹ï¼') |
| | | .then(function () { |
| | | return del(ids); |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <PageHeader content="å·¥èºè·¯çº¿é¡¹ç®" /> |
| | | |
| | | <!-- å·¥èºè·¯çº¿ä¿¡æ¯å±ç¤º --> |
| | | <el-card v-if="routeInfo.processRouteCode" class="route-info-card" shadow="hover"> |
| | | <div class="route-info"> |
| | | <div class="info-item"> |
| | | <div class="info-label-wrapper"> |
| | | <span class="info-label">å·¥èºè·¯çº¿ç¼å·</span> |
| | | </div> |
| | | <div class="info-value-wrapper"> |
| | | <span class="info-value">{{ routeInfo.processRouteCode }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-item"> |
| | | <div class="info-label-wrapper"> |
| | | <span class="info-label">产ååç§°</span> |
| | | </div> |
| | | <div class="info-value-wrapper"> |
| | | <span class="info-value">{{ routeInfo.productName || '-' }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-item"> |
| | | <div class="info-label-wrapper"> |
| | | <span class="info-label">è§æ ¼åç§°</span> |
| | | </div> |
| | | <div class="info-value-wrapper"> |
| | | <span class="info-value">{{ routeInfo.model || '-' }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-item"> |
| | | <div class="info-label-wrapper"> |
| | | <span class="info-label">BOMç¼å·</span> |
| | | </div> |
| | | <div class="info-value-wrapper"> |
| | | <span class="info-value">{{ routeInfo.bomNo || '-' }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-item full-width" v-if="routeInfo.description"> |
| | | <div class="info-label-wrapper"> |
| | | <span class="info-label">æè¿°</span> |
| | | </div> |
| | | <div class="info-value-wrapper"> |
| | | <span class="info-value">{{ routeInfo.description }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | |
| | | <!-- è¡¨æ ¼è§å¾ --> |
| | | <div v-if="viewMode === 'table'" class="section-header"> |
| | | <div class="section-title">å·¥èºè·¯çº¿é¡¹ç®å表</div> |
| | | <div class="section-actions"> |
| | | <el-button |
| | | icon="Grid" |
| | | @click="toggleView" |
| | | style="margin-right: 10px;" |
| | | > |
| | | å¡çè§å¾ |
| | | </el-button> |
| | | <el-button type="primary" @click="handleAdd">æ°å¢</el-button> |
| | | </div> |
| | | </div> |
| | | <el-table |
| | | v-if="viewMode === 'table'" |
| | | ref="tableRef" |
| | | v-loading="tableLoading" |
| | | border |
| | | :data="tableData" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | row-key="id" |
| | | tooltip-effect="dark" |
| | | class="lims-table" |
| | | > |
| | | <el-table-column align="center" label="åºå·" width="60" type="index" /> |
| | | <el-table-column label="å·¥åºåç§°" prop="processId" width="200"> |
| | | <template #default="scope"> |
| | | {{ getProcessName(scope.row.processId) || '-' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="产ååç§°" prop="productName" min-width="160" /> |
| | | <el-table-column label="è§æ ¼åç§°" prop="model" min-width="140" /> |
| | | <el-table-column label="åä½" prop="unit" width="100" /> |
| | | <el-table-column label="æä½" align="center" fixed="right" width="150"> |
| | | <template #default="scope"> |
| | | <el-button type="primary" link size="small" @click="handleEdit(scope.row)">ç¼è¾</el-button> |
| | | <el-button type="danger" link size="small" @click="handleDelete(scope.row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- å¡çè§å¾ --> |
| | | <template v-else> |
| | | <div class="section-header"> |
| | | <div class="section-title">å·¥èºè·¯çº¿é¡¹ç®å表</div> |
| | | <div class="section-actions"> |
| | | <el-button |
| | | icon="Menu" |
| | | @click="toggleView" |
| | | style="margin-right: 10px;" |
| | | > |
| | | è¡¨æ ¼è§å¾ |
| | | </el-button> |
| | | <el-button type="primary" @click="handleAdd">æ°å¢</el-button> |
| | | </div> |
| | | </div> |
| | | <div v-loading="tableLoading" class="card-container"> |
| | | <div |
| | | ref="cardsContainer" |
| | | class="cards-wrapper" |
| | | > |
| | | <div |
| | | v-for="(item, index) in tableData" |
| | | :key="item.id || index" |
| | | class="process-card" |
| | | :data-index="index" |
| | | > |
| | | <!-- åºå·åå --> |
| | | <div class="card-header"> |
| | | <div class="card-number">{{ index + 1 }}</div> |
| | | <div class="card-process-name">{{ getProcessName(item.processId) || '-' }}</div> |
| | | </div> |
| | | |
| | | <!-- 产åä¿¡æ¯ --> |
| | | <div class="card-content"> |
| | | <div v-if="item.productName" class="product-info"> |
| | | <div class="product-name">{{ item.productName }}</div> |
| | | <div v-if="item.model" class="product-model"> |
| | | {{ item.model }} |
| | | <!-- <span v-if="item.unit" class="product-unit">{{ item.unit }}</span> --> |
| | | </div> |
| | | </div> |
| | | <div v-else class="product-info empty">ææ äº§åä¿¡æ¯</div> |
| | | </div> |
| | | |
| | | <!-- æä½æé® --> |
| | | <div class="card-footer"> |
| | | <el-button type="primary" link size="small" @click="handleEdit(item)">ç¼è¾</el-button> |
| | | <el-button type="danger" link size="small" @click="handleDelete(item)">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢å·¥èºè·¯çº¿é¡¹ç®' : 'ç¼è¾å·¥èºè·¯çº¿é¡¹ç®'" |
| | | width="500px" |
| | | @close="closeDialog" |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="120px" |
| | | > |
| | | <el-form-item label="å·¥åº" prop="processId"> |
| | | <el-select |
| | | v-model="form.processId" |
| | | placeholder="è¯·éæ©å·¥åº" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="process in processOptions" |
| | | :key="process.id" |
| | | :label="process.name" |
| | | :value="process.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="产ååç§°" prop="productModelId"> |
| | | <el-button type="primary" @click="showProductSelectDialog = true"> |
| | | {{ form.productName && form.model |
| | | ? `${form.productName} - ${form.model}` |
| | | : 'éæ©äº§å' }} |
| | | </el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="åä½" prop="unit"> |
| | | <el-input |
| | | v-model="form.unit" |
| | | :placeholder="form.productModelId ? 'æ ¹æ®éæ©ç产åèªå¨å¸¦åº' : '请å
éæ©äº§å'" |
| | | clearable |
| | | :disabled="true" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit" :loading="submitLoading">ç¡®å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 产åéæ©å¯¹è¯æ¡ --> |
| | | <ProductSelectDialog |
| | | v-model="showProductSelectDialog" |
| | | @confirm="handleProductSelect" |
| | | single |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, getCurrentInstance, onMounted, onUnmounted, nextTick } from "vue"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import { findProcessRouteItemList, addOrUpdateProcessRouteItem, sortProcessRouteItem, batchDeleteProcessRouteItem } from "@/api/productionManagement/processRouteItem.js"; |
| | | import { findProductProcessRouteItemList, deleteRouteItem, addRouteItem, addOrUpdateProductProcessRouteItem, sortRouteItem } from "@/api/productionManagement/productProcessRoute.js"; |
| | | import { processList } from "@/api/productionManagement/productionProcess.js"; |
| | | import { useRoute } from 'vue-router' |
| | | import { ElMessageBox } from 'element-plus' |
| | | import Sortable from 'sortablejs' |
| | | |
| | | const route = useRoute() |
| | | const { proxy } = getCurrentInstance() || {}; |
| | | |
| | | const routeId = computed(() => route.query.id); |
| | | const orderId = computed(() => route.query.orderId); |
| | | const pageType = computed(() => route.query.type); |
| | | |
| | | const tableLoading = ref(false); |
| | | const tableData = ref([]); |
| | | const dialogVisible = ref(false); |
| | | const operationType = ref('add'); // add | edit |
| | | const formRef = ref(null); |
| | | const submitLoading = ref(false); |
| | | const cardsContainer = ref(null); |
| | | const tableRef = ref(null); |
| | | const viewMode = ref('table'); // table | card |
| | | const routeInfo = ref({ |
| | | processRouteCode: '', |
| | | productName: '', |
| | | model: '', |
| | | bomNo: '', |
| | | description: '' |
| | | }); |
| | | |
| | | const processOptions = ref([]); |
| | | const showProductSelectDialog = ref(false); |
| | | let tableSortable = null; |
| | | let cardSortable = null; |
| | | |
| | | // 忢è§å¾ |
| | | const toggleView = () => { |
| | | viewMode.value = viewMode.value === 'table' ? 'card' : 'table'; |
| | | // 忢è§å¾åéæ°åå§åææ½æåº |
| | | nextTick(() => { |
| | | initSortable(); |
| | | }); |
| | | }; |
| | | |
| | | const form = ref({ |
| | | id: undefined, |
| | | routeId: routeId.value, |
| | | processId: undefined, |
| | | productModelId: undefined, |
| | | productName: "", |
| | | model: "", |
| | | unit: "", |
| | | }); |
| | | |
| | | const rules = { |
| | | processId: [{ required: true, message: 'è¯·éæ©å·¥åº', trigger: 'change' }], |
| | | productModelId: [{ required: true, message: 'è¯·éæ©äº§å', trigger: 'change' }], |
| | | }; |
| | | |
| | | // æ ¹æ®å·¥åºIDè·åå·¥åºåç§° |
| | | const getProcessName = (processId) => { |
| | | if (!processId) return ''; |
| | | const process = processOptions.value.find(p => p.id === processId); |
| | | return process ? process.name : ''; |
| | | }; |
| | | |
| | | // è·åå表 |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const listPromise = |
| | | pageType.value === "order" |
| | | ? findProductProcessRouteItemList({ orderId: orderId.value }) |
| | | : findProcessRouteItemList({ routeId: routeId.value }); |
| | | |
| | | listPromise |
| | | .then(res => { |
| | | tableData.value = res.data || []; |
| | | tableLoading.value = false; |
| | | // å表å è½½å®æååå§åææ½æåº |
| | | nextTick(() => { |
| | | initSortable(); |
| | | }); |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | | console.error("è·åå表失败ï¼", err); |
| | | proxy?.$modal?.msgError("è·åå表失败"); |
| | | }); |
| | | }; |
| | | |
| | | // è·åå·¥åºå表 |
| | | const getProcessList = () => { |
| | | processList({}) |
| | | .then(res => { |
| | | processOptions.value = res.data || []; |
| | | }) |
| | | .catch(err => { |
| | | console.error("è·åå·¥åºå¤±è´¥ï¼", err); |
| | | }); |
| | | }; |
| | | |
| | | // è·åå·¥èºè·¯çº¿è¯¦æ
ï¼ä»è·¯ç±åæ°è·åï¼ |
| | | const getRouteInfo = () => { |
| | | routeInfo.value = { |
| | | processRouteCode: route.query.processRouteCode || '', |
| | | productName: route.query.productName || '', |
| | | model: route.query.model || '', |
| | | bomNo: route.query.bomNo || '', |
| | | description: route.query.description || '' |
| | | }; |
| | | }; |
| | | |
| | | // æ°å¢ |
| | | const handleAdd = () => { |
| | | operationType.value = 'add'; |
| | | resetForm(); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ç¼è¾ |
| | | const handleEdit = (row) => { |
| | | operationType.value = 'edit'; |
| | | form.value = { |
| | | id: row.id, |
| | | routeId: routeId.value, |
| | | processId: row.processId, |
| | | productModelId: row.productModelId, |
| | | productName: row.productName || "", |
| | | model: row.model || "", |
| | | unit: row.unit || "", |
| | | }; |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // å é¤ |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm('确认å é¤è¯¥å·¥èºè·¯çº¿é¡¹ç®ï¼', 'æç¤º', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | // ç产订åä¸ä½¿ç¨ productProcessRoute çå 餿¥å£ï¼è·¯ç±åæ¼æ¥ idï¼ï¼å
¶å®æ
åµä½¿ç¨å·¥èºè·¯çº¿é¡¹ç®æ¹éå 餿¥å£ |
| | | const deletePromise = |
| | | pageType.value === 'order' |
| | | ? deleteRouteItem(row.id) |
| | | : batchDeleteProcessRouteItem([row.id]); |
| | | |
| | | deletePromise |
| | | .then(() => { |
| | | proxy?.$modal?.msgSuccess('å 餿å'); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy?.$modal?.msgError('å é¤å¤±è´¥'); |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // 产åéæ© |
| | | const handleProductSelect = (products) => { |
| | | if (products && products.length > 0) { |
| | | const product = products[0]; |
| | | form.value.productModelId = product.id; |
| | | form.value.productName = product.productName; |
| | | form.value.model = product.model; |
| | | form.value.unit = product.unit || ""; |
| | | showProductSelectDialog.value = false; |
| | | // 触å表åéªè¯ |
| | | formRef.value?.validateField('productModelId'); |
| | | } |
| | | }; |
| | | |
| | | // æäº¤ |
| | | const handleSubmit = () => { |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | | submitLoading.value = true; |
| | | |
| | | if (operationType.value === 'add') { |
| | | // æ°å¢ï¼ä¼ å个对象ï¼å
å«dragSortåæ®µ |
| | | // dragSort = å½åå表é¿åº¦ + 1ï¼è¡¨ç¤ºæ°å¢è®°å½æå¨æå |
| | | const dragSort = tableData.value.length + 1; |
| | | const isOrderPage = pageType.value === 'order'; |
| | | |
| | | const addPromise = isOrderPage |
| | | ? addRouteItem({ |
| | | productOrderId: orderId.value, |
| | | productRouteId: routeId.value, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | dragSort, |
| | | }) |
| | | : addOrUpdateProcessRouteItem({ |
| | | routeId: routeId.value, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | dragSort, |
| | | }); |
| | | |
| | | addPromise |
| | | .then(() => { |
| | | proxy?.$modal?.msgSuccess('æ°å¢æå'); |
| | | closeDialog(); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy?.$modal?.msgError('æ°å¢å¤±è´¥'); |
| | | }) |
| | | .finally(() => { |
| | | submitLoading.value = false; |
| | | }); |
| | | } else { |
| | | // ç¼è¾ï¼ç产订åä¸ä½¿ç¨ productProcessRoute/updateRouteItemï¼å
¶å®æ
åµä½¿ç¨å·¥èºè·¯çº¿é¡¹ç®æ´æ°æ¥å£ |
| | | const isOrderPage = pageType.value === 'order'; |
| | | |
| | | const updatePromise = isOrderPage |
| | | ? addOrUpdateProductProcessRouteItem({ |
| | | id: form.value.id, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | }) |
| | | : addOrUpdateProcessRouteItem({ |
| | | routeId: routeId.value, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | id: form.value.id, |
| | | }); |
| | | |
| | | updatePromise |
| | | .then(() => { |
| | | proxy?.$modal?.msgSuccess('ä¿®æ¹æå'); |
| | | closeDialog(); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy?.$modal?.msgError('ä¿®æ¹å¤±è´¥'); |
| | | }) |
| | | .finally(() => { |
| | | submitLoading.value = false; |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // é置表å |
| | | const resetForm = () => { |
| | | form.value = { |
| | | id: undefined, |
| | | routeId: routeId.value, |
| | | processId: undefined, |
| | | productModelId: undefined, |
| | | productName: "", |
| | | model: "", |
| | | unit: "", |
| | | }; |
| | | formRef.value?.resetFields(); |
| | | }; |
| | | |
| | | // å
³éå¼¹çª |
| | | const closeDialog = () => { |
| | | dialogVisible.value = false; |
| | | resetForm(); |
| | | }; |
| | | |
| | | // åå§åææ½æåº |
| | | const initSortable = () => { |
| | | destroySortable(); |
| | | |
| | | if (viewMode.value === 'table') { |
| | | // è¡¨æ ¼è§å¾çææ½æåº |
| | | if (!tableRef.value) return; |
| | | |
| | | const tbody = tableRef.value.$el.querySelector('.el-table__body tbody') || |
| | | tableRef.value.$el.querySelector('.el-table__body-wrapper > table > tbody'); |
| | | |
| | | if (!tbody) return; |
| | | |
| | | tableSortable = new Sortable(tbody, { |
| | | animation: 150, |
| | | ghostClass: 'sortable-ghost', |
| | | handle: '.el-table__row', |
| | | filter: '.el-button, .el-select', |
| | | onEnd: (evt) => { |
| | | if (evt.oldIndex === evt.newIndex || !tableData.value[evt.oldIndex]) return; |
| | | |
| | | // éæ°æåºæ°ç» |
| | | const moveItem = tableData.value.splice(evt.oldIndex, 1)[0]; |
| | | tableData.value.splice(evt.newIndex, 0, moveItem); |
| | | |
| | | // è®¡ç®æ°çåºå·ï¼dragSortä»1å¼å§ï¼ |
| | | const newIndex = evt.newIndex; |
| | | const dragSort = newIndex + 1; |
| | | |
| | | // è°ç¨æåºæ¥å£ |
| | | if (moveItem.id) { |
| | | const isOrderPage = pageType.value === 'order'; |
| | | const sortPromise = isOrderPage |
| | | ? sortRouteItem({ |
| | | id: moveItem.id, |
| | | dragSort: dragSort |
| | | }) |
| | | : sortProcessRouteItem({ |
| | | id: moveItem.id, |
| | | dragSort: dragSort |
| | | }); |
| | | |
| | | sortPromise |
| | | .then(() => { |
| | | // æ´æ°ææè¡çdragSort |
| | | tableData.value.forEach((item, index) => { |
| | | if (item.id) { |
| | | item.dragSort = index + 1; |
| | | } |
| | | }); |
| | | proxy?.$modal?.msgSuccess('æåºæå'); |
| | | }) |
| | | .catch((err) => { |
| | | // æåºå¤±è´¥ï¼æ¢å¤åæ°ç» |
| | | tableData.value.splice(newIndex, 1); |
| | | tableData.value.splice(evt.oldIndex, 0, moveItem); |
| | | proxy?.$modal?.msgError('æåºå¤±è´¥'); |
| | | console.error("æåºå¤±è´¥ï¼", err); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | // å¡çè§å¾çææ½æåº |
| | | if (!cardsContainer.value) return; |
| | | |
| | | cardSortable = new Sortable(cardsContainer.value, { |
| | | animation: 150, |
| | | ghostClass: 'sortable-ghost', |
| | | handle: '.process-card', |
| | | filter: '.el-button', |
| | | onEnd: (evt) => { |
| | | if (evt.oldIndex === evt.newIndex || !tableData.value[evt.oldIndex]) return; |
| | | |
| | | // éæ°æåºæ°ç» |
| | | const moveItem = tableData.value.splice(evt.oldIndex, 1)[0]; |
| | | tableData.value.splice(evt.newIndex, 0, moveItem); |
| | | |
| | | // è®¡ç®æ°çåºå·ï¼dragSortä»1å¼å§ï¼ |
| | | const newIndex = evt.newIndex; |
| | | const dragSort = newIndex + 1; |
| | | |
| | | // è°ç¨æåºæ¥å£ |
| | | if (moveItem.id) { |
| | | const isOrderPage = pageType.value === 'order'; |
| | | const sortPromise = isOrderPage |
| | | ? sortRouteItem({ |
| | | id: moveItem.id, |
| | | dragSort: dragSort |
| | | }) |
| | | : sortProcessRouteItem({ |
| | | id: moveItem.id, |
| | | dragSort: dragSort |
| | | }); |
| | | |
| | | sortPromise |
| | | .then(() => { |
| | | // æ´æ°ææè¡çdragSort |
| | | tableData.value.forEach((item, index) => { |
| | | if (item.id) { |
| | | item.dragSort = index + 1; |
| | | } |
| | | }); |
| | | proxy?.$modal?.msgSuccess('æåºæå'); |
| | | }) |
| | | .catch((err) => { |
| | | // æåºå¤±è´¥ï¼æ¢å¤åæ°ç» |
| | | tableData.value.splice(newIndex, 1); |
| | | tableData.value.splice(evt.oldIndex, 0, moveItem); |
| | | proxy?.$modal?.msgError('æåºå¤±è´¥'); |
| | | console.error("æåºå¤±è´¥ï¼", err); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // éæ¯ææ½æåº |
| | | const destroySortable = () => { |
| | | if (tableSortable) { |
| | | tableSortable.destroy(); |
| | | tableSortable = null; |
| | | } |
| | | if (cardSortable) { |
| | | cardSortable.destroy(); |
| | | cardSortable = null; |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getRouteInfo(); |
| | | getList(); |
| | | getProcessList(); |
| | | }); |
| | | |
| | | onUnmounted(() => { |
| | | destroySortable(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .card-container { |
| | | padding: 20px 0; |
| | | } |
| | | |
| | | .cards-wrapper { |
| | | display: flex; |
| | | gap: 16px; |
| | | overflow-x: auto; |
| | | padding: 10px 0; |
| | | min-height: 200px; |
| | | } |
| | | |
| | | .cards-wrapper::-webkit-scrollbar { |
| | | height: 8px; |
| | | } |
| | | |
| | | .cards-wrapper::-webkit-scrollbar-track { |
| | | background: #f1f1f1; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .cards-wrapper::-webkit-scrollbar-thumb { |
| | | background: #c1c1c1; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .cards-wrapper::-webkit-scrollbar-thumb:hover { |
| | | background: #a8a8a8; |
| | | } |
| | | |
| | | .process-card { |
| | | flex-shrink: 0; |
| | | width: 220px; |
| | | background: #fff; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); |
| | | padding: 16px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | cursor: move; |
| | | transition: all 0.3s; |
| | | } |
| | | |
| | | .process-card:hover { |
| | | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); |
| | | transform: translateY(-2px); |
| | | } |
| | | |
| | | .card-header { |
| | | text-align: center; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .card-number { |
| | | width: 36px; |
| | | height: 36px; |
| | | line-height: 36px; |
| | | border-radius: 50%; |
| | | background: #409eff; |
| | | color: #fff; |
| | | font-weight: bold; |
| | | font-size: 16px; |
| | | margin: 0 auto 8px; |
| | | } |
| | | |
| | | .card-process-name { |
| | | font-size: 14px; |
| | | color: #333; |
| | | font-weight: 500; |
| | | word-break: break-all; |
| | | } |
| | | |
| | | .card-content { |
| | | flex: 1; |
| | | margin-bottom: 12px; |
| | | min-height: 60px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .product-info { |
| | | font-size: 13px; |
| | | color: #666; |
| | | text-align: center; |
| | | width: 100%; |
| | | } |
| | | |
| | | .product-info.empty { |
| | | color: #999; |
| | | text-align: center; |
| | | padding: 20px 0; |
| | | } |
| | | |
| | | .product-name { |
| | | margin-bottom: 6px; |
| | | word-break: break-all; |
| | | line-height: 1.5; |
| | | text-align: center; |
| | | } |
| | | |
| | | .product-model { |
| | | color: #909399; |
| | | font-size: 12px; |
| | | word-break: break-all; |
| | | line-height: 1.5; |
| | | text-align: center; |
| | | } |
| | | |
| | | .product-unit { |
| | | margin-left: 4px; |
| | | color: #409eff; |
| | | } |
| | | |
| | | .card-footer { |
| | | display: flex; |
| | | justify-content: space-around; |
| | | padding-top: 12px; |
| | | border-top: 1px solid #f0f0f0; |
| | | } |
| | | |
| | | .card-footer .el-button { |
| | | padding: 0; |
| | | font-size: 12px; |
| | | } |
| | | |
| | | :deep(.sortable-ghost) { |
| | | opacity: 0.5; |
| | | background-color: #f5f7fa !important; |
| | | } |
| | | |
| | | :deep(.sortable-drag) { |
| | | opacity: 0.8; |
| | | } |
| | | |
| | | /* è¡¨æ ¼è§å¾æ ·å¼ */ |
| | | :deep(.el-table__row) { |
| | | transition: background-color 0.2s; |
| | | cursor: move; |
| | | } |
| | | |
| | | :deep(.el-table__row:hover) { |
| | | background-color: #f9fafc !important; |
| | | } |
| | | |
| | | /* åºåæ 颿 ·å¼ */ |
| | | .section-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .section-title { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | color: #303133; |
| | | padding-left: 12px; |
| | | position: relative; |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .section-title::before { |
| | | content: ''; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 3px; |
| | | height: 16px; |
| | | background: #409eff; |
| | | border-radius: 2px; |
| | | } |
| | | |
| | | .section-actions { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | /* å·¥èºè·¯çº¿ä¿¡æ¯å¡çæ ·å¼ */ |
| | | .route-info-card { |
| | | margin-bottom: 20px; |
| | | border: 1px solid #e4e7ed; |
| | | background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%); |
| | | border-radius: 8px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .route-info { |
| | | display: grid; |
| | | grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); |
| | | gap: 16px; |
| | | padding: 4px; |
| | | } |
| | | |
| | | .info-item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | background: #ffffff; |
| | | border-radius: 6px; |
| | | padding: 14px 16px; |
| | | border: 1px solid #f0f2f5; |
| | | transition: all 0.3s ease; |
| | | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); |
| | | } |
| | | |
| | | .info-item:hover { |
| | | border-color: #409eff; |
| | | box-shadow: 0 2px 8px rgba(64, 158, 255, 0.15); |
| | | transform: translateY(-1px); |
| | | } |
| | | |
| | | .info-item.full-width { |
| | | grid-column: 1 / -1; |
| | | } |
| | | |
| | | .info-label-wrapper { |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | .info-label { |
| | | display: inline-block; |
| | | color: #909399; |
| | | font-size: 12px; |
| | | font-weight: 500; |
| | | text-transform: uppercase; |
| | | letter-spacing: 0.5px; |
| | | padding: 2px 0; |
| | | position: relative; |
| | | } |
| | | |
| | | .info-label::after { |
| | | content: ''; |
| | | position: absolute; |
| | | left: 0; |
| | | bottom: 0; |
| | | width: 20px; |
| | | height: 2px; |
| | | background: linear-gradient(90deg, #409eff, transparent); |
| | | border-radius: 1px; |
| | | } |
| | | |
| | | .info-value-wrapper { |
| | | flex: 1; |
| | | } |
| | | |
| | | .info-value { |
| | | display: block; |
| | | color: #303133; |
| | | font-size: 15px; |
| | | font-weight: 500; |
| | | line-height: 1.5; |
| | | word-break: break-all; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <PageHeader content="产åç»æè¯¦æ
"> |
| | | <template #right-button> |
| | | <el-button v-if="dataValue.isEdit && !isOrderPage" |
| | | type="primary" |
| | | @click="addItem">æ·»å |
| | | </el-button> |
| | | <el-button v-if="!dataValue.isEdit && !isOrderPage" |
| | | type="primary" |
| | | @click="dataValue.isEdit = true">ç¼è¾ |
| | | </el-button> |
| | | <el-button v-if="dataValue.isEdit && !isOrderPage" |
| | | type="primary" |
| | | @click="cancelEdit">åæ¶ |
| | | </el-button> |
| | | <el-button v-if="!isOrderPage" |
| | | type="primary" |
| | | :loading="dataValue.loading" |
| | | @click="submit" |
| | | :disabled="!dataValue.isEdit">确认 |
| | | </el-button> |
| | | </template> |
| | | </PageHeader> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | :preserve-expanded-content="false" |
| | | :default-expand-all="true" |
| | | style="width: 100%" |
| | | > |
| | | <el-table-column type="expand"> |
| | | <template #default="props"> |
| | | <el-form ref="form" |
| | | :model="dataValue"> |
| | | <el-table :data="dataValue.dataList" |
| | | style="width: 100%"> |
| | | <el-table-column prop="productName" |
| | | label="产å"/> |
| | | <el-table-column prop="model" |
| | | label="è§æ ¼"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item v-if="dataValue.isEdit" |
| | | :prop="`dataList.${$index}.model`" |
| | | :rules="[{ required: true, message: 'è¯·éæ©è§æ ¼', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-select v-model="row.model" |
| | | placeholder="è¯·éæ©è§æ ¼" |
| | | clearable |
| | | :disabled="!dataValue.isEdit" |
| | | style="width: 100%" |
| | | @visible-change="(v) => { if (v) openDialog($index) }"> |
| | | <el-option v-if="row.model" |
| | | :label="row.model" |
| | | :value="row.model" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="processId" |
| | | label="æ¶èå·¥åº"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.processId`" |
| | | :rules="[{ required: true, message: 'è¯·éæ©æ¶èå·¥åº', trigger: 'change' }]" |
| | | style="margin: 0"> |
| | | <el-select v-model="row.processId" |
| | | placeholder="è¯·éæ©" |
| | | filterable |
| | | clearable |
| | | style="width: 100%" |
| | | :disabled="!dataValue.isEdit"> |
| | | <el-option v-for="item in dataValue.processOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unitQuantity" |
| | | label="åä½äº§åºæéæ°é"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.unitQuantity`" |
| | | :rules="[{ required: true, message: '请è¾å
¥åä½äº§åºæéæ°é', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-input-number v-model="row.unitQuantity" |
| | | :min="0" |
| | | :precision="2" |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | :disabled="!dataValue.isEdit" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="isOrderPage" |
| | | prop="demandedQuantity" |
| | | label="éæ±æ»é"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.demandedQuantity`" |
| | | :rules="[{ required: true, message: '请è¾å
¥éæ±æ»é', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-input-number v-model="row.demandedQuantity" |
| | | :min="0" |
| | | :precision="2" |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | :disabled="!dataValue.isEdit" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" |
| | | label="åä½"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.unit`" |
| | | :rules="[{ required: true, message: '请è¾å
¥åä½', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-input v-model="row.unit" |
| | | placeholder="请è¾å
¥åä½" |
| | | clearable |
| | | :disabled="!dataValue.isEdit" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" fixed="right" width="100"> |
| | | <template #default="{ row, $index }"> |
| | | <el-button v-if="dataValue.isEdit" |
| | | type="danger" |
| | | text |
| | | @click="dataValue.dataList.splice($index, 1)">å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="BOMç¼å·" prop="bomNo" /> |
| | | <el-table-column label="产ååç§°" prop="productName" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="model" /> |
| | | </el-table> |
| | | |
| | | <product-select-dialog v-if="dataValue.showProductDialog" |
| | | v-model:model-value="dataValue.showProductDialog" |
| | | @confirm="handleProduct" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { |
| | | computed, |
| | | defineAsyncComponent, |
| | | defineComponent, |
| | | onMounted, |
| | | reactive, |
| | | ref, |
| | | } from "vue"; |
| | | import { queryList, add } from "@/api/productionManagement/productStructure.js"; |
| | | import { listProcessBom } from "@/api/productionManagement/productionOrder.js"; |
| | | import { list } from "@/api/productionManagement/productionProcess"; |
| | | import { ElMessage } from "element-plus"; |
| | | import {useRoute, useRouter} from "vue-router"; |
| | | |
| | | defineComponent({ |
| | | name: "StructureEdit", |
| | | }); |
| | | |
| | | const ProductSelectDialog = defineAsyncComponent( |
| | | () => import("@/views/basicData/product/ProductSelectDialog.vue") |
| | | ); |
| | | const form = ref(); |
| | | |
| | | const route = useRoute() |
| | | const router = useRouter() |
| | | const routeId = computed({ |
| | | get() { |
| | | return route.query.id; |
| | | }, |
| | | |
| | | set(val) { |
| | | emit('update:router', val) |
| | | } |
| | | }); |
| | | |
| | | // ä»è·¯ç±åæ°è·å产åä¿¡æ¯ |
| | | const routeBomNo = computed(() => route.query.bomNo || ''); |
| | | const routeProductName = computed(() => route.query.productName || ''); |
| | | const routeProductModelName = computed(() => route.query.productModelName || ''); |
| | | const routeOrderId = computed(() => route.query.orderId); |
| | | const pageType = computed(() => route.query.type); |
| | | const isOrderPage = computed(() => pageType.value === 'order' && routeOrderId.value); |
| | | |
| | | const dataValue = reactive({ |
| | | dataList: [], |
| | | productOptions: [], |
| | | processOptions: [], |
| | | showProductDialog: false, |
| | | currentRowIndex: null, |
| | | loading: false, |
| | | isEdit: false, |
| | | }); |
| | | |
| | | const tableData = reactive([ |
| | | { |
| | | productName: "", |
| | | model: "", |
| | | bomNo: "", |
| | | } |
| | | ]) |
| | | |
| | | const openDialog = index => { |
| | | dataValue.currentRowIndex = index; |
| | | dataValue.showProductDialog = true; |
| | | }; |
| | | |
| | | const fetchData = async () => { |
| | | if (isOrderPage.value) { |
| | | // 订åæ
åµï¼ä½¿ç¨è®¢åç产åç»ææ¥å£ |
| | | const { data } = await listProcessBom({ orderId: routeOrderId.value }); |
| | | dataValue.dataList = data || []; |
| | | } else { |
| | | // é订åæ
åµï¼ä½¿ç¨åæ¥çæ¥å£ |
| | | const { data } = await queryList(routeId.value); |
| | | dataValue.dataList = data || []; |
| | | } |
| | | }; |
| | | |
| | | const fetchProcessOptions = async () => { |
| | | const { data } = await list(routeId.value); |
| | | dataValue.processOptions = data; |
| | | }; |
| | | |
| | | const handleProduct = row => { |
| | | if (row?.length > 1) { |
| | | ElMessage.error("åªè½éæ©ä¸ä¸ªäº§å"); |
| | | } |
| | | dataValue.dataList[dataValue.currentRowIndex].productName = |
| | | row[0].productName; |
| | | dataValue.dataList[dataValue.currentRowIndex].model = row[0].model; |
| | | dataValue.dataList[dataValue.currentRowIndex].productModelId = row[0].id; |
| | | dataValue.dataList[dataValue.currentRowIndex].unit = row[0].unit || ""; |
| | | dataValue.showProductDialog = false; |
| | | }; |
| | | |
| | | const submit = () => { |
| | | form.value |
| | | .validate(valid => { |
| | | dataValue.loading = true; |
| | | if (valid) { |
| | | add({ |
| | | bomId: routeId.value, |
| | | productStructureList: dataValue.dataList || [], |
| | | }).then(res => { |
| | | router.push({ |
| | | path: '/productionManagement/productionManagement/productStructure/index', |
| | | }) |
| | | ElMessage.success("ä¿åæå"); |
| | | dataValue.loading = false; |
| | | }); |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | dataValue.loading = false; |
| | | }); |
| | | }; |
| | | |
| | | const addItem = () => { |
| | | dataValue.dataList.push({ |
| | | productName: "", |
| | | productId: "", |
| | | model: undefined, |
| | | productModelId: undefined, |
| | | processId: "", |
| | | unitQuantity: 0, |
| | | demandedQuantity: 0, |
| | | unit: "", |
| | | }); |
| | | }; |
| | | |
| | | const cancelEdit = () => { |
| | | dataValue.isEdit = false; |
| | | dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | // ä»è·¯ç±åæ°åæ¾æ°æ® |
| | | tableData[0].productName = routeProductName.value; |
| | | tableData[0].model = routeProductModelName.value; |
| | | tableData[0].bomNo = routeBomNo.value; |
| | | |
| | | // 订åæ
åµä¸ç¦ç¨ç¼è¾ |
| | | if (isOrderPage.value) { |
| | | dataValue.isEdit = false; |
| | | } |
| | | |
| | | fetchData(); |
| | | fetchProcessOptions(); |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog v-model="visible" |
| | | title="ç»æ" |
| | | width="1200" |
| | | close-on-click-modal |
| | | @close="visible = false"> |
| | | <el-button v-if="dataValue.isEdit" |
| | | type="primary" |
| | | @click="addItem" |
| | | style="margin-bottom: 10px">æ·»å |
| | | </el-button> |
| | | <el-button v-if="!dataValue.isEdit" |
| | | type="primary" |
| | | @click="dataValue.isEdit = true" |
| | | style="margin-bottom: 10px">ç¼è¾ |
| | | </el-button> |
| | | <el-button v-if="dataValue.isEdit" |
| | | type="primary" |
| | | @click="cancelEdit" |
| | | style="margin-bottom: 10px">åæ¶ |
| | | </el-button> |
| | | |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | :preserve-expanded-content="false" |
| | | style="width: 100%" |
| | | > |
| | | <el-table-column type="expand"> |
| | | <template #default="props"> |
| | | <el-form ref="form" |
| | | :model="dataValue"> |
| | | <el-table :data="dataValue.dataList" |
| | | style="width: 100%"> |
| | | <el-table-column prop="productName" |
| | | label="产å" |
| | | width="150" /> |
| | | <el-table-column prop="model" |
| | | label="è§æ ¼" |
| | | width="150"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item v-if="dataValue.isEdit" |
| | | :prop="`dataList.${$index}.model`" |
| | | :rules="[{ required: true, message: 'è¯·éæ©è§æ ¼', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-select v-model="row.model" |
| | | placeholder="è¯·éæ©äº§å" |
| | | clearable |
| | | :disabled="!dataValue.isEdit" |
| | | style="width: 100%" |
| | | @visible-change="(v) => { if (v) openDialog($index) }"> |
| | | <el-option v-if="row.model" |
| | | :label="row.model" |
| | | :value="row.model" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="processId" |
| | | label="æ¶èå·¥åº" |
| | | width="150"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.processId`" |
| | | :rules="[{ required: true, message: 'è¯·éæ©æ¶èå·¥åº', trigger: 'change' }]" |
| | | style="margin: 0"> |
| | | <el-select v-model="row.processId" |
| | | placeholder="è¯·éæ©" |
| | | filterable |
| | | clearable |
| | | style="width: 100%" |
| | | :disabled="!dataValue.isEdit"> |
| | | <el-option v-for="item in dataValue.processOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unitQuantity" |
| | | label="åä½äº§åºæéæ°é" |
| | | width="150"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.unitQuantity`" |
| | | :rules="[{ required: true, message: '请è¾å
¥åä½äº§åºæéæ°é', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-input-number v-model="row.unitQuantity" |
| | | :min="0" |
| | | :precision="2" |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | :disabled="!dataValue.isEdit" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="demandedQuantity" |
| | | label="éæ±æ»é" |
| | | width="150"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.demandedQuantity`" |
| | | :rules="[{ required: true, message: '请è¾å
¥éæ±æ»é', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-input-number v-model="row.demandedQuantity" |
| | | :min="0" |
| | | :precision="2" |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | :disabled="!dataValue.isEdit" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" |
| | | label="åä½" |
| | | width="150"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.unit`" |
| | | :rules="[{ required: true, message: '请è¾å
¥åä½', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-input v-model="row.unit" |
| | | placeholder="请è¾å
¥åä½" |
| | | clearable |
| | | :disabled="!dataValue.isEdit" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="diskQuantity" |
| | | label="çæ°ï¼çï¼" |
| | | width="150"> |
| | | <template #default="{ row, $index }"> |
| | | <el-form-item :prop="`dataList.${$index}.diskQuantity`" |
| | | :rules="[{ required: true, message: '请è¾å
¥çæ°', trigger: ['blur','change'] }]" |
| | | style="margin: 0"> |
| | | <el-input-number v-model="row.diskQuantity" |
| | | :min="0" |
| | | :precision="0" |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | :disabled="!dataValue.isEdit" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½"> |
| | | <template #default="{ row, $index }"> |
| | | <el-button type="danger" |
| | | text |
| | | @click="dataValue.dataList.splice($index, 1)">å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="产åç¼ç " prop="productCode" /> |
| | | <el-table-column label="产ååç§°" prop="productName" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="model" /> |
| | | <el-table-column label="åä½" prop="unit" /> |
| | | </el-table> |
| | | |
| | | <product-select-dialog v-if="dataValue.showProductDialog" |
| | | v-model:model-value="dataValue.showProductDialog" |
| | | @confirm="handleProduct" /> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | :loading="dataValue.loading" |
| | | @click="submit" |
| | | :disabled="!dataValue.isEdit"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="visible = false">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { |
| | | computed, |
| | | defineAsyncComponent, |
| | | defineComponent, |
| | | onMounted, |
| | | reactive, |
| | | ref, |
| | | } from "vue"; |
| | | import { queryList, add } from "@/api/productionManagement/productStructure.js"; |
| | | import { list } from "@/api/productionManagement/productionProcess"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | defineComponent({ |
| | | name: "StructureEdit", |
| | | }); |
| | | |
| | | const ProductSelectDialog = defineAsyncComponent( |
| | | () => import("@/views/basicData/product/ProductSelectDialog.vue") |
| | | ); |
| | | const form = ref(); |
| | | |
| | | const props = defineProps({ |
| | | showModel: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | record: { |
| | | type: Object, |
| | | required: true, |
| | | }, |
| | | }); |
| | | |
| | | const emits = defineEmits(["update:showModel"]); |
| | | const visible = computed({ |
| | | get() { |
| | | return props.showModel; |
| | | }, |
| | | set(val) { |
| | | emits("update:showModel", val); |
| | | }, |
| | | }); |
| | | |
| | | const dataValue = reactive({ |
| | | dataList: [], |
| | | productOptions: [], |
| | | processOptions: [], |
| | | showProductDialog: false, |
| | | currentRowIndex: null, |
| | | loading: false, |
| | | isEdit: false, |
| | | }); |
| | | |
| | | const tableData = [ |
| | | { |
| | | productName: props.record.productName, |
| | | model: props.record.model, |
| | | unit: props.record.unit, |
| | | productCode: props.record.productCode, |
| | | } |
| | | ] |
| | | |
| | | const openDialog = index => { |
| | | dataValue.currentRowIndex = index; |
| | | dataValue.showProductDialog = true; |
| | | }; |
| | | |
| | | const fetchData = async () => { |
| | | const { data } = await queryList(props.record.id); |
| | | dataValue.dataList = data; |
| | | }; |
| | | |
| | | const fetchProcessOptions = async () => { |
| | | const { data } = await list(props.record.id); |
| | | dataValue.processOptions = data; |
| | | }; |
| | | |
| | | const handleProduct = row => { |
| | | if (row?.length > 1) { |
| | | ElMessage.error("åªè½éæ©ä¸ä¸ªäº§å"); |
| | | } |
| | | dataValue.dataList[dataValue.currentRowIndex].productName = |
| | | row[0].productName; |
| | | dataValue.dataList[dataValue.currentRowIndex].model = row[0].model; |
| | | dataValue.dataList[dataValue.currentRowIndex].productModelId = row[0].id; |
| | | dataValue.showProductDialog = false; |
| | | }; |
| | | |
| | | const submit = () => { |
| | | form.value |
| | | .validate(valid => { |
| | | dataValue.loading = true; |
| | | if (valid) { |
| | | add({ |
| | | parentId: props.record.id, |
| | | productStructureList: dataValue.dataList || [], |
| | | }).then(res => { |
| | | ElMessage.success("ä¿åæå"); |
| | | visible.value = false; |
| | | dataValue.loading = false; |
| | | }); |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | dataValue.loading = false; |
| | | }); |
| | | }; |
| | | |
| | | const addItem = () => { |
| | | dataValue.dataList.push({ |
| | | productName: "", |
| | | productId: "", |
| | | model: undefined, |
| | | productModelId: undefined, |
| | | processId: "", |
| | | unitQuantity: 0, |
| | | demandedQuantity: 0, |
| | | unit: "", |
| | | diskQuantity: 0, |
| | | }); |
| | | }; |
| | | |
| | | const cancelEdit = () => { |
| | | dataValue.isEdit = false; |
| | | dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | fetchData(); |
| | | fetchProcessOptions(); |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div style="text-align: right; margin-bottom: 10px;"> |
| | | <el-button type="primary" @click="handleAdd">æ°å¢</el-button> |
| | | <el-button type="danger" plain @click="handleBatchDelete" :disabled="selectedRows.length === 0">å é¤</el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | > |
| | | <template #detail="{row}"> |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | @click="showDetail(row)">{{ row.bomNo }} |
| | | </el-button> |
| | | </template> |
| | | </PIMTable> |
| | | <StructureEdit v-if="showEdit" v-model:show-model="showEdit" :record="currentRow"/> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢BOM' : 'ç¼è¾BOM'" |
| | | width="600px" |
| | | @close="closeDialog" |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="120px" |
| | | > |
| | | <el-form-item label="产ååç§°" prop="productModelId"> |
| | | <el-button type="primary" @click="showProductSelectDialog = true"> |
| | | {{ form.productName || 'éæ©äº§å' }} |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item label="çæ¬å·" prop="version"> |
| | | <el-input v-model="form.version" placeholder="请è¾å
¥çæ¬å·" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input |
| | | v-model="form.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit">ç¡®å®</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 产åéæ©å¼¹çª --> |
| | | <ProductSelectDialog |
| | | v-model="showProductSelectDialog" |
| | | @confirm="handleProductSelect" |
| | | single |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance, defineAsyncComponent } from "vue"; |
| | | import { listPage, add, update, batchDelete } from "@/api/productionManagement/productBom.js"; |
| | | import { useRouter } from 'vue-router' |
| | | import { ElMessageBox } from 'element-plus' |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | |
| | | const router = useRouter() |
| | | const { proxy } = getCurrentInstance() |
| | | const StructureEdit = defineAsyncComponent(() => import('@/views/productionManagement/productStructure/StructureEdit.vue')) |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "BOMç¼å·", |
| | | prop: "bomNo", |
| | | dataType: 'slot', |
| | | slot: "detail", |
| | | minWidth: 140 |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | |
| | | minWidth: 160 |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "productModelName", |
| | | minWidth: 140 |
| | | }, |
| | | { |
| | | label: "çæ¬å·", |
| | | prop: "version", |
| | | width: 100 |
| | | }, |
| | | { |
| | | label: "夿³¨", |
| | | prop: "remark", |
| | | minWidth: 160 |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 150, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | handleEdit(row) |
| | | } |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | type: "danger", |
| | | link: true, |
| | | clickFun: (row) => { |
| | | handleDelete(row) |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | ]); |
| | | |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const showEdit = ref(false); |
| | | const selectedRows = ref([]); |
| | | const currentRow = ref({}); |
| | | const dialogVisible = ref(false); |
| | | const operationType = ref('add'); // add | edit |
| | | const formRef = ref(null); |
| | | const showProductSelectDialog = ref(false); |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | id: undefined, |
| | | productName: "", |
| | | productModelName: "", |
| | | productModelId: "", |
| | | remark: "", |
| | | version: "" |
| | | }, |
| | | rules: { |
| | | productModelId: [{ required: true, message: "è¯·éæ©äº§å", trigger: "change" }], |
| | | version: [{ required: true, message: "请è¾å
¥çæ¬å·", trigger: "blur" }] |
| | | } |
| | | }); |
| | | |
| | | const { form, rules } = toRefs(data); |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // å页 |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | // æ¥è¯¢å表 |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listPage({ |
| | | current: page.current, |
| | | size: page.size, |
| | | }) |
| | | .then((res) => { |
| | | const records = res?.data?.records || []; |
| | | tableData.value = records; |
| | | page.total = res?.data?.total || 0; |
| | | }) |
| | | .catch((err) => { |
| | | console.error("è·åå表失败ï¼", err); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // æ°å¢ |
| | | const handleAdd = () => { |
| | | operationType.value = 'add'; |
| | | Object.assign(form.value, { |
| | | id: undefined, |
| | | productName: "", |
| | | productModelName: "", |
| | | productModelId: "", |
| | | remark: "", |
| | | version: "" |
| | | }); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ç¼è¾ |
| | | const handleEdit = (row) => { |
| | | operationType.value = 'edit'; |
| | | Object.assign(form.value, { |
| | | id: row.id, |
| | | productName: row.productName || "", |
| | | productModelName: row.productModelName || "", |
| | | productModelId: row.productModelId || "", |
| | | remark: row.remark || "", |
| | | version: row.version || "" |
| | | }); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // å é¤ï¼åæ¡ï¼ |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm('确认å é¤è¯¥BOMï¼', 'æç¤º', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | batchDelete([row.id]) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess('å 餿å'); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msgError('å é¤å¤±è´¥'); |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleBatchDelete = () => { |
| | | if (!selectedRows.value.length) { |
| | | proxy.$modal.msgWarning('è¯·éæ©æ°æ®'); |
| | | return; |
| | | } |
| | | const ids = selectedRows.value.map(item => item.id); |
| | | ElMessageBox.confirm('éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', 'å é¤æç¤º', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | batchDelete(ids) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess('å 餿å'); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msgError('å é¤å¤±è´¥'); |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // 产åéæ© |
| | | const handleProductSelect = (products) => { |
| | | if (products && products.length > 0) { |
| | | const product = products[0]; |
| | | form.value.productModelId = product.id; |
| | | form.value.productName = product.productName; |
| | | form.value.productModelName = product.model; |
| | | } |
| | | showProductSelectDialog.value = false; |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const handleSubmit = () => { |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | | const payload = { ...form.value }; |
| | | if (operationType.value === 'add') { |
| | | add(payload) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess('æ°å¢æå'); |
| | | closeDialog(); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msgError('æ°å¢å¤±è´¥'); |
| | | }); |
| | | } else { |
| | | update(payload) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess('ä¿®æ¹æå'); |
| | | closeDialog(); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msgError('ä¿®æ¹å¤±è´¥'); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å
³éå¼¹çª |
| | | const closeDialog = () => { |
| | | dialogVisible.value = false; |
| | | formRef.value?.resetFields(); |
| | | }; |
| | | |
| | | // æ¥ç详æ
|
| | | const showDetail = (row) => { |
| | | router.push({ |
| | | path: '/productionManagement/productStructureDetail', |
| | | query: { |
| | | id: row.id, |
| | | bomNo: row.bomNo || '', |
| | | productName: row.productName || '', |
| | | productModelName: row.productModelName || '' |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <span class="search_title ml10">ååå·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.salesContractNo" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | |
| | | prop: "schedulingUserName", |
| | | width: 90, |
| | | }, |
| | | { |
| | | label: "ååå·", |
| | | prop: "salesContractNo", |
| | | width: 220, |
| | | }, |
| | | // { |
| | | // label: "客æ·ååå·", |
| | | // prop: "customerContractNo", |
| | | // width: 250, |
| | | // }, |
| | | { |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | width: 250, |
| | | }, |
| | | // { |
| | | // label: "项ç®åç§°", |
| | | // prop: "projectName", |
| | | // width:300 |
| | | // }, |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | schedulingUserName: "", |
| | | salesContractNo: "", |
| | | entryDate: [ |
| | | dayjs().format("YYYY-MM-DD"), |
| | | dayjs().add(1, "day").format("YYYY-MM-DD"), |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/basic/customer/export", {}, "çäº§æ ¸ç®.xlsx"); |
| | | proxy.download("/salesLedger/productionAccounting/export", {}, "çäº§æ ¸ç®.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | title="èªå¨æ´¾å·¥" |
| | | width="80%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form :model="form" label-width="140px" label-position="top" ref="formRef"> |
| | | <el-divider content-position="left">派工å表</el-divider> |
| | | |
| | | <el-table |
| | | :data="dispatchList" |
| | | border |
| | | style="width: 100%; margin-top: 20px;" |
| | | :row-class-name="tableRowClassName" |
| | | > |
| | | <el-table-column label="åºå·" type="index" width="60" align="center" /> |
| | | <el-table-column label="ååå·" prop="salesContractNo" width="200" /> |
| | | <el-table-column label="客æ·åç§°" prop="customerName" width="200" /> |
| | | <!-- <el-table-column label="项ç®åç§°" prop="projectName" width="250" /> --> |
| | | <el-table-column label="产å大类" prop="productCategory" width="150" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" /> |
| | | <el-table-column label="ç»å®æºå¨" prop="speculativeTradingName" width="120" /> |
| | | <el-table-column label="æ»æ°é" prop="quantity" width="100" align="right" /> |
| | | <el-table-column label="å·²æäº§" prop="schedulingNum" width="100" align="right" fixed="right" /> |
| | | <el-table-column label="å¾
æäº§" prop="pendingQuantity" width="100" align="right" fixed="right" /> |
| | | <el-table-column label="æ¬æ¬¡æäº§" width="150" align="center" fixed="right"> |
| | | <template #default="{ row }"> |
| | | <el-input-number |
| | | v-model="row.schedulingNum" |
| | | :min="0" |
| | | :max="row.pendingQuantity" |
| | | :step="1" |
| | | :precision="0" |
| | | size="small" |
| | | style="width: 120px" |
| | | @change="(value) => changeCurrentNum(value, row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认派工</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, reactive, toRefs, computed} from "vue"; |
| | | import {productionDispatch, productionDispatchList} from "@/api/productionManagement/productionOrder.js"; |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['close']) |
| | | |
| | | const dialogFormVisible = ref(false); |
| | | const operationType = ref('') |
| | | |
| | | const data = reactive({ |
| | | form: {}, |
| | | dispatchList: [], // 派工åè¡¨æ°æ® |
| | | }); |
| | | |
| | | const { form, dispatchList } = toRefs(data); |
| | | |
| | | |
| | | // è¡¨æ ¼è¡æ ·å¼ |
| | | const tableRowClassName = ({ rowIndex }) => { |
| | | if (rowIndex % 2 === 1) { |
| | | return 'even-row' |
| | | } |
| | | return '' |
| | | } |
| | | |
| | | // ä¿®æ¹æ¬æ¬¡æäº§æ°é |
| | | const changeCurrentNum = (value, row) => { |
| | | if (value > row.pendingQuantity) { |
| | | row.schedulingNum = row.pendingQuantity |
| | | proxy.$modal.msgWarning('æäº§æ°éä¸å¯å¤§äºå¾
æäº§æ°é') |
| | | } |
| | | } |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = (type, rows) => { |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | |
| | | // å¤çä¼ å
¥çæ°æ® |
| | | dispatchList.value = rows.map(row => ({ |
| | | ...row, |
| | | schedulingNum: 0, // åå§åæ¬æ¬¡æäº§æ°é为0 |
| | | pendingQuantity: (Number(row.quantity) || 0) - (Number(row.schedulingNum) || 0) // 计ç®å¾
æäº§æ°é |
| | | })) |
| | | } |
| | | |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | // æ£æ¥æ¯å¦ææäº§æ°æ® |
| | | const hasSchedulingData = dispatchList.value.some(item => item.schedulingNum > 0) |
| | | if (!hasSchedulingData) { |
| | | proxy.$modal.msgWarning('请è³å°ä¸ºä¸æ¡è®°å½è®¾ç½®æäº§æ°é') |
| | | return |
| | | } |
| | | |
| | | // æé æäº¤æ°æ® - ç´æ¥ä¼ éæ°ç»ï¼ä¸è¿æ»¤ |
| | | const submitData = dispatchList.value |
| | | |
| | | console.log('æäº¤èªå¨æ´¾å·¥æ°æ®:', submitData) |
| | | |
| | | // è°ç¨APIï¼è¿ééè¦æ ¹æ®å®é
æ¥å£è°æ´ï¼ |
| | | productionDispatchList(submitData).then(res => { |
| | | proxy.$modal.msgSuccess(res.msg); |
| | | closeDia(); |
| | | }).catch(err => { |
| | | proxy.$modal.msgError("派工失败"); |
| | | console.error('派工失败:', err); |
| | | }) |
| | | } |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | dispatchList.value = [] |
| | | emit('close') |
| | | }; |
| | | |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | :deep(.even-row) { |
| | | background-color: #fafafa; |
| | | } |
| | | |
| | | :deep(.el-table .cell) { |
| | | padding: 8px 12px; |
| | | } |
| | | |
| | | :deep(.el-table th) { |
| | | background-color: #f5f7fa; |
| | | color: #606266; |
| | | font-weight: 600; |
| | | } |
| | | </style> |
| | |
| | | @close="closeDia" |
| | | > |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <!-- <el-col :span="12">--> |
| | | <!-- <el-form-item label="项ç®åç§°ï¼" prop="projectName">--> |
| | | <!-- <el-input v-model="form.projectName" placeholder="请è¾å
¥" clearable disabled/>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | <!-- <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项ç®åç§°ï¼" prop="projectName"> |
| | | <el-input v-model="form.projectName" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产å大类ï¼" prop="productCategory"> |
| | | <el-input v-model="form.productCategory" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ»æ°éï¼" prop="quantity"> |
| | | <el-input v-model="form.quantity" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> --> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è§æ ¼åå·ï¼" prop="specificationModel"> |
| | | <el-input v-model="form.specificationModel" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»å®æºå¨ï¼" prop="speculativeTradingName"> |
| | | <el-input v-model="form.speculativeTradingName" placeholder="èªå¨è·å" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ»æ°éï¼" prop="quantity"> |
| | | <el-input v-model="form.quantity" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¾
æäº§æ°éï¼" prop="pendingQuantity"> |
| | | <el-input v-model="form.pendingQuantity" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡æäº§æ°éï¼" prop="schedulingNum"> |
| | | <el-input-number |
| | | v-model="form.schedulingNum" |
| | |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产å大类ï¼" prop="productCategory"> |
| | | <el-input v-model="form.productCategory" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | |
| | | v-model="form.schedulingUserId" |
| | | placeholder="éæ©äººå" |
| | | style="width: 100%;" |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | > |
| | | <el-option |
| | | v-for="user in userList" |
| | |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {productionDispatch} from "@/api/productionManagement/productionOrder.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | |
| | | form: { |
| | | projectName: "", |
| | | productCategory: "", |
| | | specificationModel: "", // è§æ ¼åå· |
| | | quantity: "", |
| | | schedulingNum: "", |
| | | schedulingUserId: "", |
| | | schedulingDate: "", |
| | | pendingQuantity: "", |
| | | speculativeTradingName: "", // ç»å®æºå¨åç§° |
| | | }, |
| | | rules: { |
| | | schedulingNum: [{ required: true, message: "请è¾å
¥", trigger: "blur" },], |
| | |
| | | const { form, rules } = toRefs(data); |
| | | const userList = ref([]) |
| | | const userStore = useUserStore() |
| | | |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openDialog = (type, row) => { |
| | |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate(valid => { |
| | | if (valid) { |
| | | form.value.salesLedgerProductId = form.value.id |
| | | productionDispatch(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- çæº1-4 å±ç¤ºï¼æ»é / æ£å¨ç产é / 空ä½éï¼ --> |
| | | <div class="machines-grid"> |
| | | <div v-for="machine in machines" :key="machine.id" class="machine-card"> |
| | | <div class="machine-title">{{ machine.name }}</div> |
| | | <div class="machine-metrics"> |
| | | <div class="machine-control"> |
| | | <span>æ»é(kg)ï¼</span> |
| | | <el-input-number v-model="machineData[machine.name].workLoad" :min="0" :step="1" size="small" /> |
| | | </div> |
| | | <div><span> é¢è®¡æå
¥é(kg)ï¼</span><span>{{ machineData[machine.name].currentWorkLoad }}</span></div> |
| | | <div><span>空ä½å·¥ä½é(kg)ï¼</span><span>{{ machineData[machine.name].vacant }}</span></div> |
| | | </div> |
| | | </div> |
| | | <div class="save-button-container"> |
| | | <div class="loss-rate-container"> |
| | | <span class="loss-rate-label">æèç(%)ï¼</span> |
| | | <el-select v-model="rate" placeholder="è¯·éæ©æèç" style="width: 120px" size="small"> |
| | | <el-option label="6" :value="6" /> |
| | | <el-option label="7" :value="7" /> |
| | | <el-option label="8" :value="8" /> |
| | | <el-option label="9" :value="9" /> |
| | | <el-option label="10" :value="10" /> |
| | | </el-select> |
| | | </div> |
| | | <el-button type="primary" @click="saveMachineTotals" size="small">ä¿å设置</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">客æ·åç§°ï¼</span> |
| | |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <span class="search_title ml10">项ç®åç§°ï¼</span> |
| | | <span class="search_title ml10">ååå·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.projectName" |
| | | v-model="searchForm.salesContractNo" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <!-- <span class="search_title ml10">项ç®åç§°ï¼</span>--> |
| | | <!-- <el-input--> |
| | | <!-- v-model="searchForm.projectName"--> |
| | | <!-- style="width: 240px"--> |
| | | <!-- placeholder="请è¾å
¥"--> |
| | | <!-- @change="handleQuery"--> |
| | | <!-- clearable--> |
| | | <!-- prefix-icon="Search"--> |
| | | <!-- />--> |
| | | <span class="search_title ml10">å½å
¥æ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange" |
| | | placeholder="è¯·éæ©" clearable @change="changeDaterange" /> |
| | | placeholder="è¯·éæ©" clearable @change="changeDaterange" /> |
| | | <el-checkbox |
| | | style="margin-left: 10px" |
| | | v-model="searchForm.status" |
| | | label="䏿¾ç¤ºå¾
ææ°é为0" |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">ç产派工</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | <el-button type="primary" @click="openForm('add')">ç产派工</el-button> |
| | | <el-button type="success" @click="openAutoDispatch">èªå¨æ´¾å·¥</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | |
| | | ></PIMTable> |
| | | </div> |
| | | <form-dia ref="formDia" @close="handleQuery"></form-dia> |
| | | <auto-dispatch-dia ref="autoDispatchDia" @close="handleQuery"></auto-dispatch-dia> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {onMounted, ref} from "vue"; |
| | | import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick, computed, watch} from "vue"; |
| | | import FormDia from "@/views/productionManagement/productionDispatching/components/formDia.vue"; |
| | | import {schedulingListPage} from "@/api/productionManagement/productionOrder.js"; |
| | | import AutoDispatchDia from "@/views/productionManagement/productionDispatching/components/autoDispatchDia.vue"; |
| | | import dayjs from "dayjs"; |
| | | import {schedulingListPage, schedulingList, addSpeculatTrading, updateSpeculatTrading, getLossRate, addLossRate, updateLossRate} from "@/api/productionManagement/productionOrder.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: "", |
| | | salesContractNo: "", |
| | | projectName: "", |
| | | entryDate: null, // å½å
¥æ¥æ |
| | | entryDateStart: undefined, |
| | | entryDateEnd: undefined, |
| | | status: true, |
| | | entryDate: [dayjs().format("YYYY-MM-DD"), dayjs().format("YYYY-MM-DD")], // å½å
¥æ¥æï¼é»è®¤å½å¤© |
| | | entryDateStart: dayjs().format("YYYY-MM-DD"), |
| | | entryDateEnd: dayjs().format("YYYY-MM-DD"), |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ååå·", |
| | | prop: "salesContractNo", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | width: 250, |
| | | }, |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | width: 160, |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "ç»å®æºå¨", |
| | | prop: "speculativeTradingName", |
| | | width: 160, |
| | | }, |
| | | { |
| | | label: "åä½", |
| | |
| | | }, |
| | | { |
| | | label: "å½å
¥æ¥æ", |
| | | prop: "registerDate", |
| | | prop: "entryDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "ç¶æ", |
| | | prop: "status", |
| | | dataType: "tag", |
| | | formatType: (params) => { |
| | | if (params == 'ç产ä¸') { |
| | | return "warning"; |
| | | } else if (params == 'æªå¼å§') { |
| | | return "danger"; |
| | | } else { |
| | | return "success"; |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: "ç产è¿åº¦", |
| | | prop: "progress", |
| | | formatData: (cellValue) => { |
| | | // 妿å¼ä¸ºç©ºæundefinedï¼æ¾ç¤ºç©ºå符串 |
| | | if (cellValue === null || cellValue === undefined || cellValue === '') { |
| | | return ''; |
| | | } |
| | | // ç´æ¥å¨æ°åå颿·»å ç¾åå· |
| | | return `${cellValue}%`; |
| | | } |
| | | }, |
| | | { |
| | | label: "æ°é", |
| | |
| | | { |
| | | label: "æäº§æ°é", |
| | | prop: "schedulingNum", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "å¾
ææ°é", |
| | | prop: "pendingQuantity", |
| | | width: 100, |
| | | fixed: 'right', |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | |
| | | total: 0, |
| | | }); |
| | | const formDia = ref() |
| | | const autoDispatchDia = ref() |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | // çæºæ°æ® |
| | | const machineData = reactive({ |
| | | "çæº1": { workLoad: 0, currentWorkLoad: 0, vacant: 0 }, |
| | | "çæº2": { workLoad: 0, currentWorkLoad: 0, vacant: 0 }, |
| | | "çæº3": { workLoad: 0, currentWorkLoad: 0, vacant: 0 }, |
| | | "çæº4": { workLoad: 0, currentWorkLoad: 0, vacant: 0 } |
| | | }) |
| | | |
| | | // çæºé
ç½®æ°ç» |
| | | const machines = [ |
| | | { id: 1, name: 'çæº1' }, |
| | | { id: 2, name: 'çæº2' }, |
| | | { id: 3, name: 'çæº3' }, |
| | | { id: 4, name: 'çæº4' } |
| | | ] |
| | | |
| | | // ä¿åçæºæ»é设置 |
| | | const saveMachineTotals = () => { |
| | | // éªè¯æèçæ¯å¦å·²éæ© |
| | | if (rate.value === null || rate.value === undefined || isNaN(rate.value)) { |
| | | proxy.$message.warning('è¯·éæ©æèç'); |
| | | return; |
| | | } |
| | | |
| | | // æé ä¿åæ°æ®æ°ç»ï¼ä½¿ç¨machinesæ°ç»å¾ªç¯æå»º |
| | | const saveData = machines.map(machine => { |
| | | const saveItem = { |
| | | name: machine.name, // çæºåç§° |
| | | workLoad: machineData[machine.name].workLoad, // æ»é |
| | | currentWorkLoad: machineData[machine.name].currentWorkLoad, // é¢è®¡æå
¥é |
| | | vacant: machineData[machine.name].vacant // 空ä½é |
| | | }; |
| | | |
| | | // 妿æ¯ä¿®æ¹æä½ï¼éè¦ä¼ éidåæ®µ |
| | | if (hasQueryData.value) { |
| | | const queryData = getMachineQueryData(machine.id); |
| | | if (queryData && queryData.id) { |
| | | saveItem.id = queryData.id; |
| | | } |
| | | } |
| | | |
| | | return saveItem; |
| | | }); |
| | | |
| | | // æé æèçæ°æ® |
| | | const rateData = { |
| | | rate: rate.value |
| | | }; |
| | | |
| | | // 妿æIDï¼è¯´ææ¯ä¿®æ¹æä½ |
| | | if (rateId.value) { |
| | | rateData.id = rateId.value; |
| | | } |
| | | |
| | | // æ ¹æ®æ¯å¦ææ¥è¯¢æ°æ®å³å®è°ç¨æ°å¢æ¥å£è¿æ¯ä¿®æ¹æ¥å£ |
| | | const saveApi = hasQueryData.value ? updateSpeculatTrading : addSpeculatTrading; |
| | | const successMessage = hasQueryData.value ? 'çæºè®¾ç½®ä¿®æ¹æå' : 'çæºè®¾ç½®æ°å¢æå'; |
| | | |
| | | // æ ¹æ®æ¯å¦æIDå³å®è°ç¨æ°å¢æ¥å£è¿æ¯ä¿®æ¹æ¥å£ |
| | | const rateApi = rateId.value ? updateLossRate : addLossRate; |
| | | const rateSuccessMessage = rateId.value ? 'æèçä¿®æ¹æå' : 'æèçæ°å¢æå'; |
| | | |
| | | // å¹¶è¡è°ç¨ä¸¤ä¸ªæ¥å£ |
| | | Promise.all([ |
| | | saveApi(saveData), |
| | | rateApi(rateData) |
| | | ]).then(([saveRes, rateRes]) => { |
| | | proxy.$message.success(successMessage); |
| | | proxy.$message.success(rateSuccessMessage); |
| | | |
| | | // ä¿åæååï¼è®¾ç½®hasQueryData为trueï¼ä¸æ¬¡ä¿åå°è°ç¨ä¿®æ¹æ¥å£ |
| | | if (!hasQueryData.value) { |
| | | hasQueryData.value = true; |
| | | } |
| | | |
| | | // 妿è¿åäºIDï¼ä¿åèµ·æ¥ |
| | | if (rateRes && rateRes.data && rateRes.data.id) { |
| | | rateId.value = rateRes.data.id; |
| | | } |
| | | |
| | | // ä¿åæååéæ°è°ç¨æ¥è¯¢é¡µé¢ |
| | | getList(); |
| | | }).catch(err => { |
| | | proxy.$message.error('ä¿å失败'); |
| | | console.error('ä¿å失败:', err); |
| | | }); |
| | | } |
| | | |
| | | // è·åçæºæ¥è¯¢æ°æ® |
| | | const machineQueryData = ref([]); |
| | | |
| | | const getMachineQueryData = (machineId) => { |
| | | return machineQueryData.value.find(item => item.id === machineId); |
| | | }; |
| | | |
| | | const getMachineIndex = (item) => { |
| | | // å
¼å®¹å¤ç§å段å½åï¼è¿å 1-4 ä¹ä¸ï¼å¦åè¿å 0ï¼æªç¥ï¼ |
| | | const candidates = [item.machineId, item.machineNo, item.machine, item.deviceNo, item.deviceId] |
| | | for (const v of candidates) { |
| | | if (v === undefined || v === null) continue |
| | | const n = Number(String(v).replace(/[^\d]/g, "")) // æ½åæ°å |
| | | if ([1,2,3,4].includes(n)) return n |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | const computeTodaySummary = () => { |
| | | const todayStr = dayjs().format("YYYY-MM-DD") |
| | | |
| | | // éç½®ææçæºæ°æ® |
| | | machines.forEach(machine => { |
| | | machineData[machine.name] = { workLoad: 0, currentWorkLoad: 0, vacant: 0 } |
| | | }) |
| | | |
| | | tableData.value.forEach(item => { |
| | | // ä»
ç»è®¡å½å¤© |
| | | const isToday = dayjs(item.entryDate).format("YYYY-MM-DD") === todayStr |
| | | if (!isToday) return |
| | | |
| | | // ä½¿ç¨æ£ç¡®çåæ®µåï¼workLoadï¼çæºå·¥ä½éï¼, currentWorkLoadï¼çæºæ£å¨å·¥ä½éï¼ |
| | | const workLoad = Number(item.workLoad) || 0 |
| | | const currentWorkLoad = Number(item.currentWorkLoad) || 0 |
| | | const machineName = item.speculativeTradingName || 'çæº1' |
| | | |
| | | if (machineData[machineName]) { |
| | | machineData[machineName].workLoad += workLoad |
| | | machineData[machineName].currentWorkLoad += currentWorkLoad |
| | | machineData[machineName].vacant = machineData[machineName].workLoad - machineData[machineName].currentWorkLoad |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | // æ¯å¦ææ¥è¯¢æ°æ® |
| | | const hasQueryData = ref(false) |
| | | // æèç |
| | | const rate = ref(6) |
| | | // æèçID |
| | | const rateId = ref(null) |
| | | |
| | | // è·åçæºæ£å¨å·¥ä½éæ°æ® |
| | | const getMachineProductionData = () => { |
| | | schedulingList().then((res) => { |
| | | // å¤ççæºæ£å¨å·¥ä½éæ°æ® |
| | | if (res.data && Array.isArray(res.data)) { |
| | | // 设置æ¯å¦ææ¥è¯¢æ°æ® |
| | | hasQueryData.value = res.data.length > 0 |
| | | |
| | | // ä¿åæ¥è¯¢æ°æ®å°machineQueryData |
| | | machineQueryData.value = res.data; |
| | | |
| | | // éç½®ææçæºæ°æ® |
| | | machines.forEach(machine => { |
| | | machineData[machine.name] = { workLoad: 0, currentWorkLoad: 0, vacant: 0 } |
| | | }); |
| | | |
| | | // éåæ°æ®ï¼æ ¹æ®æ¥è¯¢è¿åçæ°æ®ç»æå¤ç |
| | | res.data.forEach(item => { |
| | | // æ ¹æ®nameåæ®µç¡®å®çæº |
| | | const machineName = item.name || 'çæº1'; |
| | | |
| | | if (machineData[machineName]) { |
| | | // 妿æ¥è¯¢æ°æ®ä¸æworkLoadï¼ååå§åçæºæ»é |
| | | if (item.workLoad !== null && item.workLoad !== undefined) { |
| | | machineData[machineName].workLoad = Number(item.workLoad) || 0; |
| | | } |
| | | |
| | | // 妿æ¥è¯¢æ°æ®ä¸æcurrentWorkLoadï¼å设置æ£å¨å·¥ä½é |
| | | if (item.currentWorkLoad !== null && item.currentWorkLoad !== undefined) { |
| | | machineData[machineName].currentWorkLoad = Number(item.currentWorkLoad) || 0; |
| | | } |
| | | |
| | | // 计ç®ç©ºä½å·¥ä½é |
| | | machineData[machineName].vacant = machineData[machineName].workLoad - machineData[machineName].currentWorkLoad; |
| | | } |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | console.error('è·åçæºæ£å¨å·¥ä½éæ°æ®å¤±è´¥:', err); |
| | | }); |
| | | }; |
| | | |
| | | const changeDaterange = (value) => { |
| | | if (value) { |
| | | searchForm.value.entryDateStart = value[0]; |
| | |
| | | schedulingListPage(params).then((res) => { |
| | | tableLoading.value = false; |
| | | // å¤çæ¯æ¡æ°æ®ï¼å¢å pendingQuantityåæ®µ |
| | | tableData.value = res.data.data.records.map(item => ({ |
| | | tableData.value = res.data.records.map(item => ({ |
| | | ...item, |
| | | pendingQuantity: (Number(item.quantity) || 0) - (Number(item.schedulingNum) || 0) |
| | | })); |
| | | page.total = res.data.data.total; |
| | | page.total = res.data.total; |
| | | computeTodaySummary() |
| | | |
| | | // åæ¶è·åçæºæ£å¨å·¥ä½éæ°æ® |
| | | getMachineProductionData(); |
| | | // è·åæèçæ°æ® |
| | | getLossRateData(); |
| | | }).catch(() => { |
| | | tableLoading.value = false; |
| | | }) |
| | | }; |
| | | |
| | | // è·åæèçæ°æ® |
| | | const getLossRateData = () => { |
| | | getLossRate().then((res) => { |
| | | const data = res.data || res; |
| | | if (data && data.rate !== undefined && data.rate !== null) { |
| | | rate.value = Number(data.rate); // ç¡®ä¿è½¬æ¢ä¸ºæ°å |
| | | rateId.value = data.id || null; |
| | | } else { |
| | | rate.value = 6; |
| | | rateId.value = null; |
| | | } |
| | | }).catch(err => { |
| | | console.error('è·åæèçæ°æ®å¤±è´¥:', err); |
| | | rate.value = 6; |
| | | rateId.value = null; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | |
| | | }) |
| | | }; |
| | | |
| | | // æå¼èªå¨æ´¾å·¥å¼¹æ¡ |
| | | const openAutoDispatch = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$message.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | |
| | | // è¿æ»¤æå¾
æäº§æ°é为0çæ°æ® |
| | | const validRows = selectedRows.value.filter(row => row.pendingQuantity > 0); |
| | | |
| | | if (validRows.length === 0) { |
| | | proxy.$message.warning("éä¸çæ°æ®æ éæ´¾å·¥"); |
| | | return; |
| | | } |
| | | |
| | | nextTick(() => { |
| | | autoDispatchDia.value?.openDialog('auto', validRows) |
| | | }) |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/productionOrder/exportOne", {}, "ç产派工.xlsx"); |
| | | proxy.download("/salesLedger/scheduling/exportOne", {}, "ç产派工.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getLossRateData(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| | | <style scoped> |
| | | .summary-bar{ |
| | | display: flex; |
| | | gap: 16px; |
| | | margin: 10px 0 16px 0; |
| | | } |
| | | .summary-item{ |
| | | background: #f5f7fa; |
| | | border: 1px solid #ebeef5; |
| | | border-radius: 6px; |
| | | padding: 10px 16px; |
| | | min-width: 160px; |
| | | } |
| | | .summary-label{ |
| | | color: #909399; |
| | | font-size: 12px; |
| | | margin-bottom: 6px; |
| | | } |
| | | .summary-value{ |
| | | color: #303133; |
| | | font-size: 20px; |
| | | font-weight: 600; |
| | | } |
| | | .summary-control{ |
| | | display: flex; |
| | | align-items: center; |
| | | height: 28px; |
| | | } |
| | | .machines-grid{ |
| | | display: grid; |
| | | grid-template-columns: repeat(4, 1fr); |
| | | gap: 16px; |
| | | margin-bottom: 20px; |
| | | padding: 16px; |
| | | background: #f8f9fa; |
| | | border-radius: 8px; |
| | | border: 1px solid #e9ecef; |
| | | } |
| | | .machine-card{ |
| | | border: 1px solid #dee2e6; |
| | | border-radius: 8px; |
| | | padding: 16px; |
| | | background: #fff; |
| | | box-shadow: 0 2px 4px rgba(0,0,0,0.05); |
| | | transition: all 0.3s ease; |
| | | } |
| | | .machine-card:hover{ |
| | | transform: translateY(-2px); |
| | | box-shadow: 0 4px 8px rgba(0,0,0,0.1); |
| | | } |
| | | .machine-title{ |
| | | font-weight: 600; |
| | | font-size: 16px; |
| | | margin-bottom: 12px; |
| | | color: #2c3e50; |
| | | text-align: center; |
| | | padding-bottom: 8px; |
| | | border-bottom: 2px solid #3498db; |
| | | } |
| | | .machine-metrics{ |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | color: #495057; |
| | | } |
| | | .machine-control{ |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | gap: 8px; |
| | | padding: 8px 0; |
| | | border-bottom: 1px solid #f1f3f4; |
| | | } |
| | | .machine-control span{ |
| | | font-size: 14px; |
| | | white-space: nowrap; |
| | | color: #6c757d; |
| | | font-weight: 500; |
| | | } |
| | | .machine-metrics > div:not(.machine-control) { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 4px 0; |
| | | font-size: 14px; |
| | | } |
| | | .machine-metrics > div:not(.machine-control) span:first-child { |
| | | color: #6c757d; |
| | | } |
| | | .machine-metrics > div:not(.machine-control) span:last-child { |
| | | font-weight: 600; |
| | | color: #2c3e50; |
| | | } |
| | | .save-button-container{ |
| | | grid-column: 1 / -1; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | gap: 16px; |
| | | margin-top: 16px; |
| | | padding-top: 16px; |
| | | border-top: 1px solid #e9ecef; |
| | | } |
| | | .loss-rate-container{ |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | } |
| | | .loss-rate-label{ |
| | | font-size: 14px; |
| | | color: #6c757d; |
| | | font-weight: 500; |
| | | white-space: nowrap; |
| | | } |
| | | </style> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">产å大类ï¼</span> |
| | | <el-tree-select |
| | | v-model="searchForm.productCategory" |
| | | :data="productOptions" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | check-strictly |
| | | :render-after-expand="false" |
| | | style="width: 240px" |
| | | @change="handleQuery" |
| | | /> |
| | | <span class="search_title ml10">å½å
¥æ¥æï¼</span> |
| | | <el-date-picker v-model="searchForm.registerDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange" |
| | | placeholder="è¯·éæ©" clearable @change="changeDaterange" /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openDialog('create')">æ°å¢è®¢å</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | > |
| | | <template #action="{ row }"> |
| | | <el-button type="primary" link @click="handleEdit(row)">ç¼è¾</el-button> |
| | | <el-button type="danger" link @click="handleDelete(row)">å é¤</el-button> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <el-dialog v-model="dialogVisible" :title="dialogTitle" width="40%" @close="closeDialog"> |
| | | <el-form ref="formRef" :model="form" :rules="formRules" label-width="100px"> |
| | | <el-form-item label="å½å
¥æ¥æ" prop="registerDate"> |
| | | <el-date-picker v-model="form.registerDate" type="date" value-format="YYYY-MM-DD" format="YYYY-MM-DD" placeholder="è¯·éæ©å½å
¥æ¥æ" style="width: 100%"/> |
| | | </el-form-item> |
| | | <el-form-item label="产å大类" prop="productCategory"> |
| | | <el-tree-select |
| | | v-model="form.productCategory" |
| | | :data="productOptions" |
| | | placeholder="è¯·éæ©äº§å大类" |
| | | clearable |
| | | check-strictly |
| | | :render-after-expand="false" |
| | | style="width: 100%" |
| | | @change="handleCategoryChange" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="è§æ ¼åå·" prop="productModelId"> |
| | | <el-select v-model="form.productModelId" placeholder="è¯·éæ©è§æ ¼åå·" style="width: 100%" @change="handleModelChange"> |
| | | <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åä½" prop="unit"> |
| | | <el-input v-model="form.unit" placeholder="èªå¨å¸¦åº" disabled/> |
| | | </el-form-item> |
| | | <el-form-item label="æ°é" prop="quantity"> |
| | | <el-input-number v-model="form.quantity" :min="0" :step="0.1" style="width: 100%"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDialog">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="客æ·åç§°:"> |
| | | <el-input v-model="searchForm.customerName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="ååå·:"> |
| | | <el-input v-model="searchForm.salesContractNo" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="产ååç§°:"> |
| | | <el-input v-model="searchForm.productCategory" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="è§æ ¼:"> |
| | | <el-input v-model="searchForm.specificationModel" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress |
| | | :percentage="toProgressPercentage(row?.completionStatus)" |
| | | :color="progressColor(toProgressPercentage(row?.completionStatus))" |
| | | :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" |
| | | /> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <el-dialog v-model="bindRouteDialogVisible" |
| | | title="ç»å®å·¥èºè·¯çº¿" |
| | | width="500px"> |
| | | <el-form label-width="90px"> |
| | | <el-form-item label="å·¥èºè·¯çº¿"> |
| | | <el-select v-model="bindForm.routeId" |
| | | placeholder="è¯·éæ©å·¥èºè·¯çº¿" |
| | | style="width: 100%;" |
| | | :loading="bindRouteLoading"> |
| | | <el-option v-for="item in routeOptions" |
| | | :key="item.id" |
| | | :label="`${item.processRouteCode || ''}`" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="bindRouteDialogVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" |
| | | :loading="bindRouteSaving" |
| | | @click="handleBindRouteConfirm">确 认</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {onMounted, ref, reactive, toRefs, getCurrentInstance} from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import {schedulingListPage, addProductionOrder, updateProductionOrder, deleteProductionOrder} from "@/api/productionManagement/productionOrder.js"; |
| | | import {productTreeList, modelList} from "@/api/basicData/product.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { onMounted, ref } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { useRouter } from "vue-router"; |
| | | import { |
| | | productOrderListPage, |
| | | listProcessRoute, |
| | | bindingRoute, |
| | | listProcessBom, |
| | | } from "@/api/productionManagement/productionOrder.js"; |
| | | import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "å½å
¥æ¥æ", |
| | | prop: "registerDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "ç产订åå·", |
| | | prop: "orderNo", |
| | | }, |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "æ°é", |
| | | prop: "quantity", |
| | | }, |
| | | // { |
| | | // label: "æäº§æ°é", |
| | | // prop: "schedulingNum", |
| | | // width: 100, |
| | | // }, |
| | | // { |
| | | // label: "å®å·¥æ°é", |
| | | // prop: "successNum", |
| | | // width: 100, |
| | | // }, |
| | | { |
| | | label: "æä½", |
| | | prop: "action", |
| | | width: 120, |
| | | fixed: "right", |
| | | dataType: "slot", |
| | | align: "center", |
| | | slot: "action" |
| | | } |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = ref({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref(""); |
| | | const dialogMode = ref(""); // 'create' æ 'edit' |
| | | const formRef = ref(); |
| | | const productOptions = ref([]); |
| | | const modelOptions = ref([]); |
| | | const form = reactive({ |
| | | id: null, |
| | | registerDate: dayjs().format("YYYY-MM-DD"), |
| | | productCategory: "", |
| | | productCategoryName: "", |
| | | productModelId: "", |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: null, |
| | | }); |
| | | const formRules = { |
| | | registerDate: [{ required: true, message: "è¯·éæ©å½å
¥æ¥æ", trigger: "change" }], |
| | | productCategory: [{ required: true, message: "è¯·éæ©äº§å大类", trigger: "change" }], |
| | | productModelId: [{ required: true, message: "è¯·éæ©è§æ ¼åå·", trigger: "change" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥æ°é", trigger: "blur" }], |
| | | }; |
| | | const router = useRouter(); |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | productCategory: "", |
| | | registerDate: null, // å½å
¥æ¥æ |
| | | entryDateStart: undefined, |
| | | entryDateEnd: undefined, |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ç产订åå·", |
| | | prop: "npsNo", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | width: '150px', |
| | | }, |
| | | { |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | width: '200px', |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productCategory", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "è§æ ¼", |
| | | prop: "specificationModel", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "å·¥èºè·¯çº¿ç¼å·", |
| | | prop: "processRouteCode", |
| | | width: '200px', |
| | | }, |
| | | { |
| | | label: "éæ±æ°é", |
| | | prop: "quantity", |
| | | }, |
| | | { |
| | | label: "宿æ°é", |
| | | prop: "completeQuantity", |
| | | }, |
| | | { |
| | | dataType: "slot", |
| | | label: "宿è¿åº¦", |
| | | prop: "completionStatus", |
| | | slot: "completionStatus", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "å¼å§æ¥æ", |
| | | prop: "startTime", |
| | | formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""), |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "ç»ææ¥æ", |
| | | prop: "endTime", |
| | | formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""), |
| | | width: 120, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 200, |
| | | operation: [ |
| | | { |
| | | name: "å·¥èºè·¯çº¿", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showRouteItemModal(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "ç»å®å·¥èºè·¯çº¿", |
| | | type: "text", |
| | | showHide: row => !row.processRouteCode, |
| | | clickFun: row => { |
| | | openBindRouteDialog(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "产åç»æ", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showProductStructure(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const openDialog = (mode, row = null) => { |
| | | dialogMode.value = mode; |
| | | if (mode === 'create') { |
| | | dialogTitle.value = "æ°å¢ç产订å"; |
| | | resetForm(); |
| | | } else if (mode === 'edit') { |
| | | dialogTitle.value = "ç¼è¾ç产订å"; |
| | | resetForm(); |
| | | |
| | | console.log('ç¼è¾æ°æ®:', row); |
| | | |
| | | // å¡«å
ç¼è¾æ°æ® |
| | | form.id = row.id; |
| | | form.registerDate = row.registerDate; |
| | | form.productCategoryName = row.productCategory; |
| | | form.specificationModel = row.specificationModel; |
| | | form.unit = row.unit; |
| | | form.quantity = row.quantity; |
| | | |
| | | // å
å 载产åé项ï¼ç¶åæ ¹æ®åç§°æ¥æ¾å¯¹åºçID |
| | | if (productOptions.value.length === 0) { |
| | | getProductOptions().then(() => { |
| | | findAndSetProductCategory(row.productCategory); |
| | | }); |
| | | } else { |
| | | findAndSetProductCategory(row.productCategory); |
| | | } |
| | | } |
| | | |
| | | dialogVisible.value = true; |
| | | if (productOptions.value.length === 0) { |
| | | getProductOptions(); |
| | | } |
| | | }; |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: "", |
| | | salesContractNo: "", |
| | | projectName: "", |
| | | productCategory: "", |
| | | specificationModel: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | const closeDialog = () => { |
| | | dialogVisible.value = false; |
| | | }; |
| | | const toProgressPercentage = val => { |
| | | const n = Number(val); |
| | | if (!Number.isFinite(n)) return 0; |
| | | if (n <= 0) return 0; |
| | | if (n >= 100) return 100; |
| | | return Math.round(n); |
| | | }; |
| | | |
| | | const resetForm = () => { |
| | | form.id = null; |
| | | form.registerDate = dayjs().format("YYYY-MM-DD"); |
| | | form.productCategory = ""; |
| | | form.productCategoryName = ""; |
| | | form.productModelId = ""; |
| | | form.specificationModel = ""; |
| | | form.unit = ""; |
| | | form.quantity = null; |
| | | modelOptions.value = []; |
| | | }; |
| | | // 30/50/80/100 åæ®µé¢è²ï¼çº¢/æ©/è/绿 |
| | | const progressColor = percentage => { |
| | | const p = toProgressPercentage(percentage); |
| | | if (p < 30) return "#f56c6c"; |
| | | if (p < 50) return "#e6a23c"; |
| | | if (p < 80) return "#409eff"; |
| | | return "#67c23a"; |
| | | }; |
| | | |
| | | const handleCategoryChange = (value) => { |
| | | form.productCategory = value; |
| | | form.productCategoryName = findNodeById(productOptions.value, value) || ""; |
| | | form.productModelId = ""; |
| | | form.specificationModel = ""; |
| | | form.unit = ""; |
| | | modelOptions.value = []; |
| | | if (value) { |
| | | getModels(value); |
| | | } |
| | | }; |
| | | // ç»å®å·¥èºè·¯çº¿å¼¹æ¡ |
| | | const bindRouteDialogVisible = ref(false); |
| | | const bindRouteLoading = ref(false); |
| | | const bindRouteSaving = ref(false); |
| | | const routeOptions = ref([]); |
| | | const bindForm = reactive({ |
| | | orderId: null, |
| | | routeId: null, |
| | | }); |
| | | |
| | | const handleModelChange = (value) => { |
| | | form.productModelId = value; |
| | | const selected = modelOptions.value.find(item => item.id === value); |
| | | if (selected) { |
| | | form.specificationModel = selected.model; |
| | | form.unit = selected.unit || ""; |
| | | } else { |
| | | form.specificationModel = ""; |
| | | form.unit = ""; |
| | | } |
| | | }; |
| | | const openBindRouteDialog = async row => { |
| | | bindForm.orderId = row.id; |
| | | bindForm.routeId = null; |
| | | bindRouteDialogVisible.value = true; |
| | | routeOptions.value = []; |
| | | if (!row.productModelId) { |
| | | proxy.$modal.msgWarning("å½å订å缺å°äº§ååå·ï¼æ æ³æ¥è¯¢å·¥èºè·¯çº¿"); |
| | | bindRouteDialogVisible.value = false; |
| | | return; |
| | | } |
| | | bindRouteLoading.value = true; |
| | | try { |
| | | const res = await listProcessRoute({ productModelId: row.productModelId }); |
| | | routeOptions.value = res.data || []; |
| | | } catch (e) { |
| | | console.error("è·åå·¥èºè·¯çº¿å表失败ï¼", e); |
| | | proxy.$modal.msgError("è·åå·¥èºè·¯çº¿å表失败"); |
| | | } finally { |
| | | bindRouteLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | formRef.value?.validate(async (valid) => { |
| | | if (!valid) return; |
| | | if (!form.unit) { |
| | | proxy.$modal.msgWarning("请å
éæ©è§æ ¼åå·ä»¥å¸¦åºåä½"); |
| | | return; |
| | | } |
| | | try { |
| | | const payload = { |
| | | registerDate: form.registerDate, |
| | | productCategory: form.productCategoryName, |
| | | specificationModel: form.specificationModel, |
| | | unit: form.unit, |
| | | quantity: form.quantity, |
| | | }; |
| | | |
| | | if (dialogMode.value === 'create') { |
| | | await addProductionOrder(payload); |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | } else if (dialogMode.value === 'edit') { |
| | | payload.id = form.id; |
| | | await updateProductionOrder(payload); |
| | | proxy.$modal.msgSuccess("ç¼è¾æå"); |
| | | } |
| | | |
| | | closeDialog(); |
| | | getList(); |
| | | } catch (err) { |
| | | console.error(`${dialogMode.value === 'create' ? 'æ°å¢' : 'ç¼è¾'}失败`, err); |
| | | proxy.$modal.msgError(`${dialogMode.value === 'create' ? 'æ°å¢' : 'ç¼è¾'}失败ï¼è¯·éè¯`); |
| | | } |
| | | }); |
| | | }; |
| | | const handleBindRouteConfirm = async () => { |
| | | if (!bindForm.routeId) { |
| | | proxy.$modal.msgWarning("è¯·éæ©å·¥èºè·¯çº¿"); |
| | | return; |
| | | } |
| | | bindRouteSaving.value = true; |
| | | try { |
| | | await bindingRoute({ |
| | | id: bindForm.orderId, |
| | | routeId: bindForm.routeId, |
| | | }); |
| | | proxy.$modal.msgSuccess("ç»å®æå"); |
| | | bindRouteDialogVisible.value = false; |
| | | getList(); |
| | | } catch (e) { |
| | | console.error("ç»å®å·¥èºè·¯çº¿å¤±è´¥ï¼", e); |
| | | proxy.$modal.msgError("ç»å®å·¥èºè·¯çº¿å¤±è´¥"); |
| | | } finally { |
| | | bindRouteSaving.value = false; |
| | | } |
| | | }; |
| | | |
| | | // ç¼è¾æ¹æ³ |
| | | const handleEdit = (row) => { |
| | | openDialog('edit', row); |
| | | }; |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const changeDaterange = value => { |
| | | if (value) { |
| | | searchForm.value.entryDateStart = value[0]; |
| | | searchForm.value.entryDateEnd = value[1]; |
| | | } else { |
| | | searchForm.value.entryDateStart = undefined; |
| | | searchForm.value.entryDateEnd = undefined; |
| | | } |
| | | handleQuery(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | // æé ä¸ä¸ªæ°ç对象ï¼ä¸å
å«entryDateåæ®µ |
| | | const params = { ...searchForm.value, ...page }; |
| | | params.entryDate = undefined; |
| | | productOrderListPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // å 餿¹æ³ |
| | | const handleDelete = (row) => { |
| | | proxy.$modal.confirm(`ç¡®å®è¦å é¤ç产订å"${row.orderNo}"åï¼`, "å é¤ç¡®è®¤", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(async () => { |
| | | try { |
| | | await deleteProductionOrder([row.id]); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); // å·æ°å表 |
| | | } catch (err) { |
| | | console.error("å é¤å¤±è´¥", err); |
| | | proxy.$modal.msgError("å é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶å é¤"); |
| | | }); |
| | | }; |
| | | const showRouteItemModal = async row => { |
| | | const orderId = row.id; |
| | | try { |
| | | const res = await getOrderProcessRouteMain(orderId); |
| | | const data = res.data || {}; |
| | | if (!data || !data.id) { |
| | | proxy.$modal.msgWarning("æªæ¾å°å
³èçå·¥èºè·¯çº¿"); |
| | | return; |
| | | } |
| | | router.push({ |
| | | path: "/productionManagement/processRouteItem", |
| | | query: { |
| | | id: data.id, |
| | | processRouteCode: data.processRouteCode || "", |
| | | productName: data.productName || "", |
| | | model: data.model || "", |
| | | bomNo: data.bomNo || "", |
| | | description: data.description || "", |
| | | orderId, |
| | | type: "order", |
| | | }, |
| | | }); |
| | | } catch (e) { |
| | | console.error("è·åå·¥èºè·¯çº¿ä¸»ä¿¡æ¯å¤±è´¥ï¼", e); |
| | | proxy.$modal.msgError("è·åå·¥èºè·¯çº¿ä¿¡æ¯å¤±è´¥"); |
| | | } |
| | | }; |
| | | |
| | | const getProductOptions = () => { |
| | | return productTreeList().then((res) => { |
| | | productOptions.value = convertIdToValue(res || []); |
| | | }); |
| | | }; |
| | | const showProductStructure = row => { |
| | | router.push({ |
| | | path: "/productionManagement/productStructureDetail", |
| | | query: { |
| | | id: row.id, |
| | | bomNo: row.bomNo || "", |
| | | productName: row.productCategory || "", |
| | | productModelName: row.specificationModel || "", |
| | | orderId: row.id, |
| | | type: "order", |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | const getModels = (value) => { |
| | | return modelList({ id: value }).then((res) => { |
| | | modelOptions.value = res || []; |
| | | }); |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/productOrder/export", {...searchForm.value}, "ç产订å.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | const convertIdToValue = (data) => { |
| | | return data.map((item) => { |
| | | const { id, children, ...rest } = item; |
| | | const newItem = { |
| | | ...rest, |
| | | value: id, |
| | | }; |
| | | if (children && children.length > 0) { |
| | | newItem.children = convertIdToValue(children); |
| | | } |
| | | return newItem; |
| | | }); |
| | | }; |
| | | const handleConfirmRoute = () => {}; |
| | | |
| | | const findNodeById = (nodes, value) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === value) { |
| | | return nodes[i].label; |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const label = findNodeById(nodes[i].children, value); |
| | | if (label) return label; |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | const findNodeByLabel = (nodes, label) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].label === label) { |
| | | return nodes[i].value; |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const value = findNodeByLabel(nodes[i].children, label); |
| | | if (value) return value; |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | const findAndSetProductCategory = (categoryName) => { |
| | | const categoryId = findNodeByLabel(productOptions.value, categoryName); |
| | | if (categoryId) { |
| | | form.productCategory = categoryId; |
| | | // å 载对åºçè§æ ¼åå·é项 |
| | | getModels(categoryId).then(() => { |
| | | // æ ¹æ®è§æ ¼åå·åç§°æ¥æ¾å¯¹åºçID |
| | | const modelItem = modelOptions.value.find(item => item.model === form.specificationModel); |
| | | if (modelItem) { |
| | | form.productModelId = modelItem.id; |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.value.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.value.current = obj.page; |
| | | page.value.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const changeDaterange = (value) => { |
| | | if (value) { |
| | | searchForm.value.entryDateStart = value[0]; |
| | | searchForm.value.entryDateEnd = value[1]; |
| | | } else { |
| | | searchForm.value.entryDateStart = undefined; |
| | | searchForm.value.entryDateEnd = undefined; |
| | | } |
| | | handleQuery(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | // æé ä¸ä¸ªæ°ç对象ï¼ä¸å
å«entryDateåæ®µ |
| | | const params = { ...searchForm.value, ...page.value }; |
| | | params.registerDate = undefined |
| | | if (params.productCategory) { |
| | | // 妿æ¯å¯¹è±¡ç±»åï¼è·åå
¶labelï¼åç§°ï¼è䏿¯valueï¼IDï¼ |
| | | if (typeof params.productCategory === "object") { |
| | | params.productCategory = findNodeById(productOptions.value, params.productCategory) || params.productCategory; |
| | | } |
| | | // 妿æ¯IDï¼è½¬æ¢ä¸ºåç§° |
| | | else if (typeof params.productCategory === "string" || typeof params.productCategory === "number") { |
| | | const categoryName = findNodeById(productOptions.value, params.productCategory); |
| | | if (categoryName) { |
| | | params.productCategory = categoryName; |
| | | } |
| | | } |
| | | } |
| | | schedulingListPage(params).then((res) => { |
| | | console.log('params---', res) |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.data.records; |
| | | page.value.total = res.data.data.total; |
| | | }).catch(() => { |
| | | tableLoading.value = false; |
| | | }) |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/productionOrder/export", {}, "ç产订å.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getProductOptions(); |
| | | }); |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | <style scoped lang="scss"> |
| | | .search_form{ |
| | | align-items: start; |
| | | }</style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="ç¼è¾å·¥åº" |
| | | width="400" |
| | | @close="closeModal" |
| | | > |
| | | <el-form label-width="140px" :model="formState" label-position="top" ref="formRef"> |
| | | <el-form-item |
| | | label="å·¥åºåç§°ï¼" |
| | | prop="name" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: '请è¾å
¥å·¥åºåç§°', |
| | | }, |
| | | { |
| | | max: 100, |
| | | message: 'æå¤100个å符', |
| | | } |
| | | ]"> |
| | | <el-input v-model="formState.name" /> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥åºç¼å·" prop="no"> |
| | | <el-input v-model="formState.no" /> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥èµå®é¢" prop="salaryQuota"> |
| | | <el-input v-model="formState.salaryQuota" type="number" :step="0.001" /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="formState.remark" type="textarea" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, getCurrentInstance, watch } from "vue"; |
| | | import {update} from "@/api/productionManagement/productionProcess.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | |
| | | record: { |
| | | type: Object, |
| | | required: true, |
| | | } |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | // ååºå¼æ°æ®ï¼æ¿ä»£é项å¼ç dataï¼ |
| | | const formState = ref({ |
| | | id: props.record.id, |
| | | name: props.record.name, |
| | | no: props.record.no, |
| | | remark: props.record.remark, |
| | | salaryQuota: props.record.salaryQuota, |
| | | }); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | }, |
| | | }); |
| | | |
| | | // çå¬ record ååï¼æ´æ°è¡¨åæ°æ® |
| | | watch(() => props.record, (newRecord) => { |
| | | if (newRecord && isShow.value) { |
| | | formState.value = { |
| | | id: newRecord.id, |
| | | name: newRecord.name || '', |
| | | no: newRecord.no || '', |
| | | remark: newRecord.remark || '', |
| | | salaryQuota: newRecord.salaryQuota || '', |
| | | }; |
| | | } |
| | | }, { immediate: true, deep: true }); |
| | | |
| | | // çå¬å¼¹çªæå¼ï¼éæ°åå§åè¡¨åæ°æ® |
| | | watch(() => props.visible, (visible) => { |
| | | if (visible && props.record) { |
| | | formState.value = { |
| | | id: props.record.id, |
| | | name: props.record.name || '', |
| | | no: props.record.no || '', |
| | | remark: props.record.remark || '', |
| | | salaryQuota: props.record.salaryQuota || '', |
| | | }; |
| | | } |
| | | }); |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | update(formState.value).then(res => { |
| | | // å
³éæ¨¡ææ¡ |
| | | isShow.value = false; |
| | | // åç¥ç¶ç»ä»¶å·²å®æ |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | }) |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="æ°å¢å·¥åº" |
| | | width="400" |
| | | @close="closeModal" |
| | | > |
| | | <el-form label-width="140px" :model="formState" label-position="top" ref="formRef"> |
| | | <el-form-item |
| | | label="å·¥åºåç§°ï¼" |
| | | prop="name" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: '请è¾å
¥å·¥åºåç§°', |
| | | }, |
| | | { |
| | | max: 100, |
| | | message: 'æå¤100个å符', |
| | | } |
| | | ]"> |
| | | <el-input v-model="formState.name" /> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥åºç¼å·" prop="no"> |
| | | <el-input v-model="formState.no" /> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥èµå®é¢" prop="salaryQuota"> |
| | | <el-input v-model="formState.salaryQuota" type="number" :step="0.001" /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="formState.remark" type="textarea" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, getCurrentInstance } from "vue"; |
| | | import {add} from "@/api/productionManagement/productionProcess.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | // ååºå¼æ°æ®ï¼æ¿ä»£é项å¼ç dataï¼ |
| | | const formState = ref({ |
| | | name: '', |
| | | remark: '', |
| | | salaryQuota: '', |
| | | }); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | }, |
| | | }); |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | add(formState.value).then(res => { |
| | | // å
³éæ¨¡ææ¡ |
| | | isShow.value = false; |
| | | // åç¥ç¶ç»ä»¶å·²å®æ |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | }) |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="å·¥åºåç§°:"> |
| | | <el-input v-model="searchForm.name" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥åºç¼å·:"> |
| | | <el-input v-model="searchForm.no" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <el-button type="primary" |
| | | @click="showNewModal">æ°å¢å·¥åº</el-button> |
| | | <el-button type="info" plain @click="handleImport">导å
¥</el-button> |
| | | <el-button type="danger" |
| | | @click="handleDelete" |
| | | :disabled="selectedRows.length === 0" |
| | | plain>å é¤å·¥åº</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total"></PIMTable> |
| | | </div> |
| | | <new-process v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | @completed="getList" /> |
| | | <edit-process v-if="isShowEditModal" |
| | | v-model:visible="isShowEditModal" |
| | | :record="record" |
| | | @completed="getList" /> |
| | | <ImportDialog |
| | | ref="importDialogRef" |
| | | v-model="importDialogVisible" |
| | | title="导å
¥å·¥åº" |
| | | :action="importAction" |
| | | :headers="importHeaders" |
| | | :auto-upload="false" |
| | | :on-success="handleImportSuccess" |
| | | :on-error="handleImportError" |
| | | @confirm="handleImportConfirm" |
| | | @download-template="handleDownloadTemplate" |
| | | @close="handleImportClose" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import NewProcess from "@/views/productionManagement/productionProcess/New.vue"; |
| | | import EditProcess from "@/views/productionManagement/productionProcess/Edit.vue"; |
| | | import ImportDialog from "@/components/Dialog/ImportDialog.vue"; |
| | | import { listPage, del, importData, downloadTemplate } from "@/api/productionManagement/productionProcess.js"; |
| | | import { getToken } from "@/utils/auth"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | name: "", |
| | | no: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "å·¥åºç¼å·", |
| | | prop: "no", |
| | | }, |
| | | { |
| | | label: "å·¥åºåç§°", |
| | | prop: "name", |
| | | }, |
| | | |
| | | { |
| | | label: "å·¥èµå®é¢", |
| | | prop: "salaryQuota", |
| | | }, |
| | | { |
| | | label: "夿³¨", |
| | | prop: "remark", |
| | | }, |
| | | { |
| | | label: "æ´æ°æ¶é´", |
| | | prop: "updateTime", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 280, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showEditModal(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const isShowNewModal = ref(false); |
| | | const isShowEditModal = ref(false); |
| | | const record = ref({}); |
| | | const importDialogVisible = ref(false); |
| | | const importDialogRef = ref(null); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // 导å
¥ç¸å
³é
ç½® |
| | | const importAction = import.meta.env.VITE_APP_BASE_API + "/productProcess/importData"; |
| | | const importHeaders = { Authorization: "Bearer " + getToken() }; |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | params.entryDate = undefined; |
| | | listPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records.map(item => ({ |
| | | ...item, |
| | | })); |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // æå¼æ°å¢å¼¹æ¡ |
| | | const showNewModal = () => { |
| | | isShowNewModal.value = true; |
| | | }; |
| | | |
| | | const showEditModal = row => { |
| | | isShowEditModal.value = true; |
| | | record.value = row; |
| | | }; |
| | | |
| | | // å é¤ |
| | | function handleDelete() { |
| | | const no = selectedRows.value.map(item => item.no); |
| | | const ids = selectedRows.value.map(item => item.id); |
| | | if (no.length > 2) { |
| | | proxy.$modal |
| | | .confirm( |
| | | 'æ¯å¦ç¡®è®¤å é¤å·¥åºç¼å·ä¸º"' + |
| | | no[0] + |
| | | "ã" + |
| | | no[1] + |
| | | '"ç' + |
| | | no.length + |
| | | "æ¡æ°æ®é¡¹ï¼" |
| | | ) |
| | | .then(function () { |
| | | return del(ids); |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | } else { |
| | | proxy.$modal |
| | | .confirm('æ¯å¦ç¡®è®¤å é¤å·¥åºç¼å·ä¸º"' + no + '"çæ°æ®é¡¹ï¼') |
| | | .then(function () { |
| | | return del(ids); |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | } |
| | | } |
| | | |
| | | // 导å
¥ |
| | | const handleImport = () => { |
| | | importDialogVisible.value = true; |
| | | }; |
| | | |
| | | // 确认导å
¥ |
| | | const handleImportConfirm = () => { |
| | | if (importDialogRef.value) { |
| | | importDialogRef.value.submit(); |
| | | } |
| | | }; |
| | | |
| | | // 导å
¥æå |
| | | const handleImportSuccess = (response) => { |
| | | if (response.code === 200) { |
| | | proxy.$modal.msgSuccess("导å
¥æå"); |
| | | importDialogVisible.value = false; |
| | | if (importDialogRef.value) { |
| | | importDialogRef.value.clearFiles(); |
| | | } |
| | | getList(); |
| | | } else { |
| | | proxy.$modal.msgError(response.msg || "导å
¥å¤±è´¥"); |
| | | } |
| | | }; |
| | | |
| | | // 导å
¥å¤±è´¥ |
| | | const handleImportError = (error) => { |
| | | proxy.$modal.msgError("导å
¥å¤±è´¥ï¼" + (error.message || "æªç¥é误")); |
| | | }; |
| | | |
| | | // å
³é导å
¥å¼¹çª |
| | | const handleImportClose = () => { |
| | | if (importDialogRef.value) { |
| | | importDialogRef.value.clearFiles(); |
| | | } |
| | | }; |
| | | |
| | | // ä¸è½½æ¨¡æ¿ |
| | | const handleDownloadTemplate = async () => { |
| | | try { |
| | | const res = await downloadTemplate(); |
| | | const blob = new Blob([res], { |
| | | type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
| | | }); |
| | | const url = window.URL.createObjectURL(blob); |
| | | const link = document.createElement("a"); |
| | | link.href = url; |
| | | link.download = "å·¥åºå¯¼å
¥æ¨¡æ¿.xlsx"; |
| | | link.click(); |
| | | window.URL.revokeObjectURL(url); |
| | | proxy.$modal.msgSuccess("模æ¿ä¸è½½æå"); |
| | | } catch (error) { |
| | | proxy.$modal.msgError("模æ¿ä¸è½½å¤±è´¥"); |
| | | } |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | // const handleOut = () => { |
| | | // ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | // confirmButtonText: "确认", |
| | | // cancelButtonText: "åæ¶", |
| | | // type: "warning", |
| | | // }) |
| | | // .then(() => { |
| | | // proxy.download("/salesLedger/scheduling/exportTwo", {}, "å·¥åºæäº§.xlsx"); |
| | | // }) |
| | | // .catch(() => { |
| | | // proxy.$modal.msg("已忶"); |
| | | // }); |
| | | // }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="æå
¥" |
| | | @close="closeModal" |
| | | > |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="data" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="closeModal">å
³é</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, computed, onMounted} from "vue"; |
| | | import { productionProductInputListPage } from "@/api/productionManagement/productionProductInput"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | productionProductMainId: { |
| | | type: Number, |
| | | required: true, |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0 |
| | | }); |
| | | |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | fetchData(); |
| | | }; |
| | | |
| | | const tableLoading = ref(false); |
| | | |
| | | const tableColumn = [ |
| | | { |
| | | label: 'æ¥å·¥åå·', |
| | | prop: 'productNo', |
| | | }, |
| | | { |
| | | label: 'æå
¥äº§ååç§°', |
| | | prop: 'productName', |
| | | }, |
| | | { |
| | | label: 'æå
¥äº§ååå·', |
| | | prop: 'model', |
| | | }, |
| | | { |
| | | label: 'æå
¥æ°é', |
| | | prop: 'quantity', |
| | | }, |
| | | { |
| | | label: 'åä½', |
| | | prop: 'unit', |
| | | }, |
| | | ] |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | }, |
| | | }); |
| | | |
| | | const data = ref([]) |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | const fetchData = () => { |
| | | tableLoading.value = true; |
| | | const params = { productMainId: props.productionProductMainId, ...page }; |
| | | |
| | | productionProductInputListPage(params).then(res => { |
| | | tableLoading.value = false; |
| | | data.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | isShow, |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | fetchData() |
| | | }) |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog v-model="isShow" |
| | | title="产åº" |
| | | @close="closeModal"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="data" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"></PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="closeModal">å
³é</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, onMounted } from "vue"; |
| | | import { productionProductOutputListPage } from "@/api/productionManagement/productionProductOutput.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | productionProductMainId: { |
| | | type: Number, |
| | | required: true, |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(["update:visible", "completed"]); |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | fetchData(); |
| | | }; |
| | | |
| | | const tableLoading = ref(false); |
| | | |
| | | const tableColumn = [ |
| | | { |
| | | label: "æ¥å·¥åå·", |
| | | prop: "productNo", |
| | | }, |
| | | { |
| | | label: "产ååå·", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "äº§åºæ°é", |
| | | prop: "quantity", |
| | | }, |
| | | ]; |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit("update:visible", val); |
| | | }, |
| | | }); |
| | | |
| | | const data = ref([]); |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | const fetchData = () => { |
| | | tableLoading.value = true; |
| | | const params = { productMainId: props.productionProductMainId, ...page }; |
| | | |
| | | productionProductOutputListPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | data.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | isShow, |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | fetchData(); |
| | | }); |
| | | </script> |
| | |
| | | <el-input v-model="form.schedulingNum" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡ç产æ°éï¼" prop="finishedNum"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¾
ç产æ°éï¼" prop="pendingNum"> |
| | | <el-input v-model="form.pendingNum" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡ç产æ°éï¼" prop="finishedNum"> |
| | | <el-input-number |
| | | v-model="form.finishedNum" |
| | | placeholder="请è¾å
¥" |
| | |
| | | style="width: 100%" |
| | | @change="changeNum" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä»·(å
)ï¼" prop="unitPrice"> |
| | | <el-input v-model="form.unitPrice" placeholder="请è¾å
¥" clearable @input="calculateTotalPrice"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¾
ç产æ°éï¼" prop="pendingNum"> |
| | | <el-input v-model="form.pendingNum" placeholder="请è¾å
¥" clearable disabled/> |
| | | <el-form-item label="æ»ä»·(å
)ï¼" prop="totalPrice"> |
| | | <el-input v-model="form.totalPrice" placeholder="请è¾å
¥" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | v-model="form.schedulingUserId" |
| | | placeholder="éæ©äººå" |
| | | style="width: 100%;" |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | > |
| | | <el-option |
| | | v-for="user in userList" |
| | |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {productionReport, productionReportUpdate} from "@/api/productionManagement/productionReporting.js"; |
| | | const { proxy } = getCurrentInstance() |
| | |
| | | finishedNum: "", |
| | | schedulingUserId: "", |
| | | schedulingDate: "", |
| | | unitPrice: "", |
| | | totalPrice: "", |
| | | }, |
| | | rules: { |
| | | schedulingNum: [{ required: true, message: "请è¾å
¥", trigger: "blur" },], |
| | |
| | | proxy.$modal.msgWarning('æ¬æ¬¡ç产æ°éä¸å¯å¤§äºæäº§æ°é') |
| | | } |
| | | form.value.pendingNum = form.value.schedulingNum - form.value.finishedNum; |
| | | calculateTotalPrice(); |
| | | } |
| | | |
| | | // è®¡ç®æ»ä»· |
| | | const calculateTotalPrice = () => { |
| | | const quantity = Number(form.value.finishedNum ?? 0); |
| | | const unitPrice = Number(form.value.unitPrice ?? 0); |
| | | |
| | | if (quantity > 0 && unitPrice > 0) { |
| | | form.value.totalPrice = (quantity * unitPrice).toFixed(2); |
| | | } else { |
| | | form.value.totalPrice = '0.00'; |
| | | } |
| | | } |
| | | // æäº¤äº§å表å |
| | | const submitForm = () => { |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="客æ·åç§°:"> |
| | | <el-input v-model="searchForm.customerName" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="项ç®åç§°:"> |
| | | <el-input v-model="searchForm.projectName" placeholder="请è¾å
¥" clearable prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æäº§æ¥æ:"> |
| | | <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange" |
| | | placeholder="è¯·éæ©" clearable @change="changeDaterange" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ:"> |
| | | <el-select v-model="searchForm.status" placeholder="è¯·éæ©ç¶æ" style="width: 140px" clearable> |
| | | <el-option label="å¾
ç产" :value="1"></el-option> |
| | | <el-option label="å·²æ¥å·¥" :value="3"></el-option> |
| | | <el-option label="ç产ä¸" :value="2"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" class="mb10"> |
| | | <el-button type="primary" @click="openForm('add')">ç产æ¥å·¥</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :expandRowKeys="expandedRowKeys" |
| | | @expand-change="expandChange" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total" |
| | | > |
| | | <template #expand="{ row }"> |
| | | <el-table |
| | | :data="expandData" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | v-loading="childrenLoading" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡ç产æ°é" prop="finishedNum" align="center" width="400"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | v-model="scope.row.finishedNum" |
| | | :disabled="!scope.row.editType" |
| | | :precision="2" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | @change="changeNum(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="å¾
ç产æ°é" prop="pendingNum" width="240" align="center"></el-table-column>--> |
| | | <el-table-column label="ç产人" prop="schedulingUserId" width="400"> |
| | | <template #default="scope"> |
| | | <el-select |
| | | v-model="scope.row.schedulingUserId" |
| | | placeholder="éæ©äººå" |
| | | :disabled="!scope.row.editType" |
| | | style="width: 100%;" |
| | | > |
| | | <el-option |
| | | v-for="user in userList" |
| | | :key="user.userId" |
| | | :label="user.nickName" |
| | | :value="user.userId" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="çäº§æ¥æ" prop="schedulingDate" width="400"> |
| | | <template #default="scope"> |
| | | <el-date-picker |
| | | v-model="scope.row.schedulingDate" |
| | | type="date" |
| | | :disabled="!scope.row.editType" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="60"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="changeEditType(scope.row)" |
| | | v-if="!scope.row.editType" |
| | | :disabled="scope.row.parentStatus === 3" |
| | | >ç¼è¾</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="saveReceiptPayment(scope.row)" |
| | | v-if="scope.row.editType" |
| | | >ä¿å</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <form-dia ref="formDia" @close="handleQuery"></form-dia> |
| | | </div> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="æ¥å·¥äººååç§°:"> |
| | | <el-input v-model="searchForm.nickName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥åå·:"> |
| | | <el-input v-model="searchForm.workOrderNo" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <!-- <el-button type="primary" |
| | | @click="openForm('add')">ç产æ¥å·¥</el-button> --> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :expandRowKeys="expandedRowKeys" |
| | | @expand-change="expandChange" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total"> |
| | | <template #expand="{ row }"> |
| | | <el-table :data="expandData" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | v-loading="childrenLoading"> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="æ¬æ¬¡ç产æ°é" |
| | | prop="finishedNum" |
| | | align="center" |
| | | width="400"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" |
| | | :min="0" |
| | | style="width: 100%" |
| | | v-model="scope.row.finishedNum" |
| | | :disabled="!scope.row.editType" |
| | | :precision="2" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | @change="changeNum(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="å¾
ç产æ°é" prop="pendingNum" width="240" align="center"></el-table-column>--> |
| | | <el-table-column label="ç产人" |
| | | prop="schedulingUserId" |
| | | width="400"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.schedulingUserId" |
| | | placeholder="éæ©äººå" |
| | | :disabled="!scope.row.editType" |
| | | style="width: 100%;"> |
| | | <el-option v-for="user in userList" |
| | | :key="user.userId" |
| | | :label="user.nickName" |
| | | :value="user.userId" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="çäº§æ¥æ" |
| | | prop="schedulingDate" |
| | | width="400"> |
| | | <template #default="scope"> |
| | | <el-date-picker v-model="scope.row.schedulingDate" |
| | | type="date" |
| | | :disabled="!scope.row.editType" |
| | | placeholder="è¯·éæ©æ¥æ" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" |
| | | > |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | | size="small" |
| | | @click="changeEditType(scope.row)" |
| | | v-if="!scope.row.editType" |
| | | :disabled="scope.row.parentStatus === 3">ç¼è¾</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | size="small" |
| | | @click="saveReceiptPayment(scope.row)" |
| | | v-if="scope.row.editType">ä¿å</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <form-dia ref="formDia" |
| | | @close="handleQuery"></form-dia> |
| | | <input-modal v-if="isShowInput" |
| | | v-model:visible="isShowInput" |
| | | :production-product-main-id="isShowingId" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {onMounted, ref} from "vue"; |
| | | import FormDia from "@/views/productionManagement/productionReporting/components/formDia.vue"; |
| | | import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | | productionReportUpdate, |
| | | workListPage, |
| | | workListPageById |
| | | } from "@/api/productionManagement/productionReporting.js"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import { onMounted, ref } from "vue"; |
| | | import FormDia from "@/views/productionManagement/productionReporting/components/formDia.vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { |
| | | productionReportUpdate, |
| | | workListPageById, |
| | | productionReportDelete, |
| | | } from "@/api/productionManagement/productionReporting.js"; |
| | | import { productionProductMainListPage } from "@/api/productionManagement/productionProductMain.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import InputModal from "@/views/productionManagement/productionReporting/Input.vue"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | staffName: "", |
| | | entryDate: null, // å½å
¥æ¥æ |
| | | entryDateStart: undefined, |
| | | entryDateEnd: undefined, |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const expandedRowKeys = ref([]); |
| | | const expandData = ref([]); |
| | | const userList = ref([]) |
| | | const tableColumn = ref([ |
| | | { |
| | | type: "expand", |
| | | dataType: "slot", |
| | | slot: "expand", |
| | | }, |
| | | { |
| | | label: "ç¶æ", |
| | | prop: "status", |
| | | dataType: "tag", |
| | | formatData: (params) => { |
| | | if (params == 3) { |
| | | return "å·²æ¥å·¥"; |
| | | } else if (params == 1) { |
| | | return "å¾
ç产"; |
| | | } else { |
| | | return 'ç产ä¸'; |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 3) { |
| | | return "success"; |
| | | } else if (params == 1) { |
| | | return "primary"; |
| | | } else { |
| | | return 'warning'; |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: "æäº§æ¥æ", |
| | | prop: "schedulingDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "æäº§äºº", |
| | | prop: "schedulingUserName", |
| | | }, |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "å·¥åº", |
| | | prop: "process", |
| | | }, |
| | | { |
| | | label: "å£å³åç±»", |
| | | prop: "type", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "æè", |
| | | prop: "loss", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "æäº§æ°é", |
| | | prop: "schedulingNum", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "ç产æ°é", |
| | | prop: "finishedNum", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "å¾
ç产æ°é", |
| | | prop: "pendingFinishNum", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "夿³¨", |
| | | prop: "remark", |
| | | width: 200, |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const childrenLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const formDia = ref() |
| | | const { proxy } = getCurrentInstance() |
| | | const data = reactive({ |
| | | searchForm: { |
| | | nickName: "", |
| | | workOrderNo: "", |
| | | workOrderStatus: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const expandedRowKeys = ref([]); |
| | | const expandData = ref([]); |
| | | const userList = ref([]); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "æ¥å·¥åå·", |
| | | prop: "productNo", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "æ¥å·¥äººå", |
| | | prop: "nickName", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å·¥åç¼å·", |
| | | prop: "workOrderNo", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "产åè§æ ¼åå·", |
| | | prop: "productModelName", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "äº§åºæ°é", |
| | | prop: "quantity", |
| | | width: 120, |
| | | }, |
| | | // { |
| | | // label: "æ¥åºæ°é", |
| | | // prop: "scrapQuantity", |
| | | // width: 120, |
| | | // }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | width: 120, |
| | | }, |
| | | |
| | | { |
| | | label: "å建æ¶é´", |
| | | prop: "createTime", |
| | | width: 120, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | operation: [ |
| | | { |
| | | name: "æ¥çæå
¥", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showInput(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | type: "danger", |
| | | clickFun: row => { |
| | | deleteReport(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const childrenLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const formDia = ref(); |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const changeDaterange = (value) => { |
| | | if (value) { |
| | | searchForm.value.entryDateStart = value[0]; |
| | | searchForm.value.entryDateEnd = value[1]; |
| | | } else { |
| | | searchForm.value.entryDateStart = undefined; |
| | | searchForm.value.entryDateEnd = undefined; |
| | | } |
| | | handleQuery(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | params.entryDate = undefined |
| | | expandedRowKeys.value = [] |
| | | workListPage(params).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records.map(item => ({ |
| | | ...item, |
| | | pendingFinishNum: (Number(item.schedulingNum) || 0) - (Number(item.finishedNum) || 0) |
| | | })); |
| | | page.total = res.data.total; |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | }; |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (expandedRows.length > 0) { |
| | | nextTick(() => { |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | childrenLoading.value = true; |
| | | workListPageById({ id: row.id }).then((res) => { |
| | | childrenLoading.value = false; |
| | | const index = tableData.value.findIndex((item) => item.id === row.id); |
| | | if (index > -1) { |
| | | expandData.value = res.data.map(item => ({ |
| | | ...item, |
| | | pendingNum: (Number(item.schedulingNum) || 0) - (Number(item.finishedNum) || 0), |
| | | parentStatus: row.status // æ°å¢ç¶è¡¨ç¶æ |
| | | })); |
| | | } |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | childrenLoading.value = false; |
| | | console.log(error); |
| | | } |
| | | }) |
| | | } else { |
| | | expandedRowKeys.value = []; |
| | | } |
| | | }; |
| | | const changeNum = (row) => { |
| | | // æ¾å°ç¶è¡¨æ ¼æ°æ® |
| | | const parentRow = tableData.value.find(item => item.id === expandedRowKeys.value[0]); |
| | | // è®¡ç®ææåè¡¨æ ¼ finishedNum çæ»å |
| | | const totalFinishedNum = expandData.value.reduce((sum, item) => sum + (Number(item.finishedNum) || 0), 0); |
| | | // ç¶è¡¨æ ¼çæäº§æ°é |
| | | const schedulingNum = parentRow ? Number(parentRow.schedulingNum) : 0; |
| | | |
| | | if (totalFinishedNum > schedulingNum) { |
| | | // åéæ¬æ¬¡è¾å
¥ |
| | | row.finishedNum = schedulingNum - (totalFinishedNum - Number(row.finishedNum)); |
| | | proxy.$modal.msgWarning('æææ¬æ¬¡ç产æ°éä¹åä¸å¯å¤§äºæäº§æ°é'); |
| | | } |
| | | row.pendingNum = row.schedulingNum - row.finishedNum; |
| | | } |
| | | // ç¼è¾ä¿®æ¹ç¶æ |
| | | const changeEditType = (row) => { |
| | | row.editType = !row.editType; |
| | | }; |
| | | // ä¿åè®°å½ |
| | | const saveReceiptPayment = (row) => { |
| | | productionReportUpdate(row).then((res) => { |
| | | row.editType = !row.editType; |
| | | getList(); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, [ |
| | | "finishedNum" |
| | | ]); |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | if (selectedRows.value.length !== 1) { |
| | | proxy.$message.error("è¯·éæ©ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | if (selectedRows.value[0].pendingFinishNum == 0) { |
| | | proxy.$message.warning("æ é忥工"); |
| | | return; |
| | | } |
| | | nextTick(() => { |
| | | const rowInfo = type === 'add' ? selectedRows.value[0] : row |
| | | formDia.value?.openDialog(type, rowInfo) |
| | | }) |
| | | }; |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const changeDaterange = value => { |
| | | if (value) { |
| | | searchForm.value.entryDateStart = value[0]; |
| | | searchForm.value.entryDateEnd = value[1]; |
| | | } else { |
| | | searchForm.value.entryDateStart = undefined; |
| | | searchForm.value.entryDateEnd = undefined; |
| | | } |
| | | handleQuery(); |
| | | }; |
| | | const deleteReport = row => { |
| | | ElMessageBox.confirm("ç¡®å®å é¤è¯¥æ¥å·¥åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | productionReportDelete({ id: row.id }).then(res => { |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | } else { |
| | | ElMessageBox.alert(res.msg || "å é¤å¤±è´¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | }; |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | params.entryDate = undefined; |
| | | expandedRowKeys.value = []; |
| | | productionProductMainListPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records.map(item => ({ |
| | | ...item, |
| | | pendingFinishNum: |
| | | (Number(item.schedulingNum) || 0) - (Number(item.finishedNum) || 0), |
| | | })); |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | userListNoPageByTenantId().then(res => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (expandedRows.length > 0) { |
| | | nextTick(() => { |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | childrenLoading.value = true; |
| | | workListPageById({ id: row.id }).then(res => { |
| | | childrenLoading.value = false; |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | if (index > -1) { |
| | | expandData.value = res.data.map(item => ({ |
| | | ...item, |
| | | pendingNum: |
| | | (Number(item.schedulingNum) || 0) - |
| | | (Number(item.finishedNum) || 0), |
| | | parentStatus: row.status, // æ°å¢ç¶è¡¨ç¶æ |
| | | })); |
| | | } |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | childrenLoading.value = false; |
| | | console.log(error); |
| | | } |
| | | }); |
| | | } else { |
| | | expandedRowKeys.value = []; |
| | | } |
| | | }; |
| | | const changeNum = row => { |
| | | // æ¾å°ç¶è¡¨æ ¼æ°æ® |
| | | const parentRow = tableData.value.find( |
| | | item => item.id === expandedRowKeys.value[0] |
| | | ); |
| | | // è®¡ç®ææåè¡¨æ ¼ finishedNum çæ»å |
| | | const totalFinishedNum = expandData.value.reduce( |
| | | (sum, item) => sum + (Number(item.finishedNum) || 0), |
| | | 0 |
| | | ); |
| | | // ç¶è¡¨æ ¼çæäº§æ°é |
| | | const schedulingNum = parentRow ? Number(parentRow.schedulingNum) : 0; |
| | | |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | staffJoinDel(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/salesLedger/work/export", {}, "ç产æ¥å·¥.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | if (totalFinishedNum > schedulingNum) { |
| | | // åéæ¬æ¬¡è¾å
¥ |
| | | row.finishedNum = |
| | | schedulingNum - (totalFinishedNum - Number(row.finishedNum)); |
| | | proxy.$modal.msgWarning("æææ¬æ¬¡ç产æ°éä¹åä¸å¯å¤§äºæäº§æ°é"); |
| | | } |
| | | row.pendingNum = row.schedulingNum - row.finishedNum; |
| | | }; |
| | | // ç¼è¾ä¿®æ¹ç¶æ |
| | | const changeEditType = row => { |
| | | row.editType = !row.editType; |
| | | }; |
| | | // ä¿åè®°å½ |
| | | const saveReceiptPayment = row => { |
| | | productionReportUpdate(row).then(res => { |
| | | row.editType = !row.editType; |
| | | getList(); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | const summarizeMainTable = param => { |
| | | return proxy.summarizeTable(param, ["finishedNum"]); |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | if (selectedRows.value.length !== 1) { |
| | | proxy.$message.error("è¯·éæ©ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | if (selectedRows.value[0].pendingFinishNum == 0) { |
| | | proxy.$message.warning("æ é忥工"); |
| | | return; |
| | | } |
| | | nextTick(() => { |
| | | const rowInfo = type === "add" ? selectedRows.value[0] : row; |
| | | formDia.value?.openDialog(type, rowInfo); |
| | | }); |
| | | }; |
| | | |
| | | // æå¼æå
¥æ¨¡ææ¡ |
| | | const isShowInput = ref(false); |
| | | const isShowingId = ref(0); |
| | | const showInput = row => { |
| | | isShowInput.value = true; |
| | | isShowingId.value = row.id; |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/productionProductMain/export", {}, "ç产æ¥å·¥.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div class="search-row"> |
| | | <div class="search-item"> |
| | | <span class="search_title">å·¥åç¼å·ï¼</span> |
| | | <el-input v-model="searchForm.workOrderNo" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" /> |
| | | </div> |
| | | <div class="search-item"> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress :percentage="toProgressPercentage(row?.completionStatus)" :color="progressColor(toProgressPercentage(row?.completionStatus))" :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" /> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <el-dialog v-model="editDialogVisible" |
| | | title="ç¼è¾æ¶é´" |
| | | width="500px"> |
| | | <el-form :model="editrow" |
| | | label-width="120px"> |
| | | <el-form-item label="计åå¼å§æ¶é´"> |
| | | <el-date-picker v-model="editrow.planStartTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item label="计åç»ææ¶é´"> |
| | | <el-date-picker v-model="editrow.planEndTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item label="å®é
å¼å§æ¶é´"> |
| | | <el-date-picker v-model="editrow.actualStartTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item label="å®é
ç»ææ¶é´"> |
| | | <el-date-picker v-model="editrow.actualEndTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleUpdate">ç¡®å®</el-button> |
| | | <el-button @click="editDialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="transferCardVisible" |
| | | title="æµè½¬å¡" |
| | | width="1000px"> |
| | | <div class="transfer-card-title">å·¥åæµè½¬å¡</div> |
| | | <div class="transfer-card-container"> |
| | | <div class="transfer-card-info"> |
| | | <div class="info-group"> |
| | | <div class="info-item"> |
| | | <span class="info-label">å·¥åç¼å·</span> |
| | | <span class="info-value">{{ transferCardRowData.workOrderNo }}</span> |
| | | </div> |
| | | <!-- <div class="info-item"> |
| | | <span class="info-label">产åç¼å·</span> |
| | | <span class="info-value">{{ transferCardRowData.productNo }}</span> |
| | | </div> --> |
| | | <div class="info-item"> |
| | | <span class="info-label">产ååç§°</span> |
| | | <span class="info-value">{{ transferCardRowData.productName }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">产åè§æ ¼</span> |
| | | <span class="info-value">{{ transferCardRowData.model }}</span> |
| | | </div> |
| | | <!-- <div class="info-item"> |
| | | <span class="info-label">å·¥åç¶æ</span> |
| | | <span class="info-value">{{ |
| | | transferCardRowData.status === 1 ? 'å¾
确认' : |
| | | transferCardRowData.status === 2 ? 'å¾
ç产' : |
| | | transferCardRowData.status === 3 ? 'ç产ä¸' : |
| | | transferCardRowData.status === 4 ? 'å·²ç产' : |
| | | transferCardRowData.status |
| | | }}</span> |
| | | </div> --> |
| | | |
| | | <div class="info-item"> |
| | | <span class="info-label">计åå¼å§æ¶é´</span> |
| | | <span class="info-value">{{ transferCardRowData.planStartTime }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">计åç»ææ¶é´</span> |
| | | <span class="info-value">{{ transferCardRowData.planEndTime }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">夿³¨</span> |
| | | <span class="info-value">{{ transferCardRowData.remark }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-group"> |
| | | <div class="info-item"> |
| | | <span class="info-label">éæ±æ°é</span> |
| | | <span class="info-value">{{ transferCardRowData.planQuantity }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">宿æ°é</span> |
| | | <span class="info-value">{{ transferCardRowData.completeQuantity }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">è¯åæ°é</span> |
| | | <span class="info-value">0</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">ä¸è¯åæ°</span> |
| | | <span class="info-value">0</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">å®é
å¼å§æ¶é´</span> |
| | | <span class="info-value">{{ transferCardRowData.actualStartTime }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">å®é
ç»ææ¶é´</span> |
| | | <span class="info-value">{{ transferCardRowData.actualEndTime }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="transfer-card-qr"> |
| | | <div class="qr-container"> |
| | | <img :src="transferCardQrUrl" |
| | | alt="æµè½¬å¡äºç»´ç " |
| | | style="width: 200px; height: 200px;" /> |
| | | <!-- <div class="qr-tip" |
| | | style="margin-top: 10px; text-align: center;">æµè½¬å¡äºç»´ç </div> --> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="print-button-container" |
| | | style=" text-align: center; |
| | | margin-bottom: 40px;"> |
| | | <el-button type="primary" |
| | | style="margin-top: 20px;" |
| | | @click="printTransferCard">æå°æµè½¬å¡</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog v-model="reportDialogVisible" |
| | | title="æ¥å·¥" |
| | | width="500px"> |
| | | <el-form :model="reportForm" |
| | | label-width="120px"> |
| | | <el-form-item label="å¾
ç产æ°é"> |
| | | <el-input v-model="reportForm.planQuantity" |
| | | readonly |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ¬æ¬¡ç产æ°é"> |
| | | <el-input v-model.number="reportForm.quantity" |
| | | type="number" |
| | | min="1" |
| | | style="width: 300px" |
| | | placeholder="请è¾å
¥æ¬æ¬¡ç产æ°é" /> |
| | | </el-form-item> |
| | | <el-form-item label="çç»ä¿¡æ¯"> |
| | | <el-select v-model="reportForm.userId" |
| | | style="width: 300px" |
| | | placeholder="è¯·éæ©çç»ä¿¡æ¯" |
| | | clearable |
| | | filterable |
| | | @change="handleUserChange"> |
| | | <el-option v-for="user in userOptions" |
| | | :key="user.userId" |
| | | :label="user.userName" |
| | | :value="user.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleReport">ç¡®å®</el-button> |
| | | <el-button @click="reportDialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | | productWorkOrderPage, |
| | | updateProductWorkOrder, |
| | | addProductMain, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import QRCode from "qrcode"; |
| | | import { getCurrentInstance, reactive, toRefs } from "vue"; |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "å·¥åç¼å·", |
| | | prop: "workOrderNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "ç产订åå·", |
| | | prop: "productOrderNpsNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "è§æ ¼", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "å·¥åºåç§°", |
| | | prop: "processName", |
| | | }, |
| | | { |
| | | label: "éæ±æ°é", |
| | | prop: "planQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "宿æ°é", |
| | | prop: "completeQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "宿è¿åº¦", |
| | | prop: "completionStatus", |
| | | dataType: "slot", |
| | | slot: "completionStatus", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计åå¼å§æ¶é´", |
| | | prop: "planStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计åç»ææ¶é´", |
| | | prop: "planEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "å®é
å¼å§æ¶é´", |
| | | prop: "actualStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "å®é
ç»ææ¶é´", |
| | | prop: "actualEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "æä½", |
| | | width: "200", |
| | | align: "center", |
| | | dataType: "action", |
| | | fixed: "right", |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | clickFun: row => { |
| | | handleEdit(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "æµè½¬å¡", |
| | | clickFun: row => { |
| | | showTransferCard(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "æ¥å·¥", |
| | | clickFun: row => { |
| | | showReportDialog(row); |
| | | }, |
| | | disabled: row => row.planQuantity <= 0, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const qrCodeUrl = ref(""); |
| | | const qrRowData = ref(null); |
| | | const editDialogVisible = ref(false); |
| | | const transferCardVisible = ref(false); |
| | | const transferCardData = ref([]); |
| | | const transferCardQrUrl = ref(""); |
| | | const transferCardRowData = ref(null); |
| | | const reportDialogVisible = ref(false); |
| | | const userOptions = ref([]); |
| | | const reportForm = reactive({ |
| | | planQuantity: 0, |
| | | quantity: 0, |
| | | userName: "", |
| | | workOrderId: "", |
| | | reportWork: "", |
| | | productProcessRouteItemId: "", |
| | | userId: "", |
| | | productMainId: null, |
| | | }); |
| | | const currentReportRowData = ref(null); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | workOrderNo: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const toProgressPercentage = val => { |
| | | const n = Number(val); |
| | | if (!Number.isFinite(n)) return 0; |
| | | if (n <= 0) return 0; |
| | | if (n >= 100) return 100; |
| | | return Math.round(n); |
| | | }; |
| | | const progressColor = percentage => { |
| | | const p = toProgressPercentage(percentage); |
| | | if (p < 30) return "#f56c6c"; |
| | | if (p < 50) return "#e6a23c"; |
| | | if (p < 80) return "#409eff"; |
| | | return "#67c23a"; |
| | | }; |
| | | let editrow = ref(null); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | productWorkOrderPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const showTransferCard = async row => { |
| | | transferCardRowData.value = row; |
| | | const qrContent = String(row.id); |
| | | |
| | | transferCardQrUrl.value = await QRCode.toDataURL(qrContent); |
| | | transferCardVisible.value = true; |
| | | }; |
| | | |
| | | const printTransferCard = () => { |
| | | window.print(); |
| | | }; |
| | | |
| | | const handleEdit = row => { |
| | | editrow.value = JSON.parse(JSON.stringify(row)); |
| | | editDialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleUpdate = () => { |
| | | updateProductWorkOrder(editrow.value) |
| | | .then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | editDialogVisible.value = false; |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessageBox.alert("ä¿®æ¹å¤±è´¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const showReportDialog = row => { |
| | | currentReportRowData.value = row; |
| | | reportForm.planQuantity = row.planQuantity; |
| | | reportForm.quantity = row.quantity; |
| | | reportForm.productProcessRouteItemId = row.productProcessRouteItemId; |
| | | reportForm.workOrderId = row.id; |
| | | reportForm.reportWork = row.reportWork; |
| | | reportForm.productMainId = row.productMainId; |
| | | // è·åå½åç»å½ç¨æ·ä¿¡æ¯ï¼è®¾ç½®ä¸ºé»è®¤éä¸ |
| | | getUserProfile() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | reportForm.userId = res.data.userId; |
| | | reportForm.userName = res.data.userName; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error("è·åç¨æ·ä¿¡æ¯å¤±è´¥", err); |
| | | }); |
| | | |
| | | reportDialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleReport = () => { |
| | | if (reportForm.planQuantity <= 0) { |
| | | ElMessageBox.alert("å¾
ç产æ°é为0ï¼æ æ³æ¥å·¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | if (!reportForm.quantity || reportForm.quantity <= 0) { |
| | | ElMessageBox.alert("请è¾å
¥ææçæ¬æ¬¡ç产æ°é", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | if (reportForm.quantity > reportForm.planQuantity) { |
| | | ElMessageBox.alert("æ¬æ¬¡ç产æ°éä¸è½è¶
è¿å¾
ç产æ°é", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | // console.log(reportForm); |
| | | addProductMain(reportForm).then(res => { |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("æ¥å·¥æå"); |
| | | reportDialogVisible.value = false; |
| | | getList(); |
| | | } else { |
| | | ElMessageBox.alert(res.msg || "æ¥å·¥å¤±è´¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // è·åç¨æ·å表 |
| | | const getUserList = () => { |
| | | userListNoPageByTenantId() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | userOptions.value = res.data || []; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error("è·åç¨æ·å表失败", err); |
| | | }); |
| | | }; |
| | | |
| | | // ç¨æ·éæ©ååæ¶æ´æ° userName |
| | | const handleUserChange = (userId) => { |
| | | if (userId) { |
| | | const selectedUser = userOptions.value.find(user => user.userId === userId); |
| | | if (selectedUser) { |
| | | reportForm.userName = selectedUser.userName; |
| | | } |
| | | } else { |
| | | reportForm.userName = ""; |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getUserList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .search_form { |
| | | margin-bottom: 20px; |
| | | .search-row { |
| | | display: flex; |
| | | gap: 20px; |
| | | align-items: center; |
| | | .search-item { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 10px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .transfer-card-title { |
| | | font-size: 24px; |
| | | font-weight: bold; |
| | | text-align: center; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .transfer-card-container { |
| | | display: flex; |
| | | gap: 20px; |
| | | height: 350px; |
| | | .transfer-card-info { |
| | | flex: 1; |
| | | overflow: auto; |
| | | .info-group { |
| | | width: 50%; |
| | | float: left; |
| | | } |
| | | .info-item { |
| | | display: flex; |
| | | margin-bottom: 15px; |
| | | .info-label { |
| | | width: 120px; |
| | | font-weight: bold; |
| | | margin-right: 20px; |
| | | } |
| | | .info-value { |
| | | flex: 1; |
| | | } |
| | | } |
| | | } |
| | | .transfer-card-qr { |
| | | width: 240px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | } |
| | | </style> |
| | | |
| | | <style lang="scss"> |
| | | @media print { |
| | | @page { |
| | | size: landscape; |
| | | } |
| | | body * { |
| | | visibility: hidden; |
| | | } |
| | | .el-dialog__wrapper, |
| | | .el-dialog, |
| | | .el-dialog__body, |
| | | .transfer-card-title, |
| | | .transfer-card-container, |
| | | .transfer-card-container *, |
| | | .info-item, |
| | | .info-label, |
| | | .info-value { |
| | | visibility: visible; |
| | | } |
| | | .print-button-container { |
| | | visibility: hidden; |
| | | } |
| | | .el-dialog__wrapper { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | margin: 0; |
| | | } |
| | | .el-dialog { |
| | | width: 100% !important; |
| | | max-width: 800px; |
| | | margin: 0 auto !important; |
| | | } |
| | | .el-dialog__header, |
| | | .el-dialog__footer { |
| | | display: none; |
| | | } |
| | | .el-dialog__body { |
| | | padding: 20px; |
| | | } |
| | | .transfer-card-container { |
| | | height: auto; |
| | | display: flex; |
| | | gap: 20px; |
| | | } |
| | | .transfer-card-info { |
| | | flex: 1; |
| | | .info-group { |
| | | width: 100%; |
| | | float: none; |
| | | margin-bottom: 20px; |
| | | } |
| | | .info-item { |
| | | display: flex; |
| | | margin-bottom: 10px; |
| | | .info-label { |
| | | width: 100px; |
| | | font-weight: bold; |
| | | margin-right: 15px; |
| | | white-space: nowrap; |
| | | } |
| | | .info-value { |
| | | flex: 1; |
| | | word-break: break-word; |
| | | } |
| | | } |
| | | } |
| | | .transfer-card-qr { |
| | | width: 160px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | .qr-container img { |
| | | width: 140px !important; |
| | | height: 140px !important; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import { |
| | | qualityInspectParamDel, |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªåï¼" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="è¯·éæ©" clearable filterable> |
| | | <el-select v-model="form.checkName" placeholder="è¯·éæ©" clearable> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" |
| | | :value="item.nickName"/> |
| | | </el-select> |
| | |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import { |
| | | qualityInspectParamDel, |
| | |
| | | @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-form-item label="æ£éªåï¼" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="è¯·éæ©" clearable filterable> |
| | | <el-select v-model="form.checkName" placeholder="è¯·éæ©" clearable> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" |
| | | :value="item.nickName"/> |
| | | </el-select> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container metric-binding"> |
| | | <!-- å·¦ä¾§ï¼æ£æµæ åå表ï¼åªè¯»ï¼ --> |
| | | <div class="left-panel"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="standardColumns" |
| | | :tableData="standardTableData" |
| | | :page="page" |
| | | :isSelection="false" |
| | | :rowClassName="rowClassNameCenter" |
| | | :tableLoading="tableLoading" |
| | | :rowClick="handleTableRowClick" |
| | | @pagination="handlePagination" |
| | | :total="page.total" |
| | | > |
| | | <template #standardNoCell="{ row }"> |
| | | <span class="clickable-link" @click="handleStandardRowClick(row)"> |
| | | {{ row.standardNo }} |
| | | </span> |
| | | </template> |
| | | |
| | | <!-- 表头æç´¢ --> |
| | | <template #standardNoHeader> |
| | | <el-input |
| | | v-model="searchForm.standardNo" |
| | | placeholder="æ åç¼å·" |
| | | clearable |
| | | size="small" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | /> |
| | | </template> |
| | | <template #standardNameHeader> |
| | | <el-input |
| | | v-model="searchForm.standardName" |
| | | placeholder="æ ååç§°" |
| | | clearable |
| | | size="small" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | /> |
| | | </template> |
| | | <template #inspectTypeHeader> |
| | | <el-select |
| | | v-model="searchForm.inspectType" |
| | | placeholder="ç±»å«" |
| | | clearable |
| | | size="small" |
| | | style="width: 120px" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | > |
| | | <el-option label="åæææ£éª" value="0" /> |
| | | <el-option label="è¿ç¨æ£éª" value="1" /> |
| | | <el-option label="åºåæ£éª" value="2" /> |
| | | </el-select> |
| | | </template> |
| | | <template #stateHeader> |
| | | <el-select |
| | | v-model="searchForm.state" |
| | | placeholder="ç¶æ" |
| | | clearable |
| | | size="small" |
| | | style="width: 110px" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | > |
| | | <el-option label="è稿" value="0" /> |
| | | <el-option label="éè¿" value="1" /> |
| | | <el-option label="æ¤é" value="2" /> |
| | | </el-select> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | |
| | | <!-- å³ä¾§ï¼ç»å®å表 --> |
| | | <div class="right-panel"> |
| | | <div class="right-header"> |
| | | <div class="title">ç»å®å
³ç³»</div> |
| | | <div class="desc" v-if="currentStandard"> |
| | | å½åæ£æµæ åç¼å·ï¼<span class="link-text">{{ currentStandard.standardNo }}</span> |
| | | </div> |
| | | <div class="desc" v-else>è¯·éæ©å·¦ä¾§æ£æµæ å</div> |
| | | </div> |
| | | |
| | | <div class="right-toolbar"> |
| | | <el-button type="primary" :disabled="!currentStandard" @click="openBindingDialog">æ·»å ç»å®</el-button> |
| | | <el-button type="danger" plain :disabled="!currentStandard" @click="handleBatchUnbind">å é¤</el-button> |
| | | </div> |
| | | |
| | | <el-table |
| | | v-loading="bindingLoading" |
| | | :data="bindingTableData" |
| | | border |
| | | :row-class-name="() => 'row-center'" |
| | | class="center-table" |
| | | style="width: 100%" |
| | | height="calc(100vh - 220px)" |
| | | @selection-change="handleBindingSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="48" align="center" /> |
| | | <el-table-column type="index" label="åºå·" width="60" align="center" /> |
| | | <el-table-column prop="productName" label="产ååç§°" min-width="140" /> |
| | | <el-table-column label="æä½" width="120" fixed="right" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-button link type="danger" size="small" @click="handleUnbind(row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- æ·»å ç»å®å¼¹æ¡ --> |
| | | <el-dialog |
| | | v-model="bindingDialogVisible" |
| | | title="æ·»å ç»å®" |
| | | width="520px" |
| | | @close="closeBindingDialog" |
| | | > |
| | | <el-form label-width="100px"> |
| | | <el-form-item label="产å"> |
| | | <el-tree-select |
| | | v-model="selectedProductIds" |
| | | multiple |
| | | collapse-tags |
| | | collapse-tags-tooltip |
| | | placeholder="è¯·éæ©äº§åï¼å¯å¤éï¼" |
| | | clearable |
| | | check-strictly |
| | | :data="productOptions" |
| | | :render-after-expand="false" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="closeBindingDialog">åæ¶</el-button> |
| | | <el-button type="primary" @click="submitBinding">ç¡®å®</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue' |
| | | import { ElMessageBox } from 'element-plus' |
| | | import PIMTable from '@/components/PIMTable/PIMTable.vue' |
| | | import { productTreeList } from '@/api/basicData/product.js' |
| | | import { |
| | | qualityTestStandardListPage |
| | | } from '@/api/qualityManagement/metricMaintenance.js' |
| | | import { productProcessListPage } from '@/api/basicData/productProcess.js' |
| | | import { |
| | | qualityTestStandardBindingList, |
| | | qualityTestStandardBindingAdd, |
| | | qualityTestStandardBindingDel |
| | | } from '@/api/qualityManagement/qualityTestStandardBinding.js' |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | // 左侧æ ååè¡¨ï¼æ´è¡å
容å±
ä¸ï¼é
åæ ·å¼ï¼ |
| | | const rowClassNameCenter = () => 'row-center' |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | standardNo: '', |
| | | standardName: '', |
| | | state: '', |
| | | inspectType: '' |
| | | } |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | // 左侧 |
| | | const standardTableData = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ current: 1, size: 10, total: 0 }) |
| | | |
| | | // å·¥åºä¸æï¼ç¨äºåè¡¨åæ¾ï¼ |
| | | const processOptions = ref([]) |
| | | |
| | | const getProcessList = async () => { |
| | | try { |
| | | const res = await productProcessListPage({ current: 1, size: 1000 }) |
| | | if (res?.code === 200) { |
| | | const records = res?.data?.records || [] |
| | | processOptions.value = records.map((item) => ({ |
| | | label: item.processName || item.name || item.label, |
| | | value: item.id || item.processId || item.value |
| | | })) |
| | | } |
| | | } catch (error) { |
| | | console.error('è·åå·¥åºå表失败:', error) |
| | | } |
| | | } |
| | | |
| | | const standardColumns = ref([ |
| | | { label: 'æ åç¼å·', prop: 'standardNo', dataType: 'slot', slot: 'standardNoCell', minWidth: 160, align: 'center', headerSlot: 'standardNoHeader' }, |
| | | { label: 'æ ååç§°', prop: 'standardName', minWidth: 180, align: 'center', headerSlot: 'standardNameHeader' }, |
| | | { |
| | | label: 'ç±»å«', |
| | | prop: 'inspectType', |
| | | headerSlot: 'inspectTypeHeader', |
| | | align: 'center', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const map = { 0: 'åæææ£éª', 1: 'è¿ç¨æ£éª', 2: 'åºåæ£éª' } |
| | | return map[val] || val |
| | | } |
| | | }, |
| | | { |
| | | label: 'å·¥åº', |
| | | prop: 'processId', |
| | | align: 'center', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const target = processOptions.value.find( |
| | | (item) => String(item.value) === String(val) |
| | | ) |
| | | return target?.label || val |
| | | } |
| | | }, |
| | | { |
| | | label: '夿³¨', |
| | | prop: 'remark', |
| | | minWidth: 160, |
| | | align: 'center' |
| | | } |
| | | // { |
| | | // label: 'ç¶æ', |
| | | // prop: 'state', |
| | | // headerSlot: 'stateHeader', |
| | | // dataType: 'tag', |
| | | // formatData: (val) => { |
| | | // const map = { 0: 'è稿', 1: 'éè¿', 2: 'æ¤é' } |
| | | // return map[val] || val |
| | | // }, |
| | | // formatType: (val) => { |
| | | // if (val == 1) return 'success' |
| | | // if (val == 2) return 'warning' |
| | | // return 'info' |
| | | // } |
| | | // } |
| | | ]) |
| | | |
| | | const currentStandard = ref(null) |
| | | |
| | | // å³ä¾§ç»å® |
| | | const bindingTableData = ref([]) |
| | | const bindingLoading = ref(false) |
| | | const bindingSelectedRows = ref([]) |
| | | const bindingDialogVisible = ref(false) |
| | | |
| | | // äº§åæ ï¼ç¨äºç»å®éæ©ï¼ |
| | | const productOptions = ref([]) |
| | | const selectedProductIds = ref([]) |
| | | |
| | | const getProductOptions = async () => { |
| | | // é¿å
éå¤è¯·æ± |
| | | if (productOptions.value?.length) return |
| | | const res = await productTreeList() |
| | | productOptions.value = convertIdToValue(Array.isArray(res) ? res : []) |
| | | } |
| | | |
| | | function convertIdToValue(data) { |
| | | return (data || []).map((item) => { |
| | | const { id, children, ...rest } = item |
| | | const newItem = { |
| | | ...rest, |
| | | value: id |
| | | } |
| | | if (children && children.length > 0) { |
| | | newItem.children = convertIdToValue(children) |
| | | } |
| | | return newItem |
| | | }) |
| | | } |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getStandardList() |
| | | } |
| | | |
| | | const handlePagination = (obj) => { |
| | | page.current = obj.page |
| | | page.size = obj.limit |
| | | getStandardList() |
| | | } |
| | | |
| | | const getStandardList = () => { |
| | | tableLoading.value = true |
| | | qualityTestStandardListPage({ |
| | | ...searchForm.value, |
| | | current: page.current, |
| | | size: page.size, |
| | | state: 1 |
| | | }) |
| | | .then((res) => { |
| | | const records = res?.data?.records || [] |
| | | standardTableData.value = records |
| | | page.total = res?.data?.total || records.length |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | // è¡¨æ ¼è¡ç¹å»ï¼å è½½å³ä¾§ç»å®å表 |
| | | const handleTableRowClick = (row) => { |
| | | currentStandard.value = row |
| | | loadBindingList() |
| | | } |
| | | |
| | | // 左侧è¡ç¹å»ï¼å è½½å³ä¾§ç»å®å表ï¼ä¿çç¨äºæ åç¼å·åçç¹å»ï¼ |
| | | const handleStandardRowClick = (row) => { |
| | | currentStandard.value = row |
| | | loadBindingList() |
| | | } |
| | | |
| | | const loadBindingList = () => { |
| | | if (!currentStandard.value?.id) { |
| | | bindingTableData.value = [] |
| | | return |
| | | } |
| | | bindingLoading.value = true |
| | | qualityTestStandardBindingList({ testStandardId: currentStandard.value.id }) |
| | | .then((res) => { |
| | | const base = res?.data || [] |
| | | // å°å½åæ åçå·¥åºå夿³¨å¸¦å°ç»å®å表ä¸å±ç¤º |
| | | bindingTableData.value = base.map((item) => ({ |
| | | ...item, |
| | | processId: currentStandard.value?.processId, |
| | | remark: currentStandard.value?.remark |
| | | })) |
| | | }) |
| | | .finally(() => { |
| | | bindingLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const handleBindingSelectionChange = (selection) => { |
| | | bindingSelectedRows.value = selection |
| | | } |
| | | |
| | | const openBindingDialog = () => { |
| | | if (!currentStandard.value?.id) return |
| | | selectedProductIds.value = [] |
| | | getProductOptions() |
| | | bindingDialogVisible.value = true |
| | | } |
| | | |
| | | const closeBindingDialog = () => { |
| | | bindingDialogVisible.value = false |
| | | } |
| | | |
| | | const submitBinding = async () => { |
| | | const testStandardId = currentStandard.value?.id |
| | | if (!testStandardId) return |
| | | const ids = (selectedProductIds.value || []).filter(Boolean) |
| | | if (!ids.length) { |
| | | proxy.$message.warning('è¯·éæ©äº§å') |
| | | return |
| | | } |
| | | const payload = ids.map((pid) => ({ |
| | | productId: pid, |
| | | testStandardId |
| | | })) |
| | | await qualityTestStandardBindingAdd(payload) |
| | | proxy.$message.success('æ·»å æå') |
| | | bindingDialogVisible.value = false |
| | | loadBindingList() |
| | | } |
| | | |
| | | const handleUnbind = async (row) => { |
| | | if (!row?.id) return |
| | | try { |
| | | await ElMessageBox.confirm('确认å é¤è¯¥ç»å®ï¼', 'æç¤º', { type: 'warning' }) |
| | | } catch { |
| | | return |
| | | } |
| | | await qualityTestStandardBindingDel([row.qualityTestStandardBindingId]) |
| | | proxy.$message.success('å 餿å') |
| | | loadBindingList() |
| | | } |
| | | |
| | | const handleBatchUnbind = async () => { |
| | | if (!bindingSelectedRows.value.length) { |
| | | proxy.$message.warning('è¯·éæ©æ°æ®') |
| | | return |
| | | } |
| | | const ids = bindingSelectedRows.value.map((i) => i.qualityTestStandardBindingId) |
| | | try { |
| | | await ElMessageBox.confirm('éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', 'å é¤æç¤º', { type: 'warning' }) |
| | | } catch { |
| | | return |
| | | } |
| | | await qualityTestStandardBindingDel(ids) |
| | | proxy.$message.success('å 餿å') |
| | | loadBindingList() |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getStandardList() |
| | | getProcessList() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .metric-binding { |
| | | display: flex; |
| | | gap: 16px; |
| | | } |
| | | |
| | | .left-panel, |
| | | .right-panel { |
| | | flex: 1; |
| | | background: #ffffff; |
| | | padding: 16px; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .toolbar { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .toolbar-right { |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .right-header { |
| | | display: flex; |
| | | align-items: baseline; |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .right-header .title { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .right-header .desc { |
| | | font-size: 13px; |
| | | color: #666; |
| | | } |
| | | |
| | | .right-toolbar { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 10px; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .link-text { |
| | | color: #409eff; |
| | | cursor: default; |
| | | } |
| | | |
| | | .clickable-link { |
| | | color: #409eff; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .clickable-link:hover { |
| | | text-decoration: underline; |
| | | } |
| | | |
| | | :deep(.row-center td) { |
| | | text-align: center !important; |
| | | } |
| | | |
| | | /* el-table 表头/å
容ç»ä¸å±
ä¸ï¼row-class-name ä¸ä½ç¨äºè¡¨å¤´ï¼ */ |
| | | :deep(.center-table .el-table__header-wrapper th .cell) { |
| | | text-align: center !important; |
| | | } |
| | | :deep(.center-table .el-table__body-wrapper td .cell) { |
| | | text-align: center !important; |
| | | } |
| | | |
| | | /* PIMTable 表头å±
ä¸ */ |
| | | :deep(.lims-table .pim-table-header-cell) { |
| | | text-align: center; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | :deep(.lims-table .pim-table-header-title) { |
| | | text-align: center; |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(.lims-table .pim-table-header-extra) { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <FormDialog |
| | | v-model="dialogVisible" |
| | | :title="computedTitle" |
| | | :operation-type="operationType" |
| | | width="520px" |
| | | @close="emit('close')" |
| | | @cancel="handleCancel" |
| | | @confirm="handleConfirm" |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px" |
| | | > |
| | | <el-form-item label="忰项" prop="parameterItem"> |
| | | <el-input v-model="form.parameterItem" placeholder="请è¾å
¥åæ°é¡¹" /> |
| | | </el-form-item> |
| | | <el-form-item label="åä½" prop="unit"> |
| | | <el-input v-model="form.unit" placeholder="请è¾å
¥åä½" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ åå¼" prop="standardValue"> |
| | | <el-input v-model="form.standardValue" placeholder="请è¾å
¥æ åå¼" /> |
| | | </el-form-item> |
| | | <el-form-item label="å
æ§å¼" prop="controlValue"> |
| | | <el-input v-model="form.controlValue" placeholder="请è¾å
¥å
æ§å¼" /> |
| | | </el-form-item> |
| | | <el-form-item label="é»è®¤å¼" prop="defaultValue"> |
| | | <el-input v-model="form.defaultValue" placeholder="请è¾å
¥é»è®¤å¼" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </FormDialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref } from 'vue' |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue' |
| | | |
| | | const props = defineProps({ |
| | | modelValue: { type: Boolean, default: false }, |
| | | operationType: { type: String, default: 'add' }, // add | edit |
| | | form: { type: Object, required: true } |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:modelValue', 'close', 'cancel', 'confirm']) |
| | | |
| | | const dialogVisible = computed({ |
| | | get: () => props.modelValue, |
| | | set: (val) => emit('update:modelValue', val) |
| | | }) |
| | | |
| | | const formRef = ref(null) |
| | | |
| | | const rules = { |
| | | parameterItem: [{ required: true, message: '请è¾å
¥åæ°é¡¹', trigger: 'blur' }], |
| | | unit: [{ required: true, message: '请è¾å
¥åä½', trigger: 'blur' }] |
| | | } |
| | | |
| | | const computedTitle = computed(() => (props.operationType === 'edit' ? 'ç¼è¾æ ååæ°' : 'æ°å¢æ ååæ°')) |
| | | |
| | | const handleConfirm = () => { |
| | | formRef.value?.validate?.((valid) => { |
| | | if (valid) emit('confirm') |
| | | }) |
| | | } |
| | | |
| | | const handleCancel = () => { |
| | | emit('cancel') |
| | | dialogVisible.value = false |
| | | } |
| | | |
| | | const resetFields = () => { |
| | | formRef.value?.resetFields?.() |
| | | } |
| | | |
| | | defineExpose({ resetFields }) |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <FormDialog |
| | | v-model="dialogVisible" |
| | | :title="computedTitle" |
| | | :operation-type="operationType" |
| | | :width="width" |
| | | @close="emit('close')" |
| | | @cancel="handleCancel" |
| | | @confirm="handleConfirm" |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px" |
| | | > |
| | | <el-form-item label="æ åç¼å·" prop="standardNo"> |
| | | <el-input v-model="form.standardNo" placeholder="请è¾å
¥æ åç¼å·" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ ååç§°" prop="standardName"> |
| | | <el-input v-model="form.standardName" placeholder="请è¾å
¥æ ååç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç±»å«" prop="inspectType"> |
| | | <el-select v-model="form.inspectType" placeholder="è¯·éæ©ç±»å«" style="width: 100%"> |
| | | <el-option label="åæææ£éª" value="0" /> |
| | | <el-option label="è¿ç¨æ£éª" value="1" /> |
| | | <el-option label="åºåæ£éª" value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥åº" prop="processId"> |
| | | <el-select v-model="form.processId" placeholder="è¯·éæ©å·¥åº" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in processOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="state"> |
| | | <el-select v-model="form.state" placeholder="è¯·éæ©ç¶æ" style="width: 100%"> |
| | | <el-option label="è稿" value="0" /> |
| | | <el-option label="éè¿" value="1" /> |
| | | <el-option label="æ¤é" value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input |
| | | v-model="form.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </FormDialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref } from 'vue' |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue' |
| | | |
| | | const props = defineProps({ |
| | | modelValue: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | operationType: { |
| | | type: String, |
| | | default: 'add' |
| | | }, |
| | | form: { |
| | | type: Object, |
| | | required: true |
| | | }, |
| | | rules: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | }, |
| | | processOptions: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | width: { |
| | | type: String, |
| | | default: '500px' |
| | | } |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:modelValue', 'close', 'cancel', 'confirm']) |
| | | |
| | | const dialogVisible = computed({ |
| | | get: () => props.modelValue, |
| | | set: (val) => emit('update:modelValue', val) |
| | | }) |
| | | |
| | | const formRef = ref(null) |
| | | |
| | | const computedTitle = computed(() => { |
| | | if (props.operationType === 'edit') return 'ç¼è¾æ£æµæ å' |
| | | if (props.operationType === 'copy') return 'å¤å¶æ£æµæ å' |
| | | return 'æ°å¢æ£æµæ å' |
| | | }) |
| | | |
| | | const handleConfirm = () => { |
| | | if (!formRef.value) { |
| | | emit('confirm') |
| | | return |
| | | } |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | | emit('confirm') |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleCancel = () => { |
| | | emit('cancel') |
| | | dialogVisible.value = false |
| | | } |
| | | |
| | | const resetFields = () => { |
| | | formRef.value?.resetFields?.() |
| | | } |
| | | |
| | | defineExpose({ |
| | | resetFields |
| | | }) |
| | | </script> |
| | |
| | | <template> |
| | | <div class="app-container product-view"> |
| | | <div class="left"> |
| | | <div> |
| | | <el-input |
| | | v-model="search" |
| | | style="width: 210px" |
| | | placeholder="è¾å
¥å
³é®åè¿è¡æç´¢" |
| | | @change="searchFilter" |
| | | @clear="searchFilter" |
| | | <div class="app-container metric-maintenance"> |
| | | <!-- å·¦ä¾§ï¼æ£æµæ åå表 --> |
| | | <div class="left-panel"> |
| | | <div class="toolbar"> |
| | | <div class="toolbar-left"></div> |
| | | <div class="toolbar-right"> |
| | | <el-button type="primary" @click="openStandardDialog('add')">æ°å¢</el-button> |
| | | <el-button type="success" plain @click="handleBatchAudit(1)">æ¹å</el-button> |
| | | <el-button type="warning" plain @click="handleBatchAudit(2)">æ¤é</el-button> |
| | | <el-button type="danger" plain @click="handleBatchDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="standardColumns" |
| | | :tableData="standardTableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :tableLoading="tableLoading" |
| | | :rowClassName="rowClassNameCenter" |
| | | :rowClick="handleTableRowClick" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="handlePagination" |
| | | :total="page.total" |
| | | > |
| | | <template #standardNoCell="{ row }"> |
| | | <span class="clickable-link" @click="handleStandardRowClick(row)"> |
| | | {{ row.standardNo }} |
| | | </span> |
| | | </template> |
| | | |
| | | <!-- 表头æç´¢ææ§½ --> |
| | | <template #standardNoHeader> |
| | | <el-input |
| | | v-model="searchForm.standardNo" |
| | | placeholder="æ åç¼å·" |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | </div> |
| | | <div ref="containerRef"> |
| | | <el-tree |
| | | ref="tree" |
| | | v-loading="treeLoad" |
| | | :data="list" |
| | | @node-click="handleNodeClick" |
| | | :expand-on-click-node="false" |
| | | default-expand-all |
| | | :default-expanded-keys="expandedKeys" |
| | | :draggable="true" |
| | | :filter-node-method="filterNode" |
| | | :props="{ children: 'children', label: 'label' }" |
| | | highlight-current |
| | | node-key="id" |
| | | style=" |
| | | height: calc(100vh - 190px); |
| | | overflow-y: scroll; |
| | | scrollbar-width: none; |
| | | " |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <div class="custom-tree-node"> |
| | | <span class="tree-node-content"> |
| | | <el-icon class="orange-icon"> |
| | | <component :is="data.children && data.children.length > 0 |
| | | ? node.expanded ? 'FolderOpened' : 'Folder' : 'Tickets'" /> |
| | | </el-icon> |
| | | {{ data.label }} |
| | | </span> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | </div> |
| | | size="small" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | /> |
| | | </template> |
| | | <template #standardNameHeader> |
| | | <el-input |
| | | v-model="searchForm.standardName" |
| | | placeholder="æ ååç§°" |
| | | clearable |
| | | size="small" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | /> |
| | | </template> |
| | | <template #inspectTypeHeader> |
| | | <el-select |
| | | v-model="searchForm.inspectType" |
| | | placeholder="ç±»å«" |
| | | clearable |
| | | size="small" |
| | | style="width: 120px" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | > |
| | | <el-option label="åæææ£éª" value="0" /> |
| | | <el-option label="è¿ç¨æ£éª" value="1" /> |
| | | <el-option label="åºåæ£éª" value="2" /> |
| | | </el-select> |
| | | </template> |
| | | <template #stateHeader> |
| | | <el-select |
| | | v-model="searchForm.state" |
| | | placeholder="ç¶æ" |
| | | clearable |
| | | size="small" |
| | | style="width: 110px" |
| | | @change="handleQuery" |
| | | @clear="handleQuery" |
| | | > |
| | | <el-option label="è稿" value="0" /> |
| | | <el-option label="éè¿" value="1" /> |
| | | <el-option label="æ¤é" value="2" /> |
| | | </el-select> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <div class="right"> |
| | | <div style="margin-bottom: 10px"> |
| | | <el-button type="primary" @click="openModelDia('add')"> |
| | | æ°å¢æ£æµææ |
| | | |
| | | <!-- å³ä¾§ï¼æ ååæ°å表 --> |
| | | <div class="right-panel"> |
| | | <div class="right-header"> |
| | | <div class="title">æ ååæ°</div> |
| | | <div class="desc" v-if="currentStandard"> |
| | | æ¨å½åéæ©çæ£æµæ åç¼å·æ¯ï¼ |
| | | <span class="link-text">{{ currentStandard.standardNo }}</span> |
| | | </div> |
| | | <div class="desc" v-else>请å
å¨å·¦ä¾§éæ©ä¸ä¸ªæ£æµæ å</div> |
| | | </div> |
| | | |
| | | <div class="right-toolbar"> |
| | | <el-button type="primary" :disabled="!currentStandard || isStandardReadonly" @click="openParamDialog('add')"> |
| | | æ°å¢ |
| | | </el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleDelete" |
| | | style="margin-left: 10px" |
| | | plain |
| | | > |
| | | <el-button type="danger" plain :disabled="!currentStandard || isStandardReadonly" @click="handleParamBatchDelete"> |
| | | å é¤ |
| | | </el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="modelDia" |
| | | title="æ£æµææ " |
| | | width="400px" |
| | | @close="closeModelDia" |
| | | > |
| | | <el-form |
| | | :model="modelForm" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="modelRules" |
| | | ref="modelFormRef" |
| | | |
| | | <el-table |
| | | v-loading="detailLoading" |
| | | :data="detailTableData" |
| | | border |
| | | :row-class-name="() => 'row-center'" |
| | | class="center-table" |
| | | style="width: 100%" |
| | | height="calc(100vh - 220px)" |
| | | @selection-change="handleParamSelectionChange" |
| | | > |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="ææ ï¼" prop="parameterItem"> |
| | | <el-input |
| | | v-model="modelForm.parameterItem" |
| | | placeholder="请è¾å
¥ææ " |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åä½ï¼" prop="unit"> |
| | | <el-input |
| | | v-model="modelForm.unit" |
| | | placeholder="请è¾å
¥åä½" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="æ åå¼ï¼" prop="standardValue"> |
| | | <el-input |
| | | v-model="modelForm.standardValue" |
| | | placeholder="请è¾å
¥æ åå¼" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å
æ§å¼ï¼" prop="controlValue"> |
| | | <el-input |
| | | v-model="modelForm.controlValue" |
| | | placeholder="请è¾å
¥å
æ§å¼" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitModelForm">确认</el-button> |
| | | <el-button @click="closeModelDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-table-column type="selection" width="48" align="center" /> |
| | | <el-table-column type="index" label="åºå·" width="60" align="center" /> |
| | | <el-table-column prop="parameterItem" label="忰项" min-width="120" /> |
| | | <el-table-column prop="unit" label="åä½" width="80" /> |
| | | <el-table-column prop="standardValue" label="æ åå¼" min-width="120" /> |
| | | <el-table-column prop="controlValue" label="å
æ§å¼" min-width="120" /> |
| | | <el-table-column prop="defaultValue" label="é»è®¤å¼" min-width="120" /> |
| | | <el-table-column label="æä½" width="140" fixed="right" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-button link type="primary" size="small" :disabled="isStandardReadonly" @click="openParamDialog('edit', row)"> |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button link type="danger" size="small" :disabled="isStandardReadonly" @click="handleParamDelete(row)"> |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!-- æ°å¢ / ç¼è¾æ£æµæ å --> |
| | | <StandardFormDialog |
| | | ref="standardFormDialogRef" |
| | | v-model="standardDialogVisible" |
| | | :operation-type="standardOperationType" |
| | | :form="standardForm" |
| | | :rules="standardRules" |
| | | :process-options="processOptions" |
| | | @confirm="submitStandardForm" |
| | | @close="closeStandardDialog" |
| | | @cancel="closeStandardDialog" |
| | | /> |
| | | |
| | | <ParamFormDialog |
| | | ref="paramFormDialogRef" |
| | | v-model="paramDialogVisible" |
| | | :operation-type="paramOperationType" |
| | | :form="paramForm" |
| | | @confirm="submitParamForm" |
| | | @close="closeParamDialog" |
| | | @cancel="closeParamDialog" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {addOrEditProductModel, delProductModel, modelListPage, productTreeList} from "@/api/basicData/product.js"; |
| | | import ImportExcel from "@/views/basicData/product/ImportExcel/index.vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance, computed } from 'vue' |
| | | import { ElMessageBox } from 'element-plus' |
| | | import { |
| | | qualityTestStandardAdd, qualityTestStandardDel, |
| | | qualityTestStandardListPage, |
| | | qualityTestStandardUpdate |
| | | } from "@/api/qualityManagement/metricMaintenance.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | // æ |
| | | const search = ref(""); |
| | | const treeLoad = ref(false); |
| | | const list = ref([]); |
| | | const expandedKeys = ref([]); |
| | | const currentId = ref(""); |
| | | const currentParentId = ref(""); |
| | | // ææ è¡¨æ ¼ |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | qualityTestStandardAdd, |
| | | qualityTestStandardUpdate, |
| | | qualityTestStandardDel, |
| | | qualityTestStandardCopyParam, |
| | | qualityTestStandardAudit, |
| | | qualityTestStandardParamList, |
| | | qualityTestStandardParamAdd, |
| | | qualityTestStandardParamUpdate, |
| | | qualityTestStandardParamDel |
| | | } from '@/api/qualityManagement/metricMaintenance.js' |
| | | import { productProcessListPage } from '@/api/basicData/productProcess.js' |
| | | import StandardFormDialog from './StandardFormDialog.vue' |
| | | import ParamFormDialog from './ParamFormDialog.vue' |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | // 左侧æ ååè¡¨ï¼æ´è¡å
容å±
ä¸ï¼é
åæ ·å¼ï¼ |
| | | const rowClassNameCenter = () => 'row-center' |
| | | |
| | | // æ åç¶æä¸ºâéè¿(1)âæ¶ï¼å³ä¾§åæ°ç¦æ¢å¢å æ¹ |
| | | const isStandardReadonly = computed(() => { |
| | | const state = currentStandard.value?.state |
| | | return state === 1 || state === '1' |
| | | }) |
| | | |
| | | // æç´¢æ¡ä»¶ |
| | | const data = reactive({ |
| | | searchForm: { |
| | | standardNo: '', |
| | | standardName: '', |
| | | remark: '', |
| | | state: '', |
| | | inspectType: '', |
| | | processId: '' |
| | | }, |
| | | standardForm: { |
| | | id: undefined, |
| | | standardNo: '', |
| | | standardName: '', |
| | | remark: '', |
| | | state: '0', |
| | | inspectType: '', |
| | | processId: '' |
| | | }, |
| | | standardRules: { |
| | | standardNo: [{ required: true, message: '请è¾å
¥æ åç¼å·', trigger: 'blur' }], |
| | | standardName: [{ required: true, message: '请è¾å
¥æ ååç§°', trigger: 'blur' }], |
| | | inspectType: [{ required: true, message: 'è¯·éæ©æ£æµç±»å', trigger: 'change' }], |
| | | processId: [{ required: false, message: 'è¯·éæ©å·¥åº', trigger: 'change' }] |
| | | } |
| | | }) |
| | | |
| | | const { searchForm, standardForm, standardRules } = toRefs(data) |
| | | |
| | | // å·¦ä¾§è¡¨æ ¼ |
| | | const standardTableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }); |
| | | const tableColumn = ref([ |
| | | total: 0 |
| | | }) |
| | | |
| | | // å·¥åºä¸æ |
| | | const processOptions = ref([]) |
| | | |
| | | // è·åå·¥åºå表 |
| | | const getProcessList = async () => { |
| | | try { |
| | | const res = await productProcessListPage({ current: 1, size: 1000 }) |
| | | if (res?.code === 200) { |
| | | const records = res?.data?.records || [] |
| | | processOptions.value = records.map(item => ({ |
| | | label: item.processName || item.name || item.label, |
| | | value: item.id || item.processId || item.value |
| | | })) |
| | | } |
| | | } catch (error) { |
| | | console.error('è·åå·¥åºå表失败:', error) |
| | | } |
| | | } |
| | | |
| | | // å½åéä¸çæ å & å³ä¾§è¯¦æ
|
| | | const currentStandard = ref(null) |
| | | const detailTableData = ref([]) |
| | | const detailLoading = ref(false) |
| | | const paramSelectedRows = ref([]) |
| | | const paramDialogVisible = ref(false) |
| | | const paramOperationType = ref('add') // add | edit |
| | | const paramFormDialogRef = ref(null) |
| | | const paramForm = reactive({ |
| | | id: undefined, |
| | | parameterItem: '', |
| | | unit: '', |
| | | standardValue: '', |
| | | controlValue: '', |
| | | defaultValue: '' |
| | | }) |
| | | |
| | | // å¼¹çª |
| | | const standardDialogVisible = ref(false) |
| | | const standardOperationType = ref('add') // add | edit | copy |
| | | const standardFormDialogRef = ref(null) |
| | | |
| | | // åå®ä¹ |
| | | const standardColumns = ref([ |
| | | { |
| | | label: "ææ ", |
| | | prop: "parameterItem", |
| | | label: 'æ åç¼å·', |
| | | prop: 'standardNo', |
| | | dataType: 'slot', |
| | | slot: 'standardNoCell', |
| | | minWidth: 160, |
| | | align: 'center', |
| | | headerSlot: 'standardNoHeader' |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | label: 'æ ååç§°', |
| | | prop: 'standardName', |
| | | minWidth: 180, |
| | | align: 'center', |
| | | headerSlot: 'standardNameHeader' |
| | | }, |
| | | { |
| | | label: "æ åå¼", |
| | | prop: "standardValue", |
| | | label: 'ç±»å«', |
| | | prop: 'inspectType', |
| | | headerSlot: 'inspectTypeHeader', |
| | | align: 'center', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const map = { |
| | | 0: 'åæææ£éª', |
| | | 1: 'è¿ç¨æ£éª', |
| | | 2: 'åºåæ£éª' |
| | | } |
| | | return map[val] || val |
| | | } |
| | | }, |
| | | { |
| | | label: "å
æ§å¼", |
| | | prop: "controlValue", |
| | | label: 'å·¥åº', |
| | | prop: 'processId', |
| | | align: 'center', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const target = processOptions.value.find( |
| | | (item) => String(item.value) === String(val) |
| | | ) |
| | | return target?.label || val |
| | | } |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | label: 'ç¶æ', |
| | | prop: 'state', |
| | | headerSlot: 'stateHeader', |
| | | align: 'center', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const map = { |
| | | 0: 'è稿', |
| | | 1: 'éè¿', |
| | | 2: 'æ¤é' |
| | | } |
| | | return map[val] || val |
| | | }, |
| | | formatType: (val) => { |
| | | if (val === '1' || val === 1) return 'success' |
| | | if (val === '2' || val === 2) return 'warning' |
| | | return 'info' |
| | | } |
| | | }, |
| | | { |
| | | label: '夿³¨', |
| | | prop: 'remark', |
| | | minWidth: 160, |
| | | align: 'center' |
| | | }, |
| | | { |
| | | dataType: 'action', |
| | | label: 'æä½', |
| | | align: 'center', |
| | | fixed: 'right', |
| | | width: 220, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | name: 'ç¼è¾', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | openModelDia("edit", row); |
| | | }, |
| | | openStandardDialog('edit', row) |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const selectedRows = ref([]); |
| | | // ææ å¼¹æ¡ |
| | | const modelDia = ref(false); |
| | | const modelOperationType = ref(""); |
| | | const data = reactive({ |
| | | modelForm: { |
| | | parameterItem: "", |
| | | unit: "", |
| | | standardValue: "", |
| | | controlValue: "", |
| | | }, |
| | | modelRules: { |
| | | parameterItem: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | standardValue: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | // controlValue: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | }, |
| | | }); |
| | | const { modelForm, modelRules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢äº§åæ |
| | | const getProductTreeList = () => { |
| | | treeLoad.value = true; |
| | | productTreeList().then((res) => { |
| | | list.value = res; |
| | | list.value.forEach((a) => { |
| | | expandedKeys.value.push(a.label); |
| | | }); |
| | | treeLoad.value = false; |
| | | }).catch((err) => { |
| | | treeLoad.value = false; |
| | | }); |
| | | }; |
| | | // è¿æ»¤äº§åæ |
| | | const searchFilter = () => { |
| | | proxy.$refs.tree.filter(search.value); |
| | | }; |
| | | // éæ©äº§å |
| | | const handleNodeClick = (val, node, el) => { |
| | | // åªæå¶åèç¹ææ§è¡ä»¥ä¸é»è¾ |
| | | currentId.value = val.id; |
| | | currentParentId.value = val.parentId; |
| | | getModelList(); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æ¥è¯¢ææ æ°æ® |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getModelList(); |
| | | }; |
| | | const getModelList = () => { |
| | | tableLoading.value = true; |
| | | qualityTestStandardListPage({ |
| | | productId: currentId.value, |
| | | current: page.current, |
| | | size: page.size, |
| | | }).then((res) => { |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // è°ç¨treeè¿æ»¤æ¹æ³ 䏿è±è¿æ»¤ |
| | | const filterNode = (value, data, node) => { |
| | | if (!value) { |
| | | //å¦ææ°æ®ä¸ºç©ºï¼åè¿åtrue,æ¾ç¤ºææçæ°æ®é¡¹ |
| | | return true; |
| | | } |
| | | // æ¥è¯¢å表æ¯å¦æå¹é
æ°æ®ï¼å°å¼å°åï¼å¹é
è±ææ°æ® |
| | | let val = value.toLowerCase(); |
| | | return chooseNode(val, data, node); // è°ç¨è¿æ»¤äºå±æ¹æ³ |
| | | }; |
| | | // è¿æ»¤ç¶èç¹ / åèç¹ (妿è¾å
¥çåæ°æ¯ç¶èç¹ä¸è½å¹é
ï¼åè¿å该èç¹ä»¥åå
¶ä¸çææåèç¹ï¼å¦æåæ°æ¯åèç¹ï¼åè¿å该èç¹çç¶èç¹ãnameæ¯ä¸æå符ï¼enNameæ¯è±æå符. |
| | | const chooseNode = (value, data, node) => { |
| | | if (data.label.indexOf(value) !== -1) { |
| | | return true; |
| | | } |
| | | const level = node.level; |
| | | // å¦æä¼ å
¥çèç¹æ¬èº«å°±æ¯ä¸çº§èç¹å°±ä¸ç¨æ ¡éªäº |
| | | if (level === 1) { |
| | | return false; |
| | | } |
| | | // å
åå½åèç¹çç¶èç¹ |
| | | let parentData = node.parent; |
| | | // éåå½åèç¹çç¶èç¹ |
| | | let index = 0; |
| | | while (index < level - 1) { |
| | | // 妿å¹é
å°ç´æ¥è¿åï¼æ¤å¤name弿¯ä¸æå符ï¼enNameæ¯è±æå符ã夿å¹é
ä¸è±æè¿æ»¤ |
| | | if (parentData.data.label.indexOf(value) !== -1) { |
| | | return true; |
| | | } |
| | | // å¦åçè¯åå¾ä¸ä¸å±åå¹é
|
| | | parentData = parentData.parent; |
| | | index++; |
| | | } |
| | | // 没å¹é
å°è¿åfalse |
| | | return false; |
| | | }; |
| | | // æå¼ææ å¼¹æ¡ |
| | | const openModelDia = (type, data) => { |
| | | modelOperationType.value = type; |
| | | modelDia.value = true; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.id = ""; |
| | | if (type === "edit") { |
| | | modelForm.value = { ...data }; |
| | | } |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | proxy.download("/quality/qualityTestStandard/export", {}, "æ£æµææ .xlsx"); |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // å 餿æ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | tableLoading.value = true; |
| | | qualityTestStandardDel(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getModelList(); |
| | | }).finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // æäº¤è§æ ¼åå·ä¿®æ¹ |
| | | const submitModelForm = () => { |
| | | proxy.$refs.modelFormRef.validate((valid) => { |
| | | if (valid) { |
| | | modelForm.value.productId = Number(currentId.value); |
| | | if(modelOperationType.value === 'add') { |
| | | qualityTestStandardAdd(modelForm.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeModelDia(); |
| | | getModelList(); |
| | | }); |
| | | } else { |
| | | qualityTestStandardUpdate(modelForm.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeModelDia(); |
| | | getModelList(); |
| | | }); |
| | | { |
| | | name: 'å¤å¶', |
| | | type: 'text', |
| | | clickFun: async (row) => { |
| | | if (!row?.id) return |
| | | try { |
| | | await ElMessageBox.confirm('确认å¤å¶è¯¥æ ååæ°ï¼', 'æç¤º', { type: 'warning' }) |
| | | } catch { |
| | | return |
| | | } |
| | | await qualityTestStandardCopyParam(row.id) |
| | | proxy.$message.success('å¤å¶æå') |
| | | getStandardList() |
| | | if (currentStandard.value?.id === row.id) { |
| | | loadDetail(row.id) |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | name: 'å é¤', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | handleDelete(row) |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éåå·å¼¹æ¡ |
| | | const closeModelDia = () => { |
| | | proxy.$refs.modelFormRef.resetFields(); |
| | | modelDia.value = false; |
| | | }; |
| | | getProductTreeList(); |
| | | ] |
| | | } |
| | | ]) |
| | | |
| | | // æ¥è¯¢å表 |
| | | const getStandardList = () => { |
| | | tableLoading.value = true |
| | | const params = { |
| | | ...searchForm.value, |
| | | current: page.current, |
| | | size: page.size |
| | | } |
| | | qualityTestStandardListPage(params) |
| | | .then((res) => { |
| | | const records = res?.data?.records || [] |
| | | standardTableData.value = records |
| | | page.total = res?.data?.total || records.length |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getStandardList() |
| | | } |
| | | |
| | | const resetQuery = () => { |
| | | searchForm.value.standardNo = '' |
| | | searchForm.value.standardName = '' |
| | | searchForm.value.remark = '' |
| | | searchForm.value.state = '' |
| | | searchForm.value.inspectType = '' |
| | | searchForm.value.processId = '' |
| | | handleQuery() |
| | | } |
| | | |
| | | const handlePagination = (obj) => { |
| | | page.current = obj.page |
| | | page.size = obj.limit |
| | | getStandardList() |
| | | } |
| | | |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | |
| | | // æ¹éå®¡æ ¸ï¼ç¶æ 1=æ¹åï¼2=æ¤é |
| | | const handleBatchAudit = async (state) => { |
| | | if (!selectedRows.value.length) { |
| | | proxy.$message.warning('è¯·éæ©æ°æ®') |
| | | return |
| | | } |
| | | const text = state === 1 ? 'æ¹å' : 'æ¤é' |
| | | const payload = selectedRows.value |
| | | .filter(i => i?.id) |
| | | .map((item) => ({ id: item.id, state })) |
| | | |
| | | if (!payload.length) { |
| | | proxy.$message.warning('è¯·éæ©æææ°æ®') |
| | | return |
| | | } |
| | | |
| | | try { |
| | | await ElMessageBox.confirm(`确认${text}éä¸çæ åï¼`, 'æç¤º', { type: 'warning' }) |
| | | } catch { |
| | | return |
| | | } |
| | | await qualityTestStandardAudit(payload) |
| | | proxy.$message.success(`${text}æå`) |
| | | getStandardList() |
| | | } |
| | | |
| | | // è¡¨æ ¼è¡ç¹å»ï¼å è½½å³ä¾§åæ° |
| | | const handleTableRowClick = (row) => { |
| | | currentStandard.value = row |
| | | loadDetail(row.id) |
| | | } |
| | | |
| | | // 左侧è¡ç¹å»ï¼å è½½å³ä¾§åæ°ï¼ä¿çç¨äºæ åç¼å·åçç¹å»ï¼ |
| | | const handleStandardRowClick = (row) => { |
| | | currentStandard.value = row |
| | | loadDetail(row.id) |
| | | } |
| | | |
| | | const loadDetail = (standardId) => { |
| | | if (!standardId) { |
| | | detailTableData.value = [] |
| | | return |
| | | } |
| | | detailLoading.value = true |
| | | qualityTestStandardParamList({ testStandardId: standardId }).then((res) => { |
| | | detailTableData.value = res?.data || [] |
| | | }) |
| | | .finally(() => { |
| | | detailLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const handleParamSelectionChange = (selection) => { |
| | | paramSelectedRows.value = selection |
| | | } |
| | | |
| | | const openParamDialog = (type, row) => { |
| | | if (!currentStandard.value?.id) return |
| | | if (isStandardReadonly.value) { |
| | | proxy.$message.warning('该æ åå·²éè¿ï¼åæ°ä¸å¯ç¼è¾') |
| | | return |
| | | } |
| | | paramOperationType.value = type |
| | | if (type === 'add') { |
| | | Object.assign(paramForm, { |
| | | id: undefined, |
| | | parameterItem: '', |
| | | unit: '', |
| | | standardValue: '', |
| | | controlValue: '', |
| | | defaultValue: '' |
| | | }) |
| | | } else if (type === 'edit' && row) { |
| | | Object.assign(paramForm, row) |
| | | } |
| | | paramDialogVisible.value = true |
| | | } |
| | | |
| | | const closeParamDialog = () => { |
| | | paramDialogVisible.value = false |
| | | paramFormDialogRef.value?.resetFields?.() |
| | | } |
| | | |
| | | const submitParamForm = async () => { |
| | | const testStandardId = currentStandard.value?.id |
| | | if (!testStandardId) return |
| | | if (isStandardReadonly.value) { |
| | | proxy.$message.warning('该æ åå·²éè¿ï¼åæ°ä¸å¯ç¼è¾') |
| | | return |
| | | } |
| | | const payload = { ...paramForm, testStandardId } |
| | | if (paramOperationType.value === 'edit') { |
| | | await qualityTestStandardParamUpdate(payload) |
| | | proxy.$message.success('æäº¤æå') |
| | | } else { |
| | | await qualityTestStandardParamAdd(payload) |
| | | proxy.$message.success('æäº¤æå') |
| | | } |
| | | closeParamDialog() |
| | | loadDetail(testStandardId) |
| | | } |
| | | |
| | | const handleParamDelete = async (row) => { |
| | | if (!row?.id) return |
| | | if (isStandardReadonly.value) { |
| | | proxy.$message.warning('该æ åå·²éè¿ï¼åæ°ä¸å¯ç¼è¾') |
| | | return |
| | | } |
| | | try { |
| | | await ElMessageBox.confirm('确认å é¤è¯¥åæ°ï¼', 'æç¤º', { type: 'warning' }) |
| | | } catch { |
| | | return |
| | | } |
| | | await qualityTestStandardParamDel([row.id]) |
| | | proxy.$message.success('å 餿å') |
| | | loadDetail(currentStandard.value?.id) |
| | | } |
| | | |
| | | const handleParamBatchDelete = async () => { |
| | | if (isStandardReadonly.value) { |
| | | proxy.$message.warning('该æ åå·²éè¿ï¼åæ°ä¸å¯ç¼è¾') |
| | | return |
| | | } |
| | | if (!paramSelectedRows.value.length) { |
| | | proxy.$message.warning('è¯·éæ©æ°æ®') |
| | | return |
| | | } |
| | | const ids = paramSelectedRows.value.map((i) => i.id) |
| | | try { |
| | | await ElMessageBox.confirm('éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', 'å é¤æç¤º', { type: 'warning' }) |
| | | } catch { |
| | | return |
| | | } |
| | | await qualityTestStandardParamDel(ids) |
| | | proxy.$message.success('å 餿å') |
| | | loadDetail(currentStandard.value?.id) |
| | | } |
| | | |
| | | // æ°å¢ / ç¼è¾ / å¤å¶ |
| | | const openStandardDialog = (type, row) => { |
| | | standardOperationType.value = type |
| | | if (type === 'add') { |
| | | Object.assign(standardForm.value, { |
| | | id: undefined, |
| | | standardNo: '', |
| | | standardName: '', |
| | | remark: '', |
| | | state: '0', |
| | | inspectType: '', |
| | | processId: '' |
| | | }) |
| | | } else if (type === 'edit' && row) { |
| | | Object.assign(standardForm.value, { |
| | | ...row, |
| | | // ç¡®ä¿ inspectType å state 转æ¢ä¸ºå符串ï¼ä»¥å¹é
el-select ç value ç±»å |
| | | inspectType: row.inspectType !== null && row.inspectType !== undefined ? String(row.inspectType) : '', |
| | | state: row.state !== null && row.state !== undefined ? String(row.state) : '0', |
| | | // ç¡®ä¿ processId 转æ¢ä¸ºåç¬¦ä¸²ææ°åï¼æ ¹æ®å®é
éè¦ï¼ |
| | | processId: row.processId !== null && row.processId !== undefined ? row.processId : '' |
| | | }) |
| | | } else if (type === 'copy' && row) { |
| | | const { id, ...rest } = row |
| | | Object.assign(standardForm.value, { |
| | | ...rest, |
| | | id: undefined, |
| | | standardNo: '', |
| | | state: '0', |
| | | // ç¡®ä¿ inspectType 转æ¢ä¸ºå符串 |
| | | inspectType: rest.inspectType !== null && rest.inspectType !== undefined ? String(rest.inspectType) : '' |
| | | }) |
| | | } |
| | | standardDialogVisible.value = true |
| | | } |
| | | |
| | | const closeStandardDialog = () => { |
| | | standardDialogVisible.value = false |
| | | standardFormDialogRef.value?.resetFields?.() |
| | | } |
| | | |
| | | const submitStandardForm = () => { |
| | | const payload = { ...standardForm.value } |
| | | const isEdit = standardOperationType.value === 'edit' |
| | | if (isEdit) { |
| | | qualityTestStandardUpdate(payload).then(() => { |
| | | proxy.$message.success('æäº¤æå') |
| | | standardDialogVisible.value = false |
| | | getStandardList() |
| | | }) |
| | | } else { |
| | | qualityTestStandardAdd(payload).then(() => { |
| | | proxy.$message.success('æäº¤æå') |
| | | standardDialogVisible.value = false |
| | | getStandardList() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // å é¤ï¼åæ¡ï¼ |
| | | const handleDelete = (row) => { |
| | | const ids = [row.id] |
| | | ElMessageBox.confirm('éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', 'å é¤æç¤º', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true |
| | | qualityTestStandardDel(ids) |
| | | .then(() => { |
| | | proxy.$message.success('å 餿å') |
| | | getStandardList() |
| | | if (currentStandard.value && currentStandard.value.id === row.id) { |
| | | currentStandard.value = null |
| | | detailTableData.value = [] |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal?.msg('已忶') |
| | | }) |
| | | } |
| | | |
| | | // æ¹éå é¤ |
| | | const handleBatchDelete = () => { |
| | | if (!selectedRows.value.length) { |
| | | proxy.$message.warning('è¯·éæ©æ°æ®') |
| | | return |
| | | } |
| | | const ids = selectedRows.value.map((item) => item.id) |
| | | ElMessageBox.confirm('éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', 'å é¤æç¤º', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true |
| | | qualityTestStandardDel(ids) |
| | | .then(() => { |
| | | proxy.$message.success('å 餿å') |
| | | getStandardList() |
| | | if (currentStandard.value && ids.includes(currentStandard.value.id)) { |
| | | currentStandard.value = null |
| | | detailTableData.value = [] |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal?.msg('已忶') |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getProcessList() |
| | | getStandardList() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .product-view { |
| | | .metric-maintenance { |
| | | display: flex; |
| | | gap: 16px; |
| | | min-width: 0; /* å
许 flex åå
ç´ æ¶ç¼© */ |
| | | } |
| | | .left { |
| | | width: 380px; |
| | | padding: 16px; |
| | | background: #ffffff; |
| | | } |
| | | .right { |
| | | width: calc(100% - 380px); |
| | | padding: 16px; |
| | | margin-left: 20px; |
| | | background: #ffffff; |
| | | } |
| | | .custom-tree-node { |
| | | |
| | | .left-panel, |
| | | .right-panel { |
| | | flex: 1; |
| | | min-width: 0; /* å
许 flex åå
ç´ æ¶ç¼© */ |
| | | background: #ffffff; |
| | | padding: 16px; |
| | | box-sizing: border-box; |
| | | overflow: hidden; /* 鲿¢å
å®¹æº¢åº */ |
| | | } |
| | | |
| | | /* ä½å辨çéé
*/ |
| | | @media (max-width: 1400px) { |
| | | .metric-maintenance { |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .left-panel, |
| | | .right-panel { |
| | | width: 100%; |
| | | min-width: 0; |
| | | } |
| | | } |
| | | |
| | | @media (max-width: 768px) { |
| | | .metric-maintenance { |
| | | gap: 12px; |
| | | } |
| | | |
| | | .left-panel, |
| | | .right-panel { |
| | | padding: 12px; |
| | | } |
| | | } |
| | | |
| | | .toolbar { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 12px; |
| | | flex-wrap: wrap; |
| | | gap: 8px; |
| | | } |
| | | |
| | | .toolbar-left { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | font-size: 14px; |
| | | padding-right: 8px; |
| | | flex-wrap: wrap; |
| | | gap: 4px; |
| | | } |
| | | .tree-node-content { |
| | | |
| | | .toolbar-right { |
| | | flex-shrink: 0; |
| | | display: flex; |
| | | align-items: center; /* åç´å±
ä¸ */ |
| | | height: 100%; |
| | | flex-wrap: wrap; |
| | | gap: 8px; |
| | | } |
| | | .orange-icon { |
| | | color: orange; |
| | | font-size: 18px; |
| | | margin-right: 8px; /* 徿 䏿åä¹é´å ç¹é´è· */ |
| | | |
| | | .search-label { |
| | | margin: 0 4px 0 12px; |
| | | } |
| | | |
| | | .search-label:first-of-type { |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .right-header { |
| | | display: flex; |
| | | align-items: baseline; |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .right-header .title { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .right-header .desc { |
| | | font-size: 13px; |
| | | color: #666; |
| | | } |
| | | |
| | | .right-toolbar { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 10px; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .link-text { |
| | | color: #409eff; |
| | | cursor: default; |
| | | } |
| | | |
| | | .clickable-link { |
| | | color: #409eff; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .clickable-link:hover { |
| | | text-decoration: underline; |
| | | } |
| | | |
| | | :deep(.row-center td) { |
| | | text-align: center !important; |
| | | } |
| | | |
| | | /* el-table 表头/å
容ç»ä¸å±
ä¸ï¼row-class-name ä¸ä½ç¨äºè¡¨å¤´ï¼ */ |
| | | :deep(.center-table .el-table__header-wrapper th .cell) { |
| | | text-align: center !important; |
| | | } |
| | | :deep(.center-table .el-table__body-wrapper td .cell) { |
| | | text-align: center !important; |
| | | } |
| | | |
| | | /* PIMTable 表头å±
ä¸ */ |
| | | :deep(.lims-table .pim-table-header-cell) { |
| | | text-align: center; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | :deep(.lims-table .pim-table-header-title) { |
| | | text-align: center; |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(.lims-table .pim-table-header-extra) { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container product-view"> |
| | | <div class="left"> |
| | | <div> |
| | | <el-input |
| | | v-model="search" |
| | | style="width: 210px" |
| | | placeholder="è¾å
¥å
³é®åè¿è¡æç´¢" |
| | | @change="searchFilter" |
| | | @clear="searchFilter" |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | </div> |
| | | <div ref="containerRef"> |
| | | <el-tree |
| | | ref="tree" |
| | | v-loading="treeLoad" |
| | | :data="list" |
| | | @node-click="handleNodeClick" |
| | | :expand-on-click-node="false" |
| | | default-expand-all |
| | | :default-expanded-keys="expandedKeys" |
| | | :draggable="true" |
| | | :filter-node-method="filterNode" |
| | | :props="{ children: 'children', label: 'label' }" |
| | | highlight-current |
| | | node-key="id" |
| | | style=" |
| | | height: calc(100vh - 190px); |
| | | overflow-y: scroll; |
| | | scrollbar-width: none; |
| | | " |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <div class="custom-tree-node"> |
| | | <span class="tree-node-content"> |
| | | <el-icon class="orange-icon"> |
| | | <component :is="data.children && data.children.length > 0 |
| | | ? node.expanded ? 'FolderOpened' : 'Folder' : 'Tickets'" /> |
| | | </el-icon> |
| | | {{ data.label }} |
| | | </span> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | </div> |
| | | </div> |
| | | <div class="right"> |
| | | <div style="margin-bottom: 10px"> |
| | | <el-button type="primary" @click="openModelDia('add')"> |
| | | æ°å¢æ£æµææ |
| | | </el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleDelete" |
| | | style="margin-left: 10px" |
| | | plain |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="modelDia" |
| | | title="æ£æµææ " |
| | | width="400px" |
| | | @close="closeModelDia" |
| | | > |
| | | <el-form |
| | | :model="modelForm" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="modelRules" |
| | | ref="modelFormRef" |
| | | > |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="ææ ï¼" prop="parameterItem"> |
| | | <el-input |
| | | v-model="modelForm.parameterItem" |
| | | placeholder="请è¾å
¥ææ " |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åä½ï¼" prop="unit"> |
| | | <el-input |
| | | v-model="modelForm.unit" |
| | | placeholder="请è¾å
¥åä½" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="æ åå¼ï¼" prop="standardValue"> |
| | | <el-input |
| | | v-model="modelForm.standardValue" |
| | | placeholder="请è¾å
¥æ åå¼" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å
æ§å¼ï¼" prop="controlValue"> |
| | | <el-input |
| | | v-model="modelForm.controlValue" |
| | | placeholder="请è¾å
¥å
æ§å¼" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitModelForm">确认</el-button> |
| | | <el-button @click="closeModelDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {addOrEditProductModel, delProductModel, modelListPage, productTreeList} from "@/api/basicData/product.js"; |
| | | import ImportExcel from "@/views/basicData/product/ImportExcel/index.vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import { |
| | | qualityTestStandardAdd, qualityTestStandardDel, |
| | | qualityTestStandardListPage, |
| | | qualityTestStandardUpdate |
| | | } from "@/api/qualityManagement/metricMaintenance.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | // æ |
| | | const search = ref(""); |
| | | const treeLoad = ref(false); |
| | | const list = ref([]); |
| | | const expandedKeys = ref([]); |
| | | const currentId = ref(""); |
| | | const currentParentId = ref(""); |
| | | // ææ è¡¨æ ¼ |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ææ ", |
| | | prop: "parameterItem", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "æ åå¼", |
| | | prop: "standardValue", |
| | | }, |
| | | { |
| | | label: "å
æ§å¼", |
| | | prop: "controlValue", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openModelDia("edit", row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const selectedRows = ref([]); |
| | | // ææ å¼¹æ¡ |
| | | const modelDia = ref(false); |
| | | const modelOperationType = ref(""); |
| | | const data = reactive({ |
| | | modelForm: { |
| | | parameterItem: "", |
| | | unit: "", |
| | | standardValue: "", |
| | | controlValue: "", |
| | | }, |
| | | modelRules: { |
| | | parameterItem: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | standardValue: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | controlValue: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | }, |
| | | }); |
| | | const { modelForm, modelRules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢äº§åæ |
| | | const getProductTreeList = () => { |
| | | treeLoad.value = true; |
| | | productTreeList().then((res) => { |
| | | list.value = res; |
| | | list.value.forEach((a) => { |
| | | expandedKeys.value.push(a.label); |
| | | }); |
| | | treeLoad.value = false; |
| | | }).catch((err) => { |
| | | treeLoad.value = false; |
| | | }); |
| | | }; |
| | | // è¿æ»¤äº§åæ |
| | | const searchFilter = () => { |
| | | proxy.$refs.tree.filter(search.value); |
| | | }; |
| | | // éæ©äº§å |
| | | const handleNodeClick = (val, node, el) => { |
| | | // åªæå¶åèç¹ææ§è¡ä»¥ä¸é»è¾ |
| | | currentId.value = val.id; |
| | | currentParentId.value = val.parentId; |
| | | getModelList(); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æ¥è¯¢ææ æ°æ® |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getModelList(); |
| | | }; |
| | | const getModelList = () => { |
| | | tableLoading.value = true; |
| | | qualityTestStandardListPage({ |
| | | productId: currentId.value, |
| | | current: page.current, |
| | | size: page.size, |
| | | }).then((res) => { |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // è°ç¨treeè¿æ»¤æ¹æ³ 䏿è±è¿æ»¤ |
| | | const filterNode = (value, data, node) => { |
| | | if (!value) { |
| | | //å¦ææ°æ®ä¸ºç©ºï¼åè¿åtrue,æ¾ç¤ºææçæ°æ®é¡¹ |
| | | return true; |
| | | } |
| | | // æ¥è¯¢å表æ¯å¦æå¹é
æ°æ®ï¼å°å¼å°åï¼å¹é
è±ææ°æ® |
| | | let val = value.toLowerCase(); |
| | | return chooseNode(val, data, node); // è°ç¨è¿æ»¤äºå±æ¹æ³ |
| | | }; |
| | | // è¿æ»¤ç¶èç¹ / åèç¹ (妿è¾å
¥çåæ°æ¯ç¶èç¹ä¸è½å¹é
ï¼åè¿å该èç¹ä»¥åå
¶ä¸çææåèç¹ï¼å¦æåæ°æ¯åèç¹ï¼åè¿å该èç¹çç¶èç¹ãnameæ¯ä¸æå符ï¼enNameæ¯è±æå符. |
| | | const chooseNode = (value, data, node) => { |
| | | if (data.label.indexOf(value) !== -1) { |
| | | return true; |
| | | } |
| | | const level = node.level; |
| | | // å¦æä¼ å
¥çèç¹æ¬èº«å°±æ¯ä¸çº§èç¹å°±ä¸ç¨æ ¡éªäº |
| | | if (level === 1) { |
| | | return false; |
| | | } |
| | | // å
åå½åèç¹çç¶èç¹ |
| | | let parentData = node.parent; |
| | | // éåå½åèç¹çç¶èç¹ |
| | | let index = 0; |
| | | while (index < level - 1) { |
| | | // 妿å¹é
å°ç´æ¥è¿åï¼æ¤å¤name弿¯ä¸æå符ï¼enNameæ¯è±æå符ã夿å¹é
ä¸è±æè¿æ»¤ |
| | | if (parentData.data.label.indexOf(value) !== -1) { |
| | | return true; |
| | | } |
| | | // å¦åçè¯åå¾ä¸ä¸å±åå¹é
|
| | | parentData = parentData.parent; |
| | | index++; |
| | | } |
| | | // 没å¹é
å°è¿åfalse |
| | | return false; |
| | | }; |
| | | // æå¼ææ å¼¹æ¡ |
| | | const openModelDia = (type, data) => { |
| | | modelOperationType.value = type; |
| | | modelDia.value = true; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.id = ""; |
| | | if (type === "edit") { |
| | | modelForm.value = { ...data }; |
| | | } |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | proxy.download("/quality/qualityTestStandard/export", {}, "æ£æµææ .xlsx"); |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // å 餿æ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | tableLoading.value = true; |
| | | qualityTestStandardDel(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getModelList(); |
| | | }).finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // æäº¤è§æ ¼åå·ä¿®æ¹ |
| | | const submitModelForm = () => { |
| | | proxy.$refs.modelFormRef.validate((valid) => { |
| | | if (valid) { |
| | | modelForm.value.productId = Number(currentId.value); |
| | | if(modelOperationType.value === 'add') { |
| | | qualityTestStandardAdd(modelForm.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeModelDia(); |
| | | getModelList(); |
| | | }); |
| | | } else { |
| | | qualityTestStandardUpdate(modelForm.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeModelDia(); |
| | | getModelList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éåå·å¼¹æ¡ |
| | | const closeModelDia = () => { |
| | | proxy.$refs.modelFormRef.resetFields(); |
| | | modelDia.value = false; |
| | | }; |
| | | getProductTreeList(); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .product-view { |
| | | display: flex; |
| | | } |
| | | .left { |
| | | width: 380px; |
| | | padding: 16px; |
| | | background: #ffffff; |
| | | } |
| | | .right { |
| | | width: calc(100% - 380px); |
| | | padding: 16px; |
| | | margin-left: 20px; |
| | | background: #ffffff; |
| | | } |
| | | .custom-tree-node { |
| | | flex: 1; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | font-size: 14px; |
| | | padding-right: 8px; |
| | | } |
| | | .tree-node-content { |
| | | display: flex; |
| | | align-items: center; /* åç´å±
ä¸ */ |
| | | height: 100%; |
| | | } |
| | | .orange-icon { |
| | | color: orange; |
| | | font-size: 18px; |
| | | margin-right: 8px; /* 徿 䏿åä¹é´å ç¹é´è· */ |
| | | } |
| | | </style> |
| src/views/qualityManagement/nearExpiryReturn/index.vue
src/views/qualityManagement/processInspection/components/formDia.vue
src/views/qualityManagement/processInspection/components/inspectionFormDia.vue
src/views/qualityManagement/processInspection/index.vue
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
src/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue
src/views/qualityManagement/rawMaterialInspection/index.vue
src/views/salesManagement/receiptPayment/index.vue
src/views/salesManagement/receiptPaymentHistory/index.vue
src/views/salesManagement/receiptPaymentLedger/index.vue
src/views/salesManagement/salesLedger/index.vue |