Browse Source

添加导出和搜索

lex-xin 4 years ago
parent
commit
672b3a4f16
2 changed files with 110 additions and 2 deletions
  1. 96 2
      src/views/reportForm/index.vue
  2. 14 0
      src/views/teamDetail/teamCourseList.vue

+ 96 - 2
src/views/reportForm/index.vue

@@ -45,6 +45,7 @@
                      class="organSelect"
                      style="width:100%"
                      filterable
+                     placeholder="请选择分部"
                      multiple
                      clearable>
             <el-option v-for="(item,index) in organList"
@@ -76,6 +77,7 @@
                      class="organSelect"
                      style="width:100%"
                      filterable
+                     placeholder="请选择分部"
                      multiple
                      clearable>
             <el-option v-for="(item,index) in organList"
@@ -98,6 +100,41 @@
           </el-tooltip>
         </div>
       </div>
+      <el-divider></el-divider>
+      <div class="m-core">
+        <div class="m-wrap">
+          <div class="title">回款统计:
+          </div>
+          <el-select v-model.trim="studentOrganId"
+                     class="organSelect"
+                     style="width:100%"
+                     filterable
+                     placeholder="请选择分部"
+                     multiple
+                     clearable>
+            <el-option v-for="(item,index) in organList"
+                       :key="index"
+                       :label="item.name"
+                       :value="item.id"></el-option>
+          </el-select>
+          <el-date-picker style="margin-left: 15px;" v-model="studentMonth"
+                        type="month"
+                        placeholder="选择月"
+                        value-format="yyyy-MM-dd"></el-date-picker>
+          <div class="newBand"
+               @click="exportStudent"
+               v-permission="'export/studentOrder'">导出</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"
+               v-permission="'export/studentOrder'"></i>
+          </el-tooltip>
+        </div>
+      </div>
     </div>
   </div>
 </template>
@@ -121,7 +158,9 @@ export default {
       organIdList: [],
       teacherDefaultSalaryOrganId: '',
       courseArray: courseType,
-      courseScheduleType: []
+      courseScheduleType: [],
+      studentOrganId: '',
+      studentMonth: ''
       // imageIcon: require("@/assets/images/base/warning.png")
     };
   },
@@ -293,7 +332,62 @@ export default {
           load.endLoading();
         })
       }).catch(() => { })
-    }
+    },
+    exportStudent () {
+      if (!this.studentMonth) {
+        this.$message.error('请选择导出月份')
+        return
+      }
+      let studentOrganId = this.studentOrganId.join(',')
+      let url = '/api-web/export/studentOrder'
+      let data = { organIds: studentOrganId, date: this.studentMonth }
+      const options = {
+        method: 'POST',
+        headers: {
+          'Authorization': getToken()
+        },
+        data: qs.stringify(cleanDeep(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(() => { })
+    },
   }
 
 };

+ 14 - 0
src/views/teamDetail/teamCourseList.vue

@@ -73,6 +73,17 @@
           </el-select>
         </el-form-item>
         <el-form-item>
+          <el-select v-model.trim="searchForm.isCallNames"
+                     clearable
+                     filterable
+                     placeholder="是否点名">
+            <el-option label="是"
+                       value="1"></el-option>
+            <el-option label="否"
+                       value="0"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
           <el-date-picker v-model.trim="searchForm.timer"
                           style="width:420px;"
                           type="daterange"
@@ -334,6 +345,7 @@ export default {
         courseType: null,
         timer: [nowTime, nowTime], // 时间
         class: null,
+        isCallNames: null, // 是否点名
         search: null, // 乐团名称 编号 vip课名称
         teacherIdList: null, // 老师编号
         schoolId: null // 教学点编号
@@ -416,6 +428,7 @@ export default {
         organIdList: searchForm.organIdList || null,
         search: searchForm.search || null,
         teacherIdList: searchForm.teacherIdList || null,
+        isCallNames: searchForm.isCallNames,
         schoolId: searchForm.schoolId || null
       };
       let url = "/api-web/export/superFindCourseSchedules";
@@ -485,6 +498,7 @@ export default {
         organIdList: searchForm.organIdList || null,
         search: searchForm.search || null,
         teacherIdList: searchForm.teacherIdList || null,
+        isCallNames: searchForm.isCallNames,
         schoolId: searchForm.schoolId || null
       };
       superFindCourseSchedules(obj).then(res => {