zhangzengfei
2023-11-14 ad85ca6fdd062671047118a7d58776f9a0cf60d7
集群切换添加密码
3个文件已修改
772 ■■■■ 已修改文件
src/pages/ai/index/App.vue 694 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/settings/views/NetSettings.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/settings/views/clusterManagement.vue 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/ai/index/App.vue
@@ -2,14 +2,17 @@
  <div class="s-task-manage">
    <div style="height: 100%">
      <div class="flex-box task-manage">
        <!-- 安装进度条 -->
        <div class="installModel" v-if="isInstall">
          <div class="progress-bar">
            <div class="inner-bar"></div>
          </div>
        </div>
        <div class="super">
          <div class="left-box" v-if="!inDetail">
            <div class="nav-box">
              <!-- 菜单列表 -->
              <div class="nav-box-menu">
                <div
                  v-for="(name, index) in menuArr"
@@ -24,34 +27,16 @@
              </div>
              <div class="nav-box-search">
                <span class="icon iconfont all-scene">&#xe703;</span>
                <el-input
                  placeholder="搜索"
                  v-model="inputText"
                  @change="searchAll"
                  class="input-with-select"
                >
                <el-input placeholder="搜索" v-model="inputText" @change="searchAll" class="input-with-select">
                  <i class="el-icon-search" slot="prepend"></i>
                  <el-select
                    v-model="select"
                    slot="append"
                    placeholder="选择场景"
                    :popper-append-to-body="false"
                  >
                    <el-option label="铁路场景" value="1">
                      <span class="icon iconfont">&#xe713;</span>
                      <span>铁路场景</span>
                    </el-option>
                    <el-option label="安全场景" value="2">
                      <span class="icon iconfont">&#xe702;</span>
                      <span>安全场景</span>
                    </el-option>
                  <el-select v-model="select" slot="append" placeholder="选择场景" :popper-append-to-body="false">
                    <el-option label="通用场景" value="3">
                      <span class="icon iconfont">&#xe70d;</span>
                      <span>通用场景</span>
                    </el-option>
                    <el-option label="校园园区" value="4">
                    <el-option label="工业园区" value="4">
                      <span class="icon iconfont">&#xe70e;</span>
                      <span>校园园区</span>
                      <span>工业园区</span>
                    </el-option>
                  </el-select>
                </el-input>
@@ -70,25 +55,16 @@
                  @click="checkDetail(item, 'inactive', item.sdk_name)"
                >
                  <div class="icon-img">
                    <span class="icon iconfont" v-if="item.isUpgrade"
                      >&#xe72a;</span
                    >
                    <span class="icon iconfont" v-if="item.isUpgrade">&#xe72a;</span>
                    <img
                      v-if="item.iconBlob"
                      :src="
                        item.iconBlob.indexOf(',') > 0
                          ? item.iconBlob
                          : `data:image/png;base64,${item.iconBlob}`
                      "
                      :src="item.iconBlob.indexOf(',') > 0 ? item.iconBlob : `data:image/png;base64,${item.iconBlob}`"
                      alt
                    />
                    <img v-else :src="item.icon" alt />
                  </div>
                  <div class="desc">
                    <el-tooltip
                      :content="item.sdk_name || item.name"
                      effect="light"
                    >
                    <el-tooltip :content="item.sdk_name || item.name" effect="light">
                      <div class="desc-1">{{ item.sdk_name || item.name }}</div>
                    </el-tooltip>
                    <div class="desc-2">版本 {{ item.version }}</div>
@@ -116,64 +92,40 @@
                    class="tab"
                    @click="pickTab('sdk')"
                    :class="activeTab == 'sdk' ? 'tab-active' : ''"
                    v-show="false"
                  >
                    算法软件
                  </div>
                  <div
                    class="tab"
                    @click="pickTab('app')"
                    :class="activeTab == 'app' ? 'tab-active' : ''"
                  >
                  <div class="tab" @click="pickTab('app')" :class="activeTab == 'app' ? 'tab-active' : ''">
                    应用软件
                  </div>
                </div>
                <div
                  class="batch-update"
                  v-if="activeName == '更新' && tempList.length"
                >
                  <el-button
                    size="small"
                    type="primary"
                    round
                    @click="batchUpdate"
                    >全部更新</el-button
                  >
                <div class="batch-update" v-if="activeName == '更新' && tempList.length">
                  <el-button size="small" type="primary" round @click="batchUpdate">全部更新</el-button>
                </div>
              </div>
              <div
                class="front-page-items"
                v-if="activeName != '离线升级/安装'"
              >
              <div class="front-page-items" v-if="activeName != '离线升级/安装'">
                <div
                  class="front-page-item"
                  v-for="(item, index) in tempList"
                  :key="index"
                  @click="checkDetail(item, null, item.sdk_name)"
                  :class="{
                    disabled: activeName == '应用中心' && !item.canUpOrIns,
                    disabled: activeName == '应用中心' && !item.canUpOrIns
                  }"
                >
                  <div class="icon-img">
                    <span class="icon iconfont" v-if="item.isUpgrade"
                      >&#xe72a;</span
                    >
                    <span class="icon iconfont" v-if="item.isUpgrade">&#xe72a;</span>
                    <img
                      v-if="item.iconBlob"
                      :src="
                        item.iconBlob.indexOf(',') > 0
                          ? item.iconBlob
                          : `data:image/png;base64,${item.iconBlob}`
                      "
                      :src="item.iconBlob.indexOf(',') > 0 ? item.iconBlob : `data:image/png;base64,${item.iconBlob}`"
                      alt
                    />
                    <img v-else :src="item.icon" alt />
                  </div>
                  <div class="desc">
                    <el-tooltip
                      :content="item.sdk_name || item.name"
                      effect="light"
                    >
                    <el-tooltip :content="item.sdk_name || item.name" effect="light">
                      <div class="desc-1">{{ item.sdk_name || item.name }}</div>
                    </el-tooltip>
                    <div class="desc-2">版本 {{ item.version }}</div>
