Browse Source

新增组件及页面

liuqiwen 4 years ago
parent
commit
c0ba6f36b7
2 changed files with 135 additions and 16 deletions
  1. 1 0
      dgtis-ui/package.json
  2. 134 16
      dgtis-ui/src/views/system/userInfoList/index.vue

+ 1 - 0
dgtis-ui/package.json

@@ -65,6 +65,7 @@
     "vue-cropper": "0.4.9",
     "vue-router": "3.0.2",
     "vue-splitpane": "1.0.4",
+    "vue_pageination": "^1.1.2",
     "vuedraggable": "2.20.0",
     "vuex": "3.1.0"
   },

+ 134 - 16
dgtis-ui/src/views/system/userInfoList/index.vue

@@ -14,7 +14,8 @@
                 icon="el-icon-download"
                 size="mini"
                 @click="handleExport"
-                v-hasPermi="['system:role:export']"
+                v-hasPermi="['system:role:export']"s
+                :loading="exportLoading"
               >导出</el-button>
             </div>
             <el-table v-loading="loading" :data="customerList">
@@ -78,14 +79,21 @@
                 </template>
               </el-table-column>
             </el-table>
-
-            <pagination
-              v-show="total>0"
-              :total="total"
-              :page.sync="queryParams.pageNum"
-              :limit.sync="queryParams.pageSize"
-              @pagination="getList"
-            />
+<!--            <div :class="{'hidden':hidden}" class="pagination-container">-->
+<!--              <el-pagination-->
+<!--                background-->
+<!--                :current-page="pageNum"-->
+<!--                :page-size="queryParams.pageSize"-->
+<!--                :layout="layout"-->
+<!--                :page-sizes="pageSizes"-->
+<!--                pager-count="11"-->
+<!--                :total="total"-->
+<!--                @size-change="sizeChange"-->
+<!--                @prev-click="currentChange"-->
+<!--                @next-click="currentChange"-->
+<!--              />-->
+<!--            </div>-->
+            <pageinationnew :total="total" :size="queryParams.pageSize" :page="1" :changge="currentChange" :isUrl="true"></pageinationnew>
           </div>
         </div>
       </el-col>
@@ -94,10 +102,18 @@
 </template>
 
 <script>
-  import { listCustomer } from "@/api/customerInformation/customerInformation.js";
-  import axios from 'axios'
+  import { listCustomer,listExport } from "@/api/customerInformation/customerInformation.js";
+  import Axios from 'axios'
+  import { tansParams } from "@/utils/ruoyi";
+  import Vue from 'vue'
+  import pageinationnew from 'vue_pageination';
+  Vue.use(pageinationnew);
+
   export default {
   name: "UserInfoList",
+  components: {
+    pageinationnew
+  },
   data() {
     return {
       // 遮罩层
@@ -109,12 +125,17 @@
       customerList: [],
       // 查询参数
       queryParams: {
+        pageSize: 10,
         pageNum: 1,
-        pageSize: 10
+        // scrollId:'',
       },
       cellWidth:'130',
       cellWidthS:'90',
       cellWidthB:'260',
+      hidden:false,
+      layout:'total, sizes, prev,pager,next',
+      pageSizes:[10, 20, 30, 50],
+      exportLoading:false,
     };
   },
   // watch: {
@@ -180,18 +201,84 @@
         listCustomer(that.queryParams).then(response => {
             console.log(response);
           this.customerList = response.data.list;
+          // if(response.data.scrollId != undefined && response.data.scrollId !=""){
+          //   that.queryParams.scrollId = response.data.scrollId;
+          // }else{
+          //   that.queryParams.scrollId = '';
+          // }
           this.total = response.data.total;
           this.loading = false;
         }
       );
 
     },
-
+    currentChange(val){
+      this.queryParams.pageNum = val;
+      this.getList();
+    },
+    sizeChange(val){
+      this.queryParams.pageSize = val;
+      this.queryParams.pageNum = 1;
+      this.queryParams.scrollId = '';
+      this.getList();
+    },
     /** 导出按钮操作 */
     handleExport() {
-      this.download('data/customer/export', {
-        ...this.queryParams
-      }, `customer_${new Date().getTime()}.xlsx`)
+      var that = this;
+      var url=process.env.VUE_APP_BASE_API+'data/customer/export';
+      // Axios.get(url).then((data) => {
+      //   console.log(data)
+      // }).catch((r) => {
+      //   console.error(r)
+      // })
+      that.exportLoading = true;
+      var elemIF = document.createElement('iframe')
+      elemIF.src = url;
+      elemIF.style.display = 'none'
+      document.body.appendChild(elemIF);
+      that.exportLoading = false;
+
+      // listExport(that.queryParams).then(response => {
+      //     console.log(response);
+      //
+      //   }
+      // );
+      // this.download('data/customer/export', {
+      //   ...this.queryParams
+      // }, `customer_${c}.xlsx`)
+      // var filename = `customer_${new Date().getTime()}.xlsx`;
+      // var url=process.env.VUE_APP_BASE_API+'data/customer/export';
+      // var params = {
+      //   ...this.queryParams
+      // };
+      // Axios.defaults.timeout = 70000;
+      // Axios.get(url, params, {
+      //   transformRequest: [(params) => {
+      //     return tansParams(params)
+      //   }],
+      //   headers: {
+      //     'Content-Type': 'application/x-www-form-urlencoded'
+      //   },
+      //   responseType: 'blob'
+      // }).then((data) => {
+      //   console.log(data);
+      //   const content = data
+      //   const blob = new Blob([content])
+      //   if ('download' in document.createElement('a')) {
+      //     const elink = document.createElement('a')
+      //     elink.download = filename
+      //     elink.style.display = 'none'
+      //     elink.href = URL.createObjectURL(blob)
+      //     document.body.appendChild(elink)
+      //     elink.click()
+      //     URL.revokeObjectURL(elink.href)
+      //     document.body.removeChild(elink)
+      //   } else {
+      //     navigator.msSaveBlob(blob, filename)
+      //   }
+      // }).catch((r) => {
+      //   console.error(r)
+      // })
     },
     toOverview(row){
       this.$router.push({ path:'/userInfoOverview', query: {id: row.id}  })
@@ -228,3 +315,34 @@
     }
   }
 </style>
+<style>
+  .pagination-container {
+    /*background: #fff;*/
+    padding: 32px 16px;
+  }
+  .pagination-container.hidden {
+    display: none;
+  }
+  .pageination div:first-child,.pageination div:last-child{
+    display: none;
+  }
+  .pageination div:nth-last-child(2){
+    border-right:1px solid #d1dbe5;
+  }
+  .pagination_page{
+    min-width: 30px !important;
+    box-sizing: border-box;
+    border: 0 !important;
+    margin: 0 6px;
+  }
+  .pagination_page_active{
+    background-color: #013C8A !important;
+    color: #FFFFFF !important;
+    border: 1px solid #013C8A !important;
+    border-radius: 3px;
+  }
+  .pageination_align{
+    text-align: right !important;
+    margin-top: 30px;
+  }
+</style>