|
|
@ -243,7 +243,7 @@ |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="span-sty" style="border-right: 0px">应付金额:</div> |
|
|
|
<el-form-item><span class="addinputInfo">{{ yfTotal }} = 采购金额:{{ cgTotal }} + 运费:<el-input @keyup.native="formobj.freight = getNumber(formobj.freight, 2)" v-model="formobj.freight" style="width: 160px" clearable placeholder="" /> - 优惠:<el-input @keyup.native="formobj.discountAmount = getNumber(formobj.discountAmount, 2)" v-model="formobj.discountAmount" style="width: 160px" clearable placeholder="" /> + 误差调整:<el-input @keyup.native="formobj.errorAmount = getNumber(formobj.errorAmount, 2)" v-model="formobj.errorAmount" style="width: 160px" clearable placeholder="" /></span></el-form-item> |
|
|
|
<el-form-item><span class="addinputInfo">{{ yfTotal }} = 采购金额:{{ cgTotal }} + 运费:<el-input @keyup.native="formobj.freight = getNumber(formobj.freight, 2)" v-model="formobj.freight" style="width: 160px" clearable placeholder="" /> - 优惠:<el-input @keyup.native="formobj.discountAmount = getNumber(formobj.discountAmount, 2)" v-model="formobj.discountAmount" style="width: 160px" clearable placeholder="" /> + 误差调整:<el-input @keyup.native="formobj.errorAmount = inputByAstrict(formobj.errorAmount, 2)" v-model="formobj.errorAmount" style="width: 160px" clearable placeholder="" /></span></el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
@ -511,6 +511,29 @@ export default { |
|
|
|
} |
|
|
|
return val |
|
|
|
}, |
|
|
|
inputByAstrict(val, limit) { |
|
|
|
let value = val.replace(/[^\-\d.]/g, '') // 只能输入'.'和'-'及数字 |
|
|
|
value = value.replace(/^\./g, '') // 第一个字符不能是'.' |
|
|
|
value = value.replace(/\.{2,}/g, '.') // 不能连续输入'.' |
|
|
|
value = value.replace(/(\.\d+)\./g, '$1') // '.'后面不能在输入'0' |
|
|
|
value = value.replace(/(-)\./g, '$1') // '-'后面不能输入'.' |
|
|
|
value = value.replace(/\-{2,}/g, '-') // 只保留一个'-' |
|
|
|
value = value.replace(/(\d+|\.)-/g, '$1') // 数字和'.'后面不能跟'-', 例如11- 或 11.- |
|
|
|
value = value.replace(/-(0){2,}/g, '$1') // 不能出现-00、-001、-0001等 |
|
|
|
value = value.replace(/(-)0+(\d+)/g, '$1$2') // 不能出现-01、-02等 |
|
|
|
value = value.replace(/^0+(\d)/, '$1') // 第一位0开头,0后面为数字,则过滤掉0, 取后面的数字 |
|
|
|
value = value.replace(/(\d{15})\d*/, '$1') // 最多保留15整数 |
|
|
|
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$' |
|
|
|
const reg = new RegExp(str) |
|
|
|
if (limit === 0) { |
|
|
|
// 不需要小数点 |
|
|
|
value = value.replace(reg, '$1') |
|
|
|
} else { |
|
|
|
// 通过正则保留小数点后指定的位数 |
|
|
|
value = value.replace(reg, '$1.$2') |
|
|
|
} |
|
|
|
return value |
|
|
|
}, |
|
|
|
purchaseTypeChange(value) { |
|
|
|
const choose = this.procurementType_list.filter((item) => item.dictValue === value) |
|
|
|
if (choose !== null && choose.length > 0) { |
|
|
|