瀏覽代碼

客户/项目联系人点击直接加入

xiaohaizhao 1 年之前
父節點
當前提交
aa64e8be56

+ 29 - 0
packageA/project/modules/contacts/quickly/index.js

@@ -3,6 +3,7 @@ const _Http = getApp().globalData.http;
 Page({
     data: {
         content: {
+            loading: false,
             "ownertable": "sa_project",
             sa_projectid: "",
             nocache: true,
@@ -56,10 +57,38 @@ Page({
         })
     },
     onClick(e) {
+        if (this.data.loading) return;
         const {
             item
         } = e.currentTarget.dataset;
         delete(item.tag1)
+        item.sa_project_contactsid = 0;
+        item.sa_projectid = this.data.content.sa_projectid;
+        item.ownertable = "sa_project";
+        item.ownerid = item.sa_projectid;
+        this.data.loading = true;
+        _Http.basic({
+            "id": "20221219135502",
+            "content": item
+        }).then(res => {
+            console.log("添加项目联系人", res)
+            this.data.loading = false;
+            wx.showToast({
+                title: res.msg != '成功' ? res.msg : '添加成功',
+                icon: "none",
+                mask: true
+            })
+            if (res.msg == '成功') setTimeout(() => {
+                wx.navigateBack()
+                getCurrentPages().forEach(v => {
+                    if (v.__route__ == 'packageA/project/detail') {
+                        let page = v.selectComponent("#Contacts");
+                        page.getList(item.sa_projectid, true)
+                    }
+                });
+            }, 500)
+        })
+        return
         wx.redirectTo({
             url: `/packageA/project/modules/contacts/add/index?sa_projectid=${this.data.content.sa_projectid}&data=${JSON.stringify(item)}`,
         })

+ 36 - 1
packageA/setclient/modules/contacts/quickly/index.js

@@ -13,7 +13,8 @@ Page({
             }
         },
         list: [],
-        sa_customersid: 0
+        sa_customersid: 0,
+        loading: false
     },
     getList(init = false) {
         const content = this.data.content;
@@ -56,10 +57,44 @@ Page({
         })
     },
     onClick(e) {
+        if (this.data.loading) return;
         const {
             item
         } = e.currentTarget.dataset;
         delete(item.tag1)
+        item.sys_enterpriseid = this.data.content.ownerid;
+        this.data.loading = true;
+        _Http.basic({
+            "id": "20240531151704",
+            content: item
+        }).then(res => {
+            console.log("编辑联系人", res)
+            this.data.loading = false;
+            wx.showToast({
+                title: res.msg != '成功' ? res.msg : '添加成功',
+                icon: "none",
+                mask: true
+            });
+            if (res.msg == '成功') setTimeout(() => {
+                wx.navigateBack()
+                getCurrentPages().forEach(v => {
+                    if (v.__route__ == 'packageA/setclient/modules/contacts/detail/index' || v.__route__ == 'packageA/contacts/detail') {
+                        v.getDetail();
+                    } else if (v.selectComponent("#Contacts")) {
+                        let page = v.selectComponent("#Contacts");
+                        page.getList(page.data.content.sys_enterpriseid, true)
+                    } else if (v.__route__ == 'packageA/project/modules/contacts/search/index') {
+                        let index = v.data.list.findIndex(value => value.sys_phonebookid == res.data.sys_phonebookid);
+                        if (index != -1) v.setData({
+                            [`list[${index}]`]: res.data
+                        })
+                    }
+                });
+            }, 500)
+
+        });
+
+        return;
         wx.redirectTo({
             url: `/packageA/setclient/modules/contacts/add/index?sys_enterpriseid=${this.data.content.ownerid}&enterprisename=${this.data.enterprisename}&sa_customersid=${this.data.sa_customersid}&data=${JSON.stringify(item)}`,
         })