Files

820 lines
22 KiB
Vue
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page">
<!-- 时间助手 -->
<view class="main">
<text class="title">时间助手</text>
</view>
<view class="page-body">
<lxCalendar @change="changeCalender" style="margin-top: 60px;"></lxCalendar>
<view class="arrange" v-if="clickDayList.length==0">暂无日程</view>
<view class="arrange-detail" v-else>
<text class="arrange-date">{{dateDetail[1]}}月{{dateDetail[2]}}日</text>
<scroll-view
scroll-y="true"
scroll-x="true"
style="height: auto;scroll-behavior: smooth;"
v-for="(item,index) in clickDayList" :key="index">
<view class="container"
@touchstart="touchS($event,index,item)"
@touchmove="touchM($event,index,item)"
@touchend="touchE($event,index,item)"
:style="{'left': (currIndex==index?leftStyle + 'rpx':'')}">
<view class="detail-table-class"
style="display: flex;flex-direction: row;margin-left: 18px;">
<view style="height: 160rpx;flex-shrink: 0;
box-shadow: 0px 0px 18px rgba(0, 0, 0, 0.05);
background: rgba(255, 255, 255, 1)
border-radius: 7.25px;"
:style="{width:sildWidth+'px'}"
@click="arrangeClick(item,index)">
<view class="arrange-time">
<image class="img" src="../../../static/tabbar/cleandar.png"></image>
<text class="time">{{item.FSTARTTIME}}~{{item.FENDTIME}}</text>
</view>
<view class="detail-info" :style="{width:(sildWidth-60)+'px'}">{{item.FCONTENT ? item.FCONTENT : ''}}</view>
</view>
<view class="delete-icon" v-show="item.iconDel"
style="height: 160rpx;width: 80px;flex-shrink: 0;
box-shadow: 0px 0px 18px rgba(0, 0, 0, 0.05);
background: rgba(255, 255, 255, 1)
border-radius: 7.25px;"
@click="delItem(item,index)">
<img src="../../../static/tabbar/iconDel.png"></image>
</view>
</view>
</view>
</scroll-view>
<view style="height: 10px;width:100%;margin-left: 18px;box-shadow: 0px 0px 18px rgba(0, 0, 0, 0.05);" :style="{width:sildWidth+'px'}"></view>
</view>
</view>
<image class="add" src="../../../static/home/add.png" @click="addSchedule"></image>
<view class="alter" v-if="otherShow" @click="hideAlter"></view>
<view class="sparePart" v-show="addShow">
<view class="top-row-class" style="border-bottom: solid rgba(235, 237, 240, 1) 1px;">
<!-- <input class="selCondition-alter" style="height: 60rpx;" placeholder="新建日程" v-model="FTitle"
placeholder-style="color: #666666;font-size:28rpx;color:#666666"/> -->
<view class="selCondition-alter" style="height: 60rpx;" v-if="!isAddarrange">编辑日程</view>
<view class="selCondition-alter" style="height: 60rpx;" v-if="isAddarrange">新建日程</view>
</view>
<view class="top-row-class">
<view class="selCondition-date" @click="creatDatePicker()">{{creatlist[0].detail}}</view>
-
<view class="selCondition-date" @click="happenDatePicker()">{{happenlist[0].detail}}</view>
</view>
<date-time-picker ref='creatTime' :indicatorStyle='indicatorStyle'
:type='type' :datestring='dateString' @change='creatTimeChange'>
</date-time-picker>
<date-time-picker ref='happenTime' :indicatorStyle='indicatorStyle'
:type='type' :datestring='dateString' @change='happenTimeChange'>
</date-time-picker>
<view class="top-row-class" style="display: flex;flex-direction: column;align-items: flex-start;">
<!-- <text class="top-row-title-class-add">内容:</text> -->
<textarea class="selCondition-alter" placeholder="" v-model="FCondition"
placeholder-style="color: #666666;padding: 5rpx 10rpx;font-size:28rpx"
style="text-align: left;background: rgba(247, 247, 247, 1);"></textarea>
</view>
<view class="confirmBtn" @click="confirm">保存</view>
</view>
<view class="tabBar">
<view class="tabBar-item" @click="mainSelectF">
<view v-show="mainSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/main2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">首页</text>
</view>
<view v-show="!mainSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/main2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">首页</text>
</view>
</view>
<view class="tabBar-item" @click="applySelectF">
<view v-show="applySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/apply2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">应用</text>
</view>
<view v-show="!applySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/apply2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">应用</text>
</view>
</view>
<view class="tabBar-item" @click="cleandarSelectF">
<view v-show="cleandarSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/cleandar2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">日程</text>
</view>
<view v-show="!cleandarSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/cleandar2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">日程</text>
</view>
</view>
<view class="tabBar-item" @click="mySelectF">
<view v-show="mySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/my2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">我的</text>
</view>
<view v-show="!mySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/my2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">我的</text>
</view>
</view>
</view>
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
>
</opsoft-dialog-notice>
</view>
</template>
<script>
import Vue from 'vue';
import {
mapState
} from 'vuex';
import uniGrid from '@/components/uni-grid/uni-grid.vue'
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue'
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue'
import uniList from '@/components/uni-list/uni-list.vue'
import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
import yomolUpgrade from '@/components/yomol-upgrade/yomol-upgrade.vue';
import lxCalendar from '@/components/lx-calendar/lx-calendar.vue';
import DateTimePicker from '@/components/bory-dateTimePicker/bory-dateTimePicker.vue';
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
// import log from "@/common/log.js";
export default {
components: {
uniList,
uniCalendar,
uniListItem,
uniGrid,
uniGridItem,
yomolUpgrade,
lxCalendar,
DateTimePicker,
opsoftDialogNotice
},
data() {
return {
sildWidth:'',
leftStyle: 0,
startX: 0,
hiddenFlag: true,
delBtnWidth: 80,
currIndex:0,
mainSelect: false,
applySelect: false,
cleandarSelect: true,
mySelect: false,
clickDay: '',
dateDetail: [],
arrangeList: [],
clickDayList: [],
otherShow:false,
addShow:false,
dateString: '',
type: 'hour-minute',
creatlist: [{
type: 'hour-minute',
detail: '选择开始时间'
}],
happenlist: [{
type: 'hour-minute',
detail: '选择结束时间'
}],
FTitle:"",
FCondition:"",
isAddarrange:false,
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
FINTERID:'',
}
},
computed: {
indicatorStyle() {
return {
background: 'rgba(255,0,0,.2)',
height: '40px',
};
}
},
onShow() {
const res = uni.getSystemInfoSync();
this.sildWidth = (res.windowWidth - 36)
let date = new Date;
let curDate = date.getFullYear()+'/'+(date.getMonth()+1)+'/'+date.getDate();
this.clickDay = curDate;
this.dateDetail = curDate.split('/');
this.getPersonalInfo(curDate);
},
methods: {
dialogNoticeConfirmClick(){
this.showDialog = false;
},
dialogProps(err){
err = errorStrUntil.handle(err);
this.showDialog = true;
this.dialogNoticeType = 'error';
this.dialogNoticeTitle = '异常提示';
this.dialogNoticeContent = err;
},
addSchedule() {
this.isAddarrange = false;
this.addShow = true;
this.otherShow = true;
this.isAddarrange = true;
this.selectFINTERID = '';
this.creatlist[0].detail = '选择开始时间';
this.happenlist[0].detail = '选择结束时间';
this.FTitle = '';
this.FCondition = '';
},
arrangeClick:function(item,index){
this.isAddarrange = true;
this.addShow = true;
this.otherShow = true;
this.isAddarrange = false;
this.selectFINTERID = item.FINTERID;
this.creatlist[0].detail = item.FSTARTTIME;
this.happenlist[0].detail = item.FENDTIME;
this.FTitle = item.FNAME;
this.FCondition = item.FCONTENT;
},
hideAlter(){
this.addShow = false;
this.otherShow = false;
},
creatDatePicker() {
this.type = 'hour-minute';
this.$refs['creatTime'].show();
},
creatTimeChange(value) {
let item = this.creatlist[0];
item['detail'] = value;
},
happenDatePicker() {
this.type = 'hour-minute';
this.$refs['happenTime'].show();
},
happenTimeChange(value) {
let item = this.happenlist[0];
item['detail'] = value;
},
changeCalender(e) {
let _self = this;
this.dateDetail = e.fulldate.replace(/-(\d)(?!\d)/g, '-0$1').trim().split("-");
this.clickDay = e.fulldate.replace(/\-/g, "\/");
this.getPersonalInfo(this.clickDay);
},
getPersonalInfo(curDate) {
let _self = this;
let requestParams = {
"dateTime":curDate,
"fInterID":this.FINTERID ? this.FINTERID : "''"
};
uni.showLoading({
title:'加载中……',
mask:true
})
// log.writeLog(requestParams, false);
this.$request.get('/SysConfigData/PersonDiary',{params:requestParams})
.then(res => {
uni.hideLoading();
let datalist = res;
this.clickDayList = datalist;
this.clickDayList.forEach(
function(el){
let sTime = el.FSTARTTIME.split(" ");
let eTime = el.FENDTIME.split(" ");
sTime = sTime[1].split(":");
eTime = eTime[1].split(":");
el.FSTARTTIME = sTime[0]+":"+sTime[1];
el.FENDTIME = eTime[0]+":"+eTime[1];
el.iconDel = false;
}
);
this.arrangeList = datalist;
})
.catch(err => {
uni.hideLoading();
console.log()
if(err.message == '未找到日志信息'){
this.arrangeList = [];
this.clickDayList = [];
}else{
this.dialogProps(err)
}
});
},
confirm() {
this.addShow = false;
this.otherShow = false;
let requestParams = {
FDATE:this.clickDay,
FNAME:this.FTitle,
FCONTENT:this.FCondition,
FSTARTTIME:this.creatlist[0].detail.replace(/\-/g, "\/"),
FENDTIME:this.happenlist[0].detail.replace(/\-/g, "\/"),
FINTERID:this.selectFINTERID ? this.selectFINTERID : ''
}
uni.showLoading({
title:'加载中……',
mask:true
})
// log.writeLog(requestParams, false);
this.$request.post('/SysConfigData/EditPersonDiary',requestParams)
.then(res => {
this.isAddarrange = false;
uni.hideLoading();
this.getPersonalInfo(this.clickDay)
})
.catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
delItem:function(item,index){
let requestParams = {
"interId": item.FINTERID ? item.FINTERID : ''
};
uni.showLoading({
title:'加载中……',
mask:true
})
this.$request.get('/SysConfigData/DelPersonDiary',{params:requestParams})
.then(res => {
uni.hideLoading();
this.clickDayList.splice(index,1);
this.leftStyle = 0;
uni.showToast({
title:"删除成功",
icon:'none'
})
})
.catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
mainSelectF() {
this.mainSelect = true;
this.applySelect = false;
this.cleandarSelect = false;
this.mySelect = false;
uni.redirectTo({
url: '../home/home'
});
},
applySelectF() {
this.mainSelect = false;
this.applySelect = true;
this.cleandarSelect = false;
this.mySelect = false;
uni.redirectTo({
url: '../apply/apply'
});
},
cleandarSelectF() {
this.mainSelect = false;
this.applySelect = false;
this.cleandarSelect = true;
this.mySelect = false;
},
mySelectF() {
this.mainSelect = false;
this.applySelect = false;
this.cleandarSelect = false;
this.mySelect = true;
uni.redirectTo({
url: '../myinfo/myinfo'
});
},
// 开始移动时
touchS($event,index,item) {
item.iconDel = true
// startX记录开始移动的位置
this.currIndex = index;
if($event.touches.length === 1) {
this.startX = $event.touches[0].clientX;
}
// hiddenFlag为true则是从右向左,为false则是从左向右
if(this.leftStyle === 0) {
this.hiddenFlag = true;
} else {
this.hiddenFlag = false;
}
},
touchM($event,index) {
if($event.touches.length === 1) {
//手指移动时水平方向位置
const moveX = $event.touches[0].clientX;
this.moveFunc(moveX);
}
},
touchE($event,index,item) {
const { leftStyle } = this;
const { delBtnWidth } = this;
// 如果停止滑动的距离大于二分之一则直接弹出删除按钮,不然则left为0
if(-leftStyle >= delBtnWidth) {
item.iconDel = true;
this.leftStyle = -116;
} else {
item.iconDel = false;
this.leftStyle = 0;
}
},
moveFunc(moveX) {
// 原始位置向左,leftStyle为小于0;原始位置向右,leftStyle为大于0
// disX为相对最初位置的左右距离
// 大于0为向右,小于0为向左
const disX = moveX - this.startX;
const delBtnWidth = this.delBtnWidth;
let offsetNum = 0;
if(-disX >= delBtnWidth && this.leftStyle === -delBtnWidth) {
return;
}
console.log(disX, this.hiddenFlag);
// this.hiddenFlag为true则是从左到右,则应该将container向左移动
// this.hiddenFlag为false则是从右向左,则应该将container向右移动
if(this.hiddenFlag) {
// 此时container为最右边,则应该将container向左移动
// disX大于0为相对原始位置的向右移动,则直接将offsetNum置为0
// 否则为向左移动,offsetNum为disX相反的值,判断是否超过设置的最大位置
if(disX == 0 || disX > 0) {
offsetNum = 0;
} else {
offsetNum = disX;
if (disX <= -delBtnWidth) {
//控制手指移动距离最大值为删除按钮的宽度
offsetNum = -delBtnWidth;
}
}
} else {
// 此时container为最左边,应该向右移动
// disX小于0为相对原始位置的向左移动,则直接将offsetNum置为-this.delBtnWidth
// 否则为相对原始位置的向右移动,此时应该将最大位置与向右位置的差值为此刻位置,判断是否为大于0
if(disX < 0) {
offsetNum = -this.delBtnWidth;
} else {
offsetNum = -this.delBtnWidth + disX;
if(offsetNum > 0) {
offsetNum = 0;
}
}
}
this.leftStyle = offsetNum;
},
}
}
</script>
<style lang="scss" scoped>
@import url("../../../common/iconindex.css");
.main {
background: #2560C9;
position: fixed;
z-index: 999;
height: 60px;
width: 100%;
margin-bottom: 0;
}
.title {
height: 60px;
font-size: 32.6rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FFFFFF;
line-height: 60px;
padding-left: 40rpx;
/* text-align: center; */
}
.page-body {
display: flex;
flex-direction: column;
height: 100%;
}
.arrange {
width: 100%;
text-align: center;
display: flex;
flex: 1;
justify-content: center;
align-items: center;
background-color: #FFFFFF;
}
.arrange-detail {
width: 100%;
display: flex;
flex-direction: column;
flex: 1;
background-color: rgba(255, 255, 255, 1);
overflow-y: auto;
padding-bottom: 100px;
}
.arrange-date {
height: 45.28rpx;
font-size: 32.6rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
line-height: 45.28rpx;
margin: 40rpx 0 0 40rpx;
}
.arrange-time {
display: flex;
flex-direction: row;
align-items: center;
margin-left: 40rpx;
margin-top: 40rpx;
}
.img {
height: 54.34rpx;
width: 54.34rpx;
}
.time {
height: 54.34rpx;
line-height: 54.34rpx;
font-size: 28.98rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
margin-left: 21.73rpx;
}
.detail-info {
height: 45.28rpx;
line-height: 45.28rpx;
font-size: 32.6rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
margin-left: 119.56rpx;
overflow: hidden;
text-overflow: ellipsis;
}
.add {
height: 79.71rpx;
width: 79.71rpx;
position: fixed;
right: 9.05rpx;
bottom: 135.86rpx;
z-index: 999;
}
.tabBar {
display: flex;
position: fixed;
flex-direction: row;
left: 0;
right: 0;
bottom: 0;
height: 119.56rpx;
background: rgba(255, 255, 255, 1);
box-shadow: 2px 2px 3px rgba(0, 0, 0, 1);
}
.tabBar-item {
display: flex;
flex-direction: column;
flex-shrink: 1;
flex-grow: 1;
align-items: center;
width: 100%;
}
.tabBar-item-view {
display: flex;
flex-direction: column;
flex-shrink: 1;
flex-grow: 1;
align-items: center;
}
.tabBar-item-img {
height: 54.34rpx;
width: 54.34rpx;
margin-top: 16.3rpx;
}
.tabBar-item-text {
text-align: center;
height: 28.98rpx;
font-size: 28.98rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #515151;
line-height: 28.98rpx;
}
.page {
height: 100%;
width: 100%;
/* overflow-y: hidden; */
overflow-x: hidden;
}
/* ********日历********** */
.calendar-view {
background-color: #FFFFFF;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding-bottom: 20%;
padding-top: 10%;
}
.calendar-btn {
width: 25%;
display: flex;
align-items: center;
justify-content: center;
border: 1upx solid #CCCCCC;
border-radius: 30upx;
padding: 1.5% 8%;
margin-bottom: 5%;
}
.calendar-view view {
display: flex;
}
.calendar-event {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
border-top: 1upx solid #007AFF;
}
/* ********日历****结束******** */
/******常用事项*******/
.example-body {
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
padding: 0;
font-size: 14px;
background-color: #ffffff;
}
.grid-item-box {
flex: 1;
/* position: relative;
*/
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 15px 0;
}
.text {
padding: 10upx 0;
}
/******常用事项**结束******/
.alter{
position: fixed;
left: 0;
right: 0;
top:0;
bottom: 0;
background-color: #333333;
opacity: 0.5;
}
.sparePart{
height: 460rpx;
width: calc(100% - 80rpx);
position: fixed;
left: 40rpx;
right: 0;
bottom: 0;
background-color: #FFFFFF;
border-radius: 24rpx;
border: solid 1px #007AFF;
z-index: 999;
}
.top-row-class{
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
height: 80rpx;
line-height: 80rpx;
width: calc(100% - 112rpx);
/* padding-left: 24rpx; */
margin-left: 56rpx;
flex-shrink: 0;
flex-grow: 0;
background-color: #FFFFFF;
}
.top-row-title-class{
text-align: end;
font-size: 30rpx;
font-style: auto;
color: #666666;
flex-shrink: 0;
flex-grow: 0;
line-height: 50rpx;
height: 50rpx;
width: 150rpx;
}
.top-row-title-class-add{
font-size: 30rpx;
font-style: auto;
color: #666666;
flex-shrink: 0;
flex-grow: 0;
line-height: 50rpx;
height: 50rpx;
}
.top-row-title-class-add-text{
}
.selCondition{
width: 100%;
}
.selCondition-date{
width: 100%;
color: #2560C9;
padding: 5rpx 10rpx;
font-size:28rpx;
/* border: 1px solid #D8D8D8; */
border-radius: 10rpx;
text-align: center;
}
.selCondition-alter{
width: 100%;
height: 180rpx; line-height: 60rpx;
border-radius: 10rpx;
text-align: center;
}
.confirmBtn{
height: 64rpx;
line-height: 64rpx;
width: calc(100% - 64rpx);
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
border-radius: 40rpx;
background-color: #2560C9;
position: absolute;
bottom: 32rpx;
left: 32rpx;
}
.container {
/* position: relative;
overflow-x: auto; */
margin-top: 20rpx;
}
.delete-icon {
display: flex;
align-items: center;
justify-content: center;
img{
height: 25px;
width: 25px;
}
}
</style>