浏览代码

04/03 20:51

11
Xiao_Mo 5 年之前
父节点
当前提交
d0b8b6e21c

+ 36 - 0
src/api/teacherManager.js

@@ -196,4 +196,40 @@ export function PracticeGroupSalaryUpdate (data) {
     method: 'post',
      data
   })
+}
+
+// 获取老师时间列表
+export function queryTenantAccountList (data) {
+  return request({
+    url: api + '/sysTenantAccount/queryTenantAccountDetail',
+    method: 'get',
+    params: data
+  })
+}
+
+// 增加老师时间
+export function sysTenantAccountAddMinutes (data) {
+  return request({
+    url: api + '/sysTenantAccount/addMinutes',
+    method: 'post',
+    data:qs.stringify(data)
+  })
+}
+
+// 减少老师时间
+export function sysTenantAccountSubtractMinutes (data) {
+  return request({
+    url: api + '/sysTenantAccount/subtractMinutes',
+    method: 'post',
+    data:qs.stringify(data)
+  })
+}
+
+// 获取可用时间
+export function queryTenantAcGet (data) {
+  return request({
+    url: api + '/sysTenantAccount/get',
+    method: 'get',
+    params: data
+  })
 }

+ 11 - 1
src/utils/searchArray.js

@@ -94,6 +94,15 @@ const courseStatus = [
   { value: "OVER", label: "已结束" },
 ]
 
+// 老师时间充值状态
+const teacherTimeStatus = [
+  { value: "RECHARGE", label: "充值" },
+  { value: "CONSUME", label: "消费" },
+  { value: "RETURN", label: "退还" },
+  { value: "MANUAL_ADD", label: "系统充值" },
+  { value: "MANUAL_SUB", label: "系统扣减" },
+]
+
 export {
   courseType,
   attendance,
@@ -104,5 +113,6 @@ export {
   dealStatus,
   musicGroupStatus,
   vipGroupStatus,
-  courseStatus
+  courseStatus,
+  teacherTimeStatus
 }

+ 12 - 0
src/utils/vueFilter.js

@@ -412,4 +412,16 @@ Vue.filter('firstOrRenewFilter', value => {
     '1': "首次",
   }
   return template[value]
+})
+
+// 老师时间
+Vue.filter('transTypeFilter', value => {
+  let template = {
+    'RECHARGE': "充值",
+    'CONSUME': "消费",
+    'RETURN': "退还",
+    'MANUAL_ADD': "系统充值",
+    'MANUAL_SUB': "系统扣减",
+  }
+  return template[value]
 })

+ 231 - 0
src/views/teacherManager/teacherDetail/components/timerList.vue

