Commit 8ebfdee3cccc563bda530ac109499b17303f6751

Authored by zhangzzzz
1 parent ab46dc9a

快速报价后道参数新增报价参数配置;

src/components/Common/CommonComponent/index.js
... ... @@ -3173,7 +3173,7 @@ export default class CommonComponent extends Component {
3173 3173 /* 页面输出 */
3174 3174 return (
3175 3175 <div ref={this.myRef} className={iColValue === 24 ? 'input24' : iColValue === 18 ? 'input18' : iColValue === 12 ? 'input12' : 'changeClassName'} key={this.state.key}>
3176   - <div className={`${this.props.className} ${readonlyStyle} ${costomStyle}`}>
  3176 + <div className={`${this.props.className} ${readonlyStyle} ${costomStyle}`} onClick={this.props.onCostomClick?.bind(this, showConfig)}>
3177 3177 {commonAssembly}
3178 3178 </div>
3179 3179 </div>
... ...
src/components/Common/CommonViewTable/index.js
... ... @@ -394,6 +394,7 @@ export default class CommonViewTable extends Component {
394 394 sBtnSendDialogConfigList: this.props.sBtnSendDialogConfigList, // 校验并获取物料主数据按钮配置
395 395 onToolBarBtnClick: this.props.onToolBarBtnClick, // 工具栏按钮事件
396 396 onExecInstructSet: this.props.onExecInstructSet, // 调用指令集
  397 + onCostomClick: this.props.onCostomClick,
397 398 };
398 399 return (
399 400 <Col key={child.sId} span={iColValue} order={iOrder} style={{ display: sFormulaMemo, position: 'relative' }}>
... ...
src/components/QuickQuote/index.jsx
... ... @@ -217,6 +217,27 @@ const QuickQuoteEvent = props =&gt; {
217 217 // if (dropDownDataSelected.sProcessName === "胶印") {
218 218 // extraRowData.sPrintProcessId = dropDownDataSelected.sId;
219 219 // }
  220 +
  221 + // 后道参数额外配置
  222 + const { sParamConfig: sParamConfigStr } = dropDownDataSelected || {};
  223 + const sParamConfig = commonUtils.convertStrToObj(sParamConfigStr, []);
  224 + extraState.backendParamsConfig = sParamConfig;
  225 + extraState.backendConfig = { sParentFieldsName: sFieldName, sBoxModel: boxModel };
  226 + const sBackendParams = sParamConfig
  227 + .map((item, index) => {
  228 + const { sParamDefault, sParam } = item;
  229 + return !sParamDefault
  230 + ? ""
  231 + : {
  232 + sId: commonUtils.createSid(),
  233 + value: sParamDefault,
  234 + sParentParam: sParam,
  235 + [`sParams${index}`]: sParamDefault,
  236 + };
  237 + })
  238 + .filter(item => item !== "");
  239 + dropDownDataSelected.sBackendParams = sBackendParams;
  240 +
220 241 if (iIndex === -1) {
221 242 slaveData.push({
222 243 sId: commonUtils.createSid(),
... ... @@ -1183,6 +1204,7 @@ const ContentComponent = props =&gt; {
1183 1204 };
1184 1205 })}
1185 1206 />
  1207 + <BackendParamsExtraComponent {...props} />
1186 1208 <Divider {...dividerProps}>多数量报价</Divider>
1187 1209 <ManyComponent {...props} />
1188 1210 </>
... ... @@ -1227,7 +1249,16 @@ const MasterComponent = props =&gt; {
1227 1249 // 盒型组件
1228 1250 const BoxComponent = props => {
1229 1251 const { dividerProps, state, boxModel } = props;
1230   - const { masterData = {}, slaveConfig, slaveData = [], selectedNode = {}, downAbleConfigs = [], finishedConfigs = [], boxConfig = {} } = state;
  1252 + const {
  1253 + masterData = {},
  1254 + slaveConfig,
  1255 + slaveData = [],
  1256 + selectedNode = {},
  1257 + downAbleConfigs = [],
  1258 + downAbleExtraConfigs = [],
  1259 + finishedConfigs = [],
  1260 + boxConfig = {},
  1261 + } = state;
1231 1262 if (!slaveConfig) return "";
1232 1263  
1233 1264 const { bBox } = selectedNode;
... ... @@ -1287,15 +1318,21 @@ const BoxComponent = props =&gt; {
1287 1318  
1288 1319 const { sBackProcessData = [] } = slaveRowData;
1289 1320  
1290   - const [downAbleConfigsNew, setDownAbleConfigsNew] = useState([]);
1291   - useEffect(() => {
1292   - setDownAbleConfigsNew(downAbleConfigs);
1293   - }, [selectedNode.showName, boxModel, downAbleConfigs.length]);
  1321 + const downAbleConfigsNew = downAbleConfigs.reduce((pre, cur) => {
  1322 + const childConfigs = downAbleExtraConfigs.filter(item => item.sParentName === cur.showName);
  1323 + pre.push(cur, ...childConfigs);
  1324 + return pre;
  1325 + }, []);
1294 1326  
1295 1327 // 获取sType为2的
1296 1328 const downViewProps = {
1297 1329 ...props,
1298   - viewConfigs: downAbleConfigsNew.filter(item => item.sPartsName === boxModel || !item.sPartsName),
  1330 + viewConfigs: downAbleConfigsNew
  1331 + .filter(item => item.sPartsName === boxModel || !item.sPartsName)
  1332 + .map(config => ({
  1333 + ...config,
  1334 + costomStyle: sBackProcessData.find(item => item[config.sName0 || config.sName])?.sParamConfig ? styles.sParamConfig : "",
  1335 + })),
1299 1336 tableConfig: { ...slaveConfig, gdsconfigformslave: downAbleConfigsNew },
1300 1337 iColValueView: 24,
1301 1338 viewRow: slaveRowData,
... ... @@ -1382,11 +1419,9 @@ const BoxComponent = props =&gt; {
1382 1419 {!child.sParentName ? (
1383 1420 <Button
1384 1421 icon={<PlusOutlined />}
1385   - type="link"
  1422 + type="primary"
1386 1423 onClick={() => {
1387   - setDownAbleConfigsNew(pre => {
1388   - const iIndex = pre.findIndex(item => item.sId === child.sId);
1389   - const childLen = pre.filter(item => item.sParentName === child.showName).length;
  1424 + props.setState(pre => {
1390 1425 const newSId = commonUtils.createSid();
1391 1426 const newConfig = {
1392 1427 ...child,
... ... @@ -1394,26 +1429,31 @@ const BoxComponent = props =&gt; {
1394 1429 sParentName: child.showName,
1395 1430 sName: `${child.sName}_${newSId}`,
1396 1431 };
1397   - return [...pre.slice(0, iIndex + childLen + 1), newConfig, ...pre.slice(iIndex + childLen + 1)];
  1432 + return {
  1433 + ...pre,
  1434 + downAbleExtraConfigs: [...downAbleExtraConfigs, newConfig],
  1435 + };
1398 1436 });
1399 1437 }}
1400 1438 />
1401 1439 ) : (
1402 1440 <Button
1403 1441 icon={<MinusOutlined />}
1404   - type="link"
  1442 + type="primary"
  1443 + danger
1405 1444 onClick={() => {
1406   - setDownAbleConfigsNew(pre => {
1407   - const iIndex = pre.findIndex(item => item.sId === child.sId);
1408   - return [...pre.slice(0, iIndex), ...pre.slice(iIndex + 1)];
1409   - });
1410   -
1411   - const slaveRowIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
1412 1445 props.setState(pre => {
  1446 + const iIndex = downAbleExtraConfigs.findIndex(item => item.sId === child.sId);
  1447 +
  1448 + const slaveRowIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
1413 1449 const { sBackProcessData = [] } = slaveData[slaveRowIndex];
1414   - const iIndex = sBackProcessData.findIndex(item => item[child.sName]);
1415   - slaveData[slaveRowIndex].sBackProcessData?.splice(iIndex, 1);
1416   - return { ...pre, slaveData };
  1450 + const iIndex1 = sBackProcessData.findIndex(item => item[child.sName]);
  1451 + slaveData[slaveRowIndex].sBackProcessData?.splice(iIndex1, 1);
  1452 + return {
  1453 + ...pre,
  1454 + downAbleExtraConfigs: [...downAbleExtraConfigs.slice(0, iIndex), ...downAbleExtraConfigs.slice(iIndex + 1)],
  1455 + slaveData,
  1456 + };
1417 1457 });
1418 1458 }}
1419 1459 />
... ... @@ -1421,6 +1461,20 @@ const BoxComponent = props =&gt; {
1421 1461 </div>
1422 1462 );
1423 1463 },
  1464 + onCostomClick: (showConfig, { target }) => {
  1465 + const className = target.getAttribute("class");
  1466 + const nodeName = target.nodeName;
  1467 + if (className?.includes("select") && nodeName === "DIV") return;
  1468 +
  1469 + props.setState(pre => ({
  1470 + ...pre,
  1471 + backendParamsConfig: commonUtils.convertStrToObj(
  1472 + sBackProcessData.find(item => item[showConfig.sName0 || showConfig.sName])?.sParamConfig,
  1473 + []
  1474 + ),
  1475 + backendConfig: { sParentFieldsName: showConfig.sName, sBoxModel: boxModel },
  1476 + }));
  1477 + },
1424 1478 };
1425 1479  
1426 1480 // 获取sType为3的
... ... @@ -1797,7 +1851,7 @@ const BoxComponent = props =&gt; {
1797 1851 <>
1798 1852 {/* <Divider {...dividerProps}>成品工序</Divider> */}
1799 1853 <div className={styles.boxPart2}>
1800   - <div className={styles.viewTable}>
  1854 + <div className={`${styles.viewTable} ${styles.viewTableDownView1}`}>
1801 1855 <CommonViewTable {...finishedViewProps} />
1802 1856 </div>
1803 1857 </div>
... ... @@ -2334,4 +2388,79 @@ const BoxModelSelectedModal = props =&gt; {
2334 2388 );
2335 2389 };
2336 2390  
  2391 +// 后道参数额外配置
  2392 +const BackendParamsExtraComponent = props => {
  2393 + const { state, slaveConfig, boxModel } = props;
  2394 + const { backendParamsConfig = [], backendConfig = {}, slaveData, selectedNode } = state;
  2395 + if (!backendParamsConfig.length) return "";
  2396 +
  2397 + const { sParentFieldsName, sBoxModel } = backendConfig;
  2398 +
  2399 + const slaveRowData = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === sBoxModel) || {};
  2400 + const { sBackProcessData = [] } = slaveRowData;
  2401 +
  2402 + const viewConfigs = backendParamsConfig.map((item, index) => ({
  2403 + ...item,
  2404 + sName: `sParams${index}`,
  2405 + showName: item.sParam,
  2406 + sDropDownType: "sql",
  2407 + iColValue: 4,
  2408 + }));
  2409 +
  2410 + const viewProps = {
  2411 + ...props,
  2412 + viewConfigs: viewConfigs,
  2413 + tableConfig: { ...slaveConfig, gdsconfigformslave: viewConfigs },
  2414 + iColValueView: 24,
  2415 + getViewRow: config => {
  2416 + return sBackProcessData.find(item => item[sParentFieldsName])?.sBackendParams?.find(item => item.sParentParam === config.showName) || {};
  2417 + },
  2418 + tableName: `sBackendParams${boxModel}`,
  2419 + getSqlDropDownData: (...args) => {
  2420 + const showConfig = args[2];
  2421 + const { sParamDropDown = "", sName } = showConfig;
  2422 + const dropDownData = sParamDropDown.split(",");
  2423 + if (dropDownData?.length) {
  2424 + return {
  2425 + dropDownData: dropDownData.map(item => ({
  2426 + sId: commonUtils.createSid(),
  2427 + value: item,
  2428 + sParentParam: showConfig.sParam,
  2429 + [sName]: item,
  2430 + })),
  2431 + totalPageCount: 1,
  2432 + currentPageNo: 1,
  2433 + conditonValues: {},
  2434 + };
  2435 + }
  2436 +
  2437 + return props.getSqlDropDownData(...args);
  2438 + },
  2439 + onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
  2440 + const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
  2441 + const iIndex1 = slaveData[iIndex].sBackProcessData.findIndex(item => item[sParentFieldsName]);
  2442 + const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue[sFieldName]);
  2443 + const { sParentParam } = dropDownDataSelected;
  2444 + const { sBackendParams = [] } = slaveData[iIndex].sBackProcessData[iIndex1];
  2445 + const iIndex2 = sBackendParams.findIndex(item => item.sParentParam === sParentParam);
  2446 + if (iIndex2 !== -1) {
  2447 + sBackendParams[iIndex2] = dropDownDataSelected;
  2448 + } else {
  2449 + sBackendParams.push(dropDownDataSelected);
  2450 + }
  2451 + slaveData[iIndex].sBackProcessData[iIndex1].sBackendParams = sBackendParams;
  2452 + props.setState(pre => ({ ...pre, slaveData }));
  2453 + },
  2454 + };
  2455 +
  2456 + return (
  2457 + <>
  2458 + <Divider style={{ margin: "5px 0" }} />
  2459 + <div className={`${styles.viewTable} ${styles.viewTableDownView1}`}>
  2460 + <CommonViewTable {...viewProps} />
  2461 + </div>
  2462 + </>
  2463 + );
  2464 +};
  2465 +
2337 2466 export default QuickQuote;
... ...
src/components/QuickQuote/index.less
... ... @@ -101,6 +101,25 @@
101 101 }
102 102 }
103 103  
  104 + }
  105 +
  106 + .viewTableDownView,
  107 + .viewTableDownView1 {
  108 + :global {
  109 + .viewStyle {
  110 + padding-right: 14px;
  111 +
  112 + .ant-form-item-label {
  113 + flex: 0 0 70px !important;
  114 + max-width: 70px !important;
  115 + }
  116 +
  117 + .ant-form-item-control {
  118 + max-width: calc(100% - 95px);
  119 + }
  120 + }
  121 + }
  122 +
104 123 .subViewTable {
105 124 width: 100%;
106 125 height: auto;
... ... @@ -144,10 +163,12 @@
144 163 }
145 164 }
146 165  
147   - .viewTableDownView {
  166 + .viewTableDownView1 {
148 167 :global {
149 168 .viewStyle {
150   - padding-right: 14px;
  169 + .ant-form-item-control {
  170 + max-width: calc(100% - 60px);
  171 + }
151 172 }
152 173 }
153 174 }
... ... @@ -425,8 +446,8 @@
425 446  
426 447 .downOperations {
427 448 position: absolute;
428   - top: -4px;
429   - right: -14px;
  449 + top: 6px;
  450 + right: 6px;
430 451 display: flex;
431 452 flex-direction: column;
432 453 z-index: 1;
... ... @@ -442,4 +463,22 @@
442 463 }
443 464 }
444 465 }
  466 +}
  467 +
  468 +.sParamConfig {
  469 + :global {
  470 + .ant-form-item-label {
  471 + label {
  472 + &::before {
  473 + content: '';
  474 + display: block;
  475 + width: 5px;
  476 + height: 5px;
  477 + border-radius: 50%;
  478 + background-color: #ff4d4f;
  479 + margin-right: 2px;
  480 + }
  481 + }
  482 + }
  483 + }
445 484 }
446 485 \ No newline at end of file
... ...