فهرست منبع

应用分类与算法平台保持一致

Huhu 2 سال پیش
والد
کامیت
66685aaa1a
2فایلهای تغییر یافته به همراه37 افزوده شده و 33 حذف شده
  1. 18 17
      src/views/modules/generator/applications.vue
  2. 19 16
      src/views/modules/monitor/components/applications.vue

+ 18 - 17
src/views/modules/generator/applications.vue

@@ -26,10 +26,10 @@
           @change="getDataListByType(dataForm.applicationType)"
         >
           <el-option
-            v-for="item in applicationTypeOptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
+            v-for="data in applicationTypeOptions"
+            :key="data"
+            :label="data"
+            :value="data"
           ></el-option>
         </el-select>
       </el-form-item>
@@ -195,18 +195,6 @@ export default {
       viewDetailVisible: false,
       filterVal: "",
       applicationTypeOptions: [
-        {
-          value: "",
-          label: "全部",
-        },
-        {
-          value: "水文",
-          label: "水文",
-        },
-        {
-          value: "采矿",
-          label: "采矿",
-        },
       ],
     };
   },
@@ -221,6 +209,12 @@ export default {
     // 获取数据列表
     getDataList() {
       this.dataListLoading = true;
+      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/applications/list"),
         method: "get",
@@ -267,7 +261,14 @@ export default {
         this.$refs.addOrUpdate.init(id);
       });
     },
-
+    //去重
+    unique(arr) {
+      var ss = [];
+      for (var i = 0; i < arr.length; i++) {
+        ss[i] = arr[i].categoryName;
+      }
+      return Array.from(new Set(ss));
+    },
     // 查看详情
     viewApplicationDetail(id) {
       var item = this.dataList.filter((item) => item.applicationId === id);

+ 19 - 16
src/views/modules/monitor/components/applications.vue

@@ -23,10 +23,10 @@
           @change="getDataListByType(dataForm.applicationType)"
         >
           <el-option
-            v-for="item in applicationTypeOptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
+            v-for="data in applicationTypeOptions"
+            :key="data"
+            :label="data"
+            :value="data"
           ></el-option>
         </el-select>
       </el-form-item>
@@ -182,18 +182,7 @@ export default {
       applicationViewVisible: false,
       filterVal: "",
       applicationTypeOptions: [
-        {
-          value: "",
-          label: "全部",
-        },
-        {
-          value: "水文",
-          label: "水文",
-        },
-        {
-          value: "采矿",
-          label: "采矿",
-        },
+        
       ],
     };
   },
@@ -209,6 +198,12 @@ export default {
     // 获取数据列表
     getDataList() {
       this.dataListLoading = true;
+      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/applications/list"),
         method: "get",
@@ -251,6 +246,14 @@ export default {
         this.$refs.addOrUpdate.init(id);
       });
     },
+    //去重
+    unique(arr) {
+      var ss = [];
+      for (var i = 0; i < arr.length; i++) {
+        ss[i] = arr[i].categoryName;
+      }
+      return Array.from(new Set(ss));
+    },
 
     // 查看详情
     viewApplicationDetail(id) {