Add grade review and appeal Word forms
This commit is contained in:
1 parent
2e22e162e0
commit
ad510c0308
8 files changed
+108
-8
No files matched your search
@@ -3,6 +3,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import http, { apiErrorMessage } from '../api/http'
|
||||
import { downloadApiFile } from '../api/excel'
|
||||
|
||||
const props = defineProps<{ student: boolean; records?: any[] }>()
|
||||
const loading = ref(false)
|
||||
@@ -15,7 +16,7 @@ const reviewDialog = ref(false)
|
||||
const selected = ref<any>(null)
|
||||
const createForm = reactive({ gradeRecordId: '', reason: '' })
|
||||
const reviewForm = reactive({ accepted: false, response: '', requestedScore: undefined as number | undefined, requestedResult: '' })
|
||||
const { t } = useI18n()
|
||||
const { t, locale } = useI18n()
|
||||
|
||||
const statusValues = ['Submitted', 'Withdrawn', 'Rejected', 'ModificationPending', 'Resolved', 'ModificationRejected']
|
||||
const statusLabel = (value: string) => t(`gradeAppeal.statuses.${value}`)
|
||||
@@ -75,6 +76,11 @@ function openReview(row: any) {
|
||||
reviewDialog.value = true
|
||||
}
|
||||
|
||||
async function downloadForm(row: any) {
|
||||
try { await downloadApiFile(`/grade-appeals/${row.id}/form.docx`, 'grade-appeal.docx') }
|
||||
catch (error) { ElMessage.error(apiErrorMessage(error)) }
|
||||
}
|
||||
|
||||
async function review() {
|
||||
if (!reviewForm.response.trim()) return ElMessage.warning(t('gradeAppeal.messages.responseRequired'))
|
||||
if (reviewForm.accepted && selected.value.evaluationMethod === 'Percentage' && reviewForm.requestedScore == null)
|
||||
@@ -110,7 +116,7 @@ onMounted(load)
|
||||
<el-table-column prop="reason" :label="t('gradeAppeal.reason')" min-width="260" show-overflow-tooltip />
|
||||
<el-table-column :label="t('gradeAppeal.status')" width="150"><template #default="{row}"><el-tag effect="plain">{{statusLabel(row.status)}}</el-tag></template></el-table-column>
|
||||
<el-table-column prop="teacherResponse" :label="t('gradeAppeal.response')" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column :label="t('gradeAppeal.actions')" width="120"><template #default="{row}"><el-button v-if="student && row.status==='Submitted'" link type="danger" @click="withdraw(row)">{{ t('gradeAppeal.withdraw') }}</el-button><el-button v-if="!student && row.status==='Submitted'" link type="primary" @click="openReview(row)">{{ t('gradeAppeal.review') }}</el-button></template></el-table-column>
|
||||
<el-table-column :label="t('gradeAppeal.actions')" min-width="180"><template #default="{row}"><el-button link @click="downloadForm(row)">{{ locale.startsWith('zh') ? '下载申请表' : 'Download form' }}</el-button><el-button v-if="student && row.status==='Submitted'" link type="danger" @click="withdraw(row)">{{ t('gradeAppeal.withdraw') }}</el-button><el-button v-if="!student && row.status==='Submitted'" link type="primary" @click="openReview(row)">{{ t('gradeAppeal.review') }}</el-button></template></el-table-column>
|
||||
</el-table>
|
||||
<el-pagination v-if="!student && total>20" v-model:current-page="page" :page-size="20" :total="total" layout="total, prev, pager, next" @change="load" />
|
||||
</section>
|
||||
|
||||
Reference in new issue
Block a user