@@ -0,0 +1,231 @@
+<!--  -->
+<template>
+  <div class="m-core">
+    <div class="wrap">
+      <div class="newBand" v-permission="'sysTenantAccount/addMinutes'" style="margin-right:20px" @click="addTimer">系统充值</div>
+      <div class="newBand" v-permission="'sysTenantAccount/subtractMinutes'" @click="subTimer">系统扣除</div>
+    </div>
+    <el-form :inline="true" class="searchForm" v-model.trim="searchForm">
+      <el-form-item>
+        <el-select clearable placeholder="操作类型" v-model="searchForm.transType">
+          <el-option :label="item.label" :value="item.value" v-for="(item,index) in teacherTimeStatus" :key="index"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-date-picker
+          style="width: 400px;"
+          v-model.trim="searchForm.courseDate"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="search" type="danger">搜索</el-button>
+        <el-button @click="onReSet" type="primary">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <div
+      style="font-size: 14px; color: #F85043; padding-bottom: 10px;"
+    >可用时间:{{ totalTransMinutes }}分钟 &nbsp;&nbsp;&nbsp;&nbsp;</div>
+    <div class="tableWrap">
+      <el-table :data="tableList" :header-cell-style="{background:'#EDEEF0',color:'#444'}">
+        <el-table-column align="center" prop="updateTime" label="操作时间"></el-table-column>
+        <el-table-column align="center"  label="操作类型">
+            <template slot-scope="scope">
+                <div>
+                    {{scope.row.transType | transTypeFilter}}
+                </div>
+            </template>
+        </el-table-column>
+        <el-table-column align="center" prop="operatorId" label="操作人"></el-table-column>
+        <el-table-column align="center" prop="transMinutes" label="时间变动/分钟"></el-table-column>
+        <el-table-column align="center" prop="totalAvailableMinutes" label="剩余时间/分钟"></el-table-column>
+        <el-table-column align="center" prop="memo" label="备注"></el-table-column>
+      </el-table>
+      <pagination
+        :total="pageInfo.total"
+        :page.sync="pageInfo.page"
+        :limit.sync="pageInfo.limit"
+        :page-sizes="pageInfo.page_size"
+        @pagination="getList"
+      />
+    </div>
+    <el-dialog :title="maskTitle" width="440px" :visible.sync="timerVisible">
+      <el-form :model="timerForm" ref="timerForm">
+        <el-form-item label="本次充值" prop="minutes" :rules="[{ required: true, message: '请输入充值时间' }]">
+          <el-row>
+            <el-col :span="28">
+              <el-input type="number" @mousewheel.native.prevent v-model.trim="timerForm.minutes">
+                <template slot="append">分钟</template>
+              </el-input>
+            </el-col>
+          </el-row>
+        </el-form-item>
+        <el-form-item label="操作备注" prop="memo" :rules="[{ required: true, message: '请输入备注' }]">
+          <el-row>
+            <el-col :span="28">
+              <el-input type="textarea" :rows="3" v-model.trim="timerForm.memo"></el-input>
+            </el-col>
+          </el-row>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="timerVisible = false">取 消</el-button>
+        <el-button type="primary" @click="addTimerSub(isAdd)">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {teacherTimeStatus} from '@/utils/searchArray'
+import pagination from "@/components/Pagination/index";
+import {
+  queryTenantAccountList,
+  sysTenantAccountAddMinutes,
+  sysTenantAccountSubtractMinutes,
+  queryTenantAcGet
+} from "@/api/teacherManager";
+export default {
+  components: { pagination },
+  data() {
+    return {
+      teacherId: null,
+      teacherTimeStatus,
+      searchForm: {
+        courseDate: [],
+        transType: null
+      },
+      maskTitle: "",
+      isAdd: false,
+      totalTransMinutes: 0,
+      tableList: [],
+      timerVisible: false,
+      timerForm: {
+        minutes: null,
+        memo: null
+      },
+      pageInfo: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 1, // 总条数
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
+      }
+    };
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    this.init();
+  },
+  activated() {
+    this.init();
+  },
+  methods: {
+    init() {
+      this.teacherId = this.$route.query.teacherId;
+      queryTenantAcGet({teacherId:this.teacherId}).then(res=>{
+          if(res.code == 200){
+              if(res.data){
+                  this.totalTransMinutes = res.data.availableMinutes
+              }
+          }
+      })
+      this.getList();
+    },
+    search() {
+      this.pageInfo.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      (this.searchForm = {
+        courseDate: [],
+        transType: null
+      }),
+        this.search();
+    },
+    getList() {
+      let obj = {};
+      if (this.searchForm.courseDate && this.searchForm.courseDate.length > 0) {
+        obj.startTime = this.searchForm.courseDate[0];
+        obj.endTime = this.searchForm.courseDate[1];
+      }
+      this.searchForm.transType
+        ? (obj.transType = this.searchForm.transType)
+        : null;
+        obj.userId = this.teacherId;
+      queryTenantAccountList(obj).then(res => {
+        if (res.code == 200) {
+          this.tableList = res.data.rows;
+          this.pageInfo.total = res.data.total;
+        }
+      });
+    },
+    addTimer() {
+      this.isAdd = true;
+      this.maskTitle = "充值时间";
+      this.timerVisible = true;
+    },
+    subTimer() {
+      this.isAdd = false;
+      this.maskTitle = "扣除时间";
+      this.timerVisible = true;
+    },
+    addTimerSub(flag) {
+      // true 加时间  false 减时间
+      this.$refs["timerForm"].validate(res => {
+        if (res) {
+          let obj = {
+            teacherId: this.teacherId,
+            minutes: this.timerForm.minutes,
+            memo: this.timerForm.memo
+          };
+          if (flag) {
+            sysTenantAccountAddMinutes(obj).then(res => {
+              if (res.code == 200) {
+                this.$message.success("添加成功");
+                this.timerVisible = false;
+                this.getList();
+              }
+            });
+          } else {
+            sysTenantAccountSubtractMinutes(obj).then(res => {
+              if (res.code == 200) {
+                this.$message.success("添加成功");
+                this.timerVisible = false;
+                this.getList();
+              }
+            });
+          }
+        }
+      });
+    }
+  },
+  watch: {
+    timerVisible(val) {
+      if (!val) {
+        this.timerForm = {
+          minutes: null,
+          memo: null
+        };
+        this.$refs["timerForm"].resetFields();
+      }
+    }
+  }
+};
+</script>
+<style lang='scss' scoped>
+.wrap {
+  display: flex;
+  flex-direction: row;
+  justify-content: flex-start;
+}
+/deep/.el-textarea__inner {
+  width: 254px;
+}
+</style>

+ 9 - 2
src/views/teacherManager/teacherDetail/index.vue

