index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="full">
  3. <div class="p-l-base p-t-medium-base fill-blank">
  4. <base-form size="small" :label-width="useVW(52)" :model="model" :items="items">
  5. <template #form-item-search>
  6. <el-button type="primary" @click="onSearch">查询</el-button>
  7. </template>
  8. </base-form>
  9. </div>
  10. <div class="p-base flex justify-between">
  11. <el-card class="flex-1" shadow="never">
  12. <base-table
  13. :columns="columns1"
  14. :data="selfCheckAnalysisList"
  15. highlight-current-row
  16. @current-change="onCheckSelfCheckAnalysis"
  17. @row-dblclick="onSelfCheckAnalysisDBClick"
  18. ></base-table>
  19. </el-card>
  20. <el-card class="flex-1 m-l-base m-r-base center-card" shadow="never">
  21. <base-table
  22. :columns="columns2"
  23. highlight-current-row
  24. :data="selfCheckAnalysisDiffList"
  25. @current-change="onCheckSelfCheckAnalysisDiff"
  26. ></base-table>
  27. </el-card>
  28. <el-card class="flex-1" shadow="never">
  29. <base-table
  30. :columns="columns3"
  31. :data="currentSelfCheckAnalysisDiffItem?.papers"
  32. @row-dblclick="onPaperDBClick"
  33. ></base-table>
  34. </el-card>
  35. </div>
  36. </div>
  37. </template>
  38. <script setup lang="ts" name="QualitySelfCheck">
  39. /** 自查一致性分析 */
  40. import { reactive, watch, computed, ref } from 'vue'
  41. import { ElButton, ElCard } from 'element-plus'
  42. import { omit } from 'lodash-es'
  43. import BaseForm from '@/components/element/BaseForm.vue'
  44. import BaseTable from '@/components/element/BaseTable.vue'
  45. import useFetch from '@/hooks/useFetch'
  46. import useForm from '@/hooks/useForm'
  47. import useVW from '@/hooks/useVW'
  48. import useOptions from '@/hooks/useOptions'
  49. import useTableCheck from '@/hooks/useTableCheck'
  50. import type { ExtractApiParams, ExtractApiResponse } from '@/api/api'
  51. import type { EpFormItem, EpTableColumn } from 'global-type'
  52. type FormModel = Omit<ExtractApiParams<'selfCheckAnalysis'>, 'startTime' | 'endTime'>
  53. const model = reactive<FormModel & { time: string }>({
  54. time: '',
  55. subjectCode: '',
  56. questionMainNumber: void 0,
  57. markingGroupNumber: void 0,
  58. })
  59. const { subjectList, mainQuestionList, groupListWithAll, dataModel, onOptionInit, changeModelValue } = useOptions([
  60. 'subject',
  61. 'question',
  62. 'group',
  63. ])
  64. watch(dataModel, () => {
  65. model.subjectCode = dataModel.subject || ''
  66. model.questionMainNumber = dataModel.question
  67. model.markingGroupNumber = dataModel.group
  68. })
  69. const { defineColumn, _ } = useForm()
  70. const OneRowSpan4 = defineColumn(_, 'row-1', { span: 4 })
  71. const OneRowSpan6 = defineColumn(_, 'row-1', { span: 6 })
  72. const items = computed<EpFormItem[]>(() => {
  73. return [
  74. OneRowSpan4({
  75. label: '科目',
  76. slotType: 'select',
  77. prop: 'subjectCode',
  78. labelWidth: useVW(40),
  79. slot: { options: subjectList.value, onChange: changeModelValue('subject') },
  80. }),
  81. OneRowSpan4({
  82. label: '大题',
  83. slotType: 'select',
  84. prop: 'questionMainNumber',
  85. slot: { options: mainQuestionList.value, onChange: changeModelValue('question') },
  86. }),
  87. OneRowSpan4({
  88. label: '小组',
  89. slotType: 'select',
  90. prop: 'markingGroupNumber',
  91. slot: { options: groupListWithAll.value, onChange: changeModelValue('group') },
  92. }),
  93. OneRowSpan6({
  94. label: '时间',
  95. slotType: 'dateTime',
  96. prop: 'time',
  97. slot: {
  98. type: 'datetimerange',
  99. valueFormat: 'YYYYMMDDHHmmss',
  100. },
  101. }),
  102. OneRowSpan4({ slotName: 'search' }),
  103. ]
  104. })
  105. const { fetch: selfCheckAnalysis, result: selfCheckAnalysisList } = useFetch('selfCheckAnalysis')
  106. const { onCurrentChange: onCheckSelfCheckAnalysis, current: currentSelfCheckAnalysis } =
  107. useTableCheck(selfCheckAnalysisList)
  108. const columns1: EpTableColumn<ExtractArrayValue<ExtractApiResponse<'selfCheckAnalysis'>>>[] = [
  109. { label: '序号', type: 'index', width: 100 },
  110. { label: '评卷员', prop: 'markerName' },
  111. { label: '自查份数', prop: 'checkCount' },
  112. { label: '平均离差', prop: 'avgDiff' },
  113. ]
  114. const {
  115. fetch: getSelfCheckAnalysisDiffList,
  116. result: selfCheckAnalysisDiffList,
  117. reset,
  118. } = useFetch('selfCheckAnalysisDiffList')
  119. const { onCurrentChange: onCheckSelfCheckAnalysisDiff, current: currentSelfCheckAnalysisDiffItem } =
  120. useTableCheck(selfCheckAnalysisDiffList)
  121. const columns2: EpTableColumn<ExtractArrayValue<ExtractApiResponse<'selfCheckAnalysisDiffList'>>>[] = [
  122. { label: '离差值', prop: 'diff' },
  123. {
  124. label: '离差个数',
  125. formatter(row) {
  126. return `${row.papers?.length}`
  127. },
  128. },
  129. ]
  130. const papers = computed(() => {
  131. return currentSelfCheckAnalysisDiffItem?.value?.papers || []
  132. })
  133. const columns3: EpTableColumn[] = [
  134. { label: '密号', prop: 'secretNumber' },
  135. { label: '分数', prop: 'markScore' },
  136. { label: '上次分数', prop: 'lastMarkScore' },
  137. { label: '评卷时间', prop: 'markTime' },
  138. ]
  139. watch(currentSelfCheckAnalysis, () => {
  140. reset()
  141. if (currentSelfCheckAnalysis.value) {
  142. getSelfCheckAnalysisDiffList({
  143. subjectCode: model.subjectCode,
  144. questionMainNumber: model.questionMainNumber,
  145. markerId: currentSelfCheckAnalysis.value.markerId,
  146. })
  147. }
  148. })
  149. function onSearch() {
  150. selfCheckAnalysis({ ...omit(model, 'time'), startTime: model.time[0], endTime: model.time[1] })
  151. }
  152. /** 自查一致性列表双击 */
  153. const onSelfCheckAnalysisDBClick = () => {
  154. console.log('自查一致性列表双击')
  155. }
  156. /** 试卷列表双击 */
  157. const onPaperDBClick = () => {
  158. console.log('自查一致性列表双击')
  159. }
  160. onOptionInit(onSearch)
  161. </script>
  162. <style scoped lang="scss">
  163. .center-card {
  164. min-width: 260px;
  165. max-width: 260px;
  166. }
  167. </style>