Browse Source

奇龙修改

master
shenzhouyu 7 months ago
parent
commit
fdddf7d7f4
  1. 2
      src/api/project/gantt.js
  2. 2
      src/views/modules/project/modules/projectPartModelTable.vue
  3. 52
      src/views/modules/project/modules/projectPartModelTableDetail.vue
  4. 468
      src/views/modules/project/projectPartProgress.vue

2
src/api/project/gantt.js

@ -5,7 +5,7 @@ import { createAPI } from "@/utils/httpRequest.js";
* @param {Object} data - 查询参数
* @returns {Promise} API响应
*/
export const getProjectGanttData = data => createAPI(`/project/gantt/getProjectGanttData`, 'get', data);
export const getProjectGanttData = data => createAPI(`/project/pmprojectpartmodeldetail/getProjectGanttData`, 'get', data);
/**
* 获取甘特图图例数据

2
src/views/modules/project/modules/projectPartModelTable.vue

@ -639,7 +639,7 @@ export default {
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `项目管理事项_${this.projectPart.projectPartName || this.projectPart.projectPartCode}_${new Date().toISOString().slice(0, 10)}.xlsx`
link.download = `项目管理事项_${this.projectPart.partName || this.projectPart.partCode}_${new Date().toISOString().slice(0, 10)}.xlsx`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)

52
src/views/modules/project/modules/projectPartModelTableDetail.vue

@ -1,8 +1,8 @@
<template>
<div style="height: 100%;overflow: auto;margin-top: 5px">
<div style="height: 100%;overflow: auto;margin-top: 5px;width: 100%;">
<el-form :inline="true" label-position="top" :model="searchData" ref="queryForm"
@keyup.enter.native="getDataList()">
<el-row :gutter="10">
<el-row>
<el-col :span="4">
<el-form-item label="物料编号" prop="projectPartCode">
<el-input v-model="searchData.projectPartCode" placeholder="请输入物料编号" disabled style="width: 100%;"></el-input>
@ -49,6 +49,7 @@
@keyup.enter.native="focusNextInput(scope.$index, 'detailDaysNumber')"
@input=" value=>scope.row.detailDaysNumber= value.match(/^[1-9]\d*$/) ? value.match(/^[1-9]\d*$/)[0] : ''"
style="height: 11px; width: 98%;"></el-input>
<!-- :disabled="scope.row.detailCompletionStatus !== '0' && scope.row.detailCompletionStatus !== '1'" -->
</template>
<span v-else-if="item.columnProp == 'detailItemDesc'">
<el-tooltip class="item" effect="dark" :content="scope.row.detailItemDesc" placement="top">
@ -62,8 +63,11 @@
</span>
<template v-else-if="item.columnProp==='detailPlanEndDate'">
<el-date-picker :ref="`detailPlanEndDate${scope.$index}`" v-model="scope.row.detailPlanEndDate" type="date"
value-format='yyyy-MM-dd' format='yyyy-MM-dd' style="width: 98%;"
@change="changeAllDays(scope.$index,scope.row.detailPlanEndDate)" :clearable="false"></el-date-picker>
value-format='yyyy-MM-dd' format='yyyy-MM-dd' style="width: 98%;" :clearable="false"></el-date-picker>
</template>
<template v-else-if="item.columnProp==='detailPlanStartDate'">
<el-date-picker :ref="`detailPlanStartDate${scope.$index}`" v-model="scope.row.detailPlanStartDate" type="date"
value-format='yyyy-MM-dd' format='yyyy-MM-dd' style="width: 98%;" :clearable="false"></el-date-picker>
</template>
<template v-else-if="item.columnProp === 'detailCompletionProgress'">
<el-input :controls="false" :ref="`detailCompletionProgress${scope.$index}`"
@ -112,7 +116,7 @@
</span>
</template>
</el-table-column>
<el-table-column header-align="center" align="center" width="120" label="操作">
<el-table-column fixed="right" header-align="center" align="center" width="120" label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="editPart(scope.row)">修改</el-link>
<el-link style="cursor: pointer" @click="removeProjectPart(scope.row)">删除</el-link>
@ -256,7 +260,25 @@ export default {
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
columnWidth: 70,
},
{
userId: this.$store.state.user.name,
functionId: 5012,
serialNumber: '5012Table1RequesterName',
tableId: '5012Table1',
tableName: '项目事项',
columnProp: 'detailPlanStartDate',
headerAlign: 'center',
align: 'center',
columnLabel: '计划开始日期',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
@ -266,7 +288,7 @@ export default {
tableName: '项目事项',
columnProp: 'detailPlanEndDate',
headerAlign: 'center',
align: 'left',
align: 'center',
columnLabel: '计划完成日期',
columnHidden: false,
columnImage: false,
@ -292,7 +314,7 @@ export default {
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
columnWidth: 70,
},
{
userId: this.$store.state.user.name,
@ -302,7 +324,7 @@ export default {
tableName: '项目事项',
columnProp: 'detailExcalCompletionDate',
headerAlign: 'center',
align: 'left',
align: 'center',
columnLabel: '实际完成日期',
columnHidden: false,
columnImage: false,
@ -364,7 +386,7 @@ export default {
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80,
columnWidth: 90,
},
{
userId: this.$store.state.user.name,
@ -400,7 +422,7 @@ export default {
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
columnWidth: 124,
},
{
userId: this.$store.state.user.name,
@ -573,10 +595,18 @@ export default {
this.$message.warning('第' + (i + 1) + '行天数不能为空')
return
}
if (!this.projectPartModel[i].detailPlanStartDate) {
this.$message.warning('第' + (i + 1) + '行计划开始日期不能为空')
return
}
if (!this.projectPartModel[i].detailPlanEndDate) {
this.$message.warning('第' + (i + 1) + '行计划完成日期不能为空')
return
}
if(this.projectPartModel[i].detailPlanStartDate > this.projectPartModel[i].detailPlanEndDate){
this.$message.warning('第' + (i + 1) + '行计划开始日期不能大于计划完成日期')
return
}
}
let params = []
params = this.projectPartModel

468
src/views/modules/project/projectPartProgress.vue

@ -3,23 +3,32 @@
<!-- 项目时间范围选择 -->
<div class="project-timeline">
<span class="timeline-label">项目时间</span>
<el-form :inline="true" label-position="top" ref="queryForm">
<el-row :gutter="10">
<el-col :span="6">
<el-form-item label="日期范围">
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator="~"
start-placeholder="开始日期"
type="daterange"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
@change="handleDateRangeChange"
size="small"
style="width: 300px; margin-left: 10px;"
></el-date-picker>
<span class="timeline-range" v-if="projectStartDate && projectEndDate">
{{ projectStartDate }} {{ projectEndDate }}
</span>
size="mini"
style="width: 100%;"
class="date-range-picker">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label=" ">
<el-button type="primary" style="height: 26px;" @click="handleDateRangeChange"> </el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 主要内容区域 -->
@ -28,11 +37,13 @@
<div class="project-info-section">
<el-table :data="projectList" border style="width: 100%" size="small">
<el-table-column prop="serialNo" label="序号" width="60" align="center"></el-table-column>
<el-table-column label="供应商/项目/零件号" width="120">
<el-table-column label="物料号" width="120" align="center">
<template slot-scope="scope">
<div class="part-info">
<div class="part-number" :title="scope.row.partNumber">{{ truncateText(scope.row.partNumber, 10) }}</div>
<div class="design-lead" :title="scope.row.designLead">设计: {{ truncateText(scope.row.designLead, 8) }}</div>
<div>
<div class="part-number" :title="scope.row.partCode">{{ truncateText(scope.row.partCode, 10) }}
</div>
<div class="design-lead" :title="scope.row.designLead">设计: {{ truncateText(scope.row.designLead, 8) }}
</div>
</div>
</template>
</el-table-column>
@ -59,58 +70,39 @@
<!-- 时间轴头部 -->
<div class="timeline-header">
<!-- 年月行 -->
<div class="timeline-cell header-cell month-header project-header">项目</div>
<div
v-for="(monthGroup, groupIndex) in monthGroups"
:key="`month-group-${groupIndex}`"
<div class="timeline-cell header-cell month-header project-header">物料</div>
<div v-for="(monthGroup, groupIndex) in monthGroups" :key="`month-group-${groupIndex}`"
class="timeline-cell header-cell month-header month-group"
:style="{ width: monthGroup.width + 'px', minWidth: monthGroup.width + 'px' }"
>
:style="{ width: monthGroup.width + 'px', minWidth: monthGroup.width + 'px' }">
{{ monthGroup.year }}/{{ monthGroup.month }}
</div>
</div>
<!-- 日期行 -->
<div class="timeline-header">
<div class="timeline-cell header-cell project-header">项目</div>
<div
v-for="day in timelineDays"
:key="day.date"
class="timeline-cell header-cell"
:class="{ 'weekend': day.isWeekend }"
>
<div class="timeline-cell header-cell project-header">物料</div>
<div v-for="day in timelineDays" :key="day.date" class="timeline-cell header-cell"
:class="{ 'weekend': day.isWeekend }">
{{ day.day }}
</div>
</div>
<!-- 甘特图内容 -->
<div class="gantt-content">
<div
v-for="(project, projectIndex) in projectList"
:key="projectIndex"
class="gantt-row"
>
<div v-for="(project, projectIndex) in projectList" :key="projectIndex" class="gantt-row">
<!-- 项目名称 -->
<div class="project-name-cell" :title="project.partNumber">
{{ truncateText(project.partNumber, 20) }}
<div class="project-name-cell" :title="project.partCode">
{{ truncateText(project.partCode, 20) }}
</div>
<!-- 时间轴单元格 -->
<div class="timeline-cells">
<div
v-for="(day, dayIndex) in timelineDays"
:key="dayIndex"
class="timeline-cell"
:class="{ 'weekend': day.isWeekend }"
>
<div v-for="(day, dayIndex) in timelineDays" :key="dayIndex" class="timeline-cell"
:class="{ 'weekend': day.isWeekend }">
<!-- 渲染甘特图条 -->
<div
v-for="(task, taskIndex) in getTasksForDay(project.tasks, day.date)"
:key="`${day.date}-${taskIndex}`"
class="gantt-bar"
:style="getTaskStyle(task, day.date, dayIndex)"
:title="`${task.name}: ${task.startDate} - ${task.endDate}`"
></div>
<div v-for="(task, taskIndex) in getTasksForDay(project.tasks, day.date)"
:key="`${day.date}-${taskIndex}`" class="gantt-bar" :style="getTaskStyle(task, day.date, dayIndex)"
:title="`${task.name}: ${task.startDate} - ${task.endDate}`"></div>
</div>
</div>
</div>
@ -123,6 +115,7 @@
<script>
import { getProjectGanttData, getGanttLegend } from '@/api/project/gantt.js'
import moment from 'moment'
export default {
name: 'ProjectPartProgress',
@ -130,31 +123,31 @@ export default {
//
externalProjectList: {
type: Array,
default: () => []
default: () => [],
},
externalLegendItems: {
type: Array,
default: () => []
default: () => [],
},
externalUpdateDate: {
type: String,
default: ''
default: '',
},
externalProjectStartDate: {
type: String,
default: ''
default: '',
},
externalProjectEndDate: {
type: String,
default: ''
}
default: '',
},
},
data() {
return {
loading: false,
updateDate: '2024. 9. 28',
projectStartDate: '2024年9月9日',
projectEndDate: '2024年11月30日',
projectStartDate: '', // 30
projectEndDate: '',
//
dateRange: [],
@ -167,7 +160,7 @@ export default {
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
},
},
{
text: '最近一个月',
@ -176,7 +169,7 @@ export default {
const start = new Date()
start.setMonth(start.getMonth() - 1)
picker.$emit('pick', [start, end])
}
},
},
{
text: '最近三个月',
@ -185,7 +178,7 @@ export default {
const start = new Date()
start.setMonth(start.getMonth() - 3)
picker.$emit('pick', [start, end])
}
},
},
{
text: '最近半年',
@ -194,7 +187,7 @@ export default {
const start = new Date()
start.setMonth(start.getMonth() - 6)
picker.$emit('pick', [start, end])
}
},
},
{
text: '最近一年',
@ -203,8 +196,8 @@ export default {
const start = new Date()
start.setFullYear(start.getFullYear() - 1)
picker.$emit('pick', [start, end])
}
}
},
},
],
disabledDate(time) {
// 1
@ -213,7 +206,7 @@ export default {
const oneYearLater = new Date()
oneYearLater.setFullYear(oneYearLater.getFullYear() + 1)
return oneYearAgo > oneYearLater
}
},
},
//
@ -223,79 +216,254 @@ export default {
{ label: '机加工', color: '#0000ff' },
{ label: '热处理', color: '#ffa500' },
{ label: '线割', color: '#800080' },
{ label: '装配', color: '#a0522d' }
{ label: '装配', color: '#a0522d' },
],
//
projectList: [
{
serialNo: 1,
partNumber: 'Honda/3424725',
partCode: 'Honda/3424725',
partName: 'BUCKLE',
designLead: '5A 设计:李凤鸣',
tasks: [
{ name: '机加工', startDate: '2024-09-01', endDate: '2024-09-06', color: '#0000ff' },
{ name: '材料采购', startDate: '2024-09-23', endDate: '2024-09-26', color: '#00ff00' },
{ name: '热处理', startDate: '2024-09-27', endDate: '2024-09-30', color: '#ffa500' },
{ name: '线割', startDate: '2024-10-01', endDate: '2024-10-04', color: '#800080' },
{ name: '装配', startDate: '2024-10-05', endDate: '2024-10-08', color: '#a0522d' },
{ name: '完成', startDate: '2024-10-09', endDate: '2024-10-12', color: '#ffff00' }
]
{
name: '机加工',
startDate: '2024-09-01',
endDate: '2024-09-06',
color: '#0000ff',
},
{
name: '材料采购',
startDate: '2024-09-23',
endDate: '2024-09-26',
color: '#00ff00',
},
{
name: '热处理',
startDate: '2024-09-27',
endDate: '2024-09-30',
color: '#ffa500',
},
{
name: '线割',
startDate: '2024-10-01',
endDate: '2024-10-04',
color: '#800080',
},
{
name: '装配',
startDate: '2024-10-05',
endDate: '2024-10-08',
color: '#a0522d',
},
{
name: '完成',
startDate: '2024-10-09',
endDate: '2024-10-12',
color: '#ffff00',
},
],
},
{
serialNo: 2,
partNumber: 'SPR6.1 / G68/A022V738A',
partCode: 'SPR6.1 / G68/A022V738A',
partName: 'BUCKLE',
designLead: '设计:陈晓东',
tasks: [
{ name: '材料采购', startDate: '2024-09-13', endDate: '2024-09-16', color: '#00ff00' },
{ name: '热处理', startDate: '2024-09-17', endDate: '2024-09-20', color: '#ffa500' },
{ name: '线割', startDate: '2024-09-21', endDate: '2024-09-24', color: '#800080' },
{ name: '装配', startDate: '2024-09-25', endDate: '2024-09-28', color: '#a0522d' },
{ name: '完成', startDate: '2024-09-29', endDate: '2024-10-02', color: '#ffff00' }
]
{
name: '材料采购',
startDate: '2024-09-13',
endDate: '2024-09-16',
color: '#00ff00',
},
{
name: '热处理',
startDate: '2024-09-17',
endDate: '2024-09-20',
color: '#ffa500',
},
{
name: '线割',
startDate: '2024-09-21',
endDate: '2024-09-24',
color: '#800080',
},
{
name: '装配',
startDate: '2024-09-25',
endDate: '2024-09-28',
color: '#a0522d',
},
{
name: '完成',
startDate: '2024-09-29',
endDate: '2024-10-02',
color: '#ffff00',
},
],
},
{
serialNo: 3,
partNumber: 'BYD/R002B424A',
partCode: 'BYD/R002B424A',
partName: 'BUCKLE',
designLead: '设计:陈晓东',
tasks: [
{ name: '设计', startDate: '2024-09-14', endDate: '2024-09-16', color: '#ff0000' },
{ name: '设计', startDate: '2024-09-20', endDate: '2024-09-22', color: '#ff0000' },
{ name: '设计', startDate: '2024-09-26', endDate: '2024-09-30', color: '#ff0000' },
{ name: '机加工', startDate: '2024-10-01', endDate: '2024-10-04', color: '#0000ff' },
{ name: '材料采购', startDate: '2024-10-05', endDate: '2024-10-08', color: '#00ff00' },
{ name: '热处理', startDate: '2024-10-09', endDate: '2024-10-12', color: '#ffa500' },
{ name: '线割', startDate: '2024-10-13', endDate: '2024-10-16', color: '#800080' },
{ name: '装配', startDate: '2024-10-17', endDate: '2024-10-20', color: '#a0522d' },
{ name: '完成', startDate: '2024-10-21', endDate: '2024-10-24', color: '#ffff00' }
]
{
name: '设计',
startDate: '2024-09-14',
endDate: '2024-09-16',
color: '#ff0000',
},
{
name: '设计',
startDate: '2024-09-20',
endDate: '2024-09-22',
color: '#ff0000',
},
{
name: '设计',
startDate: '2024-09-26',
endDate: '2024-09-30',
color: '#ff0000',
},
{
name: '机加工',
startDate: '2024-10-01',
endDate: '2024-10-04',
color: '#0000ff',
},
{
name: '材料采购',
startDate: '2024-10-05',
endDate: '2024-10-08',
color: '#00ff00',
},
{
name: '热处理',
startDate: '2024-10-09',
endDate: '2024-10-12',
color: '#ffa500',
},
{
name: '线割',
startDate: '2024-10-13',
endDate: '2024-10-16',
color: '#800080',
},
{
name: '装配',
startDate: '2024-10-17',
endDate: '2024-10-20',
color: '#a0522d',
},
{
name: '完成',
startDate: '2024-10-21',
endDate: '2024-10-24',
color: '#ffff00',
},
],
},
{
serialNo: 4,
partNumber: 'BYD/R002B361A',
partCode: 'BYD/R002B361A',
partName: 'BUCKLE',
designLead: '设计:李凤鸣',
tasks: [
{ name: '设计', startDate: '2024-09-14', endDate: '2024-09-16', color: '#ff0000' },
{ name: '设计', startDate: '2024-09-20', endDate: '2024-09-22', color: '#ff0000' },
{ name: '设计', startDate: '2024-09-26', endDate: '2024-09-30', color: '#ff0000' },
{ name: '机加工', startDate: '2024-10-01', endDate: '2024-10-04', color: '#0000ff' },
{ name: '材料采购', startDate: '2024-10-05', endDate: '2024-10-08', color: '#00ff00' },
{ name: '热处理', startDate: '2024-10-09', endDate: '2024-10-12', color: '#ffa500' },
{ name: '线割', startDate: '2024-10-13', endDate: '2024-10-16', color: '#800080' },
{ name: '装配', startDate: '2024-10-17', endDate: '2024-10-20', color: '#a0522d' },
{ name: '完成', startDate: '2024-10-21', endDate: '2024-10-24', color: '#ffff00' },
{ name: '设计', startDate: '2024-10-25', endDate: '2024-10-27', color: '#ff0000' },
{ name: '材料采购', startDate: '2024-10-28', endDate: '2024-10-31', color: '#00ff00' },
{ name: '热处理', startDate: '2024-11-01', endDate: '2024-11-04', color: '#ffa500' },
{ name: '线割', startDate: '2024-11-05', endDate: '2024-11-08', color: '#800080' },
{ name: '装配', startDate: '2024-11-09', endDate: '2024-11-12', color: '#a0522d' },
{ name: '完成', startDate: '2024-11-13', endDate: '2024-11-16', color: '#ffff00' }
]
}
]
{
name: '设计',
startDate: '2024-09-14',
endDate: '2024-09-16',
color: '#ff0000',
},
{
name: '设计',
startDate: '2024-09-20',
endDate: '2024-09-22',
color: '#ff0000',
},
{
name: '设计',
startDate: '2024-09-26',
endDate: '2024-09-30',
color: '#ff0000',
},
{
name: '机加工',
startDate: '2024-10-01',
endDate: '2024-10-04',
color: '#0000ff',
},
{
name: '材料采购',
startDate: '2024-10-05',
endDate: '2024-10-08',
color: '#00ff00',
},
{
name: '热处理',
startDate: '2024-10-09',
endDate: '2024-10-12',
color: '#ffa500',
},
{
name: '线割',
startDate: '2024-10-13',
endDate: '2024-10-16',
color: '#800080',
},
{
name: '装配',
startDate: '2024-10-17',
endDate: '2024-10-20',
color: '#a0522d',
},
{
name: '完成',
startDate: '2024-10-21',
endDate: '2024-10-24',
color: '#ffff00',
},
{
name: '设计',
startDate: '2024-10-25',
endDate: '2024-10-27',
color: '#ff0000',
},
{
name: '材料采购',
startDate: '2024-10-28',
endDate: '2024-10-31',
color: '#00ff00',
},
{
name: '热处理',
startDate: '2024-11-01',
endDate: '2024-11-04',
color: '#ffa500',
},
{
name: '线割',
startDate: '2024-11-05',
endDate: '2024-11-08',
color: '#800080',
},
{
name: '装配',
startDate: '2024-11-09',
endDate: '2024-11-12',
color: '#a0522d',
},
{
name: '完成',
startDate: '2024-11-13',
endDate: '2024-11-16',
color: '#ffff00',
},
],
},
],
}
},
computed: {
@ -310,11 +478,15 @@ export default {
endDate = new Date(this.dateRange[1])
} else {
//
startDate = new Date('2024-09-01')
endDate = new Date('2024-11-30')
startDate = new Date('2025-08-01')
endDate = new Date('2025-11-30')
}
for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) {
for (
let d = new Date(startDate);
d <= endDate;
d.setDate(d.getDate() + 1)
) {
const day = new Date(d)
const dayOfWeek = day.getDay()
days.push({
@ -322,7 +494,7 @@ export default {
day: day.getDate(),
month: day.getMonth() + 1,
year: day.getFullYear(),
isWeekend: dayOfWeek === 0 || dayOfWeek === 6
isWeekend: dayOfWeek === 0 || dayOfWeek === 6,
})
}
@ -349,7 +521,7 @@ export default {
year: day.year,
month: day.month,
dayCount: 1,
width: 0
width: 0,
}
groups.push(currentGroup)
} else {
@ -364,7 +536,7 @@ export default {
}
return groups
}
},
},
methods: {
//
@ -389,7 +561,7 @@ export default {
//
getTasksForDay(tasks, date) {
return tasks.filter(task => this.isTaskInDay(task, date))
return tasks.filter((task) => this.isTaskInDay(task, date))
},
//
@ -408,15 +580,16 @@ export default {
const currentDate = new Date(date)
//
const startIndex = this.timelineDays.findIndex(day =>
new Date(day.date).getTime() >= taskStart.getTime()
const startIndex = this.timelineDays.findIndex(
(day) => new Date(day.date).getTime() >= taskStart.getTime()
)
const endIndex = this.timelineDays.findIndex(day =>
new Date(day.date).getTime() > taskEnd.getTime()
const endIndex = this.timelineDays.findIndex(
(day) => new Date(day.date).getTime() > taskEnd.getTime()
)
// 使
const actualEndIndex = endIndex === -1 ? this.timelineDays.length : endIndex
const actualEndIndex =
endIndex === -1 ? this.timelineDays.length : endIndex
const taskDuration = actualEndIndex - startIndex
//
@ -433,13 +606,13 @@ export default {
left: '0px',
top: '50%',
transform: 'translateY(-50%)',
zIndex: 1
zIndex: 1,
}
}
//
return {
display: 'none'
display: 'none',
}
},
@ -473,9 +646,16 @@ export default {
queryParams.endDate = this.dateRange[1]
}
const [ganttData, legendData] = await Promise.all([
getProjectGanttData(queryParams).then(({ data }) => {
if (data && data.code === 0) {
console.log(data);
this.projectList = data.projectGanttData.projectList
}
})
/* const [ganttData, legendData] = await Promise.all([
getProjectGanttData(queryParams),
getGanttLegend()
getGanttLegend(),
])
if (ganttData && ganttData.code === 0) {
@ -493,7 +673,7 @@ export default {
if (legendData && legendData.code === 0) {
this.legendItems = legendData.data || this.legendItems
}
} */
} catch (error) {
console.error('获取甘特图数据失败:', error)
this.$message.error('获取数据失败,使用默认数据')
@ -505,7 +685,9 @@ export default {
//
initDefaultDateRange() {
if (!this.dateRange || this.dateRange.length === 0) {
this.dateRange = ['2024-09-01', '2024-11-30']
let start = moment().subtract(3, 'months').format('YYYY-MM-DD')
let end = moment().format('YYYY-MM-DD')
this.dateRange = [start,end]
}
},
@ -514,13 +696,13 @@ export default {
if (!text) return ''
if (text.length <= maxLength) return text
return text.substring(0, maxLength) + '...'
}
},
},
mounted() {
this.initDefaultDateRange()
this.fetchGanttData()
}
},
}
</script>
@ -585,9 +767,6 @@ export default {
overflow: hidden;
}
.part-info {
padding: 5px 0;
}
.part-number {
font-weight: bold;
@ -758,6 +937,31 @@ export default {
opacity: 0.8;
}
/* 日期范围选择器样式 */
.date-range-picker >>> .el-range-input {
font-size: 13px;
color: #606266;
}
.date-range-picker >>> .el-range-separator {
padding: 0 5px;
color: #c0c4cc;
}
.date-range-picker >>> .el-range__icon {
margin-left: 5px;
}
.date-range-picker >>> .el-input__inner {
padding: 0 8px;
height: 28px !important;
line-height: 28px !important;
}
.date-range-picker >>> .el-range-editor {
padding: 0 8px;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.main-content {
@ -772,5 +976,9 @@ export default {
.gantt-section {
height: 500px;
}
.date-range-picker {
width: 280px !important;
}
}
</style>
Loading…
Cancel
Save