405 lines
10 KiB
Vue
405 lines
10 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-form
|
|
:model="queryParams"
|
|
ref="queryRef"
|
|
:inline="true"
|
|
v-show="showSearch"
|
|
>
|
|
<el-row>
|
|
<el-form-item class="search" label="监控名称" prop="videoId">
|
|
<el-select
|
|
v-model="queryParams.videoId"
|
|
placeholder="监控名称"
|
|
clearable
|
|
style="width: 200px;"
|
|
>
|
|
<el-option
|
|
v-for="dict in jkList"
|
|
:key="dict.id"
|
|
:label="dict.name"
|
|
:value="dict.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-row>
|
|
<el-row class="dfjb">
|
|
<el-row :gutter="10">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
@click="handleAdd"
|
|
class="circle-plus-btn"
|
|
>
|
|
新增
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="success"
|
|
plain
|
|
icon="Edit"
|
|
:disabled="single"
|
|
@click="handleUpdate"
|
|
>修改</el-button
|
|
>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="Delete"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
>删除</el-button
|
|
>
|
|
</el-col>
|
|
<!-- <el-col :span="1.5">
|
|
<el-button
|
|
type="warning"
|
|
plain
|
|
icon="Download"
|
|
@click="handleExport"
|
|
v-hasPermi="['large:data:export']"
|
|
>导出</el-button
|
|
>
|
|
</el-col> -->
|
|
</el-row>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
|
>搜索</el-button
|
|
>
|
|
<el-button icon="RefreshLeft" class="Refresh" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</el-row>
|
|
</el-form>
|
|
|
|
|
|
|
|
<div class="tablebox">
|
|
<el-table
|
|
v-loading="loading"
|
|
stripe
|
|
:data="dataList"
|
|
@selection-change="handleSelectionChange"
|
|
>
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<!-- <el-table-column label="id" align="center" prop="id" /> -->
|
|
<el-table-column label="监控名称" align="center" prop="videoName" />
|
|
<el-table-column
|
|
label="获取时间"
|
|
align="center"
|
|
prop="acquisitionTime"
|
|
/>
|
|
<el-table-column label="人数" align="center" prop="numberPeople" />
|
|
<el-table-column label="是否出现异常" align="center" prop="isAbnormal">
|
|
<template #default="scope">
|
|
<dict-tag :options="sys_yes_no" :value="scope.row.isAbnormal" />
|
|
</template>
|
|
</el-table-column>
|
|
<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)"
|
|
>修改</el-button
|
|
>
|
|
<el-button
|
|
link
|
|
type="primary"
|
|
icon="Delete"
|
|
@click="handleDelete(scope.row)"
|
|
>删除</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>
|
|
|
|
<!-- 添加或修改大客流视频数据获取对话框 -->
|
|
<el-dialog
|
|
:style="{ height: '420px' }"
|
|
:title="title"
|
|
v-model="open"
|
|
width="680px"
|
|
append-to-body
|
|
>
|
|
<el-form
|
|
label-position="top"
|
|
ref="dataRef"
|
|
:model="form"
|
|
:rules="rules"
|
|
label-width="120px"
|
|
>
|
|
<el-form-item label="监控名称" prop="videoId">
|
|
<el-select
|
|
v-model="form.videoId"
|
|
placeholder="监控名称"
|
|
clearable
|
|
style="width: 100%"
|
|
>
|
|
<el-option
|
|
v-for="dict in jkList"
|
|
:key="dict.id"
|
|
:label="dict.name"
|
|
:value="dict.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="获取时间" prop="acquisitionTime">
|
|
<el-date-picker
|
|
style="width: 100%"
|
|
v-model="form.acquisitionTime"
|
|
type="datetime"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
placeholder="请选择获取时间"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="人数" prop="numberPeople">
|
|
<el-input v-model="form.numberPeople" placeholder="请输入人数" />
|
|
</el-form-item>
|
|
<el-form-item label="是否出现异常" prop="isAbnormal">
|
|
<el-select
|
|
v-model="form.isAbnormal"
|
|
placeholder="是否出现异常"
|
|
clearable
|
|
style="width: 100%"
|
|
>
|
|
<el-option
|
|
v-for="dict in sys_yes_no"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
<!-- <el-input v-model="form.isAbnormal" placeholder="请输入区域" /> -->
|
|
</el-form-item>
|
|
</el-form>
|
|
<template #footer>
|
|
<div class="dialog-footer">
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup name="Data">
|
|
import {
|
|
listData,
|
|
getData,
|
|
delData,
|
|
addData,
|
|
updateData,
|
|
getjkList,
|
|
} from "@/api/videoData.js";
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
const { sys_yes_no } = proxy.useDict("sys_yes_no");
|
|
|
|
const dataList = ref([]);
|
|
const open = ref(false);
|
|
const loading = ref(true);
|
|
const showSearch = ref(true);
|
|
const ids = ref([]);
|
|
const single = ref(true);
|
|
const multiple = ref(true);
|
|
const total = ref(0);
|
|
const title = ref("");
|
|
const jkList = ref([]);
|
|
const data = reactive({
|
|
form: {},
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
videoId: null,
|
|
delFlag: 0,
|
|
},
|
|
rules: {
|
|
videoId: [{ required: true, message: "监控编号不能为空", trigger: "blur" }],
|
|
acquisitionTime: [
|
|
{ required: true, message: "请选择获取时间", trigger: "change" },
|
|
],
|
|
numberPeople: [
|
|
{ required: true, message: "人数不能为空", trigger: "blur" },
|
|
{
|
|
pattern: /^[1-9]\d*$/,
|
|
message: "请输入正整数",
|
|
trigger: "blur",
|
|
},
|
|
{
|
|
validator: (rule, value, callback) => {
|
|
if (value > 10000) {
|
|
callback(new Error("人数不能超过10000"));
|
|
} else {
|
|
callback();
|
|
}
|
|
},
|
|
trigger: "blur",
|
|
},
|
|
],
|
|
isAbnormal: [
|
|
{ required: true, message: "请选择是否出现异常", trigger: "change" },
|
|
],
|
|
},
|
|
});
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
/** 查询大客流视频数据获取列表 */
|
|
function getList() {
|
|
loading.value = true;
|
|
listData(queryParams.value).then((response) => {
|
|
dataList.value = response.rows;
|
|
total.value = response.total;
|
|
loading.value = false;
|
|
});
|
|
}
|
|
|
|
// 取消按钮
|
|
function cancel() {
|
|
open.value = false;
|
|
reset();
|
|
}
|
|
|
|
// 表单重置
|
|
function reset() {
|
|
form.value = {
|
|
id: null,
|
|
videoId: null,
|
|
acquisitionTime: null,
|
|
numberPeople: null,
|
|
isAbnormal: null,
|
|
createBy: null,
|
|
createTime: null,
|
|
updateBy: null,
|
|
updateTime: null,
|
|
delFlag: null,
|
|
originalData: null,
|
|
deptId: null,
|
|
};
|
|
proxy.resetForm("dataRef");
|
|
}
|
|
|
|
/** 搜索按钮操作 */
|
|
function handleQuery() {
|
|
queryParams.value.pageNum = 1;
|
|
getList();
|
|
}
|
|
|
|
/** 重置按钮操作 */
|
|
function resetQuery() {
|
|
proxy.resetForm("queryRef");
|
|
handleQuery();
|
|
}
|
|
|
|
// 多选框选中数据
|
|
function handleSelectionChange(selection) {
|
|
console.log(selection);
|
|
|
|
ids.value = selection.map((item) => item.id);
|
|
single.value = selection.length != 1;
|
|
multiple.value = !selection.length;
|
|
}
|
|
|
|
/** 新增按钮操作 */
|
|
function handleAdd() {
|
|
reset();
|
|
open.value = true;
|
|
title.value = "添加大客流视频数据获取";
|
|
}
|
|
|
|
/** 修改按钮操作 */
|
|
function handleUpdate(row) {
|
|
reset();
|
|
const _id = row.id || ids.value;
|
|
getData(_id).then((response) => {
|
|
form.value = response.data;
|
|
open.value = true;
|
|
title.value = "修改大客流视频数据获取";
|
|
});
|
|
}
|
|
|
|
/** 提交按钮 */
|
|
function submitForm() {
|
|
proxy.$refs["dataRef"].validate((valid) => {
|
|
if (valid) {
|
|
if (form.value.id != null) {
|
|
updateData(form.value).then((response) => {
|
|
proxy.$modal.msgSuccess("修改成功");
|
|
open.value = false;
|
|
getList();
|
|
});
|
|
} else {
|
|
addData(form.value).then((response) => {
|
|
proxy.$modal.msgSuccess("新增成功");
|
|
open.value = false;
|
|
getList();
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/** 删除按钮操作 */
|
|
function handleDelete(row) {
|
|
const _ids = row.id || ids.value;
|
|
proxy.$modal
|
|
.confirm("是否确认删除所选数据项?")
|
|
.then(function () {
|
|
return delData(_ids);
|
|
})
|
|
.then(() => {
|
|
getList();
|
|
proxy.$modal.msgSuccess("删除成功");
|
|
})
|
|
.catch(() => {});
|
|
}
|
|
|
|
/** 导出按钮操作 */
|
|
function handleExport() {
|
|
proxy.download(
|
|
"large/data/export",
|
|
{
|
|
...queryParams.value,
|
|
},
|
|
`data_${new Date().getTime()}.xlsx`
|
|
);
|
|
}
|
|
function getjkLists() {
|
|
getjkList().then((res) => {
|
|
jkList.value = res.rows;
|
|
});
|
|
}
|
|
onMounted(() => {
|
|
getList();
|
|
getjkLists();
|
|
});
|
|
</script>
|
|
<style scoped>
|
|
.map {
|
|
cursor: pointer;
|
|
color: #203f73;
|
|
}
|
|
/* 修改斑马纹的浅色行背景 */
|
|
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
|
|
background-color: #dbe4f5 !important; /* 改为淡蓝色 */
|
|
}
|
|
</style>
|
|
|