外部人员发送邮件接口添加UserTypeId参数

uat_us
wangxiaoshuang 2024-12-27 11:48:49 +08:00
parent 2f4ace45b8
commit f739563fe9
2 changed files with 230 additions and 105 deletions

View File

@ -336,4 +336,9 @@ export default {
},
},
}
</script>
</script>
<style lang="scss" scoped>
.el-radio-group {
margin-top: 12px;
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<el-container class="participant-container">
<el-header style="height:50px">
<el-header style="height: 50px">
<div class="filter-container">
<!-- 姓名 -->
<span>{{ $t('trials:externalStaff:table:name') }}:</span>
@ -12,23 +12,54 @@
<span>{{ $t('trials:externalStaff:table:phone') }}:</span>
<el-input v-model="listQuery.Phone" size="mini" class="mr" clearable />
<!-- 查询 -->
<el-button type="primary" size="mini" icon="el-icon-search" @click="handleSearch">
<el-button
type="primary"
size="mini"
icon="el-icon-search"
@click="handleSearch"
>
{{ $t('common:button:search') }}
</el-button>
<!-- 重置 -->
<el-button size="mini" type="primary" icon="el-icon-refresh-left" @click="handleReset">
<el-button
size="mini"
type="primary"
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t('common:button:reset') }}
</el-button>
<!-- 权限配置 -->
<el-button type="primary" size="mini" style="margin-left:auto" :loading="assignLoadStatus" @click="openPermission">
<el-button
type="primary"
size="mini"
style="margin-left: auto"
:loading="assignLoadStatus"
@click="openPermission"
>
{{ $t('trials:staff:button:permissionConfiguration') }}
</el-button>
<!-- 发送邮件 -->
<el-button type="primary" size="mini" style="margin-left:10px" :disabled="selectArr.length === 0" :loading="assignLoadStatus" icon="el-icon-message" @click="sendEmail">
<el-button
type="primary"
size="mini"
style="margin-left: 10px"
:disabled="selectArr.length === 0"
:loading="assignLoadStatus"
icon="el-icon-message"
@click="sendEmail"
>
{{ $t('trials:staff:button:sendEmail') }}
</el-button>
<!-- 添加 -->
<el-button type="primary" icon="el-icon-plus" size="mini" style="margin-left:10px" :loading="assignLoadStatus" @click="handleAdd">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
style="margin-left: 10px"
:loading="assignLoadStatus"
@click="handleAdd"
>
{{ $t('trials:staff:button:addExternalStaff') }}
</el-button>
</div>
@ -57,7 +88,9 @@
sortable="custom"
min-width="100"
>
<template slot-scope="scope">{{ scope.row.LastName + ' / ' + scope.row.FirstName }}</template>
<template slot-scope="scope">{{
scope.row.LastName + ' / ' + scope.row.FirstName
}}</template>
</el-table-column>
<el-table-column
prop="UserType"
@ -67,7 +100,13 @@
min-width="120"
>
<template slot-scope="scope">
{{ userTypeOptions.length > 0 ? userTypeOptions.find((v) => { return v.Id == scope.row.UserTypeId }).UserTypeShortName : '' }}
{{
userTypeOptions.length > 0
? userTypeOptions.find((v) => {
return v.Id == scope.row.UserTypeId
}).UserTypeShortName
: ''
}}
</template>
</el-table-column>
<el-table-column
@ -100,9 +139,15 @@
sortable="custom"
min-width="120"
>
<template slot-scope="scope">{{ $fd('IsJoin', scope.row.IsJoin) }}</template>
<template slot-scope="scope">{{
$fd('IsJoin', scope.row.IsJoin)
}}</template>
</el-table-column>
<el-table-column :label="$t('common:action:action')" fixed="right" min-width="150">
<el-table-column
:label="$t('common:action:action')"
fixed="right"
min-width="150"
>
<template slot-scope="scope">
<el-button
circle
@ -116,23 +161,57 @@
</el-table>
</div>
</el-main>
<StaffExternalAdd ref="StaffExternalAdd" :user-type-options="userTypeOptions" @getList="refeshList" />
<StaffExternalAdd
ref="StaffExternalAdd"
:user-type-options="userTypeOptions"
@getList="refeshList"
/>
<base-model v-if="model_config.visible" :config="model_config">
<template slot="dialog-body">
<el-form :model="permission" :rules="permissionRole" ref="permissionForm" label-width="140px" class="demo-ruleForm">
<el-form-item :label="$t('trials:externalStaff:form:IsSPMJoinReReadingApproval')" prop="IsSPMJoinReReadingApproval">
<el-form
:model="permission"
:rules="permissionRole"
ref="permissionForm"
label-width="140px"
class="demo-ruleForm"
>
<el-form-item
:label="$t('trials:externalStaff:form:IsSPMJoinReReadingApproval')"
prop="IsSPMJoinReReadingApproval"
>
<el-radio-group v-model="permission.IsSPMJoinReReadingApproval">
<el-radio v-for="item in $d.YesOrNo" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
<el-radio
v-for="item in $d.YesOrNo"
:key="item.id"
:label="item.value"
>{{ item.label }}</el-radio
>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('trials:externalStaff:form:IsSPMJoinReviewerSelect')" prop="IsSPMJoinReviewerSelect">
<el-form-item
:label="$t('trials:externalStaff:form:IsSPMJoinReviewerSelect')"
prop="IsSPMJoinReviewerSelect"
>
<el-radio-group v-model="permission.IsSPMJoinReviewerSelect">
<el-radio v-for="item in $d.YesOrNo" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
<el-radio
v-for="item in $d.YesOrNo"
:key="item.id"
:label="item.value"
>{{ item.label }}</el-radio
>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('trials:externalStaff:form:IsSPMJoinSiteSurvey')" prop="IsSPMJoinSiteSurvey">
<el-form-item
:label="$t('trials:externalStaff:form:IsSPMJoinSiteSurvey')"
prop="IsSPMJoinSiteSurvey"
>
<el-radio-group v-model="permission.IsSPMJoinSiteSurvey">
<el-radio v-for="item in $d.YesOrNo" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
<el-radio
v-for="item in $d.YesOrNo"
:key="item.id"
:label="item.value"
>{{ item.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-form>
@ -159,7 +238,14 @@
</el-container>
</template>
<script>
import { getTrialExternalUserList, addTrialUsers, getUserTypeList, sendExternalUserJoinEmail, getTrialConfigInfo, configTrialSPMInfo } from '@/api/trials'
import {
getTrialExternalUserList,
addTrialUsers,
getUserTypeList,
sendExternalUserJoinEmail,
getTrialConfigInfo,
configTrialSPMInfo,
} from '@/api/trials'
import { deleteTrialExternalUser } from '@/api/trials/setting.js'
import StaffExternalAdd from './staffExternalAdd'
import BaseModel from '@/components/BaseModel'
@ -167,11 +253,11 @@ const getListQueryDefault = () => {
return {
Phone: '',
Email: '',
Name: ''
Name: '',
}
}
export default {
components: { StaffExternalAdd,BaseModel },
components: { StaffExternalAdd, BaseModel },
data() {
return {
list: [],
@ -181,17 +267,26 @@ export default {
assignLoadStatus: false,
// isAdmin: JSON.parse(zzSessionStorage.getItem('IsAdmin')),
userTypeOptions: [],
stateList: ['WaitSent', 'HasSend', 'UserConfirmed', 'UserReject', 'OverTime'],
stateList: [
'WaitSent',
'HasSend',
'UserConfirmed',
'UserReject',
'OverTime',
],
trialId: '',
model_config:{
visible: false, title: this.$t('trials:staff:dialogTitle:permissionConfiguration'), width: '500px', appendToBody: true
model_config: {
visible: false,
title: this.$t('trials:staff:dialogTitle:permissionConfiguration'),
width: '500px',
appendToBody: true,
},
permission:{
permission: {
IsSPMJoinReReadingApproval: false,
IsSPMJoinReviewerSelect: false,
IsSPMJoinSiteSurvey: false,
},
permissionRole:{}
permissionRole: {},
}
},
mounted() {
@ -201,42 +296,42 @@ export default {
},
methods: {
//
async getPermission(){
try{
let res = await getTrialConfigInfo(this.trialId);
if(res.IsSuccess){
Object.keys(this.permission).forEach(key=>{
async getPermission() {
try {
let res = await getTrialConfigInfo(this.trialId)
if (res.IsSuccess) {
Object.keys(this.permission).forEach((key) => {
this.permission[key] = res.Result[key]
})
}
}catch(err){
} catch (err) {
console.log(err)
}
},
//
async openPermission(){
try{
await this.getPermission();
this.model_config.visible = true;
}catch(err){
console.log(err);
async openPermission() {
try {
await this.getPermission()
this.model_config.visible = true
} catch (err) {
console.log(err)
}
},
//
async savePermission(){
try{
let validate =await this.$refs.permissionForm.validate();
if(!validate) return false;
this.assignLoadStatus = true;
let data = Object.assign({ Id: this.trialId },this.permission)
let res = await configTrialSPMInfo(data);
this.assignLoadStatus = false;
if(res.IsSuccess){
this.model_config.visible = false;
this.$message.success(this.$t("common:message:updatedSuccessfully"))
async savePermission() {
try {
let validate = await this.$refs.permissionForm.validate()
if (!validate) return false
this.assignLoadStatus = true
let data = Object.assign({ Id: this.trialId }, this.permission)
let res = await configTrialSPMInfo(data)
this.assignLoadStatus = false
if (res.IsSuccess) {
this.model_config.visible = false
this.$message.success(this.$t('common:message:updatedSuccessfully'))
}
}catch(err){
this.assignLoadStatus = false;
} catch (err) {
this.assignLoadStatus = false
console.log(err)
}
},
@ -249,83 +344,108 @@ export default {
},
handleEdit(row) {
this.$nextTick(() => {
this.$refs['StaffExternalAdd'].openDialog(this.$t('trials:externalStaff:dialogTitle:edit'), row)
this.$refs['StaffExternalAdd'].openDialog(
this.$t('trials:externalStaff:dialogTitle:edit'),
row
)
})
},
handleAdd() {
this.$nextTick(() => {
this.$refs['StaffExternalAdd'].openDialog(this.$t('trials:externalStaff:dialogTitle:add'), {})
this.$refs['StaffExternalAdd'].openDialog(
this.$t('trials:externalStaff:dialogTitle:add'),
{}
)
})
},
deleteTrialExternalUser(row) {
this.$confirm(this.$t('trials:externalStaff:message:delete'), {
type: 'warning',
distinguishCancelAndClose: true
distinguishCancelAndClose: true,
}).then(() => {
this.loading = true
deleteTrialExternalUser(row.Id, row.IsSystemUser, row.SystemUserId)
.then((res) => {
this.$message.success(this.$t('common:message:deletedSuccessfully'))
this.getList()
this.loading = false
})
.catch(() => {
this.loading = false
})
})
.then(() => {
this.loading = true
deleteTrialExternalUser(row.Id, row.IsSystemUser, row.SystemUserId)
.then(res => {
this.$message.success(this.$t('common:message:deletedSuccessfully'))
this.getList()
this.loading = false
}).catch(() => { this.loading = false })
})
},
sendEmail() {
const loading = this.$loading({
target: document.querySelector('.participant-table-list'),
fullscreen: false,
lock: true
lock: true,
})
// var BaseUrl = document.domain + `/#/login`
var BaseUrl = `${location.protocol}//${location.host}/login`
var joinUrl = `${location.protocol}//${location.host}/email-recompose`
var sendEmailUserArr = this.selectArr.map((v) => { return { Id: v.Id, Email: v.Email, IsSystemUser: v.IsSystemUser, SystemUserId: v.SystemUserId } })
var sendEmailUserArr = this.selectArr.map((v) => {
return {
Id: v.Id,
Email: v.Email,
IsSystemUser: v.IsSystemUser,
SystemUserId: v.SystemUserId,
UserTypeId: v.UserTypeId,
}
})
sendExternalUserJoinEmail({
TrialId: this.trialId,
SendUsers: sendEmailUserArr,
BaseUrl: BaseUrl,
RouteUrl: joinUrl
}).then(() => {
loading.close()
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.getList()
this.$emit('getList')
}).catch(() => { loading.close() })
RouteUrl: joinUrl,
})
.then(() => {
loading.close()
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.getList()
this.$emit('getList')
})
.catch(() => {
loading.close()
})
},
getList() {
const loading = this.$loading({
target: document.querySelector('.participant-table-list'),
fullscreen: false,
lock: true
lock: true,
})
this.listQuery.TrialId = this.trialId
getTrialExternalUserList(this.listQuery).then(res => {
loading.close()
this.list = res.Result
}).catch(() => { loading.close() })
getTrialExternalUserList(this.listQuery)
.then((res) => {
loading.close()
this.list = res.Result
})
.catch(() => {
loading.close()
})
},
handleAssign() {
this.$confirm(this.$t('trials:externalStaff:message:add'), {
type: 'warning',
distinguishCancelAndClose: true
distinguishCancelAndClose: true,
}).then(() => {
const loading = this.$loading({
target: document.querySelector('.participant-table-list'),
fullscreen: false,
lock: true
lock: true,
})
this.assignLoadStatus = true
addTrialUsers(this.selectArr)
.then(res => {
.then((res) => {
this.assignLoadStatus = false
loading.close()
if (res.IsSuccess) {
this.$emit('closeDialog')
this.$message.success(this.$t('common:message:savedSuccessfully'))
}
}).catch(() => {
})
.catch(() => {
loading.close()
this.assignLoadStatus = false
})
@ -360,35 +480,35 @@ export default {
}
},
getUserType() {
getUserTypeList(1).then(res => {
getUserTypeList(1).then((res) => {
this.userTypeOptions = res.Result
})
}
}
},
},
}
</script>
<style lang="scss" scoped>
.participant-container{
height: 100%;
.el-header{
.filter-container{
display: flex;
align-items: center;
span{
font-size:13px;
margin-right:5px;
}
.mr{
margin-right: 5px;
width: 120px;
}
.participant-container {
height: 100%;
.el-header {
.filter-container {
display: flex;
align-items: center;
span {
font-size: 13px;
margin-right: 5px;
}
.mr {
margin-right: 5px;
width: 120px;
}
}
.el-main{
padding: 0px;
}
.el-footer{
padding: 0 20px;
}
}
.el-main {
padding: 0px;
}
.el-footer {
padding: 0 20px;
}
}
</style>