department_statistics.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. <template>
  2. <div>
  3. <el-row style="min-width:1160px;">
  4. <div class="flex-box-ce">
  5. <div>
  6. <el-cascader
  7. v-model="dept_name"
  8. :options="dept_tree"
  9. @change="dept1_null"
  10. :props="{
  11. checkStrictly: true,
  12. value: 'id',
  13. label: 'name',
  14. children: '_child'
  15. }"
  16. ref="dept1"
  17. filterable
  18. change-on-select
  19. placeholder="全公司"
  20. clearable
  21. ></el-cascader>
  22. </div>
  23. <div style="margin:0 10px;">
  24. <el-select v-model="time_type" placeholder="请选择分类" style="width: 100px;">
  25. <el-option v-for="item in time_types" :key="item.label" :label="item.label" :value="item.value"></el-option>
  26. </el-select>
  27. </div>
  28. <div>
  29. <el-date-picker
  30. v-show="time_type == '2'"
  31. v-model="export_from.year"
  32. class="date-picker-width"
  33. type="year"
  34. value-format="yyyy"
  35. :clearable="false"
  36. :editable="false"
  37. placeholder="选择年份排名"
  38. ></el-date-picker>
  39. <el-date-picker
  40. v-show="time_type == '1' || time_type == '月份'"
  41. v-model="export_from.month"
  42. class="date-picker-width"
  43. type="month"
  44. value-format="yyyy-MM"
  45. :clearable="false"
  46. :editable="false"
  47. placeholder="选择月份排名"
  48. ></el-date-picker>
  49. </div>
  50. </div>
  51. <el-col :span="24" style="min-width:1160px;">
  52. <el-col :span="18" style="min-width:780px;">
  53. <el-row class="left-all-style" style="margin-top:10px;">
  54. <el-row style="position: relative;">
  55. <el-col :span="24">
  56. <b class="title" style="margin-bottom:15px;display:block">{{ yearhORmontStr }}积分构成</b>
  57. </el-col>
  58. <div v-loading="IntegralFormChartLoad">
  59. <div class="nopoint_box" style="height:306px;" v-show="IntegralFormnone">
  60. <div class="noimg" style="width: 150px;height: 160px;margin-top:80px;"></div>
  61. <span class="title1">
  62. 暂无积分数据 ,
  63. <span @click="$router.push({ path: '/award_punish' })" style="color:#409EFF;cursor:pointer;">去奖扣积分></span>
  64. </span>
  65. </div>
  66. <div v-show="!IntegralFormnone"><div ref="IntegralFormChart" :style="{ width: '100%', height: '350px' }"></div></div>
  67. </div>
  68. </el-row>
  69. </el-row>
  70. <el-row class="left-all-style">
  71. <el-row style="position: relative;">
  72. <el-col :span="24" style="display:flex">
  73. <b class="title" style="margin:0 20px 15px 0;display:block">部门{{ yearhORmontStr }}积分情况</b>
  74. <el-checkbox v-model="exclusiveMonthChecked">不包含自动积分加分项</el-checkbox>
  75. </el-col>
  76. <div v-loading="monthlyIntegralloading">
  77. <!-- <el-col :span="5" style="position: absolute;top:40px;left:10px;z-index: 1;">
  78. <el-cascader
  79. v-model="dept_name2"
  80. :options="dept_tree"
  81. @change="monthlyIntegralchange"
  82. ref="dept2"
  83. filterable
  84. change-on-select
  85. placeholder="请选择部门"
  86. clearable
  87. ></el-cascader>
  88. </el-col> -->
  89. <div class="nopoint_box" style="height:430px;" v-if="monthlyIntegralnone">
  90. <div class="noimg" style="width: 150px;height: 150px;margin-top:110px;"></div>
  91. <span class="title1">暂无积分数据</span>
  92. </div>
  93. <div v-show="!monthlyIntegralnone">
  94. <div ref="monthlyIntegralChart" :style="{ width: '100%', height: '400px' }"></div>
  95. <div style="width:90%;display:flex;justify-content: space-around;margin-top:30px;padding-left:40px">
  96. <p v-for="(item, index) in monthORyear == '2' ? monthlyIntegralList : yearlyIntegralList" :key="index" style="text-align:center">
  97. <b style="display:block;color:#303133;font-size:18px;" v-if="index < 3">
  98. {{ index == 0 ? item.total_point : index == 1 ? item.reward_point : index == 2 ? item.deduction_point : '' }}
  99. </b>
  100. <b style="display:block;color:#303133;font-size:18px;" v-else-if="index == 3">{{ item.ratio == -1 ? '—' : item.ratio + ':1' }}</b>
  101. <b style="display:block;color:#303133;font-size:18px;" v-else>
  102. {{ item.toRatio.ratio + '%' }}
  103. <svg-icon
  104. :icon-class="item.toRatio.type == 1 ? 'litrearrows' : item.toRatio.type == 2 ? 'droparrows' : ''"
  105. style="font-size:10px;margin-bottom:2px"
  106. />
  107. </b>
  108. <span style="color:#303133;font-size:14px;margin-top:5px;display:block;">{{ item.name }}</span>
  109. </p>
  110. </div>
  111. </div>
  112. </div>
  113. </el-row>
  114. </el-row>
  115. </el-col>
  116. <el-col :span="6" style="min-width:280px;">
  117. <!-- <el-col :span="24">
  118. <el-row class="pointsevent_box">
  119. <div
  120. class="grid-content bg-purple"
  121. v-loading="highestPrizeBuckleloading"
  122. style="background:#fff;padding: 20px 20px 0;"
  123. >
  124. <span class="title">{{ yearhORmontStr }}奖分最高</span>
  125. <div class="nopoint_box" v-if="!prize.id">
  126. <div
  127. class="noimg"
  128. style="margin: 0px auto 0;width:80px;height:80px;"
  129. ></div>
  130. <span class="title1" style="padding-bottom:20px;"
  131. >暂无积分数据</span
  132. >
  133. </div>
  134. <div v-else style="display:flex;padding:8px 0 20px 0;height:126px;">
  135. <userImage
  136. width="45px"
  137. height="45px"
  138. :id="prize.id"
  139. :user_name="prize.name"
  140. style="margin-right:8px"
  141. ></userImage>
  142. <div class="rightexamineAndApproveList" style="border:0px">
  143. <p
  144. style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;"
  145. >
  146. <b style="color:#303133;font-size:16px;">{{ prize.name }}</b
  147. ><span style="color:#26A2FF;font-size:16px;"
  148. ><span v-if="prize.point > 0" style="padding-left:30px;"
  149. >+</span
  150. >{{ prize.point }} B分</span
  151. >
  152. </p>
  153. <p
  154. style="font-size:13px;line-height:20px;color:rgb(48, 49, 51);overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:2; "
  155. >
  156. {{ prize.remark ? prize.remark.customize : "" }}
  157. </p>
  158. </div>
  159. </div>
  160. </div>
  161. </el-row>
  162. </el-col> -->
  163. <!-- <el-col :span="24">
  164. <el-row class="pointsevent_box">
  165. <div
  166. class="grid-content bg-purple"
  167. v-loading="highestPrizeBuckleloading"
  168. style="background:#fff;padding: 20px 20px 0;"
  169. >
  170. <span class="title">{{ yearhORmontStr }}扣分最多</span>
  171. <div class="nopoint_box" v-if="!buckle.id">
  172. <div
  173. class="noimg"
  174. style="margin: 0px auto 0;width:80px;height:80px;"
  175. ></div>
  176. <span class="title1" style="padding-bottom:20px;"
  177. >暂无积分数据</span
  178. >
  179. </div>
  180. <div v-else style="display:flex;padding:8px 0 20px 0;height:126px;">
  181. <userImage
  182. width="45px"
  183. height="45px"
  184. :id="buckle.id"
  185. :user_name="buckle.name"
  186. style="margin-right:8px"
  187. ></userImage>
  188. <div class="rightexamineAndApproveList" style="border:0px">
  189. <p
  190. style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;"
  191. >
  192. <b style="color:#303133;font-size:16px;">{{ buckle.name }}</b
  193. ><span style="color:#FF9600;font-size:16px;padding-left:30px;"
  194. >{{ buckle.point }} B分</span
  195. >
  196. </p>
  197. <p
  198. style="font-size:13px;line-height:20px;color:rgb(48, 49, 51);overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:2;"
  199. >
  200. {{ buckle.remark ? buckle.remark.customize : "" }}
  201. </p>
  202. </div>
  203. </div>
  204. </div>
  205. </el-row>
  206. </el-col> -->
  207. <el-row>
  208. <div class="right-all-style" v-loading="highestPrizeBuckleloading" style="background:#fff;padding: 20px 20px 0;margin-top:10px;">
  209. <span class="title">{{ yearhORmontStr }}奖分最高</span>
  210. <div class="nopoint_box" v-if="!prize.id">
  211. <div class="noimg"></div>
  212. <span class="title1" style="padding-bottom:20px;">暂无积分数据</span>
  213. </div>
  214. <div v-else style="display:flex;padding:20px 0 20px 0;">
  215. <userImage width="45px" height="45px" :user_name="prize.name" fontSize=".9" style="margin-right:8px"></userImage>
  216. <div class="rightexamineAndApproveList" style="border:0px">
  217. <p
  218. style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;justify-content: space-between;"
  219. >
  220. <b style="color:#303133;font-size:16px;margin:0px 0 0 5px;">{{ prize.name }}</b>
  221. <span style="color:#26A2FF;font-size:16px;">
  222. <span v-if="prize.point > 0">+</span>
  223. {{ prize.point }} B分
  224. </span>
  225. </p>
  226. <p
  227. style="margin:8px 0 0 5px;font-size:13px;line-height:20px;color:#303133;overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:3;"
  228. >
  229. {{ prize.remark ? prize.remark.customize : '' }}
  230. </p>
  231. </div>
  232. </div>
  233. </div>
  234. </el-row>
  235. <el-row>
  236. <div class="right-all-style" v-loading="highestPrizeBuckleloading" style="background:#fff;padding: 20px 20px 0;">
  237. <span class="title">{{ yearhORmontStr }}扣分最多</span>
  238. <div class="nopoint_box" v-if="!buckle.id">
  239. <div class="noimg"></div>
  240. <span class="title1" style="padding-bottom:10px;">暂无积分数据</span>
  241. </div>
  242. <div v-else style="display:flex;padding:20px 0 20px 0;">
  243. <userImage width="45px" height="45px" :user_name="buckle.name" fontSize=".9" style="margin-right:8px"></userImage>
  244. <div class="rightexamineAndApproveList">
  245. <p
  246. style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#73767c;font-size:16px;display:flex;justify-content: space-between;"
  247. >
  248. <b style="color:#303133;font-size:16px;margin:0px 0 0 5px;">{{ buckle.name }}</b>
  249. <span style="color:#FF9600;font-size:16px;">{{ buckle.point }} B分</span>
  250. </p>
  251. <p
  252. style="margin:8px 0 0 5px;font-size:13px;line-height:20px;color:#303133;overflow:hidden; text-overflow:ellipsis;display:-webkit-box; -webkit-box-orient:vertical;-webkit-line-clamp:3;"
  253. >
  254. {{ buckle.remark ? buckle.remark.customize : '' }}
  255. </p>
  256. </div>
  257. </div>
  258. </div>
  259. </el-row>
  260. </el-col>
  261. </el-col>
  262. </el-row>
  263. </div>
  264. </template>
  265. <script>
  266. export default {
  267. data() {
  268. return {
  269. //筛选项
  270. formData: {
  271. dept_id: 0
  272. },
  273. //时间
  274. time_type: '月份',
  275. time_types: [{ label: '月份', value: '1' }, { label: '年份', value: '2' }],
  276. export_from: {
  277. year: this.$moment().format('YYYY'),
  278. month: this.$moment().format('YYYY-MM')
  279. },
  280. yearhORmontStr: '月',
  281. monthORyear: '2',
  282. //部门
  283. dept_name: [],
  284. dept_tree: [],
  285. //饼图
  286. IntegralFormChartLoad: false, //积分构成loading
  287. IntegralFormnone: false, //积分构成为空或报错,展示的开关
  288. //奖扣分最高积分事件
  289. highestPrizeBuckleloading: false, //奖扣最高loading
  290. prize: {}, //奖分最高
  291. buckle: {}, //扣分最高
  292. //本月积分情况
  293. exclusiveMonthChecked: true, //不包含自动积分加分项
  294. monthlyIntegralList: [
  295. //年积分情况数据
  296. { total_point: '0', name: '月总积分' },
  297. { reward_point: '0', name: '月总奖分' },
  298. { deduction_point: '0', name: '月总扣分' },
  299. { ratio: '0', name: '奖扣分比例' },
  300. { toRatio: { ratio: '0', type: 0 }, name: '对比上月总分' },
  301. { toRatio: { ratio: '0', type: 0 }, name: '对比上月奖分' },
  302. { toRatio: { ratio: '0', type: 0 }, name: '对比上月扣分' }
  303. ],
  304. yearlyIntegralList: [
  305. //年积分情况数据
  306. { total_point: '0', name: '年总积分' },
  307. { reward_point: '0', name: '年总奖分' },
  308. { deduction_point: '0', name: '年总扣分' },
  309. { ratio: '0', name: '奖扣分比例' },
  310. { toRatio: { ratio: '0', type: 0 }, name: '对比去年总分' },
  311. { toRatio: { ratio: '0', type: 0 }, name: '对比去年奖分' },
  312. { toRatio: { ratio: '0', type: 0 }, name: '对比去年扣分' }
  313. ],
  314. monthlyIntegralloading: false, //本月积分情况loading
  315. monthlyIntegralnone: false, //本月积分情况为空或报错,展示的开关
  316. exclusiveMonthBranch: 0 //本月积分情况--部门
  317. };
  318. },
  319. watch: {
  320. time_type(val) {
  321. if (val == '1') {
  322. //月
  323. this.monthORyear = '2';
  324. this.formData.year = null;
  325. this.formData.month = this.$moment().format('YYYY-MM');
  326. this.export_from.month = this.$moment().format('YYYY-MM');
  327. this.yearhORmontStr = '月';
  328. } else if (val == '2') {
  329. //年
  330. this.monthORyear = '3';
  331. this.formData.month = null;
  332. this.formData.year = this.$moment().format('YYYY');
  333. this.export_from.year = this.$moment().format('YYYY');
  334. this.yearhORmontStr = '年';
  335. }
  336. this.executiveFunction();
  337. },
  338. 'export_from.month'(val, old_val) {
  339. this.formData.month = val;
  340. this.executiveFunction();
  341. },
  342. 'export_from.year'(val, old_val) {
  343. this.formData.year = val;
  344. this.executiveFunction();
  345. },
  346. 'formData.dept_id'(val, old_val) {
  347. if (!val) {
  348. this.formData.dept_id = 0;
  349. }
  350. this.executiveFunction();
  351. },
  352. //不包含自动积分加分项
  353. exclusiveMonthChecked() {
  354. this.monthlyIntegral();
  355. }
  356. },
  357. mounted() {
  358. this.formData.month = this.$moment().format('YYYY-MM');
  359. this.executiveFunction();
  360. window.addEventListener('resize', this.selfAdaption);
  361. // if (localStorage.getItem('dept_tree')) {
  362. // this.dept_tree = this.getTreeData(JSON.parse(localStorage.getItem('dept_tree')))
  363. // }else{
  364. // this.$store.dispatch('get_dept_tree').then((res) => {
  365. // this.$nextTick(() => {
  366. // this.dept_tree = this.getTreeData(JSON.parse(localStorage.getItem('dept_tree')))
  367. // })
  368. // })
  369. // }
  370. },
  371. methods: {
  372. //需要执行的所有函数
  373. executiveFunction() {
  374. this.integralForm(); //饼图
  375. this.highestPrizeBuckle(); //奖扣分最高积分事件
  376. this.monthlyIntegral(); //本月积分情况
  377. this.getDepartment(); //部门
  378. },
  379. //echarts自适应
  380. selfAdaption() {
  381. var myChart1 = this.$echarts.init(this.$refs.monthlyIntegralChart);
  382. var myChart2 = this.$echarts.init(this.$refs.IntegralFormChart);
  383. // myChart.setOption(option);
  384. myChart1.resize();
  385. myChart2.resize();
  386. },
  387. //饼图
  388. //分为两列展示,多传legendDataTwo
  389. // drawLine(legendDataOne, legendDataTwo, dadalist) {
  390. drawLine(legendDataOne, dadalist) {
  391. const chart = this.$refs.IntegralFormChart;
  392. //此处可给固定颜色,不给就所有颜色随机
  393. let colors = ['rgb(38, 162, 255)', '#f36f2a', '#fecb09', '#00b6bd', '#e85d53', '#fecb09', '#725197', '#fcb814', '#41a08d', '#425a95', '#ea8b84', '#9d1d62', '#fcb814'];
  394. // let colors = [];
  395. // let legendDataLeng = legendDataOne.length + legendDataTwo.length;
  396. let legendDataLeng = legendDataOne.length;
  397. if (legendDataLeng > colors.length) {
  398. //当列表大于固定颜色时,给随机颜色
  399. let colorsLeng = colors.length;
  400. for (let i = 0; i <= legendDataLeng - colorsLeng; i++) {
  401. // colors.push('#' + Math.random().toString(16).substr(2, 6).toUpperCase());//也是随机色
  402. colors.push('rgb(' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ')');
  403. }
  404. }
  405. //只显示 N 条标题,多余隐藏,但是饼图不会隐藏
  406. let DataLengths = [];
  407. // for (let i in legendDataTwo) {
  408. // if (i < 8) {
  409. // DataLengths.push(legendDataTwo[i]);
  410. // }
  411. // }
  412. let left1 = '45%';
  413. let left2 = '45%';
  414. let leftBT = '25%';
  415. // if (legendDataTwo.length != 0) {
  416. // left1 = "36%";
  417. // leftBT = "18%";
  418. // }
  419. if (chart) {
  420. const myChart = this.$echarts.init(chart);
  421. var legendData1 = legendDataOne;
  422. // var legendData2 = DataLengths;
  423. const option = {
  424. tooltip: { trigger: 'item', formatter: '{b}' },
  425. legend: [
  426. {
  427. type: 'scroll',
  428. orient: 'vertical',
  429. icon: 'square',
  430. left: left1,
  431. align: 'left',
  432. top: '10%',
  433. itemGap: 20,
  434. textStyle: { fontSize: 14, color: 'rgb(48, 49, 51)' },
  435. data: legendData1
  436. }
  437. //分为两列展示
  438. // {
  439. // type: "scroll",
  440. // orient: "vertical",
  441. // icon: "square",
  442. // left: "70%",
  443. // align: "left",
  444. // top: "10%",
  445. // itemGap: 20,
  446. // textStyle: { fontSize: 14, color: "rgb(48, 49, 51)" },
  447. // data: legendData2,
  448. // },
  449. ],
  450. color: colors,
  451. grid: { x: 25, y: 45, x2: 5, y2: 20, borderWidth: 1 },
  452. toolbox: {
  453. show: true,
  454. feature: {
  455. mark: { show: true },
  456. magicType: { show: true, type: ['pie', 'funnel'] }
  457. }
  458. },
  459. series: [
  460. {
  461. name: '',
  462. type: 'pie',
  463. radius: [20, 110],
  464. center: [leftBT, '40%'],
  465. roseType: 'radius',
  466. label: { show: false },
  467. emphasis: { label: { show: false } },
  468. data: dadalist
  469. }
  470. ]
  471. };
  472. myChart.setOption(option);
  473. }
  474. },
  475. integralForm() {
  476. this.IntegralFormChartLoad = true;
  477. let listslength = [];
  478. let params = {};
  479. params.dept_id = this.formData.dept_id;
  480. if (this.monthORyear == '2') {
  481. //月
  482. params.month = this.formData.month;
  483. } else if (this.monthORyear == '3') {
  484. //年
  485. params.year = this.formData.year;
  486. }
  487. this.$axios('get', '/api/integral/statistics/pie/b', params, 'v2')
  488. .then(res => {
  489. let lists = res.data.data.list;
  490. listslength = lists;
  491. let legendData1 = [];
  492. let legendData2 = [];
  493. let dadalist = [];
  494. //分为两列展示
  495. // let listLeng = Math.ceil((lists.length)/2)
  496. for (let i in lists) {
  497. if (lists[i].name.length > 15) {
  498. lists[i].name = lists[i].name.slice(0, 15) + '...';
  499. }
  500. //分为两列展示
  501. // if(i<listLeng){
  502. // legendData1.push(lists[i].name+' '+'奖'+lists[i].reward+' '+'扣'+lists[i].deduction+' '+lists[i].ratio+'%')
  503. // }else{
  504. // legendData2.push(lists[i].name+' '+'奖'+lists[i].reward+' '+'扣'+lists[i].deduction+' '+lists[i].ratio+'%')
  505. // }
  506. if (i < 8) {
  507. legendData1.push(lists[i].name + ' ' + '奖' + lists[i].reward + ' ' + '扣' + lists[i].deduction + ' ' + lists[i].ratio + '%');
  508. } else {
  509. legendData2.push(lists[i].name + ' ' + '奖' + lists[i].reward + ' ' + '扣' + lists[i].deduction + ' ' + lists[i].ratio + '%');
  510. }
  511. let dataListDx = {};
  512. if (lists[i].ratio < 0) {
  513. dataListDx.value = 0;
  514. } else {
  515. dataListDx.value = lists[i].ratio;
  516. }
  517. dataListDx.name = lists[i].name + ' ' + '奖' + lists[i].reward + ' ' + '扣' + lists[i].deduction + ' ' + lists[i].ratio + '%';
  518. // dataListDx.name = lists[i].name
  519. dadalist.push(dataListDx);
  520. }
  521. //分为两列展示,多传legendData2
  522. // this.drawLine(legendData1, legendData2, dadalist); //图表
  523. this.drawLine(legendData1, dadalist); //图表
  524. })
  525. .finally(() => {
  526. if (listslength.length == 0) {
  527. this.IntegralFormnone = true;
  528. } else {
  529. this.IntegralFormnone = false;
  530. }
  531. this.IntegralFormChartLoad = false;
  532. });
  533. },
  534. //奖扣分最高积分事件
  535. highestPrizeBuckle() {
  536. this.highestPrizeBuckleloading = true;
  537. let params = {
  538. page: '1',
  539. page_size: '1'
  540. };
  541. params.dept_ids = this.formData.dept_id;
  542. (params.time_type = this.monthORyear), (params.pt_id = '3');
  543. if (this.monthORyear == '2') {
  544. //月
  545. params.month = this.formData.month;
  546. } else if (this.monthORyear == '3') {
  547. params.year = this.formData.year;
  548. }
  549. this.$axios('get', '/api/integral/statistics/prize/buckle/ranking', params)
  550. .then(res => {
  551. if (res.data.code == 1) {
  552. if (res.data.data.prize.length != 0) {
  553. this.prize = res.data.data.prize[0];
  554. } else {
  555. this.prize = [];
  556. }
  557. if (res.data.data.buckle.length != 0) {
  558. this.buckle = res.data.data.buckle[0];
  559. } else {
  560. this.buckle = [];
  561. }
  562. }
  563. })
  564. .finally(() => {
  565. this.highestPrizeBuckleloading = false;
  566. });
  567. },
  568. //月度积分
  569. monthlyIntegralRanking(date, total, reward, deduction) {
  570. const chart = this.$refs.monthlyIntegralChart;
  571. if (chart) {
  572. const myChart = this.$echarts.init(chart);
  573. const option = {
  574. tooltip: {
  575. trigger: 'axis'
  576. },
  577. color: ['#F56C6C', '#26A2FF', '#FFC100'],
  578. legend: {
  579. right: '0%',
  580. data: ['总积分', '奖分', '扣分']
  581. },
  582. grid: {
  583. left: '3%',
  584. right: '4%',
  585. bottom: '3%',
  586. containLabel: true
  587. },
  588. toolbox: {
  589. feature: {}
  590. },
  591. xAxis: {
  592. type: 'category',
  593. boundaryGap: false,
  594. data: date
  595. },
  596. yAxis: {
  597. type: 'value',
  598. axisLine: {
  599. show: false
  600. },
  601. axisTick: {
  602. show: false
  603. }
  604. },
  605. series: [
  606. {
  607. name: '总积分',
  608. type: 'line',
  609. data: total
  610. },
  611. {
  612. name: '奖分',
  613. type: 'line',
  614. data: reward
  615. },
  616. {
  617. name: '扣分',
  618. type: 'line',
  619. data: deduction
  620. }
  621. ]
  622. };
  623. myChart.setOption(option);
  624. }
  625. },
  626. monthlyIntegral() {
  627. this.monthlyIntegralloading = true;
  628. let params = {};
  629. let listslength = [];
  630. params.dept_id = this.formData.dept_id;
  631. if (this.monthORyear == '2') {
  632. //月
  633. params.month = this.formData.month;
  634. } else if (this.monthORyear == '3') {
  635. //年
  636. params.year = this.formData.year;
  637. }
  638. if (this.exclusiveMonthChecked) {
  639. params.include_fixed = 1;
  640. } else {
  641. params.include_fixed = 0;
  642. }
  643. this.$axios('get', '/api/integral/statistics/curve', params)
  644. .then(res => {
  645. if (res.data.code == 1) {
  646. let lists = res.data.data;
  647. listslength = lists;
  648. if (this.monthORyear == '2') {
  649. this.monthlyIntegralList[0].total_point = lists.total_point;
  650. this.monthlyIntegralList[1].reward_point = lists.reward_point;
  651. this.monthlyIntegralList[2].deduction_point = lists.deduction_point;
  652. this.monthlyIntegralList[3].ratio = lists.ratio;
  653. this.monthlyIntegralList[4].toRatio = lists.contrast_total;
  654. this.monthlyIntegralList[5].toRatio = lists.contrast_reward;
  655. this.monthlyIntegralList[6].toRatio = lists.contrast_deduction;
  656. } else if (this.monthORyear == '3') {
  657. this.yearlyIntegralList[0].total_point = lists.total_point;
  658. this.yearlyIntegralList[1].reward_point = lists.reward_point;
  659. this.yearlyIntegralList[2].deduction_point = lists.deduction_point;
  660. this.yearlyIntegralList[3].ratio = lists.ratio;
  661. this.yearlyIntegralList[4].toRatio = lists.contrast_total;
  662. this.yearlyIntegralList[5].toRatio = lists.contrast_reward;
  663. this.yearlyIntegralList[6].toRatio = lists.contrast_deduction;
  664. }
  665. let dates = []; //日期
  666. let totals = []; //总积分
  667. let rewards = []; //奖分
  668. let deductions = []; //扣分
  669. for (let i in lists.total) {
  670. dates.push(lists.total[i].date);
  671. totals.push(lists.total[i].point);
  672. }
  673. for (let i in lists.reward) {
  674. rewards.push(lists.reward[i].point);
  675. }
  676. for (let i in lists.deduction) {
  677. deductions.push(lists.deduction[i].point);
  678. }
  679. this.monthlyIntegralRanking(dates, totals, rewards, deductions);
  680. }
  681. })
  682. .finally(() => {
  683. if (listslength.total.length == 0) {
  684. this.monthlyIntegralnone = true;
  685. } else {
  686. this.monthlyIntegralnone = false;
  687. }
  688. this.monthlyIntegralloading = false;
  689. });
  690. },
  691. //筛选部门数据
  692. dept1_null(val) {
  693. if (val.length == 0) {
  694. this.formData.dept_id = 0;
  695. } else {
  696. this.formData.dept_id = this.dept_name[this.dept_name.length - 1];
  697. }
  698. this.$nextTick(() => {
  699. this.$refs.dept1.dropDownVisible = false;
  700. });
  701. },
  702. // // 递归判断列表,把最后的children设为undefined
  703. // getTreeData(data){
  704. // for(var i=0;i<data.length;i++){
  705. // if(data[i].children.length<1){
  706. // // children若为空数组,则将children设为undefined
  707. // data[i].children=undefined;
  708. // }else {
  709. // // children若不为空数组,则继续 递归调用 本方法
  710. // this.getTreeData(data[i].children);
  711. // }
  712. // }
  713. // return data;
  714. // },
  715. //获取部门
  716. getDepartment() {
  717. this.$axios('get', '/api/department/tree').then(res => {
  718. this.dept_tree = this.getTreeData(res.data.data.list);
  719. });
  720. },
  721. // 递归判断列表,把最后的children设为undefined
  722. getTreeData(data) {
  723. for (var i = 0; i < data.length; i++) {
  724. if (data[i]._child.length < 1) {
  725. // children若为空数组,则将children设为undefined
  726. data[i]._child = undefined;
  727. } else {
  728. // children若不为空数组,则继续 递归调用 本方法
  729. this.getTreeData(data[i]._child);
  730. }
  731. }
  732. return data;
  733. }
  734. },
  735. beforeDestroy() {
  736. //离开路由
  737. window.removeEventListener('resize', this.selfAdaption); //取消echarts自适应
  738. }
  739. };
  740. </script>
  741. <style scoped="scoped" lang="scss">
  742. .refresh {
  743. margin-top: 100px;
  744. width: 100px;
  745. }
  746. .noData {
  747. text-align: center;
  748. position: fixed;
  749. left: 0;
  750. top: 0;
  751. right: 0;
  752. bottom: 0;
  753. }
  754. .data-all {
  755. margin-bottom: 10%;
  756. color: #595959;
  757. }
  758. .left-all-style {
  759. margin-top: 10px;
  760. padding: 20px;
  761. background: #fff;
  762. border-radius: 5px;
  763. .title {
  764. padding-left: 10px;
  765. font-size: 16px;
  766. font-weight: normal;
  767. border-left: 2px solid #409eff;
  768. }
  769. .titledes {
  770. display: block;
  771. padding-top: 10px;
  772. font-size: 14px;
  773. color: #909399;
  774. }
  775. .noremind {
  776. display: block;
  777. text-align: right;
  778. font-size: 12px;
  779. color: #909399;
  780. cursor: pointer;
  781. }
  782. .noremind:hover {
  783. color: #409eff;
  784. }
  785. .noremind:active {
  786. color: #409eff;
  787. }
  788. }
  789. .right-all-style {
  790. background: #fff;
  791. border-radius: 5px;
  792. margin: 0 0 10px 10px;
  793. .title {
  794. padding-left: 10px;
  795. font-size: 16px;
  796. font-weight: normal;
  797. border-left: 2px solid #409eff;
  798. }
  799. }
  800. .rightexamineAndApproveList {
  801. text-align: left;
  802. width: 100%;
  803. /* border-bottom: 1px solid #efefef; */
  804. }
  805. .nopoint_box {
  806. display: inline-block;
  807. text-align: center;
  808. width: 100%;
  809. margin-bottom: 10px;
  810. .noimg {
  811. display: inline-block;
  812. width: 110px;
  813. height: 110px;
  814. margin: 22px auto 16px;
  815. background: url('../../assets/image/nodata_default.png') no-repeat center;
  816. background-size: 99%;
  817. }
  818. .noperson {
  819. display: inline-block;
  820. width: 110px;
  821. height: 110px;
  822. margin: 22px auto 16px;
  823. background: url('../../assets/image/noperson_default.png') no-repeat center;
  824. background-size: 99%;
  825. }
  826. .title1 {
  827. display: block;
  828. text-align: center;
  829. font-size: 12px !important;
  830. color: #909399 !important;
  831. padding: 0;
  832. }
  833. a {
  834. color: #26a2ff;
  835. }
  836. }
  837. </style>