You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

206 lines
5.5 KiB

11 months ago
<template>
<view>
<view class="breadcrumb" style="min-height: 120rpx">
11 months ago
<!-- <uni-breadcrumb separator=">" style="overflow-x: auto">-->
<!-- <uni-breadcrumb-item >-->
<!-- {{route.itemname}}-->
<!-- </uni-breadcrumb-item>-->
<!-- </uni-breadcrumb>-->
11 months ago
11 months ago
<scroll-view class="breadcrumb">
<view
class="item"
v-for="(route, index) in problemTreeSelectConfirmList"
:key="index"
@click="handleClick(route)"
>
{{ route.itemname }}
{{ index === problemTreeSelectConfirmList.length - 1 ? "" : ">" }}
11 months ago
</view>
</scroll-view>
</view>
11 months ago
<scroll-view style="max-height: 400px;" :scroll-top="0" scroll-y="true" show-scrollbar="true">
11 months ago
<view
class="investigation-item"
:class="problemTreeSelect === item.id ? 'active' : ''"
11 months ago
v-for="(item, index) in 50"
11 months ago
:key="item.itemname"
@click="handleSelectProblem(item, index)"
11 months ago
>
11 months ago
<text>{{ item.itemname }}</text>111
11 months ago
<uni-icons
type="checkmarkempty"
size="24"
:style="{
color: '#2663BF',
visibility: problemTreeSelect === item.id ? 'visible' : 'hidden',
}"
/>
11 months ago
</view>
11 months ago
</scroll-view>
11 months ago
</view>
</template>
<script>
export default {
11 months ago
// 组件hiddenDangerList2
11 months ago
components: {},
11 months ago
props: ["hiddenDangerList2"],
11 months ago
data() {
return {
// 公用的js
$: this.$,
originList: [],
problemTreeSelect: null,
11 months ago
problemTreeSelectList: [],
problemTreeSelectAllList: [],
11 months ago
problemTreeSelectConfirmList: [],
};
11 months ago
},
// 页面加载
onLoad(e) {
11 months ago
console.log(12312312312);
11 months ago
// this.getData()
},
11 months ago
mounted() {
this.getData();
11 months ago
},
// 页面显示
11 months ago
onShow() {},
11 months ago
// 计算属性
computed: {},
// 方法
methods: {
11 months ago
getData() {
this.$request
.globalRequest("/hiddenDanger/highDanger/getDangerItems", {}, "GET")
.then((res) => {
if (res.code == 200) {
this.originList =JSON.parse(JSON.stringify( res.result));
11 months ago
this.problemTreeSelectList =JSON.parse(JSON.stringify( res.result));
this.problemTreeSelectAllList=JSON.parse(JSON.stringify( res.result))
// if(this.hiddenDangerList2.length>0) {
// // this.problemTreeSelectConfirmList = this.hiddenDangerList2
// console.log(this.hiddenDangerList2)
// this.problemTreeSelectList = this.hiddenDangerList2[1].children
// this.problemTreeSelect = this.hiddenDangerList2[2].id
// }
11 months ago
}
});
11 months ago
},
// 跳转页面
11 months ago
skipPage(even) {
this.$.open(even);
11 months ago
},
11 months ago
handleSelectProblem(item, index) {
console.log(11111)
11 months ago
this.problemTreeSelectConfirmList[Number(item.nlevel) - 1] = item;
if (item.children && item.children.length > 0) {
this.problemTreeSelectList = item.children;
11 months ago
} else {
11 months ago
this.problemTreeSelect = item.id;
11 months ago
}
11 months ago
this.$emit("select", this.problemTreeSelectConfirmList);
11 months ago
},
11 months ago
handleClick(item) {
console.log(item);
const selectIndex = this.problemTreeSelectConfirmList.indexOf(item);
const index =
selectIndex - 1 < 0
? this.originList.indexOf(item)
: this.problemTreeSelectConfirmList[selectIndex - 1].children.indexOf(
item
);
this.problemTreeSelectList =
selectIndex - 1 < 0
? this.originList
: this.problemTreeSelectConfirmList[selectIndex - 1].children;
11 months ago
this.problemTreeSelect = index;
11 months ago
if (item.nlevel == 1) {
this.problemTreeSelectConfirmList = JSON.parse(
JSON.stringify([this.problemTreeSelectConfirmList[0]])
);
}
if (item.nlevel == 2) {
this.problemTreeSelectConfirmList = JSON.parse(
JSON.stringify([
this.problemTreeSelectConfirmList[0],
this.problemTreeSelectConfirmList[1],
])
);
}
console.log(this.problemTreeSelectConfirmList);
},
11 months ago
},
11 months ago
onReady() {},
11 months ago
// 页面卸载
11 months ago
onUnload() {},
11 months ago
// 触发下拉刷新
onPullDownRefresh() {
// 延迟关闭刷新动画
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1500);
},
// 页面上拉触底事件的处理函数
11 months ago
onReachBottom() {},
};
11 months ago
</script>
<style>
page {
11 months ago
background: #ffffff;
11 months ago
}
</style>
<style lang="scss" scoped>
.investigation-item {
11 months ago
margin: 0 auto 20rpx;
11 months ago
width: 90%;
border-radius: 8rpx;
padding: 20rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
&.active {
11 months ago
background: #dfebf8;
11 months ago
}
}
.breadcrumb {
width: 100%;
padding: 20rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
overflow-x: auto;
flex-wrap: nowrap;
}
11 months ago
::v-deep ::-webkit-scrollbar {
// 滚动条整体样式
display: block;
width: 20rpx !important;
height: 20rpx !important;
-webkit-appearance: auto !important;
background: transparent;
overflow: auto !important;
}
::v-deep ::-webkit-scrollbar-thumb {
// 滚动条里面小方块
border-radius: 20rpx !important;
box-shadow: inset 0 0 5rpx rgba(0, 0, 0, 0.2) !important;
background-color: #f7f7f7 !important;
}
::v-deep ::-webkit-scrollbar-track {
// 滚动条
border-radius: 20rpx !important;
box-shadow: inset 0 0 5rpx rgba(0, 0, 0, 0.2) !important;
background-color: #dad8d8 !important;
}
11 months ago
</style>