DESKTOP-NE65RNK\Citrus_limon 1 жил өмнө
parent
commit
fb0497334c

+ 4 - 4
src/utils/index.ts

@@ -30,8 +30,8 @@ export const timeConverts = (timestamp: number) => {
   if (!timestamp) return "";
   let now_timestamp = +new Date();
   let diff_timestamp = now_timestamp - timestamp;
-  if (diff_timestamp / 1000 < 59) return `${Math.ceil(diff_timestamp / 1000)}秒前`;
-  if (diff_timestamp / 1000 / 60 < 59) return `${Math.ceil(diff_timestamp / 1000 / 60)}分钟前`;
-  if (diff_timestamp / 1000 / 60 / 60 < 23) return `${Math.ceil(diff_timestamp / 1000 / 60 / 60)}小时前`;
-  return `${Math.ceil(diff_timestamp / 1000 / 60 / 60 / 24)}天前`;
+  if (diff_timestamp / 1000 <= 59) return `${Math.floor(diff_timestamp / 1000)}秒前`;
+  if (diff_timestamp / 1000 / 60 <= 59) return `${Math.floor((diff_timestamp / 1000) / 60)}分钟前`;
+  if (diff_timestamp / 1000 / 60 / 60 <= 23) return `${Math.floor(diff_timestamp / 1000 / 60 / 60)}小时前`;
+  return `${Math.floor(diff_timestamp / 1000 / 60 / 60 / 24)}天前`;
 };

+ 24 - 7
src/views/bot/manage/detail.vue

@@ -106,13 +106,24 @@ const getBalanceInfo = (id: number) => {
     pageConfig.loading = false;
     if (data.code == 200) {
       balanceList.value = data.data;
+
+      const xData = data.data.map((item: any) => item.creationTime);
+      const sData = data.data.map((item: any) => item.balance);
+      const yMinData = Math.min(sData);
+
       !balanceChart.value
         ? initChart(data.data)
         : balanceChart.value.setOption({
             xAxis: {
               type: "category",
               boundaryGap: false,
-              data: data.map((item: any) => item.creationTime),
+              data: xData,
+            },
+            yAxis: {
+              type: "value",
+              boundaryGap: [0, "100%"],
+              min: yMinData,
+              interval: 1,
             },
             series: {
               name: "Balance",
@@ -121,7 +132,7 @@ const getBalanceInfo = (id: number) => {
               lineStyle: {
                 width: 1,
               },
-              data: data.map((item: any) => item.balance),
+              data: sData,
             },
           });
     }
@@ -160,6 +171,10 @@ const initChart = (data: any) => {
     balanceChart.value.resize();
   });
 
+  const xData = data.map((item: any) => item.creationTime);
+  const sData = data.map((item: any) => item.balance);
+  const yMinData = Math.min(sData);
+
   const balanceChartOption = {
     tooltip: {
       trigger: "axis",
@@ -169,35 +184,37 @@ const initChart = (data: any) => {
     },
     dataZoom: [
       {
-        start: 50,
+        start: 0,
         end: 100,
       },
       {
         type: "inside",
-        start: 50,
+        start: 0,
         end: 100,
       },
     ],
     xAxis: {
       type: "category",
       boundaryGap: false,
-      data: data.map((item: any) => item.creationTime),
+      data: xData,
     },
     yAxis: {
       type: "value",
       boundaryGap: [0, "100%"],
+      min: yMinData,
+      interval: 1,
     },
     series: {
       name: "Balance",
       type: "line",
       areaStyle: {},
-      data: data.map((item: any) => item.balance),
+      data: sData,
     },
   };
   balanceChart.value.setOption(balanceChartOption);
 };
 timer.value = setInterval(() => {
-  // getBalanceInfo(robotDetail.value.accId);
+  getBalanceInfo(robotDetail.value.accId);
   getLogsInfo();
 }, 5000);
 

+ 15 - 11
src/views/bot/manage/index.vue

@@ -133,27 +133,28 @@ interface FormItem {
   pageSize?: Number;
   name?: String;
 }
-const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 10 });
+const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 20 });
 
 interface TablePage {
   current: number;
   limit: number;
   total: number;
 }
