Selaa lähdekoodia

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

seimin 3 vuotta sitten
vanhempi
commit
1400851d77
1 muutettua tiedostoa jossa 28 lisäystä ja 6 poistoa
  1. 28 6
      src/views/my.vue

+ 28 - 6
src/views/my.vue

@@ -1,10 +1,13 @@
1
 <template>
1
 <template>
2
   <div class="bgColor">
2
   <div class="bgColor">
3
     <div class="head">
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
     </div>
11
     </div>
9
     <div class="myMessage">
12
     <div class="myMessage">
10
       <div class="label">个人信息</div>
13
       <div class="label">个人信息</div>
@@ -128,7 +131,9 @@ export default {
128
       promptingStatus: "",
131
       promptingStatus: "",
129
       groups: "", //工作组
132
       groups: "", //工作组
130
       candidateGroups: "",
133
       candidateGroups: "",
131
-      toast: null
134
+      toast: null,
135
+      isWorkOnline:false,//当前用户是否可以上下班
136
+      isWorkLoading:false,//当前用户是否可以上下班loading
132
     };
137
     };
133
   },
138
   },
134
   methods: {
139
   methods: {
@@ -231,11 +236,25 @@ export default {
231
         .then(function(res) {
236
         .then(function(res) {
232
           that.incidentCount = res.data;
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
   created() {
254
   created() {
237
     this.getGroups();
255
     this.getGroups();
238
     this.getIncidentData();
256
     this.getIncidentData();
257
+    this.getWorkOnline();
239
   }
258
   }
240
 };
259
 };
241
 </script>
260
 </script>
@@ -265,7 +284,10 @@ export default {
265
 .head {
284
 .head {
266
   height: 2.4rem;
285
   height: 2.4rem;
267
   background: linear-gradient(#005395, #226ca8);
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
 .head .img {
293
 .head .img {