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.

534 lines
12 KiB

<template>
<view id="page">
<view class="Width100 Box BorderBox">
<view class="Content BorderBox Width100">
<top-title :is-show-left="false" :title="'农三轮'" :rightWidth='60' class="custom_bg">
<template slot="right">
<image :src="$.imgSrc + '/mine/plus.png'" mode="aspectFit"
@click="$.open('/pages/investigation/detail')" class="InlineBlock imgIcon"></image>
</template>
</top-title>
</view>
<view class="query-form">
<view class="search-box">
<u-search placeholder="请输入名称" v-model="searchValue" actionText="" :showAction="false"
@search="handleSearch" @clear="handleSearch"></u-search>
</view>
<view class="tab">
<view v-for="tabItem in tabList" :key="tabItem.active" :class="{
'tab-item': true,
'active': tabItem.active == approve
}" @click="handleTabChange(tabItem.active)">
<text>{{tabItem.name}}</text>
</view>
</view>
</view>
<view class="Content MarginAuto BorderBox">
<dateSearch :tabList="approve == 1? tabTypeList1:tabTypeList2" :tabActive="classification"
:startDate.sync="startDate" :endDate.sync="endDate" @handleSearch="handleSearch"
@tabChange="queryTypeChange" />
<no-data v-if="!list.length" />
<view v-else class="List Width100 BorderBox">
<view class="Unit FontBold BorderBox Width100 MarginT_30rpx BG_FFFFFF" v-for="item in list"
:key='item.id' @click='handleClick(item)' v-if="approve == 1">
<image class="itemImg" :src="item.drivingImg ||require('./defaultImg.png')" mode="widthFix">
</image>
<view class="right">
<view class="title carNumber">{{ item.vehicleLicense }}</view>
<text class="title">{{ item.driverName }}</text>
<view class="type">
<text>{{ vehicleTypeConvert(item.vehicleType) }}</text>
<text style="margin-right: 5rpx;">{{ item.streetCommunity || '--' }}</text>
<text>{{ item.villageCommunity || '--' }}</text>
</view>
</view>
</view>
<view class="Unit FontBold BorderBox Width100 MarginT_30rpx BG_FFFFFF" v-for="item in list"
:key='item.warningId' v-if="approve == 2" @click='handleWarningClick(item)'>
<image class="itemImg" :src="item.drivingImg ||require('./defaultImg.png')" mode="widthFix">
</image>
<view class="right">
<view class="title carNumber">{{ item.vehicleLicense }}</view>
<text class="title">{{ item.illegalActivities }}</text>
<view class="type" style="display: flex;justify-content: space-between;">
<text>{{ item.driverName || '--' }}</text>
<text>{{ item.warningTimeFormat || '--' }}</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="loadmorestatus" v-show="!isEmpty" />
</view>
</view>
<Tabbar name="农三轮" v-if="tabbarShow"></Tabbar>
</view>
</template>
<script>
import NoData from "../../components/no-data.vue";
import TopTitle from "../../components/top-title";
import tabFun from '@/libs/function/tabbar.js'
import Tabbar from "../../components/tabbar.vue";
import dateSearch from "./date-search.vue";
export default {
// 组件
components: {
NoData,
TopTitle,
Tabbar,
dateSearch
},
data() {
return {
// 公用的js
list: [],
isEmpty: false,
isMore: true,
pageNum: 1,
pageSize: 10,
searchValue: '',
classification: '0',
approve: '1',
status: '60',
startDate: '',
endDate: '',
tabbarShow: true,
tabList: [{
name: '信息登记',
active: '1',
},
{
name: '预警处理',
active: '2',
},
],
tabTypeList1: [{
name: '全部',
active: '0',
num: 0,
},
{
name: '已补录',
active: '1',
num: 0,
},
{
name: '未补录',
active: '2',
num: 0,
},
],
tabTypeList2: [],
loadmorestatus: 'loading',
enumList: {}
}
},
// 页面加载
onLoad(e) {
this.$request
.globalRequest(
"/hiddenDanger/tricycle/getTricycleInfoEnumType",
"GET"
).then(res => {
this.enumList = res.result
})
if (this.$.getData('userInfo').role.some(i => i == '中队民警农三轮')) {
this.tabTypeList2 = [{
name: '未处理',
active: '0',
num: 0,
},
{
name: '已分配',
active: '1',
num: 0,
},
{
name: '已完成',
active: '2',
num: 0,
},
]
} else if (this.$.getData('userInfo').role.some(i => i == '村干部农三轮')) {
this.tabTypeList2 = [{
name: '未处理',
active: '0',
num: 0,
},
{
name: '已完成',
active: '2',
num: 0,
},
]
}
},
onShow() {
const approve = uni.getStorageSync('MySPtabIndex')
if (approve) {
this.approve = Number(approve)
uni.setStorageSync('MySPtabIndex', '')
}
uni.hideTabBar() //隐藏官方的tabBar
this.pageNum = 1
this.list = [];
this.getList({})
// tabFun.tabbar()
// this.tabbarShow = false
// this.$nextTick(() => {
// this.tabbarShow = true
// })
},
// 计算属性
computed: {},
// 方法
methods: {
//车辆种类转换
vehicleTypeConvert(vehicleType) {
if (vehicleType) {
return this.enumList.vehicleTypeEnum.find(i => i.enumvalue === vehicleType)?.enumname
} else {
'--'
}
},
handleSearch(keyWord) {
this.pageNum = 1
this.list = []
this.getList({
keyWord
})
},
queryTypeChange(tabKey) {
if (this.classification != tabKey) {
this.classification = tabKey
this.pageNum = 1
this.list = []
this.getList({
tabKey
})
}
},
handleTabChange(tabKey) {
if (this.approve != tabKey) {
this.classification = '0'
this.approve = tabKey
this.pageNum = 1
this.list = []
this.getList({})
}
},
getQueryStr(query) {
let myQuery = {
...query
}
if (myQuery.approve == 2) {
myQuery.startTime = this.startDate
myQuery.endTime = this.endDate
}
return Object.entries(myQuery).reduce((str, keyValue, index, self) => {
const [key, value] = keyValue
str += `${key}=${value}${index !== self.length - 1 ? '&' : ''}`
return str
}, '')
},
getList({
tabKey,
keyWord
}) {
this.loadmorestatus = 'loading'
this.isMore = true
//信息登记列表
if (this.approve == 1) {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleList`, {
nuserId: this.$.getData('token'),
status: tabKey || this.classification,
search: keyWord || '',
pageNum: this.pageNum,
pageSize: this.pageSize,
}, 'get').then(res => {
this.loadmorestatus = 'loadmore'
if (res.code === 200) {
if (res.result.total === 0) {
this.isEmpty = true;
} else {
this.isEmpty = false;
this.list.push(...res.result.list)
}
if (this.list.length >= res.result.total) {
this.loadmorestatus = 'nomore'
this.isMore = false
}
} else {
this.$.toast(res.message)
}
}).catch((err) => {
this.loadmorestatus = 'nomore'
uni.stopPullDownRefresh();
})
//查询各状态数量
this.tabTypeList1.map(i => {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleList`, {
nuserId: this.$.getData('token'),
status: i.active,
search: keyWord || ''
}, 'get').then(res => {
i.num = res.result.total
})
})
} else if (this.approve == 2) {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleWarningList`, {
nuserId: this.$.getData('token'),
status: tabKey || this.classification,
search: keyWord || '',
pageNum: this.pageNum,
pageSize: this.pageSize,
}, 'get').then(res => {
this.loadmorestatus = 'loadmore'
if (res.code === 200) {
if (res.result.total === 0) {
this.isEmpty = true;
} else {
this.isEmpty = false;
this.list.push(...res.result.list)
}
if (this.list.length >= res.result.total) {
this.loadmorestatus = 'nomore'
this.isMore = false
}
} else {
this.$.toast(res.message)
}
}).catch((err) => {
this.loadmorestatus = 'nomore'
uni.stopPullDownRefresh();
})
//查询各状态数量
this.tabTypeList2.map(i => {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleWarningList`, {
nuserId: this.$.getData('token'),
status: i.active,
search: keyWord || ''
}, 'get').then(res => {
i.num = res.result.total
})
})
}
},
handleClick(row) {
this.$.open("/pages/investigation/detail" + "?id=" + row.id);
},
handleWarningClick(row) {
this.$.open("/pages/investigation/warningDetail" + "?warningId=" + row.warningId+ "&state=" + this.classification);
},
// 跳转页面
skipPage(even) {
// this.$.open(even)
},
},
onReady() {},
// 页面卸载
onUnload() {
},
// 触发下拉刷新
onPullDownRefresh() {
this.pageNum = 1
this.list = [];
this.getList({})
},
// 页面上拉触底事件的处理函数
onReachBottom() {
if (this.isMore) {
this.pageNum++
this.getList({})
}
},
}
</script>
<style>
</style>
<style lang="scss" scoped>
page {
background: #F6F8FA;
}
.imgIcon {
width: 40rpx;
height: 100%;
}
.imgIcon:nth-of-type(2) {
margin-left: 40rpx;
}
.img {
width: 40rpx;
height: 40rpx;
margin-left: 30rpx;
}
.trapezoidal {
position: relative;
display: inline-block;
min-width: 2em;
text-align: center;
padding: 3rpx 20rpx 3rpx 18rpx;
}
.trapezoidal::before,
.trapezoidal::after {
content: '';
position: absolute;
top: 0;
left: 0%;
width: 100%;
height: 100%;
border-radius: 0rpx 0 0 0;
background: #FF1111;
z-index: -1;
transform-origin: bottom;
transform: skew(18deg);
border: 0rpx solid #333;
box-sizing: border-box;
}
.trapezoidal::after {
left: auto;
right: 0;
transform: skew(-0deg);
border-radius: 0 0rpx 0 0;
background-color: #FF1111;
border-left: 0 none;
}
.query-form {
font-size: 16px;
height: 91px;
background: #ffffff;
box-shadow: 3px 0px 10px #ccc;
color: #666666;
position: sticky;
// top: var(--status-bar-height + 88rpx);
top: calc(var(--status-bar-height) + 88rpx);
z-index: 10;
.tab {
display: flex;
align-items: center;
justify-content: space-around;
.tab-item {
position: relative;
height: 41px;
line-height: 41px;
padding: 0 30rpx 0 30rpx;
border-bottom: 3px solid #fff;
display: flex;
align-items: center;
&.active {
color: rgb(60, 109, 195);
border-color: rgb(60, 109, 195);
}
.number {
font-weight: bold;
font-size: 18px;
margin-left: 10rpx;
}
}
}
.search-box {
padding: 10px 10px 3px;
}
}
.query-form2 {
height: 146px;
.date-content {
display: flex;
align-items: center;
padding: 15px 10px;
justify-content: space-between;
.date-item {
display: flex;
align-items: center;
&-label {
margin-right: 10px;
}
&-value {
width: 185rpx;
text-align: right;
}
}
}
}
.Box {
padding-top: var(--status-bar-height);
.Content {
width: calc(100% - 48rpx);
padding-bottom: 88rpx;
}
.Unit {
padding: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
box-shadow: 1px 1px 3px #ccc;
.trapezoidal {
position: absolute;
top: 0px;
right: 0px;
color: #ffffff;
font-size: 14px;
font-weight: normal;
z-index: 1;
}
.itemImg {
max-width: 132rpx;
max-height: 116rpx;
}
.right {
flex: 1;
padding-left: 30rpx;
.title {
font-size: 16px;
}
.carNumber {
width: 250rpx;
float: left;
}
.type {
font-size: 14px;
color: #666;
font-weight: normal;
text {
margin-right: 20rpx;
}
}
}
}
}
</style>