myGrantAward.vue 16 KB

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