@@ -203,11 +155,9 @@
                      class="check-btn"
                      round
                      v-if="
                        activeName == '已激活' &&
                        ((activeTab == 'sdk' && !item.isUpgrade) ||
                          (activeTab == 'app' &&
                            !item.isUpgrade &&
                            !item.isDefault))
                        activeName == '已安装' &&
                          ((activeTab == 'sdk' && !item.isUpgrade) ||
                            (activeTab == 'app' && !item.isUpgrade && !item.isDefault))
                      "
                      >查看</el-button
                    >
@@ -216,26 +166,17 @@
                      type="primary"
                      class="check-btn"
                      round
                      v-if="
                        activeName == '已激活' &&
                        activeTab == 'app' &&
                        item.isDefault &&
                        !item.isUpgrade
                      "
                      v-if="activeName == '已安装' && activeTab == 'app' && item.isDefault && !item.isUpgrade"
                      >查看</el-button
                    >
                    <el-button
                      size="small"
                      type="primary"
                      class="other-btn"
                      class="remove-btn"
                      round
                      v-if="
                        activeName == '已激活' &&
                        activeTab == 'app' &&
                        item.isDefault &&
                        item.isUpgrade
                      "
                      >升级</el-button
                      v-if="activeName == '已安装' && !item.isDefault"
                      @click.stop="removeAPP(item)"
                      >卸载</el-button
                    >
                    <el-button
                      size="small"
@@ -244,31 +185,21 @@
                      round
                      @click.stop="donwloadSDK(item)"
                      v-if="
                        (activeName == '更新' || activeName == '已激活') &&
                        activeTab == 'sdk' &&
                        item.isUpgrade &&
                        !item.upgradeLoading
                        (activeName == '更新' || activeName == '已安装') &&
                          activeTab == 'sdk' &&
                          item.isUpgrade &&
                          !item.upgradeLoading
                      "
                      >更新</el-button
                    >
                    <span
                      class="icon iconfont rocket-icon"
                      v-if="
                        activeName == '更新' &&
                        item.isUpgrade &&
                        item.upgradeLoading &&
                        rocketIf
                      "
                      v-if="activeName == '更新' && item.isUpgrade && item.upgradeLoading && rocketIf"
                      >&#xe70c;</span
                    >
                    <span
                      class="icon iconfont rocket-icon"
                      v-if="
                        activeName == '更新' &&
                        item.isUpgrade &&
                        item.upgradeLoading &&
                        !rocketIf
                      "
                      v-if="activeName == '更新' && item.isUpgrade && item.upgradeLoading && !rocketIf"
                      >&#xe717;</span
                    >
                    <el-button
@@ -278,10 +209,10 @@
                      round
                      @click.stop="downloadApp(item, 'upgrade')"
                      v-if="
                        (activeName == '更新' || activeName == '已激活') &&
                        activeTab == 'app' &&
                        item.isUpgrade &&
                        !item.upgradeLoading
                        (activeName == '更新' || activeName == '已安装') &&
                          activeTab == 'app' &&
                          item.isUpgrade &&
                          !item.upgradeLoading
                      "
                      >更新</el-button
                    >
@@ -301,20 +232,13 @@
                  <div class="icon-img">
                    <img
                      v-if="item.iconBlob"
                      :src="
                        item.iconBlob.indexOf(',') > 0
                          ? item.iconBlob
                          : `data:image/png;base64,${item.iconBlob}`
                      "
                      :src="item.iconBlob.indexOf(',') > 0 ? item.iconBlob : `data:image/png;base64,${item.iconBlob}`"
                      alt
                    />
                    <img v-else :src="item.icon" alt />
                  </div>
                  <div class="desc">
                    <el-tooltip
                      :content="item.sdk_name || item.name"
                      effect="light"
                    >
                    <el-tooltip :content="item.sdk_name || item.name" effect="light">
                      <div class="desc-1">{{ item.sdk_name || item.name }}</div>
                    </el-tooltip>
                    <div class="desc-2">版本 {{ item.version }}</div>
