Commit 7f17dfc3a02152d303e03e96a26eb0ce820df9c5

Authored by 陈鑫涛
1 parent 676f1770

快速报价app

Too many changes to show.

To preserve performance only 2 of 6 files are displayed.

src/mobile/components/SelectInput.jsx
@@ -15,22 +15,20 @@ const SelectInput = props => { @@ -15,22 +15,20 @@ const SelectInput = props => {
15 const [searchValue, setSearchValue] = useState(""); 15 const [searchValue, setSearchValue] = useState("");
16 const [visible, setVisible] = useState(false); 16 const [visible, setVisible] = useState(false);
17 const { sId } = props.itemDetail || {}; 17 const { sId } = props.itemDetail || {};
18 - const { viewRow, itemDetail, sModelsId, sValue, name, id, No, quotationData, showDropDown } = props || {}; 18 + const { tableName, viewRow, itemDetail, sModelsId, sValue, name, id, No, quotationData, showDropDown } = props || {};
  19 + const { masterData } = props.state;
19 const [bCanInput, setBCanInput] = useState(props.bCanInput); 20 const [bCanInput, setBCanInput] = useState(props.bCanInput);
20 const { bReadonly } = itemDetail || {}; 21 const { bReadonly } = itemDetail || {};
21 - console.log("🚀 ~ formDatassss:", bReadonly);  
22 -  
23 // useEffect(() => { 22 // useEffect(() => {
24 // setValue(props.sValue || ""); // 动态更新 value 23 // setValue(props.sValue || ""); // 动态更新 value
25 // }, [props.sValue]); 24 // }, [props.sValue]);
26 useEffect(() => { 25 useEffect(() => {
27 - if (!itemDetail) return;  
28 - console.log(itemDetail.sName, 'viewRowNew'); 26 + if (!itemDetail) return;
  27 + console.log(itemDetail, tableName, "viewRowNew");
29 28
30 - const viewRowNew = itemDetail.sName ? viewRow?.[itemDetail.sName] : "";  
31 - console.log("🚀 ~ useEffect ~ viewRowNew:", viewRowNew);  
32 - setValue(viewRowNew || ""); // 动态更新 value  
33 -}, [itemDetail, itemDetail?.sName, viewRow]); 29 + const viewRowNew = itemDetail.sName ? viewRow?.[itemDetail.sName] : "";
  30 + setValue(viewRowNew || ""); // 动态更新 value
  31 + }, [itemDetail, itemDetail?.sName, viewRow]);
34 const [columns, setColumns] = useState([]); 32 const [columns, setColumns] = useState([]);
35 const [coplyColumns, setCopyColumns] = useState(columns); 33 const [coplyColumns, setCopyColumns] = useState(columns);
36 const getSqlDropDownData = async searchValue => { 34 const getSqlDropDownData = async searchValue => {
@@ -46,7 +44,7 @@ const SelectInput = props => { @@ -46,7 +44,7 @@ const SelectInput = props => {
46 commonServices.postValueService(props.app.token, body, url).then(res => { 44 commonServices.postValueService(props.app.token, body, url).then(res => {
47 if (res.data.code === 1) { 45 if (res.data.code === 1) {
48 const list = res.data.dataset.rows?.map(item => ({ 46 const list = res.data.dataset.rows?.map(item => ({
49 - label: item.sCustomerName || item.sName || item.sProcessName || item.sColorName, 47 + label: item.sCustomerName || item.sName || item.sProcessName || item.sColorName || item.sMaterialsName,
50 value: item.sId || item.sSlaveId, 48 value: item.sId || item.sSlaveId,
51 })); 49 }));
52 setColumns(list); 50 setColumns(list);
@@ -84,6 +82,8 @@ const SelectInput = props => { @@ -84,6 +82,8 @@ const SelectInput = props => {
84 debouncedChangeOption(val); 82 debouncedChangeOption(val);
85 }; 83 };
86 useEffect(() => { 84 useEffect(() => {
  85 + console.log("🚀 ~ useEffect ~ itemDetailssss:", itemDetail)
  86 +
87 if (!visible) return; 87 if (!visible) return;
88 let { sDropDownType } = itemDetail; 88 let { sDropDownType } = itemDetail;
89 if (sDropDownType === "sql") { 89 if (sDropDownType === "sql") {
@@ -105,8 +105,6 @@ const SelectInput = props => { @@ -105,8 +105,6 @@ const SelectInput = props => {
105 useCallback; 105 useCallback;
106 106
107 const clickBtn = () => { 107 const clickBtn = () => {
108 - console.log(itemDetail, "clickBtn");  
109 -  
110 setVisible(true); 108 setVisible(true);
111 }; 109 };
112 return ( 110 return (
@@ -117,7 +115,13 @@ const SelectInput = props => { @@ -117,7 +115,13 @@ const SelectInput = props => {
117 value={value} 115 value={value}
118 onChange={val => { 116 onChange={val => {
119 setValue(val); 117 setValue(val);
120 - props.setState(pre => ({ ...pre,[itemDetail.sName]:val})); 118 + // 如果是master
  119 + if (tableName === "master") {
  120 + masterData[itemDetail.sName] = val;
  121 + props.setState(pre => ({ ...pre, masterData }));
  122 + } else {
  123 + props.setState(pre => ({ ...pre, [itemDetail.sName]: val }));
  124 + }
121 }} 125 }}
122 readOnly={bReadonly} 126 readOnly={bReadonly}
123 /> 127 />
src/mobile/quotation/detailNew.jsx
@@ -896,16 +896,23 @@ const QuickQuoteEvent = props => { @@ -896,16 +896,23 @@ const QuickQuoteEvent = props => {
896 masterConfig: masterConfig && masterConfig.length ? masterConfig[0] : {}, 896 masterConfig: masterConfig && masterConfig.length ? masterConfig[0] : {},
897 }; 897 };
898 }; 898 };
  899 +const getProps = props => {
  900 + const { state } = props;
899 901
  902 + return {
  903 + ...props,
  904 + };
  905 +};
900 const QuotationAllprogressDetail = baseProps => { 906 const QuotationAllprogressDetail = baseProps => {
901 // const props = QuickQuoteEvent(baseProps); 907 // const props = QuickQuoteEvent(baseProps);
902 const [state, setState] = useState(JsonData.state); 908 const [state, setState] = useState(JsonData.state);
903 - const props = { 909 + const propss = {
904 ...baseProps, 910 ...baseProps,
905 ...JsonData, 911 ...JsonData,
906 setState, 912 setState,
907 state, 913 state,
908 }; 914 };
  915 + const props = getProps(propss);
909 return ( 916 return (
910 <div className={styles.quotationDetailBox}> 917 <div className={styles.quotationDetailBox}>
911 <QuotationDetail {...props} /> 918 <QuotationDetail {...props} />
@@ -914,10 +921,9 @@ const QuotationAllprogressDetail = baseProps =&gt; { @@ -914,10 +921,9 @@ const QuotationAllprogressDetail = baseProps =&gt; {
914 }; 921 };
915 922
916 const QuotationDetail = props => { 923 const QuotationDetail = props => {
917 - const { location, app, sModelsId, state, masterData, selectedNode = {} } = props;  
918 - console.log("🚀 ~ QuotationDetail:", props); 924 + const { location, app, sModelsId, state, selectedNode = {} } = props;
919 const { token } = app; 925 const { token } = app;
920 - const { formData = [], masterConfig } = state || {}; 926 + const { formData = [], masterConfig, slaveRowData, masterData } = state || {};
921 const { quotationData } = JSON.parse(location.state) || {}; 927 const { quotationData } = JSON.parse(location.state) || {};
922 if (!masterConfig) return; 928 if (!masterConfig) return;
923 //masterData 主表数据 929 //masterData 主表数据
@@ -931,7 +937,6 @@ const QuotationDetail = props =&gt; { @@ -931,7 +937,6 @@ const QuotationDetail = props =&gt; {
931 viewRow: { ...masterData, sProductClassifyId: selectedNode.sId }, 937 viewRow: { ...masterData, sProductClassifyId: selectedNode.sId },
932 tableName: "master", 938 tableName: "master",
933 }; 939 };
934 - console.log("🚀 ~ viewProps:", viewProps);  
935 940
936 return ( 941 return (
937 <div> 942 <div>
@@ -947,64 +952,48 @@ const QuotationDetail = props =&gt; { @@ -947,64 +952,48 @@ const QuotationDetail = props =&gt; {
947 ); 952 );
948 }; 953 };
949 const MasterComponent = props => { 954 const MasterComponent = props => {
950 - console.log("🚀 ~ MasterComponent:", props);  
951 const { viewConfigs, masterData } = props; 955 const { viewConfigs, masterData } = props;
952 956
953 const customer = viewConfigs?.find(x => x.sName === "sCustomerName") || {}; 957 const customer = viewConfigs?.find(x => x.sName === "sCustomerName") || {};
954 const customerProps = { 958 const customerProps = {
955 ...props, 959 ...props,
956 itemDetail: customer, 960 itemDetail: customer,
957 - sValue: masterData.sCustomerName,  
958 - id: masterData.sCustomerId,  
959 - No: masterData.sCustomerNo,  
960 }; 961 };
961 const product = viewConfigs?.find(x => x.sName === "sProductName") || {}; 962 const product = viewConfigs?.find(x => x.sName === "sProductName") || {};
962 const productProps = { 963 const productProps = {
963 ...props, 964 ...props,
964 itemDetail: product, 965 itemDetail: product,
965 - bCanInput: true,  
966 - sValue: masterData.sProductName,  
967 }; 966 };
968 const dLength = viewConfigs?.find(x => x.sName === "dLength") || {}; 967 const dLength = viewConfigs?.find(x => x.sName === "dLength") || {};
969 968
970 const dLengthProps = { 969 const dLengthProps = {
971 ...props, 970 ...props,
972 itemDetail: dLength, 971 itemDetail: dLength,
973 - bCanInput: true,  
974 - sValue: masterData.dLength,  
975 }; 972 };
976 const dWidth = viewConfigs?.find(x => x.sName === "dWidth") || {}; 973 const dWidth = viewConfigs?.find(x => x.sName === "dWidth") || {};
977 const dWidthProps = { 974 const dWidthProps = {
978 ...props, 975 ...props,
979 itemDetail: dWidth, 976 itemDetail: dWidth,
980 - bCanInput: true,  
981 - sValue: masterData.dWidth,  
982 }; 977 };
983 const dHeight = viewConfigs?.find(x => x.sName === "dHeight") || {}; 978 const dHeight = viewConfigs?.find(x => x.sName === "dHeight") || {};
984 const dHeightProps = { 979 const dHeightProps = {
985 ...props, 980 ...props,
986 itemDetail: dHeight, 981 itemDetail: dHeight,
987 - bCanInput: true,  
988 - sValue: masterData.dHeight,  
989 }; 982 };
990 const dProductQty = viewConfigs?.find(x => x.sName === "dProductQty") || {}; 983 const dProductQty = viewConfigs?.find(x => x.sName === "dProductQty") || {};
991 const dProductQtyProps = { 984 const dProductQtyProps = {
992 ...props, 985 ...props,
993 itemDetail: dProductQty, 986 itemDetail: dProductQty,
994 - bCanInput: true,  
995 - sValue: masterData.dProductQty,  
996 }; 987 };
997 const sProductUnit = viewConfigs?.find(x => x.sName === "sProductUnit") || {}; 988 const sProductUnit = viewConfigs?.find(x => x.sName === "sProductUnit") || {};
998 const sProductUnitProps = { 989 const sProductUnitProps = {
999 ...props, 990 ...props,
1000 itemDetail: sProductUnit, 991 itemDetail: sProductUnit,
1001 - sValue: masterData.sProductUnit,  
1002 }; 992 };
1003 const sDeliverName = viewConfigs?.find(x => x.sName === "sDeliverName") || {}; 993 const sDeliverName = viewConfigs?.find(x => x.sName === "sDeliverName") || {};
1004 const sDeliverNameProps = { 994 const sDeliverNameProps = {
1005 ...props, 995 ...props,
1006 itemDetail: sDeliverName, 996 itemDetail: sDeliverName,
1007 - sValue: masterData.sDeliverName,  
1008 }; 997 };
1009 const baseProps = { 998 const baseProps = {
1010 ...props, 999 ...props,
@@ -1097,15 +1086,16 @@ const QuotationTabs = props =&gt; { @@ -1097,15 +1086,16 @@ const QuotationTabs = props =&gt; {
1097 const BoxComponent = props => { 1086 const BoxComponent = props => {
1098 const { state, boxModel } = props; 1087 const { state, boxModel } = props;
1099 const { activeKey, slaveConfig, masterData, selectedNode, boxConfig, downAbleConfigs = [], slaveData } = state || {}; 1088 const { activeKey, slaveConfig, masterData, selectedNode, boxConfig, downAbleConfigs = [], slaveData } = state || {};
1100 - console.log("🚀 ~ BoxComponent:", slaveData);  
1101 const { sModelsId } = props; 1089 const { sModelsId } = props;
1102 const [selectList, setSelectList] = useState([]); 1090 const [selectList, setSelectList] = useState([]);
1103 const [boxTypeList, setBoxTypeList] = useState([]); 1091 const [boxTypeList, setBoxTypeList] = useState([]);
1104 const [searchValue, setSearchValue] = useState(""); 1092 const [searchValue, setSearchValue] = useState("");
1105 - const [slaveRowData, setSlaveRowData] = useState(null);  
1106 const [boxPopup, setBoxPopup] = useState(false); 1093 const [boxPopup, setBoxPopup] = useState(false);
1107 const [boxsList, setBoxsList] = useState([]); 1094 const [boxsList, setBoxsList] = useState([]);
1108 const [selected, setSelected] = useState(null); 1095 const [selected, setSelected] = useState(null);
  1096 + const slaveRowDatas = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {};
  1097 + const [slaveRowData, setSlaveRowData] = useState(slaveRowDatas);
  1098 +
1109 // 获取盒型信息 1099 // 获取盒型信息
1110 useEffect(() => { 1100 useEffect(() => {
1111 const sId = "17428091410008594700322758474000"; 1101 const sId = "17428091410008594700322758474000";
@@ -1288,21 +1278,26 @@ const BoxComponent = props =&gt; { @@ -1288,21 +1278,26 @@ const BoxComponent = props =&gt; {
1288 const upViewProps20 = getUpViewPropsByITag(20); 1278 const upViewProps20 = getUpViewPropsByITag(20);
1289 1279
1290 // 后道参数 1280 // 后道参数
  1281 + const { sBackProcessData } = slaveRowData || [];
  1282 + const downViewConfigs = downAbleConfigs
  1283 + .filter(item => item.sPartsName === boxModel || !item.sPartsName)
  1284 + .map((item, i) => {
  1285 + return {
  1286 + ...item,
  1287 + isSelect: sBackProcessData.length && sBackProcessData[i].sId ? true : false,
  1288 + };
  1289 + });
  1290 +
1291 const downViewProps = { 1291 const downViewProps = {
1292 ...props, 1292 ...props,
1293 - viewConfigs: downAbleConfigs  
1294 - .filter(item => item.sPartsName === boxModel || !item.sPartsName)  
1295 - .map(item => {  
1296 - return {  
1297 - ...item,  
1298 - isSelect: false,  
1299 - };  
1300 - }), 1293 + viewConfigs: downViewConfigs,
1301 tableConfig: { ...slaveConfig, gdsconfigformslave: downAbleConfigs }, 1294 tableConfig: { ...slaveConfig, gdsconfigformslave: downAbleConfigs },
1302 iColValueView: 24, 1295 iColValueView: 24,
1303 viewRow: slaveRowData, 1296 viewRow: slaveRowData,
1304 tableName: `slaveDown${boxModel}`, 1297 tableName: `slaveDown${boxModel}`,
1305 }; 1298 };
  1299 + console.log(downViewProps,'downViewProps');
  1300 +
1306 const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []); 1301 const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []);
1307 const radioValue = calcMethodData[0]?.sCode; 1302 const radioValue = calcMethodData[0]?.sCode;
1308 const [materialLength, setMaterialLength] = useState(0); 1303 const [materialLength, setMaterialLength] = useState(0);
@@ -1444,7 +1439,7 @@ const BoxComponent = props =&gt; { @@ -1444,7 +1439,7 @@ const BoxComponent = props =&gt; {
1444 // }; 1439 // };
1445 // setSlaveRowData(rowData); 1440 // setSlaveRowData(rowData);
1446 // setSelected(selectListDetail?.sBoxType); 1441 // setSelected(selectListDetail?.sBoxType);
1447 - },[slaveData]); 1442 + }, [slaveData]);
1448 return ( 1443 return (
1449 <div> 1444 <div>
1450 <Selector 1445 <Selector
@@ -1511,14 +1506,15 @@ const BoxComponent = props =&gt; { @@ -1511,14 +1506,15 @@ const BoxComponent = props =&gt; {
1511 </div> 1506 </div>
1512 </div> 1507 </div>
1513 <div> 1508 <div>
1514 - <MaterialsComponent {...props} /> 1509 + <MaterialsComponent {...props} slaveRowData={slaveRowData} boxModel={boxModel} />
1515 </div> 1510 </div>
1516 <div> 1511 <div>
1517 <div>后道参数</div> 1512 <div>后道参数</div>
1518 {downViewProps.viewConfigs.map((x, i) => ( 1513 {downViewProps.viewConfigs.map((x, i) => (
1519 - <div>  
1520 - {x.showName} 1514 + <div className={styles.backBox}>
  1515 + <div className={styles.backEnd}>{x.showName}</div>
1521 <Switch 1516 <Switch
  1517 + checked={x.isSelect}
1522 onChange={async val => { 1518 onChange={async val => {
1523 console.log(val, x, "val"); 1519 console.log(val, x, "val");
1524 }} 1520 }}
@@ -1571,6 +1567,7 @@ const BoxComponent = props =&gt; { @@ -1571,6 +1567,7 @@ const BoxComponent = props =&gt; {
1571 ...Object.assign({}, ...slaveNewData), 1567 ...Object.assign({}, ...slaveNewData),
1572 }; 1568 };
1573 setSlaveRowData(rowData); 1569 setSlaveRowData(rowData);
  1570 + // props.setState(pre => ({ ...pre, slaveRowData:rowData }));
1574 setBoxPopup(false); 1571 setBoxPopup(false);
1575 }} 1572 }}
1576 > 1573 >
@@ -1615,7 +1612,6 @@ const MaterialsComponent = props =&gt; { @@ -1615,7 +1612,6 @@ const MaterialsComponent = props =&gt; {
1615 return item; 1612 return item;
1616 } 1613 }
1617 }); 1614 });
1618 -  
1619 const extraState = { 1615 const extraState = {
1620 calcPriceFinished: false, 1616 calcPriceFinished: false,
1621 manyData: [], 1617 manyData: [],
@@ -1662,7 +1658,7 @@ const MaterialsComponent = props =&gt; { @@ -1662,7 +1658,7 @@ const MaterialsComponent = props =&gt; {
1662 材料信息 1658 材料信息
1663 <div className={styles.materialsLine}> 1659 <div className={styles.materialsLine}>
1664 <div className={styles.selectInput} style={{ width: "50%" }}> 1660 <div className={styles.selectInput} style={{ width: "50%" }}>
1665 - <SelectInput {...viewProps} /> 1661 + <SelectInput {...viewProps} itemDetail={materialsConfigNew[0]} />
1666 </div> 1662 </div>
1667 <div className={styles.materialBtns}> 1663 <div className={styles.materialBtns}>
1668 <div className={styles.materialBtns}> 1664 <div className={styles.materialBtns}>
@@ -1711,8 +1707,16 @@ const MaterialsComponent = props =&gt; { @@ -1711,8 +1707,16 @@ const MaterialsComponent = props =&gt; {
1711 } 1707 }
1712 : { width: "1.93rem", height: "1.93rem", display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center" } 1708 : { width: "1.93rem", height: "1.93rem", display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center" }
1713 } 1709 }
  1710 + onClick={() => {
  1711 + const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
  1712 + const rowIndex = materialsInfo.findIndex((item, i) => i === index);
  1713 + const materialsInfoNew = [...materialsInfo];
  1714 + materialsInfoNew.splice(rowIndex, 1);
  1715 + slaveData[iIndex].materialsInfo = materialsInfoNew;
  1716 + props.setState(pre => ({ ...pre, slaveData, ...extraState }));
  1717 + }}
1714 > 1718 >
1715 - <AddOutline /> 1719 + <MinusOutline />
1716 </Button> 1720 </Button>
1717 </div> 1721 </div>
1718 </div> 1722 </div>