347617796@qq.com 3 years ago
parent
commit
731462e4a5
79 changed files with 2945 additions and 308 deletions
  1. 34 0
      .mini-ide/compileMode.json
  2. 1 1
      Component/selectDate/selectDate.js
  3. 2 2
      Component/selectType/selectType.acss
  4. 1 1
      Component/selectType/selectType.axml
  5. 7 2
      app.js
  6. 10 2
      app.json
  7. BIN
      image/att_sign.png
  8. BIN
      image/dhm.png
  9. BIN
      image/fl.png
  10. BIN
      image/jb.png
  11. BIN
      image/ju.png
  12. BIN
      image/my_examine.png
  13. BIN
      image/tq.png
  14. BIN
      image/zt.png
  15. 1 1
      pages/deploy/index/index.axml
  16. 76 0
      pages/exchange/commodityDetail/commodityDetail.acss
  17. 42 0
      pages/exchange/commodityDetail/commodityDetail.axml
  18. 31 0
      pages/exchange/commodityDetail/commodityDetail.js
  19. 1 0
      pages/exchange/commodityDetail/commodityDetail.json
  20. 96 0
      pages/exchange/exchange/exchange.acss
  21. 49 0
      pages/exchange/exchange/exchange.axml
  22. 28 0
      pages/exchange/exchange/exchange.js
  23. 1 0
      pages/exchange/exchange/exchange.json
  24. 34 0
      pages/exchange/exchangeRecord/exchangeRecord.acss
  25. 37 0
      pages/exchange/exchangeRecord/exchangeRecord.axml
  26. 18 0
      pages/exchange/exchangeRecord/exchangeRecord.js
  27. 1 0
      pages/exchange/exchangeRecord/exchangeRecord.json
  28. 145 0
      pages/exchange/gxdDetail/gxdDetail.acss
  29. 35 0
      pages/exchange/gxdDetail/gxdDetail.axml
  30. 77 0
      pages/exchange/gxdDetail/gxdDetail.js
  31. 6 0
      pages/exchange/gxdDetail/gxdDetail.json
  32. 40 0
      pages/exchange/prizeDetail/prizeDetail.acss
  33. 56 0
      pages/exchange/prizeDetail/prizeDetail.axml
  34. 15 0
      pages/exchange/prizeDetail/prizeDetail.js
  35. 1 0
      pages/exchange/prizeDetail/prizeDetail.json
  36. 28 0
      pages/statistics/B_ranking/B_ranking.js
  37. 1 1
      pages/statistics/allTask/allTask.axml
  38. 3 2
      pages/statistics/checkDetail/checkDetail.js
  39. 7 1
      pages/statistics/check_top/check_top.js
  40. 7 0
      pages/statistics/getTask/getTask.js
  41. 4 3
      pages/statistics/index/index.js
  42. 1 1
      pages/statistics/log_rank/log_rank.acss
  43. 15 10
      pages/statistics/log_rank/log_rank.axml
  44. 129 86
      pages/statistics/log_rank/log_rank.js
  45. 4 3
      pages/statistics/log_rank/log_rank.json
  46. 1 0
      pages/statistics/my_apply/my_apply.axml
  47. 1 1
      pages/statistics/my_sp/my_sp.axml
  48. 29 1
      pages/statistics/sectionRanking/sectionRanking.js
  49. 30 3
      pages/statistics/taskDetail/taskDetail.js
  50. 31 0
      pages/statistics/task_rank/task_rank.acss
  51. 51 1
      pages/statistics/task_rank/task_rank.axml
  52. 191 2
      pages/statistics/task_rank/task_rank.js
  53. 10 1
      pages/statistics/task_rank/task_rank.json
  54. 7 0
      pages/statistics/workDetail/workDetail.js
  55. 46 0
      pages/workbench/apply/apply.acss
  56. 78 0
      pages/workbench/apply/apply.axml
  57. 174 53
      pages/workbench/apply/apply.js
  58. 180 0
      pages/workbench/approval_batch/approval_batch.acss
  59. 119 0
      pages/workbench/approval_batch/approval_batch.axml
  60. 349 0
      pages/workbench/approval_batch/approval_batch.js
  61. 8 0
      pages/workbench/approval_batch/approval_batch.json
  62. 4 4
      pages/workbench/approve/approve.axml
  63. 12 11
      pages/workbench/approve/approve.js
  64. 14 0
      pages/workbench/approveDetail/approveDetail.axml
  65. 9 4
      pages/workbench/approveDetail/approveDetail.js
  66. 5 0
      pages/workbench/index/index.axml
  67. 22 1
      pages/workbench/index/index.js
  68. 46 0
      pages/workbench/jk_B/jk_B.acss
  69. 111 25
      pages/workbench/jk_B/jk_B.axml
  70. 159 45
      pages/workbench/jk_B/jk_B.js
  71. 2 2
      pages/workbench/my_approve/my_approve.acss
  72. 3 2
      pages/workbench/my_approve/my_approve.axml
  73. 5 8
      pages/workbench/my_approve/my_approve.js
  74. 7 0
      pages/workbench/noticeDetail/noticeDetail.acss
  75. 13 0
      pages/workbench/noticeDetail/noticeDetail.axml
  76. 63 0
      pages/workbench/noticeDetail/noticeDetail.js
  77. 1 0
      pages/workbench/noticeDetail/noticeDetail.json
  78. 38 28
      utils/util.js
  79. 82 0
      utils/websocket.js

+ 34 - 0
.mini-ide/compileMode.json

@@ -3,6 +3,40 @@
     {
       "title": "日志分",
       "page": "pages/statistics/log_rank/log_rank"
+    },
+    {
+      "title": "兑换",
+      "page": "pages/exchange/exchange/exchange"
+    },
+    {
+      "title": "功勋点明显",
+      "page": "pages/exchange/gxdDetail/gxdDetail"
+    },
+    {
+      "title": "兑换记录",
+      "page": "pages/exchange/exchangeRecord/exchangeRecord"
+    },
+    {
+      "title": "奖品详情",
+      "page": "pages/exchange/prizeDetail/prizeDetail"
+    },
+    {
+      "title": "商品详情",
+      "page": "pages/exchange/commodityDetail/commodityDetail"
+    },
+    {
+      "title": "公告内容",
+      "page": "pages/workbench/noticeDetail/noticeDetail",
+      "pageQuery": "id=20"
+    },
+    {
+      "title": "阶段排名",
+      "page": "pages/statistics/sectionRanking/sectionRanking"
+    },
+    {
+      "title": "悬赏任务详情",
+      "page": "pages/statistics/taskDetail/taskDetail",
+      "pageQuery": "id=2538"
     }
   ]
 }

+ 1 - 1
Component/selectDate/selectDate.js

