wwf
14 小时以前 4e6f18dfa08e2f2f4f02aaa1b8e8e51852b7a9a1
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
<template>
  <div v-if="pdfUrl">
    <el-row class="p-3 m-0" justify="space-between" align="middle">
      <el-col :span="4"></el-col>
      <el-col :span="16">
        <el-row justify="center">
          <el-text class="text-lg font-bold text-center">
            {{ title }}
          </el-text>
        </el-row>
      </el-col>
      <el-col :span="4">
        <el-row justify="center">
          <el-button
            v-if="!isVerified"
            text style="color: var(--el-color-primary);" 
            :loading="saveLoading" @click="tempSave()"
            class="mx-4"
          >
            暂存
          </el-button>
        </el-row>
      </el-col>
    </el-row>
    
    <el-divider class="m-0" style="flex-shrink: 0;"></el-divider>
    <el-scrollbar :height="`${mainHeight}px`" class="p-2 m-0 mt-1" >
      <div v-if="pdfUrl" :style="{width: '100%', height: `${mainHeight - 100}px`}">
        <PdfPreview v-if="pdfUrl" :url="pdfUrl"></PdfPreview>
      </div>
      <div class="p-2 my-4">
        <el-form ref="verifyForm" :model="form">
          <el-form-item label="*以上申报内容是否属实" prop="isVerified">
            <el-radio-group v-model="form.isContentTrue" :disabled="isVerified">
              <el-radio :value="1">是</el-radio>
              <el-radio :value="0">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="*该考点核验是否通过" prop="isPass">
            <el-radio-group v-model="form.isSitePass" :disabled="isVerified">
              <el-radio :value="1">是</el-radio>
              <el-radio :value="0">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-row><el-text>专家评估意见</el-text></el-row>
          <el-form-item class="mt-1">
            <el-input
              v-model="form.suggestion"
              :rows="3"
              type="textarea"
              placeholder="请填写评估意见"
              :disabled="isVerified"
            />
          </el-form-item>
          <el-row><el-text>*现场工作照片</el-text></el-row>
          <el-row>
            <UploadBtn v-model="form.image" :disabled="isVerified" :accept="['pdf', 'jpg']" :limitFileCount="10" listType="picture-card"></UploadBtn>
          </el-row>
          
          <Signature v-model="form.signatureUrl" :disabled="isVerified" :isRequire="true"></Signature>
 
          <el-button
            v-if="!isVerified"
            @click="submitVerify" 
            type="primary" size="large" 
            class="my-7" style="width: 100%;"
            :loading="submitLoading"
          >提交核验结果</el-button>
        </el-form>
      </div>
    </el-scrollbar>
  </div>
</template>
<script>
import PdfPreview from '@/views/main/components/PdfPreview.vue'
import { useWindowSize } from '@/utils/hook.js'
import Signature from '@/views/main/components/Signature.vue';
import { useSessionStore } from '@/stores/session.js'
import { storeToRefs } from 'pinia';
 
export default {
  components: {
    PdfPreview,
    Signature
  },
  setup() {
    const { height } = useWindowSize()
    const { userInfo } = storeToRefs(useSessionStore())
    return { pageHeight: height, userInfo }
  },
  data() {
    return {
      title: '',
      pdfUrl: '',
      form: {
        id: '',
        isContentTrue: 0,
        isSitePass: 0,
        suggestion: '',
        image: [],
        signatureUrl: ''
      },
      isVerified: false,
      saveLoading: false,
      submitLoading: false
    }
  },
  computed: {
    mainHeight() {
      return this.pageHeight - 80
    },
    appId() {
      return this.$route.query.appId
    }
  },
  async created() {
    this.getVerifyDetail()
  },
  mounted() {
    document.title = '考点核验'
  },
  methods: {
    getVerifyDetail() {
      const params = { applicationId: this.appId }
      this.$axios.get('/exam/verify-record/get-by-application-id', { params }).then(res => {
        if (res.data.code == 0) {
          const resData = res.data.data || {}
          this.pdfUrl = this.$qxueyou.qxyRes + resData.examSiteVerifyFile
          this.title = resData.organizationName + '-' + resData.examSite.siteName + '考点核验'
          if (resData.id) {
            this.form.isContentTrue  = resData.isContentTrue
            this.form.isSitePass = resData.isSitePass
            this.form.suggestion = resData.evaluationOpinion
            resData.sitePhotos?.forEach(ele => {
              this.form.image.push({ name: '', url: ele })
            })
            this.form.signatureUrl = resData.signatureUrl
            this.isVerified = resData.isVerified
          }
        } else {
          this.$message.error('获取核验信息失败')
        }
      })
    },
    tempSave() {
      const data = {
        applicationId: this.appId,
        id: this.form.id,
        userId: this.userInfo.id,
        name: this.userInfo.name,
        mobile: this.userInfo.mobile,
        idNumber: this.userInfo.idCard,
        isContentTrue: this.form.isContentTrue,
        isSitePass: this.form.isSitePass,
        evaluationOpinion: this.form.suggestion,
        sitePhotos: this.form.image.map(ele => ele.url),
        signatureUrl: this.form.signatureUrl,
      }
      this.saveLoading = true
      this.$axios.put(`/exam/verify-record/save`, data).then(res => {
        if (res.data.code == 0) {
          this.$message.success('保存成功')
          this.getVerifyDetail()
        } else {
          this.$message.error(res.data.msg)
        }
      }).finally(() => {
        this.saveLoading = false
      })
    },
    submitVerify() {
      if (this.form.image.length==0) {
        this.$message.error('请上传现场工作照片')
        return
      }
      if (!this.form.signatureUrl) {
        this.$message.error('请填写签名')
        return
      }
      this.$messageBox.confirm('提交之后不可再编辑核验,确认提交吗', '提示', 
      { confirmButtonText: '确定', cancelButtonText: '取消', type: 'tip' }).then(res => {
        if (res == 'confirm') { 
          this.submitLoading = true
          const data = {
            applicationId: this.appId,
            isContentTrue: this.form.isContentTrue,
            isSitePass: this.form.isSitePass,
            evaluationOpinion: this.form.suggestion,
            sitePhotos: this.form.image.map(ele => ele.url),
            signatureUrl: this.form.signatureUrl,
          }
          this.$axios.post('/exam/verify-record/verify', data).then(res => {
            if (res.data.code == 0) {
              this.$message.success('提交核验成功')
              this.isVerified = true
            } else {
              this.$message.error(res.data.msg || '提交核验失败')
            }
          }).finally(() => {
            this.submitLoading = false
          })
        }
      })
    },
    onPagesLoaded(msg) {
      console.log(msg)
    },
    onError(msg) {
      console.log(msg)
    },
    onPageChange() {}
  }
}
</script>