import router from '@ohos.router'


@Entry
@Component
struct PowerDetection {
  @State private configuration:Array<configurationTable>=[
    {productName:'电源1号',testingItem:1,name:'旋转开挂-0档',ratedVoltage:10,LOAD:2,loadRangeMin:1, loadRangeMax:3,InputVoltageMin:9,InputVoltageMax:12, currentLimiting:2,outputVoltageSW:0,outputCurrentSW:1,outputRippleSW:0,voltageRegulationSW:1,loadRateAdjustmentSW:0,voltageStabilizationSW:1,loadChannel:2}as configurationTable,
    {productName:'电源2号',testingItem:2,name:'旋转开挂-2档',ratedVoltage:10,LOAD:2,loadRangeMin:1, loadRangeMax:3,InputVoltageMin:9,InputVoltageMax:12, currentLimiting:2,outputVoltageSW:1,outputCurrentSW:0,outputRippleSW:1,voltageRegulationSW:0,loadRateAdjustmentSW:1,voltageStabilizationSW:0,loadChannel:2}as configurationTable
  ]
  @State private newConfiguration:Array<configurationTable>=[
    { productName:'电源1号',testingItem:this.configuration.length+1,name:'旋转开挂-0档',ratedVoltage:0,LOAD:0,loadRangeMin:0, loadRangeMax:0,InputVoltageMin:0,InputVoltageMax:0, currentLimiting:0,outputCurrent:0,outputRipple:0,voltageRegulation:0,outputVoltageSW:0,outputCurrentSW:0,outputRippleSW:0,voltageRegulationSW:0,loadRateAdjustmentSW:1,voltageStabilizationSW:0,loadChannel:0}as configurationTable
  ]
  @State index:number=0
  //执行
  @State execute:number=0
  //打开产品名称弹窗，0打开选择产品，1打开选择删除
  @State select:number=0
  @State text: string = '0.01'
  @State text1: string = '0.05'
  controller: TextInputController = new TextInputController()
  @State number1: string  ='1'
  @State index1: number = 2
  @State space: number = 8
  @State arrowPosition1: ArrowPosition = ArrowPosition.END
  //频率步进
  @State ratedVoltage:number=0
  @State click:number=0
  //时间
  @State coding:string=''
  //日期
  @State Date:string=''
  //产品名称
  @State productName:string=''
  //产品名称列表
  @State private product:Array<productName>=[
    { Name:"电源1号",configuration:[],aircraftNumber:'鲲鹏轰炸机-FG-J35',testingPersonnel:'国家统一',testTime:''} as productName,
    { Name:"电源2号",configuration:[],aircraftNumber:'',testingPersonnel:'',testTime:'' } as productName,
    { Name:"电源3号",configuration:[],aircraftNumber:'',testingPersonnel:'',testTime:'' } as productName,
    { Name:"电源4号",configuration:[],aircraftNumber:'',testingPersonnel:'',testTime:'' } as productName,
    { Name:"电源5号",configuration:[],aircraftNumber:'',testingPersonnel:'',testTime:''} as productName,
    { Name:"电源6号",configuration:[],aircraftNumber:'',testingPersonnel:'',testTime:'' } as productName,]
  //产品名称弹窗
  productController: CustomDialogController = new CustomDialogController({
    builder:namePopUp({
      index:this.index,
      select:this.select,
      product:this.product,
      productName:this.productName
    }),
    alignment: DialogAlignment.Center,
    customStyle:true,
    autoCancel:true,
  })
  //新建弹窗
  newBuiltController: CustomDialogController = new CustomDialogController({
    builder:newBuilt({
      product:this.product
    }),
    alignment: DialogAlignment.Center,
    customStyle:true,
    autoCancel:true,
  })
  //删除
  editController: CustomDialogController = new CustomDialogController({
    builder:edit({
      index:this.index,
      product:this.product
    }),
    alignment: DialogAlignment.Center,
    customStyle:true,
    autoCancel:true,
  })
  build() {
    Column() {
        Row() {
          Row() {
            Image($r('app.media.return'))
              .width(px2vp(48))
              .height(px2vp(48))
              .objectFit(ImageFit.Contain)
              .margin({ left: px2vp(40) })
          }.width(px2vp(500))
          .height(px2vp(80))
          .onClick(() => {
           router.back()
          })
          Blank()
          Column(){
            Row() {
              Text('配置')
                .fontSize($r('app.float.fontSize_24'))
                .fontWeight(FontWeight.Medium)
                .fontColor($r('app.color.black_100'))
                .textAlign(TextAlign.Center)
                .width(px2vp(292))
                .height(px2vp(80))
                .borderRadius($r('app.float.borderRadius_16'))
                .backgroundColor(this.click === 0 ? $r('app.color.white_100') : '')
                .onClick(() => {
                  this.click = 0
                })
              Blank()
              Text('执行')
                .fontSize($r('app.float.fontSize_24'))
                .fontWeight(FontWeight.Medium)
                .fontColor($r('app.color.black_100'))
                .textAlign(TextAlign.Center)
                .width(px2vp(292))
                .height(px2vp(80))
                .borderRadius($r('app.float.borderRadius_16'))
                .backgroundColor(this.click === 1 ? $r('app.color.white_100') : '')
                .onClick(() => {
                  this.click = 1
                })
            }
            .width(px2vp(608))
            .height(px2vp(80))
            .backgroundColor($r('app.color.black_10'))
            .borderRadius($r('app.float.borderRadius_16'))
          }
          .justifyContent(FlexAlign.Center)
          Blank()
          Row() {
            Blank()
            Image($r('app.media.homePage'))
              .margin({ right: px2vp(40) })
              .width(px2vp(48))
              .height(px2vp(48))
              .onClick(()=>{
                router.pushUrl({
                  url:'pages/Index'
                })
              })
            Image($r('app.media.news'))
              .margin({ right: px2vp(40) })
              .width(px2vp(48))
              .height(px2vp(48))
            Image($r('app.media.personal'))
              .margin({ right: px2vp(40) })
              .width(px2vp(48))
              .height(px2vp(48))
          }.width(px2vp(500))

        }.width(px2vp(1920))
        .height(px2vp(140))
        .alignItems(VerticalAlign.Center)


      if (this.click===0){
        Row(){
          Column(){
            Text('电源类维修检测系统')
              .fontSize($r('app.float.fontSize_30'))
              .fontWeight(FontWeight.Medium)
              .width('100%')
              .height(px2vp(30))
              .textAlign(TextAlign.Start)
              .margin({bottom:px2vp(57)})
            Text('产品：')
              .fontSize($r('app.float.fontSize_20'))
              .fontWeight(FontWeight.Regular)
              .width(px2vp(292))
              .height(px2vp(26))
              .textAlign(TextAlign.Start)
              .fontColor($r('app.color.gray_6666'))
            Row(){
              Text(this.product[this.index]?.Name)
                .width(px2vp(247))
                .height(px2vp(80))
                .fontWeight(FontWeight.Medium)
                .textAlign(TextAlign.Center)
                .fontSize($r('app.float.fontSize_24'))
              Column(){
                Image($r('app.media.subscript_space'))
                  .height(px2vp(45))
                  .width(px2vp(45))
              }
              .width(px2vp(12))
              .height(px2vp(80))
              .justifyContent(FlexAlign.End)

            } .border({width:1})
            .margin({bottom:px2vp(40),top:px2vp(8)})
            .width(px2vp(292))
            .borderRadius(px2vp(16))
            .height(px2vp(80))
            .onClick(()=>{
              this.select=0
              this.productController.open()
            })
            Button('编辑')
              .width(px2vp(292))
              .height(px2vp(80))
              .fontWeight(FontWeight.Medium)
              .fontSize($r('app.float.fontSize_24'))
              .margin({bottom:px2vp(40)})
              .onClick(()=>{
                this.editController.open()
              })

            Button('新建')
              .width(px2vp(292))
              .height(px2vp(80))
              .fontWeight(FontWeight.Medium)
              .fontSize($r('app.float.fontSize_24'))
              .margin({bottom:px2vp(40)})
              .onClick(()=>{
                this.newBuiltController.open()
              })
            Button('删除')
              .width(px2vp(292))
              .height(px2vp(80))
              .fontWeight(FontWeight.Medium)
              .fontSize($r('app.float.fontSize_24'))
              .fontColor($r('app.color.blue_100'))
              .backgroundColor($r('app.color.black_10'))
              .margin({bottom:px2vp(194)})
              .onClick(()=>{
                this.product.splice(this.index,1)

              })
          }
          .padding(px2vp(30))
          .width(px2vp(642))
          .height(px2vp(900))
          .borderRadius($r('app.float.borderRadius_16'))
          .alignItems(HorizontalAlign.Center)
          .backgroundColor($r('app.color.white_60'))
          Column(){
            Text('产品：')
              .fontSize($r('app.float.fontSize_20'))
              .fontWeight(FontWeight.Regular)
              .width('100%')
              .height(px2vp(26))
              .textAlign(TextAlign.Start)
              .fontColor($r('app.color.gray_6666'))
            Row(){
              Text(this.product[this.index]?.Name)
                .borderRadius(px2vp(76))
                .padding({left:px2vp(30)})
                .width(px2vp(292))
                .height(px2vp(80))
                .fontWeight(FontWeight.Medium)
                .margin({right:px2vp(142)})
              Button('新建')
                .width(px2vp(292))
                .fontSize($r('app.float.fontSize_24'))
                .height(px2vp(80))
                .margin({right:px2vp(40)})
                .onClick(()=>{

                  this.configuration.unshift({ productName:'电源1号',testingItem:this.configuration.length+1,name:'旋转开挂-0档',ratedVoltage:0,LOAD:0,loadRangeMin:0, loadRangeMax:0,InputVoltageMin:0,InputVoltageMax:0, currentLimiting:0,outputCurrent:0,outputRipple:0,voltageRegulation:0,outputVoltageSW:0,outputCurrentSW:0,outputRippleSW:0,voltageRegulationSW:0,loadRateAdjustmentSW:0,voltageStabilizationSW:0,loadChannel:0}as configurationTable)

                  console.log("textTag"+JSON.stringify(this.configuration))
                })
              Button('保存')
                .width(px2vp(292))
                .height(px2vp(80))
                .fontSize($r('app.float.fontSize_24'))
                .onClick(()=>{
                  for (let index = 0; index < this.configuration.length; index++) {
                    this.configuration[index]= {
                      testingItem:this.configuration[index].testingItem,
                      productName:this.configuration[index].productName,
                      name:this.configuration[index].name,
                      ratedVoltage:this.configuration[index].ratedVoltage,
                      LOAD:this.configuration[index].LOAD,
                      loadRangeMin:this.configuration[index].loadRangeMin,
                      loadRangeMax:this.configuration[index].loadRangeMax,
                      InputVoltageMin:this.configuration[index].InputVoltageMin,
                      InputVoltageMax:this.configuration[index].InputVoltageMax,
                      currentLimiting:this.configuration[index].currentLimiting,
                      outputCurrent:this.configuration[index].outputCurrent,
                      outputRipple:this.configuration[index].outputRipple,
                      voltageRegulation:this.configuration[index].voltageRegulation,
                      outputVoltageSW:this.configuration[index].outputVoltageSW,
                      outputCurrentSW:this.configuration[index].outputCurrentSW,
                      outputRippleSW:this.configuration[index].outputRippleSW,
                      voltageRegulationSW:this.configuration[index].voltageRegulationSW,
                      loadRateAdjustmentSW:this.configuration[index].loadRateAdjustmentSW,
                      voltageStabilizationSW:this.configuration[index].voltageStabilizationSW,
                      loadChannel:this.configuration[index].loadChannel,
                    }
                    console.log("textTag"+JSON.stringify(this.configuration))
                  }
                })


            }.width(px2vp(1058))
            .height(px2vp(80))

            List(){
              ForEach(this.configuration, (item:configurationTable ,index:number) => {
                ListItem() {
                  Column(){
                    Row(){
                      Text('测试项'+item.testingItem?.toString())
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                      TextInput({ text: item.name, controller: this.controller })
                        .backgroundColor($r('app.color.white_100'))
                        .caretColor(Color.Blue)
                        .width(px2vp(292))
                        .height(px2vp(80))
                        .borderRadius(px2vp(16))
                        .textAlign(TextAlign.Center)
                        .border({width:1})
                        .margin({left:px2vp(29)})
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .padding(0)
                        .onChange((value: string) => {
                          this.configuration[index].name = value
                        })
                      Blank()
                      Image($r('app.media.upper'))
                        .width(px2vp(48))
                        .height(px2vp(48))
                        .margin({right:px2vp(30)})
                        .onClick(()=>{
                          if (index!==0) {
                            const temp = this.configuration[index];
                            this.configuration[index]={
                              testingItem:this.configuration[index-1].testingItem,
                              productName:this.configuration[index-1].productName,
                              name:this.configuration[index-1].name,
                              ratedVoltage:this.configuration[index-1].ratedVoltage,
                              LOAD:this.configuration[index-1].LOAD,
                              loadRangeMin:this.configuration[index-1].loadRangeMin,
                              loadRangeMax:this.configuration[index-1].loadRangeMax,
                              InputVoltageMin:this.configuration[index-1].InputVoltageMin,
                              InputVoltageMax:this.configuration[index-1].InputVoltageMax,
                              currentLimiting:this.configuration[index-1].currentLimiting,
                              outputCurrent:this.configuration[index-1].outputCurrent,
                              outputRipple:this.configuration[index-1].outputRipple,
                              voltageRegulation:this.configuration[index-1].voltageRegulation,
                              outputVoltageSW:this.configuration[index-1].outputVoltageSW,
                              outputCurrentSW:this.configuration[index-1].outputCurrentSW,
                              outputRippleSW:this.configuration[index-1].outputRippleSW,
                              voltageRegulationSW:this.configuration[index-1].voltageRegulationSW,
                              loadRateAdjustmentSW:this.configuration[index-1].loadRateAdjustmentSW,
                              voltageStabilizationSW:this.configuration[index-1].voltageStabilizationSW,
                              loadChannel:this.configuration[index-1].loadChannel,
                            }
                            this.configuration[index-1]={
                              testingItem:temp.testingItem,
                              productName:temp.productName,
                              name:temp.name,
                              ratedVoltage:temp.ratedVoltage,
                              LOAD:temp.LOAD,
                              loadRangeMin:temp.loadRangeMin,
                              loadRangeMax:temp.loadRangeMax,
                              InputVoltageMin:temp.InputVoltageMin,
                              InputVoltageMax:temp.InputVoltageMax,
                              currentLimiting:temp.currentLimiting,
                              outputCurrent:temp.outputCurrent,
                              outputRipple:temp.outputRipple,
                              voltageRegulation:temp.voltageRegulation,
                              outputVoltageSW:temp.outputVoltageSW,
                              outputCurrentSW:temp.outputCurrentSW,
                              outputRippleSW:temp.outputRippleSW,
                              voltageRegulationSW:temp.voltageRegulationSW,
                              loadRateAdjustmentSW:temp.loadRateAdjustmentSW,
                              voltageStabilizationSW:temp.voltageStabilizationSW,
                              loadChannel:temp.loadChannel,
                            }
                          }
                        })
                      Image($r('app.media.lower'))
                        .width(px2vp(48))
                        .height(px2vp(48))
                        .margin({right:px2vp(30)})
                        .onClick(()=>{
                          const temp = this.configuration[index];
                          this.configuration[index]={
                            testingItem:this.configuration[index+1].testingItem,
                            productName:this.configuration[index+1].productName,
                            name:this.configuration[index+1].name,
                            ratedVoltage:this.configuration[index+1].ratedVoltage,
                            LOAD:this.configuration[index+1].LOAD,
                            loadRangeMin:this.configuration[index+1].loadRangeMin,
                            loadRangeMax:this.configuration[index+1].loadRangeMax,
                            InputVoltageMin:this.configuration[index+1].InputVoltageMin,
                            InputVoltageMax:this.configuration[index+1].InputVoltageMax,
                            currentLimiting:this.configuration[index+1].currentLimiting,
                            outputCurrent:this.configuration[index+1].outputCurrent,
                            outputRipple:this.configuration[index+1].outputRipple,
                            voltageRegulation:this.configuration[index+1].voltageRegulation,
                            outputVoltageSW:this.configuration[index+1].outputVoltageSW,
                            outputCurrentSW:this.configuration[index+1].outputCurrentSW,
                            outputRippleSW:this.configuration[index+1].outputRippleSW,
                            voltageRegulationSW:this.configuration[index+1].voltageRegulationSW,
                            loadRateAdjustmentSW:this.configuration[index+1].loadRateAdjustmentSW,
                            voltageStabilizationSW:this.configuration[index+1].voltageStabilizationSW,
                            loadChannel:this.configuration[index+1].loadChannel,
                          }
                          this.configuration[index+1]={
                            testingItem:temp.testingItem,
                            productName:temp.productName,
                            name:temp.name,
                            ratedVoltage:temp.ratedVoltage,
                            LOAD:temp.LOAD,
                            loadRangeMin:temp.loadRangeMin,
                            loadRangeMax:temp.loadRangeMax,
                            InputVoltageMin:temp.InputVoltageMin,
                            InputVoltageMax:temp.InputVoltageMax,
                            currentLimiting:temp.currentLimiting,
                            outputCurrent:temp.outputCurrent,
                            outputRipple:temp.outputRipple,
                            voltageRegulation:temp.voltageRegulation,
                            outputVoltageSW:temp.outputVoltageSW,
                            outputCurrentSW:temp.outputCurrentSW,
                            outputRippleSW:temp.outputRippleSW,
                            voltageRegulationSW:temp.voltageRegulationSW,
                            loadRateAdjustmentSW:temp.loadRateAdjustmentSW,
                            voltageStabilizationSW:temp.voltageStabilizationSW,
                            loadChannel:temp.loadChannel,
                          }
                        })
                      Image($r("app.media.delete"))
                        .width(px2vp(48))
                        .height(px2vp(48))
                        .onClick(()=>{
                          this.configuration.splice(index,1)
                        })


                    }.width(px2vp(998))
                    .height(px2vp(80))
                    .alignItems(VerticalAlign.Center)
                    .margin({top:px2vp(20),left:px2vp(30),bottom:px2vp(20)})
                    Row(){
                      Column(){
                        Row(){
                          Column(){
                            Text('输入额定电压')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(V)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)



                          }.width(px2vp(300))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          TextInput({ text: item.ratedVoltage===0?'-':item.ratedVoltage?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(29)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].ratedVoltage=Number(value)
                            })


                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        .alignItems(VerticalAlign.Center)
                        Row(){
                          Column(){
                            Text('负载电流')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(A)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)



                          }.width(px2vp(100))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          TextInput({ text: item.LOAD===0?'-':item.LOAD?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(29)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].LOAD=Number(value)
                            })


                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        .alignItems(VerticalAlign.Center)
                        Row(){
                          Column(){
                            Text('限流值')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(A)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)



                          }.width(px2vp(100))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          TextInput({ text: item.currentLimiting===0?'-':item.currentLimiting?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(29)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].currentLimiting=Number(value)
                            })


                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .alignItems(VerticalAlign.Center)


                      }.width(px2vp(482))
                      .height(px2vp(340))
                      .margin({right:px2vp(40)})
                      Column(){
                        Row(){
                          Column(){
                            Text('输入电压范围')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(V)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)

                          }.width(px2vp(160))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          TextInput({ text:item.InputVoltageMin===0?'-': item.InputVoltageMin?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(20)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].InputVoltageMin=Number(value)
                            })
                          Text('-')
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .margin({right:px2vp(20)})
                          TextInput({ text: item.InputVoltageMax===0?'-':item.InputVoltageMax?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(30)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].InputVoltageMax=Number(value)
                            })

                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        .alignItems(VerticalAlign.Center)
                        Row(){
                          Column(){
                            Text('负载范围')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(A)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)

                          }.width(px2vp(160))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          TextInput({ text: item.loadRangeMin===0?'-':item.loadRangeMin?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(20)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].loadRangeMin=Number(value)
                            })
                          Text('-')
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .margin({right:px2vp(20)})

                          TextInput({ text: item.loadRangeMax===0?'-':item.loadRangeMax?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(29)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].loadRangeMax=Number(value)
                            })



                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        .alignItems(VerticalAlign.Center)
                        Row(){
                          Column(){
                            Text('负载通道')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)

                          }.width(px2vp(100))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          TextInput({ text: item.loadChannel===0?'-':item.loadChannel?.toString(), controller: this.controller })
                            .backgroundColor($r('app.color.white_100'))
                            .caretColor(Color.Blue)
                            .width(px2vp(98))
                            .height(px2vp(80))
                            .border({width:1})
                            .margin({right:px2vp(29)})
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                            .padding(0)
                            .inputFilter('[(-999999)-999999]', () => {
                            })
                            .textAlign(TextAlign.Center)
                            .borderRadius(px2vp(16))
                            .onChange((value: string) => {
                              this.configuration[index].loadChannel=Number(value)
                            })



                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .alignItems(VerticalAlign.Center)



                      }.width(px2vp(482))
                      .height(px2vp(340))

                    }
                    .width(px2vp(1004))
                    .height(px2vp(340))
                    Column(){
                      Row(){
                        Row(){
                          Text('输出电压')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Toggle({ type: ToggleType.Switch, isOn: item.outputVoltageSW===1?true:false })
                            .width(px2vp(72))
                            .height(px2vp(40))
                            .margin({right:px2vp(30)})
                            .onChange( (isOn: boolean) => {
                              if (isOn===true) {
                                this.configuration[index].outputVoltageSW=1
                              }else if (isOn===false) {
                                this.configuration[index].outputVoltageSW=0
                              }
                            })

                        }
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('输出电流')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Toggle({ type: ToggleType.Switch, isOn: item.outputCurrentSW===1?true:false })
                            .width(px2vp(72))
                            .height(px2vp(40))
                            .margin({right:px2vp(30)})
                            .onChange( (isOn: boolean) => {
                              if (isOn===true) {
                                this.configuration[index].outputCurrentSW=1
                              }else if (isOn===false) {
                                this.configuration[index].outputCurrentSW=0
                              }
                            })

                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('输出纹波')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Toggle({ type: ToggleType.Switch, isOn: item.outputRippleSW===1?true:false })
                            .width(px2vp(72))
                            .height(px2vp(40))
                            .margin({right:px2vp(30)})
                            .onChange( (isOn: boolean) => {
                              if (isOn===true) {
                                this.configuration[index].outputRippleSW=1
                              }else if (isOn===false) {
                                this.configuration[index].outputRippleSW=0
                              }
                            })

                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))

                      } .width(px2vp(1004))
                      .height(px2vp(100))
                      .margin({bottom:px2vp(20),top:px2vp(20)})
                      Row(){
                        Row(){
                          Text('电压调整率')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Toggle({ type: ToggleType.Switch, isOn: item.voltageRegulationSW===1?true:false })
                            .width(px2vp(72))
                            .height(px2vp(40))
                            .margin({right:px2vp(30)})
                            .onChange( (isOn: boolean) => {
                              if (isOn===true) {
                                this.configuration[index].voltageRegulationSW=1
                              }else if (isOn===false) {
                                this.configuration[index].voltageRegulationSW=0
                              }
                            })

                        }
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('负载调整率')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Toggle({ type: ToggleType.Switch, isOn: item.loadRateAdjustmentSW===1?true:false })
                            .width(px2vp(72))
                            .height(px2vp(40))
                            .margin({right:px2vp(30)})
                            .onChange( (isOn: boolean) => {
                              if (isOn===true) {
                                this.configuration[index].loadRateAdjustmentSW=1
                              }else if (isOn===false) {
                                this.configuration[index].loadRateAdjustmentSW=0
                              }
                            })
                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('稳压精度')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                          Blank()
                          Toggle({ type: ToggleType.Switch, isOn: item.voltageStabilizationSW===1?true:false })
                            .width(px2vp(72))
                            .height(px2vp(40))
                            .margin({right:px2vp(30)})
                            .onChange( (isOn: boolean) => {
                              if (isOn===true) {
                                this.configuration[index].voltageStabilizationSW=1
                              }else if (isOn===false) {
                                this.configuration[index].voltageStabilizationSW=0
                              }
                            })
                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))

                      } .width(px2vp(1004))
                      .height(px2vp(100))
                      .margin({bottom:px2vp(20)})

                    }
                    .width(px2vp(1004))
                    .height(px2vp(220))




                  }.width(px2vp(1058))
                  .height(px2vp(720))
                  .margin({bottom:px2vp(20)})
                  .borderRadius($r('app.float.borderRadius_16'))
                  .backgroundColor($r('app.color.black_10'))


                }
              })
            }
            .width(px2vp(1058))
            .height(px2vp(720))
            .margin({top:px2vp(20)})


          }
          .padding(px2vp(30))
          .backgroundColor($r('app.color.white_60'))
          .width(px2vp(1118))
          .height(px2vp(900))
          .borderRadius($r('app.float.borderRadius_16'))
          .margin({left:px2vp(40)})
        }.width(px2vp(1800))
        .height(px2vp(900))
        .borderRadius($r('app.float.borderRadius_16'))
        .margin({left:px2vp(60),right:px2vp(60),bottom:px2vp(40)})

      }else if (this.click===1){
        Row(){
          Column(){
            Text('电源类维修检测系统')
              .fontSize($r('app.float.fontSize_30'))
              .fontWeight(FontWeight.Medium)
              .width('100%')
              .height(px2vp(30))
              .textAlign(TextAlign.Start)
              .margin({bottom:px2vp(57)})
            Text('产品：')
              .fontSize($r('app.float.fontSize_20'))
              .fontWeight(FontWeight.Regular)
              .width(px2vp(292))
              .height(px2vp(26))
              .textAlign(TextAlign.Start)
              .fontColor($r('app.color.gray_6666'))
            Row(){
              Text(this.product[this.index]?.Name)
                .width(px2vp(247))
                .height(px2vp(80))
                .fontWeight(FontWeight.Medium)
                .textAlign(TextAlign.Center)
                .fontSize($r('app.float.fontSize_24'))
              Column(){
                Image($r('app.media.subscript_space'))
                  .height(px2vp(45))
                  .width(px2vp(45))

              }
              .width(px2vp(12))
              .height(px2vp(80))
              .justifyContent(FlexAlign.End)

            } .border({width:1})
            .margin({bottom:px2vp(40),top:px2vp(8)})
            .width(px2vp(292))
            .borderRadius(px2vp(16))
            .height(px2vp(80))
            .onClick(()=>{
              this.select=0
              this.productController.open()
            })
            Text('飞机编号：')
              .fontSize($r('app.float.fontSize_20'))
              .fontWeight(FontWeight.Regular)
              .width(px2vp(292))
              .height(px2vp(26))
              .textAlign(TextAlign.Start)
              .fontColor($r('app.color.gray_6666'))
              .margin({bottom:px2vp(8)})
            TextInput({ text: this.product[this.index]?.aircraftNumber,controller: this.controller})
              .caretColor(Color.Blue)
              .width(px2vp(292))
              .height(px2vp(80))
              .backgroundColor($r('app.color.white_100'))
              .border({width:1})
              .margin({bottom:px2vp(20)})
              .fontWeight(FontWeight.Medium)
              .fontSize($r('app.float.fontSize_24'))
              .fontColor(Color.Black)
              .onChange((value: string) => {
                this.product[this.index].aircraftNumber = value
              })
            Text('测试人员：')
              .fontSize($r('app.float.fontSize_20'))
              .fontWeight(FontWeight.Regular)
              .width(px2vp(292))
              .height(px2vp(26))
              .textAlign(TextAlign.Start)
              .fontColor($r('app.color.gray_6666'))
              .margin({bottom:px2vp(8)})
            TextInput({ text:  this.product[this.index]?.testingPersonnel, controller: this.controller})
              .caretColor(Color.Blue)
              .width(px2vp(292))
              .height(px2vp(80))
              .backgroundColor($r('app.color.white_100'))
              .border({width:1})
              .margin({bottom:px2vp(20)})
              .fontWeight(FontWeight.Medium)
              .fontSize($r('app.float.fontSize_24'))
              .fontColor(Color.Black)
              .onChange((value: string) => {
                this.product[this.index].testingPersonnel = value
              })
            Text('测试时间：')
              .fontSize($r('app.float.fontSize_20'))
              .fontWeight(FontWeight.Regular)
              .width(px2vp(292))
              .height(px2vp(26))
              .textAlign(TextAlign.Start)
              .fontColor($r('app.color.gray_6666'))
              .margin({bottom:px2vp(8)})
            Text( this.product[this.index].testTime)
              .fontWeight(FontWeight.Medium)
              .fontSize($r('app.float.fontSize_24'))
              .width(px2vp(292))
              .height(px2vp(26))
            Blank()
            Button('执行')
              .width(px2vp(292))
              .height(px2vp(80))
              .backgroundColor($r('app.color.green_100'))
              .onClick(()=>{
                if (this.execute===0) {
                  this.execute=1
                  //日期时间
                  let dateTime = new Date()
                  let coding = dateTime.getFullYear() +'-'+ (dateTime.getMonth() + 1).toString().padStart(2, '0')
                    +'-'+  (dateTime.getDate().toString().padStart(2, '0')) +'   '+
                  (dateTime.getHours()).toString().padStart(2, '0')+':'+(dateTime.getMinutes() + 1).toString().padStart(2, '0')
                    +':'+(dateTime.getSeconds() ).toString().padStart(2, '0')
                  this.product[this.index].testTime=coding
                  this.product[this.index]={
                    Name:this.product[this.index].Name,
                    testingPersonnel:this.product[this.index]?.testingPersonnel,
                    aircraftNumber:this.product[this.index]?.aircraftNumber,
                    testTime:this.product[this.index]?.testTime,
                    configuration:this.product[this.index]?.configuration
                  }as productName
                  console.log("textTag"+JSON.stringify(this.product))
                }else if (this.execute===1){
                  this.execute=0
                }

              })

          }
          .padding(px2vp(30))
          .width(px2vp(642))
          .height(px2vp(900))
          .borderRadius($r('app.float.borderRadius_16'))
          .alignItems(HorizontalAlign.Center)
          .backgroundColor($r('app.color.white_60'))
          Column(){
            List() {
              ForEach(this.configuration, (item: configurationTable, index: number) => {
                ListItem() {
                  Column(){
                    Row(){
                      Text('测试项'+item.testingItem?.toString())
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                      Text(item.name)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .borderRadius(px2vp(76))
                        .padding({left:px2vp(30)})
                        .border({width:1})
                        .width(px2vp(292))
                        .height(px2vp(80))
                        .margin({right:px2vp(142),left:px2vp(20)})
                      Blank()


                    }.width(px2vp(1004))
                    .height(px2vp(80))
                    .alignItems(VerticalAlign.Center)
                    .margin({top:px2vp(20),left:px2vp(30),bottom:px2vp(20)})
                    Row(){
                      Column(){
                        Row(){
                          Column(){
                            Text('输入额定电压')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(V)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                          }.width(px2vp(150))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          Text(item.ratedVoltage?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        .alignItems(VerticalAlign.Center)
                        Row(){
                          Column(){
                            Text('负载电流')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(A)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)



                          }.width(px2vp(150))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          Text(item.LOAD?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)



                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        Row(){
                          Column(){
                            Text('限流值')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(A)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)



                          }.width(px2vp(100))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          Text(item.currentLimiting?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)


                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .alignItems(VerticalAlign.Center)



                      }.width(px2vp(482))
                      .height(px2vp(340))
                      .margin({right:px2vp(40)})
                      Column(){
                        Row(){
                          Column(){
                            Text('输入电压范围')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(V)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)

                          }.width(px2vp(100))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          Text(item.InputVoltageMin?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)

                          Text('-')
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                          Text(item.InputVoltageMax?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)



                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        .alignItems(VerticalAlign.Center)
                        Row(){
                          Column(){
                            Text('负载范围')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)
                            Text('(A)')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)

                          }.width(px2vp(100))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          Text(item.loadRangeMin?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Text('-')
                            .fontWeight(FontWeight.Medium)
                            .fontSize($r('app.float.fontSize_24'))
                            .fontColor(Color.Black)
                          Text(item.loadRangeMax?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)


                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .margin({bottom:px2vp(20)})
                        .alignItems(VerticalAlign.Center)
                        Row(){
                          Column(){
                            Text('负载通道')
                              .fontSize($r('app.float.fontSize_24'))
                              .fontWeight(FontWeight.Medium)
                              .width('100%')
                              .height(px2vp(30))
                              .textAlign(TextAlign.Start)

                          }.width(px2vp(100))
                          .height(px2vp(100))
                          .justifyContent(FlexAlign.Center)
                          Blank()
                          Text(item.loadChannel?.toString())
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)


                        }.width(px2vp(482))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        .backgroundColor($r('app.color.white_100'))
                        .alignItems(VerticalAlign.Center)

                      }.width(px2vp(482))
                      .height(px2vp(340))

                    }
                    .width(px2vp(1004))
                    .height(px2vp(340))
                    .alignItems(VerticalAlign.Center)
                    Column(){
                      Row(){
                        Row(){
                          Text('输出电压')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Text('合格')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .width(px2vp(85))
                            .textAlign(TextAlign.Center)
                            .borderRadius($r('app.float.borderRadius_16'))
                            .backgroundColor($r('app.color.green_100'))
                        }
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('输出电流')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Text('合格')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .width(px2vp(85))
                            .textAlign(TextAlign.Center)
                            .borderRadius($r('app.float.borderRadius_16'))
                            .backgroundColor($r('app.color.green_100'))
                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('输出纹波')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Text('合格')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .width(px2vp(85))
                            .textAlign(TextAlign.Center)
                            .borderRadius($r('app.float.borderRadius_16'))
                            .backgroundColor($r('app.color.green_100'))
                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))

                      } .width(px2vp(1004))
                      .height(px2vp(100))
                      .margin({bottom:px2vp(20),top:px2vp(20)})
                      Row(){
                        Row(){
                          Text('电压调整率')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Text('待检测')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .width(px2vp(85))
                            .textAlign(TextAlign.Center)
                            .borderRadius($r('app.float.borderRadius_16'))
                            .backgroundColor($r('app.color.grey_100'))
                        }
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('负载调整率')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Text('待检测')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .width(px2vp(85))
                            .textAlign(TextAlign.Center)
                            .borderRadius($r('app.float.borderRadius_16'))
                            .backgroundColor($r('app.color.grey_100'))
                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))
                        Row(){
                          Text('稳压精度')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .textAlign(TextAlign.Start)
                          Blank()
                          Text('待检测')
                            .fontSize($r('app.float.fontSize_24'))
                            .fontWeight(FontWeight.Medium)
                            .height(px2vp(30))
                            .width(px2vp(85))
                            .textAlign(TextAlign.Center)
                            .borderRadius($r('app.float.borderRadius_16'))

                            .backgroundColor($r('app.color.grey_100'))
                        }
                        .backgroundColor($r('app.color.white_100'))
                        .width(px2vp(308))
                        .height(px2vp(100))
                        .padding({left:px2vp(30),right:px2vp(30)})
                        .margin({right:px2vp(40)})
                        .borderRadius($r('app.float.borderRadius_16'))

                      } .width(px2vp(1004))
                      .height(px2vp(100))
                      .margin({bottom:px2vp(20)})

                    }
                    .width(px2vp(1004))
                    .height(px2vp(220))




                  }.width(px2vp(1058))
                  .height(px2vp(720))
                  .margin({top:px2vp(20)})
                  .borderRadius($r('app.float.borderRadius_16'))
                  .backgroundColor($r('app.color.black_10'))
                }
              })
            }.width(px2vp(1058))
            .height(px2vp(740))


            Blank()
            Button('保存数据')
              .width(px2vp(292))
              .height(px2vp(80))
              .onClick(()=>{

              })
          }
          .padding(px2vp(30))
          .backgroundColor($r('app.color.white_60'))
          .width(px2vp(1118))
          .height(px2vp(900))
          .borderRadius($r('app.float.borderRadius_16'))
          .margin({left:px2vp(40)})

        }.width(px2vp(1800))
        .height(px2vp(900))
        .borderRadius($r('app.float.borderRadius_16'))
        .margin({left:px2vp(60),right:px2vp(60),bottom:px2vp(40)})
      }
    }
      .width(px2vp(1920))
      .height(px2vp(1080))
      .backgroundImage($r('app.media.BG_two'))
  }
}
@CustomDialog
struct namePopUp {
  @Link index:number
  @Link select:number
  scroller: Scroller = new Scroller()
  @Link product:productName[]
  @Link productName:string
  controller: CustomDialogController
  build() {
    Column(){
      Text('产品名称')
        .fontSize($r('app.float.fontSize_30'))
        .fontWeight(FontWeight.Medium)
        .height(px2vp(50))
        .margin({bottom:px2vp(20)})
      List({space:px2vp(20)}){
        ForEach(this.product, (item:productName,index:number) => {
          ListItem(){
            Row(){
              Text(item.Name)
                .fontWeight(FontWeight.Medium)
                .fontSize($r('app.float.fontSize_24'))
                .width(px2vp(500))
                .height(px2vp(80))
                .textAlign(TextAlign.Center)
                .borderRadius(px2vp(16))
                .onClick(()=>{
                  this.index=index
                  this.productName=item.Name!
                  this.controller.close()
                })
            }
            .backgroundColor($r('app.color.white_f1f3f5'))
            .borderRadius(px2vp(16))
            .width(px2vp(600))
            .height(px2vp(80))
            .justifyContent(FlexAlign.Center)
          }

        })
      }
      .scrollBar(BarState.Off)
      .width(px2vp(600))
      .height(px2vp(430))


    }.width(px2vp(700))
    .height(px2vp(500))
    .borderRadius(px2vp(16))
    .backgroundColor($r('app.color.white_100'))
    .alignItems(HorizontalAlign.Center)
  }
}
//新建
@CustomDialog
struct newBuilt {
  @State private newProduct:Array<newProductClass>=[{Name:'',testingPersonnel:'',testTime:'',configuration:[]}as newProductClass]
  scroller: Scroller = new Scroller()
  @Link product: productName[]
  CustomDialogController: CustomDialogController
  @State Name: string = ''
  controller: TextInputController = new TextInputController()

