luobisheng
2022-12-07 8e367b87b978d20a30a6ca900d95c25c9eb82b0e
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
<template>
    <div class="ill">
        <!-- 到达现场情况 -->
        <MyArrive ref="arrive" :arriveData="arriveData"></MyArrive>
        <!-- 调查取证 -->
        <MyEvidence ref="evidence" :evidenceData="evidenceData" :illegal-type="illegalType"></MyEvidence>
        <!-- 文种书类 -->
        <MyBook ref="book" :writ="writ" :illegal-type="illegalType"></MyBook>
 
        <div class="footer">
            <el-button @click="handleSubmit" type="primary">确定</el-button>
            <el-button @click="handleBack">返回</el-button>
        </div>
    </div>
</template>
<script>
import MyArrive from '../components/arrive'
import MyEvidence from "../components/evidence"
import MyBook from "../components/book"
import casequery from "@/api/operate/basecase";
export default {
    components: {
        MyArrive, MyEvidence, MyBook
    },
  data() {
      return {
        arriveData: null,
        evidenceData: null,
        writ: null
      }
  },
    props: ['caseId','closeDialog', 'vioData', 'illegalType', 'imageResourceId'],
    created() {
      this.arriveData = this.vioData.arrivalSituation;
      this.evidenceData = this.vioData.investigation;
      this.writ = this.vioData.writ;
    },
    methods: {
        handleSubmit() {
            const { arrive, evidence, book } = this.$refs;
            const { arriveForm } = arrive.$refs;
            const { evidenceForm } = evidence.$refs;
            const { bookForm } = book.$refs;
            arriveForm.validate((valid) => {
                if (valid) {
                    evidenceForm.validate((flag) => {
                        if (flag) {
                            bookForm.validate((bookFlag) => {
                                if (bookFlag) {
                                  const arriveData = Object.assign({}, arrive.arrive);
                                  const evidenceData = Object.assign({}, evidence.evidence);
                                  const bookData = Object.assign({}, book.book);
                                  const partyInfo = evidence.user;
                                  const arrivalSituationId = arriveData.id;
                                  const investigationId = evidenceData.id;
                                  const partyInfoId = this.evidenceData ? partyInfo.id : null;
                                  const evidencePic = evidenceData.pic.join(',');
                                  const situationPic = arriveData.situationPic.join(',');
                                  const otherPic = bookData.otherPic.join(',');
                                  const writPic = bookData.writPic.join(',');
                                  const rectifiedPic = bookData.rectifiedPic.join(',');
                                  const originalPic = bookData.originalPic.join(',');
                                  delete evidenceData.id;
                                  delete evidenceData.partyInfo;
                                  delete evidenceData.userInfo;
                                  delete evidenceData.pic;
                                  delete arriveData.situationPic;
                                  delete arriveData.id;
                                  delete bookData.otherPic;
                                  delete bookData.writPic;
                                  delete bookData.rectifiedPic;
                                  delete bookData.originalPic;
                                  delete partyInfo.illegalType;
                                  delete bookData.illegalType;
                                  casequery.updateDisposeResult({
                                    caseId: this.caseId,
                                    imageResourceId: this.imageResourceId,
                                    pic: evidencePic,
                                    arrivalSituationId,
                                    situationPic,
                                    partyInfoId,
                                    investigationId,
                                    otherPic,
                                    writPic,
                                    rectifiedPic,
                                    originalPic,
                                    ...arriveData,
                                    ...evidenceData,
                                    ...partyInfo,
                                    ...bookData
                                  })
                                      .then(() => {
                                        this.$message.success('操作成功');
                                        this.$emit('closeDialog');
                                      })
                                      .catch(err => {
                                        this.$message.error(err);
                                      })
                                } else {
                                    return false;
                                }
                            })
 
                        } else {
                            return false;
                        }
                    })
                } else {
                    evidenceForm.validate((flag) => {
                        if (!flag) {
                            bookForm.validate((bookFlag) => {
                                if (!bookFlag) {
                                    return false;
                                }
                            })
                            return false;
                        } else {
                            bookForm.validate((bookFlag) => {
                                if (!bookFlag) {
                                    return false
                                }
                            })
                        }
                    })
                    return false;
                }
            })
        },
        handleBack(){
            this.$emit('closeDialog',{falg:false})
        }
    }
}
</script>
<style lang="scss" scoped>
.ill {
    padding: 20px 200px 100px;
}
 
.footer {
    display: flex;
    justify-content: flex-end;
}
</style>