DESKTOP-NE65RNK\Citrus_limon 7 сар өмнө
parent
commit
2636572814

+ 6 - 0
src/api/index.ts

@@ -250,6 +250,12 @@ export const get_cta_robot_order_list = (params: any, callback: any) => {
     if (data) callback && callback(data);
   });
 };
+// 机器人管理-CTA机器日志
+export const get_cta_robot_error_log = (params: any, callback: any) => {
+  return http.request("/cta/errorLog/getPage", "get", params).then((data) => {
+    if (data) callback && callback(data);
+  });
+};
 // 机器人管理-CTA机器利润
 export const get_cta_robot_profit = (params: any, callback: any) => {
   return http.request("/cta/statistics/profitLossAndTradeVolume", "get", params).then((data) => {

+ 4 - 0
src/assets/css/index.scss

@@ -328,3 +328,7 @@ body,
 .layui-input-inline {
   width: auto !important;
 }
+
+.layui-popper{
+  z-index: 100000;
+}

+ 84 - 0
src/views/bot/cta/components/Logs.vue

@@ -0,0 +1,84 @@
+<template>
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" area="auto">
+    <div class="width-1000 custom-layer" style="padding: 20px">
+      <div class="table-wp">
+        <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :loading="modelConfig.tableLoading" @change="handleCurrentChange">
+          <template v-slot:status="{ row }">
+            {{ row.status ? "启用" : "禁用" }}
+          </template>
+        </lay-table>
+      </div>
+    </div>
+  </lay-layer>
+</template>
+
+<script lang="ts" setup>
+import { ref, reactive } from "vue";
+import { get_cta_robot_error_log } from "@/api/index";
+
+interface ModelConfig {
+  title: string;
+  visible: boolean;
+  isUpdate: boolean;
+  loading: boolean;
+  tableLoading: boolean;
+}
+
+let modelConfig: ModelConfig = reactive({ title: "", visible: false, isUpdate: false, loading: false, tableLoading: true });
+
+interface FormItem {
+  pageNum?: Number;
+  pageSize?: Number;
+  id?: number;
+}
+
+let modelParams: FormItem = reactive({ pageNum: 1, pageSize: 20 });
+
+interface TablePage {
+  current: number;
+  limit: number;
+  total: number;
+}
+const tablePage: TablePage = reactive({ current: 1, limit: 20, total: 0, limits: [20, 50, 100, 200, 500] });
+const columns = ref([
+  { title: "错误类型", key: "title" },
+  { title: "请求参数", key: "paramsStr", ellipsisTooltip: true },
+  { title: "错误结果", key: "errorLos", ellipsisTooltip: true },
+]);
+let dataSource = ref([]);
+
+const show = (params?: any) => {
+  modelConfig.visible = true;
+  modelConfig.title = "数据详情";
+  dataSource = ref([]);
+  modelParams = { ...modelParams, id: params.id };
+  getCtaRobotErrorLog();
+};
+
+const getCtaRobotErrorLog = () => {
+  let params = { ...modelParams };
+  modelConfig.tableLoading = true;
+  get_cta_robot_error_log(params, (data: any) => {
+    modelConfig.tableLoading = false;
+    if (data.code == 200) {
+      dataSource.value = data.data.list;
+      tablePage.total = data.data.total;
+    }
+  });
+};
+
+// 分页设置
+const handleCurrentChange = (val: any) => {
+  modelParams.pageNum = val.current;
+  modelParams.pageSize = val.limit;
+  getCtaRobotErrorLog();
+};
+
+defineExpose({ show });
+</script>
+<style lang="scss" scoped>
+.content {
+  word-wrap: break-word;
+  padding: 10px;
+}
+</style>

+ 2 - 2
src/views/bot/cta/components/Update.vue

@@ -39,11 +39,11 @@
               <lay-input v-model="modelParams.fundRatio" placeholder="资金比例" />
             </lay-form-item>
           </lay-col>
-          <lay-col md="12" sm="12" xs="24">
+          <!-- <lay-col md="12" sm="12" xs="24">
             <lay-form-item label="止损" prop="stopLoss">
               <lay-input v-model="modelParams.stopLoss" placeholder="止损比例" />
             </lay-form-item>
-          </lay-col>
+          </lay-col> -->
         </lay-row>
       </lay-form>
     </div>

+ 10 - 11
src/views/bot/cta/detail.vue

@@ -21,6 +21,9 @@
         <span class="card-title">收益图</span>
         <span class="card-subtitle">(近3天)</span>
       </template>
+      <template v-slot:extra>
+        <lay-button class="card-button" border="red" @click="handleShowLogs()">错误日志</lay-button>
+      </template>
       <template v-slot:body>
         <div class="profit-chart" ref="profitChartRef"></div>
       </template>
@@ -64,6 +67,7 @@
     </lay-card>
   </div>
   <InfoLayer ref="infoLayerRef" />
+  <Logs ref="logsRef" />
 </template>
 <script lang="ts" setup name="BotCtaDetail">
 import { ref, reactive, onMounted, onUnmounted, shallowRef } from "vue";
@@ -73,6 +77,7 @@ import * as echarts from "echarts";
 import Decimal from "decimal.js";
 import dayjs from "dayjs";
 import InfoLayer from "./components/InfoLayer.vue";
+import Logs from "./components/Logs.vue"
 import { get_cta_robot_detail, get_cta_robot_order_list, get_cta_robot_profit } from "@/api";
 
 const ROBOT_STATUS: any = reactive({
@@ -84,6 +89,7 @@ const ROBOT_STATUS: any = reactive({
 
 const profitChartRef = ref();
 const infoLayerRef = ref();
+const logsRef = ref();
 
 const route = useRoute();
 
@@ -229,17 +235,10 @@ const getProfitInfo = (id: number) => {
 };
 
 // 请求机器人日志
-// const getLogsInfo = () => {
-//   const params = { id: route.params.id, n: 500 };
-//   pageConfig.logsLoading = true;
-//   get_robot_logs(params, (data: any) => {
-//     pageConfig.logsLoading = false;
-//     if (data.code == 200) {
-//       logsList.value = handlePageInfo(data.data);
-//     }
-//   });
-// };
-// getLogsInfo();
+const handleShowLogs = () => {
+  const params = { id: route.params.id };
+  logsRef.value.show(params)
+};
 
 // const handlePageInfo = (data: any) => {
 //   let infoList = data;

+ 4 - 4
src/views/bot/cta/index.vue

@@ -32,7 +32,7 @@
           <lay-space>
             <!-- <lay-button v-if="apiList?.includes('/robot/submitStatus')" :border="'green'" size="xs" @click="handleStatus(selectedKeys, 'RUN')">开机</lay-button> -->
             <!-- <lay-button v-if="apiList?.includes('/robot/submitStatus')" :border="'red'" size="xs" @click="handleStatus(selectedKeys, 'STOP')">停机</lay-button> -->
-            <lay-button :border="'green'" size="xs" @click="handleRrestoration(selectedKeys)">复位余额</lay-button>
+            <lay-button border="green" size="xs" @click="handleRrestoration(selectedKeys)">复位余额</lay-button>
           </lay-space>
         </div>
       </div>
@@ -47,9 +47,9 @@
             </span>
           </template>
           <template v-slot:configs="{ row }">
-            <lay-tooltip :content="`资金比例:${row.fundRatio}%;止损:${row.stopLoss}%;`">
+            <lay-tooltip :content="`资金比例:${row.fundRatio * 100}%;`">
               <div class="ellipsis-2" @click="handleUpdate(row)">
-                {{ `资金比例:${row.fundRatio}%;止损:${row.stopLoss}%;` }}
+                {{ `资金比例:${row.fundRatio * 100}%;` }}
               </div>
             </lay-tooltip>
           </template>
@@ -82,7 +82,7 @@
           <lay-space>
             <!-- <lay-button v-if="apiList?.includes('/robot/submitStatus')" :border="'green'" size="xs" @click="handleStatus(selectedKeys, 'RUN')">开机</lay-button> -->
             <!-- <lay-button v-if="apiList?.includes('/robot/submitStatus')" :border="'red'" size="xs" @click="handleStatus(selectedKeys, 'STOP')">停机</lay-button> -->
-            <lay-button :border="'green'" size="xs" @click="handleRrestoration(selectedKeys)">复位余额</lay-button>
+            <lay-button border="green" size="xs" @click="handleRrestoration(selectedKeys)">复位余额</lay-button>
           </lay-space>
         </div>
       </div>