2026-01-21 17:05:30 +08:00
|
|
|
import { loginStatus, post } from '@/utils/https';
|
|
|
|
|
import { getAuthInfo, getDataSet, toArray, toastSuccess, toNumber } from '@/utils/util';
|
2026-01-14 16:54:47 +08:00
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
/**
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
*/
|
|
|
|
|
data: {
|
2026-01-21 17:05:30 +08:00
|
|
|
params: { curr_page: 1, page_count: 20, state: '1', process_id: '' } as any,
|
|
|
|
|
list: [] as any[],
|
|
|
|
|
count: 0,
|
|
|
|
|
dialog: {
|
|
|
|
|
visible: false,
|
|
|
|
|
content: '',
|
|
|
|
|
item: {} as any,
|
|
|
|
|
action: '' as 'end' | 'back',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
handleLogin(e: any) {
|
|
|
|
|
this.setData({ isLogin: e.detail });
|
|
|
|
|
if (e.detail) {
|
|
|
|
|
this.init();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
init() {
|
|
|
|
|
this.setData({ authInfo: getAuthInfo() });
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
searchChange(e: any) {
|
|
|
|
|
this.data.params.order_no = e.detail.value;
|
|
|
|
|
},
|
|
|
|
|
searchChange2(e: any) {
|
|
|
|
|
const key = getDataSet(e).key;
|
|
|
|
|
const val = `${e.detail.value || ''}`.trim();
|
|
|
|
|
console.log(e);
|
|
|
|
|
if (val) {
|
|
|
|
|
this.data.params[key] = val;
|
|
|
|
|
} else {
|
|
|
|
|
delete this.data.params[key];
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
searchOk() {
|
|
|
|
|
this.getList(1);
|
2026-01-14 16:54:47 +08:00
|
|
|
},
|
|
|
|
|
tabChange(e: any) {
|
|
|
|
|
const state = getDataSet(e).key;
|
|
|
|
|
this.data.params.state = state;
|
2026-01-21 17:05:30 +08:00
|
|
|
this.getList();
|
2026-01-14 16:54:47 +08:00
|
|
|
},
|
2026-01-21 17:05:30 +08:00
|
|
|
paginationChange(e: any) {
|
|
|
|
|
this.getList(e.detail.curr_page);
|
|
|
|
|
},
|
|
|
|
|
getList(curr: number = 1) {
|
2026-01-14 16:54:47 +08:00
|
|
|
this.data.params.curr_page = curr;
|
|
|
|
|
this.setData({ params: this.data.params });
|
2026-01-21 17:05:30 +08:00
|
|
|
post('CompanyProcessV2/processOrd', this.data.params).then((res: any) => {
|
|
|
|
|
const list = toArray(res.data);
|
|
|
|
|
if (list.length == 0 && this.data.params.curr_page > 1) {
|
|
|
|
|
this.getList(this.data.params.curr_page - 1);
|
|
|
|
|
}
|
|
|
|
|
this.setData({
|
|
|
|
|
count: toNumber(res.count),
|
|
|
|
|
list: list,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
confirmDialog() {
|
|
|
|
|
post('ProduceOrder/setProcessV2', {
|
|
|
|
|
info_process_id: JSON.stringify([this.data.dialog.item.info_process_id]),
|
|
|
|
|
action: this.data.dialog.action,
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.closeDialog();
|
|
|
|
|
toastSuccess(this.data.dialog.action == 'end' ? '订单工序完成成功' : '订单工序撤回成功');
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.getList(this.data.params.curr_page);
|
|
|
|
|
}, 1500);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
closeDialog() {
|
|
|
|
|
this.data.dialog.visible = false;
|
|
|
|
|
this.setData({ dialog: this.data.dialog });
|
|
|
|
|
},
|
|
|
|
|
onEndOrBack(e: any) {
|
|
|
|
|
const data = getDataSet(e);
|
|
|
|
|
const index = data.index;
|
|
|
|
|
const item = this.data.list[index];
|
|
|
|
|
this.setData({
|
|
|
|
|
dialog: {
|
|
|
|
|
visible: true,
|
|
|
|
|
content: `确认${data.action == 'end' ? '完成' : '撤回'} ${item.order_no} ?`,
|
|
|
|
|
action: data.action,
|
|
|
|
|
item,
|
|
|
|
|
},
|
|
|
|
|
});
|
2026-01-14 16:54:47 +08:00
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
*/
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
// console.log(options);
|
|
|
|
|
wx.setNavigationBarTitle({
|
2026-01-21 17:05:30 +08:00
|
|
|
title: decodeURIComponent(options.title || ''),
|
2026-01-14 16:54:47 +08:00
|
|
|
});
|
2026-01-21 17:05:30 +08:00
|
|
|
this.data.params.process_id = `${options.process_id || ''}`;
|
|
|
|
|
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);
|
|
|
|
|
});
|
2026-01-14 16:54:47 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
*/
|
|
|
|
|
onReady() {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
*/
|
|
|
|
|
onShow() {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
*/
|
|
|
|
|
onHide() {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
*/
|
|
|
|
|
onUnload() {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
*/
|
|
|
|
|
onPullDownRefresh() {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
*/
|
|
|
|
|
onReachBottom() {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户点击右上角分享
|
|
|
|
|
*/
|
|
|
|
|
onShareAppMessage() {},
|
|
|
|
|
});
|