listViewStudyDetailPracticeResult.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <a-modal v-model:visible="visible" width="600" @ok="handleOk" title="练习提交" :footer="null">
  3. <a-table
  4. ref="table"
  5. :columns="columns"
  6. :data-source="dataSources"
  7. :row-key="(record) => record.courseId"
  8. bordered
  9. :expand-row-by-click="true"
  10. :pagination="false"
  11. size="small"
  12. >
  13. <template #bodyCell="{ column, text, record }">
  14. <!-- <template v-if="column.dataIndex === 'createTime'">-->
  15. <!-- <span>{{ formatDateTime(record.createTime) }}</span>-->
  16. <!-- </template>-->
  17. <!-- <template v-if="column.dataIndex === 'action'">-->
  18. <!-- &lt;!&ndash; <a-button size="small" @click="handleDetail(record)" style="margin-right: 5px">详情</a-button>&ndash;&gt;-->
  19. <!-- &lt;!&ndash; <a-button size="small" @click="handleEdit(record)" style="margin-right: 5px">编辑</a-button>&ndash;&gt;-->
  20. <!-- <a-popover v-model:visible="popoverVisibles[record.collegeId]" title="确定删除?" trigger="click">-->
  21. <!-- <template #content>-->
  22. <!-- <a-button style="margin-right: 10px" type="primary" @click="handleShelf(record,1)">确定-->
  23. <!-- </a-button>-->
  24. <!-- <a-button @click="()=>{ popoverVisibles[record.collegeId] = false}">取消</a-button>-->
  25. <!-- </template>-->
  26. <!-- &lt;!&ndash; <a-button size="small" style="margin-right: 5px">选择</a-button>&ndash;&gt;-->
  27. <!-- <a-button size="small" @click="handleDelete(record)" style="margin-right: 5px">删除</a-button>-->
  28. <!-- </a-popover>-->
  29. <!-- </template>-->
  30. </template>
  31. </a-table>
  32. <div style="display: flex; width: 100%; justify-content: flex-end; margin-top: 10px">
  33. <a-pagination
  34. v-model:current="pagination.current"
  35. v-model:pageSize="pagination.size"
  36. :total="total"
  37. show-less-items
  38. @change="handlerChange"
  39. />
  40. </div>
  41. </a-modal>
  42. </template>
  43. <script setup>
  44. import tool from '@/utils/tool'
  45. import {ref, onMounted} from 'vue'
  46. import {useRouter} from 'vue-router'
  47. import {parseTime} from "@/utils/exam";
  48. const router = useRouter()
  49. import { overviewLearningProgressApi } from '@/api/statisticalAnalysis/overviewLearningProgress'
  50. const emit = defineEmits(['handleEdit'])
  51. //发布按钮状态
  52. const releaseVisible = ref(false)
  53. const loading = ref(false) // 列表loading
  54. const dataSources = ref([])
  55. const popoverVisible = ref({})
  56. const popoverVisibles = ref({})
  57. const visible = ref(false)
  58. const courseId = ref(null)
  59. const formState = ref({
  60. name: '',
  61. loacl: ''
  62. }) // 列表loading
  63. const columns = [
  64. {
  65. title: '课程课时名称',
  66. dataIndex: 'courseHourName',
  67. // sorter: true,
  68. width: '15%'
  69. },
  70. {
  71. title: '作业分数',
  72. dataIndex: 'userScore',
  73. // sorter: true,
  74. width: '15%'
  75. },
  76. {
  77. title: '学生名称',
  78. dataIndex: 'userName',
  79. // sorter: true,
  80. width: '15%'
  81. },
  82. {
  83. title: '学生id',
  84. dataIndex: 'userId',
  85. // sorter: true,
  86. width: '15%'
  87. },
  88. {
  89. title: '创建日期',
  90. dataIndex: 'createDate',
  91. // sorter: true,
  92. width: '12%'
  93. },
  94. ]
  95. // tool.formatTimestamp()
  96. const formatDateTime = (val) => {
  97. if (!val) return ''
  98. return parseTime(val, '{y}-{m}-{d} {h}:{i}:{s}')
  99. }
  100. const formatTimestamp = (time) => {
  101. return tool.formatTimestamp(time)
  102. }
  103. const total = ref(0)
  104. const pagination = ref({
  105. size: 10,
  106. current: 1,
  107. })
  108. // const onChangeCurrent = (current) => {
  109. // router.push({
  110. // path: '/' + current
  111. // })
  112. // }
  113. const handlerChange = (page, pageSize) => {
  114. console.log('分页参数', page, pageSize)
  115. // pagination.value.size = pageSize
  116. // pagination.value.current = page
  117. getList()
  118. }
  119. const handleOk = () => {
  120. visible.value = false
  121. }
  122. const open = (id) => {
  123. visible.value = true
  124. pagination.value.size = 10
  125. pagination.value.current = 1
  126. courseId.value = id
  127. getList()
  128. }
  129. const handleDetail = (record) => {
  130. console.log('查看详情', record)
  131. router.push({
  132. path: '/portal/courseDetails',
  133. query: {
  134. id: record.courseId
  135. }
  136. })
  137. // 在这里添加查看详情的逻辑
  138. }
  139. // 编辑按钮点击事件
  140. const handleEdit = (record) => {
  141. console.log('编辑记录', record)
  142. // 在这里添加编辑记录的逻辑
  143. emit('handleEdit', record)
  144. }
  145. // 上架按钮点击事件
  146. const handleShelf = (record,num) => {
  147. console.log('上架记录', record)
  148. popoverVisible.value[record.collegeId] = false
  149. // 在这里添加上架记录的逻辑
  150. // {
  151. // "courseId": "1948183431150227458",
  152. // "putawayStatus": 1
  153. // }
  154. // updateCourseStatus({courseId : record.courseId,putawayStatus : num}).then((res)=>{
  155. // getList()
  156. // })
  157. }
  158. // 删除按钮点击事件
  159. const handleDelete = (record) => {
  160. console.log('删除记录', record)
  161. // 在这里添加删除记录的逻辑
  162. }
  163. const getList = () => {
  164. const params = {
  165. courseId: courseId.value,
  166. startTime: undefined,
  167. endTime: undefined,
  168. size : pagination.value.size,
  169. current : pagination.value.current
  170. }
  171. overviewLearningProgressApi.getStudyDetailPracticeResult(params).then((data)=>{
  172. console.log('获取列表', data)
  173. dataSources.value = data.records
  174. pagination.value.current = data.current
  175. pagination.value.size = data.size
  176. total.value = data.total
  177. })
  178. }
  179. const setList = (search) => {
  180. console.log('获取列表 setList',search)
  181. // courseName: '',
  182. // collegeId: '',
  183. // majorId: '',
  184. // courseType: '',
  185. // loacl: []
  186. formState.value = search
  187. pagination.value.current = 1
  188. list({...pagination.value, ...formState.value}).then((data) => {
  189. if (data.code == 200) {
  190. dataSources.value = data.data.records
  191. pagination.value.current = data.data.current
  192. pagination.value.size = data.data.size
  193. total.value = data.data.total
  194. }
  195. // data.records
  196. })
  197. }
  198. // 重置按钮点击事件
  199. onMounted(() => {
  200. // getListData()
  201. // getList()
  202. })
  203. // watch(
  204. // () => dataSources.value,
  205. // (newVal, oldVal) => {
  206. // console.log('数据源变化了 ', ' 新的 ',newVal, ' 旧的 ',oldVal)
  207. // },
  208. // { deep: true, immediate: true }
  209. // )
  210. defineExpose({
  211. open
  212. })
  213. </script>
  214. <style scoped>
  215. .desc p {
  216. margin-bottom: 1em;
  217. }
  218. </style>