<template>
|
<view>
|
<u-sticky>
|
<view class="hander">
|
<view class="tab">
|
<u-tabs :list="tabList" :current="tabIndex" @click="changeTab" :inactiveStyle="{color:'#999999'}"
|
:activeStyle="{color:'#017BFC'}" :scrollable="false">
|
</u-tabs>
|
</view>
|
|
<view class="search flex j-c-s-b a-i-c">
|
<view class="tab-filter flex j-c-c a-i-c" slot="right" @click="showDateModal">
|
<text class="f-28">时间筛选</text>
|
<u-icon name="arrow-down"></u-icon>
|
</view>
|
<u-search placeholder="请输入学校名称" v-model="keyWord" :clearabled="true" :showAction="true"
|
:animation="true" @search="searchConfirm" @clear="clearConfirm"
|
@custom="searchConfirm"></u-search>
|
</view>
|
|
|
</view>
|
</u-sticky>
|
<view class="list">
|
<view class="list-item bgc-ff mb-20" v-for="item in siteList" :key="item.id" @click="pushPage(item.id)">
|
<view class="item-title flex a-i-c j-c-s-b mb-20">
|
<text class="f-32 fw">{{item.placeName}}</text>
|
<!-- <u-tag text="待审批" type="warning" plain plainFill></u-tag> -->
|
<u-tag class="u_tag" size="mini" :text="findObjValue(item.confirmFlag, tabList).name"
|
:type="findObjValue(item.confirmFlag, tabList).type" plain plainFill></u-tag>
|
<!-- <u-tag text="审核拒绝" type="error" plain plainFill></u-tag> -->
|
</view>
|
<view class="item-row flex a-i-c j-c-s-b">
|
<text class="f-28">描述</text>
|
<text class="f-28 c-66 remarkText">{{item.remark}}</text>
|
</view>
|
<view class="item-row flex a-i-c j-c-s-b f-28">
|
<text>时间</text>
|
<text class="c-66">{{item.createTime}}</text>
|
</view>
|
</view>
|
</view>
|
<u-toast ref="uToast"></u-toast>
|
<u-loadmore :status="loadingStatus" loadmoreText="开始加载" loadingText="数据加载中" nomoreText="没有更多了" line />
|
|
|
|
|
|
<date-range-modal ref="dateRane" @comfirm="handleComfirmDate" @rest="handleRestDate" />
|
</view>
|
</template>
|
|
<script>
|
import dateRangeModal from '@/components/dateRangeModal/modal.vue';
|
import {
|
getTroubleReportList
|
} from "@/api/school/school.js";
|
|
export default {
|
components: {
|
dateRangeModal
|
},
|
data() {
|
return {
|
siteList: [],
|
pagingParams: {
|
current: 1,
|
size: 10
|
},
|
tabList: [{
|
name: "待处理",
|
status: 4,
|
type: 'warning'
|
},
|
{
|
name: "已处理",
|
status: 2,
|
type: 'success'
|
}
|
|
],
|
tabIndex: 0,
|
tabStatus: 4,
|
keyWord: '',
|
loadingStatus: 'nomore',
|
clickInfo: {},
|
currentRole: {},
|
selectDate: [],
|
type: 1
|
}
|
},
|
|
|
onLoad(option) {
|
if (option.from) {
|
this.tabIndex = 1;
|
this.tabStatus = 1;
|
}
|
if (option.placeId) {
|
this.pagingParams.placeId = option.placeId
|
}
|
if (option.type) {
|
this.type = option.type;
|
uni.setNavigationBarTitle({
|
title: option.type == 1 ? "安全隐患排查" : "矛盾纠纷排查"
|
})
|
}
|
},
|
|
onShow() {
|
this.currentRole = uni.getStorageSync("activeRole")
|
this.resetParams()
|
this.getSiteList()
|
},
|
onReachBottom() {
|
this.pagingParams.current++
|
this.getSiteList()
|
},
|
|
|
methods: {
|
|
|
async getSiteList() {
|
this.$nextTick(() => {
|
this.$refs.uToast.show({
|
type: 'loading',
|
message: '正在加载',
|
duration: 9999999
|
})
|
this.loadingStatus = 'loadingmore'
|
})
|
|
const params = {
|
placeName: this.keyWord,
|
confirmFlag: this.tabStatus,
|
// isReporting: 1
|
}
|
if (this.selectDate.length) {
|
params.startTime = this.selectDate[0]
|
params.endTime = this.selectDate[1]
|
}
|
const {
|
roleName
|
} = this.currentRole
|
|
const res = await getTroubleReportList({
|
...params,
|
roleName,
|
...this.pagingParams
|
})
|
console.log(res);
|
const {
|
code,
|
data: {
|
records
|
}
|
} = res
|
if (code !== 200) {
|
uni.showToast({
|
title: '数据请求失败',
|
icon: 'error'
|
})
|
return
|
}
|
this.siteList = [...this.siteList, ...records]
|
this.$nextTick(() => {
|
this.$refs.uToast.isShow = false
|
})
|
this.loadingStatus = 'nomore'
|
},
|
changeTab(e) {
|
this.tabStatus = e.status;
|
this.resetParams()
|
this.getSiteList()
|
},
|
searchConfirm() {
|
this.resetParams()
|
this.getSiteList()
|
},
|
clearConfirm() {
|
this.keyWord = ''
|
this.resetParams()
|
this.searchConfirm()
|
},
|
|
|
showDateModal() {
|
this.$refs.dateRane.open();
|
},
|
|
|
resetParams() {
|
this.siteList = []
|
this.pagingParams.current = 1
|
},
|
findObjValue(value, obj) {
|
const res = obj.find(item => {
|
return item.status == value
|
})
|
return res
|
},
|
pushPage(id) {
|
const {
|
roleAlias
|
} = this.currentRole
|
if (roleAlias === "inhabitant") {
|
return
|
}
|
uni.navigateTo({
|
url: `troubleDetail?id=${id}`
|
})
|
|
|
// this.$u.func.globalNavigator(`/subPackage/workbench/views/examine?id=${id}&placeId=${placeId}`)
|
},
|
|
handleRestDate() {
|
this.selectDate = [];
|
this.resetParams();
|
this.getSiteList()
|
},
|
handleComfirmDate(val) {
|
this.selectDate = val;
|
this.resetParams();
|
this.getSiteList()
|
}
|
|
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
page {
|
background-color: #F5F5F5;
|
}
|
|
.hander {
|
background-color: #fff;
|
|
.tab {
|
width: 100%;
|
}
|
|
.tab-filter {
|
padding: 0 20rpx;
|
}
|
|
|
.search {
|
padding: 20rpx 30rpx;
|
}
|
}
|
|
.list {
|
margin: 20rpx 30rpx 0;
|
}
|
|
.list-item {
|
padding: 0 30rpx 20rpx;
|
border-radius: 8rpx;
|
|
.item-title {
|
padding: 30rpx 0;
|
border-bottom: 1px solid #F5F5F5;
|
}
|
|
.item-row {
|
padding: 10rpx 0;
|
|
.address {
|
width: 65%;
|
text-align: right;
|
}
|
|
.remarkText {
|
width: 200px;
|
/* 定义容器宽度 */
|
white-space: nowrap;
|
/* 确保文本在一行内显示 */
|
overflow: hidden;
|
/* 隐藏超出容器的文本 */
|
text-overflow: ellipsis;
|
/* 使用点点表示文本的溢出 */
|
text-align: right;
|
/* 文本居中对齐 */
|
}
|
}
|
}
|
</style>
|