MrShi
2025-08-19 f2ac76666299407545fb733f0d21f6e8cfe538a3
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<template>
    <view class="she">
        <u--form labelPosition="left" :model="model" :rules="rules" ref="uForm">
            <u-form-item label="上报时间" labelWidth="120" prop="submitDate" borderBottom @click="openS" required>
                <u--input v-model="model.submitDate" border="none" placeholder="请选择上报时间" disabledColor="#ffffff"
                    disabled></u--input>
                <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="发现时间" labelWidth="120" prop="happenTime" borderBottom @click="openF" required>
                <u--input v-model="model.happenTime" border="none" placeholder="请选择发现时间" disabledColor="#ffffff"
                    disabled></u--input>
                <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="部门/班组" labelWidth="120" prop="companyName" borderBottom required>
                <u--input v-model="model.companyName" border="none" placeholder="请选择部门/班组" disabledColor="#ffffff"
                    disabled></u--input>
                <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="位置" labelWidth="120" prop="localtionName" borderBottom @click="$refs.pengTree._show()" required>
                <u--input v-model="model.localtionName" border="none" placeholder="请选择位置" disabledColor="#ffffff"
                    disabled></u--input>
                <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="观察主题" labelWidth="120" prop="typeName" borderBottom @click="openG" required>
                <u--input v-model="model.typeName" border="none" placeholder="请选择观察主题" disabledColor="#ffffff"
                    disabled></u--input>
                <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="观察项" labelWidth="120" prop="dcaYesNum" borderBottom @click="jumpSelectType()" required>
                <view style="width: 100%; display: flex; align-items: center; justify-content: space-between;">
                    <view style="font-size: 28rpx; color: rgba(32,110,238,1);">符合:{{model.dcaYesNum}} 不符合:{{model.dcaNoNum}}</view>
                    <u-icon name="arrow-right"></u-icon>
                </view>
            </u-form-item>
            <u-form-item label="DCA图片" labelWidth="120" prop="multifileList" labelPosition="top" borderBottom>
                <UploadImage
                    :fileList="model.multifileList"
                    folder="WORKORDER_FILE_PATH"
                    @dele="deletePic"
                    @getFileList="afterRead"
                    style="margin-top: 15rpx;"
                />
            </u-form-item>
            <u-form-item label="通知人" labelWidth="120" prop="notifier" borderBottom required>
                <u--textarea v-model="model.notifier" border="none" placeholder="请输入通知人" disabledColor="#ffffff"
                    disabled></u--textarea>
            </u-form-item>
        </u--form>
        <u-button type="primary" text="提交" @click="submit" style="margin-top: 60rpx;"></u-button>
        <!-- 上报时间 -->
        <u-datetime-picker :show="show1" v-model="time" mode="datetime" @cancel="closeS"
            @confirm="selectTime"></u-datetime-picker>
        <!-- 发现时间 -->
        <u-datetime-picker :show="show5" v-model="time1" mode="datetime" @cancel="closeF"
            @confirm="selectTime1"></u-datetime-picker>
        <!-- 确定弹窗 -->
        <u-modal :show="show4" showCancelButton title="提醒" @cancel="closeT" @confirm="report">
            <view class="slot-content">
                您本次共提交{{total}}项,<text>{{model.dcaYesNum}}项</text>符合,<text>{{model.dcaNoNum}}项</text>不符合,系统将会根据不符合项形成对应工单。
            </view>
        </u-modal>
        <!-- 位置 -->
        <peng-tree
            ref="pengTree"
            :range="address"
            idKey="id"
            :selectParent="false"
            nameKey="name"
            :multiple="false"
            title="选择位置"
            @confirm="selectAddress"
            @cancel="$refs.pengTree._hide()">
        </peng-tree>
        <!-- 主题 -->
        <u-picker
            :show="show2"
            :columns="theme"
            keyName="name"
            @confirm="selectTheme"
            @cancel="closeG" />
        <!-- 提交成功 -->
        <u-modal :show="show6" showCancelButton confirmText="查看详情" cancelText="继续上报" @cancel="next" @confirm="toDesc">
            <view class="slot-content1">
                <u-icon name="checkmark-circle-fill" color="#3875C5" size="70"></u-icon>
                <text>提交成功</text>
                <text>感谢您的反馈</text>
            </view>
        </u-modal>
    </view>
</template>
 
