|
@@ -87,13 +87,15 @@
|
|
|
<el-input type="textarea" v-model="addForm.remark"></el-input>
|
|
|
</el-form-item>
|
|
|
<!-- 总成本 -->
|
|
|
- <div style="float: left; line-height: 55px;margin-left:20px">总成本 <el-link disabled v-model="addForm.totalAmount">{{addForm.totalAmount}}</el-link> 元</div>
|
|
|
+ <!-- <div style="float: left; line-height: 55px;margin-left:20px">总成本 <el-link disabled v-model="addForm.totalAmount">{{addForm.totalAmount}}</el-link> 元</div> -->
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<!-- 按钮 -->
|
|
|
<div class="pu_button">
|
|
|
<!-- <el-button type="primary" @click="addxz">新增</el-button> -->
|
|
|
<span class="pu_bu_x" @click="addxz"> <i class="el-icon-circle-plus-outline"></i> 新增填报</span>
|
|
|
+ <span v-if="this.addForm.totalAmount <= 0">总成本 {{this.addForm.totalAmount}} 元</span>
|
|
|
+ <span v-else>总成本 ¥{{this.addForm.totalAmount | numberToCurrency}} 元</span>
|
|
|
<!-- <span class="pu_bu_t" @click="submits"> <i class="el-icon-circle-check"></i> 提交</span> -->
|
|
|
</div>
|
|
|
|
|
@@ -127,7 +129,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="费用金额" width="135px">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model.number="scope.row.amount"></el-input>
|
|
|
+ <el-input v-model.number="scope.row.amount" @blur="shiqu(scope.row.amount)"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="invoiceNo" label="发票号" width="135px">
|
|
@@ -388,6 +390,21 @@ export default {
|
|
|
this.getList() // 获取单据列表
|
|
|
this.getProjectList()
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ numberToCurrency(value) {
|
|
|
+ if (!value) return '0.00'
|
|
|
+ value = value.toFixed(2)
|
|
|
+ const intPart = Math.trunc(value)
|
|
|
+ const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
|
|
|
+ let floatPart = '.00'
|
|
|
+ const valueArray = value.toString().split('.')
|
|
|
+ if (valueArray.length === 2) { // 有小数部分
|
|
|
+ floatPart = valueArray[1].toString() // 取得小数部分
|
|
|
+ return intPartFormat + '.' + floatPart
|
|
|
+ }
|
|
|
+ return intPartFormat + floatPart
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 单据查看
|
|
|
downloadByA(val) {
|
|
@@ -706,6 +723,13 @@ export default {
|
|
|
this.$refs.xiaomian.style.width = '85%'
|
|
|
}
|
|
|
},
|
|
|
+ // 费用金额失去焦点时触发
|
|
|
+ shiqu(val){
|
|
|
+ console.log(this.addForm);
|
|
|
+ if(val == null || val == undefined) val = 0
|
|
|
+ this.addForm.totalAmount = this.addForm.totalAmount += val
|
|
|
+ console.log(this.addForm.totalAmount);
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|