Explorar o código

03/03 18:51

111
261568008@qq.com %!s(int64=5) %!d(string=hai) anos
pai
achega
867f4a0c2a

+ 3 - 0
src/layout/components/Navbar.vue

@@ -144,7 +144,10 @@ export default {
     },
     async logout () {
       await this.$store.dispatch("user/logout");
+      // await this.$store.dispatch("permission/removePermission")
       this.$router.push(`/login`);
+      window.location.reload()
+  
     },
     gotoRecode () {
       this.$router.push('/journal/journal')

+ 7 - 1
src/store/modules/permission.js

@@ -42,6 +42,7 @@ const mutations = {
     state.routes = constantRoutes.concat(routes)
   },
   SET_PERMISSION: (state, permission) => {
+
     state.permission = permission
   }
 }
@@ -109,7 +110,7 @@ const actions = {
         if (res.code == 200) {
           let newData = recursionRouter(res.data);
           recursionPerission(res.data)
-          var accessedRoutes
+          let accessedRoutes
           // 生成异步路由表
           accessedRoutes = generateAsyncRouter(asyncRoutes, newData)
           // var result = accessedRoutes.concat({ path: '*', redirect: '/404', hidden: true })
@@ -121,6 +122,11 @@ const actions = {
         }
       })
     })
+  },
+  removePermission({ commit }){
+    window.localStorage.removeItem('permission')
+    commit('SET_PERMISSION', [])
+    
   }
 }
 

+ 1 - 1
src/store/modules/user.js

