申办方、cro项目中新增

uat_us
wangxiaoshuang 2024-05-31 17:45:33 +08:00
parent 7e7e374e38
commit 6737d33dcb
2 changed files with 451 additions and 193 deletions

View File

@ -353,12 +353,14 @@ async function VueInit() {
return return
} }
_vm.$store.dispatch('user/logout').then(res => { _vm.$store.dispatch('user/logout').then(res => {
window.location.href = `/login` // window.location.href = `/login`
router.push("/login")
}).then(()=>{
_vm.$alert(lang === 'zh' ? '由于您长时间未操作,为保护您的数据安全已强制将您下线,如果需要继续操作请重新登陆!' : 'No operation for a long time non-operation, you have been forced logout to protect data security. If continue to operate, please login again!', {
type: 'warning',
})
}) })
_vm.$alert(lang === 'zh' ? '由于您长时间未操作,为保护您的数据安全已强制将您下线,如果需要继续操作请重新登陆!' : 'No operation for a long time non-operation, you have been forced logout to protect data security. If continue to operate, please login again!', {
type: 'warning',
})
} : () => { }, process.env.VUE_APP_LOGOUT_FOR_TIME, } : () => { }, process.env.VUE_APP_LOGOUT_FOR_TIME,
eval(process.env.VUE_APP_LOCK_FOR_PERMISSION) ? () => { eval(process.env.VUE_APP_LOCK_FOR_PERMISSION) ? () => {
var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh' var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh'

View File

@ -12,29 +12,58 @@
> >
<el-row> <el-row>
<!-- 项目编号 --> <!-- 项目编号 -->
<el-form-item v-if="trialForm.Id!== ''" :label="$t('trials:trials-list:form:trialId')" prop="TrialCode"> <el-form-item
v-if="trialForm.Id !== ''"
:label="$t('trials:trials-list:form:trialId')"
prop="TrialCode"
>
<el-input v-model="trialForm.TrialCode" /> <el-input v-model="trialForm.TrialCode" />
</el-form-item> </el-form-item>
<!-- 项目类型 --> <!-- 项目类型 -->
<el-form-item :label="$t('trials:trials-list:form:trialType')" prop="TrialType"> <el-form-item
<el-radio-group v-model="trialForm.TrialType " :disabled="trialForm.Id!== ''"> :label="$t('trials:trials-list:form:trialType')"
<el-radio v-for="item of $d.TrialType" :disabled="isTestUser && (item.value === 1 || item.value === 2)" :key="item.id" :label="item.value">{{ item.label }}</el-radio> prop="TrialType"
>
<el-radio-group
v-model="trialForm.TrialType"
:disabled="trialForm.Id !== ''"
>
<el-radio
v-for="item of $d.TrialType"
:disabled="isTestUser && (item.value === 1 || item.value === 2)"
:key="item.id"
:label="item.value"
>{{ item.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row>
<!-- 试验名称 --> <!-- 试验名称 -->
<el-form-item :label="$t('trials:trials-list:form:experimentName')" prop="ExperimentName"> <el-form-item
<el-input v-model="trialForm.ExperimentName" type="textarea" :autosize="{ minRows: 1, maxRows: 4}" /> :label="$t('trials:trials-list:form:experimentName')"
prop="ExperimentName"
>
<el-input
v-model="trialForm.ExperimentName"
type="textarea"
:autosize="{ minRows: 1, maxRows: 4 }"
/>
</el-form-item> </el-form-item>
<!-- 研究方案号 --> <!-- 研究方案号 -->
<el-form-item :label="$t('trials:trials-list:form:researchNumber')" prop="ResearchProgramNo"> <el-form-item
:label="$t('trials:trials-list:form:researchNumber')"
prop="ResearchProgramNo"
>
<el-input v-model="trialForm.ResearchProgramNo" /> <el-input v-model="trialForm.ResearchProgramNo" />
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row>
<!-- 主研单位 --> <!-- 主研单位 -->
<el-form-item :label="$t('trials:trials-list:form:researchUnit')" prop="MainResearchUnit"> <el-form-item
:label="$t('trials:trials-list:form:researchUnit')"
prop="MainResearchUnit"
>
<el-input v-model="trialForm.MainResearchUnit" /> <el-input v-model="trialForm.MainResearchUnit" />
</el-form-item> </el-form-item>
<!-- 负责人PI --> <!-- 负责人PI -->
@ -45,9 +74,18 @@
<el-row> <el-row>
<!-- 申办方 --> <!-- 申办方 -->
<el-form-item :label="$t('trials:trials-list:form:sponsor')"> <el-form-item :label="$t('trials:trials-list:form:sponsor')">
<el-select v-model="trialForm.SponsorId"> <el-select
v-model="trialForm.SponsorId"
filterable
allow-create
default-first-option
@change="(value) => handleSelectChange(value, 'sponsor')"
@visible-change="
(flag) => handleSelectVisibbleChange(flag, 'sponsor')
"
>
<el-option <el-option
v-for="(item) in sponsorList" v-for="item in sponsorList"
:key="item.Id" :key="item.Id"
:label="item.SponsorName" :label="item.SponsorName"
:value="item.Id" :value="item.Id"
@ -56,9 +94,18 @@
</el-form-item> </el-form-item>
<!-- CRO --> <!-- CRO -->
<el-form-item :label="$t('trials:trials-list:form:cro')"> <el-form-item :label="$t('trials:trials-list:form:cro')">
<el-select v-model="trialForm.CROId"> <el-select
v-model="trialForm.CROId"
filterable
allow-create
default-first-option
@change="(value) => handleSelectChange(value, 'cro')"
@visible-change="
(flag) => handleSelectVisibbleChange(flag, 'sponsor')
"
>
<el-option <el-option
v-for="(item) of croList" v-for="item of croList"
:key="item.Id" :key="item.Id"
:label="item.CROName" :label="item.CROName"
:value="item.Id" :value="item.Id"
@ -68,7 +115,10 @@
</el-row> </el-row>
<el-row> <el-row>
<!-- DeclarationType --> <!-- DeclarationType -->
<el-form-item :label="$t('trials:trials-list:form:declarationType')" prop="DeclarationTypeEnumList"> <el-form-item
:label="$t('trials:trials-list:form:declarationType')"
prop="DeclarationTypeEnumList"
>
<el-select <el-select
v-model="trialForm.DeclarationTypeEnumList" v-model="trialForm.DeclarationTypeEnumList"
size="small" size="small"
@ -77,7 +127,12 @@
@change="handleDeclarationTypeChange" @change="handleDeclarationTypeChange"
style="width: 100%" style="width: 100%"
> >
<el-option v-for="item of $d.DeclarationType" :key="item.value" :value="item.value" :label="item.label" /> <el-option
v-for="item of $d.DeclarationType"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- Phase --> <!-- Phase -->
@ -100,8 +155,14 @@
</el-row> </el-row>
<el-row> <el-row>
<!-- 适应症类型 IndicationType --> <!-- 适应症类型 IndicationType -->
<el-form-item :label="$t('trials:trials-list:form:indicationType')" prop="IndicationTypeId"> <el-form-item
<el-select v-model="trialForm.IndicationTypeId" @change="handleIndicationTypeChange"> :label="$t('trials:trials-list:form:indicationType')"
prop="IndicationTypeId"
>
<el-select
v-model="trialForm.IndicationTypeId"
@change="handleIndicationTypeChange"
>
<!-- <el-option <!-- <el-option
v-for="item of dictionaryList.IndicationType" v-for="item of dictionaryList.IndicationType"
:key="item.Id" :key="item.Id"
@ -117,9 +178,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- Indication --> <!-- Indication -->
<el-form-item :label="$t('trials:trials-list:form:indication')" prop="IndicationEnum"> <el-form-item
:label="$t('trials:trials-list:form:indication')"
prop="IndicationEnum"
>
<!-- <el-input v-model="trialForm.Indication" />--> <!-- <el-input v-model="trialForm.Indication" />-->
<el-select :disabled="!trialForm.IndicationTypeId" v-if="![37, 38, 39].includes(trialForm.IndicationEnum)" v-model="trialForm.IndicationEnum"> <el-select
:disabled="!trialForm.IndicationTypeId"
v-if="![37, 38, 39].includes(trialForm.IndicationEnum)"
v-model="trialForm.IndicationEnum"
>
<el-option <el-option
v-for="item of $d.Indication" v-for="item of $d.Indication"
v-show="indicationGrouping === item.raw.ChildGroup" v-show="indicationGrouping === item.raw.ChildGroup"
@ -130,7 +198,11 @@
</el-select> </el-select>
<el-row v-if="[37, 38, 39].includes(trialForm.IndicationEnum)"> <el-row v-if="[37, 38, 39].includes(trialForm.IndicationEnum)">
<el-col :span="12"> <el-col :span="12">
<el-select :disabled="!trialForm.IndicationTypeId" v-model="trialForm.IndicationEnum" style="width: 100%;margin-right: 10px;"> <el-select
:disabled="!trialForm.IndicationTypeId"
v-model="trialForm.IndicationEnum"
style="width: 100%; margin-right: 10px"
>
<el-option <el-option
v-for="item of $d.Indication" v-for="item of $d.Indication"
v-show="indicationGrouping === item.raw.ChildGroup" v-show="indicationGrouping === item.raw.ChildGroup"
@ -141,7 +213,10 @@
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-input :disabled="!trialForm.IndicationTypeId" v-model="trialForm.Indication" /> <el-input
:disabled="!trialForm.IndicationTypeId"
v-model="trialForm.Indication"
/>
</el-col> </el-col>
</el-row> </el-row>
</el-form-item> </el-form-item>
@ -166,9 +241,12 @@
</el-form-item> </el-form-item>
<!-- Sites --> <!-- Sites -->
<el-form-item :label="$t('trials:trials-list:form:siteCount')"> <el-form-item :label="$t('trials:trials-list:form:siteCount')">
<el-input-number v-model="trialForm.PlanSiteCount" controls-position="right" :min="0" /> <el-input-number
v-model="trialForm.PlanSiteCount"
controls-position="right"
:min="0"
/>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row>
<!-- Expected Patients Num --> <!-- Expected Patients Num -->
@ -193,14 +271,19 @@
<el-row> <el-row>
<!-- Visits --> <!-- Visits -->
<el-form-item :label="$t('trials:trials-list:form:visitCount')"> <el-form-item :label="$t('trials:trials-list:form:visitCount')">
<el-input-number v-model="trialForm.PlanVisitCount" controls-position="right" :min="0" /> <el-input-number
v-model="trialForm.PlanVisitCount"
controls-position="right"
:min="0"
/>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row>
<!-- Expedited --> <!-- Expedited -->
<el-form-item :label="$t('trials:trials-list:form:expedited')" prop="Expedited"> <el-form-item
:label="$t('trials:trials-list:form:expedited')"
prop="Expedited"
>
<el-select v-model="trialForm.Expedited"> <el-select v-model="trialForm.Expedited">
<el-option <el-option
v-for="item in expeditedOption" v-for="item in expeditedOption"
@ -211,15 +294,21 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- Turnaround Time --> <!-- Turnaround Time -->
<el-form-item :label="$t('trials:trials-list:form:projectCycle')" prop="ProjectCycle"> <el-form-item
:label="$t('trials:trials-list:form:projectCycle')"
prop="ProjectCycle"
>
<el-input v-model="trialForm.ProjectCycle" /> <el-input v-model="trialForm.ProjectCycle" />
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row>
<!-- Total Reviewers --> <!-- Total Reviewers -->
<el-form-item :label="$t('trials:trials-list:form:totalReviewers')"> <el-form-item :label="$t('trials:trials-list:form:totalReviewers')">
<el-input-number v-model="trialForm.TotalReviewers" controls-position="right" :min="0" /> <el-input-number
v-model="trialForm.TotalReviewers"
controls-position="right"
:min="0"
/>
</el-form-item> </el-form-item>
<!-- Type of Reviewers --> <!-- Type of Reviewers -->
<el-form-item :label="$t('trials:trials-list:form:typeofReviewers')"> <el-form-item :label="$t('trials:trials-list:form:typeofReviewers')">
@ -229,106 +318,96 @@
multiple multiple
clearable clearable
> >
<el-option v-for="item of $d.AttendedReviewerType" :key="item.value" :value="item.value" :label="item.label" /> <el-option
v-for="item of $d.AttendedReviewerType"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select> </el-select>
<!-- <el-row v-if="trialForm.AttendedReviewerTypeEnumList.includes(2)">--> <!-- <el-row v-if="trialForm.AttendedReviewerTypeEnumList.includes(2)">-->
<!-- <el-col :span="12">--> <!-- <el-col :span="12">-->
<!-- <el-select--> <!-- <el-select-->
<!-- v-model="trialForm.AttendedReviewerTypeEnumList"--> <!-- v-model="trialForm.AttendedReviewerTypeEnumList"-->
<!-- size="small"--> <!-- size="small"-->
<!-- multiple--> <!-- multiple-->
<!-- clearable--> <!-- clearable-->
<!-- style="width: 100%"--> <!-- style="width: 100%"-->
<!-- >--> <!-- >-->
<!-- <el-option v-for="item of $d.AttendedReviewerType" :key="item.value" :value="item.value" :label="item.label" />--> <!-- <el-option v-for="item of $d.AttendedReviewerType" :key="item.value" :value="item.value" :label="item.label" />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- <el-col :span="12">--> <!-- <el-col :span="12">-->
<!-- <el-input size="small" v-model="trialForm.AttendedReviewerTypeOther"/>--> <!-- <el-input size="small" v-model="trialForm.AttendedReviewerTypeOther"/>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- </el-row>--> <!-- </el-row>-->
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row style="margin-left:190px"> <el-row style="margin-left: 190px">
<el-form-item label=""> <el-form-item label="">
<el-button type="primary" :disabled="btnLoading" @click="handleCancel"> <el-button type="primary" :disabled="btnLoading" @click="handleCancel">
{{ $t('trials:trials-list:form:cancel') }} {{ $t("trials:trials-list:form:cancel") }}
</el-button> </el-button>
<el-button type="primary" :loading="btnLoading" @click="handleSave"> <el-button type="primary" :loading="btnLoading" @click="handleSave">
{{ $t('trials:trials-list:form:save') }} {{ $t("trials:trials-list:form:save") }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> </el-form>
</template> </template>
<script> <script>
import store from '@/store' import store from "@/store";
import { mapGetters, mapState } from 'vuex' import { mapState } from "vuex";
import { getTrialInfo, addOrUpdateTrial } from '@/api/trials' import { getTrialInfo, addOrUpdateTrial } from "@/api/trials";
import { getBasicDataSelects } from '@/api/dictionary/dictionary' import { getBasicDataSelects } from "@/api/dictionary/dictionary";
import { addOrUpdateSponsor, addOrUpdateCro } from "@/api/dictionary";
import { getAllSponsorList, getAllCROList } from "@/api/global";
export default { export default {
name: 'TrialForm', name: "TrialForm",
props: { props: {
trialId: { trialId: {
type: String, type: String,
default: '' default: "",
} },
}, },
data() { data() {
const comfirmIndication = (rule, value, callback) => { const comfirmIndication = (rule, value, callback) => {
if ([37, 38, 39].includes(value)) { if ([37, 38, 39].includes(value)) {
if (!this.trialForm.Indication) { if (!this.trialForm.Indication) {
return callback(new Error(this.$t('common:ruleMessage:specify'))) return callback(new Error(this.$t("common:ruleMessage:specify")));
} }
} }
callback() callback();
} };
// const comfirmDeclarationType = (rule, value, callback) => {
// console.log(value)
// if (value.includes(-1)) {
// if (!this.trialForm.DeclarationTypeOther) {
// return callback(new Error(this.$t('common:ruleMessage:specify')))
// }
// }
// callback()
// }
// const comfirmAttendedReviewerType = (rule, value, callback) => {
// if (value.includes(2)) {
// if (!this.trialForm.AttendedReviewerTypeOther) {
// return callback(new Error(this.$t('common:ruleMessage:specify')))
// }
// }
// callback()
// }
return { return {
trialForm: { trialForm: {
Id: '', Id: "",
TrialCode: '', TrialCode: "",
TrialType: null, TrialType: null,
SponsorId: '', SponsorId: "",
// CriterionIds: [], // CriterionIds: [],
CROId: '', CROId: "",
ReviewModeId: '', ReviewModeId: "",
ReviewTypeIds: [], ReviewTypeIds: [],
// 0 // 0
Expedited: '', Expedited: "",
ModalityIds: [], ModalityIds: [],
Note: '', Note: "",
ExpectedPatients: '', ExpectedPatients: "",
TimePointsPerPatient: '', TimePointsPerPatient: "",
ProjectCycle: '', ProjectCycle: "",
TotalReviewers: '', TotalReviewers: "",
DeclarationTypeId: '', DeclarationTypeId: "",
IndicationTypeId: '', IndicationTypeId: "",
PhaseId: '', PhaseId: "",
AttendedReviewerType: '', AttendedReviewerType: "",
IsLocked: false, IsLocked: false,
ResearchProgramNo: '', ResearchProgramNo: "",
ExperimentName: '', ExperimentName: "",
MainResearchUnit: '', MainResearchUnit: "",
HeadPI: '', HeadPI: "",
PlanSiteCount: null, PlanSiteCount: null,
PlanVisitCount: null, PlanVisitCount: null,
IndicationEnum: null, IndicationEnum: null,
@ -336,48 +415,113 @@ export default {
AttendedReviewerTypeEnumList: [], AttendedReviewerTypeEnumList: [],
DeclarationTypeEnumList: [], DeclarationTypeEnumList: [],
DeclarationTypeOther: null, DeclarationTypeOther: null,
AttendedReviewerTypeOther: null AttendedReviewerTypeOther: null,
}, },
indicationGrouping: null, indicationGrouping: null,
trialFormRules: { trialFormRules: {
TrialCode: [ TrialCode: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, {
{ max: 10, message: `${this.$t('common:ruleMessage:maxLength')} 10` } required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
},
{ max: 10, message: `${this.$t("common:ruleMessage:maxLength")} 10` },
], ],
TrialType: [ TrialType: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' } {
required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
},
], ],
ResearchProgramNo: [ ResearchProgramNo: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, {
{ max: 100, message: `${this.$t('common:ruleMessage:maxLength')} 100` } required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
},
{
max: 100,
message: `${this.$t("common:ruleMessage:maxLength")} 100`,
},
], ],
ExperimentName: [ ExperimentName: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, {
{ max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500` } required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
},
{
max: 500,
message: `${this.$t("common:ruleMessage:maxLength")} 500`,
},
], ],
IndicationEnum: [ IndicationEnum: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, {
{ validator: comfirmIndication, trigger: 'blur' } required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
},
{ validator: comfirmIndication, trigger: "blur" },
],
ProjectCycle: [
{ max: 50, message: `${this.$t("common:ruleMessage:maxLength")} 50` },
], ],
ProjectCycle: [{ max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` }],
ReviewModeId: [ ReviewModeId: [
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] } {
required: true,
message: this.$t("common:ruleMessage:select"),
trigger: ["blur", "change"],
},
], ],
Expedited: [ Expedited: [
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] } {
required: true,
message: this.$t("common:ruleMessage:select"),
trigger: ["blur", "change"],
},
],
Note: [
{
max: 500,
message: `${this.$t("common:ruleMessage:maxLength")} 500`,
},
], ],
Note: [{ max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500` }],
ModalityIds: [ ModalityIds: [
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] } {
required: true,
message: this.$t("common:ruleMessage:select"),
trigger: ["blur", "change"],
},
],
PhaseId: [
{
required: true,
message: this.$t("common:ruleMessage:select"),
trigger: ["blur", "change"],
},
],
IndicationTypeId: [
{
required: true,
message: this.$t("common:ruleMessage:select"),
trigger: ["blur", "change"],
},
], ],
PhaseId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }],
IndicationTypeId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }],
DeclarationTypeEnumList: [ DeclarationTypeEnumList: [
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] } {
required: true,
message: this.$t("common:ruleMessage:select"),
trigger: ["blur", "change"],
},
], ],
ReviewTypeIds: [ ReviewTypeIds: [
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] } {
] required: true,
message: this.$t("common:ruleMessage:select"),
trigger: ["blur", "change"],
},
],
}, },
btnLoading: false, btnLoading: false,
isLock: false, isLock: false,
@ -386,132 +530,244 @@ export default {
declarationNum: null, declarationNum: null,
indicationNum: null, indicationNum: null,
phaseNum: null, phaseNum: null,
dictionaryList: {} dictionaryList: {},
}
sponsorList: [],
croList: [],
};
}, },
computed: { computed: {
...mapGetters(['sponsorList', 'croList']), ...mapState("user", ["isTestUser"]),
...mapState('user', ['isTestUser'])
}, },
mounted() { mounted() {
this.initPage() this.initPage();
console.log(this.isTestUser, 'isTestUser') console.log(this.isTestUser, "isTestUser");
}, },
methods: { methods: {
initForm() { // CRO
this.loading = true handleSelectVisibbleChange(flag, key) {
getTrialInfo(this.trialId).then(res => { if (flag) {
this.loading = false if (key === "sponsor") {
if (res.IsSuccess) { this.getAllSponsorList();
for (var item in this.trialForm) { }
res.Result[item] === '00000000-0000-0000-0000-000000000000' ? '' : this.$set(this.trialForm, item, res.Result[item]) if (key === "cro") {
if (item === 'IndicationTypeId') { this.getAllCROList();
this.indicationGrouping = this.$d.IndicationType.filter(v => v.id === res.Result[item])[0].raw.ChildGroup }
} }
},
// CRO
async handleSelectChange(value, key) {
let arr = key == "sponsor" ? this.sponsorList : this.croList;
let has = arr.some((item) => item.Id === value);
if (!has) {
let res = null;
try {
if (key === "sponsor") {
let data = {
CroName: value,
CroNameCN: value,
IsTrialLevel: true,
};
res = await addOrUpdateSponsor(data);
}
if (key === "cro") {
let data = {
SponsorName: value,
SponsorNameCN: value,
IsTrialLevel: true,
};
res = await addOrUpdateCro(data);
}
if (res.IsSuccess) {
let obj = {
Id: res.Result,
CROName: value,
SponsorName: value,
};
arr.unshift(obj);
this.$nextTick(() => {
if (key === "sponsor") {
this.trialForm.SponsorId = res.Result;
}
if (key === "cro") {
this.trialForm.CROId = res.Result;
}
});
}
} catch (err) {
console.log(err);
if (key === "sponsor") {
this.trialForm.SponsorId = null;
}
if (key === "cro") {
this.trialForm.CROId = null;
} }
} }
}).catch(() => { this.loading = false }) }
},
async getAllSponsorList() {
try {
let res = await getAllSponsorList();
if (res.IsSuccess) {
this.sponsorList = res.Result;
}
} catch (err) {
console.log(err);
}
},
async getAllCROList() {
try {
let res = await getAllCROList();
if (res.IsSuccess) {
this.croList = res.Result;
}
} catch (err) {
console.log(err);
}
},
initForm() {
this.loading = true;
getTrialInfo(this.trialId)
.then((res) => {
this.loading = false;
if (res.IsSuccess) {
for (var item in this.trialForm) {
res.Result[item] === "00000000-0000-0000-0000-000000000000"
? ""
: this.$set(this.trialForm, item, res.Result[item]);
if (item === "IndicationTypeId") {
this.indicationGrouping = this.$d.IndicationType.filter(
(v) => v.id === res.Result[item]
)[0].raw.ChildGroup;
}
}
}
})
.catch(() => {
this.loading = false;
});
}, },
handleSave() { handleSave() {
this.$refs.trialForm.validate(valid => { this.$refs.trialForm.validate((valid) => {
if (valid) { if (valid) {
this.btnLoading = true this.btnLoading = true;
if (!this.trialForm.Id) { if (!this.trialForm.Id) {
this.trialForm.TrialCode = `${this.declarationNum}${this.indicationNum}${this.phaseNum}` this.trialForm.TrialCode = `${this.declarationNum}${this.indicationNum}${this.phaseNum}`;
console.log(this.trialForm.TrialCode) console.log(this.trialForm.TrialCode);
} }
var params = JSON.parse(JSON.stringify(this.trialForm)) var params = JSON.parse(JSON.stringify(this.trialForm));
console.log(params) console.log(params);
addOrUpdateTrial(params).then(res => { addOrUpdateTrial(params)
this.btnLoading = false .then((res) => {
if (!this.trialForm.Id) { this.btnLoading = false;
this.trialForm.Id = res.Result if (!this.trialForm.Id) {
this.$message.success(this.$t('trials:trials-list:message:addedSuccessfully')) this.trialForm.Id = res.Result;
} else { this.$message.success(
this.$message.success(this.$t('trials:trials-list:message:updatedSuccessfully')) this.$t("trials:trials-list:message:addedSuccessfully")
} );
} else {
this.$message.success(
this.$t("trials:trials-list:message:updatedSuccessfully")
);
}
this.$emit('getList') this.$emit("getList");
this.$emit('closeDialog') this.$emit("closeDialog");
}).catch(() => { })
this.btnLoading = false .catch(() => {
}) this.btnLoading = false;
});
} }
}) });
}, },
handleCancel() { handleCancel() {
this.$emit('closeDialog') this.$emit("closeDialog");
// this.$refs['trialForm'].resetFields() // this.$refs['trialForm'].resetFields()
}, },
handleDeclarationTypeChange(val) { handleDeclarationTypeChange(val) {
console.log(val) console.log(val);
if (val.length === 1) { if (val.length === 1) {
// this.declarationNum = this.dictionaryList.DeclarationType.filter(item => item.Idd === val)[0].ShowOrder // this.declarationNum = this.dictionaryList.DeclarationType.filter(item => item.Idd === val)[0].ShowOrder
this.declarationNum = this.$d.DeclarationType.filter(item => item.value === val[0])[0].raw.ShowOrder this.declarationNum = this.$d.DeclarationType.filter(
(item) => item.value === val[0]
)[0].raw.ShowOrder;
if (this.trialForm.Id) { if (this.trialForm.Id) {
const ids = [...this.trialForm.TrialCode] const ids = [...this.trialForm.TrialCode];
ids[2] = this.declarationNum ids[2] = this.declarationNum;
this.trialForm.TrialCode = ids.join('') this.trialForm.TrialCode = ids.join("");
} }
} else { } else {
this.declarationNum = 'X' this.declarationNum = "X";
if (this.trialForm.Id) { if (this.trialForm.Id) {
const ids = [...this.trialForm.TrialCode] const ids = [...this.trialForm.TrialCode];
ids[2] = this.declarationNum ids[2] = this.declarationNum;
this.trialForm.TrialCode = ids.join('') this.trialForm.TrialCode = ids.join("");
} }
} }
}, },
handleIndicationTypeChange(val) { handleIndicationTypeChange(val) {
this.indicationGrouping = null this.indicationGrouping = null;
if (val) { if (val) {
// this.indicationNum = this.dictionaryList.IndicationType.filter(item => item.Id === val)[0].ShowOrder // this.indicationNum = this.dictionaryList.IndicationType.filter(item => item.Id === val)[0].ShowOrder
this.indicationNum = this.$d.IndicationType.filter(item => item.id === val)[0].raw.ShowOrder this.indicationNum = this.$d.IndicationType.filter(
(item) => item.id === val
)[0].raw.ShowOrder;
if (this.trialForm.Id) { if (this.trialForm.Id) {
const ids = [...this.trialForm.TrialCode] const ids = [...this.trialForm.TrialCode];
ids[3] = this.indicationNum ids[3] = this.indicationNum;
this.trialForm.TrialCode = ids.join('') this.trialForm.TrialCode = ids.join("");
} }
this.indicationGrouping = this.$d.IndicationType.filter(item => item.id === val)[0].raw.ChildGroup this.indicationGrouping = this.$d.IndicationType.filter(
(item) => item.id === val
)[0].raw.ChildGroup;
} }
this.trialForm.Indication = null this.trialForm.Indication = null;
}, },
handlePhaseChange(val) { handlePhaseChange(val) {
if (val) { if (val) {
// const phase = this.dictionaryList['Trial_Phase'] // const phase = this.dictionaryList['Trial_Phase']
// this.phaseNum = phase.filter(item => item.Id === val)[0].ShowOrder // this.phaseNum = phase.filter(item => item.Id === val)[0].ShowOrder
this.phaseNum = this.$d.Trial_Phase.filter(item => item.id === val)[0].raw.ShowOrder this.phaseNum = this.$d.Trial_Phase.filter(
(item) => item.id === val
)[0].raw.ShowOrder;
if (this.trialForm.Id) { if (this.trialForm.Id) {
const ids = [...this.trialForm.TrialCode] const ids = [...this.trialForm.TrialCode];
ids[4] = this.phaseNum ids[4] = this.phaseNum;
this.trialForm.TrialCode = ids.join('') this.trialForm.TrialCode = ids.join("");
} }
} }
}, },
handleExpectedPatientsChange(val) { handleExpectedPatientsChange(val) {
this.trialForm.PlanVisitCount = val * this.trialForm.TimePointsPerPatient this.trialForm.PlanVisitCount = val * this.trialForm.TimePointsPerPatient;
}, },
handleTpPerPatientChange(val) { handleTpPerPatientChange(val) {
this.trialForm.PlanVisitCount = val * this.trialForm.ExpectedPatients this.trialForm.PlanVisitCount = val * this.trialForm.ExpectedPatients;
}, },
async initPage() { async initPage() {
this.loading = true this.loading = true;
await this.getDicData() await this.getDicData();
await store.dispatch('global/getSponsorList') await this.getAllSponsorList();
await store.dispatch('global/getCROList') await this.getAllCROList();
if (this.trialId) { if (this.trialId) {
this.trialForm.Id = this.trialId this.trialForm.Id = this.trialId;
this.initForm() this.initForm();
} }
this.loading = false this.loading = false;
}, },
getDicData() { getDicData() {
getBasicDataSelects(['DeclarationType', 'IndicationType', 'Modality', 'ReviewMode', 'ReviewType', 'Trial_Phase']).then(res => { getBasicDataSelects([
this.dictionaryList = { ...res.Result } "DeclarationType",
}) "IndicationType",
} "Modality",
} "ReviewMode",
} "ReviewType",
"Trial_Phase",
]).then((res) => {
this.dictionaryList = { ...res.Result };
});
},
},
};
</script> </script>
<style> <style>
.trial-Form .el-input, .trial-Form .el-input,
@ -521,7 +777,7 @@ export default {
.trial-Form .el-textarea { .trial-Form .el-textarea {
width: 340px; width: 340px;
} }
.trial-Form .el-col .el-input{ .trial-Form .el-col .el-input {
width: 165px; width: 165px;
margin-right: 10px; margin-right: 10px;
} }