import { TimeAndTitle } from '../common/component/TimeAndTitle';
import router from '@ohos.router';
import WorkOrderInfo from '../viewmodel/WorkOrderInfo';
import {ProcessCurrentView,ProcessStatus} from '../viewmodel/process/EnumerationType'
import {VoiceAssistant} from '../view/yuyinzhushou'
import {OperationList} from   '../view/ProductionProcessesView'
import { SelectWorkOrderView } from '../view/SelectWorkOrderView';
import TaskSeqVO from '../viewmodel/process/TaskSeqInfo';
import OperationComponent from '../viewmodel/process/OperationComponent';
import ProcessInfo from '../viewmodel/process/ProcessInfo';
import { MaterialCollectView } from '../view/process/MaterialCollectView';
import {ScanStartWorkView} from '../view/process/ScanStartWorkView'
import {ESOPView} from '../view/process/ESOPView'
import {WeldView} from '../view/process/WeldView'
import {RecordItemsView} from '../view/process/RecordItemsView'
import ReportInfo from '../viewmodel/process/ReporterInfo';
import { BindTaskSeq } from '../viewmodel/process/BindTaskSeq';
import { ElectricScrewdriverView } from '../view/process/ElectricScrewdriverView';
import {SwitchAndScanProductView} from '../view/SwitchAndScanProductView'
import { SelfInspectView } from '../view/process/SelfInspectView';
import { MultiMediaCollect } from '../view/process/MultiMediaCollect';
import { BarcodeAssociationDialog } from '../view/BarcodeAssociationDialog';
import WorkOrderSeq from '../viewmodel/WorkOrderSeq';
import ProcessDeviceDailyCheck from '../viewmodel/process/ProcessDeviceDailyCheck';
import { DeviceCheckView } from '../view/process/DeviceCheckView';
import { ReportWorkHourRateDialog } from '../view/ReportWorkHourRateDialog';
import { ConfirmDialog } from '../view/ConfirmDialog';
import VehicleInfo from '../viewmodel/VehicleInfo';
import OperationItem from '../viewmodel/OperationItem';
import ProcessCheck from '../viewmodel/process/ProcessCheck';
import ProcessDefectRecord from '../viewmodel/process/ProcessDefectRecord';
import RecordItem from '../viewmodel/process/RecordItem';
import { PhotoCollectView } from '../view/process/PhotoCollectView';
import fs from "@ohos.file.fs"
// 声明接受参数的类型
interface Params {
  // 辅助操作标志
  auxiliaryOperationFlag?: boolean,
}

