Browse Source

Merge branch 'qin_v10_master'

qin_v11_master
超级管理员 1 year ago
parent
commit
4b97073714
  1. 149
      src/api/calendar/Calendar.ts
  2. 110
      src/api/calendar/DateClass.ts
  3. 40
      src/api/calendar/config.ts
  4. 13
      src/api/calendar/const.ts
  5. 222
      src/components/DesignForm/app/calendar/calendar1/calendarItem.vue
  6. 122
      src/components/DesignForm/app/calendar/calendar1/calendarPage.vue
  7. 153
      src/components/DesignForm/app/calendar/calendar1/dayPage.vue
  8. 129
      src/components/DesignForm/app/calendar/calendar1/monthPage.vue
  9. 110
      src/components/DesignForm/app/calendar/calendar1/weekPage.vue
  10. 2
      src/components/DesignForm/app/calendarPage.vue
  11. 30
      src/components/DesignForm/app/index.vue
  12. 9
      src/components/DesignForm/app/timeAxis.vue
  13. 9
      src/types/components.d.ts

149
src/api/calendar/Calendar.ts

@ -2,11 +2,13 @@ import constValue from '@/api/calendar/const';
import constVal from '@/api/calendar/const';
import DateClass from '@/api/calendar/DateClass';
import { clockFactory } from '@/api/calendar/utils';
import { formToJSON } from 'axios';
export interface dateBase {
isCurrent: boolean;
title: number;
isHolidays: boolean;
isWorks: boolean;
date: string;
lunars: string;
lunarsChina: string;
@ -42,7 +44,7 @@ class Calendar {
title() {
const title: string[] = [];
for (let i = 0; i <= 6; i++) {
title.push(constValue.nStr1[i % 7]);
title.push(constValue.nStr5[i % 7]);
}
return title;
}
@ -81,7 +83,7 @@ class Calendar {
const y = date[1] === 1 ? date[0] - 1 : date[0];
const m = date[1] === 1 ? 12 : date[1] - 1;
let w = DateClass.solarMonth(y, m);
console.log("获取当月前面需补齐的数组-->",y,m,w,last)
const arr: dateBase[] = [];
for (let i = 0; i < last; i++) {
const lun = DateClass.getLunars(y, m, w - i);
@ -90,6 +92,7 @@ class Calendar {
title: w - i,
isCurrent: false,
isHolidays: DateClass.getHolidays([y, m, w - i]),
isWorks: DateClass.getWorks([y, m, w - i]),
date: `${y}-${clockFactory(m)}-${clockFactory(w - i)}`,
lunars: lun,
lunarsChinese:
@ -100,7 +103,8 @@ class Calendar {
lunarDay: DateClass.getlunarDay(Number(l[0]), Number(l[1]), Number(l[2])),
animal: DateClass.getAnimal(Number(l[0])),
astro: DateClass.toAstro(y, m, w - i),
term: getTerm(Number(l[0]), m, w - i)
term: getTerm(Number(l[0]), m, w - i),
});
}
return arr;
@ -112,7 +116,6 @@ class Calendar {
const arr: dateBase[] = [];
const y = date[1] === 12 ? date[0] + 1 : date[0];
const m = date[1] === 12 ? 1 : date[1] + 1;
for (let i = 1; i < 42 - day.length + 1; i++) {
const lun = DateClass.getLunars(y, m, i);
const l = lun.split('-');
@ -120,6 +123,7 @@ class Calendar {
title: i,
isCurrent: false,
isHolidays: DateClass.getHolidays([y, m, i]),
isWorks: DateClass.getWorks([y, m, i]),
date: `${y}-${clockFactory(m)}-${clockFactory(i)}`,
lunars: lun,
lunarsChinese:
@ -145,6 +149,7 @@ class Calendar {
title: i,
isCurrent: true,
isHolidays: DateClass.getHolidays([date[0], date[1], i]),
isWorks: DateClass.getWorks([date[0], date[1], i]),
date: `${date[0]}-${clockFactory(date[1])}-${clockFactory(i)}`,
lunars: lun,
lunarsChinese:
@ -167,13 +172,17 @@ class Calendar {
const result = this.validateDate(date);
const currentDay = DateClass.solarWeeks(result[0], result[1]);
console.log("获取当月的完整数据",currentDay,result)
// 获取当月的完整数据
const beforDays = this.beforDays(date, currentDay).reverse();
const m = this.getDay(date, beforDays);
console.log("获取当月的完整数据--->",m,date)
const afterDays = this.afterDays(m, date);
// 转化成参数
const params = this.getDateParams(afterDays, date);
@ -183,8 +192,138 @@ class Calendar {
for (let row = 0; row < 6; row++) {
dateArray.push(params.splice(0, 7));
}
// console.log("日历数据",dateArray)
return dateArray;
}
//获取单一日期格式
gainOneDay(y: number, m: number, d: number){
let dateStr = y + "-" + m + "-" + d; // 要转换的日期字符串
let now = new Date(dateStr); //当前日期字符串转换成Date对象
const lun = DateClass.getLunars(y, m, d);
const l = lun.split('-');
let currentTime = DateClass.getCurrent()
return {
title: d,
isCurrent: true,
isHolidays: DateClass.getHolidays([y, m, d]),
isWorks: DateClass.getWorks([y, m, d]),
date: `${y}-${clockFactory(m)}-${clockFactory(d)}`,
lunars: lun,
lunarsChinese:
DateClass.toChinaMonth(Number(l[1])) + DateClass.toChinaDay(Number(l[2])),
lunarsChina: DateClass.toChinaDay(Number(l[2])),
isNow: currentTime[2] === d ? true : false,
solarDay: DateClass.getSolarDay(m, d ),
lunarDay: DateClass.getlunarDay(Number(l[0]), Number(l[1]), Number(l[2])),
animal: DateClass.getAnimal(Number(l[0])),
astro: DateClass.toAstro(y, m, d),
term: getTerm(Number(l[0]), m, d),
}
}
//获取指定日期所在周的时间
gainDayOfWeek(year: number, month: number, taday: number){
let dateStr = year + "-" + month + "-" + taday; // 要转换的日期字符串
let now = new Date(dateStr); //当前日期字符串转换成Date对象
let nowTime = now.getTime();
let nowDayOfWeek = now.getDay()==0?7:now.getDay(); //今天本周的第几天
let taDay = now.getDate()
let firstTime = now.setDate(taDay - nowDayOfWeek + 1)
let currentTime = DateClass.getCurrent()
const dateArray: dateBase[] = [];
for(let i=1; i<=7;i++){
let nextWeekFirstDaty = new Date(firstTime + 86400000 * (i - 1))
let y: any = nextWeekFirstDaty.getFullYear();
let m: any = nextWeekFirstDaty.getMonth() + 1;
let d: any = nextWeekFirstDaty.getDate();
const lun = DateClass.getLunars(y, m, d);
const l = lun.split('-');
dateArray.push({
title: d,
isCurrent: true,
isHolidays: DateClass.getHolidays([y, m, d]),
isWorks: DateClass.getWorks([y, m, d - i]),
date: `${y}-${clockFactory(m)}-${clockFactory(d)}`,
lunars: lun,
lunarsChinese:
DateClass.toChinaMonth(Number(l[1])) + DateClass.toChinaDay(Number(l[2])),
lunarsChina: DateClass.toChinaDay(Number(l[2])),
isNow: currentTime[2] === d ? true : false,
solarDay: DateClass.getSolarDay(m, d + i),
lunarDay: DateClass.getlunarDay(Number(l[0]), Number(l[1]), Number(l[2])),
animal: DateClass.getAnimal(Number(l[0])),
astro: DateClass.toAstro(y, m, d),
term: getTerm(Number(l[0]), m, d),
});
}
// console.log("dateStr=========>",dateStr)
// console.log("now=========>",now)
// console.log("nowTime=========>",nowTime)
// console.log("nowDayOfWeek=========>",nowDayOfWeek)
// console.log("taDay=========>",taDay)
// console.log("kjsd=========>",firstTime)
// console.log("dateArray=========>",dateArray)
return dateArray
}
//获得一周的所有日期
getWeekNumber(year: number, month: number, taday: number) {
let dateStr = year + "-" + month + "-" + taday; // 要转换的日期字符串
let now = new Date(dateStr);
let nowTime = now.getTime();
let second = nowTime % 86400000;
let day = (now.getDay() + 6) % 7;
let endTime = nowTime - second + new Date().getTimezoneOffset() * 60000 - day * 86400000;
// var dataAry = new Array
// for(let i = 0; i <7; i++) {
let nextWeekFirstDatysss = new Date(endTime );
// let y: any = nextWeekFirstDaty.getFullYear();
// let m: any = nextWeekFirstDaty.getMonth() + 1;
// let d: any = nextWeekFirstDaty.getDate();
// dataAry.push([y,m,d])
// }
console.log("获得一周的所有日期---------------->",dateStr,now.getDay(),day,nextWeekFirstDatysss,endTime)
let currentTime = DateClass.getCurrent()
const dateArray: dateBase[] = [];
for(let i = 0; i <7; i++) {
let nextWeekFirstDaty = new Date(endTime + 86400000*(i+1) );
let y: any = nextWeekFirstDaty.getFullYear();
let m: any = nextWeekFirstDaty.getMonth() + 1;
let d: any = nextWeekFirstDaty.getDate();
const lun = DateClass.getLunars(y, m, d);
const l = lun.split('-');
console.log("获得一周的所有日期",i,d,endTime + 86400000*(i+1))
dateArray.push({
title: d,
isCurrent: true,
isHolidays: DateClass.getHolidays([y, m, d + i]),
isWorks: DateClass.getWorks([y, m, d - i]),
date: `${y}-${clockFactory(m)}-${clockFactory(d + i)}`,
lunars: lun,
lunarsChinese:
DateClass.toChinaMonth(Number(l[1])) + DateClass.toChinaDay(Number(l[2])),
lunarsChina: DateClass.toChinaDay(Number(l[2])),
isNow: currentTime[2] === d ? true : false,
solarDay: DateClass.getSolarDay(m, d + i),
lunarDay: DateClass.getlunarDay(Number(l[0]), Number(l[1]), Number(l[2])),
animal: DateClass.getAnimal(Number(l[0])),
astro: DateClass.toAstro(y, m, d + i),
term: getTerm(Number(l[0]), m, d + i),
});
}
return dateArray
}
}
export default new Calendar();

110
src/api/calendar/DateClass.ts

@ -1,7 +1,8 @@
import constValue from '@/api/calendar/const';
import { clockFactory } from '@/api/calendar/utils';
import config from '@/api/calendar/config';
export const dayArr = ['日', '一', '二', '三', '四', '五', '六'];
export const dayArr = [ '一', '二', '三', '四', '五', '六','日'];
// export const dayArr = ['日', '一', '二', '三', '四', '五', '六'];
/**
*
@ -32,6 +33,18 @@ class DateClass {
config.Holidays.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) >
-1
);
}
getWorks(date: number[]) {
// console.log("日清杀杀杀",`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`)
// console.log("日清杀杀杀--》",config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`))
// console.log("日清杀杀杀--》",(
// config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) >
// -1
// ))
return (
config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) >
-1
);
}
/**
*
@ -61,7 +74,11 @@ class DateClass {
*/
solarWeek(y: number, m: number, d: number) {
let date = new Date(y, m - 1, d);
let week = date.getDay();
let week = date.getDay()-1;
if(week < 0){
week = 6
}
// console.log("获取公历某一天是星期几",y, m ,date,week,week < 0)
return week;
}
/**
@ -81,7 +98,10 @@ class DateClass {
* @returns {string}
*/
toChinaDay(d: number) {
let str = d == 10 ? constValue.nStr2[0] : constValue.nStr2[Math.floor(d / 10)];
// console.log('返回农历日期通俗表示法',d,str)
return str + (d % 10 ? constValue.nStr1[d % 10] : constValue.nStr1[10]);
}
/**
@ -298,37 +318,73 @@ class DateClass {
}
/**
@ 作者: 秦东
@ 时间: 2024-07-12 11:50:37
@ 功能: 处理年月日回退数据
@ 时间: 2024-07-15 09:00:20
@ 功能: 前进时间
@ 1: 23
*/
gobackTime(y: number, m: number, d: number,t?:number){
console.log("计算时间--0--》",y,m,d,t)
moveTime(y: number, m: number, d: number,t?:number){
switch(t){
case 2:
let startWeek = this.getMonday(y,m,d,'s',0)
let endWeek = this.getMonday(y,m,d,'e',0)
let startWeek = this.getMonday(y,m,d,'s',1)
let endWeek = this.getMonday(y,m,d,'e',1)
return {
start:startWeek,
end:endWeek
}
break;
case 3:
let day = d-1
if(day <= 0){
let month = m - 1
if(month <= 0){
y = y -1;
m = 12
let dateStr = y + "-" + m + "-" + d; // 要转换的日期字符串
let now = new Date(dateStr); //当前日期字符串转换成Date对象
let nowTime = now.getTime();
let nextWeekFirstDaty = new Date(nowTime + 86400000)
let yy: any = nextWeekFirstDaty.getFullYear();
let mm: any = nextWeekFirstDaty.getMonth() + 1;
let dd: any = nextWeekFirstDaty.getDate();
return [yy,mm,dd]
break;
default:
let month = m + 1
if(month > 12){
y = y + 1;
m = 1
d = this.solarMonth(y,m)
}else{
m = month
d = this.solarMonth(y,month)
}
}else{
let day = this.solarMonth(y,month)
if(d > day){
d = day
}
}
return [y,m,d]
}
}
/**
@ 作者: 秦东
@ 时间: 2024-07-12 11:50:37
@ 功能: 处理年月日回退数据
@ 1: 23
*/
gobackTime(y: number, m: number, d: number,t?:number, dt?:number){
// console.log("计算时间--0--》",y,m,d,t)
switch(t){
case 2:
let startWeek = this.getMonday(y,m,d,'s',dt?dt:0)
let endWeek = this.getMonday(y,m,d,'e',dt?dt:0)
return {
start:startWeek,
end:endWeek
}
break;
case 3:
let dateStr = y + "-" + m + "-" + d; // 要转换的日期字符串
let now = new Date(dateStr); //当前日期字符串转换成Date对象
let nowTime = now.getTime();
let nextWeekFirstDaty = new Date(nowTime - 86400000)
let yy: any = nextWeekFirstDaty.getFullYear();
let mm: any = nextWeekFirstDaty.getMonth() + 1;
let dd: any = nextWeekFirstDaty.getDate();
return [yy,mm,dd]
break;
default:
let month = m - 1
@ -336,7 +392,7 @@ class DateClass {
y = y -1;
m = 12
d = this.solarMonth(y,m)
console.log("计算时间--1--》",y,m,d)
// console.log("计算时间--1--》",y,m,d)
}else{
m = month
let day = this.solarMonth(y,month)
@ -354,7 +410,7 @@ class DateClass {
/**
@ 作者: 秦东
@ 时间: 2024-07-12 13:48:55
@ 功能: 获取周
@ 功能: 任意日期获取周
*/
getMonday = (year: number, month: number, taday: number,type: any, dates: any) => {
// let now = new Date();
@ -373,11 +429,7 @@ class DateClass {
console.log("now--->",now)
console.log("nowTime--->",nowTime)
console.log("day--->",day)
console.log("longTime--->",longTime)
console.log("n--->",n)
@ -393,9 +445,19 @@ class DateClass {
let d: any = date.getDate();
// m = m < 10 ? "0" + m : m;
// d = d < 10 ? "0" + d : d;
// console.log("now--->",date)
// console.log("nowTime--->",nowTime)
// console.log("day--->",day)
// console.log("longTime--->",longTime)
// console.log("n--->",n)
let days = y + "-" + m + "-" + d;
return [y, m, d];
}
}
export default new DateClass();

40
src/api/calendar/config.ts

@ -132,6 +132,38 @@ export default {
'20230125',
'20230126',
'20230127',
'20231230',
'20240101',
'20240210',
'20240210',
'20240211',
'20240212',
'20240213',
'20240214',
'20240215',
'20240216',
'20240217',
'20240404',
'20240405',
'20240406',
'20240501',
'20240502',
'20240503',
'20240504',
'20240505',
'20240608',
'20240609',
'20240610',
'20240915',
'20240916',
'20240917',
'20241001',
'20241002',
'20241003',
'20241004',
'20241005',
'20241006',
'20241007',
],
/**
*
@ -165,5 +197,13 @@ export default {
'20220507',
'20221008',
'20221009',
'20240204',
'20240218',
'20240407',
'20240428',
'20240511',
'20240914',
'20240929',
'20241012',
],
};

13
src/api/calendar/const.ts

@ -303,6 +303,19 @@ export default {
'\u516b',
'\u4e5d',
'\u5341'
],
nStr5: [
'\u4e00',
'\u4e8c',
'\u4e09',
'\u56db',
'\u4e94',
'\u516d',
'\u65e5',
'\u4e03',
'\u516b',
'\u4e5d',
'\u5341'
],
/**
*

222
src/components/DesignForm/app/calendar/calendar1/calendarItem.vue

@ -0,0 +1,222 @@
<script lang="ts" setup>
import { PropType } from 'vue';
import DateClass from '@/api/calendar/DateClass';
import { dateBase } from '@/api/calendar/Calendar';
const props = defineProps({
col: {
type: Object as PropType<dateBase>,
default: () => {
return {};
},
},
time: {
type: String,
default: '',
},
});
const isCurrentMonth = (time: string) => {
const months = time.split('-')[1];
return DateClass.getCurrent()[1] === Number(months);
}
const emit = defineEmits(['changeTargetDate']);
const changeTargetDate = (time: dateBase) => {
emit('changeTargetDate', time);
}
/**
@ 作者: 秦东
@ 时间: 2024-07-16 10:32:41
@ 功能: 搜索数据
*/
const searchtData = (val:any,time?:any) => {
return time
}
</script>
<template>
<div
class="calendar-item-container"
:class="[
{
'is-current': col.isCurrent,
'is-holidays': col.isHolidays,
'is-week': col.isWeek,
'is-selected': col.date === props.time,
'is-current-month': isCurrentMonth(col.date),
},
]"
@click="changeTargetDate(col)"
>
<div class="dayStyle">
<span >{{ col.title }}</span>
<div v-if="col.isHolidays"></div>
<span >{{ col.lunarsChina }}</span>
</div>
<div class="dayList">
<div class="dayLogCont">Squeezed by parent element</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
<div class="dayLogCont">
{{ searchtData(1,col)}}
</div>
</div>
</div>
</template>
<style scoped lang="less">
.calendar-item-container {
width: 100%;
height: 100%;
flex-direction: column;
box-sizing: border-box;
border-radius: 6px;
border: 2px solid #ffffff;
.dayList{
height: calc(100% - 20px);
overflow-y: auto;
}
.dayLogCont{
white-space: nowrap; /* 确保文本在一行内显示 */
overflow: hidden; /* 隐藏溢出的内容 */
text-overflow: ellipsis; /* 使用省略号表示文本溢出 */
font-size: 0.95rem;
border: 1px solid #bcbcbc;
border-radius: 5px;
margin-bottom:5px;
padding: 0 5px;
}
.dayStyle{
display: flex;
// align-items: top;
justify-content: space-between;
font-size: 12px;
color: #999999;
}
.calendar-title {
font-size: 1.2rem;
color: #999999;
}
.calendar-lunar {
margin-top: 6px;
font-size: 0.85rem;
color: #bcbcbc;
}
transition: all 0.2s;
}
.calendar-item-container:hover {
cursor: pointer;
border: 2px solid #409eff;
}
.is-holidays {
.holidays-text {
position: absolute;
top: 6px;
left: 14px;
font-size: 0.85rem;
color: #ffa2a2;
}
.calendar-title {
color: #ffa2a2;
}
.dayStyle{
color: #ffa2a2;
}
background-color: #feeeef;
}
.is-selected {
border: 2px solid #409eff;
}
.is-holidays.is-selected {
border: 2px solid #ffa2a2;
}
.is-selected.is-current-month {
border: 2px solid #409eff;
}
.is-holidays.is-selected.is-current-month {
border: 2px solid #f62b2b;
}
.is-week {
.calendar-title {
color: #ffa2a2;
}
.dayStyle{
color: #ffa2a2;
}
}
.calendar-item-container.is-current {
.calendar-title {
color: #333333;
}
.dayStyle{
color: #333333;
}
.calendar-lunar {
color: #666666;
}
}
.calendar-item-container.is-current.is-holidays {
.holidays-text {
position: absolute;
top: 6px;
left: 14px;
font-size: 0.85rem;
color: #f62b2b;
}
background-color: #fbe3e4;
}
.calendar-item-container.is-current.is-holidays,
.calendar-item-container.is-current.is-week {
.calendar-title {
color: #f62b2b;
}
.dayStyle{
color: #f62b2b;
}
}
.calendar-item-container.is-current.is-holidays {
.holidays-text {
position: absolute;
top: 6px;
left: 14px;
font-size: 0.85rem;
color: #fb4949;
}
.calendar-title {
color: #fb6e6e;
}
.dayStyle{
color: #fb6e6e;
}
background-color: #ffe4e7;
}
.calendar-item-container.is-holidays:hover {
border: 2px solid #f62b2b;
}
</style>

122
src/components/DesignForm/app/calendar/calendar1/calendarPage.vue

@ -5,6 +5,14 @@
-->
<script lang='ts' setup>
import DateClass from '@/api/calendar/DateClass';
import { clockFactory } from '@/api/calendar/utils';
//
import MonthPage from './monthPage.vue'
import WeekPage from './weekPage.vue'
import DayPage from './dayPage.vue'
const props = defineProps({
data: {
type: Object,
@ -13,17 +21,37 @@ const props = defineProps({
},
},
bodyHight:Number,
searchSend:{
type:Object,
default(){
return {}
}
}
});
const taday = ref<any>([]);
const curtteDayType = ref(1)
const curtteDay = ref(1)
const monthPageRef = ref(null)
const weekPageRef = ref(null)
const dayPageRef = ref(null)
onMounted(() => {
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
}
console.log("系统加载",taday.value)
})
const curttWeek = computed(()=>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
}
if(curtteDayType.value != 2){
return DateClass.getWeek(DateClass.solarWeek(taday.value[0],taday.value[1],taday.value[2]))
}else{
return taday.value.start[1] + "月" + taday.value.start[2] + "-" + taday.value.end[1] + "月" + taday.value.end[2]
}
})
@ -31,9 +59,19 @@ const curtteMonth = computed(()=>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
}
if(curtteDayType.value != 2){
if(taday.value.length >= 2){
return taday.value[0]+"年"+taday.value[1]+"月"
}
}else{
if(taday.value.start != undefined){
return taday.value.start[0]+"年"
}else{
return taday.value[0]+"年"+taday.value[1]+"月"
}
}
})
/**
@ 作者: 秦东
@ -44,7 +82,15 @@ const backTime = () =>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
}
taday.value = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value)
if(curtteDayType.value != 2){
taday.value = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value,-1)
}else{
let weekObject = DateClass.gobackTime(taday.value.start[0],taday.value.start[1],taday.value.start[2],curtteDayType.value,-1)
taday.value = weekObject
}
}
/**
@ -56,7 +102,69 @@ const forwardTime = () =>{
if(taday.value.length <= 0){
taday.value = DateClass.getCurrent()
}
if(curtteDayType.value != 2){
taday.value = DateClass.moveTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value)
}else{
let weekObject = DateClass.moveTime(taday.value.start[0],taday.value.start[1],taday.value.start[2],curtteDayType.value)
taday.value = weekObject
}
}
/**
@ 作者: 秦东
@ 时间: 2024-07-13 08:33:01
@ 功能: 选择时间
*/
const pickTime = (val:number) => {
curtteDayType.value = val
switch (val) {
case 2:
taday.value = DateClass.getCurrent()
let weekObject = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value)
taday.value = weekObject
// curtteMonth.value = taday.value[0]+""
// curttWeek.value = taday.value[1]+""+taday.value[2]+""
// console.log("formEl---------4--------->",curttWeek.value )
break;
case 3:
taday.value = DateClass.getCurrent()
break;
default:
taday.value = DateClass.getCurrent()
break;
}
}
/**
@ 作者: 秦东
@ 时间: 2024-07-13 16:58:07
@ 功能: 回到今日
*/
const emit = defineEmits(['getDate']);
const goTady = () => {
taday.value = DateClass.getCurrent()
let time = taday.value[0] + "-" + clockFactory(taday.value[1]) + "-" + clockFactory(taday.value[2])
emit('getDate', time);
}
/**
@ 作者: 秦东
@ 时间: 2024-07-16 13:06:23
@ 功能: 查询数据
*/
const calendarSearchData = (val:any) => {
switch(curtteDayType.value){
case 2:
break;
case 3:
dayPageRef.value.searchatDayList(val);
default:
break;
}
console.log("查询数据",props.searchSend)
}
defineExpose({
calendarSearchData
})
</script>
<template>
<div class="calBox" :style="'height:calc(100vh - '+ props.bodyHight +'px)'">
@ -69,17 +177,19 @@ const forwardTime = () =>{
</div>
<div>
<el-button-group class="ml-4">
<el-button size="small" >今天</el-button>
<el-button :color="curtteDayType==1?'#a0cfff':''" @click="curtteDayType=1" size="small" ></el-button>
<el-button :color="curtteDayType==2?'#a0cfff':''" @click="curtteDayType=2" size="small" ></el-button>
<el-button :color="curtteDayType==3?'#a0cfff':''" @click="curtteDayType=3" size="small" ></el-button>
<el-button size="small" @click="goTady()">今天</el-button>
<el-button :color="curtteDayType==1?'#a0cfff':''" @click="pickTime(1)" size="small" ></el-button>
<el-button :color="curtteDayType==2?'#a0cfff':''" @click="pickTime(2)" size="small" ></el-button>
<el-button :color="curtteDayType==3?'#a0cfff':''" @click="pickTime(3)" size="small" ></el-button>
<el-button size="small" class="fa fa-angle-left" @click="backTime()"></el-button>
<el-button size="small" class="fa fa-angle-right" @click="forwardTime()"></el-button>
</el-button-group>
</div>
</div>
<div class="weekNumber">
{{DateClass.getMonday(taday[0],taday[1],taday[2],'e',0) }}
<MonthPage ref="monthPageRef" v-if="curtteDayType==1" :body-hight="props.bodyHight" :ta-day="taday" :search-send="props.searchSend" />
<WeekPage ref="weekPageRef" v-if="curtteDayType==2" :body-hight="props.bodyHight" :ta-day="taday" :search-send="props.searchSend" />
<DayPage ref="dayPageRef" v-if="curtteDayType==3" :body-hight="props.bodyHight" :ta-day="taday" :search-send="props.searchSend" />
</div>
</div>
</template>

153
src/components/DesignForm/app/calendar/calendar1/dayPage.vue

@ -0,0 +1,153 @@
<!--
@ 作者: 秦东
@ 时间: 2024-07-13 09:34:47
@ 备注: 日日历
-->
<script lang='ts' setup>
import Calendar from '@/api/calendar/Calendar';
import DateClass from '@/api/calendar/DateClass';
import { dateBase } from '@/api/calendar/Calendar';
import { clockFactory } from '@/api/calendar/utils';
const props = defineProps({
bodyHight:Number,
taDay:{
type:Array,
default() {
return [2024,7,13];
},
},
searchSend:{
type:Object,
default(){
return {}
}
}
});
//
const drawingBoardHeight = computed(()=>{
return props.bodyHight + 50
})
const curttWeek = computed(()=>{
console.log("画板高度---------->",props.taDay[0])
return DateClass.getWeek(DateClass.solarWeek(props.taDay[0],props.taDay[1],props.taDay[2]))
})
const dayInfo = ref<any>();
onMounted(()=>{
dayInfo.value = Calendar.gainOneDay(props.taDay[0],props.taDay[1],props.taDay[2])
console.log("初次加载",dayInfo.value,props.searchSend)
searchatDayList(props.searchSend)
nextTick(()=>{
let ddTime = DateClass.getCurrent()
selectedTime.value = ddTime[0] + "-" + clockFactory(ddTime[1]) + "-" + clockFactory(ddTime[2])
})
})
watch(()=>props.taDay,(val:any)=>{
dayInfo.value = Calendar.gainOneDay(val[0],val[1],val[2])
console.log("监听变化",dayInfo.value)
searchatDayList(props.searchSend)
},{
deep: true,
})
const selectedTime = ref(props.taDay[0] + "-" + clockFactory(props.taDay[1]) + "-" + clockFactory(props.taDay[2]))
const emit = defineEmits(['getDate']);
const changeDate = (time: dateBase) => {
selectedTime.value = time.date;
emit('getDate', time);
}
/**
@ 作者: 秦东
@ 时间: 2024-07-16 11:53:35
@ 功能: 获取数据
*/
const searchatDayList = (val:any) => {
val.viewClass = {
class:"date",
sortWord:"creater_time",
sort:1,
startTime:"",
endTime:"",
dayType:"",
mapWord:""
}
console.log("获取每天数据",val)
let sendInfo = {
search:val,
timeAry:[dayInfo.value]
}
console.log("获取每天数据条件",sendInfo)
}
defineExpose({
searchatDayList
})
</script>
<template>
<div class="monthCalendarBox" :style="'height:calc(100vh - '+ drawingBoardHeight +'px)'">
<ul class="t-calendar-header">
<li>
{{ curttWeek }}
</li>
</ul>
<div class="t-calendar-day">
<template v-if="dayInfo">
<div
class="t-calendar-row"
>
<CalendarItem
:col="dayInfo"
:time="selectedTime"
@changeTargetDate="changeDate"
></CalendarItem>
</div>
</template>
<template v-else>
<div class="no-date">抱歉,暂无数据</div>
</template>
</div>
</div>
</template>
<style lang='scss' scoped>
.monthCalendarBox{
width: 100%;
margin-top: 10px;
.t-calendar-header {
display: flex;
width: 100%;
height: 42px;
padding: 0;
box-sizing: border-box;
li {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
font-size: 0.95rem;
}
}
.t-calendar-day {
display: flex;
width: 100%;
height: calc(100% - 42px);
padding: 0;
box-sizing: border-box;
border-right: 1px solid #ebeef5;
.t-calendar-row {
width: 100%;
font-size: 0.95rem;
border-bottom: 1px solid #ebeef5;
border-top: 1px solid #ebeef5;
border-left: 1px solid #ebeef5;
}
}
}
</style>

129
src/components/DesignForm/app/calendar/calendar1/monthPage.vue

@ -0,0 +1,129 @@
<!--
@ 作者: 秦东
@ 时间: 2024-07-13 09:34:05
@ 备注: 月日历
-->
<script lang='ts' setup>
import Calendar from '@/api/calendar/Calendar';
import DateClass from '@/api/calendar/DateClass';
import { dateBase } from '@/api/calendar/Calendar';
import { clockFactory } from '@/api/calendar/utils';
import CalendarItem from './calendarItem.vue';
const props = defineProps({
bodyHight:Number,
taDay:{
type:Array,
default() {
return [2024,7,13];
},
}
});
onMounted(()=>{
nextTick(()=>{
selectedTime.value = props.taDay[0] + "-" + clockFactory(props.taDay[1]) + "-" + clockFactory(props.taDay[2])
})
})
const selectedTime = ref(props.taDay[0] + "-" + clockFactory(props.taDay[1]) + "-" + clockFactory(props.taDay[2]))
const emit = defineEmits(['getDate']);
const changeDate = (time: dateBase) => {
selectedTime.value = time.date;
emit('getDate', time);
}
//
const drawingBoardHeight = computed(()=>{
return props.bodyHight + 50
})
//
const THeader = Calendar.title();
//
const TBody = computed(() =>
Calendar.table(props.taDay)
);
</script>
<template>
<div class="monthCalendarBox" :style="'height:calc(100vh - '+ drawingBoardHeight +'px)'">
<ul class="t-calendar-header">
<li v-for="(item, index) in THeader" :key="index">
{{ item }}
</li>
</ul>
<div class="t-calendar-day">
<template v-if="TBody.length">
<div
class="t-calendar-row"
v-for="(item, index) in TBody"
:key="index"
>
<div
class="t-calendar-col"
v-for="(col, colIdx) in item"
:key="colIdx"
>
<CalendarItem
:col="col"
:time="selectedTime"
@changeTargetDate="changeDate"
></CalendarItem>
</div>
</div>
</template>
<template v-else>
<div class="no-date">抱歉,暂无数据</div>
</template>
</div>
</div>
</template>
<style lang='scss' scoped>
.monthCalendarBox{
width: 100%;
margin-top: 10px;
.t-calendar-header {
display: flex;
width: 100%;
height: 42px;
padding: 0;
box-sizing: border-box;
li {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
font-size: 0.95rem;
}
}
.t-calendar-day {
display: flex;
flex-direction: column;
width: 100%;
height: calc(100% - 42px);
.t-calendar-row {
width: 100%;
height: 60px;
display: flex;
flex: 1;
border-bottom: 1px solid #ebeef5;
.t-calendar-col{
box-sizing: border-box;
flex: 1;
border-left: 1px solid #ebeef5;
padding: 2px;
font-size: 16px;
transition: all 0.2s;
width: calc(100%/7);
}
.t-calendar-col:last-child {
border-right: 1px solid #ebeef5;
}
}
.t-calendar-row:first-child {
border-top: 1px solid #ebeef5;
}
}
}
</style>

110
src/components/DesignForm/app/calendar/calendar1/weekPage.vue

@ -0,0 +1,110 @@
<!--
@ 作者: 秦东
@ 时间: 2024-07-13 09:34:24
@ 备注:
-->
<script lang='ts' setup>
import Calendar from '@/api/calendar/Calendar';
import DateClass from '@/api/calendar/DateClass';
import { dateBase } from '@/api/calendar/Calendar';
import { clockFactory } from '@/api/calendar/utils';
const props = defineProps({
bodyHight:Number,
taDay:{
type:Array,
default() {
return [2024,7,13];
},
}
});
//
const drawingBoardHeight = computed(()=>{
return props.bodyHight + 50
})
//
const THeader = Calendar.title();
const WeekBody = computed(()=>{
Calendar.gainDayOfWeek(props.taDay.start[0],props.taDay.start[1],props.taDay.start[2]);
console.log("画板高度--->",props.taDay.start[0]);
return Calendar.gainDayOfWeek(props.taDay.start[0],props.taDay.start[1],props.taDay.start[2]);
});
onMounted(()=>{
nextTick(()=>{
let ddTime = DateClass.getCurrent()
selectedTime.value = ddTime[0] + "-" + clockFactory(ddTime[1]) + "-" + clockFactory(ddTime[2])
})
})
const selectedTime = ref(props.taDay[0] + "-" + clockFactory(props.taDay[1]) + "-" + clockFactory(props.taDay[2]))
const emit = defineEmits(['getDate']);
const changeDate = (time: dateBase) => {
selectedTime.value = time.date;
emit('getDate', time);
}
</script>
<template>
<div class="monthCalendarBox" :style="'height:calc(100vh - '+ drawingBoardHeight +'px)'">
<ul class="t-calendar-header">
<li v-for="(item, index) in THeader" :key="index">
{{ item }}
</li>
</ul>
<div class="t-calendar-day">
<template v-if="WeekBody.length">
<div
class="t-calendar-row"
v-for="(item, index) in WeekBody"
:key="index"
>
<CalendarItem
:col="item"
:time="selectedTime"
@changeTargetDate="changeDate"
></CalendarItem>
</div>
</template>
<template v-else>
<div class="no-date">抱歉,暂无数据</div>
</template>
</div>
</div>
</template>
<style lang='scss' scoped>
.monthCalendarBox{
width: 100%;
margin-top: 10px;
.t-calendar-header {
display: flex;
width: 100%;
height: 42px;
padding: 0;
box-sizing: border-box;
li {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
font-size: 0.95rem;
}
}
.t-calendar-day {
display: flex;
width: 100%;
height: calc(100% - 42px);
padding: 0;
box-sizing: border-box;
border-right: 1px solid #ebeef5;
.t-calendar-row {
width: calc(100%/7);
font-size: 0.95rem;
border-bottom: 1px solid #ebeef5;
border-top: 1px solid #ebeef5;
border-left: 1px solid #ebeef5;
}
}
}
</style>

2
src/components/DesignForm/app/calendarPage.vue

@ -25,7 +25,7 @@ let timek = new Date()
</script>
<template>
<CalendarPage :body-hight="345" />
<CalendarPage :body-hight="265" />
</template>
<style lang='scss' scoped>

30
src/components/DesignForm/app/index.vue

@ -22,7 +22,7 @@ import { softDeletion,retractRunWorkFlow } from '@/api/taskapi/management'
import FormPageCont from '@/components/DesignForm/tableListPage/formPageCont.vue'
import TableFlow from '@/views/sysworkflow/lowcodepage/pageFlow/appTableFlow.vue'
import TimeAxisPage from '@/components/DesignForm/app/timeAxis.vue'
import CalendarPage from '@/components/DesignForm/app/calendarPage.vue'
import CalendarPage from '@/components/DesignForm/app/calendar/calendar1/calendarPage.vue'
const props = withDefaults(
@ -296,6 +296,7 @@ watch(()=>props.formId,(val:any)=>{
})
const timeAxisRef = ref(null)
const calendarPageRef = ref(null)
const searchSend = reactive({
formId:props.formId,
page:state.currentPage,
@ -310,22 +311,27 @@ const searchSend = reactive({
*/
const getPageData = () => {
// let sendData = {
// formId:props.formId,
// page:state.currentPage,
// pagesize:state.pageSize,
// searchData:json2string(props.searchData)
// }
// console.log("",sendData)
let sendData = {
formId:props.formId,
page:state.currentPage,
pagesize:state.pageSize,
searchData:json2string(props.searchData)
}
console.log("获取列表详细信息",sendData)
switch(viewType.value){
case 2:
nextTick(()=>{
console.log("获取列表详细信息-------555---------->",calendarPageRef.value)
calendarPageRef.value.calendarSearchData(sendData)
})
// calendarPageRef.value.calendarSearchData()
break;
case 3:
nextTick(()=>{
console.log("获取列表详细信息-------222---------->",timeAxisRef.value)
// timeAxisRef.value.searchTimeList(searchSend)
timeAxisRef.value.searchTimeList(sendData,1)
})
break;
@ -335,7 +341,7 @@ const getPageData = () => {
break;
default:
state.loading = true;
gainFormPageListCont(searchSend)
gainFormPageListCont(sendData)
.then((data)=>{
console.log("获取列表详细信息----------------->",data)
tableDataList.value = data.data.list
@ -857,7 +863,7 @@ const tabsView = (val:any,types:number) => {
</div>
</el-col>
<el-col v-if="viewType==2" :span="24">
<CalendarPage />
<CalendarPage ref="calendarPageRef" :search-send="searchSend" :body-hight="265" />
</el-col>
<el-col v-if="viewType==3" :span="24">
<TimeAxisPage ref="timeAxisRef" :data="tableDataList" :view-layout="viewLayout" :columns-filter="columnsFilter" :search-send="searchSend" />
@ -941,7 +947,7 @@ const tabsView = (val:any,types:number) => {
width:100%;
}
.table-list-comm{
padding:0px 15px 15px 15px;
padding:0px 15px 5px 15px;
}
.seacherForm{
min-height: auto;

9
src/components/DesignForm/app/timeAxis.vue

@ -67,7 +67,7 @@ const timeInfoList = ref<any[]>([])
@ 时间: 2024-07-08 13:11:43
@ 功能: 时间轴数据搜索
*/
const searchTimeList = (val:any) =>{
const searchTimeList = (val:any,clas?:number) =>{
loadTimePage.value = true
console.log("时间轴数据搜索",val)
console.log("时间轴数据搜索--->",props.columnsFilter)
@ -80,12 +80,15 @@ const searchTimeList = (val:any) =>{
dayType:"",
mapWord:""
}
if(clas && clas != 1){
console.log("时间轴数据搜索-11111-->",timeInfoList.value.length)
if(timeInfoList.value.length > 0){
val.oldData = json2string(timeInfoList.value)
}else{
val.oldData = ""
}
}
multiViewPage(val)
.then((data:any) =>{
@ -118,7 +121,7 @@ defineExpose({
@ 功能: 判断当前值
*/
const judgeGainVal = (key:string,val:any) => {
console.log("判断当前值--1->",val)
// console.log("--1->",val)
if(val[key]){
return val[key]
}
@ -240,7 +243,7 @@ const showWork = computed(() => {
</template>
<style lang='scss' scoped>
.infinite-list {
height: calc(100vh - 345px);
height: calc(100vh - 280px);
// height:100px;
padding: 10px 0 0 0;
margin: 20px 0 0 0;

9
src/types/components.d.ts

@ -16,10 +16,12 @@ declare module '@vue/runtime-core' {
ApproverDrawer: typeof import('./../components/workflow/drwer/approverDrawer.vue')['default']
BianXian: typeof import('./../components/DesignForm/designLayout/bianXian.vue')['default']
Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default']
CalendarItem: typeof import('./../components/DesignForm/app/calendar/calendar1/calendarItem.vue')['default']
CalendarPage: typeof import('./../components/DesignForm/app/calendarPage.vue')['default']
ChildTable: typeof import('./../components/DesignForm/public/form/childTable.vue')['default']
ConditionDrawer: typeof import('./../components/workflow/drwer/conditionDrawer.vue')['default']
CopyerDrawer: typeof import('./../components/workflow/drwer/copyerDrawer.vue')['default']
DayPage: typeof import('./../components/DesignForm/app/calendar/calendar1/dayPage.vue')['default']
DesignLayoutButPage: typeof import('./../components/DesignForm/designLayout/designLayoutButPage.vue')['default']
DesignLayoutPage: typeof import('./../components/DesignForm/designLayout/designLayoutPage.vue')['default']
DiyIconfont: typeof import('./../components/DesignForm/public/expand/diy-iconfont.vue')['default']
@ -33,11 +35,9 @@ declare module '@vue/runtime-core' {
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCalendar: typeof import('element-plus/es')['ElCalendar']
ElCard: typeof import('element-plus/es')['ElCard']
ElCarousel: typeof import('element-plus/es')['ElCarousel']
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
ElCascader: typeof import('element-plus/es')['ElCascader']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
@ -69,7 +69,6 @@ declare module '@vue/runtime-core' {
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElProgress: typeof import('element-plus/es')['ElProgress']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
@ -123,6 +122,7 @@ declare module '@vue/runtime-core' {
HeadToolsNew: typeof import('./../components/DesignForm/public/headToolsNew.vue')['default']
IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
IEpCaretBottom: typeof import('~icons/ep/caret-bottom')['default']
IEpCaretTop: typeof import('~icons/ep/caret-top')['default']
IEpClose: typeof import('~icons/ep/close')['default']
IEpDelete: typeof import('~icons/ep/delete')['default']
IEpEdit: typeof import('~icons/ep/edit')['default']
@ -131,13 +131,13 @@ declare module '@vue/runtime-core' {
IEpRefresh: typeof import('~icons/ep/refresh')['default']
IEpSearch: typeof import('~icons/ep/search')['default']
IEpSetting: typeof import('~icons/ep/setting')['default']
IEpView: typeof import('~icons/ep/view')['default']
LangSelect: typeof import('./../components/LangSelect/index.vue')['default']
LayoutPage: typeof import('./../components/DesignForm/layoutPage/index.vue')['default']
List: typeof import('./../components/DesignForm/public/form/components/list.vue')['default']
ListTreeSide: typeof import('./../components/DesignForm/public/form/components/listTreeSide.vue')['default']
MathFormula: typeof import('./../components/DesignForm/math/mathFormula.vue')['default']
Matrix: typeof import('./../components/workflow/dialog/matrix.vue')['default']
MonthPage: typeof import('./../components/DesignForm/app/calendar/calendar1/monthPage.vue')['default']
MultiUpload: typeof import('./../components/Upload/MultiUpload.vue')['default']
NodeWrap: typeof import('./../components/workflow/nodeWrap.vue')['default']
PageSize: typeof import('./../components/DesignForm/designLayout/pageSize.vue')['default']
@ -170,6 +170,7 @@ declare module '@vue/runtime-core' {
UserDialog: typeof import('./../components/DesignForm/public/expand/userDialog.vue')['default']
VueFile: typeof import('./../components/DesignForm/vueFile.vue')['default']
WangEditor: typeof import('./../components/WangEditor/index.vue')['default']
WeekPage: typeof import('./../components/DesignForm/app/calendar/calendar1/weekPage.vue')['default']
Yuanjao: typeof import('./../components/DesignForm/designLayout/yuanjao.vue')['default']
}
export interface ComponentCustomProperties {

Loading…
Cancel
Save