Files
FreeERP.Applet/miniprogram/pages/produce/processManage/processManage.ts

102 lines
2.2 KiB
TypeScript
Raw Normal View History

2026-01-21 17:05:30 +08:00
import { loginStatus, post } from '@/utils/https';
import { getAuthInfo, getDataSet, toArray } from '@/utils/util';
Page({
/**
*
*/
data: {
2026-01-21 17:05:30 +08:00
process: [] as any[],
2026-01-29 17:46:14 +08:00
isFirstEnter: true,
2026-02-06 14:49:13 +08:00
isLogin: false,
},
navDetail(e: any) {
2026-01-21 17:05:30 +08:00
const index = getDataSet(e).index.split(',');
const pProcess = this.data.process[index[0]];
const cProcess = pProcess.child[index[1]];
const { p_process_name, process_name, process_id } = cProcess;
const title = encodeURIComponent(`${p_process_name} - ${process_name}`);
2026-01-29 17:46:14 +08:00
this.data.isFirstEnter = false;
wx.navigateTo({
url: `/pages/produce/processManageDetail/processManageDetail?process_id=${process_id}&title=${title}`,
});
},
2026-01-21 17:05:30 +08:00
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
},
getList() {
2026-02-06 14:49:13 +08:00
post('CompanyProcessV2/getAllProcessNum')
.then((res: any) => {
this.setData({ process: toArray(res.data) });
})
.finally(() => {
wx.stopPullDownRefresh();
});
2026-01-21 17:05:30 +08:00
},
/**
* --
*/
2026-01-21 17:05:30 +08:00
onLoad() {
this.setData({ loading: true });
loginStatus()
.then(() => {
this.setData({ isLogin: true, loading: false });
this.init();
})
.catch((err) => {
this.setData({ isLogin: false, loading: false });
console.log('调用登录状态请求失败', err);
});
},
/**
* --
*/
onReady() {},
/**
* --
*/
2026-01-29 17:46:14 +08:00
onShow() {
if (!this.data.isFirstEnter) {
this.getList();
}
},
/**
* --
*/
onHide() {},
/**
* --
*/
onUnload() {},
/**
* --
*/
2026-02-06 14:49:13 +08:00
onPullDownRefresh() {
if (this.data.isLogin) {
this.getList();
}
},
/**
*
*/
onReachBottom() {},
/**
*
*/
onShareAppMessage() {},
});