Browse Source

完善采购申请,误差调整字段能填写负数的功能

master
yunuo970428 2 months ago
parent
commit
73c0e19950
  1. 25
      yxt-as-ui/src/views/purchase/procurement/procurementAdd.vue
  2. 25
      yxt-as-ui/src/views/workFlow/caigouFlow/procurementEdit.vue

25
yxt-as-ui/src/views/purchase/procurement/procurementAdd.vue

@ -243,7 +243,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<div class="span-sty" style="border-right: 0px">应付金额</div> <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-col>
</el-row> </el-row>
</el-form> </el-form>
@ -511,6 +511,29 @@ export default {
} }
return val 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') // 000
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) { purchaseTypeChange(value) {
const choose = this.procurementType_list.filter((item) => item.dictValue === value) const choose = this.procurementType_list.filter((item) => item.dictValue === value)
if (choose !== null && choose.length > 0) { if (choose !== null && choose.length > 0) {

25
yxt-as-ui/src/views/workFlow/caigouFlow/procurementEdit.vue

@ -242,7 +242,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<div class="span-sty" style="border-right: 0px">应付金额</div> <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-col>
</el-row> </el-row>
</el-form> </el-form>
@ -502,6 +502,29 @@ export default {
} }
return val 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') // 000
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) { purchaseTypeChange(value) {
const choose = this.procurementType_list.filter((item) => item.dictValue === value) const choose = this.procurementType_list.filter((item) => item.dictValue === value)
if (choose !== null && choose.length > 0) { if (choose !== null && choose.length > 0) {

Loading…
Cancel
Save