|
@@ -278,7 +278,7 @@ export default {
|
|
totalScore() {
|
|
totalScore() {
|
|
var sum = 0.0;
|
|
var sum = 0.0;
|
|
for (let paperDetailStruct of this.paperDetailStructs) {
|
|
for (let paperDetailStruct of this.paperDetailStructs) {
|
|
- sum += paperDetailStruct.totalScore;
|
|
|
|
|
|
+ sum = this.accAdd(sum, paperDetailStruct.totalScore);
|
|
}
|
|
}
|
|
return sum;
|
|
return sum;
|
|
},
|
|
},
|
|
@@ -298,6 +298,21 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
+ accAdd(num1, num2) {
|
|
|
|
+ let sq1, sq2, m;
|
|
|
|
+ try {
|
|
|
|
+ sq1 = num1.toString().split(".")[1].length;
|
|
|
|
+ } catch (e) {
|
|
|
|
+ sq1 = 0;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ sq2 = num2.toString().split(".")[1].length;
|
|
|
|
+ } catch (e) {
|
|
|
|
+ sq2 = 0;
|
|
|
|
+ }
|
|
|
|
+ m = Math.pow(10, Math.max(sq1, sq2));
|
|
|
|
+ return (num1 * m + num2 * m) / m;
|
|
|
|
+ },
|
|
//查询列表集合
|
|
//查询列表集合
|
|
searchForm() {
|
|
searchForm() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
@@ -414,20 +429,17 @@ export default {
|
|
submitForm(formData) {
|
|
submitForm(formData) {
|
|
this.$refs[formData].validate((valid) => {
|
|
this.$refs[formData].validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- var ids = [];
|
|
|
|
- for (let paperDetailStruct of this.paperDetailStructs) {
|
|
|
|
- ids.push(paperDetailStruct.id);
|
|
|
|
- }
|
|
|
|
- ids.sort();
|
|
|
|
- var maxId;
|
|
|
|
- if (ids.length == 0) {
|
|
|
|
- maxId = 1;
|
|
|
|
|
|
+ var nextId;
|
|
|
|
+ if (!this.paperDetailStructs || this.paperDetailStructs.length == 0) {
|
|
|
|
+ nextId = 1;
|
|
} else {
|
|
} else {
|
|
- maxId = ids[ids.length - 1];
|
|
|
|
|
|
+ nextId =
|
|
|
|
+ this.paperDetailStructs[this.paperDetailStructs.length - 1].id +
|
|
|
|
+ 1;
|
|
}
|
|
}
|
|
var paperDetailStruct = Object.assign({}, this.paperDetailStructForm);
|
|
var paperDetailStruct = Object.assign({}, this.paperDetailStructForm);
|
|
- paperDetailStruct.id = maxId + 1;
|
|
|
|
- paperDetailStruct.number = this.paperDetailStructs.length + 1;
|
|
|
|
|
|
+ paperDetailStruct.id = nextId;
|
|
|
|
+ paperDetailStruct.number = paperDetailStruct.id;
|
|
this.paperDetailStructs.push(paperDetailStruct);
|
|
this.paperDetailStructs.push(paperDetailStruct);
|
|
this.paperDetailStructDialog = false;
|
|
this.paperDetailStructDialog = false;
|
|
this.paperDetailStructForm = { name: "", remark: "" };
|
|
this.paperDetailStructForm = { name: "", remark: "" };
|