邮件日志及状态管理
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-11-06 16:07:07 +08:00
parent 5dd13b58c5
commit 795423182d
5 changed files with 796 additions and 248 deletions

View File

@ -350,3 +350,35 @@ export function getUserJoinedTrialList(data) {
data
})
}
// 邮件日志-日志列表
export function getEmailLogList(data) {
return request({
url: `/EmailLog/getEmailLogList`,
method: 'post',
data
})
}
// 邮件日志-日志详情
export function getEmailInfo(data) {
return request({
url: `/EmailLog/getEmailInfo`,
method: 'post',
data
})
}
// 邮件日志-重发邮件
export function resendEmail(data) {
return request({
url: `/EmailLog/resendEmail`,
method: 'post',
data
})
}
// 邮件日志-同步邮件
export function synchronizationEmail(data) {
return request({
url: `/EmailLog/synchronizationEmail`,
method: 'post',
data
})
}

View File

@ -0,0 +1,228 @@
<template>
<div class="detail">
<div class="attachment" v-if="Array.isArray(info.AttachmentList) && info.AttachmentList.length > 0">
<div class="box" v-for="item of info.AttachmentList" :key="item.AttachmentPath" @click="perview(item)">
<i :class="`icon icon_file icon_${item.type}`" />
<span>{{ item.AttachmentName }}</span>
</div>
<span class="downLoadTip" @click="downloadFile">{{ $t('system:email:tip:allDownLoad') }}</span>
</div>
<div class="content" v-html="info.Content"></div>
<viewer ref="picture_perview" style="margin: 0 10px"
v-if="rowData.type && ['png', 'jpg', 'jpeg'].includes(rowData.type.toLowerCase())"
:images="[`${OSSclientConfig.basePath}${rowData.AttachmentPath}`]" :options="viewerOptions">
<img v-show="false" :src="`${OSSclientConfig.basePath}${rowData.AttachmentPath}`" alt="Image" />
</viewer>
</div>
</template>
<script>
import { downLoadFile } from '@/utils/stream.js'
export default {
name: "emailDetail",
props: {
info: {
type: Object,
default: () => {
return {}
}
}
},
data() {
return {
rowData: {},
viewerOptions: {
toolbar: {
zoomIn: true,
zoomOut: true,
reset: true,
prev: false,
next: false,
rotateLeft: true,
rotateRight: true,
flipHorizontal: true,
flipVertical: true,
}
}
}
},
methods: {
//
perview(data) {
this.rowData = data
if (['.ppt',
'.pptx',
'.doc',
'.docx',
'.xls',
'.xlsx'].includes(`.${data.type.toLowerCase()}`)) {
this.$onlyOffice({
path: data.AttachmentPath,
type: data.type,
title: data.AttachmentName
})
}
if (['.jpg',
'.jpeg',
'.png'].includes(`.${data.type.toLowerCase()}`)) {
this.$refs['picture_perview'].$viewer.show()
}
if (['.pdf'].includes(`.${data.type.toLowerCase()}`)) {
this.$preview({
path: data.Path || data.AttachmentPath,
type: 'pdf',
title: data.AttachmentName,
})
}
},
async downloadFile() {
try {
let { files, name } = this.formatDownloadFile(this.info.AttachmentList)
let res = await downLoadFile(files, name, 'zip')
} catch (err) {
console.log(err)
}
},
//
formatDownloadFile(list) {
let files = [],
name = `Attachment_${new Date().getTime()}.zip`
list.forEach(item => {
let obj = {
name: item.AttachmentName,
url: this.OSSclientConfig.basePath + item.AttachmentPath,
}
files.push(obj)
})
return { files, name }
},
}
}
</script>
<style lang="scss" scoped>
.attachment {
border-bottom: 1px solid #EBEEF5;
padding: 10px 0 0 0;
display: flex;
.box {
padding: 5px 10px;
display: flex;
align-items: center;
max-width: 400px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
border-radius: 5px;
background-color: #E4E7ED;
cursor: pointer;
margin-right: 10px;
margin-bottom: 10px;
i {
margin-right: 5px;
}
}
.downLoadTip {
cursor: pointer;
font-size: 14px;
color: #409EFF;
}
}
.content {
width: 100%;
overflow: hidden;
}
.icon {
height: 20px;
width: 20px;
padding: 0px;
line-height: 20px;
margin-right: 6px;
margin-top: 6px;
}
/*文件*/
.icon_file {
width: 16px !important;
height: 16px !important;
margin-right: 6px;
background-size: inherit;
background-image: url(@/assets/0.file-16.png);
background-position: 0 0;
margin-top: -2px;
background-repeat: no-repeat;
font-style: normal;
display: inline-block;
pointer-events: none;
font-size: 85%;
}
/*文件夹*/
.icon_folder {
background-image: url(@/assets/folder_win11_small.png);
margin-top: -6px;
margin-left: 2px;
margin-right: 6px;
background-repeat: no-repeat;
}
/*docx*/
.icon_docx {
background-position: -81px -560px !important;
margin-top: 0;
margin-left: 2px;
}
/*doc*/
.icon_doc {
background-position: -81px -592px !important;
margin-top: 0;
margin-left: 2px;
}
/*xlsx*/
.icon_xlsx {
background-position: -81px -48px !important;
margin-top: 0;
margin-left: 2px;
}
/*pdf*/
.icon_pdf {
background-position: -81px -352px !important;
margin-top: 0;
margin-left: 2px;
}
/*pptx*/
.icon_pptx {
background-position: -81px -288px !important;
margin-top: 0;
margin-left: 2px;
}
/*zip*/
.icon_zip {
background-position: 0 0 !important;
margin-top: -2px;
margin-left: 2px;
}
/*ppt*/
.icon_ppt {
background-position: -81px -304px !important;
margin-top: 0;
margin-left: 2px;
}
/*xls*/
.icon_xls {
background-position: -81px -96px !important;
margin-top: 0;
margin-left: 2px;
}
</style>

