Compare commits

4 Commits

45 changed files with 549 additions and 3053 deletions

View File

@@ -4,10 +4,10 @@ VITE_NODE_ENV=development
VITE_DEV=true VITE_DEV=true
# 请求路径 # 请求路径
# VITE_BASE_URL='http://localhost:48080' #VITE_BASE_URL='http://118.31.23.45:48080'
# VITE_BASE_URL='http://114.55.169.15:48080'
VITE_BASE_URL='http://localhost:48080'
VITE_BASE_URL='http://47.98.161.246:48080'
# VITE_BASE_URL='http://114.215.207.150:48080'
# 上传路径 # 上传路径
VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload' VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload'

View File

@@ -4,8 +4,10 @@ VITE_NODE_ENV=production
VITE_DEV=false VITE_DEV=false
# 请求路径 # 请求路径
#VITE_BASE_URL='http://47.98.161.246:48080'
VITE_BASE_URL='http://localhost:48080' VITE_BASE_URL='http://localhost:48080'
# 上传路径 # 上传路径
VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload' VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload'

View File

@@ -1,5 +0,0 @@
{
"i18n-ally.localesPaths": [
"src/locales"
]
}

View File

@@ -39,7 +39,6 @@
"@vueuse/core": "^10.1.2", "@vueuse/core": "^10.1.2",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10", "@wangeditor/editor-for-vue": "^5.1.10",
"@wangeditor/plugin-upload-attachment": "^1.1.0",
"@zxcvbn-ts/core": "^3.0.1", "@zxcvbn-ts/core": "^3.0.1",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.4.0", "axios": "^1.4.0",

View File

@@ -54,8 +54,3 @@ export const getLinkHistorySalary = async () => {
export const getCommissionDetail = async (params) => { export const getCommissionDetail = async (params) => {
return await request.get({ url: '/admin-api/oa/user-salary-grant/detail', params }) return await request.get({ url: '/admin-api/oa/user-salary-grant/detail', params })
} }
// 发送工资条通知
export const sendSalaryNotice = (data) => {
return request.post({ url: '/admin-api/oa/user-salary-grant/pushUserSalaryGrantDetail', data })
}

View File

@@ -5,8 +5,8 @@ export const createComment = (data) => {
return request.post({ return request.post({
url: '/admin-api/okr/comments/create', url: '/admin-api/okr/comments/create',
data, data,
isSubmitForm: true isSubmitForm: true,
// headers: { 'instance-id': 1016 } headers: { 'instance-id': 1016 }
}) })
} }
@@ -14,8 +14,8 @@ export const createComment = (data) => {
export const getCommentPage = (params) => { export const getCommentPage = (params) => {
return request.get({ return request.get({
url: '/admin-api/okr/comments/page', url: '/admin-api/okr/comments/page',
params params,
// headers: { 'instance-id': 1016 } headers: { 'instance-id': 1016 }
}) })
} }
@@ -27,12 +27,3 @@ export const getCommentTypeOptions = () => {
// headers: { 'instance-id': 1016 } // headers: { 'instance-id': 1016 }
}) })
} }
// 点赞评论
export const likeComment = (commentId) => {
return request.put({
url: '/admin-api/okr/comments-likes/update',
data: { commentId }
// headers: { 'instance-id': 1016 }
})
}

View File

@@ -1,61 +0,0 @@
import request from '@/config/axios'
export const createMeeting = (data) => {
return request.post({
url: '/admin-api/okr/meeting/add',
data,
isSubmitForm: true
// headers: { 'instance-id': 1016 }
})
}
// 修改
export const updateMeeting = (data) => {
return request.put({
url: '/admin-api/okr/meeting/update',
data
// headers: { 'instance-id': 1016 }
})
}
// 查询详情
export const getMeetingDetail = (params) => {
return request.get({
url: '/admin-api/okr/meeting/get',
params
// headers: { 'instance-id': 1016 }
})
}
// 取消会议
export const cancelMeeting = (data) => {
return request.put({
url: '/admin-api/okr/meeting/cancel',
data
// headers: { 'instance-id': 1016 }
})
}
// 分页查询
export const getMeetingPage = (params) => {
return request.get({
url: '/admin-api/okr/meeting/page',
params
// headers: { 'instance-id': 1016 }
})
}
// 刷新微信群列表
export const refreshWxGroupList = () => {
return request.get({
url: '/admin-api/system/wx/reFreshWeChatGroupList'
// headers: { 'instance-id': 1016 }
})
}
// 获取微信群聊列表
export const getWxGroupList = () => {
return request.get({
url: '/admin-api/system/wx/getWeChatGroupList'
// headers: { 'instance-id': 1016 }
})
}

View File

@@ -20,10 +20,10 @@ export const updateOkrNode = (data) => {
} }
// 查询详情 // 查询详情
export const getOkrNodeDetail = (params) => { export const getOkrNodeDetail = (nodeId) => {
return request.get({ return request.get({
url: '/admin-api/okr/node/get', url: '/admin-api/okr/node/get',
params params: { nodeId }
// headers: { 'instance-id': 1016 } // headers: { 'instance-id': 1016 }
}) })
} }
@@ -90,65 +90,3 @@ export const updateOkrProgress = (data) => {
// headers: { 'instance-id': 1016 } // headers: { 'instance-id': 1016 }
}) })
} }
// 获取目标关系树一级节点
export const getOkrRelationTree = (params) => {
return request.get({
url: '/admin-api/okr/node/first-node',
params
// headers: { 'instance-id': 1016 }
})
}
// 获取目标关系树下级节点数据
export const getOkrRelationTreeChildren = (params) => {
return request.get({
url: '/admin-api/okr/node/node-tree',
params
// headers: { 'instance-id': 1016 }
})
}
// 获取我的组员
export const getMyMemberList = (params) => {
return request.get({
url: '/admin-api/okr/node/my-members',
params
// headers: { 'instance-id': 1016 }
})
}
// 获取我的组员节点树
export const getMySonNodeTree = (params) => {
return request.get({
url: '/admin-api/okr/node/member/node/list',
params
// headers: { 'instance-id': 1016 }
})
}
// 获取我的组员OKR列表
export const getMySonOkrPage = (params) => {
return request.get({
url: '/admin-api/okr/node/member/objective/list',
params
// headers: { 'instance-id': 1016 }
})
}
// 获取渠道
export const getChannelOptions = () => {
return request.get({
url: '/admin-api/okr/node/source'
// headers: { 'instance-id': 1016 }
})
}
// 获取统计表中的合计信息
export const getOkrStatisticsTotal = (params) => {
return request.get({
url: '/admin-api/okr/node/data/count',
params
// headers: { 'instance-id': 1016 }
})
}

View File

@@ -13,8 +13,8 @@ export interface DeptVO {
} }
// 查询部门(精简)列表 // 查询部门(精简)列表
export const getSimpleDeptList = async (params: any): Promise<any[]> => { export const getSimpleDeptList = async (): Promise<DeptVO[]> => {
return await request.get({ url: '/admin-api/system/dept/list-all-simple', params }) return await request.get({ url: '/admin-api/system/dept/list-all-simple' })
} }
// 查询部门列表 // 查询部门列表

View File

