Commit 6bad617f by 杨子

优化甘特图显示问题

parent 4bd226d9
<template> <template>
<div <div :id="bar.ganttBarConfig.id" class="g-gantt-bar" :style="barStyle" @mousedown="onMouseEvent"
:id="bar.ganttBarConfig.id" @mouseup="onMouseEvent" @dblclick="onMouseEvent" @mouseenter="onMouseEvent" @mouseleave="onMouseEvent"
class="g-gantt-bar" @contextmenu="onMouseEvent">
:style="barStyle" <el-popover placement="right" trigger="hover" title="信息">
@mousedown="onMouseEvent"
@mouseup="onMouseEvent"
@dblclick="onMouseEvent"
@mouseenter="onMouseEvent"
@mouseleave="onMouseEvent"
@contextmenu="onMouseEvent"
>
<el-popover
placement="right"
trigger="hover"
title="保障资源信息"
>
<template #reference> <template #reference>
<div class="g-gantt-bar-label"> <div class="g-gantt-bar-label">
<slot :bar="bar"> <slot :bar="bar">
...@@ -25,24 +13,30 @@ ...@@ -25,24 +13,30 @@
</div> </div>
</template> </template>
<template #default> <template #default>
<template v-if="bar.dataResource">
<div class="card-header"> <h4 class="info-title">执行时间</h4>
<!-- <span>保障设备:</span><el-link type="primary" v-for="item in bar.equipmentResourceList" :key="item.id">{{item.name}}</el-link> --> <div>
<el-link type="primary">{{bar.dataResource.name}}</el-link> 开始时间:<span>{{ bar.beginProcessDate }}</span>
</div> </div>
<div>
结束时间:<span>{{ bar.endProcessDate }}</span>
</div>
<template v-if="bar.ganttBarConfig.label">
<h4 class="info-title">工序信息</h4>
<div class="card-header">
<!-- <span>保障设备:</span><el-link type="primary" v-for="item in bar.equipmentResourceList" :key="item.id">{{item.name}}</el-link> -->
<span>{{ bar.ganttBarConfig.label }}</span>
</div>
</template> </template>
<!-- <template v-if="bar.manpowerResourceList && bar.manpowerResourceList.length"> <template v-if="bar.dataResource">
<div class="card-header"> <h4 class="info-title">保障资源信息:</h4>
<span>人力资源:</span><el-link type="primary" v-for="item in bar.manpowerResourceList" :key="item.id">{{item.name}}</el-link> <div class="card-header">
</div> <!-- <span>保障设备:</span><el-link type="primary" v-for="item in bar.equipmentResourceList" :key="item.id">{{item.name}}</el-link> -->
<el-link type="primary">{{ bar.dataResource.name }}</el-link>
</div>
</template> </template>
<template v-if="bar.toolResourceList && bar.toolResourceList.length">
<div class="card-header">
<span>保障工具:</span><el-link type="primary" v-for="item in bar.toolResourceList" :key="item.id">{{item.name}}</el-link>
</div>
</template> -->
</template> </template>
</el-popover> </el-popover>
<template v-if="bar.ganttBarConfig.hasHandles"> <template v-if="bar.ganttBarConfig.hasHandles">
...@@ -173,17 +167,20 @@ const barStyle = computed(() => { ...@@ -173,17 +167,20 @@ const barStyle = computed(() => {
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 0 14px 0 14px; /* 14px is the width of the handle */ padding: 0 14px 0 14px;
/* 14px is the width of the handle */
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
} }
.g-gantt-bar-label > * {
.g-gantt-bar-label>* {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.g-gantt-bar-handle-left, .g-gantt-bar-handle-left,
.g-gantt-bar-handle-right { .g-gantt-bar-handle-right {
position: absolute; position: absolute;
...@@ -195,9 +192,11 @@ const barStyle = computed(() => { ...@@ -195,9 +192,11 @@ const barStyle = computed(() => {
cursor: w-resize; cursor: w-resize;
top: 0; top: 0;
} }
.g-gantt-bar-handle-left { .g-gantt-bar-handle-left {
left: 0; left: 0;
} }
.g-gantt-bar-handle-right { .g-gantt-bar-handle-right {
right: 0; right: 0;
} }
...@@ -219,8 +218,11 @@ const barStyle = computed(() => { ...@@ -219,8 +218,11 @@ const barStyle = computed(() => {
.item { .item {
margin-bottom: 18px; margin-bottom: 18px;
} }
.card-header{
.card-header {
font-size: 12px; font-size: 12px;
} }
.info-title{
margin-bottom: 10px;
}
</style> </style>
...@@ -103,6 +103,7 @@ const onDrop = (e: MouseEvent) => { ...@@ -103,6 +103,7 @@ const onDrop = (e: MouseEvent) => {
border-top: 1px solid #eaeaea; border-top: 1px solid #eaeaea;
width: 100%; width: 100%;
border-bottom: 1px solid #eaeaea; border-bottom: 1px solid #eaeaea;
/* left: 80px; */
} }
.g-gantt-row-label { .g-gantt-row-label {
......
...@@ -98,6 +98,7 @@ const { timeaxisUnits } = useTimeaxisUnits(gGanttChartPropsRefs) ...@@ -98,6 +98,7 @@ const { timeaxisUnits } = useTimeaxisUnits(gGanttChartPropsRefs)
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: flex-start;
} }
.g-upper-timeunit { .g-upper-timeunit {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment