DataSummary.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div>
  3. <el-dialog v-dialogDrag :title="title" :visible.sync="visible" :close-on-click-modal="false" :modal-append-to-body="false" width="60%" @close="closeDialog" top="5vh">
  4. <p v-if="isShowText">共{{ CompanyNum }}家客户,其中{{ CompanyMultiple }}家客户有多份合同</p>
  5. <el-table :data="tableData" border style="margin: 20px 0" height="600">
  6. <el-table-column v-for="(col, index) in columns" :key="index" :prop="col.prop" :label="col.label" align="center">
  7. <template slot-scope="{ row }">
  8. <span v-if="col.label === '操作'" style="color: #409eff; cursor: pointer; font-size: 14px; margin-right: 20px" @click="historicalNotesClickHandler(row)">历史备注</span>
  9. <span v-else>{{ handleRowContent(row, col) }}</span>
  10. </template>
  11. </el-table-column>
  12. </el-table>
  13. <el-col :span="24" class="toolbar" v-if="total">
  14. <m-page :total="total" :page_no="page_no" @handleCurrentChange="handleCurrentChange" />
  15. </el-col>
  16. </el-dialog>
  17. <HistoricalNotesDlg :historicalNotesDlgVisible.sync="historicalNotesDlgVisible" :CompanyId.sync="historicalNotesId" />
  18. </div>
  19. </template>
  20. <script>
  21. import HistoricalNotesDlg from "@/components/historicalNotesDlg.vue";
  22. import { dataMainInterface } from "@/api/api.js";
  23. import mPage from "@/components/mPage.vue";
  24. export default {
  25. name: "",
  26. components: { HistoricalNotesDlg, mPage },
  27. props: {
  28. visible: {
  29. type: Boolean,
  30. default: false,
  31. },
  32. title: {
  33. type: String,
  34. default: "",
  35. },
  36. columns: {
  37. type: Array,
  38. default: [],
  39. },
  40. dataItem: {
  41. type: Object,
  42. default: {},
  43. },
  44. },
  45. data() {
  46. return {
  47. tableData: [],
  48. historicalNotesDlgVisible: false, //历史备注的弹框
  49. historicalNotesId: 0,
  50. total: 0,
  51. pageSize: 10,
  52. page_no: 1,
  53. CompanyMultiple: 0,
  54. CompanyNum: 0,
  55. };
  56. },
  57. computed: {
  58. isShowText() {
  59. return ["新签合同", "到期合同", "续约合同", "确认不续约合同"].includes(this.title);
  60. },
  61. },
  62. watch: {
  63. visible(val) {
  64. if (val) {
  65. this.getData();
  66. }
  67. },
  68. },
  69. created() {},
  70. mounted() {},
  71. methods: {
  72. closeDialog() {
  73. this.tableData = [];
  74. this.historicalNotesDlgVisible = false; //历史备注的弹框
  75. this.historicalNotesId = 0;
  76. this.total = 0;
  77. this.pageSize = 10;
  78. this.page_no = 1;
  79. this.CompanyMultiple = 0;
  80. this.CompanyNum = 0;
  81. this.$emit("update:visible", false);
  82. this.$emit("update:dataItem", {});
  83. },
  84. // 点击了历史留言
  85. historicalNotesClickHandler(row) {
  86. this.historicalNotesDlgVisible = true;
  87. this.historicalNotesId = row.CompanyId;
  88. },
  89. handleCurrentChange(val) {
  90. this.page_no = val;
  91. this.getData();
  92. },
  93. // 获取数据
  94. async getData() {
  95. const res = await dataMainInterface.getRaiDataSummaryList({
  96. DataType: this.dataItem.DataType,
  97. SellerId: this.dataItem.SellerId,
  98. CurrentIndex: this.page_no,
  99. PageSize: this.pageSize,
  100. PopupType: this.title,
  101. });
  102. if (res.Ret === 200) {
  103. this.tableData = res.Data.List;
  104. this.total = res.Data.Paging.Totals;
  105. this.CompanyMultiple = res.Data.CompanyMultiple;
  106. this.CompanyNum = res.Data.CompanyNum;
  107. }
  108. },
  109. // 处理表格内容
  110. handleRowContent(row, col) {
  111. if (col.label === "合同期限") {
  112. return `${row.StartDate} ~ ${row.EndDate}`;
  113. }
  114. return row[col.prop];
  115. },
  116. },
  117. };
  118. </script>
  119. <style scoped lang=""></style>