|
|
@@ -401,498 +401,498 @@
|
|
|
</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 { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
- import { getCameraPlayerConfig, cabinetboxstatic } 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";
|
|
|
- import { getBoxInfo, getLock, openall } from "@/api/data"
|
|
|
- import videoDiv from "@/components/Public/videoDiv.vue"
|
|
|
+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 { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { getCameraPlayerConfig, cabinetboxstatic } 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";
|
|
|
+import { getBoxInfo, getLock, openall } from "@/api/data"
|
|
|
+import videoDiv from "@/components/Public/videoDiv.vue"
|
|
|
|
|
|
- const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
- const sites = ref([]);
|
|
|
+const sites = ref([]);
|
|
|
|
|
|
- const showTree = ref(true)
|
|
|
+const showTree = ref(true)
|
|
|
|
|
|
- const type = ref([])
|
|
|
+const type = ref([])
|
|
|
|
|
|
- const boxData = ref([])
|
|
|
- const boxCode = ref(null)
|
|
|
- const showKdg = ref(false)
|
|
|
+const boxData = ref([])
|
|
|
+const boxCode = ref(null)
|
|
|
+const showKdg = ref(false)
|
|
|
|
|
|
- const videoData = ref(null)
|
|
|
+const videoData = ref(null)
|
|
|
|
|
|
- const showVideo = ref(false)
|
|
|
+const showVideo = ref(false)
|
|
|
|
|
|
|
|
|
- const formdata = ref({
|
|
|
- name: "",
|
|
|
- type: "",
|
|
|
- code: ""
|
|
|
- })
|
|
|
+const formdata = ref({
|
|
|
+ name: "",
|
|
|
+ type: "",
|
|
|
+ code: ""
|
|
|
+})
|
|
|
|
|
|
|
|
|
- const route = useRoute();
|
|
|
- const router = useRouter();
|
|
|
+const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
|
|
|
- const tableData = ref([]);
|
|
|
- const carPathList = ref([]);
|
|
|
- const line = ref([]);
|
|
|
- const cabinetData = ref([]);
|
|
|
+const tableData = ref([]);
|
|
|
+const carPathList = ref([]);
|
|
|
+const line = ref([]);
|
|
|
+const cabinetData = ref([]);
|
|
|
|
|
|
- const activeName = ref("camera")
|
|
|
+const activeName = ref("camera")
|
|
|
|
|
|
- const countryList = ref([])
|
|
|
+const countryList = ref([])
|
|
|
|
|
|
- const filterText = ref("");
|
|
|
- const treeRef = ref(null);
|
|
|
- const dialogVisible = ref(false);
|
|
|
+const filterText = ref("");
|
|
|
+const treeRef = ref(null);
|
|
|
+const dialogVisible = ref(false);
|
|
|
|
|
|
- const gettreeheight = () => {
|
|
|
- return document.body.clientHeight - 300;
|
|
|
- }
|
|
|
+const gettreeheight = () => {
|
|
|
+ return document.body.clientHeight - 300;
|
|
|
+}
|
|
|
|
|
|
- const goAdd = () => {
|
|
|
- dialogVisible.value = true
|
|
|
- formdata.value = {
|
|
|
- name: "",
|
|
|
- type: "",
|
|
|
- code: ""
|
|
|
- }
|
|
|
+const goAdd = () => {
|
|
|
+ dialogVisible.value = true
|
|
|
+ formdata.value = {
|
|
|
+ name: "",
|
|
|
+ type: "",
|
|
|
+ code: ""
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- const openBox = (value, lockCode) => {
|
|
|
+const openBox = (value, lockCode) => {
|
|
|
|
|
|
- ElMessageBox.confirm(
|
|
|
- '是否打开' + value + "号柜",
|
|
|
- '提示',
|
|
|
- {
|
|
|
- confirmButtonText: '是',
|
|
|
- cancelButtonText: '否',
|
|
|
- type: 'warning',
|
|
|
- }
|
|
|
- )
|
|
|
- .then(() => {
|
|
|
- getLock(boxCode.value, lockCode).then(res => {
|
|
|
- console.log(res.code)
|
|
|
- ElMessage.success(value + "号柜远程开启成功");
|
|
|
- })
|
|
|
- // ElMessage({
|
|
|
- // type: 'success',
|
|
|
- // message: 'Delete completed',
|
|
|
- // })
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- // ElMessage({
|
|
|
- // type: 'info',
|
|
|
- // message: 'Delete canceled',
|
|
|
- // })
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ '是否打开' + value + "号柜",
|
|
|
+ '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '是',
|
|
|
+ cancelButtonText: '否',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ getLock(boxCode.value, lockCode).then(res => {
|
|
|
+ //console.log(res.code)
|
|
|
+ ElMessage.success(value + "号柜远程开启成功");
|
|
|
})
|
|
|
+ // ElMessage({
|
|
|
+ // type: 'success',
|
|
|
+ // message: 'Delete completed',
|
|
|
+ // })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // ElMessage({
|
|
|
+ // type: 'info',
|
|
|
+ // message: 'Delete canceled',
|
|
|
+ // })
|
|
|
+ })
|
|
|
|
|
|
- }
|
|
|
+}
|
|
|
|
|
|
- const clickCabinet = (value, lockCode) => {
|
|
|
- if (videoData.value.length > 0) {
|
|
|
- showVideo.value = true;
|
|
|
- setTimeout(() => {
|
|
|
- proxy.$refs.videoPlayer.initVideo(videoData.value[0].code)
|
|
|
- }, 100);
|
|
|
- }
|
|
|
- for (var index in boxData.value) {
|
|
|
- if (boxData.value[index].box_name == value) {
|
|
|
- // console.log(boxData.value[index].box_lock_address)
|
|
|
- openBox(value, boxData.value[index].box_lock_address);
|
|
|
- }
|
|
|
+const clickCabinet = (value, lockCode) => {
|
|
|
+ if (videoData.value.length > 0) {
|
|
|
+ showVideo.value = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ proxy.$refs.videoPlayer.initVideo(videoData.value[0].code)
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ for (var index in boxData.value) {
|
|
|
+ if (boxData.value[index].box_name == value) {
|
|
|
+ // //console.log(boxData.value[index].box_lock_address)
|
|
|
+ openBox(value, boxData.value[index].box_lock_address);
|
|
|
}
|
|
|
- ElMessage.success(value + "号柜远程开启成功");
|
|
|
}
|
|
|
+ ElMessage.success(value + "号柜远程开启成功");
|
|
|
+}
|
|
|
|
|
|
- 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 defaultProps = {
|
|
|
- children: "children",
|
|
|
- label: "label",
|
|
|
- value: 'id',
|
|
|
- };
|
|
|
- const treeIndent = ref(40);
|
|
|
+const defaultProps = {
|
|
|
+ children: "children",
|
|
|
+ label: "label",
|
|
|
+ value: 'id',
|
|
|
+};
|
|
|
+const treeIndent = ref(40);
|
|
|
|
|
|
- watch(filterText, (val) => {
|
|
|
- if (treeRef.value) {
|
|
|
- treeRef.value.filter(val);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- const savedata = () => {
|
|
|
- //保存数据
|
|
|
- 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("成功!");
|
|
|
- getSites();
|
|
|
-
|
|
|
- })
|
|
|
+watch(filterText, (val) => {
|
|
|
+ if (treeRef.value) {
|
|
|
+ treeRef.value.filter(val);
|
|
|
}
|
|
|
+});
|
|
|
+
|
|
|
+const savedata = () => {
|
|
|
+ //保存数据
|
|
|
+ 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("成功!");
|
|
|
+ getSites();
|
|
|
|
|
|
- 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)
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(sitesList)
|
|
|
- var sites = []
|
|
|
- for (var i in sitesList) {
|
|
|
- sites.push({ id: i, label: sitesList[i].data.dictLabel })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+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)
|
|
|
}
|
|
|
- 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 getBoxUsed = (obj) => {
|
|
|
- console.log(obj)
|
|
|
- var data = sites.value.filter(i => {
|
|
|
- return i.dictLabel == obj.label
|
|
|
- })[0];
|
|
|
- console.log(data)
|
|
|
- if (data) {
|
|
|
- var remark = JSON.parse((data.remark == '' ? "[]" : data.remark) ?? "[]")
|
|
|
- if (remark) {
|
|
|
- var cabinets = remark.filter(i => i.type == 'cabinet');
|
|
|
- // return cabinetData.value[cabinets+"_box"].used
|
|
|
- if (cabinets.length > 0) {
|
|
|
- var code = cabinets[0].code
|
|
|
- console.log(code + "_box")
|
|
|
- console.log(cabinetData.value[code + "_box"])
|
|
|
- return cabinetData.value[code + "_box"].used
|
|
|
- }
|
|
|
+ // //console.log(sitesList)
|
|
|
+ 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 getBoxUsed = (obj) => {
|
|
|
+ // //console.log(obj)
|
|
|
+ var data = sites.value.filter(i => {
|
|
|
+ return i.dictLabel == obj.label
|
|
|
+ })[0];
|
|
|
+ // //console.log(data)
|
|
|
+ if (data) {
|
|
|
+ var remark = JSON.parse((data.remark == '' ? "[]" : data.remark) ?? "[]")
|
|
|
+ if (remark) {
|
|
|
+ var cabinets = remark.filter(i => i.type == 'cabinet');
|
|
|
+ // return cabinetData.value[cabinets+"_box"].used
|
|
|
+ if (cabinets.length > 0 && cabinetData.value[cabinets[0].code + "_box"]) {
|
|
|
+ var code = cabinets[0].code
|
|
|
+ // //console.log(code + "_box")
|
|
|
+ // //console.log(cabinetData.value[code + "_box"])
|
|
|
+ return cabinetData.value[code + "_box"].used
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+}
|
|
|
|
|
|
- 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 } }),
|
|
|
- },];
|
|
|
- getCountry();
|
|
|
- });
|
|
|
- }
|
|
|
+const getSites = () => {
|
|
|
+ listData({ dictType: "tbl_sites" }).then(res2 => {
|
|
|
+ sites.value = res2.rows.filter(i => i.remark&&(JSON.parse(i.remark??"[]").filter(q =>q["type"]=="cabinet"&& q["code"]!="").length>0 ));
|
|
|
|
|
|
- const openAllBox = () => {
|
|
|
- let code = boxCode.value
|
|
|
- ElMessageBox.confirm(
|
|
|
- '是否打开所有柜子',
|
|
|
- '提示',
|
|
|
- {
|
|
|
- confirmButtonText: '是',
|
|
|
- cancelButtonText: '否',
|
|
|
- type: 'warning',
|
|
|
- }
|
|
|
- )
|
|
|
- .then(() => {
|
|
|
- openall(code).then(res => {
|
|
|
- if (res.code == 0) {
|
|
|
- ElMessage.success("打开所有柜子成功");
|
|
|
- }
|
|
|
- })
|
|
|
- // ElMessage({
|
|
|
- // type: 'success',
|
|
|
- // message: 'Delete completed',
|
|
|
- // })
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- // ElMessage({
|
|
|
- // type: 'info',
|
|
|
- // message: 'Delete canceled',
|
|
|
- // })
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- 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)
|
|
|
+ var index = 1;
|
|
|
+ data.value = [{
|
|
|
+ id: 1,
|
|
|
+ label: "站点",
|
|
|
+ children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
|
|
|
+ },];
|
|
|
+ getCountry();
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+const openAllBox = () => {
|
|
|
+ let code = boxCode.value
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ '是否打开所有柜子',
|
|
|
+ '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '是',
|
|
|
+ cancelButtonText: '否',
|
|
|
+ type: 'warning',
|
|
|
}
|
|
|
- updateData(data).then(res => {
|
|
|
- ElMessage.success("成功!");
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ openall(code).then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ ElMessage.success("打开所有柜子成功");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // ElMessage({
|
|
|
+ // type: 'success',
|
|
|
+ // message: 'Delete completed',
|
|
|
+ // })
|
|
|
})
|
|
|
+ .catch(() => {
|
|
|
+ // ElMessage({
|
|
|
+ // type: 'info',
|
|
|
+ // message: 'Delete canceled',
|
|
|
+ // })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+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)
|
|
|
}
|
|
|
-
|
|
|
- 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;
|
|
|
- };
|
|
|
-
|
|
|
- const currentdata = ref(null)
|
|
|
-
|
|
|
- const treeclick = (data: TreeNodeData, node: TreeNode) => {
|
|
|
-
|
|
|
- currentdata.value = sites.value.filter(i => {
|
|
|
- return i.dictLabel == data.label
|
|
|
- })[0];
|
|
|
- // console.log(currentdata.value)
|
|
|
- tableData.value = JSON.parse((currentdata.value.remark == '' ? "[]" : currentdata.value.remark) ?? "[]")
|
|
|
- if (currentdata.value) {
|
|
|
- var cabinets = tableData.value.filter(i => i.type == 'cabinet');
|
|
|
- videoData.value = tableData.value.filter(i => i.type == 'camera');
|
|
|
- console.log(videoData.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;
|
|
|
+};
|
|
|
+
|
|
|
+const currentdata = ref(null)
|
|
|
+
|
|
|
+const treeclick = (data: TreeNodeData, node: TreeNode) => {
|
|
|
+
|
|
|
+ currentdata.value = sites.value.filter(i => {
|
|
|
+ return i.dictLabel == data.label
|
|
|
+ })[0];
|
|
|
+ // //console.log(currentdata.value)
|
|
|
+ tableData.value = JSON.parse((currentdata.value.remark == '' ? "[]" : currentdata.value.remark) ?? "[]")
|
|
|
+ if (currentdata.value) {
|
|
|
+ var cabinets = tableData.value.filter(i => i.type == 'cabinet');
|
|
|
+ videoData.value = tableData.value.filter(i => i.type == 'camera');
|
|
|
+ //console.log(videoData.value)
|
|
|
+ if (cabinets.length > 0) {
|
|
|
+ boxCode.value = cabinets[0].code
|
|
|
+ getBoxInfoData(cabinets[0].code)
|
|
|
if (cabinets.length > 0) {
|
|
|
- boxCode.value = cabinets[0].code
|
|
|
- getBoxInfoData(cabinets[0].code)
|
|
|
- if (cabinets.length > 0) {
|
|
|
- type.value = cabinets[0].cabinetType
|
|
|
- } else {
|
|
|
- type.value = 4
|
|
|
- }
|
|
|
+ type.value = cabinets[0].cabinetType
|
|
|
+ } else {
|
|
|
+ type.value = 4
|
|
|
}
|
|
|
- // console.log(cabinets)
|
|
|
-
|
|
|
}
|
|
|
+ // //console.log(cabinets)
|
|
|
|
|
|
}
|
|
|
|
|
|
- const getBoxInfoData = (code) => {
|
|
|
- showKdg.value = false
|
|
|
- getBoxInfo(code).then(res => {
|
|
|
- boxData.value = res.data.list
|
|
|
- showKdg.value = true
|
|
|
- console.log(boxData.value)
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- 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.value,
|
|
|
- dictLabel: currentdata.value.label,
|
|
|
- dictType: "tbl_sites",
|
|
|
- remark: JSON.stringify(tableData.value)
|
|
|
- }
|
|
|
- updateData(data).then(res => {
|
|
|
- ElMessage.success("成功!");
|
|
|
- })
|
|
|
+}
|
|
|
|
|
|
+const getBoxInfoData = (code) => {
|
|
|
+ showKdg.value = false
|
|
|
+ getBoxInfo(code).then(res => {
|
|
|
+ boxData.value = res.data.list
|
|
|
+ showKdg.value = true
|
|
|
+ //console.log(boxData.value)
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
+const addDevice = () => {
|
|
|
+ dialogVisible.value = false;
|
|
|
+ if (formdata.value.name == "") {
|
|
|
+ ElMessage.warning("设备名称未填写");
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
- const currentCabinet = ref({
|
|
|
- total: 40,
|
|
|
- unused: 10,
|
|
|
- boxlist: []
|
|
|
+ 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.value,
|
|
|
+ dictLabel: currentdata.value.label,
|
|
|
+ dictType: "tbl_sites",
|
|
|
+ remark: JSON.stringify(tableData.value)
|
|
|
+ }
|
|
|
+ updateData(data).then(res => {
|
|
|
+ ElMessage.success("成功!");
|
|
|
})
|
|
|
- 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 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 formatIndex = (value) => {
|
|
|
- if (value < 10) {
|
|
|
- return '0' + value
|
|
|
- } else {
|
|
|
- return value
|
|
|
- }
|
|
|
+}
|
|
|
+// const openbox = (code) => {
|
|
|
+// setTimeout(() => {
|
|
|
+// ElMessage.success("指令已发送!");
|
|
|
+// }, 1000);
|
|
|
+// }
|
|
|
+
|
|
|
+const formatIndex = (value) => {
|
|
|
+ if (value < 10) {
|
|
|
+ return '0' + value
|
|
|
+ } else {
|
|
|
+ return value
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- const getStatus = (index) => {
|
|
|
- console.log(boxData.value.length)
|
|
|
- if (index - 1 < boxData.value.length) {
|
|
|
- if (boxData.value[index - 1].box_use_status == 0) {
|
|
|
- return '空闲中'
|
|
|
- } else {
|
|
|
- return '使用中'
|
|
|
- }
|
|
|
+const getStatus = (index) => {
|
|
|
+ //console.log(boxData.value.length)
|
|
|
+ if (index - 1 < boxData.value.length) {
|
|
|
+ if (boxData.value[index - 1].box_use_status == 0) {
|
|
|
+ return '空闲中'
|
|
|
} else {
|
|
|
- return '暂无'
|
|
|
+ return '使用中'
|
|
|
}
|
|
|
-
|
|
|
+ } else {
|
|
|
+ return '暂无'
|
|
|
}
|
|
|
|
|
|
- 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 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 getCountry = () => {
|
|
|
- listCountry({ pageSize: 10000 }).then(res => {
|
|
|
- console.log(res)
|
|
|
- countryList.value = res.rows
|
|
|
- })
|
|
|
- }
|
|
|
+const getCountry = () => {
|
|
|
+ listCountry({ pageSize: 10000 }).then(res => {
|
|
|
+ //console.log(res)
|
|
|
+ countryList.value = res.rows
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
- const updateSites = (sitesList) => {
|
|
|
- console.log(sitesList)
|
|
|
- var sites = []
|
|
|
- for (var i in sitesList) {
|
|
|
+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);
|
|
|
- }
|
|
|
-
|
|
|
- const getCabinetData = () => {
|
|
|
- cabinetboxstatic().then(res => {
|
|
|
- cabinetData.value = res;
|
|
|
- getSites();
|
|
|
- })
|
|
|
+ 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);
|
|
|
+}
|
|
|
+
|
|
|
+const getCabinetData = () => {
|
|
|
+ cabinetboxstatic().then(res => {
|
|
|
+ cabinetData.value = res;
|
|
|
+ getSites();
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
- const data = computed(() => {
|
|
|
+const data = computed(() => {
|
|
|
|
|
|
- var index = 1;
|
|
|
+ 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();
|
|
|
- getCabinetData();
|
|
|
- // initData();
|
|
|
- // getCountry();
|
|
|
- // treeRef.value.expandNode(treeRef.value.getNode(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();
|
|
|
+ getCabinetData();
|
|
|
+ // initData();
|
|
|
+ // 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;
|
|
|
- }
|
|
|
-
|
|
|
- .indexDiv {
|
|
|
- background-color: white;
|
|
|
- width: 20px;
|
|
|
- height: 10px;
|
|
|
- color: #000;
|
|
|
- font-weight: 600;
|
|
|
- position: absolute;
|
|
|
- right: 2px;
|
|
|
- bottom: 1px;
|
|
|
- z-index: 1000;
|
|
|
- font-size: 10px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
-
|
|
|
- .indexDivLeft {
|
|
|
- background-color: white;
|
|
|
- width: 40px;
|
|
|
- height: 10px;
|
|
|
- color: #000;
|
|
|
- font-weight: 600;
|
|
|
- position: absolute;
|
|
|
- left: 2px;
|
|
|
- bottom: 1px;
|
|
|
- z-index: 1000;
|
|
|
- font-size: 10px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
-</style>
|
|
|
+.card-header {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+
|
|
|
+.boxunused {
|
|
|
+ background: #3333332d;
|
|
|
+}
|
|
|
+
|
|
|
+.indexDiv {
|
|
|
+ background-color: white;
|
|
|
+ width: 20px;
|
|
|
+ height: 10px;
|
|
|
+ color: #000;
|
|
|
+ font-weight: 600;
|
|
|
+ position: absolute;
|
|
|
+ right: 2px;
|
|
|
+ bottom: 1px;
|
|
|
+ z-index: 1000;
|
|
|
+ font-size: 10px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.indexDivLeft {
|
|
|
+ background-color: white;
|
|
|
+ width: 40px;
|
|
|
+ height: 10px;
|
|
|
+ color: #000;
|
|
|
+ font-weight: 600;
|
|
|
+ position: absolute;
|
|
|
+ left: 2px;
|
|
|
+ bottom: 1px;
|
|
|
+ z-index: 1000;
|
|
|
+ font-size: 10px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+</style>
|