347617796@qq.com 4 năm trước cách đây
mục cha
commit
8344c7b6a8

+ 5 - 0
package-lock.json

@@ -7129,6 +7129,11 @@
         "minimist": "^1.2.5"
       }
     },
+    "moment": {
+      "version": "2.29.0",
+      "resolved": "https://registry.npm.taobao.org/moment/download/moment-2.29.0.tgz?cache=0&sync_timestamp=1600761794339&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmoment%2Fdownload%2Fmoment-2.29.0.tgz",
+      "integrity": "sha1-/L75VYRNkd61VDhhPdzsVuhqNCU="
+    },
     "move-concurrently": {
       "version": "1.0.1",
       "resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz",

+ 1 - 0
package.json

@@ -14,6 +14,7 @@
     "core-js": "^3.6.5",
     "dingtalk-jsapi": "^2.11.25",
     "element-ui": "^2.13.2",
+    "moment": "^2.29.0",
     "vconsole": "^3.3.4",
     "vue": "^2.6.11",
     "vue-router": "^3.2.0",

+ 15 - 5
src/api/axios.js

@@ -10,7 +10,7 @@ const service = axios.create({
 	baseURL: process.env.VUE_APP_BASE_API, // api的base_url
 	timeout: 5000,
 	headers: {
-		'Content-Type': 'application/x-www-form-urlencoded'
+		'Content-Type': 'application/x-www-form-urlencoded',
 	},
 	transformRequest: [function(data) {
 		return qs.stringify(data)
@@ -19,10 +19,20 @@ const service = axios.create({
 
 service.interceptors.request.use(
 	config => {
-		// if (getToken()) {
-		// 	config.headers['A-Token'] = getToken()
-			config.headers['A-Token'] = ' eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvZGluZy5pbnN5cy5nMTA3LmNvbVwvYXBpXC9kaW5nXC9sb2dpbiIsImlhdCI6MTYwMDY3NjM5NCwiZXhwIjoxNjAxMjc2Mzk0LCJuYmYiOjE2MDA2NzYzOTQsImp0aSI6IkpPZWZoc0ZpWlpLeUFubHgiLCJzdWIiOjIsInBydiI6ImNhNjQ4OWQ1MGYyNDA3YTY3ODMwZTgwOTBkMDE0ODgzNTY4NTk2MmIiLCJyb2xlIjoiZW1wbG95ZWUifQ.n4UbsnWf48m9tyb7yCHmvkULu-WK2sdrBc8lC2tQxKc'
-		// }
+		if (getToken()) {
+			config.headers['A-Token'] = getToken()
+			// config.headers['A-Token'] = ' eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdGVzdC1kaW5nLmcxMDcuY29tXC9hcGlcL2RpbmdcL2xvZ2luIiwiaWF0IjoxNjAxMjc2NzgzLCJleHAiOjE2MDE4NzY3ODMsIm5iZiI6MTYwMTI3Njc4MywianRpIjoiNzRZaHFnQW5UOVlxOEVDNiIsInN1YiI6MiwicHJ2IjoiY2E2NDg5ZDUwZjI0MDdhNjc4MzBlODA5MGQwMTQ4ODM1Njg1OTYyYiIsInJvbGUiOiJlbXBsb3llZSJ9.gamq3c4oI9ctknWq-uyx880S32MvHWz_SkRJ0euX66k'
+		}
+		
+		if (config.url == '/api/integral/statistics/ranking' || config.url == '/api/integral/review/apply') {
+		  config.headers['Accept'] = 'application/vnd.test.v2+json'
+		}
+		if (config.url == '/api/integral/statistics/prize/list'  || config.url =='/api/integral/performance/employee') {
+		  config.headers['Accept'] = 'application/vnd.test.v3+json'
+		}
+		if (config.url == '/api/integral/statistics/integral') {
+		  config.headers['Accept'] = 'application/json, text/plain, */*';
+		}
 		return config
 	},
 	error => {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 2
src/assets/css/iconfont.css


BIN
src/assets/css/iconfont.eot


+ 6 - 0
src/assets/css/iconfont.svg

@@ -38,6 +38,12 @@ Created by iconfont
     <glyph glyph-name="shezhi_zuzhijiagou" unicode="&#59153;" d="M628.4 810.7c42.8 0 77.6-34.7 77.6-77.6v-155.2c0-42.8-34.7-77.6-77.6-77.6h-77.6v-77.6h196.5c18.6 0 33.9-15 36-34.3l0.2-4.5v-116.4h77.6c42.8 0 77.6-34.7 77.6-77.6v-155.2c0-42.8-34.7-77.6-77.6-77.6H628.4c-42.8 0-77.6 34.7-77.6 77.6V190.1c0 42.8 34.7 77.6 77.6 77.6h82.7v77.6H312.9v-77.6h82.8c42.8 0 77.6-34.7 77.6-77.6v-155.2c0-42.8-34.7-77.6-77.6-77.6H162.9c-42.8 0-77.6 34.7-77.6 77.6V190.1c0 42.8 34.7 77.6 77.6 77.6h77.6V384.1c0 19.9 14 36.3 32 38.5l4.2 0.3h196.5v77.6h-77.5c-42.8 0-77.6 34.7-77.6 77.6v155c0 42.8 34.7 77.6 77.6 77.6h232.7zM395.6 190.1H162.9v-155.2h232.7V190.1z m465.5 0H628.4v-155.2h232.7V190.1z m-232.7 543H395.6v-155.2h232.7V733.1z"  horiz-adv-x="1024" />
 
     
+    <glyph glyph-name="dingdingPC_tongji" unicode="&#59171;" d="M541.1 849.5h-58.2c-32.1 0-58.2-26-58.2-58.2v-814.5c0-32.1 26-58.2 58.2-58.2h58.2c32.1 0 58.2 26 58.2 58.2V791.3c0 32.1-26.1 58.2-58.2 58.2zM832 384h-58.2c-32.1 0-58.2-26-58.2-58.2v-349.1c0-32.1 26-58.2 58.2-58.2H832c32.1 0 58.2 26 58.2 58.2V325.8c0 32.2-26.1 58.2-58.2 58.2zM250.2 587.6H192c-32.1 0-58.2-26-58.2-58.2v-552.7c0-32.1 26-58.2 58.2-58.2h58.2c32.1 0 58.2 26 58.2 58.2V529.5c0 32.1-26.1 58.1-58.2 58.1z"  horiz-adv-x="1024" />
+
+    
+    <glyph glyph-name="dingdingPC_shezhi" unicode="&#59172;" d="M518.2 846.7c-196.1 0-355.1-158.9-355.1-355.1 0-196.1 158.9-355.1 355.1-355.1 196.1 0 355.1 158.9 355.1 355.1-0.1 195.9-159 355.1-355.1 355.1z m0-523.4c-92.7 0-168.2 75.4-168.2 168.2s75.4 168.2 168.2 168.2 168.2-75.4 168.2-168.2-75.5-168.2-168.2-168.2z m-322.5-59L74.9 143.6c-9.6-9.6-13.3-23.7-9.7-36.8 3.5-13.1 13.9-23.3 27.1-26.9l103.2-27.1 27.1-103.2c3.4-13.1 13.5-23.5 26.9-27.1 3.3-0.8 6.6-1.2 9.9-1.2 9.9 0 19.5 3.8 27 11.2L455.7 102c-107.4 17.2-200 77.4-260 162.3z m753.2-120.7L835.5 257c-62.1-84-156.9-142.4-265.4-156.5L738-67.4c7.1-7.1 16.9-11.2 27-11.2 3.3 0 6.6 0.4 9.9 1.2 13.1 3.5 23.3 13.9 26.9 27.1l27 103.3L932 80c13.1 3.4 23.5 13.5 27.1 26.9 3.3 12.9-0.6 27-10.2 36.7z"  horiz-adv-x="1024" />
+
+    
 
 
   </font>

BIN
src/assets/css/iconfont.ttf


BIN
src/assets/css/iconfont.woff


+ 2 - 1
src/assets/css/reset.css

@@ -177,7 +177,7 @@ table { border-collapse:collapse; border-spacing:0; }
 }
 
 .fontColorF {
-	color: #909399 !important;
+	color: #606266 !important;
 }
 
 .fontColorT {
@@ -209,6 +209,7 @@ table { border-collapse:collapse; border-spacing:0; }
 .terr-right{
 	padding: 20px;
 	min-width: 600px;
+	box-sizing: border-box;
 }
 .border-right:after {
 	content: ' ';

BIN
src/assets/image/statistics_NO1.png


BIN
src/assets/image/statistics_NO2.png


BIN
src/assets/image/statistics_NO3.png


+ 584 - 751
src/components/EmployeeSelector.vue

@@ -1,490 +1,354 @@
 <template>
-  <div>
-    <div class="employee_selector_box">
-      <el-row :gutter="10">
-        <el-col :xs="11" :sm="11" :md="11" :lg="11" :xl="11" class="scroller-box one">
-          <div class="search-box">
-            <div class="search flex-box flex-v-ce">
-              <el-button slot="append" icon="el-icon-search" class="manager_button"></el-button>
-              <el-input v-model="keyword" placeholder="请输入内容"></el-input>
-            </div>
-          </div>
-		  <div class="flex-box flex-v-ce" style="padding: 0 10px;border-bottom: 1px solid #f1f1f1;">
-			  <div class="dept_path flex-1">
-			    <a href="javascript:void(0);" @click="back_by_index(0)">全公司</a>
-			    <a v-for="(item, index) in pid_list_arr" :key="index"  href="javascript:void(0);" @click="back_by_index(index + 1)">
-			      <i class="el-icon-arrow-right"></i>
-			      {{item.name}}
-			    </a>
-			  </div>
-			  <el-checkbox v-if="isChecKedAll" v-model="checked" @change="checkedChange" :indeterminate="indeterminate" >全选</el-checkbox>
-		  </div>
-          <el-scrollbar wrap-class="column-wrapper scrollable-items-container" :native="false" style="height: 354px;" v-loading="table_loading">
-            <div class="choose_left">
-              <a href="javascript:void(0)" v-for="(item,index) in dept_list" :key="index">
-                <div class="employee_cell" @click="select_dept(item)" v-show="item.pid == pid && item.name.indexOf(keyword) >= 0 && dept_not_select.indexOf(item.id) < 0">
-                  <i class="el-icon-caret-right" style=" display: inline-block;"></i>
-                  <div class="employee_checkbox" v-if="can_select_dept">
-                    <el-checkbox v-model="item.checked"></el-checkbox>
-                  </div>
-                  <div class="employee_name">
-                    {{item.name}}
-                  </div>
-                  <div v-if="can_select_dept" class="dept_child_cell">
-                    <span href="javascript:void(0);" class="child_btn" @click.stop="show_child(item)">
-                      | 下级
-                    </span>
-                  </div>
-                  <div class="employee_cell_clear"></div>
-                </div>
-              </a>
-              <div class="persons_box" style="padding-top:4px;" v-if="list.length>0">
-                <a class="employee_cell_a"  href="javascript:void(0)" v-for="(item,index) in list" :key="index">
-                  <div class="employee_cell flex-box flex-v-ce" v-if="can_select_employee" @click.prevent.stop="select_employee(item)">
-					<div class="employee_checkbox">
-                      <el-checkbox v-model="item.checked"></el-checkbox>
-                    </div>
-					<userImage :user_name="item.name" :img_url="item.img_url" width="30px" height="30px"></userImage>
-                    <div class="employee_name">
-                      {{item.name}}
-                    </div>
-                    <div class="employee_cell_clear"></div>
-                  </div>
-                </a>
-              </div>
-			  <div v-else class="fontColorF" style="text-align: center;margin-top: 50px;">暂无可选人员,请确保在'组织架构'中的人员开启了参与积分管理</div>
-            </div>
-          </el-scrollbar>
-        </el-col>
-        <el-col :xs="2" :sm="2" :md="2" :lg="2" :xl="2" class="col-line"><span style="opacity: 0;">空</span></el-col>
-        <el-col :xs="11" :sm="11" :md="11" :lg="11" :xl="11" class="scroller-box">
-          <div class="option-box flex-box flex-v-ce">
-            <div class="fontColorF flex-1" v-show="multi">已选择{{employee_selected_list.length}}个员工</div>
-            <el-button type="type" @click="clear_data">清空</el-button> 
-          </div>
-          <el-scrollbar wrap-class="column-wrapper scrollable-items-container" :native="false" style="height: 400px;">
-            <div class="choose_right">
-              <div class="employee_cell flex-box flex-v-ce" v-for="(item,index) in dept_selected_list" :key="index">
-                <div class="employee_name">
-                  {{item.dept_name}}
-                </div>
-                <div class="employee_delete">
-                  <el-button type="default" size="mini" @click="dept_cancel(item)" icon="el-icon-close" circle></el-button>
-                </div>
-                <div class="employee_cell_clear"></div>
-              </div>
-
-              <div class="employee_cell" v-for="(item,index) in employee_selected_list" :key="index">
-				 <userImage :user_name="item.name" :img_url="item.img_url" width="30px" height="30px"></userImage>
-                <div class="employee_name">
-                  {{item.name}}
-                </div>
-                <div class="employee_delete">
-                  <el-button type="default" size="mini" @click="employee_cancel(item,true)" icon="el-icon-close" circle></el-button>
-                </div>
-                <div class="employee_cell_clear"></div>
-              </div>
-            </div>
-          </el-scrollbar>
-        </el-col>
-      </el-row>
-    </div>
-  </div>
+	<div>
+		<div class="employee_selector_box">
+			<el-row :gutter="10">
+				<el-col :xs="11" :sm="11" :md="11" :lg="11" :xl="11" class="scroller-box one">
+					<div class="search-box">
+						<div class="search flex-box" style="margin-bottom: 7px;">
+							<el-input v-model="keyword" placeholder="请输入姓名" clearable></el-input>
+						</div>
+						<div class="search flex-box" v-if="can_select_dept">
+						    <el-cascader class="date-picker-width" v-model="dept_id" :options="dept_list" :props="{ checkStrictly: true,value:'id',label:'name',children:'_child'}" ref="dept"	clearable filterable placeholder="全公司"></el-cascader>
+						</div>
+					</div>
+					<div class="flex-box" style="padding: 10px;border-bottom: 1px solid #f1f1f1;">
+						<div class="flex-1"></div>
+						<el-checkbox v-if="isChecKedAll" v-model="checked" @change="checkedChange" :indeterminate="indeterminate">全选</el-checkbox>
+					</div>
+					<el-scrollbar wrap-class="column-wrapper scrollable-items-container" :native="false" style="height: 354px;" v-loading="table_loading">
+						<div class="choose_left">
+							<div class="persons_box" style="padding-top:4px;" v-if="list.length > 0">
+								<a class="employee_cell_a" href="javascript:void(0)" v-for="(item, index) in list" :key="index">
+									<div class="employee_cell flex-box flex-v-ce" v-if="can_select_employee" @click.prevent.stop="select_employee(item)">
+										<div class="employee_checkbox"><el-checkbox v-model="item.checked"></el-checkbox></div>
+										<userImage :user_name="item.name" :img_url="item.img_url" width="30px" height="30px"></userImage>
+										<div class="employee_name">{{ item.name }}</div>
+										<div class="employee_cell_clear"></div>
+									</div>
+								</a>
+							</div>
+							<div v-else class="fontColorF" style="text-align: center;margin-top: 50px;">暂无可选人员,请确保在'组织架构'中的人员开启了参与积分管理</div>
+						</div>
+					</el-scrollbar>
+				</el-col>
+				<el-col :xs="2" :sm="2" :md="2" :lg="2" :xl="2" class="col-line"><span style="opacity: 0;">空</span></el-col>
+				<el-col :xs="11" :sm="11" :md="11" :lg="11" :xl="11" class="scroller-box">
+					<div class="option-box flex-box flex-v-ce">
+						<div class="fontColorF flex-1" v-show="multi">已选择{{ employee_selected_list.length }}个员工</div>
+						<el-button type="type" @click="clear_data()">清空</el-button>
+					</div>
+					<el-scrollbar wrap-class="column-wrapper scrollable-items-container" :native="false" style="height: 400px;">
+						<div class="choose_right">
+							<div class="employee_cell flex-box flex-v-ce" v-for="(item, index) in dept_selected_list" :key="index">
+								<div class="employee_name">{{ item.dept_name }}</div>
+								<div class="employee_delete"><el-button type="default" size="mini" @click="dept_cancel(item)" icon="el-icon-close" circle></el-button></div>
+								<div class="employee_cell_clear"></div>
+							</div>
+
+							<div class="employee_cell" v-for="(item, index) in employee_selected_list" :key="index">
+								<userImage :user_name="item.name" :img_url="item.img_url" width="30px" height="30px"></userImage>
+								<div class="employee_name">{{ item.name }}</div>
+								<div class="employee_delete">
+									<el-button type="default" size="mini" @click="employee_cancel(item, true)" icon="el-icon-close" circle></el-button>
+								</div>
+								<div class="employee_cell_clear"></div>
+							</div>
+						</div>
+					</el-scrollbar>
+				</el-col>
+			</el-row>
+		</div>
+	</div>
 </template>
 
 <script>
-  
-  export default {
-    props: {
-      append_body: {
-        type: Boolean,
-        default: false
-      },
-      visible: {
-        type: Boolean,
-        default: false
-      },
-      can_select_dept: {
-        type: Boolean,
-        default: true
-      },
-      can_select_employee: {
-        type: Boolean,
-        default: true
-      },
-      dept_not_select: {
-        type: Array,
-        default: () => {
-          return []
-        }
-      },
-      selected: {
-        type: Object,
-        default: () => {
-          return {
-            employee: [],
-            dept: []
-          }
-        }
-      },
-      multi: {
-        type: Boolean,
-        default: true
-      },
-      dept_multi: {
-        type: Boolean,
-        default: true
-      },
-      employee_list: {
-        type: Array,
-        default: () => {
-          return []
-        }
-      },
-      close_clear_data: {
-        type: Boolean,
-        default: true
-      },
-      max: {
-        type: Number,
-        default: 0
-      },
-      user_no_select:{//是否能选择创始人
-        type: Boolean,
-        default: true
-      },
-      isChecKedAll:{
-        type: Boolean,
-        default: true
-      },
-	  my_no_select:{//当前设置人的id
-        type: Number,
-        default: 0
-	  },
-      "grouping_Json":Array
+
+export default {
+  props: {
+    can_select_dept: {//是否能选择公司
+      type: Boolean,
+      default: true
+    },
+    can_select_employee: {//是否能选择员工
+      type: Boolean,
+      default: true
     },
-    name: "EmployeeSelector",
-    data() {
-      let selected = JSON.parse(JSON.stringify(this.selected))
-      let user_no_select = JSON.parse(JSON.stringify(this.user_no_select))
-      return {
-        table_loading:false,
-        dialogVisible: true,
-        employee_selected_list: selected.employee,
-        dept_selected_list: selected.dept,
-        employee_selected: [],
-        dept_selected: [],
-        com_height: '100%',
-        company_info: {},
-        actions_show: false,
-        dept_name: '',
-        dept_id: 0,
-        list: [],
-        dept_list: [],
-        keyword: '',
-        owner_id: 0,
-        user_info: this.$store.getters.user_info,
-        pid: 0,
-        pid_list: [],
-        selected_box_width: '0',
-        pid_list_arr: [],
-        checked: false,
-        indeterminate: false,
-        not_user: user_no_select
+    dept_not_select: {//排除部门的ID,包含ID时不出现在选择列表中
+      type: Array,
+      default: () => {
+        return []
       }
     },
-    watch: {
-      max(val) {
-        this.set_button_width()
-      },
-      selected(val) {
-        let selected = JSON.parse(JSON.stringify(val))
-        this.employee_selected = []
-        this.dept_selected = []
-        this.employee_selected_list = selected.employee
-        this.dept_selected_list = selected.dept
-        for (let i in selected.employee) {
-          this.employee_selected.push(selected.employee[i].id)
+    selected: {//已经选择的员工和部门
+      type: Object,
+      default: () => {
+        return {
+          employee: [],
+          dept: []
         }
-        for (let i in selected.dept) {
-          this.dept_selected.push(selected.dept[i].dept_id)
+      }
+    },
+    multi: {//指定员工是否能多选
+      type: Boolean,
+      default: true
+    },
+    dept_multi: {//指定部门是否能多选
+      type: Boolean,
+      default: true
+    },
+    employee_list: {//指定显示的员工列表,注意:传值后组件的员工数据将不是统一向服务器获取的,而是指定的员工列表,格式是:[{id: 1, name: “张三”, img_url: “”}]
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    close_clear_data: {//关闭时是否清空选择的数据
+      type: Boolean,
+      default: true
+    },
+    max: {//当multi为true时,用来限制选择人数,0不生效
+      type: Number,
+      default: 0
+    },
+    user_no_select:{//是否能选择创始人
+      type: Boolean,
+      default: true
+    },
+    isChecKedAll:{//是否能全人员
+      type: Boolean,
+      default: true
+     },
+	 my_no_select:{//当前设置人的id
+		  type: Number,
+		  default: 0
+	 },
+  },
+  name: "EmployeeSelector",
+  data() {
+    let selected = JSON.parse(JSON.stringify(this.selected));
+	console.log(selected);
+    let user_no_select = JSON.parse(JSON.stringify(this.user_no_select));
+    return {
+      table_loading:false,
+      employee_selected_list: selected.employee,
+      dept_selected_list: selected.dept,
+      employee_selected: [],
+      dept_selected: [],
+      com_height: '100%',
+
+      list: [],//人员列表
+	  dept_name: '',//部门名称
+	  dept_id: 0,//部门ID
+	  pid:0,//部门ID实传
+      dept_list: [],//部门列表
+	  dept_list_arr: [],//收集的部门
+      keyword: '',//搜索值
+      checked: false,//是否全选
+      indeterminate: false,
+      not_user: user_no_select
+    }
+  },
+  watch: {
+	dept_id(val){
+		if(val.length>1){
+			this.pid=val[val.length-1];
+		}else{
+			this.pid=val[0];
+		}
+		this.get_user_list();
+		this.checked=false;
+	},
+    selected(val) {
+      let selected = JSON.parse(JSON.stringify(val))
+      this.employee_selected = []
+      this.dept_selected = []
+      this.employee_selected_list = selected.employee
+      this.dept_selected_list = selected.dept
+      for (let i in selected.employee) {
+        this.employee_selected.push(selected.employee[i].id)
+      }
+      for (let i in selected.dept) {
+        this.dept_selected.push(selected.dept[i].dept_id)
+      }
+    },
+    //搜索
+    keyword(val) {
+      this.get_user_list();
+	  this.checked=false;
+    }
+  },
+  methods: {
+    //全选择
+    checkedChange(val){
+      if (val) {
+        for (let i in this.list) {
+          this.$set(this.list[i], 'checked', true)
         }
-        this.set_button_width()
-      },
-      visible(val) {
-        setTimeout(() => {
-          if (this.$route.query.pid) {
-            this.pid = this.$route.query.pid
+        this.$nextTick(() => {
+          let employeeSelectedList = JSON.parse(JSON.stringify(this.employee_selected_list))
+          let employeeSelectedIds = [], total = 0
+          employeeSelectedList.forEach(element => {
+            employeeSelectedIds.push(element.id)
+          });
+          for (const i in this.list) {
+            if (employeeSelectedIds.includes(this.list[i].id)) {
+              total += 1
+            }else{
+              this.employee_selected_list.push(this.list[i])
+            }
           }
-          this.get_user_list();
-          this.get_dept_list()
-        }, 200)
-        // }
-        this.set_button_width()
-      },
-      employee_selected_list() {
-        let l = this.employee_selected_list.length + this.dept_selected_list.length
-        let width = 0.9 * l;
-        this.selected_box_width = width + 'rem'
-        this.set_button_width()
-      },
-      dept_selected_list() {
-        let l = this.employee_selected_list.length + this.dept_selected_list.length
-        let width = 0.9 * l;
-        this.selected_box_width = width + 'rem'
-        this.set_button_width()
-      },
-      //搜索
-      keyword() {
-        this.get_user_list(function() {
-
+          this.list.length == total?this.indeterminate = true:this.indeterminate = false
         })
+      }else{
+        this.clear_data()
       }
     },
-    methods: {
-		//全选择
-      checkedChange(val){
-        if (val) {
-          for (let i in this.list) {
-            this.$set(this.list[i], 'checked', true)
+    //添加或移除已添加的员工
+    employee_cancel(item) {
+      this.employee_selected_list.map((arr,index)=>{
+          if(arr.id==item.id){
+            this.employee_selected_list.splice(index,1);
           }
-          this.$nextTick(() => {
-            let employeeSelectedList = JSON.parse(JSON.stringify(this.employee_selected_list))
-            let employeeSelectedIds = [], total = 0
-            employeeSelectedList.forEach(element => {
-              employeeSelectedIds.push(element.id)
-            });
-            for (const i in this.list) {
-              if (employeeSelectedIds.includes(this.list[i].id)) {
-                total += 1
-              }else{
-                this.employee_selected_list.push(this.list[i])
-              }
-            }
-            this.list.length == total?this.indeterminate = true:this.indeterminate = false
-          })
-        }else{
-          this.clear_data()
-        }
-      },
-      close_before(done) {
-        this.close()
-      },
-      set_button_width() {
-
-      },
-      back() {
-        this.pid = this.pid_list[this.pid_list.length - 1]
-        this.pid_list.splice(this.pid_list.length - 1)
-        this.pid_list_arr.splice(this.pid_list_arr.length - 1)
-        this.get_user_list();
-      },
-      back_by_index(index) {
-        if (index == this.pid_list.length) {
-          return false
-        }
-        this.pid = this.pid_list[index]
-        this.pid_list.splice(index, 100)
-        this.pid_list_arr.splice(index, 100)
-        this.get_user_list(function() {})
-      },
-      show_child(item) {
-        this.pid_list.push(this.pid)
-        this.pid_list_arr.push(item)
-        this.pid = item.id
-        this.get_user_list(function() {
-
-        })
-      },
-      //添加或移除已添加的员工
-      employee_cancel(item) {
-        this.employee_selected_list.map((arr,index)=>{
-            if(arr.id==item.id){
-              this.employee_selected_list.splice(index,1);
-            }
-        })
-        this.list.map((arr,index)=>{
-            if(arr.id==item.id){
-             this.$set(arr, 'checked', false)
-            }
-        })
-      },
-      dept_cancel(item) {
-        this.dept_selected.splice(this.dept_selected.indexOf(item.id), 1)
-        let delete_index = -1
-        for (let i in this.dept_selected_list) {
-          if (this.dept_selected.indexOf(this.dept_selected_list[i].id) < 0) {
-            delete_index = i
+      })
+      this.list.map((arr,index)=>{
+          if(arr.id==item.id){
+           this.$set(arr, 'checked', false)
           }
+      })
+    },
+	//获取部门
+	get_dept_list() {
+		this.$axios('get','/api/department/tree').then(res => {
+			this.dept_list =this.getTreeData(res.data.data.list);
+		});
+	},
+	 // 递归判断列表,把最后的children设为undefined
+	 getTreeData(data) {
+		for (var i = 0; i < data.length; i++) {
+			if (data[i]._child.length < 1) {
+				// children若为空数组,则将children设为undefined
+				data[i]._child = undefined;
+			} else {
+				// children若不为空数组,则继续 递归调用 本方法
+				this.getTreeData(data[i]._child);
+			}
+		}
+		return data;
+	 },
+    //选择部门
+    dept_cancel(item) {
+      this.dept_selected.splice(this.dept_selected.indexOf(item.id), 1)
+      let delete_index = -1
+      for (let i in this.dept_selected_list) {
+        if (this.dept_selected.indexOf(this.dept_selected_list[i].id) < 0) {
+          delete_index = i
         }
-        if (delete_index >= 0) {
-          this.dept_selected_list.splice(delete_index, 1)
-          for (let i in this.dept_list) {
-            if (this.dept_list[i].dept_id == item.id) {
-              this.$set(this.dept_list[i], 'checked', false)
-            }
+      }
+      if (delete_index >= 0) {
+        this.dept_selected_list.splice(delete_index, 1)
+        for (let i in this.dept_list) {
+          if (this.dept_list[i].dept_id == item.id) {
+            this.$set(this.dept_list[i], 'checked', false)
           }
         }
-      },
-      //选择员工
-      select_employee(item) {
-        if (item.checked) {
-          item.checked = false
-          this.employee_cancel(item)
-        } else {
-          if (!this.multi) {
-            this.employee_selected = []
-            this.employee_selected_list = []
-            for (let i in this.list) {
-              this.$set(this.list[i], 'checked', false)
-            }
-          }
-          if (this.max > 0 && this.employee_selected_list.length == this.max && this.multi) {
-            this.$message.error('最多只能选择' + this.max + '人')
-            return false
+      }
+    },
+    //选择员工
+    select_employee(item) {
+      if (item.checked) {
+        item.checked = false
+        this.employee_cancel(item)
+      } else {
+        if (!this.multi) {
+          this.employee_selected = []
+          this.employee_selected_list = []
+          for (let i in this.list) {
+            this.$set(this.list[i], 'checked', false)
           }
-          this.employee_selected.push(item.id)
-          this.employee_selected_list.push({
-            id: item.id,
-            name: item.name,
-            img_url: item.img_url
-          })
-          item.checked = true
         }
-      },
-
-      select_dept(item) {
-        if (!this.can_select_dept) {
-          this.show_child(item)
+        if (this.max > 0 && this.employee_selected_list.length == this.max && this.multi) {
+          this.$message.error('最多只能选择' + this.max + '人')
           return false
         }
-        if (item.checked) {
-          item.checked = false
-          this.dept_cancel(item)
-        } else {
-          if (!this.dept_multi) {
-            this.dept_selected = []
-            this.dept_selected_list = []
-            for (let i in this.dept_list) {
-              this.$set(this.dept_list[i], 'checked', false)
-            }
-          }
-          this.dept_selected.push(item.id)
-          this.dept_selected_list.push({
-            dept_id: item.id,
-            dept_name: item.name,
-            avatar: '@/assets/image/e66f.jpg'
-          })
-          item.checked = true
-        }
+        this.employee_selected.push(item.id)
+        this.employee_selected_list.push({
+          id: item.id,
+          name: item.name,
+          img_url: item.img_url
+        })
+        item.checked = true
+      }
+    },
+
+    clear_data() {
+      this.employee_selected = []
+      this.employee_selected_list = []
+      this.dept_selected = []
+      this.dept_selected_list = []
+      this.checked = false
+      for (let i in this.list) {
+        this.$set(this.list[i], 'checked', false)
+      }
+      for (let i in this.dept_list) {
+        this.$set(this.dept_list[i], 'checked', false)
+      }
+    },
 
-      },
-      clear_data() {
+    close() {
+      if (this.close_clear_data) {
         this.employee_selected = []
         this.employee_selected_list = []
         this.dept_selected = []
         this.dept_selected_list = []
-        this.checked = false
         for (let i in this.list) {
           this.$set(this.list[i], 'checked', false)
         }
         for (let i in this.dept_list) {
           this.$set(this.dept_list[i], 'checked', false)
         }
-      },
-
-      close() {
-        this.$emit('update:visible', false)
-        this.$emit('cancel')
-        if (this.close_clear_data) {
-          this.employee_selected = []
-          this.employee_selected_list = []
-          this.dept_selected = []
-          this.dept_selected_list = []
-          for (let i in this.list) {
-            this.$set(this.list[i], 'checked', false)
-          }
-          for (let i in this.dept_list) {
-            this.$set(this.dept_list[i], 'checked', false)
-          }
-        }
-
-      },
-      confirm() {
-        this.$emit('confirm', {
-          employee: this.employee_selected_list,
-          dept: this.dept_selected_list
-        })
-        this.close()
-      },
-      //获取部门列表
-      get_dept_list() {
-        if (this.employee_list.length > 0) {
-          return
-        }
-        this.$axios('get','/api/department/index',{
-            pid: this.pid,
-            keyword: this.keyword
-        }).then((res) => {
-          for (let i in res.data.data.list) {
-            res.data.data.list[i]['checked'] = false
-            if (this.dept_selected.indexOf(res.data.data.list[i].id) >= 0) {
-              res.data.data.list[i]['checked'] = true
+      }
+    },
+    confirm() {
+      this.$emit('confirm', {
+        employee: this.employee_selected_list,
+        dept: this.dept_selected_list
+      })
+      this.close()
+    },
+    //获取员工详情
+    get_user_list() {
+      this.table_loading = true;
+      var that=this;
+      var employee_selected_list=this.employee_selected_list;
+      if (this.employee_list.length > 0) {
+        let list = this.employee_list
+        for (let i in list) {
+          list[i]['letter_index'] = '#';
+          if (this.$store.getters.employee_map[list[i].id]) {
+            list[i]['letter_index'] = this.$store.getters.employee_map[list[i].id].letter_index;
+            if (this.$store.getters.employee_map[list[i].id].img_url == '') {
+              list[i]['img_url'] = 'static/images/head_default.png';
+            } else {
+              list[i]['img_url'] = this.$store.getters.employee_map[list[i].id].img_url;
             }
           }
-          this.dept_list = res.data.data.list
-          this.owner_id = res.data.data.owner_id
-          this.company_info = res.data.data.company_info
-          if (res.data.data.dept_info == null) {
-            this.dept_name = JSON.parse(JSON.stringify(res.data.data.company_info.name))
-            this.dept_id = 0
-          } else {
-            this.dept_name = JSON.parse(JSON.stringify(res.data.data.dept_info.name))
-            this.dept_id = res.data.data.dept_info.id
-          }
-        })
-      },
-     //获取员工详情
-      get_user_list() {
-        this.table_loading = true;
-        var _this=this;
-        var employee_selected_list=this.employee_selected_list;
-		// var my_id=this.$getUserData().id;
-        if (this.employee_list.length > 0) {
-          let list = this.employee_list
-          for (let i in list) {
-            list[i]['letter_index'] = '#'
-            if (this.$store.getters.employee_map[list[i].id]) {
-              list[i]['letter_index'] = this.$store.getters.employee_map[list[i].id].letter_index
-              if (this.$store.getters.employee_map[list[i].id].img_url == '') {
-                list[i]['img_url'] = 'static/images/head_default.png'
-              } else {
-                list[i]['img_url'] = this.$store.getters.employee_map[list[i].id].img_url
-              }
-            }
 
-            list[i]['checked'] = false
-            if (this.employee_selected.indexOf(list[i].id) >= 0) {
-              list[i]['checked'] = true
-            }
+          list[i]['checked'] = false
+          if (this.employee_selected.indexOf(list[i].id) >= 0) {
+            list[i]['checked'] = true
           }
-
-          this.list = list.sort((a, b) => {
-            return a.letter_index.charCodeAt(0) - b.letter_index.charCodeAt(0)
-          })
-          return false
         }
-        this.list = []
-        this.$axios('get','/api/employee/index', {
-            dept_id: this.pid,//员工ID
-            keywords: this.keyword,//搜索关键字
-            page: 0,
-            page_size: 2000
-        }).then((res) => {
-          
-          var employee=res.data.data.list||[];
-		  var userAll=[];
-          employee.forEach((item,i)=>{
+        this.list = list.sort((a, b) => {
+          return a.letter_index.charCodeAt(0) - b.letter_index.charCodeAt(0)
+        })
+        return false
+      }
+	  
+      this.list = []
+      this.$axios('get','/api/employee/index',{ dept_id: this.pid,keywords: this.keyword, page: 0,page_size: 2000}).then((res) => {
+        var employee=res.data.data.list||[];
+		var userAll=[];
+        employee.forEach((item,i)=>{
 			  if(!this.not_user && item.is_creator == 1){//过滤创始人
 				  return null;
 			  }else if(this.my_no_select==item.id){//过滤掉当前设置人
@@ -492,319 +356,288 @@
 			  }else if(item.is_official==1){
 				  userAll.push(item);
 			  }
-          })
-		  userAll.map((item)=>{
+        })
+	    userAll.map((item)=>{
 			 item['checked'] = false;
 			 for(var i in employee_selected_list){//判断传进来的员工是否是员工集合里的,是就设为已点击状态
 			   if(employee_selected_list[i].id==item.id){
-			     item['checked'] = true;
+				 item['checked'] = true;
 			   }
-			 } 
-		  })
-          if (userAll.length == employee_selected_list.length) {
-            this.checked = true
-          }
-          _this.list = userAll
-        }).finally(() => {
-		    this.table_loading = false;
-		})
-      }
-    },
-    created() {
-      if (document.documentElement.style.height) {
-        this.com_height = document.documentElement.style.height
-      }
-      setTimeout(() => {
-        if (this.$route.query.pid) {
-          this.pid = this.$route.query.pid
-        }
-        this.get_user_list();
-        // this.get_dept_list()
-      }, 200)
-
+			 }
+	    })
+        // if (userAll.length == employee_selected_list.length) { this.checked = true};
+		that.list = userAll
+	   }).finally(() => {
+		  that.table_loading = false;
+	   })
+	}
+  },
+  created() {
+	var that=this;
+	that.checked=false;
+    if (document.documentElement.style.height) {
+      this.com_height = document.documentElement.style.height
     }
-  }
+    setTimeout(() => {
+      that.get_user_list();
+	  if(that.can_select_dept){
+		  that.get_dept_list();
+	  }
+    }, 200)
+  }
+}
 </script>
 
 <style scoped>
-	a{
-		cursor: pointer;
-		    color: inherit;
-		    text-decoration: none;
-	}
-  .employee_selector_box {
-    width: 600px;
-    padding: 24px;
-  }
-
-  /* 搜索框 */
-  .employee_selector_box .search {
-    border: 1px #C0C4CC solid;
-	width: 80%;
-	border-radius: 25px;
+a {
+	cursor: pointer;
+	color: inherit;
+	text-decoration: none;
+}
+.employee_selector_box {
+	width: 600px;
+	padding: 20px;
+	box-sizing: border-box;
 	margin: 0 auto;
-  }
-
-  .employee_selector_box .search-box button {
-    display: inline-block;
-    vertical-align: middle;
-    margin-left: 10px;
-    width: auto;
-    padding: 0;
-    background: none;
-    border-radius: 0px;
-    border: none;
-  }
-
-  .employee_selector_box .search-box /deep/ .el-input {
-    display: inline-block;
-    width: 84%;
-    padding: 0 24px 0 6px;
-    background: none;
-    border-radius: 0px;
-    border: none;
-  }
-
-  .employee_selector_box .search-box /deep/ .el-input input {
-    padding: 0;
-    line-height: 34px;
-    border: none;
-  }
-
-  /* /搜索框 */
-
-  /* 左边框 */
-  .employee_selector_box .choose_left {
-    padding: 8px 10px 8px 10px;
-  }
-
-  .employee_selector_box .choose_left .employee_cell {
-    border-bottom: 1px #f8f8f8 solid;
-  }
-
-  .employee_selector_box .choose_left .employee_cell_a .employee_cell {
-    border-bottom: none;
-  }
-
-  .employee_selector_box .choose_left .employee_checkbox {
-    padding-left: 8px;
-  }
-
-  .employee_selector_box .choose_left .employee_img_url {
-    padding-left: 8px;
-  }
-
-  .employee_selector_box .choose_left .employee_name {
-    padding-left: 8px;
-  }
-
-  .employee_selector_box /deep/ .el-scrollbar__thumb {
-    width: 2px;
-    margin: 15px 0 0 6px;
-    background: #409EFF;
-  }
-
-  /* 左边框 */
-
-  /* 右边距 */
-  .employee_selector_box .option-box {
-    padding: 14px;
-  }
-
-  .employee_selector_box .choose_right {
-    padding: 8px 10px;
-  }
-
-  .employee_selector_box .choose_right .employee_delete .el-button {
-    transform: scale(0.5);
-    background: #C0C4CC;
-  }
-
-  .employee_selector_box .choose_right .employee_delete .el-button /deep/ .el-icon-close {
-    color: #fff;
-  }
-
-  .employee_selector_box .choose_right .employee_delete .el-button:active {
-    background: #409EFF;
-  }
-
-  .employee_selector_box .choose_right .employee_delete .el-button:active /deep/ .el-icon-close {
-    color: #FFF;
-  }
-
-  .employee_selector_box .choose_right .employee_cell .employee_name {
-    padding-left: 8px;
-  }
-
-  .employee_selector_box .choose_right .employee_cell .employee_img_url {
-    padding-left: 8px;
-  }
-
-  /* 右边距 */
-
-  .employee_selector_box /deep/ .employee_cell {
-    padding: 8px 0;
-  }
-
-  .employee_selector_box /deep/ .employee_cell:hover {
-    background: #ecf5ff;
-  }
-
-  .employee_cell {
-    display: -webkit-inline-box;
-    cursor: pointer;
-    width: 100%;
-    color: #606266;
-    padding: 8px 0;
-    background-color: transparent;
-  }
-
-  .employee_cell .employee_cell_clear {
-    clear: both;
-  }
+}
 
-  .employee_cell .employee_img_url {
-    display: table-cell;
-    vertical-align: middle;
-    width: 30px;
-    padding-left: 0px;
-  }
-
-  .employee_cell .employee_img_url img {
-    width: 24px;
-    height: 24px;
-    border-radius: 50%;
-  }
-
-  .employee_cell .employee_checkbox {
-    display: table-cell;
-    vertical-align: middle;
-    width: 30px;
-    text-align: center;
-  }
-
-  .employee_cell .employee_name {
-    display: table-cell;
-    vertical-align: middle;
-    color: #606266;
-  }
-
-  .employee_delete {
-    display: table-cell;
-    text-align: right;
-    padding-right: 0px;
-  }
-
-  .employee_cell_a {
-    display: block;
-  }
-
-  .employee_cell_a:hover {
-    background-color: #ecf5ff;
-    border-radius: 4px;
-  }
-
-  .dept_child_cell {
-    display: table-cell;
-    vertical-align: middle;
-  }
-
-  .dept_child_cell span {
-    float: right;
-    padding-right: 8px;
-  }
-
-  .dept_child_cell span:hover {
-    color: #1c1c1c;
-  }
-
-  .dept_child_cell span:active {
-    color: #1c1c1c;
-  }
-
-  .scroller-box {
-    height: 440px;
-    padding-right: 0px !important;
-    background-color: #fdfdfd;
-    border: 1px solid #eee;
-    border-radius: 4px;
-    overflow: hidden;
-  }
-  /* .scroller-box.one{
+/* 搜索框 */
+.employee_selector_box .search {
+	margin: 0 auto;
+	width: 80%;
+}
+
+
+/* 左边框 */
+.employee_selector_box .choose_left {
+	padding: 8px 10px 8px 10px;
+}
+
+.employee_selector_box .choose_left .employee_cell {
+	border-bottom: 1px #f8f8f8 solid;
+}
+
+.employee_selector_box .choose_left .employee_cell_a .employee_cell {
+	border-bottom: none;
+}
+
+.employee_selector_box .choose_left .employee_checkbox {
+	padding-left: 8px;
+}
+
+.employee_selector_box .choose_left .employee_img_url {
+	padding-left: 8px;
+}
+
+.employee_selector_box .choose_left .employee_name {
+	padding-left: 8px;
+}
+
+.employee_selector_box /deep/ .el-scrollbar__thumb {
+	width: 2px;
+	margin: 15px 0 0 6px;
+	background: #409eff;
+}
+
+/* 左边框 */
+
+/* 右边距 */
+.employee_selector_box .option-box {
+	padding: 14px;
+}
+
+.employee_selector_box .choose_right {
+	padding: 8px 10px;
+}
+
+.employee_selector_box .choose_right .employee_delete .el-button {
+	transform: scale(0.5);
+	background: #c0c4cc;
+}
+
+.employee_selector_box .choose_right .employee_delete .el-button /deep/ .el-icon-close {
+	color: #fff;
+}
+
+.employee_selector_box .choose_right .employee_delete .el-button:active {
+	background: #409eff;
+}
+
+.employee_selector_box .choose_right .employee_delete .el-button:active /deep/ .el-icon-close {
+	color: #fff;
+}
+
+.employee_selector_box .choose_right .employee_cell .employee_name {
+	padding-left: 8px;
+}
+
+.employee_selector_box .choose_right .employee_cell .employee_img_url {
+	padding-left: 8px;
+}
+
+/* 右边距 */
+
+.employee_selector_box /deep/ .employee_cell {
+	padding: 8px 0;
+}
+
+.employee_selector_box /deep/ .employee_cell:hover {
+	background: #ecf5ff;
+}
+
+.employee_cell {
+	display: -webkit-inline-box;
+	cursor: pointer;
+	width: 100%;
+	color: #606266;
+	padding: 8px 0;
+	background-color: transparent;
+}
+
+.employee_cell .employee_cell_clear {
+	clear: both;
+}
+
+.employee_cell .employee_img_url {
+	display: table-cell;
+	vertical-align: middle;
+	width: 30px;
+	padding-left: 0px;
+}
+
+.employee_cell .employee_img_url img {
+	width: 24px;
+	height: 24px;
+	border-radius: 50%;
+}
+
+.employee_cell .employee_checkbox {
+	display: table-cell;
+	vertical-align: middle;
+	width: 30px;
+	text-align: center;
+}
+
+.employee_cell .employee_name {
+	display: table-cell;
+	vertical-align: middle;
+	color: #606266;
+}
+
+.employee_delete {
+	display: table-cell;
+	text-align: right;
+	padding-right: 0px;
+}
+
+.employee_cell_a {
+	display: block;
+}
+
+.employee_cell_a:hover {
+	background-color: #ecf5ff;
+	border-radius: 4px;
+}
+
+.dept_child_cell {
+	display: table-cell;
+	vertical-align: middle;
+}
+
+.dept_child_cell span {
+	float: right;
+	padding-right: 8px;
+}
+
+.dept_child_cell span:hover {
+	color: #1c1c1c;
+}
+
+.dept_child_cell span:active {
+	color: #1c1c1c;
+}
+
+.scroller-box {
+	height: 440px;
+	padding: 0px !important;
+	background-color: #fdfdfd;
+	border: 1px solid #eee;
+	border-radius: 4px;
+	overflow: hidden;
+}
+/* .scroller-box.one{
     height: 440px;
   } */
 
-  .col-line {
-    position: relative;
-    height: 400px;
-  }
-
-  .col-line:before {
-    content: " ";
-    width: 1px;
-    height: 400px;
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 50%;
-    background-color: #eee;
-  }
-
-  .search-box {
-    background-color: #fff;
-    padding: 14px 5px;
-    border-bottom: 1px solid #eee;
-    margin: 0 -5px;
-  }
-
-  .option-box {
-    padding: 5px;
-    background-color: #fff;
-    border-bottom: 1px solid #eee;
-    margin: 0 -5px;
-  }
-
-  .child_btn {
-    color: #409EFF;
-  }
-  .dept_path{
-    margin: 10px 0;
-    display: block;
-    white-space: nowrap;
-    overflow: auto;
-  }
-
-  /*滚动条的宽度*/
-
-  .dept_path::-webkit-scrollbar {
-    width:5px;
-    height:5px;
-  }
-
-  /*外层轨道。可以用display:none让其不显示,也可以添加背景图片,颜色改变显示效果*/
-
-  .dept_path::-webkit-scrollbar-track {
-    width: 6px;
-    background-color:#fff0;
-    -webkit-border-radius: 2em;
-    -moz-border-radius: 2em;
-    border-radius:2em;
-  }
-
-  /*滚动条的设置*/
-
-  .dept_path::-webkit-scrollbar-thumb {
-    background-color:#fff0;
-    background-clip:padding-box;
-    min-height:28px;
-    -webkit-border-radius: 2em;
-    -moz-border-radius: 2em;
-    border-radius:2em;
-  }
-  /*滚动条移上去的背景*/
-
-  .dept_path:hover::-webkit-scrollbar-thumb{
-    background-color:rgba(144,147,153,.3);
-  }
-
+.col-line {
+	position: relative;
+	height: 400px;
+}
+
+.col-line:before {
+	content: ' ';
+	width: 1px;
+	height: 400px;
+	position: absolute;
+	top: 0;
+	bottom: 0;
+	left: 50%;
+	background-color: #eee;
+}
+
+.search-box {
+	background-color: #fff;
+	padding: 10px 5px;
+	border-bottom: 1px solid #eee;
+}
+
+.option-box {
+	padding: 5px;
+	background-color: #fff;
+	border-bottom: 1px solid #eee;
+	margin: 0 -5px;
+}
+
+.child_btn {
+	color: #409eff;
+}
+.dept_path {
+	margin: 10px 0;
+	display: block;
+	white-space: nowrap;
+	overflow: auto;
+}
+
+/*滚动条的宽度*/
+
+.dept_path::-webkit-scrollbar {
+	width: 5px;
+	height: 5px;
+}
+
+/*外层轨道。可以用display:none让其不显示,也可以添加背景图片,颜色改变显示效果*/
+
+.dept_path::-webkit-scrollbar-track {
+	width: 6px;
+	background-color: #fff0;
+	-webkit-border-radius: 2em;
+	-moz-border-radius: 2em;
+	border-radius: 2em;
+}
+
+/*滚动条的设置*/
+
+.dept_path::-webkit-scrollbar-thumb {
+	background-color: #fff0;
+	background-clip: padding-box;
+	min-height: 28px;
+	-webkit-border-radius: 2em;
+	-moz-border-radius: 2em;
+	border-radius: 2em;
+}
+/*滚动条移上去的背景*/
+
+.dept_path:hover::-webkit-scrollbar-thumb {
+	background-color: rgba(144, 147, 153, 0.3);
+}
 </style>

+ 162 - 0
src/components/season.vue

@@ -0,0 +1,162 @@
+<template>
+  <div>
+    <span @click="showDoubleMonth">
+      <el-input v-model="choseQuarter" prefix-icon="el-icon-date" placeholder="请选择" />
+    </span>
+    <div v-show="showTime1a" class="show1">
+      <p>
+        <button type="button" aria-label="前一年" class="el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left"
+          @click="prev" />
+        <span role="button" class="span-year">{{ year }}年</span>
+        <button type="button" aria-label="后一年" class="el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right"
+          @click="next" />
+      </p>
+      <div>
+        <span v-for="(item,index) in fullMonth" :key="index" class="selectMonth" @click="selectQuarter(item)">
+               {{ item }}
+        </span>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  export default {
+    name: 'season',
+    data() {
+      return {
+        value: '',
+        showTime2: false,
+        showTime1a: false,
+        year: new Date().getFullYear(),
+        fullMonth: ['第一季度', '第二季度', '第三季度', '第四季度'],
+        choseQuarter: '',
+        choseQuarter1: ''
+      }
+    },
+    props:{
+      isActive:{
+        type:Boolean,
+        default:false
+      }
+    },
+    mounted() {
+      if(!this.isActive){
+        var date=new Date().getMonth()+1;
+        var arrs=this.fullMonth;
+        var str=""
+        if(date<=3){
+          str=arrs[0]
+        }else if(date<=6){
+          str=arrs[1]
+        }else if(date<=9){
+          str=arrs[2]
+        }else{
+          str=arrs[3]
+        }
+        this.selectQuarter(str);
+      }
+     },
+    methods: {
+      // 点击季度按钮
+      quarterTime() {
+        this.showTime2 = true
+        this.choseQuarter = ''
+        this.fullMonth = ['第一季度', '第二季度', '第三季度', '第四季度']
+      },
+      // 点击input框
+      showDoubleMonth() {
+        this.showTime1a = true
+      },
+      // 上一年
+      prev() {
+        this.year = this.year * 1 - 1
+      },
+      // 下一年
+      next() {
+        this.year = this.year * 1 + 1
+      },
+      // 点击选项事件
+      selectQuarter(item) {
+        switch (item) {
+          case '第一季度':
+            this.choseQuarter1 = this.year + '1'
+            this.choseQuarter = this.year + '年 第一季度'
+            break
+          case '第二季度':
+            this.choseQuarter1 = this.year + '2'
+            this.choseQuarter = this.year + '年 第二季度'
+            break
+          case '第三季度':
+            this.choseQuarter1 = this.year + '3'
+            this.choseQuarter = this.year + '年 第三季度'
+            break
+          case '第四季度':
+            this.choseQuarter1 = this.year + '4'
+            this.choseQuarter = this.year + '年 第四季度'
+            break
+        }
+        this.$emit('confirm', this.choseQuarter1)
+        this.showTime1a = false
+      }
+    }
+  }
+</script>
+<style scoped>
+  * {
+    margin: 0;
+    padding: 0;
+    list-style: none;
+  }
+
+  .show1 {
+    width: 320px;
+    margin-top: 5px;
+    position: absolute;
+    z-index: 2;
+    height: auto;
+    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
+    background: #fff;
+    padding: 5px;
+  }
+
+  .show1 p:nth-child(1) {
+    width: 100%;
+    height: 40px;
+    border-bottom: 1px solid #f5f5f5;
+    display: flex;
+    align-items: center;
+    justify-content: end;
+    padding: 0 10px;
+  }
+
+  .show1>div {
+    width: 100%;
+    height: auto;
+  }
+
+  .show1>div span {
+    width: 50%;
+  }
+
+  .selectMonth {
+    display: inline-block;
+    float: left;
+    width: 78px;
+    height: 40px;
+    line-height: 40px;
+    text-align: center;
+  }
+
+  .selectMonth:hover {
+    background: rgba(19, 131, 255, 0.052);
+  }
+
+  .span-year {
+    width: 90%;
+    margin: 0 auto;
+    display: inline-block;
+    text-align: center;
+    line-height: 40px;
+  }
+</style>

+ 58 - 28
src/index.vue

@@ -11,7 +11,7 @@
 					<div class="flex-box flex-v-ce">
 <!-- 						<div>您当前的版本:15~20人(剩余231天)</div>
 						<el-button size="small" @click="tz" class="upgrade" type="primary" icon="el-icon-upload">续费升级</el-button> -->
-						<el-tooltip class="item" effect="dark" content="设置向导" placement="bottom">
+						<el-tooltip class="item" effect="dark" content="设置向导" placement="bottom" v-if="isShowWn">
 							<img src="./assets/image/wn.png" class="wn" @click="showWn">
 						</el-tooltip>
 						<!-- <userImage :user_name="userData.name" :img_url="userData.img_url" width="44px" height="44px"></userImage> -->
@@ -22,10 +22,15 @@
 		<el-container class="main">
 			<el-aside>
 				<el-menu :default-active="defaultActive" class="el-menu-vertical-demo" :router="true">
-					<el-menu-item :index="(index + 1).toString()" :route="item.path" v-for="(item, index) in routers" :key="index">
-						<span class="iconfont" :class="item.meta.icon"></span>
-						<span slot="title" style="margin-left: 10px;">{{ item.name }}</span>
-					</el-menu-item>
+					<el-submenu :index="index.toString()" v-for="(item, index) in routers" :key="index">
+						<template slot="title"><span class="iconfont titleIcon" :class="item.icon"></span><span style="margin-left: 5px;">{{item.name}}</span>
+						</template>
+						<template v-for="(item2, index2) in item.children">
+							<el-menu-item :index="returnIndex(index,index2)" :route="item2.path" :key="index2" class="font-flex-word">
+								<span slot="title" style="margin-left: 10px;width:120px">{{ item2.name }}</span>
+							</el-menu-item>
+						</template>
+					</el-submenu>
 				</el-menu>
 			</el-aside>
 			<el-main>
@@ -35,40 +40,41 @@
 		</el-container>
 		<el-dialog title="设置向导" :visible.sync="wn_show" width="600px">
 			<div>
-				<div class="wn-title fontColorF">三步轻松搭建积分管理体系:建制度、定人员</div>
+				<div class="wn-title fontColorF">三步轻松搭建积分管理体系:定人员、分责权、建制度</div>
 				<div class="flex-box flex-v-ce wn-box">
 					<div class="flex-1 flex-box-v flex-v-ce"  @click="openView(0)">
-						<div><span class="iconfont " :class="routers[0].meta.icon"></span></div>
-						<div>1、建立{{routers[0].name}}</div>
+						<div><span class="iconfont " :class="routers_one[0].meta.icon"></span></div>
+						<div>1、确定{{routers_one[0].name}}</div>
 					</div>
 					<div class="flex-1 flex-box-v flex-v-ce"  @click="openView(1)">
-						<div><span class="iconfont " :class="routers[1].meta.icon"></span></div>
-						<div>2、确定{{routers[1].name}}</div>
+						<div><span class="iconfont " :class="routers_one[1].meta.icon"></span></div>
+						<div>2、分配{{routers_one[1].name}}</div>
 					</div>
 					<div class="flex-1 flex-box-v flex-v-ce"  @click="openView(2)">
-						<div><span class="iconfont " :class="routers[2].meta.icon"></span></div>
-						<div>3、分配{{routers[2].name}}</div>
+						<div><span class="iconfont " :class="routers_one[2].meta.icon"></span></div>
+						<div>3、建立{{routers_one[2].name}}</div>
 					</div>
 				</div>
 			</div>
 			<div>
-				<div class="wn-title fontColorF">更有效地做好积分激励和认可,你还可以设置</div>
+				<div class="wn-title fontColorF">更有效地做好积分激励和认可,你还可以设置以下3项</div>
 				<div class="flex-box flex-v-ce wn-box">
 					<div class="flex-1 flex-box-v flex-v-ce" @click="openView(3)">
-						<div><span class="iconfont " :class="routers[3].meta.icon"></span></div>
-						<div>{{routers[3].name}}</div>
+						<div><span class="iconfont " :class="routers_one[3].meta.icon"></span></div>
+						<div>{{routers_one[3].name}}</div>
 					</div>
 					<div class="flex-1 flex-box-v flex-v-ce" @click="openView(4)">
-						<div><span class="iconfont " :class="routers[4].meta.icon"></span></div>
-						<div>{{routers[4].name}}</div>
+						<div><span class="iconfont " :class="routers_one[4].meta.icon"></span></div>
+						<div>{{routers_one[4].name}}</div>
 					</div>
 					<div class="flex-1 flex-box-v flex-v-ce" @click="openView(5)">
-						<div><span class="iconfont " :class="routers[5].meta.icon"></span></div>
-						<div>{{routers[5].name}}</div>
+						<div><span class="iconfont " :class="routers_one[5].meta.icon"></span></div>
+						<div>{{routers_one[5].name}}</div>
 					</div>
 				</div>
 			</div>
 		</el-dialog>
+	
 	</el-container>
 </template>
 
@@ -78,14 +84,20 @@ export default {
 		return {
 			loading: false,
 			userData: {},
-			routers: [],
+			routers:[],
+			routers_one:[],
 			info: {},
 			wn_show:false,
-			defaultActive:"1"
+			defaultActive:"0-0",
+			isShowWn:true,
 		};
 	},
-	created() {
-		this.routers = this.$router.options.routes[0].children;
+	created() {this.returnRoutersArr('ranking')
+		this.routers=[
+			{name:'设置',children:this.returnRoutersArr('set'),icon:'icon-dingdingPC_shezhi'},
+			{name:'统计',children:this.returnRoutersArr('ranking'),icon:'icon-dingdingPC_tongji'},
+			];
+		this.routers_one=this.returnRoutersArr('set');
 		this.userData=this.$getUserData();
 	},
 	mounted() {
@@ -94,6 +106,7 @@ export default {
 		this.$nextTick(function() {
 			if (localStorage.getItem('wn_show')) {
 				this.wn_show = false;
+				this.isShowWn=false;
 			} else {
 				this.wn_show = true;
 				localStorage.setItem('wn_show','true');
@@ -101,23 +114,37 @@ export default {
 		});
 	},
 	methods: {
+		returnRoutersArr(str){
+			var routers = this.$router.options.routes[0].children;
+			var routersArr=[];
+			routers.forEach(item=>{
+				if(item.meta.groupCode==str){
+					routersArr.push(item);
+				}
+			})
+			return routersArr;
+		},
+		returnIndex(str,str2){
+			return str+"-"+str2;
+		},
 		openView(e){
-			this.defaultActive=(e+1).toString();
+			this.defaultActive="0-"+(e).toString();
 			this.wn_show=false;
-			this.$router.push({path:this.routers[e].path})
+			this.isShowWn=false;
+			this.$router.push({path:this.routers_one[e].path})
 		},
 		showWn(){
 			this.wn_show=true;
 		},
 		getInfo() {
 			var that = this;
-			this.$axios('get','api/site/info').then(res => {
+			this.$axios('get','/api/site/info').then(res => {
 				that.info = res.data.data;
 			});
 		},
 		getTypes() {
 			var that = this;
-			this.$axios('get','api/integral/types').then(res => {
+			this.$axios('get','/api/integral/types').then(res => {
 				that.$setTyps(res.data.data.list);
 			});
 		},
@@ -161,7 +188,7 @@ export default {
 }
 .el-menu-vertical-demo:not(.el-menu--collapse) {
 	width: 180px;
-	min-height: 400px;
+	// min-height: 400px;
 }
 .el-header {
 	background-color: #fff;
@@ -233,4 +260,7 @@ export default {
 .upgrade {
 	margin-left: 10px;
 }
+::v-deep .el-menu-item{
+	padding-right: 10px !important;
+}
 </style>

+ 31 - 27
src/main.js

@@ -3,6 +3,7 @@ import App from './App.vue'
 import router from './router'
 import store from './store'
 import ElementUI from 'element-ui';
+import moment from 'moment' // 时间库
 import 'element-ui/lib/theme-chalk/index.css';
 import * as dd from 'dingtalk-jsapi';
 import VConsole from 'vconsole'
@@ -16,7 +17,7 @@ Vue.component('userImage', userImage)
 
 Vue.use(ElementUI);
 // if (process.env.NODE_ENV === 'development') {
-  new VConsole()
+  // new VConsole()
 // }
 
 Vue.prototype.$dd=dd;
@@ -26,6 +27,9 @@ Vue.prototype.$getUserData = getUserData
 Vue.prototype.$setUserData = setUserData
 Vue.prototype.$getTyps = getTyps
 Vue.prototype.$setTyps = setTyps
+Vue.prototype.$moment = moment
+
+
 
 Vue.prototype.$http= service;
 //Vue函数添加一个原型属性$axios 指向axios,这样vue实例或组件中不用再去重复引用Axios 直接用this.$axios就能执行axios 方法
@@ -33,31 +37,31 @@ var CancelToken = axios.CancelToken;
 Vue.$httpRequestList=[];
 
 Vue.prototype.$axios = (type, url, data) => {
-	// if(url!='api/ding/login'&&url!='api/integral/types'){
-	// 	if(getToken()){
-	// 		return new Promise((resolve, reject) => {   //封装ajax
-	// 		    var aa = {
-	// 		        method: type,
-	// 		        url: url,
-	// 		        cancelToken: new CancelToken(c => {  //强行中断请求要用到的
-	// 		            Vue.$httpRequestList.push(c);
-	// 		        })
-	// 		    }
-	// 		    var json = (type == 'get') ? Object.assign(aa, { params: data }) : Object.assign(aa, { data: data });
-	// 		    var ajax = Vue.prototype.$http(json).then(res => {
-	// 		        resolve(res);
-	// 		    }).catch(error => {   //中断请求和请求出错的处理
-	// 		            if (error.message == "interrupt") {
-	// 		                console.log('已中断请求');
-	// 		                return;
-	// 		            } else {
-	// 		                reject(error);
-	// 		            }
-	// 		        })
-	// 		    return ajax;
-	// 		})
-	// 	}else{return Promise.reject('无token')}
-	// }else{
+	if(url!='/api/ding/login'&&url!='/api/integral/types'){
+		if(getToken()){
+			return new Promise((resolve, reject) => {   //封装ajax
+			    var aa = {
+			        method: type,
+			        url: url,
+			        cancelToken: new CancelToken(c => {  //强行中断请求要用到的
+			            Vue.$httpRequestList.push(c);
+			        })
+			    }
+			    var json = (type == 'get') ? Object.assign(aa, { params: data }) : Object.assign(aa, { data: data });
+			    var ajax = Vue.prototype.$http(json).then(res => {
+			        resolve(res);
+			    }).catch(error => {   //中断请求和请求出错的处理
+			            if (error.message == "interrupt") {
+			                console.log('已中断请求');
+			                return;
+			            } else {
+			                reject(error);
+			            }
+			        })
+			    return ajax;
+			})
+		}else{return Promise.reject('无token')}
+	}else{
 		return new Promise((resolve, reject) => {   //封装ajax
 		    var aa = {
 		        method: type,
@@ -79,7 +83,7 @@ Vue.prototype.$axios = (type, url, data) => {
 		        })
 		    return ajax;
 		})
-	// }
+	}
 };
 
 router.beforeEach((to, from, next) => {   //路由切换检测是否强行中断,

+ 2 - 2
src/noAccess.vue

@@ -2,8 +2,8 @@
 	<div class="noData flex-box flex-center-center">
 		<img  src="./assets/image/APP.png" class="appImg"/>
 		<div>
-			<img src="./assets/image/nodata.png" class="codeImg"/>
-			<div  style="margin: 10px 0;color: #999;">钉钉扫码体验</div>
+<!-- 			<img src="./assets/image/nodata.png" class="codeImg"/>
+			<div  style="margin: 10px 0;color: #999;">钉钉扫码体验</div> -->
 			<div>您当前的角色无权登录电脑端管理后台操作<br/>请打开手机版钉钉直接扫码使用</div>
 		</div>
 	</div>

+ 79 - 24
src/router/index.js

@@ -1,74 +1,129 @@
 import Vue from 'vue'
 import VueRouter from 'vue-router'
 
+//解决重复点击导航栏报错问题
+const originalPush = VueRouter.prototype.push 
+VueRouter.prototype.push = function push(location) {
+  return originalPush.call(this, location).catch(err => err)
+}
+
 Vue.use(VueRouter)
 
-const routes = [
-	{
+const routes = [{
 		path: '/index',
 		name: '首页',
 		component: () => import('@/index'),
-		redirect: "rule",
-		children: [{
-				path: '/rule',
-				name: '积分规则',
-				component: () => import('@/views/rule.vue'),
-				meta: {
-					icon: 'icon-shezhi_jifenguize'
-				}
-			},
+		redirect: "framework",
+		children: [
 			{
 				path: '/framework',
 				name: '组织架构',
-				component: () => import('@/views/framework.vue'),
+				component: () => import('@/views/set/framework.vue'),
 				meta: {
-					icon: 'icon-shezhi_zuzhijiagou'
+					icon: 'icon-shezhi_zuzhijiagou',
+					groupCode:'set'
 				}
 			},
 			{
 				path: '/jurisdiction',
 				name: '角色权限',
-				component: () => import('@/views/jurisdiction.vue'),
+				component: () => import('@/views/set/jurisdiction.vue'),
+				meta: {
+					icon: 'icon-shezhi_jiaose',
+					groupCode:'set'
+				}
+			},
+			{
+				path: '/rule',
+				name: '积分规则',
+				component: () => import('@/views/set/rule.vue'),
 				meta: {
-					icon: 'icon-shezhi_jiaose'
+					icon: 'icon-shezhi_jifenguize',
+					groupCode:'set',
+					groupName:"设置"
 				}
 			},
 			{
 				path: '/initialPoint',
 				name: '初始分',
-				component: () => import('@/views/initialPoint.vue'),
+				component: () => import('@/views/set/initialPoint.vue'),
 				meta: {
-					icon: 'icon-shezhi_jichushezhi'
+					icon: 'icon-shezhi_jichushezhi',
+					groupCode:'set',
 				}
 			},
 			{
 				path: '/check',
 				name: '考勤积分',
-				component: () => import('@/views/check.vue'),
+				component: () => import('@/views/set/check.vue'),
 				meta: {
-					icon: 'icon-kaoqin_kaoqinyuebaobiao'
+					icon: 'icon-kaoqin_kaoqinyuebaobiao',
+					groupCode:'set'
 				}
 			},
 			{
 				path: '/voluntarilyPoint',
 				name: '自动积分',
-				component: () => import('@/views/voluntarilyPoint.vue'),
+				component: () => import('@/views/set/voluntarilyPoint.vue'),
+				meta: {
+					icon: 'icon-shezhi_zidongjifen',
+					groupCode:'set'
+				}
+			},
+			{
+				path: '/integral_event',
+				name: '积分事件',
+				component: () => import('@/views/ranking/integral_event.vue'),
+				meta: {
+					icon: 'icon-shezhi_jifenguize',
+					groupCode:'ranking',
+					groupName:"统计"
+				}
+			},
+			{
+				path: '/dept_rank',
+				name: '部门B分排名',
+				component: () => import('@/views/ranking/dept_rank.vue'),
+				meta: {
+					icon: 'icon-shezhi_zuzhijiagou',
+					groupCode:'ranking'
+				}
+			},
+			{
+				path: '/total_rank',
+				name: '累计B分排名',
+				component: () => import('@/views/ranking/total_rank.vue'),
+				meta: {
+					icon: 'icon-shezhi_jiaose',
+					groupCode:'ranking'
+				}
+			},
+			{
+				path: '/custom_rank',
+				name: '自定义分组B分排名',
+				component: () => import('@/views/ranking/custom_rank.vue'),
 				meta: {
-					icon: 'icon-shezhi_zidongjifen'
+					icon: 'icon-shezhi_jichushezhi',
+					groupCode:'ranking'
 				}
 			}
 		]
 	},
 	{
 		path: '/',
-			name: '初始化',
-			component: () => import('@/init'),
-		},
+		name: '初始化',
+		component: () => import('@/init'),
+	},
 	{
 		path: '/noAccess',
 		name: '无权限',
 		component: () => import('@/noAccess'),
 	},
+	{
+		path: '/deptRankSwiper',
+		name: '轮播',
+		component: () => import('@/views/ranking/deptRankSwiper.vue'),
+	},
 ]
 
 const router = new VueRouter({

+ 408 - 0
src/views/ranking/custom_rank.vue

@@ -0,0 +1,408 @@
+<template>
+	<div class="all-box">
+		<div class="all">
+			<div class="flex-box">
+				<div class="terr-left">
+					<el-button size="medium" @click="addGroup" type="primary">新建分组</el-button>
+					<el-menu default-active="0" class="el-menu-vertical-demo" style="border: none" v-loading="groups_loading">
+						<el-menu-item
+							style="height: 47px;line-height: 47px;"
+							:index="index.toString()"
+							class="font-flex-word"
+							v-for="(item, index) in groups_list"
+							:key="index"
+							@click="open_right(item)"
+							v-show="item.code !== 'employee'"
+						>
+							<i class="el-icon-document-copy"></i>
+							<span slot="title">{{ item.name }}</span>
+						</el-menu-item>
+					</el-menu>
+				</div>
+				<div class="terr-right border-right flex-1">
+					<div class="listData" v-loading="table_loading">
+						<div class="flex-box" v-if="table_list.length > 0">
+							<div class="flex-box flex-v-ce margin-bottom">
+								<div class="groupsName">{{groups_info.name}}<span class="blue">({{groups_info.employees.length}}人)</span></div>
+								<el-button @click="editGroup" size="medium">编辑</el-button>
+							</div>
+						</div>
+						<!-- form -->
+						<el-form :model="params" :inline="true" ref="params">
+							<el-form-item label="时间" label-width="40px">
+								<el-date-picker v-model="params.month"  size="medium" type="month" placeholder="请选择月份" value-format="yyyy-MM"></el-date-picker>
+							</el-form-item>
+							<el-form-item label="规则分类" label-width="70px">
+								<el-cascader  size="medium"  class="date-picker-width" v-model="params.rule_id" :options="rule_trees" :props="props" @change="rule_null"
+									ref="rule" clearable filterable	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>
+						<!-- 表格 -->
+						<el-table :data="table_list" style="width: 100%" >
+							<el-table-column label="名次" width="80" align="center">
+								<template slot-scope="scope">
+									<img v-if="scope.row.rank === 1" src="@/assets/image/statistics_NO1.png" alt="" />
+									<img v-if="scope.row.rank === 2" src="@/assets/image/statistics_NO2.png" alt="" />
+									<img v-if="scope.row.rank === 3" src="@/assets/image/statistics_NO3.png" alt="" />
+									<span v-if="scope.row.rank > 3">{{ scope.row.rank }}</span>
+								</template>
+							</el-table-column>
+							<el-table-column label="姓名" align="left">
+								<template slot-scope="scope">
+									<div class="flex-box">
+										<userImage	class="fl" :user_name="scope.row.employee_name"	:img_url="scope.row.employee_img_url" width="50px" height="50px"></userImage>
+										<span style="line-height: 50px; padding-left: 10px;">{{ scope.row.employee_name }}</span>
+									</div>
+								</template>
+							</el-table-column>
+							<el-table-column label="B分" align="left" prop="point"></el-table-column>
+							<template slot="empty">
+								<div class="nopoint_box">
+									<div class="noimg noperson"></div>
+									<span class="title">没有对应的数据</span>
+								</div>
+							</template>
+						</el-table>
+						<center style="padding: 20px 0;">
+							<el-pagination
+								background
+								@size-change="handleSizeChange"
+								@current-change="handleCurrentChange"
+								:page-sizes="[10, 20, 30, 40, 50, 100]"
+								layout="total, sizes, prev, pager, next"
+								:page-size="page_size"
+								:current-page="page"
+								:total="total">
+							</el-pagination>
+						</center>
+					</div>
+				</div>
+			</div>
+		</div>
+		<!-- 新增分组 -->
+		<el-dialog	:title="popupType? '新增分组':'编辑分组'" width="660px"  top="5%" :visible.sync="groupShow"  :close-on-click-modal="false">
+			<el-form  ref="newGroupForm" :model="newGroupForm" :rules="rules" label-width="85px"  @submit.native.prevent>
+				<el-form-item label="分组名称" prop="group_name">
+					<el-input v-model="newGroupForm.group_name" placeholder="请输入分组名称" auto-complete="off"></el-input>
+				</el-form-item>
+				<div>
+					<EmployeeSelector
+						v-if="groupShow"
+						ref="Employee"
+						:user_no_select="false"
+						:can_select_dept="true"
+						:selected="employees_selected"
+						:close_clear_data="true"
+						@confirm="move_employee_confirm"/>
+				</div>
+			</el-form>
+			<div class="flex-box flex-v-ce">
+				<el-button type="danger" v-if="!popupType" :loading="delLoad" @click="delItem">删除</el-button>
+				<div class="flex-1"></div>
+				<el-button @click="resetForm('newGroupForm')">取 消</el-button>
+				<el-button type="primary" :loading="saveLoad" @click="subGroupForm('newGroupForm')">确 定</el-button>
+			</div>
+		</el-dialog>
+	</div>
+</template>
+
+<script>
+import EmployeeSelector from '@/components/EmployeeSelector.vue';
+import noData from '@/components/noData';
+import moment from 'moment'
+export default {
+	components: { EmployeeSelector, noData },
+	data() {
+		return {
+			page: 1,
+			page_size: 10,
+			total: null,
+			tips_show:false,
+			groups_list:[],
+			groups_loading:false,
+			table_loading:false,
+			table_list:[],
+			groups_info: {
+				name:'',
+				employees: []
+			},
+			// 
+			params:{
+				group_id: '',
+				month: moment().format('YYYY-MM'),
+				sort: 'DESC',
+				rule_id: '',
+			},
+			rule_trees: [],
+			groupShow: false,
+			rules: { group_name: [{ required: true, message: '请输入分组名称', trigger: 'blur' },{ min: 2, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }],},
+			newGroupForm:{
+				group_name: "",
+				employees: []
+			},
+			saveLoad: false,
+			delLoad: false,
+			show_employee_selector: false,
+			employee_not_select: [],
+			employees_selected: {employee:[], dept: []},
+			props:{checkStrictly: true,value: 'id', label: 'name',children:'child'},
+			sort: false,
+			
+			popupType: false,
+		};
+	},
+	created() {
+		this.getRuleList();
+		this.get_groups_list(true);
+	},
+	watch:{
+		'params.rule_id'(){
+			this.$refs.rule.dropDownVisible = false;
+		},
+		'params.month'(val,old_val){
+			this.page = 1
+			this.open_right()
+		},
+		'sort'(val){
+			this.page = 1
+			val?this.params.sort = 'ASC':this.params.sort = 'DESC'
+			this.open_right()
+		},
+	},
+	mounted() {
+
+	},
+	methods: {
+		// 提交表单
+		subGroupForm(formName){
+		  this.$refs[formName].validate((valid) => {
+		    if (valid) {
+				this.saveFun()
+		    }
+		  });
+		},
+		//获取分组详情
+		getGroupDetail(func){
+			this.$axios('get','/api/integral/statistics/groups/info', {group_id: this.groups_info.id}).then(res => {
+				func(res.data.data.employees);
+			})
+		},
+		//编辑
+		editGroup(){
+			this.newGroupForm.group_name=this.groups_info.name;
+			var that=this;
+			that.getGroupDetail(function(res){
+				that.employees_selected.employee=res;
+				that.popupType = false;
+				that.groupShow = true;
+			})
+			
+		},
+		//添加编辑组
+		saveFun(){
+		  this.saveLoad = true;
+		  this.$refs.Employee.confirm();//调用组件的confirm();
+		  if(this.newGroupForm.employees.length==0){return false};
+		  var url=this.popupType? '/api/integral/statistics/groups/create':'/api/integral/statistics/groups'
+		  this.newGroupForm.group_id=this.groups_info.id;
+		  var obj={//为编辑时
+			  name:this.newGroupForm.group_name,
+			  id:this.popupType?'':this.groups_info.id,
+			  employees:this.newGroupForm.employees,
+		  }
+		  this.$axios('post',url,this.newGroupForm).then((res) => {
+		    if (res.data.code == 1) {
+				this.$message.success(res.data.msg);
+				this.resetForm('newGroupForm');
+				if(!this.popupType){//为编辑时
+					this.groups_info=obj;
+				}
+				this.get_groups_list()
+				
+		    }else{
+		      this.$message.error(res.data.msg)
+		    }
+		  }).finally(()=>{
+				this.saveLoad = false
+		  })
+		},
+		// 重置表单
+		resetForm(formName){
+			this.$refs[formName].resetFields()
+			this.newGroupForm.employees = []
+			this.employee_not_select = []
+			this.employees_selected = {employee:[], dept: []}
+			this.groupShow = false
+		},
+		// 新增分组
+		addGroup(){
+			this.employee_not_select = []
+			this.employees_selected = {employee:[], dept: []}
+			this.newGroupForm = {
+				group_name: "",
+				employees: []
+			}
+			this.groupShow = true
+			this.popupType = true
+		},
+		// 删除分组
+		delItem(){
+			this.$confirm('确定要删除当前分组吗?, 是否继续?', '删除分组', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning'
+			}).then(() => {
+				let data = {group_id:this.groups_info.id};
+				this.delLoad = true
+				this.$axios('post','/api/integral/statistics/groups/drop',data).then((res) => {
+					if (res.data.code == 1) {
+						this.$message.success(res.data.msg)
+						this.groupShow = false
+						this.get_groups_list(true);
+					}else{
+						this.$message.error(res.data.msg)
+					}
+				}).catch((e) => {this.$message.error(e.data.msg)}).finally(()=>{
+					this.delLoad = false
+				})
+			})
+		},
+		// 选人组件提交
+		move_employee_confirm(data){
+			var employee=data.employee;
+			if(employee.length==0){
+				this.$message.error("请选择人员");
+				this.saveLoad=false;
+				return;
+			}
+			employee.forEach(item=>{
+				this.newGroupForm.employees.push(item.id);
+			})
+		},
+		// 递归判断列表,把最后的children设为undefined
+		getTreeData(data) {
+			for (var i = 0; i < data.length; i++) {
+				if (data[i].child.length < 1) {
+					// children若为空数组,则将children设为undefined
+					data[i].child = undefined;
+				} else {
+					// children若不为空数组,则继续 递归调用 本方法
+					this.getTreeData(data[i].child);
+				}
+			}
+			return data;
+		},
+		//获取规则
+		getRuleList() {
+			this.$axios('get','/api/integral/rule/trees', {cycle_type: 1}).then(res => {
+				this.rule_trees = this.getTreeData(res.data.data.rule_tree || []);
+			})
+		},
+		// 规则分类改变之后请求数据
+		rule_null(val){
+		  this.params.rule_id=val.length == 0? '': val[val.length -1]
+		  this.$nextTick(()=>{
+				this.page = 1
+				this.open_right()
+			})
+		},
+		//获取初始化数据
+		get_groups_list(isAdd) {
+			this.groups_loading = true;
+			this.$axios('get','/api/integral/statistics/groups').then(res => {
+				if (res.data.code == 1) {
+					this.groups_list = res.data.data.list;
+					isAdd? this.open_right(this.groups_list[0]):this.open_right();
+				}
+			}).finally(() => {
+				this.groups_loading = false;
+			});
+		},
+		// 打开右边列表
+		open_right(item){
+			this.table_loading = true;
+			var data={};
+			if(item){
+				this.groups_info=item;
+				data={
+					group_id: item.id,
+					month: this.params.month,
+					sort: this.params.sort,
+					rule_id: this.params.rule_id,
+					pt_id: 3,
+				}
+			}else{
+				data={
+					group_id: this.groups_info.id,
+					month: this.params.month,
+					sort: this.params.sort,
+					rule_id: this.params.rule_id,
+					pt_id: 3,
+				}
+			}
+			this.$axios('get','/api/integral/statistics/ranking',data).then((res) => {
+				if (res.data.code == 1) {
+						this.table_list = res.data.data.list
+						this.total = res.data.data.total
+				}else{
+				  this.$message.error(res.data.data.msg)
+				}
+		    }).finally(() => {
+		        this.table_loading = false
+		    })
+		},
+		// 页码变更
+		handleCurrentChange(val) {
+		  this.page = val
+		  this.open_right(this.groups_info)
+		},
+		handleSizeChange(val){
+		  this.page_size = val
+		  this.open_right(this.groups_info)
+		},
+	}
+};
+</script>
+
+<style scoped="scoped">
+::v-deep .el-radio .el-radio__label {
+	display: none;
+}
+.tips {
+	background: #dcdfe6;
+	border-radius: 50%;
+	width: 14px;
+	height: 14px;
+	color: #fff;
+	display: inline-block;
+	font-size: 12px;
+	line-height: 14px;
+	text-align: center;
+}
+.groupsName {
+	font-size: 18px;
+	margin-right:20px
+}
+.groupsName span{
+	margin-left:5px
+}
+
+.user_text {
+	font-size: 12px;
+}
+.cursor_pointer {
+	cursor: pointer;
+}
+.terr-left button{
+    margin: 0 auto;
+    display: block;
+    margin-bottom: 20px;
+}
+::v-deep .el-menu-item{
+	padding:0 10px !important;
+}
+</style>

+ 163 - 0
src/views/ranking/deptRankSwiper.vue

@@ -0,0 +1,163 @@
+<template>
+  <div>
+    <div class="swiperBg" v-loading="loading || deptNameLoad">
+      <el-row type="flex" justify="center">
+        <el-col :xs="22" :sm="22" :md="24" :lg="12" :xl="10">
+          <div class="title" v-if="type == 1">最新的积分事件<p>最后更新时间:{{lastTime}}</p></div>
+          <div class="title" v-if="type == 2">{{deptName}}{{month}}积分排名<p>最后更新时间:{{lastTime}}</p></div>
+          <marquee style="height: calc(100vh - 106px);" scrollamount="2" scrolldelay="1" align="middle" behavior="scroll" direction="up">
+            <div v-show="type == 2">
+              <el-row  v-for="(item,index) in list" :key="index" class="row">
+                <el-col class="list_name" :span="4">{{item.rank}}</el-col>
+                <el-col :span="10">{{item.employee_name}}</el-col>
+                <el-col class="point" :span="10">{{item.point}}分</el-col>
+              </el-row>
+            </div>
+            <div v-show="type == 1">
+              <el-row  v-for="(item,index) in list" :key="index" class="row">
+                <el-col :span="4">
+                  <center>
+                    <userImage :id="item.employee_id" :user_name="item.employee_name" :img_url="item.employee_img_url" fontSize="1.8" width="80px" height="80px"></userImage>
+                  </center>
+                </el-col>
+                <el-col :span="20">
+                  <p class="integralPersonnel">
+                    <el-row>
+                      <el-col :span="8">{{item.employee_name}}</el-col>
+                      <el-col :span="16">
+                        <span style="margin-left: 30px;" :class="item.point>0?'color_red':'color_green'">{{item.point>0?'+'+item.point:item.point}}分</span>
+                      </el-col>
+                    </el-row>
+                  </p>
+                  <p class="integralDetails">{{item.remark}}</p>
+                </el-col>
+              </el-row>
+            </div>
+          </marquee>
+        </el-col>
+      </el-row>
+    </div>
+  </div>
+</template>
+
+<script>
+  import moment from 'moment'
+  // type  1为积分事件 2为部门排行
+  export default {
+    name: "deptRankSwiper",
+    data() {
+      return {
+        loading: false,
+        deptNameLoad: false,
+        list: [],
+        formData:{},
+        type: 0,
+        month: null,
+        deptName: null,
+        lastTime: null
+      }
+    },
+    methods: {
+      getData(){
+        let self = this
+        self.loading = true
+        let data = this.formData
+        delete data.type
+		var url=self.type == 1? '/api/integral/statistics/integral' : '/api/integral/statistics/ranking';
+        self.$axios('get',url,data).then((res) => {
+          if (res.data.code == 1) {
+            self.lastTime = this.$moment().format('YYYY-MM-DD HH:mm:ss')
+            self.list = res.data.data.list
+          }else{
+            self.$message.error(res.data.data.msg)
+          }
+        }).finally(()=>{
+          self.loading = false
+        })
+      },
+      getDeptName(id){
+        let self = this
+        if (id !== '0') {
+          self.deptNameLoad = true
+          self.$axios("get",'/api/department/info',{id: id}).then((res) => {
+            if (res.data.code == 1) {
+              self.deptName = res.data.data.name
+            }else{
+              self.$message.error(res.data.data.msg)
+            }
+          }).finally(()=>{
+            self.deptNameLoad = false
+          })
+        }else{
+          self.deptName = '全公司'
+        }
+      }
+    },
+    mounted() {
+      this.formData = this.$route.query
+      this.type = this.$route.query.type
+      this.$route.query.month?this.month = moment(this.$route.query.month).format('YYYY年MM月'):''
+	  this.$route.query.dept_name? this.deptName=this.$route.query.dept_name:''
+      this.getData()
+      setInterval(() => {
+        this.getData()
+      }, parseInt(Math.random()*(1800000-1200000+1)+1200000,10));
+    },
+    created() {},
+  }
+</script>
+
+<style scoped lang="scss">
+  .swiperBg{
+    background-color: black;
+    color: #fff;
+    position: fixed;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	top:0;
+    font-size: 3rem;
+    .title{
+      font-size: 40px;
+      text-align: center;
+      margin: 20px 0;
+      p{
+        font-size: 16px;
+      }
+    }
+    .row{
+      margin-bottom: .6em;
+      .el-col-10{
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+      }
+      .list_name{
+        text-align: center;
+      }
+      .point{
+        text-align: center;
+      }
+      .integralDetails{
+        font-size: .6em; 
+        margin: 0; 
+        display: -webkit-box;
+        text-overflow: ellipsis;
+        overflow : hidden;
+        -webkit-line-clamp: 2;
+        -webkit-box-orient: vertical;
+      }
+      .integralPersonnel{
+        font-size: .8em; 
+        margin: 0; 
+        margin-bottom: 15px;
+      }
+    }
+  }
+  .color_red{
+    color: red;
+  }
+  .color_green{
+    color:green
+  }
+</style>

+ 655 - 0
src/views/ranking/dept_rank.vue

@@ -0,0 +1,655 @@
+<template>
+	<div>
+		<div class="diy_tip_bg" v-show="tips_show">
+			<el-alert class="diy-tip" @close="tips_close" type="success" description><p>排名不包含初始分和工龄分</p></el-alert>
+		</div>
+		<div class="manager_statistics_box">
+			<el-form :inline="true">
+				<el-form-item label="时间">
+					<el-col :span="8">
+						<el-select  size="medium" v-model="time_type" placeholder="请选择分类" style="width: 100px;">
+							<el-option v-for="item in time_types" :key="item.label" :label="item.label" :value="item.value"></el-option>
+						</el-select>
+					</el-col>
+					<el-col :span="16">
+						<el-date-picker
+						   size="medium"
+							v-show="time_type == '2'"
+							v-model="export_from.year"
+							class="date-picker-width"
+							type="year"
+							value-format="yyyy"
+							placeholder="选择年份排名"
+						></el-date-picker>
+						<el-date-picker
+						     size="medium"
+							v-show="time_type == '1' || time_type == '月份'"
+							v-model="export_from.month"
+							class="date-picker-width"
+							type="month"
+							value-format="yyyy-MM"
+							placeholder="选择月份排名"
+						></el-date-picker>
+						<season v-if="time_type == '3'" :isActive="true" class="date-picker-width" @confirm="export_quarter_confirm"></season>
+					</el-col>
+				</el-form-item>
+				<el-form-item label="部门">
+					<el-cascader
+					    size="medium"
+						class="date-picker-width"
+						v-model="dept_name"
+						:options="dept_tree"
+						:props="{ checkStrictly: true,value:'id',label:'name',children:'_child'}"
+						ref="dept"
+						clearable
+						filterable
+						placeholder="全公司"
+					></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>-->
+				</el-form-item>
+				<el-form-item label="谁不参与排名">
+					<el-select v-model="formData.exclusion"  size="medium"  multiple filterable collapse-tags placeholder="请选择员工">
+						<el-option v-for="item in employee_map" :key="item.id" :label="item.name" :value="item.id"></el-option>
+					</el-select>
+				</el-form-item>
+				<el-form-item label="规则分类">
+					<el-cascader
+					   size="medium"
+						class="date-picker-width"
+						v-model="rule_id"
+						:options="rule_trees"
+						:props="props"
+						ref="rule"
+						clearable
+						collapse-tags
+						placeholder="请选择规则分类"
+					></el-cascader>
+				</el-form-item>
+				<el-form-item label="人员">
+					<el-select  size="medium" v-model="formData.position" style="width:150px" placeholder="请选择">
+						<el-option v-for="item in positions" :key="item.id" :label="item.name" :value="item.age"></el-option>
+					</el-select>
+				</el-form-item>
+				<el-form-item>
+					<el-checkbox v-model="sort" size="medium" label="排名由低到高" border></el-checkbox>
+					<el-button type="primary"  size="medium" @click="selectBtn" style="margin-left:20px">查询</el-button>
+				</el-form-item>
+				<el-form-item>
+					<el-button type="primary"  size="medium" plain @click="dialogVisible = true">导出排名</el-button>
+					<el-button type="primary"  size="medium" plain @click="byRanking('byRankingData')">轮播排名</el-button>
+				</el-form-item>
+			</el-form>
+			<el-table :data="list" style="width: 100%" v-loading="loading">
+				<el-table-column label="名次" width="80" align="center">
+					<template slot-scope="scope">
+						<img v-if="scope.row.rank === 1" src="@/assets/image/statistics_NO1.png" alt="" />
+						<img v-if="scope.row.rank === 2" src="@/assets/image/statistics_NO2.png" alt="" />
+						<img v-if="scope.row.rank === 3" src="@/assets/image/statistics_NO3.png" alt="" />
+						<span v-if="scope.row.rank > 3">{{ scope.row.rank }}</span>
+					</template>
+				</el-table-column>
+				<el-table-column label="姓名" align="left">
+					<template slot-scope="scope">
+							<div class="flex-box">
+								<userImage	class="fl" :user_name="scope.row.employee_name"	:img_url="scope.row.employee_img_url" width="50px" height="50px"></userImage>
+								<span style="line-height: 50px; padding-left: 10px;">{{ scope.row.employee_name }}</span>
+							</div>
+					</template>
+				</el-table-column>
+				<el-table-column label="B分" align="left" prop="point"></el-table-column>
+				<template slot="empty">
+					<div class="nopoint_box">
+						<div class="noimg noperson"></div>
+						<span class="title">没有对应的数据</span>
+					</div>
+				</template>
+			</el-table>
+			<center style="padding: 20px 0;">
+				<el-pagination
+					background
+					@size-change="handleSizeChange"
+					@current-change="handleCurrentChange"
+					:page-sizes="[10, 20, 30, 40, 50, 100]"
+					layout="total, sizes, prev, pager, next"
+					:page-size="formData.page_size"
+					:total="total"
+				></el-pagination>
+			</center>
+		</div>
+		<!-- 导出弹窗 -->
+		<el-dialog title="导出排名" :visible.sync="dialogVisible" width="730px" top="5%">
+			<span style="font-size:15px">系统将按以下已选条件导出对应的排名报表</span>
+			<el-form :inline="true">
+				<div class="picker_er">
+					<el-form-item label="时间">
+						<el-date-picker
+							v-model="Dc_Data.value1"
+							type="daterange"
+							 size="medium"
+							value-format="yyyy-MM-dd"
+							format="yyyy-MM-dd"
+							range-separator="至"
+							start-placeholder="开始日期"
+							end-placeholder="结束日期"
+						></el-date-picker>
+					</el-form-item>
+
+					<el-form-item label="人员" style="margin-left:30px">
+						<el-select  size="medium" v-model="Dc_Data.DC_position" style="width:150px" placeholder="请选择">
+							<el-option v-for="item in positions" :key="item.id" :label="item.name" :value="item.age"></el-option>
+						</el-select>
+					</el-form-item>
+				</div>
+				<el-form-item label="部门">
+					<el-cascader
+						class="date-picker-width cascader_bm"
+						v-model="Dc_Data.dept_name"
+						:options="dept_tree"
+						:props="{ checkStrictly: true,value:'id',label:'name',children:'_child'}"
+						ref="dept2"
+						size="medium"
+						clearable
+						filterable
+						placeholder="全公司"
+					></el-cascader>
+				</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"
+						 size="medium"
+						ref="rule"
+						clearable
+						collapse-tags
+						placeholder="请选择规则分类"
+					></el-cascader>
+				</el-form-item>
+			</el-form>
+			<span slot="footer" class="dialog-footer">
+				<el-button @click="dialogVisible = false"  size="medium">取 消</el-button>
+				<el-button type="primary" @click="exportExcel"  size="medium">导 出</el-button>
+			</span>
+		</el-dialog>
+
+		<!-- 轮播弹窗 -->
+		<el-dialog title="轮播排名" :visible.sync="byRankingShow" width="500px" top="5%">
+			<div>
+				<el-form :inline="true" ref="byRankingData" :model="byRankingData" :rules="byRankingDataRules" label-width="90px">
+					<el-form-item label="月份" prop="month">
+						<el-date-picker v-model="byRankingData.month"  size="medium" class="date-picker-width" type="month" value-format="yyyy-MM" placeholder="选择月份排名"></el-date-picker>
+					</el-form-item>
+					<el-form-item label="选择部门" prop="dept_id">
+						<el-cascader
+						    size="medium"
+							class="date-picker-width"
+							v-model="byRankingData.dept_id"
+							:options="dept_tree"
+							:props="{ checkStrictly: true,value:'obj',label:'name',children:'_child'}"
+							ref="dept1"
+							clearable
+							filterable
+							placeholder="全公司"
+						></el-cascader>
+					</el-form-item>
+					<el-form-item label="人员范围" prop="position">
+						<el-radio-group  size="medium" 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"  size="medium">取 消</el-button>
+				<el-button type="primary" @click="swiperPage('byRankingData')"  size="medium">开始轮播</el-button>
+			</span>
+		</el-dialog>
+	</div>
+</template>
+<script>
+import moment from 'moment';
+import season from '@/components/season';
+export default {
+	data() {
+		return {
+			Dc_Data: {
+				//导出数据
+				value1: '', //时间
+				DC_position: '全部', //人员
+				dept_name: [], //部门
+				rule_id: [] //规则
+			},
+			dialogVisible: false,
+			dept_name: [],
+			dept_tree: [],
+			loading: false,
+			formData: {
+				dept_id: '0',
+				sort: 'DESC',
+				pt_id: 3,
+				time_type: 1,
+				exclusion: [],
+				page: 1,
+				rule_id: [],
+				page_size: 10,
+				position: 0 //部门多选删除这个
+			},
+			total: null,
+			rule_trees: null,
+			rule_id: null,
+			list: null,
+			point_type: [],
+			sort: false,
+			time_types: [{ label: '月份', value: '1' }, { label: '年份', value: '2' }, { label: '季度', value: '3' }],
+			props: { value: 'id', label: 'name', children: 'child', multiple: true },
+			time_type: '月份',
+			export_from: {
+				year: '',
+				month: moment().format('YYYY-MM'),
+				quarter: ''
+			},
+			employee_map: JSON.parse(localStorage.getItem('SET_EMPLOYEE_MAP')),
+			positions: [{ id: 0, age: 'all', name: '全部' }, { id: 1, age: 'manager', name: '管理者' }, { id: 2, age: 'employee', name: '员工' }],
+			tips_show: false,
+			byRankingShow: false,
+			byRankingData: {
+				month: '',
+				dept_id: '',
+				position: 'all'
+			},
+			byRankingDeptId: '',
+			byRankingDataRules: {
+				month: [{ required: true, message: '请选择月份', trigger: 'blur' }],
+				dept_id: [{ required: true, message: '请选择部门', trigger: 'change' }],
+				position: [{ required: true, message: '请选择人员范围', trigger: 'change' }]
+			}
+		};
+	},
+	watch: {
+		sort(val) {
+			if (val) {
+				this.formData.sort = 'ASC';
+			} else {
+				this.formData.sort = 'DESC';
+			}
+		},
+		dept_name(val) {
+			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();
+			});
+		},
+		'byRankingData.dept_id'(val) {
+			this.$refs.dept1.dropDownVisible = false;
+		},
+		'Dc_Data.dept_name': function(val) {
+			this.$refs.dept2.dropDownVisible = false;
+		},
+		rule_id(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: {
+		// 轮播页面跳转
+		swiperPage(formName) {
+			this.$refs[formName].validate(valid => {
+				if (valid) {
+					var { href } = this.$router.resolve({
+						path: '/deptRankSwiper',
+						query: {
+							month: this.byRankingData.month || 0,
+							type: '2',
+							position: this.byRankingData.position,
+							dept_id: this.byRankingData.dept_id[0].id,
+							dept_name:this.byRankingData.dept_id[0].name,
+							pt_id: 3
+						}
+					});
+					window.open(href);
+				}
+			});
+		},
+		// 轮播排名弹窗
+		byRanking() {
+			this.byRankingData={
+				month: '',
+				dept_id: '',
+				position: 'all'
+			},
+			this.byRankingShow = true;	
+		},
+		// 提示信息
+		tips_close() {
+			localStorage.setItem('dept_rank_tips', 'true');
+			this.tips_show = false;
+		},
+		// 查询
+		selectBtn() {
+			switch (this.time_type) {
+				case '1':
+					this.$set(this.formData, 'month', this.export_from.month);
+					this.formData.month ? '' : delete this.formData.month;
+					break;
+				case '2':
+					this.$set(this.formData, 'year', this.export_from.year);
+					this.formData.year ? '' : delete this.formData.year;
+					break;
+				case '月份':
+					this.$set(this.formData, 'month', this.export_from.month);
+					this.formData.month ? '' : delete this.formData.month;
+					break;
+				case '3':
+					this.$set(this.formData, 'quarter', this.export_from.quarter);
+					this.formData.quarter ? '' : delete this.formData.quarter;
+					break;
+				default:
+					break;
+			}
+			let data = JSON.parse(JSON.stringify(this.formData));
+			data.page = 1;
+			data.page_size = 10;
+			this.$nextTick(() => {
+				this.get_list(data);
+			});
+		},
+		// 页面变更
+		handleCurrentChange(val) {
+			this.formData.page = val;
+			this.get_list(this.formData);
+		},
+		handleSizeChange(val) {
+			this.formData.page_size = val;
+			this.get_list(this.formData);
+		},
+		// 选择时间
+		export_quarter_confirm(val) {
+			this.export_from.quarter = val;
+		},
+		//请求数据
+		get_list(data, bool) {
+			if (this.time_type == 1) {
+				delete data.year;
+				delete data.quarter;
+			} else if (this.time_type == 2) {
+				delete data.month;
+				delete data.quarter;
+			} else if (this.time_type == '月份') {
+				delete data.year;
+				delete data.quarter;
+			} else if (this.time_type == 3) {
+				delete data.month;
+				delete data.year;
+			}
+			if (bool) {
+				data.month = moment().format('YYYY-MM');
+			}
+			let self = this;
+			self.loading = true;
+			data ? '' : (data = this.formData);
+			data.position = data.position == 'manager' ? 'manager' : data.position == 'employee' ? 'employee' : 'all';
+			self.$axios('get','/api/integral/statistics/ranking',data).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;
+			});
+		},
+		// 获取积分规则
+		get_rule_tree() {
+			this.$axios('get','/api/integral/rule/trees',{ cycle_type: '1'}).then(res => {
+				this.rule_trees =this.getRuleTreeData(res.data.data.rule_tree);
+			});
+		},
+		// 规则递归 children
+		getRuleTreeData(data) {
+			for (var i = 0; i < data.length; i++) {
+				if (data[i].child.length < 1) {
+					// children若为空数组,则将children设为undefined
+					data[i].child = undefined;
+				} else {
+					// children若不为空数组,则继续 递归调用 本方法
+					this.getRuleTreeData(data[i].child);
+				}
+			}
+			return data;
+		},
+		// 递归判断列表,把最后的children设为undefined
+		getTreeData(data) {
+			for (var i = 0; i < data.length; i++) {
+				data[i].obj={id:data[i].id,name:data[i].name};
+				if (data[i]._child.length < 1) {
+					// children若为空数组,则将children设为undefined
+					data[i]._child = undefined;
+				} else {
+					// children若不为空数组,则继续 递归调用 本方法
+					this.getTreeData(data[i]._child);
+				}
+			}
+			return data;
+		},
+		getEmployeeList() {
+			let self = this;
+			self.$axios('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);
+				}
+			})
+		},
+
+		exportExcel() {
+			//人员
+			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;
+			//规则
+			let rule_id = [];
+			for (let i in this.Dc_Data.rule_id) {
+				for (let a in this.Dc_Data.rule_id[i]) {
+					rule_id.push(this.Dc_Data.rule_id[i][a]);
+				}
+			}
+			this.Dc_Data.rule_id = rule_id;
+			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;
+			}
+			window.open(process.env.VUE_APP_BASE_API + 'api/download/ranking/v2?pt_id=3&employee_id=2'+ data, '_blank');
+			this.dialogVisible = false;
+		},
+		//获取部门
+		getDepartment() {
+			this.$axios('get','/api/department/tree').then(res => {
+				this.dept_tree =this.getTreeData(res.data.data.list);
+			});
+		},
+	},
+	mounted() {
+		this.tips_show = JSON.parse(localStorage.getItem('dept_rank_tips')) ? false : true;
+		this.getDepartment();
+		this.get_list(this.formData, true);
+		this.get_rule_tree();
+	}
+};
+</script>
+<style scoped lang="scss">
+.search_box {
+	::v-deep button:active {
+		background: #26a2ff;
+	}
+	::v-deep button:active .el-icon-search {
+		color: #fff;
+	}
+}
+.date-picker-width {
+	width: 100% !important;
+}
+.color_green {
+	color: #67c23a;
+}
+.nopoint_box {
+	display: inline-block;
+	text-align: center;
+	width: 100%;
+	margin-bottom: 10px;
+}
+.noimg {
+	display: inline-block;
+	width: 110px;
+	height: 110px;
+	margin: 22px auto 16px;
+	/* background:url("/static/images/nodata_default.png") no-repeat center; */
+	background-size: 99%;
+}
+.noperson {
+	display: inline-block;
+	width: 110px;
+	height: 110px;
+	line-height: none;
+	margin: 22px auto 16px;
+	background: url('/static/images/noperson_default.png') no-repeat center;
+	background-size: 99%;
+}
+.title {
+	display: block;
+	text-align: center;
+	font-size: 12px !important;
+	line-height: 30px;
+	color: #909399 !important;
+	padding: 0;
+}
+.nopoint_box a {
+	color: #26a2ff;
+}
+.chart_content {
+	.chart-legend__wrap {
+		text-align: right;
+		padding: 20px;
+		padding-right: 50px;
+		& .chart-legend__pink {
+			position: relative;
+			padding-left: 12px;
+			padding-right: 5px;
+			&:after {
+				content: '';
+				position: absolute;
+				margin-top: -2px;
+				top: 35%;
+				left: 0;
+				width: 8px;
+				height: 8px;
+				background: #f56c6c;
+				border-radius: 100%;
+			}
+		}
+
+		& .chart-legend__green {
+			position: relative;
+			padding-left: 12px;
+			&:after {
+				content: '';
+				position: absolute;
+				margin-top: -2px;
+				top: 35%;
+				left: 0;
+				width: 8px;
+				height: 8px;
+				background: #53b87f;
+				border-radius: 100%;
+			}
+		}
+	}
+}
+.drawer_title {
+	font-size: 18px;
+	padding: 20px;
+}
+.manager_statistics_box {
+	background-color: #ffffff;
+	padding: 20px;
+	min-height: calc(100vh - 160px);
+	::v-deep .el-row .el-checkbox .el-checkbox__label {
+		line-height: 20px;
+	}
+}
+.diy_tip_bg {
+	background: #f5f6f9;
+	overflow: hidden;
+	.diy-tip {
+		margin-bottom: 15px;
+		border: 1px solid #67c23a;
+		padding: 20px 16px;
+		p {
+			color: #67c23a !important;
+			font-size: 14px;
+			margin: 0 !important;
+			padding: 4px 0;
+		}
+	}
+}
+::v-deep .el-dialog {
+	top: 21%;
+}
+.picker_er {
+	margin-top: 20px;
+}
+.el-range-editor--medium.el-input__inner {
+	width: 280px;
+}
+::v-deep .el-cascader .el-input .el-input__inner {
+	width: 150px;
+}
+.el-checkbox.is-bordered.el-checkbox--medium {
+	padding: 9px 20px 7px 10px;
+}
+</style>
+<!--  -->

+ 612 - 0
src/views/ranking/integral_event.vue

@@ -0,0 +1,612 @@
+<template>
+	<div>
+		<div class="integral_event_box">
+			<el-form ref="form" :inline="true" label-width="80px">
+			  <el-form-item label="规则分类">
+			    <el-cascader
+			    	class="date-picker-width"
+			    	v-model="rule"
+			    	:options="rule_trees"
+			    	:props="props"
+			    	@change="rule_null"
+					size="medium"
+			    	ref="rule"
+			    	clearable
+			    	placeholder="全部规则分类"
+			    ></el-cascader>
+			  </el-form-item>
+			  <el-form-item label="积分分类">
+				  <el-select class="date-picker-width" size="medium" v-model="formData.pt_id" clearable placeholder="请选择积分分类">
+				  	<el-option v-for="item in point_types" :key="item.name" :label="item.name" :value="item.id"></el-option>
+				  </el-select>
+			  </el-form-item>
+			  <el-form-item label="部门">
+				  <el-cascader
+				    size="medium"
+				  	class="date-picker-width"
+				  	v-model="dept_name"
+				  	:options="dept_tree"
+				  	:props="{ checkStrictly: true,value:'id',label:'name',children:'_child'}"
+				  	ref="dept"
+				  	clearable
+				  	filterable
+				  	placeholder="全公司"
+				  ></el-cascader>
+			  </el-form-item>
+			  <el-form-item label="时间">
+				  <el-date-picker
+				  	v-model="time_slot"
+				  	type="daterange"
+					size="medium"
+				  	value-format="yyyy-MM-dd"
+				  	range-separator="至"
+				  	start-placeholder="开始日期"
+				  	end-placeholder="结束日期"
+				  ></el-date-picker>
+			  </el-form-item>
+			  <el-form-item>
+				  <el-input size="medium" v-model="formData.keyword" placeholder="输入同事姓名" max="200" @keyup.enter.native="keyWordSelect" class="persons_name">
+				  	<el-button size="medium" slot="append" icon="el-icon-search" @click="keyWordSelect"></el-button>
+				  </el-input>
+			  </el-form-item>
+			  <el-form-item>
+				  <!-- <el-button type="primary" size="medium" @click="excelImportShow = true">导入数据</el-button> -->
+				  <el-button type="primary" size="medium" @click="exportExcel">导出当前数据</el-button>
+				  <el-button type="primary" size="medium" plain @click="swiperShow = true">轮播事件</el-button>
+			  </el-form-item>
+			</el-form> 
+			 <!-- 表格 -->
+			<div>
+				<el-table :data="list" style="width: 100%" v-loading="loading" @row-click="open_detail">
+					<el-table-column prop="employee_name" label="姓名" align="left">	
+						<template slot-scope="scope">
+							<div class="flex-box">
+								<userImage	class="fl" :user_name="scope.row.employee_name"	:img_url="scope.row.employee_img_url" width="50px" height="50px"></userImage>
+								<span style="line-height: 50px; padding-left: 10px;">{{ scope.row.employee_name }}</span>
+							</div>
+						</template>
+					</el-table-column>
+					<el-table-column prop="dept" label="部门" align="left" width="150px"></el-table-column>
+					<el-table-column prop="point" label="积分" align="left" width="80px">
+						<template slot-scope="scope">
+							<span :class="scope.row.point < 0 ? 'color_green' : 'color_red'">{{ scope.row.point }} {{ point_name(scope.row.pt_id) }}</span>
+						</template>
+					</el-table-column>
+					<el-table-column prop="remark" 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>
+							<span v-show="scope.row.source_type == 2">任务</span>
+							<span v-show="scope.row.source_type == 3">积分系统分配</span>
+							<span v-show="scope.row.source_type == 4">考勤系统分配</span>
+							<span v-show="scope.row.source_type == 5">积分申请</span>
+							<span v-show="scope.row.source_type == 6">绩效任务包</span>
+							<span v-show="scope.row.source_type > 6">其他</span>
+						</template>
+					</el-table-column>
+					<el-table-column prop="create_time" label="录入时间" align="left" width="110px">
+						<template slot-scope="scope">
+							{{ cuttString(scope.row.create_time) }}
+						</template>
+					</el-table-column>
+				
+					<template slot="empty">
+						<noData></noData>
+					</template>
+				</el-table>
+				<center class="pagination">
+					<el-pagination
+						background
+						@size-change="handleSizeChange"
+						@current-change="handleCurrentChange"
+						:current-page="formData.page"
+						:page-sizes="[10, 20, 30, 40, 50, 100]"
+						layout="total, sizes, prev, pager, next"
+						:page-size="pageLimit"
+						:total="total"
+					></el-pagination>
+				</center>
+			</div>
+		</div>
+		<el-drawer title="事件详情" :visible.sync="detail_popup" ref="drawer" :with-header="false" :width="'500px'" direction="rtl">
+			<div class="drawer_title">事件详情</div>
+			<div class="detail_popup" v-loading="detail_loading" v-if="detail_info !== null">
+				<el-row style="padding-bottom:10px;border-bottom:1px #f8f8f8 solid;">
+					<el-col :span="24">
+						<userImage :user_name="detail_info.employee_name" class="fl" width="50px" height="50px" fontSize="1"></userImage>
+						<span style="line-height:50px; margin-left:10px;margin-right:4px;">{{ detail_info.employee_name }}</span>
+						<span class="color_red point" v-show="detail_info.point >= 0">+{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
+						<span class="color_green point" v-show="detail_info.point < 0">{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
+					</el-col>
+				</el-row>
+
+				<el-row>
+					<el-col :span="4">任务描述</el-col>
+					<el-col :span="20" v-if="detail_info.remark">{{ detail_info.remark && (detail_info.remark.customize || detail_info.remark.rule) }}</el-col>
+				</el-row>
+
+				<el-row>
+					<el-col :span="4">规则分类</el-col>
+					<el-col :span="20">{{ detail_info.rule_list }}</el-col>
+				</el-row>
+
+				<el-row v-show="detail_info.rule_list">
+					<el-col :span="4">事件时间</el-col>
+					<el-col :span="20">{{ detail_info.date }}</el-col>
+				</el-row>
+
+				<el-row v-show="detail_info.source_type_mark">
+					<el-col :span="4">来源类型</el-col>
+					<el-col :span="20">{{ detail_info.source_type_mark }}</el-col>
+				</el-row>
+
+				<el-row v-show="!detail_info.rule_id">
+					<el-col :span="4">记录人</el-col>
+					<el-col :span="20">{{ detail_info.employee_name }}</el-col>
+				</el-row>
+
+				<el-row v-show="detail_info.files !== null && detail_info.files.length > 0">
+					<el-col :span="4">图片</el-col>
+					<el-col :span="20"><el-image style="width: 100px; height: 100px" :src="detail_info.files[0]" :preview-src-list="detail_info.files"></el-image></el-col>
+				</el-row>
+
+				<div v-show="detail_info.rule_id">
+					<p class="row_title">规则依据</p>
+					<el-row>
+						<el-col :span="4">规则分类</el-col>
+						<el-col :span="19">{{ detail_info.rule_list }}</el-col>
+					</el-row>
+					<el-row v-show="detail_info.remark.rule">
+						<el-col :span="4">积分规则</el-col>
+						<el-col :span="19">{{ detail_info.remark.rule }}</el-col>
+					</el-row>
+					<el-row>
+						<el-col :span="5">积分</el-col>
+						<el-col :span="19" v-show="detail_info.rule_item.min_point == detail_info.rule_item.max_point">{{ detail_info.rule_item.min_point }}</el-col>
+						<el-col :span="19" v-show="detail_info.rule_item.min_point != detail_info.rule_item.max_point">
+							{{ detail_info.rule_item.min_point }} ~ {{ detail_info.rule_item.max_point }}
+						</el-col>
+					</el-row>
+				</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;">
+										{{ item.name }} {{ item.remark }}
+										<span v-show="item.point !== 0">{{ item.point }}</span>
+									</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;">
+					<el-button @click="close_integral_event">取消</el-button>
+					<el-button type="danger" @click="del_integral_event(detail_info)">删除</el-button>
+				</div>
+			</div>
+		</el-drawer>
+
+		<!-- 导入数据 -->
+		<el-dialog title="导入积分事件数据" width="600px" :visible.sync="excelImportShow" :close-on-click-modal="false" :before-close="close_import">
+			<div style="padding:0 50px;">
+				<div class="flex-box flex-v-ce margin-bottom">
+					<div style="margin-right: 10px;">1、下载积分事件模版,批量录入积分事件</div>
+					<el-button size="medium" type="primary" @click="downloadTemplate"  plain>下载模板</el-button>
+				</div>
+				<div class="margin-bottom">
+					<el-upload  :limit="1" :headers="ATOKEN" ref="upload1" :action="action" :data="{ type: 'integral' }" :on-success="handlePictureCardPreview" :before-upload="beforeFilesUpload">
+						<p>2、上传积分事件数据Excel表<el-button  style="margin-left: 10px;" size="medium" type="primary" plain>选择文件</el-button></p>
+					</el-upload>
+				</div>
+				<div>3、选择文件后点击下方【上传】按钮</div>
+			</div>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click="close_import"  size="medium">取 消</el-button>
+				<el-button type="primary" @click="uploadFile(1)"  size="medium" :loading="update_btn">上传</el-button>
+			</div>
+		</el-dialog>
+
+		<el-dialog title="导入错误信息" :visible.sync="importErrorInfoShow" width="30%">
+			<div>
+				<el-table :data="error_list" border stripe>
+					<el-table-column prop="name" label="错误信息">
+						<template slot-scope="scope">
+							{{ scope.row }}
+						</template>
+					</el-table-column>
+				</el-table>
+			</div>
+			<span slot="footer"><el-button type="primary"  size="medium" @click="importErrorInfoShow = false">确 定</el-button></span>
+		</el-dialog>
+
+		<el-dialog title="轮播事件" :visible.sync="swiperShow" width="500px">
+			<div>
+				<el-row>
+					<el-col :span="5" style="line-height: 36px;">仅展示最新的</el-col>
+					<el-col :span="6">
+						<el-select v-model="page_size" placeholder="请选择">
+							<el-option v-for="item in swiperPageList" :key="item.value" :label="item.value" :value="item.value"></el-option>
+						</el-select>
+					</el-col>
+					<el-col :span="6" style="line-height: 36px;">条积分事件来轮播</el-col>
+				</el-row>
+			</div>
+			<span slot="footer">
+				<el-button  size="medium" @click="swiperShow = false" style="margin-right: 10px;">取 消</el-button>
+				<router-link :to="{ path: '/deptRankSwiper?' + '&page=1&page_size=' + this.page_size + '&type=1' }" target="_blank">
+					<el-button  size="medium" type="primary">开始轮播</el-button>
+				</router-link>
+			</span>
+		</el-dialog>
+	</div>
+</template>
+<script>
+import noData from '@/components/noData';
+export default {
+	data() {
+		return {
+			action:process.env.VUE_APP_BASE_API+'/api/upload/excel',
+			ATOKEN: { 'A-TOKEN':this.$getToken()},
+			loading: false,
+			swiperShow: false,
+			swiperPageList: [{ value: '10' }, { value: '30' }, { value: '50' }],
+			page_size: 10,
+			point_types: this.$getTyps(),
+			dept_name: [],
+			dept_tree: [],
+			formData: {
+				page: 1,
+				page_size: 10
+			},
+			time_slot: null,
+			rule_trees: [],
+			props: {checkStrictly: true, value: 'id', label: 'name', children: 'child' },
+			rule: [],
+			list: [],
+			total: null,
+			detail_info: null,
+			detail_popup: false,
+			detail_loading: false,
+			pageLimit: 10,
+			excelImportShow: false,
+			update_btn: false,
+			error_list: [],
+			importErrorInfoShow: false
+		};
+	},
+	components: { noData },
+	created() {},
+	mounted() {
+		this.getDepartment();
+		this.get_rule_trees();
+		this.get_integral_list(this.formData);
+	},
+	watch: {
+		'formData.pt_id'(val, old_val) {
+			this.formData.page = 1;
+			!val ? delete this.formData.pt_id : '';
+			this.get_integral_list(this.formData);
+		},
+		'formData.page'(val, old_val) {
+			this.get_integral_list(this.formData);
+		},
+		time_slot(val, old_val) {
+			this.formData.page = 1;
+			if (val !== null) {
+				this.formData.start_day = val[0];
+				this.formData.end_day = val[1];
+			} else {
+				delete this.formData.start_day;
+				delete this.formData.end_day;
+			}
+			this.get_integral_list(this.formData);
+		},
+		dept_name(val, old_val) {
+			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);
+			});
+		}
+	},
+	methods: {
+		// keyword
+		keyWordSelect() {
+			this.formData.page = 1;
+			this.get_integral_list(this.formData);
+		},
+		downloadTemplate() {
+			window.open(process.env.VUE_APP_BASE_API + 'api/download/integral/template');
+		},
+		// 文件上传
+		close_import() {
+			this.excelImportShow = false;
+		},
+		uploadFile() {
+			let params = {};
+			params.file = this.file;
+			this.update_btn = true;
+			this.$axios("post",'/api/integral/import', params).then(res => {
+					if (res.data.code == 1) {
+						if (res.data.data.error.length == 0) {
+							this.$message({ type: 'success', message: '导入成功' });
+							this.excelImportShow = false;
+						} else {
+							this.$message({ type: 'error', message: '导入错误' });
+							this.error_list = res.data.data.error;
+							this.importErrorInfoShow = true;
+						}
+					} else {
+						this.$message({ type: 'error', message: res.data.msg });
+					}
+				})
+				.finally(() => {
+					setTimeout(() => {
+						this.update_btn = false;
+					}, 3000);
+				});
+		},
+		handlePictureCardPreview(response) {
+			console.log(response);
+			if (response.code == 1) {
+				this.file = response.data;
+			}
+		},
+		beforeFilesUpload(file) {
+			const $ext_list = ['xlsx', 'xls'];
+			let len = file.name.split('.').length - 1;
+			const $ext_name = file.name.split('.')[len];
+			if ($ext_list.indexOf($ext_name) != -1) {
+			} else {
+				this.$message.warning('文件格式上传错误,仅支持上传xlsx,xls)');
+				return false;
+			}
+		},
+		onFilePreView() {},
+		exportExcel() {
+			window.open(process.env.VUE_APP_BASE_API +'api/download/integral?employee_id='+this.$getUserData().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.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 : '') +
+					(this.formData.keyword ? '&keyword=' + this.formData.keyword : ''),
+				'_blank'
+			);
+		},
+		// end 文件上传
+		handleSizeChange(val) {
+			this.pageLimit = val;
+			this.formData.page_size = this.pageLimit;
+			this.get_integral_list(this.formData);
+		},
+		cuttString(data) {
+			return data.substring(5);
+		},
+		open_detail(item) {
+			this.detail_popup = true;
+			let data = {
+				event_id: item.id
+			};
+			this.detail_loading = true;
+			this.$axios("get",'/api/integral/statistics/integral/info',data).then(res => {
+					if (res.data.code == 1) {
+						this.detail_info = res.data.data;
+					} else {
+						this.$message.error(res.data.data.msg);
+					}
+				})
+			.finally(() => {
+					this.detail_loading = false;
+			});
+		},
+		//获取部门
+		getDepartment() {
+			this.$axios('get','/api/department/tree').then(res => {
+				this.dept_tree =this.getTreeData(res.data.data.list);
+			});
+		},
+		//获取规则
+		get_rule_trees() {
+			this.$axios('get','/api/integral/rule/trees').then(res => {
+				this.rule_trees =this.getRuleTreeData(res.data.data.rule_tree);
+			});
+		},
+		get_integral_list(data) {
+			data.dept_ids = data.dept_id;
+			delete data.dept_id;
+			this.loading = true;
+			this.$axios('get','/api/integral/statistics/integral',data).then(res => {
+					if (res.data.code == 1) {
+						this.list = res.data.data.list;
+						this.total = res.data.data.total;
+					} else {
+						this.$message.error(res.data.data.msg);
+					}
+				})
+				.finally(() => {
+					this.loading = false;
+				});
+		},
+		handleCurrentChange(val) {
+			this.formData.page = val;
+		},
+		rule_null(val) {
+			if (val.length == 0) {
+				this.formData.rule_id = 0;
+			} else {
+				this.formData.rule_id = this.rule[this.rule.length - 1];
+			}
+			this.$nextTick(() => {
+				this.$refs.rule.dropDownVisible = false;
+				this.get_integral_list(this.formData);
+			});
+		},
+		del_integral_event(item) {
+			this.$confirm('删除事件的同时也会撤销积分,确定删除吗?', '提示', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning'
+			}).then(() => {
+				this.$axios("DELETE",'/api/integral/statistics/integral',{ event_id: item.event_id }).then(res => {
+						if (res.data.code == 1) {
+							this.$message.success(res.data.msg);
+							this.detail_popup = false;
+							this.get_integral_list();
+						} else {
+							this.$message.error(res.data.msg);
+						}
+					})
+					.catch(e => {
+						this.$message.error(e.data.msg);
+					});
+			});
+		},
+		close_integral_event() {
+			this.detail_popup = false;
+		},
+		point_name(id) {
+			return this.point_types.find(item => {
+				if (item.id == id) {
+					return item.name;
+				}
+			}).name;
+		},
+		// 递归判断列表,把最后的children设为undefined
+		getTreeData(data) {
+			for (var i = 0; i < data.length; i++) {
+				if (data[i]._child.length < 1) {
+					// children若为空数组,则将children设为undefined
+					data[i]._child = undefined;
+				} else {
+					// children若不为空数组,则继续 递归调用 本方法
+					this.getTreeData(data[i]._child);
+				}
+			}
+			return data;
+		},
+		// 规则递归 children
+		getRuleTreeData(data) {
+			for (var i = 0; i < data.length; i++) {
+				if (data[i].child.length < 1) {
+					// children若为空数组,则将children设为undefined
+					data[i].child = undefined;
+				} else {
+					// children若不为空数组,则继续 递归调用 本方法
+					this.getRuleTreeData(data[i].child);
+				}
+			}
+			return data;
+		},
+	}
+};
+</script>
+<style scoped lang="scss">
+header.el-drawer__header {
+	font-size: 18px;
+	font-family: MicrosoftYaHei;
+	color: #303133;
+	width: 500px;
+	span {
+		:focus {
+			outline: 0;
+		}
+	}
+}
+.display_flex {
+	display: flex;
+}
+.label {
+	line-height: 36px;
+	padding-right: 10px;
+}
+.time_section {
+	.el-range-editor {
+		width: 330px;
+	}
+}
+.color_green {
+	color: #67c23a;
+}
+.pagination {
+	padding: 20px 0;
+}
+.detail_popup {
+	padding: 20px;
+	height: 100%;
+	.row_title {
+		position: relative;
+		margin: 0 0 20px 0;
+		padding-top: 12px;
+		font-size: 16px;
+		color: #303133;
+		line-height: 22px;
+	}
+	.row_title:before {
+		position: absolute;
+		top: 0;
+		content: ' ';
+		width: 100%;
+		border-top: 1px #f8f8f8 solid;
+	}
+	.el-row {
+		margin-bottom: 10px;
+		font-size: 14px;
+		.el-col-4 {
+			color: #606266;
+		}
+	}
+}
+.color_red {
+	color: #f56c6c;
+}
+.color_green {
+	color: #67c23a;
+}
+span.point {
+	font-size: 16px;
+}
+.drawer_title {
+	font-size: 18px;
+	padding: 20px;
+	border-bottom: 1px #efefef solid;
+}
+.row_tips {
+	display: block;
+	color: #909399;
+	font-size: 12px;
+	margin-top: 0px;
+}
+.el-range-editor--medium .el-range-separator {
+	width: 25px;
+}
+.integral_event_box {
+	background-color: #ffffff;
+	padding: 20px;
+	min-height: calc(100vh - 160px);
+}
+.examine_steps ::v-deep .el-step.is-vertical .el-step__title {
+	padding-bottom: 0;
+}
+</style>

+ 284 - 0
src/views/ranking/total_rank.vue

@@ -0,0 +1,284 @@
+<template>
+	<div>
+		<div class="diy_tip_bg" v-show="tips_show">
+			<el-alert class="diy-tip" @close="tips_close" type="success" description><p>排名包含初始分和工龄分</p></el-alert>
+		</div>
+
+		<div class="manager_statistics_box">
+			<el-form :inline="true">
+				<el-form-item label="部门">
+					<el-cascader
+					  size="medium"
+						class="date-picker-width"
+						v-model="dept_name"
+						:options="dept_tree"
+						:props="{ checkStrictly: true,value:'id',label:'name',children:'_child'}"
+						ref="dept"
+						clearable
+						filterable
+						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>
+
+			<el-table :data="list" style="width: 100%" v-loading="loading">
+				<el-table-column label="名次" width="80" align="center">
+					<template slot-scope="scope">
+						<img v-if="scope.row.rank === 1" src="@/assets/image/statistics_NO1.png" alt="" />
+						<img v-if="scope.row.rank === 2" src="@/assets/image/statistics_NO2.png" alt="" />
+						<img v-if="scope.row.rank === 3" src="@/assets/image/statistics_NO3.png" alt="" />
+						<span v-if="scope.row.rank > 3">{{ scope.row.rank }}</span>
+					</template>
+				</el-table-column>
+				<el-table-column label="姓名" align="left">
+					<template slot-scope="scope">
+						<div class="flex-box">
+							<userImage	class="fl" :user_name="scope.row.employee_name"	:img_url="scope.row.employee_img_url" width="50px" height="50px"></userImage>
+							<span style="line-height: 50px; padding-left: 10px;">{{ scope.row.employee_name }}</span>
+						</div>
+					</template>
+				</el-table-column>
+				<el-table-column label="B分" align="left" prop="point"></el-table-column>
+				<template slot="empty">
+					<div class="nopoint_box">
+						<div class="noimg noperson"></div>
+						<span class="title">没有对应的数据</span>
+					</div>
+				</template>
+			</el-table>
+
+			<center style="padding: 20px 0;">
+				<el-pagination
+					background
+					@size-change="handleSizeChange"
+					@current-change="handleCurrentChange"
+					:current-page="formData.page"
+					:page-sizes="[10, 20, 30, 40, 50, 100]"
+					layout="total, sizes, prev, pager, next"
+					:page-size="pageLimit"
+					:total="total"
+				></el-pagination>
+			</center>
+		</div>
+	</div>
+</template>
+<script>
+export default {
+	data() {
+		return {
+			dept_name: [],
+			dept_tree: [],
+			loading: false,
+			formData: {
+				dept_id: '0',
+				sort: 'DESC',
+				page: 1,
+				page_size: 10,
+				pt_id: 3,
+				type: 'all'
+			},
+			sort: false,
+			list: null,
+			pageLimit: 10,
+			total: null,
+			tips_show: false
+		};
+	},
+	watch: {
+		sort(val) {
+			if (val) {
+				this.formData.sort = 'ASC';
+			} else {
+				this.formData.sort = 'DESC';
+			}
+			this.formData.page = 1;
+			this.get_list();
+		},
+		dept_name(val) {
+			if (val.length !== 0) {
+				this.formData.dept_id = val[val.length - 1];
+			} else {
+				this.formData.dept_id = '0';
+			}
+			this.formData.page = 1;
+			this.$nextTick(() => {
+				this.$refs.dept.dropDownVisible = false;
+				this.get_list();
+			});
+		}
+	},
+	methods: {
+		// 提示信息
+		tips_close() {
+			localStorage.setItem('total_rank_tips', 'true');
+			this.tips_show = false;
+		},
+		// 页面变更
+		handleCurrentChange(val) {
+			this.formData.page = val;
+			this.get_list();
+		},
+		handleSizeChange(val) {
+			this.pageLimit = val;
+			this.formData.page_size = this.pageLimit;
+			this.get_list();
+		},
+		//获取部门
+		getDepartment() {
+			this.$axios('get','/api/department/tree').then(res => {
+				this.dept_tree =this.getTreeData(res.data.data.list);
+			});
+		},
+		get_list() {
+			this.loading = true;
+			this.$axios('get','/api/integral/statistics/ranking', this.formData).then(res => {
+					if (res.data.code == 1) {
+						this.list = res.data.data.list;
+						this.total = res.data.data.total;
+					} else {
+						this.$message.error(res.data.data.msg);
+					}
+				})
+				.finally(() => {
+					this.loading = false;
+				});
+		},
+		// 递归判断列表,把最后的children设为undefined
+		getTreeData(data) {
+			for (var i = 0; i < data.length; i++) {
+				if (data[i]._child.length < 1) {
+					// children若为空数组,则将children设为undefined
+					data[i]._child = undefined;
+				} else {
+					// children若不为空数组,则继续 递归调用 本方法
+					this.getTreeData(data[i]._child);
+				}
+			}
+			return data;
+		}
+	},
+	created() {
+		this.getDepartment();
+	},
+	mounted() {
+		this.tips_show = JSON.parse(localStorage.getItem('total_rank_tips')) ? false : true;
+		this.get_list();
+	}
+};
+</script>
+<style scoped lang="scss">
+.search_box {
+	::v-deep button:active {
+		background: #26a2ff;
+	}
+	::v-deep button:active .el-icon-search {
+		color: #fff;
+	}
+}
+.date-picker-width {
+	width: 100% !important;
+}
+.color_green {
+	color: #67c23a;
+}
+.nopoint_box {
+	display: inline-block;
+	text-align: center;
+	width: 100%;
+	margin-bottom: 10px;
+}
+.noimg {
+	display: inline-block;
+	width: 110px;
+	height: 110px;
+	margin: 22px auto 16px;
+	background-size: 99%;
+}
+.noperson {
+	display: inline-block;
+	width: 110px;
+	height: 110px;
+	line-height: none;
+	margin: 22px auto 16px;
+	// background: url("@/assets/image/rules_mould.png") no-repeat center;
+	background-size: 99%;
+}
+.title {
+	display: block;
+	text-align: center;
+	font-size: 12px !important;
+	line-height: 30px;
+	color: #909399 !important;
+	padding: 0;
+}
+.nopoint_box a {
+	color: #26a2ff;
+}
+.chart_content {
+	.chart-legend__wrap {
+		text-align: right;
+		padding: 20px;
+		padding-right: 50px;
+		& .chart-legend__pink {
+			position: relative;
+			padding-left: 12px;
+			padding-right: 5px;
+			&:after {
+				content: '';
+				position: absolute;
+				margin-top: -2px;
+				top: 35%;
+				left: 0;
+				width: 8px;
+				height: 8px;
+				background: #f56c6c;
+				border-radius: 100%;
+			}
+		}
+
+		& .chart-legend__green {
+			position: relative;
+			padding-left: 12px;
+			&:after {
+				content: '';
+				position: absolute;
+				margin-top: -2px;
+				top: 35%;
+				left: 0;
+				width: 8px;
+				height: 8px;
+				background: #53b87f;
+				border-radius: 100%;
+			}
+		}
+	}
+}
+.drawer_title {
+	font-size: 18px;
+	padding: 20px;
+}
+.manager_statistics_box {
+	background-color: #ffffff;
+	padding: 20px;
+	min-height: calc(100vh - 160px);
+	::v-deep .el-row .el-checkbox .el-checkbox__label {
+		line-height: 20px;
+	}
+}
+.diy_tip_bg {
+	background: #f5f6f9;
+	overflow: hidden;
+	.diy-tip {
+		margin-bottom: 15px;
+		border: 1px solid #67c23a;
+		padding: 20px 16px;
+		p {
+			color: #67c23a !important;
+			font-size: 14px;
+			margin: 0 !important;
+			padding: 4px 0;
+		}
+	}
+}
+</style>

+ 2 - 2
src/views/check.vue → src/views/set/check.vue

@@ -113,7 +113,7 @@ export default {
       objs.off_duty_early = ok[6].sj>0? -ok[6].sj:ok[6].sj; //<=0
       objs.ot_per_hour = ok[7].sj; //>=0
       objs.leave_per_hour = ok[8].sj>0? -ok[8].sj:ok[8].sj; //<=0
-      this.$axios('post',"api/ad/update",objs).then((res) => {
+      this.$axios('post',"/api/ad/update",objs).then((res) => {
           if (res.data.code == 1) {
             this.$message({
               message: res.data.msg,
@@ -126,7 +126,7 @@ export default {
     },
     cheak_ax() {
       this.loading = true;
-      this.$axios('get',"api/ad/info").then((res) => {
+      this.$axios('get',"/api/ad/info").then((res) => {
         var arr = [],config=res.data.data;
 		config.no_sign=config.no_sign-(config.no_sign+config.no_sign);
 		config.absent=config.absent-(config.absent+config.absent);

+ 30 - 25
src/views/framework.vue → src/views/set/framework.vue

@@ -20,7 +20,7 @@
 				<div class="terr-left">
 					<div class="rule_class_box">
 							<div class="company_name">
-								<img src="../assets/image/two.png" />
+								<img src="@/assets/image/two.png" />
 								<span>组织架构</span>
 								<!-- <span :class="[dept_id==0? 'blue':'']">{{ info.name }}</span> -->
 							</div>
@@ -45,7 +45,7 @@
 								slot-scope="{ node, data }"
 								style="font-size: 14px;color: #606266; width:100%; text-align: left;"
 							>
-								<img src="../assets/image/one.png" style="width: 20px;margin-right: 5px;" />
+								<img src="@/assets/image/one.png" style="width: 20px;margin-right: 5px;" />
 								<span class="name">{{ data.name }}</span>
 							</div>
 						</el-tree>
@@ -163,8 +163,8 @@ export default {
 			  type: 'warning'
 			}).then(() => {
 				this.tbLoading = true;
-				var http1 = this.$axios('post','api/ding/department_sync');
-				var http2 = this.$axios('post','api/ding/employee_sync');
+				var http1 = this.$axios('post','/api/ding/department_sync');
+				var http2 = this.$axios('post','/api/ding/employee_sync');
 				Promise.all([http1, http2]).then(res => {
 					if (res[0]) {
 						this.$message.success({ message: '同步成功' });
@@ -177,7 +177,7 @@ export default {
 		},
 		//是否开通
 		changeIs(e, id) {
-			var url = e == 1 ? 'api/employee/disable' : 'api/employee/enable';
+			var url = e == 1 ? '/api/employee/disable' : '/api/employee/enable';
 			this.$axios('post',url, { employee_id: [id] }).then(res => {
 				if (res) {
 					if(e==0){
@@ -192,7 +192,7 @@ export default {
 		//批量开通权限
 		participation() {
 			this.enable_loading=true;
-			this.$axios('post','api/employee/enable', { employee_id: this.selectIds }).then(res => {
+			this.$axios('post','/api/employee/enable', { employee_id: this.selectIds }).then(res => {
 				if (res) {
 					this.$message.success({ message: '开启成功,可在"角色权限设置对应管理范围"' });
 					this.getEmployee();
@@ -203,7 +203,7 @@ export default {
 		},
 		//获取公司信息
 		getInfo() {
-			this.$axios('get','api/site/info').then(res => {
+			this.$axios('get','/api/site/info').then(res => {
 				this.info = res.data.data;
 				this.getDepartment();
 			});
@@ -223,7 +223,7 @@ export default {
 		},
 		//获取部门
 		getDepartment() {
-			this.$axios('get','api/department/tree').then(res => {
+			this.$axios('get','/api/department/tree').then(res => {
 				var list=[{
 					id:0,
 					name:this.info.name,
@@ -236,7 +236,7 @@ export default {
 		//获取员工
 		getEmployee() {
 			this.tableToading = true;
-			this.$axios('get','api/employee/index', {dept_id: this.dept_id, keywords: this.keywords, page: this.page, page_size: this.perPage }).then(res => {
+			this.$axios('get','/api/employee/index', {dept_id: this.dept_id, keywords: this.keywords, page: this.page, page_size: this.perPage }).then(res => {
 				this.total = res.data.data.pageInfo.count;
 				this.userList = res.data.data.list;
 			}).finally(err=>{
@@ -356,22 +356,27 @@ export default {
 		background: #ecf5ff;
 		border-radius: 4px;
 	}
-	::v-deep .is-current .el-tree-node__content .el-icon-caret-right {
-		color: #409eff !important;
-	}
-	::v-deep .is-current .el-tree-node__content .el-tree-node__label {
-		color: #409eff !important;
-	}
-	::v-deep .is-current .el-tree-node__children .el-icon-caret-right {
-		color: #c0c4cc !important;
-	}
-	::v-deep .is-current .el-tree-node__children .el-tree-node__label {
-		color: #606266 !important;
-	}
-	::v-deep .is-current .name {
-		color: #409eff !important;
-		font-weight: normal;
-		transition: 0.35s ease-in-out;
+	::v-deep .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .name{
+	    color: #409eff !important;
+			font-weight: normal;
+			transition: 0.35s ease-in-out;
 	}
+	// ::v-deep .is-current .el-tree-node__content .el-icon-caret-right {
+	// 	color: #409eff !important;
+	// }
+	// ::v-deep .is-current .el-tree-node__content .el-tree-node__label {
+	// 	color: #409eff !important;
+	// }
+	// ::v-deep .is-current .el-tree-node__children .el-icon-caret-right {
+	// 	color: #c0c4cc !important;
+	// }
+	// ::v-deep .is-current .el-tree-node__children .el-tree-node__label {
+	// 	color: #606266 !important;
+	// }
+	// ::v-deep .is-current .name {
+	// 	color: #409eff !important;
+	// 	font-weight: normal;
+	// 	transition: 0.35s ease-in-out;
+	// }
 }
 </style>

+ 1 - 1
src/views/initialPoint.vue → src/views/set/initialPoint.vue

@@ -55,7 +55,7 @@ export default {
       this.loading = true;
       this.obj.base_point = +ok[0].sj;
       this.obj.service_point = +ok[1].sj;
-      this.$axios('post',"api/integral/site/config", this.obj).then((res) => {
+      this.$axios('post',"/api/integral/site/config", this.obj).then((res) => {
           if (res.data.code == 1) {
             this.$message({
               message: res.data.msg,

+ 15 - 23
src/views/jurisdiction.vue → src/views/set/jurisdiction.vue

@@ -241,7 +241,7 @@
 		</div>
 		<el-dialog title="添加人员" :visible.sync="add_employee_show" :before-close="publicClose" width="700px" top="5vh">
 			<EmployeeSelector
-				v-if="add_employee_form"
+				v-if="add_employee_show"
 				ref="Employee"
 				:user_no_select="false"
 				:can_select_dept="false"
@@ -280,7 +280,6 @@
 		  ref="Employee2" 
 		  :user_no_select="false" 
 		  :my_no_select="my_no_select"
-		  :max='add_employee_max'
 		  :selected="management_scope_arr" 
 		  :can_select_dept="false" 
 		  @confirm="management_scope_confirm">
@@ -378,7 +377,7 @@
 </template>
 
 <script>
-import EmployeeSelector from '../components/EmployeeSelector.vue';
+import EmployeeSelector from '@/components/EmployeeSelector.vue';
 import noData from '@/components/noData';
   const minimum = (rule, value,callback)=>{
     if (value < 0){
@@ -410,7 +409,6 @@ export default {
 			management_scope_show:false,
 			integral_limit_loading:false,
 			integral_limit_form:{},
-			add_employee_max: 0,
 			management_scope_arr: {employee: [], dept: []},
 			scope_loading:false,
 			integral_loading:false,
@@ -421,18 +419,18 @@ export default {
 			bonus_deducted_loading:false,
 			bonus_loading:false,
 			integral_limit_rules:{
-			  exec_count:[
-			    { required: true, validator: minimum, trigger: 'blur' },
-			  ],
-			  exec_count_point:[
-			    { required: true, validator: minimum, trigger: 'blur' },
-			  ],
-			  reward_ratio:[
-			    { required: true, validator: minimum, trigger: 'blur' },
-			  ],
-			  reward_ratio_point:[
-			    { required: true, validator: minimum, trigger: 'blur' },
-			  ],
+			  // exec_count:[
+			  //   { required: true, validator: minimum, trigger: 'blur' },
+			  // ],
+			  // exec_count_point:[
+			  //   { required: true, validator: minimum, trigger: 'blur' },
+			  // ],
+			  // reward_ratio:[
+			  //   { required: true, validator: minimum, trigger: 'blur' },
+			  // ],
+			  // reward_ratio_point:[
+			  //   { required: true, validator: minimum, trigger: 'blur' },
+			  // ],
 			},
 			my_no_select:'',//设置人的ID
 		};
@@ -459,11 +457,7 @@ export default {
 		  this.integral_limit_form.employee_id = this.set_mployee_limit_id
 		  this.$refs[fromName].validate((valid) => {
 		    if (valid) {
-		      this.$axios({
-		        url: '/api/integral/employee/limit',
-		        method: 'post',
-		        data: this.integral_limit_form
-		      }).then((res) => {
+		      this.$axios('post','/api/integral/employee/limit',this.integral_limit_form).then((res) => {
 		        if (res.data.code == 1) {
 		          this.$message.success(res.data.msg)
 		          setTimeout(() => {
@@ -481,7 +475,6 @@ export default {
 		},
 		//设置管理范围
 		sub_management_scope(){
-		 console.log("进来了")
 		  this.scope_loading=true;
 		  this.$refs.Employee2.confirm();//调用组件的confirm();
 		  this.$axios('post','/api/employee/scope',{employee_id: this.list_info.id,id: this.management_arr}).then((res) => {
@@ -498,7 +491,6 @@ export default {
 		},
 		//添加编辑管理范围
 		management_scope_confirm(val){
-			console.log("进来了2")
 		  this.management_arr = []
 		  val.employee.forEach(element => {
 		    this.management_arr.push(element.id)

+ 14 - 9
src/views/rule.vue → src/views/set/rule.vue

@@ -28,7 +28,7 @@
 					<div class="flex-box btns flex-v-ce">
 						<el-button size="small" @click="del_item" type="danger" plain>批量删除</el-button>
 						<el-button size="small" @click="add_rule" type="primary">添加规则</el-button>
-						<el-button size="small" @click="import_rules_show = true" plain>导入规则</el-button>
+						<!-- <el-button size="small" @click="import_rules_show = true" plain>导入规则</el-button> -->
 					</div>
 					<el-table stripe ref="multipleTable" :data="item_list" tooltip-effect="dark" @selection-change="handleSelectionChange" @row-click="editDetails" align="center">
 						<el-table-column type="selection" width="55"></el-table-column>
@@ -135,12 +135,13 @@
 						</el-col>
 					</el-row>
 				</el-form-item>
-				<el-form-item style="text-align: right; margin-bottom:0;">
+				<div class="flex-box flex-v-ce">
 					<el-button type="danger" @click="del_rule" :loading="delRule_loading" v-show="rule_type == 'edit'">删除规则</el-button>
+					<div class="flex-1"></div>
 					<el-button @click="rule_close('rules_detail_form')">取消</el-button>
 					<el-button type="primary" v-show="rule_type == 'add'" :loading="rule_loading2" @click="add_submit_rule('rules_detail_form')">确定</el-button>
 					<el-button type="primary" v-show="rule_type == 'edit'" :loading="rule_loading2" @click="edit_submit_rule('rules_detail_form')">确定</el-button>
-				</el-form-item>
+				</div>
 			</el-form>
 		</el-dialog>
 
@@ -150,17 +151,17 @@
 				<el-col :span="12">
 					<div class="text-center">
 						<p>1、下载规则模版,填写好规则</p>
-						<p><img src="../assets/image/rules_mould.png" alt="" /></p>
+						<p><img src="@/assets/image/rules_mould.png" alt="" /></p>
 						<p>规则表</p>
 						<p>
-							<a target="_blank" :href="'/api/download/rule_item'"><el-button type="primary">下载模板</el-button></a>
+							<a target="_blank" :href="downloadUrl"><el-button type="primary">下载模板</el-button></a>
 						</p>
 					</div>
 				</el-col>
 				<el-col :span="12">
 					<div class="text-center">
 						<p>2、上传填好的规则表</p>
-						<p><img src="../assets/image/rules_mould1.png" alt="" /></p>
+						<p><img src="@/assets/image/rules_mould1.png" alt="" /></p>
 						<p>仅支持xls、xlsx格式文件</p>
 						<el-upload
 							class="upload-demo"
@@ -168,7 +169,7 @@
 							:data="{ type: 'rule_item' }"
 							ref="upload"
 							:limit="1"
-							action="https://ding.insys.g107.com/api/upload/excel"
+							:action="action"
 							:on-preview="handlePreview"
 							:on-remove="handleRemove"
 							:on-success="handleSuccess"
@@ -190,6 +191,8 @@ import noData from '@/components/noData';
 export default {
 	data() {
 		return {
+			action:process.env.VUE_APP_BASE_API+'/api/upload/excel',
+			downloadUrl:process.env.VUE_APP_BASE_API+'/api/download/rule_item',
 			ATOKEN: { 'A-TOKEN': this.$getToken() },
 			tips_show: true,
 			rule_loading: false,
@@ -544,7 +547,9 @@ export default {
 							}
 						}).finally(() => {
 							this.delRule_loading = false;
-						});
+					});
+			},(err)=>{
+				this.delRule_loading = false;
 			});
 		},
 		//关闭规则弹窗
@@ -683,7 +688,7 @@ export default {
 		getData(is) {
 			this.rule_loading = true;
 			var that = this;
-			this.$axios('get','api/integral/rule/trees', {cycle_type: 1}).then(res => {
+			this.$axios('get','/api/integral/rule/trees', {cycle_type: 1}).then(res => {
 				var item_list = res.data.data.item_list || [];
 				var list = [];
 				for (let i in item_list) {

+ 157 - 260
src/views/voluntarilyPoint.vue → src/views/set/voluntarilyPoint.vue

@@ -6,34 +6,31 @@
 		<div class="all">
 			<div class="flex-box">
 				<div class="terr-left">
-					<div><el-button size="medium" @click="add_grouping()" plain>新增加分组</el-button></div>
-					<div><el-button size="medium" @click="add_rules_detail" plain>新增加分项</el-button></div>
+					<div><el-button size="medium" @click="add_grouping()"   type="primary">新增加分组</el-button></div>
+					<div><el-button size="medium" @click="add_rules_detail"   type="primary">新增加分项</el-button></div>
 
 					<!-- 循环分组 -->
 					<el-col :span="24" style="padding-right: 0;" v-loading="rule_trees_load">
 						<el-menu :default-active='default_active' class="rule_name" :unique-opened="true">
-							<el-submenu :index="index.toString()" v-for="(item, index) in rule_list" :key="index" >
+							<el-submenu :index="index.toString()" v-for="(item, index) in rule_list">
 								<template slot="title">
 									<div style="width: 80%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; height: 47px;line-height: 47px;" >
 										<i class="el-icon-edit-outline title_top" @click.stop="edit_grouping(item)"></i>
 										<span class="title_top">{{ item.name }}</span>
 									</div>
 								</template>
-								<span :index="i.toString()" v-for="(d, i) in item_list" :key="i" v-show="d[0].rule_id == item.id">
-									<el-menu-item :index="i1.toString()" v-for="(data, i1) in d" :key="i1" @click="open_right(data)" style="height: 47px;line-height: 47px;">
+								<el-menu-item  :index="returnIndex(index,index2)" v-for="(data, index2) in item.child" @click="open_rights(data)" style="height: 47px;line-height: 47px;">
 										<div style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">
 											<span slot="title">{{ data.remark }}</span>
 										</div>
-									</el-menu-item>
-								</span>
-								<!-- <el-menu-item :index="i.toString()" v-for="(data,i) in item.data" :key="i" @click="open_right(data)" >{{data.name}}</el-menu-item> -->
+								</el-menu-item>
 							</el-submenu>
 						</el-menu>
 					</el-col>
 				</div>
 
 				<div class="terr-right border-right flex-1" v-loading="table_loading">
-					<el-col :span="24" v-show="rule_list.length == 0 || item_list.length == 0 || diyige == true"  style="text-align: center;margin: 0 auto;position: relative;top: 30%;">
+					<el-col :span="24" v-show="rule_list.length == 0 || isShowAdd"  style="text-align: center;margin: 0 auto;position: relative;top: 30%;">
 						<p><img src="@/assets/image/nodata_default.png" width="200px" alt="" /></p>
 						<p style="color: #909399;">
 							还没有<span v-if="rule_list.length == 0">加分组和</span>加分项
@@ -46,26 +43,20 @@
 							<span style="color: #26A2FF;cursor:pointer" @click="add_rules_detail">【新增加分项】</span>
 						</p>
 					</el-col>
-					<el-col v-if="item_list.length != 0 && diyige == false" >
+					
+					<el-col v-if="!isShowAdd&&right_rules_detail.remark">
 						<el-row>
 							<el-col :span="24" style="font-size:20px;color:#303133;line-height:36px;">
 								{{ right_rules_detail.remark }}
 								<span style="padding-left: 10px;">{{ right_rules_detail.min_point }}B分</span>
-								<el-button plain style="padding:10px 12px; margin-left: 10px;" @click="edit_rules(item_info)">编辑</el-button>
+								<el-button plain style="padding:10px 12px; margin-left: 10px;" @click="edit_rules()">编辑</el-button>
 							</el-col>
 						</el-row>
 						<div class="flex-box btns flex-v-ce">
 							<el-button size="small" @click="del_item" type="danger" plain>批量移除</el-button>
-							<el-button size="small" type="primary" @click="add_employee_show_TJ">添加人员</el-button>
+							<el-button size="small" type="primary" @click="add_employee_show=true">添加人员</el-button>
 						</div>
-						<el-table
-							ref="multipleTable"
-							:data="table_list"
-							v-loading="table_loading"
-							tooltip-effect="dark"
-							style="width: 100%;margin-top:20px;"
-							@selection-change="handleSelectionChange"
-						>
+						<el-table  ref="multipleTable"	:data="table_list"	tooltip-effect="dark"  style="width: 100%;margin-top:20px;"  @selection-change="handleSelectionChange">
 							<el-table-column type="selection" width="45"></el-table-column>
 							<el-table-column label="姓名">
 								<template slot-scope="scope">
@@ -124,15 +115,15 @@
 			<!-- 新增加分项 -->
 			<el-dialog :title="rules_detail_title ? '编辑加分项' : '新增加分项'" :visible.sync="dialogFormVisible" width="500px">
 				<el-form :model="rules_detail_form" ref="rules_detail_form" :rules="rules_rules" label-width="120px">
-					<el-form-item label="加分项名称" :label-width="formLabelWidth" prop="remark" :rules="[{ required: true, message: '请输入加分项名称' }]">
+					<el-form-item label="加分项名称" :label-width="formLabelWidth" prop="remark">
 						<el-input v-model="rules_detail_form.remark" placeholder="请输入加分项名称" autocomplete="off"></el-input>
 					</el-form-item>
-					<el-form-item label="加分组" :label-width="formLabelWidth" prop="rule_id" :rules="[{ required: true, message: '请选择加分组' }]">
+					<el-form-item label="加分组" :label-width="formLabelWidth" prop="rule_id">
 						<el-select v-model="rules_detail_form.rule_id" style="width: 100%;" placeholder="请选择加分组">
 							<el-option v-for="item in rule_list" :key="item.value" :label="item.name" :value="item.id"></el-option>
 						</el-select>
 					</el-form-item>
-					<el-form-item label="B分" prop="min_point" :rules="[{ required: true, message: '请输入B分分值' }]">
+					<el-form-item label="B分" prop="min_point">
 						<el-input
 							v-model="rules_detail_form.min_point"
 							placeholder="请输入B分分值"
@@ -149,7 +140,7 @@
 						<el-button v-if="rules_detail_title" class="fr" type="primary" @click="editRule('rules_detail_form')" style="float:right" :disabled="disabled">
 							确 定
 						</el-button>
-						<el-button v-else class="fr" type="primary" @click="next('rules_detail_form')" style="float:right" :disabled="disabled">确 定</el-button>
+						<el-button v-else class="fr" type="primary" @click="editRule('rules_detail_form')" style="float:right" :disabled="disabled">确 定</el-button>
 						<el-button class="fr" @click="rules_detail_close('rules_detail_form')" style="float:right">取 消</el-button>
 					</div>
 				</el-form>
@@ -163,13 +154,13 @@
 						</el-select>
 					</el-form-item>
 					<div v-loading="staff_loading">
-						<EmployeeSelector1
+						<EmployeeSelector
+							v-if="add_employee_show"
 							:max="add_employee_max"
 							:can_select_dept="false"
-							:visible.sync="add_employee_visible"
 							@confirm="add_employee_confirm"
 							ref="Employee"
-						></EmployeeSelector1>
+						></EmployeeSelector>
 					</div>
 					<el-form-item style="text-align: right; margin-bottom: 0;margin-top: 20px;">
 						<el-button @click="add_employee_close()">取消</el-button>
@@ -182,21 +173,15 @@
 </template>
 
 <script>
-import EmployeeSelector1 from '@/components/EmployeeSelector';
+import EmployeeSelector from '@/components/EmployeeSelector';
 import noData from '@/components/noData';
 export default {
 	data() {
 		return {
 			pd_tianjia:false,
-			dianji:{},
-			openeds:['1'],
-			default_active:'',
-			diyige:false,
-			// grouping_Json:[],
-			jieguoId: '',
+			default_active:'0-0',
 			table_list: [],
 			tips_show: false,
-			item_info: {},
 			rule_trees_load: false,
 			dialogVisible: false,
 
@@ -209,7 +194,8 @@ export default {
 			add_employee_form: {
 				employee_ids: []
 			},
-
+			
+			isShowAdd:false,
 			del_arr: {
 				ids: []
 			},
@@ -248,7 +234,7 @@ export default {
 			rules_detail_form: {
 				rule_id: '',
 				range_type: '1',
-				prize_type: '0',
+				prize_type: '1',
 				min_point: '',
 				remark: '',
 				is_attendance: '0',
@@ -300,17 +286,21 @@ export default {
 			]
 		};
 	},
+	watch:{
+		// add_employee_show(val){
+		// 	this.add_employee_visible=val;
+		// },
+	},
+	// computed:{
+	// 	returnIndex(str,str2){
+	// 		console.log(str);
+	// 		return str+"-"+str2;
+	// 	}
+	// },
 	components: {
-		EmployeeSelector1,
+		EmployeeSelector,
 		noData
 	},
-	watch:{
-		// right_rules_detail(newVal, oldVal){
-		// 	console.log(this.default_active)
-		// 	this.default_active = '0'
-        //     console.log(newVal, oldVal)
-		// }
-	},
 	created() {},
 	mounted() {
 		if (localStorage.getItem('voluntarilyPoint')) {
@@ -318,13 +308,20 @@ export default {
 		} else {
 			this.tips_show = true;
 		}
-		this.get_role_lists();
+		this.get_role_lists(true);
 	},
 	methods: {
+		returnIndex(str,str2){
+			return str+"-"+str2;
+		},
 		handleCurrentChange(val) {
 			this.page = val;
 			this.open_right();
 		},
+		open_rights(data){
+			this.page=1;
+			this.open_right(data);
+		},
 		// 组建
 		add_employee_confirm(val) {
 			this.add_employee_form.employee_ids = [];
@@ -339,15 +336,7 @@ export default {
 		add_employee_close() {
 			this.add_employee_show = false;
 		},
-		// 点击添加人员
-		add_employee_show_TJ() {
-			this.add_employee_show = true; //弹出添加人员框
-			var params = {
-					item_id: this.add_employee_id || '',
-					employee_id: this.employee_id || ''
-			};
-			this.$axios('get','/api/integral/auto/list', params).then(res => {});
-		},
+		
 		// 添加成员点击完成
 		sub_add_employee(form) {
 			let self = this;
@@ -374,42 +363,17 @@ export default {
 						this.disabled = true;
 						self.staff_loading = true;
 						self.$axios('post','/api/integral/auto/add',data).then(res => {
-								this.disabled = false;
-								self.table_loading = false;
-								self.staff_loading = false;
 								if (res.data.code == 1) {
-									// 不需要了
-									// sessionStorage.setItem('task_cycle_name', (self.task_cycle_name))//存入用户上次请求成功的加分周期。
-									self.add_employee_show = false;
 									self.$message.success('此次操作成功' + res.data.data.success + '条,失败' + res.data.data.error + '条,已经存在的' + res.data.data.exist + '条');
-									// self.err_open_right();
-
-									// self.open_right();
-									
-									self.get_role_lists();
-									if(this.pd_tianjia == true){
-										let user_FH = JSON.parse(localStorage.getItem("user_FH"))
-											for (const key in user_FH) {
-												for (let i = 0; i < user_FH[key].length; i++) {
-													if (i == 0) {
-														this.default_active = '0'
-														this.open_right(user_FH[key][i]);
-														setTimeout(()=>{
-															this.default_active = ''
-															this.pd_tianjia = false
-														},500)
-														return false
-													}
-												}
-											}
-										}
-
+									self.open_right();
 								} else {
 									self.$message.error(res.data.msg);
 								}
 							})
 							.finally(() => {
-								self.loading = false;
+								self.add_employee_show = false;
+								self.staff_loading = false;
+								this.disabled = false;
 							});
 					}
 				} else {
@@ -417,8 +381,6 @@ export default {
 				}
 			});
 		},
-
-		editDetails() {},
 		handleSelectionChange(val) {
 			this.del_arr.ids = [];
 			val.forEach(element => {
@@ -426,7 +388,6 @@ export default {
 			});
 			this.val_page = val;
 		},
-		add_item() {},
 		// 批量删除
 		del_item() {
 			let self = this;
@@ -446,7 +407,7 @@ export default {
 										this.page = this.page - 1;
 									}
 								}
-								self.get_role_lists();	
+								self.open_right();	
 							} else {
 								self.$message.error(res.data.msg);
 							}
@@ -464,12 +425,22 @@ export default {
 			localStorage.setItem('voluntarilyPoint', 'true');
 			this.tips_show = false;
 		},
-		//新增规则
+		//新增加分项
 		add_rules_detail() {
+			this.rules_detail_form={
+				rule_id: '',
+				range_type: '1',
+				prize_type: '1',
+				min_point: '',
+				remark: '',
+				is_attendance: '0',
+				cycle_type: '2',
+				pt_id: '3'
+			}
 			this.dialogFormVisible = true;
 			this.rules_detail_title = false;
 		},
-
+		//编辑加分项
 		editRule(form) {
 			let self = this;
 			let data = null;
@@ -485,102 +456,41 @@ export default {
 			self.$refs[form].validate(valid => {
 				if (valid) {
 					this.disabled = true;
-					if (this.is_attendance) {
-						self.rules_detail_form.is_attendance = 1;
-					} else {
-						self.rules_detail_form.is_attendance = 0;
-					}
-					var url=this.rules_detail_title ? 'api/integral/rule/items/edit' : '/api/integral/rule/items';
-					self.$axios('post',url,data).then(res => {
-							this.disabled = false;
-							this.dialogFormVisible = false;
-							setTimeout(() => {
-								this.is_attendance = false;
-							}, 300);
-							if (res.data.code == 1) {
-								self.$message.success(res.data.msg);
-								self.rules_detail_show = false;
-								self.jieguoId = res.data.data.item_id;
-								self.add_rulse_id = self.rules_detail_form.rule_id;
-								self.get_role_lists();
-								if (this.rules_detail_title == false) {
-									setTimeout(() => {
-										self.add_employee_show = true;
-									}, 600);
-								}
-							} else {
-								this.disabled = false;
-								this.dialogFormVisible = false;
-								self.$message.error(res.data.msg);
-							}
-						})
-						.catch(e => {
-							this.disabled = false;
-							this.dialogFormVisible = false;
-						})
-						.finally(() => {
-							self.loading = false;
-						});
-				} else {
-					return false;
-				}
-			});
-		},
-		// 点击确定提交积分规则
-		next(form) {
-			let self = this;
-			let data = null;
-			self.rules_detail_form.max_point = self.rules_detail_form.min_point;
-			if (this.rules_detail_title == false) {
-				data = {
-					items: [self.rules_detail_form]
-				};
-			} else {
-				self.rules_detail_form.item_id = self.rules_detail_form.id;
-				data = self.rules_detail_form;
-			}
-			self.$refs[form].validate(valid => {
-				if (valid) {
-					this.disabled = true;
-					if (this.is_attendance) {
-						self.rules_detail_form.is_attendance = 1;
-					} else {
-						self.rules_detail_form.is_attendance = 0;
-					}
+					// if (this.is_attendance) {
+					// 	self.rules_detail_form.is_attendance = 1;
+					// } else {
+					// 	self.rules_detail_form.is_attendance = 0;
+					// }
 					var url=this.rules_detail_title ? 'api/integral/rule/items/edit' : '/api/integral/rule/items';
 					self.$axios('post',url,data).then(res => {
-							this.disabled = false;
-							this.dialogFormVisible = false;
-							setTimeout(() => {
-								this.is_attendance = false;
-							}, 300);
+							// setTimeout(() => {
+							// 	this.is_attendance = false;
+							// }, 300);
 							if (res.data.code == 1) {
 								self.$message.success(res.data.msg);
 								self.rules_detail_show = false;
-								// self.jieguoId = res.data.data.item_id;
-								self.add_employee_id = res.data.data.item_id;
-								self.add_rulse_id = self.rules_detail_form.rule_id;
-								// this.get_role_lists()
-								if (this.rules_detail_title == false) {
+								if (this.rules_detail_title) {//当为编辑时
+									 if(self.rules_detail_form.rule_id!=self.right_rules_detail.rule_id){//当编辑规则修改了上级时
+										self.get_role_lists(true);
+									 }else{//正常编辑
+										 self.get_role_lists();
+										 self.right_rules_detail.remark=data.remark;
+										 self.right_rules_detail.min_point=data.min_point;
+									 }	 
+								}else{//当为添加时
+									self.add_employee_id = res.data.data.item_id;//规则ID
+									self.add_rulse_id = self.rules_detail_form.rule_id;//分类ID
+									self.get_role_lists(true,true);
 									setTimeout(() => {
 										self.add_employee_show = true;
 									}, 600);
 								}
 							} else {
-								this.disabled = false;
-								this.dialogFormVisible = false;
 								self.$message.error(res.data.msg);
 							}
-						})
-						.catch(e => {
-							this.disabled = false;
+						}).finally(() => {
 							this.dialogFormVisible = false;
-						})
-						.finally(() => {
-							self.loading = false;
-							setTimeout(() => {
-								this.pd_tianjia = true
-							}, 600);
+							self.disabled = false;
 						});
 				} else {
 					return false;
@@ -593,15 +503,21 @@ export default {
 			this.rules_detail_show = false;
 			this.$refs[form].resetFields();
 		},
-		open_right(data) {
-			this.dianji = data
-			this.diyige = false
+		//获取右边表格数据
+		open_right(data,updata) {
 			let self = this;
 			self.table_loading = true;
-			if (data) {
+			this.isShowAdd=false;
+			if (data&&!updata) {
 				self.add_employee_id = data.id;
 				self.add_rulse_id = data.rule_id;
-				self.right_rules_detail = data;
+				self.right_rules_detail = data;	
+				
+			}else if(updata){
+				self.right_rules_detail = data;	
+			}else{
+				self.add_employee_id = self.right_rules_detail.id;
+				self.add_rulse_id = self.right_rules_detail.rule_id;
 			}
 			var params = {
 					item_id: self.add_employee_id || '',
@@ -613,26 +529,20 @@ export default {
 					if (res.data.code == 1) {
 						self.table_list = res.data.data.list || [];
 						self.total = res.data.data.total;
-						this.rule_trees_load = false;
-						this.table_loading = false;
 					} else {
 						self.$message.error(res.data.msg);
 					}
-				})
-				.finally(() => {
-					setTimeout(()=>{
-						self.table_loading = false;
-					},500)
-				});
+			}).finally(() => {
+				self.table_loading = false;
+			});
 		},
 
-		//   编辑规则
-		edit_rules(data) {
+		//  编辑规则
+		edit_rules() {
 			this.rules_detail_title = true;
 			this.dialogFormVisible = true;
-			this.rules_detail_title = true;
 			this.rules_detail_form = JSON.parse(JSON.stringify(this.right_rules_detail));
-			this.is_attendance = this.rules_detail_form.is_attendance == '0' ? false : true;
+			// this.is_attendance = this.rules_detail_form.is_attendance == '0' ? false : true;
 		},
 		// 删除规则
 		del_rules_detail(item) {
@@ -643,31 +553,26 @@ export default {
 			}).then(() => {
 				this.disabled = true;
 				this.$axios('post','/api/integral/rule/items/destroy',{item_id: item.id}).then(res => {
-						this.dialogFormVisible = false;
-						this.disabled = false;
 						if (res.data.code == 1) {
 							this.$message.success(res.data.msg);
 							this.rules_detail_show = false;
-							this.get_role_lists('a');
+							this.get_role_lists(true);
 						} else {
-							this.dialogFormVisible = false;
-							this.disabled = false;
 							this.$message.error(res.data.msg);
 							this.get_role_lists();
 						}
-					})
-					.catch(err => {
-						this.dialogFormVisible = false;
-						this.disabled = false;
-					})
-					.finally(() => {
-							this.loading = false;
+					}).finally(() => {
+							this.dialogFormVisible = false;
+							this.disabled = false;
 					});
 			});
 		},
 
 		//新增加分组展示不同渲染
 		add_grouping() {
+			this.numberValidateForm={
+				name:''
+			}
 			this.dialogVisible = true;
 			this.grouping_type = false;
 		},
@@ -687,19 +592,13 @@ export default {
 								name: this.numberValidateForm.name
 						  };
 					this.disabled = true;
-					var url=this.grouping_type ? 'api/integral/rule/edit' : '/api/integral/rule';
+					var url=this.grouping_type ? '/api/integral/rule/edit' : '/api/integral/rule';
 					this.$axios('post',url,data).then(res => {
-							this.dialogVisible = false;
-							this.disabled = false;
 							if (res.data.code == '1') {
 								this.get_role_lists();
 								this.$message.success(this.grouping_type ? '修改积分规则' : res.data.msg);
-							} else {
-								this.dialogVisible = false;
-								this.disabled = false;
 							}
-						})
-						.catch(err => {
+						}).finally(() => {
 							this.dialogVisible = false;
 							this.disabled = false;
 						});
@@ -723,7 +622,7 @@ export default {
 				type: 'warning'
 			}).then(() => {
 				this.disabled = true;
-				this.$axios('post','api/integral/rule/destroy',{rule_id: item.id}).then(res => {
+				this.$axios('post','/api/integral/rule/destroy',{rule_id: item.id}).then(res => {
 						this.dialogVisible = false;
 						this.disabled = false;
 						if (res.data.code == 1) {
@@ -740,41 +639,39 @@ export default {
 					}, 300);
 				});
 		},
-		// 获取分组
-		get_role_lists(index) {
+		// 获取初始化数据
+		get_role_lists(is,noUpdata) {
 			this.table_loading = true;
 			this.rule_trees_load = true;
-			// this.openeds = ['0'];//修改后  修改高亮选中项
 			this.$axios('get','/api/integral/rule/trees', {cycle_type: '2'}).then(res => {
-				 	localStorage.setItem("user_FH",JSON.stringify(res.data.data.item_list));
-					this.is_attendance = this.rules_detail_form.is_attendance == '0' ? false : true;
-					this.rule_list = res.data.data.rule_tree;
-					this.item_list = res.data.data.item_list;
-					this.rule_trees_load = false;
-					if (this.item_list !== null) {
-						for(let i in this.item_list){
-								for(let a in this.item_list[i]){
-									if(index == 'a'){
-										for (const key in this.item_list) {
-											for (let arr = 0; arr < this.item_list[key].length; arr++) {
-												if (arr == 0) {
-													this.default_active = '0'
-													this.open_right(this.item_list[key][arr]);
-													setTimeout(()=>{
-														this.default_active = ''
-													},500)
-													return false;
-												}
-											}
-										}
-									}else{
-										if(this.dianji.id == this.item_list[i][a].id){
-											this.open_right(this.item_list[i][a]);
-											return false;
-										}
-									}
-								}
-							}
+					// this.is_attendance = this.rules_detail_form.is_attendance == '0' ? false : true;
+					var	rule_list = res.data.data.rule_tree;
+					var	item_list = res.data.data.item_list;
+					var itemListAll=[];
+					for (let i in item_list) {
+					  for (let k in item_list[i]) {
+						itemListAll.push(item_list[i][k])
+					  }
+					}
+					rule_list.map(item=>{
+						item.child=itemListAll.filter((item2)=>{return item2.rule_id==item.id});
+					})
+					this.rule_list=rule_list;
+					this.item_list=itemListAll;
+					if(is){
+						this.default_active="";
+						if(rule_list[0].child[0]){
+							this.right_rules_detail={};
+							this.table_list=[];
+							this.page=1;
+							this.open_right(rule_list[0].child[0],noUpdata);
+							setTimeout(()=>{
+								this.default_active = '0-0'
+							},500)
+						}else{
+							this.right_rules_detail={};
+							this.isShowAdd=true;
+						}
 					}
 			}).finally(err=>{
 				setTimeout(()=>{
@@ -802,24 +699,24 @@ export default {
 				color: #909399 !important;
 			}
 		}
-		li:hover .el-submenu__title {
-			background: #e7f6ff;
-		}
-		ul {
-			li.is-active {
-				background-color: #e7f6ff !important;
-			}
-		}
-	}
-	::v-deep .is-opened .el-submenu__title .title_top {
-		color: #409eff !important;
-	}
-	::v-deep .is-opened .el-menu .el-menu-item span {
-		color: #333;
-	}
-	::v-deep .is-opened .el-menu .is-active span {
-		color: #409eff;
+		// li:hover .el-submenu__title {
+		// 	background: #e7f6ff;
+		// }
+		// ul {
+		// 	li.is-active {
+		// 		background-color: #e7f6ff !important;
+		// 	}
+		// }
 	}
+	// ::v-deep .is-opened .el-submenu__title .title_top {
+	// 	color: #409eff !important;
+	// }
+	// ::v-deep .is-opened .el-menu .el-menu-item span {
+	// 	color: #333;
+	// }
+	// ::v-deep .is-opened .el-menu .is-active span {
+	// 	color: #409eff;
+	// }
 }
 ::v-deep .el-submenu__title {
     height: 47px !important;

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác