Commit af31c58fd2fcca95d4d46b7b1cf52d9df9c76d0a

Authored by 陈鑫涛
1 parent 0a343330

盒型设计

src/components/Common/BoxDesignCompontent/index.js
@@ -107,10 +107,15 @@ const BoxDesignCompontent = baseProps => { @@ -107,10 +107,15 @@ const BoxDesignCompontent = baseProps => {
107 const [boxKey, setBoxKey] = useState(new Date().getTime()); 107 const [boxKey, setBoxKey] = useState(new Date().getTime());
108 const [doubleLayerList, setDoubleLayerList] = useState([]); 108 const [doubleLayerList, setDoubleLayerList] = useState([]);
109 if (!boxVisible) return ""; 109 if (!boxVisible) return "";
  110 + const isEnglish = (str) => {
  111 + return /^[A-Za-z]+$/.test(str);
  112 + }
110 // 1️⃣ 只负责 tableColum 113 // 1️⃣ 只负责 tableColum
111 useEffect(() => { 114 useEffect(() => {
112 if (!tableData?.length) return; 115 if (!tableData?.length) return;
113 - 116 + const keywords = ["盒长", "盒高", "盒宽", "盒身","Box Length", "Box Width", "Box Height","Box Body"];
  117 + // 判断是否是英文
  118 + // isEnglish(item.showName) ? item.sEnglish : item.sChinese
114 const newTableColum = tableData 119 const newTableColum = tableData
115 .filter(item => item.bVisible) // 先过滤可见 120 .filter(item => item.bVisible) // 先过滤可见
116 .map(item => ({ 121 .map(item => ({
@@ -122,9 +127,18 @@ const BoxDesignCompontent = baseProps => { @@ -122,9 +127,18 @@ const BoxDesignCompontent = baseProps => {
122 })) 127 }))
123 .filter( 128 .filter(
124 item => 129 item =>
125 - !(item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽") || item.showName.includes("盒身")) 130 + !keywords.some(keyword => item.showName.includes(keyword))
126 ) 131 )
127 - .map(item => (item.showName === "盒型类别" ? { ...item, showName: "盒型名称" } : item)); 132 + .map(item => {
  133 + if (item.showName === '盒型类别') {
  134 + return { ...item, showName: '盒型名称' };
  135 + }
  136 + if (item.showName.trim() === 'Box Type Category') {
  137 + return { ...item, showName: 'Box Name' };
  138 + }
  139 + return item;
  140 + }
  141 + );
128 142
129 setTableColum(newTableColum); 143 setTableColum(newTableColum);
130 }, [tableData]); 144 }, [tableData]);
@@ -133,6 +147,8 @@ const BoxDesignCompontent = baseProps => { @@ -133,6 +147,8 @@ const BoxDesignCompontent = baseProps => {
133 useEffect(() => { 147 useEffect(() => {
134 if (!tableData?.length) return; 148 if (!tableData?.length) return;
135 149
  150 + const keywords = ['盒身', 'Box Body'];
  151 +
136 const bodyList = tableData 152 const bodyList = tableData
137 .filter(item => item.bVisible) 153 .filter(item => item.bVisible)
138 .map(item => ({ 154 .map(item => ({
@@ -140,9 +156,11 @@ const BoxDesignCompontent = baseProps => { @@ -140,9 +156,11 @@ const BoxDesignCompontent = baseProps => {
140 isEditable: true, 156 isEditable: true,
141 isSelect: false, 157 isSelect: false,
142 selectImage: null, 158 selectImage: null,
143 - value: "", 159 + value: '',
144 })) 160 }))
145 - .filter(item => item.showName.includes("盒身")); 161 + .filter(item =>
  162 + keywords.some(k => item.showName.trim().includes(k))
  163 + );
146 164
147 setBoxBodyList(bodyList); 165 setBoxBodyList(bodyList);
148 }, [tableData]); 166 }, [tableData]);
@@ -150,6 +168,15 @@ const BoxDesignCompontent = baseProps => { @@ -150,6 +168,15 @@ const BoxDesignCompontent = baseProps => {
150 // 3️⃣ 只负责 tableDataList 和 tableDataLists 168 // 3️⃣ 只负责 tableDataList 和 tableDataLists
151 useEffect(() => { 169 useEffect(() => {
152 if (!tableData?.length) return; 170 if (!tableData?.length) return;
  171 + const keywords = ["盒长", "盒高", "盒宽", "Box Length", "Box Width", "Box Height"];
  172 + const keywordMap = {
  173 + '盒长': 'L',
  174 + '盒宽': 'W',
  175 + '盒高': 'D',
  176 + 'Box Length': 'L',
  177 + 'Box Width': 'W',
  178 + 'Box Height': 'D',
  179 + };
153 180
154 const newList = tableData 181 const newList = tableData
155 .filter(item => item.bVisible) 182 .filter(item => item.bVisible)
@@ -160,15 +187,17 @@ const BoxDesignCompontent = baseProps => { @@ -160,15 +187,17 @@ const BoxDesignCompontent = baseProps => {
160 selectImage: null, 187 selectImage: null,
161 value: "", 188 value: "",
162 })) 189 }))
163 - .filter(item => item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽")) 190 + .filter(item =>
  191 + keywords.some(keyword => item.showName.includes(keyword))
  192 + )
164 .map(item => { 193 .map(item => {
165 - let name = "";  
166 - if (item.showName === "盒长") name = "盒长(L)";  
167 - if (item.showName === "盒宽") name = "盒宽(W)";  
168 - if (item.showName === "盒高") name = "盒高(D)";  
169 - return { ...item, sName: name }; 194 + const hitKey = keywords.find(k => item.showName.includes(k));
  195 + // 拼出新名字:原始关键字 + (后缀)
  196 + const sName = hitKey
  197 + ? `${hitKey} (${keywordMap[hitKey]})`
  198 + : item.showName; // 兜底,理论上不会发生
  199 + return { ...item, sName };
170 }); 200 });
171 -  
172 setTableDataList(newList); 201 setTableDataList(newList);
173 setTableDataLists(newList); 202 setTableDataLists(newList);
174 }, [tableData]); 203 }, [tableData]);
@@ -322,17 +351,17 @@ const BoxDesignCompontent = baseProps => { @@ -322,17 +351,17 @@ const BoxDesignCompontent = baseProps => {
322 const orderLength = slaveData.find(item => item.sCode === "dCHC")?.iValue; 351 const orderLength = slaveData.find(item => item.sCode === "dCHC")?.iValue;
323 const orderWidth = slaveData.find(item => item.sCode === "dCHK")?.iValue; 352 const orderWidth = slaveData.find(item => item.sCode === "dCHK")?.iValue;
324 newBoxList.forEach((item, index) => { 353 newBoxList.forEach((item, index) => {
325 - if (item.sName === "盒身") { 354 + if (item.sName.trim() === "盒身" || item.sName.trim() === "Box Body") {
326 newBoxList[index].value = masterData.sBoxBody; 355 newBoxList[index].value = masterData.sBoxBody;
327 newBoxList[index].selectImage = masterData.sMakeUpPath; 356 newBoxList[index].selectImage = masterData.sMakeUpPath;
328 newBoxList[index].type = masterData.sTypes; 357 newBoxList[index].type = masterData.sTypes;
329 - } else if (item.sName === "盒长") { 358 + } else if (item.sName.trim() === "盒长" || item.sName.trim() === "Box Length") {
330 newBoxList[index].value = masterData.dBoxLength; 359 newBoxList[index].value = masterData.dBoxLength;
331 - } else if (item.sName === "盒宽") { 360 + } else if (item.sName.trim() === "盒宽" || item.sName.trim() === "Box Width") {
332 newBoxList[index].value = masterData.dBoxWidth; 361 newBoxList[index].value = masterData.dBoxWidth;
333 - } else if (item.sName === "盒高") { 362 + } else if (item.sName.trim() === "盒高" || item.sName.trim() === "Box Height") {
334 newBoxList[index].value = masterData.dBoxHeight; 363 newBoxList[index].value = masterData.dBoxHeight;
335 - } else if (item.sName === "盒型名称") { 364 + } else if (item.sName === "盒型名称" || item.sName.trim() === "Box Name") {
336 newBoxList[index].value = masterData.sName; 365 newBoxList[index].value = masterData.sName;
337 } else if (item.sName === "首盒长") { 366 } else if (item.sName === "首盒长") {
338 newBoxList[index].value = headLength; 367 newBoxList[index].value = headLength;
@@ -524,10 +553,10 @@ const BoxDesignCompontent = baseProps => { @@ -524,10 +553,10 @@ const BoxDesignCompontent = baseProps => {
524 let updatedBoxList = [...boxList]; 553 let updatedBoxList = [...boxList];
525 if (doubleType === 0) { 554 if (doubleType === 0) {
526 updatedBoxList[index].sTypeName = Number(name) === 0 ? "矩形" : "梯形"; 555 updatedBoxList[index].sTypeName = Number(name) === 0 ? "矩形" : "梯形";
527 - updatedBoxList[index].sType = Number(name); 556 + updatedBoxList[index].sType = Number(name)
528 } else { 557 } else {
529 updatedBoxList[index].cTypeName = Number(name) === 0 ? "矩形" : "梯形"; 558 updatedBoxList[index].cTypeName = Number(name) === 0 ? "矩形" : "梯形";
530 - updatedBoxList[index].cType = Number(name); 559 + updatedBoxList[index].cType = Number(name)
531 } 560 }
532 setBoxList(updatedBoxList); 561 setBoxList(updatedBoxList);
533 }; 562 };
@@ -536,23 +565,23 @@ const BoxDesignCompontent = baseProps => { @@ -536,23 +565,23 @@ const BoxDesignCompontent = baseProps => {
536 // const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&scale=0.1&sModelsId=100&token=${props.token}`; 565 // const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&scale=0.1&sModelsId=100&token=${props.token}`;
537 // return imageUrl; 566 // return imageUrl;
538 // }; 567 // };
539 - const removeExtension = filename => {  
540 - const lastDotIndex = filename.lastIndexOf("."); 568 + const removeExtension = (filename) => {
  569 + const lastDotIndex = filename.lastIndexOf('.');
541 if (lastDotIndex === -1) { 570 if (lastDotIndex === -1) {
542 // 如果字符串中没有点,则返回原字符串 571 // 如果字符串中没有点,则返回原字符串
543 return filename; 572 return filename;
544 } 573 }
545 return filename.substring(0, lastDotIndex); 574 return filename.substring(0, lastDotIndex);
546 - };  
547 - const getImage = sName => { 575 + }
  576 + const getImage = (sName) => {
548 const fileName = removeExtension(sName); 577 const fileName = removeExtension(sName);
549 const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${fileName}&date=${new Date().getTime()}`; 578 const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${fileName}&date=${new Date().getTime()}`;
550 - return imageUrlNew;  
551 - }; 579 + return imageUrlNew
  580 + }
552 // 下来框 581 // 下来框
553 const renderOptionWithImage = option => { 582 const renderOptionWithImage = option => {
554 return ( 583 return (
555 - <Select.Option key={option.sId} value={option.sCode} label={option.sName} image={getImage(option.sMakeUpPath)}> 584 + <Select.Option key={option.sId} value={option.sCode} label={option.sName} image={option.sMakeUpPath}>
556 <div style={{ display: "flex", alignItems: "center" }}> 585 <div style={{ display: "flex", alignItems: "center" }}>
557 {option.sMakeUpPath ? <img src={getImage(option.sMakeUpPath)} style={{ width: 24, height: 24, marginRight: 8 }} /> : ""} 586 {option.sMakeUpPath ? <img src={getImage(option.sMakeUpPath)} style={{ width: 24, height: 24, marginRight: 8 }} /> : ""}
558 <span>{option.sName}</span> 587 <span>{option.sName}</span>
@@ -588,18 +617,8 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -588,18 +617,8 @@ const BoxDesignCompontent = baseProps =&gt; {
588 // 判断是新增还是修改 617 // 判断是新增还是修改
589 618
590 // 存储子表数据 619 // 存储子表数据
591 - const boxTypes = boxList.find(item => item.sName === "盒身")?.type; 620 + const boxTypes = boxList.find(item => item.sName === "盒身" || item.sName.trim() === 'Box Body')?.type;
592 const findList = boxTypes === "8" ? doubleTitlieList1 : titleList1; 621 const findList = boxTypes === "8" ? doubleTitlieList1 : titleList1;
593 - // boxList.forEach(item=>{  
594 - // if (item.type && item.type.includes('09')) {  
595 - // if (item.sName === "左贴边位" || item.sName === "右贴边位" ) {  
596 - // item.value = (item.sLength ? Number(item.sLength) : 0) + (item.cLength ? Number(item.cLength) : 0)  
597 - // } else {  
598 - // item.value = (item.sLength ? Number(item.sWidth) : 0 )+ (item.cLength ? Number(item.cWidth) : 0)  
599 - // }  
600 -  
601 - // }  
602 - // })  
603 boxList.forEach((item, index) => { 622 boxList.forEach((item, index) => {
604 const i = findList.findIndex(i => i.name === item.sName); 623 const i = findList.findIndex(i => i.name === item.sName);
605 const slave = slaveData.find(z => z.sCode === findList[i]?.value); 624 const slave = slaveData.find(z => z.sCode === findList[i]?.value);
@@ -618,18 +637,18 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -618,18 +637,18 @@ const BoxDesignCompontent = baseProps =&gt; {
618 bVisible: item.value ? true : false, 637 bVisible: item.value ? true : false,
619 sParentId: masterData.sId, 638 sParentId: masterData.sId,
620 sAssignFormula: item.sAssignFormula, 639 sAssignFormula: item.sAssignFormula,
621 - iSLength: item.sLength === undefined ? 0 : item.sLength,  
622 - iSWidth: item.sWidth === undefined ? 0 : item.sWidth,  
623 - iSType: item.sType === undefined ? 0 : item.sType, 640 + iSLength: !item.sLength ? 0 : item.sLength,
  641 + iSWidth: !item.sWidth ? 0 : item.sWidth,
  642 + iSType: !item.sType ? 0 : item.sType,
624 iSTypeName: item.sType !== null ? (Number(item.sType) === 0 ? "矩形" : Number(item.sType) === 1 ? "梯形" : null) : null, 643 iSTypeName: item.sType !== null ? (Number(item.sType) === 0 ? "矩形" : Number(item.sType) === 1 ? "梯形" : null) : null,
625 - sSOffset: item.sOffset === undefined ? 0 : item.sOffset,  
626 - iSQuantity: item.sQuantity === undefined ? 0 : item.sQuantity,  
627 - iCLength: item.cLength === undefined ? 0 : item.cLength,  
628 - iCWidth: item.cWidth === undefined ? 0 : item.cWidth,  
629 - iCType: item.cType === undefined ? 0 : item.cType, 644 + sSOffset: !item.sOffset ? 0 : item.sOffset,
  645 + iSQuantity: !item.sQuantity ? 0 : item.sQuantity,
  646 + iCLength: !item.cLength ? 0 : item.cLength,
  647 + iCWidth: !item.cWidth ? 0 : item.cWidth,
  648 + iCType: !item.cType ? 0 : item.cType,
630 iCTypeName: item.cType !== null ? (Number(item.cType) === 0 ? "矩形" : Number(item.cType) === 1 ? "梯形" : null) : null, 649 iCTypeName: item.cType !== null ? (Number(item.cType) === 0 ? "矩形" : Number(item.cType) === 1 ? "梯形" : null) : null,
631 - sCOffset: item.cOffset === undefined ? 0 : item.cOffset,  
632 - iCQuantity: item.cQuantity === undefined ? 0 : item.cQuantity, 650 + sCOffset: !item.cOffset ? 0 : item.cOffset,
  651 + iCQuantity: !item.cQuantity ? 0 : item.cQuantity,
633 }; 652 };
634 // if (item.value !== "") { 653 // if (item.value !== "") {
635 newSlaveData.push(data); 654 newSlaveData.push(data);
@@ -649,12 +668,12 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -649,12 +668,12 @@ const BoxDesignCompontent = baseProps =&gt; {
649 // 计算展长公式 sLengthFormula 668 // 计算展长公式 sLengthFormula
650 let sLengthFormula = ""; 669 let sLengthFormula = "";
651 let sWidthFormula = ""; 670 let sWidthFormula = "";
652 - const boxType = boxList.find(item => item.sName === "盒身")?.type; 671 + const boxType = boxList.find(item => item.sName === "盒身"|| item.sName.trim() === "Box Body")?.type;
653 if (boxType === "8") { 672 if (boxType === "8") {
654 } else { 673 } else {
655 - const boxLength = Number(boxList.find(item => item.sName === "盒长")?.value);  
656 - const boxWidth = Number(boxList.find(item => item.sName === "盒宽")?.value);  
657 - const boxHeight = Number(boxList.find(item => item.sName === "盒高")?.value); 674 + const boxLength = Number(boxList.find(item => item.sName === "盒长"|| item.sName.trim() === "Box Length")?.value);
  675 + const boxWidth = Number(boxList.find(item => item.sName === "盒宽"|| item.sName.trim() === "Box Width")?.value);
  676 + const boxHeight = Number(boxList.find(item => item.sName === "盒高"|| item.sName.trim() === "Box Height")?.value);
658 const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); 677 const zxcw = boxList.find(x => x.sName === "左(下)插位组件");
659 const zscw = boxList.find(x => x.sName === "左(上)插位组件"); 678 const zscw = boxList.find(x => x.sName === "左(上)插位组件");
660 const yscw = boxList.find(x => x.sName === "右(上)插位组件"); 679 const yscw = boxList.find(x => x.sName === "右(上)插位组件");
@@ -977,13 +996,13 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -977,13 +996,13 @@ const BoxDesignCompontent = baseProps =&gt; {
977 // 存储盒身数据 主表 996 // 存储盒身数据 主表
978 const newMasterData = { 997 const newMasterData = {
979 ...masterData, 998 ...masterData,
980 - sBoxBody: boxList.find(item => item.sName === "盒身")?.value || "",  
981 - dBoxLength: boxList.find(item => item.sName === "盒长")?.value || "",  
982 - dBoxWidth: boxList.find(item => item.sName === "盒宽")?.value || "",  
983 - dBoxHeight: boxList.find(item => item.sName === "盒高")?.value || "",  
984 - sName: boxList.find(item => item.sName === "盒型名称")?.value || "",  
985 - sMakeUpPath: boxList.find(item => item.sName === "盒身")?.selectImage || "",  
986 - sTypes: boxList.find(item => item.sName === "盒身")?.type || "", 999 + sBoxBody: boxList.find(item => item.sName === "盒身" || item.sName.trim() === "Box Body")?.value || "",
  1000 + dBoxLength: boxList.find(item => item.sName === "盒长" || item.sName.trim() === "Box Length")?.value || "",
  1001 + dBoxWidth: boxList.find(item => item.sName === "盒宽" || item.sName.trim() === "Box Width")?.value || "",
  1002 + dBoxHeight: boxList.find(item => item.sName === "盒高" || item.sName.trim() === "Box Height")?.value || "",
  1003 + sName: boxList.find(item => item.sName === "盒型名称" || item.sName.trim() === "Box Name")?.value || "",
  1004 + sMakeUpPath: boxList.find(item => item.sName === "盒身" || item.sName.trim() === "Box Body") ?.selectImage || "",
  1005 + sTypes: boxList.find(item => item.sName === "盒身" || item.sName.trim() === "Box Body")?.type || "",
987 sLengthFormula: masterData.sLengthFormula || sLengthFormula, 1006 sLengthFormula: masterData.sLengthFormula || sLengthFormula,
988 sWidthFormula: masterData.sWidthFormula || sWidthFormula, 1007 sWidthFormula: masterData.sWidthFormula || sWidthFormula,
989 }; 1008 };
@@ -1044,7 +1063,8 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1044,7 +1063,8 @@ const BoxDesignCompontent = baseProps =&gt; {
1044 <div className={styles.boxTitle}>{topItem.sName}</div> 1063 <div className={styles.boxTitle}>{topItem.sName}</div>
1045 {topItem?.selectImage ? ( 1064 {topItem?.selectImage ? (
1046 <img 1065 <img
1047 - src={topItem?.selectImage} 1066 + // src={topItem?.selectImage}
  1067 + src={topItem?.selectImage ? getImage(topItem?.selectImage) : ''}
1048 alt={topItem.value} 1068 alt={topItem.value}
1049 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }} 1069 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }}
1050 /> 1070 />
@@ -1055,7 +1075,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1055,7 +1075,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1055 <Select 1075 <Select
1056 optionLabelProp="label" 1076 optionLabelProp="label"
1057 className="mySelects" 1077 className="mySelects"
1058 - style={{ width: 180, height: 40 }} 1078 + style={{ width: 180 ,height:'100%'}}
1059 defaultValue={options.length ? options[0].value : ""} 1079 defaultValue={options.length ? options[0].value : ""}
1060 onSelect={(value, option) => handleSelect(value, option, index, 0)} 1080 onSelect={(value, option) => handleSelect(value, option, index, 0)}
1061 onDropdownVisibleChange={async open => { 1081 onDropdownVisibleChange={async open => {
@@ -1095,7 +1115,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1095,7 +1115,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1095 <Select 1115 <Select
1096 optionLabelProp="label" 1116 optionLabelProp="label"
1097 className="mySelectsDouble" 1117 className="mySelectsDouble"
1098 - style={{ width: 180, color: "#000", height: 40 }} 1118 + style={{ width: 180, color: "#000",height:'100%' }}
1099 defaultValue={options.length ? options[0].value : ""} 1119 defaultValue={options.length ? options[0].value : ""}
1100 value={topItem?.sTypeName || ""} 1120 value={topItem?.sTypeName || ""}
1101 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(topItem.sName), 0, 0)} 1121 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(topItem.sName), 0, 0)}
@@ -1153,7 +1173,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1153,7 +1173,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1153 <Select 1173 <Select
1154 optionLabelProp="label" 1174 optionLabelProp="label"
1155 className="mySelectsDouble" 1175 className="mySelectsDouble"
1156 - style={{ width: 180, color: "#000", height: 40 }} 1176 + style={{ width: 180, color: "#000" ,height:'100%'}}
1157 defaultValue={options.length ? options[0].value : ""} 1177 defaultValue={options.length ? options[0].value : ""}
1158 value={topItem?.cTypeName || ""} 1178 value={topItem?.cTypeName || ""}
1159 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(topItem.sName), 0, 1)} 1179 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(topItem.sName), 0, 1)}
@@ -1214,7 +1234,8 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1214,7 +1234,8 @@ const BoxDesignCompontent = baseProps =&gt; {
1214 <div className={styles.boxTitle}>{doubleTitlieList[index]}</div> 1234 <div className={styles.boxTitle}>{doubleTitlieList[index]}</div>
1215 {item?.selectImage ? ( 1235 {item?.selectImage ? (
1216 <img 1236 <img
1217 - src={item?.selectImage} 1237 + // src={item?.selectImage}
  1238 + src={item?.selectImage ? getImage(item?.selectImage) : ''}
1218 alt={item.value} 1239 alt={item.value}
1219 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }} 1240 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }}
1220 /> 1241 />
@@ -1225,7 +1246,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1225,7 +1246,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1225 <Select 1246 <Select
1226 optionLabelProp="label" 1247 optionLabelProp="label"
1227 className="mySelects" 1248 className="mySelects"
1228 - style={{ width: 180, height: 40 }} 1249 + style={{ width: 180,height:'100%' }}
1229 defaultValue={options.length ? options[0].value : ""} 1250 defaultValue={options.length ? options[0].value : ""}
1230 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} 1251 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
1231 onDropdownVisibleChange={async open => { 1252 onDropdownVisibleChange={async open => {
@@ -1266,7 +1287,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1266,7 +1287,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1266 <Select 1287 <Select
1267 optionLabelProp="label" 1288 optionLabelProp="label"
1268 className="mySelects" 1289 className="mySelects"
1269 - style={{ width: 180, height: 40 }} 1290 + style={{ width: 180 ,height:'100%'}}
1270 defaultValue={options.length ? options[0].value : ""} 1291 defaultValue={options.length ? options[0].value : ""}
1271 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} 1292 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
1272 onDropdownVisibleChange={async open => { 1293 onDropdownVisibleChange={async open => {
@@ -1280,7 +1301,8 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1280,7 +1301,8 @@ const BoxDesignCompontent = baseProps =&gt; {
1280 <div className={styles.boxInput}> 1301 <div className={styles.boxInput}>
1281 {item?.selectImage ? ( 1302 {item?.selectImage ? (
1282 <img 1303 <img
1283 - src={item?.selectImage} 1304 + // src={item?.selectImage}
  1305 + src={item?.selectImage ? getImage(item?.selectImage) : ''}
1284 alt={item.value} 1306 alt={item.value}
1285 style={{ 1307 style={{
1286 width: 40, 1308 width: 40,
@@ -1324,7 +1346,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1324,7 +1346,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1324 <Select 1346 <Select
1325 optionLabelProp="label" 1347 optionLabelProp="label"
1326 className="mySelectsDouble" 1348 className="mySelectsDouble"
1327 - style={{ width: 180, color: "#000", height: 40 }} 1349 + style={{ width: 180, color: "#000",height:'100%' }}
1328 defaultValue={options.length ? options[0].value : ""} 1350 defaultValue={options.length ? options[0].value : ""}
1329 value={item?.sTypeName || ""} 1351 value={item?.sTypeName || ""}
1330 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 0)} 1352 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 0)}
@@ -1382,7 +1404,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1382,7 +1404,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1382 <Select 1404 <Select
1383 optionLabelProp="label" 1405 optionLabelProp="label"
1384 className="mySelectsDouble" 1406 className="mySelectsDouble"
1385 - style={{ width: 180, color: "#000", height: 40 }} 1407 + style={{ width: 180, color: "#000" ,height:'100%'}}
1386 defaultValue={options.length ? options[0].value : ""} 1408 defaultValue={options.length ? options[0].value : ""}
1387 value={item?.cTypeName || ""} 1409 value={item?.cTypeName || ""}
1388 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 1)} 1410 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 1)}
@@ -1446,7 +1468,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1446,7 +1468,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1446 <Select 1468 <Select
1447 optionLabelProp="label" 1469 optionLabelProp="label"
1448 className="mySelects" 1470 className="mySelects"
1449 - style={{ width: 180, height: 40 }} 1471 + style={{ width: 180 ,height:'100%'}}
1450 defaultValue={options.length ? options[0].value : ""} 1472 defaultValue={options.length ? options[0].value : ""}
1451 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} 1473 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
1452 onDropdownVisibleChange={async open => { 1474 onDropdownVisibleChange={async open => {
@@ -1463,7 +1485,8 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1463,7 +1485,8 @@ const BoxDesignCompontent = baseProps =&gt; {
1463 <div className={styles.boxInput}> 1485 <div className={styles.boxInput}>
1464 {item?.selectImage ? ( 1486 {item?.selectImage ? (
1465 <img 1487 <img
1466 - src={item?.selectImage} 1488 + // src={item?.selectImage}
  1489 + src={item?.selectImage ? getImage(item?.selectImage) : ''}
1467 alt={item.value} 1490 alt={item.value}
1468 style={{ 1491 style={{
1469 width: 40, 1492 width: 40,
@@ -1507,7 +1530,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1507,7 +1530,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1507 <Select 1530 <Select
1508 optionLabelProp="label" 1531 optionLabelProp="label"
1509 className="mySelects" 1532 className="mySelects"
1510 - style={{ width: 180, height: 40 }} 1533 + style={{ width: 180 ,height:'100%'}}
1511 defaultValue={options.length ? options[0].value : ""} 1534 defaultValue={options.length ? options[0].value : ""}
1512 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} 1535 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
1513 onDropdownVisibleChange={async open => { 1536 onDropdownVisibleChange={async open => {
@@ -1521,7 +1544,8 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1521,7 +1544,8 @@ const BoxDesignCompontent = baseProps =&gt; {
1521 <div className={styles.boxInput}> 1544 <div className={styles.boxInput}>
1522 {item?.selectImage ? ( 1545 {item?.selectImage ? (
1523 <img 1546 <img
1524 - src={item?.selectImage} 1547 + // src={item?.selectImage}
  1548 + src={item?.selectImage ? getImage(item?.selectImage) : ''}
1525 alt={item.value} 1549 alt={item.value}
1526 style={{ 1550 style={{
1527 width: 40, 1551 width: 40,
@@ -1565,7 +1589,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1565,7 +1589,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1565 <Select 1589 <Select
1566 optionLabelProp="label" 1590 optionLabelProp="label"
1567 className="mySelectsDouble" 1591 className="mySelectsDouble"
1568 - style={{ width: 180, color: "#000", height: 40 }} 1592 + style={{ width: 180, color: "#000" ,height:'100%'}}
1569 defaultValue={options.length ? options[0].value : ""} 1593 defaultValue={options.length ? options[0].value : ""}
1570 value={item?.sTypeName || ""} 1594 value={item?.sTypeName || ""}
1571 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 0)} 1595 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 0)}
@@ -1623,7 +1647,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1623,7 +1647,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1623 <Select 1647 <Select
1624 optionLabelProp="label" 1648 optionLabelProp="label"
1625 className="mySelectsDouble" 1649 className="mySelectsDouble"
1626 - style={{ width: 180, color: "#000", height: 40 }} 1650 + style={{ width: 180, color: "#000" ,height:'100%'}}
1627 defaultValue={options.length ? options[0].value : ""} 1651 defaultValue={options.length ? options[0].value : ""}
1628 value={item?.cTypeName || ""} 1652 value={item?.cTypeName || ""}
1629 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 1)} 1653 onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 1)}
@@ -1687,7 +1711,7 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1687,7 +1711,7 @@ const BoxDesignCompontent = baseProps =&gt; {
1687 <Select 1711 <Select
1688 optionLabelProp="label" 1712 optionLabelProp="label"
1689 className="mySelects" 1713 className="mySelects"
1690 - style={{ width: 180, height: 40 }} 1714 + style={{ width: 180,height:'100%' }}
1691 defaultValue={options.length ? options[0].value : ""} 1715 defaultValue={options.length ? options[0].value : ""}
1692 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} 1716 onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
1693 onDropdownVisibleChange={async open => { 1717 onDropdownVisibleChange={async open => {
@@ -1704,7 +1728,8 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1704,7 +1728,8 @@ const BoxDesignCompontent = baseProps =&gt; {
1704 <div className={styles.boxInput}> 1728 <div className={styles.boxInput}>
1705 {item?.selectImage ? ( 1729 {item?.selectImage ? (
1706 <img 1730 <img
1707 - src={item?.selectImage} 1731 + // src={item?.selectImage}
  1732 + src={item?.selectImage ? getImage(item?.selectImage) : ''}
1708 alt={item.value} 1733 alt={item.value}
1709 style={{ 1734 style={{
1710 width: 40, 1735 width: 40,
@@ -1747,106 +1772,107 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1747,106 +1772,107 @@ const BoxDesignCompontent = baseProps =&gt; {
1747 <div className={styles.content}> 1772 <div className={styles.content}>
1748 {tableColum && tableColum.length 1773 {tableColum && tableColum.length
1749 ? tableColum.map((item, index) => { 1774 ? tableColum.map((item, index) => {
1750 - const uniqueIndex = index + 9;  
1751 - return (  
1752 - <div key={uniqueIndex} className={styles.boxFlex}>  
1753 - <div className={styles.boxInput}>  
1754 - <div className={styles.text} style={{ width: "120px" }}>  
1755 - {item.showName}  
1756 - </div>  
1757 - <Input  
1758 - value={boxList[uniqueIndex]?.value}  
1759 - onChange={e => handleChange(e, uniqueIndex)}  
1760 - onFocus={e => handleFocus(e, uniqueIndex)}  
1761 - onBlur={e => handleBlur(e, uniqueIndex)}  
1762 - readOnly={!boxList[uniqueIndex]?.isEditable}  
1763 - style={{ width: " 80%" }}  
1764 - /> 1775 + const uniqueIndex = index + 9;
  1776 + return (
  1777 + <div key={uniqueIndex} className={styles.boxFlex}>
  1778 + <div className={styles.boxInput}>
  1779 + <div className={styles.text} style={{ width: "120px" }}>
  1780 + {item.showName}
1765 </div> 1781 </div>
  1782 + <Input
  1783 + value={boxList[uniqueIndex]?.value}
  1784 + onChange={e => handleChange(e, uniqueIndex)}
  1785 + onFocus={e => handleFocus(e, uniqueIndex)}
  1786 + onBlur={e => handleBlur(e, uniqueIndex)}
  1787 + readOnly={!boxList[uniqueIndex]?.isEditable}
  1788 + style={{ width: " 80%" }}
  1789 + />
1766 </div> 1790 </div>
1767 - );  
1768 - }) 1791 + </div>
  1792 + );
  1793 + })
1769 : ""} 1794 : ""}
1770 {boxBodyList && boxBodyList.length 1795 {boxBodyList && boxBodyList.length
1771 ? boxBodyList.map((item, index) => { 1796 ? boxBodyList.map((item, index) => {
1772 - const uniqueIndex = index + 9 + tableColum.length; 1797 + const uniqueIndex = index + 9 + tableColum.length;
1773 1798
1774 - return (  
1775 - <div key={uniqueIndex} className={styles.boxFlex}>  
1776 - <div className={styles.boxInput}>  
1777 - <div className={styles.text} style={{ width: "120px" }}>  
1778 - {item.showName}  
1779 - </div>  
1780 - {boxList[uniqueIndex]?.selectImage ? (  
1781 - <img  
1782 - src={boxList[uniqueIndex]?.selectImage}  
1783 - alt={boxList[uniqueIndex].value}  
1784 - style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 120, top: 6, zIndex: 10 }}  
1785 - />  
1786 - ) : (  
1787 - ""  
1788 - )}  
1789 - {isDefaultValue ? <div className={styles.defaultValue}>{boxList[uniqueIndex]?.value}</div> : ""}  
1790 - <Select  
1791 - optionLabelProp="label"  
1792 - className="mySelects"  
1793 - style={{ width: "80%", height: 40 }}  
1794 - defaultValue={boxList[uniqueIndex]?.value}  
1795 - onSelect={(value, option) => handleSelect(value, option, uniqueIndex, 1)}  
1796 - onDropdownVisibleChange={async open => {  
1797 - if (open) {  
1798 - props.getSqlOptions(10); // 盒身  
1799 - }  
1800 - }}  
1801 - >  
1802 - {!loading ? options.map(option => renderOptionWithImage(option)) : ""}  
1803 - </Select> 1799 + return (
  1800 + <div key={uniqueIndex} className={styles.boxFlex}>
  1801 + <div className={styles.boxInput}>
  1802 + <div className={styles.text} style={{ width: "120px" }}>
  1803 + {item.showName}
1804 </div> 1804 </div>
  1805 + {boxList[uniqueIndex]?.selectImage ? (
  1806 + <img
  1807 + // src={boxList[uniqueIndex]?.selectImage}
  1808 + src={boxList[uniqueIndex]?.selectImage ? getImage(boxList[uniqueIndex]?.selectImage) : ''}
  1809 + alt={boxList[uniqueIndex].value}
  1810 + style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 120, top: 6, zIndex: 10 }}
  1811 + />
  1812 + ) : (
  1813 + ""
  1814 + )}
  1815 + {isDefaultValue ? <div className={styles.defaultValue}>{boxList[uniqueIndex]?.value}</div> : ""}
  1816 + <Select
  1817 + optionLabelProp="label"
  1818 + className="mySelects"
  1819 + style={{ width: "80%",height:'100%' }}
  1820 + defaultValue={boxList[uniqueIndex]?.value}
  1821 + onSelect={(value, option) => handleSelect(value, option, uniqueIndex, 1)}
  1822 + onDropdownVisibleChange={async open => {
  1823 + if (open) {
  1824 + props.getSqlOptions(10); // 盒身
  1825 + }
  1826 + }}
  1827 + >
  1828 + {!loading ? options.map(option => renderOptionWithImage(option)) : ""}
  1829 + </Select>
1805 </div> 1830 </div>
1806 - );  
1807 - }) 1831 + </div>
  1832 + );
  1833 + })
1808 : ""} 1834 : ""}
1809 <div className={styles.boxFlexs}> 1835 <div className={styles.boxFlexs}>
1810 {tableDataList && tableDataList.length && boxType !== "8" 1836 {tableDataList && tableDataList.length && boxType !== "8"
1811 ? tableDataList.map((item, index) => { 1837 ? tableDataList.map((item, index) => {
1812 - const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length; 1838 + const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length;
1813 1839
1814 - return (  
1815 - <div key={uniqueIndex} className={styles.boxInputs}>  
1816 - <div className={styles.text}>{item.sName}</div>  
1817 - <Input  
1818 - value={boxList[uniqueIndex]?.value}  
1819 - onChange={e => handleChange(e, uniqueIndex)}  
1820 - onFocus={e => handleFocus(e, uniqueIndex)}  
1821 - onBlur={e => handleBlur(e, uniqueIndex)}  
1822 - readOnly={!boxList[uniqueIndex]?.isEditable}  
1823 - style={{ width: " 60%" }}  
1824 - />  
1825 - </div>  
1826 - );  
1827 - }) 1840 + return (
  1841 + <div key={uniqueIndex} className={styles.boxInputs}>
  1842 + <div className={styles.text}>{item.sName}</div>
  1843 + <Input
  1844 + value={boxList[uniqueIndex]?.value}
  1845 + onChange={e => handleChange(e, uniqueIndex)}
  1846 + onFocus={e => handleFocus(e, uniqueIndex)}
  1847 + onBlur={e => handleBlur(e, uniqueIndex)}
  1848 + readOnly={!boxList[uniqueIndex]?.isEditable}
  1849 + style={{ width: " 60%" }}
  1850 + />
  1851 + </div>
  1852 + );
  1853 + })
1828 : ""} 1854 : ""}
1829 </div> 1855 </div>
1830 1856
1831 <div className={styles.boxFlexs}> 1857 <div className={styles.boxFlexs}>
1832 {doubleLayerList && doubleLayerList.length && boxType === "8" 1858 {doubleLayerList && doubleLayerList.length && boxType === "8"
1833 ? doubleLayerList.map((item, index) => { 1859 ? doubleLayerList.map((item, index) => {
1834 - const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length + tableDataList.length; 1860 + const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length + tableDataList.length;
1835 1861
1836 - return (  
1837 - <div key={uniqueIndex} className={styles.boxInputs}>  
1838 - <div className={styles.text}>{item.sName}</div>  
1839 - <Input  
1840 - value={boxList[uniqueIndex]?.value}  
1841 - onChange={e => handleChange(e, uniqueIndex)}  
1842 - onFocus={e => handleFocus(e, uniqueIndex)}  
1843 - onBlur={e => handleBlur(e, uniqueIndex)}  
1844 - readOnly={!boxList[uniqueIndex]?.isEditable}  
1845 - style={{ width: " 60%" }}  
1846 - />  
1847 - </div>  
1848 - );  
1849 - }) 1862 + return (
  1863 + <div key={uniqueIndex} className={styles.boxInputs}>
  1864 + <div className={styles.text}>{item.sName}</div>
  1865 + <Input
  1866 + value={boxList[uniqueIndex]?.value}
  1867 + onChange={e => handleChange(e, uniqueIndex)}
  1868 + onFocus={e => handleFocus(e, uniqueIndex)}
  1869 + onBlur={e => handleBlur(e, uniqueIndex)}
  1870 + readOnly={!boxList[uniqueIndex]?.isEditable}
  1871 + style={{ width: " 60%" }}
  1872 + />
  1873 + </div>
  1874 + );
  1875 + })
1850 : ""} 1876 : ""}
1851 </div> 1877 </div>
1852 </div> 1878 </div>
src/components/Common/BoxDesignCompontent/svg.js
@@ -392,7 +392,7 @@ const SvgBox = props =&gt; { @@ -392,7 +392,7 @@ const SvgBox = props =&gt; {
392 const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); 392 const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect);
393 xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); 393 xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength));
394 } else if (Number(svgType) === 4) { 394 } else if (Number(svgType) === 4) {
395 - xSvg = (scaledDeep * 2 + scaledWidth) / 2; 395 + xSvg = ((boxHeight * 2 + boxLength) / 2) * scale;
396 } else { 396 } else {
397 xSvg = zbtb?.value; 397 xSvg = zbtb?.value;
398 } 398 }
@@ -4945,7 +4945,7 @@ const SvgBox = props =&gt; { @@ -4945,7 +4945,7 @@ const SvgBox = props =&gt; {
4945 // 将分组添加到 SVG 4945 // 将分组添加到 SVG
4946 svg.appendChild(g); 4946 svg.appendChild(g);
4947 } else { 4947 } else {
4948 - pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); 4948 + pathList.push(createFull(ysbj?.type, scaledHeight, scaledHeight, dYSCW * scale, scaledWidth, 0));
4949 } 4949 }
4950 // 左边 4950 // 左边
4951 if (zxbj?.type && zxbj?.type === "4009") { 4951 if (zxbj?.type && zxbj?.type === "4009") {
@@ -5023,7 +5023,7 @@ const SvgBox = props =&gt; { @@ -5023,7 +5023,7 @@ const SvgBox = props =&gt; {
5023 // 将分组添加到 SVG 5023 // 将分组添加到 SVG
5024 svg.appendChild(g); 5024 svg.appendChild(g);
5025 } else { 5025 } else {
5026 - pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); 5026 + pathList.push(createFull(zxbj?.type, scaledHeight, -scaledHeight, -dZXCW * scale, 0, 0));
5027 } 5027 }
5028 5028
5029 pathList.forEach(x => { 5029 pathList.forEach(x => {