12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- const _Http = getApp().globalData.http,
- getHeight = require("../../utils/getRheRemainingHeight");
- Page({
- data: {
- listHeight: null,
- list: [],
- "content": {
- nochace: true,
- pageNumber: 1,
- pageTotal: 1,
- pageSize: 20,
- "where": {
- "condition": ""
- }
- }
- },
- onLoad(options) {
- this.getList();
- try {
- const arr = JSON.parse(options.auth)[0].meta.auth,
- auth = arr.map(v => v.optionname)
- this.setData({
- auth
- })
- } catch (e) {
- let arr = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['销售预测'])[0].apps[0].meta.auth,
- auth = arr.map(v => v.optionname)
- this.setData({
- auth
- })
- }
- },
- getList(init = false) {
- //init 用于初始化分页
- if (init.detail != undefined) init = init.detail;
- if (init) this.setData({
- ['content.pageNumber']: 1
- })
- if (this.data.content.pageNumber > this.data.content.pageTotal) return;
- _Http.basic({
- "id": 20220906154403,
- "version": 1,
- content: this.data.content
- }).then(res => {
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- this.setData({
- 'content.pageNumber': res.pageNumber + 1,
- 'content.pageTotal': res.pageTotal,
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
- })
- })
- },
- toDetail(e) {
- const {
- item
- } = e.currentTarget.dataset;
- _Http.basic({
- "id": 20220916134103,
- "version": 1,
- "content": {
- "sa_salesforecastmodelid": item.sa_salesforecastmodelid,
- "sa_salesforecastbillid": 0,
- "sa_projectids": [0]
- }
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- if (item.baseonproject == 1) {
- wx.navigateTo({
- url: `./detail?id=${res.data[0].sa_salesforecastbillid}&mId=${item.sa_salesforecastmodelid}&my=true`,
- })
- } else {
- const data = {
- sa_salesforecastbillid: res.data[0].sa_salesforecastbillid,
- sa_projectid: 0,
- sa_salesforecastmodelid: item.sa_salesforecastmodelid
- }
- wx.navigateTo({
- url: './reportForms?item=' + JSON.stringify(data) + '&isEdit=true',
- })
- }
- })
- },
- onReady() {
- getHeight.getHeight('#placeholder', this).then(res => this.setData({
- listHeight: res
- }));
- },
- onShareAppMessage() {}
- })
|