给租户增加有效期

This commit is contained in:
季圣华
2021-08-25 00:44:20 +08:00
parent be9786087f
commit 0fcd84d2ad
5 changed files with 72 additions and 12 deletions

View File

@@ -49,9 +49,11 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :sm="24" :md="24" :xl="24" :style="{ marginBottom: '5px' }"> <a-col :sm="24" :md="24" :xl="24" :style="{ marginBottom: '5px' }">
<a-card :bordered="false" :body-style="{padding: '5'}"> <a-card :bordered="false" :body-style="{padding: '5'}">
<div class="hidden-xs" style="float:right;">当前版本:V3.0</div> <div class="hidden-xs" style="float:right;">&copy; 2015-2030 {{systemTitle}} V3.0</div>
&copy; 2015-2030 {{systemTitle}} - Powered By <a-tag v-if="tenant.type==0" color="blue">试用到期:{{tenant.expireTime}}</a-tag>
<a :href="systemUrl" target="_blank">官方网站</a> <a-tag v-if="tenant.type==0" color="blue">试用用户:{{tenant.userCurrentNum}}/{{tenant.userNumLimit}}</a-tag>
<a-tag v-if="tenant.type==1" color="blue">服务到期:{{tenant.expireTime}}</a-tag>
<a-tag v-if="tenant.type==1" color="blue">授权用户:{{tenant.userCurrentNum}}/{{tenant.userNumLimit}}</a-tag>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
@@ -69,6 +71,7 @@
import HeadInfo from '@/components/tools/HeadInfo.vue' import HeadInfo from '@/components/tools/HeadInfo.vue'
import Trend from '@/components/Trend' import Trend from '@/components/Trend'
import { getBuyAndSaleStatistics, buyOrSalePrice } from '@/api/api' import { getBuyAndSaleStatistics, buyOrSalePrice } from '@/api/api'
import { getAction } from '../../api/manage'
export default { export default {
name: "IndexChart", name: "IndexChart",
@@ -94,14 +97,21 @@
buyPriceData: [], buyPriceData: [],
salePriceData: [], salePriceData: [],
visitFields:['ip','visit'], visitFields:['ip','visit'],
visitInfo:[] visitInfo:[],
tenant: {
type: '',
expireTime: '',
userCurrentNum: '',
userNumLimit: ''
}
} }
}, },
created() { created() {
setTimeout(() => { setTimeout(() => {
this.loading = !this.loading this.loading = !this.loading
}, 1000) }, 1000)
this.initInfo(); this.initInfo()
this.initWithTenant()
}, },
methods: { methods: {
initInfo () { initInfo () {
@@ -116,6 +126,13 @@
this.salePriceData = res.data.salePriceList; this.salePriceData = res.data.salePriceList;
} }
}) })
},
initWithTenant() {
getAction("/user/infoWithTenant",{}).then(res=>{
if(res && res.code === 200) {
this.tenant = res.data
}
})
} }
} }
} }

View File

