1、前端优化api日志页面
2、优化前端翻译页面
3、细化权限
pull/254/head
xjs 4 years ago
parent bcbeeba42c
commit 5782b7b226

@ -1,5 +1,8 @@
package com.ruoyi.common.core.web.page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
@ -8,20 +11,25 @@ import java.util.List;
*
* @author ruoyi
*/
@ApiModel(value = "表格分页数据对象")
public class TableDataInfo implements Serializable
{
private static final long serialVersionUID = 1L;
/** 总记录数 */
@ApiModelProperty("总记录数")
private long total;
/** 列表数据 */
@ApiModelProperty("列表数据")
private List<?> rows;
/** 消息状态码 */
@ApiModelProperty("消息状态码")
private int code;
/** 消息内容 */
@ApiModelProperty("消息内容")
private String msg;
/**

@ -17,24 +17,6 @@ export function getLog(id) {
})
}
// 新增日志
export function addLog(data) {
return request({
url: '/english/log',
method: 'post',
data: data
})
}
// 修改日志
export function updateLog(data) {
return request({
url: '/english/log',
method: 'put',
data: data
})
}
// 删除日志
export function delLog(id) {
return request({

@ -10,15 +10,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否请求成功" prop="isSuccess">
<el-input
v-model="queryParams.isSuccess"
placeholder="请输入是否请求成功"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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>
@ -26,27 +18,6 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['english:log:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['english:log:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
@ -72,23 +43,15 @@
</el-row>
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="接口名称" align="center" prop="apiName" />
<el-table-column label="请求API的url" align="center" prop="url" />
<el-table-column label="请求API的方法" align="center" prop="method" />
<el-table-column label="请求request" align="center" prop="request" />
<el-table-column label="响应体" align="center" prop="response" />
<el-table-column label="是否请求成功" align="center" prop="isSuccess" />
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="接口名称" align="center" prop="apiName" :show-overflow-tooltip="true"/>
<el-table-column label="URL" align="center" prop="url" :show-overflow-tooltip="true"/>
<el-table-column label="请求方法" align="center" prop="method" :show-overflow-tooltip="true"/>
<el-table-column label="请求体" align="center" prop="request" :show-overflow-tooltip="true"/>
<el-table-column label="响应体" align="center" prop="response" :show-overflow-tooltip="true"/>
<el-table-column label="是否请求成功" align="center" prop="isSuccess" :show-overflow-tooltip="true"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['english:log:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
@ -99,7 +62,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -107,21 +70,11 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改日志对话框 -->
<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>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listLog, getLog, delLog, addLog, updateLog } from "@/api/english/log";
import { listLog, getLog, delLog} from "@/api/business/english/log";
export default {
name: "Log",
@ -222,26 +175,6 @@ export default {
this.title = "修改日志";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateLog(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLog(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
@ -260,4 +193,4 @@ export default {
}
}
};
</script>
</script>

@ -0,0 +1,196 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="接口名称" prop="apiName">
<el-input
v-model="queryParams.apiName"
placeholder="请输入接口名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['english:log:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['english:log:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="接口名称" align="center" prop="apiName" :show-overflow-tooltip="true"/>
<el-table-column label="URL" align="center" prop="url" :show-overflow-tooltip="true"/>
<el-table-column label="请求方法" align="center" prop="method" :show-overflow-tooltip="true"/>
<el-table-column label="请求体" align="center" prop="request" :show-overflow-tooltip="true"/>
<el-table-column label="响应体" align="center" prop="response" :show-overflow-tooltip="true"/>
<el-table-column label="是否请求成功" align="center" prop="isSuccess" :show-overflow-tooltip="true"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['english:log:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listLog, getLog, delLog} from "@/api/business/english/log";
export default {
name: "Log",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
logList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
apiName: null,
isSuccess: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询日志列表 */
getList() {
this.loading = true;
listLog(this.queryParams).then(response => {
this.logList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
apiName: null,
url: null,
method: null,
request: null,
response: null,
isSuccess: 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();
this.open = true;
this.title = "添加日志";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getLog(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改日志";
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除日志编号为"' + ids + '"的数据项?').then(function() {
return delLog(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('english/log/export', {
...this.queryParams
}, `log_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -1,16 +1,15 @@
package com.xjs.log.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
@ -31,6 +30,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
*/
@RestController
@RequestMapping("log")
@Api(tags = "业务模块-API日志")
public class ApiLogController extends BaseController {
@Autowired
private IApiLogService apiLogService;
@ -40,6 +40,7 @@ public class ApiLogController extends BaseController {
*/
@RequiresPermissions("english:log:list")
@GetMapping("/list")
@ApiOperation("查询日志列表")
public TableDataInfo list(ApiLog apiLog) {
startPage();
List<ApiLog> list = apiLogService.selectApiLogList(apiLog);
@ -52,6 +53,7 @@ public class ApiLogController extends BaseController {
@RequiresPermissions("english:log:export")
@Log(title = "API日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ApiOperation("导出日志列表")
public void export(HttpServletResponse response, ApiLog apiLog) {
List<ApiLog> list = apiLogService.selectApiLogList(apiLog);
ExcelUtil<ApiLog> util = new ExcelUtil<ApiLog>(ApiLog.class);
@ -63,6 +65,7 @@ public class ApiLogController extends BaseController {
*/
@RequiresPermissions("english:log:query")
@GetMapping(value = "/{id}")
@ApiOperation("获取日志详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(apiLogService.selectApiLogById(id));
}
@ -74,6 +77,7 @@ public class ApiLogController extends BaseController {
@RequiresPermissions("english:log:remove")
@Log(title = "API日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除日志")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(apiLogService.deleteApiLogByIds(ids));
}

@ -17,7 +17,7 @@ public interface IApiLogService
* @param id
* @return
*/
public ApiLog selectApiLogById(Long id);
ApiLog selectApiLogById(Long id);
/**
*
@ -25,7 +25,7 @@ public interface IApiLogService
* @param apiLog
* @return
*/
public List<ApiLog> selectApiLogList(ApiLog apiLog);
List<ApiLog> selectApiLogList(ApiLog apiLog);
/**
*
@ -33,7 +33,7 @@ public interface IApiLogService
* @param ids
* @return
*/
public int deleteApiLogByIds(Long[] ids);
int deleteApiLogByIds(Long[] ids);
/**
*
@ -41,5 +41,5 @@ public interface IApiLogService
* @param id
* @return
*/
public int deleteApiLogById(Long id);
int deleteApiLogById(Long id);
}

@ -37,6 +37,7 @@ public class TranslationController {
@ApiOperation("翻译接口")
@Log(title = "翻译管理")
@RequiresLogin
@RequiresPermissions("english:translation:api")
public AjaxResult translation(@Validated @RequestBody TranslationQo translationQo) {
TranslationVo translationVo=new TranslationVo();
if (BAIDU.equals(translationQo.getTranslationType())) {

@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="apiName != null and apiName != ''"> and api_name like concat('%', #{apiName}, '%')</if>
<if test="isSuccess != null "> and is_success = #{isSuccess}</if>
</where>
order by id desc
</select>
<select id="selectApiLogById" parameterType="Long" resultMap="ApiLogResult">

Loading…
Cancel
Save