10.10综合交易所原始源码-管理后台
1
admin
2026-01-06 089bf5d2378b3c4a61d795b2a92bede2c193b771
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
<template>
  <el-dialog
    :title="!id ? '新增' : '修改'"
    :close-on-click-modal="false"
    width="1200px"
    @close="handClose"
    :visible.sync="visible"
  >
    <el-scrollbar class="vertical-scrollbar">
      <div class="scroll-content">
        <el-form
          :model="dataForm"
          :rules="dataRule"
          ref="dataForm"
          @keyup.enter.native="dataFormSubmit()"
          label-width="220px"
        >
          <el-form-item class="titleDivTwo" label="基础信息" prop="">
          </el-form-item>
          <el-row>
            <el-col :span="12">
              <el-form-item label="交易员UID" prop="traderUsercode">
                <el-input
                  :disabled="dataForm.uuid ? true : false"
                  v-model="dataForm.traderUsercode"
                  placeholder="交易员UID"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="!id">
              <el-form-item label="添加用户类型" prop="userType">
                <el-select
                  v-model="dataForm.userType"
                  class="spainut"
                  placeholder="请选择"
                  @change="changeVal()"
                >
                  <el-option
                    v-for="item in userTypeList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="(真实/演示)用户UID" prop="usercode">
                <el-input
                  :disabled="dataForm.uuid ? true : false"
                  v-model="dataForm.usercode"
                  placeholder="(真实/演示)用户UID"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="虚假用户用户名" prop="username">
                <el-input
                :disabled="dataForm.uuid ? true : false"
                  v-model="dataForm.username"
                  placeholder="虚假用户用户名"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="跟单方式" prop="followType">
                <el-select
                  class="spainut"
                  v-model="dataForm.followType"
                  placeholder="请选择"
                  @change="changeVal()"
                >
                  <el-option
                    v-for="item in direction"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="固定张数值或固定比例值(整数)" prop="volume">
                <el-input
                  type="number"
                  v-model="dataForm.volume"
                  placeholder="固定张数值或固定比例值(整数)"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="最大持仓张数(整数)" prop="volumeMax">
                <el-input
                  type="number"
                  v-model="dataForm.volumeMax"
                  placeholder="最大持仓张数(整数)"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="跟随收益" prop="profit">
                <el-input
                  type="number"
                  v-model="dataForm.profit"
                  placeholder="跟随收益"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="止盈百分比" prop="stopProfit">
                <el-input
                  type="number"
                  v-model="dataForm.stopProfit"
                  placeholder="止盈百分比"
                >
                  <template v-slot:append>
                    <span>%</span>
                  </template></el-input
                >
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="止损百分比" prop="stopLoss">
                <el-input
                  type="number"
                  v-model="dataForm.stopLoss"
                  placeholder="止损百分比"
                >
                  <template v-slot:append>
                    <span>%</span>
                  </template></el-input
                >
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="跟随本金" prop="amountSum">
                <el-input
                  type="number"
                  v-model="dataForm.amountSum"
                  placeholder="跟随本金"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </el-scrollbar>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { Debounce } from "@/utils/debounce";
