Compare commits

...

8 Commits

  1. 10
      src/api/system/dept/index.ts
  2. 7
      src/api/system/dict/dict.data.ts
  3. 25
      src/api/system/notify/message/index.ts
  4. 25
      src/api/system/role/daliyReport.js
  5. 28
      src/layout/components/Message/src/Message.vue
  6. 1
      src/permission.js
  7. 10
      src/router/modules/remaining.ts
  8. 7
      src/store/modules/user.ts
  9. 177
      src/views/Basic/Dept/DeptForm.vue
  10. 133
      src/views/Basic/Dept/DialogTarget.vue
  11. 17
      src/views/Basic/Dept/index.vue
  12. 95
      src/views/Basic/Role/Comp/ReportDaily.vue
  13. 191
      src/views/Profile/NotifyMessage.vue
  14. 65
      src/views/Profile/NotifyMessageDetail.vue

@ -41,3 +41,13 @@ export const updateDept = async (params: DeptVO) => {
export const deleteDept = async (id: number) => {
return await request.delete({ url: '/admin-api/system/dept/delete?id=' + id })
}
// 获取部门业务指标
export const getDeptTarget = async (deptId: number) => {
return await request.get({ url: '/admin-api/crm/dept-target/get', params: { deptId } })
}
// 更新部门业务指标
export const updateDeptTarget = async (data: any) => {
return await request.put({ url: '/admin-api/crm/dept-target/save', data, isSubmitForm: true })
}

@ -44,6 +44,11 @@ export const deleteDictData = (id: number) => {
}
// 导出字典类型数据
export const exportDictData = (params) => {
export const exportDictData = (params: any) => {
return request.get({ url: '/admin-api/crm/dict-data/export', params })
}
// 获取通用字典数据
export const getGeneralSysDictData = (dictType: string) => {
return request.get({ url: '/admin-api/system/dict-data/get-by-type', params: { dictType } })
}

@ -1,5 +1,4 @@
import request from '@/config/axios'
import qs from 'qs'
export interface NotifyMessageVO {
id: number
@ -26,25 +25,29 @@ export const getMyNotifyMessagePage = async (params: PageParam) => {
}
// 批量标记已读
export const updateNotifyMessageRead = async (ids) => {
export const updateNotifyMessageRead = async (data: any) => {
return await request.put({
url:
'/admin-api/system/notify-message/update-read?' +
qs.stringify({ ids: ids }, { indices: false })
url: '/admin-api/system/notify-message/update-read?',
data
})
}
// 标记所有站内信为已读
export const updateAllNotifyMessageRead = async () => {
return await request.put({ url: '/admin-api/system/notify-message/update-all-read' })
export const updateAllNotifyMessageRead = async (data: any) => {
return await request.put({ url: '/admin-api/system/notify-message/update-all-read', data })
}
// 获取当前用户的最新站内信列表
export const getUnreadNotifyMessageList = async () => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-list' })
export const getUnreadNotifyMessageList = async (params: any) => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-list', params })
}
// 获得当前用户的未读站内信数量
export const getUnreadNotifyMessageCount = async () => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-count' })
export const getUnreadNotifyMessageCount = async (params: any) => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-count', params })
}
// 获取详情
export const getNotifyMessageDetail = async (id: number) => {
return await request.get({ url: '/admin-api/system/notify-message/get', params: { id } })
}

@ -0,0 +1,25 @@
import request from '@/config/axios'
// 获取角色快报配置
export const getRoleDaliyReport = async (roleId) => {
return await request.get({
url: '/admin-api/system/role-message-setting/get',
params: { roleId }
})
}
// 保存角色每日快报配置
export const updateRoleDaliyReport = async (data) => {
return await request.post({
url: '/admin-api/system/role-message-setting/save',
data,
isSubmitForm: true
})
}
// 获取每日快报发送内容
export const getDaliyReportContent = async () => {
return await request.get({
url: '/admin-api/system/message-item/list-all-simple'
})
}

@ -1,6 +1,9 @@
<script lang="ts" name="Message" setup>
import { formatDate } from '@/utils/formatTime'
import * as NotifyMessageApi from '@/api/system/notify/message'
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const { push } = useRouter()
const activeName = ref('notice')
@ -9,16 +12,21 @@ const list = ref<any[]>([]) // 消息列表
//
const getList = async () => {
list.value = await NotifyMessageApi.getUnreadNotifyMessageList()
const data = await NotifyMessageApi.getUnreadNotifyMessageList({
roleId: userStore.getUser?.currentRole
})
list.value = data.list
// unreadCount 0
unreadCount.value = 0
}
//
const getUnreadCount = async () => {
NotifyMessageApi.getUnreadNotifyMessageCount().then((data) => {
unreadCount.value = data
})
NotifyMessageApi.getUnreadNotifyMessageCount({ roleId: userStore.getUser?.currentRole }).then(
(data) => {
unreadCount.value = data
}
)
}
//
@ -34,9 +42,9 @@ onMounted(() => {
//
getUnreadCount()
//
// msgInterval.value = setInterval(() => {
// getUnreadCount()
// }, 1000 * 60 * 2)
msgInterval.value = setInterval(() => {
getUnreadCount()
}, 1000 * 60 * 2)
})
onUnmounted(() => {
@ -56,10 +64,9 @@ onUnmounted(() => {
<div class="message-list">
<template v-for="item in list" :key="item.id">
<div class="message-item">
<img alt="" class="message-icon" src="@/assets/imgs/avatar.gif" />
<div class="message-content">
<span class="message-title">
{{ item.templateNickname }}{{ item.templateContent }}
{{ item.title }}
</span>
<span class="message-date">
{{ formatDate(item.createTime) }}
@ -94,7 +101,7 @@ onUnmounted(() => {
.message-item {
display: flex;
align-items: center;
padding: 20px 0;
padding: 0;
border-bottom: 1px solid var(--el-border-color-light);
&:last-child {
@ -113,6 +120,7 @@ onUnmounted(() => {
.message-title {
margin-bottom: 5px;
font-weight: bold;
}
.message-date {

@ -17,6 +17,7 @@ const { loadStart, loadDone } = usePageLoading()
const whiteList = [
'/login',
'/mp-login',
'/nm-detail',
'/social-login',
'/auth-redirect',
'/bind',

@ -181,6 +181,16 @@ const remainingRouter: AppRouteRecordRaw[] = [
noTagsView: true
}
},
{
path: '/nm-detail',
component: () => import('@/views/Profile/NotifyMessageDetail.vue'),
name: 'NMDetail',
meta: {
hidden: true,
title: '通知详情',
noTagsView: true
}
},
{
path: '/403',
component: () => import('@/views/Error/403.vue'),

@ -9,6 +9,7 @@ interface UserVO {
id: number
avatar: string
nickname: string
currentRole: number
}
interface UserInfoVO {
permissions: string[]
@ -25,7 +26,8 @@ export const useUserStore = defineStore('admin-user', {
user: {
id: 0,
avatar: '',
nickname: ''
nickname: '',
currentRole: 0
}
}),
getters: {
@ -72,7 +74,8 @@ export const useUserStore = defineStore('admin-user', {
this.user = {
id: 0,
avatar: '',
nickname: ''
nickname: '',
currentRole: 0
}
},
refresh() {

@ -1,122 +1,69 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-tabs v-model="tabIndex">
<el-tab-pane label="基础信息" :name="1">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="80px"
>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="上级部门" prop="parentId">
<el-tree-select
v-model="formData.parentId"
:data="deptTree"
:props="defaultProps"
check-strictly
default-expand-all
placeholder="请选择上级部门"
value-key="deptId"
/>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="部门名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入部门名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="负责人" prop="leaderUserId">
<el-select v-model="formData.leaderUserId" clearable placeholder="请输入负责人">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio :label="0"> 启用 </el-radio>
<el-radio :label="1"> 禁用 </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24" :offset="0">
<el-form-item label="备注" prop="remark">
<Editor v-model:modelValue="formData.remark" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="业务指标" :name="2">
<el-form :model="formData" label-width="auto">
<el-form-item label="每日跟进指标数">
<el-input-number
v-model="formData.followDaliyNum"
:controls="false"
style="width: 150px"
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="80px"
>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="上级部门" prop="parentId">
<el-tree-select
v-model="formData.parentId"
:data="deptTree"
:props="defaultProps"
check-strictly
default-expand-all
placeholder="请选择上级部门"
value-key="deptId"
/>
</el-form-item>
<el-form-item label="跟进指标生效日期">
<el-date-picker
v-model="formData.effectDate"
type="date"
placeholder="选择日期时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 150px"
/>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="部门名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入部门名称" />
</el-form-item>
</el-form>
<el-divider direction="horizontal" content-position="left">成交额指标</el-divider>
<el-button class="mb-10px" type="primary" @click="taskList.push({})">添加年份</el-button>
<el-table :data="taskList" border>
<el-table-column label="年份" width="120">
<template #default="{ row }">
<el-date-picker
v-model="row.year"
type="year"
placeholder="选择年份"
size="small"
format="YYYY"
value-format="YYYY"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column v-for="col in 12" :key="col" :label="`${col}月`" width="100px">
<template #default="{ row }">
<el-input-number
v-model="row[`month${col}`]"
size="small"
:controls="false"
style="width: 100%"
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="负责人" prop="leaderUserId">
<el-select v-model="formData.leaderUserId" clearable placeholder="请输入负责人">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio :label="0"> 启用 </el-radio>
<el-radio :label="1"> 禁用 </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24" :offset="0">
<el-form-item label="备注" prop="remark">
<Editor v-model:modelValue="formData.remark" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
@ -135,8 +82,6 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const tabIndex = ref(1)
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
@ -232,6 +177,4 @@ const getTree = async () => {
dept.children = handleTree(data)
deptTree.value.push(dept)
}
const taskList = ref([])
</script>

@ -0,0 +1,133 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-form ref="formRef" :model="formData" label-width="130px">
<el-form-item label="每日跟进指标数">
<el-input-number v-model="formData.targetNum" :controls="false" style="width: 150px" />
</el-form-item>
<el-form-item label="跟进指标生效日期">
<el-date-picker
v-model="formData.startDate"
type="date"
placeholder="选择日期时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 150px"
/>
</el-form-item>
</el-form>
<el-divider direction="horizontal" content-position="left">成交额指标</el-divider>
<el-button class="mb-10px" type="primary" @click="handleAddPrice"> 添加年份 </el-button>
<el-table :data="formData.deptSignPriceTargetVOList" border>
<el-table-column label="年份" width="120">
<template #default="{ row }">
<el-date-picker
v-model="row.year"
type="year"
placeholder="选择年份"
size="small"
format="YYYY"
value-format="YYYY"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column v-for="col in 12" :key="col" :label="`${col}月`" width="100px">
<template #default="{ row }">
<el-input-number
v-model="row.monthTargetVOList[col - 1].targetPrice"
size="small"
:controls="false"
style="width: 100%"
/>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup name="DialogTarget">
import * as DeptApi from '@/api/system/dept'
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formData = ref({
remark: undefined
})
/** 打开弹窗 */
const open = async (deptId) => {
dialogVisible.value = true
dialogTitle.value = '业绩指标'
resetForm()
//
if (deptId) {
formLoading.value = true
try {
formData.value = await DeptApi.getDeptTarget(deptId)
formData.value.deptId = deptId
if (formData.value?.deptSignPriceTargetVOList) {
formData.value.deptSignPriceTargetVOList.forEach((it) => {
it.year = it.year + ''
})
}
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const formRef = ref() // Ref
const submitForm = async () => {
//
formLoading.value = true
try {
await DeptApi.updateDeptTarget(formData.value)
message.success('修改成功')
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
targetNum: undefined,
startDate: undefined,
deptSignPriceTargetVOList: []
}
formRef.value?.resetFields()
}
function handleAddPrice() {
const obj = {
year: undefined,
monthTargetVOList: []
}
for (let i = 1; i <= 12; i++) {
obj.monthTargetVOList.push({
month: i,
targetPrice: undefined
})
}
if (!formData.value.deptSignPriceTargetVOList) {
formData.value.deptSignPriceTargetVOList = []
}
formData.value.deptSignPriceTargetVOList.push(obj)
}
</script>
<style lang="scss" scoped></style>

@ -25,7 +25,7 @@
<el-table-column prop="sort" label="排序" width="200" />
<el-table-column prop="status" label="状态" width="100" />
<el-table-column label="创建时间" prop="createTime" width="180" :formatter="dateFormatter" />
<el-table-column label="操作" class-name="fixed-width" width="160">
<el-table-column label="操作" class-name="fixed-width" width="240">
<template #default="scope">
<el-button
link
@ -35,6 +35,14 @@
>
修改
</el-button>
<el-button
link
type="primary"
@click="openTarget(scope.row.id)"
v-hasPermi="['basic:dept:update']"
>
业绩指标
</el-button>
<el-button
link
type="danger"
@ -49,11 +57,13 @@
<!-- 表单弹窗添加/修改 -->
<DeptForm ref="formRef" @success="getList" />
<DialogTarget ref="targetDialogRef" @success="getList" />
</template>
<script setup lang="ts" name="SystemDept">
import { handleTree } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import DeptForm from './DeptForm.vue'
import DialogTarget from './DialogTarget.vue'
import { dateFormatter } from '@/utils/formatTime'
const message = useMessage() //
const { t } = useI18n() //
@ -93,6 +103,11 @@ const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
const targetDialogRef = ref()
const openTarget = (id: number) => {
targetDialogRef.value.open(id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {

@ -2,35 +2,36 @@
<div class="pl-20px pr-20px">
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto" v-loading="formLoading">
<el-form-item label="开启通知">
<el-radio-group v-model="form.kaiqitongzhi">
<el-radio-group v-model="form.status">
<el-radio :label="1"> 开启 </el-radio>
<el-radio :label="0"> 关闭 </el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="发送途径">
<el-checkbox-group v-model="form.fasongtujing">
<el-checkbox :label="1">系统通知</el-checkbox>
<el-checkbox :label="2">微信公众号</el-checkbox>
<el-checkbox-group v-model="form.sendType">
<el-checkbox v-for="(item, index) in sendTypeOptions" :key="index" :label="item.value">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="发送时间">
<el-time-picker
v-model="form.sendTime"
placeholder="任意时间点"
format="HH:mm:ss"
value-format="HH:mm:ss"
format="HH:mm"
value-format="HH:mm"
/>
</el-form-item>
<el-form-item label="发送内容">
<el-tree
ref="treeRef"
:data="contentOptions"
:props="defaultProps"
empty-text="加载中,请稍候"
node-key="value"
node-key="id"
show-checkbox
default-expand-all
:default-checked-keys="form.sendContent"
style="width: 100%"
/>
</el-form-item>
@ -42,7 +43,9 @@
</template>
<script setup name="ReportDaily">
import { handleTree } from '@/utils/tree'
import * as DaliyReportApi from '@/api/system/role/daliyReport'
import { defaultProps, handleTree } from '@/utils/tree'
import { getGeneralSysDictData } from '@/api/system/dict/dict.data'
const message = useMessage() //
const props = defineProps({
@ -53,9 +56,16 @@ const props = defineProps({
const formLoading = ref(false)
const form = ref({
checkedMenuIds: []
sendItem: []
})
watch(
() => props.roleId,
() => {
getReportInfo()
}
)
onMounted(() => {
init()
})
@ -71,43 +81,39 @@ async function init() {
getReportInfo()
}
const sendTypeOptions = ref([])
const treeRef = ref()
function getOptions() {
const arr = [
{
value: 1,
label: '销售快报',
children: [
{ value: 11, label: '今日跟进线索数', pId: 1 },
{ value: 12, label: '今日待跟进数', pId: 1 },
{ value: 13, label: '今日接受线索数', pId: 1 }
]
},
{
value: 2,
label: '管理快报',
children: [
{ value: 21, label: '当日业绩(成交数,成交额)', pId: 2 },
{ value: 22, label: '当月业绩(成交数,成交额)', pId: 2 },
{ value: 23, label: '本月业绩完成情况(数值,比例)', pId: 2 }
]
}
]
contentOptions.value = arr
handleTree(arr)
getGeneralSysDictData('message_send_type').then((data) => {
sendTypeOptions.value = data
})
DaliyReportApi.getDaliyReportContent().then((data) => {
contentOptions.value = handleTree(data)
})
}
async function getReportInfo() {
try {
formLoading.value = true
form.value = {
kaiqitongzhi: 1,
fasongtujing: [1, 2],
sendTime: '21:00:00',
sendContent: [21, 22, 23]
const data = await DaliyReportApi.getRoleDaliyReport(props.roleId)
form.value = { ...data }
if (!form.value.sendType) {
form.value.sendType = []
}
if (!form.value.sendTime) {
form.value.sendTime = '22:00'
}
if (!form.value.sendItem) {
form.value.sendItem = []
}
treeRef.value.setCheckedKeys([], false)
//
form.value.sendItem.forEach((menuId) => {
treeRef.value.setChecked(menuId, true, false)
})
formLoading.value = false
} catch (error) {
console.log(error)
@ -121,16 +127,19 @@ const submitForm = async () => {
formLoading.value = true
try {
const data = {
id: form.value.id,
roleId: props.roleId,
menuIds: [
sendType: form.value.sendType,
sendTime: form.value.sendTime,
status: form.value.status,
sendItem: [
...treeRef.value.getCheckedKeys(false), //
...treeRef.value.getHalfCheckedKeys() //
]
}
// await PermissionApi.assignRoleMenu(data)
console.log(data)
await DaliyReportApi.updateRoleDaliyReport(data)
message.success('保存成功')
getReportInfo()
} finally {
formLoading.value = false
}

@ -1,7 +1,192 @@
<template>
<div> 站内信 </div>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="0">
<el-form-item>
<el-select
v-model="queryParams.messageType"
placeholder="消息类型"
clearable
filterable
@change="handleQuery"
>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-select
v-model="queryParams.readStatus"
placeholder="状态"
clearable
filterable
@change="handleQuery"
>
<el-option label="已读" :value="true" />
<el-option label="未读" :value="false" />
</el-select>
</el-form-item>
<el-form-item>
<el-button :disabled="selectedIds.length == 0" @click="handleUpdateList">
标记已读
</el-button>
<el-button @click="handleUpdateAll"> 全部已读 </el-button>
</el-form-item>
</el-form>
<el-text class="mb-10px" type="danger">tips: 双击展示消息详情</el-text>
<!-- 列表 -->
<el-table
ref="tableRef"
v-loading="loading"
:data="list"
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleDetail"
>
<el-table-column type="selection" :selectable="selectable" reserve-selection width="60px" />
<el-table-column label="类型" align="left" prop="messageType" width="200px" />
<el-table-column label="标题" align="left" prop="title" />
<el-table-column
label="时间"
align="left"
prop="createTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="状态" align="left" width="100px">
<template #default="{ row }">
<el-tag :type="row.readStatus ? 'success' : 'info'">
{{ row.readStatus ? '已读' : '未读' }}
</el-tag>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</template>
<script lang="ts" setup name="NotifyMessage">
import { dateFormatter } from '@/utils/formatTime'
import * as NotifyMessageApi from '@/api/system/notify/message'
import { useUserStore } from '@/store/modules/user'
import { getGeneralSysDictData } from '@/api/system/dict/dict.data'
const router = useRouter()
const userStore = useUserStore()
const message = useMessage() //
const loading = ref(true) //
const total = ref(0) //
const list = ref<any[]>([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 20,
messageType: undefined,
readStatus: undefined
})
const queryFormRef = ref() //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await NotifyMessageApi.getNotifyMessagePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 某一行,是否允许选中 */
const selectable = (row: any) => {
return !row.readStatus
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
function handleDetail(row: any) {
if (!row.readStatus) {
handleReadOne(row.id)
}
const url = router.resolve({
path: '/nm-detail',
query: { id: row.id }
})
window.open(url.href, '_blank')
}
const tableRef = ref() // Ref
const selectedIds = ref<number[]>([]) // ID
/** 标记全部站内信已读 **/
const handleUpdateAll = async () => {
await NotifyMessageApi.updateAllNotifyMessageRead({
roleId: userStore.getUser?.currentRole
})
message.success('全部已读成功!')
tableRef.value.clearSelection()
await getList()
}
/** 标记一些站内信已读 **/
const handleUpdateList = async () => {
if (selectedIds.value.length === 0) {
return
}
await NotifyMessageApi.updateNotifyMessageRead({
ids: selectedIds.value,
roleId: userStore.getUser?.currentRole
})
message.success('批量已读成功!')
tableRef.value.clearSelection()
await getList()
}
/** 标记一条站内信已读 */
const handleReadOne = async (id: number) => {
await NotifyMessageApi.updateNotifyMessageRead({
ids: [id],
roleId: userStore.getUser?.currentRole
})
await getList()
}
/** 当表格选择项发生变化时会触发该事件 */
const handleSelectionChange = (array: NotifyMessageApi.NotifyMessageVO[]) => {
selectedIds.value = []
if (!array) {
return
}
array.forEach((row) => selectedIds.value.push(row.id))
}
const typeOptions = ref<any[]>([])
<script setup name="NotifyMessage"></script>
function getOptions() {
getGeneralSysDictData('message_type').then((data) => {
typeOptions.value = data
})
}
<style lang="scss" scoped></style>
/** 初始化 **/
onMounted(() => {
getOptions()
getList()
})
</script>

@ -0,0 +1,65 @@
<template>
<div class="p-20px">
<ContentWrap style="max-width: 1000px; margin: 0 auto">
<div class="text-center">
<div class="mb-10px" style="font-size: 24px; letter-spacing: 2px">
{{ info.title }}
</div>
<el-text>
{{ formatDate(info.createTime, 'YYYY-MM-DD hh:mm:ss') }}
</el-text>
</div>
<el-divider direction="horizontal" />
<div v-dompurify-html="info.content"></div>
</ContentWrap>
</div>
</template>
<script setup name="NMDetail">
import { getNotifyMessageDetail } from '@/api/system/notify/message'
import { formatDate } from '@/utils/formatTime'
const route = useRoute()
const info = ref({})
function init() {
getNotifyMessageDetail(route.query.id).then((data) => {
info.value = data
})
}
onMounted(() => {
init()
})
</script>
<style lang="scss" scoped>
:deep(p) {
font-size: 14px;
}
:deep(table) {
margin-top: 10px;
border-collapse: separate;
text-indent: initial;
border-spacing: 1px;
text-align: left;
border-width: 1px;
box-sizing: border-box;
}
:deep(th) {
font-size: 14px;
text-align: left;
border-width: 1px;
box-sizing: border-box;
}
:deep(td) {
font-size: 12px;
text-align: left;
border-width: 1px;
box-sizing: border-box;
}
:deep(.el-card__body) {
padding: 20px 10px;
}
</style>
Loading…
Cancel
Save