Sfoglia il codice sorgente

项目商机优化

zhaoxiaohai 3 anni fa
parent
commit
8ebc8bb39f

+ 11 - 4
packageA/project/detail.js

@@ -361,11 +361,16 @@ Page({
             "id": 20221114163402,
             "content": {
                 "sa_projectid": this.data.sa_projectid,
-                type 
+                type
             }
         }).then(res => {
             console.log("报备", type, res)
-            this.getDetail();
+            wx.showToast({
+                title: res.data == '失败' ? res.msg : "操作成功",
+                icon: "none",
+                mask: true
+            })
+            if (res.data != '失败') setTimeout(() => this.getDetail, 500)
         })
     },
     //局部数据更新 tabs
@@ -433,13 +438,15 @@ Page({
                     });
                     wx.showToast({
                         title: '更换成功!',
-                        icon: "none"
+                        icon: "none",
+                        mask: true
                     });
                     setTimeout(() => {
                         that.getDetail();
                         getCurrentPages().forEach(v => {
                             if (['packageA/project/index'].includes(v.__route__)) v.getList(true)
-                        })
+                        });
+                        that.getGroup();
                         wx.navigateBack();
                     }, 300)
                 })

+ 1 - 0
packageA/project/modules/contacts/add/index.js

@@ -40,6 +40,7 @@ Page({
             type: "route",
             url: "/packageA/project/modules/contacts/select/index",
             value: "",
+            query:"&radio=true",
             placeholder: "选择单位",
             valueName: "sys_enterpriseid",
             required: true,

+ 29 - 15
packageA/project/modules/contacts/select/index.js

@@ -18,12 +18,6 @@ Page({
     },
     onLoad(options) {
         /* 从表单组件进入进入 */
-        if (options.item) {
-            let item = JSON.parse(options.item);
-            this.setData({
-                item
-            })
-        };
         this.getList()
     },
     onChange(e) {
@@ -79,18 +73,38 @@ Page({
             })
         })
     },
+
     /* 选中 */
     changeResult(e) {
-        const {
+        let {
             id
-        } = e.currentTarget.dataset;
-
-        let pages = getCurrentPages();
-        let page = pages[pages.length - 2].selectComponent("#Form"),
-            item = this.data.item,
-            data = this.data.list.find(v => v.sys_enterpriseid == id);
-        item.value = [data.enterprisename, [id]];
-        page.handleRoute(item, [data]);
+        } = e.currentTarget.dataset, result = this.data.result;
+        if (this.data.radio) {
+            result = [id];
+        } else {
+            result.some(v => v == id) ? result = result.filter(v => v != id) : result.push(id)
+        }
+        this.setData({
+            result
+        });
+        this.submit();
+    },
+    /* 提交 */
+    submit() {
+        let result = this.data.result,
+            obj = this.data.radio ? {
+                id: result,
+                item: this.data.list.find(value => value.sys_enterpriseid == result),
+                value: [this.data.list.find(value => value.sys_enterpriseid == result).enterprisename, result]
+            } : {
+                result,
+                list: result.map(v => this.data.list.find(value => value.sys_enterpriseid == v)),
+                value: [result.map(v => {
+                    let data = this.data.list.find(value => value.sys_enterpriseid == v);
+                    return data ? data.enterprisename : ""
+                }), result]
+            }
+        getApp().globalData.handleSelect && getApp().globalData.handleSelect(obj)
     },
     /* 开始搜索 */
     startSearch({

+ 3 - 3
packageA/project/modules/opponent/index.js

@@ -57,11 +57,11 @@ Component({
             });
             getApp().globalData.handleSelect = this.handleSelect.bind(this);
         },
-        handleSelect(res) {
+        handleSelect({item}) {
             let that = this;
             wx.showModal({
                 title: '提示',
-                content: `是否将"${data.value[0]}"添加到竞争对手`,
+                content: `是否添加"${item.enterprisename}"为竞争对手`,
                 complete: ({
                     confirm
                 }) => {
@@ -70,7 +70,7 @@ Component({
                         "content": {
                             sa_project_competeid: 0,
                             "sa_projectid": that.data.sa_projectid, //工程项目表ID
-                            "sa_competitorid": data.value[1][0], //竞争对手ID
+                            "sa_competitorid":item.sa_competitorid, //竞争对手ID
                             "important": 0, //主要威胁 0/1
                         }
                     }).then(res => {