1
admin
2026-01-27 88916464ff5c3be9f677aca273d0cc8c2a6700dd
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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
<template>
  <page-header-wrapper>
    <template v-slot:content>
      <div class="page-header-content">
        <div class="avatar">
          <a-avatar size="large" :src="currentUser.avatar" />
        </div>
        <div class="content">
          <div class="content-title">
            {{ timeFix }},{{ userdetails.adminName ? userdetails.adminName : 'Admin' }}<span class="welcome-text">,{{
                welcome
            }}</span>
          </div>
          <div>{{ lizhidetail.content }} —— {{ lizhidetail.author }}</div>
        </div>
      </div>
    </template>
    <template v-slot:extraContent>
      <div class="extra-content">
        <div class="stat-item">
          <a-statistic title="代理数量" :value="infodetail.agent_num" />
        </div>
        <div class="stat-item">
          <a-statistic title="实盘用户" :value="infodetail.user_sp_num" />
        </div>
        <div class="stat-item">
          <a-statistic title="模拟用户" :value="infodetail.user_moni_num" />
        </div>
      </div>
    </template>
    <div>
      <a-row :gutter="24">
        <a-col :xl="16" :lg="24" :md="24" :sm="24" :xs="24">
          <a-card class="project-list" :loading="loading" style="margin-bottom: 24px;" :bordered="false" title="大盘指数"
            :body-style="{ padding: 0 }">
            <!-- <a slot="extra">全部项目</a> -->
            <div>
              <a-card-grid class="project-card-grid" :key="i" v-for="(item, i) in market" v-if="i < 6">
                <a-card :bordered="false" :body-style="{ padding: 0 }">
                  <a-card-meta>
                    <div slot="title" class="card-title">
                      <!-- <a-avatar size="small" :src="item.cover" /> -->
                      <a :style="'background:' + color16()"
                        style="color:#fff;font-size:14px;border-radius:50%;padding:6px;line-height: 1;">
                        {{ item.name.substr(0, 1) }}
                      </a>
                      <a style="margin-left:8px">{{ item.name }}</a>
                      <a :class="item.increase < 0 ? 'greens' : 'reds'" style="margin-left:10px">({{ item.nowPrice
                      }})</a>
                    </div>
                    <div slot="description" class="card-description" v-if="i == 0">
                      上证指数是一个反映上海证券交易所挂牌股票总体走势的统计指标
                    </div>
                    <div slot="description" class="card-description" v-if="i == 1">
                      深证成指交易所成份股价指数(简称深证成指)是深圳证券交易所的主要股指。
                    </div>
                    <div slot="description" class="card-description" v-if="i == 2">
                      创业板是一种证券市场,是专为暂时无法在主板市场上市的创业型企业。
                    </div>
                    <div slot="description" class="card-description" v-if="i == 3">
                      沪深300指数由沪深市场中规模大、流动性好的最具代表性的300只证券组成。
                    </div>
                    <div slot="description" class="card-description" v-if="i == 4">
                      中小企业100指数样本应该都是在深交所中小企业板上市交易的A股。
                    </div>
                    <div slot="description" class="card-description" v-if="i == 5">
                      创业板50指数是在创业板指的100只股票中,选取最近半年日均成交额排名靠前的50只股票。
                    </div>
                  </a-card-meta>
                  <div class="project-item">
                    <a href="/#/" :class="item.increase < 0 ? 'greens' : 'reds'">{{ item.increase }}</a>
                    <span class="datetime" :class="item.increase < 0 ? 'greens' : 'reds'">{{ item.increaseRate
                    }}%</span>
                    <!-- <a-tag :color="item.increase < 0 ? '#87d068' : '#f50'" style="margin-right:0">
                      {{item.increaseRate}}%
                    </a-tag> -->
                  </div>
                </a-card>
              </a-card-grid>
            </div>
          </a-card>
 
          <a-card :loading="loading" title="持仓动态" :bordered="false">
            <a-list>
              <a-list-item :key="index" v-for="(item, index) in rongzilist">
                <a-list-item-meta>
                  <div slot="title">
                    <span>@{{ item.nickName }}</span>&nbsp; 买入了&nbsp;<a href="#">{{ item.stockName }}({{ item.stockCode
                    }})</a>&nbsp;
                    <span style="margin-right:10px;">方向</span>
                    <a-tag :color="item.orderDirection == '买涨' ? 'red' : 'green'">
                      {{ item.orderDirection }}
                    </a-tag>
                  </div>
                  <div slot="description">{{ item.buyOrderTime | moment }}</div>
                </a-list-item-meta>
              </a-list-item>
            </a-list>
          </a-card>
        </a-col>
        <a-col style="padding: 0 12px" :xl="8" :lg="24" :md="24" :sm="24" :xs="24">
          <a-card title="快速开始 / 便捷导航" style="margin-bottom: 24px;display:none" :bordered="false"
            :body-style="{ padding: 0 }">
            <div class="item-group">
              <a>操作一</a>
              <a>操作二</a>
              <a>操作三</a>
              <a>操作四</a>
              <a>操作五</a>
              <a>操作六</a>
              <a-button size="small" type="primary" ghost icon="plus">添加</a-button>
            </div>
          </a-card>
          <a-card title="占比统计" style="margin-bottom: 24px" :loading="radarLoading" :bordered="false"
            :body-style="{ padding: 0 }">
            <div style="min-height: 400px;">
              <!-- <radar :data="radarData" /> -->
              <v-chart :force-fit="true" :height="405" :data="pieData" :scale="pieScale">
                <v-tooltip :showTitle="false" dataKey="item*percent" />
                <v-axis />
                <!-- position="right" :offsetX="-140" -->
                <v-legend dataKey="item" />
                <v-pie position="percent" color="item" :vStyle="pieStyle" />
                <v-coord type="theta" :radius="0.75" :innerRadius="0.6" />
              </v-chart>
            </div>
          </a-card>
          <a-card :loading="loading" title="充值提现统计" :bordered="false">
            <div class="members">
              <a-row>
                <a-col :span="12">
                  <a>
                    <span>今日充值</span>
                    <span class="member">{{ infodetail.charge_today_sum_amt ? infodetail.charge_today_sum_amt : 0
                    }}</span>
                  </a>
                </a-col>
                <a-col :span="12">
                  <a>
                    <span>总充值</span>
                    <span class="member">{{ infodetail.charge_sum_amt ? infodetail.charge_sum_amt : 0 }}</span>
                  </a>
                </a-col>
                <a-col :span="12">
                  <a>
                    <span>今日提现</span>
                    <span class="member">{{ infodetail.sp_withdraw_sum_today_amt_success ?
                        infodetail.sp_withdraw_sum_today_amt_success : 0
                    }}</span>
                  </a>
                </a-col>
                <a-col :span="12">
                  <a>
                    <span>总提现</span>
                    <span class="member">{{ infodetail.sp_withdraw_sum_amt_success ?
                        infodetail.sp_withdraw_sum_amt_success : 0
                    }}</span>
                  </a>
                </a-col>
              </a-row>
            </div>
          </a-card>
        </a-col>
      </a-row>
    </div>
  </page-header-wrapper>
