Merge branch 'main' of http://114.215.207.150:3000/qiushanhe/ss-oa-manage-web into dev-cl
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import router from './router'
|
||||
import { isRelogin } from '@/config/axios/service'
|
||||
import { getAccessToken, removeToken } from '@/utils/auth'
|
||||
import { getAccessToken } from '@/utils/auth'
|
||||
import { useTitle } from '@/hooks/web/useTitle'
|
||||
import { useNProgress } from '@/hooks/web/useNProgress'
|
||||
import { usePageLoading } from '@/hooks/web/usePageLoading'
|
||||
import { useDictStoreWithOut } from '@/store/modules/dict'
|
||||
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
||||
import { getTenantId, getAppId } from '@/utils/auth'
|
||||
import cache from '@/plugins/cache'
|
||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||
import { getTenantId, getAppId, setTenantId, setAppId } from '@/utils/auth'
|
||||
|
||||
const { start, done } = useNProgress()
|
||||
|
||||
@@ -20,58 +20,72 @@ const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/regis
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
start()
|
||||
loadStart()
|
||||
if (getAppId() && to.query?.appId && getAppId() != to.query?.appId) {
|
||||
removeToken()
|
||||
cache?.local?.delete('appInfo')
|
||||
cache?.local?.delete('roleRouters')
|
||||
cache?.local?.delete('user')
|
||||
cache?.local?.delete('App_ID')
|
||||
next(`/login?tenantId=${to.query?.tenantId}&appId=${to.query?.appId}`)
|
||||
} else {
|
||||
if (getAccessToken()) {
|
||||
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()
|
||||
}
|
||||
const userStore = useUserStoreWithOut()
|
||||
if (to.path == '/login') {
|
||||
userStore.resetState() // 重置用户信息状态
|
||||
}
|
||||
if (getAccessToken()) {
|
||||
if (to.path === '/login') {
|
||||
if (to.query?.tenantId && to.query?.appId) {
|
||||
setApp(to.query.tenantId, to.query.appId)
|
||||
await waitTime(1500)
|
||||
}
|
||||
next({ path: '/' })
|
||||
} 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 {
|
||||
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}`) // 否则全部重定向到登录页
|
||||
}
|
||||
next()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
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) => {
|
||||
useTitle(to?.meta?.title)
|
||||
done() // 结束Progress
|
||||
|
||||
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.isSetDict = true
|
||||
} else {
|
||||
const res = await listSimpleDictData()
|
||||
const res = (await listSimpleDictData()) || []
|
||||
// 设置数据
|
||||
const dictDataMap = new Map<string, any>()
|
||||
res.forEach((dictData: DictDataVO) => {
|
||||
@@ -75,7 +75,7 @@ export const useDictStore = defineStore('dict', {
|
||||
},
|
||||
async resetDict() {
|
||||
cache.session.delete(CACHE_KEY.DICT_CACHE)
|
||||
const res = await listSimpleDictData()
|
||||
const res = (await listSimpleDictData()) || []
|
||||
// 设置数据
|
||||
const dictDataMap = new Map<string, any>()
|
||||
res.forEach((dictData: DictDataVO) => {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
|
||||
import { store } from '../index'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import remainingRouter from '@/router/modules/remaining'
|
||||
import staticRouter from '@/router/modules/static'
|
||||
import { generateRoute, flatMultiLevelRoutes } from '@/utils/routerHelper'
|
||||
import { CACHE_KEY } from '@/hooks/web/useCache'
|
||||
|
||||
@@ -37,6 +38,25 @@ export const usePermissionStore = defineStore('permission', {
|
||||
if (cache.local.get(CACHE_KEY.ROLE_ROUTERS)) {
|
||||
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)
|
||||
// 动态路由,404一定要放到最后面
|
||||
this.addRouters = routerMap.concat([
|
||||
@@ -50,6 +70,7 @@ export const usePermissionStore = defineStore('permission', {
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
// 渲染菜单的所有路由
|
||||
this.routers = cloneDeep(remainingRouter).concat(routerMap)
|
||||
resolve()
|
||||
|
||||
@@ -63,7 +63,7 @@ export const useUserStore = defineStore('admin-user', {
|
||||
async loginOut() {
|
||||
await loginOut()
|
||||
removeToken()
|
||||
cache.local.clear()
|
||||
// cache.local.clear()
|
||||
this.resetState()
|
||||
},
|
||||
resetState() {
|
||||
@@ -75,6 +75,7 @@ export const useUserStore = defineStore('admin-user', {
|
||||
avatar: '',
|
||||
nickname: ''
|
||||
}
|
||||
cache.local.delete(CACHE_KEY.USER)
|
||||
},
|
||||
refresh() {
|
||||
cache.local.delete(CACHE_KEY.USER)
|
||||
|
||||
@@ -9,26 +9,34 @@ const RefreshTokenKey = 'REFRESH_TOKEN'
|
||||
// 获取token
|
||||
export const getAccessToken = () => {
|
||||
// 此处与TokenKey相同,此写法解决初始化时Cookies中不存在TokenKey报错
|
||||
return cache.local.get(AccessTokenKey)
|
||||
? cache.local.get(AccessTokenKey)
|
||||
: cache.local.get('ACCESS_TOKEN')
|
||||
return localStorage.getItem(AccessTokenKey)
|
||||
? localStorage.getItem(AccessTokenKey)
|
||||
: localStorage.getItem('ACCESS_TOKEN')
|
||||
// return cache.local.get(AccessTokenKey)
|
||||
// ? cache.local.get(AccessTokenKey)
|
||||
// : cache.local.get('ACCESS_TOKEN')
|
||||
}
|
||||
|
||||
// 刷新token
|
||||
export const getRefreshToken = () => {
|
||||
return cache.local.get(RefreshTokenKey)
|
||||
return localStorage.getItem(RefreshTokenKey)
|
||||
// return cache.local.get(RefreshTokenKey)
|
||||
}
|
||||
|
||||
// 设置token
|
||||
export const setToken = (token: TokenType) => {
|
||||
cache.local.set(RefreshTokenKey, token.refreshToken)
|
||||
cache.local.set(AccessTokenKey, token.accessToken)
|
||||
localStorage.setItem(AccessTokenKey, token.accessToken)
|
||||
localStorage.setItem(RefreshTokenKey, token.refreshToken)
|
||||
// cache.local.set(RefreshTokenKey, token.refreshToken)
|
||||
// cache.local.set(AccessTokenKey, token.accessToken)
|
||||
}
|
||||
|
||||
// 删除token
|
||||
export const removeToken = () => {
|
||||
cache.local.delete(AccessTokenKey)
|
||||
cache.local.delete(RefreshTokenKey)
|
||||
localStorage.removeItem(AccessTokenKey)
|
||||
localStorage.removeItem(RefreshTokenKey)
|
||||
// cache.local.delete(AccessTokenKey)
|
||||
// cache.local.delete(RefreshTokenKey)
|
||||
}
|
||||
|
||||
/** 格式化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
|
||||
}
|
||||
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>
|
||||
@@ -72,7 +72,7 @@ const isCurrentLeafNode = ref(false)
|
||||
function handleSearchPeroid() {
|
||||
getAllNodeTree().then((resp) => {
|
||||
if (resp.nodeId) {
|
||||
peroidList.value = listToTree(resp.tree, {
|
||||
peroidList.value = listToTree(resp?.tree || [], {
|
||||
id: 'nodeId',
|
||||
pid: 'parentId',
|
||||
children: 'children'
|
||||
@@ -103,9 +103,14 @@ function nodeChange(nodeId) {
|
||||
function getOkrList() {
|
||||
getAllOkrPage(searchForm.value).then((resp) => {
|
||||
const list = resp
|
||||
nextTick(() => {
|
||||
okrTableRef.value.prepareData(list)
|
||||
})
|
||||
if (list && list.length > 0) {
|
||||
nextTick(() => {
|
||||
okrTableRef.value.prepareData(list)
|
||||
})
|
||||
} else {
|
||||
// 如果没有数据,清空表格
|
||||
okrTableRef.value.prepareData([])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ handleSearchPeroid()
|
||||
|
||||
function handleSearchPeroid() {
|
||||
getMyNodeTree().then((resp) => {
|
||||
peroidList.value = listToTree(resp.tree, {
|
||||
peroidList.value = listToTree(resp?.tree || [], {
|
||||
id: 'nodeId',
|
||||
pid: 'parentId',
|
||||
children: 'children'
|
||||
@@ -66,9 +66,14 @@ function handleSearchPeroid() {
|
||||
function getOkrList() {
|
||||
getMyOkrPage(searchForm.value).then((resp) => {
|
||||
const list = resp
|
||||
nextTick(() => {
|
||||
okrTableRef.value.prepareData(list)
|
||||
})
|
||||
if (list && list.length > 0) {
|
||||
nextTick(() => {
|
||||
okrTableRef.value.prepareData(list)
|
||||
})
|
||||
} else {
|
||||
// 如果没有数据,清空表格
|
||||
okrTableRef.value.prepareData([])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ handleSearchPeroid()
|
||||
|
||||
function handleSearchPeroid() {
|
||||
getMySonNodeTree({ userId: props.userId }).then((resp) => {
|
||||
peroidList.value = listToTree(resp.tree, {
|
||||
peroidList.value = listToTree(resp?.tree || [], {
|
||||
id: 'nodeId',
|
||||
pid: 'parentId',
|
||||
children: 'children'
|
||||
@@ -80,9 +80,14 @@ function getOkrList() {
|
||||
...searchForm.value,
|
||||
userId: props.userId
|
||||
}).then((resp) => {
|
||||
nextTick(() => {
|
||||
okrTableRef.value.prepareData(resp)
|
||||
})
|
||||
if (resp && resp.length > 0) {
|
||||
nextTick(() => {
|
||||
okrTableRef.value.prepareData(resp)
|
||||
})
|
||||
} else {
|
||||
// 如果没有数据,清空表格
|
||||
okrTableRef.value.prepareData([])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,10 @@ const okrList = ref([])
|
||||
const helpList = ref([])
|
||||
|
||||
function prepareData(list) {
|
||||
if (!list || !Array.isArray(list) || list.length === 0) {
|
||||
okrList.value = []
|
||||
return
|
||||
}
|
||||
helpList.value = []
|
||||
expandedRows.value = {}
|
||||
okrList.value = list.map((item) => {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<el-tab-pane label="我负责的" name="0">
|
||||
<MyDuty v-if="tabIndex == 0" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="待办事项" name="1">
|
||||
<!-- <el-tab-pane label="待办事项" name="1">
|
||||
<WaitTarget v-if="tabIndex == 1" />
|
||||
</el-tab-pane>
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane label="全部目标" name="2">
|
||||
<AllTarget v-if="tabIndex == 2" />
|
||||
</el-tab-pane>
|
||||
@@ -48,7 +48,7 @@ import AllTarget from './Components/AllTarget.vue'
|
||||
import MyDuty from './Components/MyDuty.vue'
|
||||
import MySon from './Components/MySon.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'
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
<script setup name="WaitTarget">
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
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'
|
||||
|
||||
Reference in New Issue
Block a user