Initial commit

This commit is contained in:
lnljyang
2025-12-30 09:44:46 +08:00
commit 82b8d21506
147 changed files with 39113 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,294 @@
<template>
<view>
<u-sticky>
<view style="background-color: #fff">
<u-subsection
mode="subsection"
:list="list"
:current="current"
@change="sectionChange"
activeColor="#7ba746"
:fontSize="30"
>
</u-subsection>
</view>
<u-search
placeholder="请输入"
v-model="keyword"
:showAction="false"
@search="searchList()"
></u-search>
</u-sticky>
<view class="list">
<view class="item" v-for="item in dataList" :key="item.id">
<view class="line" v-if="item.annualInspectionStatus == 1">
<u-badge :isDot="true" type="error"></u-badge>
<view class="text-normal" style="margin-left: 20rpx">年审中</view>
</view>
<view class="line" v-else-if="item.annualInspectionStatus == 2">
<u-badge :isDot="true" type="error"></u-badge>
<view class="text-normal" style="margin-left: 20rpx">未通过</view>
</view>
<view class="line" v-else-if="item.annualInspectionStatus == 0">
<u-badge :isDot="true" type="error"></u-badge>
<view class="text-normal" style="margin-left: 20rpx">待年审</view>
</view>
<view class="line" v-else-if="item.annualInspectionStatus == 3">
<u-badge :isDot="true" type="success"></u-badge>
<view class="text-normal" style="margin-left: 20rpx">已通过</view>
</view>
<view class="line" style="justify-content: space-between">
<view class="text-small">车牌号: {{ item.plateNumber }}</view>
</view>
<view class="line">
<view class="text-small"
>资产状态: {{ item.truckRentStatusName }}</view
>
</view>
<view class="line" style="justify-content: space-between">
<view class="text-small left"
>年审到期时间:
{{
formatDateTime(item.annualInspectionExpireDate, "minute")
}}</view
>
<view class="text-small"
>负责人: {{ item.submitterName || "--" }}</view
>
</view>
<view class="buttons">
<!--deliveryPermit为1的时候准许交车 -->
<button
@tap="goto"
:data-url="`/pageSub/annualReview/detail?id=${item.id}`"
>
编辑
</button>
<button
@tap="goto"
:data-url="`/pageSub/annualReview/detail?id=${item.id}&isRead=1`"
>
查看
</button>
</view>
</view>
<view class="no-more" v-if="noMoreData">没有更多数据了</view>
</view>
<view
clas="line"
style="margin-top: 150rpx"
v-if="!dataList || dataList.length === 0"
>
<u-empty mode="search" text="暂无数据" width="400" textSize="16">
</u-empty
></view>
<u-loading-page
bg-color="#ffffff"
:loading="loading"
color="#7ba746"
font-size="24"
></u-loading-page>
</view>
</template>
<script>
import stora from "@/utils/storage";
import { getUser } from "@/utils/auth.js";
export default {
options: {
styleIsolation: "shared", // 解除样式隔离
},
data() {
return {
current: 0,
list: ["待办", "已年审"],
queryPage: {
pageNo: 1, // 页码
pageSize: 10, //每页查询条数
total: 0, //总页数
pages: 1, //总页数
accessType: 1, // 访问类型 小程序传一
// userid: 0, //当前账号id
annualInspectionStatus: 0, // 表示待办
},
dataList: [],
pageNo: 1,
noMoreData: false,
loading: false,
keyword: "",
};
},
methods: {
// 新增的搜索方法
searchList() {
this.queryPage.plateNumber = this.keyword.trim(); // 设置车牌号条件
this.queryPage.pageNo = 1; // 重置页码为1
this.dataList = []; // 清空数据列表
this.noMoreData = false; // 重置没有更多数据的标志
this.loadmore(); // 重新加载数据
},
sectionChange(index) {
this.current = index;
this.keyword = "";
this.queryPage.plateNumber = undefined; // 清空搜索关键字
if (index == 1) {
this.queryPage.annualInspectionStatus = 3;
} else {
this.queryPage.annualInspectionStatus = 0;
}
this.loadmore();
this.getToDo();
this.queryPage.pageNo = 1;
this.dataList = [];
},
// submitEvent() {
// getToDo();
// this.current = 1;
// //提交后删除缓存
// stora.remove("fault_fromData");
// },
formatDateTime(obj) {
if (obj == null) {
return "";
}
let date = new Date(obj);
let y = 1900 + date.getYear();
let m = "0" + (date.getMonth() + 1);
let d = "0" + date.getDate();
return (
y +
"-" +
m.substring(m.length - 2, m.length) +
"-" +
d.substring(d.length - 2, d.length)
);
},
loadmore() {
this.loading = true;
this.$api.annualReview
.queryTakePageList(this.queryPage)
.then((res) => {
console.log(res);
this.queryPage.pageNo = res.current;
this.queryPage.pages = res.pages;
this.queryPage.total = res.total;
this.dataList.push(...(res.records || []));
this.loading = false;
})
.catch((errors) => {
this.loading = false;
});
},
goto(e) {
uni.navigateTo({ url: e.target.dataset.url });
},
// 获取待办数量
getToDo() {
this.$api.annualReview.getToDo().then((res) => {
console.log("数量");
console.log(res);
this.list[0] = `待办 + ${res}`; // 动态设置
});
},
},
onLoad() {
// this.getToDo();
this.userInfo = getUser() || {};
console.log(this.userInfo);
// this.queryPage.userid = this.userInfo.id;
console.log(this.queryPage.userid);
},
onPullDownRefresh() {
this.sectionChange(this.current);
uni.stopPullDownRefresh(); //刷新数据之后停止刷新效果
},
destroyed() {
//页面销毁删除掉数据缓存
stora.remove("fault_fromData");
},
onReachBottom() {
console.log("触底了");
//当前页数小于总页数
if (this.queryPage.pageNo < this.queryPage.pages) {
this.queryPage.pageNo++;
this.loadmore();
this.getToDo();
} else {
this.noMoreData = true;
console.log("没有更多数据了");
}
},
onShow() {
this.sectionChange(this.current);
},
};
</script>
<style lang="less" scoped>
/deep/ .u-badge--error {
background-color: red !important;
}
/deep/ .u-badge--success {
background-color: #4cd964 !important;
}
/deep/ .u-search {
background: #d7d7d7 !important;
padding: 20rpx 10rpx !important;
}
.list {
background: #d7d7d7;
padding: 20rpx;
.item {
background: white;
width: calc(100% - 40rpx);
padding: 20rpx;
margin-bottom: 20rpx;
position: relative;
border-radius: 15rpx;
.line {
display: flex;
align-items: center;
margin-bottom: 15rpx;
.left {
margin-right: 50rpx;
width: 300rpx;
}
.text-small {
font-size: x-small;
}
.text-normal {
font-size: small;
}
}
.buttons {
position: absolute;
top: 20rpx;
right: 20rpx;
button {
width: 130rpx;
height: 50rpx;
padding: 12rpx 0;
font-size: 26rpx;
line-height: 26rpx;
margin-bottom: 10rpx;
}
}
}
.no-more {
width: 100%;
text-align: center;
font-size: xx-small;
color: white;
}
}
</style>

