347617796@qq.com 2 лет назад
Родитель
Сommit
617304af8e

+ 2 - 12
config/dev.env.js

@@ -1,19 +1,9 @@
 module.exports = {
   NODE_ENV: '"development"',
   ENV_CONFIG: '"dev"',
-  // BASE_API: '"https://new.gdy.g107.com"',
-  // SERVE_AD: '"https://nkaoqin.g107.net"'
   
-  // BASE_API: '"http://test.qywx.g107.net"',
-  // BASE_API: '"http://qywx.1024win.cn"',
-
-  // BASE_API: '"http://test.qywx.g107.net"',//开发
-  BASE_API: '"https://qywx.g107.net"',//生产
+  BASE_API: '"http://test.qywx.g107.net"',//开发
+  // BASE_API: '"https://qywx.g107.net"',//生产
   SERVE_AD: '"https://nkaoqin.g107.net"',
-  // APPID: '"ww4065f0d4bb232a6a"',
   APPID: '"wwa8bbe3b687a632dd"',
-  // APPID: '"ww1d41fd7a34ed1a64"',//测试
-  // REDIRECT_URI: '"http%3A%2F%2Fwechatdings.vaiwan.com"',
-  // BASE_API: '"https://oa.g107.com"',
-  // SERVE_AD:'"https://ad.g107.com"'
 }

+ 1 - 0
package.json

@@ -6,6 +6,7 @@
   "license": "MIT",
   "scripts": {
     "dev": "cross-env BABEL_ENV=development webpack-dev-server --host 0.0.0.0 --inline --progress --config build/webpack.dev.conf.js",
+    "serve": "cross-env BABEL_ENV=development webpack-dev-server --host 0.0.0.0 --inline --progress --config build/webpack.dev.conf.js",
     "build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js",
     "build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js",
     "lint": "eslint --ext .js,.vue src",

+ 85 - 0
src/components/ShowDeptName.vue

@@ -0,0 +1,85 @@
+<template>
+  <div style="position: relative;">
+    <WWOpenData type="departmentName" :openid="dept_id" v-if="dept_id" class="WWOpenData"></WWOpenData>
+    <el-cascader :props="dept_props" v-model="dept_ids" :options="dept_tree" ref="dept" clearable placeholder="全公司">
+      <template slot-scope="{ node, data }">
+        <span><WWOpenData type="departmentName" :openid="data.name"></WWOpenData></span>
+      </template>
+    </el-cascader>
+  </div>
+</template>
+<script>
+export default {
+  name: 'ShowDeptName',
+  props: {
+    deptId: {
+      type:Number,
+      default:0,
+    }
+  },
+  data() {
+    return {
+      dept_id:0,
+      dept_ids:'',
+      dept_tree: [],
+      dept_props:{
+        label: 'name',
+        value: 'id',
+        checkStrictly: true
+      }
+    };
+  },
+  watch:{
+    dept_ids(val) {
+      this.dept_id =val.length>0? val[val.length-1]:0;
+      this.$nextTick(() => {
+        this.$refs.dept.dropDownVisible = false;
+        this.$emit('update:deptId',this.dept_id);
+        this.$emit('confirm',this.dept_id);
+      });
+    },
+  },
+  methods: {
+    // 递归判断列表,把最后的children设为undefined
+    getTreeData(data) {
+      for (var i = 0; i < data.length; i++) {
+        if (data[i].children.length < 1) {
+          // children若为空数组,则将children设为undefined
+          data[i].children = undefined;
+        } else {
+          // children若不为空数组,则继续 递归调用 本方法
+          this.getTreeData(data[i].children);
+        }
+      }
+      return data;
+    },
+  },
+  mounted() {
+    if (this.$getCache('dept_tree')) {
+      this.dept_tree = this.getTreeData(this.$getCache('dept_tree'));
+    }
+  }
+};
+</script>
+
+<style scoped="scoped" lang="scss">
+.WWOpenData {
+  color: #606266;
+  pointer-events: none;
+
+  position: absolute;
+  z-index: 9;
+  margin-top: 1px;
+  margin-left: 1px;
+  box-sizing: border-box;
+  background-color: #fff;
+  right: 30px;
+  left: 15px;
+  height: 34px;
+  line-height: 34px;
+  overflow: hidden;
+  cursor: pointer;
+  border-radius: 4px;
+  white-space:nowrap
+}
+</style>

+ 0 - 1
src/components/user_image.vue

@@ -63,7 +63,6 @@
     // 数据
     data(){
       let info = this.$store.getters.employee_map[this.id] || {name:'',img_url: '',id:0}
-       console.log("q撒旦轻松的"+JSON.stringify(info))
       if(this.img_url != ''){
         info.img_url = this.img_url
       }

+ 11 - 2
src/main.js

@@ -9,15 +9,16 @@ import axios_user from '@/utils/request-user'
 import App from './App'
 import router from './router'
 import store from './store'
-import {getToken, getEmployeeMap} from '@/utils/auth'
+import {getToken, getEmployeeMap,getCache,setCache,removeCache} from '@/utils/auth'
 import {supremeAuthority ,authoritys , getUserData, getTypsName} from './api/auth';
-
+import downloadFile from '@/utils/downloadFile'
 import i18n from './lang' // Internationalization
 import './icons' // icon
 import './permission' // permission control
 import * as filters from '@/utils/filters' // global filters
 import jtoken from '@/utils/Jtoken'
 
+
 // import VConsole from 'vconsole'
 // new VConsole()
 
@@ -31,11 +32,16 @@ Vue.component('WWOpenData', WWOpenDatas)
 import deptData from '@/components/deptData.vue'
 Vue.component('deptData', deptData)
 
+// 选择部门的选中内容覆盖
+import ShowDeptName from '@/components/ShowDeptName.vue'
+Vue.component('ShowDeptName', ShowDeptName)
+
 Vue.use(Element, {
   size: 'medium',
   i18n: (key, value) => i18n.t(key, value)
 })
 
+Vue.prototype.$downloadFile = downloadFile
 Vue.prototype.$getToken = getToken()
 Vue.prototype.$http = request
 Vue.prototype.$http_user = axios_user
@@ -49,6 +55,9 @@ Vue.prototype.$getTypsName = getTypsName
 Vue.prototype.$getEmployeeMap = getEmployeeMap
 Vue.prototype.$userInfo = getUserData
 Vue.prototype.$wx = (window).wx; // 全局使用
+Vue.prototype.$getCache = getCache
+Vue.prototype.$setCache = setCache
+Vue.prototype.$removeCache = removeCache
 
 Object.keys(filters).forEach(key => {
   Vue.filter(key, filters[key])

+ 1 - 1
src/permission.js

@@ -119,5 +119,5 @@ function init(to, next) {
 }
 
 router.afterEach((to, from) => {
-  console.log("当前页面" + to.name)
+  // console.log("当前页面" + to.name)
 })

+ 172 - 0
src/utils/FileSaver.js

@@ -0,0 +1,172 @@
+/*
+* FileSaver.js
+* A saveAs() FileSaver implementation.
+*
+* By Eli Grey, http://eligrey.com
+*
+* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)
+* source  : http://purl.eligrey.com/github/FileSaver.js
+*/
+
+// The one and only way of getting global scope in all environments
+// https://stackoverflow.com/q/3277182/1008999
+var _global = typeof window === 'object' && window.window === window
+  ? window : typeof self === 'object' && self.self === self
+  ? self : typeof global === 'object' && global.global === global
+  ? global
+  : this
+
+function bom (blob, opts) {
+  if (typeof opts === 'undefined') opts = { autoBom: false }
+  else if (typeof opts !== 'object') {
+    console.warn('Deprecated: Expected third argument to be a object')
+    opts = { autoBom: !opts }
+  }
+
+  // prepend BOM for UTF-8 XML and text/* types (including HTML)
+  // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
+  if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
+    return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type })
+  }
+  return blob
+}
+
+function download (url, name, opts) {
+  var xhr = new XMLHttpRequest()
+  xhr.open('GET', url)
+  xhr.responseType = 'blob'
+  xhr.onload = function () {
+    saveAs(xhr.response, name, opts)
+  }
+  xhr.onerror = function () {
+    console.error('could not download file')
+  }
+  xhr.send()
+}
+
+function corsEnabled (url) {
+  var xhr = new XMLHttpRequest()
+  // use sync to avoid popup blocker
+  xhr.open('HEAD', url, false)
+  try {
+    xhr.send()
+  } catch (e) {}
+  return xhr.status >= 200 && xhr.status <= 299
+}
+
+// `a.click()` doesn't work for all browsers (#465)
+function click (node) {
+  try {
+    node.dispatchEvent(new MouseEvent('click'))
+  } catch (e) {
+    var evt = document.createEvent('MouseEvents')
+    evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,
+                          20, false, false, false, false, 0, null)
+    node.dispatchEvent(evt)
+  }
+}
+
+// Detect WebView inside a native macOS app by ruling out all browsers
+// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too
+// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos
+var isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent)
+
+var saveAs = _global.saveAs || (
+  // probably in some web worker
+  (typeof window !== 'object' || window !== _global)
+    ? function saveAs () { /* noop */ }
+
+  // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView
+  : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView)
+  ? function saveAs (blob, name, opts) {
+    var URL = _global.URL || _global.webkitURL
+    // Namespace is used to prevent conflict w/ Chrome Poper Blocker extension (Issue #561)
+    var a = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')
+    name = name || blob.name || 'download'
+
+    a.download = name
+    a.rel = 'noopener' // tabnabbing
+
+    // TODO: detect chrome extensions & packaged apps
+    // a.target = '_blank'
+
+    if (typeof blob === 'string') {
+      // Support regular links
+      a.href = blob
+      if (a.origin !== location.origin) {
+        corsEnabled(a.href)
+          ? download(blob, name, opts)
+          : click(a, a.target = '_blank')
+      } else {
+        click(a)
+      }
+    } else {
+      // Support blobs
+      a.href = URL.createObjectURL(blob)
+      setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s
+      setTimeout(function () { click(a) }, 0)
+    }
+  }
+
+  // Use msSaveOrOpenBlob as a second approach
+  : 'msSaveOrOpenBlob' in navigator
+  ? function saveAs (blob, name, opts) {
+    name = name || blob.name || 'download'
+
+    if (typeof blob === 'string') {
+      if (corsEnabled(blob)) {
+        download(blob, name, opts)
+      } else {
+        var a = document.createElement('a')
+        a.href = blob
+        a.target = '_blank'
+        setTimeout(function () { click(a) })
+      }
+    } else {
+      navigator.msSaveOrOpenBlob(bom(blob, opts), name)
+    }
+  }
+
+  // Fallback to using FileReader and a popup
+  : function saveAs (blob, name, opts, popup) {
+    // Open a popup immediately do go around popup blocker
+    // Mostly only available on user interaction and the fileReader is async so...
+    popup = popup || open('', '_blank')
+    if (popup) {
+      popup.document.title =
+      popup.document.body.innerText = 'downloading...'
+    }
+
+    if (typeof blob === 'string') return download(blob, name, opts)
+
+    var force = blob.type === 'application/octet-stream'
+    var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari
+    var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent)
+
+    if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') {
+      // Safari doesn't allow downloading of blob URLs
+      var reader = new FileReader()
+      reader.onloadend = function () {
+        var url = reader.result
+        url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')
+        if (popup) popup.location.href = url
+        else location = url
+        popup = null // reverse-tabnabbing #460
+      }
+      reader.readAsDataURL(blob)
+    } else {
+      var URL = _global.URL || _global.webkitURL
+      var url = URL.createObjectURL(blob)
+      if (popup) popup.location = url
+      else location.href = url
+      popup = null // reverse-tabnabbing #460
+      setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s
+    }
+  }
+)
+
+_global.saveAs = saveAs.saveAs = saveAs
+
+if (typeof module !== 'undefined') {
+  module.exports = saveAs;
+}

+ 25 - 0
src/utils/auth.js

@@ -7,6 +7,31 @@ const ATOKEN = 'atoken'
 const USER = 'user'
 const PASW = 'pasw'
 
