|
@@ -118,8 +118,11 @@
|
118
|
118
|
</div>
|
119
|
119
|
</template>
|
120
|
120
|
<script>
|
121
|
|
-let sdk = new jssdk(3, "https://wx2.zuel.edu.cn"); // 域名更换为对应环境域名, 204 更换为对应环境wid
|
122
|
|
-sdk.config(0); //1表示调试模式,生产环境传0
|
|
121
|
+if (this.isZncd) {
|
|
122
|
+ let sdk = new jssdk(3, "https://wx2.zuel.edu.cn"); // 域名更换为对应环境域名, 204 更换为对应环境wid
|
|
123
|
+ sdk.config(0); //1表示调试模式,生产环境传0
|
|
124
|
+}
|
|
125
|
+import { GL } from "./../http/http";
|
123
|
126
|
import "./../../static/css/iconfont.js";
|
124
|
127
|
export default {
|
125
|
128
|
data() {
|
|
@@ -132,126 +135,134 @@ export default {
|
132
|
135
|
groups: "", //工作组
|
133
|
136
|
candidateGroups: "",
|
134
|
137
|
toast: null,
|
135
|
|
- isWorkOnline:false,//当前用户是否可以上下班
|
136
|
|
- isWorkLoading:false,//当前用户是否可以上下班loading
|
137
|
|
- online:0,//1是上班,0是下班
|
|
138
|
+ isWorkOnline: false, //当前用户是否可以上下班
|
|
139
|
+ isWorkLoading: false, //当前用户是否可以上下班loading
|
|
140
|
+ online: 0, //1是上班,0是下班
|
138
|
141
|
};
|
139
|
142
|
},
|
140
|
143
|
methods: {
|
141
|
144
|
//获取位置,经纬度
|
142
|
145
|
getLocation(online) {
|
143
|
146
|
// 判断是否处于微信浏览器环境
|
144
|
|
- if(!(/MicroMessenger/i.test(window.navigator.userAgent))){
|
|
147
|
+ if (!/MicroMessenger/i.test(window.navigator.userAgent)) {
|
145
|
148
|
this.$createToast({
|
146
|
|
- txt: '请前往微信中上下班',
|
147
|
|
- type: 'warn',
|
148
|
|
- mask: true
|
149
|
|
- }).show()
|
|
149
|
+ txt: "请前往微信中上下班",
|
|
150
|
+ type: "warn",
|
|
151
|
+ mask: true,
|
|
152
|
+ }).show();
|
150
|
153
|
return;
|
151
|
154
|
}
|
152
|
|
- let _this = this;
|
153
|
155
|
this.toast = this.$createToast({
|
154
|
156
|
time: 0,
|
155
|
157
|
mask: true,
|
156
|
|
- txt: "正在加载中"
|
|
158
|
+ txt: "正在加载中",
|
157
|
159
|
});
|
158
|
160
|
this.toast.show();
|
159
|
|
- // 本地测试
|
160
|
|
- if(!this.isZncd){
|
161
|
|
- this.goToWork(online, '');
|
162
|
|
- return;
|
|
161
|
+ // 中南财大
|
|
162
|
+ if (this.isZncd) {
|
|
163
|
+ //第二个参数 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
164
|
+ sdk.getLocation((res) => {
|
|
165
|
+ // alert(JSON.stringify(res));
|
|
166
|
+ // latitude
|
|
167
|
+ // longitude
|
|
168
|
+ this.gl(res, online);
|
|
169
|
+ });
|
|
170
|
+ } else {
|
|
171
|
+ GL(this).then((res) => {
|
|
172
|
+ this.gl(res, online);
|
|
173
|
+ });
|
163
|
174
|
}
|
164
|
|
- //第二个参数 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
165
|
|
- sdk.getLocation(res => {
|
166
|
|
- // alert(JSON.stringify(res));
|
167
|
|
- // latitude
|
168
|
|
- // longitude
|
169
|
|
- $.ajax({
|
170
|
|
- url: "https://apis.map.qq.com/ws/geocoder/v1",
|
171
|
|
- data: {
|
172
|
|
- location: res.latitude + "," + res.longitude,
|
173
|
|
- key: "TADBZ-IRBWU-QAXVE-2IWED-UW2F5-YVF66",
|
174
|
|
- output: "jsonp"
|
175
|
|
- },
|
176
|
|
- dataType: "jsonp",
|
177
|
|
- success: function(result) {
|
178
|
|
- if (result.status === 0) {
|
179
|
|
- let address = result.result.formatted_addresses.recommend;
|
180
|
|
- _this.goToWork(online, address);
|
181
|
|
- }
|
|
175
|
+ },
|
|
176
|
+ //获取地理位置方法
|
|
177
|
+ gl(res, online) {
|
|
178
|
+ let _this = this;
|
|
179
|
+ $.ajax({
|
|
180
|
+ url: "https://apis.map.qq.com/ws/geocoder/v1",
|
|
181
|
+ data: {
|
|
182
|
+ location: res.latitude + "," + res.longitude,
|
|
183
|
+ key: "TADBZ-IRBWU-QAXVE-2IWED-UW2F5-YVF66",
|
|
184
|
+ output: "jsonp",
|
|
185
|
+ },
|
|
186
|
+ dataType: "jsonp",
|
|
187
|
+ success(result) {
|
|
188
|
+ if (result.status === 0) {
|
|
189
|
+ let address = result.result.formatted_addresses.recommend;
|
|
190
|
+ _this.goToWork(online, address);
|
182
|
191
|
}
|
183
|
|
- });
|
|
192
|
+ },
|
184
|
193
|
});
|
185
|
194
|
},
|
186
|
195
|
// 上下班
|
187
|
196
|
goToWork(online, address) {
|
188
|
197
|
this.$http
|
189
|
198
|
.post("service/auth/online", { online, address })
|
190
|
|
- .then(res => {
|
|
199
|
+ .then((res) => {
|
191
|
200
|
if (res.data.status == 200) {
|
192
|
|
- this.$http
|
193
|
|
- .post("service/auth/showOnlineBtn", {})
|
194
|
|
- .then((res) => {
|
195
|
|
- this.toast.hide();
|
196
|
|
- if(res.data.status == 200){
|
197
|
|
- this.online = res.data.online;
|
198
|
|
- this.showToast(online, '成功');
|
199
|
|
- }
|
200
|
|
- });
|
|
201
|
+ this.$http.post("service/auth/showOnlineBtn", {}).then((res) => {
|
|
202
|
+ this.toast.hide();
|
|
203
|
+ if (res.data.status == 200) {
|
|
204
|
+ this.online = res.data.online;
|
|
205
|
+ this.showToast(online, "成功");
|
|
206
|
+ }
|
|
207
|
+ });
|
201
|
208
|
} else {
|
202
|
209
|
this.toast.hide();
|
203
|
|
- this.$createDialog({
|
204
|
|
- type: 'confirm',
|
205
|
|
- icon: 'cubeic-alert',
|
206
|
|
- title: '提示',
|
207
|
|
- content: '您现在为非下班时间,您确认要进行下班操作吗?',
|
|
210
|
+ this.$createDialog({
|
|
211
|
+ type: "confirm",
|
|
212
|
+ icon: "cubeic-alert",
|
|
213
|
+ title: "提示",
|
|
214
|
+ content: "您现在为非下班时间,您确认要进行下班操作吗?",
|
208
|
215
|
confirmBtn: {
|
209
|
|
- text: '确定按钮',
|
|
216
|
+ text: "确定按钮",
|
210
|
217
|
active: true,
|
211
|
218
|
disabled: false,
|
212
|
|
- href: 'javascript:;'
|
|
219
|
+ href: "javascript:;",
|
213
|
220
|
},
|
214
|
221
|
cancelBtn: {
|
215
|
|
- text: '取消按钮',
|
|
222
|
+ text: "取消按钮",
|
216
|
223
|
active: false,
|
217
|
224
|
disabled: false,
|
218
|
|
- href: 'javascript:;'
|
|
225
|
+ href: "javascript:;",
|
219
|
226
|
},
|
220
|
227
|
onConfirm: () => {
|
221
|
228
|
this.toast = this.$createToast({
|
222
|
229
|
time: 0,
|
223
|
230
|
mask: true,
|
224
|
|
- txt: "正在加载中"
|
|
231
|
+ txt: "正在加载中",
|
225
|
232
|
});
|
226
|
233
|
this.toast.show();
|
227
|
234
|
this.$http
|
228
|
|
- .post("service/auth/online", { online, address, confirm:'ok' })
|
229
|
|
- .then(res => {
|
230
|
|
- if (res.data.status == 200) {
|
231
|
|
- this.$http
|
232
|
|
- .post("service/auth/showOnlineBtn", {})
|
233
|
|
- .then((res) => {
|
|
235
|
+ .post("service/auth/online", {
|
|
236
|
+ online,
|
|
237
|
+ address,
|
|
238
|
+ confirm: "ok",
|
|
239
|
+ })
|
|
240
|
+ .then((res) => {
|
|
241
|
+ if (res.data.status == 200) {
|
|
242
|
+ this.$http
|
|
243
|
+ .post("service/auth/showOnlineBtn", {})
|
|
244
|
+ .then((res) => {
|
|
245
|
+ this.toast.hide();
|
|
246
|
+ if (res.data.status == 200) {
|
|
247
|
+ this.online = res.data.online;
|
|
248
|
+ this.showToast(online, "成功");
|
|
249
|
+ }
|
|
250
|
+ });
|
|
251
|
+ } else {
|
234
|
252
|
this.toast.hide();
|
235
|
|
- if(res.data.status == 200){
|
236
|
|
- this.online = res.data.online;
|
237
|
|
- this.showToast(online, '成功')
|
238
|
|
- }
|
239
|
|
- });
|
240
|
|
- }else{
|
241
|
|
- this.toast.hide();
|
242
|
|
- this.showToast(online, '失败')
|
243
|
|
- }
|
244
|
|
- })
|
|
253
|
+ this.showToast(online, "失败");
|
|
254
|
+ }
|
|
255
|
+ });
|
245
|
256
|
},
|
246
|
|
- }).show()
|
|
257
|
+ }).show();
|
247
|
258
|
}
|
248
|
259
|
});
|
249
|
260
|
},
|
250
|
261
|
// 展示信息
|
251
|
|
- showToast(online, msg){
|
|
262
|
+ showToast(online, msg) {
|
252
|
263
|
const t = this.$createToast({
|
253
|
264
|
type: "txt",
|
254
|
|
- txt: online == 1 ? "上班"+msg : "下班"+msg
|
|
265
|
+ txt: online == 1 ? "上班" + msg : "下班" + msg,
|
255
|
266
|
});
|
256
|
267
|
t.show();
|
257
|
268
|
setTimeout(() => {
|
|
@@ -262,7 +273,7 @@ export default {
|
262
|
273
|
getGroups() {
|
263
|
274
|
var that = this;
|
264
|
275
|
if (that.loginUser.group) {
|
265
|
|
- that.loginUser.group.forEach(element => {
|
|
276
|
+ that.loginUser.group.forEach((element) => {
|
266
|
277
|
that.groups += element.groupName + "/";
|
267
|
278
|
that.candidateGroups += element.id + ",";
|
268
|
279
|
});
|
|
@@ -281,8 +292,8 @@ export default {
|
281
|
292
|
this.$router.push({
|
282
|
293
|
name: "Inspection",
|
283
|
294
|
params: {
|
284
|
|
- state: state
|
285
|
|
- }
|
|
295
|
+ state: state,
|
|
296
|
+ },
|
286
|
297
|
});
|
287
|
298
|
},
|
288
|
299
|
// 事件数量
|
|
@@ -291,42 +302,43 @@ export default {
|
291
|
302
|
this.$http
|
292
|
303
|
.post("service/bpm/data/getIncidentCount", {
|
293
|
304
|
assignee: that.loginUser.id,
|
294
|
|
- candidateGroups: that.candidateGroups
|
|
305
|
+ candidateGroups: that.candidateGroups,
|
295
|
306
|
})
|
296
|
|
- .then(function(res) {
|
|
307
|
+ .then(function (res) {
|
297
|
308
|
that.incidentCount = res.data;
|
298
|
309
|
});
|
299
|
310
|
},
|
300
|
311
|
//获取展示可以上下班人员列表
|
301
|
|
- getWorkOnline(){
|
|
312
|
+ getWorkOnline() {
|
302
|
313
|
this.isWorkLoading = true;
|
303
|
314
|
this.$http
|
304
|
|
- .post("service/bpm/data/fetchDataList/workOnlineConfig", {"idx":0,"sum":1000})
|
|
315
|
+ .post("service/bpm/data/fetchDataList/workOnlineConfig", {
|
|
316
|
+ idx: 0,
|
|
317
|
+ sum: 1000,
|
|
318
|
+ })
|
305
|
319
|
.then((res) => {
|
306
|
|
- if(res.status == 200){
|
307
|
|
- let userList = res.data.list[0].userList.map(v=>v.id);//用户id列表
|
|
320
|
+ if (res.status == 200) {
|
|
321
|
+ let userList = res.data.list[0].userList.map((v) => v.id); //用户id列表
|
308
|
322
|
this.isWorkOnline = userList.includes(this.loginUser.id);
|
309
|
|
- if(this.isWorkOnline){
|
310
|
|
- this.$http
|
311
|
|
- .post("service/auth/showOnlineBtn", {})
|
312
|
|
- .then((res) => {
|
313
|
|
- this.isWorkLoading = false;
|
314
|
|
- if(res.data.status == 200){
|
315
|
|
- this.online = res.data.online;
|
316
|
|
- }
|
317
|
|
- });
|
318
|
|
- }else{
|
|
323
|
+ if (this.isWorkOnline) {
|
|
324
|
+ this.$http.post("service/auth/showOnlineBtn", {}).then((res) => {
|
|
325
|
+ this.isWorkLoading = false;
|
|
326
|
+ if (res.data.status == 200) {
|
|
327
|
+ this.online = res.data.online;
|
|
328
|
+ }
|
|
329
|
+ });
|
|
330
|
+ } else {
|
319
|
331
|
this.isWorkLoading = false;
|
320
|
332
|
}
|
321
|
333
|
}
|
322
|
334
|
});
|
323
|
|
- }
|
|
335
|
+ },
|
324
|
336
|
},
|
325
|
337
|
created() {
|
326
|
338
|
this.getGroups();
|
327
|
339
|
this.getIncidentData();
|
328
|
340
|
this.getWorkOnline();
|
329
|
|
- }
|
|
341
|
+ },
|
330
|
342
|
};
|
331
|
343
|
</script>
|
332
|
344
|
<style scoped>
|