select-msic.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div class="container" style="width: 100%">
  3. <el-form ref="search" :model="search" inline @submit.stop.native="submit" @reset.stop.native="reset">
  4. <el-form-item prop="musicGroupName">
  5. <el-input v-model.trim="search.musicGroupName" clearable placeholder="乐团名称"/>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button type="primary" native-type="submit">搜索</el-button>
  9. <el-button type="danger" native-type="reset">重置</el-button>
  10. </el-form-item>
  11. </el-form>
  12. <el-table
  13. style="width: 100%"
  14. max-height="300px"
  15. ref="table"
  16. @selection-change="handleSelectionChange"
  17. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  18. :data="tableData"
  19. >
  20. <el-table-column type="selection"
  21. :selectable="checkSelectable"
  22. width="50">
  23. </el-table-column>
  24. <el-table-column prop="id" width="100" align="center" label="乐团编号">
  25. <template slot-scope="scope">
  26. <copy-text>{{ scope.row.id }}</copy-text>
  27. </template>
  28. </el-table-column>
  29. <el-table-column
  30. prop="name"
  31. width="200px"
  32. align="center"
  33. label="乐团名称"
  34. >
  35. <template slot-scope="scope">
  36. <copy-text>{{ scope.row.name }}</copy-text>
  37. </template>
  38. </el-table-column>
  39. <el-table-column
  40. align="center"
  41. prop="cooperationOrganName"
  42. max-width="274"
  43. label="合作单位"
  44. >
  45. </el-table-column>
  46. </el-table>
  47. <pagination
  48. :total.sync="rules.total"
  49. :page.sync="rules.page"
  50. :limit.sync="rules.limit"
  51. :page-sizes="rules.page_size"
  52. layout="prev, pager, next"
  53. style="padding: 10px"
  54. @pagination="FetchList" />
  55. <div class="footer" slot="footer">
  56. <el-button @click="$emit('close')">取消</el-button>
  57. <el-button @click="submited" type="primary">确认</el-button>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import pagination from '@/components/Pagination/index'
  63. import { getTeamList, getPayType } from "@/api/teamServer";
  64. export default {
  65. props: ['visible', 'organId'],
  66. components: { pagination },
  67. data() {
  68. return {
  69. tableData: [],
  70. passed: [],
  71. rules: {
  72. // 分页规则
  73. limit: 10, // 限制显示条数
  74. page: 1, // 当前页
  75. total: 0, // 总条数
  76. page_size: [10, 20, 40, 50] // 选择限制显示条数
  77. },
  78. search: {
  79. musicGroupName: '',
  80. hastimer: ''
  81. }
  82. };
  83. },
  84. mounted() {
  85. this.FetchList()
  86. },
  87. watch: {
  88. visible() {
  89. this.$refs.table.clearSelection()
  90. this.passed = []
  91. }
  92. },
  93. methods: {
  94. submit(evt) {
  95. this.rules.page = 1;
  96. evt.stopPropagation()
  97. evt.stopImmediatePropagation()
  98. evt.preventDefault()
  99. this.FetchList()
  100. },
  101. reset(evt) {
  102. this.rules.page = 1;
  103. evt.stopPropagation()
  104. evt.stopImmediatePropagation()
  105. evt.preventDefault()
  106. this.search = {
  107. musicGroupName: '',
  108. hastimer: ''
  109. }
  110. this.FetchList()
  111. },
  112. checkSelectable (row) {
  113. return true
  114. },
  115. handleSelectionChange(arr) {
  116. const passed = [];
  117. for (let i in arr) {
  118. let obj = {};
  119. obj.id = arr[i].id;
  120. obj.name = arr[i].name;
  121. passed.push(obj);
  122. }
  123. this.passed = passed;
  124. },
  125. async FetchList() {
  126. try {
  127. const res = await getTeamList({
  128. rows: this.rules.limit,
  129. page: this.rules.page,
  130. organId: this.organId,
  131. ...this.search
  132. })
  133. this.tableData = res.data.rows.filter(item => item.id !== this.$route.query.id)
  134. this.rules.total = res.data.total
  135. } catch (error) {}
  136. },
  137. submited() {
  138. this.$emit('close')
  139. this.$emit('submited', this.passed)
  140. }
  141. },
  142. };
  143. </script>
  144. <style lang="less" scoped>
  145. .container{
  146. /deep/ .footer{
  147. text-align: right;
  148. margin-top: 20px;
  149. }
  150. }
  151. </style>