| | |
| | | @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 v-if="item.remoteVersion">最新版本:{{item.remoteVersion}}</div>
|
| | | </div>
|
| | | <div class="mask-btn">
|
| | | <!-- <el-button
|
| | | v-if="!item.isDefault"
|
| | | @click="unLoad(item)"
|
| | | <el-button
|
| | | @click="unLoadSdk(item)"
|
| | | type="primary"
|
| | | size="small"
|
| | | class="bot-btn"
|
| | | >卸载</el-button>-->
|
| | | >卸载</el-button>
|
| | | <el-button
|
| | | v-if="item.isUpgrade"
|
| | | @click="donwload(item)"
|
| | |
| | | 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>
|
| | |
| | | >
|
| | | <div class="mask">
|
| | | <el-button
|
| | | size="small"
|
| | | type="primary"
|
| | | class="bot-btn"
|
| | | @click="downloadApp(item)"
|
| | |
| | | </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";
|
| | |
| | | // });
|
| | | // return arr;
|
| | | // },
|
| | | isAdmin () {
|
| | | isAdmin() {
|
| | | if (
|
| | | sessionStorage.getItem("userInfo") &&
|
| | | sessionStorage.getItem("userInfo") !== ""
|
| | |
| | | return false;
|
| | | },
|
| | | },
|
| | | data () {
|
| | | data() {
|
| | | return {
|
| | | sdkList: [],
|
| | | installedList: [],
|
| | |
| | | storeApps: [],
|
| | | installFile: {},
|
| | | freshTimer: null,
|
| | | appUpgreading: false,
|
| | | sdkUpgreading: false
|
| | | appUpgreading: true,
|
| | | sdkUpgreading: true,
|
| | | autoRefresh: true,
|
| | | }
|
| | | },
|
| | | directives: {
|
| | |
| | | }
|
| | | }
|
| | | },
|
| | | mounted () {
|
| | | mounted() {
|
| | | // 获取所有应用
|
| | | this.getAllSdk();
|
| | | this.getAllApps();
|
| | | this.autoRefreshAppAndSdkState();
|
| | |
|
| | | this.getUnActivedList();
|
| | | this.getUnActivedAppList();
|
| | | },
|
| | | beforeDestroy() {
|
| | | this.autoRefresh = false;
|
| | | },
|
| | | methods: {
|
| | | isShow (authority) {
|
| | | isShow(authority) {
|
| | | return this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
|
| | | },
|
| | | //离线安装
|
| | | offlineInstall () {
|
| | | offlineInstall() {
|
| | | this.installDialogVisible = false;
|
| | | this.isInstall = true;
|
| | | //安装
|
| | |
| | | this.isInstall = false;
|
| | | this.$message({
|
| | | type: 'success',
|
| | | message: '安装成功,将跳转至我的算法中查看'
|
| | | message: '安装成功,将跳转至"已激活"中查看'
|
| | | });
|
| | | setTimeout(() => {
|
| | | this.getAllSdk();
|
| | | this.getAllApps();
|
| | | window.parent.postMessage({
|
| | | msg: "AppUpdate"
|
| | | }, '*')
|
| | |
| | | });
|
| | | })
|
| | | },
|
| | | downloadApp (app, action) {
|
| | | downloadApp(app, action) {
|
| | | if (action == 'upgrade') {
|
| | | app.upgradeLoading = true;
|
| | | } else {
|
| | |
| | | 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"
|
| | | }, '*')
|
| | |
| | |
|
| | | // 开启自动刷新
|
| | | this.appUpgreading = true;
|
| | | this.startAutoFresh();
|
| | | },
|
| | | async getAllApps () {
|
| | | async getAllApps() {
|
| | | let iArry = []
|
| | | let sArry = []
|
| | |
|
| | |
| | | obj.upgradeLoading = true;
|
| | |
|
| | | this.appUpgreading = true;
|
| | | this.startAutoFresh();
|
| | | }
|
| | |
|
| | | item.installed ? iArry.push(obj) : sArry.push(obj)
|
| | |
| | | this.installedApps = iArry;
|
| | | this.storeApps = sArry;
|
| | | },
|
| | | //卸载应用
|
| | | unLoad (app) {
|
| | | app.unloadLoading = true;
|
| | | //卸载算法
|
| | | unLoadSdk(sdk){
|
| | | let _this = this;
|
| | | removeApp({ appId: app.id }).then(res => {
|
| | |
|
| | | if (res && res.success) {
|
| | | //setTimeout(() => {
|
| | | app.unloadLoading = false;
|
| | | _this.getAllApps();
|
| | | window.parent.postMessage({
|
| | | msg: "AppUpdate"
|
| | | }, '*')
|
| | | //}, 3000);
|
| | | }
|
| | | }).catch(e => {
|
| | | console.log(e);
|
| | | app.unloadLoading = false;
|
| | | 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) {
|
| | | let _this = this;
|
| | | 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"
|
| | | }, '*')
|
| | | }
|
| | | }).catch(e => {
|
| | | console.log(e);
|
| | | app.unloadLoading = false;
|
| | | })
|
| | | }).catch( e => {
|
| | | console.log(e)
|
| | | })
|
| | | },
|
| | | // actSdk (id) {
|
| | | // this.actSdkId = id;
|
| | |
| | | // this.activeCode = '';
|
| | | // this.activedSdkOrApp = this.newActInfo()
|
| | | // },
|
| | | actSdkOrApp (id, type = 'sdk') {
|
| | | actSdkOrApp(id, type = 'sdk') {
|
| | | this.actType = type;
|
| | | this.actId = id;
|
| | | this.actDrawerShow = true;
|
| | |
| | | this.activeCode = '';
|
| | | this.activedSdkOrApp = this.newActInfo()
|
| | | },
|
| | | newActInfo () {
|
| | | newActInfo() {
|
| | | return {
|
| | | activateCode: '',
|
| | | productName: '',
|
| | |
| | | devIds: ''
|
| | | }
|
| | | },
|
| | | getUnActivedList () {
|
| | | getUnActivedList() {
|
| | | getUnActivedSdk().then(res => {
|
| | | if (res.code == 200) {
|
| | | this.unActivedSDKList = res.data;
|
| | |
| | | })
|
| | |
|
| | | },
|
| | | getUnActivedAppList () {
|
| | | getUnActivedAppList() {
|
| | | getUnActivedApp().then(res => {
|
| | | if (res.code == 200) {
|
| | | this.unActivedAppList = res.data;
|
| | | }
|
| | | });
|
| | | },
|
| | | actived () {
|
| | | actived() {
|
| | | let _this = this;
|
| | | if (this.actType == 'sdk') {
|
| | | //激活算法
|
| | |
| | | });
|
| | | }
|
| | | },
|
| | | getCodeDetail () { },
|
| | | checkMyAlgorith () {
|
| | | getCodeDetail() { },
|
| | | checkMyAlgorith() {
|
| | | this.actDrawerShow = false;
|
| | | this.activeName = "myAlgorithm";
|
| | | },
|
| | | onFileUpload (file) {
|
| | | onFileUpload(file) {
|
| | | //this.patchUpdateStatus = `<span style="color:green">上传成功, 点击升级按钮开始安装</span>`;
|
| | | this.patchFile = { ...file };
|
| | | this.fileAdded = true;
|
| | |
| | | _this.installFile = file;
|
| | | if (res.success) {
|
| | | _this.installDialogVisible = true;
|
| | | debugger
|
| | | if (res.data.apps.length > 0) {
|
| | | _this.installAppPackage = {
|
| | | appId: res.data.apps[0].appId,
|
| | |
| | |
|
| | | },
|
| | |
|
| | | onFileAdded (f) {
|
| | | onFileAdded(f) {
|
| | | this.patchUpdateStatus = "";
|
| | | },
|
| | |
|
| | | async getAllSdk () {
|
| | | async getAllSdk() {
|
| | | let installedList = [];
|
| | | let unInstalledList = [];
|
| | | let res = await findAllSdk();
|
| | | if (res && res.success) {
|
| | | 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.appUpgreading = true;
|
| | | this.startAutoFresh();
|
| | | this.sdkUpgreading = true;
|
| | | }
|
| | |
|
| | | //算法软件 已安装其中包含待升级 未安装
|
| | | item.installed ? installedList.push(obj) : unInstalledList.push(obj)
|
| | |
|
| | | });
|
| | |
|
| | |
|
| | | // this.sdkList = res.data.map((i, index) => {
|
| | | // if (i.progressMsg !== "" && i.progressMsg !== "已安装") {
|
| | | // i.upgradeLoading = true;
|
| | |
|
| | | // this.appUpgreading = true;
|
| | | // this.startAutoFresh();
|
| | | // }
|
| | | // this.$set(i, "isEdit", false);
|
| | | // return i;
|
| | | // });
|
| | | }
|
| | | this.installedList = installedList;
|
| | | this.notInstalledList = unInstalledList;
|
| | | },
|
| | |
|
| | | donwload (item) {
|
| | | debugger
|
| | | donwload(item) {
|
| | | item.upgradeLoading = true;
|
| | | //this.downloading = true;
|
| | | this.downloadItem = item.id;
|
| | |
|
| | | downloadSdk({ path: item.id })
|
| | | .then(rsp => {
|
| | | this.$notify({
|
| | | type: "success",
|
| | | message: "算法已安装"
|
| | | });
|
| | | // this.$notify({
|
| | | // type: "success",
|
| | | // message: "算法已安装"
|
| | | // });
|
| | | item.upgradeLoading = false;
|
| | | //this.downloading = false;
|
| | | this.downloadItem = "";
|
| | | this.getAllSdk();
|
| | | })
|
| | | .catch(err => {
|
| | | this.$notify({
|
| | |
| | | this.downloadItem = "";
|
| | | });
|
| | | // 开启自动刷新
|
| | | this.appUpgreading = true;
|
| | | this.startAutoFresh();
|
| | | this.sdkUpgreading = true;
|
| | | },
|
| | | inputBlur (item) {
|
| | | inputBlur(item) {
|
| | | // console.log(item, '修改名称')
|
| | | this.$set(item, "isEdit", false);
|
| | | },
|
| | | handleTabClick () {
|
| | | 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)
|
| | | }
|
| | | }
|
| | | };
|
| | |
| | | .src-title {
|
| | | //color: #bfbfbf;
|
| | | color: #bbcee8;
|
| | | font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC';
|
| | | font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC";
|
| | | font-weight: 650;
|
| | | font-style: normal;
|
| | | height: 36px;
|
| | |
| | | position: absolute;
|
| | | top: 50%;
|
| | | left: 50%;
|
| | | background: url('/images/algo/green.gif');
|
| | | background: url("/images/algo/green.gif");
|
| | | overflow: hidden;
|
| | | transform: translate(-50%, -50%);
|
| | | .inner-bar {
|
| | |
| | | }
|
| | | }
|
| | | .drawer-content {
|
| | | font-family: 'PingFangSC-Regular';
|
| | | font-family: "PingFangSC-Regular";
|
| | | .el-step__title.is-process {
|
| | | border-color: #3d68e1 !important;
|
| | | color: #3d68e1 !important;
|
| | | font-family: Tahoma, Helvetica, Arial, '\5B8B\4F53', sans-serif;
|
| | | font-family: Tahoma, Helvetica, Arial, "\5B8B\4F53", sans-serif;
|
| | | }
|
| | | .el-step__head.is-process {
|
| | | border-color: #3d68e1 !important;
|
| | | color: #3d68e1 !important;
|
| | | font-family: Tahoma, Helvetica, Arial, '\5B8B\4F53', sans-serif;
|
| | | font-family: Tahoma, Helvetica, Arial, "\5B8B\4F53", sans-serif;
|
| | | }
|
| | | .el-input {
|
| | | width: 100%;
|