group-dialog.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <el-dialog title="添加成员" :visible.sync="visible" width="1200px" :close-on-click-modal="false" :show-close="false">
  3. <div class="filter-container">
  4. <div class="filter-control">
  5. <span>服务商名称:</span>
  6. <el-input
  7. v-model="listQuery.name"
  8. placeholder="服务商名称"
  9. clearable
  10. style="width: 160px"
  11. @keyup.enter.native="getList"
  12. @clear="getList"
  13. />
  14. </div>
  15. <div class="filter-control">
  16. <span>手机号:</span>
  17. <el-input
  18. v-model="listQuery.mobile"
  19. placeholder="手机号"
  20. clearable
  21. style="width: 160px"
  22. @keyup.enter.native="getList"
  23. @clear="getList"
  24. />
  25. </div>
  26. <div class="filter-control">
  27. <el-button type="primary" @click="getList"> 查询 </el-button>
  28. </div>
  29. </div>
  30. <el-table
  31. ref="table"
  32. v-loading="isLoading"
  33. :data="list"
  34. height="400px"
  35. border
  36. @selection-change="handleSelectionChange"
  37. >
  38. <el-table-column type="selection" width="55" />
  39. <el-table-column label="服务商ID" prop="serviceProviderId" align="center" />
  40. <el-table-column label="服务商名称" prop="name" align="center" />
  41. <el-table-column label="手机号" prop="mobile" align="center" />
  42. </el-table>
  43. <!-- 页码 -->
  44. <pagination
  45. :total="total"
  46. :page-sizes="[10, 20]"
  47. :page-size="10"
  48. :page.sync="listQuery.pageNum"
  49. :limit.sync="listQuery.pageSize"
  50. @pagination="getServiceList"
  51. />
  52. <div slot="footer">
  53. <el-button @click="handleCanle"> 取 消 </el-button>
  54. <el-button type="primary" :disabled="disabled" @click="handleConfirm"> 确 定 </el-button>
  55. </div>
  56. </el-dialog>
  57. </template>
  58. <script>
  59. import { getServiceList } from '@/api/serviceSettlement/group'
  60. export default {
  61. name: 'GoodsDialog',
  62. data() {
  63. return {
  64. visible: true,
  65. listQuery: {
  66. name: '',
  67. mobile: '',
  68. pageNum: 1,
  69. pageSize: 100
  70. },
  71. list: [],
  72. total: 0,
  73. groupRadio: null,
  74. isLoading: true
  75. }
  76. },
  77. computed: {
  78. disabled() {
  79. return this.groupRadio === null
  80. }
  81. },
  82. created() {
  83. this.getList()
  84. },
  85. methods: {
  86. // 获取所有供应商列表
  87. async getList() {
  88. this.list = []
  89. this.listQuery.pageNum = 1
  90. this.getServiceList()
  91. },
  92. // 获取所有服务商列表
  93. async getServiceList() {
  94. try {
  95. const res = await getServiceList(this.listQuery)
  96. this.list = res.data.results
  97. this.total = res.data.totalRecord
  98. this.isLoading = false
  99. } catch (error) {
  100. console.log(error)
  101. }
  102. },
  103. // 选择服务商
  104. handleSelectionChange(row) {
  105. this.groupRadio = row
  106. console.log('row', row)
  107. },
  108. // 确认选择服务商
  109. handleConfirm() {
  110. this.$emit('confirm', this.groupRadio)
  111. },
  112. handleCanle() {
  113. // 取消弹窗
  114. this.$emit('cancel')
  115. },
  116. // 已选择的禁用勾选框
  117. selectable(row) {
  118. if (row.flag) {
  119. return true
  120. } else {
  121. return false
  122. }
  123. },
  124. checkedInput(event, type) {
  125. let pattern = ''
  126. switch (type) {
  127. case 1:
  128. pattern = /[^\d]/g
  129. break
  130. case 2:
  131. pattern = /[^u4E00-u9FA5|d|a-zA-Z|rns,.?!,。?!…—&$=()-+/*{}[]]|s/g
  132. break
  133. }
  134. return event.replace(pattern, '')
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped></style>