YOS-DRVOGPU6U78\Administrator
2023-07-19 3acc5e4a99c7c69d25d7782e3c71152c5d0e0845
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<template>
    <view>
        <view>
            <uni-card>
                <u-row customStyle="margin-bottom: 10px">
                    <u-col span="2">
                        <label>检验单号:</label>
                    </u-col>
                    <u-col span="4">
                        <label>{{item.TASK_NO}}</label>
                    </u-col>
                </u-row>
                <u-row customStyle="margin-bottom: 10px">
                    <u-col span="2">
                        <label>机台号:</label>
                    </u-col>
                    <u-col span="4">
                        <label>{{item.MACHINE_NO}}</label>
                    </u-col>
                </u-row>
                <u-row customStyle="margin-bottom: 10px">
                    <u-col span="2">
                        <label>工序名称:</label>
                    </u-col>
                    <u-col span="4">
                        <label>{{item.PROC_NAME}}</label>
                    </u-col>
                </u-row>
                <u-row customStyle="margin-bottom: 10px">
                    <u-col span="2">
                        <label>产品名称:</label>
                    </u-col>
                    <u-col span="4">
                        <label>{{item.ITEM_NAME}}</label>
                    </u-col>
                </u-row>
                <u-row customStyle="margin-bottom: 10px">
                    <u-col span="2">
                        <label>产品编号:</label>
                    </u-col>
                    <u-col span="4">
                        <label>{{item.ITEM_NO}}</label>
                    </u-col>
                </u-row>
                <u-row customStyle="margin-bottom: 10px">
                    <u-col span="2">
                        <label>检验员:</label>
                    </u-col>
                    <u-col span="4">
                        <label>{{name}}</label>
                    </u-col>
                </u-row>
                <u-row customStyle="margin-bottom: 10px">
                    <u-col span="2">
                        <label>检验类型</label>
                    </u-col>
                    <u-col span="4">
                        <label>{{item.REMEKE}}</label>
                    </u-col>
                </u-row>
            </uni-card>
        </view>
 
        <view>
            <uni-table border stripe emptyText="暂无更多数据" style="margin-left: 5px;margin-right: 5px;">
                <!-- 表头行 -->
                <uni-tr>
                    <uni-th align="center" width="80">检验项目</uni-th>
                    <uni-th align="left" width="100">检验工具</uni-th>
                    <uni-th align="left" width="180">备注</uni-th>
                    <uni-th align="left" width="30">检验数量</uni-th>
                    <uni-th align="left" width="80">上限值</uni-th>
                    <uni-th align="left" width="80">下限值</uni-th>
                    <uni-th align="left" width="100">检验值</uni-th>
                    <uni-th align="left" width="80">检验结果</uni-th>
                </uni-tr>
                <!-- 表格数据行 -->
                <uni-tr v-for="item in table">
                    <uni-td>{{item.CHECK_ITEM}}</uni-td>
                    <uni-td>{{item.CHECK_TOOL}}</uni-td>
                    <uni-td>{{item.SPECIFICATION}}</uni-td>
                    <uni-td>{{item.CHECK_NUM}}</uni-td>
                    <uni-td>{{item.UP_ALLOW}}</uni-td>
                    <uni-td>{{item.DOWN_ALLOW}}</uni-td>
                    <uni-td>
                        <u--input v-model="item.VALUE" v-if="item.UP_ALLOW"></u--input>
                        <u-switch v-model="item.VALUE === '合格'" size="20" v-if="!item.UP_ALLOW"
                            @change="changeSwitch(item)"></u-switch>
                    </uni-td>
                    <uni-td>
                        <u-tag
                            v-if="item.UP_ALLOW && item.VALUE <= item.UP_ALLOW && item.VALUE >= item.DOWN_ALLOW || !item.UP_ALLOW && item.VALUE == '合格'"
                            text="合格" type="success"></u-tag>
                        <u-tag
                            v-if="item.UP_ALLOW && (item.VALUE > item.UP_ALLOW || item.VALUE < item.DOWN_ALLOW) || !item.UP_ALLOW && item.VALUE == '不合格'"
                            text="不合格" type="error"></u-tag>
                    </uni-td>
                </uni-tr>
            </uni-table>
        </view>
        <u-button text="提交"  type="primary" style="position: absolute;bottom:0;" @click="submit()"></u-button>
    </view>
</template>
 
<script>
    import {
        getInspectionInfo, saveInspectionInfo
    } from '../../api/inspection';
    export default {
        data() {
            return {
                item: {},
                table: [],
                name:''
            }
        },
        onLoad(option) {
            let item = JSON.parse(decodeURIComponent(option.item));
            this.item = item
            this.getInspection(item.CHECK_NO)
            this.name = uni.getStorageSync('userInfo').username
        },
        methods: {
            getInspection(chenkNo) {
                getInspectionInfo(chenkNo).then(res => {
                    // this.table = res.data
                    for (let item of res.data) {
                        for (let i = 0; i < parseInt(item.CHECK_NUM); i++) {
                            let insert = JSON.parse(JSON.stringify(item))
 
                            insert.CHECK_ITEM = insert.CHECK_ITEM + '-' + i
                            if (!insert.UP_ALLOW) {
                                insert.VALUE = '合格'
                            } else {
                                insert.VALUE = 0
                            }
                            this.table.push(insert)
                        }
                    }
                })
            },
            changeSwitch(item) {
                if (item.VALUE == '合格') {
                    item.VALUE = '不合格'
                } else {
                    item.VALUE = '合格'
                }
            },
            submit() {
                saveInspectionInfo(this.item.CHECK_NO,this.table).then(res => {
                    console.log(res)
                })
            }
        }
    }
</script>
 
<style>
    .wrap {
        padding: 12px;
    }
 
    .demo-layout {
        height: 25px;
        border-radius: 4px;
    }
 
    .bg-purple {
        background: #CED7E1;
    }
 
    .bg-purple-light {
        background: #e5e9f2;
    }
 
    .bg-purple-dark {
        background: #99a9bf;
    }
 
    .text {
        font-size: x-large;
    }
</style>