Merge pull request 'dev-cjl' (#3) from dev-cjl into main
Reviewed-on: http://114.55.169.15:3000/qiushanhe/ss-crm-manage-web/pulls/3
This commit was merged in pull request #3.
This commit is contained in:
@@ -71,3 +71,10 @@ export const getAppInfo = (instanceId: number) => {
|
||||
url: '/admin-api/system/serviceInstance/getInstanceInfo?instanceId=' + instanceId
|
||||
})
|
||||
}
|
||||
|
||||
export const bindWx = (data: any) => {
|
||||
return request.post({
|
||||
url: '/admin-api/system/user/bind/wx',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -16,35 +15,39 @@ export interface NotifyMessageVO {
|
||||
}
|
||||
|
||||
// 查询站内信消息列表
|
||||
export const getNotifyMessagePage = async (params: PageParam) => {
|
||||
export const getNotifyMessagePage = async (params: any) => {
|
||||
return await request.get({ url: '/admin-api/system/notify-message/page', params })
|
||||
}
|
||||
|
||||
// 获得我的站内信分页
|
||||
export const getMyNotifyMessagePage = async (params: PageParam) => {
|
||||
export const getMyNotifyMessagePage = async (params: any) => {
|
||||
return await request.get({ url: '/admin-api/system/notify-message/my-page', params })
|
||||
}
|
||||
|
||||
// 批量标记已读
|
||||
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 } })
|
||||
}
|
||||
|
||||
25
src/api/system/role/daliyReport.js
Normal file
25
src/api/system/role/daliyReport.js
Normal file
@@ -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'
|
||||
})
|
||||
}
|
||||
@@ -205,6 +205,8 @@ service.interceptors.response.use(
|
||||
if (msg === '无效的刷新令牌') {
|
||||
// hard coding:忽略这个提示,直接登出
|
||||
console.log(msg)
|
||||
} else if (code == 18888) {
|
||||
return { data }
|
||||
} else {
|
||||
ElNotification.error({ title: msg })
|
||||
if (code == 403) {
|
||||
|
||||
@@ -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: 5px 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 {
|
||||
|
||||
@@ -14,7 +14,16 @@ const { start, done } = useNProgress()
|
||||
|
||||
const { loadStart, loadDone } = usePageLoading()
|
||||
// 路由不重定向白名单
|
||||
const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/register', '/swagger']
|
||||
const whiteList = [
|
||||
'/login',
|
||||
'/mp-login',
|
||||
'/nm-detail',
|
||||
'/social-login',
|
||||
'/auth-redirect',
|
||||
'/bind',
|
||||
'/register',
|
||||
'/swagger'
|
||||
]
|
||||
|
||||
// 路由加载前
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
|
||||
@@ -161,6 +161,16 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
noTagsView: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/mp-login',
|
||||
component: () => import('@/views/Login/MPLogin.vue'),
|
||||
name: 'MPLogin',
|
||||
meta: {
|
||||
hidden: true,
|
||||
title: '用户绑定',
|
||||
noTagsView: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/sso',
|
||||
component: () => import('@/views/Login/Login.vue'),
|
||||
@@ -171,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() {
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" name="SystemDeptForm" setup>
|
||||
<script name="SystemDeptForm" setup>
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
@@ -81,6 +81,7 @@ const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
@@ -92,7 +93,7 @@ const formData = ref({
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive<any>({
|
||||
const formRules = reactive({
|
||||
parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
|
||||
@@ -104,10 +105,10 @@ const formRules = reactive<any>({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const deptTree = ref() // 树形结构
|
||||
const userList = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const userList = ref([]) // 用户列表
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
const open = async (type, id) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
@@ -138,7 +139,7 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as DeptApi.DeptVO
|
||||
const data = formData.value
|
||||
if (formType.value === 'create') {
|
||||
await DeptApi.createDept(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
@@ -172,7 +173,7 @@ const resetForm = () => {
|
||||
const getTree = async () => {
|
||||
deptTree.value = []
|
||||
const data = await DeptApi.getSimpleDeptList()
|
||||
let dept: Tree = { id: 0, name: '顶级部门', children: [] }
|
||||
let dept = { id: 0, name: '顶级部门', children: [] }
|
||||
dept.children = handleTree(data)
|
||||
deptTree.value.push(dept)
|
||||
}
|
||||
|
||||
133
src/views/Basic/Dept/DialogTarget.vue
Normal file
133
src/views/Basic/Dept/DialogTarget.vue
Normal file
@@ -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) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
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>
|
||||
@@ -23,9 +23,13 @@
|
||||
<el-table-column prop="name" label="部门名称" />
|
||||
<el-table-column prop="leader" label="负责人" width="120" />
|
||||
<el-table-column prop="sort" label="排序" width="200" />
|
||||
<el-table-column prop="status" label="状态" width="100" />
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
{{ ['启用', '禁用'][row.status] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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 +39,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 +61,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 +107,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 {
|
||||
|
||||
@@ -1,7 +1,149 @@
|
||||
<template>
|
||||
<div> 每日快报 </div>
|
||||
<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.status">
|
||||
<el-radio :label="0"> 开启 </el-radio>
|
||||
<el-radio :label="1"> 关闭 </el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发送途径">
|
||||
<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"
|
||||
value-format="HH:mm"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发送内容">
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
:data="contentOptions"
|
||||
:props="defaultProps"
|
||||
empty-text="加载中,请稍候"
|
||||
node-key="id"
|
||||
show-checkbox
|
||||
default-expand-all
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm"> 保 存 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ReportDaily"></script>
|
||||
<script setup name="ReportDaily">
|
||||
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({
|
||||
roleId: {
|
||||
type: Number
|
||||
}
|
||||
})
|
||||
|
||||
const formLoading = ref(false)
|
||||
const form = ref({
|
||||
sendItem: []
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.roleId,
|
||||
() => {
|
||||
getReportInfo()
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
|
||||
const formRef = ref()
|
||||
|
||||
const rules = {}
|
||||
|
||||
const contentOptions = ref([])
|
||||
|
||||
async function init() {
|
||||
getOptions()
|
||||
getReportInfo()
|
||||
}
|
||||
|
||||
const sendTypeOptions = ref([])
|
||||
const treeRef = ref()
|
||||
function getOptions() {
|
||||
getGeneralSysDictData('message_send_type').then((data) => {
|
||||
sendTypeOptions.value = data
|
||||
})
|
||||
DaliyReportApi.getDaliyReportContent().then((data) => {
|
||||
contentOptions.value = handleTree(data)
|
||||
})
|
||||
}
|
||||
|
||||
async function getReportInfo() {
|
||||
try {
|
||||
formLoading.value = true
|
||||
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)
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = {
|
||||
id: form.value.id,
|
||||
roleId: props.roleId,
|
||||
sendType: form.value.sendType,
|
||||
sendTime: form.value.sendTime,
|
||||
status: form.value.status,
|
||||
sendItem: [
|
||||
...treeRef.value.getCheckedKeys(false), // 获得当前选中节点
|
||||
...treeRef.value.getHalfCheckedKeys() // 获得半选中的父节点
|
||||
]
|
||||
}
|
||||
await DaliyReportApi.updateRoleDaliyReport(data)
|
||||
message.success('保存成功')
|
||||
getReportInfo()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -75,9 +75,13 @@
|
||||
@success="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<!-- <el-tab-pane label="每日快报" :name="4">
|
||||
<ReportDaily />
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane label="每日快报" :name="4">
|
||||
<ReportDaily
|
||||
v-if="roleOperateIndex == 4"
|
||||
ref="reportDailyRef"
|
||||
:roleId="list[libraryIndex].id"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
@@ -89,7 +93,7 @@ import RoleForm from './RoleForm.vue'
|
||||
import RoleEmployee from './Comp/RoleEmployee.vue'
|
||||
import RoleAssignMenuForm from './RoleAssignMenuForm.vue'
|
||||
import RoleDataPermissionForm from './RoleDataPermissionForm.vue'
|
||||
// import ReportDaily from './Comp/ReportDaily.vue'
|
||||
import ReportDaily from './Comp/ReportDaily.vue'
|
||||
import * as RoleApi from '@/api/system/role'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
<template>
|
||||
<div class="head-container">
|
||||
<el-input v-model="deptName" class="mb-20px" clearable placeholder="请输入部门名称">
|
||||
<template #prefix>
|
||||
<Icon icon="ep:search" />
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
@@ -26,7 +19,6 @@ import { ElTree } from 'element-plus'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
|
||||
const deptName = ref('')
|
||||
const deptList = ref<Tree[]>([]) // 树形结构
|
||||
const treeRef = ref<InstanceType<typeof ElTree>>()
|
||||
|
||||
|
||||
@@ -139,7 +139,8 @@ const formData = ref({
|
||||
remark: '',
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
roleIds: [],
|
||||
hireDate: ''
|
||||
hireDate: '',
|
||||
isNewUserConfirm: false
|
||||
})
|
||||
const formRules = ref<any>({
|
||||
username: [{ required: true, message: '登录账号不能为空', trigger: 'blur' }],
|
||||
@@ -192,8 +193,14 @@ const submitForm = async () => {
|
||||
try {
|
||||
const data = formData.value as unknown as UserApi.UserVO
|
||||
if (formType.value === 'create') {
|
||||
await UserApi.createUser(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
const resp = await UserApi.createUser(data)
|
||||
if (resp.code == 18888) {
|
||||
await message.confirm(resp.msg)
|
||||
formData.value.isNewUserConfirm = true
|
||||
submitForm()
|
||||
} else {
|
||||
message.success(t('common.createSuccess'))
|
||||
}
|
||||
} else {
|
||||
await UserApi.updateUser(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
@@ -220,7 +227,8 @@ const resetForm = () => {
|
||||
remark: '',
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
roleIds: [],
|
||||
hireDate: formatDate(new Date(), 'YYYY-MM-DD')
|
||||
hireDate: formatDate(new Date(), 'YYYY-MM-DD'),
|
||||
isNewUserConfirm: false
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
<el-form-item>
|
||||
<el-input v-model="searchForm.name" placeholder="线索名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="searchForm.mobile" placeholder="联系方式" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searchForm.state" placeholder="审核状态" clearable style="width: 120px">
|
||||
<el-option label="待审核" :value="1" />
|
||||
@@ -337,6 +340,7 @@ const searchForm = ref({
|
||||
applyTime: [],
|
||||
applyUser: undefined,
|
||||
checkTime: [],
|
||||
phone: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
@@ -364,6 +368,7 @@ function handleReset() {
|
||||
applyTime: [],
|
||||
applyUser: undefined,
|
||||
checkTime: [],
|
||||
mobile: undefined,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
}
|
||||
|
||||
86
src/views/Login/MPLogin.vue
Normal file
86
src/views/Login/MPLogin.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div class="p-20px">
|
||||
<p class="mb-30px font-bold text-20px">微信授权登陆</p>
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入用户名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" show-password type="password" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-button type="primary" :disabled="formLoading" class="w-full" @click="onSubmit">
|
||||
授权登陆
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="MPLogin">
|
||||
import { bindWx } from '@/api/login'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const form = ref({
|
||||
code: undefined,
|
||||
username: undefined,
|
||||
password: undefined
|
||||
})
|
||||
const formRef = ref()
|
||||
const rules = {
|
||||
username: { required: true, message: '用户名不可为空', trigger: 'blur' },
|
||||
password: { required: true, message: '密码不可为空', trigger: 'blur' }
|
||||
}
|
||||
|
||||
// 微信授权登陆地址
|
||||
const WX_AUTH_URL = 'https://open.weixin.qq.com/connect/oauth2/authorize?'
|
||||
// 重定向参数-固定写法
|
||||
const REDIRECT = '#wechat_redirect'
|
||||
|
||||
const params = ref({
|
||||
appid: 'wxf87aa1f474c0494f', // 公众号 APP ID
|
||||
redirect_uri: ``, // 授权后重定向的回调链接地址, 请使用 urlEncode 对链接进行处理
|
||||
response_type: 'code', // 固定写法
|
||||
scope: 'snsapi_base' // snsapi_base 静默授权获取 open id ;snsapi_userinfo 需要用户授权,获取详细信息
|
||||
// state:'code', // a-zA-Z0-9的参数值,最多128字节
|
||||
})
|
||||
|
||||
const formLoading = ref(false)
|
||||
async function onSubmit() {
|
||||
// 这些需要判断没有 code 情况拉起授权登陆,有就结束放在重复拉起授权登陆
|
||||
if (!form.value.code) {
|
||||
const access_url = WX_AUTH_URL + `${new URLSearchParams(params.value)}` + REDIRECT
|
||||
location.href = access_url
|
||||
} else {
|
||||
// 校验表单
|
||||
if (!formRef.value) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
await bindWx(form.value)
|
||||
message.success('绑定成功')
|
||||
window.close()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const uri = location.origin + location.pathname
|
||||
params.value.redirect_uri = encodeURI(uri)
|
||||
// 获取地址参数
|
||||
const param = new URLSearchParams(location.search)
|
||||
form.value.code = param.get('code')
|
||||
|
||||
if (!form.value.code) {
|
||||
const access_url = WX_AUTH_URL + `${new URLSearchParams(params.value)}` + REDIRECT
|
||||
location.href = access_url
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,7 +1,193 @@
|
||||
<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="messageTypeName" 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'
|
||||
|
||||
<script setup name="NotifyMessage"></script>
|
||||
const router = useRouter()
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
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.getMyNotifyMessagePage({
|
||||
...queryParams,
|
||||
roleId: userStore.getUser?.currentRole
|
||||
})
|
||||
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()
|
||||
}
|
||||
|
||||
async function handleDetail(row: any) {
|
||||
if (!row.readStatus) {
|
||||
await 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 handleReadOne = async (id: number) => {
|
||||
await NotifyMessageApi.updateNotifyMessageRead({
|
||||
ids: [id]
|
||||
})
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 标记全部站内信已读 **/
|
||||
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 handleSelectionChange = (array: NotifyMessageApi.NotifyMessageVO[]) => {
|
||||
selectedIds.value = []
|
||||
if (!array) {
|
||||
return
|
||||
}
|
||||
array.forEach((row) => selectedIds.value.push(row.id))
|
||||
}
|
||||
|
||||
const typeOptions = ref<any[]>([])
|
||||
|
||||
function getOptions() {
|
||||
getGeneralSysDictData('message_type').then((data) => {
|
||||
typeOptions.value = data
|
||||
})
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getOptions()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
89
src/views/Profile/NotifyMessageDetail.vue
Normal file
89
src/views/Profile/NotifyMessageDetail.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<!--
|
||||
* @Author: riverQiu
|
||||
* @Date: 2024-09-11 18:42:37
|
||||
* @LastEditors: riverQiu
|
||||
* @LastEditTime: 2024-09-11 19:03:23
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="container">
|
||||
<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, updateNotifyMessageRead } 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
|
||||
if (!data.readStatus) {
|
||||
handleReadOne(data.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 标记一条站内信已读 */
|
||||
const handleReadOne = async (id) => {
|
||||
await updateNotifyMessageRead({
|
||||
ids: [id]
|
||||
// roleId: userStore.getUser?.currentRole
|
||||
})
|
||||
await getList()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
padding: 20px;
|
||||
max-height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
: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>
|
||||
Reference in New Issue
Block a user