index.vue 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665
  1. <template>
  2. <!--
  3. 校车点名页面(临时从班主任点名复制)
  4. 功能:后续将改为校车点名首页与流程入口
  5. -->
  6. <view class="page-container">
  7. <!-- 固定头部区域 不在考勤时间段、摘要模式时不显示 -->
  8. <view class="fixed-header" v-if="!isNotInTime && !isSummaryMode">
  9. <!-- 筛选条件区域 -->
  10. <view class="filter-area">
  11. <view class="full-form" style="position: relative;z-index: 1000;">
  12. <Form :rules="fieldConfigs" v-model="formData" ref="formRef">
  13. <up-table>
  14. <up-tr>
  15. <up-th>车牌号</up-th>
  16. <Td field="carNo">
  17. <view class="readonly-field">
  18. <text class="readonly-text">{{ formData.carNo }}</text>
  19. </view>
  20. </Td>
  21. </up-tr>
  22. <up-tr>
  23. <up-th>日期</up-th>
  24. <Td field="rq">
  25. <SsDatetimePicker v-model="formData.rq" mode="date" :max-date="maxDate"
  26. :z-index="99999" placeholder="请选择日期" @change="onDateChange" :disabled="true" />
  27. <text v-if="weekdayText" class="weekday-text">{{ weekdayText }}</text>
  28. </Td>
  29. </up-tr>
  30. <up-tr>
  31. <up-th>节次</up-th>
  32. <Td field="jc">
  33. <view class="onoff-button-group">
  34. <SsOnoffButton v-model="formData.jc" name="jc" label="上午" value="1" :disabled="true" />
  35. <SsOnoffButton v-model="formData.jc" name="jc" label="下午" value="2" :disabled="true" />
  36. </view>
  37. </Td>
  38. </up-tr>
  39. </up-table>
  40. </Form>
  41. </view>
  42. </view>
  43. <!-- 站点进度(mock,固定7个点,第4个永远是中心点) -->
  44. <view class="stop-progress" catchtouchmove="true" @touchstart.stop="handleStopTouchStart"
  45. @touchmove.stop="handleStopTouchMove" @touchend.stop="handleStopTouchEnd"
  46. @touchcancel.stop="handleStopTouchEnd">
  47. <view class="stop-track">
  48. <template v-for="slot in 7" :key="slot">
  49. <view class="stop-node" :class="{ center: slot === 4 }"
  50. @tap.stop="handleStopTap(slot - 1)">
  51. <view class="stop-dot" :class="getStopDotClass(slot - 1)"></view>
  52. </view>
  53. <view v-if="slot < 7" class="stop-line" :class="getStopLineClass(slot - 1)"></view>
  54. </template>
  55. </view>
  56. <view class="stop-label-row">
  57. <text class="stop-label-side stop-label-prev">{{ prevStopName }}</text>
  58. <text class="stop-label-current">{{ currentStopName }}</text>
  59. <text class="stop-label-side stop-label-next">{{ nextStopName }}</text>
  60. </view>
  61. </view>
  62. <!-- 考勤统计(临时展示) -->
  63. <view class="stats-area" v-if="!isSummaryMode && !isNotInTime">
  64. <view class="stats-left">
  65. <text class="stat-parent">家长请假:</text>
  66. <text>{{ parentLeaveCount }}人</text>
  67. </view>
  68. <view class="stats-right">{{ rollcallProgressText }}</view>
  69. </view>
  70. </view>
  71. <!-- 不在时间范围 -->
  72. <view v-else-if="isNotInTime" class="isNotInTime">
  73. <view class="isNotInTime-title">
  74. <Icon name="icon-naoling" size="97" color="#ff7e00" />
  75. 当前不在校车接送时段!
  76. </view>
  77. <view class="isNotInTime-content">
  78. <!-- <view class="isNotInTime-content-title">接送时段</view>
  79. <view v-if="notInTimeMsg" class="isNotInTime-content-tip">{{ notInTimeMsg }}</view> -->
  80. <view v-for="item in NotInTime" class="isNotInTime-content-item">
  81. <view class="isNotInTime-content-item-icon">
  82. <Icon :name="item.icon" :size="item.iconSize" :color="item.iconColor" />
  83. </view>
  84. <view>
  85. <view>{{ item.title }}</view>
  86. <view>{{ item.range }}</view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 提交后摘要显示(仅显示缺勤/请假人数) -->
  92. <view v-if="isSummaryMode" class="summary-area">
  93. <view class="stats-section">
  94. <view class="stat-item">
  95. <text class="stat-label">点名情况:</text>
  96. <text class="stat-value absent">已点名</text>
  97. </view>
  98. <view class="stat-item">
  99. <text class="stat-label">点名人数:</text>
  100. <text class="stat-value absent">{{ summaryJsrs }}人</text>
  101. </view>
  102. <view class="stat-item">
  103. <text class="stat-label">请假:</text>
  104. <text class="stat-value leave">{{ summaryQjrs }}人</text>
  105. </view>
  106. <view class="stat-item">
  107. <text class="stat-label">未上车:</text>
  108. <text class="stat-value absent">{{ summaryOffCount }}人</text>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 学生列表区域 -->
  113. <view v-else class="student-table-wrapper" :style="studentTableWrapperStyle">
  114. <view class="student-table">
  115. <!-- 表头(固定,不随列表滚动) -->
  116. <view class="table-header">
  117. <text class="col-name">姓名</text>
  118. <text class="col-class">班级</text>
  119. <text class="col-status">状态</text>
  120. </view>
  121. <!-- 学生行(滚动区域) -->
  122. <scroll-view class="student-list-area" scroll-y :scroll-into-view="scrollIntoViewId"
  123. :scroll-with-animation="true" @scroll="handleStudentListScroll" @click="closeAllSwipeStates">
  124. <view v-for="(student, index) in displayZdcyList" :key="student.zdryid" class="row-wrapper"
  125. :id="'row_' + student.zdryid" :class="{ swiped: swipeStates[student.zdryid] }"
  126. :style="{ '--actions-width': actionWidth(student) + 'rpx' }"
  127. @touchstart="handleTouchStart($event, student.zdryid)"
  128. @touchmove.stop="handleTouchMove($event, student.zdryid)"
  129. @touchend="handleTouchEnd($event, student.zdryid)"
  130. @touchcancel="handleTouchEnd($event, student.zdryid)">
  131. <view class="table-row" :class="getRowClass(student)" @tap="handleStudentTap(student)">
  132. <text class="col-name">{{ student.xm }}</text>
  133. <text class="col-class">{{ student.bjid }}</text>
  134. <text class="col-status">{{ getStatusText(student) }}</text>
  135. <view class="drag-indicator" :style="getDragIndicatorStyle(student)"></view>
  136. </view>
  137. <view class="swipe-actions" :style="{ width: actionWidth(student) + 'rpx' }">
  138. <view v-if="shouldShowException(student)" class="action-btn exception-btn"
  139. @click.stop="handleException(student)">异常登记</view>
  140. <view class="action-btn phone-btn" @click.stop="handleCallParent(student)">家长电话</view>
  141. </view>
  142. </view>
  143. </scroll-view>
  144. </view>
  145. </view>
  146. <!-- 底部按钮(保存) -->
  147. <SsBottom :buttons="bottomButtons" @button-click="handleBottomAction" v-if="!isSummaryMode && !isNotInTime" />
  148. <!-- 二次确认弹窗(取消“已上车”) -->
  149. <SsConfirm v-model:visible="showConfirm" width="90%" height="34vh" :bottom-buttons="confirmButtons"
  150. @button-click="handleConfirmAction" @close="handleConfirmClose">
  151. <view class="confirm-message">
  152. <image class="confirm-icon" src="/static/images/warning.gif" mode="aspectFit" />
  153. <view class="confirm-text">{{ confirmTextLine1 }}</view>
  154. <view class="confirm-text">{{ confirmTextLine2 }}</view>
  155. </view>
  156. </SsConfirm>
  157. </view>
  158. </template>
  159. <script setup>
  160. /**
  161. * 校车点名页面(临时从班主任点名复制)
  162. *
  163. * 主要功能:
  164. * 1. 筛选条件管理(班级、日期、节次)
  165. * 2. 学生表格显示和状态管理
  166. * 3. 三行变一行的下拉切换
  167. * 4. 学生考勤状态管理
  168. * 5. 考勤数据保存和提交
  169. */
  170. import { ref, computed, nextTick, getCurrentInstance, defineExpose, watch } from 'vue'
  171. import Form from '@/components/Form/index.vue'
  172. import Td from '@/components/Td/index.vue'
  173. import SsDatetimePicker from '@/components/SsDatetimePicker/index.vue'
  174. import SsOnoffButton from '@/components/SsOnoffButton/index.vue'
  175. import SsBottom from '@/components/SsBottom/index.vue'
  176. import SsConfirm from '@/components/SsConfirm/index.vue'
  177. import { xcdmApi } from '@/api/xcdm'
  178. import { formatDate as utilFormatDate } from '@/utils/date'
  179. import Icon from '@/components/icon/index.vue';
  180. // ==================== 数据定义 ====================
  181. /**
  182. * 表单数据
  183. * @property {string} rq - 日期
  184. * @property {string} jc - 节次 (1-上午, 2-下午)
  185. */
  186. const formData = ref({
  187. carNo: '粤A88888',
  188. rq: '', // 将在初始化时设置为今天
  189. jc: '', // 将根据当前时间自动设置
  190. })
  191. // 校车点名类别码(接口返回 xcdmlbm):1=接,51=送
  192. const xcdmlbm = ref(1)
  193. // 当前站点序号(接口返回 curZdxh,1-based)
  194. const curZdxh = ref(1)
  195. // 接口返回:校车ID、接送时间段
  196. const xcid = ref('')
  197. const jskssj = ref('')
  198. const jsjssj = ref('')
  199. // 日期相关数据
  200. const maxDate = ref(new Date()) // 最大日期为今天,禁止选择今天之后的
  201. const weekdayText = ref('') // 星期几的显示文本
  202. /**
  203. * 页面状态管理
  204. * @property {Array} zdcyList - 成员列表数据
  205. */
  206. const isSummaryMode = ref(false) // 是否为提交后的摘要模式
  207. const isNotInTime = ref(false)
  208. // 提交后摘要(接口返回 jsrs/qjrs/ycrs)
  209. const summaryJsrs = ref(0)
  210. const summaryQjrs = ref(0)
  211. const summaryYcrs = ref(0)
  212. const NotInTime = ref([
  213. {
  214. icon: 'icon-shangwu',
  215. iconColor: '#1296db',
  216. iconSize: 97,
  217. title: '上午',
  218. range:'7:40~12:00'
  219. },
  220. {
  221. icon: 'icon-xiawu',
  222. iconColor: '#dd9900',
  223. iconSize: 97,
  224. title: '下午',
  225. range:'13:40~16:00'
  226. }
  227. ])
  228. const notInTimeMsg = ref('')
  229. const zdcyList = ref([]) // 成员列表(接口返回 zdcyList)
  230. // 列表展示:按站点顺序排序(送时站点倒序)
  231. const displayZdcyList = computed(() => {
  232. const list = Array.isArray(zdcyList.value) ? zdcyList.value : []
  233. return [...list].sort((a, b) => {
  234. const ao = getOrderIndexByZdxh(a?.zdxh)
  235. const bo = getOrderIndexByZdxh(b?.zdxh)
  236. if (ao !== bo) return ao - bo
  237. return Number(a?.zdryid || 0) - Number(b?.zdryid || 0)
  238. })
  239. })
  240. const bottomButtons = [
  241. { text: '保存并提交', action: 'save' }
  242. ]
  243. // 确认弹窗相关
  244. const showConfirm = ref(false) // 是否显示确认弹窗
  245. /**
  246. * 计算统计(校车点名)
  247. */
  248. const stats = computed(() => {
  249. const leave = zdcyList.value.filter(s => isLeave(s)).length
  250. const wait = zdcyList.value.filter(s => isWait(s)).length
  251. const on = zdcyList.value.filter(s => isSuccess(s)).length
  252. const off = zdcyList.value.filter(s => isUnboard(s)).length
  253. return { leave, wait, on, off }
  254. })
  255. const parentLeaveCount = computed(() => stats.value.leave)
  256. const totalCount = computed(() => zdcyList.value.length)
  257. const boardedCount = computed(() => stats.value.on)
  258. const rollcallProgressText = computed(() => {
  259. const left = String(boardedCount.value).padStart(2, '0')
  260. const right = String(totalCount.value).padStart(2, '0')
  261. return `${left}/${right} 人`
  262. })
  263. const summaryOffCount = computed(() => (isSummaryMode.value ? summaryYcrs.value : stats.value.off))
  264. /**
  265. * 计算学生列表区域的样式
  266. */
  267. const studentTableWrapperStyle = computed(() => {
  268. const headerPaddingAdjustRpx = 20 // 约 10px,微调顶部间距
  269. return {
  270. paddingTop: Math.max(0, headerHeight.value - headerPaddingAdjustRpx) + 'rpx'
  271. }
  272. })
  273. // 站点列表(接口返回 zdList:[{xh,mc,jc}])
  274. const zdList = ref([
  275. { xh: 1, mc: '学校', jc: 'A' },
  276. { xh: 2, mc: '莲花山头', jc: 'B' },
  277. { xh: 3, mc: '北塘四环公交站', jc: 'C' },
  278. { xh: 4, mc: '莲花山(山尾)', jc: 'D' },
  279. { xh: 5, mc: '碧桂园天玺山', jc: 'E' },
  280. { xh: 6, mc: '锦城花园', jc: 'F' },
  281. { xh: 7, mc: '华大路口', jc: 'G' },
  282. { xh: 8, mc: '海丰中专1站', jc: 'H' },
  283. { xh: 9, mc: '海丰中专2站', jc: 'I' },
  284. { xh: 10, mc: '结束点', jc: 'J' },
  285. ])
  286. // 送(xcdmlbm=51)时,站点展示倒序(不改后端字段本身)
  287. const displayZdList = computed(() => {
  288. const list = Array.isArray(zdList.value) ? zdList.value : []
  289. return xcdmlbm.value === 51 ? [...list].reverse() : list
  290. })
  291. const getOrderIndexByZdxh = (zdxh) => {
  292. const idx = displayZdList.value.findIndex(z => Number(z?.xh) === Number(zdxh))
  293. return idx >= 0 ? idx : 0
  294. }
  295. const getStopIndexByZdxh = (zdxh) => getOrderIndexByZdxh(zdxh)
  296. // 实际当前站(由 curZdxh 决定),centerStopIndex 是站点条中间(第4个点)的那个
  297. const actualStopIndex = computed(() => getStopIndexByZdxh(curZdxh.value))
  298. const centerStopIndex = ref(0)
  299. const clampIndex = (idx, max) => Math.min(max, Math.max(0, idx))
  300. const slotStopIndices = computed(() => {
  301. const stops = displayZdList.value
  302. if (!stops.length) return Array.from({ length: 7 }).map(() => -1)
  303. const center = clampIndex(centerStopIndex.value, stops.length - 1)
  304. return Array.from({ length: 7 }).map((_, slotIdx) => center + (slotIdx - 3))
  305. })
  306. const getStopDotClass = (slotIdx) => {
  307. const stops = displayZdList.value
  308. const actual = clampIndex(actualStopIndex.value, Math.max(0, stops.length - 1))
  309. const stopIndex = slotStopIndices.value[slotIdx]
  310. const exists = stopIndex >= 0 && stopIndex < stops.length
  311. const isCenterSlot = slotIdx === 3
  312. if (!exists) return 'dot-empty'
  313. if (isCenterSlot) {
  314. if (stopIndex === actual) return 'dot-current'
  315. if (stopIndex < actual) return 'dot-focus-past'
  316. return 'dot-focus-future'
  317. }
  318. if (stopIndex === actual) return 'dot-actual'
  319. if (stopIndex < actual) return 'dot-past'
  320. return 'dot-future'
  321. }
  322. const currentStopName = computed(() => {
  323. const stops = displayZdList.value
  324. if (!stops.length) return ''
  325. const center = clampIndex(centerStopIndex.value, stops.length - 1)
  326. return stops[center]?.mc || ''
  327. })
  328. const prevStopName = computed(() => {
  329. const stops = displayZdList.value
  330. if (!stops.length) return ''
  331. const center = clampIndex(centerStopIndex.value, stops.length - 1)
  332. return stops[center - 1]?.mc || ''
  333. })
  334. const nextStopName = computed(() => {
  335. const stops = displayZdList.value
  336. if (!stops.length) return ''
  337. const center = clampIndex(centerStopIndex.value, stops.length - 1)
  338. return stops[center + 1]?.mc || ''
  339. })
  340. const getStopLineClass = (slotIdx) => {
  341. const stops = displayZdList.value
  342. const a = slotStopIndices.value[slotIdx]
  343. const b = slotStopIndices.value[slotIdx + 1]
  344. const aExists = a >= 0 && a < stops.length
  345. const bExists = b >= 0 && b < stops.length
  346. if (!aExists || !bExists) return 'line-empty'
  347. return ''
  348. }
  349. // 站点条左右滑动切换当前站
  350. const stopTouchStartX = ref(0)
  351. const stopTouchStartY = ref(0)
  352. const stopSwipeHandled = ref(false)
  353. const handleStopTouchStart = (event) => {
  354. stopTouchStartX.value = event.touches[0].clientX
  355. stopTouchStartY.value = event.touches[0].clientY
  356. stopSwipeHandled.value = false
  357. }
  358. const handleStopTouchMove = (event) => {
  359. if (stopSwipeHandled.value) return
  360. const deltaX = event.touches[0].clientX - stopTouchStartX.value
  361. const deltaY = event.touches[0].clientY - stopTouchStartY.value
  362. if (Math.abs(deltaX) <= Math.abs(deltaY) || Math.abs(deltaX) < 35) return
  363. const maxIndex = Math.max(0, displayZdList.value.length - 1)
  364. // 横向滑动时拦截,避免触发外层 swiper
  365. try { event.preventDefault && event.preventDefault() } catch (e) { }
  366. if (deltaX < 0) centerStopIndex.value = Math.min(maxIndex, centerStopIndex.value + 1)
  367. else centerStopIndex.value = Math.max(0, centerStopIndex.value - 1)
  368. stopSwipeHandled.value = true
  369. }
  370. const handleStopTouchEnd = () => {
  371. stopSwipeHandled.value = false
  372. }
  373. const handleStopTap = (slotIdx) => {
  374. const stops = displayZdList.value
  375. const stopIndex = slotStopIndices.value[slotIdx]
  376. const exists = stopIndex >= 0 && stopIndex < stops.length
  377. if (!exists) return
  378. centerStopIndex.value = stopIndex
  379. console.log('[mock] centerStopIndex', centerStopIndex.value, 'curZdxh', curZdxh.value)
  380. }
  381. // ==================== 站点条 ↔ 学生列表联动 ====================
  382. const rowHeightPx = ref(0)
  383. const listViewportHeightPx = ref(0)
  384. const syncingFromListScroll = ref(false)
  385. const suppressListScrollSyncUntil = ref(0)
  386. const measureRowHeightPx = () => {
  387. nextTick(() => {
  388. uni.createSelectorQuery()
  389. .in(instance)
  390. .select('.row-wrapper')
  391. .boundingClientRect((rect) => {
  392. if (rect?.height) rowHeightPx.value = rect.height
  393. })
  394. .exec()
  395. })
  396. }
  397. const measureListViewportHeightPx = () => {
  398. nextTick(() => {
  399. uni.createSelectorQuery()
  400. .in(instance)
  401. .select('.student-list-area')
  402. .boundingClientRect((rect) => {
  403. if (rect?.height) listViewportHeightPx.value = rect.height
  404. })
  405. .exec()
  406. })
  407. }
  408. const scrollListToCenterStop = ({ animate = true } = {}) => {
  409. const stopIndex = centerStopIndex.value
  410. const zdxh = displayZdList.value[stopIndex]?.xh
  411. const target = displayZdcyList.value.find(s => Number(s.zdxh) === Number(zdxh))
  412. if (!target) return
  413. suppressListScrollSyncUntil.value = Date.now() + 500
  414. // scroll-into-view 无法动态控制动画开关,这里仅通过节流避免回流抖动
  415. scrollIntoViewId.value = ''
  416. nextTick(() => {
  417. scrollIntoViewId.value = `row_${target.zdryid}`
  418. })
  419. }
  420. watch(centerStopIndex, () => {
  421. if (syncingFromListScroll.value) return
  422. scrollListToCenterStop({ animate: true })
  423. })
  424. const handleStudentListScroll = (e) => {
  425. if (showConfirm.value) return
  426. if (Date.now() < suppressListScrollSyncUntil.value) return
  427. if (!rowHeightPx.value) return
  428. const scrollTop = e?.detail?.scrollTop ?? 0
  429. const scrollHeight = e?.detail?.scrollHeight ?? 0
  430. const viewport = listViewportHeightPx.value || 0
  431. const edgeThresholdPx = 6
  432. // 顶部/底部兜底:解决“滚动到极限但 floor 计算不到最后一项”
  433. if (scrollTop <= edgeThresholdPx) {
  434. const first = displayZdcyList.value[0]
  435. const nextCenter = first ? getStopIndexByZdxh(first.zdxh) : centerStopIndex.value
  436. if (first && nextCenter !== centerStopIndex.value) {
  437. syncingFromListScroll.value = true
  438. centerStopIndex.value = nextCenter
  439. nextTick(() => { syncingFromListScroll.value = false })
  440. }
  441. return
  442. }
  443. if (scrollHeight && viewport && scrollTop + viewport >= scrollHeight - edgeThresholdPx) {
  444. const last = displayZdcyList.value[displayZdcyList.value.length - 1]
  445. const nextCenter = last ? getStopIndexByZdxh(last.zdxh) : centerStopIndex.value
  446. if (last && nextCenter !== centerStopIndex.value) {
  447. syncingFromListScroll.value = true
  448. centerStopIndex.value = nextCenter
  449. nextTick(() => { syncingFromListScroll.value = false })
  450. }
  451. return
  452. }
  453. const idx = Math.max(0, Math.min(displayZdcyList.value.length - 1, Math.floor(scrollTop / rowHeightPx.value)))
  454. const student = displayZdcyList.value[idx]
  455. if (!student) return
  456. const nextCenter = getStopIndexByZdxh(student.zdxh)
  457. if (nextCenter === centerStopIndex.value) return
  458. syncingFromListScroll.value = true
  459. centerStopIndex.value = nextCenter
  460. nextTick(() => {
  461. syncingFromListScroll.value = false
  462. })
  463. }
  464. // ==================== 确认弹窗配置 ====================
  465. /**
  466. * 确认弹窗按钮配置
  467. */
  468. const confirmButtons = ref([
  469. { text: '取消', action: 'cancel', type: 'default' },
  470. { text: '确认', action: 'confirm', type: 'primary' }
  471. ])
  472. const confirmTextLine1 = ref('')
  473. const confirmTextLine2 = ref('')
  474. // ==================== 表单配置 ====================
  475. /**
  476. * 表单字段校验配置
  477. * 定义各个字段的校验规则
  478. */
  479. const fieldConfigs = computed(() => {
  480. const configs = {
  481. rq: {
  482. rules: [{ required: true, message: '日期不能为空' }]
  483. },
  484. jc: {
  485. rules: [{ required: true, message: '请选择节次' }]
  486. }
  487. }
  488. return configs
  489. })
  490. /**
  491. * 表单引用
  492. * 用于表单校验和数据提交
  493. */
  494. const formRef = ref(null)
  495. /**
  496. * 初始化表单默认值
  497. */
  498. const initFormDefaults = () => {
  499. // 设置默认日期为今天
  500. const today = new Date()
  501. const year = today.getFullYear()
  502. const month = String(today.getMonth() + 1).padStart(2, '0')
  503. const day = String(today.getDate()).padStart(2, '0')
  504. formData.value.rq = `${year}-${month}-${day}`
  505. // 更新星期几显示
  506. updateWeekdayText(formData.value.rq)
  507. // 根据当前时间设置默认节次 - 使用国际通用标准
  508. const currentTime = new Date()
  509. const currentHour = currentTime.getHours()
  510. let jcValue = '1'
  511. if (currentHour >= 0 && currentHour < 12) {
  512. jcValue = '1'
  513. } else {
  514. jcValue = '2'
  515. }
  516. formData.value.jc = jcValue
  517. }
  518. /**
  519. * 更新星期几显示文本
  520. */
  521. const updateWeekdayText = (dateStr) => {
  522. if (!dateStr) {
  523. weekdayText.value = ''
  524. return
  525. }
  526. try {
  527. const date = new Date(dateStr)
  528. const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  529. weekdayText.value = weekdays[date.getDay()]
  530. } catch (error) {
  531. console.error('解析日期失败:', error)
  532. weekdayText.value = ''
  533. }
  534. }
  535. /**
  536. * 日期选择变化处理
  537. */
  538. const onDateChange = (value) => {
  539. // console.log('日期选择变化:', value)
  540. updateWeekdayText(value)
  541. }
  542. // ==================== 校车点名初始化(接口) ====================
  543. const loadXcdmInit = async () => {
  544. try {
  545. const params = {
  546. rq: formData.value.rq,
  547. jc: formData.value.jc,
  548. carNo: formData.value.carNo,
  549. }
  550. const res = await xcdmApi.mp_xcdmHomep_load(params)
  551. console.log('mp_xcdmHomep_load:', res)
  552. // 先只看返回结构,后续再接字段映射
  553. if (res?.data?.xcdmlbm != null) {
  554. xcdmlbm.value = Number(res.data.xcdmlbm) || 1
  555. // 节次:接=上午(1),送=下午(2)
  556. formData.value.jc = xcdmlbm.value === 51 ? '2' : '1'
  557. }
  558. // 车牌号回显:优先 xcList[0].mc,其次接口 carNo
  559. const apiCarNo = res?.data?.xcList?.[0]?.mc || res?.data?.carNo
  560. if (apiCarNo) formData.value.carNo = apiCarNo
  561. if (res?.data?.xcid != null) xcid.value = String(res.data.xcid)
  562. if (res?.data?.jskssj != null) jskssj.value = utilFormatDate(String(res.data.jskssj), 'yyyy-MM-dd HH:mm:ss')
  563. if (res?.data?.jsjssj != null) jsjssj.value = utilFormatDate(String(res.data.jsjssj), 'yyyy-MM-dd HH:mm:ss')
  564. if (res?.data?.curZdxh != null) curZdxh.value = Number(res.data.curZdxh) || 1
  565. if (Array.isArray(res?.data?.zdList) && res.data.zdList.length) {
  566. zdList.value = res.data.zdList
  567. }
  568. if (Array.isArray(res?.data?.zdcyList)) {
  569. zdcyList.value = res.data.zdcyList
  570. }
  571. // 初始化时把中心点对齐到当前站
  572. centerStopIndex.value = actualStopIndex.value
  573. // 已点名摘要:只要返回 jsrs 就视为已点名(qjrs/ycrs 可能任何时候都会返回)
  574. if (res?.data?.jsrs !== undefined && res?.data?.jsrs !== null) {
  575. isSummaryMode.value = true
  576. summaryJsrs.value = Number(res.data.jsrs || 0)
  577. summaryQjrs.value = Number(res.data.qjrs || 0)
  578. summaryYcrs.value = Number(res.data.ycrs || 0)
  579. // 摘要模式不展示列表
  580. zdcyList.value = []
  581. } else {
  582. isSummaryMode.value = false
  583. summaryJsrs.value = 0
  584. summaryQjrs.value = 0
  585. summaryYcrs.value = 0
  586. }
  587. const msg = res?.data?.msg ? String(res.data.msg) : ''
  588. notInTimeMsg.value = ''
  589. if (msg.includes('不在校车接送时段') || msg.includes('不在点名时段')) {
  590. isNotInTime.value = true
  591. notInTimeMsg.value = msg
  592. if (res?.data?.swsjd && NotInTime.value[0]) NotInTime.value[0].range = String(res.data.swsjd)
  593. if (res?.data?.xwsjd && NotInTime.value[1]) NotInTime.value[1].range = String(res.data.xwsjd)
  594. }
  595. return res
  596. } catch (e) {
  597. console.warn('mp_xcdmHomep_load failed:', e)
  598. return null
  599. }
  600. }
  601. // ==================== 事件处理方法 ====================
  602. // ==================== 状态码工具(上午接/下午送) ====================
  603. const getModeLabels = () => {
  604. return xcdmlbm.value === 51
  605. ? { base: '已上车', success: '已送达', unboard: '未上车' }
  606. : { base: '待上车', success: '已上车', unboard: '未上车' }
  607. }
  608. const isLeave = (student) => Number(student?.rcid || 0) > 0
  609. const isUnboard = (student) => [11, 61].includes(Number(student?.xcjslbm))
  610. const isSuccess = (student) => [1, 51].includes(Number(student?.xcjslbm))
  611. const isWait = (student) => Number(student?.xcjslbm) === 0 && !isLeave(student)
  612. const getStatusText = (student) => {
  613. if (isLeave(student)) return '请假'
  614. const code = Number(student?.xcjslbm)
  615. const labels = getModeLabels()
  616. if (code === 0) return labels.base
  617. if (code === 1 || code === 51) return labels.success
  618. if (code === 11 || code === 61) return labels.unboard
  619. return labels.base
  620. }
  621. const shouldShowException = (student) => {
  622. if (!student) return false
  623. if (isLeave(student)) return false
  624. // 待上车/已上车时可异常登记;未上车不显示异常登记
  625. return Number(student.xcjslbm) === 0 || isSuccess(student)
  626. }
  627. // ==================== 状态切换接口(mp_xcdmHomep_swState) ====================
  628. const callSwState = async ({ student, xcjslbm, sm }) => {
  629. const payload = {
  630. xcid: xcid.value,
  631. xcdmlbm: xcdmlbm.value,
  632. jskssj: jskssj.value,
  633. jsjssj: jsjssj.value,
  634. zdryid: student?.zdryid,
  635. xcjslbm,
  636. }
  637. if (Number(xcjslbm) === 0 && student?.xcjsjlid != null) payload.xcjsjlid = student.xcjsjlid
  638. if (sm) payload.sm = sm
  639. const res = await xcdmApi.mp_xcdmHomep_swState(payload)
  640. console.log('mp_xcdmHomep_swState:', payload, res)
  641. return res
  642. }
  643. /**
  644. * 加载学生数据
  645. * 当前无接口:使用前端 mock 数据
  646. */
  647. const loadStudentData = async ({ syncScrollToCenter = false } = {}) => {
  648. try {
  649. isSummaryMode.value = false
  650. isNotInTime.value = false
  651. // 初始化接口(先打印返回,后续再把返回映射到页面字段)
  652. await loadXcdmInit()
  653. if (isNotInTime.value) return
  654. if (isSummaryMode.value) return
  655. nextTick(() => {
  656. measureHeaderHeight()
  657. measureRowHeightPx()
  658. measureListViewportHeightPx()
  659. if (syncScrollToCenter) scrollListToCenterStop({ animate: true })
  660. })
  661. } catch (error) {
  662. console.error('加载学生数据失败:', error)
  663. uni.showToast({
  664. title: '加载学生数据失败',
  665. icon: 'none'
  666. })
  667. }
  668. }
  669. /**
  670. * 处理学生点击
  671. * 切换学生的考勤状态
  672. * @param {Object} student - 被点击的学生对象
  673. */
  674. const handleStudentClick = async (student) => {
  675. // console.log('点击学生:', student)
  676. if (isLeave(student)) return
  677. const code = Number(student?.xcjslbm)
  678. const labels = getModeLabels()
  679. // 已上车/已送达 -> 取消回到 0;未上车 -> 确认回到 0
  680. if (isSuccess(student)) {
  681. closeAllSwipeStates()
  682. pendingStatusChange.value = { zdryid: student.zdryid, to: 0 }
  683. confirmTextLine1.value = `“${labels.success}”消息已发送至家长`
  684. confirmTextLine2.value = `是否取消“${labels.success}”?`
  685. showConfirm.value = true
  686. return
  687. }
  688. if (isUnboard(student)) {
  689. closeAllSwipeStates()
  690. pendingStatusChange.value = { zdryid: student.zdryid, to: 0 }
  691. confirmTextLine1.value = `当前状态:${labels.unboard}`
  692. confirmTextLine2.value = `是否改为“${labels.base}”?`
  693. showConfirm.value = true
  694. return
  695. }
  696. // 0 -> 1(上午接) / 51(下午送)
  697. if (code === 0) {
  698. const nextCode = xcdmlbm.value === 51 ? 51 : 1
  699. const targetStudent = zdcyList.value.find(s => Number(s.zdryid) === Number(student.zdryid))
  700. if (targetStudent) {
  701. try {
  702. await callSwState({ student: targetStudent, xcjslbm: nextCode })
  703. targetStudent.xcjslbm = nextCode
  704. } catch (e) {
  705. console.warn('mp_xcdmHomep_swState failed:', e)
  706. uni.showToast({ title: '切换失败', icon: 'none' })
  707. }
  708. }
  709. }
  710. }
  711. const handleBottomAction = ({ action }) => {
  712. if (action === 'save') handleSave()
  713. }
  714. const handleSave = async () => {
  715. try {
  716. if (!xcid.value || !jskssj.value || !jsjssj.value) {
  717. uni.showToast({ title: '缺少校车信息', icon: 'none' })
  718. return
  719. }
  720. const qjrs = zdcyList.value.filter(s => isLeave(s)).length
  721. const ycrs = zdcyList.value.filter(s => isUnboard(s)).length
  722. const jsrs = Math.max(0, zdcyList.value.length - qjrs)
  723. const payload = {
  724. xcid: xcid.value,
  725. jskssj: jskssj.value,
  726. jsjssj: jsjssj.value,
  727. jsrs,
  728. qjrs,
  729. ycrs,
  730. }
  731. const res = await xcdmApi.mp_xcdmHomep_subm(payload)
  732. console.log('mp_xcdmHomep_subm:', payload, res)
  733. uni.showToast({ title: '提交成功', icon: 'success' })
  734. // 提交后重新拉取一次,刷新为“已点名”摘要
  735. await loadStudentData({ syncScrollToCenter: false })
  736. } catch (e) {
  737. console.error('提交失败:', e)
  738. uni.showToast({ title: '提交失败', icon: 'none' })
  739. }
  740. }
  741. // 左滑状态管理(参考 todo_list.vue)
  742. const swipeStates = ref({})
  743. const touchStartX = ref(0)
  744. const touchStartY = ref(0)
  745. const isSwiping = ref(false)
  746. const actionWidth = (student) => {
  747. // 待上车 / 已上车:异常登记+家长电话;未上车/请假:仅家长电话
  748. return shouldShowException(student) ? 320 : 160
  749. }
  750. const closeAllSwipeStates = () => {
  751. Object.keys(swipeStates.value).forEach(key => {
  752. swipeStates.value[key] = false
  753. })
  754. }
  755. const handleTouchStart = (event, itemId) => {
  756. if (showConfirm.value) return
  757. touchStartX.value = event.touches[0].clientX
  758. touchStartY.value = event.touches[0].clientY
  759. }
  760. const handleTouchMove = (event, itemId) => {
  761. if (showConfirm.value) return
  762. const deltaX = event.touches[0].clientX - touchStartX.value
  763. const deltaY = event.touches[0].clientY - touchStartY.value
  764. if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > 30) {
  765. isSwiping.value = true
  766. event.preventDefault()
  767. if (deltaX < -50) {
  768. closeAllSwipeStates()
  769. swipeStates.value[itemId] = true
  770. } else if (deltaX > 50) {
  771. swipeStates.value[itemId] = false
  772. }
  773. }
  774. }
  775. const handleTouchEnd = () => {
  776. if (showConfirm.value) return
  777. // 延迟清理,避免 touchend 后立刻触发 tap
  778. setTimeout(() => {
  779. isSwiping.value = false
  780. }, 50)
  781. }
  782. const handleStudentTap = (student) => {
  783. if (isSwiping.value) return
  784. handleStudentClick(student)
  785. }
  786. const pendingStatusChange = ref(null)
  787. const scrollIntoViewId = ref('')
  788. const handleCallParent = (student) => {
  789. // 保存校车电话记录(不阻塞拨号)
  790. try {
  791. if (xcid.value && jskssj.value && jsjssj.value) {
  792. xcdmApi.mp_xcdmHomep_saveXcdhjl({
  793. xcid: xcid.value,
  794. jskssj: jskssj.value,
  795. jsjssj: jsjssj.value,
  796. xcdmlbm: xcdmlbm.value,
  797. zdryid: student.zdryid,
  798. }).then((res) => {
  799. console.log('mp_xcdmHomep_saveXcdhjl:', res)
  800. }).catch((e) => {
  801. console.warn('mp_xcdmHomep_saveXcdhjl failed:', e)
  802. })
  803. }
  804. } catch (e) { }
  805. console.log('[mock] makePhoneCall', { zdryid: student.zdryid, phoneNumber: student.jzdh })
  806. uni.makePhoneCall({ phoneNumber: student.jzdh })
  807. }
  808. const handleException = (student) => {
  809. closeAllSwipeStates()
  810. const mode = xcdmlbm.value
  811. const site = zdList.value.find(z => Number(z.xh) === Number(student.zdxh))?.mc || ''
  812. uni.navigateTo({
  813. url: `/pages/xcdm/exception?zdryid=${encodeURIComponent(student.zdryid)}&xm=${encodeURIComponent(student.xm)}&site=${encodeURIComponent(site)}&xcdmlbm=${encodeURIComponent(String(mode))}&xcid=${encodeURIComponent(String(xcid.value || ''))}&jskssj=${encodeURIComponent(String(jskssj.value || ''))}&jsjssj=${encodeURIComponent(String(jsjssj.value || ''))}`
  814. })
  815. }
  816. /**
  817. * 获取表格行的样式类
  818. * @param {string} status - 状态
  819. * @returns {string} CSS类名
  820. */
  821. const getRowClass = (student) => {
  822. const classes = []
  823. const curOrder = getOrderIndexByZdxh(curZdxh.value)
  824. const stuOrder = getOrderIndexByZdxh(student?.zdxh)
  825. const stage = stuOrder < curOrder ? 'past' : stuOrder === curOrder ? 'current' : 'future'
  826. if (stage === 'past') classes.push('row-site-past')
  827. else if (stage === 'current') classes.push('row-site-current')
  828. else classes.push('row-site-future')
  829. if (isLeave(student)) {
  830. classes.push('row-status-leave')
  831. if (stage === 'current') classes.push('row-leave-current')
  832. } else if (isUnboard(student)) {
  833. classes.push('row-status-off')
  834. } else if (isSuccess(student)) {
  835. classes.push('row-status-on')
  836. }
  837. return classes.join(' ')
  838. }
  839. const getDragIndicatorStyle = (student) => {
  840. let backgroundColor = '#357cdf'
  841. if (isUnboard(student)) return { backgroundColor: '#ff0000' }
  842. const curOrder = getOrderIndexByZdxh(curZdxh.value)
  843. const stuOrder = getOrderIndexByZdxh(student?.zdxh)
  844. const stage = stuOrder < curOrder ? 'past' : stuOrder === curOrder ? 'current' : 'future'
  845. if (stage === 'past') backgroundColor = '#999999'
  846. if (stage === 'future') backgroundColor = '#6b9ce0'
  847. if (stage === 'current') backgroundColor = '#357cdf'
  848. return { backgroundColor }
  849. }
  850. const headerHeight = ref(300) // 固定头部高度(rpx),初始值设大一点避免遮挡
  851. // 获取当前组件实例(用于 SelectorQuery)
  852. const instance = getCurrentInstance()
  853. /**
  854. * 测量并更新头部高度
  855. * @param {number} retryCount - 重试次数
  856. */
  857. const measureHeaderHeight = (retryCount = 0) => {
  858. nextTick(() => {
  859. uni.createSelectorQuery()
  860. .in(instance) // 指定在当前组件实例中查询
  861. .select('.fixed-header')
  862. .boundingClientRect((rect) => {
  863. if (rect && rect.height > 0) {
  864. const headerHeightRpx = rect.height * 2 // px转rpx
  865. headerHeight.value = headerHeightRpx
  866. console.log('更新头部高度:', rect.height, 'px =', headerHeightRpx, 'rpx')
  867. } else if (retryCount < 5) {
  868. // 如果获取失败且重试次数未达到上限,延迟后重试
  869. console.log('头部高度获取失败,第', retryCount + 1, '次重试...', 'rect:', rect)
  870. setTimeout(() => {
  871. measureHeaderHeight(retryCount + 1)
  872. }, 100)
  873. }
  874. })
  875. .exec()
  876. })
  877. }
  878. /**
  879. * 确认弹窗按钮点击处理
  880. */
  881. const handleConfirmAction = async (data) => {
  882. // console.log('确认弹窗按钮点击:', data)
  883. switch (data.action) {
  884. case 'cancel':
  885. showConfirm.value = false
  886. pendingStatusChange.value = null
  887. break
  888. case 'confirm':
  889. showConfirm.value = false
  890. if (pendingStatusChange.value?.zdryid) {
  891. const { zdryid, to } = pendingStatusChange.value
  892. const targetStudent = zdcyList.value.find(s => Number(s.zdryid) === Number(zdryid))
  893. if (targetStudent && !isLeave(targetStudent)) {
  894. try {
  895. await callSwState({ student: targetStudent, xcjslbm: Number(to) })
  896. targetStudent.xcjslbm = Number(to)
  897. } catch (e) {
  898. console.warn('mp_xcdmHomep_swState failed:', e)
  899. uni.showToast({ title: '切换失败', icon: 'none' })
  900. }
  901. }
  902. }
  903. pendingStatusChange.value = null
  904. break
  905. }
  906. }
  907. /**
  908. * 确认弹窗关闭处理
  909. */
  910. const handleConfirmClose = () => {
  911. // console.log('确认弹窗关闭')
  912. showConfirm.value = false
  913. pendingStatusChange.value = null
  914. }
  915. // ==================== 页面初始化 ====================
  916. /**
  917. * 页面挂载时的初始化
  918. */
  919. // onMounted(() => {
  920. // // 初始化表单默认值
  921. // initFormDefaults()
  922. // // 加载班级选项
  923. // loadClassOptions()
  924. // // 加载学生数据
  925. // // loadStudentData()
  926. // // 多次尝试获取固定头部的高度,确保准确
  927. // const measureHeader = () => {
  928. // uni.createSelectorQuery().select('.fixed-header').boundingClientRect((rect) => {
  929. // if (rect && rect.height > 0) {
  930. // initialFilterHeight.value = rect.height
  931. // const headerHeightRpx = rect.height * 2 // px转rpx
  932. // headerHeight.value = headerHeightRpx
  933. // // console.log('固定头部高度:', rect.height, 'px =', headerHeightRpx, 'rpx')
  934. // } else {
  935. // // 如果还没获取到,再试一次
  936. // setTimeout(measureHeader, 50)
  937. // }
  938. // }).exec()
  939. // }
  940. // // 立即尝试测量,然后延迟再测量一次确保准确
  941. // measureHeader()
  942. // setTimeout(measureHeader, 200)
  943. // // 如有需要,可在此初始化更多 mock 数据
  944. // })
  945. // ============== 暴露给主容器的生命周期(供 pages/main/index.vue 调用) ==============
  946. // 避免重复初始化的标记
  947. function onLoad() {
  948. initFormDefaults()
  949. loadStudentData({ syncScrollToCenter: true })
  950. }
  951. function onShow() {
  952. // 每次切到该页时都刷新数据
  953. // 头部高度会在 loadStudentData 完成后自动测量
  954. initFormDefaults()
  955. loadStudentData({ syncScrollToCenter: false })
  956. }
  957. function onHide() {
  958. // 可按需做暂存处理
  959. }
  960. function onUnload() {
  961. // 可按需做清理处理
  962. }
  963. defineExpose({ onLoad, onShow, onHide, onUnload })
  964. // 预留:后续如需全局滚动处理再接入
  965. </script>
  966. <style lang="scss" scoped>
  967. .page-container {
  968. display: flex;
  969. flex-direction: column;
  970. height: 100vh;
  971. background-color: #f2f3f4;
  972. position: relative;
  973. }
  974. .fixed-header {
  975. position: fixed;
  976. top: 0;
  977. left: 0;
  978. right: 0;
  979. z-index: 100;
  980. background-color: #f2f3f4;
  981. }
  982. .filter-area {
  983. // background-color: #fff;
  984. transition: all 0.3s ease;
  985. // border-bottom: 1rpx solid #eceded;
  986. .full-form {
  987. padding: 18rpx 0 18rpx;
  988. }
  989. }
  990. .stop-progress {
  991. width: 100%;
  992. height: 120rpx; // 约 60px
  993. background: #f2f3f4;
  994. border-bottom: 1rpx solid #eceded;
  995. display: flex;
  996. flex-direction: column;
  997. justify-content: center;
  998. box-sizing: border-box;
  999. padding: 0 24rpx 36rpx;
  1000. overflow: visible;
  1001. }
  1002. .stop-track {
  1003. display: flex;
  1004. align-items: center;
  1005. }
  1006. .stop-node {
  1007. display: flex;
  1008. align-items: center;
  1009. justify-content: center;
  1010. flex-shrink: 0;
  1011. width: 36rpx; // 18px
  1012. height: 36rpx; // 18px
  1013. }
  1014. .stop-node.center {
  1015. width: 56rpx; // 28px
  1016. height: 56rpx; // 28px
  1017. }
  1018. .stop-dot {
  1019. width: 100%;
  1020. height: 100%;
  1021. border-radius: 9999rpx;
  1022. }
  1023. .dot-past {
  1024. background: #c3c7cb;
  1025. }
  1026. .dot-future {
  1027. background: #fff;
  1028. border: 2rpx solid #c3c7cb; // 约 1px
  1029. box-sizing: border-box;
  1030. }
  1031. .dot-actual {
  1032. background: #e59f40;
  1033. }
  1034. .dot-current {
  1035. background: #e59f40;
  1036. }
  1037. .dot-focus-future {
  1038. background: #fff;
  1039. border: 2rpx solid #e59f40;
  1040. box-sizing: border-box;
  1041. }
  1042. .dot-focus-past {
  1043. background: #c3c7cb;
  1044. border: 2rpx solid #e59f40;
  1045. box-sizing: border-box;
  1046. }
  1047. .dot-empty {
  1048. background: transparent;
  1049. opacity: 0;
  1050. }
  1051. .stop-line {
  1052. flex: 1;
  1053. height: 4rpx; // 约 2px
  1054. background: #c3c7cb;
  1055. }
  1056. .line-empty {
  1057. background: transparent;
  1058. opacity: 0;
  1059. }
  1060. .stop-label-row {
  1061. margin-top: 8rpx;
  1062. position: relative;
  1063. overflow: visible;
  1064. height: 52rpx;
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: center;
  1068. gap: 24rpx;
  1069. }
  1070. .stop-label-current {
  1071. font-size: 44rpx; // 约 22px
  1072. color: #000;
  1073. font-weight: 700;
  1074. text-align: center;
  1075. white-space: nowrap;
  1076. overflow: visible;
  1077. line-height: 1.1;
  1078. z-index: 2;
  1079. flex-shrink: 0;
  1080. }
  1081. .stop-label-side {
  1082. font-size: 32rpx;
  1083. color: #999;
  1084. font-weight: 400;
  1085. white-space: nowrap;
  1086. overflow: hidden;
  1087. z-index: 1;
  1088. flex: 1;
  1089. }
  1090. .stop-label-prev {
  1091. text-align: right;
  1092. }
  1093. .stop-label-next {
  1094. text-align: left;
  1095. }
  1096. .onoff-button-group {
  1097. display: flex;
  1098. flex-wrap: wrap;
  1099. gap: 20rpx;
  1100. align-items: flex-start;
  1101. }
  1102. .stats-area {
  1103. background-color: #fff;
  1104. padding: 24rpx;
  1105. display: flex;
  1106. align-items: center;
  1107. justify-content: space-between;
  1108. .stat-parent {
  1109. color: #e59f40;
  1110. margin-right: 8rpx;
  1111. }
  1112. .stats-left {
  1113. font-size: 28rpx;
  1114. font-weight: 500;
  1115. display: flex;
  1116. align-items: center;
  1117. }
  1118. .stats-right {
  1119. font-size: 30rpx;
  1120. font-weight: 600;
  1121. color: #333;
  1122. }
  1123. }
  1124. .student-list-area {
  1125. background-color: #ffffff;
  1126. flex: 1;
  1127. height: 0; // 配合 flex: 1,让 scroll-view 正确计算剩余空间
  1128. }
  1129. .student-table-wrapper {
  1130. flex: 1;
  1131. height: 0;
  1132. display: flex;
  1133. flex-direction: column;
  1134. padding-bottom: 120rpx; // 给底部按钮留出空间
  1135. background-color: #fff;
  1136. }
  1137. .student-table {
  1138. width: calc(100% - 32rpx);
  1139. margin: 0 auto;
  1140. border: 1rpx solid #d2d2d2;
  1141. background-color: #fff;
  1142. display: flex;
  1143. flex-direction: column;
  1144. flex: 1;
  1145. height: 0;
  1146. .row-wrapper {
  1147. position: relative;
  1148. overflow: hidden;
  1149. }
  1150. .row-wrapper:last-child .table-row {
  1151. border-bottom: none;
  1152. }
  1153. .swipe-actions {
  1154. position: absolute;
  1155. top: 0;
  1156. right: 0;
  1157. bottom: 0;
  1158. display: flex;
  1159. align-items: stretch;
  1160. z-index: 1;
  1161. box-sizing: border-box;
  1162. .action-btn {
  1163. width: 160rpx;
  1164. display: flex;
  1165. align-items: center;
  1166. justify-content: center;
  1167. font-size: 30rpx;
  1168. font-weight: 600;
  1169. color: #fff;
  1170. }
  1171. .exception-btn {
  1172. background-color: #ff0000;
  1173. }
  1174. .phone-btn {
  1175. background-color: #357cdf;
  1176. }
  1177. }
  1178. .table-header {
  1179. display: flex;
  1180. background-color: #efefef;
  1181. border-bottom: 1rpx solid #d2d2d2;
  1182. padding: 20rpx;
  1183. align-items: center;
  1184. // margin-bottom: 10rpx;
  1185. .col-name {
  1186. width: 240rpx;
  1187. font-size: 28rpx;
  1188. font-weight: bold;
  1189. color: #333;
  1190. }
  1191. .col-class {
  1192. flex: 1;
  1193. font-size: 28rpx;
  1194. font-weight: bold;
  1195. color: #333;
  1196. }
  1197. .col-status {
  1198. width: 160rpx;
  1199. font-size: 28rpx;
  1200. font-weight: bold;
  1201. color: #333;
  1202. text-align: left;
  1203. }
  1204. }
  1205. .table-row {
  1206. display: flex;
  1207. padding: 20rpx;
  1208. transition: background-color 0.3s ease;
  1209. position: relative;
  1210. z-index: 2;
  1211. transition: transform 0.2s ease, background-color 0.3s ease;
  1212. border-bottom: 1rpx solid #d2d2d2;
  1213. &:active {
  1214. background-color: #f0f0f0;
  1215. }
  1216. .col-name {
  1217. width: 240rpx;
  1218. font-size: 32rpx;
  1219. color: #000;
  1220. }
  1221. .col-class {
  1222. flex: 1;
  1223. font-size: 32rpx;
  1224. color: #000;
  1225. }
  1226. .col-status {
  1227. width: 160rpx;
  1228. text-align: left;
  1229. font-size: 32rpx;
  1230. color: #000;
  1231. }
  1232. .drag-indicator {
  1233. position: absolute;
  1234. right: 0;
  1235. top: 0;
  1236. bottom: 0;
  1237. width: 8rpx; // 约 4px
  1238. height: 100%;
  1239. opacity: 0.9;
  1240. }
  1241. // 状态行样式
  1242. &.row-site-past {
  1243. background-color: #d4f8d4;
  1244. .col-name,
  1245. .col-class,
  1246. .col-status {
  1247. color: #666;
  1248. }
  1249. }
  1250. &.row-site-current {
  1251. background-color: #e59f40;
  1252. font-weight: 700;
  1253. .col-name,
  1254. .col-class,
  1255. .col-status {
  1256. color: #000;
  1257. font-weight: 700;
  1258. }
  1259. }
  1260. &.row-site-future {
  1261. background-color: #fff;
  1262. .col-name,
  1263. .col-class,
  1264. .col-status {
  1265. color: #666;
  1266. }
  1267. }
  1268. &.row-status-on {
  1269. background-color: #d4f8d4;
  1270. .col-name,
  1271. .col-class,
  1272. .col-status {
  1273. color: #666;
  1274. font-weight: 400;
  1275. }
  1276. }
  1277. &.row-status-leave {
  1278. background-color: #c7e0ff;
  1279. .col-name,
  1280. .col-class,
  1281. .col-status {
  1282. color: #000;
  1283. font-weight: 400;
  1284. }
  1285. }
  1286. &.row-leave-current {
  1287. .col-name,
  1288. .col-class,
  1289. .col-status {
  1290. font-weight: 700;
  1291. }
  1292. }
  1293. &.row-status-off {
  1294. background-color: #eb6100;
  1295. .col-name,
  1296. .col-class,
  1297. .col-status {
  1298. color: #fff;
  1299. font-weight: 400;
  1300. }
  1301. }
  1302. }
  1303. .row-wrapper.swiped .table-row {
  1304. transform: translateX(calc(-1 * var(--actions-width)));
  1305. }
  1306. .row-wrapper.swiped .drag-indicator {
  1307. display: none;
  1308. }
  1309. }
  1310. // 星期几显示样式
  1311. .weekday-text {
  1312. font-size: 32rpx;
  1313. color: #333;
  1314. position: absolute;
  1315. right: 100rpx;
  1316. top: 50%;
  1317. transform: translateY(-50%);
  1318. padding-bottom: 6rpx;
  1319. }
  1320. // ==================== 确认弹窗样式 ====================
  1321. // 统计信息样式
  1322. .stats-section {
  1323. padding: 40rpx;
  1324. display: flex;
  1325. flex-direction: column;
  1326. gap: 20rpx;
  1327. .stat-item {
  1328. display: flex;
  1329. align-items: center;
  1330. justify-content: center;
  1331. font-size: 34rpx;
  1332. color: #333;
  1333. .stat-label {
  1334. text-align: right;
  1335. flex: 1;
  1336. margin-right: 20rpx;
  1337. }
  1338. .stat-value {
  1339. flex: 1;
  1340. }
  1341. }
  1342. }
  1343. .confirm-message {
  1344. height: calc(100% - 100rpx);
  1345. display: flex;
  1346. flex-direction: column;
  1347. align-items: center;
  1348. justify-content: center;
  1349. gap: 16rpx;
  1350. padding: 24rpx;
  1351. box-sizing: border-box;
  1352. text-align: center;
  1353. }
  1354. .confirm-icon {
  1355. width: 120rpx;
  1356. height: 120rpx;
  1357. }
  1358. .confirm-text {
  1359. font-size: 32rpx;
  1360. color: #333;
  1361. font-weight: 400;
  1362. }
  1363. // 只读班级名称样式
  1364. .readonly-field {
  1365. width: 100%;
  1366. min-height: 60rpx;
  1367. display: flex;
  1368. align-items: center;
  1369. }
  1370. .readonly-text {
  1371. font-size: 32rpx;
  1372. }
  1373. // 晚自习模式相关样式
  1374. .select-group {
  1375. width: 100%;
  1376. }
  1377. .mt-10 {
  1378. margin-top: 10rpx;
  1379. }
  1380. .summary-area{
  1381. margin-top:40vh
  1382. }
  1383. .isNotInTime{
  1384. width: calc(100% - 40rpx);
  1385. height: calc(100% - 40rpx);
  1386. background: #fff;
  1387. position: absolute;
  1388. left: 50%;
  1389. top: 50%;
  1390. transform: translate(-50%,-50%);
  1391. border-radius: 4rpx;
  1392. border: 2rpx solid #ebecec;
  1393. display: flex;
  1394. flex-direction: column;
  1395. padding: 20rpx;
  1396. box-sizing: border-box;
  1397. .isNotInTime-title{
  1398. color: #333;
  1399. font-weight: 500;
  1400. font-size: 38rpx;
  1401. text-align: center;
  1402. flex: 3;
  1403. display: flex;
  1404. align-items: center;
  1405. justify-content: center;
  1406. gap: 30rpx;
  1407. }
  1408. .isNotInTime-content{
  1409. flex: 7;
  1410. border-radius: 4rpx;
  1411. background: #f9fafb;
  1412. padding: 0 30rpx;
  1413. .isNotInTime-content-title{
  1414. font-size: 36rpx;
  1415. color: #333333;
  1416. font-weight: 400;
  1417. margin: 30rpx 0;
  1418. }
  1419. .isNotInTime-content-tip{
  1420. font-size: 26rpx;
  1421. color: #999;
  1422. font-weight: 400;
  1423. margin-top: -14rpx;
  1424. margin-bottom: 22rpx;
  1425. }
  1426. .isNotInTime-content-item{
  1427. font-size: 36rpx;
  1428. color: #333333;
  1429. font-weight: 400;
  1430. display: flex;
  1431. align-items: center;
  1432. justify-content: flex-start;
  1433. background: #fff;
  1434. padding:20rpx 30rpx;
  1435. box-sizing: border-box;
  1436. border-radius: 4rpx;
  1437. margin-bottom: 30rpx;
  1438. gap: 30rpx;
  1439. .isNotInTime-content-item-icon{
  1440. width: 120rpx;
  1441. text-align: center;
  1442. }
  1443. }
  1444. }
  1445. }
  1446. </style>