GCP证书保存新增字段
continuous-integration/drone/push Build is running Details

uat_us
wangxiaoshuang 2024-11-04 14:28:02 +08:00
parent fe18b885f1
commit 9671722e1a
2 changed files with 162 additions and 56 deletions

View File

@ -1,9 +1,41 @@
<template> <template>
<div class="gcp-container"> <div class="gcp-container">
<el-radio-group v-model="GCP" style="margin-bottom: 20px"> <el-radio-group v-model="GCP" style="margin-bottom: 20px">
<el-radio :label="1">{{ $t('system:GcpCertificate:radio:Yes') }}</el-radio> <el-radio :label="1">{{
$t('system:GcpCertificate:radio:Yes')
}}</el-radio>
<el-radio :label="0">{{ $t('system:GcpCertificate:radio:No') }}</el-radio> <el-radio :label="0">{{ $t('system:GcpCertificate:radio:No') }}</el-radio>
</el-radio-group> </el-radio-group>
<el-form
ref="certificateFrom"
v-loading="saveBtnLoading"
:model="certificateForm"
:rules="certificateRules"
label-width="80px"
size="small"
>
<el-form-item
:label="$t('curriculumVitae:clinicalTrials:form:CertificateTime')"
prop="GCPTime"
v-if="GCP"
>
<el-date-picker
v-model="certificateForm.GCPTime"
type="date"
placeholder=""
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item
:label="$t('curriculumVitae:clinicalTrials:form:certificateHospital')"
prop="GCPAgencies"
v-if="GCP"
>
<el-input v-model="certificateForm.GCPAgencies" clearable></el-input>
</el-form-item>
</el-form>
<div v-if="GCP" class="upload-container"> <div v-if="GCP" class="upload-container">
<!-- <upload-file :doctor-id="doctorId" type="GCP" />--> <!-- <upload-file :doctor-id="doctorId" type="GCP" />-->
<el-upload <el-upload
@ -19,12 +51,23 @@
:on-exceed="handleExceed" :on-exceed="handleExceed"
accept=".pdf" accept=".pdf"
> >
<el-button size="small" type="primary" :loading="btnDisabled">{{ $t('system:GcpCertificate:upload:Upload') }}</el-button> <el-button size="small" type="primary" :loading="btnDisabled">{{
<span slot="tip" style="margin-left:10px;" class="el-upload__tip">{{ $t('system:tip:file:pdf') }}</span> $t('system:GcpCertificate:upload:Upload')
}}</el-button>
<span slot="tip" style="margin-left: 10px" class="el-upload__tip">{{
$t('system:tip:file:pdf')
}}</span>
</el-upload> </el-upload>
</div> </div>
<div> <div>
<el-button :loading="saveBtnLoading" :disabled="(fileList.length === 0 && GCP === 1)" type="primary" size="small" style="margin-top:20px" @click="handleSaveGCP"> <el-button
:loading="saveBtnLoading"
:disabled="fileList.length === 0 && GCP === 1"
type="primary"
size="small"
style="margin-top: 20px"
@click="handleSaveGCP"
>
{{ $t('common:button:save') }} {{ $t('common:button:save') }}
</el-button> </el-button>
</div> </div>
@ -32,26 +75,43 @@
</template> </template>
<script> <script>
import UploadFile from '@/components/UploadFile' import UploadFile from '@/components/UploadFile'
import { uploadFile, deleteAttachment, getAttachmentByType, saveAttachments } from '@/api/attachment' import {
uploadFile,
deleteAttachment,
getAttachmentByType,
saveAttachments,
} from '@/api/attachment'
import { updateGcpExperience } from '@/api/reviewers' import { updateGcpExperience } from '@/api/reviewers'
const defaultCertificateForm = () => {
return {
GCPTime: '',
GCPAgencies: '',
}
}
export default { export default {
name: 'GcpCertificate', name: 'GcpCertificate',
components: { components: {
UploadFile UploadFile,
}, },
props: { props: {
doctorId: { doctorId: {
type: String, type: String,
required: true required: true,
}, },
gcp: { gcp: {
type: Number, type: Number,
default: 0 default: 0,
}, },
gcpId: { gcpId: {
type: String, type: String,
default: '' default: '',
} },
DATA: {
type: Object,
default: () => {
return {}
},
},
}, },
data() { data() {
return { return {
@ -59,7 +119,9 @@ export default {
btnDisabled: false, btnDisabled: false,
saveBtnLoading: false, saveBtnLoading: false,
GCP: 0, GCP: 0,
GCPID: '' GCPID: '',
certificateForm: defaultCertificateForm(),
certificateRules: {},
} }
}, },
watch: { watch: {
@ -68,7 +130,16 @@ export default {
}, },
gcpId(val) { gcpId(val) {
this.GCPID = val this.GCPID = val
} },
DATA: {
handler() {
Object.keys(this.certificateForm).forEach((key) => {
this.certificateForm[key] = this.DATA[key]
})
},
immediate: true,
deep: true,
},
}, },
mounted() { mounted() {
this.initFileList() this.initFileList()
@ -76,30 +147,35 @@ export default {
methods: { methods: {
handleSaveGCP() { handleSaveGCP() {
if (this.GCP && this.GCPID === '') { if (this.GCP && this.GCPID === '') {
this.$message.info(this.$t('reviewers:GCPCertificate:message:uploadValid')) this.$message.info(
this.$t('reviewers:GCPCertificate:message:uploadValid')
)
return return
} }
const param = { const param = {
Id: this.doctorId, Id: this.doctorId,
GCP: this.GCP, GCP: this.GCP,
GCPId: this.GCP ? this.GCPID : '' GCPId: this.GCP ? this.GCPID : '',
GCPTime: this.GCP ? this.certificateForm.GCPTime : '',
GCPAgencies: this.GCP ? this.certificateForm.GCPAgencies : '',
} }
this.saveBtnLoading = true this.saveBtnLoading = true
updateGcpExperience(param).then(res => { updateGcpExperience(param)
.then((res) => {
if (this.GCP === 0) { if (this.GCP === 0) {
this.fileList = [] this.fileList = []
} }
this.saveBtnLoading = false this.saveBtnLoading = false
this.$message.success(this.$t('common:message:savedSuccessfully')) this.$message.success(this.$t('common:message:savedSuccessfully'))
}).catch(() => { })
.catch(() => {
this.saveBtnLoading = false this.saveBtnLoading = false
}) })
}, },
initFileList() { initFileList() {
if (!this.doctorId) return if (!this.doctorId) return
getAttachmentByType(this.doctorId, 'GCP') getAttachmentByType(this.doctorId, 'GCP').then((res) => {
.then(res => {
if (res.IsSuccess) { if (res.IsSuccess) {
if (res.Result.length > 0) { if (res.Result.length > 0) {
this.fileList = this.formatterFileList(res.Result) this.fileList = this.formatterFileList(res.Result)
@ -111,13 +187,13 @@ export default {
}, },
formatterFileList(list) { formatterFileList(list) {
var arr = [] var arr = []
list.forEach(item => { list.forEach((item) => {
var data = { var data = {
name: item.FileName, name: item.FileName,
path: item.Path, path: item.Path,
fullPath: item.FullPath, fullPath: item.FullPath,
id: item.Id, id: item.Id,
type: item.Type type: item.Type,
} }
arr.push(data) arr.push(data)
}) })
@ -127,8 +203,17 @@ export default {
var fileName = param.file.name var fileName = param.file.name
this.btnDisabled = true this.btnDisabled = true
const file = await this.fileToBlob(param.file) const file = await this.fileToBlob(param.file)
const res = await this.OSSclient.put(`/SystemData/reviewer/GCP/${this.doctorId}/${fileName}`, file) const res = await this.OSSclient.put(
this.fileList.push({ name: fileName, path: this.$getObjectName(res.url), fullPath: this.$getObjectName(res.url),url: this.$getObjectName(res.url), type: 'GCP' }) `/SystemData/reviewer/GCP/${this.doctorId}/${fileName}`,
file
)
this.fileList.push({
name: fileName,
path: this.$getObjectName(res.url),
fullPath: this.$getObjectName(res.url),
url: this.$getObjectName(res.url),
type: 'GCP',
})
this.saveFile() this.saveFile()
}, },
// uploadFile(param) { // uploadFile(param) {
@ -147,8 +232,17 @@ export default {
// }, // },
saveFile() { saveFile() {
const { name, path, fullPath, type } = this.fileList[0] const { name, path, fullPath, type } = this.fileList[0]
const param = [{ DoctorId: this.doctorId, Type: type, Path: path, FullPath: fullPath, FileName: name }] const param = [
saveAttachments(param).then(res => { {
DoctorId: this.doctorId,
Type: type,
Path: path,
FullPath: fullPath,
FileName: name,
},
]
saveAttachments(param)
.then((res) => {
this.btnDisabled = false this.btnDisabled = false
if (res.IsSuccess) { if (res.IsSuccess) {
this.fileList[0].id = res.Result[0].Id this.fileList[0].id = res.Result[0].Id
@ -177,13 +271,13 @@ export default {
handleRemoveFile(file, fileList) { handleRemoveFile(file, fileList) {
if (file && file.status === 'success') { if (file && file.status === 'success') {
if (file.id) { if (file.id) {
deleteAttachment(file.id, file.path).then(res => { deleteAttachment(file.id, file.path).then((res) => {
if (res.IsSuccess) { if (res.IsSuccess) {
this.fileList = [] this.fileList = []
this.GCPID = '' this.GCPID = ''
this.$message({ this.$message({
message: this.$t('common:message:deletedSuccessfully'), message: this.$t('common:message:deletedSuccessfully'),
type: 'success' type: 'success',
}) })
} }
}) })
@ -202,14 +296,16 @@ export default {
this.$message.warning(`Upload is currently limited to 1 file`) this.$message.warning(`Upload is currently limited to 1 file`)
}, },
fileValid(fileName, typeArr) { fileValid(fileName, typeArr) {
var extendName = fileName.substring(fileName.lastIndexOf('.') + 1).toLocaleLowerCase() var extendName = fileName
.substring(fileName.lastIndexOf('.') + 1)
.toLocaleLowerCase()
if (typeArr.indexOf(extendName) > -1) { if (typeArr.indexOf(extendName) > -1) {
return true return true
} else { } else {
return false return false
} }
} },
} },
} }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -112,7 +112,12 @@
<p>{{ $t('system:TrialExperience:title:GCP Certificate') }}</p> <p>{{ $t('system:TrialExperience:title:GCP Certificate') }}</p>
</div> </div>
<div style="margin-left: 40px; width: 40%"> <div style="margin-left: 40px; width: 40%">
<gcp-certificate :doctor-id="doctorId" :gcp="GCP" :gcp-id="GCPID" /> <gcp-certificate
:doctor-id="doctorId"
:gcp="GCP"
:gcp-id="GCPID"
:DATA="GCPData"
/>
</div> </div>
<div class="title-wrapper" style="margin-top: 10px"> <div class="title-wrapper" style="margin-top: 10px">
<p>{{ $t('system:TrialExperience:title:Other Relevant Experience') }}</p> <p>{{ $t('system:TrialExperience:title:Other Relevant Experience') }}</p>
@ -396,6 +401,7 @@ export default {
selectId: '00000000-0000-0000-0000-000000000000', selectId: '00000000-0000-0000-0000-000000000000',
dictionaryList: {}, dictionaryList: {},
otherId: 'ef84e9cb-f1a6-49d7-b6da-34be2c12abd5', otherId: 'ef84e9cb-f1a6-49d7-b6da-34be2c12abd5',
GCPData: {},
} }
}, },
computed: { computed: {
@ -488,6 +494,10 @@ export default {
this.clinicalTrialList = res.Result.ClinicalTrialExperienceList this.clinicalTrialList = res.Result.ClinicalTrialExperienceList
this.GCP = res.Result.GCP this.GCP = res.Result.GCP
this.GCPID = res.Result.GCPId this.GCPID = res.Result.GCPId
this.GCPData = {
GCPAgencies: res.Result.GCPAgencies,
GCPTime: res.Result.GCPTime,
}
this.OtherClinicalExperience = res.Result.OtherClinicalExperience this.OtherClinicalExperience = res.Result.OtherClinicalExperience
this.OtherClinicalExperienceCN = this.OtherClinicalExperienceCN =
res.Result.OtherClinicalExperienceCN res.Result.OtherClinicalExperienceCN