2024年7月19日 修复问题
This commit is contained in:
parent
38aec2a7b6
commit
0399cdf7be
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-upload name="file" :showUploadList="false" :customRequest="(file) => onClick(file)">
|
||||
<a-upload name="file" v-bind="getBindValue" :customRequest="(file) => emit('uploadFn',file)">
|
||||
<Button :type="type" :class="getButtonClass">
|
||||
<template #default="data">
|
||||
<Icon :icon="preIcon" v-if="preIcon" :size="iconSize" />
|
||||
|
@ -18,14 +18,17 @@
|
|||
});
|
||||
</script>
|
||||
<script lang="ts" setup>
|
||||
import { computed, unref } from 'vue';
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { Button } from 'ant-design-vue';
|
||||
import Icon from '/@/components/Icon/src/Icon.vue';
|
||||
import { buttonProps } from './props';
|
||||
import { useAttrs } from '/@/hooks/core/useAttrs';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
const props = defineProps(buttonProps);
|
||||
const emit = defineEmits(['uploadFn']);
|
||||
// get component class
|
||||
const attrs = useAttrs({ excludeDefaultKeys: false });
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
const getButtonClass = computed(() => {
|
||||
const { color, disabled } = props;
|
||||
return [
|
||||
|
@ -36,6 +39,40 @@
|
|||
];
|
||||
});
|
||||
|
||||
const uploadGoOn = ref<boolean>(true);
|
||||
|
||||
// get inherit binding value
|
||||
const getBindValue = computed(() => ({ ...unref(attrs), ...props }));
|
||||
const getBindValue = computed(() => {
|
||||
let data = { ...unref(attrs), ...props };
|
||||
let bind = { forceAcceptVerify: false, accept: null, showUploadList: false };
|
||||
bind.forceAcceptVerify = data.forceAcceptVerify;
|
||||
bind.accept = data.accept;
|
||||
bind.beforeUpload = data.beforeUpload;
|
||||
if(!bind.beforeUpload) {
|
||||
bind.beforeUpload = (file) => {
|
||||
uploadGoOn.value = true;
|
||||
//扩展验证(目前仅支持扩展名验证)
|
||||
if(bind.forceAcceptVerify){
|
||||
let fileName = file?.name;
|
||||
if(fileName.indexOf('.')){
|
||||
let suffix = fileName.split('.')[1];
|
||||
let fileTypes = bind.accept;
|
||||
if(fileTypes){
|
||||
if(fileTypes.indexOf(',')){
|
||||
let typeList = fileTypes.split(',');
|
||||
if(typeList.indexOf('.' + suffix) == -1){
|
||||
createMessage.warning('请上传【*' + typeList.join(',*') + '】格式的文件');
|
||||
uploadGoOn.value = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return bind;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -14,27 +14,27 @@
|
|||
</a-col> -->
|
||||
<a-col :span="24">
|
||||
<a-form-item label="学校名称" v-bind="validateInfos.schoolName">
|
||||
<a-input v-model:value="formData.schoolName" placeholder="请输入学校名称" ></a-input>
|
||||
<a-input v-model:value="formData.schoolName" placeholder="请输入学校名称,eg.***学校" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="评估单位" v-bind="validateInfos.pgdw">
|
||||
<a-input v-model:value="formData.pgdw" placeholder="请输入评估单位" ></a-input>
|
||||
<a-input v-model:value="formData.pgdw" placeholder="请输入评估单位,eg.教育部教育质量评估中心" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="评估日期" v-bind="validateInfos.pgrq">
|
||||
<a-input v-model:value="formData.pgrq" placeholder="请输入评估日期" ></a-input>
|
||||
<a-input v-model:value="formData.pgrq" placeholder="请输入评估日期,eg.二零二三年十月" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="学年" v-bind="validateInfos.xuenian">
|
||||
<a-input v-model:value="formData.xuenian" placeholder="请输入学年" ></a-input>
|
||||
<a-input v-model:value="formData.xuenian" placeholder="请输入学年,eg.2023-2024" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="调查时点" v-bind="validateInfos.dysd">
|
||||
<a-input v-model:value="formData.dysd" placeholder="请输入调查时点" ></a-input>
|
||||
<a-input v-model:value="formData.dysd" placeholder="请输入调查时点,eg.2023年9月25日 - 2023年10月10日" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
|
@ -65,7 +65,7 @@
|
|||
</a-col>
|
||||
<span style="text-align: center;">
|
||||
<a-spin :spinning="uploadButtonSpinning">
|
||||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXlsPlus($event, { id: formData.id})">导入</j-upload-button>
|
||||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" accept=".xls,.xlsx" :forceAcceptVerify="true" @uploadFn="onImportXlsPlus($event, { id: formData.id})">导入</j-upload-button>
|
||||
</a-spin>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -130,6 +130,10 @@ const formData = reactive<Record<string, any>>({
|
|||
const current = ref<number>(0);
|
||||
const uploadButtonSpinning = ref<boolean>(false);
|
||||
|
||||
function log(...d){
|
||||
console.log('shangc',...d);
|
||||
}
|
||||
|
||||
const next = () => {
|
||||
current.value++;
|
||||
};
|
||||
|
@ -152,16 +156,20 @@ const validatorRules = {
|
|||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
//上传完成回调
|
||||
function handleSuccess(){
|
||||
function handleSuccess(xlsRes){
|
||||
uploadButtonSpinning.value = false;
|
||||
current.value++;
|
||||
console.log("参数--------》",{id:formData.id})
|
||||
defHttp.get({url:'/blStuAnswer/blStuAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
||||
console.log('---生成报告--->',res);
|
||||
if(res.code==200||res=='生成成功'){
|
||||
handleWancheng();
|
||||
}
|
||||
})
|
||||
if(xlsRes.success){
|
||||
current.value++;
|
||||
console.log("参数--------》",{id:formData.id}, ...d)
|
||||
defHttp.get({url:'/blStuAnswer/blStuAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
||||
console.log('---生成报告--->',res);
|
||||
if(res.code==200||res=='生成成功'){
|
||||
handleWancheng();
|
||||
}
|
||||
})
|
||||
}else {
|
||||
createMessage.error(xlsRes.message);
|
||||
}
|
||||
}
|
||||
//完成回调
|
||||
function handleWancheng() {
|
||||
|
@ -250,6 +258,7 @@ async function submitForm() {
|
|||
}
|
||||
|
||||
function onImportXlsPlus(...d) {
|
||||
console.log('?????');
|
||||
uploadButtonSpinning.value = true;
|
||||
onImportXls(...d);
|
||||
}
|
||||
|
|
|
@ -152,16 +152,20 @@ const validatorRules = {
|
|||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
//上传完成回调
|
||||
function handleSuccess(){
|
||||
function handleSuccess(res){
|
||||
uploadButtonSpinning.value = false;
|
||||
current.value++;
|
||||
console.log("参数--------》",{id:formData.id})
|
||||
defHttp.get({url:'/blTeacherAnswer/blTeacherAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
||||
console.log('---生成报告--->',res);
|
||||
if(res.code==200||res=='生成成功'){
|
||||
handleWancheng();
|
||||
}
|
||||
})
|
||||
if(xlsRes.success){
|
||||
current.value++;
|
||||
console.log("参数--------》",{id:formData.id}, ...d)
|
||||
defHttp.get({url:'/blTeacherAnswer/blTeacherAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
||||
console.log('---生成报告--->',res);
|
||||
if(res.code==200||res=='生成成功'){
|
||||
handleWancheng();
|
||||
}
|
||||
})
|
||||
}else {
|
||||
createMessage.error(xlsRes.message);
|
||||
}
|
||||
}
|
||||
//完成回调
|
||||
function handleWancheng() {
|
||||
|
|
Loading…
Reference in New Issue