Compare commits

..

No commits in common. "eec16c1a2cb0d9c21bad40eb303db882a69cd791" and "a2facabb7b09f2c1211c71abb8850ff5d5760ca2" have entirely different histories.

2 changed files with 192 additions and 450 deletions

View File

@ -353,14 +353,12 @@ 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,58 +12,29 @@
> >
<el-row> <el-row>
<!-- 项目编号 --> <!-- 项目编号 -->
<el-form-item <el-form-item v-if="trialForm.Id!== ''" :label="$t('trials:trials-list:form:trialId')" prop="TrialCode">
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 <el-form-item :label="$t('trials:trials-list:form:trialType')" prop="TrialType">
:label="$t('trials:trials-list:form:trialType')" <el-radio-group v-model="trialForm.TrialType " :disabled="trialForm.Id!== ''">
prop="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>
>
<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 <el-form-item :label="$t('trials:trials-list:form:experimentName')" prop="ExperimentName">
:label="$t('trials:trials-list:form:experimentName')" <el-input v-model="trialForm.ExperimentName" type="textarea" :autosize="{ minRows: 1, maxRows: 4}" />
prop="ExperimentName"
>
<el-input
v-model="trialForm.ExperimentName"
type="textarea"
:autosize="{ minRows: 1, maxRows: 4 }"
/>
</el-form-item> </el-form-item>
<!-- 研究方案号 --> <!-- 研究方案号 -->
<el-form-item <el-form-item :label="$t('trials:trials-list:form:researchNumber')" prop="ResearchProgramNo">
: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 <el-form-item :label="$t('trials:trials-list:form:researchUnit')" prop="MainResearchUnit">
: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 -->
@ -74,18 +45,9 @@
<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 <el-select v-model="trialForm.SponsorId">
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"
@ -94,18 +56,9 @@
</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 <el-select v-model="trialForm.CROId">
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"
@ -115,10 +68,7 @@
</el-row> </el-row>
<el-row> <el-row>
<!-- DeclarationType --> <!-- DeclarationType -->
<el-form-item <el-form-item :label="$t('trials:trials-list:form:declarationType')" prop="DeclarationTypeEnumList">
: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"
@ -127,12 +77,7 @@
@change="handleDeclarationTypeChange" @change="handleDeclarationTypeChange"
style="width: 100%" style="width: 100%"
> >
<el-option <el-option v-for="item of $d.DeclarationType" :key="item.value" :value="item.value" :label="item.label" />
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 -->
@ -155,14 +100,8 @@
</el-row> </el-row>
<el-row> <el-row>
<!-- 适应症类型 IndicationType --> <!-- 适应症类型 IndicationType -->
<el-form-item <el-form-item :label="$t('trials:trials-list:form:indicationType')" prop="IndicationTypeId">
:label="$t('trials:trials-list:form:indicationType')" <el-select v-model="trialForm.IndicationTypeId" @change="handleIndicationTypeChange">
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"
@ -178,16 +117,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- Indication --> <!-- Indication -->
<el-form-item <el-form-item :label="$t('trials:trials-list:form:indication')" prop="IndicationEnum">
:label="$t('trials:trials-list:form:indication')"
prop="IndicationEnum"
>
<!-- <el-input v-model="trialForm.Indication" />--> <!-- <el-input v-model="trialForm.Indication" />-->
<el-select <el-select :disabled="!trialForm.IndicationTypeId" v-if="![37, 38, 39].includes(trialForm.IndicationEnum)" v-model="trialForm.IndicationEnum">
: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"
@ -198,11 +130,7 @@
</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 <el-select :disabled="!trialForm.IndicationTypeId" v-model="trialForm.IndicationEnum" style="width: 100%;margin-right: 10px;">
: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"
@ -213,10 +141,7 @@
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-input <el-input :disabled="!trialForm.IndicationTypeId" v-model="trialForm.Indication" />
:disabled="!trialForm.IndicationTypeId"
v-model="trialForm.Indication"
/>
</el-col> </el-col>
</el-row> </el-row>
</el-form-item> </el-form-item>
@ -241,12 +166,9 @@
</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 <el-input-number v-model="trialForm.PlanSiteCount" controls-position="right" :min="0" />
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 -->
@ -271,19 +193,14 @@
<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 <el-input-number v-model="trialForm.PlanVisitCount" controls-position="right" :min="0" />
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 <el-form-item :label="$t('trials:trials-list:form:expedited')" prop="Expedited">
: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"
@ -294,21 +211,15 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- Turnaround Time --> <!-- Turnaround Time -->
<el-form-item <el-form-item :label="$t('trials:trials-list:form:projectCycle')" prop="ProjectCycle">
: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 <el-input-number v-model="trialForm.TotalReviewers" controls-position="right" :min="0" />
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')">
@ -318,96 +229,106 @@
multiple multiple
clearable clearable
> >
<el-option <el-option v-for="item of $d.AttendedReviewerType" :key="item.value" :value="item.value" :label="item.label" />
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 { mapState } from "vuex"; import { mapGetters, 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,
@ -415,113 +336,48 @@ 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' },
required: true, { max: 10, message: `${this.$t('common:ruleMessage:maxLength')} 10` }
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' },
required: true, { max: 100, message: `${this.$t('common:ruleMessage:maxLength')} 100` }
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' },
required: true, { max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500` }
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' },
required: true, { validator: comfirmIndication, trigger: 'blur' }
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,
@ -530,244 +386,132 @@ export default {
declarationNum: null, declarationNum: null,
indicationNum: null, indicationNum: null,
phaseNum: null, phaseNum: null,
dictionaryList: {}, dictionaryList: {}
}
sponsorList: [],
croList: [],
};
}, },
computed: { computed: {
...mapState("user", ["isTestUser"]), ...mapGetters(['sponsorList', 'croList']),
...mapState('user', ['isTestUser'])
}, },
mounted() { mounted() {
this.initPage(); this.initPage()
console.log(this.isTestUser, "isTestUser"); console.log(this.isTestUser, 'isTestUser')
}, },
methods: { methods: {
// CRO
handleSelectVisibbleChange(flag, key) {
if (flag) {
if (key === "sponsor") {
this.getAllSponsorList();
}
if (key === "cro") {
this.getAllCROList();
}
}
},
// 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;
}
}
}
},
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() { initForm() {
this.loading = true; this.loading = true
getTrialInfo(this.trialId) getTrialInfo(this.trialId).then(res => {
.then((res) => { this.loading = false
this.loading = false; if (res.IsSuccess) {
if (res.IsSuccess) { for (var item in this.trialForm) {
for (var item in this.trialForm) { res.Result[item] === '00000000-0000-0000-0000-000000000000' ? '' : this.$set(this.trialForm, item, res.Result[item])
res.Result[item] === "00000000-0000-0000-0000-000000000000" if (item === 'IndicationTypeId') {
? "" this.indicationGrouping = this.$d.IndicationType.filter(v => v.id === res.Result[item])[0].raw.ChildGroup
: 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(() => { }).catch(() => { this.loading = false })
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) addOrUpdateTrial(params).then(res => {
.then((res) => { this.btnLoading = false
this.btnLoading = false; if (!this.trialForm.Id) {
if (!this.trialForm.Id) { this.trialForm.Id = res.Result
this.trialForm.Id = res.Result; this.$message.success(this.$t('trials:trials-list:message:addedSuccessfully'))
this.$message.success( } else {
this.$t("trials:trials-list:message:addedSuccessfully") this.$message.success(this.$t('trials:trials-list:message:updatedSuccessfully'))
); }
} else {
this.$message.success(
this.$t("trials:trials-list:message:updatedSuccessfully")
);
}
this.$emit("getList"); this.$emit('getList')
this.$emit("closeDialog"); this.$emit('closeDialog')
}) }).catch(() => {
.catch(() => { this.btnLoading = false
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( this.declarationNum = this.$d.DeclarationType.filter(item => item.value === val[0])[0].raw.ShowOrder
(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( this.indicationNum = this.$d.IndicationType.filter(item => item.id === val)[0].raw.ShowOrder
(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( this.indicationGrouping = this.$d.IndicationType.filter(item => item.id === val)[0].raw.ChildGroup
(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( this.phaseNum = this.$d.Trial_Phase.filter(item => item.id === val)[0].raw.ShowOrder
(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 this.getAllSponsorList(); await store.dispatch('global/getSponsorList')
await this.getAllCROList(); await store.dispatch('global/getCROList')
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([ getBasicDataSelects(['DeclarationType', 'IndicationType', 'Modality', 'ReviewMode', 'ReviewType', 'Trial_Phase']).then(res => {
"DeclarationType", this.dictionaryList = { ...res.Result }
"IndicationType", })
"Modality", }
"ReviewMode", }
"ReviewType", }
"Trial_Phase",
]).then((res) => {
this.dictionaryList = { ...res.Result };
});
},
},
};
</script> </script>
<style> <style>
.trial-Form .el-input, .trial-Form .el-input,
@ -777,7 +521,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;
} }