From bfdbef4bd7254e42ebac1dd1ab9b00f814ea7432 Mon Sep 17 00:00:00 2001
From: qsh <>
Date: Mon, 31 Mar 2025 12:12:41 +0800
Subject: [PATCH 1/4] sc
---
src/api/okr/okr.js | 9 +++++
.../OKR/Management/Components/AllTarget.vue | 32 +++++++++++----
.../OKR/Management/Components/DialogOkr.vue | 4 +-
.../Management/Components/DialogOkrInfo.vue | 14 ++++++-
.../OKR/Management/Components/OkrTable.vue | 39 +++++++++++++++++--
5 files changed, 85 insertions(+), 13 deletions(-)
diff --git a/src/api/okr/okr.js b/src/api/okr/okr.js
index e72bdc3..1f1d4fb 100644
--- a/src/api/okr/okr.js
+++ b/src/api/okr/okr.js
@@ -81,3 +81,12 @@ export const getDefaultOkrOptions = () => {
headers: { 'instance-id': 1016 }
})
}
+
+// 更新OKR进度
+export const updateOkrProgress = (data) => {
+ return request.put({
+ url: '/admin-api/okr/node/progress/update',
+ data,
+ headers: { 'instance-id': 1016 }
+ })
+}
diff --git a/src/views/OKR/Management/Components/AllTarget.vue b/src/views/OKR/Management/Components/AllTarget.vue
index 0d31bb0..e9bdf56 100644
--- a/src/views/OKR/Management/Components/AllTarget.vue
+++ b/src/views/OKR/Management/Components/AllTarget.vue
@@ -10,7 +10,7 @@
:default-expand-all="false"
check-strictly
style="width: 400px"
- @change="getOkrList"
+ @change="nodeChange"
/>
新建节点
@@ -23,7 +23,7 @@
-
+
@@ -35,7 +35,7 @@ import DialogOkrInfo from './DialogOkrInfo.vue'
import DialogOkr from './DialogOkr.vue'
import { getAllNodeTree, getAllOkrPage } from '@/api/okr/okr'
-import { listToTree } from '@/utils/tree'
+import { listToTree, findNode } from '@/utils/tree'
const message = useMessage()
@@ -56,6 +56,10 @@ onMounted(() => {
handleSearchPeroid()
})
+// 当前是否是叶子节点
+// 如果不是叶子节点,则表格数据不可修改
+const isCurrentLeafNode = ref(false)
+
function handleSearchPeroid() {
getAllNodeTree().then((resp) => {
peroidList.value = listToTree(resp.tree, {
@@ -63,11 +67,23 @@ function handleSearchPeroid() {
pid: 'parentId',
children: 'children'
})
- searchForm.value.nodeId = resp.nodeId
- getOkrList()
+ nodeChange(resp.nodeId)
})
}
+function nodeChange(nodeId) {
+ searchForm.value.nodeId = nodeId
+ getOkrList()
+ const currentNode = findNode(peroidList.value, (node) => {
+ return node.nodeId == nodeId
+ })
+ if (!currentNode.children || currentNode.children.length == 0) {
+ isCurrentLeafNode.value = true
+ } else {
+ isCurrentLeafNode.value = false
+ }
+}
+
function getOkrList() {
getAllOkrPage(searchForm.value).then((resp) => {
const list = resp
@@ -88,8 +104,10 @@ function handleEditOkr() {
}
function handleUpdateProcess() {
- message.success('更新进度成功')
- getOkrList()
+ okrTableRef.value.updateProcess(searchForm.value.nodeId).then(() => {
+ message.success('更新成功')
+ getOkrList()
+ })
}
const dialogOkr = ref(null)
diff --git a/src/views/OKR/Management/Components/DialogOkr.vue b/src/views/OKR/Management/Components/DialogOkr.vue
index 8df6a1b..845d5fc 100644
--- a/src/views/OKR/Management/Components/DialogOkr.vue
+++ b/src/views/OKR/Management/Components/DialogOkr.vue
@@ -18,7 +18,7 @@
ork落地
【节点】
- {{ nodeInfo.nodeName }}
+ {{ nodeInfo.allNodeName }}
@@ -248,7 +248,7 @@
v-for="item in nodeRecords"
:key="item.recordId"
placement="bottom"
- :timestamp="formatDate(item.createTime)"
+ :timestamp="formatDate(item.createTime, 'YYYY-MM-DD HH:mm:ss')"
color="#30d1fc"
>
{{ item.creator }}
diff --git a/src/views/OKR/Management/Components/DialogOkrInfo.vue b/src/views/OKR/Management/Components/DialogOkrInfo.vue
index d3003a0..9117993 100644
--- a/src/views/OKR/Management/Components/DialogOkrInfo.vue
+++ b/src/views/OKR/Management/Components/DialogOkrInfo.vue
@@ -1,6 +1,5 @@
item.value == kr.keyResultName)
+ if (obj) {
+ kr.isSys = true
+ } else {
+ kr.isSys = false
+ }
+ }
+}
+
async function handleSave() {
// 校验表单
if (!formRef.value) return
diff --git a/src/views/OKR/Management/Components/OkrTable.vue b/src/views/OKR/Management/Components/OkrTable.vue
index 5d141ce..d247c59 100644
--- a/src/views/OKR/Management/Components/OkrTable.vue
+++ b/src/views/OKR/Management/Components/OkrTable.vue
@@ -28,7 +28,7 @@
当前进度:
-
{{ row.currentValue }}
+
{{ row.currentValue }}
diff --git a/src/views/OKR/Management/Components/DialogOkr.vue b/src/views/OKR/Management/Components/DialogOkr.vue
index 845d5fc..db6e0bb 100644
--- a/src/views/OKR/Management/Components/DialogOkr.vue
+++ b/src/views/OKR/Management/Components/DialogOkr.vue
@@ -68,7 +68,7 @@
-
+
@@ -275,6 +275,7 @@ import { getOkrNodeDetail, getOkrNodeHistory } from '@/api/okr/okr'
const emit = defineEmits(['edit'])
const show = ref(false)
+const canEdit = ref(false)
const toolbarConfig = {
toolbarKeys: [
@@ -302,9 +303,10 @@ const nodeInfo = ref({})
const nodeRecords = ref([])
-async function open(id) {
+async function open(curNode) {
+ canEdit.value = curNode.canEdit
try {
- getOkrNodeDetail(id).then((resp) => {
+ getOkrNodeDetail(curNode.nodeId).then((resp) => {
nodeInfo.value = resp
if (resp.objectives) {
okrList.value = resp.objectives.map((item) => ({
@@ -319,7 +321,7 @@ async function open(id) {
okrTableRef.value.prepareData(okrList.value)
})
})
- getOkrNodeHistory(id).then((resp) => {
+ getOkrNodeHistory(curNode.nodeId).then((resp) => {
nodeRecords.value = resp
})
} finally {
diff --git a/src/views/OKR/Management/Components/DialogOkrInfo.vue b/src/views/OKR/Management/Components/DialogOkrInfo.vue
index 9117993..1e791e5 100644
--- a/src/views/OKR/Management/Components/DialogOkrInfo.vue
+++ b/src/views/OKR/Management/Components/DialogOkrInfo.vue
@@ -378,7 +378,6 @@ const defaultProps = {
}
const sourceOptions = ref([])
const objectList = ref([])
-
function open(type, val) {
show.value = true
title.value = type == 'update' ? '修改Okr' : '新增Okr'
From f1d24495995242248b88e102f516f69ca232a32b Mon Sep 17 00:00:00 2001
From: qsh <>
Date: Mon, 31 Mar 2025 12:26:37 +0800
Subject: [PATCH 3/4] sc
---
src/views/OKR/Management/Components/DialogOkr.vue | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/views/OKR/Management/Components/DialogOkr.vue b/src/views/OKR/Management/Components/DialogOkr.vue
index db6e0bb..003b04e 100644
--- a/src/views/OKR/Management/Components/DialogOkr.vue
+++ b/src/views/OKR/Management/Components/DialogOkr.vue
@@ -305,6 +305,12 @@ const nodeRecords = ref([])
async function open(curNode) {
canEdit.value = curNode.canEdit
+ searchInfo(curNode)
+ show.value = true
+ // 获取数据详情
+}
+
+function searchInfo(curNode) {
try {
getOkrNodeDetail(curNode.nodeId).then((resp) => {
nodeInfo.value = resp
@@ -326,8 +332,6 @@ async function open(curNode) {
})
} finally {
}
- show.value = true
- // 获取数据详情
}
function close() {
@@ -337,7 +341,10 @@ function close() {
defineExpose({ open, close })
function handleSaveProcess() {
- console.log(okrList.value)
+ okrTableRef.value.updateProcess(nodeInfo.value.nodeId).then(() => {
+ message.success('更新成功')
+ searchInfo()
+ })
}
function handleChildItem() {
From 8a2d976552a826dff8dde43d65f5ec84cc9ef2c7 Mon Sep 17 00:00:00 2001
From: qsh <>
Date: Mon, 31 Mar 2025 17:45:00 +0800
Subject: [PATCH 4/4] sc
---
src/api/okr/comment.js | 29 +++++++
src/api/okr/okr.js | 40 ++++-----
src/api/okr/wait.js | 36 ++++----
.../OKR/Management/Components/DialogOkr.vue | 87 ++++++++++++++-----
.../OKR/Management/Components/OkrTable.vue | 7 +-
5 files changed, 137 insertions(+), 62 deletions(-)
create mode 100644 src/api/okr/comment.js
diff --git a/src/api/okr/comment.js b/src/api/okr/comment.js
new file mode 100644
index 0000000..a9758a9
--- /dev/null
+++ b/src/api/okr/comment.js
@@ -0,0 +1,29 @@
+import request from '@/config/axios'
+
+// 创建
+export const createComment = (data) => {
+ return request.post({
+ url: '/admin-api/okr/comments/create',
+ data,
+ isSubmitForm: true,
+ headers: { 'instance-id': 1016 }
+ })
+}
+
+// 分页
+export const getCommentPage = (params) => {
+ return request.get({
+ url: '/admin-api/okr/comments/page',
+ params,
+ headers: { 'instance-id': 1016 }
+ })
+}
+
+// 获取评论类型
+export const getCommentTypeOptions = () => {
+ return request.get({
+ url: '/admin-api/okr/dict-data/get-by-type',
+ params: { dictType: 'comment_type' }
+ // headers: { 'instance-id': 1016 }
+ })
+}
diff --git a/src/api/okr/okr.js b/src/api/okr/okr.js
index 1f1d4fb..a274ab0 100644
--- a/src/api/okr/okr.js
+++ b/src/api/okr/okr.js
@@ -5,8 +5,8 @@ export const createOkrNode = (data) => {
return request.post({
url: '/admin-api/okr/node/add',
data,
- isSubmitForm: true,
- headers: { 'instance-id': 1016 }
+ isSubmitForm: true
+ // headers: { 'instance-id': 1016 }
})
}
@@ -14,8 +14,8 @@ export const createOkrNode = (data) => {
export const updateOkrNode = (data) => {
return request.put({
url: '/admin-api/okr/node/update',
- data,
- headers: { 'instance-id': 1016 }
+ data
+ // headers: { 'instance-id': 1016 }
})
}
@@ -23,8 +23,8 @@ export const updateOkrNode = (data) => {
export const getOkrNodeDetail = (nodeId) => {
return request.get({
url: '/admin-api/okr/node/get',
- params: { nodeId },
- headers: { 'instance-id': 1016 }
+ params: { nodeId }
+ // headers: { 'instance-id': 1016 }
})
}
@@ -32,8 +32,8 @@ export const getOkrNodeDetail = (nodeId) => {
export const getMyNodeTree = (params) => {
return request.get({
url: '/admin-api/okr/node/my/list',
- params,
- headers: { 'instance-id': 1016 }
+ params
+ // headers: { 'instance-id': 1016 }
})
}
@@ -41,8 +41,8 @@ export const getMyNodeTree = (params) => {
export const getMyOkrPage = (params) => {
return request.get({
url: '/admin-api/okr/node/my/object/list',
- params,
- headers: { 'instance-id': 1016 }
+ params
+ // headers: { 'instance-id': 1016 }
})
}
@@ -50,8 +50,8 @@ export const getMyOkrPage = (params) => {
export const getAllNodeTree = (params) => {
return request.get({
url: '/admin-api/okr/node/all/list',
- params,
- headers: { 'instance-id': 1016 }
+ params
+ // headers: { 'instance-id': 1016 }
})
}
@@ -59,8 +59,8 @@ export const getAllNodeTree = (params) => {
export const getAllOkrPage = (params) => {
return request.get({
url: '/admin-api/okr/node/all/object/list',
- params,
- headers: { 'instance-id': 1016 }
+ params
+ // headers: { 'instance-id': 1016 }
})
}
@@ -68,8 +68,8 @@ export const getAllOkrPage = (params) => {
export const getOkrNodeHistory = (nodeId) => {
return request.get({
url: '/admin-api/okr/record/list',
- params: { nodeId },
- headers: { 'instance-id': 1016 }
+ params: { nodeId }
+ // headers: { 'instance-id': 1016 }
})
}
@@ -77,8 +77,8 @@ export const getOkrNodeHistory = (nodeId) => {
export const getDefaultOkrOptions = () => {
return request.get({
url: '/admin-api/okr/dict-data/get-by-type',
- params: { dictType: 'key_result_source' },
- headers: { 'instance-id': 1016 }
+ params: { dictType: 'key_result_source' }
+ // headers: { 'instance-id': 1016 }
})
}
@@ -86,7 +86,7 @@ export const getDefaultOkrOptions = () => {
export const updateOkrProgress = (data) => {
return request.put({
url: '/admin-api/okr/node/progress/update',
- data,
- headers: { 'instance-id': 1016 }
+ data
+ // headers: { 'instance-id': 1016 }
})
}
diff --git a/src/api/okr/wait.js b/src/api/okr/wait.js
index 2431c03..fa8517e 100644
--- a/src/api/okr/wait.js
+++ b/src/api/okr/wait.js
@@ -5,8 +5,8 @@ export const createWait = (data) => {
return request.post({
url: '/admin-api/okr/agent-work/create',
data,
- isSubmitForm: true,
- headers: { 'instance-id': 1016 }
+ isSubmitForm: true
+ // headers: { 'instance-id': 1016 }
})
}
@@ -14,8 +14,8 @@ export const createWait = (data) => {
export const updateWait = (data) => {
return request.put({
url: '/admin-api/okr/agent-work/update',
- data,
- headers: { 'instance-id': 1016 }
+ data
+ // headers: { 'instance-id': 1016 }
})
}
@@ -23,8 +23,8 @@ export const updateWait = (data) => {
export const getWaitPage = (params) => {
return request.get({
url: '/admin-api/okr/agent-work/page',
- params,
- headers: { 'instance-id': 1016 }
+ params
+ // headers: { 'instance-id': 1016 }
})
}
@@ -32,8 +32,8 @@ export const getWaitPage = (params) => {
export const getWaitDetail = (id) => {
return request.get({
url: '/admin-api/okr/agent-work/get',
- params: { id },
- headers: { 'instance-id': 1016 }
+ params: { id }
+ // headers: { 'instance-id': 1016 }
})
}
@@ -41,8 +41,8 @@ export const getWaitDetail = (id) => {
export const deleteWait = (id) => {
return request.delete({
url: '/admin-api/okr/agent-work/delete',
- params: { id },
- headers: { 'instance-id': 1016 }
+ params: { id }
+ // headers: { 'instance-id': 1016 }
})
}
@@ -50,8 +50,8 @@ export const deleteWait = (id) => {
export const urgeWait = (workId) => {
return request.get({
url: '/admin-api/okr/agent-work/urge',
- params: { workId },
- headers: { 'instance-id': 1016 }
+ params: { workId }
+ // headers: { 'instance-id': 1016 }
})
}
@@ -60,8 +60,8 @@ export const followWait = (data) => {
return request.post({
url: '/admin-api/okr/agent-work-follow/create',
data,
- isSubmitForm: true,
- headers: { 'instance-id': 1016 }
+ isSubmitForm: true
+ // headers: { 'instance-id': 1016 }
})
}
@@ -69,15 +69,15 @@ export const followWait = (data) => {
export const getFollowWaitPage = (params) => {
return request.get({
url: '/admin-api/okr/agent-work-follow/list',
- params,
- headers: { 'instance-id': 1016 }
+ params
+ // headers: { 'instance-id': 1016 }
})
}
export const getWaitCount = (params) => {
return request.get({
url: '/admin-api/okr/agent-work/getAgentWorkNum',
- params,
- headers: { 'instance-id': 1016 }
+ params
+ // headers: { 'instance-id': 1016 }
})
}
diff --git a/src/views/OKR/Management/Components/DialogOkr.vue b/src/views/OKR/Management/Components/DialogOkr.vue
index 003b04e..f430229 100644
--- a/src/views/OKR/Management/Components/DialogOkr.vue
+++ b/src/views/OKR/Management/Components/DialogOkr.vue
@@ -134,11 +134,12 @@
style="width: 120px"
@change="getCommentTemplate"
>
-
-
-
-
-
+
@@ -158,7 +159,12 @@
:toolbarConfig="toolbarConfig"
/>
-
+
-
门庆
+
{{ it.creatorName }}
-
西门庆
+
{{ it.creatorName }}
-
01-01 12:15
+
{{ it.createTime }}
-
+
- 6
+ {{ it.likeCount }}
- 1
+ {{ it.commentCount }}
@@ -271,6 +277,7 @@ import { formatDate } from '@/utils/formatTime'
import OkrTable from './OkrTable.vue'
import { getOkrNodeDetail, getOkrNodeHistory } from '@/api/okr/okr'
+import { getCommentTypeOptions, createComment, getCommentPage } from '@/api/okr/comment'
const emit = defineEmits(['edit'])
@@ -302,12 +309,14 @@ const okrTableRef = ref(null)
const nodeInfo = ref({})
const nodeRecords = ref([])
+const commentTypeOptions = ref([])
async function open(curNode) {
canEdit.value = curNode.canEdit
+ nodeInfo.value.nodeId = curNode.nodeId
+ // 获取数据详情
searchInfo(curNode)
show.value = true
- // 获取数据详情
}
function searchInfo(curNode) {
@@ -330,6 +339,10 @@ function searchInfo(curNode) {
getOkrNodeHistory(curNode.nodeId).then((resp) => {
nodeRecords.value = resp
})
+ getCommentTypeOptions().then((resp) => {
+ commentTypeOptions.value = resp
+ })
+ searchCommentList()
} finally {
}
}
@@ -354,28 +367,60 @@ function handleChildItem() {
const addNewComment = ref(false)
const form = ref({
commentValue: '',
- commentType: 1
+ commentType: undefined
})
function handleInsertComment() {
addNewComment.value = true
- form.value = {
- commentValue: '',
- commentType: 1
+ const defaultComment = commentTypeOptions.value[0]
+ if (defaultComment) {
+ form.value = {
+ commentType: defaultComment.id,
+ mentionedUserIdList: []
+ }
}
getCommentTemplate()
}
function getCommentTemplate() {
- form.value.commentValue = `一、工作概况
二、数据统计
- 呼出电话数:
- 有效沟通数:
- 销售成果
三、问题与改进方案
`
+ if (form.value.commentType) {
+ form.value.commentValue = commentTypeOptions.value.find(
+ (item) => item.id == form.value.commentType
+ ).remark
+ } else {
+ form.value.commentValue = `一、工作概况
二、数据统计
- 呼出电话数:
- 有效沟通数:
- 销售成果
三、问题与改进方案
`
+ }
}
function handleSaveComment() {
addNewComment.value = false
+ try {
+ const data = {
+ businessType: 1,
+ businessId: nodeInfo.value.nodeId,
+ contentType: 1,
+ content: form.value.commentValue,
+ mentionedUserIdList: form.value.mentionedUserIdList
+ }
+ createComment(data).then(() => {
+ message.success('评论成功')
+ searchCommentList()
+ })
+ } catch (error) {
+ message.error('评论失败')
+ }
}
+const commentList = ref([])
-const commentListVal = ref(
- `一、工作概况
刷牙洗脸吃饭穿鞋出门开车上班捣台球
二、数据统计
- 呼出电话数:666
- 有效沟通数:123
- 销售成果:今日成交20,本月成交120,距离目标还差888
三、问题与改进方案
无
`
-)
+function searchCommentList() {
+ getCommentPage({
+ businessType: 1,
+ businessId: nodeInfo.value.nodeId,
+ pageNum: 1,
+ pageSize: 100
+ }).then((resp) => {
+ commentList.value = resp.list
+ })
+}
function good(index) {
console.log(index)
diff --git a/src/views/OKR/Management/Components/OkrTable.vue b/src/views/OKR/Management/Components/OkrTable.vue
index d247c59..27f741c 100644
--- a/src/views/OKR/Management/Components/OkrTable.vue
+++ b/src/views/OKR/Management/Components/OkrTable.vue
@@ -41,8 +41,8 @@
v-model="row.currentValue"
size="small"
>
- 是
- 否
+ 是
+ 否
@@ -99,7 +99,8 @@ function prepareData(list) {
executorName: child.executorName,
type: '关键成果',
resultType: child.resultType,
- targetValue: child.targetValue
+ targetValue: child.targetValue,
+ currentValue: Number(child.currentValue)
}
helpList.value.push(kr)
return kr