award_punish.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <template>
  2. <div class="all padding-20">
  3. <el-tabs v-model="tabs">
  4. <el-tab-pane label="奖扣成功" name="success"></el-tab-pane>
  5. <el-tab-pane label="待审批" name="waiting"></el-tab-pane>
  6. <el-tab-pane label="被驳回" name="refuse"></el-tab-pane>
  7. </el-tabs>
  8. <el-row style="margin-bottom: 15px;">
  9. <el-col :span="12">
  10. <el-button type="primary" @click="point_b">奖扣B分</el-button>
  11. <el-button type="primary" @click="point_a" plain>奖扣A分</el-button>
  12. <!-- <div class="red">未成功提交列表</div> -->
  13. </el-col>
  14. <el-col :span="6" :offset="6">
  15. <el-input v-model="keyword" placeholder="输入同事姓名/内容" @keyup.enter.native="getData">
  16. <el-button slot="append" @click="getData" icon="el-icon-search"></el-button>
  17. </el-input>
  18. </el-col>
  19. </el-row>
  20. <el-table v-if="tabs == 'success'" res="table1" :data="dataList" stripe fit v-loading="table_loading" @row-click="open_detail">
  21. <el-table-column label="姓名" prop="employee_id" align="left">
  22. <template slot-scope="scope">
  23. <div class="flex-box flex-contet-conter" >
  24. <userImage :img_url="scope.row.employee_img_url" :user_name="scope.row.employee_name" width="50px" height="50px"></userImage>
  25. <span style="margin-left: 10px; line-height: 50px;">{{ scope.row.employee_name }}</span>
  26. </div>
  27. </template>
  28. </el-table-column>
  29. <el-table-column show-overflow-tooltip label="奖扣内容">
  30. <template slot-scope="scope">
  31. <span class="font-flex-word" style="max-width: 200px;">{{ scope.row.remark_data.customize}}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="积分" width="120">
  35. <template slot-scope="scope">
  36. <span :class="{green: scope.row.point < 0, red: scope.row.point > 0 }">
  37. <span v-show="scope.row.point > 0">+</span>
  38. {{ scope.row.point }} {{ point_name(scope.row.pt_id) }}
  39. </span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="奖扣时间" width="150">
  43. <template slot-scope="scope">
  44. {{ cuttString(scope.row.create_time) }}
  45. </template>
  46. </el-table-column>
  47. <template slot="empty">
  48. <noData></noData>
  49. </template>
  50. </el-table>
  51. <el-table v-else :data="dataList2" res="table2" stripe fit v-loading="table_loading" @row-click="open_detail1">
  52. <el-table-column label="姓名" prop="employee_id" align="left">
  53. <template slot-scope="scope">
  54. <div class="flex-box flex-contet-conter">
  55. <userImage :img_url="scope.row.employee_img_url" :user_name="scope.row.employee_name" width="50px" height="50px"></userImage>
  56. <span style="margin-left: 10px; line-height: 50px;">{{ scope.row.employee_name }}</span>
  57. </div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column show-overflow-tooltip label="奖扣内容">
  61. <template slot-scope="scope">
  62. {{ scope.row.remark.customize }}
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="奖扣时间" width="150">
  66. <template slot-scope="scope">
  67. {{ cuttString(scope.row.event_time) }}
  68. </template>
  69. </el-table-column>
  70. <template slot="empty">
  71. <noData></noData>
  72. </template>
  73. </el-table>
  74. <center style="margin-top: 15px;">
  75. <el-pagination
  76. background
  77. @size-change="handleSizeChange"
  78. @current-change="handleCurrentChange"
  79. :current-page="formData.page"
  80. :page-sizes="[10, 20, 50, 100]"
  81. layout="total, sizes, prev, pager, next"
  82. :page-size="pageLimit"
  83. :total="formData.total"
  84. ></el-pagination>
  85. </center>
  86. <el-drawer title="奖扣详情" :visible.sync="drawer" ref="drawer" :with-header="false" :size="'600px'" direction="rtl">
  87. <div class="drawer_title">奖扣详情</div>
  88. <div class="detail_popup" v-loading="detail_loading" v-if="detail_info !== null">
  89. <el-row :gutter="10" style="padding-bottom:10px;border-bottom:1px #f8f8f8 solid;">
  90. <el-col :span="24">
  91. <div class="flex-box flex-v-ce">
  92. <userImage :user_name="detail_info.employee_name" :img_url="detail_info.img_url" width="50px" height="50px" fontSize="1"></userImage>
  93. <span style="line-height:50px; margin-left:10px;margin:0px 10px;">{{ detail_info.employee_name }}</span>
  94. <span class="red point" v-show="detail_info.point >= 0 && detail_info.point"> +{{ detail_info.point }}</span>
  95. <span class="green point" v-show="detail_info.point < 0 && detail_info.point"> {{ detail_info.point }}</span>
  96. <span v-show="detail_info.point" style="margin-left: 5px;"> {{ detail_info.pt_id == 1 ? '绩效分' : detail_info.pt_id == 2 ? 'A分' : detail_info.pt_id == 3 ? 'B分' : '' }}</span>
  97. </div>
  98. </el-col>
  99. </el-row>
  100. <el-row :gutter="10">
  101. <el-col :span="4">任务描述</el-col>
  102. <el-col :span="20" v-if="detail_info.remark">{{ detail_info.remark && (detail_info.remark.customize || detail_info.remark.rule) }}</el-col>
  103. </el-row>
  104. <el-row :gutter="10">
  105. <el-col :span="4">规则分类</el-col>
  106. <el-col :span="20">{{ detail_info.rule_list }}</el-col>
  107. </el-row>
  108. <el-row :gutter="10" v-show="detail_info.rule_list">
  109. <el-col :span="4">事件时间</el-col>
  110. <el-col :span="20">{{ detail_info.date }}</el-col>
  111. </el-row>
  112. <el-row :gutter="10" v-show="detail_info.source_type_mark">
  113. <el-col :span="4" style="margin-bottom:5px;">来源类型</el-col>
  114. <el-col :span="20">{{ detail_info.source_type_mark }}</el-col>
  115. </el-row>
  116. <el-row :gutter="10" v-show="!detail_info.rule_id">
  117. <el-col :span="4">记录人</el-col>
  118. <el-col :span="20">{{ detail_info.employee_name }}</el-col>
  119. </el-row>
  120. <el-row :gutter="10" :v-if="detail_info.files">
  121. <el-col v-for="(item, index) in detail_info.files" :key="index" :span="4">{{ index == 0 ? '图片' : '' }}</el-col>
  122. <el-col :span="20">
  123. <el-image
  124. v-for="(item, index) in detail_info.files"
  125. :key="index"
  126. style="width: 100px; height: 100px;margin-right:8px"
  127. :src="item"
  128. :preview-src-list="detail_info.files"
  129. ></el-image>
  130. </el-col>
  131. </el-row>
  132. <div v-show="detail_info.rule_item_id">
  133. <p class="row_title">规则依据</p>
  134. <el-row :gutter="10">
  135. <el-col :span="4">规则分类</el-col>
  136. <el-col :span="19">{{ detail_info.rule_list }}</el-col>
  137. </el-row>
  138. <el-row v-if="detail_info.remark && detail_info.remark.rule">
  139. <el-col :span="4">积分规则</el-col>
  140. <el-col :span="19">{{ detail_info.remark.rule }}</el-col>
  141. </el-row>
  142. <el-row v-if="detail_info.rule_item">
  143. <el-col :span="4">积分</el-col>
  144. <el-col :span="19" v-show="detail_info.rule_item.min_point == detail_info.rule_item.max_point">{{ detail_info.rule_item.min_point }}</el-col>
  145. <el-col :span="19" v-show="detail_info.rule_item.min_point != detail_info.rule_item.max_point">
  146. {{ detail_info.rule_item.min_point }} ~ {{ detail_info.rule_item.max_point }}
  147. </el-col>
  148. </el-row>
  149. </div>
  150. <div v-show="detail_info.process">
  151. <Steps :process="detail_info.process"></Steps>
  152. </div>
  153. <div class="btn_danger flex-box flex-center-center" v-if="detail_info.process.length==1&&(detail_info.event_type==3||detail_info.event_type==4)">
  154. <el-button type="danger" class="danger" @click="revocation" :loading="cx_loading">撤销</el-button>
  155. </div>
  156. </div>
  157. </el-drawer>
  158. <el-drawer title="奖扣详情" :visible.sync="detailShow" :with-header="false" :size="'600px'" direction="rtl">
  159. <div class="drawer_title">奖扣详情</div>
  160. <div class="detail_popup" v-loading="detail_loading" v-if="detail_info !== null">
  161. <el-row :gutter="10" style="padding-bottom:10px;border-bottom:1px #f8f8f8 solid;">
  162. <el-col :span="24" >
  163. <div class="flex-box flex-v-ce">
  164. <userImage :user_name="detail_info.employee_name" :img_url="detail_info.img_url" width="50px" height="50px" fontSize="1"></userImage>
  165. <span style="line-height:50px; margin-left:10px;margin:0px 10px;">{{ detail_info.employee_name }}</span>
  166. <span class="red point" v-show="detail_info.point >= 0 && detail_info.point">+{{ detail_info.point }}</span>
  167. <span class="green point" v-show="detail_info.point < 0 && detail_info.point">{{ detail_info.point }}</span>
  168. <span v-show="detail_info.point" style="margin-left: 5px;">{{ detail_info.pt_id == 1 ? '绩效分' : detail_info.pt_id == 2 ? 'A分' : detail_info.pt_id == 3 ? 'B分' : '' }}</span>
  169. </div>
  170. </el-col>
  171. </el-row>
  172. <el-row :gutter="10" v-show="detail_info.source_type_mark">
  173. <el-col :span="4">来源类型</el-col>
  174. <el-col :span="20">{{ detail_info.source_type_mark }}</el-col>
  175. </el-row>
  176. <el-row :gutter="10" v-for="(item, index) in detail_info.detail" :key="index">
  177. <el-col :span="4">{{ item.key }}</el-col>
  178. <el-col :span="20" v-if="item.key == '附件'">
  179. <el-image style="width: 100px; height: 100px;margin-right:8px" v-for="(item2, index2) in item.value" :key="index2" :src="item2" :preview-src-list="item.value"></el-image>
  180. </el-col>
  181. <el-col :span="20" v-else>{{ item.value }}</el-col>
  182. </el-row>
  183. <el-row :gutter="10" :v-if="detail_info.files">
  184. <el-col v-for="(item, index) in detail_info.files" :key="index" :span="4">{{ index == 0 ? '图片' : '' }}</el-col>
  185. <el-col :span="20">
  186. <el-image
  187. v-for="(item, index) in detail_info.files"
  188. :key="index"
  189. style="width: 100px; height: 100px;margin-right:8px"
  190. :src="item"
  191. :preview-src-list="detail_info.files"
  192. ></el-image>
  193. </el-col>
  194. </el-row>
  195. <div v-show="detail_info.rule_id">
  196. <p class="row_title">规则依据</p>
  197. <el-row :gutter="10">
  198. <el-col :span="4">规则分类</el-col>
  199. <el-col :span="19">{{ detail_info.rule_name }}</el-col>
  200. </el-row>
  201. <el-row v-if="detail_info.item_name">
  202. <el-col :span="4">积分规则</el-col>
  203. <el-col :span="19">{{ detail_info.item_name }}</el-col>
  204. </el-row>
  205. <el-row v-if="detail_info.item_id > 0">
  206. <el-col :span="4">积分</el-col>
  207. <el-col :span="19" v-show="detail_info.item_min_point == detail_info.item_max_point">{{ detail_info.item_min_point }}</el-col>
  208. <el-col :span="19" v-show="detail_info.item_min_point != detail_info.item_max_point">
  209. {{ detail_info.item_min_point }} ~ {{ detail_info.item_max_point }}
  210. </el-col>
  211. </el-row>
  212. </div>
  213. <div v-show="detail_info.process">
  214. <Steps :process="detail_info.process"></Steps>
  215. </div>
  216. <div class="btn_danger flex-box flex-center-center" v-if="detail_info.applyor_id==userId&&detail_info.status==0&&detail_info.source_type==3">
  217. <el-button type="danger" class="danger" @click="revocation2" :loading="cx_loading">撤销</el-button>
  218. </div>
  219. </div>
  220. </el-drawer>
  221. <bonusPointsPopup :isBreak="isBreak" :title="popuTitle" :visible.sync="popupVisible" :ruleOnoff="ruleOnoff" :refresh.sync="refreshData" :integralType.sync="integralType">
  222. <div style=" position: absolute;top: 0px;right: 0;" class="yellow">最多只能选择30人</div>
  223. </bonusPointsPopup>
  224. </div>
  225. </template>
  226. <script>
  227. import EmployeeSelector from '@/components/EmployeeSelector.vue';
  228. import moment from 'moment';
  229. import bonusPointsPopup from '@/components/bonusPointsPopup';
  230. import Steps from '@/components/Steps';
  231. import {getToken,getCache } from '@/api/auth';
  232. export default {
  233. data() {
  234. return {
  235. ruleOnoff: false,
  236. refreshData: '',
  237. popuTitle: '奖扣A分',
  238. popupVisible: false,
  239. integralType: 0,
  240. table_loading: false,
  241. formData: {
  242. page: 1,
  243. page_size: 10,
  244. total: 0
  245. },
  246. tabs: 'success',
  247. dataList: [],
  248. dataList2: [],
  249. pageLimit: 10,
  250. keyword: '',
  251. rule_list: [],
  252. drawer: false,
  253. detail_loading: false,
  254. detail_info: {
  255. process:[]
  256. },
  257. detailShow: false,
  258. employee_name: JSON.parse(localStorage.getItem('SET_EMPLOYEE_MAP')),
  259. userId:'',
  260. cx_loading:false,
  261. selectId:'',//打开详情ID
  262. // 长连接
  263. isBreak:false,//是否打开缓存的未完成奖扣
  264. };
  265. },
  266. components: {
  267. EmployeeSelector,
  268. bonusPointsPopup,
  269. Steps
  270. },
  271. mounted() {
  272. this.cheakAx()
  273. this.userId=this.$getUserData().id
  274. this.getData()
  275. setTimeout(() => {
  276. let award_punish=getCache('award_punish')
  277. if(award_punish&&award_punish.obj.length>0){
  278. this.isBreak=true;
  279. award_punish.type==3? this.point_b():this.point_a()
  280. }else{
  281. this.isBreak=false;
  282. }
  283. }, 1000)
  284. },
  285. watch: {
  286. tabs(val) {
  287. this.dataList = [];
  288. this.dataList2 = [];
  289. this.formData.total = 0;
  290. this.keyword = '';
  291. this.formData.page = 1;
  292. this.formData.page_size = 10;
  293. this.getData();
  294. },
  295. refreshData(val) {
  296. this.getData();
  297. }
  298. },
  299. methods: {
  300. cheakAx() {
  301. this.$axios('get', '/api/integral/site/config')
  302. .then(res => {
  303. let data = res.data.data;
  304. if(data.specified_rule_item){
  305. this.ruleOnoff = data.specified_rule_item == 1 ? true : false;
  306. }else{
  307. this.ruleOnoff = false
  308. }
  309. })
  310. },
  311. // 撤销待审批
  312. revocation2(){
  313. var that=this;
  314. this.$confirm('撤销此项数据将不可恢复,是否撤销?', '提示', {
  315. confirmButtonText: '确定',
  316. cancelButtonText: '取消',
  317. type: 'warning'
  318. }).then(() => {
  319. let data = {
  320. review_id: that.selectId,
  321. };
  322. that.cx_loading = true;
  323. that.$axios('post', '/api/integral/review/destroy', data).then(res => {
  324. if (res.data.code == 1) {
  325. that.getData()
  326. } else {
  327. that.$message.error(res.data.data.msg);
  328. }
  329. }).finally(() => {
  330. that.detailShow = false;
  331. that.cx_loading = false;
  332. });
  333. })
  334. },
  335. // 撤销奖扣
  336. revocation(){
  337. var that=this;
  338. this.$confirm('撤销此项数据将不可恢复,是否撤销?', '提示', {
  339. confirmButtonText: '确定',
  340. cancelButtonText: '取消',
  341. type: 'warning'
  342. }).then(() => {
  343. let data = {
  344. target_id: that.selectId,
  345. type:1
  346. };
  347. that.cx_loading = true;
  348. that.$axios('post', '/api/integral/review/prize/destroy', data).then(res => {
  349. if (res.data.code == 1) {
  350. that.getData()
  351. } else {
  352. that.$message.error(res.data.data.msg);
  353. }
  354. }).finally(() => {
  355. that.cx_loading = false;
  356. that.drawer = false;
  357. });
  358. })
  359. },
  360. getEmployeeName(id) {
  361. for (const key in this.employee_name) {
  362. if (this.employee_name[key].id == id) {
  363. return this.employee_name[key].name;
  364. }
  365. }
  366. },
  367. open_detail1(item) {
  368. this.detailShow = true;
  369. this.selectId=item.id
  370. let data = {
  371. review_id: item.id
  372. };
  373. this.detail_loading = true;
  374. this.$axios('get', '/api/integral/review', data).then(res => {
  375. if (res.data.code == 1) {
  376. this.detail_info = res.data.data;
  377. } else {
  378. this.$message.error(res.data.data.msg);
  379. }
  380. })
  381. .finally(() => {
  382. this.detail_loading = false;
  383. });
  384. },
  385. open_detail(item) {
  386. this.drawer = true;
  387. let data = {event_id: item.id};
  388. this.selectId=item.id
  389. this.detail_loading = true;
  390. this.$axios('get', '/api/integral/statistics/integral/info', data).then(res => {
  391. if (res.data.code == 1) {
  392. this.detail_info = res.data.data;
  393. } else {
  394. this.$message.error(res.data.data.msg);
  395. }
  396. })
  397. .finally(() => {
  398. this.detail_loading = false;
  399. });
  400. },
  401. cuttString(data) {
  402. return data.substring(0, 10);
  403. },
  404. point_a() {
  405. this.popupVisible = false;
  406. this.integralType = 2;
  407. this.popuTitle = '奖扣A分';
  408. this.popupVisible = true;
  409. },
  410. point_b() {
  411. this.popupVisible = false;
  412. this.integralType = 3;
  413. this.popuTitle = '奖扣B分';
  414. this.popupVisible = true;
  415. },
  416. point_name(id) {
  417. return this.$getTyps(id).name;
  418. },
  419. handleCurrentChange(val) {
  420. this.formData.page = val;
  421. this.getData();
  422. },
  423. handleSizeChange(val) {
  424. this.pageLimit = val;
  425. this.formData.page_size = this.pageLimit;
  426. this.getData();
  427. },
  428. getData() {
  429. this.table_loading = true;
  430. let data = {};
  431. if (this.tabs == 'success') {
  432. data = {
  433. page: this.formData.page,
  434. page_size: this.formData.page_size,
  435. recorder_id:this.userId,
  436. source_type: '1',
  437. keyword: this.keyword
  438. };
  439. } else if (this.tabs == 'waiting') {
  440. data = {
  441. page: this.formData.page,
  442. page_size: this.formData.page_size,
  443. keyword: this.keyword,
  444. pt_id: '0',
  445. type: 'waiting'
  446. };
  447. } else {
  448. data = {
  449. page: this.formData.page,
  450. page_size: this.formData.page_size,
  451. keyword: this.keyword,
  452. pt_id: '0',
  453. type: 'refuse'
  454. };
  455. }
  456. this.$axios('get', this.tabs == 'success' ? '/api/integral/statistics/integral' : '/api/integral/review/entry/list', data)
  457. .then(res => {
  458. if (res.data.code == 1) {
  459. if(this.tabs == 'success'){
  460. this.dataList = res.data.data.list;
  461. }else{
  462. this.dataList2 = res.data.data.list;
  463. }
  464. this.formData.total = res.data.data.total;
  465. }
  466. })
  467. .finally(() => {
  468. this.table_loading = false;
  469. });
  470. }
  471. }
  472. };
  473. </script>
  474. <style scoped lang="scss">
  475. .btn_danger{
  476. margin-top: 20px;
  477. }
  478. .btn_danger .danger{
  479. width: 120px;
  480. }
  481. .box {
  482. background-color: #ffffff;
  483. padding: 20px;
  484. min-height: calc(100vh - 160px);
  485. }
  486. .examine_steps {
  487. .el-step {
  488. flex-basis: auto !important;
  489. }
  490. }
  491. .detail_popup {
  492. padding: 20px;
  493. height: calc(100vh - 100px);
  494. overflow: auto;
  495. .row_title {
  496. position: relative;
  497. margin: 0 0 20px 0;
  498. padding-top: 12px;
  499. font-size: 16px;
  500. color: #303133;
  501. line-height: 22px;
  502. }
  503. .row_title:before {
  504. position: absolute;
  505. top: 0;
  506. content: ' ';
  507. width: 100%;
  508. border-top: 1px #f8f8f8 solid;
  509. }
  510. .el-row {
  511. margin-bottom: 10px;
  512. font-size: 14px;
  513. .el-col-4 {
  514. color: #606266;
  515. }
  516. }
  517. }
  518. .drawer_title {
  519. font-size: 18px;
  520. padding: 20px;
  521. border-bottom: 1px #efefef solid;
  522. }
  523. ::v-deep .el-table tr:hover {
  524. cursor: pointer;
  525. }
  526. </style>