From 527250b10d6ecda0a8f3f9ea426dbe0bbc630a2c Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期三, 21 一月 2026 08:57:15 +0800
Subject: [PATCH] 1.递交
---
src/views/gantt/index.vue | 73 +++++++++++++++++++++++-------------
1 files changed, 47 insertions(+), 26 deletions(-)
diff --git a/src/views/gantt/index.vue b/src/views/gantt/index.vue
index 6685486..7cf09d4 100644
--- a/src/views/gantt/index.vue
+++ b/src/views/gantt/index.vue
@@ -15,6 +15,20 @@
:value="item.code"
/>
</el-select>
+ <el-select
+ v-model="priorityMethod"
+ size="mini"
+ style="margin-left: 10px;"
+ placeholder="璇烽�夋嫨"
+ @change="prepareArrange"
+ >
+ <el-option
+ v-for="item in priorityMethodArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
<el-date-picker
v-model="ganttDateRange"
style="margin-left: 10px;"
@@ -32,13 +46,6 @@
</el-button>
<el-button size="mini" @click="handleClearSelection">
娓呯┖澶嶉�夋閫夋嫨
- </el-button>
-
- <el-button size="mini" type="primary" @click="prepareArrange('device')">
- 鎸夎澶囦紭鍏堥鎺�
- </el-button>
- <el-button size="mini" type="primary" @click="prepareArrange('time')">
- 鎸夋椂闂翠紭鍏堥鎺�
</el-button>
</div>
@@ -87,7 +94,11 @@
fivePeriodsTimeName: ['OneStartDate', 'TwoStartDate', 'ThreeStartDate', 'FourStartDate', 'FiveStartDate'], // 浜斾釜鏃堕棿娈电殑閿悕
needArrangeNumber: 5000, // 鍋囪闇�瑕佹帓浜ф暟閲�5000
- priorityMethod: 'device'// device 璁惧 time 鏃堕棿
+ priorityMethod: 'device', // device 璁惧 time 鏃堕棿
+ priorityMethodArr: [
+ { code: 'device', name: '璁惧浼樺厛' },
+ { code: 'time', name: '鏃堕棿浼樺厛' }
+ ]
}
},
mounted() {
@@ -255,7 +266,11 @@
// console.log(JSON.parse(JSON.stringify(task)))
// return '<b>浠诲姟:</b> ' + task.text + '<br/><b>寮�濮嬫椂闂�:</b> ' + `${gantt.date.date_to_str('%Y-%m-%d')(start)}` + '<br/><b>缁撴潫鏃堕棿:</b> ' + handleDateReduceOneDay(end)
// return '<b>浠诲姟:</b> ' + task.text + '<br/><b>寮�濮嬫椂闂�:</b> ' + handleDatetime2(start) + '<br/><b>缁撴潫鏃堕棿:</b> ' + handleDateReduceOneDay(end) + '<br/><b>杩涘害:</b> ' + task.progress * 100 + '%'
- return '<b>浠诲姟:</b> ' + task.text + '<br/><b>寮�濮嬫椂闂�:</b> ' + handleDatetime2(start) + '<br/><b>缁撴潫鏃堕棿:</b> ' + handleDatetime2(end) + '<br/><b>杩涘害:</b> ' + task.progress * 100 + '%'
+ return '<b>浠诲姟:</b> ' + task.text +
+ '<br/><b>鐢熶骇鏁伴噺:</b> ' + task.producedCount +
+ '<br/><b>杩涘害:</b> ' + task.progress * 100 + '%' +
+ '<br/><b>寮�濮嬫椂闂�:</b> ' + handleDatetime2(start) +
+ '<br/><b>缁撴潫鏃堕棿:</b> ' + handleDatetime2(end)
}
gantt.templates.task_text = function(start, end, task) {
@@ -768,9 +783,9 @@
}
]
- this.totalTasks = this.allTasks.length
- this.updatePaginatedTasks()
- this.renderGanttChart()
+ // this.totalTasks = this.allTasks.length
+ // this.updatePaginatedTasks()
+ // this.renderGanttChart()
this.prepareArrange()
},
@@ -933,51 +948,57 @@
this.$notify.success('宸叉竻绌烘墍鏈夐�夋嫨')
},
// 棰勬帓
- prepareArrange(type) {
+ prepareArrange() {
+ this.allTasks = this.allTasks.filter(i => i.type !== 'task2')
// 浼樺厛鏂瑰紡 time device
- if (type === 'time') {
+ if (this.priorityMethod === 'time') {
this.allTasks.sort((a, b) => a.start_date - b.start_date)
}
- if (type === 'device') {
- console.log(JSON.parse(JSON.stringify(this.allTasks)), '9999')
+ if (this.priorityMethod === 'device') {
this.allTasks.sort((a, b) => Number(a.partCode.replace(/\D/g, '')) - Number(b.partCode.replace(/\D/g, '')))
+ // this.allTasks.sort((a, b) => Number(b.partCode.replace(/\D/g, '')) - Number(a.partCode.replace(/\D/g, '')))
+ // this.allTasks.sort((a, b) => a.producedCount - b.producedCount)
}
- // console.log(JSON.parse(JSON.stringify(this.allTasks)), '9999')
const newArr = []
+ let needArrangeNumber = this.needArrangeNumber
this.allTasks.forEach(item => {
if (item.type === 'task') {
- // console.log(JSON.parse(JSON.stringify(item)))
- const count = this.needArrangeNumber > 0 && this.needArrangeNumber <= item.producedCount ? this.needArrangeNumber : item.producedCount
- this.needArrangeNumber = this.needArrangeNumber - item.producedCount // 鍓╀綑寰呮帓鍊�
- if (count > 0 && (this.needArrangeNumber > 0 || Math.abs(this.needArrangeNumber) < item.producedCount)) { // 涓�瀹氭槸澶т簬闆朵笖灏忎簬鏁存潯鐨勭敓浜у�肩殑
+ console.log(JSON.parse(JSON.stringify(item)))
+ const count = needArrangeNumber > 0 && needArrangeNumber <= item.producedCount ? needArrangeNumber : item.producedCount
+ needArrangeNumber = needArrangeNumber - item.producedCount // 鍓╀綑寰呮帓鍊�
+ if (count > 0 && (needArrangeNumber > 0 || Math.abs(needArrangeNumber) < item.producedCount)) { // 涓�瀹氭槸澶т簬闆朵笖灏忎簬鏁存潯鐨勭敓浜у�肩殑
// duration 鏈�鍚庝竴鏉$殑鏁版嵁搴旇鏄�氳繃璁$畻寰楀嚭鏃堕棿闀垮害鐨�
const duration = (count / (item.AdvaDevicCropMob / 100)) * item.AdvaDevicRhythm / 60
newArr.push({
id: nanoid(),
type: 'task2',
- text: '浠诲姟鍚嶇О棰勭暀',
- partName: item.AdvaDevicName,
- partCode: item.AdvaDevicNumber,
+ text: '浠诲姟鍚嶇О111',
+ partName: item.partName,
+ partCode: item.partCode,
start_date: handleDatetime2(item.start_date),
// duration: item.duration,
duration: duration,
checked: false,
progress: 0,
parent: item.parent,
- saleOrder: 'SO-2026-01001',
+ saleOrder: item.saleOrder,
producedCount: count <= item.producedCount ? count : item.producedCount
})
}
}
})
+ console.log(JSON.parse(JSON.stringify(newArr)), 'newArr')
+
// for (let i = 0; i < this.allTasks.length; i++) {
//
// }
this.allTasks = [...this.allTasks, ...newArr]
- // console.log(JSON.parse(JSON.stringify(this.allTasks)), '9999')
+ // console.log(JSON.parse(JSON.stringify(this.allTasks)), '77')
+
+ console.log(JSON.parse(JSON.stringify(this.allTasks)), '888')
this.totalTasks = this.allTasks.length
this.updatePaginatedTasks()
--
Gitblit v1.9.3