Browse Source

正式环境测试环境切换

master
0.0 3 years ago
parent
commit
a04f553e95
  1. 8
      src/api/system/collect.js
  2. 161
      src/views/collect/index.vue
  3. 406
      src/views/contract/index.vue

8
src/api/system/collect.js

@ -43,10 +43,14 @@ export function delConfig(id) {
})
}
// 状态修改
export function changeUserStatus(id, status) {
export function changeUserStatus(row) {
let id =row.id;
let status=row.status;
let environment=row.environment;
const data = {
id,
status
status,
environment
}
return request({
url: '/conflux/collect/changeStatus',

161
src/views/collect/index.vue

@ -1,56 +1,56 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="78px">
<el-form-item label="node" prop="node">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="" prop="node">
<el-input
v-model="queryParams.node"
placeholder="请输入node"
placeholder="请输入"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="limit_count" prop="limitCount">
<el-form-item label="" prop="limitCount">
<el-input
v-model="queryParams.limitCount"
placeholder="请输入limit_count"
placeholder="请输入"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="chain_id" prop="chainId">
<el-form-item label="" prop="chainId">
<el-input
v-model="queryParams.chainId"
placeholder="请输入chain_id"
placeholder="请输入"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="epoch_number" prop="epochNumber">
<el-form-item label="" prop="epochNumber">
<el-input
v-model="queryParams.epochNumber"
placeholder="请输入epoch_number"
placeholder="请输入"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="on_pause" prop="onPause">
<el-form-item label="" prop="onPause">
<el-input
v-model="queryParams.onPause"
placeholder="请输入on_pause"
placeholder="请输入"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="mint_pause" prop="mintPause">
<el-form-item label="" prop="mintPause">
<el-input
v-model="queryParams.mintPause"
placeholder="请输入mint_pause"
placeholder="请输入"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-form-item label="状态0正常1禁用" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态0正常1禁用" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
@ -59,6 +59,16 @@
/>
</el-select>
</el-form-item>
<el-form-item label="0正式环境1测试环境" prop="environment">
<el-select v-model="queryParams.environment" placeholder="请选择0正式环境1测试环境" clearable>
<el-option
v-for="dict in dict.type.sys_system_switch"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -88,7 +98,7 @@
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
<!-- <el-button
type="danger"
plain
icon="el-icon-delete"
@ -96,7 +106,7 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:config:remove']"
>删除</el-button>
>删除</el-button>-->
</el-col>
<el-col :span="1.5">
<el-button
@ -115,9 +125,9 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="node" align="center" prop="node" />
<el-table-column label="limit_count" align="center" prop="limitCount" />
<el-table-column label="chain_id" align="center" prop="chainId" />
<el-table-column label="epoch_number" align="center" prop="epochNumber" />
<el-table-column label="limitCount" align="center" prop="limitCount" />
<el-table-column label="chainId" align="center" prop="chainId" />
<el-table-column label="epochNumber" align="center" prop="epochNumber" />
<el-table-column label="on_pause" align="center" prop="onPause">
<template slot-scope="scope">
{{scope.row.onPause}}
@ -139,6 +149,11 @@
></el-switch>
</template>
</el-table-column>
<el-table-column label="环境" align="center" prop="environment">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_system_switch" :value="scope.row.environment"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -148,13 +163,13 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']"
>修改</el-button>
<el-button
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:config:remove']"
>删除</el-button>
>删除</el-button>-->
</template>
</el-table-column>
</el-table>
@ -169,45 +184,42 @@
<!-- 添加或修改conflux对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-form-item label="node" prop="node">
<el-input v-model="form.node" placeholder="请输入node" />
<el-input v-model="form.node" placeholder="请输入" />
</el-form-item>
<el-form-item label="limitCount" prop="limitCount">
<el-input v-model="form.limitCount" placeholder="请输入" />
</el-form-item>
<el-form-item label="chainId" prop="chainId">
<el-input v-model="form.chainId" placeholder="请输入" />
</el-form-item>
<el-form-item label="limit_count" prop="limitCount">
<el-input v-model="form.limitCount" placeholder="请输入limit_count" />
<el-form-item label="epochNumber" prop="epochNumber">
<el-input v-model="form.epochNumber" placeholder="请输入" />
</el-form-item>
<el-form-item label="chain_id" prop="chainId">
<el-input v-model="form.chainId" placeholder="请输入chain_id" />
<el-form-item label="onPause" prop="onPause">
<el-input v-model="form.onPause" placeholder="请输入" />
</el-form-item>
<el-form-item label="epoch_number" prop="epochNumber">
<el-input v-model="form.epochNumber" placeholder="请输入epoch_number" />
<el-form-item label="mintPause" prop="mintPause">
<el-input v-model="form.mintPause" placeholder="请输入" />
</el-form-item>
<el-form-item label="on_pause" prop="onChainStatus" >
<el-select v-model="form.onPause" clearable placeholder="on_pause"
size="small"
@keyup.enter.native="handleQuery"
>
<el-option
v-for="item in options"
:key="item.value"
:value="item.value">
</el-option>
</el-select>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="mint_pause" prop="mintPause">-->
<!-- <el-input v-model="form.mintPause" placeholder="请输入mint_pause" />-->
<!-- </el-form-item>-->
<el-form-item label="mint_pause" prop="mintPause" >
<el-select v-model="form.mintPause" clearable placeholder="mint_pause"
size="small"
@keyup.enter.native="handleQuery"
>
<el-option
v-for="item in options"
:key="item.value"
:value="item.value">
</el-option>
</el-select>
<el-form-item label="环境">
<el-radio-group v-model="form.environment">
<el-radio
v-for="dict in dict.type.sys_system_switch"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -220,9 +232,10 @@
<script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig ,changeUserStatus} from "@/api/system/collect";
export default {
name: "Config",
dicts: ['sys_job_group', 'sys_job_status'],
dicts: ['sys_normal_disable', 'sys_system_switch'],
data() {
return {
//
@ -253,14 +266,9 @@ export default {
epochNumber: null,
onPause: null,
mintPause: null,
status: null
status: null,
environment: null
},
options: [{
value: false
}, {
value: true
}
],
//
form: {},
//
@ -298,22 +306,11 @@ export default {
mintPause: null,
createTime: null,
updateTime: null,
status: "0"
status: "0",
environment: "0"
};
this.resetForm("form");
},
handleStatusChange(row) {
console.log("------------->"+row)
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '"用户吗?').then(function() {
return changeUserStatus(row.id, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
this.getList();
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -324,6 +321,18 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
handleStatusChange(row) {
console.log("------------->"+row)
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '"吗?').then(function() {
return changeUserStatus(row);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
this.getList();
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)

406
src/views/contract/index.vue

@ -1,6 +1,14 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目名称" prop="unitName">
<el-input
v-model="queryParams.unitName"
placeholder="请输入项目名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="合约地址" prop="contract">
<el-input
v-model="queryParams.contract"
@ -17,6 +25,14 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="燃气值" prop="gasPrice">
<el-input
v-model="queryParams.gasPrice"
placeholder="请输入燃气值"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="私钥" prop="privateKey">
<el-input
v-model="queryParams.privateKey"
@ -25,6 +41,42 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单次阀值" prop="threshold">
<el-input
v-model="queryParams.threshold"
placeholder="请输入单次阀值"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="总阀值" prop="totalThreshold">
<el-input
v-model="queryParams.totalThreshold"
placeholder="请输入总阀值"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="环境" prop="environment">
<el-select v-model="queryParams.environment" placeholder="请选择环境" clearable>
<el-option
v-for="dict in dict.type.sys_system_switch"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -40,8 +92,7 @@
size="mini"
@click="handleAdd"
v-hasPermi="['system:config:add']"
>新增
</el-button>
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -52,8 +103,7 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:config:edit']"
>修改
</el-button>
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -64,8 +114,7 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:config:remove']"
>删除
</el-button>
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -75,22 +124,31 @@
size="mini"
@click="handleExport"
v-hasPermi="['system:config:export']"
>导出
</el-button>
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="id" align="center" prop="id"/>
<el-table-column label="项目名称" align="center" prop="unitName"/>
<el-table-column label="合约地址" align="center" prop="contract"/>
<el-table-column label="拥有者" align="center" prop="owner"/>
<el-table-column label="私钥" align="center" prop="privateKey"/>
<el-table-column label="单次阀值" align="center" prop="threshold"/>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="" align="center" prop="id" />
<el-table-column label="项目名称" align="center" prop="unitName" />
<el-table-column label="合约地址" align="center" prop="contract" />
<el-table-column label="拥有者" align="center" prop="owner" />
<el-table-column label="燃气值" align="center" prop="gasPrice" />
<el-table-column label="私钥" align="center" prop="privateKey" />
<el-table-column label="单次阀值" align="center" prop="threshold" />
<el-table-column label="总阀值" align="center" prop="totalThreshold" />
<el-table-column label="燃气值" align="center" prop="gasPrice"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="环境" align="center" prop="environment">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_system_switch" :value="scope.row.environment"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -99,16 +157,14 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']"
>修改
</el-button>
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:config:remove']"
>删除
</el-button>
>删除</el-button>
</template>
</el-table-column>
</el-table>
@ -124,26 +180,35 @@
<!-- 添加或修改合约私钥配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目名称" prop="contract">
<el-input v-model="form.unitName" placeholder="请输入项目名称"/>
<el-form-item label="项目名称" prop="unitName">
<el-input v-model="form.unitName" placeholder="请输入项目名称" />
</el-form-item>
<el-form-item label="合约地址" prop="contract">
<el-input v-model="form.contract" placeholder="请输入合约地址"/>
<el-input v-model="form.contract" placeholder="请输入合约地址" />
</el-form-item>
<el-form-item label="拥有者" prop="owner">
<el-input v-model="form.owner" placeholder="请输入拥有者"/>
<el-input v-model="form.owner" placeholder="请输入拥有者" />
</el-form-item>
<el-form-item label="燃气值" prop="gasPrice">
<el-input v-model="form.gasPrice" placeholder="请输入燃气值" />
</el-form-item>
<el-form-item label="私钥" prop="privateKey">
<el-input v-model="form.privateKey" placeholder="请输入私钥"/>
<el-input v-model="form.privateKey" placeholder="请输入私钥" />
</el-form-item>
<el-form-item label="单次阀值" prop="threshold">
<el-input v-model="form.threshold" placeholder="请输入限制阀值"/>
<el-input v-model="form.threshold" placeholder="请输入单次阀值" />
</el-form-item>
<el-form-item label="总阀值" prop="totalThreshold">
<el-input v-model="form.totalThreshold" placeholder="请输入上链的总阀值" />
<el-input v-model="form.totalThreshold" placeholder="请输入总阀值" />
</el-form-item>
<el-form-item label="燃气值" prop="privateKey">
<el-input v-model="form.gasPrice" placeholder="请输入私钥"/>
<el-form-item label="环境">
<el-radio-group v-model="form.environment">
<el-radio
v-for="dict in dict.type.sys_system_switch"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -155,151 +220,156 @@
</template>
<script>
import {listConfig, getConfig, delConfig, addConfig, updateConfig} from "@/api/system/contract";
import { listConfig, getConfig, delConfig, addConfig, updateConfig } from "@/api/system/contract";
export default {
name: "Config",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
configList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
unitName: null,
contract: null,
owner: null,
gasPrice: null,
privateKey: null,
threshold: null,
totalThreshold: null,
},
//
form: {},
//
rules: {}
export default {
name: "Config",
dicts: ['sys_normal_disable', 'sys_system_switch'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
configList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
unitName: null,
contract: null,
owner: null,
gasPrice: null,
privateKey: null,
threshold: null,
totalThreshold: null,
status: null,
environment: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询合约私钥配置列表 */
getList() {
this.loading = true;
listConfig(this.queryParams).then(response => {
this.configList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
unitName: null,
contract: null,
owner: null,
gasPrice: null,
privateKey: null,
threshold: null,
totalThreshold: null,
createTime: null,
updateTime: null,
status: "0",
environment: "0"
};
this.resetForm("form");
},
created() {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
methods: {
/** 查询合约私钥配置列表 */
getList() {
this.loading = true;
listConfig(this.queryParams).then(response => {
this.configList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
unitName: null,
contract: null,
owner: null,
gasPrice: null,
privateKey: null,
threshold: null,
totalThreshold: null,
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加合约私钥配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getConfig(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "添加合约私钥配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getConfig(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改合约私钥配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
this.title = "修改合约私钥配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除合约私钥配置编号为"' + ids + '"的数据项?').then(function () {
return delConfig(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/config/export', {
...this.queryParams
}, `config_${new Date().getTime()}.xlsx`)
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除合约私钥配置编号为"' + ids + '"的数据项?').then(function() {
return delConfig(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/config/export', {
...this.queryParams
}, `config_${new Date().getTime()}.xlsx`)
}
};
}
};
</script>

Loading…
Cancel
Save