bug修改

This commit is contained in:
jjLv 2024-08-28 17:04:34 +08:00
parent c696fd7b06
commit affe602366
1 changed files with 21 additions and 2 deletions

View File

@ -101,7 +101,7 @@
<!-- 添加或修改岗位对话框 --> <!-- 添加或修改岗位对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目名称" prop="projectDepartName"> <el-form-item label="项目名称" prop="projectDepartName">
<el-input v-model="form.projectDepartName" maxlength="20" placeholder="请输入项目名称" /> <el-input v-model="form.projectDepartName" maxlength="20" placeholder="请输入项目名称" />
</el-form-item> </el-form-item>
<el-form-item label="负责人" prop="projectHeadName"> <el-form-item label="负责人" prop="projectHeadName">
@ -243,6 +243,18 @@ export default {
}, },
}, },
methods: { methods: {
beforeUpload(file) {
const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png' || file.raw.type === 'image/jpg'
const isLt2M = file.size / 1024 / 1024 < 5
// console.log(isJPG)
if (!isJPG) {
this.$message.error('上传图片只能是 JPG ,JPEG或 PNG 格式!')
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 5MB!')
}
return isJPG && isLt2M
},
//- //-
handlerSelect(val, row) { handlerSelect(val, row) {
this.currentSelection.indexOf(row.projectId) === -1 this.currentSelection.indexOf(row.projectId) === -1
@ -370,8 +382,14 @@ export default {
// //
handleChange(file, fileList) { handleChange(file, fileList) {
console.log(file) console.log(file)
console.log(fileList)
if(this.beforeUpload(file)==false){
fileList.splice(fileList.length-1,1)
}
// this.$refs["form"].clearValidate() // this.$refs["form"].clearValidate()
this.fileList = fileList; this.fileList = fileList;
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
let sum = 0 let sum = 0
@ -384,6 +402,7 @@ export default {
console.log(this.delFileIdList) console.log(this.delFileIdList)
this.fileList.splice(sum, 1) this.fileList.splice(sum, 1)
}, },
//- //-
picturePreview(file) { picturePreview(file) {
console.log(file) console.log(file)
@ -475,7 +494,7 @@ export default {
}); });
return; return;
} }
this.$modal.confirm('是否确认删除项目名称为"' + projectId + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除项目名称为"' + projectId + '"的数据项?').then(function() {
return delProject(projectId); return delProject(projectId);
}).then(() => { }).then(() => {
this.getList(); this.getList();