浏览代码

2022.8.16 出差统计导出

ggooalice 2 年之前
父节点
当前提交
c63bbc4117
共有 1 个文件被更改,包括 59 次插入10 次删除
  1. 59 10
      fhKeeper/formulahousekeeper/timesheet/src/views/awayOffice/awayOffice.vue

+ 59 - 10
fhKeeper/formulahousekeeper/timesheet/src/views/awayOffice/awayOffice.vue

@@ -157,7 +157,7 @@
             <div class="ctons">
         <!-- 出差列表筛选 -->
                 <div class="flex">
-                    <div><el-select v-model="ownerIds" placeholder="请选择出差人员" clearable @change="billss()" style="width: 140px" size="small" filterable="true">
+                    <div><el-select v-model="ownerIds" placeholder="请选择出差人员" clearable @change="billss(1)" style="width: 140px" size="small" filterable="true">
                             <el-option
                             v-for="item in users"
                             :key="item.id"
@@ -166,7 +166,7 @@
                             </el-option>
                     </el-select></div>
                     <div><span style="color: #606266">交通工具</span>
-                        <el-select v-model="type" placeholder="请选择交通工具" clearable @change="billss()" style="width: 140px;" size="small" filterable="true">
+                        <el-select v-model="type" placeholder="请选择交通工具" clearable @change="billss(1)" style="width: 140px;" size="small" filterable="true">
                             <el-option label="飞机" :value="0"></el-option>
                             <el-option label="火车" :value="1"></el-option>
                             <el-option label="汽车" :value="2"></el-option>
@@ -175,7 +175,7 @@
                         </el-select>
                     </div>
                     <div><span style="color: #606266">出差状态</span>
-                        <el-select :disabled="falg" v-model="code" placeholder="请选择出差状态" clearable @change="billss()" size="small" style="width: 140px" filterable="true">
+                        <el-select :disabled="falg" v-model="code" placeholder="请选择出差状态" clearable @change="billss(1)" size="small" style="width: 140px" filterable="true">
                             <el-option label="审核通过" :value="0"></el-option>
                             <el-option label="待审核" :value="1"></el-option>
                             <el-option label="驳回" :value="2"></el-option>
@@ -184,7 +184,7 @@
                         
                     </div>
                     <div><span style="color: #606266">时间段</span>
-                        <el-date-picker v-model="createDate" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="billss()" value-format="yyyy-MM-dd" placeholder="选择日期" size="small" clearable style="width:280px"></el-date-picker>
+                        <el-date-picker v-model="createDate" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="billss(1)" value-format="yyyy-MM-dd" placeholder="选择日期" size="small" clearable style="width:280px"></el-date-picker>
                     </div>
                     <div style="line-height: 32px;margin: 0 20px;">
                         <el-checkbox v-model="isOverTendays" @change="checkboxChange">10天以上</el-checkbox>
@@ -193,6 +193,9 @@
                     <div style="margin: 0 0 0 20px" v-if="userComLis.dingdingUserid != null && permissions.awayOfficeAll">
                         <el-button size="small" type="primary" @click="dingdingClick()" >从钉钉同步</el-button>
                     </div>
+                    <div style="margin: 0 0 0 20px" v-if="userComLis.dingdingUserid != null">
+                        <el-button size="small" type="primary" @click="dingdingListExport()" >导出</el-button>
+                    </div>
                 </div>
         <!-- 出差列表 -->
                 <el-table :data="tableList" style="width: 100%" height="90%" :loading="tableListLoading">
@@ -765,7 +768,8 @@ export default {
             ownerIdsId: '',
 
             isOverTendays: false,
-            tableListLoading: false
+            tableListLoading: false,
+
         }
     },
     created(){
@@ -791,8 +795,41 @@ export default {
         // console.log("session",this.wuduData);
     },
     methods: {
+        dingdingListExport(){
+            let parameter = {
+                keyword: ''
+            }
+            if(this.createDate.length != 0){
+                parameter.startDate = this.createDate[0]
+                parameter.endDate = this.createDate[1]
+            }
+            this.http.post("/business-trip/exportData",parameter,
+            res => {
+                if(res.code == 'ok'){
+                    var filePath = res.data;
+                    const a = document.createElement('a'); // 创建a标签
+                    a.setAttribute('download', '出差统计导出');// download属性
+                    a.setAttribute('href', filePath);// href链接
+                    a.click(); //自执行点击事件
+                    a.remove();
+                }else{
+                    this.$message({
+                    message: res.msg,
+                    type: "error"
+                    });
+                }
+            },error => {
+                this.$message({
+                    message: error,
+                    type: "error"
+                });
+            })
+        },
+
+
+
         checkboxChange(){
-            this.billss()
+            this.billss(1)
         },
         deleteOfDingding(e) {
             this.$confirm("确认要删除吗?", "提示", {}).then(() => {
@@ -1093,12 +1130,22 @@ export default {
             },
         handleSizeChange(val){
             this.size = val;
-            this.bills()
+            this.page = 1
+            if(this.isDingding){
+                this.billss()
+            }else{
+                this.bills()
+            }
+            
         },
         handleCurrentChange(val) {
             // console.log(val, 1, '1')
             this.page =  val;
-            this.bills()
+            if(this.isDingding){
+                this.billss()
+            }else{
+                this.bills()
+            }
         },
 
         // 出差申请
@@ -1232,8 +1279,10 @@ export default {
             // });
         },
         // 筛选刷新
-        billss() {
-            this.page = 1
+        billss(e) {
+            if(e){
+                this.page = 1
+            }
             var param = {
                 pageIndex: this.page,
                 pageSize: this.size,