@Entry
@Component
struct ProcessIndex {
  @State processCurrentView: ProcessCurrentView = ProcessCurrentView.SCAN_PRODUCT_VIEW
  @State previousView: ProcessCurrentView = ProcessCurrentView.SCAN_PRODUCT_VIEW
  @State stationId:string = '3c3c3d3d'
  @State isStationProcess:boolean =false;
  @State currentProcessStatus:ProcessStatus =ProcessStatus.INITIAL;
  @State checkArray: ProcessCheck[] = [{checkName:'电源检查',content:"点检内容：要检查是否漏电，不能让他了电源检查是确保电气设备、系统或建筑安全稳定运行的重要环节标准值：50V上限值：60V下值：40V",isCheck:false},
    {checkName:'外观检查',content:"点检内容：外观检查是通过目视、触摸或借助简单工具，对产品表面及整体形态进行的全面质量评估。其核心内容包括：表面缺陷排查：检查是否存在划痕、凹坑、裂纹、毛刺、气泡、缩水等可见瑕疵，例如金属件需关注锈迹、镀层脱落，塑胶件需观察熔接痕与变形。颜色与光泽度验证：对比标准色卡或样件，确认产品颜色是否符合设计要求，光泽度是否均匀一致，避免出现色差或局部暗沉。装配与结构检查：查看零部件装配是否到位，缝隙是否均匀（如手机外壳接缝误差≤0.3mm），螺钉、卡扣等连接部位是否平整无凸起，避免松动或错位。标识与涂层质量：核对铭牌、logo、型号等标识是否清晰、位置正确，涂层（如油漆、电镀层）是否牢固，通过划格法等简易测试判断附着力是否达标。整体协调性评估：从外观整体观感出发，检查线条流畅度、曲面过渡自然性，以及产品与使用场景的匹配度（如汽车内饰的质感与风格一致性）通过上述检查，确保产品外观不仅满足功能需求，还符合美学标准与客户预期。标准值：50V上限值：60V下值：40V"
    ,isCheck:false},{checkName:'电源检查',content:"点检内容：要检查是否漏电，不能让他了电源检查是确保电气设备、系统或建筑安全稳定运行的重要环节标准值：50V上限值：60V下值：40V",isCheck:false},
    {checkName:'外观检查',content:"点检内容：外观检查是通过目视、触摸或借助简单工具，对产品表面及整体形态进行的全面质量评估。其核心内容包括：表面缺陷排查：检查是否存在划痕、凹坑、裂纹、毛刺、气泡、缩水等可见瑕疵，例如金属件需关注锈迹、镀层脱落，塑胶件需观察熔接痕与变形。颜色与光泽度验证：对比标准色卡或样件，确认产品颜色是否符合设计要求，光泽度是否均匀一致，避免出现色差或局部暗沉。装配与结构检查：查看零部件装配是否到位，缝隙是否均匀（如手机外壳接缝误差≤0.3mm），螺钉、卡扣等连接部位是否平整无凸起，避免松动或错位。标识与涂层质量：核对铭牌、logo、型号等标识是否清晰、位置正确，涂层（如油漆、电镀层）是否牢固，通过划格法等简易测试判断附着力是否达标。整体协调性评估：从外观整体观感出发，检查线条流畅度、曲面过渡自然性，以及产品与使用场景的匹配度（如汽车内饰的质感与风格一致性）通过上述检查，确保产品外观不仅满足功能需求，还符合美学标准与客户预期。标准值：50V上限值：60V下值：40V"
    ,isCheck:false},{checkName:'电源检查',content:"点检内容：要检查是否漏电，不能让他了电源检查是确保电气设备、系统或建筑安全稳定运行的重要环节标准值：50V上限值：60V下值：40V",isCheck:false},
    {checkName:'外观检查',content:"点检内容：外观检查是通过目视、触摸或借助简单工具，对产品表面及整体形态进行的全面质量评估。其核心内容包括：表面缺陷排查：检查是否存在划痕、凹坑、裂纹、毛刺、气泡、缩水等可见瑕疵，例如金属件需关注锈迹、镀层脱落，塑胶件需观察熔接痕与变形。颜色与光泽度验证：对比标准色卡或样件，确认产品颜色是否符合设计要求，光泽度是否均匀一致，避免出现色差或局部暗沉。装配与结构检查：查看零部件装配是否到位，缝隙是否均匀（如手机外壳接缝误差≤0.3mm），螺钉、卡扣等连接部位是否平整无凸起，避免松动或错位。标识与涂层质量：核对铭牌、logo、型号等标识是否清晰、位置正确，涂层（如油漆、电镀层）是否牢固，通过划格法等简易测试判断附着力是否达标。整体协调性评估：从外观整体观感出发，检查线条流畅度、曲面过渡自然性，以及产品与使用场景的匹配度（如汽车内饰的质感与风格一致性）通过上述检查，确保产品外观不仅满足功能需求，还符合美学标准与客户预期。标准值：50V上限值：60V下值：40V"
    ,isCheck:false}]
  @State defectRecords: ProcessDefectRecord[] = []
  @State recordItems:RecordItem[]=[]
  // 工单列表
  @State workOrders: WorkOrderInfo[] = []
  // 选中工单
  @State selectWorkOder: WorkOrderInfo = {}
  // 工位通知数量
  @State noticeNum: number = 100
  // 扫描或手动输入的流水/序列/铭牌号
  @State scanCode: string = ''
  // 当前流转卡号
  @State seqNo: string = ''
  //是否打开底部抽屉
  @State isAuxiliaryViewOpen: boolean = false
  // 选中工序id
  @State selectOperationId: string = ''
  // 绩效模式（0:计时 1:计件）
  @State operationPerformance: string = ''
  // 选中工序名称
  selectOperationName: string = ''
  //选择的按钮索引(默认加载全部)
  @State selectedButtonIndex: number = 0
  // 流转卡号信息集合
  @State taskSeqArray: TaskSeqVO[] = []

