ProjectItem.ets
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { webview } from '@kit.ArkWeb'
import { HmParseHTML } from "@wuyan/html_parse"
import { InitProjectList, ItemList } from '../api/recordsType'
@Component
export default struct ProjectItem{
@Prop itemInfo: InitProjectList
webviewController: webview.WebviewController = new webview.WebviewController()
build() {
Column(){
// 头部详情
List({space: 10}){
ForEach(this.itemInfo.itemList, (item: ItemList) => {
ListItem(){
Column({space: 5}){
HmParseHTML({
htmlStr: item.itemName, // 富文本内容-必传
baseFontColor: '#000',
baseFontSize: 14
})
Column(){
Text('项目保养内容:').fontColor('#999').fontSize(12)
HmParseHTML({
htmlStr: item.maintainceContent, // 富文本内容-必传
baseFontColor: '#999',
baseFontSize: 12,
})
}.alignItems(HorizontalAlign.Start)
Row({space: 10}){
Text('部位').fontSize(14).fontWeight(700).fontColor('#000').width(100)
Text(item.position).layoutWeight(1).fontSize(12).fontColor('#999').textAlign(TextAlign.Start)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row({space: 10}){
Text('抽查数量:').fontSize(14).fontWeight(700).fontColor('#000').width(100)
Text(item.num).layoutWeight(1).fontSize(12).fontColor('#999').textAlign(TextAlign.Start)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row({space: 10}){
Text('抽查比例 (%):').fontSize(14).fontWeight(700).fontColor('#000').width(100)
Text(item.proportion).layoutWeight(1).fontSize(12).fontColor('#999').textAlign(TextAlign.Start)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Column(){
Text('实测记录').fontSize(14).fontWeight(700).fontColor('#000')
Web({
src: `data:text/html, ${item.viewTemplate.replace(new RegExp('<input', 'g'), '<input style="width: 30px;height: 30px"')}`,
controller: this.webviewController,
renderMode: RenderMode.SYNC_RENDER
}).layoutMode(WebLayoutMode.FIT_CONTENT).defaultFontSize(30)
}.alignItems(HorizontalAlign.Start)
}.alignItems(HorizontalAlign.Start)
}.backgroundColor('#fff').padding(10).borderRadius(4)
})
}.layoutWeight(1).backgroundColor('#f2f3f7')
}.height('100%').width('100%')
}
}