Compare commits
No commits in common. "94f0bfcf584cb09a779fbae1d515ade59d3b9ad5" and "7c86916a53b8c457530f8466672d905b602d4483" have entirely different histories.
94f0bfcf58
...
7c86916a53
|
@ -22,14 +22,6 @@
|
|||
<el-form-item label="订单号" prop="orderNo">
|
||||
<el-input v-model="queryParams.orderNo" placeholder="请输入订单号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="createBy">
|
||||
<el-input
|
||||
v-model="queryParams.createBy"
|
||||
placeholder="请输入操作人手机"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
|
|
|
@ -564,10 +564,6 @@ export default {
|
|||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
},
|
||||
queryParams2: {
|
||||
pageNum: 1,
|
||||
pageSize: 999,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
payChannel: 2,
|
||||
|
@ -814,7 +810,7 @@ export default {
|
|||
this.areaOptions = response.rows;
|
||||
this.form.parentId = 100;
|
||||
});
|
||||
listChannel(this.queryParams2).then(response => {
|
||||
listChannel(this.queryParams).then(response => {
|
||||
this.channelOptions = response.rows;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -357,27 +357,53 @@
|
|||
<!-- 代理商、运营区、车辆型号一行 -->
|
||||
<el-col :span="8" v-if="userName == 'admin'">
|
||||
<el-form-item label="代理商" prop="deptId">
|
||||
<el-select v-model="form.deptId" clearable filterable placeholder="请选择代理商" @change="handleDeptChange"
|
||||
<el-select
|
||||
v-model="form.deptId"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择代理商"
|
||||
@change="handleDeptChange"
|
||||
style="width: 100%">
|
||||
<el-option v-for="item in deptOptions" :key="item.deptId" :label="item.deptName" :value="item.deptId">
|
||||
<el-option
|
||||
v-for="item in deptOptions"
|
||||
:key="item.deptId"
|
||||
:label="item.deptName"
|
||||
:value="item.deptId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="运营区" prop="areaId">
|
||||
<el-select v-model="form.areaId" clearable filterable placeholder="请选择运营区" @change="handleAreaChange"
|
||||
<el-select
|
||||
v-model="form.areaId"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择运营区"
|
||||
@change="handleAreaChange"
|
||||
style="width: 100%">
|
||||
<el-option v-for="item in areaOptions" :key="item.areaId" :label="item.areaName" :value="item.areaId">
|
||||
<el-option
|
||||
v-for="item in areaOptions"
|
||||
:key="item.areaId"
|
||||
:label="item.areaName"
|
||||
:value="item.areaId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="车辆型号" prop="modelId">
|
||||
<el-select v-model="form.modelId" clearable placeholder="请选择车辆型号" @change="handleModelChange"
|
||||
<el-select
|
||||
v-model="form.modelId"
|
||||
clearable
|
||||
placeholder="请选择车辆型号"
|
||||
@change="handleModelChange"
|
||||
style="width: 100%">
|
||||
<el-option v-for="item in modelOptions" :key="item.modelId" :label="item.model" :value="item.modelId">
|
||||
<el-option
|
||||
v-for="item in modelOptions"
|
||||
:key="item.modelId"
|
||||
:label="item.model"
|
||||
:value="item.modelId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -387,11 +413,19 @@
|
|||
<el-row :gutter="20">
|
||||
<!-- 硬件版本 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="硬件版本" prop="hardwareVersionId"
|
||||
v-if="hardwareVersionOptions.length > 0 && userName == 'admin'">
|
||||
<el-select v-model="form.hardwareVersionId" clearable placeholder="请选择硬件版本"
|
||||
:disabled="userName != 'admin'" @change="handleHardwareVersionChange" style="width: 100%">
|
||||
<el-option v-for="item in hardwareVersionOptions" :key="item.id" :label="item.version" :value="item.id">
|
||||
<el-form-item label="硬件版本" prop="hardwareVersionId" v-if="hardwareVersionOptions.length > 0 && userName == 'admin'">
|
||||
<el-select
|
||||
v-model="form.hardwareVersionId"
|
||||
clearable
|
||||
placeholder="请选择硬件版本"
|
||||
:disabled="userName != 'admin'"
|
||||
@change="handleHardwareVersionChange"
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in hardwareVersionOptions"
|
||||
:key="item.id"
|
||||
:label="item.version"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -437,7 +471,7 @@
|
|||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
<el-dialog style="font-weight: bold" title="设备详情" :close-on-click-modal="true" :visible.sync="open2" width="1300px"
|
||||
append-to-body>
|
||||
<el-form ref="form" :model="form" label-width="100px" size="mini">
|
||||
|
@ -507,7 +541,7 @@
|
|||
@select-changed="onSelectChange" @map-geo="onMapGeo" :init-lat="form.latitude" :init-lng="form.longitude"
|
||||
:status="form.status" :online-status="form.onlineStatus" :device-sn="form.sn" :areaId="form.areaId"
|
||||
:trip-route-str="tripRouteStr" /> -->
|
||||
<location-map :deviceSn="form.sn" :areaId="form.areaId" height="500px" />
|
||||
<location-map :deviceSn="form.sn" :areaId="form.areaId" height="500px"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
@ -806,7 +840,7 @@ export default {
|
|||
}
|
||||
},
|
||||
/** 当选择代理商时调用 */
|
||||
handleDeptChange(val) {
|
||||
handleDeptChange(val) {
|
||||
if (!this.isUpdating) {
|
||||
if (val) {
|
||||
this.isUpdating = true;
|
||||
|
@ -850,10 +884,10 @@ export default {
|
|||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/** 当选择运营区时调用 */
|
||||
handleAreaChange(val) {
|
||||
/** 当选择运营区时调用 */
|
||||
handleAreaChange(val) {
|
||||
if (!this.isUpdating) {
|
||||
if (val) {
|
||||
this.isUpdating = true;
|
||||
|
@ -891,7 +925,7 @@ export default {
|
|||
this.modelOptions = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/** 当选择车型时调用 */
|
||||
handleModelChange(val) {
|
||||
|
@ -1125,12 +1159,12 @@ export default {
|
|||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
if (this.queryParams2.deptId) {
|
||||
if(this.queryParams2.deptId){
|
||||
selectAreaListByDeptId(this.queryParams2.deptId).then((deptResponse) => {
|
||||
this.modelOptions = deptResponse.data.modelList || [];
|
||||
|
||||
});
|
||||
} else {
|
||||
}else{
|
||||
listModel(this.queryParams2).then((response) => {
|
||||
|
||||
|
||||
|
@ -1315,22 +1349,11 @@ export default {
|
|||
// this.fetchData(response.data.deptId)
|
||||
// this.open = true;
|
||||
// this.title = "修改设备1";
|
||||
// this.open = true;
|
||||
// this.title = "修改设备";
|
||||
let deptId = '100';
|
||||
if (response.data.deptId == null) {
|
||||
console.log('判断1');
|
||||
|
||||
deptId = '100'
|
||||
} else {
|
||||
console.log('判断2');
|
||||
deptId = response.data.deptId;
|
||||
}
|
||||
console.log(deptId, 'deptIddeptIddeptIddeptId');
|
||||
selectAreaListByDeptId(deptId).then((res) => {
|
||||
selectAreaListByDeptId(response.data.deptId).then((res) => {
|
||||
// 方案1: 使用Vue.set确保响应式更新
|
||||
setTimeout(() => {
|
||||
|
||||
console.log('=调用了11');
|
||||
|
||||
this.$set(this, 'modelOptions', []);
|
||||
this.$set(this, 'areaOptions', []);
|
||||
|
@ -1350,7 +1373,6 @@ export default {
|
|||
|
||||
// 不再需要setTimeout和$forceUpdate
|
||||
}).finally(() => {
|
||||
|
||||
this.isUpdating = false;
|
||||
});
|
||||
|
||||
|
@ -1481,59 +1503,20 @@ export default {
|
|||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(async (valid) => {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
// 1. 如果选择了运营区,验证运营区与代理商的关系
|
||||
if (this.form.areaId) {
|
||||
const areaResponse = await selectDeptByAreaId(this.form.areaId);
|
||||
const areaDeptId = areaResponse.data.sysDept?.deptId;
|
||||
|
||||
if (this.form.deptId && areaDeptId && this.form.deptId !== areaDeptId) {
|
||||
this.$modal.msgError("所选运营区不属于当前代理商,请重新选择!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 如果选择了代理商,验证车型是否属于该代理商
|
||||
if (this.form.deptId && this.form.modelId) {
|
||||
const deptResponse = await selectAreaListByDeptId(this.form.deptId);
|
||||
const validModels = deptResponse.data.modelList || [];
|
||||
const isValidModel = validModels.some(model => model.modelId === this.form.modelId);
|
||||
|
||||
if (!isValidModel) {
|
||||
this.$modal.msgError("所选车型不属于当前代理商,请重新选择!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 如果选择了运营区和车型,验证车型是否属于该运营区
|
||||
if (this.form.areaId && this.form.modelId) {
|
||||
const areaResponse = await selectDeptByAreaId(this.form.areaId);
|
||||
const validModels = areaResponse.data.modelList || [];
|
||||
const isValidModel = validModels.some(model => model.modelId === this.form.modelId);
|
||||
|
||||
if (!isValidModel) {
|
||||
this.$modal.msgError("所选车型不属于当前运营区,请重新选择!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 所有验证通过后,执行提交操作
|
||||
if (this.form.deviceId != null) {
|
||||
const response = await updateDevice(this.form);
|
||||
updateDevice(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
const response = await addDevice(this.form);
|
||||
addDevice(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("提交表单时发生错误:", error);
|
||||
this.$modal.msgError("操作失败:" + (error.message || "未知错误"));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1565,8 +1548,6 @@ export default {
|
|||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.el-dialog {
|
||||
.el-form {
|
||||
|
|
Loading…
Reference in New Issue
Block a user