|
|
@@ -39,11 +39,20 @@
|
|
|
<lay-input v-model="modelParams.fundRatio" placeholder="资金比例" />
|
|
|
</lay-form-item>
|
|
|
</lay-col>
|
|
|
- <!-- <lay-col md="12" sm="12" xs="24">
|
|
|
- <lay-form-item label="止损" prop="stopLoss">
|
|
|
- <lay-input v-model="modelParams.stopLoss" placeholder="止损比例" />
|
|
|
+ <lay-col md="24" sm="24" xs="24">
|
|
|
+ <lay-form-item label="平仓方式" prop="closeType">
|
|
|
+ <lay-radio-group name="action" v-model="modelParams.closeType">
|
|
|
+ <!-- <lay-radio value="1">止盈止损</lay-radio> -->
|
|
|
+ <lay-radio value="2">时间平仓</lay-radio>
|
|
|
+ </lay-radio-group>
|
|
|
</lay-form-item>
|
|
|
- </lay-col> -->
|
|
|
+ </lay-col>
|
|
|
+ <lay-col md="12" sm="12" xs="24">
|
|
|
+ <lay-form-item label="平仓时间(s)" prop="clockTime">
|
|
|
+ <lay-input v-model="modelParams.clockTime" placeholder="平仓时间(s)" />
|
|
|
+ <div class="input-hint">平仓时间:{{ formatTime(parseInt(modelParams.clockTime || "0") > 0 ? modelParams.clockTime : 0) }}</div>
|
|
|
+ </lay-form-item>
|
|
|
+ </lay-col>
|
|
|
</lay-row>
|
|
|
</lay-form>
|
|
|
</div>
|
|
|
@@ -52,6 +61,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, reactive, getCurrentInstance } from "vue";
|
|
|
+import { formatTime } from "@/utils/index";
|
|
|
import { add_cta_robot, update_cta_robot, get_server_select, get_apikey_select } from "@/api";
|
|
|
import { INDICATOR_EXCHANG_TYPE } from "@/utils/enum";
|
|
|
|
|
|
@@ -74,6 +84,8 @@ interface ModelParams {
|
|
|
serverId?: number;
|
|
|
accountId?: number;
|
|
|
stopLoss?: number;
|
|
|
+ closeType?: string;
|
|
|
+ clockTime?: string;
|
|
|
}
|
|
|
|
|
|
let modelParams = ref<ModelParams>({});
|
|
|
@@ -85,7 +97,6 @@ let serverList = ref();
|
|
|
let apikeyList = ref();
|
|
|
|
|
|
const show = async (params?: any) => {
|
|
|
- console.log(params);
|
|
|
const accountId = params.configList?.find((item: any) => item.code == "account")?.val;
|
|
|
serverList.value = [];
|
|
|
apikeyList.value = [];
|
|
|
@@ -93,7 +104,7 @@ const show = async (params?: any) => {
|
|
|
get_apikey(accountId);
|
|
|
modelConfig.visible = true;
|
|
|
modelConfig.isUpdate = !!params;
|
|
|
- modelParams.value = modelConfig.isUpdate ? { ...params } : {};
|
|
|
+ modelParams.value = modelConfig.isUpdate ? { ...params, closeType: "2" } : { closeType: "2", clockTime: 86400 };
|
|
|
modelConfig.title = !!params ? "编辑机器人" : "添加机器人";
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
handleResult.resolve = resolve;
|