QueryView.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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: 300px">
  6. <a-input v-model:value="formState.courseName" placeholder="请输入课程名字" allowClear />
  7. </a-form-item>
  8. <!-- <a-form-item label="" style="width: 300px">-->
  9. <!--&lt;!&ndash; <a-cascader&ndash;&gt;-->
  10. <!--&lt;!&ndash; v-model:value="formState.loacl"&ndash;&gt;-->
  11. <!--&lt;!&ndash; :options="options"&ndash;&gt;-->
  12. <!--&lt;!&ndash; placeholder="选择院校"&ndash;&gt;-->
  13. <!--&lt;!&ndash; change-on-select&ndash;&gt;-->
  14. <!--&lt;!&ndash; allowClear&ndash;&gt;-->
  15. <!--&lt;!&ndash; :field-names="{ label: 'name', value: 'id', children: 'children' }"&ndash;&gt;-->
  16. <!--&lt;!&ndash; />&ndash;&gt;-->
  17. <!-- <a-select-->
  18. <!-- v-model:value="formState.collegeId"-->
  19. <!-- :fieldNames="{ label: 'name', value: 'id' }"-->
  20. <!-- :options="collegeMajorOptions"-->
  21. <!-- placeholder="请选择院系"-->
  22. <!-- allowClear-->
  23. <!-- />-->
  24. <!-- </a-form-item>-->
  25. <!-- <a-form-item label="" style="width: 20%">-->
  26. <!--&lt;!&ndash; <a-input v-model:value="formState.type" placeholder="选择课程类型" allowClear />&ndash;&gt;-->
  27. <!-- <a-select-->
  28. <!-- ref="select"-->
  29. <!-- placeholder="选择课程类型"-->
  30. <!-- v-model:value="formState.courseType"-->
  31. <!-- :fieldNames="{ label: 'dictLabel', value: 'dictValue' }"-->
  32. <!-- :options="COURSE_TYPE"-->
  33. <!-- allowClear-->
  34. <!-- ></a-select>-->
  35. <!-- </a-form-item>-->
  36. <!-- <a-form-item label="" style="width: 30%">-->
  37. <!-- <a-range-picker v-model:value="formState.time" allowClear />-->
  38. <!-- </a-form-item>-->
  39. </a-form>
  40. </div>
  41. <div>
  42. <a-button type="primary" @click="handleSearch">
  43. <template #icon><SearchOutlined /></template>
  44. 查询
  45. </a-button>
  46. <a-button style="margin-left: 10px" @click="handleReset">
  47. <template #icon><ReloadOutlined /></template>
  48. 重置
  49. </a-button>
  50. </div>
  51. </div>
  52. </template>
  53. <script setup>
  54. import { ref, onMounted } from 'vue'
  55. import { SearchOutlined, ReloadOutlined } from '@ant-design/icons-vue'
  56. import { useRouter } from 'vue-router'
  57. import collegeApi from '@/api/college'
  58. import resourceAuditApi from '@/api/resourceAudit.js'
  59. import tool from '@/utils/tool'
  60. const emit = defineEmits([])
  61. const router = useRouter()
  62. const collegeMajorOptions = ref([]) //院系
  63. //发布按钮状态
  64. const releaseVisible = ref(false)
  65. const loading = ref(false) // 列表loading
  66. const COURSE_TYPE = tool.dictTypeList('COURSE_TYPE')
  67. const formState = ref({
  68. gradesName: undefined,
  69. collegeId: undefined,
  70. majorId: undefined,
  71. courseType: undefined,
  72. time : [],
  73. loacl: []
  74. }) // 列表loading
  75. const options = ref([
  76. // {
  77. // value: 'zhejiang',
  78. // label: 'Zhejiang',
  79. // isLeaf: false
  80. // },
  81. // {
  82. // value: 'jiangsu',
  83. // label: 'Jiangsu',
  84. // isLeaf: false
  85. // }
  86. ])
  87. // 搜索值
  88. const searchValue = ref('')
  89. const pagination = reactive({
  90. pageSize: 10,
  91. pageNum: 1,
  92. total: 0
  93. })
  94. const onChangeCurrent = (current) => {
  95. router.push({
  96. path: '/' + current
  97. })
  98. }
  99. const publishedData = ref()
  100. //发布确定
  101. // 上传资源模态框
  102. const uploadModalVisible = ref(false)
  103. //院系组织查询
  104. const getOrgTreeSelector = () => {
  105. resourceAuditApi
  106. .orgList()
  107. .then((res) => {
  108. console.log(res.data, '获取学院')
  109. collegeMajorOptions.value = res.data
  110. })
  111. .catch((err) => {
  112. console.log(err)
  113. })
  114. }
  115. const loadData = (selectedOptions) => {
  116. const targetOption = selectedOptions[selectedOptions.length - 1]
  117. targetOption.loading = true
  118. // load options lazily
  119. setTimeout(() => {
  120. targetOption.loading = false
  121. targetOption.children = [
  122. {
  123. label: `${targetOption.label} Dynamic 1`,
  124. value: 'dynamic1'
  125. },
  126. {
  127. label: `${targetOption.label} Dynamic 2`,
  128. value: 'dynamic2'
  129. }
  130. ]
  131. options.value = [...options.value]
  132. }, 1000)
  133. }
  134. const getList = () => {
  135. // collegeApi.treeAll().then((data) => {
  136. // options.value = data
  137. // })
  138. resourceAuditApi
  139. .orgList()
  140. .then((res) => {
  141. collegeMajorOptions.value = res.data
  142. })
  143. .catch((err) => {
  144. console.log(err)
  145. })
  146. }
  147. const handleSearch = () => {
  148. console.log('执行查询操作', formState.value,COURSE_TYPE)
  149. // 在这里添加查询逻辑
  150. let newJson = JSON.parse(JSON.stringify(formState.value))
  151. console.log('执行查询操作123 ', newJson.loacl.length)
  152. for (let i = 0; i < newJson.loacl.length; i++) {
  153. let item = newJson.loacl[i]
  154. if(i == 0){
  155. newJson.collegeId = item
  156. }
  157. if(i == 1){
  158. newJson.collegeTwoId = item
  159. }
  160. if(i == 2){
  161. newJson.collegeThreeId = item
  162. }
  163. }
  164. newJson.loacl = undefined
  165. if(newJson.time.length == 2){
  166. let beginTime = tool.formatTimesYearMonthDay(newJson.time[0])
  167. let endTime= tool.formatTimesYearMonthDay(newJson.time[1])
  168. newJson.beginTime = beginTime
  169. newJson.endTime = endTime
  170. newJson.time= undefined
  171. }
  172. emit('handlerSearch', newJson)
  173. }
  174. // 重置按钮点击事件
  175. const handleReset = () => {
  176. formState.value = {
  177. courseName: undefined,
  178. collegeId: undefined,
  179. majorId: undefined,
  180. courseType: undefined,
  181. time : [],
  182. loacl: []
  183. // 其他需要重置的字段
  184. }
  185. emit('handlerSearch', formState.value)
  186. }
  187. onMounted(() => {
  188. // getListData()
  189. getList()
  190. })
  191. </script>
  192. <style scoped>
  193. .desc p {
  194. margin-bottom: 1em;
  195. }
  196. </style>