  @State itemArray: OperationItem[] = [
    {
      operationId: "OP001",
      itemCode: "LX-00004",
      itemName: "手机外壳",
      itemModel: "A型",
      num: 100,
      unit: "个",
      kitNum: 50,
      storageNum: 80,
      realNum: 0,
      needNum: 1,
      batchNo: "BATCH-2024-08",
      processId: "PROC-001",
      workOrderCode: "WO-2024-0801",
      codeTypeStr: "SN:202408001"
    } as OperationItem,
    {
      operationId: "OP001",
      itemCode: "LX-00003",
      itemName: "显示屏",
      itemModel: "6.7寸OLED",
      num: 100,
      unit: "片",
      kitNum: 60,
      storageNum: 90,
      realNum: 0,
      needNum: 2,
      batchNo: "BATCH-2024-09",
      processId: "PROC-001",
      workOrderCode: "WO-2024-0801",
      codeTypeStr: "批次:202409001"
    } as OperationItem
  ]
  // 工序组件（工步）
  @State opComponents: OperationComponent[] = [
    {
      id: 0,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "物料领用和确认",
      compentName: "物料采集",
      compentType: "1",
      sortNum: 1,
      isComplete:false
    } as OperationComponent,
    {
      id: 1,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "记录生产关键参数",
      compentName: "记录项",
      compentType: "2",
      sortNum: 2,
      isComplete:false
    } as OperationComponent,
    {
      id: 2,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "拍照记录生产过程",
      compentName: "多媒体采集",
      compentType: "3",
      sortNum: 3,
      isComplete:false
    } as OperationComponent,
    {
      id: 3,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "查看作业指导书",
      compentName: "ESOP文档",
      compentType: "4",
      sortNum: 4,
      isComplete:false
    } as OperationComponent,
    {
      id: 4,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "产品质量自检",
      compentName: "自检点检",
      compentType: "5",
      sortNum: 5,
      isComplete:false
    } as OperationComponent,
    {
      id: 5,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "记录设备运行参数",
      compentName: "设备记录",
      compentType: "6",
      sortNum: 6,
      isComplete:false
    } as OperationComponent,
    {
      id: 6,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "螺栓紧固确认",
      compentName: "紧固操作",
      compentType: "7",
      sortNum: 7,
      isComplete:false
    } as OperationComponent,
    {
      id: 7,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "设备调试配对",
      compentName: "调试配对",
      compentType: "8",
      sortNum: 8,
      isComplete:false
    } as OperationComponent,
    {
      id: 8,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "产品铭牌绑定",
      compentName: "铭牌绑定",
      compentType: "9",
      sortNum: 9,
      isComplete:false
    } as OperationComponent,
    {
      id: 0,
      processRouteId: "PR001",
      operationId: "OP001",
      deleted: 0,
      remark: "填写工序表单",
      compentName: "工序表单",
      compentType: "10",
      sortNum: 10,
      isComplete:false
    } as OperationComponent,
  ]
  // 选中的工序组件类型
  @State selectComponentType: string = ''
  @State selectComponentID: number = -1
  // 工序组件状态数组(0:未完成0
  @State componentStates: number[] = [0,0,0,0,0,0,0,0,0,0]
  // 工序组件对应的图标
  componentResMap: Map<string, Resource> = new Map([
    ['1', $r('app.media.process_component_material_collect')],
    ['2', $r('app.media.process_component_record_item')],
    ['3', $r('app.media.process_component_multi_media_collect')],
    ['4', $r('app.media.process_component_esop')],
    ['5', $r('app.media.process_component_self_inspect')],
    ['6', $r('app.media.process_component_device_record')],
    ['7', $r('app.media.process_component_fastening')],
    ['9', $r('app.media.process_component_label_bind')],
    ['10', $r('app.media.process_component_form')],
    ['11', $r('app.media.process_component_auto_test')],
    ['12', $r('app.media.process_component_device_record')],
  ])
  // 扫码开工后的生产过程信息
  @State process: ProcessInfo = {}
  // 扫码开工状态(0:未开工 1:已开工)
  @State scanState: number = 0
  // 工单下流转卡号列表
  @State seqList: WorkOrderSeq[] = []
  // 设备每日点检
  @State deviceChecks: ProcessDeviceDailyCheck[] = []
  // 报工人信息
  @State reporterList: ReportInfo[] = []
  @State currentReporterIndex: number = 0
  @State currentReportNumIndex: number = 0
  @State currentDefectIndex: number = 0
  // mqtt是否连接
  @State isConnected: boolean = false
  // 当前订单扫码流水号数量
  @State scanSeqNos: number = 0
  //工序载具列表
  @State processVehicleList: VehicleInfo[] = []
  //所有流水号
  allTaskSeq: TaskSeqVO[] = []
  private scrollerList: Scroller = new Scroller()
  @Provide('currentDept') currentDept: string = ''
  @Provide('currentProductLine') currentProductLine: string = ''
  @Provide('currentStation') currentStation: string = ''
  @Provide('stationIp') stationIp: string = ''
  @Provide('currentPLCode') currentPLCode: string = ''
  @Provide('currentOrgId') currentOrgId: number = 0
  @Provide('currentUserName') currentUserName: string = ''
  @Provide('currentUserId') currentUserId: number = 0
  // 报工人、报工流水号和不良流水号
  @Provide('bindTaskSeq') bindTaskSeq: BindTaskSeq[] = []
  startWorkTime: string = ''

