reloaded 5 سال پیش
والد
کامیت
3390e944d8
1فایلهای تغییر یافته به همراه9 افزوده شده و 4 حذف شده
  1. 9 4
      src/views/pcenter/demand.vue

+ 9 - 4
src/views/pcenter/demand.vue

@@ -39,6 +39,7 @@
                 </template>
               </el-table-column>
             </el-table>
+            <page :total="total" position="right" @query="search"></page>
           </template>
         </el-col>
         <el-col :span="24" class="datail" v-else>
@@ -116,16 +117,18 @@
 </template>
 
 <script>
+import page from '@/components/pagination.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: demand } = createNamespacedHelpers('demand');
 export default {
   name: 'demand',
   props: {},
-  components: {},
+  components: { page },
   data: () => ({
     tableData: [],
     display: true,
     form: {},
+    total: 0,
     rules: {
       name: [{ required: true, message: '请输入需求技术名称', trigger: 'blur' }],
       field: [{ required: true, message: '请选择所属领域', trigger: 'blur' }],
@@ -143,17 +146,18 @@ export default {
   },
   methods: {
     ...demand(['update', 'fetch', 'query', 'create', 'delete']),
-    async search() {
+    async search({ skip = 0, limit = 10, ...info } = {}) {
       console.log(this.user);
 
       let res = {};
       if (this.user.type === '0' || this.user.type === '1') {
-        res = await this.query({ skip: 0, limit: 10 });
+        res = await this.query({ skip, limit, ...info });
       }
       if (this.user.type === '3') {
-        res = await this.query({ skip: 0, limit: 10, uid: this.user.uid });
+        res = await this.query({ skip, limit, uid: this.user.uid });
       }
       this.$set(this, `tableData`, res.data);
+      this.$set(this, `total`, res.total);
     },
     async view(id) {
       const res = await this.fetch(id);
@@ -189,6 +193,7 @@ export default {
     },
     add() {
       this.display = false;
+      this.form = {};
     },
     // 返回
     back() {