update:文件不符合规范不会加入到列表中
This commit is contained in:
@@ -119,7 +119,9 @@
|
||||
accept="application/pdf"
|
||||
action="/api2/upload/uploadfile"
|
||||
v-model:fileList="loaPicFileList"
|
||||
:beforeUpload="file => beforeUpload(file, true)"
|
||||
:beforeUpload="
|
||||
(file, fileList) => beforeUpload(file, fileList, true)
|
||||
"
|
||||
@change="info => handleChange(info, 'loaPicId')"
|
||||
:disabled="disabledUpload"
|
||||
>
|
||||
@@ -255,7 +257,11 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item :wrapper-col="{ span: 12, offset: 10 }">
|
||||
<a-button v-if="progressingId" type="primary" @click="onSubmit"
|
||||
<a-button
|
||||
v-if="progressingId"
|
||||
type="primary"
|
||||
@click="onSubmit"
|
||||
:loading="loading"
|
||||
>查询</a-button
|
||||
>
|
||||
<a-button v-else type="primary" @click="onSubmit">提交</a-button>
|
||||
@@ -530,8 +536,10 @@ export default {
|
||||
1;
|
||||
}
|
||||
};
|
||||
const loading = ref(false);
|
||||
const onSubmit = async e => {
|
||||
e.preventDefault();
|
||||
loading.value = true;
|
||||
if (progressingId.value == 0) {
|
||||
if (modelRef.orderNo) {
|
||||
await modifyUnitApply();
|
||||
@@ -548,21 +556,26 @@ export default {
|
||||
await queryUnitApply(progressingId.value);
|
||||
}
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
const beforeUpload = (file, isPdf) => {
|
||||
console.log(file, isPdf);
|
||||
const beforeUpload = (file, fileList, isPdf) => {
|
||||
console.log(file, fileList, isPdf);
|
||||
const isValid =
|
||||
isPdf === true
|
||||
? file.type === "application/pdf"
|
||||
: file.type === "image/jpeg" || file.type === "image/png";
|
||||
if (!isValid) {
|
||||
message.error("只能上传受支持格式的文件");
|
||||
fileList.pop();
|
||||
return false;
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
if (!isLt2M) {
|
||||
message.error("文件大小超过2MB!");
|
||||
fileList.pop();
|
||||
return false;
|
||||
}
|
||||
return isValid && isLt2M;
|
||||
return true;
|
||||
};
|
||||
const handleChange2 = (info, v) => {
|
||||
console.log(info.file.status, info.file, info.fileList);
|
||||
@@ -784,6 +797,7 @@ export default {
|
||||
router: useRouter(),
|
||||
progressingId,
|
||||
addSealApply,
|
||||
loading,
|
||||
status: {
|
||||
0: {
|
||||
color: "orange",
|
||||
|
||||
Reference in New Issue
Block a user