Forráskód Böngészése

工程现场 大屏界面修改

zhanghao 3 hónapja
szülő
commit
9942132909

+ 54 - 11
src/views/pad/engineering/issueDealDia.vue

@@ -53,15 +53,15 @@
 
           <div style="margin-bottom: 20px;color: #00ffff80;font-family: PingFangSC-Regular;font-weight: 400;font-size: 14px;">支持.docx、.xlsx格式</div>
 
-          <el-button style="width: 100px;margin-top: 10px;margin-right: 10px;border: 1px solid #00FFFF;border-radius: 2px;">提交</el-button>
-          <el-button style="width: 100px;margin-top: 10px;background: rgba(15, 86, 86, 0.54);color: #00ffff;border: 1px solid #00FFFF;border-radius: 2px;">取消</el-button>
+          <el-button @click="changeIssueStatus" style="width: 100px;margin-top: 10px;margin-right: 10px;border: 1px solid #00FFFF;border-radius: 2px;">提交</el-button>
+          <el-button @click="close" style="width: 100px;margin-top: 10px;background: rgba(15, 86, 86, 0.54);color: #00ffff;border: 1px solid #00FFFF;border-radius: 2px;">取消</el-button>
         </div>
       </div>
     </div>
   </template>
 
   <script>
-  import { getFoodsList } from "@/api/screen/service";
+  import { changeIssueStatus, getFoodsList } from '@/api/screen/service'
   import pinyin from "../data/pinyin.js";
 
   export default {
@@ -83,17 +83,60 @@
         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,
+          description:this.description,
+          id:this.getProList.id,
+          status: 1,
+        };
+
+        const formData = new FormData();
+        formData.append("file", this.file);
+        formData.append("issue", new Blob([JSON.stringify(issueData)], { type: "application/json" }));
+
+        changeIssueStatus(formData).then((res) => {
+          if (Number(res.code) === 200) {
+            this.close();
+          }
+        }).catch((err) => {
+          console.error("提交失败:", err);
+        });
+      },
+
       handleFileChange(event) {
         const file = event.target.files[0];
-        if (file) {
-          this.fileFlag = true
-          const reader = new FileReader();
-          reader.onload = (e) => {
-            this.dialogImageUrl = e.target.result; // base64 编码的图片 URL
-          };
-          reader.readAsDataURL(file); // 读取文件并转换为 base64 格式
-          console.log(this.dialogImageUrl)
+        if (!file) return;
+
+        // 添加文件类型白名单
+        const allowedExtensions = ['.docx', '.xlsx'];
+        const fileName = file.name.toLowerCase();
+
+        // 校验文件后缀
+        const isValidFile = allowedExtensions.some(ext => fileName.endsWith(ext));
+
+        if (!isValidFile) {
+          this.$message.error('仅支持上传.docx和.xlsx格式文件');
+          this.handleRemove(); // 清空错误文件
+          return;
         }
+
+        // 更新文件状态
+        this.fileName = file.name;
+        this.file = file;
+        this.fileFlag = true;
+
+        // 移除图片预览相关代码
+        this.dialogImageUrl = URL.createObjectURL(file) // 删除这行
       },
       handleRemove() {
         this.fileFlag = false

+ 20 - 15
src/views/pad/engineering/issueListDia.vue

@@ -15,7 +15,7 @@
           <img src="../../../assets/zhang/engineer/ownCloseBtn.png">
         </div>
       </div>
-  
+
       <!-- 表格数据 -->
       <div class="flex-container">
         <div class="header">
@@ -42,7 +42,7 @@
           </div>
         </div>
       </div>
-  
+
       <!-- 分页组件 -->
       <div style="width: 100%;display: flex;justify-content: center;align-items: center;margin-top: 10px;">
         <el-pagination
@@ -56,10 +56,10 @@
       </div>
     </div>
   </template>
-  
+
   <script>
   import { getIssueListLastWeek,changeIssueStatus } from '@/api/screen/service';
-  
+
   export default {
     name: "UnitCamera",
     props: {
@@ -149,7 +149,7 @@
           id: f,
           status: 1,
         };
-  
+
         changeIssueStatus(issueData).then((res) => {
           if (Number(res.code) === 200) {
             this.getIssueListLastWeek(); // 刷新数据
@@ -174,25 +174,25 @@
   .me::-webkit-scrollbar {
     display: none;
   }
-  
+
   .flex-container {
     width: 100%;
     height: 566px;
     font-family: PingFangSC-Medium;
     font-weight: 500;
   }
-  
+
   .header{
     display: flex;  /* 每行使用 flexbox 布局 */
     position: relative;
     background-color: rgba(21, 105, 107, 0.5);
   }
-  
+
   .flex-row {
     display: flex;  /* 每行使用 flexbox 布局 */
     position: relative;
   }
-  
+
   .flex-row::before{
     content: "";
     height: 15px;
@@ -201,7 +201,7 @@
     left: 0;
     top: 15px
   }
-  
+
   .flex-column {
     display: flex;
     justify-content: center;
@@ -210,11 +210,11 @@
     text-align: left;  /* 左对齐文本 */
     color: white;
   }
-  
+
   .header .flex-column {
     color: #00ffff;
   }
-  
+
   .el-scrollbar {
     background: #15696b;
     border: 1px solid #00ffff;
@@ -260,7 +260,7 @@
       color: #00F0ff;
       cursor: pointer;
   }
-  
+
   ::v-deep .el-input__inner{
     color: #00ffff;
     background-color: rgba(15, 86, 86, 0.54);
@@ -269,6 +269,12 @@
   ::v-deep .el-input__prefix{
     color: #00F6EC;
   }
+  ::v-deep .el-input__suffix{
+    color: #00F6EC;
+  }
+  ::v-deep .el-input__inner::placeholder{
+    color: #199294;
+  }
   ::v-deep .btn-prev{
     color: #00F6EC !important;
     background-color: rgba(21, 105, 107, 0.35) !important;
@@ -288,5 +294,4 @@
     color: #00ffff !important;
   }
   </style>
-  
-  
+

+ 1 - 1
src/views/pad/engineering/main.vue

@@ -690,7 +690,7 @@ export default {
       no-repeat;
       background-size: 100% 100%;
       margin-bottom: 28px;
-      margin-left: 15px;  
+      margin-left: 15px;
       overflow: hidden;
     }
 

+ 6 - 0
src/views/screen/engineering/issueListDia.vue

@@ -273,6 +273,12 @@ methods: {
 ::v-deep .el-input__prefix{
   color: #00F6EC;
 }
+::v-deep .el-input__suffix{
+  color: #00F6EC;
+}
+::v-deep .el-input__inner::placeholder{
+  color: #199294;
+}
 ::v-deep .btn-prev{
   color: #00F6EC !important;
   background-color: rgba(21, 105, 107, 0.35) !important;