Procházet zdrojové kódy

销售预测权限配置

zhaoxiaohai před 3 roky
rodič
revize
5973e72212

+ 31 - 21
packageA/saleClue/detail.js

@@ -1,6 +1,9 @@
 const _Http = getApp().globalData.http;
 Page({
     data: {
+        isAdmin: getApp().globalData.auth.wCustomer.options.some(v => v == "admin"), //是否具有管理权限
+        isLeader: false, //是否为负责人
+
         tabsActive: 0, //tabs 选中项
         sat_orderclueid: "",
         detail: '',
@@ -20,24 +23,6 @@ Page({
         tabbarList: [{
             icon: "icon-genjin",
             label: "跟进"
-        }, {
-            icon: "icon-bianji",
-            label: "编辑"
-        }, {
-            icon: "icon-dibu-zhuanhuan",
-            label: "转化"
-        }, {
-            icon: "icon-zhuanyi",
-            label: "更换负责人"
-        }, {
-            icon: "icon-dibu-tuihui",
-            label: "退回"
-        }, {
-            icon: "icon-dibu-wuxiao",
-            label: "无效"
-        }, {
-            icon: "icon-dibu-jieshu",
-            label: "作废"
         }],
     },
     onLoad(options) {
@@ -61,7 +46,32 @@ Page({
                 title: res.msg,
                 icon: "none"
             });
+
+            let isLeader = res.data.leader.some(some => some.userid == wx.getStorageSync('userMsg').userid),
+                tabbarList = this.data.tabbarList;
+            if (this.data.isAdmin || isLeader) tabbarList = [{
+                icon: "icon-bianji",
+                label: "编辑"
+            }, {
+                icon: "icon-dibu-zhuanhuan",
+                label: "转化"
+            }, {
+                icon: "icon-zhuanyi",
+                label: "更换负责人"
+            }, {
+                icon: "icon-dibu-jieshu",
+                label: "作废"
+            }].concat(tabbarList);
+            if (isLeader) tabbarList = tabbarList.concat([{
+                icon: "icon-dibu-tuihui",
+                label: "退回"
+            }, {
+                icon: "icon-dibu-wuxiao",
+                label: "无效"
+            }])
             this.setData({
+                isLeader,
+                tabbarList,
                 detail: res.data,
                 briefs: [{
                         label: "联系人",
@@ -310,11 +320,11 @@ Page({
                         confirm
                     }) => {
                         if (confirm) _Http.basic({
-                            "id":20221207160802,
+                            "id": 20221207160802,
                             "content": {
-                              sat_orderclueid: this.data.detail.sat_orderclueid
+                                sat_orderclueid: this.data.detail.sat_orderclueid
                             }
-                          }).then(res => {
+                        }).then(res => {
                             if (res.msg == '成功') {
                                 that.getDetail();
                             }

+ 10 - 10
packageA/saleClue/index.js

@@ -6,13 +6,14 @@ Page({
      * 页面的初始数据
      */
     data: {
+        insert: getApp().globalData.auth.worderclue.options.some(v => v == 'insert'), //查询新增权限
         navList: [{
             label: "全部",
             icon: "icon-webxialaxuanxiangjiantou",
             color: "",
             width: "",
             id: "1"
-        },{
+        }, {
             label: "排序",
             icon: "icon-shengxu",
             color: "",
@@ -28,7 +29,7 @@ Page({
         classShow: false,
         classActions: [],
         content: {
-            "isAll":0,
+            "isAll": 0,
             "nocache": true,
             "version": 1,
             "pageNumber": 1,
@@ -86,12 +87,12 @@ Page({
         })
     },
     /* 获取线索范围 */
-    getTypeList () {
+    getTypeList() {
         _Http.basic({
             "classname": "sysmanage.develop.optiontype.optiontype",
             "method": "optiontypeselect",
             "content": {
-                "typename":'dataarea'
+                "typename": 'dataarea'
             }
         }).then(res => {
             console.log("状态列表", res)
@@ -101,8 +102,8 @@ Page({
             })
             let classActions = res.data.map(item => {
                 return {
-                    name:item.value,
-                    index:item.remarks
+                    name: item.value,
+                    index: item.remarks
                 }
             })
             this.setData({
@@ -113,12 +114,12 @@ Page({
         })
     },
     /* 获取线索状态 */
-    getClueArea () {
+    getClueArea() {
         _Http.basic({
             "classname": "sysmanage.develop.optiontype.optiontype",
             "method": "optiontypeselect",
             "content": {
-                "typename":'clueprivate'
+                "typename": 'clueprivate'
             }
         }).then(res => {
             console.log("线索范围", res)
@@ -132,7 +133,6 @@ Page({
             this.setData({
                 'filter.status': status
             });
-            console.log(this.data.filter.type);
             this.setListHeight();
         })
     },
@@ -170,7 +170,7 @@ Page({
     /* 去添加 */
     openType() {
         wx.navigateTo({
-          url: '/packageA/saleClue/addClue',
+            url: '/packageA/saleClue/addClue',
         })
     },
     /* 选择添加报价形式 */

+ 1 - 1
packageA/saleClue/index.wxml

@@ -20,4 +20,4 @@
 </Yl_filtrate>
 
 <!-- 浮动按钮 -->
-<Yl_FloatingButton bindtap="openType" />
+<Yl_FloatingButton wx:if="{{insert}}" bindtap="openType" />