Переглянути джерело

反诈骗省公司报表 上传组件增加成功回调

yangyd 3 роки тому
батько
коміт
7ec382dad5

+ 2 - 4
src/components/upload.vue

@@ -2,7 +2,7 @@
     <div v-loading="loading">
         <el-upload class="upload-demo" :drag="fileInfo.type !== 'btn'" multiple :limit="fileInfo.limit" ref="upload"
             action="string" :on-remove="handleRemove" :on-exceed="handleExceed" :file-list="fileList"
-             :auto-upload="true" :show-file-list="fileInfo.type !== 'btn'" :on-change="stateChange"
+             :auto-upload="true" :show-file-list="fileInfo.type !== 'btn'"
             :before-upload="deforeUp" :http-request="signUpload">
             <div v-if="fileInfo.type !== 'btn'">
                 <i class="el-icon-upload"></i>
@@ -122,6 +122,7 @@
                         this.$refs['upload'].clearFiles();
                         this.$emit('uploadBack',res)
                         if(res.data.result==0){
+                            this.$emit('onSuccess',file)
                             _this.$message({
                                 message: res.data.desc,
                                 type: 'success'
@@ -190,9 +191,6 @@
                     return false
                 })
             },
-            stateChange(file, fileList){
-                this.$emit('onChange',file, fileList)
-            }
         },
         mounted() {
 

+ 12 - 8
src/pages/main/antiSpoofing/channel.vue

@@ -1,17 +1,17 @@
 <template>
     <fullscreen :fullscreen.sync="fullscreen" class="container" style="margin: 0;">
         <div class="container-box">
-            <div class="search">
+            <div class="search" v-if="!provincialCompany">
                 <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
                 <div v-if="!provincialCompany">
                     <el-button class="btn-check" plain size="medium" type="primary" @click="downloadTemplate">下载模板
                     </el-button>
-                    <myUpload style="display:inline-block;" :fileInfo="fileInfo" @onChange="onChange"
+                    <myUpload style="display:inline-block;" :fileInfo="fileInfo" @onSuccess="onSuccess"
                               :fileList="fileInfo.fileList"></myUpload>
                 </div>
             </div>
             <div class="tabbox">
-                <el-table height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData"
+                <el-table :key="key" :height="height" class="com-table" ref="multipleTable" :data="tableData"
                           tooltip-effect="dark" size="small" border style="width: 100%" :header-cell-style="headerStyleFun" :cell-style="cellStyle">
                     <el-table-column align="center" :label="toolTit">
                         <el-table-column prop="cityName" align="center" label="地市" >
@@ -88,13 +88,13 @@
                     typexz:"xlsx"
                 },
                 provincialCompany:false,
+                height:"calc(100% - 40px)",
+                key:0
             }
         },
         methods: {
-            onChange(file, fileList){
-                if (file.status === 'success'){
-                    this.searchInfo([this.searchList[0].value], 1);
-                }
+            onSuccess(file){
+                this.searchInfo([this.searchList[0].value], 1);
             },
             cellStyle({row, column, rowIndex, columnIndex}){
                 if (columnIndex === 0){
@@ -190,7 +190,11 @@
                         flag = true
                     }
                 }
-                this.provincialCompany = !flag
+                if (!flag){
+                    this.provincialCompany = true
+                    this.height = "calc(100%)"
+                    this.key += 1
+                }
             }
         },
         mounted() {

+ 11 - 8
src/pages/main/antiSpoofing/districtCounty.vue

@@ -1,17 +1,17 @@
 <template>
     <fullscreen :fullscreen.sync="fullscreen" class="container" style="margin: 0;">
         <div class="container-box">
-            <div class="search">
+            <div class="search"  v-if="!provincialCompany">
                 <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
                 <div v-if="!provincialCompany">
                     <el-button class="btn-check" plain size="medium" type="primary" @click="downloadTemplate">下载模板
                     </el-button>
-                    <myUpload style="display:inline-block;" :fileInfo="fileInfo" @onChange="onChange"
+                    <myUpload style="display:inline-block;" :fileInfo="fileInfo" @onSuccess="onSuccess"
                               :fileList="fileInfo.fileList"></myUpload>
                 </div>
             </div>
             <div class="tabbox">
-                <el-table height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData"
+                <el-table :key="key" height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData"
                     tooltip-effect="dark" size="small" border style="width: 100%" :header-cell-style="headerStyleFun" :cell-style="cellStyle">
                     <el-table-column align="center" :label="toolTit">
                         <el-table-column prop="cityName" align="center" label="地市" >
@@ -79,13 +79,12 @@
                     typexz:"xlsx"
                 },
                 provincialCompany:false,