  aboutToAppear(): void {
    const context = getContext(this);
    const localImageDir = `${context.filesDir}/esop/`;
    // 检查目录是否存在
    if (!fs.accessSync(localImageDir)) {
      console.warn( "目录不存在，创建目录");
      fs.mkdirSync(localImageDir);
    }
  }
  // 工位发生改变则可能需要重新选择工单

  build() {
    Stack() {
      Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
        //时间和导航标
        Row() {
          TimeAndTitle()
        }.width('100%')
        .height('3.4%')
        .alignItems(VerticalAlign.Bottom)
        .justifyContent(FlexAlign.End)

        Row() {
          Image($r('app.media.general_return'))
            .height($r('app.float.virtualSize_56'))
            .width($r('app.float.virtualSize_56'))
            .fillColor($r('app.color.FFFFFF'))
          Text('生产执行')
            .fontColor($r('app.color.FFFFFF'))
            .fontSize($r('app.float.fontSize_30'))
            .fontWeight(FontWeight.Medium)
        }
        .height('4%')
        .width('94.8%')
        .justifyContent(FlexAlign.Start)
        .onClick(() => {
          router.back()
          // window.getLastWindow(getContext()).then((data) => {
          //   //获取窗口对象
          //   let windowClass = data;
          //   windowClass.minimize((err: BusinessError) => {
          //     const errCode: number = err.code;
          //     if (errCode) {
          //       console.error('Failed to minimize the window. Cause: ' + JSON.stringify(err));
          //       return;
          //     }
          //     console.info('Succeeded in minimizing the window.');
          //   });
          //   console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
          // });
          // return true;
        })

        Row().height('2.8%')
        // 主要操作栏
        Row() {
          // 左侧选择工单、工位、人员；工序查看
          Column() {
              Column({ space: 2 }) {
                InfoRow({
                  label: '产品名称：',
                  value: this.selectWorkOder.materialName!,
                })
                InfoRow({
                  label: '产品编号：',
                  value: this.selectWorkOder.materialCode!,
                })
                InfoRow({
                  label: '工单编号：',
                  value: this.selectWorkOder.workOrderCode!,
                })
              }
              .width('100%')
              .height('10.2%')
              .justifyContent(FlexAlign.Center)
              .backgroundColor($r('app.color.20FFFFFF'))
              .borderRadius($r('app.float.fontSize_16'))
              .onClick(() => {
                this.previousView = this.processCurrentView
                this.processCurrentView = ProcessCurrentView.WORK_ORDER_VIEW
              })
            // 登录信息（工位、人员信息）
            Row() {
              Column({space:2}) {
                InfoRow({
                  label: '当前工位：',
                  value: 'HM_001',
                })
                InfoRow({
                  label: '操作员：',
                  value: '李四',
                })
                InfoRow({
                  label: '当前卡号：',
                  value: this.stationId,
                })
              }
              .width('100%')
              .height('100%')
              .justifyContent(FlexAlign.Center)

            }
            .width('100%')
            .height('10.2%')
            .backgroundColor($r('app.color.20FFFFFF'))
            .borderRadius($r('app.float.fontSize_16'))
            // .onClick(() => {
            //   this.loginInfoController.open()
            // })

            // 工序
            Column({ space: 4 }) {
              Row() {
                Text('工序')
                  .fontWeight(FontWeight.Medium)
                  .fontColor($r('app.color.FFFFFF'))
                  .fontSize($r('app.float.fontSize_24'))
              }
              .width('83.4%')
              .height('8.4%')
              .alignItems(VerticalAlign.Bottom)
              if(this.selectWorkOder){
                OperationList({
                  selectWorkOder:this.selectWorkOder,
                  stationId:this.stationId,
                  selectOperationId:this.selectOperationId,
                  isStationProcess:this.isStationProcess,
                  currentProcessStatus:this.currentProcessStatus
                })

              }

            }
            .width('100%')
            .height('77.3%')
            .backgroundColor($r('app.color.20FFFFFF'))
            .borderRadius($r('app.float.fontSize_16'))
          }
          .height('100%')
          .width('19.8%')
          .justifyContent(FlexAlign.SpaceBetween)

          // 右侧生产操作栏
          if (this.processCurrentView == ProcessCurrentView.SCAN_PRODUCT_VIEW) {
            // 没有工序组件则展示扫码页面
            Column() {
              SwitchAndScanProductView({
                processCurrentView: this.processCurrentView,
                previousView: this.processCurrentView,
              });
            }
            .width('79.1%')
            .height('100%')
            .justifyContent(FlexAlign.Center)
            .backgroundColor($r('app.color.20FFFFFF'))
            .borderRadius($r('app.float.fontSize_16'))
          }
          else if (this.processCurrentView == ProcessCurrentView.WORK_ORDER_VIEW) {
            Column() {
              SelectWorkOrderView({
                processCurrentView: this.processCurrentView,
                selectWorkOder: this.selectWorkOder,
                previousView: this.previousView

              })
            }
            .width('79.1%')
            .height('100%')
            .justifyContent(FlexAlign.Center)
            .backgroundColor($r('app.color.20FFFFFF'))
            .borderRadius($r('app.float.fontSize_16'))
          }
          else {
            Column() {
              List({ space: 4 }) {
                ForEach(this.opComponents, (item: OperationComponent, index: number) => {
                  ListItem() {
                    Column() {
                      Stack() {
                        Image(this.selectComponentID === item.id! ? $r('app.media.process_component_state_select') : (item.isComplete? $r('app.media.process_component_state_finish') : $r('app.media.process_component_state_no_select')))
                          .height(this.selectComponentID === item.id! ? '100%' : '90%')
                          .width('100%')
                          .objectFit(ImageFit.Fill)
                          .borderRadius($r('app.float.fontSize_16'))
                        Column({ space: 2 }) {
                          Image(this.componentResMap.get(item.compentType!))
                            .height($r('app.float.virtualSize_24'))
                            .width($r('app.float.virtualSize_24'))
                            .fillColor(this.selectComponentID === item.id! ? $r('app.color.99000000') : (item.isComplete? $r('app.color.30D158') : $r('app.color.FFFFFF')))
                          Text(item.compentName!)
                            .fontSize($r('app.float.fontSize_16'))
                            .fontWeight(FontWeight.Regular)
                            .fontColor(this.selectComponentID === item.id! ? $r('app.color.99000000') : (item.isComplete? $r('app.color.30D158') : $r('app.color.FFFFFF')))
                        }
                        .width('100%')
                        .height('90%')
                        .justifyContent(FlexAlign.Center)
                      }
                      .width('100%')
                      .height('100%')
                      .alignContent(Alignment.Top)
                      .onClick(() => {
                        this.selectComponentID = item.id!
                      })
                    }
                    .height('100%')
                    .width('12.5%')
                  }
                })
              }
              .listDirection(Axis.Horizontal)
              .height('9.3%')
              .width('79.1%')

              // 不同工序组件（工步）展示不同页面
              Column() {
                if(this.selectOperationId&&this.isStationProcess&&this.currentProcessStatus == ProcessStatus.INITIAL)
                {
                  ScanStartWorkView({
                    currentProcessStatus:this.currentProcessStatus,
                    selectComponentID:this.selectComponentID
                  })
                }
                if(this.currentProcessStatus === ProcessStatus.START)
                {
                  if (this.opComponents[this.selectComponentID].compentType === '1') {
                    MaterialCollectView({
                      opComponents:this.opComponents,
                      index:this.selectComponentID,
                      itemArray:this.itemArray
                    })
                  }else if (this.opComponents[this.selectComponentID].compentType === '2') {
                    RecordItemsView({
                      opComponents:this.opComponents,
                      index:this.selectComponentID,
                      recordItems:this.recordItems,
                    })
                  }else if (this.opComponents[this.selectComponentID].compentType === '3') {
                    PhotoCollectView({
                      opComponents:this.opComponents,
                      index:this.selectComponentID,

                    })
                  }
                  else if (this.opComponents[this.selectComponentID].compentType === '4') {
                    ESOPView({
                      opComponents:this.opComponents,
                      index:this.selectComponentID,
                    })
                  } else if (this.opComponents[this.selectComponentID].compentType === '5') {
                    SelfInspectView({
                      opComponents:this.opComponents,
                      index:this.selectComponentID,
                      defectRecords:this.defectRecords,
                      checkArray:this.checkArray
                    })
                  } else if (this.opComponents[this.selectComponentID].compentType === '7') {
                    WeldView({
                      opComponents:this.opComponents,
                      index:this.selectComponentID,

                    })
                  } else if (this.opComponents[this.selectComponentID].compentType === '8') {
                    ElectricScrewdriverView({
                      opComponents:this.opComponents,
                      index:this.selectComponentID,
                    })
                  }else if (this.opComponents[this.selectComponentID].compentType === '9') {
                    DeviceCheckView({

                    })
                  }
                }

                // } else if (this.selectComponentType === '3' && this.scanState === 1) {
                //   MultiMediaCollect({
                //     seqNo: this.seqNo,
                //     selectOperationId: this.selectOperationId,
                //     process: this.process,
                //   })
                // } else if (this.selectComponentType === '5') {
                //   SelfInspectView({
                //     scanState: this.scanState,
                //     seqNo: this.seqNo,
                //     selectOperationId: this.selectOperationId,
                //     process: this.process,
                //   })
                // } else if (this.selectComponentType === '12') {
                //   DeviceCheckView({
                //     deviceChecks: this.deviceChecks,
                //     scanState: this.scanState,
                //     seqNo: this.seqNo,
                //     selectOperationId: this.selectOperationId,
                //     process: this.process,
                //   })
                // }
              }
              .width('79.1%')
              .height('90.7%')
              .backgroundColor($r('app.color.20FFFFFF'))
              .borderRadius($r('app.float.fontSize_16'))
            }

          }
        }
        .height('80%')
        .width('94.8%')
        .justifyContent(FlexAlign.SpaceBetween)

        // 底部按钮和抽屉
        Row() {
          Row({ space: 4 }) {
            Image($r('app.media.devices_all'))
              .width($r('app.float.virtualSize_24'))
              .height($r('app.float.virtualSize_24'))
            Text('查看设备')
              .fontColor($r('app.color.0A84FF'))
              .fontSize($r('app.float.fontSize_24'))
              .fontWeight(FontWeight.Medium)

          }
          .width('10%')
          .height('58.3%')
          .justifyContent(FlexAlign.Center)
          .backgroundColor($r('app.color.20FFFFFF'))
          .borderRadius($r('app.float.fontSize_16'))
          .onClick(() => {
            router.pushUrl({
              url: 'pages/CameraView'
            }).then(() => {
              console.log('跳转成功');
            }).catch((error: Error) => {
              console.error('跳转失败:', error);
            });
          })

          Row().width('1.5%')
          Row({ space: 4 }) {
            Image($r('app.media.error_upload'))
              .width($r('app.float.virtualSize_24'))
              .height($r('app.float.virtualSize_24'))
            Text('异常上报')
              .fontColor($r('app.color.0A84FF'))
              .fontSize($r('app.float.fontSize_24'))
              .fontWeight(FontWeight.Medium)
          }
          .width('10%')
          .height('58.3%')
          .justifyContent(FlexAlign.Center)
          .backgroundColor($r('app.color.20FFFFFF'))
          .borderRadius($r('app.float.fontSize_16'))
          .onClick(() => {
          })

          Row().width('68%')
          Row({ space: 4 }) {
            Image($r('app.media.process_switch'))
              .width($r('app.float.virtualSize_24'))
              .height($r('app.float.virtualSize_24'))
              .fillColor($r('app.color.0A84FF'))
            Text('切换产品')
              .fontColor($r('app.color.0A84FF'))
              .fontSize($r('app.float.fontSize_24'))
              .fontWeight(FontWeight.Medium)
          }
          .width('10%')
          .height('58.3%')
          .justifyContent(FlexAlign.Center)
          .backgroundColor($r('app.color.20FFFFFF'))
          .borderRadius($r('app.float.fontSize_16'))
        }
        .width('94.8%')
        .height('9.8%')
      }
      .width('100%')
      .height('100%')
      .backgroundColor($r('app.color.000000'))

        VoiceAssistant()

    }
    .height('100%')
    .width('100%')
  }
}

@Component
export struct InfoRow {
  label: string = ''
  @Prop value: string
  build() {
    Row() {
      Text(this.label)
        .fontWeight(FontWeight.Lighter)
        .fontColor($r('app.color.FFFFFF'))
        .fontSize($r('app.float.fontSize_16'))
        .width('30%')
      Row() {
        Text(this.value)
          .fontWeight(FontWeight.Regular)
          .fontColor($r('app.color.FFFFFF'))
          .fontSize($r('app.float.fontSize_16'))
      }
      .width( '70%')
      .justifyContent(FlexAlign.End)
    }
    .width('80%')
    .justifyContent(FlexAlign.Start)
  }
}

