关于ts一些乱七八糟的代码

// // mycode-------------------------------------------------------------------------

// interface Person {

//   VehicleOid: string

//   VehicleNumber: string

//   VehicleName: string

//   BelongLine: string

//   DrivingDirection: string

//   CurrStation: string

//   Elapse: string

//   VehicleParameterLabels: {

//     labelName: string

//     labelValue: string

//     labelValue_ZH: string

//   }[]

// }

// interface NameAndAge {

//   VehicleOid: string

//   index: string

//   trainDirection: string

//   // trainSpeed: string // 车辆速度

//   // state: string // 车辆状态

//   // runningMode: string // 列车运行模式(编码)   {1: ATO模式;2: ATB模式;3: 洗车模式; 4:人工模式}

//   // nextStation: string // 该车辆下一站

//   // currentStationName: string// 该车辆当前站

//   // nextStationName: string // 该车辆下一站名字

// }

// const people: Person[] = [

//   {

//     VehicleOid: '3E32C5EAA3309E44ABBC5AE7D928C609',

//     VehicleNumber: '1035',

//     VehicleName: '1035',

//     BelongLine: 'C0C42CD4B1E2CE4CB73104ED8E3134B1',

//     DrivingDirection: 'Up',

//     CurrStation: '1航站楼',

//     Elapse: '54s',

//     VehicleParameterLabels: [

//       {

//         labelName: '列车速度',

//         labelValue: '31',

//         labelValue_ZH: '31 km/h',

//       },

//       {

//         labelName: '运行模式',

//         labelValue: '4',

//         labelValue_ZH: '人工模式',

//       },

//       {

//         labelName: '当前站',

//         labelValue: '4',

//         labelValue_ZH: '1航站楼',

//       },

//       {

//         labelName: '下一站',

//         labelValue: '5',

//         labelValue_ZH: '2航站楼',

//       },

//       {

//         labelName: '故障等级',

//         labelValue: '0',

//         labelValue_ZH: '正常',

//       },

//     ],

//   },

// ]

// // 使用.map()并指定返回类型为NameAndAge[]

// const namesAndAges: NameAndAge[] = people.map(person => ({

//   VehicleOid: person.VehicleOid,

//   index: person.VehicleNumber,

//   trainDirection: person.DrivingDirection,

// }))

// const VArr: {

//   labelName: string

//   labelValue: string

//   labelValue_ZH: string

// }[] = people.map(Vitem => Vitem.VehicleParameterLabels)

// const trainSpeed = computed(() => {

//   return VArr.flat().filter(item => item.labelName === '列车速度').map(mitem => mitem.labelValue)

// })

// const state = computed(() => {

//   return VArr.flat().filter(item => item.labelName === '故障等级').map(mitem => mitem.labelValue)

// })

// const runningMode = computed(() => {

//   return VArr.flat().filter(item => item.labelName === '运行模式').map(mitem => mitem.labelValue)

// })

// const nextStation = computed(() => {

//   return VArr.flat().filter(item => item.labelName === '下一站').map(mitem => mitem.labelValue)

// })

// const nextStationName = computed(() => {

//   return VArr.flat().filter(item => item.labelName === '下一站').map(mitem => mitem.labelValue_ZH)

// })

// const currentStationName = computed(() => {

//   return VArr.flat().filter(item => item.labelName === '当前站').map(mitem => mitem.labelValue)

// })

// interface RES {

//   TrainSpeed: string // 车辆速度

//   State: string // 车辆状态

//   RunningMode: string // 列车运行模式(编码)   {1: ATO模式;2: ATB模式;3: 洗车模式; 4:人工模式}

//   NextStation: string // 该车辆下一站

//   CurrentStationName: string// 该车辆当前站

//   NextStationName: string // 该车辆下一站名字

// }

// interface RES1 {

//   trainSpeed: string // 车辆速度

//   state: string // 车辆状态

//   runningMode: string // 列车运行模式(编码)   {1: ATO模式;2: ATB模式;3: 洗车模式; 4:人工模式}

//   nextStation: string // 该车辆下一站

//   currentStationName: string// 该车辆当前站

//   nextStationName: string // 该车辆下一站名字

// }

// // {trainSpeed: string,state: string,runningMode: string,nextStation: string,currentStationName: string,nextStationName: string}

// const resArr: Array<{ TrainSpeed: string, State: string, RunningMode: string, NextStation: string, CurrentStationName: string, NextStationName: string }> = [...trainSpeed.value, ...state.value, ...runningMode.value, ...nextStation.value, ...nextStationName.value, ...currentStationName.value]

// const resArr1: Array<{ trainSpeed: string, state: string, runningMode: string, nextStation: string, currentStationName: string, nextStationName: string }> = resArr.map((item) => {

//   if (!item)

//     return []

//   return {

//     trainSpeed: item.TrainSpeed,

//     state: item.State,

//     runningMode: item.RunningMode,

//     nextStation: item.NextStation,

//     currentStationName: item.CurrentStationName,

//     nextStationName: item.NextStationName,

//   }

// })

// watchEffect(() => {

//   console.log(namesAndAges, 'val')

//   console.log(VArr.flat(), '33')

//   // console.log(trainSpeed.value, '33') // 列车速度

//   // console.log(state.value, '33') // 车辆状态

//   // console.log(runningMode.value, '33') // 列车模式

//   // console.log(nextStation.value, '33') // 下一站

//   // console.log(nextStationName.value, '33') // 下一站

//   // console.log(currentStationName.value, '33') // 下一站

//   console.log(resArr, '33')

//   console.log(resArr1, '33')

// })

// // mycode---------------------------------------------------------------------------

  • 6
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值