irc_web/.svn/pristine/17/17b25d1c4a57b8cba3340a68d07...

219 lines
6.4 KiB
Plaintext

<template>
<BaseContainer>
<template slot="main-container">
<el-table
ref="emailList"
v-loading="loading"
:data="list"
stripe
@sort-change="handleSortChange"
>
<el-table-column type="index" width="40" />
<el-table-column
prop="TrialReadingCriterionId"
:label="$t('trials:reviewTrack:table:criterionName')"
show-overflow-tooltip
width="100"
>
<template slot-scope="scope">
{{ trialCriterionList.find(v => v.TrialReadingCriterionId === scope.row.TrialReadingCriterionId) ? trialCriterionList.find(v => v.TrialReadingCriterionId === scope.row.TrialReadingCriterionId).TrialReadingCriterionName : null }}
</template>
</el-table-column>
<!-- 业务场景 -->
<el-table-column
prop="BusinessScenarioEnum"
:label="$t('trials:emailManageCfg:title:businessScenario')"
show-overflow-tooltip
width="100"
>
<template slot-scope="scope">
{{ $fd('Common_File_BusinessScenario',scope.row.BusinessScenarioEnum) }}
</template>
</el-table-column>
<el-table-column
prop="ToUserTypeList"
:label="$t('trials:emailManageCfg:title:toUserTypeList')"
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="$t('trials:emailManageCfg:title:copyUserTypeList')"
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="$t('trials:emailManageCfg:title:fileName')"
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>-->
<el-button v-if="scope.row.FilePath" type="text" @click="handlePreview(scope.row.FilePath)">
生成报告
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('common:action:action')" width="80px" fixed="right">
<template slot-scope="scope">
<!-- 编辑 -->
<el-button
icon="el-icon-message"
circle
:disabled="isEdit"
:title="'发送'"
/>
</template>
</el-table-column>
</el-table>
</template>
</BaseContainer>
</template>
<script>
import { getTrialEmailNoticeConfigList } from '@/api/trials'
import { getTrialCriterionList } from '@/api/trials/reading'
import BaseContainer from '@/components/BaseContainer'
const searchDataDefault = () => {
return {
BusinessScenarioEnum: null,
CriterionTypeEnum: null,
TrialReadingCriterionId: null
}
}
export default {
name: 'Message',
components: { BaseContainer },
props: {
isDistinguishCriteria: {
type: Boolean,
default() {
return false
}
},
isEdit: {
type: Boolean,
default() {
return false
}
},
},
data() {
return {
searchData: searchDataDefault(),
list: [],
total: 0,
currentRow: {},
editDialog: { title: '', visible: false },
loading: false,
trialId: '',
trialCriterionList: []
}
},
watch: {
list() {
this.$nextTick(() => {
this.$refs.emailList.doLayout()
})
}
},
mounted() {
this.trialId = this.$route.query.trialId
this.getList()
this.getTrialCriterionList()
},
methods: {
getTrialCriterionList() {
this.loading = true
getTrialCriterionList(this.trialId).then(res => {
this.trialCriterionList = res.Result
// this.activeTab = this.trialCriterionList[0].TrialReadingCriterionId
this.loading = false
}).catch(() => {
this.loading = false
})
},
getList() {
this.loading = true
this.searchData.TrialId = this.trialId
this.searchData.IsDistinguishCriteria = true
getTrialEmailNoticeConfigList(this.searchData).then(res => {
this.loading = false
res.Result.forEach(item => {
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.$t('common:button:new')// '新增'
this.currentRow = { CriterionTypeEnum: this.criterionType }
this.editDialog.visible = true
},
// 编辑
handleEdit(row) {
this.editDialog.title = this.$t('common:button:edit')// '编辑'
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>