|
@@ -8,6 +8,7 @@ import DictValue from '../../viewmodel/DictValue'
|
|
|
import ProcessDeviceDailyCheck from '../../viewmodel/process/ProcessDeviceDailyCheck'
|
|
|
import HashMap from '@ohos.util.HashMap'
|
|
|
import TimeUtil from '../../common/util/TimeUtil'
|
|
|
+import CommonConstants from '../../common/constants/CommonConstants'
|
|
|
|
|
|
// 设备点检工序
|
|
|
@Component
|
|
@@ -51,6 +52,7 @@ export struct DeviceCheckView {
|
|
|
async aboutToAppear() {
|
|
|
let deviceDicts: DictValue[] = await ProcessRequest.get(`/api/v1/sys/dictData/queryByType/${this.deviceTypeDictCode}`)
|
|
|
if (deviceDicts) {
|
|
|
+ this.deviceTypes = new HashMap()
|
|
|
for (const dict of deviceDicts) {
|
|
|
this.deviceTypes.set(dict.dictValue!, dict.dictLabel!);
|
|
|
}
|
|
@@ -96,7 +98,13 @@ export struct DeviceCheckView {
|
|
|
}
|
|
|
}
|
|
|
let check: ProcessDeviceDailyCheck = await ProcessRequest.get(`/api/v1/process/deviceDailyCheck/getServiceLifeByDeviceNo/${this.queryDeviceNo}`)
|
|
|
- this.deviceChecks.unshift(check)
|
|
|
+ check.stationIp = this.stationIp
|
|
|
+ await ProcessRequest.post('/api/v1/process/deviceDailyCheck/add', check)
|
|
|
+ this.deviceChecks = []
|
|
|
+ this.deviceChecks = await ProcessRequest.post('/api/v1/process/deviceCheck/queryAndSave', {
|
|
|
+ stationIp: this.stationIp,
|
|
|
+ processId: this.process.id!,
|
|
|
+ } as RequestParamModel)
|
|
|
})
|
|
|
.onChange((value: string) => {
|
|
|
this.queryDeviceNo = value;
|
|
@@ -116,19 +124,19 @@ export struct DeviceCheckView {
|
|
|
|
|
|
Column() {
|
|
|
List({scroller: this.scrollerDevice }) {
|
|
|
- ForEach(this.deviceChecks, (item: ProcessDeviceDailyCheck, index) => {
|
|
|
+ ForEach(this.deviceChecks, (item: ProcessDeviceDailyCheck) => {
|
|
|
ListItem() {
|
|
|
Row() {
|
|
|
Column(){
|
|
|
Text(this.deviceTypes && item.deviceType && this.deviceTypes.hasKey(item.deviceType) ? this.deviceTypes.get(item.deviceType) : '')
|
|
|
.fontSize($r('app.float.fontSize_24'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
- Text(`名称:${item.deviceName!}`)
|
|
|
+ Text('名称:' + item.deviceNo && item.deviceName ? item.deviceName : '')
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.fontWeight(FontWeight.Lighter)
|
|
|
.margin({top:'2%',bottom:'1%'})
|
|
|
- Text(`编码:${item.deviceNo!}`)
|
|
|
+ Text('编码:' + item.deviceNo ? item.deviceNo : '')
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.fontWeight(FontWeight.Lighter)
|
|
@@ -144,7 +152,7 @@ export struct DeviceCheckView {
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.fontWeight(FontWeight.Lighter)
|
|
|
- if (this.scanState === 1) {
|
|
|
+ if (this.scanState === 1 && item.deviceNo) {
|
|
|
Row(){
|
|
|
Image(item.meteringState! === 1 ? $r('app.media.device_normal') : $r('app.media.device_expire'))
|
|
|
.width($r('app.float.virtualSize_24'))
|
|
@@ -171,7 +179,7 @@ export struct DeviceCheckView {
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.fontWeight(FontWeight.Lighter)
|
|
|
- if (this.scanState === 1) {
|
|
|
+ if (this.scanState === 1 && item.deviceNo) {
|
|
|
Row() {
|
|
|
Image(item.warrantyState! === 1 ? $r('app.media.device_normal') : $r('app.media.device_expire'))
|
|
|
.width($r('app.float.virtualSize_24'))
|