lifanagju_citu 2 місяців тому
батько
коміт
767e671109
1 змінених файлів з 24 додано та 17 видалено
  1. 24 17
      src/views/recruit/teacher/studentList/index.vue

+ 24 - 17
src/views/recruit/teacher/studentList/index.vue

@@ -5,7 +5,8 @@
     <div class="d-flex justify-space-between mt-8 mb-10">
       <div class="d-flex align-center">
         <!-- <span class="mx-3 color-666 font-size-14">院系</span> -->
-        <Autocomplete class="mr-3" v-model="query.schoolDepartmentName" :item="yuanXi"></Autocomplete>
+        <Autocomplete class="mr-3" v-model="query.schoolDepartmentName" :item="schoolDepartmentItem"></Autocomplete>
+        <TextInput class="mr-3" v-model="query.studentName" :item="studentNameItem" @enter="handleSearch()"></TextInput>
         <v-btn color="primary" class="half-button ml-3" @click="handleSearch()">查 询</v-btn>
         <v-btn class="half-button ml-3" prepend-icon="mdi-refresh" variant="outlined" color="primary" @click="handleSearch(true)">刷 新</v-btn>
       </div>
@@ -56,6 +57,16 @@ const query = ref({
   pageSize: 20,
   pageNo: 1,
   schoolDepartmentName: null,
+  studentName: null,
+})
+
+const studentNameItem = ref({
+  type: 'text',
+  width: 300,
+  label: '请输入学生姓名搜索',
+  clearable: true,
+  hideDetails: true,
+  // appendInnerIcon: 'mdi-magnify'
 })
 
 const headers = [
@@ -67,57 +78,53 @@ const headers = [
   { title: '录用岗位', key: 'test', sortable: false, value: item => formatName(item.test) },
   { title: '操作', key: 'actions', sortable: false }
 ]
-
-const tableData = ref([])
-tableData.value = [{ test: 'ces', person: { name: '123' }, id: '123'}]
-const total = ref(0)
-// 列表
+// 数据列表
+const tableData = ref([]); const total = ref(0)
 const getData = async (isRefresh = false) => {
-  query.value.schoolDepartmentName = '中文系'
+  if (!query.value?.schoolDepartmentName) return
+  
   const { data, total: number } = await studentList(query.value)
-
   tableData.value = data?.records?.length && data.records.map(item=>{
     const { enterpeiseName, enterpriseRecruitJobName, jobDept } = item
     return { ...item.student, enterpeiseName, enterpriseRecruitJobName, jobDept }
   })
-
   total.value = number
   if (isRefresh) Snackbar.success('刷新成功')
 }
 
+// 分页
 const handleChangePage = (val) => {
 	query.value.pageNo = val
 	getData()
 }
 
+// 查询
 const handleSearch = (refresh = false) => {
   query.value.pageNo = 1
   getData(refresh)
 }
 
 const schoolInfo = ref(localStorage.getItem('schoolInfo') ? JSON.parse(localStorage.getItem('schoolInfo')) : {})
-
-const yuanXi = ref({ width: 300, items: [], clearable: false, hideDetails: true, label: '请选择院系' })
+const schoolDepartmentItem = ref({ width: 300, items: [], clearable: false, hideDetails: true, label: '请选择院系' })
 
 // 列表
-const getYuanXiItem = async () => {
+const getSchoolDepartmentItemItem = async () => {
   const schoolId = schoolInfo.value?.school?.schoolId || null
   if (!schoolId) return Snackbar.warning('获取学校信息失败!')
   
   const { data } = await schoolOrganization({ schoolId })
-  yuanXi.value.items = data?.length && data.map(item=> {
+  schoolDepartmentItem.value.items = data?.length && data.map(item=> {
     return item?.title ? { label: item.title, value: item.title } : null
   }).filter(Boolean)
 
-  if (yuanXi.value.items?.length) {
-    query.value.schoolDepartmentName = yuanXi.value.items[0].value
+  if (schoolDepartmentItem.value.items?.length) {
+    query.value.schoolDepartmentName = schoolDepartmentItem.value.items[0].value
     getData()
   }
 }
-getYuanXiItem()
+getSchoolDepartmentItemItem()
 
 const studentDetails = (id) => {
-  // if (id) router.push(`/recruit/teacher/studentList/detail/${id}`)
   if (id) window.open(`/recruit/teacher/studentList/detail/${id}`)
 }