mo 5 lat temu
rodzic
commit
aa29a1793b
2 zmienionych plików z 118 dodań i 19 usunięć
  1. 2 1
      src/App.vue
  2. 116 18
      src/views/reportForm/index.vue

+ 2 - 1
src/App.vue

@@ -116,7 +116,8 @@ input[type="number"] {
   cursor: pointer;
 }
 .newBand {
-  width: 100px;
+  min-width: 100px;
+  padding: 0 10px;
   height: 36px;
   line-height: 36px;
   margin-bottom: 20px;

+ 116 - 18
src/views/reportForm/index.vue

@@ -5,22 +5,56 @@
     </h2>
     <div class="m-core">
       <div class="m-wrap">
-        <el-date-picker v-model="mouth" type="month" placeholder="选择月" value-format="yyyy-MM-dd"></el-date-picker>
+        <el-date-picker v-model="mouth"
+                        type="month"
+                        placeholder="选择月"
+                        value-format="yyyy-MM-dd"></el-date-picker>
 
-        <div class="newBand" @click="exportSalar" v-permission="'export/teacherSalary'">导出课酬</div>
-        <el-tooltip placement="top" popper-class="mTooltip">
+        <div class="newBand"
+             @click="exportSalar"
+             v-permission="'export/teacherSalary'">导出课酬</div>
+        <el-tooltip placement="top"
+                    popper-class="mTooltip">
           <div slot="content">
             将只导出当前选择月份已结算的课程课酬。
           </div>
           <!-- <img :src="imageIcon" class="micon el-tooltip" style="width:8px height:8px" alt /> -->
-          <i class="el-icon-question micon el-tooltip" style="font-size: 18px; color: #F56C6C"></i>
+          <i class="el-icon-question micon el-tooltip"
+             style="font-size: 18px; color: #F56C6C"></i>
         </el-tooltip>
       </div>
+      <div class="m-core">
+        <div class="m-wrap">
+          <el-select v-model.trim="organIdList"
+                     filterable
+                     multiple
+                     clearable>
+            <el-option v-for="(item,index) in organList"
+                       :key="index"
+                       :label="item.name"
+                       :value="item.id"></el-option>
+          </el-select>
+
+          <div class="newBand"
+               @click="exportMusicGroup"
+               v-permission="'export/musicGroupRegister'">招生情况汇总表导出</div>
+          <!-- <el-tooltip placement="top"
+                      popper-class="mTooltip">
+            <div slot="content">
+              将只导出当前选择月份已结算的课程课酬。
+            </div>
+
+            <i class="el-icon-question micon el-tooltip"
+               style="font-size: 18px; color: #F56C6C"></i>
+          </el-tooltip> -->
+        </div>
+      </div>
     </div>
   </div>
 </template>
 <script>
-import {exportTeacherSalary} from '@/api/generalSettings'
+import { exportTeacherSalary } from '@/api/generalSettings'
+import { getEmployeeOrgan } from "@/api/buildTeam";
 import axios from 'axios'
 import {
   getToken
@@ -29,20 +63,29 @@ import load from '@/utils/loading'
 import qs from 'qs'
 export default {
   name: "reportForm",
-  data() {
+  data () {
     return {
       mouth: "",
+      organList: [],
+      organIdList: []
       // imageIcon: require("@/assets/images/base/warning.png")
     };
   },
-  methods:{
-    exportSalar(){
-      if(!this.mouth){
+  mounted () {
+    getEmployeeOrgan().then(res => {
+      if (res.code == 200) {
+        this.organList = res.data;
+      }
+    });
+  },
+  methods: {
+    exportSalar () {
+      if (!this.mouth) {
         this.$message.error('请选择导出月份')
         return
       }
-       let url = '/api-web/export/teacherSalary'
-      let data = {date:this.mouth}
+      let url = '/api-web/export/teacherSalary'
+      let data = { date: this.mouth }
       const options = {
         method: 'POST',
         headers: {
@@ -64,11 +107,11 @@ export default {
             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) {
+            if (res.indexOf('code') != -1) {
               let json = JSON.parse(res)
               this.$message.error(json.msg)
             } else {
@@ -76,7 +119,7 @@ export default {
               let link = document.createElement("a")
               let nowTime = new Date()
               let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate()
-              let fname =  ymd + '课酬' //下载文件的名字
+              let fname = ymd + '课酬' //下载文件的名字
               link.href = objectUrl
               link.setAttribute("download", fname)
               document.body.appendChild(link)
@@ -85,13 +128,68 @@ export default {
           })
           load.endLoading();
         }).catch(error => {
-            this.$message.error('导出数据失败,请联系管理员');
-            load.endLoading();
+          this.$message.error('导出数据失败,请联系管理员');
+          load.endLoading();
+        })
+      }).catch(() => { })
+    },
+    exportMusicGroup () {
+      if (this.organIdList.length < 1) {
+        this.$message.error('请至少选择一个分部')
+        return
+      }
+
+      let url = '/api-web/export/musicGroupRegister'
+      let data = { date: this.organIdList.join(',') }
+      const options = {
+        method: 'POST',
+        headers: {
+          'Authorization': getToken()
+        },
+        data: qs.stringify(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(() => { })
+    }
   }
-  }
-  
+
 };
 </script>
 <style lang="scss" scoped>