universities-search.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <!-- 搜索表单 -->
  2. <template>
  3. <ele-card :body-style="{ paddingBottom: '8px' }">
  4. <ProSearch
  5. :items="formItems"
  6. ref="searchRef"
  7. @search="search"
  8. :initKeys="initKeys"
  9. ></ProSearch>
  10. </ele-card>
  11. </template>
  12. <script setup>
  13. import { reactive, ref, defineEmits } from 'vue';
  14. import ProSearch from '@/components/CommonPage/ProSearch2.vue';
  15. let { proxy } = getCurrentInstance();
  16. const emit = defineEmits(['search']);
  17. const provinceList = ref([]);
  18. const cityList = ref([]);
  19. const formItems = computed(() => {
  20. return [
  21. { type: 'input', label: '学校名称', prop: 'schoolName' },
  22. {
  23. type: 'select',
  24. label: '省份',
  25. prop: 'provinceId',
  26. options: provinceList.value.map((d) => {
  27. return { label: d.district, value: d.id };
  28. }),
  29. props: {
  30. filterable: true,
  31. onChange: (val) => {
  32. searchRef.value?.setData({ cityId: '' });
  33. getProviceList(val).then((res) => {
  34. cityList.value = res.data.data;
  35. });
  36. }
  37. }
  38. },
  39. {
  40. type: 'select',
  41. label: '所在市',
  42. prop: 'cityId',
  43. options: cityList.value.map((d) => {
  44. return { label: d.district, value: d.id };
  45. }),
  46. props: {
  47. filterable: true
  48. }
  49. },
  50. {
  51. type: 'dictSelect',
  52. label: '办学层次',
  53. prop: 'schoolLevel',
  54. props: {
  55. code: 'school_level'
  56. }
  57. },
  58. { type: 'input', label: '主管部门', prop: 'departmentName' },
  59. {
  60. type: 'dictSelect',
  61. label: '标记',
  62. prop: 'shcoolTag',
  63. props: {
  64. code: 'school_tag'
  65. }
  66. }
  67. ];
  68. });
  69. function getProviceList(id = 1) {
  70. return proxy.$http.get(`/baseinfo/districtInfo/findInfo/${id}`);
  71. }
  72. getProviceList().then((res) => {
  73. provinceList.value = res.data.data;
  74. });
  75. const initKeys = reactive({
  76. schoolName: '',
  77. provinceId: '',
  78. cityId: '',
  79. schoolLevel: '',
  80. departmentName: '',
  81. shcoolTag: ''
  82. });
  83. const searchRef = ref(null);
  84. /** 搜索 */
  85. const search = (data) => {
  86. emit('search', { ...data });
  87. };
  88. </script>