+// 获取缓存
+export function getCache(key) {
+	return JSON.parse(localStorage.getItem(key))
+}
+
+// 设置缓存
+export function setCache(key, data) {
+	localStorage.setItem(key, JSON.stringify(data))
+}
+
+// 清除缓存
+export function removeCache(key) {
+  if(typeof (key) === 'string'){
+    	localStorage.removeItem(key)
+  }else{
+    if(key.length>0){
+      key.forEach(item=>{
+        localStorage.removeItem(item)
+      })
+    }
+  }
+}
+
+
+
 // 获取用户列表
 export function getEmployeeMap() {
   return JSON.parse(localStorage.getItem('SET_EMPLOYEE_MAP'))

+ 52 - 0
src/utils/downloadFile.js

@@ -0,0 +1,52 @@
+
+import Vue from 'vue'
+import { Message, MessageBox,Loading  } from 'element-ui'
+import {setCache} from '@/utils/auth'
+import axios from '@/utils/request'
+// import FileSaver from '@/utils/FileSaver'
+
+import VueRouter from 'vue-router'
+var deriveJobId='';
+var circulation=0;
+var loadingInstance
+export default function downloadFile(url, params,routerPath){
+    MessageBox.confirm('确认导出排名?', '导出', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    }).then(() => {
+          // loadingInstance = Loading.service({});
+          // setCache('routerPath',routerPath)
+          axios('get',url,params).then(res => {
+              // deriveJobId = res.data.data.job_id;
+              // downloadResult();
+              Message.success('已导出,请留意消息通知');
+          });
+    }).catch(() => {});
+}
+function downloadResult() {
+    axios('get', '/api/download/result', {job_id:deriveJobId}).then(res => {
+        let urla=res.data.data.url
+        if(url){
+          loadingInstance.close();
+          try{
+            var oReq = new XMLHttpRequest();
+            oReq.open("GET", urla, true);
+            oReq.responseType = "blob";
+            oReq.onload = function() {
+                var file = new Blob([oReq.response], {type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
+                // FileSaver.saveAs(file, "");
+            };
+            oReq.send();
+            // var elemIF=document.createElement('iframe')
+            // elemIF.src=url;
+            // elemIF.style.display='none';
+            // document.body.appendChild(elemIF)
+          }catch(e){
+            message.warning('导出异常');
+          }
+        }else{
+          downloadResult();
+        }
+    });
+};

+ 29 - 8
src/utils/filters.js

@@ -1,5 +1,9 @@
 // set function parseTime,formatTime to filter
-export { parseTime, formatTime } from '@/utils'
+export {
+  parseTime,
+  formatTime
+}
+from '@/utils'
 
 function pluralize(time, label) {
   if (time === 1) {
@@ -21,13 +25,30 @@ export function timeAgo(time) {
 
 /* 数字 格式化*/
 export function numberFormatter(num, digits) {
-  const si = [
-    { value: 1E18, symbol: 'E' },
-    { value: 1E15, symbol: 'P' },
-    { value: 1E12, symbol: 'T' },
-    { value: 1E9, symbol: 'G' },
-    { value: 1E6, symbol: 'M' },
-    { value: 1E3, symbol: 'k' }
+  const si = [{
+      value: 1E18,
+      symbol: 'E'
+    },
+    {
+      value: 1E15,
+      symbol: 'P'
+    },
+    {
+      value: 1E12,
+      symbol: 'T'
+    },
+    {
+      value: 1E9,
+      symbol: 'G'
+    },
+    {
+      value: 1E6,
+      symbol: 'M'
+    },
+    {
+      value: 1E3,
+      symbol: 'k'
+    }
   ]
   for (let i = 0; i < si.length; i++) {
     if (num >= si[i].value) {

+ 9 - 9
src/utils/wx-auth-two.js

@@ -10,11 +10,11 @@ import moment from 'moment' // 时间库
 export const wxAuth = async (pushindex, next) => {
   const wechatConfigUrl = location.href.split('#')[0]
   // const wechatConfigUrl = location.href.split("?")[1].split("=")[1]
-  console.log('获取url')
-  console.log(location.href)
-  console.log(wechatConfigUrl)
-  console.log(window.wechatConfigUrl)
-  console.log(window.WWOpenData)
+  // console.log('获取url')
+  // console.log(location.href)
+  // console.log(wechatConfigUrl)
+  // console.log(window.wechatConfigUrl)
+  // console.log(window.WWOpenData)
   if (window.wechatConfigUrl === wechatConfigUrl && window.WWOpenData) {
     if (next) {
       next()
@@ -46,7 +46,7 @@ async function wxConfigByCorp(body, pushindex, next) {
   const appSignature = data.agentConfig
   // console.log(wxConfigParams)
   // console.log(appSignature)
-  console.log('wxConfig开始')
+  // console.log('wxConfig开始')
   // console.log(Vue.prototype.$wx)
   await Vue.prototype.$wx.config({ // 鉴权(企业的身份与权限)
     beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
@@ -66,9 +66,9 @@ async function wxConfigByCorp(body, pushindex, next) {
     ] // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
   });
   await Vue.prototype.$wx.ready(function () {
-    console.log('wxConfig成功')
-    console.log('wx.agentConfig开始')
-    console.log('wx.agentConfig:BEGIN');
+    // console.log('wxConfig成功')
+    // 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终端

+ 24 - 96
src/views/dashboard/index.vue

@@ -150,22 +150,7 @@
           <el-row style="position: relative;">
             <el-col :span="24"><b class="title" style="margin-bottom:15px;display:block">积分构成</b></el-col>
             <el-col :span="5" style="position: absolute;top:40px;left:10px;z-index: 1;" v-if="!employeeRout">
-              <deptData v-if="toPdept1 && toPdept1 != 0" :refsName="$refs.dept1" :toPdept="toPdept1"></deptData>
-              <el-cascader
-                v-model="dept_name1"
-                :options="dept_tree"
-                :props="{ label: 'name', value: 'id' }"
-                @change="dept1_null"
-                ref="dept1"
-                filterable
-                change-on-select
-                placeholder="请选择部门"
-                clearable
-              >
-                <template slot-scope="{ node, data }">
-                  <span><WWOpenData type="departmentName" :openid="data.name"></WWOpenData></span>
-                </template>
-              </el-cascader>
+                <ShowDeptName @confirm="deptConfirm1"></ShowDeptName>
             </el-col>
             <div v-loading="IntegralFormChartLoad">
               <div class="nopoint_box" style="height:340px;" v-show="IntegralFormnone">
@@ -188,22 +173,7 @@
             </el-col>
             <div v-loading="monthlyIntegralloading">
               <el-col :span="5" style="position: absolute;top:40px;left:10px;z-index: 1;" v-if="!employeeRout">
-                <deptData v-if="toPdept2 && toPdept2 != 0" :refsName="$refs.dept2" :toPdept="toPdept2"></deptData>
-                <el-cascader
-                  v-model="dept_name2"
-                  :options="dept_tree"
-                  :props="{ label: 'name', value: 'id' }"
-                  @change="monthlyIntegralchange"
-                  ref="dept2"
-                  filterable
-                  change-on-select
-                  placeholder="请选择部门"
-                  clearable
-                >
-                  <template slot-scope="{ node, data }">
-                    <span><WWOpenData type="departmentName" :openid="data.name"></WWOpenData></span>
-                  </template>
-                </el-cascader>
+                <ShowDeptName @confirm="deptConfirm2"></ShowDeptName>
               </el-col>
 
               <div class="nopoint_box" style="height:400px;" v-if="monthlyIntegralnone">
@@ -236,22 +206,7 @@
             <el-col :span="24"><b class="title" style="margin-bottom:15px;display:block">当月管理者奖扣任务执行情况</b></el-col>
             <div v-loading="ManagerSAwardloading">
               <el-col :span="5" style="position: absolute;top:40px;left:10px;z-index: 1;">
-                <deptData v-if="toPdept3 && toPdept3 != 0" :refsName="$refs.dept3" :toPdept="toPdept3"></deptData>
-                <el-cascader
-                  v-model="dept_name3"
-                  :options="dept_tree"
-                  :props="{ label: 'name', value: 'id' }"
-                  @change="ManagerSAwardlchange"
-                  ref="dept3"
-                  filterable
-                  change-on-select
-                  placeholder="请选择部门"
-                  clearable
-                >
-                  <template slot-scope="{ node, data }">
-                    <span><WWOpenData type="departmentName" :openid="data.name"></WWOpenData></span>
-                  </template>
-                </el-cascader>
+                <ShowDeptName @confirm="deptConfirm3"></ShowDeptName>
               </el-col>
               <div class="nopoint_box" style="height:400px;" v-if="ManagerSAwardnone">
                 <div class="noimg" style="width: 150px;height: 170px;margin-top:90px;"></div>
@@ -349,12 +304,9 @@
             <div v-else style="display:flex;padding-bottom:20px;">
               <userImage width="45px" height="45px" :id="prize.id" :user_name="prize.name" :img_url="prize.img_url" fontSize="16" style="margin-right:8px"></userImage>
               <div class="rightexamineAndApproveList" style="border:0px">
-                <p style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;justify-content: space-between;">
-                  <b style="color:#303133;font-size:16px;"><WWOpenData type="userName" :openid="prize.name"></WWOpenData></b>
-                  <span style="color:#26A2FF;font-size:16px;">
-                    <span v-if="prize.point > 0">+</span>
-                    {{ prize.point }} B分
-                  </span>
+                <p style="font-size:16px;width: 200px;" class="font-flex-word">
+                  <b><WWOpenData type="userName" :openid="prize.name"></WWOpenData></b>
+                  <span class="blue"><span v-if="prize.point > 0">+</span>{{ prize.point }} B分</span>
                 </p>
                 <p
                   style="font-size:13px;line-height:20px;color:rgb(48, 49, 51);overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:3; "
@@ -376,13 +328,18 @@
             <div v-else style="display:flex">
               <userImage width="45px" height="45px" :id="buckle.id" :user_name="buckle.name" :img_url="prize.img_url" style="margin-right:8px"></userImage>
               <div class="rightexamineAndApproveList">
-                <p style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;justify-content: space-between;">
-                  <b style="color:#303133;font-size:16px;"><WWOpenData type="userName" :openid="buckle.name"></WWOpenData></b>
-                  <span style="color:#FF9600;font-size:16px;">{{ buckle.point }} B分</span>
+                <p style="font-size:16px;width: 200px;" class="font-flex-word" >
+                  <b ><WWOpenData type="userName" :openid="buckle.name"></WWOpenData></b>
+                  <span class="red">{{ buckle.point }} B分</span>
                 </p>
-                <p
-                  style="font-size:13px;line-height:20px;color:rgb(48, 49, 51);overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:3; "
-                >
+                <p style="
+                  font-size:13px;
+                  line-height:20px;color:rgb(48, 49, 51);
+                  overflow:hidden;
+                  text-overflow:ellipsis;
+                  display:-webkit-box;
+                  -webkit-box-orient:vertical;
+                  -webkit-line-clamp:3;">
                   {{ buckle.remark ? buckle.remark.customize : '' }}
                 </p>
               </div>
@@ -820,17 +777,8 @@ export default {
         myChart.setOption(option);
       }
     },
-    ManagerSAwardlchange(val) {
-      //选中规则
-      this.toPdept3 = val[val.length - 1];
-      let valItem = 0;
-      for (let i in val) {
-        valItem = val[i];
-      }
-      this.ManagerSAward(valItem);
-      this.$nextTick(() => {
-        this.$refs.dept3.dropDownVisible = false;
-      });
+    deptConfirm3(val) {
+      this.ManagerSAward(val);
     },
     ManagerSAward(item) {
       //管理者奖扣请求
@@ -943,21 +891,9 @@ export default {
       }
     },
     //月度积分
-    monthlyIntegralchange(val) {
-      this.toPdept2 = val[val.length - 1];
-      if (val.length == 0) {
-        this.exclusiveMonthBranch = 0;
-      } else {
-        let valItem = 0;
-        for (let i in val) {
-          valItem = val[i];
-        }
-        this.exclusiveMonthBranch = valItem;
-      }
-      this.monthlyIntegral();
-      this.$nextTick(() => {
-        this.$refs.dept2.dropDownVisible = false;
-      });
+    deptConfirm2(val) {
+      this.exclusiveMonthBranch = val;
+      this.monthlyIntegral()
     },
     monthlyIntegral() {
       this.monthlyIntegralloading = true;
@@ -1013,16 +949,8 @@ export default {
         });
     },
     //积分构成
-    dept1_null(val) {
-      this.toPdept1 = val[val.length - 1];
-      let valItem = 0;
-      for (let i in val) {
-        valItem = val[i];
-      }
-      this.integralForm(valItem);
-      this.$nextTick(() => {
-        this.$refs.dept1.dropDownVisible = false;
-      });
+    deptConfirm1(val) {
+      this.integralForm(val);
     },
     //分为两列展示,多传legendDataTwo
     drawLine(legendDataOne, legendDataTwo, dadalist) {

+ 11 - 2
src/views/layout/Layout.vue

@@ -66,6 +66,15 @@
     },
     watch:{
       $route(to,from){//当点击首页或刚进入时,左边导航栏不显示
+        this.$nextTick(() => {
+            let routerPath=this.$getCache('routerPath');
+            if(routerPath){
+              this.$router.replace({ path: routerPath })
+              this.$removeCache('routerPath')
+              return false
+            }
+        });
+
         if(to.path === '/index' || to.path === '/workbench_blank'){
           this.show_sidebar = false
         }else{
@@ -105,8 +114,8 @@
 
   .main-content{
     background-color:rgba(244, 246, 249, 1);
-    padding-top: 60px; 
-    height: 100%; 
+    padding-top: 60px;
+    height: 100%;
     overflow-y: scroll;
   }
 

+ 7 - 29
src/views/statistics_new/balanceA.vue

@@ -9,33 +9,13 @@
 
 		<div class="box">
       <el-tabs v-model="active" type="card">
-        <el-tab-pane label="A分余额" name="balanceA">
-        </el-tab-pane>
-        <el-tab-pane label="清空记录" name="clearLog">
-        </el-tab-pane>
+        <el-tab-pane label="A分余额" name="balanceA" :disabled="loading"></el-tab-pane>
+        <el-tab-pane label="清空记录" name="clearLog" :disabled="loading"></el-tab-pane>
       </el-tabs>
 
 			<el-form :inline="true" v-if="active == 'balanceA'">
 				<el-form-item label="部门">
-				<deptData  deptStyle="height:24px;line-height:24px;margin-top:7px;" v-if="toPdept && toPdept!=0" :refsName="$refs.dept" :toPdept="toPdept"></deptData>
-          <el-cascader
-            class="date-picker-width"
-            v-model="dept_name"
-            :options="dept_tree"
-			:props="{ label: 'name', value: 'id'}"
-            ref="dept"
-            clearable
-            filterable
-            change-on-select
-            placeholder="全公司"
-          >
-		  	<template slot-scope="{ node, data }">
-                <span>
-                  <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-                </span>
-                <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-              </template>
-		  </el-cascader>
+            <ShowDeptName :deptId.sync="formData.dept_id"></ShowDeptName>
 				</el-form-item>
 
 				<el-form-item>
@@ -143,7 +123,7 @@
 				dept_name: '',
 				formData:{
 					keyword: '',
-					dept_id: '0',
+					dept_id: 0,
 					page: 1,
 					page_size: 10,
 				},
@@ -155,17 +135,15 @@
       }
 		},
 		watch:{
-			dept_name(val){
-      			this.toPdept = val[val.length-1]
-				this.formData.dept_id = val[val.length - 1]
-				this.$refs.dept.dropDownVisible = false;
+			'formData.dept_id'(val){
+        this.formData.page=1;
 				this.getList()
 			},
 			active(val){
 				this.list = []
 				this.formData = {
 					keyword: '',
-					dept_id: '0',
+					dept_id: 0,
 					page: 1,
 					page_size: 10,
 				}

+ 18 - 68
src/views/statistics_new/custom_rank.vue

@@ -63,7 +63,10 @@
 							placeholder="全部规则分类"
 						></el-cascader>
 					</el-form-item> -->
-          <el-form-item><el-checkbox v-model="sort" size="medium" label="由低到高" border></el-checkbox></el-form-item>
+          <el-form-item>
+            <el-checkbox v-model="sort" size="medium" label="由低到高" border></el-checkbox>
+            <el-button class="company_intergral_button" @click="export_all" type="primary" plain style="margin-left: 10px;">导出报表</el-button>
+          </el-form-item>
           <el-alert
             v-if="lastUpdateTime != undefined || lastUpdateTime"
             :title="
@@ -129,16 +132,6 @@
               <WWOpenData type="userName" :openid="item.name"></WWOpenData><span v-if="(employeeNames.length-index)>1">,</span>
             </span>
           </div>
-          <!-- <EmployeeSelector
-            :employee_not_select="employee_not_select"
-            :can_select_employee="true"
-            :can_select_dept="false"
-            :selected="employees_selected"
-            :close_clear_data="false"
-            :visible.sync="show_employee_selector"
-            @confirm="move_employee_confirm"
-            :isChecKedAll="true"
-          /> -->
           <EmployeeSelector
             :employee_not_select="employee_not_select"
             :selected="employees_selected"
@@ -148,36 +141,12 @@
             :isChecKedAll="true"
           />
         </el-form-item>
-
-        <!-- <el-form-item
-          label="规则分类"
-          label-width="85px"
-          :required="true"
-          :show-message="false"
-        >
-          <el-cascader
-            class="date-picker-width"
-            :popper-class="'itemClass'"
-            :options="rule_trees"
-            :props="props"
-            @change="rule_null"
-            v-model="newGroupFormRules"
-            collapse-tags
-            remove-tag
-            clearable
-            placeholder="全部规则分类"
-          ></el-cascader>
-        </el-form-item> -->
-
         <el-form-item label="积分规则" :required="true">
           <el-input auto-complete="off" v-model="newGroupFormRules" placeholder="全部规则分类"></el-input>
           <div @click="ruleDialogTableVisibles" style="height:36px; position: absolute; top: 0; right: 0; left: 0; bottom: 0; z-index: 9;cursor:pointer"></div>
           <div style="margin-bottom:12px;">
             <span style="font-size:13px;color:rgb(138 138 138);position: absolute; top: 30px; left: 0;">{{ruleHint}}</span>
           </div>
-          <!-- <Selectionrules
-            :visible.sync="ruleDialogTableVisible"
-          ></Selectionrules> -->
           <el-dialog title="选择规则" width="952px" :visible.sync="ruleDialogTableVisible" @close="closeNone" append-to-body :before-close="handleClose">
             <div style="display:flex;position: relative;width:100%;height:40px">
               <span style="position: absolute;line-height:40px;left:20px">已选:{{ valuesOrLength.length }}条</span>
@@ -246,26 +215,6 @@
         <el-button type="primary" :loading="saveLoad" @click="subGroupForm('newGroupForm')">确 定</el-button>
       </div>
     </el-dialog>
-
-    <!--
-		<el-form :inline="true">
-			<el-form-item label="部门">
-				<el-cascader
-					class="date-picker-width"
-					v-model="dept_name"
-					:options="dept_tree"
-					ref="dept"
-					clearable
-					filterable
-					change-on-select
-					placeholder="全公司"
-				></el-cascader>
-			</el-form-item>
-			<el-form-item>
-				<el-checkbox v-model="allPass" size="medium" label="排名由低到高" border></el-checkbox>
-			</el-form-item>
-		</el-form>
-		-->
     </div>
 </template>
 <script>
@@ -356,12 +305,6 @@ export default {
       groupShow: false,
       rules: {
         group_name: [{ required: true, message: '请输入分组名称', trigger: 'blur' }, { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }]
-        // employees:[
-        // 	{ required: true, message: '请选择成员', trigger: 'blur' },
-        // ],
-        // rule_null_trees:[
-        // 	{required: false, message: '请选择规则分类', trigger: 'blur'}
-        // ]
       },
       newGroupForm: {
         group_name: '',
@@ -392,13 +335,6 @@ export default {
       this.params.page = 1;
       this.open_right(this.clickItem);
     },
-    // "time.quarter"(val, old_val) {
-    //   console.log(val)
-    //   console.log(old_val)
-    //   this.params.quarter = val
-    //   // this.params.page = 1;
-    //   // this.open_right(this.clickItem);
-    // },
     sort(val) {
       this.params.page = 1;
       val ? (this.params.sort = 'desc') : (this.params.sort = 'asc');
@@ -429,6 +365,20 @@ export default {
   },
   components: { EmployeeSelector, Selectionrules, Season },
   methods: {
+    export_all() {
+      let months;
+      if (this.newGroupForm.date_interval == '1') {
+        months = this.time.month.replace('-', '');
+      }
+      let data=this.newGroupForm.date_interval == '1' ? months : this.newGroupForm.date_interval == '2' ? this.time.quarter : this.newGroupForm.date_interval == '3' ? this.time.year : '';
+      let params = {
+       employee_id: this.$userInfo().id,
+       group_id:this.clickItem.id,
+       sort:this.params.sort,
+       date:data,
+      }
+      this.$downloadFile('api/download/group/rank',params,this.$route.path);
+    },
     // 提示信息
     tips_close() {
       localStorage.setItem("dept_rank_tips", "true");

+ 20 - 68
src/views/statistics_new/department_statistics.vue

@@ -1,31 +1,9 @@
 <template>
   <div>
       <el-row  :span="24" style="padding: 20px;background: #fff;border:1px #e1e4e7 solid;box-shadow: 0 2px 4px rgba(140,140,140,0.1);">
-        <!-- <el-form :inline="true"> -->
-          <!-- <el-form-item label="部门"> -->
             <el-col :span="5" style="position: relative;">
-              <deptData  v-if="toPdept1 && toPdept1!=0" :refsName="$refs.dept1" :toPdept="toPdept1"></deptData>
-              <el-cascader
-                v-model="dept_name"
-                :options="dept_tree"
-                @change="dept1_null"
-                :props="{ label: 'name', value: 'id'}"
-                ref="dept1"
-                filterable
-                change-on-select
-                placeholder="全公司"
-                clearable
-              >
-                <template slot-scope="{ node, data }">
-                  <span>
-                    <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-                  </span>
-                  <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-                </template>
-              </el-cascader>
+                <ShowDeptName :deptId.sync="formData.dept_id"></ShowDeptName>
             </el-col>
-          <!-- </el-form-item> -->
-          <!-- <el-form-item label="时间"> -->
 				    <el-col style="margin-left:20px;" :span="8">
               <el-col :span="8">
                 <el-select v-model="time_type" placeholder="请选择分类" style="width: 100px;">
@@ -34,7 +12,7 @@
                     :key="item.label"
                     :label="item.label"
                     :value="item.value"
-                  ></el-option> 
+                  ></el-option>
                 </el-select>
               </el-col>
 
@@ -61,11 +39,8 @@
                 ></el-date-picker>
               </el-col>
 				    </el-col>
-          <!-- </el-form-item> -->
-        <!-- </el-form> -->
-					<!-- <el-date-picker v-model="formData.month" type="month" placeholder="请选择月份" value-format="yyyy-MM"></el-date-picker> -->
       </el-row>
-      
+
       <el-col :span="24">
         <el-row class="raiders_box">
           <el-row style="position: relative;">
@@ -84,7 +59,7 @@
           </el-row>
         </el-row>
       </el-col>
-      
+
       <el-col :span="24" style="display:flex;justify-content: space-between;">
         <el-col style="width:49%;">
           <el-row class="pointsevent_box">
@@ -106,7 +81,9 @@
                   style="margin-right:8px"
                 ></userImage>
                 <div class="rightexamineAndApproveList" style="border:0px">
-                  <p style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;"><b style="color:#303133;font-size:16px;"><WWOpenData type="userName" :openid="prize.name"></WWOpenData></b><span style="color:#26A2FF;font-size:16px;"><span v-if="prize.point>0" style="padding-left:30px;">+</span>{{prize.point}} B分</span></p>
+                  <p class="font-flex-word" style="width:300px;font-size:16px;">
+                    <b><WWOpenData type="userName" :openid="prize.name"></WWOpenData></b>
+                    <span class="blue"><span v-if="prize.point>0" style="padding-left:30px;">+</span>{{prize.point}} B分</span></p>
                   <p style="font-size:13px;line-height:20px;color:rgb(48, 49, 51);overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:2; ">{{prize.remark? prize.remark.customize : ''}}</p>
                 </div>
               </div>
@@ -133,7 +110,10 @@
                   style="margin-right:8px"
                 ></userImage>
                 <div class="rightexamineAndApproveList"  style="border:0px">
-                  <p style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;"><b style="color:#303133;font-size:16px;"><WWOpenData type="userName" :openid="buckle.name"></WWOpenData></b><span style="color:#FF9600;font-size:16px;padding-left:30px;">{{buckle.point}} B分</span></p>
+                  <p class="font-flex-word" style="width:300px;font-size:16px;">
+                    <b ><WWOpenData type="userName" :openid="buckle.name"></WWOpenData></b>
+                    <span class="yellow" style="padding-left:30px;">{{buckle.point}} B分</span>
+                  </p>
                   <p style="font-size:13px;line-height:20px;color:rgb(48, 49, 51);overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:2;">{{buckle.remark?buckle.remark.customize:''}}</p>
                 </div>
               </div>
@@ -142,7 +122,7 @@
         </el-col>
       </el-col>
 
-      
+
       <el-col :span="24" style="margin-bottom:20px;">
         <el-row class="raiders_box">
           <el-row style="position: relative;">
@@ -151,19 +131,6 @@
               <el-checkbox v-model="exclusiveMonthChecked">不包含自动积分加分项</el-checkbox>
             </el-col>
             <div v-loading="monthlyIntegralloading">
-              <!-- <el-col :span="5" style="position: absolute;top:40px;left:10px;z-index: 1;">
-                <el-cascader
-                  v-model="dept_name2"
-                  :options="dept_tree"
-                  @change="monthlyIntegralchange"
-                  ref="dept2"
-                  filterable
-                  change-on-select
-                  placeholder="请选择部门"
-                  clearable
-                ></el-cascader>
-              </el-col> -->
-
               <div class="nopoint_box" style="height:450px;" v-if="monthlyIntegralnone">
                 <div class="noimg" style="width: 150px;height: 150px;margin-top:110px;"></div>
                 <span class="title1">暂无积分数据</span>
@@ -214,7 +181,7 @@
         //部门
 				dept_name:[],
         dept_tree: [],
-        
+
         //饼图
         IntegralFormChartLoad:false,//积分构成loading
         IntegralFormnone:false,//积分构成为空或报错,展示的开关
@@ -276,9 +243,6 @@
         this.executiveFunction()
 			},
 			'formData.dept_id'(val,old_val){
-				if(!val){
-					this.formData.dept_id = 0
-				}
         this.executiveFunction()
       },
       //不包含自动积分加分项
@@ -342,7 +306,7 @@
           var legendData2 = DataLengths
           const option = {
             tooltip: {trigger: 'item',formatter: '{b}'},
-            legend: [{type: "scroll",orient: 'vertical',icon:'square',left: left1,align: 'left',top: '10%',itemGap: 20,textStyle: {fontSize:14,color: 'rgb(48, 49, 51)'},data: legendData1}, 
+            legend: [{type: "scroll",orient: 'vertical',icon:'square',left: left1,align: 'left',top: '10%',itemGap: 20,textStyle: {fontSize:14,color: 'rgb(48, 49, 51)'},data: legendData1},
             //分为两列展示
                      {type: "scroll",orient: 'vertical',icon:'square',left: '70%',align: 'left',top: '10%',itemGap: 20,textStyle: {fontSize:14,color: 'rgb(48, 49, 51)'},data: legendData2}],
             color:colors,
@@ -387,7 +351,7 @@
             }else{
               legendData2.push(lists[i].name+' '+'奖'+lists[i].reward+' '+'扣'+lists[i].deduction+' '+lists[i].ratio+'%')
             }
-            
+
             let dataListDx = {}
             if(lists[i].ratio < 0){
               dataListDx.value = 0
@@ -411,7 +375,7 @@
         });
       },
 
-      
+
       //奖扣分最高积分事件
       highestPrizeBuckle(){
         this.highestPrizeBuckleloading = true
@@ -444,7 +408,7 @@
           this.highestPrizeBuckleloading = false
         })
       },
-      
+
       //月度积分
       monthlyIntegralRanking(date,total,reward,deduction){
         const chart = this.$refs.monthlyIntegralChart
@@ -567,18 +531,6 @@
         });
       },
 
-      //筛选部门数据
-			dept1_null(val){
-        this.toPdept1 = val[val.length-1]
-				if(val.length == 0){
-					this.formData.dept_id = 0
-				}else{
-					this.formData.dept_id = this.dept_name[this.dept_name.length-1]
-				}
-				this.$nextTick(()=>{
-					this.$refs.dept1.dropDownVisible = false; 
-				})
-      },
 			// 递归判断列表,把最后的children设为undefined
 			getTreeData(data){
 				for(var i=0;i<data.length;i++){
@@ -602,7 +554,7 @@
     background: #fff;
     border:1px #e1e4e7 solid;
     box-shadow: 0 2px 4px rgba(140,140,140,0.1);
-  } 
+  }
   .raiders_box .title {
     font-family: Microsoft Yahei;
     padding-left: 10px;
@@ -611,7 +563,7 @@
     border-left: 2px solid #409EFF;
   }
 
-  
+
   .pointsevent_box {
     display: block;
     text-align: center;
@@ -640,7 +592,7 @@
   /* .pointsevent_box .more:hover {
     color: #26A2FF !important;
   } */
-  
+
   .nopoint_box {
     display: inline-block;
     text-align: center;

+ 46 - 274
src/views/statistics_new/dept_rank.vue

@@ -40,34 +40,7 @@
         </el-form-item>
 
         <el-form-item label="部门">
-          <deptData deptStyle="height:24px;line-height:24px;margin-top:7px;" v-if="toPdept && toPdept != 0" :refsName="$refs.dept" :toPdept="toPdept"></deptData>
-          <el-cascader
-            class="date-picker-width"
-            v-model="dept_name"
-            :options="dept_tree"
-            :props="{ label: 'name', value: 'id' }"
-            ref="dept"
-            clearable
-            filterable
-            change-on-select
-            placeholder="全公司"
-          >
-            <template slot-scope="{ node, data }">
-              <span><WWOpenData type="departmentName" :openid="data.name"></WWOpenData></span>
-              <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-            </template>
-          </el-cascader>
-          <!-- 这是选部门多选。如果更改需求用这个: -->
-          <!-- <el-cascader
-            v-model="dept_name"
-            :options="dept_tree"
-            :props="{ multiple: true, checkStrictly: true }"
-            class="date-picker-width"
-            ref="dept"
-            clearable
-            collapse-tags
-            placeholder="全公司"
-          ></el-cascader>-->
+          <ShowDeptName @confirm="deptConfirm"></ShowDeptName>
         </el-form-item>
 
         <el-form-item label="积分类型">
@@ -116,8 +89,7 @@
 
         <br />
         <el-form-item>
-          <!-- <el-button type="primary" plain @click="dialogVisibles" :disabled="deriveDis">导出排名</el-button> -->
-          <a :href="aherfUrl" ref="aherfClick"></a>
+          <el-button type="primary" plain @click="dialogVisibles">导出排名</el-button>
           <!-- <el-button type="primary" plain @click="byRanking">轮播排名</el-button> -->
         </el-form-item>
       </el-form>
@@ -154,6 +126,7 @@
           :page-sizes="[10, 20, 50, 100]"
           layout="total, sizes, prev, pager, next"
           :page-size="formData.page_size"
+          :current-page="formData.page"
           :total="total"
         ></el-pagination>
       </center>
@@ -182,25 +155,14 @@
           </el-form-item>
         </div>
         <el-form-item label="部门">
-          <deptData deptStyle="height:24px;line-height:24px;margin-top:7px;" v-if="toPdept2 && toPdept2 != 0" :refsName="$refs.dept2" :toPdept="toPdept2"></deptData>
-          <el-cascader
-            class="date-picker-width cascader_bm"
-            v-model="Dc_Data.dept_name"
-            :props="{ label: 'name', value: 'id' }"
-            :options="dept_tree"
-            ref="dept2"
-            clearable
-            filterable
-            change-on-select
-            placeholder="全公司"
-          >
-            <template slot-scope="{ node, data }">
-              <span><WWOpenData type="departmentName" :openid="data.name"></WWOpenData></span>
-              <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-            </template>
-          </el-cascader>
+            <ShowDeptName :deptId.sync="Dc_Data.dept_id"></ShowDeptName>
+        </el-form-item>
+        <el-form-item label="积分类型">
+          <el-select v-model="Dc_Data.pt_id" style="width:120px" placeholder="积分类型">
+            <el-option label="B分" :value="3"></el-option>
+            <el-option label="A分" :value="2"></el-option>
+          </el-select>
         </el-form-item>
-
         <el-form-item style="margin-left:20px">
           <el-select v-model="newTaskFormType" style="width:110px;" filterable placeholder="请选择">
             <el-option v-for="item in pullrow" :key="item.id" :label="item.value" :value="item.id"></el-option>
@@ -241,62 +203,6 @@
         <el-button type="primary" @click="exportExcel">导 出</el-button>
       </span>
     </el-dialog>
-
-    <!-- 轮播弹窗 -->
-    <!-- <el-dialog
-			title="轮播排名"
-			:visible.sync="byRankingShow"
-      top="8vh"
-			width="500px">
-			<div>
-				<el-form :inline="true" ref="byRankingData" :model="byRankingData" :rules="byRankingDataRules" label-width="90px">
-          <div style="color:rgb(122 202 126);font-size: 13px;padding:5px 0 20px 0">设置后,相关排名信息可在各类智能终端屏幕上的网页浏览器滚屏展示</div>
-					<el-form-item label="展示标题">
-					  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 6}" v-model="titleVals" placeholder="请输入标题" maxlength="20"  show-word-limit style="width: 341px"></el-input>
-					</el-form-item>
-					<el-form-item label="月份" prop="month">
-						<el-date-picker
-							v-model="byRankingData.month"
-							class="date-picker-width"
-							type="month"
-							value-format="yyyy-MM"
-							placeholder="选择月份排名">
-						</el-date-picker>
-					</el-form-item>
-					<el-form-item label="选择部门" class="elCascaderWidht">
-            <deptData deptStyle="height:24px;line-height:24px;margin-top:7px;" v-if="toPdept1 && toPdept1!=0" :refsName="$refs.dept1" :toPdept="toPdept1"></deptData>
-						<el-cascader
-							class="date-picker-width"
-							v-model="byRankingDeptId"
-							:options="dept_tree"
-              :props="{ label: 'name', value: 'id'}"
-							ref="dept1"
-							clearable
-							filterable
-							change-on-select
-							placeholder="全公司"
-						>
-              <template slot-scope="{ node, data }">
-                <span>
-                  <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-                </span>
-              </template>
-            </el-cascader>
-					</el-form-item>
-					<el-form-item label="人员范围" prop="position" >
-						<el-radio-group v-model="byRankingData.position">
-							<el-radio label="all">管理者和员工</el-radio>
-							<el-radio label="manager">只看管理者</el-radio>
-							<el-radio label="employee">只看员工</el-radio>
-						</el-radio-group>
-					</el-form-item>
-				</el-form>
-			</div>
-			<span slot="footer">
-				<el-button @click="byRankingShow = false">取 消</el-button>
-				<el-button type="primary" @click="swiperPage('byRankingData')">开始轮播</el-button>
-			</span>
-		</el-dialog> -->
   </div>
 </template>
 <script>
@@ -328,12 +234,12 @@ export default {
         //导出数据
         value1: '', //时间
         DC_position: '全部', //人员
-        dept_name: [], //部门
-        rule_id: [] //规则
+        dept_id: 0, //部门
+        rule_id: [] ,//规则
+        pt_id:3
       },
 
       dialogVisible: false,
-      dept_name: [],
       dept_tree: [],
       loading: false,
       formData: {
@@ -398,14 +304,6 @@ export default {
     },
     newTaskFormType(val) {
       this.Dc_Data.rule_id = [];
-      // console.log(val)
-      // if(val==1){
-      //   this.Dc_Data.rule_id = []
-      //   this.Dc_Data.val = null
-      // }else if(val==2){
-      //   this.Dc_Data.val = []
-      //   this.Dc_Data.rule_id = null
-      // }
     },
     sort(val) {
       if (val) {
@@ -414,48 +312,17 @@ export default {
         this.formData.sort = 'DESC';
       }
     },
-    dept_name(val) {
-      this.toPdept = val[val.length - 1];
-      if (val.length !== 0) {
-        // 这是选部门多选。如果更改需求用这个:
-        // let dept_id = [];
-        // for (var i in val) {
-        //   dept_id.push(val[i][0]);
-        // }
-        // console.log(dept_id);
-        // this.formData.dept_id = dept_id;//传入选中的部门ID,是数组
-
-        this.formData.dept_id = val[val.length - 1];
-      } else {
-        this.formData.dept_id = 0;
-      }
-      this.$nextTick(() => {
-        this.$refs.dept.dropDownVisible = false;
-        this.getEmployeeList();
-      });
-    },
     byRankingDeptId(val) {
       this.toPdept1 = val[val.length - 1];
       this.$refs.dept1.dropDownVisible = false;
     },
-    'Dc_Data.dept_name': function(val) {
-      this.toPdept2 = val[val.length - 1];
-      this.$refs.dept2.dropDownVisible = false;
-    }
-    // rule_id(val) {
-    //   console.log(val)
-    //   if (val.length !== 0) {
-    //     this.formData.rule_id = [];
-    //     val.forEach((element, index) => {
-    //       this.formData.rule_id.push(element[element.length - 1]);
-    //     });
-    //   } else {
-    //     this.formData.rule_id !== undefined ? delete this.formData.rule_id : "";
-    //   }
-    // },
   },
   components: { season },
   methods: {
+    deptConfirm(id){
+      this.formData.dept_id = id;
+      this.getEmployeeList();
+    },
     takePartInno() {
       this.$refs['dropOuOfonref'].visible = true;
     },
@@ -577,11 +444,9 @@ export default {
         default:
           break;
       }
-      let data = JSON.parse(JSON.stringify(this.formData));
-      data.page = 1;
-      data.page_size = 10;
+      this.formData.page = 1;
       this.$nextTick(() => {
-        this.get_list(data);
+        this.get_list(this.formData);
       });
     },
     // 页面变更
@@ -615,41 +480,30 @@ export default {
       if (bool) {
         data.month = moment().format('YYYY-MM');
       }
-      let self = this;
-      self.loading = true;
+      this.loading = true;
       data ? '' : (data = this.formData);
       this.typeName = this.formData.pt_id == 3 ? 'B分' : 'A分';
       data.position = data.position == 'manager' ? 'manager' : data.position == 'employee' ? 'employee' : 'all';
-      // let headers = { Accept: "application/vnd.test.v2+json" };
-      self
-        .$http('get', '/api/integral/statistics/ranking', data, 'v2')
-        .then(res => {
-          if (res.data.code == 1) {
-            self.list = res.data.data.list;
-            self.total = res.data.data.total;
-          } else {
-            self.$message.error(res.data.data.msg);
-          }
+      this.$http('get', '/api/integral/statistics/ranking', data, 'v2').then(res => {
+            this.list = res.data.data.list;
+            this.total = res.data.data.total;
         })
         .finally(() => {
-          self.loading = false;
+          this.loading = false;
         });
     },
     // 获取积分规则
     get_rule_tree() {
-      let self = this;
-      self
-        .$http('get', '/api/integral/rule/trees', { cycle_type: '1' })
-        .then(res => {
+      this.$http('get', '/api/integral/rule/trees', { cycle_type: '1' }).then(res => {
           if (res.data.code == 1) {
             // let arr = res.data.data.tree
-            self.rule_trees = this.getTreeData(res.data.data.rule_tree);
+            this.rule_trees = this.getTreeData(res.data.data.rule_tree);
           } else {
-            self.$message.error(res.data.data.msg);
+            this.$message.error(res.data.data.msg);
           }
         })
         .catch(e => {
-          self.$message.error('获取积分规则失败');
+          this.$message.error('获取积分规则失败');
         });
     },
     // 递归判断列表,把最后的children设为undefined
@@ -681,27 +535,15 @@ export default {
       return data;
     },
     getEmployeeList() {
-      let self = this;
-      self
-        .$http('get', '/api/employee/index', { dept_id: self.formData.dept_id, is_official: 1, page_size: 2000, page: 0 })
+      this.$http('get', '/api/employee/index', { dept_id: this.formData.dept_id, is_official: 1, page_size: 2000, page: 0 })
         .then(res => {
           if (res.data.code == 1) {
             this.employee_map = res.data.data.list;
           } else {
-            self.$message.error(res.data.data.msg);
+            this.$message.error(res.data.data.msg);
           }
         })
         .finally(() => {});
-      // self
-      //   .$http("get", "/api/employee/list", { dept_id: self.formData.dept_id })
-      //   .then(res => {
-      //     if (res.data.code == 1) {
-      //       this.employee_map = res.data.data.list;
-      //     } else {
-      //       self.$message.error(res.data.data.msg);
-      //     }
-      //   })
-      //   .finally(() => {});
     },
     downloadResult() {
       if (this.deriveJobIf < 5) {
@@ -731,100 +573,30 @@ export default {
       }
     },
     exportExcel() {
-      this.aherfUrl = '';
-      this.$confirm('确认导出排名?', '导出', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          //人员
-          this.Dc_Data.DC_position =
-            this.Dc_Data.DC_position == 'manager' ? 'manager' : this.Dc_Data.DC_position == 'employee' ? 'employee' : this.Dc_Data.DC_position == '全部' ? 'all' : 'all';
-
-          //部门
-          let dept_name;
-          for (let i in this.Dc_Data.dept_name) {
-            dept_name = this.Dc_Data.dept_name[i];
-          }
-          this.Dc_Data.dept_name = dept_name;
-          this.deriveDis = true;
-          let params = {
-            employee_id: this.$store.getters.user_info.id,
-            position: this.Dc_Data.DC_position
-          };
-          this.Dc_Data.value1 ? (params.start_date = this.Dc_Data.value1[0]) : '';
-          this.Dc_Data.value1 ? (params.end_date = this.Dc_Data.value1[1]) : '';
-          this.Dc_Data.dept_name > 0 ? (params.dept_id = this.Dc_Data.dept_name) : (params.dept_id = 0);
-          this.Dc_Data.rule_id.length > 0 ? (params.rule_id = this.Dc_Data.rule_id) : '';
-          this.$http('get', '/api/download/ranking/v2', params).then(res => {
-            if (res.data.code == 1) {
-              this.deriveJobId = res.data.data.job_id;
-              this.downloadResult();
-            } else {
-              this.deriveDis = false;
-            }
-          });
-          this.dialogVisible = false;
-        })
-        .catch(() => {});
-
-      return;
-
-      let data = '';
-      if (this.Dc_Data.value1) {
-        data += '&start_date=' + this.Dc_Data.value1[0];
-        data += '&end_date=' + this.Dc_Data.value1[1];
-      }
-      data += '&position=' + this.Dc_Data.DC_position;
-
-      this.Dc_Data.dept_name > 0 ? (data += '&dept_id=' + this.Dc_Data.dept_name) : (data += '&dept_id=0');
-
-      if (this.Dc_Data.rule_id.length > 0) {
-        data += '&rule_id=' + this.Dc_Data.rule_id;
-      }
-      let token = this.$getToken ? this.$getToken : getToken();
-      window.open(process.env.BASE_API + '/api/download/ranking/v2?pt_id=3&employee_id=' + this.$store.getters.user_info.id + data + '&token=' + token, '_blank');
+      //人员
+      this.Dc_Data.DC_position =this.Dc_Data.DC_position == 'manager' ? 'manager' : this.Dc_Data.DC_position == 'employee' ? 'employee' : this.Dc_Data.DC_position == '全部' ? 'all' : 'all';
+      //部门
+      this.deriveDis = true;
+      let params = {
+        employee_id: this.$store.getters.user_info.id,
+        position: this.Dc_Data.DC_position,
+        dept_id:this.Dc_Data.dept_id,
+        pt_id:this.Dc_Data.pt_id
+      };
+      this.Dc_Data.value1 ? (params.start_date = this.Dc_Data.value1[0]) : '';
+      this.Dc_Data.value1 ? (params.end_date = this.Dc_Data.value1[1]) : '';
+      this.Dc_Data.rule_id.length > 0 ? (params.rule_id = this.Dc_Data.rule_id) : '';
       this.dialogVisible = false;
+      this.$downloadFile('api/download/ranking/v2',params,this.$route.path);
     },
-    // exportExcel() {
-    //   let data = "&pt_id=3";
-    //   if (this.export_from.month) {
-    //     data += "&month=" + this.export_from.month;
-    //   } else if (this.export_from.year) {
-    //     data += "&year=" + this.export_from.year;
-    //   } else if (this.export_from.quarter) {
-    //     data += "&quarter=" + this.export_from.quarter;
-    //   }
-    //   this.dept_name.length > 0
-    //     ? (data += "&dept_id=" + this.dept_name)
-    //     : (data += "&dept_id=0");
-    //   this.formData.sort ? (data += "&sort=ASC") : "&sort=DESC";
-    //   if (
-    //     this.formData.rule_id != undefined &&
-    //     this.formData.rule_id.length > 0
-    //   ) {
-    //     this.formData.rule_id.forEach((element, index) => {
-    //       data += "&rule_id[]=" + element;
-    //     });
-    //   }
-    //   window.open(
-    //     process.env.BASE_API +
-    //       "/api/download/ranking/v2?employee_id=" +
-    //       this.$store.getters.user_info.id +
-    //       data,
-    //     "_blank"
-    //   );
-    // },
 
     // 获取规则分类 与 规则细则
     get_rule_trees() {
-      let self = this;
-      self
+      this
         .$http('get', '/api/integral/rule/trees', { cycle_type: '2' })
         .then(res => {
           if (res.data.code == 1) {
-            self.rule_list = this.getTreeData(res.data.data.rule_tree);
+            this.rule_list = this.getTreeData(res.data.data.rule_tree);
           }
         })
         .finally(() => {});

+ 0 - 26
src/views/statistics_new/individual_statistics.vue

@@ -55,17 +55,8 @@
             ></el-date-picker>
           </el-col>
         </el-col>
-      <!-- <el-col style="margin-left:20px;" :span="5">
-        <el-date-picker
-          v-model="formData.month"
-          type="month"
-          placeholder="请选择月份"
-          value-format="yyyy-MM"
-        ></el-date-picker>
-      </el-col> -->
     </el-row>
     
-    <!-- <el-col  style="display:flex;justify-content: space-between;"> -->
       <el-row :span="24" class="top_user_info" style="margin:20px 0 0 0;padding:0;">
         <el-col :span="7" class="userinfo_box">
           <el-row :gutter="40" style="margin:0;padding:0;">
@@ -76,12 +67,6 @@
               <div class="greetings">
                 <div><WWOpenData type="userName" :openid="personnel.name"></WWOpenData></div>
               </div>
-              <!-- <div style="padding-left:10px;display:flex;flex-wrap:wrap;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;">
-                <el-popover trigger="hover" placement="top" popper-class="popperSPBOX">
-                  <div style="font-size:14px;color:#828282;" v-for="(item,index) in dept_data" :key="index"><WWOpenData type="departmentName" :openid="item"></WWOpenData></div>
-                  <div slot="reference" class="name-wrapper"><span style="font-size:14px;color:#828282;"><WWOpenData type="departmentName" :openid="item"></WWOpenData></span></div>
-                </el-popover>
-              </div> -->
               <div style="display:flex;flex-wrap:wrap;padding-left:10px;">
                   <div style="font-size:14px;color:#828282;" v-for="(item,index) in dept_data" :key="index"><WWOpenData type="departmentName" :openid="item"></WWOpenData><span v-if="(dept_data.length-index)>1">,</span></div>
               </div>
@@ -89,7 +74,6 @@
           </el-row>
         </el-col>
         <div>
-          <!-- <el-col :span="8" style="margin-top:34px;padding:0;border-right: 1px #cecccc solid;height:58px;" v-loading="authorityManagerHeaderLoad"> -->
           <el-col :span="16" style="margin-top:34px;padding:0;height:58px;" v-loading="authorityManagerHeaderLoad">
             <el-col :gutter="50" style="margin:0;padding:0;" class="quick_button_box">
               <div style="display:flex;justify-content: space-around;">
@@ -98,18 +82,8 @@
               </div>
             </el-col>
           </el-col>
-          <!-- <el-col :span="8" style="margin:0;padding:0;">
-            <el-col :gutter="50" style="margin:0;padding:34px 0 0 0;" class="quick_button_box">
-              <div style="display:flex;justify-content: space-around;" v-loading="authorityManagerHeaderLoad">
-                <p style="text-align:center;cursor:pointer;margin: 0;"><b style="color:#26A2FF;font-size:27px;">{{authorityManagerHeaders.performance?authorityManagerHeaders.performance.review_point:'0'}}</b><br><span style="color:#606266;font-size:14px;padding-top:8px;display: inline-block;">绩效分</span></p>
-                <p style="text-align:center;cursor:pointer;margin: 0;"><b style="color:#26A2FF;font-size:27px;">{{authorityManagerHeaders.performance?authorityManagerHeaders.performance.complete_count + '/' + authorityManagerHeaders.performance.total_count : '0/0'}}</b><br><span style="color:#606266;font-size:14px;padding-top:8px;display: inline-block;">任务进度</span></p>
-              </div>
-
-            </el-col>
-          </el-col> -->
         </div>
       </el-row>
-    <!-- </el-col> -->
 
     <el-col :span="24">
       <el-row class="raiders_box">

+ 22 - 150
src/views/statistics_new/integral_event.vue

@@ -45,15 +45,7 @@
         </el-col>
         <el-col :span="7" class="display_flex" style="position: relative;">
           <span class="label">部门</span>
-          <deptData deptStyle="width:150px;left:50px;" v-if="toPdept && toPdept!=0" :refsName="$refs.dept" :toPdept="toPdept"></deptData>
-          <el-cascader class="date-picker-width" v-model="dept_name" :options="dept_tree" :props="{ label: 'name', value: 'id'}" ref="dept" clearable filterable change-on-select placeholder="全公司">
-            <template slot-scope="{ node, data }">
-                <span>
-                  <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-                </span>
-                <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-              </template>
-          </el-cascader>
+          <ShowDeptName @confirm="deptConfirm"></ShowDeptName>
         </el-col>
       </el-row>
 
@@ -90,7 +82,7 @@
       <el-row :gutter="20" style="margin-bottom: 20px;">
         <el-col :span="4">
           <!-- <el-button type="primary" @click="excelImportShow = true">导入数据</el-button> -->
-          <!-- <el-button type="primary" @click="exportExcel" :disabled="deriveDis">导出当前数据</el-button> -->
+          <el-button type="primary" @click="exportExcel" :disabled="deriveDis">导出当前数据</el-button>
           <!-- <a :href="aherfUrl" ref="aherfClick" v-if="aherfUrl != ''" v-trigger></a> -->
           <a :href="aherfUrl" ref="aherfClick"></a>
         </el-col>
@@ -125,8 +117,6 @@
           </template>
         </el-table-column>
         <el-table-column prop="remark" show-overflow-tooltip label="事件" align="left"></el-table-column>
-        <!-- <el-table-column prop="remark_data.rule" show-overflow-tooltip label="分类" align="left">
-        </el-table-column> -->
         <el-table-column prop="source_type" label="来源" align="left" width="120px">
           <template slot-scope="scope">
             <span v-show="scope.row.source_type == 1">积分录入</span>
@@ -234,34 +224,9 @@
             </el-col>
           </el-row>
         </div>
-
         <div v-show="detail_info.process !=undefined&&detail_info.process.length>0">
             <Steps :process="detail_info.process"></Steps>
         </div>
-        <!-- <div v-show="detail_info.rule_id">
-          <p class="row_title">
-            审批
-            <span class="row_tips">多人审批时,以最后一人为准</span>
-          </p>
-
-          <div class="examine_steps">
-            <el-steps direction="vertical" :space="50">
-              <el-step v-for="(item, index) in detail_info.process" :key="index">
-                <template slot="icon">
-                  <userImage width="36px" height="36px" :img_url="item.img_url" :user_name="item.name"></userImage>
-                </template>
-                <template slot="title">
-                  <div style="color: #303133;font-size:14px;margin-top:-2px;">
-                    <WWOpenData type="userName" :openid="item.name"></WWOpenData> {{ item.remark }}
-                  </div>
-                </template>
-                <template slot="description" style="">
-                  {{ item.time }}
-                </template>
-              </el-step>
-            </el-steps>
-          </div>
-        </div> -->
         <div style="position: absolute; bottom: 20px; display: block; right: 20px;" v-show="deptManagerRouters">
           <el-button @click="close_integral_event">取消</el-button>
           <el-button type="danger" @click="del_integral_event(detail_info)">删除</el-button>
@@ -356,7 +321,6 @@
 import { getToken } from '@/utils/auth';
 import noData from '@/components/noData';
 import Steps from '@/components/Steps.vue';
-// import axios from "axios"
 export default {
   data() {
     return {
@@ -465,38 +429,21 @@ export default {
       }
       this.get_integral_list(this.formData);
     },
-    dept_name(val, old_val) {
-      this.toPdept = val[val.length-1]
-      this.formData.page = 1;
-      if (val.length != 0) {
-        this.formData.dept_id = val[val.length - 1];
-      } else {
-        this.formData.dept_id = 0;
-      }
-      this.$nextTick(() => {
-        this.$refs.dept.dropDownVisible = false;
-        this.get_integral_list(this.formData);
-      });
-    },
     select_employee_id(val) {
-      console.log(val)
       this.formData.employee_ids = val;
       this.get_integral_list(this.formData);
       this.$nextTick(()=>{
-        console.log(this.$refs['dropOuOfref'].selected)
         this.dropOuOfPers = this.$refs['dropOuOfref'].selected
       })
     }
   },
-  // directives: {
-  //   aderivecli:{
-  //     inserted(el,binging){
-  //       console.log(el)
-  //       // el.click()
-  //     }
-  //   }
-  // },
   methods: {
+    deptConfirm(id){
+      this.formData.page = 1;
+      this.formData.dept_id = id;
+      this.get_integral_list(this.formData);
+    },
+
     takePartIn(){
       this.$refs['dropOuOfref'].visible = true
     },
@@ -558,7 +505,7 @@ export default {
 
       })
     },
-    
+
     //轮播
     swiperPage() {
       if (this.titleVals != '') {
@@ -660,95 +607,20 @@ export default {
       }
     },
     exportExcel() {
-      this.aherfUrl = ''
-      this.$confirm('确认导出积分事件?', '导出', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        this.deriveDis = true
-        let params = {
-          employee_id: this.$store.getters.user_info.id,
-          page: this.formData.page,
-          page_size: this.formData.page_size,
-        }
-        this.formData.rule_id ? params.rule_id = this.formData.rule_id : ''
-        this.formData.pt_id ? params.pt_id = this.formData.pt_id : ''
-        this.formData.employee_ids ? params.employee_ids = this.formData.employee_ids : ''
-        this.formData.dept_id ? params.dept_ids = this.formData.dept_id : ''
-        this.formData.start_day ? params.start_day = this.formData.start_day : ''
-        this.formData.end_day ? params.end_day = this.formData.end_day : ''
-        this.formData.keyword ? params.keyword = this.formData.keyword : ''
-        this.$http('get','/api/download/integral',params).then((res)=>{
-          if(res.data.code == 1){
-            this.deriveJobId = res.data.data.job_id
-            this.downloadResult()
-          }else{
-            this.deriveDis = false
-          }
-        })
-      }).catch(() => {
-
-      })
-      
-      return
-      window.open('https://open.work.weixin.qq.com/wwopen/openData/getTranslateContactOpenData?dataid=_Q-jZZifks4nhgXAXmSGYJwMC40p3sGyeeKZV2I79e0')
-      return
-      let token = this.$getToken?this.$getToken:getToken()
-      window.open(
-        this.publicBASE_API +'/api/download/integral?employee_id=' +this.$store.getters.user_info.id +'&page=' + this.formData.page +'&page_size=' +this.formData.page_size +
-          (this.formData.rule_id ? '&rule_id=' + this.formData.rule_id : '') +
-          (this.formData.pt_id ? '&pt_id=' + this.formData.pt_id : '') +
-          (this.formData.employee_ids ? '&employee_ids=' + this.formData.employee_ids : '') +
-          (this.formData.dept_id ? '&dept_ids=' + this.formData.dept_id : '') +
-          (this.formData.start_day ? '&start_day=' + this.formData.start_day : '') +
-          (this.formData.end_day ? '&end_day=' + this.formData.end_day : '') +0
-          (this.formData.keyword ? '&keyword=' + this.formData.keyword : '')+
-          '&token='+token,
-        '_blank'
-      );
-          // let params = {
-          //   employee_id:this.$store.getters.user_info.id,
-          //   page:this.formData.page,
-          //   page_size:this.formData.page_size,
-          //   rule_id:this.formData.rule_id ? this.formData.rule_id : null,
-          //   pt_id:this.formData.pt_id ? this.formData.pt_id : null,
-          //   employee_ids:this.formData.employee_ids ? this.formData.employee_ids : null,
-          //   dept_ids:this.formData.dept_id ? this.formData.dept_id : null,
-          //   start_day:this.formData.start_day ? this.formData.start_day : null,
-          //   end_day:this.formData.end_day ? this.formData.end_day : null,
-          //   keyword:this.formData.keyword ? this.formData.keyword : null,
-          // }
-        
-        // this.$http('get',this.publicBASE_API +'/api/download/integral',params).then((res)=>{
-        //   console.log(res)
-        // })
-
-        // axios({
-        //   method: 'get',
-				// 	url: this.publicBASE_API +'/api/download/integral',
-				// 	responseType: 'blob',
-				// 	params: params,
-				// 	headers: {
-        //   }
-        // }).then((res)=>{
-        //   console.log(res)
-        // })
+      let params = {
+        employee_id: this.$store.getters.user_info.id,
+        page: this.formData.page,
+        page_size: this.formData.page_size,
+      }
+      this.formData.rule_id ? params.rule_id = this.formData.rule_id : ''
+      this.formData.pt_id ? params.pt_id = this.formData.pt_id : ''
+      this.formData.employee_ids ? params.employee_ids = this.formData.employee_ids : ''
+      this.formData.dept_id ? params.dept_ids = this.formData.dept_id : ''
+      this.formData.start_day ? params.start_day = this.formData.start_day : ''
+      this.formData.end_day ? params.end_day = this.formData.end_day : ''
+      this.formData.keyword ? params.keyword = this.formData.keyword : ''
+      this.$downloadFile('api/download/integral',params,this.$route.path);
     },
-    // openPostWindow(url, params) {
-    //   var newWin = window.open(),
-    //   formStr = '';
-    //   //设置样式为隐藏,打开新标签再跳转页面前,如果有可现实的表单选项,用户会看到表单内容数据
-    //   formStr = '<form style="visibility:hidden;" method="POST" action="' + url + '">' +
-    //         '<input type="hidden" name="params" value="' + params + '" />' +
-    //         '</form>';
-    //   newWin.document.body.innerHTML = formStr;
-    //   // newWin.document.write(formStr)
-    //   newWin.document.forms[0].submit();
-    //   return newWin;
-    // },
-    // end 文件上传
-
     handleSizeChange(val) {
       this.pageLimit = val;
       this.formData.page_size = this.pageLimit;

+ 14 - 85
src/views/statistics_new/integral_statistics.vue

@@ -4,39 +4,16 @@
       <el-row :gutter="10" style="margin-bottom: 20px;margin-right:8px;">
         <el-col :span="5"><el-date-picker v-model="formData.month" type="month" placeholder="请选择月份" value-format="yyyy-MM" :clearable="false"></el-date-picker></el-col>
         <el-col :span="5">
-          <deptData deptStyle="width:150px;left:200px;" v-if="toPdept1 && toPdept1 != 0" :refsName="$refs.dept1" :toPdept="toPdept1"></deptData>
-          <el-cascader
-            v-model="dept_name"
-            :options="dept_tree"
-            @change="dept1_null"
-            :props="{ label: 'name', value: 'id' }"
-            ref="dept1"
-            filterable
-            change-on-select
-            placeholder="请选择部门"
-            clearable
-          >
-            <template slot-scope="{ node, data }">
-              <span><WWOpenData type="departmentName" :openid="data.name"></WWOpenData></span>
-              <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-            </template>
-          </el-cascader>
+            <ShowDeptName :deptId.sync="formData.dept_id"></ShowDeptName>
         </el-col>
         <el-col :span="5" class="search">
           <el-input v-model="formData.keyword" placeholder="输入同事姓名" @keyup.enter.native="get_all_integral">
             <el-button slot="append" @click="get_all_integral" icon="el-icon-search"></el-button>
           </el-input>
         </el-col>
-        <!--        <el-col :offset="6" :span="3">
-          <el-button
-            class="company_intergral_button"
-            @click="export_all"
-            type="primary"
-            :disabled="deriveDis"
-            >导出报表</el-button
-          >
-          <a :href="aherfUrl" ref="aherfClick"></a>
-        </el-col> -->
+        <el-col :offset="6" :span="3">
+          <el-button class="company_intergral_button" @click="export_all" type="primary" :disabled="deriveDis">导出报表</el-button>
+        </el-col>
       </el-row>
 
       <el-table :data="all_integral_list" style="width: 100%" v-loading="loading" @row-click="open_all_integral">
@@ -190,17 +167,6 @@ export default {
           self.loading = false;
         });
     },
-    dept1_null(val) {
-      this.toPdept1 = val[val.length - 1];
-      if (val.length == 0) {
-        this.formData.dept_id = 0;
-      } else {
-        this.formData.dept_id = this.dept_name[this.dept_name.length - 1];
-      }
-      this.$nextTick(() => {
-        this.$refs.dept1.dropDownVisible = false;
-      });
-    },
     downloadResult() {
       if (this.deriveJobIf < 5) {
         this.$http('get', '/api/download/result', {
@@ -232,49 +198,15 @@ export default {
       }
     },
     export_all() {
-      this.aherfUrl = '';
-      this.$confirm('确认导出统计报表?', '导出', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          this.deriveDis = true;
-          let params = {
-            month: this.formData.month,
-            keyword: this.formData.keyword,
-            dept_id: this.formData.dept_id,
-            async: 0,
-            data_type: 2,
-            employee_id: this.$store.getters.user_info.id
-          };
-          this.$http('get', '/api/download/list', params).then(res => {
-            if (res.data.code == 1) {
-              this.deriveJobId = res.data.data.job_id;
-              this.downloadResult();
-            } else {
-              this.deriveDis = false;
-            }
-          });
-        })
-        .catch(() => {});
-
-      return;
-      let token = this.$getToken ? this.$getToken : getToken();
-      window.open(
-        process.env.BASE_API +
-          '/api/download/list?month=' +
-          this.formData.month +
-          '&keyword=' +
-          this.formData.keyword +
-          '&dept_id=' +
-          this.formData.dept_id +
-          '&async=0&data_type=2&employee_id=' +
-          this.$store.getters.user_info.id +
-          '&token=' +
-          token,
-        '_blank'
-      );
+      let params = {
+        month: this.formData.month,
+        keyword: this.formData.keyword,
+        dept_id: this.formData.dept_id,
+        async: 0,
+        data_type: 2,
+        employee_id: this.$userInfo().id
+      };
+      this.$downloadFile('api/download/list',params,this.$route.path);
     },
     initEChartOption() {
       this.option = {
@@ -463,10 +395,7 @@ export default {
       this.formData.page = 1;
       this.get_all_integral();
     },
-    'formData.dept_id'(val, old_val) {
-      if (!val) {
-        this.formData.dept_id = 0;
-      }
+    'formData.dept_id'(val) {
       this.formData.page = 1;
       this.get_all_integral();
     }

+ 1 - 41
src/views/statistics_new/lotteryTicket_statistics.vue

@@ -11,25 +11,7 @@
           ></el-date-picker
         ></el-col>
         <el-col :span="5" style="position: relative;">
-          <deptData  deptStyle="padding-left:10px;" v-if="toPdept1 && toPdept1!=0" :refsName="$refs.dept1" :toPdept="toPdept1"></deptData>
-          <el-cascader
-            v-model="dept_name"
-            :options="dept_tree"
-            @change="dept1_null"
-            :props="{ label: 'name', value: 'id'}"
-            ref="dept1"
-            filterable
-            change-on-select
-            placeholder="请选择部门"
-            clearable
-          >
-            <template slot-scope="{ node, data }">
-              <span>
-                <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-              </span>
-              <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-            </template>
-          </el-cascader>
+          <ShowDeptName :deptId.sync="formData.dept_id"></ShowDeptName>
         </el-col>
         <el-col :span="5" class="search">
           <el-input
@@ -107,8 +89,6 @@ export default {
         page_size: 10
       },
       total: 0,
-      dept_tree: [],
-      dept_name: [],
       pageLimit1: 10,
       toPdept1:0,
     };
@@ -120,19 +100,11 @@ export default {
       this.get_all_integral();
     },
     "formData.dept_id"(val, old_val) {
-      if (!val) {
-        this.formData.dept_id = 0;
-      }
       this.formData.page = 1;
       this.get_all_integral();
     }
   },
   mounted() {
-    if (localStorage.getItem("dept_tree")) {
-      this.dept_tree = this.getTreeData(
-        JSON.parse(localStorage.getItem("dept_tree"))
-      );
-    }
     this.get_all_integral();
   },
   methods: {
@@ -164,18 +136,6 @@ export default {
           self.loading = false;
         });
     },
-    dept1_null(val) {
-      this.toPdept1 = val[val.length-1]
-      //部门
-      if (val.length == 0) {
-        this.formData.dept_id = 0;
-      } else {
-        this.formData.dept_id = this.dept_name[this.dept_name.length - 1];
-      }
-      this.$nextTick(() => {
-        this.$refs.dept1.dropDownVisible = false;
-      });
-    },
     // 递归判断列表,把最后的children设为undefined
     getTreeData(data) {
       for (var i = 0; i < data.length; i++) {

+ 46 - 241
src/views/statistics_new/manager_statistics.vue

@@ -7,33 +7,7 @@
           <el-form :model="condition" :inline="true" ref="formData">
             <!-- 部门 -->
             <el-form-item label="部门">
-              <deptData
-                deptStyle="height:24px;line-height:24px;margin-top:7px;"
-                v-if="toPdept && toPdept != 0"
-                :refsName="$refs.dept"
-                :toPdept="toPdept"
-              ></deptData>
-              <el-cascader
-                v-model="dept_name_xq_xq"
-                :options="dept_trees"
-                @change="get_last_dept_null"
-                :props="{ label: 'name', value: 'id' }"
-                ref="dept"
-                filterable
-                change-on-select
-                placeholder="全公司"
-                clearable
-              >
-                <template slot-scope="{ node, data }">
-                  <span>
-                    <WWOpenData
-                      type="departmentName"
-                      :openid="data.name"
-                    ></WWOpenData>
-                  </span>
-                  <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-                </template>
-              </el-cascader>
+                <ShowDeptName :deptId.sync="condition.dept_id"></ShowDeptName>
             </el-form-item>
 
             <!-- 时间 -->
@@ -77,17 +51,10 @@
             </el-form-item>
 
             <!-- 导出报表 -->
-<!--            <el-form-item>
-              <el-button
-                type="primary"
-                plain
-                @click="exportExcel"
-                style="margin-left:20px"
-                :disabled="deriveDis"
-                >导出报表</el-button
-              >
-              <a :href="aherfUrl" ref="aherfClick"></a>
-            </el-form-item> -->
+           <el-form-item>
+              <el-button type="primary" plain @click="exportExcel" style="margin-left:20px"  :disabled="deriveDis">导出报表</el-button>
+              <!-- <a :href="aherfUrl" ref="aherfClick"></a> -->
+            </el-form-item>
           </el-form>
 
           <el-table :data="last" style="width: 100%" v-loading="loading">
@@ -187,33 +154,7 @@
         <el-tab-pane label="奖扣执行对比" name="first">
           <el-form :model="formData" :inline="true" ref="formData">
             <el-form-item label="部门">
-              <deptData
-                deptStyle="height:24px;line-height:24px;margin-top:7px;"
-                v-if="toPdepts && toPdepts != 0"
-                :refsName="$refs.depts"
-                :toPdept="toPdepts"
-              ></deptData>
-              <el-cascader
-                v-model="dept_name_xq"
-                :options="dept_tree"
-                @change="dept_null"
-                :props="{ label: 'name', value: 'id' }"
-                ref="depts"
-                filterable
-                change-on-select
-                placeholder="全公司"
-                clearable
-              >
-                <template slot-scope="{ node, data }">
-                  <span>
-                    <WWOpenData
-                      type="departmentName"
-                      :openid="data.name"
-                    ></WWOpenData>
-                  </span>
-                  <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-                </template>
-              </el-cascader>
+                <ShowDeptName :deptId.sync="formData.dept_id"></ShowDeptName>
             </el-form-item>
             <el-form-item label="时间">
               <el-date-picker
@@ -227,23 +168,6 @@
               ></el-date-picker>
             </el-form-item>
           </el-form>
-
-          <!-- 
-            <el-row :gutter="20" style="margin-bottom: 20px;">
-              <el-col :span="5">
-                <el-date-picker class="date-picker-width" v-model="formData.month" width="100%" type="month" placeholder="请选择月份" value-format="yyyy-MM"></el-date-picker>
-              </el-col>
-              <el-col :span="5">
-                <el-checkbox v-model="allPass" size="medium" label="只看全部达标的" border></el-checkbox>
-              </el-col>
-              <el-col :offset="8" :span="6" class="search_box">
-                <el-input v-model="formData.keyword" @keyup.enter.native="search" placeholder="输入管理者姓名">
-                  <el-button slot="append" @click="search" icon="el-icon-search"></el-button>
-                </el-input>
-              </el-col>
-            </el-row> 
-                -->
-
           <el-table
             :data="list"
             style="width: 100%"
@@ -466,45 +390,29 @@ export default {
       }
       this.condition.page = 1;
       this.get_last();
+    },
+    'condition.dept_id'(){
+      this.condition.page = 1;
+      this.get_last();
+    },
+    'formData.dept_id'(){
+        this.formData.page = 1;
+        this.get_list();
     }
   },
   methods: {
     //情况
     get_last() {
-      let self = this;
-      self.loading = true;
-      // const headers = { Accept: "application/vnd.test.v4+json" };
-      self
-        .$http(
-          "get",
-          "/api/integral/statistics/prize/list",
-          self.condition,
-          "v4"
-        )
-        .then(res => {
-          if (res.data.code == 1) {
-            self.last = res.data.data.list;
-            self.totals = res.data.data.total;
-          } else {
-            self.$message.error(res.data.data.msg);
-          }
-        })
-        .finally(() => {
-          self.loading = false;
-        });
-    },
-    //部门
-    get_last_dept_null(val) {
-      this.toPdept = val[val.length - 1];
-      if (val.length == 0) {
-        this.condition.dept_id = 0;
-      } else {
-        this.condition.dept_id = val[0];
-      }
-      this.$nextTick(() => {
-        this.condition.page = 1;
-        this.$refs.dept.dropDownVisible = false; //监听值发生变化就关闭它
-        this.get_last();
+      this.loading = true;
+      this.$http("get","/api/integral/statistics/prize/list",this.condition, "v4").then(res => {
+        if (res.data.code == 1) {
+          this.last = res.data.data.list;
+          this.totals = res.data.data.total;
+        } else {
+          this.$message.error(res.data.data.msg);
+        }
+      }).finally(() => {
+        this.loading = false;
       });
     },
     //搜索框
@@ -540,73 +448,14 @@ export default {
     },
     //导出报表
     exportExcel() {
-      this.aherfUrl = "";
-      this.$confirm("确认导出奖扣报表?", "导出", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          this.deriveDis = true;
-          let params = {
-            employee_id: this.$store.getters.user_info.id,
-            month: this.condition.month,
-            page: this.condition.page
-          };
-          this.condition.dept_id > 0
-            ? (params.dept_id = this.condition.dept_id)
-            : (params.dept_id = 0);
-          this.condition.keyword == ""
-            ? (params.keyword = 0)
-            : (params.keyword = this.condition.keyword);
-          this.condition.complete != 0
-            ? (params.complete = this.condition.complete)
-            : (params.complete = 0);
-          this.condition.dept_id
-            ? (params.dept_ids = this.condition.dept_id)
-            : "";
-          this.$http("get", "/api/download/prize/list/v4", params).then(res => {
-            if (res.data.code == 1) {
-              this.deriveJobId = res.data.data.job_id;
-              this.downloadResult();
-            } else {
-              this.deriveDis = false;
-            }
-          });
-        })
-        .catch(() => {});
-
-      this.dialogVisible = false;
-      return;
-      let data = "";
-      //部门
-      this.condition.dept_id > 0
-        ? (data += "&dept_id=" + this.condition.dept_id)
-        : (data += "&dept_id=0");
-      //时间
-      data += "&month=" + this.condition.month;
-      //搜索框
-      this.condition.keyword == ""
-        ? (data += "&keyword=0")
-        : (data += "&keyword=" + this.condition.keyword);
-      //是否达标
-      this.condition.complete != 0
-        ? (data += "&complete=" + this.condition.complete)
-        : (data += "&complete=0");
-      //当前页数
-      data += "&page=" + this.condition.page;
-      console.log(data);
-      let token = this.$getToken ? this.$getToken : getToken();
-      window.open(
-        process.env.BASE_API +
-          "/api/download/prize/list/v4?employee_id=" +
-          this.$store.getters.user_info.id +
-          data +
-          "&token=" +
-          token,
-        "_blank"
-      );
-      this.dialogVisible = false;
+      let params = {
+        employee_id: this.$userInfo().id,
+        month: this.condition.month,
+        dept_id:this.condition.dept_id||0,
+        keyword:this.condition.keyword,
+        complete:this.condition.complete
+      };
+      this.$downloadFile('api/download/prize/list/v4',params,this.$route.path);
     },
     //分页选择显示多少条
     handleCurrentChange_xq(val) {
@@ -619,7 +468,6 @@ export default {
       this.get_last();
     },
 
-    //
     handleSizeChange(val) {
       this.formData.page_size = val;
       this.get_list();
@@ -630,27 +478,13 @@ export default {
     },
 
     get_list() {
-      let self = this;
-      self.loading = true;
-      // const headers = { Accept: "application/vnd.test.v3+json" };
-      self
-        .$http(
-          "get",
-          "/api/integral/statistics/prize/list",
-          self.formData,
-          "v3"
-        )
-        .then(res => {
-          if (res.data.code == 1) {
-            self.list = res.data.data.list;
-            self.total = res.data.data.total;
-          } else {
-            self.$message.error(res.data.data.msg);
-          }
-        })
-        .finally(() => {
-          self.loading = false;
-        });
+      this.loading = true;
+      this.$http("get","/api/integral/statistics/prize/list", this.formData,"v3").then(res => {
+          this.list = res.data.data.list;
+          this.total = res.data.data.total;
+      }).finally(() => {
+        this.loading = false;
+      });
     },
     search() {
       this.get_list();
@@ -718,9 +552,7 @@ export default {
         employee_id: this.item.id || 0,
         month: this.formData.month
       };
-      this.$http("get", "/api/integral/statistics/prize", data)
-        .then(res => {
-          if (res.data.code === 1) {
+      this.$http("get", "/api/integral/statistics/prize", data).then(res => {
             const item = res.data.data;
             this.employeeName = item.name;
             const deduct = item.chart.deduct;
@@ -754,47 +586,20 @@ export default {
                 passengersRewardData
               )
             ); //月奖扣人次
-          }
-        })
-        .finally(() => {
+        }).finally(() => {
           this.echart_loading = false;
         });
     },
-    // v1
     getDataV1(callBack) {
-      let self = this;
-      self.personalData_loading = true;
+      this.personalData_loading = true;
       const data = {
         employee_id: this.item.id || 0,
         month: this.formData.month
       };
-      self
-        .$http("get", "/api/integral/statistics", data)
-        .then(res => {
-          if (res.data.code == 1) {
-            self.personalData = res.data.data;
-          } else {
-            self.$message.error(res.data.data.msg);
-          }
-        })
-        .catch(e => {
-          self.$message.error(res.data.data.msg);
-        })
-        .finally(() => {
-          self.personalData_loading = false;
-        });
-    },
-    dept_null(val) {
-      this.toPdepts = val[val.length - 1];
-      if (val.length == 0) {
-        this.formData.dept_id = 0;
-      } else {
-        this.formData.dept_id = this.dept_name_xq[this.dept_name_xq.length - 1];
-      }
-      this.$nextTick(() => {
-        this.formData.page = 1;
-        this.$refs.depts.dropDownVisible = false;
-        this.get_list();
+      this.$http("get", "/api/integral/statistics", data).then(res => {
+          this.personalData = res.data.data;
+      }).finally(() => {
+        this.personalData_loading = false;
       });
     },
     // 递归判断列表,把最后的children设为undefined

+ 10 - 176
src/views/statistics_new/total_rank.vue

@@ -11,21 +11,13 @@
     <div class="manager_statistics_box">
       <el-form :inline="true">
         <el-form-item label="部门">
-          <deptData  deptStyle="height:24px;line-height:24px;margin-top:7px;" v-if="toPdept && toPdept!=0" :refsName="$refs.dept" :toPdept="toPdept"></deptData>
-          <el-cascader class="date-picker-width" v-model="dept_name" :props="{ label: 'name', value: 'id'}" :options="dept_tree" ref="dept" clearable filterable change-on-select placeholder="全公司">
-            <template slot-scope="{ node, data }">
-              <span>
-                <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-              </span>
-              <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-            </template>
-          </el-cascader>
+            <ShowDeptName :deptId.sync="formData.dept_id"></ShowDeptName>
         </el-form-item>
         <el-form-item><el-checkbox v-model="agePolyethism" size="medium" label="只看工龄分" border></el-checkbox></el-form-item>
         <el-form-item><el-checkbox v-model="sort" size="medium" label="排名由低到高" border></el-checkbox></el-form-item>
         <el-form-item>
-          <!-- <el-button type="primary" plain @click="dialogVisible = true" :disabled="deriveDis">导出排名</el-button> -->
-          <a :href="aherfUrl" ref="aherfClick"></a>
+          <el-button type="primary" plain @click="dialogVisible = true" :disabled="deriveDis">导出排名</el-button>
+          <!-- <a :href="aherfUrl" ref="aherfClick"></a> -->
           <!-- <el-button type="primary" plain @click="byRanking">轮播排名</el-button> -->
         </el-form-item>
       </el-form>
@@ -94,38 +86,8 @@
           </el-form-item>
         </div>
         <el-form-item label="部门">
-          <deptData deptStyle="height:24px;line-height:24px;margin-top:7px;" v-if="toPdept2 && toPdept2!=0" :refsName="$refs.dept2" :toPdept="toPdept2"></deptData>
-          <el-cascader
-            class="date-picker-width cascader_bm"
-            v-model="Dc_Data.dept_name"
-            :options="dept_tree"
-            :props="{ label: 'name', value: 'id'}"
-            ref="dept2"
-            clearable
-            filterable
-            change-on-select
-            placeholder="全公司"
-          >
-            <template slot-scope="{ node, data }">
-              <span>
-                <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-              </span>
-              <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-            </template>
-          </el-cascader>
+              <ShowDeptName :deptId.sync="Dc_Data.dept_id"></ShowDeptName>
         </el-form-item>
-        <!-- <el-form-item label="规则分类" style="margin-left:20px">
-          <el-cascader
-            class="date-picker-width"
-            v-model="Dc_Data.rule_id"
-            :options="rule_trees"
-            :props="props"
-            ref="rule"
-            clearable
-            collapse-tags
-            placeholder="请选择规则分类"
-          ></el-cascader>
-        </el-form-item> -->
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="dialogVisible = false">取 消</el-button>
@@ -133,56 +95,6 @@
       </span>
     </el-dialog>
 
-    <el-dialog title="轮播排名" :visible.sync="byRankingShow" width="500px">
-      <div>
-        <el-form :inline="true" ref="byRankingData" :model="byRankingData" :rules="byRankingDataRules" label-width="90px">
-          <div style="color:rgb(122 202 126);font-size: 13px;padding:5px 0 20px 0">设置后,相关排名信息可在各类智能终端屏幕上的网页浏览器滚屏展示</div>
-          <el-form-item label="展示标题">
-            <el-input
-              type="textarea"
-              :autosize="{ minRows: 2, maxRows: 6 }"
-              v-model="titleVals"
-              placeholder="请输入标题"
-              maxlength="20"
-              show-word-limit
-              style="width: 341px"
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="选择部门">
-            <deptData  deptStyle="height:24px;line-height:24px;margin-top:7px;" v-if="toPdept1 && toPdept1!=0" :refsName="$refs.dept1" :toPdept="toPdept1"></deptData>
-            <el-cascader
-              class="date-picker-width"
-              v-model="byRankingDeptId"
-              :options="dept_tree"
-              :props="{ label: 'name', value: 'id'}"
-              ref="dept1"
-              clearable
-              filterable
-              change-on-select
-              placeholder="全公司"
-            >
-              <template slot-scope="{ node, data }">
-                <span>
-                  <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
-                </span>
-                <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
-              </template>
-            </el-cascader>
-          </el-form-item>
-          <el-form-item label="人员范围" prop="position" :required="true">
-            <el-radio-group v-model="byRankingData.position">
-              <el-radio label="all">管理者和员工</el-radio>
-              <el-radio label="manager">只看管理者</el-radio>
-              <el-radio label="employee">只看员工</el-radio>
-            </el-radio-group>
-          </el-form-item>
-        </el-form>
-      </div>
-      <span slot="footer">
-        <el-button @click="byRankingShow = false">取 消</el-button>
-        <el-button type="primary" @click="swiperPage('byRankingData')">开始轮播</el-button>
-      </span>
-    </el-dialog>
   </div>
 </template>
 <script>
@@ -195,15 +107,10 @@ export default {
         //导出数据
         value1: '', //时间
         DC_position: '全部', //人员
-        dept_name: [], //部门
+        dept_id:0, //部门
         work_age:0
         // rule_id: [], //规则
       },
-      // positions: [
-      // 	{ id: 0, age: "all", name: "全部" },
-      // 	{ id: 1, age: "manager", name: "管理者" },
-      // 	{ id: 2, age: "employee", name: "员工" },
-      // ],
       titleVals: '',
       titleVal: {
         titleVal1: '',
@@ -232,7 +139,7 @@ export default {
       dept_tree: [],
       loading: false,
       formData: {
-        dept_id: '0',
+        dept_id: 0,
         sort: 'DESC',
         page: 1,
         page_size: 10,
@@ -284,16 +191,9 @@ export default {
       this.formData.page = 1;
       this.get_list();
     },
-    dept_name(val) {
-      this.toPdept = val[val.length-1]
-      if (val.length !== 0) {
-        this.formData.dept_id = val[val.length - 1];
-      } else {
-        this.formData.dept_id = '0';
-      }
+    'formData.dept_id'(val) {
       this.formData.page = 1;
       this.$nextTick(() => {
-        this.$refs.dept.dropDownVisible = false;
         this.get_list();
       });
     },
@@ -303,10 +203,6 @@ export default {
       this.byRankingDeptId = val;
       this.$refs.dept1.dropDownVisible = false;
     },
-    'Dc_Data.dept_name': function(val) {
-      this.toPdept2 = val[val.length-1]
-      this.$refs.dept2.dropDownVisible = false;
-    }
   },
   methods: {
     downloadResult(){
@@ -338,84 +234,22 @@ export default {
       }
     },
     exportExcel() {
-      this.aherfUrl = ''
-      this.$confirm('确认导出排名?', '导出', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
         //人员
         this.Dc_Data.DC_position =
           this.Dc_Data.DC_position == 'manager' ? 'manager' : this.Dc_Data.DC_position == 'employee' ? 'employee' : this.Dc_Data.DC_position == '全部' ? 'all' : 'all';
         //部门
-        let dept_name;
-        for (let i in this.Dc_Data.dept_name) {
-          dept_name = this.Dc_Data.dept_name[i];
-        }
-        this.Dc_Data.dept_name = dept_name;
-
-        this.deriveDis = true
         let params = {
           position: this.Dc_Data.DC_position,
           work_age: this.Dc_Data.work_age,
           pt_id: 3,
           type: 'all',
           employee_id: this.$store.getters.user_info.id,
+          dept_id:this.Dc_Data.dept_id
         }
         this.Dc_Data.value1 ? params.start_date = this.Dc_Data.value1[0] : ''
         this.Dc_Data.value1 ? params.end_date = this.Dc_Data.value1[1] : ''
-        this.Dc_Data.dept_name > 0 ? params.dept_id = this.Dc_Data.dept_name : params.dept_id = 0
-
-        this.$http('get','/api/download/ranking/v2',params).then((res)=>{
-          if(res.data.code == 1){
-            this.deriveJobId = res.data.data.job_id
-            this.downloadResult()
-          }else{
-            this.deriveDis = false
-          }
-        })
-      }).catch(() => {
-
-      })
-      this.dialogVisible = false;
-
-      return
-
-      let data = '';
-      if (this.Dc_Data.value1) {
-        data += '&start_date=' + this.Dc_Data.value1[0];
-        data += '&end_date=' + this.Dc_Data.value1[1];
-      }
-      data += '&position=' + this.Dc_Data.DC_position;
-      data += '&work_age=' + this.Dc_Data.work_age
-      this.Dc_Data.dept_name > 0 ? (data += '&dept_id=' + this.Dc_Data.dept_name) : (data += '&dept_id=0');
-      // var id = window.open(
-      // 	process.env.BASE_API +
-      // 	"/api/download/ranking/v2?pt_id=3&type=all&employee_id=" +
-      // 	this.$store.getters.user_info.id +
-      // 	data,
-      // 	"_blank"
-      // );
-      var tempwindow = window.open('_blank'); // 先打开页面
-      tempwindow.document.write(
-        "<p style='text-align:center;padding-top:50px;font-size:24px'>数据报表正在生成,生成后将自动下载,请不要关闭此标签页<br/><span style='font-size:17px'>(如网络错误请刷新后重试)<span/></p>"
-      );
-      tempwindow.document.title = '导出';
-      let token = this.$getToken?this.$getToken:getToken()
-      tempwindow.location = process.env.BASE_API + '/api/download/ranking/v2?pt_id=3&type=all&employee_id=' + this.$store.getters.user_info.id + data+'&token='+token; // 后更改页面地址
-      this.dialogVisible = false;
-
-      // var img = new Image(); //创建img标签
-      // img.src = 'http://5b0988e595225.cdn.sohucs.com/images/20170930/89fe9e8a782645048fb826e074208862.jpeg';
-      // let imgSty = 'width: 100%; height: 100%;';
-      // img.style = imgSty;
-      // img.style.width = '50%';
-      // img.style.height = '50%';
-      // img.style.position='absolute'
-      // img.style.top='50%'
-      // img.style.left='50%'
-      // img.style.margin ='-12.5% 0 0 -25%'
-      // tempwindow.document.write(img.outerHTML);
+        this.dialogVisible=false;
+        this.$downloadFile('api/download/ranking/v2',params,this.$route.path);
     },
     //轮播排名弹窗
     byRanking() {

+ 1 - 1
src/views/workbench/grade/award_punish.vue

@@ -11,7 +11,7 @@
         <el-button type="primary" @click="point_a" plain>奖扣A分</el-button>
       </el-col>
       <el-col :span="6" :offset="6">
-        <el-input v-model="keyword" placeholder="输入同事姓名/内容" @keyup.enter.native="getData">
+        <el-input v-model="keyword" placeholder="输入内容" @keyup.enter.native="getData">
           <el-button slot="append" @click="getData" icon="el-icon-search"></el-button>
         </el-input>
       </el-col>