222
schangxiang@126.com
2025-09-26 2b05362eba2f989b7857349cc9a3a1c12f8181b6
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
<template>
    <u-modal :show="show" title="信息输入" :closeOnClickOverlay="true" :showCancelButton="true" @cancel="handlerCancel"
        @confirm="handlerConfirm" @close="close">
        <u-form labelPosition="left" labelWidth="100rpx" :model="form" :rules="rules" ref="uForm">
            <u-form-item v-if="barDetail.qualityState!=1" required label="不合格原因" prop="qualityErrorInfo">
                <u-textarea :maxlength="255" v-model="form.qualityErrorInfo" placeholder="请输入不合格原因"></u-textarea>
            </u-form-item>
            <u-form-item required label="密码" prop="pwd">
                <u-input v-model="form.pwd" type="password" placeholder="请输入密码" style="width: 450rpx;"></u-input>
            </u-form-item>
        </u-form>
 
        <!-- <view class="status_flex">
            <u-input v-model="pwd" type="password" placeholder="请输入密码" style="width: 450rpx;"></u-input>
        </view> -->
    </u-modal>
</template>
 
<script>
    import {
        $alert
    } from '@/static/js/utils/index.js'
    import {
        updateBarStatus
    } from '@/api/unBind/index.js'
    export default {
        emits: ['update'],
        data() {
            return {
                show: false,
                barDetail:{},
                form: {
                    pwd: '',
                    qualityErrorInfo: ''
                },
                rules: {
                    pwd: {
                        type: 'string',
                        required: true,
                        message: '请输入密码',
                        trigger: ['blur', 'change']
                    },
                    qualityErrorInfo: {
                        type: 'string',
                        required: true,
                        message: '请输入不合格原因',
                        trigger: ['blur', 'change']
                    }
                }
            }
        },
        onReady() {
            this.$refs.uForm.setRules(this.rules)
        },
        methods: {
            showModal(barDetail){
                this.show=true
                this.barDetail=barDetail
                console.log(this.barDetail);
                if(Boolean(this.barDetail.qualityErrorInfo)){
                    this.form.qualityErrorInfo=this.barDetail.qualityErrorInfo
                }else {
                    if(this.barDetail.qualityState==2){
                        this.form.qualityErrorInfo='不合格'
                    }else if(this.barDetail.qualityState==3){
                        this.form.qualityErrorInfo='疑似'
                    }
                }
                
            },
            handlerCancel() {
                this.form =  {
                    pwd: '',
                    qualityErrorInfo: ''
                }
                this.show = false
            },
            // 选中的状态传递给父组件
            handlerConfirm() {
                this.$refs.uForm.validate().then(res => {
                    const params = {
                        workPieceIDList: [this.barDetail.workPieceID],
                        qualityState: this.barDetail.qualityState,
                        workingProcedure: this.barDetail.workingProcedureCurrent,
                        workPieceState: this.barDetail.workPieceState,
                        password: this.form.pwd,
                        qualityErrorInfo:this.form.qualityErrorInfo
                    }
                    updateBarStatus(params).then(res => {
                        uni.showToast({
                            title: '修改成功'
                        })
                        this.$emit('update')
                        this.handlerCancel()
                    })
                }).catch(errors => {
                    console.log(errors);
                })
    
            },
            close() {
                this.show = false;
                this.pwd = ''
            }
 
        }
    }
</script>
 
<style lang="scss" scoped>
    .status_flex {
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
 
        .flex_item {
            width: 450rpx;
            height: 70rpx;
            text-align: center;
            line-height: 70rpx;
            border: 1px solid $color-common;
            color: $color-common;
            font-size: 32rpx;
            font-weight: 550;
            background: #fff;
            margin-bottom: 30rpx;
        }
 
        .active_item {
            background: $color-common;
            color: #fff;
        }
    }
    
    ::v-deep .u-transition {
      z-index: 99 !important;
    }
</style>