From 2cb264ec2b7c7dd9798d1821927104fad35bd063 Mon Sep 17 00:00:00 2001 From: ZZJ <10913410+zzj2100@user.noreply.gitee.com> Date: 星期二, 28 六月 2022 14:47:43 +0800 Subject: [PATCH] 系统设置自适应 --- src/pages/settings/views/clusterManagement.vue | 498 +++++--- src/pages/datapush/index/RightEvent.vue | 13 src/pages/login/index/App.vue | 4 src/pages/search/index/Searching.vue | 14 src/components/canvas/index.vue | 513 +++++--- src/pages/settings/components/AuthorizationSetting.vue | 2 src/pages/settings/views/NetSettings.vue | 17 public/apps/loginData/login.json | 6 src/pages/cameraAccess/components/SceneRule.vue | 368 ++++-- src/pages/settings/components/UnbindBox.vue | 3 src/pages/settings/index/index.vue | 993 ++++++++++------- src/pages/settings/asset/common.scss | 4 src/pages/settings/components/LoraGateway.vue | 60 src/pages/settings/components/WifiGateway.vue | 2 src/pages/settings/components/AuthorizationManagement.vue | 2 src/pages/cameraAccess/index/VideoManage.vue | 1 src/pages/settings/views/generalSettings.vue | 4 src/pages/analysisPower/index/App.vue | 361 ++++-- src/pages/search/index/App.vue | 4 src/pages/cameraAccess/components/SeparateRules.vue | 373 +++-- 20 files changed, 1,948 insertions(+), 1,294 deletions(-) diff --git a/public/apps/loginData/login.json b/public/apps/loginData/login.json index deddd30..da292da 100644 --- a/public/apps/loginData/login.json +++ b/public/apps/loginData/login.json @@ -1,5 +1,5 @@ { - "title_firstLine" : "Smart AI", - "title_secondLine":"浜哄伐鏅鸿兘鎿嶄綔绯荤粺", - "website":"www.smartai.com" + "title_firstLine": "Smart AI", + "title_secondLine": "浜哄伐鏅鸿兘鎿嶄綔绯荤粺", + "website": "www.smartai.com" } \ No newline at end of file diff --git a/src/components/canvas/index.vue b/src/components/canvas/index.vue index aec91a9..a34a12d 100644 --- a/src/components/canvas/index.vue +++ b/src/components/canvas/index.vue @@ -1,21 +1,33 @@ <template> - <div class="s-cavas" :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px' }"> + <div + class="s-cavas" + :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px' }" + > <canvas ref="myCanvas" :width="canvasWidth" :height="canvasHeight" - :style=" - `background:url(${canvasBg}) center / ${canvasWidth}px ${canvasHeight}px no-repeat; background-size: contain;` - " + :style="`background:url(${canvasBg}) center / ${canvasWidth}px ${canvasHeight}px no-repeat; background-size: contain;`" ></canvas> - <el-tooltip content="鍒锋柊搴曞浘" placement="bottom" popper-class="atooltip" v-if="isShowRefresh"> + <el-tooltip + content="鍒锋柊搴曞浘" + placement="bottom" + popper-class="atooltip" + v-if="isShowRefresh" + > <span class="iconfont icongengxin" @click="refresh"></span> </el-tooltip> <p class="tip" :style="disabled ? `display:block;` : `display:none;`"> 鎵归噺閰嶇疆鏂瑰紡涓嶅厑璁哥粯鍒跺尯鍩燂紝璇烽�夋嫨鎽勫儚鏈鸿繘琛屽尯鍩熺粯鍒� </p> - <el-dialog title :visible.sync="visible" width="1150px" append-to-body :before-close="cancelFunc"> + <el-dialog + title + :visible.sync="visible" + width="1150px" + append-to-body + :before-close="cancelFunc" + > <canvas-dialog ref="bigCanvas" :canvasDataToChild="canvasData" @@ -24,96 +36,98 @@ ></canvas-dialog> <span slot="footer" class="dialog-footer"> <el-button @click="cancelFunc" size="small">鍙� 娑�</el-button> - <el-button type="primary" @click="handleOk" size="small">纭� 瀹�</el-button> + <el-button type="primary" @click="handleOk" size="small" + >纭� 瀹�</el-button + > </span> </el-dialog> </div> </template> <script> -import canvasDialog from "./Dialog" -import { updateSnapshot } from "@/api/camera" +import canvasDialog from "./Dialog"; +import { updateSnapshot } from "@/api/camera"; export default { name: "myCanvas", components: { - canvasDialog + canvasDialog, }, props: { divId: { default: "my-canvas", - type: String + type: String, }, isGB28181: { default: false, - type: Boolean + type: Boolean, }, isShowRefresh: { default: true, - type: Boolean + type: Boolean, }, sourceType: { default: 1, - type: Number + type: Number, }, isShowDrawArrow: { default: false, - type: Boolean + type: Boolean, }, disabled: { default: false, - type: Boolean + type: Boolean, }, canvasDataShow: { default: () => { - return { line: [], rect: [], arrow: [], polygon: [] } + return { line: [], rect: [], arrow: [], polygon: [] }; }, - type: Object + type: Object, }, currentCameraId: { type: String, - default: "" + default: "", }, snapshot_url: { type: String, - default: "" + default: "", }, isLink: { type: Boolean, - default: false + default: false, }, loading: { type: Boolean, - default: false + default: false, }, canvasWidth: { type: Number, - default: 576 + default: 576, }, canvasHeight: { type: Number, - default: 324 + default: 324, }, showProportion: { type: Number, - default: 1.666 - } + default: 1.666, + }, }, computed: { canvasBg() { if (this.snapshot_url) { // 鏁版嵁鏍堣嚜鍔ㄤ笂浼犲鐞� if (this.snapshot_url.indexOf("/opt/vasystem") == 0) { - return this.snapshot_url.replace("/opt/vasystem", "") + return this.snapshot_url.replace("/opt/vasystem", ""); } if (this.sourceType == 2) { - return `${this.snapshot_url}` + return `${this.snapshot_url}`; } else { - return `/httpImage/${this.snapshot_url}` + return `/httpImage/${this.snapshot_url}`; } } else { - return this.blackImg + return this.blackImg; } - } + }, }, data() { return { @@ -122,7 +136,7 @@ line: [], rect: [], arrow: [], - polygon: [] + polygon: [], }, // 鏈�缁堣緭鍑虹殑鐢诲竷鍧愭爣鏁版嵁 canvasPic: new Image(), // 鎾ら攢鐢ㄧ殑鍥剧墖 canvasHistory: [], // 鍘嗗彶鏁版嵁锛屼互渚涙挙閿�浣跨敤 @@ -130,169 +144,234 @@ c: null, ctx: null, visible: false, - baseImg: undefined + baseImg: undefined, //showProportion: 1.666 - } + }; }, watch: { loading: { handler(newVal, oldVal) { // console.log(newVal,'loading') if (newVal) { - this.baseImg = "" - this.refresh() + this.baseImg = ""; + this.refresh(); } }, - deep: true + deep: true, }, canvasDataShow: { handler(newVal, oldVal) { // console.log(newVal, "canvasDataShow newVal"); - this.canvasData.line = newVal.line - this.canvasData.rect = newVal.rect - this.canvasData.arrow = newVal.arrow - this.canvasData.polygon = newVal.polygon - this.clickSelect(this.canvasData) + this.canvasData.line = newVal.line; + this.canvasData.rect = newVal.rect; + this.canvasData.arrow = newVal.arrow; + this.canvasData.polygon = newVal.polygon; + this.clickSelect(this.canvasData); }, - deep: true - } + deep: true, + }, }, mounted() { this.$nextTick(() => { // this.c = document.querySelector("#" + this.divId); - this.c = this.$refs.myCanvas - this.ctx = this.c.getContext("2d") - this.canvasData = JSON.parse(JSON.stringify(this.canvasDataShow)) - this.clickSelect(this.canvasData) - }) + this.c = this.$refs.myCanvas; + this.ctx = this.c.getContext("2d"); + this.canvasData = JSON.parse(JSON.stringify(this.canvasDataShow)); + this.clickSelect(this.canvasData); + }); }, methods: { // 鑾峰彇canvas搴曞浘 async getCanvasPic() { + if (TreeDataPool.selectedNode.type == "MENU") { + return; + } // this.$emit('changeBaseImg',this.currentCameraId) - this.$emit("changeLoading", true) + this.$emit("changeLoading", true); if (this.currentCameraId) { - let _this = this + let _this = this; await updateSnapshot(this.currentCameraId, this.isGB28181) .then((res) => { if (res.data.cameraId === _this.currentCameraId) { - this.baseImg = res.data.snapshotUrl - this.$emit("refresh", res.data.snapshotUrl, _this.currentCameraId) - this.$forceUpdate() + this.baseImg = res.data.snapshotUrl; + this.$emit( + "refresh", + res.data.snapshotUrl, + _this.currentCameraId + ); + this.$forceUpdate(); this.$notify({ type: "success", - message: "搴曞浘宸插埛鏂�" - }) + message: "搴曞浘宸插埛鏂�", + }); } }) .catch((err) => { this.$notify({ type: "error", - message: "搴曞浘鍒锋柊澶辫触" - }) - }) - this.$emit("changeLoading", false) + message: "搴曞浘鍒锋柊澶辫触", + }); + }); + this.$emit("changeLoading", false); } }, showModal() { // console.log(this.canvasData, "鐐瑰嚮缁樺埗鐨勬椂鍊欎紶閫掕繃鍘荤殑鏁版嵁"); - this.visible = true + this.visible = true; this.$nextTick(() => { // this.$refs.bigCanvas.delCursor = {} - }) + }); }, cancelFunc() { - this.visible = false - this.$refs.bigCanvas.cancel() + this.visible = false; + this.$refs.bigCanvas.cancel(); // console.log("鍏抽棴浜�"); }, handleOk() { // 鍒ゆ柇鍥惧舰鐨勫悕瀛楁槸鍚﹂噸澶� // console.log("ok"); - this.$refs.bigCanvas.changeType("0") - let repeatName = this.isRepeat() + this.$refs.bigCanvas.changeType("0"); + let repeatName = this.isRepeat(); if (repeatName !== "") { this.$notify({ type: "error", - message: repeatName + "鍥惧舰鍚嶇О閲嶅锛岃鏇存锛�" - }) - return + message: repeatName + "鍥惧舰鍚嶇О閲嶅锛岃鏇存锛�", + }); + return; } this.$notify({ type: "success", - message: "宸蹭繚瀛樼粯鍒讹紒" - }) + message: "宸蹭繚瀛樼粯鍒讹紒", + }); // 姣忔淇濆瓨鍏抽棴妯℃�佺獥鏃堕兘瑕佹妸妯℃�佺獥鐨勬暟鎹啓鍒扮埗缁勪欢閲屾潵 - this.canvasData = this.$refs.bigCanvas.canvasData + this.canvasData = this.$refs.bigCanvas.canvasData; // 椤轰究鐢╁埌鏇村灞傚幓 - this.$emit("fromCanvas", this.$refs.bigCanvas.canvasData) + this.$emit("fromCanvas", this.$refs.bigCanvas.canvasData); // console.log("浣犲ソ", this.canvasData); - this.clickSelect(this.canvasData) - this.visible = false + this.clickSelect(this.canvasData); + this.visible = false; }, // 鍥炴樉cavas鏁版嵁 // 鐐瑰嚮閫変腑鍙樿壊 灏嗗綋鍓嶉〉闈㈡墍鏈夎矾寰勯噸缁樺垽鏂綋鍓嶉紶鏍囩殑鍧愭爣鍦ㄥ摢涓浘褰㈠唴 濡傛灉涓嶄紶鍧愭爣鍙傛暟灏辨槸鍥炴樉鐨勬柟娉� clickSelect(e) { - this.ctx.clearRect(0, 0, this.c.width, this.c.height) - let _this = this // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢� - _this.canvasData.line.forEach(function(v, i) { - _this.ctx.strokeStyle = "yellow" - _this.ctx.beginPath() - _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) - _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion) - _this.ctx.stroke() - _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name) - _this.c.style.cursor = "default" + this.ctx.clearRect(0, 0, this.c.width, this.c.height); + let _this = this; // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢� + _this.canvasData.line.forEach(function (v, i) { + _this.ctx.strokeStyle = "yellow"; + _this.ctx.beginPath(); + _this.ctx.moveTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[1].x / _this.showProportion, + v.location[1].y / _this.showProportion + ); + _this.ctx.stroke(); + _this.showRemarks( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion, + v.name + ); + _this.c.style.cursor = "default"; if (e && _this.ctx.isPointInStroke(e.offsetX, e.offsetY)) { // 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓� // 濡傛灉褰撳墠鐜瑕嗙洊浜嗚鍧愭爣锛屽氨灏嗗浘褰㈢殑index鏀惧埌鏁扮粍閲� // 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡 - _this.type = "0" - _this.delCursor.type = "1" - _this.delCursor.index = i + _this.type = "0"; + _this.delCursor.type = "1"; + _this.delCursor.index = i; // 灏嗗綋鍓嶅厓绱犳爣绾� - _this.ctx.strokeStyle = "red" - _this.ctx.beginPath() - _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) - _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion) - _this.ctx.stroke() - _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name) - _this.c.style.cursor = "pointer" + _this.ctx.strokeStyle = "red"; + _this.ctx.beginPath(); + _this.ctx.moveTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[1].x / _this.showProportion, + v.location[1].y / _this.showProportion + ); + _this.ctx.stroke(); + _this.showRemarks( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion, + v.name + ); + _this.c.style.cursor = "pointer"; } - }) - _this.canvasData.rect.forEach(function(v, i) { - _this.ctx.strokeStyle = "yellow" - _this.ctx.beginPath() - _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) - _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion) - _this.ctx.lineTo(v.location[2].x / _this.showProportion, v.location[2].y / _this.showProportion) - _this.ctx.lineTo(v.location[3].x / _this.showProportion, v.location[3].y / _this.showProportion) - _this.ctx.lineTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) - _this.ctx.stroke() - _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name) - _this.c.style.cursor = "default" + }); + _this.canvasData.rect.forEach(function (v, i) { + _this.ctx.strokeStyle = "yellow"; + _this.ctx.beginPath(); + _this.ctx.moveTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[1].x / _this.showProportion, + v.location[1].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[2].x / _this.showProportion, + v.location[2].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[3].x / _this.showProportion, + v.location[3].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); + _this.ctx.stroke(); + _this.showRemarks( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion, + v.name + ); + _this.c.style.cursor = "default"; if (e && _this.ctx.isPointInPath(e.offsetX, e.offsetY)) { // 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓� // 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡 - _this.type = "0" - _this.delCursor.type = "2" - _this.delCursor.index = i + _this.type = "0"; + _this.delCursor.type = "2"; + _this.delCursor.index = i; // 灏嗗綋鍓嶅厓绱犳爣绾� - _this.ctx.strokeStyle = "red" - _this.ctx.beginPath() - _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) - _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion) - _this.ctx.lineTo(v.location[2].x / _this.showProportion, v.location[2].y / _this.showProportion) - _this.ctx.lineTo(v.location[3].x / _this.showProportion, v.location[3].y / _this.showProportion) - _this.ctx.lineTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) - _this.ctx.stroke() - _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name) - _this.c.style.cursor = "pointer" + _this.ctx.strokeStyle = "red"; + _this.ctx.beginPath(); + _this.ctx.moveTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[1].x / _this.showProportion, + v.location[1].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[2].x / _this.showProportion, + v.location[2].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[3].x / _this.showProportion, + v.location[3].y / _this.showProportion + ); + _this.ctx.lineTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); + _this.ctx.stroke(); + _this.showRemarks( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion, + v.name + ); + _this.c.style.cursor = "pointer"; } - }) - _this.canvasData.arrow.forEach(function(v, i) { - _this.ctx.strokeStyle = "yellow" + }); + _this.canvasData.arrow.forEach(function (v, i) { + _this.ctx.strokeStyle = "yellow"; // _this.ctx.beginPath() // _this.ctx.moveTo(v.location[0].x / 2, v.location[0].y / 2) // _this.ctx.lineTo(v.location[1].x / 2, v.location[1].y / 2) @@ -306,18 +385,22 @@ 20, 30, "yellow" - ) // 缁樺埗鏂规硶 - _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name) - _this.c.style.cursor = "default" + ); // 缁樺埗鏂规硶 + _this.showRemarks( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion, + v.name + ); + _this.c.style.cursor = "default"; if (e && _this.ctx.isPointInStroke(e.offsetX, e.offsetY)) { // 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓� // 濡傛灉褰撳墠鐜瑕嗙洊浜嗚鍧愭爣锛屽氨灏嗗浘褰㈢殑index鏀惧埌鏁扮粍閲� // 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡 - _this.type = "0" - _this.delCursor.type = "4" - _this.delCursor.index = i + _this.type = "0"; + _this.delCursor.type = "4"; + _this.delCursor.index = i; // 灏嗗綋鍓嶅厓绱犳爣绾� - _this.ctx.strokeStyle = "red" + _this.ctx.strokeStyle = "red"; // _this.ctx.beginPath() // _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) // _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion) @@ -331,62 +414,78 @@ 20, 30, "red" - ) // 缁樺埗鏂规硶 - _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name) - _this.c.style.cursor = "pointer" + ); // 缁樺埗鏂规硶 + _this.showRemarks( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion, + v.name + ); + _this.c.style.cursor = "pointer"; } - }) - _this.canvasData.polygon.forEach(function(v, i) { + }); + _this.canvasData.polygon.forEach(function (v, i) { if (v.location.length === 0) { - return + return; } - _this.ctx.strokeStyle = "yellow" - _this.ctx.beginPath() - _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) + _this.ctx.strokeStyle = "yellow"; + _this.ctx.beginPath(); + _this.ctx.moveTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); for (let i = 1; i < v.location.length; i++) { - _this.ctx.lineTo(v.location[i].x / _this.showProportion, v.location[i].y / _this.showProportion) + _this.ctx.lineTo( + v.location[i].x / _this.showProportion, + v.location[i].y / _this.showProportion + ); } - _this.ctx.closePath() - _this.ctx.stroke() + _this.ctx.closePath(); + _this.ctx.stroke(); _this.showRemarks( v.location[v.location.length - 1].x / _this.showProportion, v.location[v.location.length - 1].y / _this.showProportion, v.name - ) - _this.c.style.cursor = "default" + ); + _this.c.style.cursor = "default"; if (e && _this.ctx.isPointInPath(e.offsetX, e.offsetY)) { // 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓� // 濡傛灉褰撳墠鐜瑕嗙洊浜嗚鍧愭爣锛屽氨灏嗗浘褰㈢殑index鏀惧埌鏁扮粍閲� // 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡 - _this.type = "0" - _this.delCursor.type = "5" - _this.delCursor.index = i + _this.type = "0"; + _this.delCursor.type = "5"; + _this.delCursor.index = i; // 灏嗗綋鍓嶅厓绱犳爣绾� - _this.ctx.strokeStyle = "red" - _this.ctx.beginPath() - _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion) + _this.ctx.strokeStyle = "red"; + _this.ctx.beginPath(); + _this.ctx.moveTo( + v.location[0].x / _this.showProportion, + v.location[0].y / _this.showProportion + ); for (let i = 1; i < v.location.length; i++) { - _this.ctx.lineTo(v.location[i].x / _this.showProportion, v.location[i].y / _this.showProportion) + _this.ctx.lineTo( + v.location[i].x / _this.showProportion, + v.location[i].y / _this.showProportion + ); } - _this.ctx.closePath() - _this.ctx.stroke() + _this.ctx.closePath(); + _this.ctx.stroke(); _this.showRemarks( v.location[v.location.length - 1].x / _this.showProportion, v.location[v.location.length - 1].y / _this.showProportion, v.name - ) - _this.c.style.cursor = "pointer" + ); + _this.c.style.cursor = "pointer"; } - }) + }); }, // 鍥炴樉鍥惧舰澶囨敞 showRemarks(x, y, remarks) { - this.ctx.moveTo(x, y - 10) // 鍥犱负鏀惧ぇ涔嬪悗鏄痽-20锛屾墍浠ョ缉灏忕増鐨勪负y-10 - this.ctx.fillStyle = "green" // 璁剧疆濉厖棰滆壊涓虹豢鑹� - this.ctx.font = '10px "寰蒋闆呴粦"' // 璁剧疆瀛椾綋 - this.ctx.textBaseline = "bottom" // 璁剧疆瀛椾綋搴曠嚎瀵归綈缁樺埗鍩虹嚎 - this.ctx.textAlign = "left" // 璁剧疆瀛椾綋瀵归綈鐨勬柟寮� - this.ctx.fillText(remarks, x, y - 10) // 濉厖鏂囧瓧 + this.ctx.moveTo(x, y - 10); // 鍥犱负鏀惧ぇ涔嬪悗鏄痽-20锛屾墍浠ョ缉灏忕増鐨勪负y-10 + this.ctx.fillStyle = "green"; // 璁剧疆濉厖棰滆壊涓虹豢鑹� + this.ctx.font = '10px "寰蒋闆呴粦"'; // 璁剧疆瀛椾綋 + this.ctx.textBaseline = "bottom"; // 璁剧疆瀛椾綋搴曠嚎瀵归綈缁樺埗鍩虹嚎 + this.ctx.textAlign = "left"; // 璁剧疆瀛椾綋瀵归綈鐨勬柟寮� + this.ctx.fillText(remarks, x, y - 10); // 濉厖鏂囧瓧 }, // 绠ご缁樺埗鍑芥暟 drawArrow(ctx, fromX, fromY, toX, toY, theta, headlen, width, color) { @@ -397,86 +496,86 @@ // headlen锛氫笁瑙掓枩杈归暱搴� // width锛氱澶寸嚎瀹藉害 // color锛氱澶撮鑹� - theta = typeof theta !== "undefined" ? theta : 30 - headlen = typeof theta !== "undefined" ? headlen : 10 - width = typeof width !== "undefined" ? width : 1 - color = typeof color !== "undefined" ? color : "yellow" + theta = typeof theta !== "undefined" ? theta : 30; + headlen = typeof theta !== "undefined" ? headlen : 10; + width = typeof width !== "undefined" ? width : 1; + color = typeof color !== "undefined" ? color : "yellow"; // 璁$畻鍚勮搴﹀拰瀵瑰簲鐨凱2,P3鍧愭爣 - let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI - let angle1 = ((angle + theta) * Math.PI) / 180 - let angle2 = ((angle - theta) * Math.PI) / 180 - let topX = headlen * Math.cos(angle1) - let topY = headlen * Math.sin(angle1) - let botX = headlen * Math.cos(angle2) - let botY = headlen * Math.sin(angle2) + let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI; + let angle1 = ((angle + theta) * Math.PI) / 180; + let angle2 = ((angle - theta) * Math.PI) / 180; + let topX = headlen * Math.cos(angle1); + let topY = headlen * Math.sin(angle1); + let botX = headlen * Math.cos(angle2); + let botY = headlen * Math.sin(angle2); - ctx.save() - ctx.beginPath() - let arrowX = fromX - topX - let arrowY = fromY - topY - ctx.moveTo(arrowX, arrowY) - ctx.moveTo(fromX, fromY) - ctx.lineTo(toX, toY) - arrowX = toX + topX - arrowY = toY + topY - ctx.moveTo(arrowX, arrowY) - ctx.lineTo(toX, toY) - arrowX = toX + botX - arrowY = toY + botY - ctx.lineTo(arrowX, arrowY) - ctx.strokeStyle = color - ctx.lineWidth = width - ctx.stroke() - ctx.restore() + ctx.save(); + ctx.beginPath(); + let arrowX = fromX - topX; + let arrowY = fromY - topY; + ctx.moveTo(arrowX, arrowY); + ctx.moveTo(fromX, fromY); + ctx.lineTo(toX, toY); + arrowX = toX + topX; + arrowY = toY + topY; + ctx.moveTo(arrowX, arrowY); + ctx.lineTo(toX, toY); + arrowX = toX + botX; + arrowY = toY + botY; + ctx.lineTo(arrowX, arrowY); + ctx.strokeStyle = color; + ctx.lineWidth = width; + ctx.stroke(); + ctx.restore(); }, async refresh() { // console.log(this.loading,'鍒锋柊搴曞浘',this.snapshot_url) if (!this.currentCameraId) { - return false + return false; } // await this.$emit('changeLoading', true) - this.getCanvasPic() + this.getCanvasPic(); }, // 鍒ゆ柇鍥惧舰鍚嶇О鏄惁閲嶅 isRepeat() { - let _this = this // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢� - let nameArray = [] + let _this = this; // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢� + let nameArray = []; for (const v of _this.$refs.bigCanvas.canvasData.line) { for (const item of nameArray) { if (v.name === item) { - return v.name + return v.name; } } - nameArray.push(v.name) + nameArray.push(v.name); } for (const v of _this.$refs.bigCanvas.canvasData.arrow) { for (const item of nameArray) { if (v.name === item) { - return v.name + return v.name; } } - nameArray.push(v.name) + nameArray.push(v.name); } for (const v of _this.$refs.bigCanvas.canvasData.rect) { for (const item of nameArray) { if (v.name === item) { - return v.name + return v.name; } } - nameArray.push(v.name) + nameArray.push(v.name); } for (const v of _this.$refs.bigCanvas.canvasData.polygon) { for (const item of nameArray) { if (v.name === item) { - return v.name + return v.name; } } - nameArray.push(v.name) + nameArray.push(v.name); } - return "" - } - } -} + return ""; + }, + }, +}; </script> <style lang="scss" scoped> canvas { diff --git a/src/pages/analysisPower/index/App.vue b/src/pages/analysisPower/index/App.vue index e5b7ce9..18819bb 100644 --- a/src/pages/analysisPower/index/App.vue +++ b/src/pages/analysisPower/index/App.vue @@ -16,13 +16,18 @@ </div> </div> - <div class="bottom" :style="{'height':strethTable?'calc(100% - 30px)':'calc(100% - 220px)'}"> - <div style="width: 100%;height: 10px;background-color: #E9EBF2;"></div> + <div + class="bottom" + :style="{ + height: strethTable ? 'calc(100% - 30px)' : 'calc(100% - 220px)', + }" + > + <div style="width: 100%; height: 10px; background-color: #e9ebf2"></div> <div class="content"> <div class="toolBar"> <el-input size="small" - style="width: 180px;" + style="width: 180px" placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" prefix-icon="el-icon-search" clearable @@ -31,50 +36,72 @@ <el-button size="small" type="primary" - style="margin-left: 20px; margin-right: 50px;" + style="margin-left: 20px; margin-right: 50px" @click="pollSeach" - >鎼滅储</el-button> + >鎼滅储</el-button + > <div class="tip"> <span> 杞鏃堕棿 : - <b>{{PollData.Config.poll_period}}</b>鍒嗛挓 + <b>{{ PollData.Config.poll_period }}</b + >鍒嗛挓 </span> <span> 杞鍛ㄦ湡 : - <b>{{pollCycle}}</b>鍒嗛挓 + <b>{{ pollCycle }}</b + >鍒嗛挓 </span> <span> 杞寮�鍏� : - <b>{{PollData.Enabled | switchText}}</b> + <b>{{ PollData.Enabled | switchText }}</b> </span> </div> - <span :class="stretchStyle" @click="strethTable = !strethTable"></span> + <span + :class="stretchStyle" + @click="strethTable = !strethTable" + ></span> <el-button size="small" type="primary" - style="float:right" + style="float: right" @click="openDrawer" v-if="showSetting" - >璁剧疆</el-button> + >璁剧疆</el-button + > </div> <el-table - :header-cell-style="{background:'#F8F8F8', color: '#222222'}" + :header-cell-style="{ background: '#F8F8F8', color: '#222222' }" height="93%" :data="PollData.CameraList" border :cell-style="cellStyle" > - <el-table-column label="搴忓彿" type="index" align="center" width="60px"></el-table-column> - <el-table-column label="鎽勫儚鏈哄悕绉�" align="center" show-overflow-tooltip> + <el-table-column + label="搴忓彿" + type="index" + align="center" + width="60px" + ></el-table-column> + <el-table-column + label="鎽勫儚鏈哄悕绉�" + align="center" + show-overflow-tooltip + > <template slot-scope="scope"> - <span - :style="scope.row.is_running ? `color:#3d68e1` : '' " - >{{scope.row.alias !== '' ? scope.row.alias: scope.row.name}}</span> + <span :style="scope.row.is_running ? `color:#3d68e1` : ''">{{ + scope.row.alias !== "" ? scope.row.alias : scope.row.name + }}</span> </template> </el-table-column> - <el-table-column label="鎽勫儚鏈哄湴鍧�" prop="addr" align="center" show-overflow-tooltip sortable></el-table-column> + <el-table-column + label="鎽勫儚鏈哄湴鍧�" + prop="addr" + align="center" + show-overflow-tooltip + sortable + ></el-table-column> <el-table-column label="鎽勫儚鏈篒P" prop="ip" @@ -85,39 +112,59 @@ ></el-table-column> <el-table-column label="鎽勫儚鏈虹被鍨�" align="center" width="120px"> <template slot-scope="scope"> - <span>{{scope.row.run_type | cameraType}}</span> + <span>{{ scope.row.run_type | cameraType }}</span> </template> </el-table-column> - <el-table-column label="鎵ц绠楁硶" align="center" show-overflow-tooltip> + <el-table-column + label="鎵ц绠楁硶" + align="center" + show-overflow-tooltip + > <template slot-scope="scope"> - <span v-if="scope.row.run_type === -1 ">-</span> - <span v-else-if="scope.row.tasks != null ">{{scope.row.tasks | taskList}}</span> + <span v-if="scope.row.run_type === -1">-</span> + <span v-else-if="scope.row.tasks != null">{{ + scope.row.tasks | taskList + }}</span> <span v-else>-</span> </template> </el-table-column> - <el-table-column label="杩愯璁惧" align="center" width="160px" sortable> + <el-table-column + label="杩愯璁惧" + align="center" + width="160px" + sortable + > <template slot-scope="scope"> - <span v-if="scope.row.run_type === -1 ">-</span> - <span v-else>{{scope.row.runServerName}}</span> + <span v-if="scope.row.run_type === -1">-</span> + <span v-else>{{ scope.row.runServerName }}</span> </template> </el-table-column> - <el-table-column label="鐘舵��" align="center" show-overflow-tooltip width="100px"> + <el-table-column + label="鐘舵��" + align="center" + show-overflow-tooltip + width="100px" + > <template slot-scope="scope"> - <span v-if="scope.row.status === -1 ">-</span> - <span v-else-if="scope.row.status === 2">{{"澶勭悊涓�"}}</span> - <span v-else-if="scope.row.status === 1">{{"绛夊緟澶勭悊"}}</span> - <span v-else-if="scope.row.status === 0">{{"瑙勫垯涓嶅叏"}}</span> + <span v-if="scope.row.status === -1">-</span> + <span v-else-if="scope.row.status === 2">{{ "澶勭悊涓�" }}</span> + <span v-else-if="scope.row.status === 1">{{ "绛夊緟澶勭悊" }}</span> + <span v-else-if="scope.row.status === 0">{{ "瑙勫垯涓嶅叏" }}</span> </template> </el-table-column> <el-table-column label="瀹炴椂/杞" align="center" width="100px"> <template slot-scope="scope"> - <span v-if="scope.row.run_type === -1 ">-</span> + <span v-if="scope.row.run_type === -1">-</span> <toggle-button v-else :value="scope.row.run_type === 1" :width="60" - :labels="{checked: '瀹炴椂', unchecked: '杞'}" - :color="{checked: '#4D88FF', unchecked: '#FF7733', disabled: '#CCCCCC'}" + :labels="{ checked: '瀹炴椂', unchecked: '杞' }" + :color="{ + checked: '#4D88FF', + unchecked: '#FF7733', + disabled: '#CCCCCC', + }" :sync="true" @change="pollSwitch(scope.row)" /> @@ -137,29 +184,34 @@ :before-close="closeDrawer" > <div class="dawer_details"> - <span>鎬荤畻鍔� {{formData.totalChanle}} 閫氶亾</span> - <span style="margin-left:20px">瀹炴椂绠楀姏 {{formData.realTime}} 閫氶亾</span> + <span>鎬荤畻鍔� {{ formData.totalChanle }} 閫氶亾</span> + <span style="margin-left: 20px" + >瀹炴椂绠楀姏 {{ formData.realTime }} 閫氶亾</span + > </div> <div class="e-drawer_rate"> <div class="rate"> <label>杞鏃堕棿</label> <el-input-number size="small" - style="width: 60px;margin-left:25px" + style="width: 60px; margin-left: 25px" v-model.number="formData.pollPeriod" :controls="false" - :min="0" + :min="1" :max="60 * 24 * 1" ></el-input-number> <span>鍒嗛挓</span> <label>杞寮�鍏�</label> - <el-switch style="margin-left: 10px;" v-model="formData.pollEnable"></el-switch> + <el-switch + style="margin-left: 10px" + v-model="formData.pollEnable" + ></el-switch> </div> <div class="rate"> <label>杞绠楀姏</label> <el-input-number - style="margin-left:25px;width:90px" + style="margin-left: 25px; width: 90px" size="small" v-model="formData.polling" @change="changePoll" @@ -171,7 +223,7 @@ <div class="rate"> <label>鏁版嵁鏍堢畻鍔�</label> <el-input-number - style="margin-left:11px;width:90px" + style="margin-left: 11px; width: 90px" size="small" v-model="formData.dataStack" @change="changeStack" @@ -184,10 +236,17 @@ <el-button size="small" type="primary" - style="margin:10px 10px 0px 200px" + style="margin: 10px 10px 0px 200px" @click="saveSetting" - >淇濆瓨</el-button> - <el-button size="small" type="info" style="color:black" @click="closeDrawer">鍙栨秷</el-button> + >淇濆瓨</el-button + > + <el-button + size="small" + type="info" + style="color: black" + @click="closeDrawer" + >鍙栨秷</el-button + > </div> </el-drawer> </div> @@ -195,9 +254,14 @@ <script> import echarts from "echarts"; -import { changeRunType, updatePollEnable, updatePollPeriod, updateChannelCount } from "@/api/pollConfig"; +import { + changeRunType, + updatePollEnable, + updatePollPeriod, + updateChannelCount, +} from "@/api/pollConfig"; -import Sysinfo from "@/components/subComponents/SystemInfo" +import Sysinfo from "@/components/subComponents/SystemInfo"; export default { name: "PollSeting", components: { @@ -208,15 +272,18 @@ return type === -1 ? "鐩戞帶鎽勫儚鏈�" : "AI鎽勫儚鏈�"; }, taskList(tasks) { - return tasks.filter(task => { - return task.hasRule; - }).map(task => { - return task.taskname - }).join(',') + return tasks + .filter((task) => { + return task.hasRule; + }) + .map((task) => { + return task.taskname; + }) + .join(","); }, switchText(type) { return type ? "宸插紑鍚�" : "鏈紑鍚�"; - } + }, }, computed: { maxPoll() { @@ -227,26 +294,29 @@ }, stretchStyle() { let arry = ["iconfont", "stretch-btn"]; - arry.push(this.strethTable ? "iconzhankai" : "iconshouqi") + arry.push(this.strethTable ? "iconzhankai" : "iconshouqi"); return arry; }, pollCycle() { - if (this.PollData.PollValidCount===0||!this.PollData.PollValidCount) { - return 0 + if (this.PollData.PollValidCount === 0 || !this.PollData.PollValidCount) { + return 0; } let sumPollingCamera = 0; - this.PollData.CameraList.forEach(cam => { + this.PollData.CameraList.forEach((cam) => { if (cam.run_type === 0) { - sumPollingCamera++ + sumPollingCamera++; } - }) + }); // 鎵�鏈夎疆璇㈢殑鎽勫儚鏈烘�绘暟 * 杞鏃堕棿 / 杞绠楀姏 - 1 - let ret = (sumPollingCamera * this.PollData.Config.poll_period) / this.PollData.PollValidCount - 1 + let ret = + (sumPollingCamera * this.PollData.Config.poll_period) / + this.PollData.PollValidCount - + 1; if (String(ret).indexOf(".") > 0) { - ret = ret.toFixed(1) + ret = ret.toFixed(1); } - return ret < 0 ? 0 : ret + return ret < 0 ? 0 : ret; }, isAdmin() { if ( @@ -260,8 +330,10 @@ return false; }, showSetting() { - return this.isAdmin || this.buttonAuthority.indexOf("analysisPower:set") > -1 - } + return ( + this.isAdmin || this.buttonAuthority.indexOf("analysisPower:set") > -1 + ); + }, }, data() { return { @@ -288,10 +360,16 @@ }, methods: { ipSortMethod(a, b) { - if (Number(a.ip.substr(a.ip.lastIndexOf('.') + 1)) < Number(b.ip.substr(b.ip.lastIndexOf('.') + 1))) { + if ( + Number(a.ip.substr(a.ip.lastIndexOf(".") + 1)) < + Number(b.ip.substr(b.ip.lastIndexOf(".") + 1)) + ) { return -1; } - if (Number(a.ip.substr(a.ip.lastIndexOf('.') + 1)) > Number(b.ip.substr(b.ip.lastIndexOf('.') + 1))) { + if ( + Number(a.ip.substr(a.ip.lastIndexOf(".") + 1)) > + Number(b.ip.substr(b.ip.lastIndexOf(".") + 1)) + ) { return 1; } return 0; @@ -313,34 +391,36 @@ pollPeriod: this.PollData.Config.poll_period, polling: this.PollData.PollChannelTotal, dataStack: this.PollData.localVideo, - } + }; }, pollSeach() { this.PollData.fetchPollList(); }, pollEnable() { - updatePollEnable({ enable: this.PollData.Enabled }).then(rsp => { + updatePollEnable({ enable: this.PollData.Enabled }).then((rsp) => { this.$notify({ type: "success", - message: "淇敼鎴愬姛" + message: "淇敼鎴愬姛", }); // this.PollData.fetchPollConfig() - }) + }); }, updateDelayTime() { - updatePollPeriod({ period: this.PollData.Config.poll_period }).then(rsp => { - if (rsp && rsp.success) { - this.$notify({ - type: 'success', - message: '杞鏃堕棿淇敼鎴愬姛锛�' - }) - } else { - this.$notify({ - type: 'error', - message: '杞鏃堕棿淇敼澶辫触锛�' - }) + updatePollPeriod({ period: this.PollData.Config.poll_period }).then( + (rsp) => { + if (rsp && rsp.success) { + this.$notify({ + type: "success", + message: "杞鏃堕棿淇敼鎴愬姛锛�", + }); + } else { + this.$notify({ + type: "error", + message: "杞鏃堕棿淇敼澶辫触锛�", + }); + } } - }) + ); }, statistic() { this.PollData.statistics(); @@ -351,19 +431,18 @@ }, pollSwitch(row) { changeRunType({ camera_ids: [row.id], run_type: row.run_type ^ 1 }).then( - rsp => { + (rsp) => { if (rsp && rsp.success) { this.$notify({ type: "success", - message: "閰嶇疆鎴愬姛" + message: "閰嶇疆鎴愬姛", }); - row.run_type = row.run_type ^ 1 - + row.run_type = row.run_type ^ 1; } else { this.$notify({ type: "error", - message: "閰嶇疆澶辫触" + message: "閰嶇疆澶辫触", }); } @@ -380,14 +459,14 @@ trigger: "axis", axisPointer: { // 鍧愭爣杞存寚绀哄櫒锛屽潗鏍囪酱瑙﹀彂鏈夋晥 - type: "shadow" // 榛樿涓虹洿绾匡紝鍙�変负锛�'line' | 'shadow' - } + type: "shadow", // 榛樿涓虹洿绾匡紝鍙�変负锛�'line' | 'shadow' + }, }, grid: { top: 40, // bottom: '45%', left: 0, - containLabel: true + containLabel: true, }, xAxis: [ @@ -398,138 +477,144 @@ // alignWithLabel: true }, axisLine: { - show: false + show: false, }, - nameLocation: 'start', + nameLocation: "start", axisTick: { - show: false + show: false, }, axisLabel: { rotate: 45, formatter: function (value, index) { - let name = "" + let name = ""; if (value.length > 2) { - name = value.substring(0, 2) + '...' + name = value.substring(0, 2) + "..."; } else { - name = value + name = value; } - let text = [`{a|${name}}`] - return text + let text = [`{a|${name}}`]; + return text; }, rich: { a: { fontSize: 10, - with: 30 - } - } - } - } + with: 30, + }, + }, + }, + }, ], yAxis: [ { type: "value", show: true, axisLine: { - show: false + show: false, }, splitLine: { lineStyle: { type: "dotted", - color: ['#f1f1f1'] - } + color: ["#f1f1f1"], + }, }, axisTick: { - show: false - } - } + show: false, + }, + }, ], series: [ { name: "鏁伴噺", type: "bar", barWidth: "30%", - data: this.dataList - } - ] + data: this.dataList, + }, + ], }; - this.showSysInfo = true + this.showSysInfo = true; this.barChart.setOption(optionBar); - this.barChart.resize() + this.barChart.resize(); this.$nextTick(() => { - this.barChart.resize() - }) + this.barChart.resize(); + }); }, //婊戝潡鏁版嵁鏇存柊鍥炶皟 changeSlider(val) { // console.log(val, '婊戝潡鍊煎彉鍔�') - let fileChannelCount = val[val.length - 1] - val[val.length - 2] - let pollChannelCount = val[val.length - 2] - val[val.length - 3] - this.PollData.updateChannelCount(fileChannelCount, pollChannelCount) + let fileChannelCount = val[val.length - 1] - val[val.length - 2]; + let pollChannelCount = val[val.length - 2] - val[val.length - 3]; + this.PollData.updateChannelCount(fileChannelCount, pollChannelCount); }, async saveSetting() { - let rsp = await updatePollEnable({ enable: this.formData.pollEnable }) + let rsp = await updatePollEnable({ enable: this.formData.pollEnable }); if (!rsp || !rsp.success) { - this.formData.pollEnable = !this.formData.pollEnable + this.formData.pollEnable = !this.formData.pollEnable; this.$notify({ type: "error", - message: "杞寮�鍏冲垏鎹㈠け璐ワ紒" + message: "杞寮�鍏冲垏鎹㈠け璐ワ紒", }); - return + return; } - rsp = await updatePollPeriod({ period: this.formData.pollPeriod }) + rsp = await updatePollPeriod({ period: this.formData.pollPeriod }); if (!rsp || !rsp.success) { this.$notify({ type: "error", - message: "杞鏃堕棿淇敼澶辫触锛�" + message: "杞鏃堕棿淇敼澶辫触锛�", }); - return + return; } - rsp = await updateChannelCount({ videoChannelCount: this.formData.dataStack, pollChannelCount: this.formData.polling }) + rsp = await updateChannelCount({ + videoChannelCount: this.formData.dataStack, + pollChannelCount: this.formData.polling, + }); if (!rsp || !rsp.success) { this.$notify({ type: "error", - message: "绠楀姏閰嶇疆澶辫触锛�" + message: "绠楀姏閰嶇疆澶辫触锛�", }); - return + return; } else { this.$notify({ type: "success", - message: "閰嶇疆淇濆瓨鎴愬姛" + message: "閰嶇疆淇濆瓨鎴愬姛", }); } - this.PollData.statisticTaskInfo() - this.PollData.fetchPollConfig() + this.PollData.statisticTaskInfo(); + this.PollData.fetchPollConfig(); }, //鐩戝惉杞绠楀姏 changePoll(newVal, oldVal) { if (newVal > oldVal) { - this.formData.dataStack-- + this.formData.dataStack--; } if (newVal < oldVal) { - this.formData.dataStack++ + this.formData.dataStack++; } // console.log("this.formData.dataStack:"+this.formData.dataStack) }, //鐩戝惉鏁版嵁鏍堢畻鍔� changeStack(newVal, oldVal) { if (newVal > oldVal) { - this.formData.polling-- + this.formData.polling--; } if (newVal < oldVal) { - this.formData.polling++ + this.formData.polling++; } // console.log("this.formData.polling:"+this.formData.polling) }, cellStyle(obj) { - if (obj.column.label == '鎽勫儚鏈哄悕绉�' || obj.column.label == '鎽勫儚鏈哄湴鍧�') { - return 'text-align:left;padding-left:8px;' + if ( + obj.column.label == "鎽勫儚鏈哄悕绉�" || + obj.column.label == "鎽勫儚鏈哄湴鍧�" + ) { + return "text-align:left;padding-left:8px;"; } - } - } + }, + }, }; </script> <style lang="scss"> diff --git a/src/pages/cameraAccess/components/SceneRule.vue b/src/pages/cameraAccess/components/SceneRule.vue index c5d985a..b89044f 100644 --- a/src/pages/cameraAccess/components/SceneRule.vue +++ b/src/pages/cameraAccess/components/SceneRule.vue @@ -1,8 +1,13 @@ <template> <div class="scene-edit-container"> <div class="scene-title"> - <b style="font-size: 14px; line-height: 18px;">鍦烘櫙</b> - <el-button type="primary" size="mini" @click="handleCreate" style="margin-left:90%" v-show="!editScene" + <b style="font-size: 14px; line-height: 18px">鍦烘櫙</b> + <el-button + type="primary" + size="mini" + @click="handleCreate" + style="margin-left: 90%" + v-show="!editScene && TreeDataPool.selectedNode.type !== 'MENU'" >+ 娣诲姞鍦烘櫙</el-button > </div> @@ -11,10 +16,19 @@ <div class="flex-form"> <div class="left"> <el-form-item label="鍦烘櫙鍚嶇О"> - <el-input v-model="sceneForm.scene_name" size="mini" maxlength="15"></el-input> + <el-input + v-model="sceneForm.scene_name" + size="mini" + maxlength="15" + ></el-input> </el-form-item> <el-form-item label="浜嬩欢绛夌骇"> - <el-select v-model="sceneForm.alarm_level" placeholder="璇烽�夋嫨" size="mini" style="width:250px"> + <el-select + v-model="sceneForm.alarm_level" + placeholder="璇烽�夋嫨" + size="mini" + style="width: 250px" + > <el-option label="涓�绾�" :value="1"></el-option> <el-option label="浜岀骇" :value="2"></el-option> <el-option label="涓夌骇" :value="3"></el-option> @@ -23,7 +37,11 @@ </el-select> </el-form-item> <el-form-item label="鏃堕棿娈�"> - <el-select v-model="sceneForm.time_rule_id" placeholder="璇烽�夋嫨" size="mini"> + <el-select + v-model="sceneForm.time_rule_id" + placeholder="璇烽�夋嫨" + size="mini" + > <el-option v-for="item in VideoManageData.TimeRules" :key="item.id" @@ -35,19 +53,42 @@ </div> <div class="right"> <el-form-item label="鍦烘櫙鎻忚堪"> - <el-input v-model="sceneForm.desc" type="textarea" size="mini"></el-input> + <el-input + v-model="sceneForm.desc" + type="textarea" + size="mini" + ></el-input> </el-form-item> <el-form-item label="浜嬩欢澹伴煶"> - <el-select v-model="sceneForm.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 + v-model="sceneForm.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 @click="togglePlayer" style="cursor:pointer; margin-left:20px" v-show="sceneForm.voiceId.length"> + <span + @click="togglePlayer" + style="cursor: pointer; margin-left: 20px" + v-show="sceneForm.voiceId.length" + > <i v-if="togglePlay" class="el-icon-video-play" - style="font-size:26px; vertical-align:middle; color:#409eff" + 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> + <i + v-else + class="el-icon-video-pause" + style="font-size: 26px; vertical-align: middle; color: #409eff" + ></i> </span> </el-form-item> </div> @@ -61,9 +102,11 @@ @sdkNameChange="getSceneName" ></scene-editor> - <el-form-item style="width: 60%;min-width: 1048px;"> + <el-form-item style="width: 60%; min-width: 1048px"> <el-button size="mini" @click="editScene = false">鍙栨秷</el-button> - <el-button type="primary" size="mini" @click="saveSceneRule">淇濆瓨</el-button> + <el-button type="primary" size="mini" @click="saveSceneRule" + >淇濆瓨</el-button + > </el-form-item> </el-form> @@ -73,19 +116,42 @@ <el-table :data="tableRuleList" border - style="width:100%" + style="width: 100%" :cell-style="cellStyle" :header-cell-style="{ background: '#f8f8f8', color: '#222222' }" > - <el-table-column label="搴忓彿" type="index" align="center"></el-table-column> - <el-table-column label="鍦烘櫙鍚嶇О" prop="scene_name" align="center" show-overflow-tooltip></el-table-column> - <el-table-column label="绛栫暐" prop="group_text" align="center" min-width="350px"> + <el-table-column + label="搴忓彿" + type="index" + align="center" + ></el-table-column> + <el-table-column + label="鍦烘櫙鍚嶇О" + prop="scene_name" + align="center" + show-overflow-tooltip + ></el-table-column> + <el-table-column + label="绛栫暐" + prop="group_text" + align="center" + min-width="350px" + > <template slot-scope="scope"> <span v-html="scope.row.group_text"></span> </template> </el-table-column> - <el-table-column label="鏃堕棿娈�" prop="time_name" align="center"></el-table-column> - <el-table-column label="鎻忚堪" prop="desc" align="center" min-width="120"></el-table-column> + <el-table-column + label="鏃堕棿娈�" + prop="time_name" + align="center" + ></el-table-column> + <el-table-column + label="鎻忚堪" + prop="desc" + align="center" + min-width="120" + ></el-table-column> <!-- <el-table-column label="鐘舵��" align="center" width="90"> <template slot-scope="scope"> <el-switch v-model="scope.row.defence_state" @change="updateDefence(scope.row)"></el-switch> @@ -103,13 +169,27 @@ </el-table-column> <el-table-column label="鎿嶄綔" fixed="right" align="center"> <template slot-scope="scope"> - <el-tooltip content="缂栬緫" :hide-after="700" placement="top" popper-class="atooltip"> - <i class="iconfont iconbianji1 btn-icon" style="font-size: 28px;" @click="handleEdit(scope.row)"></i> + <el-tooltip + content="缂栬緫" + :hide-after="700" + placement="top" + popper-class="atooltip" + > + <i + class="iconfont iconbianji1 btn-icon" + style="font-size: 28px" + @click="handleEdit(scope.row)" + ></i> </el-tooltip> - <el-tooltip content="鍒犻櫎" :hide-after="700" placement="top" popper-class="atooltipgroup_"> + <el-tooltip + content="鍒犻櫎" + :hide-after="700" + placement="top" + popper-class="atooltipgroup_" + > <i class="iconfont iconshanchu4 btn-icon" - style="font-size: 28px; color:red;" + style="font-size: 28px; color: red" @click="handleDelScene(scope.row)" ></i> </el-tooltip> @@ -122,65 +202,65 @@ </template> <script> -import { saveCameraScene, deleteCameraScene } from "@/api/scene" -import RuleEditor from "@/components/subComponents/RuleEditor" -import SceneEditor from "./scene/Editor" -import { getSoundList } from "@/api/event" +import { saveCameraScene, deleteCameraScene } from "@/api/scene"; +import RuleEditor from "@/components/subComponents/RuleEditor"; +import SceneEditor from "./scene/Editor"; +import { getSoundList } from "@/api/event"; export default { name: "SceneRuleEditor", components: { - SceneEditor + SceneEditor, }, props: { seletedCameras: { type: Array, default: () => { - return [] - } + return []; + }, }, tableRuleList: { type: Array, default: () => { - return [] - } + return []; + }, }, onSaveScene: { type: Function, - default: () => false + default: () => false, }, linkRule: { type: Boolean, - default: false - } + default: false, + }, }, filters: { alarmLevel(level) { switch (level) { case 1: - return "涓�绾�" + return "涓�绾�"; case 2: - return "浜岀骇" + return "浜岀骇"; case 3: - return "涓夌骇" + return "涓夌骇"; case 4: - return "鍥涚骇" + return "鍥涚骇"; case 5: - return "浜旂骇" + return "浜旂骇"; } - } + }, }, watch: { tableRuleList(n, o) { - this.editScene = false - } + this.editScene = false; + }, }, mounted() { // window.addEventListener('resize', this.windowSizeChange) - this.getSounds() + this.getSounds(); this.eventAudio.addEventListener("ended", () => { - this.togglePlay = true - }) + this.togglePlay = true; + }); }, data() { return { @@ -194,7 +274,7 @@ template_id: "", time_rule_id: "", voice: {}, - voiceId: "" + voiceId: "", }, templateSdks: [], templateRules: "", @@ -202,53 +282,55 @@ sceneNameStore: [], eventAudio: new Audio(), soundList: [], - togglePlay: true - } + togglePlay: true, + }; }, methods: { getSoundById(id) { if (id) { - let sound = this.soundList.find((item) => item.id == id) - return sound.name + let sound = this.soundList.find((item) => item.id == id); + return sound.name; } else { - return "" + return ""; } }, getSounds() { - let _this = this + let _this = this; getSoundList() .then((res) => { if (res.success) { //_this.soundList = [{ id: "", name: "绌�", path: "" }].concat(res.data.list) - _this.soundList = [{ id: "", name: "绌�", path: "" }].concat(res.data) + _this.soundList = [{ id: "", name: "绌�", path: "" }].concat( + res.data + ); } }) - .catch((e) => console.log(e)) + .catch((e) => console.log(e)); }, selSound(sound) { - this.soundPath = sound.path - this.sceneForm.voiceId = sound.id - this.togglePlay = true - this.eventAudio.pause() - this.$forceUpdate() + this.soundPath = sound.path; + this.sceneForm.voiceId = sound.id; + this.togglePlay = true; + this.eventAudio.pause(); + this.$forceUpdate(); // this.eventAudio. }, togglePlayer() { if (!this.soundPath) { this.$notify({ type: "info", - message: "璇峰厛閫夋嫨涓�涓0闊�!" - }) - return false + message: "璇峰厛閫夋嫨涓�涓0闊�!", + }); + return false; } - debugger - this.eventAudio.src = this.soundPath + debugger; + this.eventAudio.src = this.soundPath; if (this.togglePlay) { - this.eventAudio.play() - this.togglePlay = false + this.eventAudio.play(); + this.togglePlay = false; } else { - this.eventAudio.pause() - this.togglePlay = true + this.eventAudio.pause(); + this.togglePlay = true; } // this.togglePlay = !this.togglePlay }, @@ -256,19 +338,19 @@ for (var i = arr.length - 1; i > 0; i--) { for (var j = 0; j < i; j++) { if (arr[j] > arr[j + 1]) { - let temp = arr[j] - arr[j] = arr[j + 1] - arr[j + 1] = temp + let temp = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = temp; } } } - return arr + return arr; }, getSceneName(sdk_name) { - this.sceneNameStore.push(sdk_name) + this.sceneNameStore.push(sdk_name); if (!this.sceneForm.scene_name.trim()) { - this.sceneForm.scene_name = sdk_name + this.sceneForm.scene_name = sdk_name; } // }else if(this.sceneForm.scene_name == store[store.length-2]){ // //鍦烘櫙鍚嶇О鍙栫殑鏄笂涓�娆′紶杩囨潵鐨勭畻娉曞悕绉帮紝鍒欓』鏇存柊涓烘渶鏂颁紶鏉ョ殑绠楁硶鍚� @@ -284,18 +366,18 @@ template_id: "", time_rule_id: "", voice: {}, - voiceId: "" - } - this.$refs.sceneEditor.cleanRule() - this.$refs.sceneEditor.getSdkConnection() + voiceId: "", + }; + this.$refs.sceneEditor.cleanRule(); + this.$refs.sceneEditor.getSdkConnection(); }, handleCreate() { if (this.linkRule && this.TreeDataPool.selectedNodes.length < 2) { this.$notify({ type: "warning", - message: "璇烽�夋嫨鑷冲皯2涓憚鍍忔満!" - }) - return false + message: "璇烽�夋嫨鑷冲皯2涓憚鍍忔満!", + }); + return false; } else if ( !this.linkRule && this.TreeDataPool.treeActiveName != "dataStack" && @@ -303,117 +385,126 @@ ) { this.$notify({ type: "warning", - message: `璇烽�夋嫨1涓憚鍍忔満!` - }) - return false - } else if (this.TreeDataPool.treeActiveName == "dataStack" && !this.DataStackPool.selectedDir.id) { + message: `璇烽�夋嫨1涓憚鍍忔満!`, + }); + return false; + } else if ( + this.TreeDataPool.treeActiveName == "dataStack" && + !this.DataStackPool.selectedDir.id + ) { this.$notify({ type: "warning", - message: `璇峰厛閫夋嫨鏁版嵁鏍堟枃浠跺す!` - }) - return false + message: `璇峰厛閫夋嫨鏁版嵁鏍堟枃浠跺す!`, + }); + return false; } - this.editScene = true - this.cleanForm() + this.editScene = true; + this.cleanForm(); //鍒濆鍖栧満鏅悕绉� - var pattern = /^鍦烘櫙\s*\d+\s*$/ - var tempArr = [] + var pattern = /^鍦烘櫙\s*\d+\s*$/; + var tempArr = []; this.tableRuleList.forEach((scene) => { if (pattern.test(scene.scene_name)) { - tempArr.push(Number(scene.scene_name.substring(2).trim())) + tempArr.push(Number(scene.scene_name.substring(2).trim())); } - }) - let latest = tempArr.length > 0 ? this.bubbleSort(tempArr)[tempArr.length - 1] + 1 : 1 + }); + let latest = + tempArr.length > 0 + ? this.bubbleSort(tempArr)[tempArr.length - 1] + 1 + : 1; - this.sceneForm.scene_name = "鍦烘櫙" + latest + this.sceneForm.scene_name = "鍦烘櫙" + latest; //鍒濆鍖栨椂闂存 - this.sceneForm.time_rule_id = this.VideoManageData.TimeRules[0].id + this.sceneForm.time_rule_id = this.VideoManageData.TimeRules[0].id; }, handleEdit(scene) { - this.sceneForm = JSON.parse(JSON.stringify(scene)) + this.sceneForm = JSON.parse(JSON.stringify(scene)); // this.originSceneInfo = JSON.parse(JSON.stringify(scene)); - this.sceneForm.voice = this.soundList.find((o) => o.id === scene.voiceId) + this.sceneForm.voice = this.soundList.find((o) => o.id === scene.voiceId); - this.editScene = true - let selectedTpl = {} + this.editScene = true; + let selectedTpl = {}; this.sceneTemplates.forEach((t) => { if (t.id == this.sceneForm.template_id) { - selectedTpl = t + selectedTpl = t; } - }) - this.templateSdks = selectedTpl.sdks + }); + this.templateSdks = selectedTpl.sdks; - this.templateRules = JSON.stringify(scene.rules) - this.$refs.sceneEditor.editHandle(this.templateRules) + this.templateRules = JSON.stringify(scene.rules); + this.$refs.sceneEditor.editHandle(this.templateRules); }, validateForm() { if (!this.sceneForm.scene_name.trim()) { this.$notify({ type: "warning", - message: "鍦烘櫙鍚嶄笉鑳戒负绌�" - }) - return false + message: "鍦烘櫙鍚嶄笉鑳戒负绌�", + }); + return false; } else if (!this.sceneForm.alarm_level) { this.$notify({ type: "warning", - message: "浜嬩欢绛夌骇涓嶈兘涓虹┖" - }) - return false + message: "浜嬩欢绛夌骇涓嶈兘涓虹┖", + }); + return false; } else if (!this.sceneForm.time_rule_id) { this.$notify({ type: "warning", - message: "鏃堕棿娈典笉鑳戒负绌�" - }) - return false + message: "鏃堕棿娈典笉鑳戒负绌�", + }); + return false; } - return true + return true; }, saveSceneRule() { if (!this.validateForm()) { - return + return; } - let editorResp = this.$refs.sceneEditor.submitRule() - this.sceneForm.rules = editorResp.rules - this.sceneForm.id = editorResp.id - this.sceneForm.group_text = editorResp.text + let editorResp = this.$refs.sceneEditor.submitRule(); + if (!editorResp) { + return; + } + this.sceneForm.rules = editorResp.rules; + this.sceneForm.id = editorResp.id; + this.sceneForm.group_text = editorResp.text; - this.onSaveScene(this.sceneForm) + this.onSaveScene(this.sceneForm); }, handleDelScene(groupRule) { - let _this = this + let _this = this; this.$confirm("鎻愮ず锛氬垹闄ゅ悗锛岃鏉¤鍒欏皢澶辨晥锛屾槸鍚﹀垹闄わ紵", { center: true, cancelButtonClass: "comfirm-class-cancle", - confirmButtonClass: "comfirm-class-sure" + confirmButtonClass: "comfirm-class-sure", }) .then(() => { deleteCameraScene(groupRule.id).then((res) => { - this.$emit("delete-rule") + this.$emit("delete-rule"); if (res && res.success) { this.$notify({ type: "success", - message: "鍒犻櫎鎴愬姛" - }) - _this.$root.$children[0].$children[0].querySearchAsync("camera") + message: "鍒犻櫎鎴愬姛", + }); + _this.$root.$children[0].$children[0].querySearchAsync("camera"); } else { this.$notify({ type: "error", - message: "鍒犻櫎澶辫触锛�" - }) + message: "鍒犻櫎澶辫触锛�", + }); } - }) + }); }) - .catch(() => {}) + .catch(() => {}); }, cellStyle(obj) { if (obj.column.label == "绛栫暐" || obj.column.label == "浜嬩欢澹伴煶") { - return "text-align:left;padding-left:8px;" + return "text-align:left;padding-left:8px;"; } - } - } -} + }, + }, +}; </script> <style lang="scss"> @@ -481,5 +572,8 @@ } } } + .el-table th.el-table__cell > .cell { + padding-right: 0; + } } </style> diff --git a/src/pages/cameraAccess/components/SeparateRules.vue b/src/pages/cameraAccess/components/SeparateRules.vue index 19fb894..bb1e9e3 100644 --- a/src/pages/cameraAccess/components/SeparateRules.vue +++ b/src/pages/cameraAccess/components/SeparateRules.vue @@ -2,7 +2,7 @@ <div class="s-separate-rules"> <div class="ai"> <div class="check-area"> - <div class="ai-select"> + <div class="ai-select" v-if="TreeDataPool.selectedNode.type !== 'MENU'"> <div v-show="cameraType === 'camera'"> <span> <span class="label">瑙嗛鍒嗘瀽澶勭悊</span> @@ -15,7 +15,11 @@ </span> </div> - <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'"> + <div + v-if="Camera.analytics" + class="flex-box" + v-show="cameraType === 'camera'" + > <span class="label">澶勭悊鏂瑰紡</span> <toggle-button :value="Camera.dealWay" @@ -24,20 +28,29 @@ :color="{ checked: '#3D68E1', unchecked: '#FF7733', - disabled: '#CCCCCC' + disabled: '#CCCCCC', }" :sync="true" @change="changePoll" /> </div> - <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'"> + <div + v-if="Camera.analytics" + class="flex-box" + v-show="cameraType === 'camera'" + > <span class="label">澶勭悊鐘舵��: {{ camStatus }}</span> </div> - <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'"> + <div + v-if="Camera.analytics" + class="flex-box" + v-show="cameraType === 'camera'" + > <span class="label" >鍒嗚鲸鐜�: {{ - Camera.camearInfo.resolution_width == 0 || Camera.camearInfo.resolution_height == 0 + Camera.camearInfo.resolution_width == 0 || + Camera.camearInfo.resolution_height == 0 ? "鏈満鍒嗚鲸鐜�" : `${Camera.camearInfo.resolution_width} * ${Camera.camearInfo.resolution_height}` }}</span @@ -51,7 +64,12 @@ <div v-if="Camera.analytics" class="flex-box"> <span class="label">绠楁硶蹇�熼�氶亾</span> <div class="channel flex-box"> - <el-tooltip effect="dark" content="澶嶅埗姝ゆ憚鍍忔満绠楁硶瑙勫垯" placement="bottom" popper-class="atooltip"> + <el-tooltip + effect="dark" + content="澶嶅埗姝ゆ憚鍍忔満绠楁硶瑙勫垯" + placement="bottom" + popper-class="atooltip" + > <span style="color: #3d68e1; cursor: pointer; font-size: 23px" @click="ctrlC" @@ -61,7 +79,9 @@ <el-tooltip effect="dark" :content=" - !TreeDataPool.ctrlCameraId ? '绮樿创绠楁硶瑙勫垯' : `绮樿创绠楁硶瑙勫垯锛屾潵婧愶細${TreeDataPool.ctrlCameraName}` + !TreeDataPool.ctrlCameraId + ? '绮樿创绠楁硶瑙勫垯' + : `绮樿创绠楁硶瑙勫垯锛屾潵婧愶細${TreeDataPool.ctrlCameraName}` " placement="bottom" popper-class="atooltip" @@ -108,13 +128,19 @@ <div class="draw-box"> <div class="draw-box-title"> <b style="font-size: 14px">缁樺埗鍖哄煙</b> - <span class="el-dropdown-link" @click="drawBaseImg" style="position: relative; top: 5px; cursor: pointer"> + <span + class="el-dropdown-link" + @click="drawBaseImg" + style="position: relative; top: 5px; cursor: pointer" + > <i class="iconfont iconbianji1" style="font-size: 28px"></i> </span> </div> <div style="width: 590px; height: 16px"> <b style="font-size: 14px">{{ - Camera.camearInfo.alias ? Camera.camearInfo.alias : Camera.camearInfo.name + Camera.camearInfo.alias + ? Camera.camearInfo.alias + : Camera.camearInfo.name }}</b> </div> <div class="img-box"> @@ -150,9 +176,16 @@ class="swiper-box-container2" style="width: 100%" > - <swiper-slide v-for="(data, index) in swipercanvasData" :key="index"> + <swiper-slide + v-for="(data, index) in swipercanvasData" + :key="index" + > <div> - <b class="video-title" style="font-size: 14px; margin-top: -10px">{{ data.name }}</b> + <b + class="video-title" + style="font-size: 14px; margin-top: -10px" + >{{ data.name }}</b + > <polygon-canvas class="cavas" ref="canvas" @@ -176,12 +209,20 @@ </div> </swiper-slide> </swiper> - <div class="swiper-local-prev" v-show="swipercanvasData.length > 1" @click="prevClick"> + <div + class="swiper-local-prev" + v-show="swipercanvasData.length > 1" + @click="prevClick" + > <div class="icon-btn" slot="button-prev"> <i class="iconfont iconzuo"></i> </div> </div> - <div class="swiper-local-next" v-show="swipercanvasData.length > 1" @click="nextClick"> + <div + class="swiper-local-next" + v-show="swipercanvasData.length > 1" + @click="nextClick" + > <div class="icon-btn" slot="button-next"> <i class="iconfont iconyou1"></i> </div> @@ -219,21 +260,21 @@ </template> <script> -import { savePolygon } from "@/api/polygon" +import { savePolygon } from "@/api/polygon"; -import { pasteRules } from "@/api/task" -import { getCameraInfo } from "@/api/camera" -import { saveCameraScene } from "@/api/scene" +import { pasteRules } from "@/api/task"; +import { getCameraInfo } from "@/api/camera"; +import { saveCameraScene } from "@/api/scene"; -import { changeRunType } from "@/api/pollConfig" -import { findAllFileByStackId } from "@/api/localVedio" -import VideoRuleData from "@/Pool/VideoRuleData" +import { changeRunType } from "@/api/pollConfig"; +import { findAllFileByStackId } from "@/api/localVedio"; +import VideoRuleData from "@/Pool/VideoRuleData"; -import TimeSlider from "./TimeSlider" -import polygonCanvas from "@/components/canvas" -import Sysinfo from "@/components/subComponents/SystemInfo" -import SceneRule from "./SceneRule" -import SlideScene from "./scene/SlideScene" +import TimeSlider from "./TimeSlider"; +import polygonCanvas from "@/components/canvas"; +import Sysinfo from "@/components/subComponents/SystemInfo"; +import SceneRule from "./SceneRule"; +import SlideScene from "./scene/SlideScene"; export default { components: { @@ -241,19 +282,21 @@ polygonCanvas, Sysinfo, SceneRule, - SlideScene + SlideScene, }, directives: { focus: { - inserted: function(el) { - el.querySelector("input").focus() - } - } + inserted: function (el) { + el.querySelector("input").focus(); + }, + }, }, computed: { cameraType() { - return this.TreeDataPool.treeActiveName === "camera" ? "camera" : "dataStack" - } + return this.TreeDataPool.treeActiveName === "camera" + ? "camera" + : "dataStack"; + }, }, data() { return { @@ -266,12 +309,12 @@ grabCursor: true, pagination: { el: ".swiper-pagination", - type: "fraction" + type: "fraction", }, navigation: { nextEl: ".swiper-local-next", - prevEl: ".swiper-local-prev" - } + prevEl: ".swiper-local-prev", + }, }, tableRuleList: [], camStatus: "", @@ -284,28 +327,28 @@ swiperIndex: 0, swipercanvasData: [], stackFilesPage: 1, - stackFilesSize: 5 - } + stackFilesSize: 5, + }; }, mounted() { - this.PollData.statistics() + this.PollData.statistics(); }, watch: { "Camera.cameraId": { handler(n, o) { if (n) { if (this.TreeDataPool.treeActiveName == "dataStack") { - this.stackFilesPage = 1 - this.stackFilesSize = 5 - this.stackId = n + this.stackFilesPage = 1; + this.stackFilesSize = 5; + this.stackId = n; if (this.stackId) { - this.swipercanvasData = [] - this.getStackFiles() + this.swipercanvasData = []; + this.getStackFiles(); } } } - } - } + }, + }, }, methods: { getStatus() { @@ -313,296 +356,300 @@ if (res.success) { switch (res.data.status) { case 0: - this.camStatus = "鏈厤瑙勫垯" - return + this.camStatus = "鏈厤瑙勫垯"; + return; case 1: - this.camStatus = "绛夊緟杞澶勭悊" - return + this.camStatus = "绛夊緟杞澶勭悊"; + return; case 2: - this.camStatus = "姝e湪鎵ц鍒嗘瀽澶勭悊" - return + this.camStatus = "姝e湪鎵ц鍒嗘瀽澶勭悊"; + return; case -1: - this.camStatus = "鍏朵粬鎯呭喌瀵艰嚧鏈鐞�" - return + this.camStatus = "鍏朵粬鎯呭喌瀵艰嚧鏈鐞�"; + return; case -2: - this.camStatus = "鏁呴殰瀵艰嚧鏈鐞�" - return + this.camStatus = "鏁呴殰瀵艰嚧鏈鐞�"; + return; } } - }) + }); }, prevClick() { if (this.swiperIndex == 0) { if (this.stackFilesPage > 1) { - this.stackFilesPage-- - this.getStackFiles(true) + this.stackFilesPage--; + this.getStackFiles(true); } else { this.$message({ type: "info", - message: "褰撳墠宸叉槸绗竴椤�" - }) + message: "褰撳墠宸叉槸绗竴椤�", + }); } } }, nextClick() { if (this.swiperIndex == this.swipercanvasData.length - 1) { - this.stackFilesPage++ - this.getStackFiles(true) + this.stackFilesPage++; + this.getStackFiles(true); } }, getStackFiles(onClick = false) { - this.getStackFileLoading = true - let _this = this + this.getStackFileLoading = true; + let _this = this; findAllFileByStackId({ name: "", stackId: this.stackId, page: this.stackFilesPage, size: this.stackFilesSize, - type: 0 + type: 0, }) .then((res) => { if (res && res.success) { if (res.data.dataList.length > 0) { - this.swipercanvasData = [] + this.swipercanvasData = []; this.swipercanvasData = res.data.dataList.map((item) => { return { name: item.name, stackId: item.stack_id, baseImg: - item.type == 2 ? `/files/${item.path.substr(item.path.lastIndexOf("/") + 1)}` : item.snapshot_url, + item.type == 2 + ? `/files/${item.path.substr( + item.path.lastIndexOf("/") + 1 + )}` + : item.snapshot_url, type: item.type, id: item.id, - loading: false - } - }) - this.swiperIndex = 0 - this.$refs.swiper.swiper.activeIndex = 0 + loading: false, + }; + }); + this.swiperIndex = 0; + this.$refs.swiper.swiper.activeIndex = 0; } else { if (onClick) { this.$message({ type: "warning", - message: "宸叉棤鏇村鏁版嵁!" - }) + message: "宸叉棤鏇村鏁版嵁!", + }); } } } else { this.$message({ type: "error", - message: "鏁版嵁璇锋眰澶辫触,璇风◢鍚庨噸璇�!" - }) + message: "鏁版嵁璇锋眰澶辫触,璇风◢鍚庨噸璇�!", + }); } - this.getStackFileLoading = false + this.getStackFileLoading = false; }) .catch((e) => { - this.getStackFileLoading = false - }) + this.getStackFileLoading = false; + }); }, swiperSlideChange() { - this.swiperIndex = this.$refs.swiper.swiper.activeIndex + this.swiperIndex = this.$refs.swiper.swiper.activeIndex; }, drawBaseImg() { if (Array.isArray(this.$refs.canvas)) { if (this.$refs.canvas.length > 0) { - this.$refs.canvas[0].showModal() + this.$refs.canvas[0].showModal(); } } else { - this.$refs.canvas.showModal() + this.$refs.canvas.showModal(); } }, getCanvasData(data) { - let polyon = { ...data } - polyon.camera_id = this.Camera.cameraId + let polyon = { ...data }; + polyon.camera_id = this.Camera.cameraId; savePolygon(polyon).then((rsp) => { - this.Camera.getPolygon() + this.Camera.getPolygon(); //this.Camera.getCameraTask(); - }) + }); }, refresh(url) { - this.Camera.baseImg = url + this.Camera.baseImg = url; }, // 鍒濆鍖栨憚鍍忔満淇℃伅锛岀埗缁勪欢璋冪敤 async initCameraData(id, type) { - this.Camera = new VideoRuleData() + this.Camera = new VideoRuleData(); if (id && id !== "") { - this.loading = false - this.Camera.cameraId = id - this.Camera.gb28181 = type === 1 + this.loading = false; + this.Camera.cameraId = id; + this.Camera.gb28181 = type === 1; if (type === 1) { - await this.Camera.update(true) + await this.Camera.update(true); } else { - await this.Camera.update() + await this.Camera.update(); } } - this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id - this.showSysInfo = true + this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id; + this.showSysInfo = true; // 鍒ゆ柇姝e湪鎵ц瀹炴椂鎴栬�呰疆璇换鍔� this.PollData.CameraList.forEach((element) => { if (element.id === this.Camera.cameraId) { - this.runType = element.run_type + this.runType = element.run_type; } - }) + }); }, saveSceneRule(groupRule) { - const payload = { ...groupRule } - payload.cameraIds = [this.Camera.cameraId] - let _this = this + const payload = { ...groupRule }; + payload.cameraIds = [this.Camera.cameraId]; + let _this = this; saveCameraScene(payload).then((rsp) => { if (rsp && rsp.success) { - this.Camera.update() + this.Camera.update(); this.$notify({ type: "success", - message: "绛栫暐淇濆瓨鎴愬姛锛�" - }) + message: "绛栫暐淇濆瓨鎴愬姛锛�", + }); //鍒锋柊宸︿晶鏍� - _this.$root.$children[0].$children[0].querySearchAsync("camera") + _this.$root.$children[0].$children[0].querySearchAsync("camera"); } - }) + }); }, delScenRule() { - this.Camera.update() + this.Camera.update(); }, changeLoading(params) { - this.loading = params + this.loading = params; }, //鏄惁杩涜瑙嗛鍒嗘瀽澶勭悊 pollEnable(row) { - let val = 0 + let val = 0; if (row) { if (this.PollData.RealTimeSum < this.PollData.channelTotal) { - this.Camera.dealWay = true - val = 1 + this.Camera.dealWay = true; + val = 1; } else { - this.Camera.dealWay = false - val = 0 + this.Camera.dealWay = false; + val = 0; } } else { - this.Camera.dealWay = false - val = -1 + this.Camera.dealWay = false; + val = -1; } if (this.Camera.cameraId && this.Camera.cameraId !== undefined) { changeRunType({ camera_ids: [this.Camera.cameraId], - run_type: val + run_type: val, }).then((rsp) => { - this.getStatus() + this.getStatus(); if (rsp && rsp.success) { this.$notify({ type: "success", - message: "閰嶇疆鎴愬姛" - }) + message: "閰嶇疆鎴愬姛", + }); } else { this.$notify({ type: "error", - message: "閰嶇疆澶辫触" - }) + message: "閰嶇疆澶辫触", + }); } - this.TreeDataPool.fetchTreeData() - }) + this.TreeDataPool.fetchTreeData(); + }); } - this.PollData.statisticTaskInfo() + this.PollData.statisticTaskInfo(); }, //瀹炴椂銆佽疆璇㈠垏鎹� changePoll(row) { //鍒ゆ柇鏄柊澧炶繕鏄洿鏂� - debugger + debugger; if (this.Camera.cameraId && this.Camera.cameraId !== undefined) { if (this.PollData.RealTimeSum < this.PollData.channelTotal) { if (row.value) { - this.Camera.dealWay = true + this.Camera.dealWay = true; } else { - this.Camera.dealWay = false + this.Camera.dealWay = false; } - debugger + debugger; changeRunType({ camera_ids: [this.Camera.cameraId], - run_type: this.Camera.dealWay ? 1 : 0 + run_type: this.Camera.dealWay ? 1 : 0, }).then((rsp) => { if (rsp && rsp.success) { this.$notify({ type: "success", - message: "閰嶇疆鎴愬姛" - }) + message: "閰嶇疆鎴愬姛", + }); } else { this.$notify({ type: "error", - message: "閰嶇疆澶辫触" - }) + message: "閰嶇疆澶辫触", + }); } - }) + }); } else { if (this.Camera.dealWay) { - this.Camera.dealWay = false - debugger + this.Camera.dealWay = false; + debugger; changeRunType({ camera_ids: [this.Camera.cameraId], - run_type: this.Camera.dealWay ? 1 : 0 + run_type: this.Camera.dealWay ? 1 : 0, }).then((rsp) => { if (rsp && rsp.success) { this.$notify({ type: "success", - message: "閰嶇疆鎴愬姛" - }) + message: "閰嶇疆鎴愬姛", + }); } else { this.$notify({ type: "error", - message: "閰嶇疆澶辫触" - }) + message: "閰嶇疆澶辫触", + }); } - }) + }); } } - this.TreeDataPool.fetchTreeData() - this.PollData.statisticTaskInfo() + this.TreeDataPool.fetchTreeData(); + this.PollData.statisticTaskInfo(); } }, //澶嶅埗 ctrlC() { - this.TreeDataPool.ctrlCameraId = this.Camera.cameraId - this.TreeDataPool.ctrlCameraName = this.Camera.cameraName + this.TreeDataPool.ctrlCameraId = this.Camera.cameraId; + this.TreeDataPool.ctrlCameraName = this.Camera.cameraName; this.$notify({ type: "success", - message: "澶嶅埗绠楁硶鎴愬姛锛�" - }) + message: "澶嶅埗绠楁硶鎴愬姛锛�", + }); }, ctrlV() { if (this.Camera.cameraId === this.TreeDataPool.ctrlCameraId) { this.$notify({ type: "warning", - message: "涓嶈兘绮樿创鏈憚鍍忔満鐨勭畻娉曞埌鏈憚鍍忔満锛�" - }) - return false + message: "涓嶈兘绮樿创鏈憚鍍忔満鐨勭畻娉曞埌鏈憚鍍忔満锛�", + }); + return false; } pasteRules({ sourceId: this.TreeDataPool.ctrlCameraId, - targetIds: [this.Camera.cameraId] + targetIds: [this.Camera.cameraId], }) .then((res) => { if (res && res.success) { this.$notify({ type: "success", - message: "绮樿创绠楁硶鎴愬姛锛�" - }) - this.initCameraData(this.Camera.cameraId) + message: "绮樿创绠楁硶鎴愬姛锛�", + }); + this.initCameraData(this.Camera.cameraId); } else { this.$notify({ type: "error", - message: "绮樿创绠楁硶澶辫触锛�" - }) + message: "绮樿创绠楁硶澶辫触锛�", + }); } }) .catch((err) => { this.$notify({ type: "error", - message: "绮樿创绠楁硶澶辫触锛�" - }) - }) - } - } -} + message: "绮樿创绠楁硶澶辫触锛�", + }); + }); + }, + }, +}; </script> <style lang="scss"> .el-message--info .el-message__content { diff --git a/src/pages/cameraAccess/index/VideoManage.vue b/src/pages/cameraAccess/index/VideoManage.vue index 0ce1280..2f2bd1d 100644 --- a/src/pages/cameraAccess/index/VideoManage.vue +++ b/src/pages/cameraAccess/index/VideoManage.vue @@ -114,6 +114,7 @@ } }, "TreeDataPool.selectedNode": function (node) { + console.log(this.TreeDataPool.selectedNode); if (this.activeName == "camera-info") { if (this.TreeDataPool.treeActiveName == "camera") { this.$refs.cameraInfo.selectCamera(node); diff --git a/src/pages/datapush/index/RightEvent.vue b/src/pages/datapush/index/RightEvent.vue index 75d386e..01ca008 100644 --- a/src/pages/datapush/index/RightEvent.vue +++ b/src/pages/datapush/index/RightEvent.vue @@ -711,12 +711,12 @@ if (resetNext) { rule.topic_arg = rule.topicArgOptions[0].value; this.selectArg(rule, resetNext); + this.setOptionsDisable(rule); } } }); }, selectArg(rule, resetNext = false) { - debugger; let argInfo = rule.topicArgOptions.filter((arg) => { return arg.value === rule.topic_arg; }); @@ -785,9 +785,11 @@ rule.rule_value = val.join(","); }, setOptionsDisable(rule) { - let isAllSelect = rule.rule_values.indexOf("鍏ㄩ儴") >= 0; + console.log(rule); + let isAllSelect = + rule.rule_values.indexOf("鍏ㄩ儴") >= 0 || + rule.rule_values.indexOf("all*all") >= 0; let isNullSelect = rule.rule_values.indexOf("绌�") >= 0; - console.log(rule.rule_values); rule.ruleValueOptions.forEach((opt) => { if (!rule.rule_values.length) { @@ -802,6 +804,8 @@ opt.disabled = isAllSelect || isNullSelect; }); + console.log(1212); + console.log(rule.ruleValueOptions); }, // 鏍规嵁value杩斿洖瀵瑰簲鐨刵ame getNameByValue(arr, value) { @@ -1003,3 +1007,6 @@ } } </style> + + + diff --git a/src/pages/login/index/App.vue b/src/pages/login/index/App.vue index 7156115..e0b2279 100644 --- a/src/pages/login/index/App.vue +++ b/src/pages/login/index/App.vue @@ -81,7 +81,7 @@ > <el-form-item prop="loginName"> <el-input - v-model="user.loginName" + v-model.trim="user.loginName" :placeholder="$t('placeholder.enterUsername')" :class="{ empty: !user.loginName }" > @@ -92,7 +92,7 @@ <el-input show-password @keyup.enter.native="systemLogin()" - v-model="user.password" + v-model.trim="user.password" autocomplete="off" :placeholder="$t('placeholder.enterPassword')" :class="{ empty: !user.password }" diff --git a/src/pages/search/index/App.vue b/src/pages/search/index/App.vue index 9dbeb7c..613e436 100644 --- a/src/pages/search/index/App.vue +++ b/src/pages/search/index/App.vue @@ -61,6 +61,10 @@ overflow: hidden; min-width: 1399px; height: 100%; + + .window { + z-index: 3000 !important; + } } .column-left { background-color: #fff; diff --git a/src/pages/search/index/Searching.vue b/src/pages/search/index/Searching.vue index 3f44384..abcff6f 100644 --- a/src/pages/search/index/Searching.vue +++ b/src/pages/search/index/Searching.vue @@ -38,7 +38,7 @@ ></el-button> </el-tooltip> <p class="p-label" style="width: 16%"> - <b>鏍囩锛�</b> + <b>搴曞簱锛�</b> <el-select v-model="tagValues" multiple @@ -113,7 +113,7 @@ <el-date-picker size="mini" v-model="searchTime" - @change="searchingBtn" + @change="changeTime" type="datetimerange" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" @@ -644,6 +644,9 @@ ]; }, format(array) { + if (array.length === 0) { + return []; + } return [ this.$moment(array[0]).format("YYYY-MM-DD HH:mm:ss"), this.$moment(array[1]).format("YYYY-MM-DD HH:mm:ss"), @@ -777,6 +780,13 @@ this.setLoadSearch(this.VideoPhotoData.querySearchList()); }, + changeTime(val) { + if (!val) { + this.searchTime = []; + } + + this.searchingBtn(); + }, }, }; </script> diff --git a/src/pages/settings/asset/common.scss b/src/pages/settings/asset/common.scss index e8189f0..9a3ba41 100644 --- a/src/pages/settings/asset/common.scss +++ b/src/pages/settings/asset/common.scss @@ -1,6 +1,6 @@ .form-item { margin: 0 auto; - width: 456px; + // width: 456px; height: 48px; margin-bottom: 4px; background-color: #f2f2f7; @@ -104,7 +104,7 @@ .form-data { margin-top: 16px; - width: 456px; + // width: 456px; margin: 0 auto; } diff --git a/src/pages/settings/components/AuthorizationManagement.vue b/src/pages/settings/components/AuthorizationManagement.vue index 82bf597..275270b 100644 --- a/src/pages/settings/components/AuthorizationManagement.vue +++ b/src/pages/settings/components/AuthorizationManagement.vue @@ -77,7 +77,7 @@ position: relative; .content { - width: 456px; + // width: 456px; margin: 0 auto; } diff --git a/src/pages/settings/components/AuthorizationSetting.vue b/src/pages/settings/components/AuthorizationSetting.vue index 4161551..c421140 100644 --- a/src/pages/settings/components/AuthorizationSetting.vue +++ b/src/pages/settings/components/AuthorizationSetting.vue @@ -121,7 +121,7 @@ position: relative; .content { - width: 456px; + // width: 456px; margin: 0 auto; } diff --git a/src/pages/settings/components/LoraGateway.vue b/src/pages/settings/components/LoraGateway.vue index cfce9b1..3154749 100644 --- a/src/pages/settings/components/LoraGateway.vue +++ b/src/pages/settings/components/LoraGateway.vue @@ -38,24 +38,28 @@ </div> </el-form-item> - <div class="block"> + <div class="block flexBlock"> <el-form-item class="form-item channel-sele"> <div class="item-title">棰戦亾</div> - <el-select - v-model="loraForm.channel" - placeholder="璇烽�夋嫨" - size="small" - :popper-append-to-body="false" - > - <el-option - v-for="item in channel_option" - :key="item.value" - :label="item.label" - :value="item.value" - ></el-option> - </el-select> - <div class="channel"> - 褰撳墠杩炴帴閫氶亾锛�<span class="channelCount">{{ channelCount }}</span> + + <div class="right"> + <el-select + v-model="loraForm.channel" + placeholder="璇烽�夋嫨" + size="small" + :popper-append-to-body="false" + style="width: 173px" + > + <el-option + v-for="item in channel_option" + :key="item.value" + :label="item.label" + :value="item.value" + ></el-option> + </el-select> + <div class="channel"> + 褰撳墠杩炴帴閫氶亾锛�<span class="channelCount">{{ channelCount }}</span> + </div> </div> </el-form-item> @@ -153,8 +157,17 @@ .lora-gateway { display: flex; flex-direction: column; + .block { margin-top: 16px; + + .el-form-item__content { + justify-content: space-between; + + .right { + display: flex; + } + } } .channel-sele { .el-select { @@ -162,5 +175,20 @@ margin-left: 88px; } } + + .el-radio-group { + text-align: right; + } + + .el-form-item ::v-deep .el-form-item__content::before { + display: none; + } + + .el-form-item ::v-deep .el-form-item__content::after { + display: none; + } } +</style> + +<style> </style> \ No newline at end of file diff --git a/src/pages/settings/components/UnbindBox.vue b/src/pages/settings/components/UnbindBox.vue index 30d4f57..8491119 100644 --- a/src/pages/settings/components/UnbindBox.vue +++ b/src/pages/settings/components/UnbindBox.vue @@ -39,9 +39,8 @@ <style lang="scss" scoped> .UnbindBox { position: fixed; - top: 50%; + top: 120px; left: 50%; - margin-top: -166px; margin-left: -210px; width: 420px; height: 332px; diff --git a/src/pages/settings/components/WifiGateway.vue b/src/pages/settings/components/WifiGateway.vue index b3dfbad..e68fa7d 100644 --- a/src/pages/settings/components/WifiGateway.vue +++ b/src/pages/settings/components/WifiGateway.vue @@ -247,7 +247,7 @@ margin: 0 auto; padding-left: 20px; height: 56px; - width: 450px; + // width: 450px; line-height: 56px; font-weight: bold; font-size: 14px; diff --git a/src/pages/settings/index/index.vue b/src/pages/settings/index/index.vue index 138bd99..2f0e257 100644 --- a/src/pages/settings/index/index.vue +++ b/src/pages/settings/index/index.vue @@ -31,7 +31,11 @@ @click="openAccount(item, index)" > <div class="touxiang"> - <img v-if="item.headpic" :src="`data:image/png;base64,${item.headpic}`" alt="" /> + <img + v-if="item.headpic" + :src="`data:image/png;base64,${item.headpic}`" + alt="" + /> <span class="user-name">{{ item.username }}</span> </div> <div class="login-tag" v-if="item.id == curUserID"> @@ -40,7 +44,11 @@ </div> </div> <div class="add-account" v-if="curUserRole != '鏅�氱敤鎴�'"> - <i class="el-icon-circle-plus" style="font-size: 40px" @click="openAdd"></i> + <i + class="el-icon-circle-plus" + style="font-size: 40px" + @click="openAdd" + ></i> </div> </div> </div> @@ -50,21 +58,34 @@ :class="activeIndex == 0 ? 'container-right-for-account' : ''" > <div class="account-right" v-if="activeIndex == 0"> - <div class="account-content" v-if="inAccountDetail == false && isAddAccount == false"> + <div + class="account-content" + v-if="inAccountDetail == false && isAddAccount == false" + > <div class="content-top"> - <div class="touxiang-big" @mouseenter="showChangePic = true" @mouseleave="showChangePic = false"> + <div + class="touxiang-big" + @mouseenter="showChangePic = true" + @mouseleave="showChangePic = false" + > <img v-if="activeAccountItem.headpic" :src="`data:image/png;base64,${activeAccountItem.headpic}`" alt="" /> <div class="touxiang-mask" v-show="showChangePic"> - <span class="enable" v-if="!showJPGArr" @click="editHeadPic">缂栬緫澶村儚</span> + <span class="enable" v-if="!showJPGArr" @click="editHeadPic" + >缂栬緫澶村儚</span + > </div> </div> <div class="user-desc"> <div class="user-name"> - <span class="icon iconfont" style="font-size: 19px; margin-right: 4px"></span> + <span + class="icon iconfont" + style="font-size: 19px; margin-right: 4px" + ></span + > <span>{{ activeAccountItem.username }}</span> </div> <div class="user-role"> @@ -72,13 +93,30 @@ </div> <div class="nick-name"> <span class="nick-text">鏄电О锛�</span> - <span v-show="!showInputNickName">{{ activeAccountItem.nickname }}</span> - <el-input size="mini" v-model="inputNickName" v-if="showInputNickName"></el-input> - <span v-show="!showInputNickName" class="icon iconfont edit-icon" @click="editNickName"></span> - <span v-show="showInputNickName" class="icon iconfont clear-icon" @click="showInputNickName = false" + <span v-show="!showInputNickName">{{ + activeAccountItem.nickname + }}</span> + <el-input + size="mini" + v-model="inputNickName" + v-if="showInputNickName" + ></el-input> + <span + v-show="!showInputNickName" + class="icon iconfont edit-icon" + @click="editNickName" + ></span + > + <span + v-show="showInputNickName" + class="icon iconfont clear-icon" + @click="showInputNickName = false" ></span > - <span v-show="showInputNickName" class="icon iconfont confirm-icon" @click="hideInputNick" + <span + v-show="showInputNickName" + class="icon iconfont confirm-icon" + @click="hideInputNick" ></span > </div> @@ -93,7 +131,12 @@ :key="index" @click="pickHeadDefPic(item, index)" > - <img v-if="item" :src="`data:image/png;base64,${item.path}`" alt="" srcset="" /> + <img + v-if="item" + :src="`data:image/png;base64,${item.path}`" + alt="" + srcset="" + /> <div class="img-mask" v-if="selectedPic == index"> <span class="icon iconfont enable"></span> </div> @@ -108,10 +151,18 @@ <div class="item-btn alt-pw-btn" @click="showChangePassword"> 淇敼瀵嗙爜 </div> - <div class="item-btn del-usr-btn" v-if="isShowDeleteAccount" @click="deleteAccount"> + <div + class="item-btn del-usr-btn" + v-if="isShowDeleteAccount" + @click="deleteAccount" + > 鍒犻櫎璐︽埛 </div> - <div v-if="isShowPermitBtn" class="item-btn auth-set-btn" @click="openPermission"> + <div + v-if="isShowPermitBtn" + class="item-btn auth-set-btn" + @click="openPermission" + > 鏉冮檺璁剧疆 </div> </div> @@ -122,19 +173,39 @@ <span class="icon iconfont"></span> <span>淇敼瀵嗙爜</span> </div> - <el-form :model="passwordForm" :rules="pwRules" ref="passwordForm" class="password-form"> - <el-form-item prop="curPassword" v-if="activeAccountItem.id == curUserID"> + <el-form + :model="passwordForm" + :rules="pwRules" + ref="passwordForm" + class="password-form" + > + <el-form-item + prop="curPassword" + v-if="activeAccountItem.id == curUserID" + > <div class="p-title">褰撳墠瀵嗙爜</div> - <el-input placeholder="蹇呭~" v-model="passwordForm.curPassword" show-password></el-input> + <el-input + placeholder="蹇呭~" + v-model="passwordForm.curPassword" + show-password + ></el-input> </el-form-item> <el-form-item prop="newPassword"> <div class="p-title">鏂板瘑鐮�</div> - <el-input placeholder="蹇呭~" v-model="passwordForm.newPassword" show-password></el-input> + <el-input + placeholder="蹇呭~" + v-model="passwordForm.newPassword" + show-password + ></el-input> </el-form-item> <el-form-item prop="confirmPassword"> <div class="p-title">纭瀵嗙爜</div> - <el-input placeholder="蹇呭~" v-model="passwordForm.confirmPassword" show-password></el-input> + <el-input + placeholder="蹇呭~" + v-model="passwordForm.confirmPassword" + show-password + ></el-input> </el-form-item> </el-form> <div class="btns"> @@ -173,35 +244,68 @@ :key="index" @click="pickHeadDefPic(item, index)" > - <img v-if="item" :src="`data:image/png;base64,${item.path}`" alt="" srcset="" /> + <img + v-if="item" + :src="`data:image/png;base64,${item.path}`" + alt="" + srcset="" + /> <div class="img-mask" v-if="selectedPic == index"> <span class="icon iconfont enable"></span> </div> </div> </div> <div class="fill-group"> - <el-form :model="addForm" :rules="addRules" ref="addForm" class="add-form"> + <el-form + :model="addForm" + :rules="addRules" + ref="addForm" + class="add-form" + > <el-form-item prop="userName"> <div class="p-title">鐢ㄦ埛鍚�</div> - <el-input placeholder="2~10 浣嶅瓧绗︼紝涓嶈兘浠ユ暟瀛楀紑澶达紝涓嶅彲鍖呭惈姹夊瓧" v-model="addForm.userName"></el-input> + <el-input + placeholder="2~10 浣嶅瓧绗︼紝涓嶈兘浠ユ暟瀛楀紑澶达紝涓嶅彲鍖呭惈姹夊瓧" + v-model="addForm.userName" + ></el-input> </el-form-item> <el-form-item prop="roleId" v-if="curUserRole != '鏅�氱敤鎴�'"> <div class="p-title">瑙掕壊</div> - <el-select v-model="addForm.roleId" placeholder="璇烽�夋嫨瑙掕壊" :popper-append-to-body="false"> - <el-option v-for="(item, i) in roleList" :key="i" :label="item.name" :value="item.id"></el-option> + <el-select + v-model="addForm.roleId" + placeholder="璇烽�夋嫨瑙掕壊" + :popper-append-to-body="false" + > + <el-option + v-for="(item, i) in roleList" + :key="i" + :label="item.name" + :value="item.id" + ></el-option> </el-select> </el-form-item> <el-form-item prop="nickName"> <div class="p-title">鏄电О</div> - <el-input placeholder="閫夊~锛�2~10 浣嶅瓧绗�" v-model="addForm.nickName"></el-input> + <el-input + placeholder="閫夊~锛�2~10 浣嶅瓧绗�" + v-model="addForm.nickName" + ></el-input> </el-form-item> <el-form-item prop="password"> <div class="p-title">瀵嗙爜</div> - <el-input placeholder="蹇呭~锛岃嚦灏戜负 6 浣�" v-model="addForm.password" show-password></el-input> + <el-input + placeholder="蹇呭~锛岃嚦灏戜负 6 浣�" + v-model="addForm.password" + show-password + ></el-input> </el-form-item> <el-form-item prop="confirmPassword"> <div class="p-title">纭瀵嗙爜</div> - <el-input placeholder="蹇呭~" v-model="addForm.confirmPassword" show-password></el-input> + <el-input + placeholder="蹇呭~" + v-model="addForm.confirmPassword" + show-password + ></el-input> </el-form-item> </el-form> </div> @@ -228,10 +332,18 @@ <div class="adjust-zone"> <div class="two-radio"> - <div class="radio" :class="isNtp ? '' : 'highlight-radio'" @click="isNtp = false"> + <div + class="radio" + :class="isNtp ? '' : 'highlight-radio'" + @click="isNtp = false" + > 鎵嬪姩鏍℃椂 </div> - <div class="radio" :class="isNtp ? 'highlight-radio' : ''" @click="isNtp = true"> + <div + class="radio" + :class="isNtp ? 'highlight-radio' : ''" + @click="isNtp = true" + > NTP鏍℃椂 </div> </div> @@ -254,8 +366,14 @@ /> </div> <div class="control"> - <span class="icon iconfont" @click="plusOne('hrs')"></span> - <span class="icon iconfont fanzhuan" @click="minusOne('hrs')"></span> + <span class="icon iconfont" @click="plusOne('hrs')" + ></span + > + <span + class="icon iconfont fanzhuan" + @click="minusOne('hrs')" + ></span + > </div> </div> <div class="sep">:</div> @@ -274,8 +392,14 @@ /> </div> <div class="control"> - <span class="icon iconfont" @click="plusOne('min')"></span> - <span class="icon iconfont fanzhuan" @click="minusOne('min')"></span> + <span class="icon iconfont" @click="plusOne('min')" + ></span + > + <span + class="icon iconfont fanzhuan" + @click="minusOne('min')" + ></span + > </div> </div> <div class="sep">:</div> @@ -294,8 +418,14 @@ /> </div> <div class="control"> - <span class="icon iconfont" @click="plusOne('sec')"></span> - <span class="icon iconfont fanzhuan" @click="minusOne('sec')"></span> + <span class="icon iconfont" @click="plusOne('sec')" + ></span + > + <span + class="icon iconfont fanzhuan" + @click="minusOne('sec')" + ></span + > </div> </div> </div> @@ -372,14 +502,21 @@ </div> <div class="manual-time"> - <switchBar :barName="`鍚屾鏈绠楁満鏃堕棿`" @switchChange="syncBrowser" :value="isSyncBrowser"></switchBar> + <switchBar + :barName="`鍚屾鏈绠楁満鏃堕棿`" + @switchChange="syncBrowser" + :value="isSyncBrowser" + ></switchBar> </div> </div> <div class="ntp-wrap" v-if="isNtp"> <el-form> <el-form-item label="鏈嶅姟鍣ㄥ湴鍧�"> - <ipInput :ip="ntpServer" @on-blur="ntpServer = arguments[0]"></ipInput> + <ipInput + :ip="ntpServer" + @on-blur="ntpServer = arguments[0]" + ></ipInput> </el-form-item> <el-form-item label="鏍℃椂鏃堕棿闂撮殧"> @@ -394,7 +531,12 @@ ></el-input-number> <span class="desc-min">鍒嗛挓</span> - <el-button type="text" @click="testNTP" :loading="ntpTestLoading">娴嬭瘯</el-button> + <el-button + type="text" + @click="testNTP" + :loading="ntpTestLoading" + >娴嬭瘯</el-button + > </div> </el-form-item> </el-form> @@ -409,15 +551,40 @@ </div> </div> - <clusterManagement v-if="activeIndex == 2" ref="view_2" style="width: 100%"></clusterManagement> - <netSettings ref="view_3" v-if="activeIndex == 3" style="width: 100%"></netSettings> - <keyboardLanguage ref="view_4" v-if="activeIndex == 4" style="width: 100%"></keyboardLanguage> - <generalSettings ref="view_5" v-if="activeIndex == 5" style="width: 100%"></generalSettings> - <deviceInfo v-if="activeIndex == 6" style="width: 100%" ref="view_6"></deviceInfo> - <Authorization v-if="activeIndex == 7" style="width: 100%" ref="view_7"> </Authorization> + <clusterManagement + v-if="activeIndex == 2" + ref="view_2" + style="width: 100%" + ></clusterManagement> + <netSettings + ref="view_3" + v-if="activeIndex == 3" + style="width: 100%" + ></netSettings> + <keyboardLanguage + ref="view_4" + v-if="activeIndex == 4" + style="width: 100%" + ></keyboardLanguage> + <generalSettings + ref="view_5" + v-if="activeIndex == 5" + style="width: 100%" + ></generalSettings> + <deviceInfo + v-if="activeIndex == 6" + style="width: 100%" + ref="view_6" + ></deviceInfo> + <Authorization v-if="activeIndex == 7" style="width: 100%" ref="view_7"> + </Authorization> </div> <div class="welcome-page" v-else ref="curPage" @mouseup="mouseDownIndex = ''"> - <div class="search-box" :class="showRecomand ? 'border-change' : ''" @click.stop> + <div + class="search-box" + :class="showRecomand ? 'border-change' : ''" + @click.stop + > <el-input class="search-input" placeholder="鏌ユ壘璁剧疆" @@ -430,10 +597,17 @@ </el-input> <div class="search-res" v-if="showRecomand"> - <div class="res-bar" v-for="(item, index) in searchArrForShow" :key="index" @click="pickQuick(item.addr)"> + <div + class="res-bar" + v-for="(item, index) in searchArrForShow" + :key="index" + @click="pickQuick(item.addr)" + > {{ item.name }} </div> - <div class="no-res-bar" v-if="searchArrForShow.length == 0">娌℃湁鎵惧埌涓� {{ searchText }} 鐩稿叧鐨勭粨鏋�</div> + <div class="no-res-bar" v-if="searchArrForShow.length == 0"> + 娌℃湁鎵惧埌涓� {{ searchText }} 鐩稿叧鐨勭粨鏋� + </div> </div> <div class="dummy-end" v-if="showRecomand" style="height: 14px"></div> </div> @@ -456,7 +630,7 @@ </template> <script> -import { getClockInfo, saveClockInfo, testNTPserver } from "@/api/system" +import { getClockInfo, saveClockInfo, testNTPserver } from "@/api/system"; import { addUser, getUsers, @@ -466,17 +640,17 @@ deleteUser, getUserMenus, defHeadPics, - getRoles -} from "@/api/user" -import switchBar from "../components/switchBar" -import ipInput from "../components/IPInput" -import clusterManagement from "../views/clusterManagement" -import netSettings from "../views/NetSettings" -import deviceInfo from "../views/deviceInfo" -import keyboardLanguage from "../views/keyboardLanguage" -import generalSettings from "../views/generalSettings" -import Authorization from "../views/Authorization" -import { pad0, getUrlKey } from "@/api/utils" + getRoles, +} from "@/api/user"; +import switchBar from "../components/switchBar"; +import ipInput from "../components/IPInput"; +import clusterManagement from "../views/clusterManagement"; +import netSettings from "../views/NetSettings"; +import deviceInfo from "../views/deviceInfo"; +import keyboardLanguage from "../views/keyboardLanguage"; +import generalSettings from "../views/generalSettings"; +import Authorization from "../views/Authorization"; +import { pad0, getUrlKey } from "@/api/utils"; export default { name: "settings", @@ -488,41 +662,41 @@ keyboardLanguage, generalSettings, deviceInfo, - Authorization + Authorization, }, data() { var v2 = (rule, value, callback) => { if (value === "") { - callback(new Error("璇峰啀娆¤緭鍏ュ瘑鐮�")) + callback(new Error("璇峰啀娆¤緭鍏ュ瘑鐮�")); } else if (value !== this.addForm.password) { - callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!")) + callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!")); } else { - callback() + callback(); } - } + }; var v4 = (rule, value, callback) => { if (value === "") { - callback(new Error("璇峰啀娆¤緭鍏ュ瘑鐮�")) + callback(new Error("璇峰啀娆¤緭鍏ュ瘑鐮�")); } else if (value !== this.passwordForm.newPassword) { - callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!")) + callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!")); } else { - callback() + callback(); } - } + }; const v1 = (rule, value, callback) => { if (value.trim() === "") { - callback(new Error("璇疯緭鍏ョ敤鎴峰悕")) - this.addForm.userName = "" + callback(new Error("璇疯緭鍏ョ敤鎴峰悕")); + this.addForm.userName = ""; } else if (isNaN(Number(value[0])) == false) { - callback(new Error("涓嶈兘浠ユ暟瀛楀紑澶�")) + callback(new Error("涓嶈兘浠ユ暟瀛楀紑澶�")); } else if (/[\u4E00-\u9FA5]/g.test(value)) { - callback(new Error("涓嶈兘杈撳叆姹夊瓧")) + callback(new Error("涓嶈兘杈撳叆姹夊瓧")); } else if (value.length < 2 || value.length > 10) { - callback(new Error("闀垮害涓� 2 - 10 涓瓧绗�")) + callback(new Error("闀垮害涓� 2 - 10 涓瓧绗�")); } else { - callback() + callback(); } - } + }; return { showChangePic: false, syncYrs: "", @@ -556,7 +730,7 @@ { name: "鎵嬪姩鏍℃椂", addr: [1, 1] }, { name: "閿洏鍜岃瑷�", addr: [4] }, { name: "绯荤粺璇█", addr: [4, 0] }, - { name: "閿洏绠$悊", addr: [4, 1] } + { name: "閿洏绠$悊", addr: [4, 1] }, ], inputNickName: "", showHourInput: false, @@ -585,57 +759,57 @@ icon: "\ue6de", imgUrl: "/images/settings/璐︽埛-钃�.png", blackIcon: "/images/settings/榛戣壊涓�绾con/璐︽埛.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/璐︽埛.png" + whiteIcon: "/images/settings/鐧借壊涓�绾con/璐︽埛.png", }, { name: "鏃ユ湡鏃堕棿", icon: "\ue6ff", imgUrl: "/images/settings/鏃堕棿鏃ユ湡.png", blackIcon: "/images/settings/榛戣壊涓�绾con/鏃堕棿淇℃伅.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/鏃堕棿鏃ユ湡.png" + whiteIcon: "/images/settings/鐧借壊涓�绾con/鏃堕棿鏃ユ湡.png", }, { name: "闆嗙兢绠$悊", icon: "\ue6df", imgUrl: "/images/settings/闆嗙兢绠$悊.png", blackIcon: "/images/settings/榛戣壊涓�绾con/闆嗙兢绠$悊.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/闆嗙兢绠$悊.png" + whiteIcon: "/images/settings/鐧借壊涓�绾con/闆嗙兢绠$悊.png", }, { name: "缃戠粶璁剧疆", icon: "\ue6dd", imgUrl: "/images/settings/缃戠粶璁剧疆.png", blackIcon: "/images/settings/榛戣壊涓�绾con/缃戠粶璁剧疆.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/缃戠粶璁剧疆.png" + whiteIcon: "/images/settings/鐧借壊涓�绾con/缃戠粶璁剧疆.png", }, { name: "閿洏鍜岃瑷�", icon: "\ue6dc", imgUrl: "/images/settings/閿洏鍜岃瑷�.png", blackIcon: "/images/settings/榛戣壊涓�绾con/閿洏鍜岃瑷�.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/閿洏鍜岃瑷�.png" + whiteIcon: "/images/settings/鐧借壊涓�绾con/閿洏鍜岃瑷�.png", }, { name: "閫氱敤璁剧疆", icon: "\ue6db", imgUrl: "/images/settings/閫氱敤璁剧疆.png", blackIcon: "/images/settings/榛戣壊涓�绾con/閫氱敤璁剧疆.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/閫氱敤璁剧疆.png" + whiteIcon: "/images/settings/鐧借壊涓�绾con/閫氱敤璁剧疆.png", }, { name: "璁惧淇℃伅", icon: "\ue756", imgUrl: "/images/settings/璁惧淇℃伅.png", blackIcon: "/images/settings/榛戣壊涓�绾con/璁惧淇℃伅.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/璁惧淇℃伅.png" + whiteIcon: "/images/settings/鐧借壊涓�绾con/璁惧淇℃伅.png", }, { name: "鎺堟潈绠$悊", icon: "\ue7e9;", imgUrl: "/images/settings/鎺堟潈绠$悊.png", blackIcon: "/images/settings/榛戣壊涓�绾con/鎺堟潈绠$悊.png", - whiteIcon: "/images/settings/鐧借壊涓�绾con/鎺堟潈绠$悊.png" - } + whiteIcon: "/images/settings/鐧借壊涓�绾con/鎺堟潈绠$悊.png", + }, ], accountArr: [], jpgArr: [], @@ -653,7 +827,7 @@ passwordForm: { curPassword: "", newPassword: "", - confirmPassword: "" + confirmPassword: "", }, activeAccountIndex: 0, sysMenus: [], @@ -664,482 +838,489 @@ password: "", headpic: "", confirmPassword: "", - roleId: "" + roleId: "", }, props: { - label: "name" + label: "name", }, addRules: { userName: [{ validator: v1, trigger: "blur" }], - nickName: [{ min: 2, max: 10, message: "闀垮害涓� 2 - 10 浣�", trigger: "blur" }], + nickName: [ + { min: 2, max: 10, message: "闀垮害涓� 2 - 10 浣�", trigger: "blur" }, + ], password: [ { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" }, - { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" } + { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" }, ], - confirmPassword: [{ validator: v2, trigger: "blur" }] + confirmPassword: [{ validator: v2, trigger: "blur" }], }, pwRules: { curPassword: [ { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" }, - { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" } + { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" }, ], newPassword: [ { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" }, - { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" } + { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" }, ], - confirmPassword: [{ validator: v4, trigger: "blur" }] + confirmPassword: [{ validator: v4, trigger: "blur" }], }, - account_list_scroll: false - } + account_list_scroll: false, + }; }, created() { - let color = localStorage.getItem("--colorCard") + let color = localStorage.getItem("--colorCard"); if (color) { - document.documentElement.style.setProperty("--colorCard", `${color}`) + document.documentElement.style.setProperty("--colorCard", `${color}`); } }, beforeDestroy() { - clearTimeout(this.clockTimer) - clearInterval(this.browserTimer) + clearTimeout(this.clockTimer); + clearInterval(this.browserTimer); }, mounted() { // 杩斿洖鎸夐挳鍥炶皟 window.addEventListener("message", (e) => { if (e.data.msg === "杩斿洖绯荤粺璁剧疆") { - this.showWelcome = true + this.showWelcome = true; } - }) - const menu = getUrlKey("menu") + }); + const menu = getUrlKey("menu"); if (menu) { - this.showWelcome = false - this.activeIndex = this.menuArr.findIndex((x) => x.name == menu) + this.showWelcome = false; + this.activeIndex = this.menuArr.findIndex((x) => x.name == menu); this.$nextTick(() => { - this.$refs.view_3.openRight(2) - }) + this.$refs.view_3.openRight(2); + }); } - this.fetchUserList() - this.fetchDefHeadPic() - const e = this.$refs.curPage + this.fetchUserList(); + this.fetchDefHeadPic(); + const e = this.$refs.curPage; if (e) { e.addEventListener("click", () => { if (this.showRecomand) { - this.showRecomand = false + this.showRecomand = false; } - }) + }); } }, methods: { fetchDefHeadPic() { defHeadPics().then((res) => { - this.jpgArr = res.data - }) + this.jpgArr = res.data; + }); }, fetchUserList(showLast = false) { getUsers().then((res) => { - this.accountArr = res.data + this.accountArr = res.data; if (this.accountArr.length) { - this.activeAccountItem = this.accountArr[this.activeAccountIndex] + this.activeAccountItem = this.accountArr[this.activeAccountIndex]; } if (showLast) { - this.cancelAdd() - const lastIdx = this.accountArr.length - 1 - this.openAccount(this.accountArr[lastIdx], lastIdx) + this.cancelAdd(); + const lastIdx = this.accountArr.length - 1; + this.openAccount(this.accountArr[lastIdx], lastIdx); } - }) + }); }, confirmChangePic() { updateUser({ id: this.activeAccountItem.id, - headpic: this.addForm.headpic + headpic: this.addForm.headpic, }).then((res) => { if (res.success) { - this.$message.success(res.msg) - this.fetchUserList() - this.cacelChoosePic() + this.$message.success(res.msg); + this.fetchUserList(); + this.cacelChoosePic(); } - }) + }); }, checkMonthInput() { - this.inputMonth = this.inputMonth.replace(/[^\d]/g, "") - if (this.inputMonth.length > 2) this.inputMonth = this.inputMonth.slice(0, 2) + this.inputMonth = this.inputMonth.replace(/[^\d]/g, ""); + if (this.inputMonth.length > 2) + this.inputMonth = this.inputMonth.slice(0, 2); if (+this.inputMonth > 12) { - this.inputMonth = "12" + this.inputMonth = "12"; } }, checkDayInput() { - this.inputDay = this.inputDay.replace(/[^\d]/g, "") + this.inputDay = this.inputDay.replace(/[^\d]/g, ""); if (this.inputDay.length > 2) { - this.inputDay = this.inputDay.slice(0, 2) + this.inputDay = this.inputDay.slice(0, 2); } - const max = this.getMaxDayOfMonth() + const max = this.getMaxDayOfMonth(); if (+this.inputDay > max) { - this.inputDay = max + "" + this.inputDay = max + ""; } }, editNickName() { - this.showInputNickName = true - this.inputNickName = this.activeAccountItem.nickname + this.showInputNickName = true; + this.inputNickName = this.activeAccountItem.nickname; }, hideInputNick() { if (this.inputNickName == this.activeAccountItem.nickname) { - this.showInputNickName = false - return + this.showInputNickName = false; + return; } updateUser({ id: this.activeAccountItem.id, - nickname: this.inputNickName + nickname: this.inputNickName, }).then((res) => { - this.activeAccountItem.nickname = this.inputNickName - this.$message.success(res.msg) - this.fetchUserList(true) - this.showInputNickName = false - }) + this.activeAccountItem.nickname = this.inputNickName; + this.$message.success(res.msg); + this.fetchUserList(true); + this.showInputNickName = false; + }); }, openAccount(item, i) { - this.showInputNickName = false - this.activeAccountItem = item - this.activeAccountIndex = i - this.isChangePw = false - this.inAccountDetail = false - this.cancelSet() - this.inAccountDetail = false - this.isAddAccount = false - this.selectedPic = null - this.cacelChoosePic() - this.fetchMenu() + this.showInputNickName = false; + this.activeAccountItem = item; + this.activeAccountIndex = i; + this.isChangePw = false; + this.inAccountDetail = false; + this.cancelSet(); + this.inAccountDetail = false; + this.isAddAccount = false; + this.selectedPic = null; + this.cacelChoosePic(); + this.fetchMenu(); }, minusOne(typ) { - this.isSyncBrowser = false - this.syncBrowser(false) - let num + this.isSyncBrowser = false; + this.syncBrowser(false); + let num; switch (typ) { case "hrs": - num = +this.syncHour - 1 + num = +this.syncHour - 1; if (num == -1) { - num = 23 + num = 23; } - this.syncHour = pad0(+num) - break + this.syncHour = pad0(+num); + break; case "min": - num = +this.syncMin - 1 + num = +this.syncMin - 1; if (num == -1) { - num = 59 + num = 59; } - this.syncMin = pad0(+num) - break + this.syncMin = pad0(+num); + break; case "sec": - num = +this.syncSec + 1 + num = +this.syncSec + 1; if (num == -1) { - num = 59 + num = 59; } - this.syncSec = pad0(+num) - break + this.syncSec = pad0(+num); + break; case "yrs": - num = +this.syncYrs - 1 - this.syncYrs = pad0(+num) - break + num = +this.syncYrs - 1; + this.syncYrs = pad0(+num); + break; case "mth": - num = +this.syncMonth - 1 + num = +this.syncMonth - 1; if (num == 0) { - num = 12 - this.minusOne("yrs") + num = 12; + this.minusOne("yrs"); } - this.syncMonth = pad0(+num) + this.syncMonth = pad0(+num); if (+this.syncDay > this.getMaxDayOfMonth()) { - this.minusOne("day") + this.minusOne("day"); } - break + break; case "day": - num = +this.syncDay - 1 + num = +this.syncDay - 1; if (num == 0) { - num = this.getMaxDayOfMonth() + num = this.getMaxDayOfMonth(); } - this.syncDay = pad0(+num) - break + this.syncDay = pad0(+num); + break; default: - break + break; } }, getMaxDayOfMonth() { - return new Date(+this.syncYrs, +this.syncMonth, 0).getDate() + return new Date(+this.syncYrs, +this.syncMonth, 0).getDate(); }, fatherChange(item) { item.children.forEach((x) => { - x.selected = item.selected - }) + x.selected = item.selected; + }); }, childrenChange(item) { - let SomeOneSelected = item.children.some((x) => x.selected == true) - item.selected = SomeOneSelected + let SomeOneSelected = item.children.some((x) => x.selected == true); + item.selected = SomeOneSelected; }, plusOne(typ) { - this.isSyncBrowser = false - this.syncBrowser(false) - let num + this.isSyncBrowser = false; + this.syncBrowser(false); + let num; switch (typ) { case "hrs": - num = +this.syncHour + 1 + num = +this.syncHour + 1; if (num == 24) { - num = 0 + num = 0; } - this.syncHour = pad0(+num) - break + this.syncHour = pad0(+num); + break; case "min": - num = +this.syncMin + 1 + num = +this.syncMin + 1; if (num == 60) { - num = 0 + num = 0; } - this.syncMin = pad0(+num) - break + this.syncMin = pad0(+num); + break; case "sec": - num = +this.syncSec + 1 + num = +this.syncSec + 1; if (num == 60) { - num = 0 + num = 0; } - this.syncSec = pad0(+num) - break + this.syncSec = pad0(+num); + break; case "yrs": - num = +this.syncYrs + 1 - this.syncYrs = pad0(+num) - break + num = +this.syncYrs + 1; + this.syncYrs = pad0(+num); + break; case "mth": - num = +this.syncMonth + 1 + num = +this.syncMonth + 1; if (num == 13) { - num = 1 + num = 1; } - this.syncMonth = pad0(+num) + this.syncMonth = pad0(+num); if (+this.syncDay > this.getMaxDayOfMonth()) { - this.minusOne("day") + this.minusOne("day"); } - break + break; case "day": - num = +this.syncDay + 1 + num = +this.syncDay + 1; if (num > this.getMaxDayOfMonth()) { - num = 1 + num = 1; } - this.syncDay = pad0(+num) - break + this.syncDay = pad0(+num); + break; default: - break + break; } }, editHeadPic() { - this.showJPGArr = true + this.showJPGArr = true; this.jpgArr.forEach((item, index) => { if (this.activeAccountItem.headpic == item.path) { - this.selectedPic = index + this.selectedPic = index; } - }) + }); }, submitClock() { if (this.isNtp) { if (this.ntpServer === "" || this.ntpServer === "...") { - this.$notify.error("NTP 鏈嶅姟鍣ㄥ湴鍧�涓嶈兘涓虹┖") - return false + this.$notify.error("NTP 鏈嶅姟鍣ㄥ湴鍧�涓嶈兘涓虹┖"); + return false; } else if (this.timeInterval === "") { - this.timeInterval = 1 + this.timeInterval = 1; } } else if (this.isSyncBrowser) { if (this.settime === "") { - this.$notify.error("璁剧疆鏃堕棿涓嶈兘涓虹┖") - return false + this.$notify.error("璁剧疆鏃堕棿涓嶈兘涓虹┖"); + return false; } } else { - this.settime = `${this.syncYrs}-${this.syncMonth}-${this.syncDay} ${this.syncHour}:${this.syncMin}:${this.syncSec}` + this.settime = `${this.syncYrs}-${this.syncMonth}-${this.syncDay} ${this.syncHour}:${this.syncMin}:${this.syncSec}`; } - const now = new Date().getTime() + const now = new Date().getTime(); if (new Date(this.settime).getTime() > now) { - this.$message.warning("璁剧疆鐨勬椂闂翠笉鑳芥櫄浜庡綋鍓嶆椂闂�: " + this.formatTime(now, "Y-M-D h:m:s")) - return + this.$message.warning( + "璁剧疆鐨勬椂闂翠笉鑳芥櫄浜庡綋鍓嶆椂闂�: " + this.formatTime(now, "Y-M-D h:m:s") + ); + return; } saveClockInfo({ timeZone: this.timezone, ntp: this.isNtp, ntpServer: this.ntpServer, interval: this.timeInterval, - newTime: this.settime + newTime: this.settime, }).then( (rsp) => { if (rsp && rsp.success) { - this.$notify.success("璁剧疆鎴愬姛") + this.$notify.success("璁剧疆鎴愬姛"); } - this.initClockConf() + this.initClockConf(); }, (err) => { - this.$notify.error("璁剧疆澶辫触 " + err.msg) + this.$notify.error("璁剧疆澶辫触 " + err.msg); } - ) + ); }, saveAuth() { updataUser({ id: this.activeAccountItem.id, - menuIds: this.$refs.treeMenus.getCheckedKeys() + menuIds: this.$refs.treeMenus.getCheckedKeys(), }).then((res) => { if (res.success) { - this.$message.success(res.msg) - this.cancelSet() + this.$message.success(res.msg); + this.cancelSet(); } - }) + }); }, formatTime(timestamp, format) { const formatNumber = (n) => { - n = n + "" - return n[1] ? n : "0" + n - } - var formateArr = ["Y", "M", "D", "h", "m", "s"] - var returnArr = [] - var date = new Date(timestamp) - returnArr.push(date.getFullYear()) - returnArr.push(formatNumber(date.getMonth() + 1)) - returnArr.push(formatNumber(date.getDate())) - returnArr.push(formatNumber(date.getHours())) - returnArr.push(formatNumber(date.getMinutes())) - returnArr.push(formatNumber(date.getSeconds())) + n = n + ""; + return n[1] ? n : "0" + n; + }; + var formateArr = ["Y", "M", "D", "h", "m", "s"]; + var returnArr = []; + var date = new Date(timestamp); + returnArr.push(date.getFullYear()); + returnArr.push(formatNumber(date.getMonth() + 1)); + returnArr.push(formatNumber(date.getDate())); + returnArr.push(formatNumber(date.getHours())); + returnArr.push(formatNumber(date.getMinutes())); + returnArr.push(formatNumber(date.getSeconds())); for (var i in returnArr) { - format = format.replace(formateArr[i], returnArr[i]) + format = format.replace(formateArr[i], returnArr[i]); } - return format + return format; }, initClockConf(ntpTest = false) { getClockInfo().then((rsp) => { if (rsp && rsp.success) { - this.timezone = rsp.data.time_zone + this.timezone = rsp.data.time_zone; if (!ntpTest) { - this.isNtp = rsp.data.ntp + this.isNtp = rsp.data.ntp; } if (rsp.data.ntp) { - this.ntpServer = rsp.data.ntp_server - this.timeInterval = rsp.data.interval + this.ntpServer = rsp.data.ntp_server; + this.timeInterval = rsp.data.interval; } - this.timestamp = rsp.data.local_time - this.weekday = "鏄熸湡" + "鏃ヤ竴浜屼笁鍥涗簲鍏�".charAt(new Date(+this.timestamp * 1000).getDay()) + this.timestamp = rsp.data.local_time; + this.weekday = + "鏄熸湡" + + "鏃ヤ竴浜屼笁鍥涗簲鍏�".charAt(new Date(+this.timestamp * 1000).getDay()); if (this.clockTimer === null) { - this.runClock() - if (!this.isNtp) this.parseTime() + this.runClock(); + if (!this.isNtp) this.parseTime(); } } - }) + }); }, openMenu(i) { - this.activeIndex = i + this.activeIndex = i; if (this.activeIndex == 1) { - this.initClockConf() + this.initClockConf(); } }, openWelcome(i) { - this.showWelcome = false - this.openMenu(i) + this.showWelcome = false; + this.openMenu(i); }, showInput(typ) { - this[`show${typ}Input`] = true + this[`show${typ}Input`] = true; this.$nextTick(() => { - this.$refs[`ipt${typ}`].focus() - }) + this.$refs[`ipt${typ}`].focus(); + }); }, hideInput(typ) { if (this[`input${typ}`]) { - this[`sync${typ}`] = pad0(+this[`input${typ}`]) + this[`sync${typ}`] = pad0(+this[`input${typ}`]); } - this[`show${typ}Input`] = false - this[`input${typ}`] = "" + this[`show${typ}Input`] = false; + this[`input${typ}`] = ""; if (typ == "Month") { - const max = this.getMaxDayOfMonth() + const max = this.getMaxDayOfMonth(); if (+this.syncDay > max) { - this.syncDay = max + "" + this.syncDay = max + ""; } } }, cancelSetTime() { - this.parseTime() - this.ntpServer = "..." - this.timeInterval = 10 + this.parseTime(); + this.ntpServer = "..."; + this.timeInterval = 10; }, syncBrowser(enable) { - this.isSyncBrowser = enable + this.isSyncBrowser = enable; if (!enable) { - clearInterval(this.browserTimer) + clearInterval(this.browserTimer); } else { this.browserTimer = setInterval(() => { - this.settime = this.formatTime(new Date().getTime(), "Y-M-D h:m:s") - let [arr1, arr2] = this.settime.split(" ") - ;[this.syncYrs, this.syncMonth, this.syncDay] = arr1.split("-") - ;[this.syncHour, this.syncMin, this.syncSec] = arr2.split(":") - }, 1000) + this.settime = this.formatTime(new Date().getTime(), "Y-M-D h:m:s"); + let [arr1, arr2] = this.settime.split(" "); + [this.syncYrs, this.syncMonth, this.syncDay] = arr1.split("-"); + [this.syncHour, this.syncMin, this.syncSec] = arr2.split(":"); + }, 1000); } }, openAdd() { - this.inAccountDetail = false - this.isAddAccount = true - this.selectedPic = 0 - this.addForm.headpic = this.jpgArr[0].path + this.inAccountDetail = false; + this.isAddAccount = true; + this.selectedPic = 0; + this.addForm.headpic = this.jpgArr[0].path; getRoles().then((res) => { if (res.success) { - this.roleList = res.data + this.roleList = res.data; } - }) + }); }, cancelAdd() { - this.inAccountDetail = false - this.isAddAccount = false - this.$refs["addForm"].resetFields() - this.selectedPic = null + this.inAccountDetail = false; + this.isAddAccount = false; + this.$refs["addForm"].resetFields(); + this.selectedPic = null; }, cancelPassword() { - this.isChangePw = false - this.inAccountDetail = false - this.$refs["passwordForm"].resetFields() + this.isChangePw = false; + this.inAccountDetail = false; + this.$refs["passwordForm"].resetFields(); }, pickQuick(addr) { if (addr.length == 1) { - this.openWelcome(addr[0]) + this.openWelcome(addr[0]); } else { - this.openWelcome(addr[0]) + this.openWelcome(addr[0]); this.$nextTick(() => { if (addr[0] == 1) { - return + return; } - this.$refs[`view_${addr[0]}`].openRight(addr[1]) - }) + this.$refs[`view_${addr[0]}`].openRight(addr[1]); + }); } }, cacelChoosePic() { - this.addForm.headpic = "" - this.showChangePic = false - this.selectedPic = null - this.showJPGArr = false + this.addForm.headpic = ""; + this.showChangePic = false; + this.selectedPic = null; + this.showJPGArr = false; }, SaveNewPassword(formName) { - let data + let data; this.$refs[formName].validate((valid) => { if (valid) { if (this.passwordForm.curPassword == "") { data = { userId: this.activeAccountItem.id, oldPwd: "", - newPwd: this.passwordForm.newPassword - } + newPwd: this.passwordForm.newPassword, + }; } else { data = { oldPwd: this.passwordForm.curPassword, - newPwd: this.passwordForm.newPassword - } + newPwd: this.passwordForm.newPassword, + }; } updatePassword(data).then( (res) => { if (res.success) { - this.$message.success("瀵嗙爜" + res.msg) + this.$message.success("瀵嗙爜" + res.msg); setTimeout(() => { - this.cancelPassword() - }, 1000) + this.cancelPassword(); + }, 1000); } }, (err) => { - this.$message.error("淇濆瓨澶辫触锛�" + err.msg) + this.$message.error("淇濆瓨澶辫触锛�" + err.msg); } - ) + ); } - }) + }); }, saveAddAccount(formName) { this.$refs[formName].validate((valid) => { @@ -1149,183 +1330,189 @@ password: this.addForm.password, nickname: this.addForm.nickName, headpic: this.addForm.headpic, - roleId: this.addForm.roleId - } + roleId: this.addForm.roleId, + }; addUser(data).then( (res) => { - this.$message.success(res.data) - this.fetchUserList(true) + this.$message.success(res.data); + this.fetchUserList(true); }, (err) => { - this.$message.error("淇濆瓨澶辫触锛�" + err.msg) + this.$message.error("淇濆瓨澶辫触锛�" + err.msg); } - ) + ); } else { - return false + return false; } - }) + }); }, pickHeadDefPic(item, i) { if (this.selectedPic == i) { - this.selectedPic = null - this.addForm.headpic = "" - return + this.selectedPic = null; + this.addForm.headpic = ""; + return; } - this.addForm.headpic = item.path - this.selectedPic = i + this.addForm.headpic = item.path; + this.selectedPic = i; }, testNTP() { - this.ntpTestLoading = true + this.ntpTestLoading = true; testNTPserver({ server: this.ntpServer }) .then((rsp) => { if (rsp && rsp.success) { this.$notify({ type: "success", - message: "鏃堕棿鍚屾鎴愬姛" - }) + message: "鏃堕棿鍚屾鎴愬姛", + }); } else { this.$notify({ type: "error", - message: "鏃堕棿鍚屾澶辫触" - }) + message: "鏃堕棿鍚屾澶辫触", + }); } - this.ntpTestLoading = false - this.initClockConf(true) + this.ntpTestLoading = false; + this.initClockConf(true); }) .catch((err) => { this.$notify({ type: "error", - message: "鏃堕棿鍚屾澶辫触,璇锋鏌ユ湇鍔″櫒ip" - }) - this.ntpTestLoading = false - }) + message: "鏃堕棿鍚屾澶辫触,璇锋鏌ユ湇鍔″櫒ip", + }); + this.ntpTestLoading = false; + }); }, cancelSet() { - this.isSetPermission = false - this.inAccountDetail = false - this.sysMenus = [] + this.isSetPermission = false; + this.inAccountDetail = false; + this.sysMenus = []; }, showChangePassword() { - this.isChangePw = true - this.inAccountDetail = true + this.isChangePw = true; + this.inAccountDetail = true; }, runClock() { - const str = this.formatTime(++this.timestamp * 1000, "Y-M-D h:m:s") - ;[this.equipmentDate, this.equipmentTime] = str.split(" ") + const str = this.formatTime(++this.timestamp * 1000, "Y-M-D h:m:s"); + [this.equipmentDate, this.equipmentTime] = str.split(" "); this.clockTimer = setTimeout(() => { - this.runClock() - }, 1000) + this.runClock(); + }, 1000); }, deleteAccount() { - const h = this.$createElement + const h = this.$createElement; this.$msgbox({ title: "", message: h( "div", { - style: "display: flex; flex-direction: column; justify-content: center; align-items: center;" + style: + "display: flex; flex-direction: column; justify-content: center; align-items: center;", }, [ h("span", { class: "icon iconfont warn-icon" }, "\ue71c"), h("span", { class: "warn-title" }, "鍒犻櫎璐︽埛"), - h("span", { class: "warn-dec" }, "鎮ㄦ槸鍚︾‘璁ゅ垹闄よ处鎴凤紵") + h("span", { class: "warn-dec" }, "鎮ㄦ槸鍚︾‘璁ゅ垹闄よ处鎴凤紵"), ] ), showCancelButton: true, showClose: true, confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", - customClass: "del-account-message-box" + customClass: "del-account-message-box", }) .then(() => { let obj = { - ids: [this.activeAccountItem.id] - } + ids: [this.activeAccountItem.id], + }; deleteUser(obj).then((res) => { if (res.success) { - this.fetchUserList() - this.$message.success("鍒犻櫎鎴愬姛!") + this.fetchUserList(); + this.$message.success("鍒犻櫎鎴愬姛!"); } else { - this.$message.error("鍒犻櫎澶辫触") + this.$message.error("鍒犻櫎澶辫触"); } - }) + }); }) - .catch(() => {}) + .catch(() => {}); }, fetchMenu() { getUserMenus({ - userId: this.activeAccountItem.id + userId: this.activeAccountItem.id, }).then((res) => { if (res && res.success) { - this.sysMenus = res.data - let arr = [] - this.drawChecked(this.sysMenus, arr) - this.checkedArr = arr + this.sysMenus = res.data; + let arr = []; + this.drawChecked(this.sysMenus, arr); + this.checkedArr = arr; } - }) + }); }, drawChecked(arr, res) { for (const item of arr) { - if (item.selected && !item.children) res.push(item.id) - if (item.children) this.drawChecked(item.children, res) + if (item.selected && !item.children) res.push(item.id); + if (item.children) this.drawChecked(item.children, res); } }, openPermission() { - this.inAccountDetail = true - this.isSetPermission = true + this.inAccountDetail = true; + this.isSetPermission = true; if (this.sysMenus.length == 0) { - this.fetchMenu() + this.fetchMenu(); } }, parseTime() { - ;[this.syncYrs, this.syncMonth, this.syncDay] = this.equipmentDate.split("-") - ;[this.syncHour, this.syncMin, this.syncSec] = this.equipmentTime.split(":") - } + [this.syncYrs, this.syncMonth, this.syncDay] = + this.equipmentDate.split("-"); + [this.syncHour, this.syncMin, this.syncSec] = + this.equipmentTime.split(":"); + }, }, computed: { activeUserRole() { - if (this.activeAccountItem.sysRoles && this.activeAccountItem.sysRoles.length) { - return this.activeAccountItem.sysRoles[0].name + if ( + this.activeAccountItem.sysRoles && + this.activeAccountItem.sysRoles.length + ) { + return this.activeAccountItem.sysRoles[0].name; } - return "鏅�氱敤鎴�" + return "鏅�氱敤鎴�"; }, curUserRole() { - const info = JSON.parse(sessionStorage.getItem("userInfo")) - return info.roleName + const info = JSON.parse(sessionStorage.getItem("userInfo")); + return info.roleName; }, curUserID() { - const info = JSON.parse(sessionStorage.getItem("userInfo")) - return info.id + const info = JSON.parse(sessionStorage.getItem("userInfo")); + return info.id; }, isShowDeleteAccount() { if (this.curUserRole == "瓒呯骇绠$悊鍛�") { - return this.activeUserRole != "瓒呯骇绠$悊鍛�" + return this.activeUserRole != "瓒呯骇绠$悊鍛�"; } else if (this.curUserRole == "绠$悊鍛�") { - return this.activeUserRole == "鏅�氱敤鎴�" + return this.activeUserRole == "鏅�氱敤鎴�"; } - return false + return false; }, isShowPermitBtn() { // basic 鐢ㄦ埛涓嶅厑璁镐慨鏀规潈闄� if (this.activeUserRole == "瓒呯骇绠$悊鍛�") { - return false + return false; } if (this.curUserRole == "绠$悊鍛�") { - return this.activeUserRole == "鏅�氱敤鎴�" + return this.activeUserRole == "鏅�氱敤鎴�"; } else { - return this.curUserRole != "鏅�氱敤鎴�" + return this.curUserRole != "鏅�氱敤鎴�"; } }, searchArrForShow() { if (this.searchText == "") { - return this.searchArr + return this.searchArr; } else { return this.searchArr.filter((item) => { - return item.name.indexOf(this.searchText.toUpperCase()) > -1 - }) + return item.name.indexOf(this.searchText.toUpperCase()) > -1; + }); } - } + }, }, watch: { showWelcome(newVal) { @@ -1333,22 +1520,22 @@ // 闅愯棌杩斿洖鎸夋寜閽� window.parent.postMessage( { - msg: "hiddenBack" + msg: "hiddenBack", }, "*" - ) + ); } else { //鏄剧ず杩斿洖鎸夐挳 window.parent.postMessage( { - msg: "showBack" + msg: "showBack", }, "*" - ) + ); } - } - } -} + }, + }, +}; </script> <style lang="scss"> .welcome-page { @@ -1399,7 +1586,8 @@ line-height: 36px; outline: 0; padding: 0 20px; - -webkit-transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); + -webkit-transition: border-color 0.2s + cubic-bezier(0.645, 0.045, 0.355, 1); transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); width: 100%; font-weight: bold; @@ -1845,7 +2033,7 @@ .change-pw { padding: 40px 10px; - max-width: 600px; + // max-width: 600px; margin: 0 auto; .title { font-weight: bold; @@ -2069,7 +2257,7 @@ line-height: 22px; } .fill-group { - max-width: 450px; + // max-width: 450px; margin-top: 10px; margin: 0 auto; @@ -2390,8 +2578,11 @@ } } } - .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before, - .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap > .el-form-item__label:before { + .el-form-item.is-required:not(.is-no-asterisk) + > .el-form-item__label:before, + .el-form-item.is-required:not(.is-no-asterisk) + .el-form-item__label-wrap + > .el-form-item__label:before { display: none; } .el-form-item { diff --git a/src/pages/settings/views/NetSettings.vue b/src/pages/settings/views/NetSettings.vue index a318da7..fa61b0f 100644 --- a/src/pages/settings/views/NetSettings.vue +++ b/src/pages/settings/views/NetSettings.vue @@ -720,11 +720,11 @@ width: 100%; } .wire { - width: 456px; + // width: 456px; margin: 0 auto; } .wire-detail { - width: 456px; + // width: 456px; margin: 0 auto; .title { font-size: 16px; @@ -762,7 +762,7 @@ } } .net-set { - max-width: 456px; + // max-width: 456px; margin: 0 auto; .title { font-size: 16px; @@ -938,7 +938,7 @@ max-width: none !important; } .wifi-set { - max-width: 456px; + // max-width: 456px; margin: 0 auto; .switch-bar { background: #f2f2f7; @@ -989,7 +989,7 @@ } } .wifi-detail { - max-width: 454px; + // max-width: 454px; margin: 0 auto; transition: all 0.3s linear 0s; .general-box { @@ -1001,10 +1001,15 @@ margin-bottom: 20px; &.fold { height: 342px; + + .in-title { + display: flex; + justify-content: space-between; + } + .icon-fold { display: inline-block; font-size: 14px; - margin-left: 360px; transition: all 0.3s linear 0s; cursor: pointer; } diff --git a/src/pages/settings/views/clusterManagement.vue b/src/pages/settings/views/clusterManagement.vue index daf57d2..a903df7 100644 --- a/src/pages/settings/views/clusterManagement.vue +++ b/src/pages/settings/views/clusterManagement.vue @@ -19,8 +19,17 @@ v-model="selfForm.clustername" placeholder="璇疯緭鍏ュ唴瀹�" ></el-input> - <span class="icon iconfont" @click="startInput(1)" v-show="!isFillingName"></span> - <span class="icon iconfont" style="font-size: 18px" @click="clearInput(1)" v-show="isFillingName" + <span + class="icon iconfont" + @click="startInput(1)" + v-show="!isFillingName" + ></span + > + <span + class="icon iconfont" + style="font-size: 18px" + @click="clearInput(1)" + v-show="isFillingName" ></span > <span @@ -49,9 +58,23 @@ <div class="input-area"> <div class="text" v-show="!isFillingIp">{{ ruleForm.virtualIp }}</div> - <ip-input v-if="isFillingIp" :ip="selfForm.virtualIp" :on-blur="onIpBlur" class="ip-input-comp"></ip-input> - <span class="icon iconfont" v-show="!isFillingIp" @click="startInput(2)"></span> - <span class="icon iconfont" style="font-size: 18px" @click="clearInput(2)" v-show="isFillingIp" + <ip-input + v-if="isFillingIp" + :ip="selfForm.virtualIp" + :on-blur="onIpBlur" + class="ip-input-comp" + ></ip-input> + <span + class="icon iconfont" + v-show="!isFillingIp" + @click="startInput(2)" + ></span + > + <span + class="icon iconfont" + style="font-size: 18px" + @click="clearInput(2)" + v-show="isFillingIp" ></span > <span @@ -70,7 +93,11 @@ </div> <!-- !showCurCluster || !isHasColony --> <div class="cluster-content" v-if="!showCurCluster || !isHasColony"> - <div class="cluster-center" ref="left" v-if="!showCurCluster || !isHasColony"> + <div + class="cluster-center" + ref="left" + v-if="!showCurCluster || !isHasColony" + > <div class="menu-item" :class="activePage == i ? 'menu-item-active' : ''" @@ -88,21 +115,40 @@ <el-form :model="ruleForm" :rules="rules" ref="ruleForm"> <el-form-item prop="clustername"> <div class="p-title">闆嗙兢鍚嶇О</div> - <el-input v-model="ruleForm.clustername" placeholder="鎵嬪姩杈撳叆, 濡傗�滈泦缇鈥�" size="small"></el-input> + <el-input + v-model="ruleForm.clustername" + placeholder="鎵嬪姩杈撳叆, 濡傗�滈泦缇鈥�" + size="small" + ></el-input> </el-form-item> <el-form-item> <div class="p-title">闆嗙兢ID</div> - <el-input v-model="clusterid" placeholder="涓嶅厑璁歌緭鍏�,淇濆瓨鍚庡洖鏄�" disabled size="small"></el-input> + <el-input + v-model="clusterid" + placeholder="涓嶅厑璁歌緭鍏�,淇濆瓨鍚庡洖鏄�" + disabled + size="small" + ></el-input> </el-form-item> <el-form-item prop="clusterpwd"> <div class="p-title">闆嗙兢瀵嗙爜</div> - <el-input v-model="ruleForm.clusterpwd" placeholder="璇疯緭鍏�6浣嶅瘑鐮�,鎴栫偣鍑荤敓鎴�" size="small"> - <el-button type="text" slot="suffix" @click="getPSW">鐢熸垚瀵嗙爜</el-button> + <el-input + v-model="ruleForm.clusterpwd" + placeholder="璇疯緭鍏�6浣嶅瘑鐮�,鎴栫偣鍑荤敓鎴�" + size="small" + > + <el-button type="text" slot="suffix" @click="getPSW" + >鐢熸垚瀵嗙爜</el-button + > </el-input> </el-form-item> <el-form-item prop="virtualIp"> <div class="p-title">闆嗙兢IP</div> - <ip-input :ip="ruleForm.virtualIp" :on-blur="onIpBlur" class="ip-input-comp"></ip-input> + <ip-input + :ip="ruleForm.virtualIp" + :on-blur="onIpBlur" + class="ip-input-comp" + ></ip-input> </el-form-item> </el-form> <div class="btns"> @@ -111,7 +157,13 @@ </div> <div class="join-exist" v-if="activePage == 1"> - <el-form :model="joinForm" :rules="joinExistRules" ref="joinForm" class="join-form" v-loading="joinLoading"> + <el-form + :model="joinForm" + :rules="joinExistRules" + ref="joinForm" + class="join-form" + v-loading="joinLoading" + > <el-form-item prop="clusterid"> <div class="p-title">闆嗙兢ID</div> <el-input v-model="joinForm.clusterid" size="small"></el-input> @@ -135,8 +187,19 @@ autocomplete="new-password" size="small" > - <el-button type="text" slot="suffix" @click="searchColony" v-show="!searchDis">鎼滅储闆嗙兢</el-button> - <el-button type="text" slot="suffix" v-show="searchDis" @click="stopSearch"> + <el-button + type="text" + slot="suffix" + @click="searchColony" + v-show="!searchDis" + >鎼滅储闆嗙兢</el-button + > + <el-button + type="text" + slot="suffix" + v-show="searchDis" + @click="stopSearch" + > <i class="el-icon-loading"></i>鍋滄鎼滅储 </el-button> </el-input> @@ -144,7 +207,12 @@ </el-form> <div class="clu-list"> <!-- :class="pickedNodeI == index ? 'clu-item-active' : ''" --> - <div class="clu-item" v-for="(item, index) in members" :key="index" @click="pickNode(index)"> + <div + class="clu-item" + v-for="(item, index) in members" + :key="index" + @click="pickNode(index)" + > <i class="iconfont"></i> {{ item.Address }} </div> @@ -168,32 +236,32 @@ stopSearching, findCluster, updateClusterName, - joinCluster -} from "@/api/clusterManage" + joinCluster, +} from "@/api/clusterManage"; // import cloudNode from "../components/CloudNode"; -import NetNode from "../components/NetNode" -import ipInput from "../components/IPInput" -import { isIPv4 } from "@/scripts/validate" +import NetNode from "../components/NetNode"; +import ipInput from "../components/IPInput"; +import { isIPv4 } from "@/scripts/validate"; export default { data() { const checkPwd = (rule, value, callback) => { if (value == "") { - return callback(new Error("瀵嗙爜涓嶈兘涓虹┖")) + return callback(new Error("瀵嗙爜涓嶈兘涓虹┖")); } // setTimeout(() => { if (value.length != 6) { - callback(new Error("瀵嗙爜搴斾负6浣�!")) + callback(new Error("瀵嗙爜搴斾负6浣�!")); } else { - callback() + callback(); } // }, 1000); - } + }; const checkID = (rule, value, callback) => { if (!value) { - return callback(new Error("ID涓嶈兘涓虹┖")) + return callback(new Error("ID涓嶈兘涓虹┖")); } - } + }; return { innerNodes: [], intervalTimer: null, @@ -210,16 +278,16 @@ ruleForm: { clustername: "", clusterpwd: "", - virtualIp: "" + virtualIp: "", }, selfForm: { virtualIp: "", - clustername: "" + clustername: "", }, joinForm: { clusterid: "", clusterip: "", - clusterpwd: "" + clusterpwd: "", }, isSearch: false, showCurCluster: true, @@ -232,36 +300,38 @@ isCreate: true, tabList: ["鍒涘缓闆嗙兢", "鍔犲叆宸叉湁闆嗙兢"], rules: { - clustername: [{ required: true, message: "璇疯緭鍏ラ泦缇ゅ悕绉�", trigger: "blur" }], + clustername: [ + { required: true, message: "璇疯緭鍏ラ泦缇ゅ悕绉�", trigger: "blur" }, + ], clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }], - virtualIp: [{ required: true, validator: isIPv4, trigger: "change" }] + virtualIp: [{ required: true, validator: isIPv4, trigger: "change" }], }, joinExistRules: { clusterid: [{ validator: checkID, trigger: "blur" }], clusterip: [{ validator: isIPv4, trigger: "blur" }], - clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }] - } - } + clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }], + }, + }; }, components: { // cloudNode, NetNode, - ipInput + ipInput, }, mounted() { - this.findCluster() + this.findCluster(); this.intervalTimer = setInterval(() => { - this.findCluster() - }, 30000) + this.findCluster(); + }, 30000); }, beforeDestroy() { - clearInterval(this.intervalTimer) + clearInterval(this.intervalTimer); }, methods: { pickNode(index) { - this.pickedNodeI = index - const node = this.members[index] - const h = this.$createElement + this.pickedNodeI = index; + const node = this.members[index]; + const h = this.$createElement; // Address: "192.168.20.189:30190" // cluster_id: "5ee1dfa8-e3fb-4d62-8692-388d7632859b" // create_time: "" @@ -274,168 +344,173 @@ message: h( "div", { - style: "display: flex; flex-direction: column; justify-content: center; align-items: center;" + style: + "display: flex; flex-direction: column; justify-content: center; align-items: center;", }, [ h("span", { class: "icon iconfont warn-icon" }, "\ue71c"), h("span", { class: "warn-title" }, "鍔犲叆闆嗙兢"), - h("span", { class: "warn-dec" }, `鎮ㄦ槸鍚﹁鍔犲叆 ${node.Address} 鍚楋紵`) + h( + "span", + { class: "warn-dec" }, + `鎮ㄦ槸鍚﹁鍔犲叆 ${node.Address} 鍚楋紵` + ), ] ), showCancelButton: true, showClose: true, confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", - customClass: "del-account-message-box" + customClass: "del-account-message-box", }).then(() => { - this.joinLoading = true + this.joinLoading = true; let data = { clusterId: node.cluster_id, password: this.joinForm.clusterpwd, - nodeIps: [node.Address] - } + nodeIps: [node.Address], + }; this.joinCluster(data) .then(() => { - this.joinLoading = false - this.findCluster() + this.joinLoading = false; + this.findCluster(); }) .catch((e) => { - this.joinLoading = false - }) - }) + this.joinLoading = false; + }); + }); }, async createCluster(json) { - let res = await createSerfCluster(json) + let res = await createSerfCluster(json); this.$notify({ title: res.success ? "鎴愬姛" : "澶辫触", message: res.msg, - type: res.success ? "success" : "error" - }) + type: res.success ? "success" : "error", + }); }, //鎼滅储闆嗙兢 async getSearchNodes() { - let res = await getSearchNodes() + let res = await getSearchNodes(); if (res && res.success) { let list = res.data.map((i) => { - let obj = {} - obj.cluster_id = i.clusterID ? i.clusterID : "" - obj.create_time = i.create_time ? i.create_time : "" - obj.id = i.nodeID ? i.nodeID : "" - obj.node_id = i.nodeID ? i.nodeID : "" - obj.Address = i.nodeAddress ? i.nodeAddress : "" - obj.nodeName = i.nodeAddress ? i.nodeAddress : "" - obj.role = i.role ? i.role : "pc" - return obj - }) + let obj = {}; + obj.cluster_id = i.clusterID ? i.clusterID : ""; + obj.create_time = i.create_time ? i.create_time : ""; + obj.id = i.nodeID ? i.nodeID : ""; + obj.node_id = i.nodeID ? i.nodeID : ""; + obj.Address = i.nodeAddress ? i.nodeAddress : ""; + obj.nodeName = i.nodeAddress ? i.nodeAddress : ""; + obj.role = i.role ? i.role : "pc"; + return obj; + }); list.map((i) => { let found = this.members.find((element) => { - return element.node_id === i.node_id - }) + return element.node_id === i.node_id; + }); if (found === undefined) { - this.members.push(i) + this.members.push(i); } - }) + }); } }, async joinCluster(json) { - let res = await joinCluster(json) + let res = await joinCluster(json); if (res.success) { - this.members = [] + this.members = []; } this.$notify({ title: res.success ? "鎴愬姛" : "澶辫触", message: res.msg, - type: res.success ? "success" : "error" - }) + type: res.success ? "success" : "error", + }); }, join(formName) { - let _this = this + let _this = this; this.$refs[formName].validate((valid) => { if (valid) { - _this.joinLoading = true + _this.joinLoading = true; let data = { clusterId: _this.joinForm.clusterid, password: _this.joinForm.clusterpwd, - nodeIps: [_this.joinForm.clusterip] - } - debugger + nodeIps: [_this.joinForm.clusterip], + }; + debugger; _this .joinCluster(data) .then(() => { - _this.joinLoading = false - _this.findCluster() + _this.joinLoading = false; + _this.findCluster(); }) .catch((e) => { - _this.joinLoading = false - }) + _this.joinLoading = false; + }); } else { - return false + return false; } - }) + }); }, setSchedule() { this.scheduleId = window.setInterval(() => { - this.getSearchNodes() - }, 1000) + this.getSearchNodes(); + }, 1000); }, async searchColony() { - this.isSearch = true - this.$refs["joinForm"].clearValidate() - this.$refs["joinForm"].validateField("clusterpwd") + this.isSearch = true; + this.$refs["joinForm"].clearValidate(); + this.$refs["joinForm"].validateField("clusterpwd"); if (this.joinForm.clusterpwd.trim().length === 6) { - this.members = [] + this.members = []; const data = { - password: this.joinForm.clusterpwd - } + password: this.joinForm.clusterpwd, + }; this.search(data) .then(() => { - this.setSchedule() + this.setSchedule(); }) .catch(() => { - this.searchDis = false - this.loading = false - this.isSearch = false - }) + this.searchDis = false; + this.loading = false; + this.isSearch = false; + }); } else { - this.searchDis = false - this.loading = false - this.isSearch = false - return false + this.searchDis = false; + this.loading = false; + this.isSearch = false; + return false; } }, async search(data) { - let res = await search(data) + let res = await search(data); if (res && res.success) { - this.searchNum = res.data + this.searchNum = res.data; } - this.searchDis = true - this.loading = true + this.searchDis = true; + this.loading = true; window.setTimeout(() => { - this.stopSearch() - }, 10 * 1000) + this.stopSearch(); + }, 10 * 1000); }, openRight(i) { - this.activePage = i + this.activePage = i; }, async stopSearch() { if (!this.loading) { - return true + return true; } stopSearching({ - searchNum: this.searchNum + searchNum: this.searchNum, }) .then((res) => { - this.loading = false - this.searchDis = false - window.clearInterval(this.scheduleId) + this.loading = false; + this.searchDis = false; + window.clearInterval(this.scheduleId); }) .catch((err) => { this.$notify({ type: "error", duration: 1000, - message: "鍋滄鎼滅储鎶ラ敊锛�" - }) - }) + message: "鍋滄鎼滅储鎶ラ敊锛�", + }); + }); }, saveCluster(formName) { this.$refs[formName].validate((valid) => { @@ -444,179 +519,181 @@ clusterId: this.clusterid, clusterName: this.ruleForm.clustername, password: this.ruleForm.clusterpwd, - virtualIp: this.ruleForm.virtualIp - } + virtualIp: this.ruleForm.virtualIp, + }; this.createCluster(data).then(() => { - this.findCluster() - }) + this.findCluster(); + }); } else { - return false + return false; } - }) + }); }, getPSW() { - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - var uuid = [] + var chars = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + var uuid = []; for (let i = 0; i < 6; i++) { - uuid[i] = chars[0 | (Math.random() * 50)] + uuid[i] = chars[0 | (Math.random() * 50)]; } - this.ruleForm.clusterpwd = uuid.join("") + this.ruleForm.clusterpwd = uuid.join(""); }, exitCluster() { - const h = this.$createElement - let res = {} + const h = this.$createElement; + let res = {}; this.$msgbox({ title: "", message: h( "div", { - style: "display: flex; flex-direction: column; justify-content: center; align-items: center;" + style: + "display: flex; flex-direction: column; justify-content: center; align-items: center;", }, [ h("span", { class: "icon iconfont warn-icon" }, "\ue71c"), h("span", { class: "warn-title" }, "閫�鍑洪泦缇�"), - h("span", { class: "warn-dec" }, "纭畾閫�鍑洪泦缇ゅ悧锛�") + h("span", { class: "warn-dec" }, "纭畾閫�鍑洪泦缇ゅ悧锛�"), ] ), showCancelButton: true, showClose: true, confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", - customClass: "del-account-message-box" + customClass: "del-account-message-box", }).then( // () => { // this.showCurCluster = false; // } async () => { try { - res = await leave() + res = await leave(); if (res && res.success) { - clearInterval(this.intervalTimer) - this.showCurCluster = false - this.ruleForm.virtualIp = "" - this.ruleForm.clustername = "" - this.ruleForm.clusterpwd = "" - this.clusterid = "" + clearInterval(this.intervalTimer); + this.showCurCluster = false; + this.ruleForm.virtualIp = ""; + this.ruleForm.clustername = ""; + this.ruleForm.clusterpwd = ""; + this.clusterid = ""; } this.$notify({ title: res.success ? "鎴愬姛" : "澶辫触", message: res.msg, - type: res.success ? "success" : "error" - }) - this.findCluster() + type: res.success ? "success" : "error", + }); + this.findCluster(); } catch (err) { - console.log(err) + console.log(err); this.$notify.error({ title: "澶辫触", - message: err.msg - }) + message: err.msg, + }); } }, (err) => { - clearInterval(this.intervalTimer) - this.showCurCluster = false - this.ruleForm.virtualIp = "" - this.ruleForm.clustername = "" - this.ruleForm.clusterpwd = "" - this.clusterid = "" + clearInterval(this.intervalTimer); + this.showCurCluster = false; + this.ruleForm.virtualIp = ""; + this.ruleForm.clustername = ""; + this.ruleForm.clusterpwd = ""; + this.clusterid = ""; } - ) + ); }, clearInput(typ) { if (typ == 1) { - this.selfForm.clustername = "" - this.isFillingName = false + this.selfForm.clustername = ""; + this.isFillingName = false; } else { - this.selfForm.virtualIp = "" - this.isFillingIp = false + this.selfForm.virtualIp = ""; + this.isFillingIp = false; } }, async randomPwd() { - let res = await randomPwd() + let res = await randomPwd(); if (res && res.success) { - this.ruleForm.clusterpwd = res.data + this.ruleForm.clusterpwd = res.data; } }, startInput(typ) { if (typ == 1) { - this.selfForm.clustername = this.ruleForm.clustername - this.isFillingName = true + this.selfForm.clustername = this.ruleForm.clustername; + this.isFillingName = true; } else { - this.selfForm.virtualIp = this.ruleForm.virtualIp - this.isFillingIp = true + this.selfForm.virtualIp = this.ruleForm.virtualIp; + this.isFillingIp = true; } }, onIpBlur(ip) { - this.ruleForm.virtualIp = ip + this.ruleForm.virtualIp = ip; }, async updateCluster(v) { if (v == 1 || v == undefined) { - this.ruleForm.clustername = this.selfForm.clustername + this.ruleForm.clustername = this.selfForm.clustername; } if (this.ruleForm.clustername === "") { this.$message({ type: "error", - message: "闆嗙兢鍚嶇О涓嶈兘涓虹┖" - }) - return + message: "闆嗙兢鍚嶇О涓嶈兘涓虹┖", + }); + return; } const data = { clusterName: this.ruleForm.clustername, - virtualIp: this.ruleForm.virtualIp - } - let res = await updateClusterName(data) + virtualIp: this.ruleForm.virtualIp, + }; + let res = await updateClusterName(data); if (res.success) { - this.findCluster() + this.findCluster(); } this.$notify({ title: res.success ? "鎴愬姛" : "澶辫触", message: res.msg, - type: res.success ? "success" : "error" - }) - this.isFillingIp = false - this.isFillingName = false + type: res.success ? "success" : "error", + }); + this.isFillingIp = false; + this.isFillingName = false; }, async findCluster() { - let res = await findCluster() + let res = await findCluster(); if (res && res.success) { if (res.data && res.data.clusterId) { - this.isHasColony = true - this.clusterid = res.data.clusterId - this.ruleForm.clustername = res.data.clusterName - this.ruleForm.clusterpwd = "******" - this.ruleForm.virtualIp = res.data.virtualIp - this.isSearch = false + this.isHasColony = true; + this.clusterid = res.data.clusterId; + this.ruleForm.clustername = res.data.clusterName; + this.ruleForm.clusterpwd = "******"; + this.ruleForm.virtualIp = res.data.virtualIp; + this.isSearch = false; this.innerNodes = res.data.nodes.map((i) => { - let obj = {} - obj.device_type = i.device_type - obj.workType = i.device_type.substr(2, 2) - obj.hardwareType = i.device_type.substr(4, 2) - obj.cluster_id = i.cluster_id - obj.clusterName = res.data.clusterName - obj.create_time = i.create_time - obj.id = i.id - obj.node_id = i.node_id - obj.node_ip = i.node_ip - obj.nodeName = i.node_name - obj.Address = i.node_ip - obj.role = i.drift_state ? i.drift_state : "pc" - return obj - }) + let obj = {}; + obj.device_type = i.device_type; + obj.workType = i.device_type.substr(2, 2); + obj.hardwareType = i.device_type.substr(4, 2); + obj.cluster_id = i.cluster_id; + obj.clusterName = res.data.clusterName; + obj.create_time = i.create_time; + obj.id = i.id; + obj.node_id = i.node_id; + obj.node_ip = i.node_ip; + obj.nodeName = i.node_name; + obj.Address = i.node_ip; + obj.role = i.drift_state ? i.drift_state : "pc"; + return obj; + }); } else { - this.isHasColony = false + this.isHasColony = false; } } }, clearInnerNodes() { - this.innerNodes = [] - } - } -} + this.innerNodes = []; + }, + }, +}; </script> <style lang="scss"> .all { @@ -625,7 +702,7 @@ } .cluster-guanli { margin: 0 auto; - width: 760px; + // width: 760px; padding: 0 10px; .btns { margin-top: 30px !important; @@ -650,7 +727,11 @@ display: flex; height: 255px; border-radius: 8px; - background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%); + background: linear-gradient( + 180deg, + #ffffff 0%, + rgba(255, 255, 255, 0) 100% + ); .inner { background: url(/images/settings/easy-cloud.png) no-repeat; background-size: contain; @@ -771,8 +852,11 @@ border-top: 4px solid #f2f2f7; padding: 20px 40px; padding-top: 16px; - .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before, - .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap > .el-form-item__label:before { + .el-form-item.is-required:not(.is-no-asterisk) + > .el-form-item__label:before, + .el-form-item.is-required:not(.is-no-asterisk) + .el-form-item__label-wrap + > .el-form-item__label:before { display: none; } .clu-list { diff --git a/src/pages/settings/views/generalSettings.vue b/src/pages/settings/views/generalSettings.vue index 35190ce..ae565c1 100644 --- a/src/pages/settings/views/generalSettings.vue +++ b/src/pages/settings/views/generalSettings.vue @@ -35,7 +35,7 @@ :format-tooltip="formatTooltip" ></el-slider> </div> - <div class="sec">120s</div> + <div class="sec" style="margin: 0 20px">120s</div> <el-input-number v-model="min_len" @change="fakeObj.min = +(min_len / 1.2)" @@ -65,7 +65,7 @@ :show-tooltip="true" ></el-slider> </div> - <div class="sec">120s</div> + <div class="sec" style="margin: 0 20px">120s</div> <el-input-number v-model="max_len" @change="fakeObj.max = +(max_len / 1.2)" -- Gitblit v1.8.0