Ver Fonte

搜索逻辑优化

DESKTOP-6LTVLN7\Liumouren há 8 meses atrás
pai
commit
ec17ab0c2f
2 ficheiros alterados com 111 adições e 89 exclusões
  1. 69 55
      src/components/proxy/ConfigManage.vue
  2. 42 34
      src/views/LoginView.vue

+ 69 - 55
src/components/proxy/ConfigManage.vue

@@ -8,6 +8,8 @@
           placeholder="请选择类型"
           style="margin-right: 12px"
           default-first-option
+          @change="screenData()"
+          clearable
         >
           <el-option
             v-for="(item, index) in selectOptions"
@@ -16,9 +18,17 @@
             :value="item.value"
           ></el-option>
         </el-select>
-        <el-input v-model="searchStr" style="width:150px;margin-right:20px;" placeholder="请输入查询关键字"></el-input>
-        <el-button type="primary" round @click="screenData()">查询</el-button>
-        <el-button type="primary" round @click="handleDetailVisible('Add')">新增配置</el-button>
+        <el-input
+          v-model="searchStr"
+          style="width: 150px; margin-right: 20px"
+          placeholder="请输入查询关键字"
+          @change="screenData()"
+          clearable
+        ></el-input>
+        <!-- <el-button type="primary" round @click="screenData()">查询</el-button> -->
+        <el-button type="primary" round @click="handleDetailVisible('Add')"
+          >新增配置</el-button
+        >
         <!-- <el-button v-show="proxyType != 'INTEGRATION'" round @click="viewAllModel">全部预览</el-button> -->
         <el-tooltip content="刷新" placement="right">
           <el-button circle @click="refresh">
@@ -34,7 +44,11 @@
           :data="tableData"
           :max-height="maxHeight"
           v-loading="loading"
-          @current-change="(row) => { this.currRow = row }"
+          @current-change="
+            (row) => {
+              this.currRow = row;
+            }
+          "
           border
           stripe
         >
@@ -46,14 +60,17 @@
           <el-table-column prop="key" label="标题" min-width="100">
             <template #default="scope">
               <span
-                style="font-weight: bold;font-family: JetBrainsMono-Regular,serif"
-              >{{ scope.row.key }}</span>
+                style="font-weight: bold; font-family: JetBrainsMono-Regular, serif"
+                >{{ scope.row.key }}</span
+              >
             </template>
           </el-table-column>
           <el-table-column prop="content" label="描述" min-width="100" />
           <el-table-column prop="proxyUrl" label="链接" min-width="350">
             <template #default="scope">
-              <span style="font-family: JetBrainsMono-Regular,serif">{{ scope.row.proxyUrl }}</span>
+              <span style="font-family: JetBrainsMono-Regular, serif">{{
+                scope.row.proxyUrl
+              }}</span>
             </template>
           </el-table-column>
           <el-table-column prop="operation" label="操作" min-width="120">
@@ -64,18 +81,22 @@
                 @click="handleDetailVisible('Edit', scope.row)"
               >
                 <el-icon>
-                  <IconPark-edit />
-                </el-icon>修改
+                  <IconPark-edit /> </el-icon
+                >修改
               </el-button>
               <el-button size="small" @click="deleteConfig(scope.row)">
                 <el-icon>
-                  <IconPark-delete />
-                </el-icon>删除
+                  <IconPark-delete /> </el-icon
+                >删除
               </el-button>
-              <el-button v-show="proxyType != 'INTEGRATION'" size="small" @click="view(scope.row)">
+              <el-button
+                v-show="proxyType != 'INTEGRATION'"
+                size="small"
+                @click="view(scope.row)"
+              >
                 <el-icon>
-                  <IconPark-preview-open />
-                </el-icon>预览
+                  <IconPark-preview-open /> </el-icon
+                >预览
               </el-button>
             </template>
           </el-table-column>
