Commit af31c58fd2fcca95d4d46b7b1cf52d9df9c76d0a
1 parent
0a343330
盒型设计
Showing
2 changed files
with
185 additions
and
159 deletions
src/components/Common/BoxDesignCompontent/index.js
| ... | ... | @@ -107,10 +107,15 @@ const BoxDesignCompontent = baseProps => { |
| 107 | 107 | const [boxKey, setBoxKey] = useState(new Date().getTime()); |
| 108 | 108 | const [doubleLayerList, setDoubleLayerList] = useState([]); |
| 109 | 109 | if (!boxVisible) return ""; |
| 110 | + const isEnglish = (str) => { | |
| 111 | + return /^[A-Za-z]+$/.test(str); | |
| 112 | + } | |
| 110 | 113 | // 1️⃣ 只负责 tableColum |
| 111 | 114 | useEffect(() => { |
| 112 | 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 | 119 | const newTableColum = tableData |
| 115 | 120 | .filter(item => item.bVisible) // 先过滤可见 |
| 116 | 121 | .map(item => ({ |
| ... | ... | @@ -122,9 +127,18 @@ const BoxDesignCompontent = baseProps => { |
| 122 | 127 | })) |
| 123 | 128 | .filter( |
| 124 | 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 | 143 | setTableColum(newTableColum); |
| 130 | 144 | }, [tableData]); |
| ... | ... | @@ -133,6 +147,8 @@ const BoxDesignCompontent = baseProps => { |
| 133 | 147 | useEffect(() => { |
| 134 | 148 | if (!tableData?.length) return; |
| 135 | 149 | |
| 150 | + const keywords = ['盒身', 'Box Body']; | |
| 151 | + | |
| 136 | 152 | const bodyList = tableData |
| 137 | 153 | .filter(item => item.bVisible) |
| 138 | 154 | .map(item => ({ |
| ... | ... | @@ -140,9 +156,11 @@ const BoxDesignCompontent = baseProps => { |
| 140 | 156 | isEditable: true, |
| 141 | 157 | isSelect: false, |
| 142 | 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 | 165 | setBoxBodyList(bodyList); |
| 148 | 166 | }, [tableData]); |
| ... | ... | @@ -150,6 +168,15 @@ const BoxDesignCompontent = baseProps => { |
| 150 | 168 | // 3️⃣ 只负责 tableDataList 和 tableDataLists |
| 151 | 169 | useEffect(() => { |
| 152 | 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 | 181 | const newList = tableData |
| 155 | 182 | .filter(item => item.bVisible) |
| ... | ... | @@ -160,15 +187,17 @@ const BoxDesignCompontent = baseProps => { |
| 160 | 187 | selectImage: null, |
| 161 | 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 | 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 | 201 | setTableDataList(newList); |
| 173 | 202 | setTableDataLists(newList); |
| 174 | 203 | }, [tableData]); |
| ... | ... | @@ -322,17 +351,17 @@ const BoxDesignCompontent = baseProps => { |
| 322 | 351 | const orderLength = slaveData.find(item => item.sCode === "dCHC")?.iValue; |
| 323 | 352 | const orderWidth = slaveData.find(item => item.sCode === "dCHK")?.iValue; |
| 324 | 353 | newBoxList.forEach((item, index) => { |
| 325 | - if (item.sName === "盒身") { | |
| 354 | + if (item.sName.trim() === "盒身" || item.sName.trim() === "Box Body") { | |
| 326 | 355 | newBoxList[index].value = masterData.sBoxBody; |
| 327 | 356 | newBoxList[index].selectImage = masterData.sMakeUpPath; |
| 328 | 357 | newBoxList[index].type = masterData.sTypes; |
| 329 | - } else if (item.sName === "盒长") { | |
| 358 | + } else if (item.sName.trim() === "盒长" || item.sName.trim() === "Box Length") { | |
| 330 | 359 | newBoxList[index].value = masterData.dBoxLength; |
| 331 | - } else if (item.sName === "盒宽") { | |
| 360 | + } else if (item.sName.trim() === "盒宽" || item.sName.trim() === "Box Width") { | |
| 332 | 361 | newBoxList[index].value = masterData.dBoxWidth; |
| 333 | - } else if (item.sName === "盒高") { | |
| 362 | + } else if (item.sName.trim() === "盒高" || item.sName.trim() === "Box Height") { | |
| 334 | 363 | newBoxList[index].value = masterData.dBoxHeight; |
| 335 | - } else if (item.sName === "盒型名称") { | |
| 364 | + } else if (item.sName === "盒型名称" || item.sName.trim() === "Box Name") { | |
| 336 | 365 | newBoxList[index].value = masterData.sName; |
| 337 | 366 | } else if (item.sName === "首盒长") { |
| 338 | 367 | newBoxList[index].value = headLength; |
| ... | ... | @@ -524,10 +553,10 @@ const BoxDesignCompontent = baseProps => { |
| 524 | 553 | let updatedBoxList = [...boxList]; |
| 525 | 554 | if (doubleType === 0) { |
| 526 | 555 | updatedBoxList[index].sTypeName = Number(name) === 0 ? "矩形" : "梯形"; |
| 527 | - updatedBoxList[index].sType = Number(name); | |
| 556 | + updatedBoxList[index].sType = Number(name) | |
| 528 | 557 | } else { |
| 529 | 558 | updatedBoxList[index].cTypeName = Number(name) === 0 ? "矩形" : "梯形"; |
| 530 | - updatedBoxList[index].cType = Number(name); | |
| 559 | + updatedBoxList[index].cType = Number(name) | |
| 531 | 560 | } |
| 532 | 561 | setBoxList(updatedBoxList); |
| 533 | 562 | }; |
| ... | ... | @@ -536,23 +565,23 @@ const BoxDesignCompontent = baseProps => { |
| 536 | 565 | // const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&scale=0.1&sModelsId=100&token=${props.token}`; |
| 537 | 566 | // return imageUrl; |
| 538 | 567 | // }; |
| 539 | - const removeExtension = filename => { | |
| 540 | - const lastDotIndex = filename.lastIndexOf("."); | |
| 568 | + const removeExtension = (filename) => { | |
| 569 | + const lastDotIndex = filename.lastIndexOf('.'); | |
| 541 | 570 | if (lastDotIndex === -1) { |
| 542 | 571 | // 如果字符串中没有点,则返回原字符串 |
| 543 | 572 | return filename; |
| 544 | 573 | } |
| 545 | 574 | return filename.substring(0, lastDotIndex); |
| 546 | - }; | |
| 547 | - const getImage = sName => { | |
| 575 | + } | |
| 576 | + const getImage = (sName) => { | |
| 548 | 577 | const fileName = removeExtension(sName); |
| 549 | 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 | 582 | const renderOptionWithImage = option => { |
| 554 | 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 | 585 | <div style={{ display: "flex", alignItems: "center" }}> |
| 557 | 586 | {option.sMakeUpPath ? <img src={getImage(option.sMakeUpPath)} style={{ width: 24, height: 24, marginRight: 8 }} /> : ""} |
| 558 | 587 | <span>{option.sName}</span> |
| ... | ... | @@ -588,18 +617,8 @@ const BoxDesignCompontent = baseProps => { |
| 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 | 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 | 622 | boxList.forEach((item, index) => { |
| 604 | 623 | const i = findList.findIndex(i => i.name === item.sName); |
| 605 | 624 | const slave = slaveData.find(z => z.sCode === findList[i]?.value); |
| ... | ... | @@ -618,18 +637,18 @@ const BoxDesignCompontent = baseProps => { |
| 618 | 637 | bVisible: item.value ? true : false, |
| 619 | 638 | sParentId: masterData.sId, |
| 620 | 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 | 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 | 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 | 653 | // if (item.value !== "") { |
| 635 | 654 | newSlaveData.push(data); |
| ... | ... | @@ -649,12 +668,12 @@ const BoxDesignCompontent = baseProps => { |
| 649 | 668 | // 计算展长公式 sLengthFormula |
| 650 | 669 | let sLengthFormula = ""; |
| 651 | 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 | 672 | if (boxType === "8") { |
| 654 | 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 | 677 | const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); |
| 659 | 678 | const zscw = boxList.find(x => x.sName === "左(上)插位组件"); |
| 660 | 679 | const yscw = boxList.find(x => x.sName === "右(上)插位组件"); |
| ... | ... | @@ -977,13 +996,13 @@ const BoxDesignCompontent = baseProps => { |
| 977 | 996 | // 存储盒身数据 主表 |
| 978 | 997 | const newMasterData = { |
| 979 | 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 | 1006 | sLengthFormula: masterData.sLengthFormula || sLengthFormula, |
| 988 | 1007 | sWidthFormula: masterData.sWidthFormula || sWidthFormula, |
| 989 | 1008 | }; |
| ... | ... | @@ -1044,7 +1063,8 @@ const BoxDesignCompontent = baseProps => { |
| 1044 | 1063 | <div className={styles.boxTitle}>{topItem.sName}</div> |
| 1045 | 1064 | {topItem?.selectImage ? ( |
| 1046 | 1065 | <img |
| 1047 | - src={topItem?.selectImage} | |
| 1066 | + // src={topItem?.selectImage} | |
| 1067 | + src={topItem?.selectImage ? getImage(topItem?.selectImage) : ''} | |
| 1048 | 1068 | alt={topItem.value} |
| 1049 | 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 => { |
| 1055 | 1075 | <Select |
| 1056 | 1076 | optionLabelProp="label" |
| 1057 | 1077 | className="mySelects" |
| 1058 | - style={{ width: 180, height: 40 }} | |
| 1078 | + style={{ width: 180 ,height:'100%'}} | |
| 1059 | 1079 | defaultValue={options.length ? options[0].value : ""} |
| 1060 | 1080 | onSelect={(value, option) => handleSelect(value, option, index, 0)} |
| 1061 | 1081 | onDropdownVisibleChange={async open => { |
| ... | ... | @@ -1095,7 +1115,7 @@ const BoxDesignCompontent = baseProps => { |
| 1095 | 1115 | <Select |
| 1096 | 1116 | optionLabelProp="label" |
| 1097 | 1117 | className="mySelectsDouble" |
| 1098 | - style={{ width: 180, color: "#000", height: 40 }} | |
| 1118 | + style={{ width: 180, color: "#000",height:'100%' }} | |
| 1099 | 1119 | defaultValue={options.length ? options[0].value : ""} |
| 1100 | 1120 | value={topItem?.sTypeName || ""} |
| 1101 | 1121 | onSelect={(value, option) => handleSelects(value, option, findIndexBySname(topItem.sName), 0, 0)} |
| ... | ... | @@ -1153,7 +1173,7 @@ const BoxDesignCompontent = baseProps => { |
| 1153 | 1173 | <Select |
| 1154 | 1174 | optionLabelProp="label" |
| 1155 | 1175 | className="mySelectsDouble" |
| 1156 | - style={{ width: 180, color: "#000", height: 40 }} | |
| 1176 | + style={{ width: 180, color: "#000" ,height:'100%'}} | |
| 1157 | 1177 | defaultValue={options.length ? options[0].value : ""} |
| 1158 | 1178 | value={topItem?.cTypeName || ""} |
| 1159 | 1179 | onSelect={(value, option) => handleSelects(value, option, findIndexBySname(topItem.sName), 0, 1)} |
| ... | ... | @@ -1214,7 +1234,8 @@ const BoxDesignCompontent = baseProps => { |
| 1214 | 1234 | <div className={styles.boxTitle}>{doubleTitlieList[index]}</div> |
| 1215 | 1235 | {item?.selectImage ? ( |
| 1216 | 1236 | <img |
| 1217 | - src={item?.selectImage} | |
| 1237 | + // src={item?.selectImage} | |
| 1238 | + src={item?.selectImage ? getImage(item?.selectImage) : ''} | |
| 1218 | 1239 | alt={item.value} |
| 1219 | 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 => { |
| 1225 | 1246 | <Select |
| 1226 | 1247 | optionLabelProp="label" |
| 1227 | 1248 | className="mySelects" |
| 1228 | - style={{ width: 180, height: 40 }} | |
| 1249 | + style={{ width: 180,height:'100%' }} | |
| 1229 | 1250 | defaultValue={options.length ? options[0].value : ""} |
| 1230 | 1251 | onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} |
| 1231 | 1252 | onDropdownVisibleChange={async open => { |
| ... | ... | @@ -1266,7 +1287,7 @@ const BoxDesignCompontent = baseProps => { |
| 1266 | 1287 | <Select |
| 1267 | 1288 | optionLabelProp="label" |
| 1268 | 1289 | className="mySelects" |
| 1269 | - style={{ width: 180, height: 40 }} | |
| 1290 | + style={{ width: 180 ,height:'100%'}} | |
| 1270 | 1291 | defaultValue={options.length ? options[0].value : ""} |
| 1271 | 1292 | onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} |
| 1272 | 1293 | onDropdownVisibleChange={async open => { |
| ... | ... | @@ -1280,7 +1301,8 @@ const BoxDesignCompontent = baseProps => { |
| 1280 | 1301 | <div className={styles.boxInput}> |
| 1281 | 1302 | {item?.selectImage ? ( |
| 1282 | 1303 | <img |
| 1283 | - src={item?.selectImage} | |
| 1304 | + // src={item?.selectImage} | |
| 1305 | + src={item?.selectImage ? getImage(item?.selectImage) : ''} | |
| 1284 | 1306 | alt={item.value} |
| 1285 | 1307 | style={{ |
| 1286 | 1308 | width: 40, |
| ... | ... | @@ -1324,7 +1346,7 @@ const BoxDesignCompontent = baseProps => { |
| 1324 | 1346 | <Select |
| 1325 | 1347 | optionLabelProp="label" |
| 1326 | 1348 | className="mySelectsDouble" |
| 1327 | - style={{ width: 180, color: "#000", height: 40 }} | |
| 1349 | + style={{ width: 180, color: "#000",height:'100%' }} | |
| 1328 | 1350 | defaultValue={options.length ? options[0].value : ""} |
| 1329 | 1351 | value={item?.sTypeName || ""} |
| 1330 | 1352 | onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 0)} |
| ... | ... | @@ -1382,7 +1404,7 @@ const BoxDesignCompontent = baseProps => { |
| 1382 | 1404 | <Select |
| 1383 | 1405 | optionLabelProp="label" |
| 1384 | 1406 | className="mySelectsDouble" |
| 1385 | - style={{ width: 180, color: "#000", height: 40 }} | |
| 1407 | + style={{ width: 180, color: "#000" ,height:'100%'}} | |
| 1386 | 1408 | defaultValue={options.length ? options[0].value : ""} |
| 1387 | 1409 | value={item?.cTypeName || ""} |
| 1388 | 1410 | onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 1)} |
| ... | ... | @@ -1446,7 +1468,7 @@ const BoxDesignCompontent = baseProps => { |
| 1446 | 1468 | <Select |
| 1447 | 1469 | optionLabelProp="label" |
| 1448 | 1470 | className="mySelects" |
| 1449 | - style={{ width: 180, height: 40 }} | |
| 1471 | + style={{ width: 180 ,height:'100%'}} | |
| 1450 | 1472 | defaultValue={options.length ? options[0].value : ""} |
| 1451 | 1473 | onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} |
| 1452 | 1474 | onDropdownVisibleChange={async open => { |
| ... | ... | @@ -1463,7 +1485,8 @@ const BoxDesignCompontent = baseProps => { |
| 1463 | 1485 | <div className={styles.boxInput}> |
| 1464 | 1486 | {item?.selectImage ? ( |
| 1465 | 1487 | <img |
| 1466 | - src={item?.selectImage} | |
| 1488 | + // src={item?.selectImage} | |
| 1489 | + src={item?.selectImage ? getImage(item?.selectImage) : ''} | |
| 1467 | 1490 | alt={item.value} |
| 1468 | 1491 | style={{ |
| 1469 | 1492 | width: 40, |
| ... | ... | @@ -1507,7 +1530,7 @@ const BoxDesignCompontent = baseProps => { |
| 1507 | 1530 | <Select |
| 1508 | 1531 | optionLabelProp="label" |
| 1509 | 1532 | className="mySelects" |
| 1510 | - style={{ width: 180, height: 40 }} | |
| 1533 | + style={{ width: 180 ,height:'100%'}} | |
| 1511 | 1534 | defaultValue={options.length ? options[0].value : ""} |
| 1512 | 1535 | onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} |
| 1513 | 1536 | onDropdownVisibleChange={async open => { |
| ... | ... | @@ -1521,7 +1544,8 @@ const BoxDesignCompontent = baseProps => { |
| 1521 | 1544 | <div className={styles.boxInput}> |
| 1522 | 1545 | {item?.selectImage ? ( |
| 1523 | 1546 | <img |
| 1524 | - src={item?.selectImage} | |
| 1547 | + // src={item?.selectImage} | |
| 1548 | + src={item?.selectImage ? getImage(item?.selectImage) : ''} | |
| 1525 | 1549 | alt={item.value} |
| 1526 | 1550 | style={{ |
| 1527 | 1551 | width: 40, |
| ... | ... | @@ -1565,7 +1589,7 @@ const BoxDesignCompontent = baseProps => { |
| 1565 | 1589 | <Select |
| 1566 | 1590 | optionLabelProp="label" |
| 1567 | 1591 | className="mySelectsDouble" |
| 1568 | - style={{ width: 180, color: "#000", height: 40 }} | |
| 1592 | + style={{ width: 180, color: "#000" ,height:'100%'}} | |
| 1569 | 1593 | defaultValue={options.length ? options[0].value : ""} |
| 1570 | 1594 | value={item?.sTypeName || ""} |
| 1571 | 1595 | onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 0)} |
| ... | ... | @@ -1623,7 +1647,7 @@ const BoxDesignCompontent = baseProps => { |
| 1623 | 1647 | <Select |
| 1624 | 1648 | optionLabelProp="label" |
| 1625 | 1649 | className="mySelectsDouble" |
| 1626 | - style={{ width: 180, color: "#000", height: 40 }} | |
| 1650 | + style={{ width: 180, color: "#000" ,height:'100%'}} | |
| 1627 | 1651 | defaultValue={options.length ? options[0].value : ""} |
| 1628 | 1652 | value={item?.cTypeName || ""} |
| 1629 | 1653 | onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 1)} |
| ... | ... | @@ -1687,7 +1711,7 @@ const BoxDesignCompontent = baseProps => { |
| 1687 | 1711 | <Select |
| 1688 | 1712 | optionLabelProp="label" |
| 1689 | 1713 | className="mySelects" |
| 1690 | - style={{ width: 180, height: 40 }} | |
| 1714 | + style={{ width: 180,height:'100%' }} | |
| 1691 | 1715 | defaultValue={options.length ? options[0].value : ""} |
| 1692 | 1716 | onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)} |
| 1693 | 1717 | onDropdownVisibleChange={async open => { |
| ... | ... | @@ -1704,7 +1728,8 @@ const BoxDesignCompontent = baseProps => { |
| 1704 | 1728 | <div className={styles.boxInput}> |
| 1705 | 1729 | {item?.selectImage ? ( |
| 1706 | 1730 | <img |
| 1707 | - src={item?.selectImage} | |
| 1731 | + // src={item?.selectImage} | |
| 1732 | + src={item?.selectImage ? getImage(item?.selectImage) : ''} | |
| 1708 | 1733 | alt={item.value} |
| 1709 | 1734 | style={{ |
| 1710 | 1735 | width: 40, |
| ... | ... | @@ -1747,106 +1772,107 @@ const BoxDesignCompontent = baseProps => { |
| 1747 | 1772 | <div className={styles.content}> |
| 1748 | 1773 | {tableColum && tableColum.length |
| 1749 | 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 | 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 | 1790 | </div> |
| 1767 | - ); | |
| 1768 | - }) | |
| 1791 | + </div> | |
| 1792 | + ); | |
| 1793 | + }) | |
| 1769 | 1794 | : ""} |
| 1770 | 1795 | {boxBodyList && boxBodyList.length |
| 1771 | 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 | 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 | 1830 | </div> |
| 1806 | - ); | |
| 1807 | - }) | |
| 1831 | + </div> | |
| 1832 | + ); | |
| 1833 | + }) | |
| 1808 | 1834 | : ""} |
| 1809 | 1835 | <div className={styles.boxFlexs}> |
| 1810 | 1836 | {tableDataList && tableDataList.length && boxType !== "8" |
| 1811 | 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 | 1855 | </div> |
| 1830 | 1856 | |
| 1831 | 1857 | <div className={styles.boxFlexs}> |
| 1832 | 1858 | {doubleLayerList && doubleLayerList.length && boxType === "8" |
| 1833 | 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 | 1877 | </div> |
| 1852 | 1878 | </div> | ... | ... |
src/components/Common/BoxDesignCompontent/svg.js
| ... | ... | @@ -392,7 +392,7 @@ const SvgBox = props => { |
| 392 | 392 | const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); |
| 393 | 393 | xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); |
| 394 | 394 | } else if (Number(svgType) === 4) { |
| 395 | - xSvg = (scaledDeep * 2 + scaledWidth) / 2; | |
| 395 | + xSvg = ((boxHeight * 2 + boxLength) / 2) * scale; | |
| 396 | 396 | } else { |
| 397 | 397 | xSvg = zbtb?.value; |
| 398 | 398 | } |
| ... | ... | @@ -4945,7 +4945,7 @@ const SvgBox = props => { |
| 4945 | 4945 | // 将分组添加到 SVG |
| 4946 | 4946 | svg.appendChild(g); |
| 4947 | 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 | 4951 | if (zxbj?.type && zxbj?.type === "4009") { |
| ... | ... | @@ -5023,7 +5023,7 @@ const SvgBox = props => { |
| 5023 | 5023 | // 将分组添加到 SVG |
| 5024 | 5024 | svg.appendChild(g); |
| 5025 | 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 | 5029 | pathList.forEach(x => { | ... | ... |