Commit c91aa0a0 authored by d.arizona's avatar d.arizona

apdet

parent 4cb685d5
......@@ -243,7 +243,7 @@ export default class CorporateAnnualTarget extends Component {
let isi = resp.rows.slice(3)
console.log(isi);
let payload = []
let reg = /^\d+$/;
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
if (i.length > 0) {
let total = 0
......@@ -267,11 +267,11 @@ export default class CorporateAnnualTarget extends Component {
payload.push({
item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : reg.test(String(i[2])) === false ? "" : String(i[2]).trim(),
uom: i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : reg.test(String(i[4])) === false ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : reg.test(String(i[5])) === false ? "" : String(i[5]).trim(),
formula: i[6] === undefined ? "" : reg.test(String(i[6])) === false ? "" : String(i[6]).trim(),
weight: i[2] === undefined ? "" : String(Number(i[2]*100) +'%'),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? String(Number(i[5]*100) + '%') : String(i[5]).trim(),
formula: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
......@@ -341,7 +341,7 @@ export default class CorporateAnnualTarget extends Component {
item.uom,
item.kpi_type == "" || item.kpi_type == null ? null : { value: item.kpi_type },
item.max_ach == "" || item.max_ach == null ? null : { value: item.max_ach },
item.formula == "" || item.formula == null ? null : { value: item.formula },
item.formula_ytd == "" || item.formula_ytd == null ? null : { value: item.formula_ytd },
item.total_actual_before == "" ? item.total_actual_before : String(item.total_actual_before).indexOf(".") == -1 ? Number(item.total_actual_before) : Number(item.total_actual_before).toFixed(1),
item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1),
item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1),
......
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