Browse Source

上下班根据选择的人员显示上班按钮

seimin 3 years ago
parent
commit
1400851d77
1 changed files with 28 additions and 6 deletions
  1. 28 6
      src/views/my.vue

+ 28 - 6
src/views/my.vue

@@ -1,10 +1,13 @@
1 1
 <template>
2 2
   <div class="bgColor">
3 3
     <div class="head">
4
-      <div class="img" @click="getLocation(loginUser.online)">
5
-        {{ loginUser.online == 1 ? "下班" : "上班" }}
6
-      </div>
7
-      <div class="name">{{ loginUser.name }}</div>
4
+      <template v-if="!isWorkLoading">
5
+        <div class="img" @click="getLocation(loginUser.online)" v-show="isWorkOnline">
6
+          {{ loginUser.online == 1 ? "下班" : "上班" }}
7
+        </div>
8
+        <div class="name">{{ loginUser.name }}</div>
9
+      </template>
10
+      <cube-loading v-if="isWorkLoading"></cube-loading>
8 11
     </div>
9 12
     <div class="myMessage">
10 13
       <div class="label">个人信息</div>
@@ -128,7 +131,9 @@ export default {
128 131
       promptingStatus: "",
129 132
       groups: "", //工作组
130 133
       candidateGroups: "",
131
-      toast: null
134
+      toast: null,
135
+      isWorkOnline:false,//当前用户是否可以上下班
136
+      isWorkLoading:false,//当前用户是否可以上下班loading
132 137
     };
133 138
   },
134 139
   methods: {
@@ -231,11 +236,25 @@ export default {
231 236
         .then(function(res) {
232 237
           that.incidentCount = res.data;
233 238
         });
239
+    },
240
+    //获取展示可以上下班人员列表
241
+    getWorkOnline(){
242
+      this.isWorkLoading = true;
243
+      this.$http
244
+        .post("service/bpm/data/fetchDataList/workOnlineConfig", {"idx":0,"sum":1000})
245
+        .then((res) => {
246
+          this.isWorkLoading = false;
247
+          if(res.status == 200){
248
+            let userList = res.data.list[0].userList.map(v=>v.id);//用户id列表
249
+            this.isWorkOnline = userList.includes(this.loginUser.id);
250
+          }
251
+        });
234 252
     }
235 253
   },
236 254
   created() {
237 255
     this.getGroups();
238 256
     this.getIncidentData();
257
+    this.getWorkOnline();
239 258
   }
240 259
 };
241 260
 </script>
@@ -265,7 +284,10 @@ export default {
265 284
 .head {
266 285
   height: 2.4rem;
267 286
   background: linear-gradient(#005395, #226ca8);
268
-  padding-top: 0.3rem;
287
+  display: flex;
288
+  flex-direction: column;
289
+  justify-content: center;
290
+  align-items: center;
269 291
 }
270 292
 
271 293
 .head .img {