123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <template>
- <view>
- <view class="top">
- <image src="./img/top.jpg" mode=""></image>
- </view>
- <view class="content">
- <view class="list">
- <view class="item" v-for="(item,index) in list" :key="index"
- @click="open_draw(item.mine_id,item.mine_name)">
- <view class="inner" :style="{borderLeftColor: bgColor[index]}">
- <view class="left">
- <view class="name">{{item.mine_name}}</view>
- <view class="text">{{item.danger_num}} 条隐患信息</view>
- </view>
- <view class="right">
- <view class="num">{{item.score}} 分</view>
- <view class="icon">
- <uni-icons type="arrowright"></uni-icons>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 弹出层 -->
- <uni-drawer ref="draw" mode="right" :width="300">
- <view class="drawer">
- <view class="title">{{mine_name}}</view>
- <view class="container">
- <view class="item" v-for="(item,index) in depart_list" :key="index"
- @click="go_detail(item.depart_id)">
- <view class="inner" :style="{borderLeftColor: bgColor[index]}">
- <view class="left">
- <view class="name">{{item.depart_name}}</view>
- <view class="text">{{item.danger_num}} 条隐患信息</view>
- </view>
- <view class="right">
- <view class="num">{{item.score}} 分</view>
- <view class="icon">
- <uni-icons type="arrowright"></uni-icons>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </uni-drawer>
- </view>
- </view>
- </template>
- <script>
- import time from "@/common/time.js"
- export default {
- data() {
- return {
- start_time: "",
- end_time: "",
- list: [],
- bgColor: [],
- depart_list: [],
- mine_name: ""
- };
- },
- onLoad() {
- // 初始化时间
- this.start_time = new Date().format("yyyy-MM-01")
- this.end_time = new Date().format("yyyy-MM-dd")
- console.log(this.start_time, this.end_time)
- // 设置头像
- for (let i = 0; i < 100; i++) {
- // 获取随机色
- let r = parseInt(Math.random() * 256)
- let g = parseInt(Math.random() * 256)
- let b = parseInt(Math.random() * 256)
- // ES6 字符串拼接
- // this.bgColor = `rgba(${r},${g},${b},0.3)`
- let color = "rgba(" + r + "," + g + "," + b + "," + 0.8 + ")"
- // console.log(color)
- this.bgColor.push(color)
- }
- this.get_list()
- },
- methods: {
- open_draw(mine_id, mine_name) {
- this.mine_name = mine_name
- this.depart_list = []
- this.$refs.draw.open()
- this.$p_api.danger_depart({
- mine_id: mine_id,
- start_time: this.start_time,
- end_time: this.end_time
- }).then((res) => {
- // console.log(res.data.data)
- this.depart_list = res.data.data
- })
- },
- go_detail(depart_id) {
- uni.navigateTo({
- url: "detail/detail?depart_id=" + depart_id
- })
- },
- get_list() {
- this.$p_api.danger_mine({
- start_time: this.start_time,
- end_time: this.end_time
- }).then((res) => {
- // console.log(res.data.data)
- this.list = res.data.data
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .top {
- image {
- width: 750rpx;
- height: 360rpx;
- }
- }
- .content {
- width: 749rpx;
- }
- .list {
- .item {
- box-sizing: border-box;
- padding: 20rpx 0;
- padding-right: 30rpx;
- border-bottom: 1px solid #eee;
- .inner {
- border-left: 12rpx solid #8BDAFF;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .left {
- box-sizing: border-box;
- padding-left: 30rpx;
- line-height: 45rpx;
- .name {}
- .text {
- font-size: 26rpx;
- color: #999999;
- }
- }
- .right {
- display: flex;
- align-items: center;
- .num {
- font-size: 26rpx;
- color: #AC5158;
- }
- .icon {
- margin-left: 4rpx;
- }
- }
- }
- }
- }
- .drawer {
- width: 600rpx;
- .title {
- line-height: 87rpx;
- box-sizing: border-box;
- padding: 0 30rpx;
- border-bottom: 1px solid #2E8EAA;
- }
- .container {
- width: 600rpx;
- .item {
- box-sizing: border-box;
- padding: 20rpx 0;
- padding-right: 30rpx;
- border-bottom: 1px solid #eee;
- .inner {
- border-left: 12rpx solid #8BDAFF;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .left {
- box-sizing: border-box;
- padding-left: 30rpx;
- line-height: 45rpx;
- width: 390rpx;
- .name {
- width: 390rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .text {
- font-size: 26rpx;
- color: #999999;
- }
- }
- .right {
- display: flex;
- align-items: center;
- .num {
- font-size: 26rpx;
- color: #AC5158;
- }
- .icon {
- margin-left: 4rpx;
- }
- }
- }
- }
- }
- }
- </style>
|