|
@@ -1,16 +1,32 @@
|
|
|
+import CommonConstants from '../../common/constants/CommonConstants'
|
|
|
+import JGRequest from '../../common/util/request/Request'
|
|
|
+
|
|
|
@Component
|
|
|
export struct SpotCheckView {
|
|
|
+ // 生产过程id(开工信息id)
|
|
|
+ processId: number
|
|
|
+ // 工序id
|
|
|
+ operationId: number
|
|
|
+ @State checkArray: CheckItem[] = []
|
|
|
+
|
|
|
+ @State resultArray: string[] = []
|
|
|
+ async aboutToAppear() {
|
|
|
+ this.checkArray = await JGRequest.post('/api/v1/process/check/list', {
|
|
|
+ "operationId": this.operationId,
|
|
|
+ "processId": this.processId,
|
|
|
+ })
|
|
|
|
|
|
- @State checkArray: CheckItem[] = [
|
|
|
- {checkName: '外观尺寸检查', unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
|
|
|
- {checkName: '外观尺寸检查', unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0, checkResult:1},
|
|
|
- {checkName: '外观尺寸检查', unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0, checkResult: 2},
|
|
|
- ]
|
|
|
+ if (this.checkArray && this.checkArray.length > 0) {
|
|
|
+ for (const check of this.checkArray) {
|
|
|
+ this.resultArray.push(check.result ? check.result : '')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
build() {
|
|
|
Column() {
|
|
|
Grid() {
|
|
|
- ForEach(this.checkArray, (item: CheckItem) => {
|
|
|
+ ForEach(this.checkArray, (item: CheckItem, index: number) => {
|
|
|
GridItem() {
|
|
|
Row() {
|
|
|
Column() {
|
|
@@ -25,17 +41,17 @@ export struct SpotCheckView {
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
Row().height('12%')
|
|
|
- Text('标准值:' + item.standardValue)
|
|
|
+ Text('标准值:' + item.standard)
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
- Text('上限值:' + item.upperLimit)
|
|
|
+ Text('上限值:' + item.upper)
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
- Text('下线值:' + item.lowerLimit)
|
|
|
+ Text('下限值:' + item.lower)
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
@@ -43,36 +59,65 @@ export struct SpotCheckView {
|
|
|
}
|
|
|
.width('56%')
|
|
|
.height('100%')
|
|
|
- .padding({left: '7%'})
|
|
|
+ .padding({ left: '7%' })
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
|
|
|
- Column({space:5}) {
|
|
|
+ Column({ space: 5 }) {
|
|
|
Text('结果')
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
- Row({space: 10}) {
|
|
|
- Text('合格')
|
|
|
- .fontSize($r('app.float.process_card_middle_font_size'))
|
|
|
- .fontColor($r('app.color.general_font_color'))
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .backgroundColor(item.checkResult && item.checkResult === 1 ? $r('app.color.process_card_green_color') : $r('app.color.process_card_grey_color'))
|
|
|
- .borderRadius($r('app.float.general_border_radius'))
|
|
|
- .height('32%')
|
|
|
- .width('40%')
|
|
|
- Text('不合格')
|
|
|
- .fontSize($r('app.float.process_card_middle_font_size'))
|
|
|
- .fontColor($r('app.color.general_font_color'))
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .backgroundColor(item.checkResult && item.checkResult === 2 ? $r('app.color.process_card_red_color') : $r('app.color.process_card_grey_color'))
|
|
|
- .borderRadius($r('app.float.general_border_radius'))
|
|
|
- .width('40%')
|
|
|
- .height('32%')
|
|
|
- }
|
|
|
+ Row({ space: 10 }) {
|
|
|
+ Row() {
|
|
|
+ Text('合格')
|
|
|
+ .fontSize($r('app.float.process_card_middle_font_size'))
|
|
|
+ .fontColor(this.resultArray[index] === '1' ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ }
|
|
|
+ .backgroundColor(this.resultArray[index] === '1' ? $r('app.color.process_card_green_color') : $r('app.color.process_card_grey_color'))
|
|
|
+ .borderRadius($r('app.float.general_border_radius'))
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .height('32%')
|
|
|
+ .width('40%')
|
|
|
+ .onClick(async () => {
|
|
|
+ if (item.result && item.result === '1') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ await JGRequest.post('/api/v1/process/check/update', {
|
|
|
+ "id": item.id,
|
|
|
+ "operator": CommonConstants.USER_ID,
|
|
|
+ "processId": this.processId,
|
|
|
+ "result": 1
|
|
|
+ })
|
|
|
+ this.resultArray[index] = '1'
|
|
|
+ })
|
|
|
+
|
|
|
+ Row() {
|
|
|
+ Text('不合格')
|
|
|
+ .fontSize($r('app.float.process_card_middle_font_size'))
|
|
|
+ .fontColor(this.resultArray[index] === '2' ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ }
|
|
|
+ .backgroundColor(this.resultArray[index] === '2' ? $r('app.color.process_card_red_color') : $r('app.color.process_card_grey_color'))
|
|
|
+ .borderRadius($r('app.float.general_border_radius'))
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .width('40%')
|
|
|
+ .height('32%')
|
|
|
+ .onClick(async () => {
|
|
|
+ if (item.result && item.result === '2') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ await JGRequest.post('/api/v1/process/check/update', {
|
|
|
+ "id": item.id,
|
|
|
+ "operator": CommonConstants.USER_ID,
|
|
|
+ "processId": this.processId,
|
|
|
+ "result": 2
|
|
|
+ })
|
|
|
+ this.resultArray[index] = '2'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
.width('44%')
|
|
|
.height('100%')
|
|
@@ -90,21 +135,54 @@ export struct SpotCheckView {
|
|
|
.columnsTemplate('1fr 1fr')
|
|
|
.width('98%')
|
|
|
.rowsGap(10)
|
|
|
- .margin({top: 10})
|
|
|
+ .margin({ top: 10 })
|
|
|
}
|
|
|
.width('100%')
|
|
|
.height('100%')
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
class CheckItem {
|
|
|
- unit?: string
|
|
|
+ // 创建时间
|
|
|
+ created?: string
|
|
|
+ // 创建人
|
|
|
+ creator?: string
|
|
|
+ // 删除标识
|
|
|
+ deleted?: number
|
|
|
+ // 部门ID
|
|
|
+ deptId?: string
|
|
|
+ // 主键id
|
|
|
+ id?: number
|
|
|
+ // 修改时间
|
|
|
+ updated?: string
|
|
|
+ // 上次修改人
|
|
|
+ updator?: string
|
|
|
+ // 工序点检项编码
|
|
|
+ checkCode?: string
|
|
|
+ // 工序点检项名称
|
|
|
checkName?: string
|
|
|
- standardValue?: number
|
|
|
- upperLimit?: number
|
|
|
- lowerLimit?: number
|
|
|
- actualValue?: number
|
|
|
- // 1.合格 2.不合格
|
|
|
- checkResult?: number
|
|
|
+ // 内容
|
|
|
+ content?: string
|
|
|
+ // 下限值
|
|
|
+ lower?: string
|
|
|
+ // 工序检验项id
|
|
|
+ operationCheckId?: string
|
|
|
+ // 操作人
|
|
|
+ operator?: string
|
|
|
+ // 组织ID
|
|
|
+ orgId?: string
|
|
|
+ // 生产过程id
|
|
|
+ processId?: string
|
|
|
+ // 结果
|
|
|
+ result?: string
|
|
|
+ // 排序号
|
|
|
+ sortNum?: number
|
|
|
+ // 标准值
|
|
|
+ standard?: string
|
|
|
+ // 步骤id
|
|
|
+ stepInstanceId?: string
|
|
|
+ // 单位
|
|
|
+ unit?: string
|
|
|
+ // 上限值
|
|
|
+ upper?: string
|
|
|
}
|