Commit 85cae951f830af06f9abaf924779057df5d786f7

Authored by 陈鑫涛
1 parent db8fdbb6

快速报价app 多工序

src/components/Common/Typesetting/typesetting.js
... ... @@ -607,6 +607,7 @@ const Typesetting = props => {
607 607  
608 608 const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length;
609 609 if (isCustomized && !isShow) {
  610 + if (isMobile) return;
610 611 message.error("排版尺寸大于上机尺寸,请确认参数!");
611 612 }
612 613 const onClick = () => {
... ...
src/mobile/components/SelectInput.jsx
1 1 import React, { useState, useRef, useEffect, useCallback } from "react";
2   -import { Input, Popup, Button, Toast, PickerView, SearchBar,Checkbox } from "antd-mobile";
  2 +import { Input, Popup, Button, Toast, PickerView, SearchBar, Checkbox } from "antd-mobile";
3 3 import { DownOutline } from "antd-mobile-icons";
4 4 import commonConfig from "@/utils/config";
5 5 import * as commonServices from "@/services/services";
... ... @@ -148,7 +148,12 @@ const SelectInput = props => {
148 148 <div>
149 149 <div className={styles.inputBox}>
150 150 {propsType === "b" ? (
151   - <Checkbox style={{height:'3.125rem'}}/>
  151 + <Checkbox
  152 + style={{ height: "3.125rem" }}
  153 + onChange={val => {
  154 + props.onDataChange(tableName, itemDetail.sName, { [itemDetail.sName]: val }, null, coplyColumns);
  155 + }}
  156 + />
152 157 ) : (
153 158 <div>
154 159 {" "}
... ...
src/mobile/components/selectInput.css
1 1 .inputBox {
2 2 position: relative;
  3 + height: 100%;
3 4 }
4 5 .inputBox .icons {
5 6 position: absolute;
... ...
src/mobile/components/selectInput.less
1 1 .inputBox {
2 2 position: relative;
  3 + height: 100%;
  4 + // margin: 0.5rem 0;
3 5 .icons {
4 6 position: absolute;
5 7 top: 50%;
... ...
src/mobile/quotation/detailNew.jsx
... ... @@ -1467,6 +1467,10 @@ const BoxComponent = props =&gt; {
1467 1467 if (item.sName === "dSumPQty" && selectedNode.sTypeKey !== "huace") {
1468 1468 return false;
1469 1469 }
  1470 + const { bAdvancedSetting } = slaveRowData;
  1471 + if ((item.sName === "dPortrait" && !bAdvancedSetting) || (item.sName === "dHorizontal" && !bAdvancedSetting)) {
  1472 + return false;
  1473 + }
1470 1474  
1471 1475 return item.iTag === iTag;
1472 1476 });
... ... @@ -1515,20 +1519,26 @@ const BoxComponent = props =&gt; {
1515 1519 // return pre;
1516 1520 // }, []);
1517 1521 useEffect(() => {
1518   - setDownAbleConfigsNew(downAbleConfigs);
1519   - }, [downAbleConfigs]);
  1522 + // setDownAbleConfigsNew(downAbleConfigs);
  1523 + const data = downAbleConfigs.reduce((pre, cur) => {
  1524 + const childConfigs = downAbleExtraConfigs.filter(item => item.sParentName === cur.showName);
  1525 + pre.push(cur, ...childConfigs);
  1526 + return pre;
  1527 + }, []);
  1528 + setDownAbleConfigsNew(data);
  1529 + }, [downAbleConfigs, downAbleExtraConfigs]);
1520 1530 // 初始化状态,存储每个 Switch 的状态
1521 1531 const [switchStates, setSwitchStates] = useState(null);
1522 1532 useEffect(() => {
1523 1533 if (!sBackProcessData) return;
1524   - const newSwitchStates = downAbleConfigsNew
1525   - .filter(item => item.sPartsName === boxModel || !item.sPartsName)
1526   - .reduce((acc, item, index) => {
1527   - acc[item.sName] = sBackProcessData ? sBackProcessData[index][item.sName] !== "" : false;
1528   - return acc;
1529   - }, {});
1530   -
1531   - setSwitchStates(newSwitchStates);
  1534 + // const newSwitchStates = downAbleConfigsNew
  1535 + // .filter(item => item.sPartsName === boxModel || !item.sPartsName)
  1536 + // .reduce((acc, item, index) => {
  1537 + // acc[item.sName] = sBackProcessData && sBackProcessData[index]? sBackProcessData[index][item.sName] !== "" : false;
  1538 + // return acc;
  1539 + // }, {});
  1540 +
  1541 + // setSwitchStates(newSwitchStates);
1532 1542 }, [downAbleConfigsNew, boxModel]); // 依赖数组
1533 1543  
1534 1544 // 处理 Switch 变化的函数
... ... @@ -1544,7 +1554,7 @@ const BoxComponent = props =&gt; {
1544 1554 .map((item, i) => ({
1545 1555 ...item,
1546 1556 isSelect: switchStates ? switchStates[item.sName] : false,
1547   - sName: "sParams" + i,
  1557 + // sName: "sParams" + i,
1548 1558 sProductClassifyId: item.sId,
1549 1559 }));
1550 1560 const downViewProps = {
... ... @@ -1555,6 +1565,7 @@ const BoxComponent = props =&gt; {
1555 1565 viewRow: slaveRowData,
1556 1566 tableName: `slaveDown${boxModel}`,
1557 1567 };
  1568 +
1558 1569 // 获取sType为3的
1559 1570 const { productProcessInfo = [] } = masterData;
1560 1571 const finishedViewProps = {
... ... @@ -1891,7 +1902,75 @@ const BoxComponent = props =&gt; {
1891 1902 <Switch checked={switchStates ? switchStates[x.sName] : ""} onChange={val => handleSwitchChange(x, val)} />
1892 1903 <div className={styles.customer} style={{ marginTop: "0", marginLeft: "2rem", width: "40%" }}>
1893 1904 {switchStates && switchStates[x.sName] ? (
1894   - <SelectInput {...downViewProps} itemDetail={{ ...x, sVisColumnName: "sProcessName", sDropDownType: "sql" }} downIndex={i} />
  1905 + // 这里需要数组遍历 多个工序
  1906 + <div className={styles.processFlex}>
  1907 + <SelectInput {...downViewProps} itemDetail={{ ...x, sVisColumnName: "sProcessName", sDropDownType: "sql" }} downIndex={i} />
  1908 + <div className={styles.processBtn}>
  1909 + {!x.sParentName ? (
  1910 + <Button
  1911 + color="primary"
  1912 + fill="solid"
  1913 + size="small"
  1914 + style={{
  1915 + width: "1.93rem",
  1916 + height: "1.93rem",
  1917 + display: "flex",
  1918 + justifyContent: "center",
  1919 + alignItems: "center",
  1920 + textAlign: "center",
  1921 + }}
  1922 + onClick={() => {
  1923 + props.setState(pre => {
  1924 + const newSId = commonUtils.createSid();
  1925 + const newConfig = {
  1926 + ...x,
  1927 + sId: newSId,
  1928 + sParentName: x.showName,
  1929 + sName: `${x.sName}_${newSId}`,
  1930 + };
  1931 + return {
  1932 + ...pre,
  1933 + downAbleExtraConfigs: [...downAbleExtraConfigs, newConfig],
  1934 + };
  1935 + });
  1936 + }}
  1937 + >
  1938 + <AddOutline />
  1939 + </Button>
  1940 + ) : (
  1941 + <Button
  1942 + color="danger"
  1943 + fill="solid"
  1944 + size="small"
  1945 + style={{
  1946 + width: "1.93rem",
  1947 + height: "1.93rem",
  1948 + display: "flex",
  1949 + justifyContent: "center",
  1950 + alignItems: "center",
  1951 + textAlign: "center",
  1952 + }}
  1953 + onClick={() => {
  1954 + props.setState(pre => {
  1955 + const iIndex = downAbleExtraConfigs.findIndex(item => item.sId === x.sId);
  1956 +
  1957 + const slaveRowIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
  1958 + const { sBackProcessData = [] } = slaveData[slaveRowIndex];
  1959 + const iIndex1 = sBackProcessData.findIndex(item => item[x.sName]);
  1960 + slaveData[slaveRowIndex].sBackProcessData?.splice(iIndex1, 1);
  1961 + return {
  1962 + ...pre,
  1963 + downAbleExtraConfigs: [...downAbleExtraConfigs.slice(0, iIndex), ...downAbleExtraConfigs.slice(iIndex + 1)],
  1964 + slaveData,
  1965 + };
  1966 + });
  1967 + }}
  1968 + >
  1969 + <MinusOutline />
  1970 + </Button>
  1971 + )}
  1972 + </div>
  1973 + </div>
1895 1974 ) : (
1896 1975 ""
1897 1976 )}
... ...
src/mobile/quotation/quotationDetail.css
... ... @@ -159,3 +159,11 @@
159 159 right: 5%;
160 160 bottom: 10%;
161 161 }
  162 +.processFlex {
  163 + display: flex;
  164 + align-items: center;
  165 + justify-content: space-between;
  166 +}
  167 +.processFlex .processBtn {
  168 + margin-left: 1rem;
  169 +}
... ...
src/mobile/quotation/quotationDetail.less
... ... @@ -167,4 +167,12 @@
167 167 right: 5%;
168 168 bottom: 10%;
169 169 }
  170 +}
  171 +.processFlex{
  172 + display: flex;
  173 + align-items: center;
  174 + justify-content: space-between;
  175 + .processBtn{
  176 + margin-left: 1rem;
  177 + }
170 178 }
171 179 \ No newline at end of file
... ...