diff --git a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js index 16a8a099..bf80c8f8 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/salaryItemForm.js @@ -36,7 +36,6 @@ class SalaryItemForm extends Component { const { key } = item; switch (key) { case "useDefault": - case "sortedIndex": case "dataType": case "description": return { @@ -44,6 +43,8 @@ class SalaryItemForm extends Component { viewAttr: (!isLedger && ((editable && record.canEdit) || isAdd)) ? 2 : 1, display: !isLedger }; + case "sortedIndex": + return { ...item }; case "useInEmployeeSalary": return { ...item, diff --git a/pc4mobx/hrmSalary/stores/calculate.js b/pc4mobx/hrmSalary/stores/calculate.js index f842d9f0..5b270ddf 100644 --- a/pc4mobx/hrmSalary/stores/calculate.js +++ b/pc4mobx/hrmSalary/stores/calculate.js @@ -3,6 +3,7 @@ import { message } from "antd"; import { WeaForm, WeaTableNew } from "comsMobx"; import * as API from "../apis/calculate"; +import { toDecimal_n } from "../util"; const { TableStore } = WeaTableNew; @@ -492,7 +493,7 @@ export class calculateStore { ..._.map(cur.salaryItems, it => { return { salaryItemId: it.salaryItemId, - resultValue: it.resultValue + resultValue: (it.dataType === "number" && !!it.resultValue) ? toDecimal_n(it.resultValue, it.pattern || 2) : it.resultValue }; }) ]; @@ -501,7 +502,7 @@ export class calculateStore { const issuedAndReissueItems = this.acctresultDetailForm.issuedAndReissueItems.map(item => { let record = {}; record.salaryItemId = item.salaryItemId; - record.resultValue = item.resultValue; + record.resultValue = (item.dataType === "number" && !!item.resultValue) ? toDecimal_n(item.resultValue, item.pattern || 2) : item.resultValue; return record; }); diff --git a/pc4mobx/hrmSalary/util/index.js b/pc4mobx/hrmSalary/util/index.js index 6e864a59..a3cc81bf 100644 --- a/pc4mobx/hrmSalary/util/index.js +++ b/pc4mobx/hrmSalary/util/index.js @@ -109,3 +109,24 @@ export const format_with_regex = (number) => { export const getDomkes = (conditions) => { return _.map(conditions[0].items, it => it.domkey[0]); }; + +export const padding0 = (num, length) => { + for (let len = ("" + num).length; len < length; len++) { + num = "0" + num; + } + return "0." + num; +}; +export const toDecimal_n = (x, num) => { + if (isNaN(parseFloat(x))) return false; + let f = Math.round(x * 100) / 100; + let s = f.toString(); + let rs = s.indexOf("."); + if (rs < 0) { + rs = s.length; + s += "."; + } + while (s.length <= rs + num) { + s += "0"; + } + return s; +};