QueryView.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div style="display: flex; justify-content: space-between; align-items: center">
  3. <div>
  4. <a-form layout="inline" :model="formState">
  5. <a-form-item label="" style="width: 40%">
  6. <a-input v-model:value="formState.title" placeholder="请输入课程名称" allowClear />
  7. </a-form-item>
  8. <a-form-item label="" style="width: 50%">
  9. <a-range-picker v-model:value="formState.time" allowClear />
  10. </a-form-item>
  11. </a-form>
  12. </div>
  13. <div>
  14. <a-button type="primary" @click="handleSearch">
  15. <template #icon><SearchOutlined /></template>
  16. 查询
  17. </a-button>
  18. <a-button style="margin-left: 10px" @click="handleReset">
  19. <template #icon><ReloadOutlined /></template>
  20. 重置
  21. </a-button>
  22. </div>
  23. </div>
  24. </template>
  25. <script setup>
  26. import { ref, onMounted } from 'vue'
  27. import { SearchOutlined, ReloadOutlined } from '@ant-design/icons-vue'
  28. import { useRouter } from 'vue-router'
  29. import collegeApi from '@/api/college'
  30. import resourceAuditApi from '@/api/resourceAudit.js'
  31. import tool from '@/utils/tool'
  32. import Footer from "@/views/portal/components/Footer.vue";
  33. const emit = defineEmits([])
  34. const router = useRouter()
  35. const collegeMajorOptions = ref([]) //院系
  36. //发布按钮状态
  37. const releaseVisible = ref(false)
  38. const loading = ref(false) // 列表loading
  39. const COURSE_TYPE = tool.dictTypeList('COURSE_TYPE')
  40. const formState = ref({
  41. title: undefined,
  42. time : [],
  43. loacl: []
  44. }) // 列表loading
  45. const options = ref([
  46. // {
  47. // value: 'zhejiang',
  48. // label: 'Zhejiang',
  49. // isLeaf: false
  50. // },
  51. // {
  52. // value: 'jiangsu',
  53. // label: 'Jiangsu',
  54. // isLeaf: false
  55. // }
  56. ])
  57. // 搜索值
  58. const searchValue = ref('')
  59. const pagination = reactive({
  60. pageSize: 10,
  61. pageNum: 1,
  62. total: 0
  63. })
  64. // const onChangeCurrent = (current) => {
  65. // router.push({
  66. // path: '/' + current
  67. // })
  68. // }
  69. const publishedData = ref()
  70. //发布确定
  71. // 上传资源模态框
  72. const uploadModalVisible = ref(false)
  73. //院系组织查询
  74. // const getOrgTreeSelector = () => {
  75. // resourceAuditApi
  76. // .orgList()
  77. // .then((res) => {
  78. // console.log(res.data, '获取学院')
  79. // collegeMajorOptions.value = res.data
  80. // })
  81. // .catch((err) => {
  82. // console.log(err)
  83. // })
  84. // }
  85. const loadData = (selectedOptions) => {
  86. const targetOption = selectedOptions[selectedOptions.length - 1]
  87. targetOption.loading = true
  88. // load options lazily
  89. setTimeout(() => {
  90. targetOption.loading = false
  91. targetOption.children = [
  92. {
  93. label: `${targetOption.label} Dynamic 1`,
  94. value: 'dynamic1'
  95. },
  96. {
  97. label: `${targetOption.label} Dynamic 2`,
  98. value: 'dynamic2'
  99. }
  100. ]
  101. options.value = [...options.value]
  102. }, 1000)
  103. }
  104. const getList = () => {
  105. // collegeApi.treeAll().then((data) => {
  106. // options.value = data
  107. // })
  108. // resourceAuditApi
  109. // .orgList()
  110. // .then((res) => {
  111. // collegeMajorOptions.value = res.data
  112. // })
  113. // .catch((err) => {
  114. // console.log(err)
  115. // })
  116. }
  117. const handleSearch = () => {
  118. console.log('执行查询操作', formState.value,COURSE_TYPE)
  119. // 在这里添加查询逻辑
  120. let newJson = JSON.parse(JSON.stringify(formState.value))
  121. console.log('执行查询操作123 ', newJson.loacl.length)
  122. if(newJson.time.length == 2){
  123. let beginTime = tool.formatTimesYearMonthDay(newJson.time[0])
  124. let endTime= tool.formatTimesYearMonthDay(newJson.time[1])
  125. newJson.beginTime = beginTime
  126. newJson.endTime = endTime
  127. newJson.time= undefined
  128. }
  129. emit('handlerSearch', newJson)
  130. }
  131. // 重置按钮点击事件
  132. const handleReset = () => {
  133. formState.value = {
  134. courseName: undefined,
  135. collegeId: undefined,
  136. majorId: undefined,
  137. courseType: undefined,
  138. time : [],
  139. loacl: []
  140. // 其他需要重置的字段
  141. }
  142. emit('handlerSearch', formState.value)
  143. }
  144. onMounted(() => {
  145. // getListData()
  146. getList()
  147. })
  148. </script>
  149. <style scoped>
  150. .desc p {
  151. margin-bottom: 1em;
  152. }
  153. </style>