Commit 26bd8439 by 张杰

修复bug

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