index.vue 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <div class="flex-item flex-h">
  6. <!-- <el-button size="mini" type="success" @click="addGoodsType">新增商品类型</el-button> -->
  7. </div>
  8. <ul>
  9. <li>
  10. <!-- <span>选择案场:</span> -->
  11. <el-select v-model="CaseId" placeholder="请选择">
  12. <el-option
  13. key=""
  14. label="所有案场"
  15. value="">
  16. </el-option>
  17. <el-option
  18. v-for="item in cases"
  19. :key="item.CaseId"
  20. :label="item.CaseName"
  21. :value="item.CaseId">
  22. </el-option>
  23. </el-select>
  24. </li>
  25. <li>
  26. <el-input
  27. placeholder="请输入用户名"
  28. v-model="name"
  29. >
  30. </el-input>
  31. </li>
  32. <li>
  33. <el-input
  34. placeholder="请输入手机号"
  35. v-model="mobile"
  36. >
  37. </el-input>
  38. </li>
  39. </ul>
  40. <el-button
  41. size="mini"
  42. type="primary" @click="search">搜索</el-button>
  43. </div>
  44. <div class="moreFilter"></div>
  45. </div>
  46. <div class="system-table-box">
  47. <el-table
  48. :data="currentList"
  49. stripe
  50. style="width: 100%">
  51. <el-table-column
  52. prop="CaseName"
  53. label="案场">
  54. </el-table-column>
  55. <el-table-column
  56. prop="CustomerName"
  57. label="用户名">
  58. </el-table-column>
  59. <el-table-column
  60. prop="Phone"
  61. label="手机号">
  62. </el-table-column>
  63. <el-table-column
  64. prop="Sex"
  65. label="性别">
  66. </el-table-column>
  67. <el-table-column
  68. label="检测时间">
  69. <template slot-scope="scope">
  70. <label>{{toolClass.dateFormat(scope.row.CreateDate)}}</label>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. </div>
  75. <el-pagination
  76. @current-change="handleCurrentChange"
  77. :current-page.sync="postData.page"
  78. :page-size="postData.pagesize"
  79. layout="prev, pager, next, jumper"
  80. :total="total">
  81. </el-pagination>
  82. </div>
  83. </template>
  84. <script>
  85. import { mapState, createNamespacedHelpers } from 'vuex'
  86. const { mapState: mapHealthState, mapActions: mapHealthActions } = createNamespacedHelpers('health')
  87. export default {
  88. name: '',
  89. data () {
  90. return {
  91. total: 0,
  92. name: '',
  93. mobile: '',
  94. postData: { // 表格搜索条件
  95. caseid: '',
  96. page: 1, // 当前页码
  97. pagesize: 10, // 请求数据量
  98. },
  99. currentList: []
  100. }
  101. },
  102. mounted () {
  103. this.$nextTick(function () {
  104. this.getList()
  105. })
  106. },
  107. computed: {
  108. ...mapState({
  109. cases: x => x.app.cases.list,
  110. defaultCaseId: x => x.app.cases.default
  111. }),
  112. ...mapHealthState({
  113. list: x => x.healthList
  114. }),
  115. CaseId: {
  116. get () {
  117. return this.postData.caseid || this.defaultCaseId
  118. },
  119. set (val) {
  120. this.postData.caseid = val
  121. }
  122. }
  123. },
  124. methods: {
  125. ...mapHealthActions(['getHealthList']),
  126. search () { // 搜索
  127. this.postData.page = 1
  128. this.currentList = []
  129. this.getList()
  130. },
  131. getCaseName (caseid) {
  132. return (this.cases.filter(x => x.CaseId === caseid)[0] || {}).CaseName
  133. },
  134. getList () { // 获取列表
  135. this.getHealthList({ ...this.postData, caseid: this.CaseId, phone: this.mobile, name: this.name }).then((res) => {
  136. this.currentList = this.list.list
  137. this.postData.page = this.list.page
  138. this.total = this.list.pagenum
  139. })
  140. },
  141. handleCurrentChange (val) { // 跳转到分页
  142. this.getList()
  143. }
  144. }
  145. }
  146. </script>
  147. <!-- Add "scoped" attribute to limit CSS to this component only -->
  148. <style lang="scss" scoped>
  149. </style>