jy-safe-app/pages/apply/subPages/BS/riskIndex.vue

242 lines
6.2 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>{{dateFilterTxt}}</text>
<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
</view>
<uni-search-bar class="search-bar" radius="100" v-model="keyword" @confirm="handleSearch"
@cancel="handleCancelSearch" @clear="handleCancelSearch" placeholder="搜索" cancel-button="none">
<uni-icons slot="searchIcon" color="#999999" size="16" type="search" class="search-slot" />
</uni-search-bar>
<!-- <view class="filter filter-status" @click="handleShowPicker({title: '状态', name: 'status'})">
<text>{{statusFilterTxt}}</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" @click="showDetail(item.ID)">
<view class="content">
<view class="field">
<text class="left">检查区域</text>
<text class="value">{{item.AREANAME}}</text>
</view>
<!-- <view class="field">
<text class="left">检查内容</text>
<text class="value">{{item.CHECKCONTENT}}</text>
</view> -->
<view class="field">
<text class="left">隐患名称</text>
<text class="value">{{item.DESCREPTIONNEW}}</text>
</view>
<view class="field">
<text class="left">隐患次数</text>
<text class="value">{{item.COUNTRISK}}</text>
</view>
<view class="field">
<text class="left">隐患等级</text>
<text class="value">{{item.QUESTION_LEVEL_SHOW}}</text>
</view>
</view>
</common-card>
</view>
</view>
<u-picker :show="comPickerInfo.showPicker" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"
@cancel="closePicker"></u-picker>
</view>
</template>
<script>
import {
initFilter,
extendRule,
extendInclude
} from '../../../../utils/common'
import {
OrderPagedRISKINFO
} from '../../../../services/apply/subPages/BS/lib'
import UniSearchBar from '../../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'
export default {
data() {
return {
// lists: [{
// NOTICE_TITLE:'2345',
// TASK_STARTDT:'2023-07-25 00:00:00',
// TASK_ENDDT:'2023-07-25 23:00:00'
// NOTICE_STATUS:'待完成'
// }],
pageIndex: 0,
lists: [],
currentTab: 0,
text: '',
total: '',
keyword: '',
searchStartTime: '',
filterStatus: null,
dateFilterTxt: '问题等级',
statusFilterTxt: '检查层级',
comPickerInfo: {
showPicker: false,
columns: [],
title: '',
name: ''
}
}
},
onLoad() {
// getSiteInfo({}).then(res => {
// this.text = res.money_notice checkPlanNotice
// })
this.loadData()
},
methods: {
// handleTab(t) {
// this.currentTab = t
// },
handleSearch() {
this.pageIndex = 0
this.loadData(false)
},
loadData(paginate) {
this.pageIndex++
const orgId = uni.getStorageSync('orgId')
let json = initFilter(orgId, "", "CREATE_TIME", 1, this.pageIndex);
// extendRule(json, 'STATECHECK', 2, 0);
// extendInclude(json, 'Nav_CheckType')
// extendInclude(json, 'Nav_User')
// extendInclude(json, 'Nav_CheckTypeLevel.Nav_Enums')
if (this.keyword) {
extendRule(json, 'CHECKCONTENT', 9, this.keyword);
}
if (this.searchStartTime && this.searchStartTime > 0) {
extendRule(json, 'QUESTION_LEVEL', 1, this.searchStartTime)
}
// if (this.filterStatus !== null) {
// extendRule(json, 'Nav_CheckTypeLevel.Nav_Enums.NAME', 1, this.filterStatus)
// }
OrderPagedRISKINFO(json).then(res => {
this.total = res.TotalCount
const newRes = (res.Data || []).map(i => {
return {
...i,
title: i.CHECKCONTENT,
}
})
if (paginate) {
this.lists = this.lists.concat(newRes)
} else {
this.lists = newRes
}
})
},
showDetail(id) {
if (id === '00000000-0000-0000-0000-000000000000') {
uni.$showErrorInfo('传参有误!')
} else {
uni.navigateTo({
url: 'riskListView?ID=' + id
})
}
},
handleShowPicker(p) {
let column = []
if (p.name === 'dateRange') {
column = ['全部', '重大', 'A', 'B', 'C', 'D']
}
if (p.name === 'status') {
column = ['全部', '班组级', '车间级', '部门级', '公司级']
}
this.comPickerInfo = {
showPicker: true,
title: p.title,
name: p.name,
columns: [column]
}
},
onConfirmPicker(e) {
if (this.comPickerInfo.name === 'dateRange') {
if (e.indexs[0] === 1) {
this.searchStartTime = 10
} else if (e.indexs[0] === 2) {
this.searchStartTime = 20
} else if (e.indexs[0] === 3) {
this.searchStartTime = 30
} else if (e.indexs[0] === 4) {
this.searchStartTime = 40
} else if (e.indexs[0] === 5) {
this.searchStartTime = 50
}
if (e.indexs[0] === 0) {
this.searchStartTime = ''
this.dateFilterTxt = '问题等级'
} else {
this.dateFilterTxt = e.value[0]
}
}
if (this.comPickerInfo.name === 'status') {
if (e.indexs[0] === 0) {
// 全部
this.filterStatus = null
this.statusFilterTxt = '状态筛选'
} else {
this.statusFilterTxt = e.value[0]
this.filterStatus = e.value[0]
}
}
this.closePicker()
},
closePicker() {
this.comPickerInfo = {
showPicker: false,
columns: [],
title: '',
name: ''
}
},
},
computed: {
},
onReachBottom() {
if (this.total > 10 * this.pageIndex)
this.loadData(true)
},
watch: {
keyword(n, o) {
this.pageIndex = 0
this.keyword = n
this.loadData()
},
searchStartTime(n, o) {
this.pageIndex = 0
this.searchStartTime = n
this.loadData()
},
filterStatus(n, o) {
this.pageIndex = 0
this.filterStatus = n
this.loadData()
}
}
}
</script>
<style>
@import url("../../../../style/css/listTemplate.css");
</style>