</template>
 
<script>
import { timeFix } from '@/utils/util'
import { mapState } from 'vuex'
import { PageHeaderWrapper } from '@ant-design-vue/pro-layout'
import { Radar } from '@/components'
import { getRoleList, getServiceList } from '@/api/manage'
import { stockgetMarket, countdata } from '@/api/home'
import { positionlist } from '@/api/position'
import { adminlist } from '@/api/managesettings'
import axios from 'axios'
 
const DataSet = require('@antv/data-set')
export default {
  name: 'Workplace',
  components: {
    PageHeaderWrapper,
    Radar,
  },
  data() {
    return {
      pieScale: null,
      pieData: null,
      sourceData: null,
      pieStyle: {
        stroke: '#fff',
        lineWidth: 1
      },
      timeFix: timeFix(),
      avatar: '',
      user: {},
 
      projects: [],
      loading: true,
      radarLoading: true,
      activities: [],
      teams: [],
 
      // data
      axis1Opts: {
        dataKey: 'item',
        line: null,
        tickLine: null,
        grid: {
          lineStyle: {
            lineDash: null
          },
          hideFirstLine: false
        }
      },
      axis2Opts: {
        dataKey: 'score',
        line: null,
        tickLine: null,
        grid: {
          type: 'polygon',
          lineStyle: {
            lineDash: null
          }
        }
      },
      scale: [
        {
          dataKey: 'score',
          min: 0,
          max: 80
        }
      ],
      axisData: [
        { item: '引用', a: 70, b: 30, c: 40 },
        { item: '口碑', a: 60, b: 70, c: 40 },
        { item: '产量', a: 50, b: 60, c: 40 },
        { item: '贡献', a: 40, b: 50, c: 40 },
        { item: '热度', a: 60, b: 70, c: 40 },
        { item: '引用', a: 70, b: 50, c: 40 }
      ],
      radarData: [],
 
      market: [],
      infodetail: {},
      rongzilist: [],
      userdetails: '',
      lizhidetail: ''
    }
  },
  computed: {
    ...mapState({
      nickname: state => state.user.nickname,
      welcome: state => state.user.welcome
    }),
    currentUser() {
      return {
        name: 'Serati Ma',
        avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png'
      }
    },
    userInfo() {
      return this.$store.getters.userInfo
    }
  },
  created() {
    this.user = this.userInfo
    this.avatar = this.userInfo.avatar
 
    getRoleList().then(res => {
      // console.log('workplace -> call getRoleList()', res)
    })
 
    getServiceList().then(res => {
      // console.log('workplace -> call getServiceList()', res)
    })
  },
  mounted() {
    this.getActivity()
    this.initRadar()
    this.getdapan()
    this.getcountdata()
    this.getrongzilist()
    this.getnowuser()
    this.getlizhi()
  },
  methods: {
    getlizhi() {
      axios.get('https://api.bafang.icu/saying/get').then(res => {
        this.lizhidetail = res.data.data
      })
    },
    getnowuser() {
      adminlist().then(res => {
        if (window.localStorage.getItem('phones')) {
          var index = res.data.list.findIndex(item => item.adminPhone == window.localStorage.getItem('phones'))
          this.userdetails = res.data.list[index]
        } else {
          this.$notification['error']({
            message: '重新登陆',
            description: '未登录或登录过期,请重新登录',
          })
          this.$store.dispatch('Logout').then(() => {
            setTimeout(() => {
              window.localStorage.clear()
              window.location.reload()
            }, 1500)
          })
        }
      })
    },
    getrongzilist() {
      var data = {
        pageNum: 1,
        pageSize: 5,
        state: 0,
      }
      positionlist(data).then(res => {
        this.rongzilist = res.data.list
      })
    },
    color16() {//十六进制颜色随机
      var r = Math.floor(Math.random() * 256);
      var g = Math.floor(Math.random() * 256);
      var b = Math.floor(Math.random() * 256);
      var color = '#' + r.toString(16) + g.toString(16) + b.toString(16);
      return color;
    },
    getdapan() {
      stockgetMarket().then(res => {
        this.market = res.data.market
        this.loading = false
      })
    },
    getcountdata() {
      countdata().then(res => {
        this.infodetail = res.data
        this.sourceData = [
          { item: '股票数量', count: this.infodetail.stock_num },
          { item: '客户总资金', count: this.infodetail.user_sp_sum_amt },
          { item: '客户可用资金', count: this.infodetail.user_sp_sum_enable },
          { item: '持仓订单', count: this.infodetail.sp_position_num },
          { item: '平仓订单', count: this.infodetail.sp_pc_position_num },
          { item: '总入金', count: this.infodetail.charge_sum_amt }
        ]
        this.pieScale = [{
          dataKey: 'percent',
          min: 0,
          formatter: '.0%'
        }]
 
        var dv = new DataSet.View().source(this.sourceData)
        dv.transform({
          type: 'percent',
          field: 'count',
          dimension: 'item',
          as: 'percent'
        })
        this.pieData = dv.rows
      })
    },
    getActivity() {
      this.$http.get('/workplace/activity').then(res => {
        this.activities = res.result
      })
    },
    initRadar() {
      this.radarLoading = true
 
      this.$http.get('/workplace/radar').then(res => {
        const dv = new DataSet.View().source(res.result)
        dv.transform({
          type: 'fold',
          fields: ['个人', '团队', '部门'],
          key: 'user',
          value: 'score'
        })
 
        this.radarData = dv.rows
        this.radarLoading = false
      })
    }
  }
}
</script>
 
