custom_rank.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  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">({{total}}人)</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="resetForm('newGroupForm')" :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="请输入分组名称" :clearable="true"></el-input>
  94. </el-form-item>
  95. <el-form-item label="分组成员">
  96. <el-input 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="700px" :visible.sync="isEmployeeShow" 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 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" 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" :disabled="delLoad" :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" :disabled="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. this.valuesOrLength = valuesLengths;
  333. this.newGroupForm.items = this.valuesOrLength;
  334. if (this.valuesOrLength.length >= 1) {
  335. this.newGroupFormRules = this.valuesOrLength.length + '条规则';
  336. this.ruleHint = '统计已选规则的积分(只选分类不指定规则的积分除外)'
  337. } else {
  338. this.newGroupFormRules = '';
  339. this.ruleHint = '统计所有积分(基础分和工龄分除外)'
  340. }
  341. this.ruleDialogTableVisible = false;
  342. },
  343. //点击某行
  344. clicktable(row, column, cell, event) {
  345. let selectedsif = false;
  346. for (let i in selecteds) {
  347. if (row.id == selecteds[i]) {
  348. selectedsif = true;
  349. selecteds.splice(i, 1);
  350. this.toggleSelection([row], false);
  351. }
  352. }
  353. if (selectedsif == false) {
  354. selecteds.push(row.id);
  355. this.ifPitchOnChild(this.tableData_rule, selecteds);
  356. }
  357. },
  358. //全选
  359. selectAll(selection) {
  360. for (let i in selection) {
  361. selectionID.push(selection[i].id);
  362. }
  363. let tableData_rules = []; //当前分页id
  364. for (let i in this.tableData_rule) {
  365. tableData_rules.push(this.tableData_rule[i].id);
  366. }
  367. selectionID = [...new Set(selectionID)];
  368. if (selection.length == 0) {
  369. //全不选
  370. var diff = [];
  371. var tmp = tableData_rules;
  372. selectionID.forEach(function(val1, i) {
  373. if (tableData_rules.indexOf(val1) < 0) {
  374. diff.push(val1);
  375. } else {
  376. tmp.splice(tmp.indexOf(val1), 1);
  377. }
  378. });
  379. selectionID = diff.concat(tmp);
  380. }
  381. selecteds = [...new Set(selectionID)];
  382. this.valuesOrLength = selecteds;
  383. },
  384. onTableSelect(rows, row) {
  385. let selected = rows.length && rows.indexOf(row) !== -1;
  386. if (selected) {
  387. selecteds.push(row.id);
  388. } else {
  389. for (let i in selecteds) {
  390. if (row.id == selecteds[i]) {
  391. selecteds.splice(i, 1);
  392. }
  393. }
  394. }
  395. },
  396. //关闭
  397. handleClose(done) {
  398. done();
  399. },
  400. //此方法:拿到当前点击规则分类的所有子节点ID,(为了包含子分类 规则)
  401. menuIdInit(menus) {
  402. var _this = this;
  403. var _menu = menus;
  404. var menuId = [];
  405. var len = _menu.length;
  406. for (var i = 0; i < len; i++) {
  407. var item = _menu[i];
  408. if (item.child && item.child.length != 0) {
  409. var child = item.child;
  410. for (var j = 0; j < child.length; j++) {
  411. _menu[len + j] = child[j];
  412. }
  413. len = _menu.length;
  414. }
  415. menuId.push(item.id);
  416. }
  417. return menuId;
  418. },
  419. //点击规则分类
  420. handleNodeClick(data) {
  421. let dataArr = this.menuIdInit([data]); //调用方法
  422. this.tableLoadingRule = true;
  423. this.keyword = ''; //切换规则重置搜索框
  424. let tableData_r = [];
  425. for (let i in this.itemList) {
  426. for (let a in this.itemList[i]) {
  427. for (let x in dataArr) {
  428. if (dataArr[x] == this.itemList[i][a].rule_id) {
  429. tableData_r.push(this.itemList[i][a]);
  430. }
  431. }
  432. }
  433. }
  434. this.tableData_rule2 = tableData_r; //赋予筛选数据
  435. this.tableData_rule = tableData_r;
  436. this.ifPitchOnChild(this.tableData_rule, selecteds);
  437. },
  438. ifPitchOnChild(item, indexID) {
  439. let pitchOnChild = [];
  440. for (let i in item) {
  441. for (let a in indexID) {
  442. //判断外层的值相不相等
  443. if (indexID[a] == item[i].id) {
  444. pitchOnChild.push(item[i]);
  445. }
  446. }
  447. }
  448. this.toggleSelection(pitchOnChild, true);
  449. },
  450. //默认选中
  451. toggleSelection(rows, selected) {
  452. if (rows) {
  453. this.$nextTick(() => {
  454. rows.forEach(row => {
  455. this.$refs.multipleTable.toggleRowSelection(row, selected);
  456. });
  457. });
  458. } else {
  459. this.$refs.multipleTable.clearSelection();
  460. }
  461. setTimeout(() => {
  462. //给遮到层,让默认选中的有缓冲时间
  463. this.tableLoadingRule = false;
  464. }, 300);
  465. },
  466. // 提交表单
  467. subGroupForm(formName){
  468. this.$refs[formName].validate((valid) => {
  469. if (valid) {
  470. this.saveFun()
  471. }
  472. });
  473. },
  474. //获取分组详情
  475. getGroupDetail(func){
  476. this.$axios('get','/api/integral/statistics/groups/info', {group_id: this.groups_info.id}).then(res => {
  477. func(res.data.data);
  478. })
  479. },
  480. //编辑
  481. editGroup(){
  482. var that=this;
  483. this.getGroupDetail(function(res){
  484. that.groups_info = res;
  485. // 分组名称
  486. that.newGroupForm.group_name = res.name;
  487. // 规则
  488. that.newGroupForm.items = [];
  489. for (let i in res.items) {
  490. that.newGroupForm.items.push(res.items[i].id);
  491. }
  492. that.valuesOrLength = that.newGroupForm.items;
  493. if (that.valuesOrLength.length >= 1) {
  494. that.newGroupFormRules = that.valuesOrLength.length + '条规则';
  495. that.ruleHint = '统计已选规则的积分(只选分类不指定规则的积分除外)'
  496. } else {
  497. that.newGroupFormRules = '';
  498. that.ruleHint = '统计所有积分(基础分和工龄分除外)'
  499. }
  500. // 统计周期
  501. that.newGroupForm.date_interval = String(res.date_interval);
  502. that.options_time_value = res.date_interval == 1 ? '月度' : res.date_interval == 2 ? '季度' : res.date_interval == 3 ? '年度' : '';
  503. // 分组人员
  504. that.newGroupForm.employees = [];
  505. that.employeeNames ="";
  506. res.employees.forEach(element => {
  507. that.newGroupForm.employees.push(element.id);
  508. that.employeeNames += element.name + ',';
  509. });
  510. that.employees_selected.employee=res.employees;
  511. that.popupType = false;
  512. that.groupShow = true;
  513. })
  514. },
  515. //添加编辑组
  516. saveFun(){
  517. this.saveLoad = true;
  518. var url=this.popupType? '/api/integral/statistics/groups/create':'/api/integral/statistics/groups'
  519. this.newGroupForm.group_id=this.groups_info.id;
  520. // return;
  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. if(!this.popupType){//为编辑时
  530. this.groups_info=obj;
  531. }
  532. if(this.groups_list.length==0){
  533. this.get_groups_list(true)
  534. }else{
  535. this.get_groups_list()
  536. }
  537. this.resetForm('newGroupForm');
  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.employeeNames='';
  552. this.employees_selected = {employee:[], dept: []}
  553. this.groupShow = false
  554. },
  555. // 新增分组
  556. addGroup(){
  557. this.employee_not_select = []
  558. this.newGroupFormRules='';
  559. this.employees_selected = {employee:[], dept: []}
  560. this.newGroupForm = {
  561. group_name: "",
  562. employees: [],
  563. items:[],
  564. date_interval:"1",
  565. }
  566. this.groupShow = true
  567. this.popupType = true
  568. },
  569. // 删除分组
  570. delItem(){
  571. this.$confirm('确定要删除当前分组吗?, 是否继续?', '删除分组', {
  572. confirmButtonText: '确定',
  573. cancelButtonText: '取消',
  574. type: 'warning'
  575. }).then(() => {
  576. let data = {group_id:this.groups_info.id};
  577. this.delLoad = true
  578. this.$axios('post','/api/integral/statistics/groups/drop',data).then((res) => {
  579. if (res.data.code == 1) {
  580. this.$message.success(res.data.msg)
  581. this.groupShow = false
  582. this.get_groups_list(true);
  583. }else{
  584. this.$message.error(res.data.msg)
  585. }
  586. }).finally(()=>{
  587. this.delLoad = false
  588. })
  589. })
  590. },
  591. // 选人组件提交
  592. move_employee_confirm(data){
  593. this.employeeNames='';
  594. this.newGroupForm.employees=[];
  595. var employee=data.employee;
  596. if(employee.length>0){
  597. employee.forEach(item=>{
  598. this.employeeNames+=item.name+','
  599. this.newGroupForm.employees.push(item.id);
  600. })
  601. }else{
  602. this.newGroupForm.employees=[];
  603. }
  604. this.employees_selected.employee=employee;
  605. this.isEmployeeShow=false;
  606. },
  607. // 递归判断列表,把最后的children设为undefined
  608. getTreeData(data) {
  609. for (var i = 0; i < data.length; i++) {
  610. if (data[i].child.length < 1) {
  611. // children若为空数组,则将children设为undefined
  612. data[i].child = undefined;
  613. } else {
  614. // children若不为空数组,则继续 递归调用 本方法
  615. this.getTreeData(data[i].child);
  616. }
  617. }
  618. return data;
  619. },
  620. //获取规则
  621. getRuleList() {
  622. this.$axios('get','/api/integral/rule/trees', {cycle_type: 1}).then(res => {
  623. this.rule_trees = this.getTreeData(res.data.data.rule_tree || []);
  624. this.itemList = res.data.data.item_list; //规则
  625. })
  626. },
  627. // 规则分类改变之后请求数据
  628. rule_null(val){
  629. this.params.rule_id=val.length == 0? '': val[val.length -1]
  630. this.$nextTick(()=>{
  631. this.page = 1
  632. this.open_right()
  633. })
  634. },
  635. //获取初始化数据
  636. get_groups_list(isAdd) {
  637. this.groups_loading = true;
  638. this.$axios('get','/api/integral/statistics/groups').then(res => {
  639. if (res.data.code == 1) {
  640. this.groups_list = res.data.data.list;
  641. if(this.groups_list[0]){
  642. isAdd? this.open_right(this.groups_list[0]):this.open_right();
  643. }else{
  644. this.table_list=[];
  645. }
  646. }
  647. }).finally(() => {
  648. this.groups_loading = false;
  649. });
  650. },
  651. // 打开右边列表
  652. open_right(item){
  653. this.table_loading = true;
  654. var data={};
  655. if(item){
  656. this.groups_info=item;
  657. data={
  658. group_id: item.id,
  659. month: this.params.month,
  660. sort: this.params.sort,
  661. rule_id: this.params.rule_id,
  662. pt_id: 3,
  663. }
  664. }else{
  665. data={
  666. group_id: this.groups_info.id,
  667. month: this.params.month,
  668. sort: this.params.sort,
  669. rule_id: this.params.rule_id,
  670. pt_id: 3,
  671. }
  672. }
  673. this.$axios('get','/api/integral/statistics/ranking',data,'v2').then((res) => {
  674. if (res.data.code == 1) {
  675. this.table_list = res.data.data.list
  676. this.total = res.data.data.total
  677. }else{
  678. this.$message.error(res.data.data.msg)
  679. }
  680. }).finally(() => {
  681. this.table_loading = false
  682. })
  683. },
  684. // 页码变更
  685. handleCurrentChange(val) {
  686. this.page = val
  687. this.open_right(this.groups_info)
  688. },
  689. handleSizeChange(val){
  690. this.page_size = val
  691. this.open_right(this.groups_info)
  692. },
  693. }
  694. };
  695. </script>
  696. <style scoped lang="scss">
  697. .architecture {
  698. display: flex;
  699. text-align: center;
  700. padding-left: 0px;
  701. background-color: #fff;
  702. width: 100%;
  703. overflow: hidden;
  704. cursor: default;
  705. min-height: calc(60vh - 160px);
  706. }
  707. .architecture .RuleLine {
  708. display: table-cell;
  709. width: 1px;
  710. min-height: 600px;
  711. background: hsl(0, 2%, 76%);
  712. }
  713. .architecture .RuleLeft {
  714. display: block;
  715. text-align: center;
  716. padding: 20px 10px;
  717. border-right: none;
  718. overflow-y: auto;
  719. overflow-x: none;
  720. }
  721. /*滚动条的宽度*/
  722. .architecture .RuleLeft::-webkit-scrollbar {
  723. width: 9px;
  724. height: 9px;
  725. }
  726. .architecture .RuleRight::-webkit-scrollbar {
  727. width: 9px;
  728. height: 9px;
  729. }
  730. /*外层轨道。可以用display:none让其不显示,也可以添加背景图片,颜色改变显示效果*/
  731. .architecture .RuleLeft::-webkit-scrollbar-track {
  732. width: 6px;
  733. background-color: #fff0;
  734. -webkit-border-radius: 2em;
  735. -moz-border-radius: 2em;
  736. border-radius: 2em;
  737. }
  738. .architecture .RuleRight::-webkit-scrollbar-track {
  739. width: 6px;
  740. background-color: #fff0;
  741. -webkit-border-radius: 2em;
  742. -moz-border-radius: 2em;
  743. border-radius: 2em;
  744. }
  745. /*滚动条的设置*/
  746. .architecture .RuleLeft::-webkit-scrollbar-thumb {
  747. background-color: #fff0;
  748. background-clip: padding-box;
  749. min-height: 28px;
  750. -webkit-border-radius: 2em;
  751. -moz-border-radius: 2em;
  752. border-radius: 2em;
  753. }
  754. .architecture .RuleRight::-webkit-scrollbar-thumb {
  755. background-color: #fff0;
  756. background-clip: padding-box;
  757. min-height: 28px;
  758. -webkit-border-radius: 2em;
  759. -moz-border-radius: 2em;
  760. border-radius: 2em;
  761. }
  762. /*滚动条移上去的背景*/
  763. .architecture .RuleLeft:hover::-webkit-scrollbar-thumb {
  764. overflow-x: none;
  765. background-color: rgba(144, 147, 153, 0.3);
  766. }
  767. .architecture .RuleRight:hover::-webkit-scrollbar-thumb {
  768. background-color: rgba(115, 118, 124, 0.3);
  769. }
  770. .architecture .RuleLeft .company_name {
  771. position: relative;
  772. display: block;
  773. font-family: 'Microsoft YaHei';
  774. text-align: left;
  775. padding: 15px 28px 17px;
  776. cursor: pointer;
  777. overflow: hidden;
  778. white-space: nowrap;
  779. text-overflow: ellipsis;
  780. border-bottom: 1px #f8f8f8 solid;
  781. }
  782. .architecture .RuleLeft .company_name img {
  783. position: relative;
  784. display: inline-block;
  785. top: 2px;
  786. width: 18px;
  787. height: 18px;
  788. margin-right: 4px;
  789. }
  790. .architecture .RuleLeft ::v-deep .el-button {
  791. margin-bottom: 16px !important;
  792. }
  793. .architecture .RuleRight {
  794. position: relative;
  795. display: table-cell;
  796. text-align: left;
  797. padding: 20px;
  798. }
  799. .architecture .RuleRight .title span .sapn {
  800. display: inline-block;
  801. vertical-align: middle;
  802. max-width: 600px;
  803. overflow: hidden;
  804. white-space: nowrap;
  805. text-overflow: ellipsis;
  806. }
  807. .architecture .RuleRight:after {
  808. content: ' ';
  809. position: absolute;
  810. top: 0;
  811. left: 0;
  812. bottom: 0;
  813. width: 1px;
  814. background: #ebeef5;
  815. }
  816. .architecture .RuleRight .list_box {
  817. width: 100%;
  818. background: #fff;
  819. }
  820. .architecture .RuleRight .list_box ::v-deep table {
  821. font-family: 'Microsoft YaHei';
  822. width: 100% !important;
  823. }
  824. ::v-deep .el-radio .el-radio__label {
  825. display: none;
  826. }
  827. .tips {
  828. background: #dcdfe6;
  829. border-radius: 50%;
  830. width: 14px;
  831. height: 14px;
  832. color: #fff;
  833. display: inline-block;
  834. font-size: 12px;
  835. line-height: 14px;
  836. text-align: center;
  837. }
  838. .groupsName {
  839. font-size: 18px;
  840. margin-right:20px
  841. }
  842. .groupsName span{
  843. margin-left:5px
  844. }
  845. .user_text {
  846. font-size: 12px;
  847. }
  848. .cursor_pointer {
  849. cursor: pointer;
  850. }
  851. .terr-left button{
  852. margin: 0 auto;
  853. display: block;
  854. margin-bottom: 20px;
  855. }
  856. ::v-deep .el-menu-item{
  857. padding:0 10px !important;
  858. }
  859. .rule_class_box {
  860. ::v-deep .el-tree-node {
  861. border-bottom: 1px #f8f8f8 solid;
  862. }
  863. ::v-deep .el-tree-node__content {
  864. padding: 10px 0;
  865. // border-bottom: 1px #f8f8f8 solid;
  866. }
  867. ::v-deep .el-tree-node__content:hover {
  868. background: #ecf5ff;
  869. border-radius: 4px;
  870. }
  871. ::v-deep .is-current .el-tree-node__content .el-icon-caret-right {
  872. color: #409eff !important;
  873. }
  874. ::v-deep .is-current .el-tree-node__content .el-tree-node__label {
  875. color: #409eff !important;
  876. }
  877. ::v-deep .is-current .el-tree-node__children .el-icon-caret-right {
  878. color: #c0c4cc !important;
  879. }
  880. ::v-deep .is-current .el-tree-node__children .el-tree-node__label {
  881. color: #606266 !important;
  882. }
  883. ::v-deep .el-tree-node__label {
  884. overflow: hidden;
  885. text-overflow: ellipsis;
  886. white-space: nowrap;
  887. }
  888. }
  889. </style>