dev
阿丽 3 years ago
parent caa3bee190
commit a7f3293e40

@ -8,13 +8,13 @@
*/
import { mapGetters, mapActions } from "vuex";
export default {
nstall(Vue) {
install(Vue) {
Vue.mixin({
computed: {
...mapGetters(['getScoreData'])
},
methods: {
...mapActions(['setScoreData',]),
...mapActions(['setScoreData'])
},
filters: {

@ -9,19 +9,19 @@
<el-descriptions-item label="3.油漆面得分">{{initData.surface}}</el-descriptions-item>
<el-descriptions-item label="4.钣金得分">{{initData.Sheet}}</el-descriptions-item>
<el-descriptions-item label="5.更换件得分">{{initData.rePart}}</el-descriptions-item>
<el-descriptions-item label="6.发动机变速箱状态得分">{{initData.engine}}</el-descriptions-item>
<el-descriptions-item label="7.重大事故得分">{{accident}}</el-descriptions-item>
<el-descriptions-item label="6.发动机变速箱状态得分">{{initData.transmission}}</el-descriptions-item>
<el-descriptions-item label="7.重大事故得分"> <span style="color: red">{{initData.accident|filterAccident}}</span></el-descriptions-item>
<el-descriptions-item label="8.全程4S店保养得分">{{initData.maintain}}</el-descriptions-item>
</el-descriptions>
</div>
<div class="app-right">
<el-descriptions size="40" :column=1 :contentStyle="{'color': 'rgb(22, 93, 253)'}">
<el-descriptions-item label="最终得分">{{initData.total}}</el-descriptions-item>
<el-descriptions-item label="车辆状况">{{state}}{{numerical}}</el-descriptions-item>
<el-descriptions-item label="最终得分">{{initData.total.toFixed(1)}}</el-descriptions-item>
<el-descriptions-item label="车辆状况"><span>{{filterCarStatus(initData.total)}}</span></el-descriptions-item>
</el-descriptions>
</div>
</div>
<el-button class="orangeBtn" type="primary" @click="onSubmit"></el-button>
<el-button class="orangeBtn" type="primary">完成</el-button>
</div>
</template>
@ -35,40 +35,67 @@ export default {
surface: "",
Sheet: "",
rePart: "",
engine: "",
transmission: "",
maintain: "",
total: "",
accident: "",
},
accident: "",
state: "",
numerical: "",
warn: false,
};
},
methods: {
onSubmit() {
let state = state;
// if (initData.total >= 80 && initData.total <= 100) {
// state = "";
// } else if (initData.total >= 50 && initData.total <= 70) {
// state = "";
// } else if (initData.total >= 20 && initData.total <= 20) {
// state = "";
// }
// let numerical = numerical;
// if ((state = 100 && state >= 70 && state >= 40)) {
// numerical = "";
// } else if (state > 90 && state >= 50 && state >= 30) {
// numerical = "";
// } else if (state > 80 && state >= 50 && state >= 20) {
// numerical = "";
// }
console.log("submit!");
filterCarStatus(score) {
let numerical = null;
if (score >= 100) {
numerical = "优秀最高值";
} else if (score >= 90) {
numerical = "优秀中间值";
} else if (score >= 80) {
numerical = "优秀最低值";
} else if (score >= 70) {
numerical = "良好最高值";
} else if (score >= 60) {
numerical = "良好中间值";
} else if (score >= 50) {
numerical = "良好最低值";
} else if (score >= 40) {
numerical = "一般最高值";
} else if (score >= 30) {
numerical = "一般中间值";
} else {
numerical = "一般最低值";
}
return numerical;
},
//
accidentChange(val) {
if (val.includes(1)) {
this.initData.total = 20;
} else {
this.warn = true;
}
},
},
created() {
// this.initData = this.getScoreData;
console.log(this.initData);
this.initData = this.getScoreData;
},
filters: {
filterAccident(val = []) {
let str = "";
if (val.includes(2)) {
str = "安全气囊弹出7折";
} else if (val.length === 0) {
str = "无";
} else {
str = "发生重大事故";
}
return str;
},
},
};
</script>

@ -4,7 +4,7 @@
<div class="app-xt">
<el-form ref="elForm" label-position="left" :model="form">
<el-form-item label="1.车辆型号:">
<el-input type="text" v-model="form.name" style="width: 150px;"></el-input>
<el-input v-model="form.name" style="width: 150px;"></el-input>
</el-form-item>
<el-form-item label="2.车辆年份:">
<el-date-picker v-model="form.month" type="month" placeholder="车辆年份" align="right" style="width: 150px;">
@ -16,7 +16,8 @@
</el-select>
</el-form-item>
<el-form-item label="4.公里数:">
<el-input type="text" v-model.number="form.Kilometers" style="width: 150px;"><i slot="suffix">万公里</i></el-input>
<el-input-number :controls="false" v-model="form.Kilometers" style="width: 150px;"></el-input-number>
<i>万公里</i>
</el-form-item>
<el-form-item label="5.油漆面:">
<el-select v-model="form.surface" placeholder="请选择" style="width: 150px;">
@ -78,7 +79,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="9.是否发生重大事故:">
<el-checkbox-group v-model="form.accident" @change="accidentChange">
<el-checkbox-group v-model="form.accident">
<el-row>
<el-checkbox :label="1">
如有以下情况则视为重大事故发生纵梁修复安全气囊弹出车子四梁六柱发生修复后翼子板切割直接扣80分
@ -93,8 +94,8 @@
</el-form-item>
<el-form-item label="10.是否全程4S店保养:">
<el-radio-group v-model="form.maintain">
<el-radio label="是"></el-radio>
<el-radio label="否"></el-radio>
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
@ -115,7 +116,7 @@ export default {
month: "",
name: "",
frequency: "",
Kilometers: "",
Kilometers: undefined,
surface: "",
Sheet: "",
tick: [],
@ -280,36 +281,40 @@ export default {
],
totalMonth: 0,
coefficient: "",
total: 0
};
},
methods: {
accidentChange(val) {
console.log(val);
},
onSubmit() {
//
let frequency = 10 - this.form.frequency;
//
let surface = 10 - this.form.surface;
let surface = (11 - this.form.surface) <=0 ? 0 : (11 - this.form.surface);
//
let Sheet = 10 - this.form.Sheet;
let Sheet = (11 - this.form.Sheet*2) <= 0 ? 0 : (11 - this.form.Sheet*2);
//
let Kilometers = 0;
if (this.form.Kilometers && this.form.month) {
const m1 = moment(moment().format("YYYY-MM-DD HH:mm:ss"));
const m2 = moment(this.form.month);
let { _data } = moment.duration(m1.diff(m2));
this.totalMonth = _data.months;
let k = (this.form.Kilometers * 10000) / _data.months;
if (k === Infinity) {
Kilometers = 15;
console.log(_data)
this.totalMonth = _data.years*12 + _data.months + 1;
console.log(this.totalMonth)
let k = (this.form.Kilometers * 10000) / this.totalMonth;
let x = (k - 1250) / 125;
let y = 0;
if(x > 0) {
y = Math.round(x);
} else {
Kilometers = 15 - (k - 1250) / 125;
y = Math.floor(x*-1)*-1;
}
Kilometers = 15 - y;
Kilometers = Kilometers <= 0 ? 0 : Kilometers;
} else {
Kilometers = 0;
}
console.log(Kilometers)
//
let rePart = 13;
if (this.form.tick.length === 0) {
@ -340,34 +345,28 @@ export default {
rePart = rePart <= 0 ? 0 : rePart;
}
//
let engine = 40;
let transmission = 40;
if (this.form.transmission === 1) {
engine -= 5;
transmission -= 5;
} else if (this.form.transmission === 2) {
engine -= 20;
transmission -= 20;
} else if (this.form.transmission === 3) {
transmission -= 40;
} else {
engine -= 40;
transmission = 40;
}
engine = engine <= 0 ? 0 : engine;
transmission = transmission <= 0 ? 0 : transmission;
//
let maintain = 0;
if (this.form.maintain === 1) {
maintain = 5;
}
//
if (this.form.accident.findIndex(1) != -1) {
total = 20;
}
if (this.form.accident.findIndex(2) != -1) {
this.warn = true;
}
//
let year = this.totalMonth / 12;
if (this.totalMonth / 12 != 0) {
year++;
}
let coefficient = coefficient;
let coefficient = 0;
if (year <= 3) {
coefficient = 1;
} else if (year <= 8) {
@ -378,29 +377,29 @@ export default {
coefficient = 0.7;
}
//
let total =
this.total =
(frequency +
surface +
Sheet +
Kilometers +
rePart +
engine +
transmission +
maintain) *
coefficient;
console.log("total score = " + total);
let obj = {
frequency: frequency,
surface: surface,
Sheet: Sheet,
Kilometers: Kilometers,
rePart: rePart,
engine: engine,
transmission: transmission,
maintain: maintain,
total: total,
total: this.total,
accident: this.form.accident,
};
this.setScoreData(obj);
this.elForm = this.$router.push("/Scoresituation");
this.$router.push("/Scoresituation");
},
},
};

@ -0,0 +1,3 @@
module.exports = {
lintOnSave: false, // 关闭 eslint 检查
}
Loading…
Cancel
Save