LpRealName/pages/realName/workbench/cutToPlace/record.vue

268 lines
6.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="page">
<u-navbar class="u-navbar" title="转场记录" placeholder @leftClick="leftClick" leftIconColor="#fff" bgColor="#00337A" :titleStyle="{ color: '#FFF', fontSize: '32rpx' }"/>
<view class="view-box">
<view style="width: 96%;height: auto;padding: 10rpx auto;display: flex;align-items: center;">
<u-search shape="square" placeholder="人员姓名" v-model="keyWord" :showAction="false" bgColor="#FFF" borderColor="#ccc"></u-search>
<view class="searchBtn" @click="searchList">搜索</view>
</view>
</view>
<view style="padding-left: 40rpx;">
<text style="font-size: 24rpx;color: #5193FE;">已查询{{number}}条数据</text>
</view>
<!-- 列表 -->
<view class="list-box">
<view v-if="listData.length==0" style="width: 96%;height: 60vh;display: flex;flex-direction: column;justify-content: center;align-items: center;" >
<image src="../../../../static/realName/noData.png" style="width: 100rpx;height: 120rpx;" mode=""></image>
<view>暂无数据</view>
</view>
<u-list height="76vh" v-if="listData.length>0">
<u-list-item v-for="(item, index) in listData" :key="index">
<view class="list-item">
<view class="content-box">
<view class="item-text">
<view class="sortBox">{{index+1}}</view>
<text style="font-size: 32rpx;font-weight: bold;">{{item.name}}</text>
<text>{{item.idNumber}}</text>
</view>
</view>
<view class="content-box" style="color: red;">
<view class="item-text">
<text >原工程分包班组</text>
</view>
<view class="item-text">
<text >{{item.proName}}</text>
</view>
<view class="item-text">
<text >{{item.subName}}</text>
</view>
<view class="item-text">
<text >{{item.teamName}}</text>
</view>
</view>
<view class="content-box">
<view class="item-text">
<text >新工程分包班组</text>
</view>
<view class="item-text">
<text >{{item.proNameN}}</text>
</view>
<view class="item-text">
<text >{{item.subNameN}}</text>
</view>
<view class="item-text">
<text >{{item.teamNameN}}</text>
</view>
</view>
<view class="content-box">
<view class="item-text">
<text class="label">{{item.userName}}{{item.createTime}}操作人操作时间</text>
</view>
</view>
</view>
</u-list-item>
</u-list>
</view>
</view>
</template>
<script>
import config from '@/config'
export default {
data() {
return {
userId:uni.getStorageSync('realNameUser').userId,
keyWord:'',
listData:[],
number:0,
}
},
onLoad(option) {
this.loadmore()
},
onShow() {
},
methods: {
//搜索
searchList(){
this.listData=[]
this.number=0
this.loadmore()
},
loadmore(){
let param={
operator:this.userId,
keyWord:this.keyWord
}
console.log(param)
uni.request({
url: config.realBmwUrl+'/cutToPlace/cutToPlaceRecord',
method: 'post',
data: param,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: uni.getStorageSync('realNameToken')
},
success: res => {
console.log(res)
res = res.data;
if(res.code==200){
this.listData=res.data;
this.number=this.listData.length;
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
},
fail: err => {
console.log(err)
}
})
},
// 返回
leftClick() {
console.log('返回')
uni.navigateBack({
delta: 1 // 返回
});
},
timeFormat(dateTime = null, formatStr = 'yyyy-mm-dd') {
let date
// 若传入时间为假值,则取当前时间
if (!dateTime) {
date = new Date()
}
// 若为unix秒时间戳则转为毫秒时间戳逻辑有点奇怪但不敢改以保证历史兼容
else if (/^\d{10}$/.test(dateTime?.toString().trim())) {
date = new Date(dateTime * 1000)
}
// 若用户传入字符串格式时间戳new Date无法解析需做兼容
else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) {
date = new Date(Number(dateTime))
}
// 处理平台性差异在Safari/Webkit中new Date仅支持/作为分割符的字符串时间
// 处理 '2022-07-10 01:02:03',跳过 '2022-07-10T01:02:03'
else if (typeof dateTime === 'string' && dateTime.includes('-') && !dateTime.includes('T')) {
date = new Date(dateTime.replace(/-/g, '/'))
}
// 其他都认为符合 RFC 2822 规范
else {
date = new Date(dateTime)
}
const timeSource = {
'y': date.getFullYear().toString(), // 年
'm': (date.getMonth() + 1).toString().padStart(2, '0'), // 月
'd': date.getDate().toString().padStart(2, '0'), // 日
'h': date.getHours().toString().padStart(2, '0'), // 时
'M': date.getMinutes().toString().padStart(2, '0'), // 分
's': date.getSeconds().toString().padStart(2, '0') // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
}
for (const key in timeSource) {
const [ret] = new RegExp(`${key}+`).exec(formatStr) || []
if (ret) {
// 年可能只需展示两位
const beginIndex = key === 'y' && ret.length === 2 ? 2 : 0
formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex))
}
}
return formatStr
}
},
}
</script>
<style lang="scss">
.searchBtn{
width: 120rpx;
height:60rpx;
line-height: 60rpx;
text-align: center;
border-radius: 10rpx;
background-color: #00337A;
color: #FFF;
margin-left: 20rpx;
}
.resetBtn{
width: 120rpx;
height:60rpx;
line-height: 60rpx;
text-align: center;
border-radius: 10rpx;
background-color: #fff;
color: #000;
margin-left: 20rpx;
border: 1rpx solid #00337A;
}
.view-box{
width: 94%;
margin: 20rpx auto;
background-color: #FFF;
border-radius: 10rpx;
padding:20rpx;
}
.page {
width: 100vw;
height: 100vh;
background-color: #EFEFEF;
box-sizing: border-box;
// padding: 0 20px;
.list-box{
width: 90%;
height: auto;
// border: 1px solid #000;
margin: 0rpx auto;
.list-item{
width: 100%;
height: auto;
background-color: #fff;
border-radius: 20rpx;
margin: 20rpx 0;
.content-box{
width: 100%;
height: auto;
padding: 10rpx 0;
border-bottom: 1rpx solid #eee;
font-size: 24rpx;
.sortBox{
display: inline-block;
width: 12%;
text-align: center;
height: 60rpx;
line-height: 60rpx;
color: #FFF;
margin-right: 20rpx;
background: url('../../../../static/realName/serial.png') no-repeat;
background-size: 100% 100%;
}
.item-text{
width: 95%;
margin-left: 20rpx;
margin-top: 15rpx;
// display: flex;
align-items: center;
position: relative;
.label{
color: #999;
}
}
}
}
}
}
</style>