sc
This commit is contained in:
@@ -87,6 +87,7 @@ function nodeChange(nodeId) {
|
||||
const currentNode = findNode(peroidList.value, (node) => {
|
||||
return node.nodeId == nodeId
|
||||
})
|
||||
searchForm.value.creatorId = currentNode.creatorId
|
||||
if (!currentNode.children || currentNode.children.length == 0) {
|
||||
isCurrentLeafNode.value = true
|
||||
} else {
|
||||
@@ -108,9 +109,9 @@ function handleAddNode() {
|
||||
dialogOkrInfo.value.open('create', null)
|
||||
}
|
||||
|
||||
function handleEditOkr() {
|
||||
function handleEditOkr(nodeId = undefined) {
|
||||
dialogOkr.value.close()
|
||||
dialogOkrInfo.value.open('update', searchForm.value.nodeId, 2)
|
||||
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2)
|
||||
}
|
||||
|
||||
function handleUpdateProcess() {
|
||||
|
||||
@@ -38,7 +38,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<Icon icon="ep:edit" :size="16" />
|
||||
</el-tooltip>
|
||||
|
||||
@@ -471,7 +471,7 @@ function removeKR(oIdx, krIdx) {
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
childNodeList.value.push({})
|
||||
childNodeList.value.push({ dataScope: 1 })
|
||||
}
|
||||
|
||||
function removeChildNode(idx) {
|
||||
@@ -512,9 +512,31 @@ async function handleSave() {
|
||||
if (!formRef.value) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
|
||||
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
|
||||
try {
|
||||
form.value.isAutoAddChild = isAutoAddChild
|
||||
form.value.objectives = objectList.value
|
||||
form.value.children = childNodeList.value
|
||||
if (formType.value === 'create') {
|
||||
|
||||
@@ -77,9 +77,9 @@ const dialogOkrInfo = ref(null)
|
||||
// dialogOkrInfo.value.open('create', null)
|
||||
// }
|
||||
|
||||
function handleEditOkr() {
|
||||
function handleEditOkr(nodeId = undefined) {
|
||||
dialogOkr.value.close()
|
||||
dialogOkrInfo.value.open('update', 1, 1)
|
||||
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 1)
|
||||
}
|
||||
|
||||
function handleUpdateProcess() {
|
||||
|
||||
@@ -9,23 +9,33 @@
|
||||
:render-after-expand="false"
|
||||
:default-expand-all="false"
|
||||
style="width: 400px"
|
||||
@change="getOkrList"
|
||||
@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="MyDuty">
|
||||
<script setup name="MySon">
|
||||
import OkrTable from './OkrTable.vue'
|
||||
import DialogOkr from './DialogOkr.vue'
|
||||
import { listToTree } from '@/utils/tree'
|
||||
import DialogOkrInfo from './DialogOkrInfo.vue'
|
||||
import { listToTree, findNode } from '@/utils/tree'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
import { getMySonNodeTree, getMySonOkrPage } from '@/api/okr/okr'
|
||||
|
||||
@@ -42,6 +52,9 @@ const defaultProps = {
|
||||
children: 'children'
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
const currentUserId = userStore.getUser.id
|
||||
|
||||
const okrTableRef = ref(null)
|
||||
const searchForm = ref({
|
||||
nodeId: undefined
|
||||
@@ -58,8 +71,7 @@ function handleSearchPeroid() {
|
||||
pid: 'parentId',
|
||||
children: 'children'
|
||||
})
|
||||
searchForm.value.nodeId = resp.nodeId
|
||||
getOkrList()
|
||||
nodeChange(resp.nodeId)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -68,21 +80,35 @@ function getOkrList() {
|
||||
...searchForm.value,
|
||||
userId: props.userId
|
||||
}).then((resp) => {
|
||||
const list = resp
|
||||
nextTick(() => {
|
||||
okrTableRef.value.prepareData(list)
|
||||
okrTableRef.value.prepareData(resp)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
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: 1
|
||||
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>
|
||||
|
||||
@@ -189,9 +189,9 @@ function handleAddNode() {
|
||||
dialogOkrInfo.value.open('create', null)
|
||||
}
|
||||
|
||||
function handleEditOkr() {
|
||||
function handleEditOkr(nodeId = undefined) {
|
||||
dialogOkr.value.close()
|
||||
dialogOkrInfo.value.open('update', 1)
|
||||
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user