Commit 680f6438 authored by arvin's avatar arvin

单架次MBOM配置

parent 6a2797e0
......@@ -27,7 +27,7 @@ export default {
name: 'CommonProcessHistory',
displayName: '流程历史记录',
modelRelationObjs: ['DxDocument', 'DxPart', 'DxBaseline', 'DxAbstractChangeIssue',
'DxChangeItem', 'DxProcessExecutor', 'ExtECM', 'DxCADDocument', 'Contract'],
'DxChangeItem', 'DxProcessExecutor', 'ExtECM', 'DxCADDocument', 'Contract', 'OutStorageRequest'],
props: {
basicData: {
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 @@
<dee-tools mode="normal" :tools="tools" />
</div>
<div class="content-model">
<step v-show="viewType === 'ExtPosition'" />
<unit v-show="viewType === 'unit'" />
<view2 v-show="viewType === 'AircraftSorties'" />
<step v-show="viewType === 'ExtPosition'" :show-flag="viewType === 'ExtPosition'" :node="node" />
<unit v-show="viewType === 'unit'" :show-flag="viewType === 'unit'" :node="node" />
<view2 v-show="viewType === 'AircraftSorties'" :show-flag="viewType === 'AircraftSorties'" :node="node" />
</div>
</div>
</template>
......@@ -27,6 +27,7 @@ export default {
data() {
return {
viewType: 'ExtPosition',
node: null,
evenList: [
{
even: 'changeView',
......@@ -98,7 +99,7 @@ export default {
this.$emit('changeView', this.viewType)
},
getData(params) {
console.log(params)
this.node = params
},
import() {
......@@ -121,5 +122,8 @@ export default {
display: flex;
justify-content: space-between;
}
.content-model{
height: calc(100% - 40px);
}
}
</style>
<template>
<div>
站位路线
<div class="TfMomWebStep-model">
<div :id="ganttElId" style="height: 100%;" />
</div>
</template>
<script>
import moment from 'moment'
import config from './config'
import data from './data'
export default {
name: 'TfMomWebStep',
mixins: [config, data],
props: {
node: {
type: Object,
default: () => null
},
showFlag: {
type: Boolean,
default: false
}
},
data() {
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() {
},
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>
<style lang="scss" scoped>
<style lang="scss">
.TfMomWebStep-model{
height: 100%;
.gatt{
height: 100%;
}
}
</style>
......@@ -69,7 +69,7 @@ export default {
}, 100)
})
return [{
id: 0,
id: this.AircraftSortiesId,
subTypeName: 'aircraft',
serialNumber: `${this.AircraftName}-${this.AircraftSortiesName}`,
disabled: this.disableClickFun(type, { subTypeName: 'aircraft' }),
......@@ -111,11 +111,6 @@ export default {
this.AircraftSortiesId = list[0]
this.AircraftSortiesName = list[1]
}
// this.treeData = [{
// id: '',
// type: 'aircraft',
// label: `${this.AircraftName}-${this.AircraftSortiesName}`
// }]
this.getPosition()
},
getPosition() {
......@@ -142,7 +137,7 @@ export default {
if (!tree) {
return
}
const root = tree.getNode(0)
const root = tree.getNode(this.AircraftSortiesId)
if (this.viewType === 'unit') {
this.currentNode = root.childNodes[0] && root.childNodes[0].data
} else {
......@@ -153,7 +148,7 @@ export default {
}
this.$nextTick(() => {
tree.setCurrentKey(this.currentNode.id)
this.$emit('node-click', this.currentNode)
this.$emit('nodeClick', this.currentNode)
})
}
......
<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>
</template>
<script>
import config from './config'
import data from './data'
export default {
name: 'TfMomWebUnit',
mixins: [config, data],
props: {
node: {
type: Object,
default: () => null
},
showFlag: {
type: Boolean,
default: false
}
},
data() {
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 {
},
methods: {
search() {
},
getData() {
},
import() {
},
save() {
}
}
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.TfMomWebUnit-model{
height: 100%;
}
</style>
<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>
</template>
<script>
import config from './config'
import data from './data'
export default {
name: 'TfMomWebView',
mixins: [config, data],
props: {
node: {
type: Object,
default: () => null
},
showFlag: {
type: Boolean,
default: false
}
},
data() {
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() {
},
methods: {
getData() {
}
}
}
</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