From ac6dd934b8ea9473d85d95d60153e7c317778d33 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期三, 27 十二月 2023 13:58:41 +0800
Subject: [PATCH] 优化

---
 jcdm-ui/src/views/main/cfkb/Instructions/index.vue |   46 ++++++++++++++--------------------------------
 1 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/jcdm-ui/src/views/main/cfkb/Instructions/index.vue b/jcdm-ui/src/views/main/cfkb/Instructions/index.vue
index 3f06afe..7d33e70 100644
--- a/jcdm-ui/src/views/main/cfkb/Instructions/index.vue
+++ b/jcdm-ui/src/views/main/cfkb/Instructions/index.vue
@@ -26,7 +26,7 @@
           <div v-for="(item,index) in tableData" :key="item.sort" class="outerDiv" :id="'outerDiv'+index">
             <div class="innerDiv1">
               <div class="innerDiv2">
-                <span class="content_left">{{ item.sort }}</span>
+                <span class="content_left">{{ index+1 }}</span>
               </div>
               <div class="content_right">{{ item.address }}</div>
             </div>
@@ -83,7 +83,7 @@
         pageSize: 10,
         productCode: null,
       },
-      productCode: 'OP1010',
+      productCode: '2V91',
       tableData: [{
         img: 'https://fuss10.elemecdn.com/e/5d/4a731a90594',
         sort: '2',
@@ -138,13 +138,14 @@
     };
   },
   created() {
+    this.tableData = []
   },
   mounted() {
-    document.getElementById('outerDiv0').style.background = 'yellow'
-    this.setImg(0)
-    this.autoShow()
+    this.changeProducts(this.productCode)
+    // this.autoShow()
   },
   methods: {
+    // 瀹氭椂瑙﹀彂
     autoShow() {
       const _this = this
       this.intervalId = setInterval(() => {
@@ -193,41 +194,22 @@
 
     },
     changeProducts(val){
+
       this.productCode = val
       const _this = this
 
       /** 鏌ヨ閰嶆柟閰嶇疆瀛愪俊鎭垪琛� */
       this.queryParams.productCode = val;
       listFormulaChild(this.queryParams).then(response => {
-        this.tableData = [];
+        // this.tableData = [];
         this.tableData = response.rows;
-        clearInterval(this.intervalId);
+        this.$nextTick(() => {
+          clearInterval(this.intervalId);
+          document.getElementById('outerDiv0').style.background = 'yellow'
+          this.setImg(0)
+          this.autoShow()
+        })
 
-        for (let i = 0; i < this.tableData.length; i++) {
-          document.getElementById('outerDiv'+i).style.background = 'white'
-        }
-        setTimeout(() => {
-        document.getElementById('outerDiv0').style.background = 'yellow'
-          this.intervalId = setInterval(() => {
-            if (document.getElementById('outerDiv' + (this.tableData.length - 1)).style.background === 'yellow') {
-              this.setImg(0)
-              document.getElementById('outerDiv0').style.background = 'yellow'
-              for (let j = 1; j < this.tableData.length; j++) {
-                document.getElementById('outerDiv' + j).style.background = 'white'
-              }
-              return;
-            }
-            for (let i = 0; i < this.tableData.length; i++) {
-              if (document.getElementById('outerDiv' + i).style.background === 'yellow') {
-                this.setImg(i+1)
-                document.getElementById('outerDiv' + i).style.background = 'green'
-                document.getElementById('outerDiv' + (i+1)).style.background = 'yellow'
-                return;
-              }
-            }
-
-          }, 2000)
-        }, 7000);
 
       });
     },

--
Gitblit v1.9.3