436 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			436 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
| <template>
 | |
|   <BaseContainer>
 | |
|     <template slot="search-container">
 | |
|       <el-form :inline="true" size="small">
 | |
|         <!-- 业务场景 -->
 | |
|         <el-form-item :label="$t('trials:emailManageCfg:title:businessScenario')">
 | |
|           <el-select
 | |
|             v-model="searchData.BusinessScenarioEnum"
 | |
|             style="width:150px;"
 | |
|           >
 | |
|             <el-option
 | |
|               v-for="item of $d.Email_BusinessScenario"
 | |
|               :key="item.value"
 | |
|               :label="item.label"
 | |
|               :value="item.value"
 | |
|             />
 | |
| 
 | |
|           </el-select>
 | |
|         </el-form-item>
 | |
|         <el-form-item v-if="isDistinguishCriteria" style="margin-bottom:10px" :label="$t('trials:reviewTrack:table:criterionName')">
 | |
|           <el-select v-model="searchData.TrialReadingCriterionId" clearable style="width:120px;">
 | |
|             <el-option v-for="item of trialCriterionList" :key="'TrialReadingCriterionId' + item.TrialReadingCriterionId" :value="item.TrialReadingCriterionId" :label="item.TrialReadingCriterionName" />
 | |
|           </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-button
 | |
|             type="primary"
 | |
|             icon="el-icon-plus"
 | |
|             size="small"
 | |
|             :disabled="isEdit"
 | |
|             @click="handleAddDefault"
 | |
|           >
 | |
|             {{ $t('trials:emailManageCfg:button:Default') }}
 | |
|           </el-button>
 | |
|         </el-form-item>
 | |
|       </el-form>
 | |
|       <!-- 自定义标准允许添加 -->
 | |
|     </template>
 | |
|     <template slot="main-container">
 | |
|       <el-table
 | |
|         ref="emailList"
 | |
|         v-loading="loading"
 | |
|         :data="list"
 | |
|         stripe
 | |
|         @sort-change="handleSortChange"
 | |
|       >
 | |
|         <el-table-column type="index" width="40" />
 | |
|         <!-- Code -->
 | |
|         <el-table-column
 | |
|           prop="Code"
 | |
|           :label="$t('trials:emailManageCfg:title:code')"
 | |
|           sortable="custom"
 | |
|           show-overflow-tooltip
 | |
|           width="100"
 | |
|         />
 | |
|         <el-table-column
 | |
|           v-if="isDistinguishCriteria"
 | |
|           prop="TrialReadingCriterionId"
 | |
|           :label="$t('trials:reviewTrack:table:criterionName')"
 | |
|           show-overflow-tooltip
 | |
|           sortable="custom"
 | |
|           width="120"
 | |
|         >
 | |
|           <template slot-scope="scope">
 | |
|             {{ scope.row.TrialCriterionName }}
 | |
|           </template>
 | |
|         </el-table-column>
 | |
|         <el-table-column
 | |
|           prop="EmailTopicCN"
 | |
|           :label="$t('trials:emailManageCfg:table:EmailTopicCN')"
 | |
|           sortable="custom"
 | |
|           show-overflow-tooltip
 | |
|           width="160"
 | |
|         />
 | |
|         <el-table-column
 | |
|           prop="EmailTopic"
 | |
|           :label="$t('trials:emailManageCfg:table:EmailTopic')"
 | |
|           sortable="custom"
 | |
|           show-overflow-tooltip
 | |
|           width="160"
 | |
|         />
 | |
|         <el-table-column
 | |
|           prop="BusinessModuleEnum"
 | |
|           :label="$t('trials:emailManageCfg:table:BusinessModuleEnum')"
 | |
|           sortable="custom"
 | |
|           show-overflow-tooltip
 | |
|           width="100">
 | |
|           <template slot-scope="scope">
 | |
|             {{ $fd('BusinessModule',scope.row.BusinessModuleEnum) }}
 | |
|           </template>
 | |
|         </el-table-column>
 | |
|         <el-table-column
 | |
|           prop="BusinessScenarioEnum"
 | |
|           :label="$t('trials:emailManageCfg:table:BusinessScenarioEnum')"
 | |
|           sortable="custom"
 | |
|           show-overflow-tooltip
 | |
|           width="130"
 | |
|         >
 | |
|           <template slot-scope="scope">
 | |
