0. 功能实现描述
1. 代码实现
ScStfController.java
/**
* 查询员工证书
* @param stfId
* @param modelMap
* @return
*/
@RequiresPermissions("sc:stf:cert")
@GetMapping("/cert/{stfId}")
public String detail(@PathVariable("stfId") Long stfId, ModelMap modelMap)
{
modelMap.put("certs", scStfCertService.selectScStfCertListByStfId(stfId));
return "sc/cert/cert-simplified";
}
stf.html
<!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('员工列表')" />
</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>
<label>员工编号:</label>
<input type="text" name="id"/>
</li>
<li>
<label>姓名:</label>
<input type="text" name="xm"/>
</li>
<li>
<label>所属公司:</label>
<input type="text" name="ssgsMc"/>
</li>
<li>
<label>所属部门:</label>
<select name="ssbm" th:with="type=${@dict.getType('sc_stf_ssbm')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>岗位:</label>
<select name="gw" th:with="type=${@dict.getType('sc_stf_gw')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>移动电话:</label>
<input type="text" name="yddh"/>
</li>
<li>
<label>微信号:</label>
<input type="text" name="wxh"/>
</li>
<li>
<label>电子邮箱:</label>
<input type="text" name="dzyx"/>
</li>
<li>
<label>银行卡号:</label>
<input type="text" name="yhkh"/>
</li>
<li>
<label>健康状况:</label>
<select name="jkzk" th:with="type=${@dict.getType('sc_stf_jkzk')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>身份证号:</label>
<input type="text" name="sfzh"/>
</li>
<li>
<label>最高学历:</label>
<select name="zgxl" th:with="type=${@dict.getType('sc_stf_xl')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>专业:</label>
<input type="text" name="zy"/>
</li>
<li>
<label>政治面貌:</label>
<select name="zzmm" th:with="type=${@dict.getType('sc_stf_zzmm')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>婚姻状况:</label>
<select name="hyzk" th:with="type=${@dict.getType('sc_stf_hyzk')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>在职状态:</label>
<select name="zzzt" th:with="type=${@dict.getType('sc_stf_zzzt')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</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="sc:stf:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="sc:stf:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sc:stf:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="sc:stf:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('sc:stf:edit')}]];
var removeFlag = [[${@permission.hasPermi('sc:stf:remove')}]];
var certFlag = [[${@permission.hasPermi('sc:stf:cert')}]];
var ssbmDatas = [[${@dict.getType('sc_stf_ssbm')}]];
var gwDatas = [[${@dict.getType('sc_stf_gw')}]];
var jkzkDatas = [[${@dict.getType('sc_stf_jkzk')}]];
var zjlxDatas = [[${@dict.getType('sc_stf_zjlx')}]];
var xbDatas = [[${@dict.getType('sys_user_sex')}]];
var mzDatas = [[${@dict.getType('sc_stf_mz')}]];
var zgxlDatas = [[${@dict.getType('sc_stf_xl')}]];
var zzmmDatas = [[${@dict.getType('sc_stf_zzmm')}]];
var hyzkDatas = [[${@dict.getType('sc_stf_hyzk')}]];
var zzztDatas = [[${@dict.getType('sc_stf_zzzt')}]];
var prefix = ctx + "sc/stf";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "员工",
columns: [{
checkbox: true
},
{
field: 'id',
title: '员工编号',
visible: false
},
{
field: 'zjz',
title: '证件照'
},
{
field: 'xm',
title: '姓名'
},
{
field: 'ssgsMc',
title: '所属公司'
},
{
field: 'ssbm',
title: '所属部门',
formatter: function(value, row, index) {
return $.table.selectDictLabel(ssbmDatas, value);
}
},
{
field: 'gw',
title: '岗位',
formatter: function(value, row, index) {
return $.table.selectDictLabel(gwDatas, value);
}
},
{
field: 'gzdzz',
title: '工作地住址'
},
{
field: 'yddh',
title: '移动电话'
},
{
field: 'dzyx',
title: '电子邮箱'
},
{
field: 'jkzk',
title: '健康状况',
formatter: function(value, row, index) {
return $.table.selectDictLabel(jkzkDatas, value);
}
},
{
field: 'sfzh',
title: '身份证号'
},
{
field: 'xb',
title: '性别',
formatter: function(value, row, index) {
return $.table.selectDictLabel(xbDatas, value);
}
},
{
field: 'zzzt',
title: '在职状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(zzztDatas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" οnclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + certFlag + '" href="javascript:void(0)" οnclick="cert(\'' + row.id + '\')"><i class="fa fa-list-ul"></i>证书</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" οnclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
function cert(id) {
var url = prefix + '/cert/' + id;
$.modal.openTab("证书数据", url);
}
</script>
</body>
</html>
cert-simplified.html
<!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('证书列表')" />
</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>
<label>证书名称:</label>
<input type="text" name="zsmc"/>
</li>
<li>
<label>证书类型:</label>
<select name="zslx" th:with="type=${@dict.getType('sc_stf_cert_zslx')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>复审预警:</label>
<select name="fzsj" th:with="type=${@dict.getType('sc_stf_cert_fsyj')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</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="sc:cert:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="sc:cert:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sc:cert:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="sc:cert:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-danger" onclick="closeItem()">
<i class="fa fa-reply-all"></i> 关闭
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('sc:cert:edit')}]];
var removeFlag = [[${@permission.hasPermi('sc:cert:remove')}]];
var zslxDatas = [[${@dict.getType('sc_stf_cert_zslx')}]];
var fzsjDatas = [[${@dict.getType('sc_stf_cert_fsyj')}]];
var prefix = ctx + "sc/cert";
$(function() {
var options = {
data: [[${certs}]],
sidePagination: "client",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
/*url: prefix + "/list",*/
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "证书",
columns: [{
checkbox: true
},
{
field: 'id',
title: '系统证书编号',
visible: false
},
{
field: 'stfId',
title: '员工编号',
visible: false
},
{
field: 'zsmc',
title: '证书名称'
},
{
field: 'zslx',
title: '证书类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(zslxDatas, value);
}
},
{
field: 'zsbh',
title: '证书编号'
},
{
field: 'yxq',
title: '有效期'
},
{
field: 'clrq',
title: '初领日期'
},
{
field: 'fsrq',
title: '复审日期'
},
{
field: 'fzsj',
title: '复审预警',
formatter: function(value, row, index) {
return $.table.selectDictLabel(fzsjDatas, value);
}
},
{
field: 'fzjg',
title: '发证机构'
},
{
field: 'zsms',
title: '证书描述'
},
{
field: 'bz',
title: '备注'
},
{
field: 'zstx',
title: '证书图像'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" οnclick="$.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)" οnclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
2. 若依官方代码参考
<!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('加载data数据')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var datas = [[${@dict.getType('sys_normal_disable')}]];
$(function() {
var options = {
data: [[${users}]],
sidePagination: "client",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
columns: [{
checkbox: true
},
{
field : 'userId',
title : '用户ID'
},
{
field : 'userCode',
title : '用户编号'
},
{
field : 'userName',
title : '用户姓名'
},
{
field : 'userPhone',
title : '用户手机'
},
{
field : 'userEmail',
title : '用户邮箱'
},
{
field : 'userBalance',
title : '用户余额'
},
{
field: 'status',
title: '用户状态',
align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(datas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>