Vue用etable实现甘特图

在这里插入图片描述

<div class="table-responsive">
    <table class="table table-striped table-responsive no-padding table-hover table-bordered table-sm ofu-table-fixed"  style="text-align: center">
        <tr style="">
            <th rowspan="2" width="100" style="vertical-align:middle;width: 100px; text-align: center">合伙人</th>
            <th rowspan="2" width="100" style="vertical-align:middle;text-align: center">班组</th>
{
   {
   --            <th rowspan="2" width="100" style="vertical-align:middle;text-align: center">人数</th>--}}
            <template v-for="(val , key) in sectionDate">
                <th :colspan="val.cols" style="text-align: center">[!! val.month !!] 月份</th>
            </template>
        </tr>
        <tr>
            <template v-for="(val , key) in sectionDate">
                <template v-for="(val1 , key1) in val.days">
                    <th :bgcolor="val1.is_job">[!! val1.day !!]</th>
                </template>
            </template>
        </tr>
        <template  v-for="(item,index) in tableData">
            <td :rowspan="item.rows">[!! item.workshop_name !!]</td>
            <template v-for="(val , key) in item.list">
                <tr>
                    <td>[!! val.group_name !!]</td>
{
   {
   --                    <td>[!! val.number !!] / [!! val.rea_number !!]</td>--}}
                    <template v-for="(val1 , key1) in val.list">
                        <template v-if="val1.box">
                            <td :colspan="val1.show_days" v-on:mouseover="moveShow(val1,index,key,key1,true)" v-on:mouseout="moveShow(val1,index,key,key1,false)" :preview-src-list="srcList" class="solidBox" style="border: 1px solid #111" v-on:click="showDrawer(val1)" :bgcolor="val1.bg_color">
                                <span>[!! val1.large_no !!][!! val1.place_name !!] [!! val1.total !!][!! val1.up_line !!][!! val1.end_day !!][!! val1.per_yield !!]*[!! val1.tailor_num !!]=[!! val1.day_num !!]件  订单完成: [!! val1.percentage !!]</span>
                                <div v-if="val1.show_img">
                                    <el-image :id="val1.box_id"  style="width: 100px; height: 100px;position: absolute" :src="val1.pic_url" fit="cover"></el-image>
                                </div>
{
   {
   --                                <el-button slot="reference">[!! val1.large_no !!][!! val1.place_name !!] [!! val1.total !!][!! val1.up_line !!][!! val1.end_day !!][!! val1.per_yield !!]*[!! val1.tailor_num !!]=[!! val1.day_num !!]件  订单完成: [!! val1.percentage !!]</el-button>--}}
                            </td>
                        </template>
                        <template v-else>
                            <td :bgcolor="val1.is_job"></td>
                        </template>
                    </template>
                </tr>
            </template>
        </template>
    </table>
</div>
<el-drawer
    :title="drawerTitle"
    :visible.sync="drawer"
    direction="rtl"
    :before-close="handleClose"
    size="60%">
    <span>
        <!-- 生产爬坡期 -->
        <div class="panel panel-default" style="margin-bottom: 10px;">
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-striped table-responsive no-padding table-hover table-bordered table-sm ofu-table-fixed" style="margin-bottom: 0">
                        <thead class="thead-inverse">
                            <tr>
                                <th style="text-align: center">款号:[!! option.large_no !!]</th>
                                <th style="text-align: center">品名:[!! lineList.place_name !!]</th>
                                <th style="text-align: center">订单数量:[!! lineList.total  !!]</th>
                                <th style="text-align: center">车缝SMV:[!! lineList.tailor_smv  !!]</th>
                            </tr>
                            <tr>
                                <th style="text-align: center">生产班组:[!! lineList.group_name  !!]</th>
                                <th style="text-align: center">指导效率:[!! lineList.guide_rate  !!]</th>
                                <th style="text-align: center">浮动效率:[!! lineList.float_rate_str  !!]</th>
                                <th style="text-align: center">车缝效率:[!! lineList.tailor_rate  !!]</th>
                            </tr>
                            <tr>
                                <th style="text-align: center">
                                    <el-date-picker
                                        v-model="ganttForm.up_line"
                                        align="right"
                                        type="date"
                                        placeholder="上线日期"
                                        format="yyyy-MM-dd"
                                        value-format="yyyy-MM-dd"
                                        v-on:change="handleGanttChange()"
                                        style="width: 100%">
                                    </el-date-picker>
                                </th>
                                 <th style="text-align: center">
                                人数:
                                <el-input-number min="0" :max="50" size="mini" v-model="ganttForm.number" controls-position='right' v-on:change="handleGanttChange()" placeholder="人数调整" type="number"></el-input-number>
                                <button v-on:click="ganttOpen(1)" v-if="ganttForm.number == 0">启用</button>
                            </th>
                            <th style="text-align: center">
                                时间:
                                <el-input-number step="30"  min="0" size="mini" :max="500" v-model="ganttForm.hours" controls-position='right' v-on:change="handleGanttChange()" placeholder="时间调整" type="number"></el-input-number>
                                <button v-on:click="ganttOpen(2)" v-if="ganttForm.hours == 0">启用</button>
                            </th>
                            <th style="text-align: center"
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用Vue和Echarts来实现甘特图。首先,在`<template>`标签中创建一个包含Echarts图表的`<div>`元素,设置其id属性为"myechart",并指定其高度和宽度。然后,在`<script>`标签中使用`mounted`钩子函数来初始化图表,使用`this.$echarts.init`方法传入图表容器的id来获取图表实例,并使用`setOption`方法来配置图表的数据和样式。你可以使用`xAxis`和`yAxis`来定义图表的坐标轴,使用`series`来定义图表的数据系列,例如柱状图的数据。在`methods`中,你可以创建`drawEchart`方法来绘制图表。 下面是一个示例代码: ``` <template> <div class="about"> <h1>This is echarts page</h1> <div id="myechart" style="height:500px;width:1000px;"></div> </div> </template> <script> export default { name: 'MyEchart', mounted() { this.drawEchart() }, methods: { drawEchart() { let myechart = this.$echarts.init(document.getElementById("myechart")) myechart.setOption({ title: { text: "gant" }, xAxis: { type: 'value' }, yAxis: { type: 'category', data: ["pro1", "pro2", "pro3", "pro4", "pro5", "pro6"] }, series: [{ type: 'bar', data: [10, 20, 30, 46, 78, 22] }] }) } } } </script> ``` 如果你想在甘特图中添加更多的数据,可以在`series`中添加多个对象,每个对象表示一个数据系列。例如,你可以添加一个名为"data2"的数据系列,并在其中定义对应的数据。这样就可以实现一个具有多个数据系列的甘特图。 ``` { type: 'bar', name: 'data2', data: [20, 20, 30, 20, 10, 20] } ``` 以上是一个简单的示例,你可以根据需要修改和扩展代码。希望对你有帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [vue+echarts画甘特图](https://blog.csdn.net/feinifi/article/details/126687245)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [Vue 中使用 Echarts 实现项目进度甘特图](https://blog.csdn.net/qq_51634332/article/details/120805451)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值