jy-safe-app/pages/apply/subPages/HM/5hazardList.vue

266 lines
5.9 KiB
Vue
Raw Permalink Normal View History

2025-10-14 15:17:30 +08:00
<template>
<view class="risk-record-page">
<u-sticky>
<view class="filter-bar">
<view class="filter filter-date-range" @click="handleShowPicker({title: '时间区间', name: 'dateRange'})">
<text>时间区间</text>
<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
</view>
<uni-search-bar class="search-bar" radius="100" :value="keyword" @confirm="handleSearch"
@cancel="handleCancelSearch" @clear="handleCancelSearch" placeholder="搜索"></uni-search-bar>
<view class="filter filter-status" @click="handleShowPicker({title: '状态', name: 'status'})">
<text>状态筛选</text>
<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
</view>
</view>
</u-sticky>
<view class="main">
<view class="content-list">
<common-card :dataSource="item" v-for="item in lists" class="content" @click="showDetail(item.ID)">
<view>
<view class="field">
<text class="label">生产单元</text>
<text class="value">{{item.MineType}}</text>
</view>
<view class="field">
<text class="label">辨识区域</text>
<text class="value">{{item.Nav_Area.NAME}}</text>
</view>
<view class="field">
<text class="label">辨识对象</text>
<text class="value">{{item.Nav_Identifying ? item.Nav_Identifying.NAME : ''}}</text>
</view>
<view class="field">
<text class="label">风险地点</text>
<text class="value">{{item.RISK_PLACE}}</text>
</view>
</view>
</common-card>
</view>
<view v-if="!lists.length" class="empty-wrap">
<u-empty text="暂无数据" icon="/static/empty@2x.png">
</u-empty>
</view>
</view>
<u-picker :show="comPickerInfo.showPicker" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"
@cancel="closePicker"></u-picker>
</view>
</template>
<script>
import {
getRequestOrderPage
} from '../../../../services/apply/FOServices/FOServices.js'
import {
extendInclude,
extendRule,
initFilter
} from '../../../../utils/common'
import UniSearchBar from '../../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'
export default {
components: {
UniSearchBar
},
data() {
return {
pageIndex: 1,
total: 0,
lists: [],
keyword: '',
comPickerInfo: {
showPicker: false,
columns: [],
title: '',
name: ''
}
}
},
onLoad() {
this.loadData()
},
methods: {
handleSearch(obj) {
this.keyword = obj.value
},
handleCancelSearch() {
this.keyword = ''
},
loadData() {
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "CREATE_TIME", 1, this.pageIndex)
extendInclude(json, "Nav_Area")
extendInclude(json, "Nav_OccupationalRisk")
extendInclude(json, "Nav_Identifying")
extendInclude(json, "Nav_MonitorMeasures")
if (this.keyword) {
extendRule(json, 'NAME', 9, this.keyword)
} else {
json.FilterGroup = {
Groups: [],
Rules: []
}
}
getRequestOrderPage(json, "/HM/EvaluateHazard/OrderPaged").then(res => {
this.total = res.TotalCount;
for (let i = 0; i < res.Data.length; i++) {
if (res.Data[i].MineType == 0) {
res.Data[i].MineType = "全公司";
} else if (res.Data[i].MineType == 10) {
res.Data[i].MineType = "选矿厂";
} else if (res.Data[i].MineType == 20) {
res.Data[i].MineType = "尾矿库";
} else if (res.Data[i].MineType == 30) {
res.Data[i].MineType = "露天矿";
}
}
let newRes = (res.Data || []).map(i => {
return {
...i,
title: i.Nav_Identifying.NAME,
}
})
if (this.pageIndex !== 1) {
this.lists = this.lists.concat(newRes)
} else {
this.lists = newRes
}
})
},
showDetail(id) {
uni.navigateTo({
url: '/pages/apply/subPages/HM/5hazardShow?ID=' + id
})
},
handleShowPicker(p) {
let column = []
if (p.name === 'dateRange') {
column = ['当天', '最近三天', '最近一周', '最近一月']
}
if (p.name === 'status') {
column = ['正常', '未处理']
}
this.comPickerInfo = {
showPicker: true,
title: p.title,
name: p.name,
columns: [column]
}
},
onConfirmPicker(e) {
console.log(e)
},
closePicker() {
this.comPickerInfo = {
showPicker: false,
columns: [],
title: '',
name: ''
}
},
},
onReachBottom() {
// 页码 +1
if (this.total > 10 * this.pageIndex)
this.pageIndex++
},
watch: {
pageIndex(n, o) {
this.loadData()
},
keyword(n, o) {
this.pageIndex = 1
this.keyword = n
this.loadData()
},
}
}
</script>
<style>
.risk-record-page {
position: relative;
}
.risk-record-page .main {
padding: 0px 16px;
position: relative;
}
.risk-record-page>>>.uni-searchbar {
padding: 0px;
display: flex;
align-items: center;
font-size: 12px;
.uni-searchbar__box {
height: 30px;
}
.uni-searchbar__box-icon-clear {
display: flex;
align-items: center;
}
.uni-input-placeholder {}
.uni-searchbar__box-search-input {
font-size: 12px;
}
.uni-searchbar__text-placeholder {
font-size: 12px;
margin-left: 0px;
}
.uni-text {
font-size: 12px;
}
}
.filter-bar .search-bar {
margin-left: 20px;
margin-right: 20px;
width: 100%;
display: flex;
flex: 1;
align-items: center;
font-size: 12px;
}
.filter-bar {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #ffffff;
padding: 10px 16px 10px 16px;
box-shadow: 0px 0px 5px 0px #eaedf4;
}
.filter-bar .filter {
display: flex;
align-items: center;
font-size: 12px;
line-height: 18px;
color: #333;
}
.content-list {
padding: 10px 0;
}
.content .field {
font-size: 12px;
line-height: 18px;
margin-bottom: 4px;
}
.content .field .label {
color: #666;
}
.content .field .value {
color: #333333;
}
</style>