individual_statistics.vue 38 KB

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