提交 3381a0dd 编写于 作者: 刘英杰's avatar 刘英杰

添加值班角色、添加签到状态的查询、更改消息推送返回路由,增加已签到标识、

上级 63515242
......@@ -49,10 +49,10 @@ const getTokenActionWx = async (date) => {
}
const getToken = async () => {
if (Number(router.currentRoute.value.query.type) === 2) {
Cookies.set('token', router.currentRoute.value.query.token)
// Cookies.set('token', router.currentRoute.value.query.token)
// localStorage.setItem('token', router.currentRoute.value.query.token)
let date = {
token: Cookies.get('token')
token: router.currentRoute.value.query.token
}
await getTokenAction(date)
} else if (Number(router.currentRoute.value.query.type) === 1) {
......
......@@ -71,7 +71,7 @@ onMounted(() => {
getDutyMessage()
})
const onClickLeft = () => router.push({
name: 'welcome'
name: 'signList'
});
</script>
<style>
......
......@@ -37,7 +37,8 @@
<van-dropdown-menu :overlay="false">
<van-dropdown-item @close="closeMenu" :key="myDuty.menuKey" @open="openMenu" title="日期">
<template #default>
<van-calendar v-model:show="myDuty.show" type="range" @confirm="dateRange"/>
<van-calendar :minDate="myDuty.minDate"
:maxDate="myDuty.maxDate" v-model:show="myDuty.show" type="range" @confirm="dateRange"/>
</template>
</van-dropdown-item>
<van-dropdown-item v-model="myDuty[item[2]]" v-for="(item,index) in myDuty.addDutySelectList" :key="index"
......@@ -96,21 +97,21 @@
<van-popup v-model:show="changeShiftsPickerShow" round position="bottom">
<!-- 搜索框 -->
<van-search
v-model="changeSftInput"
placeholder="请输入姓名或工号"
@update:model-value="searchChange"/>
v-model="changeSftInput"
placeholder="请输入姓名或工号"
@update:model-value="searchChange"/>
<!-- 选择器 -->
<van-picker
:columns="userList"
:loading="pickerLoading"
@cancel="pickerCancel"
@confirm="pickerConfirm"
:columns="userList"
:loading="pickerLoading"
@cancel="pickerCancel"
@confirm="pickerConfirm"
/>
</van-popup>
</template>
<style scoped lang="less">
.container {
//box-sizing: border-box; //background-color: #706c6c; //width: 100%; //height: 100%; //min-height: 896px; //display: flex; //flex-wrap: wrap; //justify-content: center; //align-content: flex-start;
//box-sizing: border-box; //background-color: #706c6c; //width: 100%; //height: 100%; //min-height: 896px; //display: flex; //flex-wrap: wrap; //justify-content: center; //align-content: flex-start;
.cardContainer {
......@@ -141,6 +142,8 @@ import Cookies from 'js-cookie'
const onClickLeft = () => history.back();
let myDuty = reactive({
minDate: new Date(dayjs().year(), dayjs().month() - 1, 1),
maxDate: new Date(dayjs().year(), dayjs().month() + 1, 1),
addDutySelectList: [],
DatePickerKey: 1,
showCenter: false,
......@@ -243,6 +246,7 @@ const onLoad = async () => {
"page_size": myDuty.page_size,
}
const res = await api.GetWatchList(data)
// showToast('刷新成功!')
list.value = res.response.data
myDuty.total = res.response.data_count
// 异步更新数据
......@@ -254,7 +258,7 @@ const onLoad = async () => {
// 数据全部加载完成
if (list.value.length >= Number(myDuty.total)) {
finished.value = true;
showToast('加载完成!')
// showToast('加载完成!')
} else if (list.value.length < Number(myDuty.total)) {
myDuty.page_size = myDuty.page_size + 10
......@@ -304,6 +308,7 @@ function pickerChgSftOpen(obj) {
changeShiftsPickerShow.value = true
attendanceObj.value = obj
}
// 搜索值改变
function searchChange(val) {
pickerLoading.value = true
......@@ -324,6 +329,7 @@ function searchChange(val) {
pickerLoading.value = false
})
}
// 换班选择器确认
function pickerConfirm(val) {
// console.log('选择器确认', val)
......@@ -352,6 +358,7 @@ function pickerConfirm(val) {
})
}
// 换班选择器取消
function pickerCancel() {
changeShiftsPickerShow.value = false
......
......@@ -28,8 +28,6 @@
</van-floating-bubble>
<div style="position: fixed;z-index: 2;width: 100%">
<!-- &lt;!&ndash; 圆角弹窗(居中) &ndash;&gt;-->
<van-popup v-model:show="signList.showCenter" round style="width: 100%; padding: 10px;">
<template v-slot:default>
......@@ -56,7 +54,24 @@
left-text="返回"
left-arrow
@click-left="onClickLeft"
></van-nav-bar>
>
<template v-slot:title><span style="margin-right: 20vw">签到列表</span></template>
<template v-slot:right>
<van-tabs v-model:active="signList.is_lead" shrink type="card" @click-tab="tabs">
<van-tab title="教师">
<template v-slot:title>
<span style="">值班教师</span>
</template>
</van-tab>
<van-tab title="领导">
<template v-slot:title>
<span style="">值班领导</span>
</template>
</van-tab>
</van-tabs>
</template>
</van-nav-bar>
<van-search
v-model="searchValue"
shape="round"
......@@ -64,13 +79,19 @@
/>
<van-dropdown-menu :overlay="false">
<van-dropdown-item v-model="signList.sign" title="状态"
:options="signList.signClass"></van-dropdown-item>
<van-dropdown-item @close="closeMenu" :key="signList.menuKey" @open="openMenu" title="日期">
<template #default>
<van-calendar v-model:show="signList.show" type="range" @confirm="dateRange"/>
<van-calendar :max-date="signList.maxDate" :minDate="signList.minDate" v-model:show="signList.show"
type="range" @confirm="dateRange"/>
</template>
</van-dropdown-item>
<van-dropdown-item v-model="signList[item[2]]" v-for="(item,index) in signList.addDutySelectList" :key="index"
:title="item[1]" :options="item[0]"/>
</van-dropdown-menu>
</div>
......@@ -114,18 +135,18 @@
</template>
<template #value>
<van-button
v-if="item.card_name == userInfo.card_number && userInfo.role[0].indexOf('值班领导') != -1"
type="primary"
size="small"
@click="leadLog(item)">
v-if="item.card_name == userInfo.card_number && userInfo.role[0].indexOf('值班领导') != -1"
type="primary"
size="small"
@click="leadLog(item)">
查看日志
</van-button>
</template>
</van-cell>
<van-cell
class="cardContent"
title="签到"
v-if="item.card_name == userInfo.card_number && item.sign_type != 0">
class="cardContent"
title="签到"
v-if="item.card_name == userInfo.card_number && item.sign_type != 0">
<!-- <van-button
v-if="item.sign_type == 1 && item.sign < 2"
plain
......@@ -137,13 +158,22 @@
{{ `${item.sign == 0 ? '签到' : '签退'}` }}
</van-button> -->
<van-button
v-if="item.sign < 2"
size="small"
:plain="item.sign_type == 1"
:type="item.sign == 0 ? 'success' : 'primary'"
:disabled="signBtDis(item)"
@click="locSignIn(item)">
<van-icon name="edit" />
v-if="item.sign !== 0 && item.sign !==2"
size="small"
:disabled="true"
style="margin-right: 10px;"
>
<van-icon name="edit"/>
{{ `${item.sign == 1 ? '已签到' : ''}` }}
</van-button>
<van-button
v-if="item.sign < 2"
size="small"
:plain="item.sign_type == 1"
:type="item.sign == 0 ? 'success' : 'primary'"
:disabled="signBtDis(item)"
@click="locSignIn(item)">
<van-icon name="edit"/>
{{ `${item.sign == 0 ? '签到' : '签退'}` }}
</van-button>
<span v-else>签到完成</span>
......@@ -186,11 +216,11 @@
<!-- 定位打卡签到 -->
<van-action-sheet
v-model:show="signAcStShow"
ref="VAS"
style="height: 80%;"
:close-on-click-overlay="false"
:title="signObj.sign == 0 ? '签到' : '签退'">
v-model:show="signAcStShow"
ref="VAS"
style="height: 80%;"
:close-on-click-overlay="false"
:title="signObj.sign == 0 ? '签到' : '签退'">
<div style="padding: 16px;">
<div style="width: 80%; margin: auto;">
<img style="width: 100%;" :src="signImgUrl"/>
......@@ -205,20 +235,20 @@
<!-- 领导查看日志 -->
<van-action-sheet
v-model:show="logAcStShow"
ref="VASLog"
style="height: 80%;"
title="值班日志"
:close-on-click-overlay="false">
v-model:show="logAcStShow"
ref="VASLog"
style="height: 80%;"
title="值班日志"
:close-on-click-overlay="false">
<div style="padding: 16px;">
<van-field
id="teacherLog"
v-model="allLog"
readonly
autosize
label="教师日志"
label-align="top"
type="textarea"
id="teacherLog"
v-model="allLog"
readonly
autosize
label="教师日志"
label-align="top"
type="textarea"
/>
<van-sticky container="VAS" position="bottom" :offset-bottom="16">
<van-button type="primary" block @click="copyLog">复制</van-button>
......@@ -256,7 +286,7 @@
}
.container {
//box-sizing: border-box; //background-color: #706c6c; //width: 100%; //height: 100%; //min-height: 896px; //display: flex; //flex-wrap: wrap; //justify-content: center; //align-content: flex-start;
//box-sizing: border-box; //background-color: #706c6c; //width: 100%; //height: 100%; //min-height: 896px; //display: flex; //flex-wrap: wrap; //justify-content: center; //align-content: flex-start;
.cardContainer {
......@@ -285,9 +315,32 @@ import {showToast, showDialog, ActionSheet, closeToast, showSuccessToast, showFa
import Cookies from 'js-cookie'
import wx from "weixin-js-sdk"
import $ from "jquery";
import {useRouter} from "vue-router";
const onClickLeft = () => history.back();
let active = ref(1)
let signList = reactive({
minDate: new Date(dayjs().year(), dayjs().month() - 1, 1),
maxDate: new Date(dayjs().year(), dayjs().month() + 1, 1),
sign: 9,
signClass: [
{
text: '全部状态',
value: 9
},
{
text: '待签到',
value: "0"
},
{
text: '已签到',
value: 1
},
{
text: '已签退',
value: 2
},
],
addDutySelectList: [],
DatePickerKey: 1,
showCenter: false,
......@@ -305,7 +358,13 @@ let signList = reactive({
checked: [],
floatingBubble: false,
logId: '',
is_lead: 0,
})
const router = useRouter();
const onClickLeft = () => router.push({
name: 'welcome'
});
const list = ref([]);
const loading = ref(false);
const finished = ref(false);
......@@ -351,13 +410,21 @@ const logAcStShow = ref(false)
// 领导获取的教师日志
const allLog = ref('')
watch([searchValue, () => signList.watchtypeid, () => signList.watch_hour_id, () => signList.campusid, () => signList.dept_id, () => signList.checked], (newValue, oldValue) => {
watch([
searchValue,
() => signList.watchtypeid,
// () => signList.watch_hour_id,
() => signList.campusid,
() => signList.dept_id,
() => signList.sign,
() => signList.checked,
], (newValue, oldValue) => {
// console.log("🚀🚀🚀,", newValue[5])
if (newValue[0] || newValue[1] || newValue[2] || newValue[3] || newValue[4]) {
clearTimeout(signList.deleteSetTimeOut)
signList.deleteSetTimeOut = setTimeout(async () => {
await search()
showToast('操作成功!')
// showToast('操作成功!')
}, 500)
}
......@@ -366,7 +433,10 @@ watch([searchValue, () => signList.watchtypeid, () => signList.watch_hour_id, ()
signList.floatingBubble = !!signList.checked.length
}
}, {deep: true})
const tabs = (e) => {
signList.is_lead = e.name
onLoad()
}
const batch = async (value) => {
let data = []
signList.checked.map((cur, index) => {
......@@ -390,6 +460,11 @@ const onRefresh = async () => {
signList.loading = true
signList.startTime = dayjs().format('YYYY-MM-DD')
signList.endTime = dayjs().format('YYYY-MM-DD')
signList.sign = 9
signList.is_lead = 0
// signList.page_size = 5
list.value = []
await onLoad()
signList.loading = false
......@@ -417,7 +492,8 @@ const search = async () => {
"end_time": signList.endTime,
"type_id": signList.watchtypeid,
"watchhour_time": signList.watch_hour_id,
"is_lead": 3,
"is_lead": signList.is_lead,
sign: Number(signList.sign),
"campus_id": signList.campusid,
"page_index": signList.page_index,
"page_size": signList.page_size,
......@@ -436,12 +512,14 @@ const onLoad = async () => {
"end_time": signList.endTime,
"type_id": "",
"watchhour_time": "",
"is_lead": 3,
"is_lead": signList.is_lead,
sign: Number(signList.sign),
"campus_id": "",
"page_index": signList.page_index,
"page_size": signList.page_size,
}
const res = await api.GetSignRecordList(data)
list.value = res.response.data
signList.total = res.response.data_count
// 异步更新数据
......@@ -453,10 +531,10 @@ const onLoad = async () => {
// 数据全部加载完成
if (list.value.length >= Number(signList.total)) {
finished.value = true;
showToast('操作成功!')
// showToast('操作成功!')
} else if (list.value.length < Number(signList.total)) {
signList.page_size = signList.page_size + 10
// signList.page_index = signList.page_index + 1
}
}, 100)
}
......@@ -476,13 +554,13 @@ const openMenu = () => {
const addDutySearchSelectList = () => {
Promise.all([
getSearchSelectListPromiseAllAction("dutyType", '类型', "watchtypeid", api.GetWatchTypeSelect),
getSearchSelectListPromiseAllAction("dutyHourTime", '时段', "watch_hour_id", api.GetWatchHourTime),
// getSearchSelectListPromiseAllAction("dutyHourTime", '时段', "watch_hour_id", api.GetWatchHourTime),
getSearchSelectListPromiseAllAction("campusname", '校区', "campusid", api.GetWatchCampusSelect),
getSearchSelectListPromiseAllAction("dept_name", '部门', "dept_id", api.GetWatchDepSelect),
])
.then(res => {
signList.addDutySelectList = res
signList.DatePickerKey++
})
}
......@@ -506,6 +584,7 @@ function initWxPosition() {
const params = {
url: window.location.href.replace(window.location.hash, ""),
};
// var urla = `https://asc.hnasct.cn/wx/eicrs/api/GetJSSDK/GetWxConfig`
var urla = `${window.location.origin}/wx/eicrs/api/GetJSSDK/GetWxConfig`
api.GetWxInfo(urla, params).then((result) => {
let data = result;
......@@ -541,6 +620,7 @@ function initWxPosition() {
});
});
}
//获取定位
function getAddress() {
return new Promise((resolve, reject) => {
......@@ -582,6 +662,7 @@ function getAddress() {
})
}
// 地址解析
function geocoder(latitude, longitude) {
// var that = this;
......@@ -601,9 +682,9 @@ function geocoder(latitude, longitude) {
// console.log(data);
if (data.status == 0) {
address.value =
data.result.address_component.province +
data.result.address_component.city +
data.result.formatted_addresses.recommend;
data.result.address_component.province +
data.result.address_component.city +
data.result.formatted_addresses.recommend;
} else {
// that.$toast("获取地址失败");
showDialog({
......@@ -627,12 +708,12 @@ function geocoder(latitude, longitude) {
}
});
}
//GCJ02 转换为 WGS84
function gcj02towgs84(lng, lat) {
if (out_of_china(lng, lat)) {
return [lng, lat]
}
else {
} else {
var dlat = transformlat(lng - 105.0, lat - 35.0);
var dlng = transformlng(lng - 105.0, lat - 35.0);
var radlat = lat / 180.0 * PI.value;
......@@ -646,10 +727,12 @@ function gcj02towgs84(lng, lat) {
return [(lng * 2) - mglng, (lat * 2) - mglat];
}
}
//判断是否在国内,不在国内则不做偏移
function out_of_china(lng, lat) {
return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false);
}
function transformlat(lng, lat) {
var ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
ret += (20.0 * Math.sin(6.0 * lng * PI.value) + 20.0 * Math.sin(2.0 * lng * PI.value)) * 2.0 / 3.0;
......@@ -657,6 +740,7 @@ function transformlat(lng, lat) {
ret += (160.0 * Math.sin(lat / 12.0 * PI.value) + 320 * Math.sin(lat * PI.value / 30.0)) * 2.0 / 3.0;
return ret
}
function transformlng(lng, lat) {
var ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
ret += (20.0 * Math.sin(6.0 * lng * PI.value) + 20.0 * Math.sin(2.0 * lng * PI.value)) * 2.0 / 3.0;
......@@ -664,6 +748,7 @@ function transformlng(lng, lat) {
ret += (150.0 * Math.sin(lng / 12.0 * PI.value) + 300.0 * Math.sin(lng / 30.0 * PI.value)) * 2.0 / 3.0;
return ret
}
//根据经纬度计算两点之间的距离
function latlngDiff(lat1, lng1, lat2, lng2) {
var s = 999999999;
......@@ -673,21 +758,22 @@ function latlngDiff(lat1, lng1, lat2, lng2) {
var a = radLat1 - radLat2;
var b = Rad(lng1) - Rad(lng2);
s =
2 *
Math.asin(
Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) *
Math.cos(radLat2) *
Math.pow(Math.sin(b / 2), 2)
)
);
2 *
Math.asin(
Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) *
Math.cos(radLat2) *
Math.pow(Math.sin(b / 2), 2)
)
);
s = s * 6378137.0; // 取WGS84标准参考椭球中的地球长半径(单位:m)
s = Math.round(s * 10000) / 10000;
}
// console.log('定位距离',s);
return s;
}
function Rad(d) {
return (d * Math.PI) / 180.0;
}
......@@ -732,6 +818,7 @@ function locSignIn(obj) {
})
}
}
// 微信图片上传到本地
function getWxImgX(localId, date) {
showToast({
......@@ -741,7 +828,7 @@ function getWxImgX(localId, date) {
loadingType: "spinner",
type: "loading",
});
wx.getLocalImgData({
localId: localId.pop(),
success: function (resp) {
......@@ -751,8 +838,8 @@ function getWxImgX(localId, date) {
localData = "data:image/jpeg;base64," + localData;
}
localData = localData
// .replace(/\r|\n/g, "")
.replace("data:image/jgp", "data:image/jpeg");
// .replace(/\r|\n/g, "")
.replace("data:image/jgp", "data:image/jpeg");
const blobBin = atob(localData.split(",")[1]);
let data = [];
for (var i = 0; i < blobBin.length; i++) {
......@@ -762,8 +849,8 @@ function getWxImgX(localId, date) {
const name = `image.${localData.split(";")[0].split(":")[1].split("/")[1]}`;
let fileBlob = new Blob([new Uint8Array(data)], { type: type });
const file = new File([fileBlob], name, { type: type });
let fileBlob = new Blob([new Uint8Array(data)], {type: type});
const file = new File([fileBlob], name, {type: type});
afterRead(file, localId, date);
},
error: function (e) {
......@@ -771,6 +858,7 @@ function getWxImgX(localId, date) {
},
});
}
// 文件读取完成后的回调函数
function afterRead(file, localIds, date) {
// console.log(localIds);
......@@ -792,6 +880,7 @@ function afterRead(file, localIds, date) {
}
})
}
// 签到按钮
function signBt(obj) {
if (obj.sign != 2) {
......@@ -823,6 +912,7 @@ function signBt(obj) {
})
}
}
// 测试用,修改签到时间限制
// function changeSignTimeTest(obj) {
// if (obj.sign == 0) {
......@@ -853,6 +943,7 @@ function leadLog(obj) {
}
})
}
// 复制教师日志
function copyLog() {
// 创建input元素
......@@ -873,11 +964,9 @@ function copyLog() {
onMounted(() => {
addDutySearchSelectList()
signList.authUserInfo = Cookies.get('user-info').split('"').indexOf('值班领导') === -1 ? -1 : 1
api.GetAttendanceList().then(res => {
// console.log('获取考勤列表', res.response)
attendanceList.value = res.response
// 微信初始化
initWxPosition()
})
......
......@@ -15,7 +15,16 @@
<!-- <router-link to="/messageDetails">-->
<!-- <van-button>123123</van-button>-->
<!-- </router-link>-->
<van-cell-group style="width: 100%;margin-top: 10px">
<!-- <van-swipe @change="swiperNext" class="my-swipe" indicator-color="white">-->
<!-- <van-swipe-item>1</van-swipe-item>-->
<!-- <van-swipe-item>2</van-swipe-item>-->
<!-- <van-swipe-item>3</van-swipe-item>-->
<!-- <van-swipe-item style="color: red;">-->
<!-- </van-swipe-item>-->
<!-- </van-swipe>-->
<div class="dateContainer">
<div class="left" @click="reductionDate">
<span class="SlideButton"><van-icon name="arrow-left"/></span>
......@@ -38,7 +47,7 @@
<van-cell icon="manager-o" @click="myDuty" is-link class="cardTitle" title="我的值班" value="个人值班记录"/>
<van-cell icon="label-o" @click="signList" is-link class="cardTitle" title="签到列表" value="教师签到"/>
</van-cell-group>
<van-cell-group v-for="(item,index) in GetWatchListObject.GetWatchListInitArray" :key="index" inset
style="width: 100%" class="cardContainer">
<van-cell class="cardContent" :title="item.username">
......@@ -58,7 +67,6 @@
<template #extra>
<van-tag type="primary" plain>
<span>{{ item.watchtypename + '-' + item.dept_name + '-' + item.campusname }}</span></van-tag>
</template>
</van-cell>
</van-cell-group>
......@@ -105,6 +113,12 @@ let GetWatchListObject = reactive({
GetWatchListInitArray: [],
})
const swiperPrev = () => {
console.log("🚀swiperPrev🚀🚀,",)
}
const swiperNext = (e) => {
console.log("🚀🚀swiperNext🚀,", e)
}
const onRefresh = async () => {
dateArray.loading = true
GetWatchListObject.startTime = dayjs().format('YYYY-MM-DD')
......@@ -263,6 +277,14 @@ onMounted(() => {
})
</script>
<style scoped lang="less">
.my-swipe .van-swipe-item {
width: 100px;
color: #fff;
font-size: 20px;
line-height: 150px;
text-align: center;
background-color: #39ed81;
}
.container {
.dateContainer {
......@@ -294,7 +316,7 @@ onMounted(() => {
.content {
width: 11.42%;
height: 50px;
//border-radius:150%; //background-color: red;
//border-radius:150%; //background-color: red;
}
......@@ -316,7 +338,7 @@ onMounted(() => {
height: 20%;
.cardContent {
//height: 150px;
//height: 150px;
}
}
......
......@@ -15,9 +15,8 @@ export default defineConfig({
],
base: './',
server: {
// host: "127.0.0.1",
// host: "0.0.0.0",
// cors: true,
// port: 8991,
// open: true, //自动打开
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或