@@ -339,11 +263,7 @@
                      >安装</el-button
                    >
                    <div class="spin-icon">
                      <span
                        class="icon iconfont anz-font"
                        v-if="item.upgradeLoading"
                        >&#xe70a;</span
                      >
                      <span class="icon iconfont anz-font" v-if="item.upgradeLoading">&#xe70a;</span>
                    </div>
                    <div class="status">
                      {{ item.progressMsg }}
@@ -377,6 +297,7 @@
            </div>
          </div>
          <!-- 应用详情页 -->
          <detailPage
            :detailProductID="detailProductID"
            :detailType="detailType"
@@ -391,12 +312,7 @@
      </div>
    </div>
    <el-dialog
      title="安装包信息"
      :visible.sync="installDialogVisible"
      width="40%"
      :close-on-click-modal="false"
    >
    <el-dialog title="安装包信息" :visible.sync="installDialogVisible" width="40%" :close-on-click-modal="false">
      <div class="installInfo">
        <template v-if="installAppPackage != null">
          <div>
@@ -440,14 +356,7 @@
  </div>
</template>
<script>
import {
  findAllSdk,
  downloadSdk,
  installSdk,
  getInstallInfo,
  removeSdk,
  uploadSDK,
} from "./api";
import { findAllSdk, downloadSdk, installSdk, getInstallInfo, removeSdk, uploadSDK } from "./api"
import {
  getApps,
  installApp,
@@ -456,38 +365,35 @@
  getUnActivedSdk,
  actPageAlg,
  getUnActivedApp,
  actApp,
} from "@/api/app";
import { getUrlKey } from "@/api/utils";
import FileUploader from "../FileUpload/index";
import detailPage from "./detail";
  actApp
} from "@/api/app"
import { getUrlKey } from "@/api/utils"
import FileUploader from "../FileUpload/index"
import detailPage from "./detail"
export default {
  name: "algorithmManage",
  components: {
    FileUploader,
    detailPage,
    detailPage
  },
  computed: {
    updateNum() {
      return this.hasNewVersionApp.length + this.hasNewVersionSdk.length;
      return this.hasNewVersionApp.length + this.hasNewVersionSdk.length
    },
    isAdmin() {
      if (
        sessionStorage.getItem("userInfo") &&
        sessionStorage.getItem("userInfo") !== ""
      ) {
        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
        return loginName === "superadmin" || loginName === "basic";
      if (sessionStorage.getItem("userInfo") && sessionStorage.getItem("userInfo") !== "") {
        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username
        return loginName === "superadmin" || loginName === "basic"
      }
      return false;
    },
      return false
    }
  },
  data() {
    return {
      installedList: [],
      recomandUpdateList: [],
      hasNewVersionSdk: [],
      activeTab: "sdk",
      activeTab: "app",
      hasNewVersionApp: [],
      tempDarkList: [],
      notInstalledList: [],
@@ -525,7 +431,7 @@
        setting: "",
        expireTime: "",
        licence: "",
        devIds: "",
        devIds: ""
      },
      installedApps: [],
      storeApps: [],
@@ -546,243 +452,233 @@
      showInputCode: false,
      needToUpgradeInWin: false,
      showInstallNotActive: false,
      menuArr: ["应用中心", "已激活", "离线升级/安装", "更新"],
    };
      menuArr: ["应用中心", "已安装", "离线升级/安装", "更新"]
    }
  },
  directives: {
    focus: {
      inserted: function (el) {
        el.querySelector("input").focus();
      },
    },
      inserted: function(el) {
        el.querySelector("input").focus()
      }
    }
  },
  mounted() {
    var name = getUrlKey("activeName");
    var name = getUrlKey("activeName")
    if (name) {
      this.pickMenu(name);
      this.pickMenu(name)
    }
    this.autoRefreshAppAndSdkState();
    this.getUnActivedList(1);
    this.getUnActivedAppList();
    this.autoRefreshAppAndSdkState()
    this.getUnActivedList(1)
    this.getUnActivedAppList()
  },
  beforeDestroy() {
    this.autoRefresh = false;
    this.autoRefresh = false
  },
  methods: {
    searchAll() {
      this.getAllApps();
      this.getAllSdk();
      this.getUnActivedList(1);
      this.getUnActivedAppList();
      this.getAllApps()
      this.getAllSdk()
      this.getUnActivedList(1)
      this.getUnActivedAppList()
    },
    goback() {
      this.inDetail = false;
      this.inDetail = false
    },
    batchUpdate(s) {
      if (s == "both") {
        this.batchUpdateSDK();
        this.batchUpdateApp();
        this.batchUpdateSDK()
        this.batchUpdateApp()
      } else if (this.activeTab == "sdk") {
        this.batchUpdateSDK();
        this.batchUpdateSDK()
      } else {
        this.batchUpdateApp();
        this.batchUpdateApp()
      }
    },
    batchUpdateSDK() {
      this.hasNewVersionSdk.forEach((sdk) => {
        this.donwloadSDK(sdk);
      });
        this.donwloadSDK(sdk)
      })
    },
    batchUpdateApp() {
      this.hasNewVersionApp.forEach((app) => {
        this.downloadApp(app, "upgrade");
      });
        this.downloadApp(app, "upgrade")
      })
    },
    pickMenu(name) {
      this.activeName = name;
      this.activeTab = "sdk";
      this.showQuickPath = true;
      this.activeName = name
      this.activeTab = "app"
      this.showQuickPath = true
      switch (name) {
        case "应用中心":
          this.tempList = this.unActivedSDKList;
          this.tempDarkList = [];
          break;
        case "已激活":
          this.tempList = this.installedList;
          this.tempDarkList = this.notInstalledList;
          break;
          this.tempList = this.unActivedSDKList
          this.tempDarkList = []
          break
        case "已安装":
          this.tempList = this.installedList
          this.tempDarkList = this.notInstalledList
          break
        case "更新":
          this.showQuickPath = false;
          this.tempList = this.hasNewVersionSdk;
          this.tempDarkList = [];
          break;
          this.showQuickPath = false
          this.tempList = this.hasNewVersionSdk
          this.tempDarkList = []
          break
        default:
          this.tempList = [];
          this.tempDarkList = [];
          break;
          this.tempList = []
          this.tempDarkList = []
          break
      }
      this.pickTab("app")
    },
    pickTab(val) {
      if (val) {
        this.activeTab = val;
        this.activeTab = val
      }
      if (this.activeName == "应用中心") {
        this.tempList =
          this.activeTab == "sdk"
            ? this.unActivedSDKList
            : this.unActivedAppList;
        this.tempDarkList = [];
      } else if (this.activeName == "已激活") {
        this.tempList =
          this.activeTab == "sdk" ? this.installedList : this.installedApps;
        this.tempDarkList =
          this.activeTab == "sdk" ? this.notInstalledList : this.storeApps;
        this.tempList = this.activeTab == "sdk" ? this.unActivedSDKList : this.unActivedAppList
        this.tempDarkList = []
      } else if (this.activeName == "已安装") {
        this.tempList = this.activeTab == "sdk" ? this.installedList : this.installedApps
        this.tempDarkList = this.activeTab == "sdk" ? this.notInstalledList : this.storeApps
      } else if (this.activeName == "更新") {
        this.tempList =
          this.activeTab == "sdk"
            ? this.hasNewVersionSdk
            : this.hasNewVersionApp;
        this.tempList = this.activeTab == "sdk" ? this.hasNewVersionSdk : this.hasNewVersionApp
        this.tempDarkList = [];
        this.tempDarkList = []
      }
    },
    checkDetail(item, typ, sdkName) {
      /* if (!item.canUpOrIns && typ == "Appcenter") {
        return false;
      } */
      this.isSdk = Boolean(sdkName);
      this.inDetail = true;
      this.detailProductID = item.id;
      this.detailPrice = item.price;
      this.isSdk = Boolean(sdkName)
      this.inDetail = true
      this.detailProductID = item.id
      this.detailPrice = item.price
      if (typ) {
        this.detailType = typ;
        this.detailType = typ
      } else {
        this.detailType = this.activeName == "应用中心" ? "inactive" : "active";
        this.detailType = this.activeName == "应用中心" ? "inactive" : "active"
      }
    },
    checkIsDefOrNot(id) {
      this.isDefaultApp = id.length <= 10;
      this.isDefaultApp = id.length <= 10
    },
    forwards() {
      if (this.forwardStack.length == 0) {
        this.forwardDisable = true;
        return;
        this.forwardDisable = true
        return
      }
      this.backStack.push([this.productDetail, this.otherProducts]);
      this.backDisable = false;
      let item = this.forwardStack.pop();
      this.backStack.push([this.productDetail, this.otherProducts])
      this.backDisable = false
      let item = this.forwardStack.pop()
      this.productDetail = item[0];
      this.otherProducts = item[1];
      this.productDetail = item[0]
      this.otherProducts = item[1]
      if (this.forwardStack.length == 0) {
        this.forwardDisable = true;
        this.forwardDisable = true
      }
    },
    offlineInstall() {
      this.installDialogVisible = false;
      this.isInstall = true;
      this.installDialogVisible = false
      this.isInstall = true
      installSdk(this.installFile)
        .then((res) => {
          if (res.success) {
            this.isInstall = false;
            this.$message.success('安装成功,将跳转至"已激活"中查看');
            this.isInstall = false
            this.$message.success('安装成功,将跳转至"已激活"中查看')
            setTimeout(() => {
              this.getAllSdk();
              window.parent.postMessage({ msg: "AppUpdate" }, "*");
              this.activeName = "已激活";
            }, 3000);
              this.getAllSdk()
              window.parent.postMessage({ msg: "AppUpdate" }, "*")
              this.activeName = "已安装"
            }, 3000)
          }
        })
        .catch((e) => {
          this.isInstall = false;
          this.$message.error(e.msg);
        });
          this.isInstall = false
          this.$message.error(e.msg)
        })
    },
    downloadApp(app, action) {
      let timer = null;
      app.upgradeLoading = true;
      let timer = null
      app.upgradeLoading = true
      timer = setInterval(() => {
        this.rocketIf = !this.rocketIf;
      }, 350);
        this.rocketIf = !this.rocketIf
      }, 350)
      let _this = this;
      let _this = this
      installApp({ path: app.id })
        .then((res) => {
          if (res && res.success) {
            _this.$notify.success("安装应用成功");
            clearInterval(timer);
            app.upgradeLoading = false;
            _this.$notify.success("安装应用成功")
            clearInterval(timer)
            app.upgradeLoading = false
            setTimeout(() => {
              window.parent.postMessage({ msg: "AppUpdate" }, "*");
            }, 3000);
              window.parent.postMessage({ msg: "AppUpdate" }, "*")
            }, 3000)
          } else {
          }
        })
        .catch((e) => {
          _this.$notify.warning(e.msg);
          clearInterval(timer);
          app.upgradeLoading = false;
        });
          _this.$notify.warning(e.msg)
          clearInterval(timer)
          app.upgradeLoading = false
        })
      // 开启自动刷新
      this.appUpgreading = true;
      this.appUpgreading = true
    },
    async getAllApps() {
      let iArry = [];
      let sArry = [];
      let nArry = [];
      let rsp = await getApps({ appName: this.inputText });
      let iArry = []
      let sArry = []
      let nArry = []
      let rsp = await getApps({ appName: this.inputText })
      if (rsp && rsp.success) {
        // 遍历app的过程重置
        this.appUpgreading = false;
        this.appUpgreading = false
        rsp.data.forEach((item) => {
          let obj = Object.assign(
            { unloadLoading: false, upgradeLoading: false },
            item
          );
          if (
            obj.progressMsg !== "" &&
            obj.progressMsg !== "已安装" &&
            obj.progressMsg != "100%"
          ) {
            obj.upgradeLoading = true;
            this.appUpgreading = true;
          let obj = Object.assign({ unloadLoading: false, upgradeLoading: false }, item)
          if (obj.progressMsg !== "" && obj.progressMsg !== "已安装" && obj.progressMsg != "100%") {
            obj.upgradeLoading = true
            this.appUpgreading = true
          }
          if (obj.upgradeDone) {
            this.$notify.success(1 ? "算法安装成功" : "算法升级成功");
            this.$notify.success(1 ? "算法安装成功" : "算法升级成功")
          }
          item.installed ? iArry.push(obj) : sArry.push(obj);
          item.isUpgrade && nArry.push(obj);
        });
          item.installed ? iArry.push(obj) : sArry.push(obj)
          item.isUpgrade && nArry.push(obj)
        })
        this.$nextTick(() => {
          this.pickTab("app")
        })
      }
      this.installedApps = iArry;
      this.storeApps = sArry;
      this.hasNewVersionApp = nArry;
      this.installedApps = iArry
      this.storeApps = sArry
      this.hasNewVersionApp = nArry
    },
    unloadApp(app) {
      let _this = this;
      let _this = this
      this.$confirm("确定要卸载该应用吗?", "提示")
        .then(() => {
          _this.productDetailVisible = false;
          _this.productDetailVisible = false
          app.unloadLoading = true;
          app.unloadLoading = true
          removeApp({ appId: app.id })
            .then((res) => {
              if (res && res.success) {
                app.unloadLoading = false;
                _this.getAllApps();
                window.parent.postMessage({ msg: "AppUpdate" }, "*");
                _this.$notify.success("卸载应用成功");
                app.unloadLoading = false
                _this.getAllApps()
                window.parent.postMessage({ msg: "AppUpdate" }, "*")
                _this.$notify.success("卸载应用成功")
              }
            })
            .catch((e) => {
              app.unloadLoading = false;
            });
              app.unloadLoading = false
            })
        })
        .catch((e) => {});
        .catch((e) => {})
    },
    newActInfo() {
      return {
@@ -791,211 +687,207 @@
        setting: "",
        expireTime: "",
        licence: "",
        devIds: "",
      };
        devIds: ""
      }
    },
    getUnActivedList(v) {
      getUnActivedSdk({ sdkName: this.inputText }).then((res) => {
        if (res.code == 200) {
          this.unActivedSDKList = res.data;
          const len = this.unActivedSDKList.length;
          const set = new Set();
          this.unActivedSDKList = res.data
          const len = this.unActivedSDKList.length
          const set = new Set()
          if (len <= 3) {
            this.recomandUpdateList = [...this.unActivedSDKList];
            this.recomandUpdateList = [...this.unActivedSDKList]
          } else {
            for (let i = 0; i < 3; i++) {
              const pickI = Math.floor(Math.random() * len);
              const pickI = Math.floor(Math.random() * len)
              if (set.has(pickI)) {
                i--;
                continue;
                i--
                continue
              }
              set.add(pickI);
              this.recomandUpdateList.push(this.unActivedSDKList[pickI]);
              set.add(pickI)
              this.recomandUpdateList.push(this.unActivedSDKList[pickI])
            }
          }
          v == 1 ? (this.tempList = res.data) : null;
          v == 1 ? (this.tempList = res.data) : null
        }
      });
      })
    },
    getUnActivedAppList() {
      getUnActivedApp({ appName: this.inputText }).then((res) => {
        if (res.code == 200) {
          this.unActivedAppList = res.data;
          this.pickTab();
          this.unActivedAppList = res.data
          this.pickTab("app")
        }
      });
      })
    },
    actived(item) {
      if (!item.canUpOrIns) {
        return false;
        return false
      }
      let _this = this;
      let _this = this
      if (this.activeTab == "sdk") {
        actPageAlg(item.id, "")
          .then((res) => {
            if (res.data.isSuccess) {
              this.productDetailVisible = false;
              _this.activedSdkOrApp = res.data.successMsg;
              this.showActivateSuccess = true;
              _this.actStep++;
              _this.getUnActivedList(1);
              _this.getAllSdk();
              this.productDetailVisible = false
              _this.activedSdkOrApp = res.data.successMsg
              this.showActivateSuccess = true
              _this.actStep++
              _this.getUnActivedList(1)
              _this.getAllSdk()
            } else {
              _this.$notify.error(res.data.failMsg.failMsg);
              _this.$notify.error(res.data.failMsg.failMsg)
            }
          })
          .catch((e) => {});
          .catch((e) => {})
      } else if (this.activeTab == "app") {
        //激活应用
        actApp(item.id, "")
          .then((res) => {
            if (res.data.isSuccess) {
              this.productDetailVisible = false;
              _this.activedSdkOrApp = res.data.successMsg;
              this.showActivateSuccess = true;
              _this.actStep++;
              _this.getUnActivedAppList();
              _this.getAllApps();
              this.productDetailVisible = false
              _this.activedSdkOrApp = res.data.successMsg
              this.showActivateSuccess = true
              _this.actStep++
              _this.getUnActivedAppList()
              _this.getAllApps()
            } else {
              _this.$notify.error(res.data.failMsg.failMsg);
              _this.$notify.error(res.data.failMsg.failMsg)
            }
          })
          .catch((e) => {});
          .catch((e) => {})
      }
    },
    onFileUpload(file) {
      this.patchFile = { ...file };
      this.fileAdded = true;
      const h = this.$createElement;
      this.patchFile = { ...file }
      this.fileAdded = true
      const h = this.$createElement
      //上传完成获取安装信息
      let _this = this;
      let _this = this
      getInstallInfo(file)
        .then((res) => {
          _this.installFile = file;
          _this.installFile = file
          if (res.success) {
            _this.installDialogVisible = true;
            _this.installDialogVisible = true
            if (res.data.apps.length > 0) {
              _this.installAppPackage = {
                appId: res.data.apps[0].appId,
                version: res.data.apps[0].version,
                productName: res.data.productName,
                installContent: res.data.apps[0].installContent,
              };
                installContent: res.data.apps[0].installContent
              }
            }
            if (res.data.sdks.length > 0) {
              _this.installSdkPackage = {
                appId: res.data.sdks[0].sdkId,
                version: res.data.sdks[0].version,
                productName: res.data.productName,
                installContent: res.data.sdks[0].installContent,
              };
                installContent: res.data.sdks[0].installContent
              }
            }
          } else {
            this.$message.error(res.msg);
            this.$message.error(res.msg)
          }
        })
        .catch((e) => {
          this.$message.error(e.msg);
        });
          this.$message.error(e.msg)
        })
    },
    onFileAdded(f) {
      this.patchUpdateStatus = "";
      this.patchUpdateStatus = ""
    },
    async getAllSdk() {
      let installedList = [];
      let unInstalledList = [];
      let hasNewVersionList = [];
      let res = await findAllSdk({ sdkName: this.inputText });
      let installedList = []
      let unInstalledList = []
      let hasNewVersionList = []
      let res = await findAllSdk({ sdkName: this.inputText })
      if (res && res.success) {
        this.sdkUpgreading = false;
        this.sdkUpgreading = false
        res.data.forEach((item) => {
          let obj = Object.assign(
            { unloadLoading: false, upgradeLoading: false },
            item
          );
          if (
            obj.progressMsg !== "" &&
            obj.progressMsg !== "已安装" &&
            obj.progressMsg !== "100%"
          ) {
            obj.upgradeLoading = true;
            this.sdkUpgreading = true;
          let obj = Object.assign({ unloadLoading: false, upgradeLoading: false }, item)
          if (obj.progressMsg !== "" && obj.progressMsg !== "已安装" && obj.progressMsg !== "100%") {
            obj.upgradeLoading = true
            this.sdkUpgreading = true
          }
          //算法软件 已安装其中包含待升级 未安装
          item.installed ? installedList.push(obj) : unInstalledList.push(obj);
          item.isUpgrade ? hasNewVersionList.push(obj) : null;
        });
          item.installed ? installedList.push(obj) : unInstalledList.push(obj)
          item.isUpgrade ? hasNewVersionList.push(obj) : null
        })
      }
      this.installedList = installedList;
      this.notInstalledList = unInstalledList;
      this.toUpdateArr1 = this.installedList.slice(0, 10);
      this.hasNewVersionSdk = hasNewVersionList;
      this.pickTab();
      this.installedList = installedList
      this.notInstalledList = unInstalledList
      this.toUpdateArr1 = this.installedList.slice(0, 10)
      this.hasNewVersionSdk = hasNewVersionList
      this.pickTab("app")
    },
    unloadSdk(sdk) {
      let _this = this;
      let _this = this
      this.$confirm("确定要卸载该算法吗?", "提示")
        .then(() => {
          _this.productDetailVisible = false;
          sdk.unloadLoading = true;
          _this.productDetailVisible = false
          sdk.unloadLoading = true
          removeSdk({ sdkId: sdk.id })
            .then((res) => {
              if (res && res.success) {
                sdk.unloadLoading = false;
                this.$notify.success("卸载完成");
                _this.getAllSdk();
                window.parent.postMessage({ msg: "AppUpdate" }, "*");
                sdk.unloadLoading = false
                this.$notify.success("卸载完成")
                _this.getAllSdk()
                window.parent.postMessage({ msg: "AppUpdate" }, "*")
              }
            })
            .catch((e) => {
              sdk.unloadLoading = false;
            });
              sdk.unloadLoading = false
            })
        })
        .catch((e) => {});
        .catch((e) => {})
    },
    donwloadSDK(item) {
      let timer = null;
      item.upgradeLoading = true;
      let timer = null
      item.upgradeLoading = true
      timer = setInterval(() => {
        this.rocketIf = !this.rocketIf;
      }, 350);
      this.downloadItem = item.id;
        this.rocketIf = !this.rocketIf
      }, 350)
      this.downloadItem = item.id
      downloadSdk({ path: item.id })
        .then((rsp) => {
          clearInterval(timer);
          item.upgradeLoading = false;
          this.downloadItem = "";
          clearInterval(timer)
          item.upgradeLoading = false
          this.downloadItem = ""
          window.parent.postMessage({ msg: "AppUpdate" }, "*");
          window.parent.postMessage({ msg: "AppUpdate" }, "*")
        })
        .catch((err) => {
          this.$notify.warning(err.data);
          item.upgradeLoading = false;
          this.downloadItem = "";
        });
          this.$notify.warning(err.data)
          item.upgradeLoading = false
          this.downloadItem = ""
        })
      // 开启自动刷新
      this.sdkUpgreading = true;
      this.sdkUpgreading = true
    },
    autoRefreshAppAndSdkState() {
      this.getAllApps();
      this.getAllSdk();
      this.getAllApps()
      this.getAllSdk()
      if (!this.autoRefresh) {
        return;
        return
      }
      setTimeout(() => {
        if (this.appUpgreading) {
          this.getAllApps();
          this.getAllApps()
        }
        if (this.sdkUpgreading) {
          this.getAllSdk();
          this.getAllSdk()
        }
      }, 1000);
      }, 1000)
    },
  },
};
    removeAPP(item) {
      console.log(item)
    }
  }
}
</script>
<style lang="scss">
.s-task-manage {
@@ -1142,12 +1034,7 @@
              border: none;
              border-radius: 20px;
              width: 52px;
              background: linear-gradient(
                180deg,
                #ecfcfe 0%,
                #ebf4fd 47.92%,
                #f4f4fe 100%
              );
              background: linear-gradient(180deg, #ecfcfe 0%, #ebf4fd 47.92%, #f4f4fe 100%);
              .el-input--suffix {
                border: none;
                .el-input__icon {
@@ -1196,12 +1083,7 @@
              margin: -10px -20px;
              border: none;
              border-radius: 20px;
              background: linear-gradient(
                180deg,
                #ecfcfe 0%,
                #ebf4fd 47.92%,
                #f4f4fe 100%
              );
              background: linear-gradient(180deg, #ecfcfe 0%, #ebf4fd 47.92%, #f4f4fe 100%);
            }
          }
        }
@@ -1221,12 +1103,7 @@
        height: 200px;
        margin: 0 60px;
        z-index: 99;
        background: linear-gradient(
          180deg,
          #ecfcfe 0%,
          #ebf4fd 47.92%,
          #f4f4fe 100%
        );
        background: linear-gradient(180deg, #ecfcfe 0%, #ebf4fd 47.92%, #f4f4fe 100%);
        border-radius: 4px;
        height: 75px;
        display: flex;
@@ -1418,6 +1295,12 @@
                border-color: #1dd4ec !important;
                color: #ffffff;
              }
              .remove-btn {
                margin: 10px 0px;
                background-color: #b6b9b9 !important;
                border-color: #b9bbbb !important;
                color: #ffffff;
              }
              @keyframes spin {
                from {
                  transform: rotate(0deg);
@@ -1587,4 +1470,3 @@
  }
}
</style>
src/pages/settings/views/NetSettings.vue
@@ -85,7 +85,8 @@
          <!-- <switchBar :barName="`高级设置`" :value="isHighClass"></switchBar> -->
          <div class="general-box fold" :class="{ hidden: IPV4_hid }">
          <!-- wifi已连接的情况下显示ip信息 -->
          <div class="general-box fold" :class="{ hidden: IPV4_hid }" v-show="selectedWifi.connected">
            <div class="in-title">
              IPV4
              <span class="icon iconfont icon-fold" @click="toggleFold('IPV4_hid')">&#xe757;</span>
src/pages/settings/views/clusterManagement.vue
@@ -253,7 +253,8 @@
        clusterip: [{ validator: isIPv4, trigger: "blur" }],
        clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }]
      },
      quitInput: ""
      clusterPassword: "",
      clusterPasswordInput: ""
    }
  },
  components: {
@@ -482,7 +483,7 @@
    exitCluster() {
      const h = this.$createElement
      let res = {}
      this.quitInput = ""
      this.clusterPasswordInput = ""
      this.$msgbox({
        title: "",
        message: h(
@@ -494,7 +495,7 @@
            h("span", { class: "icon iconfont warn-icon" }, "\ue71c"),
            h("span", { class: "warn-title" }, "退出集群"),
            h("input", {
              attrs: { placeholder: "请输入集群密码", id: "quit-input", class: "warn-title" },
              attrs: { placeholder: "请输入集群密码", id: "cluster-password", class: "warn-title" },
              value: "",
              on: { input: this.onQuitInputChange }
            })
@@ -513,7 +514,7 @@
        async () => {
          clearInterval(this.intervalTimer)
          try {
            res = await leave({ password: this.quitInput })
            res = await leave({ password: this.clusterPasswordInput })
            if (res && res.success) {
              this.showCurCluster = false
              this.ruleForm.virtualIp = ""
@@ -539,7 +540,7 @@
      )
    },
    onQuitInputChange() {
      this.quitInput = document.getElementById("quit-input").value
      this.clusterPasswordInput = document.getElementById("cluster-password").value
    },
    clearInput(typ) {
      if (typ == 1) {
@@ -639,13 +640,63 @@
      this.innerNodes = []
    },
    async change2Master() {
      let res = await update2Master({ clusterId: this.clusterid, nodeId: this.ruleForm.localId })
      if (res && res.success) {
        this.$message.success("切换成功")
        this.findCluster()
      } else {
        this.$message.warning("切换失败")
      }
      const h = this.$createElement
      this.clusterPasswordInput = ""
      this.$msgbox({
        title: "",
        message: h(
          "div",
          {
            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("input", {
              attrs: { placeholder: "请输入集群密码", id: "cluster-password", class: "warn-title" },
              value: "",
              on: { input: this.onQuitInputChange }
            })
          ]
        ),
        // showInput: true,
        showCancelButton: true,
        showClose: true,
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        customClass: "del-account-message-box"
      })
        .then(
          // () => {
          //   this.showCurCluster = false;
          // }
          async () => {
            clearInterval(this.intervalTimer)
            try {
              let res = await update2Master({
                clusterId: this.clusterid,
                nodeId: this.ruleForm.localId,
                password: this.clusterPasswordInput
              })
              if (res && res.success) {
                this.$message.success("切换成功")
                this.findCluster()
              } else {
                this.$message.warning("切换失败, 请检查密码")
                this.masterNode = false
              }
            } catch (err) {
              console.log(err)
              this.$notify.error({
                title: "失败",
                message: err.msg
              })
            }
          }
        )
        .catch(() => {
          this.masterNode = false
        })
    }
  }
}