系统通知功能优化
parent
05e9bbb050
commit
3907123c1d
|
|
@ -128,7 +128,14 @@ const actions = {
|
||||||
if (response.IsSuccess) {
|
if (response.IsSuccess) {
|
||||||
var noticeList = []
|
var noticeList = []
|
||||||
response.Result.forEach(el => {
|
response.Result.forEach(el => {
|
||||||
noticeList.push({ Id: el.Id, Content: el.NoticeContent, NoticeTypeEnum: el.NoticeTypeEnum })
|
noticeList.push({
|
||||||
|
Id: el.Id,
|
||||||
|
Content: el.NoticeContent,
|
||||||
|
NoticeTypeEnum: el.NoticeTypeEnum,
|
||||||
|
PublishedTime: el.PublishedTime,
|
||||||
|
FileName: el.FileName,
|
||||||
|
Path: el.Path
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
commit('SET_NOTICE', noticeList)
|
commit('SET_NOTICE', noticeList)
|
||||||
|
|
|
||||||
|
|
@ -4,30 +4,38 @@
|
||||||
<el-form ref="NoticeForm" :model="form" :rules="rules" label-width="180px" size="small">
|
<el-form ref="NoticeForm" :model="form" :rules="rules" label-width="180px" size="small">
|
||||||
<el-form-item :label="$t('system:notice:label:NoticeLevel')" prop="NoticeLevelEnum">
|
<el-form-item :label="$t('system:notice:label:NoticeLevel')" prop="NoticeLevelEnum">
|
||||||
<el-select v-model="form.NoticeLevelEnum" clearable size="small">
|
<el-select v-model="form.NoticeLevelEnum" clearable size="small">
|
||||||
<el-option v-for="item of dict.type.NoteLevel" :key="item.value" :label="item.label"
|
<el-option v-for="item of $d.NoteLevel" :key="item.value" :label="item.label"
|
||||||
:value="item.raw.Code * 1" />
|
:value="item.raw.Code * 1" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('system:notice:label:NoticeType')" prop="NoticeTypeEnum">
|
<el-form-item :label="$t('system:notice:label:NoticeType')" prop="NoticeTypeEnum">
|
||||||
<el-select v-model="form.NoticeTypeEnum" clearable size="small">
|
<el-select v-model="form.NoticeTypeEnum" clearable size="small">
|
||||||
<el-option v-for="item of dict.type.NoteType" :key="item.value" :label="item.label"
|
<el-option v-for="item of $d.NoteType" :key="item.value" :label="item.label"
|
||||||
:value="item.raw.Code * 1" />
|
:value="item.raw.Code * 1" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('system:notice:label:ApplicableProject')" prop="ApplicableProjectEnum">
|
<el-form-item :label="$t('system:notice:label:ApplicableProject')" prop="ApplicableProjectEnum">
|
||||||
<el-select v-model="form.ApplicableProjectEnum" clearable size="small">
|
<el-select v-model="form.ApplicableProjectEnum" clearable size="small">
|
||||||
<el-option v-for="item of dict.type.NoticeApplicableTrial" :key="item.value" :label="item.label"
|
<el-option v-for="item of $d.NoticeApplicableTrial" :key="item.value" :label="item.label"
|
||||||
:value="item.raw.Code * 1" />
|
:value="item.raw.Code * 1" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('system:notice:label:NoticeUserTypeIdList')" prop="NoticeUserTypeIdList">
|
<el-form-item :label="$t('system:notice:label:NoticeUserTypeIdList')" prop="NoticeUserTypeIdList">
|
||||||
<el-select v-model="form.NoticeUserTypeIdList" multiple clearable size="small">
|
<div class="role-checkbox-group">
|
||||||
<el-option v-for="item of roleList" :key="item.Id" :label="item.UserTypeShortName" :value="item.Id" />
|
<div class="role-checkbox-actions">
|
||||||
</el-select>
|
<el-button size="small" type="text" @click="handleSelectAllRoles">全选</el-button>
|
||||||
|
<el-button size="small" type="text" @click="handleClearRoles">清空</el-button>
|
||||||
|
</div>
|
||||||
|
<el-checkbox-group v-model="form.NoticeUserTypeIdList" class="role-checkbox-list">
|
||||||
|
<el-checkbox v-for="item of roleList" :key="item.Id" :label="item.Id">
|
||||||
|
{{ item.UserTypeShortName }}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('system:notice:label:NoticeMode')" prop="NoticeModeEnum">
|
<el-form-item :label="$t('system:notice:label:NoticeMode')" prop="NoticeModeEnum">
|
||||||
<el-select v-model="form.NoticeModeEnum" clearable size="small">
|
<el-select v-model="form.NoticeModeEnum" clearable size="small">
|
||||||
<el-option v-for="item of dict.type.NoticeMode" :key="item.value" :label="item.label"
|
<el-option v-for="item of $d.NoticeMode" :key="item.value" :label="item.label"
|
||||||
:value="item.raw.Code * 1" />
|
:value="item.raw.Code * 1" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -35,13 +43,14 @@
|
||||||
<el-date-picker v-model="form.StartDate" type="datetime" />
|
<el-date-picker v-model="form.StartDate" type="datetime" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('system:notice:label:EndDate')" prop="EndDate">
|
<el-form-item :label="$t('system:notice:label:EndDate')" prop="EndDate">
|
||||||
<el-date-picker v-model="form.EndDate" type="datetime" :default-time="'23:59:59'" />
|
<el-date-picker v-model="form.EndDate" type="datetime" :default-time="'23:59:59'"
|
||||||
|
@change="handleEndDateChange" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!form.Id" :label="$t('system:notice:label:IsPush')" prop="IsPush">
|
<el-form-item v-if="!form.Id" :label="$t('system:notice:label:IsPush')" prop="IsPush">
|
||||||
<el-switch v-model="form.IsPush" :active-value="true" :inactive-value="false" />
|
<el-switch v-model="form.IsPush" :active-value="true" :inactive-value="false" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('system:notice:label:NoticeContent')" prop="NoticeContent">
|
<el-form-item :label="$t('system:notice:label:NoticeContent')" prop="NoticeContent">
|
||||||
<el-input v-model="form.NoticeContent" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" />
|
<el-input v-model="form.NoticeContent" type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('system:notice:label:file')">
|
<el-form-item :label="$t('system:notice:label:file')">
|
||||||
<el-upload class="upload-demo" action :before-upload="beforeUpload" :http-request="handleUploadFile"
|
<el-upload class="upload-demo" action :before-upload="beforeUpload" :http-request="handleUploadFile"
|
||||||
|
|
@ -106,12 +115,44 @@ export default {
|
||||||
NoticeUserTypeIdList: [{ required: true, message: 'Please specify', trigger: 'blur' }]
|
NoticeUserTypeIdList: [{ required: true, message: 'Please specify', trigger: 'blur' }]
|
||||||
},
|
},
|
||||||
fileList: [],
|
fileList: [],
|
||||||
model_cfg: { visible: false, showClose: true, width: '600px', title: '', appendToBody: true }
|
model_cfg: {
|
||||||
|
visible: false,
|
||||||
|
showClose: true,
|
||||||
|
width: '800px',
|
||||||
|
title: '',
|
||||||
|
appendToBody: true,
|
||||||
|
bodyStyle: {
|
||||||
|
maxHeight: '60vh',
|
||||||
|
overflowY: 'auto'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleSelectAllRoles() {
|
||||||
|
this.form.NoticeUserTypeIdList = this.roleList.map(item => item.Id)
|
||||||
|
},
|
||||||
|
handleClearRoles() {
|
||||||
|
this.form.NoticeUserTypeIdList = []
|
||||||
|
},
|
||||||
|
handleEndDateChange(value) {
|
||||||
|
this.form.EndDate = this.normalizeEndDate(value)
|
||||||
|
},
|
||||||
|
normalizeEndDate(value) {
|
||||||
|
if (!value) {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
const date = new Date(value)
|
||||||
|
if (Number.isNaN(date.getTime())) {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
if (date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0) {
|
||||||
|
date.setHours(23, 59, 59, 0)
|
||||||
|
}
|
||||||
|
return date
|
||||||
|
},
|
||||||
handleRemoveFile() {
|
handleRemoveFile() {
|
||||||
this.form.FileName = null
|
this.form.FileName = null
|
||||||
this.form.Path = null
|
this.form.Path = null
|
||||||
|
|
@ -147,6 +188,7 @@ export default {
|
||||||
this.fileList[0] = { name: this.form.FileName, path: this.form.FilePath, fullPath: this.form.FullFilePath }
|
this.fileList[0] = { name: this.form.FileName, path: this.form.FilePath, fullPath: this.form.FullFilePath }
|
||||||
}
|
}
|
||||||
this.$set(this.form, 'NoticeUserTypeIdList', this.form.NoticeUserTypeList.map(v => v.Id))
|
this.$set(this.form, 'NoticeUserTypeIdList', this.form.NoticeUserTypeList.map(v => v.Id))
|
||||||
|
this.form.EndDate = this.normalizeEndDate(this.form.EndDate)
|
||||||
} else {
|
} else {
|
||||||
this.form = formDataDefault()
|
this.form = formDataDefault()
|
||||||
}
|
}
|
||||||
|
|
@ -177,3 +219,27 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.role-checkbox-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-checkbox-actions {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-checkbox-actions .el-button + .el-button {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-checkbox-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-checkbox-list .el-checkbox {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,21 @@
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">{{ $t('common:button:add') }}</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">{{ $t('common:button:add') }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table v-loading="loading" v-adaptive="{bottomOffset:45}" height="100" :data="list" class="table">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
v-adaptive="{bottomOffset:45}"
|
||||||
|
height="100"
|
||||||
|
:data="list"
|
||||||
|
class="table"
|
||||||
|
@sort-change="handleSortChange"
|
||||||
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column :label="$t('system:notice:table:NoticeLevel')" prop="NoticeLevelEnum" min-width="120" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:NoticeLevel')" prop="NoticeLevelEnum" min-width="120" show-overflow-tooltip sortable="custom">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ $d.NoteLevel.find(v => {return v.raw.Code * 1 === scope.row.NoticeLevelEnum}) ? $d.NoteLevel.find(v => {return v.raw.Code * 1 === scope.row.NoticeLevelEnum}).label : '' }}
|
{{ $d.NoteLevel.find(v => {return v.raw.Code * 1 === scope.row.NoticeLevelEnum}) ? $d.NoteLevel.find(v => {return v.raw.Code * 1 === scope.row.NoticeLevelEnum}).label : '' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:NoticeType')" prop="NoticeTypeEnum" min-width="100" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:NoticeType')" prop="NoticeTypeEnum" min-width="100" show-overflow-tooltip sortable="custom">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ $d.NoteType.find(v => {return v.raw.Code * 1 === scope.row.NoticeTypeEnum}) ? $d.NoteType.find(v => {return v.raw.Code * 1 === scope.row.NoticeTypeEnum}).label : '' }}
|
{{ $d.NoteType.find(v => {return v.raw.Code * 1 === scope.row.NoticeTypeEnum}) ? $d.NoteType.find(v => {return v.raw.Code * 1 === scope.row.NoticeTypeEnum}).label : '' }}
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -74,46 +81,47 @@
|
||||||
{{ scope.row.NoticeContent }}
|
{{ scope.row.NoticeContent }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:NoticeState')" prop="NoticeStateEnum" min-width="100" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:NoticeState')" prop="NoticeStateEnum" min-width="100" show-overflow-tooltip sortable="custom">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="scope.row.ActualNoticeStateEnum === 0 ? 'info' : scope.row.ActualNoticeStateEnum === 1 ? 'success' : 'danger'">
|
<el-tag :type="scope.row.ActualNoticeStateEnum === 0 ? 'info' : scope.row.ActualNoticeStateEnum === 1 ? 'success' : 'danger'">
|
||||||
{{ $d.NoticeState.find(v => {return v.raw.Code * 1 === scope.row.ActualNoticeStateEnum}) ? $d.NoticeState.find(v => {return v.raw.Code * 1 === scope.row.ActualNoticeStateEnum}).label : '' }}
|
{{ $d.NoticeState.find(v => {return v.raw.Code * 1 === scope.row.ActualNoticeStateEnum}) ? $d.NoticeState.find(v => {return v.raw.Code * 1 === scope.row.ActualNoticeStateEnum}).label : '' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:ApplicableProject')" prop="ApplicableProjectEnum" min-width="100" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:ApplicableProject')" prop="ApplicableProjectEnum" min-width="100" show-overflow-tooltip sortable="custom">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ $d.NoticeApplicableTrial.find(v => {return v.raw.Code * 1 === scope.row.ApplicableProjectEnum}) ? $d.NoticeApplicableTrial.find(v => {return v.raw.Code * 1 === scope.row.ApplicableProjectEnum}).label : '' }}
|
{{ $d.NoticeApplicableTrial.find(v => {return v.raw.Code * 1 === scope.row.ApplicableProjectEnum}) ? $d.NoticeApplicableTrial.find(v => {return v.raw.Code * 1 === scope.row.ApplicableProjectEnum}).label : '' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:NoticeUserTypeList')" prop="NoticeUserTypeList" min-width="80" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:NoticeUserTypeList')" prop="NoticeUserTypeList" min-width="100" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.NoticeUserTypeList.map(v => v.UserTypeShortName).toString() }}
|
{{ scope.row.NoticeUserTypeList.map(v => v.UserTypeShortName).toString() }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:NoticeMode')" prop="NoticeModeEnum" min-width="100" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:NoticeMode')" prop="NoticeModeEnum" min-width="100" show-overflow-tooltip sortable="custom">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ dict.type.NoticeMode.find(v => {return v.raw.Code * 1 === scope.row.NoticeModeEnum}) ? $d.NoticeMode.find(v => {return v.raw.Code * 1 === scope.row.NoticeModeEnum}).label : '' }}
|
{{ dict.type.NoticeMode.find(v => {return v.raw.Code * 1 === scope.row.NoticeModeEnum}) ? $d.NoticeMode.find(v => {return v.raw.Code * 1 === scope.row.NoticeModeEnum}).label : '' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:StartDate')" prop="StartDate" min-width="240" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:StartDate')" prop="StartDate" min-width="160" show-overflow-tooltip sortable="custom">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.StartDate }}-{{ scope.row.EndDate }}
|
{{ scope.row.StartDate }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:PublishUserName')" prop="PublishUserName" min-width="100" show-overflow-tooltip />
|
<el-table-column :label="$t('system:notice:table:UpdateTime')" prop="EndDate" min-width="160" show-overflow-tooltip sortable="custom">
|
||||||
<el-table-column :label="$t('system:notice:table:PublishedTime')" prop="PublishedTime" min-width="160" show-overflow-tooltip />
|
|
||||||
<el-table-column :label="$t('system:notice:table:UpdateTime')" prop="UpdateTime" min-width="160" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.StartDate ? scope.row.StartDate: scope.row.CreateTime }}
|
{{ scope.row.EndDate }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('system:notice:table:FileName')" fixed="right" prop="FileName" min-width="120" show-overflow-tooltip>
|
<el-table-column :label="$t('system:notice:table:PublishUserName')" prop="PublishUserName" min-width="100" show-overflow-tooltip sortable="custom"/>
|
||||||
|
<el-table-column :label="$t('system:notice:table:PublishedTime')" prop="PublishedTime" min-width="160" show-overflow-tooltip sortable="custom"/>
|
||||||
|
|
||||||
|
<el-table-column :label="$t('system:notice:table:FileName')" fixed="right" prop="FileName" min-width="120" show-overflow-tooltip sortable="custom">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<a :href="OSSclientConfig.basePath + scope.row.FullFilePath" target="_blank" style="color:#428bca">{{ scope.row.FileName }}</a>
|
<a :href="OSSclientConfig.basePath + scope.row.FullFilePath" target="_blank" style="color:#428bca">{{ scope.row.FileName }}</a>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('common:action:action')" fixed="right" prop="UserTypeShortName" min-width="200" show-overflow-tooltip>
|
<el-table-column :label="$t('common:action:action')" fixed="right" prop="UserTypeShortName" min-width="120" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
|
|
@ -236,6 +244,17 @@ export default {
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loading = false
|
this.loading = 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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
class="notice-detail-dialog"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:title="title"
|
||||||
|
width="700px"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@closed="handleClosed"
|
||||||
|
>
|
||||||
|
<div class="notice-detail-dialog__body">
|
||||||
|
<div v-if="publishedTime" class="notice-detail-dialog__meta">
|
||||||
|
<span class="notice-detail-dialog__time">{{ publishedTime }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="notice-detail-dialog__content">
|
||||||
|
{{ content || '-' }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="filePath" class="notice-detail-dialog__attachment">
|
||||||
|
<div class="notice-detail-dialog__attachment-label">{{ $t('trials:notice:table:appendix') }}</div>
|
||||||
|
<div class="notice-detail-dialog__attachment-card">
|
||||||
|
<i class="el-icon-paperclip" />
|
||||||
|
<el-button size="small" type="text" @click="$emit('open-file', filePath)">
|
||||||
|
{{ fileName}}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span slot="footer" class="notice-detail-dialog__footer">
|
||||||
|
<el-button size="small" @click="handleClose">{{ $t('common:button:close') }}</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="showConfirmButton"
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
:loading="confirmLoading"
|
||||||
|
@click="$emit('confirm')"
|
||||||
|
>
|
||||||
|
{{ $t('common:button:confirm') }}
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'NoticeDetailDialog',
|
||||||
|
props: {
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
publishedTime: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
fileName: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
filePath: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
showConfirmButton: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
confirmLoading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dialogVisible: {
|
||||||
|
get() {
|
||||||
|
return this.visible
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$emit('update:visible', value)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClose() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
},
|
||||||
|
handleClosed() {
|
||||||
|
this.$emit('closed')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.notice-detail-dialog {
|
||||||
|
::v-deep .el-dialog__header {
|
||||||
|
padding: 18px 20px 10px;
|
||||||
|
border-bottom: 1px solid #ebeef5;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-dialog__body {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-dialog__footer {
|
||||||
|
padding: 12px 20px 18px;
|
||||||
|
border-top: 1px solid #ebeef5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__body {
|
||||||
|
max-height: 70vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 18px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__meta {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__content {
|
||||||
|
padding: 14px 16px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #f8f9fb;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__attachment {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__attachment-label {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
color: #606266;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__attachment-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__attachment-card .el-icon-paperclip {
|
||||||
|
margin-right: 8px;
|
||||||
|
color: #409eff;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-dialog__attachment-name {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
margin-right: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -7,16 +7,45 @@
|
||||||
{{ item.Content }}
|
{{ item.Content }}
|
||||||
</span>
|
</span>
|
||||||
</marquee>
|
</marquee>
|
||||||
|
<notice-detail-dialog
|
||||||
|
:visible.sync="detailDialog.visible"
|
||||||
|
:title="detailDialog.title"
|
||||||
|
:content="detailDialog.content"
|
||||||
|
:published-time="detailDialog.publishedTime"
|
||||||
|
:file-name="detailDialog.fileName"
|
||||||
|
:file-path="detailDialog.filePath"
|
||||||
|
:show-confirm-button="detailDialog.showConfirmButton"
|
||||||
|
:confirm-loading="detailDialog.confirmLoading"
|
||||||
|
@confirm="handleDetailConfirm"
|
||||||
|
@open-file="downLoadFile"
|
||||||
|
@closed="handleDetailClosed"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { setSystemNoticeHaveRead } from '@/api/global'
|
import { setSystemNoticeHaveRead } from '@/api/global'
|
||||||
import { getBasicDataSelects } from '@/api/dictionary/dictionary'
|
import { getBasicDataSelects } from '@/api/dictionary/dictionary'
|
||||||
|
import NoticeDetailDialog from '@/views/trials/components/NoticeDetailDialog'
|
||||||
|
const detailDialogDefault = () => {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
title: '',
|
||||||
|
content: '',
|
||||||
|
publishedTime: '',
|
||||||
|
fileName: '',
|
||||||
|
filePath: '',
|
||||||
|
showConfirmButton: false,
|
||||||
|
confirmLoading: false,
|
||||||
|
noticeId: null
|
||||||
|
}
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'NoticeMarquee',
|
name: 'NoticeMarquee',
|
||||||
|
components: { NoticeDetailDialog },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
noteType: []
|
noteType: [],
|
||||||
|
detailDialog: detailDialogDefault()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -40,25 +69,41 @@ export default {
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
currentNoticeType = this.noteType[i].Value
|
currentNoticeType = this.noteType[i].Value
|
||||||
}
|
}
|
||||||
const h = this.$createElement
|
this.detailDialog = {
|
||||||
this.$msgbox({
|
visible: true,
|
||||||
title: currentNoticeType,
|
title: currentNoticeType,
|
||||||
message: h('span', null, item.Content),
|
content: item.Content || '',
|
||||||
beforeClose: (action, instance, done) => {
|
publishedTime: item.PublishedTime || '',
|
||||||
if (action === 'confirm') {
|
fileName: item.FileName || '',
|
||||||
instance.confirmButtonLoading = true
|
filePath: item.Path || '',
|
||||||
setSystemNoticeHaveRead(item.Id).then(async res => {
|
showConfirmButton: true,
|
||||||
if (res.IsSuccess) {
|
confirmLoading: false,
|
||||||
await this.$store.dispatch('global/getNoticeList')
|
noticeId: item.Id
|
||||||
}
|
}
|
||||||
instance.confirmButtonLoading = false
|
},
|
||||||
done()
|
async handleDetailConfirm() {
|
||||||
}).catch(() => { instance.confirmButtonLoading = false })
|
if (!this.detailDialog.noticeId) {
|
||||||
} else {
|
return
|
||||||
done()
|
}
|
||||||
}
|
this.detailDialog.confirmLoading = true
|
||||||
|
try {
|
||||||
|
const res = await setSystemNoticeHaveRead(this.detailDialog.noticeId)
|
||||||
|
if (res.IsSuccess) {
|
||||||
|
await this.$store.dispatch('global/getNoticeList')
|
||||||
|
this.detailDialog.visible = false
|
||||||
}
|
}
|
||||||
})
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
} finally {
|
||||||
|
this.detailDialog.confirmLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDetailClosed() {
|
||||||
|
this.detailDialog = detailDialogDefault()
|
||||||
|
},
|
||||||
|
downLoadFile(filePath) {
|
||||||
|
if (!filePath) return
|
||||||
|
window.open(this.OSSclientConfig.basePath + filePath, '_blank')
|
||||||
},
|
},
|
||||||
getDicData() {
|
getDicData() {
|
||||||
getBasicDataSelects(['NoteType']).then(res => {
|
getBasicDataSelects(['NoteType']).then(res => {
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,19 @@
|
||||||
:limit.sync="searchData.PageSize"
|
:limit.sync="searchData.PageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
<notice-detail-dialog
|
||||||
|
:visible.sync="detailDialog.visible"
|
||||||
|
:title="detailDialog.title"
|
||||||
|
:content="detailDialog.content"
|
||||||
|
:published-time="detailDialog.publishedTime"
|
||||||
|
:file-name="detailDialog.fileName"
|
||||||
|
:file-path="detailDialog.filePath"
|
||||||
|
:show-confirm-button="detailDialog.showConfirmButton"
|
||||||
|
:confirm-loading="detailDialog.confirmLoading"
|
||||||
|
@confirm="handleDetailConfirm"
|
||||||
|
@open-file="downLoadFile"
|
||||||
|
@closed="handleDetailClosed"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</BaseContainer>
|
</BaseContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -179,6 +192,7 @@
|
||||||
import { getUserSystemNoticeList, setSystemNoticeHaveRead } from '@/api/global'
|
import { getUserSystemNoticeList, setSystemNoticeHaveRead } from '@/api/global'
|
||||||
import BaseContainer from '@/components/BaseContainer'
|
import BaseContainer from '@/components/BaseContainer'
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
|
import NoticeDetailDialog from '@/views/trials/components/NoticeDetailDialog'
|
||||||
const searchDataDefault = () => {
|
const searchDataDefault = () => {
|
||||||
return {
|
return {
|
||||||
NoticeContent: '',
|
NoticeContent: '',
|
||||||
|
|
@ -193,9 +207,22 @@ const searchDataDefault = () => {
|
||||||
PageSize: 20,
|
PageSize: 20,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const detailDialogDefault = () => {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
title: '',
|
||||||
|
content: '',
|
||||||
|
publishedTime: '',
|
||||||
|
fileName: '',
|
||||||
|
filePath: '',
|
||||||
|
showConfirmButton: false,
|
||||||
|
confirmLoading: false,
|
||||||
|
noticeId: null,
|
||||||
|
}
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'TrialsNotice',
|
name: 'TrialsNotice',
|
||||||
components: { BaseContainer, Pagination },
|
components: { BaseContainer, Pagination, NoticeDetailDialog },
|
||||||
dicts: ['NoteType', 'NoticeState', 'NoticeMode'],
|
dicts: ['NoteType', 'NoticeState', 'NoticeMode'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -203,6 +230,7 @@ export default {
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
detailDialog: detailDialogDefault(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -222,38 +250,39 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showDetail(row) {
|
showDetail(row) {
|
||||||
var currentNoticeType = this.$fd('NoteType', row.NoticeTypeEnum)
|
this.detailDialog = {
|
||||||
if (row.IsRead || row.ActualNoticeStateEnum !== 1) {
|
visible: true,
|
||||||
this.$alert(row.NoticeContent, currentNoticeType, {
|
title: this.$fd('NoteType', row.NoticeTypeEnum),
|
||||||
showConfirmButton: false,
|
content: row.NoticeContent || '',
|
||||||
})
|
publishedTime: row.PublishedTime || '',
|
||||||
} else {
|
fileName: row.FileName || '',
|
||||||
const h = this.$createElement
|
filePath: row.Path || '',
|
||||||
this.$msgbox({
|
showConfirmButton: !row.IsRead && row.ActualNoticeStateEnum === 1,
|
||||||
title: currentNoticeType,
|
confirmLoading: false,
|
||||||
message: h('span', null, row.NoticeContent),
|
noticeId: row.Id
|
||||||
beforeClose: (action, instance, done) => {
|
|
||||||
if (action === 'confirm') {
|
|
||||||
instance.confirmButtonLoading = true
|
|
||||||
setSystemNoticeHaveRead(row.Id)
|
|
||||||
.then(async (res) => {
|
|
||||||
if (res.IsSuccess) {
|
|
||||||
await this.$store.dispatch('global/getNoticeList')
|
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
instance.confirmButtonLoading = false
|
|
||||||
done()
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
instance.confirmButtonLoading = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
done()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async handleDetailConfirm() {
|
||||||
|
if (!this.detailDialog.noticeId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.detailDialog.confirmLoading = true
|
||||||
|
try {
|
||||||
|
const res = await setSystemNoticeHaveRead(this.detailDialog.noticeId)
|
||||||
|
if (res.IsSuccess) {
|
||||||
|
await this.$store.dispatch('global/getNoticeList')
|
||||||
|
this.detailDialog.visible = false
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
} finally {
|
||||||
|
this.detailDialog.confirmLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDetailClosed() {
|
||||||
|
this.detailDialog = detailDialogDefault()
|
||||||
|
},
|
||||||
downLoadFile(filePath) {
|
downLoadFile(filePath) {
|
||||||
if (!filePath) return
|
if (!filePath) return
|
||||||
window.open(this.OSSclientConfig.basePath + filePath, '_blank')
|
window.open(this.OSSclientConfig.basePath + filePath, '_blank')
|
||||||
|
|
@ -281,4 +310,9 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.notice-content-text {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue