QueryView.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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: 20%">
  6. <a-input v-model:value="formState.courseName" placeholder="请输入课程名称" allowClear />
  7. </a-form-item>
  8. <!-- <a-form-item label="" style="width: 15%">-->
  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.collegeTwoId"-->
  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. <!-- <a-input v-model:value="formState.type" placeholder="选择课程类型" allowClear />-->
  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. courseName: 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. collegeMajorOptions.value = res.data
  109. })
  110. .catch((err) => {
  111. console.log(err)
  112. })
  113. }
  114. const loadData = (selectedOptions) => {
  115. const targetOption = selectedOptions[selectedOptions.length - 1]
  116. targetOption.loading = true
  117. // load options lazily
  118. setTimeout(() => {
  119. targetOption.loading = false
  120. targetOption.children = [
  121. {
  122. label: `${targetOption.label} Dynamic 1`,
  123. value: 'dynamic1'
  124. },
  125. {
  126. label: `${targetOption.label} Dynamic 2`,
  127. value: 'dynamic2'
  128. }
  129. ]
  130. options.value = [...options.value]
  131. }, 1000)
  132. }
  133. const getList = () => {
  134. // collegeApi.treeAll().then((data) => {
  135. // options.value = data
  136. // })
  137. resourceAuditApi
  138. .orgList()
  139. .then((res) => {
  140. collegeMajorOptions.value = res.data
  141. })
  142. .catch((err) => {
  143. console.log(err)
  144. })
  145. }
  146. const handleSearch = () => {
  147. console.log('执行查询操作', formState.value,COURSE_TYPE)
  148. // 在这里添加查询逻辑
  149. let newJson = JSON.parse(JSON.stringify(formState.value))
  150. console.log('执行查询操作123 ', newJson.loacl.length)
  151. for (let i = 0; i < newJson.loacl.length; i++) {
  152. let item = newJson.loacl[i]
  153. if(i == 0){
  154. newJson.collegeId = item
  155. }
  156. if(i == 1){
  157. newJson.collegeTwoId = item
  158. }
  159. if(i == 2){
  160. newJson.collegeThreeId = item
  161. }
  162. }
  163. newJson.loacl = undefined
  164. if(newJson.time.length == 2){
  165. let beginTime = tool.formatTimesYearMonthDay(newJson.time[0])
  166. let endTime= tool.formatTimesYearMonthDay(newJson.time[1])
  167. newJson.beginTime = beginTime
  168. newJson.endTime = endTime
  169. newJson.time= undefined
  170. }
  171. emit('handlerSearch', newJson)
  172. }
  173. // 重置按钮点击事件
  174. const handleReset = () => {
  175. formState.value = {
  176. courseName: undefined,
  177. collegeId: undefined,
  178. majorId: undefined,
  179. courseType: undefined,
  180. time : [],
  181. loacl: []
  182. // 其他需要重置的字段
  183. }
  184. emit('handlerSearch', formState.value)
  185. }
  186. onMounted(() => {
  187. // getListData()
  188. getList()
  189. })
  190. </script>
  191. <style scoped>
  192. .desc p {
  193. margin-bottom: 1em;
  194. }
  195. </style>