351 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			351 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
| <template>
 | |
|   <div>
 | |
| 
 | |
|     <el-form
 | |
|       ref="conclusionsForm"
 | |
|       v-loading="loading"
 | |
|       :model="form"
 | |
|       label-width="100px"
 | |
|       style="width:500px"
 | |
|     >
 | |
|       <el-form-item
 | |
|         label="是否有问题"
 | |
|         prop="IsHaveQuestion"
 | |
|         :rules="[
 | |
|           { required: true, message: '请选择'},
 | |
|         ]"
 | |
|       >
 | |
|         <el-radio-group
 | |
|           v-model="form.IsHaveQuestion"
 | |
|           :disabled="isSendMessage || auditState===2 || userTypeEnumInt!==14"
 | |
|         >
 | |
|           <el-radio
 | |
|             v-for="item of $d.YesOrNo"
 | |
|             :key="'IsHaveQuestion' + item.value"
 | |
|             :label="item.value"
 | |
|           >
 | |
|             {{ item.label }}
 | |
|           </el-radio>
 | |
|         </el-radio-group>
 | |
|       </el-form-item>
 | |
| 
 | |
|       <el-form-item
 | |
|         v-if="form.IsHaveQuestion === true"
 | |
|         label="质询问题"
 | |
|         prop="Questioning"
 | |
|         maxlength="500"
 | |
|         autosize
 | |
|         show-word-limit
 | |
|         :rules="[
 | |
|           { required: true, message: '请注明'},
 | |
|         ]"
 | |
|       >
 | |
|         <el-input
 | |
|           v-model="form.Questioning"
 | |
|           type="textarea"
 | |
|           :disabled="isSendMessage || auditState===2 || userTypeEnumInt!==14"
 | |
|         />
 | |
|       </el-form-item>
 | |
| 
 | |
|       <el-form-item
 | |
|         v-if="form.IsHaveQuestion === true"
 | |
|         label="审核建议"
 | |
|         prop="AuditAdviceEnum"
 | |
|         :rules="[
 | |
|           { required: true, message: '请选择'},
 | |
|         ]"
 | |
|       >
 | |
|         <el-radio-group
 | |
|           v-model="form.AuditAdviceEnum"
 | |
|           :disabled="isSendMessage || auditState===2 || userTypeEnumInt!==14"
 | |
|         >
 | |
|           <el-radio
 | |
|             v-for="item of $d.AuditAdvice"
 | |
|             :key="item.id"
 | |
|             :label="item.value"
 | |
|           >
 | |
|             {{ item.label }}
 | |
|           </el-radio>
 | |
|         </el-radio-group>
 | |
|       </el-form-item>
 | |
|       <el-form-item
 | |
|         v-if="form.IsHaveQuestion === true"
 | |
|         label="截图说明"
 | |
|       >
 | |
|         <el-upload
 | |
|           :action="accept"
 | |
|           :limit="1"
 | |
|           :on-preview="handlePictureCardPreview"
 | |
|           :before-upload="handleBeforeUpload"
 | |
|           :http-request="uploadScreenshot"
 | |
|           list-type="picture-card"
 | |
|           :on-remove="handleRemove"
 | |
|           :file-list="fileList"
 | |
|           :class="{disabled:uploadDisabled}"
 | |
|           :disabled="isSendMessage || auditState===2 || userTypeEnumInt!==14"
 | |
|         >
 | |
|           <i slot="default" class="el-icon-plus" />
 | |
|           <div slot="file" slot-scope="{file}">
 | |
|             <img
 | |
|               class="el-upload-list__item-thumbnail"
 | |
|               :src="file.url"
 | |
|               alt=""
 | |
|             >
 | |
|             <span class="el-upload-list__item-actions">
 | |
|               <span
 | |
|                 class="el-upload-list__item-preview"
 | |
|                 @click="handlePictureCardPreview(file)"
 | |
|               >
 | |
|                 <i class="el-icon-zoom-in" />
 | |
|               </span>
 | |
| 
 | |
|               <span
 | |
|                 v-if="!isSendMessage && auditState!==2"
 | |
|                 class="el-upload-list__item-delete"
 | |
|                 @click="handleRemove(file)"
 | |
|               >
 | |
|                 <i class="el-icon-delete" />
 | |
|               </span>
 | |
|             </span>
 | |
|           </div>
 | |
|         </el-upload>
 | |
|         <el-dialog
 | |
|           append-to-body
 | |
|           :visible.sync="imgVisible"
 | |
|           width="600px"
 | |
|         >
 | |
|           <img width="100%" :src="imageUrl" alt="图片未找到">
 | |
|           <!-- <el-image
 | |
|             style="width: 100px; height: 100px"
 | |