  build() {
    Column() {
      Text('新建产品名称')
        .fontSize($r('app.float.fontSize_30'))
        .fontWeight(FontWeight.Medium)
        .margin({top:px2vp(20)})
        .height(px2vp(60))
      TextInput({ text: this.Name, placeholder: '请输入产品名称', controller: this.controller })
        .placeholderColor(Color.Grey)
        .placeholderFont({ size: 14, weight: px2vp(400) })
        .caretColor(Color.Blue)
        .width('95%')
        .height(px2vp(80))
        .margin(px2vp(20))
        .fontSize(14)
        .fontColor(Color.Black)
        .onChange((value: string) => {
          this.Name = value
        })
      Row({space:px2vp(24)}){
        Button('取消')
          .width(px2vp(292))
          .height(px2vp(80))
          .onClick(()=>{
            this.CustomDialogController.close()
          })
        Button('确认')
          .width(px2vp(292))
          .height(px2vp(80))
          .onClick(()=>{
            this.newProduct[0]= { Name: this.Name,
              aircraftNumber:this.newProduct[0].aircraftNumber,
              testingPersonnel:this.newProduct[0].testingPersonnel,
              testTime:this.newProduct[0].testTime,
            }
            this.product.unshift(this.newProduct[0]= { Name: this.Name,
              aircraftNumber:this.newProduct[0].aircraftNumber,
              testingPersonnel:this.newProduct[0].testingPersonnel,
              testTime:this.newProduct[0].testTime,
            })
            console.log('textTag'+'+++++'+ JSON.stringify(this.product))
            this.CustomDialogController.close()
          })

      }.width(px2vp(700))
      .height(px2vp(80))
      .alignItems(VerticalAlign.Center)
      .justifyContent(FlexAlign.Center)

    }.width(px2vp(700))
    .height(px2vp(300))
    .borderRadius(px2vp(16))
    .backgroundColor($r('app.color.white_100'))
    .alignItems(HorizontalAlign.Center)
  }
}
//编辑
@CustomDialog
struct edit {
  @Link index:number
  @State private newProduct:Array<newProductClass>=[]
  scroller: Scroller = new Scroller()
  @Link product: productName[]
  CustomDialogController: CustomDialogController
  @State Name: string = ''
  controller: TextInputController = new TextInputController()

