StandardDialog.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div v-if="visible" v-dialogResizeStandard="'can-resize-standard'" class="standard-dialog can-resize-standard">
  3. <div class="standard-head">
  4. <span>评分标准</span>
  5. <div class="head-btn-box flex justify-center items-center" @click="closeDialog">
  6. <el-icon><close /></el-icon>
  7. </div>
  8. </div>
  9. <div class="standard-body">
  10. <div id="my-iframe-mask"></div>
  11. <base-form class="p-t-base" size="small" :model="formModel" :items="formItems" :label-width="'78px'">
  12. <template #form-item-search>
  13. <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
  14. <!-- <span v-if="mainStore.markerPausedLimit > 0" class="limit-time">{{ limitTime }}</span> -->
  15. </template>
  16. </base-form>
  17. <iframe
  18. v-if="showIframe"
  19. style="width: 100%; height: calc(100% - 60px); prevent-events: pointer"
  20. :src="iframeSrc"
  21. ></iframe>
  22. </div>
  23. </div>
  24. </template>
  25. <script setup lang="ts" name="StandardDialog">
  26. import useVModel from '@/hooks/useVModel'
  27. import { ref, computed, reactive, watch } from 'vue'
  28. import { Close } from '@element-plus/icons-vue'
  29. import { ElIcon, ElButton } from 'element-plus'
  30. import useFetch from '@/hooks/useFetch'
  31. import useMainStore from '@/store/main'
  32. import useOptions from '@/hooks/useOptions'
  33. import useForm from '@/hooks/useForm'
  34. import BaseForm from '@/components/element/BaseForm.vue'
  35. const mainStore = useMainStore()
  36. const { subjectList, mainQuestionList, dataModel, changeModelValue, onOptionInit, isExpert, isLeader } = useOptions([
  37. 'subject',
  38. 'question',
  39. ])
  40. const showIframe = ref(false)
  41. const formModel = reactive<any>({
  42. mainNumber: dataModel.question,
  43. subjectCode: dataModel.subject,
  44. })
  45. watch(dataModel, () => {
  46. formModel.mainNumber = dataModel.question
  47. formModel.subjectCode = dataModel.subject
  48. })
  49. const { defineColumn, _ } = useForm()
  50. const span10 = defineColumn(_, '', { span: 9 })
  51. const formItems = computed<any[]>(() => [
  52. span10({
  53. rowKey: 'row-1',
  54. label: '科目',
  55. prop: 'subjectCode',
  56. slotType: 'select',
  57. labelWidth: '46px',
  58. slot: { options: subjectList.value, onChange: changeModelValue('subject'), disabled: !isExpert.value },
  59. }),
  60. span10({
  61. rowKey: 'row-1',
  62. label: '大题',
  63. prop: 'mainNumber',
  64. labelWidth: '46px',
  65. slotType: 'select',
  66. slot: {
  67. options: mainQuestionList.value,
  68. onChange: changeModelValue('question'),
  69. disabled: !isExpert.value && !isLeader.value,
  70. },
  71. }),
  72. { rowKey: 'row-1', slotName: 'search', labelWidth: '10px', colProp: { span: 6 } },
  73. ])
  74. const props = defineProps<{
  75. modelValue: boolean
  76. }>()
  77. const visible = useVModel(props)
  78. const closeDialog = () => {
  79. visible.value = false
  80. }
  81. const { fetch: fetchStandard, result: standardRes, loading } = useFetch('getMarkingStandard')
  82. const iframeSrc = computed(() => {
  83. return standardRes.value?.url
  84. ? standardRes.value?.url + '#view=FitH&scrollbar=0&toolbar=0&statusbar=0&messages=0&navpanes=0'
  85. : ''
  86. })
  87. const onSearch = () => {
  88. showIframe.value = false
  89. // fetchStandard({ subjectCode: mainStore?.myUserInfo?.subjectCode, mainNumber: mainStore?.myUserInfo?.mainNumber })
  90. fetchStandard({ subjectCode: formModel.subjectCode, mainNumber: formModel.mainNumber }).then(() => {
  91. showIframe.value = true
  92. })
  93. }
  94. onOptionInit(onSearch)
  95. const limitTime = computed(() => {
  96. return Math.ceil(mainStore.markerPausedLimit / 1000)
  97. })
  98. </script>
  99. //
  100. <style scoped lang="scss">
  101. .standard-dialog {
  102. display: flex;
  103. flex-direction: column;
  104. position: fixed;
  105. z-index: 500;
  106. border-radius: 6px;
  107. box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.04), 0px 8px 20px rgba(0, 0, 0, 0.08);
  108. .standard-head {
  109. background-color: #f8f8f8;
  110. border-radius: 6px 6px 0 0;
  111. color: #333;
  112. font-size: 14px;
  113. height: 44px;
  114. line-height: 44px;
  115. padding: 0 10px;
  116. position: relative;
  117. .head-btn-box {
  118. position: absolute;
  119. right: 0;
  120. top: 0;
  121. width: 44px;
  122. height: 44px;
  123. z-index: 1;
  124. cursor: pointer;
  125. &:hover {
  126. :deep(i) {
  127. color: $color--primary;
  128. }
  129. }
  130. }
  131. }
  132. .standard-body {
  133. flex: 1;
  134. padding: 2px;
  135. position: relative;
  136. .limit-time {
  137. font-size: 16px;
  138. font-weight: bold;
  139. color: #000;
  140. margin-left: 10px;
  141. }
  142. #my-iframe-mask {
  143. position: absolute;
  144. left: 0;
  145. right: 0;
  146. bottom: 0;
  147. top: 0;
  148. z-index: 10;
  149. display: none;
  150. }
  151. }
  152. }
  153. </style>