1.调整
This commit is contained in:
parent
c29fd7f110
commit
319328c50b
|
@ -80,6 +80,17 @@
|
|||
<el-table-column label="亏电电压(V)" align="center" prop="lowVoltage" />
|
||||
<el-table-column label="满电续航(km)" align="center" prop="fullEndurance" />
|
||||
<el-table-column label="骑行低电量提醒(%)" align="center" prop="lowBatteryReminder" />
|
||||
<!-- 新增低电量提醒开关 -->
|
||||
<el-table-column label="低电量提醒开关" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.lowBatteryReminderSwitch"
|
||||
:active-value="true"
|
||||
:inactive-value="false"
|
||||
@change="handleLowBatteryReminderSwitchChange(scope.row)"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已投放车辆" align="center" prop="deviceNum" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
|
@ -275,6 +286,25 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
handleLowBatteryReminderSwitchChange(row) {
|
||||
// 获取低电量提醒开关的状态提示
|
||||
let text = row.lowBatteryReminderSwitch ? "启用低电量提醒" : "关闭低电量提醒";
|
||||
this.$modal.confirm(`确认要"${text}"吗?`).then(() => {
|
||||
// 创建更新数据对象,将需要更新的模型信息传递给后端
|
||||
const updateData = {
|
||||
...row, // 将模型的所有字段都传递过去
|
||||
lowBatteryReminderSwitch: row.lowBatteryReminderSwitch // 确保传递最新的开关状态
|
||||
};
|
||||
// 调用 updateModel 方法更新模型信息
|
||||
return updateModel(updateData).then(response => {
|
||||
this.$modal.msgSuccess(`${text}成功`);
|
||||
this.getList(); // 刷新列表
|
||||
}).catch(() => {
|
||||
// 如果更新失败,恢复开关原始状态
|
||||
row.lowBatteryReminderSwitch = !row.lowBatteryReminderSwitch;
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 当选择代理商时 根据代理商id,获取运营区和型号 */
|
||||
fetchData2(deptId,oldVal) {
|
||||
console.log("deptId1111",deptId)
|
||||
|
|
Loading…
Reference in New Issue
Block a user