|
|
@@ -305,6 +305,8 @@
|
|
|
:http-request="httpRequest"
|
|
|
:before-remove="beforeRemove"
|
|
|
:on-remove="invoiceRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ accept=".jpg,.jpeg,.png"
|
|
|
action=""
|
|
|
multiple
|
|
|
>
|
|
|
@@ -646,6 +648,11 @@ export default {
|
|
|
message: "合同编号不能为空",
|
|
|
trigger: ["blur", "change"],
|
|
|
},
|
|
|
+ {
|
|
|
+ pattern:/^[a-zA-Z0-9]+$/,
|
|
|
+ message: "请输入数字或英文",
|
|
|
+ trigger: ["blur", "change"],
|
|
|
+ }
|
|
|
],
|
|
|
},
|
|
|
//类型
|
|
|
@@ -844,6 +851,19 @@ export default {
|
|
|
}
|
|
|
return extension || extension2 || extension3 || extension4;
|
|
|
},
|
|
|
+ //上传前校验
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
+
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error('上传图片只能是 JPG/PNG 格式');
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传图片大小不能超过 2MB');
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
//上传合同
|
|
|
submitUploadContract() {
|
|
|
this.$refs.contractUpload.submit();
|