Explorar o código

工程现场 问题上报界面修改

zhanghao hai 3 meses
pai
achega
a39440b6b9

+ 2 - 5
src/api/screen/service.js

@@ -873,12 +873,9 @@ export function changeIssueStatus(formData) {
 // 提交问题
 export function add(data) {
   return request({
-    url: '/check/large/issue/add',
+    url: '/large/check/add',
     method: 'post',
-    data: data,
-    headers: {
-      'Content-Type': 'application/json',
-    },
+    data: data
   });
 }
 // 本周检查项目数量

+ 32 - 30
src/views/pad/engineering/issueSubDia.vue

@@ -11,8 +11,8 @@
       <div v-if="dialogVisible" style="z-index: 10000;display: flex;justify-content: center;align-items: center;background-color: transparent;position: absolute;width: 100%;height: 100%" @click="handleCloseView">
           <img width="600px" :src="dialogImageUrl" alt="">
       </div>
-  
-  
+
+
       <div class="me">
         <div style="width: 35%;color: #00ffff;">
   <!--        <div style="text-align: right;margin-bottom: 10px;height: 32px;line-height: 32px">时间:</div>-->
@@ -31,11 +31,11 @@
           <div>
             <el-input v-model="title" placeholder="请输入标题" style="margin-bottom: 20px;width: 220px"></el-input>
           </div>
-  
+
           <el-input v-model="description" type="textarea" :rows=6 placeholder="请输入内容" resize="none" style="margin-bottom: 20px;width: 350px"></el-input>
-  
+
           <el-input v-model="need" type="textarea" :rows=6 placeholder="请输入整改要求" resize="none" style="margin-bottom: 20px;width: 350px"></el-input>
-  
+
           <div style="width: 130px;height: 130px;background: rgba(15, 86, 86, 0.54);margin-bottom: 10px;mborder-radius: 4px;color: #00ffff;position: relative;font-size: 45px;display: flex;align-items: center">
             <i v-if="!fileFlag" class="el-icon-plus" style="position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);"></i>
             <input v-if="!fileFlag" type="file" ref="fileInput" @change="handleFileChange" style="display: none;position: absolute;left: -1000px"/>
@@ -59,11 +59,11 @@
       </div>
     </div>
   </template>
-  
+
   <script>
   import { add } from "@/api/screen/service";
   import pinyin from "../data/pinyin.js";
-  
+
   export default {
     name: "UnitCamera",
     props: {
@@ -74,6 +74,7 @@
     },
     data() {
       return {
+        file:null,
         title:'',
         description:'',
         need:'',
@@ -87,7 +88,6 @@
         checked:false
       };
     },
-    mounted() {},
     mounted() {
       this.dialogImageUrl = this.imgUrl
   },
@@ -96,18 +96,24 @@
         this.$refs.fileInput.click();
       },
       add() {
-         alert(this.imgUrl)
-        return
+        if (this.file == null){
+          return
+        }
+
         const issueData = {
           title:this.title,
           description:this.description,
           need:this.need,
           projectId:'',
           delFlag: 0,
-          file:this.dialogImageUrl,
           status: 0,
         };
-        add(issueData).then((res) => {
+
+        const formData = new FormData();
+        formData.append("file", this.file);
+        formData.append("issue", new Blob([JSON.stringify(issueData)], { type: "application/json" }));
+
+        add(formData).then((res) => {
           if (Number(res.code) === 200) {
             this.close();
           }
@@ -118,13 +124,10 @@
       handleFileChange(event) {
         const file = event.target.files[0];
         if (file) {
+          this.file = 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)
+          this.dialogImageUrl = URL.createObjectURL(file)
+
         }
       },
       handleRemove() {
@@ -137,7 +140,7 @@
       handleCloseView() {
         this.dialogVisible = false;
       },
-  
+
       change(){
         this.checked = !this.check
       },
@@ -147,14 +150,14 @@
       choose(){
         this.$emit("choose");
       },
-  
+
       close() {
         this.$emit("close");
       },
     },
   };
   </script>
-  
+
   <style lang="scss" scoped>
   .close-icon {
     position: absolute;
@@ -164,7 +167,7 @@
     height: 15px;
     cursor: pointer;
   }
-  
+
   .close-icon::before,
   .close-icon::after {
     content: '';
@@ -177,15 +180,15 @@
     transform-origin: center;
     transform: translate(-50%, -50%);
   }
-  
+
   .close-icon::before {
     transform: translate(-50%, -50%) rotate(45deg); /* 旋转 45 度 */
   }
-  
+
   .close-icon::after {
     transform: translate(-50%, -50%) rotate(-45deg); /* 旋转 -45 度 */
   }
-  
+
   .myTitle{
     color: #00F6EC;
     font-size: 16px;
@@ -216,7 +219,7 @@
     opacity: 1;
     background: rgba(5, 28, 38, 0.58);
   }
-  
+
   .el-scrollbar {
     background: #15696b;
     border: 1px solid #00ffff;
@@ -242,10 +245,10 @@
     width: 640px;
     height: 708px;
     background-size: cover;
-  
+
     background-image: radial-gradient(circle at 50% 50%, #031417b3 0%, #0C1A1A 84%);
   }
-  
+
   ::v-deep .el-input__inner{
     color: #00ffff;
     background-color: rgba(15, 86, 86, 0.54);
@@ -288,5 +291,4 @@
     color: #199294;
   }
   </style>
-  
-  
+

+ 14 - 11
src/views/screen/engineering/issueSubDia.vue

@@ -74,6 +74,7 @@ export default {
   },
   data() {
     return {
+      file:null,
       title:'',
       description:'',
       need:'',
@@ -87,7 +88,6 @@ export default {
       checked:false
     };
   },
-  mounted() {},
   mounted() {
     this.dialogImageUrl = this.imgUrl
 },
@@ -96,18 +96,24 @@ export default {
       this.$refs.fileInput.click();
     },
     add() {
-      //  alert(this.imgUrl)
-      // return
+      if (this.file == null){
+        return
+      }
+
       const issueData = {
         title:this.title,
         description:this.description,
         need:this.need,
         projectId:'',
         delFlag: 0,
-        file:this.dialogImageUrl,
         status: 0,
       };
-      add(issueData).then((res) => {
+
+      const formData = new FormData();
+      formData.append("file", this.file);
+      formData.append("issue", new Blob([JSON.stringify(issueData)], { type: "application/json" }));
+
+      add(formData).then((res) => {
         if (Number(res.code) === 200) {
           this.close();
         }
@@ -118,13 +124,10 @@ export default {
     handleFileChange(event) {
       const file = event.target.files[0];
       if (file) {
+        this.file = 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)
+        this.dialogImageUrl = URL.createObjectURL(file)
+
       }
     },
     handleRemove() {

+ 4 - 1
src/views/screen/engineering/main.vue

@@ -519,7 +519,10 @@ export default {
 
     onChooseIssueList(){
       this.showC = true
-      this.showIssue = 1
+
+      this.flag = 2
+      this.showIssueSub = 1
+      this.showIssue = 0
     },
     onCloseIssue(){
       this.showC = false