|
@@ -96,21 +96,14 @@ export default {
|
|
|
// alert(1)
|
|
|
this.title = this.getProList.title
|
|
|
this.description = this.getProList.description
|
|
|
-
|
|
|
+
|
|
|
this.value = this.getProList.createDate
|
|
|
},
|
|
|
triggerFileInput(){
|
|
|
this.$refs.fileInput.click();
|
|
|
},
|
|
|
changeIssueStatus() {
|
|
|
- if (this.file == null){
|
|
|
- return
|
|
|
- }
|
|
|
- // 添加二次校验
|
|
|
- if (!this.fileName.endsWith('.docx') && !this.fileName.endsWith('.xlsx')) {
|
|
|
- this.$message.error('文件格式不符合要求');
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
const issueData = {
|
|
|
createDate:this.value,
|
|
|
title:this.title,
|
|
@@ -120,7 +113,14 @@ export default {
|
|
|
};
|
|
|
|
|
|
const formData = new FormData();
|
|
|
- formData.append("file", this.file);
|
|
|
+ if (this.file){
|
|
|
+ // 添加二次校验
|
|
|
+ if (!this.fileName.endsWith('.docx') && !this.fileName.endsWith('.xlsx')) {
|
|
|
+ this.$message.error('文件格式不符合要求');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ formData.append("file", this.file);
|
|
|
+ }
|
|
|
formData.append("issue", new Blob([JSON.stringify(issueData)], { type: "application/json" }));
|
|
|
|
|
|
changeIssueStatus(formData).then((res) => {
|
|
@@ -131,7 +131,7 @@ export default {
|
|
|
console.error("提交失败:", err);
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
handleFileChange(event) {
|
|
|
const file = event.target.files[0];
|
|
|
if (!file) return;
|
|
@@ -139,7 +139,7 @@ export default {
|
|
|
// 添加文件类型白名单
|
|
|
const allowedExtensions = ['.docx', '.xlsx'];
|
|
|
const fileName = file.name.toLowerCase();
|
|
|
-
|
|
|
+
|
|
|
// 校验文件后缀
|
|
|
const isValidFile = allowedExtensions.some(ext => fileName.endsWith(ext));
|
|
|
if (!isValidFile) {
|
|
@@ -156,7 +156,7 @@ export default {
|
|
|
// 移除图片预览相关代码
|
|
|
this.dialogImageUrl = URL.createObjectURL(file) // 删除这行
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
handleRemove() {
|
|
|
this.fileFlag = false;
|
|
|
this.fileName = '';
|
|
@@ -165,7 +165,7 @@ handleRemove() {
|
|
|
},
|
|
|
|
|
|
// 移除图片预览相关方法
|
|
|
-
|
|
|
+
|
|
|
handlePictureCardPreview() {
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
@@ -236,7 +236,7 @@ handleRemove() {
|
|
|
}
|
|
|
.sth {
|
|
|
background: rgba(5, 28, 38, 0.78); // 加深背景提高文字可读性
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
.sth:hover{
|
|
|
opacity: 1;
|