manager_statistics.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. <template>
  2. <div>
  3. <div class="all padding-20">
  4. <el-tabs v-model="activeName">
  5. <!-- 奖扣完成情况 -->
  6. <el-tab-pane label="奖扣完成情况" name="second">
  7. <el-form :model="condition" :inline="true" ref="formData">
  8. <!-- 部门 -->
  9. <el-form-item label="部门">
  10. <el-cascader
  11. size="medium"
  12. class="date-picker-width"
  13. v-model="dept_name_xq_xq"
  14. :options="dept_tree"
  15. @change="get_last_dept_null"
  16. :props="{ checkStrictly: true, value: 'id', label: 'name', children: '_child' }"
  17. ref="dept"
  18. clearable
  19. filterable
  20. change-on-select
  21. placeholder="全公司"
  22. ></el-cascader>
  23. </el-form-item>
  24. <!-- 时间 -->
  25. <el-form-item label="时间">
  26. <el-date-picker
  27. class="date-picker-width"
  28. v-model="condition.month"
  29. :clearable="false"
  30. size="medium"
  31. width="100%"
  32. type="month"
  33. placeholder="请选择月份"
  34. value-format="yyyy-MM"
  35. ></el-date-picker>
  36. </el-form-item>
  37. <!-- 搜索框 -->
  38. <el-form-item>
  39. <el-input
  40. v-model="condition.keyword"
  41. placeholder="输入同事姓名"
  42. max="200"
  43. size="medium"
  44. @keyup.enter.native="keyWordSelect"
  45. class="persons_name"
  46. :clearable="true"
  47. >
  48. <el-button slot="append" size="medium" icon="el-icon-search" @click="search_box"></el-button>
  49. </el-input>
  50. </el-form-item>
  51. <!-- 达标选项 -->
  52. <br />
  53. <el-form-item><el-checkbox v-model="allPass" size="medium" label="只看全部达标的"></el-checkbox></el-form-item>
  54. <!-- 导出报表 -->
  55. <el-form-item>
  56. <downloadexcel
  57. v-if="exportExcelArr.length>0"
  58. :fetch="returnArr"
  59. name="管理者奖扣列表.xls"
  60. :fields="json_fields"
  61. >
  62. <el-button type="primary" plain size="medium" style="margin-left:20px">导出报表</el-button>
  63. </downloadexcel>
  64. </el-form-item>
  65. </el-form>
  66. <div class="flex-box-end">
  67. <span class="orange">*管理者奖扣任务均为B分,对A分不做要求*</span>
  68. </div>
  69. <el-table :data="last" style="width: 100%;cursor: pointer;" v-loading="loading2" @row-click="openDetail">
  70. <el-table-column label="管理者">
  71. <template slot-scope="scope">
  72. <div class="flex-box flex-v-ce">
  73. <userImage :user_name="scope.row.name" :img_url="scope.row.img_url" width="50px" height="50px"></userImage>
  74. <span style=" margin-left: 10px; line-height: 50px; display: inline-block;">{{ scope.row.name }}</span>
  75. </div>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="部门" align="left" prop="dept" show-overflow-tooltip></el-table-column>
  79. <el-table-column label="奖分" prop="scope_count">
  80. <template slot-scope="scope">
  81. <b>{{ scope.row.reward.point }}&nbsp;</b>
  82. <span :class="scope.row.reward.status == 1 ? 'green' : ''">{{ scope.row.reward.status == 1 ? '达标' : '' }}</span>
  83. <br />
  84. <span class="span_h">奖分目标 {{ scope.row.reward.target }}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="扣分" prop="reward_count">
  88. <template slot-scope="scope">
  89. <b>{{ scope.row.deduction.point }}&nbsp;</b>
  90. <span :class="scope.row.deduction.status == 1 ? 'green' : ''">{{ scope.row.deduction.status == 1 ? '达标' : '' }}</span>
  91. <br />
  92. <span class="span_h">扣分目标 {{ scope.row.deduction.target }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="奖扣比例" prop="deduct_count">
  96. <template slot-scope="scope">
  97. <div>
  98. <template v-if="scope.row.ratio.enable == 1">
  99. <b>{{ scope.row.ratio.reward_ratio }}&nbsp;:1</b>
  100. <span :class="scope.row.ratio.status == 1 ? 'green' : ''">{{ scope.row.ratio.status == 1 ? '达标' : '' }}</span>
  101. </template>
  102. <b v-else>-</b>
  103. <br />
  104. <span class="span_h">比例目标 {{ scope.row.ratio.target }}<b>:</b>&nbsp;1</span>
  105. </div>
  106. <!-- <div v-else style="padding-left:21px">—</div> -->
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="人次目标" prop="deduct_count">
  110. <template slot-scope="scope">
  111. <b>{{ scope.row.exec.count }}&nbsp;</b>
  112. <span :class="scope.row.exec.status == 1 ? 'green' : ''">{{ scope.row.exec.status == 1 ? '达标' : '' }}</span>
  113. <br />
  114. <span class="span_h">人次目标 {{ scope.row.exec.target }}人次</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column>
  118. <template slot-scope="scope">
  119. <span class="blue" style="cursor: pointer;" @click="openDetail(scope.row)">查看奖扣明细</span>
  120. </template>
  121. </el-table-column>
  122. <template slot="empty">
  123. <div class="nopoint_box">
  124. <div class="noimg noperson"></div>
  125. <span class="title">没有对应的数据</span>
  126. </div>
  127. </template>
  128. </el-table>
  129. <center style="padding: 20px 0;">
  130. <el-pagination
  131. background
  132. @size-change="handleSizeChange_xq"
  133. @current-change="handleCurrentChange_xq"
  134. :current-page="condition.page"
  135. :page-sizes="[10, 20, 50, 100]"
  136. layout="total, sizes, prev, pager, next"
  137. :page-size="condition.page_size"
  138. :total="totals"
  139. ></el-pagination>
  140. </center>
  141. </el-tab-pane>
  142. <el-tab-pane label="奖扣执行对比" name="first" v-if="false">
  143. <el-form :model="formData" :inline="true" ref="formData">
  144. <el-form-item label="部门">
  145. <el-cascader
  146. v-model="dept_name_xq"
  147. :options="dept_tree"
  148. @change="dept_null"
  149. :props="{ checkStrictly: true, value: 'id', label: 'name', children: '_child' }"
  150. ref="depts"
  151. filterable
  152. size="medium"
  153. change-on-select
  154. placeholder="全公司"
  155. clearable
  156. ></el-cascader>
  157. </el-form-item>
  158. <el-form-item label="时间">
  159. <el-date-picker
  160. class="date-picker-width"
  161. v-model="formData.month"
  162. :clearable="false"
  163. width="100%"
  164. type="month"
  165. size="medium"
  166. placeholder="请选择月份"
  167. value-format="yyyy-MM"
  168. ></el-date-picker>
  169. </el-form-item>
  170. </el-form>
  171. <div class="flex-box-end">
  172. <span class="orange">*管理者奖扣任务均为B分,对A分不做要求*</span>
  173. </div>
  174. <el-table :data="list" style="width: 100%;cursor: pointer;" v-loading="loading" @row-click="open_detail">
  175. <el-table-column label="管理者">
  176. <template slot-scope="scope">
  177. <div class="flex-box flex-v-ce">
  178. <userImage :user_name="scope.row.name" :img_url="scope.row.img_url" width="50px" height="50px"></userImage>
  179. <span style=" margin-left: 10px; line-height: 50px; display: inline-block;">{{ scope.row.name }}</span>
  180. </div>
  181. </template>
  182. </el-table-column>
  183. <el-table-column show-overflow-tooltip label="部门" align="left" min-width="120px" prop="deptName"></el-table-column>
  184. <el-table-column label="管理范围(人)" prop="scope_count"></el-table-column>
  185. <el-table-column label="人均奖分(次)" prop="reward_count"></el-table-column>
  186. <el-table-column label="人均扣分(次)" prop="deduct_count"></el-table-column>
  187. <template slot="empty">
  188. <div class="nopoint_box">
  189. <div class="noimg noperson"></div>
  190. <span class="title">没有对应的数据</span>
  191. </div>
  192. </template>
  193. </el-table>
  194. <center style="padding: 20px 0;">
  195. <el-pagination
  196. background
  197. @size-change="handleSizeChange"
  198. @current-change="handleCurrentChange"
  199. :current-page="formData.page"
  200. :page-sizes="[10, 20, 50, 100]"
  201. layout="total, sizes, prev, pager, next"
  202. :page-size="formData.page_size"
  203. :total="total"
  204. ></el-pagination>
  205. </center>
  206. <el-drawer size="500px" :visible.sync="detail_show" :with-header="false" direction="rtl">
  207. <el-button type="info" style="position: absolute; left: -100px;">test</el-button>
  208. <div class="drawer_title">
  209. {{ item.name }}的奖扣统计
  210. <el-tooltip placement="top">
  211. <div slot="content" style="width: 300px">作为管理者,管理执行力是关键,每月按要求完成奖分和扣分任务。</div>
  212. <span class="tips">?</span>
  213. </el-tooltip>
  214. </div>
  215. <div class="chart_content">
  216. <div v-if="personalData !== null" class="flex-box-ce" v-loading="personalData_loading">
  217. <div class="dataItem flex-1">
  218. <p class="point">{{ personalData.task.reward.point }}</p>
  219. <p>奖分</p>
  220. <p class="target">目标{{ personalData.task.reward.target }}</p>
  221. </div>
  222. <div class="dataItem flex-1">
  223. <p class="point">{{ personalData.task.deduction.point }}</p>
  224. <p>扣分</p>
  225. <p class="target">目标{{ personalData.task.deduction.target }}</p>
  226. </div>
  227. <!-- <div class="dataItem flex-1">
  228. <p class="point">{{ personalData.task.ratio.ratio }}:1</p>
  229. <p>奖扣比例</p>
  230. <p class="target">目标 ≤ {{ personalData.task.ratio.target_ratio }}:1</p>
  231. </div> -->
  232. <div class="dataItem flex-1">
  233. <p class="point" v-if="personalData.task.ratio.enable==1">{{ personalData.task.ratio.reward_ratio }}:1</p>
  234. <p class="point" v-else>-</p>
  235. <p>奖扣比例</p>
  236. <p class="target">目标 ≤ {{ personalData.task.ratio.target }}:1</p>
  237. </div>
  238. <div class="dataItem flex-1">
  239. <p class="point">{{ personalData.task.exec.count }}</p>
  240. <p>奖扣人次</p>
  241. <p class="target">目标{{ personalData.task.exec.target }}</p>
  242. </div>
  243. </div>
  244. <div class="chart-legend__wrap">
  245. <span class="fl">月奖扣执行情况</span>
  246. <span class="chart-legend__pink">奖分</span>
  247. <span class="chart-legend__green">扣分</span>
  248. </div>
  249. <div id="situationChart" v-loading="echart_loading" style="height: 300px;"></div>
  250. <div class="chart-legend__wrap">
  251. <div class="fl">月奖扣人次</div>
  252. <span class="chart-legend__pink">奖分人次</span>
  253. <span class="chart-legend__green">扣分人次</span>
  254. </div>
  255. <div id="passengersChart" v-loading="echart_loading" style="height: 300px;"></div>
  256. </div>
  257. </el-drawer>
  258. </el-tab-pane>
  259. </el-tabs>
  260. </div>
  261. </div>
  262. </template>
  263. <script>
  264. import downloadexcel from "vue-json-excel";
  265. export default {
  266. components:{downloadexcel},
  267. data() {
  268. return {
  269. json_fields:{
  270. '姓名':'name',
  271. '部门':'dept',
  272. '实际奖分':'point',
  273. '奖分目标':'target',
  274. '实际扣分':'point2',
  275. '扣分目标':'target2',
  276. '实际奖扣比例':'jkbl',
  277. '比例目标':'blmb2',
  278. '实际奖扣人次':'sjjk',
  279. '人次目标':'rcmb',
  280. },
  281. last: [],
  282. //完成情况
  283. condition: {
  284. month: this.$moment().format('YYYY-MM'), //时间
  285. page: 1, //当前页
  286. page_size: 10, //每页数量
  287. dept_id: 0, //部门id
  288. keyword: '', //关键字
  289. complete: '' //是否达标 1是
  290. },
  291. activeName: 'second',
  292. totals: null,
  293. dept_name_xq_xq: '',
  294. //对比
  295. loading: false,
  296. loading2: false,
  297. choose_time: '',
  298. input: '',
  299. radio: '1',
  300. formData: {
  301. month: this.$moment().format('YYYY-MM'),
  302. page: 1,
  303. page_size: 10,
  304. dept_id: 0
  305. },
  306. total: null,
  307. allPass: false,
  308. list: [],
  309. detail_show: false,
  310. echart_loading: false,
  311. item: {},
  312. dept_name_xq: '',
  313. dept_tree: [],
  314. personalData_loading: false,
  315. personalData: null,
  316. exportExcelArr:[]
  317. };
  318. },
  319. watch: {
  320. //对比
  321. 'formData.month'(val, old_val) {
  322. this.formData.page = 1;
  323. this.get_list();
  324. },
  325. //情况
  326. 'condition.month'(val, old_val) {
  327. this.condition.page = 1;
  328. this.get_last();
  329. },
  330. //查看全部达标
  331. allPass(val, old_val) {
  332. if (val) {
  333. this.condition.complete = '1';
  334. } else {
  335. this.condition.complete = '0';
  336. }
  337. this.condition.page = 1;
  338. this.get_last();
  339. }
  340. },
  341. methods: {
  342. returnArr(){
  343. return this.exportExcelArr;
  344. },
  345. opneWebSocket(index) {
  346. let data={};
  347. if(index==2){
  348. this.loading =true ;
  349. data={
  350. type:"es_avg",
  351. employee_id:this.$getUserData().id,
  352. page:this.formData.page,
  353. page_size:this.formData.page_size,
  354. month:this.formData.month,
  355. dept_id:this.formData.dept_id,
  356. keyword:this.formData.keyword
  357. };
  358. }else if(index==1){
  359. this.loading2 = true;
  360. data={
  361. type:"es",
  362. employee_id:this.$getUserData().id,
  363. page:this.condition.page,
  364. page_size:this.condition.page_size,
  365. month:this.condition.month,
  366. dept_id:this.condition.dept_id,
  367. complete:this.condition.complete||0,
  368. keyword:this.condition.keyword
  369. };
  370. }else if(index==3){
  371. data={
  372. type:"es",
  373. employee_id:this.$getUserData().id,
  374. page:1,
  375. page_size:100000,
  376. month:this.condition.month,
  377. dept_id:this.condition.dept_id,
  378. complete:this.condition.complete||0,
  379. keyword:this.condition.keyword
  380. };
  381. }else if(index==4){
  382. this.echart_loading=true;
  383. data={
  384. type:"es_info",
  385. recorder_id:this.item.id,
  386. month:this.formData.month
  387. };
  388. }
  389. this.$socketApiTow.sendData(data,(res)=>{
  390. if (res.code == 1&&res.type=='es') {
  391. if(res.result.source_msg.page_size==100000){
  392. let list = res.result.list;
  393. list.forEach(item=>{
  394. item.point=item.reward.point;
  395. item.target=item.reward.target;
  396. item.point2=item.deduction.point;
  397. item.target2=item.deduction.target;
  398. item.jkbl=item.ratio.enable == 1? item.ratio.reward_ratio+'比1':'-';
  399. item.blmb2=item.ratio.target+'比1';
  400. item.sjjk=item.exec.count;
  401. item.rcmb=item.exec.target;
  402. })
  403. this.exportExcelArr=list;
  404. }else{
  405. this.last = res.result.list;
  406. this.totals = res.result.total;
  407. this.$nextTick(()=>{
  408. this.loading2 = false;
  409. this.opneWebSocket(3);
  410. })
  411. }
  412. }
  413. if (res.code == 1&&res.type=='es_avg') {
  414. this.list =this.$returnDeptName(res.result.list);
  415. this.total = res.result.total;
  416. this.$nextTick(()=>{
  417. this.loading = false;
  418. })
  419. }
  420. if (res.code == 1&&res.type=='es_info') {
  421. this.personalData = res.result;
  422. const chart = res.result.chart;
  423. this.employeeName = res.result.name;
  424. const deduct = chart.deduct;
  425. const situationRewardData = [];
  426. const situationDeductionData = [];
  427. const passengersRewardData = [];
  428. const passengersDeductionData = [];
  429. const xAxisData = chart.reward.map((o, i) => {
  430. // 降分分数
  431. situationDeductionData.push(chart.reward[i].point);
  432. // 扣分分数
  433. passengersDeductionData.push(chart.deduct[i].point);
  434. // 奖分次数
  435. situationRewardData.push(chart.reward[i].count);
  436. // 扣分次数
  437. passengersRewardData.push(chart.deduct[i].count);
  438. return o.date;
  439. });
  440. this.situationChart.setOption(this.getChartOption(xAxisData, situationDeductionData, passengersDeductionData)); //奖分数值、扣分数值
  441. this.passengersChart.setOption(this.getChartOption(xAxisData, situationRewardData, passengersRewardData)); //月奖扣人次
  442. this.$nextTick(()=>{
  443. this.echart_loading = false;
  444. })
  445. }
  446. if (res.type=='break') {
  447. this.loading2 = false;
  448. }
  449. },true)
  450. },
  451. openDetail(e){
  452. let data={
  453. date:this.condition.month,
  454. id:e.id,
  455. name:e.name
  456. }
  457. this.$router.push({path:'/integral_event_two',query:{data:JSON.stringify(data)}})
  458. },
  459. //情况
  460. get_last() {
  461. this.opneWebSocket(1);
  462. return false
  463. this.loading = true;
  464. this.$axios('get', '/api/integral/statistics/prize/list', this.condition, 'v4').then(res => {
  465. if (res.data.code == 1) {
  466. this.last = res.data.data.list;
  467. this.totals = res.data.data.total;
  468. } else {
  469. this.$message.error(res.data.data.msg);
  470. }
  471. }).finally(() => {
  472. this.loading = false;
  473. });
  474. },
  475. //部门
  476. get_last_dept_null(val) {
  477. if (val.length == 0) {
  478. this.condition.dept_id = 0;
  479. } else {
  480. this.condition.dept_id = val[val.length-1];
  481. }
  482. this.$nextTick(() => {
  483. this.condition.page = 1;
  484. this.$refs.dept.dropDownVisible = false; //监听值发生变化就关闭它
  485. this.get_last();
  486. });
  487. },
  488. //搜索框
  489. search_box() {
  490. this.get_last();
  491. },
  492. //导出报表
  493. // opneWebSocket() {
  494. // let data = '';
  495. // //部门
  496. // this.condition.dept_id > 0 ? (data += '&dept_id=' + this.condition.dept_id) : (data += '&dept_id=0');
  497. // //时间
  498. // data += '&month=' + this.condition.month;
  499. // //搜索框
  500. // this.condition.keyword == '' ? (data += '&keyword=') : (data += '&keyword=' + this.condition.keyword);
  501. // //是否达标
  502. // this.condition.complete != 0 ? (data += '&complete=' + this.condition.complete) : (data += '&complete=0');
  503. // //当前页数
  504. // data += '&page=1&page_size=9999';
  505. // window.open(process.env.VUE_APP_BASE_API + 'api/download/prize/list/v4?employee_id=' + this.$getUserData().id + data, '_blank');
  506. // },
  507. //分页选择显示多少条
  508. handleCurrentChange_xq(val) {
  509. this.condition.page = val;
  510. this.get_last();
  511. },
  512. //分页
  513. handleSizeChange_xq(val) {
  514. this.condition.page_size = val;
  515. this.get_last();
  516. },
  517. handleSizeChange(val) {
  518. this.formData.page_size = val;
  519. this.get_list();
  520. },
  521. handleCurrentChange(val) {
  522. this.formData.page = val;
  523. this.get_list();
  524. },
  525. get_list() {
  526. // this.opneWebSocket(2);
  527. return false
  528. this.loading = true;
  529. this.$axios('get', '/api/integral/statistics/prize/list', this.formData, 'v3')
  530. .then(res => {
  531. if (res.data.code == 1) {
  532. this.list =this.$returnDeptName(res.data.data.list);
  533. this.total = res.data.data.total;
  534. } else {
  535. this.$message.error(res.data.data.msg);
  536. }
  537. })
  538. .finally(() => {
  539. this.loading = false;
  540. });
  541. },
  542. search() {
  543. this.get_list();
  544. },
  545. open_detail(row, column, event) {
  546. this.detail_show = true;
  547. this.item = row;
  548. this.$nextTick(() => {
  549. this.situationChart = this.$echarts.init(document.getElementById('situationChart'));
  550. this.passengersChart = this.$echarts.init(document.getElementById('passengersChart'));
  551. });
  552. this.opneWebSocket(4);
  553. // this.getData(() => (this.echart_loading = false));
  554. // this.getDataV1(() => (this.personalData_loading = false));
  555. },
  556. getChartOption(xAxisData, rewardData, deductionData) {
  557. return {
  558. tooltip: {
  559. trigger: 'axis'
  560. },
  561. grid: {
  562. containLabel: true,
  563. top: '4%',
  564. right: '4%',
  565. bottom: '5%',
  566. left: '7%'
  567. },
  568. xAxis: {
  569. type: 'category',
  570. boundaryGap: false,
  571. axisLine: { lineStyle: { color: '#eee' } },
  572. axisLabel: { color: '#333' },
  573. data: xAxisData
  574. },
  575. yAxis: {
  576. position: 'right',
  577. axisLine: { lineStyle: { color: '#eee' } },
  578. axisLabel: { color: '#333' },
  579. type: 'value',
  580. splitLine: { lineStyle: { color: '#eee' } }
  581. },
  582. series: [
  583. {
  584. name: '奖分',
  585. type: 'line',
  586. data: rewardData,
  587. lineStyle: { normal: { color: '#F56C6C' } }
  588. },
  589. {
  590. name: '扣分',
  591. type: 'line',
  592. data: deductionData,
  593. lineStyle: { normal: { color: '#53B87F' } }
  594. }
  595. ]
  596. };
  597. },
  598. // v2
  599. getData(callBack) {
  600. this.echart_loading = true;
  601. const data = {
  602. employee_id: this.item.id || 0,
  603. month: this.formData.month
  604. };
  605. this.$axios('get', '/api/integral/statistics/prize', data)
  606. .then(res => {
  607. if (res.data.code === 1) {
  608. const item = res.data.data;
  609. this.employeeName = item.name;
  610. const deduct = item.chart.deduct;
  611. const situationRewardData = [];
  612. const situationDeductionData = [];
  613. const passengersRewardData = [];
  614. const passengersDeductionData = [];
  615. const xAxisData = item.chart.reward.map((o, i) => {
  616. // 降分分数
  617. situationDeductionData.push(item.chart.reward[i].point);
  618. // 扣分分数
  619. passengersDeductionData.push(item.chart.deduct[i].point);
  620. // 奖分次数
  621. situationRewardData.push(item.chart.reward[i].count);
  622. // 扣分次数
  623. passengersRewardData.push(item.chart.deduct[i].count);
  624. return o.date;
  625. });
  626. this.situationChart.setOption(this.getChartOption(xAxisData, situationDeductionData, passengersDeductionData)); //奖分数值、扣分数值
  627. this.passengersChart.setOption(this.getChartOption(xAxisData, situationRewardData, passengersRewardData)); //月奖扣人次
  628. }
  629. })
  630. .finally(() => {
  631. this.echart_loading = false;
  632. });
  633. },
  634. // v1
  635. getDataV1(callBack) {
  636. this.personalData_loading = true;
  637. const data = {
  638. employee_id: this.item.id || 0,
  639. month: this.formData.month
  640. };
  641. this.$axios('get', '/api/integral/statistics', data)
  642. .then(res => {
  643. if (res.data.code == 1) {
  644. this.personalData = res.data.data;
  645. } else {
  646. this.$message.error(res.data.data.msg);
  647. }
  648. })
  649. .finally(() => {
  650. this.personalData_loading = false;
  651. });
  652. },
  653. dept_null(val) {
  654. if (val.length == 0) {
  655. this.formData.dept_id = 0;
  656. } else {
  657. this.formData.dept_id = this.dept_name_xq[this.dept_name_xq.length - 1];
  658. }
  659. this.$nextTick(() => {
  660. this.formData.page = 1;
  661. this.$refs.depts.dropDownVisible = false;
  662. this.get_list();
  663. });
  664. },
  665. //获取部门
  666. getDepartment() {
  667. this.$axios('get', '/api/department/tree').then(res => {
  668. this.dept_tree = this.getTreeData(res.data.data.list);
  669. });
  670. },
  671. // 递归判断列表,把最后的children设为undefined
  672. getTreeData(data) {
  673. for (var i = 0; i < data.length; i++) {
  674. data[i].obj = { id: data[i].id, name: data[i].name };
  675. if (data[i]._child.length < 1) {
  676. // children若为空数组,则将children设为undefined
  677. data[i]._child = undefined;
  678. } else {
  679. // children若不为空数组,则继续 递归调用 本方法
  680. this.getTreeData(data[i]._child);
  681. }
  682. }
  683. return data;
  684. }
  685. },
  686. created() {
  687. this.get_last();
  688. },
  689. mounted() {
  690. this.getDepartment();
  691. this.get_list();
  692. },
  693. beforeDestroy() {
  694. this.$socketApiTow.closewebsocket();
  695. }
  696. };
  697. </script>
  698. <style scoped lang="scss">
  699. .search_box {
  700. ::v-deep button:active {
  701. background: #26a2ff;
  702. }
  703. ::v-deep button:active .el-icon-search {
  704. color: #fff;
  705. }
  706. }
  707. .date-picker-width {
  708. width: 100% !important;
  709. }
  710. .nopoint_box {
  711. display: inline-block;
  712. text-align: center;
  713. width: 100%;
  714. margin-bottom: 10px;
  715. }
  716. .noimg {
  717. display: inline-block;
  718. width: 110px;
  719. height: 110px;
  720. margin: 22px auto 16px;
  721. background-size: 99%;
  722. }
  723. .noperson {
  724. display: inline-block;
  725. width: 110px;
  726. height: 110px;
  727. line-height: none;
  728. margin: 22px auto 16px;
  729. background: url('../../assets/image/nodata_default.png') no-repeat center;
  730. background-size: 99%;
  731. }
  732. .title {
  733. display: block;
  734. text-align: center;
  735. font-size: 12px !important;
  736. line-height: 30px;
  737. color: #909399 !important;
  738. padding: 0;
  739. }
  740. .nopoint_box a {
  741. color: #26a2ff;
  742. }
  743. .chart_content {
  744. height: 90vh;
  745. overflow-y: auto;
  746. overflow-x: hidden;
  747. .chart-legend__wrap {
  748. text-align: right;
  749. padding: 20px;
  750. padding-right: 50px;
  751. & .chart-legend__pink {
  752. position: relative;
  753. padding-left: 12px;
  754. padding-right: 5px;
  755. &:after {
  756. content: '';
  757. position: absolute;
  758. margin-top: -2px;
  759. top: 35%;
  760. left: 0;
  761. width: 8px;
  762. height: 8px;
  763. background: #f56c6c;
  764. border-radius: 100%;
  765. }
  766. }
  767. & .chart-legend__green {
  768. position: relative;
  769. padding-left: 12px;
  770. &:after {
  771. content: '';
  772. position: absolute;
  773. margin-top: -2px;
  774. top: 35%;
  775. left: 0;
  776. width: 8px;
  777. height: 8px;
  778. background: #53b87f;
  779. border-radius: 100%;
  780. }
  781. }
  782. }
  783. }
  784. // 滚动条样式
  785. .chart_content::-webkit-scrollbar-track {
  786. -webkit-box-shadow: inset 0 0 5px #fff;
  787. border-radius: 5px;
  788. background-color: #fff;
  789. }
  790. .chart_content::-webkit-scrollbar {
  791. width: 5px;
  792. background-color: rgba(201, 201, 201, 0);
  793. }
  794. .chart_content::-webkit-scrollbar-thumb {
  795. border-radius: 5px;
  796. -webkit-box-shadow: inset 0 0 5px rgb(153, 145, 145) (160, 154, 154);
  797. background-color: #a8a7a7;
  798. }
  799. .dataItem {
  800. text-align: center;
  801. .point {
  802. font-size: 22px;
  803. color: #26a2ff;
  804. margin: 10px 0;
  805. }
  806. .target {
  807. font-size: 12px;
  808. color: #909399;
  809. }
  810. }
  811. .drawer_title {
  812. font-size: 18px;
  813. padding: 20px;
  814. }
  815. .manager_statistics_box {
  816. background-color: #ffffff;
  817. padding: 20px;
  818. min-height: calc(100vh - 160px);
  819. ::v-deep .el-row .el-checkbox .el-checkbox__label {
  820. line-height: 20px;
  821. }
  822. }
  823. .tips {
  824. background: #409eff;
  825. border-radius: 50%;
  826. width: 14px;
  827. height: 14px;
  828. color: #fff;
  829. display: inline-block;
  830. font-size: 12px;
  831. line-height: 14px;
  832. text-align: center;
  833. }
  834. .el-form-item__label {
  835. width: 0px !important;
  836. }
  837. b {
  838. font-size: 14px;
  839. }
  840. .span_h {
  841. font-size: 13px;
  842. color: #898c94;
  843. }
  844. </style>