RecordsHome.ets 5.7 KB
import { InitData } from '../api/recordsType'
import {  getMaintenanceType } from '../api/originalRecords'
import { InitFirstPartySign } from '../api/recordsType'
import { quarterTest, quarterType } from '../api/options/optionsType'
import { AxiosResponse } from '@ohos/axios'
import  { HmParseHTML } from "@wuyan/html_parse"
import baseUrl from '../utils/baseUrl'
@Component
export default struct RecordsHome {
  @Prop info: InitData
  // 记录类型列表
  @State maintenanceTypeList: quarterType[] = []
  // 获取类型
  getType = (arr: quarterType[], value: string): string => {
    const newValue = arr.filter((item: quarterType) => item.dictValue == value)
    return newValue[0]?.dictLabel || '月度'
  }
  // 获取时间范围
  getTimeFrame = (startTime: string | null | undefined, endTime: string | null | undefined) => {
    if(startTime != null && endTime != null){
      return `${startTime} 至 ${endTime}`
    } else if(startTime != null) {
      return startTime
    } else {
      return ''
    }
  }
  // 获取签名
  getSign = (index: number) => {
    if(this.info.signList) {
      let signList: InitFirstPartySign[] = this.info.signList
      return baseUrl + signList[index]?.signPic
    } else {
      return ''
    }
  }
  // 获取签名
  getFirstSign = (index: number) => {
    if(this.info.firstPartySign) {
      let firstPartySignList: InitFirstPartySign[] = this.info.firstPartySign
      return baseUrl + firstPartySignList[index]?.signPic
    } else {
      return ''
    }
  }
  aboutToAppear(){
    getMaintenanceType().then((res: AxiosResponse<quarterTest>) => {
      this.maintenanceTypeList = res.data.data
    })
  }
  build() {
    Scroll(){
      Column(){
        Text(`项目编号:${this.info.reportNo}`).fontSize(12).fontColor('#000').fontWeight(700)
        Text('建筑消防设施维护保养记录表').fontSize(16).fontColor('#000').fontWeight(700).width('100%').textAlign(TextAlign.Center).margin({bottom: 10, top: 10})
        Text(`(${this.getType(this.maintenanceTypeList, this.info.reportType)})`).fontSize(12).fontColor('#666').padding({top: 10, bottom: 10})
          .border({width: {bottom: 1},color: '#eee'})
          .width('100%').textAlign(TextAlign.Center)
          .margin({bottom: 10})
        Row(){
          Text('维保项目名称:').fontSize(12).fontColor('#999').width(120)
          Text(this.info.reportName).fontSize(12).fontColor('#999')
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%')
        Row(){
          Text('维护委托单位:').fontSize(12).fontColor('#999').width(120)
          Text(this.info.applyCompanyName).fontSize(12).fontColor('#999')
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%')
        Row(){
          Text('维护机构:').fontSize(12).fontColor('#999').width(120)
          Text(this.info.companyName).fontSize(12).fontColor('#999')
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%')
        Row(){
          Text('维保日期:').fontSize(12).fontColor('#999').width(120)
          Text(this.getTimeFrame(this.info?.maintenanceTime, this.info?.maintenanceEndTime)).fontSize(12).fontColor('#999')
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%')
        Row(){
          Text('维护保养人员签字:').fontSize(12).fontColor('#999').width(120)
          Image(this.getSign(0)).width(80).height(40).margin({left: 20})
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%')
        Row(){
          Column(){
            Text('委托单位见证人签字:').fontSize(12).fontColor('#999').margin({bottom: 4})
            Text('(签字人作为委托单位见证人对本消防原始记录表已仔细核对不存在弄虚作假,本电子签名经委托方、受委托方认可具有法律效应)').fontSize(10).fontColor('#999')
          }.width(120)
          Image(this.getFirstSign(0)).width(80).height(40).margin({left: 20})
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%')
        Column(){
          Text('使用仪器设备及编号:').fontSize(12).fontColor('#999').margin({bottom: 4})
          Text(this.info.equipment).fontSize(12).fontColor('#999')
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%').alignItems(HorizontalAlign.Start)
        Row(){
          Text('综合评述:').fontSize(12).fontColor('#999')
          HmParseHTML({
            htmlStr: this.info?.result || '<p>无</p>',
            baseFontSize: 12,
            baseFontColor: '#999'
          })
        }.padding({top: 10, bottom: 10}).border({width: {bottom: 1},color: '#eee'}).width('100%')
        Column(){
          Text('注:').margin({bottom: 10}).width('100%').textAlign(TextAlign.Start).fontSize(12).fontColor('#000')
          Column(){
            Text('1.对发现的问题应及时处理,当场不能处置的要填报《消防设施故障处理单》。').fontSize(12).fontColor('#000')
            Text('2.表中未包含的消防设施维护保养项目,消防设施维护保养单位可参考表格样式自行制定原始记录表。').fontSize(12).fontColor('#000')
            Text('3.如消防技术规范有更新,消防设施维护保养单位可根据最新规范要求自行更新原始记录表。').fontSize(12).fontColor('#000')
          }.padding({left: 20})
        }.margin({top: 20})
      }.width('100%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.Start)
      .padding({left: 10, right: 10, bottom: 30, top: 30})
    }.width('100%').height('100%').scrollBar(BarState.Off).backgroundColor('#fff').borderRadius(10)
  }
}