Commit c738f700b78cb82b20a846ec76b851e298bb11f5

Authored by 陈鑫涛
1 parent 94834f44

快速报价app 主表数据

src/components/QuickQuote/index.jsx
... ... @@ -246,6 +246,7 @@ const QuickQuoteEvent = props => {
246 246 handleType: slaveData[iIndex].handleType || "update",
247 247 };
248 248 }
  249 +
249 250 } else {
250 251 if (iIndex === -1) {
251 252 slaveData.push({
... ... @@ -1423,6 +1424,7 @@ const BoxComponent = props => {
1423 1424 );
1424 1425 },
1425 1426 };
  1427 +
1426 1428 // 获取sType为3的
1427 1429 const { productProcessInfo = [] } = masterData;
1428 1430 const finishedViewProps = {
... ...
src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js
... ... @@ -1770,7 +1770,6 @@ class QuotationPackTableTree extends Component {
1770 1770 }
1771 1771 }
1772 1772 }
1773   - console.log('222', skipFlag);
1774 1773 if(((skipFlag === 0) || masterData.bNoVerify) && !skipCalculation) {
1775 1774 this.handleCalculation(true);
1776 1775 } else {
... ... @@ -2266,7 +2265,6 @@ class QuotationPackTableTree extends Component {
2266 2265 if (commonUtils.isNotEmptyArr(materialsSelectedDelRowKeys)) {
2267 2266 materialsReturnData = this.props.onDataRowDel('materials', true, materialsSelectedDelRowKeys);
2268 2267 }
2269   - console.log('materialsReturnData', materialsReturnData);
2270 2268 this.props.onSaveState({
2271 2269 ...processReturnData,
2272 2270 ...materialsReturnData,
... ... @@ -2770,7 +2768,6 @@ class QuotationPackTableTree extends Component {
2770 2768 if (commonUtils.isNotEmptyObject(dataReturn)) {
2771 2769 if (dataReturn.code === 1) {
2772 2770 const flowData = dataReturn.dataset.rows[0];
2773   - console.log(flowData);
2774 2771 if (commonUtils.isNotEmptyObject(flowData)) {
2775 2772 this.props.onSaveState({
2776 2773 flowData: flowData,workFlowVisible:true
... ... @@ -4121,7 +4118,6 @@ class QuotationPackTableTree extends Component {
4121 4118 // const sSqlCondition = { sId: selectData[0].sSlaveId }; /* 后台根据rowData自己取 */
4122 4119 const condition = { sConfigformId, sControlName, sRowData };
4123 4120 const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data;
4124   - console.log('dataReturn', dataReturn);
4125 4121 if (dataReturn.code === 1) {
4126 4122 const copyTo = { config: masterConfig.gdsconfigformslave, name: selectConfig.sControlName };
4127 4123 const returnDataSet = dataReturn.dataset.rows[0];
... ... @@ -4245,7 +4241,6 @@ class QuotationPackTableTree extends Component {
4245 4241 returnData[sName] = returnDataSet[key];
4246 4242 }
4247 4243 }
4248   - console.log('returnData', returnData);
4249 4244 if (commonUtils.isNotEmptyArr(returnData.controlData)) {
4250 4245 let dProductQty = 0;
4251 4246 /* 主表配置bProductQtyAdd 则代表产品数量不叠加备货数 赠送数 */
... ...
src/mobile/components/SelectInput.jsx
... ... @@ -46,7 +46,7 @@ const SelectInput = props => {
46 46 };
47 47 commonServices.postValueService(props.app.token, body, url).then(res => {
48 48 if (res.data.code === 1) {
49   - const list = res.data.dataset.rows?.map(item => ({
  49 + const list = res.data.dataset.rows?.map((item,i) => ({
50 50 label: item.sCustomerName || item.sName || item.sProcessName || item.sColorName || item.sMaterialsName,
51 51 value: item.sId || item.sSlaveId,
52 52 ...item,
... ...
src/mobile/quotation/detailNew.jsx
... ... @@ -97,29 +97,32 @@ const QuickQuoteEvent = props => {
97 97 }, [bLinkFieledClick, props.enabled]);
98 98 useEffect(() => {
99 99 // 获取 masterConfig
100   - const { sModelsId } = props;
101   - const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}`;
102   - commonServices
103   - .getService(props.app.token, configUrl)
104   - .then(({ data: configReturn }) => {
105   - if (configReturn.code === 1) {
106   - const formData = configReturn.dataset.rows[0]?.formData;
107   - setMasterConfig(formData);
108   - // setState(pre => ({ ...pre, masterConfig: formData, slaveConfig: formData[1] }));
109   - }
110   - })
111   - .catch(error => {});
  100 +
112 101 const sActiveId = "172129113112117428019179600";
113 102 const configUrls = `${commonConfig.server_host}business/getModelBysId/${sActiveId}?sModelsId=${sActiveId}`;
114   - commonServices.getService(props.app.token, configUrls).then(({ data: configReturn }) => {
  103 + commonServices.getService(props.app.token, configUrls).then(async ({ data: configReturn }) => {
115 104 if (configReturn.code === 1) {
116 105 const formData = configReturn.dataset.rows[0].formData;
117   - // 需要查询到processConfig和materialsConfig
118   - setState(pre => ({ ...pre, formData, masterConfig: formData[0], processConfig: {} }));
  106 + setState(pre => ({ ...pre, formData, masterConfig: formData[0] }));
119 107 }
120 108 });
121 109 }, []);
122   -
  110 + // 获取主表信息
  111 + useEffect(() => {
  112 + const configUrl = `${commonConfig.server_host}business/getModelBysId/${props.sModelsId}?sModelsId=${props.sModelsId}`;
  113 + commonServices
  114 + .getService(props.app.token, configUrl)
  115 + .then(({ data: masterReturn }) => {
  116 + if (masterReturn.code === 1) {
  117 + const materFormData = masterReturn.dataset.rows[0].formData;
  118 + const processConfig = materFormData.find(x => x.sTbName === "QuoQuotationprocess");
  119 + const materialsConfig = materFormData.find(x => x.sTbName === "QuoQuotationmaterials");
  120 + setMasterConfig(materFormData);
  121 + setState(pre => ({ ...pre, processConfig, materialsConfig }));
  122 + }
  123 + })
  124 + .catch(error => {});
  125 + }, [props.sModelsId]);
123 126 // 获取盒型定义配置
124 127 useEffect(() => {
125 128 if (!formData.length) return;
... ... @@ -180,6 +183,7 @@ const QuickQuoteEvent = props => {
180 183 }
181 184 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState }));
182 185 } else if (name.includes("slave")) {
  186 +
183 187 const boxModel = name.replace("slaveUp", "").replace("slaveDown", "");
184 188 if (sFieldName === "sName") {
185 189 if (!changeValue.sName) return;
... ... @@ -224,7 +228,6 @@ const QuickQuoteEvent = props => {
224 228 } else {
225 229 const sBackProcessData = slaveData[iIndex].sBackProcessData || [];
226 230 const iIndex1 = sBackProcessData.findIndex(item => item.value === dropDownData[0].value);
227   -
228 231 if (iIndex1 === -1) {
229 232 dropDownDataSelected !== undefined && sBackProcessData.push(dropDownDataSelected);
230 233 } else {
... ... @@ -295,6 +298,13 @@ const QuickQuoteEvent = props => {
295 298 if (sFieldName === "sPrint") {
296 299 slaveData[saveIndex] = {
297 300 ...slaveData[saveIndex],
  301 + sProcessId: changeValue.sId,
  302 + sPrintProcessId: changeValue.sId,
  303 + };
  304 + }
  305 + if (sFieldName === "sPrint") {
  306 + slaveData[saveIndex] = {
  307 + ...slaveData[saveIndex],
298 308 dMachineWidth: slaveData[saveIndex].dWlkd,
299 309 dMachineLength: slaveData[saveIndex].dWlcd,
300 310 };
... ... @@ -511,6 +521,8 @@ const QuickQuoteEvent = props => {
511 521 })
512 522 .filter(item => commonUtils.isNotEmptyObject(item) && item.materialsInfo && item.materialsInfo.length)
513 523 .map(item => {
  524 + // slaveData里的sMaterialRate sMaterialsStyle
  525 +
514 526 return {
515 527 ...Object.keys(item).reduce((pre, cur) => {
516 528 if (typeof item[cur] !== "object") {
... ... @@ -541,8 +553,8 @@ const QuickQuoteEvent = props => {
541 553 const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;
542 554  
543 555 if (dataReturn.code === 1) {
544   - const { app, sModelsId, materialsConfig } = props;
545   - const { slaveConfig, masterData: masterData1, processConfig } = state;
  556 + const { app, sModelsId } = props;
  557 + const { slaveConfig, masterData: masterData1, processConfig, materialsConfig } = state;
546 558 const { productClassify, partsNewInfo = [], productProcessInfo, partsInfo: partsOldInfo } = dataReturn.dataset.rows[0];
547 559  
548 560 const slaveData = [];
... ... @@ -673,7 +685,7 @@ const QuickQuoteEvent = props => {
673 685 const materialInfo = partInfo.materialsInfo[i];
674 686 const iOrder = i;
675 687 let materialDataRow = {};
676   - for (const item of materialsConfig?.gdsconfigformslave) {
  688 + for (const item of materialsConfig.gdsconfigformslave) {
677 689 materialDataRow[item.sName] = materialInfo[item.sName];
678 690 }
679 691 materialDataRow.handleType = "add";
... ... @@ -861,9 +873,12 @@ const QuickQuoteEvent = props => {
861 873 // quickQuoteModel: false,
862 874 };
863 875 delete newState.masterData.sQuoConfig;
  876 + const masterProps = {
  877 + ...props,
  878 + };
864 879 const result = await props.handleCalculation(
865 880 false,
866   - { ...props, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData },
  881 + { ...masterProps, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData },
867 882 true
868 883 );
869 884  
... ... @@ -1073,7 +1088,35 @@ const sortData = (tableData, processData) => {
1073 1088 });
1074 1089 return processData;
1075 1090 };
1076   -const QuotationAllprogressDetail = baseProps => {
  1091 +// 计算数量
  1092 +const handleCalculation = async (bSave, nextProps, isWait) => {
  1093 + const dataUrl = `${commonConfig.server_host}business/addQuotationsheet?sModelsId=${nextProps.sModelsId}`;
  1094 + const {
  1095 + masterConfig,
  1096 + slaveConfig,
  1097 + slaveDelData,
  1098 + controlConfig,
  1099 + controlDelData,
  1100 + colorConfig,
  1101 + colorData,
  1102 + colorDelData,
  1103 + materialsConfig,
  1104 + materialsDelData,
  1105 + processConfig,
  1106 + processDelData,
  1107 + app,
  1108 + manyqtysConfig,
  1109 + manyqtysDelData,
  1110 + packConfig,
  1111 + packDelData,
  1112 + manyDataCache = [],
  1113 + dQuickQuoteProductQty,
  1114 + } = nextProps;
  1115 + let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps;
  1116 + const sMakePerson = masterData.sMakePerson;
  1117 + const data = [];
  1118 +};
  1119 +const getProps = baseProps => {
1077 1120 const { location, quotationData, app, sModelsId } = baseProps;
1078 1121 const getSqlDropDownDatas = async (formId, name, showConfig, record, sKeyUpFilterName, pageNum) => {
1079 1122 const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${sModelsId}`;
... ... @@ -1110,10 +1153,17 @@ const QuotationAllprogressDetail = baseProps => {
1110 1153 getSqlDropDownData: getSqlDropDownDatas,
1111 1154 onMaterialsChange: handleMaterialsChange,
1112 1155 sortData,
  1156 + handleCalculation,
  1157 + };
  1158 + return {
  1159 + ...baseProps,
  1160 + ...propss,
1113 1161 };
  1162 +};
  1163 +const QuotationAllprogressDetail = baseProps => {
  1164 + const props = QuickQuoteEvent(getProps(baseProps));
1114 1165  
1115   - const props = QuickQuoteEvent(propss);
1116   - const { selectedNode } = props;
  1166 + const { selectedNode, location, quotationData, app, sModelsId } = props;
1117 1167 const { showName, sUnit } = quotationData;
1118 1168 const timeRef = useRef(0);
1119 1169  
... ... @@ -1593,7 +1643,7 @@ const BoxComponent = props => {
1593 1643 const newSwitchStates = downAbleConfigsNew
1594 1644 .filter(item => item.sPartsName === boxModel || !item.sPartsName)
1595 1645 .reduce((acc, item, index) => {
1596   - acc[item.sName] = sBackProcessData[index][item.sName] !== "";
  1646 + acc[item.sName] = sBackProcessData ? sBackProcessData[index][item.sName] !== "" : false;
1597 1647 return acc;
1598 1648 }, {});
1599 1649  
... ... @@ -1613,9 +1663,11 @@ const BoxComponent = props => {
1613 1663 // 过滤后的数据
1614 1664 const downViewConfigs = downAbleConfigsNew
1615 1665 .filter(item => item.sPartsName === boxModel || !item.sPartsName)
1616   - .map(item => ({
  1666 + .map((item, i) => ({
1617 1667 ...item,
1618 1668 isSelect: switchStates ? switchStates[item.sName] : false,
  1669 + sName: "sParams" + i,
  1670 + sProductClassifyId: item.sId,
1619 1671 }));
1620 1672  
1621 1673 const downViewProps = {
... ... @@ -1626,6 +1678,7 @@ const BoxComponent = props => {
1626 1678 viewRow: slaveRowData,
1627 1679 tableName: `slaveDown${boxModel}`,
1628 1680 };
  1681 +
1629 1682 const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []);
1630 1683 const radioValue = calcMethodData[0]?.sCode;
1631 1684 const [materialLength, setMaterialLength] = useState(0);
... ... @@ -1653,7 +1706,7 @@ const BoxComponent = props => {
1653 1706 dMachineWidth: width, // 上机宽
1654 1707 sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸
1655 1708 sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸
1656   - sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2),
  1709 + sMaterialRate: (((length * width) / (dWlcd * dWlkd)) * 100).toFixed(2),
1657 1710 newMaterialLength: length,
1658 1711 newMaterialWidth: width,
1659 1712 sLayoutRate: Number(
... ... @@ -2069,11 +2122,11 @@ const MaterialsComponent = props => {
2069 2122 tableName: `slaveUp${boxModel}`,
2070 2123 onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
2071 2124 const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
2072   - const { sMaterialsName, sMaterialsNo, sMaterialsId, sAuxiliaryUnit, sMaterialsUnit, dGramWeight, sMaterialsType, dWlkd, dWlcd } = changeValue;
  2125 + const { sMaterialsName, sMaterialsNo, sAuxiliaryUnit, sMaterialsUnit, dGramWeight, sMaterialsType, dWlkd, dWlcd } = changeValue;
2073 2126 const masterials = {
2074 2127 sMaterialsName,
2075 2128 sMaterialsNo,
2076   - sMaterialsId,
  2129 + sMaterialsId: changeValue.sId,
2077 2130 sAuxiliaryUnit,
2078 2131 sMaterialsUnit,
2079 2132 dGramWeight,
... ...