individual_statistics.vue 31 KB

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