Compare commits

..

No commits in common. '5c6c3df4d0e0d7fd1606de68e15c45b371c21d95' and 'acdcc670de14dd247fe82eb53c74c59cfb3a0d82' have entirely different histories.

  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,13 +41,3 @@ export const updateDept = async (params: DeptVO) => {
export const deleteDept = async (id: number) => { export const deleteDept = async (id: number) => {
return await request.delete({ url: '/admin-api/system/dept/delete?id=' + id }) 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,11 +44,6 @@ export const deleteDictData = (id: number) => {
} }
// 导出字典类型数据 // 导出字典类型数据
export const exportDictData = (params: any) => { export const exportDictData = (params) => {
return request.get({ url: '/admin-api/crm/dict-data/export', params }) 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,4 +1,5 @@
import request from '@/config/axios' import request from '@/config/axios'
import qs from 'qs'
export interface NotifyMessageVO { export interface NotifyMessageVO {
id: number id: number
@ -25,29 +26,25 @@ export const getMyNotifyMessagePage = async (params: PageParam) => {
} }
// 批量标记已读 // 批量标记已读
export const updateNotifyMessageRead = async (data: any) => { export const updateNotifyMessageRead = async (ids) => {
return await request.put({ return await request.put({
url: '/admin-api/system/notify-message/update-read?', url:
data '/admin-api/system/notify-message/update-read?' +
qs.stringify({ ids: ids }, { indices: false })
}) })
} }
// 标记所有站内信为已读 // 标记所有站内信为已读
export const updateAllNotifyMessageRead = async (data: any) => { export const updateAllNotifyMessageRead = async () => {
return await request.put({ url: '/admin-api/system/notify-message/update-all-read', data }) return await request.put({ url: '/admin-api/system/notify-message/update-all-read' })
} }
// 获取当前用户的最新站内信列表 // 获取当前用户的最新站内信列表
export const getUnreadNotifyMessageList = async (params: any) => { export const getUnreadNotifyMessageList = async () => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-list', params }) return await request.get({ url: '/admin-api/system/notify-message/get-unread-list' })
} }
// 获得当前用户的未读站内信数量 // 获得当前用户的未读站内信数量
export const getUnreadNotifyMessageCount = async (params: any) => { export const getUnreadNotifyMessageCount = async () => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-count', params }) return await request.get({ url: '/admin-api/system/notify-message/get-unread-count' })
}
// 获取详情
export const getNotifyMessageDetail = async (id: number) => {
return await request.get({ url: '/admin-api/system/notify-message/get', params: { id } })
} }

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

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

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

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

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

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

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

@ -1,192 +1,7 @@
<template> <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> </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[]>([])
function getOptions() { <script setup name="NotifyMessage"></script>
getGeneralSysDictData('message_type').then((data) => {
typeOptions.value = data
})
}
/** 初始化 **/ <style lang="scss" scoped></style>
onMounted(() => {
getOptions()
getList()
})
</script>

@ -1,65 +0,0 @@
<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