|             :src="imageUrl"
 | |
|             :preview-src-list="[imageUrl]"
 | |
|           /> -->
 | |
|         </el-dialog>
 | |
|       </el-form-item>
 | |
|       <el-form-item>
 | |
|         <el-button
 | |
|           v-if="userTypeEnumInt===14 && auditState !== 2"
 | |
|           type="primary"
 | |
|           size="small"
 | |
|           :disabled="isSendMessage"
 | |
|           @click="handleSave(true)"
 | |
|         >
 | |
|           {{ form.IsHaveQuestion?'保存并发送':'保存' }}
 | |
|         </el-button>
 | |
|         <el-button
 | |
|           v-if="form.IsHaveQuestion === true && isSendMessage && userTypeEnumInt===14"
 | |
|           type="primary"
 | |
|           size="small"
 | |
|           @click="handleReply"
 | |
|         >
 | |
|           {{ isClosedDialog?'查看质询':'回复' }}
 | |
|         </el-button>
 | |
|         <el-button
 | |
|           v-if="form.IsHaveQuestion === true && isSendMessage && userTypeEnumInt===13"
 | |
|           type="primary"
 | |
|           size="small"
 | |
|           @click="handleReply"
 | |
|         >
 | |
|           {{ isClosedDialog?'查看质询':'回复' }}
 | |
|         </el-button>
 | |
|         <el-button
 | |
|           v-if="userTypeEnumInt===14 && form.IsHaveQuestion === true && !isClosedDialog && isSendMessage "
 | |
|           type="primary"
 | |
|           size="small"
 | |
|           @click="handleCloseReply"
 | |
|         >
 | |
|           关闭
 | |
|         </el-button>
 | |
|       </el-form-item>
 | |
|     </el-form>
 | |
| 
 | |
|     <el-dialog
 | |
|       v-if="chatVisible"
 | |
|       :visible.sync="chatVisible"
 | |
|       :close-on-click-modal="false"
 | |
|       width="800px"
 | |
|       title="质询记录"
 | |
|       append-to-body
 | |
|     >
 | |
|       <ChatForm :task-medical-review-id="form.TaskMedicalReviewId" />
 | |
|     </el-dialog>
 | |
|   </div>
 | |
| </template>
 | |
| <script>
 | |
| import { UploadMedicalReviewImage, saveMedicalReviewInfo, closedMedicalReviewDialog } from '@/api/trials'
 | |
| import ChatForm from './ChatForm'
 | |
