395 lines
12 KiB
Plaintext
395 lines
12 KiB
Plaintext
<template>
|
|
<BaseContainer>
|
|
|
|
<template slot="search-container">
|
|
<el-form :inline="true" size="small">
|
|
<el-form-item label="业务场景">
|
|
<el-select
|
|
v-model="searchData.BusinessScenarioEnum"
|
|
style="width:150px;"
|
|
>
|
|
<el-option
|
|
v-for="item of $d.Common_File_BusinessScenario"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
/>
|
|
|
|
</el-select>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<!-- 查询 -->
|
|
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
|
|
{{ $t('common:button:search') }}
|
|
</el-button>
|
|
<!-- 重置 -->
|
|
<el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
|
|
{{ $t('common:button:reset') }}
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<!-- 自定义标准允许添加 -->
|
|
<el-button
|
|
v-if="criterionType === 0"
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
style="margin-left:auto;"
|
|
size="small"
|
|
@click="handleAdd"
|
|
>
|
|
{{ $t('common:button:new') }}
|
|
</el-button>
|
|
</template>
|
|
<template slot="main-container">
|
|
<el-table
|
|
ref="emailList"
|
|
v-adaptive="{bottomOffset:60}"
|
|
v-loading="loading"
|
|
:data="list"
|
|
stripe
|
|
height="100"
|
|
@sort-change="handleSortChange"
|
|
>
|
|
<el-table-column type="index" width="40" />
|
|
<el-table-column
|
|
prop="Code"
|
|
label="Code"
|
|
sortable="custom"
|
|
show-overflow-tooltip
|
|
width="100"
|
|
/>
|
|
<el-table-column
|
|
prop="BusinessScenarioEnum"
|
|
label="业务场景"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
width="100"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{ $fd('Common_File_BusinessScenario',scope.row.BusinessScenarioEnum) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="FromName"
|
|
label="发件人"
|
|
sortable="custom"
|
|
show-overflow-tooltip
|
|
width="100"
|
|
/>
|
|
<el-table-column
|
|
prop="FromEmail"
|
|
label="发件箱"
|
|
sortable="custom"
|
|
show-overflow-tooltip
|
|
width="100"
|
|
/>
|
|
<!-- <el-table-column
|
|
prop="FromUsers"
|
|
label="发件人"
|
|
show-overflow-tooltip
|
|
>
|
|
<template slot-scope="scope">
|
|
|
|
<el-popover
|
|
placement="bottom"
|
|
trigger="click"
|
|
width="600"
|
|
>
|
|
<el-table :data="scope.row.FromUserList">
|
|
<el-table-column prop="RealName" label="姓名" show-overflow-tooltip />
|
|
<el-table-column prop="UserName" label="用户名" show-overflow-tooltip />
|
|
<el-table-column prop="Email" label="邮箱" show-overflow-tooltip />
|
|
</el-table>
|
|
<el-button slot="reference" type="text"> {{ scope.row.FromUsers }}</el-button>
|
|
</el-popover>
|
|
|
|
</template>
|
|
</el-table-column> -->
|
|
|
|
<el-table-column
|
|
prop="SMTPServerAddress"
|
|
label="SMTP服务器地址"
|
|
show-overflow-tooltip
|
|
width="150"
|
|
/>
|
|
<el-table-column
|
|
prop="SMTPServerPort"
|
|
label="SMTP服务器端口"
|
|
show-overflow-tooltip
|
|
width="150"
|
|
/>
|
|
<el-table-column
|
|
prop="AuthorizationCode"
|
|
label="发件箱授权码"
|
|
show-overflow-tooltip
|
|
width="150"
|
|
/>
|
|
<el-table-column
|
|
prop="ToUserTypeList"
|
|
label="收件人"
|
|
show-overflow-tooltip
|
|
width="100"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.ToUserTypeNameList.length>0?scope.row.ToUserTypeNameList.join('、'):'' }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="CopyUserTypeList"
|
|
label="抄送人"
|
|
show-overflow-tooltip
|
|
width="100"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.CopyUserTypeNameList.length>0?scope.row.CopyUserTypeNameList.join('、'):'' }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="FileName"
|
|
label="附件"
|
|
show-overflow-tooltip
|
|
width="100"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-button v-if="scope.row.FilePath" type="text" @click="handlePreview(scope.row.FilePath)">
|
|
{{ scope.row.FileName }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column
|
|
prop="IsReturnRequired"
|
|
label="是否需要回执"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
width="140"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.IsReturnRequired" type="danger">
|
|
{{ $fd('YesOrNo', scope.row.IsReturnRequired) }}
|
|
</el-tag>
|
|
<el-tag v-else type="primary">{{ $fd('YesOrNo', scope.row.IsReturnRequired) }}</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="IsUrgent"
|
|
label="是否加急"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
width="100"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.IsUrgent" type="danger">
|
|
{{ $fd('YesOrNo', scope.row.IsUrgent) }}
|
|
</el-tag>
|
|
<el-tag v-else type="primary">{{ $fd('YesOrNo', scope.row.IsUrgent) }}</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="IsAutoSend"
|
|
label="是否自动发送"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
width="140"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.IsAutoSend" type="danger">
|
|
{{ $fd('YesOrNo', scope.row.IsAutoSend) }}
|
|
</el-tag>
|
|
<el-tag v-else type="primary">{{ $fd('YesOrNo', scope.row.IsAutoSend) }}</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<!-- <el-table-column
|
|
prop="IsDistinguishCriteria"
|
|
label="是否区分标准"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
width="140"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.IsDistinguishCriteria" type="danger">
|
|
{{ $fd('YesOrNo', scope.row.IsDistinguishCriteria) }}
|
|
</el-tag>
|
|
<el-tag v-else type="primary">{{ $fd('YesOrNo', scope.row.IsDistinguishCriteria) }}</el-tag>
|
|
</template>
|
|
</el-table-column> -->
|
|
<!-- <el-table-column
|
|
prop="IsEnable"
|
|
label="是否启用"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.IsEnable" type="danger">{{ $fd('YesOrNo', scope.row.IsEnable) }}</el-tag>
|
|
<el-tag v-else type="primary">{{ $fd('YesOrNo', scope.row.IsEnable) }}</el-tag>
|
|
</template>
|
|
</el-table-column> -->
|
|
<el-table-column
|
|
prop="UpdateTime"
|
|
label="更新时间"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
width="120"
|
|
/>
|
|
|
|
<el-table-column
|
|
prop="CreateTime"
|
|
label="创建时间"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
width="120"
|
|
/>
|
|
|
|
<el-table-column label="Action" fixed="right">
|
|
<template slot-scope="scope">
|
|
|
|
<el-button
|
|
icon="el-icon-edit-outline"
|
|
circle
|
|
title="编辑"
|
|
@click="handleEdit(scope.row)"
|
|
/>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<!-- 新增/编辑 -->
|
|
<el-dialog
|
|
v-if="editDialog.visible"
|
|
:visible.sync="editDialog.visible"
|
|
:close-on-click-modal="false"
|
|
:title="editDialog.title"
|
|
width="600px"
|
|
custom-class="base-dialog-wrapper"
|
|
>
|
|
<EmailForm
|
|
:data="currentRow"
|
|
:criterion-type="criterionType"
|
|
@closeDialog="closeDialog"
|
|
@getList="getList"
|
|
/>
|
|
</el-dialog>
|
|
</template>
|
|
</BaseContainer>
|
|
</template>
|
|
<script>
|
|
import { getTrialEmailNoticeConfigList } from '@/api/trials'
|
|
import BaseContainer from '@/components/BaseContainer'
|
|
import EmailForm from './EmailForm'
|
|
const searchDataDefault = () => {
|
|
return {
|
|
BusinessScenarioEnum: null,
|
|
CriterionTypeEnum: null
|
|
}
|
|
}
|
|
export default {
|
|
name: 'EmailList',
|
|
components: { BaseContainer, EmailForm },
|
|
props: {
|
|
criterionType: {
|
|
type: Number,
|
|
required: true
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
searchData: searchDataDefault(),
|
|
list: [],
|
|
total: 0,
|
|
currentRow: {},
|
|
editDialog: { title: '', visible: false },
|
|
loading: false,
|
|
trialId: ''
|
|
}
|
|
},
|
|
watch: {
|
|
list() {
|
|
this.$nextTick(() => {
|
|
this.$refs.emailList.doLayout()
|
|
})
|
|
}
|
|
},
|
|
mounted() {
|
|
this.trialId = this.$route.query.trialId
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
getList() {
|
|
this.loading = true
|
|
this.searchData.TrialId = this.trialId
|
|
this.searchData.CriterionTypeEnum = this.criterionType
|
|
getTrialEmailNoticeConfigList(this.searchData).then(res => {
|
|
this.loading = false
|
|
res.Result.forEach(item => {
|
|
// item.FromUsers = this.getUsersByType(item.TrialEmailNoticeUserList, 1)
|
|
// item.FromUserList = this.getUserList(item.TrialEmailNoticeUserList, 1)
|
|
// item.ToUsers = this.getUsersByType(item.TrialEmailNoticeUserList, 2)
|
|
// item.ToUserList = this.getUserList(item.TrialEmailNoticeUserList, 2)
|
|
// item.CopyUsers = this.getUsersByType(item.TrialEmailNoticeUserList, 3)
|
|
// item.CopyUserList = this.getUserList(item.TrialEmailNoticeUserList, 3)
|
|
item.ToUserTypeNameList = this.getUserTypeName(item.ToUserTypeList)
|
|
item.CopyUserTypeNameList = this.getUserTypeName(item.CopyUserTypeList)
|
|
})
|
|
this.list = res.Result
|
|
}).catch(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
getUserTypeName(userTypeList) {
|
|
var userTypes = userTypeList.map(i => this.$fd('UserType', i))
|
|
return userTypes
|
|
},
|
|
getUserList(userList, type) {
|
|
return userList.filter(i => i.EmailUserType === type)
|
|
},
|
|
getUsersByType(userList, type) {
|
|
var users = userList.filter(i => i.EmailUserType === type)
|
|
var usersName = users.map(obj => {
|
|
return obj.RealName
|
|
})
|
|
return usersName.join('、')
|
|
},
|
|
// 新增
|
|
handleAdd() {
|
|
this.editDialog.title = '新增'
|
|
this.currentRow = { CriterionTypeEnum: this.criterionType }
|
|
this.editDialog.visible = true
|
|
},
|
|
// 编辑
|
|
handleEdit(row) {
|
|
this.editDialog.title = '编辑'
|
|
this.currentRow = { ...row }
|
|
this.editDialog.visible = true
|
|
},
|
|
handlePreview(filePath) {
|
|
if (filePath) {
|
|
window.open(filePath, '_blank')
|
|
}
|
|
},
|
|
handleSearch() {
|
|
this.searchData.PageIndex = 1
|
|
this.getList()
|
|
},
|
|
handleReset() {
|
|
this.searchData = searchDataDefault()
|
|
this.getList()
|
|
},
|
|
closeDialog() {
|
|
this.editDialog.visible = false
|
|
},
|
|
// 排序
|
|
handleSortChange(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()
|
|
}
|
|
}
|
|
}
|
|
</script>
|