index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div>
  3. <el-dialog :visible.sync="visible" append-to-body width="900px">
  4. <div class="flex-align-center flex-between mt-10">
  5. <el-input
  6. style="width:200px"
  7. size="small"
  8. suffix-icon="el-icon-search"
  9. :placeholder="$t('搜索')"
  10. @input="valueChange"
  11. v-model="condition"
  12. @keyup.enter.native="listData(customParam ? customParam.content.pageNumber = 1 : param.content.pageNumber = 1)"
  13. @clear="listData(customParam ? customParam.content.pageNumber = 1 : param.content.pageNumber = 1)" clearable></el-input>
  14. </div>
  15. <div>
  16. <el-table
  17. ref="multipleTable"
  18. :data="tableData"
  19. style="width: 100%"
  20. size="mini"
  21. height="50vh"
  22. border>
  23. <el-table-column
  24. prop="name"
  25. :label="$t('姓名')"
  26. width="100">
  27. </el-table-column>
  28. <el-table-column
  29. prop="position"
  30. :label="$t('职位')"
  31. width="120">
  32. </el-table-column>
  33. <el-table-column
  34. prop="areaname"
  35. :label="$t(`负责区域`)"
  36. width="0">
  37. <!-- <template slot-scope="scope">-->
  38. <!-- <span v-if="scope.row.salearea">-->
  39. <!-- <span v-for="(item,index) in scope.row.salearea" :key="index">-->
  40. <!-- {{index === scope.row.salearea.length -1?item.areafullname:item.areafullname + ','}}-->
  41. <!-- </span>-->
  42. <!-- </span>-->
  43. <!-- <span v-else>-->
  44. <!-- {{'&#45;&#45;'}}-->
  45. <!-- </span>-->
  46. <!-- </template>-->
  47. </el-table-column>
  48. <el-table-column
  49. prop="userphonenumber"
  50. :label="$t(`手机号码`)"
  51. width="150">
  52. </el-table-column>
  53. <el-table-column
  54. :label="$t('操作')"
  55. width="80">
  56. <template slot-scope="scope">
  57. <el-button type="text" size="small" @click="selectRow(scope.row)">{{$t('选 择')}}</el-button>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <div style="margin-top:16px;text-align:right">
  62. <el-pagination
  63. background
  64. small
  65. @current-change="handleCurrentChange"
  66. :current-page="customParam ? customParam.content.pageNumber : param.content.pageNumber"
  67. :page-size="customParam ? customParam.content.pageSize : param.content.pageSize"
  68. layout="total, pager, next, jumper"
  69. :total="total">
  70. </el-pagination>
  71. </div>
  72. </div>
  73. </el-dialog>
  74. <slot name="input"></slot>
  75. </div>
  76. </template>
  77. <script>
  78. export default {
  79. props:['customParam'],
  80. data () {
  81. return {
  82. visible:false,
  83. param:{
  84. "id": 20221122153902,
  85. "content": {
  86. "pageNumber": 1,
  87. "pageSize": 20,
  88. "where": {
  89. "condition": ""
  90. }
  91. },
  92. },
  93. tableData: [],
  94. total:0,
  95. currentPage:0,
  96. search:'',
  97. condition:''
  98. }
  99. },
  100. methods:{
  101. async listData () {
  102. const res = await this.$api.requested(this.customParam ? this.customParam : this.param)
  103. this.tableData = res.data
  104. this.total = res.total
  105. this.currentPage = res.pageNumber
  106. // console.log(this.tableData);
  107. },
  108. valueChange (data) {
  109. console.log(data);
  110. if (this.customParam) {
  111. this.customParam.content.where.condition = data
  112. } else {
  113. this.param.content.where.condition = data
  114. }
  115. },
  116. handleCurrentChange(val) {
  117. // console.log(`当前页: ${val}`);
  118. if (this.customParam) {
  119. this.customParam.content.pageNumber = val
  120. } else {
  121. this.param.content.pageNumber = val
  122. }
  123. this.listData()
  124. },
  125. selectRow (row) {
  126. this.$emit('selectRow',row)
  127. },
  128. // searchQuery(){
  129. // /*this.customParam.content.where.condition = this.search*/
  130. // this.param.content.where.condition = this.search
  131. // this.listData()
  132. // }
  133. },
  134. mounted() {
  135. this.listData()
  136. },
  137. created () {
  138. },
  139. }
  140. </script>
  141. <style>
  142. </style>