award_punish.vue 18 KB

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