@@ -138,7 +159,7 @@ export default {
       pageInfo: {
         page: 1,
         pageSize: 10,
-        total: 0
+        total: 0,
       },
       proxyType: "",
       dataType: "",
@@ -146,45 +167,45 @@ export default {
       dataTypes: {
         99: {
           label: "数据",
-          value: "UNKNOWN"
+          value: "UNKNOWN",
         },
         0: {
           label: "全部",
-          value: "ALL"
+          value: "ALL",
         },
         1: {
           label: "地图",
-          value: "MAP"
+          value: "MAP",
         },
         2: {
           label: "三维模型",
-          value: "MODEL"
+          value: "MODEL",
         },
         3: {
           label: "GLTF模型",
-          value: "GLTF"
-        }
+          value: "GLTF",
+        },
       },
 
       routerParam: {
         publish_twoD: {
           proxyType: "PUBLISH",
-          dataTypes: [1]
+          dataTypes: [1],
         },
         publish_threeD: {
           proxyType: "PUBLISH",
-          dataTypes: [2, 3]
+          dataTypes: [2, 3],
         },
         integration_data: {
           proxyType: "INTEGRATION",
-          dataTypes: [99]
-        }
+          dataTypes: [99],
+        },
       },
 
       mapTypes: {
         MODEL: 1,
         GLTF: 2,
-        MAP: 4
+        MAP: 4,
       },
 
       detailVisible: false,
