You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.0 KiB
JavaScript

2 months ago
// pages/production/production.js
2 months ago
import {
request
} from '../../utils/request'
2 months ago
const app = getApp()
Page({
2 months ago
data: {
optionsRow: [],
2 months ago
options: [],
selectedIndex: 0
},
2 months ago
onChange(e) {
2 months ago
this.setData({
selectedIndex: e.detail.value
2 months ago
})
let id = this.data.optionsRow.find(v => v.label === this.data.options[e.detail.value])?.value || ''
2 months ago
console.log(id);
2 months ago
2 months ago
},
2 months ago
2 months ago
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
2 months ago
},
2 months ago
data: {
2 months ago
username: 'admin',
password: 'admin123',
clientId: '428a8310cd442757ae699df5d894f051',
grantType: 'password',
2 months ago
rememberMe: false,
tenantId: "000000",
}
2 months ago
}).then(e => {
2 months ago
app.globalData.token = e.data.access_token
})
2 months ago
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),
})
})
2 months ago
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})