From a96f8fe6fcdb95d1ab77187afb0b98cfa2ea0515 Mon Sep 17 00:00:00 2001
From: PC-20250623MANY\Administrator <344137771@qq.com>
Date: Thu, 25 Sep 2025 15:07:58 +0800
Subject: [PATCH] 1

---
 src/views/account/components/Position.vue |   59 ++++++++++++++++++++++-------------------------------------
 1 files changed, 22 insertions(+), 37 deletions(-)

diff --git a/src/views/account/components/Position.vue b/src/views/account/components/Position.vue
index cc5e7df..b125da7 100644
--- a/src/views/account/components/Position.vue
+++ b/src/views/account/components/Position.vue
@@ -1,35 +1,17 @@
 <template>
-  <el-drawer
-    :title="$t('hj2')"
-    :visible.sync="dialogVisible"
-    direction="rtl"
-    :before-close="onClose"
-    size="980px"
-  >
+  <el-drawer :title="$t('hj2')" :visible.sync="dialogVisible" direction="rtl" :before-close="onClose" size="980px">
     <div class="drawer-content">
-      <el-table
-        height="100%"
-        :data="tableData"
-        style="width: 100%; flex: 1"
-        empty-text="No Data"
-      >
+      <el-table height="100%" :data="tableData" style="width: 100%; flex: 1" empty-text="No Data">
         <el-table-column prop="stockSpell" :label="$t('hj313')">
           <template slot-scope="scope">
-            <el-tag
-              :type="scope.row.stockGid != $mc ? 'success' : ''"
-              size="small"
-              style="margin-right: 8px"
-            >
+            <el-tag :type="scope.row.stockGid != $mc ? 'success' : ''" size="small" style="margin-right: 8px">
               {{ scope.row.stockGid }}
             </el-tag>
             <span>{{ scope.row.stockName }}</span>
           </template>
         </el-table-column>
 
-        <el-table-column
-          prop="positionType"
-          :label="`${$t('hj313')} ${$t('類型')}`"
-        >
+        <el-table-column prop="positionType" :label="`${$t('hj313')} ${$t('類型')}`">
           <template slot-scope="scope">
             <el-tag type="warning">
               {{ dictionary.gplx[scope.row.positionType] }}
@@ -49,15 +31,12 @@
 
         <el-table-column prop="profitAndLoseParent" :label="$t('Profit')">
           <template slot-scope="scope">
-            <span
-              :class="`${
-                scope.row.profitAndLose < 0
-                  ? 'r_c'
-                  : scope.row.profitAndLose > 0
+            <span :class="`${scope.row.profitAndLose < 0
+                ? 'r_c'
+                : scope.row.profitAndLose > 0
                   ? 'lc_c'
                   : ''
-              }`"
-            >
+              }`">
               {{ scope.row.profitAndLose }} ({{
                 scope.row.profitAndLoseParent
               }})
@@ -95,14 +74,8 @@
       </el-table>
 
       <div class="pagination flex-end">
-        <el-pagination
-          background
-          layout="prev, pager, next"
-          :total="total"
-          :current-page="pageNum"
-          :page-size="pageSize"
-          @current-change="handleCurrentChange"
-        >
+        <el-pagination background layout="prev, pager, next" :total="total" :current-page="pageNum"
+          :page-size="pageSize" @current-change="handleCurrentChange">
         </el-pagination>
       </div>
     </div>
@@ -110,6 +83,7 @@
 </template>
 
 <script>
+let times = null; // 计时器
 import mixins from "@/mixins/myMixins"; // 混入
 import * as api from "@/axios/api";
 export default {
@@ -135,6 +109,11 @@
     this.opt.stockType = this.type;
     this.apiInterface = api.getchicang; // 赋值接口
     this.init(); // 获取记录列表
+
+    this.stopTimer()
+    times = setInterval(() => {
+      this.getList()
+    }, 3000)
   },
   methods: {
     // 关闭弹窗
@@ -142,6 +121,12 @@
       this.$emit("update:dialogVisible", false);
       this.$emit("onClose"); // 关闭弹窗时,通知父组件
     },
+    stopTimer() {
+      if (times) {
+        clearInterval(times);
+        times = null;
+      }
+    },
   },
 };
 </script>

--
Gitblit v1.9.3