import { encrypt } from "@/utils/crypto";
export default {
  data() {
    return {
      visible: false,
      imageUrl: "",
      dataForm: {
        id: "",
        uuid:"",
        traderUsercode: "",
        userType: "",
        usercode: "",
        followType: "",
        username: "",
        volume: "",
        volumeMax: "",
        profit: "",
        amountSum: "",
        stopProfit: "",
        stopLoss: "",
      },
      id: "",
      userTypeList: [
        {
          label: "(真实/演示)用户",
          value: "1",
        },
        {
          label: "虚假用户",
          value: "2",
        },
      ],
      direction: [
        {
          label: "固定张数",
          value: "1",
        },
        {
          label: "固定比例",
          value: "2",
        },
      ],
      dataRule: {
        //{ validator: validateindex, trigger: "blur" },
        traderUsercode: [
          { required: true, message: "交易员UID不能为空", trigger: "blur" },
        ],
        usercode: [{ required: true, message: "UID不能为空", trigger: "blur" }],
        username: [
          { required: true, message: "名称不能为空", trigger: "blur" },
        ],
        volume: [
          {
            required: true,
            message: "跟单张数或比例不能为空",
            trigger: "blur",
          },
        ],
        volumeMax: [
          { required: true, message: "最大持仓张数不能为空", trigger: "blur" },
        ],
        profit: [
          { required: true, message: "跟随收益不能为空", trigger: "blur" },
        ],
        amountSum: [
          { required: true, message: "跟随本金不能为空", trigger: "blur" },
        ],
        stopProfit: [
          { required: true, message: "止盈百分比不能为空", trigger: "blur" },
        ],
        stopLoss: [
          { required: true, message: "止损百分比不能为空", trigger: "blur" },
        ],
      },
      tempKey: -666666, // 临时key, 用于解决tree半选中状态项不能传给后台接口问题. # 待优化
    };
  },
  methods: {
    init(id) {
      if (id) {
        this.id = id;
        this.getMassage();
      } else {
        this.dataForm.userType = this.userTypeList[0].value;
        this.dataForm.followType = this.direction[0].value;
      }
      if (this.dataForm.img) {
        // this.imageUrl =  this.dataForm.path
      }
      this.visible = true;
    },
    handleAvatarSuccess(res, file) {
      this.dataForm.img = res.data.path;
      this.imageUrl = URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload(file) {
      // const isJPG = file.type === 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 10;
 
      // if (!isJPG) {
      //   this.$message.error('上传头像图片只能是 JPG 格式!');
      // }
      if (!isLt2M) {
        this.$message.error("上传图片大小不能超过 10MB!");
      }
      // return isJPG && isLt2M;
      return isLt2M;
    },
    handClose() {
      this.id = "";
      this.$data.dataForm = JSON.parse(
        JSON.stringify(this.$options.data().dataForm)
      );
      this.imageUrl = "";
      this.$nextTick(() => {
        this.$refs["dataForm"].clearValidate(); // 清除表单验证
      });
    },
    changeVal(val) {
      this.$forceUpdate();
    },
 
    dataFormSubmit: Debounce(function () {
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          let url = "";
          if (this.id) {
            //更新
            url = `/normal/adminTraderFollowUser!update.action`;
          } else {
            //新增
            url = `/normal/adminTraderFollowUser!add.action`;
          }
          // 添加需要提交的表单字段及其值到 FormData 对象
          this.$http({
            url: this.$http.adornUrl(url),
            method: "post",
            data: this.$http.adornData(this.dataForm),
          }).then(({ data }) => {
            if (data.code == 0) {
              this.$message({
                message: "操作成功",
                type: "success",
                duration: 1500,
                onClose: () => {
                  this.visible = false;
                  this.$emit("refreshDataList");
                },
              });
            } else {
              this.$message({
                message: data.msg,
                type: "error",
                duration: 1500,
                onClose: () => {},
              });
            }
          });
        }
      });
    }),
    getMassage() {
      this.$http({
        url: this.$http.adornUrl(
          `/normal/adminTraderFollowUser!toUpdate.action`
        ),
        method: "get",
        params: this.$http.adornParams({
          uuid: this.id,
        }),
      }).then(({ data }) => {
        console.log("data => " + JSON.stringify(data));
        if (data.code == 0) {
          //this.dataForm = { ...data.data };
          this.dataForm.uuid=data.data.uuid
          this.dataForm.traderUsercode = data.data.traderUserCode;
          // this.dataForm.userType=data.data.,
          this.dataForm.usercode = data.data.userCode;
          this.dataForm.followType = data.data.followType;
          this.dataForm.username = data.data.username;
          this.dataForm.volume = data.data.volume;
          this.dataForm.volumeMax = data.data.volumeMax;
          this.dataForm.profit = data.data.profit;
          this.dataForm.amountSum = data.data.amountSum;
          this.dataForm.stopProfit = data.data.stopProfit;
          this.dataForm.stopLoss = data.data.stopLoss;
          //   this.imageUrl = this.dataForm.img;
          // console.log(this.imageUrl)
        } else {
          this.$message({
            message: data.msg,
            type: "error",
            duration: 1500,
            onClose: () => {},
          });
        }
      });
    },
    // 表单提交
    // dataFormSubmit: Debounce(function () {
    //   if (!this.dataForm.img) {
    //     this.$message.error("上传图片不能为空");
    //     return;
    //   }
 
    //   let url = `/normal/adminFinanceAction!update.action`;
    //   if (!this.dataForm.id) {
    //     url = `/normal/adminFinanceAction!add.action`;
    //   }
    //   this.$refs["dataForm"].validate((valid) => {
    //     if (valid) {
    //       this.$http({
    //         url: this.$http.adornUrl(url),
    //         method: "get",
    //         params: this.$http.adornParams({
    //           ...this.dataForm,
    //           login_safeword: encrypt(this.dataForm.login_safeword),
    //         }),
    //       }).then(({ data }) => {
    //         console.log("data => " + JSON.stringify(data));
    //         this.$message({
    //           message: "操作成功",
    //           type: "success",
    //           duration: 1500,
    //           onClose: () => {
    //             this.visible = false;
    //             this.$emit("refreshDataList");
    //           },
    //         });
    //       });
    //     }
    //   });
    // }),
  },
};
</script>
<style scoped>
.titleDivTwo {
  height: 40px;
  border-left: 3px solid #1c4efa;
  background: #f4f7ff;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
.vertical-scrollbar .scroll-content {
  max-height: 600px;
  overflow-y: auto;
  overflow-x: hidden;
}
.vertical-scrollbar .scroll-content::-webkit-scrollbar {
  width: 4px;
}
 
.vertical-scrollbar .scroll-content::-webkit-scrollbar-track {
  background-color: #f1f1f1;
}
 
.vertical-scrollbar .scroll-content::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 4px;
}
 
.vertical-scrollbar .scroll-content::-webkit-scrollbar-thumb:hover {
  background-color: #555;
}
.spainut {
  width: 360px;
}
</style>