From ecb6cadc3f016cf9968f48e0cc77479a1e56365b Mon Sep 17 00:00:00 2001 From: hanbaoshan <hanbaoshan@aiotlink.com> Date: 星期日, 20 十二月 2020 17:32:06 +0800 Subject: [PATCH] 标定添加关联摄像机tab,绘制区域组件参数更新 --- src/pages/ai/index/App.vue | 242 ++++++++++++++++++++++++++++++++--------------- 1 files changed, 163 insertions(+), 79 deletions(-) diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue index 03c0690..faed1b4 100644 --- a/src/pages/ai/index/App.vue +++ b/src/pages/ai/index/App.vue @@ -19,14 +19,20 @@ @tab-click="handleTabClick" style="height: calc(100% - 20px);" > - <el-tab-pane label="宸插畨瑁�" name="myAlgorithm"> + <el-tab-pane label="宸叉縺娲�" name="myAlgorithm"> <div class="width-new-line task-list" v-show="activeName === 'myAlgorithm'"> <p class="src-title">绠楁硶杞欢</p> <div class="flex-list"> - <div class="wrap-box" v-for="item in ungradeList" :key="'upgrade'+item.id"> + <!-- <div class="wrap-box" v-for="item in ungradeList" :key="'upgrade'+item.id"> <div class="list-choose-item-left"> <div class="list-complete-item-handle"> - <div class="svg-wrap" :class="{willUpGrade:item.isUpgrade}"> + <div + class="svg-wrap" + :class="{willUpGrade:item.isUpgrade}" + v-loading="item.upgradeLoading" + :element-loading-text="item.progressMsg" + element-loading-background="rgba(0,0,0,.8)" + > <i class="iconfont iconupdate" v-if="item.isUpgrade"></i> <div class="mask"> <div class="info-onmask"> @@ -42,9 +48,6 @@ >鍗囩骇</el-button> </div> </div> - - <!-- <div class="list-complete-item-handle"> --> - <!-- <div class="svg-wrap" :class="{willUpGrade:item.isUpgrade}"> --> <img v-if="item.iconBlob" class="baseImg" @@ -60,14 +63,42 @@ </div> </div> </div> - </div> + </div>--> <div class="wrap-box" v-for="(item) in installedList" :key="item.id"> <div class="list-choose-item-left"> <div class="list-complete-item-handle"> - <div class="svg-wrap"> - <div class="mask flex-center" v-if="!item.isEdit"> + <div + class="svg-wrap" + :class="{willUpGrade:item.isUpgrade}" + v-loading="item.upgradeLoading" + :element-loading-text="item.progressMsg" + element-loading-background="rgba(0,0,0,.8)" + > + <!-- <div class="mask flex-center"> <div class="info-onmask"> <div>褰撳墠鐗堟湰:{{item.version}}</div> + </div> + </div>--> + <i class="iconfont iconupdate" v-if="item.isUpgrade"></i> + <div class="mask" v-if="!item.isDefault || item.isUpgrade"> + <div class="info-onmask"> + <div>褰撳墠鐗堟湰:{{item.version}}</div> + <div v-if="item.remoteVersion">鏈�鏂扮増鏈�:{{item.remoteVersion}}</div> + </div> + <div class="mask-btn"> + <el-button + @click="unLoadSdk(item)" + type="primary" + size="small" + class="bot-btn" + >鍗歌浇</el-button> + <el-button + v-if="item.isUpgrade" + @click="donwload(item)" + type="warning" + size="small" + class="bot-btn" + >鍗囩骇</el-button> </div> </div> <img @@ -108,7 +139,12 @@ <span class="iconfont iconxiazai1"></span> </div> <div class="list-complete-item-handle"> - <div class="svg-wrap"> + <div + class="svg-wrap" + v-loading="item.installLoading||item.upgradeLoading" + :element-loading-text="item.progressMsg" + element-loading-background="rgba(0,0,0,.8)" + > <img v-if="item.iconBlob" class="baseImg" @@ -139,7 +175,7 @@ element-loading-background="rgba(0,0,0,.8)" > <i class="iconfont iconupdate" v-if="item.isUpgrade"></i> - <div class="mask" v-if="!item.isDefault || item.isUpgrade"> + <div class="mask" > <div class="info-onmask"> <div>褰撳墠鐗堟湰:{{item.version}}</div> <div v-if="item.remoteVersion">鏈�鏂扮増鏈�:{{item.remoteVersion}}</div> @@ -196,6 +232,7 @@ > <div class="mask"> <el-button + size="small" type="primary" class="bot-btn" @click="downloadApp(item)" @@ -437,7 +474,7 @@ </template> <script> -import { findAllSdk, downloadSdk, installSdk, getInstallInfo } from "./api"; +import { findAllSdk, downloadSdk, installSdk, getInstallInfo, removeSdk} from "./api"; import { getApps, installApp, removeApp, getUnActivedSdk, actPageAlg, getUnActivedApp, actApp } from "@/api/app"; import FileUploader from "@/components/subComponents/FileUpload/index"; @@ -448,23 +485,26 @@ FileUploader }, computed: { - notInstalledList() { - return this.sdkList.filter(sdk => { - return sdk.installed === false; - }); - }, - installedList() { - return this.sdkList.filter(sdk => { - return sdk.installed === true && !sdk.isUpgrade; - }); - }, - ungradeList() { - // 鍗囩骇澶勭悊浼氬鑷撮噸澶嶇殑key,闇�瑕佷慨鏀� - //return []; - return this.sdkList.filter(sdk => { - return sdk.isUpgrade === true; - }); - }, + // notInstalledList () { + // return this.sdkList.filter(sdk => { + // return sdk.installed === false; + // }); + // }, + // installedList () { + // return this.sdkList.filter(sdk => { + // return sdk.installed === true && !sdk.isUpgrade; + // }); + // }, + // ungradeList () { + // // 鍗囩骇澶勭悊浼氬鑷撮噸澶嶇殑key,闇�瑕佷慨鏀� + // let arr = this.sdkList.filter(sdk => { + // return sdk.isUpgrade === true; + // }); + // arr.forEach(sdk => { + // sdk.upgradeLoading = false; + // }); + // return arr; + // }, isAdmin() { if ( sessionStorage.getItem("userInfo") && @@ -480,6 +520,9 @@ data() { return { sdkList: [], + installedList: [], + ungradeList: [], + notInstalledList: [], buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [], activeName: "myAlgorithm", patchUpdateStatus: "", @@ -514,8 +557,9 @@ storeApps: [], installFile: {}, freshTimer: null, - appUpgreading: false, - sdkUpgreading: false + appUpgreading: true, + sdkUpgreading: true, + autoRefresh: true, } }, directives: { @@ -527,11 +571,13 @@ }, mounted() { // 鑾峰彇鎵�鏈夊簲鐢� - this.getAllSdk(); - this.getAllApps(); + this.autoRefreshAppAndSdkState(); this.getUnActivedList(); this.getUnActivedAppList(); + }, + beforeDestroy() { + this.autoRefresh = false; }, methods: { isShow(authority) { @@ -547,11 +593,10 @@ this.isInstall = false; this.$message({ type: 'success', - message: '瀹夎鎴愬姛,灏嗚烦杞嚦鎴戠殑绠楁硶涓煡鐪�' + message: '瀹夎鎴愬姛,灏嗚烦杞嚦"宸叉縺娲�"涓煡鐪�' }); setTimeout(() => { this.getAllSdk(); - this.getAllApps(); window.parent.postMessage({ msg: "AppUpdate" }, '*') @@ -581,18 +626,18 @@ setTimeout(() => { if (action == 'upgrade') { app.upgradeLoading = false; - _this.$notify({ - type: 'success', - message: '鍗囩骇鎴愬姛' - }); + // _this.$notify({ + // type: 'success', + // message: '鍗囩骇鎴愬姛' + // }); } else { app.installLoading = false; - _this.$notify({ - type: 'success', - message: '瀹夎鎴愬姛' - }); + // _this.$notify({ + // type: 'success', + // message: '瀹夎鎴愬姛' + // }); } - _this.getAllApps(); + // _this.getAllApps(); window.parent.postMessage({ msg: "AppUpdate" }, '*') @@ -609,7 +654,6 @@ // 寮�鍚嚜鍔ㄥ埛鏂� this.appUpgreading = true; - this.startAutoFresh(); }, async getAllApps() { let iArry = [] @@ -626,7 +670,6 @@ obj.upgradeLoading = true; this.appUpgreading = true; - this.startAutoFresh(); } item.installed ? iArry.push(obj) : sArry.push(obj) @@ -636,26 +679,47 @@ this.installedApps = iArry; this.storeApps = sArry; }, + //鍗歌浇绠楁硶 + unLoadSdk(sdk){ + let _this = this; + this.$confirm('纭畾瑕佸嵏杞借绠楁硶鍚�?','鎻愮ず').then(()=>{ + sdk.unloadLoading = true; + removeSdk({ sdkId: sdk.id }).then(res => { + if (res && res.success) { + sdk.unloadLoading = false; + _this.getAllSdk(); + window.parent.postMessage({ + msg: "AppUpdate" + }, '*') + } + }).catch(e => { + console.log(e); + sdk.unloadLoading = false; + }) + }).catch( e => { + console.log(e) + }) + }, //鍗歌浇搴旂敤 unLoad(app) { - app.unloadLoading = true; let _this = this; - removeApp({ appId: app.id }).then(res => { - - if (res && res.success) { - setTimeout(() => { + this.$confirm('纭畾瑕佸嵏杞借搴旂敤鍚�?','鎻愮ず').then(()=>{ + app.unloadLoading = true; + removeApp({ appId: app.id }).then(res => { + if (res && res.success) { app.unloadLoading = false; _this.getAllApps(); window.parent.postMessage({ msg: "AppUpdate" }, '*') - }, 3000); - } - }).catch(e => { - console.log(e); - app.unloadLoading = false; + } + }).catch(e => { + console.log(e); + app.unloadLoading = false; + }) + }).catch( e => { + console.log(e) }) - }, // actSdk (id) { // this.actSdkId = id; @@ -751,7 +815,6 @@ _this.installFile = file; if (res.success) { _this.installDialogVisible = true; - debugger if (res.data.apps.length > 0) { _this.installAppPackage = { appId: res.data.apps[0].appId, @@ -783,38 +846,55 @@ }, async getAllSdk() { + let installedList = []; + let unInstalledList = []; let res = await findAllSdk(); if (res && res.success) { - this.sdkList = res.data.map((i, index) => { - this.$set(i, "isEdit", false); - return i; + this.sdkUpgreading = false; + + res.data.forEach(item => { + let obj = Object.assign({ unloadLoading: false, upgradeLoading: false }, item) + if (obj.progressMsg !== "" && obj.progressMsg !== "宸插畨瑁�") { + obj.upgradeLoading = true; + + this.sdkUpgreading = true; + } + + //绠楁硶杞欢 宸插畨瑁呭叾涓寘鍚緟鍗囩骇 鏈畨瑁� + item.installed ? installedList.push(obj) : unInstalledList.push(obj) + }); } + this.installedList = installedList; + this.notInstalledList = unInstalledList; }, donwload(item) { - this.downloading = true; + item.upgradeLoading = true; + //this.downloading = true; this.downloadItem = item.id; downloadSdk({ path: item.id }) .then(rsp => { - this.$notify({ - type: "success", - message: "绠楁硶宸插畨瑁�" - }); - this.downloading = false; + // this.$notify({ + // type: "success", + // message: "绠楁硶宸插畨瑁�" + // }); + item.upgradeLoading = false; + //this.downloading = false; this.downloadItem = ""; - this.getAllSdk(); }) .catch(err => { this.$notify({ type: "warning", message: err.data }); - - this.downloading = false; + item.upgradeLoading = false; + //this.downloading = false; this.downloadItem = ""; }); + // 寮�鍚嚜鍔ㄥ埛鏂� + this.sdkUpgreading = true; }, inputBlur(item) { // console.log(item, '淇敼鍚嶇О') @@ -823,20 +903,24 @@ handleTabClick() { }, - startAutoFresh() { - if (this.freshTimer) { - clearTimeout(this.freshTimer) + autoRefreshAppAndSdkState() { + // 鍏抽棴鍚庨��鍑� + if (!this.autoRefresh) { + return; } - if (!this.appUpgreading && !this.sdkUpgreading) { - this.freshTimer = -1 - return + if (this.appUpgreading) { + this.getAllApps(); } - this.getAllSdk() - this.getAllApps() + if (this.sdkUpgreading) { + this.getAllSdk(); + } - this.freshTimer = setTimeout(this.startAutoFresh, 5 * 1000) + let _this = this + setTimeout(() => { + _this.autoRefreshAppAndSdkState(); + }, 500) } } }; -- Gitblit v1.8.0