Commit 296f79ea authored by arvin's avatar arvin

架次甘特图

parent f82dd7a7
...@@ -17,7 +17,6 @@ export default { ...@@ -17,7 +17,6 @@ export default {
setColumnsConfig() { setColumnsConfig() {
this.gantt.config.columns = this.columns this.gantt.config.columns = this.columns
}, },
usePlugins() { usePlugins() {
this.gantt.plugins({ this.gantt.plugins({
tooltip: true, tooltip: true,
......
...@@ -5,18 +5,20 @@ export default { ...@@ -5,18 +5,20 @@ export default {
} }
}, },
watch: { watch: {
showFlag(val) { showFlag: {
if (!val) { immediate: true,
return handler(val) {
} if (!val) {
if (!this.node) { return
return }
} if (!this.node) {
if (this.node.id === this.currentId) { return
return }
} if (this.node.id === this.currentId) {
this.getData() return
}, }
this.getData()
} },
node: { node: {
immediate: true, immediate: true,
deep: true, deep: true,
......
...@@ -60,67 +60,6 @@ export default { ...@@ -60,67 +60,6 @@ export default {
}, },
methods: { methods: {
refreshGantt() {
const val = this.ganttData
if (!val || !val.length) {
this.gantt.parse({ data: [] })
return
}
const params = {
data: [],
links: []
}
val.forEach((item, index) => {
const link = item.extProcessExecutorRoutes && item.extProcessExecutorRoutes[0]
params.data.push({
index: index + 1,
text: item.serialNumber,
id: item.id,
parenId: link && link.prevNodeId || '',
start_date: '2007-1-1',
type: 'task',
duration: item.workHour ? Number(item.workHour / 8) : 0
})
if (link) {
params.links.push({
cid: link.id,
tid: link.currNodeId,
source: link.prevNodeId,
target: link.currNodeId,
type: '0',
isCritical: link.isCritical
})
}
})
this.params = params
this.gantt.clearAll()
this.gantt.parse(this.params)
},
getData() {
this.currentId = this.node.id
const params = {
'searchItems': { 'items': [{ 'fieldName': 'aircraftSortiesId', 'operator': 'EQ', 'value': this.node.id }] },
'sortItem': [{ 'fieldName': 'serialNumber', 'sortOrder': 'asc' }],
'openProps': [
{
'name': 'extProcessExecutorRoutes'
}
]
}
this.$api.searchApi('ExtPosition', params).then(res => {
if (res.items.content) {
this.ganttData = res.items.content
} else {
this.ganttData = []
}
this.refreshGantt()
}).catch(() => {
this.ganttData = []
this.refreshGantt()
})
},
configLayout() { configLayout() {
const ganttAg = this.gantt const ganttAg = this.gantt
const getInput = function(node) { const getInput = function(node) {
...@@ -310,6 +249,67 @@ export default { ...@@ -310,6 +249,67 @@ export default {
ganttAg.init(this.ganttElId) ganttAg.init(this.ganttElId)
}) })
}, },
refreshGantt() {
const val = this.ganttData
if (!val || !val.length) {
this.gantt.parse({ data: [] })
return
}
const params = {
data: [],
links: []
}
val.forEach((item, index) => {
const link = item.extProcessExecutorRoutes && item.extProcessExecutorRoutes[0]
params.data.push({
index: index + 1,
text: item.serialNumber,
id: item.id,
parenId: link && link.prevNodeId || '',
start_date: '2007-1-1',
type: 'task',
duration: item.workHour ? Number(item.workHour / 8) : 0
})
if (link) {
params.links.push({
cid: link.id,
tid: link.currNodeId,
source: link.prevNodeId,
target: link.currNodeId,
type: '0',
isCritical: link.isCritical
})
}
})
this.params = params
this.gantt.clearAll()
this.gantt.parse(this.params)
},
getData() {
this.currentId = this.node.id
const params = {
'searchItems': { 'items': [{ 'fieldName': 'aircraftSortiesId', 'operator': 'EQ', 'value': this.node.id }] },
'sortItem': [{ 'fieldName': 'serialNumber', 'sortOrder': 'asc' }],
'openProps': [
{
'name': 'extProcessExecutorRoutes'
}
]
}
this.$api.searchApi('ExtPosition', params).then(res => {
if (res.items.content) {
this.ganttData = res.items.content
} else {
this.ganttData = []
}
this.refreshGantt()
}).catch(() => {
this.ganttData = []
this.refreshGantt()
})
},
export(mode) { export(mode) {
if (mode === 'png') { if (mode === 'png') {
this.gantt.exportToPNG({ this.gantt.exportToPNG({
...@@ -391,12 +391,12 @@ export default { ...@@ -391,12 +391,12 @@ export default {
} }
.gantt_critical_task{ .gantt_critical_task{
background: #f39c4f; background: #f39c4f;
border: 1px solid #f39c4f; border: 1px solid #f39c4f;
} }
.gantt_task_line{ .gantt_task_line{
&.workday_over{ &.workday_over{
background: #f39c4f; background: #f39c4f;
border: 1px solid #f39c4f; border: 1px solid #f39c4f;
} }
} }
} }
......
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