Explorar el Código

添加权限判断页

347617796@qq.com hace 4 años
padre
commit
96e4add946

+ 1 - 0
.tea/entryFiles-development/index$.web.js

@@ -45,3 +45,4 @@ require('../../pages/deploy/setCheck/setCheck?hash=32d7d2807ed4e666ef03b4b3fe8c3
 require('../../pages/deploy/integralRule/integralRule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
 require('../../pages/workbench/approve/approve?hash=d0f7b9c3ec6457c02f205337e1fdf44d2d143adc');
 require('../../pages/statistics/C_ranking/C_ranking?hash=bcd8e1c05053f01c7126b59e3990df8bcf9058aa');
+require('../../pages/workbench/noJurisdiction/noJurisdiction?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');

+ 1 - 0
.tea/entryFiles-development/index$.worker.js

@@ -73,6 +73,7 @@ require('../../pages/deploy/setCheck/setCheck?hash=32d7d2807ed4e666ef03b4b3fe8c3
 require('../../pages/deploy/integralRule/integralRule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
 require('../../pages/workbench/approve/approve?hash=d0f7b9c3ec6457c02f205337e1fdf44d2d143adc');
 require('../../pages/statistics/C_ranking/C_ranking?hash=bcd8e1c05053f01c7126b59e3990df8bcf9058aa');
+require('../../pages/workbench/noJurisdiction/noJurisdiction?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
 }
 self.bootstrapApp ? self.bootstrapApp({ success }) : success();
 }

+ 1 - 0
.tea/entryFiles-production/index$.web.js

@@ -45,3 +45,4 @@ require('../../pages/deploy/setCheck/setCheck?hash=32d7d2807ed4e666ef03b4b3fe8c3
 require('../../pages/deploy/integralRule/integralRule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
 require('../../pages/workbench/approve/approve?hash=d0f7b9c3ec6457c02f205337e1fdf44d2d143adc');
 require('../../pages/statistics/C_ranking/C_ranking?hash=bcd8e1c05053f01c7126b59e3990df8bcf9058aa');
+require('../../pages/workbench/noJurisdiction/noJurisdiction?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');

+ 1 - 0
.tea/entryFiles-production/index$.worker.js

@@ -98,6 +98,7 @@ require('../../pages/deploy/setCheck/setCheck?hash=32d7d2807ed4e666ef03b4b3fe8c3
 require('../../pages/deploy/integralRule/integralRule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
 require('../../pages/workbench/approve/approve?hash=d0f7b9c3ec6457c02f205337e1fdf44d2d143adc');
 require('../../pages/statistics/C_ranking/C_ranking?hash=bcd8e1c05053f01c7126b59e3990df8bcf9058aa');
+require('../../pages/workbench/noJurisdiction/noJurisdiction?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
 }
 self.bootstrapApp ? self.bootstrapApp({ success }) : success();
 }

+ 20 - 21
Component/selectRule/selectRule.axml

@@ -2,22 +2,22 @@
   <image mode="scaleToFill" catchTap="plusOne" class="close" src="../../../image/close.png"/>
   <view class="search flex-box flex-v-ce">
     <image mode="scaleToFill" src="../../../image/ss.png"/>
-    <input placeholder="请输入规则内容搜索"  onInput="bindKeyInput"/>
+    <input placeholder="请输入规则内容搜索" onInput="bindKeyInput"/>
   </view>
   <view class="flex-box content">
     <scroll-view class="flex-2 left" scroll-y="{{true}}" a:if="{{isItem}}">
       <view class="tree" a:for="{{rule_tree}}">
-          <view class="{{item.id == activeIndex ? 'active':''}} yi" catchTap="activeTree" data-item="{{item}}">{{item.name}}</view>
-          <view catchTap="activeItem" data-item="{{child}}" class="{{child.id == activeItemIndex ? 'itemActive':''}} er" a:if="{{item.child&&item.child.length>0&&item.id == activeIndex}}" a:for="{{item.child}}" a:for-index="idx" a:for-item="child">
+        <view class="{{item.id == activeIndex ? 'active':''}} yi" catchTap="activeTree" data-item="{{item}}">{{item.name}}</view>
+        <view catchTap="activeItem" data-item="{{child}}" class="{{child.id == activeItemIndex ? 'itemActive':''}} er" a:if="{{item.child&&item.child.length>0&&item.id == activeIndex}}" a:for="{{item.child}}" a:for-index="idx" a:for-item="child">
               {{child.name}}
-          </view>
+        </view>
       </view>
     </scroll-view>
     <scroll-view class="flex-5 right" scroll-y="{{true}}" a:if="{{isItem}}">
       <view a:if="{{item_child_list.length>0}}">
         <view class="flex-box flex-v-ce items-top" a:for="{{item_child_list}}" catchTap="openDetail" data-item="{{item}}">
-            <view class="flex-1" data-item="{{item}}">{{item.name}}</view>
-            <image mode="scaleToFill" src="../../../image/right.png" style="width: 26rpx;height: 26rpx;"/>
+          <view class="flex-1" data-item="{{item}}">{{item.name}}</view>
+          <image mode="scaleToFill" src="../../../image/right.png" style="width: 26rpx;height: 26rpx;"/>
         </view>
       </view>
       <view>
@@ -37,22 +37,21 @@
         <view a:if="{{item_list.length==0}}" class="nodata fontColorF">暂无相关规则</view>
       </view>
     </scroll-view>
-  
     <scroll-view class="flex-5 right" scroll-y="{{true}}" a:else>
-        <radio-group class="radio-group" onChange="radioChange" a:if="{{selectItem.length>0}}">
-          <label class="flex-box flex-v-ce items" a:for="{{selectItem}}">
-            <view class="radio">
-              <radio value="{{item}}" checked="{{item.checked}}"/>{{item.value}}</view>
-            <view class="radio-right flex-1">
-              <view>{{item.remark}}</view>
-              <view class="red num" a:if="{{item.min_point<0}}">{{(item.range_type == 1 ? item.min_point : item.min_point+'~'+item.max_point)}}
-                <text class="fontColorT" style="margin-left:10rpx">{{item.pt_Obj.name}}</text></view>
-              <view class="green num" a:if="{{item.min_point>0}}">+{{(item.range_type == 1 ? item.min_point : item.min_point+'~'+item.max_point)}}
-                <text class="fontColorT" style="margin-left:10rpx">{{item.pt_Obj.name}}</text></view>
-            </view>
-          </label>
-        </radio-group>
-        <view a:else class="nodata fontColorT">暂无相关规则</view>
+      <radio-group class="radio-group" onChange="radioChange" a:if="{{selectItem.length>0}}">
+        <label class="flex-box flex-v-ce items" a:for="{{selectItem}}">
+          <view class="radio">
+            <radio value="{{item}}" checked="{{item.checked}}"/>{{item.value}}</view>
+          <view class="radio-right flex-1">
+            <view>{{item.remark}}</view>
+            <view class="red num" a:if="{{item.min_point<0}}">{{(item.range_type == 1 ? item.min_point : item.min_point+'~'+item.max_point)}}
+              <text class="fontColorT" style="margin-left:10rpx">{{item.pt_Obj.name}}</text></view>
+            <view class="green num" a:if="{{item.min_point>0}}">+{{(item.range_type == 1 ? item.min_point : item.min_point+'~'+item.max_point)}}
+              <text class="fontColorT" style="margin-left:10rpx">{{item.pt_Obj.name}}</text></view>
+          </view>
+        </label>
+      </radio-group>
+      <view a:else class="nodata fontColorT">暂无相关规则</view>
       </view>
     </scroll-view>
   </view>

+ 9 - 2
Component/selectRule/selectRule.js

@@ -16,7 +16,8 @@ Component({
   props: {
     onClose: (data) => console.log(data),
     onConfirm:(data) => console.log(data),
-    isGzType:''
+    isGzType:'',
+    defaultId:'',//默认选中
   },
   didMount() {
     that = this;
@@ -119,7 +120,13 @@ Component({
             list.push(item_list[i][k])
           }
         }
-        // console.log(list)
+        if(this.props.defaultId){
+          list.map(item=>{
+            if(this.props.defaultId==item.id){
+              item.checked=true;
+            }
+          })
+        }
         that.setData({
           item_list: list,
           rule_tree:rule_tree,

+ 9 - 7
Component/selectSectionStaff/selectSectionStaff.js

@@ -28,14 +28,16 @@ Component({
   },
   didMount() {
     that = this;
-    this.setData({
-      selectUserId: this.props.selectUser,
-      isAll: this.props.isAllSelect,
-      userData:app.globalData.userData.employee_detail.manage_scope,
-      terr:[{name: '全部', id:0}]
+    app.login(app.globalData.corpId, function () {
+      that.setData({
+        selectUserId: that.props.selectUser,
+        isAll: that.props.isAllSelect,
+        userData:app.globalData.userData.employee_detail.manage_scope,
+        terr:[{name: '全部', id:0}]
+      })
+      that.getData(0);
+      that.getBmData();
     })
-    this.getData(0);
-    this.getBmData();
   },
   didUpdate() { },
   didUnmount() {

+ 59 - 41
Component/selectType/selectType.js

@@ -5,80 +5,98 @@ Component({
   data: {
     all_rule_list: {},
     rule_tree: {},
-    terr:[
-      {name: '全部', id:0}
+    terr: [
+      { name: '全部', id: 0 }
     ],
 
   },
   props: {
     onClose: (data) => console.log(data),
-    onConfirm:(data) => console.log(data),
-    isGzType:''
+    onConfirm: (data) => console.log(data),
+    isGzType: '',
+    defaultId: '',//默认选中
   },
   didMount() {
     that = this;
+    this.setData({
+      terr: [{ name: '全部', id: 0 }]
+    })
     this.getData();
   },
   didUpdate() { },
   didUnmount() { },
   methods: {
     //点击导航栏
-    activeItem(e){
-       this.setData({ rule_tree:[]});
-       var item=e.target.dataset.item;
-       var index=e.target.dataset.index;
-       var terr=this.data.terr;
-      if((index+1)==terr.length){return false};
-      if(index==0){
+    activeItem(e) {
+      this.setData({ rule_tree: [] });
+      var item = e.target.dataset.item;
+      var index = e.target.dataset.index;
+      var terr = this.data.terr;
+      if ((index + 1) == terr.length) { return false };
+      if (index == 0) {
         this.setData({
-          terr:[{name: '全部', id:0}],
-          rule_tree:this.data.all_rule_list
+          terr: [{ name: '全部', id: 0 }],
+          rule_tree: this.data.all_rule_list
         })
-      }else{
-        var arr=terr.slice(0,index+1);
-        console.log(arr);
+      } else {
+        var arr = terr.slice(0, index + 1);
         this.setData({
-          rule_tree:item.child,
-          terr:arr
+          rule_tree: item.child,
+          terr: arr
         })
       }
     },
     // 点击下一级
-    openDown(e){
-      this.setData({ rule_tree:[]});
-       var item=e.target.dataset.item;
-       var terr=this.data.terr;
-       terr.push(item);
-       if(item.child.length>0){
+    openDown(e) {
+      this.setData({ rule_tree: [] });
+      var item = e.target.dataset.item;
+      var terr = this.data.terr;
+
+      terr.push(item);
+      if (item.child.length > 0) {
         that.setData({
-          rule_tree:item.child,
-          terr:terr
+          rule_tree: item.child,
+          terr: terr
         })
-       }
+      }
     },
-    radioChange: function(e) {
+    radioChange: function (e) {
       this.props.onConfirm(e.detail.value);
       this.plusOne();
     },
-    recursion(data){
-          for(var i=0;i<data.length;i++){
-               data[i].checked=false;
-              if(data[i].child.length>0){
-                 this.recursion(data[i].child);
-              }
-          }
-          return data;
+    recursion(data) {
+      for (var i = 0; i < data.length; i++) {
+        data[i].checked = false;
+        if (data[i].child.length > 0) {
+          this.recursion(data[i].child);
+        }
+      }
+      return data;
     },
     getData() {
       var pt_id
-      if(that.props.isGzType){
-          pt_id=app.getTypesItem(that.props.isGzType).id;
+      if (that.props.isGzType) {
+        pt_id = app.getTypesItem(that.props.isGzType).id;
       }
-      app.$get("api/integral/rule/trees", { pt_id:pt_id }).then((res)=>{
+      app.$get("api/integral/rule/trees", { pt_id: pt_id }).then((res) => {
         var rule_tree = res.data.data.rule_tree
+        if (this.props.defaultId) {
+          rule_tree.map(item => {
+            if (this.props.defaultId == item.id) {
+              item.checked = true;
+            }
+            
+            item.child.map(item2 => {
+              if (this.props.defaultId == item2.id) {
+                item2.checked = true;
+              }
+            })
+
+          })
+        }
         that.setData({
-          rule_tree:rule_tree,
-          all_rule_list:rule_tree
+          rule_tree: rule_tree,
+          all_rule_list: rule_tree
         })
       })
     },

+ 9 - 4
app.js

@@ -100,13 +100,18 @@ App({
   login(corpId, callBack) {
     dd.getAuthCode({
       success: function (res) {
-        console.log(res);
         that.$post('api/ding/login', { authCode: res.authCode, corpId: corpId }).then(res => {
           if (res.data.code == 1) {
             var { token, user } = res.data.data;
-            that.globalData.token = token;
-            that.globalData.userData = user;
-            callBack();
+            if(user.is_official==1){
+              that.globalData.token = token;
+              that.globalData.userData = user;
+              callBack();
+            }else{
+              dd.navigateTo({
+                url:'./pages/workbench/noJurisdiction'
+              })
+            }
           } else {
             that.globalData.showToast(res.msg)
           }

+ 2 - 1
app.json

@@ -29,7 +29,8 @@
     "pages/deploy/setCheck/setCheck",
     "pages/deploy/integralRule/integralRule",
     "pages/workbench/approve/approve",
-    "pages/statistics/C_ranking/C_ranking"
+    "pages/statistics/C_ranking/C_ranking",
+    "pages/workbench/noJurisdiction/noJurisdiction"
   ],
   "window": {
     "defaultTitle": "功道云",

+ 4 - 4
pages/statistics/addCustom/addCustom.axml

@@ -8,11 +8,11 @@
   <view class="main">
     <view class="main-herader margin-bottom">
       <view class="title fontColorF">分组成员({{selectUser.length}})</view>
-      <view class="flex-box flex-v-ce add">
-        <view class="blue flex-1" onTap="openAdd">+ 添加员工</view>
+      <view class="flex-box flex-v-ce add" onTap="openAdd">
+        <view class="blue flex-1">+ 添加员工</view>
         <view class="add-right fontColorF">
-          <text a:for="{{selectUser}}">{{item.name}},</text>
-          <text>{{selectUser.length}}人</text>
+          <!-- <text a:for="{{selectUser}}">{{item.name}},</text>
+          <text>{{selectUser.length}}人</text> -->
           <image mode="scaleToFill" src="../../../image/right.png"/>
         </view>
       </view>

+ 4 - 4
pages/workbench/approve/approve.axml

@@ -147,13 +147,13 @@
           <view class="flex-1"></view>
           <switch onChange="switchChange" checked="{{item.checked}}" color="#26A2FF"></switch>
         </view>
-        <view class="flex-box flex-v-ce li" a:if="{{item.checked}}" data-num="1" catchTap="openSelect">
+        <view class="flex-box flex-v-ce li" a:if="{{item.checked}}" data-num="1" data-ruleId="{{item.item_id}}" catchTap="openSelect">
           <view class="label">选择规则</view>
           <view class="flex-1" a:if="{{item.selectRule}}">已选择1条</view>
           <view class="flex-1" a:else></view>
           <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
         </view>
-        <view class="flex-box flex-v-ce li" a:else data-num="2" catchTap="openSelect">
+        <view class="flex-box flex-v-ce li" a:else data-num="2" data-ruleId="{{item.rule_id2}}" catchTap="openSelect">
           <view class="label isBt">选择分类</view>
           <view class="flex-1">{{item.rule_name}}</view>
           <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
@@ -240,8 +240,8 @@
     <button type="default" loading="{{disabled}}" class="defBtn" disabled="{{disabled}}" catchTap="formSubmit">提交</button>
   </view>
   <view class="box" animation="{{animationInfo}}">
-    <select-rule onConfirm="onSelectItem" onClose="onClose" a:if="{{isShowType=='1'}}"/>
-    <select-type onConfirm="onSelectType" onClose="onClose" a:if="{{isShowType=='2'}}"/>
+    <select-rule  defaultId="{{defaultRuleId}}" onConfirm="onSelectItem" onClose="onClose" a:if="{{isShowType=='1'}}"/>
+    <select-type  defaultId="{{defaultRuleId}}" onConfirm="onSelectType" onClose="onClose" a:if="{{isShowType=='2'}}"/>
     <select-section-staff-two onClose="onClose" onConfirm="onSelectUser" a:if="{{isShowType=='3'}}"/>
   </view>
 </view>

+ 6 - 2
pages/workbench/approve/approve.js

@@ -18,6 +18,7 @@ Page({
       remark: '',//备注
       ticket_count: false,//奖票数量
       disabled:false,
+      defaultRuleId:'',
     },
     users: {
       id:''
@@ -181,14 +182,17 @@ Page({
     that.setData({
       ['item.rule_id']: item.rule_id,
       ['item.selectRule']: item,
-      ['item.item']: item.id,
+      ['item.item_id']: item.id,
       ['item.point']: Number(strMin),
       ['item.isArrindex']: item.min_point > 0 ? true : false,
     })
   },
   //显示规则
   openSelect(e) {
-    that.setData({ activeIndex: '' });
+    if(e.target.dataset.ruleId){
+       that.setData({ defaultRuleId:e.target.dataset.ruleId});
+    }
+    that.setData({ activeIndex: '',isShowType:'' });
     that.setData({
       isShowType: e.target.dataset.num,
       activeIndex: e.target.dataset.index,

+ 3 - 1
pages/workbench/jk_B/jk_B.acss

@@ -139,5 +139,7 @@ textarea::before{
 }
 .picker-right{
   right: 5rpx;
-
+}
+.userList{
+  height: 40rpx;
 }

+ 5 - 5
pages/workbench/jk_B/jk_B.axml

@@ -2,7 +2,7 @@
   <form>
     <view class="flex-box flex-v-ce form-top" catchTap="openSelect"  data-num="3">
       <view class="label isBt">录入对象</view>
-      <view class="flex-1 font-flex-word">
+      <view class="flex-1 font-flex-word userList">
           <block a:for="{{users}}">
               <text>{{item.name}},</text>
           </block>
@@ -20,13 +20,13 @@
           <view class="flex-1"></view>
           <switch onChange="switchChange" checked="{{item.checked}}" data-index="{{index}}" color="#26A2FF"></switch>
         </view>
-        <view class="flex-box flex-v-ce li" a:if="{{item.checked}}" data-index="{{index}}" data-num="1" catchTap="openSelect">
+        <view class="flex-box flex-v-ce li" a:if="{{item.checked}}" data-ruleId="{{item.item_id}}" data-index="{{index}}" data-num="1" catchTap="openSelect">
           <view class="label isBt">选择规则</view>
           <view class="flex-1" a:if="{{item.selectRule}}">已选择1条</view>
           <view class="flex-1" a:else></view>
           <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
         </view>
-        <view class="flex-box flex-v-ce li" a:else data-index="{{index}}" data-num="2" catchTap="openSelect">
+        <view class="flex-box flex-v-ce li" a:else data-ruleId="{{item.rule_id2}}" data-index="{{index}}" data-num="2" catchTap="openSelect">
           <view class="label isBt">选择分类</view>
           <view class="flex-1">{{item.rule_name}}</view>
           <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
@@ -101,8 +101,8 @@
     </view>
   </form>
   <view class="box" animation="{{animationInfo}}">
-    <select-rule isGzType="{{isGzType}}" onConfirm="onSelectItem" onClose="onClose" a:if="{{isShowType=='1'}}"/>
-    <select-type isGzType="{{isGzType}}" onConfirm="onSelectType" onClose="onClose" a:if="{{isShowType=='2'}}"/>
+    <select-rule defaultId="{{defaultRuleId}}" isGzType="{{isGzType}}" onConfirm="onSelectItem" onClose="onClose" a:if="{{isShowType=='1'}}"/>
+    <select-type defaultId="{{defaultRuleId}}" isGzType="{{isGzType}}" onConfirm="onSelectType" onClose="onClose" a:if="{{isShowType=='2'}}"/>
     <select-section-staff isLeadership="{{true}}" selectUser="{{users}}" onClose="onClose" onConfirm="onSelectUser" a:if="{{isShowType=='3'}}"/>
     <select-section-staff-two superior_list="{{superior_list}}" isLeadership="{{false}}" selectUser="{{reviewerObj}}" onClose="onClose" onConfirm="onSelectUser2" a:if="{{isShowType=='4'}}"/>
   </view>

+ 5 - 1
pages/workbench/jk_B/jk_B.js

@@ -15,6 +15,7 @@ Page({
     superior_list:[],//领导人员
     type:'B',
     isGzType:'BF',
+    defaultRuleId:'',
   },
   onLoad(data) {
     that = this;
@@ -98,6 +99,9 @@ Page({
         }
     }
     that.setData({ activeIndex: '' });
+    if(e.target.dataset.ruleId){
+       that.setData({ defaultRuleId:e.target.dataset.ruleId});
+    }
     if(e.target.dataset.item){
        that.setData({ reviewerObj: [e.target.dataset.item] });
     }
@@ -132,7 +136,6 @@ Page({
     dd.chooseImage({
       count: 1,
       success: (res) => {
-        console.log(res);
           that.postImg(res.filePaths[0], index2);
       },
     });
@@ -486,6 +489,7 @@ Page({
   },
   //选择规则
   onSelectItem(item) {
+    console.log(item);
     var index = this.data.activeIndex;
     var point = `items[${index}].point`
     var isArrindex = `items[${index}].isArrindex`

+ 4 - 0
pages/workbench/noJurisdiction/noJurisdiction.acss

@@ -0,0 +1,4 @@
+.noJ{
+  text-align: center;
+  margin-top: 30%
+}

+ 5 - 0
pages/workbench/noJurisdiction/noJurisdiction.axml

@@ -0,0 +1,5 @@
+<view>
+  <view class="noJ">
+      您当前无权限进入系统,请联系企业管理员授权开通使用
+  </view>
+</view>

+ 4 - 0
pages/workbench/noJurisdiction/noJurisdiction.js

@@ -0,0 +1,4 @@
+Page({
+  data: {},
+  onLoad() {},
+});

+ 1 - 0
pages/workbench/noJurisdiction/noJurisdiction.json

@@ -0,0 +1 @@
+{}