Commit 8eadbf8a authored by d.arizona's avatar d.arizona

issue CAT

parent aa99d6c6
...@@ -636,6 +636,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -636,6 +636,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
handleCalculate(datatable2) { handleCalculate(datatable2) {
// console.log(datatable2)
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
let total = 0 let total = 0
let perfomanceScore = '' let perfomanceScore = ''
...@@ -690,7 +691,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -690,7 +691,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
}) })
} }
totalScore = Number(totalScore).toFixed(0) let totalScorez = Number(totalScore).toFixed(0)
//Score X Weight //Score X Weight
let totalSW = 0 let totalSW = 0
...@@ -703,16 +704,21 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -703,16 +704,21 @@ export default class CorporateAnnualTargetMR extends Component {
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') { if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalSW = 0 totalSW = 0
} else { } else {
totalSW = (Number(totalScore) * Number(handlePercent) / 100) totalSW = (Number(totalScorez) * Number(handlePercent) / 1000)
} }
totalSW = Number(totalSW).toFixed(2) totalSW = Number(totalSW).toFixed(2)
// console.log(totalSW)
if (item[0] !== 1 && item[0] !== 4) { if (item[0] !== 1 && item[0] !== 4) {
total += Number(totalSW) total += Number(totalSW)
} }
// console.log(item[5])
// console.log(totalAch);
// console.log(achx100);
// console.log(listParameterFilter);
// console.log(listParameterFilterCompany);
// console.log(totalScorez)
// console.log(totalSW)
// console.log(total)
return [ return [
[
item[0], item[0],
item[1], item[1],
item[2], item[2],
...@@ -727,37 +733,39 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -727,37 +733,39 @@ export default class CorporateAnnualTargetMR extends Component {
item[11], item[11],
item[12], item[12],
totalAch, totalAch,
totalScore, totalScorez,
totalSW, totalSW,
item[16], item[16],
item[17], item[17],
item[18], item[18],
item[19], // item[19],
] // ]
] ]
}) })
console.log(totalWeight) // console.log(totalWeight)
console.log(total) // console.log(total)
console.log(datatable3); // console.log(datatable3);
totalWeight = Number(totalWeight) / 100 let totalWeightz = Number(totalWeight) / 100
total = Number(Number(total).toFixed(2) / Number(totalWeight)).toFixed(2) let totalz = Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2)
if (total >= 1.00 && total <= 2.00) { let lastTotal = R.equals(totalz, NaN) ? 0.0 : totalz
// console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
if (lastTotal >= 1.00 && lastTotal <= 2.00) {
perfomanceScore = 'K' perfomanceScore = 'K'
} else if (total >= 2.01 && total <= 2.75) { } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
perfomanceScore = 'C' perfomanceScore = 'C'
} else if (total >= 2.76 && total <= 3.00) { } else if (lastTotal >= 2.76 && lastTotal <= 3.00) {
perfomanceScore = 'B-' perfomanceScore = 'B-'
} else if (total >= 3.01 && total <= 3.75) { } else if (lastTotal >= 3.01 && lastTotal <= 3.75) {
perfomanceScore = 'B' perfomanceScore = 'B'
} else if (total >= 3.76 && total <= 4.00) { } else if (lastTotal >= 3.76 && lastTotal <= 4.00) {
perfomanceScore = 'B+' perfomanceScore = 'B+'
} else if (total >= 4.01 && total <= 4.75) { } else if (lastTotal >= 4.01 && lastTotal <= 4.75) {
perfomanceScore = 'BS' perfomanceScore = 'BS'
} else if (total >= 4.76 && total <= 5.00) { } else if (lastTotal >= 4.76 && lastTotal <= 5.00) {
perfomanceScore = 'IST' perfomanceScore = 'IST'
} }
setTimeout(() => { setTimeout(() => {
this.setState({ totalScore: total, perfomanceScore, loading: false}, () => { this.setState({ totalScore: lastTotal, perfomanceScore, loading: false}, () => {
this.setState({loading: true}) this.setState({loading: true})
setTimeout(() => { setTimeout(() => {
this.setState({loading: false}) this.setState({loading: false})
...@@ -1044,10 +1052,10 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1044,10 +1052,10 @@ export default class CorporateAnnualTargetMR extends Component {
if (dataTable2[tableMeta.rowIndex][5] == "ROIC") { if (dataTable2[tableMeta.rowIndex][5] == "ROIC") {
dataTable2[tableMeta.rowIndex][column] = 0 dataTable2[tableMeta.rowIndex][column] = 0
} else { } else {
dataTable2[tableMeta.rowIndex][column] = total dataTable2[tableMeta.rowIndex][column] = Number(total).toFixed(1)
} }
return total return Number(total).toFixed(1)
} }
const handleChangeText = (value, tableMeta) => { const handleChangeText = (value, tableMeta) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment