|
|
@@ -0,0 +1,362 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="仓库名称" prop="houseName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.houseName"
|
|
|
+ placeholder="请输入仓库名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备名称" prop="deviceName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.deviceName"
|
|
|
+ placeholder="请输入设备名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备编码" prop="deviceCode">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.deviceCode"
|
|
|
+ placeholder="请输入设备编码"
|
|
|
+ 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"
|
|
|
+ >新增
|
|
|
+ </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>
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="dbList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column label="仓库名称" align="center" prop="houseName"/>
|
|
|
+ <el-table-column label="设备编码" align="center" prop="deviceCode"/>
|
|
|
+ <el-table-column label="设备名称" align="center" prop="deviceName"/>
|
|
|
+ <el-table-column label="厂商" align="center" prop="manufacturer"/>
|
|
|
+ <el-table-column label="型号" align="center" prop="model"/>
|
|
|
+ <el-table-column label="状态" align="center" prop="status"/>
|
|
|
+ <el-table-column label="注册时间" align="center" prop="createTime" width="180">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
+ </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="VideoPlay" @click="handleSync(scope.row)">同步设备</el-button>
|
|
|
+ <el-button link type="primary" icon="VideoCamera" @click="handleChannel(scope.row)">通道详情</el-button>
|
|
|
+ <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"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改视频融合配置对话框 -->
|
|
|
+ <el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
|
|
+ <el-form ref="dbRef" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="仓库名称" prop="houseName">
|
|
|
+ <el-select v-model="form.houseName" placeholder="请选择仓库名称" clearable filterable
|
|
|
+ @change="handleHouseChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in houseConfigList"
|
|
|
+ :key="item.houseName"
|
|
|
+ :label="item.houseName"
|
|
|
+ :value="item.houseId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备编码" prop="deviceCode">
|
|
|
+ <el-input v-model="form.deviceCode" placeholder="请输入设备编码"/>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="设备名称" prop="deviceName">-->
|
|
|
+ <!-- <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- <el-form-item label="厂商" prop="manufacturer">-->
|
|
|
+ <!-- <el-input v-model="form.manufacturer" placeholder="请输入厂商"/>-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- <el-form-item label="型号" prop="model">-->
|
|
|
+ <!-- <el-input v-model="form.model" 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>
|
|
|
+
|
|
|
+ <!-- 仓库配置详情对话框 -->
|
|
|
+ <el-dialog :title="dialogTitle" v-model="houseConfigOpen" width="80%" append-to-body>
|
|
|
+ <iframe :src="dialogUrl" width="100%" height="600" frameborder="0"></iframe>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup name="Db">
|
|
|
+import {addDb, delDb, getDb, listDb, updateDb} from "@/api/biz/db";
|
|
|
+import {listHouseConfig} from "@/api/biz/houseConfig";
|
|
|
+import {sync} from "../../../api/biz/db.js";
|
|
|
+
|
|
|
+const {proxy} = getCurrentInstance();
|
|
|
+
|
|
|
+const dbList = 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 houseConfigList = ref(undefined);
|
|
|
+const data = reactive({
|
|
|
+ form: {},
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ houseId: null,
|
|
|
+ houseName: null,
|
|
|
+ houseCode: null,
|
|
|
+ deviceName: null,
|
|
|
+ deviceCode: null,
|
|
|
+ manufacturer: null,
|
|
|
+ model: null,
|
|
|
+ status: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ houseName: [
|
|
|
+ {required: true, message: "仓库名称不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ deviceCode: [
|
|
|
+ {required: true, message: "设备编码不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ dialogUrl: "",
|
|
|
+ dialogTitle: "",
|
|
|
+ houseConfigOpen: false,
|
|
|
+});
|
|
|
+
|
|
|
+const {queryParams, form, rules, dialogUrl, dialogTitle, houseConfigOpen} = toRefs(data);
|
|
|
+
|
|
|
+/** 查询仓库配置列表 */
|
|
|
+function getHouseList() {
|
|
|
+ listHouseConfig().then(response => {
|
|
|
+ houseConfigList.value = response.rows;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function handleHouseChange(value) {
|
|
|
+ if (value) {
|
|
|
+ // 查找选中的部门信息
|
|
|
+ const selectedDept = findDeptById(houseConfigList.value, value);
|
|
|
+ console.log(selectedDept)
|
|
|
+ if (selectedDept) {
|
|
|
+ form.value.houseId = selectedDept.houseId;
|
|
|
+ form.value.houseName = selectedDept.houseName;
|
|
|
+ form.value.houseCode = selectedDept.houseCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ form.value.houseId = '';
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/** 根据ID查找部门信息 */
|
|
|
+function findDeptById(deptList, id) {
|
|
|
+ if (!deptList || !id) return null;
|
|
|
+
|
|
|
+ for (let i = 0; i < deptList.length; i++) {
|
|
|
+ const dept = deptList[i];
|
|
|
+ if (dept.houseId === id) {
|
|
|
+ return dept;
|
|
|
+ }
|
|
|
+ if (dept.children && dept.children.length) {
|
|
|
+ const found = findDeptById(dept.children, id);
|
|
|
+ if (found) return found;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+}
|
|
|
+
|
|
|
+/** 查询视频融合配置列表 */
|
|
|
+function getList() {
|
|
|
+ loading.value = true;
|
|
|
+ listDb(queryParams.value).then(response => {
|
|
|
+ dbList.value = response.rows;
|
|
|
+ total.value = response.total;
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 取消按钮
|
|
|
+function cancel() {
|
|
|
+ open.value = false;
|
|
|
+ reset();
|
|
|
+}
|
|
|
+
|
|
|
+// 表单重置
|
|
|
+function reset() {
|
|
|
+ form.value = {
|
|
|
+ autoId: null,
|
|
|
+ houseId: null,
|
|
|
+ houseName: null,
|
|
|
+ houseCode: null,
|
|
|
+ deviceName: null,
|
|
|
+ deviceCode: null,
|
|
|
+ manufacturer: null,
|
|
|
+ model: null,
|
|
|
+ status: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ remark: null
|
|
|
+ };
|
|
|
+ proxy.resetForm("dbRef");
|
|
|
+}
|
|
|
+
|
|
|
+/** 搜索按钮操作 */
|
|
|
+function handleQuery() {
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
+ getList();
|
|
|
+}
|
|
|
+
|
|
|
+/** 重置按钮操作 */
|
|
|
+function resetQuery() {
|
|
|
+ proxy.resetForm("queryRef");
|
|
|
+ handleQuery();
|
|
|
+}
|
|
|
+
|
|
|
+// 多选框选中数据
|
|
|
+function handleSelectionChange(selection) {
|
|
|
+ ids.value = selection.map(item => item.autoId);
|
|
|
+ single.value = selection.length != 1;
|
|
|
+ multiple.value = !selection.length;
|
|
|
+}
|
|
|
+
|
|
|
+/** 新增按钮操作 */
|
|
|
+function handleAdd() {
|
|
|
+ reset();
|
|
|
+ open.value = true;
|
|
|
+ title.value = "添加视频融合配置";
|
|
|
+}
|
|
|
+
|
|
|
+/** 修改按钮操作 */
|
|
|
+function handleUpdate(row) {
|
|
|
+ reset();
|
|
|
+ const _autoId = row.autoId || ids.value
|
|
|
+ getDb(_autoId).then(response => {
|
|
|
+ form.value = response.data;
|
|
|
+ open.value = true;
|
|
|
+ title.value = "修改视频融合配置";
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 修改按钮操作 */
|
|
|
+function handleSync(row) {
|
|
|
+ const _autoId = row.autoId || ids.value
|
|
|
+ sync(_autoId).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("同步成功");
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 通道详情 */
|
|
|
+function handleChannel(row) {
|
|
|
+ // 使用dialog方式打开仓库配置页面
|
|
|
+ dialogUrl.value = "/device/channel?deviceCode=" + row.deviceCode;
|
|
|
+ dialogTitle.value = "通道详情";
|
|
|
+ houseConfigOpen.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+/** 提交按钮 */
|
|
|
+function submitForm() {
|
|
|
+ proxy.$refs["dbRef"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (form.value.autoId != null) {
|
|
|
+ updateDb(form.value).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("修改成功");
|
|
|
+ open.value = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addDb(form.value).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("新增成功");
|
|
|
+ open.value = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 删除按钮操作 */
|
|
|
+function handleDelete(row) {
|
|
|
+ const _autoIds = row.autoId || ids.value;
|
|
|
+ proxy.$modal.confirm('是否确认删除视频融合配置编号为"' + _autoIds + '"的数据项?').then(function () {
|
|
|
+ return delDb(_autoIds);
|
|
|
+ }).then(() => {
|
|
|
+ getList();
|
|
|
+ proxy.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 导出按钮操作 */
|
|
|
+function handleExport() {
|
|
|
+ proxy.download('biz/db/export', {
|
|
|
+ ...queryParams.value
|
|
|
+ }, `db_${new Date().getTime()}.xlsx`)
|
|
|
+}
|
|
|
+
|
|
|
+getHouseList();
|
|
|
+getList();
|
|
|
+</script>
|