  build() {
    Column() {
      Text('编辑产品名称')
        .fontSize($r('app.float.fontSize_30'))
        .fontWeight(FontWeight.Medium)
        .margin({top:px2vp(20)})
        .height(px2vp(60))

      TextInput({ text: this.product[this.index].Name, placeholder:this.product[this.index].Name, controller: this.controller })
        .placeholderColor(Color.Grey)
        .placeholderFont({ size: 14, weight: px2vp(400) })
        .caretColor(Color.Blue)
        .width('95%')
        .height(px2vp(80))
        .margin(px2vp(20))
        .fontSize(14)
        .fontColor(Color.Black)
        .onChange((value: string) => {
          this.Name = value
        })
      Row({space:px2vp(24)}){
        Button('取消')
          .width(px2vp(292))
          .height(px2vp(80))
          .onClick(()=>{
            this.CustomDialogController.close()
          })
        Button('确认')
          .width(px2vp(292))
          .height(px2vp(80))
          .onClick(()=>{
            this.product[this.index]= { Name: this.Name }
            console.log('textTag'+'+++++'+ JSON.stringify(this.product))
            this.CustomDialogController.close()
          })

      }.width(px2vp(700))
      .height(px2vp(80))
      .alignItems(VerticalAlign.Center)
      .justifyContent(FlexAlign.Center)

    }.width(px2vp(700))
    .height(px2vp(300))
    .borderRadius(px2vp(16))
    .backgroundColor($r('app.color.white_100'))
    .alignItems(HorizontalAlign.Center)
  }
}
export class newProductClass{
  Name?:string
  configuration?:configurationTable[]
  aircraftNumber?:string
  testingPersonnel?:string
  testTime?:string
}
////电源类测试表
export class  configurationTable{
  //测试项
  testingItem?:number
  //产品名称
  productName?:string
  //测试项名字
  name?:string
  //输入额定电压
  ratedVoltage?:number
  //负载电流
  LOAD?:number
  //负载范围
  loadRangeMin?:number
  loadRangeMax?:number
  //输入电压范围
  InputVoltageMin?:number
  InputVoltageMax?:number
  //限流值
  currentLimiting?:number
  //负载通道
  loadChannel?:number
  //输出电压
  outputVoltage?:number
  //输出电压开关
  outputVoltageSW?:number
  //输出电流
  outputCurrent?:number
  //输出电流开关
  outputCurrentSW?:number
  //输出纹波
  outputRipple?:number
  //输出纹波开关
  outputRippleSW?:number
  //电压调整率
  voltageRegulation?:number
  //电压调整率开关
  voltageRegulationSW?:number
  //负载率调整
  loadRateAdjustment?:number
  //负载率调整开关
  loadRateAdjustmentSW?:number
  //稳压精度
  voltageStabilization?:number
  //稳压精度开关
  voltageStabilizationSW?:number
}
export class productName{
  //产品名字
  Name?:string
  //测试表
  configuration?:configurationTable[]
  //飞机编码
  aircraftNumber?:string
  //测试人员
  testingPersonnel?:string
  //测试时间
  testTime?:string

}