zhangjie il y a 2 ans
Parent
commit
fcdc37d251

+ 13 - 1
src/components/UserSelect.vue

@@ -6,6 +6,7 @@
     filterable
     :clearable="clearable"
     :disabled="disabled"
+    :filter-method="filterMothod"
     @change="select"
   >
     <el-option
@@ -32,6 +33,7 @@ export default {
   data() {
     return {
       optionList: [],
+      dataList: [],
       selected: ""
     };
   },
@@ -51,7 +53,17 @@ export default {
       this.optionList = [];
 
       const res = await userListQuery();
-      this.optionList = res || [];
+      this.dataList = res || [];
+      this.optionList = this.dataList;
+    },
+    filterMothod(val) {
+      const escapeRegexpString = (value = "") =>
+        String(value).replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
+      const reg = new RegExp(escapeRegexpString(val), "i");
+
+      this.optionList = this.dataList.filter(
+        item => reg.test(item.name) || reg.test(item.loginName)
+      );
     },
     select() {
       this.$emit("input", this.selected);

+ 7 - 3
src/modules/admin/components/AppNginxManage.vue

@@ -48,14 +48,18 @@
           v-if="checkPrivilege('app_config_nginx_edit') || IS_MAINTAINER"
           class="part-box-action"
         >
+          <el-button
+            v-if="isEdit"
+            type="primary"
+            :loading="loading"
+            @click="confirm"
+            >提交</el-button
+          >
           <el-button
             :type="isEdit ? 'success' : 'default'"
             @click="isEdit = !isEdit"
             >编辑</el-button
           >
-          <el-button type="primary" :loading="loading" @click="confirm"
-            >提交</el-button
-          >
         </div>
       </div>