channelItem.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div>
  3. <!-- 选择项目 -->
  4. <el-dialog
  5. title="选择渠道"
  6. :visible.sync="showChannelItem"
  7. width="1000px"
  8. append-to-body
  9. >
  10. <el-table
  11. class="tableWrapper"
  12. ref="channelTable"
  13. @row-click="clickRow"
  14. :data="channelList"
  15. @selection-change="handleSelectionChange"
  16. >
  17. <el-table-column type="selection" width="55" align="center" />
  18. <!-- <el-table-column label="主键ID" align="center" prop="id" /> -->
  19. <el-table-column label="渠道编号" align="center" prop="channelCode" />
  20. <el-table-column
  21. label="渠道名称"
  22. width="150"
  23. align="center"
  24. prop="channelName"
  25. >
  26. <template slot-scope="scope">
  27. <div :title="scope.row.channelName">
  28. {{ scope.row.channelName }}
  29. </div>
  30. </template>
  31. </el-table-column>
  32. <el-table-column
  33. label="渠道类别"
  34. width="450"
  35. align="center"
  36. prop="channelType"
  37. >
  38. <template slot-scope="scope">
  39. <dict-tag
  40. :options="dict.type.channel_type"
  41. :value="scope.row.channelType"
  42. />
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="联系人" align="center" prop="contacts" />
  46. <el-table-column
  47. label="联系电话"
  48. width="150"
  49. align="center"
  50. prop="telephone"
  51. />
  52. <el-table-column label="渠道负责人" align="center" prop="channelHead" />
  53. <el-table-column label="状态" align="center" prop="status">
  54. <template slot-scope="scope">
  55. <dict-tag
  56. :options="dict.type.channel_status"
  57. :value="scope.row.status"
  58. />
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <pagination
  63. v-show="channelItemTotal > 0"
  64. :total="channelItemTotal"
  65. :page.sync="channelQueryParams.pageNum"
  66. :limit.sync="channelQueryParams.pageSize"
  67. @pagination="getList"
  68. />
  69. <div slot="footer" class="dialog-footer">
  70. <el-button type="primary" @click="submit" v-preventReClick
  71. >确 定</el-button
  72. >
  73. <el-button @click="cancel">取 消</el-button>
  74. </div>
  75. </el-dialog>
  76. </div>
  77. </template>
  78. <script>
  79. import { listChannel } from "@/api/invest/channel";
  80. export default {
  81. props: {},
  82. dicts: ["channel_type", "channel_status"],
  83. data() {
  84. return {
  85. showChannelItem: false,
  86. // 总条数
  87. channelItemTotal: 0,
  88. channelList: [],
  89. channelQueryParams: {
  90. pageNum: 1,
  91. pageSize: 10,
  92. orderByColumn: "createTime",
  93. isAsc: "desc",
  94. },
  95. // 选中数组
  96. ids: [],
  97. idsName: [],
  98. // 非单个禁用
  99. single: true,
  100. // 非多个禁用
  101. multiple: true,
  102. };
  103. },
  104. mounted() {
  105. this.getList();
  106. },
  107. methods: {
  108. clickRow(row) {
  109. this.$refs.channelTable.toggleRowSelection(row);
  110. },
  111. // 多选框选中数据
  112. handleSelectionChange(selection) {
  113. if (selection.length > 1) {
  114. this.$modal.msg("只能选择一个渠道");
  115. this.$refs.channelTable.clearSelection();
  116. return;
  117. }
  118. if (this.ids.length == 0) {
  119. this.ids = selection;
  120. } else {
  121. this.$modal.msg("只能选择一个渠道");
  122. this.ids = [];
  123. // channelTable与table的ref绑定的一样
  124. this.$refs.channelTable.clearSelection();
  125. }
  126. },
  127. /** 查询会议列表 */
  128. getList() {
  129. listChannel(this.channelQueryParams).then((response) => {
  130. this.channelList = response.rows;
  131. this.channelItemTotal = response.total;
  132. });
  133. },
  134. submit() {
  135. // console.log("确定", this.ids);
  136. this.$emit("getChannelInfo", this.ids);
  137. this.showChannelItem = false;
  138. },
  139. cancel() {
  140. this.showChannelItem = false;
  141. },
  142. },
  143. };
  144. </script>