代码补正

This commit is contained in:
xiaofajia 2024-11-16 12:56:05 +08:00
parent 9a74a8414f
commit 8dc907e992

View File

@ -33,7 +33,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="车辆型号" prop="carModel">
<el-input v-model="formData.carModel" placeholder="车辆型号" />
<el-input v-model="formData.carModel" placeholder="车辆型号"/>
</el-form-item>
</el-col>
<el-col :span="8">
@ -113,7 +113,9 @@
</el-form-item>
</el-col>
<el-col :span="16">
<el-button :loading="buttonLoading" icon="el-icon-date" @click="compute" size="small" type="primary">计算</el-button>
<el-button :loading="buttonLoading" icon="el-icon-date" @click="compute" size="small" type="primary">
计算
</el-button>
</el-col>
</el-row>
</el-collapse-item>
@ -205,7 +207,7 @@ export default {
nextMaintenanceMileage: undefined,
carModel: undefined
},
buttonLoading:false,
buttonLoading: false,
//
formRules: {
engineNumber: [{required: true, message: '发动机号码不能为空', trigger: 'blur'}],
@ -221,9 +223,13 @@ export default {
},
methods: {
/**计算车辆信息*/
async compute(){
async compute() {
this.buttonLoading = true
try{
try {
const brand = this.formData.brandAndModel
if (typeof brand === 'string'){
this.formData.brandAndModel = [brand, this.formData?.carModel]
}
const data = this.formData;
debugger
const res = await CarMainApi.compute(data);
@ -259,7 +265,10 @@ export default {
async submitForm() {
//
// await this.$refs["formRef"].validate();
this.formData.brandAndModel = [this.formData?.brandAndModel, this.formData?.carModel]
const brand = this.formData.brandAndModel
if (typeof brand === 'string'){
this.formData.brandAndModel = [brand, this.formData?.carModel]
}
this.formLoading = true;
try {
const data = this.formData;