pending.uvue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013
  1. <template>
  2. <uni-navbar-lite :showLeft=true title="待评分工单"></uni-navbar-lite>
  3. <view class="list-page">
  4. <!-- 搜索栏 -->
  5. <view class="search-bar">
  6. <view class="search-box">
  7. <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
  8. <input
  9. class="search-input"
  10. placeholder="搜索工单编码、风机编号"
  11. v-model="searchKeyword"
  12. @confirm="handleSearch"
  13. @blur="handleSearch"
  14. />
  15. <text v-if="searchKeyword.length > 0" class="clear-icon" @click="clearSearch">✕</text>
  16. </view>
  17. </view>
  18. <!-- 工单评分状态筛选 -->
  19. <!-- <view class="status-bar">
  20. <view class="status-box">
  21. <text
  22. class="status-txt"
  23. :class="{ 'stauts-sel': statusFilter === '' }"
  24. @click="filterByStatus('')"
  25. >
  26. 全部
  27. </text>
  28. <text
  29. class="status-txt"
  30. :class="{ 'stauts-sel': statusFilter === 'to_self' }"
  31. @click="filterByStatus('to_self')"
  32. >
  33. 待自评
  34. </text>
  35. <text
  36. class="status-txt"
  37. :class="{ 'stauts-sel': statusFilter === 'to_re' }"
  38. @click="filterByStatus('to_re')"
  39. >
  40. 待复评
  41. </text>
  42. <text
  43. class="status-txt"
  44. :class="{ 'stauts-sel': statusFilter === 'to_confirm' }"
  45. @click="filterByStatus('to_confirm')"
  46. >
  47. 待确认
  48. </text>
  49. <text
  50. class="status-txt"
  51. :class="{ 'stauts-sel': statusFilter === 'to_final' }"
  52. @click="filterByStatus('to_final')"
  53. >
  54. 待终评
  55. </text>
  56. </view>
  57. </view> -->
  58. <!-- 工分统计 -->
  59. <!-- <view class="stats-section">
  60. <view class="stats-header">
  61. <text class="stats-title">{{ monthTitle }}月度工分</text>
  62. <view class="month-filters">
  63. <text
  64. class="month-filter"
  65. :class="{ 'month-filter-sel': selectedMonth === 'prev' }"
  66. @click="changeMonth('prev')"
  67. >
  68. 上月
  69. </text>
  70. <text
  71. class="month-filter"
  72. :class="{ 'month-filter-sel': selectedMonth === 'current' }"
  73. @click="changeMonth('current')"
  74. >
  75. 本月
  76. </text>
  77. <text
  78. class="month-filter"
  79. :class="{ 'month-filter-sel': selectedMonth === 'custom' }"
  80. @click="showCustomDatePicker"
  81. >
  82. 自定义
  83. </text>
  84. </view>
  85. </view> -->
  86. <!-- 统计数据 -->
  87. <!-- <view class="stats-content">
  88. <view class="total-score">
  89. <text class="score-value">{{ totalScore }}分</text>
  90. <text class="score-label">{{ monthTitle }}总工分</text>
  91. </view>
  92. <view class="score-breakdown">
  93. <view class="breakdown-item">
  94. <text class="breakdown-label">维保工分</text>
  95. <text class="breakdown-value">{{ maintenanceScore }}分</text>
  96. </view>
  97. <view class="breakdown-item">
  98. <text class="breakdown-label">维修工分</text>
  99. <text class="breakdown-value">{{ repairScore }}分</text>
  100. </view>
  101. <view v-if="rank !== null && totalRankingUsers !== null" class="breakdown-item">
  102. <text class="breakdown-label">排名</text>
  103. <text class="breakdown-value">{{ rank }}/{{ totalRankingUsers }}</text>
  104. </view>
  105. </view>
  106. </view>
  107. </view> -->
  108. <!-- 工单评分列表 -->
  109. <common-list
  110. :dataList="orderList"
  111. :loading="loading"
  112. :refreshing="refreshing"
  113. :hasMore="hasMore"
  114. @refresh="handleRefresh"
  115. @loadMore="loadMore"
  116. @itemClick="handleItemClick"
  117. class="list-with-padding"
  118. >
  119. <template #default="{ item, index }">
  120. <view class="list-item">
  121. <view class="item-container">
  122. <view class="item-header">
  123. <text class="item-title">{{ getPropertyValue(item, 'workOrderProjectNo') }}-风机编号{{ getPropertyValue(item, 'pcsDeviceName') }}的{{ getWorkOrderTypeText(getPropertyValue(item, 'orderType')) }}</text>
  124. <!-- <text class="info-value">{{ getScoringStatus(item) }}</text> -->
  125. <text class="status-tag" :class="getStatusClass(item)">{{ getScoringStatus(item) }}</text>
  126. </view>
  127. <view class="info-row">
  128. <view class="info-label">
  129. <text class="text-gray">{{ getWorkOrderTypeInfo(item) }}</text>
  130. </view>
  131. <view class="info-value-row">
  132. <text v-if="getPropertyValue(item, 'score') !== ''" class="score-text">{{ formatNumber(parseFloat(getPropertyValue(item, 'score'))) }}</text>
  133. <!-- <text class="status-text">{{ getOrderStatusText(getPropertyValue(item, 'scoreStatus')) }}</text> -->
  134. </view>
  135. </view>
  136. <view class="info-row">
  137. <view class="info-label">
  138. <text class="text-gray">工作结束时间: {{ formatDate(getPropertyValue(item, 'assignTime')) }}</text>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. </common-list>
  145. <!-- 自定义时间选择弹窗 -->
  146. <l-popup v-model="showDatePickerPopup" position="bottom">
  147. <view class="date-picker-popup">
  148. <view class="popup-header">
  149. <text class="popup-title">选择年月</text>
  150. <view class="popup-actions">
  151. <text class="cancel-btn" @click="closeDatePicker">取消</text>
  152. </view>
  153. </view>
  154. <view class="date-picker-container">
  155. <view class="date-picker-item">
  156. <!-- <text class="date-label">选择年月</text> -->
  157. <view class="date-display" @click="openDatePicker">
  158. {{ customDate != null && customDate != '' ? customDate : '请选择年月' }}
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </l-popup>
  164. <!-- Date Picker -->
  165. <l-popup v-model="showDatePicker" position="bottom" :z-index="1000">
  166. <l-date-time-picker
  167. :mode="3"
  168. format="YYYY-MM"
  169. :modelValue="customDate"
  170. confirm-btn="确定"
  171. cancel-btn="取消"
  172. @confirm="onDateConfirm"
  173. @cancel="showDatePicker = false">
  174. </l-date-time-picker>
  175. </l-popup>
  176. <!-- 底部 TabBar -->
  177. <!-- <custom-tabbar :current="3" /> -->
  178. </view>
  179. </template>
  180. <script setup lang="uts">
  181. import { ref, computed, onMounted } from 'vue'
  182. import { listOrderScores, getOrderScoreStatistics, listMyRate } from '@/api/score/index'
  183. import { getDictDataByType } from '@/api/dict/index'
  184. import type { SysDictData } from '@/types/dict'
  185. // 数据状态
  186. let searchKeyword = ref<string>('')
  187. const statusFilter = ref<string>('')
  188. const selectedMonth = ref<string>('current')
  189. const loading = ref<boolean>(false)
  190. const refreshing = ref<boolean>(false)
  191. const hasMore = ref<boolean>(true)
  192. const orderList = ref<any[]>([])
  193. const currentPage = ref<number>(1)
  194. const totalScore = ref<number>(0)
  195. const maintenanceScore = ref<number>(0)
  196. const repairScore = ref<number>(0)
  197. const rank = ref<number | null>(null)
  198. const totalRankingUsers = ref<number | null>(null)
  199. const customDate = ref<string>('')
  200. // 弹窗显示状态
  201. const showDatePickerPopup = ref<boolean>(false)
  202. const showDatePicker = ref<boolean>(false)
  203. // 工单状态字典列表
  204. const statusDictList = ref<SysDictData[]>([])
  205. // 维保类型字典列表
  206. const inspectionTypeDictList = ref<SysDictData[]>([])
  207. // 检修类型字典列表
  208. const maintenanceTypeDictList = ref<SysDictData[]>([])
  209. const dictLoaded = ref<boolean>(false)
  210. // 计算属性
  211. const monthTitle = computed(() => {
  212. switch (selectedMonth.value) {
  213. case 'prev':
  214. return '上月'
  215. case 'current':
  216. return '本月'
  217. case 'custom':
  218. // 显示自定义选择的年月
  219. return (customDate.value != null && customDate.value != '') ? customDate.value : '自定义'
  220. default:
  221. return '本月'
  222. }
  223. })
  224. // 打开自定义日期选择弹窗
  225. function showCustomDatePicker() {
  226. showDatePickerPopup.value = true
  227. }
  228. function closeDatePicker() {
  229. showDatePicker.value = false
  230. showDatePickerPopup.value = false
  231. }
  232. // 打开日期选择器
  233. function openDatePicker() {
  234. showDatePicker.value = true
  235. }
  236. // 获取工单评分状态字典列表
  237. const loadStatusDictList = async (): Promise<void> => {
  238. try {
  239. const result = await getDictDataByType('gxt_scoring_status')
  240. const resultObj = result as UTSJSONObject
  241. if (resultObj['code'] == 200) {
  242. const data = resultObj['data'] as any[]
  243. const dictData: SysDictData[] = []
  244. if (data != null && data.length > 0) {
  245. for (let i = 0; i < data.length; i++) {
  246. const item = data[i] as UTSJSONObject
  247. // 只提取需要的字段
  248. const dictItem: SysDictData = {
  249. dictValue: item['dictValue'] as string | null,
  250. dictLabel: item['dictLabel'] as string | null,
  251. dictCode: null,
  252. dictSort: null,
  253. dictType: null,
  254. cssClass: null,
  255. listClass: null,
  256. isDefault: null,
  257. status: null,
  258. default: null,
  259. createTime: null,
  260. remark: null
  261. }
  262. dictData.push(dictItem)
  263. }
  264. }
  265. statusDictList.value = dictData
  266. }
  267. } catch (e: any) {
  268. console.error('获取工单评分状态字典失败:', e.message)
  269. }
  270. }
  271. // 获取维保类型字典列表
  272. const loadInspectionTypeDictList = async (): Promise<void> => {
  273. try {
  274. const result = await getDictDataByType('gxt_inspection_type')
  275. const resultObj = result as UTSJSONObject
  276. if (resultObj['code'] == 200) {
  277. const data = resultObj['data'] as any[]
  278. const dictData: SysDictData[] = []
  279. if (data != null && data.length > 0) {
  280. for (let i = 0; i < data.length; i++) {
  281. const item = data[i] as UTSJSONObject
  282. // 只提取需要的字段
  283. const dictItem: SysDictData = {
  284. dictValue: item['dictValue'] as string | null,
  285. dictLabel: item['dictLabel'] as string | null,
  286. dictCode: null,
  287. dictSort: null,
  288. dictType: null,
  289. cssClass: null,
  290. listClass: null,
  291. isDefault: null,
  292. status: null,
  293. default: null,
  294. createTime: null,
  295. remark: null
  296. }
  297. dictData.push(dictItem)
  298. }
  299. }
  300. inspectionTypeDictList.value = dictData
  301. }
  302. } catch (e: any) {
  303. console.error('获取维保类型字典失败:', e.message)
  304. }
  305. }
  306. // 获取检修类型字典列表
  307. const loadMaintenanceTypeDictList = async (): Promise<void> => {
  308. try {
  309. const result = await getDictDataByType('gxt_maintenance_type')
  310. const resultObj = result as UTSJSONObject
  311. if (resultObj['code'] == 200) {
  312. const data = resultObj['data'] as any[]
  313. const dictData: SysDictData[] = []
  314. if (data != null && data.length > 0) {
  315. for (let i = 0; i < data.length; i++) {
  316. const item = data[i] as UTSJSONObject
  317. // 只提取需要的字段
  318. const dictItem: SysDictData = {
  319. dictValue: item['dictValue'] as string | null,
  320. dictLabel: item['dictLabel'] as string | null,
  321. dictCode: null,
  322. dictSort: null,
  323. dictType: null,
  324. cssClass: null,
  325. listClass: null,
  326. isDefault: null,
  327. status: null,
  328. default: null,
  329. createTime: null,
  330. remark: null
  331. }
  332. dictData.push(dictItem)
  333. }
  334. }
  335. maintenanceTypeDictList.value = dictData
  336. }
  337. } catch (e: any) {
  338. console.error('获取检修类型字典失败:', e.message)
  339. }
  340. }
  341. // Helper function to safely extract properties from item
  342. function getPropertyValue(item: any | null, propertyName: string): string {
  343. if (item == null) return ''
  344. const itemObj = item as UTSJSONObject
  345. const value = itemObj[propertyName]
  346. return value != null ? '' + value : ''
  347. }
  348. // 获取工单类型文本
  349. function getWorkOrderTypeText(orderType: string | null): string {
  350. if (orderType != null) {
  351. if (orderType == "1") {
  352. return "维修工单"
  353. } else if (orderType == "2") {
  354. return "维保工单"
  355. }
  356. }
  357. return ""
  358. }
  359. // 获取工单类型相关信息(维保类型或检修类型)
  360. function getWorkOrderTypeInfo(item: any | null): string {
  361. if (item == null) return ''
  362. const orderType = getPropertyValue(item, 'orderType')
  363. // 维保工单显示维保类型
  364. if (orderType == "2") {
  365. const inspectionType = getPropertyValue(item, 'inspectionType')
  366. if (inspectionType != null && inspectionType != '') {
  367. // 如果字典尚未加载,返回原始值
  368. if (inspectionTypeDictList.value.length == 0) {
  369. return inspectionType
  370. }
  371. // 查找字典中对应的标签
  372. const dictItem = inspectionTypeDictList.value.find(dict => dict.dictValue == inspectionType)
  373. return (dictItem != null ? dictItem.dictLabel : inspectionType) as string
  374. }
  375. }
  376. // 维修工单显示检修类型
  377. else if (orderType == "1") {
  378. const maintenanceType = getPropertyValue(item, 'maintenanceType')
  379. if (maintenanceType != null && maintenanceType != '') {
  380. // 如果字典尚未加载,返回原始值
  381. if (maintenanceTypeDictList.value.length == 0) {
  382. return maintenanceType
  383. }
  384. // 查找字典中对应的标签
  385. const dictItem = maintenanceTypeDictList.value.find(dict => dict.dictValue == maintenanceType)
  386. return (dictItem != null ? dictItem.dictLabel : maintenanceType) as string
  387. }
  388. }
  389. return ""
  390. }
  391. // 获取工单状态文本
  392. function getScoringStatus(item: any | null): string | null {
  393. if (item == null) return ''
  394. const rawStatus = getPropertyValue(item, 'scoringStatus')
  395. if (rawStatus == null || rawStatus == '') return ''
  396. // 如果字典尚未加载,返回原始值
  397. if (!dictLoaded.value) {
  398. return rawStatus
  399. }
  400. // 查找字典中对应的标签
  401. const dictItem = statusDictList.value.find(dict => dict.dictValue == rawStatus)
  402. return dictItem != null ? dictItem.dictLabel : rawStatus
  403. }
  404. // 获取工单评分状态文本
  405. function getOrderStatusText(status: string | null): string {
  406. const statusMap: UTSJSONObject = {
  407. '1': '待自评',
  408. '2': '待复评',
  409. '3': '待确认',
  410. '4': '待终评'
  411. }
  412. if (status == null) return ''
  413. const result = statusMap[status]
  414. return result != null ? result as string : '未知状态'
  415. }
  416. // 获取统计数据
  417. function getStatistics() {
  418. // Convert 'current' and 'prev' values to actual date strings
  419. let monthValue = '';
  420. if (selectedMonth.value === 'custom') {
  421. monthValue = customDate.value;
  422. } else if (selectedMonth.value === 'current') {
  423. const now = new Date();
  424. monthValue = `${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, '0')}`;
  425. } else if (selectedMonth.value === 'prev') {
  426. const now = new Date();
  427. const prevMonth = now.getMonth(); // getMonth() returns 0-11
  428. const prevYear = prevMonth === 0 ? now.getFullYear() - 1 : now.getFullYear();
  429. const monthStr = prevMonth === 0 ? '12' : prevMonth.toString().padStart(2, '0');
  430. monthValue = `${prevYear}-${monthStr}`;
  431. }
  432. const params: UTSJSONObject = {
  433. //scoringStatus: statusFilter.value,
  434. month: monthValue
  435. }
  436. getOrderScoreStatistics(params).then((response: any) => {
  437. const resultObj = response as UTSJSONObject
  438. const responseData = resultObj['data'] as UTSJSONObject
  439. if (responseData != null) {
  440. totalScore.value = (responseData['totalScore'] != null) ? parseFloat((responseData['totalScore'] as number).toFixed(2)) : 0
  441. maintenanceScore.value = (responseData['maintenanceScore'] != null) ? parseFloat((responseData['maintenanceScore'] as number).toFixed(2)) : 0
  442. repairScore.value = (responseData['repairScore'] != null) ? parseFloat((responseData['repairScore'] as number).toFixed(2)) : 0
  443. rank.value = (responseData['rank'] != null) ? responseData['rank'] as number : null
  444. totalRankingUsers.value = (responseData['totalRankingUsers'] != null) ? responseData['totalRankingUsers'] as number : null
  445. } else {
  446. totalScore.value = 0
  447. maintenanceScore.value = 0
  448. repairScore.value = 0
  449. rank.value = null
  450. totalRankingUsers.value = null
  451. }
  452. })
  453. }
  454. function onDateConfirm(value: string) {
  455. customDate.value = value
  456. showDatePicker.value = false
  457. showDatePickerPopup.value = false
  458. selectedMonth.value = 'custom'
  459. getStatistics()
  460. }
  461. // 方法
  462. function loadData(isRefresh: boolean) {
  463. const shouldRefresh = isRefresh
  464. if (loading.value && !shouldRefresh) {
  465. return
  466. }
  467. loading.value = true
  468. if (shouldRefresh) {
  469. currentPage.value = 1
  470. refreshing.value = true
  471. }
  472. // Convert 'current' and 'prev' values to actual date strings
  473. let monthValue = '';
  474. if (selectedMonth.value === 'custom') {
  475. monthValue = customDate.value;
  476. } else if (selectedMonth.value === 'current') {
  477. const now = new Date();
  478. const m = now.getMonth() + 1
  479. let mStr = m.toString()
  480. if (m < 10) {
  481. mStr = '0' + mStr
  482. }
  483. monthValue = `${now.getFullYear()}-${mStr}`;
  484. } else if (selectedMonth.value === 'prev') {
  485. const now = new Date();
  486. const prevMonth = now.getMonth(); // getMonth() returns 0-11
  487. const prevYear = prevMonth === 0 ? now.getFullYear() - 1 : now.getFullYear();
  488. let monthStr = prevMonth === 0 ? '12' : prevMonth.toString()
  489. if (prevMonth !== 0 && prevMonth < 10) {
  490. monthStr = '0' + monthStr
  491. }
  492. monthValue = `${prevYear}-${monthStr}`;
  493. }
  494. const params: UTSJSONObject = {
  495. pageNum: currentPage.value,
  496. pageSize: 10,
  497. keyword: searchKeyword.value,
  498. scoringStatus: 'to_self,to_re,to_confirm,to_final',
  499. month: monthValue
  500. }
  501. listMyRate(params).then((response: any) => {
  502. // 提取响应数据
  503. const resultObj = response as UTSJSONObject
  504. console.log('API响应数据:', resultObj)
  505. const responseData = resultObj['rows'] as any[]
  506. const responseTotal = resultObj['total'] as number
  507. if (shouldRefresh) {
  508. orderList.value = Array.isArray(responseData) ? responseData : []
  509. } else {
  510. const currentRows = Array.isArray(responseData) ? responseData : []
  511. orderList.value = [...orderList.value, ...currentRows]
  512. }
  513. hasMore.value = orderList.value.length < responseTotal
  514. loading.value = false
  515. refreshing.value = false
  516. }).catch(() => {
  517. loading.value = false
  518. refreshing.value = false
  519. })
  520. }
  521. function handleSearch() {
  522. loadData(true)
  523. }
  524. function clearSearch() {
  525. searchKeyword.value = ""
  526. loadData(true)
  527. }
  528. function filterByStatus(status: string) {
  529. statusFilter.value = status
  530. loadData(true)
  531. getStatistics()
  532. }
  533. function changeMonth(month: string) {
  534. selectedMonth.value = month
  535. //loadData(true)
  536. getStatistics()
  537. }
  538. function loadMore() {
  539. if (!hasMore.value || loading.value) return
  540. currentPage.value++
  541. loadData(false)
  542. }
  543. function handleRefresh() {
  544. loadData(true)
  545. }
  546. // 点击列表项
  547. function handleItemClick(item: any | null, index: number): void {
  548. if (item == null) return
  549. const itemObj = item as UTSJSONObject
  550. const id = itemObj.get('id')
  551. const orderType = itemObj.get('orderType')
  552. if (id != null && orderType != null) {
  553. // 转换为字符串
  554. const idStr = '' + id
  555. const orderTypeStr = '' + orderType
  556. uni.navigateTo({
  557. url: `/pages/score/detail/index?id=${idStr}&orderType=${orderTypeStr}`
  558. })
  559. }
  560. }
  561. function formatNumber(value: number | null) {
  562. if (value === null) return '0.0'
  563. return value.toFixed(2)
  564. }
  565. // 获取工单评分状态样式类
  566. function getStatusClass(item: any | null): string {
  567. if (item == null) return ''
  568. const rawStatus = getPropertyValue(item, 'scoringStatus')
  569. if (rawStatus == null || rawStatus == '') return ''
  570. return `status-${rawStatus}`
  571. }
  572. function formatDate(dateString: string) {
  573. if (dateString == '' || dateString == null) return ''
  574. const date = new Date(dateString)
  575. const year = date.getFullYear()
  576. const month = (date.getMonth() + 1).toString().padStart(2, '0')
  577. const day = date.getDate().toString().padStart(2, '0')
  578. const hours = date.getHours().toString().padStart(2, '0')
  579. const minutes = date.getMinutes().toString().padStart(2, '0')
  580. return `${year}-${month}-${day} ${hours}:${minutes}`
  581. }
  582. // 生命周期
  583. onMounted(() => {
  584. loadStatusDictList()
  585. loadInspectionTypeDictList()
  586. loadMaintenanceTypeDictList()
  587. loadData(false)
  588. getStatistics()
  589. dictLoaded.value = true
  590. })
  591. </script>
  592. <style lang="scss">
  593. .list-page {
  594. flex: 1;
  595. background-color: #e8f0f9;
  596. // padding-bottom: 150rpx; // 为底部 TabBar 留出空间
  597. }
  598. /* 搜索栏样式 */
  599. .search-bar {
  600. padding: 20rpx 30rpx;
  601. background-color: #d7eafe;
  602. }
  603. .search-box {
  604. flex-direction: row;
  605. align-items: center;
  606. height: 72rpx;
  607. padding: 0 24rpx;
  608. background-color: #f5f5f5;
  609. border-radius: 36rpx;
  610. .search-icon {
  611. width: 32rpx;
  612. height: 32rpx;
  613. margin-right: 12rpx;
  614. }
  615. .search-input {
  616. flex: 1;
  617. font-size: 28rpx;
  618. color: #333333;
  619. }
  620. .clear-icon {
  621. margin-left: 12rpx;
  622. font-size: 28rpx;
  623. color: #999999;
  624. }
  625. }
  626. /* 工单状态筛选 */
  627. .status-bar {
  628. padding-bottom: 10px;
  629. padding-left: 30rpx;
  630. background-color: #d7eafe;
  631. }
  632. .status-box {
  633. flex-direction: row;
  634. align-items: center;
  635. height: 72rpx;
  636. flex: 1;
  637. .status-txt {
  638. padding: 8px 12px;
  639. text-align: center;
  640. margin-right: 12rpx;
  641. border-radius: 36rpx;
  642. background-color: #fff;
  643. font-size: 28rpx;
  644. }
  645. .stauts-sel {
  646. background-color: #007AFF;
  647. color: #fff;
  648. }
  649. }
  650. /* 工分统计 */
  651. .stats-section {
  652. margin: 15rpx 30rpx;
  653. background-color: #ffffff;
  654. border-radius: 16rpx;
  655. padding: 20rpx;
  656. }
  657. .stats-header {
  658. flex-direction: row;
  659. justify-content: space-between;
  660. align-items: center;
  661. margin-bottom: 20rpx;
  662. }
  663. .stats-title {
  664. font-size: 32rpx;
  665. font-weight: bold;
  666. flex: 1;
  667. }
  668. .month-filters {
  669. flex-direction: row;
  670. justify-content: flex-end;
  671. }
  672. .month-filter {
  673. padding: 6rpx 16rpx;
  674. margin-left: 12rpx;
  675. font-size: 24rpx;
  676. border-radius: 24rpx;
  677. background-color: #f2f3f5;
  678. color: #666;
  679. white-space: nowrap;
  680. }
  681. .month-filter-sel {
  682. background-color: #165dff;
  683. color: white;
  684. }
  685. .stats-content {
  686. margin-top: 20rpx;
  687. flex-direction: column;
  688. }
  689. .total-score {
  690. margin-bottom: 30rpx;
  691. flex-direction: column;
  692. align-items: center;
  693. }
  694. .score-label {
  695. font-size: 28rpx;
  696. color: #666;
  697. display: flex;
  698. margin-bottom: 8rpx;
  699. }
  700. .score-value {
  701. display: flex;
  702. font-size: 48rpx;
  703. font-weight: bold;
  704. color: #165dff;
  705. line-height: 1.2;
  706. }
  707. .score-breakdown {
  708. flex-direction: row;
  709. justify-content: space-between;
  710. }
  711. .breakdown-item {
  712. flex: 1;
  713. flex-direction: column;
  714. align-items: center;
  715. }
  716. .breakdown-label {
  717. display: flex;
  718. font-size: 32rpx;
  719. font-weight: bold;
  720. color: #333;
  721. line-height: 1.4;
  722. }
  723. .breakdown-value {
  724. font-size: 28rpx;
  725. color: #666;
  726. display: flex;
  727. margin-bottom: 8rpx;
  728. }
  729. /* 列表项样式 */
  730. .list-item {
  731. margin: 12rpx 30rpx;
  732. background-color: #ffffff;
  733. border-radius: 16rpx;
  734. }
  735. .item-container {
  736. padding: 30rpx;
  737. }
  738. .item-header {
  739. flex-direction: row;
  740. align-items: flex-start;
  741. margin-bottom: 16rpx;
  742. .item-title {
  743. font-size: 30rpx;
  744. color: #333333;
  745. font-weight: bold;
  746. flex-wrap: wrap;
  747. flex: 0 1 70%;
  748. min-width: 0;
  749. }
  750. .info-value {
  751. font-size: 28rpx;
  752. color: #999999;
  753. margin-left: auto;
  754. flex: 0 0 auto;
  755. white-space: nowrap;
  756. }
  757. }
  758. .info-row {
  759. flex-direction: row;
  760. justify-content: space-between;
  761. align-items: center;
  762. .info-label {
  763. font-size: 26rpx;
  764. color: #666;
  765. }
  766. .info-value-row {
  767. flex-direction: row;
  768. align-items: center;
  769. }
  770. .score-text {
  771. font-size: 28rpx;
  772. color: #ff9900;
  773. font-weight: bold;
  774. margin-right: 20rpx;
  775. }
  776. .status-text {
  777. font-size: 24rpx;
  778. padding: 4rpx 12rpx;
  779. border-radius: 24rpx;
  780. background-color: #f2f3f5;
  781. color: #666;
  782. }
  783. }
  784. .text-gray{
  785. font-size: 26rpx;
  786. color: #666;
  787. }
  788. /* 日期选择弹窗 */
  789. .date-picker-popup {
  790. background-color: white;
  791. border-top-left-radius: 30rpx;
  792. border-top-right-radius: 30rpx;
  793. padding: 40rpx;
  794. padding-bottom: 40rpx;
  795. margin-bottom: 150rpx; /* 提高弹窗,避免被底部导航栏遮挡 */
  796. }
  797. .popup-header {
  798. display: flex;
  799. justify-content: space-between;
  800. align-items: center;
  801. margin-bottom: 40rpx;
  802. }
  803. .popup-title {
  804. font-size: 34rpx;
  805. font-weight: bold;
  806. }
  807. .popup-actions {
  808. display: flex;
  809. flex-direction: row;
  810. }
  811. .cancel-btn {
  812. color: #999;
  813. padding: 10rpx 20rpx;
  814. }
  815. .confirm-btn {
  816. color: #165dff;
  817. padding: 10rpx 20rpx;
  818. font-weight: bold;
  819. }
  820. .date-picker-container {
  821. padding: 20rpx 0;
  822. padding-bottom: env(safe-area-inset-bottom); // 适配安全区域
  823. }
  824. .date-picker-item {
  825. margin-bottom: 40rpx;
  826. }
  827. .date-label {
  828. display: flex;
  829. margin-bottom: 20rpx;
  830. font-size: 30rpx;
  831. color: #333;
  832. }
  833. .date-display {
  834. width: 100%;
  835. padding: 20rpx;
  836. border: 2rpx solid #ddd;
  837. border-radius: 8rpx;
  838. font-size: 32rpx;
  839. color: #333;
  840. }
  841. // 添加底部填充的类
  842. .list-with-padding {
  843. padding-bottom: 40rpx;
  844. }
  845. /* 工单评分状态标签样式 */
  846. .status-tag {
  847. padding: 8rpx 20rpx;
  848. border-radius: 20rpx;
  849. font-size: 24rpx;
  850. white-space: nowrap;
  851. margin-left: 70rpx;
  852. border: 1rpx solid;
  853. }
  854. /* 待自评 */
  855. .status-to_self {
  856. background-color: #fff7e6;
  857. color: #fa8c16;
  858. border-color: #ffd591;
  859. }
  860. /* 待复评 */
  861. .status-to_re {
  862. background-color: #ebf5ff;
  863. color: #409eff;
  864. border-color: #d8ebff;
  865. }
  866. /* 待确认 */
  867. .status-to_confirm {
  868. background-color: #f0f9eb;
  869. color: #5cb87a;
  870. border-color: #c2e7b0;
  871. }
  872. /* 待终评 */
  873. .status-to_final {
  874. background-color: #ebf5ff;
  875. color: #409eff;
  876. border-color: #d8ebff;
  877. }
  878. /* 待归档 */
  879. .status-to_archive {
  880. background-color: #f0f9eb;
  881. color: #5cb87a;
  882. border-color: #c2e7b0;
  883. }
  884. /* 已归档 */
  885. .status-archived {
  886. background-color: #f0f9eb;
  887. color: #5cb87a;
  888. border-color: #c2e7b0;
  889. }
  890. </style>