347617796@qq.com 3 年 前
コミット
d7736eb26c
43 ファイル変更1479 行追加5466 行削除
  1. 11 0
      .ftp/ftp-sync.json
  2. 3 9
      config/dev.env.js
  3. 2 2
      config/index.js
  4. 1 2
      config/prod.env.js
  5. 2 35
      index.html
  6. 4 232
      src/App.vue
  7. 1 0
      src/api/configget.js
  8. 258 636
      src/components/body/department.vue
  9. 0 14
      src/components/body/statistics.vue
  10. 0 20
      src/components/body/user_center.vue
  11. 202 242
      src/components/common/DeptSelectorDropdown.vue
  12. 0 930
      src/components/common/EmployeeSelector copy.vue
  13. 266 240
      src/components/common/EmployeeSelector.vue
  14. 0 291
      src/components/common/EmployeeSelector1.vue
  15. 0 230
      src/components/common/EmployeeSelectorDropdown.vue
  16. 0 718
      src/components/common/EmployeeSelectorNoMark.vue
  17. 1 3
      src/components/common/RuleCategorySelector1.vue
  18. 494 442
      src/components/common/scroller/src/components/Scroller.vue
  19. 0 13
      src/components/ems/employee_edit.vue
  20. 45 55
      src/components/ems/invite.vue
  21. 2 2
      src/components/ems/new_employee.vue
  22. 1 6
      src/components/integral/integral_application.vue
  23. 1 17
      src/components/integral/integral_entry_n.vue
  24. 0 7
      src/components/integral/integral_rank.vue
  25. 0 18
      src/components/pk/pk_teams_copy.vue
  26. 0 11
      src/components/task/short_task.vue
  27. 88 266
      src/components/user/index.vue
  28. 75 0
      src/components/user/login.vue
  29. 0 170
      src/components/user/login1.vue
  30. 0 172
      src/components/user/login2.vue
  31. 0 109
      src/components/user/login3.vue
  32. 2 12
      src/main.js
  33. 0 12
      src/permission.js
  34. 0 114
      src/permissionbf.js
  35. 1 1
      src/router/index.js
  36. 0 10
      src/stcssrc.js
  37. 0 98
      src/utils/analytics.js
  38. 0 4
      src/utils/auth.js
  39. 0 220
      src/utils/request-kq.js
  40. 0 14
      src/utils/request-user.js
  41. 8 57
      src/utils/request.js
  42. 8 31
      src/utils/wx-auth-two.js
  43. 3 1
      src/view/wxOpendata.vue

+ 11 - 0
.ftp/ftp-sync.json

@@ -0,0 +1,11 @@
+{
+    "name": "pc_qywx",
+    "host": "47.106.219.66",
+    "protocol": "sftp",
+    "port": 22,
+    "username": "tuser",
+    "password": "gdy123456",
+    "remotePath": "/home/tuser/qywxm",
+    "uploadOnSave": false,
+    "downloadOnOpen":false
+}

+ 3 - 9
config/dev.env.js

