2025-06-19 17:33:18 +08:00

131 lines
3.1 KiB
TypeScript

// pages/backlog/annualInspection/annualInspection.ts
import { getAction } from '../../../api/base';
Page({
/**
* 页面的初始数据
*/
data: {
tabActive: 0,
id: '',
item: {} as any
},
// 变更tab
changeTab(e: any) {
console.log(e.currentTarget.dataset.tab);
this.setData({
tabActive: e.currentTarget.dataset.tab
});
},
getDetailInf() {
let parms = {
id: this.data.id
};
getAction('api/vehicles/backlog/getAnnualInspectionById', parms).then(
(res: any) => {
if (res.code == 200) {
console.log(res.result);
res.result.drivingLicenseList = res.result.drivingLicense
? res.result.drivingLicense.split(',')
: [];
res.result.vehicleQualificationMarkList = res.result
.vehicleQualificationMark
? res.result.vehicleQualificationMark.split(',')
: [];
res.result.detailsTableList = res.result.detailsTable
? res.result.detailsTable.split(',')
: [];
res.result.otherList = res.result.other
? res.result.other.split(',')
: [];
this.setData({
item: res.result
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
}
);
},
previewImg(e: any) {
let that = this;
let { index, key, key2 } = e.currentTarget.dataset;
if (key2) {
wx.previewImage({
current: that.data.item[key][key2][index | 0], // 当前显示图片的http链接 默认urls[0]
urls: that.data.item[key][key2] // 需要预览的图片http链接列表
});
} else {
wx.previewImage({
current: that.data.item[key][index | 0], // 当前显示图片的http链接 默认urls[0]
urls: that.data.item[key] // 需要预览的图片http链接列表
});
}
},
toFeedback() {
let that = this;
// 跳转到反馈
wx.navigateTo({
url: '../annualInspectionFeedback/annualInspectionFeedback',
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('eventName', { ...that.data.item });
},
fail: e => {
console.log(e);
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
const eventChannel = this.getOpenerEventChannel();
getApp().EventChannel = eventChannel;
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
let id = wx.getStorageSync('backlogInf').id;
this.setData({
id: id
});
this.getDetailInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});