@@ -44,6 +44,11 @@
                      name="6">
           <settlement v-if="activeName == 6" />
         </el-tab-pane>
+          <el-tab-pane label="时间记录"
+                     v-if="permissionList.timerList"
+                     name="7">
+          <timerList v-if="activeName == 7" />
+        </el-tab-pane>
       </el-tabs>
     </div>
   </div>
@@ -56,11 +61,12 @@ import courseInfo from '@/views/teacherManager/teacherDetail/components/courseIn
 import courseInfo1 from '@/views/teacherManager/teacherDetail/components/courseInfo1'
 import courseInfo2 from '@/views/teacherManager/teacherDetail/components/courseInfo2'
 import settlement from '@/views/teacherManager/teacherDetail/components/settlement'
+import timerList from '@/views/teacherManager/teacherDetail/components/timerList'
 import { permission } from '@/utils/directivePage'
 export default {
   components: {    teacherRecord,
     leaveRecord, teacherInfo,
-    courseInfo, courseInfo1, courseInfo2, settlement  },
+    courseInfo, courseInfo1, courseInfo2, settlement,timerList  },
   name: 'teacherDetail',
   data () {
     return {
@@ -74,7 +80,8 @@ export default {
         domeCourse: permission('/teacherDetail/domeCourse'),
         teacherRecord: permission('/teacherDetail/teacherRecord'),
         leaveRecord: permission('/teacherDetail/leaveRecord'),
-        settlement: permission('/teacherDetail/settlement')
+        settlement: permission('/teacherDetail/settlement'),
+        timerList: permission('/teacherDetail/timerList')
       },
       Fsearch: null,
       Frules: null

+ 86 - 89
src/views/teamDetail/componentCourse/studentWork.vue

@@ -3,105 +3,93 @@
     <el-form :inline="true">
       <el-form-item label="应交学生数">
         <!-- <el-input disabled
-                  :value="studentNum"></el-input> -->
-        <div class="inputStyle">{{  studentNum}}</div>
+        :value="studentNum"></el-input>-->
+        <div class="inputStyle">{{ studentNum}}</div>
       </el-form-item>
       <el-form-item label="已交学生数">
         <!-- <el-input disabled
-                  :value="homeworkNum"></el-input> -->
+        :value="homeworkNum"></el-input>-->
         <div class="inputStyle">{{ homeworkNum}}</div>
       </el-form-item>
       <el-form-item label="已回复数">
         <!-- <el-input disabled
-                  :value="repliedNum"></el-input> -->
+        :value="repliedNum"></el-input>-->
         <div class="inputStyle">{{ repliedNum}}</div>
       </el-form-item>
     </el-form>
     <p class="work">老师布置的作业:{{content}}</p>
     <div class="tableWrap">
-      <el-table :data='tableList'
-                :header-cell-style="{background:'#EDEEF0',color:'#444'}">
-        <el-table-column align='center'
-                         prop="username"
-                         label="学生姓名">
-        </el-table-column>
-        <el-table-column align='center'
-                         prop="phone"
-                         label="手机号">
-        </el-table-column>
-        <el-table-column align='center'
-                         prop="subjectName"
-                         label="声部名称">
-        </el-table-column>
-        <el-table-column align='center'
-                         prop="createTime"
-                         label="交作业时间">
-        </el-table-column>
-        <el-table-column align='center'
-                         prop="isView"
-                         label="是否查看">
+      <el-table :data="tableList" :header-cell-style="{background:'#EDEEF0',color:'#444'}">
+        <el-table-column align="center" prop="username" label="学生姓名"></el-table-column>
+        <el-table-column align="center" prop="phone" label="手机号"></el-table-column>
+        <el-table-column align="center" prop="subjectName" label="声部名称"></el-table-column>
+        <el-table-column align="center" prop="createTime" label="交作业时间"></el-table-column>
+        <el-table-column align="center" prop="isView" label="是否查看">
           <template slot-scope="scope">
-            <div>
-              {{ scope.row.isView ? '是' : '否' }}
-            </div>
+            <div>{{ scope.row.isView ? '是' : '否' }}</div>
           </template>
         </el-table-column>
-        <el-table-column align='center'
-                         prop="isReplied"
-                         label="是否回复">
+        <el-table-column align="center" prop="isReplied" label="是否回复">
           <template slot-scope="scope">
-            <div>
-              {{ scope.row.isReplied ? '是' : '否' }}
-            </div>
+            <div>{{ scope.row.isReplied ? '是' : '否' }}</div>
           </template>
         </el-table-column>
-        <el-table-column align='center'
-                         label="操作">
+        <el-table-column align="center" label="查看作业" width="200px">
           <template slot-scope="scope">
             <div>
               <!--   -->
-              <el-button type="text"
-                         v-if="scope.row.url"
-                         @click="lookWork(scope.row.url)">查看</el-button>
+              <el-button
+                type="text"
+                v-for="(item,index) in scope.row.urlList"
+                :key="index"
+                @click="lookWork(item)"
+              >{{'作业'+(index+1) }}</el-button>
             </div>
           </template>
-
         </el-table-column>
       </el-table>
-      <pagination :total="rules.total"
-                  :page.sync="rules.page"
-                  :limit.sync="rules.limit"
-                  @pagination="getList" />
+      <pagination
+        :total="rules.total"
+        :page.sync="rules.page"
+        :limit.sync="rules.limit"
+        @pagination="getList"
+      />
     </div>
-    <el-dialog title="查看作业"
-               @close="closeWorkVisible"
-               width="680px"
-               append-to-body
-               :visible.sync="workVisible">
+    <el-dialog
+      title="查看作业"
+      @close="closeWorkVisible"
+      width="680px"
+      append-to-body
+      :visible.sync="workVisible"
+    >
       <!-- activeUrl -->
-      <video style="width:640px;"
-             :src='activeUrl'
-             ref="dialogVideo"
-             controls="controls">
-        您的浏览器不支持视频播放
-      </video>
+      <video
+        style="width:640px;"
+        :src="activeUrl"
+        ref="dialogVideo"
+        controls="controls"
+      >您的浏览器不支持视频播放</video>
     </el-dialog>
   </div>
 </template>
 <script>
-import pagination from '@/components/Pagination/index'
-import { findStudentCourseHomeworks, sumStudentAttendance, getCourseScheduleHomework } from '@/api/buildTeam'
+import pagination from "@/components/Pagination/index";
+import {
+  findStudentCourseHomeworks,
+  sumStudentAttendance,
+  getCourseScheduleHomework
+} from "@/api/buildTeam";
 export default {
-  props: ['courseScheduleId'],
+  props: ["courseScheduleId"],
   components: { pagination },
-  data () {
+  data() {
     return {
       tableList: [],
       rules: {
         // 分页规则
         limit: 10, // 限制显示条数
         page: 1, // 当前页
-        total: 0, // 总条数
+        total: 0 // 总条数
       },
       workVisible: false,
       studentNum: null,
@@ -109,53 +97,62 @@ export default {
       repliedNum: null,
       activeUrl: null,
       content: null
-    }
+    };
   },
-  mounted () {
-    this.init()
+  mounted() {
+    this.init();
   },
-  activated () {
-    this.init()
+  activated() {
+    this.init();
   },
   methods: {
-    init () {
-      sumStudentAttendance({ courseScheduleId: this.courseScheduleId }).then(res => {
-        if (res.code == 200) {
-          this.studentNum = res.data.studentNum;
-          this.homeworkNum = res.data.homeworkNum;
-          this.repliedNum = res.data.repliedNum
+    init() {
+      sumStudentAttendance({ courseScheduleId: this.courseScheduleId }).then(
+        res => {
+          if (res.code == 200) {
+            this.studentNum = res.data.studentNum;
+            this.homeworkNum = res.data.homeworkNum;
+            this.repliedNum = res.data.repliedNum;
+          }
         }
-      })
-      //this.courseScheduleId 
-      // 
+      );
+      //this.courseScheduleId
+      //
 
-      getCourseScheduleHomework({ courseScheduleId: this.courseScheduleId }).then(res => {
+      getCourseScheduleHomework({
+        courseScheduleId: this.courseScheduleId
+      }).then(res => {
         if (res.code == 200) {
           if (res.data) {
-            this.content = res.data.content
+            this.content = res.data.content;
           }
-          this.content ? this.content : this.content = '还未布置作业'
+          this.content ? this.content : (this.content = "还未布置作业");
         }
-      })
-      this.getList()
+      });
+      this.getList();
     },
-    getList () {
-      findStudentCourseHomeworks({ search: this.courseScheduleId }).then(res => {
-        if (res.code == 200) {
-          this.rules.total = res.data.total
-          this.tableList = res.data.rows
+    getList() {
+      findStudentCourseHomeworks({ search: this.courseScheduleId }).then(
+        res => {
+          if (res.code == 200) {
+            this.rules.total = res.data.total;
+            this.tableList = res.data.rows.map(item => {
+              item.urlList = item.url ? item.url.split(",") : [];
+              return item;
+            });
+          }
         }
-      })
+      );
     },
-    lookWork (url) {
+    lookWork(url) {
       this.workVisible = true;
       this.activeUrl = url;
     },
-    closeWorkVisible () {
-      this.activeUrl = '';
+    closeWorkVisible() {
+      this.activeUrl = "";
     }
   }
-}
+};
 </script>
 <style lang="scss" scoped>
 .inputStyle {