|
|
@ -10,7 +10,7 @@ |
|
|
|
:default-expand-all="false" |
|
|
|
:default-expand-all="false" |
|
|
|
check-strictly |
|
|
|
check-strictly |
|
|
|
style="width: 400px" |
|
|
|
style="width: 400px" |
|
|
|
@change="getOkrList" |
|
|
|
@change="nodeChange" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<el-button class="ml-10px" type="primary" @click="handleAddNode">新建节点</el-button> |
|
|
|
<el-button class="ml-10px" type="primary" @click="handleAddNode">新建节点</el-button> |
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
@ -23,7 +23,7 @@ |
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<OkrTable ref="okrTableRef" /> |
|
|
|
<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" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -35,7 +35,7 @@ import DialogOkrInfo from './DialogOkrInfo.vue' |
|
|
|
import DialogOkr from './DialogOkr.vue' |
|
|
|
import DialogOkr from './DialogOkr.vue' |
|
|
|
|
|
|
|
|
|
|
|
import { getAllNodeTree, getAllOkrPage } from '@/api/okr/okr' |
|
|
|
import { getAllNodeTree, getAllOkrPage } from '@/api/okr/okr' |
|
|
|
import { listToTree } from '@/utils/tree' |
|
|
|
import { listToTree, findNode } from '@/utils/tree' |
|
|
|
|
|
|
|
|
|
|
|
const message = useMessage() |
|
|
|
const message = useMessage() |
|
|
|
|
|
|
|
|
|
|
@ -56,6 +56,10 @@ onMounted(() => { |
|
|
|
handleSearchPeroid() |
|
|
|
handleSearchPeroid() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当前是否是叶子节点 |
|
|
|
|
|
|
|
// 如果不是叶子节点,则表格数据不可修改 |
|
|
|
|
|
|
|
const isCurrentLeafNode = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
function handleSearchPeroid() { |
|
|
|
function handleSearchPeroid() { |
|
|
|
getAllNodeTree().then((resp) => { |
|
|
|
getAllNodeTree().then((resp) => { |
|
|
|
peroidList.value = listToTree(resp.tree, { |
|
|
|
peroidList.value = listToTree(resp.tree, { |
|
|
@ -63,11 +67,23 @@ function handleSearchPeroid() { |
|
|
|
pid: 'parentId', |
|
|
|
pid: 'parentId', |
|
|
|
children: 'children' |
|
|
|
children: 'children' |
|
|
|
}) |
|
|
|
}) |
|
|
|
searchForm.value.nodeId = resp.nodeId |
|
|
|
nodeChange(resp.nodeId) |
|
|
|
getOkrList() |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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() { |
|
|
|
function getOkrList() { |
|
|
|
getAllOkrPage(searchForm.value).then((resp) => { |
|
|
|
getAllOkrPage(searchForm.value).then((resp) => { |
|
|
|
const list = resp |
|
|
|
const list = resp |
|
|
@ -88,8 +104,10 @@ function handleEditOkr() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function handleUpdateProcess() { |
|
|
|
function handleUpdateProcess() { |
|
|
|
message.success('更新进度成功') |
|
|
|
okrTableRef.value.updateProcess(searchForm.value.nodeId).then(() => { |
|
|
|
getOkrList() |
|
|
|
message.success('更新成功') |
|
|
|
|
|
|
|
getOkrList() |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const dialogOkr = ref(null) |
|
|
|
const dialogOkr = ref(null) |
|
|
|