@@ -11,6 +11,22 @@
<a-input placeholder="输入登录名称模糊查询" v-model="queryParam.loginName"></a-input> <a-input placeholder="输入登录名称模糊查询" v-model="queryParam.loginName"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="24">
<a-form-item label="租户类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="queryParam.type" placeholder="请选择租户类型">
<a-select-option value="0">免费租户</a-select-option>
<a-select-option value="1">付费租户</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="租户状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="queryParam.enabled" placeholder="请选择操作状态">
<a-select-option value="1">启用</a-select-option>
<a-select-option value="0">禁用</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery">查询</a-button> <a-button type="primary" @click="searchQuery">查询</a-button>
@@ -51,7 +67,11 @@
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
</span> </span>
<!-- 状态渲染模板 --> <!-- 状态渲染模板 -->
<template slot="customRenderFlag" slot-scope="enabled"> <template slot="customRenderType" slot-scope="type">
<a-tag v-if="type==0">免费租户</a-tag>
<a-tag v-if="type==1" color="green">付费租户</a-tag>
</template>
<template slot="customRenderEnabled" slot-scope="enabled">
<a-tag v-if="enabled" color="green">启用</a-tag> <a-tag v-if="enabled" color="green">启用</a-tag>
<a-tag v-if="!enabled" color="orange">禁用</a-tag> <a-tag v-if="!enabled" color="orange">禁用</a-tag>
</template> </template>
@@ -85,7 +105,9 @@
offset: 1 offset: 1
}, },
queryParam: { queryParam: {
loginName: "" loginName: '',
type: '',
enabled: ''
}, },
columns: [ columns: [
{ {
@@ -100,8 +122,11 @@
}, },
{ title: '登录名称', dataIndex: 'loginName', width: 100, align: "center"}, { title: '登录名称', dataIndex: 'loginName', width: 100, align: "center"},
{ title: '用户数量限制', dataIndex: 'userNumLimit', width: 100, align: "center"}, { title: '用户数量限制', dataIndex: 'userNumLimit', width: 100, align: "center"},
{ title: '状态',dataIndex: 'enabled',width:70,align:"center", { title: '租户类型',dataIndex: 'type',width:70,align:"center",
scopedSlots: { customRender: 'customRenderFlag' } scopedSlots: { customRender: 'customRenderType' }
},
{ title: '租户状态',dataIndex: 'enabled',width:70,align:"center",
scopedSlots: { customRender: 'customRenderEnabled' }
}, },
{ title: '创建时间', dataIndex: 'createTimeStr', width: 100, align: "center"}, { title: '创建时间', dataIndex: 'createTimeStr', width: 100, align: "center"},
{ title: '到期时间', dataIndex: 'expireTimeStr', width: 100, align: "center"}, { title: '到期时间', dataIndex: 'expireTimeStr', width: 100, align: "center"},

View File

@@ -16,7 +16,16 @@
suffix="初始密码123456" /> suffix="初始密码123456" />
</a-form-item> </a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="用户数量限制"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="用户数量限制">
<a-input-number style="width:50%" placeholder="请输入用户数量限制" v-decorator.trim="[ 'userNumLimit' ]" /> <a-input-number style="width:60%" placeholder="请输入用户数量限制" v-decorator.trim="[ 'userNumLimit' ]" />
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="租户类型">
<a-select style="width:60%" placeholder="请选择租户类型" v-decorator.trim="[ 'type' ]">
<a-select-option value="0">免费租户</a-select-option>
<a-select-option value="1">付费租户</a-select-option>
</a-select>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="到期时间">
<j-date style="width:60%" placeholder="请选择到期时间" v-decorator.trim="[ 'expireTime' ]" :show-time="true"/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-spin> </a-spin>
@@ -25,8 +34,12 @@
<script> <script>
import pick from 'lodash.pick' import pick from 'lodash.pick'
import {registerUser,editTenant,checkTenant } from '@/api/api' import {registerUser,editTenant,checkTenant } from '@/api/api'
import JDate from '@/components/jeecg/JDate'
export default { export default {
name: "TenantModal", name: "TenantModal",
components: {
JDate
},
data () { data () {
return { return {
title:"操作", title:"操作",
@@ -62,9 +75,10 @@
edit (record) { edit (record) {
this.form.resetFields(); this.form.resetFields();
this.model = Object.assign({}, record); this.model = Object.assign({}, record);
this.model.expireTime = this.model.expireTimeStr
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'loginName', 'userNumLimit', 'billsNumLimit')) this.form.setFieldsValue(pick(this.model,'loginName', 'userNumLimit', 'billsNumLimit', 'type', 'expireTime'))
}); });
}, },
close () { close () {

View File

@@ -202,6 +202,10 @@
err.message = '用户所属的租户被禁用'; err.message = '用户所属的租户被禁用';
this.requestFailed(err) this.requestFailed(err)
this.Logout(); this.Logout();
} else if(res.data.msgTip == 'tenant is expire'){
err.message = '用户所属的租户已过期';
this.requestFailed(err)
this.Logout();
} else if(res.data.msgTip == 'access service error'){ } else if(res.data.msgTip == 'access service error'){
err.message = '查询服务异常'; err.message = '查询服务异常';
this.requestFailed(err) this.requestFailed(err)

View File

@@ -242,7 +242,7 @@
} else { } else {
this.$notification['error']({ this.$notification['error']({
message: "提示", message: "提示",
description: "注册失败", description: res.data.message || "注册失败",
duration: 2 duration: 2
}); });
} }