<style lang="less" scoped>
@import './Workplace.less';
 
.greens {
  color: #52c41a !important;
}
 
.reds {
  color: #f5222d !important;
}
 
.project-list {
  .card-title {
    font-size: 0;
 
    a {
      color: rgba(0, 0, 0, 0.85);
      // margin-left: 12px;
      line-height: 24px;
      height: 24px;
      display: inline-block;
      vertical-align: top;
      font-size: 16px;
      font-weight: 600;
 
      &:hover {
        color: #1890ff;
      }
    }
  }
 
  .card-description {
    color: rgba(0, 0, 0, 0.45);
    height: 44px;
    line-height: 22px;
    overflow: hidden;
    // font-size: 20px;
    // font-weight: 600;
  }
 
  .project-item {
    display: flex;
    margin-top: 8px;
    overflow: hidden;
    font-size: 12px;
    height: 20px;
    line-height: 20px;
 
    a {
      color: rgba(0, 0, 0, 0.45);
      display: inline-block;
      flex: 1 1 0;
      font-size: 14px;
      letter-spacing: 1px;
 
      &:hover {
        color: #1890ff;
      }
    }
 
    .datetime {
      color: rgba(0, 0, 0, 0.25);
      flex: 0 0 auto;
      float: right;
      font-size: 14px;
      letter-spacing: 1px;
    }
  }
 
  .ant-card-meta-description {
    color: rgba(0, 0, 0, 0.45);
    height: 44px;
    line-height: 22px;
    overflow: hidden;
  }
}
 
.item-group {
  padding: 20px 0 8px 24px;
  font-size: 0;
 
  a {
    color: rgba(0, 0, 0, 0.65);
    display: inline-block;
    font-size: 14px;
    margin-bottom: 13px;
    width: 25%;
  }
}
 
.members {
  a {
    display: block;
    margin: 12px 0;
    line-height: 24px;
    height: 24px;
 
    .member {
      font-size: 14px;
      color: rgba(0, 0, 0, 0.65);
      line-height: 24px;
      max-width: 100px;
      vertical-align: top;
      margin-left: 12px;
      transition: all 0.3s;
      display: inline-block;
    }
 
    &:hover {
      span {
        color: #1890ff;
      }
    }
  }
}
 
.mobile {
  .project-list {
    .project-card-grid {
      width: 100%;
    }
  }
 
  .more-info {
    border: 0;
    padding-top: 16px;
    margin: 16px 0 16px;
  }
 
  .headerContent .title .welcome-text {
    display: none;
  }
}
</style>