mo 4 年之前
父节点
当前提交
741390d6fa

+ 34 - 6
src/views/teamDetail/componentCourse/gpsLocation.vue

@@ -9,14 +9,19 @@
              ref='map'
              vid="amapDemo"
              :amap-manager="amapManager"
-             :plugin="plugin"
              :center="center"
+             :events="markerEvents"
              class="amap-demo">
-      <!--  :events="markerEvents()" -->
+      <!--  :plugin="plugin"  -->
       <el-amap-marker v-for="(marker, index) in markers"
                       :key="index"
                       :position="marker.location"
                       :title="marker.title"></el-amap-marker>
+      <el-amap-polyline :path="path"
+                        strokeColor='#4196fc'></el-amap-polyline>
+      <el-amap-text v-for="text in texts"
+                    :text="text.text"
+                    :position="text.position"></el-amap-text>
     </el-amap>
   </div>
 </template> 
@@ -51,6 +56,10 @@ VueAMap.initAMapApiLoader({
 })
 let amapManager = new VueAMap.AMapManager();
 import { getTeacherPersonalAttendance } from '@/api/buildTeam'
+const exampleComponents = {
+  props: ['text'],
+  template: `<div>text from  parent: {{text}}</div>`
+}
 export default {
   props: ['activeRow'],
   data () {
@@ -59,16 +68,25 @@ export default {
       amapManager,
       center: [114.34371, 30.55939],
       markers: [],
-      plugin: [],
       distance: '-',
       schoolLongitudeLatitude: null,
       signInLongitudeLatitude: null,
+      markerEvents: {
+        complete: (o) => {
+          this.$refs.map.$amap.setFitView()
 
+        }
+      },
+      path: [],
+      texts: []
     }
   },
+  watch: {
+  },
   mounted () {
     this.init()
   },
+
   activated () {
     // this.init()
   },
@@ -80,11 +98,13 @@ export default {
       if (this.activeRow.schoolLongitudeLatitude) {
         let add = {
           title: '教学点',
-          location: this.activeRow.schoolLongitudeLatitude.split(',')
+          location: this.activeRow.schoolLongitudeLatitude.split(','),
+          contentRender: (h, instance) => h(exampleComponents, { style: { backgroundColor: '#fff' }, props: { text: 'father is here' } }, ['xxxxxxx'])
         }
         this.center = this.activeRow.schoolLongitudeLatitude.split(',');
         this.schoolLongitudeLatitude = this.activeRow.schoolLongitudeLatitude.split(',')
         this.markers.push(add)
+
       }
       if (this.activeRow.signInLongitudeLatitude) {
         let add = {
@@ -104,8 +124,10 @@ export default {
         this.signInLongitudeLatitude = this.activeRow.signOutLongitudeLatitude.split(',')
         this.markers.push(add)
       }
-      // this.$refs.map.$amap.setFitView(this.markers)
-      console.log(this.$refs.map)
+      // if (this.$refs.map) {
+      //   this.$refs.map.$amap.setFitView(this.markers)
+      // }
+
       this.getDistance(this.signInLongitudeLatitude, this.schoolLongitudeLatitude)
 
       return
@@ -160,7 +182,13 @@ export default {
 
         let p1 = marker1.getPosition();
         let p2 = marker2.getPosition();
+        var textPos = p1.divideBy(2).add(p2.divideBy(2));
+        console.log(textPos)
+        let position = [textPos.lng, textPos.lat]
         var distance = Math.round(p1.distance(p2));
+
+        this.path.push(sigin, school)
+        this.texts.push({ text: `两点相距${distance}米`, position })
         this.distance = distance;
       }
 

+ 29 - 3
src/views/teamDetail/componentCourse/teacherList.vue

@@ -59,9 +59,9 @@
         <template slot-scope="scope">
           <div>
             <el-button type="text"
-                       size="small">补考勤</el-button>
-            <el-button type="text"
-                       size="small">清除考勤</el-button>
+                       size="small"
+                       v-permission="'teacherAttendance/updateTeacherAttendance'"
+                       @click="mackAttendance(scope.row)">补考勤</el-button>
             <el-button type="text"
                        v-if="teachMode == 'OFFLINE'"
                        size="small"
@@ -79,6 +79,7 @@
   </div>
 </template>
 <script>
+import { updateTeacherAttendance } from "@/api/buildTeam";
 import { getCourseTeachers } from "@/api/teacherManager";
 import gpsLoction from "../componentCourse/gpsLocation";
 export default {
@@ -111,6 +112,31 @@ export default {
     lookGPS (row) {
       this.activeRow = row;
       this.gpsVisible = true
+    },
+    mackAttendance (row) {
+
+      this.$confirm('确定补考勤', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let params = {
+          teacherId: row.teacherId,
+          courseScheduleId: this.courseScheduleId,
+          signInStatus: 1,
+          signOutStatus: 1
+        };
+        updateTeacherAttendance(params).then(res => {
+          if (res.code == 200) {
+            this.$message.success("补卡成功");
+            this.getList();
+          } else {
+            this.$message.error(res.msg);
+          }
+        });
+
+      }).catch(() => { })
+
     }
   },
 }

+ 32 - 3
src/views/teamDetail/teamCourseList.vue

@@ -239,7 +239,7 @@
           <el-table-column align="center"
                            label="详情"
                            fixed="right"
-                           width="120px">
+                           width="180px">
             <template slot-scope="scope">
               <div>
                 <el-button type="text"
@@ -248,6 +248,14 @@
                 <el-button type="text"
                            v-if="permission('courseSchedule/classStartDateAdjust?hight')"
                            @click="resetClass(scope.row)">调整</el-button>
+                <el-button type="text"
+                           v-if="
+                           scope.row.status=='OVER'
+                           &&
+                           !scope.row.isSettlement
+                           &&permission('courseSchedule/cleanAttendance')"
+                           @click="clearAttend(scope.row)"
+                           size="small">清除考勤</el-button>
               </div>
             </template>
           </el-table-column>
@@ -372,7 +380,8 @@ import {
   getTeacher,
   getMusicGroupAllClass,
   superFindCourseSchedules,
-  getEmployeeOrgan
+  getEmployeeOrgan,
+  cleanAttendance
 } from "@/api/buildTeam";
 import { getTeacherPersonalAttendanceDetail } from "@/api/teacherManager";
 import { getSchool } from "@/api/systemManage";
@@ -639,7 +648,27 @@ export default {
     },
     closeReset () {
       this.show = false
-    }
+    },
+    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(() => { });
+    },
 
   },
   filters: {