Explorar el Código

fix(质检报告): 修复组件显示逻辑和模态框可见性控制

liujt hace 6 meses
padre
commit
be6c9a3267

+ 4 - 3
src/views/inspectionReport/index.vue

@@ -109,8 +109,8 @@
     </el-card>
 
     <component
+      v-if="targetVisible"
       :is="targetComponent"
-      ref="targetComponentRef"
       :key="targetComponent"
       :isView="isView"
       :visible.sync="targetVisible"
@@ -463,16 +463,17 @@
         this.targetComponent = row.reportTemplateCode;
         this.currentRow = row;
         this.$nextTick(() => {
-          this.targetVisible = true;
+          this.detailVisible = true;    
         });
       },
       openDetails(row) {
-        let id = row.id;
         this.isView = true;
         this.currentRow = row;
         this.targetComponent = row.reportTemplateCode;
+        console.log('currentRow', this.currentRow, this.targetComponent);
         this.$nextTick(() => {
           this.targetVisible = true;
+            console.log('targetVisible~~~~', this.targetVisible);
         });
       },
       async deleteReportBtn(row) {

+ 12 - 5
src/views/inspectionReport/template/inspection_report1.vue

@@ -1,9 +1,11 @@
 <template>
     <ele-modal
-        :visible.sync="visible"
+        :visible="visible"
+        v-if="visible"
         title="质检报告"
         width="70%"
         append-to-body
+        :before-close="cancel"
         :maxable="true"
     >
         <div id="printSection" style="padding: 20px; background-color: white;">
@@ -249,10 +251,15 @@ export default {
         }
     },
     watch: {
-        visible(newVal, oldVal) {
-            if (newVal) {
-                this.open(this.row, this.item);
-            }
+        visible: {
+            handler: function (val) {
+                console.log('visible~~~', val);
+                if (val) {
+                    this.open(this.row, this.item);
+                }
+            },
+            deep: true,
+            immediate: true
         }
     },
     created() {