1832
pageSub/failure/detail.vue Normal file

File diff suppressed because it is too large Load Diff

272
pageSub/failure/index.vue Normal file
View File

@@ -0,0 +1,272 @@
<template>
<view>
<u-sticky>
<u-button text="去上报" color="#7ba746" @click="addFailuer"></u-button>
<u-search
placeholder="请输入车牌号/上报人"
v-model="keyword"
:showAction="false"
@search="searchList()"
></u-search>
</u-sticky>
<view class="list">
<view class="item" v-for="item in dataList" :key="item.id">
<view
class="line"
v-if="item.failureStatusName == '已解决' && item.isSubmit != 0"
>
<u-badge :isDot="true" type="success"></u-badge>
<view class="text-normal" style="margin-left: 20rpx">已解决</view>
</view>
<view class="line" v-else>
<u-badge :isDot="true" type="error"></u-badge>
<view class="text-normal" style="margin-left: 20rpx">未解决</view>
</view>
<view class="line">
<view class="text-normal"
>上报人: {{ item.implementerName || "" }}</view
>
</view>
<view class="line" style="justify-content: space-between">
<view class="text-small left"
>上报时间: {{ formatDateTime(item.failureTime, "minute") }}</view
>
</view>
<view class="line" style="justify-content: space-between">
<view class="text-small left"
>解决时间: {{ formatDateTime(item.solutionTime, "minute") }}</view
>
</view>
<view class="line">
<view class="text-small"
>维修效率时长: {{ item.timeConsuming || "" }}</view
>
</view>
<view class="line">
<view class="text-small">故障来源: {{ item.faultSourceName }}</view>
</view>
<view class="line">
<view class="text-small">故障状态: {{ item.failureStatusName }}</view>
</view>
<view class="line" style="justify-content: space-between">
<view class="text-small left"
>故障类型: {{ item.typeName || item.type }}</view
>
<view class="text-small">车牌号: {{ item.plateNumber }}</view>
</view>
<view class="buttons">
<button
@tap="goto"
:data-url="`/pageSub/failure/detail?id=${item.id}`"
v-if="item.failureStatusName != '已解决' || item.isSubmit == 0"
>
编辑
</button>
<button
@tap="goto"
:data-url="`/pageSub/failure/detail?id=${item.id}&isRead=1`"
>
查看
</button>
</view>
</view>
<view class="no-more" v-if="noMoreData">没有更多数据了</view>
</view>
<u-loading-page
bg-color="#ffffff"
:loading="loading"
color="#7ba746"
font-size="24"
></u-loading-page>
</view>
</template>
<script>
import stora from "@/utils/storage";
export default {
options: {
styleIsolation: "shared", // 解除样式隔离
},
data() {
return {
keyword: "",
current: 0,
list: ["待交车", "全部"],
queryPage: {
pageNo: 1, // 页码
pageSize: 10, //每页查询条数
total: 0, //总页数
pages: -1, //总页数
keyword: "", // 新增车牌号查询条件
},
dataList: [],
pageNo: 1,
noMoreData: false,
loading: false,
};
},
methods: {
formatDateTime(obj, type = "data") {
if (obj == null) {
return "";
}
const date = new Date(obj);
if (type === "date") {
let y = 1900 + date.getYear();
let m = "0" + (date.getMonth() + 1);
let d = "0" + date.getDate();
return (
y +
"-" +
m.substring(m.length - 2, m.length) +
"-" +
d.substring(d.length - 2, d.length)
);
} else if (type === "minute") {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始
const day = String(date.getDate()).padStart(2, "0");
const hour = String(date.getHours()).padStart(2, "0");
const minute = String(date.getMinutes()).padStart(2, "0");
return `${year}-${month}-${day} ${hour}:${minute}`;
}
},
loadmore() {
this.loading = true;
this.$api.failure
.queryPageList(this.queryPage)
.then((res) => {
console.log(res);
this.queryPage.pageNo = res.current;
this.queryPage.pages = res.pages;
this.queryPage.total = res.total;
this.dataList.push(...(res.records || []));
this.loading = false;
})
.catch((errors) => {
this.loading = false;
});
},
// 新增的搜索方法
searchList() {
this.queryPage.keyword = this.keyword.trim(); // 设置车牌号条件
this.queryPage.pageNo = 1; // 重置页码为1
this.dataList = []; // 清空数据列表
this.noMoreData = false; // 重置没有更多数据的标志
this.loadmore(); // 重新加载数据
},
goto(e) {
uni.navigateTo({ url: e.target.dataset.url });
},
addFailuer() {
uni.navigateTo({ url: `/pageSub/failure/detail` });
},
},
onLoad() {},
onPullDownRefresh() {
this.queryPage.pageNo = 1;
this.dataList = [];
this.loadmore();
uni.stopPullDownRefresh(); //刷新数据之后停止刷新效果
},
onReachBottom() {
console.log("触底了");
//当前页数小于总页数
if (this.queryPage.pageNo < this.queryPage.pages) {
this.queryPage.pageNo++;
this.loadmore();
} else {
this.noMoreData = true;
console.log("没有更多数据了");
}
},
onShow() {
this.queryPage.pageNo = 1;
this.dataList = [];
this.loadmore();
},
};
</script>
<style lang="less" scoped>
/deep/ .u-search {
background: #d7d7d7 !important;
padding: 20rpx 10rpx !important;
}
// /deep/ .u-search__content__input {
// height: 50rpx !important;
// padding-top: 20rpx !important; /* 上边距 */
// padding-bottom: 20rpx !important; /* 下边距 */
// }
/deep/ .u-icon__icon {
font-size: 26rpx !important;
}
/deep/ .u-badge--error {
background-color: red !important;
}
/deep/ .u-badge--dot {
height: 20rpx !important;
width: 20rpx !important;
}
.list {
background: #d7d7d7;
padding: 0 20px 20rpx;
.item {
background: white;
width: calc(100% - 40rpx);
padding: 20rpx;
margin-bottom: 20rpx;
position: relative;
border-radius: 15rpx;
.line {
display: flex;
align-items: center;
margin-bottom: 15rpx;
.left {
margin-right: 50rpx;
width: 300rpx;
}
.text-small {
font-size: x-small;
}
.text-normal {
font-size: small;
}
}
.buttons {
position: absolute;
top: 20rpx;
right: 20rpx;
button {
width: 130rpx;
height: 50rpx;
padding: 12rpx 0;
font-size: 26rpx;
line-height: 26rpx;
margin-bottom: 10rpx;
}
}
}
.no-more {
width: 100%;
text-align: center;
font-size: xx-small;
color: white;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,348 @@
<template>
<view>
<u-sticky>
<view style="background-color: #fff">
<u-subsection
mode="subsection"
:list="list"
:current="current"
@change="sectionChange"
activeColor="#7ba746"
:fontSize="30"
>
</u-subsection>
</view>
<u-search
placeholder="请输入"
v-model="keyword"
:showAction="false"
@search="searchList()"
></u-search>
</u-sticky>
<!-- // 还车根据id获取详情
// 待费用核篡(code: 0
// 撤回(code:1
// 待提交审批(code:9
// 待审批(code:10,
// 审批史(code:20
// 待付款确认(code:30
// 审批通过(code:30,
// 审批驳回(code:40
// 待费用结算(code:60
// 已付款(code:70 -->
<view class="list">
<view class="item" v-for="item in dataList" :key="item.id">
<view class="line" v-if="item.costApprovalStatus === 20">
<u-badge :isDot="true" type="warning"></u-badge>
<view class="text-normal" style="margin-left: 10rpx">待审批</view>
</view>
<view
class="line"
v-else-if="[30, 60].includes(item.costApprovalStatus)"
>
<u-badge :isDot="true" type="success"></u-badge>
<view class="text-normal" style="margin-left: 10rpx">已通过</view>
</view>
<view class="line" v-else-if="item.costApprovalStatus == 40">
<u-badge :isDot="true" type="error"></u-badge>
<view class="text-normal" style="margin-left: 10rpx">驳回</view>
</view>
<view class="line">
<view class="text-small">车牌号: {{ item.plateNumber || "--" }}</view>
</view>
<view class="line">
<view class="text-small"
>项目名称: {{ item.projectName || "--" }}</view
>
</view>
<view class="line">
<view class="text-small"
>还车时间: {{ formatDateTime(item.returnDate) }}</view
>
</view>
<view
class="line"
v-if="item.approvalName"
style="justify-content: flex-end"
>
<view class="text-small right"
>当前审批人: {{ item.approvalName }}</view
>
</view>
<view class="buttons">
<!-- 仅待运维备车的数据才显示编辑按钮 v-if="[0, 2].includes(item.preparationStatus)" -->
<button
@tap="goto"
v-if="item.canApprove"
:data-url="`/pageSub/returnCarCost/detail?id=${item.id}&returnId=${item.returnId}`"
>
审批
</button>
<button
@tap="goto"
v-if="disbursement && item.costApprovalStatus === 60"
:data-url="`/pageSub/returnCarCost/detail?id=${item.id}&returnId=${item.returnId}&isCoster=1`"
>
费用结算
</button>
<button
@tap="showModal(item.returnId)"
v-if="paymentConfirmBtn && item.costApprovalStatus === 30"
>
付款确认
</button>
<button
v-if="costView"
@tap="goto"
:data-url="`/pageSub/returnCarCost/detail?id=${
item.id
}&isRead=1&returnId=${item.returnId}&isCoster=${
disbursement ? 1 : 0
}`"
>
查看
</button>
</view>
</view>
<view class="no-more" v-if="noMoreData">没有更多数据了</view>
</view>
<view
clas="line"
style="margin-top: 150rpx"
v-if="!dataList || dataList.length === 0"
>
<u-empty mode="search" text="暂无数据" width="400" textSize="16">
</u-empty
></view>
<u-loading-page
bg-color="#ffffff"
:loading="loading"
color="#7ba746"
font-size="24"
></u-loading-page>
</view>
</template>
<script>
import { checkButtonPermission } from "@/utils/permission.js";
export default {
options: {
styleIsolation: "shared", // 解除样式隔离
},
data() {
return {
current: 0,
list: ["待审批", "审批通过"],
queryPage: {
pageNo: 1, // 页码
pageSize: 10, //每页查询条数
total: 0, //总页数
pages: -1, //总页数
},
dataList: [],
pageNo: 1,
noMoreData: false,
loading: false,
keyword: "",
pageCode: "returnCarCost",
};
},
computed: {
//业务审批
flowAudit: function () {
return checkButtonPermission("flowAudit", this.pageCode);
},
//查看
costView: function () {
return checkButtonPermission("costView", this.pageCode);
},
disbursement: function () {
return checkButtonPermission("disbursementSettlement", this.pageCode);
},
paymentConfirmBtn: function () {
return checkButtonPermission("paymentConfirm", this.pageCode);
},
},
methods: {
// 新增的搜索方法
searchList() {
this.queryPage.plateNumber = this.keyword.trim(); // 设置车牌号条件
this.queryPage.pageNo = 1; // 重置页码为1
this.dataList = []; // 清空数据列表
this.noMoreData = false; // 重置没有更多数据的标志
this.loadmore(); // 重新加载数据
},
sectionChange(index) {
this.current = index;
this.queryPage.plateNumber = ""; // 清空搜索关键字
this.keyword = ""; // 清空搜索关键字
if (index == 1) {
// 通过
this.queryPage.costApprovalStatus = [30, 60, 70];
} else {
// 审批中
this.queryPage.costApprovalStatus = [20];
}
this.queryPage.pageNo = 1;
this.dataList = [];
this.loadmore();
},
formatDateTime(obj) {
if (obj == null) {
return "";
}
let date = new Date(obj);
let y = 1900 + date.getYear();
let m = "0" + (date.getMonth() + 1);
let d = "0" + date.getDate();
return (
y +
"-" +
m.substring(m.length - 2, m.length) +
"-" +
d.substring(d.length - 2, d.length)
);
},
loadmore() {
this.loading = true;
this.$api.returnCost
.queryPageList(this.queryPage)
.then((res) => {
this.queryPage.pageNo = res.data.current;
this.queryPage.pages = res.data.pages;
this.queryPage.total = res.data.total;
this.dataList.push(...(res.data.records || []));
this.loading = false;
})
.catch((errors) => {
this.loading = false;
});
},
showModal(id) {
uni.showModal({
title: "确认提示",
content: "确认已于钉钉提交付款申请?",
success: (res) => {
if (res.confirm) {
this.$api.returnCost
.paymentConfirm({
id: id,
status: 1,
})
.then((res) => {
console.log(res);
this.sectionChange(this.current);
});
} else {
console.log("用户点击取消");
}
},
});
},
goto(e) {
uni.navigateTo({ url: e.target.dataset.url });
},
},
onLoad() {},
onPullDownRefresh() {
this.sectionChange(this.current);
uni.stopPullDownRefresh(); //刷新数据之后停止刷新效果
},
onReachBottom() {
console.log("触底了");
//当前页数小于总页数
if (this.queryPage.pageNo < this.queryPage.pages) {
this.queryPage.pageNo++;
this.loadmore();
} else {
this.noMoreData = true;
console.log("没有更多数据了");
}
},
onShow() {
this.sectionChange(this.current);
},
};
</script>
<style lang="less" scoped>
/deep/ .u-badge--error {
background-color: red !important;
}
/deep/ .u-badge--success {
background-color: #4cd964 !important;
}
/deep/ .u-badge--dot {
height: 20rpx !important;
width: 20rpx !important;
}
/deep/ .u-search {
background: #d7d7d7 !important;
padding: 20rpx 10rpx !important;
}
// /deep/ .u-search__content__input {
// height: 50rpx !important;
// padding-top: 20rpx !important; /* 上边距 */
// padding-bottom: 20rpx !important; /* 下边距 */
// }
.list {
background: #d7d7d7;
padding: 0 20px 20rpx;
.item {
background: white;
width: calc(100% - 40rpx);
padding: 20rpx;
margin-bottom: 20rpx;
position: relative;
border-radius: 15rpx;
.line {
display: flex;
align-items: center;
margin-bottom: 15rpx;
.left {
margin-right: 50rpx;
width: 300rpx;
}
.text-small {
font-size: x-small;
}
.text-normal {
font-size: small;
}
}
.buttons {
position: absolute;
top: 20rpx;
right: 20rpx;
button {
width: 130rpx;
height: 50rpx;
padding: 12rpx 0;
font-size: 26rpx;
line-height: 26rpx;
margin-bottom: 10rpx;
}
}
}
.no-more {
width: 100%;
text-align: center;
font-size: xx-small;
color: white;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,287 @@
<template>
<view>
<u-sticky>
<view style="background-color: #fff">
<u-subsection
mode="subsection"
:list="list"
:current="current"
@change="sectionChange"
activeColor="#7ba746"
:fontSize="30"
>
</u-subsection>
</view>
<u-search
placeholder="请输入"
v-model="keyword"
:showAction="false"
@search="searchList()"
></u-search>
</u-sticky>
<view class="list">
<view class="item" v-for="item in dataList" :key="item.id">
<view class="line" v-if="item.preparationStatus === 0">
<u-badge :isDot="true" type="warning"></u-badge>
<view class="text-normal" style="margin-left: 10rpx">未整备</view>
</view>
<view class="line" v-else-if="item.preparationStatus == 2">
<u-badge :isDot="true" type="error"></u-badge>
<view class="text-normal" style="margin-left: 10rpx">整备过期</view>
</view>
<view class="line" v-else-if="item.preparationStatus == 1">
<u-badge :isDot="true" type="success"></u-badge>
<view class="text-normal" style="margin-left: 10rpx">已整备</view>
</view>
<view class="line">
<!-- <u-badge
:isDot="true"
type="warning"
v-if="item.preparationStatus === 0"
></u-badge>
<u-badge
:isDot="true"
type="error"
v-if="item.preparationStatus === 2"
></u-badge>
<u-badge
:isDot="true"
type="success"
v-if="item.preparationStatus === 1"
></u-badge> -->
<view class="text-small">品牌: {{ item.brandName }}</view>
</view>
<view class="line">
<view class="text-small">车型: {{ item.modelName }}</view>
</view>
<view class="line">
<view class="text-small">停车场: {{ item.parkingName }}</view>
</view>
<view class="line">
<view class="text-small"
>整备类型: {{ item.preparationTypeName }}</view
>
</view>
<view class="line">
<view class="text-small"
>备车完成时间:
{{ formatDateTime(item.preparationCompletionTime) }}</view
>
</view>
<view class="line" style="justify-content: space-between">
<view class="text-small left"
>下次整备时间: {{ formatDateTime(item.nextPreparationDate) }}</view
>
<view class="text-small">车牌号: {{ item.plateNumber }}</view>
</view>
<view class="buttons">
<!-- 仅待运维备车的数据才显示编辑按钮 v-if="[0, 2].includes(item.preparationStatus)" -->
<button
@tap="goto"
:data-url="`/pageSub/truckPreparation/detail?id=${item.id}`"
>
备车
</button>
<button
@tap="goto"
:data-url="`/pageSub/truckPreparation/detail?id=${item.id}&isRead=1`"
>
查看
</button>
</view>
</view>
<view class="no-more" v-if="noMoreData">没有更多数据了</view>
</view>
<u-loading-page
bg-color="#ffffff"
:loading="loading"
color="#7ba746"
font-size="24"
></u-loading-page>
</view>
</template>
<script>
export default {
options: {
styleIsolation: "shared", // 解除样式隔离
},
data() {
return {
current: 0,
list: ["未整备", "已整备"],
queryPage: {
pageNo: 1, // 页码
pageSize: 10, //每页查询条数
total: 0, //总页数
pages: -1, //总页数
preparationStatus: [0, 2], // 整备状态, 0表示未整备, 1整备完成2表示整备过期
},
dataList: [],
pageNo: 1,
noMoreData: false,
loading: false,
keyword: "",
};
},
methods: {
// 新增的搜索方法
searchList() {
this.queryPage.plateNumber = this.keyword.trim(); // 设置车牌号条件
this.queryPage.pageNo = 1; // 重置页码为1
this.dataList = []; // 清空数据列表
this.noMoreData = false; // 重置没有更多数据的标志
this.loadmore(); // 重新加载数据
},
sectionChange(index) {
this.current = index;
this.queryPage.plateNumber = undefined; // 清空搜索关键字
if (index == 1) {
// 显示已整备
this.queryPage.preparationStatus = [1];
} else {
// 显示未整备
this.queryPage.preparationStatus = [0, 2];
}
this.queryPage.pageNo = 1;
this.dataList = [];
this.loadmore();
},
formatDateTime(obj) {
if (obj == null) {
return "";
}
let date = new Date(obj);
let y = 1900 + date.getYear();
let m = "0" + (date.getMonth() + 1);
let d = "0" + date.getDate();
return (
y +
"-" +
m.substring(m.length - 2, m.length) +
"-" +
d.substring(d.length - 2, d.length)
);
},
loadmore() {
this.loading = true;
this.$api.truckPreparation
.queryPageList(this.queryPage)
.then((res) => {
this.queryPage.pageNo = res.data.current;
this.queryPage.pages = res.data.pages;
this.queryPage.total = res.data.total;
this.dataList.push(...(res.data.records || []));
this.loading = false;
})
.catch((errors) => {
this.loading = false;
});
},
goto(e) {
uni.navigateTo({ url: e.target.dataset.url });
},
},
onLoad() {},
onPullDownRefresh() {
this.sectionChange(this.current);
uni.stopPullDownRefresh(); //刷新数据之后停止刷新效果
},
onReachBottom() {
console.log("触底了");
//当前页数小于总页数
if (this.queryPage.pageNo < this.queryPage.pages) {
this.queryPage.pageNo++;
this.loadmore();
} else {
this.noMoreData = true;
console.log("没有更多数据了");
}
},
onShow() {
this.sectionChange(this.current);
},
};
</script>
<style lang="less" scoped>
/deep/ .u-badge--error {
background-color: red !important;
}
/deep/ .u-badge--success {
background-color: #4cd964 !important;
}
/deep/ .u-badge--dot {
height: 20rpx !important;
width: 20rpx !important;
}
/deep/ .u-search {
background: #d7d7d7 !important;
padding: 20rpx 10rpx !important;
}
// /deep/ .u-search__content__input {
// height: 50rpx !important;
// padding-top: 20rpx !important; /* 上边距 */
// padding-bottom: 20rpx !important; /* 下边距 */
// }
.list {
background: #d7d7d7;
padding: 0 20px 20rpx;
.item {
background: white;
width: calc(100% - 40rpx);
padding: 20rpx;
margin-bottom: 20rpx;
position: relative;
border-radius: 15rpx;
.line {
display: flex;
align-items: center;
margin-bottom: 15rpx;
.left {
margin-right: 50rpx;
width: 300rpx;
}
.text-small {
font-size: x-small;
}
.text-normal {
font-size: small;
}
}
.buttons {
position: absolute;
top: 20rpx;
right: 20rpx;
button {
width: 130rpx;
height: 50rpx;
padding: 12rpx 0;
font-size: 26rpx;
line-height: 26rpx;
margin-bottom: 10rpx;
}
}
}
.no-more {
width: 100%;
text-align: center;
font-size: xx-small;
color: white;
}
}
</style>