| export default {
 | |
|   name: 'AuditConclusions',
 | |
|   components: {
 | |
|     ChatForm
 | |
|   },
 | |
|   props: {
 | |
|     medicalReviewInfo: {
 | |
|       type: Object,
 | |
|       default() {
 | |
|         return {}
 | |
|       }
 | |
|     },
 | |
|     auditState: {
 | |
|       type: Number,
 | |
|       required: true
 | |
|     }
 | |
|   },
 | |
|   data() {
 | |
|     return {
 | |
|       form: {
 | |
|         TaskMedicalReviewId: '',
 | |
|         IsHaveQuestion: null,
 | |
|         Questioning: '',
 | |
|         ImagePath: '',
 | |
|         AuditAdviceEnum: null
 | |
|       },
 | |
| 
 | |
|       loading: false,
 | |
|       accept: '.png,.jpg,.jpeg',
 | |
|       imgVisible: false,
 | |
|       imageUrl: '',
 | |
|       uploadDisabled: false,
 | |
|       fileList: [],
 | |
|       chatVisible: false,
 | |
|       userTypeEnumInt: zzSessionStorage.getItem('userTypeEnumInt') * 1,
 | |
|       isClosedDialog: false,
 | |
|       isSendMessage: false
 | |
|     }
 | |
|   },
 | |
|   mounted() {
 | |
|     this.initForm()
 | |
|     console.log((this.isSendMessage || this.auditState === 2) && this.userTypeEnumInt !== 14)
 | |
|   },
 | |
|   methods: {
 | |
|     initForm() {
 | |
|       if (Object.keys(this.medicalReviewInfo).length > 0) {
 | |
|         for (const k in this.form) {
 | |
|           if (this.medicalReviewInfo.hasOwnProperty(k)) {
 | |
|             this.form[k] = this.medicalReviewInfo[k]
 | |
|           }
 | |
|         }
 | |
|         if (this.form.ImagePath) {
 | |
|           this.fileList = [{ name: this.form.FileName, url: `/api/${this.form.ImagePath}` }]
 | |
|           this.imageUrl = `/api/${this.form.ImagePath}`
 | |
|           this.uploadDisabled = true
 | |
|         }
 | |
|         this.isClosedDialog = this.medicalReviewInfo.IsClosedDialog
 | |
|         this.isSendMessage = this.medicalReviewInfo.IsSendMessage
 | |
|       }
 | |
|     },
 | |
|     handleSave(isPrompt) {
 | |
|       return new Promise((resolve, reject) => {
 | |
|         this.$refs['conclusionsForm'].validate((valid) => {
 | |
|           if (!valid) {
 | |
|             reject()
 | |
|           } else {
 | |
|             this.loading = isPrompt
 | |
|             this.form.IsSendDialog = this.form.IsHaveQuestion
 | |
|             saveMedicalReviewInfo(this.form).then(res => {
 | |
|               if (isPrompt) {
 | |
|                 this.$message.success(this.$t('common:message:savedSuccessfully'))
 | |
|                 this.$emit('getMedicalAuditList')
 | |
|               }
 | |
|               this.isSendMessage = this.form.IsHaveQuestion
 | |
|               this.loading = false
 | |
|               resolve()
 | |
|             }).catch(() => {
 | |
|               this.loading = false
 | |
|               reject()
 | |
|             })
 | |
|           }
 | |
|         })
 | |
|       })
 | |
|     },
 | |
|     handleReply() {
 | |
|       this.chatVisible = true
 | |
|     },
 | |
|     handleCloseReply() {
 | |
|       this.$confirm('是否确认关闭质询?', {
 | |
|         type: 'warning',
 | |
|         distinguishCancelAndClose: true
 | |
|       })
 | |
|         .then(() => {
 | |
|           this.loading = true
 | |
|           var param = {
 | |
|             taskMedicalReviewId: this.form.TaskMedicalReviewId,
 | |
|             isClosedDialog: true
 | |
|           }
 | |
|           closedMedicalReviewDialog(param)
 | |
|             .then(res => {
 | |
|               this.loading = false
 | |
|               if (res.IsSuccess) {
 | |
|                 this.isClosedDialog = true
 | |
|                 this.$message.success('保存成功!')
 | |
|                 this.$emit('getMedicalAuditList')
 | |
|               }
 | |
|             }).catch(() => { this.loading = false })
 | |
|         })
 | |
|     },
 | |
|     uploadScreenshot(param) {
 | |
|       this.loading = true
 | |
|       this.uploadDisabled = false
 | |
|       const formData = new FormData()
 | |
|       formData.append('file', param.file)
 | |
|       UploadMedicalReviewImage(this.$route.query.trialId, this.form.TaskMedicalReviewId, formData).then(res => {
 | |
|         this.loading = false
 | |
|         if (res.IsSuccess) {
 | |
|           this.fileList.push({ name: res.Result.FileName, url: `/api/${res.Result.Path}` })
 | |
|           this.imageUrl = `/api/${res.Result.Path}`
 | |
|           this.form.ImagePath = res.Result.Path
 | |
|         }
 | |
|         this.uploadDisabled = true
 | |
|       }).catch(() => {
 | |
|         this.loading = false
 | |
|       })
 | |
|     },
 | |
|     handleBeforeUpload(file) {
 | |
|       // 检测文件类型是否符合要求
 | |
|       if (this.checkFileSuffix(file.name)) {
 | |
|         this.fileList = []
 | |
|         return true
 | |
|       } else {
 | |
|         this.$message.error(`必须是 ${this.accept} 格式`)
 | |
|         return false
 | |
|       }
 | |
|     },
 | |
|     checkFileSuffix(fileName) {
 | |
|       var index = fileName.lastIndexOf('.')
 | |
|       var suffix = fileName.substring(index + 1, fileName.length)
 | |
|       if (this.accept.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1) {
 | |
|         return false
 | |
|       } else {
 | |
|         return true
 | |
|       }
 | |
|     },
 | |
|     // 图片清空
 | |
|     removeImage() {
 | |
|       this.imageUrl = ''
 | |
|       this.fileList = []
 | |
|       this.form.ImagePath = ''
 | |
|     },
 | |
|     // 预览图片
 | |
|     handlePictureCardPreview() {
 | |
|       this.imgVisible = true
 | |
|       this.uploadDisabled = true
 | |
|     },
 | |
|     // 删除图片
 | |
|     handleRemove(file, fileList) {
 | |
|       this.uploadDisabled = false
 | |
|       this.imageUrl = ''
 | |
|       this.fileList = []
 | |
|       this.form.ImagePath = ''
 | |
|     }
 | |
|   }
 | |
| }
 | |
| </script>
 | |
| <style lang="scss" scoped>
 | |
| .disabled{
 | |
|   >>>.el-upload--picture-card {
 | |
|     display: none;
 | |
|   }
 | |
| }
 | |
| 
 | |
| </style>
 |