|
@@ -22,8 +22,8 @@
|
|
|
<template v-slot="{ row, $index }">
|
|
|
<el-input-number
|
|
|
v-model="row.jynum"
|
|
|
- @change="toComputed(row, $index, (type = 'jynum'))"
|
|
|
- :max="maxnum"
|
|
|
+ @change="numtotal(row, $index)"
|
|
|
+ :max="toComputed(row, $index, (type = 'jynum'))"
|
|
|
:min="0"
|
|
|
size="mini"
|
|
|
:controls="false"
|
|
@@ -34,8 +34,8 @@
|
|
|
<template v-slot="{ row, $index }">
|
|
|
<el-input-number
|
|
|
v-model="row.cynum"
|
|
|
- @change="toComputed(row, $index, (type = 'cynum'))"
|
|
|
- :max="maxnum"
|
|
|
+ @change="numtotal(row, $index)"
|
|
|
+ :max="toComputed(row, $index, (type = 'cynum'))"
|
|
|
:min="0"
|
|
|
size="mini"
|
|
|
:controls="false"
|
|
@@ -46,8 +46,8 @@
|
|
|
<template v-slot="{ row, $index }">
|
|
|
<el-input-number
|
|
|
v-model="row.mznum"
|
|
|
- @change="toComputed(row, $index, (type = 'mznum'))"
|
|
|
- :max="maxnum"
|
|
|
+ @change="numtotal(row, $index)"
|
|
|
+ :max="toComputed(row, $index, (type = 'mznum'))"
|
|
|
:min="0"
|
|
|
size="mini"
|
|
|
:controls="false"
|
|
@@ -80,7 +80,6 @@ export default {
|
|
|
form: {},
|
|
|
plan: {},
|
|
|
template: {},
|
|
|
- maxnum: 0,
|
|
|
nextmaxnum: 0,
|
|
|
opera: [
|
|
|
{
|
|
@@ -107,7 +106,6 @@ export default {
|
|
|
if (this.$checkRes(res)) {
|
|
|
if (res.data !== null) {
|
|
|
this.$set(this, `template`, res.data);
|
|
|
- this.$set(this, `maxnum`, Number(res.data.total));
|
|
|
this.$set(this, `nextmaxnum`, Number(res.data.total));
|
|
|
}
|
|
|
}
|
|
@@ -174,18 +172,26 @@ export default {
|
|
|
});
|
|
|
return res;
|
|
|
},
|
|
|
+ numtotal(row, index) {
|
|
|
+ let { jynum = 0, cynum = 0, mznum = 0 } = row;
|
|
|
+ this.list[index].num = jynum + cynum + mznum;
|
|
|
+ },
|
|
|
toComputed(row, index, type) {
|
|
|
let { jynum = 0, cynum = 0, mznum = 0 } = row;
|
|
|
+ const list = this.list;
|
|
|
+ let nowrow = 0;
|
|
|
+ if (row[type]) nowrow = row[type];
|
|
|
const total = this.computeTotal(index, type);
|
|
|
- this.$set(this, `maxnum`, this.nextmaxnum - total);
|
|
|
+ if (index == 0) {
|
|
|
+ console.log('nextmaxnum-----' + this.nextmaxnum);
|
|
|
+ console.log('total-----' + total);
|
|
|
+ console.log('nowrow-----' + nowrow);
|
|
|
+ console.log(this.nextmaxnum - total - nowrow);
|
|
|
+ }
|
|
|
+ return this.nextmaxnum - total + nowrow;
|
|
|
},
|
|
|
- computeTotal(index, type) {
|
|
|
+ computeTotal() {
|
|
|
let total = 0;
|
|
|
- const list = this.list;
|
|
|
- let nowrow;
|
|
|
- if (type === 'jynum') nowrow = list[index].jynum;
|
|
|
- if (type === 'cynum') nowrow = list[index].cynum;
|
|
|
- if (type === 'mznum') nowrow = list[index].mznum;
|
|
|
for (const _list of this.list) {
|
|
|
if (_list.jynum) {
|
|
|
total = total + _list.jynum;
|
|
@@ -197,7 +203,7 @@ export default {
|
|
|
total = total + _list.mznum;
|
|
|
}
|
|
|
}
|
|
|
- return total - nowrow;
|
|
|
+ return total;
|
|
|
},
|
|
|
},
|
|
|
watch: {
|