guhongwei 4 gadi atpakaļ
vecāks
revīzija
7a46ed25cb
2 mainītis faili ar 26 papildinājumiem un 4 dzēšanām
  1. 13 2
      src/views/test/dialogs.vue
  2. 13 2
      src/views/test/route.vue

+ 13 - 2
src/views/test/dialogs.vue

@@ -4,8 +4,15 @@
       <el-col :span="24">
         <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
         <el-col :span="24" class="container">
-          <el-col :span="24" style="margin:15px 0;text-align:right;">
-            <el-button type="primary" size="mini" @click="dialogFormVisible = true">添加</el-button>
+          <el-col :span="24" style="margin:15px 0;">
+            <el-col :span="12">
+              <el-input placeholder="请输入名称" v-model="searchName" class="input-with-select">
+                <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
+              </el-input>
+            </el-col>
+            <el-col :span="12" style="text-align:right;">
+              <el-button type="primary" size="mini" @click="dialogFormVisible = true">添加</el-button>
+            </el-col>
           </el-col>
           <el-col :span="24">
             <el-table :data="list" style="width: 100%" border>
@@ -77,6 +84,7 @@ export default {
       currentPage: 0,
       pageSize: 10,
       skip: 0,
+      searchName: '',
     };
   },
   created() {
@@ -86,6 +94,9 @@ export default {
     ...lunbo(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询列表
     async search({ skip = 0, limit = 10, ...info } = {}) {
+      if (this.searchName) {
+        info.name = this.searchName;
+      }
       skip = this.skip;
       let res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {

+ 13 - 2
src/views/test/route.vue

@@ -4,8 +4,15 @@
       <el-col :span="24">
         <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
         <el-col :span="24" class="container">
-          <el-col :span="24" style="margin:15px 0;text-align:right;">
-            <el-button type="primary" size="mini" @click="add()">添加</el-button>
+          <el-col :span="24" style="margin:15px 0;">
+            <el-col :span="12">
+              <el-input placeholder="请输入名称" v-model="searchName" class="input-with-select">
+                <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
+              </el-input>
+            </el-col>
+            <el-col :span="12" style="text-align:right;">
+              <el-button type="primary" size="mini" @click="dialogFormVisible = true">添加</el-button>
+            </el-col>
           </el-col>
           <el-col :span="24">
             <el-table :data="list" style="width: 100%" border>
@@ -56,6 +63,7 @@ export default {
       currentPage: 0,
       pageSize: 10,
       skip: 0,
+      searchName: '',
     };
   },
   created() {
@@ -65,6 +73,9 @@ export default {
     ...lunbo(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询列表
     async search({ skip = 0, limit = 10, ...info } = {}) {
+      if (this.searchName) {
+        info.name = this.searchName;
+      }
       skip = this.skip;
       let res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {