You need to sign in before continuing.

Commit 4fc2c964c941fe943a18416dc57f57509075ab03

Authored by Min
1 parent ff5cef99

1.生产工单增加选择材料功能

src/components/Common/CommonTable/index.js
... ... @@ -4717,7 +4717,7 @@ class CommonTableRc extends React.Component {
4717 4717 let iTag = index + colSpan;
4718 4718 if (tableColumn[index].children !== undefined && tableColumn[index].children.length > 0) {
4719 4719 tableColumn[index].children.forEach((itemChild, i) => {
4720   - const sValue = selectedSumData[itemChild.dataIndex] || 0;
  4720 + const sValue = selectedSumData.hasOwnProperty(itemChild.dataIndex) ? selectedSumData[itemChild.dataIndex] : '';
4721 4721 const cellChild = (
4722 4722 <Table.Summary.Cell key={itemChild.dataIndex} index={iTag + i}>
4723 4723 <Tooltip title={this.formatThousands(sValue)}><span
... ... @@ -4728,7 +4728,7 @@ class CommonTableRc extends React.Component {
4728 4728 selectedCells.push(cellChild);
4729 4729 });
4730 4730 } else {
4731   - const sValue = selectedSumData[item.dataIndex] || 0;
  4731 + const sValue = selectedSumData.hasOwnProperty(item.dataIndex) ? selectedSumData[item.dataIndex] : '';
4732 4732 const cell = (
4733 4733 <Table.Summary.Cell key={item.dataIndex} index={iTag}>
4734 4734 <Tooltip title={this.formatThousands(sValue)}><span
... ...
src/components/Manufacture/WorkOrderPackTableTreeNew/index.js
... ... @@ -1693,7 +1693,7 @@ const WorkOrderPackTableTreeNewEvent = props =&gt; {
1693 1693 [`${name}Data`]: tableData,
1694 1694 [`${name}Config`]: tableConfig,
1695 1695 masterConfig,
1696   - controlSelectedRowKeys,
  1696 + controlSelectedRowKeys = [],
1697 1697 processSelectedRowKeys,
1698 1698 sModelsId,
1699 1699 token,
... ... @@ -1705,8 +1705,8 @@ const WorkOrderPackTableTreeNewEvent = props =&gt; {
1705 1705 packConfig,
1706 1706 slaveData,
1707 1707 controlData: controlDataOld,
1708   - materials0Data: materialsDataOld,
1709   - processData: processDataOld,
  1708 + materials0Data: materialsDataOld = [],
  1709 + processData: processDataOld = [],
1710 1710 colorData: colorDataOld,
1711 1711 packData: packDataOld,
1712 1712 controlDelData: controlDelDataOld,
... ... @@ -1716,12 +1716,57 @@ const WorkOrderPackTableTreeNewEvent = props =&gt; {
1716 1716 packDelData: packDelDataOld,
1717 1717 } = props;
1718 1718 let { masterData, slaveSelectedRowKeys } = props;
  1719 + const bInsertMaterials = selectConfig?.sControlName?.toLowerCase().includes("inserttestmaterials");
1719 1720 const bTmpInfoBySql = selectConfig?.sControlName?.toLowerCase().includes("tmpinfobysql");
1720   - if (name === "productProcessInfo" && !bTmpInfoBySql) {
  1721 + if (name === "productProcessInfo" && !bInsertMaterials) {
1721 1722 message.info("productProcessInfo已废弃,请改成TmpInfoBySql!");
1722 1723 return;
1723 1724 }
1724   - if (bTmpInfoBySql) {
  1725 + /* 插入测试材料 */
  1726 + if(bInsertMaterials) {
  1727 + let iSlaveIndex = -1;
  1728 + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
  1729 + iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys.toString());
  1730 + } else if (slaveData.length > 0) {
  1731 + iSlaveIndex = 0;
  1732 + }
  1733 +
  1734 + let controlSelectedRow = {}; /* 控制表选中行 */
  1735 + if (commonUtils.isNotEmptyArr(controlDataOld)) {
  1736 + if (commonUtils.isNotEmptyArr(controlSelectedRowKeys)) {
  1737 + controlSelectedRow = controlDataOld.find(item => controlSelectedRowKeys.includes(item.sId));
  1738 + } else {
  1739 + controlSelectedRow = controlDataOld[0];
  1740 + }
  1741 + }
  1742 +
  1743 + for (const item of selectData) {
  1744 + const newCopyTo = {};
  1745 + newCopyTo.master = masterData;
  1746 + newCopyTo.control = controlSelectedRow;
  1747 + let tableDataRow = commonFunc.getDefaultData(tableConfig, newCopyTo); // 取默认值
  1748 + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) };
  1749 + tableDataRow.handleType = "add";
  1750 + tableDataRow.sId = commonUtils.createSid();
  1751 + tableDataRow.sParentId = masterData.sId;
  1752 + tableDataRow.sProcessId = item.sProcessId;
  1753 + const sProcessId = item.sProcessId;
  1754 + const iProcessIndex = processDataOld.findIndex(item => item.sProcessId === sProcessId);
  1755 + if (iProcessIndex > -1) {
  1756 + tableDataRow.sProcessTbId = processDataOld[iProcessIndex].sId; /* 工序表格ID */
  1757 + tableDataRow.sMaterialsProcessNameOrder = processDataOld[iProcessIndex].sProcessName; /* 工序ID */
  1758 + tableDataRow.sMaterialsProcessName = processDataOld[iProcessIndex].sProcessName; /* 工序ID */
  1759 + }
  1760 + tableDataRow.sControlId = controlSelectedRow?.sId;
  1761 + tableDataRow.sPartsName = controlSelectedRow?.sPartsName;
  1762 + materialsDataOld.push(tableDataRow);
  1763 + }
  1764 + console.log('插入', materialsDataOld);
  1765 + props.onSaveState({
  1766 + materials0Data: materialsDataOld,
  1767 + [`${name}ChooseVisible`]: false
  1768 + });
  1769 + } else if (bTmpInfoBySql) {
1725 1770 /* 复制从部件 根据配置下拉sql获取数据源 通过按钮名称是否包含add来判断数据源新增还是删除 */
1726 1771 const addState = {};
1727 1772 let controlData = commonUtils.isEmptyArr(controlDataOld) ? [] : controlDataOld;
... ... @@ -2298,7 +2343,7 @@ const WorkOrderPackTableTreeNewEvent = props =&gt; {
2298 2343 }
2299 2344 });
2300 2345 }
2301   - console.log('1122221', returnData.colorData, colorAssignField);
  2346 +
2302 2347 if (commonUtils.isNotEmptyArr(returnData.colorData)) {
2303 2348 if (commonUtils.isNotEmptyObject(config.colorConfig)) {
2304 2349 returnData.colorData.forEach(colorItem => {
... ...