Commit d7b89814 authored by jingnan's avatar jingnan 👀

站位计划维护系统默认1101架机,左侧树结构修改为懒加载

parent b4d42146
......@@ -255,7 +255,7 @@ export default {
})
this.$nextTick(() => {
if (this.sortiesData.length) {
this.form.sorties = this.sortiesData[0].value
this.form.sorties = this.sortiesData.find(s => s.label === '1101').value
}
})
} else {
......
......@@ -269,7 +269,7 @@ export default {
})
this.$nextTick(() => {
if (this.sortiesData.length) {
this.form.sorties = this.sortiesData[0].value
this.form.sorties = this.sortiesData.find(s => s.label === '1101').value
}
})
} else {
......
......@@ -224,7 +224,7 @@ export default {
})
this.$nextTick(() => {
if (this.sortiesData.length) {
this.form.sorties = this.sortiesData[0].value
this.form.sorties = this.sortiesData.find(s => s.label === '1101').value
}
})
} else {
......
......@@ -47,6 +47,9 @@
class="plan-tree"
:data="treeData"
node-key="id"
lazy
accordion
:load="loadNode"
:default-expanded-keys="defaultExpandedKeys"
:current-node-key="currentNodekey"
:props="defaultProps"
......@@ -59,7 +62,7 @@
<i :class="'tree' + node.level" />
<span v-if="node.level === 1" class="label change-text" :title="data.serialNumber">{{ data.serialNumber }}</span>
<span v-if="node.level === 2" class="change-text">{{ data.serialNumber + ',' + data.name }}</span>
<span v-if="node.level === 3&& data.target" class="change-text" :class="[data.target.isOk ?'Delivery':'Finish']">{{ data.target.serialNumber + ',' + data.target.name }}</span>
<span v-if="node.level === 3&&data.name!=='转移工作包'" class="change-text" :class="[data.isOk ?'Delivery':'Finish']">{{ data.serialNumber + ',' + data.name }}</span>
<span v-if="data.name==='转移工作包'" class="change-text Reserved">{{ data.name }}</span>
<span v-if="node.level === 4" class="change-text" :class="[data.isOk ?'Delivery':'Finish']">{{ data.serialNumber + ',' + data.name }}</span>
</span>
......@@ -288,7 +291,7 @@ export default {
const spans = treeNode.getElementsByClassName('change-text')
if (spans.length > 0) {
for (let i = 0; i < spans.length; i++) {
var labelText = spans[i].textContent
let labelText = spans[i].textContent
const reg = this.keyword
.replace(/\(/g, '\\(')
.replace(/\)/g, '\\)')
......@@ -366,10 +369,8 @@ export default {
this.filterTool.nodes = nodeMap.filter(node => {
if (node.level === 1) {
node.data.label = node.data.serialNumber
} else if (node.level === 2) {
node.data.label = node.data.serialNumber + ',' + node.data.name
} else {
node.data.label = node.data.target.serialNumber + ',' + node.data.target.name
node.data.label = node.data.serialNumber + ',' + node.data.name
}
return node.data.label.toUpperCase().includes(this.keyword.toUpperCase())
}
......@@ -467,7 +468,7 @@ export default {
})
this.$nextTick(() => {
if (this.sortiesData.length) {
this.form.sorties = this.sortiesData[0].value
this.form.sorties = this.sortiesData.find(s => s.label === '1101').value
}
})
} else {
......@@ -485,6 +486,19 @@ export default {
})
})
},
loadNode(node, resolve) {
if (node.level === 0) {
return resolve(this.treeData)
} else if (node.level === 1) {
return resolve(node.data.children)
} else if (node.level === 2) {
if (node.data) {
this.getCAData(node, resolve)
}
} else if (node.data.name === '转移工作包') {
this.getQueryRetention(node, resolve)
}
},
/**
* 获取树结构数据
*/
......@@ -522,14 +536,14 @@ export default {
}
],
openProps: [
{
name: 'target',
openProps: [
{
name: 'wrProduction'
}
]
}
// {
// name: 'target',
// openProps: [
// {
// name: 'wrProduction'
// }
// ]
// }
]
}
],
......@@ -542,16 +556,16 @@ export default {
}
post(`/ExtPosition/queryPosition`, params)
.then((res) => {
var data = res.items.content || []
data.map((item) => {
if (item.extPositionLinks) {
item.extPositionLinks = item.extPositionLinks.filter(val => val.target)
item.extPositionLinks.forEach(element => {
element.leaf = true
})
item.children = [...item.extPositionLinks, { name: '转移工作包', children: [], id: parseInt(Math.random() * 100000000000000, 10) }]
}
})
const data = res.items.content || []
// data.map((item) => {
// if (item.extPositionLinks) {
// item.extPositionLinks = item.extPositionLinks.filter(val => val.target) || []
// item.extPositionLinks.forEach(element => {
// element.leaf = true
// })
// item.children = [...item.extPositionLinks, { name: '转移工作包', children: [], id: parseInt(Math.random() * 100000000000000, 10) }]
// }
// })
this.treeData = [
{
serialNumber: `BBOM-${this.form.modelName}-${this.form.sortiesName}`,
......@@ -561,29 +575,105 @@ export default {
children: data
}
]
if (data.length > 0) {
this.defaultExpandedKeys = [this.treeData[0].children[0].id]
this.currentNodekey = this.treeData[0].children[0].children[0].id
this.defaultExpandedKeys = [this.treeData[0].id]
// if (data.length > 0) {
// this.defaultExpandedKeys = [this.treeData[0].children[0].id]
// this.currentNodekey = this.treeData[0].children[0].children[0].id
// this.$nextTick(() => {
// this.$refs.tree.setCurrentKey(this.currentNodekey)
// })
// this.$nextTick(() => {
// this.treeData[0].children[0].children[0].level = 3
// this.activeNodeData = this.treeData[0].children[0].children[0]
// this.treeData[0].children[0].children[0].activeTab = this.activeTab
// this.treeData[0].children[0].children[0].searchStories = this.form.sortiesName
// this.getRightTableData(this.treeData[0].children[0].children[0])
// })
// } else {
// this.activeNodeData = {}
// this.activeNodeData.searchStories = this.form.sortiesName
// this.getRightTableData(this.activeNodeData)
// }
})
.catch((err) => console.log(err))
.finally(() => {
this.treeLoading = false
})
},
/**
* 获取树结构-CAS数据(第三层)
*/
getCAData(node, resolve) {
const params = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'sorties',
'operator': 'EQ',
'value': this.form.sortiesName
},
{
'fieldName': 'positionNumber',
'operator': 'EQ',
'value': node.data.serialNumber
},
{
'fieldName': 'subTypeName',
'operator': 'EQ',
'value': 'ExtProcessPlanAssemblyUnit'
}
],
'operator': 'AND'
}
],
'items': [],
'operator': 'AND'
},
'openProps': [],
'sortItem': [
{
'fieldName': 'serialNumber',
'sortOrder': 'asc'
}
]
}
post('/ExtProcessPlan/queryCA', params)
.then((res) => {
if (!res || !res.items) return
res.items.forEach(element => {
element.leaf = true
element.level = 3
element.targetId = element.id // 兼容懒加载之前查询右侧的操作
element.target = element // 兼容懒加载之前查询右侧的操作
})
if (res.items.length > 0) {
this.currentNodekey = res.items[0].id
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentNodekey)
})
this.$nextTick(() => {
this.treeData[0].children[0].children[0].level = 3
this.activeNodeData = this.treeData[0].children[0].children[0]
this.treeData[0].children[0].children[0].activeTab = this.activeTab
this.treeData[0].children[0].children[0].searchStories = this.form.sortiesName
this.getRightTableData(this.treeData[0].children[0].children[0])
this.activeNodeData = res.items[0]
res.items[0].activeTab = this.activeTab
res.items[0].searchStories = this.form.sortiesName
this.getRightTableData(res.items[0])
})
} else {
this.activeNodeData = {}
this.activeNodeData.searchStories = this.form.sortiesName
this.getRightTableData(this.activeNodeData)
}
return resolve([...res.items, { name: '转移工作包', children: [], id: parseInt(Math.random() * 100000000000000, 10) }])
})
.catch((err) => console.log(err))
.finally(() => {
this.treeLoading = false
.catch((err) => {
console.log(err)
return resolve([])
})
.finally(() => {})
},
tabClick(val) {
this.activeTab = val.index
......@@ -595,9 +685,9 @@ export default {
},
handleNodeClick(data, node) {
this.requestParams = []
if (data.name === '转移工作包') {
this.getQueryRetention(data, node)
} else {
if (data.name !== '转移工作包') {
// this.getQueryRetention(data, node)
// } else {
data.activeTab = this.activeTab
data.level = node.level
data.searchStories = this.form.sortiesName
......@@ -631,7 +721,7 @@ export default {
}
}
},
getQueryRetention(data, node) {
getQueryRetention(node, resolve) {
const params = {
'searchItems': {
'children': [
......@@ -677,15 +767,16 @@ export default {
item.leaf = true
item.parentPosition = node.parent.data && node.parent.data.serialNumber || ''
return item
})
if (newChildren) {
this.$refs.tree.updateKeyChildren(node.key, newChildren)
this.defaultExpandedKeys = [node.key]
}
}) || []
// if (newChildren) {
// this.$refs.tree.updateKeyChildren(node.key, newChildren)
// this.defaultExpandedKeys = [node.key]
// }
return resolve(newChildren)
}).catch(err => {
console.log(err)
return resolve([])
}).finally(() => {
})
},
getCurrentData(data) {
......
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