diff --git a/src/components/Common/BoxDesignCompontent/index.js b/src/components/Common/BoxDesignCompontent/index.js index 7921dae..719c420 100644 --- a/src/components/Common/BoxDesignCompontent/index.js +++ b/src/components/Common/BoxDesignCompontent/index.js @@ -24,6 +24,7 @@ const BoxDesignEvent = props => { setLoading(false); if (!tableData?.length) return const shape = tableData?.find(x => x.iTag === 70)?.showDropDown + if (!shape) return const JsonShape = JSON.parse(shape) const arr = Array.from(Object.values(JsonShape)); setOptions([ @@ -166,6 +167,7 @@ const BoxDesignCompontent = baseProps => { setTableDataList(newList); setTableDataLists(newList); const shape = tableData.find(x => x.iTag === 70)?.showDropDown + if (!shape) return const JsonShape = JSON.parse(shape) const shapeLists = Array.from(Object.values(JsonShape)) setShapeList(shapeLists) @@ -437,6 +439,10 @@ const BoxDesignCompontent = baseProps => { setTopDoubleBoxList(box.filter(topBoxFilter)); setLeftDoubleBoxList(box.filter(leftBoxFilter)); setRightDoubleBoxList(box.filter(rightBoxFilter)); + } else if (Number(type) === 9) { + setTopBoxList([]) + setLeftBoxList([]) + setRightBoxList([]) } else { const box = [...boxList]; box.forEach(x => { @@ -558,11 +564,7 @@ const BoxDesignCompontent = baseProps => { } setBoxList(updatedBoxList); }; - // const getImage = fileName => { - // // const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&sModelsId=100&token=${props.token}`; - // const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&scale=0.1&sModelsId=100&token=${props.token}`; - // return imageUrl; - // }; + const removeExtension = (filename) => { const lastDotIndex = filename.lastIndexOf('.'); if (lastDotIndex === -1) { diff --git a/src/components/Common/BoxDesignCompontent/svg.js b/src/components/Common/BoxDesignCompontent/svg.js index 036b976..90ad58c 100644 --- a/src/components/Common/BoxDesignCompontent/svg.js +++ b/src/components/Common/BoxDesignCompontent/svg.js @@ -69,9 +69,10 @@ const SvgBox = props => { useEffect(() => { setTimeout(() => { const svg = svgRef.current; - if (svg) { - initSVG(); + if (svg) { + initSVG() } + }, 0); }, [boxList, svgType]); @@ -343,6 +344,8 @@ const SvgBox = props => { const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0; viewBoxWidth = Math.max(topLength, bottomLength) + Number(leftOffect) + Number(rightOffect); viewBoxHeight = Number(headWidth) + Number(orderWidth) + max; + } else if (Number(svgType) === 9) { + } // 计算缩放比例 let scale = 1; @@ -412,6 +415,10 @@ const SvgBox = props => { xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); } else if (Number(svgType) === 4) { xSvg = (boxHeight * 2 + boxLength) / 2; + } else if (Number(svgType) === 9) { + // const data = calculateCupDimensionsAndStart(boxLength, boxWidth, boxHeight, g) + // xSvg = (data?.startX + 100) * scale + // ySvg = (data?.startDistance + 100) * scale } else { xSvg = zbtb?.value; } @@ -423,6 +430,7 @@ const SvgBox = props => { `${-(xSvg * scale)} ${dSvgBoxWidth ? (dSvgBoxWidth === 100 ? -ySvg : 0) : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth + ySvg : 500} ${dSvgBoxHeight ? dSvgBoxHeight - ySvg - bottom * scale : 250 + ySvg }` ); + svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; @@ -481,6 +489,10 @@ const SvgBox = props => { xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); } else if (Number(svgType) === 4) { xSvg = (boxHeight * 2 + boxLength) / 2; + } else if (Number(svgType) === 9) { + // const data = calculateCupDimensionsAndStart(boxLength, boxWidth, boxHeight, g) + // xSvg = (data?.startX + 150) * scale + // ySvg = (data?.startDistance + 100) * scale } else { xSvg = zbtb?.value; } @@ -492,6 +504,7 @@ const SvgBox = props => { "viewBox", `${-xSvg} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${dSvgBoxHeight ? dSvgBoxHeight : 250}` ); + svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; @@ -567,6 +580,10 @@ const SvgBox = props => { const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength)); ySvg = topOffect(boxList, headLength, headWidth, props); + } else if (Number(svgType) === 9) { + // const data = calculateCupDimensionsAndStart(boxLength, boxWidth, boxHeight, g) + // leftSize = -data?.startX + // ySvg = (data?.startDistance) * scale } else { leftSize = zbtb?.value; if (zbtb?.type === "8009") { @@ -658,6 +675,10 @@ const SvgBox = props => { const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength)); ySvg = topOffect(boxList, headLength, headWidth, props); + } else if (Number(svgType) === 9) { + // const data = calculateCupDimensionsAndStart(boxLength, boxWidth, boxHeight, g) + // leftSize = -data?.startX + // ySvg = (data?.startDistance) * scale } else { leftSize = zbtb?.value; } @@ -5179,10 +5200,107 @@ const SvgBox = props => { svg.appendChild(g); } else if (Number(svgType) === 9) { - // g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)) - svg.appendChild(g); + svg.appendChild(drawCup(boxLength, boxWidth, boxHeight, g)); + const result = calculateCupUnfoldDimensions(boxLength, boxWidth, boxHeight) + if (props.showNew !== 0) { + const w = result.width + const h = result.height + svg.setAttribute('viewBox', `${result.points.outerLeft.x} ${result.points.topCenter.y} ${w} ${h}`); + svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); + svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); + } + } + }; + function calculateCupUnfoldDimensions(D, d, h) { + + const R1 = D / 2; // 上口半径 + const R2 = d / 2; // 底部半径 + + // 1. 计算母线长 l + const deltaR = R1 - R2; + const l = Math.sqrt(deltaR * deltaR + h * h); + + // 2. 计算外半径 R 和内半径 r + const R = (R1 * l) / deltaR; // 外半径 + const r = R - l; // 内半径 + + // 3. 计算圆心角 θ(弧度) + const theta_rad = (2 * Math.PI * R1) / R; + const halfTheta = theta_rad / 2; + + // 4. 计算弦长(水平宽度) + const chord = 2 * R * Math.sin(halfTheta); + + // 5. 展开图垂直高度 + const y_top = -R; // 外弧中点(最高点) + const y_inner_end = -r * Math.cos(halfTheta); + const verticalHeight = y_inner_end - y_top; + + // ✅ 新增:计算关键点坐标(以圆心为原点,y 向上为正) + // 注意:数学坐标系中,角度从 x 轴开始逆时针,但我们希望顶部在 y 轴负方向 + // 所以我们把角度偏移 -90°(即 -π/2),让 0° 指向正上方 + + const angleOffset = -Math.PI / 2; // 使 0° 指向顶部 + + const points = { + outerCenter: { + x: R * Math.cos(halfTheta + angleOffset), + y: R * Math.sin(halfTheta + angleOffset) + }, + outerLeft: { + x: R * Math.cos(-halfTheta + angleOffset), + y: R * Math.sin(-halfTheta + angleOffset) + }, + outerRight: { + x: R * Math.cos(halfTheta + angleOffset), + y: R * Math.sin(halfTheta + angleOffset) + }, + innerLeft: { + x: r * Math.cos(-halfTheta + angleOffset), + y: r * Math.sin(-halfTheta + angleOffset) + }, + innerRight: { + x: r * Math.cos(halfTheta + angleOffset), + y: r * Math.sin(halfTheta + angleOffset) + }, + // 也可以计算顶部中点(0° 方向) + topCenter: { + x: 0, + y: -R // 正上方 + }, + bottomLeft: { + x: -chord / 2, + y: -r * Math.cos(halfTheta) + }, + bottomRight: { + x: chord / 2, + y: -r * Math.cos(halfTheta) + } + }; + + // 如果你需要用于 SVG(y 向下为正),可以转换 + const pointsForSVG = Object.keys(points).reduce((acc, key) => { + acc[key] = { + x: points[key].x, + y: -points[key].y // 反转 y 轴 + }; + return acc; + }, {}); + + return { + width: chord, + height: verticalHeight, + R, r, l, + theta_deg: (theta_rad * 180) / Math.PI, + points, // 数学坐标系(y 向上) + pointsForSVG, // SVG 坐标系(y 向下) + chord, + verticalHeight + }; + } + // 计算头部偏移 const topOffect = (list, length, width, height, props) => { const val = list.filter(x => x.type); @@ -5369,6 +5487,119 @@ const SvgBox = props => { // if (svg === 4) top = Number(top) + Number(height); return isNaN(top) ? 0 : top; }; + // 将角度转换为弧度 + const degToRad = (degrees) => { + return degrees * (Math.PI / 180); + } + + // 将弧度转换为角度 + const radToDeg = (radians) => { + return radians * (180 / Math.PI); + } + const drawCup = (w, h, d, g) => { + const R1 = w / 2; + const R2 = h / 2; + const H = d; + + // 1. 计算基础参数 + const l = Math.sqrt(Math.pow(R1 - R2, 2) + Math.pow(H, 2)); // 斜高 + const R = (R1 * l) / (R1 - R2); // 扇形外弧半径 + const r = R - l; // 扇形内弧半径 + const theta_rad = (2 * Math.PI * R1) / R; // 圆心角(弧度) + const theta_deg = radToDeg(theta_rad); // 圆心角(度) + + // 2. 计算SVG路径关键点坐标 + // 外弧起点和终点 (相对于新的坐标系) + const x1_outer = R * Math.sin(-theta_rad / 2); // 使用 sin 对应 x + const y1_outer = -R * Math.cos(-theta_rad / 2); // 使用 -cos 对应 y,使其开口向上 + const x2_outer = R * Math.sin(theta_rad / 2); + const y2_outer = -R * Math.cos(theta_rad / 2); + + // 内弧起点和终点 (现在与外弧圆心角相同) + const x1_inner = r * Math.sin(-theta_rad / 2); + const y1_inner = -r * Math.cos(-theta_rad / 2); + const x2_inner = r * Math.sin(theta_rad / 2); + const y2_inner = -r * Math.cos(theta_rad / 2); + + // 3. 计算主展开形状SVG路径 + // 大扇形外弧路径 (逆时针) + const isLargeArcOuter = theta_deg > 180 ? 1 : 0; + const outerArcPath = `M ${x1_outer} ${y1_outer} A ${R} ${R} 0 ${isLargeArcOuter} 1 ${x2_outer} ${y2_outer}`; + + // 连接到内弧终点的直线 + const lineToInnerEnd = `L ${x2_inner} ${y2_inner}`; + + // 内弧路径 (顺时针) + const isLargeArcInner = theta_deg > 180 ? 1 : 0; // 内弧圆心角与外弧相同 + const innerArcPath = `A ${r} ${r} 0 ${isLargeArcInner} 0 ${x1_inner} ${y1_inner}`; + + // 连接回外弧起点的直线并闭合 + const lineToOuterStartClose = `L ${x1_outer} ${y1_outer} Z`; + + // 4. 组合路径数据 + const pathData = `${outerArcPath} ${lineToInnerEnd} ${innerArcPath} ${lineToOuterStartClose}`; + + // 5. 创建SVG Path元素 + const svgNS = "http://www.w3.org/2000/svg"; + const pathElement = document.createElementNS(svgNS, 'path'); + pathElement.setAttribute('d', pathData); + pathElement.setAttribute('fill', 'transparent'); + pathElement.setAttribute('stroke', '#7588B9'); + pathElement.setAttribute('stroke-width', '1'); + pathElement.setAttribute('id', 'cupPath'); + g.appendChild(pathElement); + return pathElement; + } + + const calculateCupDimensionsAndStart = (w, h, d) => { + const R1 = w / 2; + const R2 = h / 2; + const H = d; + + // 输入验证 + if (isNaN(R1) || isNaN(R2) || isNaN(H) || + R1 <= R2 || R1 <= 0 || R2 < 0 || H <= 0) { + console.error("calculateCupDimensionsAndStart: 请输入有效的参数:R1 > R2 >= 0, H > 0"); + return null; + } + + // 1. 计算基础参数 + const l = Math.sqrt(Math.pow(R1 - R2, 2) + Math.pow(H, 2)); // 斜高 + const R = (R1 * l) / (R1 - R2); // 扇形外弧半径 + const r = R - l; // 扇形内弧半径 + const theta_rad = (2 * Math.PI * R1) / R; // 圆心角(弧度) + + // 2. 计算SVG路径关键点坐标 + // 外弧起点和终点 (相对于新的坐标系) + // 起始点是路径的第一个点 + const startX = R * Math.sin(-theta_rad / 2); // 使用 sin 对应 x + const startY = -R * Math.cos(-theta_rad / 2); // 使用 -cos 对应 y,使其开口向上 + const x2_outer = R * Math.sin(theta_rad / 2); + const y2_outer = -R * Math.cos(theta_rad / 2); + + // 内弧起点和终点 (现在与外弧圆心角相同) + const x1_inner = r * Math.sin(-theta_rad / 2); + const y1_inner = -r * Math.cos(-theta_rad / 2); + const x2_inner = r * Math.sin(theta_rad / 2); + const y2_inner = -r * Math.cos(theta_rad / 2); + + // 3. 计算起始点到原点 (0,0) 的距离 + const startDistance = Math.sqrt(startX * startX + startY * startY); + + // 4. 确定所有点的边界框 (Bounding Box) 以计算总宽度和高度 + const allX = [startX, x2_outer, x1_inner, x2_inner]; + const allY = [startY, y2_outer, y1_inner, y2_inner]; + + const minX = Math.min(...allX); + const maxX = Math.max(...allX); + const minY = Math.min(...allY); + const maxY = Math.max(...allY); + + const width = maxX - minX; + const height = maxY - minY; + + return { width, height, startX, startY, startDistance }; + }; // 上方盒舌左边 const createUpperBoxTongueLeft = (upperBoxTongueType, width, height, offsetX, offsetY) => { if (!height) return createNoneProject(); @@ -5694,7 +5925,6 @@ const SvgBox = props => { style={{ width: "100%", height: "100%", - margin: "0 auto", }} > ); } - const removeExtension = (filename) => { + const removeExtension = (filename) => { const lastDotIndex = filename.lastIndexOf('.'); if (lastDotIndex === -1) { // 如果字符串中没有点,则返回原字符串 @@ -1269,7 +1269,8 @@ export default class CommonComponent extends Component { return filename.substring(0, lastDotIndex); } if (sName === "sPackPath" || sName === "sPackDetailPathUpLoad" || sName === "sSvgPath") { - const uploadProps = { + let imageUrls = ""; + const uploadProps = { listType: "picture-card", className: "avatar-uploader", action: `${commonConfig.server_host}file/uploadPrice?sLogoName=logo${sName}${this.props.record.sName}`, @@ -1304,21 +1305,28 @@ export default class CommonComponent extends Component { const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`; return imageUrlNew } + const uploadName = commonFunc.showLocalMessage(this.props, "BtnUpload", "上传"); + const imageUrl = sName === "sPackPath" ? (this.props.record.sPackPath ? getImageUrl(this.props.record.sPackPath) : '') : sName === "sPackDetailPathUpLoad" ? (this.props.record.sPackDetailPathUpLoad ? getImageUrl(this.props.record.sPackDetailPathUpLoad) : '') : (this.props.record.sSvgPath ? getImageUrl(this.props.record.sSvgPath) : ''); return (
{imageUrl ? ( - avatar + avatar + ) : (
-
上传
+
{uploadName}
)}
- +
); } @@ -1343,28 +1351,20 @@ export default class CommonComponent extends Component { { name: "右贴边位", value: "dYTBW" }, { name: "右(下)插位组件", value: "dYXCW" }, ]; - const doubleTitlieList1 = [ - { name: "左上插位组件", value: "dZSCW" }, - { name: "上插位组件", value: "dSCW" }, - { name: "右上插位组件", value: "dYSCW" }, - { name: "左偏移", value: "dZPY" }, - { name: "左插位组件", value: "dZCW" }, - { name: "左下插位组件", value: "dZXCW" }, - { name: "右偏移", value: "dYPY" }, - { name: "右插位组件", value: "dYCW" }, - { name: "右下插位组件", value: "dYXCW" }, - { name: "首盒长", value: "dSHC" }, - { name: "首盒宽", value: "dSHK" }, - { name: "次盒长", value: "dCHC" }, - { name: "次盒宽", value: "dCHK" }, - ]; - const boxTypes = this.props.record.sTypes; - const srcList = Number(boxTypes) === 8 ? doubleTitlieList1 : titleList1; - - slaveData.forEach(x => + slaveData.forEach(x => { + let key = 0; + if (x.sTypes && x.sTypes.includes('09')) { + if (x.sCode === 'dZTBW' || x.sCode === 'dYTBW') { + key = x.iSLength + x.iCLength + } else { + key = x.iSWidth+ x.iCWidth + } + } else { + key = x.iValue + } boxList.push({ - value: x.iValue, - sName: srcList.find(item => item.value === x.sCode)?.name || "", + value: key, + sName: titleList1.find(item => item.value === x.sCode)?.name || "", isEditable: true, isSelect: false, selectValue: null, @@ -1372,7 +1372,7 @@ export default class CommonComponent extends Component { selectImage: null, type: x.sTypes || null, show: true, - showName: x.sName, + showName: x.sName, // 参数名称 sLength: x.iSLength, sWidth: x.iSWidth, sType: x.iSType, @@ -1385,9 +1385,8 @@ export default class CommonComponent extends Component { cTypeName: Number(x.iCType) === 0 ? "矩形" : "梯形", cOffset: x.sCOffset, cQuantity: x.iCQuantity, - }) - ); - + }); + }); tables.forEach(x => { boxList.push({ value: x.value, @@ -1402,23 +1401,7 @@ export default class CommonComponent extends Component { showName: x.name, // 参数名称 }); }); - // if (sDoubleSizeList && sDoubleSizeList.length) { - // const titles = ["首盒长", "首盒宽", "次盒长", "次盒宽"]; - // sDoubleSizeList.forEach((x, i) => { - // boxList.push({ - // value: x, - // sName: titles[i], - // isEditable: true, - // isSelect: false, - // selectValue: null, - // selectLabel: "", - // selectImage: null, - // type: null, - // show: true, - // showName: titles[i], // 参数名称 - // }); - // }); - // } + const svgProps = { ...this.props, boxList, @@ -1426,7 +1409,6 @@ export default class CommonComponent extends Component { dSvgBoxHeight: 100, showNew: 1, }; - return (
diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index a44a58c..c1666d5 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -31,7 +31,7 @@ import { import { Icon as LegacyIcon } from '@ant-design/compatible'; // import '@ant-design/compatible/assets/index.css'; import lodash from 'lodash'; -import { Table, Input, Checkbox, Button, Upload, message, Popover, Spin, Space, Form, Tooltip, Row, Progress,Modal, Col, Pagination } from 'antd-v4'; +import { Table, Input, Checkbox, Button, Upload, message, Popover, Spin, Space, Form, Tooltip, Row, Progress, Modal, Col, Pagination } from 'antd-v4'; import { DndProvider, DropTarget, DragSource } from 'react-dnd'; import { sortableContainer, @@ -126,10 +126,10 @@ const BodyRow = (props) => { // DragSource 拖拽事件的方法对象 const rowSource = { beginDrag(props) { - const dragingKey = props["data-row-key"] + const dragingKey = props["data-row-key"] dragingIndex = props.index; return { - 'data-row-key':dragingKey, + 'data-row-key': dragingKey, index: props.index, } // dragingIndex = props.index; @@ -148,7 +148,7 @@ const rowTarget = { if (dragKey === hoverKey) { return; } - props.moveRow(dragIndex, hoverIndex,dragKey,hoverKey); + props.moveRow(dragIndex, hoverIndex, dragKey, hoverKey); monitor.getItem().index = hoverIndex; monitor.getItem()["data-row-key"] = hoverKey; }, @@ -183,11 +183,11 @@ class CommonTableRc extends React.Component { totalData1: [], /* 总计数据1 */ enabled: false, /* 是否为编辑 */ filteredValue: [], /* 过滤数据值 */ - expKeys:[], /* 展开数据行(数据格式:数组) */ + expKeys: [], /* 展开数据行(数据格式:数组) */ showimgs: false, // 必须字段控制弹框显示隐藏 firstIndex: 0, // 点击时默认下标 - commonPopupVisible:false, - commonFieldPopupVisible:false, + commonPopupVisible: false, + commonFieldPopupVisible: false, openNewTabFlag: false, // 是否因在弹窗中打开新页签离开本页; randomId: commonUtils.createSid(), realizeHeight: 0, @@ -195,7 +195,7 @@ class CommonTableRc extends React.Component { commonFileDownloadVisible: false, // 多文件下载弹窗 commonFileDownloadList: [], // 多文件列表 pdfFileVisible: false, // pdf文件弹窗 - bOperateMoreVisible : false, /* 复制更多弹窗 */ + bOperateMoreVisible: false, /* 复制更多弹窗 */ pdfFileUrl: '', currentHoverSid: '', simpleModalVisible: false, @@ -292,20 +292,20 @@ class CommonTableRc extends React.Component { } document.addEventListener('mouseover', this.handleLastTdMouseOver); - + // 监听鼠标右击事件 this.mydiv.addEventListener('contextmenu', this.handleContextMenu); } componentDidUpdate() { - if( + if ( this.props.app && this.props.app.currentPane && (this.props.app.currentPane.route.indexOf('commonList') !== -1 - || - this.props.app.currentPane.route.indexOf('productionScheduleTree') !== -1) + || + this.props.app.currentPane.route.indexOf('productionScheduleTree') !== -1) ) { if (this.tableHeight !== '100%' && this.tableHeight !== 0) { if (this.props.name !== 'report') { - this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = this.tableHeight ? this.tableHeight + 'px': 80 + 'px'; + this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = this.tableHeight ? this.tableHeight + 'px' : 80 + 'px'; } } } @@ -437,7 +437,7 @@ class CommonTableRc extends React.Component { oResizable.style.cursor = 'col-resize'; const tempDom = document.createElement('div'); const mask = document.createElement('div'); - mask.style= "position: absolute; width: 100%; height: 100%; left: 0; top: 0; z-index: 9999;" + mask.style = "position: absolute; width: 100%; height: 100%; left: 0; top: 0; z-index: 9999;" const resizableMousemove = (e) => { const { clientX } = e; const left = Math.min(Math.max(minLeft, clientX), maxLeft + 200); @@ -504,7 +504,7 @@ class CommonTableRc extends React.Component { } } oResizable.onmousedown = () => { - const { y, height } = event.target.getBoundingClientRect(); + const { y, height } = event.target.getBoundingClientRect(); minLeft = event.target.parentNode.getBoundingClientRect().x + 50; maxLeft = event.target.parentNode.getBoundingClientRect().x + event.target.parentNode.getBoundingClientRect().width; Object.assign(tempDom.style, { @@ -525,7 +525,7 @@ class CommonTableRc extends React.Component { document.addEventListener('mousemove', resizableMousemove); }; } - } catch (error) {} + } catch (error) { } } /** 列拖动s */ @@ -553,7 +553,7 @@ class CommonTableRc extends React.Component { width: column.width, onResize: !bNotResize ? this.handleResize(index, column, isSlaveInfo) : null, bnotresize: bNotResize ? 'bNotResize' : null, - onClick: () => {}, + onClick: () => { }, onMouseDown: () => { if (this.lastTdMouseOver) { return; @@ -836,7 +836,7 @@ class CommonTableRc extends React.Component { const oDiv = { 'span': target.parentNode, 'td': target.childNodes[0].childNodes[0], - 'div': target.getAttribute('data-name') ? target : target.childNodes[0], + 'div': target.getAttribute('data-name') ? target : target.childNodes[0], }[tagName.toLowerCase()]; if (!oDiv) return; @@ -848,7 +848,7 @@ class CommonTableRc extends React.Component { } - onRowMouseEnter= (record) => { // recor + onRowMouseEnter = (record) => { // recor if (this.props.enabled && this.props.tableBelone !== 'list' && commonUtils.isNotEmptyObject(this.props.tableProps) && !this.beSelectDropdownOpen && commonUtils.isEmptyObject(this.props.tableProps.rowSelection) && this.state.currentHoverSid !== record.sId) { if (this.timerSelectRowChange) { @@ -864,7 +864,7 @@ class CommonTableRc extends React.Component { } } - onRowMouseLeave= () => { + onRowMouseLeave = () => { if (this.timerSelectRowChange) { this.setState({ currentHoverSid: '', @@ -879,7 +879,7 @@ class CommonTableRc extends React.Component { /** 行选择 */ onRowClick = (record, index, type, name, tabType) => { if (this.handleCellClick(record)) return; - + if (this.stopRowClick) { this.stopRowClick = false; return; @@ -1010,11 +1010,11 @@ class CommonTableRc extends React.Component { } else if (e.ctrlKey && e.keyCode === 65) { console.log('全选成功!'); } else if (e.ctrlKey && (e.altKey || e.metaKey) && e.keyCode === 71) { /* CTRL+ALT+G F7 设置界面 */ - const {name, config, data, configName } = this.props; - const { sType } = this.props?.app?.userinfo || {}; - if (!['sysadmin'].includes(sType)) { - return; - } + const { name, config, data, configName } = this.props; + const { sType } = this.props?.app?.userinfo || {}; + if (!['sysadmin'].includes(sType)) { + return; + } if (commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.config) && commonUtils.isNotEmptyObject(this.props.data)) { const bInModal = (el) => { if (commonUtils.isEmpty(el) || commonUtils.isEmpty(el.classList)) { @@ -1110,13 +1110,13 @@ class CommonTableRc extends React.Component { allRowClassName = record.sColor; } else { if (commonUtils.isEmptyObject(allRowClassName) || commonUtils.isEmptyObject(allRowClassName.trim())) { /* 设置奇 偶行背景色 */ - allRowClassName = (index % 2 === 1) ? 'dark-record-row' : ''; + allRowClassName = (index % 2 === 1) ? 'dark-record-row' : ''; } } /* 如果行字段的sDivRow有值 则做成特殊样式 */ - if(commonUtils.isNotEmptyObject(record) && commonUtils.isNotEmptyObject(record.sDivRowNew) && record.bInsert) { + if (commonUtils.isNotEmptyObject(record) && commonUtils.isNotEmptyObject(record.sDivRowNew) && record.bInsert) { allRowClassName = 'split-record-row'; - if (this.props.skipSlaveInfo){ + if (this.props.skipSlaveInfo) { allRowClassName = 'split-record-row-skip'; } } @@ -1200,24 +1200,24 @@ class CommonTableRc extends React.Component { const fileType = fileName.split('.').pop().toLowerCase(); const previewFileList = ['jpg', 'png', 'jepg', 'webp', 'svg', 'bmp', 'apng', 'pdf']; return
- { - if (fileType === 'pdf') { - this.setState({ - pdfFileVisible: true, - pdfFileUrl: fileList[0], - }); - } else { - this.handlePreviewImage(e, fileList); - } - }} title="预览"> - - {fileName} -
+ { + if (fileType === 'pdf') { + this.setState({ + pdfFileVisible: true, + pdfFileUrl: fileList[0], + }); + } else { + this.handlePreviewImage(e, fileList); + } + }} title="预览"> + + {fileName} +
} else { return { this.setState({ commonFileDownloadVisible: true, - commonFileDownloadList: fileList.map(item => {return { url: item, checked: false }}), + commonFileDownloadList: fileList.map(item => { return { url: item, checked: false } }), }) }} >{`附件(${fileList.length})`}; @@ -1228,12 +1228,12 @@ class CommonTableRc extends React.Component { if (commonUtils.isNotEmptyArr(sMakeUpPath)) { sMakeUpPath.forEach(item => { item.render = (value = '', record) => { - const { formId, name, enabled } = this.props; - const { token } = this.props.app; + const { formId, name, enabled, config } = this.props; + const { token } = this.props.app; const divProps = { action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`, onChange: (info) => { - this.handleUploadChange(info, () => {}); + this.handleUploadChange(info, () => { }); const savePathStr = info?.file?.response?.dataset?.rows?.[0]?.savePathStr; this.props.onDataChange(name, item.dataIndex, { [item.dataIndex]: savePathStr }, record.sId, []); }, @@ -1254,32 +1254,48 @@ class CommonTableRc extends React.Component { }) } }; - + const removeExtension = (filename) => { + const lastDotIndex = filename.lastIndexOf('.'); + if (lastDotIndex === -1) { + // 如果字符串中没有点,则返回原字符串 + return filename; + } + return filename.substring(0, lastDotIndex); + } + const getImageUrl = (sName) => { + const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`; + return imageUrlNew + } const picAddr = commonUtils.isNotEmptyObject(value) ? value.split(',') : ''; - const dataUrl = picAddr[0].includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */ - + let dataUrl = picAddr[0].includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */ + if (config.sTbName === "sisboxcomponent") { + dataUrl = getImageUrl(removeExtension(picAddr[0])); + } + // const picAddr = commonUtils.isNotEmptyObject(value) ? value.split(',') : ''; + // const dataUrl = picAddr[0].includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */ + const officeFileTypeList = ['PDF', 'DOCX', 'XLSX', 'MP4', 'WEBM', 'OGG']; const imgTypeList = ['PNG', 'SVG', 'JPG', 'JPEG', 'GIF', 'BMP', 'TIFF', 'ICO']; const officeFileType = picAddr[0].split('.').pop().toUpperCase(); - let fileIcon = ; - + let fileIcon = ; + if (officeFileType === 'DOCX') { - fileIcon = ; + fileIcon = ; } else if (officeFileType === 'XLSX') { - fileIcon = ; + fileIcon = ; } else if (['MP4', 'WEBM', 'OGG'].includes(officeFileType)) { - fileIcon = ; + fileIcon = ; } - + let imgBox = ; - + if (officeFileTypeList.includes(officeFileType)) { imgBox = fileIcon; } else if (imgTypeList.includes(officeFileType)) { imgBox = img 0} onClick={e => this.handlePreviewImage(e, picAddr)} style={{ width: '30px', height: '20px' }} />; } - return imgBox; + return imgBox; }) } { @@ -1341,9 +1357,9 @@ class CommonTableRc extends React.Component { } } return ( -
+
{commonUtils.isNotEmptyObject(t.sProcessName) ? t.sProcessName : ''} - { i + 1 === sPartItemLength ? '' : } + {i + 1 === sPartItemLength ? '' : }
); }) @@ -1385,9 +1401,9 @@ class CommonTableRc extends React.Component { } } return ( -
+
{commonUtils.isNotEmptyObject(t.sProcessName) ? t.sProcessName : ''} - { i + 1 === sPartItemLength ? '' : } + {i + 1 === sPartItemLength ? '' : }
); }) @@ -1415,9 +1431,9 @@ class CommonTableRc extends React.Component { const ArrItemTime = t.split('#')[4]; /* 排单时间 */ const ArrItemPCNum = t.split('#')[5]; /* 排程数 */ const ArrItemSBNum = t.split('#')[6]; /* 上报数 */ - const ArrItem7Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 8 ? t.split('#')[8] : ''; /* 包数 */ - const ArrItem8Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 9 ? t.split('#')[9]: ''; /* 每包数量 */ - const ArrItem9Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 10 ? t.split('#')[10]: ''; /* 零头数量 */ + const ArrItem7Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 8 ? t.split('#')[8] : ''; /* 包数 */ + const ArrItem8Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 9 ? t.split('#')[9] : ''; /* 每包数量 */ + const ArrItem9Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 10 ? t.split('#')[10] : ''; /* 零头数量 */ let ArrItemNumChange = ''; let icon; // eslint-disable-next-line default-case @@ -1458,13 +1474,13 @@ class CommonTableRc extends React.Component {
排程数:{ArrItemPCNum}
上报数:{ArrItemSBNum}
{ - ArrItem7Num ?
包数:{ArrItem7Num}
:'' + ArrItem7Num ?
包数:{ArrItem7Num}
: '' } { - ArrItem8Num ?
每包数量:{ArrItem8Num}
:'' + ArrItem8Num ?
每包数量:{ArrItem8Num}
: '' } { - ArrItem9Num ?
零头数量:{ArrItem9Num}
:'' + ArrItem9Num ?
零头数量:{ArrItem9Num}
: '' }
); @@ -1514,7 +1530,7 @@ class CommonTableRc extends React.Component { } } return ( - { + { return
{ // eslint-disable-next-line array-callback-return; @@ -1546,12 +1562,12 @@ class CommonTableRc extends React.Component { } } return ( -
+
{commonUtils.isNotEmptyObject(t.sMaterialsName) ? - {t.sMaterialsName} - : ''} - { i + 1 === sPartItemLength ? '' : -} + {t.sMaterialsName} + : ''} + {i + 1 === sPartItemLength ? '' : -}
); }) @@ -1589,12 +1605,12 @@ class CommonTableRc extends React.Component { } } return ( -
+
{commonUtils.isNotEmptyObject(t.sMaterialsName) ? - {t.sMaterialsName} - : ''} - { i + 1 === sPartItemLength ? '' : -} + {t.sMaterialsName} + : ''} + {i + 1 === sPartItemLength ? '' : -}
); }) @@ -1624,8 +1640,8 @@ class CommonTableRc extends React.Component { } } return ( - { - return
+ { + return
{ // eslint-disable-next-line array-callback-return; sPartItem.map((t, i) => { @@ -1656,12 +1672,12 @@ class CommonTableRc extends React.Component { } } return ( -
+
{commonUtils.isNotEmptyObject(t.sMaterialsName) ? - {t.sMaterialsName} - : ''} - { i + 1 === sPartItemLength ? '' : -} + {t.sMaterialsName} + : ''} + {i + 1 === sPartItemLength ? '' : -}
); }) @@ -1699,12 +1715,12 @@ class CommonTableRc extends React.Component { } } return ( -
+
{commonUtils.isNotEmptyObject(t.sMaterialsName) ? - {t.sMaterialsName} - : ''} - { i + 1 === sPartItemLength ? '' : -} + {t.sMaterialsName} + : ''} + {i + 1 === sPartItemLength ? '' : -}
); }) @@ -1713,7 +1729,7 @@ class CommonTableRc extends React.Component { ); } else { - return
{itemStr}
; + return
{itemStr}
; } }; } @@ -1725,13 +1741,13 @@ class CommonTableRc extends React.Component { if (commonUtils.isNotEmptyArr(dynamicColumn) && commonUtils.isNotEmptyArr(dataSource)) { dynamicColumn.forEach((jsonStatus, index) => { if (commonUtils.isNotEmptyArr(jsonStatus.children)) { /* 嵌套列头JSON解析 */ - const childrenJson = jsonStatus.children.filter(itemChild=> itemChild.dataIndex && itemChild.dataIndex.includes('json')); + const childrenJson = jsonStatus.children.filter(itemChild => itemChild.dataIndex && itemChild.dataIndex.includes('json')); for (const obj of childrenJson) { obj.render = (itemStr) => { if (commonUtils.isNotEmptyObject(itemStr) && commonUtils.isJSON(itemStr)) { const sPartItem = JSON.parse(itemStr); return ( -
+
{ // eslint-disable-next-line array-callback-return; sPartItem.map((t, i) => { @@ -1757,7 +1773,7 @@ class CommonTableRc extends React.Component { return (
{t.dSchedulHours}
@@ -1823,7 +1839,7 @@ class CommonTableRc extends React.Component { const sPartItem = JSON.parse(itemStr); const linkStyle = 'sTimeStatusStyle';/* 弹窗 */ return ( -
+
{ // eslint-disable-next-line array-callback-return; sPartItem.map((t, i) => { @@ -1841,7 +1857,7 @@ class CommonTableRc extends React.Component {
@@ -1869,7 +1885,7 @@ class CommonTableRc extends React.Component { const { sState, sColor = '#000000', sName = '' } = t; return (
- {sName}{ i + 1 === itemLength ? '' : } + {sName}{i + 1 === itemLength ? '' : }
); }) @@ -1884,11 +1900,11 @@ class CommonTableRc extends React.Component { lineHeight: '29px', textOverflow: 'ellipsis' }}> - { - return
{content}
- }}> - {content} -
+ { + return
{content}
+ }}> + {content} +
); } @@ -1903,16 +1919,16 @@ class CommonTableRc extends React.Component { } let bPagination = true; /* 默认表格分页s */ if (commonUtils.isNotEmptyObject(this.props)) { - bPagination = (commonUtils.isNotEmptyObject(this.props.tableProps) && commonUtils.isNotEmptyObject(this.props.tableProps.pagination)); + bPagination = (commonUtils.isNotEmptyObject(this.props.tableProps) && commonUtils.isNotEmptyObject(this.props.tableProps.pagination)); } let noVlistController = false; - if(this.props.config && this.props.config.gdsconfigformslave.filter(item => item.sControlName === 'bNoVlist')[0]) { + if (this.props.config && this.props.config.gdsconfigformslave.filter(item => item.sControlName === 'bNoVlist')[0]) { noVlistController = true; } /* 特殊情况的表格 在虚拟列表情况 会无法滑动 */ let noVlistTable = false; - if(this.props.noVlistTable) { + if (this.props.noVlistTable) { noVlistTable = true; } // 判断是否有合并单元格, 有的话默认关闭虚拟滚动 @@ -1937,18 +1953,20 @@ class CommonTableRc extends React.Component { oBody && (oBody.scrollTop = 0); } window.vlistNewSearh = null; - this.Vcomponents = VListNew({height: this.scrollY, vid: this.uniqueId, onScroll: () => { - setTimeout(() => { - let divs = document.getElementsByClassName('noInputInsert'); - if (divs.length) { - Array.prototype.forEach.call(divs, item => { - item.parentNode.parentNode.parentNode.parentNode.classList.add('insertTd'); - }); - } - }, 20); - }}); + this.Vcomponents = VListNew({ + height: this.scrollY, vid: this.uniqueId, onScroll: () => { + setTimeout(() => { + let divs = document.getElementsByClassName('noInputInsert'); + if (divs.length) { + Array.prototype.forEach.call(divs, item => { + item.parentNode.parentNode.parentNode.parentNode.classList.add('insertTd'); + }); + } + }, 20); + } + }); } - components = {...this.Vcomponents, ...components}; + components = { ...this.Vcomponents, ...components }; } else { // vid是多个列表在同个页面中,同时渲染会促发问题 // vid不可以为随机数,随机数会导致双击时,点击的两个VList id不同 @@ -1963,23 +1981,25 @@ class CommonTableRc extends React.Component { oBody && (oBody.scrollTop = 0); } window.vlistNewSearh = null; - this.Vcomponents1 = VList({ height: this.scrollY, vid: this.uniqueId, rowKey: this.rowKey, onScroll: () => { - setTimeout(() => { - let divs = document.getElementsByClassName('noInputInsert'); - if (divs.length) { - Array.prototype.forEach.call(divs, item => { - item.parentNode.parentNode.parentNode.parentNode.classList.add('insertTd'); - }); - } - }, 20); - } }); + this.Vcomponents1 = VList({ + height: this.scrollY, vid: this.uniqueId, rowKey: this.rowKey, onScroll: () => { + setTimeout(() => { + let divs = document.getElementsByClassName('noInputInsert'); + if (divs.length) { + Array.prototype.forEach.call(divs, item => { + item.parentNode.parentNode.parentNode.parentNode.classList.add('insertTd'); + }); + } + }, 20); + } + }); } components = { ...this.Vcomponents1, ...components }; } } if (this.props.config && this.props.config.iFreezeColumn) { tableColumn.forEach((val, index) => { - if(tableColumn[index].fixedHelp) { + if (tableColumn[index].fixedHelp) { tableColumn[index].fixed = false; tableColumn[index].fixedHelp = false; } @@ -1991,14 +2011,14 @@ class CommonTableRc extends React.Component { } // 处理拖拽排序 if (this.props.dragHandle) { - const handleSortTitle = commonFunc.showMessage(this.props.app.commonConst, 'sort') || '排序' ; + const handleSortTitle = commonFunc.showMessage(this.props.app.commonConst, 'sort') || '排序'; const handleSort = tableColumn.filter(item => item.dataIndex === 'handleSort').length; if (tableColumn[0]) { function arrayMoveMutable(array, fromIndex, toIndex) { const startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex; if (startIndex >= 0 && startIndex < array.length) { const endIndex = toIndex < 0 ? array.length + toIndex : toIndex; - if(commonUtils.isNotEmptyObject(array[fromIndex].sWorkOrderUsed)) { + if (commonUtils.isNotEmptyObject(array[fromIndex].sWorkOrderUsed)) { message.error(array[fromIndex].sWorkOrderUsed); return; } @@ -2034,11 +2054,11 @@ class CommonTableRc extends React.Component { const { dataSource } = this.state; // function findIndex base on Table rowKey props and should always be a right array index const index = dataSource.findIndex(x => x.index === restProps['data-row-key']); - return ; + return ; }; // 处理渲染后丢失input focus的bug. let bDrag = this.props.enabled && !this.props.bForbiddenDrag;/* 是否可以拖动 */ - if(bDrag) { + if (bDrag) { if (!this.DraggableContainer) { this.DraggableContainer = DraggableContainer; } @@ -2046,10 +2066,10 @@ class CommonTableRc extends React.Component { this.DraggableBodyRow = DraggableBodyRow; } } - if(!handleSort) { - components = {...components, body: {wrapper: this.DraggableContainer, row: this.DraggableBodyRow}}; + if (!handleSort) { + components = { ...components, body: { wrapper: this.DraggableContainer, row: this.DraggableBodyRow } }; } else { - components = {...components, body: {wrapper: this.DraggableContainer, row: this.DraggableBodyRow}}; + components = { ...components, body: { wrapper: this.DraggableContainer, row: this.DraggableBodyRow } }; tableColumn.shift(); } tableColumn.unshift( @@ -2103,8 +2123,8 @@ class CommonTableRc extends React.Component { onMouseEnter: () => { this.onRowMouseEnter(record); }, onMouseLeave: () => { this.onRowMouseLeave(record); }, onDoubleClick: () => { this.onDoubleClick(this.props.name, record); }, - moveRow: (dragIndex, hoverIndex,dragKey,hoverKey) => { - this.moveRow(dragIndex, hoverIndex,dragKey,hoverKey); + moveRow: (dragIndex, hoverIndex, dragKey, hoverKey) => { + this.moveRow(dragIndex, hoverIndex, dragKey, hoverKey); }, onDragClick: (type) => { this.onRowClick(record, index, type, this.props.name, 'slave'); }, }; @@ -2232,8 +2252,8 @@ class CommonTableRc extends React.Component { onDoubleClick: () => { this.onDoubleClick(record, index, undefined, slaveInfoName, 'slaveInfo'); }, - moveRow: (dragIndex, hoverIndex,dragKey,hoverKey) => { - this.moveRow(dragIndex, hoverIndex,dragKey,hoverKey); + moveRow: (dragIndex, hoverIndex, dragKey, hoverKey) => { + this.moveRow(dragIndex, hoverIndex, dragKey, hoverKey); }, onDragClick: (type) => { this.onRowClick(record, index, type, slaveInfoName, 'slaveInfo'); @@ -2271,8 +2291,8 @@ class CommonTableRc extends React.Component { } else { filterData = dataSource.length; } - if(commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sZczlxShowName)) { - if(masterData.sZczlxShowName === '删除' || masterData.sZczlxShowName === '恢复'){ + if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sZczlxShowName)) { + if (masterData.sZczlxShowName === '删除' || masterData.sZczlxShowName === '恢复') { filterData += 1; } } @@ -2299,7 +2319,7 @@ class CommonTableRc extends React.Component { if (isSlaveInfo && commonUtils.isNotEmptyObject(this.props.slaveInfo) && commonUtils.isNotEmptyObject(this.props.slaveInfo.config)) { const showConfigArr = this.props.slaveInfo.config.gdsconfigformslave.filter(item => item.sName === sName && item.bVisible); if (commonUtils.isNotEmptyArr(showConfigArr)) { - showConfig = showConfigArr[0]; + showConfig = showConfigArr[0]; } } @@ -2377,11 +2397,11 @@ class CommonTableRc extends React.Component { } if (isRow && isRowShow && !commonUtils.isEmpty(record[column]) && commonUtils.isNotEmptyObject(record[column].toString())) { /* 配置行 */ let { conditionValue: conditionValueOld } = item; - const conditionValue = record[conditionValueOld] ? record[conditionValueOld]: conditionValueOld; + const conditionValue = record[conditionValueOld] ? record[conditionValueOld] : conditionValueOld; if (condition === '=') { - if(commonUtils.isNotEmptyObject(conditionValue) && conditionValue.includes('#')) { - const sXName = conditionValue.replace('#','').replace('#','').trim(); - if(sXName && commonUtils.isNotEmptyObject(this.props[sXName])) { + if (commonUtils.isNotEmptyObject(conditionValue) && conditionValue.includes('#')) { + const sXName = conditionValue.replace('#', '').replace('#', '').trim(); + if (sXName && commonUtils.isNotEmptyObject(this.props[sXName])) { const sXValue = this.props[sXName]; styleColor = record[column] === sXValue ? `SetRow_${color} color${color.replace('#', '-')}` : ''; } @@ -2449,7 +2469,7 @@ class CommonTableRc extends React.Component { } = item; if (!isRow) { /* 根据配置设置单元格颜色 */ let { conditionValue: conditionValueOld } = item; - const conditionValue = record[conditionValueOld] ? record[conditionValueOld]: conditionValueOld; + const conditionValue = record[conditionValueOld] ? record[conditionValueOld] : conditionValueOld; if (column === sName && (column === showConfig.sName || showConfig.sControlName?.startsWith('canOtherConfig'))) { /* 只控制该配置的单元格 */ if (condition === '=') { styleColor = record[column] === conditionValue ? color : ''; @@ -2478,13 +2498,13 @@ class CommonTableRc extends React.Component { styleColor = record[column] <= conditionValue ? color : ''; styleBackground = record[column] <= conditionValue ? background : ''; } else if (Array.isArray(condition)) { /* 通过其他列条件控制该字段的颜色显示 */ - if(commonUtils.isNotEmptyArr(condition)) { + if (commonUtils.isNotEmptyArr(condition)) { for (const itemConditon of condition) { const { bFilterName, bFilterCondition, color, background, } = itemConditon; let { bFilterValue: bFilterValueOld } = itemConditon; - const bFilterValue = record[bFilterValueOld] ? record[bFilterValueOld]: bFilterValueOld; + const bFilterValue = record[bFilterValueOld] ? record[bFilterValueOld] : bFilterValueOld; if (bFilterCondition === '=') { styleColor = record[bFilterName] === bFilterValue ? color : ''; styleBackground = record[bFilterName] === bFilterValue ? background : ''; @@ -2495,7 +2515,7 @@ class CommonTableRc extends React.Component { } } else if (bFilterCondition === '!=') { styleColor = record[bFilterName] !== bFilterValue ? color : ''; - styleBackground = record[bFilterName] !== bFilterValue ? background : ''; + styleBackground = record[bFilterName] !== bFilterValue ? background : ''; } else if (bFilterCondition === '>') { styleColor = record[bFilterName] > bFilterValue ? color : ''; styleBackground = record[bFilterName] > bFilterValue ? background : ''; @@ -2516,10 +2536,10 @@ class CommonTableRc extends React.Component { } styleColorArr += styleColor; styleColorArrB += styleBackground; - if(styleColor) { + if (styleColor) { styleColorArr = styleColor; } - if(styleBackground) { + if (styleBackground) { styleColorArrB = styleBackground; } } @@ -2593,10 +2613,10 @@ class CommonTableRc extends React.Component { result = false; } /* 若红冲单据 则按钮锁定 不能操作 */ - if(commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sMinusSrcId) && masterData.sMinusType === '1') { + if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sMinusSrcId) && masterData.sMinusType === '1') { result = false; } - if(btnName === 'BtnAdd' && bLimitOperate){ + if (btnName === 'BtnAdd' && bLimitOperate) { result = false; } @@ -2699,25 +2719,25 @@ class CommonTableRc extends React.Component { } /* 工单、工艺卡、报价单 去掉排序 */ - if (this.props.name === 'sParam' || specialRoute.includes('workOrder') || specialRoute.includes('processCard') || specialRoute.includes('quotation')) { + if (this.props.name === 'sParam' || specialRoute.includes('workOrder') || specialRoute.includes('processCard') || specialRoute.includes('quotation')) { sorter = false; } /* 默认字段是排序的 通过配置bNotSort来设置字段不排序 */ if (config && commonUtils.isNotEmptyStr(config.gdsconfigformslave.filter(item => item.sName === column.dataIndex))) { - if(config.gdsconfigformslave.filter(item => item.sName === column.dataIndex).length > 0 && config.gdsconfigformslave.filter(item => item.sName === column.dataIndex)[0].bNotSort){ + if (config.gdsconfigformslave.filter(item => item.sName === column.dataIndex).length > 0 && config.gdsconfigformslave.filter(item => item.sName === column.dataIndex)[0].bNotSort) { sorter = false; } } if (config && commonUtils.isNotEmptyStr(config.gdsconfigformslave.filter(item => item.sName === column.dataIndex))) { - if(config.gdsconfigformslave.filter(item => item.sName === column.dataIndex)[0].bNotSearch){ + if (config.gdsconfigformslave.filter(item => item.sName === column.dataIndex)[0].bNotSearch) { search = false; } } if (column.dataIndex === "spicture" || column.dataIndex === "tableLastEmpty") { sorter = false; } - let sTitleBgColor =commonUtils.isNotEmptyObject(column.sTitleBgColor) ? column.sTitleBgColor : ''; /* 标题背景颜色 */ - let sTitleColor =commonUtils.isNotEmptyObject(column.sTitleColor) ? column.sTitleColor : ''; /* 标题字体颜色 */ + let sTitleBgColor = commonUtils.isNotEmptyObject(column.sTitleBgColor) ? column.sTitleBgColor : ''; /* 标题背景颜色 */ + let sTitleColor = commonUtils.isNotEmptyObject(column.sTitleColor) ? column.sTitleColor : ''; /* 标题字体颜色 */ const styleObj = {}; if (commonUtils.isNotEmptyObject(sTitleBgColor)) { styleObj.background = sTitleBgColor; @@ -2753,7 +2773,7 @@ class CommonTableRc extends React.Component {
); } else { res = (
this.onKeyDownDiv(e, sName)} onCut={e => e.preventDefault()} onPaste={e => e.preventDefault()} suppressContentEditableWarning contentEditable="true" onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null} - > {sValue} + > {sValue} } - {bShow}{imgBox}{this.handleGetFastSearchBtn({record, sName, isSlaveInfo})} + {bShow}{imgBox}{this.handleGetFastSearchBtn({ record, sName, isSlaveInfo })}
); } const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo); return cell; - } else if ( commonUtils.isNotEmptyObject(showConfigObj) && !showConfigObj.bReadonly && (props.enabled || showConfigObj.iTag === 3 ) + } else if (commonUtils.isNotEmptyObject(showConfigObj) && !showConfigObj.bReadonly && (props.enabled || showConfigObj.iTag === 3) && commonUtils.isEmptyObject(record.sDivRowNew) && (commonUtils.isNotEmptyArr(props.selectedRowKeys) && props.selectedRowKeys.toString().includes(record.sId) || props.name === 'sParam' - || ( props.name ==='slaveInfo' && commonUtils.isNotEmptyArr(props.selectedRowKeys) && props.selectedRowKeys.toString().includes(record.sSlaveId) && showConfigObj.iTag === 3 )) + || (props.name === 'slaveInfo' && commonUtils.isNotEmptyArr(props.selectedRowKeys) && props.selectedRowKeys.toString().includes(record.sSlaveId) && showConfigObj.iTag === 3)) || (this.getShowTypeProps(props, text, record, sName)?.enabled && record.sId === this.state.currentHoverSid) || (false && location.pathname.includes('productionScheduleTree') && this.getShowTypeProps(props, text, record, sName)?.enabled && record.sId === props.rowHoverSid) || (props.rootType === 'list' && props.selectedRowKeys.toString().includes(record.sSlaveId))) { @@ -5594,7 +5614,7 @@ class CommonTableRc extends React.Component { let backgroundColor = ''; if (commonUtils.isNotEmptyArr(showConfig)) { const cellStyle = this.getCellColorConfig(text, record, sName); - if (commonUtils.isNotEmptyObject(cellStyle.styleColorArrTotal) || commonUtils.isNotEmptyObject(cellStyle.styleColorArrTotalB) ) { + if (commonUtils.isNotEmptyObject(cellStyle.styleColorArrTotal) || commonUtils.isNotEmptyObject(cellStyle.styleColorArrTotalB)) { cellColor = cellStyle.styleColorArrTotal; backgroundColor = cellStyle.styleColorArrTotalB; } @@ -5619,27 +5639,27 @@ class CommonTableRc extends React.Component { /* 取小数点位数 */ let point = 0; let strIndex = sDateFormat.indexOf('.'); - if(strIndex > -1 && sDateFormat.length > 1) { + if (strIndex > -1 && sDateFormat.length > 1) { point = sDateFormat.substring(strIndex + 1, sDateFormat.length).length; - if(commonUtils.isNotEmptyNumber(sValue) && sValue !== null) { + if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) { const dConfigResult = commonUtils.convertFixNum(Number(sValue), point).toFixed(point); - if(!isNaN(dConfigResult)) { + if (!isNaN(dConfigResult)) { sValue = dConfigResult; } } } } else { if (firstDataIndex === 'd' && sName.toLowerCase().endsWith('price')) { /* 列表单价格式化显示 */ - if(commonUtils.isNotEmptyNumber(sValue) && sValue !== null) { + if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) { const dResult = commonUtils.convertFixNum(Number(sValue), dNetPrice).toFixed(dNetPrice); - if(!isNaN(dResult)) { + if (!isNaN(dResult)) { sValue = dResult; } } } else if (firstDataIndex === 'd' && sName.toLowerCase().endsWith('money')) { /* 列表金额格式化显示 */ - if(commonUtils.isNotEmptyNumber(sValue) && sValue !== null) { + if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) { const dResult = commonUtils.convertFixNum(Number(sValue), dNetMoney).toFixed(dNetMoney); - if(!isNaN(dResult)) { + if (!isNaN(dResult)) { sValue = dResult; } } @@ -5656,7 +5676,7 @@ class CommonTableRc extends React.Component { if (typeof showConfig.showDropDown === 'object') { showDropDown = showConfig.showDropDown; } else { - if(commonUtils.isJSON(showConfig.showDropDown)) { + if (commonUtils.isJSON(showConfig.showDropDown)) { showDropDown = commonUtils.objectToArr(commonUtils.convertStrToObj(showConfig.showDropDown)); } } @@ -5669,11 +5689,11 @@ class CommonTableRc extends React.Component { let clickEvent = ''; /* 选择合版产品弹窗 */ const sModelsType = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? props.app.currentPane.sModelsType : ''; - const combinedInfo = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? commonFunc.showMessage(props.app.commonConst, 'CombinedInfo') : '合版信息' ; + const combinedInfo = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? commonFunc.showMessage(props.app.commonConst, 'CombinedInfo') : '合版信息'; - const pleaseSelect = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'pleaseSelect') : '请选择' ; + const pleaseSelect = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'pleaseSelect') : '请选择'; - if (commonUtils.isNotEmptyObject(sName) && ( sName === 'sCombinedMemo' || sName ==='sCombineProductNameNew' || sName === 'sColorSerialMemo' || sName === 'sPositiveColor' || sName === 'sOppositeColor' || sName === 'sParams' || sName === 'sParamsNew'|| sName === 'sQuoParams' || (commonUtils.isNotEmptyObject(sModelsType) && !sModelsType.includes('Set') && sName === 'sCombinePartsNameNew'))) { + if (commonUtils.isNotEmptyObject(sName) && (sName === 'sCombinedMemo' || sName === 'sCombineProductNameNew' || sName === 'sColorSerialMemo' || sName === 'sPositiveColor' || sName === 'sOppositeColor' || sName === 'sParams' || sName === 'sParamsNew' || sName === 'sQuoParams' || (commonUtils.isNotEmptyObject(sModelsType) && !sModelsType.includes('Set') && sName === 'sCombinePartsNameNew'))) { linkStyle = 'linksActiveIdStyle'; clickEvent = 'onViewChoose'; if (sName === 'sCombinedMemo') { @@ -5716,7 +5736,7 @@ class CommonTableRc extends React.Component { sMemo = commonUtils.isNotEmptyObject(sMemo) ? sMemo.substr(0, sMemo.length - 1) : ''; sValue = sMemo; } - } else if (sName === 'sParams' || sName === 'sQuoParams' || sName === 'sParamsNew' ) { + } else if (sName === 'sParams' || sName === 'sQuoParams' || sName === 'sParamsNew') { if (props.onGetParamsValue) { // 页面自行处理sparams的sValue sValue = props.onGetParamsValue({ sName, sValue, record }); @@ -5737,7 +5757,7 @@ class CommonTableRc extends React.Component { let sParamStr = ''; if (commonUtils.isNotEmptyArr(JsonData)) { JsonData.forEach((item) => { - if(item.bSelfCbx) { + if (item.bSelfCbx) { const strValue = commonUtils.isNotEmptyObject(item.sParamValue) ? item.sParamValue : ''; sParamStr += `${item.sParamName}:${strValue},`; } @@ -5750,13 +5770,13 @@ class CommonTableRc extends React.Component { } } sValue = commonUtils.isEmpty(sValue) ? sName === 'sCombinedMemo' ? combinedInfo : pleaseSelect : sValue; - } else if ((!props.enabled) && sName.indexOf('Memo') > -1 && showConfigObj.iTag !== 3 ) { + } else if ((!props.enabled) && sName.indexOf('Memo') > -1 && showConfigObj.iTag !== 3) { linkStyle = 'linksActiveIdStyle'; clickEvent = 'onMemoShow'; sValue = commonUtils.isEmpty(sValue) ? '' : sValue; const regex = /<[^>]*>/g; sValue = sValue.replace(regex, ''); - } else if ((!props.enabled) && showConfigObj.sControlName && showConfigObj.sControlName.toLowerCase().indexOf('memo') > -1 && showConfigObj.iTag !== 3 ) { + } else if ((!props.enabled) && showConfigObj.sControlName && showConfigObj.sControlName.toLowerCase().indexOf('memo') > -1 && showConfigObj.iTag !== 3) { linkStyle = 'linksActiveIdStyle'; clickEvent = 'onMemoShow'; sValue = commonUtils.isEmpty(sValue) ? '' : sValue; @@ -5767,43 +5787,43 @@ class CommonTableRc extends React.Component { clickEvent = 'onOpenPopupModal'; } /* 如果列表行包含sDivRow并且sDivRow有值 则代表该行行不渲染数据 只做分割作用 */ - if(commonUtils.isNotEmptyObject(record.sDivRowNew) && record.bInsert) { + if (commonUtils.isNotEmptyObject(record.sDivRowNew) && record.bInsert) { bShow = ''; // linkStyle = 'linksActiveIdStyle'; - if(sValue) { + if (sValue) { const splitArr = sValue ? sValue.toString().split('F') : []; - if(commonUtils.isNotEmptyArr(splitArr) && splitArr.length > 1) { + if (commonUtils.isNotEmptyArr(splitArr) && splitArr.length > 1) { sValue = {splitArr[0]} {splitArr[1]} ; } } } - let showQty=''; - if(!this.props.enabled && location.pathname.includes('quotationPackTableTree') && this.props.name === 'control' && sName === 'dSinglePQty') { + let showQty = ''; + if (!this.props.enabled && location.pathname.includes('quotationPackTableTree') && this.props.name === 'control' && sName === 'dSinglePQty') { showQty = - } else if(sName === 'sSaveProName' || sName === 'sDeleteProName' || sName === 'sSaveProNameBefore' || sName === 'sProcName') { + } else if (sName === 'sSaveProName' || sName === 'sDeleteProName' || sName === 'sSaveProNameBefore' || sName === 'sProcName') { /* 增删改存业务处理 加查看眼睛 */ - sValue = {sValue} - }else if(sName === 'dNeedAuxiliaryQty' && showConfig.sControlName && showConfig.sControlName !=='slaveInfo' ) { /* 净需求 */ + sValue = {sValue} + } else if (sName === 'dNeedAuxiliaryQty' && showConfig.sControlName && showConfig.sControlName !== 'slaveInfo') { /* 净需求 */ /* 增删改存业务处理 加查看眼睛 */ - sValue = {sValue} + sValue = {sValue} } /* 只读字段置灰 */ const isColorInclude = this.rowColorData.current?.find(i => i && i?.key === record?.[this.rowKey]); let bReadonlyField = false; - if((showConfig.bReadonly || showConfig.iTag ===1) && commonUtils.isEmptyStr(backgroundColor) && !isColorInclude) { + if ((showConfig.bReadonly || showConfig.iTag === 1) && commonUtils.isEmptyStr(backgroundColor) && !isColorInclude) { backgroundColor = '#f1f2f8'; bReadonlyField = true; } - if (backgroundColor && !this.props.slaveInfo) { + if (backgroundColor && !this.props.slaveInfo) { this.hasSpanBgColor = true; } res = ( {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'b') || (imgBox !== '') ? '' : {commonUtils.isNotEmptyObject(specialTitle) ? specialTitle :sValue}} + title={{commonUtils.isNotEmptyObject(specialTitle) ? specialTitle : sValue}} > { sValue} + > {sValue} }{bShow}{imgBox}{showQty} ); @@ -6074,13 +6094,13 @@ class CommonTableRc extends React.Component { const productionRoute = (commonUtils.isNotEmptyObject(props.app.currentPane) && commonUtils.isNotEmptyObject(props.app.currentPane.route) && props.app.currentPane.route.includes('productionSchedule')); if (productionRoute) { /* 生产排程对选中行进行汇总 */ this.handleSumOtherColumn(props.config, props.data); - } else if(rootType === 'list') { - if(commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyArr(props.totalData)) { - const addState ={}; + } else if (rootType === 'list') { + if (commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyArr(props.totalData)) { + const addState = {}; addState.totalData = props.totalData; this.setState({ ...addState }) } - } else if(name ==='slaveChild'){ + } else if (name === 'slaveChild') { this.handleSumChildColumn(props.config, props.data); } else { this.handleSumAllColumn(props.config, props.data); @@ -6108,7 +6128,7 @@ class CommonTableRc extends React.Component { if (stateValue.tableColumn[index].children && stateValue.tableColumn[index].children.length) { const childrenSortArr = []; const childrenDataIndexArr = []; - item.children = item.children.map(child => { return {...child, ...{ sortIndex: sortArr.indexOf(child.dataIndex) }}}).sort(compare('sortIndex')); + item.children = item.children.map(child => { return { ...child, ...{ sortIndex: sortArr.indexOf(child.dataIndex) } } }).sort(compare('sortIndex')); item.children.forEach((child, childIndex) => { const currentSort = sortArr.indexOf(child.dataIndex); if (childIndex === 0) { @@ -6144,7 +6164,7 @@ class CommonTableRc extends React.Component { } }); stateValue.tableColumn = stateValue.tableColumn.filter(item => !item.delete); // 删除需要分割的双层表头 - stateValue.tableColumn = [ ...stateValue.tableColumn, ...addTableColumn ]; // 将分割后的双层表头加回去 + stateValue.tableColumn = [...stateValue.tableColumn, ...addTableColumn]; // 将分割后的双层表头加回去 stateValue.tableColumn = stateValue.tableColumn.sort(compare('sortIndex')); // 合并一级表头相同的相邻的column stateValue.tableColumn = stateValue.tableColumn.reduce((prev, cur) => { @@ -6197,7 +6217,7 @@ class CommonTableRc extends React.Component { const footerHeight = commonUtils.isNotEmptyArr(this.state.totalData1) ? 58 : 29; if (this.props.tableProps.AutoTableHeight) { this.scrollY = this.props.tableProps.AutoTableHeight; - this.tableHeight = this.props.tableProps.AutoTableHeight == '100%' ? '100%' : this.props.tableProps.AutoTableHeight + tableHeaderHeight + footerHeight; + this.tableHeight = this.props.tableProps.AutoTableHeight == '100%' ? '100%' : this.props.tableProps.AutoTableHeight + tableHeaderHeight + footerHeight; return; } @@ -6221,19 +6241,19 @@ class CommonTableRc extends React.Component { const tabHeight = 89; const paginationHeight = this.props.tableProps.pagination ? 60 : 0; let extraHeight = 0; /* 额外的区域 */ - if(commonUtils.isNotEmptyObject(location.pathname) && location.pathname.includes('commonListTab')) { /* 带Tab页签的列表 */ + if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.includes('commonListTab')) { /* 带Tab页签的列表 */ /* 有从表高度100,没有高度20 */ const hasSlave = document.getElementsByClassName('hasSlave'); - if(commonUtils.isNotEmptyArr(hasSlave)) { - extraHeight = 220; - }else { - extraHeight = 20; + if (commonUtils.isNotEmptyArr(hasSlave)) { + extraHeight = 220; + } else { + extraHeight = 20; } } if (this.props?.masterConfig?.sTableColorTs) { extraHeight += this.colorInfo?.getBoundingClientRect()?.height || 80; - if(location.pathname?.includes('productionScheduleTree')) { + if (location.pathname?.includes('productionScheduleTree')) { extraHeight -= 34; } } else { @@ -6563,7 +6583,7 @@ class CommonTableRc extends React.Component { message.warning('请确认复制的内容是文件类型!'); } }; - handleGetFastSearchBtn = ({record, sName, isSlaveInfo}) => { + handleGetFastSearchBtn = ({ record, sName, isSlaveInfo }) => { if (isSlaveInfo || !sName.startsWith('s') || this.props.name !== 'slave') { return ''; } @@ -6705,9 +6725,9 @@ class CommonTableRc extends React.Component { } } /* 拖拽改变对应层级 */ - moveRow = (dragIndex, hoverIndex,dragKey,hoverKey) => { - if(this.props.onMoveRow) { - this.props.onMoveRow(dragIndex, hoverIndex,dragKey,hoverKey); + moveRow = (dragIndex, hoverIndex, dragKey, hoverKey) => { + if (this.props.onMoveRow) { + this.props.onMoveRow(dragIndex, hoverIndex, dragKey, hoverKey); } }; @@ -6762,7 +6782,7 @@ class CommonTableRc extends React.Component { if (commonUtils.isNotEmptyObject(previewImage)) { if (commonUtils.isNotEmptyArr(this.props.data)) { if (this.props.data[0].sPicturePath) { - for(const item of this.props.data) { + for (const item of this.props.data) { const dataUrl = `${commonConfig.file_host}file/download?savePathStr=${item.sPicturePath}&sModelsId=100&token=${token}`; /* 缩略图 */ data.push(dataUrl); } @@ -6779,7 +6799,7 @@ class CommonTableRc extends React.Component { onChange: this.handleUploadChange, accept: '*/*', showUploadList: false, - multiple:true, + multiple: true, beforeUpload: this.handleBeforeUpload, }; /* 获取look的props */ @@ -6825,15 +6845,15 @@ class CommonTableRc extends React.Component { const iIndex = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && (item.sControlName.includes('BtnPopup') || item.sControlName.includes('BtnHeadPopup')) && item.bVisible && item.sDropDownType === 'popup'); if (iIndex > -1) { commonPopupConfig = config.gdsconfigformslave[iIndex]; - if(commonPopupShowConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo' || commonPopupShowConfig?.sControlName === 'BtnChooseProcess') { + if (commonPopupShowConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo' || commonPopupShowConfig?.sControlName === 'BtnChooseProcess') { commonPopupConfig = commonPopupShowConfig; - if(commonPopupShowConfig?.sControlName === 'BtnChooseProcess') { + if (commonPopupShowConfig?.sControlName === 'BtnChooseProcess') { bCommonPopupProcess = true; } } commonPopupTitle = commonUtils.isNotEmptyObject(commonPopupConfig) && commonUtils.isNotEmptyObject(commonPopupConfig.sActiveName) ? commonPopupConfig.sActiveName : commonPopupTitle; - commonPopupTitle = commonUtils.isNotEmptyObject(commonPopupRecord) ? ( commonPopupConfig.sActiveId === '1' ? commonUtils.isEmpty(commonPopupRecord.sSrcFormName) ? commonPopupTitle : commonPopupRecord.sSrcFormName : commonPopupTitle ) : commonPopupTitle; - const sFormId = commonUtils.isNotEmptyObject(commonPopupRecord) ? ( commonPopupConfig.sActiveId === '1' ? commonUtils.isEmpty(commonPopupRecord.sFormId) ? commonPopupRecord.sSrcFormId : commonPopupRecord.sFormId : commonPopupConfig.sActiveId ) : commonPopupConfig.sActiveId; + commonPopupTitle = commonUtils.isNotEmptyObject(commonPopupRecord) ? (commonPopupConfig.sActiveId === '1' ? commonUtils.isEmpty(commonPopupRecord.sSrcFormName) ? commonPopupTitle : commonPopupRecord.sSrcFormName : commonPopupTitle) : commonPopupTitle; + const sFormId = commonUtils.isNotEmptyObject(commonPopupRecord) ? (commonPopupConfig.sActiveId === '1' ? commonUtils.isEmpty(commonPopupRecord.sFormId) ? commonPopupRecord.sSrcFormId : commonPopupRecord.sFormId : commonPopupConfig.sActiveId) : commonPopupConfig.sActiveId; commonPopupProps = { app: { @@ -6843,13 +6863,13 @@ class CommonTableRc extends React.Component { bEdit: (commonUtils.isNotEmptyObject(app.currentPane) && commonUtils.isNotEmptyObject(app.currentPane.route) && app.currentPane.route.includes('commonBillDeliver')), config: commonPopupConfig, conditonValues: this.props.getSqlCondition(commonPopupConfig), - title:commonPopupTitle, + title: commonPopupTitle, route: '/indexPage/commonList', formRoute: '/indexPage/commonList', formId: sFormId, key: sModelsId + commonPopupConfig.sId, sModelsType: bCommonPopupProcess ? 'search/commonProcess' : 'search/commonPopup', - select:this.handleSelectCommonPopup, + select: this.handleSelectCommonPopup, selectCancel: this.handleSelectCancel.bind(this, 'commonPopupVisible'), }, }, @@ -6863,13 +6883,13 @@ class CommonTableRc extends React.Component { } /* 多列弹出窗 */ - const commonPopupIndex = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && (item.sControlName.includes('BtnPopup') || item.sControlName.includes('BtnHeadPopup') ) && !['BtnPopup1'].includes(item.sControlName) && !item.sControlName.startsWith('BtnPopupEdit') && item.bVisible && item.sDropDownType === 'popup'); + const commonPopupIndex = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && (item.sControlName.includes('BtnPopup') || item.sControlName.includes('BtnHeadPopup')) && !['BtnPopup1'].includes(item.sControlName) && !item.sControlName.startsWith('BtnPopupEdit') && item.bVisible && item.sDropDownType === 'popup'); if (commonPopupIndex > -1) { bCommonPopup = true; } /* 单列弹出窗 */ - const commonPopupIndex1 = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.includes('BtnPopup1') && item.bVisible && item.sDropDownType === 'popup'); + const commonPopupIndex1 = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.includes('BtnPopup1') && item.bVisible && item.sDropDownType === 'popup'); if (commonPopupIndex1 > -1) { bCommonPopup1 = true; bCommonPopup = false; @@ -6906,7 +6926,7 @@ class CommonTableRc extends React.Component { } if (iIndex > -1) { - if(commonFieldPopupConfig.sDropDownType === 'popupSingle') { /* 如果下拉类型是单列弹出窗 则为单列 */ + if (commonFieldPopupConfig.sDropDownType === 'popupSingle') { /* 如果下拉类型是单列弹出窗 则为单列 */ bFieldPopup = false; } commonFieldPopupTitle = commonUtils.isNotEmptyObject(commonFieldPopupConfig) && commonUtils.isNotEmptyObject(commonFieldPopupConfig.sActiveName) ? commonFieldPopupConfig.sActiveName : commonFieldPopupTitle; @@ -6916,13 +6936,13 @@ class CommonTableRc extends React.Component { currentPane: { name: 'commonPopup', config: commonFieldPopupConfig, - title:commonFieldPopupTitle, + title: commonFieldPopupTitle, route: '/indexPage/commonList', formRoute: '/indexPage/commonList', formId: commonFieldPopupConfig.sActiveId, key: sModelsId + commonFieldPopupConfig.sId, sModelsType: 'search/commonPopup', - select:this.handleSelectCommonFieldPopup, + select: this.handleSelectCommonFieldPopup, selectCancel: this.handleSelectCancel.bind(this, 'commonFieldPopupVisible'), }, }, @@ -6958,25 +6978,25 @@ class CommonTableRc extends React.Component { const { config, sModelsId, app, selectedRowKeys, enabled } = this.props; if (commonUtils.isNotEmptyObject(config)) { commonModalTitle = commonUtils.isNotEmptyObject(commonModalShowConfig) && commonUtils.isNotEmptyObject(commonModalShowConfig.sActiveName) ? commonModalShowConfig.sActiveName : commonModalTitle; - const sFormId = commonUtils.isNotEmptyObject(commonModalRecord) && commonUtils.isNotEmptyObject(commonModalShowConfig) ? ( commonModalShowConfig.sActiveId === '1' ? commonUtils.isEmpty(commonModalRecord.sFormId) ? commonModalRecord.sSrcFormId : commonModalRecord.sFormId : commonModalShowConfig.sActiveId ) : commonModalShowConfig?.sActiveId; + const sFormId = commonUtils.isNotEmptyObject(commonModalRecord) && commonUtils.isNotEmptyObject(commonModalShowConfig) ? (commonModalShowConfig.sActiveId === '1' ? commonUtils.isEmpty(commonModalRecord.sFormId) ? commonModalRecord.sSrcFormId : commonModalRecord.sFormId : commonModalShowConfig.sActiveId) : commonModalShowConfig?.sActiveId; commonModalProps = { app: { ...this.props.app, currentPane: { name: 'commonModal', - bEdit: commonModalShowConfig?.sName === 'dStockAuxiliaryQty'? enabled:false, + bEdit: commonModalShowConfig?.sName === 'dStockAuxiliaryQty' ? enabled : false, config: commonModalShowConfig, - conditonValues: commonModalShowConfig ? this.props.getSqlCondition(commonModalShowConfig, this.props.name, commonModalRecord) :{}, - title:commonModalTitle, + conditonValues: commonModalShowConfig ? this.props.getSqlCondition(commonModalShowConfig, this.props.name, commonModalRecord) : {}, + title: commonModalTitle, route: '/indexPage/commonList', formRoute: '/indexPage/commonList', formId: sFormId, key: sModelsId + commonModalShowConfig?.sId, sModelsType: 'search/commonPopup', - select:this.handleSelectCommonPopup, + select: this.handleSelectCommonPopup, selectCancel: this.handleSelectCancel.bind(this, 'commonModalVisible'), - slaveDataSource :commonModalShowConfig?.sName === 'dStockAuxiliaryQty'? [commonModalRecord]: [], + slaveDataSource: commonModalShowConfig?.sName === 'dStockAuxiliaryQty' ? [commonModalRecord] : [], }, }, dispatch: this.props.dispatch, @@ -6985,7 +7005,7 @@ class CommonTableRc extends React.Component { onOpenNewTab: this.onOpenNewTab, outerMasterData: this.props.masterData, realizeHeight: this.props.realizeHeight, /* 拖动偏移高度 */ - bEdit:commonModalShowConfig?.sName === 'dAvailableAuxiliaryQty'? enabled:false + bEdit: commonModalShowConfig?.sName === 'dAvailableAuxiliaryQty' ? enabled : false }; // if(commonModalShowConfig?.sName === 'dSumCompleteAvailableStockQty' ){ // commonModalProps.data = commonModalData; @@ -7073,7 +7093,7 @@ class CommonTableRc extends React.Component { layoutScrollY = this.props.fixedHeight; } let bShowBtnUpload = true; - if(commonUtils.isNotEmptyObject(this.props.masterData) && commonUtils.isNotEmptyObject(this.props.masterData.sZczlxShowName)) { + if (commonUtils.isNotEmptyObject(this.props.masterData) && commonUtils.isNotEmptyObject(this.props.masterData.sZczlxShowName)) { bShowBtnUpload = this.props.masterData.sZczlxShowName !== '删除' && this.props.masterData.sZczlxShowName !== '恢复'; } @@ -7085,11 +7105,11 @@ class CommonTableRc extends React.Component {
{ this.props.name === 'picFile' || (commonUtils.isNotEmptyObject(this.props.name) && this.props.name.indexOf('file') > -1) || - (this.props.name.startsWith('slave') && this.findIsUpdByControlName(this.props, 'BtnUpload') && bShowBtnUpload ) ? + (this.props.name.startsWith('slave') && this.findIsUpdByControlName(this.props, 'BtnUpload') && bShowBtnUpload) ? - : null } + : null}
{ this.mydiv = ref; if (this.mydiv) { this.computedTdWidth(); if (false && commonUtils.isNotEmptyObject(location.pathname) && location.pathname.includes('commonListTab')) { - this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = this.tableHeight ? this.tableHeight + 'px': 80 + 'px'; + this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = this.tableHeight ? this.tableHeight + 'px' : 80 + 'px'; } if (layoutScrollY) { this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = typeof layoutScrollY === 'number' ? layoutScrollY + 'px' : layoutScrollY; @@ -7127,7 +7147,7 @@ class CommonTableRc extends React.Component { - : + :
} - { hasColorInfo && + {hasColorInfo && this.colorInfo = e}> - + - { tableProps.pagination && {this.onChange({ current: page, pageSize })}} - /> } + onChange={(page, pageSize) => { this.onChange({ current: page, pageSize }) }} + />} } @@ -7207,27 +7227,27 @@ class CommonTableRc extends React.Component { : '' }{ - commonPopupVisible ? - - {bCommonPopup ? - - : bCommonPopup1 ? - - : bCommonPopupTree ? - : '' - } - - : '' - } + commonPopupVisible ? + + {bCommonPopup ? + + : bCommonPopup1 ? + + : bCommonPopupTree ? + : '' + } + + : '' + } { commonFieldPopupVisible ? { + () => { const newList = [...commonFileDownloadList]; const checkState = newList.find(item => !item.checked); newList.forEach(item => item.checked = checkState); @@ -7347,27 +7367,27 @@ class CommonTableRc extends React.Component { } { pdfFileVisible ? - { - this.setState({ - pdfFileVisible: false - }); - }} - > -
- -
-
: '' + { + this.setState({ + pdfFileVisible: false + }); + }} + > +
+ +
+
: '' } { bOperateMoreVisible ? @@ -7389,15 +7409,15 @@ class CommonTableRc extends React.Component { {officePreviewVisible && } {/* 简单对话框 */} - { this.state.simpleModalVisible && this.setState({ simpleModalVisible: false, simpleModalWord: '' })} + onCancel={() => this.setState({ simpleModalVisible: false, simpleModalWord: '' })} >
- } + } ); } @@ -7447,8 +7467,8 @@ const CommonTable = (props) => { data[indexNew].iOrder = iOrder1; const tempItem = data[index]; - data[index] = {...data[indexNew], handleType: data[indexNew].handleType || "update"}; - data[indexNew] = {...tempItem, handleType: tempItem.handleType || "update"}; + data[index] = { ...data[indexNew], handleType: data[indexNew].handleType || "update" }; + data[indexNew] = { ...tempItem, handleType: tempItem.handleType || "update" }; props.onSaveState({ [`${props.name}Data`]: data @@ -7495,10 +7515,10 @@ const handleSetIRowNum = (data, props) => { if (commonUtils.isNotEmptyArr(eachData)) { eachData.forEach((item, index) => { /* 采购 */ - item.iRowNum = index +1; + item.iRowNum = index + 1; const iIndex = data.findIndex(row => row.sId === item.sId); - if(iIndex > -1) { - data[iIndex] ={...data[iIndex], iRowNum: index +1} + if (iIndex > -1) { + data[iIndex] = { ...data[iIndex], iRowNum: index + 1 } } }); @@ -7506,7 +7526,7 @@ const handleSetIRowNum = (data, props) => { } } } - if(location.pathname !== '/indexPage/commonClassify'){ + if (location.pathname !== '/indexPage/commonClassify') { if (commonUtils.isNotEmptyArr(item.children)) { handleSetIRowNum(item.children, props); } diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js index aec3e59..3f523b4 100644 --- a/src/components/Common/Typesetting/typesetting.js +++ b/src/components/Common/Typesetting/typesetting.js @@ -1,7 +1,7 @@ /* eslint-disable */ import * as commonFunc from "@/components/Common/commonFunc"; import { DownOutlined, LeftOutlined, RightOutlined, UpOutlined, VerticalLeftOutlined, VerticalRightOutlined } from "@ant-design/icons"; -import { message, Modal } from "antd-v4"; +import { message, Modal } from "antd"; import React, { useEffect, useRef, useState } from "react"; import { ArrowRightOutlined } from "@ant-design/icons"; import DynamicSVG from "../../Common/BoxDesignCompontent/svg"; @@ -65,6 +65,8 @@ const Typesetting = props => { const [newDHorizontalType, setNewDHorizontalType] = useState(0); const [newDPortraitType, setNewDPortraitType] = useState(0); const [oldVariables, setOldVariables] = useState(""); + const [innerWidth, setInnerWidth] = useState(0); + const [innerHeight, setInnerHeight] = useState(0); // 横板 let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData; // 使用 useRef 获取 DOM 元素 @@ -125,6 +127,7 @@ const Typesetting = props => { let boxList = []; if (sColumnNameConfig) { const slaveNewData = slaveRowData.upAbleConfigsExtra || JSON.parse(slaveRowData.sColumnNameConfig); + // 处理为双盒的部件 const tables = [ { name: "盒型类别", value: slaveRowData.sBoxType, type: null }, { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes }, @@ -143,22 +146,6 @@ const Typesetting = props => { { name: "右贴边位", value: "dYTBW" }, { name: "右(下)插位组件", value: "dYXCW" }, ]; - const doubleTitlieList1 = [ - { name: "左上插位组件", value: "dZSCW" }, - { name: "上插位组件", value: "dSCW" }, - { name: "右上插位组件", value: "dYSCW" }, - { name: "左偏移", value: "dZPY" }, - { name: "左插位组件", value: "dZCW" }, - { name: "左下插位组件", value: "dZXCW" }, - { name: "右偏移", value: "dYPY" }, - { name: "右插位组件", value: "dYCW" }, - { name: "右下插位组件", value: "dYXCW" }, - { name: "首盒长", value: "dSHC" }, - { name: "首盒宽", value: "dSHK" }, - { name: "次盒长", value: "dCHC" }, - { name: "次盒宽", value: "dCHK" }, - ]; - const srcList = Number(slaveRowData.sTypes) === 8 ? doubleTitlieList1 : titleList1; slaveNewData.forEach(x => { let key = 0; if (x.sAssignFormula) { @@ -168,7 +155,7 @@ const Typesetting = props => { } boxList.push({ value: key, - sName: srcList.find(item => item.value === x.sName)?.name || "", + sName: titleList1.find(item => item.value === x.sName)?.name || "", isEditable: true, isSelect: false, selectValue: null, @@ -176,8 +163,20 @@ const Typesetting = props => { selectImage: null, type: x.sTypes || null, show: true, - sCode: srcList.find(item => item.value === x.sName)?.value || "", + sCode: titleList1.find(item => item.value === x.sName)?.value || "", showName: x.showName, // 参数名称 + sLength: x.iSLength, + sWidth: x.iSWidth, + sType: x.iSType, + sTypeName: Number(x.iSType) === 0 ? "矩形" : "梯形", + sOffset: x.sSOffset, + sQuantity: x.iSQuantity, + cLength: x.iCLength, + cWidth: x.iCWidth, + cType: x.iCType, + cTypeName: Number(x.iCType) === 0 ? "矩形" : "梯形", + cOffset: x.sCOffset, + cQuantity: x.iCQuantity, }); }); tables.forEach(x => { @@ -209,9 +208,121 @@ const Typesetting = props => { } }); let DisableMateriallIcon = L ? sPackDetailPath : null; + function calculateCupUnfoldDimensions(D, d, h) { + + const R1 = D / 2; // 上口半径 + const R2 = d / 2; // 底部半径 + if (D === d) { + const paperCup = commonFunc.showLocalMessage(props, "paperCup", "L不能小于等于W!"); + message.error(paperCup); + return { + width: 0, + height: 0 + } + } + // 1. 计算母线长 l + const deltaR = R1 - R2; + const l = Math.sqrt(deltaR * deltaR + h * h); + + // 2. 计算外半径 R 和内半径 r + const R = (R1 * l) / deltaR; // 外半径 + const r = R - l; // 内半径 + + // 3. 计算圆心角 θ(弧度) + const theta_rad = (2 * Math.PI * R1) / R; + const halfTheta = theta_rad / 2; + + // 4. 计算弦长(水平宽度) + const chord = 2 * R * Math.sin(halfTheta); + + // 5. 展开图垂直高度 + const y_top = -R; // 外弧中点(最高点) + const y_inner_end = -r * Math.cos(halfTheta); + const verticalHeight = y_inner_end - y_top; + + // ✅ 新增:计算关键点坐标(以圆心为原点,y 向上为正) + // 注意:数学坐标系中,角度从 x 轴开始逆时针,但我们希望顶部在 y 轴负方向 + // 所以我们把角度偏移 -90°(即 -π/2),让 0° 指向正上方 + + const angleOffset = -Math.PI / 2; // 使 0° 指向顶部 + + const points = { + outerCenter: { + x: R * Math.cos(halfTheta + angleOffset), + y: R * Math.sin(halfTheta + angleOffset) + }, + outerLeft: { + x: R * Math.cos(-halfTheta + angleOffset), + y: R * Math.sin(-halfTheta + angleOffset) + }, + outerRight: { + x: R * Math.cos(halfTheta + angleOffset), + y: R * Math.sin(halfTheta + angleOffset) + }, + innerLeft: { + x: r * Math.cos(-halfTheta + angleOffset), + y: r * Math.sin(-halfTheta + angleOffset) + }, + innerRight: { + x: r * Math.cos(halfTheta + angleOffset), + y: r * Math.sin(halfTheta + angleOffset) + }, + // 也可以计算顶部中点(0° 方向) + topCenter: { + x: 0, + y: -R // 正上方 + }, + bottomLeft: { + x: -chord / 2, + y: -r * Math.cos(halfTheta) + }, + bottomRight: { + x: chord / 2, + y: -r * Math.cos(halfTheta) + } + }; + + // 如果你需要用于 SVG(y 向下为正),可以转换 + const pointsForSVG = Object.keys(points).reduce((acc, key) => { + acc[key] = { + x: points[key].x, + y: -points[key].y // 反转 y 轴 + }; + return acc; + }, {}); + + return { + width: chord, + height: verticalHeight, + R, r, l, + theta_deg: (theta_rad * 180) / Math.PI, + points, // 数学坐标系(y 向上) + pointsForSVG, // SVG 坐标系(y 向下) + chord, + verticalHeight + }; + } // 盒子展长展开公式计算 - const innerWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless); - const innerHeight = slaveRowData.sTypes === "6" ? evaluateFormula(sLengthFormula, variabless) : evaluateFormula(sWidthFormula, variabless); + // 在 useEffect 内部 + useEffect(() => { + if (Number(slaveRowData.sTypes) === 9) { + if (L > 0 && W > 0 && H > 0) { + const { width, height } = calculateCupUnfoldDimensions(L, W, D); + // 确保新值与旧值不同时才更新 + if (width && height) { + setInnerWidth(Number(width.toFixed(2))); + setInnerHeight(Number(height.toFixed(2))); + } + } + } else { + // 计算其他类型的盒子尺寸 + let newWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless); + let newHeight = slaveRowData.sTypes === "6" ? evaluateFormula(sLengthFormula, variabless) : evaluateFormula(sWidthFormula, variabless); + setInnerWidth(newWidth); + setInnerHeight(newHeight); + } + }, [slaveRowData.sTypes, L, W, H, D, sLengthFormula, sWidthFormula, variabless]); + const { sSettingMethod, sSGroupOffset, iFAngle, iSAngle, sSecondorizontalOffset, sSecondLongitudinalOffset } = radioValue ? radioValue : {}; const dFWidthOffset = evaluateFormula(radioValue?.sFWidthOffset, variabless); // 首盒纵向偏移 const dFLengthOffset = evaluateFormula(radioValue?.sFLengthOffset, variabless); // 首盒横向偏移 @@ -272,20 +383,11 @@ const Typesetting = props => { // 计算剩余空间 每组都算上偏移量 那么剩余需要加上后面偏移的总量 const remainingWidth = outerWidth - colsMaxLength + (boxLengthOffset + (reference ? 0 : dSLengthOffset)); const remainingHeight = outerHeight - rowsMaxLength + (boxWidthOffset + (reference ? 0 : dSWidthOffset)); - // const remainingWidth = - // outerWidth - - // (cols * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) - boxLengthOffset - (reference ? 0 : dSLengthOffset)); - // const remainingHeight = - // outerHeight - - // (rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) - boxWidthOffset - (reference ? 0 : dSWidthOffset)); //剩余量能不能放一下单独一个 const commonHeightCheck = remainingHeight > jInnerHeight + dXBJJ; const commonWidthCheck = remainingWidth > jInnerWidth + dYBJJ; const isCustomized = bAdvancedSetting; let remaining = isVertical ? commonHeightCheck : commonWidthCheck; - console.log(dSLengthOffset, "次盒横向偏移量"); - console.log(dSWidthOffset, "次盒纵向偏移量"); - // 判断 // const remaining = false; const isOdd = num => { @@ -312,6 +414,11 @@ const Typesetting = props => { } } } + const handleSaveState = (data) => { + setInnerWidth(Number(data.width.toFixed(2))) + setInnerHeight(Number(data.height.toFixed(2))) + + } const svgProps = { ...props, boxList, @@ -341,7 +448,7 @@ const Typesetting = props => { }} >
- {!sSvgPath ? : } + {!sSvgPath ? : } {/* */}
@@ -381,7 +488,7 @@ const Typesetting = props => { >
{!sSvgPath ? ( - + ) : ( { justifyContent: "center", alignItems: "center", position: "absolute", - left: `${ - isVertical - ? dSLengthOffset - : iSAngle === 90 || iSAngle === 270 + left: `${isVertical + ? dSLengthOffset + : iSAngle === 90 || iSAngle === 270 ? innerHeight + dFLengthOffset + dSLengthOffset + dYBJJ : innerWidth + dFLengthOffset + dSLengthOffset + dYBJJ - }px`, - top: `${ - isVertical ? jInnerHeight + dFWidthOffset + dSWidthOffset + dXBJJ : iSAngle === 90 || iSAngle === 270 ? dSWidthOffset : dSWidthOffset - }px`, + }px`, + top: `${isVertical ? jInnerHeight + dFWidthOffset + dSWidthOffset + dXBJJ : iSAngle === 90 || iSAngle === 270 ? dSWidthOffset : dSWidthOffset + }px`, }} >
{!sSvgPath ? ( - + ) : ( { {/* */} {/* {isSvg ? : } */}
- {!sSvgPath ? : } + {!sSvgPath ? : }
@@ -471,12 +576,12 @@ const Typesetting = props => { const calculateLeftPosition = (col, reference, isVertical, leftPosition, dYBJJ, dSLengthOffset) => { if (isVertical) { if (reference) { - return col === 0 ? leftPosition : leftPosition + dYBJJ * col; + return col === 0 ? leftPosition : leftPosition + (dYBJJ * col); } return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col; } else { if (reference) { - return col === 0 ? leftPosition : leftPosition + dYBJJ * col; + return col === 0 ? leftPosition : leftPosition + (dYBJJ * col); } return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col + dSLengthOffset * col; } @@ -519,15 +624,15 @@ const Typesetting = props => { if (cols === 0 || rows === 0) { if (cols > 0) { for (let col = 0; col < cols; col++) { - const leftPosition = col * innerWidthCombined; - const topPosition = 0 * innerHeightCombined; + const leftPosition = col * (innerWidthCombined + boxLengthOffset); + const topPosition = 0 * (innerHeightCombined + boxWidthOffset); innerDivs.push(createBoxOne(col, 0, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); } } if (rows > 0) { for (let row = 0; row < rows; row++) { - const leftPosition = 0 * innerWidthCombined; - const topPosition = row * innerHeightCombined; + const leftPosition = 0 * (innerWidthCombined + boxLengthOffset); + const topPosition = row * (innerHeightCombined + boxWidthOffset); innerDivs.push(createBoxOne(0, row, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); } } @@ -535,8 +640,8 @@ const Typesetting = props => { let hasPushed = false; // 标志变量 for (let col = 0; col < cols; col++) { for (let row = 0; row < rows; row++) { - const leftPosition = col * innerWidthCombined; - const topPosition = row * innerHeightCombined; + const leftPosition = col * (innerWidthCombined + boxLengthOffset); + const topPosition = row * (innerHeightCombined + boxWidthOffset + dXBJJ); innerDivs.push(createBox(col, row, 1, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); } // 如果可以放下首盒\ @@ -546,11 +651,11 @@ const Typesetting = props => { if (reference) { // 是否首盒 // 首盒的上边距下边距 末尾盒子的上下边距 添加那一行的上边距 - leftPosition = col * innerWidthCombined + dFLengthOffset; - topPosition = rows * innerHeightCombined + dFWidthOffset; + leftPosition = col * (innerWidthCombined + boxLengthOffset) + dFLengthOffset; + topPosition = rows * (innerHeightCombined + boxWidthOffset) + dFWidthOffset; } else { - leftPosition = col * innerWidthCombined; - topPosition = rows * innerHeightCombined; + leftPosition = col * (innerWidthCombined + boxLengthOffset); + topPosition = rows * (innerHeightCombined + boxWidthOffset); } innerDivs.push(createBoxOne(col, rows, 3, leftPosition, topPosition + dXBJJ, iFAngle, DisableMateriallIcon)); } @@ -561,11 +666,10 @@ const Typesetting = props => { let topPosition = 0; let leftPosition = 0; if (reference) { - topPosition = index * (innerHeightCombined + boxWidthOffset); + topPosition = index * (innerHeightCombined + boxWidthOffset) + dFWidthOffset; leftPosition = cols * (innerWidthCombined + boxLengthOffset); } else { - topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset); - + topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset) + dFWidthOffset; leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset + dYBJJ); } innerDivs.push(createDiv(cols - 1, index, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); @@ -578,6 +682,7 @@ const Typesetting = props => { onSaveDPartsLength(innerWidth, innerHeight, slaveData); } const propsData = innerDivs[innerDivs.length - 1]; + const propsDataFirst = innerDivs[0]; let openEdition = 0; if (propsData && L) { const { dWlcd, sBillNo } = slaveRowData; @@ -590,19 +695,20 @@ const Typesetting = props => { const propsDataTop = Number(propsData.props.style.top.slice(0, -2)); // 判断列是否是单独的 - const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长 - const newMaterialWidth = parseFloat( - propsDataTop + propsDataHeight + dSBLB + dXBLB - (isVertical ? 0 : rows >= 1 ? (remaining ? 0 : dXBJJ) : 0) - ).toFixed(2); - + let newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长 + const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dSBLB + dXBLB - (isVertical ? 0 : rows >= 1 ? (remaining ? 0 : dXBJJ) : 0)).toFixed(2); + // 如果只有一列的时候去除右边刀位 + if (cols === 1) { + newMaterialLength = newMaterialLength - dYBJJ + } // 计算开数 let dSinglePQty = isVertical ? remaining ? cols + cols * (rows * 2) : cols * (rows * 2) : remaining - ? rows + rows * (cols * 2) - : rows * (cols * 2); + ? rows + rows * (cols * 2) + : rows * (cols * 2); let dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2; let dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows; @@ -717,6 +823,8 @@ const Typesetting = props => { const confirmParam = commonFunc.showLocalMessage(props, "confirmParam", "排版尺寸大于上机尺寸,请确认参数!"); const isJuantong = selectedNode.sTypeKey === "juantong"; + const OpenVersion = commonFunc.showLocalMessage(props, "OpenVersion", "开版利用率"); + const DoorWidthDirection = commonFunc.showLocalMessage(props, "DoorWidthDirections", "门幅方向"); if (isCustomized && !isShow) { if (isMobile) return; message.error(confirmParam); @@ -744,6 +852,7 @@ const Typesetting = props => { const handleCancel = () => { setIsModalOpen(false); }; + return ( <> {isShow ? ( @@ -860,7 +969,7 @@ const Typesetting = props => { textOrientation: "upright", }} > - {"门幅方向"} + {DoorWidthDirection} ) : ( "" @@ -953,7 +1062,7 @@ const Typesetting = props => { {maxWidth} {openEdition ? ( - 开版利用率: + {OpenVersion}: {openEdition} % ) : null} @@ -1232,7 +1341,7 @@ const Typesetting = props => { textOrientation: "upright", }} > - {"门幅方向"} + {DoorWidthDirection} ) : ( "" @@ -1329,7 +1438,7 @@ const Typesetting = props => { {maxWidth} {openEdition ? ( - 开版利用率: + {OpenVersion}: {openEdition} % ) : null} @@ -1463,6 +1572,8 @@ const Typesetting = props => {
+ + ); }; diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 8304a32..900f79b 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -2452,6 +2452,7 @@ const BoxComponent = props => { let boxList = []; const { sStripType = 0 } = selectedNode; + if ( (slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth && masterData.dHeight) || (Number(sStripType) === 1 && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) || @@ -2598,12 +2599,16 @@ const BoxComponent = props => { } const getImageUrl = (sName) => { const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`; - return imageUrlNew - } - let imagesData = [ - { src: getImageUrl(removeExtension(slaveRowData.sPackDetailPathUpLoad)), alt: "展开图" }, - { src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" }, - ]; + return imageUrlNew; + }; + + let imagesData = useMemo(() => { + if (!slaveRowData) return []; + return [ + { src: getImageUrl(removeExtension(slaveRowData.sPackDetailPathUpLoad)), alt: "展开图" }, + { src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" }, + ]; + }, [slaveRowData?.sPackDetailPathUpLoad, slaveRowData?.sPackPath]); if (!slaveRowData.sPackDetailPathUpLoad) { imagesData = [{ src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" }]; } else if (!slaveRowData.sPackPath) { @@ -2713,6 +2718,7 @@ const BoxComponent = props => { transform: " translate(-50%, -50%)", width: "100%", height: "200px", + margin:0 }} >