优化甘特图

This commit is contained in:
kuaifan 2022-03-16 16:13:01 +08:00
parent c53db63cc7
commit 5497bd97b2
2 changed files with 47 additions and 14 deletions

View File

@ -16,7 +16,7 @@
:name="item.id"
:class="{'dropdown-active':filtrProjectId == item.id}">
{{ item.name }}
<span v-if="item.tasks">({{ item.tasks.length }})</span>
<span v-if="item.tasks">({{ filtrLength(item.tasks) }})</span>
</DropdownItem>
</DropdownMenu>
</Dropdown>
@ -39,7 +39,7 @@
</template>
<script>
import {mapState} from "vuex";
import {mapGetters, mapState} from "vuex";
import GanttView from "../../../components/GanttView";
export default {
@ -49,6 +49,9 @@ export default {
projectColumn: {
default: []
},
flowInfo: {
default: {}
},
},
data() {
@ -105,12 +108,18 @@ export default {
computed: {
...mapState(['userId', 'windowWidth', 'taskPriority']),
...mapGetters(['projectParameter']),
menuWidth() {
return this.windowWidth < 1440 ? 180 : 260;
},
dropStyle() {
return this.windowWidth < 1440 ? {left: '142px'} : {};
},
completedTask() {
return this.projectParameter('completedTask');
}
},
@ -120,6 +129,15 @@ export default {
this.initData();
},
deep: true,
},
flowInfo: {
handler() {
this.initData();
},
deep: true,
},
completedTask() {
this.initData();
}
},
@ -129,6 +147,18 @@ export default {
this.projectColumn && this.projectColumn.some(this.checkAdd);
},
filtrLength(list) {
return list.filter(taskData => {
if (taskData.complete_at && !this.completedTask) {
return false;
}
if (this.flowInfo.value > 0 && taskData.flow_item_id !== this.flowInfo.value) {
return false;
}
return true
}).length
},
checkAdd(item) {
if (this.filtrProjectId > 0) {
if (item.id != this.filtrProjectId) {
@ -141,18 +171,20 @@ export default {
let start = times.start;
let end = times.end;
//
let color = '#058ce4';
if (taskData.complete_at) {
return;
} else {
//
this.taskPriority.some(level => {
if (level.priority === taskData.p_level) {
color = level.color;
return true;
}
});
if (taskData.complete_at && !this.completedTask) {
return false;
}
if (this.flowInfo.value > 0 && taskData.flow_item_id !== this.flowInfo.value) {
return false;
}
//
let color = '#058ce4';
this.taskPriority.some(level => {
if (level.priority === taskData.p_level) {
color = level.color;
return true;
}
});
//
let tempTime = {start, end};
let bakTime = $A.cloneJSON(tempTime)

View File

@ -315,7 +315,7 @@
</div>
<div v-else-if="tabTypeActive === 'gantt'" class="project-gantt">
<!--甘特图-->
<ProjectGantt :projectColumn="columnList"/>
<ProjectGantt :projectColumn="columnList" :flowInfo="flowInfo"/>
</div>
<!--项目设置-->
<Modal
@ -1302,6 +1302,7 @@ export default {
},
getFlowData() {
this.flowInfo = {}
this.$store.dispatch("call", {
url: 'project/flow/list',
data: {