当前位置:网站首页>Open Source Summer | List Details Display Based on Ruoyi Architecture
Open Source Summer | List Details Display Based on Ruoyi Architecture
2022-08-09 21:15:00 【InfoQ】
展示效果
Since it is to display the list details,So let's take a look at the display effect of the list after implementation

点击列表+to show the details
代码实现
First go to Ruoyi's official website(http://demo.ruoyi.vip/index)Take a look at similar functions,展示结果如下

The detailed field name and property value enumeration is not rematched,不是我们想要的,This requires rewriting the general open source code provided by Ruoyi,The open source general code is as follows
function detailFormatter(index, row) {
var html = [];
$.each(row, function(key, value) {
html.push('<p><b>' + key + ':</b> ' + value + '</p>');
});
return html.join('');
}Also needs to be in the listoptionsCorresponding content is added,In order to show the original point of Ruoyi's open source architecture+No. shows the effect

Below I will add my own methoddetailFormatterTo supplement the display data enumeration value
代码改造
//Load data details
function detailFormatter(index, row) {
var html = [];
//Get list columns
var columns = options.columns;
var len = columns.length;
//遍历列表
for (var i = 1; i < len; i++) {
let field = columns[i].field;
let title = columns[i].title;
let formatter = columns[i].formatter;
//Traverse the data content of the current row
$.each(row, function(key, value) {
if (formatter != undefined) {
value = formatter(value);
}
//对比fieldWhether the field is related to the current row data contentkey一致
if (field == key) {
html.push('<p><b>' + title + ':</b> ' + value + '</p>');
return true;
}
})
}
return html.join('');
}The final result after the transformation is the screenshot effect starting above,The complete code of the page is also posted for backup
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('Outbound call risk control record list')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
风控类型:
<select name="riskType">
<option value="">请选择</option>
<option value="0" >系统风控</option>
<option value="1" >呼叫中心</option>
</select>
</li>
<li>
Call center platform type:
<select name="callCenterType">
<option value="">请选择</option>
<option value="0" >未知</option>
<option value="1" >平台1</option>
<option value="2" >平台2</option>
<option value="3" >平台3</option>
<option value="4" >平台4</option>
<option value="5" >平台5</option>
</select>
</li>
<li>
业务类型:
<select name="bizType">
<option value="">请选择</option>
<option value="1" >类型1</option>
<option value="2" >类型2</option>
<option value="3" >类型3</option>
<option value="5" >类型4</option>
<option value="6" >类型5</option>
</select>
</li>
<li>
Outgoing number:<input type="text" name="phone"/>
</li>
<li>
坐席号:<input type="text" name="cno"/>
</li>
<li>
分机号:<input type="text" name="sipNo"/>
</li>
<li>
External display number on the client side:<input type="text" name="clid"/>
</li>
<li>
创建时间:
<input type="text" readonly="readonly" placeholder="时间范围" name="createTime" id="createTime"/>
<input type="hidden" name="params[createTimeStartTime]" id="createTimeStartTime"/>
<input type="hidden" name="params[createTimeEndTime]" id="createTimeEndTime"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
</li>
</ul>
</div>
</form>
</div>
<!--<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="project:monitorCallRiskRecord:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="project:monitorCallRiskRecord:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="project:monitorCallRiskRecord:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="project:monitorCallRiskRecord:export">
<i class="fa fa-download"></i> 导出
</a>
</div>-->
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
//var editFlag = [[${@permission.hasPermi('project:monitorCallRiskRecord:edit')}]];
//var removeFlag = [[${@permission.hasPermi('project:monitorCallRiskRecord:remove')}]];
var prefix = ctx + "project/monitorCallRiskRecord";
var options;
$(function() {
initDaterangepickerWithoutInitTime("createTime","createTimeStartTime","createTimeEndTime");
options = {
url: prefix + "/list",
//createUrl: prefix + "/add",
//updateUrl: prefix + "/edit/{id}",
//removeUrl: prefix + "/remove",
//exportUrl: prefix + "/export",
modalName: "Outbound call risk control records",
sortName:"id",
sortOrder: "desc",
// showExport: true,
detailView: true,
detailFormatter: detailFormatter,
columns: [{
checkbox: true
},
{
field : 'id',
title : 'id'
},
{
field : 'riskType',
title : '风控类型',
formatter:function (value, row, index) {
if (value == 0) {
return "系统风控";
}else if (value == 1) {
return "呼叫中心";
}else {
return "-";
}
}
},
{
field : 'callCenterType',
title : 'Call center platform type',
formatter:function (value,row,index) {
if (value == 0) {
return "未知";
}else if (value == 1) {
return "平台1";
}else if (value == 2) {
return "平台2";
}else if (value == 3) {
return "平台3";
}else if (value == 4) {
return "平台4";
}else if (value == 5) {
return "平台5";
}else {
return "-";
}
}
},
{
field : 'callId',
title : 'crm通话记录id',
visible: false
},
{
field : 'bizType',
title : '业务类型',
formatter:function (value,row,index) {
if (value == 1) {
return "类型1";
}else if (value == 2) {
return "类型2";
}else if (value == 3) {
return "类型3";
}else if (value == 5) {
return "类型4";
}else if (value == 6) {
return "类型5";
}else {
return "-";
}
}
},
{
field : 'bizId',
title : '业务id',
visible: false
},
{
field : 'requestParams',
title : '请求参数',
visible: false
},
{
field : 'responseBody',
title : '返回参数',
visible: false
},
{
field : 'phone',
title : 'Outgoing number'
},
{
field : 'cno',
title : '坐席号'
},
{
field : 'sipNo',
title : '分机号'
},
{
field : 'userId',
title : '用户id',
visible: false
},
{
field : 'clid',
title : 'External display number on the client side'
},
{
field : 'callBackContent',
title : 'CDR push content',
visible: false
},
{
field : 'requestUniqueId',
title : '请求唯一标识',
visible: false
},
{
field : 'uniqueId',
title : 'Phone unique identifier',
visible: false
},
{
field : 'riskTime',
title : 'Risk control time',
visible: false
},
{
field : 'unRiskTime',
title : '解封时间',
visible: false
},
{
field : 'createTime',
title : '创建时间'
},
{
field : 'updateTime',
title : '更新时间',
visible: false
}
/*{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}*/]
};
$.table.init(options);
});
//Load data details
function detailFormatter(index, row) {
var html = [];
//Get list columns
var columns = options.columns;
var len = columns.length;
//遍历列表
for (var i = 1; i < len; i++) {
let field = columns[i].field;
let title = columns[i].title;
let formatter = columns[i].formatter;
//Traverse the data content of the current row
$.each(row, function(key, value) {
if (formatter != undefined) {
value = formatter(value);
}
//对比fieldWhether the field is related to the current row data contentkey一致
if (field == key) {
html.push('<p><b>' + title + ':</b> ' + value + '</p>');
return true;
}
})
}
return html.join('');
}
</script>
</body>
</html>边栏推荐
猜你喜欢
随机推荐
winpe工具WEPE微PE工具箱
shared usage in d
MySQL数据指令
智驾科技完成C1轮融资,此前2轮已融4.5亿元
RT-Thread推荐入围国赛及群体挑战赛名单
IDEA工具常用配置
Unity Webgl与JS相互交互 Unity 2021.2之后的版本
国产抗新冠口服药每瓶不超300元/ 我国IPv6网络全面建成/ 谷歌入局折叠屏手机...今日更多新鲜事在此...
16 张图解 | 淘宝 10年架构演进
PHP基础笔记-NO.4
std::atomic_flag的test_and_set函数理解
面试官:当Redis大的时候,要如何处理key?
对数学直观、感性的认知是理解数学、喜爱数学的必经之路,这本书做到了!
Sublime Text的安装过程记录
Cortex-A7 MPCore 架构
开源一夏 | 基于若依架构的列表详情展示
Detailed explanation of VIT transformer
MFC教程
How to stop the test after reaching a given number of errors during stress testing in JMeter
Office 365 Group概述以及创建方法
![[免费专栏] Android安全之Root检测和绕过(浅析)](/img/04/4170dea9c367c406fe3f36cb9c6501.png)
![[免费专栏] Android安全之Android工程模式](/img/9e/373a513dd3cd4681ff969432c9dfd5.png)






