瀏覽代碼

网管课search修改

wolyshaw 4 年之前
父節點
當前提交
09df5baf13

+ 1 - 0
src/components/overflow-text/index.vue

@@ -3,6 +3,7 @@
     class="tooltip"
     effect="dark"
     placement="top"
+    :open-delay="300"
   >
     <template #content>
       <span class="tooltip-content">{{text}}</span>

+ 1 - 1
src/components/save-form/index.vue

@@ -21,7 +21,7 @@ export default {
     }
   },
   mounted() {
-    const searchs = new Searchs(this['save-key'] || this.$route.fullPath)
+    const searchs = new Searchs(this.saveKey || this.$route.fullPath)
     this.searchs = searchs
     const active = searchs.get()
     for (const key in active.form) {

+ 1 - 0
src/router/notKeepAliveList.js

@@ -15,4 +15,5 @@ export default [
   '/vipClassSet/vipNewActive', // VIP活动方案修改
   '/main/main', // 首页
   '/journal/journal', // 系统日志
+  '/business/accompany',
 ]

+ 21 - 13
src/views/accompanyManager/accompanyBuys.vue

@@ -1,13 +1,15 @@
 <!--  -->
 <template>
   <div class="m-core">
-    <el-form :inline="true"
+    <save-form :inline="true"
              class="searchForm"
-             v-model.trim="searchForm">
+             @submit="search"
+             @reset="onReSet"
+             :save-key="saveKey"
+             :model.sync="searchForm">
       <!-- 状态 指导老师 活动方案-->
       <el-form-item>
         <el-input v-model.trim="searchForm.search"
-                  @keyup.enter.native="search"
                   placeholder="学员编号 学员名称"></el-input>
       </el-form-item>
       <el-form-item>
@@ -16,7 +18,7 @@
                    filterable
                    clearable
                    placeholder="请选择分部">
-          <el-option v-for="(item,index) in organList"
+          <el-option v-for="(item,index) in selects.branchs"
                      :key="index"
                      :label="item.name"
                      :value="item.id"></el-option>
@@ -36,9 +38,9 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button @click="search"
+        <el-button native-type="submit"
                    type="danger">搜索</el-button>
-        <el-button @click="onReSet"
+        <el-button native-type="reset"
                    type="primary">重置</el-button>
       </el-form-item>
       <el-form-item>
@@ -48,7 +50,7 @@
                    v-permission="'export/studentBuyPractice'"
                    style="background-color: #14928a; border: 1px solid #14928a;">导出</el-button>
       </el-form-item>
-    </el-form>
+    </save-form>
     <div class="tableWrap">
       <el-table style="width: 100%"
                 :header-cell-style="{background:'#EDEEF0',color:'#444'}"
@@ -198,14 +200,20 @@ export default {
   activated () {
     this.init();
   },
+  computed: {
+    saveKey() {
+      return this.$route.path + '/2'
+    }
+  },
   methods: {
     init () {
       // 获取分部
-      getEmployeeOrgan().then(res => {
-        if (res.code == 200) {
-          this.organList = res.data;
-        }
-      });
+      this.$store.dispatch('setBranchs')
+      // getEmployeeOrgan().then(res => {
+      //   if (res.code == 200) {
+      //     this.organList = res.data;
+      //   }
+      // });
       this.getList()
     },
     getList () {
@@ -298,4 +306,4 @@ export default {
 };
 </script>
 <style lang='scss' scoped>
-</style>
+</style>

+ 36 - 19
src/views/accompanyManager/accompanyList.vue

@@ -14,13 +14,16 @@
            style="width: 120px;">网管课导出</div>
     </div>
     <div class="m-core">
-      <el-form :inline="true"
+      <save-form :inline="true"
                class="searchForm"
-               v-model.trim="searchForm">
+               @submit="search"
+               @reset="onReSet"
+               :save-key="saveKey"
+               :model.sync="searchForm">
         <!-- 状态 指导老师 活动方案-->
         <el-form-item>
           <el-input v-model.trim="searchForm.search"
-                    @keyup.enter.native="search"
+                    clearable
                     placeholder="课程组名称"></el-input>
         </el-form-item>
         <el-form-item>
@@ -29,7 +32,7 @@
                      filterable
                      clearable
                      placeholder="请选择分部">
-            <el-option v-for="(item,index) in organList"
+            <el-option v-for="(item,index) in selects.branchs"
                        :key="index"
                        :label="item.name"
                        :value="item.id"></el-option>
@@ -63,6 +66,7 @@
           <el-select v-model.trim="searchForm.teacherId"
                      clearable
                      filterable
+                     :filter-method="filterMethod"
                      placeholder="指导老师">
             <el-option v-for="(item,index) in teacherList"
                        :key="index"
@@ -95,12 +99,12 @@
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button @click="search"
+          <el-button native-type="submit"
                      type="danger">搜索</el-button>
-          <el-button @click="onReSet"
+          <el-button native-type="reset"
                      type="primary">重置</el-button>
         </el-form-item>
-      </el-form>
+      </save-form>
       <!-- tab -->
       <div class="tableWrap">
         <el-table style="width: 100%"
@@ -326,6 +330,11 @@ export default {
       }
     };
   },
+  computed: {
+    saveKey() {
+      return this.$route.path + '/1'
+    }
+  },
   created () {
     // if (this.$route.query.searchForm) {
     //   this.$route.query.searchForm instanceof Object
@@ -356,18 +365,26 @@ export default {
     this.init();
   },
   methods: {
+    filterMethod(inp) {
+      this.teacherList = this.selects.teachers.filter(item => (item.realName || '').indexOf(inp) > -1).slice(0, 49)
+    },
     init () {
-      getEmployeeOrgan().then(res => {
-        if (res.code == 200) {
-          this.organList = res.data;
-        }
-      });
+      // getEmployeeOrgan().then(res => {
+      //   if (res.code == 200) {
+      //     this.organList = res.data;
+      //   }
+      // });
+      this.$store.dispatch('setBranchs')
+      this.$store.dispatch('setTeachers')
+        .then(() => {
+          this.teacherList = [...this.selects.teachers].slice(0, 49)
+        })
       //   <!-- 状态 指导老师 活动方案-->
-      getTeacher().then(res => {
-        if (res.code == 200) {
-          this.teacherList = res.data;
-        }
-      });
+      // getTeacher().then(res => {
+      //   if (res.code == 200) {
+      //     this.teacherList = res.data;
+      //   }
+      // });
       this.getList();
     },
     permission (str, parent) {
@@ -536,7 +553,7 @@ export default {
       let searchForm = JSON.stringify(this.searchForm);
       this.$router.push({
         path: "/business/accompanys",
-        query: { id: row.id, rules, searchForm, type: row.type }
+        query: { id: row.id, type: row.type }
       });
     },
     closeCrouse (row) {
@@ -608,4 +625,4 @@ export default {
     margin-right: 10px;
   }
 }
-</style>
+</style>

+ 6 - 3
src/views/accompanyManager/index.vue

@@ -27,8 +27,9 @@ import accompanyBuys from '@/views/accompanyManager/accompanyBuys'
 export default {
   components: { accompanyList, accompanyBuys },
   data () {
+    const { query } = this.$route
     return {
-      activeIndex: "1",
+      activeIndex: query.opt || '1',
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -40,9 +41,11 @@ export default {
 
   },
   methods: {
-    handleClick () { }
+    handleClick (evt) {
+      this.changeHash(evt.name)
+    }
   },
 }
 </script>
 <style lang='scss' scoped>
-</style>
+</style>