2024年7月19日 修复问题
This commit is contained in:
parent
38aec2a7b6
commit
0399cdf7be
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<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">
|
<Button :type="type" :class="getButtonClass">
|
||||||
<template #default="data">
|
<template #default="data">
|
||||||
<Icon :icon="preIcon" v-if="preIcon" :size="iconSize" />
|
<Icon :icon="preIcon" v-if="preIcon" :size="iconSize" />
|
||||||
|
@ -18,14 +18,17 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, unref } from 'vue';
|
import { computed, ref, unref } from 'vue';
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button } from 'ant-design-vue';
|
||||||
import Icon from '/@/components/Icon/src/Icon.vue';
|
import Icon from '/@/components/Icon/src/Icon.vue';
|
||||||
import { buttonProps } from './props';
|
import { buttonProps } from './props';
|
||||||
import { useAttrs } from '/@/hooks/core/useAttrs';
|
import { useAttrs } from '/@/hooks/core/useAttrs';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
const props = defineProps(buttonProps);
|
const props = defineProps(buttonProps);
|
||||||
|
const emit = defineEmits(['uploadFn']);
|
||||||
// get component class
|
// get component class
|
||||||
const attrs = useAttrs({ excludeDefaultKeys: false });
|
const attrs = useAttrs({ excludeDefaultKeys: false });
|
||||||
|
const { createMessage, createConfirm } = useMessage();
|
||||||
const getButtonClass = computed(() => {
|
const getButtonClass = computed(() => {
|
||||||
const { color, disabled } = props;
|
const { color, disabled } = props;
|
||||||
return [
|
return [
|
||||||
|
@ -36,6 +39,40 @@
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const uploadGoOn = ref<boolean>(true);
|
||||||
|
|
||||||
// get inherit binding value
|
// 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>
|
</script>
|
||||||
|
|
|
@ -14,27 +14,27 @@
|
||||||
</a-col> -->
|
</a-col> -->
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="学校名称" v-bind="validateInfos.schoolName">
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="评估单位" v-bind="validateInfos.pgdw">
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="评估日期" v-bind="validateInfos.pgrq">
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="学年" v-bind="validateInfos.xuenian">
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="调查时点" v-bind="validateInfos.dysd">
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
<span style="text-align: center;">
|
<span style="text-align: center;">
|
||||||
<a-spin :spinning="uploadButtonSpinning">
|
<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>
|
</a-spin>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -130,6 +130,10 @@ const formData = reactive<Record<string, any>>({
|
||||||
const current = ref<number>(0);
|
const current = ref<number>(0);
|
||||||
const uploadButtonSpinning = ref<boolean>(false);
|
const uploadButtonSpinning = ref<boolean>(false);
|
||||||
|
|
||||||
|
function log(...d){
|
||||||
|
console.log('shangc',...d);
|
||||||
|
}
|
||||||
|
|
||||||
const next = () => {
|
const next = () => {
|
||||||
current.value++;
|
current.value++;
|
||||||
};
|
};
|
||||||
|
@ -152,16 +156,20 @@ const validatorRules = {
|
||||||
};
|
};
|
||||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
//上传完成回调
|
//上传完成回调
|
||||||
function handleSuccess(){
|
function handleSuccess(xlsRes){
|
||||||
uploadButtonSpinning.value = false;
|
uploadButtonSpinning.value = false;
|
||||||
current.value++;
|
if(xlsRes.success){
|
||||||
console.log("参数--------》",{id:formData.id})
|
current.value++;
|
||||||
defHttp.get({url:'/blStuAnswer/blStuAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
console.log("参数--------》",{id:formData.id}, ...d)
|
||||||
console.log('---生成报告--->',res);
|
defHttp.get({url:'/blStuAnswer/blStuAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
||||||
if(res.code==200||res=='生成成功'){
|
console.log('---生成报告--->',res);
|
||||||
handleWancheng();
|
if(res.code==200||res=='生成成功'){
|
||||||
}
|
handleWancheng();
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
createMessage.error(xlsRes.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//完成回调
|
//完成回调
|
||||||
function handleWancheng() {
|
function handleWancheng() {
|
||||||
|
@ -250,6 +258,7 @@ async function submitForm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onImportXlsPlus(...d) {
|
function onImportXlsPlus(...d) {
|
||||||
|
console.log('?????');
|
||||||
uploadButtonSpinning.value = true;
|
uploadButtonSpinning.value = true;
|
||||||
onImportXls(...d);
|
onImportXls(...d);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,16 +152,20 @@ const validatorRules = {
|
||||||
};
|
};
|
||||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
//上传完成回调
|
//上传完成回调
|
||||||
function handleSuccess(){
|
function handleSuccess(res){
|
||||||
uploadButtonSpinning.value = false;
|
uploadButtonSpinning.value = false;
|
||||||
current.value++;
|
if(xlsRes.success){
|
||||||
console.log("参数--------》",{id:formData.id})
|
current.value++;
|
||||||
defHttp.get({url:'/blTeacherAnswer/blTeacherAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
console.log("参数--------》",{id:formData.id}, ...d)
|
||||||
console.log('---生成报告--->',res);
|
defHttp.get({url:'/blTeacherAnswer/blTeacherAnswer/createWord',params:{id:formData.id}}).then(res=>{
|
||||||
if(res.code==200||res=='生成成功'){
|
console.log('---生成报告--->',res);
|
||||||
handleWancheng();
|
if(res.code==200||res=='生成成功'){
|
||||||
}
|
handleWancheng();
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
createMessage.error(xlsRes.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//完成回调
|
//完成回调
|
||||||
function handleWancheng() {
|
function handleWancheng() {
|
||||||
|
|
Loading…
Reference in New Issue