index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <div class="flex direction-column full">
  3. <mark-header
  4. :exclude-operations="['remark', 'problem', 'example', 'delete', 'bookmark']"
  5. :paper-path="currentSystemCheckPaper?.filePath"
  6. :secret-number="currentSystemCheckPaper?.secretNumber"
  7. @click="onOperationClick"
  8. >
  9. <template v-if="!hideHeaderButtons">
  10. <!-- <el-button class="m-l-base" size="small" type="primary" @click="onEditScore">修改给分</el-button> -->
  11. <el-button class="m-l-base m-r-auto" size="small" type="primary" @click="onSendBack">打回</el-button>
  12. </template>
  13. </mark-header>
  14. <div class="flex flex-1 overflow-hidden p-base mark-container">
  15. <splitpanes class="default-theme" style="height: 100%" @resize="setPaneSize">
  16. <pane
  17. max-size="80"
  18. :size="paneSize"
  19. class="flex flex-1 direction-column radius-base fill-blank mark-content"
  20. :class="{ 'text-center': center }"
  21. :style="{ 'background-color': backgroundColor }"
  22. >
  23. <span class="preview" @click="onPreview">
  24. <svg-icon name="preview"></svg-icon>
  25. </span>
  26. <!-- <right-button class="next-button" @click="checkNext" /> -->
  27. <div class="flex-1 p-base scroll-auto mark-content-paper img-wrap">
  28. <img :src="dataUrl" alt="" class="paper-img" :style="{ 'background-color': frontColor }" />
  29. <p v-if="currentSystemCheckPaper" class="absolute mark-score">
  30. {{ currentSystemCheckPaper.headerScore ?? currentSystemCheckPaper.markerScore }}
  31. </p>
  32. </div>
  33. <!-- <scoring-panel-with-confirm
  34. :id="currentSystemCheckPaper?.taskId"
  35. v-model:visible="scoringPanelVisible"
  36. v-model:score="modelScore"
  37. modal
  38. :toggle-modal="false"
  39. :auto-visible="false"
  40. :main-number="currentSystemCheckPaper?.mainNumber"
  41. @submit="onSubmit"
  42. ></scoring-panel-with-confirm> -->
  43. <scoring-panel-with-confirm
  44. :id="currentSystemCheckPaper?.taskId"
  45. v-model:visible="scoringPanelVisible"
  46. v-model:score="modelScore"
  47. modal
  48. :auto-visible="false"
  49. :main-number="currentSystemCheckPaper?.mainNumber"
  50. :subject-code="formModel.subjectCode"
  51. @submit="onSubmit"
  52. ></scoring-panel-with-confirm>
  53. </pane>
  54. <pane
  55. v-loading="loading"
  56. max-size="80"
  57. :size="100 - paneSize"
  58. class="flex direction-column p-base radius-base fill-blank table-view"
  59. >
  60. <base-form size="small" :model="formModel" :items="formItems" :label-width="'52px'">
  61. <template #form-item-search>
  62. <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
  63. </template>
  64. </base-form>
  65. <div class="flex items-center justify-between detail-info-table-header">
  66. <el-button custom-1 size="small" class="detail-info-label">
  67. <span class="">系统抽查卷: 共</span>
  68. <span class="m-l-extra-small detail-info-label-num">{{ total }}</span>
  69. </el-button>
  70. <el-pagination
  71. v-bind="pagination"
  72. v-model:current-page="currentPage"
  73. size="small"
  74. class="m-t-unset"
  75. background
  76. right
  77. hide-on-single-page
  78. :pager-count="3"
  79. small
  80. ></el-pagination>
  81. </div>
  82. <div class="flex-1 scroll-auto m-t-mini">
  83. <base-table
  84. ref="tableRef"
  85. border
  86. stripe
  87. size="small"
  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="currentSystemCheckPaper?.filePath"></image-preview>
  102. <mark-history-list
  103. :id="currentViewHistory?.taskId"
  104. v-model="visibleHistory"
  105. :task="currentViewHistory"
  106. ></mark-history-list>
  107. <send-back-mark
  108. :id="currentSystemCheckPaper?.id"
  109. v-model="sendBackVisible"
  110. type="system-check"
  111. @rejected="onRejected"
  112. ></send-back-mark>
  113. </template>
  114. <script setup lang="tsx" name="SystemCheck">
  115. /** 系统抽查卷 */
  116. import { reactive, ref, computed, watch } from 'vue'
  117. import { ElButton, ElPagination, ElMessage } from 'element-plus'
  118. import { add } from '@/utils/common'
  119. import { useSetImgBg } from '@/hooks/useSetImgBg'
  120. import useVW from '@/hooks/useVW'
  121. import useFetch from '@/hooks/useFetch'
  122. import useForm from '@/hooks/useForm'
  123. import useOptions from '@/hooks/useOptions'
  124. import useMarkHeader from '@/hooks/useMarkHeader'
  125. import useTable from '@/hooks/useTable'
  126. import useTableCheck from '@/hooks/useTableCheck'
  127. import MarkHeader from '@/components/shared/MarkHeader.vue'
  128. import SvgIcon from '@/components/common/SvgIcon.vue'
  129. import BaseForm from '@/components/element/BaseForm.vue'
  130. import BaseTable from '@/components/element/BaseTable.vue'
  131. import MarkHistoryList from '@/components/shared/MarkHistoryList.vue'
  132. import SendBackMark from '@/components/shared/SendBackMark.vue'
  133. import RightButton from '@/components/shared/RightButton.vue'
  134. import ScoringPanelWithConfirm from '@/components/shared/ScoringPanelWithConfirm.vue'
  135. import ImagePreview from '@/components/shared/ImagePreview.vue'
  136. import SecNumberStatus from '@/components/common/secNumberStatus.vue'
  137. import type { SetImgBgOption } from '@/hooks/useSetImgBg'
  138. import type { ExtractApiParams } from '@/api/api'
  139. import type { MarkHeaderInstance, EpFormItem, EpTableColumn } from 'global-type'
  140. import { Splitpanes, Pane } from 'splitpanes'
  141. import { setPaneSize } from '@/utils/common'
  142. import useMainStore from '@/store/main'
  143. const mainStore = useMainStore()
  144. const paneSize = computed(() => {
  145. return mainStore.paneSizeConfig[location.pathname] || 60
  146. })
  147. const {
  148. rotate,
  149. scale,
  150. center,
  151. frontColor,
  152. backgroundColor,
  153. onBack,
  154. onScaleChange,
  155. onCenter,
  156. onRotate,
  157. setBackgroundColor,
  158. setFrontColor,
  159. onViewStandard,
  160. } = useMarkHeader()
  161. /** 给分板 */
  162. const scoringPanelVisible = ref<boolean>(true)
  163. /** 图片预览 */
  164. const previewModalVisible = ref<boolean>(false)
  165. /** 打回弹窗 */
  166. const sendBackVisible = ref<boolean>(false)
  167. const modelScore = ref<number[]>([])
  168. /** 刷新 */
  169. const onRefresh = () => {
  170. onSearch()
  171. }
  172. /** 预览试卷 */
  173. const onPreview = () => {
  174. previewModalVisible.value = true
  175. }
  176. /** 修改给分 */
  177. const onEditScore = () => {
  178. scoringPanelVisible.value = true
  179. modelScore.value = currentSystemCheckPaper.value.markScores
  180. }
  181. /** 打回 */
  182. const onSendBack = () => {
  183. sendBackVisible.value = true
  184. }
  185. /** 打回成功 */
  186. const onRejected = () => {
  187. // onSearch()
  188. fetchTable()
  189. }
  190. type OperationClick = MarkHeaderInstance['onClick']
  191. type OperationType = Parameters<Exclude<OperationClick, undefined>>[0]['type']
  192. const operationHandles: Partial<Record<OperationType, (...args: any) => void>> = {
  193. back: onBack,
  194. 'scale-change': onScaleChange,
  195. center: onCenter,
  196. rotate: onRotate,
  197. 'front-color': setFrontColor,
  198. 'background-color': setBackgroundColor,
  199. refresh: onRefresh,
  200. standard: onViewStandard,
  201. }
  202. const onOperationClick: OperationClick = ({ type, value }) => {
  203. operationHandles[type]?.(value)
  204. }
  205. const { subjectList, mainQuestionList, dataModel, changeModelValue, onOptionInit, isLeader, isExpert } = useOptions([
  206. 'subject',
  207. 'question',
  208. ])
  209. const formModel = reactive<any>({
  210. mainNumber: dataModel.question,
  211. status: 'INITIAL',
  212. level: '',
  213. // pageNumber: 1,
  214. // pageSize: 9999999,
  215. subjectCode: dataModel.subject,
  216. })
  217. const hideHeaderButtons = computed(() => {
  218. return formModel.status === 'REJECT'
  219. })
  220. watch(dataModel, () => {
  221. formModel.mainNumber = dataModel.question
  222. formModel.subjectCode = dataModel.subject
  223. })
  224. const { defineColumn, _ } = useForm()
  225. const span10 = defineColumn(_, '', { span: 10 })
  226. const formItems = computed<EpFormItem[]>(() => [
  227. span10({
  228. rowKey: 'row-1',
  229. label: '科目',
  230. prop: 'subjectCode',
  231. slotType: 'select',
  232. labelWidth: '46px',
  233. slot: { options: subjectList.value, onChange: changeModelValue('subject'), disabled: !isExpert.value },
  234. }),
  235. span10({
  236. rowKey: 'row-1',
  237. label: '大题',
  238. prop: 'mainNumber',
  239. slotType: 'select',
  240. labelWidth: '46px',
  241. slot: {
  242. options: mainQuestionList.value,
  243. onChange: changeModelValue('question'),
  244. disabled: !isExpert.value && !isLeader.value,
  245. },
  246. }),
  247. span10({
  248. rowKey: 'row-2',
  249. label: '档次',
  250. prop: 'level',
  251. slotType: 'select',
  252. slot: {
  253. // options: [{ label: '全部', value: '' }, ...[1, 2, 3, 4, 5].map((n) => ({ label: n, value: `LEVEL_${n}` }))],
  254. // options: [
  255. // { label: '全部', value: '' },
  256. // ...['0', '2', '5', '8', '11', '14'].map((n) => ({ label: n, value: `LEVEL_${n}` })),
  257. // ],
  258. options: [{ label: '全部', value: '' }, ...(levelOptions.value || []).map((n: any) => ({ label: n, value: n }))],
  259. },
  260. }),
  261. { rowKey: 'row-1', slotName: 'search', labelWidth: '10px', colProp: { span: 4 } },
  262. span10({
  263. rowKey: 'row-2',
  264. label: '类型',
  265. prop: 'status',
  266. slotType: 'select',
  267. labelWidth: '46px',
  268. slot: {
  269. options: [
  270. { label: '未浏览', value: 'INITIAL' },
  271. { label: '已浏览', value: 'VIEWED' },
  272. { label: '已给分', value: 'GRADED' },
  273. { label: '已打回', value: 'REJECT' },
  274. ],
  275. },
  276. }),
  277. ])
  278. /** 系统抽查卷列表 */
  279. const columns: EpTableColumn[] = [
  280. {
  281. label: '密号',
  282. prop: 'secretNumber',
  283. minWidth: 110,
  284. fixed: 'left',
  285. formatter(row: any) {
  286. return (
  287. <SecNumberStatus
  288. secretNumber={row.secretNumber}
  289. checked={row.checked}
  290. corrected={row.corrected}
  291. ></SecNumberStatus>
  292. )
  293. },
  294. },
  295. { label: '评卷员', prop: 'markerName', minWidth: 80 },
  296. { label: '评卷员给分', prop: 'markerScore', minWidth: 108, sortable: true },
  297. { label: '组长给分', prop: 'headerScore', minWidth: 94, sortable: true },
  298. // { label: '评卷时间', prop: 'markTime', width: 160 },
  299. { label: '客观分', prop: 'objectiveScore', minWidth: 90, sortable: true },
  300. { label: '客主比', prop: 'ratio', minWidth: 90, sortable: true },
  301. { label: '成绩', prop: 'markScore', minWidth: 90, sortable: true },
  302. { label: '抽查次数', prop: 'checkCount', minWidth: 94, sortable: true },
  303. { label: '评卷时间', prop: 'markTime', minWidth: 130 },
  304. ]
  305. // const { fetch: getSystemSpotList, result: systemSpotList, loading } = useFetch('getSystemSpotList')
  306. const { fetch: getSystemCheckLevel, result: levelOptions } = useFetch('getSystemCheckLevel')
  307. getSystemCheckLevel()
  308. const { pagination, currentPage, data, fetchTable, loading, total } = useTable('getSystemSpotList', formModel, {
  309. pageSize: 100,
  310. })
  311. const {
  312. tableRef,
  313. tableData,
  314. current: currentSystemCheckPaper,
  315. currentView: currentViewHistory,
  316. next: checkNext,
  317. visibleHistory,
  318. onDbClick,
  319. onCurrentChange,
  320. nextRow,
  321. // } = useTableCheck(systemSpotList)
  322. } = useTableCheck(data)
  323. watch(currentSystemCheckPaper, () => {
  324. if (currentSystemCheckPaper.value) {
  325. useFetch('viewSystemSpotPaper').fetch({ id: currentSystemCheckPaper.value.id })
  326. // modelScore.value = [currentSystemCheckPaper.value?.headerScore ?? (currentSystemCheckPaper.value?.markScore || 0)]
  327. modelScore.value = currentSystemCheckPaper.value?.markScores || []
  328. }
  329. })
  330. const onSearch = async () => {
  331. // getSystemSpotList(formModel)
  332. currentPage.value = 1
  333. }
  334. /** 系统抽查卷打分 */
  335. const { fetch: markSystemSpotPaper } = useFetch('markSystemSpotPaper')
  336. const onSubmit = async () => {
  337. if (currentSystemCheckPaper.value) {
  338. const scores = JSON.parse(JSON.stringify(modelScore.value))
  339. let res: any = await markSystemSpotPaper({ id: currentSystemCheckPaper.value.id, scores: modelScore.value })
  340. currentSystemCheckPaper.value.markScore = currentSystemCheckPaper.value.headerScore = add(...scores)
  341. currentSystemCheckPaper.value.markScores = scores
  342. currentSystemCheckPaper.value.checked = res.checked
  343. currentSystemCheckPaper.value.corrected = res.corrected
  344. currentSystemCheckPaper.value.objectiveScore = res.objectiveScore
  345. currentSystemCheckPaper.value.ratio = res.ratio
  346. currentSystemCheckPaper.value.markerScore = res.markerScore
  347. ElMessage.success('修改成功')
  348. // scoringPanelVisible.value = false
  349. // onSearch()
  350. // fetchTable()
  351. nextRow()
  352. }
  353. }
  354. onOptionInit(onSearch)
  355. const imgOption = computed<SetImgBgOption>(() => {
  356. return {
  357. image: currentSystemCheckPaper?.value?.filePath,
  358. rotate: rotate.value,
  359. scale: scale.value,
  360. }
  361. })
  362. const { drawing, dataUrl } = useSetImgBg(imgOption, frontColor, setFrontColor)
  363. </script>
  364. <style scoped lang="scss">
  365. .mark-container {
  366. .mark-content {
  367. position: relative;
  368. .preview {
  369. position: absolute;
  370. cursor: pointer;
  371. top: 20px;
  372. right: 25px;
  373. font-size: 38px;
  374. }
  375. .next-button {
  376. position: absolute;
  377. right: -20px;
  378. top: 300px;
  379. }
  380. .mark-content-paper {
  381. img {
  382. max-width: 100%;
  383. }
  384. }
  385. }
  386. .table-view {
  387. // width: 480px;
  388. .detail-info-label {
  389. .detail-info-label-num {
  390. min-width: 32px;
  391. height: 24px;
  392. line-height: 24px;
  393. background: #00987b;
  394. border-radius: 4px;
  395. }
  396. }
  397. }
  398. }
  399. </style>