Commit c72e76be88da00d7bb51eb8498e84ca8c13d7790
1 parent
eb63d37c
1.处理工单计算,处理del的数据
Showing
3 changed files
with
84 additions
and
13 deletions
src/components/IndexCenter/IndexCenter.js
| ... | ... | @@ -105,7 +105,6 @@ class IndexCenter extends Component { |
| 105 | 105 | componentWillReceiveProps(nextProps) { |
| 106 | 106 | const { dispatch } = nextProps; |
| 107 | 107 | const { modelCenter, comParameter:comParameterAll = [], dataCode, kpiData, logoImageInfo, userinfo, token } = nextProps.app; |
| 108 | - console.log('1-comParameterAll', comParameterAll); | |
| 109 | 108 | const comParameter = comParameterAll.filter(item => item.sDisplayType ? item.sDisplayType !== 'LargeScreen' : !item.sFormUrl?.includes('http')); |
| 110 | 109 | const commonThirdApp = comParameterAll.filter(item => item.sDisplayType ? item.sDisplayType === 'LargeScreen' : item.sFormUrl?.includes('http')); |
| 111 | 110 | const { modelCenter: modelCenterOld } = this.props; | ... | ... |
src/components/Manufacture/CommonPackEvent.js
| ... | ... | @@ -134,14 +134,14 @@ const CommonPackEvent = props => { |
| 134 | 134 | colorConfig, |
| 135 | 135 | sModelsType, |
| 136 | 136 | colorData, |
| 137 | - slaveDelData, | |
| 138 | - controlDelData, | |
| 139 | - processDelData, | |
| 140 | - colorDelData, | |
| 141 | - packDelData, | |
| 137 | + slaveDelData = [], | |
| 138 | + controlDelData= [], | |
| 139 | + processDelData= [], | |
| 140 | + colorDelData= [], | |
| 141 | + packDelData= [], | |
| 142 | 142 | addStateMap, |
| 143 | 143 | materials0Config, |
| 144 | - materials0DelData, | |
| 144 | + materials0DelData = [], | |
| 145 | 145 | } = props; |
| 146 | 146 | let { slaveData, packData, controlData, processData, masterData, materials0Data } = props; |
| 147 | 147 | const sMakePerson = masterData.sMakePerson; |
| ... | ... | @@ -172,11 +172,79 @@ const CommonPackEvent = props => { |
| 172 | 172 | if (masterData.handleType === "update" && !commonUtils.isEmpty(sMakePerson)) { |
| 173 | 173 | masterData.sMakePerson = sMakePerson; |
| 174 | 174 | } |
| 175 | - slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`]; | |
| 176 | - packData = valueReturn[`${packConfig.sTbName.toLowerCase()}_tmp`]; | |
| 177 | - controlData = valueReturn[`${controlConfig.sTbName.toLowerCase()}_tmp`]; | |
| 178 | - materials0Data = valueReturn[`${materials0Config.sTbName.toLowerCase()}_tmp`]; | |
| 179 | - processData = valueReturn[`${processConfig.sTbName.toLowerCase()}_tmp`]; | |
| 175 | + let slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`] || []; | |
| 176 | + let packData = valueReturn[`${packConfig.sTbName.toLowerCase()}_tmp`] || []; | |
| 177 | + let controlData = valueReturn[`${controlConfig.sTbName.toLowerCase()}_tmp`] || []; | |
| 178 | + let materials0Data = valueReturn[`${materials0Config.sTbName.toLowerCase()}_tmp`] || []; | |
| 179 | + let processData = valueReturn[`${processConfig.sTbName.toLowerCase()}_tmp`] || []; | |
| 180 | + | |
| 181 | + const slaveDelNewData = slaveData.filter(item => item?.handleType === 'del'); | |
| 182 | + slaveData = slaveData.filter(item => item?.handleType !== 'del'); | |
| 183 | + | |
| 184 | + const packDelNewData = packData.filter(item => item?.handleType === 'del'); | |
| 185 | + packData = packData.filter(item => item?.handleType !== 'del'); | |
| 186 | + | |
| 187 | + const controlDelNewData = controlData.filter(item => item?.handleType === 'del'); | |
| 188 | + controlData = controlData.filter(item => item?.handleType !== 'del'); | |
| 189 | + | |
| 190 | + const materials0DelNewData = materials0Data.filter(item => item?.handleType === 'del'); | |
| 191 | + materials0Data = materials0Data.filter(item => item?.handleType !== 'del'); | |
| 192 | + | |
| 193 | + const processDelNewData = processData.filter(item => item?.handleType === 'del'); | |
| 194 | + processData = processData.filter(item => item?.handleType !== 'del'); | |
| 195 | + | |
| 196 | + | |
| 197 | + slaveDelNewData.forEach(item => { | |
| 198 | + // 获取当前项的 sId,使用可选链避免报错 | |
| 199 | + const currentSId = item?.sId; | |
| 200 | + // 查找目标数组中是否存在相同 sId 的项 | |
| 201 | + const existIndex = slaveDelData.findIndex(row => row?.sId === currentSId); | |
| 202 | + // 不存在(index === -1)且 currentSId 有效时,执行 push | |
| 203 | + if (currentSId && existIndex === -1) { | |
| 204 | + slaveDelData.push(item); | |
| 205 | + } | |
| 206 | + }); | |
| 207 | + | |
| 208 | + | |
| 209 | + packDelNewData.forEach(item => { | |
| 210 | + const currentSId = item?.sId; | |
| 211 | + const existIndex = packDelData.findIndex(row => row?.sId === currentSId); | |
| 212 | + if (currentSId && existIndex === -1) { | |
| 213 | + packDelData.push(item); | |
| 214 | + } | |
| 215 | + }); | |
| 216 | + | |
| 217 | + | |
| 218 | + controlDelNewData.forEach(item => { | |
| 219 | + const currentSId = item?.sId; | |
| 220 | + const existIndex = controlDelData.findIndex(row => row?.sId === currentSId); | |
| 221 | + if (currentSId && existIndex === -1) { | |
| 222 | + controlDelData.push(item); | |
| 223 | + } | |
| 224 | + }); | |
| 225 | + | |
| 226 | + | |
| 227 | + materials0DelNewData.forEach(item => { | |
| 228 | + const currentSId = item?.sId; | |
| 229 | + const existIndex = materials0DelData.findIndex(row => row?.sId === currentSId); | |
| 230 | + if (currentSId && existIndex === -1) { | |
| 231 | + materials0DelData.push(item); | |
| 232 | + } | |
| 233 | + }); | |
| 234 | + | |
| 235 | + | |
| 236 | + processDelNewData.forEach(item => { | |
| 237 | + const currentSId = item?.sId; | |
| 238 | + const existIndex = processDelData.findIndex(row => row?.sId === currentSId); | |
| 239 | + if (currentSId && existIndex === -1) { | |
| 240 | + processDelData.push(item); | |
| 241 | + } | |
| 242 | + }); | |
| 243 | + console.log('计算', | |
| 244 | + { | |
| 245 | + slaveData, controlData, materials0Data, packDelData, processData, | |
| 246 | + slaveDelData, controlDelData, materials0DelData, packDelNewData, processDelData | |
| 247 | + }) | |
| 180 | 248 | |
| 181 | 249 | /* 计算成功后自动调用保存 */ |
| 182 | 250 | if (bSave) { |
| ... | ... | @@ -226,6 +294,11 @@ const CommonPackEvent = props => { |
| 226 | 294 | materials0Data, |
| 227 | 295 | processData, |
| 228 | 296 | masterData, |
| 297 | + slaveDelData, | |
| 298 | + controlDelData, | |
| 299 | + materials0DelData, | |
| 300 | + processDelData, | |
| 301 | + colorDelData, | |
| 229 | 302 | loading: false, |
| 230 | 303 | calculated: true, |
| 231 | 304 | }); | ... | ... |
src/components/Manufacture/WorkOrderPackTableTreeNew/index.js