dev
阿丽 3 years ago
parent caa3bee190
commit a7f3293e40

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

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

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