Commit 680f6438 authored by arvin's avatar arvin

单架次MBOM配置

parent 6a2797e0
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
name: 'CommonProcessHistory', name: 'CommonProcessHistory',
displayName: '流程历史记录', displayName: '流程历史记录',
modelRelationObjs: ['DxDocument', 'DxPart', 'DxBaseline', 'DxAbstractChangeIssue', modelRelationObjs: ['DxDocument', 'DxPart', 'DxBaseline', 'DxAbstractChangeIssue',
'DxChangeItem', 'DxProcessExecutor', 'ExtECM', 'DxCADDocument', 'Contract'], 'DxChangeItem', 'DxProcessExecutor', 'ExtECM', 'DxCADDocument', 'Contract', 'OutStorageRequest'],
props: { props: {
basicData: { basicData: {
type: Object, type: Object,
......
export default {
data() {
return {
// eslint-disable-next-line no-undef
gantt: Gantt.getGanttInstance()
}
},
mounted() {
this.initGantt()
},
methods: {
initGantt() {
this.gantt.init(this.ganttElId)
this.setColumnsConfig()
this.setScaleConfig(this.type)
this.configLayout()
this.gantt.i18n.setLocale('cn')
},
setColumnsConfig() {
this.gantt.config.columns = this.columns
},
configLayout() {
this.gantt.config.layout = {
css: 'gantt_container',
rows: [
{
cols: [
{ view: 'grid', id: 'grid', scrollX: 'scrollHor', scrollY: 'scrollVer' },
{ resizer: true, width: 2 },
{ view: 'timeline', id: 'timeline', scrollX: 'scrollHor', scrollY: 'scrollVer' },
{ view: 'scrollbar', scroll: 'y', id: 'scrollVer' }
]
},
{ view: 'scrollbar', scroll: 'x', id: 'scrollHor', height: 20 }
]
}
},
setScaleConfig(type) {
if (type === 'month-week') {
var weekScaleTemplate = function(date) {
var dateToStr = this.gantt.date.date_to_str('%d %M')
var endDate = this.gantt.date.add(this.gantt.date.add(date, 1, 'week'), -1, 'day')
return dateToStr(date) + ' - ' + dateToStr(endDate)
}
this.gantt.config.scales = [
{ unit: 'month', step: 1, format: '%M月' },
{ unit: 'week', step: 1, format: weekScaleTemplate }
]
this.gantt.config.scale_height = 50
return
}
},
usePlugins() {
this.gantt.plugins({
drag_timeline: true, // 整体拖拽时间线
fullscreen: true, // 全屏模式,
tooltip: true
})
}
}
}
export default {
watch: {
showFlag(val) {
if (!val) {
return
}
if (!this.node) {
return
}
if (this.node.id === this.currentId) {
return
}
this.getData()
},
node: {
immediate: true,
deep: true,
handler(val) {
if (!this.showFlag) {
return
}
if (!val) {
return
}
if (val.id === this.currentId) {
return
}
this.getData()
}
}
},
mounted() {
},
methods: {
search() {
},
import() {
},
save() {
}
}
}
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
<dee-tools mode="normal" :tools="tools" /> <dee-tools mode="normal" :tools="tools" />
</div> </div>
<div class="content-model"> <div class="content-model">
<step v-show="viewType === 'ExtPosition'" /> <step v-show="viewType === 'ExtPosition'" :show-flag="viewType === 'ExtPosition'" :node="node" />
<unit v-show="viewType === 'unit'" /> <unit v-show="viewType === 'unit'" :show-flag="viewType === 'unit'" :node="node" />
<view2 v-show="viewType === 'AircraftSorties'" /> <view2 v-show="viewType === 'AircraftSorties'" :show-flag="viewType === 'AircraftSorties'" :node="node" />
</div> </div>
</div> </div>
</template> </template>
...@@ -27,6 +27,7 @@ export default { ...@@ -27,6 +27,7 @@ export default {
data() { data() {
return { return {
viewType: 'ExtPosition', viewType: 'ExtPosition',
node: null,
evenList: [ evenList: [
{ {
even: 'changeView', even: 'changeView',
...@@ -98,7 +99,7 @@ export default { ...@@ -98,7 +99,7 @@ export default {
this.$emit('changeView', this.viewType) this.$emit('changeView', this.viewType)
}, },
getData(params) { getData(params) {
console.log(params) this.node = params
}, },
import() { import() {
...@@ -121,5 +122,8 @@ export default { ...@@ -121,5 +122,8 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.content-model{
height: calc(100% - 40px);
}
} }
</style> </style>
<template> <template>
<div> <div class="TfMomWebStep-model">
站位路线 <div :id="ganttElId" style="height: 100%;" />
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment'
import config from './config'
import data from './data'
export default { export default {
name: 'TfMomWebStep', name: 'TfMomWebStep',
mixins: [config, data],
props: {
node: {
type: Object,
default: () => null
},
showFlag: {
type: Boolean,
default: false
}
},
data() { data() {
return { return {
ganttElId: 'unit-gantt',
type: 'month-week',
ganttData: [],
initGanttFlag: false,
params: null,
currentId: ''
}
},
computed: {
columns() {
return [
{ name: 'ganttId', label: '节点', width: 60, align: 'center', resize: true },
{ name: 'text', label: '站位号', width: 160, align: 'center', resize: true },
{ name: 'duration', label: '工期(天)', width: 100, align: 'center', resize: true },
{ name: 'prevIndex', label: '前置', width: 150, align: 'center', resize: true, editor: { type: 'date', map_to: 'start_date' }}
]
} }
}, },
mounted() { mounted() {
}, },
methods: { methods: {
refreshGantt() {
const val = this.ganttData
if (!val || !val.length) {
this.gantt.parse({ data: [] })
return
}
const params = {
data: [],
links: []
}
val.forEach((item, index) => {
params.data.push({
ganttId: index + 1,
text: item.serialNumber,
rowId: item.id,
prevIndex: '',
start_date: new Date(item.createTime), // moment(item.createTime).format('DD-MM-yyyy'),
duration: item.workHour ? (item.workHour / 8) : 0
})
})
val.forEach((item) => {
if (item.extProcessExecutorRoutes && item.extProcessExecutorRoutes[0]) {
const ganttRow = params.data.find(r => r.rowId === item.id)
const prevRow = params.data.find(r => r.rowId === item.extProcessExecutorRoutes[0].prevNodeId)
ganttRow.prevIndex = prevRow.ganttId
const idx = params.links.length + 1
params.links.push({
id: idx,
source: prevRow.ganttId,
target: ganttRow.ganttId
})
}
})
this.params = JSON.parse(JSON.stringify(params))
this.gantt.clearAll()
this.gantt.parse(params)
},
getData() {
this.currentId = this.node.id
const params = {
'searchItems': { 'items': [{ 'fieldName': 'aircraftSortiesId', 'operator': 'EQ', 'value': this.node.id }] },
'sortItem': [{ 'fieldName': 'modifyTime', '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()
})
},
dataWash() {
}
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.TfMomWebStep-model{
height: 100%;
.gatt{
height: 100%;
}
}
</style> </style>
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
}, 100) }, 100)
}) })
return [{ return [{
id: 0, id: this.AircraftSortiesId,
subTypeName: 'aircraft', subTypeName: 'aircraft',
serialNumber: `${this.AircraftName}-${this.AircraftSortiesName}`, serialNumber: `${this.AircraftName}-${this.AircraftSortiesName}`,
disabled: this.disableClickFun(type, { subTypeName: 'aircraft' }), disabled: this.disableClickFun(type, { subTypeName: 'aircraft' }),
...@@ -111,11 +111,6 @@ export default { ...@@ -111,11 +111,6 @@ export default {
this.AircraftSortiesId = list[0] this.AircraftSortiesId = list[0]
this.AircraftSortiesName = list[1] this.AircraftSortiesName = list[1]
} }
// this.treeData = [{
// id: '',
// type: 'aircraft',
// label: `${this.AircraftName}-${this.AircraftSortiesName}`
// }]
this.getPosition() this.getPosition()
}, },
getPosition() { getPosition() {
...@@ -142,7 +137,7 @@ export default { ...@@ -142,7 +137,7 @@ export default {
if (!tree) { if (!tree) {
return return
} }
const root = tree.getNode(0) const root = tree.getNode(this.AircraftSortiesId)
if (this.viewType === 'unit') { if (this.viewType === 'unit') {
this.currentNode = root.childNodes[0] && root.childNodes[0].data this.currentNode = root.childNodes[0] && root.childNodes[0].data
} else { } else {
...@@ -153,7 +148,7 @@ export default { ...@@ -153,7 +148,7 @@ export default {
} }
this.$nextTick(() => { this.$nextTick(() => {
tree.setCurrentKey(this.currentNode.id) tree.setCurrentKey(this.currentNode.id)
this.$emit('node-click', this.currentNode) this.$emit('nodeClick', this.currentNode)
}) })
} }
......
<template> <template>
<div> <div class="TfMomWebUnit-model">
装配单元路线 <div class="search-bar">
<el-input>
<el-input v-model="AOname" placeholder="AO(号/名称)" class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="search" />
</el-input>
</el-input>
</div>
<div id="unit-gatt" class="gatt" />
</div> </div>
</template> </template>
<script> <script>
import config from './config'
import data from './data'
export default { export default {
name: 'TfMomWebUnit', name: 'TfMomWebUnit',
mixins: [config, data],
props: {
node: {
type: Object,
default: () => null
},
showFlag: {
type: Boolean,
default: false
}
},
data() { data() {
return { return {
currentId: '',
AOname: ''
}
},
watch: {
showFlag(val) {
if (!val) {
return
}
if (!this.node) {
return
}
if (this.node.id === this.currentId) {
return
}
this.getData()
},
node: {
immediate: true,
deep: true,
handler(val) {
if (!this.showFlag) {
return
}
if (!val) {
return
}
if (val.id === this.currentId) {
return
}
this.getData()
}
} }
}, },
...@@ -19,11 +69,24 @@ export default { ...@@ -19,11 +69,24 @@ export default {
}, },
methods: { methods: {
search() {
},
getData() {
},
import() {
},
save() {
}
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.TfMomWebUnit-model{
height: 100%;
}
</style> </style>
<template> <template>
<div> <div class="TfMomWebView-model">
架次视图路线 <div class="search-bar">
<el-input>
<el-input v-model="AOname" placeholder="AO(号/名称)" class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="search" />
</el-input>
</el-input>
</div>
<div :id="ganttElId" class="gatt" />
</div> </div>
</template> </template>
<script> <script>
import config from './config'
import data from './data'
export default { export default {
name: 'TfMomWebView', name: 'TfMomWebView',
mixins: [config, data],
props: {
node: {
type: Object,
default: () => null
},
showFlag: {
type: Boolean,
default: false
}
},
data() { data() {
return { return {
ganttElId: 'view-gantt',
currentId: '',
AOname: ''
}
},
watch: {
showFlag(val) {
if (!val) {
return
}
if (!this.node) {
return
}
if (this.node.id === this.currentId) {
return
}
this.getData()
},
node: {
immediate: true,
deep: true,
handler(val) {
if (!this.showFlag) {
return
}
if (!val) {
return
}
if (val.id === this.currentId) {
return
}
this.getData()
}
} }
}, },
mounted() { mounted() {
}, },
methods: { methods: {
getData() {
}
} }
} }
</script> </script>
......
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