@@ -85,7 +85,7 @@ const actions = {
 
   // 登出
   logout ({ commit }) {
-    return new Promise((resolve, reject) => {
+    return new Promise((resolve, reject) => { 
       logout().then(() => {
         commit('SET_TOKEN', '')
         removeToken()

+ 0 - 1
src/views/accompanyManager/accompanyList.vue

@@ -217,7 +217,6 @@ export default {
         })
       },
       lookCrouse(row){
-        console.log(row)
          let rules = JSON.stringify(this.rules);
       let searchForm = JSON.stringify(this.searchForm);
         this.$router.push({path:'/business/accompanys',query:{id:row.id, rules, searchForm}})

+ 211 - 24
src/views/accompanyManager/accompanys.vue

@@ -10,12 +10,17 @@
         @click="resetTeachers"
         v-permission="'courseSchedule/practiceGroupTeacherAdjust'"
       >修改老师</div>
-      <!-- <div class="newBand" @click="adjustment">批量调整</div> -->
+      <!-- // accompanys/addCourse -->
+      <!-- <div v-permission="'accompanys/addCourse'" class="newBand" @click="addCourse">网管课加课</div> -->
+      <div class="newBand" v-permission="'accompanys/vipCourseAdjust'" @click="adjustment">批量调整</div>
     </div>
 
     <div class="tableWrap">
-      <el-table :data="tableList" :header-cell-style="{background:'#EDEEF0',color:'#444'}">
-        <!-- @selection-change="handleSelectionChange" -->
+      <el-table
+        :data="tableList"
+        :header-cell-style="{background:'#EDEEF0',color:'#444'}"
+        @selection-change="handleSelectionChange"
+      >
         <el-table-column type="selection" :selectable="isDisabled" width="55"></el-table-column>
         <el-table-column label="课程编号" align="center" prop="id"></el-table-column>
         <el-table-column label="课程名称" align="center" prop="name"></el-table-column>
@@ -36,7 +41,7 @@
             <div>{{ scope.row.classDate | formatTimer}}</div>
           </template>
         </el-table-column>
-             <el-table-column label="是否点名" align="center" prop="status">
+        <el-table-column label="是否点名" align="center" prop="status">
           <template slot-scope="scope">{{ scope.row.isCallNames ? '是' : '否' }}</template>
         </el-table-column>
         <el-table-column label="课程状态" align="center" prop="status">
@@ -56,7 +61,7 @@
             <div>{{scope.row.schoolName?scope.row.schoolName:'网络教室'}}</div>
           </template>
         </el-table-column>-->
-        <el-table-column label="操作" width="180px">
+        <el-table-column label="操作" width="250px" align="center" fixed="right">
           <template slot-scope="scope">
             <div>
               <el-button
@@ -65,13 +70,24 @@
                 v-if="scope.row.status == 'NOT_START'"
                 @click="resetClass(scope.row)"
               >调整</el-button>
-              <!--  v-permission="'courseSchedule/classStartDateAdjust'" -->
+              <el-button
+                type="text"
+                v-permission="'accompanys/remove'"
+                v-if="!scope.row.isSettlement"
+                @click="removeClass(scope.row)"
+              >删除</el-button>
               <el-button
                 v-permission="'courseSchedule/practiceCourseTeacherAdjust'"
                 type="text"
                 v-if="scope.row.status == 'NOT_START'"
                 @click="resetTeacher(scope.row)"
               >更换老师</el-button>
+              <el-button
+                type="text"
+                v-permission="'accompanys/cleanAttendance'"
+                v-if="!scope.row.isSettlement"
+                @click="clearAttend(scope.row)"
+              >清除考勤</el-button>
             </div>
           </template>
         </el-table-column>
@@ -180,7 +196,7 @@
         <el-button type="primary" @click="subresetTeacher">确 定</el-button>
       </div>
     </el-dialog>
-     <!-- <el-dialog title="批量调整" width="800px" :visible.sync="adjustmentVisible">
+    <el-dialog :title="adjustmentName" width="800px" :visible.sync="adjustmentVisible">
       <el-form
         :model="adjustmentForm"
         label-position="right"
@@ -199,7 +215,6 @@
         <el-form-item label="单课费用" prop="fee" v-if="isaddCourse">
           <el-input v-model.trim="adjustmentForm.fee"></el-input>
         </el-form-item>
-        <br />
         <el-form-item label="排课起始时间" prop="courseTime">
           <el-date-picker
             v-model.trim="adjustmentForm.courseTime"
@@ -259,7 +274,7 @@
         <el-button type="primary" v-if="!isaddCourse" @click="submitAdjustment">确 定</el-button>
         <el-button type="primary" v-if="isaddCourse" @click="addCourseSubmit">确 定</el-button>
       </div>
-    </el-dialog> -->
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -270,15 +285,23 @@ import {
   getTeacher,
   practiceGroupManage,
   practiceGroupTeacherAdjust,
-  practiceCourseTeacherAdjust
+  practiceCourseTeacherAdjust,
+  cleanAttendance
 } from "@/api/buildTeam";
+import {
+  vipCourseAdjust,
+  batchAppendVipGroupCourses,
+  bathDelete
+} from "@/api/vipSeting";
 export default {
   components: {
     pagination
   },
   data() {
     return {
-      adjustmentVisible:false,
+      adjustmentName: "",
+      isaddCourse: false,
+      adjustmentVisible: false,
       isMultiple: true,
       name: "网管课程组",
       courseVisible: false,
@@ -303,6 +326,14 @@ export default {
         startTime: "",
         id: ""
       },
+      adjustmentForm: {
+        count: "",
+        courseTime: "",
+        checked: false,
+        addCount: "",
+        courseType: "",
+        fee: ""
+      },
       startTime: null,
       maskRules: {
         date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
@@ -318,7 +349,36 @@ export default {
         teacher: null
       },
       courseOption: null,
-      coursesExpireDate: null
+      coursesExpireDate: null,
+      adjustmentRules: {
+        courseTime: [{ required: true, message: "请选择开始时间" }],
+        addCount: [{ required: true, message: "请输入加课次数" }],
+        courseType: [{ required: true, message: "请选择课程类型" }],
+        fee: [{ required: true, message: "请输入费用" }]
+      },
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() + 86400000 <= new Date().getTime();
+        }
+      },
+      weekList: [
+        {
+          dayOfWeek: "",
+          startTime: "",
+          endTime: "",
+          moid: new Date().getTime()
+        }
+      ],
+      weekDateList: [
+        { value: "1", label: "星期一" },
+        { value: "2", label: "星期二" },
+        { value: "3", label: "星期三" },
+        { value: "4", label: "星期四" },
+        { value: "5", label: "星期五" },
+        { value: "6", label: "星期六" },
+        { value: "7", label: "星期日" }
+      ],
+      activeList: []
     };
   },
   created() {
@@ -430,7 +490,6 @@ export default {
       this.isMultiple = false;
       this.activeRow = row;
       this.teacherForm.teacher = row.actualTeacherId;
-      console.log(row.actualTeacherId);
       this.teacherVisible = true;
     },
     resetTeachers() {
@@ -499,31 +558,159 @@ export default {
       };
     },
     // 是否允许批量调整
-     isDisabled(row, index) {
-       // || !row.isCallNames
-      if (row.isSettlement ) {
+    isDisabled(row, index) {
+      // || !row.isCallNames
+      if (row.isSettlement) {
         return false;
       } else {
         return true;
       }
     },
-    adjustment(){
+    adjustment() {
+      this.adjustmentName = "批量调整";
+      this.isaddCourse = false;
       if (this.adjustmentForm.count <= 0) {
         this.$message.error("请至少勾选一节课");
       } else {
         this.adjustmentVisible = true;
       }
+    },
+    addWeek() {
+      // 添加循环周期
+      this.weekList.push({
+        dayOfWeek: "",
+        startClassTime: "",
+        endClassTime: "",
+        id: new Date()
+      });
+    },
+    // 删除循环周
+    removeWeek(item) {
+      for (let i in this.weekList) {
+        if (this.weekList[i].id == item.id) {
+          this.weekList.splice(i, 1);
+        }
+      }
+    },
+    submitAdjustment() {
+      this.$refs["adjustmentForm"].validate(item => {
+        if (item) {
+          let week = this.weekList;
+          if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
+            this.$message.error("至少排一节课");
+            return;
+          }
+          // 开始
+          let obj = {};
+          obj.courseCreateStartTime = this.adjustmentForm.courseTime;
+          let idArr = this.activeList.map(item => {
+            return item.id;
+          });
+          let courseScheduleIds = idArr.join(",");
+          obj.courseScheduleIds = courseScheduleIds;
+          obj.courseTimes = this.weekList;
+          obj.holiday = this.adjustmentForm.checked;
+          obj.teachMode = this.adjustmentForm.courseType || null;
+          obj.groupType = "PRACTICE";
+
+          obj.vipGroupId = this.practiceId;
+          vipCourseAdjust(obj).then(res => {
+            if (res.code == 200) {
+              this.$message.success("恭喜您修改成功");
+              this.adjustmentVisible = false;
+              this.getList();
+            }
+          });
+        }
+      });
+    },
+    handleSelectionChange(val) {
+      this.adjustmentForm.count = val.length;
+      this.activeList = val;
+    },
+    clearAttend(row) {
+      this.$confirm("是否清除考勤记录?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          cleanAttendance({ courseScheduleIds: row.id }).then(res => {
+            if (res.code == 200) {
+              this.$message.success("清除成功");
+              this.getList();
+            } else {
+              this.$message.error(res.msg);
+            }
+          });
+        })
+        .catch(() => {});
+    },
+    // 网管课加课弹窗
+    addCourse() {
+      this.adjustmentName = "网管课加课";
+      this.isaddCourse = true;
+      this.adjustmentVisible = true;
+    },
+    // 网管课加课提交
+    addCourseSubmit() {
+      this.$refs["adjustmentForm"].validate(item => {
+        if (item) {
+          let week = this.weekList;
+          if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
+            this.$message.error("至少排一节课");
+            return;
+          }
+          // 开始
+          let obj = {};
+          obj.courseCreateStartTime = this.adjustmentForm.courseTime;
+          let idArr = this.activeList.map(item => {
+            return item.id;
+          });
+          let courseScheduleIds = idArr.join(",");
+          obj.courseScheduleIds = courseScheduleIds;
+          obj.courseTimes = this.weekList;
+          obj.holiday = this.adjustmentForm.checked;
+          obj.vipGroupId = this.practiceId;
+          obj.courseCount = this.adjustmentForm.addCount;
+          obj.teachMode = this.adjustmentForm.courseType;
+          obj.singleClassPrice = this.adjustmentForm.fee;
+          obj.groupType = "PRACTICE";
+          batchAppendVipGroupCourses(obj).then(res => {
+            if (res.code == 200) {
+              this.$message.success("恭喜您添加成功");
+              this.adjustmentVisible = false;
+              this.getList();
+            }
+          });
+        }
+      });
+    },
+    // 删除
+    removeClass(row) {
+      this.$confirm("是否删除该课程?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        bathDelete({ courseScheduleIds: row.id }).then(res => {
+          if (res.code == 200) {
+            this.$message.success("删除成功");
+            this.getList();
+          }
+        });
+      });
     }
   }
 };
 </script>
 <style lang="scss" scoped>
-  .wrap {
-    display: flex;
-    flex-direction: row;
-    justify-content: flex-start;
-    div {
-      margin-right: 20px;
-    }
+.wrap {
+  display: flex;
+  flex-direction: row;
+  justify-content: flex-start;
+  div {
+    margin-right: 20px;
   }
+}
 </style>