index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <div class="flex direction-column full">
  3. <mark-header
  4. :exclude-operations="['remark', 'problem', 'example', 'delete', 'bookmark']"
  5. :paper-path="current?.filePath"
  6. :secret-number="current?.secretNumber"
  7. @click="onOperationClick"
  8. >
  9. <!-- <el-button :disabled="!current?.taskId" class="m-l-base" size="small" type="primary" @click="onEditScore"
  10. >修改给分</el-button
  11. > -->
  12. <el-button :disabled="!current?.taskId" class="m-l-base m-r-auto" size="small" type="primary" @click="onSendBack"
  13. >打回</el-button
  14. >
  15. </mark-header>
  16. <div class="flex flex-1 overflow-hidden p-base mark-container">
  17. <splitpanes class="default-theme" style="height: 100%" @resize="setPaneSize">
  18. <pane
  19. max-size="80"
  20. :size="paneSize"
  21. class="flex flex-1 direction-column radius-base fill-blank mark-content"
  22. :class="{ 'text-center': center }"
  23. :style="{ 'background-color': backgroundColor }"
  24. >
  25. <span class="preview" @click="onPreview">
  26. <svg-icon name="preview"></svg-icon>
  27. </span>
  28. <p v-if="current" class="absolute mark-score">{{ current.markScore }}</p>
  29. <!-- <right-button class="next-button" @click="checkNext" /> -->
  30. <div class="flex-1 p-base scroll-auto mark-content-paper img-wrap">
  31. <img :src="dataUrl" alt="" class="paper-img" :style="{ 'background-color': frontColor }" />
  32. </div>
  33. <!-- <scoring-panel-with-confirm
  34. :id="current?.taskId"
  35. v-model:visible="editScoreVisible"
  36. v-model:score="modelScore"
  37. :main-number="current?.mainNumber"
  38. modal
  39. :auto-visible="false"
  40. :toggle-modal="false"
  41. @submit="onSubmit"
  42. ></scoring-panel-with-confirm> -->
  43. <scoring-panel-with-confirm
  44. :id="current?.taskId"
  45. v-model:visible="editScoreVisible"
  46. v-model:score="modelScore"
  47. :main-number="current?.mainNumber"
  48. :subject-code="query.subjectCode"
  49. modal
  50. :auto-visible="false"
  51. @submit="onSubmit"
  52. ></scoring-panel-with-confirm>
  53. </pane>
  54. <pane
  55. max-size="80"
  56. :size="100 - paneSize"
  57. class="flex direction-column p-base radius-base fill-blank table-view"
  58. >
  59. <!-- <div class="flex items-center p-b-base m-b-base marker-name">
  60. <span>评卷员</span>
  61. <span>{{ query.markerName }}</span>
  62. </div> -->
  63. <div class="flex items-center justify-between detail-info-table-header">
  64. <el-button custom-1 size="small" class="detail-info-label">
  65. <span class="">总数:</span>
  66. <span class="m-l-extra-small detail-info-label-num">{{ pagination.total }}</span>
  67. </el-button>
  68. <btn-pagination v-model="currentPage" :pagination="pagination"></btn-pagination>
  69. <!-- <el-pagination
  70. v-bind="pagination"
  71. v-model:current-page="currentPage"
  72. size="small"
  73. class="m-t-unset"
  74. background
  75. right
  76. hide-on-single-page
  77. :pager-count="3"
  78. small
  79. ></el-pagination> -->
  80. </div>
  81. <div class="flex-1 scroll-auto m-t-mini">
  82. <base-table
  83. ref="tableRef"
  84. border
  85. stripe
  86. size="small"
  87. v-bind="pagination"
  88. height="100%"
  89. :data="tableData"
  90. :columns="columns"
  91. highlight-current-row
  92. :cell-style="{ padding: '6px 0' }"
  93. @current-change="onCurrentChange"
  94. @row-dblclick="onDbClick"
  95. ></base-table>
  96. </div>
  97. </pane>
  98. </splitpanes>
  99. </div>
  100. </div>
  101. <image-preview v-model="previewModalVisible" :url="current?.filePath"></image-preview>
  102. <send-back-mark
  103. :id="current?.taskId"
  104. v-model="sendBackVisible"
  105. type="custom-check"
  106. @rejected="onRejected"
  107. ></send-back-mark>
  108. <mark-history-list
  109. :id="currentViewHistory?.taskId"
  110. v-model="visibleHistory"
  111. :task="currentViewHistory"
  112. ></mark-history-list>
  113. </template>
  114. <script setup lang="tsx" name="AnalysisViewMarked">
  115. // <script setup lang="ts" name="ViewMarkedDetail">
  116. /** 提取阅卷明细 */
  117. import { ref, computed, watch } from 'vue'
  118. import { useRoute } from 'vue-router'
  119. import { ElButton, ElMessage, ElPagination } from 'element-plus'
  120. import { add } from '@/utils/common'
  121. import { useSetImgBg } from '@/hooks/useSetImgBg'
  122. import useFetch from '@/hooks/useFetch'
  123. import useTable from '@/hooks/useTable'
  124. import useTableCheck from '@/hooks/useTableCheck'
  125. import useMarkHeader from '@/hooks/useMarkHeader'
  126. import MarkHeader from '@/components/shared/MarkHeader.vue'
  127. import BaseTable from '@/components/element/BaseTable.vue'
  128. import MarkHistoryList from '@/components/shared/MarkHistoryList.vue'
  129. import RightButton from '@/components/shared/RightButton.vue'
  130. import SvgIcon from '@/components/common/SvgIcon.vue'
  131. import ImagePreview from '@/components/shared/ImagePreview.vue'
  132. import ScoringPanelWithConfirm from '@/components/shared/ScoringPanelWithConfirm.vue'
  133. import SendBackMark from '@/components/shared/SendBackMark.vue'
  134. import SecNumberStatus from '@/components/common/secNumberStatus.vue'
  135. import type { SetImgBgOption } from '@/hooks/useSetImgBg'
  136. import type { ExtractMultipleApiResponse, ExtractApiParams, ExtractApiResponse } from '@/api/api'
  137. import type { MarkHeaderInstance, EpTableColumn } from 'global-type'
  138. import { Splitpanes, Pane } from 'splitpanes'
  139. import { setPaneSize } from '@/utils/common'
  140. import useMainStore from '@/store/main'
  141. import BtnPagination from '@/components/common/BtnPagination'
  142. type RowType = ExtractMultipleApiResponse<'getPersonalMarkDetail'> & { index: number }
  143. const mainStore = useMainStore()
  144. const paneSize = computed(() => {
  145. return mainStore.paneSizeConfig[location.pathname] || 60
  146. })
  147. const props = defineProps<{
  148. markerId: string
  149. }>()
  150. const { query } = useRoute()
  151. /** 打回弹窗 */
  152. const sendBackVisible = ref<boolean>(false)
  153. /** 打回 */
  154. const onSendBack = () => {
  155. sendBackVisible.value = true
  156. }
  157. /** 打回成功 */
  158. const onRejected = () => {
  159. // onRefresh()
  160. ElMessage.success('打回成功')
  161. }
  162. /** 给分板 */
  163. const editScoreVisible = ref<boolean>(true)
  164. /** 图片预览 */
  165. const previewModalVisible = ref<boolean>(false)
  166. /** 分数 */
  167. const modelScore = ref<number[]>([])
  168. const {
  169. rotate,
  170. scale,
  171. center,
  172. frontColor,
  173. backgroundColor,
  174. onBack,
  175. onScaleChange,
  176. onCenter,
  177. onRotate,
  178. setBackgroundColor,
  179. setFrontColor,
  180. onViewStandard,
  181. } = useMarkHeader()
  182. /** 刷新 */
  183. const onRefresh = () => {
  184. fetchTable()
  185. }
  186. /** 预览试卷 */
  187. const onPreview = () => {
  188. previewModalVisible.value = true
  189. }
  190. const onEditScore = () => {
  191. editScoreVisible.value = true
  192. }
  193. type OperationClick = MarkHeaderInstance['onClick']
  194. type OperationType = Parameters<Exclude<OperationClick, undefined>>[0]['type']
  195. const operationHandles: Partial<Record<OperationType, (...args: any) => void>> = {
  196. back: onBack,
  197. 'scale-change': onScaleChange,
  198. center: onCenter,
  199. rotate: onRotate,
  200. 'front-color': setFrontColor,
  201. 'background-color': setBackgroundColor,
  202. refresh: onRefresh,
  203. standard: onViewStandard,
  204. }
  205. const onOperationClick: OperationClick = ({ type, value }) => {
  206. operationHandles[type]?.(value)
  207. }
  208. const columns: EpTableColumn<RowType>[] = [
  209. {
  210. label: '评卷员',
  211. prop: 'markerName',
  212. minWidth: 90,
  213. formatter(row: any) {
  214. return (
  215. <SecNumberStatus
  216. secretNumber={row.markerName}
  217. checked={row.checked}
  218. corrected={row.corrected}
  219. ></SecNumberStatus>
  220. )
  221. },
  222. },
  223. {
  224. label: '密号',
  225. prop: 'secretNumber',
  226. minWidth: 110,
  227. },
  228. { label: '给分', prop: 'markerScore', minWidth: 70 },
  229. { label: '客观分', prop: 'objectiveScore', minWidth: 70 },
  230. { label: '客主比', prop: 'markerRatio', minWidth: 80 },
  231. { label: '成绩', prop: 'markScore', minWidth: 70 },
  232. { label: '评卷时间', prop: 'markTime', minWidth: 130 },
  233. ]
  234. const { pagination, currentPage, data, fetchTable } = useTable('getPersonalMarkDetail', {
  235. markerId: props.markerId,
  236. score: (query.score as string) || '',
  237. pageSize: 100,
  238. subjectCode: query.subjectCode as string,
  239. mainNumber: query.questionMainNumber as string,
  240. })
  241. const queryPosition: any = query.markScore
  242. ? { markScore: query.markScore }
  243. : query.markerRatio
  244. ? { markerRatio: query.markerRatio }
  245. : null
  246. const {
  247. tableRef,
  248. tableData,
  249. current,
  250. currentView: currentViewHistory,
  251. next: checkNext,
  252. visibleHistory,
  253. onDbClick,
  254. onCurrentChange,
  255. nextRow,
  256. } = useTableCheck(data, true, queryPosition)
  257. /** 确定给分 */
  258. const { fetch: updatePersonalMarkDetailScore } = useFetch('updatePersonalMarkDetailScore')
  259. const onSubmit = async () => {
  260. if (current.value) {
  261. const scores = JSON.parse(JSON.stringify(modelScore.value))
  262. await updatePersonalMarkDetailScore({
  263. taskId: current.value.taskId,
  264. scores: modelScore.value,
  265. source: (query.source as string) || '',
  266. })
  267. // current.value.markerScore = add(...scores)
  268. current.value.markScore = add(...scores)
  269. ElMessage.success('修改成功')
  270. // editScoreVisible.value = false
  271. // onRefresh()
  272. nextRow()
  273. }
  274. }
  275. // watch(current, () => {
  276. // modelScore.value = [current.value?.markerScore || 0]
  277. // })
  278. watch(current, () => {
  279. if (current.value) {
  280. useFetch('viewActiveCheck').fetch({ taskId: current.value?.taskId })
  281. }
  282. })
  283. const imgOption = computed<SetImgBgOption>(() => {
  284. return {
  285. image: current?.value?.filePath || '',
  286. rotate: rotate.value,
  287. scale: scale.value,
  288. }
  289. })
  290. const { drawing, dataUrl } = useSetImgBg(imgOption, frontColor, setFrontColor)
  291. onRefresh()
  292. </script>
  293. <style scoped lang="scss">
  294. .mark-container {
  295. .mark-content {
  296. position: relative;
  297. .preview {
  298. position: absolute;
  299. cursor: pointer;
  300. top: 20px;
  301. right: 25px;
  302. font-size: 38px;
  303. }
  304. .next-button {
  305. position: absolute;
  306. right: -20px;
  307. top: 300px;
  308. }
  309. .mark-content-paper {
  310. img {
  311. max-width: 100%;
  312. }
  313. }
  314. }
  315. .table-view {
  316. // width: 580px;
  317. .marker-name {
  318. border-bottom: $OnePixelLine;
  319. }
  320. .detail-info-label {
  321. .detail-info-label-num {
  322. min-width: 32px;
  323. height: 24px;
  324. line-height: 24px;
  325. background: #00987b;
  326. border-radius: 4px;
  327. }
  328. }
  329. }
  330. }
  331. </style>