|
|
@@ -2,30 +2,61 @@
|
|
|
<template>
|
|
|
<div class="p-2" style="padding: 10px">
|
|
|
<div style="display: flex; flex-direction: row">
|
|
|
- <div style="width: 20%;">
|
|
|
+ <div style="width: 20%">
|
|
|
<div class="card-header">
|
|
|
<div style="display: flex; flex-direction: row">
|
|
|
<div style="width: 4px; height: 19px; opacity: 1; background: #409eff"></div>
|
|
|
- <span style="
|
|
|
+ <span
|
|
|
+ style="
|
|
|
font-family: PingFang SC;
|
|
|
font-size: 14px;
|
|
|
font-weight: normal;
|
|
|
line-height: 19px;
|
|
|
height: 19px;
|
|
|
margin-left: 5px;
|
|
|
- ">站点列表</span>
|
|
|
+ "
|
|
|
+ >站点列表</span
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div style="margin-top: 20px; padding-left: 10px;">
|
|
|
- <el-select v-model="line" placeholder="请选择乡镇" style="width: 240px" @change="getCountrySites()">
|
|
|
- <el-option v-for="item in countryList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
+ <div style="margin-top: 20px; padding-left: 10px">
|
|
|
+ <el-select
|
|
|
+ v-model="line"
|
|
|
+ placeholder="请选择乡镇"
|
|
|
+ style="width: 240px"
|
|
|
+ @change="getCountrySites()"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in countryList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
- <el-input style="margin-top: 10px;" v-model="filterText" placeholder="输入关键字" />
|
|
|
- <el-tree-v2 v-if="showTree" style="margin-top: 10px;" ref="treeRef" class="filter-tree"
|
|
|
- :height="gettreeheight()" :data="data" :indent="treeIndent" :props="defaultProps"
|
|
|
- :filter-method="filterNode" @node-click="treeclick">
|
|
|
+ <el-input
|
|
|
+ style="margin-top: 10px"
|
|
|
+ v-model="filterText"
|
|
|
+ placeholder="输入关键字"
|
|
|
+ />
|
|
|
+ <el-tree-v2
|
|
|
+ v-if="showTree"
|
|
|
+ style="margin-top: 10px"
|
|
|
+ ref="treeRef"
|
|
|
+ class="filter-tree"
|
|
|
+ :height="gettreeheight()"
|
|
|
+ :data="data"
|
|
|
+ :indent="treeIndent"
|
|
|
+ :props="defaultProps"
|
|
|
+ :filter-method="filterNode"
|
|
|
+ @node-click="treeclick"
|
|
|
+ >
|
|
|
<template v-slot:default="{ node }">
|
|
|
- <element-tree-line :node="node" :treeData="data" :showLabelLine="false" :indent="treeIndent">
|
|
|
+ <element-tree-line
|
|
|
+ :node="node"
|
|
|
+ :treeData="data"
|
|
|
+ :showLabelLine="false"
|
|
|
+ :indent="treeIndent"
|
|
|
+ >
|
|
|
</element-tree-line>
|
|
|
</template>
|
|
|
</el-tree-v2>
|
|
|
@@ -33,30 +64,43 @@
|
|
|
</div>
|
|
|
<div style="width: 77%; margin-left: 2%">
|
|
|
<div class="card-header">
|
|
|
- <div style="display: flex; flex-direction: row;position: relative">
|
|
|
+ <div style="display: flex; flex-direction: row; position: relative">
|
|
|
<div style="width: 4px; height: 19px; opacity: 1; background: #409eff"></div>
|
|
|
- <span style="
|
|
|
+ <span
|
|
|
+ style="
|
|
|
font-family: PingFang SC;
|
|
|
font-size: 14px;
|
|
|
font-weight: normal;
|
|
|
line-height: 19px;
|
|
|
height: 19px;
|
|
|
margin-left: 5px;
|
|
|
- ">站点设备</span>
|
|
|
- <span style="margin-left: 30px; font-size: 14px">{{ currentdata?.label }}</span>
|
|
|
-
|
|
|
-
|
|
|
+ "
|
|
|
+ >站点设备</span
|
|
|
+ >
|
|
|
+ <span style="margin-left: 30px; font-size: 14px">{{
|
|
|
+ currentdata?.label
|
|
|
+ }}</span>
|
|
|
</div>
|
|
|
- <el-button v-if="tableData.length < 4" type="primary" style="position: absolute;right: 20px;"
|
|
|
- @click="goAdd">添加设备</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="tableData.length < 4"
|
|
|
+ type="primary"
|
|
|
+ style="position: absolute; right: 20px"
|
|
|
+ @click="goAdd"
|
|
|
+ >添加设备</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
<div style="margin-top: 20px">
|
|
|
<el-table :data="tableData" border style="width: 100%">
|
|
|
<el-table-column prop="name" label="设备名称" width="160">
|
|
|
<template #default="scope">
|
|
|
<div>
|
|
|
- <span>{{ scope.row.name }}</span> <el-tag style="margin-left: 40px;" type="success"
|
|
|
- v-if="scope.row.type == 'cabinet'">{{ '在线' }}</el-tag>
|
|
|
+ <span>{{ scope.row.name }}</span>
|
|
|
+ <el-tag
|
|
|
+ style="margin-left: 40px"
|
|
|
+ type="success"
|
|
|
+ v-if="scope.row.type == 'cabinet'"
|
|
|
+ >{{ "在线" }}</el-tag
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -68,24 +112,73 @@
|
|
|
v-if="scope.row.type == 'cabinet'">{{ `共 ${currentCabinet.total} 格` }}<span
|
|
|
style="margin-left: 5px;color:green">{{ `可用 ${currentCabinet.total - currentCabinet.unused} 格`
|
|
|
}}</span></span> -->
|
|
|
- <span style="margin-left: 20px;" v-if="scope.row.type == 'cabinet'">{{ getTypeName(scope.row)
|
|
|
- }}</span>
|
|
|
+ <span style="margin-left: 20px" v-if="scope.row.type == 'cabinet'">{{
|
|
|
+ getTypeName(scope.row)
|
|
|
+ }}</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="code" label="设备序列号">
|
|
|
<template #default="scope">
|
|
|
- <div style="display: flex;flex-wrap: nowrap;align-items: center;justify-content: space-between;">
|
|
|
- <el-input v-model="scope.row.code" style="width: 240px" placeholder="请输入" />
|
|
|
- <el-button type="primary" size="small" @click="savedata">保存</el-button>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.code"
|
|
|
+ style="width: 240px"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ <el-button type="primary" size="small" @click="savedata"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="wdcode" label="网点编号">
|
|
|
+ <template #default="scope">
|
|
|
+ <div
|
|
|
+ v-if="scope.row.type == 'cabinet'"
|
|
|
+ style="
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.wdcode"
|
|
|
+ style="width: 240px"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ <el-button type="primary" size="small" @click="savedata"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div v-else>--</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="code" label="操作">
|
|
|
<template #default="scope">
|
|
|
<div>
|
|
|
- <el-button type="danger" link size="small" @click="deleteDevice(scope.row)">删除</el-button>
|
|
|
- <el-button v-if="scope.row.type == 'cabinet'" type="primary" link size="small">立即同步</el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ link
|
|
|
+ size="small"
|
|
|
+ @click="deleteDevice(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.type == 'cabinet'"
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ size="small"
|
|
|
+ >立即同步</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -120,10 +213,26 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="类型">
|
|
|
<el-select v-model="formdata.type" placeholder="请选择设备类型">
|
|
|
- <el-option v-if="tableData.filter(i => i.type == 'tts').length < 1" label="tts" value="tts" />
|
|
|
- <el-option v-if="tableData.filter(i => i.type == 'led').length < 1" label="led" value="led" />
|
|
|
- <el-option v-if="tableData.filter(i => i.type == 'cabinet').length < 1" label="快递柜" value="cabinet" />
|
|
|
- <el-option v-if="tableData.filter(i => i.type == 'camera').length < 1" label="摄像头" value="camera" />
|
|
|
+ <el-option
|
|
|
+ v-if="tableData.filter((i) => i.type == 'tts').length < 1"
|
|
|
+ label="tts"
|
|
|
+ value="tts"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ v-if="tableData.filter((i) => i.type == 'led').length < 1"
|
|
|
+ label="led"
|
|
|
+ value="led"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ v-if="tableData.filter((i) => i.type == 'cabinet').length < 1"
|
|
|
+ label="快递柜"
|
|
|
+ value="cabinet"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ v-if="tableData.filter((i) => i.type == 'camera').length < 1"
|
|
|
+ label="摄像头"
|
|
|
+ value="camera"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="快递类型" v-if="formdata.type == 'cabinet'">
|
|
|
@@ -136,369 +245,377 @@
|
|
|
<el-form-item label="序列号">
|
|
|
<el-input v-model="formdata.code" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="网点编号">
|
|
|
+ <el-input v-model="formdata.wdcode" />
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="addDevice">
|
|
|
- 保存
|
|
|
- </el-button>
|
|
|
+ <el-button type="primary" @click="addDevice"> 保存 </el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
-
|
|
|
</el-dialog>
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="CarInfo" lang="ts">
|
|
|
- import { listCountry, getCountry, delCountry, addCountry, updateCountry } from '@/api/country';
|
|
|
- import { TreeNode } from "element-plus";
|
|
|
- import { useRoute, useRouter } from "vue-router";
|
|
|
- import EZUIKit from 'ezuikit-js';
|
|
|
- import { getCameraPlayerConfig } from '@/api/gpsData';
|
|
|
- import { listCarPath, getCarPath, delCarPath, addCarPath, updateCarPath } from '@/api/carPath';
|
|
|
- import { updateData, listData } from "@/api/system/dict/data";
|
|
|
- import imgulock from "@/assets/images/unlock@2x.png";
|
|
|
-
|
|
|
- const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
-
|
|
|
- const sites = ref([]);
|
|
|
-
|
|
|
- const showTree = ref(true)
|
|
|
-
|
|
|
-
|
|
|
- const formdata = ref({
|
|
|
+import {
|
|
|
+ listCountry,
|
|
|
+ getCountry,
|
|
|
+ delCountry,
|
|
|
+ addCountry,
|
|
|
+ updateCountry,
|
|
|
+} from "@/api/country";
|
|
|
+import { TreeNode } from "element-plus";
|
|
|
+import { useRoute, useRouter } from "vue-router";
|
|
|
+import EZUIKit from "ezuikit-js";
|
|
|
+import { getCameraPlayerConfig } from "@/api/gpsData";
|
|
|
+import {
|
|
|
+ listCarPath,
|
|
|
+ getCarPath,
|
|
|
+ delCarPath,
|
|
|
+ addCarPath,
|
|
|
+ updateCarPath,
|
|
|
+} from "@/api/carPath";
|
|
|
+import { updateData, listData } from "@/api/system/dict/data";
|
|
|
+import imgulock from "@/assets/images/unlock@2x.png";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
+
|
|
|
+const sites = ref([]);
|
|
|
+
|
|
|
+const showTree = ref(true);
|
|
|
+
|
|
|
+const formdata = ref({
|
|
|
+ name: "",
|
|
|
+ type: "",
|
|
|
+ code: "",
|
|
|
+ wdcode: "",
|
|
|
+ cabinetType: "",
|
|
|
+});
|
|
|
+
|
|
|
+const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
+
|
|
|
+const tableData = ref([]);
|
|
|
+const carPathList = ref([]);
|
|
|
+const countryList = ref([]);
|
|
|
+const line = ref([]);
|
|
|
+
|
|
|
+const activeName = ref("camera");
|
|
|
+
|
|
|
+const filterText = ref("");
|
|
|
+const treeRef = ref(null);
|
|
|
+const dialogVisible = ref(false);
|
|
|
+
|
|
|
+const gettreeheight = () => {
|
|
|
+ return document.body.clientHeight - 300;
|
|
|
+};
|
|
|
+
|
|
|
+const goAdd = () => {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ formdata.value = {
|
|
|
name: "",
|
|
|
type: "",
|
|
|
code: "",
|
|
|
- cabinetType: ''
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
- const route = useRoute();
|
|
|
- const router = useRouter();
|
|
|
-
|
|
|
- const tableData = ref([]);
|
|
|
- const carPathList = ref([]);
|
|
|
- const countryList = ref([])
|
|
|
- const line = ref([]);
|
|
|
-
|
|
|
- const activeName = ref("camera")
|
|
|
-
|
|
|
- const filterText = ref("");
|
|
|
- const treeRef = ref(null);
|
|
|
- const dialogVisible = ref(false);
|
|
|
-
|
|
|
- const gettreeheight = () => {
|
|
|
- return document.body.clientHeight - 300;
|
|
|
- }
|
|
|
-
|
|
|
- const goAdd = () => {
|
|
|
- dialogVisible.value = true
|
|
|
- formdata.value = {
|
|
|
- name: "",
|
|
|
- type: "",
|
|
|
- code: ""
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const getTypeName = (data) => {
|
|
|
- var type = data.cabinetType
|
|
|
- if (type == 1) {
|
|
|
- return '一主'
|
|
|
- } else if (type == 2) {
|
|
|
- return '一主一副'
|
|
|
- } else {
|
|
|
- return '一主二副'
|
|
|
- }
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
+const getTypeName = (data) => {
|
|
|
+ var type = data.cabinetType;
|
|
|
+ if (type == 1) {
|
|
|
+ return "一主";
|
|
|
+ } else if (type == 2) {
|
|
|
+ return "一主一副";
|
|
|
+ } else {
|
|
|
+ return "一主二副";
|
|
|
}
|
|
|
+};
|
|
|
|
|
|
- const initData = async () => {
|
|
|
- const res = await listCarPath({ pageSize: 1000 });
|
|
|
- carPathList.value = res.rows;
|
|
|
- }
|
|
|
+const initData = async () => {
|
|
|
+ const res = await listCarPath({ pageSize: 1000 });
|
|
|
+ carPathList.value = res.rows;
|
|
|
+};
|
|
|
|
|
|
- const getCountry = () => {
|
|
|
- listCountry({ pageSize: 10000 }).then(res => {
|
|
|
- console.log(res)
|
|
|
- countryList.value = res.rows
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- const getCountrySites = () => {
|
|
|
- for (var i in countryList.value) {
|
|
|
- if (line.value == countryList.value[i].id) {
|
|
|
- console.log(countryList.value[i].sites)
|
|
|
- var siteList = countryList.value[i].sites.split(",")
|
|
|
- var siteObjList = [];
|
|
|
- for (var j in sites.value) {
|
|
|
- if (siteList.indexOf(sites.value[j].dictCode) > -1) {
|
|
|
- siteObjList.push(sites.value[j])
|
|
|
- }
|
|
|
+const getCountry = () => {
|
|
|
+ listCountry({ pageSize: 10000 }).then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ countryList.value = res.rows;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const getCountrySites = () => {
|
|
|
+ for (var i in countryList.value) {
|
|
|
+ if (line.value == countryList.value[i].id) {
|
|
|
+ console.log(countryList.value[i].sites);
|
|
|
+ var siteList = countryList.value[i].sites.split(",");
|
|
|
+ var siteObjList = [];
|
|
|
+ for (var j in sites.value) {
|
|
|
+ if (siteList.indexOf(sites.value[j].dictCode) > -1) {
|
|
|
+ siteObjList.push(sites.value[j]);
|
|
|
}
|
|
|
- updateSites(siteObjList)
|
|
|
}
|
|
|
+ updateSites(siteObjList);
|
|
|
}
|
|
|
}
|
|
|
+};
|
|
|
|
|
|
- const updateSites = (sitesList) => {
|
|
|
- console.log(sitesList)
|
|
|
- var sites = []
|
|
|
- for (var i in sitesList) {
|
|
|
-
|
|
|
- sites.push({ id: i, label: sitesList[i].dictLabel })
|
|
|
- }
|
|
|
- console.log(sites)
|
|
|
- data.value = [{
|
|
|
+const updateSites = (sitesList) => {
|
|
|
+ console.log(sitesList);
|
|
|
+ var sites = [];
|
|
|
+ for (var i in sitesList) {
|
|
|
+ sites.push({ id: i, label: sitesList[i].dictLabel });
|
|
|
+ }
|
|
|
+ console.log(sites);
|
|
|
+ data.value = [
|
|
|
+ {
|
|
|
id: 1,
|
|
|
label: "站点",
|
|
|
- },];
|
|
|
- data.value[0].children = sites
|
|
|
- console.log(data.value)
|
|
|
- showTree.value = false;
|
|
|
- setTimeout(() => {
|
|
|
- showTree.value = true
|
|
|
- }, 100);
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ data.value[0].children = sites;
|
|
|
+ console.log(data.value);
|
|
|
+ showTree.value = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ showTree.value = true;
|
|
|
+ }, 100);
|
|
|
+};
|
|
|
+
|
|
|
+const defaultProps = {
|
|
|
+ children: "children",
|
|
|
+ label: "label",
|
|
|
+ value: "id",
|
|
|
+};
|
|
|
+const treeIndent = ref(40);
|
|
|
+
|
|
|
+watch(filterText, (val) => {
|
|
|
+ if (treeRef.value) {
|
|
|
+ treeRef.value.filter(val);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- const defaultProps = {
|
|
|
- children: "children",
|
|
|
- label: "label",
|
|
|
- value: 'id',
|
|
|
+});
|
|
|
+
|
|
|
+const savedata = () => {
|
|
|
+ //保存数据
|
|
|
+ var data = {
|
|
|
+ dictCode: currentdata.value.dictCode,
|
|
|
+ dictValue: currentdata.value.dictValue,
|
|
|
+ dictLabel: currentdata.value.dictLabel,
|
|
|
+ dictType: "tbl_sites",
|
|
|
+ remark: JSON.stringify(tableData.value),
|
|
|
};
|
|
|
- const treeIndent = ref(40);
|
|
|
-
|
|
|
- watch(filterText, (val) => {
|
|
|
- if (treeRef.value) {
|
|
|
- treeRef.value.filter(val);
|
|
|
- }
|
|
|
+ updateData(data).then((res) => {
|
|
|
+ ElMessage.success("成功!");
|
|
|
+ window.location.reload();
|
|
|
});
|
|
|
-
|
|
|
- const savedata = () => {
|
|
|
- //保存数据
|
|
|
- var data = {
|
|
|
- dictCode: currentdata.value.dictCode,
|
|
|
- dictValue: currentdata.value.dictValue,
|
|
|
- dictLabel: currentdata.value.dictLabel,
|
|
|
- dictType: "tbl_sites",
|
|
|
- remark: JSON.stringify(tableData.value)
|
|
|
+};
|
|
|
+
|
|
|
+const getLineSites = () => {
|
|
|
+ console.log(line.value);
|
|
|
+ var sitesList = [];
|
|
|
+ for (var index in carPathList.value) {
|
|
|
+ if (carPathList.value[index].id == line.value) {
|
|
|
+ sitesList = JSON.parse(carPathList.value[index].stationList);
|
|
|
}
|
|
|
- updateData(data).then(res => {
|
|
|
- ElMessage.success("成功!");
|
|
|
- getLineSites();
|
|
|
-
|
|
|
- })
|
|
|
}
|
|
|
-
|
|
|
- const getLineSites = () => {
|
|
|
- console.log(line.value)
|
|
|
- var sitesList = []
|
|
|
- for (var index in carPathList.value) {
|
|
|
- if (carPathList.value[index].id == line.value) {
|
|
|
- sitesList = JSON.parse(carPathList.value[index].stationList)
|
|
|
- }
|
|
|
- }
|
|
|
- var sites = []
|
|
|
- for (var i in sitesList) {
|
|
|
- sites.push({ id: i, label: sitesList[i].data.dictLabel })
|
|
|
- }
|
|
|
- console.log(sites)
|
|
|
- data.value = [{
|
|
|
+ var sites = [];
|
|
|
+ for (var i in sitesList) {
|
|
|
+ sites.push({ id: i, label: sitesList[i].data.dictLabel });
|
|
|
+ }
|
|
|
+ console.log(sites);
|
|
|
+ data.value = [
|
|
|
+ {
|
|
|
id: 1,
|
|
|
label: "站点",
|
|
|
- },];
|
|
|
- data.value[0].children = sites
|
|
|
- console.log(data.value)
|
|
|
- showTree.value = false;
|
|
|
- setTimeout(() => {
|
|
|
- showTree.value = true
|
|
|
- }, 100);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- const getSites = () => {
|
|
|
- listData({ dictType: "tbl_sites" }).then(res2 => {
|
|
|
- sites.value = res2.rows;
|
|
|
- var index = 1;
|
|
|
- data.value = [{
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ data.value[0].children = sites;
|
|
|
+ console.log(data.value);
|
|
|
+ showTree.value = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ showTree.value = true;
|
|
|
+ }, 100);
|
|
|
+};
|
|
|
+
|
|
|
+const getSites = () => {
|
|
|
+ listData({ dictType: "tbl_sites" }).then((res2) => {
|
|
|
+ sites.value = res2.rows;
|
|
|
+ var index = 1;
|
|
|
+ data.value = [
|
|
|
+ {
|
|
|
id: 1,
|
|
|
label: "站点",
|
|
|
- children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
|
|
|
- },];
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- const deleteDevice = (datac) => {
|
|
|
- tableData.value = tableData.value.filter(i => i.type != datac.type);
|
|
|
- var data = {
|
|
|
- dictCode: currentdata.value.dictCode,
|
|
|
- dictValue: currentdata.value.dictValue,
|
|
|
- dictLabel: currentdata.value.dictLabel,
|
|
|
- dictType: "tbl_sites",
|
|
|
- remark: JSON.stringify(tableData.value)
|
|
|
- }
|
|
|
- updateData(data).then(res => {
|
|
|
- ElMessage.success("成功!");
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- const handleTabClick = () => {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- const filterNode = (value: string, node: TreeNode) => {
|
|
|
- if (node.id == 1) return true;
|
|
|
- console.log(node.label.indexOf(value) != -1)
|
|
|
- return node.label.indexOf(value) != -1;
|
|
|
+ children: sites.value.map((i) => {
|
|
|
+ return { id: ++index, label: i.dictLabel };
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const deleteDevice = (datac) => {
|
|
|
+ tableData.value = tableData.value.filter((i) => i.type != datac.type);
|
|
|
+ var data = {
|
|
|
+ dictCode: currentdata.value.dictCode,
|
|
|
+ dictValue: currentdata.value.dictValue,
|
|
|
+ dictLabel: currentdata.value.dictLabel,
|
|
|
+ dictType: "tbl_sites",
|
|
|
+ remark: JSON.stringify(tableData.value),
|
|
|
};
|
|
|
+ updateData(data).then((res) => {
|
|
|
+ ElMessage.success("成功!");
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
- const currentdata = ref(null)
|
|
|
+const handleTabClick = () => {};
|
|
|
|
|
|
- const isJSON = (str) => {
|
|
|
- if (typeof str == 'string') {
|
|
|
- try {
|
|
|
- var obj = JSON.parse(str);
|
|
|
- if (typeof obj == 'object' && obj) {
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
+const filterNode = (value: string, node: TreeNode) => {
|
|
|
+ if (node.id == 1) return true;
|
|
|
+ console.log(node.label.indexOf(value) != -1);
|
|
|
+ return node.label.indexOf(value) != -1;
|
|
|
+};
|
|
|
+
|
|
|
+const currentdata = ref(null);
|
|
|
|
|
|
- } catch (e) {
|
|
|
+const isJSON = (str) => {
|
|
|
+ if (typeof str == "string") {
|
|
|
+ try {
|
|
|
+ var obj = JSON.parse(str);
|
|
|
+ if (typeof obj == "object" && obj) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
return false;
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- const treeclick = (data: TreeNodeData, node: TreeNode) => {
|
|
|
-
|
|
|
- currentdata.value = sites.value.filter(i => {
|
|
|
- return i.dictLabel == data.label
|
|
|
- })[0];
|
|
|
- tableData.value = [];
|
|
|
- if (currentdata.value) {
|
|
|
- // if (isJSON(currentdata.value.remark)) {
|
|
|
- tableData.value = JSON.parse((currentdata.value.remark == '' ? "[]" : currentdata.value.remark) ?? "[]");
|
|
|
- var cameras = tableData.value.filter(i => i.type == 'camera');
|
|
|
- if (cameras.length > 0) {
|
|
|
- var cameracode = cameras[0].code;
|
|
|
- //存在视频播放视频
|
|
|
- // getCameraPlayerConfig(cameracode).then(res => {
|
|
|
- // console.log(res.data);
|
|
|
- // var player = new EZUIKit.EZUIKitPlayer({
|
|
|
- // template: "pcLive",
|
|
|
- // id: 'video-container', // 视频容器ID
|
|
|
- // ...res.data
|
|
|
- // })
|
|
|
- // })
|
|
|
- }
|
|
|
-
|
|
|
- var cabinets = tableData.value.filter(i => i.type == 'cabinet');
|
|
|
- if (cabinets.length > 0) {
|
|
|
- var cabinetcode = cameras[0].code;
|
|
|
- SycCabinet(cabinetcode);
|
|
|
- }
|
|
|
- // }else{
|
|
|
- // ElMessage.warning("站点设备配置错误");
|
|
|
- // }
|
|
|
+};
|
|
|
+
|
|
|
+const treeclick = (data: TreeNodeData, node: TreeNode) => {
|
|
|
+ currentdata.value = sites.value.filter((i) => {
|
|
|
+ return i.dictLabel == data.label;
|
|
|
+ })[0];
|
|
|
+ tableData.value = [];
|
|
|
+ if (currentdata.value) {
|
|
|
+ // if (isJSON(currentdata.value.remark)) {
|
|
|
+ tableData.value = JSON.parse(
|
|
|
+ (currentdata.value.remark == "" ? "[]" : currentdata.value.remark) ?? "[]"
|
|
|
+ );
|
|
|
+ var cameras = tableData.value.filter((i) => i.type == "camera");
|
|
|
+ if (cameras.length > 0) {
|
|
|
+ var cameracode = cameras[0].code;
|
|
|
+ //存在视频播放视频
|
|
|
+ // getCameraPlayerConfig(cameracode).then(res => {
|
|
|
+ // console.log(res.data);
|
|
|
+ // var player = new EZUIKit.EZUIKitPlayer({
|
|
|
+ // template: "pcLive",
|
|
|
+ // id: 'video-container', // 视频容器ID
|
|
|
+ // ...res.data
|
|
|
+ // })
|
|
|
+ // })
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- const addDevice = () => {
|
|
|
- dialogVisible.value = false;
|
|
|
- if (formdata.value.name == "") {
|
|
|
- ElMessage.warning("设备名称未填写");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (formdata.value.type == "") {
|
|
|
- ElMessage.warning("设备类型未填写");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (formdata.value.code == "") {
|
|
|
- ElMessage.warning("设备序列号未填写");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (tableData.value.filter(i => i.type == formdata.value.type).length > 0) {
|
|
|
- ElMessage.warning("存在相同类型的设备");
|
|
|
- return;
|
|
|
- }
|
|
|
- tableData.value.push(formdata.value);
|
|
|
- var data = {
|
|
|
- dictCode: currentdata.value.dictCode,
|
|
|
- dictValue: currentdata.value.dictValue,
|
|
|
- dictLabel: currentdata.value.dictLabel,
|
|
|
- dictType: "tbl_sites",
|
|
|
- remark: JSON.stringify(tableData.value)
|
|
|
+ var cabinets = tableData.value.filter((i) => i.type == "cabinet");
|
|
|
+ if (cabinets.length > 0) {
|
|
|
+ var cabinetcode = cameras[0].code;
|
|
|
+ SycCabinet(cabinetcode);
|
|
|
}
|
|
|
- updateData(data).then(res => {
|
|
|
- ElMessage.success("成功!");
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
+ // }else{
|
|
|
+ // ElMessage.warning("站点设备配置错误");
|
|
|
+ // }
|
|
|
}
|
|
|
+};
|
|
|
|
|
|
- const currentCabinet = ref({
|
|
|
- total: 40,
|
|
|
- unused: 10,
|
|
|
- boxlist: []
|
|
|
- })
|
|
|
- const SycCabinet = (code) => {
|
|
|
- //TODO 获取格数
|
|
|
- // var toalnum
|
|
|
- currentCabinet.value.boxlist = [];
|
|
|
- for (var i = 0; i < currentCabinet.value.total; i++) {
|
|
|
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
- //@ts-ignore
|
|
|
- currentCabinet.value.boxlist.push({
|
|
|
- box_id: 1,
|
|
|
- box_name: (i + 1) + "",
|
|
|
- box_status: i % 2
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
+const addDevice = () => {
|
|
|
+ dialogVisible.value = false;
|
|
|
+ if (formdata.value.name == "") {
|
|
|
+ ElMessage.warning("设备名称未填写");
|
|
|
+ return;
|
|
|
}
|
|
|
- const openbox = (code) => {
|
|
|
- setTimeout(() => {
|
|
|
- ElMessage.success("指令已发送!");
|
|
|
- }, 1000);
|
|
|
+ if (formdata.value.type == "") {
|
|
|
+ ElMessage.warning("设备类型未填写");
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- const data = computed(() => {
|
|
|
-
|
|
|
- var index = 1;
|
|
|
-
|
|
|
- return [{
|
|
|
+ if (formdata.value.code == "") {
|
|
|
+ ElMessage.warning("设备序列号未填写");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableData.value.filter((i) => i.type == formdata.value.type).length > 0) {
|
|
|
+ ElMessage.warning("存在相同类型的设备");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tableData.value.push(formdata.value);
|
|
|
+ var data = {
|
|
|
+ dictCode: currentdata.value.dictCode,
|
|
|
+ dictValue: currentdata.value.dictValue,
|
|
|
+ dictLabel: currentdata.value.dictLabel,
|
|
|
+ dictType: "tbl_sites",
|
|
|
+ remark: JSON.stringify(tableData.value),
|
|
|
+ };
|
|
|
+ updateData(data).then((res) => {
|
|
|
+ ElMessage.success("成功!");
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const currentCabinet = ref({
|
|
|
+ total: 40,
|
|
|
+ unused: 10,
|
|
|
+ boxlist: [],
|
|
|
+});
|
|
|
+const SycCabinet = (code) => {
|
|
|
+ //TODO 获取格数
|
|
|
+ // var toalnum
|
|
|
+ currentCabinet.value.boxlist = [];
|
|
|
+ for (var i = 0; i < currentCabinet.value.total; i++) {
|
|
|
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
+ //@ts-ignore
|
|
|
+ currentCabinet.value.boxlist.push({
|
|
|
+ box_id: 1,
|
|
|
+ box_name: i + 1 + "",
|
|
|
+ box_status: i % 2,
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+const openbox = (code) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ ElMessage.success("指令已发送!");
|
|
|
+ }, 1000);
|
|
|
+};
|
|
|
+
|
|
|
+const data = computed(() => {
|
|
|
+ var index = 1;
|
|
|
+
|
|
|
+ return [
|
|
|
+ {
|
|
|
id: 1,
|
|
|
label: "站点",
|
|
|
- children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
|
|
|
- },]
|
|
|
- });
|
|
|
- onMounted(() => {
|
|
|
- if (treeRef.value) {
|
|
|
- setTimeout(() => {
|
|
|
- treeRef.value.expandNode(treeRef.value.getNode(1))
|
|
|
- }, 100);
|
|
|
- getSites();
|
|
|
- getCountry();
|
|
|
- // treeRef.value.expandNode(treeRef.value.getNode(1))
|
|
|
- }
|
|
|
- });
|
|
|
+ children: sites.value.map((i) => {
|
|
|
+ return { id: ++index, label: i.dictLabel };
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+onMounted(() => {
|
|
|
+ if (treeRef.value) {
|
|
|
+ setTimeout(() => {
|
|
|
+ treeRef.value.expandNode(treeRef.value.getNode(1));
|
|
|
+ }, 100);
|
|
|
+ getSites();
|
|
|
+ getCountry();
|
|
|
+ // treeRef.value.expandNode(treeRef.value.getNode(1))
|
|
|
+ }
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .card-header {
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- justify-content: space-between;
|
|
|
- }
|
|
|
-
|
|
|
- .boxunused {
|
|
|
- background: #3333332d;
|
|
|
- }
|
|
|
-</style>
|
|
|
+.card-header {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+
|
|
|
+.boxunused {
|
|
|
+ background: #3333332d;
|
|
|
+}
|
|
|
+</style>
|