quanyawei
2024-07-04 1e71dd86f6d0c4fc7e5143600d4bc4b50992a2a7
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<template>
    <view class="">
        <!-- 整改信息 -->
        <view class="workOrderDetail">
            <view class="headerCont">
                <p class="title">审批信息</p>
            </view>
            <u-line color="#bbb" />
            <view>
                <view class="mainContent">
                    <u--form labelPosition="left" label-width="80" :model="form" :border-bottom="false" :rules="rules"
                        ref="uForm">
                        <view class="formItemContent">
                            <u-form-item border-bottom label="考核打分:" prop="checkScore"
                                :required="basicInfor.pageState==='edit'" :border-bottom="false">
                                <view class="fonttest" v-if="basicInfor.pageState==='view'">
                                    {{ basicInfor.checkScore ||''}}
                                </view>
                                <u-input v-else v-model="form.checkScore" border="none" placeholder="请输入"
                                    type="number" />
                            </u-form-item>
                        </view>
                        <view class="formItemContent">
                            <u-form-item border-bottom label="理由:" prop="checkDescribe"
                                :required="basicInfor.pageState==='edit'" :border-bottom="false">
                                <view class="fonttest" v-if="basicInfor.pageState==='view'">
                                    {{ basicInfor.checkDescribe ||''}}
                                </view>
                                <u--textarea v-else v-model="form.checkDescribe" border="none" placeholder="请输入内容" />
                            </u-form-item>
                        </view>
                        <view class="formItemContent">
                            <u-form-item border-bottom label="相关附件:" :border-bottom="false">
                                <view class="fileBox" v-if="basicInfor.pageState==='view'">
                                    <cl-upload v-model="fileList" :add="false" :action="`''`" cloud-type="other"
                                        :remove="false" />
                                </view>
                                <view class="fileBox" v-else>
                                    <fileUpload class="rowTipContenetAll" :sys-code="sysCode"
                                        @handleFile="handleFile" />
                                </view>
                            </u-form-item>
                        </view>
                    </u--form>
                </view>
            </view>
        </view>
    </view>
</template>
<script>
    import fileUpload from '../components/fileUpload.vue'
    export default {
        components: {
            fileUpload
        },
        props: {
            basicInfor: {
                type: Object,
                default: () => {}
            },
        },
        computed: {
            pageState() {
                return this.basicInfor.pageState
            }
        },
        data() {
            return {
                sysCode: '1010203',
                form: {
                    checkScore: 0,
                    checkDescribe: '',
                },
                dictObj: JSON.parse(uni.getStorageSync('dictObj') || '[]'),
                fileList: [],
                fileBaseList: [],
                baseUrl: this.$storage.get('baseUrl'),
                rules: {
                    'checkScore': {
                        required: true,
                        message: '请输入',
                        trigger: ['blur', 'change']
                    },
                    'checkDescribe': {
                        required: true,
                        message: '请输入',
                        trigger: ['blur', 'change']
                    },
                }
            }
        },
        onLoad: function(option) {
            //option为object类型,会序列化上个页面传递的参数
            console.log(option) //打印出上个页面传递的参数。
        },
        onReady() {
            //onReady 为uni-app支持的生命周期之一
            this.$refs.uForm.setRules(this.rules)
        },
        mounted() {
            console.log('this.basicInfor', this.basicInfor)
            if (this.basicInfor.fileApproveList && this.basicInfor.fileApproveList.length > 0) {
                this.basicInfor.fileApproveList.forEach(item => {
                    let name = item.fileType === 1 ? 'name.png' : 'name.mp4'
                    this.fileList.push(`${this.baseUrl}/file/preview/${item.fileId}?${name}`) // 原图
                })
                console.log('this.fileList', this.basicInfor.fileBaseList)
                console.log('this.fileList', this.fileList)
            }
        },
        methods: {
            handleFile(data) {
                this.fileBaseList = data
                this.form.fileChangeList = this.fileBaseList
            },
            formVali() {
                return new Promise((resolve, reject) => {
                    if (this.basicInfor.pageState !== 'view') {
                        this.$refs.uForm.validate().then(res => {
                            resolve(true)
                        }).catch(errors => {
                            reject(false)
                            uni.$u.toast('校验失败')
                        })
                    } else {
                        resolve(true)
                    }
                })
            }
        },
    }
</script>
<style scoped lang="scss">
    /deep/.u-line {
        margin: 19.23rpx 0px !important;
    }
 
    .workOrderDetail {
        border: 1px solid #bbb;
        border-radius: 5px;
        margin: 19.23rpx;
        padding: 19.23rpx;
        color: #101010;
        font-weight: 700;
        font-size: 30.77rpx;
 
        .headerCont {
            display: flex;
            justify-content: space-between;
            font-size: 30.77rpx;
        }
 
        .mainContent {
            margin-bottom: 10px;
            font-weight: 500;
 
            .rowTip {
                display: flex;
                padding: 5px 0;
                border-bottom: 1px dashed #bbb;
 
                .wholeLine {
                    display: flex;
                    width: 100%;
                    align-items: center;
 
                    .rowTipContenetLabel {
                        min-width: 144.23rpx;
                        font-size: 28.85rpx;
                        text-align: left;
                    }
 
                    .rowTipContenetAll {
                        font-size: 28.85rpx;
                        width: calc(100% - 144.23rpx);
                    }
                }
 
                .rowTipContenet {
                    width: 50%;
                    text-align: left;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
 
                    .butsName {
                        display: inline-block;
                        margin-left: 19.23rpx;
                        color: #1990ff;
                    }
                }
            }
 
            .rowTipContenet_right {
                text-align: right !important;
            }
        }
    }
</style>