ServiceDetailsDlg.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <el-dialog v-dialogDrag :visible.sync="isServiceDetailsShow" destroy-on-close width="1000px" @close="handleClose" :modal-append-to-body="false" center :title="`服务明细--${dlgForm.CompanyName}`">
  3. <el-table ref="updateTable" :data="tableData" style="width: 100%; margin-bottom: 20px" border height="400px">
  4. <el-table-column align="center" prop="Content" label="服务内容"> </el-table-column>
  5. <el-table-column align="center" prop="ServeTypeName" label="服务类型" width="120"> </el-table-column>
  6. <el-table-column align="center" prop="address" label="主题标签">
  7. <template slot-scope="{ row }" v-if="row.Tag">
  8. <el-tag style="margin: 5px" type="info" size="small" v-for="item in row.Tag.split(',')" :key="item">{{ item }}</el-tag>
  9. </template>
  10. </el-table-column>
  11. <el-table-column align="center" prop="RealName" label="参与人" width="100"> </el-table-column>
  12. <el-table-column align="center" prop="IsKp" label="是否kp" width="80">
  13. <template slot-scope="{ row }">
  14. <span>{{ row.IsKp == 1 ? "是" : "否" }}</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column align="center" prop="ServeCount" label="服务量小计" width="100"> </el-table-column>
  18. <el-table-column align="center" prop="ViewTime" label="时间">
  19. <template slot="header" slot-scope="{}">
  20. <span>时间</span>
  21. <el-tooltip class="item" effect="dark" content="时间指的是:活动开始时间,一对一路演开始时间,报告阅读时间,交流反馈提交时间" placement="top-start">
  22. <i class="el-icon-warning"></i>
  23. </el-tooltip>
  24. </template>
  25. <template slot-scope="{ row }">
  26. <span>{{ row.ViewTime }}</span>
  27. </template>
  28. </el-table-column>
  29. </el-table>
  30. </el-dialog>
  31. </template>
  32. <script>
  33. import { dataMainInterface, raiInterface } from "@/api/api.js";
  34. export default {
  35. props: {
  36. dlgForm: {
  37. type: Object,
  38. default: {},
  39. },
  40. isServiceDetailsShow: {
  41. type: Boolean,
  42. require: true,
  43. },
  44. selectForm: {
  45. type: Object,
  46. default: {},
  47. },
  48. },
  49. data() {
  50. return {
  51. tableData: [], // 初始表格数据
  52. page_no: 1, // 当前页码
  53. pageSize: 10, // 每页显示的行数
  54. noMoreData: false,
  55. };
  56. },
  57. methods: {
  58. /* 滚动监听 */
  59. loadMoveHandler() {
  60. let dom = this.$refs.updateTable.bodyWrapper;
  61. dom.addEventListener(
  62. "scroll",
  63. _.throttle(() => {
  64. const scroll = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
  65. console.log(scroll <= 1, !this.noMoreData);
  66. if (scroll <= 1 && !this.noMoreData) {
  67. this.page_no++;
  68. this.loadData();
  69. }
  70. }, 500)
  71. );
  72. },
  73. async loadData() {
  74. const res = await dataMainInterface.getRaiServeBillList({
  75. CompanyId: this.dlgForm.CompanyId,
  76. PageSize: this.pageSize,
  77. CurrentIndex: this.page_no,
  78. TagType: this.selectForm.TagType,
  79. TagId: this.selectForm.TagId,
  80. ServeTypeId: this.selectForm.ServeTypeId,
  81. WhatWeek: this.selectForm.WhatWeek,
  82. WhatMonth: this.selectForm.WhatMonth,
  83. });
  84. if (res.Ret == 200) {
  85. this.tableData = this.tableData.concat(res.Data.List);
  86. this.noMoreData = res.Data.Paging.IsEnd;
  87. }
  88. },
  89. // 关闭弹框
  90. handleClose() {
  91. this.tableData = [];
  92. this.noMoreData = false;
  93. this.page_no = 1;
  94. this.$emit("update:isServiceDetailsShow", false);
  95. this.$emit("update:dlgForm", {});
  96. },
  97. // 时间的计算
  98. getWeekRange(offset) {
  99. const now = new Date();
  100. const startOfWeek = new Date(now);
  101. startOfWeek.setDate(now.getDate() - now.getDay() + 1 + offset * 7); // 设置为每周的周一
  102. const endOfWeek = new Date(startOfWeek);
  103. endOfWeek.setDate(startOfWeek.getDate() + 6); // 设置为每周的周日
  104. const formatDate = (date) => {
  105. const year = date.getFullYear();
  106. const month = ("0" + (date.getMonth() + 1)).slice(-2);
  107. const day = ("0" + date.getDate()).slice(-2);
  108. return `${month}-${day}`;
  109. };
  110. return `(${formatDate(startOfWeek)} ~ ${formatDate(endOfWeek)})`;
  111. },
  112. },
  113. watch: {
  114. isServiceDetailsShow: {
  115. handler(val) {
  116. if (val) {
  117. this.loadData();
  118. this.$nextTick(() => {
  119. this.loadMoveHandler();
  120. });
  121. } else {
  122. this.tableData = [];
  123. }
  124. },
  125. deep: true,
  126. },
  127. },
  128. };
  129. </script>
  130. <style></style>