Commit 6a2797e0 authored by arvin's avatar arvin

单架次MBOM配置

parent e844d320
<template> <template>
<div class=""> <div class="TfMomWebGatt-page">
<el-button-group> <div class="btn-bar">
<el-button :type="viewType==='ExtPosition'?'primary':''" @click="setView('ExtPosition')">站位路线</el-button> <el-radio-group v-model="viewType" size="small" @input="setView">
<el-button :type="viewType==='unit'?'primary':''" @click="setView('unit')">装配单元路线</el-button> <el-radio-button label="ExtPosition">站位路线</el-radio-button>
<el-button :type="viewType==='AircraftSorties'?'primary':''" @click="setView('AircraftSorties')">架次视图路线</el-button> <el-radio-button label="unit">装配单元路线</el-radio-button>
</el-button-group> <el-radio-button label="AircraftSorties">架次视图路线</el-radio-button>
</el-radio-group>
<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'" />
</div>
</div> </div>
</template> </template>
<script> <script>
import step from './step.vue'
import unit from './unit.vue'
import view2 from './view.vue'
export default { export default {
componentName: '单架次MBOM甘特图', componentName: '单架次MBOM甘特图',
name: 'TfMomWebGatt', name: 'TfMomWebGatt',
components: { step, unit, view2 },
data() { data() {
return { return {
viewType: 'ExtPosition', viewType: 'ExtPosition',
...@@ -30,7 +41,53 @@ export default { ...@@ -30,7 +41,53 @@ export default {
] ]
} }
}, },
computed: {
tools() {
const btns = [{
name: '导出',
icon: '/icons/c-export.png',
handler: {
click: () => {
this.import()
}
}
}]
if (this.viewType === 'AircraftSorties') {
return btns
}
if (this.viewType === 'ExtPosition') {
btns.unshift({
name: '保存',
icon: '/icons/c-export.png',
handler: {
click: () => {
this.save()
}
}
})
return btns
}
btns.unshift({
name: '设置排序',
icon: '/icons/check.png',
handler: {
click: () => {
this.config()
}
}
})
btns.unshift({
name: '保存',
icon: '/icons/c-export.png',
handler: {
click: () => {
this.save()
}
}
})
return btns
}
},
mounted() { mounted() {
}, },
...@@ -39,11 +96,30 @@ export default { ...@@ -39,11 +96,30 @@ export default {
setView(type) { setView(type) {
this.viewType = type this.viewType = type
this.$emit('changeView', this.viewType) this.$emit('changeView', this.viewType)
},
getData(params) {
console.log(params)
},
import() {
},
save() {
},
config() {
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.TfMomWebGatt-page{
height: 100%;
.btn-bar{
height: 40px;
display: flex;
justify-content: space-between;
}
}
</style> </style>
<template>
<div>
站位路线
</div>
</template>
<script>
export default {
name: 'TfMomWebStep',
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
<template> <template>
<div class="TfMomWeb-tree"> <div class="TfMomWeb-tree">
<el-tree <el-tree
v-show="AircraftName"
ref="tree"
:data="treeData" :data="treeData"
default-expand-all default-expand-all
:props="props" :props="props"
node-key="id"
:expand-on-click-node="false"
@node-click="nodeClick"
> >
<span slot-scope="{ node, data }" class="custom-tree-node"> <span slot-scope="{ node, data }" class="dee-as-tree-node" :class="{'disable-dee-as-tree-node': data.disabled, 'current':currentNode.id === data.id}">
<i v-show="data.subTypeName==='aircraft'" class="el-icon-s-promotion" /> <i v-show="data.subTypeName==='aircraft'" class="el-icon-s-promotion" />
<i v-show="data.subTypeName==='ExtPosition'" class="el-icon-s-tools" /> <i v-show="data.subTypeName==='ExtPosition'" class="el-icon-s-tools" />
<span>{{ node.label }}</span> <span>{{ node.label }}</span>
...@@ -23,7 +28,8 @@ export default { ...@@ -23,7 +28,8 @@ export default {
AircraftName: '', AircraftName: '',
AircraftSortiesId: '', AircraftSortiesId: '',
AircraftSortiesName: '', AircraftSortiesName: '',
treeData: [], currentNode: {},
postionList: [],
viewType: 'ExtPosition', viewType: 'ExtPosition',
emitMethods: [ emitMethods: [
{ {
...@@ -42,22 +48,57 @@ export default { ...@@ -42,22 +48,57 @@ export default {
} }
], ],
props: { props: {
disabled: (data) => { label: (data, node) => this.setLabel(data, node)
console.log('ddddd')
if (this.viewType === 'ExtPosition') {
return data.subTypeName === 'ExtPosition'
}
return data.subTypeName === 'aircraft'
}
} }
} }
}, },
computed: {
treeData() {
return this.initTree(this.viewType, this.postionList)
}
},
mounted() { mounted() {
}, },
methods: { methods: {
initTree(type, postionList) {
this.$nextTick(() => {
setTimeout(() => {
this.defaultNodeClick()
}, 100)
})
return [{
id: 0,
subTypeName: 'aircraft',
serialNumber: `${this.AircraftName}-${this.AircraftSortiesName}`,
disabled: this.disableClickFun(type, { subTypeName: 'aircraft' }),
children: postionList.map(r => {
r.disabled = this.disableClickFun(type, r)
return r
})
}]
},
setLabel(data, node) {
return data.serialNumber
},
disableClickFun(type, data) {
if (type === 'unit') {
return data.subTypeName === 'aircraft'
}
return data.subTypeName === 'ExtPosition'
},
nodeClick(data, node) {
if (data.disabled) {
this.$refs.tree.setCurrentKey(null)
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentNode.id)
})
return
}
this.currentNode = data
this.$emit('nodeClick', data)
},
getData(params) { getData(params) {
const items = params.items || params const items = params.items || params
const AircraftType = items.find(r => r.fieldName === 'AircraftType') const AircraftType = items.find(r => r.fieldName === 'AircraftType')
...@@ -85,26 +126,49 @@ export default { ...@@ -85,26 +126,49 @@ export default {
this.$api.searchApi('ExtPosition', params).then(res => { this.$api.searchApi('ExtPosition', params).then(res => {
if (res.items.content) { if (res.items.content) {
this.treeData = [{ this.postionList = res.items.content
id: '', } else {
subTypeName: 'aircraft', this.postionList = []
label: `${this.AircraftName}-${this.AircraftSortiesName}`,
children: res.items.content.map(r => {
r.label = r.serialNumber
return r
})
}]
} }
}).catch(() => {
this.postionList = []
}) })
}, },
setNode(type) { setNode(type) {
this.viewType = type this.viewType = type
},
defaultNodeClick() {
const tree = this.$refs.tree
if (!tree) {
return
}
const root = tree.getNode(0)
if (this.viewType === 'unit') {
this.currentNode = root.childNodes[0] && root.childNodes[0].data
} else {
this.currentNode = root.data
}
if (!this.currentNode) {
return
}
this.$nextTick(() => {
tree.setCurrentKey(this.currentNode.id)
this.$emit('node-click', this.currentNode)
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.TfMomWeb-tree{
.dee-as-tree-node{
width: 100%;
&.disable-dee-as-tree-node{
color: #ccc;
cursor: not-allowed;;
}
}
}
</style> </style>
<template>
<div>
装配单元路线
</div>
</template>
<script>
export default {
name: 'TfMomWebUnit',
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div>
架次视图路线
</div>
</template>
<script>
export default {
name: 'TfMomWebView',
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
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