// pages/production/production.js import { request } from '../../utils/request' const app = getApp() Page({ data: { optionsRow: [], options: [], selectedIndex: 0 }, onChange(e) { this.setData({ selectedIndex: e.detail.value }) let id = this.data.optionsRow.find(v => v.label === this.data.options[e.detail.value])?.value || '' console.log(id); }, onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ async onShow() { const tabBar = this.getTabBar?.() if (tabBar) { tabBar.setData({ nowPage: getCurrentPages().at(-1)?.route }) } await request({ url: '/auth/login', method: 'post', headers: { isToken: false, isEncrypt: true, repeatSubmit: false }, data: { username: 'admin', password: 'admin123', clientId: '428a8310cd442757ae699df5d894f051', grantType: 'password', rememberMe: false, tenantId: "000000", } }).then(e => { app.globalData.token = e.data.access_token }) await request({ url: '/mes/baseProcessInfo/getProcessInfoList', method: 'get', }).then(e => { this.setData({ optionsRow: JSON.parse(JSON.stringify(e.data)).map(v => { return { value : v.processId, label : v.processName, } }), options: e.data.map(v => v.processName), }) }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })