Browse Source

课表列表需求修改与搜索修改

wolyshaw 4 năm trước cách đây
mục cha
commit
f559292ab8

+ 11 - 0
src/constant/index.js

@@ -139,3 +139,14 @@ export const songUseType = {
   PERSON: '个人',
   COMMON: '公用',
 }
+
+export const jobNature = {
+  PART_TIME: "兼职",
+  FULL_TIME: "全职",
+  TEMPORARY: "临时工"
+}
+
+export const workType = {
+  TEACHING: "助教",
+  BISHOP: "主教"
+}

+ 9 - 0
src/main.js

@@ -98,6 +98,15 @@ Vue.use(ElementUI, { locale })
 
 Vue.config.productionTip = false
 
+// 将selects全局混入当前vue实例中
+Vue.mixin({
+  computed: {
+    selects() {
+      return store.state.selects
+    }
+  },
+})
+
 new Vue({
   el: '#app',
   router,

+ 2 - 1
src/router/notKeepAliveList.js

@@ -1,6 +1,7 @@
 export default [
   '/setSilder/save-form',
   '/contentManager/accompaniment',
-  '/orderList/orderAudit'
+  '/orderList/orderAudit',
+  '/business/teamCourseList',
   // '/operateManager/HumanResources'
 ]

+ 3 - 3
src/utils/index.js

@@ -152,11 +152,11 @@ export const objectToOptions = data => {
   return options
 }
 
-export const getTimes = (times, keys = []) => {
+export const getTimes = (times, keys = [], format = 'YYYY-MM-DD') => {
   if (times && times.length) {
     return {
-      [keys[0] || 'start']: dayjs(times[0]).isValid() ? dayjs(times[0]).format('YYYY-MM-DD') : '',
-      [keys[1] || 'end']: dayjs(times[1]).isValid() ? dayjs(times[1]).format('YYYY-MM-DD') : '',
+      [keys[0] || 'start']: dayjs(times[0]).isValid() ? dayjs(times[0]).format(format) : '',
+      [keys[1] || 'end']: dayjs(times[1]).isValid() ? dayjs(times[1]).format(format) : '',
     }
   }
   return {}

+ 18 - 28
src/utils/vueFilter.js

@@ -1,8 +1,7 @@
 import Vue from 'vue'
 import dayjs from 'dayjs'
 import numeral from 'numeral'
-import { feeProject, feeType, saleType, payStatus, payOrderType, paymentPatternType, payUserType, userPaymentType, courseType, auditType, auditPaymentType, orderServerType, orderAuditType, songUseType } from '../constant'
-
+import * as constant from '../constant'
 // 合并数组
 Vue.filter('joinArray', (value, type) => {
   if (!type) {
@@ -171,13 +170,13 @@ Vue.filter('dateForMinFormat', (value) => {
   }
 })
 
-Vue.filter('paymentPatternTypeFormat', val => paymentPatternType[val])
+Vue.filter('paymentPatternTypeFormat', val => constant.paymentPatternType[val])
 // 支付用户类型
-Vue.filter('payUserTypeFormat', val => payUserType[val])
+Vue.filter('payUserTypeFormat', val => constant.payUserType[val])
 // 支付缴费方式
-Vue.filter('userPaymentTypeFormat', val => userPaymentType[val])
+Vue.filter('userPaymentTypeFormat', val => constant.userPaymentType[val])
 // 课程类型格式化
-Vue.filter('courseTypeFormat', val => courseType[val])
+Vue.filter('courseTypeFormat', val => constant.courseType[val])
 
 
 // 时间处理
@@ -211,12 +210,7 @@ Vue.filter('jobType', value => {
 
 // 工作类型
 Vue.filter('jobNature', (value) => {
-  let template = {
-    PART_TIME: "兼职",
-    FULL_TIME: "全职",
-    TEMPORARY: "临时工"
-  }
-  return template[value]
+  return constant.jobNature[value]
 })
 
 
@@ -241,11 +235,7 @@ Vue.filter('attendanceOutType', value => {
 
 // 上课类型
 Vue.filter('workType', value => {
-  let template = {
-    TEACHING: "助教",
-    BISHOP: "主教"
-  }
-  return template[value]
+  return constant.workType[value]
 })
 // 交易类型
 Vue.filter('orderType', value => {
@@ -302,7 +292,7 @@ Vue.filter('returnStatus', value => {
 
 // 缴费状态
 Vue.filter('payTypeStatus', val => {
-  return payStatus[val]
+  return constant.payStatus[val]
 })
 
 // 性别
@@ -628,19 +618,19 @@ Vue.filter('hrStatus', value => {
 // 费用类型
 
 Vue.filter('feeType', value => {
-  return feeType[value]
+  return constant.feeType[value]
 })
 
 // 费用项目
 
 Vue.filter('feeProject', value => {
-  return feeProject[value]
+  return constant.feeProject[value]
 })
 
 // 销售类型
 
 Vue.filter('saleType', value => {
-  return saleType[value]
+  return constant.saleType[value]
 })
 
 // 缴费状态
@@ -680,30 +670,30 @@ Vue.filter('receiveFormat', value => {
 // 缴费方式
 
 Vue.filter('payOrderType', value => {
-  return payOrderType[value]
+  return constant.payOrderType[value]
 })
 
 // 审核状态 auditType
 Vue.filter('auditType', value => {
-  return auditType[value]
+  return constant.auditType[value]
 })
 
 // 审核申请类型 auditPaymentType
 Vue.filter('auditPaymentType', value => {
-  return auditPaymentType[value]
+  return constant.auditPaymentType[value]
 })
 
 // 销售收入和服务收入
 Vue.filter('orderServer', value => {
-  return orderServerType[value]
+  return constant.orderServerType[value]
 })
 
 // 订单审核状态 orderAuditType
 Vue.filter('orderAuditType', value => {
-  orderAuditType[''] = '审核通过'
-  return orderAuditType[value]
+  constant.orderAuditType[''] = '审核通过'
+  return constant.orderAuditType[value]
 })
 
 Vue.filter('songUseTypeFormat', value => {
-  return songUseType[value]
+  return constant.songUseType[value]
 })

+ 0 - 3
src/views/accompaniment/index.vue

@@ -167,9 +167,6 @@ export default {
     }
   },
   computed: {
-    selects() {
-      return this.$store.state.selects
-    },
     title() {
       const t1 = this.detail ? '修改' : '添加'
       const t2 = this.type === 'COMMON' ? '公用' : '个人'

+ 0 - 5
src/views/accompaniment/modals/form.vue

@@ -67,11 +67,6 @@ export default {
       }
     }
   },
-  computed: {
-    selects() {
-      return this.$store.state.selects
-    }
-  },
   mounted() {
     this.$store.dispatch('setSubject')
     if (this.detail) {

+ 0 - 5
src/views/save-form-test/index.vue

@@ -136,11 +136,6 @@ export default {
       }],
     }
   },
-  computed: {
-    selects() {
-      return this.$store.state.selects
-    }
-  },
   mounted() {
     this.$store.dispatch('setBranchs')
     this.$store.dispatch('setSubject')

+ 97 - 125
src/views/teamDetail/teamCourseList.vue

@@ -5,14 +5,14 @@
     </h2>
     <div class="m-core">
       <!-- 搜索类型 -->
-      <el-form :inline="true"
+      <save-form :inline="true"
                class="searchForm"
-               v-model.trim="searchForm">
+               ref="searchForm"
+               :model.sync="searchForm">
         <el-form-item>
-          <el-input style="width: 240px"
-                    v-model.trim="searchForm.search"
+          <el-input v-model.trim="searchForm.search"
                     @keyup.enter.native="search"
-                    placeholder="课程组编号/课程编号/课程名称" />
+                    placeholder="课程(组)编号/课程名称" />
         </el-form-item>
         <el-form-item>
           <el-select v-model.trim="searchForm.schoolId"
@@ -42,7 +42,7 @@
                      filterable
                      clearable
                      placeholder="请选择分部">
-            <el-option v-for="(item,index) in organList"
+            <el-option v-for="(item,index) in selects.branchs"
                        :key="index"
                        :label="item.name"
                        :value="item.id"></el-option>
@@ -95,6 +95,14 @@
           </el-select>
         </el-form-item>
         <el-form-item>
+          <el-select v-model.trim="searchForm.teachType"
+                     clearable
+                     filterable
+                     placeholder="老师类型">
+            <el-option v-for="item in workTypeOptions" :key="item.label" :label="item.label" :value="item.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
           <el-select v-model.trim="searchForm.isCallNames"
                      clearable
                      filterable
@@ -107,7 +115,6 @@
         </el-form-item>
         <el-form-item>
           <el-date-picker v-model.trim="searchForm.timer"
-                          style="width:420px;"
                           type="daterange"
                           value-format="yyyy-MM-dd"
                           range-separator="至"
@@ -119,7 +126,6 @@
         </el-form-item>
         <el-form-item>
           <el-date-picker v-model.trim="searchForm.creatTimer"
-                          style="width:420px;"
                           type="daterange"
                           value-format="yyyy-MM-dd"
                           range-separator="至"
@@ -129,19 +135,27 @@
         firstDayOfWeek: 1
     }"></el-date-picker>
         </el-form-item>
-        <el-form-item>
-          <div class="searchBtn"
-               @click="search">搜索</div>
-        </el-form-item>
-        <el-form-item>
-          <div class="searchBtn exportBtn"
-               v-permission="'export/superFindCourseSchedules'"
-               @click="onCourseExport">导出课表</div>
-        </el-form-item>
-      </el-form>
+        <el-row type="flex" justify="space-around">
+          <el-col>
+            <el-button
+              @click="search"
+              type="primary"
+            >搜索</el-button>
+            <el-button
+              @click="reset"
+              type="danger"
+            >重置</el-button>
+            <el-button
+              v-permission="'export/superFindCourseSchedules'"
+              @click="onCourseExport"
+              type="primary"
+            >导出课表</el-button>
+          </el-col>
+        </el-row>
+      </save-form>
       <div class="btnWraps"></div>
       <!-- 列表 -->
-      <div class="tableWrap">
+      <div class="tableWrap" style="margin-top: 20px">
         <el-table :data="tableList"
                   :header-cell-style="{background:'#EDEEF0',color:'#444'}">
           <el-table-column align="center"
@@ -155,25 +169,10 @@
                            prop="id"
                            label="课程编号"></el-table-column>
           <el-table-column align="center"
-                           label="创建时间">
-            <template slot-scope="scope">
-              <div>{{scope.row.createTime | dayjsFormat}}</div>
-            </template>
-          </el-table-column>
-          <el-table-column align="center"
                            width="200px"
                            label="上课时间">
             <template slot-scope="scope">{{ scope.row.startClassTime ? scope.row.startClassTime.substr(0, 16) : '' }}-{{ scope.row.endClassTime ? scope.row.endClassTime.substr(11,5) : ''}}</template>
           </el-table-column>
-          <!-- <el-table-column align="center" prop="groupName" label="乐团/VIP名"></el-table-column> -->
-          <!-- <el-table-column align="center" prop="classGroupName" label="班级名称"></el-table-column> -->
-          <el-table-column align="center"
-                           prop="studentId"
-                           label="学生ID">
-            <template slot-scope="scope">
-              <div v-if="scope.row.groupType != 'MUSIC'">{{scope.row.studentId}}</div>
-            </template>
-          </el-table-column>
           <el-table-column align="center"
                            prop="subjectName"
                            label="声部"></el-table-column>
@@ -181,6 +180,7 @@
                            prop="name"
                            label="课程名称"></el-table-column>
           <el-table-column align="center"
+                           width="150px"
                            label="课程类型">
             <template slot-scope="scope">
               <div>{{ scope.row.type | coursesType}}</div>
@@ -226,28 +226,20 @@
             <template slot-scope="scope">{{ scope.row.isCallNames ? '是' : '否' }}</template>
           </el-table-column>
           <el-table-column align="center"
-                           width="150px"
-                           prop="teacherName"
-                           label="指导老师"
-                           fixed="right">
-            <template slot-scope="scope">
-              <div>
-                {{scope.row.teacherName}}({{scope.row.actualTeacherId}})
-              </div>
-            </template>
-          </el-table-column>
-          <el-table-column align="center"
                            label="详情"
                            fixed="right"
-                           width="180px">
+                           width="220px">
             <template slot-scope="scope">
               <div>
                 <el-button type="text"
                            v-if="permission('teamCourseList/details')"
                            @click="lookDetail(scope.row)">详情</el-button>
                 <el-button type="text"
-                           v-if="permission('courseSchedule/classStartDateAdjust?hight')"
+                           v-if="permission('courseSchedule/classStartDateAdjust?hight') && (!scope.row.isLock || scope.row.newCourseId > 0)"
                            @click="resetClass(scope.row)">调整</el-button>
+                <el-button type="text" @click="common(scope.row)" v-if="scope.row.newCourseId > 0">
+                  合并课
+                </el-button>
                 <el-button type="text"
                            @click="addCompound(scope.row)"
                            v-if="(scope.row.groupType=='MUSIC'&&scope.row.type!='MUSIC_NETWORK'&&scope.row.type!='HIGH_ONLINE'&&scope.row.status=='NOT_START'&&!isAddCom(scope.row))">添加合班</el-button>
@@ -411,6 +403,8 @@ import {
   getEmployeeOrgan,
   cleanAttendance
 } from "@/api/buildTeam";
+import { workType } from '@/constant'
+import { objectToOptions, getTimes } from '@/utils'
 import { getTeacherPersonalAttendanceDetail } from "@/api/teacherManager";
 import { getSchool } from "@/api/systemManage";
 import { courseType, courseListType } from "@/utils/searchArray";
@@ -433,6 +427,21 @@ nowTime =
   (nowTime.getMonth() + 1) +
   "-" +
   nowTime.getDate();
+
+const initSearch = {
+  teachMode: null, // 教学模式
+  organIdList: null,
+  courseStatus: null,
+  courseType: null,
+  timer: [nowTime, nowTime], // 时间
+  class: null,
+  teachType: null,
+  isCallNames: null, // 是否点名
+  search: null, // 乐团名称 编号 vip课名称
+  teacherIdList: null, // 老师编号
+  schoolId: null, // 教学点编号
+  creatTimer: []
+}
 export default {
   data () {
     return {
@@ -441,19 +450,7 @@ export default {
       courseVisible: false,
       courseType: courseType,
       courseListType: courseListType,
-      searchForm: {
-        teachMode: null, // 教学模式
-        organIdList: null,
-        courseStatus: null,
-        courseType: null,
-        timer: [nowTime, nowTime], // 时间
-        class: null,
-        isCallNames: null, // 是否点名
-        search: null, // 乐团名称 编号 vip课名称
-        teacherIdList: null, // 老师编号
-        schoolId: null, // 教学点编号
-        creatTimer: []
-      },
+      searchForm: {...initSearch},
       tableList: [],
       searchLsit: [],
       organList: [],
@@ -487,7 +484,13 @@ export default {
   activated () {
     this.init();
   },
+  computed: {
+    workTypeOptions() {
+      return objectToOptions(workType)
+    }
+  },
   mounted () {
+    this.$store.dispatch('setBranchs')
     this.init();
   },
   methods: {
@@ -507,25 +510,38 @@ export default {
         }
       });
 
-      getEmployeeOrgan().then(res => {
-        if (res.code == 200) {
-          this.organList = res.data;
-        }
-      });
+      // getEmployeeOrgan().then(res => {
+      //   if (res.code == 200) {
+      //     this.organList = res.data;
+      //   }
+      // });
     },
     permission (str, parent) {
       return permission(str, parent);
     },
-
+    reset() {
+      this.searchForm = {...initSearch}
+      this.search()
+    },
     search () {
       this.rules.page = 1;
+      this.$refs.searchForm.save(this.searchForm)
       this.getList();
     },
-    onCourseExport () {
-      // 课表导出
+    common(row) {
+      this.searchForm = {
+        ...initSearch,
+        timer: [],
+        search: row.newCourseId,
+      }
+      this.search()
+    },
+    getSearchForm() {
       let searchForm = this.searchForm;
       if (!searchForm.timer || searchForm.timer.length <= 0) {
         searchForm.timer = [];
+        // this.$message.error("请选择时间段");
+        // return;
       }
       if (!searchForm.creatTimer || searchForm.creatTimer.length <= 0) {
         searchForm.creatTimer = []
@@ -542,29 +558,24 @@ export default {
         this.$message.error('请至少选择一个搜索条件')
         return
       }
-      let obj = {
-        teachMode: searchForm.teachMode || null,
-        courseStatus: searchForm.courseStatus || null,
-        courseType: searchForm.courseType || null,
-        startTime: searchForm.timer[0] || null,
-        endTime: searchForm.timer[1] || null,
-        classGroupId: searchForm.class || null,
-        organIdList: searchForm.organIdList || null,
-        search: searchForm.search || null,
-        teacherIdList: searchForm.teacherIdList || null,
-        isCallNames: searchForm.isCallNames,
-        schoolId: searchForm.schoolId || null,
-        groupType: searchForm.groupType || null,
-        createStartDate: searchForm.creatTimer[0] || null,
-        createEndDate: searchForm.creatTimer[1] || null
-      };
+      const { creatTimer, timer, ...rest } = searchForm
+      return {
+        ...rest,
+        page: this.rules.page,
+        rows: this.rules.limit,
+        ...getTimes(creatTimer, ['createStartDate', 'createEndDate']),
+        ...getTimes(timer, ['startTime', 'endTime']),
+      }
+    },
+    onCourseExport () {
+      // 课表导出
       let url = "/api-web/export/superFindCourseSchedules";
       const options = {
         method: "get",
         headers: {
           Authorization: getToken()
         },
-        params: obj,
+        params: this.getSearchForm(),
         url,
         responseType: "blob"
       };
@@ -608,46 +619,7 @@ export default {
         .catch(() => { });
     },
     getList () {
-      let searchForm = this.searchForm;
-      if (!searchForm.timer || searchForm.timer.length <= 0) {
-        searchForm.timer = [];
-        // this.$message.error("请选择时间段");
-        // return;
-      }
-      if (!searchForm.creatTimer || searchForm.creatTimer.length <= 0) {
-        searchForm.creatTimer = []
-      }
-      let count = 0
-      for (let item in searchForm) {
-        if (searchForm[item] && !Array.isArray(searchForm[item])) {
-          count++
-        } else if (Array.isArray(searchForm[item]) && searchForm[item].length > 0) {
-          count++
-        }
-      }
-      if (count <= 0) {
-        this.$message.error('请至少选择一个搜索条件')
-        return
-      }
-      let obj = {
-        teachMode: searchForm.teachMode || null,
-        courseStatus: searchForm.courseStatus || null,
-        courseType: searchForm.courseType || null,
-        startTime: searchForm.timer[0] || null,
-        endTime: searchForm.timer[1] || null,
-        page: this.rules.page,
-        rows: this.rules.limit,
-        classGroupId: searchForm.class || null,
-        organIdList: searchForm.organIdList || null,
-        search: searchForm.search || null,
-        teacherIdList: searchForm.teacherIdList || null,
-        isCallNames: searchForm.isCallNames,
-        schoolId: searchForm.schoolId || null,
-        groupType: searchForm.groupType || null,
-        createStartDate: searchForm.creatTimer[0] ? searchForm.creatTimer[0] : null,
-        createEndDate: searchForm.creatTimer[1] ? searchForm.creatTimer[1] : null
-      };
-      superFindCourseSchedules(obj).then(res => {
+      superFindCourseSchedules(this.getSearchForm()).then(res => {
         if (res.code == 200) {
           this.tableList = res.data.rows;
           this.rules.total = res.data.total;