View File

@ -0,0 +1,271 @@
<template>
<div class="event">
<div ref="leftContainer" class="left">
<el-form :inline="true">
<el-form-item :label="$t('system:email:search:ToRecipientName')">
<el-input v-model="searchData.ToRecipientName" clearable />
</el-form-item>
<el-form-item :label="$t('system:email:search:CcRecipientName')">
<el-input v-model="searchData.CcRecipientName" clearable />
</el-form-item>
<el-form-item :label="$t('system:email:search:EmailStateEnum')">
<el-select v-model="searchData.EmailStateEnum" clearable filterable placeholder="">
<el-option v-for="item in $d.EmailState" :key="item.id" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('system:email:search:EmailStateEnum')">
<el-select v-model="searchData.EmailStateEnum" clearable filterable placeholder="">
<el-option v-for="item in $d.EmailState" :key="item.id" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item :label="$t('system:email:search:emailDate')">
<el-date-picker v-model="datetimerange" type="datetimerange"
:default-time="['00:00:00', '23:59:59']" :start-placeholder="$t('feedBack:search:beginTime')"
:end-placeholder="$t('feedBack:search:endTime')" value-format="yyyy-MM-dd HH:mm:ss"
@change="handleDatetimeChange" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="getList">
{{ $t('common:button:search') }}
</el-button>
<el-button icon="el-icon-refresh-left" size="small" @click="handleReset">
{{ $t('common:button:reset') }}
</el-button>
<el-button type="primary" size="small" @click="synchronizationEmail">
{{ $t('system:email:button:sync') }}
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" v-adaptive="{ bottomOffset: 45 }" height="100" :data="list" class="table"
@sort-change="handleSortByColumn">
<el-table-column type="index" width="50" />
<el-table-column :label="$t('system:email:table:messageId')" prop="MessageId" show-overflow-tooltip
sortable="custom" />
<el-table-column :label="$t('system:email:table:emailSubject')" prop="EmailSubject"
show-overflow-tooltip />
<el-table-column :label="$t('system:email:table:ToRecipientName')" prop="ToRecipientName"
show-overflow-tooltip>
<template slot-scope="scope">
<span>{{Array.isArray(scope.row.RecipientList) && scope.row.RecipientList.length > 0
? scope.row.RecipientList.filter(item => item.RecipientTypeEnum === 0).map(item =>
item.RecipientName).join(", ") : ''
}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('system:email:table:CcRecipientName')" prop="CcRecipientName"
show-overflow-tooltip>
<template slot-scope="scope">
<span>{{Array.isArray(scope.row.RecipientList) && scope.row.RecipientList.length > 0
? scope.row.RecipientList.filter(item => item.RecipientTypeEnum === 1).map(item =>
item.RecipientName).join(", ") : ''
}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('system:email:table:emailDate')" prop="EmailDate" show-overflow-tooltip
sortable="custom" />
<el-table-column :label="$t('system:email:table:emailStateEnum')" prop="EmailStateEnum"
show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
<el-tag :type="scope.row.EmailStateEnum === 1 ? 'danger' : ''">{{ $fd("EmailState",
scope.row.EmailStateEnum) }}</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('system:email:table:errorInfo')" prop="ErrorInfo" show-overflow-tooltip />
<el-table-column :label="$t('common:action:action')" fixed="right" prop="" show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="text" @click="view(scope.row)">
{{ $t('common:button:view') }}
</el-button>
<el-button type="text" @click="resendEmail(scope.row)">
{{ $t('system:email:button:resendEmail') }}
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination" style="text-align: right; margin-top: 5px">
<pagination :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
@pagination="getList" />
</div>
</div>
<base-model v-if="model_cfg.visible" :config="model_cfg">
<template slot="dialog-body">
<emailDetail :info="info" />
</template>
</base-model>
</div>
</template>
<script>
import { getEmailLogList, resendEmail, getEmailInfo, synchronizationEmail } from '@/api/admin'
import Pagination from '@/components/Pagination'
import BaseModel from '@/components/BaseModel'
import emailDetail from "./components/detail"
const searchDataDefault = () => {
return {
TrialId: null,
EmailStartDate: null,
EmailEndDate: null,
EmailStateEnum: null,
ToRecipientName: null,
CcRecipientName: null,
Asc: false,
SortField: 'CreateTime',
PageIndex: 1,
PageSize: 20,
}
}
export default {
name: 'emailLog',
components: { Pagination, BaseModel, emailDetail },
props: {
isSystem: {
type: Boolean,
default: true
}
},
data() {
return {
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
datetimerange: [],
model_cfg: { visible: false, title: '', width: '500px', fullscreen: true },
info: null,
}
},
mounted() {
this.getList()
},
methods: {
getList() {
this.loading = true
if (!this.isSystem) this.searchData.TrialId = this.$route.query.trialId
getEmailLogList(this.searchData)
.then((res) => {
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
})
.catch(() => {
this.loading = false
})
},
//
async view(row) {
try {
let data = {
Id: row.Id
// Id: "EC660000-BA37-5C60-8680-08DE1CD6931B"
}
let res = await getEmailInfo(data)
if (res.IsSuccess) {
this.info = res.Result
if (Array.isArray(this.info.AttachmentList) && this.info.AttachmentList.length > 0) {
this.info.AttachmentList.forEach(item => {
var type = item.AttachmentName
.substring(item.AttachmentName.lastIndexOf('.'))
.toLocaleLowerCase().split('.')[1];
item.type = type
})
}
this.model_cfg.visible = true
}
} catch (err) {
console.log(err)
}
},
//
async synchronizationEmail() {
try {
this.loading = true
let res = await synchronizationEmail()
this.loading = false
if (res.IsSuccess) {
this.getList()
this.$message.success(this.$t("system:email:message:syncSuccessfully"))
}
} catch (err) {
this.loading = false
console.log(err)
}
},
//
async resendEmail(row) {
try {
let data = {
Id: row.Id
}
this.loading = true
let res = await resendEmail(data)
this.loading = false
if (res.IsSuccess) {
this.getList()
this.$message.success(this.$t("system:email:message:resendSuccessfully"))
}
} catch (err) {
this.loading = false
console.log(err)
}
},
//
handleReset() {
this.searchData = searchDataDefault()
this.getList()
},
//
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
handleDatetimeChange(val) {
if (val) {
this.searchData.EmailStartDate = val[0]
this.searchData.EmailEndDate = val[1]
} else {
this.searchData.EmailStartDate = ''
this.searchData.EmailEndDate = ''
}
},
},
}
</script>
<style lang="scss" scoped>
.event {
height: 100%;
box-sizing: border-box;
display: flex;
padding: 10px;
border-radius: 5px;
.left {
display: flex;
flex-direction: column;
width: 0;
flex-grow: 4;
// border-right: 1px solid #ccc;
.filter-container {
display: flex;
align-items: center;
margin: 5px;
}
.data-table {
flex: 1;
padding: 5px 0px;
}
.pagination-container {
text-align: right;
}
}
}
</style>

View File

@ -0,0 +1,242 @@
<template>
<div v-loading="loading" class="email-wrapper">
<el-collapse v-model="activeCollapse" class="setting-config">
<!-- 发件箱配置 -->
<el-collapse-item :title="$t('trials:emailManageCfg:title:sendEmailCfg')" name="1">
<!-- 配置信息表单 -->
<el-form ref="emailRulesForm" v-loading="loading" :model="form" style="width:800px;margin-top: 10px;"
:rules="rules" label-width="230px" size="small">
<!-- 发件箱账号 -->
<el-form-item :label="$t('trials:emailManageCfg:title:sendEmailAccount')" prop="EmailFromEmail">
<el-input v-model="form.EmailFromEmail" :disabled="!isEdit" />
</el-form-item>
<!-- 发件人 -->
<el-form-item :label="$t('trials:emailManageCfg:title:fromName')" prop="EmailFromName">
<el-input v-model="form.EmailFromName" :disabled="!isEdit" />
</el-form-item>
<!-- 密码/授权码 -->
<el-form-item :label="$t('trials:emailManageCfg:title:password')" prop="EmailAuthorizationCode">
<el-input v-model="form.EmailAuthorizationCode" :disabled="!isEdit" />
</el-form-item>
<!-- SMTP服务器 -->
<el-form-item :label="$t('trials:emailManageCfg:title:SMTPServerAddress')"
prop="EmailSMTPServerAddress">
<el-input v-model="form.EmailSMTPServerAddress" :disabled="!isEdit" />
</el-form-item>
<!-- SMTP端口 -->
<el-form-item :label="$t('trials:emailManageCfg:title:SMTPServerPort')" prop="EmailSMTPServerPort">
<el-input v-model.number="form.EmailSMTPServerPort" type="number" :disabled="!isEdit" />
</el-form-item>
<el-form-item v-if="hasPermi(['trials:trials-panel:setting:email-manage:edit'])">
<el-button v-if="isEdit" size="small" type="primary" @click="setTrialEmail">
{{ $t('common:button:confirm') }}
</el-button>
<el-button v-else size="small" type="primary" @click="isEdit = true">
{{ $t('trials:trialCfg:button:update') }}
</el-button>
</el-form-item>
</el-form>
</el-collapse-item>
<!-- 自动邮件模版 -->
<el-collapse-item :title="$t('trials:emailManageCfg:title:emailTpl')" name="2">
<el-tabs v-model="activeTab" type="border-card">
<!-- 通用 -->
<el-tab-pane :label="$t('trials:emailManageCfg:title:commom')" name="0">
<EmailList v-if="activeTab === '0'" ref="emailList" :is-distinguish-criteria="false"
:is-edit="isEdit" />
</el-tab-pane>
<!-- 标准相关 -->
<el-tab-pane :label="$t('trials:emailManageCfg:title:criterions')" name="1">
<EmailList v-if="activeTab === '1'" ref="emailList" :is-distinguish-criteria="true"
:is-edit="isEdit" />
</el-tab-pane>
</el-tabs>
</el-collapse-item>
</el-collapse>
</div>
</template>
<script>
import EmailList from './components/EmailList'
import { getTrialCriterionList } from '@/api/trials/reading'
import { setTrialEmail, getTrialEmail } from '@/api/trials'
export default {
name: 'emailConfig',
components: {
EmailList
},
data() {
return {
activeCollapse: ['1', '2'],
trialId: '',
activeTab: '0',
trialCriterionList: [],
loading: false,
isEdit: true,
form: {
EmailFromEmail: '',
EmailFromName: '',
EmailAuthorizationCode: '',
EmailSMTPServerAddress: '',
EmailSMTPServerPort: null,
IsConfigureEmail: true
},
rules: {
EmailFromEmail: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailFromName: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailAuthorizationCode: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailSMTPServerAddress: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailSMTPServerPort: [{ required: true, message: this.$t('common:ruleMessage:specify') }, {
type: "number",
min: 1,
max: 65535,
message: this.$t("common:ruleMessage:portPattern"),
trigger: "blur",
},
{
validator: (rule, value, callback) => {
if (
value &&
(String(value).includes(".") ||
new RegExp(/\D/g).test(String(value)))
) {
callback(new Error(this.$t("common:ruleMessage:portPattern")));
} else {
callback();
}
},
trigger: "blur",
},]
},
NODE_ENV: process.env.NODE_ENV,
VUE_APP_OSS_PATH: process.env.VUE_APP_OSS_PATH,
}
},
// watch: {
// activeTab(v) {
// console.log(v)
// }
// },
created() {
if (this.VUE_APP_OSS_PATH === '/uat/dist') {
this.form = {
EmailFromEmail: 'uat@extimaging.com',
EmailFromName: 'Uat IRC Imaging System',
EmailAuthorizationCode: 'SHzyyl2021',
EmailSMTPServerAddress: 'smtp.qiye.aliyun.com',
EmailSMTPServerPort: 465,
IsConfigureEmail: true
};
}
if (this.VUE_APP_OSS_PATH === '/test/dist') {
this.form = {
EmailFromEmail: 'test@extimaging.com',
EmailFromName: 'Test IRC Imaging System',
EmailAuthorizationCode: 'SHzyyl2021',
EmailSMTPServerAddress: 'smtp.qiye.aliyun.com',
EmailSMTPServerPort: 465,
IsConfigureEmail: true
};
}
},
mounted() {
this.trialId = this.$route.query.trialId
this.getTrialEmail()
this.getTrialCriterionList()
},
methods: {
handleClick(a) {
this.activeName = a.name
},
setTrialEmail() {
this.$refs['emailRulesForm'].validate((valid) => {
if (!valid) {
// resolve(false)
} else {
this.form.TrialId = this.trialId
setTrialEmail(this.form).then(res => {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.isEdit = false
this.$refs['emailList'].getList()
})
}
})
},
getTrialEmail() {
getTrialEmail({
TrialId: this.trialId
}).then(res => {
if (res.Result.IsConfigureEmail) {
this.form = Object.assign(this.form, res.Result)
this.isEdit = false
}
})
},
getTrialCriterionList() {
this.loading = true
getTrialCriterionList(this.trialId, false).then(res => {
this.trialCriterionList = res.Result
// this.activeTab = this.trialCriterionList[0].TrialReadingCriterionId
this.loading = false
}).catch(() => {
this.loading = false
})
}
}
}
</script>
<style lang="scss">
.email-wrapper {
height: 100%;
background-color: #fff;
.el-tabs {
height: 100%;
display: flex;
flex-direction: column;
}
.el-tabs__header {
height: 40px;
margin-bottom: 5px;
}
.el-tabs__content {
flex: 1;
.el-tab-pane {
height: 100%;
}
}
}
</style>
<style lang="scss" scoped>
.email-wrapper {
height: 100%;
background-color: #fff;
display: flex;
flex-direction: column;
.content {
flex: 1;
overflow-y: auto;
}
::v-deep.el-collapse-item__header {
background: #e5ecef;
padding-left: 10px;
}
::v-deep.el-collapse-item__content {
padding: 10px;
}
.bottom {
height: 50px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
border-top: 1px solid #e1e1e1;
}
}
</style>

View File

@ -1,268 +1,43 @@
<template>
<div v-loading="loading" class="email-wrapper">
<el-collapse v-model="activeCollapse" class="setting-config">
<!-- 发件箱配置 -->
<el-collapse-item :title="$t('trials:emailManageCfg:title:sendEmailCfg')" name="1">
<!-- 配置信息表单 -->
<el-form
ref="emailRulesForm"
v-loading="loading"
:model="form"
style="width:800px;margin-top: 10px;"
:rules="rules"
label-width="230px"
size="small"
>
<!-- 发件箱账号 -->
<el-form-item
:label="$t('trials:emailManageCfg:title:sendEmailAccount')"
prop="EmailFromEmail"
>
<el-input v-model="form.EmailFromEmail" :disabled="!isEdit" />
</el-form-item>
<!-- 发件人 -->
<el-form-item
:label="$t('trials:emailManageCfg:title:fromName')"
prop="EmailFromName"
>
<el-input v-model="form.EmailFromName" :disabled="!isEdit" />
</el-form-item>
<!-- 密码/授权码 -->
<el-form-item
:label="$t('trials:emailManageCfg:title:password')"
prop="EmailAuthorizationCode"
>
<el-input v-model="form.EmailAuthorizationCode" :disabled="!isEdit" />
</el-form-item>
<!-- SMTP服务器 -->
<el-form-item
:label="$t('trials:emailManageCfg:title:SMTPServerAddress')"
prop="EmailSMTPServerAddress"
>
<el-input v-model="form.EmailSMTPServerAddress" :disabled="!isEdit" />
</el-form-item>
<!-- SMTP端口 -->
<el-form-item
:label="$t('trials:emailManageCfg:title:SMTPServerPort')"
prop="EmailSMTPServerPort"
>
<el-input v-model.number="form.EmailSMTPServerPort" type="number" :disabled="!isEdit" />
</el-form-item>
<el-form-item v-if="hasPermi(['trials:trials-panel:setting:email-manage:edit'])">
<el-button v-if="isEdit" size="small" type="primary" @click="setTrialEmail">
{{ $t('common:button:confirm') }}
</el-button>
<el-button v-else size="small" type="primary" @click="isEdit = true">
{{ $t('trials:trialCfg:button:update') }}
</el-button>
</el-form-item>
</el-form>
</el-collapse-item>
<!-- 自动邮件模版 -->
<el-collapse-item :title="$t('trials:emailManageCfg:title:emailTpl')" name="2">
<el-tabs v-model="activeTab" type="border-card">
<!-- 通用 -->
<el-tab-pane
:label="$t('trials:emailManageCfg:title:commom')"
name="0"
>
<EmailList
v-if="activeTab === '0'"
ref="emailList"
:is-distinguish-criteria="false"
:is-edit="isEdit"
/>
</el-tab-pane>
<!-- 标准相关 -->
<el-tab-pane
:label="$t('trials:emailManageCfg:title:criterions')"
name="1"
>
<EmailList
v-if="activeTab === '1'"
ref="emailList"
:is-distinguish-criteria="true"
:is-edit="isEdit"
/>
</el-tab-pane>
</el-tabs>
</el-collapse-item>
</el-collapse>
<div style="background-color: #fff;height: 100%;">
<el-tabs v-model="activeName" @tab-click="handleClick" style="height: 100%;">
<el-tab-pane :label="$t('trials:emailManageCfg:tab:title:emailManageCfg')" name="emailManageCfg">
<emailConfig v-if="activeName === 'emailManageCfg'" />
</el-tab-pane>
<el-tab-pane :label="$t('trials:emailManageCfg:tab:title:emailLog')" name="emailLog">
<emailLog :isSystem="false" v-if="activeName === 'emailLog'" />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import EmailList from './components/EmailList'
import { getTrialCriterionList } from '@/api/trials/reading'
import { setTrialEmail, getTrialEmail } from '@/api/trials'
import emailConfig from './config.vue'
import emailLog from "@/views/system/email"
export default {
name: 'EmailManage',
components: {
EmailList
emailConfig,
emailLog
},
data() {
return {
activeCollapse: ['1', '2'],
trialId: '',
activeTab: '0',
trialCriterionList: [],
loading: false,
isEdit: true,
form: {
EmailFromEmail: '',
EmailFromName: '',
EmailAuthorizationCode: '',
EmailSMTPServerAddress: '',
EmailSMTPServerPort: null,
IsConfigureEmail: true
},
rules: {
EmailFromEmail: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailFromName: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailAuthorizationCode: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailSMTPServerAddress: [{ required: true, message: this.$t('common:ruleMessage:specify') }],
EmailSMTPServerPort: [{ required: true, message: this.$t('common:ruleMessage:specify') },{
type: "number",
min: 1,
max: 65535,
message: this.$t("common:ruleMessage:portPattern"),
trigger: "blur",
},
{
validator: (rule, value, callback) => {
if (
value &&
(String(value).includes(".") ||
new RegExp(/\D/g).test(String(value)))
) {
callback(new Error(this.$t("common:ruleMessage:portPattern")));
} else {
callback();
}
},
trigger: "blur",
},]
},
NODE_ENV: process.env.NODE_ENV,
VUE_APP_OSS_PATH: process.env.VUE_APP_OSS_PATH,
activeName: 'emailManageCfg', // emailLog emailManageCfg
}
},
// watch: {
// activeTab(v) {
// console.log(v)
// }
// },
created() {
if(this.VUE_APP_OSS_PATH === '/uat/dist'){
this.form= {
EmailFromEmail: 'uat@extimaging.com',
EmailFromName: 'Uat IRC Imaging System',
EmailAuthorizationCode: 'SHzyyl2021',
EmailSMTPServerAddress: 'smtp.qiye.aliyun.com',
EmailSMTPServerPort: 465,
IsConfigureEmail: true
};
}
if(this.VUE_APP_OSS_PATH === '/test/dist'){
this.form= {
EmailFromEmail: 'test@extimaging.com',
EmailFromName: 'Test IRC Imaging System',
EmailAuthorizationCode: 'SHzyyl2021',
EmailSMTPServerAddress: 'smtp.qiye.aliyun.com',
EmailSMTPServerPort: 465,
IsConfigureEmail: true
};
}
},
mounted() {
this.trialId = this.$route.query.trialId
this.getTrialEmail()
this.getTrialCriterionList()
},
methods: {
setTrialEmail() {
this.$refs['emailRulesForm'].validate((valid) => {
if (!valid) {
// resolve(false)
} else {
this.form.TrialId = this.trialId
setTrialEmail(this.form).then(res => {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.isEdit = false
this.$refs['emailList'].getList()
})
}
})
handleClick(a) {
this.activeName = a.name
},
getTrialEmail() {
getTrialEmail({
TrialId: this.trialId
}).then(res => {
if (res.Result.IsConfigureEmail) {
this.form = Object.assign(this.form, res.Result)
this.isEdit = false
}
})
},
getTrialCriterionList() {
this.loading = true
getTrialCriterionList(this.trialId, false).then(res => {
this.trialCriterionList = res.Result
// this.activeTab = this.trialCriterionList[0].TrialReadingCriterionId
this.loading = false
}).catch(() => {
this.loading = false
})
}
}
}
</script>
<style lang="scss">
.email-wrapper{
height: 100%;
background-color: #fff;
.el-tabs{
height: 100%;
display: flex;
flex-direction: column;
}
.el-tabs__header {
height: 40px;
margin-bottom:5px;
}
.el-tabs__content{
flex: 1;
.el-tab-pane{
height: 100%;
}
}
}
</style>
<style lang="scss" scoped>
.email-wrapper{
height: 100%;
background-color: #fff;
display: flex;
flex-direction: column;
.content{
flex: 1;
overflow-y: auto;
}
::v-deep.el-collapse-item__header{
background:#e5ecef;
padding-left:10px;
}
::v-deep.el-collapse-item__content{
padding: 10px;
}
.bottom{
height: 50px;
display:flex;
align-items:center;
justify-content:center;
text-align: center;
border-top: 1px solid #e1e1e1;
::v-deep .el-tabs__content {
height: calc(100% - 60px);
.el-tab-pane {
height: 100%;
overflow: auto;
}
}
</style>
</style>