Commit 26bd8439 by 张杰

修复bug

1 parent 08fed01a
......@@ -115,7 +115,8 @@ export default {
// 传递参数给父组件
toParent() {
let plate = `${this.plateProvince}${this.plateLetter}${this.plateNo}`;
let plate = `${this.plateProvince||''}${this.plateLetter||''}${this.plateNo||''}`;
console.log(plate)
this.$emit("change", plate);
},
},
......
......@@ -68,13 +68,13 @@
<el-table-column label="车主电话号码" prop="lesseePhone"></el-table-column>
<el-table-column label="车牌号码" prop="plateNo"></el-table-column>
<el-table-column label="品牌/车型" prop="">
<template slot-scope="{row}">{{row.brandName + row.subBrandName + row.seriesName + row.typeName}}</template>
<template slot-scope="{row}">{{row.brandName}}{{row.subBrandName}}{{row.seriesName}}{{row.typeName}}</template>
</el-table-column>
<el-table-column label="设备组合" prop="deviceComposeName"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="120px">
<template>
<el-link class="el_link" type="primary">编辑</el-link>
<el-link class="el_link" type="danger">删除</el-link>
<template slot-scope="{row}">
<el-link class="el_link" type="primary" @click="editCar(row)">编辑</el-link>
<el-link class="el_link" type="danger" @click="removeCar(row)">删除</el-link>
</template>
</el-table-column>
</el-table>
......@@ -89,9 +89,11 @@
<!-- 按钮区域 开始 -->
<!-- 弹框 开始 -->
<glsx-dialog :show="showDialog" title="新增车辆" @close="closeDialog()">
<glsx-dialog :show="showDialog" :title="current.id?'编辑车辆':'新增车辆'" @close="closeDialog()">
<template>
<add-car ref="addCarCom" @change="onChange"></add-car>
<keep-alive>
<add-car ref="addCarCom" :info="current" @change="onChange"></add-car>
</keep-alive>
</template>
<template slot="footer">
<el-button type="primary" size="small" @click="saveCar()">保存</el-button>
......@@ -108,7 +110,7 @@ import GlsxDialog from "@/components/dialog";
import { ADD_WORKORDER_INFO } from "@/services/order";
import provinceList from "@/common/province.json";
import { Validator } from "@/common/validator";
import { showToast, deepClone } from "@/utils/util";
import { showToast, deepClone, showModal } from "@/utils/util";
export default {
components: {
AddCar,
......@@ -179,6 +181,7 @@ export default {
children: "childs",
},
aloading: false,
current: {},
};
},
mounted() {
......@@ -194,15 +197,24 @@ export default {
// 关闭弹框
closeDialog() {
this.showDialog = false;
this.current = {};
this.$refs.addCarCom.rest();
},
// 监听新增车辆组件变化
onChange(e) {
if (e) {
this.tableData.push(e);
this.showDialog = false;
console.log(e);
if (!e) {
return false;
}
let list = this.tableData;
let idx = list.find((k) => k.id == e.id);
if (idx >= 0) {
list[idx] = e;
} else {
list.push(e);
}
this.showDialog = false;
},
// 新增车辆
......@@ -234,7 +246,7 @@ export default {
message: "新增成功",
type: "success",
});
_this.goBack()
_this.goBack();
return false;
}
});
......@@ -263,7 +275,15 @@ export default {
// 删除车辆
removeCar(e) {
this.tableData = this.tableData.filter((k) => k != e);
let _this = this;
showModal({
message: "确认删除该车辆吗?",
showCancelButton: true,
success: () => {
let list = _this.tableData;
_this.tableData = list.filter((k) => k != e);
},
});
},
// 处理新增订单数据
......@@ -288,6 +308,7 @@ export default {
m.map((k) => {
delete k.deviceComposeName;
delete k.test;
delete k.id;
return k;
});
......@@ -298,10 +319,15 @@ export default {
},
// 返回上一页
goBack(){
this.$router.go(-1)
}
goBack() {
this.$router.go(-1);
},
// 编辑车辆信息
editCar(row) {
this.openDialog();
this.current = row;
},
},
};
</script>
......
......@@ -8,7 +8,7 @@
<el-input v-model="addForm.vin" maxlength="17" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="设备组合" prop="deviceCompose">
<el-select v-model="addForm.deviceCompose" @change="changeDeviceCompose">
<el-select v-model="addForm.deviceCompose">
<el-option v-for="(item,index) in deviceList" :key="index" :label="item.name" :value="item.code"></el-option>
</el-select>
</el-form-item>
......@@ -34,11 +34,20 @@ import {
} from "@/services/order";
import { Validator } from "@/common/validator";
import PlateNumberInput from "@/components/plateNumberInput";
import { deepClone } from "@/utils/util";
export default {
name: "AddCar",
components: {
PlateNumberInput,
},
props: {
info: {
type: Object,
default: function () {
return {};
},
},
},
data() {
return {
addForm: {},
......@@ -71,6 +80,10 @@ export default {
},
};
},
activated() {
console.log('666666666666666666');
this.addForm = this.info;
},
mounted() {
this.getDevice();
this.getCarBrand();
......@@ -92,6 +105,9 @@ export default {
// 监听车型选择
onChange(e) {
if (!e || e.length <= 0) {
return false;
}
let list = this.carBrands;
// 找第一级
......@@ -123,17 +139,17 @@ export default {
if (!valid) {
return false;
}
_this.$emit("change", _this.addForm);
_this.addForm = {};
});
},
let o = deepClone(_this.addForm);
let list = this.deviceList;
let n = list.find((k) => k.code == o.deviceCompose);
if (!o.id) {
o.id = new Date().getTime();
}
// 切换设备型号
changeDeviceCompose(e) {
console.log(e);
let list = this.deviceList;
let n = list.find((k) => k.code == e);
this.$set(this.addForm, "deviceComposeName", n.name);
o.deviceComposeName = n.name;
_this.$emit("change", o);
_this.rest();
});
},
// 切换车牌号
......
......@@ -162,7 +162,7 @@ export default {
pageSizes: [10, 20, 30, 40],
pageSize: 10,
pageTotal: 0,
tableData: [{}, {}],
tableData: [],
showDialog: false,
uploadFile: {},
showResult: false,
......@@ -283,6 +283,7 @@ export default {
if (e) {
this.orgInfo = e.origin;
this.searchForm.orgId = e.origin.orgId;
this.searchForm.orgType = e.origin.type;
this.searchForm.orgName = e.origin.orgName;
}
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!