This commit is contained in:
simple321vip
2026-06-04 21:34:58 +08:00
parent f501c6041b
commit bef1906747
82 changed files with 257 additions and 7 deletions
+1
View File
@@ -0,0 +1 @@
# AGENT.md
+1 -1
View File
@@ -1,4 +1,4 @@
FROM nginx:1.23.1-alpine
FROM ccr.ccs.tencentyun.com/violin/nginx:latest
COPY dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
+3 -3
View File
@@ -6,13 +6,13 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>violin-home</title>
<script type="module" crossorigin src="/assets/index.e20aada4.js"></script>
<link rel="stylesheet" href="/assets/index.35a0e576.css">
<script type="module" crossorigin src="/resets/index.e20aada4.js"></script>
<link rel="stylesheet" href="/resets/index.35a0e576.css">
</head>
<body>
<div id="app"></div>
</body>
</html>

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Before

Width:  |  Height:  |  Size: 410 KiB

After

Width:  |  Height:  |  Size: 410 KiB

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

+1 -1
View File
@@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>violin-home</title>
<title>个人知识记录</title>
</head>
<body>
+57
View File
@@ -0,0 +1,57 @@
import { MockMethod } from 'vite-plugin-mock'
export default [
{
url: '/traderCalender/api/v1/trader/calender/year/2024',
method: 'get',
response: ({ body, query }) => {
return [
{
month: 4,
month_beginning_balance: 132947.59,
offset_gain_and_loss: 0,
mark_to_market: 5300,
commission: 0,
deposit_and_withdrawal: 0,
month_end_balance: 138247.59,
},
{
month: 5,
month_beginning_balance: 138247.59,
offset_gain_and_loss: 5080,
mark_to_market: 1960,
commission: 108,
deposit_and_withdrawal: 10000,
month_end_balance: 135179.59,
},
{
month: 6,
month_beginning_balance: 135179.59,
offset_gain_and_loss: -2830,
mark_to_market: -2920,
commission: 32,
deposit_and_withdrawal: 10000,
month_end_balance: 119397.59,
},
{
month: 7,
month_beginning_balance: 119397.59,
offset_gain_and_loss: 0,
mark_to_market: -5640,
commission: 16,
deposit_and_withdrawal: 0,
month_end_balance: 113741.59,
},
{
month: 8,
month_beginning_balance: 113741.59,
offset_gain_and_loss: -2480,
mark_to_market: -4150,
commission: 24,
deposit_and_withdrawal: 1000,
month_end_balance: 106087.59,
},
]
}
},
] as MockMethod[]
+25
View File
@@ -0,0 +1,25 @@
import { service } from '../utils/request'
const headers = {
'Content-Type': 'application/json;charsetset=UTF-8'
}
// To obtain the monthly data by year
const get_monthly_data = (year: string) => {
return service({
url: '/traderCalender/api/v1/trader/calender/year/' + year,
method: 'GET',
headers: headers,
})
}
// To update the monthly data by year
// const update_monthly_data = (data: object) => {
// return service({
// url: '/traderCalender/api/v1/trader/calender/year/' + year,
// method: 'POST',
// data: data
// })
// }
export { get_monthly_data }
+7 -1
View File
@@ -44,7 +44,12 @@ router.beforeEach((to, from, next) => {
next()
}
} else {
if (url.search("register") != -1) {
if (to.path == "/register") {
next()
return
}
if (url.search("registerFrom") != -1) {
let arr = url.split('?')
let parameters = arr[1].split('&')
let query_data: { [key: string]: any } = {}
@@ -56,6 +61,7 @@ router.beforeEach((to, from, next) => {
path: '/register',
query: query_data
})
return
}
if (url.search("/home/") != -1) {
let arr = url.split('?')
+7
View File
@@ -57,6 +57,13 @@ const routes: Array<RouteRecordRaw> = [
name: '市场行情'
}
},
{
path: '/traderCalender',
component: () => import('@/view/traderCalender/index.vue'),
meta: {
name: '交易日历'
}
},
{
path: '/capital',
component: () => import('@/view/capital/index.vue'),
+11 -1
View File
@@ -9,7 +9,17 @@ const addZero = (num: number) => {
return '0' + num
}
const ToString = (value: number) => {
return value.toLocaleString()
}
const GetSum = (obj: object, ...props: any[]) => {
return props.filter(prop => prop in obj).reduce((accumulator, currentValue) => accumulator + currentValue, 0)
}
export {
toPercent,
addZero
addZero,
ToString,
GetSum
}
+144
View File
@@ -0,0 +1,144 @@
<template>
<el-form :model="form" label-width="30px">
<el-form-item>
<el-select v-model="form.balance_type" :placeholder="balanceTypes[0].balance_type_Name">
<el-option v-for="item in balanceTypes" :key="item.balance_type" :label="item.balance_type_Name"
:value="item.balance_type" />
</el-select>
<!-- <el-select v-model="form.btId" placeholder="选择分类">
<el-option v-for="item in btNameList " :key="item.btId"
:label="item.btNa me"
:value=" item.btId " />
</el-select> -->
<el-col :span="6" style="text-align: center;">
<el-button type="primary" @click="onSearch">搜索</el-button>
</el-col>
</el-form-item>
</el-form>
<el-table :data="data_list" style="width: 100%">
<el-table-column type="selection" width="55" />
<el-table-column prop="month" label="交易月" width="80" />
<el-table-column v-for="column in columns" :prop="column.prop" :label="column.label" :width="column.width">
<template #default="scope">
<el-input type="text" v-model="scope.row[column.prop]" :formatter="ToString(scope.row[column.prop])"
@change="onTextChange(scope.row[column.prop], column.prop, scope.$index)" />
</template>
</el-table-column>
<el-table-column prop="month_end_balance" label="月末结存" width="150">
</el-table-column>
<el-table-column label="操作">
<template #default="scope">
<!-- <el-button size="small" type="danger" @click="handleDelete(scope.$i ndex, scope.row)"
v-show="useTenantStore.tenant.account">
删除
</el-button> -->
</template>
</el-table-column>
</el-table>
<!-- <div class="page_style">
<el-pagination small background layout="prev, pager, next" :total="50" class ="mt-4" />
</div> -->
</template>
<script setup lang="ts">
import Cookies from 'js-cookie'
import { ref, reactive, watch } from 'vue'
import { get_monthly_data } from '../../api/traderCalender'
import { ToString, GetSum } from '../../utils/number'
import router from '../../router/index'
// -- INTERFACE OR TYPE DEFINITION --
interface MonthlyBalance {
month: number // 结算月
month_beginning_balance: number // 月初结存
offset_gain_and_loss: number // 平仓损益
mark_to_market: number // 盯市损益
commission: number // 手续费
deposit_and_withdrawal: number // 出入金
month_end_balance: number // 月末结存
}
interface BalanceType {
balance_type: number // 结算类型:12
balance_type_Name: string // 结算年,结算月
}
// -- REACTIVE OBJECT --
const form = reactive({
balance_type: '',
year: '',
month: '',
})
const data_list = reactive<MonthlyBalance[]>([])
const balanceTypes = ref<BalanceType[]>([
{ balance_type: 1, balance_type_Name: "结算年" },
{ balance_type: 2, balance_type_Name: "结算月" }
])
const columns = ref([
{ prop: 'month_beginning_balance', label: '月初结存', width: '150' },
{ prop: 'offset_gain_and_loss', label: '平仓损益', width: '150' },
{ prop: 'mark_to_market', label: '盯市损益', width: '150' },
{ prop: 'commission', label: '手续费', width: '150' },
{ prop: 'deposit_and_withdrawal', label: '出入金', width: '150' },
])
// -- EVENT DEFINITION --
const onSearch = () => {
get_monthly_data("2024").then(response => {
data_list.splice(0, data_list.length);
console.log(response)
response.data.forEach((item: MonthlyBalance) => {
data_list.push(item)
})
})
}
// const onCommit = () => {
// update_monthly_data(data).then(response => {
// data_list.splice(0, data_list.length);
// console.log(response)
// response.data.forEach((item: MonthlyBalance) => {
// data_list.push(item)
// })
// })
// }
const onTextChange = (value: number, prop: string, index: number) => {
// 输入校验
let monthlyBalance = data_list[index]
console.log(monthlyBalance[prop])
if (Number.isNaN(monthlyBalance[prop])) {
console.log(1)
return
}
monthlyBalance.month_end_balance = Number(monthlyBalance.month_beginning_balance) + Number(monthlyBalance.offset_gain_and_loss)
+ Number(monthlyBalance.mark_to_market) - Number(monthlyBalance.commission) - Number(monthlyBalance.deposit_and_withdrawal)
if (Number.isNaN(monthlyBalance.month_end_balance)) {
console.log(2)
return
}
}
</script>
<style>
.blog_list {
display: flex;
flex-direction: column;
border-bottom: 1px solid rgba(151, 151, 151, 0.3);
padding-top: 10px;
padding-bottom: 10px;
}
.page_style {
margin-top: 25px;
display: flex;
flex-direction: column;
align-items: center;
}
</style>