xiaohaizhao 3 anni fa
parent
commit
0cbdcc84cc

+ 3 - 7
packageA/opponent/add.js

@@ -70,11 +70,7 @@ Page({
             this.setData({
                 disabled: false,
                 form: this.data.form.map(v => {
-                    if (v.valueName != 'region') {
-                        v.value = data[v.valueName];
-                    } else {
-                        v.value = data.province ? [data.province, data.city, data.county] : []
-                    }
+                    v.value = data.province ? [data.province, data.city, data.county] : []
                     return v
                 }),
                 "content.sa_competitorid": data.sa_competitorid,
@@ -145,7 +141,7 @@ Page({
         }); */
         let res = await this.handleQueryRepetition({
             ...data,
-            sa_competitorid: this.data.sa_competitorid||'0'
+            sa_competitorid: this.data.sa_competitorid || '0'
         });
         console.log("查询重复", res)
         if (res.msg != '成功') return wx.showToast({
@@ -196,7 +192,7 @@ Page({
         let data = this.selectComponent("#Form").submit();
         let query = await this.handleQueryRepetition({
             ...data,
-            sa_competitorid: this.data.sa_competitorid||'0'
+            sa_competitorid: this.data.sa_competitorid || '0'
         });
         if (query.total != 0) {
             wx.showToast({

+ 6 - 0
packageA/project/addAndEdit.js

@@ -216,6 +216,9 @@ Page({
             title: `您还未填写项目名称`,
             icon: "none"
         }); */
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
         let res = await this.handleQueryRepetition({
             sa_projectid: this.data.sa_projectid,
             ...data
@@ -283,6 +286,9 @@ Page({
     },
     async submit() {
         let data = this.selectComponent("#Form").submit();
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
         let query = await this.handleQueryRepetition({
             sa_projectid: this.data.sa_projectid,
             ...data

+ 82 - 18
packageA/project/detail.js

@@ -7,6 +7,7 @@ const _Http = getApp().globalData.http,
 Page({
     data: {
         isLeader: false, //是否为负责人
+        isRecover: false, //关闭弹窗是否恢复项目
         tabsActive: 0, //tabs 选中项
         sa_projectid: "",
         tabsList: [{
@@ -300,25 +301,38 @@ Page({
                     title: '失败项目才可恢复!',
                     icon: "none"
                 });
-                wx.showModal({
-                    title: '提示',
-                    content: '是否确认恢复项目',
-                    complete: ({
-                        confirm
-                    }) => {
-                        if (confirm) _Http.basic({
-                            "id": 20221215164002,
-                            "content": {
-                                "sa_projectid": data.sa_projectid
+                _Http.basic({
+                    "id": 20221208184202,
+                    "content": {
+                        ...data,
+                        pageSize: 999
+                    }
+                }).then(res => {
+                    console.log("查看重复", res)
+                    if (res.msg != '成功') return wx.showToast({
+                        title: res.msg,
+                        icon: "none"
+                    });
+                    if (res.data.length == 0) {
+                        wx.showModal({
+                            title: '提示',
+                            content: '是否确认恢复项目',
+                            complete: ({
+                                confirm
+                            }) => {
+                                if (confirm) that.onRecover()
                             }
-                        }).then(res => {
-                            console.log('恢复', res)
-                            wx.showToast({
-                                title: res.msg == '成功' ? '已恢复' : res.msg,
-                                icon: "none"
-                            });
-                            if (res.msg == '成功') setTimeout(this.getDetail, 300);
                         })
+                    } else {
+                        wx.showToast({
+                            title: '查询到有疑似重复项目',
+                            icon: "none"
+                        })
+                        this.setData({
+                            repetitionList: res.data,
+                            repetitionShow: true,
+                            isRecover: true
+                        });
                     }
                 })
                 break;
@@ -433,9 +447,59 @@ Page({
                 break;
         }
     },
+    /* 恢复项目 */
+    onRecover() {
+        _Http.basic({
+            "id": 20221215164002,
+            "content": {
+                "sa_projectid": this.data.sa_projectid
+            }
+        }).then(res => {
+            console.log('恢复', res)
+            wx.showToast({
+                title: res.msg == '成功' ? '已恢复' : res.msg,
+                icon: "none",
+                mask: true
+            });
+            if (res.msg == '成功') setTimeout(this.getDetail, 300);
+        })
+    },
+    /* 关闭查重弹窗 */
     repClose() {
+        let that = this;
+        if (this.data.isRecover) wx.showModal({
+            title: '提示',
+            content: '存在重复项目,是否确认恢复',
+            complete: ({
+                confirm
+            }) => {
+                if (confirm) {
+                    that.onRecover(true)
+                    let {
+                        datatag,
+                        systemtag
+                    } = this.selectComponent("#Tags").returnTags();
+                    if (!systemtag.some(v => v == '疑似重复')) {
+                        systemtag.push("疑似重复")
+                        _Http.basic({
+                            "id": 20220929090901,
+                            "content": {
+                                "ownertable": "sa_project",
+                                "ownerid": that.data.sa_projectid,
+                                datatag,
+                                systemtag
+                            }
+                        }).then(res => {
+                            console.log("绑定疑似重复标签", res)
+                            if (res.msg == '成功') that.getTags();
+                        })
+                    }
+                }
+            }
+        });
         this.setData({
-            repetitionShow: false
+            repetitionShow: false,
+            isRecover: false
         })
     },
     /* 1提交报备,2报备审核,3报备驳回(退回) */

+ 7 - 0
packageA/publicCustomer/addAndEditor.js

@@ -305,6 +305,10 @@ Page({
             title: `您还未填写企业名称`,
             icon: "none"
         }); */
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
+
         let res = await this.handleQueryRepetition({
             sa_customersid: this.data.content.sa_customersid,
             ...data
@@ -356,6 +360,9 @@ Page({
     },
     async submit() {
         let data = this.selectComponent("#Form").submit();
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
         let query = await this.handleQueryRepetition({
             sa_customersid: this.data.content.sa_customersid,
             ...data

+ 6 - 0
packageA/saleClue/translate.js

@@ -296,6 +296,9 @@ Page({
             title: `您还未填写企业名称`,
             icon: "none"
         }); */
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
         let res = await this.handleQueryRepetition({
             sa_customersid: this.data.content.sa_customersid || 0,
             ...data
@@ -347,6 +350,9 @@ Page({
     },
     async submit() {
         let data = this.selectComponent("#Form").submit();
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
         let query = await this.handleQueryRepetition({
             sa_customersid: this.data.content.sa_customersid || 0,
             ...data

+ 6 - 0
packageA/setclient/addAndEditor.js

@@ -301,6 +301,9 @@ Page({
             title: `您还未填写企业名称`,
             icon: "none"
         }); */
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
         let res = await this.handleQueryRepetition({
             sa_customersid: this.data.content.sa_customersid,
             ...data
@@ -352,6 +355,9 @@ Page({
     },
     async submit() {
         let data = this.selectComponent("#Form").submit();
+        data.province = data.region[0] || "";
+        data.city = data.region[1] || "";
+        data.county = data.region[2] || "";
         let query = await this.handleQueryRepetition({
             sa_customersid: this.data.content.sa_customersid,
             ...data