license管理新增重置key的操作

This commit is contained in:
aoshiguchen
2022-12-19 10:18:59 +08:00
parent 461805e652
commit cfd079279f
4 changed files with 35 additions and 5 deletions
+10
View File
@@ -51,3 +51,13 @@ export function deleteLicense(id) {
}
})
}
export function resetLicense(id) {
return request({
url: '/license/reset',
method: 'post',
params: {
id: id
}
})
}
+2 -1
View File
@@ -146,7 +146,8 @@ export default {
updatePwd: '修改密码',
msg: '消息',
outcome: '结果',
err: '异常信息'
err: '异常信息',
resetKey: '重置Key'
},
button: {
lookOver: '查看'
@@ -47,14 +47,14 @@
<el-tag :type="scope.row.isOnline | statusFilter">{{scope.row.isOnline | isOnlineName}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.actions')" width="230" class-name="small-padding fixed-width">
<el-table-column align="center" :label="$t('table.actions')" width="330" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
<el-button size="mini" type="primary" @click="handleReset(scope.row)">{{$t('table.resetKey')}}</el-button>
<el-button v-if="scope.row.enable =='1'" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">{{$t('table.disable')}}</el-button>
<el-button v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">{{$t('table.enable')}}</el-button>
<!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px"/>
</template>
</el-table-column>
</el-table>
@@ -98,7 +98,7 @@
</template>
<script>
import { fetchList, createLicense, updateLicense, updateEnableStatus, deleteLicense } from '@/api/license'
import { fetchList, createLicense, updateLicense, updateEnableStatus, deleteLicense, resetLicense } from '@/api/license'
import { userList } from '@/api/user'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
@@ -277,6 +277,25 @@
this.$refs['dataForm'].clearValidate()
})
},
handleReset(row) {
this.$confirm('确定重置吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
resetLicense(row.id).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '重置成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}).catch(() => {})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
@@ -77,7 +77,7 @@ public interface LicenseMapper extends SqlMapper {
@Update("update `license` set is_online = :isOnline, update_time = :updateTime")
void updateOnlineStatus(@Param("isOnline") Integer isOnline, @Param("updateTime") Date updateTime);
@Update("update `license` set key = :key,update_time = :updateTime where id = :id")
@Update("update `license` set `key` = :key,update_time = :updateTime where id = :id")
void reset(@Param("id") Integer id, @Param("key") String key, @Param("updateTime") Date updateTime);
@Delete("delete from `license` where id = ?")