@@ -4,15 +4,10 @@ const prodEnv = require('./prod.env')
 
 module.exports = merge(prodEnv, {
   NODE_ENV: '"development"',
-  // BASE_API: '"http://test.qywx.g107.net"', // wechatgdy.vaiwan.com
-  // BASE_API: '"http://qywx.1024win.cn"',
-
-  // BASE_API: '"http://test.qywx.g107.net"',//开发
-  BASE_API: '"https://qywx.g107.net"',//生产
-
   
- 
-  // BASE_API: '"https://oa.g107.com"',
+  BASE_API: '"http://test.qywx.g107.net"',//开发
+  // BASE_API: '"https://qywx.g107.net"',//生产
+
   BASE_API_KQ: '"https://nkaoqin.g107.net"',
   APP_NAME: '"功道云"',
   APP_VER: '"7.0"',
@@ -30,4 +25,3 @@ module.exports = merge(prodEnv, {
   APP_ID: '"ww4065f0d4bb232a6a"',
   REDIRECT_URI: '"http://wechatgdym.vaiwan.com"',
 })
-

+ 2 - 2
config/index.js

@@ -14,7 +14,7 @@ module.exports = {
 
     // Various Dev Server settings
     host: 'localhost', // can be overwritten by process.env.HOST
-    port: 6002, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
+    port: 8090, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,
     notifyOnErrors: true,
@@ -23,7 +23,7 @@ module.exports = {
     // Use Eslint Loader?
     // If true, your code will be linted during bundling and
     // linting errors and warnings will be shown in the console.
-    useEslint: true,
+    useEslint: false,
     // If true, eslint errors and warnings will also be shown in the error overlay
     // in the browser.
     showEslintErrorsInOverlay: false,

+ 1 - 2
config/prod.env.js

@@ -1,11 +1,10 @@
 'use strict'
 module.exports = {
   NODE_ENV: '"production"',
-  // BASE_API: '"https://oa.g107.com"',
-  // BASE_API: '"http://qywx.1024win.cn"',
 
   // BASE_API: '"http://test.qywx.g107.net"',//开发
   BASE_API: '"https://qywx.g107.net"',//生产
+  
   BASE_API_KQ: '"https://ad.g107.com"',
   APP_NAME: '"功道云-绩效版"',
   APP_VER: '"7.0"',

+ 2 - 35
index.html

@@ -1,6 +1,5 @@
 <!DOCTYPE html>
 <html>
-
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,viewport-fit=cover">
@@ -75,38 +74,6 @@
             'setKeyboardDisplayRequiresUserAction': false
           })
         }
-        // var webview = plus.webview.all();
-        // webview = webview[webview.length - 1]
-        // plus.key.addEventListener('backbutton', function(e) {
-        //   if (plus.storage.getItem('qr_scaning')) {
-        //     return false;
-        //   }
-        //   webview.canBack(function(e) {
-        //     if (e.canBack) {
-        //       webview.back()
-        //     } else {
-        //       if (webview.id == plus.runtime.appid) {
-        //         //首次按键,提示‘再按一次退出应用’
-        //         if (!first) {
-        //           first = new Date().getTime()
-        //           plus.nativeUI.toast("再按一次退出应用");
-        //           setTimeout(function() {
-        //             first = null
-        //           }, 1000)
-        //         } else {
-        //           if (new Date().getTime() - first < 1500) {
-        //             plus.runtime.quit()
-        //           }
-        //         }
-
-        //       } else {
-        //         webview.close();
-        //       }
-
-        //     }
-        //   })
-        // })
-
         var wgtVer = null;
         plus.runtime.getProperty(plus.runtime.appid, function(inf) {
           wgtVer = inf.version
@@ -179,6 +146,6 @@
     <div id="app"></div>
     <!-- built files will be auto injected -->
   </body>
-	<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=a3b5fef4a3a2984284387ae5e2c340ed&plugin=AMap.Geocoder"></script>
-	<script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
+<!-- 	<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=a3b5fef4a3a2984284387ae5e2c340ed&plugin=AMap.Geocoder"></script>
+	<script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script> -->
 </html>

+ 4 - 232
src/App.vue

@@ -1,54 +1,21 @@
 <template>
   <div style="width:100%; height: 100%; position: relative;">
     <vc-keep-alive :ignorePaths="['/help_detail']" :ignoreParams="[]"><router-view :style="'width:100%; height: 100%;'"></router-view></vc-keep-alive>
-    <!-- <div class="suspendButton" v-if="buyPopup" id="moveDiv" @mousedown="down" @touchstart="down" @mousemove="move" @touchmove.prevent="move" @mouseup="end" @touchend="end">
-      <div class="yuanqiu" @click.stop="applyBuyButton">
-        <van-icon name="shopping-cart" size="0.5rem" />
-        <div>申请购买</div>
-      </div>
-      <van-popup v-model="buyPopupPage" :close-on-click-overlay="false" style="border-radius: 0.15rem; background: #fff0;" @closed="getItemBuyPopupPage">
-        <div class="buyPopupBody" style="width: 85vw;">
-          <div class="buyPopupContent" style="position: relative;background: white;padding: 0 5vw 5vw 5vw;border-radius: 0.15rem;">
-            <div
-              class="buyPopupTitle"
-              style="background: #1a89fa;position: absolute;left: 0.6rem;right: 0.6rem;top: -0.3rem;text-align: center;border-radius: 0.1rem;line-height: 2;font-weight: normal;font-size: 0.36rem;color: #fff;"
-            >
-              请购买正式版
-            </div>
-            <p style="font-size: 0.32rem;line-height: 1.8;padding-top: 0.8rem;color: rgb(44, 41, 41)">
-              亲爱的用户,欢迎使用功道云。我们已预置部分体验数据,如需购买完整版请点击【申请购买】,或拨打电话:
-            </p>
-            <p style="color: #1a89fa;font-weight: bold;">400-6877-880</p>
-            <van-row gutter="20">
-              <van-col span="12"><van-button block type="info" @click="applyButton">申请购买</van-button></van-col>
-              <van-col span="12"><van-button block type="default" @click="getItemBuyPopupPage">我知道了</van-button></van-col>
-            </van-row>
-          </div>
-        </div>
-      </van-popup>
-    </div> -->
   </div>
 </template>
 
 <script>
-import { getToken, setToken } from '@/utils/auth'
 import '@/utils/fastclick' // 解决点击存在的300Ms延迟问题
 import Vue from 'vue'
 import VcKeepAlive from 'vc-keep-alive'
-import Echo from 'laravel-echo'
 import VcKeepAliveUpdateMixin from '@/utils/keep-alive-update'
-import request from '@/utils/request'
-import moment from 'moment'
 
-window.io = require('socket.io-client')
 Vue.use(VcKeepAlive)
 Vue.mixin(VcKeepAliveUpdateMixin)
 export default {
   name: 'App',
   data () {
     return {
-      // buyPopupPage: false,
-      // buyPopup: false,
       empty_webview_loaded: false,
       transitionName: '',
       view_height: window.innerHeight + 'px',
@@ -65,47 +32,7 @@ export default {
       yPum: ''
     }
   },
-  sockets: {
-    connect: function () {
-      this.$store.commit('SET_NETWORK_STATUS', 1)
-    },
-    disconnect: function () {
-      this.$store.commit('SET_NETWORK_STATUS', 0)
-    },
-    reconnect: function () {
-      this.$store.commit('SET_NETWORK_STATUS', 1)
-      this.$socket.emit('login', this.$store.getters.user_info.id)
-    }
-  },
   methods: {
-    update_components () {
-      if (window.plus) {
-        let all_view = plus.webview.all()
-        for (let i = 0; i < all_view.length; i++) {
-          all_view[i].evalJS('window.VueObj.$root.$children[0].parse_com(window.VueObj.$root.$children);window.VueObj.$root.$children[0].keep_alive_update_data = {}')
-        }
-      } else {
-        this.parse_com(this.$root.$children)
-        this.keep_alive_update_data = {}
-      }
-    },
-    flush_cache () {
-      if (window.plus) {
-        let all_view = plus.webview.all()
-        for (let i = 0; i < all_view.length; i++) {
-          all_view[i].evalJS('window.VueObj.$store.dispatch("clear_cache")')
-        }
-      } else {
-        this.$store.dispatch('clear_cache')
-      }
-    },
-    create_params (p) {
-      let ret = []
-      for (let i in p) {
-        ret.push(i + '=' + p[i])
-      }
-      return '?' + ret.join('&')
-    },
     open_app (url) {
       if (!window.plus) {
         return false
@@ -246,102 +173,13 @@ export default {
     },
     set_keep_alive_update_data (key, value) {
       this.keep_alive_update_data[key] = value
-    },
-    socket_io_init () {
-      let echo = new Echo({
-        broadcaster: 'socket.io',
-        host: process.env.WEBSOCKET_API
-      })
-
-      // xmx    网址:https://laravel.com/docs/7.x/broadcasting#listening-for-events
-      echo.channel('integral:employee:' + this.$store.getters.user_info.id).listen('.server.info', e => {
-        // 通知前端用户信息有更新
-        // console.log('用户更新了' + e)
-        this.$keep_alive_update('update_user_info', e)
-      })
-
-      echo.channel('integral:site:' + this.$store.getters.user_info.site_id).listen('.server.employeeInvitation', e => {
-        // 通知前端员工新朋友有更新
-        // console.log('新朋友' + e)
-        this.$keep_alive_update('update_new_employee', e)
-        this.update_components()
-      })
-
-      echo.channel('integral:employee:' + this.$store.getters.user_info.id).listen('.server.msgA', e => {
-        // 通知前端A分通知有更新
-        this.$keep_alive_update('update_msgInformation', e)
-        this.update_components()
-      })
-
-      echo.channel('integral:employee:' + this.$store.getters.user_info.id).listen('.server.msgB', e => {
-        // 通知前端B分通知有更新
-        this.$keep_alive_update('update_msgInformation', e)
-        this.update_components()
-      })
-
-      // 加入新公司
-      echo.channel('integral:account:' + this.$store.getters.user_info.account_id).listen('.server.inviteAgree', e => {
-        // 通知前端平台账号申请通过了
-        // console.log(e)
-      })
-      echo.channel('integral:account:' + this.$store.getters.user_info.account_id).listen('.server.CrateSite', e => {
-        // 通知前端异步创建公司结果。
-        // console.log(e)
-      })
-
-      echo.channel('integral:employee:' + this.$store.getters.user_info.id).listen('.server.msgTask', e => {
-        // 通知前端任务消息有更新
-        this.$keep_alive_update('update_task_num', e)
-        this.update_components()
-      })
-      echo.channel('integral:site:' + this.$store.getters.user_info.site_id).listen('.server.siteEmployee', e => {
-        // 通知前端公司所有用户信息有更新(基础数据、权限等)
-        // 更新缓存
-        this.$keep_alive_update('clear_app_cache', {})
-      })
-      echo.channel('integral:employee:' + this.$store.getters.user_info.id).listen('.server.msgInformation', e => {
-        // 通知前端公告通知有更新
-        this.$keep_alive_update('update_msgInformation', e)
-        this.update_components()
-      })
-
-      echo.channel('integral:employee:' + this.$store.getters.user_info.id).listen('.server.msgPerformance', e => {
-        // 通知前端绩效分消息有更新
-        this.$keep_alive_update('update_msgInformation', e)
-        this.update_components()
-      })
-    },
-    // 刷新token
-    refreshToken () {
-      var refreshTime = localStorage.getItem('refreshTime')
-      console.log(refreshTime + '更新token')
-      if (!refreshTime) { // 如果没有时间,存储当前日期
-        localStorage.setItem('refreshTime', moment().format('YYYY-MM-DD'))
-      } else if (getToken()) {
-        var Time = moment().format('YYYY-MM-DD')// 当前时间
-        var expireDate = moment(Time).diff(moment(refreshTime), 'days')// 获取两个时间的差值
-        if (expireDate > 6 && expireDate < 15) {
-          request('get', '/api/fresh_token').then(res => {
-            if (res.data.code == 1) {
-              localStorage.setItem('a-token-temp', res.data.data.account_token)
-              localStorage.setItem('Admin-Token', res.data.data.employee_token)
-              localStorage.setItem('refreshTime', moment().format('YYYY-MM-DD'))
-            }
-          })
-        }
-      }
     }
   },
   mounted () {
     if (window.plus) {
       this.user_info = JSON.parse(plus.storage.getItem('user_info'))
-      if (plus.webview.currentWebview().id == plus.runtime.appid) {
-        // APP只要主窗口监听就好了
-        // this.socket_io_init()
-      }
     } else {
       this.user_info = JSON.parse(localStorage.getItem('user_info'))
-      // this.socket_io_init()
     }
     let self = this
     FastClick.attach(document.body)
@@ -458,34 +296,14 @@ export default {
       },
       true
     )
-    // this.$nextTick(() => {
-    //   if (this.user_info) {
-    //     if (this.user_info.data.try_user && localStorage.getItem('a-token-temp')) {
-    //       this.get_site_list()
-    //     }
-    //   }
-    // })
-  },
-  watch: {
-    // '$store.getters.buyPopup': {
-    //   handler (newName, oldName) {
-    //     this.buyPopup = this.$store.getters.buyPopup
-    //   },
-    //   deep: true,
-    //   immediate: true
-    // }
   },
   created () {
-    if (window.plus) {
-      if (navigator.userAgent.indexOf('Android') > 0) {
-        this.$setCache('isAndroid', 1)
-      } else {
-        this.$setCache('isAndroid', 2)
-      }
+    if (navigator.userAgent.indexOf('Android') > 0) {
+      this.$setCache('isAndroid', 1)
+    } else {
+      this.$setCache('isAndroid', 2)
     }
     let self = this
-    // self.get_ver()
-    // self.refreshToken()
     self.create_web_view(false)
     self.$router.beforeEach((to, from, next) => {
       let view_id = ''
@@ -584,52 +402,6 @@ export default {
       }
       sessionStorage.setItem('routers', routersArr.join(','))
     })
-
-    // if (window.plus) {
-    //   if (plus.webview.currentWebview().id == plus.runtime.appid) {
-    //     // Webview窗口的标识
-    //     plus.webview.currentWebview().onloaded = function () {
-    //       // Webview窗口页面加载完成事件
-    //       plus.push.addEventListener('click', function (msg) {
-    //         // Push模块管理推送消息功能,可以实现在线、离线的消息推送,通过plus.push可获取推送消息管理对象。
-    //         if (!localStorage.getItem(msg.payload.sn)) {
-    //           localStorage.setItem(msg.payload.sn, msg.payload)
-    //           try {
-    //             let app = { url: msg.payload.mini_program.index, download_url: msg.payload.mini_program.path }
-    //             let url = app.url + self.create_params(msg.payload.mini_program.params)
-    //             if (app.download_url.indexOf('.zip') >= 0) {
-    //               self.get_app_and_open(app.download_url, url)
-    //               return false
-    //             } else {
-    //               // 公司对得上直接处理,对不上要提醒切换
-    //               if (self.$store.getters.user_info.site_id == msg.payload.site_id) {
-    //                 var plusUrl = plus.webview.currentWebview().getURL()
-    //                 plusUrl = plusUrl.split('#')[0] + '#' + url
-    //                 var w = plus.webview.create(plusUrl, msg.payload.msg_id)
-    //                 setTimeout(function () {
-    //                   w.show('pop-in', 300)
-    //                 }, 100)
-    //               } else {
-    //                 // self.login2(msg.payload.site_id, function () {
-    //                 //   var plusUrl = plus.webview.currentWebview().getURL()
-    //                 //   plusUrl = plusUrl.split('#')[0] + '#' + url
-    //                 //   var w = plus.webview.create(plusUrl, msg.payload.msg_id)
-    //                 //   setTimeout(function () {
-    //                 //     w.show('pop-in', 300)
-    //                 //   }, 100)
-    //                 // })
-    //               }
-    //             }
-    //           } catch (e) {
-    //             alert(e.message)
-    //           }
-    //         }
-    //       },
-    //       false
-    //       )
-    //     }
-    //   }
-    // }
   }
 }
 </script>

+ 1 - 0
src/api/configget.js

@@ -5,6 +5,7 @@ export async function allocations(body){
     console.log("请求配置")
     if(getToken()){
         let params = {url : body}
+        // let params = {url : 'https://qywx.g107.net'}
         return await request('get','/api/wechat/config', params)
     }
 }

ファイルの差分が大きいため隠しています
+ 258 - 636
src/components/body/department.vue


+ 0 - 14
src/components/body/statistics.vue

@@ -586,20 +586,6 @@ export default {
       }
     },
   },
-  sockets: {
-    new_msg (data) {
-      let self = this
-      self.chat_msg_session_list(function () {})
-    },
-    send_msg_success (data) {
-      let self = this
-      self.chat_msg_session_list(function () {})
-    },
-    get_badge_num (data) {
-      let json = JSON.parse(data)
-      setBadgeNumber(json.num)
-    }
-  },
   keep_alive_update: {
     // 运用缓存更新方法来完成返回后的更新
     update_common_menu_list: function (vm, data) {

+ 0 - 20
src/components/body/user_center.vue

@@ -3,14 +3,10 @@
     <div class="nav-bar__wrap">
       <div class="about-me__header">
         <!-- 公司信息展示 -->
-        <!-- <div class="about-me__info" @click="toAccount"> -->
         <div class="about-me__info">
           <span class="about-me__name"><Wxopendata type="userName" :openid="account_info.name"></Wxopendata></span>
           <userImage class="about-me__avatar" :img_url="account_info.img_url" :user_name="account_info.name" width="1.12rem" height="1.12rem"></userImage>
         </div>
-        <!-- <div>
-          {{account_info.company_info.name}}
-        </div> -->
         <van-cell title-class="platform-title" v-if="user_info.company_info" :title="user_info.company_info.name" is-link/>
       </div>
     </div>
@@ -26,22 +22,6 @@
         <icon class="cell-item__icon color-blue" name="repetition_cycle"/>
       </template>
     </van-cell>
-    <!-- <van-cell is-link to="about">
-      <template slot="title">
-        <span class="cell-item__title">关于功道云</span>
-      </template>
-      <template slot="icon">
-        <icon class="cell-item__icon" name="about_platform"/>
-      </template>
-    </van-cell> -->
-    <!-- <van-cell is-link to="help">
-      <template slot="title">
-        <span class="cell-item__title">帮助与建议</span>
-      </template>
-      <template slot="icon">
-        <icon class="cell-item__icon" name="help_suggest"/>
-      </template>
-    </van-cell> -->
     <van-cell is-link @click="openfx()">
       <template slot="title">
         <span class="cell-item__title">推荐功道云给好友</span>

+ 202 - 242
src/components/common/DeptSelectorDropdown.vue

@@ -1,15 +1,10 @@
 <template>
   <div class="dept-select-drodown__wrap">
-    <div class="dept_path"  style="white-space:nowrap;">
+    <div class="dept_path" style="white-space:nowrap;">
       <div class="dept_paths">
         <a href="javascript:void(0);" @click="backToIndex(-1)">全公司</a>
-        <a
-          v-for="(item, i) in selectedDeptStack"
-          :key="i"
-          href="javascript:void(0);"
-          @click.stop="backToIndex(i)"
-        >
-          <van-icon name="arrow"/>
+        <a v-for="(item, i) in selectedDeptStack" :key="i" href="javascript:void(0);" @click.stop="backToIndex(i)">
+          <van-icon name="arrow" />
           <Wxopendata type="departmentName" :openid="item.name"></Wxopendata>
         </a>
       </div>
@@ -17,20 +12,12 @@
     <div class="select-dropdown__content" :style="contentStyle">
       <scroller class="selector-left _v-container">
         <van-cell-group style="margin-top:0;">
-          <van-cell
-            :class="{on: item.id === selectedLeftDeptId}"
-            v-for="(item,index) in deptData"
-            :key="index"
-            :title="item.name"
-            v-show="item.pid == 0"
-            class="employee_cell"
-            @click.stop="onselectedLeftDepart(item)"
-          >
-          <template slot="title">
-            <span class="custom-title"><Wxopendata type="departmentName" :openid="item.name"></Wxopendata></span>
-          </template>
+          <van-cell :class="{on:item.id === selectedLeftDeptId }" v-for="(item, index) in deptData" :key="index"  class="employee_cell"  @click.stop="onselectedLeftDepart(item)">
+            <template slot="title">
+              <span class="custom-title"><Wxopendata type="departmentName" :openid="item.name"></Wxopendata></span>
+            </template>
           </van-cell>
-          <ListEmptyDataCell :data="deptData" :loading="loading"/>
+          <ListEmptyDataCell :data="deptData" :loading="loading" />
         </van-cell-group>
       </scroller>
 
@@ -39,282 +26,255 @@
           :is-link="selectedRightDeptId !== item.id"
           v-for="(item, i) in rightDepartData"
           :key="i"
-          :title="item.name"
           class="employee_cell"
-          :class="{on: selectedRightDeptId === item.id}"
+          :class="{ on: selectedRightDeptId === item.id }"
           @click.stop="onselectedRightDepart(item)"
         >
           <template slot="title">
             <span class="custom-title"><Wxopendata type="departmentName" :openid="item.name"></Wxopendata></span>
           </template>
           <template slot="right-icon">
-            <van-icon name="success" v-if="selectedRightDeptId === item.id"/>
+            <van-icon name="success" v-if="selectedRightDeptId === item.id" />
           </template>
         </van-cell>
       </scroller>
     </div>
     <div class="date-picker__toolbar">
-      <van-button
-        class="reset-button"
-        block
-        square
-        color="rgba(38,162,255,0.2)"
-        @click.stop="onResetDepart"
-      >{{ resetBtnText }}
-      </van-button>
+      <van-button class="reset-button" block square color="rgba(38,162,255,0.2)" @click.stop="onResetDepart">{{ resetBtnText }}</van-button>
       <van-button block square type="info" @click="onConfirmDepart">确认</van-button>
     </div>
   </div>
 </template>
 
 <script>
-  import Vue from 'vue'
-  import {CellGroup, Cell, Icon, Loading} from 'vant'
-  import request from '@/utils/request'
-  import ListEmptyDataCell from './ListEmptyDataCell'
-
-  Vue.use(CellGroup).use(Cell).use(Icon).use(Loading)
-
-  export default {
-    props: {
-      contentHeight: {type: String, default: '5rem'},
-      resetBtnText: {type: String, default: '恢复默认'}
-    },
-    name: 'EmployeeSelector1',
-    data () {
-      return {
-        loading: false,
-        deptData: null,
-        rightDepartData: null,
-        selectedDeptStack: null,
-        selectedLeftDeptId: null,
-        selectedLeftDeptItem: null,
-        selectedRightDeptId: null,
-        selectedRightDeptItem: null,
+import Vue from 'vue';
+import { CellGroup, Cell, Icon, Loading } from 'vant';
+import request from '@/utils/request';
+import ListEmptyDataCell from './ListEmptyDataCell';
+Vue.use(CellGroup).use(Cell).use(Icon).use(Loading);
+export default {
+  props: {
+    contentHeight: { type: String, default: '5rem' },
+    resetBtnText: { type: String, default: '恢复默认' }
+  },
+  name: 'DeptSelectorDropdown',
+  data() {
+    return {
+      loading: false,
+      deptData: [],
+      deptDataAll: [],//缓存的数据
+      rightDepartData: null,
+      selectedDeptStack: null,
+      selectedLeftDeptId: null,
+      selectedLeftDeptItem: null,
+      selectedRightDeptId: null,
+      selectedRightDeptItem: null
+    };
+  },
+  components: { ListEmptyDataCell },
+  computed: {
+    contentStyle() {
+      return { height: this.contentHeight };
+    }
+  },
+  methods: {
+    backToIndex(index) {
+      if (index < 0) {
+        this.restoreDefaults();
+        this.$emit('onchange', 0);
+      } else {
+        this.Paging_return(index); //传入当前点击下标
+        const deptItem = this.selectedDeptStack[index];
+        this.selectedRightDeptId = deptItem.id;
+        this.selectedRightDeptItem = deptItem;
+        let children=deptItem.children
+        this.rightDepartData = [].concat(deptItem, children);
+        this.$emit('onchange', deptItem);
       }
     },
-    components: {ListEmptyDataCell},
-    computed: {
-      contentStyle () {
-        return {height: this.contentHeight}
-      }
+    Paging_return(deptItem) {
+      this.selectedDeptStack.splice(deptItem + 1, 1 * 1000);
     },
-    methods: {
-      backToIndex (index) {
-        if (index < 0) {
-          this.restoreDefaults()
-          this.$emit('onchange', 0)
-        } else {
-          this.Paging_return(index)//传入当前点击下标
-          const deptItem = this.selectedDeptStack[index]
-          this.selectedRightDeptId = deptItem.id
-          this.selectedRightDeptItem = deptItem
-          this.rightDepartData = [].concat(deptItem, this.deptData.filter(o => o.pid === deptItem.id))
-          this.$emit('onchange', deptItem)
-        }
-      },
-      Paging_return (deptItem) {
-        // 1.循环遍历重新插入数组
-        // let Paging_return_Arrer = []
-        // for(let i=0;i<this.selectedDeptStack.length;i++){//循环当前有的面包屑,获取当前点击下标及前面的面包屑
-        //   if(i <= deptItem){
-        //     Paging_return_Arrer.push(this.selectedDeptStack[i])
-        //   }
-        // }
-        // this.selectedDeptStack = Paging_return_Arrer  
-        //2.删除点击的下标后边所有
-        this.selectedDeptStack.splice(deptItem+1,1*1000)
-      },
-      onselectedLeftDepart (deptItem) {
-        this.selectedLeftDeptId = deptItem.id
-        this.selectedLeftDeptItem = deptItem
-        this.selectedRightDeptId = deptItem.id
-        this.selectedRightDeptItem = deptItem
-        this.selectedDeptStack = [deptItem]
-        this.rightDepartData = [].concat(deptItem, this.deptData.filter(o => o.pid === deptItem.id))
-        this.$emit('onchange', deptItem)
-      },
-      onselectedRightDepart (deptItem) {
-        if (deptItem.id === this.selectedRightDeptId) {
-          return
-        }
-        this.selectedRightDeptId = deptItem.id
-        this.selectedRightDeptItem = deptItem
-        this.selectedDeptStack.push(deptItem)
-        this.rightDepartData = [].concat(deptItem, this.deptData.filter(o => o.pid === deptItem.id))
-        // this.$emit('onchange', deptItem)
-        // this.onConfirmDepart()
-      },
-      onResetDepart () {
-        this.backToIndex(-1)
-      },
-      onConfirmDepart () {
-        this.$emit('onConfirm', this.selectedRightDeptItem)
-      },
-      getDepartData () {
-        this.loading = true
-        request('get','/api/department/index',{pid: this.pid}).then((res) => {
-          const result = res.data
-          if (result.code === 1) {
-            const arr = []
-            const {list: items} = result.data
-            for (let key in items) {
-              arr.push(items[key])
-            }
-            this.deptData = arr
-          }
-        }).catch((e) => {
-
-        }).finally(() => {
-          this.$toast.clear()
-          this.loading = false
-        })
-      },
-      restoreDefaults () {
-        this.selectedLeftDeptId = null
-        this.selectedLeftDeptItem = null
-        this.selectedRightDeptId = null
-        this.selectedRightDeptItem = null
-        this.selectedDeptStack = null
-        this.rightDepartData = null
+    // 选择部门
+    onselectedLeftDepart(deptItem) {
+      this.selectedLeftDeptId = deptItem.id;
+      this.selectedLeftDeptItem = deptItem;
+      this.selectedRightDeptId = deptItem.id;
+      this.selectedRightDeptItem = deptItem;
+      this.selectedDeptStack = [deptItem];
+      let children=deptItem.children
+      this.rightDepartData = [].concat(deptItem, children);
+      this.$emit('onchange', deptItem);
+    },
+    onselectedRightDepart(deptItem) {
+      if (deptItem.id === this.selectedRightDeptId) {
+        return;
       }
+      this.selectedRightDeptId = deptItem.id;
+      this.selectedRightDeptItem = deptItem;
+      this.selectedDeptStack.push(deptItem);
+      let children=deptItem.children
+      this.rightDepartData = [].concat(deptItem, children);
+    },
+    onResetDepart() {
+      this.backToIndex(-1);
     },
-    mounted () {
-      this.getDepartData()
+    onConfirmDepart() {
+      this.$emit('onConfirm', this.selectedRightDeptItem);
+    },
+    getDepartData() {
+      this.loading = true;
+      request('get', '/api/department/index','','v2').then(res => {
+          let list=res.data.data.list;
+          this.deptData = res.data.data.list;
+      }).finally(() => {
+          this.loading = false;
+      });
+    },
+    restoreDefaults() {
+      this.selectedLeftDeptId = null;
+      this.selectedLeftDeptItem = null;
+      this.selectedRightDeptId = null;
+      this.selectedRightDeptItem = null;
+      this.selectedDeptStack = null;
+      this.rightDepartData = null;
     }
+  },
+  mounted() {
+    this.getDepartData();
   }
+};
 </script>
 
 <style scoped lang="less">
-  .dept-select-drodown__wrap {
-    position: relative;
-    overflow: hidden;
-  }
+.dept-select-drodown__wrap {
+  position: relative;
+  overflow: hidden;
+}
 
-  .select-dropdown__content {
-    position: relative;
-  }
-
-  .employee_cell {
-    padding: 0.16rem 0.32rem;
-    touch-action: none;
-  }
+.select-dropdown__content {
+  position: relative;
+}
 
-  .employee_cell .van-cell__title {
-    line-height: 0.8rem;
+.employee_cell {
+  padding: 0.16rem 0.32rem;
+  touch-action: none;
+}
 
-    & > span {
-      font-size: 0.3rem;
-    }
-  }
+.employee_cell .van-cell__title {
+  line-height: 0.8rem;
 
-  .dept_path a {
-    color: #238dfa;
+  & > span {
     font-size: 0.3rem;
   }
+}
 
-  .dept_path a:nth-last-child(1) {
-    color: #999;
-  }
+.dept_path a {
+  color: #238dfa;
+  font-size: 0.3rem;
+}
 
-  .dept_path a * {
-    vertical-align: middle;
-  }
+.dept_path a:nth-last-child(1) {
+  color: #999;
+}
 
-  .dept_path {
-    position: relative;
-    display: flex;
-    height: 0.8rem;
-    font-size: 0.32rem;
-    padding: 0 0.32rem;
-    align-items: center;
-    touch-action: none;
-    overflow-x: scroll;
-  }
+.dept_path a * {
+  vertical-align: middle;
+}
 
-  .dept_path:after {
-    content: ' ';
-    bottom: 0;
-    left: 0;
-    right: 0;
-    background-color: #efefef;
-    height: 1px;
-    position: absolute;
-    transform: scaleY(0.5);
-  }
+.dept_path {
+  position: relative;
+  display: flex;
+  height: 0.8rem;
+  font-size: 0.32rem;
+  padding: 0 0.32rem;
+  align-items: center;
+  touch-action: none;
+  overflow-x: scroll;
+}
 
-  .selector-left {
-    width: 2.2rem !important;
-    background-color: #f5f5f5;
-  }
+.dept_path:after {
+  content: ' ';
+  bottom: 0;
+  left: 0;
+  right: 0;
+  background-color: #efefef;
+  height: 1px;
+  position: absolute;
+  transform: scaleY(0.5);
+}
 
-  .selector-left .van-cell {
-    background-color: #f5f5f5;
-  }
+.selector-left {
+  width: 2.2rem !important;
+  background-color: #f5f5f5;
+}
 
-  .selector-left .employee_cell {
-    padding-left: 0.32rem;
-  }
+.selector-left .van-cell {
+  background-color: #f5f5f5;
+}
 
-  .selector-left .employee_cell.on {
-    position: relative;
+.selector-left .employee_cell {
+  padding-left: 0.32rem;
+}
 
-    &:before {
-      position: absolute;
-      top: 50%;
-      left: 0.08rem;
-      content: '';
-      width: 0.04rem;
-      height: 0.36rem;
-      background: #26a2ff;
-      border-radius: 0.04rem;
-      transform: translateY(-50%);
-    }
-  }
+.selector-left .employee_cell.on {
+  position: relative;
 
-  /deep/ .selector-left .van-cell:not(:last-child):after {
-    left: 0;
+  &:before {
+    position: absolute;
+    top: 50%;
+    left: 0.08rem;
+    content: '';
+    width: 0.04rem;
+    height: 0.36rem;
+    background: #26a2ff;
+    border-radius: 0.04rem;
+    transform: translateY(-50%);
   }
+}
 
-  .selector-right {
-    width: 5.4rem !important;
-    background-color: #fff;
-  }
+/deep/ .selector-left .van-cell:not(:last-child):after {
+  left: 0;
+}
 
-  .van-cell {
-    &.on {
-      color: #238dfa;
+.selector-right {
+  width: 5.4rem !important;
+  background-color: #fff;
+}
 
-      & .van-cell__title > span {
-        font-size: 0.3rem;
-      }
-    }
+.van-cell {
+  &.on {
+    color: #238dfa;
 
     & .van-cell__title > span {
       font-size: 0.3rem;
     }
-
-    & .van-icon-success {
-      align-self: center;
-    }
   }
 
-  .date-picker__toolbar {
-    display: flex;
-    flex-direction: row;
+  & .van-cell__title > span {
+    font-size: 0.3rem;
+  }
 
-    & .reset-button {
-      touch-action: none;
-      color: #26a2ff !important;
-      border: transparent !important;
-    }
+  & .van-icon-success {
+    align-self: center;
   }
-  //滚动条
-  .dept_paths{
-      overflow-x: scroll;
-      height: 0.8rem;
-      display: flex;
-      align-items: center;
+}
+
+.date-picker__toolbar {
+  display: flex;
+  flex-direction: row;
+
+  & .reset-button {
+    touch-action: none;
+    color: #26a2ff !important;
+    border: transparent !important;
   }
+}
+//滚动条
+.dept_paths {
+  overflow-x: scroll;
+  height: 0.8rem;
+  display: flex;
+  align-items: center;
+}
 </style>
-

+ 0 - 930
src/components/common/EmployeeSelector copy.vue

@@ -1,930 +0,0 @@
-<template>
-  <van-popup
-    :duration="0.2"
-    :overlay="false"
-    class="employee_selector_popup"
-    v-model="visible_"
-    :position="position"
-    :style="'height:'+com_height"
-  >
-    <slot name="nav"></slot>
-    <van-nav-bar v-if="!$slots.nav" :title="title" left-text="取消" @click-left="close"></van-nav-bar>
-    <!-- <van-search v-model="keyword" v-if="can_select_employee" placeholder="请输入姓名搜索" />
-    <van-search v-model="keyword" v-else placeholder="请输入部门名称搜索" /> -->
-    <van-search v-model="keyword" style="margin-top: .2rem;" v-if="!can_select_employee" placeholder="请输入部门名称搜索" />
-    <div class="dept_path" v-show="pid_list_arr.length > 0">
-      <a href="javascript:void(0);" @click="back_by_index(0)">全公司</a>
-      <a
-        v-for="(item, index) in pid_list_arr"
-        :key="index"
-        href="javascript:void(0);"
-        @click="back_by_index(index + 1)"
-      >
-        <van-icon name="arrow" />
-        <Wxopendata type="departmentName" :openid="item.name"></Wxopendata>
-      </a>
-    </div>
-    <div class="body_com" :class="{show_dept_path:pid_list_arr.length > 0}">
-      <scroller :on-refresh="get_user_list" ref="scroller_com">
-        <!-- can_select_dept  选择部门传值 -->
-        <van-cell
-          :is-link="!can_select_dept"
-          v-for="(item,index) in dept_list"
-          :key="index"
-          :title="item.name"
-          v-show="item.pid == pid && item.name.indexOf(keyword) >= 0 && dept_not_select.indexOf(item.id) < 0"
-          class="employee_cell"
-          @click="select_dept(item)"
-        >
-          <template slot="icon">
-            <van-checkbox v-if="can_select_dept" v-model="item.checked"></van-checkbox>
-            <img v-if="can_select_dept" src="static/images/e66f.jpg" class="employee_cell_head_img" />
-            <!-- <userImage :id="item.id" width="0.8rem" height="0.8rem" ></userImage> -->
-          </template>
-          <template slot="title">
-            <Wxopendata type="departmentName" :openid="item.name"></Wxopendata>
-          </template>
-          <template slot="right-icon" v-if="(can_select_dept && item.child.length > 0) || (!can_select_dept && can_select_employee && item.count > 0)">
-            <a href="javascript:void(0);" class="child_btn" @click.stop="show_child(item)">| 下级</a>
-          </template>
-        </van-cell>
-
-        <div style="height: .4rem; background: rgb(245, 245, 245);" v-show="selected_all"></div>
-        <van-cell v-show="selected_all">
-          <template #title>
-            <van-checkbox v-model="checked_btn" @change="checked_change">全选</van-checkbox>
-          </template>
-        </van-cell>
-        <div v-for="(item,index) in list" :key="index" v-if="can_select_employee" v-show="item.name.indexOf(keyword) >= 0">
-          <!-- <div
-            v-if="index == 0"
-            :data-pageindex="item.letter_index"
-            class="pageIndexBtn"
-          >{{item.letter_index}}</div> -->
-          <!-- <div
-            v-if="index > 0 && list[index-1].letter_index != item.letter_index"
-            :data-pageindex="item.letter_index"
-            class="pageIndexBtn"
-          >{{item.letter_index}}</div> -->
-          <van-cell
-            :class="{'letter-first': index == 0 || (index > 0 && list[index-1].letter_index != item.letter_index)}"
-            v-if="can_select_employee"
-            :title="item.name+(item.identification?'(直属上级)':'')"
-            class="employee_cell"
-            @click="select_employee(item)"
-          >
-            <template slot="icon">
-              <van-checkbox
-                v-if="selectedQuitEmployee"
-                :style="item.status > 1 || employee_not_select.indexOf(item.id) >= 0?'opacity: 0':'opacity: 1'"
-                v-model="item.checked"
-              ></van-checkbox>
-              <van-checkbox
-                v-if="!selectedQuitEmployee"
-                :style="employee_not_select.indexOf(item.id) > 0?'opacity: 0':'opacity: 1'"
-                v-model="item.checked"
-              ></van-checkbox>
-
-              <!-- {opacity: item.status < 2 || employee_not_select.indexOf(item.id) < 0 ? 1 :0} -->
-              <userImage
-                class="employee_cell_head_img"
-                :img_url ="item.img_url"
-                :user_name="item.name"
-                width="0.8rem"
-                height="0.8rem"
-                fontSize="0.2"
-              ></userImage>
-              <!-- <img :src="item.img_url"class="employee_cell_head_img"/> -->
-            </template>
-            <template slot="title">
-              <Wxopendata type="userName" :openid="item.name"></Wxopendata>{{item.identification?'(直属上级)':''}}
-            </template>
-            <template slot="right-icon" v-if="typeof(item.status) != 'undefined'">
-              <van-tag plain v-show="item.status == 0 || item.status == 2">{{item.status == 0 ?'未加入':'离职'}}</van-tag>
-            </template>
-          </van-cell>
-        </div>
-      </scroller>
-    </div>
-    <slot name="footer"></slot>
-    <div class="bottom_menu flex-box flex-v-ce" :class="{isIos:isIos}">
-      <div class="selected_box flex-1">
-        <div class="flex-box flex-v-ce ul" :style="'width:'+selected_box_width">
-          <div v-for="(item,index) in employee_selected_list" :key="index" @click="employee_cancel(item)" class="li">
-            <userImage :img_url ="item.img_url" :user_name="item.name" width="0.9rem" height="0.9rem"  fontSize="0.2"></userImage>
-          </div>
-          <div v-for="(item,index) in dept_selected_list" :key="index" @click="dept_cancel(item)" class="fb">
-            <img src="static/images/e66f.jpg" />
-            <div class="name_mini"><Wxopendata type="departmentName" :openid="item.dept_name"></Wxopendata></div>
-          </div>
-        </div>
-      </div>
-      <div class="selected_btn" ref="selected_btn">
-        <van-button ref="selected_button" style="height: 0.7rem; line-height: 0.7rem;" type="info" @click="confirm">
-          确定<template v-if="multi && max*1 > 0">({{employee_selected_list.length}}/{{max}})</template>
-         </van-button>
-      </div>
-    </div>
-  </van-popup>
-</template>
-
-<script>
-import Vue from 'vue'
-import { ActionSheet, Popup, Checkbox, Tag, Search } from 'vant'
-
-import userImage from '@/components/common/user_image'
-import request from '@/utils/request'
-Vue.use(Popup).use(Tag)
-Vue.use(Checkbox)
-Vue.use(ActionSheet)
-Vue.use(Search)
-export default {
-  props: {
-    position: {// 弹窗从哪里出来
-      type: String,
-      default: 'bottom'
-    },
-    append_body: {// 销毁组件时清空标题的作用
-      type: Boolean,
-      default: false
-    },
-    visible: { // 是否显示组件
-      type: Boolean,
-      default: false
-    },
-    can_select_dept: { // 指定是否能选择部门
-      type: Boolean,
-      default: true
-    },
-    can_select_employee: { // 指定是否能选择员工
-      type: Boolean,
-      default: true
-    },
-    employee_not_select: { // 排除员工的ID,包含ID时不出现在选择列表中
-      type: Array,
-      default: () => { return [] }
-    },
-    dept_not_select: { // dept_not_select
-      type: Array,
-      default: () => { return [] }
-    },
-    selected: { // 已经选择的员工和部门
-      type: Object,
-      default: () => {
-        return { employee: [], dept: [] }
-      }
-    },
-    multi: { // 指定员工是否能多选
-      type: Boolean,
-      default: true
-    },
-    dept_multi: { // dept_multi
-      type: Boolean,
-      default: true
-    },
-    employee_list: { // 指定显示的员工列表,注意:传值后组件的员工数据将不是统一向服务器获取的,而是指定的员工列表,格式是:[{id: 1, name: “张三”, img_url: “”}]
-      type: Array,
-      default: null
-    },
-    use_employee_list: { // 为true时,employee_list才生效
-      type: Boolean,
-      default: false
-    },
-    close_clear_data: { // 关闭时是否清空选择的数据
-      type: Boolean,
-      default: true
-    },
-    max: { // 当multi为true时,用来限制选择人数,0不生效
-      type: Number,
-      default: 0
-    },
-    include_self: { // 是否显示当前登录的员工信息
-      type: Boolean,
-      default: true
-    },
-    show_manager_only: { // 是否只显示管理者列表
-      type: Boolean,
-      default: false
-    },
-    title: { // cell的显示名称
-      type: String,
-      default: ''
-    },
-    selected_all: { // 是否选择全部
-      type: Boolean,
-      default: false
-    },
-    selectedQuitEmployee: {//
-      type: Boolean,
-      default: true
-    },
-    is_filtration_creator: {// 是否过滤掉创始人
-      type: Boolean,
-      default: false
-    }
-  },
-  name: 'EmployeeSelector',
-  components: { userImage },
-  data () {
-    let selected = JSON.parse(JSON.stringify(this.selected))
-    return {
-      employee_selected_list: selected.employee,
-      dept_selected_list: selected.dept,
-      employee_selected: [],
-      dept_selected: [],
-      com_height: '100%',
-      company_info: {},
-      actions_show: false,
-      dept_name: '',
-      dept_id: 0,
-      list: [],
-      dept_list: [],
-      keyword: '',
-      owner_id: 0,
-      user_info: this.$store.getters.user_info,
-      pid: 0,
-      pid_list: [],
-      selected_box_width: '0',
-      pid_list_arr: [],
-      visible_: false,
-      cache_list: [],
-      checked_btn: false,
-	  isIos: false // 是否需要兼容IOS X以上
-    }
-  },
-  watch: {
-    max (val) {
-      this.set_button_width()
-    },
-    selected (val) {
-      let selected = JSON.parse(JSON.stringify(val))
-      this.employee_selected = []
-      this.dept_selected = []
-      this.employee_selected_list = selected.employee
-      this.dept_selected_list = selected.dept
-      for (let i in selected.employee) {
-        this.employee_selected.push(selected.employee[i].id)
-      }
-      for (let i in selected.dept) {
-        this.dept_selected.push(selected.dept[i].dept_id)
-      }
-      this.set_button_width()
-    },
-    // 显示组件并调用初始化数据接口
-    visible (val) {
-      this.visible_ = JSON.parse(JSON.stringify(val))
-      if (val) {
-        setTimeout(() => {
-          if (this.$route.query.pid) {
-            this.pid = this.$route.query.pid
-          }
-          this.get_user_list(function () {})
-          this.get_dept_list()
-        }, 200)
-      }
-      this.set_button_width()
-    },
-    employee_selected_list () {
-      let l = this.employee_selected_list.length + this.dept_selected_list.length
-      let width = 1 * l
-      this.selected_box_width = width + 'rem'
-      this.set_button_width()
-    },
-    dept_selected_list () {
-      let l = this.employee_selected_list.length + this.dept_selected_list.length
-      let width = 1 * l
-      this.selected_box_width = width + 'rem'
-      this.set_button_width()
-    },
-    keyword () {
-      this.get_user_list(function () {})
-    }
-  },
-  mounted () {
-  },
-  methods: {
-    checked_change (val) {
-      if (val) {
-        for (let i in this.list) {
-          this.$set(this.list[i], 'checked', true)
-        }
-        this.$nextTick(() => {
-          let employeeSelectedList = JSON.parse(JSON.stringify(this.employee_selected_list))
-          let employeeSelectedIds = [], total = 0
-          employeeSelectedList.forEach(element => {
-            employeeSelectedIds.push(element.id)
-          })
-          for (const i in this.list) {
-            if (this.employee_not_select.indexOf(this.list[i].id) < 0) {
-              this.$set(this.list[i], 'checked', true)
-              if (employeeSelectedIds.includes(this.list[i].id)) {
-                total += 1
-              } else {
-                this.employee_selected_list.push(this.list[i])
-              }
-            }
-          }
-        })
-      } else {
-        this.employee_selected_list = []
-        this.employee_selected = []
-        for (let i in this.list) {
-          this.$set(this.list[i], 'checked', false)
-        }
-        // this.clear_data()
-      }
-    },
-    set_button_width () {
-      this.$nextTick(() => {})
-    },
-    back () {
-      this.pid = this.pid_list[this.pid_list.length - 1]
-      this.pid_list.splice(this.pid_list.length - 1)
-      this.pid_list_arr.splice(this.pid_list_arr.length - 1)
-      this.get_user_list(function () {
-
-      })
-    },
-    back_by_index (index) {
-      if (index == this.pid_list.length) {
-        return false
-      }
-      this.pid = this.pid_list[index]
-      this.pid_list.splice(index, 100)
-      this.pid_list_arr.splice(index, 100)
-      this.get_user_list(function () {
-
-      })
-    },
-    show_child (item) {
-      this.pid_list.push(this.pid)
-      this.pid_list_arr.push(item)
-      this.pid = item.id
-      this.list = []
-      this.get_user_list(function () {
-
-      })
-    },
-    employee_cancel (item) {
-      this.employee_selected.splice(this.employee_selected.indexOf(item.id), 1)
-      let delete_index = -1
-      for (let i in this.employee_selected_list) {
-        if (this.employee_selected.indexOf(this.employee_selected_list[i].id) < 0) {
-          delete_index = i
-        }
-      }
-      if (delete_index >= 0) {
-        this.employee_selected_list.splice(delete_index, 1)
-        for (let i in this.list) {
-          if (this.list[i].id == item.id) {
-            this.$set(this.list[i], 'checked', false)
-          }
-        }
-      }
-    },
-    dept_cancel (item) {
-      this.dept_selected.splice(this.dept_selected.indexOf(item.id), 1)
-      let delete_index = -1
-      for (let i in this.dept_selected_list) {
-        if (this.dept_selected.indexOf(this.dept_selected_list[i].id) < 0) {
-          delete_index = i
-        }
-      }
-      if (delete_index >= 0) {
-        this.dept_selected_list.splice(delete_index, 1)
-        for (let i in this.dept_list) {
-          if (this.dept_list[i].dept_id == item.id) {
-            this.$set(this.dept_list[i], 'checked', false)
-          }
-        }
-      }
-    },
-    select_employee (item) {
-      if (this.selectedQuitEmployee) {
-        if (this.employee_not_select.indexOf(item.id) >= 0 || item.status > 1) {
-          return false
-        }
-      } else {
-        if (this.employee_not_select.indexOf(item.id) >= 0) {
-          return false
-        }
-      }
-
-      if (item.checked) {
-        item.checked = false
-        this.employee_cancel(item)
-      } else {
-        if (!this.multi) {
-          this.employee_selected = []
-          this.employee_selected_list = []
-          for (let i in this.list) {
-            this.$set(this.list[i], 'checked', false)
-          }
-        }
-        if (this.max > 0 && this.employee_selected.length == this.max && this.multi) {
-          this.$toast('最多只能选择' + this.max + '人')
-          return false
-        }
-        this.employee_selected.push(item.id)
-        this.employee_selected_list.push({ id: item.id, name: item.name, img_url: item.img_url })
-        item.checked = true
-      }
-    },
-    select_dept (item) {
-      if (!this.can_select_dept) {
-        this.show_child(item)
-        return false
-      }
-      if (item.checked) {
-        item.checked = false
-        this.dept_cancel(item)
-      } else {
-        if (!this.dept_multi) {
-          this.dept_selected = []
-          this.dept_selected_list = []
-          for (let i in this.dept_list) {
-            this.$set(this.dept_list[i], 'checked', false)
-          }
-        }
-        this.dept_selected.push(item.id)
-        this.dept_selected_list.push({ dept_id: item.id, dept_name: item.name, avatar: 'static/images/e66f.jpg' })
-        item.checked = true
-      }
-    },
-    close () {
-      this.$emit('update:visible', false)
-      this.$emit('cancel')
-      if (this.close_clear_data) {
-        this.employee_selected = []
-        this.employee_selected_list = []
-        this.dept_selected = []
-        this.dept_selected_list = []
-        for (let i in this.list) {
-          this.$set(this.list[i], 'checked', false)
-        }
-        for (let i in this.dept_list) {
-          this.$set(this.dept_list[i], 'checked', false)
-        }
-      }
-    },
-    confirm () {
-      this.$emit('confirm', {
-        employee: this.employee_selected_list,
-        dept: this.dept_selected_list
-      })
-      this.close()
-    },
-    // 获取部门数据
-    get_dept_list () {
-      // 当只显示管理者列表或者 use_employee_list为True
-      if (this.use_employee_list || this.show_manager_only) {
-        return
-      }
-      this.dept_map = {}
-      request('get', '/api/department/index', { pid: this.pid, keyword: this.keyword }).then((res) => {
-        var userList = res.data.data.list || []
-        for (let i in userList) {
-          userList[i]['checked'] = false
-          if (this.dept_selected.indexOf(userList[i].id) >= 0) {
-            userList[i]['checked'] = true
-          }
-          for (let k in userList) {
-            if (!userList[i]['child']) {
-              userList[i]['child'] = []
-            }
-            if (userList[k].pid == i) {
-              userList[i]['child'].push(userList[k])
-            }
-          }
-        }
-        this.dept_list = userList
-        this.owner_id = res.data.data.owner_id
-        this.company_info = res.data.data.company_info
-        if (res.data.data.dept_info == null) {
-          this.dept_name = JSON.parse(JSON.stringify(res.data.data.company_info.name))
-          this.dept_id = 0
-        } else {
-          this.dept_name = JSON.parse(JSON.stringify(res.data.data.dept_info.name))
-          this.dept_id = res.data.data.dept_info.id
-        }
-        this.$toast.clear()
-      }).catch((e) => {
-        this.$toast.clear()
-      })
-    },
-    // 选择部门来筛选人,默认选择中的人勾上
-    parse_list (data) {
-      this.list = []
-      let _list = []
-      for (let i in data) {
-        data[i]['checked'] = false
-        if (this.employee_selected.indexOf(data[i].id) >= 0) {
-          data[i]['checked'] = true
-        }
-        if (data[i].img_url == '') {
-          data[i].img_url = ''
-        }
-        // 过滤创始人
-        if (this.is_filtration_creator) {
-          if (data[i].is_creator == 1) {
-            data.splice(i, 1)
-          }
-        }
-      }
-      this.list = data
-      this.$nextTick(() => {
-        if (this.visible && this.can_select_employee) {
-          this.$refs['scroller_com'].createPageIndex()
-        }
-      })
-    },
-
-    
-    // get_user_list (done) {
-    //   console.log('this.use_employee_list')
-    //   console.log(this.use_employee_list)
-    //   let employeeMap = window.plus ? JSON.parse(plus.storage.getItem('SET_EMPLOYEE_MAP')) : JSON.parse(localStorage.getItem('SET_EMPLOYEE_MAP'))
-    //   // 当有指定显示列表时
-      
-    //   this.$toast.loading({
-    //     mask: true,
-    //     message: '加载中...'
-    //   });
-    //   request('get', '/api/employee/index', { dept_id: this.pid, keywords: this.keyword, page: 0, page_size: 2000, is_official: 1 }).then((res) => {
-    //     let offlist = res.data.data.list
-
-    //     if (this.use_employee_list) {
-    //       let employee_list = this.employee_list
-    //       var userData = [];
-    //       offlist.map(item => {
-    //         // 列表数据是否是自己的管理范围
-    //         employee_list.map(item2 => {
-    //           if (item.id == item2.id) {
-    //             userData.push(item);
-    //           }
-    //         });
-    //       });
-
-    //       let list = userData
-    //       for (let i in list) {
-    //         list[i]['letter_index'] = '#'
-    //         if (employeeMap[list[i].id]) {
-    //           list[i]['letter_index'] = employeeMap[list[i].id].letter_index
-    //           if (employeeMap[list[i].id].img_url == '') {
-    //             list[i]['img_url'] = ''
-    //           } else {
-    //             list[i]['img_url'] = employeeMap[list[i].id].img_url
-    //           }
-    //           list[i]['status'] = employeeMap[list[i].id].status
-    //         }
-    //         list[i]['checked'] = false
-    //         if (this.employee_selected.indexOf(list[i].id) >= 0) {
-    //           list[i]['checked'] = true
-    //         }
-    //       }
-          
-    //       this.list = list.sort((a, b) => {
-    //         return a.letter_index.charCodeAt(0) - b.letter_index.charCodeAt(0)
-    //       })
-    //       done()
-    //       this.$nextTick(() => {
-    //         if (this.visible && this.can_select_employee) {
-    //           this.$refs['scroller_com'].createPageIndex()
-    //         }
-    //       })
-
-    //       this.removeSelf(list)
-    //       this.dept_list = []
-    //       return false
-    //     }
-    //     // 当点击选择部门时,传入部门ID过去出符合人员
-    //     if (this.cache_list[this.pid]) {
-    //       this.parse_list(this.cache_list[this.pid])
-    //       done()
-    //     }
-    //     // 避免多次请求
-    //     if (this.loadingUserList) { return }
-    //     this.loadingUserList = true
-
-        
-    //     let _list = []
-    //     // 把管理者过滤掉
-    //     if (this.show_manager_only) {
-    //       for (let i in offlist) {
-    //         let is_manager = false
-    //         for (let j in offlist[i].role_list) {
-    //           if (offlist[i].role_list[j].name == 'creator' || offlist[i].role_list[j].name == 'point_manager' || offlist[i].role_list[j].name == 'dept_manager' || offlist[i].role_list[j].name == 'admin') {
-    //             is_manager = true
-    //           }
-    //         }
-    //         if (is_manager) {
-    //           _list.push(offlist[i])
-    //         }
-    //       }
-    //     } else {
-    //       _list = offlist
-    //     }
-    //     // 正常进行
-    //     const list = _list
-    //     this.cache_list[this.pid] = this.removeSelf(list)
-    //     this.parse_list(list)
-    //     done()
-    //     this.$toast.clear()
-
-    //   }).catch((e) => {
-    //     done()
-    //     this.$toast.clear()
-    //   }).finally(() => {
-    //     this.loadingUserList = false
-    //     this.$toast.clear();
-    //   })
-    // },
-    // 获取人员数据
-    get_user_list (done) {
-      console.log('this.use_employee_list')
-      console.log(this.use_employee_list)
-      let employeeMap = window.plus ? JSON.parse(plus.storage.getItem('SET_EMPLOYEE_MAP')) : JSON.parse(localStorage.getItem('SET_EMPLOYEE_MAP'))
-      // 当有指定显示列表时
-      if (this.use_employee_list) {
-        let list = this.employee_list
-        for (let i in list) {
-          list[i]['letter_index'] = '#'
-          if (employeeMap[list[i].id]) {
-            list[i]['letter_index'] = employeeMap[list[i].id].letter_index
-            if (employeeMap[list[i].id].img_url == '') {
-              list[i]['img_url'] = ''
-            } else {
-              list[i]['img_url'] = employeeMap[list[i].id].img_url
-            }
-            list[i]['status'] = employeeMap[list[i].id].status
-          }
-          list[i]['checked'] = false
-          if (this.employee_selected.indexOf(list[i].id) >= 0) {
-            list[i]['checked'] = true
-          }
-        }
-        this.list = list.sort((a, b) => {
-          return a.letter_index.charCodeAt(0) - b.letter_index.charCodeAt(0)
-        })
-        done()
-        this.$nextTick(() => {
-          if (this.visible && this.can_select_employee) {
-            this.$refs['scroller_com'].createPageIndex()
-          }
-        })
-
-        this.removeSelf(list)
-        this.dept_list = []
-        return false
-      }
-      // 当点击选择部门时,传入部门ID过去出符合人员
-      if (this.cache_list[this.pid]) {
-        this.parse_list(this.cache_list[this.pid])
-        done()
-      }
-      // 避免多次请求
-      if (this.loadingUserList) { return }
-      this.loadingUserList = true
-
-      request('get', '/api/employee/index', { dept_id: this.pid, keywords: this.keyword, page: 0, page_size: 2000, is_official: 1 }).then((res) => {
-        let _list = []
-        // 把管理者过滤掉
-        console.log(this.show_manager_only)
-        if (this.show_manager_only) {
-          console.log(res.data.data.list)
-          for (let i in res.data.data.list) {
-            let is_manager = false
-            for (let j in res.data.data.list[i].role_list) {
-              if (res.data.data.list[i].role_list[j].name == 'creator' || res.data.data.list[i].role_list[j].name == 'point_manager' || res.data.data.list[i].role_list[j].name == 'dept_manager' || res.data.data.list[i].role_list[j].name == 'admin') {
-                is_manager = true
-              }
-            }
-            if (is_manager) {
-              _list.push(res.data.data.list[i])
-            }
-          }
-        } else {
-          _list = res.data.data.list
-        }
-        
-        console.log(_list)
-        // 正常进行
-        const list = _list
-        this.cache_list[this.pid] = this.removeSelf(list)
-        this.parse_list(list)
-        done()
-        this.$toast.clear()
-      }).catch((e) => {
-        done()
-        this.$toast.clear()
-      }).finally(() => this.loadingUserList = false)
-    },
-    // 删除自己
-    removeSelf (list) {
-      if (!this.include_self) {
-        const currUserId = this.$store.getters.user_info.id
-        const index = list.findIndex(o => o.id === currUserId)
-        if (index > -1) {
-          list.splice(index, 1)
-        }
-      }
-      return list
-    }
-  },
-  created () {
-    if (document.documentElement.style.height) {
-      this.com_height = document.documentElement.style.height
-    }
-    if (window.plus) {
-	  this.isIos = window.plus.storage.getItem('iPhone')
-    }
-    this.pid = this.$route.query.pid || 0
-  },
-  // 组件生命周期销毁时调用
-  beforeDestroy () {
-    if (this.append_body) {
-      document.body.removeChild(this.$el)
-    }
-    this.close()
-  }
-}
-</script>
-
-<style scoped>
-.body_com {
-  /* height: calc(100% - 3.2rem); */
-  height: calc(100% - 1.2rem);
-  position: relative;
-}
-.isIos{
-   padding-bottom: 0.4rem !important;
-}
-.body_com.show_dept_path {
-  height: calc(100% - 3.48rem);
-}
-.bottom_menu {
-  text-align: center;
-  position: fixed;
-  padding:0.1rem 0.16rem;
-  min-height: 0.9rem;
-  left: 0;
-  right: 0;
-  bottom: 0;
-  background-color: #fff;
-}
-.bottom_menu:before {
-  content: ' ';
-  height: 1px; /*no*/
-  background-color: #eee;
-  width: 100%;
-  top: 0;
-  left: 0;
-  position: absolute;
-}
-.bottom_menu a {
-  color: #1989fa;
-  font-size: 0.32rem;
-}
-
-.employee_cell_head_img {
-  width: 0.8rem;
-  height: 0.8rem;
-  margin-left: 0.16rem;
-  -webkit-border-radius: 0.1rem;
-  -moz-border-radius: 0.1rem;
-  border-radius: 0.1rem;
-  margin-right: 0.15rem;
-}
-
-.employee_cell {
-  padding: 0.16rem 0.32rem;
-}
-.employee_cell .van-checkbox {
-  overflow: visible;
-}
-.employee_cell .van-cell__title {
-  line-height: 0.8rem;
-}
-.employee_cell .van-cell__right-icon {
-  margin-top: 0.2rem;
-}
-.employee_cell .van-icon {
-  color: #999;
-  margin-top: 0.2rem;
-}
-
-.employee_selector_popup {
-  height: 100%;
-  width: 100%;
-}
-.child_btn {
-  color: #1989fa;
-  display: block;
-  height: 1.14rem;
-  position: absolute;
-  right: 0.32rem;
-  top: 0;
-  padding: 0 0.16rem;
-  line-height: 1.1rem;
-  font-size: 0.28rem;
-}
-.child_btn:active {
-  color: #323233;
-}
-.selected_box,
-.selected_btn {
-  vertical-align: top;
-}
-.selected_btn {
-  text-align: center;
-}
-.selected_box{
-    overflow-x: scroll;
-    margin-right: 0.16rem;
-}
-.ul .li {
-  width:0.9rem;
-  height:0.9rem;
-  margin-right: 0.1rem;
-}
-.ul .li img {
-  width: 0.8rem;
-  vertical-align: top;
-  height: 0.8rem;
-  padding: 0.05rem;
-  -webkit-border-radius: 0.1rem;
-  -moz-border-radius: 0.1rem;
-  border-radius: 0.1rem;
-}
-.ul .fb {
-  width:0.9rem;
-  height:0.9rem;
-  margin-right: 0.1rem;
-  position: relative;
-}
-.ul .fb img {
-  width: 0.8rem;
-  vertical-align: top;
-  height: 0.8rem;
-  padding: 0.05rem;
-  -webkit-border-radius: 0.1rem;
-  -moz-border-radius: 0.1rem;
-  border-radius: 0.1rem;
-}
-.name_mini {
-  font-size: 0.2rem;
-  position: absolute;
-  bottom: 0rem;
-  left: 0rem;
-  right: 0rem;
-  padding: 0.02rem 0;
-  text-align: center;
-  background-color: rgba(0, 0, 0, 0.4);
-  height: 0.2rem;
-  color: #fff;
-  line-height: 0.2rem;
-  overflow: hidden;
-  text-overflow: ellipsis;
-  white-space: nowrap;
-}
-.dept_path a {
-  color: #238dfa;
-  font-size: 0.28rem;
-}
-.dept_path a:nth-last-child(1) {
-  color: #999;
-}
-.dept_path a * {
-  vertical-align: middle;
-}
-.dept_path {
-  min-height: 0.6rem;
-  position: relative;
-  font-size: 0.32rem;
-  line-height: 0.4rem;
-  overflow-x: scroll;
-  padding: 0 0.32rem;
-}
-.dept_path:after {
-  content: ' ';
-  bottom: 0;
-  left: 0;
-  right: 0;
-  background-color: #efefef;
-  height: 1px;
-  position: absolute;
-  transform: scaleY(0.5);
-}
-.pageIndexBtn {
-  width: 100%;
-  text-align: left;
-  padding: 0.1rem 0.4rem 0.05rem;
-  color: #909399;
-  background: rgb(245, 245, 245);
-  font-size: 0.24rem;
-}
-.employee_cell .van-tag{
-  display: inline-table;
-  margin-top: 0.16rem;
-}
-</style>

+ 266 - 240
src/components/common/EmployeeSelector.vue

@@ -5,24 +5,29 @@
     <van-search v-model="keyword" v-if="can_select_employee" placeholder="请输入姓名搜索" />
     <van-search v-model="keyword" v-else placeholder="请输入部门名称搜索" />
     <template v-if="isShowDeptsAll">
-      <div @click="isShowDeptSelect()" class="sax">部门筛选 <van-icon style="position: relative;top: 2px;" :name="!isShowDept? 'arrow-down':'arrow-up'" color="#909399" /></div>
-      <div class="dept_path" v-show="pid_list_arr.length > 0&&isShowDept">
+      <div @click="isShowDeptSelect()" class="sax">
+        部门筛选
+        <van-icon style="position: relative;top: 2px;" :name="!isShowDept ? 'arrow-down' : 'arrow-up'" color="#909399" />
+      </div>
+      <div class="dept_path" v-show="pid_list_arr.length > 0 && isShowDept">
         <a href="javascript:void(0);" @click="back_by_index(0)">全公司</a>
-        <a v-for="(item, index) in pid_list_arr" :key="index" href="javascript:void(0);" @click="back_by_index(index+1,item)">
-          <van-icon name="arrow"/>
+        <a v-for="(item, index) in pid_list_arr" :key="index" href="javascript:void(0);" @click="back_by_index(index + 1, item)">
+          <van-icon name="arrow" />
           <Wxopendata type="departmentName" :openid="item.name"></Wxopendata>
         </a>
       </div>
     </template>
     <div class="body_com" :class="{ show_dept_path: pid_list_arr.length > 0 }">
-     <scroller ref="scroller_com">
-      <!-- <scroller :on-refresh="get_user_list" ref="scroller_com"> -->
-        <!-- can_select_dept  选择部门传值 -->
-        <van-cell :is-link="!can_select_dept"
-        v-for="(item, index) in dept_list" :key="index" :title="item.name"
-         v-show="isShowDept && dept_not_select.indexOf(item.id) < 0"
-        class="employee_cell"
-        @click="select_dept(item)">
+      <scroller ref="scroller_com">
+        <van-cell
+          :is-link="!can_select_dept"
+          v-for="(item, index) in dept_list"
+          :key="index"
+          :title="item.name"
+          v-show="isShowDept && dept_not_select.indexOf(item.id) < 0"
+          class="employee_cell"
+          @click="select_dept(item)"
+        >
           <template slot="icon">
             <van-checkbox v-if="can_select_dept" v-model="item.checked"></van-checkbox>
             <img v-if="can_select_dept" src="static/images/e66f.jpg" class="employee_cell_head_img" />
@@ -30,10 +35,10 @@
           <template slot="title">
             <Wxopendata type="departmentName" :openid="item.name"></Wxopendata>
           </template>
-          <template slot="right-icon" v-if="item.children.length>0">
+          <template slot="right-icon" v-if="item.children.length > 0">
             <a href="javascript:void(0);" class="child_btn" @click.stop="show_child(item)">| 下级</a>
           </template>
-       </van-cell>
+        </van-cell>
 
         <div style="height: .4rem; background: rgb(245, 245, 245);" v-show="selected_all"></div>
         <van-cell v-show="selected_all">
@@ -42,8 +47,6 @@
           </template>
         </van-cell>
         <div v-for="(item, index) in list" :key="index" v-if="can_select_employee">
-          <!-- <div v-if="index == 0" :data-pageindex="item.letter_index" class="pageIndexBtn">{{ item.letter_index }}</div>
-          <div v-if="index > 0 && list[index - 1].letter_index != item.letter_index" :data-pageindex="item.letter_index" class="pageIndexBtn">{{ item.letter_index }}</div> -->
           <van-cell
             :class="{ 'letter-first': index == 0 || (index > 0 && list[index - 1].letter_index != item.letter_index) }"
             v-if="can_select_employee"
@@ -52,20 +55,24 @@
             @click="select_employee(item)"
           >
             <template slot="icon">
-              <van-checkbox v-if="selectedQuitEmployee"  :style="item.status > 1 || employee_not_select.indexOf(item.id) >= 0 ? 'opacity: 0' : 'opacity: 1'" v-model="item.checked"></van-checkbox>
+              <van-checkbox
+                v-if="selectedQuitEmployee"
+                :style="item.status > 1 || employee_not_select.indexOf(item.id) >= 0 ? 'opacity: 0' : 'opacity: 1'"
+                v-model="item.checked"
+              ></van-checkbox>
               <van-checkbox v-if="!selectedQuitEmployee" :style="employee_not_select.indexOf(item.id) > 0 ? 'opacity: 0' : 'opacity: 1'" v-model="item.checked"></van-checkbox>
               <userImage class="employee_cell_head_img" :img_url="item.img_url" :user_name="item.name" width="0.8rem" height="0.8rem" fontSize="0.2"></userImage>
             </template>
             <template slot="title">
-              <Wxopendata type="userName" :openid="item.name"></Wxopendata>{{item.identification?'(直属上级)':''}}
+              <Wxopendata type="userName" :openid="item.name"></Wxopendata>
+              {{ item.identification ? '(直属上级)' : '' }}
             </template>
             <template slot="right-icon" v-if="typeof item.status != 'undefined'">
               <van-tag plain v-show="item.status == 0 || item.status == 2">{{ item.status == 0 ? '未加入' : '离职' }}</van-tag>
             </template>
           </van-cell>
-
         </div>
-        <van-empty v-if="list.length==0" description="暂无数据..."/>
+        <van-empty v-if="list.length == 0" description="暂无数据..." />
         <div style="height: 1rem;"></div>
       </scroller>
     </div>
@@ -95,15 +102,15 @@
 </template>
 
 <script>
-import Vue from 'vue'
-import { ActionSheet, Popup, Checkbox, Tag, Search } from 'vant'
+import Vue from 'vue';
+import { ActionSheet, Popup, Checkbox, Tag, Search } from 'vant';
 
-import userImage from '@/components/common/user_image'
-import request from '@/utils/request'
-Vue.use(Popup).use(Tag)
-Vue.use(Checkbox)
-Vue.use(ActionSheet)
-Vue.use(Search)
+import userImage from '@/components/common/user_image';
+import request from '@/utils/request';
+Vue.use(Popup).use(Tag);
+Vue.use(Checkbox);
+Vue.use(ActionSheet);
+Vue.use(Search);
 export default {
   props: {
     position: {
@@ -135,20 +142,21 @@ export default {
       // 排除员工的ID,包含ID时不出现在选择列表中
       type: Array,
       default: () => {
-        return []
+        return [];
       }
     },
-    dept_not_select: {// 不选择的部门
+    dept_not_select: {
+      // 不选择的部门
       type: Array,
       default: () => {
-        return []
+        return [];
       }
     },
     selected: {
       // 已经选择的员工和部门
       type: Object,
       default: () => {
-        return { employee: [], dept: [] }
+        return { employee: [], dept: [] };
       }
     },
     multi: {
@@ -156,7 +164,8 @@ export default {
       type: Boolean,
       default: true
     },
-    dept_multi: {// 部门能否多选
+    dept_multi: {
+      // 部门能否多选
       type: Boolean,
       default: true
     },
@@ -164,14 +173,16 @@ export default {
       // 指定显示的员工列表,注意:传值后组件的员工数据将不是统一向服务器获取的,而是指定的员工列表,格式是:[{id: 1, name: “张三”, img_url: “”}]
       type: Array,
       default: () => {
-        return []
+        return [];
       }
     },
-    use_employee_list: {// 为true时,employee_list才生效
+    use_employee_list: {
+      // 为true时,employee_list才生效
       type: Boolean,
       default: false
     },
-    close_clear_data: { // 关闭时是否清空选择的数据
+    close_clear_data: {
+      // 关闭时是否清空选择的数据
       type: Boolean,
       default: true
     },
@@ -180,7 +191,8 @@ export default {
       type: Number,
       default: 0
     },
-    include_self: {// 是否显示当前登录的员工信息
+    include_self: {
+      // 是否显示当前登录的员工信息
       type: Boolean,
       default: true
     },
@@ -189,7 +201,8 @@ export default {
       type: Boolean,
       default: false
     },
-    title: {// cell的显示名称
+    title: {
+      // cell的显示名称
       type: String,
       default: ''
     },
@@ -213,19 +226,21 @@ export default {
       type: Boolean,
       default: false
     },
-    deptId: {// 指定显示某部门的人员,(这是部门ID)
+    deptId: {
+      // 指定显示某部门的人员,(这是部门ID)
       type: Number,
       default: 0
     },
-    isShowDeptsAll: {// 是否不可看部门选择
+    isShowDeptsAll: {
+      // 是否不可看部门选择
       type: Boolean,
       default: true
     }
   },
   name: 'EmployeeSelector',
   components: { userImage },
-  data () {
-    let selected = JSON.parse(JSON.stringify(this.selected))
+  data() {
+    let selected = JSON.parse(JSON.stringify(this.selected));
     return {
       employee_selected_list: selected.employee,
       dept_selected_list: selected.dept,
@@ -245,339 +260,349 @@ export default {
       cache_list: [],
       checked_btn: false,
       isIos: false, // 是否需要兼容IOS X以上
-      isShowDept: false// 控制显示部门选择
-    }
+      isShowDept: false // 控制显示部门选择
+    };
   },
   watch: {
-    selected (val) {
-      this.setSelected(val)
+    selected(val) {
+      this.setSelected(val);
     },
     // 显示组件并调用初始化数据接口
-    visible (val) {
-      this.visible_ = JSON.parse(JSON.stringify(val))
+    visible(val) {
+      this.visible_ = JSON.parse(JSON.stringify(val));
       if (val) {
         setTimeout(() => {
           if (this.$route.query.pid) {
-            this.pid = this.$route.query.pid
+            this.pid = this.$route.query.pid;
           }
           if (this.deptId != 0) {
-            this.pid = this.deptId
+            this.pid = this.deptId;
           }
-          this.get_user_list(function () {})
-          this.get_dept_list()
-        }, 200)
+          this.get_user_list(function() {});
+          this.get_dept_list();
+        }, 200);
       }
     },
-    employee_selected_list () {
-      let l = this.employee_selected_list.length + this.dept_selected_list.length
-      let width = 1 * l
-      this.selected_box_width = width + 'rem'
+    employee_selected_list() {
+      let l = this.employee_selected_list.length + this.dept_selected_list.length;
+      let width = 1 * l;
+      this.selected_box_width = width + 'rem';
     },
-    dept_selected_list () {
-      let l = this.employee_selected_list.length + this.dept_selected_list.length
-      let width = 1 * l
-      this.selected_box_width = width + 'rem'
+    dept_selected_list() {
+      let l = this.employee_selected_list.length + this.dept_selected_list.length;
+      let width = 1 * l;
+      this.selected_box_width = width + 'rem';
     }
     // keyword () {
     //   this.get_user_list(function () {})
     // }
   },
-  mounted () {
-    this.isShowDept = this.isShowDepts
+  mounted() {
+    this.isShowDept = this.isShowDepts;
   },
   methods: {
-    setSelected (val) {
-      let selected = JSON.parse(JSON.stringify(val))
-      this.employee_selected = []
-      this.dept_selected = []
-      this.employee_selected_list = selected.employee
-      this.dept_selected_list = selected.dept
+    setSelected(val) {
+      let selected = JSON.parse(JSON.stringify(val));
+      this.employee_selected = [];
+      this.dept_selected = [];
+      this.employee_selected_list = selected.employee;
+      this.dept_selected_list = selected.dept;
       for (let i in selected.employee) {
-        this.employee_selected.push(selected.employee[i].id)
+        this.employee_selected.push(selected.employee[i].id);
       }
       for (let i in selected.dept) {
-        this.dept_selected.push(selected.dept[i].dept_id)
+        this.dept_selected.push(selected.dept[i].dept_id);
       }
     },
     // 打开时触发
-    openPopup () {
-      this.setSelected(this.selected)
+    openPopup() {
+      this.setSelected(this.selected);
     },
     // 控制部门显示隐藏
-    isShowDeptSelect () {
-      this.isShowDept = !this.isShowDept
+    isShowDeptSelect() {
+      this.isShowDept = !this.isShowDept;
     },
-    checked_change (val) {
+    checked_change(val) {
       if (val) {
         for (let i in this.list) {
-          this.$set(this.list[i], 'checked', true)
+          this.$set(this.list[i], 'checked', true);
         }
         this.$nextTick(() => {
-          let employeeSelectedList = JSON.parse(JSON.stringify(this.employee_selected_list))
-          let employeeSelectedIds = [], total = 0
+          let employeeSelectedList = JSON.parse(JSON.stringify(this.employee_selected_list));
+          let employeeSelectedIds = [],
+            total = 0;
           employeeSelectedList.forEach(element => {
-            employeeSelectedIds.push(element.id)
-          })
+            employeeSelectedIds.push(element.id);
+          });
           for (const i in this.list) {
             if (this.employee_not_select.indexOf(this.list[i].id) < 0) {
-              this.$set(this.list[i], 'checked', true)
+              this.$set(this.list[i], 'checked', true);
               if (employeeSelectedIds.includes(this.list[i].id)) {
-                total += 1
+                total += 1;
               } else {
-                this.employee_selected_list.push(this.list[i])
+                this.employee_selected_list.push(this.list[i]);
               }
             }
           }
-        })
+        });
       } else {
-        this.employee_selected_list = []
-        this.employee_selected = []
+        this.employee_selected_list = [];
+        this.employee_selected = [];
         for (let i in this.list) {
-          this.$set(this.list[i], 'checked', false)
+          this.$set(this.list[i], 'checked', false);
         }
       }
     },
-    back_by_index (index, item) {
-      this.pid_list_arr.splice(index, 100)
-      if (index == 0) { // 点击全部
-        this.dept_list = this.dept_list_all
-        this.pid_list_arr = []
-        this.pid = 0
+    back_by_index(index, item) {
+      this.pid_list_arr.splice(index, 100);
+      if (index == 0) {
+        // 点击全部
+        this.dept_list = this.dept_list_all;
+        this.pid_list_arr = [];
+        this.pid = 0;
       }
       if (item) {
         if (item.children) {
-          this.dept_list = item.children
-          this.pid = item.id
+          this.dept_list = item.children;
+          this.pid = item.id;
         }
       }
-      this.get_user_list(function () {})
+      this.get_user_list(function() {});
     },
-    show_child (item) {
+    show_child(item) {
       if (item.children) {
-        this.dept_list = item.children
+        this.dept_list = item.children;
       }
-      this.pid_list_arr.push(item)
-      this.pid = item.id
-      this.list = []
-      this.get_user_list(function () {})
-    },
-    employee_cancel (item) {
-      this.employee_selected.splice(this.employee_selected.indexOf(item.id), 1)
-      let delete_index = -1
+      this.pid_list_arr.push(item);
+      this.pid = item.id;
+      this.list = [];
+      this.get_user_list(function() {});
+    },
+    employee_cancel(item) {
+      this.employee_selected.splice(this.employee_selected.indexOf(item.id), 1);
+      let delete_index = -1;
       for (let i in this.employee_selected_list) {
         if (this.employee_selected.indexOf(this.employee_selected_list[i].id) < 0) {
-          delete_index = i
+          delete_index = i;
         }
       }
       if (delete_index >= 0) {
-        this.employee_selected_list.splice(delete_index, 1)
+        this.employee_selected_list.splice(delete_index, 1);
         for (let i in this.list) {
           if (this.list[i].id == item.id) {
-            this.$set(this.list[i], 'checked', false)
+            this.$set(this.list[i], 'checked', false);
           }
         }
       }
     },
-    dept_cancel (item) {
-      this.dept_selected.splice(this.dept_selected.indexOf(item.id), 1)
-      let delete_index = -1
+    dept_cancel(item) {
+      this.dept_selected.splice(this.dept_selected.indexOf(item.id), 1);
+      let delete_index = -1;
       for (let i in this.dept_selected_list) {
         if (this.dept_selected.indexOf(this.dept_selected_list[i].id) < 0) {
-          delete_index = i
+          delete_index = i;
         }
       }
       if (delete_index >= 0) {
-        this.dept_selected_list.splice(delete_index, 1)
+        this.dept_selected_list.splice(delete_index, 1);
         for (let i in this.dept_list) {
           if (this.dept_list[i].dept_id == item.id) {
-            this.$set(this.dept_list[i], 'checked', false)
+            this.$set(this.dept_list[i], 'checked', false);
           }
         }
       }
     },
-    select_employee (item) {
+    select_employee(item) {
       if (this.selectedQuitEmployee) {
         if (this.employee_not_select.indexOf(item.id) >= 0 || item.status > 1) {
-          return false
+          return false;
         }
       } else {
         if (this.employee_not_select.indexOf(item.id) >= 0) {
-          return false
+          return false;
         }
       }
       if (item.checked) {
-        item.checked = false
-        this.employee_cancel(item)
+        item.checked = false;
+        this.employee_cancel(item);
       } else {
         if (!this.multi) {
-          this.employee_selected = []
-          this.employee_selected_list = []
+          this.employee_selected = [];
+          this.employee_selected_list = [];
           for (let i in this.list) {
-            this.$set(this.list[i], 'checked', false)
+            this.$set(this.list[i], 'checked', false);
           }
         }
         if (this.max > 0 && this.employee_selected.length == this.max && this.multi) {
-          this.$toast('最多只能选择' + this.max + '人')
-          return false
+          this.$toast('最多只能选择' + this.max + '人');
+          return false;
         }
-        this.employee_selected.push(item.id)
-        this.employee_selected_list.push({ id: item.id, name: item.name, img_url: item.img_url })
-        item.checked = true
+        this.employee_selected.push(item.id);
+        this.employee_selected_list.push({ id: item.id, name: item.name, img_url: item.img_url });
+        item.checked = true;
       }
     },
-    select_dept (item) {
+    select_dept(item) {
       if (!this.can_select_dept) {
-        this.show_child(item)
-        return false
+        this.show_child(item);
+        return false;
       }
       if (item.checked) {
-        item.checked = false
-        this.dept_cancel(item)
+        item.checked = false;
+        this.dept_cancel(item);
       } else {
         if (!this.dept_multi) {
-          this.dept_selected = []
-          this.dept_selected_list = []
+          this.dept_selected = [];
+          this.dept_selected_list = [];
           for (let i in this.dept_list) {
-            this.$set(this.dept_list[i], 'checked', false)
+            this.$set(this.dept_list[i], 'checked', false);
           }
         }
-        this.dept_selected.push(item.id)
-        this.dept_selected_list.push({ dept_id: item.id, dept_name: item.name, avatar: 'static/images/e66f.jpg' })
-        item.checked = true
+        this.dept_selected.push(item.id);
+        this.dept_selected_list.push({ dept_id: item.id, dept_name: item.name, avatar: 'static/images/e66f.jpg' });
+        item.checked = true;
       }
     },
-    close () {
-      this.$emit('update:visible', false)
-      this.$emit('cancel')
+    close() {
+      this.$emit('update:visible', false);
+      this.$emit('cancel');
       if (this.close_clear_data) {
-        this.employee_selected = []
-        this.employee_selected_list = []
-        this.dept_selected = []
-        this.dept_selected_list = []
+        this.employee_selected = [];
+        this.employee_selected_list = [];
+        this.dept_selected = [];
+        this.dept_selected_list = [];
         for (let i in this.list) {
-          this.$set(this.list[i], 'checked', false)
+          this.$set(this.list[i], 'checked', false);
         }
         for (let i in this.dept_list) {
-          this.$set(this.dept_list[i], 'checked', false)
+          this.$set(this.dept_list[i], 'checked', false);
         }
       }
     },
-    confirm () {
+    confirm() {
       this.$emit('confirm', {
         employee: this.employee_selected_list,
         dept: this.dept_selected_list
-      })
-      this.close()
+      });
+      this.close();
     },
     // 获取部门数据
-    get_dept_list () {
-      this.dept_map = {}
-      request('get', '/api/department/tree', '').then(res => {
-        var userList = res.data.data.list || []
-        for (let i in userList) {
-          userList[i]['checked'] = false
-          if (this.dept_selected.indexOf(userList[i].id) >= 0) {
-            userList[i]['checked'] = true
+    get_dept_list() {
+      this.dept_map = {};
+      request('get', '/api/department/tree', '')
+        .then(res => {
+          var userList = res.data.data.list || [];
+          for (let i in userList) {
+            userList[i]['checked'] = false;
+            if (this.dept_selected.indexOf(userList[i].id) >= 0) {
+              userList[i]['checked'] = true;
+            }
           }
-        }
-        this.dept_list = userList
-        this.dept_list_all = userList
-      }).finally(() => {
-        this.$toast.clear()
-      })
+          this.dept_list = userList;
+          this.dept_list_all = userList;
+        })
+        .finally(() => {
+          this.$toast.clear();
+        });
     },
     // 选择部门来筛选人,默认选择中的人勾上
-    parse_list (data) {
-      this.list = []
+    parse_list(data) {
+      this.list = [];
       for (let i in data) {
-        data[i]['checked'] = false
+        data[i]['checked'] = false;
         if (this.employee_selected.indexOf(data[i].id) >= 0) {
-          data[i]['checked'] = true
+          data[i]['checked'] = true;
         }
         if (data[i].img_url == '') {
-          data[i].img_url = ''
+          data[i].img_url = '';
         }
       }
-      this.list = data
+      this.list = data;
       this.$nextTick(() => {
         if (this.visible && this.can_select_employee) {
-          this.$refs['scroller_com'].createPageIndex()
+          this.$refs['scroller_com'].createPageIndex();
         }
-      })
+      });
     },
     // 获取人员数据
-    get_user_list (done) {
-      if (this.loadingUserList) { return }
-      this.loadingUserList = true
-      request('get', '/api/employee/index', { dept_id: this.pid, keywords: this.keyword, page: 0, page_size: 2000, is_official: 1 }).then(res => {
-        var list = this.filtration(res.data.data.list)// 过滤各种条件
-        // 当有指定显示列表时
-        console.log(this.use_employee_list)
-        console.log(this.employee_list)
-        console.log(list)
-        if (this.use_employee_list) {
-          var employeeList = this.employee_list
-          var userData = []
-          list.map((item) => { // 列表数据是否是自己的管理范围
-            employeeList.map((item2) => {
-              if (item.id == item2.id) {
-                userData.push(item)
-              }
-            })
-          })
-          console.log(userData)
-          this.parse_list(userData)
-        } else { // 没有指定人员列表
-          this.cache_list[this.pid] = list
-          this.parse_list(list)
-        }
-      }).finally(() => {
-        done()
-        this.$toast.clear()
-        this.loadingUserList = false
-      })
+    get_user_list(done) {
+      if (this.loadingUserList) {
+        return;
+      }
+      this.loadingUserList = true;
+      request('get', '/api/employee/index', { dept_id: this.pid, keywords: this.keyword, page: 0, page_size: 2000, is_official: 1 })
+        .then(res => {
+          var list = this.filtration(res.data.data.list); // 过滤各种条件
+          // 当有指定显示列表时
+          console.log(this.use_employee_list);
+          console.log(this.employee_list);
+          console.log(list);
+          if (this.use_employee_list) {
+            var employeeList = this.employee_list;
+            var userData = [];
+            list.map(item => {
+              // 列表数据是否是自己的管理范围
+              employeeList.map(item2 => {
+                if (item.id == item2.id) {
+                  userData.push(item);
+                }
+              });
+            });
+            console.log(userData);
+            this.parse_list(userData);
+          } else {
+            // 没有指定人员列表
+            this.cache_list[this.pid] = list;
+            this.parse_list(list);
+          }
+        })
+        .finally(() => {
+          done();
+          this.$toast.clear();
+          this.loadingUserList = false;
+        });
 
       // 当点击选择部门时,传入部门ID过去出符合人员
       if (this.cache_list[this.pid]) {
-        this.parse_list(this.cache_list[this.pid])
-        done()
+        this.parse_list(this.cache_list[this.pid]);
+        done();
       }
     },
     // 过滤各种条件:如:自己,创始人,只显示管理者等。。。
-    filtration (data) {
-      var list = data
+    filtration(data) {
+      var list = data;
       // 去除已经离职的人
       for (let i = 0; i < list.length; i++) {
         if (list[i].status == 2) {
-          list.splice(i, 1)
-          i--
+          list.splice(i, 1);
+          i--;
         }
       }
-      var managerList = [] // 管理者列表
+      var managerList = []; // 管理者列表
       // 只显示管理者
       if (this.show_manager_only) {
-        var isManager
+        var isManager;
         list.map(item => {
-          isManager = false
+          isManager = false;
           item.employee_detail.role_list.map(item2 => {
             if (item2.name == 'creator' || item2.name == 'point_manager' || item2.name == 'dept_manager' || item2.name == 'admin') {
-              isManager = true
+              isManager = true;
             }
-          })
+          });
           if (isManager) {
-            managerList.push(item)
+            managerList.push(item);
           }
-        })
-        list = managerList
+        });
+        list = managerList;
       }
 
       // 过滤自己
       if (!this.include_self) {
-        const currUserId = this.$userInfo().id
+        const currUserId = this.$userInfo().id;
         for (let i = 0; i < list.length; i++) {
           if (list[i].id == currUserId) {
-            list.splice(i, 1)
-            i--
+            list.splice(i, 1);
+            i--;
           }
         }
       }
@@ -585,43 +610,44 @@ export default {
       if (this.is_filtration_creator) {
         for (let i = 0; i < list.length; i++) {
           if (list[i].is_creator == 1) {
-            list.splice(i, 1)
-            i--
+            list.splice(i, 1);
+            i--;
           }
         }
       }
-      return list
+      return list;
     }
   },
-  created () {
+  created() {
     if (document.documentElement.style.height) {
-      this.com_height = document.documentElement.style.height
+      this.com_height = document.documentElement.style.height;
     }
     if (window.plus) {
-      this.isIos =(plus.storage.getItem('iPhone')=='false')? false:true;
+      this.isIos = plus.storage.getItem('iPhone') == 'false' ? false : true;
     }
   },
   // 组件生命周期销毁时调用
-  beforeDestroy () {
+  beforeDestroy() {
     if (this.append_body) {
-      this.$nextTick(()=>{
-        if(document.body.contains(this.$el)){//判断有无在body中
-          document.body.removeChild(this.$el)
+      this.$nextTick(() => {
+        if (document.body.contains(this.$el)) {
+          //判断有无在body中
+          document.body.removeChild(this.$el);
         }
-      })
+      });
     }
-    this.close()
+    this.close();
   }
-}
+};
 </script>
 
 <style scoped>
- .sax{
-   text-align: center;
-   font-size: 0.32rem;
-   padding-bottom: 0.2rem;
-   border-bottom: 1px solid #f1f1f1;
- }
+.sax {
+  text-align: center;
+  font-size: 0.32rem;
+  padding-bottom: 0.2rem;
+  border-bottom: 1px solid #f1f1f1;
+}
 .body_com {
   height: calc(100% - 3.2rem);
   position: relative;

+ 0 - 291
src/components/common/EmployeeSelector1.vue

@@ -1,291 +0,0 @@
-<template>
-  <div class="dropdown-box">
-    <div class="dept_path">
-      <a href="javascript:void(0);" @click="backToIndex(-1)">全公司</a>
-      <a
-        v-for="(item, i) in selectedDepartStack"
-        :key="i"
-        href="javascript:void(0);"
-        @click="backToIndex(i)"
-      >
-        <van-icon name="arrow" />
-        {{item.name}}
-      </a>
-    </div>
-    <div class="body_com">
-      <scroller class="selector-left">
-        <van-cell-group style="margin-top:0;">
-          <van-cell
-            :class="{on: item.id === selectedLeftDepartId}"
-            v-for="(item,index) in departData"
-            :key="index"
-            :title="item.name"
-            v-show="item.pid == 0"
-            class="employee_cell"
-            @click="onselectedLeftDepart(item)"
-          />
-        </van-cell-group>
-      </scroller>
-
-      <scroller ref="scroller_com" class="selector-right" style="left:2.2rem; width:5.4rem;">
-        <van-cell
-          :is-link="selectedRightDepartId !== item.id"
-          v-for="(item, i) in rightDepartData"
-          :key="i"
-          :title="item.name"
-          class="employee_cell"
-          :class="{on: selectedRightDepartId === item.id}"
-          @click="onselectedRightDepart(item)"
-        >
-          <template slot="right-icon">
-            <van-icon name="success" v-if="selectedRightDepartId === item.id" />
-          </template>
-        </van-cell>
-      </scroller>
-    </div>
-  </div>
-</template>
-
-<script>
-import Vue from 'vue';
-import { ActionSheet, Popup, Checkbox } from 'vant';
-Vue.use(Popup);
-Vue.use(Checkbox);
-Vue.use(ActionSheet);
-import { Search } from 'vant';
-
-Vue.use(Search);
-import request from '@/utils/request'
-export default {
-  props: {
-    append_body: {
-      type: Boolean,
-      default: false
-    },
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    can_select_dept: {
-      type: Boolean,
-      default: true
-    },
-    can_select_employee: {
-      type: Boolean,
-      default: true
-    },
-    employee_not_select: {
-      type: Array,
-      default: () => { return [] }
-    },
-    dept_not_select: {
-      type: Array,
-      default: () => { return [] }
-    },
-    selected: {
-      type: Object,
-      default: () => {
-        return { employee: [], dept: [] }
-      }
-    },
-    multi: {
-      type: Boolean,
-      default: true
-    },
-    dept_multi: {
-      type: Boolean,
-      default: true
-    },
-    close_clear_data: {
-      type: Boolean,
-      default: true
-    },
-    max: {
-      type: Number,
-      default: 0
-    }
-  },
-  name: "EmployeeSelector1",
-  data() {
-    let selected = JSON.parse(JSON.stringify(this.selected))
-    return {
-      departData: null,
-      rightDepartData: null,
-      selectedDepartStack: null,
-      selectedLeftDepartId: null,
-      selectedLeftDepartItem: null,
-      selectedRightDepartId: null,
-      selectedRightDepartItem: null,
-    }
-  },
-  beforeDestroy() {
-    if (this.append_body) {
-      document.body.removeChild(this.$el)
-    }
-  },
-  methods: {
-    backToIndex(index) {
-      if (index < 0) {
-        this.restoreDefaults()
-      } else if (index === 0) {
-        this.onselectedLeftDepart(this.selectedDepartStack[0])
-      } else {
-        const departItem = this.selectedDepartStack[index]
-        this.selectedRightDepartId = departItem.id
-        this.selectedRightDepartItem = departItem
-        this.rightDepartData = [].concat(departItem, this.departData.filter(o => o.pid === departItem.id))
-      }
-    },
-    onselectedLeftDepart(departItem) {
-      if (departItem.id === this.selectedLeftDepartId) {
-        return;
-      }
-      this.selectedLeftDepartId = departItem.id
-      this.selectedLeftDepartItem = departItem
-      this.selectedRightDepartId = departItem.id
-      this.selectedRightDepartItem = departItem
-      this.selectedDepartStack = [departItem]
-      this.rightDepartData = [].concat(departItem, this.departData.filter(o => o.pid === departItem.id))
-    },
-    onselectedRightDepart(departItem) {
-      if (departItem.id === this.selectedRightDepartId) {
-        return;
-      }
-      this.selectedRightDepartId = departItem.id
-      this.selectedRightDepartItem = departItem
-      this.selectedDepartStack.push(departItem)
-      this.rightDepartData = [].concat(departItem, this.departData.filter(o => o.pid === departItem.id))
-    },
-    getDepartData() {
-      request('get','/api/department/index',{ pid: this.pid }).then((res) => {
-        const result = res.data;
-        if (result.code === 1) {
-          const arr = [];
-          const { list: items } = result.data;
-          for (let key in items) {
-            arr.push(items[key])
-          }
-          this.departData = arr
-        }
-      }).catch((e) => {
-
-      }).finally(() => this.$toast.clear())
-    },
-    restoreDefaults() {
-      this.selectedLeftDepartId = null
-      this.selectedLeftDepartItem = null
-      this.selectedRightDepartId = null
-      this.selectedRightDepartItem = null
-      this.selectedDepartStack = null
-      this.rightDepartData = null
-    }
-  },
-  mounted() {
-    this.getDepartData();
-  }
-}
-</script>
-
-<style scoped lang="less">
-.body_com {
-  height: calc(100% - 0.8rem);
-  position: relative;
-}
-
-.employee_cell {
-  padding: 0.16rem 0.32rem;
-  touch-action: none;
-}
-
-.employee_cell .van-cell__title {
-  line-height: 0.8rem;
-
-  & > span {
-    font-size: 0.3rem;
-  }
-}
-
-.dept_path a {
-  color: #238dfa;
-  font-size: 0.3rem;
-}
-.dept_path a:nth-last-child(1) {
-  color: #999;
-}
-.dept_path a * {
-  vertical-align: middle;
-}
-.dept_path {
-  position: relative;
-  display: flex;
-  height: 0.8rem;
-  font-size: 0.32rem;
-  padding: 0 0.32rem;
-  align-items: center;
-  touch-action: none;
-  overflow-x: scroll;
-}
-.dept_path:after {
-  content: ' ';
-  bottom: 0;
-  left: 0;
-  right: 0;
-  background-color: #efefef;
-  height: 1px;
-  position: absolute;
-  transform: scaleY(0.5);
-}
-
-.dropdown-box {
-  height: 6rem;
-}
-.selector-left {
-  width: 2.2rem !important;
-  background-color: #f5f5f5;
-}
-.selector-left .van-cell {
-  background-color: #f5f5f5;
-}
-.selector-left .employee_cell {
-  padding-left: 0.32rem;
-}
-.selector-left .employee_cell.on {
-  position: relative;
-
-  &:before {
-    position: absolute;
-    top: 50%;
-    left: 0.08rem;
-    content: '';
-    width: 0.04rem;
-    height: 0.36rem;
-    background: #26a2ff;
-    border-radius: 0.04rem;
-    transform: translateY(-50%);
-  }
-}
-/deep/ .selector-left .van-cell:not(:last-child):after {
-  left: 0;
-}
-.selector-right {
-  width: 5.4rem !important;
-  background-color: #fff;
-}
-.van-cell {
-  &.on {
-    color: #238dfa;
-    & .van-cell__title > span {
-      font-size: 0.3rem;
-    }
-  }
-
-  & .van-cell__title > span {
-    font-size: 0.3rem;
-  }
-
-  & .van-icon-success {
-    align-self: center;
-  }
-}
-</style>
-

+ 0 - 230
src/components/common/EmployeeSelectorDropdown.vue

@@ -1,230 +0,0 @@
-<template>
-  <div class="dept-select-drodown__wrap">
-
-    <div class="select-dropdown__content" :style="contentStyle">
-      <EmployeeSelectorNoMark :employee_list.sync="employee_list" :selected.sync="selected" @confirm="confirm"></EmployeeSelectorNoMark>
-    </div>
-    <div class="date-picker__toolbar">
-      <van-button
-        class="reset-button"
-        block
-        square
-        color="rgba(38,162,255,0.2)"
-        @click="onResetDepart"
-      >{{ resetBtnText }}
-      </van-button>
-      <van-button block square type="info" @click="onConfirmDepart">确认</van-button>
-    </div>
-  </div>
-</template>
-
-<script>
-  import Vue from 'vue'
-  import {CellGroup, Cell, Icon, Loading} from 'vant'
-  import ListEmptyDataCell from './ListEmptyDataCell'
-  import EmployeeSelectorNoMark from './EmployeeSelectorNoMark'
-
-  Vue.use(CellGroup).use(Cell).use(Icon).use(Loading)
-
-  export default {
-    props: {
-      contentHeight: {type: String, default: '7.5rem'},
-      resetBtnText: {type: String, default: '恢复默认'}
-    },
-    name: 'EmployeeSelectorDropdown',
-    data () {
-      return {
-        employee_list: [],
-        selected: {employee: [], dept: []},
-        loading: false,
-        deptData: null,
-        rightDepartData: null,
-        selectedDeptStack: null,
-        selectedLeftDeptId: null,
-        selectedLeftDeptItem: null,
-        selectedRightDeptId: null,
-        selectedRightDeptItem: null,
-      }
-    },
-    components: {ListEmptyDataCell, EmployeeSelectorNoMark},
-    computed: {
-      contentStyle () {
-        return {height: this.contentHeight}
-      }
-    },
-    methods: {
-      onselectedLeftDepart (deptItem) {
-        this.selectedLeftDeptId = deptItem.id
-        this.selectedLeftDeptItem = deptItem
-        this.selectedRightDeptId = deptItem.id
-        this.selectedRightDeptItem = deptItem
-        this.selectedDeptStack = [deptItem]
-        this.rightDepartData = [].concat(deptItem, this.deptData.filter(o => o.pid === deptItem.id))
-        this.$emit('onchange', deptItem)
-      },
-      onselectedRightDepart (deptItem) {
-        if (deptItem.id === this.selectedRightDeptId) {
-          return
-        }
-        this.selectedRightDeptId = deptItem.id
-        this.selectedRightDeptItem = deptItem
-        this.selectedDeptStack.push(deptItem)
-        this.rightDepartData = [].concat(deptItem, this.deptData.filter(o => o.pid === deptItem.id))
-        this.$emit('onchange', deptItem)
-      },
-      onResetDepart () {
-        this.selected = {employee: [], dept: []}
-        this.employee_list = []
-      },
-      onConfirmDepart () {
-        this.$emit('onConfirm', this.selectedRightDeptItem)
-      },
-      getDepartData () {
-
-      },
-      restoreDefaults () {
-        this.selectedLeftDeptId = null
-        this.selectedLeftDeptItem = null
-        this.selectedRightDeptId = null
-        this.selectedRightDeptItem = null
-        this.selectedDeptStack = null
-        this.rightDepartData = null
-      },
-      confirm(data){
-        this.selectedRightDeptItem = data
-      }
-    },
-    mounted () {
-      this.getDepartData()
-    }
-  }
-</script>
-
-<style scoped lang="less">
-  .dept-select-drodown__wrap {
-    position: relative;
-    overflow: hidden;
-  }
-
-  .select-dropdown__content {
-    position: relative;
-  }
-
-  .employee_cell {
-    padding: 0.16rem 0.32rem;
-    touch-action: none;
-  }
-
-  .employee_cell .van-cell__title {
-    line-height: 0.8rem;
-
-    & > span {
-      font-size: 0.3rem;
-    }
-  }
-
-  .dept_path a {
-    color: #238dfa;
-    font-size: 0.3rem;
-  }
-
-  .dept_path a:nth-last-child(1) {
-    color: #999;
-  }
-
-  .dept_path a * {
-    vertical-align: middle;
-  }
-
-  .dept_path {
-    position: relative;
-    display: flex;
-    height: 0.8rem;
-    font-size: 0.32rem;
-    padding: 0 0.32rem;
-    align-items: center;
-    touch-action: none;
-    overflow-x: scroll;
-  }
-
-  .dept_path:after {
-    content: ' ';
-    bottom: 0;
-    left: 0;
-    right: 0;
-    background-color: #efefef;
-    height: 1px;
-    position: absolute;
-    transform: scaleY(0.5);
-  }
-
-  .selector-left {
-    width: 2.2rem !important;
-    background-color: #f5f5f5;
-  }
-
-  .selector-left .van-cell {
-    background-color: #f5f5f5;
-  }
-
-  .selector-left .employee_cell {
-    padding-left: 0.32rem;
-  }
-
-  .selector-left .employee_cell.on {
-    position: relative;
-
-    &:before {
-      position: absolute;
-      top: 50%;
-      left: 0.08rem;
-      content: '';
-      width: 0.04rem;
-      height: 0.36rem;
-      background: #26a2ff;
-      border-radius: 0.04rem;
-      transform: translateY(-50%);
-    }
-  }
-
-  /deep/ .selector-left .van-cell:not(:last-child):after {
-    left: 0;
-  }
-
-  .selector-right {
-    background-color: #fff;
-  }
-
-  .van-cell {
-    &.on {
-      color: #238dfa;
-
-      & .van-cell__title > span {
-        font-size: 0.3rem;
-      }
-    }
-
-    & .van-cell__title > span {
-      font-size: 0.3rem;
-    }
-
-    & .van-icon-success {
-      align-self: center;
-    }
-  }
-
-  .date-picker__toolbar {
-    display: flex;
-    flex-direction: row;
-    position: relative;
-    z-index: 22;
-    background-color: #fff;
-    & .reset-button {
-      touch-action: none;
-      color: #26a2ff !important;
-      border: transparent !important;
-    }
-  }
-  .employee_list_box{padding:0.32rem;}
-</style>
-

+ 0 - 718
src/components/common/EmployeeSelectorNoMark.vue

@@ -1,718 +0,0 @@
-<template>
-  <div style="height: 100%;">
-    <van-search v-model="keyword" placeholder="请输入姓名搜索" />
-    <div class="body_com" :class="{show_dept_path:pid_list_arr.length > 0}">
-      <scroller :on-refresh="get_user_list" ref="scroller_com">
-        <!-- can_select_dept  选择部门传值 -->
-        <van-cell
-          :is-link="!can_select_dept"
-          v-for="(item,index) in dept_list"
-          :key="index"
-          :title="item.name"
-          v-show="item.pid == pid && item.name.indexOf(keyword) >= 0 && dept_not_select.indexOf(item.id) < 0"
-          class="employee_cell"
-          @click="select_dept(item)"
-        >
-        
-          <template slot="icon">
-            <van-checkbox v-if="can_select_dept" v-model="item.checked"></van-checkbox>
-            <img v-if="can_select_dept" src="static/images/e66f.jpg" class="employee_cell_head_img" />
-            <!-- <userImage :id="item.id" width="0.8rem" height="0.8rem" ></userImage> -->
-          </template>
-          <template slot="right-icon" v-if="can_select_dept&&item.count>0">
-            <a href="javascript:void(0);" class="child_btn" @click.stop="show_child(item)">| 下级</a>
-          </template>
-        </van-cell>
-        <div v-for="(item,index) in list" :key="index" v-if="can_select_employee" v-show="item.name.indexOf(keyword) >= 0">
-          <div
-            v-if="index == 0"
-            :data-pageindex="item.letter_index"
-            class="pageIndexBtn"
-          >{{item.letter_index}}</div>
-          <div
-            v-if="index > 0 && list[index-1].letter_index != item.letter_index"
-            :data-pageindex="item.letter_index"
-            class="pageIndexBtn"
-          >{{item.letter_index}}</div>
-          <van-cell
-            :class="{'letter-first': index == 0 || (index > 0 && list[index-1].letter_index != item.letter_index)}"
-            v-if="can_select_employee"
-            :title="item.name"
-            class="employee_cell"
-            @click="select_employee(item)"
-          >
-            <template slot="icon">
-              <van-checkbox
-                :style="{opacity: employee_not_select.indexOf(item.id) < 0 ? 1 :0}"
-                v-model="item.checked"
-              ></van-checkbox>
-              <userImage
-                class="employee_cell_head_img"
-                :img_url ="item.img_url"
-                :user_name="item.name"
-                width="0.8rem"
-                height="0.8rem"
-                fontSize="0.2"
-              ></userImage>
-              <!-- <img :src="item.img_url"class="employee_cell_head_img"/> -->
-            </template>
-            <template slot="right-icon" v-if="typeof(item.status) != 'undefined'">
-              <van-tag plain v-show="item.status == 0 || item.status == 2">{{item.status == 0 ?'未加入':'离职'}}</van-tag>
-            </template>
-          </van-cell>
-        </div>
-      </scroller>
-    </div>
-    <slot name="footer"></slot>
-    <div class="bottom_menu">
-      <div class="selected_box" ref="selected_box">
-        <ul :style="'width:'+selected_box_width">
-          <li v-for="(item,index) in employee_selected_list" @click.stop="employee_cancel(item)" :key="index" style="width:0.9rem; overflow: hidden; height:0.9rem;">
-            <userImage
-              :img_url ="item.img_url"
-              :user_name="item.name"
-              width="0.9rem"
-              height="0.9rem"
-              fontSize="0.2"
-            ></userImage>
-            <div class="name_mini">{{item.name}}</div>
-          </li>
-          <li v-for="(item,index) in dept_selected_list" :key="index">
-            <img @click="dept_cancel(item)" src="static/images/e66f.jpg" />
-            <div class="name_mini">{{item.dept_name}}</div>
-          </li>
-        </ul>
-      </div>
-    </div>
-  </div>
-
-</template>
-
-<script>
-import Vue from 'vue';
-import { ActionSheet, Popup, Checkbox, Tag } from 'vant';
-Vue.use(Popup).use(Tag);
-Vue.use(Checkbox);
-Vue.use(ActionSheet);
-import { Search } from 'vant';
-import userImage from '@/components/common/user_image'
-Vue.use(Search);
-import request from '@/utils/request'
-export default {
-  props: {
-    position: {
-      type: String,
-      default: 'bottom'
-    },
-    append_body: {
-      type: Boolean,
-      default: false
-    },
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    can_select_dept: {
-      type: Boolean,
-      default: true
-    },
-    can_select_employee: {
-      type: Boolean,
-      default: true
-    },
-    employee_not_select: {
-      type: Array,
-      default: () => { return [] }
-    },
-    dept_not_select: {
-      type: Array,
-      default: () => { return [] }
-    },
-    selected: {
-      type: Object,
-      default: () => {
-        return { employee: [], dept: [] }
-      }
-    },
-    multi: {
-      type: Boolean,
-      default: true
-    },
-    dept_multi: {
-      type: Boolean,
-      default: true
-    },
-    employee_list: {
-      type: Array,
-      default: null
-    },
-    use_employee_list: {
-      type: Boolean,
-      default: false
-    },
-    close_clear_data: {
-      type: Boolean,
-      default: true
-    },
-    max: {
-      type: Number,
-      default: 0
-    },
-    include_self:{
-      type: Boolean,
-      default: true
-    },
-    show_manager_only:{
-      type: Boolean,
-      default: false
-    },
-    title:{
-      type: String,
-      default: ''
-    },
-  },
-  name: "EmployeeSelectorNoMark",
-  components: { userImage },
-  data() {
-    let selected = JSON.parse(JSON.stringify(this.selected))
-    return {
-      employee_selected_list: selected.employee,
-      dept_selected_list: selected.dept,
-      employee_selected: [],
-      dept_selected: [],
-      com_height: '100%',
-      company_info: {},
-      actions_show: false,
-      dept_name: '',
-      dept_id: 0,
-      list: [],
-      dept_list: [],
-      keyword: '',
-      owner_id: 0,
-      user_info: this.$store.getters.user_info,
-      pid: 0,
-      pid_list: [],
-      selected_box_width: '0',
-      pid_list_arr: [],
-      visible_: false,
-      cache_list: []
-    }
-  },
-  watch: {
-    max(val) {
-      this.set_button_width()
-    },
-    selected(val) {
-      let selected = JSON.parse(JSON.stringify(val))
-      this.employee_selected = []
-      this.dept_selected = []
-      this.employee_selected_list = selected.employee
-      this.dept_selected_list = selected.dept
-      for (let i in selected.employee) {
-        this.employee_selected.push(selected.employee[i].id)
-      }
-      for (let i in selected.dept) {
-        this.dept_selected.push(selected.dept[i].dept_id)
-      }
-      for(let i in this.list){
-        this.list[i]['checked'] = false
-        if (this.employee_selected.indexOf(this.list[i].id) >= 0) {
-          this.list[i]['checked'] = true
-        }
-      }
-
-      this.set_button_width()
-    },
-    visible(val) {
-      this.visible_ = JSON.parse(JSON.stringify(val))
-      if (val) {
-        setTimeout(() => {
-          if (this.$route.query.pid) {
-            this.pid = this.$route.query.pid
-          }
-          this.get_user_list(function () {
-
-          })
-          this.get_dept_list()
-        }, 200)
-      }
-      this.set_button_width()
-    },
-    employee_selected_list() {
-      let l = this.employee_selected_list.length + this.dept_selected_list.length
-      let width = 0.9 * l;
-      this.selected_box_width = width + 'rem'
-      this.set_button_width()
-    },
-    dept_selected_list() {
-      let l = this.employee_selected_list.length + this.dept_selected_list.length
-      let width = 0.9 * l;
-      this.selected_box_width = width + 'rem'
-      this.set_button_width()
-    },
-    keyword() {
-      this.get_user_list(function () {
-
-      })
-    }
-  },
-  beforeDestroy() {
-    if (this.append_body) {
-      document.body.removeChild(this.$el)
-    }
-    this.close();
-  },
-  methods: {
-    set_button_width() {
-
-    },
-    back() {
-      this.pid = this.pid_list[this.pid_list.length - 1]
-      this.pid_list.splice(this.pid_list.length - 1)
-      this.pid_list_arr.splice(this.pid_list_arr.length - 1)
-      this.get_user_list(function () {
-
-      })
-    },
-    back_by_index(index) {
-
-      if (index == this.pid_list.length) {
-        return false
-      }
-      this.pid = this.pid_list[index]
-      this.pid_list.splice(index, 100)
-      this.pid_list_arr.splice(index, 100)
-      this.get_user_list(function () {
-
-      })
-    },
-    show_child(item) {
-      this.pid_list.push(this.pid)
-      this.pid_list_arr.push(item)
-      this.pid = item.id
-      this.list = []
-      this.get_user_list(function () {
-
-      })
-    },
-    employee_cancel(item) {
-      this.employee_selected.splice(this.employee_selected.indexOf(item.id), 1)
-      let delete_index = -1
-      for (let i in this.employee_selected_list) {
-        if (this.employee_selected.indexOf(this.employee_selected_list[i].id) < 0) {
-          delete_index = i
-        }
-      }
-      if (delete_index >= 0) {
-        this.employee_selected_list.splice(delete_index, 1)
-        for (let i in this.list) {
-          if (this.list[i].id == item.id) {
-            this.$set(this.list[i], 'checked', false)
-          }
-        }
-      }
-      this.$emit('confirm', {
-        employee: this.employee_selected_list,
-        dept: this.dept_selected_list
-      })
-    },
-    dept_cancel(item) {
-      this.dept_selected.splice(this.dept_selected.indexOf(item.id), 1)
-      let delete_index = -1
-      for (let i in this.dept_selected_list) {
-        if (this.dept_selected.indexOf(this.dept_selected_list[i].id) < 0) {
-          delete_index = i
-        }
-      }
-      if (delete_index >= 0) {
-        this.dept_selected_list.splice(delete_index, 1)
-        for (let i in this.dept_list) {
-          if (this.dept_list[i].dept_id == item.id) {
-            this.$set(this.dept_list[i], 'checked', false)
-          }
-        }
-      }
-    },
-    select_employee(item) {
-      if (this.employee_not_select.indexOf(item.id) >= 0) {
-        return false
-      }
-      if (item.checked) {
-        item.checked = false
-        this.employee_cancel(item)
-      } else {
-        if (!this.multi) {
-          this.employee_selected = []
-          this.employee_selected_list = []
-          for (let i in this.list) {
-            this.$set(this.list[i], 'checked', false)
-          }
-        }
-        if (this.max > 0 && this.employee_selected.length == this.max && this.multi) {
-          this.$toast('最多只能选择' + this.max + '人')
-          return false
-        }
-        this.employee_selected.push(item.id)
-        this.employee_selected_list.push({ id: item.id, name: item.name, img_url: item.img_url })
-        item.checked = true
-      }
-      this.$emit('confirm', {
-        employee: this.employee_selected_list,
-        dept: this.dept_selected_list
-      })
-    },
-    select_dept(item) {
-      if (!this.can_select_dept) {
-        this.show_child(item)
-        return false
-      }
-      if (item.checked) {
-        item.checked = false
-        this.dept_cancel(item)
-      } else {
-        if (!this.dept_multi) {
-          this.dept_selected = []
-          this.dept_selected_list = []
-          for (let i in this.dept_list) {
-            this.$set(this.dept_list[i], 'checked', false)
-          }
-        }
-        this.dept_selected.push(item.id)
-        this.dept_selected_list.push({ dept_id: item.id, dept_name: item.name, avatar: 'static/images/e66f.jpg' })
-        item.checked = true
-      }
-    },
-    close() {
-      //this.visible = false
-      this.$emit('update:visible', false)
-      this.$emit('cancel')
-      if (this.close_clear_data) {
-        this.employee_selected = []
-        this.employee_selected_list = []
-        this.dept_selected = []
-        this.dept_selected_list = []
-        for (let i in this.list) {
-          this.$set(this.list[i], 'checked', false)
-        }
-        for (let i in this.dept_list) {
-          this.$set(this.dept_list[i], 'checked', false)
-        }
-      }
-
-    },
-    confirm() {
-      this.$emit('confirm', {
-        employee: this.employee_selected_list,
-        dept: this.dept_selected_list
-      })
-      this.close()
-    },
-    get_dept_list() {
-      if (this.use_employee_list || this.show_manager_only) {
-        return
-      }
-      request('get','/api/department/index',{ pid: this.pid, keyword: this.keyword }).then((res) => {
-        for (let i in res.data.data.list) {
-          res.data.data.list[i]['checked'] = false
-          if (this.dept_selected.indexOf(res.data.data.list[i].id) >= 0) {
-            res.data.data.list[i]['checked'] = true
-          }
-        }
-        this.dept_list = res.data.data.list
-        this.owner_id = res.data.data.owner_id
-        this.company_info = res.data.data.company_info
-        if (res.data.data.dept_info == null) {
-          this.dept_name = JSON.parse(JSON.stringify(res.data.data.company_info.name))
-          this.dept_id = 0
-        } else {
-          this.dept_name = JSON.parse(JSON.stringify(res.data.data.dept_info.name))
-          this.dept_id = res.data.data.dept_info.id
-        }
-        this.$toast.clear()
-      }).catch((e) => {
-        this.$toast.clear()
-      })
-    },
-    parse_list(data) {
-      this.list = []
-      let _list = []
-      for (let i in data) {
-        data[i]['checked'] = false
-        if (this.employee_selected.indexOf(data[i].id) >= 0) {
-          data[i]['checked'] = true
-        }
-        if (data[i].img_url == '') {
-          data[i].img_url = ''
-        }
-      }
-
-      this.list = data
-      this.$nextTick(() => {
-        if (this.visible && this.can_select_employee) {
-          this.$refs['scroller_com'].createPageIndex()
-        }
-      })
-    },
-    get_user_list(done) {
-      if (this.use_employee_list) {
-        let list = this.employee_list
-        for (let i in list) {
-          list[i]['letter_index'] = '#'
-          if (this.$store.getters.employee_map[list[i].id]) {
-            list[i]['letter_index'] = this.$store.getters.employee_map[list[i].id].letter_index
-            if (this.$store.getters.employee_map[list[i].id].img_url == '') {
-              list[i]['img_url'] = 'static/images/defalut_custmer_headicon.png'
-            } else {
-              list[i]['img_url'] = this.$store.getters.employee_map[list[i].id].img_url
-            }
-            list[i]['status'] = this.$store.getters.employee_map[list[i].id].status
-          }
-
-          list[i]['checked'] = false
-          if (this.employee_selected.indexOf(list[i].id) >= 0) {
-            list[i]['checked'] = true
-          }
-
-        }
-        this.list = list.sort((a, b) => {
-          return a.letter_index.charCodeAt(0) - b.letter_index.charCodeAt(0)
-        })
-        done()
-        this.$nextTick(() => {
-          if (this.visible && this.can_select_employee) {
-            this.$refs['scroller_com'].createPageIndex()
-          }
-        })
-
-        this.removeSelf(list)
-        this.dept_list = []
-        return false
-      }
-      if (this.cache_list[this.pid]) {
-        this.parse_list(this.cache_list[this.pid])
-        done()
-      }
-
-      if (this.loadingUserList){
-         return
-      }
-
-      this.loadingUserList = true
-      request('get','/api/employee/list',{ dept_id: this.pid, keywords: this.keyword, page: 0, page_size: 2000 }).then((res) => {
-        let _list = []
-        if(this.show_manager_only){
-          //把其它无关的人干掉
-          for(let i in res.data.data.list){
-            let is_manager = false
-            for(let j in res.data.data.list[i].role_list){
-              if(res.data.data.list[i].role_list[j].name == 'creator' || res.data.data.list[i].role_list[j].name == 'point_manager' || res.data.data.list[i].role_list[j].name == 'dept_manager' || res.data.data.list[i].role_list[j].name == 'admin'){
-                is_manager = true
-              }
-            }
-            if(is_manager){
-              _list.push(res.data.data.list[i])
-            }
-          }
-        }else{
-          _list = res.data.data.list
-        }
-        const list = _list
-
-        this.cache_list[this.pid] = this.removeSelf(list)
-        this.parse_list(list)
-        done()
-        this.$toast.clear()
-      }).catch((e) => {
-        done()
-        this.$toast.clear()
-      }).finally(()=>this.loadingUserList = false)
-    },
-    removeSelf(list){
-      if (!this.include_self){
-        const currUserId = this.$store.getters.user_info.id
-        const index = list.findIndex(o=>o.id === currUserId)
-        if(index > -1){
-          list.splice(index, 1)
-        }
-      }
-      return list
-    }
-  },
-  created() {
-    if (document.documentElement.style.height) {
-      this.com_height = document.documentElement.style.height
-    }
-    this.pid = this.$route.query.pid || 0
-  }
-}
-</script>
-
-<style scoped>
-.body_com {
-  height: calc(100% - 2rem);
-  position: relative;
-}
-.body_com.show_dept_path {
-  height: calc(100% - 3.48rem);
-}
-.bottom_menu {
-  height: 0.8rem;
-  text-align: center;
-  line-height: 0.8rem;
-  position: relative;
-  display: table;
-}
-.bottom_menu:before {
-  content: ' ';
-  height: 1px; /*no*/
-  background-color: #eee;
-  width: 100%;
-  top: 0;
-  left: 0;
-  position: absolute;
-}
-.bottom_menu a {
-  color: #1989fa;
-  font-size: 0.32rem;
-}
-
-.employee_cell_head_img {
-  width: 0.8rem;
-  height: 0.8rem;
-  margin-left: 0.16rem;
-  -webkit-border-radius: 0.1rem;
-  -moz-border-radius: 0.1rem;
-  border-radius: 0.1rem;
-  margin-right: 0.15rem;
-}
-
-.employee_cell {
-  padding: 0.16rem 0.32rem;
-}
-.employee_cell .van-checkbox {
-  overflow: visible;
-}
-.employee_cell .van-cell__title {
-  line-height: 0.8rem;
-}
-.employee_cell .van-cell__right-icon {
-  margin-top: 0.2rem;
-}
-.employee_cell .van-icon {
-  color: #999;
-  margin-top: 0.2rem;
-}
-
-.employee_selector_popup {
-  height: 100%;
-}
-.child_btn {
-  color: #1989fa;
-  display: block;
-  height: 1.14rem;
-  position: absolute;
-  right: 0.32rem;
-  top: 0;
-  padding: 0 0.16rem;
-  line-height: 1.1rem;
-  font-size: 0.28rem;
-}
-.child_btn:active {
-  color: #323233;
-}
-.bottom_menu {
-  width: 100%;
-  height: 0.9rem;
-}
-.selected_box,
-.selected_btn {
-  vertical-align: top;
-  text-align: left;
-}
-.selected_btn {
-  text-align: center;
-  float: right;
-}
-
-.selected_box {
-  overflow-x: scroll;
-  width: 7.5rem;
-  float: left;
-  min-height: 0.5rem;
-}
-.selected_box ul,
-.selected_box li {
-  margin: 0;
-  padding: 0;
-  text-align: left;
-}
-.selected_box li {
-  display: block;
-  text-align: left;
-  float: left;
-  position: relative;
-}
-.selected_box li img {
-  width: 0.8rem;
-  vertical-align: top;
-  height: 0.8rem;
-  padding: 0.05rem;
-  -webkit-border-radius: 0.1rem;
-  -moz-border-radius: 0.1rem;
-  border-radius: 0.1rem;
-}
-.name_mini {
-  font-size: 0.2rem;
-  position: absolute;
-  bottom: 0.05rem;
-  left: 0.05rem;
-  right: 0.05rem;
-  padding: 0.02rem 0;
-  text-align: center;
-  background-color: rgba(0, 0, 0, 0.4);
-  height: 0.2rem;
-  color: #fff;
-  line-height: 0.2rem;
-}
-.dept_path a {
-  color: #238dfa;
-  font-size: 0.28rem;
-}
-.dept_path a:nth-last-child(1) {
-  color: #999;
-}
-.dept_path a * {
-  vertical-align: middle;
-}
-.dept_path {
-  height: 0.6rem;
-  position: relative;
-  font-size: 0.32rem;
-  line-height: 0.4rem;
-  overflow-x: scroll;
-  padding: 0 0.32rem;
-}
-.dept_path:after {
-  content: ' ';
-  bottom: 0;
-  left: 0;
-  right: 0;
-  background-color: #efefef;
-  height: 1px;
-  position: absolute;
-  transform: scaleY(0.5);
-}
-.pageIndexBtn {
-  width: 100%;
-  text-align: left;
-  padding: 0.1rem 0.4rem 0.05rem;
-  color: #909399;
-  background: rgb(245, 245, 245);
-  font-size: 0.24rem;
-}
-.employee_cell .van-tag{
-  display: inline-table;
-  margin-top: 0.16rem;
-}
-</style>
-

+ 1 - 3
src/components/common/RuleCategorySelector1.vue

@@ -14,7 +14,7 @@
           </van-collapse-item>
         </van-collapse>
       </scroller>
-      <scroller :on-refresh="get_category_list" style="left:2rem; right:0; width:auto;" class="selector-rightt _v-container">
+      <scroller :on-refresh="get_category_list" style="left:2rem; right:0; width:auto;" class="selector-right _v-container">
         <van-cell-group style="margin-top:0;">
         <van-cell :is-link="!can_select_category" v-for="(item,index) in category_list" :key="index" :title="item.name" v-show="pid > 0 && item.pid == pid && item.name.indexOf(keyword) >= 0 && category_not_select.indexOf(item.id) < 0" class="employee_cell" @click="select_dept(item)">
           <template slot="icon">
@@ -39,14 +39,12 @@
           <template slot="icon">
             <van-checkbox v-model="item.checked" style="margin-right:0.16rem;"></van-checkbox>
           </template>
-
         </van-cell>
         </van-cell-group>
 
         <slot name="append"></slot>
       </scroller>
       <noData v-model="list" class="nodata" ></noData>
-
     </div>
     <div class="bottom_menu" style="display: none;">
       <div class="selected_box" ref="selected_box">

+ 494 - 442
src/components/common/scroller/src/components/Scroller.vue

@@ -11,7 +11,7 @@
         @mousemove="mouseMove($event)"
         @mouseup="mouseUp($event)"
       >
-        <div class="_scroller-bar" ref="scroller_bar" :id="contentId+'_bar'" style="opacity: 0"></div>
+        <div class="_scroller-bar" ref="scroller_bar" :id="contentId + '_bar'" style="opacity: 0"></div>
         <div
           class="pageIndexBox"
           v-if="pageIndex.length > 0"
@@ -20,51 +20,32 @@
           @touchend.stop="pageIndex_touchend($event)"
         >
           <div class="pageIndexBtn" v-for="(item, index) in pageIndex" @click="go_index(item)">
-            <div class="page-index-tip">{{item.label}}</div>
-            {{item.label}}
+            <div class="page-index-tip">{{ item.label }}</div>
+            {{ item.label }}
           </div>
         </div>
         <div class="_v-content" :id="contentId" ref="scroller_content">
-          <div
-            v-if="onRefresh"
-            class="pull-to-refresh-layer"
-            :class="{'active': state == 1, 'active refreshing': state == 2}"
-          >
+          <div v-if="onRefresh" class="pull-to-refresh-layer" :class="{ active: state == 1, 'active refreshing': state == 2 }">
             <span class="spinner-holder">
               <arrow class="arrow" :fillColor="refreshLayerColor" v-if="state != 2"></arrow>
 
-              <span
-                class="text"
-                v-if="state != 2"
-                :style="{color: refreshLayerColor}"
-                v-text="refreshText"
-              ></span>
+              <span class="text" v-if="state != 2" :style="{ color: refreshLayerColor }" v-text="refreshText"></span>
 
               <span v-if="state == 2">
-                <slot name="refresh-spinner">
-                  <spinner :style="{fill: refreshLayerColor, stroke: refreshLayerColor}"></spinner>
-                </slot>
+                <slot name="refresh-spinner"><spinner :style="{ fill: refreshLayerColor, stroke: refreshLayerColor }"></spinner></slot>
               </span>
             </span>
           </div>
 
           <slot></slot>
 
-          <div v-if="showInfiniteLayer && list.length >0" class="loading-layer">
-            <span class="spinner-holder" :class="{'active': showLoading}">
-              <slot name="infinite-spinner">
-                <spinner :style="{fill: loadingLayerColor, stroke: loadingLayerColor}"></spinner>
-              </slot>
+          <div v-if="showInfiniteLayer && list.length > 0" class="loading-layer">
+            <span class="spinner-holder" :class="{ active: showLoading }">
+              <slot name="infinite-spinner"><spinner :style="{ fill: loadingLayerColor, stroke: loadingLayerColor }"></spinner></slot>
             </span>
 
-            <div
-              class="no-data-text"
-              :class="{'active': !showLoading && loadingState == 2}"
-              :style="{color: loadingLayerColor}"
-              v-text="noDataText"
-            ></div>
+            <div class="no-data-text" :class="{ active: !showLoading && loadingState == 2 }" :style="{ color: loadingLayerColor }" v-text="noDataText"></div>
           </div>
-
         </div>
       </div>
     </template>
@@ -72,21 +53,21 @@
   </div>
 </template>
 <script>
-import Scroller from '../module/core'
-import getContentRender from '../module/render'
-import Spinner from './Spinner.vue'
-import Arrow from './Arrow.vue'
+import Scroller from '../module/core';
+import getContentRender from '../module/render';
+import Spinner from './Spinner.vue';
+import Arrow from './Arrow.vue';
 
-const re = /^[\d]+(\%)?$/
+const re = /^[\d]+(\%)?$/;
 
-const widthAndHeightCoerce = (v) => {
-  if (v[v.length - 1] != '%') return v + 'px'
-  return v
-}
+const widthAndHeightCoerce = v => {
+  if (v[v.length - 1] != '%') return v + 'px';
+  return v;
+};
 
-const widthAndHeightValidator = (v) => {
-  return re.test(v)
-}
+const widthAndHeightValidator = v => {
+  return re.test(v);
+};
 
 export default {
   components: {
@@ -99,9 +80,7 @@ export default {
     onInfinite: Function,
     onScrolling: {
       type: Function,
-      default: function (e) {
-
-      }
+      default: function(e) {}
     },
     refreshText: {
       type: String,
@@ -128,7 +107,7 @@ export default {
     list: {
       type: Array,
       default: () => {
-        return []
+        return [];
       }
     },
     snapping: {
@@ -177,7 +156,7 @@ export default {
       type: Number,
       default: 0 // px
     },
-    
+
     isNeed: {
       //是否需要显示滚动组件
       type: Boolean,
@@ -186,40 +165,45 @@ export default {
   },
 
   computed: {
-    w: function () {
-      return widthAndHeightCoerce(this.width)
+    w: function() {
+      return widthAndHeightCoerce(this.width);
     },
 
-    h: function () {
-      return widthAndHeightCoerce(this.height)
+    h: function() {
+      return widthAndHeightCoerce(this.height);
     },
 
-    showInfiniteLayer () {
-      let contentHeight = 0
-      this.content
-        ? contentHeight = this.content.offsetHeight
-        : void 666
+    showInfiniteLayer() {
+      let contentHeight = 0;
+      this.content ? (contentHeight = this.content.offsetHeight) : void 666;
 
-      return this.onInfinite
-        ? contentHeight > this.minContentHeight
-        : false
+      return this.onInfinite ? contentHeight > this.minContentHeight : false;
     }
   },
 
-  data () {
+  data() {
     return {
       bar_top: 0,
-      bar_id: 'bar-' + Math.random().toString(36).substring(3, 8),
-      containerId: 'outer-' + Math.random().toString(36).substring(3, 8),
-      contentId: 'inner-' + Math.random().toString(36).substring(3, 8),
+      bar_id:
+        'bar-' +
+        Math.random()
+          .toString(36)
+          .substring(3, 8),
+      containerId:
+        'outer-' +
+        Math.random()
+          .toString(36)
+          .substring(3, 8),
+      contentId:
+        'inner-' +
+        Math.random()
+          .toString(36)
+          .substring(3, 8),
       state: 0, // 0: pull to refresh, 1: release to refresh, 2: refreshing
       loadingState: 0, // 0: stop, 1: loading, 2: stopping loading
-
       showLoading: false,
       bar_height: 0,
-
       bar_opacity: 0,
-
       bar: undefined,
       container: undefined,
       content: undefined,
@@ -236,225 +220,233 @@ export default {
       window_height: 0,
       pageIndex: [],
       last_top: 0
-    }
+    };
   },
 
-  mounted () {
-    this.$nextTick(() => {
-      this.init();
-      this.createPageIndex();
-    })
+  mounted() {
+    console.log(this.isNeed);
+    if (this.isNeed) {
+      this.$nextTick(() => {
+        this.init();
+        this.createPageIndex();
+      });
+    }
   },
-  deactivated () {
-    this.last_top = this.getPosition().top
+  deactivated() {
+    this.last_top = this.getPosition().top;
   },
-  destroyed () {
-    clearInterval(this.resizeTimer)
-    if (this.infiniteTimer) clearInterval(this.infiniteTimer)
+  destroyed() {
+    clearInterval(this.resizeTimer);
+    if (this.infiniteTimer) clearInterval(this.infiniteTimer);
   },
 
   methods: {
-	init(){
-		 let self = this
-		 this.container = document.getElementById(this.containerId)
-		 this.window_height = localStorage.getItem('window_height')
-		 this.container.style.width = this.w
-		 this.container.style.height = this.h
-		 this.bar = document.getElementById(this.bar_id)
-		 this.container_height = JSON.parse(JSON.stringify(this.h))
-		 this.container_top = JSON.parse(JSON.stringify(this.container.getBoundingClientRect().top))
-		 this.content = document.getElementById(this.contentId)
-		 if (this.cssClass) this.content.classList.add(this.cssClass)
-		 this.pullToRefreshLayer = this.content.getElementsByTagName('div')[0]
-
-		 let render = getContentRender(this.content)
-
-		 let scrollerOptions = {
-		   scrollingX: false
-		 }
-		 this.bar_height = (self.container.offsetHeight) / (self.content.offsetHeight) * (self.container.offsetHeight)
-		 this.scroller = new Scroller(render, {
-		   scrollingX: false,
-		   snapping: this.snapping,
-		   animating: this.animating,
-		   animationDuration: this.animationDuration,
-		   bouncing: this.bouncing,
-		   scrolling: function (x, y) {
-		     self.bar_height = (self.container.offsetHeight) / (self.content.offsetHeight) * (self.container.offsetHeight)
-		     if (self.bar_height < 50) {
-		       self.bar_height = 50
-		     }
-		     self.bar_opacity = 1
-		     let cp = y / (self.content.offsetHeight) * (self.container.offsetHeight)
-		     self.bar_top = cp.toString()
-		     self.onScrolling(Math.round(cp))
-		     const { scroller_bar } = self.$refs
-		     if (scroller_bar) {
-		       scroller_bar.style.transform = 'translate3d(0px, ' + self.bar_top + 'px, 0px) scale(1)'
-		       scroller_bar.style.height = self.bar_height + 'px'
-		       scroller_bar.style.opacity = self.bar_opacity
-		     }
-		     // localStorage.setItem('scroller-top-' + self.contentId, self.getPosition().top)
-
-		     if (self.onInfinite) {
-		       let {left, top, zoom} = self.scroller.getValues()
-		       // 在 keep alive 中 deactivated 的组件长宽变为 0
-		       if (self.content.offsetHeight > 0 && top + 60 > self.content.offsetHeight - self.container.clientHeight) {
-		         if (self.loadingState) return
-		         self.loadingState = 1
-		         self.showLoading = true
-		         self.onInfinite(self.finishInfinite)
-		       }
-		     }
-		   },
-		   scrollingComplete: function () {
-		     self.bar_opacity = 0
-		     const { scroller_bar } = self.$refs
-		     if (scroller_bar) {
-		       scroller_bar.style.opacity = self.bar_opacity
-		     }
-		   }
-		 })
-
-		 // enable PullToRefresh
-		 if (this.onRefresh) {
-		   this.scroller.activatePullToRefresh(60, () => {
-		     this.state = 1
-		   }, () => {
-		     this.state = 0
-		   }, () => {
-		     this.state = 2
-
-		     this.$on('$finishPullToRefresh', () => {
-		       setTimeout(() => {
-		         this.state = 0
-		         this.finishPullToRefresh()
-		       })
-		     })
-		     this.onRefresh(this.finishPullToRefresh)
-		   })
-		   this.triggerPullToRefresh()
-		 }
-
-		 // setup scroller
-		 let rect = this.container.getBoundingClientRect()
-		 this.scroller.setPosition(rect.left + this.container.clientLeft, rect.top + this.container.clientTop)
-
-		 // snapping
-		 if (this.snapping) {
-		   // console.log(this.snapWidth, this.snapHeight)
-		   this.scroller.setSnapSize(this.snapWidth, this.snapHeight)
-		 }
-
-		 // onContentResize
-		 const contentSize = () => {
-		   return {
-		     width: this.content.offsetWidth,
-		     height: this.content.offsetHeight
-		   }
-		 }
-		 const containerSize = () => {
-		   return {
-		     width: this.container.clientWidth,
-		     height: this.container.clientHeight
-		   }
-		 }
-		 let { content_width, content_height } = contentSize()
-		 let _container_size = containerSize()
-		 let no_focus_count = 0
-		 window.addEventListener('resize', () => {
-		   setTimeout(() => {
-		     // console.log( '失焦时高度:'+window.innerHeight)
-		     if (window.plus && Math.abs(this.window_height - window.innerHeight) < 5 && navigator.userAgent.indexOf('Android') > 0) {
-		       setTimeout(() => {
-		         // alert(Math.abs(this.window_height - window.innerHeight))
-		         // Math.abs(this.window_height - window.innerHeight) < 5
-
-		         if (Math.abs(this.window_height - window.innerHeight) < 0.17) {
-		           document.activeElement.blur()
-		         }
-		       }, 100)
-		     }
-		   }, 10)
-
-		   if (navigator.userAgent.indexOf('Android') > 0) {
-		     // let pos_y = this.getPosition().top
-		     document.documentElement.style.opacity = 0
-		     // self.scrollTo(0, pos_y)
-		     window.scroll(0, 0)
-		     document.documentElement.style.opacity = 1
-		   }
-		   document.documentElement.style.overflow = 'visible'
-		   document.body.style.overflow = 'visible'
-		   self.container.style.overflow = 'visible'
-
-		   self.container.style.overflow = 'hidden'
-		   document.documentElement.style.overflow = 'hidden'
-		   document.body.style.overflow = 'hidden'
-		   document.activeElement.classList.remove('cur_focus')
-		   if (document.activeElement && document.activeElement.type == 'textarea') {
-		     // 此处ios环境下,在textarea中输入内容,自动上滚之后,再点击input就全部内容都上滚了,看起来像是原生的滚动,不知道是怎么回事
-		     document.activeElement.addEventListener('input', function () {
-		       let getInputPositon = self.getInputPositon(document.activeElement) + document.activeElement.getBoundingClientRect().top
-		       if (getInputPositon > self.container.clientHeight) {
-		         self.scrollBy(0, 30, true)
-		       }
-		     })
-		   }
-		   if (this.window_height > containerSize().height) {
-		     let { width, height } = contentSize()
-		     this.resize(content_height, height)
-		   }
-		 }, false)
-
-		 this.resizeTimer = setInterval(() => {
-		   // let {width, height} = contentSize()
-		   let contentSize_obj = contentSize()
-		   if (contentSize_obj.width !== content_width || contentSize_obj.height !== content_height) {
-		     let old_height = content_height
-		     content_width = contentSize_obj.width
-		     content_height = contentSize_obj.height
-		     this.resize(old_height, contentSize_obj.height)
-		     if (this.last_top != 0) {
-		       this.scrollTo(0, this.last_top)
-		     }
-		   }
-		 }, 10)
-	},
-    pageIndex_touchstart (e) {
-
-    },
-    pageIndex_touchend (e) {
-      let index_tip = document.querySelectorAll('.pageIndexBtn')
+    init() {
+      let self = this;
+      this.container = document.getElementById(this.containerId);
+      this.window_height = localStorage.getItem('window_height');
+      this.container.style.width = this.w;
+      this.container.style.height = this.h;
+      this.bar = document.getElementById(this.bar_id);
+      this.container_height = JSON.parse(JSON.stringify(this.h));
+      this.container_top = JSON.parse(JSON.stringify(this.container.getBoundingClientRect().top));
+      this.content = document.getElementById(this.contentId);
+      if (this.cssClass) this.content.classList.add(this.cssClass);
+      this.pullToRefreshLayer = this.content.getElementsByTagName('div')[0];
+      let render = getContentRender(this.content);
+      let scrollerOptions = {
+        scrollingX: false
+      };
+      this.bar_height = (self.container.offsetHeight / self.content.offsetHeight) * self.container.offsetHeight;
+      this.scroller = new Scroller(render, {
+        scrollingX: false,
+        snapping: this.snapping,
+        animating: this.animating,
+        animationDuration: this.animationDuration,
+        bouncing: this.bouncing,
+        scrolling: function(x, y) {
+          self.bar_height = (self.container.offsetHeight / self.content.offsetHeight) * self.container.offsetHeight;
+          if (self.bar_height < 50) {
+            self.bar_height = 50;
+          }
+          self.bar_opacity = 1;
+          let cp = (y / self.content.offsetHeight) * self.container.offsetHeight;
+          self.bar_top = cp.toString();
+          self.onScrolling(Math.round(cp));
+          const { scroller_bar } = self.$refs;
+          if (scroller_bar) {
+            scroller_bar.style.transform = 'translate3d(0px, ' + self.bar_top + 'px, 0px) scale(1)';
+            scroller_bar.style.height = self.bar_height + 'px';
+            scroller_bar.style.opacity = self.bar_opacity;
+          }
+          // localStorage.setItem('scroller-top-' + self.contentId, self.getPosition().top)
+
+          if (self.onInfinite) {
+            let { left, top, zoom } = self.scroller.getValues();
+            // 在 keep alive 中 deactivated 的组件长宽变为 0
+            if (self.content.offsetHeight > 0 && top + 60 > self.content.offsetHeight - self.container.clientHeight) {
+              if (self.loadingState) return;
+              self.loadingState = 1;
+              self.showLoading = true;
+              self.onInfinite(self.finishInfinite);
+            }
+          }
+        },
+        scrollingComplete: function() {
+          self.bar_opacity = 0;
+          const { scroller_bar } = self.$refs;
+          if (scroller_bar) {
+            scroller_bar.style.opacity = self.bar_opacity;
+          }
+        }
+      });
+
+      // enable PullToRefresh
+      if (this.onRefresh) {
+        this.scroller.activatePullToRefresh(
+          60,
+          () => {
+            this.state = 1;
+          },
+          () => {
+            this.state = 0;
+          },
+          () => {
+            this.state = 2;
+
+            this.$on('$finishPullToRefresh', () => {
+              setTimeout(() => {
+                this.state = 0;
+                this.finishPullToRefresh();
+              });
+            });
+            this.onRefresh(this.finishPullToRefresh);
+          }
+        );
+        this.triggerPullToRefresh();
+      }
+
+      // setup scroller
+      let rect = this.container.getBoundingClientRect();
+      this.scroller.setPosition(rect.left + this.container.clientLeft, rect.top + this.container.clientTop);
+
+      // snapping
+      if (this.snapping) {
+        // console.log(this.snapWidth, this.snapHeight)
+        this.scroller.setSnapSize(this.snapWidth, this.snapHeight);
+      }
+
+      // onContentResize
+      const contentSize = () => {
+        return {
+          width: this.content.offsetWidth,
+          height: this.content.offsetHeight
+        };
+      };
+      const containerSize = () => {
+        return {
+          width: this.container.clientWidth,
+          height: this.container.clientHeight
+        };
+      };
+      let { content_width, content_height } = contentSize();
+      let _container_size = containerSize();
+      let no_focus_count = 0;
+      window.addEventListener(
+        'resize',
+        () => {
+          setTimeout(() => {
+            // console.log( '失焦时高度:'+window.innerHeight)
+            if (window.plus && Math.abs(this.window_height - window.innerHeight) < 5 && navigator.userAgent.indexOf('Android') > 0) {
+              setTimeout(() => {
+                // alert(Math.abs(this.window_height - window.innerHeight))
+                // Math.abs(this.window_height - window.innerHeight) < 5
+
+                if (Math.abs(this.window_height - window.innerHeight) < 0.17) {
+                  document.activeElement.blur();
+                }
+              }, 100);
+            }
+          }, 10);
+
+          if (navigator.userAgent.indexOf('Android') > 0) {
+            // let pos_y = this.getPosition().top
+            document.documentElement.style.opacity = 0;
+            // self.scrollTo(0, pos_y)
+            window.scroll(0, 0);
+            document.documentElement.style.opacity = 1;
+          }
+          document.documentElement.style.overflow = 'visible';
+          document.body.style.overflow = 'visible';
+          self.container.style.overflow = 'visible';
+
+          self.container.style.overflow = 'hidden';
+          document.documentElement.style.overflow = 'hidden';
+          document.body.style.overflow = 'hidden';
+          document.activeElement.classList.remove('cur_focus');
+          if (document.activeElement && document.activeElement.type == 'textarea') {
+            // 此处ios环境下,在textarea中输入内容,自动上滚之后,再点击input就全部内容都上滚了,看起来像是原生的滚动,不知道是怎么回事
+            document.activeElement.addEventListener('input', function() {
+              let getInputPositon = self.getInputPositon(document.activeElement) + document.activeElement.getBoundingClientRect().top;
+              if (getInputPositon > self.container.clientHeight) {
+                self.scrollBy(0, 30, true);
+              }
+            });
+          }
+          if (this.window_height > containerSize().height) {
+            let { width, height } = contentSize();
+            this.resize(content_height, height);
+          }
+        },
+        false
+      );
+
+      this.resizeTimer = setInterval(() => {
+        // let {width, height} = contentSize()
+        let contentSize_obj = contentSize();
+        if (contentSize_obj.width !== content_width || contentSize_obj.height !== content_height) {
+          let old_height = content_height;
+          content_width = contentSize_obj.width;
+          content_height = contentSize_obj.height;
+          this.resize(old_height, contentSize_obj.height);
+          if (this.last_top != 0) {
+            this.scrollTo(0, this.last_top);
+          }
+        }
+      }, 10);
+    },
+    pageIndex_touchstart(e) {},
+    pageIndex_touchend(e) {
+      let index_tip = document.querySelectorAll('.pageIndexBtn');
       for (let i in index_tip) {
-        index_tip.item(i).classList.remove('cur')
+        index_tip.item(i).classList.remove('cur');
       }
     },
-    pageIndex_touchmove (e) {
-      let touch = e.changedTouches[0]
-      let point = document.elementFromPoint(touch.clientX, touch.clientY)
-      let index_tip = document.querySelectorAll('.pageIndexBtn')
+    pageIndex_touchmove(e) {
+      let touch = e.changedTouches[0];
+      let point = document.elementFromPoint(touch.clientX, touch.clientY);
+      let index_tip = document.querySelectorAll('.pageIndexBtn');
       for (let i in index_tip) {
-        index_tip.item(i).classList.remove('cur')
+        index_tip.item(i).classList.remove('cur');
       }
-      point.classList.add('cur')
-      let list = document.querySelectorAll('[data-pageindex]')
+      point.classList.add('cur');
+      let list = document.querySelectorAll('[data-pageindex]');
       for (let i = 0; i < list.length; i++) {
         if (this.$refs['scroller_content'].contains(list.item(i)) && list.item(i).getAttribute('data-pageindex') == point.innerText.split('')[0]) {
-          this.go_index({ label: point.innerText, element: list.item(i) })
+          this.go_index({ label: point.innerText, element: list.item(i) });
         }
       }
     },
-    go_index (item) {
-      let activeElementClientTop = item.element.getBoundingClientRect().top
-      this.scrollBy(0, activeElementClientTop - this.container.getBoundingClientRect().top)
+    go_index(item) {
+      let activeElementClientTop = item.element.getBoundingClientRect().top;
+      this.scrollBy(0, activeElementClientTop - this.container.getBoundingClientRect().top);
     },
-    createPageIndex () {
-      let list = document.querySelectorAll('[data-pageindex]')
-      this.pageIndex = []
+    createPageIndex() {
+      let list = document.querySelectorAll('[data-pageindex]');
+      this.pageIndex = [];
       for (let i = 0; i < list.length; i++) {
         if (this.$refs['scroller_content'].contains(list.item(i))) {
-          this.pageIndex.push({ label: list.item(i).getAttribute('data-pageindex'), element: list.item(i) })
+          this.pageIndex.push({ label: list.item(i).getAttribute('data-pageindex'), element: list.item(i) });
         }
       }
     },
@@ -463,290 +455,350 @@ export default {
      * @param		{HTMLElement}	输入框元素
      * @return		{Object}		返回left和top,bottom
      */
-    getInputPositon: function (elem) {
-      var that = this
-      var cloneDiv = '{$clone_div}', cloneLeft = '{$cloneLeft}', cloneFocus = '{$cloneFocus}', cloneRight = '{$cloneRight}'
-      var none = '<span style="white-space:pre-wrap;"> </span>'
-      var div = elem[cloneDiv] || document.createElement('div'), focus = elem[cloneFocus] || document.createElement('span')
-      var text = elem[cloneLeft] || document.createElement('span')
-      var offset = that._offset(elem), index = this._getFocus(elem), focusOffset = { left: 0, top: 0 }
+    getInputPositon: function(elem) {
+      var that = this;
+      var cloneDiv = '{$clone_div}',
+        cloneLeft = '{$cloneLeft}',
+        cloneFocus = '{$cloneFocus}',
+        cloneRight = '{$cloneRight}';
+      var none = '<span style="white-space:pre-wrap;"> </span>';
+      var div = elem[cloneDiv] || document.createElement('div'),
+        focus = elem[cloneFocus] || document.createElement('span');
+      var text = elem[cloneLeft] || document.createElement('span');
+      var offset = that._offset(elem),
+        index = this._getFocus(elem),
+        focusOffset = { left: 0, top: 0 };
 
       if (!elem[cloneDiv]) {
-        elem[cloneDiv] = div, elem[cloneFocus] = focus
-        elem[cloneLeft] = text
-        div.appendChild(text)
-        div.appendChild(focus)
-        document.body.appendChild(div)
-        focus.innerHTML = '|'
-        focus.style.cssText = 'display:inline-block;width:0px;overflow:hidden;z-index:-100;word-wrap:break-word;word-break:break-all;'
-        div.className = this._cloneStyle(elem)
-        div.style.cssText = 'visibility:hidden;display:inline-block;position:absolute;z-index:-100;word-wrap:break-word;word-break:break-all;overflow:hidden;'
-      };
-      div.style.top = '-10000000px'
-      var strTmp = elem.value.substring(0, index).replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br/>').replace(/\s/g, none)
-      text.innerHTML = strTmp
-
-      focus.style.display = 'inline-block'
-      try { focusOffset = this._offset(focus) } catch (e) { };
-      focus.style.display = 'none'
-      return text.offsetHeight
+        (elem[cloneDiv] = div), (elem[cloneFocus] = focus);
+        elem[cloneLeft] = text;
+        div.appendChild(text);
+        div.appendChild(focus);
+        document.body.appendChild(div);
+        focus.innerHTML = '|';
+        focus.style.cssText = 'display:inline-block;width:0px;overflow:hidden;z-index:-100;word-wrap:break-word;word-break:break-all;';
+        div.className = this._cloneStyle(elem);
+        div.style.cssText = 'visibility:hidden;display:inline-block;position:absolute;z-index:-100;word-wrap:break-word;word-break:break-all;overflow:hidden;';
+      }
+      div.style.top = '-10000000px';
+      var strTmp = elem.value
+        .substring(0, index)
+        .replace(/</g, '<')
+        .replace(/>/g, '>')
+        .replace(/\n/g, '<br/>')
+        .replace(/\s/g, none);
+      text.innerHTML = strTmp;
+
+      focus.style.display = 'inline-block';
+      try {
+        focusOffset = this._offset(focus);
+      } catch (e) {}
+      focus.style.display = 'none';
+      return text.offsetHeight;
     },
 
     // 克隆元素样式并返回类
-    _cloneStyle: function (elem, cache) {
-      if (!cache && elem['${cloneName}']) return elem['${cloneName}']
-      var className, name, rstyle = /^(number|string)$/
-      var rname = /^(content|outline|outlineWidth)$/ // Opera: content; IE8:outline && outlineWidth
-      var cssText = [], sStyle = elem.style
+    _cloneStyle: function(elem, cache) {
+      if (!cache && elem['${cloneName}']) return elem['${cloneName}'];
+      var className,
+        name,
+        rstyle = /^(number|string)$/;
+      var rname = /^(content|outline|outlineWidth)$/; // Opera: content; IE8:outline && outlineWidth
+      var cssText = [],
+        sStyle = elem.style;
 
       for (name in sStyle) {
         if (!rname.test(name)) {
-          var val = this._getStyle(elem, name)
-          if (val !== '' && rstyle.test(typeof val)) { // Firefox 4
-            name = name.replace(/([A-Z])/g, '-$1').toLowerCase()
-            cssText.push(name)
-            cssText.push(':')
-            cssText.push(val)
-            cssText.push(';')
-          };
-        };
-      };
-      cssText = cssText.join('')
-      elem['${cloneName}'] = className = 'clone' + (new Date()).getTime()
-      this._addHeadStyle('.' + className + '{' + cssText + '}')
-      return className
+          var val = this._getStyle(elem, name);
+          if (val !== '' && rstyle.test(typeof val)) {
+            // Firefox 4
+            name = name.replace(/([A-Z])/g, '-$1').toLowerCase();
+            cssText.push(name);
+            cssText.push(':');
+            cssText.push(val);
+            cssText.push(';');
+          }
+        }
+      }
+      cssText = cssText.join('');
+      elem['${cloneName}'] = className = 'clone' + new Date().getTime();
+      this._addHeadStyle('.' + className + '{' + cssText + '}');
+      return className;
     },
 
     // 向页头插入样式
-    _addHeadStyle: function (content) {
-      var style = this.focus_style[document]
+    _addHeadStyle: function(content) {
+      var style = this.focus_style[document];
       if (!style) {
-        style = this.focus_style[document] = document.createElement('style')
-        style.id = 'temp_style'
-        document.getElementsByTagName('head')[0].appendChild(style)
-      };
-      style.styleSheet && (style.styleSheet.cssText += content) || style.appendChild(document.createTextNode(content))
+        style = this.focus_style[document] = document.createElement('style');
+        style.id = 'temp_style';
+        document.getElementsByTagName('head')[0].appendChild(style);
+      }
+      (style.styleSheet && (style.styleSheet.cssText += content)) || style.appendChild(document.createTextNode(content));
     },
 
     // 获取最终样式
-    _getStyle: 'getComputedStyle' in window ? function (elem, name) {
-      return getComputedStyle(elem, null)[name]
-    } : function (elem, name) {
-      return elem.currentStyle[name]
-    },
+    _getStyle:
+      'getComputedStyle' in window
+        ? function(elem, name) {
+            return getComputedStyle(elem, null)[name];
+          }
+        : function(elem, name) {
+            return elem.currentStyle[name];
+          },
 
     // 获取光标在文本框的位置
-    _getFocus: function (elem) {
-      var index = 0
-      if (document.selection) { // IE Support
-        elem.focus()
-        var Sel = document.selection.createRange()
-        if (elem.nodeName === 'TEXTAREA') { // textarea
-          var Sel2 = Sel.duplicate()
-          Sel2.moveToElementText(elem)
-          var index = -1
+    _getFocus: function(elem) {
+      var index = 0;
+      if (document.selection) {
+        // IE Support
+        elem.focus();
+        var Sel = document.selection.createRange();
+        if (elem.nodeName === 'TEXTAREA') {
+          // textarea
+          var Sel2 = Sel.duplicate();
+          Sel2.moveToElementText(elem);
+          var index = -1;
           while (Sel2.inRange(Sel)) {
-            Sel2.moveStart('character')
-            index++
-          };
-        } else if (elem.nodeName === 'INPUT') { // input
-          Sel.moveStart('character', -elem.value.length)
-          index = Sel.text.length
+            Sel2.moveStart('character');
+            index++;
+          }
+        } else if (elem.nodeName === 'INPUT') {
+          // input
+          Sel.moveStart('character', -elem.value.length);
+          index = Sel.text.length;
         }
-      } else if (elem.selectionStart || elem.selectionStart == '0') { // Firefox support
-        index = elem.selectionStart
+      } else if (elem.selectionStart || elem.selectionStart == '0') {
+        // Firefox support
+        index = elem.selectionStart;
       }
-      return (index)
+      return index;
     },
 
     // 获取元素在页面中位置
-    _offset: function (elem) {
-      var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement
-      var clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0
-      var top = box.top + (self.pageYOffset || docElem.scrollTop) - clientTop, left = box.left + (self.pageXOffset || docElem.scrollLeft) - clientLeft
+    _offset: function(elem) {
+      var box = elem.getBoundingClientRect(),
+        doc = elem.ownerDocument,
+        body = doc.body,
+        docElem = doc.documentElement;
+      var clientTop = docElem.clientTop || body.clientTop || 0,
+        clientLeft = docElem.clientLeft || body.clientLeft || 0;
+      var top = box.top + (self.pageYOffset || docElem.scrollTop) - clientTop,
+        left = box.left + (self.pageXOffset || docElem.scrollLeft) - clientLeft;
       return {
         left: left,
         top: top,
         right: left + box.width,
         bottom: top + box.height
-      }
+      };
     },
-    resize (old_height, height) {
-      let _this = this
-      let container = this.container
-      let content = this.content
-      this.scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight)
+    resize(old_height, height) {
+      let _this = this;
+      let container = this.container;
+      let content = this.content;
+      this.scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight);
       // 虚拟元素定位
-      let vInput = document.querySelectorAll('.v-input')
+      let vInput = document.querySelectorAll('.v-input');
       if (vInput.length > 0 && container.contains(vInput.item(0))) {
-        let pos_y = this.getPosition().top
-        let activeElementClientTop = vInput.item(0).getBoundingClientRect().top
+        let pos_y = this.getPosition().top;
+        let activeElementClientTop = vInput.item(0).getBoundingClientRect().top;
         if (container.clientHeight - 60 < activeElementClientTop - this.container.getBoundingClientRect().top) {
           setTimeout(() => {
-            this.scrollTo(0, pos_y + (activeElementClientTop - this.container.getBoundingClientRect().top - container.clientHeight + 100), true)
-          }, 100)
+            this.scrollTo(0, pos_y + (activeElementClientTop - this.container.getBoundingClientRect().top - container.clientHeight + 100), true);
+          }, 100);
         }
       }
-      if (old_height && height && height - old_height != 0 && document.activeElement && (document.activeElement.type == 'textarea' || document.activeElement.type == 'text' || document.activeElement.type == 'password' || document.activeElement.type == 'search' || document.activeElement.type == 'number')) {
+      if (
+        old_height &&
+        height &&
+        height - old_height != 0 &&
+        document.activeElement &&
+        (document.activeElement.type == 'textarea' ||
+          document.activeElement.type == 'text' ||
+          document.activeElement.type == 'password' ||
+          document.activeElement.type == 'search' ||
+          document.activeElement.type == 'number')
+      ) {
         setTimeout(() => {
           if (document.activeElement.style.textShadow === '') {
-            document.activeElement.style.textShadow = 'rgba(0,0,0,0) 0 0 0' // 改变某个不可见样式,触发dom重绘,这样可以解决光标错位的问题
+            document.activeElement.style.textShadow = 'rgba(0,0,0,0) 0 0 0'; // 改变某个不可见样式,触发dom重绘,这样可以解决光标错位的问题
           } else {
-            document.activeElement.style.textShadow = ''
+            document.activeElement.style.textShadow = '';
           }
-        }, 450)
+        }, 450);
       }
-      let pos_y = this.getPosition().top
+      let pos_y = this.getPosition().top;
 
-      document.activeElement.addEventListener('blur', function () {
-        setTimeout(() => {
-          if (!container.contains(document.activeElement) && (document.activeElement.type == 'textarea' || document.activeElement.type == 'text' || document.activeElement.type == 'password' || document.activeElement.type == 'search' || document.activeElement.type == 'number')) {
-            _this.scrollTo(0, pos_y, true)
-            _this.resize(old_height, height)
-            document.body.style.height = '100%'
-          }
-        }, 200)
-      }, false)
+      document.activeElement.addEventListener(
+        'blur',
+        function() {
+          setTimeout(() => {
+            if (
+              !container.contains(document.activeElement) &&
+              (document.activeElement.type == 'textarea' ||
+                document.activeElement.type == 'text' ||
+                document.activeElement.type == 'password' ||
+                document.activeElement.type == 'search' ||
+                document.activeElement.type == 'number')
+            ) {
+              _this.scrollTo(0, pos_y, true);
+              _this.resize(old_height, height);
+              document.body.style.height = '100%';
+            }
+          }, 200);
+        },
+        false
+      );
       if (container.contains(document.activeElement) && window.plus) {
-        let last_click_pos = localStorage.getItem('last_click_pos')
-        let activeElementClientTop = document.activeElement.getBoundingClientRect().top
+        let last_click_pos = localStorage.getItem('last_click_pos');
+        let activeElementClientTop = document.activeElement.getBoundingClientRect().top;
         if (last_click_pos) {
-          last_click_pos = JSON.parse(last_click_pos)
-          activeElementClientTop += last_click_pos.y
+          last_click_pos = JSON.parse(last_click_pos);
+          activeElementClientTop += last_click_pos.y;
         }
         if (container.clientHeight - 60 < activeElementClientTop - this.container.getBoundingClientRect().top) {
           setTimeout(() => {
-            this.scrollTo(0, pos_y + (activeElementClientTop - this.container.getBoundingClientRect().top - container.clientHeight + 60), true)
-          }, 100)
+            this.scrollTo(0, pos_y + (activeElementClientTop - this.container.getBoundingClientRect().top - container.clientHeight + 60), true);
+          }, 100);
           setTimeout(() => {
             if (document.activeElement.style.textShadow === '') {
-              document.activeElement.style.textShadow = 'rgba(0,0,0,0) 0 0 0' // 改变某个不可见样式,触发dom重绘,这样可以解决光标错位的问题
+              document.activeElement.style.textShadow = 'rgba(0,0,0,0) 0 0 0'; // 改变某个不可见样式,触发dom重绘,这样可以解决光标错位的问题
             } else {
-              document.activeElement.style.textShadow = ''
+              document.activeElement.style.textShadow = '';
             }
-          }, 450)
-          var bar_height = plus.navigator.getStatusbarHeight()
-          document.body.style.height = (window.innerHeight - bar_height) + 'px'
+          }, 450);
+          var bar_height = plus.navigator.getStatusbarHeight();
+          document.body.style.height = window.innerHeight - bar_height + 'px';
         }
       }
     },
 
-    finishPullToRefresh () {
-      this.scroller.finishPullToRefresh()
+    finishPullToRefresh() {
+      this.scroller.finishPullToRefresh();
     },
 
-    finishInfinite (hideSpinner) {
-      this.loadingState = hideSpinner ? 2 : 0
-      this.showLoading = false
+    finishInfinite(hideSpinner) {
+      this.loadingState = hideSpinner ? 2 : 0;
+      this.showLoading = false;
       if (this.loadingState == 2) {
-        this.resetLoadingState()
+        this.resetLoadingState();
       }
     },
 
-    triggerPullToRefresh () {
+    triggerPullToRefresh() {
       // 触发更新,每次都回到0的位置,然后就能出现loading了
-      this.scrollTo(0, 0)
+      this.scrollTo(0, 0);
       setTimeout(() => {
-        this.scroller.triggerPullToRefresh()
-      }, 100)
+        this.scroller.triggerPullToRefresh();
+      }, 100);
     },
 
-    scrollTo (x, y, animate) {
-      this.scroller.scrollTo(x, y, animate)
+    scrollTo(x, y, animate) {
+      this.scroller.scrollTo(x, y, animate);
     },
 
-    scrollBy (x, y, animate) {
-      this.scroller.scrollBy(x, y, animate)
+    scrollBy(x, y, animate) {
+      this.scroller.scrollBy(x, y, animate);
     },
 
-    touchStart (e) {
-      this.scroller.doTouchStart(e.touches, e.timeStamp)
+    touchStart(e) {
+      this.scroller.doTouchStart(e.touches, e.timeStamp);
     },
 
-    touchMove (e) {
-      let self = this
-      e.preventDefault()
-      this.scroller.doTouchMove(e.touches, e.timeStamp)
+    touchMove(e) {
+      let self = this;
+      e.preventDefault();
+      this.scroller.doTouchMove(e.touches, e.timeStamp);
       // 同步滚动条的位置
-      let y = this.getPosition().top
-      self.bar_height = (self.container.offsetHeight) / (self.content.offsetHeight) * (self.container.offsetHeight)
+      let y = this.getPosition().top;
+      self.bar_height = (self.container.offsetHeight / self.content.offsetHeight) * self.container.offsetHeight;
       if (self.bar_height < 50) {
-        self.bar_height = 50
+        self.bar_height = 50;
       }
-      self.bar_opacity = 1
-      let cp = y / (self.content.offsetHeight) * (self.container.offsetHeight)
-      self.bar_top = Math.round(cp)
-      self.onScrolling(Math.round(cp))
+      self.bar_opacity = 1;
+      let cp = (y / self.content.offsetHeight) * self.container.offsetHeight;
+      self.bar_top = Math.round(cp);
+      self.onScrolling(Math.round(cp));
       // console.log(document.getElementById(this.contentId+'_bar').getAttribute('style'))
-      const {scroller_bar} = self.$refs
+      const { scroller_bar } = self.$refs;
       if (scroller_bar) {
-        scroller_bar.style.transform = 'translate3d(0px, ' + self.bar_top + 'px, 0px) scale(1)'
-        scroller_bar.style.height = self.bar_height + 'px'
-        scroller_bar.style.opacity = self.bar_opacity
+        scroller_bar.style.transform = 'translate3d(0px, ' + self.bar_top + 'px, 0px) scale(1)';
+        scroller_bar.style.height = self.bar_height + 'px';
+        scroller_bar.style.opacity = self.bar_opacity;
       }
       // localStorage.setItem('scroller-top-' + self.contentId, self.getPosition().top)
     },
 
-    touchEnd (e) {
-      this.scroller.doTouchEnd(e.timeStamp)
-      let y = this.getPosition().top
+    touchEnd(e) {
+      this.scroller.doTouchEnd(e.timeStamp);
+      let y = this.getPosition().top;
       setTimeout(() => {
-        this.onScrolling(Math.round(y))
-      }, 100)
+        this.onScrolling(Math.round(y));
+      }, 100);
     },
 
-    mouseDown (e) {
-      this.scroller.doTouchStart([{
-        pageX: e.pageX,
-        pageY: e.pageY
-      }], e.timeStamp)
-      this.mousedown = true
+    mouseDown(e) {
+      this.scroller.doTouchStart(
+        [
+          {
+            pageX: e.pageX,
+            pageY: e.pageY
+          }
+        ],
+        e.timeStamp
+      );
+      this.mousedown = true;
     },
 
-    mouseMove (e) {
+    mouseMove(e) {
       if (!this.mousedown) {
-        return
+        return;
       }
-      this.scroller.doTouchMove([{
-        pageX: e.pageX,
-        pageY: e.pageY
-      }], e.timeStamp)
-      this.mousedown = true
+      this.scroller.doTouchMove(
+        [
+          {
+            pageX: e.pageX,
+            pageY: e.pageY
+          }
+        ],
+        e.timeStamp
+      );
+      this.mousedown = true;
     },
 
-    mouseUp (e) {
+    mouseUp(e) {
       if (!this.mousedown) {
-        return
+        return;
       }
-      this.scroller.doTouchEnd(e.timeStamp)
-      this.mousedown = false
+      this.scroller.doTouchEnd(e.timeStamp);
+      this.mousedown = false;
     },
 
     // 获取位置
-    getPosition () {
-      let v = this.scroller.getValues()
+    getPosition() {
+      let v = this.scroller.getValues();
 
       return {
         left: parseInt(v.left),
         top: parseInt(v.top)
-      }
+      };
     },
 
-    resetLoadingState () {
-      let { left, top, zoom } = this.scroller.getValues()
-      let container = this.container
-      let content = this.content
+    resetLoadingState() {
+      let { left, top, zoom } = this.scroller.getValues();
+      let container = this.container;
+      let content = this.content;
 
       if (top + 60 > this.content.offsetHeight - this.container.clientHeight) {
         setTimeout(() => {
-          this.resetLoadingState()
-        }, 1000)
+          this.resetLoadingState();
+        }, 1000);
       } else {
-        this.loadingState = 0
+        this.loadingState = 0;
       }
     }
   }
-}
+};
 </script>
 <style lang="css" scoped>
 .cur .page-index-tip {

+ 0 - 13
src/components/ems/employee_edit.vue

@@ -6,26 +6,13 @@
     </van-nav-bar>
     <div class="body_com">
       <scroller>
-        <!--
-        <van-cell-group>
-          <van-cell title="头像" clickable class="user_img_w">
-            <template slot="default">
-              <img :src="employee_info.img_url?employee_info.img_url:'static/images/join_review.jpg'" class="needsclick user_img" />
-            </template>
-          </van-cell>
-        </van-cell-group>
-        -->
         <van-cell-group>
           <van-field label="姓名" name="姓名" :disabled="employee_info.status != 1" required v-model="employee_info.name" v-validate="'required|min:2|max:20'" placeholder="请输入姓名" />
           <van-field label="手机" name="手机" :disabled="employee_info.status != 1" required v-model="employee_info.tel" v-validate="'required|phone'" type="tel" placeholder="请输入手机号码" />
         </van-cell-group>
         <van-cell-group>
           <van-cell required name="部门" title="部门" :disabled="employee_info.status == 2" is-link @click="show_dept_selector = true" :value="selecte_dept_name" />
-          <!-- <van-cell required title="上级" is-link @click=" show_superior_selector = true " value="上级" /> -->
-
           <van-cell required name="状态" title="状态" :disabled="employee_info.status == 2" :value="employee_info.status == 0?'待邀':(employee_info.status == 1?'在职':'离职')" />
-
-          <!-- <van-field label="邮箱" v-model="employee_info.email" v-validate="'required|email'" placeholder="如:1051033780@qq.com" /> -->
           <van-field label="工号" name="工号" :disabled="employee_info.status == 2" v-model="employee_info.company_id" v-validate="'max:20'" placeholder="请输入工号" />
           <van-field label="职位" name="职位" :disabled="employee_info.status == 2" v-model="employee_info.post" placeholder="如:技术经理" />
           <van-cell title="入职日期" :disabled="employee_info.status == 2" name="入职日期" class="hiredate-cell" @click="select_date=true">{{employee_info.accedence_time}}</van-cell>

+ 45 - 55
src/components/ems/invite.vue

@@ -1,74 +1,64 @@
 <template>
   <div>
-    <van-nav-bar title="邀请成员" left-text="返回" @click-left="$route_back" left-arrow>
-
-    </van-nav-bar>
+    <van-nav-bar title="邀请成员" left-text="返回" @click-left="$route_back" left-arrow></van-nav-bar>
     <div style="padding:0.5rem 0.5rem;">
       <div style=" text-align: center; -webkit-border-radius: 0.2rem;-moz-border-radius: 0.2rem;border-radius: 0.2rem; padding:0.5rem 0;">
-        <h4> {{company_info.name}} </h4>
-        <div id="example">
-        <qrcode-vue class="qrcode_box" :value="url" :size="150" level="H"></qrcode-vue>
-        </div>
+        <h4>{{ company_info.name }}</h4>
+        <div id="example"><qrcode-vue class="qrcode_box" :value="url" :size="150" level="H"></qrcode-vue></div>
         <p style="color:#999; font-size:0.28rem;">用APP扫一扫,快速加入组织</p>
       </div>
     </div>
-   </div>
+  </div>
 </template>
 <script src="html5plus://ready"></script>
 <script>
+import request from '@/utils/request';
+import QrcodeVue from 'qrcode.vue';
+import plusShare from '../../../static/js/plusShare.js';
+import { getToken, getUserId } from '@/utils/auth';
+import Vue from 'vue';
+import axios from 'axios';
 
-  // import coreDialog from '@/components/common/coreDialog.vue';
-  import request from '@/utils/request'
-  import QrcodeVue from 'qrcode.vue'
-  import plusShare from '../../../static/js/plusShare.js'
-  import analytics from '@/utils/analytics.js'
-  import { getToken, getUserId } from '@/utils/auth'
-  import Vue from 'vue'
-  import axios from 'axios'
-
-  export default {
-    name: 'invite',
+export default {
+  name: 'invite',
 
-    data(){
-      return {
-        userinfo: this.$store.getters.user_info,
-        url: 'http://192.168.1.3:8080/#/join_company?id=',
-        company_info:{},
-        site_id:'',
-        employee_id:'',
-      }
-    },
-    components: {
-      QrcodeVue,
-      // coreDialog
-    },
-    created(){
-      this.companyId =  this.$route.query.id;
-      let id = this.$route.query.id
-      let dept_id = this.$route.query.dept_id
-      this.url = this.url + id
-      this.site_id = this.userinfo.site_id;
-      this.employee_id = this.userinfo.id;
-      this.get_company_info(id)
-    },
-    methods:{
-      getUserInfo(event) {
-
-      },
-      get_company_info(id){
-        let self = this
-        request('get','/addons/ems/index/get_company_info',{id:id}).then((res) => {
-          if(res.data.code == 1){
+  data() {
+    return {
+      userinfo: this.$store.getters.user_info,
+      url: 'http://192.168.1.3:8080/#/join_company?id=',
+      company_info: {},
+      site_id: '',
+      employee_id: ''
+    };
+  },
+  components: {
+    QrcodeVue
+    // coreDialog
+  },
+  created() {
+    this.companyId = this.$route.query.id;
+    let id = this.$route.query.id;
+    let dept_id = this.$route.query.dept_id;
+    this.url = this.url + id;
+    this.site_id = this.userinfo.site_id;
+    this.employee_id = this.userinfo.id;
+    this.get_company_info(id);
+  },
+  methods: {
+    getUserInfo(event) {},
+    get_company_info(id) {
+      let self = this;
+      request('get', '/addons/ems/index/get_company_info', { id: id })
+        .then(res => {
+          if (res.data.code == 1) {
             self.company_info = res.data.data;
-            self.url = this.url + '&site_id='+this.site_id + '&employee_idz'
+            self.url = this.url + '&site_id=' + this.site_id + '&employee_idz';
           }
-        }).catch((e) => {
-
         })
-      }
+        .catch(e => {});
     }
   }
+};
 </script>
 
-<style scoped>
-</style>
+<style scoped></style>

+ 2 - 2
src/components/ems/new_employee.vue

@@ -12,8 +12,8 @@
               <template slot="default">
                 <van-button type="info" @click="agree_btn([item.id])" size="small" v-if="item.status == '0' && !multi">同意</van-button>
                 <span v-if="item.invitee">
-                 <a style="color:#1989fa;" v-if="item.invitee && item.status == '1' && item.invitee.employee_detail.dept_list.length == 0" @click="$router.push({name:'employee_edit',query:{id: item.invitee.employee_detail.id}})" >去完善信息</a>
-                 <span v-if="item.status == '1' && item.invitee.employee_detail.id && item.invitee.employee_detail.dept_list.length > 0">信息已完善</span>
+<!--                 <a style="color:#1989fa;" v-if="item.invitee && item.status == '1' && item.invitee.employee_detail.dept_list.length == 0" @click="$router.push({name:'',query:{id: item.invitee.employee_detail.id}})" >去完善信息</a>
+                 <span v-if="item.status == '1' && item.invitee.employee_detail.id && item.invitee.employee_detail.dept_list.length > 0">信息已完善</span> -->
                 </span>
               </template>
             </van-cell>

+ 1 - 6
src/components/integral/integral_application.vue

@@ -3,20 +3,16 @@
     <van-nav-bar title="积分申请" left-text="返回" @click-left="$route_back" left-arrow></van-nav-bar>
     <div class="body_com has_header">
       <scroller :isNeed="isNeed">
-
         <div v-for="(item,index) in fromData.items" :key="index" class="item_class" @click="itemIndex = index">
           <div class="clear operation">
             <span class="fl color_ccc">申请(第{{index+1}}条)</span>
-            <span class="fr del_btn" v-show="index == 0 && fromData.items.length > 1" @click="del_one(index)">删除</span>
-            <span class="fr del_btn" v-show="index != 0" @click="del_one(index)">删除</span>
+            <span class="fr del_btn" v-show="fromData.items.length > 1" @click="del_one(index)">删除</span>
           </div>
           <integralApplyItem v-model="itemData" :num="index" />
         </div>
-
         <van-cell-group>
           <van-cell @click="add_one" title-class="color_bule" title="+ 再加一条"></van-cell>
         </van-cell-group>
-
         <div style="padding:0.32rem;">
           <van-button size="large" @click="data_verify" :disabled="subloading" type="info">提交</van-button>
         </div>
@@ -28,7 +24,6 @@
 import request from '@/utils/request'
 import integralApplyItem from '@/components/common/integralApplyItem'
 import moment from 'moment'
-import Vue from 'vue'
 
 export default {
   name: 'integral_application',

+ 1 - 17
src/components/integral/integral_entry_n.vue

@@ -595,25 +595,9 @@ export default {
       this.types_list_map[this.types_list_array[i].id] = this.types_list_array[i]
     }
     //刷新当前角色下级上级
-    request('get', '/api/employee/detail')
-      .then(res => {
+    request('get', '/api/employee/detail').then(res => {
         let list = res.data.data.user
         this.manage_scope = list.employee_detail.manage_scope
-        // let manageList = list.employee_detail.manage_scope
-        
-        // request('get', '/api/employee/index', { page: 0, page_size: 2000, is_official: 1 }).then((res) => {
-        //   let arr = res.data.data.list
-        //   let scopeList = []
-        //   arr.map(item => {
-        //     // 列表数据是否是自己的管理范围
-        //     manageList.map(item2 => {
-        //       if (item.id == item2.id) {
-        //         scopeList.push(item);
-        //       }
-        //     });
-        //   });
-        //   this.manage_scope = scopeList
-        // })
         this.reviewed_score = list.employee_detail.superior_list
       })
   },

+ 0 - 7
src/components/integral/integral_rank.vue

@@ -53,18 +53,11 @@
           <van-button class="button-border-none" block square type="info" @click="onConfirmFilter">确认</van-button>
         </div>
       </van-dropdown-item>
-
-      <!--
-      <div @click="sortNumber" class="dropdown-menu__item">
-        <span :class="{'asc-order': !sort}">{{ sort ? '降序': '升序' }}</span>
-      </div>
-      -->
     </van-dropdown-menu>
     <div class="body_com has_header">
       <scroller ref="scroller" :on-refresh="onRefresh" :on-infinite="onInfinite">
         <van-cell v-for="(item, index) in data" :key="index" @click="openDetail(item)">
           <div slot="icon" class="rank-item__icon-wrap">
-            <!-- <icon :name="mapRankIconName[index]" v-if="item.rank < 4 && sort" class="rank-item__icon"></icon> -->
             <icon name="rank-first" v-if="item.rank == 1" class="rank-item__icon"></icon>
             <icon name="rank-second" v-if="item.rank == 2" class="rank-item__icon"></icon>
             <icon name="rank-third" v-if="item.rank == 3" class="rank-item__icon"></icon>

+ 0 - 18
src/components/pk/pk_teams_copy.vue

@@ -253,28 +253,10 @@ export default {
     // 获取团队人员列表
     get_team_employee_list (item) {
       this.team_employee_list = []
-      // let teamEmployeeList = []
       let employee_arr = []
-      // item.members.forEach(v => {
-      //   this.employee_list.list.forEach(d => {
-      //     if (v.id == d.id) {
-      //       teamEmployeeList.push(d)
-      //       employee_arr.push(d.name)
-      //     }
-      //   })
-      // })
       item.members.forEach((item,index)=>{
         employee_arr.push(item.name)
       })
-      // const arr2Ids = this.employee_list.list.map(item => item.id);
-      // console.log('arr2Ids')
-      // console.log(arr2Ids)
-      // const intersection1 = item.members.filter(item => arr2Ids.includes(item.id))
-      // console.log('intersection1');
-      // console.log(intersection1);
-      // intersection1.forEach((item,index)=>{
-      //   employee_arr.push(item.name)
-      // })
       this.team_employee_list = item.members
       this.select_employee_name = employee_arr
     },

+ 0 - 11
src/components/task/short_task.vue

@@ -353,21 +353,10 @@ export default {
           self.data.targets.push(val[i].id)
           arr.push(self.employee_map[val[i].id].superior_list)
         }
-        // if (arr.length == 1) {
-        //   console.log(val)
-        //   self.approver_manage_scope = []
-        //   self.approver_manage_scope = arr[0]
-        // } else {
-        //   console.log(self.intersection(arr))
-        //   console.log(self.employee_map)
-        //   console.log(self.employee_map[self.intersection(arr)])
-        //   self.approver_manage_scope = self.employee_map[self.intersection(arr)].superior_list
-        // }
       }
     }
   },
   methods: {
-    // data.super_satisfied" placeholder="请输入积分" label="超预期" />
     changeunqualified (val) {
       let str = '' + this.data.super_satisfied
       let str2 = ''

+ 88 - 266
src/components/user/index.vue

@@ -1,16 +1,11 @@
 <template>
   <div>
-    <div class="user_index_scroller_com" :class="isIos? 'isIos':''">
-      <!-- 内容 -->
-	   <!-- <div class="height100p" v-if="active_index == 1" :class="{ hidden_right: active_index != 1 }"><work @url_jump="app_open"></work></div> -->
-	   <!-- <div class="height100p" v-if="active_index == 2" :class="{ hidden_right: active_index != 2 }"><statistics_personal /></div> -->
-
-      <div class="height100p"  :class="{ hidden_right: active_index != 0 }"><statistics ref="management" @active2="active2" /></div>
+    <div class="user_index_scroller_com" :class="isIos ? 'isIos' : ''">
+      <div class="height100p" :class="{ hidden_right: active_index != 0 }"><statistics ref="management" @active2="active2" /></div>
       <div class="height100p" v-show="active_index == 1" :class="{ hidden_right: active_index != 1 }"><work></work></div>
-      <!-- <div class="height100p" v-if="active_index == 2" :class="{ hidden_right: active_index != 2 }"><message_list @shwoCunt="shwoCunt"></message_list></div> -->
-      <div class="height100p" v-if="active_index == 2" :class="{ hidden_right: active_index != 2 }"><user_center></user_center></div>
+      <div class="height100p" v-if="active_index == 2" :class="{ hidden_right: active_index != 2 }"><userCenter></userCenter></div>
       <!-- 导航 -->
-      <van-tabbar v-model="active_index" :class="isIos? 'padding-m':''" :fixed="false">
+      <van-tabbar v-model="active_index" :class="isIos ? 'padding-m' : ''" :fixed="false">
         <van-tabbar-item>
           <icon name="statistics" v-if="tabs != 0" class="footer_nav_review"></icon>
           <icon name="statistics_checked" v-if="tabs == 0" class="footer_nav_review active"></icon>
@@ -21,299 +16,126 @@
           <icon name="footer_nav_work_press" v-if="tabs == 1" class="footer_nav_work_press active"></icon>
           <span>工作台</span>
         </van-tabbar-item>
-        <!-- <van-tabbar-item>
-          <icon name="footer_nav_message" v-if="tabs != 2" class="footer_nav_message"></icon>
-          <icon name="footer_nav_message_press" v-if="tabs == 2" class="footer_nav_message_press active"></icon>
-          <span>通知</span>
-          <em v-if="cuntNum.deal>0" class="cunt" :class="{ cunts: cuntNum.deal > 99 }">
-              <i v-if="cuntNum.deal <100">{{cuntNum.deal}}</i>
-              <i v-else>99+</i>
-          </em>
-          <template v-else>
-              <em class="cunt2" v-if="cuntNum.notice==1"></em>
-          </template>
-        </van-tabbar-item> -->
         <van-tabbar-item>
           <icon name="footer_nav_me" v-if="tabs != 2" class="footer_nav_me"></icon>
           <icon name="footer_nav_me_press" v-if="tabs == 2" class="footer_nav_me_press active"></icon>
           <span>我的</span>
         </van-tabbar-item>
       </van-tabbar>
-
-      <!-- 中间弹出 -->
-      <!-- <van-tabbar-item><icon name="footer_nav_add_press" class="footer_nav_add_press active"></icon></van-tabbar-item> -->
-
-      <!-- 体验版相关 -->
-      <!-- <div class="suspendButton" v-if="showBuyPopup" id="moveDiv" @mousedown="down" @touchstart="down" @mousemove="move" @touchmove.prevent="move" @mouseup="end" @touchend="end">
-        <div class="yuanqiu" @click.stop="applyBuyButton">
-          <van-icon name="shopping-cart" size="0.5rem" />
-          <div>申请购买</div>
-        </div>
-      </div>
-      <van-popup v-model="buyPopupPage" :close-on-click-overlay="false" style="border-radius: 0.15rem; background: #fff0;" @closed="getItemBuyPopupPage">
-        <div class="buyPopupBody">
-          <div class="buyPopupContent">
-            <div class="buyPopupTitle">请购买正式版</div>
-            <p class="buyPopupTxt">亲爱的用户,欢迎使用功道云。我们已预置部分体验数据,如需购买完整版请点击【申请购买】,或拨打电话:</p>
-            <p class="buyPopupTel">400-6877-880</p>
-            <van-row gutter="20">
-              <van-col span="12"><van-button block type="info" @click="applyButton">申请购买</van-button></van-col>
-              <van-col span="12"><van-button block type="default" @click="getItemBuyPopupPage">我知道了</van-button></van-col>
-            </van-row>
-          </div>
-        </div>
-      </van-popup> -->
-
     </div>
-<!--    <van-popup class="common_menu_popup" v-model="shortcut_show" position="bottom" close-icon-position="bottom-right" closeable>
-      <common_menu @confirm="shortcut_show = false"></common_menu>
-    </van-popup> -->
   </div>
 </template>
 
 <script>
-import request from '@/utils/request'
-// import management from '@/components/body/management'
-import user_center from '@/components/body/user_center'
-// import message_list from '@/components/body/message_list'
-import statistics from '@/components/body/statistics'
-import work from '@/components/body/work'
-// import department from '@/components/body/department'
-// import common_menu from '@/components/user/common_menu'
-// import statistics_personal from '@/components/integral/statistics_personal'
+import statistics from '@/components/body/statistics';
+import work from '@/components/body/work';
+import userCenter from '@/components/body/user_center'
 
-import Vue from 'vue'
-import { Overlay, Image as VanImage } from 'vant'
-Vue.use(Overlay).use(VanImage)
+import Vue from 'vue';
+import { Overlay, Image as VanImage } from 'vant';
+Vue.use(Overlay).use(VanImage);
 
 export default {
-  components: { user_center, statistics, work},
-  sockets: {
-    new_msg (data) {
-      let self = this
-      let json = JSON.parse(data)
-      self.msg_count = json.count
-    }
-  },
-  keep_alive_update: {},
-  data () {
+  components: {userCenter,statistics, work },
+  data() {
     return {
-      cuntNum: {deal: 0, notice: ''},
-      icon_click: 0,
-      shortcut_show: false,
-      msg_count: 0,
       active_index: 0,
       tabs: 0,
-      userinfo: null,
-      // showBuyPopup: false,
-      // buyPopupPage: false,
-      flags: false,
-      position: { x: 0, y: 0 },
-      nx: '',
-      ny: '',
-      dx: '',
-      dy: '',
-      xPum: '',
-      yPum: '',
-      employeeMap: {},
       isIos: false
-    }
+    };
   },
   watch: {
-    active_index: function (val, old) {
-      // if (val == 0) {
-        // this.$store.dispatch('getMenu').then(res => {
-          // this.$refs.management.getMenu(res)
-          // this.$refs.management.getKqList()
-        // })
-        // if (!this.$refs.management.isShowImg) {
-        //   this.$refs.management.get_notice_list()
-        // }
-      // }
-      this.docuTitle(val)
-      this.tabs = val
+    active_index: function(val, old) {
+      this.docuTitle(val);
+      this.tabs = val;
     }
   },
   methods: {
-    active2(data){
-      this.active_index = data
-    },
-    docuTitle(val){
-      window.document.title =
-      val == 0 ? '首页':
-      val == 1 ? '工作台':
-      val == 2 ? '我的':
-      '功道云'
+    active2(data) {
+      this.active_index = data;
     },
-    shwoCunt (data) {
-      request('get', '/api/notice/number').then(res => {
-        this.cuntNum = res.data.data
-      })
+    docuTitle(val) {
+      window.document.title = val == 0 ? '首页' : val == 1 ? '工作台' : val == 2 ? '我的' : '功道云';
     },
-    // 实现移动端拖拽
-    // down () {
-    //   this.flags = true
-    //   var touch
-    //   if (event.touches) {
-    //     touch = event.touches[0]
-    //   } else {
-    //     touch = event
-    //   }
-    //   this.position.x = touch.clientX
-    //   this.position.y = touch.clientY
-    //   this.dx = moveDiv.offsetLeft
-    //   this.dy = moveDiv.offsetTop
-    // },
-    // move () {
-    //   if (this.flags) {
-    //     var touch
-    //     if (event.touches) {
-    //       touch = event.touches[0]
-    //     } else {
-    //       touch = event
-    //     }
-    //     this.nx = touch.clientX - this.position.x
-    //     this.ny = touch.clientY - this.position.y
-    //     this.xPum = this.dx + this.nx
-    //     this.yPum = this.dy + this.ny
-    //     moveDiv.style.left = this.xPum + 'px'
-    //     moveDiv.style.top = this.yPum + 'px'
-    //     // 阻止页面的滑动默认事件;如果碰到滑动问题,1.2 请注意是否获取到 touchmove
-    //     document.addEventListener(
-    //       'touchmove',
-    //       function () {
-    //         event.preventDefault()
-    //       },
-    //       false
-    //     )
-    //   }
-    // },
-    // 鼠标释放时候的函数
-    // end () {
-    //   this.flags = false
-    // },
-    // applyBuyButton () {
-    //   this.buyPopupPage = true
-    // },
-    // applyButton () {
-    //   let self = this
-    //   let data = {
-    //     account_id: this.$store.getters.user_info.account_id,
-    //     source_type: 1,
-    //     apply_type: 1
-    //   }
-    //   request_user('post', '/api/intentions/addbuy', data).then(res => {
-    //     if (res.data.code == 1) {
-    //       self.$toast('申请成功')
-    //     } else {
-    //       self.$toast(res.data.msg)
-    //     }
-    //   }).catch(e => {
-    //     self.$toast.clear()
-    //   })
-    // },
-    // end元素拖拽
-
-    // getItemBuyPopupPage () {
-    //   localStorage.setItem('buyPopupPage', true)
-    //   this.buyPopupPage = false
-    // },
-
-    app_open (url) {
-      localStorage.setItem('home_active_index', this.active_index)
-    }
-  },
-  activated (){
-    this.docuTitle(this.active_index)
   },
-  created () {
-    document.documentElement.style.backgroundColor = '#26A2FF'
-    if (window.plus) { // 下边横杠兼容
-      plus.navigator.setStatusBarStyle('light')
-      var str = window.plus.device.model
+  created() {
+    document.documentElement.style.backgroundColor = '#26A2FF';
+    if (window.plus) {
+      // 下边横杠兼容
+      plus.navigator.setStatusBarStyle('light');
+      var str = window.plus.device.model;
       if (str.indexOf('iPhone') >= 0) {
-        if (str === 'iPhone4' || str === 'iPhone4s' || str === 'iPhone5' || str === 'iPhone5c' || str === 'iPhone5s' || str === 'iPhone6' || str === 'iPhone6 Plus' || str === 'iPhone6s' || str === 'iPhone6s Plus' || str === 'iPhone SE' || str === 'iPhone7' || str === 'iPhone7 Plus' || str === 'iPhone8' || str === 'iPhone8 Plus') {
-          plus.storage.setItem('iPhone', 'false')
-          this.isIos = false
+        if (
+          str === 'iPhone4' ||
+          str === 'iPhone4s' ||
+          str === 'iPhone5' ||
+          str === 'iPhone5c' ||
+          str === 'iPhone5s' ||
+          str === 'iPhone6' ||
+          str === 'iPhone6 Plus' ||
+          str === 'iPhone6s' ||
+          str === 'iPhone6s Plus' ||
+          str === 'iPhone SE' ||
+          str === 'iPhone7' ||
+          str === 'iPhone7 Plus' ||
+          str === 'iPhone8' ||
+          str === 'iPhone8 Plus'
+        ) {
+          plus.storage.setItem('iPhone', 'false');
+          this.isIos = false;
         } else {
-          plus.storage.setItem('iPhone', 'true')
-          this.isIos = true
+          plus.storage.setItem('iPhone', 'true');
+          this.isIos = true;
         }
       }
     }
-    // this.shwoCunt()
   },
-  mounted () {
-    let index = localStorage.getItem('home_active_index')
+  mounted() {
+    let index = localStorage.getItem('home_active_index');
     if (index) {
-      localStorage.removeItem('home_active_index')
-      this.active_index = index
+      localStorage.removeItem('home_active_index');
+      this.active_index = index;
     }
-    // 判断规则树和人员缓存 控制弹窗
-    this.$nextTick(() => {
-      // this.employeeMap = {}
-      if (JSON.parse(localStorage.getItem('buyPopup')) == null) {
-        if (this.$store.getters.user_info.try_user == 1) {
-          JSON.parse(localStorage.getItem('buyPopupPage')) ? (this.buyPopupPage = false) : (this.buyPopupPage = true)
-          this.showBuyPopup = true
-        } else {
-          this.showBuyPopup = false
-        }
-      } else {
-        if (this.$store.getters.user_info.try_user == 1) {
-          this.showBuyPopup = true
-        } else {
-          this.showBuyPopup = false
-        }
-      }
-    })
   },
-  beforeRouteLeave (to, form, next) {
-    if (this.showBuyPopup) {
-      localStorage.setItem('buyPopup', true)
-      this.showBuyPopup = false
-    }
-    next()
-  }
-}
+};
 </script>
 
 <style scoped lang="less">
- .cunt{
-   background-color: rgb(245, 108, 108);
-   text-align: center;
-   line-height: 0.35rem;
-   width: 0.35rem;
-   height: 0.35rem;
-   border-radius: 1rem;
-   position: absolute;
-   top: 5px;
-   left: 1.1rem;
-   color: #fff;
-   font-size: 0.24rem;
-   font-style:normal
- }
- .cunt2{
-   background-color: rgb(245, 108, 108);
-   text-align: center;
-   width: 0.2rem;
-   height: 0.2rem;
-   border-radius: 1rem;
-   position: absolute;
-   top: 5px;
-   left: 1.1rem;
- }
- .cunt i{
-   font-style:normal
- }
- .cunts{
-    padding: 0 0.04rem !important;
-    width: auto !important;
-    max-width: 0.8rem;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
- }
+.cunt {
+  background-color: rgb(245, 108, 108);
+  text-align: center;
+  line-height: 0.35rem;
+  width: 0.35rem;
+  height: 0.35rem;
+  border-radius: 1rem;
+  position: absolute;
+  top: 5px;
+  left: 1.1rem;
+  color: #fff;
+  font-size: 0.24rem;
+  font-style: normal;
+}
+.cunt2 {
+  background-color: rgb(245, 108, 108);
+  text-align: center;
+  width: 0.2rem;
+  height: 0.2rem;
+  border-radius: 1rem;
+  position: absolute;
+  top: 5px;
+  left: 1.1rem;
+}
+.cunt i {
+  font-style: normal;
+}
+.cunts {
+  padding: 0 0.04rem !important;
+  width: auto !important;
+  max-width: 0.8rem;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
 .common_menu_popup {
   padding-bottom: 1.5rem;
   padding-top: 0.1rem;
@@ -334,10 +156,10 @@ export default {
   height: calc(100% - 1rem);
   position: relative;
 }
-.isIos{
+.isIos {
   height: calc(100% - 1.4rem);
 }
-.padding-m{
+.padding-m {
   padding-bottom: 0.4rem;
 }
 .user_index_header_com {

+ 75 - 0
src/components/user/login.vue

@@ -0,0 +1,75 @@
+<template>
+  <div class="login-box-parent">
+    <div class="all" style="">
+      <div class="data-all" style="text-align:center;margin-top:50px;">
+        <transition name="fade"><img src="static/images/init.gif" style="margin:0 auto;" alt="" /></transition>
+        <div>管理执行难,就用功道云</div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import request from '@/utils/request';
+import { getToken, setToken, cookGetToken } from '@/utils/auth';
+import { wxAuth } from '@/utils/wx-auth-two.js';
+
+export default {
+  name: 'login',
+  data() {
+    return {
+      logImage: true,
+      loginButton: true
+    };
+  },
+  created() {
+    console.log('进入登录页');
+    if (cookGetToken()) {
+      setToken(cookGetToken());
+      this.detailAxiox(1);
+    } else {
+      window.location.href = process.env.BASE_API; //重新授权
+    }
+  },
+  methods: {
+    detailAxiox(add) {
+      request('get', process.env.BASE_API + '/api/employee/detail').then(res => {
+        if (res.data.code == 1) {
+          if (res.data.data.user.is_official == 0) {
+            this.$router.push({
+              path: '/noAccess',
+              query: {
+                msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'
+              }
+            });
+          } else if (add == 1) {
+            this.$store.commit('SET_USERINFO', res.data.data.user); // 设置员工信息
+            window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']));
+            window.sessionStorage.setItem('routers', '/');
+            console.log(getToken());
+            wxAuth(true);
+          }
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style rel="stylesheet/scss" lang="scss" scoped>
+.all {
+  margin: 0 auto;
+  position: relative;
+  top: 50%;
+  margin-top: -325px;
+}
+.login-box-parent {
+  position: relative;
+  width: 100vw;
+  height: 100vh;
+  overflow: auto;
+  cursor: default;
+  /* background-color: #f5f6f9; */
+  background-color: #fff;
+}
+</style>

+ 0 - 170
src/components/user/login1.vue

@@ -1,170 +0,0 @@
-<template>
-  <div class="login-box-parent">
-    <div class="all" style="">
-      <div class="data-all" style="text-align:center;margin-top:50px;">
-        <transition name="fade">
-          <!-- <img
-            src="/static/images/login300.png"
-            v-if="logImage"
-            style="margin:48px auto;width:104px;height:104px;"
-            alt=""
-          /> -->
-          <img
-            src="static/images/init.gif"
-            style="margin:0 auto;"
-            alt=""
-          />
-        </transition>
-        <div>管理执行难,就用功道云</div>
-        <!-- <transition name="fade">
-          <van-button
-            class="refresh"
-            type="info"
-            @click="LoginBut"
-            v-show="loginButton"
-            style="border-radius:5px;margin-top:10px;"
-            >{{ logButText }}</van-button
-          >
-        </transition> -->
-      </div>
-    </div>
-  </div>
-</template>
-
-<script>
-import Vue from "vue";
-import { Divider } from "vant";
-import Cookies from 'js-cookie'
-
-import request from '@/utils/request'
-import { getToken, setToken } from "@/utils/auth";
-
-import { wxAuth } from "@/utils/wx-auth-two.js";
-import axios from "axios";
-Vue.use(Divider);
-export default {
-  name: "login1",
-  data() {
-    return {
-      logImage: true,
-      logButText: "登录",
-      loginButton: true
-    };
-  },
-  activated() {//activated()每次进入页面都会执行,代替created
-    if(Cookies.get('Admin-Token')){
-      console.log('Admin-Token')
-      const user_info = this.$store.getters.user_info || JSON.parse(localStorage.getItem('user_info')).data || JSON.parse(plus.storage.getItem('user_info')).data
-      console.log(user_info)
-      if(user_info){
-        wxAuth(true);
-      }else{
-        this.detailAxiox()
-      }
-    }else{
-      console.log('222222')
-      var url = window.location.href; //获取url中"?"符后的字串
-      let tokenif = false
-      var token = ''
-      if(url){
-        if (url.split("?")[1]) {//判断有无?参数
-          let str = url.split("?")[1]
-          console.log(str)
-          if(str.split("=")[0] == 'token'){
-            token = str.split("=")[1].split("#")[0]
-            console.log(str.split("=")[1])
-            tokenif = true
-          }
-        }
-      }
-      if(tokenif){
-        setToken(token);
-        this.detailAxiox(token)
-      }else{
-        window.location.href = 'http://test.qywx.g107.net/wechat/authorize?platform='+ this.isPcOrApp() +'#wechat_redirect'
-      }
-    }
-  },
-  mounted() {
-  },
-  watch: {},
-  methods: {
-    detailAxiox(){
-      request('get',process.env.BASE_API+'/api/employee/detail')
-      .then(res => {
-        if(res.data.code == 1){
-          this.$store.commit("SET_USERINFO", res.data.data.user); // 设置员工信息
-          window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']))
-          window.sessionStorage.setItem('routers', '/')
-          console.log(getToken());
-          wxAuth(true);
-        }
-      })
-    },
-    // LoginBut() {
-    //   // if(this.logButText == "重新登录"){
-    //   //   window.location.href = 'http://wechatdimgs.vaiwan.com'
-    //   // }else{
-    //     console.log(process.env.APPID);
-    //     console.log(process.env.REDIRECT_URI);
-    //     var appid, redirect_uri, response_type, scope, state, wechat, agentid;
-    //     appid = 'ww4065f0d4bb232a6a';
-    //     redirect_uri = 'http%3A%2F%2Fwechatdings.vaiwan.com';
-    //     response_type = "code";
-    //     scope = "snsapi_privateinfo";
-    //     state = "a";
-    //     wechat = "#wechat_redirect";
-    //     let link =
-    //       "appid=" +
-    //       appid +
-    //       "&redirect_uri=" +
-    //       redirect_uri +
-    //       "&response_type=" +
-    //       response_type +
-    //       "&scope=" +
-    //       scope +
-    //       "&state=" +
-    //       state +
-    //       wechat;
-    //     window.location.href =
-    //       "https://open.weixin.qq.com/connect/oauth2/authorize?" + link;
-    //   // }
-    // },
-    isPcOrApp(){
-      if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
-        return 'app'
-      } else {
-        return 'pc'
-      }
-    },
-
-    clone() {
-      if (window.plus) {
-        plus.storage.clear()
-	      Cookies.remove('Admin-Token')
-      } else {
-        window.localStorage.clear()
-	      Cookies.remove('Admin-Token')
-      }
-    }
-  }
-};
-</script>
-
-<style rel="stylesheet/scss" lang="scss" scoped>
-.all {
-  margin: 0 auto;
-  position: relative;
-  top: 50%;
-  margin-top: -325px;
-}
-.login-box-parent{
-  position: relative;
-  width: 100vw;
-  height: 100vh;
-  overflow: auto;
-  cursor: default;
-  /* background-color: #f5f6f9; */
-  background-color: #FFF;
-}
-</style>

+ 0 - 172
src/components/user/login2.vue

@@ -1,172 +0,0 @@
-<template>
-  <div class="login-box-parent">
-    <div class="all" style="">
-      <div class="data-all" style="text-align:center;margin-top:50px;">
-        <transition name="fade">
-          <img
-            src="static/images/login300.png"
-            v-if="logImage"
-            style="margin:48px auto;width:104px;height:104px;"
-            alt=""
-          />
-          <img
-            src="static/images/init.gif"
-            v-if="!logImage"
-            style="margin:0 auto;"
-            alt=""
-          />
-        </transition>
-        <div>管理执行难,就用功道云</div>
-        <transition name="fade">
-          <van-button
-            class="refresh"
-            type="info"
-            @click="LoginBut"
-            v-show="loginButton"
-            style="border-radius:5px;margin-top:10px;"
-            >{{ logButText }}</van-button
-          >
-        </transition>
-      </div>
-    </div>
-  </div>
-</template>
-
-<script>
-import Vue from "vue";
-import { Divider } from "vant";
-import Cookies from 'js-cookie'
-
-import { getToken, setToken } from "@/utils/auth";
-
-import { wxAuth } from "@/utils/wx-auth-two.js";
-import Cookies from "js-cookie";
-import axios from "axios";
-Vue.use(Divider);
-export default {
-  name: "login1",
-  data() {
-    return {
-      logImage: true,
-      logButText: "登录",
-      loginButton: true
-    };
-  },
-  activated() {//activated()每次进入页面都会执行,代替created
-    var url = window.location.href; //获取url中"?"符后的字串
-    let codesif = false;
-    let codes = "";
-    if (url) {
-      if (url.split("?")[1]) {//判断有无?参数
-        var strs = url.split("?")[1].split("&");
-        for (var i = 0; i < strs.length; i++) {
-          if (strs[i].split("=")[0] == "code") {
-            this.loginButton = false;
-            this.logImage = false;
-            codesif = true;
-            codes = strs[i].split("=")[1].split("&")[0];
-          }
-        }
-      } else {//没有就清空缓存并放出登录按钮
-        this.clone();
-        this.loginButton = true;
-        this.logImage = true;
-      }
-    }
-
-    if (!codesif) {
-      this.logImage = true;
-      this.loginButton = true;
-    } else {
-        this.clone();
-      let params = { code: codes };
-      axios.get(process.env.BASE_API + "/api/wechat/minAuth", { params: params })
-        .then(res => {
-          if (res.data.code == 1) {
-            if (res.data.data.user.is_official == 1) {
-              setToken(res.data.data.token);
-              this.$store.commit("SET_USERINFO", res.data.data.user); // 设置员工信息
-              window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']))
-              window.sessionStorage.setItem('routers', '/')
-              console.log(getToken());
-              wxAuth(true);
-            } else if (res.data.data.user.is_official == 0) {
-              this.clone();
-              this.$router.push({name: 'noAccess',params: { status: 0 }})
-            }
-          } else if (res.data.code == 4444){
-            this.$router.push({name: 'noAccess',params: { status: 4444 }})
-          } else {
-            this.logButText = "重新登录";
-            this.loginButton = true;
-            this.logImage = true;
-          }
-        }).catch((err)=>{
-        });
-    }
-  },
-  mounted() {
-    console.log('登录页mounted')
-  },
-  watch: {},
-  methods: {
-    LoginBut() {
-      // if(this.logButText == "重新登录"){
-      //   window.location.href = 'http://wechatdimgs.vaiwan.com'
-      // }else{
-        console.log(process.env.APPID);
-        console.log(process.env.REDIRECT_URI);
-        var appid, redirect_uri, response_type, scope, state, wechat, agentid;
-        appid = 'ww4065f0d4bb232a6a';
-        redirect_uri = 'http%3A%2F%2Fwechatdings.vaiwan.com';
-        response_type = "code";
-        scope = "snsapi_privateinfo";
-        state = "a";
-        wechat = "#wechat_redirect";
-        let link =
-          "appid=" +
-          appid +
-          "&redirect_uri=" +
-          redirect_uri +
-          "&response_type=" +
-          response_type +
-          "&scope=" +
-          scope +
-          "&state=" +
-          state +
-          wechat;
-        window.location.href =
-          "https://open.weixin.qq.com/connect/oauth2/authorize?" + link;
-      // }
-    },
-
-    clone() {
-      if (window.plus) {
-        plus.storage.clear()
-	      Cookies.remove('Admin-Token')
-      } else {
-        window.localStorage.clear()
-	      Cookies.remove('Admin-Token')
-      }
-    }
-  }
-};
-</script>
-
-<style rel="stylesheet/scss" lang="scss" scoped>
-.all {
-  margin: 0 auto;
-  position: relative;
-  top: 50%;
-  margin-top: -325px;
-}
-.login-box-parent{
-  position: relative;
-  width: 100vw;
-  height: 100vh;
-  overflow: auto;
-  cursor: default;
-  /* background-color: #f5f6f9; */
-  background-color: #FFF;
-}
-</style>

+ 0 - 109
src/components/user/login3.vue

@@ -1,109 +0,0 @@
-<template>
-  <div class="login-box-parent">
-    <div class="all" style="">
-      <div class="data-all" style="text-align:center;margin-top:50px;">
-        <transition name="fade">
-          <!-- <img
-            src="/static/images/login300.png"
-            v-if="logImage"
-            style="margin:48px auto;width:104px;height:104px;"
-            alt=""
-          /> -->
-          <img
-            src="static/images/init.gif"
-            style="margin:0 auto;"
-            alt=""
-          />
-        </transition>
-        <div>管理执行难,就用功道云</div>
-        <!-- <transition name="fade">
-          <van-button
-            class="refresh"
-            type="info"
-            @click="LoginBut"
-            v-show="loginButton"
-            style="border-radius:5px;margin-top:10px;"
-            >{{ logButText }}</van-button
-          >
-        </transition> -->
-      </div>
-    </div>
-  </div>
-</template>
-
-<script>
-import Vue from "vue";
-import { Divider } from "vant";
-import Cookies from 'js-cookie'
-
-import request from '@/utils/request'
-import { getToken, setToken, cookGetToken } from "@/utils/auth";
-
-import { wxAuth } from "@/utils/wx-auth-two.js";
-import axios from "axios";
-Vue.use(Divider);
-export default {
-  name: "login1",
-  data() {
-    return {
-      logImage: true,
-      logButText: "登录",
-      loginButton: true
-    };
-  },
-  activated() {
-    console.log('进入登录页')
-    if(cookGetToken()){
-      setToken(cookGetToken());
-      this.detailAxiox(1)
-    }else{
-      console.log('无Token')
-      window.location.href = process.env.BASE_API;//重新授权
-    }
-  },
-  mounted() {
-  },
-  watch: {},
-  methods: {
-    detailAxiox(add){
-      request('get',process.env.BASE_API+'/api/employee/detail')
-      .then(res => {
-        if(res.data.code == 1){
-          if(res.data.data.user.is_official == 0){
-            this.$router.push({
-              path: '/noAccess',
-              query: {
-                msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'
-              }
-            })
-          }else if(add == 1){
-            this.$store.commit("SET_USERINFO", res.data.data.user); // 设置员工信息
-            window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']))
-            window.sessionStorage.setItem('routers', '/')
-            console.log(getToken());
-            wxAuth(true);
-          }
-        }
-      })
-    },
-  }
-};
-</script>
-
-<style rel="stylesheet/scss" lang="scss" scoped>
-.all {
-  margin: 0 auto;
-  position: relative;
-  top: 50%;
-  margin-top: -325px;
-}
-.login-box-parent{
-  position: relative;
-  width: 100vw;
-  height: 100vh;
-  overflow: auto;
-  cursor: default;
-  /* background-color: #f5f6f9; */
-  background-color: #FFF;
-}
-</style>

+ 2 - 12
src/main.js

@@ -5,21 +5,11 @@ import router from './router'
 import store from './store'
 import './permission'
 import './utils/validator'
-// import './utils/analytics'  //报错收集
 import '../css/reset.css'
 import echarts from 'echarts'
 
-// import Vconsole from 'vconsole'
-// Vue.use(new Vconsole())
 import VConsole from 'vconsole'
 new VConsole()
-// window.addEventListener("unhandledrejection",e=>{
-//   throw e.reason
-// })
-// window.addEventListener('error',e=>{
-//   console.log('error event:',e);
-//   return true
-// },true)
 
 import {
   Tabbar,Empty, TabbarItem,Grid, GridItem,Field,NavBar,Row, Col,Cell, CellGroup,Toast,Popup,Dialog,RadioGroup, Radio,Notify,
@@ -37,13 +27,14 @@ Vue.prototype.$getTypes = getTypes()
 Vue.prototype.$getCache = getCache
 Vue.prototype.$setCache = setCache
 Vue.prototype.$isPt_id = isPt_id
+Vue.prototype.$echarts = echarts
+Vue.prototype.$wx = (window).wx; // 全局使用
 
 // wx通讯录
 import wwOpenDAtas from '@/view/wxOpendata'
 Vue.component('Wxopendata', wwOpenDAtas)
 
 Vue.use(Button).use(Tabbar).use(TabbarItem).use(Grid).use(GridItem).use(Field).use(NavBar).use(Row).use(Col).use(Cell).use(CellGroup).use(Toast).use(Popup).use(Dialog).use(RadioGroup).use(Radio).use(Icon).use(Notify).use(Empty)
-Vue.prototype.$echarts = echarts
 Vue.use(VueScroller)
 Vue.component('icon', Icon1)
 Vue.component('noData', noData)
@@ -70,7 +61,6 @@ Vue.prototype.$route_back = function (setp) {
 }
 
 Vue.config.ignoredElements = ['ww-open-data'];
-Vue.prototype.$wx = (window).wx; // 全局使用
 
 window.VueObj = new Vue({
   el: '#app',

+ 0 - 12
src/permission.js

@@ -4,7 +4,6 @@ import router from './router'
 import store from './store'
 import request from '@/utils/request'
 import {getToken, setToken, cookGetToken} from '@/utils/auth'
-const whiteList = ['/login', '/reg', '/pwdforget'] // no redirect whitelist
 const stopPath = ['/login', '/noAccess', '/']
 import { wxAuth } from "@/utils/wx-auth-two.js";
 router.beforeEach((to, from, next) => {
@@ -40,17 +39,12 @@ router.beforeEach((to, from, next) => {
         }
       } else {
         window.location.href = process.env.BASE_API//直接重新授权
-        // next('/')
       }
     }
   }
 })
 
 function thens(to, from, next){
-  console.log('跳转后的path:')
-  console.log(to.path)
-  console.log('跳转前的path:')
-  console.log(from.path)
   if(to.name !== 'home'){
     window.document.title = window.$routes_map[to.name].label
   }
@@ -59,11 +53,7 @@ function thens(to, from, next){
   }
   // 初始一些数据
   init(to);
-  // next();
-  console.log('wxAuth12121221121221888')
-  console.log(router.history.current.name)
   wxAuth(false,next,to)
-
 }
 
 function init(to) {
@@ -83,8 +73,6 @@ function init(to) {
   store.dispatch('get_point_types').then(res => {}); //获取积分类型
   // 数据更新,每两分钟更新一次
   store.dispatch('get_employee_map').then((res) => {}); //获取人员列表
-  // store.dispatch('get_account_info').then((res) => {}); //获取公司信息
-
 }
 
 function detailAxiox(){

+ 0 - 114
src/permissionbf.js

@@ -1,114 +0,0 @@
-import Vue from 'vue'
-import Cookies from 'js-cookie'
-import router from './router'
-import store from './store'
-import request from '@/utils/request'
-import {getToken, setToken, cookGetToken} from '@/utils/auth'
-const whiteList = ['/login', '/reg', '/pwdforget'] // no redirect whitelist
-import { wxAuth } from "@/utils/wx-auth-two.js";
-router.beforeEach((to, from, next) => {
-  if (Vue.$httpRequestList.length > 0) { //强行中断时才向下执行
-    Vue.$httpRequestList.forEach(item => {
-      item('interrupt'); //给个标志,中断请求
-    })
-  }
-  if(to.path == '/noAccess' || to.path == '/login' || to.path == '/'){ 
-    next()
-    return
- }
-
-  if (cookGetToken()){//Cook中A-Token
-    setToken(cookGetToken())
-    detailAxiox()//员工详细信息
-    // Cookies.remove('Admin-Token')
-    Cookies.remove('Admin-Token')
-    thens(to, from, next)
-  } else if (getToken()) {//local中A-Token
-    console.log('无cook,走localStorage')
-    thens(to, from, next)
-  } else {
-      if (!window.$routes_map[to.name].need_login) { // 在免登录白名单,直接进入
-        if(to.name=='init'&&localStorage.getItem('init')){
-          // window.document.title = '用户登录'
-          next('/login')
-        }else{
-          if (typeof(window.$routes_map[to.name]) != 'undefined') {
-            window.document.title = window.$routes_map[to.name].label
-          }
-          next()
-        }
-      } else {
-        // window.document.title = '用户登录'
-        next('/login')
-      }
-  }
-})
-
-function thens(to, from, next){
-  // if (to.path == '/login'||to.name == 'init') { // 在免登录白名单,直接进入
-  //   next({ name: 'home'})
-  //   return false
-  // }
-  if (typeof(window.$routes_map[to.name]) != 'undefined') {
-    window.document.title = window.$routes_map[to.name].label
-  } else {
-    // window.document.title = '工作台'
-  }
-  console.log(window.$routes_map)
-  
-  console.log('跳转后的path:')
-  console.log(to.path)
-  console.log('跳转前的path:')
-  console.log(from.path)
-  //首页按返回到登录 或 初始化时--直接退出
-  if(to.path == '/login' && from.path == '/home' || to.path == '/init' && from.path == '/home' || to.path == '/' && from.path == '/home'){
-    wx.closeWindow();//关闭当前网页窗口
-    return false
-  }
-  
-  if (to.path == '/login' || to.name == 'init') { // 在免登录白名单,直接进入
-    next({ name: 'home'})
-  }
-  // 初始一些数据
-  init(to);
-  // next();
-  console.log('wxAuth12121221121221888')
-  console.log(router.history.current.name)
-  wxAuth(false,next,to)
-
-}
-
-function init(to) {
-  store.dispatch('get_user_info', getToken()).then((res) => { //获取用户信息
-    if (router.history.current.name == 'login' && to.name != 'home') {
-      router.push({
-        name: 'home'
-      })
-      return false
-    }
-    if (store.getters.user_info.try_user == 1) { //判断是否试用账号
-      store.dispatch("setBuyPopup",true);
-    }else{
-       store.dispatch("setBuyPopup",false);
-    }
-  });
-  store.dispatch('get_point_types').then(res => {}); //获取积分类型
-  // 数据更新,每两分钟更新一次
-  store.dispatch('get_employee_map').then((res) => {}); //获取人员列表
-  // store.dispatch('get_account_info').then((res) => {}); //获取公司信息
-
-}
-
-function detailAxiox(){
-  request('get',process.env.BASE_API+'/api/employee/detail')
-  .then(res => {
-    if(res.data.code == 1){
-      store.commit("SET_USERINFO", res.data.data.user); // 设置员工信息
-      window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']))
-      window.sessionStorage.setItem('routers', '/')
-      console.log(getToken());
-      console.log(JSON.parse(localStorage.getItem('user_info')))
-      console.log(store.getters.user_info)
-    }
-  })
-}

+ 1 - 1
src/router/index.js

@@ -20,7 +20,7 @@ let routes = [
   {
     path: '/login',
     name: 'login',
-    component: () => import('@/components/user/login3'),
+    component: () => import('@/components/user/login'),
     label: '用户登录',
     need_login: false
   },

+ 0 - 10
src/stcssrc.js

@@ -1,10 +0,0 @@
-// https://github.com/michael-ciniawsky/postcss-load-config
-
-module.exports = {
-  "plugins": {
-    "postcss-import": {},
-    "postcss-url": {},
-    // to edit target browsers: use "browserslist" field in package.json
-    "autoprefixer": {}
-  }
-}

+ 0 - 98
src/utils/analytics.js

@@ -1,98 +0,0 @@
-import html2canvas from 'html2canvas'
-import {
-  getToken,
-  getUserId
-} from '@/utils/auth'
-import Vue from 'vue'
-import request from '@/utils/request';
-(function() {
-  let tools = {
-    setImage(callback) {
-      if (window.plus) {
-        var ws = plus.webview.currentWebview()
-        var bitmap = new plus.nativeObj.Bitmap('test');
-        // 将webview内容绘制到Bitmap对象中
-        ws.draw(bitmap, function() {
-          callback(bitmap.toBase64Data());
-        }, function(e) {
-          console.log('截屏绘制图片失败:' + JSON.stringify(e));
-        });
-      } else {
-        html2canvas(document.body, {
-          useCORS: true
-        }).then(function(canvas) {
-          var extra_canvas = document.createElement("canvas");
-          var w = canvas.width
-          var h = canvas.height
-          extra_canvas.setAttribute('width', 320);
-          extra_canvas.setAttribute('height', (320 * h / w));
-          var ctx = extra_canvas.getContext('2d');
-          ctx.drawImage(canvas, 0, 0, canvas.width, canvas.height, 0, 0, 320, (320 * h / w));
-          var dataURL = extra_canvas.toDataURL();
-          callback(dataURL)
-        });
-      }
-    },
-    getBlob(canvas) { //获取blob对象
-      var data = canvas.toDataURL("image/jpeg", 0.1);
-      var dataurl = data
-      return dataurl
-    }
-  }
-
-  document.body.addEventListener('click', function(e) {
-    tools.setImage(function(image) {
-      var error_msg = ""
-      var user_token = getToken()
-      var user_id = getUserId()
-      let _canvas = document.body;
-      var timestamp = (new Date()).valueOf() / 1000;
-      var w = parseInt(window.getComputedStyle(_canvas).width);
-      var h = parseInt(window.getComputedStyle(_canvas).height);
-      request('post','/api/error/push', {
-        event_time: timestamp,
-        sw: w,
-        sh: h,
-        error_msg: error_msg,
-        image: image,
-        user_token: user_token,
-        user_id: user_id,
-        click_left: e.clientX,
-        click_top: e.clientY,
-        url: window.location.href
-      }).then((res) => {
-
-      })
-    })
-  }, false)
-
-
-  const errorHandler = (error, vm, info) => {
-    tools.setImage(function(image) {
-      var error_msg = ""
-      error_msg += "vm: " + vm.$vnode.tag + "\n"
-      error_msg += "URL: " + location.href + "\n"
-      error_msg += "Error: " + error.name + ':' + error.message + "" + info
-
-      var timestamp = (new Date()).valueOf() / 1000;
-      var user_token = getToken()
-      var user_id = getUserId()
-      let _canvas = document.body;
-      var w = parseInt(window.getComputedStyle(_canvas).width);
-      var h = parseInt(window.getComputedStyle(_canvas).height);
-
-      request('post','/api/error/push', {
-        event_time: timestamp,
-        sw: w,
-        sh: h,
-        error_msg: error_msg,
-        image: image,
-        user_token: user_token,
-        user_id: user_id,
-        url: window.location.href
-      }).then((res) => {})
-    })
-  }
-  Vue.config.warnHandler = errorHandler
-  Vue.config.errorHandler = errorHandler;
-})(window)

+ 0 - 4
src/utils/auth.js

@@ -37,10 +37,8 @@ export function getTypes(id) {
 export function getToken() {
   if (window.plus) {
     return plus.storage.getItem(TokenKey)
-    // return Cookies.get(TokenKey)
   } else {
     return localStorage.getItem(TokenKey)
-    // return Cookies.get(TokenKey)
   }
 }
 export function cookGetToken() {
@@ -60,12 +58,10 @@ export function setToken(token) {
     var timestamp = parseInt((new Date()).valueOf() / 1000)
     plus.storage.setItem('token-expire', timestamp + 7200)
     return plus.storage.setItem(TokenKey, token)
-    // return Cookies.set(TokenKey, token)
   } else {
     var timestamp = parseInt((new Date()).valueOf() / 1000)
     localStorage.setItem('token-expire', timestamp + 7200)
     return localStorage.setItem(TokenKey, token)
-    // return Cookies.set(TokenKey, token)
   }
 }
 

+ 0 - 220
src/utils/request-kq.js

@@ -1,220 +0,0 @@
-import axios from 'axios'
-import router from '@/router'
-import {
-  getToken,
-  getUserId,
-  setToken
-} from '@/utils/auth'
-import qs from 'qs'
-import Vue from 'vue'
-import Cookies from 'js-cookie'
-import {
-  Dialog,
-  Toast,
-  Notify
-} from 'vant'
-Vue.use(Dialog).use(Toast).use(Notify)
-
-
-const service = axios.create({
-  baseURL: process.env.BASE_API_KQ, // api的base_url
-  timeout: 10000,
-  headers: {
-    'Content-Type': 'application/x-www-form-urlencoded'
-  },
-  transformRequest: [function(data) {
-    // 对 data 进行任意转换处理
-    return qs.stringify(data)
-  }]
-})
-
-var bool = true; //五秒执行一次变量
-// request interceptor
-service.interceptors.request.use(
-  config => {
-    if (getToken()) {
-      config.headers['X-Token'] = getToken()
-    }
-    if (getToken()) {
-      config.headers['J-TOKEN'] = getToken()
-    }
-    return config
-  },
-  error => {
-    Promise.reject(error)
-  }
-)
-
-service.interceptors.response.use(
-  response => {
-    if (response.data.code === 1) {
-      if (response.data.refresh_token) {
-        if (response.data.refresh_token !== getToken()) {
-          localStorage.setItem('Admin-Token', response.data.refresh_token)
-        }
-      }
-      var timestamp = parseInt((new Date()).valueOf() / 1000)
-      if (window.plus) {
-        var temp_timestamp = plus.storage.getItem('token-expire')
-        if (temp_timestamp < timestamp && response.data.refresh_token) {
-          setToken(response.data.refresh_token)
-          plus.storage.setItem('token-expire', timestamp + 7200)
-        }
-      } else {
-        var temp_timestamp = localStorage.getItem('token-expire')
-        if (temp_timestamp < timestamp && response.data.refresh_token) {
-          setToken(response.data.refresh_token)
-          localStorage.setItem('token-expire', timestamp + 7200)
-        }
-      }
-      return response
-    } else if (response.data.code === 401) {
-      Dialog.alert({
-        message: '当前登录授权时间已经过期,请重新授权登录',
-      }).then(() => {
-        if (window.plus) {
-          plus.storage.clear()
-          Cookies.remove('Admin-Token')
-        } else {
-          window.localStorage.clear()
-          Cookies.remove('Admin-Token')
-        }
-        router.push({
-          name: 'login'
-        });
-      });
-    } 
-    // else if (response.data.code === 4444) {
-    //   Dialog.alert({
-    //     message: '您当前的套餐已到期,如需继续使用,请联系客服4006877880',
-    //   }).then(() => {
-    //     if (window.plus) {
-    //       plus.storage.clear()
-    //     } else {
-    //       window.localStorage.clear()
-    //     }
-    //     router.push({
-    //       name: 'login'
-    //     });
-    //   });
-    // } 
-    else if (response.data.code === 0) {
-      Notify({
-        message: response.data.msg,
-        color: '#ad0000',
-        background: '#d1d1d1',
-      });
-      return Promise.reject('error')
-    } else if (response.data.code === 2001) {
-      Notify({
-        message: response.data.msg,
-        color: '#ad0000',
-        background: '#ffe1e1',
-      });
-      return Promise.reject('error')
-    } else if (response.data.code === 999) {
-      Notify({
-        message: response.data.msg,
-        color: '#ad0000',
-        background: '#ffe1e1',
-      });
-      return Promise.reject('error')
-    } else if (response.data.code === 3000) {
-      Notify({
-        message: '服务暂时不可用,请稍后重试,或联系客服',
-        color: '#ad0000',
-        background: '#ffe1e1',
-      });
-      return Promise.reject('error')
-    } else if (response.data.code === 4444) { //系统过期
-      Dialog.alert({
-        title: '系统已到期',
-        message: "请在功道云积分服务群中联系客服顾问或电话咨询:<span class='color-blue'>400-6877-880</span>",
-        theme: 'round-button',
-      }).then(() => {
-        if (window.plus) {
-          plus.storage.clear()
-          Cookies.remove('Admin-Token')
-        } else {
-          window.localStorage.clear()
-          Cookies.remove('Admin-Token')
-        }
-        router.replace({name: 'login'});
-      });
-    } else {
-      return response
-    }
-  },
-  error => {
-    if (error.message == 'interrupt') {
-      return Promise.reject(error.message)
-    }
-    //五秒内只执行一次
-    if (bool) {
-      if (error.message == 'timeout of 10000ms exceeded') {
-        Notify({
-          type: 'warning',
-          message: "网络连接超时,请稍后重试",
-          duration: 3000,
-        });
-      }
-      if (error.message == 'Network Error') {
-        Notify({
-          type: 'danger',
-          message: "网络连接失败,请检查您的网络",
-          duration: 3000,
-        });
-      }
-      bool = false
-      setTimeout(() => {
-        bool = true
-      }, 5000)
-    }
-    return Promise.reject(error)
-  }
-)
-
-// 接口再次封装
-var CancelToken = axios.CancelToken; //中断请求
-Vue.$httpRequestList = [];
-export default (type, url, data, heaStr) => {
-  var Accept, Token = '';
-  switch (heaStr) {
-    case 'v2':
-      Accept = 'application/vnd.test.v2+json'
-      break;
-    case 'v3':
-      Accept = 'application/vnd.test.v3+json'
-      break;
-    case 'v4':
-      Accept = 'application/vnd.test.v4+json'
-      break;
-  }
-  return new Promise((resolve, reject) => { //封装ajax
-    var aa = {
-      method: type,
-      url: url,
-      headers: {
-        'Accept': Accept
-      },
-      cancelToken: new CancelToken(c => { //强行中断请求要用到的
-        Vue.$httpRequestList.push(c);
-      })
-    }
-    var json = (type == 'get') ? Object.assign(aa, {
-      params: data
-    }) : Object.assign(aa, {
-      data: data
-    });
-    var ajax = service(json).then(res => {
-      resolve(res);
-    }).catch(error => { //中断请求和请求出错的处理
-      if (error == "interrupt") {
-        return;
-      } else {
-        reject(error);
-      }
-    })
-    return ajax;
-  })
-};

+ 0 - 14
src/utils/request-user.js

@@ -59,20 +59,6 @@ request.interceptors.response.use(
         })
       });
     } 
-    // else if (response.data.code === 4444) {
-    //   Dialog.alert({
-    //     message: '您当前的套餐已到期,如需继续使用,请联系客服4006877880',
-    //   }).then(() => {
-    //     if (window.plus) {
-    //       plus.storage.clear()
-    //     } else {
-    //       window.localStorage.clear()
-    //     }
-    //     router.push({
-    //       name: 'login'
-    //     });
-    //   });
-    // } 
     else if (response.data.code === 0) {
       Notify({
         message: response.data.msg,

+ 8 - 57
src/utils/request.js

@@ -29,7 +29,6 @@ const service = axios.create({
 })
 
 var bool = true; //五秒执行一次变量
-// request interceptor
 service.interceptors.request.use(
   config => {
     if (getToken()) {
@@ -66,46 +65,14 @@ service.interceptors.response.use(
       }
       return response
     } else if (response.data.code === 401) {
-      // Dialog.alert({
-      //   message: '当前登录授权时间已经过期,请重新授权登录',
-      // }).then(() => {
-      //   Cookies.remove('Admin-Token')
-      //   if (window.plus) {
-      //     plus.storage.clear()
-      //   } else {
-      //     window.localStorage.clear()
-      //   }
-        // router.replace({
-        //   name: 'login'
-        // });
-        
-        if (window.plus) {
-          plus.storage.clear()
-        } else {
-          localStorage.clear()
-        }
-        Cookies.remove('Admin-Token')
-        window.location.href = process.env.BASE_API//直接重新授权
-        // router.replace({
-        //   name: 'init'
-        // });
-      // });
-    } 
-    // else if (response.data.code === 4444) {
-    //   Dialog.alert({
-    //     message: '您当前的套餐已到期,如需继续使用,请联系客服4006877880',
-    //   }).then(() => {
-    //     if (window.plus) {
-    //       plus.storage.clear()
-    //     } else {
-    //       window.localStorage.clear()
-    //     }
-    //     router.push({
-    //       name: 'login'
-    //     });
-    //   });
-    // } 
-    else if (response.data.code === 0) {
+      if (window.plus) {
+        plus.storage.clear()
+      } else {
+        localStorage.clear()
+      }
+      Cookies.remove('Admin-Token')
+      window.location.href = process.env.BASE_API //直接重新授权
+    } else if (response.data.code === 0) {
       Notify({
         message: response.data.msg,
         color: '#ad0000',
@@ -140,8 +107,6 @@ service.interceptors.response.use(
       } else {
         localStorage.clear()
       }
-      console.log('requser:4444')
-      console.log(response.data.msg)
       router.push({
         path: '/noAccess',
         query: {
@@ -149,20 +114,6 @@ service.interceptors.response.use(
         }
       })
       return Promise.reject('error')
-      // Dialog.alert({
-      //   title: '系统已到期',
-      //   message: "请在功道云积分服务群中联系客服顾问或电话咨询:<span class='color-blue'>400-6877-880</span>",
-      //   theme: 'round-button',
-      // }).then(() => {
-      //   if (window.plus) {
-      //     Cookies.remove('Admin-Token')
-      //     plus.storage.clear()
-      //   } else {
-      //     Cookies.remove('Admin-Token')
-      //     window.localStorage.clear()
-      //   }
-      //   router.replace({name: 'login'});
-      // });
     } else {
       return response
     }

+ 8 - 31
src/utils/wx-auth-two.js

@@ -1,16 +1,12 @@
-// import network from '@/network'; // 这个是自己项目里的网络层,用于调用接口
 import Vue from 'vue';
-import {
-  allocations
-} from '@/api/configget';
+import {allocations} from '@/api/configget';
 import Router from '@/router'
-// import {withoutCodeLoad} from '@/utils/wxconfiguration.js'
 import {
   getToken
 } from '@/utils/auth'
 let isfot = false
 export const wxAuth = async (ifHome, next, to) => {
-  if(isfot) return
+  if (isfot) return
   const wechatConfigUrl = location.href.split('#')[0]
   console.log('--获取url--')
   console.log(wechatConfigUrl)
@@ -24,12 +20,8 @@ export const wxAuth = async (ifHome, next, to) => {
           name: 'home'
         })
       } else {
-        console.log('走next()')
         if (next) {
-          console.log(to)
-          console.log(next)
           next()
-          console.log('111')
         }
       }
     }
@@ -52,10 +44,8 @@ async function wxConfigByCorp(ifHome, body, next) {
     if (res.data.code == 1) {
       console.log("--请求配置成功--")
       data = res.data.data
-    } else {}
-  }).catch(() => {
-    // withoutCodeLoad()
-  })
+    }
+  }).catch(() => {})
   const wxConfigParams = data.config
   const appSignature = data.agentConfig
   console.log(wxConfigParams)
@@ -78,10 +68,8 @@ async function wxConfigByCorp(ifHome, body, next) {
       'showOptionMenu'
     ] // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
   });
-  await Vue.prototype.$wx.ready(function () {
-    console.log('--wxConfig成功--')
+  await Vue.prototype.$wx.ready(function() {
     console.log('--wx.agentConfig开始--')
-    console.log('--wx.agentConfig:BEGIN--');
     const u = navigator.userAgent;
     const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // 安卓
     const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
@@ -94,19 +82,13 @@ async function wxConfigByCorp(ifHome, body, next) {
         nonceStr: appSignature.nonceStr, // 必填,生成签名的随机串
         signature: appSignature.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
         jsApiList: ['selectExternalContact'], //必填
-        success: function (res) { // 回调  //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+        success: function(res) { // 回调  //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
           console.log('--agentConfig成功--')
-          console.log('--回调--')
           console.log(res)
-          console.log('--window.WWOpenData--')
-          console.log(window.WWOpenData)
-          console.log(next)
           isfot = false
           if (next) {
             next()
           }
-          console.log(getToken())
-          console.log(ifHome)
           if (ifHome) {
             console.log('--跳转首页--')
             Router.push({
@@ -114,8 +96,8 @@ async function wxConfigByCorp(ifHome, body, next) {
             })
           }
         },
-        fail: function (res) {
-          console.log(res)
+        fail: function(res) {
+          console.log('fail'+res)
           if (res.errMsg.indexOf('function not exist') > -1) {
             alert('版本过低请升级')
           }
@@ -136,11 +118,6 @@ async function wxConfigByCorp(ifHome, body, next) {
         ], // 必填
         success(res) {
           console.log('agentConfig', res);
-          console.log('agentConfig成功')
-          console.log('回调')
-          console.log(res)
-          console.log('window.WWOpenData')
-          console.log(window.WWOpenData)
           isfot = false
           if (next) {
             next()

+ 3 - 1
src/view/wxOpendata.vue

@@ -13,7 +13,9 @@ export default {
     }
   },
   mounted() {
-    window.WWOpenData.bind(this.$el);
+    this.$nextTick(() => {
+      window.WWOpenData.bind(this.$el);
+    });
   },
 };
 </script>

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません