|
@@ -22,6 +22,20 @@ export class HardwareModel {
|
|
|
station?: string //"工站/工位",
|
|
|
devicePosition?: string // "空间位置,目前暂时不用",
|
|
|
data?: HardwareModel[]
|
|
|
+ enable?: boolean | string //是否启用了设备
|
|
|
+ imageSource?: ResourceStr
|
|
|
+}
|
|
|
+
|
|
|
+interface ImageDictModel {
|
|
|
+ sansedeng: ResourceStr
|
|
|
+ saomaqiang: ResourceStr
|
|
|
+ diannengbiao: ResourceStr
|
|
|
+ multimeter: ResourceStr
|
|
|
+ dukaqi: ResourceStr
|
|
|
+ chengkongdianyuan: ResourceStr
|
|
|
+ shukongdian: ResourceStr
|
|
|
+ diandongluosidao: ResourceStr
|
|
|
+ zhaomingdeng: ResourceStr
|
|
|
}
|
|
|
|
|
|
|
|
@@ -41,11 +55,23 @@ struct StationDevicesPage {
|
|
|
// deviceName: "三色灯"
|
|
|
// }
|
|
|
]
|
|
|
+ imageDict: ImageDictModel = {
|
|
|
+ sansedeng: $r("app.media.sansedeng"),
|
|
|
+ saomaqiang: $r('app.media.saomaqiang'),
|
|
|
+ diannengbiao: $r('app.media.diannengbiao'),
|
|
|
+ multimeter: $r('app.media.multimeter'),
|
|
|
+ dukaqi: $r('app.media.dukaqi'),
|
|
|
+ chengkongdianyuan: $r('app.media.chengkongdianyuan'),
|
|
|
+ shukongdian: $r('app.media.shukongdian'),
|
|
|
+ diandongluosidao: $r('app.media.diandongluosidao'),
|
|
|
+ zhaomingdeng: $r('app.media.zhaomingdeng')
|
|
|
+ }
|
|
|
scroller: Scroller = new Scroller()
|
|
|
getDeviceList = async () => {
|
|
|
let res: HardwareModel = await EquipmentRequest.get('/api/v1/device/list') as HardwareModel
|
|
|
this.items = res?.data?.filter((device) => {
|
|
|
- return device.state! === 0
|
|
|
+ device.imageSource = Reflect.get(this.imageDict, device.devicePic!)
|
|
|
+ return device.enable! === true || device.enable! === "true"
|
|
|
}) ?? []
|
|
|
}
|
|
|
// 点击选择了设备之后
|
|
@@ -104,7 +130,7 @@ struct StationDevicesPage {
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
.fontSize($r('app.float.fontSize_20'))
|
|
|
Row() {
|
|
|
- Image($r(`app.media.${item.devicePic}`))
|
|
|
+ Image(item.imageSource)
|
|
|
.width(px2vp(120))
|
|
|
.height(px2vp(120))
|
|
|
.margin({ top: 40 })
|
|
@@ -291,12 +317,13 @@ struct ThreeColorsLight {
|
|
|
toOperation = (m: SSDModel) => {
|
|
|
console.log("toOperation", JSON.stringify(m))
|
|
|
let data: SSDParamsData = {
|
|
|
- lighting: 'off',
|
|
|
- buzzer: 'off',
|
|
|
- flash: 'off'
|
|
|
+ lighting: '',
|
|
|
+ buzzer: '',
|
|
|
+ flash: ''
|
|
|
}
|
|
|
|
|
|
Reflect.set(data, m.key, m.value)
|
|
|
+
|
|
|
|
|
|
console.log("toOperation", JSON.stringify(data))
|
|
|
|