/* eslint-disable */ import React, { useRef, useState, useEffect } from "react"; import styles from "../index.less"; import SvgBox from "../svg"; import { Select, Button, message, Input, Spin } from "antd-v4"; import { CompressOutlined, ExpandOutlined } from "@ant-design/icons"; import * as commonUtils from "@/utils/utils"; import * as commonFunc from "@/components/Common/commonFunc"; import * as commonBusiness from "@/components/Common/commonBusiness"; import * as commonServices from "@/services/services"; import CommonBase from "@/components/Common/CommonBase"; import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; import CommonViewTable from "@/components/Common/CommonViewTable"; import StaticEditTable from "@/components/Common/CommonTable"; import jsPreviewPdf from "@js-preview/pdf"; import commonConfig from "@/utils/config"; const DoubleLayerBox = props => { console.log("🚀 ~ DoubleLayerBox:", props); const [boxList, setBoxList] = useState([]); const [tableColum, setTableColum] = useState([]); // 盒身类型 const [tableDataList, setTableDataList] = useState([]); // 盒长 const [boxBodyList, setBoxBodyList] = useState([]); // 盒身信息 const [isDefaultValue, setIsDefaultValue] = useState(true); // 是否默认值 const [topBoxList, setTopBoxList] = useState([]); // 盒身信息 const [leftBoxList, setLeftBoxList] = useState([]); // 左边 const [rightBoxList, setRightBoxList] = useState([]); const [loading, setLoading] = useState(false); const { renderOptionWithImage } = props; let boxData = { value: "", sName: "", isEditable: true, isSelect: false, selectValue: null, selectLabel: "", selectImage: null, type: null, show: true, showName: "", // 参数名称 sAssignFormula: null, code: "", }; const options = props.options; const top = [ { name: "左贴边位", value: "dZTBW" }, { name: "上插位组件", value: "dZSCW" }, { name: "右贴边位", value: "dYTBW" }, ]; setTopBoxList( top.map(item => { boxData.sName = item.name; boxData.showName = item.name; boxData.code = item.value; return boxData; }) ); const svgBoxProps = { ...props, boxList: [], showNew: 0, }; return (
{topBoxList.map((topItem, index) => (
{topItem.sName}
{topItem?.selectImage ? ( {topItem.value} ) : ( "" )}
{/*
参数:
*/} handleChangeName(e, index)} onFocus={e => handleFocus(e, index)} onBlur={e => handleBlur(e, index)} readOnly={!topItem?.isEditable} className={styles.text} /> handleChange(e, index)} onFocus={e => handleFocus(e, index)} onBlur={e => handleBlur(e, index)} readOnly={!topItem?.isEditable} style={{ width: " 80%" }} />
))}
{leftBoxList.map((item, index) => (
{titleList[index + 3]}
{item?.selectImage ? ( {item.value} ) : ( "" )} handleChangeName(e, findIndexBySname(item.sName))} onFocus={e => handleFocus(e, findIndexBySname(item.sName))} onBlur={e => handleBlur(e, findIndexBySname(item.sName))} readOnly={!item?.isEditable} className={styles.text} /> handleChange(e, findIndexBySname(item.sName))} onFocus={e => handleFocus(e, findIndexBySname(item.sName))} onBlur={e => handleBlur(e, findIndexBySname(item.sName))} readOnly={!item?.isEditable} style={{ width: " 80%" }} />
))}
{rightBoxList.map((item, index) => (
{titleList[findIndexBySname(item.sName)]}
{item?.selectImage ? ( {item.value} ) : ( "" )} handleChangeName(e, findIndexBySname(item.sName))} onFocus={e => handleFocus(e, findIndexBySname(item.sName))} onBlur={e => handleBlur(e, findIndexBySname(item.sName))} readOnly={!item?.isEditable} className={styles.text} /> handleChange(e, findIndexBySname(item.sName))} onFocus={e => handleFocus(e, findIndexBySname(item.sName))} onBlur={e => handleBlur(e, findIndexBySname(item.sName))} readOnly={!item?.isEditable} style={{ width: " 80%" }} />
))}
{tableColum && tableColum.length ? tableColum.map((item, index) => { const uniqueIndex = index + 9; return (
{item.showName}
handleChange(e, uniqueIndex)} onFocus={e => handleFocus(e, uniqueIndex)} onBlur={e => handleBlur(e, uniqueIndex)} readOnly={!boxList[uniqueIndex]?.isEditable} style={{ width: " 80%" }} />
); }) : ""} {boxBodyList && boxBodyList.length ? boxBodyList.map((item, index) => { const uniqueIndex = index + 9 + tableColum.length; return (
{item.showName}
{boxList[uniqueIndex]?.selectImage ? ( {boxList[uniqueIndex].value} ) : ( "" )} {isDefaultValue ?
{boxList[uniqueIndex]?.value}
: ""}
); }) : ""}
{tableDataList && tableDataList.length ? tableDataList.map((item, index) => { const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length; return (
{item.sName}
handleChange(e, uniqueIndex)} onFocus={e => handleFocus(e, uniqueIndex)} onBlur={e => handleBlur(e, uniqueIndex)} readOnly={!boxList[uniqueIndex]?.isEditable} style={{ width: " 60%" }} />
); }) : ""}
); }; export default DoubleLayerBox;