custom_rank.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908
  1. <template>
  2. <div class="all-box">
  3. <div class="all">
  4. <div class="flex-box">
  5. <div class="terr-left">
  6. <el-button size="medium" @click="addGroup" type="primary">新建分组</el-button>
  7. <el-menu default-active="0" class="el-menu-vertical-demo" style="border: none" v-if="groups_list.length>0" v-loading="groups_loading">
  8. <el-menu-item
  9. style="height: 47px;line-height: 47px;"
  10. :index="index.toString()"
  11. class="font-flex-word"
  12. v-for="(item, index) in groups_list"
  13. :key="index"
  14. @click="open_right(item)"
  15. v-show="item.code !== 'employee'"
  16. >
  17. <i class="el-icon-document-copy"></i>
  18. <span slot="title">{{ item.name }}</span>
  19. </el-menu-item>
  20. </el-menu>
  21. <div v-else style="text-align: center;margin-top: 10%;" class="fontColorF">
  22. <img src="@/assets/image/nodata.png" style="width: 180px;height: 120px;margin: 30px auto;">
  23. 还没有自定义分组
  24. </div>
  25. </div>
  26. <div class="terr-right border-right flex-1">
  27. <div class="listData" v-loading="table_loading" v-if="table_list.length > 0">
  28. <div class="flex-box">
  29. <div class="flex-box flex-v-ce margin-bottom">
  30. <div class="groupsName">{{groups_info.name}}<span class="blue">({{groups_info.employees.length}}人)</span></div>
  31. <el-button @click="editGroup" size="medium">编辑</el-button>
  32. </div>
  33. </div>
  34. <!-- form -->
  35. <el-form :model="params" :inline="true" ref="params">
  36. <el-form-item label="时间" label-width="40px">
  37. <el-date-picker v-model="params.month" size="medium" type="month" placeholder="请选择月份" value-format="yyyy-MM"></el-date-picker>
  38. </el-form-item>
  39. <el-form-item>
  40. <el-checkbox v-model="sort" size="medium" label="由低到高" border></el-checkbox>
  41. </el-form-item>
  42. </el-form>
  43. <!-- 表格 -->
  44. <el-table :data="table_list" style="width: 100%" >
  45. <el-table-column label="名次" width="80" align="center">
  46. <template slot-scope="scope">
  47. <img v-if="scope.row.rank === 1" src="@/assets/image/statistics_NO1.png" alt="" />
  48. <img v-if="scope.row.rank === 2" src="@/assets/image/statistics_NO2.png" alt="" />
  49. <img v-if="scope.row.rank === 3" src="@/assets/image/statistics_NO3.png" alt="" />
  50. <span v-if="scope.row.rank > 3">{{ scope.row.rank }}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="姓名" align="left">
  54. <template slot-scope="scope">
  55. <div class="flex-box">
  56. <userImage class="fl" :user_name="scope.row.employee_name" :img_url="scope.row.employee_img_url" width="50px" height="50px"></userImage>
  57. <span style="line-height: 50px; padding-left: 10px;">{{ scope.row.employee_name }}</span>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="B分" align="left" prop="point"></el-table-column>
  62. <template slot="empty">
  63. <noData></noData>
  64. </template>
  65. </el-table>
  66. <center style="padding: 20px 0;">
  67. <el-pagination
  68. background
  69. @size-change="handleSizeChange"
  70. @current-change="handleCurrentChange"
  71. :page-sizes="[10, 20, 30, 40, 50, 100]"
  72. layout="total, sizes, prev, pager, next"
  73. :page-size="page_size"
  74. :current-page="page"
  75. :total="total">
  76. </el-pagination>
  77. </center>
  78. </div>
  79. <div v-else style="margin-top: 10%;">
  80. <noData :isSolt="true">
  81. <template v-slot:default>
  82. <div style="text-align: center;">还没有分组,<span style="color:#26A2FF;cursor:pointer" @click="addGroup">去添加 >></span></div>
  83. </template>
  84. </noData>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 新增分组 -->
  90. <el-dialog :title="popupType? '新增分组':'编辑分组'" width="660px" top="5%" :visible.sync="groupShow" :close-on-click-modal="false">
  91. <el-form ref="newGroupForm" :model="newGroupForm" :rules="rules" label-width="85px" @submit.native.prevent>
  92. <el-form-item label="分组名称" prop="group_name">
  93. <el-input v-model="newGroupForm.group_name" placeholder="请输入分组名称" auto-complete="off"></el-input>
  94. </el-form-item>
  95. <div>
  96. <EmployeeSelector
  97. v-if="groupShow"
  98. ref="Employee"
  99. :user_no_select="false"
  100. :can_select_dept="true"
  101. :selected="employees_selected"
  102. :close_clear_data="true"
  103. @confirm="move_employee_confirm"/>
  104. </div>
  105. <!-- <el-form-item label="分组成员">
  106. <el-input auto-complete="off" v-model="employeeNames" placeholder="全部成员"></el-input>
  107. <div @click="isEmployeeShow=true" style="height:36px; position: absolute; top: 0; right: 0; left: 0; bottom: 0; z-index: 9;cursor:pointer"></div>
  108. <el-dialog title="选择人员" width="800px" :visible.sync="isEmployeeShow" @close="closeNone" append-to-body :before-close="handleClose">
  109. <EmployeeSelector
  110. v-if="isEmployeeShow"
  111. ref="Employee"
  112. :user_no_select="false"
  113. :can_select_dept="true"
  114. :selected="employees_selected"
  115. :close_clear_data="true"
  116. @confirm="move_employee_confirm"/>
  117. <span slot="footer" class="dialog-footer">
  118. <el-button @click="isEmployeeShow = false">取 消</el-button>
  119. <el-button type="primary" @click="submitEmployee()">确 定</el-button>
  120. </span>
  121. </el-dialog>
  122. </el-form-item>
  123. <el-form-item label="积分规则">
  124. <el-input auto-complete="off" v-model="newGroupFormRules" placeholder="全部规则分类"></el-input>
  125. <div @click="ruleDialogTableVisibles" style="height:36px; position: absolute; top: 0; right: 0; left: 0; bottom: 0; z-index: 9;cursor:pointer"></div>
  126. <div style="margin-bottom:12px;">
  127. <span style="font-size:13px;color:rgb(138 138 138);position: absolute; top: 30px; left: 0;">{{ruleHint}}</span>
  128. </div>
  129. <el-dialog title="选择规则" width="800px" :visible.sync="ruleDialogTableVisible" @close="closeNone" append-to-body :before-close="handleClose">
  130. <div style="display:flex;position: relative;width:100%;height:40px">
  131. <span style="position: absolute;line-height:40px;left:20px">已选:{{ valuesOrLength.length }}条</span>
  132. <el-input type="text" class="search" style="position: absolute;right:20px;width:20%" placeholder="输入关键字搜索" v-model.trim="keyword" />
  133. </div>
  134. <el-row class="architecture">
  135. <el-col :span="8" class="RuleLeft" style="height:500px">
  136. <div class="rule_class_box">
  137. <el-tree
  138. ref="menum"
  139. class="cate-tree"
  140. node-key="id"
  141. :accordion="true"
  142. :highlight-current="true"
  143. :data="rule_trees"
  144. :default-expand-all="false"
  145. :props="defaultProps"
  146. :expand-on-click-node="false"
  147. @node-click="handleNodeClick"
  148. >
  149. <div content="tree" v-if="!data.dis" v-show="rule_trees.length != 0" slot-scope="{ node, data }">
  150. <span class="name">{{ data.name }}</span>
  151. </div>
  152. </el-tree>
  153. </div>
  154. </el-col>
  155. <el-col :span="16" class="RuleRight" v-loading="tableLoadingRule" style="height:500px;overflow-y:auto">
  156. <el-table
  157. ref="multipleTable"
  158. :data="tableData_rule"
  159. tooltip-effect="dark"
  160. style="width: 100%;cursor:pointer"
  161. @select="onTableSelect"
  162. @select-all="selectAll"
  163. @cell-click="clicktable"
  164. >
  165. <el-table-column type="selection" width="55"></el-table-column>
  166. <el-table-column prop="remark" :label="'全选'" show-overflow-tooltip></el-table-column>
  167. </el-table>
  168. </el-col>
  169. </el-row>
  170. <span slot="footer" class="dialog-footer">
  171. <el-button @click="ruleDialogTableVisible = false">取 消</el-button>
  172. <el-button type="primary" @click="ruleDialogTableVisibleQD">确 定</el-button>
  173. </span>
  174. </el-dialog>
  175. </el-form-item>
  176. <el-form-item label="统计周期" label-width="85px" prop="date_interval" :show-message="false">
  177. <el-select v-model="newGroupForm.date_interval" placeholder="请选择周期">
  178. <el-option v-for="item in options_time" :key="item.value" :label="item.label" :value="item.value"></el-option>
  179. </el-select>
  180. </el-form-item> -->
  181. </el-form>
  182. <div class="flex-box flex-v-ce">
  183. <el-button type="danger" v-if="!popupType" :loading="delLoad" @click="delItem">删除</el-button>
  184. <div class="flex-1"></div>
  185. <el-button @click="resetForm('newGroupForm')">取 消</el-button>
  186. <el-button type="primary" :loading="saveLoad" @click="subGroupForm('newGroupForm')">确 定</el-button>
  187. </div>
  188. </el-dialog>
  189. </div>
  190. </template>
  191. <script>
  192. import EmployeeSelector from '@/components/EmployeeSelector.vue';
  193. import noData from '@/components/noData';
  194. import moment from 'moment'
  195. var selecteds = [];
  196. let selectionID = [];
  197. export default {
  198. components: { EmployeeSelector, noData },
  199. data() {
  200. return {
  201. page: 1,
  202. page_size: 10,
  203. total: null,
  204. tips_show:false,
  205. groups_list:[],
  206. groups_loading:false,
  207. table_loading:false,
  208. table_list:[],
  209. groups_info: {
  210. name:'',
  211. employees: []
  212. },
  213. //
  214. params:{
  215. group_id: '',
  216. month: moment().format('YYYY-MM'),
  217. sort: 'DESC',
  218. rule_id: '',
  219. },
  220. rule_trees: [],
  221. groupShow: false,
  222. rules: {
  223. group_name: [{ required: true, message: '请输入分组名称', trigger: 'blur' },{ min: 2, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }],
  224. date_interval: [{ required: true, message: '请选择周期', trigger: 'change' }],
  225. },
  226. newGroupForm:{
  227. group_name: "",
  228. employees: [],
  229. items:[],
  230. date_interval:'1',
  231. },
  232. saveLoad: false,
  233. delLoad: false,
  234. show_employee_selector: false,
  235. employee_not_select: [],
  236. employees_selected: {employee:[], dept: []},
  237. props:{checkStrictly: true,value: 'id', label: 'name',children:'child'},
  238. sort: false,
  239. popupType: false,
  240. // 添加分组(第二期内容添加)
  241. ruleDialogTableVisible:false,
  242. defaultProps: {
  243. children: 'child',
  244. label: 'name'
  245. },
  246. tableLoadingRule:false,
  247. tableData_rule: [],
  248. options_time_value: '',
  249. options_time: [
  250. {
  251. value: '1',
  252. label: '月度'
  253. },
  254. {
  255. value: '2',
  256. label: '季度'
  257. },
  258. {
  259. value: '3',
  260. label: '年度'
  261. }
  262. ],
  263. newGroupFormRules:'',
  264. ruleHint:'统计所有积分(基础分和工龄分除外)',
  265. valuesOrLength: [],
  266. keyword:'',
  267. treedata: [],
  268. isEmployeeShow:false,
  269. employeeNames:'',
  270. };
  271. },
  272. created() {
  273. this.getRuleList();
  274. this.get_groups_list(true);
  275. },
  276. watch:{
  277. 'params.rule_id'(){
  278. this.$refs.rule.dropDownVisible = false;
  279. },
  280. 'params.month'(val,old_val){
  281. this.page = 1
  282. this.open_right()
  283. },
  284. 'sort'(val){
  285. this.page = 1
  286. val?this.params.sort = 'ASC':this.params.sort = 'DESC'
  287. this.open_right()
  288. },
  289. keyword() {
  290. //函数节流
  291. if (this.timer) {
  292. clearTimeout(this.timer);
  293. }
  294. //清空 全部
  295. if (!this.keyword) {
  296. this.tableData_rule = this.tableData_rule2;
  297. this.ifPitchOnChild(this.tableData_rule, selecteds);
  298. return;
  299. }
  300. this.timer = setTimeout(() => {
  301. const result = [];
  302. this.tableData_rule2.forEach(val => {
  303. if (val.remark.indexOf(this.keyword) > -1) {
  304. result.push(val);
  305. }
  306. });
  307. this.tableData_rule = result;
  308. this.ifPitchOnChild(this.tableData_rule, selecteds);
  309. }, 100);
  310. }
  311. },
  312. mounted() {
  313. },
  314. methods: {
  315. // 第二期内容
  316. //
  317. submitEmployee(){
  318. this.$refs.Employee.confirm();//调用组件的confirm();
  319. },
  320. //点击规则弹出窗口
  321. ruleDialogTableVisibles() {
  322. this.tableLoadingRule = true;
  323. selecteds = this.valuesOrLength;
  324. //点击弹出窗口并展示所有数据
  325. let tableData_r = [];
  326. for (let i in this.itemList) {
  327. for (let a in this.itemList[i]) {
  328. tableData_r.push(this.itemList[i][a]);
  329. }
  330. }
  331. this.tableData_rule2 = tableData_r; //赋予筛选数据
  332. this.tableData_rule = tableData_r;
  333. this.ruleDialogTableVisible = true;
  334. this.ifPitchOnChild(this.tableData_rule, selecteds);
  335. },
  336. //规则弹窗确定
  337. ruleDialogTableVisibleQD() {
  338. let valuesLengths = [];
  339. for (let i in selecteds) {
  340. valuesLengths.push(selecteds[i]);
  341. }
  342. // valuesLengths = selecteds
  343. this.valuesOrLength = valuesLengths;
  344. this.newGroupForm.items = this.valuesOrLength;
  345. if (this.valuesOrLength.length >= 1) {
  346. this.newGroupFormRules = this.valuesOrLength.length + '条规则';
  347. this.ruleHint = '统计已选规则的积分(只选分类不指定规则的积分除外)'
  348. } else {
  349. this.newGroupFormRules = '';
  350. this.ruleHint = '统计所有积分(基础分和工龄分除外)'
  351. }
  352. this.ruleDialogTableVisible = false;
  353. },
  354. //点击某行
  355. clicktable(row, column, cell, event) {
  356. let selectedsif = false;
  357. for (let i in selecteds) {
  358. if (row.id == selecteds[i]) {
  359. selectedsif = true;
  360. selecteds.splice(i, 1);
  361. this.toggleSelection([row], false);
  362. }
  363. }
  364. if (selectedsif == false) {
  365. selecteds.push(row.id);
  366. this.ifPitchOnChild(this.tableData_rule, selecteds);
  367. }
  368. },
  369. //全选
  370. selectAll(selection) {
  371. for (let i in selection) {
  372. selectionID.push(selection[i].id);
  373. }
  374. let tableData_rules = []; //当前分页id
  375. for (let i in this.tableData_rule) {
  376. tableData_rules.push(this.tableData_rule[i].id);
  377. }
  378. selectionID = [...new Set(selectionID)];
  379. if (selection.length == 0) {
  380. //全不选
  381. var diff = [];
  382. var tmp = tableData_rules;
  383. selectionID.forEach(function(val1, i) {
  384. if (tableData_rules.indexOf(val1) < 0) {
  385. diff.push(val1);
  386. } else {
  387. tmp.splice(tmp.indexOf(val1), 1);
  388. }
  389. });
  390. selectionID = diff.concat(tmp);
  391. } else {
  392. //全选
  393. console.log('true');
  394. }
  395. selecteds = [...new Set(selectionID)];
  396. this.valuesOrLength = selecteds;
  397. },
  398. onTableSelect(rows, row) {
  399. let selected = rows.length && rows.indexOf(row) !== -1;
  400. if (selected) {
  401. selecteds.push(row.id);
  402. } else {
  403. for (let i in selecteds) {
  404. if (row.id == selecteds[i]) {
  405. selecteds.splice(i, 1);
  406. }
  407. }
  408. }
  409. },
  410. //关闭回调
  411. closeNone() {
  412. selecteds = [];
  413. },
  414. //关闭
  415. handleClose(done) {
  416. done();
  417. },
  418. //此方法:拿到当前点击规则分类的所有子节点ID,(为了包含子分类 规则)
  419. menuIdInit(menus) {
  420. var _this = this;
  421. var _menu = menus;
  422. var menuId = [];
  423. var len = _menu.length;
  424. for (var i = 0; i < len; i++) {
  425. var item = _menu[i];
  426. if (item.child && item.child.length != 0) {
  427. var child = item.child;
  428. for (var j = 0; j < child.length; j++) {
  429. _menu[len + j] = child[j];
  430. }
  431. len = _menu.length;
  432. }
  433. menuId.push(item.id);
  434. }
  435. return menuId;
  436. },
  437. //点击规则分类
  438. handleNodeClick(data) {
  439. let dataArr = this.menuIdInit([data]); //调用方法
  440. this.tableLoadingRule = true;
  441. this.keyword = ''; //切换规则重置搜索框
  442. let tableData_r = [];
  443. for (let i in this.itemList) {
  444. for (let a in this.itemList[i]) {
  445. for (let x in dataArr) {
  446. if (dataArr[x] == this.itemList[i][a].rule_id) {
  447. tableData_r.push(this.itemList[i][a]);
  448. }
  449. }
  450. }
  451. }
  452. this.tableData_rule2 = tableData_r; //赋予筛选数据
  453. this.tableData_rule = tableData_r;
  454. this.ifPitchOnChild(this.tableData_rule, selecteds);
  455. },
  456. ifPitchOnChild(item, indexID) {
  457. let pitchOnChild = [];
  458. for (let i in item) {
  459. for (let a in indexID) {
  460. //判断外层的值相不相等
  461. if (indexID[a] == item[i].id) {
  462. pitchOnChild.push(item[i]);
  463. }
  464. }
  465. }
  466. this.toggleSelection(pitchOnChild, true);
  467. },
  468. //默认选中
  469. toggleSelection(rows, selected) {
  470. if (rows) {
  471. this.$nextTick(() => {
  472. rows.forEach(row => {
  473. this.$refs.multipleTable.toggleRowSelection(row, selected);
  474. });
  475. });
  476. } else {
  477. this.$refs.multipleTable.clearSelection();
  478. }
  479. setTimeout(() => {
  480. //给遮到层,让默认选中的有缓冲时间
  481. this.tableLoadingRule = false;
  482. }, 300);
  483. },
  484. // 提交表单
  485. subGroupForm(formName){
  486. this.$refs[formName].validate((valid) => {
  487. if (valid) {
  488. this.saveFun()
  489. }
  490. });
  491. },
  492. //获取分组详情
  493. getGroupDetail(func){
  494. this.$axios('get','/api/integral/statistics/groups/info', {group_id: this.groups_info.id}).then(res => {
  495. func(res.data.data.employees);
  496. })
  497. },
  498. //编辑
  499. editGroup(){
  500. this.newGroupForm.group_name=this.groups_info.name;
  501. var that=this;
  502. that.getGroupDetail(function(res){
  503. console.log(res)
  504. that.employees_selected.employee=res;
  505. that.popupType = false;
  506. that.groupShow = true;
  507. })
  508. },
  509. //添加编辑组
  510. saveFun(){
  511. this.saveLoad = true;
  512. this.$refs.Employee.confirm();
  513. var url=this.popupType? '/api/integral/statistics/groups/create':'/api/integral/statistics/groups'
  514. this.newGroupForm.group_id=this.groups_info.id;
  515. if(this.newGroupForm.employees.length==0){
  516. this.$message.error('请选择员工')
  517. this.saveLoad = false;
  518. return;
  519. }
  520. console.log(this.newGroupForm)
  521. var obj={//为编辑时
  522. name:this.newGroupForm.group_name,
  523. id:this.popupType?'':this.groups_info.id,
  524. employees:this.newGroupForm.employees,
  525. }
  526. this.$axios('post',url,this.newGroupForm).then((res) => {
  527. if (res.data.code == 1) {
  528. this.$message.success(res.data.msg);
  529. this.resetForm('newGroupForm');
  530. if(!this.popupType){//为编辑时
  531. this.groups_info=obj;
  532. }
  533. if(this.groups_list.length==0){
  534. this.get_groups_list(true)
  535. }else{
  536. this.get_groups_list()
  537. }
  538. }else{
  539. this.saveLoad = false
  540. this.$message.error(res.data.msg)
  541. }
  542. }).finally(()=>{
  543. this.saveLoad = false
  544. })
  545. },
  546. // 重置表单
  547. resetForm(formName){
  548. this.$refs[formName].resetFields()
  549. this.newGroupForm.employees = []
  550. this.employee_not_select = []
  551. this.employees_selected = {employee:[], dept: []}
  552. this.groupShow = false
  553. },
  554. // 新增分组
  555. addGroup(){
  556. this.employee_not_select = []
  557. this.employees_selected = {employee:[], dept: []}
  558. this.newGroupForm = {
  559. group_name: "",
  560. employees: []
  561. }
  562. this.groupShow = true
  563. this.popupType = true
  564. },
  565. // 删除分组
  566. delItem(){
  567. this.$confirm('确定要删除当前分组吗?, 是否继续?', '删除分组', {
  568. confirmButtonText: '确定',
  569. cancelButtonText: '取消',
  570. type: 'warning'
  571. }).then(() => {
  572. let data = {group_id:this.groups_info.id};
  573. this.delLoad = true
  574. this.$axios('post','/api/integral/statistics/groups/drop',data).then((res) => {
  575. if (res.data.code == 1) {
  576. this.$message.success(res.data.msg)
  577. this.groupShow = false
  578. this.get_groups_list(true);
  579. }else{
  580. this.$message.error(res.data.msg)
  581. }
  582. }).catch((e) => {this.$message.error(e.data.msg)}).finally(()=>{
  583. this.delLoad = false
  584. })
  585. })
  586. },
  587. // 选人组件提交
  588. move_employee_confirm(data){
  589. this.employeeNames='';
  590. var employee=data.employee;
  591. if(employee.length>0){
  592. employee.forEach(item=>{
  593. this.employeeNames+=item.name+','
  594. this.newGroupForm.employees.push(item.id);
  595. })
  596. }else{
  597. this.newGroupForm.employees=[];
  598. }
  599. this.employees_selected.employee=employee;
  600. this.isEmployeeShow=false;
  601. },
  602. // 递归判断列表,把最后的children设为undefined
  603. getTreeData(data) {
  604. for (var i = 0; i < data.length; i++) {
  605. if (data[i].child.length < 1) {
  606. // children若为空数组,则将children设为undefined
  607. data[i].child = undefined;
  608. } else {
  609. // children若不为空数组,则继续 递归调用 本方法
  610. this.getTreeData(data[i].child);
  611. }
  612. }
  613. return data;
  614. },
  615. //获取规则
  616. getRuleList() {
  617. this.$axios('get','/api/integral/rule/trees', {cycle_type: 1}).then(res => {
  618. this.rule_trees = this.getTreeData(res.data.data.rule_tree || []);
  619. this.itemList = res.data.data.item_list; //规则
  620. })
  621. },
  622. // 规则分类改变之后请求数据
  623. rule_null(val){
  624. this.params.rule_id=val.length == 0? '': val[val.length -1]
  625. this.$nextTick(()=>{
  626. this.page = 1
  627. this.open_right()
  628. })
  629. },
  630. //获取初始化数据
  631. get_groups_list(isAdd) {
  632. this.groups_loading = true;
  633. this.$axios('get','/api/integral/statistics/groups').then(res => {
  634. if (res.data.code == 1) {
  635. this.groups_list = res.data.data.list;
  636. if(this.groups_list[0]){
  637. isAdd? this.open_right(this.groups_list[0]):this.open_right();
  638. }else{
  639. this.table_list=[];
  640. }
  641. }
  642. }).finally(() => {
  643. this.groups_loading = false;
  644. });
  645. },
  646. // 打开右边列表
  647. open_right(item){
  648. this.table_loading = true;
  649. var data={};
  650. if(item){
  651. this.groups_info=item;
  652. data={
  653. group_id: item.id,
  654. month: this.params.month,
  655. sort: this.params.sort,
  656. rule_id: this.params.rule_id,
  657. pt_id: 3,
  658. }
  659. }else{
  660. data={
  661. group_id: this.groups_info.id,
  662. month: this.params.month,
  663. sort: this.params.sort,
  664. rule_id: this.params.rule_id,
  665. pt_id: 3,
  666. }
  667. }
  668. this.$axios('get','/api/integral/statistics/ranking',data,'v2').then((res) => {
  669. if (res.data.code == 1) {
  670. this.table_list = res.data.data.list
  671. this.total = res.data.data.total
  672. }else{
  673. this.$message.error(res.data.data.msg)
  674. }
  675. }).finally(() => {
  676. this.table_loading = false
  677. })
  678. },
  679. // 页码变更
  680. handleCurrentChange(val) {
  681. this.page = val
  682. this.open_right(this.groups_info)
  683. },
  684. handleSizeChange(val){
  685. this.page_size = val
  686. this.open_right(this.groups_info)
  687. },
  688. }
  689. };
  690. </script>
  691. <style scoped lang="scss">
  692. .architecture {
  693. display: flex;
  694. text-align: center;
  695. padding-left: 0px;
  696. background-color: #fff;
  697. width: 100%;
  698. overflow: hidden;
  699. cursor: default;
  700. min-height: calc(60vh - 160px);
  701. }
  702. .architecture .RuleLine {
  703. display: table-cell;
  704. width: 1px;
  705. min-height: 600px;
  706. background: hsl(0, 2%, 76%);
  707. }
  708. .architecture .RuleLeft {
  709. display: block;
  710. text-align: center;
  711. padding: 20px 10px;
  712. border-right: none;
  713. overflow-y: auto;
  714. overflow-x: none;
  715. }
  716. /*滚动条的宽度*/
  717. .architecture .RuleLeft::-webkit-scrollbar {
  718. width: 9px;
  719. height: 9px;
  720. }
  721. .architecture .RuleRight::-webkit-scrollbar {
  722. width: 9px;
  723. height: 9px;
  724. }
  725. /*外层轨道。可以用display:none让其不显示,也可以添加背景图片,颜色改变显示效果*/
  726. .architecture .RuleLeft::-webkit-scrollbar-track {
  727. width: 6px;
  728. background-color: #fff0;
  729. -webkit-border-radius: 2em;
  730. -moz-border-radius: 2em;
  731. border-radius: 2em;
  732. }
  733. .architecture .RuleRight::-webkit-scrollbar-track {
  734. width: 6px;
  735. background-color: #fff0;
  736. -webkit-border-radius: 2em;
  737. -moz-border-radius: 2em;
  738. border-radius: 2em;
  739. }
  740. /*滚动条的设置*/
  741. .architecture .RuleLeft::-webkit-scrollbar-thumb {
  742. background-color: #fff0;
  743. background-clip: padding-box;
  744. min-height: 28px;
  745. -webkit-border-radius: 2em;
  746. -moz-border-radius: 2em;
  747. border-radius: 2em;
  748. }
  749. .architecture .RuleRight::-webkit-scrollbar-thumb {
  750. background-color: #fff0;
  751. background-clip: padding-box;
  752. min-height: 28px;
  753. -webkit-border-radius: 2em;
  754. -moz-border-radius: 2em;
  755. border-radius: 2em;
  756. }
  757. /*滚动条移上去的背景*/
  758. .architecture .RuleLeft:hover::-webkit-scrollbar-thumb {
  759. overflow-x: none;
  760. background-color: rgba(144, 147, 153, 0.3);
  761. }
  762. .architecture .RuleRight:hover::-webkit-scrollbar-thumb {
  763. background-color: rgba(115, 118, 124, 0.3);
  764. }
  765. .architecture .RuleLeft .company_name {
  766. position: relative;
  767. display: block;
  768. font-family: 'Microsoft YaHei';
  769. text-align: left;
  770. padding: 15px 28px 17px;
  771. cursor: pointer;
  772. overflow: hidden;
  773. white-space: nowrap;
  774. text-overflow: ellipsis;
  775. border-bottom: 1px #f8f8f8 solid;
  776. }
  777. .architecture .RuleLeft .company_name img {
  778. position: relative;
  779. display: inline-block;
  780. top: 2px;
  781. width: 18px;
  782. height: 18px;
  783. margin-right: 4px;
  784. }
  785. .architecture .RuleLeft ::v-deep .el-button {
  786. margin-bottom: 16px !important;
  787. }
  788. .architecture .RuleRight {
  789. position: relative;
  790. display: table-cell;
  791. text-align: left;
  792. padding: 20px;
  793. }
  794. .architecture .RuleRight .title span .sapn {
  795. display: inline-block;
  796. vertical-align: middle;
  797. max-width: 600px;
  798. overflow: hidden;
  799. white-space: nowrap;
  800. text-overflow: ellipsis;
  801. }
  802. .architecture .RuleRight:after {
  803. content: ' ';
  804. position: absolute;
  805. top: 0;
  806. left: 0;
  807. bottom: 0;
  808. width: 1px;
  809. background: #ebeef5;
  810. }
  811. .architecture .RuleRight .list_box {
  812. width: 100%;
  813. background: #fff;
  814. }
  815. .architecture .RuleRight .list_box ::v-deep table {
  816. font-family: 'Microsoft YaHei';
  817. width: 100% !important;
  818. }
  819. ::v-deep .el-radio .el-radio__label {
  820. display: none;
  821. }
  822. .tips {
  823. background: #dcdfe6;
  824. border-radius: 50%;
  825. width: 14px;
  826. height: 14px;
  827. color: #fff;
  828. display: inline-block;
  829. font-size: 12px;
  830. line-height: 14px;
  831. text-align: center;
  832. }
  833. .groupsName {
  834. font-size: 18px;
  835. margin-right:20px
  836. }
  837. .groupsName span{
  838. margin-left:5px
  839. }
  840. .user_text {
  841. font-size: 12px;
  842. }
  843. .cursor_pointer {
  844. cursor: pointer;
  845. }
  846. .terr-left button{
  847. margin: 0 auto;
  848. display: block;
  849. margin-bottom: 20px;
  850. }
  851. ::v-deep .el-menu-item{
  852. padding:0 10px !important;
  853. }
  854. .rule_class_box {
  855. ::v-deep .el-tree-node {
  856. border-bottom: 1px #f8f8f8 solid;
  857. }
  858. ::v-deep .el-tree-node__content {
  859. padding: 10px 0;
  860. // border-bottom: 1px #f8f8f8 solid;
  861. }
  862. ::v-deep .el-tree-node__content:hover {
  863. background: #ecf5ff;
  864. border-radius: 4px;
  865. }
  866. ::v-deep .is-current .el-tree-node__content .el-icon-caret-right {
  867. color: #409eff !important;
  868. }
  869. ::v-deep .is-current .el-tree-node__content .el-tree-node__label {
  870. color: #409eff !important;
  871. }
  872. ::v-deep .is-current .el-tree-node__children .el-icon-caret-right {
  873. color: #c0c4cc !important;
  874. }
  875. ::v-deep .is-current .el-tree-node__children .el-tree-node__label {
  876. color: #606266 !important;
  877. }
  878. ::v-deep .el-tree-node__label {
  879. overflow: hidden;
  880. text-overflow: ellipsis;
  881. white-space: nowrap;
  882. }
  883. }
  884. </style>