dev-cl^2
qsh 4 weeks ago
parent 33965c55f9
commit e5e86e24e5
  1. 4
      .env.base
  2. 12
      src/permission.js
  3. 47
      src/router/modules/static.ts
  4. 21
      src/store/modules/permission.ts
  5. 1
      src/store/modules/user.ts
  6. 80
      src/utils/tableObjectSpanMethod.js
  7. 177
      src/views/OKR/Analysis/index.vue
  8. 7
      src/views/OKR/Management/Components/AllTarget.vue
  9. 7
      src/views/OKR/Management/Components/MyDuty.vue
  10. 7
      src/views/OKR/Management/Components/MySon.vue
  11. 4
      src/views/OKR/Management/Components/OkrTable.vue
  12. 6
      src/views/OKR/Management/index.vue
  13. 0
      src/views/OKR/Wait/Components/DialogWait.vue
  14. 2
      src/views/OKR/Wait/index.vue

@ -6,9 +6,9 @@ VITE_DEV=true
# 请求路径
# 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.215.207.150:48080'
VITE_BASE_URL='http://114.215.207.150:48080'
# 上传路径
VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload'

@ -20,18 +20,20 @@ const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/regis
router.beforeEach(async (to, from, next) => {
start()
loadStart()
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)
} else {
next({ path: '/' })
}
next({ path: '/' })
} else {
// 获取所有字典
const dictStore = useDictStoreWithOut()
const userStore = useUserStoreWithOut()
const permissionStore = usePermissionStoreWithOut()
if (!dictStore.getIsSetDict) {
await dictStore.setDictMap()
@ -60,9 +62,9 @@ router.beforeEach(async (to, from, next) => {
const tenantId = getTenantId()
const appId = getAppId()
if (tenantId && appId) {
next(`/oa/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
next(`/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
} else {
next(`/oa/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
}
}
}

@ -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

@ -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()

@ -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)

@ -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
}

@ -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
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
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) => {
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'
Loading…
Cancel
Save