2025-03-21 17:47:58 +08:00
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
<el-form-item label="SN" prop="sn">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.sn"
|
|
|
|
placeholder="请输入设备SN号"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="MAC" prop="mac">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.mac"
|
|
|
|
placeholder="请输入MAC号"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="设备名称" prop="deviceName">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.deviceName"
|
|
|
|
placeholder="请输入设备名称"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="型号" prop="modelName">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.modelName"
|
|
|
|
placeholder="请输入型号名称"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="车牌号" prop="vehicleNum">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.vehicleNum"
|
|
|
|
placeholder="请输入车牌号"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="运营区" prop="areaId">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.areaName"
|
|
|
|
placeholder="请输入运营区名称"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="在线状态" prop="onlineStatus">
|
|
|
|
<el-select v-model="queryParams.onlineStatus" placeholder="请选择在线状态" clearable @change="handleQuery">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dict.type.device_online_status"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="车辆状态" prop="status">
|
|
|
|
<el-select v-model="queryParams.status" placeholder="请选择车辆状态" clearable @change="handleQuery">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dict.type.device_status"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="锁状态" prop="lockStatus">
|
|
|
|
<el-select v-model="queryParams.lockStatus" placeholder="请选择锁状态" clearable @change="handleQuery">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dict.type.device_lock_status"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="运营商" prop="mchName">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.mchName"
|
|
|
|
placeholder="请输入运营商"
|
|
|
|
clearable
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="物联网状态" prop="iotStatus" label-width="6em">
|
|
|
|
<el-select v-model="queryParams.iotStatus" placeholder="请选择物联网状态" clearable @change="handleQuery">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dict.type.device_iot_status"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</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-has-permi="['bst:device:add']"
|
|
|
|
>新增</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-has-permi="['bst:device:remove']"
|
|
|
|
>删除</el-button>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="warning"
|
|
|
|
plain
|
|
|
|
icon="el-icon-download"
|
|
|
|
size="mini"
|
|
|
|
@click="handleExport"
|
|
|
|
v-has-permi="['bst:device:export']"
|
|
|
|
>导出</el-button>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="primary"
|
|
|
|
plain
|
|
|
|
icon="el-icon-upload"
|
|
|
|
size="mini"
|
2025-04-11 15:35:32 +08:00
|
|
|
@click="handleOut(null)"
|
2025-03-21 17:47:58 +08:00
|
|
|
:disabled="multiple"
|
|
|
|
v-has-permi="['bst:device:out']"
|
|
|
|
>一键出仓</el-button>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="primary"
|
|
|
|
plain
|
|
|
|
icon="el-icon-download"
|
|
|
|
size="mini"
|
2025-04-11 15:35:32 +08:00
|
|
|
@click="handleIn(null)"
|
2025-03-21 17:47:58 +08:00
|
|
|
:disabled="multiple"
|
|
|
|
v-has-permi="['bst:device:in']"
|
|
|
|
>一键入仓</el-button>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="danger"
|
|
|
|
plain
|
|
|
|
icon="el-icon-close"
|
|
|
|
size="mini"
|
2025-04-11 15:35:32 +08:00
|
|
|
@click="handleDisable(null)"
|
2025-03-21 17:47:58 +08:00
|
|
|
:disabled="multiple"
|
|
|
|
v-has-permi="['bst:device:disable']"
|
|
|
|
>一键禁用</el-button>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="success"
|
|
|
|
plain
|
|
|
|
icon="el-icon-check"
|
|
|
|
size="mini"
|
2025-04-11 15:35:32 +08:00
|
|
|
@click="handleEnable(null)"
|
2025-03-21 17:47:58 +08:00
|
|
|
:disabled="multiple"
|
|
|
|
v-has-permi="['bst:device:enable']"
|
|
|
|
>一键启用</el-button>
|
|
|
|
</el-col>
|
2025-04-10 14:07:21 +08:00
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="warning"
|
|
|
|
plain
|
|
|
|
icon="el-icon-sort"
|
|
|
|
size="mini"
|
2025-04-11 15:35:32 +08:00
|
|
|
@click="handleTransfer(null)"
|
2025-04-10 14:07:21 +08:00
|
|
|
:disabled="multiple"
|
|
|
|
v-has-permi="['bst:device:transfer']"
|
|
|
|
>一键划拨</el-button>
|
|
|
|
</el-col>
|
2025-03-21 17:47:58 +08:00
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList(true)" :columns="columns"></right-toolbar>
|
|
|
|
</el-row>
|
|
|
|
|
2025-03-29 18:07:17 +08:00
|
|
|
<el-table size="mini" v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
|
2025-03-21 17:47:58 +08:00
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
<template v-for="column of showColumns">
|
|
|
|
<el-table-column
|
|
|
|
:key="column.key"
|
|
|
|
:label="column.label"
|
|
|
|
:prop="column.key"
|
|
|
|
:align="column.align"
|
|
|
|
:min-width="column.minWidth"
|
|
|
|
:sort-orders="orderSorts"
|
|
|
|
:sortable="column.sortable"
|
|
|
|
:show-overflow-tooltip="column.overflow"
|
|
|
|
:width="column.width"
|
|
|
|
>
|
|
|
|
<template slot-scope="d">
|
|
|
|
<template v-if="column.key === 'id'">
|
|
|
|
{{d.row[column.key]}}
|
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'sn'">
|
|
|
|
{{d.row.sn | dv}}
|
2025-03-29 18:07:17 +08:00
|
|
|
| {{d.row.mac | dv}}<br/>
|
2025-03-21 17:47:58 +08:00
|
|
|
<dict-tag :options="dict.type.device_online_status" :value="d.row.onlineStatus" size="mini"/>
|
|
|
|
<dict-tag :options="dict.type.device_status" :value="d.row.status" size="mini" style="margin-left: 4px;"/>
|
2025-03-29 18:07:17 +08:00
|
|
|
<dict-tag :options="dict.type.device_iot_status" :value="d.row.iotStatus" size="mini" style="margin-left: 4px;"/>
|
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'mchName'">
|
|
|
|
{{d.row.mchName | dv}}<br/>
|
|
|
|
{{d.row.areaName | dv}}
|
2025-03-21 17:47:58 +08:00
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'lockStatus'">
|
2025-04-10 14:07:21 +08:00
|
|
|
<el-tooltip content="开锁:共享模块有开锁的信号输出;电门开:车子处于开锁可骑行状态" placement="top">
|
2025-04-02 21:02:39 +08:00
|
|
|
<div>
|
|
|
|
<dict-tag :options="dict.type.device_lock_status" :value="d.row.lockStatus" size="mini"/><br/>
|
|
|
|
<dict-tag :options="dict.type.device_quality" :value="d.row.quality" size="mini"/>
|
|
|
|
</div>
|
|
|
|
</el-tooltip>
|
2025-03-21 17:47:58 +08:00
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'iotStatus'">
|
|
|
|
<dict-tag :options="dict.type.device_iot_status" :value="d.row[column.key]" size="mini"/>
|
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'remainingPower'">
|
2025-03-29 18:07:17 +08:00
|
|
|
{{d.row.remainingPower | fix2 | dv}} % <br/>
|
|
|
|
{{d.row.remainEndurance | dv}} KM
|
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'vehicleNum'">
|
|
|
|
{{d.row.vehicleNum | dv}}<br/>
|
|
|
|
{{d.row.modelName | dv}}
|
2025-03-21 17:47:58 +08:00
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'voltage'">
|
|
|
|
{{d.row.voltage | fix2 | dv}} V
|
|
|
|
</template>
|
|
|
|
<template v-else-if="column.key === 'isSound'">
|
|
|
|
<boolean-tag :value="d.row[column.key]" size="mini" true-text="有声" false-text="静音"/>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
{{d.row[column.key]}}
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</template>
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300">
|
|
|
|
<template slot-scope="scope">
|
2025-04-02 21:02:39 +08:00
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-view"
|
|
|
|
@click="handleView(scope.row)"
|
|
|
|
v-has-permi="['bst:device:query']"
|
|
|
|
>详情</el-button>
|
2025-03-21 17:47:58 +08:00
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-edit"
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
v-has-permi="['bst:device:edit']"
|
|
|
|
>修改</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-upload"
|
|
|
|
@click="handleOut(scope.row)"
|
|
|
|
v-has-permi="['bst:device:out']"
|
|
|
|
v-show="DeviceStatus.canOut().includes(scope.row.status)"
|
|
|
|
>出仓</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-download"
|
|
|
|
@click="handleIn(scope.row)"
|
|
|
|
v-has-permi="['bst:device:in']"
|
|
|
|
v-show="DeviceStatus.canIn().includes(scope.row.status)"
|
|
|
|
>入仓</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-close"
|
|
|
|
@click="handleDisable(scope.row)"
|
|
|
|
v-has-permi="['bst:device:disable']"
|
|
|
|
v-show="DeviceStatus.canDisable().includes(scope.row.status)"
|
|
|
|
>禁用</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-check"
|
|
|
|
@click="handleEnable(scope.row)"
|
|
|
|
v-has-permi="['bst:device:enable']"
|
|
|
|
v-show="DeviceStatus.canEnable().includes(scope.row.status)"
|
|
|
|
>启用</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-unlock"
|
|
|
|
@click="handleUnlock(scope.row)"
|
|
|
|
v-has-permi="['bst:device:unlock']"
|
2025-03-27 18:04:06 +08:00
|
|
|
v-show="canUnlock(scope.row)"
|
2025-03-21 17:47:58 +08:00
|
|
|
>开锁</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-lock"
|
|
|
|
@click="handleLock(scope.row)"
|
|
|
|
v-has-permi="['bst:device:lock']"
|
2025-04-10 14:07:21 +08:00
|
|
|
v-show="canAdminLock(scope.row)"
|
2025-03-21 17:47:58 +08:00
|
|
|
>锁车</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-bell"
|
|
|
|
@click="handleRing(scope.row)"
|
|
|
|
v-has-permi="['bst:device:ring']"
|
|
|
|
>响铃</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-refresh"
|
|
|
|
@click="handleReboot(scope.row)"
|
|
|
|
v-has-permi="['bst:device:reboot']"
|
|
|
|
>重启</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-unlock"
|
|
|
|
@click="handleUnlockSeat(scope.row)"
|
|
|
|
v-has-permi="['bst:device:unlockSeat']"
|
|
|
|
>开坐垫锁</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-refresh"
|
|
|
|
@click="handleRefresh(scope.row)"
|
|
|
|
v-has-permi="['bst:device:refresh']"
|
|
|
|
>刷新</el-button>
|
2025-04-10 14:07:21 +08:00
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-sort"
|
|
|
|
@click="handleTransfer(scope.row)"
|
|
|
|
v-has-permi="['bst:device:transfer']"
|
|
|
|
>划拨</el-button>
|
2025-03-21 17:47:58 +08:00
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
type="text"
|
|
|
|
icon="el-icon-delete"
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
v-has-permi="['bst:device: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(true)"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- 添加或修改设备对话框 -->
|
|
|
|
<device-edit-dialog
|
|
|
|
:visible.sync="open"
|
|
|
|
:id="editId"
|
|
|
|
@success="getList(true)"
|
|
|
|
/>
|
2025-04-10 14:07:21 +08:00
|
|
|
|
|
|
|
<device-transfer-dialog
|
|
|
|
:visible.sync="showTransferDialog"
|
|
|
|
:ids="transferIds"
|
|
|
|
@success="getList(true)"
|
|
|
|
/>
|
2025-03-21 17:47:58 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { listDevice, delDevice, inDevice, outDevice, disableDevice, enableDevice} from "@/api/bst/device";
|
|
|
|
import { unlockDevice, lockDevice, ringDevice, rebootDevice, unlockSeatDevice, refreshDevice} from "@/api/bst/deviceIot";
|
|
|
|
import { $showColumns } from '@/utils/mixins';
|
|
|
|
import FormCol from "@/components/FormCol/index.vue";
|
|
|
|
import DeviceEditDialog from './components/DeviceEditDialog.vue';
|
|
|
|
import BooleanTag from '@/components/BooleanTag/index.vue';
|
|
|
|
import { DeviceStatus } from '@/utils/enums';
|
2025-03-27 18:04:06 +08:00
|
|
|
import { $device } from '@/views/bst/device/mixins';
|
2025-04-10 14:07:21 +08:00
|
|
|
import DeviceTransferDialog from '@/views/bst/device/components/DeviceTransferDialog.vue';
|
2025-03-21 17:47:58 +08:00
|
|
|
|
|
|
|
// 默认排序字段
|
|
|
|
const defaultSort = {
|
|
|
|
prop: "createTime",
|
|
|
|
order: "descending"
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "Device",
|
2025-03-27 18:04:06 +08:00
|
|
|
mixins: [$showColumns, $device],
|
2025-03-21 17:47:58 +08:00
|
|
|
dicts: ['device_status', 'device_lock_status', 'device_iot_status', 'device_online_status', 'device_quality'],
|
2025-04-10 14:07:21 +08:00
|
|
|
components: {FormCol, DeviceEditDialog, BooleanTag, DeviceTransferDialog},
|
|
|
|
props: {
|
|
|
|
query: {
|
|
|
|
type: Object,
|
|
|
|
default: () => ({})
|
|
|
|
}
|
|
|
|
},
|
2025-03-21 17:47:58 +08:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
DeviceStatus,
|
|
|
|
span: 24,
|
|
|
|
// 字段列表
|
|
|
|
columns: [
|
|
|
|
{key: 'id', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
2025-04-10 19:56:40 +08:00
|
|
|
{key: 'sn', visible: true, label: '设备', minWidth: null, sortable: true, overflow: false, align: 'left', width: "220"},
|
2025-03-29 18:07:17 +08:00
|
|
|
{key: 'vehicleNum', visible: true, label: '车辆', minWidth: null, sortable: true, overflow: false, align: 'left', width: null},
|
|
|
|
{key: 'mchName', visible: true, label: '归属', minWidth: null, sortable: true, overflow: false, align: 'left', width: null},
|
2025-04-11 18:08:36 +08:00
|
|
|
{key: 'hardwareVersion', visible: true, label: '版本', minWidth: null, sortable: true, overflow: false, align: 'left', width: null},
|
2025-03-21 17:47:58 +08:00
|
|
|
{key: 'signalStrength', visible: true, label: '信号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
|
|
|
{key: 'satellites', visible: true, label: '卫星', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
2025-04-02 21:02:39 +08:00
|
|
|
{key: 'lockStatus', visible: true, label: '锁状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
2025-03-21 17:47:58 +08:00
|
|
|
{key: 'voltage', visible: true, label: '电压', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
2025-03-29 18:07:17 +08:00
|
|
|
{key: 'remainingPower', visible: true, label: '续航', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
2025-03-21 17:47:58 +08:00
|
|
|
{key: 'isSound', visible: true, label: '声音', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
|
|
|
{key: 'remark', visible: true, label: '备注', minWidth: null, sortable: true, overflow: true, align: 'center', width: null},
|
2025-03-29 18:07:17 +08:00
|
|
|
{key: 'orderNo', visible: true, label: '订单', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
|
|
|
{key: 'createTime', visible: true, label: '创建', minWidth: null, sortable: true, overflow: false, align: 'center', width: "90"},
|
2025-03-21 17:47:58 +08:00
|
|
|
],
|
|
|
|
// 排序方式
|
|
|
|
orderSorts: ['ascending', 'descending', null],
|
|
|
|
// 遮罩层
|
|
|
|
loading: true,
|
|
|
|
// 选中数组
|
|
|
|
ids: [],
|
|
|
|
// 非单个禁用
|
|
|
|
single: true,
|
|
|
|
// 非多个禁用
|
|
|
|
multiple: true,
|
|
|
|
// 显示搜索条件
|
|
|
|
showSearch: true,
|
|
|
|
// 总条数
|
|
|
|
total: 0,
|
|
|
|
// 设备表格数据
|
|
|
|
deviceList: [],
|
|
|
|
// 是否显示弹出层
|
|
|
|
open: false,
|
|
|
|
// 编辑ID
|
|
|
|
editId: null,
|
|
|
|
defaultSort,
|
|
|
|
// 查询参数
|
|
|
|
queryParams: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 20,
|
|
|
|
orderByColumn: defaultSort.prop,
|
|
|
|
isAsc: defaultSort.order,
|
|
|
|
refresh: true,
|
|
|
|
id: null,
|
|
|
|
modelId: null,
|
|
|
|
deviceName: null,
|
|
|
|
mac: null,
|
|
|
|
sn: null,
|
|
|
|
vehicleNum: null,
|
|
|
|
areaId: null,
|
|
|
|
onlineStatus: null,
|
|
|
|
remark: null,
|
|
|
|
status: null,
|
|
|
|
lockStatus: null,
|
|
|
|
location: null,
|
|
|
|
gps: null,
|
|
|
|
lastLocationTime: null,
|
|
|
|
hardwareVersionId: null,
|
|
|
|
mchId: null,
|
|
|
|
iotStatus: null,
|
|
|
|
isSound: null
|
|
|
|
},
|
|
|
|
// 表单参数
|
|
|
|
form: {},
|
|
|
|
// 表单校验
|
|
|
|
rules: {
|
|
|
|
modelId: [
|
|
|
|
{ required: true, message: "型号id不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
mac: [
|
|
|
|
{ required: true, message: "设备Mac号不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
sn: [
|
|
|
|
{ required: true, message: "设备SN号不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
createTime: [
|
|
|
|
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
|
|
|
],
|
2025-04-10 14:07:21 +08:00
|
|
|
},
|
|
|
|
showTransferDialog: false,
|
|
|
|
transferIds: [],
|
2025-03-21 17:47:58 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
2025-04-10 14:07:21 +08:00
|
|
|
Object.assign(this.queryParams, this.query);
|
2025-03-21 17:47:58 +08:00
|
|
|
this.getList(true);
|
|
|
|
},
|
|
|
|
methods: {
|
2025-04-10 14:07:21 +08:00
|
|
|
// 划拨运营区
|
|
|
|
handleTransfer(row) {
|
2025-04-11 15:35:32 +08:00
|
|
|
this.transferIds = this.ids;
|
2025-04-10 16:48:47 +08:00
|
|
|
if (row != null) {
|
2025-04-10 14:07:21 +08:00
|
|
|
this.transferIds = [row.id];
|
2025-04-11 15:35:32 +08:00
|
|
|
}
|
2025-04-10 14:07:21 +08:00
|
|
|
this.showTransferDialog = true;
|
|
|
|
},
|
2025-03-21 17:47:58 +08:00
|
|
|
// 管理员开锁
|
|
|
|
handleUnlock(row) {
|
|
|
|
this.$confirm('是否确认操作设备【' + row.sn + '】开锁?', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
unlockDevice({ id: row.id }).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,设备已开锁");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 管理员锁车
|
|
|
|
handleLock(row) {
|
|
|
|
this.$confirm('是否确认操作设备【' + row.sn + '】锁车?', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
lockDevice({ id: row.id }).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,设备已锁车");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 管理员响铃寻车
|
|
|
|
handleRing(row) {
|
|
|
|
this.$confirm('是否确认操作设备【' + row.sn + '】响铃寻车?', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
ringDevice({ id: row.id }).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,设备已响铃");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 管理员重启
|
|
|
|
handleReboot(row) {
|
|
|
|
this.$confirm('是否确认操作设备【' + row.sn + '】重启?', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
rebootDevice({ id: row.id }).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,设备已重启");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 管理员开坐垫锁
|
|
|
|
handleUnlockSeat(row) {
|
|
|
|
this.$confirm('是否确认操作设备【' + row.sn + '】开坐垫锁?', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
unlockSeatDevice({ id: row.id }).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,坐垫锁已开");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 管理员刷新
|
|
|
|
handleRefresh(row) {
|
|
|
|
this.$confirm('是否确认刷新设备【' + row.sn + '】?', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
refreshDevice({ id: row.id }).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,设备已刷新");
|
|
|
|
this.getList(false);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 一键入仓
|
|
|
|
handleOut(row) {
|
|
|
|
let msg = '是否确认一键出仓?';
|
|
|
|
let ids = this.ids;
|
|
|
|
if (row != null) {
|
|
|
|
ids = [row.id];
|
|
|
|
msg = '是否确认出仓设备【' + row.sn + '】?';
|
|
|
|
}
|
|
|
|
this.$confirm(msg, {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
outDevice(ids).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,共出仓" + res.data + "台设备");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 一键出仓
|
|
|
|
handleIn(row) {
|
|
|
|
let msg = '是否确认一键入仓?';
|
|
|
|
let ids = this.ids;
|
|
|
|
if (row != null) {
|
|
|
|
ids = [row.id];
|
|
|
|
msg = '是否确认入仓设备【' + row.sn + '】?';
|
|
|
|
}
|
|
|
|
this.$confirm(msg, {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
inDevice(ids).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,共入仓" + res.data + "台设备");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 一键禁用
|
|
|
|
handleDisable(row) {
|
|
|
|
let msg = '是否确认一键禁用?';
|
|
|
|
let ids = this.ids;
|
|
|
|
if (row != null) {
|
|
|
|
ids = [row.id];
|
|
|
|
msg = '是否确认禁用设备【' + row.sn + '】?';
|
|
|
|
}
|
|
|
|
this.$confirm(msg, {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
disableDevice(ids).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,共禁用" + res.data + "台设备");
|
|
|
|
this.getList(true);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 一键启用
|
|
|
|
handleEnable(row) {
|
|
|
|
let msg = '是否确认一键启用?';
|
|
|
|
let ids = this.ids;
|
|
|
|
if (row != null) {
|
|
|
|
ids = [row.id];
|
|
|
|
msg = '是否确认启用设备【' + row.sn + '】?';
|
|
|
|
}
|
|
|
|
this.$confirm(msg, {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
enableDevice(ids).then((res) => {
|
|
|
|
if (res.code === 200) {
|
|
|
|
this.$message.success("操作成功,共启用" + res.data + "台设备");
|
|
|
|
this.getList();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/** 当排序按钮被点击时触发 **/
|
|
|
|
onSortChange(column) {
|
|
|
|
if (column.order == null) {
|
|
|
|
this.queryParams.orderByColumn = defaultSort.prop;
|
|
|
|
this.queryParams.isAsc = defaultSort.order;
|
|
|
|
} else {
|
|
|
|
this.queryParams.orderByColumn = column.prop;
|
|
|
|
this.queryParams.isAsc = column.order;
|
|
|
|
}
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
/** 查询设备列表 */
|
|
|
|
getList(refresh = false) {
|
|
|
|
this.loading = true;
|
|
|
|
this.queryParams.refresh = refresh;
|
|
|
|
listDevice(this.queryParams).then(response => {
|
|
|
|
this.deviceList = response.rows;
|
|
|
|
this.total = response.total;
|
|
|
|
this.loading = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
handleQuery() {
|
|
|
|
this.queryParams.pageNum = 1;
|
|
|
|
this.getList(true);
|
|
|
|
},
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
resetQuery() {
|
|
|
|
this.resetForm("queryForm");
|
|
|
|
this.handleQuery();
|
|
|
|
},
|
|
|
|
// 多选框选中数据
|
|
|
|
handleSelectionChange(selection) {
|
|
|
|
this.ids = selection.map(item => item.id)
|
|
|
|
this.single = selection.length!==1
|
|
|
|
this.multiple = !selection.length
|
|
|
|
},
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
handleAdd() {
|
|
|
|
this.editId = null;
|
|
|
|
this.open = true;
|
|
|
|
},
|
2025-04-02 21:02:39 +08:00
|
|
|
/** 详情按钮操作 */
|
|
|
|
handleView(row) {
|
|
|
|
this.$router.push(`/view/device/${row.id}`);
|
|
|
|
},
|
2025-03-21 17:47:58 +08:00
|
|
|
/** 修改按钮操作 */
|
|
|
|
handleUpdate(row) {
|
|
|
|
this.editId = row.id || this.ids;
|
|
|
|
this.open = true;
|
|
|
|
},
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
handleDelete(row) {
|
|
|
|
const ids = row.id || this.ids;
|
|
|
|
this.$modal.confirm('是否确认删除设备编号为"' + ids + '"的数据项?').then(function() {
|
|
|
|
return delDevice(ids);
|
|
|
|
}).then(() => {
|
|
|
|
this.getList(true);
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
}).catch(() => {});
|
|
|
|
},
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
handleExport() {
|
|
|
|
this.download('bst/device/export', {
|
|
|
|
...this.queryParams
|
|
|
|
}, `device_${new Date().getTime()}.xlsx`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|