Browse Source

Merge remote-tracking branch 'origin/master'

master
God 10 months ago
parent
commit
0a01fe8a6a
  1. 26
      yxt-as-ui/src/views/basicinformation/maintenanceitem/maintenanceitemAdd.vue

26
yxt-as-ui/src/views/basicinformation/maintenanceitem/maintenanceitemAdd.vue

@ -61,17 +61,17 @@
</el-col>
<el-col :span="8">
<div class="span-sty"><span class="icon">*</span>工时数</div>
<el-form-item prop="hours"><el-input class="addinputInfo addinputw" @keyup.native="formobj.hours = getNumber(formobj.hours, 2)" v-model="formobj.hours" clearable placeholder="" /></el-form-item>
<el-form-item prop="hours"><el-input @input="priceInput(formobj)" class="addinputInfo addinputw" @keyup.native="formobj.hours = getNumber(formobj.hours, 2)" v-model="formobj.hours" clearable placeholder="" /></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty"><span class="icon">*</span>外协成本</div>
<el-form-item prop="cost"><el-input class="addinputInfo addinputw" @keyup.native="formobj.cost = getNumber(formobj.cost, 2)" v-model="formobj.cost" clearable placeholder="" /></el-form-item>
<el-form-item prop="cost"><el-input @input="priceInput(formobj)" class="addinputInfo addinputw" @keyup.native="formobj.cost = getNumber(formobj.cost, 2)" v-model="formobj.cost" clearable placeholder="" /></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty"><span class="icon">*</span>销售价</div>
<el-form-item prop="price"><span class="addinputInfo">{{ calculatePrice }}</span></el-form-item>
<el-form-item prop="price"><span class="addinputInfo">{{ formobj.price }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty"><span class="icon">*</span>工时提成</div>
@ -174,14 +174,6 @@ export default {
}
}
},
computed: {
// = * +
calculatePrice() {
let price = '0'
price = Math.round((parseFloat(price) + (parseFloat(this.formobj.hourPrice !== '' ? this.formobj.hourPrice : '0') * parseFloat(this.formobj.hours !== '' ? this.formobj.hours : '0')) + parseFloat(this.formobj.cost !== '' ? this.formobj.cost : '0')) * 100) / 100
return price
}
},
methods: {
init() {
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => {
@ -285,16 +277,22 @@ export default {
this.formobj.manufacturerSid = ''
}
},
// = * +
priceInput(val) {
val.price = Math.round(((parseFloat(val.hourPrice !== '' ? val.hourPrice : '0') * parseFloat(val.hours !== '' ? val.hours : '0')) + parseFloat(val.cost !== '' ? val.cost : '0')) * 100) / 100
//
val.examineHourPrice = ''
this.royaltiesRatio = ''
},
// = /
royaltiesRatioInput(val) {
this.royaltiesRatio = Math.round((((parseFloat(val.examineHourPrice !== '' ? val.examineHourPrice : '0') / parseFloat(this.calculatePrice)) * 100).toFixed(2)) * 100) / 100
this.royaltiesRatio = Math.round((((parseFloat(val.examineHourPrice !== '' ? val.examineHourPrice : '0') / parseFloat(val.price !== '' ? val.price : '0')) * 100).toFixed(2)) * 100) / 100
},
// = *
examineHourPriceInput(val) {
val.examineHourPrice = Math.round((parseFloat(this.calculatePrice) * ((parseFloat(this.royaltiesRatio !== '' ? this.royaltiesRatio : '0') / 100)).toFixed(2)) * 100) / 100
val.examineHourPrice = Math.round((parseFloat(val.price !== '' ? val.price : '0') * ((parseFloat(this.royaltiesRatio !== '' ? this.royaltiesRatio : '0') / 100)).toFixed(2)) * 100) / 100
},
saveOrUpdate() {
this.formobj.price = this.calculatePrice
this.$refs['form_obj'].validate((valid) => {
if (valid) {
this.submitdisabled = true

Loading…
Cancel
Save