|             {{ $fd('Email_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
 | |
|           :label="$t('trials:emailManageCfg:table:EmailUrgentEnum')"
 | |
|           sortable="custom"
 | |
|           show-overflow-tooltip
 | |
|           width="100"
 | |
|         >
 | |
|           <template slot-scope="scope">
 | |
|             {{ $fd('EmailUrgent',scope.row.EmailUrgentEnum) }}
 | |
|           </template>
 | |
|         </el-table-column>
 | |
| <!--        <el-table-column-->
 | |
| <!--          prop="EmailCron"-->
 | |
| <!--          :label="$t('trials:emailManageCfg:table:EmailCron')"-->
 | |
| <!--          sortable="custom"-->
 | |
| <!--          show-overflow-tooltip-->
 | |
| <!--          width="160"-->
 | |
| <!--        />-->
 | |
|         <!-- 附件 -->
 | |
|         <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>
 | |
|           </template>
 | |
|         </el-table-column>
 | |
|         <!-- 是否需要回执 -->
 | |
|         <el-table-column
 | |
|           prop="IsReturnRequired"
 | |
|           :label="$t('trials:emailManageCfg:title:isReturnRequired')"
 | |
|           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="IsAutoSend"
 | |
|           :label="$t('trials:emailManageCfg:title:isAutoSend')"
 | |
|           show-overflow-tooltip
 | |
|           sortable="custom"
 | |
|           width="160"
 | |
|         >
 | |
|           <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="IsEnable"
 | |
|           :label="$t('trials:emailManageCfg:table:IsEnable')"
 | |
|           show-overflow-tooltip
 | |
|           sortable="custom"
 | |
|           width="160"
 | |
|         >
 | |
|           <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="$t('trials:emailManageCfg:title:updateTime')"
 | |
|           show-overflow-tooltip
 | |
|           sortable="custom"
 | |
|           width="160"
 | |
|         />
 | |
|         <!-- 创建时间 -->
 | |
|         <el-table-column
 | |
|           prop="CreateTime"
 | |
|           :label="$t('trials:emailManageCfg:title:createTime')"
 | |
|           show-overflow-tooltip
 | |
|           sortable="custom"
 | |
|           width="160"
 | |
|         />
 | |
| 
 | |
|         <el-table-column v-if="hasPermi(['trials:trials-panel:setting:email-manage:edit'])" width="120" :label="$t('common:action:action')" fixed="right">
 | |
|           <template slot-scope="scope">
 | |
|             <!-- 编辑 -->
 | |
|             <el-button
 | |
|               icon="el-icon-edit-outline"
 | |
|               circle
 | |
|               :disabled="isEdit"
 | |
|               :title="$t('common:button:edit')"
 | |
|               @click="handleEdit(scope.row)"
 | |
|             />
 | |
|             <!-- 编辑 -->
 | |
|             <el-button
 | |
|               icon="el-icon-delete"
 | |
|               circle
 | |
|               :disabled="isEdit"
 | |
|               :title="$t('common:button:delete')"
 | |
|               @click="deleteTrialEmailNoticeConfig(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"
 | |
|         fullscreen
 | |
|         custom-class="base-dialog-wrapper"
 | |
|       >
 | |
|         <EmailForm
 | |
|           :data="currentRow"
 | |
|           :criterion-type="criterionType"
 | |
|           :is-distinguish-criteria="isDistinguishCriteria"
 | |
|           @closeDialog="closeDialog"
 | |
|           @getList="getList"
 | |
|         />
 | |
|       </el-dialog>
 | |
|       <!-- 新增默认问题 -->
 | |
|       <el-dialog
 | |
|         v-if="addVisible"
 | |
|         :visible.sync="addVisible"
 | |
|         width="1200px"
 | |
|         :close-on-click-modal="false"
 | |
|         custom-class="base-dialog-wrapper"
 | |
|         :title="'邮件模版'"
 | |
|       >
 | |
|         <div class="base-dialog-body">
 | |
|           <DefaultQS @getList="getList" @close="addVisible = false" />
 | |
|         </div>
 | |
|       </el-dialog>
 | |
|     </template>
 | |
|   </BaseContainer>
 | |
| </template>
 | |
| <script>
 | |
| import { getTrialEmailNoticeConfigList } from '@/api/trials'
 | |
| import { deleteTrialEmailNoticeConfig } from '@/api/dictionary'
 | |
| import { getTrialCriterionList } from '@/api/trials/reading'
 | |
| import BaseContainer from '@/components/BaseContainer'
 | |
| import EmailForm from './EmailForm'
 | |
| import DefaultQS from './DefaultQS'
 | |
| const searchDataDefault = () => {
 | |
|   return {
 | |
|     BusinessScenarioEnum: null,
 | |
|     CriterionTypeEnum: null,
 | |
|     TrialReadingCriterionId: null
 | |
|   }
 | |
| }
 | |
| export default {
 | |
|   name: 'EmailList',
 | |
|   components: { BaseContainer, EmailForm, DefaultQS },
 | |
|   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: [],
 | |
|       criterionType: null,
 | |
|       addVisible: false
 | |
|     }
 | |
|   },
 | |
|   watch: {
 | |
|     list() {
 | |
|       this.$nextTick(() => {
 | |
|         this.$refs.emailList.doLayout()
 | |
|       })
 | |
|     }
 | |
|   },
 | |
|   mounted() {
 | |
|     this.trialId = this.$route.query.trialId
 | |
|     this.getList()
 | |
|     this.getTrialCriterionList()
 | |
|   },
 | |
|   methods: {
 | |
|     handleAddDefault() {
 | |
|       this.addVisible = true
 | |
|     },
 | |
|     deleteTrialEmailNoticeConfig(row) {
 | |
|       this.$confirm(this.$t('trials:emailManageCfg:message:msg2')).then(() => {
 | |
|         deleteTrialEmailNoticeConfig(row.Id).then(res => {
 | |
|           this.$message.success(this.$t('common:message:deletedSuccessfully'))
 | |
|           this.getList()
 | |
|         })
 | |
|       })
 | |
|     },
 | |
|     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 = this.isDistinguishCriteria
 | |
|       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.$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>
 |