Explorar el Código

新增模糊查询功能

limengbo hace 5 años
padre
commit
0fdac75637

+ 2 - 0
src/store/modules/topicList.js

@@ -20,9 +20,11 @@ const actions = {
     const code = obj.code ? obj.code : ''
     const status = obj.status ? obj.status : ''
     const pageNo = obj.page ? obj.page : ''
+    const title = obj.title ? obj.title : ''
     return new Promise((resolve, reject) => {
       getTopicList({
         code,
+        title,
         status,
         pageNo
       }).then((res) => {

+ 37 - 3
src/views/dashboardRowItem/index.vue

@@ -136,6 +136,17 @@
       </el-dialog>
       <!-- 选择课程表格 -->
       <el-dialog :title="form.targetType === 'TOPIC' ? '选择专题' : '选择课程' " :visible.sync="dialogTableVisible">
+        <el-form :inline="true" :model="formInline" class="demo-form-inline">
+          <el-form-item label="code">
+            <el-input v-model="formInline.code" placeholder="code" clearable />
+          </el-form-item>
+          <el-form-item label="名字">
+            <el-input v-model="formInline.title" placeholder="名字" clearable />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="onSubmit">查询</el-button>
+          </el-form-item>
+        </el-form>
         <el-table
           ref="singleTable"
           :data="tableData"
@@ -216,7 +227,11 @@ export default {
       },
       tableData: [],
       totalSize: 0,
-      tablePage: 1
+      tablePage: 1,
+      formInline: {
+        code: '',
+        title: ''
+      }
     }
   },
   created() {
@@ -340,6 +355,11 @@ export default {
     },
     selectList() {
       this.dialogTableVisible = true
+      this.formInline = {
+        title: '',
+        code: '',
+        status: ''
+      }
       if (this.form.targetType === 'TOPIC') {
         this.$store.dispatch('topicList/getTopicLists', {
           page: this.tablePage
@@ -417,7 +437,6 @@ export default {
           type: 'success'
         })
       }
-      // this.currentRow = val
     },
     handleTableChange(val) {
       console.log(val)
@@ -443,6 +462,21 @@ export default {
       // this.$store.dispatch('courseList/getCourseLists', {
       //   page: this.page
       // })
+    },
+    onSubmit() {
+      if (this.form.targetType === 'TOPIC') {
+        this.$store.dispatch('topicList/getTopicLists', this.formInline).then(res => {
+          console.log(res)
+          this.tableData = res.list
+          this.totalSize = res.totalSize
+        })
+      } else {
+        this.$store.dispatch('courseList/getCourseLists', this.formInline).then(res => {
+          console.log(res)
+          this.tableData = res.list
+          this.totalSize = res.totalSize
+        })
+      }
     }
   }
 }
@@ -459,7 +493,7 @@ export default {
   }
 }
   .el-input {
-    width: 280px;
+    width: 260px;
   }
   .el-select>.el-input {
     width: 300px;

+ 5 - 1
src/views/topicList/index.vue

@@ -6,6 +6,9 @@
         <el-form-item label="code">
           <el-input v-model="formInline.code" placeholder="code" clearable />
         </el-form-item>
+        <el-form-item label="名字">
+          <el-input v-model="formInline.title" placeholder="名字" clearable />
+        </el-form-item>
         <el-form-item label="状态">
           <el-select v-model="formInline.status" placeholder="请选择状态">
             <el-option label="未上架" value="NOT_ON_STOCK" />
@@ -128,6 +131,7 @@ export default {
     return {
       dialogFormVisible: false,
       formInline: {
+        title: '',
         code: '',
         status: ''
       },
@@ -218,7 +222,7 @@ export default {
   margin-top: 20px;
 }
 .el-form {
-  width: 50%;
+  width: 80%;
 }
 .el-input {
   width: 300px;