王浩宇 2 years ago
parent
commit
5c9045c9d0
  1. 27
      common/http.js
  2. 8
      pages.json
  3. 116
      pages/customer/customer.vue
  4. 206
      pages/general/general.vue
  5. 1
      pages/login/index.vue
  6. 80
      pages/supervise/supervise.vue
  7. 142
      pages/supervise/superviseList.vue

27
common/http.js

@ -77,6 +77,33 @@ export function post(url, data, header){
})
}
export function upload(url, data, header){
header.Authorization = `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`
const token = uni.getStorageSync("token")
if (token) {
header['Blade-Auth'] = 'bearer ' + token
}
return new Promise((resolve, reject)=>{
uni.uploadFile({
url:API_URL + url,
header:header,
filePath:data,
name:'file',
formData:{
filePath:'knFire',
dir:'image'
},
success:(res)=>{
resolve(res)
},
fail: (e) => {
reject(e)
}
})
})
}
function removeAll(){
uni.removeStorageSync("token")
}

8
pages.json

@ -31,6 +31,14 @@
"enablePullDownRefresh": false
}
}, {
"path": "pages/supervise/superviseList",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
}
],
"globalStyle": {

116
pages/customer/customer.vue

@ -1,12 +1,25 @@
//
<template>
<view style="min-height: 200vh;">
<view style="min-height: 100vh;background-color: #F3F3F3;">
<u-sticky>
<view style="background-color: #3A71FF;height: 90px;">
<image :src="applet+'/close.png'" style="width: 35px;height: 35px;margin-top: 40px;margin-left: 10px;" @tap="close"></image>
<view style="text-align: center;color: #fff;position: absolute;top: 49px;left: 40%;font-size: 17px;" >打卡记录</view>
</view>
</u-sticky>
<!-- <u-search v-if="isSearth" v-model="pageInfo.unitName" placeholder="请输入单位名称" @custom="search" :showAction="true" actionText="搜索" :animation="true"></u-search> -->
<uni-list class="custom-list">
<u-card class="custom-card" v-for="(val,index) in list"
:show-foot="false" :show-head="false">
<view slot="body" class="u-body-title">企业名称{{val.unitName}}</view>
<view slot="body" class="u-body-item-desc">日期{{val.siginDate}}</view>
<!-- <view slot="body" class="u-body-item-desc">应打卡{{val.num}}</view> -->
<view slot="body" class="u-body-item-desc">打卡时间</view>
<view slot="body" class="u-body-item-desc" style="display: flex;justify-content: space-between;width: 70%;margin-left: 10%;">
<view class="u-body-item-desc" v-for="item in val.ut.split(',')" >{{item}}</view>
</view>
</u-card>
</uni-list>
</view>
</template>
@ -15,19 +28,118 @@
data() {
return {
applet:this.$url.data.applet,
pageInfo:{
page:1,
limit:20,
unitName:'',
unitId:''
},
//isSearth:uni.getStorageSync("role_name") == 'SUPERVISE_USER',
// isSearth:true,
list:[]
}
},
onLoad() {
this.loadData()
this.pageInfo.unitId = uni.getStorageSync("dept_id")
},
methods: {
loadData(){
this.$http.get("/fire-customer/sign/record/customer/page",this.pageInfo,{}).then(res =>{
this.list = this.list.concat(res.data)
})
},
search(e){
this.pageInfo.page = 1;
this.list = [];
this.loadData()
// console.log(e)
},
close(){
uni.removeStorageSync("token")
uni.redirectTo({
url:'/pages/login/index'
})
}
},
onPullDownRefresh() {
this.pageInfo.page = 1;
this.list = [];
this.loadData();
//
uni.stopPullDownRefresh();
},
onReachBottom() {
this.pageInfo.page = this.pageInfo.page + 1;
this.loadData();
//
}
}
</script>
<style>
<style scoped lang="scss">
.CBlue {
background-image: linear-gradient(#7cc9ff,#1771d7);
box-shadow: 0 8px 8px #b0d2f3;
}
.module {
overflow: hidden;
margin: 20upx auto;
width: 260upx;
height: 260upx;
border-radius: 50%;
color: #fff;
text-align: center;
}
.module .text {
font-size: 20px;
margin: 80upx auto 10upx;
}
.custom-list {
background: #f1f1f4;
.custom-card {
//margin: 12rpx 24rpx !important;
position: relative;
.card-nav {
position: absolute;
float: right;
top: 40%;
right: 35rpx;
}
}
}
.u-body-title {
font-size: 32rpx;
color: #333;
}
.u-body-item {
padding: 0rpx;
}
.u-body-item-desc {
font-size: 28rpx;
color: #555;
padding: 0rpx;
}
.u-body-item image {
width: 160rpx;
flex: 0 0 160rpx;
height: 120rpx;
border-radius: 8rpx;
margin-left: 0rpx;
margin-right: 12rpx;
}
.u-margin-right-12 {
margin-right: 12rpx;
border: 0;
}
</style>

206
pages/general/general.vue

@ -7,33 +7,29 @@
<view style="text-align: center;color: #fff;position: absolute;top: 49px;left: 40%;font-size: 17px;" >值班打卡</view>
</view>
</u-sticky>
<view style="padding: 10px 10px;">
<view style="margin-bottom: 10px;">打卡时间范围</view><view v-for="item in ruleList" style="font-size: 12px;padding-left: 10px;">{{item.startTime}} ~ {{item.endTime}}</view>
<view style="margin: 10px auto;border: 1px #b7b7b7 dashed;width: 80%;border-radius: 6px;padding: 10px;background-color: #eaeaea;">
<view style="margin-bottom: 10px;text-align: center;">打卡时间范围</view><view v-for="item in ruleList" style="font-size: 12px;text-align: center;margin-top: 10px;">{{item.startTime}} ~ {{item.endTime}}</view>
</view>
<view style="margin-top: 60px;" @click="clickSign">
<view style="margin-top: 30px;" @click="clickSign">
<view class="module CBlue">
<view class="text">打卡</view>
<view class="time">{{time}}</view>
</view>
<view style="margin: 10px 0;text-align: center;font-size: 12px;">提示打卡需要获取您的位置还有您上传中控室的自拍照片</view>
<view style="margin: 10px 0;text-align: center;font-size: 12px;">提示打卡需要您上传中控室的自拍照片</view>
</view>
<view style="text-align: center;font-size: 12px;margin-top: 20px;">
<view v-for="item in ingDate" style="margin-top: 5px;"><image :src="applet+'/success.png'" style="width: 14px;height: 14px;margin-right: 5px;"></image>{{item}}已打卡</view>
<view v-for="item in ingDate" style="margin-top: 5px;"><image :src="applet+'/success.png'" style="width: 14px;height: 14px;margin-right: 5px;"></image>{{item.time}}已打卡</view>
</view>
<view style="padding: 10px 10px;">
<view>
<text>打卡记录</text>
</view>
<uni-list class="custom-list">
<u-card class="custom-card" v-for="(val,index) in list" @click="previewOpen(val)"
<u-card class="custom-card" v-for="(val,index) in list" @click="previewOpen(val.picUrl)"
:show-foot="false" :show-head="false">
<view slot="body" class="u-body-item u-flex">
<image :src="val.picUrl"
mode="aspectFill"></image>
<view>
<view class="u-body-item-desc">姓名:{{val.name}}</view>
<view class="u-body-item-desc">打卡时间:{{val.time}}</view>
</view>
<view slot="body" class="u-body-item" style="display: flex;flex-wrap:nowrap;">
<view><image :src="val.picUrl" mode="aspectFill" style="width: 60px;height: 80px;"></image></view>
<view style="margin-left: 20px;line-height: 28px;margin-top: 11px;"><view>打卡时间:</view><view>{{val.time}}</view></view>
</view>
</u-card>
</uni-list>
@ -44,20 +40,35 @@
<script>
import { formatterDateTime } from "@/common/utils.js"
import config from "../../uni_modules/uview-ui/libs/config/config"
var interval = null
export default {
data() {
return {
pageInfo:{
page:1,
limit:20,
userId:uni.getStorageSync("user_id"),
unitId:uni.getStorageSync("dept_id")
},
applet:this.$url.data.applet,
time: formatterDateTime(new Date(), 'h:min:s'),
date:formatterDateTime(new Date(), 'Y-M-D'),
lnt:'',
ingDate:['9:30','10:00','11:00'],
ingDate:[],
list:[],
ruleList:[{startTime:'2023-07-20 08:00:00',endTime:'2023-07-20 16:00:00'},{startTime:'2023-07-20 08:00:00',endTime:'2023-07-20 16:00:00'},{startTime:'2023-07-20 08:00:00',endTime:'2023-07-20 16:00:00'}]
//ruleList:[{startTime:'2023-07-20 08:00:00',endTime:'2023-07-20 16:00:00'},{startTime:'2023-07-20 08:00:00',endTime:'2023-07-20 16:00:00'},{startTime:'2023-07-20 08:00:00',endTime:'2023-07-20 16:00:00'}]
ruleList:[],
serverTime:'',
form:{},
taskId:''
}
},
onLoad() {
this.getTime()
this.initRuleList()
this.getRecordByToday()
this.loadData()
},
onHide() {
clearInterval(interval)
@ -66,52 +77,118 @@
this.getTime()
},
methods: {
close(){
clearInterval(interval)
uni.removeStorageSync("token")
uni.redirectTo({
url:'/pages/login/index'
initRuleList(){
this.$http.get("/fire-customer/sign/getRuleByUnitIdAndDate",{unitId:uni.getStorageSync("dept_id"),date:this.date},{}).then(res =>{
this.ruleList = res.data
})
},
clickSign(){
this.getLocation().then((res)=>{
uni.chooseMedia({
count:1,
mediaType:['image'],
sourceType:['camera'],
camera:'front',
success:(tempFiles)=>{
console.log(tempFiles)
}
getRecordByToday(){
//
this.$http.get("/fire-customer/sign/getRecordByUserIdAndDate",{userId:uni.getStorageSync("user_id"),unitId:uni.getStorageSync("dept_id"),date:this.date},{}).then(res =>{
this.ingDate = res.data
this.ingDate.forEach(ingDate =>{
this.ruleList.forEach((rule,index)=>{
if(ingDate.taskId == rule.id){
// this.ruleList[index].bb = true
rule.bb = true
}
})
})
})
},
getLocation() {
uni.showLoading({
title: "获取位置中...",
mask: true
loadData(){
this.$http.get("/fire-customer/sign/record/user/page",this.pageInfo,{}).then(res =>{
this.list = this.list.concat(res.data.records)
})
},
clickSign(){
this.$http.get("/fire-customer/sign/getServerTime",{},{}).then(res =>{
this.serverTime = res.data
let n = new Date(res.data).getTime()
let bl = false
try {
this.ruleList.forEach((rule) =>{
let s = new Date(rule.startTime).getTime()
let e = new Date(rule.endTime).getTime()
if(s <= n && n<= e){
if(rule.bb){
uni.showToast({
icon:'none',
title:'该时间段已打卡,请勿重复打卡'
})
bl = true
return false
}
rule.bb = true
this.taskId = rule.id
bl = true
this.getDw()
throw new Error("停止循环");
}
})
} catch(e){
throw e;
}
if(!bl){
uni.showToast({
icon:"none",
title:"不在打卡时间范围!请到点打卡!"
})
return false
}
})
return new Promise((resolve, reject)=>{
uni.getLocation({
type: 'gcj02', //uni.openLocation
geocode: true,
success:(res)=> {
uni.hideLoading();
this.lnt = res.longitude + ',' + res.latitude;
resolve()
},
fail(err) {
uni.hideLoading();
},
getDw(){
this.getLocation()
this.getCam()
},
getCam(){
uni.chooseMedia({
count:1,
mediaType:['image'],
sourceType:['camera'],
camera:'front',
success:(e)=>{
uni.showLoading({
title: "上传图片...",
mask: true
})
let te = e.tempFiles[0].tempFilePath
//"{"code":200,"success":true,"data":"https://keningfile.oss-cn-shenzhen.aliyuncs.com/knFire/image/20230724/20230724180751_446.jpg","msg":""}"
this.$http.upload('/fire-customer/knAliOss/uploadVadioFile',te,{}).then(res=>{
let ddd = JSON.parse(res.data)
this.form.picUrl = ddd.data
this.form.locate = this.lnt
this.form.time = this.serverTime
this.form.userId = uni.getStorageSync("user_id")
this.form.unitId = uni.getStorageSync("dept_id")
this.form.date = this.date
this.form.taskId = this.taskId
this.$http.post('/fire-customer/sign/addRecord',this.form,{}).then(res =>{
uni.hideLoading()
this.getRecordByToday()
this.pageInfo.page = 1;
this.list = [];
this.loadData();
})
}).catch(e=>{
uni.hideLoading()
uni.showToast({
title: "请检查位置信息状态!",
icon: "none",
mask: true,
duration: 3000
icon:'error',
title:'请重试..'
})
reject()
}
})
})
}
})
},
getLocation() {
uni.getLocation({
type: 'gcj02', //uni.openLocation
geocode: true,
success:(res)=> {
this.lnt = res.longitude + ',' + res.latitude;
}
})
},
getTime() {
@ -124,6 +201,27 @@
urls:[e]
})
},
close(){
clearInterval(interval)
uni.removeStorageSync("token")
uni.redirectTo({
url:'/pages/login/index'
})
}
},
onPullDownRefresh() {
this.pageInfo.page = 1;
this.list = [];
this.loadData();
this.getRecordByToday()
//
uni.stopPullDownRefresh();
},
onReachBottom() {
this.pageInfo.page = this.pageInfo.page + 1;
this.loadData();
//
},
onUnload() {
clearInterval(interval)
@ -156,7 +254,7 @@
background: #f1f1f4;
.custom-card {
margin: 12rpx 24rpx !important;
//margin: 12rpx 24rpx !important;
position: relative;
.card-nav {

1
pages/login/index.vue

@ -131,6 +131,7 @@
uni.setStorageSync("role_id",res.role_id)
uni.setStorageSync("role_name",res.role_name)
uni.setStorageSync("tenant_id",res.tenant_id)
uni.setStorageSync("regionId",res.detail.otherInfo.regionId)
}
}
}

80
pages/supervise/supervise.vue

@ -1,11 +1,11 @@
//
<template>
<view style="min-height: 100vh;">
<view :style="{background: 'url('+applet+'/jg/banner.png) no-repeat',height:'30vh',backgroundSize:'100%'}">
<view>
<view :style="{background: 'url('+applet+'/jg/banner.png) no-repeat',height:'23vh',backgroundSize:'100%'}">
<image :src="applet+'/close.png'" style="width: 35px;height: 35px;margin-top: 40px;margin-left: 10px;"
@tap="close"></image>
</view>
<view style="height: calc(100vh - 30vh);padding: 10px;"
<view style="height: calc(100vh - 24vh);padding: 10px;margin-top: -12px;"
:style="{background: 'url('+applet+'/jg/bg.png) no-repeat',backgroundSize:'100% 100%'}">
<view class="charts-box">
<qiun-data-charts type="arcbar" :opts="opts" :chartData="chartData" />
@ -13,33 +13,33 @@
<view class="home-left-bottom">
<view class="home-left-bottom-item"
:style="{background: 'url('+applet+'/jg/unit1_bg.png) no-repeat',backgroundSize:'100% 100%'}"
@click="gourl('/pages/massif/addMassif')">
@click="gourl('/pages/supervise/superviseList?type=')">
<view class="text">
<view class="ttt1" >567</view>
<view class="ttt1" >{{val.unitCount}}</view>
<view class="ttt">联网单位</view>
</view>
</view>
<view class="home-left-bottom-item"
:style="{background: 'url('+applet+'/jg/unit2_bg.png) no-repeat',backgroundSize:'100% 100%'}"
@click="gourl('/pages/device/binding')">
@click="gourl('/pages/supervise/superviseList?type=0')">
<view class="text">
<view class="ttt1" >567</view>
<view class="ttt1" >{{val.qualified}}</view>
<view class="ttt">已打卡单位</view>
</view>
</view>
<view class="home-left-bottom-item"
:style="{background: 'url('+applet+'/jg/unit3_bg.png) no-repeat',backgroundSize:'100% 100%'}"
@click="gourl('/pages/task/add')">
@click="gourl('/pages/supervise/superviseList?type=1')">
<view class="text">
<view class="ttt1" >567</view>
<view class="ttt1" >{{val.imperfect}}</view>
<view class="ttt">未完全打卡单位</view>
</view>
</view>
<view class="home-left-bottom-item"
:style="{background: 'url('+applet+'/jg/unit4_bg.png) no-repeat',backgroundSize:'100% 100%'}"
@click="gourl('/pages/device/perceptionConf')">
@click="gourl('/pages/supervise/superviseList?type=2')">
<view class="text">
<view class="ttt1" >567</view>
<view class="ttt1" >{{val.unqualified}}</view>
<view class="ttt">未打卡单位</view>
</view>
</view>
@ -49,6 +49,9 @@
</template>
<script>
import {
formatterDateTime
} from "@/common/utils.js"
export default {
data() {
return {
@ -59,47 +62,66 @@
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
"#ea7ccc"
],
padding: undefined,
title: {
name: "80%",
fontSize: 35,
color: "#2fc25b"
name: "0%",
fontSize: 25,
color: "#3971ff"
},
padding: undefined,
subtitle: {
name: "正确率",
fontSize: 25,
color: "#666666"
name: "在岗率",
fontSize: 18,
color: "#333"
},
extra: {
arcbar: {
type: "circle",
width: 12,
backgroundColor: "#E9E9E9",
backgroundColor: "#ffffff",
startAngle: 1.5,
endAngle: 0.25,
gap: 2,
linearType: "custom"
}
}
}
},
val:{},
date:formatterDateTime(new Date(), 'Y-M-D'),
dateTime:formatterDateTime(new Date(), 'Y-M-D h:min:s'),
regionId:uni.getStorageSync("regionId")
}
},
onLoad() {
this.loadCharts()
this.loadData()
},
methods: {
loadCharts() {
loadData(){
this.$http.get("/fire-customer/sign/record/supervise",{
date:this.date,dateTime:this.dateTime,regionId:this.regionId
},{}).then(res =>{
this.val = res.data
this.opts.title.name = res.data.rate != 'NaN' ? res.data.rate.toFixed(2) *100 +"%" : '0%'
this.loadCharts(res.data.rate)
})
},
loadCharts(e) {
let res = {
title:{
name:e
},
series: [{
name: "正确率",
color: "#2fc25b",
data: 0.8
name: "在岗率",
color: "#3971ff",
data: e
}]
};
this.chartData = JSON.parse(JSON.stringify(res));
},
gourl(){
gourl(e){
uni.navigateTo({
url:e+ "&date="+this.date+ "&dateTime="+this.dateTime
})
},
close() {
uni.removeStorageSync("token")
@ -115,7 +137,9 @@
.charts-box {
width: 50%;
height: 200px;
margin: 0 auto;
margin: 30px auto;
// background-color: #fff;
// border-radius: 50%;
}
.home-left-bottom {
width: 100%;

142
pages/supervise/superviseList.vue

@ -0,0 +1,142 @@
//
<template>
<view style="min-height: 100vh;background-color: #F3F3F3;">
<u-sticky>
<view style="background-color: #3A71FF;height: 90px;">
<image :src="applet+'/back.png'" style="width: 20px;height: 20px;margin-top: 55px;margin-left: 10px;" @tap="close"></image>
<view style="text-align: center;color: #fff;position: absolute;top: 49px;left: 40%;font-size: 17px;" >打卡记录</view>
</view>
</u-sticky>
<view >
<u-search bgColor="#fff" v-model="pageInfo.unitName" placeholder="请输入单位名称" @custom="search" :showAction="true" actionText="搜索" :animation="true"></u-search>
</view>
<uni-list class="custom-list">
<u-card class="custom-card" v-for="(val,index) in list"
:show-foot="false" :show-head="false">
<view slot="body" class="u-body-title">企业名称{{val.unitName}}</view>
<view slot="body" class="u-body-item-desc">应打卡{{val.sum}}</view>
<view slot="body" class="u-body-item-desc">已打卡{{val.recnum}}</view>
<view slot="body" class="u-body-item-desc">打卡时间</view>
<view slot="body" class="u-body-item-desc" style="display: flex;justify-content: space-between;width: 70%;margin-left: 10%;">
<view class="u-body-item-desc" v-for="item in val.ut.split(',')" >{{item}}</view>
</view>
</u-card>
</uni-list>
</view>
</template>
<script>
export default {
data() {
return {
applet:this.$url.data.applet,
pageInfo:{
page:1,
limit:20,
unitName:'',
date:'2023-07-25',
dateTime:'2023-07-25 15:00:00',
regionId:'',
type:''
},
list:[]
}
},
onLoad(e) {
this.pageInfo.type = e.type
this.pageInfo.regionId = uni.getStorageSync("regionId")
this.pageInfo.date = e.date
this.pageInfo.dateTime = e.dateTime
this.loadData()
},
methods: {
loadData(){
this.$http.get("/fire-customer/sign/record/supervise/page",this.pageInfo,{}).then(res =>{
this.list = this.list.concat(res.data)
})
},
search(e){
this.pageInfo.page = 1;
this.list = [];
this.loadData()
// console.log(e)
},
close(){
uni.navigateBack()
}
},
onPullDownRefresh() {
this.pageInfo.page = 1;
this.list = [];
this.loadData();
//
uni.stopPullDownRefresh();
},
onReachBottom() {
this.pageInfo.page = this.pageInfo.page + 1;
this.loadData();
//
}
}
</script>
<style scoped lang="scss">
.CBlue {
background-image: linear-gradient(#7cc9ff,#1771d7);
box-shadow: 0 8px 8px #b0d2f3;
}
.module {
overflow: hidden;
margin: 20upx auto;
width: 260upx;
height: 260upx;
border-radius: 50%;
color: #fff;
text-align: center;
}
.module .text {
font-size: 20px;
margin: 80upx auto 10upx;
}
.custom-list {
background: #f1f1f4;
.custom-card {
position: relative;
}
}
.u-body-title {
font-size: 32rpx;
color: #333;
}
.u-body-item {
padding: 0rpx;
}
.u-body-item-desc {
font-size: 28rpx;
color: #555;
padding: 0rpx;
}
.u-body-item image {
width: 160rpx;
flex: 0 0 160rpx;
height: 120rpx;
border-radius: 8rpx;
margin-left: 0rpx;
margin-right: 12rpx;
}
.u-margin-right-12 {
margin-right: 12rpx;
border: 0;
}
</style>
Loading…
Cancel
Save