|
@@ -1,25 +1,23 @@
|
|
|
<template>
|
|
<template>
|
|
|
|
|
+ <el-row style="display: flex;flex-direction: row;align-items: center;margin-bottom: 10px;color: #333333">
|
|
|
|
|
+ <h4>项目规划</h4>
|
|
|
|
|
+ <el-tooltip class="item" effect="dark" :content="scheduleGuide" placement="right-end">
|
|
|
|
|
+ <i class="el-icon-question"></i>
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
+ </el-row>
|
|
|
<Tree :data="requirements" @change="handleTreeChange" @nodeClick="handleNodeClick" ref="tree"></Tree>
|
|
<Tree :data="requirements" @change="handleTreeChange" @nodeClick="handleNodeClick" ref="tree"></Tree>
|
|
|
- <ElDrawer v-model="showRequirementDrawer" size="650px">
|
|
|
|
|
|
|
+ <ElDrawer v-model="showRequirementDrawer" :with-header="false" size="650px">
|
|
|
<!-- TODO: 供展示和编辑节点详情,可在taskList中复用 -->
|
|
<!-- TODO: 供展示和编辑节点详情,可在taskList中复用 -->
|
|
|
<template #default>
|
|
<template #default>
|
|
|
<TaskDrawerContent
|
|
<TaskDrawerContent
|
|
|
@change="handleDrawerContentChange"
|
|
@change="handleDrawerContentChange"
|
|
|
|
|
+ @close-drawer="showRequirementDrawer = false"
|
|
|
v-bind="requirementInDrawer"
|
|
v-bind="requirementInDrawer"
|
|
|
:state-options="stateOptions"
|
|
:state-options="stateOptions"
|
|
|
:user-options="userOptions"
|
|
:user-options="userOptions"
|
|
|
:priority-options="priorityOptions">
|
|
:priority-options="priorityOptions">
|
|
|
</TaskDrawerContent></template>
|
|
</TaskDrawerContent></template>
|
|
|
</ElDrawer>
|
|
</ElDrawer>
|
|
|
- <ElDrawer v-model="addRequirementDrawer" size="650px">
|
|
|
|
|
- <template #title><h3 style="width: 100%">新建节点</h3></template>
|
|
|
|
|
- <AddDrawerContent
|
|
|
|
|
- @add-success="handleTreeChange"
|
|
|
|
|
- @add-cancel="addRequirementDrawer = false"
|
|
|
|
|
- :parent="parentOfAddingRequirement"
|
|
|
|
|
- :user-options="userOptions"
|
|
|
|
|
- :priority-options="priorityOptions"></AddDrawerContent>
|
|
|
|
|
- </ElDrawer>
|
|
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -27,150 +25,15 @@ import Tree from '@/components/Tree.vue';
|
|
|
|
|
|
|
|
import { RequirementAPI } from '@/api';
|
|
import { RequirementAPI } from '@/api';
|
|
|
import TaskDrawerContent from '@/components/TaskDrawerContent.vue';
|
|
import TaskDrawerContent from '@/components/TaskDrawerContent.vue';
|
|
|
-import AddDrawerContent from '@/components/AddDrawerContent.vue';
|
|
|
|
|
|
|
|
|
|
|
|
+const scheduleGuide = '项目规划用于asdsadsadda';
|
|
|
export default {
|
|
export default {
|
|
|
name: 'Schedule',
|
|
name: 'Schedule',
|
|
|
- components: { AddDrawerContent, TaskDrawerContent, Tree },
|
|
|
|
|
|
|
+ components: { TaskDrawerContent, Tree },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- requirements: [{
|
|
|
|
|
- deep: 1,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 1,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: null,
|
|
|
|
|
- priority: 0,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '已创建',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题1',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- deep: 2,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 2,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: 1,
|
|
|
|
|
- priority: 0,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '已创建',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题2',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- deep: 2,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 3,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: 1,
|
|
|
|
|
- priority: 0,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '进行中',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题3',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- deep: 3,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 4,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: 3,
|
|
|
|
|
- priority: 1,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '已完成',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题4',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- deep: 3,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 5,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: 3,
|
|
|
|
|
- priority: 2,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '已完成',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题5',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- deep: 4,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 6,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: 5,
|
|
|
|
|
- priority: 0,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '进行中',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题6',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- deep: 4,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 7,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: 5,
|
|
|
|
|
- priority: 0,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '已完成',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题7',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- deep: 4,
|
|
|
|
|
- description: '这里是节点描述啊啊啊。',
|
|
|
|
|
- endTime: '2021/3/17 12:00:01',
|
|
|
|
|
- groupId: 101,
|
|
|
|
|
- id: 8,
|
|
|
|
|
- leaf: false,
|
|
|
|
|
- parent: 5,
|
|
|
|
|
- priority: 0,
|
|
|
|
|
- projectId: 101,
|
|
|
|
|
- startTime: '2021/3/17 12:00:01',
|
|
|
|
|
- state: '已完成',
|
|
|
|
|
- timeToTake: 10,
|
|
|
|
|
- title: '这是标题8',
|
|
|
|
|
- type: '需求',
|
|
|
|
|
- userId: 101,
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ scheduleGuide,
|
|
|
|
|
+ requirements: [],
|
|
|
showRequirementDrawer: false,
|
|
showRequirementDrawer: false,
|
|
|
addRequirementDrawer: false,
|
|
addRequirementDrawer: false,
|
|
|
parentOfAddingRequirement: null,
|
|
parentOfAddingRequirement: null,
|
|
@@ -181,15 +44,18 @@ export default {
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
async mounted() {
|
|
async mounted() {
|
|
|
- // this.requirements = await RequirementAPI.getTreeNodesByProjectId(this.$store.state.workspace.currentProjectId);
|
|
|
|
|
|
|
+ await this.getTreeData();
|
|
|
|
|
+ console.warn('Schedule.vue_mounted');
|
|
|
// this.$refs.tree.regenerateTree();
|
|
// this.$refs.tree.regenerateTree();
|
|
|
- this.addChild2Node();
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- addChild2Node() {
|
|
|
|
|
|
|
+ async getTreeData() {
|
|
|
|
|
+ this.requirements = this.addChild2Node(await RequirementAPI.getTreeNodesByProjectId(this.$store.state.workspace.currentProjectId));
|
|
|
|
|
+ },
|
|
|
|
|
+ addChild2Node(array) {
|
|
|
const nodeMap = new Map();
|
|
const nodeMap = new Map();
|
|
|
- this.requirements.forEach((item) => nodeMap.set(item.id, item));
|
|
|
|
|
- this.requirements.forEach((item) => {
|
|
|
|
|
|
|
+ array.forEach((item) => nodeMap.set(item.id, item));
|
|
|
|
|
+ array.forEach((item) => {
|
|
|
if (item.parent) {
|
|
if (item.parent) {
|
|
|
const tempParent = nodeMap.get(item.parent);
|
|
const tempParent = nodeMap.get(item.parent);
|
|
|
if (!tempParent.childs) {
|
|
if (!tempParent.childs) {
|
|
@@ -198,14 +64,13 @@ export default {
|
|
|
tempParent.childs.push(item);
|
|
tempParent.childs.push(item);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ return array;
|
|
|
},
|
|
},
|
|
|
async handleTreeChange(msg) {
|
|
async handleTreeChange(msg) {
|
|
|
const { type, id } = msg;
|
|
const { type, id } = msg;
|
|
|
- if (type === 'addChild') this.addRequirementDrawer = true;
|
|
|
|
|
- this.parentOfAddingRequirement = id;
|
|
|
|
|
await RequirementAPI[type](id);
|
|
await RequirementAPI[type](id);
|
|
|
- // this.requirements = await RequirementAPI.getTreeNodesByProjectId(this.$store.state.workspace.currentProjectId);
|
|
|
|
|
- this.$refs.tree.regenerateTree();
|
|
|
|
|
|
|
+ console.warn('treeNode_event');
|
|
|
|
|
+ await this.getTreeData();
|
|
|
},
|
|
},
|
|
|
handleNodeClick(id) {
|
|
handleNodeClick(id) {
|
|
|
this.showRequirementDrawer = true;
|
|
this.showRequirementDrawer = true;
|
|
@@ -213,7 +78,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
handleDrawerContentChange(id) {
|
|
handleDrawerContentChange(id) {
|
|
|
this.requirementInDrawer = Array.prototype.find.call(this.requirements, (requirement) => requirement.id === id);
|
|
this.requirementInDrawer = Array.prototype.find.call(this.requirements, (requirement) => requirement.id === id);
|
|
|
- this.showRequirementDrawer = true;
|
|
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|