individual_statistics.vue 35 KB

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