修改左侧树状结构

ds1.0
fanluyan 2 years ago
parent 96a75a4e6b
commit f606b9003e

@ -36,11 +36,13 @@
:data="lineTreeData"
:props="defaultProps"
node-key="id"
default-expand-all
:default-expanded-keys="defaultExpandedKeys"
highlight-current
:expand-on-click-node="false"
:filter-node-method="filterNode"
:current-node-key="currentNodekey"
@node-expand="onHandleExpand"
@node-collapse="onHandleCollapse"
@node-click="handleNodeClick"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
@ -89,6 +91,8 @@ export default {
totalNum: "", //
zzradio: -1, //线
lineTreeData: [],
defaultExpandedKeys: [], //
collapsedKeys: [], // key
defaultProps: {
//
children: "list",
@ -215,10 +219,24 @@ export default {
getzzdyTreeList({ type: this.zzradio })
.then((res) => {
this.lineTreeData = res.data.list;
this.onlineNum = res.data.onlineNum;
this.totalNum = res.data.totalNum;
this.currentData = JSON.parse(localStorage.getItem("currentData"));
this.lineTreeData.forEach((node) => {
if (node.list) {
node.list.forEach((child) => {
this.defaultExpandedKeys.push(child.id);
});
} else {
this.defaultExpandedKeys.push(node.id);
}
});
this.defaultExpandedKeys =
JSON.parse(localStorage.getItem("defaultKey")) !== null
? JSON.parse(localStorage.getItem("defaultKey"))
: []; //defaultKey ;
console.log(this.defaultExpandedKeys);
if (this.lineTreeData[0].list[0].list.length > 0) {
}
if (
@ -244,10 +262,24 @@ export default {
getdyTreeListJoggle({ type: this.zzradio })
.then((res) => {
this.lineTreeData = res.data.list;
this.onlineNum = res.data.onlineNum;
this.totalNum = res.data.totalNum;
this.currentData = JSON.parse(localStorage.getItem("currentData"));
this.lineTreeData.forEach((node) => {
if (node.list) {
node.list.forEach((child) => {
this.defaultExpandedKeys.push(child.id);
});
} else {
this.defaultExpandedKeys.push(node.id);
}
});
this.defaultExpandedKeys =
JSON.parse(localStorage.getItem("defaultKey")) !== null
? JSON.parse(localStorage.getItem("defaultKey"))
: []; //defaultKey ;
console.log(this.defaultExpandedKeys);
if (this.lineTreeData[0].list[0].list.length > 0) {
}
if (
@ -285,6 +317,28 @@ export default {
//this.$refs.tree.scrollTo(data);
// localStorage.setItem("currentData", JSON.stringify(this.currentData));
},
//
onHandleExpand(data) {
this.defaultExpandedKeys.push(data.id);
console.log(this.defaultExpandedKeys);
localStorage.setItem(
"defaultKey",
JSON.stringify(this.defaultExpandedKeys)
);
},
//
onHandleCollapse(data) {
console.log(this.defaultExpandedKeys);
let index = this.defaultExpandedKeys.findIndex(
(item) => item === data.id
);
if (index !== -1) this.defaultExpandedKeys.splice(index, 1);
console.log(this.defaultExpandedKeys);
localStorage.setItem(
"defaultKey",
JSON.stringify(this.defaultExpandedKeys)
);
},
scrollView() {
if (this.currentData) {
this.$nextTick(() => {

@ -45,6 +45,9 @@ export default {
clearInterval(this.statusTimer);
this.statusTimer = null;
this.statusNum = 0;
clearInterval(this.picPimer);
this.picPimer = null;
this.picNum = 0;
this.picLoading = false;
},
deep: true,
@ -133,6 +136,50 @@ export default {
.then((res) => {
console.log(res);
//res.data 0 1 2
// if (
// res.data.cmaStatus == 0 &&
// res.data.picStatus == false &&
// this.statusNum >= 5
// ) {
// //
// this.clearFn();
// this.$message({
// duration: 1500,
// showClose: true,
// message: "true",
// type: "warning",
// });
// } else if (res.data.cmaStatus == 1) {
// this.clearFn();
// this.$message({
// duration: 1500,
// showClose: true,
// message: "cmaStatus1",
// type: "success",
// });
// clearInterval(this.picPimer);
// this.picPimer = null;
// this.picPimer = window.setInterval(() => {
// this.newPicApi(val);
// this.picNum++;
// }, 8000);
// return;
// } else if (res.data.picStatus == true) {
// this.clearFn();
// this.$message({
// duration: 1500,
// showClose: true,
// message: "",
// type: "success",
// });
// clearInterval(this.picPimer);
// this.picPimer = null;
// this.picPimer = window.setInterval(() => {
// this.newPicApi(val);
// this.picNum++;
// }, 2000);
// return;
// }
if (res.data.cmaStatus != 1 && this.statusNum >= 5) {
this.clearFn();
this.$message({

@ -21,11 +21,11 @@ module.exports = defineConfig({
proxy: {
"/api": {
//表示拦截以/api开头的请求路径
target: "http://47.96.238.157:8093", //阿里云服务器环境
//target: "http://180.166.218.222:40080", //dell
//target: "http://47.96.238.157:8093", //阿里云服务器环境
target: "http://180.166.218.222:40080", //dell
changOrigin: true, //是否开启跨域
pathRewrite: {
"^/api": "", //重写api把api变成空字符因为我们真正请求的路径是没有api的
"^/api": "/api", //重写api把api变成空字符因为我们真正请求的路径是没有api的
},
},
},

Loading…
Cancel
Save