优化问题列表组件,调整表格布局,添加检查错误装饰函数,更新样式以居中对齐

This commit is contained in:
keqingmoe 2024-12-31 00:21:30 +08:00
parent 1b1196cb21
commit 08dfb27ac9

View File

@ -82,14 +82,34 @@
</v-dialog> </v-dialog>
</v-toolbar> </v-toolbar>
</template> </template>
<template v-slot:item.actions="{ item }"> <template v-slot:item="{ item }">
<v-icon class="me-2" size="small" @click="editItem(item)"> <tr>
mdi-pencil <td>{{ item.id }}</td>
</v-icon> <td>{{ item.problem }}</td>
<v-icon size="small" @click="deleteItem(item)"> <td>{{ item.answer }}</td>
mdi-delete <td>{{ decorateCheckingError(item.check_error) }}</td>
</v-icon> <td class="text-center">
<v-icon class="me-2" size="small" @click="editItem(item)">
mdi-pencil
</v-icon>
<v-icon size="small" @click="deleteItem(item)">
mdi-delete
</v-icon>
</td>
</tr>
</template> </template>
<!-- <template v-slot:item.actions="{ item }">
<tr>
<td class="text-center">
<v-icon class="me-2" size="small" @click="editItem(item)">
mdi-pencil
</v-icon>
<v-icon size="small" @click="deleteItem(item)">
mdi-delete
</v-icon>
</td>
</tr>
</template> -->
</v-data-table> </v-data-table>
<v-dialog v-model="dialogShow" width="auto"> <v-dialog v-model="dialogShow" width="auto">
<v-card max-width="400" prepend-icon="mdi-update" :text="dialogText" :title="dialogTitle"> <v-card max-width="400" prepend-icon="mdi-update" :text="dialogText" :title="dialogTitle">
@ -175,6 +195,13 @@ const checkingErrorTitle = ref('');
const checkingErrorIcon = ref(''); const checkingErrorIcon = ref('');
const checkingError = ref(''); const checkingError = ref('');
const decorateCheckingError = (checkError: number) => {
if (checkError == 0) {
return '精确匹配';
}
return checkError;
}
watch(preciseMode, () => { watch(preciseMode, () => {
if (preciseMode.value) { if (preciseMode.value) {
checkingError.value = '精确匹配'; checkingError.value = '精确匹配';
@ -402,4 +429,9 @@ const save = async (event: SubmitEvent) => {
close1(); close1();
}; };
</script> </script>
<style lang="scss" scoped>
td {
text-align: center;
}
</style>