-const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
+const tablePage: TablePage = reactive({ current: 1, limit: 20, total: 0 });
 const columns = ref([
   { title: "选项", width: "44px", type: "checkbox" },
-  { title: "ID", key: "id" },
-  { title: "名称", key: "name", customSlot: "name", ellipsisTooltip: true },
-  { title: "起始", key: "startAmount", align: "center" },
-  { title: "收益", key: "earningRate", customSlot: "earningRate", align: "center" },
-  { title: "状态", key: "status", customSlot: "status", align: "center" },
+  { title: "ID", width: "60px", key: "id" },
+  { title: "名称", width: "90px", key: "name", customSlot: "name", ellipsisTooltip: true },
+  { title: "起始", width: "90px", key: "startAmount", align: "center" },
+  { title: "收益", width: "90px", key: "earningRate", customSlot: "earningRate", align: "center" },
+  { title: "状态", width: "90px", key: "status", customSlot: "status", align: "center" },
   { title: "参数", key: "configs", ellipsisTooltip: true },
-  { title: "IP:编号", key: "ip", customSlot: "ip", ellipsisTooltip: true },
-  { title: "通讯", key: "lastReportTime", customSlot: "lastReportTime", align: "center" },
-  { title: "修改", key: "updateTime", customSlot: "updateTime", align: "center" },
+  { title: "IP:编号", width: "130px", key: "ip", customSlot: "ip", ellipsisTooltip: true },
+  { title: "通讯", width: "120px", key: "lastReportTime", customSlot: "lastReportTime", align: "center" },
+  { title: "修改", width: "120px", key: "updateTime", customSlot: "updateTime", align: "center" },
   {
     title: "操作",
+    width: "120px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,
@@ -194,7 +195,7 @@ const jumpDetail = (info: any) => {
 const handleShowInfo = (info: any) => {
   document.title = `[${info.runNum || 0}/${info.total || 0}] 利润:${info.income || 0}(${info.incomeRate || 0}%)
     初始:${info.startAmount || 0} 现有:${info.nowAmount || 0}`;
-  collectInfo.value = `[${info.runNum || 0}/${info.total || 0}] 利润:<span class="primary-color">${info.income || 0}(${info.incomeRate || 0}%)</span>
+  collectInfo.value = `[${info.runNum || 0}/${info.total || 0}] 利润:<span class="${info.income >= 0 ? 'primary-color' : 'danger-color'}">${info.income || 0}(${info.incomeRate || 0}%)</span>
     初始:<span class="primary-color">${info.startAmount || 0}</span> 现有:<span class="primary-color">${info.nowAmount || 0}</span>`;
 };
 
@@ -268,6 +269,9 @@ onBeforeUnmount(() => {
     :deep(.primary-color) {
       color: var(--primary-color);
     }
+    :deep(.danger-color) {
+      color: var(--danger-color);
+    }
   }
 }
 .custom-form-layout {

+ 1 - 1
src/views/quant/manage/components/UpdateParams.vue

@@ -10,7 +10,7 @@
         </lay-form-item>
         <lay-form-item label="类型" prop="valType">
           <lay-select v-model="modelParams.valType">
-            <lay-select-option v-for="(value, key) of QUANT_PARAMS_TYPE" :value="key" :label="value" />
+            <lay-select-option v-for="(value, key) of QUANT_PARAMS_TYPE" :value="Number(key)" :label="value" />
           </lay-select>
         </lay-form-item>
         <lay-form-item v-if="modelParams.valType == 3" prop="contentVal" label="可选值">

+ 1 - 1
src/views/server/manage/index.vue

@@ -102,7 +102,7 @@ const columns = ref([
   { title: "IP", width: "120px", key: "ipAddrComplex" },
   { title: "端口号", width: "80px", key: "portComplex" },
   { title: "状态", width: "80px", key: "status", customSlot: "status" },
-  { title: "通讯", width: "160px", key: "lastReportTime", customSlot: "lastReportTime" },
+  { title: "通讯", width: "80px", key: "lastReportTime", customSlot: "lastReportTime" },
   { title: "更新时间", width: "160px", key: "updateTime" },
   { title: "备注", key: "remark", ellipsisTooltip: true },
   {