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.

474 lines
11 KiB

<template>
<view class="boxContent">
<view class="box-header">
<view class="search-wrap">
<!-- 如果使用u-search组件必须要给v-model绑定一个变量 -->
3 years ago
<u-search v-model="serachEntity.keyword" placeholder="请输入关键词" @custom="tosearch()" @search="tosearch()" height="56"
:action-style="{color: '#fff'}">
</u-search>
</view>
3 years ago
</view>
3 years ago
<view :class="mask?'list listfixed':'list'" style="padding-top: 100rpx;">
3 years ago
<u-dropdown ref="uDropdown" @open="openmask" @close="closemask" :class="mask?'':'overflowmask'">
<u-dropdown-item v-model="serachEntity.type" :title="typeStatus==''?'养护类型':typeStatus"
@change="toChangeTypeStatus" :options="typeList">
3 years ago
</u-dropdown-item>
3 years ago
<u-dropdown-item v-model="serachEntity.status" :title="proStatus==''?'状态':proStatus"
@change="toChangeStatus" :options="statusList">
3 years ago
</u-dropdown-item>
</u-dropdown>
<block v-for="(item, index) in dataList">
3 years ago
<u-card :title="item.created_at" padding="20" margin="20rpx" :border="true" :sub-title="item.statusName"
:thumb="thumb" thumb-width="36">
<view class="" slot="body" @click="todetail(item.id)">
<u-row gutter="16">
<u-col span="4">
<view class="demo-layout bg-purple">地址/排放点</view>
</u-col>
<u-col span="12">
<view class="demo-layout bg-purple-light">{{item.address}}</view>
</u-col>
</u-row>
<u-row gutter="16">
<u-col span="3">
<view class="demo-layout bg-purple">养护类型</view>
</u-col>
<u-col span="9">
<view class="demo-layout bg-purple-light">{{item.typeName}}</view>
3 years ago
</u-col>
<u-col span="3">
<view class="demo-layout bg-purple">所属片区</view>
</u-col>
<u-col span="9">
3 years ago
<view class="demo-layout bg-purple-light">{{item.area_info?item.area_info.name:""}}
</view>
3 years ago
</u-col>
<u-col span="3">
<view class="demo-layout bg-purple">所属道路</view>
</u-col>
<u-col span="9">
<view class="demo-layout bg-purple-light">{{item.road_name}}</view>
</u-col>
</u-row>
<!-- <u-row gutter="16">
<u-col span="3">
<view class="demo-layout bg-purple">描述</view>
</u-col>
<u-col span="12">
<view class="demo-layout bg-purple-light">{{item.content}}</view>
</u-col>
</u-row> -->
</view>
3 years ago
<view class="footer" slot="foot">
<block v-if="item.status==0">
3 years ago
<u-button :custom-style="editStyle" type="primary" size="medium" @click="toedit(item.id)"
:ripple="true">编辑
3 years ago
</u-button>
</block>
<block v-if="item.status!=0">
3 years ago
<u-button :custom-style="editStyle" type="primary" size="medium" @click="todetail(item.id)"
:ripple="true">查看
3 years ago
</u-button>
</block>
3 years ago
<block>
<u-button type="error" size="medium" @click="del(item.id)" :custom-style="customStyle"
:ripple="true">删除
3 years ago
</u-button>
</block>
</view>
</u-card>
</block>
3 years ago
<u-loadmore class="loadmore" :status="loadStatus" :load-text="loadText" />
<u-empty text="暂无数据" margin-top="200" v-if="dataList.length==0" mode="list"></u-empty>
</view>
</view>
</template>
<script>
export default {
data() {
return {
background: {
3 years ago
backgroundColor: '#0385e5'
},
3 years ago
serachEntity: {
keyword: "",
status: "",
type: ""
},
3 years ago
mask: false,
3 years ago
loadStatus: "loadmore",
loadText: {
loadmore: "加载更多",
nomore: "已经到底了"
},
dataList: [],
thumb: "/static/img/location.png",
3 years ago
currentPage: 0,
3 years ago
lastPage: 0,
editStyle: {
fontSize: '30rpx'
3 years ago
},
customStyle: {
marginLeft: '20px',
3 years ago
fontSize: '30rpx'
},
value1Arr: [],
keyword: "",
title: "",
3 years ago
stat: [],
3 years ago
statusId: "",
proStatus: "",
typeId: "",
typeStatus: "",
3 years ago
typeList: [{
3 years ago
label: "所有",
value: ''
}, {
value: 1,
label: "雨水管道疏挖"
},
{
value: 2,
label: "雨水管道疏通"
},
{
value: 3,
label: "汛期助排"
},
{
value: 4,
label: "污泥外运"
},
{
value: 5,
label: "出水口排查"
}
],
statusList: [{
label: "所有",
value: ''
}, {
label: "待审核",
3 years ago
value: 0
}, {
label: "已审核",
value: 1
}, {
label: "已办结",
value: 2
}, {
label: "已退回",
value: 3
}]
}
},
onReachBottom: function(e) {
3 years ago
if (this.currentPage >= this.lastPage) {
3 years ago
this.loadStatus = "nomore"
return;
}
this.loadPage(this.currentPage + 1);
},
onPullDownRefresh: function(e) {
this.loadPage(1);
},
onShow: function() {
var that = this;
},
onLoad(options) {
this.loadPage(1);
},
3 years ago
methods: {
3 years ago
openmask() {
this.mask = true
3 years ago
// this.isPullDown(false);
},
3 years ago
closemask() {
this.mask = false
3 years ago
// this.isPullDown(true);
},
tosearch() {
this.loadPage(1)
this.$refs.uDropdown.close();
3 years ago
},
toChangeStatus: function(value) {
3 years ago
for (var m of this.statusList) {
if (value == m.value) {
3 years ago
this.proStatus = m.label
}
}
3 years ago
console.log(this.proStatus)
3 years ago
this.loadPage(1);
this.$refs.uDropdown.close();
},
toChangeTypeStatus: function(value) {
3 years ago
for (var m of this.typeList) {
if (value == m.value) {
3 years ago
this.typeStatus = m.label
}
}
this.loadPage(1);
this.$refs.uDropdown.close();
},
tagClick(index) {
this.options1[index].active = !this.options1[index].active;
},
3 years ago
toedit(id) {
3 years ago
uni.navigateTo({
3 years ago
url: "../rainmaintain/rainmaintain?id=" + id
3 years ago
})
},
todetail: function(id) {
uni.navigateTo({
url: "../rainmaintaininfo/rainmaintainInfo?id=" + id
})
3 years ago
},
3 years ago
loadAllArea() {
3 years ago
},
3 years ago
loadPage: function(page) {
uni.hideKeyboard()
var that = this;
this.util.request({
bindThis: that,
api: '/api/mobile/rain-maintains/index',
customLoading: false,
data: {
page: page,
page_size: 4,
3 years ago
...that.serachEntity
},
utilSuccess: function(r) {
var res = r.data;
that.lastPage = r.last_page;
uni.stopPullDownRefresh(); // 服务器总条数 < 每页条数, 会将第一页的条数重新返回
3 years ago
if (r.total < 5) {
3 years ago
that.loadStatus = "nomore";
}
var hasNoMore = that.dataList.length < 4 && page > 1;
if (hasNoMore || res.length == 0 && page > 1) {
3 years ago
// 已加载到最后一页
that.loadStatus = "nomore";
uni.showToast({
title: '已加载到最后一页',
icon: 'none'
});
return;
}
var dataList = that.dataList;
if (page == 1) {
dataList = res;
} else {
dataList.push(...res);
}
for (var m of dataList) {
3 years ago
m.created_at = m.created_at.split("T")[0]
3 years ago
switch (m.status) {
3 years ago
case 0:
m.statusName = "待审核"
break
case 1:
m.statusName = "已审核"
break
case 2:
m.statusName = "已办结"
break
case 3:
m.statusName = "已退回"
break
case 4:
m.statusName = "缺陷办结"
break
3 years ago
3 years ago
default:
3 years ago
3 years ago
break;
}
3 years ago
switch (m.type) {
3 years ago
case 1:
m.typeName = "雨水管道疏挖"
3 years ago
m.road_name = m.circulation_info.road ? m.circulation_info.road.name :
""
3 years ago
break
case 2:
m.typeName = "雨水管道疏通"
3 years ago
m.road_name = m.circulation_info.road ? m.circulation_info.road.name :
""
3 years ago
break
case 3:
m.typeName = "汛期助排"
3 years ago
m.road_name = m.help_discharge_info.road ? m.help_discharge_info.road
.name : ""
3 years ago
break
case 4:
m.typeName = "污泥外运"
3 years ago
m.road_name = m.mire_info.road ? m.mire_info.road.name : ""
break
case 5:
m.typeName = "出水口排查"
m.road_name = m.out_water_info.road ? m.out_water_info.road.name : ""
break
3 years ago
default:
3 years ago
3 years ago
break;
}
}
console.log(dataList)
that.currentPage = page;
that.dataList = dataList;
},
utilFail: function(res) {
uni.stopPullDownRefresh();
if (page == 1) {
that.currentPage = page;
}
this.util.alert(res);
}
});
3 years ago
},
3 years ago
del(id) {
var that = this;
uni.showModal({
title: '提示',
content: '是否确定删除?',
success(res) {
if (res.confirm) {
that.util.request({
api: '/api/mobile/rain-maintains/destroy',
customLoading: false,
method: "get",
data: {
id: id
},
utilSuccess: function(r) {
uni.showToast({
icon: "none",
title: "提交成功",
complete() {
that.loadPage(1)
},
duration: 2000
})
},
utilFail: function(r) {
this.util.alert(res);
},
})
} else if (res.cancel) {
}
}
})
}
}
}
</script>
<style>
.boxContent {
background: #f3f4f6;
min-height: 100vh;
}
.footer {
display: flex;
justify-content: flex-end;
}
.box-header {
position: fixed;
/* top: 0; */
3 years ago
width: 100%;
z-index: 99;
}
.u-row {
margin: 10rpx 0;
font-size: 28rpx;
3 years ago
}
3 years ago
.u-card {
3 years ago
z-index: 1;
}
</style>
<style scoped lang="scss">
.search-wrap {
3 years ago
background: #0385e5;
padding: 20rpx;
}
3 years ago
.overflowmask {
3 years ago
overflow: hidden;
}
3 years ago
.loadmore {
padding: 24rpx !important
3 years ago
}
3 years ago
.listfixed {
3 years ago
position: fixed;
3 years ago
width: 100%;
}
3 years ago
.u-config-wrap {
padding: 30rpx;
}
.bg-purple {
font-weight: bold;
}
.slot-content {
background-color: #FFFFFF;
padding: 24rpx;
.item-box {
margin-bottom: 50rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.item {
border: 1px solid $u-type-primary;
color: $u-type-primary;
padding: 8rpx 40rpx;
border-radius: 100rpx;
margin-top: 30rpx;
}
.active {
color: #FFFFFF;
background-color: $u-type-primary;
}
}
}
3 years ago
</style>