Browse Source

修复图片上传

dev-xx
qb 7 months ago
parent
commit
649734255f
  1. 16
      src/views/aftersales/aftersalesWorkOrderInfoEnxt.vue
  2. 16
      src/views/aftersales/aftersalesWorkOrderInfoTemp.vue
  3. 16
      src/views/aftersales/aftersalesWorkOrdermodifyTemp.vue
  4. 16
      src/views/aftersales/customerService.vue
  5. 16
      src/views/basic/pda/basicPdatt.vue
  6. 22
      src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue
  7. 16
      src/views/datadetail/ToolUpdate.vue
  8. 16
      src/views/distribution/artery/directGoMarketDetails.vue

16
src/views/aftersales/aftersalesWorkOrderInfoEnxt.vue

@ -917,13 +917,19 @@ const ImgSuccess = (response, uploadFile) => {
//
const beforeAvatarUpload = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

16
src/views/aftersales/aftersalesWorkOrderInfoTemp.vue

@ -892,13 +892,19 @@ const ButtonPermissions = computed(() => {
//
const beforeAvatarUpload = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

16
src/views/aftersales/aftersalesWorkOrdermodifyTemp.vue

@ -1012,13 +1012,19 @@ const ImgSuccess = (response, uploadFile) => {
//
const beforeAvatarUpload = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

16
src/views/aftersales/customerService.vue

@ -216,13 +216,19 @@ const messagesendFn = () => {
console.log(Mydata.value, '参数');
};
const beforeAvatarUpload = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

16
src/views/basic/pda/basicPdatt.vue

@ -789,13 +789,19 @@ const ImgSuccess: UploadProps['onSuccess'] = (response, uploadFile) => {
};
//
const beforeAvatarUpload: UploadProps['beforeUpload'] = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

22
src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue

@ -90,7 +90,7 @@
<el-input v-model.trim="Addform.linkman" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="联系电话" prop="contactNumber">
<el-form-item label="联系电话" prop="contactNumber">
<el-input v-model.trim="Addform.contactNumber" placeholder="请输入联系电话" />
</el-form-item>
@ -456,7 +456,6 @@ const rules = reactive({
addressInfo: [{ required: true, message: '请选择仓库地区', trigger: 'change' }],
department: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
warehouseAddress: [{ required: true, message: '请选择仓库地址', trigger: 'change' }],
});
const Topquery = ref({}); //
const newlyaddload = ref(false); //
@ -465,8 +464,7 @@ const department = ref();
const Addform = ref({}); //
const WarehouseType = ref([]); //
const FireProtection = ref([]); //
const Isprotection = ref([
]); //
const Isprotection = ref([]); //
const WarehouseStructureList = ref([]); //
const Iselevated = ref([
{
@ -917,13 +915,19 @@ const view = value => {
GetDetails(value); //
};
const beforeAvatarUpload = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

16
src/views/datadetail/ToolUpdate.vue

@ -301,13 +301,19 @@ const handleAvatarSuccess: UploadProps['onSuccess'] = (response, uploadFile) =>
};
//
const beforeAvatarUpload: UploadProps['beforeUpload'] = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

16
src/views/distribution/artery/directGoMarketDetails.vue

@ -984,13 +984,19 @@ const handleZeroSubmit = async () => {
//
const beforeAvatarUpload: UploadProps['beforeUpload'] = async rawFile => {
if (rawFile.type !== 'image/png') {
ElMessage.error('图片格式只能为image/png!');
return false;
} else if (rawFile.size / 1024 / 1024 > 2) {
ElMessage.error('图片大小不能大于2MB!');
const _nameArr = rawFile.name.split('.');
if (_nameArr.length === 0) {
ElMessage.warning('异常类型文件');
return false;
}
const _name = _nameArr[_nameArr.length - 1];
const _whiteArr = ['png', 'jpg', 'jpeg'];
if (!_whiteArr.includes(_name.toLocaleLowerCase()))
return ElMessage.warning('请上传png、jpg、jpeg的类型图片');
const res = await compressImageBlob(rawFile);
return res;
};

Loading…
Cancel
Save