feat(日志管理): 开发日志管理功能。
fix(项目任务): 1、任务完成后需要依然能够修改工作日志,但是只能修改工作内容和上传附件。2、任务完成后,协办人的工作日志不应该能删除、所有任务里的成员不能新增工作日志,前端不显示新增、删除按钮。3、团队成员的面板,在成员排序时,让有下属的成员提前。4、在任务弹出框有个快速用执行的信息填充的icon。
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
defineOptions({ name: 'SubordinateSelector' });
|
||||
|
||||
interface Props {
|
||||
@@ -17,6 +19,41 @@ const selectedUserId = defineModel<string | null>('selectedUserId', {
|
||||
default: null
|
||||
});
|
||||
|
||||
function sortSubordinateNodes(
|
||||
nodes: Api.SystemManage.MySubordinateTreeNode[] | null | undefined
|
||||
): Api.SystemManage.MySubordinateTreeNode[] | null {
|
||||
if (!nodes?.length) return null;
|
||||
|
||||
return nodes
|
||||
.map((node, index) => ({
|
||||
...node,
|
||||
children: sortSubordinateNodes(node.children),
|
||||
originalIndex: index
|
||||
}))
|
||||
.sort((left, right) => {
|
||||
const leftHasChildren = (left.children?.length ?? 0) > 0 ? 1 : 0;
|
||||
const rightHasChildren = (right.children?.length ?? 0) > 0 ? 1 : 0;
|
||||
|
||||
if (leftHasChildren !== rightHasChildren) {
|
||||
return rightHasChildren - leftHasChildren;
|
||||
}
|
||||
|
||||
return left.originalIndex - right.originalIndex;
|
||||
})
|
||||
.map(({ originalIndex: _ignored, ...node }) => node);
|
||||
}
|
||||
|
||||
const treeData = computed<Api.SystemManage.MySubordinateTreeNode[] | null>(() => {
|
||||
if (!props.data) return null;
|
||||
|
||||
return [
|
||||
{
|
||||
...props.data,
|
||||
children: sortSubordinateNodes(props.data.children)
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
function handleNodeClick(node: Api.SystemManage.MySubordinateTreeNode) {
|
||||
selectedUserId.value = node.userId;
|
||||
}
|
||||
@@ -40,7 +77,7 @@ function renderNodeLabel(node: Api.SystemManage.MySubordinateTreeNode) {
|
||||
<ElEmpty v-if="!props.data" :image-size="88" :description="props.emptyText" />
|
||||
<ElTree
|
||||
v-else
|
||||
:data="[props.data]"
|
||||
:data="treeData || []"
|
||||
node-key="userId"
|
||||
:current-node-key="selectedUserId || undefined"
|
||||
:props="{ label: 'userNickname', children: 'children' }"
|
||||
|
||||
Reference in New Issue
Block a user