|
|
@@ -53,6 +53,9 @@
|
|
|
</a-menu>
|
|
|
</template>
|
|
|
</a-dropdown>
|
|
|
+ <a-upload :customRequest="handleImportExcel" :showUploadList="false" accept=".xlsx,.xls" class="link-left">
|
|
|
+ <a-button type="primary">导入Excel</a-button>
|
|
|
+ </a-upload>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
<a-table
|
|
|
@@ -155,7 +158,7 @@
|
|
|
import tQuestionApi from '@/api/exam/question/tQuestionApi'
|
|
|
import customPagination from '@/components/customPagination.vue'
|
|
|
import { StarFilled, StarOutlined } from '@ant-design/icons-vue'
|
|
|
- import { Modal } from 'ant-design-vue'
|
|
|
+ import { Modal, message } from 'ant-design-vue'
|
|
|
import { parseTime } from '@/utils/exam'
|
|
|
const bankTypeEnum = computed(() => examStore.getBankTypeEnum)
|
|
|
const examStore = useExamStore()
|
|
|
@@ -287,6 +290,25 @@
|
|
|
queryParam.pageSize = size
|
|
|
search()
|
|
|
}
|
|
|
+
|
|
|
+ // 处理Excel导入
|
|
|
+ const handleImportExcel = (options) => {
|
|
|
+ const { file } = options
|
|
|
+ const loading = message.loading('正在导入中...', 0)
|
|
|
+
|
|
|
+ tQuestionApi
|
|
|
+ .importExcel(file)
|
|
|
+ .then((res) => {
|
|
|
+ loading()
|
|
|
+ message.success('导入成功')
|
|
|
+ search() // 刷新列表
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ loading()
|
|
|
+ message.error('导入失败,请检查Excel文件格式是否正确')
|
|
|
+ console.error('导入失败:', error)
|
|
|
+ })
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|