| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040 |
- <template>
- <uni-navbar-lite :showLeft="true" title="设备清单"></uni-navbar-lite>
- <view class="list-page">
- <!-- 任务信息栏 -->
- <view class="task-info-bar" v-if="taskInfo.planName != null">
- <view class="task-info-item">
- <text class="task-info-label">任务:</text>
- <text class="task-info-value">{{ taskInfo.planName }}</text>
- </view>
- <view class="task-info-item" v-if="taskInfo.displayTime != null">
- <text class="task-info-label">时间:</text>
- <text class="task-info-value">{{ taskInfo.displayTime }}</text>
- </view>
- </view>
- <!-- 搜索栏 -->
- <!--<view class="search-bar">
- <view class="search-box">
- <image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
- <input class="search-input" type="text" placeholder="搜索设备" v-model="keyword" @confirm="handleSearch" @blur="handleSearch" />
- <text v-if="keyword.length > 0" class="clear-icon" @click="clearSearch">✕</text>
- </view>
- </view>-->
- <!-- 列表内容 -->
- <common-list
- :dataList="dataList"
- :loading="loading"
- :refreshing="refreshing"
- :hasMore="hasMore"
- @refresh="handleRefresh"
- @loadMore="loadMore"
- @itemClick="handleView"
- >
- <template #default="{ item, index }">
- <view class="list-item">
- <view class="item-container">
- <view class="item-header">
- <text class="item-title">{{ (item as DeviceCheckTaskDetail).machineryName }}</text>
- <view class="task-badges">
- <text class="status-tag" :class="getTaskStatusClass(item)">
- {{ getTaskStatusText((item as DeviceCheckTaskDetail).taskStatus) }}
- </text>
- </view>
- </view>
- <view class="info-row">
- <view class="info-label">
- <text class="text-gray">设备编号: {{ (item as DeviceCheckTaskDetail).machinerySpec }}</text>
- </view>
- </view>
- <view class="info-row">
- <view class="info-label">
- <text class="text-gray">位置: {{ (item as DeviceCheckTaskDetail).machineryLocation }}</text>
- </view>
- </view>
- <view class="btn-group">
- <!-- 显示扫描按钮的逻辑:如果设备未完成检查,且是第一个未检查的设备,则启用;否则禁用 -->
- <view
- v-if="(item as DeviceCheckTaskDetail).taskStatus == '0'"
- :class="['btn-primary', isFirstUncompletedTask(item) ? '' : 'btn-disabled']"
- @click.stop="isFirstUncompletedTask(item) ? handleItemClick(item,'scan') : null"
- >
- <!-- <text class="btn-text">扫描二维码</text> -->
- <text class="btn-text">开始检查</text>
- </view>
- <view
- v-else
- class="btn-primary"
- @click.stop="handleItemClick(item,'detail')"
- >
- <text class="btn-text">查看</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- </common-list>
- </view>
- </template>
- <script setup lang="uts">
- import { ref, onBeforeUnmount, onMounted, reactive } from 'vue'
- import { onLoad, onShow } from '@dcloudio/uni-app';
- import type { SysDictData } from '../../types/dict'
- import {checkPermi, getUserInfo} from '../../utils/storage'
- import { getTaskInfo, updateTaskInfo } from '../../api/task/list.uts'
- import { getTaskDetails } from '../../api/task/detail.uts'
- import { getDictDataByType } from '../../api/dict/index'
- // 任务基础信息类型(参照GenTask实体类)
- type TaskInfoForDevice = {
- taskId: Number | null
- planId: Number | null
- planType: string | null
- planName: string | null
- taskDate: string | null
- startTime: string | null
- endTime: string | null
- subjects: string | null
- machineryTypeName: string | null
- machinerySpec: string | null
- machineryLocation: string | null
- machineryName: string | null
- machineries: string | null
- locations: string | null
- operator: string | null
- operatorId: Number | null
- status: string | null
- taskDesc: string | null
- sourceType: string | null
- locationCount: Number
- machineryCount: Number
- createTime: string | null
- updateTime: string | null
- // 前端计算字段
- planTypeText: string | null
- statusText: string | null
- displayTime: string | null
- taskCount: string | null
- checkType: string | null
- }
- // 设备检查任务明细类型(参照DvCheckTaskDetail实体类)
- type DeviceCheckTaskDetail = {
- detailId: Number | null
- taskId: Number | null
- machineryRecordId: Number | null
- machineryId: Number | null
- machineryTypeName: string | null
- machinerySpec: string | null
- machineryLocation: string | null
- machineryName: string | null
- subjectId: Number | null
- subjectCode: string | null
- subjectName: string | null
- locationRecordId: Number | null
- locationId: Number | null
- locationName: string | null
- locationCode: string | null
- sourceType: string | null
- orderNum: Number | null
- status: string | null
- imagesUrl: string | null
- videosUrl: string | null
- resultValue: string | null
- resultDesc: string | null
- remark: string | null
- attr1: string | null
- attr2: string | null
- attr3: Number | null
- attr4: Number | null
- // 任务状态字段
- taskStatus: string | null // 'completed' 表示已完成,其他值表示未完成
- }
- // 设备清单数据
- const dataList = ref<DeviceCheckTaskDetail[]>([])
- // 任务信息
- const taskInfo = ref<TaskInfoForDevice>({
- taskId: null,
- planId: null,
- planType: null,
- planName: null,
- taskDate: null,
- startTime: null,
- endTime: null,
- subjects: null,
- machineryTypeName: null,
- machinerySpec: null,
- machineryLocation: null,
- machineryName: null,
- machineries: null,
- locations: null,
- operator: null,
- operatorId: null,
- status: null,
- taskDesc: null,
- sourceType: null,
- locationCount: 0,
- machineryCount: 0,
- createTime: null,
- updateTime: null,
- // 前端计算字段
- planTypeText: null,
- statusText: null,
- displayTime: null,
- taskCount: null,
- checkType: null
- })
- // 当前任务ID
- const currentTaskId = ref<string>('')
- const page = ref<number>(1)
- const pageSize: number = 10
- const hasMore = ref<boolean>(true)
- const loadingShow = ref<boolean>(false)
- const loading = ref<boolean>(false)
- const refreshing = ref<boolean>(false)
- const total = ref<number>(0)
-
- const taskStatusDictList = ref<SysDictData[]>([]) // 任务状态字典列表
- const dictLoaded = ref<boolean>(false) // 字典加载状态
-
- // 不再需要设备检查状态管理,使用taskStatus字段
-
- // 判断当前设备是否是第一个未完成的任务
- const isFirstUncompletedTask = (item: any | null): boolean => {
- if (item == null) return false
- const deviceItem = item as DeviceCheckTaskDetail
- // 如果任务已经完成,则返回false
- if (deviceItem.taskStatus == '2') {
- return false
- }
-
- // 查找第一个未完成的任务
- for (let i = 0; i < dataList.value.length; i++) {
- const device = dataList.value[i] as DeviceCheckTaskDetail
- if (device.taskStatus != '2') {
- // 返回当前设备是否是第一个未完成的任务
- return device.detailId == deviceItem.detailId
- }
- }
-
- // 如果所有任务都已完成,返回false
- return false
- }
- // 添加防重复刷新的标志
- const isRefreshing = ref<boolean>(false)
- // 添加刷新时间戳,用于防抖
- const lastRefreshTime = ref<number>(0)
-
- // 获取设备状态样式
- const getDeviceStatusClass = (item: any | null): string => {
- if (item == null) return ''
- const deviceItem = item as DeviceCheckTaskDetail
- const rawStatus = deviceItem.status
- if (rawStatus==null) return ''
- // 返回对应的状态类名
- return `status-${rawStatus}`
- }
-
- // 获取任务状态文本
- const getTaskStatusText = (taskStatus: string | null): string => {
- if (taskStatus == null || taskStatus.length == 0) return ''
- if (dictLoaded.value != true) {
- return taskStatus
- }
- const dictItem = taskStatusDictList.value.find((dict: SysDictData) => dict.dictValue == taskStatus)
- return dictItem != null && dictItem.dictLabel != null ? dictItem.dictLabel : taskStatus
- }
-
- // 获取任务状态字典列表
- const loadTaskStatusDictList = async (): Promise<void> => {
- try {
- const result = await getDictDataByType('dv_task_status')
- 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)
- }
- }
- taskStatusDictList.value = dictData
- dictLoaded.value = true
- }
- } catch (e: any) {
- console.error('获取任务状态字典失败:', e.message)
- dictLoaded.value = true
- }
- }
-
- // 获取任务状态样式
- const getTaskStatusClass = (item: any | null): string => {
- if (item == null) return ''
- const deviceItem = item as DeviceCheckTaskDetail
- const taskStatus = deviceItem.taskStatus
- if (taskStatus==null) return ''
- // 返回对应的任务状态类名
- return `taskStatus-${taskStatus}`
- }
-
- // 获取显示时间
- const getDisplayTime = (item: TaskInfoForDevice): string | null => {
- if (item.taskDate == null || item.taskDate.length == 0) return null
- if (item.startTime != null && item.startTime.length > 0 && item.endTime != null && item.endTime.length > 0) {
- return `${item.taskDate} ${item.startTime}-${item.endTime}`
- }
- return item.taskDate
- }
-
- // 根据dataList中的taskStatus更新taskInfo的status
- const updateTaskInfoStatus = async (): Promise<void> => {
- if (dataList.value.length == 0) return;
-
- let completedCount = 0;
- for (let i = 0; i < dataList.value.length; i++) {
- const item = dataList.value[i] as DeviceCheckTaskDetail;
- if (item.taskStatus == '2') {
- completedCount++;
- }
- }
-
- let newStatus = '0';
- // 全部完成
- if (completedCount == dataList.value.length) {
- newStatus = '2';
- }
- // 部分完成
- else if (completedCount > 0) {
- newStatus = '1';
- }
- // 全部未完成
- else {
- newStatus = '0';
- }
-
- // 只有状态发生变化时才调用接口更新
- if (taskInfo.value.status != newStatus) {
- taskInfo.value.status = newStatus;
-
- console.log(`任务状态更新: 总数${dataList.value.length}, 完成${completedCount}, 设置状态为${newStatus}`);
-
- // 调用后端接口更新任务状态
- try {
- const updateData: UTSJSONObject = {
- 'taskId': taskInfo.value.taskId,
- 'status': newStatus
- } as UTSJSONObject;
-
- await updateTaskInfo(updateData);
- console.log('任务状态已同步到后端');
- } catch (error) {
- console.error('更新任务状态失败:', error);
- // 如果更新失败,可以考虑回滚状态或给出提示
- }
- }
- }
-
- // 加载真实数据
- const loadData = async (isRefresh: boolean | null, disablePullDown: boolean | null): Promise<void> => {
- const shouldRefresh = isRefresh != null ? isRefresh : false
- const shouldDisablePullDown = disablePullDown != null ? disablePullDown : false
- if (currentTaskId.value == null || currentTaskId.value.length == 0) {
- return
- }
- loading.value = true
- if (shouldRefresh && !shouldDisablePullDown) {
- page.value = 1
- refreshing.value = true
- } else if (shouldRefresh && shouldDisablePullDown) {
- page.value = 1
- refreshing.value = false
- } else {
- refreshing.value = false
- }
- try {
- // 获取设备清单数据
- const result = await getTaskDetails(currentTaskId.value)
-
- // 提取响应数据
- const resultObj = result as UTSJSONObject
- const code = resultObj['code'] as number
- const responseData = resultObj['rows'] as any[]
- const responseTotal = resultObj['total'] as number
- if (code == 200) {
- // 将 any[] 转换为 DeviceCheckTaskDetail[]
- const newData: DeviceCheckTaskDetail[] = []
- for (let i = 0; i < responseData.length; i++) {
- const item = responseData[i] as UTSJSONObject
- const deviceItem: DeviceCheckTaskDetail = {
- detailId: item['detailId'] != null ? (item['detailId'] as Number) : null,
- taskId: item['taskId'] != null ? (item['taskId'] as Number) : null,
- machineryRecordId: item['machineryRecordId'] != null ? (item['machineryRecordId'] as Number) : null,
- machineryId: item['machineryId'] != null ? (item['machineryId'] as Number) : null,
- machineryTypeName: item['machineryTypeName'] as string | null,
- machinerySpec: item['machinerySpec'] as string | null,
- machineryLocation: item['machineryLocation'] as string | null,
- machineryName: item['machineryName'] as string | null,
- subjectId: item['subjectId'] != null ? (item['subjectId'] as Number) : null,
- subjectCode: item['subjectCode'] as string | null,
- subjectName: item['subjectName'] as string | null,
- locationRecordId: item['locationRecordId'] != null ? (item['locationRecordId'] as Number) : null,
- locationId: item['locationId'] != null ? (item['locationId'] as Number) : null,
- locationName: item['locationName'] as string | null,
- locationCode: item['locationCode'] as string | null,
- sourceType: item['sourceType'] as string | null,
- orderNum: item['orderNum'] != null ? (item['orderNum'] as Number) : null,
- status: item['status'] as string | null,
- imagesUrl: item['imagesUrl'] as string | null,
- videosUrl: item['videosUrl'] as string | null,
- resultValue: item['resultValue'] as string | null,
- resultDesc: item['resultDesc'] as string | null,
- remark: item['remark'] as string | null,
- attr1: item['attr1'] as string | null,
- attr2: item['attr2'] as string | null,
- attr3: item['attr3'] != null ? (item['attr3'] as Number) : null,
- attr4: item['attr4'] != null ? (item['attr4'] as Number) : null,
- // 任务状态字段
- //taskStatus: item['taskStatus'] != null ? (item['taskStatus'] as string) : '0',
- taskStatus: item['taskStatus'] as string | null,
- }
- newData.push(deviceItem)
- }
-
- if (shouldRefresh) {
- dataList.value = newData
- } else {
- dataList.value = [...dataList.value, ...newData]
- }
- total.value = responseTotal
- hasMore.value = dataList.value.length < responseTotal
- } else {
- const msg = resultObj['msg'] as string | null
- uni.showToast({
- title: msg ?? '加载失败',
- icon: 'none'
- })
- }
- } catch (e: any) {
- uni.showToast({
- title: e.message ?? '加载失败',
- icon: 'none'
- })
- } finally {
- loading.value = false
- if (shouldRefresh) {
- refreshing.value = false
- setTimeout(() => {
- isRefreshing.value = false
- }, 50)
- }
- }
- }
-
- // 加载任务基础信息
- const loadTaskInfo = async (): Promise<void> => {
- if (currentTaskId.value == null || currentTaskId.value.length == 0) {
- return
- }
-
- try {
- const result = await getTaskInfo(currentTaskId.value)
-
- // 提取响应数据
- const resultObj = result as UTSJSONObject
- const code = resultObj['code'] as number
- const taskData = resultObj['data'] as UTSJSONObject
- if (code == 200) {
- // 将返回的数据转换为TaskInfo类型
- const newTaskInfo: TaskInfoForDevice = {
- taskId: taskData['taskId'] != null ? (taskData['taskId'] as Number) : null,
- planId: taskData['planId'] != null ? (taskData['planId'] as Number) : null,
- planType: taskData['planType'] as string | null,
- planName: taskData['planName'] as string | null,
- taskDate: taskData['taskDate'] as string | null,
- startTime: taskData['startTime'] as string | null,
- endTime: taskData['endTime'] as string | null,
- subjects: taskData['subjects'] as string | null,
- machineryTypeName: taskData['machineryTypeName'] as string | null,
- machinerySpec: taskData['machinerySpec'] as string | null,
- machineryLocation: taskData['machineryLocation'] as string | null,
- machineryName: taskData['machineryName'] as string | null,
- machineries: taskData['machineries'] as string | null,
- locations: taskData['locations'] as string | null,
- operator: taskData['operator'] as string | null,
- operatorId: taskData['operatorId'] != null ? (taskData['operatorId'] as Number) : null,
- status: taskData['status'] as string | null,
- taskDesc: taskData['taskDesc'] as string | null,
- sourceType: taskData['sourceType'] as string | null,
- locationCount: taskData['locationCount'] != null ? (taskData['locationCount'] as Number) : 0,
- machineryCount: taskData['machineryCount'] != null ? (taskData['machineryCount'] as Number) : 0,
- createTime: taskData['createTime'] as string | null,
- updateTime: taskData['updateTime'] as string | null,
- // 前端计算字段初始化
- planTypeText: null,
- statusText: null,
- displayTime: null,
- taskCount: null,
- checkType: null
- }
- taskInfo.value = newTaskInfo
-
- // 计算前端显示字段
- taskInfo.value.displayTime = getDisplayTime(taskInfo.value)
- } else {
- const msg = resultObj['msg'] as string | null
- uni.showToast({
- title: msg ?? '获取任务信息失败',
- icon: 'none'
- })
- }
- } catch (e: any) {
- uni.showToast({
- title: e.message ?? '获取任务信息失败',
- icon: 'none'
- })
- }
- }
-
- // 下拉刷新
- const handleRefresh = async (): Promise<void> => {
- console.log("handleRefresh被触发")
- const now = Date.now();
- if (now - lastRefreshTime.value < 1000) {
- refreshing.value = false;
- return;
- }
- lastRefreshTime.value = now;
- if (loading.value || isRefreshing.value) {
- refreshing.value = false;
- return;
- }
-
- isRefreshing.value = true;
- try {
- await loadData(true, false);
- // 刷新完成后检查并更新任务状态
- await updateTaskInfoStatus();
- } catch (error) {
- console.error('刷新失败:', error);
- } finally {
- // 简单的状态重置
- refreshing.value = false;
- loading.value = false;
- isRefreshing.value = false;
- }
- setTimeout(() => {
- isRefreshing.value = false
- }, 100)
- }
-
- // 加载更多
- const loadMore = (): void => {
- if (!hasMore.value || loading.value) {
- return
- }
- page.value++
- loadData(false, false)
- }
- // 点击列表项
- const handleItemClick = (item: any | null, action: string): void => {
- if (item == null) return
- const deviceItem = item as DeviceCheckTaskDetail
-
- if(action == 'scan') {
- /* // 检查前一个任务是否已完成
- const currentIndex = dataList.value.findIndex(d => d.detailId == deviceItem.detailId);
- let canProcess = true;
-
- // 检查前面的所有任务是否都已完成
- for (let i = 0; i < currentIndex; i++) {
- if (dataList.value[i].taskStatus != 'completed') {
- canProcess = false;
- break;
- }
- }
-
- if (canProcess) { */
- // 跳转到任务处理页面
- uni.showModal({
- title: '开始检查',
- //content: `即将处理任务: ${deviceItem.machineryName} (${deviceItem.machinerySpec})`,
- confirmText: '确定开始',
- cancelText: '取消',
- success: (res) => {
- if(res.confirm) {
- // 跳转到设备检查页面进行任务处理
- /* const deviceName = deviceItem.machineryName != null ? deviceItem.machineryName : '';
- const deviceCode = deviceItem.machinerySpec != null ? deviceItem.machinerySpec : '';
- const deviceTypeText = deviceItem.machineryTypeName != null ? deviceItem.machineryTypeName : '';
- const location = deviceItem.locationName != null ? deviceItem.locationName : ''; */
- if(deviceItem.detailId != null){
- uni.navigateTo({
- url: `/pages/task/device-check?detailId=${deviceItem.detailId}`
- });
- }else{
- uni.showToast({
- title: '缺少参数',
- icon: 'none'
- })
- }
- }
- }
- });
- /* } else {
- uni.showToast({
- title: '请按顺序完成任务!前序任务完成后才能开始当前任务。',
- icon: 'none',
- duration: 2000
- });
- } */
- }
- if(action === 'detail') {
- uni.navigateTo({
- url: `/pages/task/device-check?detailId=${deviceItem.detailId}&opType=view`
- });
- }
- }
- // 点击列表项
- const handleView = (item: any | null): void => {
- /* if (item == null) return
- const deviceItem = item as deviceInfo
- uni.showToast({
- title: `设备详情: ${deviceItem.deviceName}`,
- icon: 'none'
- }); */
- }
-
- onLoad((options: any) => {
- const params = options as UTSJSONObject
- const taskId = params.get('taskId') as string | null
- // 获取传递的任务ID
- if (taskId != null) {
- currentTaskId.value = taskId
- // 并行加载字典、任务信息和设备清单
- Promise.all([
- loadTaskStatusDictList(),
- loadTaskInfo(),
- loadData(true, true)
- ]).catch(error => {
- console.error('加载数据失败:', error)
- }).finally(() => {
- // 确保在任何情况下都重置加载状态
- loading.value = false
- refreshing.value = false
- })
- } else {
- uni.showToast({
- title: '缺少任务ID参数',
- icon: 'none'
- })
- }
- })
-
- // 组件卸载前清理事件监听
- onBeforeUnmount(() => {
- refreshing.value = false
- loading.value = false
- isRefreshing.value = false
- })
-
- // 页面显示时强制重置加载状态
- onShow(() => {
- /* loading.value = false
- refreshing.value = false
- isRefreshing.value = false */
- // 检查是否有来自子页面的刷新标记
- const needRefresh = uni.getStorageSync('needRefresh')
- if (needRefresh == true) {
- // 清除标记
- uni.removeStorageSync('needRefresh')
- // 延迟一小段时间再执行刷新,避免状态冲突
- setTimeout(() => {
- loadData(true, false).then(() => {
- updateTaskInfoStatus()
- })
- }, 500)
- }
- // 延迟再重置一次确保生效
- /* setTimeout(() => {
- loading.value = false
- refreshing.value = false
- isRefreshing.value = false
- }, 500) */
- })
-
- // 页面卸载时设置返回标记
- onUnload(() => {
- // 设置标记通知index页面需要刷新
- uni.setStorageSync('needRefresh', true)
- })
- </script>
- <style lang="scss">
- .list-page {
- flex: 1;
- background-color: #e8f0f9;
- }
- .task-info-bar {
- padding: 20rpx 30rpx;
- background-color: #d7eafe;
- border-bottom: 1rpx solid #ccc;
- }
- .task-info-item {
- flex-direction: row;
- align-items: center;
- margin-bottom: 10rpx;
- }
- .task-info-label {
- font-size: 28rpx;
- color: #333;
- font-weight: bold;
- margin-right: 10rpx;
- }
- .task-info-value {
- font-size: 28rpx;
- color: #666;
- }
- .search-bar {
- padding: 20rpx 30rpx;
- background-color: #d7eafe;
- }
- .search-box {
- flex-direction: row;
- align-items: center;
- height: 72rpx;
- padding: 0 24rpx;
- background-color: #f5f5f5;
- border-radius: 36rpx;
- .search-icon {
- width: 32rpx;
- height: 32rpx;
- margin-right: 12rpx;
- }
- .search-input {
- flex: 1;
- font-size: 28rpx;
- color: #333333;
- }
- .clear-icon {
- margin-left: 12rpx;
- font-size: 28rpx;
- color: #999999;
- }
- }
- .list-item {
- margin: 12rpx 30rpx;
- background-color: #ffffff;
- border-radius: 16rpx;
- }
-
- .device-completed {
- background-color: #f0f9eb; /* 浅绿色背景表示已完成 */
- }
-
- .device-in-progress {
- background-color: #e6f4ff; /* 浅蓝色背景表示检查中 */
- }
-
- .device-pending {
- background-color: #ffffff; /* 白色背景表示待扫描 */
- }
-
- .btn-disabled {
- z-index: 999;
- border-radius: 10rpx;
- font-size: 24rpx;
- margin-left: 20rpx;
- background-color: #ccc;
- line-height: 45rpx;
- color: #999;
- .btn-text{
- color: #999;
- font-size: 24rpx;
- padding: 5px 15px;
- }
- }
- .item-container {
- padding: 30rpx;
- }
- .item-header {
- flex-direction: row;
- align-items: flex-start;
- margin-bottom: 16rpx;
- justify-content: space-between; /* 主轴两端对齐 */
- min-height: 55rpx;
- .item-title {
- font-size: 30rpx;
- color: #333333;
- font-weight: bold;
- flex-wrap: wrap;
- flex: 0 1 75%;
- min-width: 0;
- }
-
- .task-badges {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 10rpx; /* 添加间距 */
- }
- }
-
- .info-row {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- .info-label {
- font-size: 26rpx;
- color: #666;
- }
- .info-value {
- font-size: 26rpx;
- // color: #666;
- }
- }
- .btn-group {
- flex-direction: row;
- align-items: center;
- justify-content: flex-end;
- margin-top: 20rpx;
- }
- .btn-primary {
- z-index: 999;
- border-radius: 10rpx;
- font-size: 24rpx;
- // white-space: nowrap;
- margin-left: 20rpx;
- background-color: #165DFF;
- line-height: 45rpx;
- color: #ffffff;
- .btn-text{
- color: #ffffff;
- font-size: 24rpx;
- padding: 5px 15px;
- }
- }
-
- .btn-disabled {
- z-index: 999;
- border-radius: 10rpx;
- font-size: 24rpx;
- margin-left: 20rpx;
- background-color: #ccc;
- line-height: 45rpx;
- color: #999;
- .btn-text{
- color: #999;
- font-size: 24rpx;
- padding: 5px 15px;
- }
- }
- .status-tag {
- padding: 8rpx 20rpx;
- border-radius: 20rpx;
- font-size: 24rpx;
- white-space: nowrap;
- // margin-left: 50rpx;
- // justify-content: flex-end;
- border: 1rpx solid;
- text-align: center;
- }
- /* 设备类型样式 */
- .type-power {
- background-color: #ECF5FF;
- color: #409EFF;
- border-color: #d8ebff;
- }
- .type-cooling {
- background-color: #F4F4F5;
- color: #909399;
- border-color: #e9e9eb;
- }
- .type-water {
- background-color: #F0F9EB;
- color: #67C23A;
- border-color: #c2e7b0;
- }
- /* 设备状态样式 */
- .status-normal {
- background-color: #F0F9EB;
- color: #67C23A;
- border-color: #c2e7b0;
- }
- .status-warning {
- background-color: #FDF6EC;
- color: #E6A23C;
- border-color: #faecd8;
- }
- .status-danger {
- background-color: #FEF0F0;
- color: #F56C6C;
- border-color: #fde2e2;
- }
- /* 扫描状态样式 */
- .scan-completed {
- background-color: #F0F9EB;
- color: #67C23A;
- border-color: #c2e7b0;
- }
- .scan-pending {
- background-color: #FDF6EC;
- color: #E6A23C;
- border-color: #faecd8;
- }
- .scan-in-progress {
- background-color: #F4F4F5;
- color: #909399;
- border-color: #e9e9eb;
- }
- /* 任务类型样式 (保留兼容性) */
- .type-inspection {
- background-color: #ECF5FF;
- color: #409EFF;
- border-color: #d8ebff;
- }
- .type-patrol {
- background-color: #F4F4F5;
- color: #909399;
- border-color: #e9e9eb;
- }
- .type-maintenance {
- background-color: #F0F9EB;
- color: #67C23A;
- border-color: #c2e7b0;
- }
- /* 任务状态样式 (保留兼容性) */
- .status-pending {
- background-color: #FDF6EC;
- color: #E6A23C;
- border-color: #faecd8;
- }
- .status-completed {
- background-color: #F0F9EB;
- color: #67C23A;
- border-color: #c2e7b0;
- }
- .status-overdue {
- background-color: #FEF0F0;
- color: #F56C6C;
- border-color: #fde2e2;
- }
- /* 任务状态样式 */
- .taskStatus-0 {
- background-color: #FDF6EC;
- color: #E6A23C;
- border-color: #faecd8;
- }
- .taskStatus-1 {
- background-color: #EBF5FF;
- color: #409EFF;
- border-color: #d8ebff;
- }
- .taskStatus-2 {
- background-color: #F0F9EB;
- color: #67C23A;
- border-color: #c2e7b0;
- }
- /* 保持其他原有样式 */
- .text-gray{
- font-size: 26rpx;
- color: #666;
- }
- .scroll-view_H {
- width: 100%;
- flex-direction: row;
- }
- .scroll-view-item_H {
- justify-content: center;
- align-items: center;
- .status-txt{
- padding: 8px 12px;
- text-align: center;
- margin-right: 12rpx;
- border-radius: 36rpx;
- background-color: #fff;
- font-size: 28rpx;
- }
- .stauts-sel{
- background-color: #007AFF;
- color: #fff;
- }
- }
- </style>
|