|
|
@@ -1,230 +1,230 @@
|
|
|
let _Http = getApp().globalData.http,
|
|
|
- currency = require("../../utils/currency"),
|
|
|
- CNY = value => currency(value, {
|
|
|
- symbol: "¥",
|
|
|
- precision: 2
|
|
|
- }).format();
|
|
|
+ currency = require("../../utils/currency"),
|
|
|
+ CNY = value => currency(value, {
|
|
|
+ symbol: "¥",
|
|
|
+ precision: 2
|
|
|
+ }).format();
|
|
|
|
|
|
Page({
|
|
|
- data: {
|
|
|
- showFiltrate: false,
|
|
|
- pageIndex: 0,
|
|
|
- admin: false,
|
|
|
- tabsActive: 0,
|
|
|
- active: null,
|
|
|
- tabbarList: [{
|
|
|
- icon: "icon-guanlian-bianji",
|
|
|
- label: "添加项目"
|
|
|
- }, {
|
|
|
- icon: "icon-guanlian-fuzhi",
|
|
|
- label: "移除项目"
|
|
|
- }],
|
|
|
- "content": {
|
|
|
- "type": 1,
|
|
|
- "dataid": 0,
|
|
|
- "baseonproject": 1,
|
|
|
- "title": ""
|
|
|
- },
|
|
|
- isonlydep: false
|
|
|
+ data: {
|
|
|
+ showFiltrate: false,
|
|
|
+ pageIndex: 0,
|
|
|
+ admin: false,
|
|
|
+ tabsActive: 0,
|
|
|
+ active: null,
|
|
|
+ tabbarList: [{
|
|
|
+ icon: "icon-guanlian-bianji",
|
|
|
+ label: "添加项目"
|
|
|
+ }, {
|
|
|
+ icon: "icon-guanlian-fuzhi",
|
|
|
+ label: "移除项目"
|
|
|
+ }],
|
|
|
+ "content": {
|
|
|
+ "type": 1,
|
|
|
+ "dataid": 0,
|
|
|
+ "baseonproject": 1,
|
|
|
+ "title": ""
|
|
|
},
|
|
|
- onLoad(options) {
|
|
|
- this.setData({
|
|
|
- sa_salesforecastbillid: options.id
|
|
|
- })
|
|
|
- if (options.admin == 'true') {
|
|
|
- this.setData({
|
|
|
- admin: true
|
|
|
- })
|
|
|
- _Http.basic({
|
|
|
- "id": 20230620102004,
|
|
|
- "content": {
|
|
|
- unLeave: 1
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("获取下级部门和下级人员", res)
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- let data = {
|
|
|
- label: "查询范围",
|
|
|
- showName: "name", //显示字段
|
|
|
- valueKey: "active", //返回Key
|
|
|
- value: "id", //选中值
|
|
|
- list: res.data.hr.map(v => {
|
|
|
- v.id = v.userid;
|
|
|
- v.type = '人员'
|
|
|
- delete(v.rowindex)
|
|
|
- delete(v.userid)
|
|
|
- return v
|
|
|
- })
|
|
|
- };
|
|
|
- const mflat = (v, prefix) => {
|
|
|
- v.subdep.forEach(s => mflat(s, v.depname));
|
|
|
- v.name = v.depname;
|
|
|
- v.type = '部门';
|
|
|
- v.id = v.departmentid;
|
|
|
- delete(v.depname)
|
|
|
- delete(v.departmentid)
|
|
|
- delete(v.parentid)
|
|
|
- delete(v.rowindex)
|
|
|
- delete(v.subdep)
|
|
|
- data.list.unshift(v)
|
|
|
- };
|
|
|
- res.data.dep.forEach(v => mflat(v))
|
|
|
- this.setData({
|
|
|
- "filtratelist[0]": data
|
|
|
- });
|
|
|
- });
|
|
|
+ isonlydep: false
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ sa_salesforecastbillid: options.id
|
|
|
+ })
|
|
|
+ if (options.admin == 'true') {
|
|
|
+ this.setData({
|
|
|
+ admin: true
|
|
|
+ })
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230620102004,
|
|
|
+ "content": {
|
|
|
+ unLeave: 1
|
|
|
}
|
|
|
- let tabsList = [{
|
|
|
- label: "项目产品清单",
|
|
|
- icon: "icon-tabchanpin",
|
|
|
- model: "#Project"
|
|
|
- }, {
|
|
|
- label: "附件",
|
|
|
- icon: "icon-tabfujian1",
|
|
|
- model: "#Files"
|
|
|
- }, {
|
|
|
- label: "操作记录",
|
|
|
- icon: "icon-tabcaozuojilu1",
|
|
|
- model: "#Record"
|
|
|
- }];
|
|
|
-
|
|
|
- const {
|
|
|
- isdatafollowup,
|
|
|
- istask,
|
|
|
- isdatatag,
|
|
|
- isdatateam
|
|
|
- } = wx.getStorageSync('auth')[options.admin == 'true' ? 'finishforecastadmin' : 'finishforecast'];
|
|
|
-
|
|
|
- console.log(wx.getStorageSync('auth')[options.admin == 'true' ? 'finishforecastadmin' : 'finishforecast'])
|
|
|
- if (isdatafollowup) tabsList.push({
|
|
|
- label: "跟进动态",
|
|
|
- icon: "icon-tabgenjinjilu",
|
|
|
- model: "#Trace"
|
|
|
+ }).then(res => {
|
|
|
+ console.log("获取下级部门和下级人员", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
})
|
|
|
- if (istask) tabsList.push({
|
|
|
- label: "任务",
|
|
|
- icon: "icon-tabrenwu",
|
|
|
- model: "#Work"
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- tabsList,
|
|
|
- isdatatag,
|
|
|
- isdatateam
|
|
|
- })
|
|
|
- this.getDetail();
|
|
|
- if (isdatatag) this.getTags();
|
|
|
- if (isdatateam) this.getGroup()
|
|
|
- this.partialRenewal();
|
|
|
- },
|
|
|
- switchOnChange({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- this.setData({
|
|
|
- isonlydep: detail
|
|
|
- });
|
|
|
- if (detail) {
|
|
|
- this.setData({
|
|
|
- active: null,
|
|
|
- "content.type": 1,
|
|
|
- "content.dataid": 0,
|
|
|
- });
|
|
|
+ let data = {
|
|
|
+ label: "查询范围",
|
|
|
+ showName: "name", //显示字段
|
|
|
+ valueKey: "active", //返回Key
|
|
|
+ value: "id", //选中值
|
|
|
+ list: res.data.hr.map(v => {
|
|
|
+ v.id = v.userid;
|
|
|
+ v.type = '人员'
|
|
|
+ delete(v.rowindex)
|
|
|
+ delete(v.userid)
|
|
|
+ return v
|
|
|
+ })
|
|
|
};
|
|
|
- this.getRests();
|
|
|
- },
|
|
|
- /* 切换 */
|
|
|
- onChange(e) {
|
|
|
+ const mflat = (v, prefix) => {
|
|
|
+ v.subdep.forEach(s => mflat(s, v.depname));
|
|
|
+ v.name = v.depname;
|
|
|
+ v.type = '部门';
|
|
|
+ v.id = v.departmentid;
|
|
|
+ delete(v.depname)
|
|
|
+ delete(v.departmentid)
|
|
|
+ delete(v.parentid)
|
|
|
+ delete(v.rowindex)
|
|
|
+ delete(v.subdep)
|
|
|
+ data.list.unshift(v)
|
|
|
+ };
|
|
|
+ res.data.dep.forEach(v => mflat(v))
|
|
|
this.setData({
|
|
|
- pageIndex: e.detail.index
|
|
|
- })
|
|
|
- },
|
|
|
- openFiltrate() {
|
|
|
+ "filtratelist[0]": data
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let tabsList = [{
|
|
|
+ label: "项目产品清单",
|
|
|
+ icon: "icon-tabchanpin",
|
|
|
+ model: "#Project"
|
|
|
+ }, {
|
|
|
+ label: "附件",
|
|
|
+ icon: "icon-tabfujian1",
|
|
|
+ model: "#Files"
|
|
|
+ }, {
|
|
|
+ label: "操作记录",
|
|
|
+ icon: "icon-tabcaozuojilu1",
|
|
|
+ model: "#Record"
|
|
|
+ }];
|
|
|
+
|
|
|
+ const {
|
|
|
+ isdatafollowup,
|
|
|
+ istask,
|
|
|
+ isdatatag,
|
|
|
+ isdatateam
|
|
|
+ } = wx.getStorageSync('auth')[options.admin == 'true' ? 'finishforecastadmin' : 'finishforecast'];
|
|
|
+
|
|
|
+ console.log(wx.getStorageSync('auth')[options.admin == 'true' ? 'finishforecastadmin' : 'finishforecast'])
|
|
|
+ if (isdatafollowup) tabsList.push({
|
|
|
+ label: "跟进动态",
|
|
|
+ icon: "icon-tabgenjinjilu",
|
|
|
+ model: "#Trace"
|
|
|
+ })
|
|
|
+ if (istask) tabsList.push({
|
|
|
+ label: "任务",
|
|
|
+ icon: "icon-tabrenwu",
|
|
|
+ model: "#Work"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ tabsList,
|
|
|
+ isdatatag,
|
|
|
+ isdatateam
|
|
|
+ })
|
|
|
+ this.getDetail();
|
|
|
+ if (isdatatag) this.getTags();
|
|
|
+ if (isdatateam) this.getGroup()
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ switchOnChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ isonlydep: detail
|
|
|
+ });
|
|
|
+ if (detail) {
|
|
|
+ this.setData({
|
|
|
+ active: null,
|
|
|
+ "content.type": 1,
|
|
|
+ "content.dataid": 0,
|
|
|
+ });
|
|
|
+ };
|
|
|
+ this.getRests();
|
|
|
+ },
|
|
|
+ /* 切换 */
|
|
|
+ onChange(e) {
|
|
|
+ this.setData({
|
|
|
+ pageIndex: e.detail.index
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openFiltrate() {
|
|
|
+ this.setData({
|
|
|
+ showFiltrate: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleFilter(e) {
|
|
|
+ let {
|
|
|
+ active
|
|
|
+ } = e.detail;
|
|
|
+ try {
|
|
|
+ if (active.type) this.setData({
|
|
|
+ active,
|
|
|
+ 'content.type': active.type == '人员' ? 0 : 1,
|
|
|
+ 'content.dataid': active.id || 0,
|
|
|
+ isonlydep: false
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ this.setData({
|
|
|
+ active: null,
|
|
|
+ 'content.type': 1,
|
|
|
+ 'content.dataid': 0,
|
|
|
+ isonlydep: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.getRests();
|
|
|
+ },
|
|
|
+ getRests() {
|
|
|
+ let content = this.data.content;
|
|
|
+ content.isonlydep = this.data.isonlydep ? 1 : 0
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230705144804,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("其他预测单", res)
|
|
|
+ if (res.msg != '成功') wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.data.allprojectamount) res.data.allprojectamount = CNY(res.data.allprojectamount)
|
|
|
+ res.data.data = res.data.data.filter(v => v.sa_salesforecastbillid).map(v => {
|
|
|
+ v.showAmount = CNY(v.projectamount)
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ rests: res.data
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDetail() {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230705144704,
|
|
|
+ "content": {
|
|
|
+ "sa_salesforecastbillid": this.data.sa_salesforecastbillid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("预测详情", res)
|
|
|
+ if (res.msg != '成功') wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ res.data.projectamount = CNY(res.data.projectamount)
|
|
|
+ this.setData({
|
|
|
+ detail: res.data,
|
|
|
+ 'content.title': res.data.title,
|
|
|
+ isLeader: res.data.userid == wx.getStorageSync('userMsg').userid
|
|
|
+ });
|
|
|
+ if (!this.data.isLeader) getApp().agentOrNot("sa_salesforecastbill", this.data.sa_salesforecastbillid).then(s => {
|
|
|
+ console.log("代理人数据", s)
|
|
|
this.setData({
|
|
|
- showFiltrate: true
|
|
|
+ isLeader: s.data.editable == 1 || this.selectComponent("#Group").data.editable == 1
|
|
|
})
|
|
|
- },
|
|
|
- handleFilter(e) {
|
|
|
- let {
|
|
|
- active
|
|
|
- } = e.detail;
|
|
|
- try {
|
|
|
- if (active.type) this.setData({
|
|
|
- active,
|
|
|
- 'content.type': active.type == '人员' ? 0 : 1,
|
|
|
- 'content.dataid': active.id || 0,
|
|
|
- isonlydep: false
|
|
|
- });
|
|
|
- } catch (error) {
|
|
|
- this.setData({
|
|
|
- active: null,
|
|
|
- 'content.type': 1,
|
|
|
- 'content.dataid': 0,
|
|
|
- isonlydep: false
|
|
|
- })
|
|
|
- }
|
|
|
- this.getRests();
|
|
|
- },
|
|
|
- getRests() {
|
|
|
- let content = this.data.content;
|
|
|
- content.isonlydep = this.data.isonlydep ? 1 : 0
|
|
|
- _Http.basic({
|
|
|
- "id": 20230705144804,
|
|
|
- content
|
|
|
- }).then(res => {
|
|
|
- console.log("其他预测单", res)
|
|
|
- if (res.msg != '成功') wx.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- if (res.data.allprojectamount) res.data.allprojectamount = CNY(res.data.allprojectamount)
|
|
|
- res.data.data = res.data.data.filter(v => v.sa_salesforecastbillid).map(v => {
|
|
|
- v.showAmount = CNY(v.projectamount)
|
|
|
- return v
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- rests: res.data
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- getDetail() {
|
|
|
- _Http.basic({
|
|
|
- "id": 20230705144704,
|
|
|
- "content": {
|
|
|
- "sa_salesforecastbillid": this.data.sa_salesforecastbillid
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("预测详情", res)
|
|
|
- if (res.msg != '成功') wx.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- res.data.projectamount = CNY(res.data.projectamount)
|
|
|
- this.setData({
|
|
|
- detail: res.data,
|
|
|
- 'content.title': res.data.title,
|
|
|
- isLeader: res.data.userid == wx.getStorageSync('userMsg').userid
|
|
|
- });
|
|
|
- if (!this.data.isLeader) getApp().agentOrNot("sa_salesforecastbill", this.data.sa_salesforecastbillid).then(s => {
|
|
|
- console.log("代理人数据", s)
|
|
|
- this.setData({
|
|
|
- isLeader: s.data.editable == 1 || this.selectComponent("#Group").data.editable == 1
|
|
|
- })
|
|
|
- })
|
|
|
- if (this.data.admin) this.getRests();
|
|
|
- })
|
|
|
- },
|
|
|
- tabbarOnClick({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- switch (detail.label) {
|
|
|
- case "添加项目":
|
|
|
- this.toAddProject();
|
|
|
- break;
|
|
|
- case "移除项目":
|
|
|
- wx.navigateTo({
|
|
|
- url: `/packageA/select/project/select2?params=${JSON.stringify({
|
|
|
+ })
|
|
|
+ if (this.data.admin) this.getRests();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ tabbarOnClick({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ switch (detail.label) {
|
|
|
+ case "添加项目":
|
|
|
+ this.toAddProject();
|
|
|
+ break;
|
|
|
+ case "移除项目":
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/packageA/select/project/select2?params=${JSON.stringify({
|
|
|
"id": "20230705144904",
|
|
|
"content": {
|
|
|
nocache: true,
|
|
|
@@ -235,23 +235,23 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
})}&radio=true`,
|
|
|
- })
|
|
|
- getApp().globalData.handleSelect = this.deteleProject.bind(this);
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
- //tabs 切换
|
|
|
- tabsChange({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- this.setData({
|
|
|
- tabsActive: detail
|
|
|
- });
|
|
|
- this.partialRenewal();
|
|
|
- },
|
|
|
- toAddProject() {
|
|
|
- wx.navigateTo({
|
|
|
- url: `/packageA/select/project/select2?params=${JSON.stringify({
|
|
|
+ })
|
|
|
+ getApp().globalData.handleSelect = this.deteleProject.bind(this);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //tabs 切换
|
|
|
+ tabsChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ tabsActive: detail
|
|
|
+ });
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ toAddProject() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/packageA/select/project/select2?params=${JSON.stringify({
|
|
|
"id": 20230705145604,
|
|
|
"content": {
|
|
|
nocache:true,
|
|
|
@@ -261,144 +261,144 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
})}`,
|
|
|
- });
|
|
|
- getApp().globalData.handleSelect = this.addProject.bind(this);
|
|
|
- },
|
|
|
- /* 添加项目 */
|
|
|
- addProject({
|
|
|
- list
|
|
|
- }) {
|
|
|
- let that = this;
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: `是否确认添加${list.length}个项目`,
|
|
|
- complete: ({
|
|
|
- confirm
|
|
|
- }) => {
|
|
|
- if (confirm) _Http.basic({
|
|
|
- id: 20230705145104,
|
|
|
- content: {
|
|
|
- sa_salesforecastbillid: that.data.sa_salesforecastbillid,
|
|
|
- "ownertable": "sa_project",
|
|
|
- salesforecastproject: list.map(v => {
|
|
|
- return {
|
|
|
- ownerid: v.sa_projectid,
|
|
|
- ownertable: "sa_project",
|
|
|
- discountrate: v.discountrate,
|
|
|
- sa_salesforecastprojectid: 0
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("添加项目", res)
|
|
|
- wx.showToast({
|
|
|
- title: res.msg == '成功' ? '添加成功' : res.msg,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- if (res.msg == '成功') {
|
|
|
- that.setData({
|
|
|
- tabsActive: that.data.tabsList.findIndex(v => v.label == '项目产品清单')
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- wx.navigateBack();
|
|
|
- setTimeout(() => {
|
|
|
- that.selectComponent('#Project').getList(that.data.sa_salesforecastbillid, false);
|
|
|
- }, 300)
|
|
|
- }, 300)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- /* 删除项目 */
|
|
|
- deteleProject({
|
|
|
- item
|
|
|
- }) {
|
|
|
- let that = this;
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: `是否确认移除“${item.projectname}”`,
|
|
|
- complete: ({
|
|
|
- confirm
|
|
|
- }) => {
|
|
|
- if (confirm) _Http.basic({
|
|
|
- "id": 20230705145304,
|
|
|
- "content": {
|
|
|
- "sa_salesforecastbillid": that.data.sa_salesforecastbillid,
|
|
|
- "sa_salesforecastprojectids": [item.sa_salesforecastprojectid]
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("移除项目", res)
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- that.selectComponent("#Project").getList(that.data.sa_salesforecastbillid);
|
|
|
- setTimeout(() => {
|
|
|
- wx.showToast({
|
|
|
- title: `已移除“${item.projectname}”`,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- let page = getCurrentPages().find(v => v.__route__ == 'packageA/select/project/select2');
|
|
|
- if (page) page.deteleItem(item.sa_projectid);
|
|
|
- that.getDetail();
|
|
|
- }, 500)
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- //更新标签
|
|
|
- getTags() {
|
|
|
- this.selectComponent("#Tags").getTags();
|
|
|
- },
|
|
|
- //局部数据更新 tabs
|
|
|
- partialRenewal(init = false) {
|
|
|
- let model = this.data.tabsList[this.data.tabsActive].model;
|
|
|
- if (model) {
|
|
|
- let Component = this.selectComponent(model),
|
|
|
- {
|
|
|
- total,
|
|
|
- pageNumber,
|
|
|
- pageTotal
|
|
|
- } = Component.data.content,
|
|
|
- id = this.data.sa_salesforecastbillid;
|
|
|
- if (total == null || init) {
|
|
|
- Component.getList(id, init);
|
|
|
- } else if (pageNumber <= pageTotal) {
|
|
|
- Component.getList(id, false);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- onReachBottom() {
|
|
|
- this.partialRenewal();
|
|
|
- },
|
|
|
- //更新团队成员
|
|
|
- getGroup() {
|
|
|
- this.selectComponent("#Group").getList().then(res => {
|
|
|
- this.setData({
|
|
|
- isLeader: this.selectComponent("#Group").data.editable == 1
|
|
|
+ });
|
|
|
+ getApp().globalData.handleSelect = this.addProject.bind(this);
|
|
|
+ },
|
|
|
+ /* 添加项目 */
|
|
|
+ addProject({
|
|
|
+ list
|
|
|
+ }) {
|
|
|
+ let that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认添加${list.length}个项目`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ id: 20230705145104,
|
|
|
+ content: {
|
|
|
+ sa_salesforecastbillid: that.data.sa_salesforecastbillid,
|
|
|
+ "ownertable": "sa_project",
|
|
|
+ salesforecastproject: list.map(v => {
|
|
|
+ return {
|
|
|
+ ownerid: v.sa_projectid,
|
|
|
+ ownertable: "sa_project",
|
|
|
+ discountrate: v.discountrate,
|
|
|
+ sa_salesforecastprojectid: 0
|
|
|
+ }
|
|
|
})
|
|
|
- });
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- let page = getCurrentPages()[getCurrentPages().length - 2];
|
|
|
- if (page.getRests) return page.getRests();
|
|
|
- let content = JSON.parse(JSON.stringify(page.data.content));
|
|
|
- content.pageSize = (content.pageNumber - 1) * content.pageSize;
|
|
|
- content.pageNumber = 1;
|
|
|
- _Http.basic({
|
|
|
- id: page.data.admin ? 20230705144604 : 20230706092304,
|
|
|
- content
|
|
|
+ }
|
|
|
}).then(res => {
|
|
|
- console.log("更新预测", res);
|
|
|
- res.data = res.data.map(v => {
|
|
|
- v.showAmount = CNY(v.projectamount)
|
|
|
- return v
|
|
|
- })
|
|
|
- if (res.msg == '成功') page.setData({
|
|
|
- list: res.data,
|
|
|
- "content.total": res.total
|
|
|
+ console.log("添加项目", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? '添加成功' : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ that.setData({
|
|
|
+ tabsActive: that.data.tabsList.findIndex(v => v.label == '项目产品清单')
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateBack();
|
|
|
+ setTimeout(() => {
|
|
|
+ that.selectComponent('#Project').getList(that.data.sa_salesforecastbillid, false);
|
|
|
+ }, 300)
|
|
|
+ }, 300)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 删除项目 */
|
|
|
+ deteleProject({
|
|
|
+ item
|
|
|
+ }) {
|
|
|
+ let that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认移除“${item.projectname}”`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "id": 20230705145304,
|
|
|
+ "content": {
|
|
|
+ "sa_salesforecastbillid": that.data.sa_salesforecastbillid,
|
|
|
+ "sa_salesforecastprojectids": [item.sa_salesforecastprojectid]
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("移除项目", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ that.selectComponent("#Project").getList(that.data.sa_salesforecastbillid);
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.showToast({
|
|
|
+ title: `已移除“${item.projectname}”`,
|
|
|
+ icon: "none"
|
|
|
})
|
|
|
+ let page = getCurrentPages().find(v => v.__route__ == 'packageA/select/project/select2');
|
|
|
+ if (page) page.deteleItem(item.sa_projectid);
|
|
|
+ that.getDetail();
|
|
|
+ }, 500)
|
|
|
})
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //更新标签
|
|
|
+ getTags() {
|
|
|
+ this.selectComponent("#Tags").getTags();
|
|
|
+ },
|
|
|
+ //局部数据更新 tabs
|
|
|
+ partialRenewal(init = false) {
|
|
|
+ let model = this.data.tabsList[this.data.tabsActive].model;
|
|
|
+ if (model) {
|
|
|
+ let Component = this.selectComponent(model),
|
|
|
+ {
|
|
|
+ total,
|
|
|
+ pageNumber,
|
|
|
+ pageTotal
|
|
|
+ } = Component.data.content,
|
|
|
+ id = this.data.sa_salesforecastbillid;
|
|
|
+ if (total == null || init) {
|
|
|
+ Component.getList(id, init);
|
|
|
+ } else if (pageNumber <= pageTotal) {
|
|
|
+ Component.getList(id, false);
|
|
|
+ }
|
|
|
}
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ //更新团队成员
|
|
|
+ getGroup() {
|
|
|
+ this.selectComponent("#Group").getList().then(res => {
|
|
|
+ if (!this.data.isLeader) this.setData({
|
|
|
+ isLeader: this.selectComponent("#Group").data.editable == 1
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ let page = getCurrentPages()[getCurrentPages().length - 2];
|
|
|
+ if (page.getRests) return page.getRests();
|
|
|
+ let content = JSON.parse(JSON.stringify(page.data.content));
|
|
|
+ content.pageSize = (content.pageNumber - 1) * content.pageSize;
|
|
|
+ content.pageNumber = 1;
|
|
|
+ _Http.basic({
|
|
|
+ id: page.data.admin ? 20230705144604 : 20230706092304,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("更新预测", res);
|
|
|
+ res.data = res.data.map(v => {
|
|
|
+ v.showAmount = CNY(v.projectamount)
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ if (res.msg == '成功') page.setData({
|
|
|
+ list: res.data,
|
|
|
+ "content.total": res.total
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|