<script>
    import { mapState } from 'vuex'
    import UploadImage from '@/components/uploadImage/uploadImage.vue'
    import pengTree from '@/uni_modules/peng-tree/peng-tree/peng-tree.vue'
    export default {
        components: { pengTree, UploadImage },
        computed: {
            ...mapState(['userInfo'])
        },
        data() {
            return {
                id: null,
                model: {
                    submitDate: '',
                    happenTime: '',
                    companyName: '',
                    localtionName: '',
                    localtionId: '',
                    typeId: '',
                    typeName: '',
                    notifier: '',
                    dcaYesNum: 0,
                    dcaNoNum: 0,
                    dcaNoProblemDTOList: [],
                    multifileList: [],
                    type: 1
                },
                rules: {
                    submitDate: [{
                        type: 'string',
                        required: true,
                        message: '上报时间不能为空',
                        trigger: ['blur', 'change']
                    }],
                    happenTime: [{
                        type: 'string',
                        required: true,
                        message: '发现时间不能为空',
                        trigger: ['blur', 'change']
                    }],
                    companyName: [{
                        type: 'string',
                        required: true,
                        message: '部门/班组不能为空',
                        trigger: ['blur', 'change']
                    }],
                    localtionName: [{
                        type: 'string',
                        required: true,
                        message: '位置不能为空',
                        trigger: ['blur', 'change']
                    }],
                    typeName: [{
                        type: 'string',
                        required: true,
                        message: '观察主题不能为空',
                        trigger: ['blur', 'change']
                    }],
                    notifier: [{
                        type: 'string',
                        required: true,
                        message: '通知人不能为空',
                        trigger: ['blur', 'change']
                    }]
                },
                show: false,
                show1: false,
                show2: false,
                show3: false,
                show4: false,
                show5: false,
                show6: false,
                time: new Date().getTime(),
                time1: new Date().getTime(),
                address: [],
                theme: [],
                total: 0,
                list: []
            };
        },
        onLoad() {
            this.model.submitDate = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss')
            this.model.happenTime = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss')
            this.model.companyName = this.userInfo.companyName
            this.getNotifier()
            this.getLocation()
            this.getZhuti()
            // 接收数据
            uni.$on('update', (data) => {
                this.total = data.total
                this.model.dcaYesNum = data.dcaYesNum
                this.model.dcaNoNum = data.dcaNoNum
                this.model.dcaNoProblemDTOList = data.dcaNoProblemDTOList
                this.list = data.list
            })
        },
        methods: {
            openG() {
                // this.theme = []
                this.total = 0
                this.list = []
                this.model.dcaYesNum = ''
                this.model.dcaNoNum = ''
                this.model.dcaNoProblemDTOList = []
                this.stopScroll()
                this.show2 = true
            },
            closeG() {
                this.canScroll()
                this.show2 = false
            },
            next() {
                this.canScroll()
                this.show6 = false
            },
            next1() {
                this.model.submitDate = ''
                this.model.happenTime = ''
                this.model.localtionName = ''
                this.model.localtionId = ''
                this.model.typeId = ''
                this.model.typeName = ''
                this.model.dcaYesNum = 0
                this.model.dcaNoNum = 0
                this.model.dcaNoProblemDTOList = []
                this.model.multifileList = []
                this.model.type = 1
            },
            toDesc() {
                this.canScroll()
                this.show6 = false
                uni.navigateTo({
                    url: `/pages/details_dca/details_dca?id=${this.id}`
                })
            },
            // 提交上报
            async report() {
                let res = await this.$u.api.workOrderCreate(this.model)
                if (res.code === 200) {
                    this.next1()
                    this.show4 = false
                    this.id = res.data
                    this.show6 = true
                }
            },
            // dac位置
            async getLocation() {
                let res = await this.$u.api.categoryTree({ categoryType: 3 })
                if (res.code === 200) {
                    this.address = res.data
                }
            },
            // dac主题
            async getZhuti() {
                let res = await this.$u.api.categoryList({ categoryType: 4, isRoot: 1 })
                if (res.code === 200) {
                    this.theme = [res.data]
                }
            },
            // 选择主题
            selectTheme(e) {
                this.model.typeId = e.value[0].id
                this.model.typeName = e.value[0].name
                this.canScroll()
                this.show2 = false
            },
            // 选择位置
            selectAddress(e) {
                this.model.localtionId = e[0].id
                this.model.localtionName = e[0].name
                this.$refs.pengTree._hide()
            },
            // 获取通知人
            async getNotifier() {
                let res = await this.$u.api.managersList({ type: 0 })
                if (res.code === 200) {
                    this.model.notifier = res.data.map(item => item.memberName).join(',')
                }
            },
            jumpSelectType() {
                if (!this.model.typeId) {
                    uni.showToast({
                        title: '请先选择观察主题',
                        icon: 'none'
                    })
                    return
                }
                if (this.list.length > 0) {
                    uni.setStorageSync('list', this.list);
                    uni.navigateTo({
                        url: `/pages/type_dca/type_dca?theme=${this.model.typeId}&themeName=${this.model.typeName}&disable=1`
                    })
                } else {
                    uni.navigateTo({
                        url: `/pages/type_dca/type_dca?theme=${this.model.typeId}&themeName=${this.model.typeName}`
                    })
                }
            },
            // 删除图片
            deletePic(index) {
                this.model.multifileList.splice(index, 1)
            },
            // 新增图片
            afterRead(arr) {
                this.model.multifileList = [...this.model.multifileList, ...arr]
            },
            submit() {
                this.$refs.uForm.validate().then(res => {
                    if (this.total === 0) return uni.showToast({
                        title: '请选择观察项',
                        icon: 'none'
                    })
                    this.show4 = true
                }).catch(errors => {
                    
                })
            },
            openF() {
                this.stopScroll()
                this.show5 = true
            },
            closeF() {
                this.canScroll()
                this.show5 = false
            },
            openS() {
                this.stopScroll()
                this.show1 = true
            },
            closeS() {
                this.canScroll()
                this.show1 = false
            },
            closeT() {
                this.canScroll()
                this.show4 = false
            },
            // 上报时间
            selectTime(e) {
                this.model.submitDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss')
                this.canScroll()
                this.show1 = false
            },
            // 发现时间
            selectTime1(e) {
                this.model.happenTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss')
                this.canScroll()
                this.show5 = false
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .she {
        width: 100%;
        padding: 0 30rpx 30rpx 30rpx;
        box-sizing: border-box;
        .slot-content {
            color: rgba(16,16,16,1);
            font-size: 28rpx;
            margin: 30rpx 0;
            text {
                color: #206EEE;
            }
        }
        .slot-content1 {
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            text {
                &:nth-child(2) {
                    color: rgba(16,16,16,1);
                    font-size: 28rpx;
                    margin-top: 24rpx;
                }
                &:nth-child(3) {
                    color: rgba(190,190,190,1);
                    font-size: 24rpx;
                    margin-top: 34rpx;
                }
            }
        }
    }
</style>