import router from '@ohos.router'

@Entry
@Component
struct PanelMaintenanceInspection {
  @State private configuration:Array<configurationTable>=[
    {productName:'面板1号',testingItem:1,name:'旋转开挂-0档',onOffTest:1,diode:2,resistanceMin:1, resistanceMax:3,voltageMin:9,voltageMax:12,capacitanceMin:12,capacitanceMax:20,diodeSW:0,voltageSW:1,voltageAC:1,capacitanceSW:0,resistanceSW:1,}as configurationTable,
    {productName:'面板2号',testingItem:2,name:'旋转开挂-2档',onOffTest:0,diode:2,resistanceMin:1, resistanceMax:3,voltageMin:9,voltageMax:12, capacitanceMin:12,capacitanceMax:20,diodeSW:0,voltageSW:1,voltageAC:1,capacitanceSW:0,resistanceSW:1,}as configurationTable
  ]
  @State private newConfiguration:Array<configurationTable>=[
    { productName:'面板1号',testingItem:this.configuration.length+1,name:'旋转开挂-0档',onOffTest:0,diode:0,resistanceMin:0, resistanceMax:0,voltageMin:0,voltageMax:0,capacitanceMin:0,capacitanceMax:20,diodeSW:0,voltageSW:0,voltageAC:0,capacitanceSW:0,resistanceSW:1,}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 onOffTest: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,]
  ConfigurationTableController: CustomDialogController= new CustomDialogController({
    builder: ConfigurationTable({}),
    alignment: DialogAlignment.Center,
    customStyle:true,

  })
  //产品名称弹窗
  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)

              })
              Button('接线配置表')
                .width(px2vp(292))
                .height(px2vp(80))
                .margin({bottom:px2vp(40)})
                .onClick(()=>{
                  this.ConfigurationTableController.open()
                })

          }
          .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档',onOffTest:0,diode:0,resistanceMin:0, resistanceMax:0,voltageMin:0,voltageMax:0,capacitanceMin:0,capacitanceMax:20,diodeSW:0,voltageSW:0,voltageAC:0,capacitanceSW:0,resistanceSW:1,}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,
                      onOffTest:this.configuration[index].onOffTest,
                      diode:this.configuration[index].diode,
                      resistanceMin:this.configuration[index].resistanceMin,
                      resistanceMax:this.configuration[index].resistanceMax,
                      voltageMin:this.configuration[index].voltageMin,
                      voltageMax:this.configuration[index].voltageMax,
                      capacitanceMax:this.configuration[index].capacitanceMax,
                      capacitanceMin:this.configuration[index].capacitanceMin,
                    }
                    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('测试项1')
                        .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,
                              onOffTest:this.configuration[index-1].onOffTest,
                              diode:this.configuration[index-1].diode,
                              resistanceMin:this.configuration[index-1].resistanceMin,
                              resistanceMax:this.configuration[index-1].resistanceMax,
                              voltageMin:this.configuration[index-1].voltageMin,
                              voltageMax:this.configuration[index-1].voltageMax,
                              capacitanceMax:this.configuration[index-1].capacitanceMax,
                              capacitanceMin:this.configuration[index-1].capacitanceMin,
                            }
                            this.configuration[index-1]={
                              testingItem:temp.testingItem,
                              productName:temp.productName,
                              name:temp.name,
                              onOffTest:temp.onOffTest,
                              diode:temp.diode,
                              resistanceMin:temp.resistanceMin,
                              resistanceMax:temp.resistanceMax,
                              voltageMin:temp.voltageMin,
                              voltageMax:temp.voltageMax,
                              capacitanceMax:temp.capacitanceMax,
                              capacitanceMin:temp.capacitanceMin,
                            }
                          }
                        })

                      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,
                              onOffTest:this.configuration[index+1].onOffTest,
                              diode:this.configuration[index+1].diode,
                              resistanceMin:this.configuration[index+1].resistanceMin,
                              resistanceMax:this.configuration[index+1].resistanceMax,
                              voltageMin:this.configuration[index+1].voltageMin,
                              voltageMax:this.configuration[index+1].voltageMax,
                              capacitanceMax:this.configuration[index+1].capacitanceMax,
                              capacitanceMin:this.configuration[index+1].capacitanceMin,
                            }
                            this.configuration[index+1]={
                              testingItem:temp.testingItem,
                              productName:temp.productName,
                              name:temp.name,
                              onOffTest:temp.onOffTest,
                              diode:temp.diode,
                              resistanceMin:temp.resistanceMin,
                              resistanceMax:temp.resistanceMax,
                              voltageMin:temp.voltageMin,
                              voltageMax:temp.voltageMax,
                              capacitanceMax:temp.capacitanceMax,
                              capacitanceMin:temp.capacitanceMin,
                            }
                        })
                      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(){
                        Text('通断测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      Blank()
                      Toggle({ type: ToggleType.Switch, isOn: item.onOffTest===1?true:false })
                        .width(px2vp(72))
                        .height(px2vp(40))
                        .margin({right:px2vp(30)})
                        .onChange( (isOn: boolean) => {
                          if (isOn===true) {
                            this.configuration[index].onOffTest=1
                          }else if (isOn===false) {
                            this.configuration[index].onOffTest=0
                          }
                        })

                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(20),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('电阻测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      .width(px2vp(200))
                      .margin({right:px2vp(50)})
                      TextInput({ text: item.resistanceMin===0?'-':item.resistanceMin?.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].resistanceMin=Number(value)
                        })
                      Text('-')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .margin({right:px2vp(29)})
                      TextInput({ text: item.resistanceMax===0?'-':item.resistanceMax?.toString(), controller: this.controller })
                        .backgroundColor($r('app.color.white_100'))
                        .caretColor(Color.Blue)
                        .width(px2vp(98))
                        .height(px2vp(80))
                        .border({width:1})
                        .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].resistanceMax=Number(value)
                        })
                      Blank()
                      Toggle({ type: ToggleType.Switch, isOn: item.resistanceSW===1?true:false })
                        .width(px2vp(72))
                        .height(px2vp(40))
                        .margin({right:px2vp(30)})
                        .onChange( (isOn: boolean) => {
                          if (isOn===true) {
                            this.configuration[index].resistanceSW=1
                          }else if (isOn===false) {
                            this.configuration[index].resistanceSW=0
                          }
                        })

                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(20),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('电压测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      .width(px2vp(200))
                      .margin({right:px2vp(50)})
                      TextInput({ text: item.voltageMin===0?'-':item.voltageMin?.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].voltageMin=Number(value)
                        })
                      Text('-')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .margin({right:px2vp(29)})
                      TextInput({ text: item.voltageMax===0?'-':item.voltageMax?.toString(), controller: this.controller })
                        .backgroundColor($r('app.color.white_100'))
                        .caretColor(Color.Blue)
                        .width(px2vp(98))
                        .height(px2vp(80))
                        .border({width:1})
                        .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].voltageMax=Number(value)
                        })
                      Blank()
                      Radio({ value: '', group: 'radioGroup' })
                        .radioStyle({
                          checkedBackgroundColor: Color.Blue
                        })
                        .checked(false)
                        .height(px2vp(48))
                        .width(px2vp(48))
                        .onChange((isChecked: boolean) => {
                          if (isChecked===true) {
                            this.configuration[index].voltageAC=1
                          }else if (isChecked===false){
                            this.configuration[index].voltageAC=0
                          }
                          console.log('textTag'+this.configuration[index].voltageAC)
                        })
                      Text('AC')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .margin({right:px2vp(10)})
                      Radio({ value:'', group: 'radioGroup' })
                        .checked(true)
                        .radioStyle({
                          checkedBackgroundColor: Color.Blue
                        })
                        .height(px2vp(48))
                        .width(px2vp(48))
                        .onChange((isChecked: boolean) => {
                          if (isChecked===true) {
                            this.configuration[index].voltageAC=1
                          }else if (isChecked===false){
                            this.configuration[index].voltageAC=0
                          }
                          console.log('textTag'+this.configuration[index].voltageAC)
                        })
                      Text('DC')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .margin({right:px2vp(20)})
                      Toggle({ type: ToggleType.Switch, isOn: item.voltageSW===1?true:false })
                        .width(px2vp(72))

                        .height(px2vp(40))
                        .margin({right:px2vp(30)})
                        .onChange( (isOn: boolean) => {
                          if (isOn===true) {
                            this.configuration[index].voltageSW=1
                          }else if (isOn===false) {
                            this.configuration[index].voltageSW=0
                          }
                        })
                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(20),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('二极管测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))
                      }.padding({left:px2vp(30)})
                      .margin({right:px2vp(50)})
                      Text('小于')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .width(px2vp(200))
                        .textAlign(TextAlign.Center)
                        .margin({right:px2vp(20)})
                      TextInput({ text: item.diode===0?'-':item.diode?.toString(), controller: this.controller })
                        .backgroundColor($r('app.color.white_100'))
                        .caretColor(Color.Blue)
                        .width(px2vp(98))
                        .height(px2vp(80))
                        .border({width:1})
                        .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].diode=Number(value)
                        })
                      Blank()
                      Toggle({ type: ToggleType.Switch, isOn: item.capacitanceSW===1?true:false })
                        .width(px2vp(72))
                        .height(px2vp(40))
                        .margin({right:px2vp(30)})
                        .onChange( (isOn: boolean) => {
                          if (isOn===true) {
                            this.configuration[index].capacitanceSW=1
                          }else if (isOn===false) {
                            this.configuration[index].capacitanceSW=0
                          }
                        })
                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(20),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('电容测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))
                      }.padding({left:px2vp(30)})
                      .margin({right:px2vp(50)})
                      .width(px2vp(200))
                      TextInput({ text:item.capacitanceMin===0?'-': item.capacitanceMin?.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].capacitanceMin=Number(value)
                        })
                      Text('-')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .margin({right:px2vp(29)})
                      TextInput({ text: item.capacitanceMax===0?'-':item.capacitanceMax?.toString(), controller: this.controller })
                        .backgroundColor($r('app.color.white_100'))
                        .caretColor(Color.Blue)
                        .width(px2vp(98))
                        .height(px2vp(80))
                        .border({width:1})
                        .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].capacitanceMax=Number(value)
                        })
                      Blank()
                      Toggle({ type: ToggleType.Switch, isOn: item.diodeSW===1?true:false })
                        .width(px2vp(72))
                        .height(px2vp(40))
                        .margin({right:px2vp(30)})
                        .onChange( (isOn: boolean) => {
                          if (isOn===true) {
                            this.configuration[index].diodeSW=1
                          }else if (isOn===false) {
                            this.configuration[index].diodeSW=0
                          }
                        })
                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(20),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                  }
                  .backgroundColor($r('app.color.black_10'))
                  .width(px2vp(1058))
                  .height(px2vp(720))
                  .borderRadius($r('app.float.borderRadius_16'))
                  .margin({bottom:px2vp(20)})

                }
              })
            }
            .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('测试项1')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                      Text('旋钮开关-0挡')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .borderRadius(px2vp(76))
                        .padding({left:px2vp(30)})
                        .width(px2vp(292))
                        .height(px2vp(80))
                        .margin({right:px2vp(142),left:px2vp(20)})

                    }.width(px2vp(998))
                    .height(px2vp(80))
                    .alignItems(VerticalAlign.Center)
                    .margin({top:px2vp(20),left:px2vp(30)})
                    Row(){
                      Column(){
                        Text('通断测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      Blank()
                      Column(){
                        Text('X1-5')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.green_100'))
                        Text('连接器')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }
                      .margin({right:px2vp(30)})

                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(30),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('电阻测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      Blank()
                      Text('0.01')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .fontColor($r('app.color.black_100'))
                      Text('-')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                      Text('0.05')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .fontColor($r('app.color.black_100'))
                        .margin({right:px2vp(400)})
                      Column(){
                        Text('0.07')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.red_100'))
                        Text('测量值')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }
                      .margin({right:px2vp(30)})

                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(30),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('电压测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      Blank()
                      Text('0.01')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .fontColor($r('app.color.black_100'))
                      Text('-')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                      Text('0.05')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .fontColor($r('app.color.black_100'))
                        .margin({right:px2vp(120)})
                      Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
                        .radioStyle({
                          checkedBackgroundColor: Color.Blue
                        })
                        .height(px2vp(48))
                        .width(px2vp(48))
                        .onChange((isChecked: boolean) => {
                          console.log('Radio1 status is ' + isChecked)
                        })
                      Text('AC')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .margin({right:px2vp(30)})
                      Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
                        .radioStyle({
                          checkedBackgroundColor: Color.Blue
                        })
                        .height(px2vp(48))
                        .width(px2vp(48))
                        .onChange((isChecked: boolean) => {
                          console.log('Radio1 status is ' + isChecked)
                        })
                      Text('DC')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                        .margin({right:px2vp(25)})
                      Column(){
                        Text('等待')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('测量值')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }
                      .margin({right:px2vp(30)})

                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(30),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('二极管测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      Blank()

                      Text('小于')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                      Text('0.05')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .fontColor($r('app.color.black_100'))
                        .margin({right:px2vp(400)})
                      Column(){
                        Text('等待')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('测量值')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }
                      .margin({right:px2vp(30)})

                    }
                    .width(px2vp(1004))
                    .height(px2vp(100))
                    .borderRadius($r('app.float.borderRadius_16'))
                    .alignItems(VerticalAlign.Center)
                    .margin({left:px2vp(30),right:px2vp(20),bottom:px2vp(20)})
                    .backgroundColor($r('app.color.white_100'))
                    Row(){
                      Column(){
                        Text('电容测试')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('合格范围')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }.padding({left:px2vp(30)})
                      Blank()
                      Text('0.01')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .fontColor($r('app.color.black_100'))
                      Text('-')
                        .fontWeight(FontWeight.Medium)
                        .fontSize($r('app.float.fontSize_24'))
                        .fontColor(Color.Black)
                      Text('0.05')
                        .fontSize($r('app.float.fontSize_24'))
                        .fontWeight(FontWeight.Medium)
                        .fontColor($r('app.color.black_100'))
                        .margin({right:px2vp(400)})
                      Column(){
                        Text('等待')
                          .fontSize($r('app.float.fontSize_24'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.black_100'))
                        Text('测量值')
                          .fontSize($r('app.float.fontSize_20'))
                          .fontWeight(FontWeight.Medium)
                          .fontColor($r('app.color.gray_6666'))

                      }
                      .margin({right:px2vp(30)})

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


                  }.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 ConfigurationTable {
  @State text: string = '0.05'
  controller1: TextInputController = new TextInputController()
  controller: CustomDialogController
  build() {
    Column(){
      Text('接线配置表')
        .fontSize($r('app.float.fontSize_24'))
        .fontWeight(FontWeight.Medium)
        .fontColor($r('app.color.black_100'))
        .textAlign(TextAlign.Center)
        .margin({top:px2vp(43)})
      Row(){
        Button('新建')
          .width(px2vp(292))
          .height(px2vp(80))
          .margin({right:px2vp(171)})
        Button('保存')
          .width(px2vp(292))
          .height(px2vp(80))
          .onClick(()=>{
            this.controller.close()
          })

      }
      .height(px2vp(80))
      .margin({top:px2vp(52)})
      .justifyContent(FlexAlign.Center)
      Row(){
        Column(){
          Text('项目1')
            .fontSize($r('app.float.fontSize_24'))
            .fontWeight(FontWeight.Medium)
            .fontColor($r('app.color.black_100'))
            .textAlign(TextAlign.Start)
            .width('100%')
          Text('板卡：')
            .fontSize($r('app.float.fontSize_20'))
            .fontWeight(FontWeight.Regular)
            .fontColor($r('app.color.gray_6666'))
            .textAlign(TextAlign.Start)
            .width('100%')
            .margin({top:px2vp(20)})
          TextInput({ text: this.text, placeholder:'1',controller: this.controller1 })
            .caretColor(Color.Blue)
            .width(px2vp(292))
            .height(px2vp(80))
            .backgroundColor($r('app.color.white_100'))
            .border({width:1,color:$r('app.color.gray_979797')})
            .margin({right:px2vp(29)})
            .fontWeight(FontWeight.Medium)
            .fontSize($r('app.float.fontSize_24'))
            .fontColor(Color.Black)
            .inputFilter('[a-z]', (e) => {
              console.log(JSON.stringify(e))
            })
            .onChange((value: string) => {
              this.text = value
            })
          Text('连接器：')
            .fontSize($r('app.float.fontSize_20'))
            .fontWeight(FontWeight.Regular)
            .fontColor($r('app.color.gray_6666'))
            .textAlign(TextAlign.Start)
            .width('100%')
            .margin({top:px2vp(20)})
          TextInput({ text: this.text, placeholder:'1',controller: this.controller1 })
            .caretColor(Color.Blue)
            .width(px2vp(292))
            .height(px2vp(80))
            .backgroundColor($r('app.color.white_100'))
            .border({width:1,color:$r('app.color.gray_979797')})
            .margin({right:px2vp(29)})
            .fontWeight(FontWeight.Medium)
            .fontSize($r('app.float.fontSize_24'))
            .fontColor(Color.Black)
            .inputFilter('[a-z]', (e) => {
              console.log(JSON.stringify(e))
            })
            .onChange((value: string) => {
              this.text = value
            })



        }.width('50%')
        .padding({left:px2vp(60),top:px2vp(20)})
        .height(px2vp(370))
        Column(){
          Row(){
            Image($r("app.media.delete1"))
              .width(px2vp(48))
              .height(px2vp(48))
          }
          .justifyContent(FlexAlign.End)

          Text('板卡引角：')
            .fontSize($r('app.float.fontSize_20'))
            .fontWeight(FontWeight.Regular)
            .fontColor($r('app.color.gray_6666'))
            .textAlign(TextAlign.Start)
            .width('100%')
            .margin({top:px2vp(20)})
          TextInput({ text: this.text, placeholder:'1',controller: this.controller1 })
            .caretColor(Color.Blue)
            .width(px2vp(292))
            .height(px2vp(80))
            .backgroundColor($r('app.color.white_100'))
            .border({width:1,color:$r('app.color.gray_979797')})
            .margin({right:px2vp(29)})
            .fontWeight(FontWeight.Medium)
            .fontSize($r('app.float.fontSize_24'))
            .fontColor(Color.Black)
            .inputFilter('[a-z]', (e) => {
              console.log(JSON.stringify(e))
            })
            .onChange((value: string) => {
              this.text = value
            })
          Text('连接器引角：')
            .fontSize($r('app.float.fontSize_20'))
            .fontWeight(FontWeight.Regular)
            .fontColor($r('app.color.gray_6666'))
            .textAlign(TextAlign.Start)
            .width('100%')
            .margin({top:px2vp(20)})
          TextInput({ text: this.text, placeholder:'1',controller: this.controller1 })
            .caretColor(Color.Blue)
            .width(px2vp(292))
            .height(px2vp(80))
            .backgroundColor($r('app.color.white_100'))
            .border({width:1,color:$r('app.color.gray_979797')})
            .margin({right:px2vp(29)})
            .fontWeight(FontWeight.Medium)
            .fontSize($r('app.float.fontSize_24'))
            .fontColor(Color.Black)
            .inputFilter('[a-z]', (e) => {
              console.log(JSON.stringify(e))
            })
            .onChange((value: string) => {
              this.text = value
            })



        }.width('50%')
        .padding({left:px2vp(60),top:px2vp(20)})
        .height(px2vp(370))

      }
      .width(px2vp(756))
      .height(px2vp(346))
      .margin({top:px2vp(20)})
      .backgroundColor($r('app.color.white_f1f3f5'))


    }.width(px2vp(924))
    .height(px2vp(824))
    .borderRadius($r('app.float.borderRadius_16'))
    .backgroundColor($r('app.color.white_100'))
  }
}
@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
  //通断测试
  onOffTest?:number
  //二极管
  diode?:number
  //二极管测试开关
  diodeSW?:number
  //电容测试开关
  capacitanceSW?:number
  //电阻测试
  resistanceMin?:number
  resistanceMax?:number
  //电阻测试开关
  resistanceSW?:number

  //电压范围
  voltageMin?:number
  voltageMax?:number
  //电容测试
  capacitanceMin?:number
  capacitanceMax?:number
  //电压测试ad dc
  voltageAC?:number
  //电压测试开关
  voltageSW?:number

  
}
export class productName{
  //产品名字
  Name?:string
  //测试表
  configuration?:configurationTable[]
  //飞机编码
  aircraftNumber?:string
  //测试人员
  testingPersonnel?:string
  //测试时间
  testTime?:string

}