custom_rank.vue 25 KB

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