@@ -198,37 +219,37 @@ export default {
       allMapType: -1,
       isAllMapShow: false,
 
-      searchStr: ""
+      searchStr: "",
     };
   },
   watch: {
-    "pageInfo.page": function() {
+    "pageInfo.page": function () {
       this.renderTable();
     },
-    "pageInfo.pageSize": function() {
+    "pageInfo.pageSize": function () {
       this.renderTable();
     },
-    dataType: function() {
+    dataType: function () {
       this.refresh();
     },
-    "$route.name": function(val) {
+    "$route.name": function (val) {
       if (val) {
         this.initType();
         this.refresh();
       }
-    }
+    },
   },
   components: {
     ConfigDetail,
     CesiumMap,
-    AllCesiumMap
+    AllCesiumMap,
   },
   created() {
     this.initType();
     this.pageInfo = {
       page: 1,
       pageSize: 10,
-      total: 0
+      total: 0,
     };
   },
   mounted() {
@@ -272,11 +293,11 @@ export default {
 
       let params = {
         proxyType: this.proxyType, //"PUBLISH"
-        dataType: this.dataType //"MAP"
+        dataType: this.dataType, //"MAP"
       };
       this.$request
         .postForm("/proxy_proxy/proxy_api/config/getByType", params)
-        .then(res => {
+        .then((res) => {
           that.configData = [];
           if (res.code === 200) {
             let num = 0;
@@ -286,14 +307,11 @@ export default {
             if (res.content) {
               that.configData = JSON.parse(JSON.stringify(res.content));
               // let t = []
-              that.configData.forEach(i => {
+              that.configData.forEach((i) => {
                 i.id = num++;
                 // if (i.type == "3dtiles") {
                 if (i.type.indexOf("arcgis") >= 0) {
-                  i.proxyUrl = systemConfig.proxyUrl_arcgis.replace(
-                    "{PROXYURL}",
-                    i.key
-                  );
+                  i.proxyUrl = systemConfig.proxyUrl_arcgis.replace("{PROXYURL}", i.key);
                   // if (i.type.indexOf("arcgis-tile") >= 0) t.push(encodeURIComponent(i.proxyUrl + "622067E9-93E5-D8EC-E677-85B58A63C0C7"))
                 } else if (i.type == "cartodb") {
                   let one = systemConfig.proxyUrl.replace(
@@ -320,18 +338,14 @@ export default {
                   );
                   i.proxyUrl = one.replace("{PROXYURL}", i.key);
                 } else {
-                  i.proxyUrl = systemConfig.proxyUrl.replace(
-                    "{PROXYURL}",
-                    i.key
-                  );
+                  i.proxyUrl = systemConfig.proxyUrl.replace("{PROXYURL}", i.key);
                 }
               });
 
-              that.configData = that.configData.filter(function(item) {
+              that.configData = that.configData.filter(function (item) {
                 return that.searchStr == ""
                   ? true
-                  : item.content.indexOf(that.searchStr.replace(/ /g, "")) >=
-                      0 ||
+                  : item.content.indexOf(that.searchStr.replace(/ /g, "")) >= 0 ||
                       item.key.indexOf(that.searchStr.replace(/ /g, "")) >= 0;
               });
 
@@ -342,7 +356,7 @@ export default {
           }
           that.loading = false;
         })
-        .catch(err => {
+        .catch((err) => {
           that.loading = false;
           that.$message({ message: err.message, type: "error" });
         });
@@ -405,11 +419,11 @@ export default {
         let params = {
           proxyType: this.proxyType,
           dataType: this.dataType,
-          index: item.id
+          index: item.id,
         };
         that.$request
           .deleteForm("/proxy_proxy/proxy_api/config/delete", params)
-          .then(res => {
+          .then((res) => {
             if (res.code === 200) {
               that.$message({ message: "删除成功", type: "success" });
               that.getData();
@@ -417,12 +431,12 @@ export default {
               that.$message({ message: res.content, type: "error" });
             }
           })
-          .catch(err => {
+          .catch((err) => {
             that.$message({ message: err.message, type: "error" });
           });
       });
-    }
-  }
+    },
+  },
 };
 </script>
 
@@ -451,4 +465,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 42 - 34
src/views/LoginView.vue

@@ -2,17 +2,26 @@
   <div id="login">
     <div class="login_container">
       <div class="login_div">
-        <el-form :model="loginForm" label-width="120" style="margin-right: 75px;margin-top: 100px">
+        <el-form
+          :model="loginForm"
+          label-width="120"
+          style="margin-right: 75px; margin-top: 100px"
+        >
           <el-form-item label="用户名:">
             <el-input placeholder="请输入用户名" v-model="loginForm.userName"></el-input>
           </el-form-item>
-          <el-form-item>
-          </el-form-item>
+          <el-form-item> </el-form-item>
           <el-form-item label="密码:">
-            <el-input placeholder="请输入密码" type="password" v-model="loginForm.password"></el-input>
+            <el-input
+              placeholder="请输入密码"
+              type="password"
+              v-model="loginForm.password"
+            ></el-input>
           </el-form-item>
           <el-form-item>
-            <el-button style="margin-top: 15px;width: 50%;" type="primary" @click="login" >登录</el-button>
+            <el-button style="margin-top: 15px; width: 50%" type="primary" @click="login"
+              >登录</el-button
+            >
           </el-form-item>
         </el-form>
       </div>
@@ -21,45 +30,46 @@
 </template>
 
 <script>
-
 export default {
   data() {
     return {
       loginForm: {
-        userName: '',
-        password: '',
-        clientId: 7
-      }
-    }
-  },
-  mounted() {
+        userName: "",
+        password: "",
+        clientId: 7,
+      },
+    };
   },
+  mounted() {},
   methods: {
     login() {
-      if (!this.loginForm.userName || this.loginForm.userName==='') {
-        this.$message.error('请输入用户名')
+      if (!this.loginForm.userName || this.loginForm.userName === "") {
+        this.$message.error("请输入用户名");
         return;
       }
-      if (!this.loginForm.password || this.loginForm.password==='') {
-        this.$message.error('请输入密码')
+      if (!this.loginForm.password || this.loginForm.password === "") {
+        this.$message.error("请输入密码");
         return;
       }
       let app = this;
-      this.$request.post('/oauth/api/user/login', this.loginForm).then(res=>{
-        if (res.code==200) {
-          this.$store.state.token = res.message;
-          this.$store.state.user = res.content;
-          localStorage.setItem("user-token", res.message);
-          this.$router.push({name:'home'})
-        } else {
-          app.$message.error(res.content)
-        }
-      }).catch(e=>{
-        app.$message.error(e.message)
-      })
-    }
-  }
-}
+      this.$request
+        .post("/oauth/api/user/login", this.loginForm)
+        .then((res) => {
+          if (res.code == 200) {
+            this.$store.state.token = res.message;
+            this.$store.state.user = res.content;
+            localStorage.setItem("user-token", res.message);
+            this.$router.push({ name: "home" });
+          } else {
+            app.$message.error(res.content);
+          }
+        })
+        .catch((e) => {
+          app.$message.error(e.message);
+        });
+    },
+  },
+};
 </script>
 
 <style lang="less" scoped>
@@ -70,7 +80,6 @@ export default {
   background-repeat: no-repeat;
   background-size: 100% 100%;
   //border: 1px solid red;
-
 }
 .login_container {
   width: 100%;
@@ -89,4 +98,3 @@ export default {
   }
 }
 </style>
-