Commit 1f629803 authored by d.arizona's avatar d.arizona

apdet

parent 20f2bb00
...@@ -371,7 +371,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -371,7 +371,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.item_report, item.item_report,
item.weight, String(item.weight).includes("%") ? String(item.weight).substr(0, String(item.weight).length - 1) : item.weight,
item.uom, item.uom,
item.jenis_kpi, item.jenis_kpi,
item.max_ach, item.max_ach,
...@@ -633,6 +633,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -633,6 +633,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
handleBackgroundPerf(total) { handleBackgroundPerf(total) {
console.log(total)
let color = 'white' let color = 'white'
if ( total >= 1.00 && total <= 2.00) { if ( total >= 1.00 && total <= 2.00) {
color = 'red' color = 'red'
...@@ -913,49 +914,6 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -913,49 +914,6 @@ export default class CorporateAnnualTargetMR extends Component {
return total return total
} }
const handleChangeDropdown = (value, tableMeta) => {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
let valz = value.value
let total = 0
let lastValz = 0
if (valz == 'SUM' || valz == 'AVG' || valz == 'LAST') {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 13 && index <= 24) {
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
if (index == 24) {
lastValz += Number(valItem)
}
}
})
dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
}
}
const handleValueDropdown = (value, type, tableMeta) => {
// console.log(value,type, tableMeta);
// console.log(this.state.maxAchList.options);
let data = type == 'KPI' ? this.state.kpiTypeList.options : (type == 'MAX' ? this.state.maxAchList.options : this.state.formulaYtdList.options)
// console.log(data);
let index = 0
if (value == null) {
// console.log("masuk");
index = -1
} else {
index = data.findIndex((val) => val.value == value.value)
}
// console.log(value)
// console.log(data)
// console.log(index)
if (index == -1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null
return null
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
return value
}
}
const handleChangeText = (value, tableMeta) => { const handleChangeText = (value, tableMeta) => {
// // console.log(value) // // console.log(value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
...@@ -1086,7 +1044,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1086,7 +1044,7 @@ export default class CorporateAnnualTargetMR extends Component {
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase()) let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase())
let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id) let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
let totalScore = 0 let totalScore = 0
let achx100 = tableMeta.rowData[9] == '100%'? 1 : Number(tableMeta.rowData[13])/100 let achx100 = tableMeta.rowData[9] == '100%'? Number(tableMeta.rowData[13])/100 > 1? 1 : Number(tableMeta.rowData[13])/100 : Number(tableMeta.rowData[13])/100
if (listParameterFilterCompany.length == 0) { if (listParameterFilterCompany.length == 0) {
listParameterFilter.map((item,index) => { listParameterFilter.map((item,index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) { if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
...@@ -1118,6 +1076,37 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1118,6 +1076,37 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(total) // console.log(total)
} }
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2)
if (tableMeta.rowIndex == dataTable2.length -1) {
let totals = 0
let perfomanceScoreX = ''
dataTable2.map((item,index) => {
let value = String(item[15]) == 'NaN' || String(item[15]) == ''? 0 : Number(item[15])
totals += value
})
totals = Number(totals).toFixed(2)
if ( totals >= 1.00 && totals <= 2.00) {
perfomanceScoreX = 'K'
} else if ( totals >= 2.01 && totals <= 2.75) {
perfomanceScoreX = 'C'
} else if ( totals >= 2.76 && totals <= 3.00) {
perfomanceScoreX = 'B-'
} else if ( totals >= 3.01 && totals <= 3.75) {
perfomanceScoreX = 'B'
} else if ( totals >= 3.76 && totals <= 4.00) {
perfomanceScoreX = 'B+'
} else if ( totals >= 4.01 && totals <= 4.75) {
perfomanceScoreX = 'BS'
} else if ( totals >= 4.76 && totals <= 5.00) {
perfomanceScoreX = 'IST'
}
totalScoreXXX = totals
perfomanceScore = perfomanceScoreX
setTimeout(() => {
console.log(totalScoreXXX)
console.log(perfomanceScore)
}, 300);
}
return total return total
} }
......
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