myGrantAward.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <div>
  3. <FormBox style="margin: 0px;background-color: #fff;">
  4. <div class="form-item">
  5. <div class="form-label">姓名搜索</div>
  6. <div class="form-search">
  7. <el-select style="margin: 0 10px;" v-model="formData.employee_id" size="medium" filterable placeholder="请输入或选择人员" clearable>
  8. <el-option v-for="item in employee_map" :key="item.id" :label="item.name" :value="item.id"></el-option>
  9. </el-select>
  10. </div>
  11. </div>
  12. <div class="form-item">
  13. <div class="form-label">事件时间</div>
  14. <div class="form-search">
  15. <el-date-picker size="medium" value-format="yyyy-MM-dd" :picker-options="pickerOptions" v-model="date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
  16. </div>
  17. </div>
  18. <div class="form-item">
  19. <div class="form-label">内容搜索</div>
  20. <div class="form-search">
  21. <el-input size="medium" v-model="formData.keyword" clearable placeholder="请输入" maxlength="20"></el-input>
  22. </div>
  23. </div>
  24. </FormBox>
  25. <div class="all">
  26. <div>
  27. <el-table :data="list" style="width: 100%" v-loading="loading">
  28. <el-table-column prop="employee_name" label="姓名" align="left" width="200">
  29. <template slot-scope="scope">
  30. <div class="flex-box">
  31. <userImage :img_url="scope.row.employee_img_url" :user_name="scope.row.employee_name" width="50px" height="50px"></userImage>
  32. <div style="height: 50px;padding-left: 10px;" class="flex-box-v flex-h-zhu">
  33. <span>{{scope.row.employee_name}}</span>
  34. </div>
  35. </div>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="name" min-width="300" label="奖票事件">
  39. <template slot-scope="scope">
  40. <span>{{scope.row.remark.customize||scope.row.remark.rule}}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="ct" label="事件时间" width="100">
  44. <template slot-scope="scope">
  45. <span>{{$moment(scope.row.date+'').format("YYYY-MM-DD")}}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="操作" align="right">
  49. <template slot-scope="scope">
  50. <el-link type="primary" :underline="false" @click="openDetail(scope.row)">查看详情</el-link>
  51. </template>
  52. </el-table-column>
  53. <template slot="empty">
  54. <noData></noData>
  55. </template>
  56. </el-table>
  57. <center style="padding: 20px 0;">
  58. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"
  59. :page-sizes="[10, 20, 50, 100]" layout="total, sizes, prev, pager, next" :page-size="page_size" :total="total">
  60. </el-pagination>
  61. </center>
  62. </div>
  63. </div>
  64. <!-- 检查单详情 -->
  65. <BrawerBox :showDrawer.sync="isShowDetail" drawerTitle="奖票详情">
  66. <template slot="main">
  67. <div>
  68. <div class="flex-box-v">
  69. <div class="message-box">
  70. <div class="flex-box-ce">
  71. <div class="fontColorC">奖票对象</div>
  72. <div class="flex-1">{{detail.employee_name}}</div>
  73. </div>
  74. <div class="flex-box-ce">
  75. <div class="fontColorC">事件时间</div>
  76. <div class="flex-1">{{$moment(detail.date+'').format("YYYY-MM-DD")}}</div>
  77. </div>
  78. <div class="flex-box-ce">
  79. <div class="fontColorC">发放人</div>
  80. <div class="flex-1">{{detail.publisher_name||'--'}}</div>
  81. </div>
  82. <div class="flex-box-ce">
  83. <div class="fontColorC">发放时间</div>
  84. <div class="flex-1">{{detail.ct}}</div>
  85. </div>
  86. <div class="flex-box-ce">
  87. <div class="fontColorC">奖票事件</div>
  88. <div class="flex-1">{{detail.remark.customize||detail.remark.rule}}</div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="message-box" v-if="detail.event">
  93. <div style="font-size: 16px;margin-bottom: 20px;">对应积分事件</div>
  94. <div class="flex-box" @click="open_detail()" style="cursor: pointer;background-color: rgb(248, 252, 255);margin-bottom: 14px;position: relative;padding: 8px;border-radius: 5px;">
  95. <div class="flex-1" style="padding-right: 20px;">
  96. {{detail.event.remark.customize||detail.event.remark.rule}}
  97. </div>
  98. <div class="red" v-if="detail.event.point>0">+{{detail.event.point}} {{detail.event.pt_id==3? 'B分':'A分'}}</div>
  99. <div class="green" v-else>{{detail.event.point}} {{detail.event.pt_id==3? 'B分':'A分'}}</div>
  100. </div>
  101. </div>
  102. </div>
  103. </template>
  104. <template slot="footer">
  105. <el-button type="danger" plain @click="deleteItem" v-if="detail.publisher_id==$getUserData().id||($supremeAuthority()!='dept_manager'&&$supremeAuthority()!='employee')">{{detail.publisher_id==$getUserData().id ?'撤回奖票':'删除奖票'}}</el-button>
  106. <div class="flex-1"></div>
  107. <el-button plain @click="isShowDetail=false">关 闭</el-button>
  108. </template>
  109. </BrawerBox>
  110. <el-drawer title="事件详情" :visible.sync="detail_popup" ref="drawer" :with-header="false" :width="'500px'" direction="rtl">
  111. <div class="drawer_title flex-box-ce">
  112. <span class="flex-1">事件详情</span>
  113. <i @click="detail_popup=false" style="cursor: pointer;" class="el-icon-close"></i>
  114. </div>
  115. <div class="detail_popup" v-loading="detail_loading" v-if="detail_info !== null">
  116. <el-row style="padding-bottom:10px;border-bottom:1px #f8f8f8 solid;">
  117. <div class="flex-box flex-v-ce">
  118. <userImage :user_name="detail_info.employee_name" :img_url="detail_info.img_url" width="50px" height="50px" fontSize="1"></userImage>
  119. <span style="font-size: 18px;line-height:50px; margin-left:10px;margin-right:4px;">{{ detail_info.employee_name }}</span>
  120. <span class="red point" v-if="detail_info.point >= 0">+{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  121. <span class="green point" v-if="detail_info.point < 0">{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  122. </div>
  123. </el-row>
  124. <el-row >
  125. <el-col :span="6">事件内容</el-col>
  126. <el-col :span="18" v-if="detail_info.remark">{{ detail_info.remark && (detail_info.remark.customize || detail_info.remark.rule) }}</el-col>
  127. </el-row>
  128. <el-row v-show="detail_info.files && detail_info.files.length > 0">
  129. <el-col :span="18" :offset="6">
  130. <el-image
  131. v-for="(itme, index) in detail_info.files"
  132. :key="index"
  133. style="width: 80px; height: 80px;margin: 0 5px;"
  134. :src="itme"
  135. :preview-src-list="detail_info.files"
  136. ></el-image>
  137. </el-col>
  138. </el-row>
  139. <el-row v-show="detail_info.rule_list">
  140. <el-col :span="6">规则分类</el-col>
  141. <el-col :span="18">{{ detail_info.rule_list }}</el-col>
  142. </el-row>
  143. <el-row v-show="detail_info.source_type_mark">
  144. <el-col :span="6">来源类型</el-col>
  145. <el-col :span="18">{{ detail_info.source_type_mark }}</el-col>
  146. </el-row>
  147. <el-row v-show="detail_info.recorder_name">
  148. <el-col :span="6">记录人</el-col>
  149. <el-col :span="18">{{ detail_info.recorder_name }}</el-col>
  150. </el-row>
  151. <el-row v-show="detail_info.date">
  152. <el-col :span="6">事件时间</el-col>
  153. <el-col :span="18">{{ detail_info.date }}</el-col>
  154. </el-row>
  155. <el-row v-show="detail_info.complete_task.time">
  156. <el-col :span="6">完成时间</el-col>
  157. <el-col :span="18">{{ detail_info.complete_task.time }}</el-col>
  158. </el-row>
  159. <el-row v-show="detail_info.complete_task.remark">
  160. <el-col :span="6">完成备注</el-col>
  161. <el-col :span="18">{{ detail_info.complete_task.remark }}</el-col>
  162. </el-row>
  163. <el-row v-show="detail_info.complete_task && detail_info.complete_task.files && detail_info.complete_task.files.length > 0">
  164. <el-col :span="18" :offset="6">
  165. <el-image
  166. v-for="(itme, index) in detail_info.complete_task.files"
  167. :key="index"
  168. style="width: 80px; height: 80px;margin: 0 5px;"
  169. :src="itme"
  170. :preview-src-list="detail_info.complete_task.files"
  171. ></el-image>
  172. </el-col>
  173. </el-row>
  174. <div v-show="detail_info.rule_id">
  175. <p class="row_title">规则依据</p>
  176. <el-row>
  177. <el-col :span="6">规则分类</el-col>
  178. <el-col :span="18">{{ detail_info.rule_list }}</el-col>
  179. </el-row>
  180. <el-row v-show="detail_info.remark.rule">
  181. <el-col :span="6">积分规则</el-col>
  182. <el-col :span="18">{{ detail_info.remark.rule }}</el-col>
  183. </el-row>
  184. <el-row>
  185. <el-col :span="6">积分</el-col>
  186. <el-col :span="18" v-show="detail_info.rule_item.min_point == detail_info.rule_item.max_point">{{ detail_info.rule_item.min_point }} {{ point_name(detail_info.pt_id) }}</el-col>
  187. <el-col :span="18" v-show="detail_info.rule_item.min_point != detail_info.rule_item.max_point">
  188. {{ detail_info.rule_item.min_point }} ~ {{ detail_info.rule_item.max_point }} {{ point_name(detail_info.pt_id) }}
  189. </el-col>
  190. </el-row>
  191. </div>
  192. <div v-show="detail_info.process"><Steps :process="detail_info.process"></Steps></div>
  193. <div v-show="detail_info.dc_remark.flow"><Review :process="detail_info.dc_remark.flow" :status="detail_info.dc_status"></Review></div>
  194. </div>
  195. <div style="position: absolute; bottom: 20px;right: 20px;left: 20px;" class="flex-box-ce">
  196. <!-- <el-button type="primary" v-if="!detail_info.has_ticket" @click="deleteInBatches({id:detail_info.event_id},true)">发放奖票</el-button> -->
  197. <!-- <el-button type="primary" v-else @click="openDetail({id:detail_info.event_id})">查看奖票</el-button> -->
  198. <div class="flex-1"></div>
  199. <el-button @click="detail_popup=false">取消</el-button>
  200. </div>
  201. </el-drawer>
  202. </div>
  203. </template>
  204. <script>
  205. import {_debounce} from '@/api/auth';
  206. import moment from 'moment' // 时间库
  207. import Steps from '@/components/Steps';
  208. import Review from '@/components/Review';
  209. import toLead from '@/components/toLead';
  210. export default {
  211. components:{Steps,Review,toLead},
  212. data() {
  213. return {
  214. pickerOptions: {
  215. shortcuts: [
  216. {
  217. text: '今天',
  218. onClick(picker) {
  219. const now = new Date(new Date().toLocaleDateString());
  220. const start = now.getTime();
  221. picker.$emit('pick', [moment(start).format('YYYY-MM-DD'), moment(start).format('YYYY-MM-DD')]);
  222. }
  223. },
  224. {
  225. text: '昨天',
  226. onClick(picker) {
  227. const now = new Date(new Date().toLocaleDateString());
  228. const start = now.getTime() - 60 * 60 * 24 * 1000;
  229. picker.$emit('pick', [moment(start).format('YYYY-MM-DD'),moment(start).format('YYYY-MM-DD')]);
  230. }
  231. },
  232. {
  233. text: '本周',
  234. onClick(picker) {
  235. picker.$emit('pick', [moment().startOf('isoWeek').format('YYYY-MM-DD'),moment().endOf('isoWeek').format('YYYY-MM-DD')]);
  236. }
  237. },
  238. {
  239. text: '上周',
  240. onClick(picker) {
  241. const now = new Date(new Date().toLocaleDateString());
  242. const start = now.getTime() - (now.getDay() + 6) * 24 * 60 * 60 * 1000;
  243. const end = start + 7 * 24 * 60 * 60 * 1000 - 1000;
  244. picker.$emit('pick', [moment(start).format('YYYY-MM-DD'), moment(end).format('YYYY-MM-DD')]);
  245. }
  246. },
  247. {
  248. text: '本月',
  249. onClick(picker) {
  250. const now = new Date();
  251. const startDate = new Date(now.getFullYear(), now.getMonth(), 1);
  252. const endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0);
  253. picker.$emit('pick', [moment(startDate.getTime()).format('YYYY-MM-DD'), moment(endDate.getTime()).format('YYYY-MM-DD')]);
  254. }
  255. },
  256. {
  257. text: '上月',
  258. onClick(picker) {
  259. const now = new Date();
  260. const startDate = new Date(now.getFullYear() - (now.getMonth() > 0 ? 0 : 1), (now.getMonth() + 11) % 12, 1);
  261. const endDate = new Date(now.getFullYear(), now.getMonth(), 0);
  262. picker.$emit('pick', [moment(startDate.getTime()).format('YYYY-MM-DD'), moment(endDate.getTime()).format('YYYY-MM-DD')]);
  263. }
  264. },
  265. {
  266. text: '本季',
  267. onClick(picker) {
  268. const quarter=Math.ceil((new Date().getMonth()+1)/3)
  269. let str=moment().format(`YYYY-${(quarter-1)*3+1}-01`);
  270. let ent=moment(moment().format(`YYYY-${(quarter-1)*3+1}-01`)).add(2,`month`).endOf('month').format("YYYY-MM-DD");
  271. console.log(str,ent)
  272. picker.$emit('pick',[str,ent]);
  273. }
  274. },
  275. {
  276. text: '本年',
  277. onClick(picker) {
  278. let year=moment().format('YYYY');
  279. picker.$emit('pick', [year+'-01-01',year+'-12-31']);
  280. }
  281. },
  282. ],
  283. },
  284. loading: false,
  285. list: null,
  286. formData: {
  287. keyword: "",
  288. employee_id:'',
  289. publisher_id: this.$getUserData().id,
  290. },
  291. page:1,
  292. page_size:10,
  293. total: 0,
  294. employee_map: [],
  295. date:'',
  296. isShowDetail:false,
  297. detail:{remark:{},event:{remark:{}},date:''},
  298. selectItem:{},
  299. detail_info: {complete_task:{},remark:{},rule_item:{},dc_remark:{},pt_id:3},
  300. detail_popup: false,
  301. detail_loading: false,
  302. };
  303. },
  304. watch: {
  305. 'formData.keyword': {
  306. deep: true,
  307. handler: _debounce(function(val) {
  308. this.getUserAwardList();
  309. },1000)
  310. },
  311. date(val) {
  312. this.getUserAwardList();
  313. },
  314. 'formData.employee_id'(){
  315. this.getUserAwardList();
  316. }
  317. },
  318. mounted() {
  319. this.employee_map = this.$getCache('userList');
  320. this.getUserAwardList();
  321. },
  322. methods: {
  323. point_name(id) {
  324. let point_types=this.$getTyps();
  325. return point_types.find(item => {
  326. if (item.id == id) {
  327. return item.name;
  328. }
  329. }).name;
  330. },
  331. open_detail() {
  332. this.detail_popup = true;
  333. let data = {event_id:this.detail.event_id};
  334. this.detail_loading = true;
  335. this.$axios('get', '/api/integral/statistics/integral/info',data).then(res => {
  336. this.detail_info = res.data.data;
  337. }).finally(() => {
  338. this.detail_loading = false;
  339. });
  340. },
  341. deleteItem(){
  342. this.$confirm(`确定${this.detail.publisher_id==this.$getUserData().id? '撤回':'删除'}此奖票?`, '提示', {
  343. confirmButtonText: '确定',
  344. cancelButtonText: '取消',
  345. type: 'warning'
  346. }).then(() => {
  347. this.$axios("post", "/api/integral/ticket/del",{id:this.detail.id}).then(res => {
  348. this.$message.success(this.detail.publisher_id==this.$getUserData().id? "已撤回":'已删除');
  349. this.getUserAwardList();
  350. this.isShowDetail=false;
  351. })
  352. }).catch(() => {});
  353. },
  354. openDetail(item){
  355. this.$axios("get", "/api/integral/ticket/info",{id:item.id}).then(res => {
  356. this.detail=res.data.data;
  357. this.isShowDetail=true;
  358. })
  359. },
  360. getUserAwardList(is){
  361. this.loading2 = true;
  362. !is? this.page=1:'';
  363. let formData={
  364. page: this.page,
  365. page_size: this.page_size,
  366. employee_id:this.formData.employee_id||0,
  367. publisher_id:this.formData.publisher_id,
  368. keyword:this.formData.keyword,
  369. }
  370. if(this.date){
  371. formData.start_date=moment(this.date[0]).format('YYYY-MM-DD')
  372. formData.end_date=this.date[1]
  373. }
  374. this.$axios("get", "/api/integral/ticket", formData,'v2').then(res => {
  375. let list = res.data.data.list;
  376. this.list = list;
  377. this.total = res.data.data.total;
  378. }).finally(() => {
  379. this.loading2 = false;
  380. });
  381. },
  382. // 页面变更
  383. handleCurrentChange(val) {
  384. this.page = val;
  385. this.getUserAwardList(true);
  386. },
  387. // 页面跳转
  388. handleSizeChange(val) {
  389. this.page_size = val;
  390. this.getUserAwardList();
  391. },
  392. }
  393. };
  394. </script>
  395. <style scoped lang="scss">
  396. .drawer_title {
  397. font-size: 18px;
  398. padding: 20px;
  399. border-bottom: 1px #efefef solid;
  400. }
  401. .detail_popup {
  402. padding: 20px;
  403. height: calc(100vh - 140px);
  404. overflow: auto;
  405. padding-bottom: 100px;
  406. .row_title {
  407. position: relative;
  408. margin: 0 0 20px 0;
  409. padding-top: 12px;
  410. font-size: 16px;
  411. color: #303133;
  412. line-height: 22px;
  413. }
  414. .row_title:before {
  415. position: absolute;
  416. top: 0;
  417. content: ' ';
  418. width: 100%;
  419. border-top: 1px #f8f8f8 solid;
  420. }
  421. .el-row {
  422. margin-bottom: 10px;
  423. font-size: 14px;
  424. .el-col-4 {
  425. color: #606266;
  426. }
  427. }
  428. }
  429. .message-box .label{
  430. font-size: 18px;
  431. font-weight: 600;
  432. margin-bottom: 20px;
  433. }
  434. .message-box .flex-box-ce{
  435. margin-bottom:16px ;
  436. }
  437. .message-box .fontColorC{
  438. width: 100px;
  439. }
  440. .el-date-editor.el-input {
  441. width: auto;
  442. }
  443. .date-picker-width {
  444. width: 145px !important;
  445. }
  446. .search ::v-deep .el-input-group__append{
  447. background: #FFF;
  448. }
  449. .search ::v-deep .el-input-group__append:active {
  450. background: #26a2ff;
  451. }
  452. .search ::v-deep .el-input-group__append:active .el-icon-search {
  453. color: #fff;
  454. }
  455. .all{
  456. margin-top:10px;
  457. padding:10px 20px 0px 20px;
  458. min-height: calc(100vh - 204px);
  459. }
  460. </style>