| | |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materialNos", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materialWides", |
| | | title: "å¹
宽", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "isLackMaterial", |
| | | title: "æ¯å¦ç¼ºæ", |
| | | type: "string", |
| | | width: 100, |
| | | align: "center", |
| | | formatter: (row) => { |
| | | field: "materialNos", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 160, |
| | | align: "left", |
| | | formatter: (row) => { |
| | | const materialNos = row.materialNos; |
| | | if (!materialNos) return materialNos; |
| | | |
| | | // å¤çç©æç¼å·ï¼æ ¹æ®æ¯ä¸ªç©æçå®é
ç¶ææ¾ç¤ºé¢è² |
| | | const materialList = materialNos.split('/'); |
| | | let formattedMaterials = []; |
| | | |
| | | // 妿æç©æç¼ºæç¶æåç¬¦ä¸²ï¼æ ¹æ®æ¯ä¸ªç©æçç¶ææ¾ç¤ºé¢è² |
| | | if (row.materialLackStatus) { |
| | | // è§£æç©æç¼ºæç¶æå符串ï¼ç©æç¼å·:ç¶æ,ç©æç¼å·:ç¶æ |
| | | const statusPairs = row.materialLackStatus.split(','); |
| | | // è·åææç©æç缺æç¶æå表ï¼ä¿æåå§é¡ºåº |
| | | const lackStatusList = statusPairs.map(pair => { |
| | | const [, isLack] = pair.split(':'); |
| | | return isLack.trim() === 'true'; |
| | | }); |
| | | |
| | | // 为æ¯ä¸ªç©æç¼å·è®¾ç½®é¢è²ï¼ä¿æåå§é¡ºåº |
| | | formattedMaterials = materialList.map((materialNo, index) => { |
| | | const trimmedMaterialNo = materialNo.trim(); |
| | | const isLack = lackStatusList[index] || false; |
| | | if (isLack) { |
| | | return `<span style="color: red;">${trimmedMaterialNo}</span>`; |
| | | } |
| | | return trimmedMaterialNo; |
| | | }); |
| | | } else { |
| | | // å¦ææ²¡æç©æç¼ºæç¶æä¿¡æ¯ï¼ä½¿ç¨è®¢å级å«ç缺æç¶æ |
| | | const isLack = Boolean(row.isLackMaterial); |
| | | const text = isLack ? "æ¯" : "å¦"; |
| | | const bgColor = isLack ? '#ff4d4f' : '#52c41a'; |
| | | return `<div style="background-color: ${bgColor}; color: #ffffff; text-align: center; font-weight: bold; width: 100%; height: 100%; padding: 10px 0; display: flex; justify-content: center; align-items: center;">${text}</div>`; |
| | | if (isLack) { |
| | | return `<span style="color: red;">${materialNos}</span>`; |
| | | } |
| | | formattedMaterials = materialList; |
| | | } |
| | | }, |
| | | |
| | | return formattedMaterials.join('/'); |
| | | } |
| | | }, |
| | | { |
| | | field: "materialWides", |
| | | title: "å¹
宽", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | formatter: (row) => { |
| | | const value = row.materialWides; |
| | | if (value && typeof value === 'string') { |
| | | return value.replace(/\.\d+$/, ''); |
| | | } |
| | | return value; |
| | | } |
| | | }, |
| | | { |
| | | field: "boardFluteNos", |
| | | title: "æ¥å«", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left" |
| | | }, |
| | | { |
| | | field: "isLackMaterial", |
| | | title: "æ¯å¦ç¼ºæ", |
| | | type: "string", |
| | | width: 100, |
| | | align: "center", |
| | | formatter: (row) => { |
| | | const isLack = Boolean(row.isLackMaterial); |
| | | const text = isLack ? "æ¯" : "å¦"; |
| | | const bgColor = isLack ? '#ff4d4f' : '#52c41a'; |
| | | return `<div style="background-color: ${bgColor}; color: #ffffff; text-align: center; font-weight: bold; width: 100%; height: 100%; padding: 10px 0; display: flex; justify-content: center; align-items: center;">${text}</div>`; |
| | | } |
| | | }, |
| | | ]); |
| | | const detail = ref({ |
| | | cnName: "åºåºæç»å", |
| | |
| | | align: "left", |
| | | edit: { type: "string" }, |
| | | required: true, |
| | | |
| | | }, |
| | | { |
| | | field: "xqLen", |