255 lines
6.2 KiB
Vue
255 lines
6.2 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-form
|
|
:model="queryParams"
|
|
ref="queryRef"
|
|
:inline="true"
|
|
v-show="showSearch"
|
|
label-width="68px"
|
|
>
|
|
<el-form-item label="围栏名称" prop="fenceName">
|
|
<el-input
|
|
v-model="queryParams.fenceName"
|
|
placeholder="请输入围栏名称"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="限速(km/h)" prop="speed">
|
|
<el-input
|
|
v-model="queryParams.speed"
|
|
placeholder="请输入限速(km/h)"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="报警时段" prop="reportTime">
|
|
<el-input
|
|
v-model="queryParams.reportTime"
|
|
placeholder="请输入报警时段"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="租户ID(预留)" prop="tenantId">
|
|
<el-input
|
|
v-model="queryParams.tenantId"
|
|
placeholder="请输入租户ID(预留)"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
/>
|
|
</el-form-item> -->
|
|
<el-form-item>
|
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
|
>搜索</el-button
|
|
>
|
|
<el-button icon="Refresh" @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="Plus"
|
|
@click="handleAdd"
|
|
v-hasPermi="['car:fence:add']"
|
|
>新增</el-button
|
|
>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="Delete"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
v-hasPermi="['car:fence:remove']"
|
|
>删除</el-button
|
|
>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="warning"
|
|
plain
|
|
icon="Download"
|
|
@click="handleExport"
|
|
v-hasPermi="['car:fence:export']"
|
|
>导出</el-button
|
|
>
|
|
</el-col>
|
|
<right-toolbar
|
|
v-model:showSearch="showSearch"
|
|
@queryTable="getList"
|
|
></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table
|
|
v-loading="loading"
|
|
:data="fenceList"
|
|
@selection-change="handleSelectionChange"
|
|
>
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column label="围栏ID" align="center" prop="fenceId" />
|
|
<el-table-column label="围栏名称" align="center" prop="fenceName" />
|
|
<el-table-column label="限速(km/h)" align="center" prop="speed" />
|
|
<el-table-column
|
|
label="报警类型(0不1进2出3都)"
|
|
align="center"
|
|
prop="${field}"
|
|
>
|
|
<template #default="{ row }">
|
|
{{ reportTypeMap.get(row.reportType) ?? "未知" }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="报警时段" align="center" prop="reportTime" />
|
|
<!-- <el-table-column label="围栏地图数据" align="center" prop="fencePath" /> -->
|
|
<!-- <el-table-column label="租户ID(预留)" align="center" prop="tenantId" /> -->
|
|
<el-table-column
|
|
label="操作"
|
|
align="center"
|
|
class-name="small-padding fixed-width"
|
|
>
|
|
<template #default="scope">
|
|
<el-button
|
|
link
|
|
type="primary"
|
|
icon="Edit"
|
|
@click="handleUpdate(scope.row)"
|
|
v-hasPermi="['car:fence:edit']"
|
|
>修改</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total > 0"
|
|
:total="total"
|
|
v-model:page="queryParams.pageNum"
|
|
v-model:limit="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup name="Fence">
|
|
import { listFence, delFence } from "@/api/fence";
|
|
import { useRouter } from "vue-router";
|
|
|
|
const router = useRouter();
|
|
const { proxy } = getCurrentInstance();
|
|
const fenceList = ref([]);
|
|
const loading = ref(true);
|
|
const showSearch = ref(true);
|
|
const ids = ref([]);
|
|
const single = ref(true);
|
|
const multiple = ref(true);
|
|
const total = ref(0);
|
|
const reportTypeMap = new Map([
|
|
["0", "不报警"],
|
|
["1", "进入时"],
|
|
["2", "离开时"],
|
|
["3", "都报警"],
|
|
]);
|
|
const data = reactive({
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
fenceName: null,
|
|
speed: null,
|
|
reportType: null,
|
|
reportTime: null,
|
|
fencePath: null,
|
|
tenantId: null,
|
|
},
|
|
});
|
|
|
|
const { queryParams } = toRefs(data);
|
|
|
|
/** 查询电子围栏列表 */
|
|
function getList() {
|
|
loading.value = true;
|
|
listFence(queryParams.value).then((response) => {
|
|
fenceList.value = response.rows;
|
|
total.value = response.total;
|
|
loading.value = false;
|
|
});
|
|
}
|
|
|
|
/** 搜索按钮操作 */
|
|
function handleQuery() {
|
|
queryParams.value.pageNum = 1;
|
|
getList();
|
|
}
|
|
|
|
/** 重置按钮操作 */
|
|
function resetQuery() {
|
|
proxy.resetForm("queryRef");
|
|
handleQuery();
|
|
}
|
|
|
|
// 多选框选中数据
|
|
function handleSelectionChange(selection) {
|
|
ids.value = selection.map((item) => {
|
|
return { id: item.fenceId, uuid: item.uuid };
|
|
});
|
|
single.value = selection.length != 1;
|
|
multiple.value = !selection.length;
|
|
}
|
|
|
|
/** 新增按钮操作 */
|
|
function handleAdd() {
|
|
router.push({
|
|
path: "/basic/fence/add",
|
|
});
|
|
}
|
|
|
|
/** 修改按钮操作 */
|
|
function handleUpdate(row) {
|
|
const { fenceId, uuid } = row;
|
|
router.push({
|
|
path: "/basic/fence/add",
|
|
query: {
|
|
fenceId,
|
|
uuid,
|
|
},
|
|
});
|
|
}
|
|
|
|
/** 删除按钮操作 */
|
|
function handleDelete(row) {
|
|
const _fenceIds = row.fenceId
|
|
? [{ id: row.fenceId, uuid: row.uuid }]
|
|
: ids.value;
|
|
proxy.$modal
|
|
.confirm(
|
|
'是否确认删除电子围栏编号为"' +
|
|
_fenceIds.map((el) => el.fenceId).join(",") +
|
|
'"的数据项?'
|
|
)
|
|
.then(function () {
|
|
return delFence(_fenceIds);
|
|
})
|
|
.then(() => {
|
|
getList();
|
|
proxy.$modal.msgSuccess("删除成功");
|
|
})
|
|
.catch(() => {});
|
|
}
|
|
|
|
/** 导出按钮操作 */
|
|
function handleExport() {
|
|
proxy.download(
|
|
"car/fence/export",
|
|
{
|
|
...queryParams.value,
|
|
},
|
|
`fence_${new Date().getTime()}.xlsx`
|
|
);
|
|
}
|
|
|
|
getList();
|
|
</script>
|