@@ -78,7 +78,7 @@ Component({
     selectDay2() {
       dd.datePicker({
         format: 'yyyy-MM-dd',
-        currentDate: this.data.startDay,
+        currentDate: this.data.endDay,
         success: (res) => {
           if (res.date < this.data.startDay) {
             app.globalData.showToast("结束时间不能小于开始时间")

+ 2 - 2
Component/selectType/selectType.acss

@@ -43,7 +43,7 @@
   height: calc(100vh - 212rpx);
 }
 
-.ul {
+.ul3 {
   width: 100%;
   background-color: #fff;
   height: 100%;
@@ -54,7 +54,7 @@
   border-bottom: 1px solid #f1f1f1;
 }
 
-.ul .li .xia {
+.ul3 .li .xia {
   color: #26A2FF !important;
 }
 

+ 1 - 1
Component/selectType/selectType.axml

@@ -14,7 +14,7 @@
         </view>
       </view>
 
-      <scroll-view class="ul" scroll-y="{{true}}">
+      <scroll-view class="ul3" scroll-y="{{true}}">
          <radio-group class="radio-group" onChange="radioChange">
             <view class="flex-box flex-v-ce li" a:for="{{rule_tree}}">
                <label class="flex-box flex-v-ce flex-1"><radio value="{{item}}"  checked="{{item.checked}}" name="{{item.id}}"/><image mode="scaleToFill" style="width:60rpx;height:60rpx; margin:0 10rpx;" src="../../../image/e66f.jpg"/> {{item.name}}</label>

+ 7 - 2
app.js

@@ -1,5 +1,6 @@
 import { showToast } from './utils/feedback'
 import { formatTime, arrRemoveObj, getTypeItem } from './utils/util'
+import * as socketApi from './utils/websocket'
 
 const baseUrl = "https://test-ding.g107.com/";//测试
 // const baseUrl = "https://ding.insys.g107.com/";//正式
@@ -12,6 +13,8 @@ for (var i = 2018; i <= year; i++) {
 App({
   //自定义全局变量
   globalData: {
+    webScoketUrl: "test-ding.g107.com",//webScoket测试
+    // webScoketUrl: "ding.insys.g107.com",//webScoket正式
     showToast: showToast,//提示框
     arrRemoveObj: arrRemoveObj,//删除数组的某一项
     year: formatTime(new Date()).year,//当前年
@@ -30,6 +33,7 @@ App({
     isCreator: false,//是否是创始人
     corpMessage: '',//企业套餐信息
     usersList: [],//缓存的人员列表
+    socketApi:socketApi,//长连接
   },
   //获取积分类型
   getTypes(callBack) {
@@ -251,7 +255,7 @@ App({
                 that.globalData.token = token;
                 that.globalData.userData = user;
                 var getIsStart = dd.getStorageSync({ key: 'isStart' });//判断是否需要打开引导页
-                // console.log(JSON.stringify(user));
+                console.log(JSON.stringify(user));
                 that.getUserList();//缓存人员列表
                 if (isStart && !getIsStart.data) {//判断是否需要打开引导
                   dd.reLaunch({
@@ -296,7 +300,7 @@ App({
     }
   },
   getUserList() {
-    this.$get("api/employee/list", { dept_id: 0 }).then((res) => {
+    this.$get("api/employee/list",{ dept_id: 0 }).then((res) => {
       that.globalData.usersList = res.data.data.list;
     })
   },
@@ -327,6 +331,7 @@ App({
     })
   },
   onLaunch(options) {
+    dd.globalData=this.globalData;
     that = this;
     // that.updateApp();
     that.getTypes(function () { });

+ 10 - 2
app.json

@@ -1,6 +1,7 @@
 {
   "pages": [
     "pages/begin/begin",
+    "pages/workbench/approval_batch/approval_batch",
     "pages/workbench/index/index",
     "pages/statistics/index/index",
     "pages/deploy/index/index",
@@ -60,12 +61,19 @@
     "pages/statistics/allTask/allTask",
     "pages/deploy/buy/buy",
     "pages/statistics/log_rank/log_rank",
-    "pages/statistics/task_rank/task_rank"
+    "pages/statistics/task_rank/task_rank",
+    "pages/exchange/exchange/exchange",
+    "pages/exchange/exchangeRecord/exchangeRecord",
+    "pages/exchange/gxdDetail/gxdDetail",
+    "pages/exchange/prizeDetail/prizeDetail",
+    "pages/exchange/commodityDetail/commodityDetail",
+    "pages/workbench/noticeDetail/noticeDetail"
   ],
   "window": {
     "defaultTitle": "功道云",
     "titleBarColor": "#26A2FF",
-    "pullRefresh": "false"
+    "pullRefresh": "false",
+    "allowsBounceVertical": "NO"
   },
   "tabBar": {
     "textColor": "#606266",

BIN
image/att_sign.png


BIN
image/dhm.png


BIN
image/fl.png


BIN
image/jb.png


BIN
image/ju.png


BIN
image/my_examine.png


BIN
image/tq.png


BIN
image/zt.png


+ 1 - 1
pages/deploy/index/index.axml

@@ -4,7 +4,7 @@
       <img-box name="{{userData.name}}" imgUrl="{{userData.img_url}}" height="100rpx" width="100rpx"></img-box>
       <view class="name font-flex-word">
         <view>{{userData.name}}</view>
-        <view class="fontColorF font-flex-word" style="font-size:28rpx;margin-top:10rpx;width:80%">{{userData.post}}</view>
+        <view class="fontColorF font-flex-word" style="font-size:28rpx;margin-top:10rpx;">{{userData.post}}</view>
       </view>
     </view>
   </view>

+ 76 - 0
pages/exchange/commodityDetail/commodityDetail.acss

@@ -0,0 +1,76 @@
+
+.img{
+  /* width: 300rpx; */
+  height: 300rpx;
+  border-radius: 10rpx;
+}
+.input{
+  width: 50rpx;
+  /* margin:0 10rpx; */
+  text-align: center;
+}
+.num{
+  border-radius: 6rpx;
+  border: 1px solid #f1f1f1;
+  width: 40rpx;
+  height: 40rpx;
+  text-align: center;
+  line-height: 40rpx;
+  font-weight: 600;
+}
+.btn{
+  position: fixed;
+  bottom: 40rpx;
+  left: 5%;
+  right: 5%;
+
+}
+.lBgn{
+  background: #26A2FF;
+  box-sizing: border-box;
+  padding: 32rpx;
+  height: 140rpx;
+}
+.windows-box {
+  background: #fff;
+  border-radius: 20rpx;
+  position: absolute;
+  left: 10%;
+  right: 10%;
+  top: 40%;
+  margin-top: -25%;
+}
+
+.windows-title {
+  padding: 32rpx;
+  color: #999;
+  font-size: 24rpx;
+}
+
+.windows-btn {
+  /* border-top: 1px solid #f1f1f1; */
+}
+
+.windows-btn view:nth-child(1) {
+  text-align: right;
+  padding: 32rpx;
+  color: #26A2FF;
+}
+
+.windows-content {
+  padding: 0 28rpx;
+  font-size: 32rpx;
+  color: #606266;
+}
+.btns view{
+    text-align: center;
+    padding:0.32rem;
+    border-top: 1px solid #f1f1f1;
+    font-size: 0.28rem
+}
+.btns view:nth-child(1){
+    border-right: 1px solid #f1f1f1;
+}
+.btns view:nth-child(2){
+   color: #26A2FF;
+}

+ 42 - 0
pages/exchange/commodityDetail/commodityDetail.axml

@@ -0,0 +1,42 @@
+<view class="all">
+  <view class="flex-box-ce" style="background:#fff;padding:24rpx">
+    <image mode="scaleToFill" src="../../../image/money.jpg" class="img" />
+    <view class="flex-box-v" style="height:300rpx;padding-left:20rpx">
+      <view class="content fontColorF flex-1">
+        因为这些问题也陪伴我度过了生命中那些夜不能寐的日子,
+      </view>
+      <view style="margin-bottom:20rpx">功勋点:
+        <text class="red">49</text></view>
+      <view class="flex-box-ce">
+        <text>数量:</text>
+        <view class="flex-box-ce">
+          <view class="num" catchTap="active" data-id="1">-</view>
+          <input class="input" type="number" value="{{val}}" />
+          <view class="num" data-id="2" catchTap="active">+</view>
+        </view>
+      </view>
+    </view>
+  </view>
+  <view class="fontColorF" style="padding:20rpx;background:#fff"> 商品描述: 因为这些问题也陪伴我度过了生命中那些夜不能寐的日子,</view>
+  <textarea onBlur="bindTextAreaBlur" placeholder="请输入兑换备注" maxlength="100" style="margin-top:24rpx;padding:24rpx;height:200rpx" />
+  <button type="primary" class="btn" catchTap="showText">立即兑换</button>
+  <view a:if="{{isBh}}" class="windows" content="还没有积分事件">
+    <view class="windows-box">
+      <view class="windows-title">兑换</view>
+      <view class="flex-box-ce flex-center-center" style="margin-bottom:20rpx;">
+        <text style="padding-right:20rpx;font-size:36rpx">确认兑换</text>
+      </view>
+      <view style="text-align:center;padding:20rpx 0;">
+        <image src="../../../image/money.jpg" style="width:260rpx;height:260rpx;border-radius: 10rpx" />
+      </view>
+      <view class="windows-content" style="text-align:center">您需要花<text class="red">49</text>功勋点兑换此商品</view>
+      <view style="text-align:center;font-size:24rpx;margin-bottom:20rpx" class="fontColorX">
+        (当前的功勋点为1354分)
+      </view>
+      <view class="btns flex-box flex-v-ce">
+        <view class="flex-1" catchTap="colseText">取消</view>
+        <view class="flex-1" catchTap="openText">确认</view>
+      </view>
+    </view>
+  </view>
+</view>

+ 31 - 0
pages/exchange/commodityDetail/commodityDetail.js

@@ -0,0 +1,31 @@
+Page({
+  data: {
+    val: 1,
+  },
+  onLoad() {
+    dd.setNavigationBar({ title: "商品详情" });
+  },
+  active(e) {
+    var id = e.target.dataset.id;
+    let val = this.data.val;
+    if (id == 1) {
+      if (val != 1) {
+        val--;
+      }
+    } else {
+      val++
+    }
+    this.setData({
+      val: val
+    })
+  },
+  showText() {
+    this.setData({ isBh: !this.data.isBh })
+  },
+  handleCopy() {
+    dd.setClipboard({
+      text: this.data.text,
+    })
+    app.globalData.showToast("已复制");
+  }
+});

+ 1 - 0
pages/exchange/commodityDetail/commodityDetail.json

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

+ 96 - 0
pages/exchange/exchange/exchange.acss

@@ -0,0 +1,96 @@
+page{
+  background-color: #fff;
+}
+.nums{
+  text-align: center;
+  color: #fff;
+  font-size: 32rpx;
+}
+.nums view:nth-child(1){
+  font-size: 56rpx;
+  margin-bottom: 20rpx;
+}
+.lBgn{
+  height: 240rpx;
+  border-bottom-left-radius: 20%;
+  border-bottom-right-radius: 20%;
+  background-image: linear-gradient(to top, #47CAFE 0%, #26A2FF 100%);
+  box-sizing: border-box;
+  padding-top: 20rpx;
+}
+.lBgn image{
+  width: 80rpx;
+  height: 80rpx;
+  opacity: 0.2;
+  margin:0 40rpx;
+  position: relative;
+  top: 40rpx;
+}
+.box{
+  position: absolute;
+  background: #fff;
+  box-shadow: 0rpx 4rpx 10rpx rgba(0, 0, 0, 0.05);
+  height: 140rpx;
+  border-radius: 10rpx;
+  top: -70rpx;
+  text-align: center;
+  font-size: 28rpx;
+  left: 3%;
+  right: 3%;
+  top: 170rpx;
+  color: #777;
+}
+.box image{
+  width: 32rpx;
+  height: 32rpx;
+  margin-bottom: 10rpx;
+}
+.search {
+  background-color: #f1f1f1;
+  border-radius: 10rpx;
+  width: 60%;
+  margin: 0 0;
+  padding: 6rpx 10rpx;
+  margin-right: 20rpx;
+}
+.form{
+  padding: 0 3%;
+}
+.search input {
+  background-color: #f1f1f1;
+}
+.search image {
+  width: 30rpx;
+  height: 30rpx;
+  margin-left: 10rpx;
+}
+.item{
+  width: 49%;
+  padding: 10rpx;
+  box-shadow: 0rpx 0rpx 10rpx rgba(0, 0, 0, 0.05);
+  border-radius: 5rpx;
+  background-color: #fff;
+  box-sizing: border-box;
+  margin-bottom: 2%;
+}
+.itemBox{
+  padding: 24rpx 2%;
+}
+.css3{
+  transform: rotate(90deg);
+  padding-left: 10rpx;
+}
+.itemBox .item:nth-child(odd){
+  margin-right: 2%;
+}
+.item image{
+  width: 100%;
+  height: 200rpx;
+}
+.content{
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 2;
+  overflow: hidden;
+  margin: 20rpx 0;
+}

+ 49 - 0
pages/exchange/exchange/exchange.axml

@@ -0,0 +1,49 @@
+<view>
+  <view class="lBgn flex-box">
+    <image mode="widthFix" src="" style="width:80rpx"/>
+    <view class="flex-1 nums">
+      <view>1652</view>
+      <view>可用功勋点</view>
+    </view>
+    <image mode="widthFix" src="../../../image/jb.png"/>
+  </view>
+  <view class="box">
+    <view class="flex-box-ce" style="height:140rpx">
+      <view class="flex-box-v flex-1 flex-center-center">
+        <image src="../../../image/lb.png" />
+        <text>功勋点明显</text>
+      </view>
+      <view class="flex-1 flex-box-v flex-center-center">
+        <image src="../../../image/lb.png" />
+        <text>兑换记录</text>
+      </view>
+    </view>
+  </view>
+  <view style="height:100rpx"></view>
+  <form onReset="onReset" class="flex-box-ce form">
+    <view class="search flex-1 flex-box flex-v-ce">
+      <image mode="widthFix" src="../../../image/ss.png" />
+      <input placeholder="商品搜索" onInput="bindKeyInput" onConfirm="bindKeyInput" class="flex-1" />
+      <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
+    </view>
+    <view class="flex-box-ce">
+      <picker onChange="activeItem" value="{{minuteIndex}}" range="{{minuteArray}}" range-key="name">
+          <text style="font-size:28rpx;color:#777">{{minuteArray[minuteIndex].name}}</text>
+      </picker>
+      <image mode="widthFix" src="../../../image/right.png" style="width:30rpx" class="css3"/>
+    </view>
+  </form>
+  <view class="flex-box flex-d-wrap itemBox">
+    <view class="item" a:for="{{list}}">
+        <image mode="widthFix" src="../../../image/money.jpg"/>
+        <view class="content fontColorF">
+          因为这些问题也陪伴我度过了生命中那些夜不能寐的日子,
+        </view>
+        <view class="flex-box-ce">
+          <text class="red flex-1">49功勋点</text>
+          <button size="mini" type="ghost">兑换</button>
+        </view>
+    </view>
+  </view>
+
+</view>

+ 28 - 0
pages/exchange/exchange/exchange.js

@@ -0,0 +1,28 @@
+var app = getApp();
+var that;
+Page({
+  data: {
+    src: '',
+    list: [1, 2, 3],
+    minuteIndex: 0,//条件选择
+    minuteArray: [
+      { id: 0, name: '全部分类' },
+      { id: 1, name: '待审批' },
+      { id: 2, name: '已审批' },
+    ],
+  },
+  onLoad(e) {
+    dd.setNavigationBar({ title: "积分商城" });
+  },
+  activeItem(e) {
+
+  },
+  openUrl() {
+
+  },
+  openUrl2() {
+    dd.switchTab({
+      url: '../../workbench/index/index'
+    })
+  }
+});

+ 1 - 0
pages/exchange/exchange/exchange.json

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

+ 34 - 0
pages/exchange/exchangeRecord/exchangeRecord.acss

@@ -0,0 +1,34 @@
+page{
+  background: #fff;
+}
+.windows-box {
+  background: #fff;
+  border-radius: 20rpx;
+  position: absolute;
+  left: 10%;
+  right: 10%;
+  top: 40%;
+  margin-top: -25%;
+}
+
+.windows-title {
+  padding: 32rpx;
+  color: #999;
+  font-size: 24rpx;
+}
+
+.windows-btn {
+  /* border-top: 1px solid #f1f1f1; */
+}
+
+.windows-btn view:nth-child(1) {
+  text-align: right;
+  padding: 32rpx;
+  color: #26A2FF;
+}
+
+.windows-content {
+  padding: 0 28rpx;
+  font-size: 28rpx;
+  color: #606266;
+}

+ 37 - 0
pages/exchange/exchangeRecord/exchangeRecord.axml

@@ -0,0 +1,37 @@
+<view>
+  <scroll-view class="scroll" a:if="{{list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower" style="padding:20rpx">
+    <view a:for="{{list}}" style="padding:20rpx;box-shadow: 0rpx 0rpx 10rpx #ccc;margin-bottom:20rpx">
+      <view class="flex-box-ce" style="border-bottom:1px solid #f1f1f1;padding-bottom:20rpx">
+        <text class="flex-1 font-flex-word" style="padding-right:20rpx;">商品明细</text>
+        <text class="yellow" style="width:100rpx">待发放</text>
+      </view>
+      <view class="flex-box-ce" style="padding:20rpx 0">
+        <image src="../../../image/money.jpg" style="width:200rpx;height:200rpx;border-radius: 10rpx;" />
+        <view class="flex-box-v flex-1" style="height:200rpx;padding-top:20rpx;padding-left:20rpx;">
+          <view style="margin-bottom:30rpx"> 单价:20功勋点</view>
+          <view class="fontColorF" style="margin-bottom:30rpx"> 数量:1</view>
+          <view > 总价:20功勋点</view>
+        </view>
+        <image src="../../../image/money.jpg" style="width:70rpx;height:70rpx" catchTap="showText"/>
+      </view>
+      <view class="fontColorF" style="font-size:28rpx">发布于 2015-12-23 14:14</view>
+    </view>
+  </scroll-view>
+  <no-data a:if="{{list.length==0}}" />
+  <view a:if="{{isBh}}" class="windows" content="还没有积分事件">
+    <view class="windows-box">
+      <view class="windows-title">兑换码</view>
+      <view class="flex-box-ce flex-center-center" style="margin-bottom:20rpx;">
+        <text style="padding-right:20rpx;font-size:36rpx">285 5451 654</text>
+        <button size="mini" open-type="share" catchTap="handleCopy">复制</button>
+      </view>
+      <view style="text-align:center;padding:20rpx 0;">
+              <image src="../../../image/money.jpg" style="width:260rpx;height:260rpx;border-radius: 10rpx" />
+      </view>
+      <view class="windows-content">提供兑换码或二维码给奖品兑换负责人即可</view>
+      <view class="windows-btn flex-box flex-v-ce">
+        <view class="flex-1" catchTap="showText">我知道了</view>
+      </view>
+    </view>
+  </view>
+</view>

+ 18 - 0
pages/exchange/exchangeRecord/exchangeRecord.js

@@ -0,0 +1,18 @@
+var app = getApp()
+var that;
+Page({
+  data: {
+    list:[1,2,3],
+    text:'嘻嘻嘻'
+  },
+  onLoad() {},
+  showText() {
+    this.setData({ isBh: !this.data.isBh })
+  },
+  handleCopy() {
+    dd.setClipboard({
+      text: this.data.text,
+    })
+    app.globalData.showToast("已复制");
+  } 
+});

+ 1 - 0
pages/exchange/exchangeRecord/exchangeRecord.json

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

+ 145 - 0
pages/exchange/gxdDetail/gxdDetail.acss

@@ -0,0 +1,145 @@
+page{
+  background: #fff;
+}
+.top {
+  width: 100%;
+  height: 140rpx;
+  background-color: #26A2FF;
+  margin-bottom: 60rpx;
+  color: #fff;
+  text-align: center;
+}
+
+.top image {
+  width: 36rpx;
+  height: 36rpx;
+  margin-right: 10rpx;
+  position: relative;
+  top: 6rpx;
+}
+
+.dates {
+  width: 200rpx;
+  margin: 0 auto;
+  text-align: center;
+}
+
+.head {
+  position: absolute;
+  top: 80rpx;
+  left: 32rpx;
+  right: 32rpx;
+  border-radius: 20rpx;
+  background-color: #fff;
+  box-shadow: 0 0.04rem 0.12rem 0 rgba(0, 0, 0, .05);
+  height: 120rpx;
+  text-align: center;
+}
+
+.head .flex-1 view:nth-child(1) {
+  color: #26A2FF;
+  font-weight: 600;
+  margin-bottom: 10rpx;
+  font-size: 40rpx;
+}
+
+.head .flex-1 view:nth-child(2) {
+  color: #C0C4CC;
+  margin-bottom: 5rpx;
+  font-size: 28rpx;
+}
+
+.headed {
+  background-color: #fff;
+}
+
+.headed-box {
+  padding: 28rpx;
+  color: #303133;
+}
+
+.title {
+  color: #222;
+  position: relative;
+  font-size: 32rpx;
+  font-weight: 600;
+  padding-left: 20rpx;
+  margin: 30rpx 0;
+}
+
+.title::before {
+  position: absolute;
+  content: "";
+  height: 30rpx;
+  left: 0;
+  top: 3rpx;
+  width: 8rpx;
+  background-color: #26A2FF;
+  border-radius: 50rpx;
+}
+
+.f2-chart {
+  width: 100%;
+  height: 400rpx;
+}
+
+/* 底部 */
+
+
+.list {
+  padding: 28rpx 0;
+  border-top: 1px solid #f1f1f1;
+  font-size: 32rpx;
+}
+
+.text {
+  margin-right: 10rpx;
+  color: #303133;
+}
+
+.main .gengduo image {
+  width: 24rpx;
+  height: 24rpx;
+  position: relative;
+  top: 4rpx;
+}
+
+.gengduo {
+  color: #303133;
+  font-size: 32rpx;
+}
+
+.num {
+  font-size: 40rpx;
+  
+}
+
+.dates text::after {
+  position: absolute;
+  /* position: relative; */
+  top: 50%;
+  right: -20rpx;
+  margin-top: -0.1rem;
+  border: 0.06rem solid;
+  border-color: transparent transparent #fff #fff;
+  -webkit-transform: rotate(-45deg);
+  transform: rotate(-45deg);
+  opacity: .8;
+  content: '';
+}
+
+.dates .activeView::after {
+  margin-top: -0.02rem;
+  -webkit-transform: rotate(135deg);
+  transform: rotate(135deg);
+  border-color: transparent transparent #fff #fff;
+}
+.item{
+  padding: 24rpx;
+  border-bottom: 1px solid #f1f1f1;
+}
+
+
+.scroll {
+  height: calc(100vh - 2.2rem);
+}

+ 35 - 0
pages/exchange/gxdDetail/gxdDetail.axml

@@ -0,0 +1,35 @@
+<view>
+  <view class="head flex-box flex-center-center">
+    <view class="flex-1">
+      <view>{{month_total}}</view>
+      <view>支出</view>
+    </view>
+    <view class="flex-1">
+      <view>{{total}}</view>
+      <view>收入</view>
+    </view>
+  </view>
+  <view class="headed margin-bottom">
+    <view class="top">
+      <view class="dates" style="padding:10rpx 0" catchTap="openDate">
+        <image mode="scaleToFill" src="../../../image/date.png"/>
+        <text style="font-size:32rpx;position: relative;" class="{{showDate? 'activeView':''}}">{{date}}</text>
+      </view>
+    </view>
+  </view>
+  <view class="main margin-bottom">
+    <!-- <view class="title" style="padding-bottom:0rpx">本月奖票</view> -->
+    <scroll-view class="scroll" a:if="{{list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
+      <view class="flex-box-ce item" a:for="{{list}}">
+          <view class="flex-1">
+            <view>本月奖票</view>
+            <text style="font-size:28rpx" class="fontColorF">2015-12-23 14:14</text>
+          </view>
+          <view class="red">
+            +100
+          </view>
+      </view>
+    </scroll-view>
+     <no-data a:if="{{list.length==0}}"/>
+  </view>
+</view>

+ 77 - 0
pages/exchange/gxdDetail/gxdDetail.js

@@ -0,0 +1,77 @@
+
+var app = getApp()
+var that;
+Page({
+  data: {
+    date: app.globalData.month,
+    list: [1,2,3,5],
+    page: 1,
+    month_total: 0,
+    total: 0
+  },
+  onLoad() {
+    that = this;
+    dd.setNavigationBar({ title: "功勋点明细" });
+    this.getData();
+  },
+  //选择时间
+  openDate(e) {
+    dd.datePicker({
+      format: 'yyyy-MM',
+      currentDate: that.data.date,
+      success: (res) => {
+        that.setData({
+          date: res.date
+        })
+        if (res.date) {
+          that.getData();
+        }
+      },
+    });
+  },
+  //上啦加载
+  onScrollToLower() {
+    if (!that.data.isData) {
+      this.setData({ page: ++that.data.page })
+    }
+  },
+  getData(is) {
+    var data = {
+      page: this.data.page,
+      page_size: 20,
+      employee_id: app.globalData.userData.id,
+      month: this.data.date
+    }
+    app.$get('/api/integral/ticket', data).then((res) => {
+      var data = res.data.data.month_list;
+      var list = that.data.list;
+      this.setData({
+        month_total: res.data.data.month_total,
+        total: res.data.data.total
+      })
+      if (is) {
+        if (data.length < 20) {
+          this.setData({
+            list: list.concat(data),
+            isData: true
+          })
+        } else {
+          this.setData({
+            list: list.concat(data)
+          })
+        }
+      } else {
+        this.setData({
+          list: data,
+          isData: false
+        })
+      }
+    })
+  },
+  //打开更多
+  openMore() {
+    dd.navigateTo({
+      url: '../../statistics/integralEvent/integralEvent?month=' + this.data.date + '&type=BF'
+    })
+  },
+});

+ 6 - 0
pages/exchange/gxdDetail/gxdDetail.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "f2": "@antv/my-f2",
+        "no-data":"/Component/noData/noData"
+    }
+}

+ 40 - 0
pages/exchange/prizeDetail/prizeDetail.acss

@@ -0,0 +1,40 @@
+page{
+  background-color: #fff;
+}
+.lBgn{
+  background: #26A2FF;
+  box-sizing: border-box;
+  padding: 32rpx;
+  height: 140rpx;
+}
+.windows-box {
+  background: #fff;
+  border-radius: 20rpx;
+  position: absolute;
+  left: 10%;
+  right: 10%;
+  top: 40%;
+  margin-top: -25%;
+}
+
+.windows-title {
+  padding: 32rpx;
+  color: #999;
+  font-size: 24rpx;
+}
+
+.windows-btn {
+  /* border-top: 1px solid #f1f1f1; */
+}
+
+.windows-btn view:nth-child(1) {
+  text-align: right;
+  padding: 32rpx;
+  color: #26A2FF;
+}
+
+.windows-content {
+  padding: 0 28rpx;
+  font-size: 28rpx;
+  color: #606266;
+}

+ 56 - 0
pages/exchange/prizeDetail/prizeDetail.axml

@@ -0,0 +1,56 @@
+<view>
+  <view class="lBgn flex-box-ce">
+    <image mode="scaleToFill" src="../../../image/zt.png" style="width:40rpx;height:40rpx;" />
+    <text class="flex-1" style="font-size:36rpx;color:#fff;padding-left:20rpx">待发放</text>
+    <image mode="scaleToFill" src="../../../image/ju.png" style="width:100rpx;height:100rpx;" />
+  </view>
+  <view style="padding:20rpx;">
+    <view style="padding:20rpx;box-shadow: 0px 0px 10px #ccc;border-radius: 4px;margin-bottom:20rpx">
+      <view class="fontColorF" style="font-size:28rpx;margin-bottom:10rpx">2015-12-23 14:14</view>
+      <view style="background:#F5F7FA;height:100rpx;border-radius: 4px;padding:20rpx;color: #606266;font-size:28rpx">
+        这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色
+      </view>
+    </view>
+    <view style="padding:20rpx;box-shadow: 0px 0px 10px #ccc;border-radius: 4px;margin-bottom:20rpx">
+      <view class="fontColorF flex-box-ce" style="font-size:28rpx;padding-bottom:20rpx;border-bottom:1px dashed #f1f1f1">
+        <image mode="widthFix" src="../../../image/dhm.png" style="width:40rpx;" />
+        <text class="flex-1" style="font-size:28rpx;padding-left:20rpx">兑换码</text>
+      </view>
+      <view class="flex-box-ce" style="height:70rpx;padding:20rpx;color: #606266;padding-bottom:0">
+        <text class="flex-1" style="padding-right:20rpx;font-size:36rpx">123 456 789</text>
+        <image src="../../../image/money.jpg" style="width:70rpx;height:70rpx" catchTap="showText" />
+      </view>
+    </view>
+    <view style="padding:20rpx;box-shadow: 0px 0px 10px #ccc;border-radius: 4px;margin-bottom:20rpx">
+      <view style="color: #606266;font-size:28rpx;padding-bottom:20rpx;">
+        这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色这个颜色
+      </view>
+      <view class="flex-box-ce">
+        <image src="../../../image/money.jpg" style="width:200rpx;height:200rpx;border-radius: 10rpx;" />
+        <view class="flex-box-v flex-1" style="height:200rpx;padding-top:20rpx;padding-left:20rpx;">
+          <view style="margin-bottom:30rpx"> 单价:20功勋点</view>
+          <view class="fontColorF" style="margin-bottom:30rpx"> 数量:1</view>
+          <view > 总价:20功勋点</view>
+        </view>
+      </view>
+    </view>
+  </view>
+  
+  
+  <view a:if="{{isBh}}" class="windows" content="还没有积分事件">
+    <view class="windows-box">
+      <view class="windows-title">兑换码</view>
+      <view class="flex-box-ce flex-center-center" style="margin-bottom:20rpx;">
+        <text style="padding-right:20rpx;font-size:36rpx">285 5451 654</text>
+        <button size="mini" open-type="share" catchTap="handleCopy">复制</button>
+      </view>
+      <view style="text-align:center;padding:20rpx 0;">
+        <image src="../../../image/money.jpg" style="width:260rpx;height:260rpx;border-radius: 10rpx" />
+      </view>
+      <view class="windows-content">提供兑换码或二维码给奖品兑换负责人即可</view>
+      <view class="windows-btn flex-box flex-v-ce">
+        <view class="flex-1" catchTap="showText">我知道了</view>
+      </view>
+    </view>
+  </view>
+</view>

+ 15 - 0
pages/exchange/prizeDetail/prizeDetail.js

@@ -0,0 +1,15 @@
+Page({
+  data: {},
+  onLoad() {
+    dd.setNavigationBar({ title: "奖品兑换详情" });
+  },
+  showText() {
+    this.setData({ isBh: !this.data.isBh })
+  },
+  handleCopy() {
+    dd.setClipboard({
+      text: this.data.text,
+    })
+    app.globalData.showToast("已复制");
+  }
+});

+ 1 - 0
pages/exchange/prizeDetail/prizeDetail.json

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

+ 28 - 0
pages/statistics/B_ranking/B_ranking.js

@@ -15,6 +15,34 @@ Page({
     dd.setNavigationBar({ title: "累计B分排名" });
     this.getData();
   },
+  onShareAppMessage() {
+    return {
+      title: '累计B分排名',
+      desc: '积分排名有变动了,快来看看!',
+      path: 'pages/statistics/B_ranking/B_ranking'
+    };
+  },
+  onShow() {
+    if (app.globalData.userData) {
+      if (that.data.page == 1) {
+        dd.hideLoading();
+        that.getData();
+      }
+    } else {
+      app.login(app.globalData.corpId, function (is) {
+        if (is) {
+          if (that.data.page == 1) {
+            dd.hideLoading();
+            that.getData();
+          }
+        } else {
+          dd.reLaunch({
+            url: '../noJurisdiction/noJurisdiction'
+          })
+        }
+      },function(){})
+    }
+  },
   getData(is){
     var data = {
       page: that.data.page,

+ 1 - 1
pages/statistics/allTask/allTask.axml

@@ -17,7 +17,7 @@
       <view style="margin-top:16rpx;">
         <view class="search flex-box flex-v-ce">
           <image mode="scaleToFill" src="../../../image/ss.png"/>
-          <input class="flex-1" placeholder="请输入任务内容" onInput="bindKeyInput" class="flex-1"/>
+          <input class="flex-1" placeholder="请输入任务内容" onInput="bindKeyInput"/>
           <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
         </view>
       </view>

+ 3 - 2
pages/statistics/checkDetail/checkDetail.js

@@ -12,7 +12,8 @@ Page({
     dd.setNavigationBar({ title: "排名" });
     if (e.item) {
       this.setData({
-        item: JSON.parse(e.item)
+        item: JSON.parse(e.item),
+        type:JSON.parse(e.item).type
       })
       this.setData({
         item_obj: that.data.item.item
@@ -32,7 +33,7 @@ Page({
     console.log(item);
     //条件选择 0-全部 1-迟到 2-早退 6-准时打卡 20-上班缺卡 21-下班缺卡 16-加班 10-缺勤
     // type-1 总分,type-2早到,type-3迟到,4-加班, 8-早退, 9-缺卡,10-缺勤 6-奖分 7-扣分
-    switch (item.type) {
+    switch (this.data.type) {
       case 0:
         item.type = 1;
         break

+ 7 - 1
pages/statistics/check_top/check_top.js

@@ -25,8 +25,14 @@ Page({
     defaultDate:{type:"2",date:[app.globalData.day,app.globalData.day]},
   },
   onLoad() {
+    var lastDay= new Date(app.globalData.year,app.globalData.month_tow,0).getDate()
+    this.setData({
+      defaultDate:{type:"2",date:[app.globalData.month+'-01',app.globalData.month+'-'+lastDay]},
+      dateObj:[app.globalData.month+'-01',app.globalData.month+'-'+lastDay]
+    })
+    console.log(this.data.defaultDate)
     that = this;
-    dd.setNavigationBar({ title: "考勤积分排名" });
+    dd.setNavigationBar({ title: "考勤分" });
     this.getTisrr();
   },
   openDetail(e) {

+ 7 - 0
pages/statistics/getTask/getTask.js

@@ -16,6 +16,13 @@ Page({
       userId: app.globalData.userData.id
     })
   },
+  onShareAppMessage() {
+    return {
+      title: '悬赏任务大厅',
+      desc: '有新的悬赏任务发布啦,大家快来抢!',
+      path: 'pages/statistics/getTask/getTask'
+    };
+  },
   onShow() {
     if (app.globalData.userData) {
       if (that.data.page == 1) {

+ 4 - 3
pages/statistics/index/index.js

@@ -23,7 +23,7 @@ Page({
           { name: '发布悬赏', imgUrl: '../../../image/caback6.png', url: '../offerAreward/offerAreward', code: 'creator admin ' },
           { name: '我发布的', imgUrl: '../../../image/my_publish.png', url: '../my_issue/my_issue', code: 'creator admin ' },
           { name: '我的任务', imgUrl: '../../../image/my_task.png', url: '../my_task/my_task', code: 'admin employee' },
-          { name: '我审批的', imgUrl: '../../../image/my_task.png', url: '../my_sp/my_sp', code: 'creator admin' },
+          { name: '我审批的', imgUrl: '../../../image/my_examine.png', url: '../my_sp/my_sp', code: 'creator admin' },
           { name: '领任务', imgUrl: '../../../image/task_hall.png', url: '../getTask/getTask', code: 'creator admin employee' },
           { name: '全部任务', imgUrl: '../../../image/apply_list.png', url: '../allTask/allTask', code: 'creator admin' },
         ]
@@ -31,7 +31,7 @@ Page({
       {
         code: '统计分析', child: [
           { name: '排行榜', imgUrl: '../../../image/att_statistics.png', url: '../userRamking/userRamking', code: 'creator admin ' },
-          { name: '考勤分', imgUrl: '../../../image/att_statistics.png', url: '../check_top/check_top', code: 'creator admin employee' },
+          { name: '考勤分', imgUrl: '../../../image/att_sign.png', url: '../check_top/check_top', code: 'creator admin employee' },
           { name: '日志分', imgUrl: '../../../image/log1.png', url: '../log_rank/log_rank', code: 'creator admin employee' },
           { name: '任务分', imgUrl: '../../../image/log2.png', url: '../task_rank/task_rank', code: 'creator admin employee' },
           { name: '积分事件', imgUrl: '../../../image/event_list_a.png', url: '../integralEvent/integralEvent', code: 'creator admin employee' },
@@ -41,7 +41,8 @@ Page({
         code: '其他', child: [
           { name: '组织架构', imgUrl: '../../../image/dept.png', url: '../../deploy/organization/organization', code: 'creator admin employee' },
           { name: '积分规则', imgUrl: '../../../image/rule.png', url: '../../deploy/integralRule/integralRule', code: 'creator admin employee' },
-          { name: '考勤分规则', imgUrl: '../../../image/rule.png', url: '../../deploy/setCheck/setCheck', code: 'creator admin employee' },
+          { name: '考勤分规则', imgUrl: '../../../image/log1.png', url: '../../deploy/setCheck/setCheck', code: 'creator admin employee' },
+          // { name: '福利兑换', imgUrl: '../../../image/fl.png', url: '../../exchange/exchange/exchange', code: 'creator admin employee' },
           // { name: '工作汇报分规则', imgUrl: '../../../image/e66f.jpg', url: '../my_approve/my_approve', code: 'creator admin employee' },
         ]
       },

+ 1 - 1
pages/statistics/log_rank/log_rank.acss

@@ -23,7 +23,7 @@
   width: 40rpx;
   height: 40rpx;
 }
-.scroll{
+.scroll {
   height: calc(100vh - 140rpx);
 }
 .name{

+ 15 - 10
pages/statistics/log_rank/log_rank.axml

@@ -1,19 +1,22 @@
 <view>
   <view class="{{popupCx}}">
     <view class="flex-box flex-v-ce tab">
+      <view class="flex-1" catchTap="selectDate">
+        <text class="{{showDate? 'activeView blue':''}}">{{selectDateVal}}</text>
+      </view>
       <view class="flex-1" catchTap="selectTissue">
         <text class="{{showTissue? 'activeView blue':''}}">{{TissueVal}}</text>
       </view>
-      <view class="flex-1" catchTap="selectStaff">
-        <text class="{{showStaff? 'activeView blue':''}}">{{staffVal}}</text>
-      </view>
-      <view class="flex-1" catchTap="selectDate">
-        <text class="{{showDate? 'activeView blue':''}}">{{selectDateVal}}</text>
+      <!-- <view class="flex-1" catchTap="selectRule">
+        <text class="{{showRuleTwo? 'activeView blue':''}}">{{ruleVal}}</text>
       </view>
+      <view class="flex-1" catchTap="selectSx">
+        <text class="{{showSx? 'activeView blue':''}}">{{sxVal}}</text>
+      </view> -->
     </view>
-    <view class="fontColorF" style="font-size:28rpx;padding:10rpx 28rpx;">排名包含初始分和工龄分</view>
+    <view class="fontColorF" style="font-size:28rpx;padding:10rpx 28rpx;">排名包含初始分和工龄分</view>
     <view class="main scroll">
-      <scroll-view lower-threshold="100" class="scroll" scroll-y="{{true}}" a:if="{{list.length>0}}" onScrollToLower="onScrollToLower">
+      <scroll-view class="scroll" scroll-y="{{true}}" a:if="{{list.length>0}}" onScrollToLower="onScrollToLower">
         <view a:for="{{list}}" data-item="{{item}}" class="flex-box flex-v-ce item border-bottom">
           <view a:if="{{item.rank==1}}" class="index">
             <image mode="scaleToFill" src="../../../image/1.png"></image>
@@ -31,12 +34,14 @@
           </view>
           <view class="blue" style="margin-right:28rpx;">{{item.point}}</view>
         </view>
-        <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
+                <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
       </scroll-view>
       <no-data a:if="{{list.length==0}}"></no-data>
     </view>
   </view>
-  <select-staff defaultUser="{{employee_ids}}" isShow="{{showStaff}}" a:if="{{showStaff==true}}" onClose="onClose" onConfirm="onConfirmStaff"></select-staff>
-  <select-date defaultDate="{{defaultDate}}" isShow="{{showDate}}" a:if="{{showDate==true}}" onClose="onClose" onConfirm="onConfirmDate"></select-date>
+
   <select-section defaultSection="{{dept_id}}" a:if="{{showTissue==true}}" isShow="{{showTissue}}" onClose="onClose" onConfirm="onConfirmTissue"></select-section>
+  <select-sx defaultSx="{{sxObj}}" a:if="{{showSx==true}}" isShow="{{showSx}}" onClose="onClose" onConfirm="onConfirmSx"></select-sx>
+  <select-date dateObj="{{dateObj}}" a:if="{{showDate==true}}" isShow="{{showDate}}" onClose="onClose" onConfirm="onConfirmDate"></select-date>
+  <select-rule-two defaultSection="{{rule_id}}" a:if="{{showRuleTwo==true}}" isShow="{{showRuleTwo}}" onClose="onClose" onConfirm="onConfirmRule"></select-rule-two>
 </view>

+ 129 - 86
pages/statistics/log_rank/log_rank.js

@@ -3,89 +3,68 @@ var app = getApp()
 var that;
 Page({
   data: {
-    showTissue: false,//显示部门组件
-    TissueVal: '全公司',
-    
-    isPx: true,
-    page: 1,
-    scroll_top: 0,
-    popupCx: '',
+    date: app.globalData.month,
+    minuteIndex: 0,//条件选择
+    minuteArray: [
+      { id: 0, name: '总分' },
+      { id: 1, name: '加班' },
+      { id: 2, name: '迟到' },
+    ],
 
     showDate: false,//是否显示时间组件
-    selectDateVal: '本月',
+    selectDateVal: app.globalData.month,
+
+    showSx: false,//显示sx选择
+    sxVal: '筛选',
+
+    showRuleTwo: false,//显示规则组件
+    ruleVal: "规则分类",
+
+    showTissue: false,//显示部门组件
+    TissueVal: '全公司',
 
-    showStaff: false,//显示员工选择
-    staffVal: '员工',
+    sort:'DESC',
+    position:'all',
+    year:app.globalData.year,
+    page:1,
+    dateIndex:'3',
+    popupCx: '',
+    pt_id:'3',
   },
   onLoad() {
     that = this;
-    dd.setNavigationBar({ title: "日志分排名" });
-    // this.getData();
-  },
-  //选择时间
-  onConfirmDate(data) {
-    that.setData({
-      defaultDate: data,
-      dateObj: data.date,
-      date_type: data.type == 1 ? 3 : data.type,
-      page: 1,
-      selectDateVal: data.type == 1 ? (data.date == that.data.date ? '本月' : '月') : '日',
-    })
-    this.getData();
-  },
-  //选择员工
-  onConfirmStaff(data) {
-    if (!data) {
-      this.setData({ staffVal: '员工', employee_ids: '', page: 1 })
-      this.getData();
-      return false;
-    }
-    if (data.length > 0) {
-      if (data.length > 1) {
-        var str = "";
-        var arr = [];
-        data.forEach((item) => {
-          str += item.name + ','
-          arr.push(item.id);
-        })
-        var employee_ids = arr.join(',');
-        this.setData({ staffVal: str.substring(0, str.length - 1), employee_ids: employee_ids, page: 1 })
-      } else {
-        this.setData({ staffVal: data[0].name, employee_ids: [data[0].id], page: 1 })
-      }
-    } else {
-      this.setData({ staffVal: '员工', employee_ids: [], page: 1 })
-    }
+    dd.setNavigationBar({ title: "日志分" });
     this.getData();
   },
-  //显示选择时间组件
-  selectDate() {
-    this.setData({
-      popupCx: 'container__mask',
-      showDate: true
-    })
-  },
-  //显示选择员工
-  selectStaff() {
-    this.setData({
-      popupCx: 'container__mask',
-      showStaff: true
-    })
-  },
-  getData(is) {
+  getData(is) {  
     var data = {
+      pt_id:that.data.pt_id,
+      dept_id:that.data.dept_id,
       page: that.data.page,
-      page_size: 20,
-      dept_id: that.data.dept_id,
-      pt_id: app.getTypesItem('BF').id,
-      sort: that.data.isPx ? 'DESC' : 'ASC',
-      type: 'all',
+      rule_id: that.data.rule_id,
+      sort:that.data.sort,
+      position:that.data.position,
+      page_size:20,
+      source_type: '10',
     }
-    app.$get('api/integral/statistics/ranking', data, 'application/vnd.test.v2+json').then((res) => {
+    if(that.data.dateIndex=='1'){
+      data.year=that.data.year;
+    }else if(that.data.dateIndex=='2'){
+      data.quarter=that.data.quarter
+    }else if(that.data.dateIndex=='4'){
+      data.start_date=that.data.custom.start_date
+      data.end_date=that.data.custom.end_date
+    }else{
+      data.month=that.data.month||app.globalData.month;
+    }
+    
+    app.$get('api/integral/statistics/ranking',data,'application/vnd.test.v2+json').then((res) => {
       var data = res.data.data.list;
       if (is) {
         if (data.length == 0) {
-          this.setData({ isData: true })
+          this.setData({
+            isData: true
+          })
           return;
         }
         var list = that.data.list;
@@ -93,51 +72,115 @@ Page({
           list: list.concat(data)
         })
       } else {
-        this.setData({ list: [] });
+        this.setData({list:[]});
         this.setData({
           list: data,
-          isData: false,
+          isData: false
         })
       }
     })
   },
   //上啦加载
   onScrollToLower() {
-    if (!that.data.isData) {
+    if(!that.data.isData){
       this.setData({ page: ++that.data.page })
       this.getData(true);
     }
   },
-  selectIsPx() {
+  // //打开兴趣
+  // openDetail(e) {
+  //   var item = e.target.dataset.item;
+  //   console.log(item)
+  //   dd.navigateTo({
+  //     url: '../prizeBuckleDetail/prizeBuckleDetail?id=' + item.employee_id
+  //   })
+  // },
+  //显示规则组件
+  selectRule() {
     this.setData({
-      isPx: !this.data.isPx,
-      page: 1
+      popupCx: 'container__mask',
+      showRuleTwo: true
+    })
+  },
+  //显示选择时间组件
+  selectDate() {
+    this.setData({
+      popupCx: 'container__mask',
+      showDate: true
     })
-    this.getData();
   },
-  //打开兴趣
-  openDetail(e) {
-    var item = e.target.dataset.item;
-    dd.navigateTo({
-      url: '../prizeBuckleDetail/prizeBuckleDetail?item=' + item
+  //显示选择员工
+  selectSx() {
+    this.setData({
+      popupCx: 'container__mask',
+      showSx: true
     })
   },
+  //选择时间
+  onConfirmDate(data) {
+    this.setData({
+        dateObj: data,
+    })
+    if (data.type == '1') {
+      this.setData({
+        selectDateVal:data.date,
+        year:data.date,
+        dateIndex:data.type
+      })
+    } else if(data.type == '2'){
+      this.setData({
+        selectDateVal:data.date+'季度',
+        quarter: data.date,
+        dateIndex:data.type
+      })
+    } else if(data.type == '4'){
+      this.setData({
+        selectDateVal: data.date.start_date + '--' + data.date.end_date,
+        custom: data.date,
+        dateIndex:data.type
+      })
+    }else{
+       this.setData({
+        selectDateVal: data.date,
+        month:data.date,
+        dateIndex:data.type
+      })
+    }
+    this.setData({page:1})
+    this.getData();
+  },
   //关闭弹窗
   onClose() {
     this.setData({
-      showTissue: false,
       showDate: false,
-      showStaff: false,
-      popupCx: '',
+      showSx: false,
+      showRuleTwo: false,
+      showTissue: false,
+      popupCx: ''  
     })
   },
+  //选择筛选
+  onConfirmSx(data) {
+    console.log(data)
+   this.setData({sxObj:data, sort:data[1],position:data[0],pt_id:data[2],page:1})
+   this.getData();
+  },
+  //选择规则
+  onConfirmRule(data) {
+    this.setData({
+      rule_id: data.id ? data.id : '',
+      page: 1,
+      ruleVal: data.name
+    })
+    this.getData();
+  },
   //显示部门选择组件
   selectTissue() {
-    this.setData({ showTissue: !this.data.showTissue, popupCx: 'container__mask', })
+    this.setData({ showTissue: !this.data.showTissue,popupCx: 'container__mask', })
   },
   //选择部门
   onConfirmTissue(data) {
-    this.setData({ dept_id: data.id, page: 1, TissueVal: data.name })
+    this.setData({ dept_id: data.id,page:1,TissueVal:data.name })
     this.getData();
   },
 });

+ 4 - 3
pages/statistics/log_rank/log_rank.json

@@ -1,9 +1,10 @@
 {
   "usingComponents": {
-     "img-box": "/Component/img-box/index",
+    "img-box": "/Component/img-box/index",
+    "select-date": "/Component/selectDate_two/selectDate_two",
+    "select-sx": "/Component/selectSx/selectSx",
+    "select-rule-two": "/Component/selectRule_two/selectRule_two",
     "select-section": "/Component/selectSection/selectSection",
-    "select-date": "/Component/selectDate/selectDate",
-    "select-staff": "/Component/selectStaff/selectStaff",
     "no-data": "/Component/noData/noData"
   }
 }

+ 1 - 0
pages/statistics/my_apply/my_apply.axml

@@ -21,6 +21,7 @@
           <view class="flex-box">
             <view class="name flex-1" style="margin-right: 10rpx;">{{item.remark.customize || item.remark.rule}}</view>
             <view class="red" a:if="{{item.review_point > 0}}">+{{item.review_point}} {{item.pt_name}}</view>
+            <view class="green" a:else>{{item.review_point}} {{item.pt_name}}</view>
           </view>
           <view class="flex-box flex-v-ce">
             <view class="date flex-1">{{item.event_time}}</view>

+ 1 - 1
pages/statistics/my_sp/my_sp.axml

@@ -17,7 +17,7 @@
       <view style="margin-top:16rpx;">
         <view class="search flex-box flex-v-ce">
           <image mode="scaleToFill" src="../../../image/ss.png"/>
-          <input class="flex-1" placeholder="请输入任务内容" onInput="bindKeyInput" class="flex-1"/>
+          <input class="flex-1" placeholder="请输入任务内容" onInput="bindKeyInput"/>
           <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
         </view>
       </view>

+ 29 - 1
pages/statistics/sectionRanking/sectionRanking.js

@@ -31,11 +31,40 @@ Page({
     popupCx: '',
     pt_id:'3',
   },
+  onShareAppMessage() {
+    return {
+      title: '阶段排名',
+      desc: '积分排名有变动了,快来看看!',
+      path: 'pages/statistics/sectionRanking/sectionRanking'
+    };
+  },
   onLoad() {
     that = this;
     dd.setNavigationBar({ title: "阶段排名" });
     this.getData();
   },
+  onShow() {
+    if (app.globalData.userData) {
+      if (that.data.page == 1) {
+        dd.hideLoading();
+        that.getData();
+      }
+    } else {
+      app.login(app.globalData.corpId, function (is) {
+        if (is) {
+          if (that.data.page == 1) {
+            dd.hideLoading();
+            that.getData();
+          }
+        } else {
+          dd.reLaunch({
+            url: '../noJurisdiction/noJurisdiction'
+          })
+        }
+      },function(){})
+    }
+
+  },
   getData(is) {  
     var data = {
       pt_id:that.data.pt_id,
@@ -56,7 +85,6 @@ Page({
     }else{
       data.month=that.data.month||app.globalData.month;
     }
-    
     app.$get('api/integral/statistics/ranking',data,'application/vnd.test.v2+json').then((res) => {
       var data = res.data.data.list;
       if (is) {

+ 30 - 3
pages/statistics/taskDetail/taskDetail.js

@@ -9,22 +9,49 @@ Page({
     isPublisher: true,//是不是发布者
     userId: '',
     id: '',
-    isCreator:false,
+    isCreator: false,
   },
   onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "任务详情" });
     this.setData({
-      isCreator:app.globalData.isCreator
+      isCreator: app.globalData.isCreator
     })
     if (e.id) {
-      that.getDetail(e.id);
+      // that.getDetail(e.id);
       this.setData({
         id: e.id,
         userId: app.globalData.userData.id
       })
     }
   },
+  onShow() {
+    if (app.globalData.userData) {
+      dd.hideLoading();
+      that.getDetail(that.data.id);
+    } else {
+      app.login(app.globalData.corpId, function (is) {
+        if (is) {
+          dd.hideLoading();
+          that.setData({
+            userId: app.globalData.userData.id
+          })
+          that.getDetail(that.data.id);
+        } else {
+          dd.reLaunch({
+            url: '../noJurisdiction/noJurisdiction'
+          })
+        }
+      }, function () { })
+    }
+  },
+  onShareAppMessage() {
+    return {
+      title: '任务详情',
+      desc:'积分任务:'+ this.data.dataDetail.task_name,
+      path: 'pages/statistics/taskDetail/taskDetail?id=' + this.data.id
+    };
+  },
   bindPickerChange(e) {
     if (this.data.array[e.detail.value] == '删除任务') {
       dd.confirm({

+ 31 - 0
pages/statistics/task_rank/task_rank.acss

@@ -0,0 +1,31 @@
+
+.main{
+  background: #fff;
+}
+.item{
+  padding: 16rpx 0;
+}
+.item .flex-2{
+    padding-left: 28rpx; 
+}
+.users{
+  margin-left: 20rpx;
+}
+.num{
+  font-size: 24rpx;
+  color: #909399;
+}
+.index{
+  width: 90rpx;
+  text-align: center;
+}
+.index image{
+  width: 40rpx;
+  height: 40rpx;
+}
+.scroll {
+  height: calc(100vh - 140rpx);
+}
+.name{
+  margin-left: 20rpx;
+}

+ 51 - 1
pages/statistics/task_rank/task_rank.axml

@@ -1,3 +1,53 @@
 <view>
-  New Page
+  <view class="{{popupCx}}">
+    <view class="flex-box flex-v-ce tab">
+      <view class="flex-1" catchTap="selectDate">
+        <text class="{{showDate? 'activeView blue':''}}">{{selectDateVal}}</text>
+      </view>
+      <view class="flex-1" catchTap="selectTissue">
+        <text class="{{showTissue? 'activeView blue':''}}">{{TissueVal}}</text>
+      </view>
+      <view class="flex-1">
+        <picker onChange="bingIntegralType" value="{{typesIndex}}" range="{{types}}" range-key="name">
+          <text a:if="{{types[typesIndex].name=='全部'}}">积分类型</text>
+          <text a:else>{{types[typesIndex].name}}</text>
+        </picker>
+      </view>
+      <!-- <view class="flex-1" catchTap="selectRule">
+        <text class="{{showRuleTwo? 'activeView blue':''}}">{{ruleVal}}</text>
+      </view> -->
+      <!-- <view class="flex-1" catchTap="selectSx">
+        <text class="{{showSx? 'activeView blue':''}}">{{sxVal}}</text>
+      </view> -->
+    </view>
+    <view class="fontColorF" style="font-size:28rpx;padding:10rpx 28rpx;">排名不包含初始分和工龄分</view>
+    <view class="main scroll">
+      <scroll-view class="scroll" scroll-y="{{true}}" a:if="{{list.length>0}}" onScrollToLower="onScrollToLower">
+        <view a:for="{{list}}" data-item="{{item}}" class="flex-box flex-v-ce item border-bottom">
+          <view a:if="{{item.rank==1}}" class="index">
+            <image mode="scaleToFill" src="../../../image/1.png"></image>
+          </view>
+          <view a:elif="{{item.rank==2}}" class="index">
+            <image mode="scaleToFill" src="../../../image/2.png"></image>
+          </view>
+          <view a:elif="{{item.rank==3}}" class="index">
+            <image mode="scaleToFill" src="../../../image/3.png"></image>
+          </view>
+          <view a:else class="index">{{item.rank}}</view>
+          <view class="flex-1 flex-box flex-v-ce">
+            <img-box name="{{item.employee_name}}" imgUrl="{{item.employee_img_url}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
+            <view class="name">{{item.employee_name}}</view>
+          </view>
+          <view class="blue" style="margin-right:28rpx;">{{item.point}}</view>
+        </view>
+                <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
+      </scroll-view>
+      <no-data a:if="{{list.length==0}}"></no-data>
+    </view>
+  </view>
+
+  <select-section defaultSection="{{dept_id}}" a:if="{{showTissue==true}}" isShow="{{showTissue}}" onClose="onClose" onConfirm="onConfirmTissue"></select-section>
+  <select-sx defaultSx="{{sxObj}}" a:if="{{showSx==true}}" isShow="{{showSx}}" onClose="onClose" onConfirm="onConfirmSx"></select-sx>
+  <select-date dateObj="{{dateObj}}" a:if="{{showDate==true}}" isShow="{{showDate}}" onClose="onClose" onConfirm="onConfirmDate"></select-date>
+  <select-rule-two defaultSection="{{rule_id}}" a:if="{{showRuleTwo==true}}" isShow="{{showRuleTwo}}" onClose="onClose" onConfirm="onConfirmRule"></select-rule-two>
 </view>

+ 191 - 2
pages/statistics/task_rank/task_rank.js

@@ -1,4 +1,193 @@
+
+var app = getApp()
+var that;
+var typeArr = [];
 Page({
-  data: {},
-  onLoad() {},
+  data: {
+    date: app.globalData.month,
+    minuteIndex: 0,//条件选择
+    minuteArray: [
+      { id: 0, name: '总分' },
+      { id: 1, name: '加班' },
+      { id: 2, name: '迟到' },
+    ],
+
+    showDate: false,//是否显示时间组件
+    selectDateVal: app.globalData.month,
+
+    showSx: false,//显示sx选择
+    sxVal: '筛选',
+
+    showRuleTwo: false,//显示规则组件
+    ruleVal: "规则分类",
+
+    showTissue: false,//显示部门组件
+    TissueVal: '全公司',
+
+    sort: 'DESC',
+    position: 'all',
+    year: app.globalData.year,
+    page: 1,
+    dateIndex: '3',
+    popupCx: '',
+    pt_id: '3',
+
+    types: [{id: '3', name: 'B分'},{ id: '2', name: 'A分' }],//积分分类
+    typesIndex: '0',
+  },
+  onLoad() {
+    that = this;
+    dd.setNavigationBar({ title: "任务分" });
+
+  },
+  onShow() {
+    this.getData();
+  },
+  getData(is) {
+    var data = {
+      pt_id: that.data.types.length > 0 ? that.data.types[that.data.typesIndex].id : '2',
+      dept_id: that.data.dept_id,
+      page: that.data.page,
+      rule_id: that.data.rule_id,
+      sort: that.data.sort,
+      position: that.data.position,
+      page_size: 20,
+      source_type: '2',
+    }
+    if (that.data.dateIndex == '1') {
+      data.year = that.data.year;
+    } else if (that.data.dateIndex == '2') {
+      data.quarter = that.data.quarter
+    } else if (that.data.dateIndex == '4') {
+      data.start_date = that.data.custom.start_date
+      data.end_date = that.data.custom.end_date
+    } else {
+      data.month = that.data.month || app.globalData.month;
+    }
+
+    app.$get('api/integral/statistics/ranking', data, 'application/vnd.test.v2+json').then((res) => {
+      var data = res.data.data.list;
+      if (is) {
+        if (data.length == 0) {
+          this.setData({
+            isData: true
+          })
+          return;
+        }
+        var list = that.data.list;
+        this.setData({
+          list: list.concat(data)
+        })
+      } else {
+        this.setData({ list: [] });
+        this.setData({
+          list: data,
+          isData: false
+        })
+      }
+    })
+  },
+  //上啦加载
+  onScrollToLower() {
+    if (!that.data.isData) {
+      this.setData({ page: ++that.data.page })
+      this.getData(true);
+    }
+  },
+  //选择积分分类
+  bingIntegralType(e) {
+    this.setData({
+      typesIndex: e.detail.value,
+      page: 1
+    });
+    this.getData();
+  },
+  //显示规则组件
+  selectRule() {
+    this.setData({
+      popupCx: 'container__mask',
+      showRuleTwo: true
+    })
+  },
+  //显示选择时间组件
+  selectDate() {
+    this.setData({
+      popupCx: 'container__mask',
+      showDate: true
+    })
+  },
+  //显示选择员工
+  selectSx() {
+    this.setData({
+      popupCx: 'container__mask',
+      showSx: true
+    })
+  },
+  //选择时间
+  onConfirmDate(data) {
+    this.setData({
+      dateObj: data,
+    })
+    if (data.type == '1') {
+      this.setData({
+        selectDateVal: data.date,
+        year: data.date,
+        dateIndex: data.type
+      })
+    } else if (data.type == '2') {
+      this.setData({
+        selectDateVal: data.date + '季度',
+        quarter: data.date,
+        dateIndex: data.type
+      })
+    } else if (data.type == '4') {
+      this.setData({
+        selectDateVal: data.date.start_date + '--' + data.date.end_date,
+        custom: data.date,
+        dateIndex: data.type
+      })
+    } else {
+      this.setData({
+        selectDateVal: data.date,
+        month: data.date,
+        dateIndex: data.type
+      })
+    }
+    this.setData({ page: 1 })
+    this.getData();
+  },
+  //关闭弹窗
+  onClose() {
+    this.setData({
+      showDate: false,
+      showSx: false,
+      showRuleTwo: false,
+      showTissue: false,
+      popupCx: ''
+    })
+  },
+  //选择筛选
+  onConfirmSx(data) {
+    console.log(data)
+    this.setData({ sxObj: data, sort: data[1], position: data[0], pt_id: data[2], page: 1 })
+    this.getData();
+  },
+  //选择规则
+  onConfirmRule(data) {
+    this.setData({
+      rule_id: data.id ? data.id : '',
+      page: 1,
+      ruleVal: data.name
+    })
+    this.getData();
+  },
+  //显示部门选择组件
+  selectTissue() {
+    this.setData({ showTissue: !this.data.showTissue, popupCx: 'container__mask', })
+  },
+  //选择部门
+  onConfirmTissue(data) {
+    this.setData({ dept_id: data.id, page: 1, TissueVal: data.name })
+    this.getData();
+  },
 });

+ 10 - 1
pages/statistics/task_rank/task_rank.json

@@ -1 +1,10 @@
-{}
+{
+  "usingComponents": {
+    "img-box": "/Component/img-box/index",
+    "select-date": "/Component/selectDate_two/selectDate_two",
+    "select-sx": "/Component/selectSx/selectSx",
+    "select-rule-two": "/Component/selectRule_two/selectRule_two",
+    "select-section": "/Component/selectSection/selectSection",
+    "no-data": "/Component/noData/noData"
+  }
+}

+ 7 - 0
pages/statistics/workDetail/workDetail.js

@@ -30,6 +30,13 @@ Page({
     }
 
   },
+  onShareAppMessage() {
+    return {
+      title: '积分任务-功道云积分制',
+      desc: app.globalData.userData.name+'分享了任务:'+this.data.dataDetail.task_name,
+      path: 'pages/statistics/workDetail/workDetail'
+    };
+  },
   onShow() {
     if (app.globalData.userData) {
       dd.hideLoading();

+ 46 - 0
pages/workbench/apply/apply.acss

@@ -117,4 +117,50 @@ textarea::before{
   background: #fff;
   padding: 28rpx;
   border-bottom: 1px solid #f1f1f1;
+}
+.windows-box{
+  background: #fff;
+  margin: 0 32rpx;
+  margin-top: 30%;
+  border-radius: 20rpx; 
+}
+.windows-title{
+  text-align: center;
+  padding: 28rpx 0;
+  border-bottom: 1px solid #f1f1f1;
+}
+.windows-btn{
+   border-top: 1px solid #f1f1f1;
+}
+.windows-btn view:nth-child(1){
+  text-align: center;
+  padding: 28rpx 0;
+  border-right: 1px solid #f1f1f1;
+}
+.windows-btn button{
+  text-align: center;
+  color: #26A2FF;
+  background: #fff;
+  border: none;
+}
+.windows-content textarea{
+  height: 150rpx;
+  padding: 28rpx;
+}
+.results{
+  text-align: center;
+  font-size: 24rpx;
+  position: relative;
+}	
+.results view{
+  padding:10rpx 0rpx;
+}
+.resultsBox{
+  margin-top:20rpx;
+  border:1px solid #f1f1f1;
+  max-height:600rpx;
+  overflow-y:auto
+}
+.results:nth-child(odd){
+  background-color: #f1f1f1;
 }

+ 78 - 0
pages/workbench/apply/apply.axml

@@ -72,4 +72,82 @@
     <select-section-staff-two superior_list="{{superior_list}}" onClose="onClose" selectUser="{{reviewerObj}}" onConfirm="onSelectUser" a:if="{{isShowType=='2'}}"/>
     <select-section-staff  isAllSelect="{{false}}" isBoss="{{true}}" selectUser="{{employeeObj}}" onClose="onClose" onConfirm="onSelectUserEmployee" a:if="{{isShowType=='3'}}"/>
   </view>
+  <!-- 结果弹窗 -->
+  <view class="windows" a:if="{{isResult}}">
+    <view class="windows-box" style="margin-top:15%">
+      <view class="windows-title">处理结果</view>
+      <block a:if="{{!isShowError}}">
+        <view class="windows-content" style="padding:20rpx;">
+          <progress percent="{{percentage}}" show-info stroke-width="10" />
+          <view class="resultsBox">
+            <view class="flex-box-ce results">
+              <view style="width:60rpx;padding:0;text-align:center"></view>
+              <view class="flex-1">奖扣对象</view>
+              <view class="flex-2">申请内容</view>
+              <!-- <view class="flex-1">积分</view> -->
+              <view class="flex-2">处理结果</view>
+            </view>
+            <view a:for="{{results}}" class="flex-box-ce results">
+              <view style="width:60rpx;padding:0;text-align:center">{{results.length-index}}</view>
+              <view class="flex-1">{{item.target}}</view>
+              <view class="flex-2" style="padding: 0.1rem 0.1rem;">{{item.task.msg.remark}}</view>
+              <!-- <view class="flex-1">
+                {{ item.point>0? '+'+item.point:item.point }}
+                <text>{{ item.task.msg.pt_id==3? 'B分':'A分' }}</text>
+              </view> -->
+              <view class="green flex-2" a:if="{{item.status==1}}">
+                <text a:if="{{item.msg=='奖扣成功'}}" class="green">{{ item.msg }}</text>
+                <text a:else class="blue">{{ item.msg }}</text>
+              </view>
+              <view class="red flex-2" a:else>{{item.msg}}</view>
+            </view>
+          </view>
+        </view>
+        <view class="windows-btn flex-box flex-v-ce" a:if="{{results.length==resultList.length}}">
+          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
+        </view>
+      </block>
+      <view a:else class="windows-content" style="padding:20rpx;">
+        <view style="text-align: center;margin-bottom:20rpx" class="red">服务器繁忙,请稍后再试</view>
+        <view class="windows-btn flex-box flex-v-ce">
+          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
+        </view>
+      </view>
+    </view>
+  </view>
+
+  <!-- 错误弹窗 -->
+  <view class="windows" a:if="{{isErrorShow}}">
+    <view class="windows-box" style="margin-top:15%">
+      <view class="windows-title red">网络连接中断,请检查网络再次提交</view>
+      <view class="windows-content" style="padding:20rpx;">
+        <view class="resultsBox">
+          <view class="flex-box-ce results">
+            <view style="width:60rpx;padding:0;text-align:center"></view>
+            <view class="flex-1">奖扣对象</view>
+            <view class="flex-1">分类</view>
+            <view class="flex-1">规则</view>
+            <view class="flex-2">事件内容</view>
+            <!-- <view class="flex-1">积分</view> -->
+          </view>
+          <view a:for="{{errorList}}" class="flex-box-ce results">
+            <view style="width:60rpx;padding:0;text-align:center">{{index+1}}</view>
+            <view class="flex-1">{{item.name}}</view>
+            <view class="flex-1">{{ item.rule_name||'--' }}</view>
+            <view class="flex-1">{{ item.item_name||'--' }}</view>
+            <view class="flex-2">{{item.remark}}</view>
+            <!-- <view class="flex-1">
+              {{ item.point>0? '+'+item.point:item.point }}
+              <text>{{ item.task.msg.pt_id==3? 'B分':'A分' }}</text>
+            </view> -->
+          </view>
+        </view>
+      </view>
+      <view class="windows-btn flex-box flex-v-ce">
+        <button type="default" class="flex-1" catchTap="closeTc">取消</button>
+        <button type="default" class="flex-1" catchTap="resubmit">再次提交</button>
+      </view>
+    </view>
+  </view>
+
 </view>

+ 174 - 53
pages/workbench/apply/apply.js

@@ -1,6 +1,7 @@
 var app = getApp()
 var that;
 var animation;
+var setTime;
 Page({
   data: {
     members: '',//用户id
@@ -29,8 +30,18 @@ Page({
     defaultRuleId: '',
     qrcodeId: '',//扫码进入
     popupCx: '',
-    boxTop:0,
-    ruleOnoff:false,
+    boxTop: 0,
+    ruleOnoff: false,
+
+    // 长连接结果
+    results: [], //提交的返回结果集合
+    isResult: false,
+    percentage: 0,
+    resultList: [],//要发送数据的集合
+    resultIndex: 0,
+    isShowError: false,
+    errorList: [],
+    isErrorShow: false,
   },
   onLoad(e) {
     that = this;
@@ -60,27 +71,51 @@ Page({
       })
     }
   },
-  onPageScroll(e){
-      if(e.scrollTop!=0){
-        this.setData({
-          boxTop:e.scrollTop
-        })
-      }
+  onShow() {
+    dd.hideLoading();
+    animation = dd.createAnimation({
+      duration: 200,
+      timeFunction: "linear",
+    });
+    if (app.globalData.userData) {
+      that.showQrcode();
+    } else {
+      app.login(app.globalData.corpId, function (is) {
+        if (is) {
+          that.showQrcode();
+        } else {
+          dd.reLaunch({
+            url: '../noJurisdiction/noJurisdiction'
+          })
+        }
+      }, function () { })
+    }
+  },
+  // 页面被关闭
+  onUnload() {
+    app.globalData.socketApi.closewebsocket();
+  },
+  onPageScroll(e) {
+    if (e.scrollTop != 0) {
+      this.setData({
+        boxTop: e.scrollTop
+      })
+    }
   },
   //获取系统配置
   cheakAx() {
     app.$get("/api/integral/site/config").then((res) => {
-        let data = res.data.data;
-        if(data.specified_rule_item){
-          this.setData({
-            ruleOnoff: data.specified_rule_item == 1 ? true : false
-          })
-        }else{
-          this.setData({
-            ruleOnoff: false
-          })
-        }
-      })
+      let data = res.data.data;
+      if (data.specified_rule_item) {
+        this.setData({
+          ruleOnoff: data.specified_rule_item == 1 ? true : false
+        })
+      } else {
+        this.setData({
+          ruleOnoff: false
+        })
+      }
+    })
   },
   //获取缓存的审批人
   getReviewerObj(id, fuc) {
@@ -96,40 +131,20 @@ Page({
     });
   },
   revieList(id, fuc) {
-    app.$get('/api/employee/info', {id :id}).then(res =>{
+    app.$get('/api/employee/info', { id: id }).then(res => {
       var item = res.data.data || {}
-      if(item.employee_detail.superior_list && item.employee_detail.superior_id != 0){
+      if (item.employee_detail.superior_list && item.employee_detail.superior_id != 0) {
         let obj = item.employee_detail.superior_list.filter(x => x.id == item.employee_detail.superior_id)[0];
-        if(obj.id == app.globalData.userData.id){
-            this.getReviewerObj(id, fuc)
-        }else{
+        if (obj.id == app.globalData.userData.id) {
+          this.getReviewerObj(id, fuc)
+        } else {
           fuc(obj)
         }
-      }else{
+      } else {
         this.getReviewerObj(id, fuc)
       }
     })
   },
-  onShow() {
-    dd.hideLoading();
-    animation = dd.createAnimation({
-      duration: 200,
-      timeFunction: "linear",
-    });
-    if (app.globalData.userData) {
-     that.showQrcode();
-    } else {
-      app.login(app.globalData.corpId, function (is) {
-        if (is) {
-         that.showQrcode();
-        } else {
-          dd.reLaunch({
-            url: '../noJurisdiction/noJurisdiction'
-          })
-        }
-      },function(){})
-    }
-  },
   //显示二维码规则ID内容
   showQrcode() {
     if (this.data.qrcodeId) {
@@ -151,7 +166,7 @@ Page({
         var employee_id = `items[0].employee_id`
         var employeeName = `items[0].employeeName`
         that.setData({
-          [employee_id]:app.globalData.userData.id,
+          [employee_id]: app.globalData.userData.id,
           [employeeName]: app.globalData.userData.name,
           [selectRule]: item,
           [remark]: item.remark,
@@ -176,11 +191,11 @@ Page({
       isShowType: '',
       popupCx: ''
     });
-    setTimeout(()=>{
+    setTimeout(() => {
       dd.pageScrollTo({
         scrollTop: that.data.boxTop
       })
-    },100)
+    }, 100)
   },
   showToast(text) {
     app.globalData.showToast(text);
@@ -339,7 +354,18 @@ Page({
       [remark]: e.detail.value,
     });
   },
-
+  resubmit() {
+    this.setData({
+      resultList: this.data.errorList,
+      resultIndex: 0,
+      percentage: 0,
+      results: [],
+      isResult: true,
+      isErrorShow: false,
+      popupCx: 'container__mask',
+    })
+    this.opneWebSocket()
+  },
   formSubmit() {
     var items = this.data.items;
     var arr = [];
@@ -361,9 +387,11 @@ Page({
       if (item.checked) {
         obj.rule_id = item.selectRule ? item.selectRule.rule_id : 0;
         obj.item_id = item.selectRule ? item.selectRule.id : 0;
+        obj.item_name = item.selectRule ? item.selectRule.remark : '';
       } else {
         obj.rule_id = 0;
         obj.item_id = 0;
+        obj.item_name = "";
       }
       if (item.checked) {
         if (!obj.rule_id) {
@@ -381,8 +409,10 @@ Page({
     }
     if (isTg) {
       var data = {
-        items: JSON.stringify(arr)
+        items: arr
       }
+      this.webSocket(data)
+      return false;
       this.setData({ disabled: true });
       app.$post("api/integral/review/apply", data).then((res) => {
         var is = true;
@@ -422,6 +452,96 @@ Page({
       })
     }
   },
+  webSocket(data) {
+    data.items.forEach(item2 => {
+      item2.type = 'point_apply';
+    })
+    this.setData({
+      resultList: data.items,
+      resultIndex: 0,
+      percentage: 0,
+      results: [],
+      isResult: true,
+       popupCx: 'container__mask',
+    })
+    this.opneWebSocket()
+  },
+  returnResult(id) {
+    return app.globalData.usersList.filter(item => {
+      return item.id == id;
+    })
+  },
+  opneWebSocket() {
+    let wsData = this.data.resultList;
+    if (wsData[this.data.resultIndex]) {
+      setTime = setTimeout(() => {
+        let errorList = wsData.slice(this.data.resultIndex, wsData.length);
+        errorList.forEach(item => {
+          let obj = this.returnResult(item.employee_id)[0]
+          item.name = obj ? obj.name : '未知';
+        })
+        this.setData({
+          isErrorShow: true,
+          errorList: errorList
+        })
+        clearTimeout(setTime);
+        app.globalData.socketApi.closewebsocket();
+      }, 15000)
+      app.globalData.socketApi.sendData(wsData[this.data.resultIndex], this.onmessageWS);
+    } else {
+      // console.log(this.data.results)
+    }
+  },
+  onmessageWS(e) {
+    // 因为作用域问题,这个函数不能使用this
+    if (e.type == 'point_apply') {
+      clearTimeout(setTime);
+      let lng = that.data.resultList.length;// 进度条
+
+      let results = that.data.results;//结果集
+      results.unshift(e.result);
+
+      that.setData({
+        percentage: Math.floor(that.data.percentage += (100 / lng)),
+        results: results,
+        resultIndex: that.data.resultIndex + 1
+      })
+      that.opneWebSocket();
+      if (lng == that.data.results.length) {
+        that.setData({
+          percentage: 100,
+        })
+      }
+    }
+    if (e.type == 'error') {
+      clearTimeout(setTime);
+      that.setData({
+        isShowError: true,
+      })
+    }
+  },
+  closeTc() {
+    this.setData({
+      resultList: [],
+      resultIndex: 0,
+      percentage: 0,
+      results: [],
+      isShowError: false,
+      isResult: false,
+      popupCx: '',
+    })
+    setTimeout(() => {
+      if (this.data.qrcodeId) {
+        dd.switchTab({ url: '../index/index' })
+      } else {
+        dd.navigateBack({ delta: 1 })
+      }
+      this.setData({ disabled: false });
+    }, 1000);
+  },
+
+
+
   //删除一条
   deleteArr(e) {
     var index = e.target.dataset.index;
@@ -443,8 +563,8 @@ Page({
       [employee_id]: elm.id,
       [employeeName]: elm.name,
     });
-    this.revieList(elm.id, function(res){
-      if(res.name){
+    this.revieList(elm.id, function (res) {
+      if (res.name) {
         that.setData({
           [reviewer_id]: res.id,
           [revieweName]: res.name
@@ -493,7 +613,7 @@ Page({
   //添加一条
   addArr() {
     var list = that.data.items
-    if(list.length>=10){
+    if (list.length >= 10) {
       this.showToast('一次只能添加10条申请')
       return;
     }
@@ -540,6 +660,7 @@ Page({
     var index = this.data.activeIndex;
     var selectRule = `items[${index}].selectRule`
     var remark = `items[${index}].remark`
+    var remark = `items[${index}].remark`
     that.setData({
       [selectRule]: item,
       [remark]: item.remark,

+ 180 - 0
pages/workbench/approval_batch/approval_batch.acss

@@ -0,0 +1,180 @@
+.results{
+  text-align: center;
+  font-size: 24rpx;
+  position: relative;
+}	
+.results view{
+  padding:10rpx 0rpx;
+}
+.resultsBox{
+  margin-top:20rpx;
+  border:1px solid #f1f1f1;
+  max-height:600rpx;
+  overflow-y:auto
+}
+.results:nth-child(odd){
+  background-color: #f1f1f1;
+}
+.search {
+  background-color: #f1f1f1;
+  border-radius: 10rpx;
+  width: 90%;
+  margin: 0 auto;
+  padding: 6rpx 10rpx;
+}
+.search input {
+  background-color: #f1f1f1;
+}
+
+.search image {
+  width: 30rpx;
+  height: 30rpx;
+  margin-left: 10rpx;
+}
+
+.header {
+  background: #fff;
+  position: sticky;
+  top: 0;
+}
+.text2 {
+  border-radius: 50%;
+  border: 1px solid #909399;
+  color: #909399;
+  width: 26rpx;
+  height: 26rpx;
+  font-size: 22rpx;
+  text-align: center;
+  display: inline-block;
+  margin-left: 10rpx;
+  position: relative;
+  line-height: 26rpx;
+  box-sizing: border-box;
+}
+
+.selectItems {
+  margin-top: 20rpx;
+}
+.sxImg {
+  width: 30rpx;
+  height: 30rpx;
+}
+
+.selectItems .selectImg {
+  border-left: 1px solid #f1f1f1;
+  /* padding: 0 20rpx; */
+}
+
+.selectImg image {
+  width: 30rpx;
+  height: 30rpx;
+}
+
+.selectItems .flex-1 {
+  padding: 16rpx 0;
+  text-align: center;
+  position: relative;
+}
+
+.selectItems .active::before {
+  position: absolute;
+  content: " ";
+  height: 4rpx;
+  width: 120rpx;
+  background: #26A2FF;
+  bottom: 0rpx;
+}
+.li {
+  padding: 24rpx 28rpx;
+  padding-bottom: 0rpx;
+}
+.main{
+  background: #fff;
+}
+.main-right {
+  margin-left: 10rpx;
+}
+
+.main-right .name {
+  padding-top: 12rpx;
+  font-size: 36rpx;
+}
+
+.main-right .context {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  font-size: 32rpx;
+  -webkit-box-orient: vertical;
+  padding-top: 10rpx;
+  margin-bottom: 10rpx;
+}
+
+.main-right .date {
+  font-size: 32rpx;
+  color: #909399;
+}
+
+.main-right text {
+  color: #26A2FF;
+  font-size: 32rpx;
+}
+.footer{
+  position: fixed;
+  bottom: 0;
+  right: 0;
+  left: 0;
+  z-index: 999;
+  border-top: 1px solid #f1f1f1;
+  text-align: center;
+  background-color: #fff;
+}
+.footer view{
+  padding: 24rpx 0;
+  font-size: 32rpx;
+}
+
+.index {
+  border-radius: 6rpx;
+  background: #67C23A;
+  color: #fff;
+  font-size: 20rpx;
+  padding: 0 6rpx;
+}
+.label{
+    padding-bottom: 100rpx;
+}
+.scroll {
+  height:  calc(100vh - 300rpx);
+}
+
+.windows-box{
+  background: #fff;
+  margin: 0 32rpx;
+  margin-top: 30%;
+  border-radius: 20rpx; 
+}
+.windows-title{
+  text-align: center;
+  padding: 28rpx 0;
+  border-bottom: 1px solid #f1f1f1;
+}
+.windows-btn{
+   border-top: 1px solid #f1f1f1;
+}
+.windows-btn view:nth-child(1){
+  text-align: center;
+  padding: 28rpx 0;
+  border-right: 1px solid #f1f1f1;
+}
+.windows-btn button{
+  text-align: center;
+  color: #26A2FF;
+  background: #fff;
+  border: none;
+}
+.windows-content textarea{
+  height: 150rpx;
+  padding: 28rpx;
+}

+ 119 - 0
pages/workbench/approval_batch/approval_batch.axml

@@ -0,0 +1,119 @@
+<view>
+  <view class="header margin-bottom" style="padding-bottom:16rpx;">
+    <view class="flex-box flex-v-ce tab border-bottom">
+      <view class="flex-2" catchTap="selectStaff">
+        <text class="{{showStaff? 'activeView blue':''}}">{{staffVal}}</text>
+      </view>
+      <view class="flex-1"></view>
+    </view>
+    <view catchTap="showText" style="position: absolute;right:28rpx;top:20rpx;z-index:999">
+      <text style="font-size:28rpx">提示
+        <text class="text2">?</text></text>
+    </view>
+    <form onReset="onReset" style="position:relative">
+      <view style="margin-top:16rpx;">
+        <view class="search flex-box flex-v-ce">
+          <image mode="scaleToFill" src="../../../image/ss.png" />
+          <input class="flex-1" placeholder="请输入任务内容" onInput="bindKeyInput" />
+          <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
+        </view>
+      </view>
+    </form>
+  </view>
+  <view class="main scroll">
+    <no-bata a:if="{{dataList.length==0}}"></no-bata>
+    <scroll-view class="scroll" scroll-y="{{true}}" a:if="{{dataList.length>0}}" onScrollToLower="onScrollToLower">
+      <checkbox-group onChange="onChange" name="libs">
+        <view class="flex-box li border-bottom" a:for="{{dataList}}">
+          <label key="label-{{index}}" class="flex-box-ce label">
+            <checkbox value="{{item.id}}" checked="{{item.checked}}" style="font-size:20rpx" />
+            <img-box name="{{item.employee_name}}" id="{{item.employee_id}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
+          </label>
+          <view class="flex-1 main-right" catchTap="openDetail" data-item="{{item}}">
+            <view class="flex-box-ce">
+              <view class="name flex-1" a:if="{{item.source_type == 2}}">{{item.employee_name}}的积分申请</view>
+              <view class="name flex-1" a:if="{{item.source_type == 1}}">{{item.employee_name}}的积分任务</view>
+              <view class="name flex-1" a:if="{{item.source_type == 3}}">{{item.employee_name}}的积分奖扣</view>
+              <view class="name flex-1" a:if="{{item.source_type == 4}}">{{item.employee_name}}的绩效工作</view>
+              <view class="red" a:if="{{item.point>0}}">+{{item.point}}{{item.pt_name}}</view>
+              <view class="green" a:else>{{item.point}}{{item.pt_name}}</view>
+            </view>
+            <view class="context" a:if="{{item.remark.customize}}">{{item.remark.customize}}</view>
+            <view class="context" a:else>{{item.remark.rule}}</view>
+            <view class="flex-box flex-v-ce">
+              <view class="date flex-1">{{item.event_time}}</view>
+              <view class="flex-box flex-v-ce">
+                <!--<text a:if="{{item.source_type != 4}}" catchTap="openBh" data-item="{{item}}">驳回</text> -->
+                <text>审批</text>
+              </view>
+            </view>
+          </view>
+        </view>
+      </checkbox-group>
+      <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
+    </scroll-view>
+    
+    <view class="flex-box-ce footer">
+      <view class="flex-1" catchTap="selectAll">全选</view>
+      <view class="flex-1 red" catchTap="openBh" style="border-left:1px solid #f1f1f1;border-right:1px solid #f1f1f1;">批量驳回</view>
+      <view class="flex-1 blue" catchTap="openTg">批量通过</view>
+    </view>
+  </view>
+  
+  <select-staff defaultUser="{{[target_id]}}" isAllSelect="{{false}}" isShow="{{showStaff}}" a:if="{{showStaff==true}}" onClose="onClose" 
+    onConfirm="onConfirmStaff"></select-staff>
+  <!-- 弹出框 -->
+  <view class="windows" a:if="{{isBh}}">
+    <view class="windows-box">
+      <view class="windows-title">确认驳回</view>
+      <view class="windows-content">
+        <textarea value="{{textArea}}" onInput="bindTextAreaBlur" maxlength="50" placeholder="请输入审批意见" />
+      </view>
+      <view class="windows-btn flex-box flex-v-ce">
+        <view class="flex-1" catchTap="closeBh">取消</view>
+        <button type="default" loading="{{disabled}}" class="flex-1" disabled="{{disabled}}" catchTap="confirmBh">确定</button>
+      </view>
+    </view>
+  </view>
+  <!-- 结果弹窗 -->
+  <view class="windows" a:if="{{isResult}}">
+    <view class="windows-box" style="margin-top:15%">
+      <view class="windows-title">审批结果</view>
+      <block a:if="{{!isShowError}}">
+        <view class="windows-content" style="padding:20rpx;">
+          <progress percent="{{percentage}}" show-info stroke-width="10" />
+          <view class="resultsBox">
+            <view class="flex-box-ce results">
+              <view style="width:60rpx;padding:0;text-align:center"></view>
+              <view class="flex-1">奖扣对象</view>
+              <view class="flex-2">事件内容</view>
+              <view class="flex-1">积分</view>
+              <view class="flex-2">处理结果</view>
+            </view>
+            <view a:for="{{results}}" class="flex-box-ce results">
+              <view style="width:60rpx;padding:0;text-align:center">{{results.length-index}}</view>
+              <view class="flex-1">{{item.target}}</view>
+              <view class="flex-2" style="padding: 0.1rem 0.1rem;">{{item.remark.customize||item.remark.rule}}</view>
+              <view class="flex-1">
+                {{ item.point>0? '+'+item.point:item.point }}
+                <text>{{ item.pt_name }}</text>
+              </view>
+              <view class="green flex-2" a:if="{{item.status==1}}">{{item.msg}}</view>
+              <view class="red flex-2" a:else>{{item.msg}}</view>
+            </view>
+          </view>
+        </view>
+        <view class="windows-btn flex-box flex-v-ce" a:if="{{results.length==resultList.length}}">
+          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
+        </view>
+      </block>
+      <view a:else class="windows-content" style="padding:20rpx;">
+        <view style="text-align: center;margin-bottom:20rpx" class="red">服务器繁忙,请稍后再试</view>
+        <view class="windows-btn flex-box flex-v-ce">
+          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
+        </view>
+      </view>
+    </view>
+  </view>
+  
+</view>

+ 349 - 0
pages/workbench/approval_batch/approval_batch.js

@@ -0,0 +1,349 @@
+
+var app = getApp()
+var that;
+var socket = null;
+var setTime;
+Page({
+  data: {
+    date: app.globalData.month,
+    httpType: 'waiting',
+    keyword: '',
+    page: 1,
+    isBh: false,//是否显示驳回弹窗
+    textArea: "",
+
+    showStaff: false,//显示员工选择
+    staffVal: '奖扣对象',
+    target_id: '',
+
+    selectIds: [],//选择的人员
+    dataList: [],
+    isAll: true,
+
+    // 长连接结果
+    results: [], //提交的返回结果集合
+    isResult: false,
+    percentage: 0,
+    resultList: [],//要发送数据的集合
+    resultIndex: 0,
+    isShowError: false,
+  },
+  onLoad() {
+    that = this;
+    dd.setNavigationBar({ title: "批量审批" });
+  },
+  // 页面被关闭
+  onUnload() {
+
+  },
+  onShow() {
+    if (app.globalData.userData) {
+      that.refreshData();
+    } else {
+      app.login(app.globalData.corpId, function (is) {
+        if (is) {
+          that.refreshData();
+        } else {
+          dd.reLaunch({
+            url: '../noJurisdiction/noJurisdiction'
+          })
+        }
+      }, function () { })
+    }
+  },
+  closeTc() {
+    this.setData({
+      results: [], //提交的返回结果集合
+      isResult: false,
+      percentage: 0,
+      resultList: [],//要发送数据的集合
+      resultIndex: 0,
+      selectIds: [],
+      isBh: false,//是否显示驳回弹窗
+      isShowError: false,
+      textArea: '',
+      page: 1,
+    })
+    app.globalData.socketApi.closewebsocket();
+    this.getData();
+  },
+  // 驳回
+  openBh() {
+    if (this.data.selectIds.length == 0) {
+      app.globalData.showToast("请先选择审批单");
+      return false
+    }
+    this.setData({
+      isBh: true,
+    })
+  },
+  // 通过
+  openTg() {
+    let that = this;
+    if (this.data.selectIds.length == 0) {
+      app.globalData.showToast("请先选择审批单");
+      return false
+    }
+    dd.confirm({
+      title: '批量通过',
+      content: `已选中${this.data.selectIds.length}条审批单,确认全部通过?`,
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      success: (result) => {
+        if (result.confirm) {
+          that.webSocket(true);
+        }
+      },
+    });
+  },
+  webSocket(is) {
+    let arr = [];
+    let wsData;
+    this.data.selectIds.forEach(item => {
+      if (is) {
+        wsData = {
+          type: 'review',
+          action: 'complete',
+          review_id: item,
+        };
+      } else {
+        wsData = {
+          type: 'review',
+          action: 'refuse',
+          review_id: item,
+          remark: this.data.textArea,
+        };
+      }
+      arr.push(wsData);
+    });
+    this.setData({
+      resultList: arr,
+      resultIndex: 0,
+      percentage: 0,
+      results: [],
+      isResult: true,
+    })
+    this.opneWebSocket()
+  },
+  opneWebSocket() {
+    let wsData = this.data.resultList;
+    if (wsData[this.data.resultIndex]) {
+      setTime = setTimeout(() => {
+        dd.alert({
+            title: '温馨提示',
+            content: '网络异常,请检查网络',
+            buttonText: '我知道了',
+            success: (result) => {
+                clearTimeout(setTime);
+                app.globalData.socketApi.closewebsocket();
+                that.closeTc();
+             },
+        });
+      }, 15000)
+      app.globalData.socketApi.sendData(wsData[this.data.resultIndex], this.onmessageWS);
+    } else {
+      // console.log(this.data.results)
+    }
+  },
+  onmessageWS(e) {
+    // 因为作用域问题,这个函数不能使用this
+    if (e.type == 'review') {
+       clearTimeout(setTime);
+      let data = e.result;
+      let employee = that.returnResult(e.result.task.msg.review_id)[0]
+      data.target = employee.employee_name;
+      data.remark = employee.remark;
+      data.point = employee.point;
+      data.pt_name = employee.pt_name;
+      // console.log(employee)
+      // data.msg=e.msg
+      let results = that.data.results;//结果集
+      results.unshift(e.result);
+      let lng = that.data.resultList.length;// 进度条
+      that.setData({
+        percentage: Math.floor(that.data.percentage += (100 / lng)),
+        results: results,
+        resultIndex: that.data.resultIndex + 1
+      })
+      that.opneWebSocket();
+      if (lng == that.data.results.length) {
+        that.setData({
+          percentage: 100,
+        })
+      }
+    }
+    if (e.type == 'error') {
+       clearTimeout(setTime);
+      that.setData({
+        isShowError: true,
+      })
+    }
+  },
+  returnResult(id) {
+    return this.data.dataList.filter(item => {
+      return item.id == id;
+    })
+  },
+  confirmBh() {
+    if (that.data.textArea == '') {
+      app.globalData.showToast("请输入审批意见");
+      return;
+    }
+    this.setData({ isBh: false })
+    that.webSocket(false);
+  },
+
+  onChange(e) {
+    if (e) {
+      this.setData({
+        selectIds: e.detail.value
+      })
+    }
+  },
+  selectAll() {
+    let selectIds = [];
+    let dataList = this.data.dataList.map(item => {
+      item.checked = this.data.isAll;
+      selectIds.push(item.id);
+      return item;
+    })
+    this.setData({
+      dataList: dataList,
+      selectIds: this.data.isAll ? selectIds : [],
+      isAll: !this.data.isAll,
+    })
+  },
+  bindKeyInput(e) {
+    this.setData({
+      page: 1,
+      isVal: e.detail.value ? true : false,
+      keyword: e.detail.value ? e.detail.value : '',
+    })
+    this.getData();
+  },
+  //关闭弹窗
+  onClose() {
+    this.setData({
+      showStaff: false,
+    })
+  },
+  //选择员工
+  onConfirmStaff(data) {
+    if (!data) {
+      this.setData({ staffVal: '奖扣对象', target_id: '', page: 1 })
+      this.getData();
+      return false;
+    }
+    if (data.length > 0) {
+      this.setData({ staffVal: data[0].name, target_id: data[0].id, page: 1 })
+    } else {
+      this.setData({ staffVal: '奖扣对象', target_id: '', page: 1 })
+    }
+    this.getData();
+  },
+  //显示选择员工
+  selectStaff() {
+    this.setData({
+      showStaff: true
+    })
+  },
+  openDetail(e) {
+    var id = e.target.dataset.item.id;
+    dd.navigateTo({
+      url: '../approveDetail/approveDetail?id=' + id
+    })
+  },
+  showText() {
+    dd.alert({
+      title: '温馨提示',
+      content: '批量审批仅支持快速处理任务审批和已指定规则的积分审批,其余情况的审批单请到【待我审批】处理,权限分不足时,请进入【审批详情】→【通过】→【递交审批】给上级',
+      buttonText: '我知道了',
+      success: (result) => { },
+    });
+  },
+  //当在详情返回时刷新列表,但你请求接口
+  refreshData(id) {
+    if (this.data.page == 1) {
+      dd.hideLoading();
+      that.getData();
+    } else {
+      if (id) {//当page不为一并下一页返回上一页不执行onshow()
+        var arr = this.data.dataList;
+        arr.forEach((element, index) => {
+          if (element.id == id) {
+            arr.splice(index, 1);
+          }
+        });
+        this.setData({
+          dataList: arr
+        })
+      }
+    }
+  },
+  bindTextAreaBlur(e) {
+    this.setData({
+      textArea: e.detail.value
+    });
+  },
+  closeBh() {
+    this.setData({ isBh: false, textArea: '' })
+  },
+  onReset() {
+    this.setData({
+      keyword: '',
+      isVal: false,
+      page: 1,
+    })
+    this.getData();
+  },
+  getData(type) {
+    let data = {
+      source_type: '0',
+      batch: 1,
+      type: 'waiting',
+      page: that.data.page,
+      pt_id: 0,
+      page_size: 20,
+      keyword: that.data.keyword
+    }
+    if (that.data.target_id) {
+      data.target_id = that.data.target_id;
+    }
+    app.$get("api/integral/review/list", data).then((res) => {
+      var list = res.data.data.list || [];
+      list.forEach(element => {
+        if (element.pt_id) {
+          element.pt_name = app.getTypesItem(element.pt_id).name
+        }
+      });
+      if (that.data.page == 1) {
+        this.setData({
+          dataList: []
+        })
+      }
+      var data = list;
+      var dataList = that.data.dataList || [];
+      if (type == '2') {
+        if (data.length < 20) {
+          this.setData({
+            dataList: dataList.concat(data),
+            isData: true
+          })
+        } else {
+          this.setData({
+            dataList: dataList.concat(data),
+          })
+        }
+      } else {
+        this.setData({ dataList: data, isData: false })
+      }
+    })
+  },
+  //上啦加载
+  onScrollToLower() {
+    if (!that.data.isData) {
+      this.setData({ page: ++that.data.page })
+      this.getData("2");
+    }
+  },
+});

+ 8 - 0
pages/workbench/approval_batch/approval_batch.json

@@ -0,0 +1,8 @@
+{
+  "usingComponents": {
+    "select-staff": "/Component/selectStaff/selectStaff",
+    "img-box": "/Component/img-box/index",
+    "no-bata": "/Component/noData/noData"
+  },
+   "allowsBounceVertical": "NO"
+}

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

@@ -43,7 +43,7 @@
                 <input a:else value="{{item.point}}"  placeholder="0" type="number" onInput="bindKeyInput"  class="flex-1"/>
                 <view class="picker-box"  catchTap="bindPickerChange" a:if="{{item.selectRule.range_type!=1&&item.pid==0}}">
                   <view class="{{item.isArrindex==true ? 'picker-right':'picker-left'}} yuan"></view>
-                  <view class="flex-box flex-v-ce" class="picker">
+                  <view class="flex-box flex-v-ce" >
                     <text class="red flex-1">奖</text>
                     <text class="green flex-1">扣</text>
                   </view>
@@ -94,7 +94,7 @@
                 <input a:else value="{{item.point}}"  placeholder="0" type="number" onInput="bindKeyInput"  class="flex-1"/>
                 <view class="picker-box"  catchTap="bindPickerChange" a:if="{{item.selectRule.range_type!=1}}">
                   <view class="{{item.isArrindex==true ? 'picker-right':'picker-left'}} yuan"></view>
-                  <view class="flex-box flex-v-ce" class="picker">
+                  <view class="flex-box flex-v-ce">
                     <text class="red flex-1">奖</text>
                     <text class="green flex-1">扣</text>
                   </view>
@@ -155,7 +155,7 @@
                 <input a:else value="{{item.point}}"  placeholder="0" type="number" onInput="bindKeyInput" class="flex-1"/>
                 <view class="picker-box" catchTap="bindPickerChange" a:if="{{item.selectRule.range_type!=1}}">
                   <view class="{{item.isArrindex==true ? 'picker-right':'picker-left'}} yuan"></view>
-                  <view class="flex-box flex-v-ce" class="picker">
+                  <view class="flex-box flex-v-ce" >
                     <text class="red flex-1">奖</text>
                     <text class="green flex-1">扣</text>
                   </view>
@@ -177,7 +177,7 @@
                 <input value="{{item.point2}}"  placeholder="0" type="number" onInput="bindKeyInput2" class="flex-1"/>
                 <view class="picker-box"  catchTap="bindPickerChange2">
                   <view class="{{item.isArrindex2==true? 'picker-right':'picker-left'}} yuan"></view>
-                  <view class="flex-box flex-v-ce" class="picker">
+                  <view class="flex-box flex-v-ce" >
                     <text class="red flex-1">奖</text>
                     <text class="green flex-1">扣</text>
                   </view>

+ 12 - 11
pages/workbench/approve/approve.js

@@ -94,17 +94,18 @@ Page({
         this.showToast("积分不能为0或空")
         return;
       }
-      if (item.selectRule.range_type == 1 && item.selectRule.min_point == item.selectRule.max_point) {
-        if (point < item.selectRule.min_point || point > item.selectRule.max_point) {
-          this.showToast(`系统发现此条积分规则制度有变动,请驳回后让员工按最新的规则重新申请`);
-          return;
-        }
-      } else {
-        if (point < item.selectRule.min_point || point > item.selectRule.max_point) {
-          this.showToast(`积分超出可输入范围`);
-          return;
-        }
-      }
+      // if (item.selectRule.range_type == 1 && item.selectRule.min_point == item.selectRule.max_point) {
+      //   if (point < item.selectRule.min_point || point > item.selectRule.max_point) {
+      //     this.showToast(`系统发现此条积分规则制度有变动,请驳回后让员工按最新的规则重新申请`);
+      //     return;
+      //   }
+      // } 
+      // else {
+      //   if (point < item.selectRule.min_point || point > item.selectRule.max_point) {
+      //     this.showToast(`积分超出可输入范围`);
+      //     return;
+      //   }
+      // }
 
 
     } else {

+ 14 - 0
pages/workbench/approveDetail/approveDetail.axml

@@ -22,6 +22,20 @@
       <view>{{dataDetail.status_mark}}</view>
     </view>
     <view class="header-main">
+        <view class="flex-box flex-v-ce">
+          <view class="laber">积分</view>
+          <view class="flex-1">
+            <text a:if="{{dataDetail.item_range_type==1}}">
+              <text a:if="{{dataDetail.item_prize_type == 1}}">+</text> 
+               {{ dataDetail.item_min_point }}
+            </text>
+            <text a:if="{{dataDetail.item_range_type==2}}">
+              <text a:if="{{dataDetail.item_prize_type == 1}}">+</text> 
+               {{ dataDetail.item_min_point }} ~ {{ dataDetail.item_max_point }}
+            </text>
+            <text style="margin-left:10rpx;">{{dataDetail.typeName}}</text>
+          </view>
+        </view>
       <view class="flex-box" a:for="{{dataDetail.detail}}">
         <block a:if="{{item.type=='text'&&item.value}}">
           <view class="laber">{{item.key}}</view>

+ 9 - 4
pages/workbench/approveDetail/approveDetail.js

@@ -32,7 +32,7 @@ Page({
       app.login(corpId, function (is) {
         if (is) {
           dd.hideLoading();
-          that.setData({userData: app.globalData.userData });
+          that.setData({ userData: app.globalData.userData });
           that.getData();
         } else {
           dd.reLaunch({
@@ -42,9 +42,9 @@ Page({
       }, function () { })
     }
   },
-  openDetail(){
+  openDetail() {
     dd.navigateTo({
-      url: '../../statistics/workDetail/workDetail?id=' + that.data.dataDetail.source_id+'&isNot=true'
+      url: '../../statistics/workDetail/workDetail?id=' + that.data.dataDetail.source_id + '&isNot=true'
     })
   },
   showImg(e) {
@@ -56,6 +56,11 @@ Page({
     });
   },
   submit() {
+    // 暂时无法解决这个中途删除积分规则的问题
+    // if (that.data.dataDetail.item_max_point == -1 && that.data.dataDetail.item_min_point == -1&&that.data.dataDetail.item.item_id) {
+    //   app.globalData.showToast("系统发现此条积分规则制度有变动, 请驳回后让员工按最新的规则重新申请");
+    //   return;
+    // }
     dd.navigateTo({
       url: '../approve/approve?id=' + that.data.dataDetail.id
     })
@@ -113,7 +118,7 @@ Page({
                 active.filtrationList(2, item.review_id);
               }
               setTimeout(() => {
-                dd.navigateBack({delta: 1})
+                dd.navigateBack({ delta: 1 })
               }, 1000);
             } else {
               setTimeout(() => {

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

@@ -30,6 +30,11 @@
       </view>
     </view>
   </view>
+  <view class="flex-box-ce margin-bottom"  style="background:#fff;padding:24rpx 32rpx" a:if="{{noticeTitle}}" onTap="openUrl2">
+    <image mode="scaleToFill" src="../../../image/lb.png" style="width:30rpx;height:30rpx;position:relative;top:-2px"></image>
+    <view style="padding:0 20rpx;" class="flex-1 font-flex-word">{{noticeTitle}}</view>
+    <image mode="scaleToFill" src="../../../image/right.png" class="img-right"></image>
+  </view>
   <view class="main margin-bottom">
     <view class="main-title flex-box flex-v-ce" onTap="openView" data-index="10">
       <text class="flex-1" style="font-size:32rpx">排行榜</text>

+ 22 - 1
pages/workbench/index/index.js

@@ -22,6 +22,7 @@ Page({
     total: '',
     menuList: [
       { name: '审批', imgUrl: '../../../image/sp.png', url: '../my_approve/my_approve', code: 'creator admin' },
+      // { name: '批量审批', imgUrl: '../../../image/sp.png', url: '../approval_batch/approval_batch', code: 'creator admin' },
       { name: '任务', imgUrl: '../../../image/a7.png', url: '../../statistics/my_task/my_task', code: 'admin employee' },
       { name: '奖扣B分', imgUrl: '../../../image/point_entry.png', url: '../jk_B/jk_B?type=B', code: 'creator admin' },
       { name: '指派任务', imgUrl: '../../../image/my_publish.png', url: '../../statistics/assaign/assaign', code: 'creator admin' },
@@ -30,6 +31,7 @@ Page({
       { name: '领任务', imgUrl: '../../../image/task_hall.png', url: '../../statistics/getTask/getTask', code: 'admin employee' },
       { name: '发布悬赏', imgUrl: '../../../image/caback6.png', url: '../../statistics/offerAreward/offerAreward', code: 'creator admin' },
       { name: '发放奖票', imgUrl: '../../../image/add_ticket.png', url: '../../statistics/grant/grant', code: 'creator admin' },
+      // { name: '福利兑换', imgUrl: '../../../image/fl.png', url: '../../exchange/exchange/exchange', code: 'creator admin employee' },
       { name: '全部', imgUrl: '../../../image/all2.png', url: 'all', code: 'creator admin employee' },
     ],
     isUpdate: false,
@@ -38,6 +40,8 @@ Page({
 
     isSubject: false,//判断是否是个人版进入
     mainCorpId: '',//如果是个人版,这个企业ID是登录者所在的企业ID,不是钉钉那边提供的隐藏企业ID
+
+    noticeTitle:'',
   },
   onLoad() {
     that = this;
@@ -47,6 +51,7 @@ Page({
     if (app.globalData.userData) {
       that.getUserData();
       that.getGg();
+      that.getNotice();
       that.setData({
         isAdministrator: app.globalData.isAdministrator,
         getRole_four: app.globalData.isCreator,
@@ -70,8 +75,9 @@ Page({
           } else if (!app.globalData.isCreator && !app.globalData.isAdministrator) {
             that.setMenuList("employee");
           }
-          that.getGg();
           that.getUserData();
+          that.getGg();
+          that.getNotice();
           that.setData({
             isAdministrator: app.globalData.isAdministrator,
             getRole_four: app.globalData.isCreator,
@@ -105,6 +111,11 @@ Page({
       url: url
     })
   },
+  openUrl2() {
+    dd.navigateTo({
+      url: '../noticeDetail/noticeDetail?id=' + that.data.noticeId
+    })
+  },
   openText() {
     that.colseText();
     dd.navigateTo({
@@ -125,6 +136,16 @@ Page({
     });
   },
   // 获取公告
+  getNotice() {
+    app.$get("api/information/index", { page: 1, page_size: 1 }).then((res) => {
+      let data= res.data.data;
+      that.setData({
+        noticeTitle: data[0]? data[0].name:'',
+        noticeId: data[0]? data[0].id:'',
+      });
+    })
+  },
+  // 获取公告
   getGg() {
     if (that.data.title) {
       return

+ 46 - 0
pages/workbench/jk_B/jk_B.acss

@@ -143,4 +143,50 @@ textarea::before{
 .userList{
   height: 40rpx;
   font-size: 32rpx;
+}
+.windows-box{
+  background: #fff;
+  margin: 0 32rpx;
+  margin-top: 30%;
+  border-radius: 20rpx; 
+}
+.windows-title{
+  text-align: center;
+  padding: 28rpx 0;
+  border-bottom: 1px solid #f1f1f1;
+}
+.windows-btn{
+   border-top: 1px solid #f1f1f1;
+}
+.windows-btn view:nth-child(1){
+  text-align: center;
+  padding: 28rpx 0;
+  border-right: 1px solid #f1f1f1;
+}
+.windows-btn button{
+  text-align: center;
+  color: #26A2FF;
+  background: #fff;
+  border: none;
+}
+.windows-content textarea{
+  height: 150rpx;
+  padding: 28rpx;
+}
+.results{
+  text-align: center;
+  font-size: 24rpx;
+  position: relative;
+}	
+.results view{
+  padding:10rpx 0rpx;
+}
+.resultsBox{
+  margin-top:20rpx;
+  border:1px solid #f1f1f1;
+  max-height:600rpx;
+  overflow-y:auto
+}
+.results:nth-child(odd){
+  background-color: #f1f1f1;
 }

+ 111 - 25
pages/workbench/jk_B/jk_B.axml

@@ -1,13 +1,13 @@
 <view>
   <view class="{{popupCx}}">
-    <view class="flex-box flex-v-ce form-top" catchTap="openSelect"  data-num="3">
+    <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 userList">
-          <block a:for="{{users}}">
-              <text style="font-size:32rpx">{{item.name}},</text>
-          </block>
+        <block a:for="{{users}}">
+          <text style="font-size:32rpx">{{item.name}},</text>
+        </block>
       </view>
-      <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      <image mode="scaleToFill" src="../../../image/right.png" class="rightImg" />
     </view>
     <view a:for="{{items}}" a:for-index="index" key="{{index}}">
       <view class="flex-box flex-v-ce" style="padding-right:28rpx;">
@@ -20,30 +20,33 @@
           <view class="flex-1"></view>
           <switch onChange="switchChange" disabled="{{ruleOnoff}}" checked="{{item.checked}}" data-index="{{index}}" color="#26A2FF"></switch>
         </view>
-
-        <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="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"/>
+          <image mode="scaleToFill" src="../../../image/right.png" class="rightImg" />
         </view>
         <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"/>
+          <image mode="scaleToFill" src="../../../image/right.png" class="rightImg" />
         </view>
-
+        
         <view class="flex-box li" style="padding:15rpx 28rpx;" a:if="{{item.checked}}">
           <view class="label isBt" style="position: relative;top:8rpx;">积分</view>
           <text class="red" style="position: relative;top:8rpx;" a:if="{{item.isArrindex==true}}">+</text>
           <text class="green" a:else style="position: relative;top:8rpx;">-</text>
           <view class="flex-1">
             <view class="flex-box flex-v-ce">
-              <view a:if="{{item.selectRule.range_type==1&&item.selectRule.min_point==item.selectRule.max_point}}" style="padding-left:10rpx; height:60rpx;line-height:60rpx;" class="flex-1">{{item.point}}</view>
-              <input a:else value="{{item.point}}" name="{{index}}" placeholder="0" type="number" onInput="bindKeyInput" data-index="{{index}}" class="flex-1"/>
+              <view a:if="{{item.selectRule.range_type==1&&item.selectRule.min_point==item.selectRule.max_point}}" style="padding-left:10rpx; height:60rpx;line-height:60rpx;" 
+                class="flex-1">{{item.point}}</view>
+              <input a:else value="{{item.point}}" name="{{index}}" placeholder="0" type="number" onInput="bindKeyInput" 
+                data-index="{{index}}" class="flex-1" />
               <view class="picker-box" data-index="{{index}}" catchTap="bindPickerChange" a:if="{{item.selectRule.range_type!=1}}">
                 <view class="{{item.isArrindex==true? 'picker-right':'picker-left'}} yuan"></view>
-                <view class="flex-box flex-v-ce" class="picker">
+                <view class="flex-box flex-v-ce">
                   <text class="red flex-1">奖</text>
                   <text class="green flex-1">扣</text>
                 </view>
@@ -63,7 +66,8 @@
           <text class="green" a:else style="position: relative;top:8rpx;">-</text>
           <view class="flex-1">
             <view class="flex-box flex-v-ce">
-              <input value="{{item.point2}}" name="{{index}}" placeholder="0" type="number" onInput="bindKeyInput2" data-index="{{index}}" class="flex-1"/>
+              <input value="{{item.point2}}" name="{{index}}" placeholder="0" type="number" onInput="bindKeyInput2" data-index="{{index}}" 
+                class="flex-1" />
               <view class="picker-box" data-index="{{index}}" catchTap="bindPickerChange2">
                 <view class="{{item.isArrindex2==true? 'picker-right':'picker-left'}} yuan"></view>
                 <view class="flex-box flex-v-ce">
@@ -74,38 +78,120 @@
             </view>
           </view>
         </view>
-
+        
         <view class="flex-box flex-v-ce li" catchTap="openDate" data-index="{{index}}">
           <view class="label isBt">发生时间</view>
           <view class="flex-1">{{item.event_time}}</view>
-          <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+          <image mode="scaleToFill" src="../../../image/right.png" class="rightImg" />
         </view>
-        <view class="flex-box flex-v-ce li" data-index="{{index}}"  data-num="4" a:if="{{!isCreator}}"  data-item="{{{id:item.reviewer_id,name:item.revieweName}}}"  catchTap="openSelect">
+        <view class="flex-box flex-v-ce li" data-index="{{index}}" data-num="4" a:if="{{!isCreator}}" data-item="{{{id:item.reviewer_id,name:item.revieweName}}}" 
+          catchTap="openSelect">
           <view class="label">递交审批</view>
           <view class="flex-1">{{item.revieweName}}</view>
-          <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+          <image mode="scaleToFill" src="../../../image/right.png" class="rightImg" />
         </view>
         <view class="li">
           <textarea maxlength="100" value="{{item.remark}}" onInput="bindTextAreaBlur" placeholder="请输入事件内容" data-index="{{index}}"></textarea>
-          <image mode="scaleToFill" src="../../../image/addImg.png" data-index="{{index}}" class="addImg" catchTap="openImg"/>
+          <image mode="scaleToFill" src="../../../image/addImg.png" data-index="{{index}}" class="addImg" catchTap="openImg" />
         </view>
         <view style="background:#fff;padding:0 28rpx;" a:if="{{item.files[0]}}" class="flex-box flex-v-ce">
           <view a:for="{{item.files}}" key="index" a:for-item="imgs" a:for-index="imgIndex" style="position:relative">
             <text class="detele" data-itemIndx="{{index}}" data-index="{{imgIndex}}" catchTap="deteleImg">×</text>
-            <image mode="scaleToFill" class="showImg" src="{{imgs}}"  data-index="{{imgIndex}}" data-item="{{item.files}}" catchTap="showImg"/>
+            <image mode="scaleToFill" class="showImg" src="{{imgs}}" data-index="{{imgIndex}}" data-item="{{item.files}}" 
+              catchTap="showImg" />
           </view>
         </view>
       </view>
     </view>
     <view class="add" catchTap="addArr">+  再加一条</view>
     <view class="btn-area" style="margin-top:28rpx;">
-        <button type="default" loading="{{disabled}}" class="defBtn" disabled="{{disabled}}" catchTap="formSubmit">提交</button>
+      <button type="default" loading="{{disabled}}" class="defBtn" disabled="{{disabled}}" catchTap="formSubmit">提交</button>
     </view>
   </view>
   <view class="box" animation="{{animationInfo}}">
-    <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}}" isBoss="{{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'}}"/>
+    <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}}" isBoss="{{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>
+  
+  <!-- 结果弹窗 -->
+  <view class="windows" a:if="{{isResult}}">
+    <view class="windows-box" style="margin-top:15%">
+      <view class="windows-title">处理结果</view>
+      <block a:if="{{!isShowError}}">
+        <view class="windows-content" style="padding:20rpx;">
+          <progress percent="{{percentage}}" show-info stroke-width="10" />
+          <view class="resultsBox">
+            <view class="flex-box-ce results">
+              <view style="width:60rpx;padding:0;text-align:center"></view>
+              <view class="flex-1">奖扣对象</view>
+              <view class="flex-2">事件内容</view>
+              <view class="flex-1">积分</view>
+              <view class="flex-2">处理结果</view>
+            </view>
+            <view a:for="{{results}}" class="flex-box-ce results">
+              <view style="width:60rpx;padding:0;text-align:center">{{results.length-index}}</view>
+              <view class="flex-1">{{item.target}}</view>
+              <view class="flex-2" style="padding: 0.1rem 0.1rem;">{{item.task.msg.remark}}</view>
+              <view class="flex-1">
+                {{ item.point>0? '+'+item.point:item.point }}
+                <text>{{ item.task.msg.pt_id==3? 'B分':'A分' }}</text>
+              </view>
+              <view class="green flex-2" a:if="{{item.status==1}}">
+                <text a:if="{{item.msg=='奖扣成功'}}" class="green">{{ item.msg }}</text>
+                <text a:else class="blue">{{ item.msg }}</text>
+              </view>
+              <view class="red flex-2" a:else>{{item.msg}}</view>
+            </view>
+          </view>
+        </view>
+        <view class="windows-btn flex-box flex-v-ce" a:if="{{results.length==resultList.length}}">
+          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
+        </view>
+      </block>
+      <view a:else class="windows-content" style="padding:20rpx;">
+        <view style="text-align: center;margin-bottom:20rpx" class="red">服务器繁忙,请稍后再试</view>
+        <view class="windows-btn flex-box flex-v-ce">
+          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
+        </view>
+      </view>
+    </view>
+  </view>
+  <!-- 错误弹窗 -->
+  <view class="windows" a:if="{{isErrorShow}}">
+    <view class="windows-box" style="margin-top:15%">
+      <view class="windows-title red">网络连接中断,请检查网络再次提交</view>
+      <view class="windows-content" style="padding:20rpx;">
+        <view class="resultsBox">
+          <view class="flex-box-ce results">
+            <view style="width:60rpx;padding:0;text-align:center"></view>
+            <view class="flex-1">奖扣对象</view>
+            <view class="flex-1">分类</view>
+            <view class="flex-1">规则</view>
+            <view class="flex-2">事件内容</view>
+            <view class="flex-1">积分</view>
+          </view>
+          <view a:for="{{errorList}}" class="flex-box-ce results">
+            <view style="width:60rpx;padding:0;text-align:center">{{index+1}}</view>
+            <view class="flex-1">{{item.name}}</view>
+            <view class="flex-1">{{ item.rule_name||'--' }}</view>
+            <view class="flex-1">{{ item.item_name||'--' }}</view>
+            <view class="flex-2">{{item.remark}}</view>
+            <view class="flex-1">
+              {{ item.point>0? '+'+item.point:item.point }}
+              <text>{{ item.task.msg.pt_id==3? 'B分':'A分' }}</text>
+            </view>
+          </view>
+        </view>
+      </view>
+      <view class="windows-btn flex-box flex-v-ce">
+        <button type="default" class="flex-1" catchTap="closeTc">取消</button>
+        <button type="default" class="flex-1" catchTap="resubmit">再次提交</button>
+      </view>
+    </view>
   </view>
+  
 </view>

+ 159 - 45
pages/workbench/jk_B/jk_B.js

@@ -1,6 +1,7 @@
 var app = getApp()
 var that;
 var animation;
+var setTime;
 Page({
   data: {
     users: [],
@@ -16,10 +17,20 @@ Page({
     type: 'B',
     isGzType: 'BF',
     defaultRuleId: '',
-    isCreator:false,//是否创始人
+    isCreator: false,//是否创始人
     popupCx: '',
-    boxTop:0,
-    ruleOnoff:false,
+    boxTop: 0,
+    ruleOnoff: false,
+
+    // 长连接结果
+    results: [], //提交的返回结果集合
+    isResult: false,
+    percentage: 0,
+    resultList: [],//要发送数据的集合
+    resultIndex: 0,
+    isShowError: false,
+    errorList: [],
+    isErrorShow: false,
   },
   onLoad(data) {
     that = this;
@@ -27,7 +38,7 @@ Page({
     this.setData({
       type: data.type,
       isGzType: data.type == "B" ? "BF" : "AF",
-      isCreator:app.globalData.isCreator,
+      isCreator: app.globalData.isCreator,
       items: [{//录入选项列表
         checked: true,//判断是否开启指定规则
         rule_id: '',//积分分类id
@@ -56,12 +67,12 @@ Page({
       dd.setNavigationBar({ title: "奖扣A分" });
     }
   },
-  onPageScroll(e){
-      if(e.scrollTop!=0){
-        this.setData({
-          boxTop:e.scrollTop
-        })
-      }
+  onPageScroll(e) {
+    if (e.scrollTop != 0) {
+      this.setData({
+        boxTop: e.scrollTop
+      })
+    }
   },
   onShow() {
     animation = dd.createAnimation({
@@ -69,6 +80,10 @@ Page({
       timeFunction: "linear",
     });
   },
+  // 页面被关闭
+  onUnload() {
+    app.globalData.socketApi.closewebsocket();
+  },
   //显示图片
   showImg(e) {
     var index = e.target.dataset.index;
@@ -81,17 +96,17 @@ Page({
   //获取系统配置
   cheakAx() {
     app.$get("/api/integral/site/config").then((res) => {
-        let data = res.data.data;
-        if(data.specified_rule_item){
-          this.setData({
-            ruleOnoff: data.specified_rule_item == 1 ? true : false
-          })
-        }else{
-          this.setData({
-            ruleOnoff: false
-          })
-        }
-      })
+      let data = res.data.data;
+      if (data.specified_rule_item) {
+        this.setData({
+          ruleOnoff: data.specified_rule_item == 1 ? true : false
+        })
+      } else {
+        this.setData({
+          ruleOnoff: false
+        })
+      }
+    })
   },
   //选择奖还是扣(细则)
   bindPickerChange(e) {
@@ -119,11 +134,11 @@ Page({
       animationInfo: animation.export(),
       popupCx: '',
     });
-    setTimeout(()=>{
+    setTimeout(() => {
       dd.pageScrollTo({
         scrollTop: that.data.boxTop
       })
-    },100)
+    }, 100)
   },
   //选择弹窗
   openSelect(e) {
@@ -239,6 +254,7 @@ Page({
 
     })
   },
+
   random_string(len) {
     len = len || 32
     var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
@@ -316,12 +332,11 @@ Page({
     that.setData({
       items: list
     })
-    console.log(that.data.items);
   },
   //添加一条
   addArr() {
     var list = that.data.items
-    if(list.length>=10){
+    if (list.length >= 10) {
       this.showToast('一次只能添加10条奖扣')
       return;
     }
@@ -351,7 +366,22 @@ Page({
   showToast(text) {
     app.globalData.showToast(text);
   },
+  resubmit(){
+    this.setData({
+      resultList: this.data.errorList,
+      resultIndex: 0,
+      percentage: 0,
+      results: [],
+      isResult: true,
+      isErrorShow: false,
+      popupCx: 'container__mask',
+    })
+    this.opneWebSocket()
+  },
   formSubmit() {
+    // app.globalData.socketApi.sendData({type:'review'},(res)=>{
+    //   console.log(res)
+    // })
     var items = this.data.items;
     var userData = this.data.users;
     var arr = [];
@@ -409,6 +439,8 @@ Page({
       }
       obj.rule_id = item.checked ? item.rule_id : item.rule_id2;
       obj.item_id = item.checked ? item.item_id : 0;
+      obj.item_name = item.item_name;
+      obj.rule_name = item.rule_name;
       obj.point = point;
       obj.remark = item.remark;
       obj.event_time = item.event_time;
@@ -422,15 +454,14 @@ Page({
       userIds.push(item.id)
     })
     if (isTg) {
-      var data = {
-        members: JSON.stringify(userIds),
-        items: JSON.stringify(arr)
-      }
+      var data = { members: userIds, items: arr }
+      // 走长连接
+      this.webSocket(data)
+      return false;
       this.setData({ disabled: true });
       var url = this.data.type == 'B' ? 'api/integral/point/entry' : 'api/integral/review/a/entry'
       app.$post(url, data).then((res) => {
         var is = true, msg;
-
         if (this.data.type == 'B') {
           res.data.data.list.forEach(item => {
             if (item.status != 1) {
@@ -462,6 +493,98 @@ Page({
       })
     }
   },
+  webSocket(data) {
+    let { members, items } = data;
+    let arr = [];
+    members.forEach(item => {
+      items.forEach(item2 => {
+        item2.type = this.data.type == 'B' ? 'peb' : 'pea';
+        item2.employee_id = item;
+        arr.push(JSON.parse(JSON.stringify(item2)))
+      })
+    })
+    this.setData({
+      resultList: arr,
+      resultIndex: 0,
+      percentage: 0,
+      results: [],
+      isResult: true,
+      popupCx: 'container__mask',
+    })
+    this.opneWebSocket()
+  },
+  opneWebSocket() {
+    let wsData = this.data.resultList;
+    if (wsData[this.data.resultIndex]) {
+      setTime = setTimeout(() => {
+        let errorList = wsData.slice(this.data.resultIndex, wsData.length);
+        errorList.forEach(item => {
+          let obj = this.returnResult(Number(item.employee_id))[0]
+          item.name = obj ? obj.name:'未知';
+        })
+       
+        this.setData({
+          isErrorShow: true,
+          errorList: errorList
+        })
+        clearTimeout(setTime);
+        app.globalData.socketApi.closewebsocket();
+      }, 15000)
+      app.globalData.socketApi.sendData(wsData[this.data.resultIndex], this.onmessageWS);
+    } else {
+      // console.log(this.data.results)
+    }
+  },
+  onmessageWS(e) {
+    // 因为作用域问题,这个函数不能使用this
+    if (e.type == 'peb' || e.type == 'pea') {
+      clearTimeout(setTime);
+      let lng = that.data.resultList.length;// 进度条
+
+      let results = that.data.results;//结果集
+      results.unshift(e.result);
+
+      that.setData({
+        percentage: Math.floor(that.data.percentage += (100 / lng)),
+        results: results,
+        resultIndex: that.data.resultIndex + 1
+      })
+      that.opneWebSocket();
+      if (lng == that.data.results.length) {
+        that.setData({
+          percentage: 100,
+        })
+      }
+    }
+    if (e.type == 'error') {
+      clearTimeout(setTime);
+      that.setData({
+        isShowError: true,
+      })
+    }
+  },
+  closeTc() {
+    this.setData({
+      resultList: [],
+      resultIndex: 0,
+      percentage: 0,
+      results: [],
+      errorList:[],
+      isErrorShow:false,
+      isShowError: false,
+      isResult: false,
+      popupCx: '',
+    })
+    setTimeout(() => {
+      dd.navigateBack({ delta: 1 })
+    }, 1000);
+  },
+  returnResult(id) {
+    return app.globalData.usersList.filter(item => {
+      return item.id == id;
+    })
+  },
+
   switchChange(e) {
     var index = e.target.dataset.index;
     var item = `items[${index}].checked`;
@@ -497,22 +620,11 @@ Page({
       }
     })
     this.setData({ superior_list: [] });
-    var userIdArr = [];
     if (item.length > 0) {
-      // item.forEach(el => {
-      //   userIdArr.push(el.id)
-      // })
-      // var employee_ids = userIdArr.join(',');
-      // this.getEmployeeList(employee_ids, function (res) {//获取共同上级
-      //   var arr = []
-      //   res.forEach(el => {
-      //     arr.push(el.id)
-      //   })
-        that.setData({
-          users: item.length > 0 ? item : [],
-          superior_list: app.globalData.userData.employee_detail.superior_list
-        })
-      // });
+      that.setData({
+        users: item.length > 0 ? item : [],
+        superior_list: app.globalData.userData.employee_detail.superior_list
+      })
     }
 
   },
@@ -547,6 +659,7 @@ Page({
     var remark = `items[${index}].remark`
     var rule_id = `items[${index}].rule_id`;//分类ID
     var item_id = `items[${index}].item_id`;//分类ID
+    var item_name = `items[${index}].item_name`;//分类ID
     var strMin;
     if (item.min_point < 0) {
       var min = item.min_point.toString();
@@ -559,6 +672,7 @@ Page({
       [isArrindex]: item.min_point > 0 ? true : false,
       [selectRule]: item,
       [remark]: item.remark,
+      [item_name]: item.remark,
       [rule_id]: item.rule_id,
       [item_id]: item.id,
     });

+ 2 - 2
pages/workbench/my_approve/my_approve.acss

@@ -1,7 +1,7 @@
 .search {
   background-color: #f1f1f1;
   border-radius: 10rpx;
-  width: 90%;
+  width: 70%;
   margin: 0 auto;
   padding: 6rpx 10rpx;
 }
@@ -101,7 +101,7 @@
 }
 
 .scroll {
-  height:  calc(100vh - 216rpx);
+  height:  calc(100vh - 200rpx);
 }
 
 .windows-box{

+ 3 - 2
pages/workbench/my_approve/my_approve.axml

@@ -1,11 +1,12 @@
 <view>
   <view class="header margin-bottom">
-    <form onReset="onReset">
+    <form onReset="onReset" class="flex-box-ce">
       <view class="search flex-box flex-v-ce">
         <image mode="scaleToFill" src="../../../image/ss.png"/>
         <input placeholder="请输入姓名" onInput="bindKeyInput" onConfirm="bindKeyInput" class="flex-1"/>
         <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
       </view>
+      <button size="mini" type="primary" catchTap="openPl">批量审批</button>
     </form>
     <view class="flex-box flex-v-ce selectItems border-bottom">
       <view data-index="1" class="{{activeIndex == 1? 'active':''}} flex-1" catchTap="activeItem">待我审批</view>
@@ -13,7 +14,7 @@
       <view class="selectImg">
         <picker class="picker" onChange="bindObjPickerChange" value="{{arrIndex}}" range="{{objectArray}}" range-key="name">
           <view style="padding:20rpx 30rpx;">
-              <image mode="scaleToFill" src="../../../image/sx.png"/></view>
+              <image mode="scaleToFill" src="../../../image/sx.png"/>
           </view>
         </picker>
       </view>

+ 5 - 8
pages/workbench/my_approve/my_approve.js

@@ -31,13 +31,6 @@ Page({
     ],
     arrIndex: 0,
   },
-  onShareAppMessage() {
-    return {
-      title: '我的审批功能分享',
-      desc: '我的审批功能分享。',
-      path: 'pages/workbench/my_approve/my_approve'
-    };
-  },
   onLoad() {
     that = this;
     dd.setNavigationBar({ title: "我的审批" });
@@ -57,6 +50,11 @@ Page({
       },function(){})
     }
   },
+  openPl(){
+    dd.navigateTo({
+      url: '../approval_batch/approval_batch'
+    })
+  },
   bindObjPickerChange(e) {
     this.setData({
       arrIndex: e.detail.value,
@@ -133,7 +131,6 @@ Page({
   },
   //选择规则分类
   bindKeyInput(e) {
-    console.log(e)
     this.setData({
       keyword: e.detail.value,
       page: 1,

+ 7 - 0
pages/workbench/noticeDetail/noticeDetail.acss

@@ -0,0 +1,7 @@
+
+@import "../../../Component/aParse/aParse.acss";
+
+.title{
+ padding: 28rpx;
+ padding-bottom: 0;
+}

+ 13 - 0
pages/workbench/noticeDetail/noticeDetail.axml

@@ -0,0 +1,13 @@
+<import src="../../../Component/aParse/aParse.axml"/>
+<view>
+  <view class="title">
+    <view style="margin-bottom:10rpx;font-size:36rpx;font-weight:600">{{obj.name}}</view>
+    <view style="font-size:24rpx;color:#999">{{obj.create_time}} {{obj.employee_name}}发布</view>
+  </view>
+  <view style="padding:28rpx;">
+      <template is="aParse" data="{{aParseData:article.nodes}}"/>
+  </view>
+  <view a:if="{{obj.file_list}}"> 
+     <image mode="widthFix" src="{{obj.file_list}}" style="width:auto" />
+  </view>
+</view>

+ 63 - 0
pages/workbench/noticeDetail/noticeDetail.js

@@ -0,0 +1,63 @@
+var app = getApp();
+var that;
+var AParse = require('../../../Component/aParse/aParse.js');
+Page({
+  data: {
+    obj: {},
+    id: '',
+  },
+  onShareAppMessage() {
+    return {
+      title: '公告',
+      desc:'公告:'+ this.data.obj.name ? this.data.obj.name : '公告内容',
+      path: 'pages/workbench/noticeDetail/noticeDetail?id=' + this.data.id
+    };
+  },
+  onLoad(e) {
+    that = this;
+    dd.setNavigationBar({ title: "公告内容" });
+    if (e.id) {
+      // this.getList(e.id);
+      this.setData({
+        id: e.id
+      })
+    }
+  },
+  onShow() {
+    if (app.globalData.userData) {
+      dd.hideLoading();
+      that.getList(that.data.id);
+    } else {
+      app.login(app.globalData.corpId, function (is) {
+        if (is) {
+          dd.hideLoading();
+          that.getList(that.data.id);
+        } else {
+          dd.reLaunch({
+            url: '../noJurisdiction/noJurisdiction'
+          })
+        }
+      }, function () { })
+    }
+
+  },
+  getList(id) {
+    /**
+ * 使用说明:
+* AParse.AParse(bindName , type, data, target,imagePadding)
+* 1.bindName绑定的数据名(必填)
+* 2.type可以为html或者md(必填)
+* 3.data为传入的具体数据(必填)
+* 4.target为Page对象,一般为this(必填)
+* 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选)
+*/
+    app.$get("api/information/info", { id: id }).then((res) => {
+      AParse.aParse('article', 'html',
+        `${res.data.data.content.html}`
+        , that, 5);
+      this.setData({
+        obj: res.data.data
+      })
+    })
+  },
+});

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

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

+ 38 - 28
utils/util.js

@@ -7,47 +7,57 @@ const formatTime = (date) => {
   const minute = date.getMinutes()
   const second = date.getSeconds()
   return {
-    year:year,
-    month:[year, month].map(formatNumber).join('-'),
-    day:[year, month, day].map(formatNumber).join('-'),
-    month_tow:month,
-    allDate:[year, month, day].map(formatNumber).join('-')+" "+hour+":"+minute
+    year: year,
+    month: [year, month].map(formatNumber).join('-'),
+    day: [year, month, day].map(formatNumber).join('-'),
+    month_tow: month,
+    allDate: [year, month, day].map(formatNumber).join('-') + " " + hour + ":" + minute
   }
 }
-
 const formatNumber = n => {
   n = n.toString()
   return n[1] ? n : '0' + n
 }
 //删除数组的某一项
 const arrRemoveObj = (array, obj) => {
-    let length = array.length;
-    for (let i = 0; i < length; i++) {
-        if (array[i] === obj) {
-            if (i === 0) {
-                array.shift();
-                return array;
-            } else if (i === length - 1) {
-                array.pop();
-                return array;
-            } else {
-                array.splice(i, 1);
-                return array;
-            }
-        }
+  let length = array.length;
+  for (let i = 0; i < length; i++) {
+    if (array[i] === obj) {
+      if (i === 0) {
+        array.shift();
+        return array;
+      } else if (i === length - 1) {
+        array.pop();
+        return array;
+      } else {
+        array.splice(i, 1);
+        return array;
+      }
     }
+  }
 }
 
 //获取对应积分类型
-const getTypeItem=(arr,id)=>{
-    var item=arr.filter(element => {
-          return  typeof(id)=='string'?element.code==id:element.id==id
-    });
-    return item[0]
+const getTypeItem = (arr, id) => {
+  var item = arr.filter(element => {
+    return typeof (id) == 'string' ? element.code == id : element.id == id
+  });
+  return item[0]
 }
+// 获取唯一标识(uid)
+const generateUUID = () => {
+  var d = new Date().getTime();
+  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+    var r = (d + Math.random() * 16) % 16 | 0;
+    d = Math.floor(d / 16);
+    return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
+  });
+  return uuid;
+};
 
 module.exports = {
-  formatTime: formatTime,
-  arrRemoveObj:arrRemoveObj,
-  getTypeItem:getTypeItem
+  formatTime,
+  arrRemoveObj,
+  getTypeItem,
+  generateUUID
 }

+ 82 - 0
utils/websocket.js

@@ -0,0 +1,82 @@
+
+let ws = false
+let weboscket_callback = null
+import { generateUUID } from './util'
+import { showToast } from './feedback'
+
+// 手动关闭 websocket
+let closewebsocket = () => {
+  console.log("关闭")
+  ws = false;
+  dd.offSocketOpen();
+  dd.offSocketMessage();
+  dd.offSocketError();
+  dd.closeSocket();
+  dd.offSocketClose();
+}
+
+let initWebSocket = (callback) => {
+  //初始化 websocket
+  
+  dd.onSocketClose((res) => {
+      console.log(res);
+  });
+
+  // 打开
+  dd.onSocketOpen((res) => {
+    let wsData = {
+      type: 'auth',
+      token: dd.globalData.token,
+      machine: generateUUID()
+    };
+    sendSocketMessage(wsData)
+    ws = true;
+    callback()
+  });
+  // 监听信息
+  dd.onSocketMessage((res) => {
+    let data = JSON.parse(res.data)
+    if (data.type == "ping") {
+      if (ws) {
+        sendSocketMessage('续命')
+      }
+    }
+    return weboscket_callback(data);
+  })
+  // 报错
+  dd.onSocketError((res) => {
+    showToast('服务器繁忙,请稍后再试!');
+    return weboscket_callback({ type: 'error' })
+    // opneWebSocket();
+  });
+  // 创建
+  dd.connectSocket({
+    url: 'wss://' + dd.globalData.webScoketUrl + '/ws/'
+  });
+}
+// 发送消息
+let sendSocketMessage = (message) => {
+  dd.sendSocketMessage({
+    data: JSON.stringify(message), // 需要发送的内容
+    success: (res) => { },
+  });
+};
+
+// 发送数据
+let sendData = (data, callback) => {
+  weboscket_callback = callback
+  if (ws) {
+    sendSocketMessage(data);
+  } else {
+    initWebSocket(() => {
+      sendData(data, callback);
+    });
+  }
+}
+
+// 导出
+export {
+  initWebSocket,
+  sendData,
+  closewebsocket
+}