hldy_app_mini/pages/NursingNew/component/nurse/bigindex.vue

1051 lines
35 KiB
Vue
Raw Normal View History

2026-01-09 16:23:18 +08:00
<!-- 护嘱 -->
<template>
<view class="right-container" :style="isshow?{opacity: `1`}:{opacity: `0`}">
<view class="doctorsay-container-view">
<view class="doctorsay-container-container">
<view class="super-card">
<view class="boom-father">
<view class="boom" :style="{ transform: transformStyle }">
<view>
<view v-for="(item,index) in timeArray" :key="index">
<view class="boom-son">
<text class="boom-text">
{{item}}
</text>
</view>
</view>
</view>
</view>
</view>
<view class="super-card-container">
<scroll-view style="width: 100%;" scroll-with-animation :scroll-left="cardLeft" scroll-x
@scroll="handleTop" :show-scrollbar="false">
<view style="display: flex;width:4824rpx;">
<view v-for="(item0,index0) in timearr" :key="index0" class="super-card-right">
<view class="super-card-time">
{{(item0.positioning.length == 1 ? ('0' + item0.positioning) : item0.positioning) + ":00"}}
</view>
</view>
</view>
2026-01-16 14:28:12 +08:00
<view style="display: flex;height: 1225rpx;position: relative;">
2026-01-09 16:23:18 +08:00
<view class="xian-bian"></view>
<scroll-view style="height: 100%;width:6960rpx;background-color: #fff;"
:scroll-top="scrollTop" scroll-with-animation :scroll-y="true"
@scroll="handleScrolltime" :show-scrollbar="false">
<view style="display: flex;height: 100%;">
<view v-for="(item0,index0) in timearr" :key="index0">
<view class="super-card-time-und">
<view v-for="(item1,index1) in item0.children" style="width: 100%;"
:key="index1">
<view
:class=" 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} : {borderBottom: '1rpx solid transparent'}"
:id="`a${index0}_${index1}`" style="position: relative;"
2026-01-12 17:03:21 +08:00
@click="rulerTouchClickfather(index0,index1)"
2026-01-09 16:23:18 +08:00
:data-index0="index0" :data-index1="index1">
2026-01-09 17:17:45 +08:00
2026-01-09 16:23:18 +08:00
<view class="title-time-blue"
v-show="saveEditIndex.index0 == index0 && saveEditIndex.index1 == index1 && isRule">
2026-01-09 17:17:45 +08:00
<image class="blue-img"
src="/static/index/bluetarget.png" />
2026-01-09 16:23:18 +08:00
</view>
2026-01-13 17:16:36 +08:00
<view class="card-bao" v-if="item1.izPackage==`Y`">
</view>
2026-01-16 17:27:09 +08:00
<!-- <view class="card-overtime"
2026-01-13 17:16:36 +08:00
v-if="item1.executeStatus==`hisTimeOut`">
超时
2026-01-16 17:27:09 +08:00
</view> -->
2026-01-13 17:16:36 +08:00
2026-01-09 16:23:18 +08:00
<view :class="getClass(item1,index0,index1)"
style="font-size: 30rpx;overflow: hidden;"
2026-01-09 17:17:45 +08:00
:style="{ animationDelay:`-${computeDelay(index0, index1).toFixed(2)}s`,border:saveEditIndex.index0 == index0 && saveEditIndex.index1 == index1? `2rpx solid #46B2F6`:'' }">
2026-01-09 16:23:18 +08:00
<view class="title-time" v-if="item1.startTime"
style="flex-direction: column;">
<view v-if="item1.startTime"
class="title-time-font-rel">
{{ item1.directiveName?splitString(item1.directiveName)[0]:""}}
</view>
<view
v-if="item1.startTime&&splitString(item1.directiveName)[1]"
class="title-time-font-tags">
({{ item1.directiveName?splitString(item1.directiveName)[1]:""}})
</view>
2026-01-09 17:17:45 +08:00
<view v-if="item1.startTime"
:class="getFontClass(item1,index0,index1)">
2026-01-12 17:03:21 +08:00
<view style="margin-bottom: 3rpx;">
{{ item1.rightshow }}
</view>
2026-01-16 17:27:09 +08:00
<view class="weight-time">
{{ `${parseHourMinutestring(item1.startTime).hour}:${parseHourMinutestring(item1.startTime).minute}-${parseHourMinutestring(item1.endTime).hour}:${parseHourMinutestring(item1.endTime).minute}` }}
2026-01-12 17:03:21 +08:00
</view>
2026-01-09 16:23:18 +08:00
</view>
2026-01-13 17:16:36 +08:00
2026-01-09 16:23:18 +08:00
</view>
2026-01-13 17:16:36 +08:00
<view
v-if="saveEditIndex.index0 == index0 && saveEditIndex.index1 == index1 && !item1.startTime"
class="pulic-time">
2026-01-09 17:17:45 +08:00
2026-01-13 17:16:36 +08:00
{{(item0.positioning.length == 1 ? ('0' + item0.positioning) : item0.positioning) + ":" + timeArray[index1]}}
</view>
2026-01-09 16:23:18 +08:00
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</scroll-view>
</view>
<view class="right-order">
<view class="order-title">
2026-01-12 17:03:21 +08:00
<view class="order-month" @click="dateshow()">
2026-01-09 16:23:18 +08:00
{{ selectdata.month }}
</view>
2026-01-12 17:03:21 +08:00
<scroll-view class="order-day" scroll-with-animation scroll-x :scroll-left="movetime">
2026-01-09 16:23:18 +08:00
<view class="days-father">
2026-01-12 17:03:21 +08:00
<view :class="selectdata.day===item? `targetdays` :`days`"
2026-01-09 16:23:18 +08:00
v-for="(item,index) in daysarray" :key="index" @click="clickday(item,index)">
{{ item }}
</view>
</view>
</scroll-view>
</view>
2026-01-12 17:03:21 +08:00
<view class="order-future">
2026-01-14 15:08:18 +08:00
<nomessgae :cont="`暂无数据`" v-show="!upmenuarray.length" ></nomessgae>
2026-01-13 17:16:36 +08:00
<scroll-view class="future-items" scroll-with-animation scroll-y :scroll-top="firsttopmove">
2026-01-14 14:31:43 +08:00
<view style="position: relative;" v-for="(item,index) in upmenuarray" :key="index"
@click="searchtable(item);">
<view :class="moveById===item.id? `future-item-target`: `future-item`">
<view class="future-fonts">
<view class="card-over">
{{ item.directiveName }}
</view>
{{ ` | ` +item.serviceDuration + `分钟` }}
2026-01-13 17:16:36 +08:00
</view>
2026-01-14 14:31:43 +08:00
<view class="future-time">
<text class="time">
{{ extractHHMM(item.startTime) }}
</text>
<view class="time-right-bad" v-if="item.tagtype">
{{ item.tagtype=="1"?'即将开始':'指令尚未开始' }}
</view>
<view class="time-right-blue" v-else>
正在进行
<view class="ellipsis">
<view v-for="(n, idx) in 3" :key="idx" class="dot"
:style="{ animationDelay: (idx * 0.12) + 's' }"></view>
</view>
2026-01-13 17:16:36 +08:00
</view>
</view>
2026-01-14 14:31:43 +08:00
<view class="future-tag">
{{ item.cycleType }}
</view>
<view class="open-img-father" v-if="!item.tagtype"
@click.stop="clickfirstarray(item,index);"
:style="firstListTarget===index?{transform: `rotate(180deg)`}:{}">
<image class="open-img" src="/static/index/down.png" />
</view>
2026-01-12 17:03:21 +08:00
</view>
2026-01-14 14:31:43 +08:00
<view
style="position: absolute;top: 0;left: 0;transition: height 0.3s, top 0.3s;z-index: 9999; ;"
:class="moveById===item.id? `future-item-target`: `future-item`" :style="{
height: firstListTarget === index ? '320rpx' : '152rpx',
left: firstListTargetShow === index ? '0' : '999rpx',
top: index === upmenuarray.length - 1 && firstListTarget === index? `-168rpx`:`0rpx`
}">
<view class="future-fonts">
<view class="card-over">
{{ item.directiveName }}
2026-01-13 17:16:36 +08:00
</view>
2026-01-14 14:31:43 +08:00
{{ ` | ` +item.serviceDuration + `分钟` }}
</view>
<view class="future-time">
<text class="time">
{{ extractHHMM(item.startTime) }}
</text>
<view class="time-right-bad" v-if="item.tagtype">
{{ item.tagtype=="1"?'即将开始':'指令尚未开始' }}
</view>
<view class="time-right-blue" v-else>
正在进行
<view class="ellipsis">
<view v-for="(n, idx) in 3" :key="idx" class="dot"
:style="{ animationDelay: (idx * 0.12) + 's' }"></view>
</view>
2026-01-13 17:16:36 +08:00
</view>
</view>
2026-01-14 14:31:43 +08:00
<view class="future-tag">
{{ item.cycleType }}
</view>
<view class="future-info" v-if="firstListTarget===index">
<view class="info" v-if="item.optType == 2">
<image class="info-img" src="/static/index/leftpeople.png" />
<view class="">
{{ item.optNames?.split(',')[0] }}
</view>
<image class="info-img" style="margin-left: 15rpx;"
src="/static/index/rightpeople.png" />
<view class="">
{{ item.optNames?.split(',')[1] }}
</view>
2026-01-13 17:16:36 +08:00
</view>
2026-01-14 14:31:43 +08:00
<view class="info" v-else>
<image class="info-img" src="/static/index/leftpeople.png" />
<view class="">
{{ item.optTypeName }}
</view>
<image class="info-img" style="margin-left: 15rpx;"
src="/static/index/rightpeople.png" />
<view class="">
{{ item.optNames }}
</view>
2026-01-13 17:16:36 +08:00
</view>
</view>
2026-01-14 14:31:43 +08:00
<view class="open-img-father" @click.stop="clickfirstarray(item,index)"
:style="firstListTarget===index?{transform: `rotate(180deg)`}:{}">
<image class="open-img" src="/static/index/down.png" />
</view>
<view class="serviceContent" v-if="firstListTarget===index">
{{ item.serviceContent }}
</view>
2026-01-13 17:16:36 +08:00
</view>
2026-01-12 17:03:21 +08:00
</view>
</scroll-view>
</view>
<view class="order-history">
2026-01-12 17:28:07 +08:00
<view class="history-title">
<view class="history-left">
服务指令
</view>
<view class="history-right">
长者标签
</view>
</view>
2026-01-14 15:08:18 +08:00
<nomessgae :cont="`暂无数据`" v-show="!downmenuarray.length" ></nomessgae>
2026-01-13 17:16:36 +08:00
<scroll-view class="history-items" scroll-with-animation scroll-y
:scroll-top="secondtopmove">
2026-01-14 14:31:43 +08:00
<view v-for="(item,index) in downmenuarray" :key="index" @click="searchtable(item);">
<view class="history-item">
<view class="history-shu-up" v-if="index"></view>
<view class="history-shu-circle"></view>
<view class="history-spe"
:style="moveById===item.id?{border:`2rpx solid #46B2F6`}:{border:`2rpx solid transparent`}">
<view class="history-left">
<view
:class="item.executeStatus!==`hisOk`?`history-left-jiao-error`: `history-left-jiao`"
2026-01-14 16:00:57 +08:00
style="top: 1.5rpx;right: 1.5rpx;"
2026-01-14 14:31:43 +08:00
v-show="secondListTargetShow !== index">
{{ item.rightshow }}
</view>
<view class="history-time">
{{ extractHHMM(item.startTime) }}
</view>
<view style="display: flex;width: 1000rpx;">
<image class="history-img"
:src="`${serverUrl}${item.previewFileSmall}`" />
<view class="history-name">
{{ item.directiveName+" " }}|{{" " + item.serviceDuration + `分钟` }}
</view>
</view>
<view class="small-font">
{{ item.serviceContent }}
</view>
2026-01-13 17:16:36 +08:00
</view>
2026-01-14 14:31:43 +08:00
<view class="history-spe"
style="position: absolute;top: 0;left: 0;transition: height 0.3s, top 0.3s;z-index: 9999; "
:style="{
height: secondListTarget === index ? '260rpx' : '120rpx',
left: secondListTargetShow === index ? '0' : '999rpx',
top: index === downmenuarray.length - 1 && secondListTarget === index ? '-140rpx' : '0rpx',
border: moveById === item.id ? '2rpx solid #46B2F6' : '2rpx solid transparent'
}">
<view class="history-left">
<view
:class="item.executeStatus!==`hisOk`?`history-left-jiao-error`: `history-left-jiao`"
v-show="secondListTargetShow === index">
{{ item.rightshow }}
</view>
<view class="history-time">
{{ extractHHMM(item.startTime) }}
</view>
<view style="display: flex;width: 1000rpx;">
<image class="history-img"
:src="`${serverUrl}${item.previewFileSmall}`" />
<view class="history-name">
{{ item.directiveName+" " }}|{{" " + item.serviceDuration + `分钟` }}
</view>
</view>
<view
:class="secondListTarget===index?`small-font-target`:`small-font`">
{{ item.serviceContent }}
</view>
</view>
<view class="future-info-second" style="left: 20rpx;"
v-if="secondListTarget===index">
<view class="info" v-if="item.optType == 2">
<image class="info-img" src="/static/index/leftpeople.png" />
<view class="">
{{ item.optNames?.split(',')[0] }}
</view>
<image class="info-img" style="margin-left: 15rpx;"
src="/static/index/rightpeople.png" />
<view class="">
{{ item.optNames?.split(',')[1] }}
</view>
</view>
<view class="info" v-else>
<image class="info-img" src="/static/index/leftpeople.png" />
<view class="">
{{ item.optTypeName }}
</view>
<image class="info-img" style="margin-left: 15rpx;"
src="/static/index/rightpeople.png" />
<view class="">
{{ item.optNames }}
</view>
</view>
</view>
<view class="open-img-father" style="right: 15rpx;bottom: 11.5rpx;"
@click.stop="clicksecondarray(item,index)">
<image
:style="secondListTarget===index?{transform: `rotate(180deg)`}:{}"
class="open-img" src="/static/index/down.png" />
</view>
</view>
</view>
<view class="future-info-second"
v-if="secondListTarget===index&& secondListTargetShow !== index">
<view class="info" v-if="item.optType == 2">
<image class="info-img" src="/static/index/leftpeople.png" />
<view class="">
{{ item.optNames?.split(',')[0] }}
</view>
<image class="info-img" style="margin-left: 15rpx;"
src="/static/index/rightpeople.png" />
<view class="">
{{ item.optNames?.split(',')[1] }}
2026-01-13 17:16:36 +08:00
</view>
</view>
2026-01-14 14:31:43 +08:00
<view class="info" v-else>
<image class="info-img" src="/static/index/leftpeople.png" />
<view class="">
{{ item.optTypeName }}
</view>
<image class="info-img" style="margin-left: 15rpx;"
src="/static/index/rightpeople.png" />
<view class="">
{{ item.optNames }}
</view>
2026-01-13 17:16:36 +08:00
</view>
</view>
2026-01-14 14:31:43 +08:00
<view class="open-img-father" style="right: 16rpx;bottom: 12rpx;"
@click.stop="clicksecondarray(item,index)">
<image class="open-img" src="/static/index/down.png"
:style="secondListTarget===index?{transform: `rotate(180deg)`}:{}" />
</view>
2026-01-12 17:03:21 +08:00
</view>
</view>
2026-01-14 14:31:43 +08:00
2026-01-13 17:16:36 +08:00
</scroll-view>
2026-01-12 17:03:21 +08:00
</view>
2026-01-09 17:17:45 +08:00
<view class="calendar-father" v-show="opendata">
2026-01-12 17:03:21 +08:00
<calendarsimple @datachange="dateget" v-model="selectdata" />
2026-01-09 17:17:45 +08:00
</view>
2026-01-12 17:03:21 +08:00
<view v-show="opendata" class="mengban" @click="opendata=false">
2026-01-09 17:17:45 +08:00
</view>
2026-01-09 16:23:18 +08:00
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, computed, nextTick, watch } from 'vue';
import { onShow, onHide } from '@dcloudio/uni-app';
import { getNclist, addBatch, addDirective, addInstant, deleteDirective, deleteInstant, editDirective, getDirectiveOrders } from "./api.js";
import { myArray } from './yaoshandiao.js';
2026-01-09 17:17:45 +08:00
import calendarsimple from '@/component/public/calendarsimple.vue'
2026-01-14 15:08:18 +08:00
import nomessgae from './component/default.vue'
2026-01-09 16:23:18 +08:00
const props = defineProps({
isshow: {
type: Boolean,
required: true,
},
});
2026-01-13 17:16:36 +08:00
const serverUrl = ref(uni.getStorageSync('serverUrl') + '/sys/common/static/')
2026-01-09 17:17:45 +08:00
const opendata = ref(false);
2026-01-09 16:23:18 +08:00
const bodystatus = ref(false);
const bodystatustarget = ref(-1);
const facestatus = ref(false);
const facestatustarget = ref(-1);
2026-01-13 17:16:36 +08:00
const firstListTarget = ref(-1)
const secondListTarget = ref(-1)
2026-01-14 14:31:43 +08:00
const firstListTargetShow = ref(-1)
const secondListTargetShow = ref(-1)
let _hideTimer = null
watch(secondListTarget, (newVal) => {
// 先清掉之前的定时器(如果有)
if (_hideTimer) {
clearTimeout(_hideTimer)
_hideTimer = null
}
if (newVal === -1) {
// 延迟 0.3s 再隐藏(设置为 -1
_hideTimer = setTimeout(() => {
secondListTargetShow.value = -1
_hideTimer = null
}, 300) // 300ms = 0.3s
} else {
// 非 -1 时立即同步
secondListTargetShow.value = newVal
}
})
watch(firstListTarget, (newVal) => {
// 先清掉之前的定时器(如果有)
if (_hideTimer) {
clearTimeout(_hideTimer)
_hideTimer = null
}
if (newVal === -1) {
// 延迟 0.3s 再隐藏(设置为 -1
_hideTimer = setTimeout(() => {
firstListTargetShow.value = -1
_hideTimer = null
}, 300) // 300ms = 0.3s
} else {
// 非 -1 时立即同步
firstListTargetShow.value = newVal
}
})
onBeforeUnmount(() => {
if (_hideTimer) {
clearTimeout(_hideTimer)
_hideTimer = null
}
})
2026-01-09 16:23:18 +08:00
/* ---- transform ----
注意虽然这是响应式但我们只在 rAF 里更新它受控更新避免频繁触发 Vue 渲染 */
const transformStyle = ref('translate3d(0, 0, 0)');
/* rAF / 计数器变量 */
let lastY = 0;
let ticking = false;
const bodydonghua = ref(false)
const openbody = ref(false)
const openface = ref(false)
const hournow = ref(new Date().getHours());
// 获得现在的年月日
2026-01-12 17:03:21 +08:00
function extractHHMM(startTime) {
if (!startTime) return null;
const timePart = (startTime + '').split(' ')[1] || '';
const [h = '0', m = '0'] = timePart.split(':');
return String(h).padStart(2, '0') + ':' + String(m).padStart(2, '0');
}
2026-01-09 16:23:18 +08:00
const dateref = ref(getTodayObj())
function getTodayObj() {
const d = new Date()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
return {
year: d.getFullYear(),
month,
day
}
}
const selectdata = ref({
year: 0,
month: "",
day: ""
})
const daysarray = ref([]);
const movetime = ref(0)
function generateDayArray() {
const selY = Number(selectdata.value.year)
const selM = Number(selectdata.value.month)
// 校验:年/月 必须是有效数字且月在1-12之间
if (!Number.isFinite(selY) || !Number.isFinite(selM) || selM < 1 || selM > 12) {
return []
}
const todayY = Number(dateref.value.year)
const todayM = Number(dateref.value.month) // dateref.month 可能是字符串 "01"
const todayD = Number(dateref.value.day)
let endDay = 0
if (selY === todayY && selM === todayM) {
// 同年同月:到今天为止
endDay = todayD;
} else {
// 不同:计算该月总天数。注意 new Date(year, month, 0).getDate()
// 这里 month 要传 1-12这个构造会返回该月最后一天
endDay = new Date(selY, selM, 0).getDate()
}
daysarray.value = Array.from({ length: endDay }, (_, i) => String(i + 1).padStart(2, '0'))
2026-01-13 17:16:36 +08:00
// console.log("啥", daysarray.value)
2026-01-12 17:03:21 +08:00
movetime.value = (Number(selectdata.value.day) - 3) * 25
2026-01-09 16:23:18 +08:00
}
const daytarget = ref(0)
const clickday = (item : string, index : number) => {
2026-01-12 17:03:21 +08:00
selectdata.value.day = item;
movetime.value = (index - 2) * 25
getTable()
2026-01-09 16:23:18 +08:00
}
const facedonghua = ref(false)
const open = ref(false);
const bottomItems = ref([])
const nameArray = [
`标准`, `超重`, `强直`, `偏瘫`, `佝偻`, `稳定`, `焦虑`, `抑郁`, `暴力`, `恐惧`, `烦躁`, `易怒`, `臆想`,
]
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);
// 是否周期
const iszhouqi = ref(false);
//高度回到最高
const firsttop = ref(0);
const secondtop = ref(0);
const scrollLeft = ref(0);
const cardLeft = ref(678);
//移动表格
const scrollTop = ref(0)
//左下的数组
const downList = ref<any>()
const isop = ref(false);
const bigArray = ref([]);
const isopen = ref(false)
const songisopen = ref(false)
const isopacity = ref(false)
const songisopacity = ref(false)
// 删除表格弹窗
const deleteisopen = ref(false);
const deletename = ref("")
const deleteisopacity = ref(false)
// 解释图标弹窗
const sayisopen = ref(false);
const sayname = ref("")
const sayisopacity = ref(false)
const saveleft = ref(6);
const saveright = ref(11);
const savetop = ref(0);
const savebottom = ref(3);
const isMove = ref(false);
const getjiao = computed(() => {
if (jiao.value[0] && jiao.value[1]) {
return "left-bottom"
} else if (!jiao.value[0] && jiao.value[1]) {
return "right-bottom"
} else if (jiao.value[0] && !jiao.value[1]) {
return "left-top"
} else {
return "right-top"
}
})
2026-01-09 17:17:45 +08:00
const getFontClass = (item : any, index0, index1) => {
2026-01-13 17:16:36 +08:00
2026-01-09 16:23:18 +08:00
switch (item.executeStatus) {
2026-01-13 17:16:36 +08:00
case 'hisUnExe':
return 'card-time-red';
case 'hisTimeOut':
2026-01-09 16:23:18 +08:00
return 'card-time-red';
2026-01-09 17:17:45 +08:00
2026-01-09 16:23:18 +08:00
case 'current':
return 'card-time-blue';
2026-01-09 17:17:45 +08:00
2026-01-09 16:23:18 +08:00
default:
return 'card-time';
}
}
// 这是二级菜单的动画的模板
const secondtemp = ref([])
// 上次点击时间
const lastTap = ref(0)
// 双击的最大间隔ms可根据体验调整
const DOUBLE_TAP_DELAY = 300
//变更左侧菜单
const isempty = ref(false);
const isRule = ref(false);
const topindex = ref(-1)
const isDelete = ref(false);
// 给抖动用的
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;
}
// 在作用域中声明一个定时器变量
let throttleTimer = null;
//监听拖拽
/* 兼容:如果不支持 requestAnimationFrame就用 setTimeout */
const requestAnimationFrame =
typeof window !== 'undefined' && window.requestAnimationFrame
? window.requestAnimationFrame
: (cb) => setTimeout(cb, 16);
function handleScrolltime(e) {
// uni-app 的 scroll 事件通常把位置放在 e.detail.scrollTop
// 为保险,先做容错判断
const scrollTop = (e && e.detail && (e.detail.scrollTop ?? e.detail.scrollY)) || 0;
lastY = scrollTop;
// 如果还在等待上一帧更新,就直接返回;否则安排下一帧更新
if (!ticking) {
ticking = true;
requestAnimationFrame(() => {
// 把 transform 更新为负的 scrollTop向上平移
// 使用 translate3d 触发 GPU 合成层
transformStyle.value = `translate3d(0, -${lastY}px, 0)`;
ticking = false;
});
}
}
const leftIn = ref(0)
function handleTop(e) {
leftIn.value = e.detail.scrollLeft
}
// 方法:根据条件返回不同的类名
const getClass = (item, index0, index1) => {
if (item.startTime) {
switch (item.executeStatus) {
case 'hisOk':
return 'title-time-border-hisOk';
2026-01-13 17:16:36 +08:00
case 'hisUnExe':
return 'title-time-border-hisFaild';
case 'hisTimeOut':
2026-01-09 16:23:18 +08:00
return 'title-time-border-hisFaild';
case 'current':
return 'title-time-border-current';
2026-01-09 17:17:45 +08:00
2026-01-09 16:23:18 +08:00
case 'future':
2026-01-12 17:03:21 +08:00
return 'title-time-border-future';
2026-01-09 16:23:18 +08:00
}
}
return 'title-time-border';
}
2026-01-13 17:16:36 +08:00
const clickfirstarray = (item, index) => {
if (firstListTarget.value != -1) {
firstListTarget.value = -1
2026-01-14 14:31:43 +08:00
} else {
2026-01-13 17:16:36 +08:00
firstListTarget.value = index;
}
2026-01-12 17:03:21 +08:00
}
2026-01-14 14:31:43 +08:00
const clicksecondarray = (item, index) => {
if (secondListTarget.value != -1) {
secondListTarget.value = -1
} else if (!item.tagtype) {
secondListTarget.value = index;
}
}
2026-01-09 16:23:18 +08:00
// 通用的生成函数
function genPaths(base, prefix, count, ext = 'png', startIndex = 0, pad = false) {
return Array.from({ length: count }, (_, i) => {
const idx = pad
? String(i + startIndex).padStart(2, '0')
: i + startIndex
return `${base}/${prefix}${idx}.${ext}`
})
}
// 当前选中的菜单索引
const upmenuIndex = ref<number>(1);
const downmenuIndex = ref<number>(0);
const downdonghua = ref(-1);
const thirdmenuIndex = ref<number>(0);
const forthmenuIndex = ref<number>(0);
const saveEditIndex = ref({
index0: -1,
index1: -1
})
const timer = ref(null);//计时器
const elementsInfo = ref({})//所有表格的信息
const moveX = ref(0)
const moveY = ref(0)
const openX = ref(0)
const openY = ref(0)
const flyNumber = ref({
index0: 999,
index1: 999,
// tagName: ''
})
const deletedownisopacity = ref(false);
const touchindex1 = ref(-1);
const jiao = ref([false, false])
//表格点击开始
const showDetail = ref([-1, -1])
2026-01-12 17:03:21 +08:00
const moveById = ref(0);
const rulerTouchClickfather = (index0 : number, index1 : number) => {
2026-01-16 17:27:09 +08:00
// console.log("sssss", timearr.value[index0].children[index1])
2026-01-13 17:16:36 +08:00
firstListTarget.value = -1;
secondListTarget.value = -1;
2026-01-12 17:03:21 +08:00
moveById.value = timearr.value[index0].children[index1].id
backsearch(moveById.value)
rulerTouchClick(index0, index1)
}
const rulerTouchClick = (index0 : number, index1 : number) => {
2026-01-09 16:23:18 +08:00
isDelete.value = false;
saveEditIndex.value.index0 = index0;
saveEditIndex.value.index1 = index1;
centerCell();
isRule.value = true;
2026-01-12 17:03:21 +08:00
2026-01-09 16:23:18 +08:00
}
const shakyTable = ref(false);
const saveX = ref(0);
const saveY = ref(0);
const indexsave = ref([-1, -1]);
const buttonBlue = ref(false)
let animTimer = null
// 暂存器
const saveRulerTime = ref({
index0: -1,
index1: -1
})
const targetRuler = ref({
index0: -1,
index1: -1,
current: -1,
bordershow: true
})
const whereEvent = (data : any) => {
saveEditIndex.value.index0 = data.index0;
saveEditIndex.value.index1 = data.index1;
centerCell();
targetRuler.value.index0 = data.index0;
targetRuler.value.index1 = data.index1;
saveRulerTime.value.index0 = targetRuler.value.index0;
saveRulerTime.value.index1 = targetRuler.value.index1;
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)
}
// 定义每小时中的分钟数组,表示每 5 分钟一个时间段,总共 12 个
const minuteArr = ['00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55']
const timearr = ref(
Array.from({ length: 24 }, (_, hour) => ({
positioning: hour.toString(),
children: minuteArr.map(time => ({
// tagName: time, // 表示分钟,如 '00', '05' 等
directiveName: '' // 默认的 directiveName
}))
}))
)
const geteverything = () => {
if (uni.getStorageSync('nuId') && uni.getStorageSync('elderId')) {
2026-01-12 17:03:21 +08:00
getTable();
2026-01-09 16:23:18 +08:00
}
}
// 处理分钟和小时的函数
function parseHourMinutestring(startTime) {
// 假设格式固定为 "YYYY-MM-DD HH:MM:SS"
const parts = startTime.split(' ');
if (parts.length < 2) return { hour: NaN, minute: NaN };
const [hh, mm] = parts[1].split(':');
return { hour: hh, minute: mm };
}
// 处理分钟和小时的函数(number)
function parseHourMinute(startTime) {
// 假设格式固定为 "YYYY-MM-DD HH:MM:SS"
const parts = startTime.split(' ');
if (parts.length < 2) return { hour: NaN, minute: NaN };
const [hh, mm] = parts[1].split(':');
return { hour: Number(hh), minute: Number(mm) };
}
2026-01-12 17:03:21 +08:00
const upmenuarray = ref([]);
const downmenuarray = ref([])
2026-01-09 16:23:18 +08:00
const getTable = () => {
let time = `${selectdata.value.year}-${selectdata.value.month}-${selectdata.value.day}`
2026-01-12 17:03:21 +08:00
2026-01-09 16:23:18 +08:00
getDirectiveOrders(time).then((data) => {
2026-01-13 17:16:36 +08:00
firstListTarget.value = -1;
secondListTarget.value = -1;
// console.log("现在", data.result.current)
// console.log("未来", data.result.future)
data.result.current.forEach((element : any) => {
element.tagtype = 0
})
data.result.future.forEach((element : any, index : number) => {
if (index) {
element.tagtype = 2
} else {
element.tagtype = 1
}
})
2026-01-12 17:03:21 +08:00
upmenuarray.value = [...data.result.current, ...data.result.future]
2026-01-14 14:31:43 +08:00
data.result.history.forEach((element : any, index : number) => {
if (element.executeStatus === 'hisUnExe') {
element.rightshow = `未执行`
} else if (element.executeStatus === 'hisTimeOut') {
element.rightshow = `超时`
} else if (element.executeStatus === 'hisOk') {
element.rightshow = `已完成`
}
})
2026-01-12 17:03:21 +08:00
downmenuarray.value = [...data.result.history]
2026-01-09 16:23:18 +08:00
timearr.value = Array.from({ length: 24 }, (_, hour) => ({
positioning: hour.toString(),
2026-01-12 17:03:21 +08:00
children: minuteArr.map(() => ({
2026-01-09 16:23:18 +08:00
directiveName: '' // 默认的 directiveName
}))
}))
data.result.all.forEach((element : any) => {
element.positioning = parseHourMinute(element.startTime).hour;
element.positioningLong = parseHourMinute(element.startTime).minute / 5;
2026-01-13 17:16:36 +08:00
if (element.executeStatus === 'hisUnExe') {
2026-01-12 17:03:21 +08:00
element.rightshow = `未执行`
2026-01-16 17:27:09 +08:00
} else if (element.executeStatus === 'hisTimeOut') {
element.rightshow = `超时`
}else if (element.executeStatus === 'current') {
2026-01-13 17:16:36 +08:00
element.rightshow = ``
} else if (element.executeStatus === 'future') {
element.rightshow = ``
}
else {
2026-01-12 17:03:21 +08:00
if (element.optType == 2) {
element.rightshow = element.optNames?.split(',').join('/')
} else {
element.rightshow = `${element.optTypeName}/${element.optNames}`
}
}
2026-01-13 17:16:36 +08:00
// switch (element.executeStatus) {
// case 'hisUnExe':
// element.rightshow = `未执行`
// case 'hisTimeOut':
// element.rightshow = `${element.optTypeName}/${element.optNames}`
// case 'hisOk':
// element.rightshow = `${element.optTypeName}/${element.optNames}`
// case 'hisTimeOut':
// element.rightshow = `${element.optTypeName}/${element.optNames}`
// case 'hisTimeOut':
// element.rightshow = `${element.optTypeName}/${element.optNames}`
// default:
// return 'card-time';
// }
if (element.cycleTypeId != 3) {
timearr.value[element.positioning].children[element.positioningLong] = element;
}
// console.log("aaaaaa", element)
2026-01-09 16:23:18 +08:00
})
2026-01-13 17:16:36 +08:00
2026-01-09 16:23:18 +08:00
})
}
const savePackagelist = ref([]);
onMounted(() => {
selectdata.value = dateref.value;
generateDayArray()
savePackagelist.value = uni.getStorageSync('Packagelist') || []
let res = uni.getStorageSync('saveTree0')
let goodArray = []
myArray.forEach((element : any) => {
element.children.forEach((element1 : any) => {
goodArray.push({
name: element1.title,
url: element1.url,
})
})
})
secondtemp.value = goodArray
if (res.result) {
bigArray.value = res.result;
}
downList.value = bigArray.value[0].children
upmenuIndex.value = -1;
downdonghua.value = -1;
setTimeout(() => {
upmenuIndex.value = 0;
downdonghua.value = 0;
}, 50)
uni.$on('where', findback);
downdonghua.value = 0;
geteverything()
2026-01-09 17:17:45 +08:00
2026-01-09 16:23:18 +08:00
nextTick(() => {
timeNowMove()
})
})
const bodyTagListLook = ref([]);
const emotionTagListLook = ref([]);
const cansumit = ref(false);
onBeforeUnmount(() => {
if (animTimer) clearTimeout(animTimer)
uni.$off('where', findback);
ticking = false;
})
function findback(data : any) {
// solveWatch.value = 3;
whereEvent(data)
}
// 切割bigArray
function splitString(str) {
// 使用正则表达式找到所有括号的内容
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;
}
const totalColumns = 24; // 总列数
const totalRows = 11; // 总行数
2026-01-16 17:27:09 +08:00
const visibleWidth = 1295; // 可视区域宽度 (rpx),基于 scalcType * widthType ≈ 2220
const visibleHeight = 1225; // 可视区域高度 (rpx)假设显示约5行时 heightType = 102.5
2026-01-09 16:23:18 +08:00
function centerCell() {
if (saveEditIndex.value.index0 >= 0 && saveEditIndex.value.index0 <= totalColumns && saveEditIndex.value.index1 >= 0 && saveEditIndex.value.index1 <= totalRows) {
// 计算点击格子的中心位置 (rpx)
2026-01-16 17:27:09 +08:00
const cellCenterX = (saveEditIndex.value.index0 + 0.5) * 259;
const cellCenterY = (saveEditIndex.value.index1 + 0.5) * 245;
2026-01-09 16:23:18 +08:00
// 计算 scrollLeft 和 scrollTop使格子中心位于可视区域中心
cardLeft.value = cellCenterX - visibleWidth / 2;
scrollTop.value = cellCenterY - visibleHeight / 2;
// 计算网格总宽高
2026-01-16 17:27:09 +08:00
const totalWidth = totalColumns * 259;
const totalHeight = totalRows * 245;
2026-01-09 16:23:18 +08:00
// 限制 scrollLeft 和 scrollTop 在有效范围内
2026-01-16 17:27:09 +08:00
cardLeft.value = Math.max(0, Math.min(cardLeft.value, totalWidth - visibleWidth)) / 2 ;
2026-01-09 16:23:18 +08:00
// scrollTop.value = 0
scrollTop.value = Math.max(0, Math.min(scrollTop.value, totalHeight - visibleHeight)) / 2;
}
}
// 表格进来就给我居中
function timeNowMove() {
2026-01-16 17:27:09 +08:00
const cellCenterX = (hournow.value + 0.5) * 259;
2026-01-09 16:23:18 +08:00
let width = cellCenterX - visibleWidth / 2;
2026-01-16 17:27:09 +08:00
const totalWidth = totalColumns * 259;
cardLeft.value = Math.max(0, Math.min(width, totalWidth - visibleWidth)) / 2;
2026-01-09 16:23:18 +08:00
}
const iszhiling = ref(false)
const zhilingbao = () => {
iszhiling.value = !iszhiling.value
forthmenuIndex.value = 0;
}
const deletedonghua = ref(false);
2026-01-12 17:03:21 +08:00
const dateget = () => {
opendata.value = false;
generateDayArray()
getTable()
}
const dateshow = () => {
opendata.value = true;
}
const searchtable = (item : any) => {
2026-01-13 17:16:36 +08:00
// console.log("aaaaaaa",item)
firstListTarget.value = -1;
secondListTarget.value = -1;
2026-01-12 17:03:21 +08:00
moveById.value = item.id
backsearch(item.id)
timearr.value.forEach((element : any) => {
element.children.forEach((data : any) => {
if (item.id == data.id) {
rulerTouchClick(data.positioning, data.positioningLong)
}
})
})
}
const firsttopmove = ref(0)
2026-01-13 17:16:36 +08:00
const secondtopmove = ref(0)
2026-01-12 17:03:21 +08:00
const backsearch = (id) => {
2026-01-13 17:16:36 +08:00
upmenuarray.value.forEach((element : any, index : number) => {
if (element.id === id) {
firsttopmove.value = (index - 1) * 80
}
})
downmenuarray.value.forEach((element : any, index : number) => {
if (element.id === id) {
secondtopmove.value = (index - 1) * 66.5
2026-01-12 17:03:21 +08:00
}
})
2026-01-09 17:17:45 +08:00
}
2026-01-09 16:23:18 +08:00
</script>
<style lang="less" scoped>
// 主页的css
@import './bigindex';
</style>