优化中心调研

uat_us
caiyiling 2024-01-15 16:19:45 +08:00
parent e4453bced6
commit 62b85d9d45
4 changed files with 195 additions and 159 deletions

View File

@ -4,7 +4,7 @@ src/utils/*
public
dist
src/*
# src/*
src/views/dictionary/checkConfig/*
src/views/trials/trials-panel/trial-summary/*
src/main.js

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ tests/**/coverage/
*.ntvs*
*.njsproj
*.sln
.eslintignore

View File

@ -3,19 +3,11 @@
<div class="base-dialog-body">
<!-- -->
<el-form-item :label="$t('trials:staffResearch:form:lastName')" prop="LastName">
<el-input
v-model="form.LastName"
disabled
style="width:200px;"
/>
<el-input v-model="form.LastName" disabled style="width: 200px" />
</el-form-item>
<!-- -->
<el-form-item :label="$t('trials:staffResearch:form:firstName')" prop="FirstName">
<el-input
v-model="form.FirstName"
disabled
style="width:200px;"
/>
<el-input v-model="form.FirstName" disabled style="width: 200px" />
</el-form-item>
<!-- 角色 -->
<!-- <el-form-item :label="$t('trials:staffResearch:form:role')" prop="TrialRoleCode">
@ -34,27 +26,15 @@
</el-form-item> -->
<!-- 电话号码 -->
<el-form-item :label="$t('trials:staffResearch:form:phone')" prop="Phone">
<el-input
v-model="form.Phone"
disabled
style="width:200px;"
/>
<el-input v-model="form.Phone" disabled style="width: 200px" />
</el-form-item>
<!-- 邮箱 -->
<el-form-item :label="$t('trials:staffResearch:form:email')" prop="Email">
<el-input
v-model="form.Email"
disabled
style="width:200px;"
/>
<el-input v-model="form.Email" disabled style="width: 200px" />
</el-form-item>
<!-- 单位 -->
<el-form-item :label="$t('trials:staffResearch:form:organization')" prop="OrganizationName">
<el-input
v-model="form.OrganizationName"
disabled
style="width:200px;"
/>
<el-input v-model="form.OrganizationName" disabled style="width: 200px" />
</el-form-item>
<!-- 是否生成账号 -->
<!-- <el-form-item
@ -69,51 +49,35 @@
</el-radio-group>
</el-form-item> -->
<!-- 用户类型 -->
<el-form-item
v-if="form.IsGenerateAccount"
:label="$t('trials:staffResearch:form:userType')"
prop="UserTypeId"
>
<el-select
v-model="form.UserTypeId"
style="width:200px;"
disabled
>
<el-option
v-for="item of userTypeOptions"
:key="item.Id"
:label="item.UserTypeShortName"
:value="item.Id"
>
<el-form-item v-if="form.IsGenerateAccount" :label="$t('trials:staffResearch:form:userType')" prop="UserTypeId">
<el-select v-model="form.UserTypeId" style="width: 200px" disabled>
<el-option v-for="item of userTypeOptions" :key="item.Id" :label="item.UserTypeShortName" :value="item.Id">
<span>{{ item.UserType }}</span>
</el-option>
</el-select>
</el-form-item>
<!-- 更新状态 -->
<el-form-item
:label="$t('trials:staffResearch:form:updateState')"
>
<el-radio-group
v-model="form.IsHistoryUserDeleted"
style="width:200px;"
>
<el-radio v-for="item of $d.IsUserExitTrial" :key="`IsHistoryUserDeleted${item.value}`" :label="item.value">{{ item.label }}</el-radio>
<el-form-item :label="$t('trials:staffResearch:form:updateState')">
<el-radio-group v-model="form.IsHistoryUserDeleted" style="width: 200px">
<el-radio v-for="item of $d.IsUserExitTrial" :key="`IsHistoryUserDeleted${item.value}`" :label="item.value">{{
item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="errorMsg" label="">
<span v-if="errorMsg" style="font-size: 12px;color: #f66;">{{ errorMsg }}</span>
<span v-if="errorMsg" style="font-size: 12px; color: #f66">{{
errorMsg
}}</span>
</el-form-item>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<div class="base-dialog-footer" style="text-align: right; margin-top: 10px">
<el-form-item>
<!-- 取消 -->
<el-button size="small" type="primary" :disabled="btnLoading" @click="handleCancel">
{{ $t('common:button:cancel') }}
{{ $t("common:button:cancel") }}
</el-button>
<!-- 保存 -->
<el-button size="small" type="primary" :loading="btnLoading" @click="handleSave">
{{ $t('common:button:save') }}
{{ $t("common:button:save") }}
</el-button>
</el-form-item>
</div>
@ -142,7 +106,8 @@ export default {
if (value === '') {
callback(new Error(this.$t('trials:researchForm:formRule:specify')))
} else {
var reg = /^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/
var reg =
/^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/
if (this.form.Email && reg.test(this.form.Email)) {
this.sendDisabled = false
callback()
@ -164,29 +129,64 @@ export default {
OrganizationName: '',
IsGenerateAccount: false,
IsHistoryUserDeleted: ''
},
rules: {
LastName: [
{ required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' },
{ min: 0, max: 50, message: this.$t('trials:researchForm:formRule:maxLength'), trigger: 'blur' }
{
required: true,
message: this.$t('trials:researchForm:formRule:specify'),
trigger: 'blur'
},
{
min: 0,
max: 50,
message: this.$t('trials:researchForm:formRule:maxLength'),
trigger: 'blur'
}
],
FirstName: [
{ required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' },
{ min: 0, max: 50, message: this.$t('trials:researchForm:formRule:maxLength'), trigger: 'blur' }
{
required: true,
message: this.$t('trials:researchForm:formRule:specify'),
trigger: 'blur'
},
{
min: 0,
max: 50,
message: this.$t('trials:researchForm:formRule:maxLength'),
trigger: 'blur'
}
],
TrialRoleCode: [
{ required: true, message: this.$t('trials:researchForm:formRule:select'), trigger: ['blur', 'change'] }
{
required: true,
message: this.$t('trials:researchForm:formRule:select'),
trigger: ['blur', 'change']
}
],
UserTypeId: [
{
required: true,
message: this.$t('trials:researchForm:formRule:select'),
trigger: ['blur']
}
],
UserTypeId: [{ required: true, message: this.$t('trials:researchForm:formRule:select'), trigger: ['blur'] }],
Phone: [
{ max: 50, message: this.$t('common:ruleMessage:maxLength') + ' 50', trigger: 'blur' }
{
max: 50,
message: this.$t('common:ruleMessage:maxLength') + ' 50',
trigger: 'blur'
}
],
Email: [
{ required: true, validator: validateEmail, trigger: ['blur'] }
],
IsHistoryUserDeleted: [
{ required: true, message: this.$t('trials:researchForm:formRule:select'), trigger: ['blur', 'change'] }
{
required: true,
message: this.$t('trials:researchForm:formRule:select'),
trigger: ['blur', 'change']
}
]
},
btnLoading: false,
@ -202,7 +202,7 @@ export default {
methods: {
async initForm() {
await this.getUserType()
Object.keys(this.data).forEach(key => {
Object.keys(this.data).forEach((key) => {
this.form[key] = this.data[key]
})
if (zzSessionStorage.getItem('userTypeEnumInt')) {
@ -211,37 +211,44 @@ export default {
},
//
handleSave() {
this.$refs['participantForm'].validate(valid => {
this.$refs['participantForm'].validate((valid) => {
if (!valid) return
this.btnLoading = true
if (!this.form.TrialSiteSurveyId) {
this.form.TrialSiteSurveyId = getQueryString('trialSiteSurveyId')
}
const trialId = getQueryString('trialId')
addOrUpdateTrialSiteUserSurvey(trialId, this.form).then(res => {
this.btnLoading = false
if (res.IsSuccess) {
//
this.$message.success(this.$t('common:message:savedSuccessfully'))
addOrUpdateTrialSiteUserSurvey(trialId, this.form)
.then((res) => {
this.btnLoading = false
if (res.IsSuccess) {
//
this.$message.success(
this.$t('common:message:savedSuccessfully')
)
this.$emit('close', { id: res.Result, errorMessage: '' })
}
}).catch((res) => {
if (res.Result && res.Result.Id && res.ErrorMessage) {
this.$emit('close', { id: res.Result.Id, errorMessage: res.ErrorMessage })
// this.$confirm(res.ErrorMessage, '', {
// type: 'warning'
// }).then(() => {
// this.$set(this.form, 'LastName', res.Result.LastName)
// this.$set(this.form, 'FirstName', res.Result.FirstName)
// this.$set(this.form, 'Phone', res.Result.Phone)
// this.handleSave()
// }).catch(() => {
this.$emit('close', { id: res.Result, errorMessage: '' })
}
})
.catch((res) => {
if (res.Result && res.Result.Id && res.ErrorMessage) {
this.$emit('close', {
id: res.Result.Id,
errorMessage: res.ErrorMessage
})
// this.$confirm(res.ErrorMessage, '', {
// type: 'warning'
// }).then(() => {
// this.$set(this.form, 'LastName', res.Result.LastName)
// this.$set(this.form, 'FirstName', res.Result.FirstName)
// this.$set(this.form, 'Phone', res.Result.Phone)
// this.handleSave()
// }).catch(() => {
// })
}
this.btnLoading = false
})
// })
}
this.btnLoading = false
})
})
},
//
@ -250,12 +257,16 @@ export default {
},
//
getUserType() {
return new Promise(resolve => {
getUserTypeList(3).then(res => {
return new Promise((resolve) => {
getUserTypeList(3).then((res) => {
this.userTypeOptions = res.Result
var crcObj = res.Result.find((i) => i.UserTypeEnum === 2)
this.crcId = crcObj ? crcObj.Id : ''
var craObj = res.Result.find((i) => i.UserTypeEnum === 9)
this.craId = craObj ? craObj.Id : ''
})
resolve()
}).catch(() => { resolve() })
})
}
}
}

View File

@ -1,27 +1,19 @@
<template>
<el-form ref="participantForm" :model="form" :rules="rules" label-width="200px" :inline="true" v-loading="loading">
<el-form ref="participantForm" v-loading="loading" :model="form" :rules="rules" label-width="200px" :inline="true">
<div class="base-dialog-body">
<!-- -->
<el-form-item :label="$t('trials:staffResearch:form:lastName')" prop="LastName">
<el-input
v-model="form.LastName"
:disabled="!(state === 0 && userTypeEnumInt === 0)"
style="width:200px;"
/>
<el-input v-model="form.LastName" :disabled="!(state === 0 && userTypeEnumInt === 0)" style="width: 200px" />
</el-form-item>
<!-- -->
<el-form-item :label="$t('trials:staffResearch:form:firstName')" prop="FirstName">
<el-input
v-model="form.FirstName"
:disabled="!(state === 0 && userTypeEnumInt === 0)"
style="width:200px;"
/>
<el-input v-model="form.FirstName" :disabled="!(state === 0 && userTypeEnumInt === 0)" style="width: 200px" />
</el-form-item>
<!-- 角色 -->
<el-form-item :label="$t('trials:staffResearch:form:role')" prop="TrialRoleCode">
<el-select
v-model="form.TrialRoleCode"
style="width:200px;"
style="width: 200px"
:disabled="!(state === 0 && userTypeEnumInt === 0)"
@change="handleTrialRoleChange"
>
@ -35,26 +27,18 @@
</el-form-item>
<!-- 电话号码 -->
<el-form-item :label="$t('trials:staffResearch:form:phone')" prop="Phone">
<el-input
v-model="form.Phone"
:disabled="!(state === 0 && userTypeEnumInt === 0)"
style="width:200px;"
/>
<el-input v-model="form.Phone" :disabled="!(state === 0 && userTypeEnumInt === 0)" style="width: 200px" />
</el-form-item>
<!-- 邮箱 -->
<el-form-item :label="$t('trials:staffResearch:form:email')" prop="Email">
<el-input
v-model="form.Email"
:disabled="!(state === 0 && userTypeEnumInt === 0)"
style="width:200px;"
/>
<el-input v-model="form.Email" :disabled="!(state === 0 && userTypeEnumInt === 0)" style="width: 200px" />
</el-form-item>
<!-- 单位 -->
<el-form-item :label="$t('trials:staffResearch:form:organization')" prop="OrganizationName">
<el-input
v-model="form.OrganizationName"
:disabled="!(state === 0 && userTypeEnumInt === 0)"
style="width:200px;"
style="width: 200px"
/>
</el-form-item>
<!-- <el-row>
@ -93,19 +77,20 @@
</el-form-item>
</el-row>-->
<el-form-item v-if="errorMsg" label="">
<span v-if="errorMsg" style="font-size: 12px;color: #f66;">{{ errorMsg }}</span>
<span v-if="errorMsg" style="font-size: 12px; color: #f66">{{
errorMsg
}}</span>
</el-form-item>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<div class="base-dialog-footer" style="text-align: right; margin-top: 10px">
<el-form-item>
<!-- 取消 -->
<el-button size="small" type="primary" :disabled="btnLoading" @click="handleCancel">
{{ $t('common:button:cancel') }}
{{ $t("common:button:cancel") }}
</el-button>
<!-- 保存 -->
<el-button size="small" type="primary" :loading="btnLoading" @click="handleSave">
{{ $t('common:button:save') }}
{{ $t("common:button:save") }}
</el-button>
</el-form-item>
</div>
@ -152,7 +137,8 @@ export default {
if (value === '') {
callback(new Error(this.$t('trials:researchForm:formRule:specify')))
} else {
var reg = /^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/
var reg =
/^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/
if (this.form.Email && reg.test(this.form.Email)) {
this.sendDisabled = false
callback()
@ -175,23 +161,54 @@ export default {
// IsCorrect: false,
IsGenerateAccount: false,
IsDisable: false
},
rules: {
LastName: [
{ required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' },
{ min: 0, max: 50, message: this.$t('trials:researchForm:formRule:maxLength'), trigger: 'blur' }
{
required: true,
message: this.$t('trials:researchForm:formRule:specify'),
trigger: 'blur'
},
{
min: 0,
max: 50,
message: this.$t('trials:researchForm:formRule:maxLength'),
trigger: 'blur'
}
],
FirstName: [
{ required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' },
{ min: 0, max: 50, message: this.$t('trials:researchForm:formRule:maxLength'), trigger: 'blur' }
{
required: true,
message: this.$t('trials:researchForm:formRule:specify'),
trigger: 'blur'
},
{
min: 0,
max: 50,
message: this.$t('trials:researchForm:formRule:maxLength'),
trigger: 'blur'
}
],
TrialRoleCode: [
{ required: true, message: this.$t('trials:researchForm:formRule:select'), trigger: ['blur', 'change'] }
{
required: true,
message: this.$t('trials:researchForm:formRule:select'),
trigger: ['blur', 'change']
}
],
UserTypeId: [
{
required: true,
message: this.$t('trials:researchForm:formRule:select'),
trigger: ['blur']
}
],
UserTypeId: [{ required: true, message: this.$t('trials:researchForm:formRule:select'), trigger: ['blur'] }],
Phone: [
{ max: 50, message: this.$t('common:ruleMessage:maxLength') + ' 50', trigger: 'blur' }
{
max: 50,
message: this.$t('common:ruleMessage:maxLength') + ' 50',
trigger: 'blur'
}
],
Email: [
{ required: true, validator: validateEmail, trigger: ['blur'] }
@ -204,7 +221,7 @@ export default {
errorMsg: '',
crcId: '',
craId: '',
loading:false
loading: false
}
},
mounted() {
@ -214,7 +231,7 @@ export default {
async initForm() {
this.loading = true
await this.getUserType()
Object.keys(this.data).forEach(key => {
Object.keys(this.data).forEach((key) => {
this.form[key] = this.data[key]
})
if (zzSessionStorage.getItem('userTypeEnumInt')) {
@ -224,37 +241,44 @@ export default {
},
//
handleSave() {
this.$refs['participantForm'].validate(valid => {
this.$refs['participantForm'].validate((valid) => {
if (!valid) return
this.btnLoading = true
if (!this.form.TrialSiteSurveyId) {
this.form.TrialSiteSurveyId = getQueryString('trialSiteSurveyId')
}
const trialId = getQueryString('trialId')
addOrUpdateTrialSiteUserSurvey(trialId, this.form).then(res => {
this.btnLoading = false
if (res.IsSuccess) {
//
this.$message.success(this.$t('common:message:savedSuccessfully'))
addOrUpdateTrialSiteUserSurvey(trialId, this.form)
.then((res) => {
this.btnLoading = false
if (res.IsSuccess) {
//
this.$message.success(
this.$t('common:message:savedSuccessfully')
)
this.$emit('close', { id: res.Result, errorMessage: '' })
}
}).catch((res) => {
if (res.Result && res.Result.Id && res.ErrorMessage) {
this.$emit('close', { id: res.Result.Id, errorMessage: res.ErrorMessage })
// this.$confirm(res.ErrorMessage, '', {
// type: 'warning'
// }).then(() => {
// this.$set(this.form, 'LastName', res.Result.LastName)
// this.$set(this.form, 'FirstName', res.Result.FirstName)
// this.$set(this.form, 'Phone', res.Result.Phone)
// this.handleSave()
// }).catch(() => {
this.$emit('close', { id: res.Result, errorMessage: '' })
}
})
.catch((res) => {
if (res.Result && res.Result.Id && res.ErrorMessage) {
this.$emit('close', {
id: res.Result.Id,
errorMessage: res.ErrorMessage
})
// this.$confirm(res.ErrorMessage, '', {
// type: 'warning'
// }).then(() => {
// this.$set(this.form, 'LastName', res.Result.LastName)
// this.$set(this.form, 'FirstName', res.Result.FirstName)
// this.$set(this.form, 'Phone', res.Result.Phone)
// this.handleSave()
// }).catch(() => {
// })
}
this.btnLoading = false
})
// })
}
this.btnLoading = false
})
})
},
handleTrialRoleChange(v) {
@ -278,16 +302,16 @@ export default {
},
//
getUserType() {
return new Promise(resolve => {
getUserTypeList(3).then(res => {
return new Promise((resolve) => {
getUserTypeList(3).then((res) => {
this.userTypeOptions = res.Result
var crcObj = res.Result.find(i => i.UserTypeEnum === 2)
var crcObj = res.Result.find((i) => i.UserTypeEnum === 2)
this.crcId = crcObj ? crcObj.Id : ''
var craObj = res.Result.find(i => i.UserTypeEnum === 9)
var craObj = res.Result.find((i) => i.UserTypeEnum === 9)
this.craId = craObj ? craObj.Id : ''
})
resolve()
}).catch(() => { resolve() })
})
},
handleIsCorrectChange(val) {
if (!val) {