zhaozp 3 жил өмнө
parent
commit
63235a253c

+ 1 - 1
config/index.js

@@ -59,7 +59,7 @@ module.exports = {
     // Paths
     assetsRoot: path.resolve(__dirname, '../dist'),
     assetsSubDirectory: 'static',
-    assetsPublicPath: '/',
+    assetsPublicPath: './',
 
     /**
      * Source Maps

+ 2 - 0
index.html

@@ -9,5 +9,7 @@
     <div id="app"></div>
     <!-- built files will be auto injected -->
   </body>
+  <script src="ebeiapp://cordova.js"></script>
+  <script src="ebeiapp://EbeiPlugins.js"></script>
   <script src="https://webapi.amap.com/maps?v=1.4.15&key=e8a1c4d772a95eee75b2161133e35555&plugin=AMap.CircleEditor,AMap.PolyEditor"></script>
 </html>

+ 0 - 5
src/App.vue

@@ -9,11 +9,6 @@ import { setStore } from '@/utils/store'
 export default {
   name: 'App',
   created() {
-          // 1 考勤页  2 人员管理页
-      let type = this.$route.query.type || 1
-      if(type) {
-        setStore({'name':'type', 'content': type, 'type':''})
-      }
       // token 
       let token = this.$route.query.token
       if(token) {

+ 3 - 0
src/api/index.js

@@ -43,5 +43,8 @@ export const userManageList = (data) => { return request({ url: "/attendance/api
 // 部门人员签到列表
 export const userSignList = (data) => { return request({ url: "/attendance/api/manage/userSignList",method: "post",data: data }) }
 
+// 工作轨迹
+export const getTrack = (data) => { return request({ url: "/attendance/admin/manage/getTrack",method: "post",data: data }) }
+
 // 获取项目
 export const getProjectList = () => { return request({ url: "/attendance/api/manage/getProjectList", method: "post"}) }

+ 53 - 0
src/components/navBarPunch.vue

@@ -0,0 +1,53 @@
+<template>
+  <van-nav-bar
+    :title="ifPunch ? '考勤打卡' : '统计'"
+    :left-text="leftText"
+    :left-arrow="leftArrow"
+    @click-left="onClickLeft"
+  >
+  </van-nav-bar>
+</template>
+
+<script>
+import { returnApp } from '@/utils/native'
+export default {
+  props: {
+    ifPunch: {
+      type: Boolean,
+      default: false,
+    },
+    // 是否为选择项目页
+    ifProject: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  data() {
+    return {
+      leftArrow: true,
+      leftText: "返回",
+    };
+  },
+  methods: {
+    onClickLeft() {
+      returnApp().then(res=> {})
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+$white: #fff;
+.van-nav-bar {
+  background: #67a2ff;
+}
+/deep/ .van-icon {
+  color: $white;
+}
+/deep/ .van-nav-bar__text {
+  color: $white;
+}
+/deep/ .van-nav-bar__title {
+  color: $white;
+}
+</style>

+ 6 - 1
src/components/peopleManage/card.vue

@@ -20,7 +20,7 @@
         <span>下班 <span style="color: #67a2ff">{{ item.downworkTime || '暂无' }}</span></span>
       </div>
       <div class="userCard-three">
-        <div class="userCard-three-chunk">工作轨迹</div>
+        <div class="userCard-three-chunk" @click="jumpTrack(item.recordId)">工作轨迹</div>
       </div>
     </div>
   </div>
@@ -33,6 +33,11 @@ export default {
     default() {
       return []
     }
+  },
+  methods: {
+    jumpTrack(recordId) {
+      this.$router.push({'path':'/trajectory','query':{'recordId':recordId}})
+    }
   }
 };
 </script>

+ 8 - 13
src/components/navBar.vue → src/components/peopleManage/navBarPeople.vue

@@ -5,7 +5,7 @@
     :left-arrow="leftArrow"
     @click-left="onClickLeft"
   >
-    <template #title v-if="type === 2">
+    <template #title>
       <template v-if="!ifProject">
         <div style="display: flex; align-items: center">
           <van-icon
@@ -27,7 +27,7 @@
 </template>
 
 <script>
-import { getStore } from "@/utils/store";
+import { returnApp } from '@/utils/native'
 export default {
   props: {
     ifPunch: {
@@ -42,32 +42,27 @@ export default {
   },
   data() {
     return {
-      type: getStore({ name: "type", type: "", debug: "" }),
       leftArrow: true,
       leftText: "返回",
     };
   },
   created() {
-    if (this.type === 2) {
-      if (!this.$store.state.pName) {
-        this.leftArrow = false;
-        this.leftText = "";
-      }
+    if (!this.$store.state.pName) {
+      this.leftArrow = false;
+      this.leftText = "";
     }
   },
   methods: {
     onClickLeft() {
       // 人员管理
-      if (this.type === 2) {
-        if (this.ifPunch) {
-          return this.$router.back();
-        }
+      if (this.ifPunch) {
+        return this.$router.back();
       }
       this.jumpModule();
     },
     // 跳出当前模块
     jumpModule() {
-      console.log("跳出");
+      returnApp().then(res=> {})
     },
   },
 };

+ 12 - 11
src/permission.js

@@ -13,17 +13,18 @@ router.beforeEach((to, from, next) => {
   // 是否为人员管理模块
 
     // 是否已经选择项目
-    if(!store.state.pName){
-      if (to.name === '人员管理') {
-        next({
-          path: '/chooseProject'
-        })
-      } else {
-        next()
-      }
-    } else {
-      next()
-    }
+    // if(!store.state.pName){
+    //   if (to.name === '人员管理') {
+    //     next({
+    //       path: '/chooseProject'
+    //     })
+    //   } else {
+    //     next()
+    //   }
+    // } else {
+    //   next()
+    // }
+    next()
 })
 
 router.afterEach(() => {

+ 80 - 21
src/router/index.js

@@ -4,29 +4,13 @@ import { getStore } from '@/utils/store'
 Vue.use(Router)
 
 export default new Router({
-  routes: [{
-    path: '/',
-    name: 'Index',
-    redirect: function () {
-      let type = getStore({'name':'type','type':'','debug':''})
-      if(type == 1){
-        return '/punch'
-      } else {
-        return '/peopleManage'
-      }
-    },
-    component: () => import('@/views/Index'),
-    meta: {
-      keepAlive: true,
-      isTab: false,
-      isAuth: true
-    },
-    children: [ {
+  routes: [
+    {
       path: '/punch',
       name: '打卡',
       component: () => import('@/views/base/punch'),
       meta: {
-        keepAlive: true,
+        keepAlive: false,
         isTab: false,
         isAuth: true
       }
@@ -75,6 +59,81 @@ export default new Router({
         isTab: false,
         isAuth: true
       }
-    }]
-  }]
+    }
+]
 })
+// export default new Router({
+//   routes: [{
+//     path: '/',
+//     name: 'Index',
+//     redirect: function () {
+//       let type = getStore({'name':'type','type':'','debug':''})
+//       if(type == 1){
+//         return '/punch'
+//       } else {
+//         return '/peopleManage'
+//       }
+//     },
+//     component: () => import('@/views/Index'),
+//     meta: {
+//       keepAlive: true,
+//       isTab: false,
+//       isAuth: true
+//     },
+//     children: [ {
+//       path: '/punch',
+//       name: '打卡',
+//       component: () => import('@/views/base/punch'),
+//       meta: {
+//         keepAlive: false,
+//         isTab: false,
+//         isAuth: true
+//       }
+//     }, {
+//       path: '/statistics',
+//       name: '统计',
+//       component: () => import('@/views/base/statistics'),
+//       meta: {
+//         keepAlive: false,
+//         isTab: false,
+//         isAuth: true
+//       }
+//     }, {
+//       path: '/peopleManage',
+//       name: '人员管理',
+//       component: () => import('@/views/base/peopleManage'),
+//       meta: {
+//         keepAlive: false,
+//         isTab: false,
+//         isAuth: true
+//       }
+//     }, {
+//       path: '/departmentStatistics',
+//       name: '部门签到统计',
+//       component: () => import('@/views/base/departmentStatistics'),
+//       meta: {
+//         keepAlive: false,
+//         isTab: false,
+//         isAuth: true
+//       }
+//     }, {
+//       path: '/chooseProject',
+//       name: '选择项目',
+//       component: () => import('@/views/base/chooseProject'),
+//       meta: {
+//         keepAlive: false,
+//         isTab: false,
+//         isAuth: true
+//       }
+//     }, {
+//       path: '/trajectory',
+//       name: '工作轨迹',
+//       component: () => import('@/views/trajectory/trajectory'),
+//       meta: {
+//         keepAlive: false,
+//         isTab: false,
+//         isAuth: true
+//       }
+//     }]
+//   }]
+// })

+ 14 - 0
src/utils/native.js

@@ -0,0 +1,14 @@
+//  回退到app
+
+export function returnApp () {
+  return new Promise((resolve, reject) => {
+    window.EbeiPlugins.onBackKeyDown(
+      result => {
+        resolve(result)
+      },
+      error => {
+        reject(error)
+      }
+    )
+  })
+}

+ 0 - 11
src/views/Index.vue

@@ -1,6 +1,5 @@
 <template>
   <div class="index">
-    <Loading v-show="LOADING"></Loading>
     <!-- <keep-alive>
       <router-view></router-view>
     </keep-alive> -->
@@ -8,17 +7,10 @@
       <router-view v-if="$route.meta.keepAlive" />
     </keep-alive>
     <router-view v-if="!$route.meta.keepAlive" />
-    <van-tabbar v-model="active"  v-if="type === 1">
-      <van-tabbar-item to="/punch" icon="location-o">打卡</van-tabbar-item>
-      <van-tabbar-item to="/statistics" icon="records">统计</van-tabbar-item>
-    </van-tabbar>
   </div>
 </template>
 
 <script>
-import { mapState } from "vuex";
-import { getStore } from "@/utils/store";
-import Loading from "@/components/loading";
 export default {
   name: "Index",
   components: {
@@ -26,12 +18,9 @@ export default {
   },
   data() {
     return {
-      active: 0,
-      type: getStore({'name':'type','type':'','debug':''})
     };
   },
   computed: {
-    ...mapState(["LOADING"]),
   },
   watch: {},
   mounted() {

+ 1 - 1
src/views/base/chooseProject.vue

@@ -38,7 +38,7 @@
 </template>
 
 <script>
-import navBar from "@/components/navBar";
+import navBar from "@/components/peopleManage/navBarPeople";
 import { setStore } from "@/utils/store";
 import { getProjectList } from "@/api";
 import { noRepeat,fuzzyQuery } from "@/utils/util";

+ 1 - 1
src/views/base/departmentStatistics.vue

@@ -24,7 +24,7 @@
 </template>
 
 <script>
-import navBar from "@/components/navBar";
+import navBar from "@/components/peopleManage/navBarPeople";
 import card from "@/components/peopleManage/card";
 import { userSignList } from "@/api";
 import { Notify } from "vant";

+ 10 - 2
src/views/base/peopleManage.vue

@@ -6,10 +6,11 @@
 </template>
 
 <script>
-import navBar from "@/components/navBar";
+import navBar from "@/components/peopleManage/navBarPeople";
 import manageIndex from "@/components/peopleManage/index";
 import { Notify } from "vant";
 import { userManageList } from "@/api"
+import { getStore } from "@/utils/store"
 export default {
   name: "peopleManage",
   components: {
@@ -17,7 +18,14 @@ export default {
     manageIndex
   },
   created() {
-    this.getUserManageList()
+    if(!getStore({'name':'projectId','type':'','debug':''})){
+      Notify({ type: 'warning', message: '请先选择项目',duration:1000 })
+      setTimeout(()=> {
+        this.$router.push('/chooseProject')
+      },1000)
+    } else {
+      this.getUserManageList()
+    }
   },
   data() {
     return {

+ 18 - 12
src/views/base/punch.vue

@@ -1,5 +1,6 @@
 <template>
   <div>
+    <Loading v-show="LOADING"></Loading>
     <nav-bar ifPunch />
     <head-info />
     <van-divider :style="{ color: '#aaa', borderColor: '#aaa', margin: 0 }" />
@@ -30,13 +31,19 @@
         description="暂无任何打卡信息"
       />
     </template>
+    <van-tabbar v-model="active">
+      <van-tabbar-item icon="location-o">打卡</van-tabbar-item>
+      <van-tabbar-item to="/statistics" icon="records">统计</van-tabbar-item>
+    </van-tabbar>
   </div>
 </template>
 
 <script>
-import navBar from "@/components/navBar";
+import navBar from "@/components/navBarPunch";
 import headInfo from "@/components/headInfo";
 import punchInfo from "@/components/punchInfo";
+import Loading from "@/components/loading";
+import { mapState } from "vuex";
 import empty from "@/assets/empty.png";
 import { Toast,Notify } from "vant";
 import { getButtonState,getTodaySignRecord,signRecord,userInfoHead } from "@/api"
@@ -45,10 +52,12 @@ export default {
   components: {
     navBar,
     headInfo,
-    punchInfo
+    punchInfo,
+    Loading
   },
   data() {
-    return {      
+    return {
+      active: 0,
       // 当前时间
       nowDate: "",
       // 按钮数据
@@ -63,12 +72,11 @@ export default {
       // 打卡信息
       punchInfo: {},
       // 定时器1
-      interOne: "",
-      // 定时器2
-      interTwo: ""
+      interOne: ""
     };
   },
   computed: {
+    ...mapState(["LOADING"]),
     buttonInfo() {
       return function(code) {
         if(this.buttonPrayCode.some((item) => item == code)){
@@ -80,15 +88,12 @@ export default {
   },
   created() {
     this.$store.commit('showLoading')
+    this.currentTime();
     this.getUserInfoHead()
     this.getButtonStateInfo()
   },
-  activated() {
-     this.currentTime();
-  },
-  deactivated() {
+  beforeDestroy() {
     clearInterval(this.interOne)
-    // clearInterval(this.interTwo)
   },
   methods: {
     // 获取用户信息
@@ -112,6 +117,7 @@ export default {
           }  
         } else {
           this.$store.commit('hideLoading')
+          clearInterval(this.interOne)
           Notify({ type: 'warning', message: res.message })
         }
       })
@@ -133,7 +139,6 @@ export default {
     },
     currentTime() {
       this.interOne = setInterval(this.formatDate, 1000);
-      // this.interTwo = setInterval(this.getButtonStateInfo(false), 1000);
     },
     formatDate() {
       let date = new Date();
@@ -144,6 +149,7 @@ export default {
       let second = date.getSeconds(); // 秒
       second = second < 10 ? "0" + second : second; // 如果只有一位,则前面补零
       this.nowDate = `${hour}:${minute}:${second}`;
+      this.getButtonStateInfo(false)
     },
     // 打卡
     punchCard() {

+ 11 - 1
src/views/base/statistics.vue

@@ -1,5 +1,6 @@
 <template>
   <div style="height: 100%">
+    <Loading v-show="LOADING"></Loading>
     <nav-bar />
     <head-info
       :nowYearMonth="value"
@@ -72,14 +73,20 @@
         />
       </template>
     </div>
+    <van-tabbar v-model="active">
+      <van-tabbar-item to="/punch" icon="location-o">打卡</van-tabbar-item>
+      <van-tabbar-item icon="records">统计</van-tabbar-item>
+    </van-tabbar>
   </div>
 </template>
 
 <script>
-import navBar from "@/components/navBar";
+import navBar from "@/components/navBarPunch";
 import headInfo from "@/components/headInfo";
 import statisticsNum from "@/components/statisticsNum";
 import statisticsInfo from "@/components/statisticsInfo";
+import Loading from "@/components/loading";
+import { mapState } from "vuex";
 import { statistics, statisticsTop } from "@/api";
 import { Notify } from "vant";
 import { getYyMmDdTimeStamp } from "@/utils/date";
@@ -92,9 +99,11 @@ export default {
     headInfo,
     statisticsNum,
     statisticsInfo,
+    Loading
   },
   data() {
     return {
+      active: 1,
        // 图片路径
       empty: empty,
       rest: rest,
@@ -119,6 +128,7 @@ export default {
     });
   },
   computed: {
+    ...mapState(["LOADING"]),
     // 计算元素高度
     calRelHeight() {
       return `height: calc( 100vh - ${this.calHeight}px - 50px )`;

+ 73 - 129
src/views/trajectory/trajectory.vue

@@ -6,156 +6,100 @@
       left-arrow
       @click-left="goBack()"
     />
-    <div id="map-container" style="width: 100%; height: calc(100vh - 46px)"></div>
+    <div
+      id="map-container"
+      style="width: 100%; height: calc(100vh - 46px)"
+    ></div>
   </div>
 </template>
 
 <script>
-import { getTrajectoryInfo } from '@/api'
-import { Notify } from 'vant'
+import { getTrack } from "@/api";
+import { Notify } from "vant";
 export default {
-  name: 'trajectory',
-  components: {
-  },
-  data () {
+  name: "trajectory",
+  components: {},
+  data() {
     return {
-    }
+      recordId: "",
+    };
+  },
+  created() {
+    this.recordId = this.$route.query.recordId;
   },
-  mounted () {
-    getTrajectoryInfo({
-    }).then(res => {
+  mounted() {
+    let that = this
+    getTrack({ recordId: this.recordId }).then((res) => {
       if (res.status == 10000) {
-        const map = new AMap.Map('map-container')
-        map.setCenter(new AMap.LngLat(res.data.coordPoint.log, res.data.coordPoint.lat))
-        map.setZoom(13)
-        map.add(new AMap.Polyline({
-          path: res.data.coordPointList.map(item => {
-            return new AMap.LngLat(item.log, item.lat)
-          }),
-          strokeWeight: 6,
-          strokeColor: '#ee0a24',
-          lineJoin: 'round',
-          lineCap: 'round',
-          showDir: true
-        }))
+        const map = new AMap.Map("map-container");
+        // 如果为圆形
+        map.setCenter(
+            new AMap.LngLat(res.data.coordPoint.log, res.data.coordPoint.lat)
+        );
+        map.setZoom(13);
+        map.add(
+          new AMap.Polyline({
+            path: res.data.guijicoord.map((item) => {
+              return new AMap.LngLat(item.log, item.lat);
+            }),
+            strokeWeight: 6,
+            strokeColor: "#ee0a24",
+            lineJoin: "round",
+            lineCap: "round",
+            showDir: true,
+            })
+          );
         if (res.data.fenceType == 0) {
-          map.add(new AMap.Circle({
-            center: new AMap.LngLat(res.data.coordPoint.log, res.data.coordPoint.lat),
-            radius: parseFloat(res.data.fenceRadii),
-            fillColor: '#409eff66',
-            strokeColor: '#409eff',
-            strokeWeight: 1
-          }))
+          map.add(
+            new AMap.Circle({
+              center: new AMap.LngLat(
+                res.data.coordPoint.log,
+                res.data.coordPoint.lat
+              ),
+              radius: parseFloat(res.data.fenceRadii),
+              fillColor: "#409eff66",
+              strokeColor: "#409eff",
+              strokeWeight: 1,
+            })
+          );
         } else {
-          map.add(new AMap.Polygon({
-            path: res.data.coordPointList.map(item => {
-              return [item.log, item.lat]
-            }),
-            fillColor: '#409eff66',
-            borderWeight: 1,
-            strokeColor: '#409eff'
-          }))
+          map.add(
+            new AMap.Polygon({
+              path: res.data.coordPointList.map((item) => {
+                return [item.log, item.lat];
+              }),
+              fillColor: "#409eff66",
+              borderWeight: 1,
+              strokeColor: "#409eff",
+            })
+          );
         }
       } else {
-        Notify({ type: 'warning', message: '查看轨迹信息失败' })
+        Notify({ type: "warning", message: res.message || "查看轨迹信息失败",duration:1000 });
+        setTimeout(()=>that.$router.back(),1000)
       }
-    })
+    });
   },
   methods: {
-    goBack () {
-      this.$router.back()
-    }
-  }
-}
+    goBack() {
+      this.$router.back();
+    },
+  },
+};
 </script>
 
 <style scoped lang="scss">
-$width: 1.2vw;
-$height: 0.6vh;
-.punch-img-style {
-  padding-bottom: 2vh;
-}
-.yc-style {
-  display: flex;
-  justify-content: center;
-}
-.redDot {
-  width: $width;
-  height: $height;
-  border-radius: 50%;
-  background: #932562;
-}
-.blueDot {
-  width: $width;
-  height: $height;
-  border-radius: 50%;
-  background: #0000ff;
-}
-.orangeDot {
-  width: $width;
-  height: $height;
-  border-radius: 50%;
-  background: #ff9900;
-}
-.rest-style {
-  display: flex;
-  justify-content: center;
-  width: 100%;
-  color: #aaa;
-}
-.table-head {
-  height: 100%;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-}
-/deep/ .el-calendar__body {
-  padding: 0;
-  table > thead > th {
-    text-align: center;
-  }
-}
-/deep/ .el-calendar-table tr:first-child td {
-  border: none;
-}
-/deep/ .el-calendar-table td {
-  border: none;
-}
-/deep/ .el-calendar-table .el-calendar-day {
-  height: 6vh;
-  /* width: 14.5vw; */
-  padding: 1vh 2vw 0 2vw;
-  /* padding: 0; */
-}
-/deep/ .el-calendar-table td.is-selected {
-  background: #fff;
-}
-/deep/ .el-calendar-table .el-calendar-day:hover {
-  background: transparent;
-}
-/deep/ .el-calendar-table td.is-selected .el-calendar-day .table-head {
-  border-radius: 50%;
+$white: #fff;
+.van-nav-bar {
   background: #67a2ff;
-  color: #fff;
-}
-/deep/ .el-calendar-table__row .prev {
-  pointer-events: none;
-}
-/deep/ .el-calendar-table__row .next {
-  pointer-events: none;
-}
-/deep/ .van-empty__image {
-  width: 100%;
-  height: 100%;
 }
-/deep/ .van-empty {
-  padding: 0;
+/deep/ .van-icon {
+  color: $white;
 }
-/deep/ .custom-image .van-empty__image img {
-  width: 100%;
-  height: 100%;
+/deep/ .van-nav-bar__text {
+  color: $white;
 }
-/deep/ .van-empty__description {
-  color: #aaa;
+/deep/ .van-nav-bar__title {
+  color: $white;
 }
 </style>