@@ -42,11 +42,7 @@ const props = defineProps({
'undo', // 撤销 'undo', // 撤销
'redo', // 重做 'redo', // 重做
'fullScreen' 'fullScreen'
], ]
insertKeys: {
index: 20, // 自定义插入的位置
keys: ['uploadAttachment'] // “上传附件”菜单
}
}) })
} }
}) })
@@ -108,12 +104,6 @@ const editorConfig = computed((): IEditorConfig => {
}, },
autoFocus: false, autoFocus: false,
scroll: true, scroll: true,
// 在编辑器中,点击选中“附件”节点时,要弹出的菜单
hoverbarKeys: {
attachment: {
menuKeys: ['downloadAttachment'] // “下载附件”菜单
}
},
MENU_CONF: { MENU_CONF: {
['uploadImage']: { ['uploadImage']: {
server: import.meta.env.VITE_UPLOAD_URL, server: import.meta.env.VITE_UPLOAD_URL,
@@ -228,52 +218,6 @@ const editorConfig = computed((): IEditorConfig => {
customInsert(res: any, insertFn: InsertFnType) { customInsert(res: any, insertFn: InsertFnType) {
insertFn(res.data, 'video', res.data) insertFn(res.data, 'video', res.data)
} }
},
uploadAttachment: {
server: import.meta.env.VITE_UPLOAD_URL,
timeout: 20 * 1000, // 2s
fieldName: 'file',
// meta: { token: 'xxx', a: 100 }, // 请求时附加的数据
// metaWithUrl: true, // meta 拼接到 url 上
// headers: { Accept: 'text/x-json' },
// 自定义增加 http header
headers: {
Accept: '*',
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId(),
'instance-id': getAppId()
},
maxFileSize: 20 * 1024 * 1024, // 20M
onBeforeUpload(file: File) {
console.log('onBeforeUpload', file)
return file // 上传 file 文件
// return false // 会阻止上传
},
onProgress(progress: number) {
console.log('onProgress', progress)
},
onSuccess(file: File, res: any) {
console.log('onSuccess', file, res)
},
onFailed(file: File, res: any) {
alert(res.message)
console.log('onFailed', file, res)
},
onError(file: File, err: Error, res: any) {
alert(err.message)
console.error('onError', file, err, res)
},
// 上传成功后,用户自定义插入文件
customInsert(res: any, file: File, insertFn: Function) {
console.log('customInsert', res)
// 插入附件到编辑器
insertFn(file.name, res.data)
// insertFn(res.data, `customInsert-${file.name}`, res.data)
}
} }
}, },
uploadImgShowBase64: true uploadImgShowBase64: true

View File

@@ -41,14 +41,9 @@ import '@/plugins/tongji' // 百度统计
import Logger from '@/utils/Logger' import Logger from '@/utils/Logger'
import VueDOMPurifyHTML from 'vue-dompurify-html' import VueDOMPurifyHTML from 'vue-dompurify-html'
import { Boot } from '@wangeditor/editor'
import attachmentModule from '@wangeditor/plugin-upload-attachment'
// 创建实例 // 创建实例
const setupAll = async () => { const setupAll = async () => {
// 注册。要在创建编辑器之前注册,且只能注册一次,不可重复注册。
Boot.registerModule(attachmentModule)
const app = createApp(App) const app = createApp(App)
await setupI18n(app) await setupI18n(app)

View File

@@ -1,14 +1,14 @@
import router from './router' import router from './router'
import { isRelogin } from '@/config/axios/service' import { isRelogin } from '@/config/axios/service'
import { getAccessToken } from '@/utils/auth' import { getAccessToken, removeToken } from '@/utils/auth'
import { useTitle } from '@/hooks/web/useTitle' import { useTitle } from '@/hooks/web/useTitle'
import { useNProgress } from '@/hooks/web/useNProgress' import { useNProgress } from '@/hooks/web/useNProgress'
import { usePageLoading } from '@/hooks/web/usePageLoading' import { usePageLoading } from '@/hooks/web/usePageLoading'
import { useDictStoreWithOut } from '@/store/modules/dict' import { useDictStoreWithOut } from '@/store/modules/dict'
import { useUserStoreWithOut } from '@/store/modules/user' import { useUserStoreWithOut } from '@/store/modules/user'
import { usePermissionStoreWithOut } from '@/store/modules/permission' import { usePermissionStoreWithOut } from '@/store/modules/permission'
import { useAppStoreWithOut } from '@/store/modules/app' import { getTenantId, getAppId } from '@/utils/auth'
import { getTenantId, getAppId, setTenantId, setAppId } from '@/utils/auth' import cache from '@/plugins/cache'
const { start, done } = useNProgress() const { start, done } = useNProgress()
@@ -20,90 +20,58 @@ const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/regis
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
start() start()
loadStart() loadStart()
const userStore = useUserStoreWithOut() if (getAppId() && to.query?.appId && getAppId() != to.query?.appId) {
if (to.path == '/login') { removeToken()
userStore.resetState() // 重置用户信息状态 cache?.local?.delete('appInfo')
} cache?.local?.delete('roleRouters')
if (getAccessToken()) { cache?.local?.delete('user')
if (to.path === '/login') { cache?.local?.delete('App_ID')
if (to.query?.tenantId && to.query?.appId) { next(`/login?tenantId=${to.query?.tenantId}&appId=${to.query?.appId}`)
setApp(to.query.tenantId, to.query.appId)
await waitTime(1500)
}
next({ path: '/' })
} else {
// 获取所有字典
const dictStore = useDictStoreWithOut()
const permissionStore = usePermissionStoreWithOut()
if (!dictStore.getIsSetDict) {
await dictStore.setDictMap()
}
if (!userStore.getIsSetUser) {
isRelogin.show = true
await userStore.setUserInfoAction()
isRelogin.show = false
// 后端过滤菜单
await permissionStore.generateRoutes()
permissionStore.getAddRouters.forEach((route) => {
router.addRoute(route) // 动态添加可访问路由表
})
const redirectPath = from.query.redirect || to.path
const redirect = decodeURIComponent(redirectPath)
const nextData =
to.path === redirect
? { ...to, replace: true, query: to.query }
: { path: redirect, query: to.query }
next(nextData)
} else {
next()
}
}
} else { } else {
if (whiteList.indexOf(to.path) !== -1) { if (getAccessToken()) {
next() if (to.path === '/login') {
} else { next({ path: '/' })
const tenantId = getTenantId() || to.query?.tenantId
const appId = getAppId() || to.query?.appId
if (tenantId && appId) {
let redirectPath = to.fullPath
const p = to.fullPath.split('?')
if (p.length > 1) {
// 过滤掉query参数中的tenantId和appId
redirectPath =
p[0] +
'?' +
p[1]
.split('&')
.filter((item) => !item.startsWith('tenantId=') && !item.startsWith('appId='))
.join('&')
}
next(`/login?tenantId=${tenantId}&appId=${appId}&redirect=${redirectPath}`) // 否则全部重定向到登录页
} else { } else {
// next(`/login?redirect=${to.fullPath}`) // 获取所有字典
// 否则全部重定向到平台登陆页 const dictStore = useDictStoreWithOut()
window.location.href = 'https://cloud.ahduima.com/ss/login' const userStore = useUserStoreWithOut()
const permissionStore = usePermissionStoreWithOut()
if (!dictStore.getIsSetDict) {
await dictStore.setDictMap()
}
if (!userStore.getIsSetUser) {
isRelogin.show = true
await userStore.setUserInfoAction()
isRelogin.show = false
// 后端过滤菜单
await permissionStore.generateRoutes()
permissionStore.getAddRouters.forEach((route) => {
router.addRoute(route) // 动态添加可访问路由表
})
const redirectPath = from.query.redirect || to.path
const redirect = decodeURIComponent(redirectPath)
const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }
next(nextData)
} else {
next()
}
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
next()
} else {
const tenantId = getTenantId()
const appId = getAppId()
if (tenantId && appId) {
next(`/oa/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
} else {
next(`/oa/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
}
} }
} }
} }
}) })
async function waitTime(seconds) {
return new Promise((resolve) => {
setTimeout(() => {
resolve()
}, seconds)
})
}
function setApp(tenantId, appId) {
setTenantId(tenantId)
setAppId(appId)
const appStore = useAppStoreWithOut()
appStore.setAppInfo(appId)
}
router.afterEach((to) => { router.afterEach((to) => {
useTitle(to?.meta?.title) useTitle(to?.meta?.title)
done() // 结束Progress done() // 结束Progress

View File

@@ -106,29 +106,41 @@ const remainingRouter: AppRouteRecordRaw[] = [
} }
] ]
}, },
// { {
// path: '/Basic', path: '/Basic',
// component: Layout, component: Layout,
// name: 'Basic', name: 'Basic',
// meta: { meta: {
// title: '菜单管理' title: '菜单管理'
// }, },
// redirect: '/Basic/menu', redirect: '/Basic/menu',
// children: [ children: [
// { {
// path: 'menu', path: 'menu',
// component: () => import('@/views/Basic/Menu/index.vue'), component: () => import('@/views/Basic/Menu/index.vue'),
// name: 'Menu', name: 'Menu',
// meta: { meta: {
// canTo: true, canTo: true,
// // hidden: true, // hidden: true,
// noTagsView: false, noTagsView: false,
// icon: 'ep:user', icon: 'ep:user',
// title: '菜单管理' title: '菜单管理'
// } }
// } },
// ] {
// }, path: 'okr',
component: () => import('@/views/OKR/Management/index.vue'),
name: 'OkrManagement',
meta: {
canTo: true,
// hidden: true,
noTagsView: false,
icon: 'ep:user',
title: 'Okr管理'
}
}
]
},
{ {
path: '/login', path: '/login',
component: () => import('@/views/Login/Login.vue'), component: () => import('@/views/Login/Login.vue'),
@@ -139,16 +151,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
noTagsView: true noTagsView: true
} }
}, },
{
path: '/meeting-summary',
component: () => import('@/views/OKR/Meeting/MeetingSummary.vue'),
name: 'MeetingSummary',
meta: {
hidden: true,
title: '会议纪要',
noTagsView: true
}
},
{ {
path: '/sso', path: '/sso',
component: () => import('@/views/Login/Login.vue'), component: () => import('@/views/Login/Login.vue'),

View File

@@ -1,87 +0,0 @@
const staticRouter: AppCustomRouteRecordRaw[] = [
{
icon: 'ep:calendar',
path: '/Okr',
component: '',
name: 'OKR',
componentName: '',
redirect: '',
parentId: 0,
visible: true,
alwaysShow: true,
children: [
{
icon: 'ep:finished',
path: 'okr-management',
name: 'OKR管理',
componentName: 'OkrManagement',
component: 'OKR/Management/index',
visible: true,
alwaysShow: true,
meta: {
title: 'OKR管理'
},
redirect: ''
},
{
icon: 'ep:alarm-clock',
path: 'okr-wait',
name: '待办事项',
componentName: 'OkrWait',
component: 'OKR/Wait/index',
meta: {
title: '待办事项'
},
visible: true,
alwaysShow: true,
redirect: ''
},
{
icon: 'ep:data-line',
path: 'okr-analysis',
name: 'OKR统计',
componentName: 'OkrAnalysis',
component: 'OKR/Analysis/index',
meta: {
title: 'OKR统计'
},
visible: true,
alwaysShow: true,
redirect: ''
},
{
icon: 'ep:data-board',
path: 'okr-meeting',
name: '会议管理',
componentName: 'OkrMeeting',
component: 'OKR/Meeting/index',
meta: {
title: '会议管理'
},
visible: true,
alwaysShow: true,
redirect: ''
},
{
icon: 'ep:data-board',
path: 'okr-meeting-info/:id',
name: '会议详情',
componentName: 'MeetingInfo',
component: 'OKR/Meeting/MeetingInfo',
meta: {
title: '会议详情'
},
visible: false,
alwaysShow: true,
redirect: '',
keepAlive: true
}
],
meta: {
title: 'OKR',
icon: 'ep:calendar'
}
}
]
export default staticRouter

View File

@@ -45,7 +45,7 @@ export const useDictStore = defineStore('dict', {
this.dictMap = dictMap this.dictMap = dictMap
this.isSetDict = true this.isSetDict = true
} else { } else {
const res = (await listSimpleDictData()) || [] const res = await listSimpleDictData()
// 设置数据 // 设置数据
const dictDataMap = new Map<string, any>() const dictDataMap = new Map<string, any>()
res.forEach((dictData: DictDataVO) => { res.forEach((dictData: DictDataVO) => {
@@ -75,7 +75,7 @@ export const useDictStore = defineStore('dict', {
}, },
async resetDict() { async resetDict() {
cache.session.delete(CACHE_KEY.DICT_CACHE) cache.session.delete(CACHE_KEY.DICT_CACHE)
const res = (await listSimpleDictData()) || [] const res = await listSimpleDictData()
// 设置数据 // 设置数据
const dictDataMap = new Map<string, any>() const dictDataMap = new Map<string, any>()
res.forEach((dictData: DictDataVO) => { res.forEach((dictData: DictDataVO) => {

View File

@@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
import { store } from '../index' import { store } from '../index'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import remainingRouter from '@/router/modules/remaining' import remainingRouter from '@/router/modules/remaining'
import staticRouter from '@/router/modules/static'
import { generateRoute, flatMultiLevelRoutes } from '@/utils/routerHelper' import { generateRoute, flatMultiLevelRoutes } from '@/utils/routerHelper'
import { CACHE_KEY } from '@/hooks/web/useCache' import { CACHE_KEY } from '@/hooks/web/useCache'
@@ -38,25 +37,6 @@ export const usePermissionStore = defineStore('permission', {
if (cache.local.get(CACHE_KEY.ROLE_ROUTERS)) { if (cache.local.get(CACHE_KEY.ROLE_ROUTERS)) {
res = cache.local.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[] res = cache.local.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[]
} }
const staticRouters = cloneDeep(staticRouter)
// 与动态路由比较,首先判断目录是否存在,如果存在就合并,并替换动态路由中的目录
staticRouters.forEach((item) => {
const index = res.findIndex((item2) => item2.path === item.path)
if (index !== -1) {
const arr = []
if (!item.children || item.children.length === 0) {
item.children = arr
}
if (res[index].children && res[index].children.length > 0) {
item.children = item.children.concat(res[index].children)
}
// routerMap[index].children = item.children
// 插入动态路由数组的第二位
res[index] = { ...res, ...item }
} else {
res = [...staticRouters, ...res]
}
})
const routerMap: AppRouteRecordRaw[] = generateRoute(res) const routerMap: AppRouteRecordRaw[] = generateRoute(res)
// 动态路由404一定要放到最后面 // 动态路由404一定要放到最后面
this.addRouters = routerMap.concat([ this.addRouters = routerMap.concat([
@@ -70,7 +50,6 @@ export const usePermissionStore = defineStore('permission', {
} }
} }
]) ])
// 渲染菜单的所有路由 // 渲染菜单的所有路由
this.routers = cloneDeep(remainingRouter).concat(routerMap) this.routers = cloneDeep(remainingRouter).concat(routerMap)
resolve() resolve()

View File

@@ -63,7 +63,7 @@ export const useUserStore = defineStore('admin-user', {
async loginOut() { async loginOut() {
await loginOut() await loginOut()
removeToken() removeToken()
// cache.local.clear() cache.local.clear()
this.resetState() this.resetState()
}, },
resetState() { resetState() {
@@ -75,7 +75,6 @@ export const useUserStore = defineStore('admin-user', {
avatar: '', avatar: '',
nickname: '' nickname: ''
} }
cache.local.delete(CACHE_KEY.USER)
}, },
refresh() { refresh() {
cache.local.delete(CACHE_KEY.USER) cache.local.delete(CACHE_KEY.USER)

View File

@@ -97,13 +97,4 @@
/* 去除 Firefox 中的指示器 */ /* 去除 Firefox 中的指示器 */
.el-input__inner[type='number'] { .el-input__inner[type='number'] {
-moz-appearance: textfield; -moz-appearance: textfield;
}
.el-drawer__header {
padding: 16px 16px 8px 16px !important;
margin: 0 !important;
line-height: 24px !important;
font-size: 18px !important;
color: #303133 !important;
box-sizing: border-box !important;
// border-bottom: 1px solid #e8e8e8 !important;
} }

View File

@@ -9,34 +9,26 @@ const RefreshTokenKey = 'REFRESH_TOKEN'
// 获取token // 获取token
export const getAccessToken = () => { export const getAccessToken = () => {
// 此处与TokenKey相同此写法解决初始化时Cookies中不存在TokenKey报错 // 此处与TokenKey相同此写法解决初始化时Cookies中不存在TokenKey报错
return localStorage.getItem(AccessTokenKey) return cache.local.get(AccessTokenKey)
? localStorage.getItem(AccessTokenKey) ? cache.local.get(AccessTokenKey)
: localStorage.getItem('ACCESS_TOKEN') : cache.local.get('ACCESS_TOKEN')
// return cache.local.get(AccessTokenKey)
// ? cache.local.get(AccessTokenKey)
// : cache.local.get('ACCESS_TOKEN')
} }
// 刷新token // 刷新token
export const getRefreshToken = () => { export const getRefreshToken = () => {
return localStorage.getItem(RefreshTokenKey) return cache.local.get(RefreshTokenKey)
// return cache.local.get(RefreshTokenKey)
} }
// 设置token // 设置token
export const setToken = (token: TokenType) => { export const setToken = (token: TokenType) => {
localStorage.setItem(AccessTokenKey, token.accessToken) cache.local.set(RefreshTokenKey, token.refreshToken)
localStorage.setItem(RefreshTokenKey, token.refreshToken) cache.local.set(AccessTokenKey, token.accessToken)
// cache.local.set(RefreshTokenKey, token.refreshToken)
// cache.local.set(AccessTokenKey, token.accessToken)
} }
// 删除token // 删除token
export const removeToken = () => { export const removeToken = () => {
localStorage.removeItem(AccessTokenKey) cache.local.delete(AccessTokenKey)
localStorage.removeItem(RefreshTokenKey) cache.local.delete(RefreshTokenKey)
// cache.local.delete(AccessTokenKey)
// cache.local.delete(RefreshTokenKey)
} }
/** 格式化tokenjwt格式 */ /** 格式化tokenjwt格式 */

View File

@@ -220,30 +220,3 @@ export const removeNullField = (obj: Object) => {
} }
return obj return obj
} }
import * as XLSX from 'xlsx'
import * as FileSaver from 'file-saver'
export const exportTableWithVue = (domId: any, fileName: String) => {
// const XLSX = require('xlsx')
// 使用 this.$nextTick 是在dom元素都渲染完成之后再执行
// this.$nextTick(function () {
// 设置导出的内容是否只做解析,不进行格式转换 false要解析 true:不解析
const xlsxParam = { raw: true }
const wb = XLSX.utils.table_to_book(document.querySelector(domId), xlsxParam)
const wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: true,
type: 'array'
})
try {
// 下载保存文件
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), `${fileName}.xlsx`)
} catch (e) {
if (typeof console !== 'undefined') {
console.log(e, wbout)
}
}
return wbout
// });
}

View File

@@ -30,18 +30,11 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12" :offset="0"> <el-col :span="12" :offset="0">
<el-form-item label="负责人" prop="leaderUserId"> <el-form-item label="负责人" prop="leaderUserId">
<el-select <el-select v-model="formData.leaderUserId" clearable placeholder="请输入负责人">
v-model="formData.leaderUserId"
clearable
multiple
filterable
placeholder="请输入负责人"
>
<el-option <el-option
v-for="item in employeeOptions" v-for="item in userList"
:key="item.id" :key="item.id"
:disabled="item.status == 1" :label="item.nickname"
:label="item.name"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
@@ -62,24 +55,6 @@
<el-input-number v-model="formData.sort" :min="0" /> <el-input-number v-model="formData.sort" :min="0" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" :offset="0">
<el-form-item label="业务系统" prop="instanceId">
<el-select
v-model="formData.instanceId"
placeholder="选择主业务系统"
clearable
filterable
>
<el-option
v-for="item in instanceIdOptions"
:key="item.instanceId"
:label="item.instanceName"
:disabled="item.status == 1"
:value="item.instanceId"
/>
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24" :offset="0"> <el-col :span="24" :offset="0">
@@ -98,9 +73,8 @@
<script lang="ts" name="SystemDeptForm" setup> <script lang="ts" name="SystemDeptForm" setup>
import { defaultProps, handleTree } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
import { getEmployeeSimpleList } from '@/api/pers/employee' import * as UserApi from '@/api/system/user'
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
import { getSimpleAppList } from '@/api/system/app'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗 const message = useMessage() // 消息弹窗
@@ -109,7 +83,15 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题 const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用 const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formType = ref('') // 表单的类型create - 新增update - 修改 const formType = ref('') // 表单的类型create - 新增update - 修改
const formData = ref<any>({}) const formData = ref({
id: undefined,
parentId: undefined,
name: undefined,
sort: 1,
leaderUserId: undefined,
status: CommonStatusEnum.ENABLE,
remark: undefined
})
const formRules = reactive<any>({ const formRules = reactive<any>({
parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }], parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
name: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
@@ -122,8 +104,7 @@ const formRules = reactive<any>({
}) })
const formRef = ref() // 表单 Ref const formRef = ref() // 表单 Ref
const deptTree = ref() // 树形结构 const deptTree = ref() // 树形结构
const employeeOptions = ref<any>([]) // 用户列表 const userList = ref<UserApi.UserVO[]>([]) // 用户列表
const instanceIdOptions = ref<any>([]) // 实例ids
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {
@@ -136,23 +117,12 @@ const open = async (type: string, id?: number) => {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await DeptApi.getDept(id) formData.value = await DeptApi.getDept(id)
formData.value.remark = formData.value.remark || ''
formData.value.leaderUserId = formData.value.leaderUserId?.map((it) => it + '') || []
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
} }
// 获得用户列表 // 获得用户列表
getEmployeeSimpleList().then((data) => { userList.value = await UserApi.getSimpleUserList()
employeeOptions.value = data.map((it) => ({
...it,
id: it.id + ''
}))
})
//实例
getSimpleAppList().then((data) => {
instanceIdOptions.value = data
})
// 获得部门树 // 获得部门树
await getTree() await getTree()
} }
@@ -191,10 +161,9 @@ const resetForm = () => {
parentId: undefined, parentId: undefined,
name: undefined, name: undefined,
sort: 1, sort: 1,
leaderUserId: [], leaderUserId: undefined,
status: CommonStatusEnum.ENABLE, status: CommonStatusEnum.ENABLE,
remark: undefined, remark: undefined
instanceId: undefined
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }
@@ -202,7 +171,7 @@ const resetForm = () => {
/** 获得部门树 */ /** 获得部门树 */
const getTree = async () => { const getTree = async () => {
deptTree.value = [] deptTree.value = []
const data = await DeptApi.getSimpleDeptList({ allFlag: true }) const data = await DeptApi.getSimpleDeptList()
let dept: Tree = { id: 0, name: '顶级部门', children: [] } let dept: Tree = { id: 0, name: '顶级部门', children: [] }
dept.children = handleTree(data) dept.children = handleTree(data)
deptTree.value.push(dept) deptTree.value.push(dept)

View File

@@ -22,15 +22,8 @@
<el-table v-loading="loading" :data="list" row-key="id" default-expand-all border> <el-table v-loading="loading" :data="list" row-key="id" default-expand-all border>
<el-table-column prop="name" label="部门名称" /> <el-table-column prop="name" label="部门名称" />
<el-table-column prop="leaderUserName" label="负责人" width="120" /> <el-table-column prop="leaderUserName" label="负责人" width="120" />
<el-table-column prop="instanceName" label="业务系统" width="200" /> <el-table-column prop="sort" label="排序" width="200" />
<el-table-column prop="sort" label="排序" width="80" /> <el-table-column prop="status" label="状态" width="100" />
<el-table-column prop="status" label="状态" width="100">
<template #default="scope">
<el-tag :type="scope.row.status == 0 ? 'success' : 'danger'">
{{ scope.row.status == 0 ? '正常' : '停用' }}
</el-tag>
</template>
</el-table-column>
<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="160"> <el-table-column label="操作" class-name="fixed-width" width="160">
<template #default="scope"> <template #default="scope">
@@ -68,7 +61,6 @@ const { t } = useI18n() // 国际化
const loading = ref(true) // 列表的加载中 const loading = ref(true) // 列表的加载中
const list = ref() // 列表的数据 const list = ref() // 列表的数据
const queryParams = reactive({ const queryParams = reactive({
allFlag: true,
name: undefined name: undefined
}) })
const queryFormRef = ref() // 搜索的表单 const queryFormRef = ref() // 搜索的表单

View File

@@ -13,7 +13,7 @@
<el-input v-model="formData.nickname" placeholder="请输入用户姓名" /> <el-input v-model="formData.nickname" placeholder="请输入用户姓名" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="12"> <el-col :span="12">
<el-form-item label="用户性别"> <el-form-item label="用户性别">
<el-radio-group v-model="formData.sex"> <el-radio-group v-model="formData.sex">
<el-radio :value="1"> </el-radio> <el-radio :value="1"> </el-radio>
@@ -34,7 +34,7 @@
placeholder="请选择归属部门" placeholder="请选择归属部门"
/> />
</el-form-item> </el-form-item>
</el-col> --> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="角色" prop="role"> <el-form-item label="角色" prop="role">
<el-select <el-select
@@ -84,7 +84,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12" :offset="0"> <el-col :span="12" :offset="0">
<el-form-item label="入职日期" prop="hireDate"> <el-form-item label="入职日期" prop="hireDate">
<el-date-picker <el-date-picker
@@ -96,7 +96,7 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> --> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注"> <el-form-item label="备注">
@@ -113,8 +113,7 @@
</template> </template>
<script lang="ts" name="SystemUserForm" setup> <script lang="ts" name="SystemUserForm" setup>
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
// import { defaultProps, handleTree } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import { handleTree } from '@/utils/tree'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import * as RoleApi from '@/api/system/role' import * as RoleApi from '@/api/system/role'
@@ -175,7 +174,7 @@ const open = async (type: string, id?: number) => {
} }
} }
// 加载部门树 // 加载部门树
deptList.value = handleTree(await DeptApi.getSimpleDeptList({ allFlag: false })) deptList.value = handleTree(await DeptApi.getSimpleDeptList())
// 加载岗位列表 // 加载岗位列表
roleOptions.value = await RoleApi.getSimpleRoleList() roleOptions.value = await RoleApi.getSimpleRoleList()
} }

View File

@@ -1,100 +1,105 @@
<template> <template>
<!-- <el-row :gutter="20"> --> <el-row :gutter="20">
<!-- 左侧部门树 --> <!-- 左侧部门树 -->
<!-- <el-col :span="4" :xs="24"> <el-col :span="4" :xs="24">
<DeptTree @node-click="handleDeptNodeClick" /> <DeptTree @node-click="handleDeptNodeClick" />
</el-col> </el-col>
<el-col :span="20" :xs="24"> --> <el-col :span="20" :xs="24">
<!-- 搜索 --> <!-- 搜索 -->
<el-form :model="queryParams" ref="queryFormRef" inline label-width="0"> <el-form :model="queryParams" ref="queryFormRef" inline label-width="68px">
<el-form-item prop="nickname"> <el-form-item label="姓名" prop="nickname">
<el-input <el-input
v-model="queryParams.nickname" v-model="queryParams.nickname"
placeholder="请输入姓名" placeholder="请输入姓名"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item prop="mobile"> <el-form-item label="手机号码" prop="mobile">
<el-input <el-input
v-model="queryParams.mobile" v-model="queryParams.mobile"
placeholder="请输入手机号码" placeholder="请输入手机号码"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery" v-hasPermi="['basic:employee:search']">搜索</el-button> <el-button @click="handleQuery" v-hasPermi="['basic:employee:search']">搜索</el-button>
<el-button @click="resetQuery" v-hasPermi="['basic:employee:reset']">重置</el-button> <el-button @click="resetQuery" v-hasPermi="['basic:employee:reset']">重置</el-button>
<el-button <el-button
type="primary" type="primary"
plain plain
@click="openForm('create')" @click="openForm('create')"
v-hasPermi="['basic:employee:add']" v-hasPermi="['basic:employee:add']"
> >
新增 新增
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="用户编号" key="id" prop="id" /> <el-table-column label="用户编号" key="id" prop="id" />
<el-table-column label="登录账号" prop="username" /> <el-table-column label="登录账号" prop="username" />
<el-table-column label="用户姓名" prop="nickname" /> <el-table-column label="用户姓名" prop="nickname" />
<!-- <el-table-column label="部门" key="deptName" prop="deptName" /> --> <el-table-column label="部门" key="deptName" prop="deptName" />
<el-table-column label="手机号码" prop="mobile" width="120" /> <el-table-column label="手机号码" prop="mobile" width="120" />
<el-table-column label="状态" key="status"> <el-table-column label="状态" key="status">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
:active-value="0" :active-value="0"
:inactive-value="1" :inactive-value="1"
active-text="在职" active-text="在职"
inactive-text="离职" inactive-text="离职"
v-hasPermi="['basic:employee:update']" v-hasPermi="['basic:employee:update']"
@change="handleStatusChange(scope.row)" @change="handleStatusChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="createTime"
width="180"
:formatter="dateFormatter"
/> />
</template> <el-table-column label="操作" width="260">
</el-table-column> <template #default="scope">
<el-table-column label="创建时间" prop="createTime" width="180" :formatter="dateFormatter" /> <el-button
<el-table-column label="操作" width="260"> type="primary"
<template #default="scope"> link
<el-button @click="openForm('update', scope.row.id)"
type="primary" v-hasPermi="['basic:employee:update']"
link >
@click="openForm('update', scope.row.id)" 修改
v-hasPermi="['basic:employee:update']" </el-button>
> <el-button
修改 type="primary"
</el-button> link
<el-button @click="handleDelete(scope.row.id)"
type="primary" v-hasPermi="['basic:employee:delete']"
link >
@click="handleDelete(scope.row.id)" 删除
v-hasPermi="['basic:employee:delete']" </el-button>
> <el-button
删除 type="primary"
</el-button> link
<el-button @click="handleResetPwd(scope.row)"
type="primary" v-hasPermi="['basic:employee:password']"
link >
@click="handleResetPwd(scope.row)" 重置密码
v-hasPermi="['basic:employee:password']" </el-button>
> </template>
重置密码 </el-table-column>
</el-button> </el-table>
</template> <Pagination
</el-table-column> :total="total"
</el-table> v-model:page="queryParams.pageNo"
<Pagination v-model:limit="queryParams.pageSize"
:total="total" @pagination="getList"
v-model:page="queryParams.pageNo" />
v-model:limit="queryParams.pageSize" </el-col>
@pagination="getList" </el-row>
/>
<!-- </el-col> -->
<!-- </el-row> -->
<!-- 添加或修改用户对话框 --> <!-- 添加或修改用户对话框 -->
<UserForm ref="formRef" @success="getList" /> <UserForm ref="formRef" @success="getList" />
@@ -104,7 +109,7 @@ import { CommonStatusEnum } from '@/utils/constants'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import UserForm from './UserForm.vue' import UserForm from './UserForm.vue'
// import DeptTree from './DeptTree.vue' import DeptTree from './DeptTree.vue'
const message = useMessage() // 消息弹窗 const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
@@ -145,11 +150,11 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
// /** 处理部门被点击 */ /** 处理部门被点击 */
// const handleDeptNodeClick = async (row) => { const handleDeptNodeClick = async (row) => {
// queryParams.deptId = row.id queryParams.deptId = row.id
// await getList() await getList()
// } }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()

View File

@@ -267,18 +267,14 @@ async function getList() {
return pre.concat(cur.userDingAttendanceRespVOList) return pre.concat(cur.userDingAttendanceRespVOList)
}, []) }, [])
} else { } else {
tableList.value = data.list.map((it, index) => { tableList.value = data.list.map((it, index) => ({
const arr = it.userDingAttendanceRespVOList.filter((user) => user.needAttendance) ...it,
return { userDingAttendanceRespVOList: it.userDingAttendanceRespVOList.sort((pre, cur) =>
...it, pre.employeeName.localeCompare(cur.employeeName)
userDingAttendanceRespVOList: multiFieldSort(arr, [ ),
{ key: 'dept' }, id: index + 1,
{ key: 'employeeName' } edit: it.status == 1 ? '2' : '0'
]), }))
id: index + 1,
edit: it.status == 1 ? '2' : '0'
}
})
} }
total.value = data.total total.value = data.total
} catch (err) { } catch (err) {
@@ -288,32 +284,6 @@ async function getList() {
} }
} }
function multiFieldSort(arr, fields) {
return arr.sort((a, b) => {
// 遍历每个排序字段
for (const field of fields) {
const { key, order = 'asc' } = field
const valueA = a[key]
const valueB = b[key]
// 处理不同类型的比较
let compareResult
if (typeof valueA === 'number' && typeof valueB === 'number') {
compareResult = valueA - valueB // 数字比较
} else {
compareResult = String(valueA).localeCompare(String(valueB)) // 字符串比较(兼容其他类型)
}
// 如果当前字段值不相等,直接返回比较结果(根据排序方向调整)
if (compareResult !== 0) {
return order === 'desc' ? -compareResult : compareResult
}
}
// 所有字段都相等,保持原有顺序
return 0
})
}
function spanMethod({ row, columnIndex }) { function spanMethod({ row, columnIndex }) {
if (row.userDingAttendanceRespVOList && row.userDingAttendanceRespVOList.length > 0) { if (row.userDingAttendanceRespVOList && row.userDingAttendanceRespVOList.length > 0) {
if (columnIndex === 0) { if (columnIndex === 0) {

View File

@@ -1,96 +1,7 @@
<template> <template>
<div> <div> 首页 </div>
<el-card shadow="never">
<el-skeleton :loading="loading" animated>
<el-row :gutter="20" justify="space-between">
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
<div class="flex items-center">
<img :src="avatar" alt="" class="w-40px h-40px rounded-[50%] mr-20px" />
<div class="text-20px text-700">
{{ t('workplace.welcome') }} {{ username }} {{ t('workplace.happyDay') }}
</div>
</div>
</el-col>
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
<div class="flex h-40px items-center justify-end <sm:mt-10px">
<div
class="px-8px text-right"
@click="router.push({ path: '/Okr/okr-wait', query: { type: 1 } })"
>
<div class="text-14px text-red-600 mb-20px">今日待办</div>
<CountTo
class="text-20px number-font"
:start-val="0"
:end-val="waitCount.dayEndAgentWorkNum"
:duration="2600"
/>
</div>
<el-divider direction="vertical" border-style="dashed" />
<div
class="px-8px text-right"
@click="router.push({ path: '/Okr/okr-wait', query: { type: 2 } })"
>
<div class="text-14px text-gray-400 mb-20px">我的待办</div>
<CountTo
class="text-20px number-font"
:start-val="0"
:end-val="waitCount.myAgentWorkNum"
:duration="2600"
/>
</div>
</div>
</el-col>
</el-row>
</el-skeleton>
</el-card>
</div>
</template> </template>
<script setup lang="ts" name="Home">
import { useUserStore } from '@/store/modules/user'
import avatarImg from '@/assets/imgs/avatar.gif'
import { getWaitCount } from '@/api/okr/wait'
const { t } = useI18n() <script setup name="Home"></script>
const userStore = useUserStore()
const router = useRouter() // 路由对象
const loading = ref(false)
const avatar = userStore.getUser.avatar ? userStore.getUser.avatar : avatarImg
const username = userStore.getUser.nickname
function getWaitTargetCount() { <style lang="scss" scoped></style>
getWaitCount({}).then((res) => {
waitCount.value = res
})
}
const waitCount = ref({
dayEndAgentWorkNum: 0,
myAgentWorkNum: 0,
urgeAgentWorkNum: 0,
notifyNum: 0
})
const getAllApi = async () => {
await getWaitTargetCount()
loading.value = false
}
onMounted(() => {
getAllApi()
})
</script>
<style lang="scss" scoped>
@font-face {
font-family: numberFont;
src: url('@/assets/fonts/DISPLAY FREE TFB.ttf');
}
.number-font {
font-family: numberFont !important;
}
:deep(.el-card__header) {
padding: 10px;
}
</style>

View File

@@ -308,24 +308,9 @@
<span v-if="row.status == 0">封存</span> <span v-if="row.status == 0">封存</span>
<span v-else-if="row.status == 1">已封存</span> <span v-else-if="row.status == 1">已封存</span>
</el-button> </el-button>
<el-button <el-button type="primary" v-if="row.grantId" text @click="handleDetail(row)">
type="primary"
v-if="row.grantId"
style="padding: 0"
text
@click="handleDetail(row)"
>
提成明细 提成明细
</el-button> </el-button>
<el-button
type="primary"
text
v-hasPermi="['home:salary:send']"
style="padding: 0"
@click="handelSendNotic(row)"
>
发送工资条
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -392,10 +377,9 @@ async function getList() {
} else { } else {
tableList.value = data.list.map((it, index) => ({ tableList.value = data.list.map((it, index) => ({
...it, ...it,
userSalaryGrantRespVOList: multiFieldSort(it.userSalaryGrantRespVOList, [ userSalaryGrantRespVOList: it.userSalaryGrantRespVOList.sort((pre, cur) =>
{ key: 'dept' }, pre.name.localeCompare(cur.name)
{ key: 'name' } ),
]),
id: index + 1, id: index + 1,
edit: it.status == 1 ? '2' : '0' edit: it.status == 1 ? '2' : '0'
})) }))
@@ -408,32 +392,6 @@ async function getList() {
} }
} }
function multiFieldSort(arr, fields) {
return arr.sort((a, b) => {
// 遍历每个排序字段
for (const field of fields) {
const { key, order = 'asc' } = field
const valueA = a[key]
const valueB = b[key]
// 处理不同类型的比较
let compareResult
if (typeof valueA === 'number' && typeof valueB === 'number') {
compareResult = valueA - valueB // 数字比较
} else {
compareResult = String(valueA).localeCompare(String(valueB)) // 字符串比较(兼容其他类型)
}
// 如果当前字段值不相等,直接返回比较结果(根据排序方向调整)
if (compareResult !== 0) {
return order === 'desc' ? -compareResult : compareResult
}
}
// 所有字段都相等,保持原有顺序
return 0
})
}
const createSalaryRef = ref() const createSalaryRef = ref()
function craeteSalary() { function craeteSalary() {
createSalaryRef.value.open() createSalaryRef.value.open()
@@ -510,20 +468,6 @@ async function handleDetail(row) {
console.log(error) console.log(error)
} }
} }
function handelSendNotic(row) {
const name = row.grantId ? row.name : row.period
const params = row.grantId ? { grantId: row.grantId } : { period: row.period }
message.confirm('确认要发送"' + name + '"工资条吗?').then(async () => {
try {
await SalaryApi.sendSalaryNotice(params)
message.success('发送成功!')
} catch (error) {
message.error(error)
console.log(error)
}
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -12,7 +12,7 @@
<el-date-picker <el-date-picker
v-model="form.effectiveDate" v-model="form.effectiveDate"
type="date" type="date"
:disabled="!!form.id" :disabled="form.id"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="选择日期时间" placeholder="选择日期时间"

View File

@@ -127,8 +127,6 @@ const formLogin = ref()
const { validForm } = useFormValid(formLogin) const { validForm } = useFormValid(formLogin)
const { setLoginState, getLoginState } = useLoginState() const { setLoginState, getLoginState } = useLoginState()
const { currentRoute, push } = useRouter() const { currentRoute, push } = useRouter()
const route = useRoute()
const permissionStore = usePermissionStore() const permissionStore = usePermissionStore()
const redirect = ref('') const redirect = ref('')
const loginLoading = ref(false) const loginLoading = ref(false)
@@ -219,12 +217,9 @@ const handleLogin = async (params) => {
if (redirect.value.indexOf('sso') !== -1) { if (redirect.value.indexOf('sso') !== -1) {
window.location.href = window.location.href.replace('/login?redirect=', '') window.location.href = window.location.href.replace('/login?redirect=', '')
} else { } else {
push({ push({ path: redirect.value || permissionStore.addRouters[0].path })
path: redirect.value || permissionStore.addRouters[0].path,
query: route.redirectedFrom?.query
})
} }
} catch (err) { } catch {
loginLoading.value = false loginLoading.value = false
} finally { } finally {
setTimeout(() => { setTimeout(() => {
@@ -234,12 +229,10 @@ const handleLogin = async (params) => {
} }
} }
// const routerParams = ref(undefined)
watch( watch(
() => currentRoute.value, () => currentRoute.value,
(route1) => { (route) => {
redirect.value = route1?.redirectedFrom?.path redirect.value = route?.query?.redirect
// routerParams.value = route?.redirectedFrom?.query
}, },
{ {
immediate: true immediate: true

View File

@@ -1,602 +0,0 @@
<template>
<div>
<el-row class="mb-10px flex justify-between items-start">
<el-tree-select
v-model="searchForm.nodeId"
:data="peroidList"
:props="defaultProps"
:render-after-expand="false"
:default-expand-all="false"
check-strictly
style="width: 300px"
@change="nodeChange"
/>
<div class="flex justify-end flex-1">
<el-button type="info" @click="handleExport">导出</el-button>
<el-popover
ref="countRef"
placement="left"
:title="`${currentNode?.nodeName} 数据汇总`"
trigger="click"
width="500px"
v-model:visible="showCountPop"
>
<template #reference><el-button>数据汇总</el-button></template>
<el-table :data="countInfo" stripe>
<el-table-column prop="keyResultShowName" label="项目名称" />
<el-table-column prop="currentValue" label="当前值" width="90" />
<el-table-column prop="targetValue" label="预期值" width="90" />
<el-table-column label="完成度" width="150">
<template #default="{ row }">
<el-progress
:percentage="parseInt((row.currentValue / row.targetValue) * 100) || 0"
:color="customColors"
/>
</template>
</el-table-column>
</el-table>
</el-popover>
<el-button type="primary" @click="openDrawer(1, currentNode.nodeId, currentNode.nodeName)">
节点笔谈
</el-button>
</div>
</el-row>
<el-table
id="okrAnalysisTable"
:data="originList"
border
:span-method="objectSpanMethod"
:show-summary="!!tableKeywords"
@cell-click="handleClickCell"
>
<el-table-column prop="objectInfo.objectiveName" label="目标">
<template #default="{ row }">
{{ row.objectInfo.objectiveName }}
</template>
</el-table-column>
<!-- <el-table-column prop="objectiveId" label="占比" width="100px">
<template #default> 0 </template>
</el-table-column> -->
<el-table-column prop="keyResultShowName">
<template #header>
<div class="flex items-center justify-center">
<div class="flex-1 mr-10px">
<el-input
v-if="showTableSearch"
v-model="tableKeywords"
placeholder="请输入关键字"
size="small"
style="width: 100%"
clearable
@change="handleTableFilter"
/>
<div v-else>关键成果</div>
</div>
<el-button type="primary" size="small" @click="handleFilterTableClick">
{{ showTableSearch ? '取消' : '筛选' }}
</el-button>
</div>
</template>
<template #default="{ row }">
{{ row.sourceName ? `${row.sourceName}` : '' }} {{ row.keyResultShowName }}
</template>
</el-table-column>
<el-table-column prop="targetValue" label="目标值" width="100px" />
<el-table-column prop="currentValue" label="当前进度" width="100px" />
<el-table-column label="开始日期" width="120px">
<template #default>
{{ currentNode.startTime }}
</template>
</el-table-column>
<el-table-column prop="status" label="完成状态" width="100px">
<template #default="{ row }">
<el-tag v-if="row.currentValue >= row.targetValue" type="success">完成</el-tag>
<el-tag v-else type="danger">未完成</el-tag>
</template>
</el-table-column>
<el-table-column prop="muis" label="差值" width="100px">
<template #default="{ row }">
<span
:style="{
color: row.targetValue >= row.currentValue ? 'red' : '#333',
'font-weight': row.targetValue >= row.currentValue ? 'bold' : '500'
}"
>
{{ parseInt(row.targetValue - row.currentValue) }}
</span>
</template>
</el-table-column>
<el-table-column prop="complete" label="完成度" width="200px">
<template #default="{ row }">
<el-progress :percentage="parseInt(row.progress)" :color="customColors" />
</template>
</el-table-column>
<el-table-column prop="endTime" label="结束日期" width="120px">
<template #default>
{{ currentNode.endTime }}
</template>
</el-table-column>
<el-table-column prop="objectInfo.progress" label="目标完成度" width="100px" align="center">
<template #default="{ row }">
{{ parseInt(row.objectInfo.progress) }}%
<!-- <el-progress :percentage="parseInt(row.objectInfo.progress)" :color="customColors" /> -->
</template>
</el-table-column>
</el-table>
<el-drawer
v-if="showDrawer"
v-model="showDrawer"
:title="drawerTitle"
size="60vw"
direction="rtl"
append-to-body
destroy-on-close
>
<el-tabs v-model="currentType" @tab-click="searchCommentList()">
<el-tab-pane
v-for="item in commentTypeOptions"
:key="item.id"
:label="item.label"
:name="item.id"
>
<div v-if="item.id == currentType">
<div v-if="addNewComment">
<div class="flex justify-between items-center">
<div>
<el-button size="small" @click="addNewComment = false"> 取消 </el-button>
<el-button type="primary" size="small" @click="handleSaveComment">
发布
</el-button>
</div>
</div>
<div class="mt-10px" v-if="addNewComment">
<Editor
v-model:modelValue="form.commentValue"
height="300px"
:toolbarConfig="toolbarConfig"
/>
</div>
</div>
<el-button v-else type="primary" size="small" @click="handleInsertComment">
新增
</el-button>
<div
v-for="(it, index) in commentList"
:key="it.commentId"
class="border-b-1"
style="padding: 10px 5px"
>
<div
class="flex items-center justify-between overflow-hidden text-16px"
style="line-height: 30px"
>
<div class="flex items-center">
<el-avatar
shape="circle"
style="
background-color: var(--el-color-primary-light-3);
width: 30px;
height: 30px;
"
fit="fill"
>
<span class="text-12px">{{ it.creatorName.slice(-2) }}</span>
</el-avatar>
<div class="ml-10px text-16px">{{ it.creatorName }}</div>
</div>
</div>
<div class="ml-10px" v-dompurify-html="it.content"></div>
<div
class="ml-10px mt-10px flex items-center justify-between text-12px"
style="line-height: 20px; color: #aaa"
>
<div class="flex items-center">
<div class="flex items-center mr-50px">
<el-button link @click="good(it)">
<Icon
icon="fa:thumbs-o-up"
:size="16"
:color="it.currentUserIsLike ? 'var(--el-color-primary)' : '#333'"
/>
</el-button>
<span
class="ml-5px"
:style="{
color: it.currentUserIsLike ? 'var(--el-color-primary)' : '#333'
}"
>{{ it.likeCount }}</span
>
</div>
<div class="flex items-center mr-50px">
<el-button link @click="showChildComment(index)">
<Icon icon="ep:chat-dot-square" :size="16" color="#333" />
</el-button>
<span class="ml-5px" style="color: #333">{{ it.commentCount }}</span>
</div>
</div>
<div class="ml-10px text-13px text-gray-400">
{{ formatDate(it.createTime, 'YYYY-MM-DD HH:mm') }}
</div>
</div>
<!-- 评论 -->
<div
v-if="showCommentIndex == index"
class="bg-gray-100 pl-10px pr-10px pt-5px pb-5px"
style="margin: 10px 10px 0 10px; border-radius: 4px"
label="笔谈"
>
<div
v-for="subComment in it.children.sort((a, b) => a.createTime - b.createTime)"
:key="subComment.commentId"
class="text-14px"
style="line-height: 24px"
>
<span class="font-bold">{{ subComment.creatorName }}</span>
<span>
{{ subComment.content }}
</span>
</div>
<div class="mt-10px relative">
<!-- <el-input
v-model="form.commentValue"
placeholder="请输入评论"
type="textarea"
:autosize="{ minRows: 4 }"
clearable
size="small"
style="width: 100%"
/> -->
<el-mention
v-model="form.commentValue"
type="textarea"
:autosize="{ minRows: 4 }"
:options="employeeOptions"
style="width: 100%"
size="small"
whole
placeholder="请输入内容"
@select="handleMention"
>
<template #label="scope">
<div class="flex items-center justify-between h-full">
<span class="text-14px text-dark-700">{{ scope.item.name }}</span>
<span class="text-12px text-gray-400">{{ scope.item.dept }}</span>
</div>
</template>
</el-mention>
<el-button
type="primary"
size="small"
style="position: absolute; right: 2px; bottom: 2px"
@click="handleSendCommnet(index)"
>
发布
</el-button>
</div>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</el-drawer>
</div>
</template>
<script setup name="Analysis">
import { listToTree, findNode } from '@/utils/tree'
import { formatDate } from '@/utils/formatTime'
import { getAllNodeTree, getAllOkrPage, getOkrStatisticsTotal } from '@/api/okr/okr'
import { getEmployeeSimpleList } from '@/api/pers/employee'
import { cloneDeep } from 'lodash-es'
import {
getCommentTypeOptions,
createComment,
getCommentPage,
likeComment
} from '@/api/okr/comment'
import { exportTableWithVue } from '@/utils'
const message = useMessage()
const defaultProps = {
value: 'nodeId',
label: 'nodeName',
children: 'children'
}
const searchForm = ref({
nodeId: undefined
})
const currentNode = ref(undefined)
const showDrawer = ref(false)
const drawerTitle = ref('详情')
const customColors = [
{ color: 'rgb(196, 86.4, 86.4)', percentage: 20 },
{ color: 'rgb(196, 86.4, 86.4)', percentage: 40 },
{ color: 'rgb(237.5, 189.9, 118.5)', percentage: 60 },
{ color: 'rgb(159.5, 206.5, 255)', percentage: 80 },
{ color: 'rgb(179, 224.5, 156.5)', percentage: 100 }
]
const peroidList = ref([])
const showTableSearch = ref(false)
const tableKeywords = ref('')
handleSearchPeroid()
getOptions()
// 当前是否是叶子节点
// 如果不是叶子节点,则表格数据不可修改
const isCurrentLeafNode = ref(false)
function handleSearchPeroid() {
getAllNodeTree().then((resp) => {
if (resp.nodeId) {
peroidList.value = listToTree(resp?.tree || [], {
id: 'nodeId',
pid: 'parentId',
children: 'children'
})
nodeChange(resp.nodeId)
currentNode.value = (resp.tree || []).find((item) => item.nodeId === resp.nodeId)
} else {
message.warning('请先创建节点数据')
}
})
}
const showCountPop = ref(false)
function nodeChange(nodeId) {
if (nodeId) {
showTableSearch.value = false
tableKeywords.value = ''
searchForm.value.nodeId = nodeId
getOkrList()
getCountInfo()
currentNode.value = findNode(peroidList.value, (node) => {
return node.nodeId == nodeId
})
searchForm.value.creatorId = currentNode.value.creatorId
if (!currentNode.value.children || currentNode.value.children.length == 0) {
isCurrentLeafNode.value = true
} else {
isCurrentLeafNode.value = false
}
}
}
const originList = ref([])
const defaultTableList = ref([])
const spanObj = ref([])
function getOkrList() {
getAllOkrPage(searchForm.value).then((resp) => {
originList.value = []
spanObj.value = []
if (resp && resp.length) {
resp.map((o) => {
if (o.keyResults && o.keyResults.length) {
const arr = o.keyResults.map((k, index) => {
spanObj.value.push(index == 0 ? o.keyResults.length : 0)
const obj = cloneDeep(o)
delete obj.keyResults
return {
...k,
objectInfo: obj
}
})
originList.value = [...originList.value, ...arr]
}
})
defaultTableList.value = [...originList.value]
}
})
}
const countInfo = ref([])
function getCountInfo() {
getOkrStatisticsTotal({ nodeId: searchForm.value.nodeId }).then(async (resp) => {
countInfo.value = resp || []
// await nextTick(() =)
showCountPop.value = true
})
}
function objectSpanMethod({ column, rowIndex }) {
if (['目标', '目标完成度'].includes(column.label)) {
let _row = spanObj.value[rowIndex]
let _col = _row > 0 ? 1 : 0
return {
rowspan: _row,
colspan: _col
}
}
}
function handleClickCell(row, column) {
if (column.property === 'keyResultShowName') {
openDrawer(2, row.keyResultId, `${row.sourceName} ${row.keyResultShowName}`)
} else if (column.property === 'objectInfo.objectiveName') {
openDrawer(3, row.objectInfo.objectiveId, row.objectInfo.objectiveName)
}
}
const commentTypeOptions = ref([])
const currentType = ref(1) // 默认评论类型为1
function getOptions() {
getCommentTypeOptions().then((resp) => {
commentTypeOptions.value = (resp || []).sort((pre, cur) => pre.sort - cur.sort)
currentType.value = resp[0].id
})
getEmployeeSimpleList({ status: 0 }).then((resp) => {
employeeOptions.value = resp.map((item) => ({
...item,
label: item.name,
value: item.name
}))
})
}
const commentList = ref([])
const commentInfo = ref({
businessType: undefined,
businessId: undefined,
commentType: undefined,
pageSize: -1
})
function openDrawer(type, id, name) {
showDrawer.value = true
drawerTitle.value = `${name}】笔谈`
commentInfo.value = {
businessType: type,
businessId: id,
commentType: currentType.value,
pageSize: -1
}
searchCommentList()
}
function searchCommentList() {
commentInfo.value.commentType = currentType.value
getCommentPage(commentInfo.value).then((resp) => {
// commentList.value = resp.list
commentList.value = listToTree(resp.list, {
id: 'commentId',
pid: 'parentId',
children: 'children'
})
})
}
const showCommentIndex = ref(-1)
function showChildComment(index) {
showCommentIndex.value = showCommentIndex.value == index ? -1 : index
}
function good(item) {
likeComment(item.commentId).then(() => {
message.success('点赞成功')
searchCommentList()
})
}
const form = ref({
commentValue: '',
mentionedUserIdList: []
})
const employeeOptions = ref([])
function handleMention(item) {
form.value.mentionedUserIdList.push(item.id)
}
function handleSendCommnet(idx) {
try {
// 过滤掉删除的用户方式为遍历mentionedUserIdList查找评论中是否有对应的用户名
const userList = [...form.value.mentionedUserIdList]
const arr = []
userList.map((item) => {
if (form.value.commentValue.indexOf(`@${item.name}`) != -1) {
arr.push(item.id)
// 然后移除对应的用户名,防止有多个
form.value.commentValue = form.value.commentValue.replace(`@${item.name}`, '')
}
})
const data = {
businessType: commentInfo.value.businessType,
businessId: commentInfo.value.businessId,
commentType: currentType.value,
content: form.value.commentValue,
mentionedUserIdList: arr,
parentId: commentList.value[idx].commentId
}
createComment(data)
.then(() => {
message.success('创建成功')
searchCommentList()
})
.finally(() => {
form.value.commentValue = ''
})
} catch (error) {
console.log(error)
message.error('创建失败')
}
}
const addNewComment = ref(false)
function handleInsertComment() {
addNewComment.value = true
form.value.commentValue = commentTypeOptions.value.find(
(item) => item.id == currentType.value
).remark
}
const toolbarConfig = {
toolbarKeys: [
'bold', // 加粗
'underline', // 下划线
'italic', // 斜体
'color', // 文字颜色
'bgColor', // 背景色
'fontSize', // 字号
'bulletedList', // 无序列表
'numberedList', // 有序列表
'insertTable', // 插入表格
'insertLink', // 插入链接
'undo' // 撤销
]
}
function handleSaveComment() {
addNewComment.value = false
try {
const data = {
businessType: commentInfo.value.businessType,
businessId: commentInfo.value.businessId,
commentType: currentType.value,
content: form.value.commentValue,
mentionedUserIdList: form.value.mentionedUserIdList
}
createComment(data)
.then(() => {
message.success('创建成功')
searchCommentList()
})
.finally(() => {
form.value.commentValue = ''
})
} catch (error) {
message.error('创建失败')
}
}
function handleExport() {
exportTableWithVue('#okrAnalysisTable', `OKR分析报表-${currentNode.value.nodeName}`)
}
function handleTableFilter() {
console.log('tableKeywords', tableKeywords.value)
if (tableKeywords.value) {
originList.value = defaultTableList.value.filter(
(item) =>
item.keyResultShowName.includes(tableKeywords.value) ||
item.sourceName.includes(tableKeywords.value)
)
} else {
originList.value = [...defaultTableList.value]
}
}
function handleFilterTableClick() {
showTableSearch.value = !showTableSearch.value
if (!showTableSearch.value) {
tableKeywords.value = ''
originList.value = [...defaultTableList.value]
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="flex flex-col w-full h-full p-4 bg-white rounded-lg shadow-md overflow-hidden"> <div>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<el-row> <el-row>
<el-tree-select <el-tree-select
@@ -16,21 +16,13 @@
</el-row> </el-row>
<el-row> <el-row>
<el-button type="info" @click="handleShowOkr(searchForm.nodeId)"> 节点详情 </el-button> <el-button type="info" @click="handleShowOkr(searchForm.nodeId)"> 节点详情 </el-button>
<el-button <el-button type="warning" @click="handleEditOkr(searchForm.nodeId)">
type="warning"
v-if="currentUserId == searchForm.creatorId"
@click="handleEditOkr(searchForm.nodeId)"
>
修改当前节点 修改当前节点
</el-button> </el-button>
<el-button <el-button type="success" @click="handleUpdateProcess">更新进度</el-button>
type="success"
v-if="searchForm.executor?.includes(currentUserId)"
@click="handleUpdateProcess"
>更新进度</el-button
>
</el-row> </el-row>
</div> </div>
<OkrTable ref="okrTableRef" :canEdit="isCurrentLeafNode" /> <OkrTable ref="okrTableRef" :canEdit="isCurrentLeafNode" />
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" /> <DialogOkr ref="dialogOkr" @edit="handleEditOkr" />
<DialogOkrInfo ref="dialogOkrInfo" @success="handleSearchPeroid" /> <DialogOkrInfo ref="dialogOkrInfo" @success="handleSearchPeroid" />
@@ -44,11 +36,8 @@ import DialogOkr from './DialogOkr.vue'
import { getAllNodeTree, getAllOkrPage } from '@/api/okr/okr' import { getAllNodeTree, getAllOkrPage } from '@/api/okr/okr'
import { listToTree, findNode } from '@/utils/tree' import { listToTree, findNode } from '@/utils/tree'
import { useUserStore } from '@/store/modules/user'
const message = useMessage() const message = useMessage()
const userStore = useUserStore()
const currentUserId = userStore.getUser.id
const defaultProps = { const defaultProps = {
value: 'nodeId', value: 'nodeId',
@@ -63,7 +52,9 @@ const searchForm = ref({
const peroidList = ref([]) const peroidList = ref([])
handleSearchPeroid() onMounted(() => {
handleSearchPeroid()
})
// 当前是否是叶子节点 // 当前是否是叶子节点
// 如果不是叶子节点,则表格数据不可修改 // 如果不是叶子节点,则表格数据不可修改
@@ -71,46 +62,34 @@ const isCurrentLeafNode = ref(false)
function handleSearchPeroid() { function handleSearchPeroid() {
getAllNodeTree().then((resp) => { getAllNodeTree().then((resp) => {
if (resp.nodeId) { peroidList.value = listToTree(resp.tree, {
peroidList.value = listToTree(resp?.tree || [], { id: 'nodeId',
id: 'nodeId', pid: 'parentId',
pid: 'parentId', children: 'children'
children: 'children' })
}) nodeChange(resp.nodeId)
nodeChange(resp.nodeId)
} else {
message.warning('请先创建节点数据')
}
}) })
} }
function nodeChange(nodeId) { function nodeChange(nodeId) {
if (nodeId) { searchForm.value.nodeId = nodeId
searchForm.value.nodeId = nodeId getOkrList()
getOkrList() const currentNode = findNode(peroidList.value, (node) => {
const currentNode = findNode(peroidList.value, (node) => { return node.nodeId == nodeId
return node.nodeId == nodeId })
}) if (!currentNode.children || currentNode.children.length == 0) {
searchForm.value.creatorId = currentNode.creatorId isCurrentLeafNode.value = true
if (!currentNode.children || currentNode.children.length == 0) { } else {
isCurrentLeafNode.value = true isCurrentLeafNode.value = false
} else {
isCurrentLeafNode.value = false
}
} }
} }
function getOkrList() { function getOkrList() {
getAllOkrPage(searchForm.value).then((resp) => { getAllOkrPage(searchForm.value).then((resp) => {
const list = resp const list = resp
if (list && list.length > 0) { nextTick(() => {
nextTick(() => { okrTableRef.value.prepareData(list)
okrTableRef.value.prepareData(list) })
})
} else {
// 如果没有数据,清空表格
okrTableRef.value.prepareData([])
}
}) })
} }
@@ -119,9 +98,9 @@ function handleAddNode() {
dialogOkrInfo.value.open('create', null) dialogOkrInfo.value.open('create', null)
} }
function handleEditOkr(nodeId = undefined) { function handleEditOkr() {
dialogOkr.value.close() dialogOkr.value.close()
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2) dialogOkrInfo.value.open('update', searchForm.value.nodeId)
} }
function handleUpdateProcess() { function handleUpdateProcess() {
@@ -135,8 +114,7 @@ const dialogOkr = ref(null)
function handleShowOkr(id) { function handleShowOkr(id) {
dialogOkr.value.open({ dialogOkr.value.open({
nodeId: id, nodeId: id,
canEdit: isCurrentLeafNode.value, canEdit: isCurrentLeafNode.value
queryType: 2
}) })
} }
</script> </script>

View File

@@ -18,31 +18,11 @@
<span class="text-14px ml-0.25">ork落地</span> <span class="text-14px ml-0.25">ork落地</span>
<div class="ml-20px text-14px"> <div class="ml-20px text-14px">
<span>节点</span> <span>节点</span>
<span <span>{{ nodeInfo.allNodeName }}</span>
v-for="(item, index) in nodeInfo.parentNodes"
:key="item.nodeId"
@click="handleChildItem(item)"
>
<span
class="cursor-pointer"
:style="{
color: index < nodeInfo.parentNodes.length - 1 ? '#409eff' : '#333',
borderBottom:
index < nodeInfo.parentNodes.length - 1 ? '1px solid #409eff' : 'none'
}"
>
{{ item.nodeName }}
</span>
<span v-if="index != nodeInfo.parentNodes.length - 1"> -> </span>
</span>
</div> </div>
</div> </div>
<div class="flex items-center"> <div class="flex items-center">
<el-button <el-button link @click="emit('edit')">
v-if="nodeInfo.creatorId == currentUserId"
link
@click="emit('edit', nodeInfo.nodeId)"
>
<el-tooltip content="编辑" placement="top" effect="dark"> <el-tooltip content="编辑" placement="top" effect="dark">
<Icon icon="ep:edit" :size="16" /> <Icon icon="ep:edit" :size="16" />
</el-tooltip> </el-tooltip>
@@ -67,7 +47,7 @@
</div> </div>
<div class="basic-title-item"> <div class="basic-title-item">
<div class="basic-title-label">执行人</div> <div class="basic-title-label">执行人</div>
<div class="basic-title-value">{{ nodeInfo.executorName || '无' }}</div> <div class="basic-title-value">{{ nodeInfo.executorName }}</div>
</div> </div>
<div class="basic-title-item"> <div class="basic-title-item">
<div class="basic-title-label">目标数</div> <div class="basic-title-label">目标数</div>
@@ -75,7 +55,7 @@
</div> </div>
<div class="basic-title-item" style="min-width: 200px"> <div class="basic-title-item" style="min-width: 200px">
<div class="basic-title-label">总体进度</div> <div class="basic-title-label">总体进度</div>
<el-progress :percentage="parseInt(nodeInfo.progress) || 0" :stroke-width="8" /> <el-progress :percentage="nodeInfo.progress || 0" :stroke-width="8" />
</div> </div>
</div> </div>
<div class="flex detail-basic-info"> <div class="flex detail-basic-info">
@@ -92,21 +72,21 @@
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<el-button v-if="canEdit" class="sav-btn" type="primary" @click="handleSaveProcess"> <el-button class="sav-btn" type="primary" @click="handleSaveProcess">
保存并更新 保存并更新
</el-button> </el-button>
</div> </div>
</div> </div>
<div class="dialog-okr-side pl-10px"> <div class="dialog-okr-side pl-10px">
<el-tabs v-model="sideIndex" style="flex: 1; height: 100%"> <el-tabs v-model="sideIndex" style="flex: 1; height: 100%">
<el-tab-pane label="子节点" name="subNode" key=" "> <el-tab-pane label="子节点" name="subNode">
<div class="overflow-y-auto" style="height: calc(100% - 50px)"> <div class="overflow-y-auto" style="height: calc(100% - 50px)">
<div <div
v-for="item in childNodeList" v-for="item in childNodeList"
:key="item.nodeId" :key="item.nodeId"
class="border-b-1 child-item" class="border-b-1 child-item"
style="padding: 10px 5px; cursor: pointer" style="padding: 10px 5px; cursor: pointer"
@click="handleChildItem(item)" @click="handleChildItem"
> >
<div <div
class="flex justify-between items-center overflow-hidden text-16px" class="flex justify-between items-center overflow-hidden text-16px"
@@ -115,21 +95,21 @@
<div class="child-label">节点{{ item.nodeName }}</div> <div class="child-label">节点{{ item.nodeName }}</div>
<el-progress <el-progress
type="line" type="line"
:percentage="parseInt(item.progress) || 0" :percentage="item.progress || 0"
:stroke-width="6" :stroke-width="6"
style="width: 120px" style="width: 120px"
/> />
</div> </div>
<div class="ml-10px flex items-center text-13px" style="line-height: 30px"> <div class="ml-10px flex items-center text-13px" style="line-height: 30px">
<span>目标数</span> <span>目标数</span>
<span style="color: #aaa">{{ item.objectiveNum }}</span> <span style="color: #aaa">{{ item.objectiveCount }}</span>
<el-divider direction="vertical" style="margin: 0 20px" /> <el-divider direction="vertical" style="margin: 0 20px" />
<div <div
class="flex-1 overflow-hidden h-30px" class="flex-1 overflow-hidden h-30px"
style="text-overflow: ellipsis; white-space: nowrap" style="text-overflow: ellipsis; white-space: nowrap"
> >
<span>执行人</span> <span>执行人</span>
<span style="color: #aaa">{{ item.executorName || '无' }}</span> <span style="color: #aaa">{{ item.executorName }}</span>
</div> </div>
</div> </div>
<div <div
@@ -143,45 +123,44 @@
</div> </div>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="笔谈" name="conclusion" key="conclusion"> <el-tab-pane label="评论" name="conclusion">
<div class="relative overflow-y-auto" style="height: calc(100% - 50px)"> <div class="relative overflow-y-auto" style="height: calc(100% - 50px)">
<div v-if="addNewComment"> <div class="flex justify-between items-center">
<div class="flex justify-between items-center"> <el-select
<el-select v-if="addNewComment"
v-model="form.commentType" v-model="form.commentType"
filterable filterable
size="small" size="small"
style="width: 120px" style="width: 120px"
@change="getCommentTemplate" @change="getCommentTemplate"
> >
<el-option <el-option
v-for="it in commentTypeOptions" v-for="it in commentTypeOptions"
:label="it.label" :label="it.label"
:value="it.id" :value="it.id"
:key="it.id" :key="it.id"
/>
</el-select>
<div>
<el-button size="small" @click="addNewComment = false"> 取消 </el-button>
<el-button type="primary" size="small" @click="handleSaveComment">
发布
</el-button>
</div>
</div>
<div class="mt-10px" v-if="addNewComment">
<Editor
v-model:modelValue="form.commentValue"
height="300px"
:toolbarConfig="toolbarConfig"
/> />
</el-select>
<div v-if="addNewComment">
<el-button size="small" @click="addNewComment = false"> 取消 </el-button>
<el-button type="primary" size="small" @click="handleSaveComment">
发布
</el-button>
</div> </div>
<el-button v-else type="primary" size="small" @click="handleInsertComment">
新增评论
</el-button>
</div>
<div class="mt-10px" v-if="addNewComment">
<Editor
v-model:modelValue="form.commentValue"
height="300px"
:toolbarConfig="toolbarConfig"
/>
</div> </div>
<el-button v-else type="primary" size="small" @click="handleInsertComment">
新增笔谈
</el-button>
<div <div
v-for="(it, index) in commentList" v-for="it in commentList"
:key="it.commentId" :key="it.commentId"
class="border-b-1" class="border-b-1"
style="padding: 10px 5px" style="padding: 10px 5px"
@@ -200,42 +179,28 @@
" "
fit="fill" fit="fill"
> >
<span class="text-12px">{{ it.creatorName.slice(-2) }}</span> <span class="text-12px">{{ it.creatorName }}</span>
</el-avatar> </el-avatar>
<div class="ml-10px text-16px">{{ it.creatorName }}</div> <div class="ml-10px text-16px">{{ it.creatorName }}</div>
</div> </div>
<div class="ml-10px text-13px text-gray-400">{{ it.createTime }}</div>
</div> </div>
<div class="ml-10px" v-dompurify-html="it.content"></div> <div class="ml-10px" v-dompurify-html="it.content"></div>
<div <div
class="ml-10px mt-10px flex items-center justify-between text-12px" class="ml-10px mt-10px flex items-center text-12px"
style="line-height: 20px; color: #aaa" style="line-height: 20px; color: #aaa"
> >
<div class="flex items-center"> <div class="flex items-center mr-50px">
<div class="flex items-center mr-50px"> <el-button link @click="good(index)">
<el-button link @click="good(it)"> <Icon icon="fa:thumbs-o-up" :size="16" />
<Icon </el-button>
icon="fa:thumbs-o-up" <span class="ml-5px">{{ it.likeCount }}</span>
:size="16"
:color="it.currentUserIsLike ? 'var(--el-color-primary)' : '#333'"
/>
</el-button>
<span
class="ml-5px"
:style="{
color: it.currentUserIsLike ? 'var(--el-color-primary)' : '#333'
}"
>{{ it.likeCount }}</span
>
</div>
<div class="flex items-center mr-50px">
<el-button link @click="showComment(index)">
<Icon icon="ep:chat-dot-square" :size="16" color="#333" />
</el-button>
<span class="ml-5px" style="color: #333">{{ it.commentCount }}</span>
</div>
</div> </div>
<div class="ml-10px text-13px text-gray-400"> <div class="flex items-center mr-50px">
{{ formatDate(it.createTime, 'YYYY-MM-DD HH:mm') }} <el-button link @click="showComment(index)">
<Icon icon="ep:chat-dot-square" :size="16" />
</el-button>
<span class="ml-5px">{{ it.commentCount }}</span>
</div> </div>
</div> </div>
<!-- 评论 --> <!-- 评论 -->
@@ -243,21 +208,24 @@
v-if="showCommentIndex == index" v-if="showCommentIndex == index"
class="bg-gray-100 pl-10px pr-10px pt-5px pb-5px" class="bg-gray-100 pl-10px pr-10px pt-5px pb-5px"
style="margin: 10px 10px 0 10px; border-radius: 4px" style="margin: 10px 10px 0 10px; border-radius: 4px"
label="笔谈" label="评论"
> >
<div <div class="text-14px" style="line-height: 24px">
v-for="subComment in it.children.sort((a, b) => a.createTime - b.createTime)" <span class="font-bold">武大郎</span>
:key="subComment.commentId"
class="text-14px"
style="line-height: 24px"
>
<span class="font-bold">{{ subComment.creatorName }}</span>
<span> <span>
{{ subComment.content }} 大官人你要脆饼不要卖完最后一个我要回家了我家婆娘熬了鸡汤给我补身子
</span> </span>
</div> </div>
<div class="text-14px" style="line-height: 24px">
<span class="font-bold">潘金莲</span>
<span>西门大官人我要给你生猴子(^_-)</span>
</div>
<div class="text-14px" style="line-height: 24px">
<span class="font-bold">武二郎</span>
<span>如同天上降魔主真乃人间太岁</span>
</div>
<div class="mt-10px relative"> <div class="mt-10px relative">
<!-- <el-input <el-input
v-model="form.commentValue" v-model="form.commentValue"
placeholder="请输入评论" placeholder="请输入评论"
type="textarea" type="textarea"
@@ -265,30 +233,12 @@
clearable clearable
size="small" size="small"
style="width: 100%" style="width: 100%"
/> --> />
<el-mention
v-model="form.commentValue"
type="textarea"
:autosize="{ minRows: 4 }"
:options="employeeOptions"
style="width: 100%"
size="small"
whole
placeholder="请输入笔谈"
@select="handleMention"
>
<template #label="{ item }">
<div class="flex items-center justify-between h-full">
<span class="text-14px text-dark-700">{{ item.name }}</span>
<span class="text-12px text-gray-400">{{ item.dept }}</span>
</div>
</template>
</el-mention>
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
style="position: absolute; right: 2px; bottom: 2px" style="position: absolute; right: 2px; bottom: 2px"
@click="handleSendCommnet(index)" @click="handleSendCommnet"
> >
发布 发布
</el-button> </el-button>
@@ -297,7 +247,7 @@
</div> </div>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="进度历史" name="history" key="history"> <el-tab-pane label="进度历史" name="history">
<div class="overflow-y-auto pl-15px" style="height: calc(100% - 50px)"> <div class="overflow-y-auto pl-15px" style="height: calc(100% - 50px)">
<el-timeline class="ml-10px"> <el-timeline class="ml-10px">
<el-timeline-item <el-timeline-item
@@ -327,32 +277,11 @@ import { formatDate } from '@/utils/formatTime'
import OkrTable from './OkrTable.vue' import OkrTable from './OkrTable.vue'
import { getOkrNodeDetail, getOkrNodeHistory } from '@/api/okr/okr' import { getOkrNodeDetail, getOkrNodeHistory } from '@/api/okr/okr'
import { import { getCommentTypeOptions, createComment, getCommentPage } from '@/api/okr/comment'
getCommentTypeOptions,
createComment,
getCommentPage,
likeComment
} from '@/api/okr/comment'
import { listToTree } from '@/utils/tree'
import { getEmployeeSimpleList } from '@/api/pers/employee'
import { useUserStore } from '@/store/modules/user'
const message = useMessage() const emit = defineEmits(['edit'])
const userStore = useUserStore()
const currentUserId = userStore.getUser.id
const emit = defineEmits(['edit', 'close'])
const show = ref(false) const show = ref(false)
watch(
() => show.value,
(newValue, oldValue) => {
if (oldValue && !newValue) {
emit('close', nodeInfo.value)
}
}
)
const canEdit = ref(false) const canEdit = ref(false)
const toolbarConfig = { const toolbarConfig = {
@@ -382,26 +311,18 @@ const nodeInfo = ref({})
const nodeRecords = ref([]) const nodeRecords = ref([])
const commentTypeOptions = ref([]) const commentTypeOptions = ref([])
const queryType = ref(1) async function open(curNode) {
function open(curNode) {
canEdit.value = curNode.canEdit canEdit.value = curNode.canEdit
nodeInfo.value.nodeId = curNode.nodeId nodeInfo.value.nodeId = curNode.nodeId
queryType.value = curNode.queryType
// 获取数据详情 // 获取数据详情
searchInfo(curNode) searchInfo(curNode)
show.value = true show.value = true
} }
const employeeOptions = ref([])
function searchInfo(curNode) { function searchInfo(curNode) {
try { try {
getOkrNodeDetail({ nodeId: curNode.nodeId, queryType: queryType.value }).then((resp) => { getOkrNodeDetail(curNode.nodeId).then((resp) => {
nodeInfo.value = { nodeInfo.value = resp
...resp,
executor: resp.executor || []
}
canEdit.value = canEdit.value && nodeInfo.value.executor.includes(currentUserId + '')
if (resp.objectives) { if (resp.objectives) {
okrList.value = resp.objectives.map((item) => ({ okrList.value = resp.objectives.map((item) => ({
...item, ...item,
@@ -418,13 +339,6 @@ function searchInfo(curNode) {
getOkrNodeHistory(curNode.nodeId).then((resp) => { getOkrNodeHistory(curNode.nodeId).then((resp) => {
nodeRecords.value = resp nodeRecords.value = resp
}) })
getEmployeeSimpleList({ status: 0 }).then((resp) => {
employeeOptions.value = resp.map((item) => ({
...item,
label: item.name,
value: item.name
}))
})
getCommentTypeOptions().then((resp) => { getCommentTypeOptions().then((resp) => {
commentTypeOptions.value = resp commentTypeOptions.value = resp
}) })
@@ -439,29 +353,21 @@ function close() {
defineExpose({ open, close }) defineExpose({ open, close })
function handleMention(item) {
form.value.mentionedUserIdList.push(item.id)
}
function handleSaveProcess() { function handleSaveProcess() {
okrTableRef.value.updateProcess(nodeInfo.value.nodeId).then(() => { okrTableRef.value.updateProcess(nodeInfo.value.nodeId).then(() => {
message.success('更新成功') message.success('更新成功')
searchInfo({ nodeId: nodeInfo.value.nodeId }) searchInfo()
}) })
} }
function handleChildItem(item) { function handleChildItem() {
const arr = item.executor || [] console.log('handleChildItem')
const isExecutor = arr.includes(currentUserId)
canEdit.value = isExecutor && (!item.children || item.children.length == 0)
searchInfo(item)
} }
const addNewComment = ref(false) const addNewComment = ref(false)
const form = ref({ const form = ref({
commentValue: '', commentValue: '',
commentType: undefined, commentType: undefined
mentionedUserIdList: []
}) })
function handleInsertComment() { function handleInsertComment() {
addNewComment.value = true addNewComment.value = true
@@ -492,20 +398,15 @@ function handleSaveComment() {
businessType: 1, businessType: 1,
businessId: nodeInfo.value.nodeId, businessId: nodeInfo.value.nodeId,
contentType: 1, contentType: 1,
commentType: form.value.commentType,
content: form.value.commentValue, content: form.value.commentValue,
mentionedUserIdList: form.value.mentionedUserIdList mentionedUserIdList: form.value.mentionedUserIdList
} }
createComment(data) createComment(data).then(() => {
.then(() => { message.success('评论成功')
message.success('笔谈成功') searchCommentList()
searchCommentList() })
})
.finally(() => {
form.value.commentValue = ''
})
} catch (error) { } catch (error) {
message.error('笔谈失败') message.error('评论失败')
} }
} }
const commentList = ref([]) const commentList = ref([])
@@ -515,21 +416,14 @@ function searchCommentList() {
businessType: 1, businessType: 1,
businessId: nodeInfo.value.nodeId, businessId: nodeInfo.value.nodeId,
pageNum: 1, pageNum: 1,
pageSize: -1 pageSize: 100
}).then((resp) => { }).then((resp) => {
commentList.value = listToTree(resp.list, { commentList.value = resp.list
id: 'commentId',
pid: 'parentId',
children: 'children'
})
}) })
} }
function good(item) { function good(index) {
likeComment(item.commentId).then(() => { console.log(index)
message.success('点赞成功')
searchCommentList()
})
} }
const showCommentIndex = ref(-1) const showCommentIndex = ref(-1)
@@ -537,39 +431,8 @@ function showComment(index) {
showCommentIndex.value = showCommentIndex.value == index ? -1 : index showCommentIndex.value = showCommentIndex.value == index ? -1 : index
} }
function handleSendCommnet(idx) { function handleSendCommnet() {
try { console.log(form.value.commentValue)
// 过滤掉删除的用户方式为遍历mentionedUserIdList查找评论中是否有对应的用户名
const userList = [...form.value.mentionedUserIdList]
const arr = []
userList.map((item) => {
if (form.value.commentValue.indexOf(`@${item.name}`) != -1) {
arr.push(item.id)
// 然后移除对应的用户名,防止有多个
form.value.commentValue = form.value.commentValue.replace(`@${item.name}`, '')
}
})
const data = {
businessType: 1,
businessId: nodeInfo.value.nodeId,
contentType: 1,
commentType: form.value.commentType,
content: form.value.commentValue,
mentionedUserIdList: arr,
parentId: commentList.value[idx].commentId
}
createComment(data)
.then(() => {
message.success('创建成功')
searchCommentList()
})
.finally(() => {
form.value.commentValue = ''
})
} catch (error) {
console.log(error)
message.error('创建失败')
}
} }
</script> </script>
@@ -653,9 +516,8 @@ function handleSendCommnet(idx) {
} }
} }
.content-wrap { .content-wrap {
display: flex; overflow-y: auto;
flex-direction: column; max-height: calc(100% - 70px);
height: calc(100% - 15px);
} }
} }
.dialog-okr-side { .dialog-okr-side {

View File

@@ -1,7 +1,7 @@
<template> <template>
<el-dialog <el-dialog
v-model="show" v-model="show"
width="88vw" width="900px"
class="dialog-okr" class="dialog-okr"
:show-close="false" :show-close="false"
:close-on-click-modal="false" :close-on-click-modal="false"
@@ -120,20 +120,10 @@
class="flex items-center w-full" class="flex items-center w-full"
v-for="(item, i) in objectList" v-for="(item, i) in objectList"
:key="item.objectiveId" :key="item.objectiveId"
style="padding-bottom: 5px"
> >
<div class="flex-1 w-100px"> <div class="flex-1 w-100px">
<div class="flex items-center"> <div class="flex items-center">
<el-tooltip content="点击可折叠/展开目标" placement="top" effect="dark"> <el-tag type="success" class="mr-10px">O{{ i + 1 }}</el-tag>
<el-tag
type="success"
class="mr-10px"
@click="item.hideChild = !item.hideChild"
>
O{{ i + 1 }}
</el-tag>
</el-tooltip>
<el-input <el-input
v-model="item.objectiveName" v-model="item.objectiveName"
placeholder="目标名称" placeholder="目标名称"
@@ -145,7 +135,6 @@
placeholder="选择执行人,可多选" placeholder="选择执行人,可多选"
multiple multiple
clearable clearable
collapse-tags
filterable filterable
style="width: 240px; margin-left: 10px" style="width: 240px; margin-left: 10px"
> >
@@ -172,7 +161,7 @@
<el-button type="danger" text @click="removeObj(i)">删除目标</el-button> <el-button type="danger" text @click="removeObj(i)">删除目标</el-button>
</div> </div>
</div> </div>
<div v-if="!item.hideChild" style="background: #f0f3fa; padding-bottom: 10px"> <div style="background: #f0f3fa; padding-bottom: 15px">
<div <div
class="ml-50px" class="ml-50px"
v-for="(kr, index) in item.keyResults" v-for="(kr, index) in item.keyResults"
@@ -203,7 +192,7 @@
</div> </div>
<div class="mt-5px flex items-center"> <div class="mt-5px flex items-center">
<el-tree-select <el-tree-select
v-model="kr.source" v-model="kr.sourceId"
:data="sourceOptions" :data="sourceOptions"
:props="defaultProps" :props="defaultProps"
check-strictly check-strictly
@@ -213,10 +202,10 @@
node-key="sourceId" node-key="sourceId"
placeholder="请选择渠道" placeholder="请选择渠道"
/> />
<!-- <el-radio-group v-model="kr.resultType" class="ml-10px"> <el-radio-group v-model="kr.resultType" class="ml-10px">
<el-radio-button :value="1">目标值</el-radio-button> <el-radio-button :value="1">目标值</el-radio-button>
<el-radio-button :value="2">/</el-radio-button> <el-radio-button :value="2">/</el-radio-button>
</el-radio-group> --> </el-radio-group>
<el-input <el-input
v-if="kr.resultType == 1" v-if="kr.resultType == 1"
@@ -255,10 +244,6 @@
<el-option label="公开" :value="1" /> <el-option label="公开" :value="1" />
<el-option label="仅上级可见" :value="2" /> <el-option label="仅上级可见" :value="2" />
</el-select> </el-select>
<el-radio-group v-model="kr.isCount" class="ml-10px">
<el-radio :label="true" :value="true">参与统计</el-radio>
<el-radio :label="false" :value="false">不参与统计</el-radio>
</el-radio-group>
</div> </div>
</div> </div>
</div> </div>
@@ -347,8 +332,7 @@ import {
createOkrNode, createOkrNode,
updateOkrNode, updateOkrNode,
getAllOkrPage, getAllOkrPage,
getDefaultOkrOptions, getDefaultOkrOptions
getChannelOptions
} from '@/api/okr/okr' } from '@/api/okr/okr'
import { listToTree } from '@/utils/tree' import { listToTree } from '@/utils/tree'
import { getEmployeeSimpleList } from '@/api/pers/employee' import { getEmployeeSimpleList } from '@/api/pers/employee'
@@ -394,7 +378,7 @@ const defaultProps = {
} }
const sourceOptions = ref([]) const sourceOptions = ref([])
const objectList = ref([]) const objectList = ref([])
function open(type, val, queryType) { function open(type, val) {
show.value = true show.value = true
title.value = type == 'update' ? '修改Okr' : '新增Okr' title.value = type == 'update' ? '修改Okr' : '新增Okr'
formType.value = type formType.value = type
@@ -412,20 +396,10 @@ function open(type, val, queryType) {
getDefaultOkrOptions().then((resp) => { getDefaultOkrOptions().then((resp) => {
krOptions.value = resp krOptions.value = resp
}) })
getChannelOptions().then((resp) => {
sourceOptions.value = listToTree(resp, {
id: 'sourceId',
pid: 'parentId',
children: 'children'
})
})
if (val) { if (val) {
formLoading.value = true formLoading.value = true
try { try {
getOkrNodeDetail({ getOkrNodeDetail(val).then((resp) => {
nodeId: val,
queryType
}).then((resp) => {
form.value = resp form.value = resp
if (resp.objectives) { if (resp.objectives) {
objectList.value = resp.objectives.map((item) => ({ objectList.value = resp.objectives.map((item) => ({
@@ -449,7 +423,7 @@ function resetForm() {
startTime: undefined, startTime: undefined,
endTime: undefined, endTime: undefined,
executor: [], executor: [],
dataScope: 2 dataScope: 1
} }
} }
@@ -462,9 +436,9 @@ const emit = defineEmits(['success', 'close']) // 定义 success 事件,用于
function addObjective() { function addObjective() {
objectList.value.push({ objectList.value.push({
objectiveName: '', objectiveName: '',
executor: form.value.executor || [], executor: [],
keyResults: [], keyResults: [],
dataScope: form.value.dataScope || 2 dataScope: 1
}) })
} }
@@ -481,8 +455,7 @@ function AddKR(idx) {
process: undefined, process: undefined,
currentValue: undefined, currentValue: undefined,
executor: obj.executor, executor: obj.executor,
dataScope: obj.dataScope, dataScope: obj.dataScope
isCount: false
}) })
} }
@@ -495,7 +468,7 @@ function removeKR(oIdx, krIdx) {
} }
function addChildNode() { function addChildNode() {
childNodeList.value.push({ dataScope: 2 }) childNodeList.value.push({})
} }
function removeChildNode(idx) { function removeChildNode(idx) {
@@ -536,32 +509,9 @@ async function handleSave() {
if (!formRef.value) return if (!formRef.value) return
const valid = await formRef.value.validate() const valid = await formRef.value.validate()
if (!valid) return if (!valid) return
form.value.executor = form.value.executor || []
if (form.value.executor.length > 1) {
message
.confirm('是否按照当前节点所选的多个执行人自动新增对应的员工节点?', {
type: 'warning',
showCancelButton: true,
cancelButtonText: '不新增员工节点',
confirmButtonText: '新增员工节点'
})
.then(() => {
saveOkrData(true)
})
.catch(() => {
saveOkrData(false)
})
} else {
saveOkrData(false)
}
}
async function saveOkrData(isAutoAddChild = false) {
// 提交请求 // 提交请求
formLoading.value = true formLoading.value = true
try { try {
form.value.isAutoAddChild = isAutoAddChild
form.value.objectives = objectList.value form.value.objectives = objectList.value
form.value.children = childNodeList.value form.value.children = childNodeList.value
if (formType.value === 'create') { if (formType.value === 'create') {
@@ -577,34 +527,24 @@ async function saveOkrData(isAutoAddChild = false) {
2, 2,
'0' '0'
)}-${getLastDayOfMonth(defaultTime.getFullYear(), month)}`, )}-${getLastDayOfMonth(defaultTime.getFullYear(), month)}`,
dataScope: form.value.dataScope, children: [
executor: form.value.executor {
// children: [ nodeName: `${month + 1}月第1周`,
// { children: []
// nodeName: `${month + 1}月第1周`, },
// dataScope: form.value.dataScope, {
// executor: form.value.executor, nodeName: `${month + 1}月第2周`,
// children: [] children: []
// }, },
// { {
// nodeName: `${month + 1}月第2周`, nodeName: `${month + 1}月第3周`,
// dataScope: form.value.dataScope, children: []
// executor: form.value.executor, },
// children: [] {
// }, nodeName: `${month + 1}月第4周`,
// { children: []
// nodeName: `${month + 1}月第3周`, }
// dataScope: form.value.dataScope, ]
// executor: form.value.executor,
// children: []
// },
// {
// nodeName: `${month + 1}月第4周`,
// dataScope: form.value.dataScope,
// executor: form.value.executor,
// children: []
// }
// ]
}) })
} }
} }

View File

@@ -4,7 +4,7 @@
<el-form <el-form
:model="form" :model="form"
ref="formRef" ref="formRef"
:disabled="['do', 'detail'].includes(formType)" :disabled="formType == 'do'"
:rules="rules" :rules="rules"
label-width="80px" label-width="80px"
class="flex-1" class="flex-1"
@@ -237,11 +237,9 @@ const rules = ref({
const followList = ref([]) const followList = ref([])
function open(type, id) { async function open(type, id) {
show.value = true show.value = true
title.value = { create: '新增待办', update: '修改待办', do: '更新待办进度', detail: '待办详情' }[ title.value = { create: '新增待办', update: '修改待办', do: '更新待办进度' }[type]
type
]
formType.value = type formType.value = type
resetForm() resetForm()
if (id) { if (id) {

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="h-full flex flex-col"> <div>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<el-row> <el-row>
<el-tree-select <el-tree-select
@@ -13,12 +13,11 @@
/> />
</el-row> </el-row>
<el-row> <el-row>
<el-button type="info" @click="handleShowOkr(searchForm.nodeId)"> 节点详情 </el-button>
<el-button type="success" @click="handleUpdateProcess">更新进度</el-button> <el-button type="success" @click="handleUpdateProcess">更新进度</el-button>
</el-row> </el-row>
</div> </div>
<OkrTable ref="okrTableRef" canEdit /> <OkrTable ref="okrTableRef" @row-click="handleShowOkr" />
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" /> <DialogOkr ref="dialogOkr" @edit="handleEditOkr" />
<DialogOkrInfo ref="dialogOkrInfo" /> <DialogOkrInfo ref="dialogOkrInfo" />
</div> </div>
@@ -47,13 +46,13 @@ const searchForm = ref({
const peroidList = ref([]) const peroidList = ref([])
// onMounted(() => { onMounted(() => {
handleSearchPeroid() handleSearchPeroid()
// }) })
function handleSearchPeroid() { async function handleSearchPeroid() {
getMyNodeTree().then((resp) => { getMyNodeTree().then((resp) => {
peroidList.value = listToTree(resp?.tree || [], { peroidList.value = listToTree(resp.tree, {
id: 'nodeId', id: 'nodeId',
pid: 'parentId', pid: 'parentId',
children: 'children' children: 'children'
@@ -63,17 +62,12 @@ function handleSearchPeroid() {
}) })
} }
function getOkrList() { async function getOkrList() {
getMyOkrPage(searchForm.value).then((resp) => { getMyOkrPage(searchForm.value).then((resp) => {
const list = resp const list = resp
if (list && list.length > 0) { nextTick(() => {
nextTick(() => { okrTableRef.value.prepareData(list)
okrTableRef.value.prepareData(list) })
})
} else {
// 如果没有数据,清空表格
okrTableRef.value.prepareData([])
}
}) })
} }
@@ -82,25 +76,19 @@ const dialogOkrInfo = ref(null)
// dialogOkrInfo.value.open('create', null) // dialogOkrInfo.value.open('create', null)
// } // }
function handleEditOkr(nodeId = undefined) { function handleEditOkr() {
dialogOkr.value.close() dialogOkr.value.close()
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 1) dialogOkrInfo.value.open('update', 1)
} }
function handleUpdateProcess() { function handleUpdateProcess() {
okrTableRef.value.updateProcess(searchForm.value.nodeId).then(() => { message.success('更新进度成功')
message.success('更新成功') getOkrList()
getOkrList()
})
} }
const dialogOkr = ref(null) const dialogOkr = ref(null)
function handleShowOkr(id) { function handleShowOkr(row) {
dialogOkr.value.open({ dialogOkr.value.open(row.id)
nodeId: id,
canEdit: true,
queryType: 1
})
} }
</script> </script>

View File

@@ -1,125 +0,0 @@
<template>
<div class="h-full flex flex-col">
<div class="flex items-center justify-between">
<el-row>
<el-tree-select
v-model="searchForm.nodeId"
:data="peroidList"
:props="defaultProps"
:render-after-expand="false"
:default-expand-all="false"
style="width: 400px"
@change="nodeChange"
/>
</el-row>
<el-row>
<el-button type="info" @click="handleShowOkr(searchForm.nodeId)"> 节点详情 </el-button>
<el-button
type="warning"
v-if="currentUserId == searchForm.creatorId"
@click="handleEditOkr(searchForm.nodeId)"
>
修改当前节点
</el-button>
</el-row>
</div>
<OkrTable ref="okrTableRef" canEdit />
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" />
<DialogOkrInfo ref="dialogOkrInfo" @success="handleSearchPeroid" />
</div>
</template>
<script setup name="MySon">
import OkrTable from './OkrTable.vue'
import DialogOkr from './DialogOkr.vue'
import DialogOkrInfo from './DialogOkrInfo.vue'
import { listToTree, findNode } from '@/utils/tree'
import { useUserStore } from '@/store/modules/user'
import { getMySonNodeTree, getMySonOkrPage } from '@/api/okr/okr'
const props = defineProps({
userId: {
type: Number,
default: undefined
}
})
const defaultProps = {
value: 'nodeId',
label: 'nodeName',
children: 'children'
}
const userStore = useUserStore()
const currentUserId = userStore.getUser.id
const okrTableRef = ref(null)
const searchForm = ref({
nodeId: undefined
})
const peroidList = ref([])
handleSearchPeroid()
function handleSearchPeroid() {
getMySonNodeTree({ userId: props.userId }).then((resp) => {
peroidList.value = listToTree(resp?.tree || [], {
id: 'nodeId',
pid: 'parentId',
children: 'children'
})
nodeChange(resp.nodeId)
})
}
function getOkrList() {
getMySonOkrPage({
...searchForm.value,
userId: props.userId
}).then((resp) => {
if (resp && resp.length > 0) {
nextTick(() => {
okrTableRef.value.prepareData(resp)
})
} else {
// 如果没有数据,清空表格
okrTableRef.value.prepareData([])
}
})
}
function nodeChange(nodeId) {
searchForm.value.nodeId = nodeId
getOkrList()
const currentNode = findNode(peroidList.value, (node) => {
return node.nodeId == nodeId
})
searchForm.value.creatorId = currentNode.creatorId
}
const dialogOkr = ref(null)
function handleShowOkr(id) {
dialogOkr.value.open({
nodeId: id,
canEdit: true,
queryType: 2
})
}
const dialogOkrInfo = ref(null)
function handleEditOkr(nodeId = undefined) {
dialogOkr.value.close()
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2)
}
</script>
<style lang="scss" scoped>
:deep(.el-overlay-dialog) {
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -6,7 +6,7 @@
<div class="flex items-center border-1px w-300px h-32px p-10px peroid-select"> <div class="flex items-center border-1px w-300px h-32px p-10px peroid-select">
<Icon icon="ep:calendar" style="color: #aaa" /> <Icon icon="ep:calendar" style="color: #aaa" />
<span class="text-14px ml-10px" style="color: #aaa"> <span class="text-14px ml-10px" style="color: #aaa">
{{ searchForm.nodeName ? searchForm.nodeName : '选择周期' }} {{ searchForm.peroidName ? searchForm.peroidName : '选择周期' }}
</span> </span>
</div> </div>
</template> </template>
@@ -15,13 +15,11 @@
<el-table :data="peroidList" @row-click="handleSelectPeroid"> <el-table :data="peroidList" @row-click="handleSelectPeroid">
<el-table-column label="节点名称"> <el-table-column label="节点名称">
<template #default="{ row }"> <template #default="{ row }">
<el-radio v-model="searchForm.nodeId" :label="row.nodeId">{{ <el-radio v-model="searchForm.peroidId" :label="row.id">{{ row.name }}</el-radio>
row.nodeName
}}</el-radio>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="开始日期" prop="startTime" width="120" /> <el-table-column label="开始日期" prop="startDate" width="120" />
<el-table-column label="截止日期" prop="endTime" width="120" /> <el-table-column label="截止日期" prop="endDate" width="120" />
</el-table> </el-table>
</div> </div>
</div> </div>
@@ -29,15 +27,7 @@
<el-button class="ml-10px" type="primary" @click="handleAddNode">新建节点</el-button> <el-button class="ml-10px" type="primary" @click="handleAddNode">新建节点</el-button>
</div> </div>
<vue3-tree-org <vue3-tree-org :data="dataList" center collapsable @on-node-click="handleClickNode">
ref="treeOrgRef"
:data="dataList"
center
collapsable
:default-expand-keys="lastExpendKeys"
:props="treeProps"
@on-node-click="handleClickNode"
>
<template #default="{ node }"> <template #default="{ node }">
<div style="cursor: pointer"> <div style="cursor: pointer">
<div class="tree-org-node__text node-label"> <div class="tree-org-node__text node-label">
@@ -45,19 +35,15 @@
<template #reference> <template #reference>
<div> <div>
<div style="max-height: 40px; overflow: hidden">{{ node.label }}</div> <div style="max-height: 40px; overflow: hidden">{{ node.label }}</div>
<div class="tip"> 目标数 {{ getNodePropData(node.id, 'objectiveNum') }}</div> <div class="tip"> 目标数 3</div>
<!-- 执行人 -->
<div class="tip">
执行人 {{ getNodePropData(node.id, 'executorName') || '无' }}
</div>
</div> </div>
</template> </template>
<template #default> <template #default>
<div style="font-size: 0.875rem; line-height: 1.5"> <div style="font-size: 0.875rem; line-height: 1.5">
<div v-for="i in getNodePropData(node.id, 'objectives')" :key="i.id" class="mt-5"> <div v-for="i in 3" :key="i" class="mt-5">
<span style="color: #aaa">{{ parseInt(i.progress) }}%</span> <span style="color: #aaa">0%</span>
<span style="margin-left: 0.5rem"> <span style="margin-left: 0.5rem">
{{ i.objectiveName }} 成交数达到10个且订单的利润不能低于成交价的30%
</span> </span>
</div> </div>
</div> </div>
@@ -65,18 +51,13 @@
</el-popover> </el-popover>
</div> </div>
<div class="p-5px"> <div class="p-5px">
<el-progress <el-progress type="line" :percentage="80" text-inside :stroke-width="12" />
type="line"
:percentage="parseInt(getNodePropData(node.id, 'progress')) || 0"
text-inside
:stroke-width="12"
/>
</div> </div>
</div> </div>
</template> </template>
</vue3-tree-org> </vue3-tree-org>
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" /> <DialogOkr ref="dialogOkr" @edit="handleEditOkr" />
<DialogOkrInfo ref="dialogOkrInfo" @close="openOkr" @success="resetTreeData" /> <DialogOkrInfo ref="dialogOkrInfo" @close="openOkr" />
</div> </div>
</template> </template>
@@ -86,108 +67,95 @@ import 'vue3-tree-org/lib/vue3-tree-org.css'
import DialogOkr from './DialogOkr.vue' import DialogOkr from './DialogOkr.vue'
import DialogOkrInfo from './DialogOkrInfo.vue' import DialogOkrInfo from './DialogOkrInfo.vue'
import { getOkrRelationTree, getOkrRelationTreeChildren } from '@/api/okr/okr' const dataList = ref({
import { listToTree } from '@/utils/tree' id: 1,
label: '寻驾全年目标',
const dataList = ref({}) noDragging: true,
const helpDataList = ref([]) disabled: true,
const lastExpendKeys = ref([]) children: [
const treeProps = { {
children: 'children', id: 2,
label: 'nodeName', pid: 1,
id: 'nodeId', label: '1月',
pid: 'parentId' noDragging: true,
} disabled: true,
children: [
{ id: 6, pid: 2, label: '第一周', noDragging: true, disabled: true },
{ id: 8, pid: 2, label: '第二周', noDragging: true, disabled: true },
{ id: 10, pid: 2, label: '第三周', noDragging: true, disabled: true },
{ id: 10, pid: 2, label: '第四周', noDragging: true, disabled: true }
]
},
{
id: 3,
pid: 1,
label: '2月',
noDragging: true,
disabled: true,
children: [
{ id: 6, pid: 2, label: '第一周', noDragging: true, disabled: true },
{ id: 8, pid: 2, label: '第二周', noDragging: true, disabled: true },
{ id: 10, pid: 2, label: '第三周', noDragging: true, disabled: true },
{ id: 10, pid: 2, label: '第四周', noDragging: true, disabled: true }
]
},
{
id: 4,
pid: 1,
label: '3月',
noDragging: true,
disabled: true,
children: [
{ id: 6, pid: 2, label: '第一周', noDragging: true, disabled: true },
{ id: 8, pid: 2, label: '第二周', noDragging: true, disabled: true },
{ id: 10, pid: 2, label: '第三周', noDragging: true, disabled: true },
{ id: 10, pid: 2, label: '第四周', noDragging: true, disabled: true }
]
}
]
})
const searchForm = ref({ const searchForm = ref({
nodeName: '', peroidName: '',
nodeId: null peroidId: null
}) })
const peroidList = ref([]) const peroidList = ref([])
handleSearchPeroid() onMounted(() => {
handleSearchPeroid()
function handleSearchPeroid() { if (!searchForm.value.peroidId && peroidList.value.length) {
lastExpendKeys.value = [] searchForm.value.peroidId = peroidList.value[0].id
getOkrRelationTree().then((resp) => { searchForm.value.peroidName = peroidList.value[0].name
peroidList.value = resp
if (resp && resp.length && !searchForm.value.nodeId) {
searchForm.value.nodeId = resp[0].nodeId
searchForm.value.nodeName = resp[0].nodeName
getOkrList()
}
})
}
const treeOrgRef = ref(null)
function resetTreeData() {
if (treeOrgRef.value) {
lastExpendKeys.value = treeOrgRef.value.getExpandKeys()
} }
handleSearchOkr()
})
// 重新获取tree数据 async function handleSearchPeroid() {
getOkrRelationTree().then((resp) => { peroidList.value = [
peroidList.value = resp {
if (resp && resp.length) { id: 1,
if (!searchForm.value.nodeId) { name: '2025年寻驾okr',
searchForm.value.nodeId = resp[0].nodeId startDate: '2022-01-01',
searchForm.value.nodeName = resp[0].nodeName endDate: '2022-01-31'
} },
getOkrRelationTreeChildren({ {
nodeId: searchForm.value.nodeId id: 2,
}).then((resp) => { name: '2024年寻驾okr',
const tree = listToTree(resp, { startDate: '2022-02-01',
id: 'nodeId', endDate: '2022-02-28'
pid: 'parentId',
children: 'children'
})
// // 设置展开的keys
// if (treeOrgRef.value) {
// treeOrgRef.value.setExpandKeys(lastExpendKeys.value)
// }
helpDataList.value = resp
if (tree && tree.length) {
dataList.value = tree[0]
} else {
dataList.value = {}
}
})
} }
}) ]
}
function getOkrList() {
getOkrRelationTreeChildren({
nodeId: searchForm.value.nodeId
}).then((resp) => {
const tree = listToTree(resp, {
id: 'nodeId',
pid: 'parentId',
children: 'children'
})
helpDataList.value = resp
if (tree && tree.length) {
dataList.value = tree[0]
} else {
dataList.value = {}
}
})
} }
function handleSelectPeroid(row) { function handleSelectPeroid(row) {
searchForm.value.nodeName = row.nodeName searchForm.value.peroidName = row.name
searchForm.value.nodeId = row.nodeId searchForm.value.peroidId = row.id
getOkrList() handleSearchOkr()
} }
function getNodePropData(nodeId, prop) { function handleSearchOkr() {
const nodeData = helpDataList.value.find((it) => it.nodeId == nodeId) console.log(searchForm.value)
if (nodeData) {
return nodeData[prop]
} else {
return ''
}
} }
function toggleExpand(data, val) { function toggleExpand(data, val) {
@@ -209,30 +177,25 @@ function toggleExpand(data, val) {
toggleExpand(dataList.value, true) toggleExpand(dataList.value, true)
const dialogOkr = ref(null) const dialogOkr = ref(null)
const clickNode = ref(null) const okrId = ref(null)
function handleClickNode(node, data) { function handleClickNode(node, data) {
clickNode.value = data okrId.value = data.id
openOkr() openOkr()
} }
function openOkr() { function openOkr() {
clickNode.value && okrId.value && dialogOkr.value.open(okrId.value)
dialogOkr.value.open({
nodeId: clickNode.value.nodeId,
queryType: 2,
canEdit: !clickNode.value.children || clickNode.value.children.length == 0
})
} }
const dialogOkrInfo = ref(null) const dialogOkrInfo = ref(null)
function handleAddNode() { function handleAddNode() {
clickNode.value = null okrId.value = null
dialogOkrInfo.value.open('create', null) dialogOkrInfo.value.open('create', null)
} }
function handleEditOkr(nodeId = undefined) { function handleEditOkr() {
dialogOkr.value.close() dialogOkr.value.close()
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2) dialogOkrInfo.value.open('update', 1)
} }
</script> </script>

View File

@@ -1,12 +1,11 @@
<template> <template>
<div class="flex-1 h-200px overflow-hidden"> <div>
<el-table <el-table
ref="tableRef" ref="tableRef"
:data="okrList" :data="okrList"
default-expand-all default-expand-all
row-key="id" row-key="id"
size="large" size="large"
height="100%"
@row-click="handleRowClick" @row-click="handleRowClick"
@expand-change="handleExpand" @expand-change="handleExpand"
> >
@@ -20,18 +19,11 @@
height: getHeight(row, $index) height: getHeight(row, $index)
}" }"
></span> ></span>
<span v-if="row.type == '目标'"> <span v-if="row.type == '目标'">目标{{ row.name }}</span>
<el-tag type="success" size="small">目标</el-tag>
{{ row.name }}
</span>
<template v-else> <template v-else>
<span class="line2"></span> <span class="line2"></span>
<span> <span>
<el-tag type="primary" size="small">关键成果</el-tag> 关键成果{{ row.channelName }} {{ row.name }}
<span class="font-bold text-black" v-if="row.sourceName">
{{ row.sourceName }}
</span>
<span>{{ row.name }}</span>
<span v-if="row.resultType == 1"> {{ row.targetValue }}</span> <span v-if="row.resultType == 1"> {{ row.targetValue }}</span>
</span> </span>
<div class="flex items-center mt-10px ml-50px"> <div class="flex items-center mt-10px ml-50px">
@@ -58,7 +50,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="progress" label="进度" width="200px"> <el-table-column prop="progress" label="进度" width="200px">
<template #default="{ row }"> <template #default="{ row }">
<el-progress :percentage="parseInt(row.progress) || 0" /> <el-progress :percentage="row.progress || 0" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="executorName" label="执行人" width="200px" /> <el-table-column prop="executorName" label="执行人" width="200px" />
@@ -82,10 +74,6 @@ const okrList = ref([])
const helpList = ref([]) const helpList = ref([])
function prepareData(list) { function prepareData(list) {
if (!list || !Array.isArray(list) || list.length === 0) {
okrList.value = []
return
}
helpList.value = [] helpList.value = []
expandedRows.value = {} expandedRows.value = {}
okrList.value = list.map((item) => { okrList.value = list.map((item) => {
@@ -106,14 +94,13 @@ function prepareData(list) {
nodeId: child.nodeId, nodeId: child.nodeId,
isSys: child.isSys, isSys: child.isSys,
processId: child.id, processId: child.id,
name: child.keyResultShowName, name: child.keyResultName,
progress: child.progress, progress: child.progress,
executorName: child.executorName, executorName: child.executorName,
type: '关键成果', type: '关键成果',
resultType: child.resultType, resultType: child.resultType,
targetValue: child.targetValue, targetValue: child.targetValue,
currentValue: Number(child.currentValue), currentValue: Number(child.currentValue)
sourceName: child.sourceName
} }
helpList.value.push(kr) helpList.value.push(kr)
return kr return kr

View File

@@ -63,7 +63,7 @@
</el-badge> </el-badge>
</template> </template>
</el-tab-pane> </el-tab-pane>
<!-- <el-tab-pane :name="4"> <el-tab-pane :name="4">
<template #label> <template #label>
<el-badge :value="tabCount.notifyNum" :max="99" :show-zero="false"> <el-badge :value="tabCount.notifyNum" :max="99" :show-zero="false">
<el-tooltip content="特指OKR中@我的消息" placement="top" effect="dark"> <el-tooltip content="特指OKR中@我的消息" placement="top" effect="dark">
@@ -85,7 +85,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-tab-pane> --> </el-tab-pane>
</el-tabs> </el-tabs>
<el-table v-if="tabIndex != 4" :data="tableList"> <el-table v-if="tabIndex != 4" :data="tableList">
@@ -139,15 +139,6 @@
> >
修改 修改
</el-button> </el-button>
<el-button
v-if="row.completeStatus == 2"
style="padding: 0; margin-right: 10px; margin-left: 0"
type="primary"
text
@click="handleDetail(row)"
>
详情
</el-button>
<el-button <el-button
v-if="row.creator == currentUserId && row.completeStatus == 1" v-if="row.creator == currentUserId && row.completeStatus == 1"
style="padding: 0; margin-right: 10px; margin-left: 0" style="padding: 0; margin-right: 10px; margin-left: 0"
@@ -174,11 +165,10 @@
<script setup name="WaitTarget"> <script setup name="WaitTarget">
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import DialogWait from './Components/DialogWait.vue' import DialogWait from './DialogWait.vue'
import { getWaitPage, deleteWait, getWaitCount, urgeWait } from '@/api/okr/wait' import { getWaitPage, deleteWait, getWaitCount, urgeWait } from '@/api/okr/wait'
const route = useRoute()
const userStore = useUserStore() const userStore = useUserStore()
const currentUserId = userStore.getUser.id const currentUserId = userStore.getUser.id
@@ -222,11 +212,6 @@ const priorityNameFilter = (priority) => {
const tabIndex = ref(1) const tabIndex = ref(1)
onMounted(() => { onMounted(() => {
if (route?.query?.type) {
tabIndex.value = Number(route.query.type)
} else {
tabIndex.value = 1
}
searchList() searchList()
}) })
@@ -252,7 +237,7 @@ function getTabCount() {
const loading = ref(false) const loading = ref(false)
const tableList = ref([]) const tableList = ref([])
// const mentionedList = ref([]) const mentionedList = ref([])
const total = ref(0) const total = ref(0)
function getList() { function getList() {
loading.value = true loading.value = true
@@ -280,10 +265,6 @@ function handleEdit(row) {
waitDialogRef.value.open('update', row.workId) waitDialogRef.value.open('update', row.workId)
} }
function handleDetail(row) {
waitDialogRef.value.open('detail', row.workId)
}
function handleDelete(row) { function handleDelete(row) {
message.confirm('确定删除待办事项吗?').then(() => { message.confirm('确定删除待办事项吗?').then(() => {
deleteWait(row.workId).then(() => { deleteWait(row.workId).then(() => {
@@ -294,17 +275,19 @@ function handleDelete(row) {
} }
function handleNotice(row) { function handleNotice(row) {
console.log(row)
message.confirm('即将发送微信通知提醒执行人,是否继续?').then(() => { message.confirm('即将发送微信通知提醒执行人,是否继续?').then(() => {
urgeWait(row.workId).then(() => { urgeWait({ workId: row.workId }).then(() => {
message.success('发送成功') message.success('发送成功')
}) })
}) })
} }
// function handleShow(row) { function handleShow(row) {
// console.log(row) console.log(row)
// message.success('okr') message.success('打开okr详情页')
// } }
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@@ -11,16 +11,16 @@
<el-tab-pane label="我负责的" name="0"> <el-tab-pane label="我负责的" name="0">
<MyDuty v-if="tabIndex == 0" /> <MyDuty v-if="tabIndex == 0" />
</el-tab-pane> </el-tab-pane>
<!-- <el-tab-pane label="待办事项" name="1"> <el-tab-pane label="待办事项" name="1">
<WaitTarget v-if="tabIndex == 1" /> <WaitTarget v-if="tabIndex == 1" />
</el-tab-pane> --> </el-tab-pane>
<el-tab-pane label="全部目标" name="2"> <el-tab-pane label="全部目标" name="2">
<AllTarget v-if="tabIndex == 2" /> <AllTarget v-if="tabIndex == 2" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="目标关系树" name="3"> <el-tab-pane label="目标关系树" name="3">
<ObjectList v-if="tabIndex == 3" /> <ObjectList v-if="tabIndex == 3" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane disabled v-if="employeeList.length > 0"> <el-tab-pane disabled>
<template #label> <template #label>
<div class="w-full"> <div class="w-full">
<el-divider <el-divider
@@ -31,14 +31,9 @@
</div> </div>
</template> </template>
</el-tab-pane> </el-tab-pane>
<el-tab-pane <el-tab-pane label="张三">张三</el-tab-pane>
v-for="item in employeeList" <el-tab-pane label="李四">李四</el-tab-pane>
:key="item.userId" <el-tab-pane label="王二">王二</el-tab-pane>
:label="item.userName"
:name="item.userId"
>
<MySon v-if="tabIndex == item.userId" :userId="item.userId" />
</el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</template> </template>
@@ -46,21 +41,11 @@
<script setup name="OkrManagement"> <script setup name="OkrManagement">
import AllTarget from './Components/AllTarget.vue' import AllTarget from './Components/AllTarget.vue'
import MyDuty from './Components/MyDuty.vue' import MyDuty from './Components/MyDuty.vue'
import MySon from './Components/MySon.vue'
import ObjectList from './Components/ObjectList.vue' import ObjectList from './Components/ObjectList.vue'
// import WaitTarget from './Components/WaitTarget.vue' import WaitTarget from './Components/WaitTarget.vue'
import { getMyMemberList } from '@/api/okr/okr'
const tabIndex = ref('0') const tabIndex = ref('0')
const height = ref(innerHeight - 115) const height = ref(innerHeight - 115)
const employeeList = ref([])
onMounted(() => {
getMyMemberList().then((res) => {
employeeList.value = res
})
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -1,550 +0,0 @@
<template>
<div>
<!-- <el-affix postion="top" :offset="95" v-if="!isDetail"> -->
<div class="flex justify-between mb-4 bg-white" v-if="!isDetail">
<b class="text-20px">{{ form.meetingId ? '修改会议' : '新增会议' }}</b>
<div>
<el-button @click="submit(true)">保存至草稿</el-button>
<el-button type="success" @click="submit(false)">保存</el-button>
</div>
</div>
<!-- </el-affix> -->
<el-form
:model="form"
ref="formRef"
:rules="rules"
label-width="120px"
v-loading="loading"
:disabled="!!isDetail"
>
<el-row :gutter="20">
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
<el-form-item label="会议主题" prop="meetingSubject">
<el-input v-model="form.meetingSubject" placeholder="请输入会议主题" clearable />
</el-form-item>
</el-col>
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
<el-form-item label="okr节点" prop="nodeId">
<el-tree-select
v-model="form.nodeId"
:data="peroidList"
:props="defaultProps"
:render-after-expand="false"
:default-expand-all="false"
check-strictly
clearable
placeholder="选择OKR节点"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24">
<el-form-item label="会议时间" prop="startTime">
<el-date-picker
v-model="form.startTime"
type="datetime"
format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm"
placeholder="请选择会议开始时间"
/>
</el-form-item>
</el-col>
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24">
<el-form-item label="预计结束时间" prop="expectEndTime">
<el-date-picker
v-model="form.expectEndTime"
type="datetime"
format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm"
placeholder="请选择预计结束时间"
/>
</el-form-item>
</el-col>
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24">
<el-form-item label="会议地点" prop="meetingRoom">
<el-input v-model="form.meetingRoom" placeholder="请输入会议地点" clearable />
</el-form-item>
</el-col>
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24">
<el-form-item label="会议状态" prop="status">
<el-select v-model="form.status" placeholder="请选择会议状态" style="width: 100%">
<el-option label="未开始" value="1" />
<el-option label="已结束" value="2" />
<el-option label="已取消" value="3" disabled />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" :offset="0">
<el-form-item label="预约参会人员" prop="expectUsers">
<el-select
v-model="form.expectUsers"
placeholder="选择参会人员"
filterable
style="width: 100%"
multiple
@change="handleUserChange"
>
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.name"
:value="item.id"
:disabled="item.status == 1 || item.id == userStore.getUser.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" :offset="0" v-if="form.meetingId">
<el-form-item label="实际参会人员" prop="actualUsers">
<el-checkbox-group v-model="form.actualUsers">
<el-checkbox
v-for="item in expectUserOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :span="24" :offset="0" v-if="form.meetingId && !isAllActived">
<el-form-item label="缺席原因" prop="absentReason">
<el-input v-model="form.absentReason" placeholder="请输入缺席原因" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24">
<el-tabs v-model="currentUserId" tab-position="top" @tab-click="userTabChange">
<el-tab-pane
v-for="item in form.meetingContentList"
:key="item.userId"
:label="item.userName"
:name="item.userId + ''"
/>
</el-tabs>
<el-tabs v-model="currentContentId" tab-position="left" addable @edit="handleTabsEdit">
<el-tab-pane
v-for="(item, index) in form.meetingContentList.find(
(it) => it.userId == currentUserId
)?.userMeetingContentList"
:key="index"
:label="'内容' + (index + 1)"
:name="index"
:closable="index > 0"
>
<div v-if="!!isDetail" v-dompurify-html="item.content" class="w-full"></div>
<Editor v-else v-model="item.content" height="500px" style="width: 100%" />
</el-tab-pane>
</el-tabs>
</el-col>
<el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" v-if="!!form.meetingId">
<div v-if="!!isDetail" v-dompurify-html="form.meetingSummary" class="w-full"></div>
<div v-else>
<el-tabs v-model="summaryIdx" addable @edit="meetingSummaryEdit">
<el-tab-pane
v-for="(item, index) in form.meetingSummaryList"
:key="index"
:label="`会议纪要${index || ''}`"
:name="index"
:closable="index > 0"
>
<Editor
v-model="item.summary"
:toolbarConfig="toolbarConfig"
height="350px"
placeholder="请输入会议纪要"
style="width: 100%"
/>
<div class="mt-10px">
<el-form-item label="是否创建待办" label-width="auto">
<el-radio-group v-model="item.isCreateAgentWork">
<el-radio :label="true" :value="true"> 创建待办 </el-radio>
<el-radio :label="false" :value="false"> 不创建待办 </el-radio>
</el-radio-group>
</el-form-item>
</div>
<div class="flex items-center" v-if="item.isCreateAgentWork">
<el-select
class="flex-1"
v-model="item.agentUserList"
placeholder="选择执行人"
clearable
filterable
multiple
>
<el-option
v-for="it in userOptions"
:key="it.id"
:label="it.name"
:value="it.id"
:disabled="it.status == 1"
/>
</el-select>
<el-date-picker
class="flex-1 ml-10px"
v-model="item.endDate"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="选择截止时间"
/>
</div>
</el-tab-pane>
</el-tabs>
<el-divider />
<div class="text-black text-12px">
如果选择创建待办请选择执行人及截止日期默认每天9:00循环提醒可于待办中修改
</div>
<div class="mt-10px">
<el-form-item label="会议纪要发送至群聊:" label-width="auto">
<el-select
filterable
clearable
v-model="form.wxId"
placeholder="请输入群聊名称"
style="width: 100%"
>
<el-option
v-for="item in groupOptions"
:key="item.wxGroupId"
:label="item.wxGroupName"
:value="item.wxGroupId"
/>
</el-select>
</el-form-item>
</div>
</div>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script setup name="MeetingInfo">
import { listToTree } from '@/utils/tree'
import { getAllNodeTree } from '@/api/okr/okr'
import { getWaitPage } from '@/api/okr/wait'
import * as MeetingApi from '@/api/okr/meeting'
import { formatDate } from '@/utils/formatTime'
import { getEmployeeSimpleList } from '@/api/pers/employee'
import { useTagsViewStore } from '@/store/modules/tagsView'
import { useUserStore } from '@/store/modules/user'
const route = useRoute()
const message = useMessage()
const tagsViewStore = useTagsViewStore()
const userStore = useUserStore()
const defaultProps = {
value: 'nodeId',
label: 'nodeName',
children: 'children'
}
const isDetail = route.query.isDetail
const currentUserId = ref(undefined)
const currentContentId = ref(0) // 默认选中第一个标签页
const summaryIdx = ref(0) // 会议纪要的索引
const toolbarConfig = {
toolbarKeys: []
}
onMounted(async () => {
getWxGroupOptions()
await getOptions()
if (route.params.id && route.params.id != 0) {
// 这里可以调用API获取会议详情数据
getMeetingInfo(route.params.id)
} else {
form.value.meetingContentList = [
{
userId: userStore.getUser.id + '',
userName: userStore.getUser.nickname,
userMeetingContentList: [
{
content: ''
}
]
}
]
currentContentId.value = 0
searchUserWait([userStore.getUser.id])
}
})
const peroidList = ref([])
function getOptions() {
return Promise.all([getAllNodeTree(), getEmployeeSimpleList()])
.then(([okrResp, employeeResp]) => {
peroidList.value = listToTree(okrResp?.tree || [], {
id: 'nodeId',
pid: 'parentId',
children: 'children'
})
userOptions.value = employeeResp.map((it) => ({ ...it, id: it.id + '' }))
form.value.expectUsers = [userStore.getUser.id + ''] // 默认添加当前用户为预约参会人员
// form.value.actualUsers = [userStore.getUser.id + '']
currentUserId.value = userStore.getUser.id + '' // 默认选中当前用户
})
.catch((error) => {
console.error('获取数据失败:', error)
})
}
const form = ref({
meetingId: undefined,
meetingSubject: '',
startTime: '',
meetingRoom: '',
expectEndTime: '',
expectUsers: [],
actualUsers: [],
okrNodeName: '',
status: '1',
meetingContent: '',
meetingSummary: '',
absentReason: '',
meetingContentList: [],
meetingSummaryList: []
})
const rules = {
meetingSubject: [{ required: true, message: '请输入会议主题', trigger: 'blur' }],
startTime: [{ required: true, message: '请选择会议开始时间', trigger: 'change' }],
expectEndTime: [{ required: true, message: '请选择预计结束时间', trigger: 'change' }],
meetingRoom: [{ required: true, message: '请输入会议地点', trigger: 'blur' }],
expectUsers: [{ required: true, message: '请选择参会人员', trigger: 'change' }]
}
const formRef = ref(null)
const userOptions = ref([])
const expectUserOptions = ref([])
const isAllActived = computed(() => {
// 判断实际参会人员是否包含所有预约参会人员
return form.value.expectUsers.every((item) => form.value.actualUsers.includes(item))
})
const loading = ref(false)
// 获取详情
const getMeetingInfo = async (meetingId) => {
try {
loading.value = true
// 调用API获取会议详情
const resp = await MeetingApi.getMeetingDetail({ meetingId })
loading.value = false
if (resp) {
let summaryList = []
if (resp.meetingSummaryList && resp.meetingSummaryList.length > 0) {
summaryList = resp.meetingSummaryList.map((item) => ({
...item,
isCreateAgentWork: !!item.isCreateAgentWork,
agentUserList: item.agentUserList ? item.agentUserList.map((it) => it + '') : []
}))
} else {
summaryList = [
{
summary: resp.meetingSummary || '',
agentUserList: [],
endDate: '',
isCreateAgentWork: true
}
]
}
form.value = {
...form.value,
...resp,
startTime: formatDate(resp.startTime, 'YYYY-MM-DD HH:mm'),
expectEndTime: formatDate(resp.expectEndTime, 'YYYY-MM-DD HH:mm'),
expectUsers: resp.expectUsers || [],
actualUsers: resp.actualUsers || [],
meetingSummaryList: summaryList
}
currentContentId.value = 0
expectUserOptions.value = userOptions.value.filter((user) =>
form.value.expectUsers.some((it) => it == user.id)
)
}
} catch (error) {
loading.value = false
console.error('获取会议详情失败:', error)
}
}
const groupOptions = ref([])
function getWxGroupOptions() {
MeetingApi.refreshWxGroupList().then(() => {
MeetingApi.getWxGroupList()
.then((resp) => {
groupOptions.value = resp || []
})
.catch((error) => {
console.error('获取微信群列表失败:', error)
})
})
}
function userTabChange() {
currentContentId.value = 0
}
function handleTabsEdit(targetName, action) {
if (action === 'add') {
form.value.meetingContentList.forEach((item) => {
if (item.userId == currentUserId.value) {
item.userMeetingContentList.push({
content: ''
})
}
})
} else if (action === 'remove') {
form.value.meetingContentList.forEach((item) => {
if (item.userId == currentUserId.value) {
item.userMeetingContentList.splice(targetName, 1)
// 如果删除的是当前选中的标签页,则切换到下一个标签页
if (currentContentId.value == targetName) {
currentContentId.value = targetName - 1
}
}
})
}
}
function meetingSummaryEdit(targetName, action) {
if (action === 'add') {
form.value.meetingSummaryList.push({
summary: '',
agentUserList: [],
endDate: '',
isCreateAgentWork: true
})
} else if (action === 'remove') {
form.value.meetingSummaryList.splice(targetName, 1)
summaryIdx.value = targetName - 1
}
}
const checkedUsers = ref([])
function handleUserChange(val) {
// 当预约参会人员变化时,更新实际参会人员选项
expectUserOptions.value = userOptions.value.filter((user) =>
form.value.expectUsers.some((it) => it == user.id)
)
if (!isDetail) {
form.value.actualUsers = [...form.value.expectUsers]
}
// 先过滤掉不存在的参会人员
form.value.meetingContentList = form.value.meetingContentList.filter((item) => {
return val.some((it) => it == item.userId)
})
// 再补充新增的
val.map((item) => {
if (!form.value.meetingContentList.some((it) => it.userId == item)) {
form.value.meetingContentList.push({
userId: item,
userName: userOptions.value.find((it) => it.id == item).name,
userMeetingContentList: [
{
content: ''
}
]
})
}
})
if (!form.value.meetingId) {
searchUserWait(val)
}
}
function searchUserWait(val) {
val.map((item) => {
if (!checkedUsers.value.includes(item)) {
checkedUsers.value.push(item)
// 新增会议时,根据参会人员拉取代办事项
getWaitPage({
pageNo: 1,
pageSize: -1,
workUserId: item,
creator: userStore.getUser.id,
completeStatus: 1
}).then((resp) => {
joinContent(resp.list)
})
}
})
}
function joinContent(arr) {
arr.map((wait) => {
let text = '<p>未完成事项:' + wait.title + '</p>'
text += wait.content
text += `<p>执行人:${wait.userNameStr}</p>`
text += `<p>截止日期:${formatDate(wait.endDate, 'YYYY-MM-DD')}</p>`
text += '<p><br></p>'
form.value.meetingContentList[0].userMeetingContentList[0].content =
text + form.value.meetingContentList[0].userMeetingContentList[0].content
})
}
const router = useRouter()
async function submit(isDraft = false) {
// 校验表单
if (!formRef.value) return
const valid = await formRef.value.validate()
if (!valid) return
try {
form.value.isDraft = isDraft
// 提交表单数据
if (form.value.meetingId) {
if (
form.value.status == 2 &&
form.value.meetingSummaryList.some((it) => it.summary.trim() == '')
) {
message.error('会议结束时,会议纪要不能为空')
return
} else {
let text = ''
form.value.meetingSummaryList.map((item, index) => {
if (form.value.meetingSummaryList.length > 1) {
text += '<p>会议纪要' + (index + 1) + '</p>'
}
text += item.summary
if (item.isCreateAgentWork) {
text += `<p>执行人:`
item.agentUserList.map((it) => {
if (it) {
text += `${userOptions.value.find((user) => user.id == it).name} `
}
})
text += '</p>'
text += `<p>截止日期:${item.endDate}</p>`
}
text += '<p><br></p>'
})
form.value.meetingSummary = text
}
// 更新会议
await MeetingApi.updateMeeting(form.value)
message.success('会议更新成功')
} else {
form.value.actualUsers = []
// 新增会议
await MeetingApi.createMeeting(form.value)
message.success('会议创建成功')
}
tagsViewStore.delView(route)
const visitedViews = tagsViewStore.getVisitedViews
const latestView = visitedViews.slice(-1)[0]
router.push(latestView)
} catch (error) {
console.error('保存会议数据失败:', error)
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -1,48 +0,0 @@
<template>
<div>
<el-descriptions :column="1" border label-width="90px" class="w-full">
<el-descriptions-item label="会议主题">{{ meetingInfo.meetingSubject }}</el-descriptions-item>
<el-descriptions-item label="会议时间">{{ meetingInfo.startTime }}</el-descriptions-item>
<el-descriptions-item label="发起人">{{ meetingInfo.creatorName }}</el-descriptions-item>
<el-descriptions-item label="会议纪要">
<div v-dompurify-html="meetingInfo.meetingSummary"></div>
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script setup name="MeettingSummary">
import { getMeetingDetail } from '@/api/okr/meeting'
import { formatDate } from '@/utils/formatTime'
const route = useRoute()
onMounted(() => {
if (route.query.id && route.query.id != 0) {
// 这里可以调用API获取会议详情数据
getMeetingInfo(route.query.id)
} else {
console.error('会议不存在')
}
})
const meetingInfo = ref({})
const getMeetingInfo = async (meetingId) => {
try {
// 调用API获取会议详情
const resp = await getMeetingDetail({ meetingId })
if (resp) {
meetingInfo.value = {
meetingSubject: resp.meetingSubject,
meetingSummary: resp.meetingSummary,
startTime: formatDate(resp.startTime, 'YYYY-MM-DD HH:mm'),
creatorName: resp.creatorName
}
}
} catch (error) {
console.error('获取会议详情失败:', error)
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -1,230 +0,0 @@
<template>
<div>
<!-- 搜索条件主题会议状态会议时间时间段选择OKR节点 -->
<el-form :model="searchForm" inline label-width="0">
<el-form-item>
<el-input
v-model="searchForm.meetingSubject"
placeholder="会议主题"
style="width: 200px"
clearable
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item>
<el-input
v-model="searchForm.creator"
placeholder="发起人"
style="width: 120px"
clearable
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item>
<el-select
v-model="searchForm.status"
placeholder="会议状态"
style="width: 150px"
@change="handleSearch"
>
<el-option label="未开始" value="1" />
<el-option label="已结束" value="2" />
<el-option label="已取消" value="3" />
</el-select>
</el-form-item>
<el-form-item>
<el-date-picker
v-model="searchForm.dateRange"
type="daterange"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
start-placeholder="会议时间"
end-placeholder="会议时间"
@change="handleSearch"
/>
</el-form-item>
<el-form-item>
<el-tree-select
v-model="searchForm.nodeId"
:data="peroidList"
:props="defaultProps"
:render-after-expand="false"
:default-expand-all="false"
check-strictly
placeholder="选择OKR节点"
style="width: 300px"
clearable
@change="handleSearch"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleSearch">查询</el-button>
<el-button type="primary" @click="handleAdd">预约会议</el-button>
</el-form-item>
</el-form>
<el-table :data="tableList" v-loading="loading" border stripe>
<el-table-column prop="meetingSubject" label="会议主题" />
<el-table-column prop="startTime" label="会议时间" width="170px" />
<el-table-column prop="meetingRoom" label="会议地点" width="140px" />
<el-table-column prop="creatorName" label="发起人" width="100px" />
<el-table-column prop="expectEndTime" label="预计结束时间" width="170px" />
<el-table-column prop="expectUserName" label="预约参会人员" />
<el-table-column prop="actualUserName" label="实际参会人员" />
<el-table-column prop="nodeName" label="关联OKR节点" width="150px" />
<el-table-column prop="status" label="会议状态" width="100px">
<template #default="{ row }">
<el-tag :type="['', 'info', 'success', 'warning'][row.status]" size="small">
{{ ['', '未开始', '已结束', '已取消'][row.status] }}
</el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="140">
<template #default="{ row }">
<template v-if="row.status == 1 && row.creator == currentUserId">
<el-button type="primary" style="padding: 0" text @click="handleEdit(row.meetingId)">
修改
</el-button>
<el-button type="danger" text style="padding: 0" @click="handleCancel(row)">
取消
</el-button>
</template>
<el-button
v-else
type="primary"
style="padding: 0"
text
@click="handleDetail(row.meetingId)"
>
详情
</el-button>
</template>
</el-table-column>
</el-table>
<Pagination
v-model:limit="searchForm.pageSize"
v-model:page="searchForm.pageNo"
:total="total"
@pagination="getList"
/>
</div>
</template>
<script setup name="Meeting">
import { listToTree } from '@/utils/tree'
import { useUserStore } from '@/store/modules/user'
import { getAllNodeTree } from '@/api/okr/okr'
import * as MeetingApi from '@/api/okr/meeting'
const currentUserId = useUserStore().getUser.id
const defaultProps = {
value: 'nodeId',
label: 'nodeName',
children: 'children'
}
const message = useMessage()
const searchForm = ref({
meetingSubject: undefined,
creator: undefined,
status: '1',
dateRange: [],
nodeId: undefined,
pageNo: 1,
pageSize: 50
})
const total = ref(0)
onMounted(() => {
getOptions()
handleSearch()
})
const peroidList = ref([])
function getOptions() {
// 获取OKR节点数据
getAllNodeTree().then((resp) => {
peroidList.value = listToTree(resp?.tree || [], {
id: 'nodeId',
pid: 'parentId',
children: 'children'
})
})
}
const loading = ref(false)
const tableList = ref([])
const handleSearch = () => {
searchForm.value.pageNo = 1
getList()
}
function getList() {
loading.value = true
// 获取会议列表
try {
const params = { ...searchForm.value }
if (params.dateRange && params.dateRange.length) {
params.startTime = params.dateRange[0] + ' 00:00:00'
params.endTime = params.dateRange[1] + ' 23:59:59'
delete params.dateRange
} else {
delete params.startTime
delete params.endTime
}
MeetingApi.getMeetingPage(params)
.then((resp) => {
tableList.value = resp.list || []
total.value = resp.total || 0
})
.finally(() => {
loading.value = false
})
} catch (error) {
console.error('获取会议列表失败:', error)
loading.value = false
}
}
const router = useRouter()
const handleAdd = () => {
router.push({ name: 'MeetingInfo', params: { id: 0 } })
}
const handleEdit = (id) => {
router.push({
name: `MeetingInfo`,
params: {
id
}
})
}
const handleDetail = (id) => {
router.push({
name: `MeetingInfo`,
params: {
id
},
query: {
isDetail: 1
}
})
}
const handleCancel = async (row) => {
try {
await message.confirm('是否确认取消该会议?')
// 取消会议操作
await MeetingApi.cancelMeeting({ meetingId: row.meetingId })
message.success('会议取消成功')
getList() // 刷新列表
} catch (error) {
console.log('取消操作被用户拒绝', error)
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -25,14 +25,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="组织部门" prop="dept"> <el-form-item label="组织部门" prop="dept">
<el-tree-select <el-input v-model="formData.dept" placeholder="请输入部门" />
v-model="formData.deptId"
:data="deptList"
:props="defaultProps"
check-strictly
node-key="id"
placeholder="请选择部门"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@@ -196,10 +189,8 @@
<script name="DialogEmployee" setup> <script name="DialogEmployee" setup>
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { defaultProps, handleTree } from '@/utils/tree'
import { getPlanSimpleList } from '@/api/pers/attendancePlan' import { getPlanSimpleList } from '@/api/pers/attendancePlan'
import { getSimpleAppList } from '@/api/system/app' import { getSimpleAppList } from '@/api/system/app'
import * as DeptApi from '@/api/system/dept'
import * as EmployeeApi from '@/api/pers/employee' import * as EmployeeApi from '@/api/pers/employee'
@@ -228,8 +219,6 @@ const attendanceSettingIdOptions = ref([])
const instanceIdsOptions = ref([]) const instanceIdsOptions = ref([])
const employeeOptions = ref([]) const employeeOptions = ref([])
const deptList = ref([])
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type, id) => { const open = async (type, id) => {
dialogVisible.value = true dialogVisible.value = true
@@ -245,7 +234,6 @@ const open = async (type, id) => {
formLoading.value = false formLoading.value = false
} }
} }
deptList.value = handleTree(await DeptApi.getSimpleDeptList({ allFlag: true }))
getOptions() getOptions()
} }
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 defineExpose({ open }) // 提供 open 方法,用于打开弹窗

View File

@@ -2502,13 +2502,6 @@
resolved "https://registry.yarnpkg.com/@wangeditor/list-module/-/list-module-1.0.5.tgz#3fc0b167acddf885536b45fa0c127f9c6adaea33" resolved "https://registry.yarnpkg.com/@wangeditor/list-module/-/list-module-1.0.5.tgz#3fc0b167acddf885536b45fa0c127f9c6adaea33"
integrity sha512-uDuYTP6DVhcYf7mF1pTlmNn5jOb4QtcVhYwSSAkyg09zqxI1qBqsfUnveeDeDqIuptSJhkh81cyxi+MF8sEPOQ== integrity sha512-uDuYTP6DVhcYf7mF1pTlmNn5jOb4QtcVhYwSSAkyg09zqxI1qBqsfUnveeDeDqIuptSJhkh81cyxi+MF8sEPOQ==
"@wangeditor/plugin-upload-attachment@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@wangeditor/plugin-upload-attachment/-/plugin-upload-attachment-1.1.0.tgz#a014de72703a9f3d5ae44a428ac01406640ac80a"
integrity sha512-K6SsV3Cv1g+Ob1xjRRQ13Sh3lcj3yAa/aXMaKKbaPI76rNZiOpyAGH/iVv5i9enmwbZql01IXpvhK+HtrikVyQ==
dependencies:
dom7 "^4.0.4"
"@wangeditor/table-module@^1.1.4": "@wangeditor/table-module@^1.1.4":
version "1.1.4" version "1.1.4"
resolved "https://registry.yarnpkg.com/@wangeditor/table-module/-/table-module-1.1.4.tgz#757d4a5868b2b658041cd323854a4d707c8347e9" resolved "https://registry.yarnpkg.com/@wangeditor/table-module/-/table-module-1.1.4.tgz#757d4a5868b2b658041cd323854a4d707c8347e9"
@@ -3740,13 +3733,6 @@ dom7@^3.0.0:
dependencies: dependencies:
ssr-window "^3.0.0-alpha.1" ssr-window "^3.0.0-alpha.1"
dom7@^4.0.4:
version "4.0.6"
resolved "https://registry.yarnpkg.com/dom7/-/dom7-4.0.6.tgz#091a51621d7a19ce0fb86045cafb3c10035e97ed"
integrity sha512-emjdpPLhpNubapLFdjNL9tP06Sr+GZkrIHEXLWvOGsytACUrkbeIdjO5g77m00BrHTznnlcNqgmn7pCN192TBA==
dependencies:
ssr-window "^4.0.0"
domelementtype@1, domelementtype@^1.3.1: domelementtype@1, domelementtype@^1.3.1:
version "1.3.1" version "1.3.1"
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f"
@@ -7259,11 +7245,6 @@ ssr-window@^3.0.0-alpha.1:
resolved "https://registry.yarnpkg.com/ssr-window/-/ssr-window-3.0.0.tgz#fd5b82801638943e0cc704c4691801435af7ac37" resolved "https://registry.yarnpkg.com/ssr-window/-/ssr-window-3.0.0.tgz#fd5b82801638943e0cc704c4691801435af7ac37"
integrity sha512-q+8UfWDg9Itrg0yWK7oe5p/XRCJpJF9OBtXfOPgSJl+u3Xd5KI328RUEvUqSMVM9CiQUEf1QdBzJMkYGErj9QA== integrity sha512-q+8UfWDg9Itrg0yWK7oe5p/XRCJpJF9OBtXfOPgSJl+u3Xd5KI328RUEvUqSMVM9CiQUEf1QdBzJMkYGErj9QA==
ssr-window@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/ssr-window/-/ssr-window-4.0.2.tgz#dc6b3ee37be86ac0e3ddc60030f7b3bc9b8553be"
integrity sha512-ISv/Ch+ig7SOtw7G2+qkwfVASzazUnvlDTwypdLoPoySv+6MqlOV10VwPSE6EWkGjhW50lUmghPmpYZXMu/+AQ==
stable@^0.1.8: stable@^0.1.8:
version "0.1.8" version "0.1.8"
resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf"