mo 4 年之前
父节点
当前提交
ef15729488
共有 3 个文件被更改,包括 78 次插入5 次删除
  1. 1 1
      src/api/zeroManager.js
  2. 19 4
      src/views/reportForm/index.vue
  3. 58 0
      src/views/sporadicManager/sporadicList.vue

+ 1 - 1
src/api/zeroManager.js

@@ -42,4 +42,4 @@ export function updateOpenFlag (data) {
     method: 'POST',
     data: qs.stringify(data)
   })
-}
+}

+ 19 - 4
src/views/reportForm/index.vue

@@ -72,6 +72,18 @@
                        :value="item.id"></el-option>
           </el-select>
 
+          <el-select v-model.trim="courseScheduleType"
+                     style="marginLeft:10px"
+                     filterable
+                     clearable
+                     multiple
+                     placeholder="课程类型">
+            <el-option v-for="(item, index) in courseArray"
+                       :key="index"
+                       :label="item.label"
+                       :value="item.value"></el-option>
+          </el-select>
+
           <div class="newBand"
                @click="exportDefaultSalary"
                v-permission="'export/teacherDefaultSalary'">导出</div>
@@ -92,12 +104,13 @@
 <script>
 import { exportTeacherSalary } from '@/api/generalSettings'
 import { getEmployeeOrgan } from "@/api/buildTeam";
+import { courseType } from '@/utils/searchArray'
 import axios from 'axios'
+import qs from 'qs'
 import {
   getToken
 } from '@/utils/auth'
 import load from '@/utils/loading'
-import qs from 'qs'
 export default {
   name: "reportForm",
   data () {
@@ -105,7 +118,9 @@ export default {
       mouth: "",
       organList: [],
       organIdList: [],
-      teacherDefaultSalaryOrganId: ''
+      teacherDefaultSalaryOrganId: '',
+      courseArray: courseType,
+      courseScheduleType: []
       // imageIcon: require("@/assets/images/base/warning.png")
     };
   },
@@ -231,9 +246,9 @@ export default {
         this.$message.error('请选择一个分部')
         return
       }
-
+      let courseTypeList = this.courseScheduleType.join(',')
       let url = '/api-web/export/teacherDefaultSalary'
-      let data = { organId: this.teacherDefaultSalaryOrganId }
+      let data = { organId: this.teacherDefaultSalaryOrganId, courseTypeList }
       const options = {
         method: 'POST',
         headers: {

+ 58 - 0
src/views/sporadicManager/sporadicList.vue

@@ -80,6 +80,8 @@
                      @click="search">搜索</el-button>
           <el-button @click="onReSet"
                      type="primary">重置</el-button>
+          <el-button @click="exportSporad"
+                     style=" background: #14928a; border:1px solid #14928a;color:#fff">导出</el-button>
         </el-form-item>
       </el-form>
       <div class="tableWrap">
@@ -375,6 +377,12 @@ import { getEmployeeOrgan } from '@/api/buildTeam'
 import pagination from '@/components/Pagination/index'
 import { vaildStudentUrl } from '@/utils/validate'
 import { addZero, getZero, removeZero, getBasic, updateOpenFlag } from '@/api/zeroManager'
+import axios from 'axios'
+import qs from 'qs'
+import {
+  getToken
+} from '@/utils/auth'
+import load from '@/utils/loading'
 import QRCode from 'qrcodejs2'
 export default {
   name: 'sporadicList',
@@ -676,6 +684,56 @@ export default {
       }).catch(() => {
       });
 
+    },
+    exportSporad () {
+      let url = '/api-web/export/sporadicChargeInfo'
+      let data = this.searchForm
+      const options = {
+        method: 'get',
+        headers: {
+          'Authorization': getToken()
+        },
+        params: data,
+        url,
+        responseType: 'blob'
+      }
+      this.$confirm('您确定导出零星缴费列表', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        load.startLoading()
+        axios(options).then(res => {
+          let blob = new Blob([res.data], {
+            // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
+            type: 'application/vnd.ms-excel;charset=utf-8'
+            //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
+          })
+
+          let text = (new Response(blob)).text()
+          text.then(res => {
+            // 判断是否报错
+            if (res.indexOf('code') != -1) {
+              let json = JSON.parse(res)
+              this.$message.error(json.msg)
+            } else {
+              let objectUrl = URL.createObjectURL(blob)
+              let link = document.createElement("a")
+              let nowTime = new Date()
+              let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate()
+              let fname = ymd + '零星缴费' //下载文件的名字
+              link.href = objectUrl
+              link.setAttribute("download", fname)
+              document.body.appendChild(link)
+              link.click()
+            }
+          })
+          load.endLoading();
+        }).catch(error => {
+          this.$message.error('导出数据失败,请联系管理员');
+          load.endLoading();
+        })
+      }).catch(() => { })
     }
   },
   watch: {