pending.uvue 28 KB

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