1
PC-20250623MANY\Administrator
2025-09-25 a96f8fe6fcdb95d1ab77187afb0b98cfa2ea0515
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>