|
@@ -71,7 +71,9 @@
|
|
|
:maxHeight="300"
|
|
|
:rowNumber="true"
|
|
|
:rowSelection="true"
|
|
|
- :actionButton="true">
|
|
|
+ :actionButton="true"
|
|
|
+ @selectRowChange="moneyChange"
|
|
|
+ @valueChange="moneyChange">
|
|
|
<template v-slot:department="props">
|
|
|
<j-select-depart @change="departChange(props)" v-model="props.text" :trigger-change="true"></j-select-depart>
|
|
|
</template>
|
|
@@ -104,6 +106,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ selectedRowIds:[],
|
|
|
yearShowOne: false,
|
|
|
labelCol: {
|
|
|
span: 6
|
|
@@ -275,6 +278,13 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ mounted () {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ // this.selectedRowIds = this.$refs.refKeys[0].selectedRowIds;
|
|
|
+ // console.log("selectedRowIds",this.selectedRowIds)
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
methods: {
|
|
|
getAllTable() {
|
|
|
let values = this.tableKeys.map(key => getRefPromise(this, key))
|
|
@@ -327,6 +337,7 @@
|
|
|
},
|
|
|
//部门插槽更改数据
|
|
|
departChange(props) {
|
|
|
+ console.log(props)
|
|
|
let values = [
|
|
|
{
|
|
|
rowKey: props.rowId,
|
|
@@ -336,7 +347,33 @@
|
|
|
},
|
|
|
]
|
|
|
this.$refs.budgetReplyDetail.setValues(values)
|
|
|
- }
|
|
|
+ },
|
|
|
+ moneyChange() {
|
|
|
+ this.$refs.budgetReplyDetail.getValues((error, values) =>{
|
|
|
+ console.log(values)
|
|
|
+ var detailMoneys = 0;//定义预算总金额
|
|
|
+ var d = 0;//定义小数位的初始长度,默认为整数,即小数位为0
|
|
|
+ // 错误数 = 0 则代表验证通过
|
|
|
+ if (error === 0) {
|
|
|
+ // 将通过后的数组提交到后台或自行进行其他处理
|
|
|
+ for(var i = 0;i<values.length;i++){
|
|
|
+ var str = values[i].detailMoney;
|
|
|
+ if(str.indexOf(".")!=-1){//判断数字是否为小数
|
|
|
+ //获取小数位的长度
|
|
|
+ var temp = str.split(".")[1].length;
|
|
|
+ //比较此数的小数位与原小数位的长度,取小数位较长的存储到d中
|
|
|
+ d = d < temp ? temp : d;
|
|
|
+ }
|
|
|
+ detailMoneys+= Number(values[i].detailMoney);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('验证未通过')
|
|
|
+ }
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ budgetTotal: detailMoneys.toFixed(d)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|