|
@@ -20,17 +20,38 @@
|
|
|
<el-table-column align="center" label="学校代码" prop="code"></el-table-column>
|
|
|
<el-table-column align="center" label="就业人数">
|
|
|
<template v-slot="{ row, $index }">
|
|
|
- <el-input-number v-model="row.jynum" @change="toComputed(row, $index)" :max="5" :min="0" size="mini" :controls="false"></el-input-number>
|
|
|
+ <el-input-number
|
|
|
+ v-model="row.jynum"
|
|
|
+ @change="toComputed(row, $index, (type = 'jynum'))"
|
|
|
+ :max="maxnum"
|
|
|
+ :min="0"
|
|
|
+ size="mini"
|
|
|
+ :controls="false"
|
|
|
+ ></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="创业人数">
|
|
|
<template v-slot="{ row, $index }">
|
|
|
- <el-input-number v-model="row.cynum" @change="toComputed(row, $index)" :max="5" :min="0" size="mini" :controls="false"></el-input-number>
|
|
|
+ <el-input-number
|
|
|
+ v-model="row.cynum"
|
|
|
+ @change="toComputed(row, $index, (type = 'cynum'))"
|
|
|
+ :max="maxnum"
|
|
|
+ :min="0"
|
|
|
+ size="mini"
|
|
|
+ :controls="false"
|
|
|
+ ></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="少数民族人数">
|
|
|
<template v-slot="{ row, $index }">
|
|
|
- <el-input-number v-model="row.mznum" @change="toComputed(row, $index)" :max="5" :min="0" size="mini" :controls="false"></el-input-number>
|
|
|
+ <el-input-number
|
|
|
+ v-model="row.mznum"
|
|
|
+ @change="toComputed(row, $index, (type = 'mznum'))"
|
|
|
+ :max="maxnum"
|
|
|
+ :min="0"
|
|
|
+ size="mini"
|
|
|
+ :controls="false"
|
|
|
+ ></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" :label="`总人数(共计:${template.total || 0})`" prop="num"> </el-table-column>
|
|
@@ -59,6 +80,8 @@ export default {
|
|
|
form: {},
|
|
|
plan: {},
|
|
|
template: {},
|
|
|
+ maxnum: 0,
|
|
|
+ nextmaxnum: 0,
|
|
|
opera: [
|
|
|
{
|
|
|
label: '修改',
|
|
@@ -84,6 +107,8 @@ 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));
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -138,7 +163,7 @@ export default {
|
|
|
this.form = {};
|
|
|
},
|
|
|
getList() {
|
|
|
- let duplicate = _.cloneDeep(this.list);
|
|
|
+ let duplicate = this.list;
|
|
|
let res = duplicate.filter(f => {
|
|
|
let name = _.get(this.form, 'name');
|
|
|
let code = _.get(this.form, 'code');
|
|
@@ -149,8 +174,30 @@ export default {
|
|
|
});
|
|
|
return res;
|
|
|
},
|
|
|
- toComputed(row, index) {
|
|
|
+ toComputed(row, index, type) {
|
|
|
let { jynum = 0, cynum = 0, mznum = 0 } = row;
|
|
|
+ const total = this.computeTotal(index, type);
|
|
|
+ this.$set(this, `maxnum`, this.nextmaxnum - total);
|
|
|
+ },
|
|
|
+ computeTotal(index, type) {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ if (_list.cynum) {
|
|
|
+ total = total + _list.cynum;
|
|
|
+ }
|
|
|
+ if (_list.mznum) {
|
|
|
+ total = total + _list.mznum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return total - nowrow;
|
|
|
},
|
|
|
},
|
|
|
watch: {
|