From 994e5e08cba4e6b9ce321b7cf5cb1ec8d19dfa22 Mon Sep 17 00:00:00 2001 From: ZZJ <zzjdsg2300@163.com> Date: 星期二, 12 四月 2022 17:50:21 +0800 Subject: [PATCH] 摄像机管理 --- src/api/taskMange.ts | 2 src/Pool/PollData.ts | 110 vue.config.js | 26 src/views/hashrate/CameraManage/index.vue | 40 src/views/productDetail/components/ConfirmOrder.vue | 61 src/Pool/VideoRuleData.ts | 1 src/views/equipmentManagement/algorithmDetail/index.vue | 32 src/views/trialCenter/components/Banner.vue | 2 src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue | 14 src/views/equipmentManagement/equipmentList/components/QuitClusterBox.vue | 41 src/views/hashrate/HashManage/components/SettingBox.vue | 138 ++ src/views/personalCenter/components/OrderMng.vue | 588 +++++---- src/api/order.ts | 6 src/components/CameraLeft.vue | 12 src/api/polygon.ts | 8 src/views/hashrate/AlgManage/index.vue | 16 src/views/hashrate/HashManage/components/ClusterCard.vue | 30 src/components/giantTree/zTree/ztree.vue | 4 src/views/hashrate/CameraManage/CameraRules/components/CameraBox.vue | 10 src/views/equipmentManagement/equipmentList/components/InfoCard.vue | 14 src/api/search.ts | 2 src/views/equipmentManagement/equipmentDetail/components/UpdateBox.vue | 9 src/views/index/components/commendContent.vue | 12 src/api/scene.ts | 18 src/views/equipmentManagement/equipmentList/components/FormList.vue | 101 src/api/clusterManage.ts | 127 + src/api/pollConfig.ts | 2 src/components/IndexHeader.vue | 20 src/views/trialCenter/components/SdkList.vue | 14 src/views/productDetail/components/PayCard.vue | 1 src/views/equipmentManagement/algorithmDetail/components/Card.vue | 65 src/views/index/components/rightRrid.vue | 12 public/images/hashrate/集群.png | 0 src/api/area.ts | 14 src/views/hashrate/CameraManage/CameraInfo/index.vue | 80 src/components/subComponents/MultiRangeSlider.vue | 127 + src/views/equipmentManagement/equipmentDetail/components/FormArea.vue | 8 src/api/device.js | 73 src/views/hashrate/HashManage/components/EquipmentForm.vue | 276 ++-- src/views/hashrate/CameraManage/CameraRules/components/SceneRule.vue | 2 src/views/trialCenter/components/commendCard.vue | 40 src/api/timeRule.ts | 2 src/views/equipmentManagement/equipmentDetail/components/UnbindBox.vue | 3 src/views/hashrate/CameraManage/CameraRules/components/SdkSettingBox.vue | 44 src/views/trialCenter/components/ProductForm.vue | 45 src/views/index/index.vue | 2 src/api/camera.ts | 18 src/views/hashrate/HashManage/index.vue | 233 +++ src/components/subComponents/SystemInfo.vue | 13 src/views/trialCenter/components/SdkItem.vue | 27 src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue | 64 src/Pool/TaskMange.ts | 7 src/Pool/TreeData.ts | 55 src/Pool/VideoManageData.ts | 9 src/api/event.ts | 2 src/views/productDetail/index.vue | 3 src/views/hashrate/HashManage/components/ClusterList.vue | 96 src/views/equipmentManagement/equipmentList/components/JoinClusterBox.vue | 149 ++ src/views/index/components/rightColumn.vue | 12 src/views/equipmentManagement/equipmentDetail/components/SettingBox.vue | 14 src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue | 37 src/api/product.ts | 10 src/views/equipmentManagement/equipmentDetail/index.vue | 37 src/components/giantTree/index.vue | 2 src/main.ts | 4 src/views/hashrate/HashManage/components/HashCard.vue | 37 src/api/dictionary.ts | 2 src/scripts/httpRequest.ts | 45 src/views/product/components/productCard.vue | 2 src/views/trialCenter/index.vue | 52 src/views/hashrate/CameraManage/CameraRules/index.vue | 82 src/api/shopcart.ts | 5 src/views/productDetail/components/UploadBox.vue | 10 src/App.vue | 1 src/views/equipmentManagement/equipmentList/components/AddBox.vue | 259 +-- 75 files changed, 2,180 insertions(+), 1,361 deletions(-) diff --git "a/public/images/hashrate/\351\233\206\347\276\244.png" "b/public/images/hashrate/\351\233\206\347\276\244.png" new file mode 100644 index 0000000..add7d18 --- /dev/null +++ "b/public/images/hashrate/\351\233\206\347\276\244.png" Binary files differ diff --git a/src/App.vue b/src/App.vue index 27261e1..904307e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -119,6 +119,7 @@ } .scroll { + overflow-y: auto; /*婊氬姩鏉″ 闀�,婊氬姩鏉℃暣浣撻儴鍒嗭紝鍏朵腑鐨勫睘鎬ф湁width,height,background,border绛夈��*/ &::-webkit-scrollbar { diff --git a/src/Pool/PollData.ts b/src/Pool/PollData.ts index e30b8ad..da79eb0 100644 --- a/src/Pool/PollData.ts +++ b/src/Pool/PollData.ts @@ -1,5 +1,11 @@ -import { getPollConfig, changeRunType, getCamerasByServer, statisticRunInfo, updateChannelCount } from "@/api/pollConfig"; -import { getSystemSummaryInfo, getSysThresholds } from "@/api/system" +import { getPollConfig, changeRunType, getCamerasByServer, updateChannelCount } from "@/api/pollConfig"; +import { getSysThresholds } from "@/api/system" +import { + clusterStatisticRunInfo, + deviceStatisticRunInfo, + devicesSysInfo, + clusterSysInfo +} from "@/api/clusterManage"; export default class PollData { public Config: Object = {}; @@ -62,6 +68,7 @@ //绠楀姏閰嶇疆涓粦鍧楁暟鎹� public sliderList: Array<any> = []; + public init() { this.fetchPollConfig(); this.fetchPollList(); @@ -118,71 +125,62 @@ } } public async statistics() { - let list = [] + // let list = [] - let rsp: any = await getCamerasByServer({ cameraName: "" }); - if (rsp && rsp.success) { - list = list.concat(rsp.data); - } + // let rsp: any = await getCamerasByServer({ cameraName: "" }); + // if (rsp && rsp.success) { + // list = list.concat(rsp.data); + // } - let RealTimeSum = 0, RealTimeRun = 0, PollSum = 0, PollRun = 0; + // let RealTimeSum = 0, RealTimeRun = 0, PollSum = 0, PollRun = 0; - list.forEach((cam: any) => { - if (cam.run_type === 1) { - RealTimeSum++ - if (cam.is_running) { - RealTimeRun++ - } - } + // list.forEach((cam: any) => { + // if (cam.run_type === 1) { + // RealTimeSum++ + // if (cam.is_running) { + // RealTimeRun++ + // } + // } - if (cam.run_type === 0) { - PollSum++ - if (cam.is_running) { - PollRun++ - } - } - }) + // if (cam.run_type === 0) { + // PollSum++ + // if (cam.is_running) { + // PollRun++ + // } + // } + // }) - this.Running = RealTimeRun + PollRun - this.Idle = RealTimeSum + PollSum - this.Running + // this.Running = RealTimeRun + PollRun + // this.Idle = RealTimeSum + PollSum - this.Running // 璁$畻绯荤粺淇℃伅 - rsp = await getSystemSummaryInfo() - if (rsp && rsp.success && rsp.data.cpu) { - let sysinfo = rsp.data - - // cpu - if (sysinfo.cpu) { - let cpuLoad = sysinfo.cpu.reduce((pre, item) => { - return pre + item; - }, 0) - - this.CpuUsedPercent = Number((cpuLoad / sysinfo.cpu.length).toFixed(2)) - } - - // 鍐呭瓨 - this.MemUsedPercent = Number(sysinfo.mem.usedPercent.toFixed(2)) - // 纭洏浣跨敤鎯呭喌 - this.DiskUsePercent = Number(sysinfo.disk.usedPercent.toFixed(2)) - - if (sysinfo.gpu) { - let gpuLoad = 0, gpuTotal = 0; - - for (let i = 0; i < sysinfo.gpu.length; i++) { - gpuLoad += sysinfo.gpu[i].used; - gpuTotal += sysinfo.gpu[i].memory; - } - this.GpuUsedPercent = Number((gpuLoad / gpuTotal * 100).toFixed(2)) - } - this.barCharts = [this.DiskUsePercent,this.CpuUsedPercent,this.GpuUsedPercent,this.MemUsedPercent] + let res: any + if(sessionStorage.getItem("clusterId")) { + res = await clusterSysInfo({}); } - - console.log(this); - + else { + res = await devicesSysInfo({}); + } + if (res && res.success ) { + this.CpuUsedPercent =res.data.cpu.usedPercent.toFixed(2) + this.MemUsedPercent = res.data.mem.usedPercent.toFixed(2) + this.DiskUsePercent =res.data.disk.usedPercent.toFixed(2) + this.GpuUsedPercent = res.data.gpu.usedPercent.toFixed(2) + this.barCharts = [this.DiskUsePercent,this.CpuUsedPercent,this.GpuUsedPercent,this.MemUsedPercent] + console.log(this.barCharts); + + } } public async statisticTaskInfo() { - let res: any = await statisticRunInfo({}); + let res: any + if(sessionStorage.getItem("clusterId")) { + res = await clusterStatisticRunInfo({}); + } + else { + res = await deviceStatisticRunInfo({}); + } + if (res && res.success) { // console.log(res,'缁熻瀹炴椂銆佽疆璇㈡暟閲�') this.RealTimeSum = res.data.realTotal diff --git a/src/Pool/TaskMange.ts b/src/Pool/TaskMange.ts index 76575b9..a66f478 100644 --- a/src/Pool/TaskMange.ts +++ b/src/Pool/TaskMange.ts @@ -1,5 +1,4 @@ import { - findAllSdk, findAll, addTaskSdk, delTaskSdk, @@ -14,6 +13,8 @@ findByType, getTagList } from "@/api/taskMange"; +import { findAllSdk } from "@/api/device"; + export default class TaskMange{ public list1:Array<Object> = []; public list2:Array<Object> = []; @@ -61,7 +62,9 @@ } async findAllSdk(params) { - let res:any = await findAllSdk(params) + let id = sessionStorage.getItem("nodeId"); + + let res:any = await findAllSdk({ userId: "", nodeId: id }) if (res && res.success) { this.list1 = res.data } diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts index 49b9c0e..8c9ad4c 100644 --- a/src/Pool/TreeData.ts +++ b/src/Pool/TreeData.ts @@ -65,8 +65,9 @@ public cameraNameForBaseImage: string public gb28181CameraBaseImage: string public baseImageLoading: boolean - public clusterId: string - public devId: string + + public activeNode: string + constructor() { this.openeds = [true, true, false] @@ -106,24 +107,11 @@ this.cameraNameForBaseImage = "" this.gb28181CameraBaseImage = "" this.baseImageLoading = false + this.activeNode = '' - this.clusterId = "" - this.devId = "" - this.getId() } - async getId(){ - - //鍏堟嬁闆嗙兢id鎴栬澶噄d - const res:any = await getClusterDevList() - if(res.data.clusterList.length > 0) { - this.clusterId = res.data.clusterList[0].cluster_id - } - else { - this.devId = res.data.devList[0].devId - } - } setVideoArr(index: number, value: object, vue: any): void { vue.$set(this.videoArr, index, value) @@ -362,8 +350,7 @@ parentId:"", searchType: this.searchCamType, cameraName: this.searchInput, - clusterId:this.clusterId, - devId:this.devId + //isPlatform: 1 } if (this.searchFrom == 'cluster') { @@ -374,6 +361,7 @@ const rsp: any = await getLocalCameraTree(params) if (rsp && rsp.success) { + this.treeData = rsp.data.treeMenu ? rsp.data.treeMenu : [] if (this.treeData && this.treeData.length > 0) { this.sortTreeData(this.treeData) @@ -402,20 +390,21 @@ } async fetchGbTree() { - const rsp: any = await getGB28181CameraTree({ - searchType: this.searchCamType, - cameraName: this.searchInput - }) + // 鍚庨棬 + // const rsp: any = await getGB28181CameraTree({ + // searchType: this.searchCamType, + // cameraName: this.searchInput + // }) - if (rsp && rsp.success) { - this.gb28181Data = rsp.data ? rsp.data : [] - if (this.gb28181Data && this.gb28181Data.length > 0) { - this.sortTreeData(this.gb28181Data) - } + // if (rsp && rsp.success) { + // this.gb28181Data = rsp.data ? rsp.data : [] + // if (this.gb28181Data && this.gb28181Data.length > 0) { + // this.sortTreeData(this.gb28181Data) + // } - this.gb28181DataPure = JSON.parse(JSON.stringify(this.gb28181Data)) - this.isFold(this.gb28181Data) - } + // this.gb28181DataPure = JSON.parse(JSON.stringify(this.gb28181Data)) + // this.isFold(this.gb28181Data) + // } } async fetchTreeData() { @@ -430,7 +419,7 @@ async add(name: string, parent: string) { await addAreaTreeData({ name: name, - parentId: parent + parentId: parent, }) this.fetchTreeData() @@ -438,7 +427,7 @@ async del(id: string) { await delAreaTreeData({ - id: id + id: id, }) this.fetchTreeData() @@ -449,7 +438,7 @@ id: id, name: name, parentId: this.getParent(id, isGb), - alias: alias + alias: alias, }) this.fetchTreeData() diff --git a/src/Pool/VideoManageData.ts b/src/Pool/VideoManageData.ts index 1caee06..fb11ffd 100644 --- a/src/Pool/VideoManageData.ts +++ b/src/Pool/VideoManageData.ts @@ -12,6 +12,7 @@ { day: 7, time_range: [{ start: "00:00", end: "24:00" }] } ] + export default class VideoManageData { public SepTasks: Array<object> = []; public TimeRules: Array<object> = []; @@ -23,14 +24,16 @@ // this.getAllSeparateTasks(); this.getTimeRule(); this.getDictionary(); - this.getTagList(); + // this.getTagList(); } public async getTimeRule() { let rsp: any = await getAllTimeRule(); + console.log(rsp); + if (rsp && rsp.success) { - this.TimeRules = rsp.data; - this.TimeRuleSum = rsp.data.length + this.TimeRules = rsp.data.timeRules; + this.TimeRuleSum = this.TimeRules.length } // 娣诲姞涓�鏉¢粯璁よ鍒� diff --git a/src/Pool/VideoRuleData.ts b/src/Pool/VideoRuleData.ts index 59e7d8f..a49fec8 100644 --- a/src/Pool/VideoRuleData.ts +++ b/src/Pool/VideoRuleData.ts @@ -63,6 +63,7 @@ ] this.selectResolution = '1002' this.hasCtrlC = false + } public async update() { diff --git a/src/api/area.ts b/src/api/area.ts index 5395da4..c26d38b 100644 --- a/src/api/area.ts +++ b/src/api/area.ts @@ -11,7 +11,7 @@ export const getGB28181CameraTree = (query: any) => { return request({ - url: "/data/api-v/gb28181/tree", + url: "/saas/api-s/gb28181/tree", method: "get", params: query }); @@ -27,25 +27,25 @@ export const addAreaTreeData = (query: any) => { return request({ - url: "/data/api-v/area/add", + url: "/saas/api-s/area/add", method: "post", - data: qs.stringify(query) + data: query }); }; export const delAreaTreeData = (query: any) => { return request({ - url: "/data/api-v/area/del", + url: "/saas/api-s/area/del", method: "post", - data: qs.stringify(query) + data: query }); }; export const updateAreaTreeData = (query: any) => { return request({ - url: "/data/api-v/area/update", + url: "/saas/api-s/area/update", method: "post", - data: qs.stringify(query) + data: query }); }; diff --git a/src/api/camera.ts b/src/api/camera.ts index 52c51f9..d2f33a5 100644 --- a/src/api/camera.ts +++ b/src/api/camera.ts @@ -4,7 +4,7 @@ export const createCamera = (camera: any) => { return request({ - url: "/data/api-v/camera/add", + url: "/saas/api-s/camera/add", method: "post", data: camera }); @@ -12,25 +12,25 @@ export const updateCameraInfo = (camera: any) => { return request({ - url: "/data/api-v/camera/update", - method: "put", + url: "/saas/api-s/camera/update", + method: "post", data: camera }); }; export const getCameraInfo = (id: string) => { return request({ - url: "/data/api-v/camera/show", + url: "/saas/api-s/camera/show", method: "get", params: { id: id } }); }; -export const delCamera = (id: string) => { +export const delCamera = (data: string) => { return request({ - url: "/data/api-v/camera/del", - method: "get", - params: { id: id } + url: "/saas/api-s/camera/del", + method: "post", + data: data }); }; @@ -68,7 +68,7 @@ export const updateSnapshot = (cameraId: string) => { return request({ - url: "/data/api-v/camera/updateSnapshotUrl", + url: "/saas/api-s/camera/updateSnapshotUrl", method: "get", params: { cameraId: cameraId } }); diff --git a/src/api/clusterManage.ts b/src/api/clusterManage.ts index cadb61d..625053e 100644 --- a/src/api/clusterManage.ts +++ b/src/api/clusterManage.ts @@ -4,7 +4,7 @@ // 鑾峰彇闅忔満瀵嗙爜 export const randomPwd = (query: any) => { return request({ - url: "/data/api-v/cluster/randomPwd", + url: "/saas/api-d/device/randomPwd", method: "get", params: query }); @@ -13,7 +13,7 @@ // 鍒涘缓闆嗙兢 export const createSerfCluster = (query: any) => { return request({ - url: "/data/api-v/cluster/create", + url: "/saas/api-d/device/createCluster", method: "post", data: query }) @@ -22,7 +22,7 @@ // 鎼滅储闆嗙兢 export const search = (query: any) => { return request({ - url: "/data/api-v/cluster/search", + url: "/saas/api-d/device/searchCluster", method: "post", data: query }) @@ -31,16 +31,16 @@ // 璋僺earch鍚庯紝閫氳繃姝ゆ帴鍙h幏鍙栨煡鍒扮殑闆嗙兢鑺傜偣淇℃伅 export const getSearchNodes = (query: any) => { return request({ - url: "/data/api-v/cluster/getSearchNodes", - method: "get", - params: query + url: "/saas/api-d/device/getSearchNodes", + method: "post", + data: query }); }; // 鍋滄鎼滅储 export const stopSearching = (query: any) => { return request({ - url: "/data/api-v/cluster/stopSearching", + url: "/saas/api-d/device/stopSearching", method: "post", data: query }) @@ -49,16 +49,16 @@ // 鏌ヨ鏈湴闆嗙兢 export const findCluster = (query: any) => { return request({ - url: "/data/api-v/cluster/findCluster", - method: "get", - params: query + url: "/saas/api-d/device/findCluster", + method: "post", + data: query }); }; // 淇濆瓨闆嗙兢鍚嶇О export const updateClusterName = (query: any) => { return request({ - url: '/data/api-v/cluster/updateClusterName', + url: '/saas/api-d/device/updateClusterName', method: 'post', data: qs.stringify(query) }) @@ -67,7 +67,7 @@ // 鍔犲叆闆嗙兢 export const joinCluster = (query: any) => { return request({ - url: "/data/api-v/cluster/joinCluster", + url: "/saas/api-d/device/joinCluster", method: "post", headers: { "Content-Type": "application/json; charset=UTF-8" @@ -79,7 +79,7 @@ // 閫�鍑洪泦缇� export const leave = (query: any) => { return request({ - url: "/data/api-v/cluster/leave", + url: "/saas/api-d/device/exitCluster", method: "post", data: query }) @@ -135,4 +135,103 @@ url: "/saas/api-s/area/getClusterDevList", method: "get", }) -} \ No newline at end of file +} + + + +//鑾峰彇鐢ㄦ埛鎬荤畻鍔� +export const userStatisticRunInfo = () => { + return request({ + url: "/saas/api-s/camera/userStatisticRunInfo", + method: "post", + }) +} + +//鑾峰彇璁惧绠楀姏 +export const deviceStatisticRunInfo = (data: any) => { + return request({ + url: "/saas/api-s/camera/deviceStatisticRunInfo", + method: "post", + data + }) +} + +//鑾峰彇闆嗙兢绠楀姏 +export const clusterStatisticRunInfo = (data: any) => { + return request({ + url: "/saas/api-s/camera/clusterStatisticRunInfo", + method: "post", + data + }) +} + +//鑾峰彇鐢ㄦ埛涓嬫墍鏈夎澶嘽pu +export const userSysInfo = () => { + return request({ + url: "/saas/api-d/device/userSysInfo", + method: "post", + }) +} + +//鑾峰彇闆嗙兢涓媍pu +export const clusterSysInfo = (data: any) => { + return request({ + url: "/saas/api-d/device/clusterSysInfo", + method: "post", + data + }) +} + +//鑾峰彇璁惧cpu +export const devicesSysInfo = (data: any) => { + return request({ + url: "/saas/api-d/device/devicesSysInfo", + method: "post", + data + }) +} + +//鑾峰彇鎵�鏈夎澶囬泦缇� +export const userStatisticRun = (data: any) => { + return request({ + url: "/saas/api-s/camera/userStatisticRun", + method: "post", + data + }) +} + +//鑾峰彇闆嗙兢涓嬭澶� +export const clusterStatisticRun = (data: any) => { + return request({ + url: "/saas/api-s/camera/clusterStatisticRun", + method: "post", + data + }) +} + +//鑾峰彇璁惧鎽勫儚鏈哄垪琛� +export const getCameraByPage = (data: any) => { + return request({ + url: "/saas/api-s/camera/getCameraByPage", + method: "post", + data + }) +} + +//鑾峰彇绠楀姏璁剧疆 +export const getPollConfig = (data: any) => { + return request({ + url: "/saas/api-s/camera/getPollConfig", + method: "post", + data + }) +} + +//淇敼绠楀姏璁剧疆 +export const savePollConfig = (data: any) => { + return request({ + url: "/saas/api-s/camera/savePollConfig", + method: "post", + data + }) +} diff --git a/src/api/device.js b/src/api/device.js index fe9fa13..8214771 100644 --- a/src/api/device.js +++ b/src/api/device.js @@ -49,7 +49,7 @@ */ export const unbind = (params) => { return request({ - url: "/sass/api-d/device/unbind", + url: "/saas/api-d/device/unbind", method: "post", data: params, }); @@ -58,7 +58,7 @@ // 鏄剧ず璁惧璇︽儏 export const findDevDetail = (data) => { return request({ - url: "/sass/api-d/device/show", + url: "/saas/api-d/device/show", method: "post", data, }); @@ -67,7 +67,7 @@ //鍥炲~閲嶅惎鏃ユ湡 export const getRestartTask = (data) => { return request({ - url: "/sass/api-d/device/getRestartTask", + url: "/saas/api-d/device/getRestartTask", method: "post", data, }); @@ -76,16 +76,16 @@ // 璁剧疆閲嶅惎鏃ユ湡 export const setRestartTask = (data) => { return request({ - url: "/sass/api-d/device/setRestartTask", + url: "/saas/api-d/device/setRestartTask", method: "post", data, }); }; -// 璁剧疆閲嶅惎鏃ユ湡 +// 閲嶅惎璁惧 export const restart = (data) => { return request({ - url: "/sass/api-d/device/restart", + url: "/saas/api-d/device/restart", method: "post", data, }); @@ -94,7 +94,7 @@ // 妫�鏌ユ渶鏂扮増鏈� export const checkVersion = (data) => { return request({ - url: "/sass/api-d/device/checkVersion", + url: "/saas/api-d/device/checkVersion", method: "post", data, }); @@ -103,7 +103,7 @@ // 鏇存柊鏈�鏂扮増鏈� export const updateVersion = (data) => { return request({ - url: "/sass/api-d/device/updateVersion", + url: "/saas/api-d/device/updateVersion", method: "post", data, }); @@ -112,7 +112,7 @@ // 鑾峰彇搴旂敤 export const findAllApp = (data) => { return request({ - url: "/sass/api-d/device/findAllApp", + url: "/saas/api-d/device/findAllApp", method: "post", data, }); @@ -121,7 +121,7 @@ // 鑾峰彇绠楁硶 export const findAllSdk = (data) => { return request({ - url: "/sass/api-d/device/findAllSdk", + url: "/saas/api-d/device/findAllSdk", method: "post", data, }); @@ -130,7 +130,7 @@ // 鑾峰彇璁惧鎬ц兘 export const showSystemStates = (data) => { return request({ - url: "/sass/api-d/device/showSystemStates", + url: "/saas/api-d/device/showSystemStates", method: "post", data, }); @@ -139,7 +139,7 @@ // 鑾峰彇绠楁硶璧勬簮 export const showProcesses = (data) => { return request({ - url: "/sass/api-d/device/showProcesses", + url: "/saas/api-d/device/showProcesses", method: "post", data, }); @@ -157,7 +157,7 @@ // 鍗歌浇搴旂敤 export const unInstallApp = (data) => { return request({ - url: "/sass/api-d/device/unInstallApp", + url: "/saas/api-d/device/unInstallApp", method: "post", data, }); @@ -175,8 +175,53 @@ // 鑾峰彇鏃堕棿 export const clockInfo = (data) => { return request({ - url: "/sass/api-d/device/clockInfo", + url: "/saas/api-d/device/clockInfo", method: "post", data, }); }; + +// 鑾峰彇闆嗙兢 +export const findClustersBySearch = (data) => { + return request({ + url: "/saas/api-d/device/findClustersBySearch", + method: "post", + data, + }); +}; + +// 鑾峰彇闆嗙兢 +export const findDeviceListAll = (params) => { + return request({ + url: "/saas/api-d/device/findDeviceListAll", + method: "post", + data: params, + }); +}; + +//鑾峰彇闆嗙兢涓嬫墍鏈夎澶� +export const getDevicesByCluster = (params) => { + return request({ + url: "/saas/api-d/device/getDevicesByCluster", + method: "post", + data: params, + }); +}; + +//鑾峰彇闆嗙兢涓嬫墍鏈夎澶� +export const addCluster = (params) => { + return request({ + url: "/saas/api-d/device/addCluster", + method: "post", + data: params, + }); +}; + +//鑾峰彇闆嗙兢涓嬫墍鏈夎澶� +export const addDeviceToUser = (params) => { + return request({ + url: "/saas/api-d/device/addDeviceToUser", + method: "post", + data: params, + }); +}; diff --git a/src/api/dictionary.ts b/src/api/dictionary.ts index ce407f4..730773b 100644 --- a/src/api/dictionary.ts +++ b/src/api/dictionary.ts @@ -29,7 +29,7 @@ export const findDictionaryByType = () => { return request({ - url: "/data/api-v/dictionary/findByType", + url: "/saas/api-s/dictionary/findByType", method: "get" }); }; diff --git a/src/api/event.ts b/src/api/event.ts index d1b14fe..90b86b9 100644 --- a/src/api/event.ts +++ b/src/api/event.ts @@ -72,7 +72,7 @@ //鑾峰彇浜嬩欢澹伴煶鍒楄〃 export const getSoundList = () => { return request({ - url: "/data/api-v/voice/findAll", + url: "/saas/api-s/voice/findAll", method: "get" }) diff --git a/src/api/order.ts b/src/api/order.ts index 9d77ce0..dfbd7b9 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -13,7 +13,7 @@ */ export const getOrders = (params: any) => { return request({ - url: "/data/api-s/order/findAllOrder", + url: "/saas/api-s/saasOrder/findAllOrder", method: "post", data: params }); @@ -74,7 +74,7 @@ // 纭鏀粯 export const resumePay = (data: any) => { return request({ - url: `/data/api-s/order/confirmPay`, + url: `/saas/api-s/saasOrder/confirmPay`, method: "post", data }); @@ -88,7 +88,7 @@ //淇濆瓨璁㈠崟鏀粯鍑瘉 export const saveOrderCertificate = (data:any) => request({ - url:'/data/api-s/order/certificate/save', + url:'/saas/api-s/saasOrder/certificate/save', method: 'post', data }); diff --git a/src/api/pollConfig.ts b/src/api/pollConfig.ts index 0abd33b..c033ea2 100644 --- a/src/api/pollConfig.ts +++ b/src/api/pollConfig.ts @@ -10,7 +10,7 @@ export const changeRunType = (params: any) => { return request({ - url: "/data/api-v/camera/changeRunType", + url: "/saas/api-s/camera/changeRunType", method: "post", data: params }); diff --git a/src/api/polygon.ts b/src/api/polygon.ts index c7d1202..e7aaa94 100644 --- a/src/api/polygon.ts +++ b/src/api/polygon.ts @@ -2,9 +2,9 @@ export const getAllPolygon = (query: any) => { return request({ - url: "/data/api-v/polygon/findByCameraId", - method: "get", - params: query + url: "/saas/api-s/polygon/findByCameraId", + method: "post", + data: query }); }; @@ -18,7 +18,7 @@ export const savePolygon = (params: any) => { return request({ - url: "/data/api-v/polygon/save", + url: "/saas/api-s/polygon/save", method: "post", data: params }); diff --git a/src/api/product.ts b/src/api/product.ts index f4c1e9e..bf26038 100644 --- a/src/api/product.ts +++ b/src/api/product.ts @@ -128,7 +128,7 @@ //鏍规嵁璁㈠崟id鏌ヨ璁㈠崟璇︽儏 export const getOrderById = (id: string) => { return request({ - url: `/data/api-s/order/show/${id}`, + url: `/saas/api-s/saasOrder/show/${id}`, method: 'get' }) } @@ -293,4 +293,12 @@ url: `/saas/api-i/saasIndex/getModelList`, method: 'get', }) +} + +//璇曠敤涓績 +export const getFreeList = () => { + return request({ + url: `/saas/api-s/saasProduct/getFreeList`, + method: 'post', + }) } \ No newline at end of file diff --git a/src/api/scene.ts b/src/api/scene.ts index 130433f..bb7611a 100644 --- a/src/api/scene.ts +++ b/src/api/scene.ts @@ -25,7 +25,7 @@ export const saveCameraScene = (params: any) => { return request({ - url: "/data/api-v/camera/rule/save", + url: "/saas/api-s/camera/rule/save", method: "post", data: params }); @@ -33,7 +33,7 @@ export const saveLinkScene = (params: any) => { return request({ - url: "/data/api-v/camera/rule/saveLinkRulesByGroup", + url: "/saas/api-s/camera/rule/saveLinkRulesByGroup", method: "post", data: params }); @@ -41,15 +41,15 @@ export const getCameraSceneRule = (query: any) => { return request({ - url: "/data/api-v/camera/rule/findByCameraId", - method: "get", - params: query + url: "/saas/api-s/camera/rule/findByCameraId", + method: "post", + data: query }); }; export const getLinkSceneRule = (params: any) => { return request({ - url: "/data/api-v/camera/rule/getLinkRulesByCameraIds", + url: "/saas/api-s/camera/rule/getLinkRulesByCameraIds", method: "post", data: params }); @@ -57,8 +57,8 @@ export const deleteCameraScene = (id: any) => { return request({ - url: "/data/api-v/camera/rule/deleteGroup", - method: "get", - params: { groupId: id } + url: "/saas/api-s/camera/rule/deleteGroup", + method: "delete", + data: { groupId: id } }); }; diff --git a/src/api/search.ts b/src/api/search.ts index 9e685f9..94cdfef 100644 --- a/src/api/search.ts +++ b/src/api/search.ts @@ -39,7 +39,7 @@ // 瀛楀吀鏌ヨ锛堝竷闃茬瓑绾э級 export const getAlarmLevel = (query: any) => { return request({ - url: "/data/api-v/dictionary/findByType", + url: "/saas/api-s/dictionary/findByType", method: "get", data: query }); diff --git a/src/api/shopcart.ts b/src/api/shopcart.ts index 4b79ea0..9c6e6ce 100644 --- a/src/api/shopcart.ts +++ b/src/api/shopcart.ts @@ -1,4 +1,5 @@ -import request from './index' +import request from "@/scripts/httpRequest"; + //鏂板璐墿杞﹀晢鍝� export const addShopcartProd = (data: any) => request({ @@ -29,7 +30,7 @@ //纭璁㈠崟 export const resumeOrder = (data:any) => request({ - url: '/data/api-s/order/addOrder', + url: '/saas/api-s/saasOrder/addOrder', method: 'post', data }); \ No newline at end of file diff --git a/src/api/taskMange.ts b/src/api/taskMange.ts index 64732b5..d4bcd0f 100644 --- a/src/api/taskMange.ts +++ b/src/api/taskMange.ts @@ -112,7 +112,7 @@ // 鏍规嵁绫诲瀷鏌ユ壘瀛楀吀 export const findByType = (query: any) => { return request({ - url: '/data/api-v/dictionary/findByType', + url: '/saas/api-s/dictionary/findByType', method: "get", params: query }) diff --git a/src/api/timeRule.ts b/src/api/timeRule.ts index 646c729..ef5da6d 100644 --- a/src/api/timeRule.ts +++ b/src/api/timeRule.ts @@ -2,7 +2,7 @@ export const getAllTimeRule = () => { return request({ - url: "/data/api-v/cameraTimerule/findAll", + url: "/saas/api-s/cameraTimerule/findAll", method: "get" }); }; diff --git a/src/components/CameraLeft.vue b/src/components/CameraLeft.vue index 1dd293a..31ee1e8 100644 --- a/src/components/CameraLeft.vue +++ b/src/components/CameraLeft.vue @@ -499,7 +499,7 @@ created() { if (this.showCam) { this.TreeDataPool.treeActiveName = "camera"; - this.TreeDataPool.fetchTreeData(); + // this.TreeDataPool.fetchTreeData(); } else { this.TreeDataPool.treeActiveName = "dataStack"; this.DataStackPool.fetchFiles(); @@ -698,7 +698,15 @@ camera.rtsp = String(sheetArray[item].rtsp); camera.addr = String(sheetArray[item].addr); - promiseArr.push(createCamera(camera)); + let tem = { + camera: camera, + sensors: camera.sensors, + areaid: camera.areaid, + }; + tem.camera.clusterId = this.TreeDataPool.clusterId; + tem.camera.devId = this.TreeDataPool.devId; + + promiseArr.push(createCamera(tem)); } let _this = this; Promise.allSettled(promiseArr) diff --git a/src/components/IndexHeader.vue b/src/components/IndexHeader.vue index 645b30c..9f17990 100644 --- a/src/components/IndexHeader.vue +++ b/src/components/IndexHeader.vue @@ -25,6 +25,7 @@ placeholder="璇疯緭鍏ュ叧閿瘝" v-model="keyWord" @focus="showInputBox(true)" + :class="{ Unlogin: !userInfo }" > <div class="iconList" slot="suffix"> <i class="search iconfont" v-if="!isShow"></i> @@ -68,7 +69,7 @@ <div class="label">浣欓</div> <div class="content"> <span class="button">鍏呭��</span> - <span class="number">锟�4900.82</span> + <span class="number">锟�0</span> </div> </li> @@ -83,7 +84,9 @@ </li> <li> - <div class="label">璁㈠崟绠$悊</div> + <div class="label"> + <router-link to="/personalCenter">璁㈠崟绠$悊</router-link> + </div> </li> <li> @@ -108,7 +111,7 @@ </div> <!-- 杈撳叆涓嬫媺妗� --> - <div class="inputBox" v-if="isShowBox"> + <div class="inputBox" :class="{ Unlogin: !userInfo }" v-if="isShowBox"> <div class="hotKey"> <div class="title">鐑棬鎼滅储</div> <ul class="keyCard"> @@ -346,6 +349,11 @@ right: 88px; width: 300px; background-color: #fff; + + &.Unlogin { + right: 158px; + } + ::v-deep input { width: 300px; background-color: #fff; @@ -364,13 +372,17 @@ position: absolute; top: 62px; right: 88px; - // right: -158px; padding: 12px 20px 8px 20px; width: 300px; background-color: #fff; border-top: 1px solid rgb(204, 204, 204); z-index: 4; + &.Unlogin { + top: 52px; + right: 158px; + } + .hotKey, .historyKey { margin-top: 12px; diff --git a/src/components/giantTree/index.vue b/src/components/giantTree/index.vue index 356d6d2..13ad53d 100644 --- a/src/components/giantTree/index.vue +++ b/src/components/giantTree/index.vue @@ -287,7 +287,9 @@ this.showDialog = true; }, itemClick(evt, treeId, treeNode) { + console.log("click"); this.TreeDataPool.selectedNode = treeNode; + this.TreeDataPool.activeNode = treeNode; this.TreeDataPool.treeType = this.treeName; // 澶氶�� diff --git a/src/components/giantTree/zTree/ztree.vue b/src/components/giantTree/zTree/ztree.vue index 409932c..88db186 100644 --- a/src/components/giantTree/zTree/ztree.vue +++ b/src/components/giantTree/zTree/ztree.vue @@ -370,7 +370,7 @@ .editIcon { &::after { margin-left: 10px; - content: "\e642"; + content: "\e644"; font-size: 16px; color: #666; vertical-align: -2px; @@ -390,7 +390,7 @@ .addCameraIcon { &::after { margin-left: 10px; - content: "\e644"; + content: "\e642"; font-size: 16px; color: #666; vertical-align: -2px; diff --git a/src/components/subComponents/MultiRangeSlider.vue b/src/components/subComponents/MultiRangeSlider.vue index 5bab8e5..36a2cfc 100644 --- a/src/components/subComponents/MultiRangeSlider.vue +++ b/src/components/subComponents/MultiRangeSlider.vue @@ -1,6 +1,8 @@ <template> <div class="timeRangeSliderBox"> - <canvas :id="mainId" :ref="mainId" width="700px" height="260px">鎶辨瓑,鎮ㄧ殑娴忚鍣ㄤ笉鏀寔canvas!璇锋洿鎹㈡祻瑙堝櫒</canvas> + <canvas :id="mainId" :ref="mainId" width="700px" height="260px" + >鎶辨瓑,鎮ㄧ殑娴忚鍣ㄤ笉鏀寔canvas!璇锋洿鎹㈡祻瑙堝櫒</canvas + > <canvas :id="`${mainId}Dummy`" :ref="`${mainId}Dummy`" @@ -11,8 +13,13 @@ @mousedown="mouseDown($event)" @mousemove="mousemove($event)" @mouseup="mouseup($event)" - >鎶辨瓑,鎮ㄧ殑娴忚鍣ㄤ笉鏀寔canvas!璇锋洿鎹㈡祻瑙堝櫒</canvas> - <div class="popup-box" :style="`top:${popPos.y + 10}px;left:${popPos.x - 70}px`" v-if="isPopup"> + >鎶辨瓑,鎮ㄧ殑娴忚鍣ㄤ笉鏀寔canvas!璇锋洿鎹㈡祻瑙堝櫒</canvas + > + <div + class="popup-box" + :style="`top:${popPos.y + 10}px;left:${popPos.x - 70}px`" + v-if="isPopup" + > <div> <b>寮�濮嬫椂闂�:</b> <input @@ -37,7 +44,7 @@ <b>:</b> <input v-model="changeTime.endMin" type="number" placeholder="鍒�" /> </div> - <div style="margin-top:5px;"> + <div style="margin-top: 5px"> <el-button @click="deleteRange">鍒犻櫎</el-button> <el-button @click="cancalPop">鍙栨秷</el-button> <el-button @click="timeAck">纭畾</el-button> @@ -49,7 +56,6 @@ <script> export default { mounted() { - this.initMain(); this.initMainDummy(); }, @@ -71,43 +77,43 @@ isPopup: false, popPos: { x: "", - y: "" + y: "", }, changeTime: { startHour: "", startMin: "", endHour: "", - endMin: "" + endMin: "", }, rangeArrBackup: "", styleClass: { weekTextColor: "", minutePerColor: "#cdcdcd", - minutePerTextColor: "#808080" - } + minutePerTextColor: "#808080", + }, }; }, props: { timeData: { - default: () => { }, - type: Array + default: () => {}, + type: Array, }, mainId: { type: String, - default: "" + default: "", }, itemId: { type: String, - default: "" + default: "", }, itemName: { type: String, - default: "" + default: "", }, edit: { type: Boolean, - default: false - } + default: false, + }, }, watch: { changeTime: { @@ -131,24 +137,27 @@ } if (newVal.startMin > 60) { - newVal.startMin = 0 + newVal.startMin = 0; } if (newVal.startMin < 0) { - newVal.startMin = 60 + newVal.startMin = 60; } if (newVal.endMin > 60) { - newVal.endMin = 0 + newVal.endMin = 0; } if (newVal.endMin < 0) { - newVal.endMin = 0 + newVal.endMin = 0; } - if (parseInt(newVal.startHour) == parseInt(newVal.endHour) && parseInt(newVal.startMin) > parseInt(newVal.endMin)) { - newVal.startMin = 0 + if ( + parseInt(newVal.startHour) == parseInt(newVal.endHour) && + parseInt(newVal.startMin) > parseInt(newVal.endMin) + ) { + newVal.startMin = 0; } }, - deep: true - } + deep: true, + }, }, methods: { timeAck() { @@ -157,14 +166,24 @@ let perM = perH / 60; let tempRangeInfo = this.rangeArr[rangeInfo.ownedIndex].rangeInfo; - tempRangeInfo.maxX = this.changeTime.endHour * perH + this.changeTime.endMin * perM + 50.5; - tempRangeInfo.minX = this.changeTime.startHour * perH + this.changeTime.startMin * perM + 50.5; + tempRangeInfo.maxX = + this.changeTime.endHour * perH + this.changeTime.endMin * perM + 50.5; + tempRangeInfo.minX = + this.changeTime.startHour * perH + + this.changeTime.startMin * perM + + 50.5; tempRangeInfo.width = tempRangeInfo.maxX - tempRangeInfo.minX; for (let i = 0; i < this.gridArr.length; i++) { let num = 0; for (let j = 0; j < this.rangeArr.length; j++) { - if (this.gridArr[i].posIndex === this.rangeArr[j].rangeInfo.posIndex) { - this.gridArr[i].rangeList.splice(num, 1, this.rangeArr[j].rangeInfo); + if ( + this.gridArr[i].posIndex === this.rangeArr[j].rangeInfo.posIndex + ) { + this.gridArr[i].rangeList.splice( + num, + 1, + this.rangeArr[j].rangeInfo + ); num++; } } @@ -310,9 +329,11 @@ return; } this.actRange.rangeInfo.minX = tempMinxX; - this.actRange.rangeInfo.maxX = tempMinxX + this.actRange.rangeInfo.width; + this.actRange.rangeInfo.maxX = + tempMinxX + this.actRange.rangeInfo.width; this.currentPointX = e.offsetX; - let tempRangeList = this.gridArr[this.actRange.rangeInfo.posIndex].rangeList; + let tempRangeList = + this.gridArr[this.actRange.rangeInfo.posIndex].rangeList; this.redraw(); // console.log("move-ed"); } else if ( @@ -327,17 +348,17 @@ if ( this.actRange.rangeInfo.minX <= limit.limitLeft || this.actRange.rangeInfo.minX + this.actRange.rangeInfo.width >= - limit.limitRight + limit.limitRight ) { return; } - let tempX + let tempX; if (this.x < 50) { - tempX = 50 + tempX = 50; } else if (this.x > 650) { - tempX = 650 + tempX = 650; } else { - tempX = this.x + tempX = this.x; } let temp = tempX - this.currentPointX > 0 ? true : false; let newWith = 0; @@ -366,8 +387,8 @@ width: 10, height: 14, posIndex: this.actGrid.posIndex, - ownedIndex: 0 - } + ownedIndex: 0, + }, }; let actRangeIndex = 0; for (let i = 0; i < tempRangeList.length; i++) { @@ -395,9 +416,8 @@ } } } - this.actGrid.rangeList = this.gridArr[ - this.actGrid.posIndex - ].rangeList; + this.actGrid.rangeList = + this.gridArr[this.actGrid.posIndex].rangeList; this.actRange = this.rangeArr[this.actRangeIndex]; this.isCreate = true; } @@ -412,7 +432,7 @@ if ( (this.actRange.rangeInfo.minX <= limit.limitLeft || this.actRange.rangeInfo.minX + this.actRange.rangeInfo.width >= - limit.limitRight) && + limit.limitRight) && this.noLimit > 5 ) { this.isResizeRight = false; @@ -441,7 +461,8 @@ return; } this.actRange.rangeInfo.maxX = this.x > 650 ? 650 : this.x; - this.actRange.rangeInfo.width = this.actRange.rangeInfo.maxX - this.actRange.rangeInfo.minX; + this.actRange.rangeInfo.width = + this.actRange.rangeInfo.maxX - this.actRange.rangeInfo.minX; this.noLimit++; this.redraw(); return; @@ -486,7 +507,7 @@ let behind = this.rangeArr[this.actRangeIndex + 1]; let obj = { limitLeft: 50, - limitRight: 650 + limitRight: 650, }; if (before === undefined && behind === undefined) { return obj; @@ -579,7 +600,7 @@ width: 600, height: 14, posIndex: i, - rangeList: [] + rangeList: [], }; this.gridArr.push(tempGrid); let timePer = 600 / 24; @@ -629,7 +650,7 @@ width: diffRange, height: 14, posIndex: i, - ownedIndex: this.rangeArr.length + ownedIndex: this.rangeArr.length, }; rang[j].rangeInfo = rangeInfo; this.gridArr[i].rangeList.push(rangeInfo); @@ -655,10 +676,10 @@ minuteEnd = minuteEnd < 10 ? "0" + minuteEnd : minuteEnd; let textStart = `${hourStart < 10 ? "0" + hourStart : hourStart}:${ minutetStart === 60 ? "00" : minutetStart - }`; + }`; let textEnd = `${hourEnd < 10 ? "0" + hourEnd : hourEnd}:${ minuteEnd === 60 ? "00" : minuteEnd - }`; + }`; let startPointX = rangeInfo.minX - 14; let startPointY = rangeInfo.maxY + 10; let endPointX = rangeInfo.maxX - 13; @@ -684,7 +705,7 @@ day: i + 1, time_range: (() => { let range = []; - this.rangeArr.forEach(item => { + this.rangeArr.forEach((item) => { if (item.rangeInfo.posIndex === i) { let rangeInfo = item.rangeInfo; let hourStart = parseInt((rangeInfo.minX - 50.5) / (600 / 24)); @@ -702,23 +723,23 @@ minuteEnd = minuteEnd < 10 ? "0" + minuteEnd : minuteEnd; range.push({ start: hourStart + ":" + minutetStart, - end: hourEnd + ":" + minuteEnd + end: hourEnd + ":" + minuteEnd, }); } }); return range; - })() + })(), }); } let obj = { id: this.itemId, name: this.itemName, - time_rule: timeRule + timeRule: timeRule, }; this.$emit("range-update", obj); - } - } + }, + }, }; </script> diff --git a/src/components/subComponents/SystemInfo.vue b/src/components/subComponents/SystemInfo.vue index caf8c84..8863800 100644 --- a/src/components/subComponents/SystemInfo.vue +++ b/src/components/subComponents/SystemInfo.vue @@ -1,13 +1,10 @@ <template> - <div - class="chart" - v-if="PollData.barCharts && PollData.barCharts.length !== 0" - > + <div class="chart" v-if="PollData.barCharts"> <!-- 鍐呭瓨杩涘害鏉� --> <div class="row"> <div class="label">鍐呭瓨</div> <el-progress - :percentage="PollData.barCharts[3]" + :percentage="+PollData.barCharts[3]" :stroke-width="stroke" :show-text="false" ></el-progress> @@ -17,7 +14,7 @@ <div class="row"> <div class="label">绠楀姏</div> <el-progress - :percentage="PollData.barCharts[2]" + :percentage="+PollData.barCharts[2]" :stroke-width="stroke" :show-text="false" ></el-progress> @@ -27,7 +24,7 @@ <div class="row"> <div class="label">CPU</div> <el-progress - :percentage="PollData.barCharts[1]" + :percentage="+PollData.barCharts[1]" :stroke-width="stroke" :show-text="false" ></el-progress> @@ -37,7 +34,7 @@ <div class="row"> <div class="label">纭洏</div> <el-progress - :percentage="PollData.barCharts[0]" + :percentage="+PollData.barCharts[0]" :stroke-width="stroke" :show-text="false" ></el-progress> diff --git a/src/main.ts b/src/main.ts index 885a4d8..dbb832e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,6 +11,8 @@ import * as VueWindow from "@hscmap/vue-window"; import VueAwesomeSwiper from "vue-awesome-swiper"; +import ToggleButton from 'vue-js-toggle-button'; + import "swiper/dist/css/swiper.css"; @@ -22,6 +24,8 @@ Vue.use(preview); Vue.use(VueWindow); Vue.use(VueAwesomeSwiper as any); +Vue.use(ToggleButton) + diff --git a/src/scripts/httpRequest.ts b/src/scripts/httpRequest.ts index 194dfe6..848eba0 100644 --- a/src/scripts/httpRequest.ts +++ b/src/scripts/httpRequest.ts @@ -12,27 +12,24 @@ /* //POST浼犲弬搴忓垪鍖�(娣诲姞璇锋眰鎷︽埅鍣�) */ Axios.interceptors.request.use( config => { - // config.data = JSON.stringify(config.data) - // let Public = {}; - // if ( - // config.method === "post" || - // config.method === "put" || - // config.method === "delete" - // ) { - // // 搴忓垪鍖� - // // config.data = qs.stringify(config.data); - // // config.data = qs.stringify(Object.assign(Public, config.data)); - // } else { - // config.method = "get"; - // config.params = Object.assign(Public, config.data); - // } - // config.headers = { - // "X-Requested-With": "XMLHttpRequest", - // Accept: "application/json", - // "Content-Type": "application/json; charset=UTF-8" - // }; + if ( + config.method === "post" && + sessionStorage.getItem('clusterId') || + sessionStorage.getItem('devId') + ) { + if( !config.data ) { + config.data = {} + } + + if(typeof config.data == 'object' ) { + config.data.clusterId = sessionStorage.getItem('clusterId') + config.data.devId = sessionStorage.getItem('devId') + } + + } // 鑻ユ槸鏈夊仛閴存潈token , 灏辩粰澶撮儴甯︿笂token + let token = sessionStorage.getItem('loginedInfo') && JSON.parse(sessionStorage.getItem('loginedInfo')).access_token @@ -42,6 +39,10 @@ return config }, error => { + console.log('璇锋眰閿欒'); + console.log(error); + + /* Message({ showClose: true, message: "鎻愪氦鍑洪敊锛岃鑱旂郴绠$悊鍛橈紒", @@ -86,8 +87,13 @@ /* //return res.data ? res.data : {}; */ }, error => { + console.log('鍝嶅簲閿欒'); + console.log(error); let errJson: any = { success: false + } + if(error && error.response&&error.response.status == 404) { + return } // 涓嬮潰鏄帴鍙e洖璋冪殑satus ,鍥犱负鎴戝仛浜嗕竴浜涢敊璇〉闈�,鎵�浠ラ兘浼氭寚鍚戝搴旂殑鎶ラ敊椤甸潰 if (error && error.response) { @@ -164,7 +170,6 @@ // path: '/login' // }); } - console.log(error.response); if(error.response&&error.response.data&&!error.response.data.success ) { errJson.message =error.response.data.msg diff --git a/src/views/equipmentManagement/algorithmDetail/components/Card.vue b/src/views/equipmentManagement/algorithmDetail/components/Card.vue index eaea749..4b3fd6e 100644 --- a/src/views/equipmentManagement/algorithmDetail/components/Card.vue +++ b/src/views/equipmentManagement/algorithmDetail/components/Card.vue @@ -17,7 +17,7 @@ <div class="realTime" v-if="realTime">瀹炴椂</div> <div class="poll" v-if="poll">杞</div> <div class="analyse" v-if="analyse">姝e湪鍒嗘瀽</div> - <div class="update" v-if="update">鍙崌绾�</div> + <div class="update" v-if="data.isUpgrade">鍙崌绾�</div> </div> </div> </div> @@ -25,7 +25,7 @@ <ul class="info"> <li> <div class="label">瀹夎鏃堕棿:</div> - <div class="data">{{ data.update_time }}</div> + <div class="data">{{ data.create_time }}</div> </li> <li> @@ -56,45 +56,41 @@ </template> <script> -import { unInstallSdk, unInstallApp, installAppSdk } from "@/api/device"; +//搴旂敤鍗歌浇 +import { unInstallApp } from "@/api/device"; +//绠楁硶鍗囩骇鍗歌浇 +import { downloadOrUpgrade, unInstall } from "@/api/algorithm"; export default { props: { data: {}, type: {}, - address: {}, + id: {}, }, data() { return { - realTime: true, + realTime: false, poll: false, - analyse: true, - update: true, + analyse: false, }; }, - created() { - console.log(this.data); - }, + created() {}, methods: { + //鍗囩骇 async upgrade() { - const res = await installAppSdk({ - ip: this.address.ip, - port: this.address.port, - id: this.data.id, + const res = await downloadOrUpgrade({ + nodeId: this.id, + path: this.data.id, + userId: JSON.parse(sessionStorage.getItem("userInfo")).id, }); - - if (res.success) { - this.$message({ + if (res && res.success) { + this.$notify({ type: "success", - message: "鍗囩骇鎴愬姛!", - }); - } else { - this.$message({ - type: "info", - message: "鍗囩骇澶辫触", + message: "鎿嶄綔鎴愬姛,璇风◢鍚�", }); } }, + //鍗歌浇 unInstall() { this.$confirm(`鏄惁鍗歌浇璇�${this.type == "sdk" ? "绠楁硶" : "搴旂敤"}`, { confirmButtonText: "纭鍗歌浇", @@ -103,27 +99,24 @@ customClass: "uninstallBox", }) .then(async () => { + //鍗歌浇绠楁硶 if (this.type == "sdk") { - const res = await unInstallSdk({ - ip: this.address.ip, - port: this.address.port, + const res = await unInstall({ + nodeId: this.id, sdkId: this.data.id, + userId: JSON.parse(sessionStorage.getItem("userInfo")).id, }); - if (res.success) { - this.$message({ + if (res && res.success) { + this.$emit("unInstall"); + this.$notify({ type: "success", - message: "鍒犻櫎鎴愬姛!", - }); - } else { - this.$message({ - type: "info", - message: "鍒犻櫎澶辫触", + message: "鍗歌浇鎴愬姛", }); } + //鍗歌浇搴旂敤 } else if (this.type == "app") { const res = await unInstallApp({ - ip: this.address.ip, - port: this.address.port, + nodeId: this.id, appId: this.data.id, }); if (res.success) { diff --git a/src/views/equipmentManagement/algorithmDetail/index.vue b/src/views/equipmentManagement/algorithmDetail/index.vue index fb217af..af52910 100644 --- a/src/views/equipmentManagement/algorithmDetail/index.vue +++ b/src/views/equipmentManagement/algorithmDetail/index.vue @@ -51,7 +51,7 @@ :key="index" :data="item" :type="'sdk'" - :address="{ ip: ip, port: port }" + :id="id" ></Card> </div> <el-select @@ -78,7 +78,7 @@ :data="item" :key="index" :type="'app'" - :address="{ ip: ip, port: port }" + :id="id" ></Card> </div> <el-select @@ -108,11 +108,15 @@ import Card from "@/views/equipmentManagement/algorithmDetail/components/Card"; export default { created() { + this.userId = JSON.parse(sessionStorage.getItem("userInfo")).id; + this.id = this.$route.query.id; this.getData(); }, data() { return { deviceData: {}, + userId: null, + id: null, applicationInfo: [ { label: "绠楁硶鎬绘暟", @@ -148,13 +152,12 @@ { value: "all", label: "鍏ㄩ儴搴旂敤" }, { value: "update", label: "寰呭崌绾у簲鐢�" }, ], //搴旂敤涓嬫媺妗嗛�夐」 - ip: this.$route.query.ip, - port: this.$route.query.port, - id: this.$route.query.id, + activeApp: [], upgradeApp: [], activeSdk: [], upgradeSdk: [], + enableSdk: [], time: "", }; }, @@ -174,13 +177,16 @@ //鑾峰彇搴旂敤鍒楄〃 async getApp() { - const res = await findAllApp({ ip: this.ip, port: this.port }); - res.data.data.forEach((item) => { + const res = await findAllApp({ userId: "", nodeId: this.id }); + res.data.forEach((item) => { if (item.installed) { this.activeApp.push(item); } if (item.installed && item.isUpgrade) { this.upgradeApp.push(item); + } + if (item.installed && item.enable) { + this.enableSdk.push(item); } }); @@ -190,14 +196,12 @@ this.applicationInfo[3].count = this.upgradeApp.length ? this.upgradeApp.length : 0; - - console.log(this.applicationInfo); }, //鑾峰彇绠楁硶鍒楄〃 async getSdk() { - const res2 = await findAllSdk({ ip: this.ip, port: this.port }); - res2.data.data.forEach((item) => { + const res2 = await findAllSdk({ userId: "", nodeId: this.id }); + res2.data.forEach((item) => { if (item.installed) { this.activeSdk.push(item); } @@ -222,7 +226,7 @@ //鑾峰彇璁惧鏃堕棿鎴� async getTime() { - const res = await clockInfo({ ip: this.ip, port: this.port }); + const res = await clockInfo({ userId: this.userId, nodeId: this.id }); if (res && res.success) { // const timezone = res.data.time_zone; let timestamp = res.data.local_time; @@ -260,6 +264,10 @@ return this.upgradeSdk; } + if (this.algorithm == "process") { + return this.enableSdk; + } + return []; }, applicationArr() { diff --git a/src/views/equipmentManagement/equipmentDetail/components/FormArea.vue b/src/views/equipmentManagement/equipmentDetail/components/FormArea.vue index 6543286..e89f41a 100644 --- a/src/views/equipmentManagement/equipmentDetail/components/FormArea.vue +++ b/src/views/equipmentManagement/equipmentDetail/components/FormArea.vue @@ -3,7 +3,9 @@ <div class="title">绠楁硶鍗犵敤鐨勮祫婧�</div> <div class="formAlgorithm"> <div class="formHead"> - 绠楁硶鍗曞厓<span class="des">姝e湪杩涜5涓畻娉曞崟鍏�</span> + 绠楁硶鍗曞厓<span class="des" + >姝e湪杩涜{{ data.algos.length }}涓畻娉曞崟鍏�</span + > </div> <el-table :data="data.algos" stripe style="width: 100%"> <el-table-column prop="name" label="鍚嶇О" width="206" class-name="name"> @@ -35,7 +37,9 @@ <div class="formApplication"> <div class="formHead"> - 搴旂敤鍗曞厓<span class="des">姝e湪杩涜5涓簲鐢ㄥ崟鍏�</span> + 搴旂敤鍗曞厓<span class="des" + >姝e湪杩涜{{ data.apps.length }}涓簲鐢ㄥ崟鍏�</span + > </div> <el-table :data="data.apps" stripe style="width: 100%"> <el-table-column prop="name" label="鍚嶇О" width="206" class-name="name"> diff --git a/src/views/equipmentManagement/equipmentDetail/components/SettingBox.vue b/src/views/equipmentManagement/equipmentDetail/components/SettingBox.vue index 23281ed..3e02336 100644 --- a/src/views/equipmentManagement/equipmentDetail/components/SettingBox.vue +++ b/src/views/equipmentManagement/equipmentDetail/components/SettingBox.vue @@ -78,9 +78,7 @@ export default { name: "SettingBox", props: { - device: { - type: Object, - }, + id: {}, }, created() { let mins = []; @@ -155,8 +153,7 @@ if (this.every === "close") { this.cronText = ""; const res = await setRestartTask({ - ip: this.device.ip, - port: this.device.port, + nodeId: this.id, task: "", }); if (res.success) { @@ -200,8 +197,7 @@ " " + obj.week; const res = await setRestartTask({ - ip: this.device.ip, - port: this.device.port, + nodeId: this.id, task: this.cronText, }); @@ -220,8 +216,8 @@ }, async getTask() { const res = await getRestartTask({ - ip: this.device.ip, - port: this.device.port, + nodeId: this.id, + userId: JSON.parse(sessionStorage.getItem("userInfo")).id, }); this.rebootCron = res.data; this.resolveExp(); diff --git a/src/views/equipmentManagement/equipmentDetail/components/UnbindBox.vue b/src/views/equipmentManagement/equipmentDetail/components/UnbindBox.vue index ea90873..cc12cf9 100644 --- a/src/views/equipmentManagement/equipmentDetail/components/UnbindBox.vue +++ b/src/views/equipmentManagement/equipmentDetail/components/UnbindBox.vue @@ -33,9 +33,10 @@ let res = {}; try { res = await unbind({ - ids: [this.id], + id: this.id, password: this.password, username: JSON.parse(sessionStorage.getItem("userInfo")).username, + userId: JSON.parse(sessionStorage.getItem("userInfo")).id, }); } catch (err) { this.$notify({ diff --git a/src/views/equipmentManagement/equipmentDetail/components/UpdateBox.vue b/src/views/equipmentManagement/equipmentDetail/components/UpdateBox.vue index d6b6a31..1094ec6 100644 --- a/src/views/equipmentManagement/equipmentDetail/components/UpdateBox.vue +++ b/src/views/equipmentManagement/equipmentDetail/components/UpdateBox.vue @@ -18,6 +18,7 @@ export default { props: { device: {}, + id: {}, }, data() { return { @@ -31,11 +32,15 @@ }, async updateVersion() { this.loadingStatus = 1; - await updateVersion(); + await updateVersion({ + nodeId: this.id, + }); this.check(); }, async check() { - const res = await checkVersion(); + const res = await checkVersion({ + nodeId: this.id, + }); if (res.data.hasNewVersion) { this.timer = setTimeout(() => { this.check(); diff --git a/src/views/equipmentManagement/equipmentDetail/index.vue b/src/views/equipmentManagement/equipmentDetail/index.vue index dd7d031..18f3c04 100644 --- a/src/views/equipmentManagement/equipmentDetail/index.vue +++ b/src/views/equipmentManagement/equipmentDetail/index.vue @@ -62,6 +62,7 @@ :stroke-width="25" stroke-linecap="butt" class="type1" + :class="{ warn: item.data >= 85 }" ></el-progress> <el-progress @@ -73,6 +74,7 @@ :stroke-width="25" stroke-linecap="butt" class="type2" + :class="{ warn: item.data >= 85 }" ></el-progress> <el-progress @@ -83,7 +85,8 @@ :width="100" :stroke-width="25" stroke-linecap="butt" - class="type3 warn" + class="type3" + :class="{ warn: item.data >= 85 }" ></el-progress> <el-progress @@ -95,6 +98,7 @@ :stroke-width="25" stroke-linecap="butt" class="type4" + :class="{ warn: item.data >= 85 }" ></el-progress> <div class="label">{{ item.name }}</div> </div> @@ -250,7 +254,7 @@ <!-- 瑙g粦寮圭獥 --> <UnbindBox v-if="showUnbindBox" - :id="ndid" + :id="id" @close="showUnbindBox = false" ></UnbindBox> @@ -258,14 +262,14 @@ <SettingBox v-if="showSettingBox" @close="showSettingBox = false" - :device="{ id: id, ip: ip, port: port }" + :id="id" ></SettingBox> <!-- 鏇存柊寮圭獥 --> <UpdateBox v-if="showUpdateBox" @close="closeUpdateBox" - :device="{ ip: this.ip, port: this.port }" + :id="id" ></UpdateBox> <Footer :isBlack="true"></Footer> @@ -305,10 +309,8 @@ }, data() { return { + userId: null, id: null, - ip: null, - port: null, - ndid: null, time: "", detailData: {}, //鍥涗釜鐜舰杩涘害鏉¢鑹� @@ -339,21 +341,22 @@ methods: { //鑾峰彇璁惧璇︽儏 async findDetail() { + this.userId = JSON.parse(sessionStorage.getItem("userInfo")).id; this.id = this.$route.query.id; - this.ndid = this.$route.query.ndid; - this.ip = this.$route.query.ip; - this.port = this.$route.query.port; const res = await findDevDetail({ devId: this.id }); this.detailData = res.data; }, //鑾峰彇鐗堟湰淇℃伅 async getVersion() { - const res = await checkVersion({ ip: this.ip, port: this.port }); + const res = await checkVersion({ nodeId: this.id }); this.versionInfo = res.data; }, //鑾峰彇璁惧鎬ц兘 async getDevicePerformance() { - const res = await showSystemStates({ ip: this.ip, port: this.port }); + const res = await showSystemStates({ + userId: this.userId, + nodeId: this.id, + }); this.devicePerformance.push({ data: res.data.mem.usedPercent.toString().split(".")[0], name: "鍐呭瓨", @@ -391,13 +394,13 @@ }, //鑾峰彇绠楁硶鎵�鍗犺祫婧� async showProcesses() { - const res = await showProcesses({ ip: this.ip, port: this.port }); + const res = await showProcesses({ userId: this.userId, nodeId: this.id }); console.log(res.data); this.deviceProcesses = res.data; }, //鑾峰彇璁惧鏃堕棿鎴� async getTime() { - const res = await clockInfo({ ip: this.ip, port: this.port }); + const res = await clockInfo({ userId: this.userId, nodeId: this.id }); if (res && res.success) { // const timezone = res.data.time_zone; let timestamp = res.data.local_time; @@ -432,7 +435,7 @@ type: "warning", }) .then(async () => { - const res = await restart({ ip: this.ip, port: this.port }); + const res = await restart({ userId: this.userId, nodeId: this.id }); if (res.success) { this.$notify({ title: "鎴愬姛", @@ -562,7 +565,7 @@ margin-right: 22px; .label { - margin-top: 10px; + margin-top: 5px; text-align: center; } @@ -598,7 +601,7 @@ stroke: rgb(241, 215, 245); } .warn ::v-deep .el-progress-circle__track { - stroke: rgb(250, 215, 210); + stroke: rgb(250, 215, 210) !important; } } diff --git a/src/views/equipmentManagement/equipmentList/components/AddBox.vue b/src/views/equipmentManagement/equipmentList/components/AddBox.vue index 86a3bdb..24e66fe 100644 --- a/src/views/equipmentManagement/equipmentList/components/AddBox.vue +++ b/src/views/equipmentManagement/equipmentList/components/AddBox.vue @@ -1,6 +1,6 @@ <template> <div class="addBox"> - <div class="title">鍔犲叆闆嗙兢</div> + <div class="title">娣诲姞璁惧</div> <div class="close iconfont" @click="close()"></div> @@ -9,8 +9,8 @@ v-model="searchContent" placeholder="璇疯緭鍏ラ泦缇P/闆嗙兢鍚嶇О/璁惧IP/璁惧鍚嶇О" ></el-input> - <div class="button" @click="listType = 'cluster'">鎼滅储闆嗙兢</div> - <div class="button" @click="listType = 'equipment'">鎼滅储璁惧</div> + <div class="button" @click="searchCluster">鎼滅储闆嗙兢</div> + <div class="button" @click="searchDevice">鎼滅储璁惧</div> </div> <div class="clusterList"> @@ -28,21 +28,28 @@ <div class="row" v-for="(item, index) in clusterList" :key="index"> <div class="content"> <div class="rowItem index">{{ index + 1 }}</div> - <div class="rowItem name">{{ item.name }}</div> - <div class="rowItem ip">{{ item.ip }}</div> + <div class="rowItem name">{{ item.clusterName }}</div> + <div class="rowItem ip">{{ item.virtualIp }}</div> <div class="rowItem status"> - <div v-if="item.status == 1" class="status green">宸叉坊鍔�</div> + <div v-if="!item.canAdd" class="status green">宸叉坊鍔�</div> <div v-else class="status">鏈坊鍔�</div> </div> <div class="rowItem options"> <!-- 娣诲姞 --> - <span class="iconfont option" @click="showPasswordBox = true" - ></span - > - <!-- 闆嗙兢璇︽儏 --> - <span class="iconfont option" @click="showChildrenLIst(index)" - ></span - > + <span v-if="!item.canAdd">-</span> + <template v-else> + <span + class="iconfont option" + @click="showBox('cluster', item.clusterId)" + ></span + > + <!-- 闆嗙兢璇︽儏 --> + <span + class="iconfont option" + @click="showChildrenLIst(index, item.clusterId)" + ></span + > + </template> </div> </div> @@ -63,19 +70,19 @@ > </el-table-column> <el-table-column - prop="id" + prop="dev_id" label="璁惧ID" width="146" ></el-table-column> <el-table-column - prop="ip" + prop="dev_ip" label="璁惧IP" width="146" ></el-table-column> <el-table-column - prop="name" + prop="dev_name" label="璁惧鍚嶇О" width="240" ></el-table-column> @@ -101,21 +108,29 @@ class-name="index" > </el-table-column> - <el-table-column prop="id" label="璁惧ID" width="107"></el-table-column> <el-table-column - prop="name" + prop="devId" + label="璁惧ID" + width="107" + ></el-table-column> + <el-table-column + prop="devName" label="璁惧鍚嶇О" width="107" ></el-table-column> - <el-table-column prop="ip" label="璁惧IP" width="107"></el-table-column> <el-table-column - prop="cluster" + prop="devIp" + label="璁惧IP" + width="107" + ></el-table-column> + <el-table-column + prop="clusterName" label="鎵�灞為泦缇�" width="107" ></el-table-column> <el-table-column label="鐘舵��" width="107"> <template slot-scope="scope"> - <div v-if="scope.row.status == 1" class="status green">宸叉坊鍔�</div> + <div v-if="!scope.row.canAdd" class="status green">宸叉坊鍔�</div> <div v-else class="status">鏈坊鍔�</div> </template> </el-table-column> @@ -124,7 +139,11 @@ <template slot-scope="scope"> <div class="options" v-if="scope"> <!-- 娣诲姞 --> - <span class="iconfont option" @click="showPasswordBox = true" + <span v-if="!scope.row.canAdd">-</span> + <span + v-else + class="iconfont option" + @click="showBox('dev', scope.row.devId, scope.row.clusterId)" ></span > </div> @@ -144,13 +163,21 @@ <el-input v-model="auth_password"></el-input> <div class="btns"> <div class="cancel button" @click="showPasswordBox = false">鍙栨秷</div> - <div class="submit button" @click="showPasswordBox = false">鎻愪氦</div> + <div class="submit button" @click="submit">鎻愪氦</div> </div> </div> </div> </template> <script> +import { + findDeviceListAll, + findClustersBySearch, + getDevicesByCluster, + addCluster, + addDeviceToUser, +} from "@/api/device"; + export default { data() { return { @@ -159,131 +186,19 @@ showClusterChild: null, //灞曠ず闆嗙兢鍒楄〃涓嬫媺鍒楄〃 clusterHeader: ["搴忓彿", "闆嗙兢鍚嶇О", "IP鍦板潃", "鐘舵��", "鎿嶄綔"], //闆嗙兢鍒楄〃琛ㄥご showPasswordBox: false, - clusterList: [ - { - name: "闆嗙兢1", - ip: "192.168.7.45", - status: "1", - }, - { - name: "闆嗙兢1", - ip: "192.168.7.45", - status: "1", - }, - { - name: "闆嗙兢1", - ip: "192.168.7.45", - status: "0", - }, - { - name: "闆嗙兢1", - ip: "192.168.7.45", - status: "0", - }, - ], - equipmentList: [ - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - ], - overList: [ - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - { - id: "BJS23123132", - name: "鏈嶅姟鍣�20.10", - ip: "192.168.7.45", - cluster: "闆嗙兢1", - status: "1", - }, - ], + clusterList: [], + equipmentList: [], + overList: [], auth_password: "", //鎺堟潈绉橀挜 + addObj: {}, }; }, + methods: { close() { this.$emit("close"); }, - showChildrenLIst(index) { + async showChildrenLIst(index, id) { if (this.showClusterChild === index) { this.showClusterChild = null; return; @@ -294,6 +209,68 @@ setTimeout(() => { this.showClusterChild = index; }, 400); + + const res = await getDevicesByCluster({ + clusterId: id, + }); + if (res && res.success) { + this.overList = res.data.list; + } + }, + async getCluster() { + const res = await findClustersBySearch({ + InputText: this.searchContent, + Page: 1, + Size: 10000, + }); + if (res && res.success) { + this.clusterList = res.data.list; + } + }, + + async getDevice() { + const res = await findDeviceListAll({ + InputText: this.searchContent, + Page: 1, + Size: 10000, + }); + if (res && res.success) { + this.equipmentList = res.data.list; + } + }, + + searchCluster() { + this.getCluster(); + this.listType = "cluster"; + }, + + searchDevice() { + this.getDevice(); + this.listType = "equipment"; + }, + + async submit() { + if (this.addObj.type == "cluster") { + const res = await addCluster({ + clusterPwd: this.auth_password, + clusterId: this.addObj.id, + }); + } else { + const res = await addDeviceToUser({ + clusterPwd: this.auth_password, + deviceId: this.addObj.id, + clusterId: this.addObj.cid, + }); + } + }, + showBox(type, id, cid) { + console.log(cid); + this.showPasswordBox = true; + this.addObj = { + type, + id, + cid, + }; }, }, }; diff --git a/src/views/equipmentManagement/equipmentList/components/FormList.vue b/src/views/equipmentManagement/equipmentList/components/FormList.vue index 347be27..2185910 100644 --- a/src/views/equipmentManagement/equipmentList/components/FormList.vue +++ b/src/views/equipmentManagement/equipmentList/components/FormList.vue @@ -114,14 +114,14 @@ <el-table-column label="鎿嶄綔" min-width="180"> <template slot-scope="scope"> <!-- 鍔犲叆 --> - <span class="iconfont option" @click="joinCluster(scope.row)" + <span + class="iconfont option" + @click="joinCluster(scope.row)" + v-if="scope.row.clusterId" ></span > <!-- 閫�鍑� --> - <span - class="iconfont option" - @click="quitCluster(scope.row)" - v-if="false" + <span class="iconfont option" @click="quitCluster(scope.row)" v-else ></span > <!-- 绠楁硶璇︽儏 --> @@ -181,7 +181,7 @@ </template> <script> -import { findDevList } from "@/api/device"; +import { findDevList, findClustersBySearch } from "@/api/device"; import AddBox from "@/views/equipmentManagement/equipmentList/components/AddBox"; import UnbindBox from "@/views/equipmentManagement/equipmentDetail/components/UnbindBox"; import QuitClusterBox from "@/views/equipmentManagement/equipmentList/components/QuitClusterBox"; @@ -192,6 +192,9 @@ UnbindBox, QuitClusterBox, JoinClusterBox, + }, + created() { + this.getCluster(); }, data() { return { @@ -207,16 +210,7 @@ isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥 isShowUnbind: false, //鏄惁灞曠ず瑙g粦寮圭獥 unbindId: "", - clusterArr: [ - { - value: 0, - label: "闆嗙兢1", - }, - { - value: 1, - label: "闆嗙兢2", - }, - ], //鎵�灞為泦缇や笅鎷夋 + clusterArr: [], //鎵�灞為泦缇や笅鎷夋 cluster: null, //閫変腑鐨勯泦缇ょ被鍨� showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥 showJoin: false, //灞曠ず鍔犲叆闆嗙兢鐨勫脊绐� @@ -224,15 +218,29 @@ }; }, methods: { + async getCluster() { + const res = await findClustersBySearch({ + InputText: "", + Page: 1, + Size: 10000, + userId: JSON.parse(sessionStorage.getItem("userInfo")).id, + }); + if (res && res.success) { + res.data.list.forEach((item) => { + this.clusterArr.push({ + label: item.clusterName, + value: item.clusterId, + }); + }); + } + }, + // 璺冲埌璁惧璇︽儏 checkDetail(row) { this.$router.push({ path: "/equipmentDetail", query: { id: row.devId, - ip: row.devIp, - port: row.serverPort, - ndid: row.id, }, }); }, @@ -243,8 +251,6 @@ path: "/algorithmDetail", query: { id: row.devId, - ip: row.devIp, - port: row.serverPort, }, }); }, @@ -291,39 +297,8 @@ //瑙g粦鎸夐挳 Untying(row) { console.log(row); - this.unbindId = row.id; + this.unbindId = row.devId; this.isShowUnbind = true; - /* this.$confirm( - "瑙g粦鍚庤璁惧灏嗕粠璁惧鍒楄〃涓Щ闄わ紝鏄惁纭鎿嶄綔?", - "瑙g粦鎻愮ず", - { - type: "warning", - center: true, - } - ) - .then(() => { - unbind({ ids: [row.id] }) - .then(() => { - this.$notify({ - type: "success", - message: "瑙g粦鎴愬姛", - duration: 2500, - offset: 57, - }); - this.searchingBtn(); - }) - .catch(() => { - this.$notify({ - type: "error", - message: "瑙g粦澶辫触锛岃鑱旂郴瀹㈡湇", - duration: 2500, - offset: 57, - }); - }); - }) - .catch((e) => { - console.log(e); - }); */ }, //鑾峰緱榛樿鏃堕棿 @@ -402,6 +377,26 @@ align-items: center; } + .cluster { + .el-select { + width: 200px; + height: 40px; + line-height: 40px; + + ::v-deep input { + height: 40px; + } + + .el-icon-arrow-up { + line-height: 40px; + } + + ::v-deep .el-icon-arrow-up { + height: 40px; + } + } + } + .id .el-input ::v-deep { width: 180px; } diff --git a/src/views/equipmentManagement/equipmentList/components/InfoCard.vue b/src/views/equipmentManagement/equipmentList/components/InfoCard.vue index 6098ced..785b95f 100644 --- a/src/views/equipmentManagement/equipmentList/components/InfoCard.vue +++ b/src/views/equipmentManagement/equipmentList/components/InfoCard.vue @@ -125,12 +125,9 @@ methods: { //鑾峰彇绠楁硶淇℃伅 async getAlg() { - const res = await findAllSdk({ - ip: this.node.devIp, - port: this.node.serverPort, - }); + const res = await findAllSdk({ userId: "", nodeId: this.node.devId }); - res.data.data.forEach((item) => { + res.data.forEach((item) => { //璁$畻绠楁硶鎬绘暟 if (item.installed) { this.algAll++; @@ -144,8 +141,8 @@ //鑾峰彇璁惧鎬ц兘 async getDevicePerformance() { const res = await showSystemStates({ - ip: this.node.devIp, - port: this.node.serverPort, + userId: "", + nodeId: this.node.devId, }); this.devicePerformance.push({ data: +res.data.mem.usedPercent.toString().split(".")[0], @@ -188,9 +185,6 @@ path: `/${type}`, query: { id: this.node.devId, - ip: this.node.devIp, - port: this.node.serverPort, - ndid: this.node.id, }, }); }, diff --git a/src/views/equipmentManagement/equipmentList/components/JoinClusterBox.vue b/src/views/equipmentManagement/equipmentList/components/JoinClusterBox.vue index 2b53c89..90bd0e4 100644 --- a/src/views/equipmentManagement/equipmentList/components/JoinClusterBox.vue +++ b/src/views/equipmentManagement/equipmentList/components/JoinClusterBox.vue @@ -1,5 +1,5 @@ <template> - <div class="QuitClusterBox" @click="showClusterList = false"> + <div class="JoinClusterBox" @click="showClusterList = false"> <div class="title">鍔犲叆闆嗙兢</div> <!-- 鍒囨崲tab --> <div class="tabs" :class="{ right: activeTab == '鍔犲叆宸叉湁闆嗙兢' }"> @@ -23,12 +23,15 @@ v-if="activeTab == '鍒涘缓闆嗙兢'" > <el-form-item prop="name" label="闆嗙兢鍚嶇О"> - <el-input v-model="formData.name" placeholder="璇疯緭鍏�"></el-input> + <el-input + v-model="formData.clustername" + placeholder="璇疯緭鍏�" + ></el-input> </el-form-item> <el-form-item prop="id" label="闆嗙兢ID"> <el-input - v-model="formData.id" + v-model="id" :disabled="true" placeholder="鍒涘缓闆嗙兢鍚庡洖鏄�" ></el-input> @@ -39,12 +42,12 @@ v-model="formData.password" placeholder="璇疯緭鍏�,鎴栫偣鍑荤敓鎴愬瘑鐮�" ></el-input> - <div class="createPassword">鐢熸垚瀵嗙爜</div> + <div class="createPassword" @click="generatePassword">鐢熸垚瀵嗙爜</div> </el-form-item> <el-form-item prop="ip" label="闆嗙兢IP"> <ip-input - :ip="formData.ip" + :ip="formData.virtualIp" :on-blur="onCreateIpBlur" class="ip-input-comp" ></ip-input> @@ -61,12 +64,12 @@ autocomplete="off" > <el-form-item prop="id" label="闆嗙兢ID"> - <el-input v-model="formData2.name" placeholder="璇疯緭鍏�"></el-input> + <el-input v-model="formData2.clusterId" placeholder="璇疯緭鍏�"></el-input> </el-form-item> <el-form-item prop="ip" label="IP鍦板潃"> <ip-input - :ip="formData2.ip" + :ip="formData2.nodeIps" :on-blur="onJoinIpBlur" class="ip-input-comp" ></ip-input> @@ -75,7 +78,7 @@ <el-form-item prop="password" label="闆嗙兢瀵嗙爜" class="password"> <el-input v-model="formData2.password" - placeholder="璇疯緭鍏�,鎴栫偣鍑荤敓鎴愬瘑鐮�" + placeholder="璇疯緭鍏�" class="passwordInput" :class="{ hiddenPassword: hiddenPassword }" > @@ -96,7 +99,7 @@ <el-form-item prop="ip" label="闆嗙兢IP"> <ip-input - :ip="formData2.clusterIp" + :ip="formData2.virtualIp" :on-blur="onClusterIpBlur" class="ip-input-comp" ></ip-input> @@ -107,8 +110,9 @@ class="clusterItem" v-for="(item, index) in clusterList" :key="index" + @click="join2(item)" > - {{ item }} + {{ item.clusterId }} </div> </div> </el-form> @@ -116,7 +120,7 @@ <!-- 鍙栨秷涓庢彁浜� --> <div class="btns"> <div class="cancel button" @click="close()">鍙栨秷</div> - <div class="quit button" @click="close()">閫�鍑洪泦缇�</div> + <div class="quit button" @click="submit">鍔犲叆闆嗙兢</div> </div> <div class="close iconfont" @click="close()"></div> @@ -124,30 +128,43 @@ </template> <script> +import { + createSerfCluster, + getSearchNodes, + findCluster, + joinCluster, +} from "@/api/clusterManage"; import ipInput from "@/components/IPInput"; export default { components: { ipInput, }, + props: { + equipment: {}, + }, + created() { + this.formData.nodeId = this.equipment.devId; + this.formData2.nodeId = this.equipment.devId; + }, data() { return { + id: "", tabArr: ["鍒涘缓闆嗙兢", "鍔犲叆宸叉湁闆嗙兢"], //tab鏍� activeTab: "鍒涘缓闆嗙兢", //閫変腑鐨則ab formData: { - name: "189闆嗙兢", - id: "5ee1dfa8-e3fb-4d62-8692-388d7632859b", - password: "123456", - ip: "192.168.20.117", + clustername: "", + password: "", + virtualIp: "", }, //鍒涘缓闆嗙兢琛ㄥ崟鏁版嵁 formData2: { - id: "", - ip: "", + clusterId: "", password: "", - clusterIp: "", + virtualIp: "", + nodeIps: "", }, //鍔犲叆闆嗙兢琛ㄥ崟鏁版嵁 hiddenPassword: false, //闅愯棌瀵嗙爜 - clusterList: ["192.168.20.4", "192.168.20.5", "192.168.20.6"], //闆嗙兢鍒楄〃 + clusterList: [], //闆嗙兢鍒楄〃 showClusterList: false, //鏄惁灞曠ず闆嗙兢鍒楄〃 }; }, @@ -157,27 +174,109 @@ }, //鍒涘缓闆嗙兢ip鍥炶皟 onCreateIpBlur(ip) { - this.formData.ip = ip; + this.formData.virtualIp = ip; }, //鍔犲叆闆嗙兢ip鍦板潃 onJoinIpBlur(ip) { - this.formData2.ip = ip; + this.formData2.nodeIps = ip; }, //鍔犲叆闆嗙兢闆嗙兢ip onClusterIpBlur(ip) { - this.formData2.clusterIp = ip; + this.formData2.virtualIp = ip; }, + //鎼滅储闆嗙兢鍒楄〃 - searchCluster(e) { + async searchCluster(e) { + this.clusterList = []; e.stopPropagation(); this.showClusterList = true; + let res = await getSearchNodes({ + nodeId: this.equipment.devId, + }); + if (res && res.success) { + res.data.forEach((item) => { + const obj = { + clusterId: item.clusterID, + nodeIps: [item.nodeAddress], + password: this.formData2.password, + nodeId: this.equipment.devId, + }; + this.clusterList.push(obj); + }); + } + }, + //鍒涘缓闆嗙兢 + async submitForm() { + const res = await createSerfCluster(this.formData); + this.findCluster(); + if (res && res.success) { + this.$notify({ + message: "鎿嶄綔鎴愬姛", + type: "success", + }); + } + this.close(); + }, + // 鐢熸垚瀵嗙爜 + generatePassword() { + var chars = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + var uuid = []; + + for (let i = 0; i < 6; i++) { + uuid[i] = chars[0 | (Math.random() * 50)]; + } + this.formData.password = uuid.join(""); + }, + async findCluster() { + let res = await findCluster({ + nodeId: this.equipment.devId, + }); + if (res && res.success) { + if (res.data && res.data.clusterId) { + this.id = res.data.clusterId; + } + } + }, + async join() { + let res = await joinCluster({ + clusterId: this.formData2.clusterId, + password: this.formData2.password, + virtualIp: this.formData2.virtualIp, + nodeIps: [this.formData2.nodeIps], + nodeId: this.equipment.devId, + }); + if (res && res.success) { + this.$notify({ + message: "鎿嶄綔鎴愬姛", + type: "success", + }); + } + this.close(); + }, + async join2(item) { + let res = await joinCluster(item); + if (res && res.success) { + this.$notify({ + message: "鎿嶄綔鎴愬姛", + type: "success", + }); + } + this.close(); + }, + submit() { + if (this.activeTab == "鍒涘缓闆嗙兢") { + this.submitForm(); + } else { + this.join(); + } }, }, }; </script> <style lang="scss" scoped> -.QuitClusterBox { +.JoinClusterBox { position: relative; box-sizing: border-box; padding: 20px; @@ -272,6 +371,7 @@ .createPassword { font-size: 14px; color: #0065ff; + cursor: pointer; } .search { @@ -307,6 +407,7 @@ box-shadow: 0px 4px 12px rgba(0, 43, 106, 0.12); .clusterItem { + font-size: 12px; padding-left: 10px; height: 40px; line-height: 40px; diff --git a/src/views/equipmentManagement/equipmentList/components/QuitClusterBox.vue b/src/views/equipmentManagement/equipmentList/components/QuitClusterBox.vue index 19dd78a..2a87edb 100644 --- a/src/views/equipmentManagement/equipmentList/components/QuitClusterBox.vue +++ b/src/views/equipmentManagement/equipmentList/components/QuitClusterBox.vue @@ -28,7 +28,7 @@ <div class="btns"> <div class="cancel button" @click="close()">鍙栨秷</div> - <div class="submit button" @click="close()">閫�鍑洪泦缇�</div> + <div class="submit button" @click="leave()">閫�鍑洪泦缇�</div> </div> <div class="close iconfont" @click="close()"></div> @@ -36,14 +36,21 @@ </template> <script> +import { findCluster, leave } from "@/api/clusterManage"; export default { + props: { + equipment: {}, + }, + created() { + this.getCluster(); + }, data() { return { formData: { - name: "189闆嗙兢", - id: "5ee1dfa8-e3fb-4d62-8692-388d7632859b", - password: "123456", - ip: "192.168.20.117", + name: "", + id: "", + password: "", + ip: "", }, }; }, @@ -51,6 +58,30 @@ close() { this.$emit("close"); }, + async getCluster() { + let res = await findCluster({ + nodeId: this.equipment.devId, + }); + if (res && res.success) { + if (res.data && res.data.clusterId) { + this.formData.name = res.data.clusterName; + this.formData.id = res.data.clusterId; + this.formData.password = "******"; + this.formData.ip = res.data.virtualIp; + } + } + }, + async leave() { + const res = await leave({ + nodeId: this.equipment.devId, + }); + if (res && res.success) { + this.$notify({ + message: "鎿嶄綔鎴愬姛", + type: "success", + }); + } + }, }, }; </script> diff --git a/src/views/hashrate/AlgManage/index.vue b/src/views/hashrate/AlgManage/index.vue index c09b0d0..9082156 100644 --- a/src/views/hashrate/AlgManage/index.vue +++ b/src/views/hashrate/AlgManage/index.vue @@ -10,7 +10,9 @@ <div class="algCard" v-for="(item, index) in payAlg" :key="index"> <img :src="item.logoUrl" alt="" draggable="false" /> <div class="name">{{ item.productName }}</div> - <span class="button pay">璐拱</span> + <span class="button pay" @click="toDetail(item.productName)" + >璐拱</span + > </div> </div> @@ -32,7 +34,9 @@ @dragstart="dragStart(item)" /> <div class="name">{{ item.productName }}</div> - <span class="button detail">鏌ョ湅璇︽儏</span> + <span class="button detail" @click="toDetail(item.productName)" + >鏌ョ湅璇︽儏</span + > </div> </div> </div> @@ -256,6 +260,14 @@ }); } }, + toDetail(productName) { + this.$router.push({ + path: "/productDetail", + query: { + name: productName, + }, + }); + }, }, }; </script> diff --git a/src/views/hashrate/CameraManage/CameraInfo/index.vue b/src/views/hashrate/CameraManage/CameraInfo/index.vue index b4d7ca1..62665ae 100644 --- a/src/views/hashrate/CameraManage/CameraInfo/index.vue +++ b/src/views/hashrate/CameraManage/CameraInfo/index.vue @@ -77,33 +77,6 @@ <el-form-item label="浜嬩欢澹伴煶"> <div class="flex-wrap"> <el-switch v-model="form.voiceEnable" :width="56"></el-switch> - <!-- 灞忚斀澹伴煶閫夋嫨,璋冩暣鍒板満鏅� --> - <!-- <el-select - v-model="voice" - placeholder="閫夋嫨澹伴煶" - size="small" - value-key="id" - @change="selSound" - > - <el-option - v-for="item in soundList" - :key="item.id" - :label="item.name" - :value="item" - ></el-option> - </el-select> - <span class="player-btn" @click="togglePlayer" style="cursor:pointer;"> - <i - v-if="togglePlay" - class="el-icon-video-play" - style="font-size:26px; vertical-align:middle; color:#409eff" - ></i> - <i - v-else - class="el-icon-video-pause" - style="font-size:26px; vertical-align:middle; color:#409eff" - ></i> - </span>--> </div> </el-form-item> </div> @@ -118,7 +91,7 @@ </el-form-item> </div> - <div class="row"> + <!-- <div class="row"> <el-form-item label="鎵�灞為泦缇�"> <el-select v-model="form.cluster" @@ -134,7 +107,7 @@ ></el-option> </el-select> </el-form-item> - </div> + </div> --> <!-- 娣诲姞浼犳劅鍣� --> <CameraInfoEditor @@ -277,6 +250,9 @@ type: Array, }, }, + created() { + document.querySelector("html").style["min-width"] = "1280px"; + }, data() { return { videoItem: null, @@ -350,7 +326,7 @@ getSoundList() .then((res) => { if (res.success) { - this.soundList = res.data; + this.soundList = res.data.voices; } }) .catch((e) => console.log(e)); @@ -396,16 +372,9 @@ this.$refs.addForm.resetFields(); this.voice = null; - // this.initFormData(); - // this.$refs.addForm.clearValidate(); if (node.type === "4") { - console.log(getCameraInfo); - getCameraInfo(node.id).then((res) => { if (res.success) { - // console.log(res, '鑾峰彇鎽勫儚鏈轰俊鎭�') - console.log(5555555); - if (res.data.resolutions) { let list = res.data.resolutions.map((i) => { let obj = {}; @@ -438,7 +407,7 @@ this.form.isAI = false; } this.form.resolution = - this.form.resolution_width + "*" + this.form.resolution_height; + this.form.resolutionWidth + "*" + this.form.resolutionHeight; }); } }); @@ -459,10 +428,10 @@ ? 0 : parseFloat(this.form.longitude); this.form.sensors = list; - this.form.resolution_width = Number( + this.form.resolutionWidth = Number( this.form.resolution.split("*")[0] ); - this.form.resolution_height = Number( + this.form.resolutionHeight = Number( this.form.resolution.split("*")[1] ); let _this = this; @@ -473,7 +442,16 @@ this.isGb28182 ); console.log(this.TreeDataPool.selectedNode); - updateCameraInfo(this.form) + + let tem = { + camera: this.form, + sensors: this.form.sensors, + areaid: this.form.areaid, + }; + tem.camera.clusterId = this.TreeDataPool.clusterId; + tem.camera.devId = this.TreeDataPool.devId; + + updateCameraInfo(tem) .then((rsp) => { if (rsp.success) { this.$notify({ @@ -506,7 +484,15 @@ }); } else { this.form.areaid = this.addParentId; - createCamera(this.form) + + let tem = { + camera: this.form, + sensors: this.form.sensors, + areaid: this.form.areaid, + }; + tem.camera.clusterId = this.TreeDataPool.clusterId; + tem.camera.devId = this.TreeDataPool.devId; + createCamera(tem) .then((rsp) => { if (rsp.success) { this.$notify({ @@ -543,11 +529,11 @@ name: this.form.name, rtsp: this.form.rtsp, id: this.form.id, - isRunning: this.form.run_enable, + isRunning: this.form.runEnable, cameraType: this.form.type, }; - console.log(this.videoItem.rtsp); + console.log(this.videoItem); }); }, // * 楠岃瘉蹇呴�夐」 @@ -574,7 +560,11 @@ cancelButtonClass: "comfirm-class-cancle", confirmButtonClass: "comfirm-class-sure", }).then(() => { - delCamera(this.form.id).then((res) => { + delCamera({ + id: this.form.id, + clusterId: this.TreeDataPool.clusterId, + devId: this.TreeDataPool.devId, + }).then((res) => { if (res.success) { this.initFormData(); this.$notify({ diff --git a/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue index 1ed8212..101188a 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/AddRuleBox.vue @@ -114,9 +114,6 @@ this.eventAudio.addEventListener("ended", () => { this.togglePlay = true; }); - if (this.editData.type) { - this.initEditData(); - } }, data() { return { @@ -172,6 +169,12 @@ voiceId: this.editData.rule.voiceId, index: this.editData.index, }; + this.soundList.forEach((item) => { + if (item.id == this.editData.rule.voiceId) { + this.ruleForm.voiceId = item.id; + this.ruleForm.voice = item; + } + }); }, getSounds() { let _this = this; @@ -179,8 +182,11 @@ .then((res) => { if (res.success) { _this.soundList = [{ id: "", name: "绌�", path: "" }].concat( - res.data + res.data.voices ); + if (_this.editData.type) { + _this.initEditData(); + } } }) .catch((e) => console.log(e)); diff --git a/src/views/hashrate/CameraManage/CameraRules/components/CameraBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/CameraBox.vue index 77bed71..1247b70 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/CameraBox.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/CameraBox.vue @@ -15,7 +15,7 @@ </div> <div class="body"> - <div class="row"> + <div class="row" v-if="camera.analytics"> <div class="label">澶勭悊鏂瑰紡:</div> <div class="button pollingBtn" @@ -36,10 +36,12 @@ <div class="label">鍒嗚鲸鐜�:</div> <div class="data"> {{ - camera.camearInfo.resolution_width == 0 || - camera.camearInfo.resolution_height == 0 + camera.camearInfo.resolutionWidth == 0 || + camera.camearInfo.resolutionHeight == 0 || + !camera.camearInfo.resolutionHeight || + !camera.camearInfo.resolutionWidth ? "鏈満鍒嗚鲸鐜�" - : `${camera.camearInfo.resolution_width} * ${camera.camearInfo.resolution_height}` + : `${camera.camearInfo.resolutionWidth} * ${camera.camearInfo.resolutionHeight}` }} </div> </div> diff --git a/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue index e666862..74bf857 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue @@ -35,15 +35,14 @@ </div> <div class="row"> <div class="label">鍒嗚鲸鐜�:</div> - <div - class="data" - v-if="camera.camearInfo.resolution_width != undefined" - > + <div class="data"> {{ - camera.camearInfo.resolution_width == 0 || - camera.camearInfo.resolution_height == 0 + !camera.camearInfo.resolutionWidth || + !camera.camearInfo.resolutionHeight || + camera.camearInfo.resolutionWidth == 0 || + camera.camearInfo.resolutionHeight == 0 ? "鏈満鍒嗚鲸鐜�" - : `${camera.camearInfo.resolution_width} * ${camera.camearInfo.resolution_height}` + : `${camera.camearInfo.resolutionWidth} * ${camera.camearInfo.resolutionHeight}` }} </div> </div> @@ -61,7 +60,7 @@ <script> import { changeRunType } from "@/api/pollConfig"; -import VideoRuleData from "@/Pool/VideoRuleData"; +import { getCameraInfo } from "@/api/camera"; export default { props: { @@ -184,12 +183,28 @@ }, getCameraInfo() { - this.cameras.forEach((id) => { - let newCamera = new VideoRuleData(id); - this.cameraArr.push(newCamera); + this.cameraArr = []; + this.cameras.forEach(async (id) => { + const rsp = await getCameraInfo(id); + if (rsp.success) { + this.cameraArr.push({ + cameraName: rsp.data.name ? rsp.data.name : "", + analytics: rsp.data.runType !== -1 ? true : false, + dealWay: rsp.data.runType !== 1 ? true : false, + camearInfo: { + resolutionWidth: rsp.data.resolutionWidth, + resolutionHeight: rsp.data.resolutionHeight, + }, + }); + } }); }, }, + watch: { + cameras() { + this.getCameraInfo(); + }, + }, }; </script> diff --git a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue index f385dce..f8d8476 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue @@ -87,6 +87,7 @@ </div> <div class="control"> <div class="title">鍦烘櫙鎿嶄綔</div> + <span class="close iconfont" @click="deleteRule"></span> <div class="content"> <div class="btns"> <div class="button cancel" @click="backToOrigin">鍙栨秷</div> @@ -100,12 +101,13 @@ <script> import bus from "@/plugin/bus"; -import { saveLinkScene, saveCameraScene } from "@/api/scene"; +import { saveLinkScene, saveCameraScene, deleteCameraScene } from "@/api/scene"; export default { props: { rule: {}, ruleType: {}, + cameraId: {}, }, created() { this.getSdkConnection(); @@ -204,36 +206,46 @@ }, save() { if (this.ruleType === "separate") { - this.rule.cameraIds = [this.rule.cameraId]; + this.rule.cameraIds = [this.cameraId]; saveCameraScene(this.rule).then((rsp) => { if (rsp && rsp.success) { this.$notify({ type: "success", message: "绛栫暐淇濆瓨鎴愬姛锛�", }); + this.backToOrigin(); } }); } else { - saveLinkScene(this.rule) - .then((rsp) => { - if (rsp && rsp.success) { - this.$notify({ - type: "success", - message: "浠诲姟淇濆瓨鎴愬姛锛�", - }); - } else { - this.$notify({ - type: "error", - message: rsp.data, - }); - } - }) - .catch((err) => { - this.$message({ - type: "error", - message: "淇濆瓨澶辫触锛�", + saveLinkScene(this.rule).then((rsp) => { + if (rsp && rsp.success) { + this.$notify({ + type: "success", + message: "浠诲姟淇濆瓨鎴愬姛锛�", }); - }); + this.backToOrigin(); + } else { + this.$notify({ + type: "error", + message: rsp.data, + }); + } + }); + } + }, + async deleteRule() { + if (!this.rule.id) { + console.log("87878"); + this.backToOrigin(); + return; + } + const res = await deleteCameraScene(this.rule.id); + if (res && res.success) { + this.$notify({ + type: "success", + message: "鍒犻櫎鎴愬姛", + }); + this.$emit("deletRule"); } }, update() { @@ -387,8 +399,18 @@ } .control { + position: relative; width: 128px; + .close { + position: absolute; + top: 12px; + right: 15px; + font-size: 12px; + color: #e34d59; + cursor: pointer; + } + .btns { display: flex; margin-top: 68px; diff --git a/src/views/hashrate/CameraManage/CameraRules/components/SceneRule.vue b/src/views/hashrate/CameraManage/CameraRules/components/SceneRule.vue index 02ba214..c31226f 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/SceneRule.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/SceneRule.vue @@ -301,7 +301,7 @@ if (res.success) { //_this.soundList = [{ id: "", name: "绌�", path: "" }].concat(res.data.list) _this.soundList = [{ id: "", name: "绌�", path: "" }].concat( - res.data + res.data.voices ); } }) diff --git a/src/views/hashrate/CameraManage/CameraRules/components/SdkSettingBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/SdkSettingBox.vue index c1e1726..30dab1d 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/SdkSettingBox.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/SdkSettingBox.vue @@ -295,7 +295,6 @@ } else { sdkItem = this.$store.state.newSdk; } - console.log(typeof sdkItem.argDef); if (typeof sdkItem.argDef === "string") { sdkItem.argDef = JSON.parse(sdkItem.argDef); } @@ -339,25 +338,35 @@ initPolygon() { let cameras = []; if (this.linkEditCamera) { + this.allPolygonData = []; cameras = this.linkEditCamera; + this.linkEditCamera.forEach((camera) => { + camera.polygon.forEach((polygon) => { + this.allPolygonData.push({ + defence_state: polygon.defenceState, + polygonId: polygon.id, + name: camera.cameraName + ":" + polygon.name, + cameraId: camera.cameraId, + }); + }); + }); } else { cameras = [...this.Cameras]; - } + for (let i = 0; i < cameras.length; i++) { + let polyOpt = cameras[i].polygonData.map((p) => { + return { + defence_state: p.defence_state, + polygonId: p.id, + name: + this.isLinkRule || this.linkEditCamera + ? cameras[i].cameraName + ":" + p.name + : p.name, - for (let i = 0; i < cameras.length; i++) { - let polyOpt = cameras[i].polygonData.map((p) => { - return { - defence_state: p.defence_state, - polygonId: p.id, - name: - this.isLinkRule || this.linkEditCamera - ? cameras[i].cameraName + ":" + p.name - : p.name, - - cameraId: cameras[i].cameraId, - }; - }); - this.allPolygonData = this.allPolygonData.concat(polyOpt); + cameraId: cameras[i].cameraId, + }; + }); + this.allPolygonData = this.allPolygonData.concat(polyOpt); + } } this.$forceUpdate(); @@ -925,11 +934,12 @@ optArgDesc.substring(optArgDesc.length - 1, optArgDesc.length); optArgDesc += ")"; tempObj.sdk_set = defaultArgs.concat(optArgs); - tempObj.icon_blob = this.$store.state.newSdk.iconBlob; if (this.editSdk) { + tempObj.icon_blob = this.editSdk.icon_blob; this.$emit("getEditSdk", tempObj); } else { + tempObj.icon_blob = this.$store.state.newSdk.iconBlob; this.$emit("getNewSdk", tempObj); } }, diff --git a/src/views/hashrate/CameraManage/CameraRules/index.vue b/src/views/hashrate/CameraManage/CameraRules/index.vue index 5b774ad..595de68 100644 --- a/src/views/hashrate/CameraManage/CameraRules/index.vue +++ b/src/views/hashrate/CameraManage/CameraRules/index.vue @@ -82,11 +82,11 @@ v-for="(data, index) in swipercanvasData" :key="index" > - <b + <!-- <b class="video-title" style="font-size: 14px; margin-top: -10px" >{{ data.name }}</b - > + > --> <polygon-canvas ref="canvas" v-loading="loading" @@ -149,10 +149,12 @@ :rule="item" :id="'rule_' + index" :ruleType="'separate'" + :cameraId="Camera.cameraId" @edit="editRules(item, index, 'separate')" @addSdk="addSdk('separate', index)" @backToOrigin="backToOrigin('separate', index)" @editSdk="editSdk($event, 'separate', index)" + @deletRule="deletRule('separate', index)" ></RuleItem> </template> @@ -188,7 +190,8 @@ @edit="editRules(item, index, 'linkage')" @addSdk="addSdk('linkage', index)" @backToOrigin="backToOrigin('linkage', index)" - @editSdk="editSdk($event, 'linkage', index, item.Cameras)" + @editSdk="editSdk($event, 'linkage', index)" + @deletRule="deletRule('linkage', index)" :id="'linkage_' + index" ></RuleItem> </div> @@ -219,7 +222,7 @@ @getEditSdk="getEditSdk" :editSdk="editSdkObj.sdk" :linkEditCamera=" - ruleType === 'linkage' && editSdkObj ? editSdkObj.cameras : null + ruleType === 'linkage' && editSdkObj ? editSdkObj.camera_polygons : null " :Cameras="ruleType === 'linkage' ? Carmeras : [Camera]" ></SdkSettingBox> @@ -342,7 +345,7 @@ SeparateRules: [], //鐙珛鍦烘櫙 linkageRule: [], //鑱斿姩鍦烘櫙 cameraId: "", - showSysInfo: false, + showSysInfo: true, showCanvas: true, canvasWidth: 568, canvasHeight: 320, @@ -358,8 +361,8 @@ this.plumbIns = jsPlumb.getInstance(); }, mounted() { - this.PollData.statistics(); - this.TaskMange.findAllSdk({ installed: true }); + // this.PollData.statistics(); + this.TaskMange.findAllSdk(); }, destroyed() { document.querySelector("html").style["min-width"] = "1280px"; @@ -523,6 +526,7 @@ this.Camera = newCamera; this.SeparateRules = this.Camera.rules; + this.$nextTick(() => { this.connectLine(); }); @@ -546,7 +550,7 @@ getLinkSceneRule({ cameraIds: [id] }) .then((rsp) => { if (rsp && rsp.success) { - rules = rsp.data; + rules = rsp.data.rules; // 缁熶竴瑙勫垯缂栬緫鐨勬暟鎹粨鏋� for (let i = 0; i < rules.length; i++) { rules[i].group_rules = rules[i].rules; @@ -554,18 +558,12 @@ this.linkageRule = rules; + console.log(this.linkageRule); + this.$set(this.Camera, "rules", this.Camera.rules.concat(rules)); this.$nextTick(() => { this.connectLine2(); - }); - - this.linkageRule.forEach((rule) => { - rule.Cameras = []; - rule.cameraIds.forEach((id) => { - let newCamera = new VideoRuleData(id); - rule.Cameras.push(newCamera); - }); }); } }) @@ -921,6 +919,9 @@ }); if (rsp && rsp.success) { let rules = rsp.data.rules ? rsp.data.rules : []; + rules.forEach((item) => { + item.cameraIds = rsp.data.cameraInfo.id; + }); if (rules[index]) { this.SeparateRules[index] = rules[index]; } else { @@ -930,32 +931,25 @@ this.$forceUpdate(); this.connectLine(); } else { - getLinkSceneRule({ cameraIds: [this.Camera.cameraId] }) - .then((rsp) => { - if (rsp && rsp.success) { - let rules = rsp.data; - console.log(rules); - if (rules[index]) { - console.log(1111); - this.linkageRule[index] = rules[index]; - this.linkageRule.group_rules = this.linkageRule.rules; - } else { - console.log(2222); - this.linkageRule.splice(index, 1); - } - this.$forceUpdate(); - this.connectLine2(); + getLinkSceneRule({ cameraIds: [this.Camera.cameraId] }).then((rsp) => { + if (rsp && rsp.success) { + let rules = rsp.data.rules ? rsp.data.rules : []; + if (rules[index]) { + this.linkageRule[index] = rules[index]; + this.linkageRule.group_rules = this.linkageRule.rules; + } else { + this.linkageRule.splice(index, 1); } - console.log("澶辫触"); - }) - .catch((err) => { - console.log(err); - }); + this.$forceUpdate(); + this.connectLine2(); + } + console.log("澶辫触"); + }); } }, // 缂栬緫绠楁硶 - editSdk(sdkIndex, type, ruleIndex, Cameras) { + editSdk(sdkIndex, type, ruleIndex) { this.addData = {}; this.ruleType = type; if (type === "separate") { @@ -970,13 +964,21 @@ ruleIndex, sdkIndex, type, - cameras: Cameras, + camera_polygons: this.linkageRule[ruleIndex].camera_polygons, sdk: this.linkageRule[ruleIndex].rules[sdkIndex], }; } this.showSdkBox = false; this.showSdkSettingBox = true; + }, + + deletRule(type, index) { + if (type === "separate") { + this.SeparateRules.splice(index, 1); + } else { + this.linkageRule.splice(index, 1); + } }, getEditSdk(newRule) { @@ -1246,6 +1248,8 @@ } .swiper-box-container2 { + margin: 0; + margin-top: -13px; width: 568px; } @@ -1268,7 +1272,7 @@ .swiper-next-border ::v-deep { position: absolute; bottom: 146px; - right: 10px; + right: 58px; cursor: pointer; z-index: 1; diff --git a/src/views/hashrate/CameraManage/index.vue b/src/views/hashrate/CameraManage/index.vue index c8ab02e..9fba6ac 100644 --- a/src/views/hashrate/CameraManage/index.vue +++ b/src/views/hashrate/CameraManage/index.vue @@ -66,6 +66,7 @@ activeTab: "淇℃伅缁存姢", clusterArr: [], cluster: "", + clusterData: [], intervalTimer: null, leftWith: 0, screenHeight: 0, @@ -77,11 +78,8 @@ }, watch: { - "TreeDataPool.selectedNode": function (node) { - if (this.TreeDataPool.multiple) { - return; - } - + "TreeDataPool.activeNode": function (node) { + console.log("cclickaaa"); if (this.activeTab == "淇℃伅缁存姢") { if (this.TreeDataPool.treeActiveName == "camera") { this.$refs.cameraInfo.selectCamera(node); @@ -93,6 +91,7 @@ "TreeDataPool.selectedNodes": { handler(nodes) { if (this.activeTab == "鍦烘櫙閰嶇疆") { + console.log(this.TreeDataPool.multiple); // this.$refs.sepRule.initCameraData(nodes[nodes.length - 1]); let CameraArr = []; @@ -102,6 +101,7 @@ }); this.$refs.sepRule.Carmeras = CameraArr; + console.log(CameraArr); } }, deep: true, @@ -124,7 +124,6 @@ }, created() { this.getCluster(); - this.PollData.statistics(); this.TreeDataPool.readonly = false; // this.TreeDataPool.readonly = true; @@ -132,7 +131,6 @@ this.TreeDataPool.multiple = false; this.TreeDataPool.selectedNode = ""; this.selectedNodes = []; - this.VideoManageData.init(); }, beforeDestroy() { clearInterval(this.intervalTimer); @@ -148,12 +146,6 @@ }); this.TreeDataPool.clean(); }); - - let _this = this; - _this.PollData.statisticTaskInfo(); - this.intervalTimer = setInterval(() => { - _this.PollData.statisticTaskInfo(); - }, 10000); }, methods: { handAddDevice(node) { @@ -190,8 +182,8 @@ }, async getCluster() { const res = await getClusterDevList(); - console.log(res); if (res && res.success) { + this.clusterData = res.data.clusterList; res.data.clusterList.forEach((item) => { this.clusterArr.push({ label: item.cluster_name, @@ -207,20 +199,30 @@ }); this.cluster = this.clusterArr[0].value; + this.selectCluster(this.clusterArr[0].value); } }, selectCluster(val) { const arr = val.split("$$"); - console.log(arr); if (arr[0] == "0") { - this.TreeDataPool.clusterId = arr[1]; - this.TreeDataPool.devId = ""; + sessionStorage.setItem("clusterId", arr[1]); + sessionStorage.setItem("devId", ""); + console.log(this.clusterData); + this.clusterData.forEach((item) => { + if (arr[1] == item.cluster_id) { + sessionStorage.setItem("nodeId", item.nodeList[0].devId); + } + }); } if (arr[0] == "1") { - this.TreeDataPool.devId = arr[1]; - this.TreeDataPool.clusterId = ""; + sessionStorage.setItem("clusterId", ""); + sessionStorage.setItem("devId", arr[1]); + sessionStorage.setItem("nodeId", arr[1]); } this.TreeDataPool.fetchTreeData(); + this.PollData.statisticTaskInfo(); + this.VideoManageData.init(); + this.PollData.statistics(); }, }, }; diff --git a/src/views/hashrate/HashManage/components/ClusterCard.vue b/src/views/hashrate/HashManage/components/ClusterCard.vue index d1cc470..f7ed1fe 100644 --- a/src/views/hashrate/HashManage/components/ClusterCard.vue +++ b/src/views/hashrate/HashManage/components/ClusterCard.vue @@ -1,10 +1,12 @@ <template> <div class="ClusterCard"> <div class="cardHeader"> - <img src="/images/hashrate/璁惧.png" alt="" /> + <img v-if="info.type == 1" src="/images/hashrate/闆嗙兢.png" alt="" /> + <img v-else src="/images/hashrate/璁惧.png" alt="" /> + <div class="info"> - <div class="name">鏈嶅姟鍣�20.10</div> - <div class="id">DSVAD010120190622</div> + <div class="name">{{ info.name }}</div> + <div class="id">{{ info.id }}</div> <div class="link" @click="showDetail">鏌ョ湅璇︽儏 ></div> </div> </div> @@ -15,23 +17,32 @@ <img src="/images/hashrate/瀹炴椂绠楀姏.png" alt="" /> 瀹炴椂绠楀姏 </div> - <div class="data"><span>4</span>璺�</div> + <div class="data"> + <span>{{ info.info.realValidCount }}</span + >璺� + </div> </div> <div class="hashrate"> <div class="label"> <img src="/images/hashrate/杞绠楀姏.png" alt="" /> - 瀹炴椂绠楀姏 + 杞绠楀姏 </div> - <div class="data"><span>4</span>璺�</div> + <div class="data"> + <span>{{ info.info.pollChannelCount }}</span + >璺� + </div> </div> <div class="hashrate"> <div class="label"> <img src="/images/hashrate/鏁版嵁鏍堢畻鍔�.png" alt="" /> - 瀹炴椂绠楀姏 + 鏁版嵁鏍堢畻鍔� </div> - <div class="data"><span>4</span>璺�</div> + <div class="data"> + <span>{{ info.info.stackChannelCount }}</span + >璺� + </div> </div> </div> </div> @@ -39,6 +50,9 @@ <script> export default { + props: { + info: {}, + }, methods: { showDetail() { this.$emit("showDetail"); diff --git a/src/views/hashrate/HashManage/components/ClusterList.vue b/src/views/hashrate/HashManage/components/ClusterList.vue index 0770a99..077e737 100644 --- a/src/views/hashrate/HashManage/components/ClusterList.vue +++ b/src/views/hashrate/HashManage/components/ClusterList.vue @@ -1,13 +1,18 @@ <template> <div class="ClusterList"> - <div class="title">闆嗙兢鍒楄〃</div> <div v-if="showCluster"> + <div class="title" v-if="listType == 'cluster'">闆嗙兢鍒楄〃</div> + <div class="back" v-else> + <span class="iconfont" @click="back"></span>璁惧鍒楄〃 + </div> <div class="List"> <ClusterCard - v-for="i in listlength" - :key="i" - @showDetail="showList" + v-for="(item, index) in listData" + :key="index" + :info="item" + @showDetail="showList(item)" ></ClusterCard> + <div class="ClusterCard" v-for="i in emptylength" @@ -27,7 +32,12 @@ ></el-pagination> </div> - <EquipmentForm v-else @hiddenList="hiddenList"></EquipmentForm> + <EquipmentForm + :name="activeName" + :id="devId" + v-else + @hiddenList="hiddenList" + ></EquipmentForm> </div> </template> @@ -35,10 +45,12 @@ import ClusterCard from "./ClusterCard"; import EquipmentForm from "./EquipmentForm"; export default { - mounted() { - this.getEmptyElement(); - this.addSizeListener(); + props: { + list: {}, + listType: {}, }, + created() {}, + mounted() {}, components: { ClusterCard, EquipmentForm, @@ -46,46 +58,45 @@ data() { return { showCluster: true, - listlength: 11, emptylength: 0, page: 1, size: 10, - total: 100, + devId: "", + activeName: "", }; }, methods: { - addSizeListener() { - window.onresize = () => { - this.getEmptyElement(); - }; + handleSizeChange(size) { + this.size = size; }, - //鍥炲~绌虹櫧椤� - getEmptyElement() { - // 鑾峰彇灞忓箷鎬诲搴�(鍗虫祻瑙堝櫒绐楀彛鐨勫搴�) - var allWidth = document.body.clientWidth; - - // 鑾峰彇鍗曚釜item椤瑰搴�(鍗冲崟涓猧tem鍏冪礌鐨勫搴︽槸澶氬皯) - var dom = document.querySelector(".ClusterCard").scrollWidth; - - // [缁撴灉鍙栨暣] 璁$畻涓�琛岃兘鏀惧灏戜釜item椤�(鍗充竴鎺掕兘鏀惧灏戜釜鍏冪礌) - var line = parseInt(allWidth / dom); - - // 璁$畻闇�瑕佽ˉ澶氬皯涓猧tem椤�(鍏冪礌涓嶉渶瑕佽ˉ鐨勬椂鍊�(=0)蹇呴』浣滃鐞�) - // 鍏紡: ( [鎬籭tem椤规暟閲廬 % [涓�琛岃兘鏀惧灏戜釜item椤筣 ) - // 濡傛灉绛変簬0鍒欒瘉鏄庝笉闇�瑕佽ˉ | 鍙嶄箣涓�琛屽噺鍘昏ˉ鍏� - var result = - this.listlength % line == 0 ? 0 : line - (this.listlength % line); - - //閫氱煡瑙嗗浘杩涜琛ュ厓绱�(娓叉煋瑙嗗浘涓婄殑闅愯棌鍏冪礌) - this.emptylength = result; + refrash(page) { + this.page = page; }, - handleSizeChange() {}, - refrash() {}, - showList() { - this.showCluster = false; + showList(dev) { + if (dev.type == 1) { + this.$emit("chooseCluster", dev.id); + } else { + this.$emit("chooseDevice", dev.id); + this.devId = dev.id; + this.activeName = dev.name; + this.showCluster = false; + } }, hiddenList() { this.showCluster = true; + }, + back() { + this.$emit("back"); + }, + }, + computed: { + listData() { + let arr = []; + arr = this.list.slice((this.page - 1) * this.size, this.page * this.size); + return arr; + }, + total() { + return this.list.length; }, }, }; @@ -106,16 +117,25 @@ font-size: 16px; font-weight: 700; } + .back { + margin-bottom: 30px; + font-size: 18px; + font-weight: 700; + span { + margin-right: 10px; + cursor: pointer; + } + } .List { display: flex; flex-wrap: wrap; .ClusterCard { + width: 434px; margin-right: 24px; margin-bottom: 24px; padding: 20px; - flex: 1; } } diff --git a/src/views/hashrate/HashManage/components/EquipmentForm.vue b/src/views/hashrate/HashManage/components/EquipmentForm.vue index 9740c0a..5522d29 100644 --- a/src/views/hashrate/HashManage/components/EquipmentForm.vue +++ b/src/views/hashrate/HashManage/components/EquipmentForm.vue @@ -1,12 +1,12 @@ <template> <div class="EquipmentForm"> <div class="back"> - <span class="iconfont" @click="hiddenList"></span>鏈嶅姟鍣�20.10 + <span class="iconfont" @click="hiddenList"></span>{{ name }} </div> <div class="header"> <div class="search"> <el-input v-model="searchInput" placeholder="璇疯緭鍏ュ唴瀹�"></el-input> - <div class="button searchBtn">鎼滅储</div> + <div class="button searchBtn" @click="getDevice">鎼滅储</div> <div class="button settingBtn" @click="showSettingBox = true">璁剧疆</div> </div> @@ -29,58 +29,74 @@ :fit="true" :stripe="true" > - <el-table-column label="搴忓彿" class-name="index" width="70"> - <template slot-scope="scope">{{ - scope.$index + 1 + (page - 1) * size - }}</template> - </el-table-column> <el-table-column - prop="name" + label="搴忓彿" + type="index" + align="center" + width="80" + ></el-table-column> + <el-table-column label="鎽勫儚鏈哄悕绉�" + align="center" show-overflow-tooltip - ></el-table-column> - <el-table-column - prop="position" - label="鎽勫儚鏈轰綅缃�" - show-overflow-tooltip - ></el-table-column> - <el-table-column prop="IP" label="鎽勫儚鏈篒P"></el-table-column> - <el-table-column prop="type" label="鎽勫儚鏈虹被鍨�"></el-table-column> - <el-table-column prop="sdk" label="鎵ц绠楁硶"></el-table-column> - <el-table-column prop="device" label="杩愯璁惧"></el-table-column> - - <el-table-column label="鐘舵��"> + > <template slot-scope="scope"> - <div v-if="scope.row.status == 1" class="status green">澶勭悊涓�</div> - <div v-else class="status">绛夊緟澶勭悊</div> + <span>{{ + scope.row.alias !== "" ? scope.row.alias : scope.row.name + }}</span> </template> </el-table-column> - - <el-table-column label="瀹炴椂/杞"> + <el-table-column + label="鎽勫儚鏈哄湴鍧�" + prop="addr" + align="center" + show-overflow-tooltip + ></el-table-column> + <el-table-column + label="鎽勫儚鏈篒P" + prop="ip" + align="center" + ></el-table-column> + <el-table-column label="鎽勫儚鏈虹被鍨�" align="center"> <template slot-scope="scope"> - <div class="switch"> - <el-switch - v-model="scope.row.realTime" - active-color="#D4E3FA" - inactive-color="#FAE4D4" - :width="56" - > - </el-switch> - <div - class="activeText" - v-if="scope.row.realTime" - @click="scope.row.realTime = !scope.row.realTime" - > - 瀹炴椂 - </div> - <div - class="inactiveText" - v-else - @click="scope.row.realTime = !scope.row.realTime" - > - 杞 - </div> - </div> + <span>{{ scope.row.runType | cameraType }}</span> + </template> + </el-table-column> + <el-table-column label="鎵ц绠楁硶" align="center" show-overflow-tooltip> + <template slot-scope="scope"> + <span v-if="scope.row.tasks != null">{{ + scope.row.tasks | taskList + }}</span> + <span v-else>-</span> + </template> + </el-table-column> + <el-table-column label="杩愯璁惧" align="center"> + <template slot-scope="scope"> + <span>{{ scope.row.runServerName }}</span> + </template> + </el-table-column> + <el-table-column label="鐘舵��" align="center" show-overflow-tooltip> + <template slot-scope="scope"> + <span v-if="scope.row.isRunning">{{ "澶勭悊涓�" }}</span> + <span v-else>{{ "绛夊緟澶勭悊" }}</span> + </template> + </el-table-column> + <el-table-column label="瀹炴椂/杞" align="center" width="100px"> + <template slot-scope="scope"> + <span v-if="scope.row.runType === -1">-</span> + <toggle-button + v-else + :value="scope.row.runType === 1" + :width="60" + :labels="{ checked: '瀹炴椂', unchecked: '杞' }" + :color="{ + checked: '#4D88FF', + unchecked: '#FF7733', + disabled: '#CCCCCC', + }" + :sync="true" + @change="pollSwitch(scope.row)" + /> </template> </el-table-column> </el-table> @@ -102,113 +118,111 @@ <SettingBox v-if="showSettingBox" @close="showSettingBox = false" + :id="id" ></SettingBox> </div> </template> <script> import SettingBox from "./SettingBox"; +import { getCameraByPage } from "@/api/clusterManage"; export default { + props: { + id: {}, + name: {}, + }, components: { SettingBox, + }, + created() { + this.getDevice(); }, data() { return { searchInput: "", showSettingBox: false, - dataList: [ - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 1, - realTime: true, - }, - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 0, - realTime: true, - }, - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 1, - realTime: true, - }, - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 1, - realTime: true, - }, - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 1, - realTime: true, - }, - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 1, - realTime: false, - }, - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 1, - realTime: false, - }, - { - name: "5.151锛堜骇鍝佹梺锛�265", - position: "5.155鎽勫儚鏈�", - IP: "192.168.20.110", - type: "鐩戞帶鎽勫儚鏈�", - sdk: "鍦烘櫙1锛宻leep", - device: "189鏈嶅姟", - status: 1, - realTime: false, - }, - ], + dataList: [], page: 1, size: 10, total: 100, }; }, methods: { - handleSizeChange() {}, - refrash() {}, + async getDevice() { + const res = await getCameraByPage({ + deviceId: this.id, + inputText: this.searchInput, + page: this.page, + size: this.size, + }); + if (res && res.success) { + this.dataList = res.data.lists; + this.total = res.data.total; + } + // 鏍规嵁rtsp 鎻愬彇ip鍦板潃 + const ipReg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/; + this.dataList.forEach((cam) => { + // 鍥芥爣鎽勫儚鏈轰笉鏄剧ずip + if (cam.type === 1) { + cam.ip = "-"; + return; + } + let ip = ipReg.exec(cam.rtsp); + if (ip.length > 0) { + cam.ip = ip[0]; + } + }); + }, + handleSizeChange(size) { + this.size = size; + this.getDevice(); + }, + refrash(page) { + this.page = page; + this.getDevice(); + }, hiddenList() { this.$emit("hiddenList"); }, + pollSwitch(row) { + changeRunType({ camera_ids: [row.id], run_type: row.run_type ^ 1 }).then( + (rsp) => { + if (rsp && rsp.success) { + this.$notify({ + type: "success", + message: "閰嶇疆鎴愬姛", + }); + + row.run_type = row.run_type ^ 1; + } else { + this.$notify({ + type: "error", + message: "閰嶇疆澶辫触", + }); + } + + // this.PollData.fetchPollList(); + } + ); + }, + }, + filters: { + cameraType(type) { + return type === -1 ? "鐩戞帶鎽勫儚鏈�" : "AI鎽勫儚鏈�"; + }, + taskList(tasks) { + return tasks + .filter((task) => { + return task.hasRule; + }) + .map((task) => { + return task.taskname; + }) + .join(","); + }, + switchText(type) { + return type ? "宸插紑鍚�" : "鏈紑鍚�"; + }, }, }; </script> diff --git a/src/views/hashrate/HashManage/components/HashCard.vue b/src/views/hashrate/HashManage/components/HashCard.vue index 2d3ff33..7a6ec85 100644 --- a/src/views/hashrate/HashManage/components/HashCard.vue +++ b/src/views/hashrate/HashManage/components/HashCard.vue @@ -1,10 +1,17 @@ <template> <div class="HashCard"> <div class="hashrate"> - <img src="/images/hashrate/鎬荤畻鍔�.png" alt="" /> + <img v-if="type == 0" src="/images/hashrate/杞绠楀姏.png" alt="" /> + <img v-if="type == 1" src="/images/hashrate/瀹炴椂绠楀姏.png" alt="" /> + <img v-if="type == 2" src="/images/hashrate/鏁版嵁鏍堢畻鍔�.png" alt="" /> <div class="hashrateContent"> - <div class="label">鎬荤畻鍔�</div> - <div class="data"><span class="number">42</span>璺�</div> + <div class="label" v-if="type == 0">杞绠楀姏</div> + <div class="label" v-if="type == 1">瀹炴椂绠楀姏</div> + <div class="label" v-if="type == 2">鏁版嵁鏍堢畻鍔�</div> + <div class="data"> + <span class="number">{{ hashrate.total }}</span + >璺� + </div> </div> </div> <div class="detail"> @@ -12,21 +19,33 @@ <div class="label"> <span class="iconfont"></span>鎵撳紑鍒嗘瀽寮�鍏� </div> - <div class="data"><span class="number">8</span>璺�</div> + <div class="data"> + <span class="number">{{ hashrate.valid }}</span + >璺� + </div> </div> <div class="detailItem"> <div class="label"><span class="iconfont"></span>绠楁硶涓嶅叏</div> - <div class="data"><span class="number">8</span>璺�</div> + <div class="data"> + <span class="number">{{ hashrate.invalid }}</span + >璺� + </div> </div> <div class="detailItem"> <div class="label"><span class="iconfont"></span>姝e湪鍒嗘瀽</div> - <div class="data"><span class="number">8</span>璺�</div> + <div class="data"> + <span class="number">{{ hashrate.run }}</span + >璺� + </div> </div> <div class="detailItem"> <div class="label"> <span class="iconfont"></span>鍥犳湭鐭ュ師鍥犳湭鈥� </div> - <div class="data"><span class="number">8</span>璺�</div> + <div class="data"> + <span class="number">{{ hashrate.noDeal }}</span + >璺� + </div> </div> </div> </div> @@ -34,6 +53,10 @@ <script> export default { + props: { + type: {}, + hashrate: {}, + }, data() { return {}; }, diff --git a/src/views/hashrate/HashManage/components/SettingBox.vue b/src/views/hashrate/HashManage/components/SettingBox.vue index e418ea5..30c3955 100644 --- a/src/views/hashrate/HashManage/components/SettingBox.vue +++ b/src/views/hashrate/HashManage/components/SettingBox.vue @@ -5,17 +5,19 @@ <div class="settingBody"> <div class="settingItem"> <div class="label">鎬荤畻鍔�:</div> - <div class="data">2閫氶亾</div> - <div class="label">鎬荤畻鍔�:</div> - <div class="data">2閫氶亾</div> + <div class="data">{{ total }}閫氶亾</div> + <div class="label">瀹炴椂绠楀姏:</div> + <div class="data">{{ realTime.total }}閫氶亾</div> </div> <div class="settingItem"> <div class="label">杞鏃堕棿:</div> <el-input-number class="time" - v-model="time" + v-model="formdata.poll_period" :controls="false" + :min="0" + :max="60 * 24 * 1" ></el-input-number >鍒嗛挓 </div> @@ -23,7 +25,7 @@ <div class="settingItem"> <div class="label">杞寮�鍏�:</div> <el-switch - v-model="pollingSwitch" + v-model="formdata.enable" active-color="#D4E3FA" inactive-color="#E9EBEE" :width="56" @@ -32,26 +34,32 @@ </div> <div class="settingItem"> - <div class="label">杞鏃堕棿:</div> + <div class="label">杞绠楀姏:</div> <el-input-number - v-model="time" + v-model="formdata.pollChannelCount" controls-position="right" + :max="limit" + :min="0" + @change="changePoll" ></el-input-number >鍒嗛挓 </div> <div class="settingItem"> - <div class="label">杞鏃堕棿:</div> + <div class="label">鏁版嵁鏍堢畻鍔�:</div> <el-input-number - v-model="time" + v-model="stack.total" controls-position="right" + :max="limit" + :min="0" + @change="changeStack" ></el-input-number >鍒嗛挓 </div> <div class="btns"> <div class="cancel button" @click="close()">鍙栨秷</div> - <div class="submit button" @click="close()">淇濆瓨</div> + <div class="submit button" @click="save()">淇濆瓨</div> </div> </div> @@ -60,16 +68,121 @@ </template> <script> +import { + getPollConfig, + deviceStatisticRunInfo, + savePollConfig, +} from "@/api/clusterManage"; export default { + props: { + id: {}, + }, data() { return { - time: 0, - pollingSwitch: false, + realTime: {}, + total: "", + polling: {}, + stack: {}, + formdata: { + deviceId: "", + delay: 10, + enable: true, + pollChannelCount: 0, + poll_period: 0, + videoChannelCount: 0, + }, + stackChannel: 0, + limit: 100, }; }, + created() { + this.getFormData(); + this.chooseDevice(); + }, + methods: { + async getFormData() { + const res = await getPollConfig({ deviceId: this.id }); + this.formdata.deviceId = this.id; + this.formdata.enable = res.data.enable; + this.formdata.poll_period = res.data.poll_period; + this.formdata.pollChannelCount = res.data.pollChannelCount; + this.$set(this.formdata, "pollChannelCount", res.data.pollChannelCount); + this.$forceUpdate(); + }, + async chooseDevice() { + const res1 = await deviceStatisticRunInfo({ deviceId: [this.id] }); + if (res1 && res1.success) { + this.total = res1.data.channelTotal; + this.realTime = { + total: res1.data.realValidCount, + valid: res1.data.realTotal, + invalid: res1.data.realInvalidCount, + run: res1.data.realRunningCount, + noDeal: + res1.data.realTotal - + res1.data.realRunningCount - + res1.data.realInvalidCount, + }; + this.polling = { + valid: res1.data.pollTotal, + total: res1.data.pollChannelCount, + invalid: res1.data.pollInvalidCount, + run: res1.data.pollRunningCount, + noDeal: + res1.data.pollTotal - + res1.data.pollRunningCount - + res1.data.pollInvalidCount, + }; + + this.stack = { + total: res1.data.stackChannelCount, + valid: res1.data.stackTotal, + invalid: res1.data.stackInvalidCount, + run: res1.data.stackRunningCount, + noDeal: + res1.data.stackTotal - + res1.data.stackInvalidCount - + res1.data.stackRunningCount, + }; + + this.limit = this.total - this.realTime.total; + + this.$forceUpdate(); + } + }, close() { this.$emit("close"); + }, + //鐩戝惉杞绠楀姏 + changePoll(newVal, oldVal) { + if (newVal > oldVal) { + this.stack.total--; + } + if (newVal < oldVal) { + this.stack.total++; + } + this.$forceUpdate(); + }, + //鐩戝惉鏁版嵁鏍堢畻鍔� + changeStack(newVal, oldVal) { + if (newVal > oldVal) { + this.formdata.pollChannelCount--; + } + if (newVal < oldVal) { + this.formdata.pollChannelCount++; + } + }, + async save() { + this.formdata.videoChannelCount = this.stack.total; + const res = await savePollConfig(this.formdata); + if (res && res.success) { + this.$notify({ + type: "success", + message: "淇濆瓨鎴愬姛", + }); + } + this.close(); }, }, }; @@ -142,6 +255,7 @@ width: 64px; height: 32px; border-radius: 0; + padding: 0 0; } .el-input-number__decrease { diff --git a/src/views/hashrate/HashManage/index.vue b/src/views/hashrate/HashManage/index.vue index a1caf5e..c3d84ef 100644 --- a/src/views/hashrate/HashManage/index.vue +++ b/src/views/hashrate/HashManage/index.vue @@ -8,19 +8,22 @@ <img src="/images/hashrate/鎬荤畻鍔�.png" alt="" /> <div class="hashrateContent"> <div class="label">鎬荤畻鍔�</div> - <div class="data"><span class="number">42</span>璺�</div> + <div class="data"> + <span class="number">{{ total }}</span + >璺� + </div> </div> </div> </div> <!-- 瀹炴椂绠楀姏 --> - <HashCard></HashCard> + <HashCard :type="0" :hashrate="realTime"></HashCard> </div> <div class="medium"> <!-- 杞绠楀姏 --> - <HashCard class="topCard"></HashCard> + <HashCard class="topCard" :type="1" :hashrate="polling"></HashCard> <!-- 鏁版嵁鏍堢畻鍔� --> - <HashCard></HashCard> + <HashCard :type="2" :hashrate="stack"></HashCard> </div> <div class="right"> @@ -30,58 +33,262 @@ <div class="row"> <div class="label">鍐呭瓨</div> <el-progress - :percentage="50" + :percentage="systemInfo.mem" :stroke-width="24" :show-text="false" ></el-progress> - <div class="number">50%</div> + <div class="number">{{ systemInfo.mem }}%</div> </div> <!-- 绠楀姏杩涘害鏉� --> <div class="row"> <div class="label">绠楀姏</div> <el-progress - :percentage="50" + :percentage="systemInfo.gpu" :stroke-width="24" :show-text="false" ></el-progress> - <div class="number">50%</div> + <div class="number">{{ systemInfo.gpu }}%</div> </div> <!-- CPU杩涘害鏉� --> <div class="row"> <div class="label">CPU</div> <el-progress - :percentage="50" + :percentage="systemInfo.cpu" :stroke-width="24" :show-text="false" ></el-progress> - <div class="number">50%</div> + <div class="number">{{ systemInfo.cpu }}%</div> </div> <!-- 纭洏杩涘害鏉� --> <div class="row"> <div class="label">纭洏</div> <el-progress - :percentage="50" + :percentage="systemInfo.disk" :stroke-width="24" :show-text="false" ></el-progress> - <div class="number">50%</div> + <div class="number">{{ systemInfo.disk }}%</div> </div> </div> </div> </div> - <ClusterList></ClusterList> + <ClusterList + :list="deviceList" + @chooseCluster="chooseCluster" + @chooseDevice="chooseDevice" + @back="back" + :listType="listType" + ></ClusterList> </div> </template> <script> import HashCard from "./components/HashCard"; import ClusterList from "./components/ClusterList"; +import { + userStatisticRunInfo, + userSysInfo, + userStatisticRun, + clusterStatisticRunInfo, + clusterSysInfo, + clusterStatisticRun, + deviceStatisticRunInfo, + devicesSysInfo, +} from "@/api/clusterManage"; export default { components: { HashCard, ClusterList, }, + created() { + this.getUserInfo(); + this.getUserDevice(); + }, + + data() { + return { + total: "", + realTime: {}, + polling: {}, + stack: {}, + systemInfo: { + cpu: 0, + disk: 0, + gpu: 0, + mem: 0, + }, + deviceList: [], + listType: "cluster", + }; + }, + methods: { + //鑾峰彇鍏ㄩ儴淇℃伅 + async getUserInfo() { + const res1 = await userStatisticRunInfo(); + if (res1 && res1.success) { + this.total = res1.data.channelTotal; + this.realTime = { + total: res1.data.realValidCount, + valid: res1.data.realTotal, + invalid: res1.data.realInvalidCount, + run: res1.data.realRunningCount, + noDeal: + res1.data.realTotal - + res1.data.realRunningCount - + res1.data.realInvalidCount, + }; + this.polling = { + valid: res1.data.pollTotal, + total: res1.data.pollChannelCount, + invalid: res1.data.pollInvalidCount, + run: res1.data.pollRunningCount, + noDeal: + res1.data.pollTotal - + res1.data.pollRunningCount - + res1.data.pollInvalidCount, + }; + + this.stack = { + total: res1.data.stackChannelCount, + valid: res1.data.stackTotal, + invalid: res1.data.stackInvalidCount, + run: res1.data.stackRunningCount, + noDeal: + res1.data.stackTotal - + res1.data.stackInvalidCount - + res1.data.stackRunningCount, + }; + } + const res2 = await userSysInfo(); + if (res2 && res2.success) { + this.systemInfo = { + cpu: parseInt(res2.data.cpu.usedPercent), + disk: parseInt(res2.data.disk.usedPercent), + gpu: parseInt(res2.data.gpu.usedPercent), + mem: parseInt(res2.data.mem.usedPercent), + }; + } + }, + //鑾峰彇鍏ㄩ儴璁惧 + async getUserDevice() { + const res = await userStatisticRun(); + if (res && res.success) { + this.deviceList = res.data.lists; + this.listType = "cluster"; + } + }, + //鑾峰彇闆嗙兢淇℃伅 + async getClusterInfo(id) { + const res1 = await clusterStatisticRunInfo({ clusterId: id }); + if (res1 && res1.success) { + this.total = res1.data.channelTotal; + this.realTime = { + total: res1.data.realValidCount, + valid: res1.data.realTotal, + invalid: res1.data.realInvalidCount, + run: res1.data.realRunningCount, + noDeal: + res1.data.realTotal - + res1.data.realRunningCount - + res1.data.realInvalidCount, + }; + this.polling = { + valid: res1.data.pollTotal, + total: res1.data.pollChannelCount, + invalid: res1.data.pollInvalidCount, + run: res1.data.pollRunningCount, + noDeal: + res1.data.pollTotal - + res1.data.pollRunningCount - + res1.data.pollInvalidCount, + }; + + this.stack = { + total: res1.data.stackChannelCount, + valid: res1.data.stackTotal, + invalid: res1.data.stackInvalidCount, + run: res1.data.stackRunningCount, + noDeal: + res1.data.stackTotal - + res1.data.stackInvalidCount - + res1.data.stackRunningCount, + }; + } + const res2 = await clusterSysInfo({ clusterId: id }); + if (res2 && res2.success) { + this.systemInfo = { + cpu: parseInt(res2.data.cpu.usedPercent), + disk: parseInt(res2.data.disk.usedPercent), + gpu: parseInt(res2.data.gpu.usedPercent), + mem: parseInt(res2.data.mem.usedPercent), + }; + } + }, + //鑾峰彇闆嗙兢璁惧 + async getClusterDevice(id) { + const res = await clusterStatisticRun({ clusterId: id }); + if (res && res.success) { + this.deviceList = res.data.lists; + this.listType = "device"; + } + }, + //鑾峰彇璁惧淇℃伅 + async chooseDevice(id) { + const res1 = await deviceStatisticRunInfo({ deviceId: [id] }); + if (res1 && res1.success) { + this.total = res1.data.channelTotal; + this.realTime = { + total: res1.data.realValidCount, + valid: res1.data.realTotal, + invalid: res1.data.realInvalidCount, + run: res1.data.realRunningCount, + noDeal: + res1.data.realTotal - + res1.data.realRunningCount - + res1.data.realInvalidCount, + }; + this.polling = { + valid: res1.data.pollTotal, + total: res1.data.pollChannelCount, + invalid: res1.data.pollInvalidCount, + run: res1.data.pollRunningCount, + noDeal: + res1.data.pollTotal - + res1.data.pollRunningCount - + res1.data.pollInvalidCount, + }; + + this.stack = { + total: res1.data.stackChannelCount, + valid: res1.data.stackTotal, + invalid: res1.data.stackInvalidCount, + run: res1.data.stackRunningCount, + noDeal: + res1.data.stackTotal - + res1.data.stackInvalidCount - + res1.data.stackRunningCount, + }; + } + const res2 = await devicesSysInfo({ deviceId: [id] }); + if (res2 && res2.success) { + this.systemInfo = { + cpu: parseInt(res2.data.cpu.usedPercent), + disk: parseInt(res2.data.disk.usedPercent), + gpu: parseInt(res2.data.gpu.usedPercent), + mem: parseInt(res2.data.mem.usedPercent), + }; + } + }, + chooseCluster(id) { + this.getClusterInfo(id); + this.getClusterDevice(id); + }, + back() { + this.getUserInfo(); + this.getUserDevice(); + }, + }, }; </script> diff --git a/src/views/index/components/commendContent.vue b/src/views/index/components/commendContent.vue index 3c3b324..c0f8693 100644 --- a/src/views/index/components/commendContent.vue +++ b/src/views/index/components/commendContent.vue @@ -8,11 +8,11 @@ v-for="(item, index) in commendData" :key="index" > - <img :src="'http:/' + item.logoUrl" alt="" /> + <img :src="'/httpImage/' + item.logoUrl" alt="" /> <div class="title">{{ item.productName }}</div> <div class="des limitoRow2">{{ item.description }}</div> <price :priceNew="item.priceBase"></price> - <div class="button">绔嬪嵆璐拱</div> + <div class="button" @click="buyProduct(item.productName)">绔嬪嵆璐拱</div> </div> </div> </template> @@ -33,6 +33,14 @@ refresh() { this.$emit("refresh"); }, + buyProduct(productName) { + this.$router.push({ + path: "/productDetail", + query: { + name: productName, + }, + }); + }, }, }; </script> diff --git a/src/views/index/components/rightColumn.vue b/src/views/index/components/rightColumn.vue index 8bd0397..7318ed1 100644 --- a/src/views/index/components/rightColumn.vue +++ b/src/views/index/components/rightColumn.vue @@ -14,7 +14,7 @@ </li> </ul> <price :priceNew="item.priceBase"></price> - <div class="button">绔嬪嵆璐拱</div> + <div class="button" @click="buyProduct(item.modelName)">绔嬪嵆璐拱</div> </div> </div> </template> @@ -43,6 +43,16 @@ this.product = this.data.product; } }, + methods: { + buyProduct(modelName) { + this.$router.push({ + path: "/productDetail", + query: { + name: modelName, + }, + }); + }, + }, }; </script> diff --git a/src/views/index/components/rightRrid.vue b/src/views/index/components/rightRrid.vue index d1f064b..aa1b5a2 100644 --- a/src/views/index/components/rightRrid.vue +++ b/src/views/index/components/rightRrid.vue @@ -9,7 +9,7 @@ {{ item.description }} </div> <price :priceNew="item.priceBase"></price> - <div class="button">绔嬪嵆璐拱</div> + <div class="button" @click="buyProduct(item.modelName)">绔嬪嵆璐拱</div> </div> </div> </template> @@ -38,6 +38,16 @@ this.product = this.data.product; } }, + methods: { + buyProduct(modelName) { + this.$router.push({ + path: "/productDetail", + query: { + name: modelName, + }, + }); + }, + }, }; </script> diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 2c7a273..909df1d 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -80,7 +80,7 @@ <div class="productItem" v-for="(item, index) in productData1" - :key="index" + :key="index + '1'" :class="{ short: item.typeId == 4 || item.typeId == 1 }" > <productLeft :data="item"></productLeft> diff --git a/src/views/personalCenter/components/OrderMng.vue b/src/views/personalCenter/components/OrderMng.vue index a803d5d..9e9f084 100644 --- a/src/views/personalCenter/components/OrderMng.vue +++ b/src/views/personalCenter/components/OrderMng.vue @@ -13,7 +13,7 @@ <el-date-picker size="small" v-model="searchTime" - @change="save" + @change="searchingBtn" type="datetimerange" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" @@ -23,8 +23,8 @@ </div> <div class="right"> - <div class="button searchBtn" @click="save">鎼滅储</div> - <div class="button resetBtn" @click="save">閲嶇疆</div> + <div class="button searchBtn" @click="searchingBtn">鎼滅储</div> + <div class="button resetBtn" @click="clearSearch">閲嶇疆</div> </div> <div class="to-excel"> <span class="iconfont"></span> <span>瀵煎嚭</span> @@ -47,25 +47,29 @@ }}</template> </el-table-column> <el-table-column - prop="name" - label="濮撳悕" + prop="sn" + label="璁㈠崟缂栧彿" show-overflow-tooltip ></el-table-column> - <el-table-column - prop="phone" - label="鎵嬫満鍙�" - show-overflow-tooltip - ></el-table-column> - <el-table-column prop="userType" label="鐢ㄦ埛绫诲瀷"></el-table-column> - <el-table-column prop="duration" label="鎺堟潈鏃堕暱"></el-table-column> - <el-table-column prop="authList" label="鏉冮檺"></el-table-column> - - <el-table-column label="鐘舵��"> + <el-table-column label="浜у搧鍚嶇О" show-overflow-tooltip> <template slot-scope="scope"> - <div v-if="scope.row.isBind == 1" class="status green">宸茬粦瀹�</div> - <div v-else class="status">鏈粦瀹�</div> + {{ scope.row.products[0].productName }} </template> </el-table-column> + <el-table-column + prop="createTime" + label="鍒涘缓鏃堕棿" + show-overflow-tooltip + ></el-table-column> + <el-table-column prop="orderMoney" label="璁㈠崟閲戦"></el-table-column> + <el-table-column label="鏀粯鏂瑰紡"> + <template slot-scope="scope"> + <div v-if="scope.row.payMethod == 0">绾夸笅姹囨</div> + <div v-if="scope.row.payMethod == 1">鏀粯瀹�</div> + <div v-if="scope.row.payMethod == 2">寰俊</div> + </template> + </el-table-column> + <el-table-column prop="status" label="璁㈠崟鐘舵��"></el-table-column> <el-table-column label="鎿嶄綔"> <template slot-scope="scope"> @@ -87,15 +91,16 @@ </div> </div> </div> + <div class="order-detail" v-else> <div class="banner"> - <span class="iconfont"></span> <span class="t">璁㈠崟璇︽儏</span> + <span class="iconfont" @click="back"></span> + <span class="t">璁㈠崟璇︽儏</span> </div> <div class="block"> <div class="head-name">璁㈠崟淇℃伅</div> <div class="order-general-view"> - <div class="detail-list"> <div class="item"> <label>璁㈠崟缂栧彿锛�</label> @@ -117,7 +122,7 @@ <label>璁㈠崟鐘舵�侊細</label> <span>{{ form.status }}</span> </div> - + <div class="item"> <label>璁㈠崟閲戦锛�</label> <span>{{ @@ -129,157 +134,117 @@ </div> <div class="block"> <div class="head-name">璁㈠崟璇︽儏</div> - <el-table - id="multipleTable" - ref="multipleTable" - tooltip-effect="dark" - :data="form.products" - style="width: 100%" - :fit="true" - :max-height="tableHeight" - :default-sort="{ prop: 'createTime', order: 'descending' }" - @selection-change="handleSelectionChange" - > - <el-table-column prop="productName" label="浜у搧鍚嶇О" width="220"></el-table-column> - <el-table-column prop="productTypeName" label="浜у搧绫诲瀷" width="140"></el-table-column> - <el-table-column prop="productVersion" label="鐗堟湰鍙�" width="140"></el-table-column> - <el-table-column label="閰嶇疆璇︽儏" min-width="180"> - <template slot-scope="scope"> - <div style="text-align: left"> - <p v-if="scope.row.productType != 3 && scope.row.productType != 4 && scope.row.modules.length"> - 妯″潡锛� - <span v-for="item in scope.row.modules" :key="item">{{ item + " " }}</span> - </p> - <p v-if="scope.row.productBaseDetail.hasChUnitPrice"> - 閫氶亾鏁伴噺锛� - <span>{{ scope.row.ChCount }}</span> - </p> - <p v-if="scope.row.productBaseDetail.hasAuthPrice"> - 鎺堟潈鏁伴噺锛� - <span>{{ scope.row.authCount }}</span> - </p> - <p v-if="scope.row.productType != 3 && scope.row.productType != 4 && scope.row.sdks.length"> - 绠楁硶锛� - <span v-for="item in scope.row.sdks" :key="item">{{ item + " " }}</span> - </p> - <p> - 鏈嶅姟鏃堕暱锛� - <span>{{ scope.row.serveYear + "骞�" }}</span> - </p> - </div> - </template> - </el-table-column> - <el-table-column prop="devCount" label="鏁伴噺" width="110"></el-table-column> - <el-table-column label="鏈嶅姟璧锋鏃堕棿" min-width="180"> - <template slot-scope="scope"> - <p>{{ scope.row.startTime }}</p> - <p>{{ scope.row.endTime }}</p> - </template> - </el-table-column> - <el-table-column label="閲戦" prop="price" width="130"> - <template slot-scope="scope">{{ form.source == 0 ? "--" : "锟� " + scope.row.price + " 鍏�" }}</template> - </el-table-column> - <el-table-column label="鎿嶄綔" min-width="200"> - <template slot-scope="scope"> - <div class="operation"> - <span style="cursor: pointer" @click="downLoadEnclosure(scope.row)" v-if="scope.row.appendix.length" - >涓嬭浇闄勪欢</span - > - <span - style="cursor: pointer" - v-if="scope.row.orderStatus == 2 && (scope.row.productType == 3 || scope.row.productType == 4)" - @click="downLoadSoftware(scope.row)" - >涓嬭浇杞欢</span - > - <span - style="cursor: pointer" - v-if="scope.row.orderStatus == 2 && (scope.row.productType == 2 || scope.row.productType == 1)" - @click="downLoadSoftware(scope.row)" - >涓嬭浇瀹夎鍖�</span - > - <span - style="cursor: pointer" - v-if="scope.row.orderStatus == 2 && scope.row.productType == 5" - @click="downLoadAuth(scope.row)" - >涓嬭浇浜у搧瀵嗛挜</span - > - <span style="cursor: pointer" v-if="scope.row.productType != 2" @click="toDevice(scope.row)" - >鏌ョ湅璁惧</span - > - </div> - </template> - </el-table-column> - </el-table> + <el-table + id="multipleTable" + ref="multipleTable" + tooltip-effect="dark" + :data="form.products" + style="width: 100%" + :fit="true" + :default-sort="{ prop: 'createTime', order: 'descending' }" + v-if="showTable" + > + <el-table-column prop="productName" label="浜у搧鍚嶇О"></el-table-column> + + <el-table-column label="閰嶇疆璇︽儏"> + <template slot-scope="scope"> + <div style="text-align: left"> + <p + v-if=" + scope.row.productType != 3 && + scope.row.productType != 4 && + scope.row.modules.length + " + > + 妯″潡锛� + <span v-for="item in scope.row.modules" :key="item">{{ + item + " " + }}</span> + </p> + <p v-if="scope.row.productBaseDetail.hasChUnitPrice"> + 閫氶亾鏁伴噺锛� + <span>{{ scope.row.ChCount }}</span> + </p> + <p v-if="scope.row.productBaseDetail.hasAuthPrice"> + 鎺堟潈鏁伴噺锛� + <span>{{ scope.row.authCount }}</span> + </p> + <p + v-if=" + scope.row.productType != 3 && + scope.row.productType != 4 && + scope.row.sdks.length + " + > + 绠楁硶锛� + <span v-for="item in scope.row.sdks" :key="item">{{ + item + " " + }}</span> + </p> + <p> + 鏈嶅姟鏃堕暱锛� + <span>{{ scope.row.serveYear + "骞�" }}</span> + </p> + </div> + </template> + </el-table-column> + <el-table-column prop="devCount" label="鏁伴噺"></el-table-column> + <el-table-column label="鏈嶅姟璧锋鏃堕棿"> + <template slot-scope="scope"> + <p>{{ scope.row.startTime }}</p> + <p>{{ scope.row.endTime }}</p> + </template> + </el-table-column> + <el-table-column label="閲戦"> + <template slot-scope="scope">{{ + form.source == 0 ? "--" : "锟� " + scope.row.price + " 鍏�" + }}</template> + </el-table-column> + </el-table> </div> <div class="block"> <div class="head-name">鏀粯淇℃伅</div> - <el-table - tooltip-effect="dark" - :data="form.payInfo" - :fit="true" - :max-height="tableHeight" - :default-sort="{ prop: 'createTime', order: 'descending' }" - :span-method="tableSpanMethod" - > - <el-table-column prop="payMethod" label="鏀粯娓犻亾" width="150"> - <template slot-scope="scope"> - <div v-if="scope.row.payMethod == 1">绾夸笅姹囨</div> - <div v-if="scope.row.payMethod == 2">鏀粯瀹�</div> - <div v-if="scope.row.payMethod == 3">寰俊</div> - </template> - </el-table-column> - <!-- <el-table-column prop="payTime" label="浠樻鏃堕棿" align="center" min-width="150" ></el-table-column> --> - <el-table-column prop="updateTime" label="浠樻鏃堕棿" width="180"></el-table-column> - <el-table-column prop="payMoney" label="浠樻閲戦" width="150"></el-table-column> - <el-table-column - prop="tradeNo" - label="闄勪欢鍑瘉鍙�/娴佹按鍙�" - v-if="form.payMethod == 2" - width="200" - ></el-table-column> - <el-table-column prop="payAccount" label="浠樻璐﹀彿" width="190"></el-table-column> - <el-table-column label="浠樻鍗曚綅/濮撳悕" prop="payUser" width="220"></el-table-column> - <el-table-column label="鏌ョ湅浠樻鍑瘉" width="200"> - <template slot-scope="scope"> - <div> - <el-image - style="width: 100px" - :fit="imageFit" - :src="`/httpImage/${scope.row.appendix}`" - :preview-src-list="[`/httpImage/${scope.row.appendix}`]" - ></el-image> - </div> - </template> - </el-table-column> - <el-table-column label="瀹℃牳鐘舵��" width="180"> - <template slot-scope="scope"> - <div> - <span v-if="scope.row.orderStatus == 11">瀹℃牳涓�</span> - <span v-if="scope.row.orderStatus == 12">宸查┏鍥�</span> - <span v-if="scope.row.orderStatus == 2">瀹℃牳閫氳繃</span> - </div> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" min-width="170"> - <template slot-scope="scope"> - <div v-if="scope.row.orderStatus !== 2"> - <span class="cursor-pointer" @click="checkOrder(1)">瀹℃牳閫氳繃</span> - <span class="cursor-pointer" @click="checkOrder(2)">椹冲洖</span> - </div> - <span v-else>-</span> - </template> - </el-table-column> - </el-table> + <el-table + tooltip-effect="dark" + :data="form.payInfo" + :fit="true" + :default-sort="{ prop: 'createTime', order: 'descending' }" + v-if="showTable" + > + <el-table-column prop="payMethod" label="鏀粯娓犻亾" min-width="80"> + <template slot-scope="scope"> + <div v-if="scope.row.payMethod == 1">绾夸笅姹囨</div> + <div v-if="scope.row.payMethod == 2">鏀粯瀹�</div> + <div v-if="scope.row.payMethod == 3">寰俊</div> + </template> + </el-table-column> + <!-- <el-table-column prop="payTime" label="浠樻鏃堕棿" align="center" min-width="150" ></el-table-column> --> + <el-table-column prop="updateTime" label="浠樻鏃堕棿"></el-table-column> + <el-table-column prop="payMoney" label="浠樻閲戦"></el-table-column> + + <el-table-column prop="payAccount" label="浠樻璐﹀彿"></el-table-column> + <el-table-column label="浠樻鍗曚綅/濮撳悕" prop="payUser"></el-table-column> + <el-table-column label="鏌ョ湅浠樻鍑瘉"> + <template slot-scope="scope"> + <div class="link" @click="openImg(scope.row.appendix)"> + 鏌ョ湅浠樻鍑瘉 + </div> + </template> + </el-table-column> + </el-table> </div> </div> </template> <script> -// import Steps from "./Steps"; -// import StepsCard from "./StepCard"; -// import TreeBox from "./TreeBox"; +import { getOrders } from "@/api/order"; +import { getOrderById } from "@/api/product"; + export default { components: {}, + created() { + this.searchingBtn(); + }, data() { return { searchTime: [ @@ -292,16 +257,7 @@ activeStep: 0, activeIndex: 0, total: 0, //鎬绘暟 - dataList: [ - { - name: "basic", - phone: "1121313232", - userType: "涓汉", - duration: "姘镐箙", - authList: "闆嗙兢1锛岄泦缇�2", - isBind: 1, - }, - ], + dataList: [], isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥 isShowUnbind: false, //鏄惁灞曠ず瑙g粦寮圭獥 unbindId: "", @@ -318,76 +274,103 @@ cluster: null, //閫変腑鐨勯泦缇ょ被鍨� showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥 showJoin: false, //灞曠ず鍔犲叆闆嗙兢鐨勫脊绐� - activeEquipment: null, //澶勭悊涓殑璁惧 + form: {}, //澶勭悊涓殑璁惧 isShowDetail: false, - form: { - id: "", - createTime: "", - createUserName: "", - payTime: "", - payMethod: "", - payAble: 0, - orderMoney: 0, - price: "", - serveYear: 1, - source: 0, - status: "", - products: [], - activeCodes: [], - payInfo: [], - }, + showTable: false, }; }, methods: { - goback() { - this.isShowAdd = false; - this.activeIndex = 0; - }, - goto(i) { - this.activeIndex = i; - }, - // 璺冲埌璁惧璇︽儏 - checkDetail(row) { - this.$router.push({ - path: "/equipmentDetail", - query: { - id: row.devId, - ip: row.devIp, - port: row.serverPort, - ndid: row.id, - }, - }); - }, - - // 璺冲埌绠楁硶璇︽儏 - algorithmDetail(row) { - this.$router.push({ - path: "/algorithmDetail", - query: { - id: row.devId, - ip: row.devIp, - port: row.serverPort, - }, - }); - }, - // 鏌ヨ鍒楄〃 - - save() {}, + searchingBtn() { + let param = { + page: this.page, + size: this.size, + startTime: this.searchTime[0], + endTime: this.searchTime[1], + inputText: this.inputText, + productBaseId: "0", + orderName: "", + orderType: "", + status: 0, + }; + getOrders(param).then((res) => { + this.dataList = res.data.list.map((item, indez) => { + let status = ""; + switch (item.orderStatus) { + case -1: + status = "宸插彇娑�"; + break; + case 0: + status = "鏈笅鍗�"; + break; + case 1: + status = "寰呮敮浠�"; + break; + case 2: + status = "宸叉敮浠�"; + break; + case 11: + status = "瀹℃牳涓�"; + break; + case 12: + status = "宸查┏鍥�"; + break; + default: + status = ""; + } + let name = ""; + let downFlag = false; + let products = []; + item.products.forEach((every, index) => { + // 鍒ゆ柇鏈鍗曟槸鍚﹀瓨鍦ㄥ彲涓嬭浇鐨勫唴瀹癸紙杞欢锛宻dk锛� + if (every.productType == 1 || every.productType == 3) { + downFlag = true; + } + // 褰掔被浜у搧鍜屾縺娲荤爜浠ヤ緵涓嬭浇 + products.push({ + productId: every.productId, + productName: every.productName, + activateCode: every.activateCode, + productTypeName: every.productTypeName, + }); + if (index == 0) { + name += every.productName + "(" + every.productTypeName + ")"; + } else { + name += + " / " + every.productName + "(" + every.productTypeName + ")"; + } + }); + return { + id: item.id, + sn: item.sn, + name: name, + source: item.source == 0 ? "婵�娲荤爜涓嬭浇" : "绾夸笂璐拱", + createTime: item.createTime, + status: status, + orderStatus: item.orderStatus, + orderMoney: item.orderMoney, + payMethod: item.payMethod, + code: + item.products.length > 1 ? "-" : item.products[0].activateCode, + canDownLoad: downFlag, + products: products, + }; + }); + this.total = res.data.total; + if (res.data.total <= this.size) { + this.page = 1; + } + }); + }, //鍒嗛〉鍔熻兘 handleSizeChange(size) { this.size = size; + this.searchingBtn(); }, //鍒嗛〉鍔熻兘 refrash(page) { this.page = page; - }, - - //瑙g粦鎸夐挳 - Untying(row) { - console.log(row); - this.unbindId = row.id; - this.isShowUnbind = true; + this.searchingBtn(); }, //鑾峰緱榛樿鏃堕棿 @@ -408,35 +391,119 @@ ]; }, - //鍏抽棴鏂板寮圭獥 - closeAddBox() { - this.isShowAdd = false; - }, - // 鍏抽棴瑙g粦寮圭獥 - closeUnbindBox() { - this.isShowUnbind = false; - }, - - //瑙g粦鎴愬姛鍥炶皟 - reflash() { - this.isShowUnbind = false; - }, - clearSearch() { this.searchTime = this.getDateInit(); this.inputText = ""; + this.searchingBtn(); }, - //閫�鍑洪泦缇� - quitCluster(equipment) { - this.activeEquipment = equipment; - this.showQuit = true; + showDetail(order) { + getOrderById(order.id).then((res) => { + if (res.success) { + let status = ""; + switch (res.data.orderInfo.orderStatus) { + case -1: + status = "宸插彇娑�"; + break; + case 0: + status = "鏈笅鍗�"; + break; + case 1: + status = "宸蹭笅鍗�,寰呮敮浠�"; + break; + case 2: + status = "宸叉敮浠�"; + break; + default: + status = ""; + } + + let prod = res.data.orderInfo.products.map((item) => { + // 绠楀嚭璧峰鏈嶅姟鏃堕棿 + let year = res.data.orderInfo.createTime.split("-")[0]; + let endTime = + parseInt(year) + + item.serveYear + + res.data.orderInfo.createTime.slice(4); + return { + productId: item.productId, + productName: item.productName, + productType: item.productType, + orderStatus: res.data.orderInfo.orderStatus, + productTypeName: item.productTypeName, + productVersion: item.productVersion, + modules: item.moduleNames, + sdks: item.sdkNames, + appendix: item.appendix, + serveYear: item.serveYear, + ChCount: item.ChCount, + authCount: item.authCount, + devCount: item.devCount, + price: res.data.orderInfo.orderMoney, + startTime: res.data.orderInfo.createTime, + endTime: endTime, + deviceIds: item.devIdList, + code: item.activateCode, + productBaseDetail: item.productBaseDetail, + }; + }); + let codes = res.data.orderInfo.products.map((item) => { + return { + productId: item.productId, + productName: item.productName, + code: item.activateCode, + deviceIds: item.deviceIds, + status: item.codeStatus == 0 ? "鏈縺娲�" : "宸叉縺娲�", + activeTime: item.activeTime, + devCount: item.devCount, + usedCount: item.usedCount, + }; + }); + let payInfo = res.data.orderInfo.payCerts.map((item) => { + return { + appendix: item.appendix, + payMethod: res.data.orderInfo.payMethod, + payTime: res.data.orderInfo.payTime, + updateTime: item.updateTime, + payAccount: item.payAccount, + payMoney: item.payMoney, + payUser: item.payUser, + tradeNo: res.data.orderInfo.tradeNo, + orderStatus: res.data.orderInfo.orderStatus, + }; + }); + this.form = { + id: res.data.orderInfo.id, + createTime: res.data.orderInfo.createTime, + createUserName: res.data.orderInfo.createUserName, + orderMoney: res.data.orderInfo.orderMoney, + orderStatus: res.data.orderInfo.orderStatus, + status: status, + sn: res.data.orderInfo.sn, + source: res.data.orderInfo.source, + payMethod: "鏀粯瀹�", + price: "-", + payAble: "-", + payTime: "-", + products: prod, + activeCodes: codes, + payInfo: payInfo, + }; + this.isShowDetail = true; + this.$nextTick(() => { + this.showTable = true; + }); + } + }); }, - //鍔犲叆闆嗙兢 - showDetail(equipment) { - this.activeEquipment = equipment; - this.isShowDetail = true; + back() { + this.isShowDetail = false; + this.searchingBtn(); + }, + + openImg(url) { + window.open("http://" + url); }, }, mounted() {}, @@ -465,9 +532,6 @@ margin-right: 10px; } } - .steps { - } - .searchBtn { width: 60px; height: 32px; @@ -779,6 +843,7 @@ .iconfont { margin-right: 10px; font-size: 18px; + cursor: pointer; } .t { font-size: 16px; @@ -789,7 +854,7 @@ } .block { box-sizing: border-box; - padding: 20px ; + padding: 20px; padding-bottom: 30px; margin-bottom: 24px; background: #ffffff; @@ -818,20 +883,21 @@ text-align: left; .item { width: 25%; - // margin: 15px 0 0; - margin-top: 30px; + // margin: 15px 0 0; + margin-top: 30px; label { height: 20px; font-size: 14px; font-family: PingFangSC-Regular, PingFang SC; - line-height: 20px;color: #666666; + line-height: 20px; + color: #666666; } span { height: 20px; font-size: 14px; font-family: PingFangSC-Regular, PingFang SC; font-weight: 700; - color: #3D3D3D; + color: #3d3d3d; line-height: 20px; } } @@ -860,4 +926,8 @@ border-color: #0065ff; } +.link { + color: #0065ff; + cursor: pointer; +} </style> \ No newline at end of file diff --git a/src/views/product/components/productCard.vue b/src/views/product/components/productCard.vue index 8a4aa2f..9f2a1aa 100644 --- a/src/views/product/components/productCard.vue +++ b/src/views/product/components/productCard.vue @@ -40,7 +40,7 @@ this.$router.push({ path: "/productDetail", query: { - id: this.data.id, + name: this.data.productName, }, }); }, diff --git a/src/views/productDetail/components/ConfirmOrder.vue b/src/views/productDetail/components/ConfirmOrder.vue index 33045aa..6c2d2da 100644 --- a/src/views/productDetail/components/ConfirmOrder.vue +++ b/src/views/productDetail/components/ConfirmOrder.vue @@ -128,60 +128,6 @@ <el-button type="primary" @click="assureOnlinePay">瀹屾垚鏀粯</el-button> </div> </el-dialog> - <el-dialog - class="offpay-instruct-dialog" - :visible="offPayInstruVisible" - :show-close="true" - @close="offPayInstruVisible = false" - > - <div slot="title" class="dialog-title">绾夸笅姹囨璇存槑</div> - <div class="offPay-instruct"> - <h5>璇峰皢娆鹃」姹囧叆浠ヤ笅閾惰璐︽埛锛�</h5> - <ul> - <li><label>寮�鎴烽摱琛岋細</label>鍖椾含閾惰澶槼瀹敮琛�</li> - <li><label>璐� 鍙凤細</label>2000 0031 2025 0000 9136 746</li> - <li><label>寮�鎴疯琛屽彿锛�</label>313100001792</li> - <li> - <label>娆鹃」锛�</label> - <span class="main-color">{{ sum }}鍏�</span> - </li> - </ul> - <div class="dash-line"></div> - <ul class="userinfo"> - <li> - <label>鎮ㄧ殑鐧诲綍鐢ㄦ埛鍚嶏細</label> - {{ this.username }} - </li> - <li> - <label>鎮ㄧ殑璁㈠崟鍙凤細</label> - {{ orderId }} - </li> - </ul> - <div class="attentions"> - <p class="title">娉ㄦ剰浜嬮」锛�</p> - <p>1銆佽鍦ㄨ浆璐︽椂鍔″繀鎻愪緵鐢ㄦ埛鍚嶅拰璁㈠崟缂栧彿锛�</p> - <p> - 2銆佽浆璐﹀悗锛岃鍔″繀鐐瑰嚮鈥滄敮浠樺畬鎴�/涓婁紶鍑瘉鈥濇彁浜よ浆璐︿俊鎭紝浠ヤ究璐㈠姟纭锛岃储鍔$‘璁ゆ椂闂翠负鎻愪氦鍚庣殑1-3涓伐浣滄棩锛� - </p> - <p>3銆佹偍鍙互鍦ㄢ�滄垜鐨勮鍗曗�濈偣鍑汇�愭彁浜や粯娆惧嚟璇併�戯紝鏌ョ湅鏈〉涓殑鍐呭</p> - </div> - <div class="btns text-center"> - <el-button - class="btn-cancle" - @click="offPayInstruVisible = false" - style="margin-right: 20px" - >鍙栨秷</el-button - > - <router-link - :to="`/Layout/ManageOrder?confirmOrder=offPay&orderId=${orderId}`" - > - <el-button class="btn-assure" type="primary" - >鏀粯瀹屾垚/涓婁紶鍑瘉</el-button - > - </router-link> - </div> - </div> - </el-dialog> <div class="offerpay" v-if="showOffpayInstruct || showUploadBox"> <OffpayInstruct @@ -272,7 +218,12 @@ if (this.orderInfo.orderMoney == 0) { resumePay({ orderId, payMethod: 5 }).then((res) => { if (res.success) { - // this.$router.replace("/Layout/ManageOrder"); + this.$notify({ + type: "success", + message: "鍏嶈垂璇曠敤", + duration: 2500, + offset: 57, + }); } }); return; diff --git a/src/views/productDetail/components/PayCard.vue b/src/views/productDetail/components/PayCard.vue index 62b90e0..54b97c4 100644 --- a/src/views/productDetail/components/PayCard.vue +++ b/src/views/productDetail/components/PayCard.vue @@ -533,6 +533,7 @@ payMethod: 0, products, status: 0, + userId: JSON.parse(sessionStorage.getItem("userInfo")).id, }).then((res) => { if (res.success) { this.orderId = res.data.orderId; diff --git a/src/views/productDetail/components/UploadBox.vue b/src/views/productDetail/components/UploadBox.vue index ffa5aa2..3c29672 100644 --- a/src/views/productDetail/components/UploadBox.vue +++ b/src/views/productDetail/components/UploadBox.vue @@ -2,7 +2,7 @@ <div class="UploadBox"> <div class="title">绾夸笅姹囨璇存槑</div> <div class="close iconfont" @click="close"></div> - <div class="content"> + <div class="content scroll"> <el-form :model="certificateForm" ref="certificateForm" @@ -114,10 +114,10 @@ export default { props: { - offerId: {}, + orderId: {}, }, mounted() { - this.certificateForm.orderId = this.offerId; + this.certificateForm.orderId = this.orderId; }, data() { return { @@ -163,7 +163,7 @@ fd.append("file", param.file); request({ method: "post", - url: `/data/api-s/file/upload`, + url: `/saas/api-s/saasFile/upload`, data: fd, }) .then((res) => { @@ -255,6 +255,8 @@ } .content { + height: 533px; + overflow-y: auto; box-sizing: border-box; padding: 30px 20px 20px 20px; font-size: 14px; diff --git a/src/views/productDetail/index.vue b/src/views/productDetail/index.vue index 3706282..28ba0de 100644 --- a/src/views/productDetail/index.vue +++ b/src/views/productDetail/index.vue @@ -51,8 +51,7 @@ let param = { page: 1, size: 1, - inputText: "", - id: this.$route.query.id, + inputText: this.$route.query.name, archType: "", gpuType: "", publishStatus: 1, diff --git a/src/views/trialCenter/components/Banner.vue b/src/views/trialCenter/components/Banner.vue index 47d9bba..1baa53f 100644 --- a/src/views/trialCenter/components/Banner.vue +++ b/src/views/trialCenter/components/Banner.vue @@ -12,7 +12,7 @@ export default { methods: { jump() { - this.$router.push("/"); + this.$router.push("/connectUs"); }, }, }; diff --git a/src/views/trialCenter/components/ProductForm.vue b/src/views/trialCenter/components/ProductForm.vue index cafff31..f1300db 100644 --- a/src/views/trialCenter/components/ProductForm.vue +++ b/src/views/trialCenter/components/ProductForm.vue @@ -2,9 +2,9 @@ <div class="ProductForm"> <div class="title">鍏嶈垂璇曠敤浜у搧</div> - <el-table :data="formData" stripe> + <el-table :data="freeProd" stripe> <el-table-column - prop="version" + prop="sysPackName" label="浜у搧鐗堟湰" width="350" class-name="name" @@ -12,7 +12,7 @@ </el-table-column> <el-table-column - prop="time" + prop="createTime" label="鏇存柊鏃堕棿" width="350" class-name="name" @@ -20,7 +20,7 @@ </el-table-column> <el-table-column - prop="des" + prop="info" label="鏇存柊璇存槑" width="350" class-name="name" @@ -40,39 +40,16 @@ <script> export default { + props: { + freeProd: {}, + }, data() { - return { - formData: [ - { - version: "AIOS璇曠敤鐗�2.1.1", - time: "2021-09-01 12:34", - des: "浼樺寲浜嗚В鐮佺殑bug", - }, - { - version: "AIOS璇曠敤鐗�2.1.1", - time: "2021-09-01 12:34", - des: "浼樺寲浜嗚В鐮佺殑bug", - }, - { - version: "AIOS璇曠敤鐗�2.1.1", - time: "2021-09-01 12:34", - des: "浼樺寲浜嗚В鐮佺殑bug", - }, - { - version: "AIOS璇曠敤鐗�2.1.1", - time: "2021-09-01 12:34", - des: "浼樺寲浜嗚В鐮佺殑bug", - }, - { - version: "AIOS璇曠敤鐗�2.1.1", - time: "2021-09-01 12:34", - des: "浼樺寲浜嗚В鐮佺殑bug", - }, - ], - }; + return {}; }, methods: { - download() {}, + download(row) { + window.open(row.url); + }, }, }; </script> diff --git a/src/views/trialCenter/components/SdkItem.vue b/src/views/trialCenter/components/SdkItem.vue index 7bb13e9..adf0be5 100644 --- a/src/views/trialCenter/components/SdkItem.vue +++ b/src/views/trialCenter/components/SdkItem.vue @@ -1,18 +1,32 @@ <template> <div class="SdkItem"> <div class="icon"> - <img src="/images/index/15鎴村彛缃�.png" alt="" /> + <img :src="'/httpImage/' + sdk.logoUrl" alt="" /> </div> - <div class="title">鎴村彛缃�</div> - <div class="des"> - 瀵圭伀杞﹂┚椹惰埍鐨勭洃鎺ц棰戣繘琛屾娴嬶紝褰撻┚椹朵汉鍛樺嚭鐜拌洞浼忕幇璞℃椂锛屽皢缁撴灉璁板綍涓嬫潵 + <div class="title">{{ sdk.productName }}</div> + <div class="des limitoRow2"> + {{ sdk.description }} </div> - <div class="button">绔嬪嵆璇曠敤</div> + <div class="button" @click="buyProduct(sdk.productName)">绔嬪嵆璇曠敤</div> </div> </template> <script> -export default {}; +export default { + props: { + sdk: {}, + }, + methods: { + buyProduct(productName) { + this.$router.push({ + path: "/productDetail", + query: { + name: productName, + }, + }); + }, + }, +}; </script> <style lang="scss" scoped> @@ -34,6 +48,7 @@ } .des { + height: 38px; margin: 0 20px 30px 20px; color: #666666; font-size: 14px; diff --git a/src/views/trialCenter/components/SdkList.vue b/src/views/trialCenter/components/SdkList.vue index ba37b3c..40fece4 100644 --- a/src/views/trialCenter/components/SdkList.vue +++ b/src/views/trialCenter/components/SdkList.vue @@ -2,8 +2,12 @@ <div class="SdkList"> <div class="title">鍏嶈垂璇曠敤绠楁硶</div> - <div class="list heart"> - <SdkItem v-for="i in 16" :key="i"></SdkItem> + <div class="list scroll heart"> + <SdkItem + v-for="(item, index) in freeSdk" + :key="index" + :sdk="item" + ></SdkItem> </div> </div> </template> @@ -11,6 +15,9 @@ <script> import SdkItem from "@/views/trialCenter/components/SdkItem"; export default { + props: { + freeSdk: {}, + }, components: { SdkItem, }, @@ -32,12 +39,13 @@ } .list { + max-height: 960px; width: 1280px; display: flex; flex-wrap: wrap; .SdkItem { - margin-right: 24px; + margin-right: 22px; margin-bottom: 40px; &:nth-child(4n) { diff --git a/src/views/trialCenter/components/commendCard.vue b/src/views/trialCenter/components/commendCard.vue index 315d08b..95a392b 100644 --- a/src/views/trialCenter/components/commendCard.vue +++ b/src/views/trialCenter/components/commendCard.vue @@ -19,14 +19,46 @@ </template> <script> +import { logout } from "@/api/login"; export default { props: { - commendCardData: { - type: Array, - }, + total: {}, }, data() { - return {}; + return { + commendCardData: [ + { + img: "/images/trialCenter/绱娉ㄥ唽鐢ㄦ埛.png", + count: "", + des: "绱娉ㄥ唽鐢ㄦ埛", + }, + { + img: "/images/trialCenter/闄愭椂璇曠敤浜у搧.png", + count: "", + des: "闄愭椂璇曠敤浜у搧", + }, + { + img: "/images/trialCenter/绱鏈嶅姟浼佷笟.png", + count: "", + des: "绱鏈嶅姟浼佷笟", + }, + { + img: "/images/trialCenter/鍏嶈垂璇曠敤鏃堕暱.png", + count: "", + des: "鍏嶈垂璇曠敤鏃堕暱", + }, + ], + }; + }, + methods: { + getCount() { + this.commendCardData[0].count = this.total.totalUser; + this.commendCardData[1].count = this.total.totalFreeProd; + this.commendCardData[2].count = this.total.totalCompany; + this.commendCardData[3].count = this.total.totalFreeDay; + console.log(this.commendCardData); + this.$forceUpdate(); + }, }, }; </script> diff --git a/src/views/trialCenter/index.vue b/src/views/trialCenter/index.vue index f2d8d67..4e13a1c 100644 --- a/src/views/trialCenter/index.vue +++ b/src/views/trialCenter/index.vue @@ -2,15 +2,17 @@ <div class="trialCenter"> <IndexHeader></IndexHeader> <Banner></Banner> - <commendCard :commendCardData="commendCardData"></commendCard> - <SdkList></SdkList> - <ProductForm></ProductForm> + <commendCard ref="commendCard" :total="total"></commendCard> + <SdkList :freeSdk="freeSdk"></SdkList> + <ProductForm :freeProd="freeProd"></ProductForm> <Connect></Connect> <Footer :isBlack="true"></Footer> </div> </template> <script> +import { getFreeList } from "@/api/product"; + import IndexHeader from "@/components/IndexHeader"; import Banner from "@/views/trialCenter/components/Banner"; import commendCard from "@/views/trialCenter/components/commendCard"; @@ -20,30 +22,14 @@ import Footer from "@/components/Footer"; export default { + created() { + this.getList(); + }, data() { return { - commendCardData: [ - { - img: "/images/trialCenter/绱娉ㄥ唽鐢ㄦ埛.png", - count: "10涓�+", - des: "绱娉ㄥ唽鐢ㄦ埛", - }, - { - img: "/images/trialCenter/闄愭椂璇曠敤浜у搧.png", - count: "10娆�+", - des: "闄愭椂璇曠敤浜у搧", - }, - { - img: "/images/trialCenter/绱鏈嶅姟浼佷笟.png", - count: "800+", - des: "绱鏈嶅姟浼佷笟", - }, - { - img: "/images/trialCenter/鍏嶈垂璇曠敤鏃堕暱.png", - count: "90澶�", - des: "鍏嶈垂璇曠敤鏃堕暱", - }, - ], //鎺ㄨ崘鍗$墖鏁版嵁 + total: {}, + freeProd: [], + freeSdk: [], }; }, components: { @@ -55,6 +41,22 @@ Footer, ProductForm, }, + methods: { + async getList() { + const res = await getFreeList(); + this.total = { + totalCompany: res.data.totalCompany, + totalFreeDay: res.data.totalFreeDay, + totalFreeProd: res.data.totalFreeProd, + totalUser: res.data.totalUser, + }; + this.freeSdk = res.data.freeSdk; + this.freeProd = res.data.freeProd; + setTimeout(() => { + this.$refs["commendCard"].getCount(); + }, 0); + }, + }, }; </script> diff --git a/vue.config.js b/vue.config.js index 3027214..bed67fb 100644 --- a/vue.config.js +++ b/vue.config.js @@ -12,26 +12,6 @@ // https: false, // hotOnly: false, // 鐑洿鏂� proxy: { - "/track": { - //target: 'http://bsic.asuscomm.com:7003', - // target: 'http://222.128.87.51:8000', - target: "http://192.168.20.10:7004", - // ws: true, - changeOrigin: true, - }, - "/ws": { - //target: 'http://bsic.asuscomm.com:7004', - // target: 'http://222.128.87.51:7003', - target: "http://192.168.20.10:7004", - // ws: true, - changeOrigin: true, - }, - "/api-v": { - //target: 'http://192.168.20.145:8000', - // target: "http://192.168.20.230:8000", - target: "http://192.168.20.189:7009", - changeOrigin: true, - }, "/api": { // target: "http://192.168.20.10:7004", target: "http://192.168.20.174:7070", @@ -47,12 +27,6 @@ // target: "http://192.168.20.189:7009", // target: "http://192.168.20.117:7080", - changeOrigin: true, //寮�鍚唬鐞� - }, - "/files": { - //target: "http://bsic.asuscomm.com:7003", - // target: "http://222.128.87.51:7003", - target: "http://192.168.20.10:7004", changeOrigin: true, //寮�鍚唬鐞� }, }, -- Gitblit v1.8.0