lotteryTicket_statistics.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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" v-model="formData.month" :clearable="false" :disabled="checked" type="month" placeholder="请选择月份" value-format="yyyy-MM"></el-date-picker>
  8. </el-form-item>
  9. <el-form-item label="部门">
  10. <el-cascader
  11. size="medium"
  12. v-model="dept_name"
  13. :options="dept_tree"
  14. :props="{ multiple: true, value: 'id', label: 'name', children: '_child'}"
  15. ref="deptRef"
  16. filterable
  17. collapse-tags
  18. placeholder="全公司"
  19. clearable
  20. ></el-cascader>
  21. </el-form-item>
  22. <el-form-item label="人员搜索">
  23. <el-input size="medium" v-model="formData.keyword" clearable placeholder="请输入人员姓名" maxlength="20"></el-input>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-checkbox v-model="checked" border size="medium">查看所有累计奖票</el-checkbox>
  27. </el-form-item>
  28. </el-form>
  29. </template>
  30. </FormBox>
  31. <div class="all">
  32. <div>
  33. <el-table :data="all_integral_list" style="width: 100%" v-loading="loading">
  34. <el-table-column prop="employee_name" label="姓名" align="left">
  35. <template slot-scope="scope">
  36. <div class="flex-box">
  37. <userImage :user_name="scope.row.name" :img_url="scope.row.img_url" width="50px" height="50px"></userImage>
  38. <div style="height: 50px;padding-left: 10px;" class="flex-box-v flex-h-zhu">
  39. <span>{{ scope.row.name }}</span>
  40. </div>
  41. </div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="count" label="部门">
  45. <template slot-scope="scope">
  46. <span style="font-size: 12px;max-width: 200px;" class="fontColorC font-flex-word">{{ scope.row.dept||'--' }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column prop="count" label="奖票数量" align="left">
  50. <template slot-scope="scope">
  51. <span>{{ scope.row.count }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column>
  55. <template slot-scope="scope">
  56. <span class="blue" style="cursor: pointer;" @click="openTable(scope.row)">查看奖票明细</span>
  57. </template>
  58. </el-table-column>
  59. <template slot="empty">
  60. <noData></noData>
  61. </template>
  62. </el-table>
  63. <center style="padding: 20px 0;">
  64. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="formData.page"
  65. :page-sizes="[10, 20, 50, 100]" layout="total, sizes, prev, pager, next" :page-size="pageLimit1" :total="total">
  66. </el-pagination>
  67. </center>
  68. </div>
  69. </div>
  70. <!-- 对齐我的目标详情 -->
  71. <el-dialog title="奖票明细" :visible.sync="isShowTable" :append-to-body="true" width="900px" top="5%">
  72. <div class="flex-box-ce" style="margin-bottom: 20px;">
  73. <h1 class="flex-1" style="font-size: 18px;">{{selectItem.name}}的奖票明细-{{checked? '所有奖票':formData.month}}</h1>
  74. <el-input v-model="keywordTabel" size="small" clearable placeholder="搜索内容" style="width: 250px;" maxlength="20"></el-input>
  75. </div>
  76. <div>
  77. <el-table :data="tableList" style="width: 100%;" v-loading="loading2">
  78. <el-table-column prop="name" min-width="300" label="奖票事件">
  79. <template slot-scope="scope">
  80. <span>{{scope.row.remark.customize||scope.row.remark.rule}}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column prop="ct" label="事件时间" width="100">
  84. <template slot-scope="scope">
  85. <span>{{$moment(scope.row.date+'').format("YYYY-MM-DD")}}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="操作" align="right">
  89. <template slot-scope="scope">
  90. <el-link type="primary" :underline="false" @click="openDetail(scope.row)">查看详情</el-link>
  91. <el-link v-if="scope.row.publisher_id==$getUserData().id||($supremeAuthority()!='dept_manager'&&$supremeAuthority()!='employee')" type="danger" :underline="false" @click="deleteItem(scope.row.id,scope.row.publisher_id)" style="padding-left: 10px;">{{scope.row.publisher_id==$getUserData().id ?'撤回奖票':'删除奖票'}}</el-link>
  92. </template>
  93. </el-table-column>
  94. <template slot="empty">
  95. <noData></noData>
  96. </template>
  97. </el-table>
  98. <el-pagination style="text-align: center;margin-top: 20px;" :current-page.sync="page" :page-sizes="[5,10,15]" layout="total,prev,pager,next,sizes" :total="total2" @size-change="handleSizeChange2" @current-change="handleCurrentChange2" :page-size="page_size"></el-pagination>
  99. </div>
  100. <div class="flex-box-end" style="margin-top: 20px;">
  101. <el-button @click="isShowTable=false">关 闭</el-button>
  102. </div>
  103. </el-dialog>
  104. <!-- 检查单详情 -->
  105. <BrawerBox :showDrawer.sync="isShowDetail" drawerTitle="奖票详情">
  106. <template slot="main">
  107. <div>
  108. <div class="flex-box-v">
  109. <div class="message-box">
  110. <div class="flex-box-ce">
  111. <div class="fontColorC">奖票对象</div>
  112. <div class="flex-1">{{detail.employee_name}}</div>
  113. </div>
  114. <div class="flex-box-ce">
  115. <div class="fontColorC">事件时间</div>
  116. <div class="flex-1">{{$moment(detail.date+'').format("YYYY-MM-DD")}}</div>
  117. </div>
  118. <div class="flex-box-ce">
  119. <div class="fontColorC">发放人</div>
  120. <div class="flex-1">{{detail.publisher_name||'--'}}</div>
  121. </div>
  122. <div class="flex-box-ce">
  123. <div class="fontColorC">发放时间</div>
  124. <div class="flex-1">{{detail.ct}}</div>
  125. </div>
  126. <div class="flex-box-ce">
  127. <div class="fontColorC">奖票事件</div>
  128. <div class="flex-1">{{detail.remark.customize||detail.remark.rule}}</div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="message-box" v-if="detail.event">
  133. <div style="font-size: 16px;margin-bottom: 20px;">对应积分事件</div>
  134. <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;">
  135. <div class="flex-1" style="padding-right: 20px;">
  136. {{detail.event.remark.customize||detail.event.remark.rule}}
  137. </div>
  138. <div class="red" v-if="detail.event.point>0">+{{detail.event.point}} {{detail.event.pt_id==3? 'B分':'A分'}}</div>
  139. <div class="green" v-else>{{detail.event.point}} {{detail.event.pt_id==3? 'B分':'A分'}}</div>
  140. </div>
  141. </div>
  142. </div>
  143. </template>
  144. <template slot="footer">
  145. <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>
  146. <div class="flex-1"></div>
  147. <el-button plain @click="isShowDetail=false">关 闭</el-button>
  148. </template>
  149. </BrawerBox>
  150. <el-drawer title="事件详情" :visible.sync="detail_popup" ref="drawer" :with-header="false" :width="'500px'" direction="rtl">
  151. <div class="drawer_title flex-box-ce">
  152. <span class="flex-1">事件详情</span>
  153. <i @click="detail_popup=false" style="cursor: pointer;" class="el-icon-close"></i>
  154. </div>
  155. <div class="detail_popup" v-loading="detail_loading" v-if="detail_info !== null">
  156. <el-row style="padding-bottom:10px;border-bottom:1px #f8f8f8 solid;">
  157. <div class="flex-box flex-v-ce">
  158. <userImage :user_name="detail_info.employee_name" :img_url="detail_info.img_url" width="50px" height="50px" fontSize="1"></userImage>
  159. <span style="font-size: 18px;line-height:50px; margin-left:10px;margin-right:4px;">{{ detail_info.employee_name }}</span>
  160. <span class="red point" v-if="detail_info.point >= 0">+{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  161. <span class="green point" v-if="detail_info.point < 0">{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  162. </div>
  163. </el-row>
  164. <el-row >
  165. <el-col :span="6">事件内容</el-col>
  166. <el-col :span="18" v-if="detail_info.remark">{{ detail_info.remark && (detail_info.remark.customize || detail_info.remark.rule) }}</el-col>
  167. </el-row>
  168. <el-row v-show="detail_info.files && detail_info.files.length > 0">
  169. <el-col :span="18" :offset="6">
  170. <el-image
  171. v-for="(itme, index) in detail_info.files"
  172. :key="index"
  173. style="width: 80px; height: 80px;margin: 0 5px;"
  174. :src="itme"
  175. :preview-src-list="detail_info.files"
  176. ></el-image>
  177. </el-col>
  178. </el-row>
  179. <el-row v-show="detail_info.rule_list">
  180. <el-col :span="6">规则分类</el-col>
  181. <el-col :span="18">{{ detail_info.rule_list }}</el-col>
  182. </el-row>
  183. <el-row v-show="detail_info.source_type_mark">
  184. <el-col :span="6">来源类型</el-col>
  185. <el-col :span="18">{{ detail_info.source_type_mark }}</el-col>
  186. </el-row>
  187. <el-row v-show="detail_info.recorder_name">
  188. <el-col :span="6">记录人</el-col>
  189. <el-col :span="18">{{ detail_info.recorder_name }}</el-col>
  190. </el-row>
  191. <el-row v-show="detail_info.date">
  192. <el-col :span="6">事件时间</el-col>
  193. <el-col :span="18">{{ detail_info.date }}</el-col>
  194. </el-row>
  195. <el-row v-show="detail_info.complete_task.time">
  196. <el-col :span="6">完成时间</el-col>
  197. <el-col :span="18">{{ detail_info.complete_task.time }}</el-col>
  198. </el-row>
  199. <el-row v-show="detail_info.complete_task.remark">
  200. <el-col :span="6">完成备注</el-col>
  201. <el-col :span="18">{{ detail_info.complete_task.remark }}</el-col>
  202. </el-row>
  203. <el-row v-show="detail_info.complete_task && detail_info.complete_task.files && detail_info.complete_task.files.length > 0">
  204. <el-col :span="18" :offset="6">
  205. <el-image
  206. v-for="(itme, index) in detail_info.complete_task.files"
  207. :key="index"
  208. style="width: 80px; height: 80px;margin: 0 5px;"
  209. :src="itme"
  210. :preview-src-list="detail_info.complete_task.files"
  211. ></el-image>
  212. </el-col>
  213. </el-row>
  214. <div v-show="detail_info.rule_id">
  215. <p class="row_title">规则依据</p>
  216. <el-row>
  217. <el-col :span="6">规则分类</el-col>
  218. <el-col :span="18">{{ detail_info.rule_list }}</el-col>
  219. </el-row>
  220. <el-row v-show="detail_info.remark.rule">
  221. <el-col :span="6">积分规则</el-col>
  222. <el-col :span="18">{{ detail_info.remark.rule }}</el-col>
  223. </el-row>
  224. <el-row>
  225. <el-col :span="6">积分</el-col>
  226. <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>
  227. <el-col :span="18" v-show="detail_info.rule_item.min_point != detail_info.rule_item.max_point">
  228. {{ detail_info.rule_item.min_point }} ~ {{ detail_info.rule_item.max_point }} {{ point_name(detail_info.pt_id) }}
  229. </el-col>
  230. </el-row>
  231. </div>
  232. <div v-show="detail_info.process"><Steps :process="detail_info.process"></Steps></div>
  233. <div v-show="detail_info.dc_remark.flow"><Review :process="detail_info.dc_remark.flow" :status="detail_info.dc_status"></Review></div>
  234. </div>
  235. <div style="position: absolute; bottom: 20px;right: 20px;left: 20px;" class="flex-box-ce">
  236. <!-- <el-button type="primary" v-if="!detail_info.has_ticket" @click="deleteInBatches({id:detail_info.event_id},true)">发放奖票</el-button>
  237. <el-button type="primary" v-else @click="openDetail({id:detail_info.event_id})">查看奖票</el-button> -->
  238. <div class="flex-1"></div>
  239. <el-button @click="detail_popup=false">取消</el-button>
  240. </div>
  241. </el-drawer>
  242. </div>
  243. </template>
  244. <script>
  245. import {_debounce} from '@/api/auth';
  246. import Steps from '@/components/Steps';
  247. import Review from '@/components/Review';
  248. import toLead from '@/components/toLead';
  249. export default {
  250. components:{Steps,Review,toLead},
  251. data() {
  252. return {
  253. checked:false,
  254. loading: false,
  255. all_integral_list: null,
  256. formData: {
  257. month: this.$moment().format("YYYY-MM"),
  258. keyword: "",
  259. dept_ids: "",
  260. page: 1,
  261. page_size: 10
  262. },
  263. total: 0,
  264. //部门
  265. dept_name: [],
  266. dept_tree: [],
  267. pageLimit1: 10,
  268. page: 1,
  269. total2: 0,
  270. page_size: 10,
  271. keywordTabel:'',
  272. isShowTable:false,
  273. tableList:[],
  274. loading2:false,
  275. isShowDetail:false,
  276. detail:{remark:{},event:{remark:{}},date:''},
  277. selectItem:{},
  278. detail_info: {complete_task:{},remark:{},rule_item:{},dc_remark:{},pt_id:3},
  279. detail_popup: false,
  280. detail_loading: false,
  281. };
  282. },
  283. watch: {
  284. "formData.month"(val, old_val) {
  285. this.formData.page = 1;
  286. this.get_all_integral();
  287. },
  288. 'formData.keyword': {
  289. deep: true,
  290. handler: _debounce(function(val) {
  291. this.formData.page = 1;
  292. this.get_all_integral();
  293. },1000)
  294. },
  295. 'keywordTabel':{
  296. deep: true,
  297. handler: _debounce(function(val) {
  298. this.getUserAwardList();
  299. },1000)
  300. },
  301. checked(){
  302. this.formData.page = 1;
  303. this.get_all_integral();
  304. },
  305. dept_name(val, old_val) {
  306. this.formData.page = 1;
  307. if (val.length !== 0) {
  308. let dept_ids=[];
  309. val.forEach((item)=>{
  310. dept_ids.push(...item);
  311. })
  312. let set =new Set(dept_ids);
  313. this.formData.dept_ids = [...set].toString();
  314. } else {
  315. this.formData.dept_ids = 0;
  316. }
  317. this.$nextTick(() => {
  318. this.$refs.deptRef.dropDownVisible = false;
  319. this.get_all_integral();
  320. });
  321. },
  322. },
  323. created() {
  324. this.getDepartment(); //部门
  325. },
  326. mounted() {
  327. this.get_all_integral();
  328. },
  329. methods: {
  330. point_name(id) {
  331. let point_types=this.$getTyps();
  332. return point_types.find(item => {
  333. if (item.id == id) {
  334. return item.name;
  335. }
  336. }).name;
  337. },
  338. open_detail() {
  339. this.detail_popup = true;
  340. let data = {event_id:this.detail.event_id};
  341. this.detail_loading = true;
  342. this.$axios('get', '/api/integral/statistics/integral/info',data).then(res => {
  343. this.detail_info = res.data.data;
  344. }).finally(() => {
  345. this.detail_loading = false;
  346. });
  347. },
  348. deleteItem(id,is){
  349. let str='';
  350. let num=1;
  351. if(is==this.$getUserData().id||this.detail.publisher_id==this.$getUserData().id){
  352. str='确定撤回此奖票?';
  353. }else {
  354. str='确定删除此奖票?';
  355. num=2;
  356. }
  357. this.$confirm(str, '提示', {
  358. confirmButtonText: '确定',
  359. cancelButtonText: '取消',
  360. type: 'warning'
  361. }).then(() => {
  362. this.$axios("post", "/api/integral/ticket/del",{id:id||this.detail.id}).then(res => {
  363. this.$message.success(num==1? "已撤回":'已删除');
  364. this.getUserAwardList();
  365. this.isShowDetail=false;
  366. })
  367. }).catch(() => {});
  368. },
  369. openTable(item){
  370. this.isShowTable=true;
  371. this.selectItem=item;
  372. this.page_size=10;
  373. this.keywordTabel="";
  374. this.getUserAwardList();
  375. },
  376. openDetail(item){
  377. this.$axios("get", "/api/integral/ticket/info",{id:item.id}).then(res => {
  378. this.detail=res.data.data;
  379. this.isShowDetail=true;
  380. })
  381. },
  382. getUserAwardList(is){
  383. this.loading2 = true;
  384. !is? this.page=1:'';
  385. let formData={
  386. page: this.page,
  387. page_size: this.page_size,
  388. employee_id:this.selectItem.id,
  389. keyword:this.keywordTabel,
  390. }
  391. if(this.checked){
  392. // formData.start_date="2010-01-01";
  393. // formData.end_date=this.$moment().format('YYYY-MM-DD')
  394. }else{
  395. formData.month=this.formData.month
  396. }
  397. this.$axios("get", "/api/integral/ticket", formData,'v2').then(res => {
  398. this.tableList = res.data.data.list;
  399. this.total2 = res.data.data.total;
  400. }).finally(() => {
  401. this.loading2 = false;
  402. });
  403. },
  404. // 页面变更
  405. handleCurrentChange2(val) {
  406. this.page = val;
  407. this.getUserAwardList(true);
  408. },
  409. // 页面跳转
  410. handleSizeChange2(val) {
  411. this.page_size = val;
  412. this.getUserAwardList();
  413. },
  414. //分页
  415. handleSizeChange(val) {
  416. this.pageLimit1 = val;
  417. this.formData.page_size = this.pageLimit1;
  418. this.get_all_integral();
  419. },
  420. handleCurrentChange(val) {
  421. this.formData.page = val;
  422. this.get_all_integral();
  423. },
  424. //请求数据
  425. get_all_integral() {
  426. this.loading = true;
  427. let formData=JSON.parse(JSON.stringify(this.formData));
  428. if(this.checked){
  429. delete formData.month
  430. }
  431. this.$axios("get", "/api/integral/ticket/statistics", formData).then(res => {
  432. if (res.data.code == 1) {
  433. this.all_integral_list = res.data.data.list;
  434. this.total = res.data.data.total;
  435. } else {
  436. this.$message.error(res.data.data.msg);
  437. }
  438. }).finally(() => {
  439. this.loading = false;
  440. });
  441. },
  442. returnArr(child,arr){
  443. if(child.length>0){
  444. child.forEach(item=>{
  445. arr.push(item.value)
  446. this.returnArr(item.children,arr)
  447. })
  448. }
  449. },
  450. //获取部门
  451. getDepartment() {
  452. this.$axios("get", "/api/department/tree").then((res) => {
  453. this.dept_tree = this.getTreeData(res.data.data.list);
  454. });
  455. },
  456. // 递归判断列表,把最后的children设为undefined
  457. getTreeData(data) {
  458. for (var i = 0; i < data.length; i++) {
  459. if (data[i]._child.length < 1) {
  460. // children若为空数组,则将children设为undefined
  461. data[i]._child = undefined;
  462. } else {
  463. // children若不为空数组,则继续 递归调用 本方法
  464. this.getTreeData(data[i]._child);
  465. }
  466. }
  467. return data;
  468. },
  469. }
  470. };
  471. </script>
  472. <style scoped lang="scss">
  473. .drawer_title {
  474. font-size: 18px;
  475. padding: 20px;
  476. border-bottom: 1px #efefef solid;
  477. }
  478. .message-box .label{
  479. font-size: 18px;
  480. font-weight: 600;
  481. margin-bottom: 20px;
  482. }
  483. .message-box .flex-box-ce{
  484. margin-bottom:16px ;
  485. }
  486. .message-box .fontColorC{
  487. width: 100px;
  488. }
  489. .el-date-editor.el-input {
  490. width: auto;
  491. }
  492. .date-picker-width {
  493. width: 145px !important;
  494. }
  495. .search ::v-deep .el-input-group__append{
  496. background: #FFF;
  497. }
  498. .search ::v-deep .el-input-group__append:active {
  499. background: #26a2ff;
  500. }
  501. .el-checkbox.is-bordered.el-checkbox--medium {
  502. padding: 9px 20px 7px 10px;
  503. }
  504. .search ::v-deep .el-input-group__append:active .el-icon-search {
  505. color: #fff;
  506. }
  507. .detail_popup {
  508. padding: 20px;
  509. height: calc(100vh - 140px);
  510. overflow: auto;
  511. padding-bottom: 100px;
  512. .row_title {
  513. position: relative;
  514. margin: 0 0 20px 0;
  515. padding-top: 12px;
  516. font-size: 16px;
  517. color: #303133;
  518. line-height: 22px;
  519. }
  520. .row_title:before {
  521. position: absolute;
  522. top: 0;
  523. content: ' ';
  524. width: 100%;
  525. border-top: 1px #f8f8f8 solid;
  526. }
  527. .el-row {
  528. margin-bottom: 10px;
  529. font-size: 14px;
  530. .el-col-4 {
  531. color: #606266;
  532. }
  533. }
  534. }
  535. .all{
  536. margin-top:10px;
  537. padding:10px 20px 0px 20px;
  538. min-height: calc(100vh - 204px);
  539. }
  540. </style>