Commit 9821da44 by 张杰

修复bug

1 parent 58a15a4d
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<el-button v-for="(j, idx) in vehicleTableParams.tableOption.btnList" :key="idx" :type="j.type || 'text'" size="mini" plain @click="btnClick(j.pType, scope.scope)">{{j.name}}</el-button> <el-button v-for="(j, idx) in vehicleTableParams.tableOption.btnList" :key="idx" :type="j.type || 'text'" size="mini" plain @click="btnClick(j.pType, scope.scope)">{{j.name}}</el-button>
<el-button v-if="scope.scope.sns" type="text" size="mini" @click="btnClick('unbind', scope.scope)">解绑</el-button> <el-button v-if="scope.scope.sns" type="text" size="mini" @click="btnClick('unbind', scope.scope)">解绑</el-button>
<!-- <el-button v-if="scope.scope.adjFreq === 1" type="text" size="mini" @click="btnClick('freq', scope.scope)">一键调频</el-button> --> <!-- <el-button v-if="scope.scope.adjFreq === 1" type="text" size="mini" @click="btnClick('freq', scope.scope)">一键调频</el-button> -->
<el-dropdown v-if="scope.scope.adjFreq" @command="handleCommand" style="margin-left:5px"> <el-dropdown v-if="scope.scope.adjFreq" @command="handleCommand" style="margin-left:5px">
<el-button size="mini"> <el-button size="mini">
<i class="el-icon-arrow-down"></i> <i class="el-icon-arrow-down"></i>
</el-button> </el-button>
...@@ -32,22 +32,19 @@ ...@@ -32,22 +32,19 @@
<basic-dialog width="800px" :title="vehicleTitle" :isVisible="vehicleVisible" :hasOk="vehicleHasOk" @confirmDialog="handleConfirm('create')" @closeDialog="handleClose('create')"> <basic-dialog width="800px" :title="vehicleTitle" :isVisible="vehicleVisible" :hasOk="vehicleHasOk" @confirmDialog="handleConfirm('create')" @closeDialog="handleClose('create')">
<slot> <slot>
<div v-loading="formLoading"> <div v-loading="formLoading">
<el-form ref="snForm" :model="snForm" :rules="snRules" :inline="false" size="mini" label-width="140px" > <el-form ref="snForm" :model="snForm" :rules="snRules" :inline="false" size="mini" label-width="140px">
<el-row> <el-row>
<el-col :span="20"> <el-col :span="20">
<el-row v-for="(item, index) in snForm.deviceArr" :key="index"> <el-row v-for="(item, index) in snForm.deviceArr" :key="index">
<!-- <i v-show="!isViewMode" @click="removeDevice(index)" class="el-icon-remove-outline" style="position: absolute;font-size: 20px; margin-left:20px; line-height:30px;"></i> --> <!-- <i v-show="!isViewMode" @click="removeDevice(index)" class="el-icon-remove-outline" style="position: absolute;font-size: 20px; margin-left:20px; line-height:30px;"></i> -->
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item label="设备SN号" class="is-required" :prop="'device'+index">
label="设备SN号" <el-input v-model="item.sn" :disabled="item.disabled"></el-input>
class="is-required"
:prop="'device'+index" >
<el-input v-model="item.sn" :disabled="item.disabled"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备型号:"> <el-form-item label="设备型号:">
<el-input disabled v-model="item.deviceType"></el-input> <el-input disabled v-model="item.deviceType"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -61,8 +58,8 @@ ...@@ -61,8 +58,8 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form label-width="120px"> <el-form label-width="120px">
<el-form-item label="操作日志" v-show="isViewMode"> <el-form-item label="操作日志" v-show="isViewMode">
<table class="freq_table" v-loading="freqLoading" style="min-height: 40px"> <table class="freq_table" v-loading="freqLoading" style="min-height: 40px">
<tr v-show="freqTableData.length"> <tr v-show="freqTableData.length">
<th width="80">调频时间</th> <th width="80">调频时间</th>
<th width="80">调频模式</th> <th width="80">调频模式</th>
...@@ -136,7 +133,7 @@ import axios from "axios"; ...@@ -136,7 +133,7 @@ import axios from "axios";
import { dictInfo } from "services/common"; import { dictInfo } from "services/common";
import { VEHICLE_API } from "@/config/config"; import { VEHICLE_API } from "@/config/config";
import store from "@/store"; import store from "@/store";
import freqModal from './freqModal' import freqModal from "./freqModal";
import { import {
getVehicleList, getVehicleList,
getSpecialShopList, getSpecialShopList,
...@@ -157,14 +154,12 @@ import { ...@@ -157,14 +154,12 @@ import {
deleteNewVehicle, deleteNewVehicle,
getAdjFreqInfo, getAdjFreqInfo,
} from "services/vehicle"; } from "services/vehicle";
import { import { getOrgTree } from "services/common";
getOrgTree,
} from "services/common";
export default { export default {
data() { data() {
const _this = this const _this = this;
let checkShopName = (rule, vaule, cb) => { let checkShopName = (rule, vaule, cb) => {
console.log(this.vehicleForm) console.log(this.vehicleForm);
if (this.vehicleForm.organizationName == "") { if (this.vehicleForm.organizationName == "") {
cb(new Error("请选择所属组织")); cb(new Error("请选择所属组织"));
} else { } else {
...@@ -172,39 +167,35 @@ export default { ...@@ -172,39 +167,35 @@ export default {
} }
}; };
let checkDevice = (rule, value, cb) => { let checkDevice = (rule, value, cb) => {
if(rule.field) { if (rule.field) {
let i = rule.field.split('device')[1] let i = rule.field.split("device")[1];
let sn = this.snForm.deviceArr[i].sn let sn = this.snForm.deviceArr[i].sn;
if(this.snForm.deviceArr[i].disabled) return cb() if (this.snForm.deviceArr[i].disabled) return cb();
if (sn == "") { if (sn == "") {
cb(new Error("请输入设备号")); cb(new Error("请输入设备号"));
} }
if(sn) { if (sn) {
//this._timeoutId && clearTimeout(this._timeoutId) //this._timeoutId && clearTimeout(this._timeoutId)
//this._timeoutId = setTimeout(()=>{ //this._timeoutId = setTimeout(()=>{
verifydevice({sn}).then((res)=>{ verifydevice({ sn }).then((res) => {
if(res.code == 200) { if (res.code == 200) {
checkSn({sn}).then((res)=>{ checkSn({ sn }).then((res) => {
if(res.data) { if (res.data) {
this.snForm.deviceArr[i].deviceType = res.data this.snForm.deviceArr[i].deviceType = res.data;
} }
}) });
cb() cb();
}else{ } else {
cb(new Error(res.message)) cb(new Error(res.message));
} }
}) });
//}, 500) //}, 500)
} else { } else {
cb() cb();
} }
//cb(); //cb();
} }
}; };
return { return {
searchForm: {}, searchForm: {},
...@@ -214,24 +205,28 @@ export default { ...@@ -214,24 +205,28 @@ export default {
type: "input", type: "input",
inputType: "text", inputType: "text",
prop: "keywords", prop: "keywords",
width: '360', width: "360",
placeholder: "车主姓名|车架号|设备号|车型", placeholder: "车主姓名|车架号|设备号|车型",
}, },
{ {
label: "设备类型", label: "设备类型",
type: 'select', type: "select",
prop: 'deviceType', prop: "deviceType",
placeholder: '请选择', placeholder: "请选择",
options: [{ options: [
label: '全部', {
value: '' label: "全部",
}, { value: "",
label: '有线', },
value: '1' {
}, { label: "有线",
label: '无线', value: "1",
value: '0' },
}] {
label: "无线",
value: "0",
},
],
}, },
/* { /* {
label: "设备状态", label: "设备状态",
...@@ -257,61 +252,73 @@ export default { ...@@ -257,61 +252,73 @@ export default {
}] }]
}, */ }, */
{ {
label: '激活时间', label: "激活时间",
type: 'daterange', type: "daterange",
dateType: 'day', dateType: "day",
prop: 'date', prop: "date",
placeholder: '请选择年月', placeholder: "请选择年月",
selectStyle: 'width:360px', selectStyle: "width:360px",
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() < new Date(_this.date).getTime() return time.getTime() < new Date(_this.date).getTime();
} },
} },
}, },
{ {
label: "车辆标签", label: "车辆标签",
type: 'select', type: "select",
prop: 'vehicleType', prop: "vehicleType",
placeholder: '请选择', placeholder: "请选择",
options: [{ options: [
label: '全部', {
value: '' label: "全部",
}, { value: "",
label: '试驶车 ', },
value: '1' {
}, { label: "试驶车 ",
label: '服务车', value: "1",
value: '3' },
}, { {
label: '代步车', label: "服务车",
value: '4' value: "3",
}, { },
label: '救援车', {
value: '5' label: "代步车",
}, { value: "4",
label: '办公车', },
value: '6' {
}, { label: "救援车",
label: '其他', value: "5",
value: '7' },
}] {
label: "办公车",
value: "6",
},
{
label: "其他",
value: "7",
},
],
}, },
{ {
label: "车辆用途", label: "车辆用途",
type: 'select', type: "select",
prop: 'vehicleUsages', prop: "vehicleUsages",
placeholder: '请选择', placeholder: "请选择",
options: [{ options: [
label: '全部', {
value: '' label: "全部",
}, { value: "",
label: '专属用途', },
value: '1' {
}, { label: "专属用途",
label: '非专属用途', value: "1",
value: '2' },
}] {
label: "非专属用途",
value: "2",
},
],
}, },
], ],
vehicleTableParams: { vehicleTableParams: {
...@@ -321,7 +328,6 @@ export default { ...@@ -321,7 +328,6 @@ export default {
{ {
label: "车主姓名", label: "车主姓名",
prop: "ownerName", prop: "ownerName",
}, },
{ {
label: "车架号", label: "车架号",
...@@ -366,7 +372,6 @@ export default { ...@@ -366,7 +372,6 @@ export default {
prop: "specialState", prop: "specialState",
width: 110, width: 110,
}, },
], ],
tableOption: { tableOption: {
width: 170, width: 170,
...@@ -384,7 +389,7 @@ export default { ...@@ -384,7 +389,7 @@ export default {
pType: "view", pType: "view",
}, },
], ],
align: 'left', align: "left",
}, },
}, },
getListApi: getVehicleList, getListApi: getVehicleList,
...@@ -432,7 +437,7 @@ export default { ...@@ -432,7 +437,7 @@ export default {
"brandId", "brandId",
"seriesId", "seriesId",
"typeId", "typeId",
"remark" "remark",
], ],
vehicleData: [ vehicleData: [
{ {
...@@ -662,7 +667,12 @@ export default { ...@@ -662,7 +667,12 @@ export default {
], ],
vehicleRules: { vehicleRules: {
ownerName: [ ownerName: [
{min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur'}, {
min: 2,
max: 50,
message: "长度在 2 到 50 个字符",
trigger: "blur",
},
//{validator: this.$Common.checkName, trigger: "blur"} //{validator: this.$Common.checkName, trigger: "blur"}
], ],
organizationName: [ organizationName: [
...@@ -704,21 +714,19 @@ export default { ...@@ -704,21 +714,19 @@ export default {
vehicleList: [], vehicleList: [],
loading: false, loading: false,
snForm: { snForm: {
deviceArr: [{ deviceArr: [
sn: '', {
deviceType: '' sn: "",
}], deviceType: "",
},
],
}, },
snRules: { snRules: {
device0: [ device0: [{ validator: checkDevice }],
{validator: checkDevice}
],
}, },
freqVisible: false, freqVisible: false,
freqSn: '', freqSn: "",
frequencyForm: { frequencyForm: {},
},
enableFreq: false, enableFreq: false,
freqTableData: [], freqTableData: [],
formLoading: true, formLoading: true,
...@@ -733,22 +741,18 @@ export default { ...@@ -733,22 +741,18 @@ export default {
}, },
watch: { watch: {
filterText(val) { filterText(val) {
this._timeout && clearTimeout(this._timeout);
this._timeout && clearTimeout(this._timeout) this._timeout = setTimeout(() => {
this._timeout = setTimeout(()=>{ this.$refs.tree.filter(val);
this.$refs.tree.filter(val) }, 500);
},500) },
}
}, },
created() { created() {
this.vehicleListPromise = new Promise((resolve, reject)=>{ this.vehicleListPromise = new Promise((resolve, reject) => {
this.getModels(resolve); this.getModels(resolve);
}) });
}, },
mounted() { mounted() {
/* dictInfo("trialdrive_vehicle_model").then((res) => { /* dictInfo("trialdrive_vehicle_model").then((res) => {
this.vehicleData.find((item) => item.prop == "modelId").options = this.vehicleData.find((item) => item.prop == "modelId").options =
res.data; res.data;
...@@ -766,14 +770,14 @@ export default { ...@@ -766,14 +770,14 @@ export default {
methods: { methods: {
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(this.searchForm.date) console.log(this.searchForm.date);
if(this.searchForm.date) { if (this.searchForm.date) {
this.searchForm.activateTimeStart = this.searchForm.date[0] this.searchForm.activateTimeStart = this.searchForm.date[0];
this.searchForm.activateTimeEnd = this.searchForm.date[1] this.searchForm.activateTimeEnd = this.searchForm.date[1];
} }
resolve() resolve();
}) });
}, },
tableDataFinished() { tableDataFinished() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -787,25 +791,24 @@ export default { ...@@ -787,25 +791,24 @@ export default {
btnClick(pType, scope) { btnClick(pType, scope) {
switch (pType) { switch (pType) {
case "create": case "create":
this.formLoading = true this.formLoading = true;
this.vehicleVisible = !this.vehicleVisible; this.vehicleVisible = !this.vehicleVisible;
this.isReadonly = false; this.isReadonly = false;
this.isCreateMode = true this.isCreateMode = true;
this.freqLoading = false this.freqLoading = false;
this.isViewMode = false this.isViewMode = false;
this.vehicleListPromise.then(()=>{ this.vehicleListPromise.then(() => {
if (this.vehicleVisible) { if (this.vehicleVisible) {
let _list = _.cloneDeep(this.vehicleDefalutData); let _list = _.cloneDeep(this.vehicleDefalutData);
let _arr = []; let _arr = [];
_list.map((k) => { _list.map((k) => {
this.$set(k, "disabled", false); this.$set(k, "disabled", false);
if(k.prop == 'brandId') { if (k.prop == "brandId") {
this.$set(k, "loading", false); this.$set(k, "loading", false);
} }
if (k.prop != "seriesId" && k.prop != "typeId") { if (k.prop != "seriesId" && k.prop != "typeId") {
_arr.push(k); _arr.push(k);
} }
}); });
this.vehicleTitle = "新增车辆"; this.vehicleTitle = "新增车辆";
this.vehicleHasOk = true; this.vehicleHasOk = true;
...@@ -815,119 +818,115 @@ export default { ...@@ -815,119 +818,115 @@ export default {
if (this.$refs.vehicleRuleForm) if (this.$refs.vehicleRuleForm)
this.$refs.vehicleRuleForm.$children[0].clearValidate(); this.$refs.vehicleRuleForm.$children[0].clearValidate();
this.snForm.deviceArr = [{sn: '', deviceType: ''}] this.snForm.deviceArr = [{ sn: "", deviceType: "" }];
this.$refs.snForm && this.$refs.snForm.clearValidate(); this.$refs.snForm && this.$refs.snForm.clearValidate();
this.freqTableData = [] this.freqTableData = [];
this.formLoading = false this.formLoading = false;
}) });
break; break;
case "edit": case "edit":
this.vehicleVisible = !this.vehicleVisible; this.vehicleVisible = !this.vehicleVisible;
this.isReadonly = false; this.isReadonly = false;
this.formLoading = true this.formLoading = true;
this.isCreateMode = false this.isCreateMode = false;
this.freqLoading = false this.freqLoading = false;
this.isViewMode = false this.isViewMode = false;
this.vehicleListPromise.then(()=>{ this.vehicleListPromise.then(() => {
if (this.vehicleVisible) { if (this.vehicleVisible) {
//let _list = this.vehicleDefalutData; //let _list = this.vehicleDefalutData;
this.vehicleTitle = "编辑车辆"; this.vehicleTitle = "编辑车辆";
this.vehicleHasOk = true; this.vehicleHasOk = true;
getVehicleInfo({ id: scope.id }).then((res) => { getVehicleInfo({ id: scope.id }).then((res) => {
const { code, data } = res; const { code, data } = res;
if (code == 200) { if (code == 200) {
//动态创建车系、车型选择框 //动态创建车系、车型选择框
let _list = this.creatSelect(data); let _list = this.creatSelect(data);
_list.map((k) => {console.log(k.prop) _list.map((k) => {
console.log(k.prop);
if (k.prop === "vin" || k.prop == "organizationName") { if (k.prop === "vin" || k.prop == "organizationName") {
this.$set(k, "disabled", true); this.$set(k, "disabled", true);
}else{ } else {
if(k.prop == 'brandId') { if (k.prop == "brandId") {
this.$set(k, "loading", false); this.$set(k, "loading", false);
} }
this.$set(k, "disabled", false); this.$set(k, "disabled", false);
} }
}); });
this.vehicleData = _.cloneDeep(_list); this.vehicleData = _.cloneDeep(_list);
this.vehicleArr.forEach((item) => { this.vehicleArr.forEach((item) => {
if (item == "serveType"){ if (item == "serveType") {
this.$set(this.vehicleForm, item, data[item] + ""); this.$set(this.vehicleForm, item, data[item] + "");
}else { } else {
this.$set(this.vehicleForm, item, data[item]); this.$set(this.vehicleForm, item, data[item]);
if(item == 'brandId') { if (item == "brandId") {
this.changeCarBrand(data.brandId, true) this.changeCarBrand(data.brandId, true);
} }
} }
}); });
this.vehicleForm.id = scope.id; this.vehicleForm.id = scope.id;
this.snForm.deviceArr = data.deviceInfoDtos.map((item, i)=>{ this.snForm.deviceArr = data.deviceInfoDtos.map((item, i) => {
//this.snRules['device'+i] = this.snRules['device0'] //this.snRules['device'+i] = this.snRules['device0']
return { return {
sn: item.sn, sn: item.sn,
deviceType: item.deviceClassifyName, deviceType: item.deviceClassifyName,
disabled: true, disabled: true,
} };
}) });
this.formLoading = false this.formLoading = false;
} }
}); });
this.freqTableData = [] this.freqTableData = [];
} }
}) });
break; break;
case "view": case "view":
console.log("view"); console.log("view");
this.formLoading = true this.formLoading = true;
this.vehicleVisible = !this.vehicleVisible; this.vehicleVisible = !this.vehicleVisible;
this.isReadonly = true; this.isReadonly = true;
this.isCreateMode = false this.isCreateMode = false;
this.isViewMode = true this.isViewMode = true;
this.vehicleListPromise.then(()=>{ this.vehicleListPromise.then(() => {
if (this.vehicleVisible) { if (this.vehicleVisible) {
getVehicleInfo({ id: scope.id }).then((res) => { getVehicleInfo({ id: scope.id }).then((res) => {
const { code, data } = res; const { code, data } = res;
if (code == 200) { if (code == 200) {
//动态创建车系、车型选择框 //动态创建车系、车型选择框
let _list = this.creatSelect(data); let _list = this.creatSelect(data);
_list.map((k) => { _list.map((k) => {
this.$set(k, "disabled", true); this.$set(k, "disabled", true);
if(k.prop == 'brandId') { if (k.prop == "brandId") {
this.$set(k, "loading", false); this.$set(k, "loading", false);
} }
}); });
this.vehicleData = _.cloneDeep(_list); this.vehicleData = _.cloneDeep(_list);
this.vehicleArr.forEach((item) => { this.vehicleArr.forEach((item) => {
if (item == "serveType"){ if (item == "serveType") {
this.$set(this.vehicleForm, item, data[item] + ""); this.$set(this.vehicleForm, item, data[item] + "");
}else { } else {
this.$set(this.vehicleForm, item, data[item]); this.$set(this.vehicleForm, item, data[item]);
if(item == 'brandId') { if (item == "brandId") {
this.changeCarBrand(data.brandId, 'view') this.changeCarBrand(data.brandId, "view");
} }
} }
}); });
this.snForm.deviceArr = data.deviceInfoDtos.map((item, i)=>{ this.snForm.deviceArr = data.deviceInfoDtos.map((item, i) => {
//this.snRules['device'+i] = this.snRules['device0'] //this.snRules['device'+i] = this.snRules['device0']
return { return {
sn: item.sn, sn: item.sn,
deviceType: item.deviceClassifyName, deviceType: item.deviceClassifyName,
disabled: true disabled: true,
} };
}) });
this.formLoading = false this.formLoading = false;
} }
}); });
this.vehicleTitle = "查看车辆"; this.vehicleTitle = "查看车辆";
...@@ -936,16 +935,16 @@ export default { ...@@ -936,16 +935,16 @@ export default {
// if (item.type == 'input') this.$set(item, 'readonly', true) // if (item.type == 'input') this.$set(item, 'readonly', true)
// else this.$set(item, 'disabled', true) // else this.$set(item, 'disabled', true)
// }) // })
this.freqTableData = [] this.freqTableData = [];
this.freqLoading = true this.freqLoading = true;
getAdjFreqInfo({ getAdjFreqInfo({
sn: scope.sn sn: scope.sn,
}).then((res) => { }).then((res) => {
this.freqTableData = res.data this.freqTableData = res.data;
this.freqLoading = false this.freqLoading = false;
}) });
} }
}) });
break; break;
case "delete": case "delete":
this.$confirm("是否要删除?", "提示", { this.$confirm("是否要删除?", "提示", {
...@@ -953,10 +952,10 @@ export default { ...@@ -953,10 +952,10 @@ export default {
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
}).then(() => { }).then(() => {
deleteNewVehicle({ deleteNewVehicle({
vdId: scope.vdId, vdId: scope.vdId,
//sn: scope.sn //sn: scope.sn
}).then((res) => { }).then((res) => {
const { code, message } = res; const { code, message } = res;
if (code == 200) { if (code == 200) {
this.$message({ this.$message({
...@@ -1008,66 +1007,65 @@ export default { ...@@ -1008,66 +1007,65 @@ export default {
url: `${store.state.baseURL}/trialdrive/vehicle/vehicleinfo/export`, url: `${store.state.baseURL}/trialdrive/vehicle/vehicleinfo/export`,
method: "GET", method: "GET",
data: this.searchForm, data: this.searchForm,
fileName: '车辆列表'+moment().format('YYYY.MM.DD')+'.xls' fileName: "车辆列表" + moment().format("YYYY.MM.DD") + ".xls",
}); });
break; break;
case "freq": case "freq":
this.freqSn = scope.sn; this.freqSn = scope.sn;
this.freqVisible = true; this.freqVisible = true;
break; break;
} }
}, },
handleCommand(command){ handleCommand(command) {
if(command.indexOf('freq')>-1){ if (command.indexOf("freq") > -1) {
this.freqSn = command.split('freq')[1]; this.freqSn = command.split("freq")[1];
this.freqVisible = true; this.freqVisible = true;
} }
}, },
getCommand(type, val, enable){ getCommand(type, val, enable) {
if(type === 'freq') { if (type === "freq") {
this.enableFreq = enable === 'true' ? true : false this.enableFreq = enable === "true" ? true : false;
} }
return type+val return type + val;
}, },
// 弹框确定按钮方法 // 弹框确定按钮方法
handleConfirm(type) { handleConfirm(type) {
switch (type) { switch (type) {
case "create": case "create":
//console.log(this.vehicleForm, this.vehicleData); //console.log(this.vehicleForm, this.vehicleData);
Promise.all([this.formPromise(), this.snPromise()]).then((arr)=>{ Promise.all([this.formPromise(), this.snPromise()]).then((arr) => {
let params = arr[0]; let params = arr[0];
params.deviceInfoDtos = arr[1] params.deviceInfoDtos = arr[1];
console.log(arr) console.log(arr);
let api = addNewVehicle; let api = addNewVehicle;
if (params.id) api = updateNewVehicle; if (params.id) api = updateNewVehicle;
api(params).then((res) => { api(params).then((res) => {
const { code, message } = res; const { code, message } = res;
if (code == 200) { if (code == 200) {
this.$message({ this.$message({
message: "操作成功", message: "操作成功",
type: "success", type: "success",
}); });
this.vehicleVisible = !this.vehicleVisible; this.vehicleVisible = !this.vehicleVisible;
this.$refs.vehicleForm.refreshTable(); this.$refs.vehicleForm.refreshTable();
} else { } else {
this.$message({ this.$message({
message: message, message: message,
type: "error", type: "error",
}); });
} }
}); });
}) });
return return;
this.$refs.vehicleRuleForm.$children[0].validate((valid) => { this.$refs.vehicleRuleForm.$children[0].validate((valid) => {
//console.log(valid, this.$refs.vehicleRuleForm); //console.log(valid, this.$refs.vehicleRuleForm);
if (valid) { if (valid) {
let params = _.cloneDeep(this.vehicleForm); let params = _.cloneDeep(this.vehicleForm);
//const { typeId, configId } = params; //const { typeId, configId } = params;
// let _list = this.vehicleData.find( // let _list = this.vehicleData.find(
// (item) => item.prop == "typeId" // (item) => item.prop == "typeId"
...@@ -1081,15 +1079,15 @@ export default { ...@@ -1081,15 +1079,15 @@ export default {
// .find((item) => item.prop == "configId") // .find((item) => item.prop == "configId")
// .options.find((j) => j.id == configId).dictLabel; // .options.find((j) => j.id == configId).dictLabel;
params.organizationId = params.organizationId params.organizationId = params.organizationId;
params.modelId = params.typeId params.modelId = params.typeId;
delete params.brandId; delete params.brandId;
delete params.seriesId; delete params.seriesId;
delete params.organizationId; delete params.organizationId;
delete params.organizationName; delete params.organizationName;
delete params.typeId; delete params.typeId;
console.log(params) console.log(params);
return; return;
let api = addVehicle; let api = addVehicle;
if (params.id) api = editVehicle; if (params.id) api = editVehicle;
...@@ -1114,10 +1112,10 @@ export default { ...@@ -1114,10 +1112,10 @@ export default {
break; break;
case "import": case "import":
console.log(this.importForm.file); console.log(this.importForm.file);
if(this.importing) return if (this.importing) return;
var data = new FormData(); var data = new FormData();
data.append("file", this.importForm.file); data.append("file", this.importForm.file);
this.importing = true this.importing = true;
axios({ axios({
headers: { headers: {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
...@@ -1128,7 +1126,7 @@ export default { ...@@ -1128,7 +1126,7 @@ export default {
data, data,
}).then((res) => { }).then((res) => {
console.log(res); console.log(res);
this.importing = false this.importing = false;
if (res.data.code == 200) { if (res.data.code == 200) {
this.exportData = res.data.data; this.exportData = res.data.data;
} else { } else {
...@@ -1142,55 +1140,55 @@ export default { ...@@ -1142,55 +1140,55 @@ export default {
} }
}, },
formPromise() { formPromise() {
return new Promise((resovle, reject)=>{ return new Promise((resovle, reject) => {
this.$refs.vehicleRuleForm.$children[0].validate((valid) => { this.$refs.vehicleRuleForm.$children[0].validate((valid) => {
//console.log(valid, this.$refs.vehicleRuleForm); //console.log(valid, this.$refs.vehicleRuleForm);
if (valid) { if (valid) {
let params = _.cloneDeep(this.vehicleForm); let params = _.cloneDeep(this.vehicleForm);
//const { typeId, configId } = params; //const { typeId, configId } = params;
// let _list = this.vehicleData.find( // let _list = this.vehicleData.find(
// (item) => item.prop == "typeId" // (item) => item.prop == "typeId"
// ).options; // ).options;
// let o = _list.find((j) => j.id == typeId); // let o = _list.find((j) => j.id == typeId);
// if (o) { // if (o) {
// params.modelName = o.name; // params.modelName = o.name;
// } // }
// else params.modelName = modelId // else params.modelName = modelId
// params.configDesc = this.vehicleData // params.configDesc = this.vehicleData
// .find((item) => item.prop == "configId") // .find((item) => item.prop == "configId")
// .options.find((j) => j.id == configId).dictLabel; // .options.find((j) => j.id == configId).dictLabel;
params.modelId = params.typeId params.modelId = params.typeId;
/* delete params.brandId; /* delete params.brandId;
delete params.seriesId; delete params.seriesId;
delete params.organizationId; delete params.organizationId;
delete params.organizationName; delete params.organizationName;
delete params.typeId; */ delete params.typeId; */
resovle(params) resovle(params);
} }
});
}) });
})
}, },
snPromise() { snPromise() {
return new Promise((resovle, reject)=>{ return new Promise((resovle, reject) => {
this.$refs.snForm.validate((valid) => { this.$refs.snForm.validate((valid) => {
if (valid) { if (valid) {
resovle(
resovle(this.snForm.deviceArr.filter(item=>item.sn).map((item)=>{ this.snForm.deviceArr
return { .filter((item) => item.sn)
sn: item.sn, .map((item) => {
deviceClassifyName: item.deviceType return {
} sn: item.sn,
deviceClassifyName: item.deviceType,
})) };
})
);
} }
}) });
}) });
}, },
handleClose(type) { handleClose(type) {
this.btnClick(type); this.btnClick(type);
...@@ -1211,7 +1209,7 @@ export default { ...@@ -1211,7 +1209,7 @@ export default {
getStoreList() { getStoreList() {
let _this = this; let _this = this;
_this.loading = true; _this.loading = true;
getOrgTree({hasUserLeaf: true}).then((res) => { getOrgTree({ hasUserLeaf: true }).then((res) => {
const { code, data } = res; const { code, data } = res;
_this.loading = false; _this.loading = false;
if (code == 200) { if (code == 200) {
...@@ -1221,7 +1219,7 @@ export default { ...@@ -1221,7 +1219,7 @@ export default {
}, },
filterConfirm() { filterConfirm() {
const { label, id, origin } = this.$refs.tree.getCurrentNode(); const { label, id, origin } = this.$refs.tree.getCurrentNode();
if (origin.type !== 'u') { if (origin.type !== "u") {
this.$message({ this.$message({
message: "请选择下级所属组织", message: "请选择下级所属组织",
type: "error", type: "error",
...@@ -1230,7 +1228,7 @@ export default { ...@@ -1230,7 +1228,7 @@ export default {
} }
this.$set(this.vehicleForm, "organizationName", label); this.$set(this.vehicleForm, "organizationName", label);
this.vehicleForm.organizationId = id; this.vehicleForm.organizationId = id;
this.$refs.vehicleRuleForm.$children[0].validateField('organizationName') this.$refs.vehicleRuleForm.$children[0].validateField("organizationName");
this.closeFilter(); this.closeFilter();
}, },
filterNode(value, data) { filterNode(value, data) {
...@@ -1279,10 +1277,10 @@ export default { ...@@ -1279,10 +1277,10 @@ export default {
let o = _this.vehicleDefalutData; let o = _this.vehicleDefalutData;
let m = o.find((k) => k.prop == "brandId"); let m = o.find((k) => k.prop == "brandId");
m.options = _list; m.options = _list;
m.loading = false m.loading = false;
_this.vehicleList = _list; _this.vehicleList = _list;
this.vehicleListInit = true this.vehicleListInit = true;
resolve() resolve();
}); });
}, },
...@@ -1312,32 +1310,29 @@ export default { ...@@ -1312,32 +1310,29 @@ export default {
} else { } else {
list.splice(idx + 1, 0, n); list.splice(idx + 1, 0, n);
} }
if(flag) {
let row = list.find((item)=>item.prop === 'seriesId')
setTimeout(()=>{
let id = this.vehicleForm.typeId
this.changeCarModel(this.vehicleForm.seriesId, row)
this.vehicleForm.typeId = id
},500) if (flag) {
let row = list.find((item) => item.prop === "seriesId");
setTimeout(() => {
let id = this.vehicleForm.typeId;
this.changeCarModel(this.vehicleForm.seriesId, row);
this.vehicleForm.typeId = id;
}, 500);
} }
list.map((k) => { list.map((k) => {
if(flag == 'view') { if (flag == "view") {
this.$set(k, "disabled", true); this.$set(k, "disabled", true);
}else if(!this.isCreateMode){ } else if (!this.isCreateMode) {
if (k.prop === "vin" || k.prop == "organizationName") { if (k.prop === "vin" || k.prop == "organizationName") {
this.$set(k, "disabled", true); this.$set(k, "disabled", true);
}else{ } else {
this.$set(k, "disabled", false); this.$set(k, "disabled", false);
} }
}else{ } else {
this.$set(k, "disabled", false); this.$set(k, "disabled", false);
} }
}); });
this.$set(this, "vehicleDefalutData", list); this.$set(this, "vehicleDefalutData", list);
this.vehicleData = _.cloneDeep(list); this.vehicleData = _.cloneDeep(list);
...@@ -1382,11 +1377,11 @@ export default { ...@@ -1382,11 +1377,11 @@ export default {
} }
list.map((k) => { list.map((k) => {
if(k.prop === 'typeId') { if (k.prop === "typeId") {
if(this.isViewMode){ if (this.isViewMode) {
this.$set(k, 'disabled', true) this.$set(k, "disabled", true);
}else{ } else {
this.$set(k, 'disabled', false) this.$set(k, "disabled", false);
} }
} }
}); });
...@@ -1397,7 +1392,8 @@ export default { ...@@ -1397,7 +1392,8 @@ export default {
}, },
// 动态创建选择框 // 动态创建选择框
creatSelect(data) {console.log(data) creatSelect(data) {
console.log(data);
let nList = this.vehicleList; let nList = this.vehicleList;
let _list = _.cloneDeep(this.vehicleDefalutData); let _list = _.cloneDeep(this.vehicleDefalutData);
//动态创建车系、车型选择框 //动态创建车系、车型选择框
...@@ -1464,28 +1460,29 @@ export default { ...@@ -1464,28 +1460,29 @@ export default {
return _list; return _list;
}, },
addDevice(){ addDevice() {
if(this.snForm.deviceArr.length === 9) return if (this.snForm.deviceArr.length === 9) return;
this.snForm.deviceArr.push({ this.snForm.deviceArr.push({
sn: '', sn: "",
deviceType: '' deviceType: "",
}) });
this.snRules['device'+(this.snForm.deviceArr.length-1)] = this.snRules.device0 this.snRules["device" + (this.snForm.deviceArr.length - 1)] =
}, this.snRules.device0;
},
removeDevice(index) { removeDevice(index) {
if(this.snForm.deviceArr.length == 1) return if (this.snForm.deviceArr.length == 1) return;
this.snForm.deviceArr.splice(index, 1) this.snForm.deviceArr.splice(index, 1);
}, },
// 监听输入 // 监听输入
onInput(e){ onInput(e) {
console.log(this.searchForm); console.log(this.searchForm);
this.$refs.serchButton.$el.click(); this.$refs.serchButton.$el.click();
}, },
FreqModalChange(isOpen){ FreqModalChange(isOpen) {
this.freqVisible = isOpen; this.freqVisible = isOpen;
}, },
gotoMonitor() { gotoMonitor() {
console.log(this.vehicleForm) console.log(this.vehicleForm);
/* let snO = { /* let snO = {
name: this.vehicleForm.name, name: this.vehicleForm.name,
standNo: this.vehicleForm.vin, standNo: this.vehicleForm.vin,
...@@ -1493,52 +1490,56 @@ export default { ...@@ -1493,52 +1490,56 @@ export default {
sourceType: this.vehicleForm.trackInfo.source === 0?'无线':'有线', sourceType: this.vehicleForm.trackInfo.source === 0?'无线':'有线',
source: this.vehicleForm.trackInfo.source source: this.vehicleForm.trackInfo.source
} */ } */
//this.$router.push({ name: 'monitor', params: { snArr: [snO], mode: 'monitor' }}) //this.$router.push({ name: 'monitor', params: { snArr: [snO], mode: 'monitor' }})
//let routeData = this.$router.resolve({ path: '../oEshield#/monitor/monitor', query: { snArr: JSON.stringify([snO])}});
// window.open(routeData.href, '_blank');
//location.href = '/trialRun#/vehicleSubmit'//'/oEshield#/monitor/monitor?vin='+this.vehicleForm.vin //let routeData = this.$router.resolve({ path: '../oEshield#/monitor/monitor', query: { snArr: JSON.stringify([snO])}});
history.pushState(null, 'name', '/oEshield#/monitor/monitor?vin='+this.vehicleForm.vin) // window.open(routeData.href, '_blank');
}
//location.href = '/trialRun#/vehicleSubmit'//'/oEshield#/monitor/monitor?vin='+this.vehicleForm.vin
history.pushState(
null,
"name",
"/oEshield#/monitor/monitor?vin=" + this.vehicleForm.vin
);
},
}, },
components: { components: {
freqModal freqModal,
} },
}; };
</script> </script>
<style> <style>
.searchTop.inline .search-form{ .searchTop.inline .search-form {
max-width: 1200px; max-width: 1200px;
position: relative; position: relative;
} }
.searchTop.inline .el-form-item{ .searchTop.inline .el-form-item {
width: auto; width: auto;
max-width: 430px; max-width: 430px;
} }
.searchTop.inline .search-form .el-form-item__content { .searchTop.inline .search-form .el-form-item__content {
width: auto; width: auto;
} }
.searchTop.inline .el-input .el-input__inner{ .searchTop.inline .el-input .el-input__inner {
width: 360px; width: 360px;
} }
.searchTop.inline .el-select .el-input__inner{ .searchTop.inline .el-select .el-input__inner {
width: 120px; width: 120px;
} }
.searchTop.inline .el-form-item__label{ .searchTop.inline .el-form-item__label {
width: 5em; width: 5em;
} }
.freq_table{ .freq_table {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
} }
.freq_table th, .freq_table td{ .freq_table th,
border: 1px solid #ccc; .freq_table td {
padding: 2px; border: 1px solid #ccc;
text-align: center; padding: 2px;
} text-align: center;
.unvisible{ }
visibility: hidden; .unvisible {
} visibility: hidden;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -411,6 +411,10 @@ export default { ...@@ -411,6 +411,10 @@ export default {
listName: "list", listName: "list",
tableColumns: [ tableColumns: [
{ {
label: "业务工单号",
prop: "bizOrderNo",
},
{
label: "车主姓名", label: "车主姓名",
prop: "ownerName", prop: "ownerName",
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!