bug修改

This commit is contained in:
tx 2024-12-20 16:25:49 +08:00
parent 005bd0ef63
commit 56b3b0f438
2 changed files with 154 additions and 121 deletions

View File

@ -689,6 +689,7 @@ export default {
//
queryParams2: {
pageNum: 1,
deptId: this.deptId,
pageSize: 999
},
//
@ -726,6 +727,10 @@ export default {
sn: [{ required: true, message: "SN不能为空", trigger: "blur" }],
mac: [{ required: true, message: "MAC不能为空", trigger: "blur" }],
},
deptAreas: {}, // {deptId: {areaList: [], modelList: []}}
areaInfo: {}, // {areaId: {deptId: null, modelList: []}}
allAreas: [], //
allModels: [], //
};
},
mounted() {
@ -826,29 +831,101 @@ export default {
this.gettj();
}
},
handleDeptChange(val) {
if (!this.isUpdating) {
this.fetchData2(val);
}
},
/** 当选择代理商时调用 */
handleDeptChange(val) {
if (!this.isUpdating) {
if (val) {
this.isUpdating = true;
selectAreaListByDeptId(val).then((response) => {
//
this.areaOptions = response.data.areaList || [];
this.modelOptions = response.data.modelList || [];
//
this.form.areaId = null;
this.form.modelId = null;
//
if (this.areaOptions.length > 0) {
this.form.areaId = this.areaOptions[0].areaId;
}
if (this.modelOptions.length > 0) {
this.form.modelId = this.modelOptions[0].modelId;
}
//
handleAreaChange(val) {
console.log('=调用了');
if (!this.isUpdating) {
this.fetchData3(val);
}
},
//
if (this.areaOptions.length === 0) {
this.$message.warning('该代理商暂无运营区');
}
if (this.modelOptions.length === 0) {
this.$message.warning('该代理商暂无可用车型');
}
}).finally(() => {
this.isUpdating = false;
});
} else {
//
this.isUpdating = true;
listArea(this.queryParams2).then((response) => {
this.areaOptions = response.rows || [];
this.form.areaId = null;
this.form.modelId = null;
this.modelOptions = [];
}).finally(() => {
this.isUpdating = false;
});
}
}
},
//
handleModelChange(val) {
console.log('=调用了');
if (!this.isUpdating) {
this.fetchData(val);
}
},
/** 当选择运营区时调用 */
handleAreaChange(val) {
if (!this.isUpdating) {
if (val) {
this.isUpdating = true;
selectDeptByAreaId(val).then((response) => {
//
if (!this.form.deptId && response.data.sysDept) {
this.form.deptId = response.data.sysDept.deptId;
//
selectAreaListByDeptId(this.form.deptId).then((deptResponse) => {
this.modelOptions = deptResponse.data.modelList || [];
if (this.modelOptions.length > 0) {
this.form.modelId = this.modelOptions[0].modelId;
} else {
this.form.modelId = null;
this.$message.warning('该代理商暂无可用车型');
}
});
} else {
// 使
this.modelOptions = response.data.modelList || [];
if (!this.form.modelId && this.modelOptions.length > 0) {
this.form.modelId = this.modelOptions[0].modelId;
} else if (this.modelOptions.length === 0) {
this.form.modelId = null;
this.$message.warning('该运营区暂无可用车型');
}
}
}).finally(() => {
this.isUpdating = false;
});
} else {
//
this.form.modelId = null;
this.modelOptions = [];
}
}
},
/** 当选择车型时调用 */
handleModelChange(val) {
//
if (!val) {
this.form.modelId = null;
}
},
//
handleHardwareVersionChange(val) {
@ -906,88 +983,29 @@ export default {
},
/** 当选择车型时调用 */
fetchData(modelId) {
if (modelId) {
this.isUpdating = true; //
getModel(modelId).then((response) => {
this.areaOptions = response.data.areaList;
let areaOptions = response.data.areaList;
if (response.data.operator) {
this.form.deptId = response.data.operator;
} else {
this.form.deptId = null;
}
areaOptions.length > 0
? (this.form.areaId = areaOptions[0].areaId)
: (this.form.areaId = null);
}).finally(() => {
this.isUpdating = false; //
});
} else {
this.reset2();
}
},
/** 当选择代理商时 根据代理商id获取运营区和型号 */
fetchData2(deptId) {
if (deptId) {
this.isUpdating = true; //
selectAreaListByDeptId(deptId).then((response) => {
this.areaOptions = response.data.areaList;
let areaOptions = response.data.areaList;
areaOptions.length > 0
? (this.form.areaId = areaOptions[0].areaId)
: (this.form.areaId = null);
this.modelOptions = response.data.modelList;
let modelOptions = response.data.modelList;
// console.log("=======1111111111=======",this.modelOptions.length)
modelOptions.length > 0
? (this.form.modelId = modelOptions[0].modelId)
: (this.form.modelId = null);
}).finally(() => {
this.isUpdating = false; //
});
} else {
this.reset2();
// this.form.areaId = null;
// this.form.modelId = null;
}
},
/** 当选择代理商时 根据代理商id获取运营区和型号 */
fetchData4(deptId) {
if (deptId) {
// this.isUpdating = true; //
selectAreaListByDeptId(deptId).then((response) => {
this.modelOptions = response.data.modelList;
let modelOptions = response.data.modelList;
modelOptions.length > 0
? (this.form.modelId = modelOptions[0].modelId)
: (this.form.modelId = null);
}).finally(() => {
// this.isUpdating = false; //
});
} else {
this.reset2();
// this.form.areaId = null;
// this.form.modelId = null;
}
},
/** 当选择运营区时 根据运营区id获取代理商和型号 */
fetchData3(areaId) {
if (areaId) {
this.isUpdating = true; //
selectDeptByAreaId(areaId).then((response) => {
this.form.deptId = response.data.sysDept.deptId;
this.modelOptions = response.data.modelList;
let modelOptions = response.data.modelList;
modelOptions.length > 0
? (this.form.modelId = modelOptions[0].modelId)
: (this.form.modelId = null);
}).finally(() => {
this.isUpdating = false; //
});
} else {
this.reset2();
}
// if (modelId) {
// this.isUpdating = true; //
// getModel(modelId).then((response) => {
// this.areaOptions = response.data.areaList;
// let areaOptions = response.data.areaList;
// if (response.data.operator) {
// this.form.deptId = response.data.operator;
// } else {
// this.form.deptId = null;
// }
// areaOptions.length > 0
// ? (this.form.areaId = areaOptions[0].areaId)
// : (this.form.areaId = null);
// }).finally(() => {
// this.isUpdating = false; //
// });
// } else {
// this.reset2();
// }
},
/** 排序触发事件 */
handleSortChange(column, prop, order) {
this.queryParams.orderByColumn = column.prop;
@ -1126,15 +1144,26 @@ export default {
},
/** 查询设备列表 */
getList() {
console.log('111111111111111111111111');
this.loading = true;
listDevice(this.queryParams).then((response) => {
this.deviceList = response.rows;
this.total = response.total;
this.loading = false;
});
listModel(this.queryParams2).then((response) => {
if(this.queryParams2.deptId){
selectAreaListByDeptId(this.queryParams2.deptId).then((deptResponse) => {
this.modelOptions = deptResponse.data.modelList || [];
});
}else{
listModel(this.queryParams2).then((response) => {
this.modelOptions = response.rows;
});
}
},
//
cancel() {
@ -1178,7 +1207,7 @@ export default {
}
);
}
// console.log(33333333333)
listModel(this.queryParams2).then((response) => {
this.modelOptions = response.rows;
});
@ -1187,20 +1216,24 @@ export default {
});
},
reset2() {
this.form.areaId = null;
this.form.deptId = null;
this.form.modelId = null;
if (this.userName === "admin") {
listDept2({ status: "0", pageNum: 1, pageSize: 999 }).then(
(response) => {
this.deptOptions = response.rows;
}
);
}
listArea(this.queryParams2).then((response) => {
this.areaOptions = response.rows;
this.form.areaId = null;
this.form.deptId = null;
this.form.modelId = null;
this.areaOptions = [];
this.modelOptions = [];
//
if (this.userName === "admin") {
listDept2({ status: "0", pageNum: 1, pageSize: 999 }).then((response) => {
this.deptOptions = response.rows;
});
},
}
//
listArea(this.queryParams2).then((response) => {
this.areaOptions = response.rows;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;

View File

@ -140,7 +140,7 @@
<el-input v-model="form.model" placeholder="请输入车型" />
</el-form-item>
<el-form-item v-if="userName == 'admin'" label="代理商" prop="operator">
<el-select v-model="form.operator" style="width: 100%" clearable placeholder="请选择代理商">
<el-select v-model="form.operator" style="width: 100%" filterable clearable placeholder="请选择代理商">
<el-option
v-for="item in deptOptions"
:key="item.deptId"
@ -149,8 +149,8 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="运营区" prop="areaId">
<el-select v-model="form.areaId" style="width: 100%" clearable placeholder="请选择代理商">
<!-- <el-form-item label="运营区" prop="areaId">
<el-select v-model="form.areaId" style="width: 100%" clearable placeholder="请选择代理商">
<el-option
v-for="item in areaOptions"
:key="item.areaId"
@ -158,7 +158,7 @@
:value="item.areaId"
></el-option>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="满电电压(V)" label-width="90" prop="fullVoltage">
<el-input style="width: 85%" v-model="form.fullVoltage" placeholder="请输入满电电压" />
</el-form-item>