irc_web/src/views/reviewers/new.vue

180 lines
5.1 KiB
Vue

<template>
<div class="app-container">
<el-tabs v-model="active" :before-leave="checkLeave" @tab-click="clickTab">
<el-tab-pane
:label="$t('system:reviewer:tab:BasicInfo')"
name="BasicInfo"
>
<basic-info
v-if="load.BasicInfo"
:reviewerId.sync="reviewerId"
:isSystem="isSystem"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('system:reviewer:tab:Employment')"
name="Employment"
>
<Employment v-if="load.Employment" :reviewerId.sync="reviewerId" />
</el-tab-pane>
<el-tab-pane
:label="$t('system:reviewer:tab:Specialty')"
name="Specialty"
>
<specialty v-if="load.Specialty" :reviewerId.sync="reviewerId" />
</el-tab-pane>
<el-tab-pane
:label="$t('system:reviewer:tab:Education&Training')"
name="EducationTraining"
>
<education-training
v-if="load.EducationTraining"
:reviewerId.sync="reviewerId"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('system:reviewer:tab:Research&Publication')"
name="ResearchPublication"
>
<research-publication
v-if="load.ResearchPublication"
:reviewerId.sync="reviewerId"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('system:reviewer:tab:TrialExperience')"
name="TrialExperience"
>
<trial-experience
v-if="load.TrialExperience"
:reviewerId.sync="reviewerId"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('system:reviewer:tab:Credentials')"
name="Credentials"
>
<Credentials v-if="load.Credentials" :reviewerId.sync="reviewerId" />
</el-tab-pane>
<el-tab-pane :label="$t('system:reviewer:tab:Resumes')" name="Resumes">
<Resumes v-if="load.Resumes" :reviewerId.sync="reviewerId" />
</el-tab-pane>
<el-tab-pane
:label="$t('system:reviewer:tab:Agreements')"
name="Agreements"
>
<Agreements v-if="load.Agreements" :reviewerId.sync="reviewerId" />
</el-tab-pane>
<el-tab-pane :label="$t('system:reviewer:tab:Setting')" name="Setting">
<Setting v-if="load.Setting" :reviewerId.sync="reviewerId" />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import BasicInfo from './components/BasicInfo'
import Employment from './components/Employment'
import Specialty from './components/Specialty'
import EducationTraining from './components/EducationTraining'
import ResearchPublication from './components/ResearchPublication'
import TrialExperience from './components/TrialExperience'
import Credentials from './components/Credentials'
import Resumes from './components/Resumes'
import Agreements from './components/Agreements'
import Setting from './components/Setting'
import { changeURLStatic, getQueryString } from '@/utils/history.js'
export default {
components: {
BasicInfo,
Employment,
Specialty,
EducationTraining,
ResearchPublication,
TrialExperience,
Credentials,
Resumes,
Agreements,
Setting,
},
props: {
isSystem: {
type: Boolean,
default: true,
},
},
data() {
return {
active: 'BasicInfo',
load: {
BasicInfo: true,
Employment: false,
Specialty: false,
EducationTraining: false,
ResearchPublication: false,
TrialExperience: false,
Credentials: false,
Resumes: false,
Agreements: false,
Setting: false,
},
reviewerId: null,
}
},
mounted() {
if (this.isSystem) {
this.active = this.$route.query.tabActive
if (this.$route.query.Id === '' && this.active !== 'BasicInfo') {
this.$router.push({ path: '/reviewers/reviewers-list' })
}
this.load[this.active] = true
}
},
methods: {
clickTab(tab, event) {
if (this.load[tab.name] === false) {
this.load[tab.name] = true
}
if (!this.isSystem) return false
changeURLStatic('tabActive', tab.name)
const id = getQueryString('Id')
const isEnglish = getQueryString('isEnglish')
this.$router.push({
path: `/reviewers/reviewers-add?Id=${id}&isEnglish=${isEnglish}&tabActive=${tab.name}`,
})
},
checkLeave() {
const id = getQueryString('Id')
if (!id) {
this.$message({
message: 'Please fill in the basic information first',
type: 'warning',
})
return false
} else {
return true
}
},
getQueryString(name) {
console.log(window.location.href)
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
var r = window.location.search.substr(1).match(reg)
if (r != null) {
return unescape(r[2])
} else {
return null
}
},
},
}
</script>
<style lang="scss" scoped>
.el-tabs {
height: 100%;
.el-tabs__content {
height: calc(100%-50px);
overflow-y: auto;
}
}
</style>