GCP证书保存新增字段
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
fe18b885f1
commit
9671722e1a
|
@ -1,11 +1,43 @@
|
|||
<template>
|
||||
<div class="gcp-container">
|
||||
<el-radio-group v-model="GCP" style="margin-bottom:20px">
|
||||
<el-radio :label="1">{{ $t('system:GcpCertificate:radio:Yes') }}</el-radio>
|
||||
<el-radio-group v-model="GCP" style="margin-bottom: 20px">
|
||||
<el-radio :label="1">{{
|
||||
$t('system:GcpCertificate:radio:Yes')
|
||||
}}</el-radio>
|
||||
<el-radio :label="0">{{ $t('system:GcpCertificate:radio:No') }}</el-radio>
|
||||
</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">
|
||||
<!-- <upload-file :doctor-id="doctorId" type="GCP" />-->
|
||||
<!-- <upload-file :doctor-id="doctorId" type="GCP" />-->
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
action
|
||||
|
@ -19,12 +51,23 @@
|
|||
:on-exceed="handleExceed"
|
||||
accept=".pdf"
|
||||
>
|
||||
<el-button size="small" type="primary" :loading="btnDisabled">{{ $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-button size="small" type="primary" :loading="btnDisabled">{{
|
||||
$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>
|
||||
</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') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
@ -32,26 +75,43 @@
|
|||
</template>
|
||||
<script>
|
||||
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'
|
||||
const defaultCertificateForm = () => {
|
||||
return {
|
||||
GCPTime: '',
|
||||
GCPAgencies: '',
|
||||
}
|
||||
}
|
||||
export default {
|
||||
name: 'GcpCertificate',
|
||||
components: {
|
||||
UploadFile
|
||||
UploadFile,
|
||||
},
|
||||
props: {
|
||||
doctorId: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
gcp: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
gcpId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
default: '',
|
||||
},
|
||||
DATA: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -59,7 +119,9 @@ export default {
|
|||
btnDisabled: false,
|
||||
saveBtnLoading: false,
|
||||
GCP: 0,
|
||||
GCPID: ''
|
||||
GCPID: '',
|
||||
certificateForm: defaultCertificateForm(),
|
||||
certificateRules: {},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -68,7 +130,16 @@ export default {
|
|||
},
|
||||
gcpId(val) {
|
||||
this.GCPID = val
|
||||
}
|
||||
},
|
||||
DATA: {
|
||||
handler() {
|
||||
Object.keys(this.certificateForm).forEach((key) => {
|
||||
this.certificateForm[key] = this.DATA[key]
|
||||
})
|
||||
},
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initFileList()
|
||||
|
@ -76,48 +147,53 @@ export default {
|
|||
methods: {
|
||||
handleSaveGCP() {
|
||||
if (this.GCP && this.GCPID === '') {
|
||||
this.$message.info(this.$t('reviewers:GCPCertificate:message:uploadValid'))
|
||||
this.$message.info(
|
||||
this.$t('reviewers:GCPCertificate:message:uploadValid')
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const param = {
|
||||
Id: this.doctorId,
|
||||
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
|
||||
updateGcpExperience(param).then(res => {
|
||||
if (this.GCP === 0) {
|
||||
this.fileList = []
|
||||
}
|
||||
this.saveBtnLoading = false
|
||||
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
}).catch(() => {
|
||||
this.saveBtnLoading = false
|
||||
})
|
||||
updateGcpExperience(param)
|
||||
.then((res) => {
|
||||
if (this.GCP === 0) {
|
||||
this.fileList = []
|
||||
}
|
||||
this.saveBtnLoading = false
|
||||
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.saveBtnLoading = false
|
||||
})
|
||||
},
|
||||
initFileList() {
|
||||
if(!this.doctorId) return
|
||||
getAttachmentByType(this.doctorId, 'GCP')
|
||||
.then(res => {
|
||||
if (res.IsSuccess) {
|
||||
if (res.Result.length > 0) {
|
||||
this.fileList = this.formatterFileList(res.Result)
|
||||
} else {
|
||||
this.fileList = []
|
||||
}
|
||||
if (!this.doctorId) return
|
||||
getAttachmentByType(this.doctorId, 'GCP').then((res) => {
|
||||
if (res.IsSuccess) {
|
||||
if (res.Result.length > 0) {
|
||||
this.fileList = this.formatterFileList(res.Result)
|
||||
} else {
|
||||
this.fileList = []
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
formatterFileList(list) {
|
||||
var arr = []
|
||||
list.forEach(item => {
|
||||
list.forEach((item) => {
|
||||
var data = {
|
||||
name: item.FileName,
|
||||
path: item.Path,
|
||||
fullPath: item.FullPath,
|
||||
id: item.Id,
|
||||
type: item.Type
|
||||
type: item.Type,
|
||||
}
|
||||
arr.push(data)
|
||||
})
|
||||
|
@ -127,8 +203,17 @@ export default {
|
|||
var fileName = param.file.name
|
||||
this.btnDisabled = true
|
||||
const file = await this.fileToBlob(param.file)
|
||||
const res = await this.OSSclient.put(`/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' })
|
||||
const res = await this.OSSclient.put(
|
||||
`/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()
|
||||
},
|
||||
// uploadFile(param) {
|
||||
|
@ -147,15 +232,24 @@ export default {
|
|||
// },
|
||||
saveFile() {
|
||||
const { name, path, fullPath, type } = this.fileList[0]
|
||||
const param = [{ DoctorId: this.doctorId, Type: type, Path: path, FullPath: fullPath, FileName: name }]
|
||||
saveAttachments(param).then(res => {
|
||||
this.btnDisabled = false
|
||||
if (res.IsSuccess) {
|
||||
this.fileList[0].id = res.Result[0].Id
|
||||
this.GCPID = res.Result[0].Id
|
||||
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
}
|
||||
})
|
||||
const param = [
|
||||
{
|
||||
DoctorId: this.doctorId,
|
||||
Type: type,
|
||||
Path: path,
|
||||
FullPath: fullPath,
|
||||
FileName: name,
|
||||
},
|
||||
]
|
||||
saveAttachments(param)
|
||||
.then((res) => {
|
||||
this.btnDisabled = false
|
||||
if (res.IsSuccess) {
|
||||
this.fileList[0].id = res.Result[0].Id
|
||||
this.GCPID = res.Result[0].Id
|
||||
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.btnDisabled = false
|
||||
})
|
||||
|
@ -177,19 +271,19 @@ export default {
|
|||
handleRemoveFile(file, fileList) {
|
||||
if (file && file.status === 'success') {
|
||||
if (file.id) {
|
||||
deleteAttachment(file.id, file.path).then(res => {
|
||||
deleteAttachment(file.id, file.path).then((res) => {
|
||||
if (res.IsSuccess) {
|
||||
this.fileList = []
|
||||
this.GCPID = ''
|
||||
this.$message({
|
||||
message: this.$t('common:message:deletedSuccessfully'),
|
||||
type: 'success'
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.fileList = []
|
||||
this.GCPID = ''
|
||||
this.GCPID = ''
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -202,18 +296,20 @@ export default {
|
|||
this.$message.warning(`Upload is currently limited to 1 file`)
|
||||
},
|
||||
fileValid(fileName, typeArr) {
|
||||
var extendName = fileName.substring(fileName.lastIndexOf('.') + 1).toLocaleLowerCase()
|
||||
var extendName = fileName
|
||||
.substring(fileName.lastIndexOf('.') + 1)
|
||||
.toLocaleLowerCase()
|
||||
if (typeArr.indexOf(extendName) > -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.gcp-container{
|
||||
.gcp-container {
|
||||
.upload-container .el-upload--text {
|
||||
border: none;
|
||||
width: 80px;
|
||||
|
|
|
@ -112,7 +112,12 @@
|
|||
<p>{{ $t('system:TrialExperience:title:GCP Certificate') }}</p>
|
||||
</div>
|
||||
<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 class="title-wrapper" style="margin-top: 10px">
|
||||
<p>{{ $t('system:TrialExperience:title:Other Relevant Experience') }}</p>
|
||||
|
@ -396,6 +401,7 @@ export default {
|
|||
selectId: '00000000-0000-0000-0000-000000000000',
|
||||
dictionaryList: {},
|
||||
otherId: 'ef84e9cb-f1a6-49d7-b6da-34be2c12abd5',
|
||||
GCPData: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -488,6 +494,10 @@ export default {
|
|||
this.clinicalTrialList = res.Result.ClinicalTrialExperienceList
|
||||
this.GCP = res.Result.GCP
|
||||
this.GCPID = res.Result.GCPId
|
||||
this.GCPData = {
|
||||
GCPAgencies: res.Result.GCPAgencies,
|
||||
GCPTime: res.Result.GCPTime,
|
||||
}
|
||||
this.OtherClinicalExperience = res.Result.OtherClinicalExperience
|
||||
this.OtherClinicalExperienceCN =
|
||||
res.Result.OtherClinicalExperienceCN
|
||||
|
|
Loading…
Reference in New Issue