|
|
@@ -52,13 +52,25 @@ export default defineComponent({
|
|
|
const treeData = ref([]);
|
|
|
const expandedKeys = ref([]);
|
|
|
const selectedKeys = ref([]);
|
|
|
+ const currentTreeNodeKeys = ref([])
|
|
|
const checkedKeys = ref([]);
|
|
|
const achieveList = ref([]);
|
|
|
|
|
|
- const nodeSelect = (selectedKeys, { selectedNode, node }) => {
|
|
|
- if (selectedKeys.length) {
|
|
|
+ const nodeSelect = (selectedKey, { selectedNode, node }) => {
|
|
|
+ if (currentTreeNodeKeys.value.length && currentTreeNodeKeys.value[0] === selectedKey[0]) {
|
|
|
+ selectedKeys.value = [];
|
|
|
+ currentTreeNodeKeys.value = [];
|
|
|
+ platList().then((r) => {
|
|
|
+ if (r) {
|
|
|
+ achieveList.value = r
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ currentTreeNodeKeys.value[0] = selectedKey[0]
|
|
|
+ if (selectedKey.length) {
|
|
|
console.log(node.dataRef)
|
|
|
- platListByMenuId(node.dataRef.id).then(res => {
|
|
|
+ platList({id: node.dataRef.id}).then(res => {
|
|
|
if (res.length) {
|
|
|
achieveList.value = res
|
|
|
}
|
|
|
@@ -75,17 +87,37 @@ export default defineComponent({
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
- platList().then((r) => { if (r) achieveList.value = r });
|
|
|
+ platList().then((r) => {
|
|
|
+ if (r) {
|
|
|
+ achieveList.value = r
|
|
|
+ console.log(achieveList.value)
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
eventBus.on('platListCenter', (o) => {
|
|
|
var type = null;
|
|
|
if (o && o.type) type = o.type == 'MAP' ? 'MR' : o.type == 'SCENE' ? 'ER' : 'DR';
|
|
|
- platList(o).then((r) => {
|
|
|
+ let params = JSON.parse(JSON.stringify(o))
|
|
|
+ params.id = currentTreeNodeKeys.value.length ? currentTreeNodeKeys.value[0] : null
|
|
|
+ platList(params).then((r) => {
|
|
|
if (r) {
|
|
|
if (type) {
|
|
|
var list = JSON.parse(JSON.stringify(achieveList.value))
|
|
|
- achieveList.value = list.map(i => { if (i.type == type) { i = r.find(j => j.type == type) } return i; })
|
|
|
+ let resArr = []
|
|
|
+ list.forEach((item,index)=>{
|
|
|
+ item.type!==type && (resArr[index]=item)
|
|
|
+ })
|
|
|
+ r.forEach((item,index)=>{
|
|
|
+ item.type===type && (resArr[index]=item)
|
|
|
+ })
|
|
|
+ achieveList.value = resArr;
|
|
|
+ // achieveList.value = list.map(i => {
|
|
|
+ // if (i.type == type) {
|
|
|
+ // i = r.find(j => j.type == type)
|
|
|
+ // }
|
|
|
+ // return i;
|
|
|
+ // })
|
|
|
} else {
|
|
|
achieveList.value = r;
|
|
|
}
|
|
|
@@ -94,7 +126,10 @@ export default defineComponent({
|
|
|
});
|
|
|
|
|
|
const resAddToCar = () => {
|
|
|
- platList().then((r) => { if (r) achieveList.value = r });
|
|
|
+ let params = {
|
|
|
+ id:currentTreeNodeKeys.value.length ? currentTreeNodeKeys.value[0] : null
|
|
|
+ }
|
|
|
+ platList(params).then((r) => { if (r) achieveList.value = r });
|
|
|
}
|
|
|
|
|
|
return {
|