|
@@ -12,8 +12,7 @@
|
|
|
<div class="select-box--item_new">
|
|
<div class="select-box--item_new">
|
|
|
<span>
|
|
<span>
|
|
|
<span style="color: red;">*</span>
|
|
<span style="color: red;">*</span>
|
|
|
- 审批流程
|
|
|
|
|
- :
|
|
|
|
|
|
|
+ 审批流程:
|
|
|
</span>
|
|
</span>
|
|
|
<el-select
|
|
<el-select
|
|
|
class="select-box--item__select"
|
|
class="select-box--item__select"
|
|
@@ -30,8 +29,7 @@
|
|
|
<div class="select-box--item_new" v-if="!isCreateMode">
|
|
<div class="select-box--item_new" v-if="!isCreateMode">
|
|
|
<span>
|
|
<span>
|
|
|
<span style="color: red;">*</span>
|
|
<span style="color: red;">*</span>
|
|
|
- 申请单号
|
|
|
|
|
- :
|
|
|
|
|
|
|
+ 申请单号:
|
|
|
</span>
|
|
</span>
|
|
|
{{ form.applyNo }}
|
|
{{ form.applyNo }}
|
|
|
</div>
|
|
</div>
|
|
@@ -92,13 +90,14 @@
|
|
|
@uploadSuccess="(list: FileItem[]) => onStylePhotoSuccess(row, list)"
|
|
@uploadSuccess="(list: FileItem[]) => onStylePhotoSuccess(row, list)"
|
|
|
/> -->
|
|
/> -->
|
|
|
<el-upload
|
|
<el-upload
|
|
|
- :key="row.id || row.$$uid || $index"
|
|
|
|
|
|
|
+ :key="row.id || row.$$uid"
|
|
|
:ref="el => setUploadRef(row, el)"
|
|
:ref="el => setUploadRef(row, el)"
|
|
|
v-model:file-list="row.pictureUrl"
|
|
v-model:file-list="row.pictureUrl"
|
|
|
:auto-upload="false"
|
|
:auto-upload="false"
|
|
|
list-type="picture-card"
|
|
list-type="picture-card"
|
|
|
:limit="1"
|
|
:limit="1"
|
|
|
:disabled="isViewMode"
|
|
:disabled="isViewMode"
|
|
|
|
|
+ :before-upload="beforeUpload"
|
|
|
:on-change="(file) => handleApprovalImageChange(row, file)"
|
|
:on-change="(file) => handleApprovalImageChange(row, file)"
|
|
|
:on-exceed="handleApprovalImageExceed"
|
|
:on-exceed="handleApprovalImageExceed"
|
|
|
:on-remove="() => handleApprovalImageRemove(row)"
|
|
:on-remove="() => handleApprovalImageRemove(row)"
|
|
@@ -838,10 +837,49 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
+// 图片格式校验
|
|
|
|
|
+ const validateImage = (file) => {
|
|
|
|
|
+ console.log(file, 'jiaoyan')
|
|
|
|
|
+ const validMIME = [
|
|
|
|
|
+ 'image/jpeg',
|
|
|
|
|
+ 'image/png',
|
|
|
|
|
+ 'image/gif',
|
|
|
|
|
+ 'image/bmp',
|
|
|
|
|
+ 'image/webp',
|
|
|
|
|
+ 'image/svg+xml',
|
|
|
|
|
+ 'image/tiff',
|
|
|
|
|
+ 'image/heic',
|
|
|
|
|
+ 'image/heif',
|
|
|
|
|
+ 'image/avif',
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ if (!validMIME.includes(file.type)) {
|
|
|
|
|
+ ElMessage.error('仅支持图片文件(JPEG/PNG/GIF/BMP/WEBP/SVG/TIFF/HEIC/AVIF等)');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!validMIME.includes(file.type)) {
|
|
|
|
|
+ ElMessage.error('仅支持JPG/PNG格式图片');
|
|
|
|
|
+ return false; // 阻止上传
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 可选:添加文件大小限制
|
|
|
|
|
+ const maxSize = 1 * 1024 * 1024; // 5MB
|
|
|
|
|
+ if (file.size > maxSize) {
|
|
|
|
|
+ ElMessage.error('图片大小不能超过1MB');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true; // 验证通过
|
|
|
|
|
+ };
|
|
|
|
|
+ const beforeUpload = (row: PurchaseApplyItem, uploadFile: UploadUserFile) => {
|
|
|
|
|
+ const validate = validateImage(uploadFile.raw)
|
|
|
|
|
+ if(!validate) return;
|
|
|
|
|
+ }
|
|
|
const handleApprovalImageChange = (row: PurchaseApplyItem, uploadFile: UploadUserFile) => {
|
|
const handleApprovalImageChange = (row: PurchaseApplyItem, uploadFile: UploadUserFile) => {
|
|
|
if (!uploadFile.raw) return;
|
|
if (!uploadFile.raw) return;
|
|
|
-
|
|
|
|
|
|
|
+ const validate = validateImage(uploadFile.raw)
|
|
|
|
|
+ if(!validate) return;
|
|
|
uploadFileApi({
|
|
uploadFileApi({
|
|
|
file: uploadFile.raw,
|
|
file: uploadFile.raw,
|
|
|
bizType: UPLOAD_BIZ_TYPE['DICTIONARY'],
|
|
bizType: UPLOAD_BIZ_TYPE['DICTIONARY'],
|