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,10 @@
{
"usingComponents": {
"g-upload": "/components/uploadPic/uploadPic",
"van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-search": "@vant/weapp/search/index"
},
"navigationBarTitleText": "新增保养"
}
@@ -0,0 +1,380 @@
.container {
height: 100vh;
padding-top: 2px;
box-sizing: border-box;
background: #EFF1F4;
position: relative;
.row {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
.label {
color: #858CA0;
font-size: 14px;
}
.val {
color: #2E3A4F;
font-size: 14px;
}
}
.item-container {
height: calc(100vh - 72px);
max-height: calc(100vh - 72px);
overflow-y: auto;
// background-color: #bfa;
.item {
padding: 12px 10px;
background: #fff;
position: relative;
&:not(:last-child) {
margin-bottom: 8px;
}
.require {
&::after {
content: '*';
width: 6px;
height: 100%;
color: red;
margin-left: 8px;
display: inline-block;
}
}
.title {
font-size: 14px;
font-weight: bold;
color: #333F53;
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
width: 4px;
height: 22px;
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
border-radius: 2px;
margin-right: 8px;
}
}
.car-info {
width: calc(100% - 16px);
background: #ECEFF5;
border-radius: 4px;
padding: 8px 8px 4px;
margin-top: 8px;
.paroject-select {
display: flex;
justify-content: space-between;
.select-row {
width: calc(50% - 4px);
height: 36px;
padding: 8px 10px;
margin-bottom: 8px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
background-color: #fff;
&::before {
content: '*';
width: 6px;
height: 100%;
color: red;
margin-right: 8px;
display: inline-block;
}
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 38px;
box-sizing: border-box;
border-radius: 4px;
font-size: 14px;
display: flex;
align-items: center;
}
.picker::after {
content: '';
width: 0;
height: 0;
border-top: 6px solid #636B83;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid transparent;
position: absolute;
top: 50%;
right: 14px;
transform: translateY(-2px);
}
}
}
}
}
.classify-select {
width: 100%;
display: flex;
flex-wrap: wrap;
.classify-button {
width: 30%;
height: 36px;
margin-right: 8px;
margin-top: 8px;
border-radius: 4px;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
}
.classify-button-select {
background: #E9F2FF;
border: 1px solid #24A2FE;
}
.classify-button-notSelect {
background: #FFFFFF;
border: 1px solid #E6EAF2;
}
}
.weui-input {
border-radius: 8px;
border: 1px solid #E6EAF2;
width: calc(100% - 16px);
height: 83px;
padding: 8px;
margin-top: 8px;
}
}
}
.bottom {
width: 100%;
padding: 10px 8px 14px;
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;
.row {
width: 100%;
height: 36px;
padding: 8px 10px;
margin-bottom: 8px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 20px;
height: 20px;
margin-right: 8px;
image {
width: 100%;
height: 100%;
}
}
input {
flex: 1;
font-size: 14px;
}
}
.select-row {
// width: calc((100% - 6px) / 2);
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 38px;
// padding-left: 14px;
box-sizing: border-box;
// border: 1px solid #E6EAF2;
border-radius: 4px;
font-size: 14px;
display: flex;
// justify-content: space-between;
align-items: center;
}
.picker::after {
content: '';
width: 0;
height: 0;
border-top: 6px solid #636B83;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid transparent;
position: absolute;
top: 50%;
right: 14px;
transform: translateY(-2px);
}
}
}
.btn-box {
width: 100%;
display: flex;
justify-content: space-between;
.btn {
width: 100%;
height: 40px;
background-color: #FFFFFF;
line-height: 40px;
border-radius: 8px;
color: #2E3A4F;
text-align: center;
border: 1px solid #D6D6D6;
}
.apply {
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #2E3A4F;
color: #fff;
font-size: 15px;
font-weight: bold;
}
}
}
.input-content {
height: 40px;
display: flex;
justify-content: space-between;
align-items: center;
.input-label {
// width: 17%;
color: #2F3B50;
font-size: 14px;
}
.input {
margin-right: 8px;
display: flex;
align-items: center;
.icon {
width: 20px;
height: 20px;
margin-right: 8px;
image {
width: 100%;
height: 100%;
}
}
}
}
.searchBox {
position: absolute;
width: 100%;
left: 0;
top: 80rpx;
z-index: 63;
}
.arrow {
width: 0;
height: 0;
border-left: 11rpx solid transparent;
border-right: 11rpx solid transparent;
border-top: 13rpx solid #636B83;
margin-left: 18rpx;
}
.delete {
width: 12px;
height: 12px;
margin-left: 8px;
}
.requireItem {
&::before {
content: '*';
width: 6px;
height: 100%;
color: red;
margin-right: 4px;
display: inline-block;
}
}
.picker {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.upload {
padding: 12px 0;
}
.echoFile {
display: flex;
flex-wrap: wrap;
}
.photo-list {
width: 64px;
height: 64px;
margin-left: 8px;
border-radius: 4px;
position: relative;
margin-top: 8px;
image {
width: 100%;
height: 100%;
display: block;
}
.del {
width: 20px;
height: 20px;
position: absolute;
top: -10px;
right: -10px;
image {
width: 100%;
height: 100%;
display: block;
}
}
}
}
@@ -0,0 +1,548 @@
import { getAction, postAction, putAction } from '../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
upKeepObject: null as any, // 保养单数据
selectProject: null as any, // 项目所选
selectCar: null as any, // 车辆所选
projectOptions: [], // 项目数据
carOptions: [] as any, // 车辆数据
filterCarOptions: [] as any, // 过滤后的车辆数据
filterProjectOptions: [] as any, // 过滤后的项目数据
lastMileage: '', // 上次保养里程
predictMileage: '', // 预计保养里程
content: '', // 保养内容
uploadUrl: 'api/vehicles/repair/fileUpload', // 上传图片地址
attachmentList: [] as any, //附件
lastTimeShow: false, // 展示上次保养时间选择框
predictTimeShow: false, // 展示预计保养时间选择框
lastTime: '', // 上传保养时间
predictTime: '', // 预计保养时间
lastTimestamp: new Date().getTime(),
predictTimestamp: new Date().getTime(),
plateNumberShow: false, //展示车牌号选择框
projectShow: false, //展示项目选择框
plateNumberSearchVal: '', // 查找车牌号输入值
projectSearchVal: '', // 查找项目输入值
type: '', // 当前页面状态(新增/编辑)
echoFile: null as any // 回显附件
},
// 输入保养里程
getMileage(e: any) {
let { fieldname } = e.currentTarget.dataset;
let res = null as any;
e.detail.value = Number(Number(e.detail.value).toFixed(2));
if (e.detail.value > 99999999) {
res = 99999999;
wx.showToast({
title: '保养里程不能大于99999999',
icon: 'none'
});
} else if (e.detail.value < 0) {
res = 0;
wx.showToast({
title: '保养里程不能小于0',
icon: 'none'
});
} else res = e.detail.value;
if (fieldname == 'lastMileage') {
this.setData({
lastMileage: res
});
} else if (fieldname == 'predictMileage') {
this.setData({
predictMileage: res
});
}
},
// 输入保养内容
textareaInput(e: any) {
this.setData({
content: e.detail.value
});
},
// 上传图片回显
returnPic(e: any) {
let list = [] as any;
e.detail.photoList.forEach((item: any) => {
list.push(item);
});
this.setData({
attachmentList: list
});
},
// 提交申请
submit() {
// 校验必填
let checkProject, checkCar, checkTextarea;
this.data.selectProject?.projectId
? (checkProject = true)
: (checkProject = false);
this.data.selectCar?.id ? (checkCar = true) : (checkCar = false);
this.data.content ? (checkTextarea = true) : (checkTextarea = false);
if (!checkProject) {
wx.showToast({
title: '请选择所属项目',
icon: 'none'
});
return;
}
if (!checkCar) {
wx.showToast({
title: '请选择所属车辆',
icon: 'none'
});
return;
}
if (!this.data.lastTime) {
wx.showToast({
title: '请选择上次保养时间',
icon: 'none'
});
return;
}
if (this.data.lastMileage === '') {
wx.showToast({
title: '请输入上次保养里程',
icon: 'none'
});
return;
}
if (!this.data.predictTime) {
wx.showToast({
title: '请选择预计保养时间',
icon: 'none'
});
return;
}
if (this.data.predictMileage === '') {
wx.showToast({
title: '请输入预计保养里程',
icon: 'none'
});
return;
}
if (!checkTextarea) {
wx.showToast({
title: '请填写保养内容',
icon: 'none'
});
return;
}
let fileList = JSON.parse(JSON.stringify(this.data.attachmentList)) as any;
// 如何有回显的附件且未删除
if (this.data.echoFile) {
this.data.echoFile.forEach((item: any) => {
fileList.push(item);
});
}
let params = {
id: this.data.type == 'add' ? null : this.data.upKeepObject.id, //id
projectId: this.data.selectProject?.projectId, //所属项目
plateNumber: this.data.selectCar?.plateNumber, //车牌号
deliveryTime: this.data.selectCar?.deliveryTime, //交车时间
frameNumber: this.data.selectCar?.frameNumber, //车架号
vehicleBrand: this.data.selectCar?.vehicleBrand, //车辆品牌
vehicleModel: this.data.selectCar?.vehicleModel, //车辆型号
vehicleType: this.data.selectCar?.vehicleType, //车辆种类
vinCode: this.data.selectCar?.vinCode, //VIN码
engineNumber: this.data.selectCar?.engineNumber, //发动机码
lastMileage: this.data.lastMileage, //上次保养里程
lastTime: this.data.lastTime, //上次保养时间
predictMileage: this.data.predictMileage, //上次保养里程
predictTime: this.data.predictTime, //上次保养时间
content: this.data.content, //保养内容
attachmentList: fileList ? fileList : [] // 附件
};
wx.showLoading({
title: '加载中',
mask: true
});
// 新增
if (this.data.type == 'add') {
postAction('api/vehicles/upkeepPlan/add', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '提交成功',
icon: 'none'
});
wx.setStorageSync('message', {
projectName: this.data.selectProject?.projectName,
plateNumber: this.data.selectCar?.plateNumber,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
id: res.message,
auditStatus: 1
});
wx.reLaunch({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
}
// 编辑
else if (this.data.type == 'edit') {
putAction('api/vehicles/upkeepPlan/edit', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '编辑成功',
icon: 'none'
});
wx.setStorageSync('message', {
projectName: this.data.selectProject?.projectName,
plateNumber: this.data.selectCar?.plateNumber,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
id: this.data.upKeepObject.id,
auditStatus: 1
});
wx.reLaunch({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
}
},
// 获取项目数据
getProjects() {
getAction('api/vehicles/repair/queryProjects')
.then((res: any) => {
if (res.code == 200) {
let data = [] as any;
res.result.forEach((el: any) => {
el.value = el.projectId;
el.text = el.projectName;
});
data = res.result;
// 编辑情况下回显项目
let selectProject;
if (this.data.upKeepObject && this.data.type == 'edit') {
selectProject = data.find((item: any) => {
return (
item.projectId == this.data.upKeepObject.upkeepPlan.projectId
);
});
this.getCarFn(selectProject.projectId);
}
this.setData({
projectOptions: data,
filterProjectOptions: data,
selectProject: selectProject
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 展示选择框
pickerChange(event: any) {
//下拉框切换是否展示
let fieldName: any = event.currentTarget.dataset.fieldname;
let data: any = { ...this.data };
data[fieldName] = true;
this.setData(data);
},
// 隐藏展示框
hidePicker() {
this.setData({
lastTimeShow: false,
predictTimeShow: false,
plateNumberShow: false,
projectShow: false
});
},
// 选择器点击确认
pickerConfirm(event: any) {
let { fieldname } = event.currentTarget.dataset;
let detail = event.detail;
// 选择保养时间
if (fieldname == 'lastTime') {
this.setData({
lastTime: dayjs(detail).format('YYYY-MM-DD'),
lastTimestamp: detail
});
} else if (fieldname == 'predictTime') {
this.setData({
predictTime: dayjs(detail).format('YYYY-MM-DD'),
predictTimestamp: detail
});
}
// 选择车牌号
else if (fieldname == 'plateNumber') {
this.setData({
selectCar: event.detail.value
});
}
// 选择项目
else if (fieldname == 'project') {
this.setData({
selectProject: event.detail.value
});
if (event.detail.value.projectId) {
this.getCarFn(event.detail.value.projectId);
}
}
this.hidePicker();
},
// 获取车辆数据
getCarFn(projectId: any) {
getAction(
`api/vehicles/repair/queryVehicleInfoByProjectId?projectId=${projectId}`
)
.then((res: any) => {
if (res.code == 200) {
// 清空当前所选的车辆数据
this.setData({
selectCar: null
});
let data = [] as any;
res.result.forEach((el: any) => {
el.value = el.plateNumber;
el.text = el.plateNumber;
});
data = res.result;
// 编辑回显
let selectCar;
if (data && this.data.type == 'edit') {
selectCar = data.find((item: any) => {
return (
item.plateNumber ==
this.data.upKeepObject.upkeepPlan.plateNumber
);
});
}
this.setData({
carOptions: data,
filterCarOptions: data,
selectCar: selectCar
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 清空数据
resetData(event: any) {
let { fieldname } = event.currentTarget.dataset;
if (fieldname == 'lastMileage') {
this.setData({
lastMileage: ''
});
} else if (fieldname == 'predictMileage') {
this.setData({
predictMileage: ''
});
}
},
// 过滤车牌号
filterPlateNumber(event: any) {
let list = [] as any;
this.data.carOptions.forEach((item: any) => {
if (
item.plateNumber.toLowerCase().indexOf(event.detail.toLowerCase()) >= 0
) {
list.push(item);
}
});
this.setData({
filterCarOptions: list,
plateNumberSearchVal: event.detail
});
},
// 过滤项目
filterProject(event: any) {
let list = [] as any;
this.data.projectOptions.forEach((item: any) => {
if (
item.projectName.toLowerCase().indexOf(event.detail.toLowerCase()) >= 0
) {
list.push(item);
}
});
this.setData({
filterProjectOptions: list,
projectSearchVal: event.detail
});
},
getInf() {
let data = wx.getStorageSync('type');
wx.removeStorage({ key: 'type' });
if (!this.data.type) {
this.setData({
type: data.type
});
}
// 编辑时先获取保养计划数据再获取项目数据和车辆数据
if (data.info) this.getRepairObject(data.info.id);
// 新增时获取项目数据
if (data.type == 'add') this.getProjects();
let title = data.type == 'add' ? '新增保养' : '保养计划编辑';
wx.setNavigationBarTitle({
title: title
});
},
// 获取保养计划单数据
getRepairObject(id: string) {
if (id) {
getAction(`api/vehicles/upkeepPlan/getUpkeepPlanObjectById?id=${id}`)
.then((res: any) => {
if (res.code == 200) {
let data = res.result;
this.setData({
lastTime: data.upkeepPlan.lastTime,
lastMileage: data.upkeepPlan.lastMileage,
predictTime: data.upkeepPlan.predictTime,
predictMileage: data.upkeepPlan.predictMileage,
content: data.upkeepPlan.content,
echoFile: data.upkeepPlan.attachmentList, // 回显附件
upKeepObject: data
});
this.getProjects();
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.showToast({
title: err.message,
icon: 'none'
});
});
}
},
// 删除回显图片
delImg(e: any) {
let that = this;
let { index } = e.currentTarget.dataset;
let { echoFile } = this.data;
wx.showModal({
title: '提示',
content: '是否删除当前照片',
success(res) {
if (res.confirm) {
echoFile.splice(index, 1);
that.setData({
echoFile: echoFile
});
}
}
});
},
// 图片预览
showImage(event: any) {
let { index, image } = event.currentTarget.dataset;
let list = [] as any;
if (image == 'echoFile') {
this.data.echoFile.forEach((item: any) => {
list.push(item.fileUrl);
});
}
wx.previewImage({
current: list[index | 0], // 当前显示图片的http链接 默认urls[0]
urls: list // 需要预览的图片http链接列表
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
this.getInf();
// 默认保养人为当前用户
// let userInfo = wx.getStorageSync('userInfo');
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,129 @@
<view class="container">
<view class="item-container">
<view class="item" style="padding-bottom: 0;">
<view class="title">车辆信息</view>
<view class="car-info">
<view class="paroject-select">
<view class="select-row" data-fieldName="projectShow" catch:tap="pickerChange">
<view class="picker">
<view style="color: #aaa;font-size: 14px;" wx:if="{{!selectProject}}">请选择所属项目</view>
<view style="font-size: 14px;" wx:if="{{selectProject}}">{{selectProject.projectName}}</view>
<view class="arrow"></view>
</view>
</view>
<view class="select-row" data-fieldName="plateNumberShow" catch:tap="pickerChange">
<view class="picker">
<view style="color: #aaa;font-size: 14px;" wx:if="{{carOptions.length == 0}}">请选择所属项目</view>
<view style="color: #aaa;font-size: 14px;" wx:if="{{carOptions.length > 0 && !selectCar}}">请选择车牌号</view>
<view style="font-size: 14px;" wx:if="{{carOptions.length > 0 && selectCar}}">{{selectCar.plateNumber}}</view>
<view class="arrow"></view>
</view>
</view>
</view>
<van-popup show="{{projectShow}}" position="bottom" bind:close="hidePicker">
<view class="searchBox">
<van-search value="{{ projectSearchVal }}" placeholder="请输入项目名称" bind:search="filterProject" />
</view>
<van-picker data-fieldname="project" show-toolbar columns="{{filterProjectOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
</van-picker>
</van-popup>
<van-popup show="{{plateNumberShow}}" position="bottom" bind:close="hidePicker">
<view class="searchBox">
<van-search value="{{ plateNumberSearchVal }}" placeholder="请输入车牌号" bind:search="filterPlateNumber" />
</view>
<van-picker data-fieldname="plateNumber" show-toolbar columns="{{filterCarOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
</van-picker>
</van-popup>
<view class="row">
<view class="label">车架号</view>
<view class="val">{{selectCar.frameNumber ? selectCar.frameNumber : '暂无'}}</view>
</view>
<view class="row">
<view class="label">交车时间</view>
<view class="val">{{selectCar.deliveryTime ? selectCar.deliveryTime : '暂无'}}</view>
</view>
<view class="row">
<view class="label">车辆品牌</view>
<view class="val">{{selectCar.vehicleBrand_dictText ? selectCar.vehicleBrand_dictText : '暂无'}}</view>
</view>
<view class="row">
<view class="label">车辆型号</view>
<view class="val">{{selectCar.vehicleModel ? selectCar.vehicleModel : '暂无'}}</view>
</view>
<view class="row">
<view class="label">车辆种类</view>
<view class="val">{{selectCar.vehicleType_dictText ? selectCar.vehicleType_dictText : '暂无'}}</view>
</view>
<view class="row">
<view class="label">VIN码</view>
<view class="val">{{selectCar.vinCode ? selectCar.vinCode : '暂无'}}</view>
</view>
<view class="row">
<view class="label">发动机码</view>
<view class="val">{{selectCar.engineNumber ? selectCar.engineNumber : '暂无'}}</view>
</view>
</view>
<view class="input-content">
<view class="input-label requireItem">上次保养时间</view>
<view class="input" data-fieldName="lastTimeShow" catch:tap="pickerChange">
<view style="color: #aaa;font-size: 14px;" wx:if="{{!lastTime}}">请选择</view>
<view style="font-size: 14px;" wx:if="{{lastTime}}">{{lastTime}}</view>
<view class="arrow"></view>
</view>
</view>
<view class="input-content" style="border-bottom: 1px solid #E6EAF2;">
<view class="input-label requireItem">上次保养里程</view>
<view class="input">
<input type="text" placeholder="请输入" placeholder-style="color:#949CB5; font-size: 14px; font-weight: 400;text-align: right;" value="{{lastMileage}}" data-fieldname="lastMileage" bindblur="getMileage" style="font-size: 14px;text-align: right;" />
<view style="font-size: 14px;color: #636B83;margin-left: 4px;">km</view>
<image src="../../../images/icon_delete.png" mode="" class="delete" data-fieldName="lastMileage" catch:tap="resetData" />
</view>
</view>
<view class="input-content">
<view class="input-label requireItem">预计保养时间</view>
<view class="input" data-fieldName="predictTimeShow" catch:tap="pickerChange">
<view style="color: #aaa;font-size: 14px;" wx:if="{{!predictTime}}">请选择</view>
<view style="font-size: 14px;" wx:if="{{predictTime}}">{{predictTime}}</view>
<view class="arrow"></view>
</view>
</view>
<view class="input-content" style="border-bottom: 1px solid #E6EAF2;">
<view class="input-label requireItem">预计保养里程</view>
<view class="input">
<input type="text" placeholder="请输入" placeholder-style="color:#949CB5; font-size: 14px; font-weight: 400;text-align: right;" value="{{predictMileage}}" data-fieldname="predictMileage" bindblur="getMileage" style="font-size: 14px;text-align: right;" />
<view style="font-size: 14px;color: #636B83;margin-left: 4px;">km</view>
<image src="../../../images/icon_delete.png" mode="" class="delete" data-fieldName="predictMileage" catch:tap="resetData" />
</view>
</view>
<van-popup show="{{lastTimeShow}}" position="bottom" bind:close="hidePicker">
<van-datetime-picker data-fieldname="lastTime" type="date" value="{{ lastTimestamp }}" bind:cancel="hidePicker" bind:confirm="pickerConfirm" />
</van-popup>
<van-popup show="{{predictTimeShow}}" position="bottom" bind:close="hidePicker">
<van-datetime-picker data-fieldname="predictTime" type="date" value="{{ predictTimestamp }}" bind:cancel="hidePicker" bind:confirm="pickerConfirm" />
</van-popup>
</view>
<view class="item">
<view class="title require">保养内容</view>
<textarea class="weui-input" maxlength="200" placeholder="最大输入长度为200" value="{{content}}" bindblur="textareaInput" />
</view>
<view class="item">
<view class="title" style="margin-bottom: 8px;">附件(最大上传10张)</view>
<view wx:if="{{echoFile}}" class="echoFile">
<view class="photo-list" wx:for="{{echoFile}}" data-index="{{index}}" wx:key="index">
<image src="{{item.fileUrl}}" mode="" data-index="{{index}}" data-image="echoFile" catch:tap="showImage" />
<view class="del" catchtap="delImg" data-index="{{index}}">
<image src="../../../images/btn_del.png" mode="" />
</view>
</view>
</view>
<view class="upload" style="margin-left: 8px;">
<g-upload id="g-upload" maxLength="{{10 - (echoFile ? echoFile.length : 0)}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPic"></g-upload>
</view>
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn apply" catch:tap="submit">提交申请</view>
</view>
</view>
</view>
@@ -0,0 +1,8 @@
{
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-divider": "@vant/weapp/divider/index"
},
"navigationBarTitleText": "保养计划详情"
}
@@ -0,0 +1,414 @@
.container {
height: 100vh;
padding-top: 2px;
box-sizing: border-box;
background: #EFF1F4;
position: relative;
>.bg {
width: 100%;
height: 250px;
position: absolute;
top: 0;
image {
width: 100%;
height: 100%;
display: block;
}
}
.top {
margin: 8px 8px 10px;
padding: 12px 10px;
margin-bottom: 8px;
background: #fff;
border-radius: 8px;
position: relative;
.row:first-child {
margin-bottom: 8px;
}
.row {
color: #2E3A4F;
display: flex;
justify-content: space-between;
align-items: center;
.number-plate {
display: flex;
.status {
padding: 0 6px;
margin-right: 4px;
border-radius: 2px;
color: #FFFFFF;
font-size: 14px;
}
.status1 {
background: linear-gradient(90deg, #0D92FF 0%, #38B1FE 100%);
}
.status2 {
background: linear-gradient(270deg, #4CDBAD 0%, #2FCBAB 100%);
}
.status3 {
background: linear-gradient(270deg, #A1A8BB 0%, #838EAA 100%);
}
.val {
font-size: 16px;
font-weight: bold;
}
}
.project-name,
.code {
font-size: 14px;
}
.time {
font-size: 14px;
color: #858CA0;
}
.overdue {
font-size: 14px;
color: #EA4955;
margin-right: 5px;
}
}
}
.detail-container {
padding: 0px 8px 0px;
position: relative;
.tabs {
display: flex;
border-radius: 8px 8px 0 0;
overflow: hidden;
.tab {
width: 50%;
height: 40px;
line-height: 40px;
color: #959595;
font-size: 16px;
font-weight: 500;
text-align: center;
position: relative;
.bg {
width: 100%;
height: 100%;
position: absolute;
image {
width: 100%;
height: 100%;
display: block;
}
}
.value {
position: relative;
}
}
.active {
color: #4381FC;
// background-color: #FFFFFF;
}
.active::after {
content: '';
width: 26px;
height: 4px;
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
border-radius: 2px;
position: absolute;
bottom: 2px;
left: 50%;
transform: translateX(-50%);
}
}
.content-borderall {
border-radius: 8px;
}
.contentHeight1 {
max-height: calc(100vh - 72px - 272px);
}
.contentHeight2 {
max-height: calc(100vh - 72px - 182px);
}
.contentHeight3 {
max-height: calc(100vh - 72px - 170px);
}
.content {
overflow-y: auto;
border-radius: 0px 0px 8px 8px;
.info {
padding: 12px 8px;
border-radius: 0px 0px 8px 8px;
background: #fff;
}
.check-info {
margin-top: 8px;
padding: 12px 8px;
border-radius: 8px;
background: #fff;
.check-title {
color: #4381FC;
font-weight: bold;
font-size: 18px;
margin-bottom: 8px;
}
.check-one {
display: flex;
justify-content: space-between;
.margin-left8 {
margin-left: 8px;
}
}
.check-idea {
display: flex;
justify-content: space-between;
}
.label {
color: #858CA0;
font-size: 14px;
}
.val {
color: #2E3A4F;
font-size: 14px;
}
}
.row {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
// align-items: center;
.label {
color: #858CA0;
font-size: 14px;
}
.val {
color: #2E3A4F;
font-size: 14px;
}
.bold {
color: #2F3B50;
font-weight: bold;
font-size: 16px;
}
.bold-blue {
color: #4381FC;
font-weight: bold;
font-size: 20px;
}
.pic-box {
max-width: 83%;
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
.item {
width: 84px;
height: 84px;
padding-left: 8px;
margin-bottom: 8px;
display: flex;
align-items: center;
image {
width: 100%;
height: 100%;
display: block;
}
}
}
.check-title {
width: 60px;
font-size: 15px;
font-weight: bold;
color: #4381FC;
line-height: 21px;
}
}
.repairList {
max-height: 6000px;
transition: max-height 0.6s ease-in-out;
will-change: height;
overflow: hidden;
// transform-origin: top;
// transform: scaleY(1);
// transition: transform 0.3s ease-in;
}
.repairList-hide {
// transform-origin: top;
// transform: scaleY(0);
// transition: transform 0.3s ease-out;
}
.repairList-item {
padding: 8px 8px 2px 8px;
background: #ECEFF5;
border-radius: 4px;
margin-bottom: 8px;
}
}
}
.bottom {
width: 100%;
padding: 0px 8px 14px;
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;
.row {
width: 100%;
height: 36px;
padding: 8px 10px;
margin-bottom: 8px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 20px;
height: 20px;
margin-right: 8px;
image {
width: 100%;
height: 100%;
}
}
input {
flex: 1;
font-size: 14px;
}
}
.select-row {
// width: calc((100% - 6px) / 2);
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 38px;
// padding-left: 14px;
box-sizing: border-box;
// border: 1px solid #E6EAF2;
border-radius: 4px;
font-size: 14px;
display: flex;
// justify-content: space-between;
align-items: center;
}
.picker::after {
content: '';
width: 0;
height: 0;
border-top: 6px solid #636B83;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid transparent;
position: absolute;
top: 50%;
right: 14px;
transform: translateY(-2px);
}
}
}
.btn-box {
width: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.btn {
width: calc(50% - 8px);
height: 40px;
background-color: #FFFFFF;
line-height: 40px;
border-radius: 8px;
color: #2E3A4F;
text-align: center;
border: 1px solid #D6D6D6;
margin-top: 10px;
}
.btn-full {
width: 100%;
}
.apply {
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #2E3A4F;
color: #fff;
font-size: 15px;
font-weight: bold;
}
.edit {
background-color: #E4EDFF;
color: #4381FC;
font-size: 15px;
font-weight: bold;
}
.margin8{
margin-top: 8px;
}
}
}
.label-width {
width: 25%;
}
.val-width {
width: 73%;
text-align: right;
word-break: break-all;
}
}
@@ -0,0 +1,183 @@
import { getAction } from '../../../api/base';
Page({
/**
* 页面的初始数据
*/
data: {
tabActive: 0,
userInfo: {} as any, // 用户信息
upkeepObject: {} as any, // 维修单数据
info: '', // 列表查询的保养计划信息
userInf: ''
},
getInf() {
// 获取信息
let { info } = wx.getStorageSync('info');
wx.removeStorage({ key: 'info' });
let userInfo = wx.getStorageSync('userInfo');
if (info) {
this.setData({
userInfo: userInfo,
info: info
});
this.getRepairObject(info.id);
}
},
// 获取维修单数据
getRepairObject(id: string) {
if (id) {
getAction(`api/vehicles/upkeepPlan/getUpkeepPlanObjectById?id=${id}`)
.then((res: any) => {
if (res.code == 200) {
let data = res.result;
this.setData({
upkeepObject: data
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.showToast({
title: err.message,
icon: 'none'
});
});
}
},
// 变更tab
changeTab(e: any) {
this.setData({
tabActive: e.currentTarget.dataset.tab
});
},
bindCancel() {
// 作废
wx.setStorageSync('upkeepObject', this.data.upkeepObject);
wx.navigateTo({
url: '../cancel/cancel',
fail: e => {
console.log(e);
}
});
},
// 返回
goBack() {
let pageList = getCurrentPages();
if (pageList.length != 1) wx.navigateBack();
else {
if (this.data.userInfo.type == '1') {
wx.reLaunch({
url: '/pages/index/index'
});
} else if (this.data.userInfo.type == '2') {
wx.reLaunch({
url: '/pages/manufacturerIndex/manufacturerIndex'
});
} else if (this.data.userInfo.type == '3') {
wx.reLaunch({
url: '/pages/projectIndex/projectIndex'
});
} else if (this.data.userInfo.type == '4') {
wx.reLaunch({
url: '/pages/maintenanceIndex/maintenanceIndex'
});
} else {
wx.reLaunch({
url: '/pages/login/login'
});
}
}
},
bindSend() {
// 审核/审批
wx.setStorageSync('upkeepObject', this.data.upkeepObject);
wx.navigateTo({
url: '../check/check',
fail: e => {
console.log(e);
}
});
},
// 编辑
bindEdit() {
wx.setStorageSync('type', {
type: 'edit',
info: this.data.upkeepObject
});
wx.navigateTo({
url: '../UpkeepPlanApply/UpkeepPlanApply',
fail: e => {
console.log(e);
}
});
},
// 图片预览
showImage(event: any) {
let { index, image } = event.currentTarget.dataset;
let list = [] as any;
if (image == 'repairImgUrl') {
list = this.data.upkeepObject.repairInfo.repairImgUrl;
} else if (image == 'attachmentList') {
this.data.upkeepObject.upkeepPlan.attachmentList.forEach((item: any) => {
list.push(item.fileUrl);
});
}
wx.previewImage({
current: list[index | 0], // 当前显示图片的http链接 默认urls[0]
urls: list // 需要预览的图片http链接列表
});
},
getUserInf() {
this.setData({
userInf: wx.getStorageSync('userInfo')
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
this.getInf();
this.getUserInf();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,152 @@
<wxs module="module" src="../../module/module.wxs"></wxs>
<view class="container">
<view class="bg">
<image src="../../../images/bg_page_blue.png" mode="" />
</view>
<view class="top">
<view class="row">
<view class="code">{{upkeepObject.upkeepPlan.orderNo}}</view>
<view class="number-plate">
<view wx:if="{{upkeepObject.auditStatus == 1}}" class="status status2">未审批</view>
<view wx:if="{{upkeepObject.auditStatus == 2}}" class="status status2">审批通过</view>
<view wx:if="{{upkeepObject.auditStatus == 3}}" class="status status3">审批未通过</view>
<view wx:if="{{upkeepObject.auditStatus == 4}}" class="status status3">已作废</view>
<view wx:if="{{upkeepObject.auditStatus == 5}}" class="status status3">已归档</view>
<view class="val">{{upkeepObject.upkeepPlan.plateNumber}}</view>
</view>
</view>
<view class="row">
<view class="project-name">{{upkeepObject.upkeepPlan.projectId_dictText}}</view>
<view style="display: flex;">
<view class="overdue" wx:if="{{upkeepObject.overdueStatus == 2 && upkeepObject.auditStatus != 4 && upkeepObject.auditStatus != 5}}">已逾期:{{upkeepObject.overdueDay}}天</view>
<view class="time">{{upkeepObject.upkeepPlan.predictTime ? upkeepObject.upkeepPlan.predictTime : '/'}}</view>
</view>
</view>
</view>
<view class="detail-container">
<view class="tabs">
<view class="tab {{tabActive == 0 ? 'active' : ''}}" data-tab="0" catch:tap="changeTab">
<view class="bg" wx:if="{{tabActive == 0}}">
<image src="../../../images/btn_l.png" mode="" />
</view>
<view class="value">基本信息</view>
</view>
</view>
<view class="content {{(upkeepObject.auditStatus == 1 && upkeepObject.editButton == 1 && module.buttonPermissions(userInf.auth,'UpkeepPlan:cancel') && module.buttonPermissions(userInf.auth,'UpkeepPlan:leaderCheckOffer')) ? 'contentHeight2' : 'contentHeight3'}}">
<view class="info" wx:if="{{tabActive == 0}}">
<view class="row">
<view class="label label-width">车架号</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.frameNumber || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">交车时间</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.deliveryTime || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">车辆品牌</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.vehicleBrand_dictText || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">车辆型号</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.vehicleModel || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">车辆种类</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.vehicleType_dictText || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">VIN码</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.vinCode || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">发动机码</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.engineNumber || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">提单时间</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.planSaveTime || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">上次保养时间</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.lastTime || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">上次保养里程</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.lastMileage ? upkeepObject.upkeepPlan.lastMileage + '公里' : '/'}}</view>
</view>
<view class="row">
<view class="label label-width">预计保养时间</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.predictTime || '/'}}</view>
</view>
<view class="row">
<view class="label label-width">预计保养里程</view>
<view class="val val-width">{{upkeepObject.upkeepPlan.predictMileage ? upkeepObject.upkeepPlan.predictMileage + '公里' : '/'}}</view>
</view>
<view class="row">
<view class="label label-width" style="width: 20%;">保养内容</view>
<view class="val val-width" style="width: 80%;text-align: right;">{{upkeepObject.upkeepPlan.content ? upkeepObject.upkeepPlan.content : '/'}}</view>
</view>
<view class="row">
<view class="label">单据附件</view>
<view class="pic-box" wx:if="{{upkeepObject.upkeepPlan.attachmentList}}">
<view class="item" wx:for="{{upkeepObject.upkeepPlan.attachmentList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<image src="{{item.fileUrl}}" mode="" data-index="{{index}}" data-image="attachmentList" catch:tap="showImage" />
</view>
</view>
<view wx:else class="val">/</view>
</view>
</view>
<view wx:if="{{upkeepObject.cancelObject}}">
<view class="check-info">
<view class="item">
<view class="check-title" style="color: red;">已作废</view>
<view class="check-one">
<view class="check-operator">
<text class="label">操作人</text>
<text class="val margin-left8">{{upkeepObject.cancelObject.cancelPeople}}</text>
</view>
<view class="check-time">
<text class="label">作废时间</text>
<text class="val margin-left8">{{upkeepObject.cancelObject.cancelTime}}</text>
</view>
</view>
<view class="check-idea">
<text class="label">作废原因</text>
<text class="val" style="width: 81%;word-break: break-all;">{{upkeepObject.cancelObject.cancelIdea}}</text>
</view>
</view>
</view>
</view>
<view wx:if="{{upkeepObject.upkeepCheckList}}">
<view class="check-info" wx:for="{{upkeepObject.upkeepCheckList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="item">
<view class="check-title" style="color: #4381FC;" wx:if="{{item.checkResult == '1'}}">审批结果:通过</view>
<view class="check-title" style="color: red;" wx:if="{{item.checkResult == '2'}}">审批结果:不通过</view>
<view class="check-one">
<view class="check-operator">
<text class="label">审批人</text>
<text class="val margin-left8">{{item.checkPeople ? item.checkPeople : '/'}}</text>
</view>
<view class="check-time">
<text class="label">审批时间</text>
<text class="val margin-left8">{{item.checkTime ? item.checkTime : '/'}}</text>
</view>
</view>
<view class="check-idea">
<text class="label">审批意见</text>
<text class="val" style="width: 81%;word-break: break-all;">{{item.checkIdea ? item.checkIdea : '/'}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn cancel {{ (upkeepObject.auditStatus != 1 && upkeepObject.editButton != 1)? 'btn-full': ''}}" catch:tap="bindCancel" wx:if="{{module.buttonPermissions(userInf.auth,'UpkeepPlan:cancel') && upkeepObject.auditStatus != 4 && upkeepObject.auditStatus != 5 && upkeepObject.auditStatus != 2}}">作废</view>
<view class="btn apply" catch:tap="bindSend" wx:if="{{module.buttonPermissions(userInf.auth,'UpkeepPlan:leaderCheckOffer') && upkeepObject.auditStatus == 1}}">去审批</view>
<view class="btn edit {{ upkeepObject.auditStatus == 1 ? 'margin8' : ''}} {{ upkeepObject.auditStatus == 1 || userInfo.userType == 4 ? 'btn-full' : ''}}" wx:if="{{upkeepObject.editButton == 1 && module.buttonPermissions(userInf.auth,'UpkeepPlan:edit')}}" catch:tap="bindEdit">编辑</view>
<view class="btn cancel btn-full" catch:tap="goBack" wx:if="{{(upkeepObject.auditStatus == 4 || upkeepObject.auditStatus == 5 || upkeepObject.auditStatus == 2) || upkeepObject.editButton != 1 || !module.buttonPermissions(userInf.auth,'UpkeepPlan:edit') }}">返回</view>
</view>
</view>
</view>
@@ -0,0 +1,11 @@
{
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-empty": "@vant/weapp/empty/index",
"van-divider": "@vant/weapp/divider/index"
},
"enablePullDownRefresh": true,
"navigationBarTitleText": "保养计划"
}
@@ -0,0 +1,384 @@
/* pages/vehicleMaintenance/maintainRecord/maintainRecord.wxss */
page {
width: 100vw;
height: 100vh;
position: relative;
.top {
width: 100%;
background: #ffffff;
position: absolute;
top: 0;
z-index: 10;
.search-container {
padding: 10px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
>.number-plate, >.project-select {
// width: calc((100% - 6px) / 2);
width: 100%;
height: 36px;
padding: 8px 10px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
}
>.number-plate {
.icon {
width: 20px;
height: 20px;
margin-right: 8px;
image {
width: 100%;
height: 100%;
}
}
input {
flex: 1;
font-size: 14px;
}
}
>.project-select {
width: calc((100% - 6px) / 2);
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 38px;
// padding-left: 14px;
box-sizing: border-box;
// border: 1px solid #E6EAF2;
border-radius: 4px;
font-size: 14px;
display: flex;
// justify-content: space-between;
align-items: center;
}
.picker::after {
content: '';
width: 0;
height: 0;
border-top: 6px solid #636B83;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid transparent;
position: absolute;
top: 50%;
right: 14px;
transform: translateY(-2px);
}
}
}
}
.tab-container {
width: 100%;
height: 48px;
display: flex;
overflow: hidden;
.tabs {
width: calc(100% - 48px);
// overflow-x: auto;
}
.swicth {
width: 48px;
height: 48px;
box-shadow: -4px 2px 4px -2px rgba(0,0,0,.25);
// border-left: 1px solid rgba(0,0,0,.25);
position: absolute;
right: 0;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
image {
width: 20px;
height: 20px;
display: block;
}
}
}
.more-search {
padding: 8px 14px 12px;
border-radius: 0 0 8px 8px;
background: #fff;
.row {
margin-bottom: 8px;
.label {
margin: 6px;
color: #394458;
font-size: 14px;
}
.date-content {
display: flex;
align-items: center;
justify-content: space-between;
.line {
width: 10px;
height: 1px;
background: #949CB5;
}
.date {
width: calc((100% - 10px - 30px) / 2);
height: 36px;
padding: 8px 10px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 16px;
height: 16px;
margin-left: 8px;
image {
width: 100%;
height: 100%;
}
}
input {
flex: 1;
color: #2E3A4F;
font-size: 14px;
}
}
}
.select-content {
>.project-select {
width: 100%;
border: 1px solid #DBDBDB;
border-radius: 4px;
background: #ffffff;
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 36px;
padding-left: 8px;
box-sizing: border-box;
// border: 1px solid #E6EAF2;
border-radius: 4px;
font-size: 14px;
display: flex;
// justify-content: space-between;
align-items: center;
}
.picker::after {
content: '';
width: 0;
height: 0;
border-top: 6px solid #636B83;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid transparent;
position: absolute;
top: 50%;
right: 14px;
transform: translateY(-2px);
}
}
}
}
.checkbox-content {
width: 100%;
max-height: 96px;
overflow-y: auto;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
.item {
width: 48%;
height: 36px;
line-height: 36px;
margin-bottom: 8px;
background: #FFFFFF;
border-radius: 4px;
border: 1px solid #E6EAF2;
color: #2E3A4F;
font-size: 14px;
text-align: center;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.check {
background: #E9F2FF;
border: 1px solid #24A2FE;
}
}
.btn-content {
display: flex;
justify-content: space-between;
align-items: center;
.btn {
width: 48%;
height: 40px;
line-height: 40px;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 8px;
border: 1px solid #D6D6D6;
color: #2E3A4F;
font-size: 15px;
font-weight: bold;
text-align: center;
}
.btn-confirm {
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
border: 0;
color: #fff;
}
}
}
}
}
>.list {
width: 100%;
height: calc(100vh - 104px);
padding: 8px 0;
box-sizing: border-box;
background: #EFF1F4;
position: absolute;
bottom: 0;
// overflow-y: auto;
.scroll-view_H {
height: 100%;
// padding: 0 8px;
box-sizing: border-box;
}
.item {
padding: 12px 10px;
margin: 0 8px 8px;
background: #fff;
border-radius: 8px;
.row:first-child {
margin-bottom: 8px;
}
.row {
color: #2E3A4F;
display: flex;
justify-content: space-between;
align-items: center;
.number-plate {
display: flex;
.status {
padding: 0 4px;
margin: 0 4px;
border-radius: 2px;
color: #FFFFFF;
font-size: 14px;
flex-shrink: 1;
}
.status1 {
background: linear-gradient(90deg, #0D92FF 0%, #38B1FE 100%);
}
.status2 {
background: linear-gradient(270deg, #4CDBAD 0%, #2FCBAB 100%);
}
.status3 {
background: linear-gradient(270deg, #A1A8BB 0%, #838EAA 100%);
}
.val {
font-size: 16px;
font-weight: bold;
flex-shrink: 0;
display: flex;
align-items: center;
}
}
.project-name, .code {
font-size: 14px;
}
.time {
font-size: 14px;
color: #858CA0;
}
.overdue{
font-size: 14px;
color: #EA4955;
margin-right: 5px;
}
}
}
.no-data {
width: 100%;
height: 100%;
background: #fff;
}
}
}
// 时间选择器
.date-btn-box {
// background: #fff;
// border-radius: 4px 4px 0 0;
border-bottom: 2rpx solid #F1F1F1;
font-size: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.btn {
padding: 20rpx 36rpx;
color: #888888;
}
.btn-confirm{
color: #3D7EEA;
}
}
.date-title {
padding: 20rpx 36rpx;
font-size: 36rpx;
color: #888888;
border-bottom: 2rpx solid #F1F1F1;
display: flex;
justify-content: space-evenly;
align-items: center;
.line {
width: 10px;
height: 1px;
margin: 0 14px;
background: #949CB5;
}
.date {
width: calc((100% - 10px - 28px) / 2);
height: 36px;
padding: 8px 10px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 16px;
height: 16px;
margin-left: 8px;
image {
width: 100%;
height: 100%;
display: block;
}
}
input {
flex: 1;
color: #2E3A4F;
font-size: 14px;
}
}
.select {
border: 1px solid #1677FF;
input {
color: #1677FF !important;
}
}
}
.picker-box {
width: 100%;
display: flex;
justify-content: space-between;
}
@@ -0,0 +1,484 @@
// pages/vehicleMaintenance/maintainRecord/maintainRecord.ts
import { getAction } from '../../../api/base';
Page({
/**
* 页面的初始数据
*/
data: {
startDate: '',
endDate: '',
startDateTmp: '',
endDateTmp: '',
selectDate: 'startDate',
showDateSelect: false,
dateList: {
years: [2023, 2024, 2025],
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
date: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
]
},
dateValue: [0, 0, 0],
projectOptions: [
{
id: '',
projectName: '全部'
}
],
selectProjectIndex: 0,
selectProject: {} as any,
tabList: [] as any,
active: 0,
showMoreSearch: false,
plateNumberOrOrderNo: '',
// repairShopsOptions: [] as any,
auditStatus: -1,
current: 1,
isLast: false,
loading: false,
recordList: []
},
toSearch() {},
// 切换显示 更多条件
filterShow() {
this.setData({
showMoreSearch: true
});
},
filterHide() {
this.setData({
showMoreSearch: false
});
},
// 日期相关--------------
showDate(e: any) {
// selectDate
let clickDate = null as any;
if (e.currentTarget.dataset.key == 'startDate') {
clickDate = this.data.startDate;
} else {
clickDate = this.data.endDate;
}
let y = this.data.dateList.years.findIndex(
(x: number) => x == Number(clickDate.split('-')[0])
);
let m = this.data.dateList.months.findIndex(
(x: number) => x == Number(clickDate.split('-')[1])
);
let d = this.data.dateList.date.findIndex(
(x: number) => x == Number(clickDate.split('-')[2])
);
// console.log(this.data.startDate.split('-'))
console.log([y, m, d]);
this.setData({
showDateSelect: true,
selectDate: e.currentTarget.dataset.key,
startDateTmp: this.data.startDate,
endDateTmp: this.data.endDate,
dateValue: [y, m, d]
});
},
hideDate() {
this.setData({
showDateSelect: false
});
},
changeSelectDate(e: any) {
this.setData({
selectDate: e.currentTarget.dataset.key
});
},
selectDate(e: any) {
console.log(e.detail.value);
let y: string | number = this.data.dateList.years[e.detail.value[0]];
let m: string | number = this.data.dateList.months[e.detail.value[1]];
let d: string | number = this.data.dateList.date[e.detail.value[2]];
y = y < 10 ? '0' + y : y;
m = m < 10 ? '0' + m : m;
d = d < 10 ? '0' + d : d;
if (this.data.selectDate == 'startDate') {
this.setData({
startDateTmp: `${y}-${m}-${d}`
});
} else {
this.setData({
endDateTmp: `${y}-${m}-${d}`
});
}
},
changeDate(e: any) {
console.log(
new Date(this.data.startDateTmp).getTime(),
new Date(this.data.endDateTmp).getTime()
);
if (
new Date(this.data.startDateTmp).getTime() >
new Date(this.data.endDateTmp).getTime()
) {
wx.showToast({
title: '结束时间不能早于开始时间',
icon: 'none'
});
return;
}
this.setData({
startDate: this.data.startDateTmp,
endDate: this.data.endDateTmp,
showDateSelect: false
});
},
// 日期初始化
initDate() {
let year = new Date().getFullYear();
let mon =
new Date().getMonth() + 1 < 10
? '0' + (new Date().getMonth() + 1)
: new Date().getMonth() + 1;
let day =
new Date().getDate() < 10
? '0' + new Date().getDate()
: new Date().getDate();
let years = [];
for (let i = -3; i < 6; i++) {
years.push(year + i);
}
this.setData({
dateList: {
years: years,
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
date: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
]
},
dateValue: [0, 0, 0],
startDate: `${year}-${mon}-${day}`,
endDate: `${year}-${mon}-${day}`,
startDateTmp: `${year}-${mon}-${day}`,
endDateTmp: `${year}-${mon}-${day}`
});
},
// 日期相关--------------end
// 项目选择--------------
getProjectOptions() {
getAction('api/vehicles/repair/queryProjects').then((res: any) => {
if (res.code == 200) {
let tmpArr = [
{
id: '',
projectName: '全部'
}
];
// res.result.unshift();
res.result.forEach((item: any) => {
tmpArr.push({
id: item.projectId,
projectName: item.projectName
});
});
this.setData({
projectOptions: tmpArr,
selectProjectIndex: 0,
selectProject: tmpArr[0]
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
});
},
bindPickerProject(e: any) {
console.log(e);
let index = Number(e.detail.value);
this.setData({
selectProject: this.data.projectOptions[index],
selectProjectIndex: index
});
},
// 项目选择--------------end
// 维修厂选择---------
// getRepairShops() {
// getAction('api/vehicles/repair/getRepairShop').then((res: any) => {
// if (res.code == 200) {
// res.result.forEach((item: any) => {
// item.check = false;
// });
// this.setData({
// repairShopsOptions: res.result
// });
// } else {
// wx.showToast({
// title: res.message,
// icon: 'none'
// });
// }
// });
// },
// checkRepairShop(e: any) {
// let tmpArr = this.data.repairShopsOptions;
// let index = e.currentTarget.dataset.index;
// tmpArr.forEach((item: any, i: number) => {
// if (i == index) {
// item.check = true;
// } else {
// item.check = false;
// }
// });
// // tmpArr[index].check = !tmpArr[index].check
// this.setData({
// repairShopsOptions: tmpArr
// });
// },
// 维修厂选择---------
tabOnChange(e: any) {
console.log(e);
this.setData({
plateNumberOrOrderNo: this.data.plateNumberOrOrderNo,
active: e.detail.index,
auditStatus: this.data.tabList[e.detail.index].auditStatus,
current: 1,
isLast: false,
recordList: []
});
this.getList();
},
getTabList() {
// let tmpArr = this.data.repairShopsOptions.filter((x: any) => x.check);
// let repairShop = tmpArr[0] ? tmpArr[0].repairShop : '';
let parms = {
plateNumberOrOrderNo: this.data.plateNumberOrOrderNo,
projectId: this.data.selectProject.id
// repairShop: repairShop
};
getAction('api/vehicles/upkeepPlan/getUpkeepPageStatic', parms).then(
(res: any) => {
if (res.code == 200) {
this.setData({
tabList: res.result
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
}
);
},
restList() {
// let tmpArr = this.data.repairShopsOptions;
// tmpArr.forEach((item: any) => {
// item.check = false;
// });
this.initDate();
this.setData({
current: 1,
isLast: false,
recordList: [],
plateNumberOrOrderNo: '',
selectProject: this.data.projectOptions[0],
selectProjectIndex: 0
// repairShopsOptions: tmpArr
});
this.getTabList();
this.getList();
},
changePlateNumberOrOrderNo(e: any) {
console.log(e.detail.value);
this.setData({
current: 1,
isLast: false,
recordList: [],
plateNumberOrOrderNo: e.detail.value
});
this.getTabList();
this.getList();
},
getListByMoreParms() {
this.setData({
current: 1,
isLast: false,
recordList: [],
showMoreSearch: false
});
this.getTabList();
this.getList();
},
getList() {
let parms: any;
// if (this.data.showMoreSearch) {
// let tmpArr = this.data.repairShopsOptions.filter((x: any) => x.check);
// let repairShop = tmpArr[0] ? tmpArr[0].repairShop : '';
parms = {
// startTime: this.data.startDate,
// endTime: this.data.endDate,
plateNumberOrOrderNo: this.data.plateNumberOrOrderNo,
projectId: this.data.selectProject.id,
// repairShop: repairShop,
auditStatus: this.data.auditStatus,
pageNo: this.data.current,
pageSize: 10
};
// } else {
// parms = {
// plateNumberOrOrderNo: this.data.plateNumberOrOrderNo,
// auditStatus: this.data.auditStatus,
// pageNo: this.data.current,
// pageSize: 10
// };
// }
this.setData({
loading: true
});
wx.showLoading({
title: '加载中',
icon: 'none'
});
getAction('api/vehicles/upkeepPlan/list', parms)
.then((res: any) => {
this.setData({
loading: false
});
wx.hideLoading();
if (res.code == 200) {
let tmpArr = this.data.recordList.concat(res.result.records);
this.setData({
listTotal: res.result.total,
recordList: tmpArr
});
if (res.result.total == tmpArr.length) {
// tmpArr 目前只是调试流程用
this.setData({
isLast: true
});
}
// if (1) {
// this.setData({
// // isLast: true,
// listTotal: res.result.total,
// recordList: res.result.records //之后放出来
// });
// }
console.log('查询结果', res);
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
this.setData({
loading: false
});
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 跳转到对应的维修详情页
toDetailPage(e: any) {
let url = '../UpkeepPlanInfo/UpkeepPlanInfo';
wx.setStorageSync('info', {
info: e.currentTarget.dataset.inf
});
wx.navigateTo({
url: url,
fail: e => {
console.log(e);
}
});
},
lower(e: any) {
console.log(e.detail.direction == 'bottom');
// return
if (this.data.isLast) {
wx.showToast({
title: '已经是最后一页',
icon: 'none'
});
return;
}
if (e.detail.direction == 'bottom' && !this.data.loading) {
// this.data.current += 1
this.setData({
loading: true,
current: (this.data.current += 1)
});
this.getList();
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.initDate();
this.getProjectOptions();
// this.getRepairShops();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// this.getTabList();
// this.getList();
this.restList();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// this.setData({
// current: 1,
// isLast: false,
// recordList: [],
// });
this.getTabList();
// this.getList();
this.restList();
// 手动控制回弹
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,132 @@
<!--pages/vehicleMaintenance/maintainRecord/maintainRecord.wxml-->
<!-- <view class="container"> -->
<view class="top">
<view class="search-container">
<view class="number-plate" catchtap="toSearch">
<view class="icon">
<image src="../../../images/icon_search.png" mode="" />
</view>
<input type="text" placeholder="搜索车辆或工单号" placeholder-style="color:#949CB5; font-size: 28rpx; font-weight: 400;" value="{{password}}" bind:input="changePlateNumberOrOrderNo" />
</view>
</view>
<view class="tab-container">
<view class="tabs">
<van-tabs color="#4381FC" title-active-color="#4381FC" ellipsis="{{false}}" active="{{ active }}" bind:change="tabOnChange">
<van-tab title-style="font-size:16px" wx:for="{{tabList}}" wx:key="index" title="{{item.flowName + '(' + item.count + ')' }}"></van-tab>
</van-tabs>
</view>
<view class="swicth" catchtap="filterShow">
<image src="../../../images/icon_filter.png" mode="" />
</view>
</view>
<van-popup show="{{ showMoreSearch }}" position="top" bind:close="filterHide">
<view class="more-search">
<!-- <view class="row">
<view class="label">按时间选择</view>
<view class="date-content">
<view class="date" data-key="startDate" catchtap="showDate">
<input type="text" value="{{startDate}}" disabled="true" />
</view>
<view class="line"></view>
<view class="date" data-key="endDate" catchtap="showDate">
<input type="text" value="{{endDate}}" disabled="true" />
</view>
</view>
</view> -->
<view class="row">
<view class="label">按项目选择</view>
<view class="select-content">
<view class="project-select">
<picker bindchange="bindPickerProject" value="{{selectProjectIndex}}" range-key="projectName" range="{{projectOptions}}">
<view class="picker project-select">
{{projectOptions[selectProjectIndex].projectName}}
</view>
</picker>
</view>
</view>
</view>
<!-- <view class="row">
<view class="label">按维修厂选择</view>
<view class="checkbox-content">
<view class="item {{item.check ? 'check' : ''}}" wx:for="{{repairShopsOptions}}" wx:key="index" data-index="{{index}}" catch:tap="checkRepairShop">
{{item.repairShop_dictText}}
</view>
</view>
</view> -->
<view class="row">
<view class="btn-content">
<view class="btn" catchtap="restList">重置</view>
<view class="btn btn-confirm" catchtap="getListByMoreParms">确定</view>
</view>
</view>
</view>
</van-popup>
</view>
<view class="list">
<scroll-view class="scroll-view_H" scroll-y="true" bindscrolltolower="lower" style="width: 100%">
<view class="item" wx:for="{{recordList}}" wx:key="index" data-inf="{{item}}" catchtap="toDetailPage">
<view class="row">
<view class="code">{{item.orderNo}}</view>
<view class="number-plate">
<view class="status status2" wx:if="{{item.auditStatus == 1 || item.auditStatus == 2 }}">{{item.auditStatus_dictText}}</view>
<view class="status status3" wx:if="{{item.auditStatus == 3 || item.auditStatus == 4 || item.auditStatus == 5}}">{{item.auditStatus_dictText}}</view>
<view class="val">{{item.plateNumber ? item.plateNumber : '/'}}</view>
</view>
</view>
<view class="row">
<view class="project-name">{{item.projectId_dictText ? item.projectId_dictText : '/'}}</view>
<view style="display: flex;">
<view class="overdue" wx:if="{{item.overdueStatus == 2}}">已逾期:{{item.overdueDay}}天</view>
<view class="time">{{item.predictTime ? item.predictTime : '/'}}</view>
</view>
</view>
</view>
<view class="is-last" wx:if="{{isLast && recordList.length > 0}}" style="padding-bottom: 40rpx;">
<van-divider contentPosition="center">已加载完全部数据</van-divider>
</view>
<view class="no-data" wx:if="{{recordList.length == 0}}">
<van-empty description="无数据" />
</view>
</scroll-view>
</view>
<!-- 日期范围选择 -->
<van-popup show="{{ showDateSelect }}" position="bottom" custom-style="height: 50%;" bind:click-overlay="hideDate">
<view style="background: #fff;border-radius: 4px 4px 0 0;overflow: hidden;">
<view class="date-btn-box">
<view class="btn btn-cancel" bindtap="hideDate">取消</view>
<view class="title">选择开始结束时间</view>
<view class="btn btn-confirm" bindtap="changeDate">确定</view>
</view>
<view class="date-title">
<view class="date {{selectDate == 'startDate' ? 'select' : ''}}" data-key="startDate" catchtap="changeSelectDate">
<input type="text" value="{{startDateTmp}}" disabled="true" bindinput="getPassword" />
<view class="icon">
<image src="../../../images/icon_cal.png" mode="" />
</view>
</view>
<view class="line"></view>
<view class="date {{selectDate == 'endDate' ? 'select' : ''}}" data-key="endDate" catchtap="changeSelectDate">
<input type="text" value="{{endDateTmp}}" disabled="true" bindinput="getPassword" />
<view class="icon">
<image src="../../../images/icon_cal.png" mode="" />
</view>
</view>
</view>
<view class="picker-box">
<picker-view data-key="dateRang" value="{{dateValue}}" indicator-style="height: 50px;" style="width: 100%; height: 500rpx;" bindchange="selectDate">
<picker-view-column>
<view style="line-height: 50px; text-align: center;" wx:for="{{dateList.years}}" wx:key="index">{{item}}年</view>
</picker-view-column>
<picker-view-column>
<view style="line-height: 50px; text-align: center;" wx:for="{{dateList.months}}" wx:key="index">{{item}}月</view>
</picker-view-column>
<picker-view-column>
<view style="line-height: 50px; text-align: center;" wx:for="{{dateList.date}}" wx:key="index">{{item}}日</view>
</picker-view-column>
</picker-view>
</view>
</view>
</van-popup>
<!-- </view> -->
@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "作废"
}
@@ -0,0 +1,208 @@
.container {
height: 100vh;
padding-top: 2px;
box-sizing: border-box;
background: #EFF1F4;
position: relative;
.top {
margin: 8px 8px 10px;
padding: 12px 10px;
margin-bottom: 8px;
background: #fff;
border-radius: 8px;
position: relative;
.row:first-child {
margin-bottom: 8px;
}
.row {
color: #2E3A4F;
display: flex;
justify-content: space-between;
align-items: center;
.number-plate {
display: flex;
.status {
padding: 0 6px;
margin-right: 4px;
border-radius: 2px;
color: #FFFFFF;
font-size: 14px;
}
.status1 {
background: linear-gradient(90deg, #0D92FF 0%, #38B1FE 100%);
}
.status2 {
background: linear-gradient(270deg, #4CDBAD 0%, #2FCBAB 100%);
}
.status3 {
background: linear-gradient(270deg, #A1A8BB 0%, #838EAA 100%);
}
.val {
font-size: 16px;
font-weight: bold;
}
}
.project-name,
.code {
font-size: 14px;
}
.time {
font-size: 14px;
color: #858CA0;
}
.overdue {
font-size: 14px;
color: #EA4955;
margin-right: 5px;
}
}
}
.row {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
.label {
color: #858CA0;
font-size: 14px;
}
.val {
color: #2E3A4F;
font-size: 14px;
}
}
.item-container {
height: calc(100vh - 72px);
max-height: calc(100vh - 72px);
overflow-y: auto;
// background-color: #bfa;
.item {
padding: 12px 10px;
background: #fff;
position: relative;
&:not(:last-child) {
margin-bottom: 8px;
}
.require {
&::after {
content: '*';
width: 6px;
height: 100%;
color: red;
margin-left: 8px;
display: inline-block;
}
}
.title {
font-size: 14px;
font-weight: bold;
color: #333F53;
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
width: 4px;
height: 22px;
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
border-radius: 2px;
margin-right: 8px;
}
}
}
}
.bottom {
width: 100%;
padding: 10px 8px 14px;
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;
.row {
width: 100%;
height: 36px;
padding: 8px 10px;
margin-bottom: 8px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 20px;
height: 20px;
margin-right: 8px;
image {
width: 100%;
height: 100%;
}
}
input {
flex: 1;
font-size: 14px;
}
}
.btn-box {
width: 100%;
display: flex;
justify-content: space-between;
.btn {
width: 100%;
height: 40px;
background-color: #FFFFFF;
line-height: 40px;
border-radius: 8px;
color: #2E3A4F;
text-align: center;
border: 1px solid #D6D6D6;
}
.apply {
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #2E3A4F;
color: #fff;
font-size: 15px;
font-weight: bold;
}
}
}
.weui-input {
border-radius: 8px;
border: 1px solid #E6EAF2;
width: calc(100% - 16px);
height: 83px;
padding: 8px;
margin-top: 8px;
}
}
@@ -0,0 +1,129 @@
import { postAction } from '../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
cancelIdea: '', // 作废原因
upkeepObject: '' as any, // 维修单数据
userInfo: '' as any, // 用户信息
checkPeople: '' //审批人
},
// 输入报修内容
textareaInput(e: any) {
this.setData({
cancelIdea: e.detail.value
});
},
// 提交申请
submit() {
if (!this.data.cancelIdea) {
wx.showToast({
title: '请填写作废原因',
icon: 'none'
});
return;
}
let params = {
id: this.data.upkeepObject.id,
cancelIdea: this.data.cancelIdea,
realname: this.data.userInfo.realname
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepPlan/cancel', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '作废成功',
icon: 'none'
});
wx.setStorageSync('message', {
checkPeople: this.data.userInfo.realname,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
cancelIdea: this.data.cancelIdea,
id: this.data.upkeepObject.id,
auditStatus: 4
});
wx.reLaunch({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
getInf() {
// 获取信息
let info = wx.getStorageSync('upkeepObject');
wx.removeStorage({ key: 'upkeepObject' });
let userInfo = wx.getStorageSync('userInfo');
this.setData({
upkeepObject: info,
userInfo: userInfo,
checkPeople: userInfo.realname
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,33 @@
<view class="container">
<view class="item-container">
<view class="top">
<view class="row">
<view class="code">{{upkeepObject.upkeepPlan.orderNo}}</view>
<view class="number-plate">
<view wx:if="{{upkeepObject.auditStatus == 1}}" class="status status2">未审批</view>
<view wx:if="{{upkeepObject.auditStatus == 2}}" class="status status2">审批通过</view>
<view wx:if="{{upkeepObject.auditStatus == 3}}" class="status status3">审批未通过</view>
<view wx:if="{{upkeepObject.auditStatus == 4}}" class="status status3">已作废</view>
<view wx:if="{{upkeepObject.auditStatus == 5}}" class="status status3">已归档</view>
<view class="val">{{upkeepObject.upkeepPlan.plateNumber}}</view>
</view>
</view>
<view class="row">
<view class="project-name">{{upkeepObject.upkeepPlan.projectId_dictText}}</view>
<view style="display: flex;">
<view class="overdue" wx:if="{{upkeepObject.overdueStatus == 2 && upkeepObject.auditStatus != 4 && upkeepObject.auditStatus != 5}}">已逾期:{{upkeepObject.overdueDay}}天</view>
<view class="time">{{upkeepObject.upkeepPlan.predictTime ? upkeepObject.upkeepPlan.predictTime : '/'}}</view>
</view>
</view>
</view>
<view class="item">
<view class="title require">作废原因</view>
<textarea class="weui-input" maxlength="200" placeholder="最大输入长度为200" value="{{checkIdea}}" bindblur="textareaInput" />
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn apply" catch:tap="submit">确认作废</view>
</view>
</view>
</view>
@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-radio-group": "@vant/weapp/radio-group/index",
"van-radio": "@vant/weapp/radio/index"
},
"navigationBarTitleText": "审批"
}
@@ -0,0 +1,152 @@
/* pages/vehicleMaintenance/maintainSend/maintainSend.wxss */
.container {
height: 100vh;
padding-top: 2px;
box-sizing: border-box;
background: #EFF1F4;
position: relative;
.row {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
.label {
color: #858CA0;
font-size: 14px;
}
.val {
color: #2E3A4F;
font-size: 14px;
}
}
.item-container {
height: calc(100vh - 72px);
max-height: calc(100vh - 72px);
overflow-y: auto;
// background-color: #bfa;
.item {
padding: 12px 10px;
background: #fff;
position: relative;
&:not(:last-child) {
margin-bottom: 8px;
}
.require {
&::after {
content: '*';
width: 6px;
height: 100%;
color: red;
margin-left: 8px;
display: inline-block;
}
}
.title {
font-size: 14px;
font-weight: bold;
color: #333F53;
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
width: 4px;
height: 22px;
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
border-radius: 2px;
margin-right: 8px;
}
}
}
}
.bottom {
width: 100%;
padding: 10px 8px 14px;
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;
.row {
width: 100%;
height: 36px;
padding: 8px 10px;
margin-bottom: 8px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 20px;
height: 20px;
margin-right: 8px;
image {
width: 100%;
height: 100%;
}
}
input {
flex: 1;
font-size: 14px;
}
}
.btn-box {
width: 100%;
display: flex;
justify-content: space-between;
.btn {
width: 100%;
height: 40px;
background-color: #FFFFFF;
line-height: 40px;
border-radius: 8px;
color: #2E3A4F;
text-align: center;
border: 1px solid #D6D6D6;
}
.apply {
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #2E3A4F;
color: #fff;
font-size: 15px;
font-weight: bold;
}
}
}
.weui-input {
border-radius: 8px;
border: 1px solid #E6EAF2;
width: calc(100% - 16px);
height: 83px;
padding: 8px;
margin-top: 8px;
}
.radio-group {
margin-top: 16px;
display: block;
.van-radio-group {
display: flex;
}
}
}
+150
View File
@@ -0,0 +1,150 @@
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
import { postAction } from '../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
checkIdea: '', // 报修内容
upkeepObject: '' as any, // 维修单数据
checkResult: '' as any, // 评审结果
userInfo: '' as any, // 用户信息
checkPeople: '' //审批人
},
// 输入报修内容
textareaInput(e: any) {
this.setData({
checkIdea: e.detail.value
});
},
selectRadio(e: any) {
this.setData({
checkResult: e.currentTarget.dataset.inf
});
},
// 提交申请
submit() {
if (this.data.checkResult) {
if (this.data.checkResult == '2' && !this.data.checkIdea) {
wx.showToast({
title: '请填写审批意见',
icon: 'none'
});
return;
}
let params = {
id: this.data.upkeepObject.id, //id
checkFlag: this.data.checkResult, //审核状态 1-》通过, 2-》不通过
upkeepPlan: {},
currentUpkeepCheck: {
checkResult: this.data.checkResult, //审核结果/维修结果
checkPeople: this.data.userInfo.realname, //审批人
checkIdea: this.data.checkIdea //审核意见
}
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepPlan/submitUpkeepPlan', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '提交成功',
icon: 'none'
});
wx.setStorageSync('message', {
checkPeople: this.data.userInfo.realname,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
checkIdea: this.data.checkIdea,
checkResult: this.data.checkResult,
id: this.data.upkeepObject.id,
auditStatus: 2,
checkFlag: this.data.checkResult // 通过结果
});
wx.reLaunch({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
} else {
wx.showToast({
title: '请选择审批结果',
icon: 'none'
});
}
},
getInf() {
// 获取信息
let info = wx.getStorageSync('upkeepObject');
wx.removeStorage({ key: 'upkeepObject' });
let userInfo = wx.getStorageSync('userInfo');
this.setData({
upkeepObject: info,
userInfo: userInfo,
checkPeople: userInfo.realname
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,20 @@
<view class="container">
<view class="item-container">
<view class="item">
<view class="title require">审批结果</view>
<van-radio-group class="radio-group">
<van-radio name="1" style="margin-right: 16px;" catch:tap="selectRadio" data-inf='{{1}}'>通过</van-radio>
<van-radio name="2" catch:tap="selectRadio" data-inf='{{2}}'>不通过</van-radio>
</van-radio-group>
</view>
<view class="item">
<view class="title {{checkResult == 2 ? 'require' : ''}}">审批意见</view>
<textarea class="weui-input" maxlength="200" placeholder="最大输入长度为200" value="{{checkIdea}}" bindblur="textareaInput" />
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn apply" catch:tap="submit">提交审核</view>
</view>
</view>
</view>
@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "操作成功"
}
@@ -0,0 +1,123 @@
/* pages/vehicleMaintenance/maintainSend/maintainSend.wxss */
.container {
.bg {
width: 100%;
height: 250px;
position: absolute;
top: 0;
image {
width: 100%;
height: 100%;
display: block;
}
}
.success {
position: absolute;
width: 100%;
top: 18px;
text-align: center;
image {
width: 85px;
height: 69px;
}
.title {
font-size: 20px;
font-weight: bold;
color: #FFFFFF;
margin-top: 8px;
}
.info {
width: 100%;
margin-top: 10px;
display: flex;
flex-wrap: wrap;
justify-content: center;
.info-top {
width: 90%;
height: 11px;
}
.info-bottom {
width: 87%;
height: 12px;
}
.info-content {
width: calc(85.7% - 16px);
padding: 8px;
background-color: #FFFFFF;
box-shadow: 0rpx 0px 10rpx 2rpx rgba(165, 165, 165, 0.34);
.info-title {
font-size: 16px;
font-weight: bold;
color: #4381FC;
text-align: left;
margin-bottom: 8px;
}
}
.info-button {
width: calc(85.7% - 16px);
padding: 8px;
background-color: #FFFFFF;
box-shadow: 0px 5px 10rpx 2rpx rgba(165, 165, 165, 0.34);
border-radius: 0px 0px 10px 10px;
display: flex;
justify-content: space-between;
.btn {
width: calc(50% - 8px);
height: 40px;
line-height: 40px;
border-radius: 8px;
text-align: center;
border: 1px solid #D6D6D6;
}
.apply {
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #2E3A4F;
color: #fff;
font-size: 15px;
font-weight: bold;
}
.cancel {
border: 1px solid #4381FC;
background-color: #FFFFFF;
color: #4381FC;
}
}
}
}
.row {
width: calc(100% -16px);
display: flex;
margin-bottom: 8px;
.label {
width: 22%;
color: #858CA0;
font-size: 14px;
text-align: left;
}
.val {
width: 78%;
text-align: left;
color: #2E3A4F;
font-size: 14px;
word-break: break-word;
}
}
}
@@ -0,0 +1,122 @@
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
Page({
/**
* 页面的初始数据
*/
data: {
message: {} as any, // 展示的信息
userInfo: {} as any // 用户信息
},
// 前往下一状态的维修单
goRepair() {
let url = '../UpkeepPlanInfo/UpkeepPlanInfo';
wx.setStorageSync('info', {
info: this.data.message
});
wx.reLaunch({
url: url,
fail: e => {
console.log(e);
}
});
},
// 返回首页
backHome() {
if (this.data.userInfo.type == '1') {
wx.reLaunch({
url: '/pages/index/index'
});
} else if (this.data.userInfo.type == '2') {
wx.reLaunch({
url: '/pages/manufacturerIndex/manufacturerIndex'
});
} else if (this.data.userInfo.type == '3') {
wx.reLaunch({
url: '/pages/projectIndex/projectIndex'
});
} else if (this.data.userInfo.type == '4') {
wx.reLaunch({
url: '/pages/maintenanceIndex/maintenanceIndex'
});
} else {
wx.reLaunch({
url: '/pages/login/login'
});
}
},
getInf() {
// 获取信息
let info = wx.getStorageSync('message');
wx.removeStorage({ key: 'message' });
this.setData({
message: info
});
this.changeTitle(info);
},
// 获取用户信息
getUserInfo() {
let userInfo = wx.getStorageSync('userInfo');
this.setData({
userInfo: userInfo
});
},
// 修改页眉
changeTitle(info: any) {
let title = '操作成功';
switch (info.auditStatus) {
case 1:
title = '已提交';
break;
case 2:
title = '已审批';
break;
}
wx.setNavigationBarTitle({
title: title
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
this.getUserInfo();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,64 @@
<!--pages/vehicleMaintenance/maintainSend/maintainSend.wxml-->
<view class="container">
<view class="bg">
<image src="../../../images/bg_page_blue.png" mode="" />
</view>
<view class="success">
<image src="../../../images/icon_success.png" mode="" />
<view class="title" wx:if="{{message.auditStatus == 1}}">已提交保养申请</view>
<view class="title" wx:if="{{message.auditStatus == 2}}">已审核</view>
<view class="title" wx:if="{{message.auditStatus == 4}}">已作废</view>
<view class="info">
<image class="info-top" src="../../../images/info-top.png" mode="" />
<view class="info-content" wx:if="{{message.auditStatus == 1}}">
<view class="row">
<view class="label">所属项目</view>
<view class="val">{{message.projectName}}</view>
</view>
<view class="row">
<view class="label">车牌号码</view>
<view class="val">{{message.plateNumber}}</view>
</view>
<view class="row">
<view class="label">申请时间</view>
<view class="val">{{message.date}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.auditStatus == 2}}">
<view class="info-title" style="color: #4381FC;" wx:if="{{message.checkResult == 1}}">审批通过</view>
<view class="info-title" style="color: red;" wx:if="{{message.checkResult == 2}}">审批不通过</view>
<view class="row">
<view class="label">审批人</view>
<view class="val">{{message.checkPeople}}</view>
</view>
<view class="row">
<view class="label">审批时间</view>
<view class="val">{{message.date}}</view>
</view>
<view class="row">
<view class="label">审批意见</view>
<view class="val">{{message.checkIdea ? message.checkIdea : '/'}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.auditStatus == 4}}">
<view class="row">
<view class="label">作废人</view>
<view class="val">{{message.checkPeople}}</view>
</view>
<view class="row">
<view class="label">作废时间</view>
<view class="val">{{message.date}}</view>
</view>
<view class="row">
<view class="label">作废原因</view>
<view class="val">{{message.cancelIdea ? message.cancelIdea : '/'}}</view>
</view>
</view>
<image class="info-bottom" src="../../../images/info-bottom.png" mode="" />
<view class="info-button">
<view class="btn cancel" catch:tap="goRepair">保养单详情</view>
<view class="btn apply" catch:tap="backHome">回首页</view>
</view>
</view>
</view>
</view>