This commit is contained in:
2025-06-19 17:33:18 +08:00
commit f8f31dc4d9
437 changed files with 103080 additions and 0 deletions
@@ -0,0 +1,11 @@
{
"usingComponents": {
"van-picker": "@vant/weapp/picker/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-popup": "@vant/weapp/popup/index",
"van-empty": "@vant/weapp/empty/index",
"van-divider": "@vant/weapp/divider/index"
},
"enablePullDownRefresh": true,
"navigationBarTitleText": "事件上报"
}
@@ -0,0 +1,135 @@
/* pages/eventReport/eventReportRecord/eventReportRecord.wxss */
.container {
min-height: 100vh;
background: #EFF1F4;
position: relative;
.search-container {
padding: 10px;
box-sizing: border-box;
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
>.select-box {
width: calc((100% - 6px) / 2);
height: 36px;
padding: 8px 10px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
font-size: 14px;
display: flex;
align-items: center;
justify-content: space-between;
white-space: nowrap;
>.val {
max-width: 80%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&.selectItem{
width: 100%;
justify-content: flex-end;
.placeholder{
color: #949CB5;
}
}
.arrow{
width: 0;
height: 0;
border-left: 13rpx solid transparent;
border-right: 13rpx solid transparent;
border-top: 15rpx solid #636B83;
margin-left: 18rpx;
}
}
}
.list-content {
.list {
width: 100%;
height: calc(100vh - 44px - 110px);
padding: 8px 0 0 0;
box-sizing: border-box;
// overflow-y: auto;
.scroll-view_H {
height: 100%;
// padding: 0 8px;
box-sizing: border-box;
}
.item {
padding: 12px 10px;
margin: 0 8px 8px;
background: #FFFFFF;
border-radius: 8px;
box-shadow: 0 0 4px 0 rgba(0,0,0,.4);
.row {
margin-bottom: 4px;
color: #2E3A4F;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: space-between;
.title {
font-size: 30rpx;
font-weight: bold;
}
.time {
color: #858CA0;
}
.type {
width: 104rpx;
height: 32rpx;
padding: 4rpx;
margin-left: 16rpx;
line-height: 32rpx;
// background: linear-gradient(270deg, #4CDBAD 0%, #2FCBAB 100%);
background: linear-gradient(90deg, #0D92FF 0%, #38B1FE 100%);
border-radius: 2px;
color: #fff;
text-align: center;
}
.type-g {
background: linear-gradient(270deg, #A1A8BB 0%, #838EAA 100%);
}
}
}
}
}
.nodata {
text-align: center;
margin: 60px;
font-size: 26px;
}
.bottom {
width: 100%;
padding: 16px 12px 30px;
background: #fff;
box-sizing: border-box;
border-radius: 8px 8px 0 0;
box-shadow: 0px -2px 12px 0px rgba(0,0,0,0.2);
position: absolute;
bottom: 0;
left: 0;
.btn-box {
width: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.btn {
width: 100%;
height: 40px;
line-height: 40px;
border-radius: 8px;
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #fff;
font-size: 30rpx;
font-weight: bold;
text-align: center;
}
}
}
}
@@ -0,0 +1,267 @@
// pages/eventReport/eventReportRecord/eventReportRecord.ts
import { getAction } from '../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
projectSelectShow: false,
projectOptions: [
{
text: '全部',
value: ''
}
],
selectProjectIndex: 0,
timeSelectShow: false,
reportTimestamp: new Date().getTime(),
reportTimeStr: '',
params: {
reportTime: '',
projectId: '',
eventTheme: '',
pageNo: 1,
pageSize: 10
} as any,
list: [],
loading: false,
isLast: false
},
pickerChange(event: any) {
console.log(event);
//下拉框切换是否展示
let fieldName: any = event.currentTarget.dataset.fieldname;
let data: any = { ...this.data };
data[fieldName] = true;
data.isLast = true;
this.setData(data);
},
hidePicker() {
this.setData({
projectSelectShow: false,
timeSelectShow: false
});
},
pickerConfirm(event: any) {
//下拉框点击确认
let { fieldname } = event.currentTarget.dataset;
let detail = event.detail;
let data: any = { ...this.data };
if (fieldname === 'reportTime') {
data.params[fieldname] =
dayjs(detail).format('YYYY-MM-DD') +
' 00:00:00,' +
dayjs(detail).format('YYYY-MM-DD') +
' 23:59:59';
data.reportTimestamp = detail;
data.reportTimeStr = dayjs(detail).format('YYYY-MM-DD');
} else if (fieldname === 'projectId') {
data.params[fieldname] = detail.value.value;
data.selectProjectIndex = detail.index;
} else {
data.params[fieldname] = detail.value.value;
// data.params[fieldvalue] = detail.value.value;
}
data.list = [];
data.params.pageNo = 1;
data.isLast = false;
this.setData(data);
this.hidePicker();
this.getList();
},
getProjectOptions() {
getAction('api/projects/list').then((res: any) => {
if (res.code == 200) {
res.result.unshift({
id: '',
projectName: '全部'
});
let arr = [] as any;
res.result.forEach((item: any) => {
arr.push({
text: item.projectName,
value: item.id
});
});
this.setData({
projectOptions: arr,
selectProjectIndex: 0
// selectProject: res.result[0]
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
});
},
toDetail(e: any) {
console.log('跳转', e.currentTarget.dataset.inf);
wx.navigateTo({
url: '../eventReportDetail/eventReportDetail',
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('eventName', { ...e.currentTarget.dataset.inf });
},
fail: e => {
console.log(e);
}
});
// // 接收传参
// const eventChannel = this.getOpenerEventChannel();
// eventChannel &&
// eventChannel.on &&
// eventChannel.on('eventName', data => {
// console.log('接收参数', data);
// this.setData({
// detailInf: data
// });
// });
},
eventReportAdd() {
wx.navigateTo({
url: '../eventReportAdd/eventReportAdd',
// success: function (res) {
// // 通过eventChannel向被打开页面传送数据
// res.eventChannel.emit('eventName', { ...e.currentTarget.dataset.inf });
// },
fail: e => {
console.log(e);
}
});
},
getList() {
console.log(this.data);
let parms = this.data.params;
wx.showLoading({
title: '加载中'
});
if (!this.data.loading) {
this.setData({
loading: true
});
}
getAction('api/event/info/list', parms).then((res: any) => {
wx.hideLoading();
this.setData({
loading: false
});
if (res.code == 200) {
let data: any = { ...this.data };
data.list = data.list.concat(res.result.records);
console.log(data);
this.setData(data);
if (data.list.length == res.result.total) {
this.setData({
isLast: true
});
}
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
});
},
lower(e: any) {
console.log(e.detail.direction == 'bottom');
if (this.data.isLast) {
wx.showToast({
title: '已经是最后一页',
icon: 'none'
});
return;
}
if (e.detail.direction == 'bottom' && !this.data.loading) {
// this.data.current += 1
let { params } = this.data;
params.pageNo = params.pageNo += 1;
this.setData({
loading: true,
params: params
});
this.getList();
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getProjectOptions();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let params = {
reportTime: '',
projectId: '',
// eventTheme: '', // 事件主题
pageSize: 10,
pageNo: 1
};
this.setData({
reportTimestamp: new Date().getTime(),
reportTimeStr: '',
list: [],
params: params,
isLast: false
});
this.getList();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let params = {
reportTime: '',
projectId: '',
// eventTheme: '', // 事件主题
pageSize: 10,
pageNo: 1
};
this.setData({
reportTimestamp: new Date().getTime(),
reportTimeStr: '',
list: [],
params: params,
isLast: false
});
this.getList();
//停止下拉刷新
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,52 @@
<!--pages/eventReport/eventReportRecord/eventReportRecord.wxml-->
<view class="container">
<view class="search-container">
<view class="select-box" data-fieldName="projectSelectShow" catch:tap="pickerChange">
<view class="val" wx:if="{{params.projectId}}">{{projectOptions[selectProjectIndex].text}}</view>
<view class="placeholder" wx:else>请选择项目</view>
<view class="arrow"></view>
</view>
<van-popup show="{{projectSelectShow}}" position="bottom" bind:close="hidePicker">
<van-picker default-index="{{selectProjectIndex}}" data-fieldname="projectId" show-toolbar columns="{{projectOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
</van-picker>
</van-popup>
<view class="select-box" data-fieldName="timeSelectShow" catch:tap="pickerChange">
<view class="val" wx:if="{{params.reportTime}}">{{reportTimeStr}}</view>
<view class="placeholder" wx:else>请选择时间</view>
<view class="arrow"></view>
</view>
<van-popup show="{{timeSelectShow}}" position="bottom" bind:close="hidePicker">
<van-datetime-picker type="date" value="{{ reportTimestamp }}" data-fieldName="reportTime" bind:cancel="hidePicker" bind:confirm="pickerConfirm" />
</van-popup>
</view>
<view class="list-content">
<view class="list">
<scroll-view class="scroll-view_H" scroll-y="true" bindscrolltolower="lower" style="width: 100%">
<view class="item" wx:for="{{list}}" wx:key="index" data-inf="{{item}}" catchtap="toDetail">
<view class="row">
<view class="title">{{item.eventTheme}}</view>
<view class="time">{{item.reportTime}}</view>
</view>
<view class="row">
<view class="val">{{item.projectId_dictText}}</view>
<view class="type type-g" wx:if="{{item.isHandle == 1}}">已处理</view>
<view class="type" wx:else="">未处理</view>
</view>
</view>
<view class="is-last" wx:if="{{isLast && list.length > 0}}">
<van-divider contentPosition="center">已加载完全部数据</van-divider>
</view>
<view class="no-data" wx:if="{{list.length == 0}}">
<van-empty description="无数据" />
</view>
</scroll-view>
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn" catch:tap="eventReportAdd">新增上报</view>
</view>
</view>
</view>