award_punish.vue 16 KB

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