From 215823d4a764d87b3e4c13767f748e61f06aebfc Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期六, 07 五月 2022 12:11:15 +0800
Subject: [PATCH] add sub user reset
---
src/views/hashrate/HashManage/components/SettingBox.vue | 138 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 126 insertions(+), 12 deletions(-)
diff --git a/src/views/hashrate/HashManage/components/SettingBox.vue b/src/views/hashrate/HashManage/components/SettingBox.vue
index e418ea5..30c3955 100644
--- a/src/views/hashrate/HashManage/components/SettingBox.vue
+++ b/src/views/hashrate/HashManage/components/SettingBox.vue
@@ -5,17 +5,19 @@
<div class="settingBody">
<div class="settingItem">
<div class="label">鎬荤畻鍔�:</div>
- <div class="data">2閫氶亾</div>
- <div class="label">鎬荤畻鍔�:</div>
- <div class="data">2閫氶亾</div>
+ <div class="data">{{ total }}閫氶亾</div>
+ <div class="label">瀹炴椂绠楀姏:</div>
+ <div class="data">{{ realTime.total }}閫氶亾</div>
</div>
<div class="settingItem">
<div class="label">杞鏃堕棿:</div>
<el-input-number
class="time"
- v-model="time"
+ v-model="formdata.poll_period"
:controls="false"
+ :min="0"
+ :max="60 * 24 * 1"
></el-input-number
>鍒嗛挓
</div>
@@ -23,7 +25,7 @@
<div class="settingItem">
<div class="label">杞寮�鍏�:</div>
<el-switch
- v-model="pollingSwitch"
+ v-model="formdata.enable"
active-color="#D4E3FA"
inactive-color="#E9EBEE"
:width="56"
@@ -32,26 +34,32 @@
</div>
<div class="settingItem">
- <div class="label">杞鏃堕棿:</div>
+ <div class="label">杞绠楀姏:</div>
<el-input-number
- v-model="time"
+ v-model="formdata.pollChannelCount"
controls-position="right"
+ :max="limit"
+ :min="0"
+ @change="changePoll"
></el-input-number
>鍒嗛挓
</div>
<div class="settingItem">
- <div class="label">杞鏃堕棿:</div>
+ <div class="label">鏁版嵁鏍堢畻鍔�:</div>
<el-input-number
- v-model="time"
+ v-model="stack.total"
controls-position="right"
+ :max="limit"
+ :min="0"
+ @change="changeStack"
></el-input-number
>鍒嗛挓
</div>
<div class="btns">
<div class="cancel button" @click="close()">鍙栨秷</div>
- <div class="submit button" @click="close()">淇濆瓨</div>
+ <div class="submit button" @click="save()">淇濆瓨</div>
</div>
</div>
@@ -60,16 +68,121 @@
</template>
<script>
+import {
+ getPollConfig,
+ deviceStatisticRunInfo,
+ savePollConfig,
+} from "@/api/clusterManage";
export default {
+ props: {
+ id: {},
+ },
data() {
return {
- time: 0,
- pollingSwitch: false,
+ realTime: {},
+ total: "",
+ polling: {},
+ stack: {},
+ formdata: {
+ deviceId: "",
+ delay: 10,
+ enable: true,
+ pollChannelCount: 0,
+ poll_period: 0,
+ videoChannelCount: 0,
+ },
+ stackChannel: 0,
+ limit: 100,
};
},
+ created() {
+ this.getFormData();
+ this.chooseDevice();
+ },
+
methods: {
+ async getFormData() {
+ const res = await getPollConfig({ deviceId: this.id });
+ this.formdata.deviceId = this.id;
+ this.formdata.enable = res.data.enable;
+ this.formdata.poll_period = res.data.poll_period;
+ this.formdata.pollChannelCount = res.data.pollChannelCount;
+ this.$set(this.formdata, "pollChannelCount", res.data.pollChannelCount);
+ this.$forceUpdate();
+ },
+ async chooseDevice() {
+ const res1 = await deviceStatisticRunInfo({ deviceId: [this.id] });
+ if (res1 && res1.success) {
+ this.total = res1.data.channelTotal;
+ this.realTime = {
+ total: res1.data.realValidCount,
+ valid: res1.data.realTotal,
+ invalid: res1.data.realInvalidCount,
+ run: res1.data.realRunningCount,
+ noDeal:
+ res1.data.realTotal -
+ res1.data.realRunningCount -
+ res1.data.realInvalidCount,
+ };
+ this.polling = {
+ valid: res1.data.pollTotal,
+ total: res1.data.pollChannelCount,
+ invalid: res1.data.pollInvalidCount,
+ run: res1.data.pollRunningCount,
+ noDeal:
+ res1.data.pollTotal -
+ res1.data.pollRunningCount -
+ res1.data.pollInvalidCount,
+ };
+
+ this.stack = {
+ total: res1.data.stackChannelCount,
+ valid: res1.data.stackTotal,
+ invalid: res1.data.stackInvalidCount,
+ run: res1.data.stackRunningCount,
+ noDeal:
+ res1.data.stackTotal -
+ res1.data.stackInvalidCount -
+ res1.data.stackRunningCount,
+ };
+
+ this.limit = this.total - this.realTime.total;
+
+ this.$forceUpdate();
+ }
+ },
close() {
this.$emit("close");
+ },
+ //鐩戝惉杞绠楀姏
+ changePoll(newVal, oldVal) {
+ if (newVal > oldVal) {
+ this.stack.total--;
+ }
+ if (newVal < oldVal) {
+ this.stack.total++;
+ }
+ this.$forceUpdate();
+ },
+ //鐩戝惉鏁版嵁鏍堢畻鍔�
+ changeStack(newVal, oldVal) {
+ if (newVal > oldVal) {
+ this.formdata.pollChannelCount--;
+ }
+ if (newVal < oldVal) {
+ this.formdata.pollChannelCount++;
+ }
+ },
+ async save() {
+ this.formdata.videoChannelCount = this.stack.total;
+ const res = await savePollConfig(this.formdata);
+ if (res && res.success) {
+ this.$notify({
+ type: "success",
+ message: "淇濆瓨鎴愬姛",
+ });
+ }
+ this.close();
},
},
};
@@ -142,6 +255,7 @@
width: 64px;
height: 32px;
border-radius: 0;
+ padding: 0 0;
}
.el-input-number__decrease {
--
Gitblit v1.8.0