瀏覽代碼

添加默认值

DESKTOP-NE65RNK\Citrus_limon 1 年之前
父節點
當前提交
90e87f313f
共有 2 個文件被更改,包括 17 次插入6 次删除
  1. 16 5
      src/views/bot/manage/components/Update.vue
  2. 1 1
      src/views/bot/manage/index.vue

+ 16 - 5
src/views/bot/manage/components/Update.vue

@@ -44,7 +44,7 @@
               <lay-col md="12" sm="12" xs="24">
                 <lay-form-item :label="item.name" :prop="`robotConfigs.${item.code}`">
                   <lay-input v-if="item.valType == 0" v-model="modelParams.robotConfigs[item.code]" />
-                  <lay-input-number v-if="item.valType == 1" v-model="modelParams.robotConfigs[item.code]" />
+                  <lay-input type="number" v-if="item.valType == 1" v-model="modelParams.robotConfigs[item.code]" />
                   <lay-switch v-if="item.valType == 2" v-model="modelParams.robotConfigs[item.code]" />
                   <lay-select v-if="item.valType == 3" v-model="modelParams.robotConfigs[item.code]" :show-search="true">
                     <lay-select-option v-for="items in item.contentVal.split(',')" :value="items" :label="items" />
@@ -112,15 +112,14 @@ const show = async (params?: any) => {
     detail.robotConfigs.map((item: any) => {
       if (item.valType == 2) {
         robotConfigs[item.code] = item.val == "true" ? true : false;
-      } else if (item.valType == 4) {
-        robotConfigs[item.code] = parseInt(item.val);
+      } else if (item.valType == 5) {
+        robotConfigs[item.code] = item.val ? parseInt(item.val) : undefined;
       } else {
         robotConfigs[item.code] = item.val;
       }
     });
 
     modelParams.value = { ...params, robotConfigs };
-    console.log(modelParams.value);
     strategyHandleChange(modelParams.value.strategyId);
     strategyProgramHandleChange(modelParams.value.strategyProgramId);
   } else {
@@ -166,9 +165,21 @@ const get_strategy_parameter = (value: number) => {
   const params = { programId: value };
   get_strategy_parameter_select(params, (data: any) => {
     strategyParameterList.value = data.data;
+
+    let defaultValObj: any = {};
+    strategyParameterList.value.map((item: any) => {
+      if (item.valType == 2) {
+        defaultValObj[item.code] = item.defaultVal == "true" ? true : false;
+      } else if (item.valType == 5) {
+        defaultValObj[item.code] = item.defaultVal ? parseInt(item.defaultVal) : undefined;
+      } else {
+        defaultValObj[item.code] = item.defaultVal;
+      }
+    });
+    modelParams.value = { ...modelParams.value, robotConfigs: { ...defaultValObj, ...modelParams.value.robotConfigs } };
   });
 };
-// 获取策略版本参数下拉
+// 获取APIKEY参数下拉
 const get_apikey = () => {
   const params = {};
   get_apikey_select(params, (data: any) => {

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

@@ -185,7 +185,7 @@ let refreshInterval = setInterval(() => {
       handleShowInfo(data.data);
     }
   });
-}, 2000);
+}, 100000);
 
 const jumpDetail = (info: any) => {
   window.open(`/bot/manage/detail/${info.id}`);