2024-05-20 18:07:24 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
2024-11-06 10:53:33 +08:00
|
|
|
|
<el-form-item label="代理商" prop="deptId" v-if="userName == 'admin' && !deptId">
|
2024-09-12 16:30:33 +08:00
|
|
|
|
<el-select v-model="queryParams.operator" filterable placeholder="选择代理商" clearable>
|
2024-08-01 17:22:15 +08:00
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in deptOptions"
|
|
|
|
|
:key="item.deptId"
|
|
|
|
|
:label="item.deptName"
|
|
|
|
|
:value="item.deptId"
|
|
|
|
|
></el-option>
|
2024-11-06 10:53:33 +08:00
|
|
|
|
</el-select>
|
2024-08-01 17:22:15 +08:00
|
|
|
|
</el-form-item>
|
2024-05-20 18:07:24 +08:00
|
|
|
|
<el-form-item label="车型" prop="model">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.model"
|
|
|
|
|
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>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleAdd"
|
|
|
|
|
v-hasPermi="['system:model:add']"
|
|
|
|
|
>新增</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="success"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
size="mini"
|
|
|
|
|
:disabled="single"
|
|
|
|
|
@click="handleUpdate"
|
|
|
|
|
v-hasPermi="['system:model:edit']"
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="danger"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
size="mini"
|
|
|
|
|
:disabled="multiple"
|
|
|
|
|
@click="handleDelete"
|
|
|
|
|
v-hasPermi="['system:model:remove']"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="warning"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-download"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
v-hasPermi="['system:model:export']"
|
|
|
|
|
>导出</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="modelList" @selection-change="handleSelectionChange">
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
<el-table-column label="车型" align="center" prop="model" />
|
2024-11-06 10:53:33 +08:00
|
|
|
|
<!-- <el-table-column label="代理商" align="center" prop="operatorName" /> -->
|
|
|
|
|
<el-table-column label="代理商" align="center" :show-overflow-tooltip="true">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<router-link :to="'/system/deptDetail/index/' + scope.row.operator" class="link-type">
|
|
|
|
|
<span>{{scope.row.operatorName}}</span>
|
|
|
|
|
</router-link>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2024-09-10 10:25:06 +08:00
|
|
|
|
<el-table-column label="运营区" align="center" prop="areaName" />
|
2024-06-06 22:08:03 +08:00
|
|
|
|
<el-table-column label="满电电压(V)" align="center" prop="fullVoltage" />
|
|
|
|
|
<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" />
|
2024-09-14 10:16:36 +08:00
|
|
|
|
<!-- 新增低电量提醒开关 -->
|
|
|
|
|
<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>
|
2024-05-20 18:07:24 +08:00
|
|
|
|
<el-table-column label="已投放车辆" align="center" prop="deviceNum" />
|
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="备注" align="center" prop="remark" />
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
v-hasPermi="['system:model:edit']"
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
|
v-hasPermi="['system:model:remove']"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<pagination
|
|
|
|
|
v-show="total>0"
|
|
|
|
|
:total="total"
|
|
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改车辆型号对话框 -->
|
2024-06-06 22:08:03 +08:00
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
2024-05-20 18:07:24 +08:00
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
<el-form-item label="车型" prop="model">
|
|
|
|
|
<el-input v-model="form.model" placeholder="请输入车型" />
|
|
|
|
|
</el-form-item>
|
2024-09-12 16:30:33 +08:00
|
|
|
|
<el-form-item v-if="userName == 'admin'" label="代理商" prop="operator">
|
|
|
|
|
<el-select v-model="form.operator" style="width: 100%" clearable placeholder="请选择代理商">
|
2024-08-01 17:22:15 +08:00
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in deptOptions"
|
|
|
|
|
:key="item.deptId"
|
|
|
|
|
:label="item.deptName"
|
|
|
|
|
:value="item.deptId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
2024-05-20 18:07:24 +08:00
|
|
|
|
</el-form-item>
|
2024-09-10 10:25:06 +08:00
|
|
|
|
<el-form-item label="运营区" prop="areaId">
|
2024-09-12 16:30:33 +08:00
|
|
|
|
<el-select v-model="form.areaId" style="width: 100%" clearable placeholder="请选择代理商">
|
2024-09-10 10:25:06 +08:00
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in areaOptions"
|
|
|
|
|
:key="item.areaId"
|
|
|
|
|
:label="item.areaName"
|
|
|
|
|
:value="item.areaId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-06-06 22:08:03 +08:00
|
|
|
|
<el-form-item label="满电电压(V)" label-width="90" prop="fullVoltage">
|
|
|
|
|
<el-input style="width: 85%" v-model="form.fullVoltage" placeholder="请输入满电电压" />
|
2024-05-20 18:07:24 +08:00
|
|
|
|
</el-form-item>
|
2024-06-06 22:08:03 +08:00
|
|
|
|
<el-form-item label="亏电电压(V)" label-width="90" prop="lowVoltage">
|
|
|
|
|
<el-input style="width: 85%" v-model="form.lowVoltage" placeholder="请输入亏电电压" />
|
2024-05-20 18:07:24 +08:00
|
|
|
|
</el-form-item>
|
2024-06-06 22:08:03 +08:00
|
|
|
|
<el-form-item label="满电续航(KM)" label-width="90" prop="fullEndurance">
|
|
|
|
|
<el-input style="width: 80%" v-model="form.fullEndurance" placeholder="请输入满电续航" />
|
2024-05-20 18:07:24 +08:00
|
|
|
|
</el-form-item>
|
2024-09-12 16:30:33 +08:00
|
|
|
|
<el-form-item label="低电量提醒" label-width="90" prop="lowBatteryReminderSwitch">
|
|
|
|
|
<el-switch v-model="form.lowBatteryReminderSwitch" class="drawer-switch" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="form.lowBatteryReminderSwitch == true" label="骑行低电量提醒(%)" label-width="120" prop="lowBatteryReminder">
|
2024-06-06 22:08:03 +08:00
|
|
|
|
<el-input style="width: 78%" v-model="form.lowBatteryReminder" placeholder="请输入骑行低电量提醒" />
|
2024-05-20 18:07:24 +08:00
|
|
|
|
</el-form-item>
|
2024-09-10 10:25:06 +08:00
|
|
|
|
<el-form-item label="应用收费方式" label-width="120" prop="ruleIds">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="form.ruleIds"
|
|
|
|
|
multiple
|
|
|
|
|
style="width: 85%"
|
|
|
|
|
placeholder="请选择收费方式">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in ruleOptions"
|
|
|
|
|
:key="item.ruleId"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.ruleId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-05-20 18:07:24 +08:00
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listModel, getModel, delModel, addModel, updateModel } from "@/api/system/model";
|
2024-06-06 22:08:03 +08:00
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
2024-08-01 17:22:15 +08:00
|
|
|
|
import { listDept2 } from '@/api/system/dept'
|
2024-09-10 10:25:06 +08:00
|
|
|
|
import { listFee } from '@/api/system/fee'
|
|
|
|
|
import { listArea, optionselect as getAreaOptionselect, selectAreaListByDeptId } from '@/api/system/area'
|
2024-05-20 18:07:24 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Model",
|
2024-06-06 22:08:03 +08:00
|
|
|
|
components: { Treeselect },
|
2024-11-06 10:53:33 +08:00
|
|
|
|
props: {
|
|
|
|
|
// 用户id
|
|
|
|
|
deptId: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: null,
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-05-20 18:07:24 +08:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
2024-09-10 10:25:06 +08:00
|
|
|
|
isUpdating: false, // 标志位
|
2024-05-20 18:07:24 +08:00
|
|
|
|
// 选中数组
|
|
|
|
|
ids: [],
|
2024-09-12 16:30:33 +08:00
|
|
|
|
// 代理商树选项
|
2024-06-06 22:08:03 +08:00
|
|
|
|
deptOptions: [],
|
2024-09-10 10:25:06 +08:00
|
|
|
|
// 区域列表
|
|
|
|
|
areaOptions: [],
|
2024-06-06 22:08:03 +08:00
|
|
|
|
userName: undefined,
|
2024-09-10 10:25:06 +08:00
|
|
|
|
ruleOptions: [],
|
2024-05-20 18:07:24 +08:00
|
|
|
|
// 非单个禁用
|
|
|
|
|
single: true,
|
|
|
|
|
// 非多个禁用
|
|
|
|
|
multiple: true,
|
|
|
|
|
// 显示搜索条件
|
|
|
|
|
showSearch: true,
|
|
|
|
|
// 总条数
|
|
|
|
|
total: 0,
|
|
|
|
|
// 车辆型号表格数据
|
|
|
|
|
modelList: [],
|
|
|
|
|
// 弹出层标题
|
|
|
|
|
title: "",
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
2024-08-21 09:03:18 +08:00
|
|
|
|
pageSize: 20,
|
2024-05-20 18:07:24 +08:00
|
|
|
|
model: null,
|
|
|
|
|
brand: null,
|
2024-11-06 10:53:33 +08:00
|
|
|
|
operator: this.deptId,
|
|
|
|
|
// operator:,
|
2024-05-20 18:07:24 +08:00
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
2024-09-12 16:30:33 +08:00
|
|
|
|
form: {
|
|
|
|
|
lowBatteryReminderSwitch: false,
|
|
|
|
|
},
|
2024-05-20 18:07:24 +08:00
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
2024-06-06 22:08:03 +08:00
|
|
|
|
model: [
|
|
|
|
|
{ required: true, message: "车型不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
operator: [
|
2024-09-12 16:30:33 +08:00
|
|
|
|
{ required: true, message: "代理商不能为空", trigger: "blur" }
|
2024-06-06 22:08:03 +08:00
|
|
|
|
],
|
|
|
|
|
fullVoltage: [
|
|
|
|
|
{ required: true, message: "满电电压不能为空", trigger: "blur" },
|
2024-06-25 09:30:33 +08:00
|
|
|
|
{ pattern: /^\d+(\.\d{1,2})?$/, message: '请输入最多两位小数的浮点数', trigger: 'blur' }
|
|
|
|
|
|
2024-06-06 22:08:03 +08:00
|
|
|
|
],
|
|
|
|
|
lowVoltage: [
|
|
|
|
|
{ required: true, message: "亏电电压不能为空", trigger: "blur" },
|
2024-06-25 09:30:33 +08:00
|
|
|
|
{ pattern: /^\d+(\.\d{1,2})?$/, message: '请输入最多两位小数的浮点数', trigger: 'blur' }
|
|
|
|
|
|
2024-06-06 22:08:03 +08:00
|
|
|
|
],
|
|
|
|
|
fullEndurance: [
|
|
|
|
|
{ required: true, message: "满电续航不能为空", trigger: "blur" },
|
|
|
|
|
{ pattern: /^\d+$/, message: '满电续航必须为正整数', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
lowBatteryReminder: [
|
|
|
|
|
{ required: true, message: "骑行低电量提醒不能为空", trigger: "blur" },
|
|
|
|
|
{ pattern: /^\d+$/, message: '骑行低电量提醒必须为正整数', trigger: 'blur' }
|
|
|
|
|
]
|
2024-05-20 18:07:24 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
2024-06-06 22:08:03 +08:00
|
|
|
|
console.log("当前用户信息:",this.$store.state.user.name)
|
|
|
|
|
this.userName = this.$store.state.user.name;
|
2024-08-08 14:29:43 +08:00
|
|
|
|
if(this.userName == 'admin'){
|
|
|
|
|
this.getDeptTree();
|
|
|
|
|
}
|
2024-09-10 10:25:06 +08:00
|
|
|
|
this.getAreaList();
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
'form.operator'(newVal,oldVal) {
|
|
|
|
|
if (!this.isUpdating) {
|
|
|
|
|
this.fetchData2(newVal,oldVal);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-05-20 18:07:24 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-09-14 10:16:36 +08:00
|
|
|
|
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;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-09-12 16:30:33 +08:00
|
|
|
|
/** 当选择代理商时 根据代理商id,获取运营区和型号 */
|
2024-09-10 10:25:06 +08:00
|
|
|
|
fetchData2(deptId,oldVal) {
|
|
|
|
|
console.log("deptId1111",deptId)
|
|
|
|
|
console.log("oldVal1111",oldVal)
|
|
|
|
|
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.ruleOptions = response.data.ruleList;
|
|
|
|
|
// this.form.ruleIds = null
|
|
|
|
|
// ruleOptions.length > 0
|
|
|
|
|
// ? (this.form.ruleIds = ruleOptions.map((rule) => rule.ruleId))
|
|
|
|
|
// : (this.form.ruleIds = null);
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
this.isUpdating = false; // 清除标志位
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.reset2();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getAreaList() {
|
|
|
|
|
getAreaOptionselect().then((response) => {
|
|
|
|
|
this.areaOptions = response.data;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getRuleList() {
|
|
|
|
|
listFee({ deptId: this.form.modelId }).then(response => {
|
|
|
|
|
this.ruleOptions = response.rows;
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-05-20 18:07:24 +08:00
|
|
|
|
/** 查询车辆型号列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
listModel(this.queryParams).then(response => {
|
|
|
|
|
this.modelList = response.rows;
|
|
|
|
|
this.total = response.total;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
modelId: null,
|
2024-07-22 17:18:28 +08:00
|
|
|
|
hardwareVersionId: null,
|
2024-05-20 18:07:24 +08:00
|
|
|
|
model: null,
|
|
|
|
|
brand: null,
|
|
|
|
|
operator: null,
|
|
|
|
|
fullVoltage: null,
|
2024-06-06 22:08:03 +08:00
|
|
|
|
parentId: undefined,
|
2024-05-20 18:07:24 +08:00
|
|
|
|
lowVoltage: null,
|
|
|
|
|
fullEndurance: null,
|
|
|
|
|
lowBatteryReminder: null,
|
|
|
|
|
createBy: null,
|
|
|
|
|
createTime: null,
|
|
|
|
|
updateBy: null,
|
|
|
|
|
updateTime: null,
|
|
|
|
|
remark: null
|
|
|
|
|
};
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
2024-09-10 10:25:06 +08:00
|
|
|
|
reset2() {
|
|
|
|
|
console.log(111111111111111111);
|
|
|
|
|
this.form.areaId = null;
|
|
|
|
|
this.form.deptId = null;
|
|
|
|
|
// this.form.ruleId = null;
|
|
|
|
|
this.form.ruleIds = null;
|
|
|
|
|
if (this.userName === "admin") {
|
|
|
|
|
listDept2({ status: "0", pageNum: 1, pageSize: 999 }).then(
|
|
|
|
|
(response) => {
|
|
|
|
|
this.deptOptions = response.rows;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
listFee(this.queryParams).then(response => {
|
|
|
|
|
this.ruleOptions = response.rows;
|
|
|
|
|
});
|
|
|
|
|
listArea(this.queryParams).then((response) => {
|
|
|
|
|
this.areaOptions = response.rows;
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-05-20 18:07:24 +08:00
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.pageNum = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.resetForm("queryForm");
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
// 多选框选中数据
|
|
|
|
|
handleSelectionChange(selection) {
|
|
|
|
|
this.ids = selection.map(item => item.modelId)
|
|
|
|
|
this.single = selection.length!==1
|
|
|
|
|
this.multiple = !selection.length
|
|
|
|
|
},
|
2024-09-12 16:30:33 +08:00
|
|
|
|
/** 查询代理商下拉树结构 */
|
2024-06-06 22:08:03 +08:00
|
|
|
|
getDeptTree() {
|
2024-08-01 17:22:15 +08:00
|
|
|
|
listDept2({status: '0',pageNum:1,pageSize:999 }).then(response => {
|
|
|
|
|
this.deptOptions = response.rows;
|
2024-06-06 22:08:03 +08:00
|
|
|
|
});
|
2024-08-01 17:22:15 +08:00
|
|
|
|
// deptTreeSelect().then(response => {
|
|
|
|
|
// this.deptOptions = response.data;
|
|
|
|
|
// });
|
2024-06-06 22:08:03 +08:00
|
|
|
|
},
|
2024-05-20 18:07:24 +08:00
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleAdd() {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加车辆型号";
|
2024-11-08 09:38:40 +08:00
|
|
|
|
if(this.deptId){
|
|
|
|
|
this.form.operator=this.deptId
|
|
|
|
|
}
|
2024-05-20 18:07:24 +08:00
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
const modelId = row.modelId || this.ids
|
|
|
|
|
getModel(modelId).then(response => {
|
|
|
|
|
this.form = response.data;
|
2024-09-10 10:25:06 +08:00
|
|
|
|
this.form.ruleIds = response.ruleIds
|
2024-05-20 18:07:24 +08:00
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改车辆型号";
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
2024-09-14 13:48:49 +08:00
|
|
|
|
if (this.form.lowBatteryReminderSwitch === undefined || this.form.lowBatteryReminderSwitch === null) {
|
|
|
|
|
this.form.lowBatteryReminderSwitch = false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-20 18:07:24 +08:00
|
|
|
|
if (this.form.modelId != null) {
|
|
|
|
|
updateModel(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
addModel(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
const modelIds = row.modelId || this.ids;
|
|
|
|
|
this.$modal.confirm('是否确认删除车辆型号编号为"' + modelIds + '"的数据项?').then(function() {
|
|
|
|
|
return delModel(modelIds);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
handleExport() {
|
|
|
|
|
this.download('system/model/export', {
|
|
|
|
|
...this.queryParams
|
|
|
|
|
}, `model_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|