瀏覽代碼

大屏 界面修改

zhanghao 3 周之前
父節點
當前提交
e84e07cb9c

+ 15 - 15
src/views/screen/engineering/issueDealDia.vue

@@ -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;

+ 8 - 1
src/views/screen/engineering/issueSubDia.vue

@@ -156,7 +156,14 @@ export default {
           try {
             doc.render();
             const out = doc.getZip().generate({ type: "blob" });
-            saveAs(out, "generated-file.docx");
+            const now = new Date();  // 获取当前时间
+            const year = now.getFullYear();  // 获取年份
+            const month = String(now.getMonth() + 1).padStart(2, '0');  // 获取月份并补零
+            const date = String(now.getDate()).padStart(2, '0');  // 获取日期并补零
+            const hours = String(now.getHours()).padStart(2, '0');  // 获取小时并补零
+            const minutes = String(now.getMinutes()).padStart(2, '0');  // 获取分钟并补零
+            const seconds = String(now.getSeconds()).padStart(2, '0');  // 获取秒并补零
+            saveAs(out, `问题整改通知单"${year}${month}${date}${hours}${minutes}${seconds}.docx`);
             console.log("Word文档已生成并下载!");
           } catch (error) {
             console.error("生成 Word 文件时出错:", error);

+ 3 - 0
src/views/zcustom/issue/index.vue

@@ -97,6 +97,9 @@
         <el-form-item label="整改要求" prop="need">
           <el-input type="textarea" v-model="form.need" readonly/>
         </el-form-item>
+        <el-form-item label="附件" prop="imagePath">
+          <el-button @click="downloadImage()" v-if=""></el-button>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
 <!--        <el-button type="primary" @click="submitForm">确 定</el-button>-->