优化左侧

master
fanluyan 1 year ago
parent e85790effb
commit 0f262b5b9d

@ -76,7 +76,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getdyTreeListJoggle } from "@/utils/api/index"; import { getdyTreeListJoggle, getzzdyTreeList } from "@/utils/api/index";
export default { export default {
data() { data() {
return { return {
@ -99,6 +99,7 @@ export default {
}, },
currentData: {}, // currentData: {}, //
currentNodekey: "", //, currentNodekey: "", //,
role: "",
}; };
}, },
watch: { watch: {
@ -133,7 +134,69 @@ export default {
}, },
// //
getLineTreeList() { getLineTreeList() {
this.role = localStorage.getItem("role");
console.log(this.role);
this.treeLoading = true; this.treeLoading = true;
if (this.role == 2) {
getzzdyTreeList({
type: -1,
lineid: [
"234",
"238",
"253",
"242",
"233",
"231",
"243",
"235",
"248",
"230",
"236",
"239",
"257",
"255",
],
})
.then((res) => {
this.lineTreeData = res.data.list;
this.treeLoading = false;
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"))
: this.defaultExpandedKeys; //defaultKey ;
//console.log(this.defaultExpandedKeys);
if (this.lineTreeData[0].list[0].list.length > 0) {
}
if (
this.currentData !== null &&
Object.keys(this.currentData).length !== 0
) {
this.currentNodekey = this.currentData.id;
this.handleNodeClick(this.currentData);
} else {
this.currentData = this.lineTreeData[0]; //
this.currentNodekey = this.lineTreeData[0].id; //
this.handleNodeClick(this.currentData);
}
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentNodekey); //
});
})
.catch((err) => {
console.log(err); //
});
} else {
getdyTreeListJoggle({ type: -1 }) getdyTreeListJoggle({ type: -1 })
.then((res) => { .then((res) => {
this.lineTreeData = res.data.list; this.lineTreeData = res.data.list;
@ -174,6 +237,7 @@ export default {
.catch((err) => { .catch((err) => {
console.log(err); // console.log(err); //
}); });
}
}, },
//treenode //treenode
handleNodeClick(data) { handleNodeClick(data) {

@ -204,3 +204,12 @@ export function getSearchInfo(data) {
data, data,
}); });
} }
//郑州左侧树状结构接口
export function getzzdyTreeList(data) {
return request({
url: "/api/getzzdyTreeList",
method: "post",
data,
});
}

@ -170,6 +170,7 @@ export default {
this.loading = true; this.loading = true;
this.$set(this.formdata, "pageindex", this.page); this.$set(this.formdata, "pageindex", this.page);
this.$set(this.formdata, "pagesize", this.pageSize); this.$set(this.formdata, "pagesize", this.pageSize);
console.log(this.formdata);
getLineListJoggle(this.formdata) getLineListJoggle(this.formdata)
.then((res) => { .then((res) => {
this.lineTableData = res.data.list; this.lineTableData = res.data.list;

Loading…
Cancel
Save