| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022 |
- <template>
- <uni-navbar-lite :showLeft=false title="首页"></uni-navbar-lite>
- <view class="page-container">
- <!-- 背景图 -->
- <!-- <image class="bg-image" src="/static/images/index/1.png" mode="widthFix"></image> -->
- <!-- <view class="bg-color"></view> -->
- <scroll-view class="page-content">
- <view class="db-view">
- <view class="db-box" @click="navigateToOverdueOrders" v-if="checkPermi(['gxt:app:overdue'])" >
- <view v-if="overdueCount > 0" class="badge"><text class="count">{{ overdueCount }}</text></view>
- <view class="db-block">
- <view class="db-center-3">
- <image class="db-image" src="/static/images/map/2.png"></image>
- </view>
- </view>
- <text class="db-text">超时工单</text>
- </view>
- <view class="db-box" @click="navigateToAssignedOrders">
- <view v-if="assignedCount > 0" class="badge"><text class="count">{{ assignedCount }}</text></view>
- <view class="db-block">
- <view class="db-center-1">
- <image class="db-image" src="/static/images/map/1.png"></image>
- </view>
- </view>
- <text class="db-text">待处理工单</text>
- </view>
- <view class="db-box" @click="navigateToScoreOrders" v-if="checkPermi(['gxt:app:toScore'])">
- <view v-if="selfScoreCount > 0" class="badge"><text class="count">{{ selfScoreCount }}</text></view>
- <view class="db-block">
- <view class="db-center-2">
- <image class="db-image" src="/static/images/map/2.png"></image>
- </view>
- </view>
- <text class="db-text">待评分工单</text>
- </view>
- <view class="db-box" @click="navigateToSuspendedOrders" v-if="checkPermi(['gxt:app:toResume'])">
- <view v-if="suspendedCount > 0" class="badge"><text class="count">{{ suspendedCount }}</text></view>
- <view class="db-block">
- <view class="db-center-1">
- <image class="db-image" src="/static/images/map/2.png"></image>
- </view>
- </view>
- <text class="db-text">已挂起工单</text>
- </view>
- <view class="db-box" @click="navigateToApproveOrders" v-if="checkPermi(['gxt:app:toApprove'])">
- <view v-if="approveCount > 0" class="badge"><text class="count">{{ approveCount }}</text></view>
- <view class="db-block">
- <view class="db-center-2">
- <image class="db-image" src="/static/images/map/1.png"></image>
- </view>
- </view>
- <text class="db-text">待审批工单</text>
- </view>
- </view>
- <!-- <view>
- <button @click="handlePush">通知</button>
- </view> -->
- <!-- 即将超时工单列表 -->
- <!-- <view class="section-title-container" v-if="almostOverdueListData.length > 0">
- <view class="section-header">
- <text class="section-title">即将超时工单</text>
- <text class="view-all" @click="navigateToAlmostOverdueOrders">查看全部</text>
- </view>
- </view>
- <common-list
- v-if="almostOverdueListData.length > 0"
- :dataList="almostOverdueListData.slice(0, 2)"
- :loading="almostOverdueLoading"
- :hasMore="false"
- :refresherEnabled="false"
- :itemKey="'id'"
- @itemClick="handleAlmostOverdueItemClick"
- >
- <template #default="{ item }">
- <view class="list-item">
- <view class="item-container">
- <view class="item-header">
- <text class="item-title">{{ getPcsDeviceName(item) }}-{{ getStationName(item) }}</text>
- </view>
- <view class="info-row">
- <text class="text-gray">工单编码:{{ getWorkOrderProjectNo(item) }}</text>
- <text class="text-gray" :class="getRemarkClass(item)">{{ getRemark(item) }}</text>
- </view>
- </view>
- </view>
- </template>
- <template #loadMore>
- <view></view>
- </template>
- </common-list> -->
- <!-- 超时工单列表 -->
- <view class="section-title-container">
- <view class="section-header">
- <text class="section-title">超时工单</text>
- <text class="view-all" @click="navigateToOverdueOrders" v-if="overdueListData.length > 0">查看全部</text>
- </view>
- </view>
- <template v-if="overdueListData.length > 0">
- <common-list
- :dataList="overdueListData.slice(0, 4)"
- :loading="overdueLoading"
- :hasMore="false"
- :refresherEnabled="false"
- :itemKey="'id'"
- @itemClick="handleOverdueItemClick"
- >
- <template #default="{ item }">
- <view class="list-item">
- <view class="item-container">
- <view class="item-header">
- <text class="item-title">{{ getPcsDeviceName(item) }}-{{ getStationName(item) }}</text>
- <!-- <text class="status-tag status-suspended">{{ getWorkOrderStatus(item) }}</text> -->
- </view>
- <view class="info-row">
- <text class="text-gray">工单编码:{{ getWorkOrderProjectNo(item) }}</text>
- <!-- <text class="text-gray overdue-title">{{ getRemark(item) }}</text> -->
- </view>
- <view class="info-row">
- <text class="overdue-title">{{ getRemark(item) }}</text>
- </view>
- </view>
- </view>
- </template>
- <template #loadMore>
- <view></view>
- </template>
- </common-list>
- </template>
- <template v-else>
- <view class="empty-tips">
- <text class="empty-text">暂无超时工单</text>
- </view>
- </template>
- </scroll-view>
- <!-- 底部 TabBar -->
- <custom-tabbar :current="0" :hide0="tabbar[0]" :hide1="tabbar[1]" :hide2="tabbar[2]" :hide3="tabbar[3]"/>
- </view>
- </template>
- <script setup lang="uts">
- import { ref, onMounted, reactive, onLoad, onShow, nextTick } from 'vue'
- import { getUserInfo,checkPermi } from '../../utils/storage'
- import FlowChart from '../../components/index/flow-chart/flow-chart.uvue'
- import { getOrderList, almostOverdueList, overdueList, pendingList } from '../../api/order/list'
- import { listMyRate } from '../../api/score/index'
- import type { SysDictData } from '../../types/dict'
- import { getDictDataByType } from '../../api/dict/index'
- // import {startKeepAlive,stopKeepAlive} from '@/uni_modules/ygtx-keepService'
- // import { RequestOption } from '@/uni_modules/ygtx-keepService/utssdk/interface.uts';
- import { getBaseUrl } from '../../utils/request'
- import { KeepLive } from '@/uni_modules/android-keeplive'
- import { getMyNotify, registerServer} from '../../api/index/index'
- // const handleStartKeepAlive = (userId: string) => {
- // let notifyUrl = getBaseUrl() + "/mobile/notify";
- // console.log("通知地址:" + notifyUrl)
- // const requestOption:RequestOption = {
- // requestUrl: notifyUrl, // 你的接口地址(必填)
- // requestData: JSON.stringify({ method: "get", data: userId }), // 请求数据(字符串格式,必填)
- // task_interval: 10000 // 任务间隔(毫秒,必填)
- // };
- // startKeepAlive(requestOption,
- // (res:any)=>{
- // console.log(res)
- // });
- // };
- const tabbar = reactive([1,1,1,1])
- // 用户名
- const userName = ref<string>('用户')
- // 待接单数量
- const assignedCount = ref<number>(0)
- // 待自评工单数量
- const selfScoreCount = ref<number>(0)
- // 超时工单数量
- const overdueCount = ref<number>(0)
- // 已挂起工单数量
- const suspendedCount = ref<number>(0)
- // 待审批工单数量
- const approveCount = ref<number>(0)
- // 即将超时工单列表
- const almostOverdueListData = ref<any[]>([])
- const almostOverdueLoading = ref<boolean>(false)
- // 超时工单列表
- const overdueListData = ref<any[]>([])
- const overdueLoading = ref<boolean>(false)
- // 维保类型字典列表
- const inspectionTypeList = ref<SysDictData[]>([])
- // 添加字典加载状态
- const dictLoaded = ref<boolean>(false)
- // 获取工单状态字典列表
- const loadStatusDictList = async (): Promise<void> => {
- try {
- const result = await getDictDataByType('gxt_inspection_type')
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const data = resultObj['data'] as any[]
- const dictData: SysDictData[] = []
- if (data.length > 0) {
- for (let i = 0; i < data.length; i++) {
- const item = data[i] as UTSJSONObject
- // 只提取需要的字段
- const dictItem: SysDictData = {
- dictValue: item['dictValue'] as string | null,
- dictLabel: item['dictLabel'] as string | null,
- dictCode: null,
- dictSort: null,
- dictType: null,
- cssClass: null,
- listClass: null,
- isDefault: null,
- status: null,
- default: null,
- createTime: null,
- remark: null
- }
- dictData.push(dictItem)
- }
- }
- inspectionTypeList.value = dictData
- dictLoaded.value = true
- }
- } catch (e: any) {
- console.error('获取工单状态字典失败:', e.message)
- dictLoaded.value = true
- }
- }
- // 获取待接单数量
- const loadAssignedCount = async (): Promise<void> => {
- try {
- const result = await pendingList(1, 1, null)
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const total = resultObj['total'] as number
- assignedCount.value = total
- }
- } catch (e: any) {
- console.error('获取待处理工单数量失败:', e.message)
- }
- }
- // 获取待自评工单数量
- const loadSelfScoreCount = async (): Promise<void> => {
- try {
- const params: UTSJSONObject = {
- pageNum: 1,
- pageSize: 1,
- scoringStatus: 'to_self,to_re,to_confirm,to_final'
- }
- const result = await listMyRate(params)
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const total = resultObj['total'] as number
- selfScoreCount.value = total
- }
- } catch (e: any) {
- console.error('获取待自评工单数量失败:', e.message)
- }
- }
- // 获取超时工单数量
- const loadOverdueCount = async (): Promise<void> => {
- try {
- const result = await overdueList(1, 1, '') // 只需要获取总数,不需要具体数据
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const total = resultObj['total'] as number
- overdueCount.value = total
- }
- } catch (e: any) {
- console.error('获取超时工单数量失败:', e.message)
- }
- }
- // 获取已挂起工单数量
- const loadSuspendedCount = async (): Promise<void> => {
- try {
- const result = await getOrderList(1, 1, '', "suspended,auto_suspend") // 只需要获取总数,不需要具体数据
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const total = resultObj['total'] as number
- suspendedCount.value = total
- }
- } catch (e: any) {
- console.error('获取已挂起工单数量失败:', e.message)
- }
- }
- // 获取已挂起工单数量
- const loadApproveCount = async (): Promise<void> => {
- try {
- const result = await getOrderList(1, 1, '', "to_approve") // 只需要获取总数,不需要具体数据
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const total = resultObj['total'] as number
- approveCount.value = total
- }
- } catch (e: any) {
- console.error('获取待审批工单数量失败:', e.message)
- }
- }
- // 获取即将超时工单列表
- const loadAlmostOverdueList = async (): Promise<void> => {
- try {
- almostOverdueLoading.value = true
- const result = await almostOverdueList(1, 2, '') // 获取前2条
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const rows = resultObj['rows'] as any[]
- almostOverdueListData.value = rows
- }
- } catch (e: any) {
- console.error('获取即将超时工单列表失败:', e.message)
- } finally {
- almostOverdueLoading.value = false
- }
- }
- // 获取超时工单列表
- const loadOverdueList = async (): Promise<void> => {
- try {
- overdueLoading.value = true
- const result = await overdueList(1, 4, '') // 获取前2条
- const resultObj = result as UTSJSONObject
- if (resultObj['code'] == 200) {
- const data = resultObj['rows'] as any[]
- overdueListData.value = data
- }
- } catch (e: any) {
- console.error('获取超时工单列表失败:', e.message)
- } finally {
- overdueLoading.value = false
- }
- }
- // 跳转到待接单列表
- const navigateToAssignedOrders = (): void => {
- // 使用 redirectTo 而不是 switchTab,因为工单页面不是 tabBar 页面
- // uni.redirectTo({
- // url: '/pages/order/index?isDeal=1'
- // })
- // 跳转到待处理工单页面
- uni.navigateTo({
- url: '/pages/order/pendingOrder'
- })
- // // 延迟设置状态,确保页面已加载
- // setTimeout(() => {
- // uni.$emit('switchOrderStatus', 'deal')
- // }, 500)
- }
- // 跳转到评分工单列表
- const navigateToScoreOrders = (): void => {
- // 跳转到待评分工单页面
- uni.navigateTo({
- url: '/pages/score/pending'
- })
- // uni.redirectTo({
- // url: '/pages/score/index'
- // })
- // 延迟设置状态,确保页面已加载
- // setTimeout(() => {
- // uni.$emit('switchScoreStatus', 'to_self')
- // }, 500)
- }
- // 跳转到超时工单列表
- const navigateToOverdueOrders = (): void => {
- // 跳转到超时工单页面
- uni.navigateTo({
- url: '/pages/order/overdue'
- })
- }
- // 跳转到即将超时工单列表
- const navigateToAlmostOverdueOrders = (): void => {
- // 跳转到即将超时工单页面
- uni.navigateTo({
- url: '/pages/order/almostOverdue'
- })
- }
- // 跳转到已挂起工单列表
- const navigateToSuspendedOrders = (): void => {
- // 跳转到超时工单页面
- uni.navigateTo({
- url: '/pages/order/suspendedOrder'
- })
- }
- // 跳转到已挂起工单列表
- const navigateToApproveOrders = (): void => {
- // 跳转到超时工单页面
- uni.navigateTo({
- url: '/pages/order/approveOrder'
- })
- }
- const getNofiyMes = (): void=>{
- const userInfo = getUserInfo()
- if (userInfo != null) {
- const userId = userInfo['userId']?.toString()
- if(userId!=null){
- getMyNotify(userId).then((result:any) => {
- const jsonData = JSON.stringify(result)
- const respData = JSON.parse(jsonData) as UTSJSONObject
- if (respData['code'] == 200 &&
- respData.hasOwnProperty('data') && respData['data'] != null) {
- const data = respData['data'] as UTSJSONObject
- const badge = data["num"] as number
- setTimeout(() => {
- console.log("============:" + badge)
- if(badge > -1){
- uni.setAppBadgeNumber(badge);
- }
- if(data.hasOwnProperty("title") && data["title"] != null
- && data.hasOwnProperty("desc") && data["desc"] != null){
- const title = data["title"] as string
- const desc = data["desc"] as string
- uni.createPushMessage({
- title: title,
- content: desc,
- when: Date.now() + 10000,
- icon: "/static/login/2.png",
- sound: "system",
- success: (res) => {
- console.log('创建推送消息成功', res);
- },
- fail: (err) => {
- console.error('创建推送消息失败', err);
- }
- });
- }
- }, 0);
- }
- }).catch((error) => {
- console.error('Promise 执行失败:', error)
- });
- }
- }
- }
- const handleKeepAlive = ()=>{
- var keep=new KeepLive()
- keep.setTitle("工效通")
- keep.setContent("工效通正在运行")
- // keep.setLargeIcon("icon");
- keep.setSmallIcon("icon"); //图标名字 图标放在 插件下面的 uni_modules\android-keeplive\utssdk\app-android\res 文件夹下
- keep.onAddBackgroundCallback(function(res:boolean){
- console.log("后台运行 "+res)
- })
- keep.onAddScrrenListenerCallback(function(res:boolean){
- console.log("屏幕开启状态 "+res)
- })
- keep.setWakeLock(1,"keeptag");// 设置唤醒类型
- keep.setAutoStartEnable(true)
- keep.doStartApplicationWithPackageName("uni.app.UNI1050C07");
- if(!keep.checkAppNotification()){
- keep.onOpenNotificationSetting(function(res:boolean){
- keep.register();
- var ignoring= keep.isIgnoringBatteryOptimizations();
- if(!ignoring){
- keep.requestIgnoreBatteryOptimizations();
- }
- })
- }else{
- keep.register();
- var ignoring= keep.isIgnoringBatteryOptimizations();
- if(!ignoring){
- keep.requestIgnoreBatteryOptimizations();
- }
- }
- // keep.wifilock();
- // 稳定定时器 需要的用户使用(默认定时器1 )
- const is_time = uni.getStorageSync("notify_key")
- console.log("检查定时器" + is_time)
- if(is_time == "0"){
- console.log("启动定时器")
- keep.onStartCSystemTimer(10,function(){
- const is_login = uni.getStorageSync("login_key")
- console.log("onStartCSystemTimer:" + is_login);
- getNofiyMes();
- if(is_login == '1'){
- // 加载待接单数量
- loadAssignedCount()
- // 加载待自评工单数量
- loadSelfScoreCount()
- // 加载超时工单数量
- loadOverdueCount()
- // 加载已挂起工单数量
- loadSuspendedCount()
- // 加载待审批工单数量
- loadApproveCount()
- // 超时工单列表
- loadOverdueList()
- }
- keep.acquire(1000);// 唤醒一秒钟
- });
- uni.setStorageSync("notify_key", "1")
- }
- }
- // 辅助函数:从 any 类型提取属性
- const getWorkOrderProjectNo = (item: any | null): string | null => {
- if (item == null) return ''
- const orderInfoItem = item as UTSJSONObject
- return orderInfoItem['workOrderProjectNo'] as string != null ? orderInfoItem['workOrderProjectNo'] as string : ''
- }
- const getPcsDeviceName = (item: any | null): string | null=> {
- if (item == null) return ''
- const orderInfoItem = item as UTSJSONObject
- return orderInfoItem['pcsDeviceName'] as string != null ? orderInfoItem['pcsDeviceName'] as string : ''
- }
- const getStationName = (item: any | null): string | null=> {
- if (item == null) return ''
- const orderInfoItem = item as UTSJSONObject
- return orderInfoItem['pcsStationName'] as string != null ? orderInfoItem['pcsStationName'] as string : ''
- }
- const getCreateTime = (item: any | null): string|null => {
- if (item == null) return null
- const orderInfoItem = item as UTSJSONObject
- return orderInfoItem['createTime'] as string != null ? orderInfoItem['createTime'] as string : ''
- }
- const getRemark = (item: any | null): string|null => {
- if (item == null) return null
- const orderInfoItem = item as UTSJSONObject
- return orderInfoItem['remark'] as string != null ? orderInfoItem['remark'] as string : ''
- }
- // 根据剩余时间获取颜色类名
- const getRemarkClass = (item: any | null): string => {
- if (item == null) return ''
- const orderInfoItem = item as UTSJSONObject
- const remark = orderInfoItem['remark'] as string
- if (remark == null || remark.length === 0) return ''
- // 解析备注中的剩余时间(假设格式为包含数字和小时的字符串)
- // 例如:"剩余时间:5小时" 或 "还剩10小时"
- const timeMatch = remark.match(/(\d+(\.\d+)?)\s*(小时|时)/)
- if (timeMatch != null && timeMatch.length > 1 && timeMatch[1] != null) {
- const hours = parseFloat(timeMatch[1] as string)
- if (hours < 6) {
- return 'time-critical' // 红色
- } else if (hours < 12) {
- return 'time-warning' // 橙色
- } else if (hours < 24) {
- return 'time-notice' // 黄色
- }
- }
- return ''
- }
- // 辅助函数:从 any 类型提取属性
- const getOrderType = (item: any | null): string => {
- if (item == null) return ''
- const orderInfoItem = item as UTSJSONObject
- return orderInfoItem['orderType'] == 1?"维修工单":"维保工单";
- }
- const getInspectionType = (item: any | null): string | null => {
- if (item == null) return ''
- const orderInfoItem = item as UTSJSONObject
- const rawStatus = orderInfoItem['inspectionType']
- if (rawStatus==null) return ''
- // 如果字典尚未加载,返回原始值
- if (!dictLoaded.value) {
- return rawStatus
- }
- // 查找字典中对应的标签
- const dictItem = inspectionTypeList.value.find(dict => dict.dictValue == rawStatus)
- return dictItem!=null ? dictItem.dictLabel : rawStatus
- }
- // 即将超时工单点击事件
- const handleAlmostOverdueItemClick = (item: any, index: number): void => {
- if (item == null) return
- const orderItem = item as UTSJSONObject
- try {
- // 跳转到工单详情页
- uni.navigateTo({
- url: `/pages/order/detail/index?id=${orderItem['id']}&orderType=${orderItem['orderType']}`
- })
- } catch (e) {
- console.error('处理即将超时工单点击事件失败:', e)
- }
- }
- // 超时工单点击事件
- const handleOverdueItemClick = (item: any, index: number): void => {
- if (item == null) return
- const orderItem = item as UTSJSONObject
- try {
- // 跳转到工单详情页
- uni.navigateTo({
- url: `/pages/order/detail/acceptIndex?id=${orderItem.id}&orderType=${orderItem.orderType}`
- })
- } catch (e) {
- console.error('处理超时工单点击事件失败:', e)
- }
- }
- const registerPush =() =>{
- console.log("获取CID")
- uni.getPushClientId({
- success: (res) => {
- console.log(res.cid);
- registerServer(res.cid).then((result:any) => {
- console.log("注册成功");
- });
- },
- fail(err) {
- console.log(err)
- }
- })
- }
- onShow(() => {
- // 重新加载所有计数
- loadAssignedCount()
- loadSelfScoreCount()
- loadOverdueCount()
- loadSuspendedCount()
- loadApproveCount()
- loadOverdueList()
- // 修复:使用从vue导入的nextTick,移除document操作
- nextTick(() => {
- // uts中无需手动操作DOM,nextTick已确保数据更新后DOM完成渲染
- console.log('数据更新完成,DOM已重新渲染')
- })
- })
- // 初始化
- //onMounted(() => {
- onLoad((options: any) => {
- // 检查权限设置tabbar
- tabbar[2] = checkPermi(['gxt:app:worktime']) ? 1 : 0
- tabbar[3] = checkPermi(['gxt:app:score']) ? 1 : 0
- const userInfo = getUserInfo()
- if (userInfo != null) {
- const realName = userInfo['nickName'] as string | null
- userName.value = realName ?? '用户'
- const userId = userInfo['userId']?.toString()
- if(userId!=null){
- console.log("监听:"+userId)
- handleKeepAlive()
- registerPush();
- }
- }
- // 加载待接单数量
- loadAssignedCount()
- // 加载待自评工单数量
- loadSelfScoreCount()
- // 加载超时工单数量
- loadOverdueCount()
- // 加载已挂起工单数量
- loadSuspendedCount()
- // 加载待审批工单数量
- loadApproveCount()
- // 加载即将超时工单列表
- // loadAlmostOverdueList()
- // 加载超时工单列表
- loadOverdueList()
- // 监听工单状态更新事件
- uni.$on('refreshAssignedCount', () => {
- loadAssignedCount()
- })
- // 监听评分工单状态更新事件
- uni.$on('refreshSelfScoreCount', () => {
- loadSelfScoreCount()
- })
- // 监听超时工单状态更新事件
- uni.$on('refreshOverdueCount', () => {
- loadOverdueCount()
- })
- // 监听接单成功的事件,刷新列表
- uni.$on('refreshOrderList', () => {
- loadOverdueList()
- })
- // 监听已挂起工单状态更新事件
- uni.$on('refreshSuspendedCount', () => {
- loadSuspendedCount()
- })
- // 监听待审批工单状态更新事件
- uni.$on('refreshApproveCount', () => {
- loadApproveCount()
- })
- })
- </script>
- <style lang="scss">
- .page-container {
- position: relative;
- flex: 1;
- // padding-top: env(safe-area-inset-top);
- background-color: #e8f0f9;
- z-index: 1; // 新增:基础层级
- }
- .bg-image {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 0;
- }
- .bg-color {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: -1;
- background: #71a6e4;
- }
- .page-content {
- position: relative;
- flex: 1;
- margin-top: 30rpx;
- margin-bottom: 150rpx;
- // padding: 20rpx;
- z-index: 2;
- }
- .header {
- flex-direction: row;
- height: 40px;
- &-title {
- font-size: 40rpx;
- color: #ffffff;
- font-weight: bold;
- margin-bottom: 15rpx;
- }
- &-greeting {
- font-size: 28rpx;
- color: rgba(255, 255, 255, 0.9);
- }
- }
- .section-title {
- font-size: 32rpx;
- color: #333333;
- font-weight: bold;
- // margin-bottom: 20rpx;
- }
- .section-title-container {
- // margin-top: 20rpx;
- padding: 20rpx 30rpx;
- }
- .section-header {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- }
- .view-all {
- font-size: 28rpx;
- color: #165dff;
- }
- /* 图表区域 */
- .chart-section {
- padding: 30rpx;
- margin-bottom: 20rpx;
- background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.9) 100%);
- box-shadow: 0 0 16rpx 0 rgba(0, 0, 0, 0.1);
- border-radius: 16rpx;
- }
- .db-view{
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: flex-start; // 或 space-around
- // justify-content: space-around; /* 自动分配间距,避免挤压 */
- align-items: center;
- padding: 0 20rpx; // 可选:避免贴边
- position: relative; // 新增
- z-index: 3; // 新增
- .db-box {
- background-color: #fff;
- width: 216rpx;
- // 删除固定宽高 ↓
- // max-width: 300rpx;
- // height: 200rpx;
- // flex: 1; // ✅ 关键:平均分空间
- display: flex;
- flex-direction: column; // 垂直排列:图标在上,文字在下
- justify-content: center;
- align-items: center;
- margin: 0 10rpx 20rpx 10rpx; // 左右间距(替代原来的 margin-left)
- border-radius: 5px;
- padding: 30rpx 10rpx; // 可选:增加内边距使内容不拥挤
- position: relative;
- // z-index: 10 !important;
- z-index: 4; // 提升卡片层级
- .db-text {
- margin-top: 16rpx; // 图标与文字间距
- font-size: 24rpx; // 建议用 rpx,10px 太小了
- color: #333;
- }
- .db-center-1,
- .db-center-2,
- .db-center-3 {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100rpx;
- height: 100rpx;
- border-radius: 50rpx;
- // position: relative;
- }
- .db-center-1 { background-color: #DBEAFE; }
- .db-center-2 { background-color: #DCFCE7; }
- .db-center-3 { background-color: #F3E8FF; }
- }
- .db-image{
- width:50rpx;
- height:50rpx;
- }
- }
- .badge {
- z-index: 9999 !important;
- position: absolute;
- top: 35rpx;
- right: 35rpx;
- background-color: #ff4d4f;
- border-radius: 40rpx !important;
- min-width: 40rpx;
- height: 40rpx;
- display: flex; // 启用 Flexbox 布局
- justify-content: center; // 水平居中
- align-items: center; // 垂直居中
- box-sizing: border-box; // 确保 padding 不影响整体尺寸
- padding: 0 12rpx;
- overflow: hidden;
- .count {
- // line-height: 40rpx;
- font-size: 26rpx;
- // text-align: center;
- color: #ffffff;
- }
- }
- .list-item {
- margin: 0 30rpx 24rpx 30rpx;
- background-color: #ffffff;
- border-radius: 16rpx;
- }
- .item-container {
- padding: 30rpx;
- }
- .item-header {
- flex-direction: row;
- align-items: center;
- margin-bottom: 16rpx;
- .item-title {
- flex: 1;
- font-size: 32rpx;
- color: #333333;
- font-weight: bold;
- }
- .detail-link {
- font-size: 28rpx;
- color: #999999;
- }
- }
- .btn-primary {
- font-size: 14px;
- background-color: #165DFF;
- color: #ffffff;
- }
- .info-row {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- .info-label {
- font-size: 26rpx;
- color: #666;
- }
- .info-value {
- font-size: 26rpx;
- }
- }
- .text-gray{
- font-size: 26rpx;
- color: #666;
- }
- /* 剩余时间颜色样式 */
- .time-critical {
- color: #ff4d4f; /* 红色 */
- }
- .time-warning {
- color: #fa8c16; /* 橙色 */
- }
- .time-notice {
- color: #faad14; /* 黄色 */
- }
- .status-tag {
- padding: 8rpx 20rpx;
- border-radius: 20rpx;
- font-size: 24rpx;
- white-space: nowrap;
- margin-left: 20rpx;
- border: 1rpx solid;
- }
- /* 已超时工单标题红色样式 */
- .overdue-title {
- margin-top: 16rpx;
- font-size: 26rpx;
- color: #ff4d4f;
- }
- /* 待接单 */
- .status-assigned {
- background-color: #ebf5ff;
- color: #409eff;
- border-color: #d8ebff;
- }
- /* 已挂起 */
- .status-suspended {
- background-color: #fff2f0;
- color: #ff4d4f;
- border-color: #ffccc7;
- }
- .empty-tips {
- padding: 30rpx;
- justify-content: center;
- align-items: center;
- .empty-text {
- font-size: 26rpx;
- color: #999999;
- }
- }
- </style>
|