search.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <!-- 搜索工作栏 -->
  3. <ContentWrap>
  4. <el-form
  5. class="-mb-15px"
  6. :model="queryParams"
  7. ref="queryFormRef"
  8. :inline="true"
  9. label-width="68px"
  10. >
  11. <el-form-item label="姓名" prop="name">
  12. <el-input v-model="queryParams.name" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" class="!w-130px" />
  13. </el-form-item>
  14. <el-form-item label="联系电话" prop="phone">
  15. <el-input v-model="queryParams.phone" placeholder="请输入联系电话" clearable @keyup.enter="handleQuery" class="!w-130px" />
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button @click="handleQuery" type="primary"><Icon icon="ep:search" /> 搜索</el-button>
  19. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  20. </el-form-item>
  21. </el-form>
  22. </ContentWrap>
  23. <div v-if="paramsVerify && !list?.length" class="tip">
  24. <div>{{ tipContent }}</div>
  25. </div>
  26. <!-- 列表 -->
  27. <ContentWrap v-loading="loading">
  28. <div class="listBox">
  29. <personCard
  30. v-for="item of list"
  31. :key="item.id"
  32. :data="item"
  33. class="item"
  34. @detail="detail"
  35. />
  36. </div>
  37. </ContentWrap>
  38. <ContentWrap v-if="total">
  39. <Pagination
  40. :total="total"
  41. layout="total, prev, pager, next"
  42. v-model:page="queryParams.pageNo"
  43. v-model:limit="queryParams.pageSize"
  44. @pagination="getList"
  45. />
  46. </ContentWrap>
  47. </template>
  48. <script setup>
  49. defineOptions({ name: 'TalentMapSearch' })
  50. import { TalentMap } from '@/api/menduner/system/talentMap'
  51. import { PersonInfoApi } from '@/api/menduner/system/person'
  52. import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
  53. import personCard from './personCard.vue'
  54. const emit = defineEmits(['detail'])
  55. const props = defineProps({
  56. detailButTxt: String,
  57. paramsVerify: Boolean,
  58. searchName: String
  59. })
  60. const message = useMessage() // 消息弹窗
  61. const { t } = useI18n() // 国际化
  62. const loading = ref(false) // 列表的加载中
  63. const list = ref([]) // 列表的数据
  64. const total = ref(0) // 列表的总页数
  65. const queryParams = reactive({
  66. pageNo: 1,
  67. pageSize: 5,
  68. name: '',
  69. phone: undefined
  70. })
  71. const queryFormRef = ref() // 搜索的表单
  72. /** 查询列表 */
  73. const getList = async () => {
  74. loading.value = true
  75. try {
  76. const data = await PersonInfoApi.getPersonInfoPage(queryParams)
  77. list.value = data?.list.map(e => {
  78. return {
  79. ...e.person,
  80. // Boolean(exp.year) || Boolean(exp.enterpriseName) || Boolean(exp.positionName)
  81. // workExpList: e.work ? [e.work] : []
  82. }
  83. }) || []
  84. total.value = data?.total || 0
  85. } finally {
  86. loading.value = false
  87. }
  88. }
  89. const tipContent = '输入人才姓名、电话查询后可使用门墩儿人才库数据填充表单!'
  90. /** 搜索按钮操作 */
  91. const handleQuery = () => {
  92. queryParams.pageNo = 1
  93. if (props.paramsVerify && !queryParams.name && !queryParams.phone) {
  94. message.warning('请输入后查询 !')
  95. return
  96. }
  97. getList()
  98. }
  99. /** 重置按钮操作 */
  100. const resetQuery = () => {
  101. queryFormRef.value.resetFields()
  102. handleQuery()
  103. }
  104. const detail = (row) => {
  105. emit('detail', { id: row.id, userId: row.userId })
  106. }
  107. /** 初始化 **/
  108. // onMounted(async () => {
  109. // if (props.paramsVerify) return
  110. // setTimeout(() => {
  111. // if (props.searchName) {
  112. // queryParams.name = props.searchName
  113. // }
  114. // }, 1000)
  115. // getList()
  116. // })
  117. if (!props.paramsVerify) getList()
  118. </script>
  119. <style lang="scss" scoped>
  120. .tip {
  121. text-align: center;
  122. margin-bottom: 10px;
  123. color: #e6a23c;
  124. }
  125. .listBox {
  126. min-height: 200px;
  127. max-height: calc(100vh - 400px);
  128. overflow-y: auto;
  129. padding: 10px;
  130. .item {
  131. margin-bottom: 10px;
  132. }
  133. }
  134. </style>