|
@@ -147,12 +147,7 @@ export default {
|
|
|
if (this.$checkRes(res)) {
|
|
|
let nd = res.data.map(i => (i = _.omit(i, ['meta', 'id', '_id', 'logourl', 'number'])));
|
|
|
nd = this.setSchoolNumber(nd);
|
|
|
- let school = nd.map(i => {
|
|
|
- if (i.number) i.remaining = JSON.parse(JSON.stringify(i.number));
|
|
|
- else i.remaining = 0;
|
|
|
- return i;
|
|
|
- });
|
|
|
- this.$set(this, `list`, school);
|
|
|
+ this.$set(this, `list`, nd);
|
|
|
await this.getSchoolPlan();
|
|
|
}
|
|
|
},
|
|
@@ -387,19 +382,20 @@ export default {
|
|
|
//改变上报时间格式
|
|
|
i = this.changeRange(i);
|
|
|
if (arrange)
|
|
|
- arrange.map(p => {
|
|
|
+ for (const p of arrange) {
|
|
|
let { termid, term, batchid, batch, number, carnum, _id, remark } = p;
|
|
|
+ if (!parseInt(number)) continue;
|
|
|
let obj = {};
|
|
|
obj[this.proAffix(batchid, 'term_batch')] = termid;
|
|
|
obj[this.proAffix(batchid, 'batch')] = batch;
|
|
|
- obj[this.proAffix(batchid, 'batch_total')] = parseInt(number);
|
|
|
- obj[this.proAffix(batchid, 'car_total')] = parseInt(carnum);
|
|
|
+ obj[this.proAffix(batchid, 'batch_total')] = parseInt(number) || 0;
|
|
|
+ obj[this.proAffix(batchid, 'car_total')] = parseInt(carnum) || 0;
|
|
|
obj[this.proAffix(termid, 'term')] = term;
|
|
|
obj[this.proAffix(batchid, 'arrange_id')] = _id;
|
|
|
obj[this.proAffix(batchid, 'remark')] = remark;
|
|
|
i = { ...i, ...obj };
|
|
|
i = _.pickBy(i, _.identity);
|
|
|
- });
|
|
|
+ }
|
|
|
i.plan = plan;
|
|
|
}
|
|
|
return i;
|
|
@@ -598,13 +594,23 @@ export default {
|
|
|
let r = planSchool.find(f => f.code == i.code);
|
|
|
if (r) {
|
|
|
let obj = {};
|
|
|
- r.classnum.map(i => {
|
|
|
- obj[this.proAffix(i.code, 'number')] = i.number * 1;
|
|
|
- obj[this.proAffix(i.code, 'remaining')] = i.number * 1;
|
|
|
- });
|
|
|
- obj.number = r.classnum.reduce((p, n) => p + (n.number || 0) * 1, 0);
|
|
|
+ for (const ct of this.classTypeList) {
|
|
|
+ let number = r.classnum.reduce((p, n) => {
|
|
|
+ let num = 0;
|
|
|
+ if (n.code == ct.code) num = n.number * 1;
|
|
|
+ return p + num;
|
|
|
+ }, 0);
|
|
|
+ obj[this.proAffix(ct.code, 'number')] = number;
|
|
|
+ obj[this.proAffix(ct.code, 'remaining')] = number;
|
|
|
+ }
|
|
|
i = { ...i, ...obj };
|
|
|
}
|
|
|
+ let keysNum = Object.keys(i).filter(f => f.includes('number-'));
|
|
|
+ let number = keysNum.reduce((p, n) => p + i[n], 0);
|
|
|
+ i.number = number;
|
|
|
+ let keysRem = Object.keys(i).filter(f => f.includes('remaining-'));
|
|
|
+ let remaining = keysRem.reduce((p, n) => p + i[n], 0);
|
|
|
+ i.remaining = remaining;
|
|
|
return i;
|
|
|
});
|
|
|
nl = nl.sort((a, b) => a.code * 1 - b.code * 1);
|