Parcourir la source

边缘设备管理

wangyi il y a 2 ans
Parent
commit
cd11677639

+ 28 - 2
src/views/modules/generator/algorithm.vue

@@ -204,6 +204,9 @@ export default {
       this.$http({
         url: this.$http.adornUrl("/minioAlgorithm/getAlgorithmList"),
         method: "get",
+        params: this.$http.adornParams({
+          search:this.search
+        }),
       }).then(({ data }) => {
         console.log("data", data);
         if (data.length) {
@@ -237,13 +240,36 @@ export default {
     },
     //查询搜索框
     searchDataList() {
+      this.dataListLoading = true;
+      this.$http({
+        url: this.$http.adornUrl("/minioAlgorithm/selectByName"),
+        method: "get",
+        params: this.$http.adornParams({
+          algName:this.search
+        }),
+      }).then(({ data }) => {
+        console.log("data", data);
+        if (data.length) {
+          this.dataList = data.map((element) => {
+            element["state"] = 0;
+            element["loadingText"] = "发布";
+            return element;
+          });
+          this.totalPage = this.dataList.length;
+        } else {
+          this.dataList = [];
+          this.totalPage = 0;
+        }
+        this.dataListLoading = false;
+      });
+      /*
       this.getDataList();
-      this.dataList = this.dataList.filter(
+       this.dataList = this.dataList.filter(
         (data) =>
           !this.search ||
           data.algorithmName.toLowerCase().includes(this.search.toLowerCase())
       );
-      this.totalPage = this.dataList.length;
+      this.totalPage = this.dataList.length; */
     },
     //查询镜像制作日志
     watchImagesLog(id){

+ 36 - 12
src/views/modules/generator/applications.vue

@@ -6,9 +6,9 @@
       @keyup.enter.native="getDataList()"
     >
       <el-form-item>
-        <el-button type="primary" @click="addOrUpdateHandle()"
+        <!-- <el-button type="primary" @click="addOrUpdateHandle()"
           >新增应用</el-button
-        >
+        > -->
         <el-form-item>
           <el-input
             v-model="dataForm.applicationName"
@@ -22,14 +22,14 @@
         <el-select
           clearable
           label="应用类型"
-          v-model="dataForm.applicationType"
+          v-model="dataForm.deployDeviceId"
           @change="getDataListByType(dataForm.applicationType)"
         >
           <el-option
-            v-for="data in applicationTypeOptions"
-            :key="data"
-            :label="data"
-            :value="data"
+            v-for="data in deployDevices"
+            :key="data.edgenodesId"
+            :label="data.edgenodesName"
+            :value="data.edgenodesId"
           ></el-option>
         </el-select>
       </el-form-item>
@@ -84,6 +84,13 @@
         label="应用状态"
       >
       </el-table-column>
+      <el-table-column
+        prop="deployDeviceName"
+        header-align="center"
+        align="center"
+        label="部署设备"
+      >
+      </el-table-column>
       <!-- <el-table-column
         prop="parentProjectName"
         header-align="center"
@@ -184,6 +191,7 @@ export default {
       dataForm: {
         applicationType: "",
         applicationName: "",
+        deployDeviceId:"",
       },
       dataList: [],
       pageIndex: 1,
@@ -196,6 +204,9 @@ export default {
       filterVal: "",
       applicationTypeOptions: [
       ],
+      deployDevices:[
+        
+      ]
     };
   },
   components: {
@@ -209,19 +220,31 @@ export default {
     // 获取数据列表
     getDataList() {
       this.dataListLoading = true;
-      this.$http({
+      /* this.$http({
         url: this.$http.adornUrl("/category/select"),
         method: "get",
       }).then(({ data }) => {
         this.applicationTypeOptions = this.unique(data.list);
-      });
+      }); */
+      //获取所有边缘结点
+      this.$http({
+          url: this.$http.adornUrl('/generator/edgenodes/list'),
+          method: 'get',
+          params: this.$http.adornParams({
+            
+          })
+        }).then(({data}) => {
+          this.deployDevices=data.page.list;
+          var center={edgenodesId:0,edgenodesName:"中心云"};
+          this.deployDevices.push(center);
+        })
       this.$http({
         url: this.$http.adornUrl("/generator/applications/list"),
         method: "get",
         params: this.$http.adornParams({
           page: this.pageIndex,
           limit: this.pageSize,
-          applicationType: this.dataForm.applicationType,
+          deployDeviceId: this.dataForm.deployDeviceId,
           applicationName: this.dataForm.applicationName,
         }),
       }).then(({ data }) => {
@@ -357,10 +380,11 @@ export default {
     // 更新image状态
     async updateImage(name) {
       const { data } = await this.$http({
-        url: this.$http.adornUrl("/generator/images/list"),
+        url: this.$http.adornUrl("/generator/images/listAll"),
         method: "get",
       });
-      const image = data.page.list.find((item) => item.imageName == name);
+      console.log(data.list)
+      const image = data.list.find((item) => item.imageName == name);
       if (image) {
         await this.$http({
           url: this.$http.adornUrl("/generator/images/update"),

+ 1 - 0
src/views/modules/generator/edgenodes.vue

@@ -247,6 +247,7 @@
                 }
               })
             } else {
+              console.log(data)
               this.$message.error(data.msg)
             }
           })

+ 22 - 4
src/views/modules/generator/images.vue

@@ -38,12 +38,12 @@
       @keyup.enter.native="getDataList()"
     >
       <el-form-item>
-        <el-button
+        <!-- <el-button
           v-if="isAuth('generator:images:save')"
           type="primary"
           @click="addOrUpdateHandle()"
           >新增镜像</el-button
-        >
+        > -->
         <el-form-item>
           <el-input
             v-model="dataForm.imageName"
@@ -236,8 +236,8 @@ export default {
           label: "全部",
         },
         {
-          value: "基础镜像",
-          label: "基础镜像",
+          value: "传统算法镜像",
+          label: "传统算法镜像",
         },
         {
           value: "应用镜像",
@@ -307,6 +307,17 @@ export default {
         }
         this.dataListLoading = false;
       });
+
+      //获取所有边缘结点
+      this.$http({
+          url: this.$http.adornUrl('/generator/edgenodes/list'),
+          method: 'get',
+          params: this.$http.adornParams({
+            
+          })
+        }).then(({data}) => {
+          this.edgenodes=data.page.list;
+        })
     },
     // 每页数
     sizeChangeHandle(val) {
@@ -498,6 +509,7 @@ export default {
         method: "post",
         data: this.$http.adornData({
           applicationName: name,
+          deployDeviceId: this.deployDevice,
           applicationType: "算法",
           applicationVersion: "v1",
           applicationStatus: "运行中",
@@ -552,6 +564,12 @@ export default {
         this.deployDevice=this.device;
         console.log("部署在中心云:"+this.deployDevice);
       }
+      if(this.deployDevice.length==0){
+        this.$message.error("请选择部署设备", 1500);
+      }else{
+        this.startImage(this.image);
+        this.appDeviceVisible=false;
+      }
       
     }
   },