hldy_app/component/rightItemssecond/index.vue

1506 lines
50 KiB
Vue
Raw Normal View History

2025-03-05 17:29:32 +08:00
<!-- 护嘱 -->
<template>
2025-03-14 17:30:56 +08:00
<!-- click是让抖动停止 -->
2025-03-21 17:36:27 +08:00
<view class="right-container" :style="isshow?{opacity: `1`}:{opacity: `0`}"
@click="bottomisShaking=false;shakyTable = false">
2025-03-05 17:29:32 +08:00
<view class="right-container-title-nav">
<text :class="darkFans?`right-container-title-no-dark`:`right-container-title-no`">
ID12345678
</text>
<text :class="darkFans?`right-container-title-no-dark`:`right-container-title-no`">
名称未命名01
</text>
<view class="right-icons">
<image class="right-icons-img" :src="`/static/index/undericons/man.png`" />
<view :class="darkFans?`right-icons-font-dark`: `right-icons-font` ">王金福</view>
<image class="right-icons-img-icon"
:src="darkFans?`/static/index/undericons/face.png`:`/static/index/undericons/facelight.png`" />
<image class="right-icons-img-icon"
:src="darkFans?`/static/index/undericons/hand.png`:`/static/index/undericons/handlight.png`" />
<image class="right-icons-img-icon"
:src="darkFans?`/static/index/undericons/out.png`:`/static/index/undericons/outlight.png`" />
</view>
<view class="right-container-title-class-anhei-button" @click="darkFanschange()" v-show="!darkFans">
<text class="right-container-title-class-anhei">
切换到暗黑模式
</text>
</view>
<view class="right-container-title-class-anhei-button" :style="darkFans ? { backgroundColor:'#fff' } : {}"
@click="darkFanschange()" v-show="darkFans">
<text class="right-container-title-class-anhei" :style="darkFans ? { color: 'black' } : {}">
取消暗黑模式
</text>
</view>
</view>
2025-03-07 17:26:02 +08:00
<view class="doctorsay-container-view">
<view class="doctorsay-container-items">
<view class="doctorsay-container-up">
2025-03-11 17:27:40 +08:00
<view v-for="(item,index) in doctorsayList" :key="index" @click="changLeft(index)">
2025-03-07 17:26:02 +08:00
<view class="doctorsay-container-card"
2025-03-24 17:37:51 +08:00
:style="index === upmenuIndex ? {background: 'linear-gradient(to right bottom, #00c9ff, #0076ff)'} : {}">
2025-03-07 17:26:02 +08:00
<image class="doctorsay-container-card-img"
:src="index === upmenuIndex ? item.targetUrl : item.url" />
<view
:class="(index === upmenuIndex) ? `doctorsay-container-card-font-dark`:`doctorsay-container-card-font`">
{{ item.name }}
</view>
</view>
</view>
2025-03-17 17:34:36 +08:00
<view>
<view class="doctorsay-container-card"
2025-03-21 17:36:27 +08:00
style="background: linear-gradient(135deg, #01e7be 0%, #0080dd 100%);">
2025-03-17 17:34:36 +08:00
<image class="doctorsay-container-card-img" src="/static/index/shexiang.png" />
<view class="doctorsay-container-card-font-dark">
监控
</view>
</view>
</view>
2025-03-07 17:26:02 +08:00
</view>
<view class="doctorsay-container-down">
2025-03-14 17:30:56 +08:00
<view class="doctorsay-top">
<view class="doctorsay-top-gun"></view>
<view class="doctorsay-top-font">服务类型</view>
</view>
2025-03-12 15:22:01 +08:00
<scroll-view :scroll-y="canmove" class="doctorsay-container-scroll" @scroll="handleScroll">
2025-03-12 10:33:32 +08:00
<view v-for="(item,index) in downList" :key="index">
2025-04-01 17:27:15 +08:00
<view class="doctorsay-container-button" @touchstart="handleTouchStart(item,index,$event)"
@touchmove="handleTouchMove" @touchend="handleTouchEnd">
2025-03-12 15:22:01 +08:00
<text
:class="downmenuIndex===index?`doctorsay-container-text-target`:`doctorsay-container-text`"
2025-03-14 17:30:56 +08:00
:style="{
backgroundColor: item.color ? item.color : '',
...(isBack ? {} : { width: '250rpx', height: '75rpx', fontSize: '30rpx', borderRadius: '10rpx' })
2025-04-01 17:27:15 +08:00
}">{{item.title}}</text>
2025-03-12 10:33:32 +08:00
<image v-show="downmenuIndex===index" class="doctorsay-container-button-uplight"
2025-03-12 15:22:01 +08:00
:style="isBack?{}:{top:'30rpx'}" :src="`/static/index/cardicons/uplight.png`" />
2025-03-12 10:33:32 +08:00
</view>
2025-03-07 17:26:02 +08:00
</view>
</scroll-view>
</view>
</view>
<view class="doctorsay-container-container">
<view class="doctorsay-container-title">
<view class="doctorsay-container-left">
<view class="doctorsay-container-left-gun"></view>
<view class="doctorsay-container-left-font">时间矩阵</view>
2025-04-01 17:27:15 +08:00
<view class="doctorsay-container-share" @click="shareToWeixin">
分享到微信
</view>
2025-03-07 17:26:02 +08:00
</view>
<view class="doctorsay-container-right">
2025-03-11 17:27:40 +08:00
<view class="doctorsay-container-right-kuai-cheng"></view>
<view class="doctorsay-container-kuai-font">日常</view>
<view class="doctorsay-container-right-kuai-zi"></view>
<view class="doctorsay-container-kuai-font">周期</view>
<view class="doctorsay-container-button-father" v-for="(item,index) in rightList" :key="index">
<view
:class="rightListIndex===index?`doctorsay-container-button-target`:`doctorsay-container-button`"
@click="rightListClick(index)">
{{item}}
</view>
</view>
2025-03-24 17:37:51 +08:00
<view class="doctorsay-container-juzhen" @click="routerPush">
2025-03-26 17:34:08 +08:00
预览
2025-03-24 17:37:51 +08:00
</view>
2025-03-07 17:26:02 +08:00
</view>
</view>
2025-03-11 17:27:40 +08:00
<view class="super-card">
<view class="super-card-container">
2025-03-26 17:34:08 +08:00
<!-- 气泡 top: `${2 * scrollTop - 253}rpx` -->
<view class="boom">
<view :style="{ marginTop: `-${2 *moveDownNumber}rpx` }">
<view v-for="(item,index) in timearr[0].children" :key="index">
<view
:class="touchindex1 === index ||(liang.index1 === index && !canmove) || (flyNumber.index1 === index && shakyTable) ? `boom-son-target`: `boom-son`"
2025-04-01 17:27:15 +08:00
v-show="item.typeName">
{{item.typeName}}
2025-03-26 17:34:08 +08:00
</view>
</view>
</view>
2025-03-24 17:37:51 +08:00
</view>
2025-03-21 17:36:27 +08:00
<swiper :disable-touch="!canmove || shakyTable" :current="currentNumber" class="scroll-x"
circular :indicator-dots="false" @change="changecurrentNumber" :interval="4000"
:duration="500">
2025-03-14 17:30:56 +08:00
<swiper-item v-for="(item,index) in [1,2,3,4]" :key="index">
2025-03-21 17:36:27 +08:00
<view
style="display: flex;box-shadow: 10rpx 10rpx 20rpx rgba(0, 0, 0, 0.1);background: linear-gradient(to right, #c4dbf4,#c9c2ef, #c6dcf3);">
2025-03-14 17:30:56 +08:00
<view v-for="(item0,index0) in timearr.slice(index * 6, (index + 1) * 6)"
:key="index0">
<view class="super-card-time"
2025-03-21 17:36:27 +08:00
:style="rightListIndex ? { width: '274rpx' } : { width: '206rpx' }">
2025-04-02 17:33:46 +08:00
{{(item0.positioning.length == 1 ? ('0' + item0.positioning) : item0.positioning) + ":00"}}
2025-03-14 17:30:56 +08:00
</view>
2025-03-11 17:27:40 +08:00
</view>
</view>
2025-03-14 17:30:56 +08:00
<view style="display: flex;height: calc(100% - 80rpx);">
<scroll-view style="height: 100%;" :scroll-top="scrollTop"
2025-03-21 17:36:27 +08:00
:scroll-y="canmove && !shakyTable" @scroll="handleScrolltime"
:style="rightListIndex ? { width: '6700rpx' } : { width: '5000rpx' }"
2025-03-14 17:30:56 +08:00
:show-scrollbar="false">
<view style="display: flex;height: 100%;">
<view v-for="(item0,index0) in timearr.slice(index * 6, (index + 1) * 6)"
:key="index0">
<view class="super-card-time-und"
2025-03-21 17:36:27 +08:00
:style="rightListIndex ? { width: '274rpx' } : { width: '206rpx' }">
2025-03-14 17:30:56 +08:00
<view v-for="(item1,index1) in item0.children" style="width: 100%;"
:key="index1">
2025-03-24 17:37:51 +08:00
<view
2025-03-26 17:34:08 +08:00
:class="targetRuler.current===currentNumber && targetRuler.index0 === index0 && targetRuler.index1 === index1 ? targetRuler.index1 ?`title-time-border-big`:`title-time-border-big-top` : `super-card-time-card` "
:style="!targetRuler.bordershow && saveRulerTime.index0 === index0 && saveRulerTime.index1 === index1 ? {zIndex:999} : {borderTop: '1rpx solid transparent'}"
:id="`a${index0}_${index1}`" style="position: relative;"
2025-03-21 17:36:27 +08:00
@click="rulerTouchClick(item1,index0,index1,$event)"
2025-03-14 17:30:56 +08:00
@touchstart="rulerTouchStart(item1,index0,index1,$event)"
@touchmove="rulerTouchMove" @touchend="rulerTouchEnd()"
:data-index0="index0" :data-index1="index1">
2025-03-24 17:37:51 +08:00
2025-03-21 17:36:27 +08:00
<view class="title-time-delete"
v-show="liang.index0 !== index0 || liang.index1 !== index1 || canmove"
2025-04-01 17:27:15 +08:00
v-if="item1.directiveName&&shakyTable "
@click.stop="deleteItems(item1,index0,index1)">
2025-03-21 17:36:27 +08:00
-
</view>
2025-03-14 17:30:56 +08:00
<view :class="getClass(item1,index0,index1)"
2025-03-21 17:36:27 +08:00
style="font-size: 30rpx;overflow: hidden;"
:style="{ animationDelay:`-${computeDelay(index0, index1).toFixed(2)}s` }">
2025-04-01 17:27:15 +08:00
<view class="title-time" v-if="item1.startTime"
2025-03-21 17:36:27 +08:00
v-show=" liang.index0 !== index0 || liang.index1 !== index1 || canmove"
2025-03-14 17:30:56 +08:00
style="margin-top: 5rpx;">
<view class="title-time-time"
style="font-size: 30rpx;">
2025-04-01 17:27:15 +08:00
{{item1.startTime + `-` + item1.endTime}}
2025-03-14 17:30:56 +08:00
</view>
2025-03-17 17:34:36 +08:00
<image class="title-time-button"
2025-04-01 17:27:15 +08:00
:src="item1.cycleType=='日常'?`/static/index/yellowbian.png`:`/static/index/puoplebian.png`" />
2025-03-17 17:34:36 +08:00
<view class="title-time-font">
2025-04-01 17:27:15 +08:00
{{item1.cycleType}}
2025-03-14 17:30:56 +08:00
</view>
</view>
2025-03-21 17:36:27 +08:00
<view style="margin-top: 20rpx;font-weight: 700;"
v-show=" liang.index0 !== index0 || liang.index1 !== index1 || canmove">
2025-04-01 17:27:15 +08:00
{{splitString(item1.directiveName)[0]}}
2025-03-14 17:30:56 +08:00
</view>
2025-03-21 17:36:27 +08:00
<view class="down-icons"
v-show=" liang.index0 !== index0 || liang.index1 !== index1 || canmove"
2025-04-01 17:27:15 +08:00
:style="item1.cycleType!='日常'?{backgroundColor:`rgb(212,203,255)`}:{}"
v-if="splitString(item1.directiveName)[1]">
2025-03-21 17:36:27 +08:00
<view class=""
2025-04-01 17:27:15 +08:00
v-for="(item,index) in splitString(item1.directiveName).slice(1)"
2025-03-21 17:36:27 +08:00
:key="index">
<view class="icon"
2025-04-01 17:27:15 +08:00
:style="item1.cycleType!='日常'?{backgroundColor:`rgb(123,97,255)`}:{}">
{{splitString(item1.directiveName)[index + 1]}}
2025-03-21 17:36:27 +08:00
</view>
2025-03-17 17:34:36 +08:00
</view>
2025-03-14 17:30:56 +08:00
</view>
2025-03-12 15:22:01 +08:00
</view>
</view>
2025-03-11 17:27:40 +08:00
</view>
</view>
</view>
</view>
2025-03-14 17:30:56 +08:00
</scroll-view>
</view>
</swiper-item>
</swiper>
2025-03-11 17:27:40 +08:00
</view>
</view>
<view class="super-card-end">
<view class="super-end-father">
<view class="super-end-font-father">
<view class="super-end-font-gun"></view>
2025-03-21 17:36:27 +08:00
<view class="super-end-font-font">即时指令</view>
2025-03-11 17:27:40 +08:00
</view>
2025-03-21 17:36:27 +08:00
<scroll-view scroll-x class="super-end-items-all" :scroll-left="scrollLeft">
<view class="super-end-items">
<view v-for="(item,index) in bottomItems" :key="index">
<view @touchstart="bottomTouchStart" @touchmove="bottomTouchMove"
2025-03-24 17:37:51 +08:00
@touchend="bottomTouchEnd"
:style="item.target?{background: item.target,transition:`all 1.5s ease-in-out`}:{transition:`all 1.5s ease-in-out`}"
class="super-end-items-father">
2025-03-21 17:36:27 +08:00
<view class="super-end-items-father-close-father" v-show="bottomisShaking"
@click.stop="deletebottom(index,item.name)">
-
</view>
2025-03-07 17:26:02 +08:00
2025-03-21 17:36:27 +08:00
<view :style="{ animationDelay:`-${index * 0.1}s` }"
:class="bottomisShaking?`super-end-items-img-father-active`:`super-end-items-img-father`">
<image class="super-end-items-img" :src="item.url" />
</view>
<view class="super-end-items-font">{{item.name}}</view>
2025-03-14 17:30:56 +08:00
</view>
</view>
</view>
2025-03-21 17:36:27 +08:00
</scroll-view>
2025-03-11 17:27:40 +08:00
</view>
</view>
</view>
2025-03-05 17:29:32 +08:00
</view>
2025-03-14 17:30:56 +08:00
<!-- 长按的弹出层 -->
2025-03-26 17:34:08 +08:00
<view v-show="isopen" class="popup-overlay" @click="isopen=false;flyNumber.index0=999;touchindex1=-1">
2025-03-14 17:30:56 +08:00
<view class="popup-overlay-content"
:style="{ top: (2*openY - 350) + 'rpx',left: (2*openX - 780) + 'rpx',opacity: isopacity ? 1 : 0,backgroundColor:timearr[flyNumber.index0]?.children[flyNumber.index1]?.type==='日常'? '#fffcf6':'rgb(246, 244, 254)' }"
@click.stop>
<view class="popup-overlay-content-left">
<image class="popup-overlay-content-left-img" :src="`/static/index/teeth.png`" />
<text class="popup-overlay-content-left-font">
{{ timearr[flyNumber.index0]?.children[flyNumber.index1]?.value }}
</text>
</view>
<view class="popup-overlay-content-right">
<view class="time-font">
10:00 - 10:10
</view>
<view class="time-text">
为老人提供口腔清洁器具牙膏牙刷及水杯看护完成
</view>
</view>
2025-03-11 17:27:40 +08:00
</view>
2025-03-14 17:30:56 +08:00
</view>
<!-- 拉动松手的弹出层 -->
<view v-if="songisopen" class="popup-song" @click="songisopen=false">
<view class="popup-song-contain" :style="{opacity: songisopacity ? 1 : 0}" @click.stop>
<view class="popup-song-father">
<image class="shu-up-img" src="/static/index/cheng.png" />
<view class="shu-up-font">
<view class="">
服务时段{{ openValue.time + ":00"}}
</view>
<view style="margin-left: 30rpx;">
护理时长10分钟
</view>
</view>
<view class="shu-container-left">
<view class="shu-container-left-gun"></view>
<view class="shu-container-left-font">服务指令</view>
</view>
<view class="arrayindex">
<view v-for="(item,index) in openValue.array" :key="index">
2025-03-21 17:36:27 +08:00
<view style="position: relative;box-shadow: 10rpx 10rpx 20rpx rgba(105, 129, 178, 0.4)"
2025-03-17 17:34:36 +08:00
:class="cardsumit.op.index[2]===index?`arrayindex-one-target`:`arrayindex-one`"
2025-04-01 17:27:15 +08:00
@click="clickOp(index,item)">
<image class="ri-img" v-show="item.cycleType ==='日常护理'"
2025-03-17 17:34:36 +08:00
:src="cardsumit.op.index[2]!==index? `/static/index/ridark.png`:`/static/index/ri.png`" />
2025-04-01 17:27:15 +08:00
<image class="ri-img" v-show="item.cycleType ==='周期护理'"
2025-03-17 17:34:36 +08:00
:src="cardsumit.op.index[2]==index? `/static/index/zhoudark.png`:`/static/index/zhou.png`" />
2025-04-01 17:27:15 +08:00
<image class="ri-img" v-show="item.cycleType ==='即时护理'"
2025-03-17 17:34:36 +08:00
:src="cardsumit.op.index[2]==index? `/static/index/jidark.png`:`/static/index/ji.png`" />
2025-04-01 17:27:15 +08:00
{{item.relName}}
2025-03-14 17:30:56 +08:00
</view>
</view>
</view>
<view class="shu-container-left" style="margin-top: 50rpx;" v-show="openOp!=2">
<view class="shu-container-left-gun"></view>
<view class="shu-container-left-font">开始分钟</view>
</view>
<view class="time-father" v-show="openOp!=2">
<view v-for="(item,index) in timeArray" :key="index">
<view v-show="Number(item)>=50" class="time-one-hui">
{{item}}
</view>
<view v-show="Number(item)<50"
:class="cardsumit.startTime===item?`time-one-target`:`time-one`"
@click="clickTime(item)">
{{item}}
</view>
</view>
</view>
<view class="shu-container-left" style="margin-top: 50rpx;" v-show="openOp==1">
<view class="shu-container-left-gun"></view>
<view class="shu-container-left-font">周期类型</view>
</view>
<view class="radio-father" v-show="openOp==1">
<view :class="isweek?`radio-circle-target`: `radio-circle`"
@click="isweek=true;cardsumit.monthTime=''"></view>
<view class="radio-font" @click="isweek=true;cardsumit.monthTime=''">每周</view>
<view :class="!isweek?`radio-circle-target`: `radio-circle`"
@click="isweek=false;cardsumit.weekTime=''"></view>
<view class="radio-font" @click="isweek=false;cardsumit.weekTime=''">每月</view>
</view>
<view class="week-father" v-show="isweek&&openOp==1">
<view v-for="(item,index) in weekDays" :key="index">
<view :class="cardsumit.weekTime===item?`week-one-target`:`week-one`"
@click="clickweek(item)">
{{item}}
</view>
</view>
</view>
<view class="month-father" v-show="!isweek&&openOp==1">
<view v-for="(item,index) in days" :key="index">
<view :class="cardsumit.monthTime===item?`month-one-target`:`month-one`"
@click="clickmonth(item)">
{{item}}
</view>
</view>
</view>
<view class="button-father">
<view style="display: flex;">
<view class="button-father-right" @click="movetoruler" v-show="isblue()">
确定
</view>
<view class="button-father-wrong" v-show="!isblue()">
确定
</view>
<view class="button-father-wrong" @click="songisopen=false" style="margin-left: 20rpx;">
取消
</view>
</view>
</view>
</view>
</view>
</view>
2025-03-21 17:36:27 +08:00
<!-- 删除表格的的弹出层 -->
<view v-show="deleteisopen" class="popup-delete" @click="deleteisopen=false">
<view class="popup-delete-content" :style="{ opacity: deleteisopacity ? 1 : 0 }" @click.stop>
<image class="popup-delete-img" src="/static/index/deleteicon.png" />
<view class="popup-delete-text">
确定要删除 {{deletename}} ?
</view>
<view class="popup-delete-button">
<view class="popup-delete-button-right" @click="deleteisopen=false">
取消
</view>
<view class="popup-delete-button-left" @click="deleteRuler(deleteindex[0],deleteindex[1])">
确定
</view>
</view>
</view>
</view>
<!-- 删除下方菜单的的弹出层 -->
<view v-show="deletedownisopen" class="popup-delete" @click="deletedownisopen=false">
<view class="popup-delete-content" :style="{ opacity: deletedownisopacity ? 1 : 0 }" @click.stop>
<image class="popup-delete-img" src="/static/index/deleteicon.png" />
<view class="popup-delete-text">
确定要删除 {{deletename}} ?
</view>
<view class="popup-delete-button">
<view class="popup-delete-button-right" @click="deletedownisopen=false">
取消
</view>
<view class="popup-delete-button-left"
@click="bottomItems.splice(deletebottomindex, 1);deletedownisopen=false">
确定
</view>
</view>
</view>
</view>
2025-04-01 17:27:15 +08:00
<!-- 分享的弹出层 -->
<view v-show="shareShow" class="popup-share" @click="shareShow=false">
<view class="popup-share-content" :style="{ opacity: deletedownisopacity ? 1 : 0 }" @click.stop>
<view class="popup-share-title">
护理日程分享
<image class="popup-share-img" src="/static/index/NU.png" />
</view>
<view class="popup-share-upcontent">
<view class="popup-share-font">久泰护理日程分享测试</view>
</view>
<view class="popup-share-gray"></view>
<view class="popup-share-downcontent">
<view class="popup-share-downcontent-left">
<image class="popup-downcontent-img" src="/static/index/NU.png" />
<view class="popup-downcontent-font">久泰护理</view>
</view>
<view class="popup-share-downcontent-button" @click="clickshare">
分享
</view>
</view>
</view>
</view>
2025-03-05 17:29:32 +08:00
</view>
2025-03-11 17:27:40 +08:00
2025-03-05 17:29:32 +08:00
</template>
<script setup lang="ts">
2025-03-14 17:30:56 +08:00
import { ref, onMounted, onBeforeUnmount, computed, nextTick, defineProps, defineEmits, watch } from 'vue';
2025-03-24 17:37:51 +08:00
import { onShow, onHide } from '@dcloudio/uni-app';
2025-03-05 17:29:32 +08:00
import type { roomBtttonType } from "./index";
2025-04-02 17:33:46 +08:00
import { getServiceTree, getNclist, addBatch } from "./api.js";
import index from '../../request';
2025-03-05 17:29:32 +08:00
const props = defineProps({
isshow: {
type: Boolean,
required: true,
},
darkFans: {
type: Boolean,
required: true,
},
2025-03-11 17:27:40 +08:00
canmove: {
2025-03-07 17:26:02 +08:00
type: Boolean,
required: true,
2025-03-11 17:27:40 +08:00
},
liang: {
type: Object,
2025-03-07 17:26:02 +08:00
}
2025-03-05 17:29:32 +08:00
});
2025-03-14 17:30:56 +08:00
watch(
() => props.canmove,
() => {
2025-03-21 17:36:27 +08:00
bottomisShaking.value = false;
2025-03-14 17:30:56 +08:00
})
watch(
() => props.isshow,
() => {
bottomisShaking.value = false
2025-03-21 17:36:27 +08:00
shakyTable.value = false
2025-03-14 17:30:56 +08:00
})
2025-03-11 17:27:40 +08:00
onMounted(() => {
})
2025-03-14 17:30:56 +08:00
const bottomItems = ref([
{
name: '纸尿裤',
url: "/static/index/niao.png"
},
{
name: '呕吐',
url: "/static/index/tu.png"
},
{
name: '吸痰',
url: "/static/index/ou.png"
},
{
name: '大便',
url: "/static/index/baba.png"
},
2025-03-21 17:36:27 +08:00
{
name: '纸尿裤',
url: "/static/index/niao.png"
},
{
name: '呕吐',
url: "/static/index/tu.png"
},
{
name: '吸痰',
url: "/static/index/ou.png"
},
{
name: '大便',
url: "/static/index/baba.png"
},
{
name: '纸尿裤',
url: "/static/index/niao.png"
},
{
name: '呕吐',
url: "/static/index/tu.png"
},
{
name: '吸痰',
url: "/static/index/ou.png"
},
{
name: '大便',
url: "/static/index/baba.png"
},
{
name: '纸尿裤',
url: "/static/index/niao.png"
},
{
name: '呕吐',
url: "/static/index/tu.png"
},
{
name: '吸痰',
url: "/static/index/ou.png"
},
{
name: '大便',
url: "/static/index/baba.png"
},
2025-03-14 17:30:56 +08:00
])
const timeArray = [
`00`, `05`, `10`, `15`, `20`, `25`, `30`, `35`, `40`, `45`, `50`, `55`
];
const weekDays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
const days = Array.from({ length: 31 }, (_, i) => (i + 1).toString().padStart(2, "0"));
const isweek = ref(true);
2025-03-11 17:27:40 +08:00
//弹窗
2025-03-21 17:36:27 +08:00
// const containerRef = ref(null);
const scrollLeft = ref(0);
2025-03-11 17:27:40 +08:00
//移动表格
const scrollTop = ref(0)
//左下的数组
const downList = ref<any>()
2025-03-07 17:26:02 +08:00
//左下的数组
2025-03-11 17:27:40 +08:00
const rightList = ref<String[]>([
2025-03-12 15:22:01 +08:00
// "三分段",
// "四分段",
2025-03-07 17:26:02 +08:00
])
2025-04-01 17:27:15 +08:00
const bigArray = ref([]);
2025-03-14 17:30:56 +08:00
const isopen = ref(false)
const songisopen = ref(false)
const isopacity = ref(false)
const songisopacity = ref(false)
2025-03-21 17:36:27 +08:00
// 删除表格弹窗
const deleteisopen = ref(false);
const deletename = ref("")
const deleteisopacity = ref(false)
2025-03-14 17:30:56 +08:00
//第几套表格
const currentNumber = ref(1);
2025-03-21 17:36:27 +08:00
const scrollKey = ref(0);
function pseudoRandom(index0, index1) {
const seed = index0 * 55.9898 + index1 * 78.233;
// 产生一个伪随机数,取小数部分
return Math.abs(Math.sin(seed) * 43758.5453) % 1;
}
function computeDelay(index0, index1) {
const range = 2; // 延迟范围 0 ~ 2 秒
return pseudoRandom(index0, index1) * range;
}
2025-03-14 17:30:56 +08:00
const changecurrentNumber = (event : any) => {
2025-03-24 17:37:51 +08:00
2025-03-14 17:30:56 +08:00
currentNumber.value = event.detail.current;
2025-03-21 17:36:27 +08:00
nextTick(() => {
scrollTop.value = moveDownNumber.value;
})
2025-03-14 17:30:56 +08:00
};
2025-03-21 17:36:27 +08:00
//监听拖拽
const dragOffset = ref(0);
const moveDownNumber = ref(0)
function handleScrolltime(e) {
let num = e.detail.scrollTop
let formattedNum = parseFloat(num.toFixed(2));
moveDownNumber.value = formattedNum
}
const changeBug = ref(true);
const nextItems = () => {
currentNumber.value > 2 ? currentNumber.value = 0 : currentNumber.value++
}
2025-03-11 17:27:40 +08:00
// 方法:根据条件返回不同的类名
const getClass = (item, index0, index1) => {
2025-03-24 17:37:51 +08:00
2025-03-26 17:34:08 +08:00
if (!props.canmove && props.liang.index0 === index0 && props.liang.index1 === index1 && (redNameindex0.value.includes(index0 + (currentNumber.value * 6)) || (redNameindex1.value != index1))) {
2025-03-21 17:36:27 +08:00
return 'title-time-border-red';
}
else if (!props.canmove && props.liang.index0 === index0 && props.liang.index1 === index1) {
2025-03-14 17:30:56 +08:00
return 'title-time-border-blue';
2025-03-21 17:36:27 +08:00
}
2025-04-01 17:27:15 +08:00
else if (item.cycleType === '日常') {
2025-03-21 17:36:27 +08:00
if (flyNumber.value.index0 === (index0 + (currentNumber.value * 6)) && flyNumber.value.index1 === index1 && shakyTable.value) {
return 'title-time-border-yellow-active-transparent';
} else if (shakyTable.value) {
return 'title-time-border-yellow-active';
} else {
return 'title-time-border-yellow';
}
2025-04-01 17:27:15 +08:00
} else if (item.cycleType) {
2025-03-21 17:36:27 +08:00
//为啥这么写,是因为动画写行内无效!!!
if (flyNumber.value.index0 === (index0 + (currentNumber.value * 6)) && flyNumber.value.index1 === index1 && shakyTable.value) {
return 'title-time-border-pouple-active-transparent';
}
else if (shakyTable.value) {
return 'title-time-border-pouple-active';
} else {
return 'title-time-border-pouple';
}
2025-03-11 17:27:40 +08:00
}
2025-03-14 17:30:56 +08:00
return 'title-time-border';
2025-03-11 17:27:40 +08:00
}
2025-03-07 17:26:02 +08:00
// 初始化下面侧单列表
const doctorsayList = ref<roomBtttonType[]>([
{ url: '/static/index/doctorsay/light/clean.png', targetUrl: '/static/index/doctorsay/dark/clean.png', name: '清洁' },
{ url: '/static/index/doctorsay/light/drink.png', targetUrl: '/static/index/doctorsay/dark/drink.png', name: '饮食' },
{ url: '/static/index/doctorsay/light/bed.png', targetUrl: '/static/index/doctorsay/dark/bed.png', name: '睡眠' },
2025-03-12 15:22:01 +08:00
{ url: '/static/index/doctorsay/light/shi.png', targetUrl: '/static/index/doctorsay/dark/shi.png', name: '排泻' },
2025-03-07 17:26:02 +08:00
{ url: '/static/index/doctorsay/light/use.png', targetUrl: '/static/index/doctorsay/dark/use.png', name: '日常' },
]);
2025-03-05 17:29:32 +08:00
// 当前选中的菜单索引
2025-03-12 15:22:01 +08:00
const rightListIndex = ref<number>(1);
2025-03-17 17:34:36 +08:00
// const undermenuIndex = ref<number>(0);
2025-03-07 17:26:02 +08:00
const upmenuIndex = ref<number>(0);
2025-03-11 17:27:40 +08:00
const downmenuIndex = ref<number>(999);
2025-03-05 17:29:32 +08:00
// 暗黑模式
// const darkFans = ref<boolean>(false);
const underFans = ref<boolean>(false);
// 当前选中的菜单索引
const roomTar = ref<number[]>([]);
2025-03-21 17:36:27 +08:00
const emit = defineEmits(['darkchange', 'savename', 'saveruler', 'closename', 'changefangkuang']);
2025-03-05 17:29:32 +08:00
// 暗黑模式改变
const darkFanschange = () => {
emit('darkchange', !props.darkFans);
}
2025-03-11 17:27:40 +08:00
//变更左侧菜单
const changLeft = (index : number) => {
upmenuIndex.value = index
2025-04-01 17:27:15 +08:00
downList.value = bigArray.value[index].children
2025-03-11 17:27:40 +08:00
downmenuIndex.value = 999
}
// 变更右部菜单
const rightListClick = (index : number) => {
rightListIndex.value = index;
};
2025-03-05 17:29:32 +08:00
2025-03-07 17:26:02 +08:00
const timer = ref(null);//计时器
2025-03-11 17:27:40 +08:00
const elementsInfo = ref({})//所有表格的信息
2025-03-14 17:30:56 +08:00
const moveX = ref(0)
const moveY = ref(0)
const openX = ref(0)
const openY = ref(0)
const flyNumber = ref({
index0: 999,
2025-03-21 17:36:27 +08:00
index1: 999,
2025-04-01 17:27:15 +08:00
typeName: ''
2025-03-14 17:30:56 +08:00
})
2025-03-21 17:36:27 +08:00
const deletebottomindex = ref(-1);
const deletedownisopen = ref(false);
const deletedownisopacity = ref(false);
const deletebottom = (index : number, name : string) => {
bottomisShaking.value = false;
deletebottomindex.value = index;
shakyTable.value = false;
deletedownisopacity.value = false;
deletedownisopen.value = true;
deletename.value = name;
setTimeout(() => {
deletedownisopacity.value = true
}, 200)
}
const deleteindex = ref([-1, -1])
2025-04-01 17:27:15 +08:00
const deleteId = ref("");
const deleteItems = (item : any, index0 : number, index1 : number) => {
2025-03-21 17:36:27 +08:00
deleteindex.value = [-1, -1];
shakyTable.value = false;
bottomisShaking.value = false;
deleteisopacity.value = false;
deleteisopen.value = true;
deleteindex.value = [index0 + (currentNumber.value * 6), index1]
2025-04-01 17:27:15 +08:00
deletename.value = item.directiveName;
deleteId.value = item.id
2025-03-21 17:36:27 +08:00
setTimeout(() => {
deleteisopacity.value = true
}, 200)
}
2025-03-26 17:34:08 +08:00
const touchindex1 = ref(-1);
2025-04-01 17:27:15 +08:00
// 分享矩阵到微信
const shareShow = ref(false);
const shareToWeixin = () => {
shareShow.value = true;
deletedownisopacity.value = false;
setTimeout(() => {
deletedownisopacity.value = true
}, 100)
2025-03-26 17:34:08 +08:00
2025-04-01 17:27:15 +08:00
}
const clickshare = () => {
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 0,
href: "https://www.baidu.com/",
title: "护理日程分享",
summary: "九泰护理日程测试",
imageUrl: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png",
success: function (res) {
console.log("success:");
},
fail: function (err) {
console.log("fail:");
}
});
}
2025-03-21 17:36:27 +08:00
//表格点击开始
const rulerTouchClick = (item : any, index0 : number, index1 : number, e : any) => {
2025-04-01 17:27:15 +08:00
if (item.directiveName) {
2025-03-26 17:34:08 +08:00
touchindex1.value = index1;
2025-03-21 17:36:27 +08:00
const query = uni.createSelectorQuery()
query
.selectAll('.super-card-time-card')
.boundingClientRect((data : any) => {
data.forEach(async (res : any) => {
// 根据你的条件筛选元素
if (res.left > 200 && res.left < 1067 && res.top < 570 && res.top > 140 && res.dataset.index0 == index0 && res.dataset.index1 == index1) {
if (res.left > 200 && res.left < 500) {
// 表格太靠左侧,修改到右面
openX.value = Math.floor(res.left) + 520;
} else {
openX.value = Math.floor(res.left)
}
if (res.top > 140 && res.top < 300) {
// 表格太靠上侧,修改到下面
openY.value = Math.floor(res.top) + 250;
} else {
openY.value = Math.floor(res.top)
}
// openY.value = Math.floor(res.top);
await nextTick()
isopen.value = true;
isopacity.value = false;
//加动画
setTimeout(() => {
isopacity.value = true;
}, 100)
}
})
})
.exec()
}
2025-03-14 17:30:56 +08:00
}
2025-03-21 17:36:27 +08:00
const shakyTable = ref(false);
2025-03-24 17:37:51 +08:00
const reldata = ref([]);
2025-03-11 17:27:40 +08:00
//表格长按开始
2025-03-14 17:30:56 +08:00
const rulerTouchStart = (item : any, index0 : number, index1 : number, e : any) => {
2025-03-21 17:36:27 +08:00
scrollTop.value = moveDownNumber.value;
2025-03-26 17:34:08 +08:00
redNameindex0.value = [];
let index1Number = -1
2025-03-14 17:30:56 +08:00
moveX.value = Math.floor(e.touches[0].pageX);
moveY.value = Math.floor(e.touches[0].pageY);
2025-03-07 17:26:02 +08:00
timer.value = setTimeout(() => {
2025-04-01 17:27:15 +08:00
if (item.directiveName) {
2025-03-26 17:34:08 +08:00
timearr.value.forEach((element0 : any, index0 : number) => {
element0.children.forEach((element1 : any) => {
2025-04-01 17:27:15 +08:00
if (element1.typeName === item.typeName && element1.directiveName) {
2025-03-26 17:34:08 +08:00
redNameindex0.value.push(index0)
}
2025-04-01 17:27:15 +08:00
if (element1.directiveName) {
2025-03-26 17:34:08 +08:00
index1Number = index0
}
})
})
if (redNameindex0.value.length) {
redNameindex1.value = index1
} else {
redNameindex1.value = index1Number + 1
}
2025-04-01 17:27:15 +08:00
flyNumber.value.typeName = item.typeName
2025-03-14 17:30:56 +08:00
flyNumber.value.index0 = index0 + (currentNumber.value * 6);
flyNumber.value.index1 = index1;
2025-03-21 17:36:27 +08:00
indexsave.value = [-1, -1]
2025-03-24 17:37:51 +08:00
reldata.value = []
2025-03-21 17:36:27 +08:00
isTuoing.value = true;
2025-03-14 17:30:56 +08:00
const query = uni.createSelectorQuery()
query
.selectAll('.super-card-time-card')
.boundingClientRect((data : any) => {
data.forEach(async (res : any) => {
// 根据你的条件筛选元素
2025-03-21 17:36:27 +08:00
if (res.left > 200 && res.left < 1067 && res.top < 570 && res.top > 140) {
shakyTable.value = true;
2025-03-24 17:37:51 +08:00
reldata.value.push(res)
2025-03-14 17:30:56 +08:00
}
})
})
.exec()
2025-03-24 17:37:51 +08:00
emit('saveruler', item, reldata.value);
2025-03-11 17:27:40 +08:00
}
2025-03-21 17:36:27 +08:00
}, 100); // 2秒后触发
2025-03-14 17:30:56 +08:00
}
const rulerTouchMove = (e : any) => {
const moveXa = Math.floor(e.touches[0].pageX);
const moveYa = Math.floor(e.touches[0].pageY);
// 计算移动距离
if (
Math.abs(moveXa - moveX.value) > 0 ||
Math.abs(moveYa - moveY.value) > 0
) {
// 移动时取消长按计时器
if (timer.value) {
clearTimeout(timer.value);
timer.value = null;
}
}
2025-03-07 17:26:02 +08:00
}
2025-03-11 17:27:40 +08:00
//表格长按结束
const rulerTouchEnd = () => {
2025-03-21 17:36:27 +08:00
isTuoing.value = false;
2025-03-07 17:26:02 +08:00
if (timer.value) {
clearTimeout(timer.value);
timer.value = null;
}
2025-03-11 17:27:40 +08:00
}
2025-03-14 17:30:56 +08:00
const deleteRuler = (index0 : number, index1 : number) => {
2025-04-01 17:27:15 +08:00
timearr.value[index0].children[index1] = { directiveName: "" };
2025-03-14 17:30:56 +08:00
isopen.value = false;
flyNumber.value.index0 = 999;
flyNumber.value.index1 = 999;
2025-03-17 17:34:36 +08:00
let emptyChildIndices = [];
let emptyChildNumber = 0;
timearr.value.forEach((res : any, rowIndex : number) => {
emptyChildIndices = [];
emptyChildNumber = res.children.length;
// 遍历 res.children 数组中的每个子元素 child
res.children.forEach((child, index) => {
// 检查 child 的 value 属性是否为空
2025-04-01 17:27:15 +08:00
if (child.directiveName === null || child.directiveName === '' || child.directiveName === undefined) {
2025-03-17 17:34:36 +08:00
// 如果是空值,检查其他 res.children 中相同索引的元素
const isEmptyInAllRows = timearr.value.every((otherRes) => {
const otherChild = otherRes.children[index];
2025-04-01 17:27:15 +08:00
return otherChild === undefined || otherChild.directiveName === null || otherChild.directiveName === '' || otherChild.directiveName === undefined;
2025-03-17 17:34:36 +08:00
});
// 如果在所有行中该位置的 value 都为空,记录该索引
if (isEmptyInAllRows) {
emptyChildIndices.push(index);
}
}
});
})
if (emptyChildNumber > 4 && emptyChildIndices.length > 1) {
timearr.value.forEach((res : any, rowIndex : number) => {
2025-03-21 17:36:27 +08:00
res.children.splice(emptyChildIndices[0], 1)
2025-03-17 17:34:36 +08:00
})
} else {
timearr.value.forEach((res : any, rowIndex : number) => {
res.children.splice(emptyChildIndices[0], 1);
2025-04-01 17:27:15 +08:00
res.children.push({ directiveName: '' })
2025-03-17 17:34:36 +08:00
})
}
2025-03-21 17:36:27 +08:00
deleteisopen.value = false;
2025-04-02 17:33:46 +08:00
saveAll()
2025-03-14 17:30:56 +08:00
}
2025-03-12 15:22:01 +08:00
const longPressTimer = ref(null);
const isScrolling = ref(false)
//长按计时器
let scrollTimeout = null
function handleScroll(e) {
isScrolling.value = true
// 清除之前的定时器
if (scrollTimeout) clearTimeout(scrollTimeout)
// 设置新的定时器
scrollTimeout = setTimeout(() => {
isScrolling.value = false;
}, 400)
}
const isBack = ref(false)
2025-03-14 17:30:56 +08:00
const saveX = ref(0);
const saveY = ref(0);
2025-03-21 17:36:27 +08:00
const isTuoing = ref(false);
//给红色表格用
const redNameindex0 = ref([]);
2025-03-26 17:34:08 +08:00
const redNameindex1 = ref(-1);
2025-04-01 17:27:15 +08:00
// 存储菜单的id
const saveId = ref("");
const saveTagName = ref("");
2025-03-11 17:27:40 +08:00
//左下菜单长按开始
2025-04-01 17:27:15 +08:00
const handleTouchStart = (item : any, index : number, e : any) => {
// console.log("????", item)
2025-03-24 17:37:51 +08:00
scrollTop.value = moveDownNumber.value;
2025-03-21 17:36:27 +08:00
shakyTable.value = false
2025-03-14 17:30:56 +08:00
saveX.value = Math.floor(e.touches[0].pageX);
saveY.value = Math.floor(e.touches[0].pageY);
2025-04-01 17:27:15 +08:00
longPressTimer.value = setTimeout(() => {
2025-03-26 17:34:08 +08:00
let noHave = false;
2025-04-01 17:27:15 +08:00
timearr.value[0].children.forEach((element : any, index0 : number) => {
if (element.typeName === item.title) {
2025-03-26 17:34:08 +08:00
scrollTop.value = 0
scrollTop.value = index0 * 104
noHave = true
}
})
2025-04-01 17:27:15 +08:00
if (!noHave) {
2025-03-26 17:34:08 +08:00
scrollTop.value = 0
scrollTop.value = 999
}
2025-04-01 17:27:15 +08:00
}, 190)
2025-03-12 15:22:01 +08:00
//执行方法
longPressTimer.value = setTimeout(() => {
2025-03-26 17:34:08 +08:00
redNameindex0.value = [];
2025-03-12 15:22:01 +08:00
if (isScrolling.value) return
2025-03-26 17:34:08 +08:00
let index1save = -1;
let indexanthersave = -1;
2025-03-24 17:37:51 +08:00
timearr.value.forEach((element0 : any, index0 : number) => {
2025-03-26 17:34:08 +08:00
element0.children.forEach((element1 : any, index1 : number) => {
2025-04-01 17:27:15 +08:00
// console.log("!!!!",element1)
if (element1.typeName === item.title && element1.directiveName) {
2025-03-21 17:36:27 +08:00
redNameindex0.value.push(index0)
2025-03-26 17:34:08 +08:00
index1save = index1
}
2025-04-01 17:27:15 +08:00
if (element1.directiveName) {
2025-03-26 17:34:08 +08:00
if (index1 > indexanthersave) {
indexanthersave = index1
}
2025-03-21 17:36:27 +08:00
}
})
})
2025-04-01 17:27:15 +08:00
2025-03-26 17:34:08 +08:00
if (redNameindex0.value.length) {
redNameindex1.value = index1save
} else {
redNameindex1.value = indexanthersave + 1
}
// redName.value = item;
2025-03-12 15:22:01 +08:00
isBack.value = true;
downmenuIndex.value = index
2025-03-14 17:30:56 +08:00
indexsave.value = [-1, -1]
2025-03-21 17:36:27 +08:00
isTuoing.value = true;
2025-03-24 17:37:51 +08:00
// const reldata = []
reldata.value = []
2025-03-14 17:30:56 +08:00
const query = uni.createSelectorQuery()
query
.selectAll('.super-card-time-card')
.boundingClientRect((data : any) => {
data.forEach((res : any) => {
// 根据你的条件筛选元素
2025-03-21 17:36:27 +08:00
if (res.left > 200 && res.left < 1067 && res.top < 570 && res.top > 140) {
2025-03-24 17:37:51 +08:00
reldata.value.push(res)
2025-03-14 17:30:56 +08:00
}
})
2025-03-12 15:22:01 +08:00
})
2025-03-14 17:30:56 +08:00
.exec()
2025-04-01 17:27:15 +08:00
emit('savename', item.title, reldata.value);
2025-03-12 15:22:01 +08:00
}, 200)
}
2025-03-14 17:30:56 +08:00
function isblue() {
if (((!openOp.value) && cardsumit.value.startTime) || (openOp.value === 1 && cardsumit.value.startTime && (cardsumit.value.weekTime || cardsumit.value.monthTime)) || openOp.value === 2) {
return true
} else {
return false
}
}
const handleTouchMove = (e : any) => {
const moveX = Math.floor(e.touches[0].pageX);
const moveY = Math.floor(e.touches[0].pageY);
// 计算移动距离
if (
Math.abs(moveX - saveX.value) > 0 ||
Math.abs(moveY - saveY.value) > 0
) {
if (longPressTimer.value) {
clearTimeout(longPressTimer.value)
longPressTimer.value = null
}
}
}
2025-03-12 15:22:01 +08:00
const handleTouchEnd = () => {
2025-03-21 17:36:27 +08:00
isTuoing.value = false;
2025-03-12 15:22:01 +08:00
if (longPressTimer.value) {
clearTimeout(longPressTimer.value)
longPressTimer.value = null
}
2025-03-11 17:27:40 +08:00
}
2025-03-14 17:30:56 +08:00
const bottomTimer = ref(null);
const bottomisShaking = ref(false);
2025-03-21 17:36:27 +08:00
const bottomTouchStart = (e) => {
saveX.value = Math.floor(e.touches[0].pageX);
saveY.value = Math.floor(e.touches[0].pageY);
2025-03-14 17:30:56 +08:00
// 2秒后触发抖动效果
bottomTimer.value = setTimeout(() => {
bottomisShaking.value = true
}, 500)
}
2025-03-21 17:36:27 +08:00
const bottomTouchMove = (e) => {
const moveX = Math.floor(e.touches[0].pageX);
const moveY = Math.floor(e.touches[0].pageY);
// 计算移动距离
if (
Math.abs(moveX - saveX.value) > 0 ||
Math.abs(moveY - saveY.value) > 0
) {
if (bottomTimer.value) {
clearTimeout(bottomTimer.value)
bottomTimer.value = null
}
}
}
2025-03-14 17:30:56 +08:00
const bottomTouchEnd = () => {
if (bottomTimer.value) {
clearTimeout(bottomTimer.value)
bottomTimer.value = null
}
}
const openValue = ref({
time: "",
array: []
})
const cardsumit = ref({
op: {
name: "",
index: [-1, -1, -1],
},
startTime: "",
monthTime: "",
weekTime: ""
})
const openOp = ref(0);
2025-04-01 17:27:15 +08:00
const clickOp = (index : number, item : any) => {
2025-03-14 17:30:56 +08:00
cardsumit.value.startTime = ""
cardsumit.value.monthTime = ""
cardsumit.value.weekTime = ""
2025-04-01 17:27:15 +08:00
saveId.value = item.id;
saveTagName.value = item.tagName
2025-03-17 17:34:36 +08:00
if (cardsumit.value.op.index[2] === index) {
cardsumit.value.op.index[2] = -1;
2025-03-14 17:30:56 +08:00
cardsumit.value.op.name = ""
openOp.value = -1
} else {
2025-03-17 17:34:36 +08:00
cardsumit.value.op.index[2] = index
2025-04-01 17:27:15 +08:00
cardsumit.value.op.name = item.relName
switch (item.cycleType) {
case `日常护理`:
openOp.value = 0
break;
case `周期护理`:
openOp.value = 1
break;
case `即时护理`:
openOp.value = 2
break;
default:
break;
}
2025-03-14 17:30:56 +08:00
}
}
const clickTime = (index : string) => {
if (cardsumit.value.startTime == index) {
cardsumit.value.startTime = ""
} else {
cardsumit.value.startTime = index
}
}
const clickweek = (index : string) => {
if (cardsumit.value.weekTime == index) {
cardsumit.value.weekTime = ""
} else {
cardsumit.value.weekTime = index
}
}
const clickmonth = (index : string) => {
if (cardsumit.value.monthTime == index) {
cardsumit.value.monthTime = ""
} else {
cardsumit.value.monthTime = index
}
}
const indexsave = ref([-1, -1]);
2025-03-11 17:27:40 +08:00
//表格拖动结束
const rulerEnd = async (res : any) => {
2025-03-12 15:22:01 +08:00
isBack.value = false;
2025-03-26 17:34:08 +08:00
2025-03-11 17:27:40 +08:00
if (props.liang.index0 !== 999 && res) {
2025-04-01 17:27:15 +08:00
//检测拖动是否超出范围和是否不合法
2025-03-26 17:34:08 +08:00
if (redNameindex0.value.includes(props.liang.index0 + (currentNumber.value * 6)) || redNameindex1.value !== props.liang.index1) {
return false;
}
2025-03-14 17:30:56 +08:00
cardsumit.value = {
op: {
name: "",
index: [-1, -1, -1],
},
startTime: "",
monthTime: "",
weekTime: ""
2025-03-11 17:27:40 +08:00
}
2025-03-14 17:30:56 +08:00
songisopacity.value = false;
2025-04-01 17:27:15 +08:00
//虚化的动画
2025-03-14 17:30:56 +08:00
songisopen.value = true;
setTimeout(() => {
songisopacity.value = true
}, 200)
2025-04-01 17:27:15 +08:00
// 存储 两个index
2025-03-17 17:34:36 +08:00
cardsumit.value.op.index[0] = upmenuIndex.value
cardsumit.value.op.index[1] = downmenuIndex.value
2025-04-01 17:27:15 +08:00
// 存储时间和二级数组
openValue.value.time = timearr.value[props.liang.index0 + (currentNumber.value * 6)].positioning;
openValue.value.array = bigArray.value[upmenuIndex.value].children[downmenuIndex.value].children
//将逗号换成()
openValue.value.array.forEach((element : any) => {
element.relName = element.title + (element.tagName ? element.tagName.split(",").map(item => `${item}`).join("") : "")
})
//存储选中表格的坐标
2025-03-14 17:30:56 +08:00
indexsave.value = [props.liang.index0 + (currentNumber.value * 6), props.liang.index1]
2025-04-01 17:27:15 +08:00
//开启弹窗
clickOp(0, openValue.value.array[0])
2025-03-14 17:30:56 +08:00
}
}
2025-03-26 17:34:08 +08:00
// (长按表格后)表格拖动结束
2025-03-21 17:36:27 +08:00
const rulerMoveEnd = (object : any) => {
2025-04-01 17:27:15 +08:00
if (props.liang.index0 !== 999 && object.cycleType) {
2025-03-26 17:34:08 +08:00
if (redNameindex0.value.includes(props.liang.index0 + (currentNumber.value * 6)) || redNameindex1.value !== props.liang.index1) {
return false;
}
2025-03-21 17:36:27 +08:00
indexsave.value = [props.liang.index0 + (currentNumber.value * 6), props.liang.index1]
let savaIndex = -1;
let emptyChildIndices = [];
timearr.value.forEach((res : any, rowIndex : number) => {
// 检测行列空则去除
emptyChildIndices = [];
// 遍历 res.children 数组中的每个子元素 child
res.children.forEach((child, index) => {
// 检查 child 的 value 属性是否为空
2025-04-01 17:27:15 +08:00
if (child.directiveName === null || child.directiveName === '' || child.directiveName === undefined) {
2025-03-21 17:36:27 +08:00
// 如果是空值,检查其他 res.children 中相同索引的元素
const isEmptyInAllRows = timearr.value.every((otherRes) => {
const otherChild = otherRes.children[index];
2025-04-01 17:27:15 +08:00
return otherChild === undefined || otherChild.directiveName === null || otherChild.directiveName === '' || otherChild.directiveName === undefined;
2025-03-21 17:36:27 +08:00
});
// 如果在所有行中该位置的 value 都为空,记录该索引
if (isEmptyInAllRows) {
emptyChildIndices.push(index);
}
}
});
// 检测是否已经没有东西了
res.children.forEach((item : any, index : number) => {
2025-04-01 17:27:15 +08:00
if (item.typeName == object.typeName) {
2025-03-21 17:36:27 +08:00
savaIndex = index
}
})
})
if (savaIndex === -1) {
//如果有东西,则自动顶到下一排空行
savaIndex = emptyChildIndices[0]
}
let haveAnyItem = 0;
2025-04-01 17:27:15 +08:00
let savetypeName = "";
2025-03-21 17:36:27 +08:00
timearr.value.forEach((element : any) => {
if (element.children[0].value) {
haveAnyItem++
2025-04-01 17:27:15 +08:00
savetypeName = element.children[0].typeName
2025-03-21 17:36:27 +08:00
}
})
2025-04-01 17:27:15 +08:00
// 防止覆盖typeName
2025-03-21 17:36:27 +08:00
if (haveAnyItem > 1) {
2025-04-01 17:27:15 +08:00
timearr.value[flyNumber.value.index0].children[flyNumber.value.index1] = { directiveName: '', typeName: savetypeName }
2025-03-21 17:36:27 +08:00
} else {
2025-04-01 17:27:15 +08:00
timearr.value[flyNumber.value.index0].children[flyNumber.value.index1] = { directiveName: '' }
2025-03-21 17:36:27 +08:00
}
2025-04-01 17:27:15 +08:00
let parentHour = 0
2025-03-21 17:36:27 +08:00
timearr.value[indexsave.value[0]].children[savaIndex] = object
2025-04-01 17:27:15 +08:00
let startTime = timearr.value[indexsave.value[0]].children[savaIndex].startTime;
let endTime = timearr.value[indexsave.value[0]].children[savaIndex].endTime;
let positioning = timearr.value[indexsave.value[0]].positioning
const rest = startTime.substring(startTime.indexOf(":")); // ":20"
const rest0 = endTime.substring(endTime.indexOf(":")); // ":20"
// 用 positioning 替换原来的小时部分
timearr.value[indexsave.value[0]].children[savaIndex].startTime = positioning + rest; // "9:20"
timearr.value[indexsave.value[0]].children[savaIndex].endTime = positioning + rest0; // "9:20"
2025-03-21 17:36:27 +08:00
// 检查是否有任意一个对象的 children 数组最后一个对象的 value 有值
const shouldAdd = timearr.value.some(obj => {
const children = obj.children;
2025-04-01 17:27:15 +08:00
return children[children.length - 1].directiveName.trim() !== '';
2025-03-21 17:36:27 +08:00
});
// 如果满足条件,则为每个对象的 children 数组追加一个新对象
if (shouldAdd) {
timearr.value.forEach(obj => {
2025-04-01 17:27:15 +08:00
obj.children.push({ directiveName: '' });
2025-03-21 17:36:27 +08:00
});
// 先将 scrollTop 重置为 0
scrollTop.value = 999
// 等待 DOM 更新完成
// 设置一个足够大的值让 scroll-view 滚动到底部
scrollTop.value = 9999
}
2025-04-02 17:33:46 +08:00
saveAll()
2025-03-21 17:36:27 +08:00
}
}
const scrollContainer = ref(null)
2025-03-14 17:30:56 +08:00
const movetoruler = async () => {
2025-04-01 17:27:15 +08:00
//关闭弹窗
2025-03-14 17:30:56 +08:00
songisopen.value = false;
2025-04-01 17:27:15 +08:00
// 还原成默认选项
2025-03-14 17:30:56 +08:00
isweek.value = true;
2025-03-17 17:34:36 +08:00
let savaIndex = -1;
let emptyChildIndices = [];
2025-04-01 17:27:15 +08:00
//如果是即时指令直接干掉
2025-03-21 17:36:27 +08:00
if (openOp.value === 2) {
scrollLeft.value = 1;
nextTick(() => {
scrollLeft.value = 0;
bottomItems.value.unshift({
name: cardsumit.value.op.name,
url: "/static/index/ou.png",
2025-03-24 17:37:51 +08:00
target: `#00a8ff`
2025-03-21 17:36:27 +08:00
})
2025-04-01 17:27:15 +08:00
// 实现即时指令动画
2025-03-24 17:37:51 +08:00
setTimeout(() => {
bottomItems.value[0].target = `#fff`;
}, 1500)
setTimeout(() => {
2025-03-21 17:36:27 +08:00
bottomItems.value[0].target = "";
2025-03-24 17:37:51 +08:00
}, 3000)
2025-03-21 17:36:27 +08:00
})
return
}
2025-04-01 17:27:15 +08:00
//找空行
2025-03-17 17:34:36 +08:00
timearr.value.forEach((res : any, rowIndex : number) => {
emptyChildIndices = [];
// 遍历 res.children 数组中的每个子元素 child
res.children.forEach((child, index) => {
// 检查 child 的 value 属性是否为空
2025-04-01 17:27:15 +08:00
if (child.directiveName === null || child.directiveName === '' || child.directiveName === undefined) {
2025-03-17 17:34:36 +08:00
// 如果是空值,检查其他 res.children 中相同索引的元素
const isEmptyInAllRows = timearr.value.every((otherRes) => {
const otherChild = otherRes.children[index];
2025-04-01 17:27:15 +08:00
return otherChild === undefined || otherChild.directiveName === null || otherChild.directiveName === '' || otherChild.directiveName === undefined;
2025-03-17 17:34:36 +08:00
});
2025-04-01 17:27:15 +08:00
// 如果在所有行中该位置的 directiveName 都为空,记录该索引
2025-03-17 17:34:36 +08:00
if (isEmptyInAllRows) {
emptyChildIndices.push(index);
}
}
});
2025-04-01 17:27:15 +08:00
//如果选定的左侧菜单,在表格中有同类,则记录同类
2025-03-17 17:34:36 +08:00
res.children.forEach((item : any, index : number) => {
2025-04-01 17:27:15 +08:00
if (item.typeName == bigArray.value[cardsumit.value.op.index[0]].children[cardsumit.value.op.index[1]].title) {
2025-03-17 17:34:36 +08:00
savaIndex = index
}
})
})
2025-04-01 17:27:15 +08:00
// 没同类,则新开一行
2025-03-17 17:34:36 +08:00
if (savaIndex === -1) {
savaIndex = emptyChildIndices[0]
}
2025-04-01 17:27:15 +08:00
//将一行所有的typeName变成新添加的typeName
let savetypeName = bigArray.value[cardsumit.value.op.index[0]].children[cardsumit.value.op.index[1]].title
2025-03-21 17:36:27 +08:00
await nextTick();
timearr.value.forEach((element : any, index : number) => {
2025-04-01 17:27:15 +08:00
element.children[savaIndex].typeName = savetypeName;
2025-03-21 17:36:27 +08:00
})
2025-04-01 17:27:15 +08:00
let cycleType = ""
//看看是啥指令
2025-03-21 17:36:27 +08:00
if (!openOp.value) {
2025-04-01 17:27:15 +08:00
cycleType = "日常";
2025-03-21 17:36:27 +08:00
} else if (openOp.value === 1) {
2025-04-01 17:27:15 +08:00
cycleType = cardsumit.value.weekTime || (cardsumit.value.monthTime + '号');
2025-03-14 17:30:56 +08:00
}
2025-03-21 17:36:27 +08:00
2025-03-14 17:30:56 +08:00
const startHour = Number(openValue.value.time)
const startMinute = Number(cardsumit.value.startTime)
const endMinute = startMinute + 10
const endHour = startHour + Math.floor(endMinute / 60)
const formattedStart = `${String(startHour)}:${String(startMinute).padStart(2, '0')}`
const formattedEnd = `${String(endHour)}:${String(endMinute % 60).padStart(2, '0')}`
2025-04-01 17:27:15 +08:00
//表格的时间
2025-03-17 17:34:36 +08:00
if (savaIndex !== -1) {
2025-04-01 17:27:15 +08:00
timearr.value[indexsave.value[0]].children[savaIndex].startTime = formattedStart
timearr.value[indexsave.value[0]].children[savaIndex].endTime = formattedEnd
2025-03-17 17:34:36 +08:00
} else {
2025-04-01 17:27:15 +08:00
timearr.value[indexsave.value[0]].children[indexsave.value[1]].startTime = formattedStart
timearr.value[indexsave.value[0]].children[indexsave.value[1]].endTime = formattedEnd
}
2025-04-02 17:33:46 +08:00
2025-04-01 17:27:15 +08:00
let param = {
directiveId: saveId.value,
directiveName: cardsumit.value.op.name,
startTime: formattedStart,
endTime: formattedEnd,
positioning: indexsave.value[0].toString(),
positioningLong: indexsave.value[1].toString(),
tagName: saveTagName.value,
cycleType: cycleType,
nuId: "1",
2025-04-02 17:33:46 +08:00
customerId: "1",
id: "",
typeName: savetypeName,
}
//给表格赋值
timearr.value[indexsave.value[0]].children[savaIndex] = param;
let allArray = [];
timearr.value.forEach((element : any) => {
element.children.forEach((res : any) => {
allArray.push(res)
})
})
const shouldAdd = timearr.value.some(obj => {
const children = obj.children;
return children[children.length - 1].directiveName.trim() !== '';
});
// 如果满足条件,则为每个对象的 children 数组追加一个新对象
if (shouldAdd) {
timearr.value.forEach(obj => {
obj.children.push({ directiveName: '' });
2025-03-14 17:30:56 +08:00
});
2025-04-02 17:33:46 +08:00
// 先将 scrollTop 重置为 0
scrollTop.value = 999
// 等待 DOM 更新完成
nextTick()
// 设置一个足够大的值让 scroll-view 滚动到底部
scrollTop.value = 9999
}
saveAll()
}
const saveAll = () =>{
//给后端编译一下
let postArray = [];
timearr.value.forEach((element0, index0) => {
element0.children.forEach((element1, index1) => {
let saveTypeName = ""
if (!element1.directiveName && !element1.id) {
let array = {};
if (element1.typeName) {
saveTypeName = element1.typeName
}
array = JSON.parse(JSON.stringify(moBan.value))
saveTypeName ? array.typeName = saveTypeName : ""
array.positioning = index0
array.positioningLong = index1
postArray.push(array)
} else {
element1.positioning = index0;
element1.positioningLong = index1;
postArray.push(element1)
}
})
})
addBatch(postArray).then((res : any) => {
if (res.code == 200) {
getNclist().then((res : any) => {
timearr.value = res.result
})
2025-04-01 17:27:15 +08:00
}
})
2025-03-11 17:27:40 +08:00
}
2025-03-24 17:37:51 +08:00
const routerPush = () => {
uni.navigateTo({
url: `/pages/timeMatrix/index?currentNumber=${currentNumber.value}`
})
}
2025-03-26 17:34:08 +08:00
// 暂存器
const saveRulerTime = ref({
index0: -1,
index1: -1
})
const targetRuler = ref({
index0: -1,
2025-03-24 17:37:51 +08:00
index1: -1,
current: -1,
2025-03-26 17:34:08 +08:00
bordershow: true
2025-03-24 17:37:51 +08:00
})
const whereEvent = (data : any) => {
2025-03-26 17:34:08 +08:00
scrollTop.value = 0
scrollTop.value = data.index1 * 104
if (currentNumber.value === Math.floor(data.index0 / 6)) {
targetRuler.value.index0 = data.index0 - currentNumber.value * 6;
targetRuler.value.index1 = data.index1;
saveRulerTime.value.index0 = targetRuler.value.index0;
saveRulerTime.value.index1 = targetRuler.value.index1;
targetRuler.value.current = currentNumber.value
targetRuler.value.bordershow = false;
setTimeout(() => {
targetRuler.value.index0 = -1;
targetRuler.value.index1 = -1;
targetRuler.value.current = -1
}, 400)
setTimeout(() => {
targetRuler.value.bordershow = true;
saveRulerTime.value.index0 = -1;
saveRulerTime.value.index1 = -1;
}, 1000)
} else {
setTimeout(() => {
currentNumber.value = Math.floor(data.index0 / 6);
}, 100)
setTimeout(() => {
targetRuler.value.index0 = data.index0 - currentNumber.value * 6;
targetRuler.value.index1 = data.index1;
saveRulerTime.value.index0 = targetRuler.value.index0;
saveRulerTime.value.index1 = targetRuler.value.index1;
targetRuler.value.current = currentNumber.value
targetRuler.value.bordershow = false;
}, 800)
setTimeout(() => {
targetRuler.value.index0 = -1;
targetRuler.value.index1 = -1;
targetRuler.value.current = -1
}, 1400)
setTimeout(() => {
targetRuler.value.bordershow = true;
saveRulerTime.value.index0 = -1;
saveRulerTime.value.index1 = -1;
}, 2200)
}
2025-03-24 17:37:51 +08:00
}
onShow(() => {
2025-04-01 17:27:15 +08:00
getServiceTree().then((res : any) => {
bigArray.value = res.result
downList.value = bigArray.value[0].children
})
2025-04-02 17:33:46 +08:00
2025-04-01 17:27:15 +08:00
getNclist().then((res : any) => {
2025-04-02 17:33:46 +08:00
timearr.value = res.result
2025-04-01 17:27:15 +08:00
})
2025-03-24 17:37:51 +08:00
uni.$on('where', whereEvent);
})
onHide(() => {
uni.$off('where', whereEvent);
});
2025-03-11 17:27:40 +08:00
defineExpose({
2025-03-21 17:36:27 +08:00
rulerEnd,
rulerMoveEnd,
2025-03-24 17:37:51 +08:00
nextItems,
2025-03-11 17:27:40 +08:00
})
2025-03-24 17:37:51 +08:00
2025-03-11 17:27:40 +08:00
const moveNumber = ref({
index0: 999,
index1: 999
})
2025-04-02 17:33:46 +08:00
const moBan = ref({
directiveId: "",
directiveName: "",
startTime: "",
endTime: "",
positioning: "",
positioningLong: "",
tagName: "",
cycleType: "",
nuId: "1",
customerId: "1",
id: "",
typeName: ""
2025-03-17 17:34:36 +08:00
2025-04-02 17:33:46 +08:00
})
const timearr = ref(
Array.from({ length: 24 }, (_, hour) => ({
positioning: hour.toString(),
children: Array.from({ length: 4 }, () => ({ directiveName: '' }))
}))
)
2025-03-14 17:30:56 +08:00
// 切割bigArray
function splitString(str) {
2025-03-21 17:36:27 +08:00
// 使用正则表达式找到所有括号的内容
let result = [];
let remainingStr = str;
// 正则匹配最外层括号(支持全角和半角)
let regex = /([^(]*)[(]([^)]+)[)]/;
while (regex.test(remainingStr)) {
let match = remainingStr.match(regex);
if (match) {
// 添加括号前的部分(去掉空白)
if (match[1].trim()) {
result.push(match[1].trim());
}
// 添加括号内的内容
if (match[2].trim()) {
result.push(match[2].trim());
}
// 更新剩余的字符串
remainingStr = remainingStr.replace(match[0], '').trim();
}
}
// 如果最后还有剩余部分,也加入结果
if (remainingStr.trim()) {
result.push(remainingStr.trim());
}
return result;
2025-03-14 17:30:56 +08:00
}
2025-03-05 17:29:32 +08:00
</script>
<style lang="less" scoped>
2025-04-02 17:33:46 +08:00
// 主页的css
@import './index';
2025-03-05 17:29:32 +08:00
</style>