|
@@ -1,66 +1,170 @@
|
|
|
-// packageA/forecast/detail.js
|
|
|
+const getHeight = require("../../utils/getRheRemainingHeight"),
|
|
|
+ _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
-
|
|
|
+ myProject: false,
|
|
|
+ list: [],
|
|
|
+ total: null,
|
|
|
+ projectList: null,
|
|
|
+ sa_salesforecastmodelid: null,
|
|
|
+ "content": {
|
|
|
+ "nocache": true,
|
|
|
+ "sa_salesforecastbillid": null,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "pageTotal": 1,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ 'content.sa_salesforecastbillid': options.id,
|
|
|
+ 'sa_salesforecastmodelid': options.mId
|
|
|
+ })
|
|
|
+ this.getList();
|
|
|
+ if (options.my) this.setData({
|
|
|
+ myProject: true
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {
|
|
|
-
|
|
|
+ /* 添加项目 */
|
|
|
+ addProjece() {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20220906154803,
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "nocache": true,
|
|
|
+ pageSize: 9999,
|
|
|
+ "sa_salesforecastbillid": this.data.content.sa_salesforecastbillid,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ projectList: res.data
|
|
|
+ });
|
|
|
+ this.selectComponent("#Plist").setData({
|
|
|
+ show: true
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow() {
|
|
|
-
|
|
|
+ getList(init = false) {
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ if (init) this.setData({
|
|
|
+ ['content.pageNumber']: 1
|
|
|
+ })
|
|
|
+ if (this.data.content.pageNumber > this.data.content.pageTotal) return;
|
|
|
+ return _Http.basic({
|
|
|
+ "id": 20220916115203,
|
|
|
+ "version": 1,
|
|
|
+ content: this.data.content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("列表", 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),
|
|
|
+ total: res.total
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide() {
|
|
|
-
|
|
|
+ /* 得到结果创建项目 */
|
|
|
+ getResult({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20220916134103,
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sa_salesforecastmodelid": this.data.sa_salesforecastmodelid,
|
|
|
+ "sa_salesforecastbillid": this.data.content.sa_salesforecastbillid,
|
|
|
+ "sa_projectids": detail
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.getList(true)
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload() {
|
|
|
-
|
|
|
+ /* 开始搜索 */
|
|
|
+ startSearch({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ 'content.where.condition': detail.trim()
|
|
|
+ });
|
|
|
+ this.getList(true);
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {
|
|
|
-
|
|
|
+ cancelSearch() {
|
|
|
+ this.setData({
|
|
|
+ 'content.where.condition': ""
|
|
|
+ });
|
|
|
+ this.getList(true);
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom() {
|
|
|
-
|
|
|
+ onReady() {
|
|
|
+ //滚动区域高度
|
|
|
+ getHeight.getHeight('#Search', this).then(res => this.setData({
|
|
|
+ scrollHeight: res
|
|
|
+ }))
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {
|
|
|
-
|
|
|
- }
|
|
|
+ onClose(event) {
|
|
|
+ const {
|
|
|
+ instance
|
|
|
+ } = event.detail;
|
|
|
+ instance.close();
|
|
|
+ },
|
|
|
+ /* 删除提报 */
|
|
|
+ deleteProject(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset, that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: `是否确认删除${item.projectname}`,
|
|
|
+ success({
|
|
|
+ confirm
|
|
|
+ }) {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "id": 20220908134803,
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sa_salesforecastbillid": item.sa_salesforecastbillid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ let arr = that.data.list.filter(v => v.sa_salesforecastbillid != item.sa_salesforecastbillid);
|
|
|
+ that.setData({
|
|
|
+ list: arr
|
|
|
+ })
|
|
|
+ wx.showToast({
|
|
|
+ title: '删除成功',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onShareAppMessage() {}
|
|
|
})
|