var app = getApp() var that; Page({ data: { review_id: '', isBh: false,//是否显示驳回弹窗 textArea: "", disabled: false, corpId: '', }, onLoad(e) { that = this; dd.setNavigationBar({ title: "详情" }); if (e.id) { that.setData({ review_id: parseInt(e.id), userData: app.globalData.userData }); } if (e.is) { that.setData({ is: e.is }); } if (e.corpId) { that.setData({ corpId: e.corpId }); app.globalData.corpId = e.corpId } }, onShow() { if (app.globalData.userData) { dd.hideLoading(); that.getData(); } else { let corpId = that.data.corpId ? that.data.corpId : app.globalData.corpId app.login(corpId, function (is) { if (is) { dd.hideLoading(); that.setData({ userData: app.globalData.userData }); that.getData(); } else { dd.reLaunch({ url: '../../noJurisdiction/noJurisdiction' }) } }) } }, openDetail() { dd.navigateTo({ url: '../../statistics/workDetail/workDetail?id=' + that.data.dataDetail.source_id + '&isNot=true' }) }, showImg(e) { var index = e.target.dataset.index; var item = e.target.dataset.item dd.previewImage({ current: index, urls: item }); }, submit() { // 暂时无法解决这个中途删除积分规则的问题 // if (that.data.dataDetail.item_max_point == -1 && that.data.dataDetail.item_min_point == -1&&that.data.dataDetail.item.item_id) { // app.globalData.showToast("系统发现此条积分规则制度有变动, 请驳回后让员工按最新的规则重新申请"); // return; // } dd.navigateTo({ url: '../approve/approve?id=' + that.data.dataDetail.id }) }, bindTextAreaBlur(e) { this.setData({ textArea: e.detail.value }); }, openBh(e) { this.setData({ isBh: !this.data.isBh, textArea: '' }) }, confirmBh() { if (!that.data.textArea) { app.globalData.showToast("请输入审批意见"); return; } this.setData({ disabled: true }); app.$post("api/integral/review", { review_id: that.data.review_id, remark: that.data.textArea, action: "refuse", ticket_count: 0 }).then((res) => { app.globalData.showToast("已驳回"); that.setData({ disabled: false }); var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法 var active = pages[pages.length - 2]; if (active) { if (active.data.page != 1) { active.refreshData(that.data.review_id); } setTimeout(() => { dd.navigateBack({ delta: 1 }); }, 1000); } else { setTimeout(() => { dd.reLaunch({ url: '/pages/workbench/index/index' }) }, 1000); } }) }, openCx() { dd.confirm({ title: '撤掉审批', content: '你确定撤掉此项吗?', confirmButtonText: '确定', cancelButtonText: '取消', success: (result) => { if (result.confirm) { app.$post("api/integral/review/destroy", { review_id: that.data.review_id }).then((res) => { app.globalData.showToast("已撤掉"); var pages = getCurrentPages();//当上一页的page不等于一时,执行上一页的方法 var active = pages[pages.length - 2]; if (active) { if (active.data.page != 1) { active.refreshData(that.data.review_id); active.filtrationList(2, item.review_id); } setTimeout(() => { dd.navigateBack({ delta: 1 }) }, 1000); } else { setTimeout(() => { dd.reLaunch({ url: '/pages/workbench/index/index' }) }, 1000); } }) } }, }); }, getData() { app.$get("api/integral/review", { review_id: that.data.review_id }).then((res) => { var data = res.data.data; data.typeName = app.getTypesItem(data.pt_id).name; this.setData({ dataDetail: data }) }) }, });