优化甘特图

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

View File

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