需求更改开发中

This commit is contained in:
2025-10-20 10:15:13 +08:00
parent d1b3357a8e
commit a60603acd0
30 changed files with 2863 additions and 704 deletions

View File

@@ -79,8 +79,14 @@
<el-table-column prop="user" label="挖矿账户" min-width="80" />
<el-table-column prop="id" label="矿机ID" min-width="60" />
<el-table-column prop="miner" label="机器编号" min-width="100" />
<el-table-column label="实算力">
<template #default="scope">{{ scope.row.computingPower }} {{ scope.row.unit || '' }}</template>
<el-table-column label="实算力" width="100">
<template slot="header">
<el-tooltip content="实际算力为该机器在本矿池过去24H的平均算力" effect="dark" placement="top">
<i class="el-icon-question label-help" aria-label="帮助" tabindex="0"></i>
</el-tooltip>
<span>实际算力</span>
</template>
<template slot-scope="scope">{{ scope.row.computingPower }} {{ scope.row.unit || '' }}</template>
</el-table-column>
<el-table-column label="理论算力" min-width="140">
<template #default="scope">
@@ -128,8 +134,20 @@
/>
</template>
</el-table-column>
<el-table-column label="价(USDT)" min-width="140">
<template #default="scope">
<el-table-column label="价(USDT)" min-width="140">
<template slot="header">
<el-tooltip effect="dark" placement="top">
<div slot="content">
卖家最终收款金额 = 机器售价 × 波动率<br/>
波动率规则<br/>
10% - 5%包含5%波动率 = 1按售价结算<br/>
25%以上波动率 = 实际算力 / 理论算力且不会超过 1,即最终结算时不会超过机器售价
</div>
<i class="el-icon-question label-help" aria-label="帮助" tabindex="0"></i>
</el-tooltip>
<span>售价(USDT)</span>
</template>
<template slot-scope="scope">
<el-input
v-model="scope.row.price"
size="small"
@@ -144,6 +162,22 @@
</el-input>
</template>
</el-table-column>
<el-table-column label="最大租赁天数(天)" min-width="140">
<template #default="scope">
<el-input
v-model="scope.row.maxLeaseDays"
size="small"
inputmode="numeric"
:disabled="isRowDisabled(scope.row)"
@input="handleMaxLeaseDaysInput(scope.$index)"
@blur="handleMaxLeaseDaysBlur(scope.$index)"
:class="{ 'changed-input': isCellChanged(scope.row, 'maxLeaseDays') }"
style="max-width: 260px;"
>
<template slot="append"></template>
</el-input>
</template>
</el-table-column>
<el-table-column label="上下架" min-width="140">
<template #default="scope">
<el-switch
@@ -309,6 +343,7 @@ export default {
powerDissipation: String(row.powerDissipation ?? ''),
type: String(row.type ?? ''),
price: String(row.price ?? ''),
maxLeaseDays: String(row.maxLeaseDays ?? ''),
}
}
this.fieldSnapshot = snapshot
@@ -443,6 +478,30 @@ export default {
this.$set(this.machineList, index, row)
}
},
handleMaxLeaseDaysInput(index) {
const rowItem = this.machineList && this.machineList[index]
if (!rowItem || this.isRowDisabled(rowItem)) return
let v = String(this.machineList[index].maxLeaseDays ?? '')
v = v.replace(/\D/g, '')
if (v.length > 3) v = v.slice(0, 3)
const row = { ...this.machineList[index], maxLeaseDays: v }
this.$set(this.machineList, index, row)
},
handleMaxLeaseDaysBlur(index) {
const raw = String(this.machineList[index].maxLeaseDays ?? '')
if (!/^\d{1,3}$/.test(raw)) {
this.$message.warning('最大租赁天数需为 1-365 的整数')
const row = { ...this.machineList[index], maxLeaseDays: '' }
this.$set(this.machineList, index, row)
return
}
const n = Number(raw)
if (!Number.isInteger(n) || n < 1 || n > 365) {
this.$message.warning('最大租赁天数需为 1-365 的整数')
const row = { ...this.machineList[index], maxLeaseDays: '' }
this.$set(this.machineList, index, row)
}
},
handleTheoryPowerBlur(index) {
const raw = String(this.machineList[index].theoryPower ?? '')
const pattern = /^\d{1,6}(\.\d{1,4})?$/
@@ -511,6 +570,7 @@ export default {
const priceRaw = String(row.price ?? '')
const typeRaw = String(row.type ?? '')
const dissRaw = String(row.powerDissipation ?? '')
const daysRaw = String(row.maxLeaseDays ?? '')
if (!theoryRaw || Number(theoryRaw) <= 0 || !powerPattern.test(theoryRaw)) {
this.$message.warning(`${i + 1}行(机器:${rowLabel}) 理论算力必须大于0整数最多6位小数最多4位`)
@@ -524,6 +584,10 @@ export default {
this.$message.warning(`${i + 1}行(机器:${rowLabel}) 单价必须大于0整数最多12位小数最多2位`)
return
}
if (!/^\d{1,3}$/.test(daysRaw) || !Number.isInteger(Number(daysRaw)) || Number(daysRaw) < 1 || Number(daysRaw) > 365) {
this.$message.warning(`${i + 1}行(机器:${rowLabel}) 最大租赁天数需为 1-365 的整数`)
return
}
// 型号允许为空,但如果填写则不能全空格
if (typeRaw && isOnlySpaces(typeRaw)) {
this.$message.warning(`${i + 1}行(机器:${rowLabel}) 型号不能全是空格`)
@@ -538,6 +602,7 @@ export default {
state: Number(m.state ?? 0),
theoryPower: Number(m.theoryPower ?? 0),
type: m.type || '',
maxLeaseDays: Number(m.maxLeaseDays ?? 0),
unit: m.unit || ''
}))
@@ -575,6 +640,8 @@ export default {
.split { width: 8px; }
.empty-text { color: #909399; text-align: center; padding: 12px 0; }
.label-help { margin-left: 4px; color: #909399; cursor: help; }
</style>
<style>
@@ -587,5 +654,13 @@ export default {
.changed-input input.el-input__inner {
border-color: #f56c6c !important;
}
.el-input.is-disabled .el-input__inner{
color: #000 !important;
}
.el-textarea.is-disabled .el-textarea__inner{
color: #000 !important;
}
</style>