| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- tabsActive: 0, //tabs 选中项
- sys_taskid: "",
- detail: '',
- tabsList: [{
- label: "详细信息",
- icon: "icon-tabxiangxixinxi1"
- }, {
- label: "跟进动态",
- icon: "icon-tabgenjinjilu"
- }, {
- label: "操作",
- icon: "icon-tabcaozuojilu1"
- }, {
- label: "附件",
- icon: "icon-tabfujian1"
- }],
- tabbarList: [],
- confirmShow: false,
- finishnotes: "", //完成说明
- },
- /* 完成情况说明输入 */
- areaInput(e) {
- this.setData({
- finishnotes: e.detail.value
- })
- },
- onConfirm(e) {
- console.log(this.data.finishnotes)
- _Http.basic({
- "id": 20221211112501,
- "content": {
- "sys_taskid": this.data.sys_taskid,
- "finishnotes": this.data.finishnotes
- }
- }).then(res => {
- console.log("完成情况说明", res)
- wx.showToast({
- title: res.msg == '成功' ? "提交成功" : res.msg,
- icon: "none"
- })
- if (res.msg == '成功') setTimeout(this.getDetail, 500)
- })
- },
- /* 取消提交说明 */
- onCancel(e) {
- this.setData({
- confirmShow: false
- })
- },
- onLoad(options) {
- this.setData({
- sys_taskid: options.id
- });
- this.getDetail();
- },
- getDetail() {
- _Http.basic({
- "id": 20221211111901,
- "content": {
- "nocache": true,
- "sys_taskid": this.data.sys_taskid
- },
- }).then(res => {
- console.log("任务详情", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- let isCreateby = res.data.createuserid == wx.getStorageSync('userMsg').userid,
- tabbarList = [{
- icon: "icon-genjin",
- label: "跟进"
- }, {
- icon: "icon-dibu-chengjiao",
- label: "完成"
- }];
- if (isCreateby) tabbarList.splice(1, 0, {
- icon: "icon-guanlian-bianji",
- label: "编辑"
- })
- this.setData({
- tabbarList,
- detail: res.data,
- briefs: [{
- label: "任务要求",
- value: res.data.remarks
- }, {
- label: "开始时间",
- value: res.data.starttime
- }, {
- label: "截止时间",
- value: res.data.endtime
- },
- {
- label: '关联页数数据',
- value: res.data.allocationstatus
- },
- {
- label: '状态',
- value: res.data.status
- }
- ],
- list1: [{
- label: "任务要求",
- value: res.data.remarks
- },
- {
- label: "开始时间",
- value: res.data.starttime
- },
- {
- label: "截止时间",
- value: res.data.endtime
- },
- {
- label: '关联页数数据',
- value: res.data.allocationstatus
- },
- {
- label: '状态',
- value: res.data.status
- }
- ],
- list2: [{
- label: "创建人",
- value: res.data.createby
- }, {
- label: "创建时间",
- value: res.data.createdate
- }, {
- label: "最近编辑人",
- value: res.data.changeby
- }, {
- label: "最近编辑时间",
- value: res.data.changedate
- }, {
- label: "转手次数",
- value: res.data.leader[0].leadernum
- }]
- });
- /* 更新列表中状态 */
- let page = getCurrentPages().find(v => v.__route__ == 'packageA/saleClue/index');
- if (page) {
- let index = page.data.list.findIndex(v => v.sys_taskid == res.data.sys_taskid);
- if (index != -1) page.setData({
- [`list[${index}].status`]: res.data.status,
- [`list[${index}].title`]: res.data.title,
- [`list[${index}].remarks`]: res.data.remarks
- })
- } else {
- let pages = getCurrentPages(),
- p = pages[pages.length - 2].selectComponent("#Work");
- if (p) {
- let index = p.data.list.findIndex(v => v.sys_taskid == res.data.sys_taskid);
- if (index != -1) p.setData({
- [`list[${index}].status`]: res.data.status,
- [`list[${index}].title`]: res.data.title,
- [`list[${index}].remarks`]: res.data.remarks
- })
- }
- }
- this.getTags();
- this.getGroup();
- this.partialRenewal();
- })
- },
- //tabs 切换
- tabsChange({
- detail
- }) {
- this.setData({
- tabsActive: detail
- });
- this.partialRenewal();
- },
- //更新标签
- getTags() {
- this.selectComponent("#Tags").getTags();
- },
- //更新团队成员
- getGroup() {
- this.selectComponent("#Group").getList();
- },
- onClose() {
- this.setData({
- show: false
- });
- },
- //局部数据更新 tabs
- partialRenewal(init = false) {
- let id = this.data.detail.sys_taskid;
- let model = '';
- let name = this.data.tabsList[this.data.tabsActive].label;
- switch (name) {
- case "操作":
- model = "#Record"
- break;
- case "跟进动态":
- model = "#Trace"
- break;
- case "附件":
- model = "#Files"
- break;
- };
- if (model) {
- // 确定好模块ID total = null 是第一次加载 加载数据
- // init是新增或修改需要清数据
- let Component = this.selectComponent(model);
- const {
- total,
- pageNumber,
- pageTotal
- } = Component.data.content;
- if (total == null || init) {
- Component.getList(id, init);
- } else if (pageNumber <= pageTotal) {
- Component.getList(id, false);
- } else {
- //用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据
- }
- }
- },
- onReachBottom() {
- this.partialRenewal();
- },
- //详情按钮回调
- tabbarOnClick({
- detail
- }) {
- switch (detail.label) {
- case "编辑":
- let group = this.selectComponent("#Group").query();
- wx.navigateTo({
- url: `/packageA/work/add?data=${JSON.stringify(this.data.detail)}&group=${JSON.stringify(group)}`,
- })
- break;
- case "完成":
- this.setData({
- confirmShow: true
- })
- break;
- case "跟进":
- wx.navigateTo({
- url: `/packageA/setclient/modules/trace/add/index?ownertable=sys_task&ownerid=${this.data.sys_taskid}`,
- })
- break;
- }
- },
- onShareAppMessage() {}
- })
|