Commit aee48410a2fb758c71303428020e57e2b54f9498
1 parent
3dd80d02
出版选择颜色
Showing
1 changed file
with
21 additions
and
3 deletions
src/mes/common/commonModelComponent/index.js
| ... | ... | @@ -3163,6 +3163,13 @@ const SisColorChooseComponent = props => { |
| 3163 | 3163 | const { [`${sisTableName}Data`]: tableData } = props; |
| 3164 | 3164 | const iIndex = tableData?.findIndex(item => item.sId === controlSelectedRowId); |
| 3165 | 3165 | // iPositiveColor sPositiveColor sOppositeColor |
| 3166 | + if (props?.sisColorSelectedData && props?.sisColorSelectedData?.length === 0) { | |
| 3167 | + props.onSaveState({ | |
| 3168 | + sisColorChooseVisible: false, | |
| 3169 | + sisColorSelectedData: [] | |
| 3170 | + }); | |
| 3171 | + return | |
| 3172 | + } | |
| 3166 | 3173 | const colorList = JSON.parse(tableData[iIndex][sisColorField]).map(item => { |
| 3167 | 3174 | const i = rightData.findIndex(rightItem => rightItem.sId === item.sId); |
| 3168 | 3175 | let newItem = { |
| ... | ... | @@ -3176,13 +3183,24 @@ const SisColorChooseComponent = props => { |
| 3176 | 3183 | } |
| 3177 | 3184 | return newItem |
| 3178 | 3185 | }); |
| 3179 | - const totalDColor = rightData.reduce((total, item) => total + item.dColor, 0); | |
| 3180 | 3186 | tableData[iIndex] = { |
| 3181 | 3187 | ...tableData[iIndex], |
| 3182 | 3188 | [sisColorField]: JSON.stringify(colorList), |
| 3183 | - iOutsideQty: totalDColor, | |
| 3184 | - iPublishQty: totalDColor | |
| 3185 | 3189 | } |
| 3190 | + const { sPositiveColor, sOppositeColor } = tableData[iIndex] | |
| 3191 | + const sPositiveColorList = (sPositiveColor && sPositiveColor !== 'undefined' && sPositiveColor !== 'null') | |
| 3192 | + ? JSON.parse(sPositiveColor).filter(item => item.bSelected) | |
| 3193 | + : []; | |
| 3194 | + const sOppositeColorList = (sOppositeColor && sOppositeColor !== 'undefined' && sOppositeColor !== 'null') | |
| 3195 | + ? JSON.parse(sOppositeColor).filter(item => item.bSelected) | |
| 3196 | + : []; | |
| 3197 | + const allTotalDColor = sPositiveColorList.reduce((total, item) => total + item.dColor, 0) + sOppositeColorList.reduce((total, item) => total + item.dColor, 0); | |
| 3198 | + tableData[iIndex] = { | |
| 3199 | + ...tableData[iIndex], | |
| 3200 | + iOutsideQty: allTotalDColor, | |
| 3201 | + iPublishQty: allTotalDColor | |
| 3202 | + } | |
| 3203 | + | |
| 3186 | 3204 | props.onSaveState({ |
| 3187 | 3205 | [`${sisTableName}Data`]: [...tableData], |
| 3188 | 3206 | sisColorChooseVisible: false, | ... | ... |