+                key:0
             }
         },
         methods: {
-            onChange(file, fileList){
-                if (file.status === 'success'){
-                    this.searchInfo([this.searchList[0].value], 1);
-                }
+            onSuccess(file){
+                this.searchInfo([this.searchList[0].value], 1);
             },
             cellStyle({row, column, rowIndex, columnIndex}){
                 if (columnIndex === 0){
@@ -181,7 +180,11 @@
                         flag = true
                     }
                 }
-                this.provincialCompany = !flag
+                if (!flag){
+                    this.provincialCompany = true
+                    this.height = "calc(100%)"
+                    this.key += 1
+                }
             }
         },
         mounted() {

+ 14 - 10
src/pages/main/antiSpoofing/personnel.vue

@@ -1,17 +1,17 @@
 <template>
     <fullscreen :fullscreen.sync="fullscreen" class="container" style="margin: 0;">
         <div class="container-box">
-            <div class="search">
+            <div class="search" v-if="!provincialCompany">
                 <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
-                <div v-if="!provincialCompany">
+                <div>
                     <el-button class="btn-check" plain size="medium" type="primary" @click="downloadTemplate">下载模板
                     </el-button>
-                    <myUpload style="display:inline-block;" :fileInfo="fileInfo" @onChange="onChange"
+                    <myUpload style="display:inline-block;" :fileInfo="fileInfo" @onSuccess="onSuccess"
                               :fileList="fileInfo.fileList"></myUpload>
                 </div>
             </div>
             <div class="tabbox">
-                <el-table height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData"
+                <el-table :key="key" :height="height" class="com-table" ref="multipleTable" :data="tableData"
                           tooltip-effect="dark" size="small" border style="width: 100%" :header-cell-style="headerStyleFun" :cell-style="cellStyle">
                     <el-table-column align="center" :label="toolTit">
                         <el-table-column prop="cityName" align="center" label="地市" >
@@ -85,13 +85,13 @@
                     typexz:"xlsx"
                 },
                 provincialCompany:false,
+                height:'calc(100% - 40px)',
+                key:0
             }
         },
         methods: {
-            onChange(file, fileList){
-                if (file.status === 'success'){
-                    this.searchInfo([this.searchList[0].value], 1);
-                }
+            onSuccess(file){
+                this.searchInfo([this.searchList[0].value], 1);
             },
             headerStyleFun({row, column, rowIndex, columnIndex}){
                 if (rowIndex === 0){
@@ -187,7 +187,11 @@
                         flag = true
                     }
                 }
-                this.provincialCompany = !flag
+                if (!flag){
+                    this.provincialCompany = true
+                    this.height = "calc(100%)"
+                    this.key += 1
+                }
             }
         },
         mounted() {
@@ -202,7 +206,7 @@
         },
         created() {
 
-        }
+        },
     }
 </script>
 <style scoped lang="scss">

+ 7 - 4
src/pages/main/antiSpoofing/standingBook.vue

@@ -139,8 +139,10 @@
             },
             outList() {
                 let param = new FormData();
-                param.append("startDate", this.searchList[0].value ? this.$formatDate(this.searchList[0].value, "YYYY-MM") : '');
-                param.append("endDate", this.searchList[1].value ? this.$formatDate(this.searchList[1].value, "YYYY-MM") : '');
+                let startDate = this.searchList[0].value ? this.$formatDate(this.searchList[0].value, "YYYY-MM") : '';
+                let endDate = this.searchList[1].value ? this.$formatDate(this.searchList[1].value, "YYYY-MM") : '';
+                param.append("startDate", startDate);
+                param.append("endDate", endDate);
                 this.$http({
                     url: '/market/antiSpoofing/exportStandingBook',
                     method: "post",
@@ -150,18 +152,19 @@
                     },
                     data: param,
                 }).then((response) => {
+                    let fileName = '省公司汇总台账_'+(startDate===endDate ? startDate : startDate+'-'+endDate)+'.xlsx';
                     if (window.navigator && window.navigator.msSaveOrOpenBlob) {
                         let blob = new Blob([response.data], {
                             type: response.data.type
                         });
-                        window.navigator.msSaveOrOpenBlob(blob, '人员考核模板.xlsx');
+                        window.navigator.msSaveOrOpenBlob(blob, fileName);
                     } else {
                         /* 火狐谷歌的文件下载方式 */
                         var blob = new Blob([response.data])
                         var downloadElement = document.createElement('a')
                         var href = window.URL.createObjectURL(blob);
                         downloadElement.href = href;
-                        downloadElement.download = '人员考核模板.xlsx';
+                        downloadElement.download = fileName;
                         document.body.appendChild(downloadElement);
                         downloadElement.click();
                         document.body.removeChild(downloadElement);