|
@@ -1,19 +1,32 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<div>
|
|
|
- <el-form ref="form" :model="activationCode" :rules="rulesActivationCode" label-width="80px">
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :model="activationCode"
|
|
|
+ :rules="rulesActivationCode"
|
|
|
+ label-width="80px"
|
|
|
+ >
|
|
|
<el-form-item label="租户信息" prop="tenantCode">
|
|
|
<el-select v-model="activationCode.tenantCode" placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="item in tenantList"
|
|
|
:key="item.tenantId"
|
|
|
:label="item.tenantName"
|
|
|
- :value="item.tenantId">
|
|
|
+ :value="item.tenantId"
|
|
|
+ >
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="充值时间" prop="tenantExpirationDate" style="width: 300px">
|
|
|
- <el-input v-model="activationCode.tenantExpirationDate" placeholder="请输入充值天数"></el-input>
|
|
|
+ <el-form-item
|
|
|
+ label="充值时间"
|
|
|
+ prop="tenantExpirationDate"
|
|
|
+ style="width: 300px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="activationCode.tenantExpirationDate"
|
|
|
+ placeholder="请输入充值天数"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -21,16 +34,22 @@
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
<!-- 激活码生成成功-->
|
|
|
- <el-dialog :title="title" :visible.sync="activationCodeForm" width="500px" append-to-body>
|
|
|
+ <el-dialog
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="activationCodeForm"
|
|
|
+ width="500px"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
<span v-html="actCode"></span>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="copyToClipboard">一键复制</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="copyToClipboard"
|
|
|
+ >一键复制</el-button
|
|
|
+ >
|
|
|
+ <el-button @click="activationCodeForm = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
<div style="margin-top: 30px">
|
|
|
-
|
|
|
<!--搜索条件表单-->
|
|
|
<el-form
|
|
|
:model="queryParams"
|
|
@@ -45,7 +64,7 @@
|
|
|
v-model="queryParams.ipAddress"
|
|
|
placeholder="请输入登录地址"
|
|
|
clearable
|
|
|
- style="width: 240px;"
|
|
|
+ style="width: 240px"
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -77,10 +96,10 @@
|
|
|
icon="el-icon-search"
|
|
|
size="mini"
|
|
|
@click="handleQuery"
|
|
|
- >搜索</el-button
|
|
|
+ >搜索</el-button
|
|
|
>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
- >重置</el-button
|
|
|
+ >重置</el-button
|
|
|
>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -95,7 +114,6 @@
|
|
|
@sort-change="handleSortChange"
|
|
|
style="margin-top: 20px"
|
|
|
>
|
|
|
-
|
|
|
<el-table-column type="selection" width="50" align="center" />
|
|
|
<el-table-column label="日志编号" align="center" prop="logId" />
|
|
|
<el-table-column label="操作人员" align="center" prop="operator" />
|
|
@@ -132,66 +150,65 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { listTenant, createTenantCode } from "@/api/system/tenant";
|
|
|
import {
|
|
|
- listTenant,
|
|
|
- createTenantCode
|
|
|
-} from "@/api/system/tenant";
|
|
|
-import {list, delActivationLog, cleanActivationLog} from "@/api/monitor/activationcode";
|
|
|
+ list,
|
|
|
+ delActivationLog,
|
|
|
+ cleanActivationLog,
|
|
|
+} from "@/api/monitor/activationcode";
|
|
|
|
|
|
-import Clipboard from 'clipboard';
|
|
|
+import Clipboard from "clipboard";
|
|
|
|
|
|
export default {
|
|
|
name: "TenantCode",
|
|
|
data() {
|
|
|
return {
|
|
|
- options: [],
|
|
|
- //表单校验
|
|
|
- rulesActivationCode: {
|
|
|
- tenantCode: [
|
|
|
- { required: true, message: "未选择租户信息", trigger: "blur" },
|
|
|
- ],
|
|
|
- tenantExpirationDate: [
|
|
|
- { required: true, message: "租户到期时间为设置", trigger: "blur" },
|
|
|
- ],
|
|
|
- },
|
|
|
- activationCode: {},
|
|
|
- //租户信息表格数据
|
|
|
- tenantList: [],
|
|
|
- activationCodeForm: false,
|
|
|
- actCode:"",
|
|
|
- title:"激活码生成成功",
|
|
|
- // 遮罩层
|
|
|
- loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
- // 显示搜索条件
|
|
|
- showSearch: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
- // 表格数据
|
|
|
- list: [],
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
- // 日期范围
|
|
|
- dateRange: [],
|
|
|
- // 默认排序
|
|
|
- defaultSort: { prop: "operTime", order: "descending" },
|
|
|
- // 表单参数
|
|
|
- form: {},
|
|
|
- // 查询参数
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- operator: undefined,
|
|
|
- ipAddress: undefined
|
|
|
- },
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
-
|
|
|
+ options: [],
|
|
|
+ //表单校验
|
|
|
+ rulesActivationCode: {
|
|
|
+ tenantCode: [
|
|
|
+ { required: true, message: "未选择租户信息", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ tenantExpirationDate: [
|
|
|
+ { required: true, message: "租户到期时间未设置", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ activationCode: {},
|
|
|
+ //租户信息表格数据
|
|
|
+ tenantList: [],
|
|
|
+ activationCodeForm: false,
|
|
|
+ actCode: "",
|
|
|
+ title: "激活码生成成功",
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 表格数据
|
|
|
+ list: [],
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 日期范围
|
|
|
+ dateRange: [],
|
|
|
+ // 默认排序
|
|
|
+ defaultSort: { prop: "operTime", order: "descending" },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ operator: undefined,
|
|
|
+ ipAddress: undefined,
|
|
|
+ },
|
|
|
+ };
|
|
|
},
|
|
|
+ computed: {},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
this.getCodeLogList();
|
|
@@ -204,30 +221,40 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//创建激活码
|
|
|
- crateCode(){
|
|
|
- createTenantCode(this.activationCode).then((response) => {
|
|
|
- this.activationCodeForm=true;
|
|
|
- this.actCode=response.msg;
|
|
|
+ crateCode() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ createTenantCode(this.activationCode).then((response) => {
|
|
|
+ this.activationCodeForm = true;
|
|
|
+ this.actCode = response.msg;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
//激活码复制操作
|
|
|
copyToClipboard() {
|
|
|
//创建一个新 Clipboard 实例,将目标元素和复制成功时的回调传递给它
|
|
|
- const clipboard = new Clipboard('button', {
|
|
|
+ const clipboard = new Clipboard("button", {
|
|
|
text: () => this.actCode, //在这里替换为你要复制的文本
|
|
|
});
|
|
|
- clipboard.on('success', () => {
|
|
|
- this.activationCodeForm=false;
|
|
|
- this.$message({showClose: true, message: '文本已成功复制到剪贴板', type: 'success'});
|
|
|
+ clipboard.on("success", () => {
|
|
|
+ this.activationCodeForm = false;
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: "文本已成功复制到剪贴板",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
clipboard.destroy(); //清除 Clipboard 实例
|
|
|
});
|
|
|
- clipboard.on('error', () => {
|
|
|
- console.error('复制失败');
|
|
|
+ clipboard.on("error", () => {
|
|
|
+ console.error("复制失败");
|
|
|
clipboard.destroy(); //清除 Clipboard 实例
|
|
|
});
|
|
|
//触发按钮点击事件,开始复制操作
|
|
|
clipboard.onClick({
|
|
|
- action: 'copy',
|
|
|
+ action: "copy",
|
|
|
});
|
|
|
},
|
|
|
//取消按钮
|
|
@@ -238,7 +265,8 @@ export default {
|
|
|
//激活码日志信息
|
|
|
getCodeLogList() {
|
|
|
this.loading = true;
|
|
|
- list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
+ list(this.addDateRange(this.queryParams, this.dateRange)).then(
|
|
|
+ (response) => {
|
|
|
this.list = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|