search.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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-160px" />
  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-160px" />
  16. </el-form-item>
  17. <el-form-item label="酒店品牌" prop="brand">
  18. <el-input v-model="queryParams.brand" placeholder="请输入" clearable @keyup.enter="handleQuery" class="!w-160px" />
  19. </el-form-item>
  20. <el-form-item label="最高学历" prop="eduType">
  21. <el-select
  22. v-model="queryParams.eduType"
  23. placeholder="请选择"
  24. clearable
  25. class="!w-160px"
  26. >
  27. <el-option
  28. v-for="dict in getIntDictOptions(DICT_TYPE.MENDUNER_EDUCATION_TYPE)"
  29. :key="dict.value"
  30. :label="dict.label"
  31. :value="dict.value"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="工作经验" prop="expType">
  36. <el-select
  37. v-model="queryParams.expType"
  38. placeholder="请选择"
  39. clearable
  40. class="!w-160px"
  41. >
  42. <el-option
  43. v-for="dict in getIntDictOptions(DICT_TYPE.MENDUNER_EXP_TYPE)"
  44. :key="dict.value"
  45. :label="dict.label"
  46. :value="dict.value"
  47. />
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="所在城市" prop="areaId">
  51. <el-cascader
  52. v-model="queryParams.areaId"
  53. :options="areaTreeData"
  54. :props="{ label: 'name', value: 'id', multiple: true, emitPath: false, checkStrictly: true }"
  55. collapse-tags
  56. collapse-tags-tooltip
  57. class="!w-160px"
  58. />
  59. </el-form-item>
  60. <el-form-item label="意向城市" prop="workAreaIds">
  61. <el-cascader
  62. v-model="queryParams.workAreaIds"
  63. :options="areaTreeData"
  64. :props="{ label: 'name', value: 'id', multiple: true, emitPath: false, checkStrictly: true }"
  65. collapse-tags
  66. collapse-tags-tooltip
  67. class="!w-160px"
  68. />
  69. </el-form-item>
  70. <el-form-item label="意向职位" prop="positionIds">
  71. <el-select
  72. v-model="queryParams.positionIds"
  73. placeholder="请选择"
  74. clearable
  75. multiple
  76. collapse-tags
  77. collapse-tags-tooltip
  78. class="!w-160px"
  79. >
  80. <el-option
  81. v-for="dict in positionTreeData"
  82. :key="dict?.id"
  83. :label="dict?.nameCn"
  84. :value="dict?.id"
  85. />
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item>
  89. <el-button @click="handleQuery" type="primary"><Icon icon="ep:search" /> 搜索</el-button>
  90. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  91. </el-form-item>
  92. </el-form>
  93. </ContentWrap>
  94. <!-- 列表 -->
  95. <ContentWrap v-loading="loading">
  96. <div class="listBox">
  97. <div v-if="!loading && !list?.length" class="tip" style="line-height: 200px;">
  98. <div v-if="paramsBool">未查到任何数据,请更换查询条件后再试!</div>
  99. <div v-else>请输入查询条件!</div>
  100. </div>
  101. <personCard
  102. v-for="item of list"
  103. :key="item.id"
  104. :data="item"
  105. class="item"
  106. @detail="detail"
  107. />
  108. </div>
  109. </ContentWrap>
  110. <ContentWrap v-if="total">
  111. <Pagination
  112. :total="total"
  113. layout="total, prev, pager, next"
  114. v-model:page="queryParams.pageNo"
  115. v-model:limit="queryParams.pageSize"
  116. @pagination="getList"
  117. />
  118. </ContentWrap>
  119. </template>
  120. <script setup>
  121. defineOptions({ name: 'TalentMapSearch' })
  122. import { TalentMap } from '@/api/menduner/system/talentMap'
  123. import { PersonInfoApi } from '@/api/menduner/system/person'
  124. import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
  125. import personCard from './personCard.vue'
  126. import { getDict } from '@/hooks/web/useDictionaries'
  127. const emit = defineEmits(['detail'])
  128. const props = defineProps({
  129. paramsVerify: Boolean, // 查询条件必传
  130. searchName: String
  131. })
  132. const message = useMessage() // 消息弹窗
  133. const { t } = useI18n() // 国际化
  134. const loading = ref(false) // 列表的加载中
  135. const list = ref([]) // 列表的数据
  136. const total = ref(0) // 列表的总页数
  137. const queryParams = reactive({
  138. pageNo: 1,
  139. pageSize: 5,
  140. name: '',
  141. phone: undefined,
  142. brand: '',
  143. eduType: undefined,
  144. expType: undefined,
  145. areaId: [],
  146. workAreaIds: [],
  147. positionIds: [],
  148. })
  149. const queryFormRef = ref() // 搜索的表单
  150. // 地区列表
  151. const areaTreeData = ref([])
  152. const getDictData = async () => {
  153. const { data } = await getDict('areaTreeData', {}, 'areaTreeData')
  154. const obj = data.find(e => e.name === '中国')
  155. const list = obj?.children ? obj.children.map(e =>{
  156. // 市辖区直接显示区
  157. const municipality = e.children && e.children.length && e.children[0].name === '市辖区'
  158. if (municipality && e.children[0].children?.length) e.children = e.children[0].children
  159. return e
  160. }) : []
  161. areaTreeData.value = list.length ? list : []
  162. }
  163. getDictData()
  164. const positionTreeData = ref([])
  165. const getPositionTreeData = async () => {
  166. const { data } = await getDict('positionTreeData', {}, 'positionTreeData')
  167. positionTreeData.value = data || []
  168. }
  169. getPositionTreeData()
  170. /** 查询列表 */
  171. const getList = async () => {
  172. loading.value = true
  173. try {
  174. const data = await PersonInfoApi.getPersonInfoPage(queryParams)
  175. list.value = data?.list.map(e => {
  176. return {
  177. ...e.person,
  178. workExpList: e.work ? [e.work] : []
  179. }
  180. }) || []
  181. total.value = data?.total || 0
  182. } finally {
  183. loading.value = false
  184. }
  185. }
  186. const paramsBool = ref(false) // 是否存在筛选条件
  187. /** 搜索按钮操作 */
  188. const handleQuery = () => {
  189. const obj = { pageNo: null, pageSize: null, ...queryParams }
  190. paramsBool.value = Object.values(obj).some(value => value !== undefined && value !== null && value !== '' && value.length)
  191. if (props.paramsVerify && !paramsBool.value) return message.warning('请输入查询条件后再查询 !')
  192. queryParams.pageNo = 1
  193. getList()
  194. }
  195. /** 重置按钮操作 */
  196. const resetQuery = () => {
  197. queryFormRef.value.resetFields()
  198. handleQuery()
  199. }
  200. const detail = (row) => {
  201. emit('detail', { id: row.id, userId: row.userId })
  202. }
  203. /** 初始化 **/
  204. // onMounted(async () => {
  205. // if (props.paramsVerify) return
  206. // setTimeout(() => {
  207. // if (props.searchName) {
  208. // queryParams.name = props.searchName
  209. // }
  210. // }, 1000)
  211. // getList()
  212. // })
  213. if (!props.paramsVerify) getList()
  214. </script>
  215. <style lang="scss" scoped>
  216. .tip {
  217. text-align: center;
  218. margin-bottom: 10px;
  219. color: #e6a23c;
  220. }
  221. .listBox {
  222. min-height: 200px;
  223. max-height: calc(100vh - 400px);
  224. overflow-y: auto;
  225. padding: 10px;
  226. .item {
  227. margin-bottom: 10px;
  228. }
  229. }
  230. </style>