index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight">
  5. <div class="w_1200">
  6. <el-col :span="24" class="one">
  7. <el-col
  8. :span="24"
  9. class="list"
  10. v-for="(item, index) in list"
  11. :key="index"
  12. @click="toView(item)"
  13. >
  14. <el-col :span="24" class="name">
  15. <el-tooltip effect="dark" :content="item.name" placement="top">
  16. {{ item.name || '暂无姓名' }}
  17. </el-tooltip>
  18. </el-col>
  19. <el-row class="other">
  20. <el-col :span="8" class="other_1">
  21. <span>手机号:</span>
  22. {{ item.phone || '暂无' }}
  23. </el-col>
  24. <el-col :span="8" class="other_1">
  25. <span>证件类型:</span>
  26. {{ getDict(item.cardType, 'cardType') }}
  27. </el-col>
  28. <el-col :span="8" class="other_1">
  29. <span>证件号码:</span>
  30. {{ item.card || '暂无' }}
  31. </el-col>
  32. </el-row>
  33. <el-col :span="24" class="brief textOver">
  34. {{ item.remark || '没有更多备注' }}
  35. </el-col>
  36. </el-col>
  37. </el-col>
  38. <el-col :span="24" class="two">
  39. <el-pagination
  40. background
  41. layout="total, prev, pager, next"
  42. :page-sizes="[10, 20, 50, 100, 200]"
  43. :total="total"
  44. :page-size="limit"
  45. v-model:current-page="currentPage"
  46. @current-change="changePage"
  47. @size-change="sizeChange"
  48. >
  49. </el-pagination>
  50. </el-col>
  51. </div>
  52. </el-col>
  53. </el-row>
  54. </div>
  55. </template>
  56. <script setup>
  57. import { get } from 'lodash-es'
  58. const $checkRes = inject('$checkRes')
  59. import { UserStore } from '@/store/user'
  60. const userStore = UserStore()
  61. const user = computed(() => userStore.user)
  62. // 接口
  63. import { SignStore } from '@/store/api/platform/sign'
  64. import { DictDataStore } from '@/store/api/system/dictData'
  65. const store = SignStore()
  66. const dictDataStore = DictDataStore()
  67. // 路由
  68. const router = useRouter()
  69. // 加载中
  70. const loading = ref(false)
  71. // 列表
  72. const list = ref([])
  73. let skip = 0
  74. let limit = inject('limit')
  75. const total = ref(0)
  76. // 字典表
  77. const cardTypeList = ref([])
  78. // 查看
  79. const toView = (item) => {
  80. router.push({ path: '/innovation/detail', query: { id: item.match } })
  81. }
  82. // 请求
  83. onMounted(async () => {
  84. loading.value = true
  85. await searchOther()
  86. await search({ skip, limit })
  87. loading.value = false
  88. })
  89. const searchOther = async () => {
  90. let result
  91. // 证件类型
  92. result = await dictDataStore.query({ code: 'cardType', is_use: '0' })
  93. if ($checkRes(result)) cardTypeList.value = result.data
  94. }
  95. const search = async (query = { skip: 0, limit }) => {
  96. const info = {
  97. skip: query.skip,
  98. limit: query.limit,
  99. user: user.value._id
  100. }
  101. const res = await store.query(info)
  102. if (res.errcode == '0') {
  103. list.value = res.data
  104. total.value = res.total
  105. }
  106. }
  107. // 字典数据转换
  108. const getDict = (data, model) => {
  109. let res
  110. if (model == 'cardType') res = cardTypeList.value.find((f) => f.value == data)
  111. return get(res, 'label')
  112. }
  113. const currentPage = ref(1)
  114. // 分页
  115. const changePage = (page = currentPage.value) => {
  116. search({ skip: (page - 1) * limit, limit: limit })
  117. }
  118. const sizeChange = (limits) => {
  119. limit = limits
  120. currentPage.value = 1
  121. search({ skip: 0, limit: limit })
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .main {
  126. background: rgb(248, 248, 248);
  127. .one {
  128. margin-top: 20px;
  129. background: #ffffff;
  130. border-radius: 10px;
  131. padding: 15px;
  132. .list {
  133. margin-bottom: 10px;
  134. border-bottom: 1px solid #ebebeb;
  135. padding-bottom: 10px;
  136. .name {
  137. color: #337ab7;
  138. font-size: 18px;
  139. font-weight: bold;
  140. display: inline-block;
  141. margin: 10px 0;
  142. }
  143. .name:hover {
  144. color: #2374ff;
  145. }
  146. .other {
  147. padding: 5px 0;
  148. .other_1 {
  149. font-family: 'PingFangSC-Light', 'Microsoft YaHei', 'WenQuanYi Micro Hei', arial,
  150. sans-serif;
  151. font-size: 12px;
  152. font-weight: normal;
  153. }
  154. .other_1:hover {
  155. color: #2374ff;
  156. }
  157. }
  158. .brief {
  159. line-height: 30px;
  160. color: #666;
  161. font-size: 14px;
  162. }
  163. }
  164. }
  165. .two {
  166. display: flex;
  167. flex-direction: row-reverse;
  168. padding: 20px;
  169. }
  170. }
  171. </style>