award_punish.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  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" :src="item.value[0]" :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" :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. refreshData: '',
  217. popuTitle: '奖扣A分',
  218. popupVisible: false,
  219. integralType: 0,
  220. table_loading: false,
  221. formData: {
  222. page: 1,
  223. page_size: 10,
  224. total: 0
  225. },
  226. tabs: 'success',
  227. dataList: [],
  228. dataList2: [],
  229. pageLimit: 10,
  230. keyword: '',
  231. rule_list: [],
  232. drawer: false,
  233. detail_loading: false,
  234. detail_info: {
  235. process:[]
  236. },
  237. detailShow: false,
  238. employee_name: JSON.parse(localStorage.getItem('SET_EMPLOYEE_MAP')),
  239. userId:'',
  240. cx_loading:false,
  241. selectId:'',//打开详情ID
  242. };
  243. },
  244. components: {
  245. EmployeeSelector,
  246. bonusPointsPopup,
  247. noData,
  248. Steps
  249. },
  250. mounted() {
  251. this.userId=this.$getUserData().id
  252. this.getData()
  253. },
  254. watch: {
  255. tabs(val) {
  256. this.dataList = [];
  257. this.dataList2 = [];
  258. this.formData.total = 0;
  259. this.keyword = '';
  260. this.formData.page = 1;
  261. this.formData.page_size = 10;
  262. this.getData();
  263. },
  264. refreshData(val) {
  265. this.getData();
  266. }
  267. },
  268. methods: {
  269. // 撤销待审批
  270. revocation2(){
  271. var that=this;
  272. this.$confirm('撤销此项数据将不可恢复,是否撤销?', '提示', {
  273. confirmButtonText: '确定',
  274. cancelButtonText: '取消',
  275. type: 'warning'
  276. }).then(() => {
  277. let data = {
  278. review_id: that.selectId,
  279. };
  280. that.cx_loading = true;
  281. that.$axios('post', '/api/integral/review/destroy', data).then(res => {
  282. if (res.data.code == 1) {
  283. that.getData()
  284. } else {
  285. that.$message.error(res.data.data.msg);
  286. }
  287. }).finally(() => {
  288. that.detailShow = false;
  289. that.cx_loading = false;
  290. });
  291. })
  292. },
  293. // 撤销奖扣
  294. revocation(){
  295. var that=this;
  296. this.$confirm('撤销此项数据将不可恢复,是否撤销?', '提示', {
  297. confirmButtonText: '确定',
  298. cancelButtonText: '取消',
  299. type: 'warning'
  300. }).then(() => {
  301. let data = {
  302. target_id: that.selectId,
  303. type:1
  304. };
  305. that.cx_loading = true;
  306. that.$axios('post', '/api/integral/review/prize/destroy', data).then(res => {
  307. if (res.data.code == 1) {
  308. that.getData()
  309. } else {
  310. that.$message.error(res.data.data.msg);
  311. }
  312. }).finally(() => {
  313. that.cx_loading = false;
  314. that.drawer = false;
  315. });
  316. })
  317. },
  318. getEmployeeName(id) {
  319. for (const key in this.employee_name) {
  320. if (this.employee_name[key].id == id) {
  321. return this.employee_name[key].name;
  322. }
  323. }
  324. },
  325. open_detail1(item) {
  326. this.detailShow = true;
  327. this.selectId=item.id
  328. let data = {
  329. review_id: item.id
  330. };
  331. this.detail_loading = true;
  332. this.$axios('get', '/api/integral/review', data).then(res => {
  333. if (res.data.code == 1) {
  334. this.detail_info = res.data.data;
  335. } else {
  336. this.$message.error(res.data.data.msg);
  337. }
  338. })
  339. .finally(() => {
  340. this.detail_loading = false;
  341. });
  342. },
  343. open_detail(item) {
  344. this.drawer = true;
  345. let data = {event_id: item.id};
  346. this.selectId=item.id
  347. this.detail_loading = true;
  348. this.$axios('get', '/api/integral/statistics/integral/info', data).then(res => {
  349. if (res.data.code == 1) {
  350. this.detail_info = res.data.data;
  351. } else {
  352. this.$message.error(res.data.data.msg);
  353. }
  354. })
  355. .finally(() => {
  356. this.detail_loading = false;
  357. });
  358. },
  359. cuttString(data) {
  360. return data.substring(0, 10);
  361. },
  362. point_a() {
  363. this.popupVisible = false;
  364. this.integralType = 2;
  365. this.popuTitle = '奖扣A分';
  366. this.popupVisible = true;
  367. },
  368. point_b() {
  369. this.popupVisible = false;
  370. this.integralType = 3;
  371. this.popuTitle = '奖扣B分';
  372. this.popupVisible = true;
  373. },
  374. point_name(id) {
  375. return this.$getTyps(id).name;
  376. },
  377. handleCurrentChange(val) {
  378. this.formData.page = val;
  379. this.getData();
  380. },
  381. handleSizeChange(val) {
  382. this.pageLimit = val;
  383. this.formData.page_size = this.pageLimit;
  384. this.getData();
  385. },
  386. getData() {
  387. this.table_loading = true;
  388. let data = {};
  389. if (this.tabs == 'success') {
  390. data = {
  391. page: this.formData.page,
  392. page_size: this.formData.page_size,
  393. recorder_id:this.userId,
  394. source_type: '1',
  395. keyword: this.keyword
  396. };
  397. } else if (this.tabs == 'waiting') {
  398. data = {
  399. page: this.formData.page,
  400. page_size: this.formData.page_size,
  401. keyword: this.keyword,
  402. pt_id: '0',
  403. type: 'waiting'
  404. };
  405. } else {
  406. data = {
  407. page: this.formData.page,
  408. page_size: this.formData.page_size,
  409. keyword: this.keyword,
  410. pt_id: '0',
  411. type: 'refuse'
  412. };
  413. }
  414. this.$axios('get', this.tabs == 'success' ? '/api/integral/statistics/integral' : '/api/integral/review/entry/list', data)
  415. .then(res => {
  416. if (res.data.code == 1) {
  417. if(this.tabs == 'success'){
  418. this.dataList = res.data.data.list;
  419. }else{
  420. this.dataList2 = res.data.data.list;
  421. }
  422. this.formData.total = res.data.data.total;
  423. }
  424. })
  425. .finally(() => {
  426. this.table_loading = false;
  427. });
  428. }
  429. }
  430. };
  431. </script>
  432. <style scoped lang="scss">
  433. .btn_danger{
  434. margin-top: 20px;
  435. }
  436. .btn_danger .danger{
  437. width: 120px;
  438. }
  439. .box {
  440. background-color: #ffffff;
  441. padding: 20px;
  442. min-height: calc(100vh - 160px);
  443. }
  444. .examine_steps {
  445. .el-step {
  446. flex-basis: auto !important;
  447. }
  448. }
  449. .detail_popup {
  450. padding: 20px;
  451. height: calc(100vh - 100px);
  452. overflow: auto;
  453. .row_title {
  454. position: relative;
  455. margin: 0 0 20px 0;
  456. padding-top: 12px;
  457. font-size: 16px;
  458. color: #303133;
  459. line-height: 22px;
  460. }
  461. .row_title:before {
  462. position: absolute;
  463. top: 0;
  464. content: ' ';
  465. width: 100%;
  466. border-top: 1px #f8f8f8 solid;
  467. }
  468. .el-row {
  469. margin-bottom: 10px;
  470. font-size: 14px;
  471. .el-col-4 {
  472. color: #606266;
  473. }
  474. }
  475. }
  476. .drawer_title {
  477. font-size: 18px;
  478. padding: 20px;
  479. border-bottom: 1px #efefef solid;
  480. }
  481. ::v-deep .el-table tr:hover {
  482. cursor: pointer;
  483. }
  484. </style>