Browse Source

新增组件及页面

liuqiwen 4 years ago
parent
commit
efb9b16eae

+ 2 - 0
dgtis-ui/src/main.js

@@ -14,6 +14,7 @@ import store from './store'
 import router from './router'
 import permission from './directive/permission'
 import { download } from '@/utils/request'
+import { downloadNew } from '@/utils/downloadNew'
 
 import './assets/icons' // icon
 import './permission' // permission control
@@ -33,6 +34,7 @@ Vue.prototype.addDateRange = addDateRange
 Vue.prototype.selectDictLabel = selectDictLabel
 Vue.prototype.selectDictLabels = selectDictLabels
 Vue.prototype.download = download
+Vue.prototype.downloadNew = downloadNew
 Vue.prototype.handleTree = handleTree
 Vue.prototype.levelText = levelText
 Vue.prototype.getArea = getArea

+ 33 - 8
dgtis-ui/src/views/system/sameCustomer/index.vue

@@ -12,8 +12,9 @@
             type="warning"
             icon="el-icon-download"
             size="mini"
-            @click="handleExport"
-            v-hasPermi="['system:user:export']"
+            @click="handleExportZero"
+            v-hasPermi="['business:sameCustomer']"
+            :loading="exportLoadingZero"
           >导出</el-button>
         </el-col>
       </el-row>
@@ -27,8 +28,9 @@
             type="warning"
             icon="el-icon-download"
             size="mini"
-            @click="handleExport"
-            v-hasPermi="['system:user:export']"
+            @click="handleExportOne"
+            v-hasPermi="['business:sameCustomer']"
+            :loading="exportLoadingOne"
           >导出</el-button>
         </el-col>
       </el-row>
@@ -42,8 +44,9 @@
             type="warning"
             icon="el-icon-download"
             size="mini"
-            @click="handleExport"
-            v-hasPermi="['system:user:export']"
+            @click="handleExportTwo"
+            v-hasPermi="['business:sameCustomer']"
+            :loading="exportLoadingTwo"
           >导出</el-button>
         </el-col>
       </el-row>
@@ -61,7 +64,9 @@ export default {
   },
   data() {
     return {
-
+      exportLoadingZero:false,
+      exportLoadingOne:false,
+      exportLoadingTwo:false,
     }
   },
   created() {
@@ -82,11 +87,31 @@ export default {
           );
       },
     /** 导出按钮操作 */
-    handleExport() {
+    handleExportZero() {
       // this.download('system/user/export', {
       //   ...this.queryParams
       // }, `user_${new Date().getTime()}.xlsx`)
     },
+    handleExportOne() {
+      var that = this;
+      that.exportLoadingOne = true;
+      this.downloadNew('data/customer/exportSameOne', {}, `customer_${new Date().getTime()}.csv`).then(response => {
+        console.log(response);
+        if(response){
+          that.exportLoadingOne = false;
+        }
+      })
+    },
+    handleExportTwo() {
+      var that = this;
+      that.exportLoadingTwo = true;
+      this.downloadNew('data/customer/exportSameTwo', {}, `customer_${new Date().getTime()}.csv`).then(response => {
+        console.log(response);
+        if(response){
+          that.exportLoadingTwo = false;
+        }
+      })
+    },
   }
 };
 </script>

+ 2 - 2
dgtis-ui/src/views/system/userInfoDetails/index.vue

@@ -62,7 +62,7 @@
 <!--                  <img style="width: 100%;" src="../../../assets/image/levelBg.png" alt=""/>-->
 <!--                </div>-->
                 <div :class="{'levelImgDiv':true,'levelImg':isShowlevelText(levelText(custInfo.custclass)),'levelImgNull':!isShowlevelText(levelText(custInfo.custclass))}">
-                  <div class="level" v-if="isShowlevelText(levelText(custInfo.custclass))">{{levelText(custInfo.custclass)}}会员</div>
+                  <div class="level" v-if="isShowlevelText(levelText(custInfo.custclass))">{{levelText(custInfo.custclass)}}客户</div>
                   <div class="isPay">已交保费</div>
                   <div class="payNum">{{custInfo.prem}}</div>
                 </div>
@@ -269,7 +269,7 @@ export default {
       this.$router.push({ path:'/userInfoDetails', query: {id: id}  })
     },
     isShowlevelText(text){
-      if(text == '普通' || text == '无'){
+      if(text == '无'){
         return false;
       }else{
         return true;

+ 13 - 54
dgtis-ui/src/views/system/userInfoList/index.vue

@@ -14,7 +14,7 @@
                 icon="el-icon-download"
                 size="mini"
                 @click="handleExport"
-                v-hasPermi="['system:role:export']"s
+                v-hasPermi="['business:customerInformation:list']"
                 :loading="exportLoading"
               >导出</el-button>
             </div>
@@ -225,60 +225,19 @@
     /** 导出按钮操作 */
     handleExport() {
       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)
-      // })
+      this.downloadNew('data/customer/export', {
+        ...this.queryParams
+      }, `customer_${new Date().getTime()}.csv`).then(response => {
+        console.log(response);
+        if(response){
+          that.exportLoading = false;
+        }
+      })
+    },
+    genUrl(encoded, options) {
+      const dataBlob = new Blob([`\ufeff${encoded}`], { type: 'text/plain;charset=utf-8' });//返回的格式
+      return window.URL.createObjectURL(dataBlob);
     },
     toOverview(row){
       this.$router.push({ path:'/userInfoOverview', query: {id: row.id}  })