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,7 +105,6 @@ class IndexCenter extends Component { | ||
| 105 | componentWillReceiveProps(nextProps) { | 105 | componentWillReceiveProps(nextProps) { |
| 106 | const { dispatch } = nextProps; | 106 | const { dispatch } = nextProps; |
| 107 | const { modelCenter, comParameter:comParameterAll = [], dataCode, kpiData, logoImageInfo, userinfo, token } = nextProps.app; | 107 | const { modelCenter, comParameter:comParameterAll = [], dataCode, kpiData, logoImageInfo, userinfo, token } = nextProps.app; |
| 108 | - console.log('1-comParameterAll', comParameterAll); | ||
| 109 | const comParameter = comParameterAll.filter(item => item.sDisplayType ? item.sDisplayType !== 'LargeScreen' : !item.sFormUrl?.includes('http')); | 108 | const comParameter = comParameterAll.filter(item => item.sDisplayType ? item.sDisplayType !== 'LargeScreen' : !item.sFormUrl?.includes('http')); |
| 110 | const commonThirdApp = comParameterAll.filter(item => item.sDisplayType ? item.sDisplayType === 'LargeScreen' : item.sFormUrl?.includes('http')); | 109 | const commonThirdApp = comParameterAll.filter(item => item.sDisplayType ? item.sDisplayType === 'LargeScreen' : item.sFormUrl?.includes('http')); |
| 111 | const { modelCenter: modelCenterOld } = this.props; | 110 | const { modelCenter: modelCenterOld } = this.props; |
src/components/Manufacture/CommonPackEvent.js
| @@ -134,14 +134,14 @@ const CommonPackEvent = props => { | @@ -134,14 +134,14 @@ const CommonPackEvent = props => { | ||
| 134 | colorConfig, | 134 | colorConfig, |
| 135 | sModelsType, | 135 | sModelsType, |
| 136 | colorData, | 136 | colorData, |
| 137 | - slaveDelData, | ||
| 138 | - controlDelData, | ||
| 139 | - processDelData, | ||
| 140 | - colorDelData, | ||
| 141 | - packDelData, | 137 | + slaveDelData = [], |
| 138 | + controlDelData= [], | ||
| 139 | + processDelData= [], | ||
| 140 | + colorDelData= [], | ||
| 141 | + packDelData= [], | ||
| 142 | addStateMap, | 142 | addStateMap, |
| 143 | materials0Config, | 143 | materials0Config, |
| 144 | - materials0DelData, | 144 | + materials0DelData = [], |
| 145 | } = props; | 145 | } = props; |
| 146 | let { slaveData, packData, controlData, processData, masterData, materials0Data } = props; | 146 | let { slaveData, packData, controlData, processData, masterData, materials0Data } = props; |
| 147 | const sMakePerson = masterData.sMakePerson; | 147 | const sMakePerson = masterData.sMakePerson; |
| @@ -172,11 +172,79 @@ const CommonPackEvent = props => { | @@ -172,11 +172,79 @@ const CommonPackEvent = props => { | ||
| 172 | if (masterData.handleType === "update" && !commonUtils.isEmpty(sMakePerson)) { | 172 | if (masterData.handleType === "update" && !commonUtils.isEmpty(sMakePerson)) { |
| 173 | masterData.sMakePerson = sMakePerson; | 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 | if (bSave) { | 250 | if (bSave) { |
| @@ -226,6 +294,11 @@ const CommonPackEvent = props => { | @@ -226,6 +294,11 @@ const CommonPackEvent = props => { | ||
| 226 | materials0Data, | 294 | materials0Data, |
| 227 | processData, | 295 | processData, |
| 228 | masterData, | 296 | masterData, |
| 297 | + slaveDelData, | ||
| 298 | + controlDelData, | ||
| 299 | + materials0DelData, | ||
| 300 | + processDelData, | ||
| 301 | + colorDelData, | ||
| 229 | loading: false, | 302 | loading: false, |
| 230 | calculated: true, | 303 | calculated: true, |
| 231 | }); | 304 | }); |
src/components/Manufacture/WorkOrderPackTableTreeNew/index.js
| @@ -254,7 +254,6 @@ const WorkOrderPackTableTreeNewEvent = props => { | @@ -254,7 +254,6 @@ const WorkOrderPackTableTreeNewEvent = props => { | ||
| 254 | }, {}); | 254 | }, {}); |
| 255 | 255 | ||
| 256 | const func = props[`${tableName}Props`]?.[funcName]; | 256 | const func = props[`${tableName}Props`]?.[funcName]; |
| 257 | - console.log("=====func", func); | ||
| 258 | if (func) { | 257 | if (func) { |
| 259 | return func(params); | 258 | return func(params); |
| 260 | } | 259 | } |