Compare commits
28 Commits
dev-zcx
...
b05e42f9c7
| Author | SHA1 | Date | |
|---|---|---|---|
| b05e42f9c7 | |||
|
|
e5e86e24e5 | ||
|
|
33965c55f9 | ||
|
|
683bfa0d38 | ||
|
|
83793b6591 | ||
|
|
ab4d644526 | ||
|
|
3e8a9220f6 | ||
| 6d08fd8390 | |||
|
|
8f20e04701 | ||
|
|
e007be1f2d | ||
|
|
1f29e02135 | ||
|
|
8f2ac77fd1 | ||
|
|
dc449979fa | ||
|
|
ff3f4d9e47 | ||
|
|
5098a5cf01 | ||
| 1413ce44c7 | |||
|
|
5ee61f7f6b | ||
|
|
51140a3c41 | ||
|
|
53d66f9676 | ||
|
|
f2f14789f0 | ||
|
|
f93e1f7187 | ||
| 74efe8409f | |||
| 5d88d06707 | |||
| f0afdcf18e | |||
| b019400409 | |||
| 69a496dc6e | |||
| 7c7bf51518 | |||
| 65dae80239 |
@@ -8,6 +8,7 @@ VITE_BASE_URL='http://localhost:48080'
|
|||||||
|
|
||||||
# VITE_BASE_URL='http://47.98.161.246:48080'
|
# VITE_BASE_URL='http://47.98.161.246:48080'
|
||||||
# VITE_BASE_URL='http://114.55.169.15:48080'
|
# VITE_BASE_URL='http://114.55.169.15: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'
|
||||||
|
|||||||
2
.env.dev
2
.env.dev
@@ -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'
|
||||||
|
|
||||||
|
|||||||
@@ -54,3 +54,8 @@ 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 })
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ export const updateOkrNode = (data) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询详情
|
// 查询详情
|
||||||
export const getOkrNodeDetail = (nodeId) => {
|
export const getOkrNodeDetail = (params) => {
|
||||||
return request.get({
|
return request.get({
|
||||||
url: '/admin-api/okr/node/get',
|
url: '/admin-api/okr/node/get',
|
||||||
params: { nodeId }
|
params
|
||||||
// headers: { 'instance-id': 1016 }
|
// headers: { 'instance-id': 1016 }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -108,3 +108,38 @@ export const getOkrRelationTreeChildren = (params) => {
|
|||||||
// headers: { 'instance-id': 1016 }
|
// 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 }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ export interface DeptVO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询部门(精简)列表
|
// 查询部门(精简)列表
|
||||||
export const getSimpleDeptList = async (): Promise<DeptVO[]> => {
|
export const getSimpleDeptList = async (params: any): Promise<any[]> => {
|
||||||
return await request.get({ url: '/admin-api/system/dept/list-all-simple' })
|
return await request.get({ url: '/admin-api/system/dept/list-all-simple', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询部门列表
|
// 查询部门列表
|
||||||
|
|||||||
@@ -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, removeToken } from '@/utils/auth'
|
import { getAccessToken } 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 { getTenantId, getAppId } from '@/utils/auth'
|
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||||
import cache from '@/plugins/cache'
|
import { getTenantId, getAppId, setTenantId, setAppId } from '@/utils/auth'
|
||||||
|
|
||||||
const { start, done } = useNProgress()
|
const { start, done } = useNProgress()
|
||||||
|
|
||||||
@@ -20,58 +20,72 @@ 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()
|
||||||
if (getAppId() && to.query?.appId && getAppId() != to.query?.appId) {
|
const userStore = useUserStoreWithOut()
|
||||||
removeToken()
|
if (to.path == '/login') {
|
||||||
cache?.local?.delete('appInfo')
|
userStore.resetState() // 重置用户信息状态
|
||||||
cache?.local?.delete('roleRouters')
|
}
|
||||||
cache?.local?.delete('user')
|
if (getAccessToken()) {
|
||||||
cache?.local?.delete('App_ID')
|
if (to.path === '/login') {
|
||||||
next(`/login?tenantId=${to.query?.tenantId}&appId=${to.query?.appId}`)
|
if (to.query?.tenantId && to.query?.appId) {
|
||||||
} else {
|
setApp(to.query.tenantId, to.query.appId)
|
||||||
if (getAccessToken()) {
|
await waitTime(1500)
|
||||||
if (to.path === '/login') {
|
|
||||||
next({ path: '/' })
|
|
||||||
} else {
|
|
||||||
// 获取所有字典
|
|
||||||
const dictStore = useDictStoreWithOut()
|
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
next({ path: '/' })
|
||||||
} else {
|
} else {
|
||||||
if (whiteList.indexOf(to.path) !== -1) {
|
// 获取所有字典
|
||||||
next()
|
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 } : { path: redirect }
|
||||||
|
next(nextData)
|
||||||
} else {
|
} else {
|
||||||
const tenantId = getTenantId()
|
next()
|
||||||
const appId = getAppId()
|
}
|
||||||
if (tenantId && appId) {
|
}
|
||||||
next(`/oa/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
} else {
|
||||||
} else {
|
if (whiteList.indexOf(to.path) !== -1) {
|
||||||
next(`/oa/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
next()
|
||||||
}
|
} else {
|
||||||
|
const tenantId = getTenantId()
|
||||||
|
const appId = getAppId()
|
||||||
|
if (tenantId && appId) {
|
||||||
|
next(`/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||||
|
} else {
|
||||||
|
next(`/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
|
||||||
|
|||||||
@@ -106,41 +106,29 @@ 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'),
|
||||||
|
|||||||
47
src/router/modules/static.ts
Normal file
47
src/router/modules/static.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
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: ''
|
||||||
|
}
|
||||||
|
],
|
||||||
|
meta: {
|
||||||
|
title: 'OKR',
|
||||||
|
icon: 'ep:calendar'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
export default staticRouter
|
||||||
@@ -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) => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ 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'
|
||||||
|
|
||||||
@@ -37,6 +38,25 @@ 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([
|
||||||
@@ -50,6 +70,7 @@ export const usePermissionStore = defineStore('permission', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
// 渲染菜单的所有路由
|
// 渲染菜单的所有路由
|
||||||
this.routers = cloneDeep(remainingRouter).concat(routerMap)
|
this.routers = cloneDeep(remainingRouter).concat(routerMap)
|
||||||
resolve()
|
resolve()
|
||||||
|
|||||||
@@ -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,6 +75,7 @@ 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)
|
||||||
|
|||||||
@@ -9,26 +9,34 @@ const RefreshTokenKey = 'REFRESH_TOKEN'
|
|||||||
// 获取token
|
// 获取token
|
||||||
export const getAccessToken = () => {
|
export const getAccessToken = () => {
|
||||||
// 此处与TokenKey相同,此写法解决初始化时Cookies中不存在TokenKey报错
|
// 此处与TokenKey相同,此写法解决初始化时Cookies中不存在TokenKey报错
|
||||||
return cache.local.get(AccessTokenKey)
|
return localStorage.getItem(AccessTokenKey)
|
||||||
? cache.local.get(AccessTokenKey)
|
? localStorage.getItem(AccessTokenKey)
|
||||||
: cache.local.get('ACCESS_TOKEN')
|
: localStorage.getItem('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 cache.local.get(RefreshTokenKey)
|
return localStorage.getItem(RefreshTokenKey)
|
||||||
|
// return cache.local.get(RefreshTokenKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置token
|
// 设置token
|
||||||
export const setToken = (token: TokenType) => {
|
export const setToken = (token: TokenType) => {
|
||||||
cache.local.set(RefreshTokenKey, token.refreshToken)
|
localStorage.setItem(AccessTokenKey, token.accessToken)
|
||||||
cache.local.set(AccessTokenKey, token.accessToken)
|
localStorage.setItem(RefreshTokenKey, token.refreshToken)
|
||||||
|
// cache.local.set(RefreshTokenKey, token.refreshToken)
|
||||||
|
// cache.local.set(AccessTokenKey, token.accessToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除token
|
// 删除token
|
||||||
export const removeToken = () => {
|
export const removeToken = () => {
|
||||||
cache.local.delete(AccessTokenKey)
|
localStorage.removeItem(AccessTokenKey)
|
||||||
cache.local.delete(RefreshTokenKey)
|
localStorage.removeItem(RefreshTokenKey)
|
||||||
|
// cache.local.delete(AccessTokenKey)
|
||||||
|
// cache.local.delete(RefreshTokenKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 格式化token(jwt格式) */
|
/** 格式化token(jwt格式) */
|
||||||
|
|||||||
80
src/utils/tableObjectSpanMethod.js
Normal file
80
src/utils/tableObjectSpanMethod.js
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/**
|
||||||
|
* @Author: River_qiu
|
||||||
|
* @Date: 2021/11/18
|
||||||
|
*/
|
||||||
|
// 表格单元格合并多列
|
||||||
|
let [spanObj, pos] = [{}, {}]
|
||||||
|
//spanObj 存储每个key 对应的合并值
|
||||||
|
//pos 存储的是 key合并值得索引 大概吧
|
||||||
|
export const dataMethod = (data, isH, allColumns = []) => {
|
||||||
|
//循环数据(行)
|
||||||
|
for (let i in data) {
|
||||||
|
let dataI = data[i]
|
||||||
|
//循环数据内对象,查看有多少key
|
||||||
|
if (allColumns.length > 0) {
|
||||||
|
let preProp = undefined
|
||||||
|
// dataI.historyValue =
|
||||||
|
// 循环列数据
|
||||||
|
for (let index = 0; index < allColumns.length; index++) {
|
||||||
|
let j = allColumns[index]
|
||||||
|
if (i == 0) {
|
||||||
|
// 第一行,每列至少展示1行
|
||||||
|
spanObj[j] = [1]
|
||||||
|
pos[j] = 0
|
||||||
|
} else {
|
||||||
|
if (index == 0) {
|
||||||
|
data[i].historyValue = ''
|
||||||
|
data[i - 1].historyValue = ''
|
||||||
|
} else {
|
||||||
|
data[i].historyValue += data[i][preProp]
|
||||||
|
data[i - 1].historyValue += data[i - 1][preProp]
|
||||||
|
}
|
||||||
|
// e: 当前行数据,k:上一行数据
|
||||||
|
let [e, k] = [dataI, data[i - 1]]
|
||||||
|
// 判断上一行数据是否存在
|
||||||
|
// 空数据不合并
|
||||||
|
// 前一列值相同并且不为空或者为第一列
|
||||||
|
// 存在当前的列的值与上一行是否一样
|
||||||
|
// 判断是否有数组规定只允许那几列需要合并单元格的
|
||||||
|
if (
|
||||||
|
k &&
|
||||||
|
e[j] &&
|
||||||
|
(!preProp || (e.historyValue && e.historyValue == k.historyValue)) &&
|
||||||
|
e[j] == k[j] &&
|
||||||
|
(!isH || isH.length == 0 || isH.includes(j))
|
||||||
|
) {
|
||||||
|
//如果上一级和当前一级相当,数组就加1 数组后面就添加一个0
|
||||||
|
spanObj[j][pos[j]] += 1
|
||||||
|
spanObj[j].push(0)
|
||||||
|
} else {
|
||||||
|
spanObj[j].push(1)
|
||||||
|
pos[j] = i
|
||||||
|
}
|
||||||
|
preProp = j
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let j in dataI) {
|
||||||
|
//如果只有一条数据时默认为1即可,无需合并
|
||||||
|
if (i == 0) {
|
||||||
|
spanObj[j] = [1]
|
||||||
|
pos[j] = 0
|
||||||
|
} else {
|
||||||
|
let [e, k] = [dataI, data[i - 1]]
|
||||||
|
//判断上一级别是否存在 ,
|
||||||
|
//存在当前的key是否和上级别的key是否一样
|
||||||
|
//判断是否有数组规定只允许那几列需要合并单元格的
|
||||||
|
if (k && e[j] && k[j] && e[j] == k[j] && (!isH || isH.length == 0 || isH.includes(j))) {
|
||||||
|
//如果上一级和当前一级相当,数组就加1 数组后面就添加一个0
|
||||||
|
spanObj[j][pos[j]] += 1
|
||||||
|
spanObj[j].push(0)
|
||||||
|
} else {
|
||||||
|
spanObj[j].push(1)
|
||||||
|
pos[j] = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return spanObj
|
||||||
|
}
|
||||||
@@ -30,7 +30,12 @@
|
|||||||
<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 v-model="formData.leaderUserId" clearable placeholder="请输入负责人">
|
<el-select
|
||||||
|
v-model="formData.leaderUserId"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="请输入负责人"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in employeeOptions"
|
v-for="item in employeeOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -57,17 +62,15 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" :offset="0">
|
<el-col :span="12" :offset="0">
|
||||||
<el-form-item label="开通系统" prop="instanceIds">
|
<el-form-item label="业务系统" prop="instanceId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.instanceIds"
|
v-model="formData.instanceId"
|
||||||
placeholder="选择开通系统"
|
placeholder="选择主业务系统"
|
||||||
multiple
|
|
||||||
collapse-tags
|
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in instanceIdsOptions"
|
v-for="item in instanceIdOptions"
|
||||||
:key="item.instanceId"
|
:key="item.instanceId"
|
||||||
:label="item.instanceName"
|
:label="item.instanceName"
|
||||||
:disabled="item.status == 1"
|
:disabled="item.status == 1"
|
||||||
@@ -105,16 +108,7 @@ 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({
|
const formData = ref<any>({})
|
||||||
id: undefined,
|
|
||||||
parentId: undefined,
|
|
||||||
name: undefined,
|
|
||||||
sort: 1,
|
|
||||||
leaderUserId: undefined,
|
|
||||||
status: CommonStatusEnum.ENABLE,
|
|
||||||
remark: undefined,
|
|
||||||
instanceIds: 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' }],
|
||||||
@@ -128,7 +122,7 @@ const formRules = reactive<any>({
|
|||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const deptTree = ref() // 树形结构
|
const deptTree = ref() // 树形结构
|
||||||
const employeeOptions = ref<any>([]) // 用户列表
|
const employeeOptions = ref<any>([]) // 用户列表
|
||||||
const instanceIdsOptions = ref<any>([]) // 实例ids
|
const instanceIdOptions = ref<any>([]) // 实例ids
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number) => {
|
||||||
@@ -141,6 +135,7 @@ 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 || ''
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
@@ -151,7 +146,7 @@ const open = async (type: string, id?: number) => {
|
|||||||
})
|
})
|
||||||
//实例
|
//实例
|
||||||
getSimpleAppList().then((data) => {
|
getSimpleAppList().then((data) => {
|
||||||
instanceIdsOptions.value = data
|
instanceIdOptions.value = data
|
||||||
})
|
})
|
||||||
// 获得部门树
|
// 获得部门树
|
||||||
await getTree()
|
await getTree()
|
||||||
@@ -194,7 +189,7 @@ const resetForm = () => {
|
|||||||
leaderUserId: undefined,
|
leaderUserId: undefined,
|
||||||
status: CommonStatusEnum.ENABLE,
|
status: CommonStatusEnum.ENABLE,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
instanceIds: undefined
|
instanceId: undefined
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
@@ -202,7 +197,7 @@ const resetForm = () => {
|
|||||||
/** 获得部门树 */
|
/** 获得部门树 */
|
||||||
const getTree = async () => {
|
const getTree = async () => {
|
||||||
deptTree.value = []
|
deptTree.value = []
|
||||||
const data = await DeptApi.getSimpleDeptList()
|
const data = await DeptApi.getSimpleDeptList({ allFlag: true })
|
||||||
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)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<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="instanceNames" label="业务系统" width="200" />
|
<el-table-column prop="instanceName" label="业务系统" width="200" />
|
||||||
<el-table-column prop="sort" label="排序" width="80" />
|
<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">
|
<template #default="scope">
|
||||||
@@ -68,6 +68,7 @@ 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() // 搜索的表单
|
||||||
|
|||||||
@@ -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,7 +113,8 @@
|
|||||||
</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'
|
||||||
@@ -174,7 +175,7 @@ const open = async (type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 加载部门树
|
// 加载部门树
|
||||||
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
deptList.value = handleTree(await DeptApi.getSimpleDeptList({ allFlag: false }))
|
||||||
// 加载岗位列表
|
// 加载岗位列表
|
||||||
roleOptions.value = await RoleApi.getSimpleRoleList()
|
roleOptions.value = await RoleApi.getSimpleRoleList()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,105 +1,100 @@
|
|||||||
<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="68px">
|
<el-form :model="queryParams" ref="queryFormRef" inline label-width="0">
|
||||||
<el-form-item label="姓名" prop="nickname">
|
<el-form-item 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 label="手机号码" prop="mobile">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.mobile"
|
|
||||||
placeholder="请输入手机号码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button @click="handleQuery" v-hasPermi="['basic:employee:search']">搜索</el-button>
|
|
||||||
<el-button @click="resetQuery" v-hasPermi="['basic:employee:reset']">重置</el-button>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
@click="openForm('create')"
|
|
||||||
v-hasPermi="['basic:employee:add']"
|
|
||||||
>
|
|
||||||
新增
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<el-table v-loading="loading" :data="list">
|
|
||||||
<el-table-column label="用户编号" key="id" prop="id" />
|
|
||||||
<el-table-column label="登录账号" prop="username" />
|
|
||||||
<el-table-column label="用户姓名" prop="nickname" />
|
|
||||||
<el-table-column label="部门" key="deptName" prop="deptName" />
|
|
||||||
<el-table-column label="手机号码" prop="mobile" width="120" />
|
|
||||||
<el-table-column label="状态" key="status">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-switch
|
|
||||||
v-model="scope.row.status"
|
|
||||||
:active-value="0"
|
|
||||||
:inactive-value="1"
|
|
||||||
active-text="在职"
|
|
||||||
inactive-text="离职"
|
|
||||||
v-hasPermi="['basic:employee:update']"
|
|
||||||
@change="handleStatusChange(scope.row)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
|
||||||
prop="createTime"
|
|
||||||
width="180"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
/>
|
|
||||||
<el-table-column label="操作" width="260">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="openForm('update', scope.row.id)"
|
|
||||||
v-hasPermi="['basic:employee:update']"
|
|
||||||
>
|
|
||||||
修改
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleDelete(scope.row.id)"
|
|
||||||
v-hasPermi="['basic:employee:delete']"
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleResetPwd(scope.row)"
|
|
||||||
v-hasPermi="['basic:employee:password']"
|
|
||||||
>
|
|
||||||
重置密码
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<Pagination
|
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-form-item>
|
||||||
</el-row>
|
<el-form-item prop="mobile">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.mobile"
|
||||||
|
placeholder="请输入手机号码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery" v-hasPermi="['basic:employee:search']">搜索</el-button>
|
||||||
|
<el-button @click="resetQuery" v-hasPermi="['basic:employee:reset']">重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="openForm('create')"
|
||||||
|
v-hasPermi="['basic:employee:add']"
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="用户编号" key="id" prop="id" />
|
||||||
|
<el-table-column label="登录账号" prop="username" />
|
||||||
|
<el-table-column label="用户姓名" prop="nickname" />
|
||||||
|
<!-- <el-table-column label="部门" key="deptName" prop="deptName" /> -->
|
||||||
|
<el-table-column label="手机号码" prop="mobile" width="120" />
|
||||||
|
<el-table-column label="状态" key="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
:active-value="0"
|
||||||
|
:inactive-value="1"
|
||||||
|
active-text="在职"
|
||||||
|
inactive-text="离职"
|
||||||
|
v-hasPermi="['basic:employee:update']"
|
||||||
|
@change="handleStatusChange(scope.row)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" prop="createTime" width="180" :formatter="dateFormatter" />
|
||||||
|
<el-table-column label="操作" width="260">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
v-hasPermi="['basic:employee:update']"
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['basic:employee:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleResetPwd(scope.row)"
|
||||||
|
v-hasPermi="['basic:employee:password']"
|
||||||
|
>
|
||||||
|
重置密码
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
<!-- </el-col> -->
|
||||||
|
<!-- </el-row> -->
|
||||||
|
|
||||||
<!-- 添加或修改用户对话框 -->
|
<!-- 添加或修改用户对话框 -->
|
||||||
<UserForm ref="formRef" @success="getList" />
|
<UserForm ref="formRef" @success="getList" />
|
||||||
@@ -109,7 +104,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() // 国际化
|
||||||
|
|
||||||
@@ -150,11 +145,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()
|
||||||
|
|||||||
@@ -308,9 +308,24 @@
|
|||||||
<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 type="primary" v-if="row.grantId" text @click="handleDetail(row)">
|
<el-button
|
||||||
|
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>
|
||||||
@@ -468,6 +483,20 @@ 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>
|
||||||
|
|||||||
@@ -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="选择日期时间"
|
||||||
|
|||||||
177
src/views/OKR/Analysis/index.vue
Normal file
177
src/views/OKR/Analysis/index.vue
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-row class="mb-10px">
|
||||||
|
<el-tree-select
|
||||||
|
v-model="searchForm.nodeId"
|
||||||
|
:data="peroidList"
|
||||||
|
:props="defaultProps"
|
||||||
|
:render-after-expand="false"
|
||||||
|
:default-expand-all="false"
|
||||||
|
check-strictly
|
||||||
|
style="width: 400px"
|
||||||
|
@change="nodeChange"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table :data="originList" border :span-method="objectSpanMethod">
|
||||||
|
<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" label="关键成果">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Analysis">
|
||||||
|
import { listToTree, findNode } from '@/utils/tree'
|
||||||
|
import { getAllNodeTree, getAllOkrPage } from '@/api/okr/okr'
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
|
||||||
|
const message = useMessage()
|
||||||
|
const defaultProps = {
|
||||||
|
value: 'nodeId',
|
||||||
|
label: 'nodeName',
|
||||||
|
children: 'children'
|
||||||
|
}
|
||||||
|
const searchForm = ref({
|
||||||
|
nodeId: undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
const currentNode = ref(undefined)
|
||||||
|
|
||||||
|
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([])
|
||||||
|
|
||||||
|
handleSearchPeroid()
|
||||||
|
|
||||||
|
// 当前是否是叶子节点
|
||||||
|
// 如果不是叶子节点,则表格数据不可修改
|
||||||
|
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('请先创建节点数据')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function nodeChange(nodeId) {
|
||||||
|
if (nodeId) {
|
||||||
|
searchForm.value.nodeId = nodeId
|
||||||
|
getOkrList()
|
||||||
|
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 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]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectSpanMethod({ column, rowIndex }) {
|
||||||
|
if (['目标', '目标完成度'].includes(column.label)) {
|
||||||
|
let _row = spanObj.value[rowIndex]
|
||||||
|
let _col = _row > 0 ? 1 : 0
|
||||||
|
return {
|
||||||
|
rowspan: _row,
|
||||||
|
colspan: _col
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="flex flex-col w-full h-full p-4 bg-white rounded-lg shadow-md overflow-hidden">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
@@ -31,7 +31,6 @@
|
|||||||
>
|
>
|
||||||
</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" />
|
||||||
@@ -72,34 +71,46 @@ const isCurrentLeafNode = ref(false)
|
|||||||
|
|
||||||
function handleSearchPeroid() {
|
function handleSearchPeroid() {
|
||||||
getAllNodeTree().then((resp) => {
|
getAllNodeTree().then((resp) => {
|
||||||
peroidList.value = listToTree(resp.tree, {
|
if (resp.nodeId) {
|
||||||
id: 'nodeId',
|
peroidList.value = listToTree(resp?.tree || [], {
|
||||||
pid: 'parentId',
|
id: 'nodeId',
|
||||||
children: 'children'
|
pid: 'parentId',
|
||||||
})
|
children: 'children'
|
||||||
nodeChange(resp.nodeId)
|
})
|
||||||
|
nodeChange(resp.nodeId)
|
||||||
|
} else {
|
||||||
|
message.warning('请先创建节点数据')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeChange(nodeId) {
|
function nodeChange(nodeId) {
|
||||||
searchForm.value.nodeId = nodeId
|
if (nodeId) {
|
||||||
getOkrList()
|
searchForm.value.nodeId = nodeId
|
||||||
const currentNode = findNode(peroidList.value, (node) => {
|
getOkrList()
|
||||||
return node.nodeId == nodeId
|
const currentNode = findNode(peroidList.value, (node) => {
|
||||||
})
|
return node.nodeId == nodeId
|
||||||
if (!currentNode.children || currentNode.children.length == 0) {
|
})
|
||||||
isCurrentLeafNode.value = true
|
searchForm.value.creatorId = currentNode.creatorId
|
||||||
} else {
|
if (!currentNode.children || currentNode.children.length == 0) {
|
||||||
isCurrentLeafNode.value = false
|
isCurrentLeafNode.value = true
|
||||||
|
} else {
|
||||||
|
isCurrentLeafNode.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOkrList() {
|
function getOkrList() {
|
||||||
getAllOkrPage(searchForm.value).then((resp) => {
|
getAllOkrPage(searchForm.value).then((resp) => {
|
||||||
const list = resp
|
const list = resp
|
||||||
nextTick(() => {
|
if (list && list.length > 0) {
|
||||||
okrTableRef.value.prepareData(list)
|
nextTick(() => {
|
||||||
})
|
okrTableRef.value.prepareData(list)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,清空表格
|
||||||
|
okrTableRef.value.prepareData([])
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,9 +119,9 @@ function handleAddNode() {
|
|||||||
dialogOkrInfo.value.open('create', null)
|
dialogOkrInfo.value.open('create', null)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleEditOkr() {
|
function handleEditOkr(nodeId = undefined) {
|
||||||
dialogOkr.value.close()
|
dialogOkr.value.close()
|
||||||
dialogOkrInfo.value.open('update', searchForm.value.nodeId)
|
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdateProcess() {
|
function handleUpdateProcess() {
|
||||||
@@ -124,7 +135,8 @@ 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>
|
||||||
|
|||||||
@@ -18,11 +18,31 @@
|
|||||||
<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>{{ nodeInfo.allNodeName }}</span>
|
<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 v-if="nodeInfo.creatorId == currentUserId" link @click="emit('edit')">
|
<el-button
|
||||||
|
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>
|
||||||
@@ -79,7 +99,7 @@
|
|||||||
</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">
|
<el-tab-pane label="子节点" name="subNode" key=" ">
|
||||||
<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"
|
||||||
@@ -123,42 +143,43 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="评论" name="conclusion">
|
<el-tab-pane label="评论" name="conclusion" key="conclusion">
|
||||||
<div class="relative overflow-y-auto" style="height: calc(100% - 50px)">
|
<div class="relative overflow-y-auto" style="height: calc(100% - 50px)">
|
||||||
<div class="flex justify-between items-center">
|
<div v-if="addNewComment">
|
||||||
<el-select
|
<div class="flex justify-between items-center">
|
||||||
v-if="addNewComment"
|
<el-select
|
||||||
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>
|
</el-select>
|
||||||
|
|
||||||
<div v-if="addNewComment">
|
<div>
|
||||||
<el-button size="small" @click="addNewComment = false"> 取消 </el-button>
|
<el-button size="small" @click="addNewComment = false"> 取消 </el-button>
|
||||||
<el-button type="primary" size="small" @click="handleSaveComment">
|
<el-button type="primary" size="small" @click="handleSaveComment">
|
||||||
发布
|
发布
|
||||||
</el-button>
|
</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>
|
|
||||||
<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, index) in commentList"
|
||||||
:key="it.commentId"
|
:key="it.commentId"
|
||||||
@@ -276,7 +297,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="进度历史" name="history">
|
<el-tab-pane label="进度历史" name="history" key="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
|
||||||
@@ -319,9 +340,19 @@ import { useUserStore } from '@/store/modules/user'
|
|||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const currentUserId = userStore.getUser.id
|
const currentUserId = userStore.getUser.id
|
||||||
const emit = defineEmits(['edit'])
|
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 = {
|
||||||
@@ -351,9 +382,11 @@ const nodeInfo = ref({})
|
|||||||
const nodeRecords = ref([])
|
const nodeRecords = ref([])
|
||||||
const commentTypeOptions = ref([])
|
const commentTypeOptions = ref([])
|
||||||
|
|
||||||
|
const queryType = ref(1)
|
||||||
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
|
||||||
@@ -363,13 +396,12 @@ const employeeOptions = ref([])
|
|||||||
|
|
||||||
function searchInfo(curNode) {
|
function searchInfo(curNode) {
|
||||||
try {
|
try {
|
||||||
getOkrNodeDetail(curNode.nodeId).then((resp) => {
|
getOkrNodeDetail({ nodeId: curNode.nodeId, queryType: queryType.value }).then((resp) => {
|
||||||
nodeInfo.value = {
|
nodeInfo.value = {
|
||||||
...resp,
|
...resp,
|
||||||
executor: resp.executor || []
|
executor: resp.executor || []
|
||||||
}
|
}
|
||||||
canEdit.value =
|
canEdit.value = canEdit.value && nodeInfo.value.executor.includes(currentUserId + '')
|
||||||
canEdit.value && currentUserId == 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,
|
||||||
@@ -414,7 +446,7 @@ function handleMention(item) {
|
|||||||
function handleSaveProcess() {
|
function handleSaveProcess() {
|
||||||
okrTableRef.value.updateProcess(nodeInfo.value.nodeId).then(() => {
|
okrTableRef.value.updateProcess(nodeInfo.value.nodeId).then(() => {
|
||||||
message.success('更新成功')
|
message.success('更新成功')
|
||||||
searchInfo()
|
searchInfo({ nodeId: nodeInfo.value.nodeId })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,8 +650,9 @@ function handleSendCommnet(idx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.content-wrap {
|
.content-wrap {
|
||||||
overflow-y: auto;
|
display: flex;
|
||||||
max-height: calc(100% - 70px);
|
flex-direction: column;
|
||||||
|
height: calc(100% - 15px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.dialog-okr-side {
|
.dialog-okr-side {
|
||||||
|
|||||||
@@ -120,10 +120,20 @@
|
|||||||
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-tag type="success" class="mr-10px">O{{ i + 1 }}</el-tag>
|
<el-tooltip content="点击可折叠/展开目标" placement="top" effect="dark">
|
||||||
|
<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="目标名称"
|
||||||
@@ -135,6 +145,7 @@
|
|||||||
placeholder="选择执行人,可多选"
|
placeholder="选择执行人,可多选"
|
||||||
multiple
|
multiple
|
||||||
clearable
|
clearable
|
||||||
|
collapse-tags
|
||||||
filterable
|
filterable
|
||||||
style="width: 240px; margin-left: 10px"
|
style="width: 240px; margin-left: 10px"
|
||||||
>
|
>
|
||||||
@@ -161,7 +172,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 style="background: #f0f3fa; padding-bottom: 15px">
|
<div v-if="!item.hideChild" style="background: #f0f3fa; padding-bottom: 10px">
|
||||||
<div
|
<div
|
||||||
class="ml-50px"
|
class="ml-50px"
|
||||||
v-for="(kr, index) in item.keyResults"
|
v-for="(kr, index) in item.keyResults"
|
||||||
@@ -192,7 +203,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.sourceId"
|
v-model="kr.source"
|
||||||
:data="sourceOptions"
|
:data="sourceOptions"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
check-strictly
|
check-strictly
|
||||||
@@ -202,10 +213,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"
|
||||||
@@ -332,7 +343,8 @@ 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'
|
||||||
@@ -378,7 +390,7 @@ const defaultProps = {
|
|||||||
}
|
}
|
||||||
const sourceOptions = ref([])
|
const sourceOptions = ref([])
|
||||||
const objectList = ref([])
|
const objectList = ref([])
|
||||||
function open(type, val) {
|
function open(type, val, queryType) {
|
||||||
show.value = true
|
show.value = true
|
||||||
title.value = type == 'update' ? '修改Okr' : '新增Okr'
|
title.value = type == 'update' ? '修改Okr' : '新增Okr'
|
||||||
formType.value = type
|
formType.value = type
|
||||||
@@ -396,10 +408,20 @@ function open(type, val) {
|
|||||||
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(val).then((resp) => {
|
getOkrNodeDetail({
|
||||||
|
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) => ({
|
||||||
@@ -468,7 +490,7 @@ function removeKR(oIdx, krIdx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addChildNode() {
|
function addChildNode() {
|
||||||
childNodeList.value.push({})
|
childNodeList.value.push({ dataScope: 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeChildNode(idx) {
|
function removeChildNode(idx) {
|
||||||
@@ -509,9 +531,32 @@ 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') {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="h-full flex flex-col">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
@@ -53,7 +53,7 @@ handleSearchPeroid()
|
|||||||
|
|
||||||
function handleSearchPeroid() {
|
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'
|
||||||
@@ -66,9 +66,14 @@ function handleSearchPeroid() {
|
|||||||
function getOkrList() {
|
function getOkrList() {
|
||||||
getMyOkrPage(searchForm.value).then((resp) => {
|
getMyOkrPage(searchForm.value).then((resp) => {
|
||||||
const list = resp
|
const list = resp
|
||||||
nextTick(() => {
|
if (list && list.length > 0) {
|
||||||
okrTableRef.value.prepareData(list)
|
nextTick(() => {
|
||||||
})
|
okrTableRef.value.prepareData(list)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,清空表格
|
||||||
|
okrTableRef.value.prepareData([])
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,9 +82,9 @@ const dialogOkrInfo = ref(null)
|
|||||||
// dialogOkrInfo.value.open('create', null)
|
// dialogOkrInfo.value.open('create', null)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
function handleEditOkr() {
|
function handleEditOkr(nodeId = undefined) {
|
||||||
dialogOkr.value.close()
|
dialogOkr.value.close()
|
||||||
dialogOkrInfo.value.open('update', 1)
|
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdateProcess() {
|
function handleUpdateProcess() {
|
||||||
@@ -93,7 +98,8 @@ const dialogOkr = ref(null)
|
|||||||
function handleShowOkr(id) {
|
function handleShowOkr(id) {
|
||||||
dialogOkr.value.open({
|
dialogOkr.value.open({
|
||||||
nodeId: id,
|
nodeId: id,
|
||||||
canEdit: true
|
canEdit: true,
|
||||||
|
queryType: 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
125
src/views/OKR/Management/Components/MySon.vue
Normal file
125
src/views/OKR/Management/Components/MySon.vue
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<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>
|
||||||
@@ -30,9 +30,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<vue3-tree-org
|
<vue3-tree-org
|
||||||
|
ref="treeOrgRef"
|
||||||
:data="dataList"
|
:data="dataList"
|
||||||
center
|
center
|
||||||
collapsable
|
collapsable
|
||||||
|
:default-expand-keys="lastExpendKeys"
|
||||||
:props="treeProps"
|
:props="treeProps"
|
||||||
@on-node-click="handleClickNode"
|
@on-node-click="handleClickNode"
|
||||||
>
|
>
|
||||||
@@ -74,7 +76,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</vue3-tree-org>
|
</vue3-tree-org>
|
||||||
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" />
|
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" />
|
||||||
<DialogOkrInfo ref="dialogOkrInfo" @close="openOkr" />
|
<DialogOkrInfo ref="dialogOkrInfo" @close="openOkr" @success="resetTreeData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -89,6 +91,7 @@ import { listToTree } from '@/utils/tree'
|
|||||||
|
|
||||||
const dataList = ref({})
|
const dataList = ref({})
|
||||||
const helpDataList = ref([])
|
const helpDataList = ref([])
|
||||||
|
const lastExpendKeys = ref([])
|
||||||
const treeProps = {
|
const treeProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'nodeName',
|
label: 'nodeName',
|
||||||
@@ -106,6 +109,7 @@ const peroidList = ref([])
|
|||||||
handleSearchPeroid()
|
handleSearchPeroid()
|
||||||
|
|
||||||
function handleSearchPeroid() {
|
function handleSearchPeroid() {
|
||||||
|
lastExpendKeys.value = []
|
||||||
getOkrRelationTree().then((resp) => {
|
getOkrRelationTree().then((resp) => {
|
||||||
peroidList.value = resp
|
peroidList.value = resp
|
||||||
if (resp && resp.length && !searchForm.value.nodeId) {
|
if (resp && resp.length && !searchForm.value.nodeId) {
|
||||||
@@ -116,6 +120,43 @@ function handleSearchPeroid() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const treeOrgRef = ref(null)
|
||||||
|
function resetTreeData() {
|
||||||
|
if (treeOrgRef.value) {
|
||||||
|
lastExpendKeys.value = treeOrgRef.value.getExpandKeys()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新获取tree数据
|
||||||
|
getOkrRelationTree().then((resp) => {
|
||||||
|
peroidList.value = resp
|
||||||
|
if (resp && resp.length) {
|
||||||
|
if (!searchForm.value.nodeId) {
|
||||||
|
searchForm.value.nodeId = resp[0].nodeId
|
||||||
|
searchForm.value.nodeName = resp[0].nodeName
|
||||||
|
}
|
||||||
|
getOkrRelationTreeChildren({
|
||||||
|
nodeId: searchForm.value.nodeId
|
||||||
|
}).then((resp) => {
|
||||||
|
const tree = listToTree(resp, {
|
||||||
|
id: 'nodeId',
|
||||||
|
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() {
|
function getOkrList() {
|
||||||
getOkrRelationTreeChildren({
|
getOkrRelationTreeChildren({
|
||||||
nodeId: searchForm.value.nodeId
|
nodeId: searchForm.value.nodeId
|
||||||
@@ -178,6 +219,7 @@ function openOkr() {
|
|||||||
clickNode.value &&
|
clickNode.value &&
|
||||||
dialogOkr.value.open({
|
dialogOkr.value.open({
|
||||||
nodeId: clickNode.value.nodeId,
|
nodeId: clickNode.value.nodeId,
|
||||||
|
queryType: 2,
|
||||||
canEdit: !clickNode.value.children || clickNode.value.children.length == 0
|
canEdit: !clickNode.value.children || clickNode.value.children.length == 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -188,9 +230,9 @@ function handleAddNode() {
|
|||||||
dialogOkrInfo.value.open('create', null)
|
dialogOkrInfo.value.open('create', null)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleEditOkr() {
|
function handleEditOkr(nodeId = undefined) {
|
||||||
dialogOkr.value.close()
|
dialogOkr.value.close()
|
||||||
dialogOkrInfo.value.open('update', 1)
|
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="flex-1 h-200px overflow-hidden">
|
||||||
<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"
|
||||||
>
|
>
|
||||||
@@ -19,11 +20,18 @@
|
|||||||
height: getHeight(row, $index)
|
height: getHeight(row, $index)
|
||||||
}"
|
}"
|
||||||
></span>
|
></span>
|
||||||
<span v-if="row.type == '目标'">【目标】{{ row.name }}</span>
|
<span v-if="row.type == '目标'">
|
||||||
|
<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>
|
||||||
【关键成果】{{ row.channelName }} {{ row.name }}
|
<el-tag type="primary" size="small">关键成果</el-tag>
|
||||||
|
<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">
|
||||||
@@ -74,6 +82,10 @@ 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) => {
|
||||||
@@ -94,13 +106,14 @@ function prepareData(list) {
|
|||||||
nodeId: child.nodeId,
|
nodeId: child.nodeId,
|
||||||
isSys: child.isSys,
|
isSys: child.isSys,
|
||||||
processId: child.id,
|
processId: child.id,
|
||||||
name: child.keyResultName,
|
name: child.keyResultShowName,
|
||||||
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
|
||||||
|
|||||||
@@ -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>
|
<el-tab-pane disabled v-if="employeeList.length > 0">
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<el-divider
|
<el-divider
|
||||||
@@ -31,9 +31,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="张三">张三</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"
|
||||||
|
: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>
|
||||||
@@ -41,11 +46,21 @@
|
|||||||
<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>
|
||||||
|
|||||||
@@ -165,7 +165,7 @@
|
|||||||
<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 './DialogWait.vue'
|
import DialogWait from './Components/DialogWait.vue'
|
||||||
|
|
||||||
import { getWaitPage, deleteWait, getWaitCount, urgeWait } from '@/api/okr/wait'
|
import { getWaitPage, deleteWait, getWaitCount, urgeWait } from '@/api/okr/wait'
|
||||||
|
|
||||||
@@ -275,10 +275,8 @@ function handleDelete(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleNotice(row) {
|
function handleNotice(row) {
|
||||||
console.log(row)
|
|
||||||
|
|
||||||
message.confirm('即将发送微信通知提醒执行人,是否继续?').then(() => {
|
message.confirm('即将发送微信通知提醒执行人,是否继续?').then(() => {
|
||||||
urgeWait({ workId: row.workId }).then(() => {
|
urgeWait(row.workId).then(() => {
|
||||||
message.success('发送成功')
|
message.success('发送成功')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -25,7 +25,14 @@
|
|||||||
<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-input v-model="formData.dept" placeholder="请输入部门" />
|
<el-tree-select
|
||||||
|
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">
|
||||||
@@ -189,8 +196,10 @@
|
|||||||
<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'
|
||||||
|
|
||||||
@@ -219,6 +228,8 @@ 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
|
||||||
@@ -234,6 +245,7 @@ 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 方法,用于打开弹窗
|
||||||
|
|||||||
Reference in New Issue
Block a user