路由修改Win

1.x
tanghc 6 years ago
parent 5d436081a5
commit 2231fdece1
  1. 36
      sop-admin/sop-admin-front/pages/service/routeManager.html
  2. 31
      sop-admin/sop-admin-front/pages/service/routeManager.js

@ -43,11 +43,43 @@
<div class="layui-btn-group demoTable">
<button class="layui-btn layui-btn-ms layui-btn-normal" lay-event="addRoute">添加路由</button>
</div>
<table class="layui-hide" id="table"></table>
<script type="text/html" id="optBar">
<table class="layui-hide" id="routeTable" lay-filter="routeTable"></table>
<script type="text/html" id="optBar" >
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">修改</a>
</script>
</div>
</div>
<div id="updateWin" style="display: none;padding: 20px;">
<form class="layui-form" action="" lay-filter="updateWinFilter">
<div class="layui-form-item">
<label class="layui-form-label">id</label>
<div class="layui-input-block">
<input type="text" name="id" readonly="readonly" class="layui-input"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">uri</label>
<div class="layui-input-block">
<input type="text" name="uri" lay-verify="required" class="layui-input"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">忽略验证</label>
<div class="layui-input-block">
<input type="radio" name="ignoreValidate" value="true" title="是">
<input type="radio" name="ignoreValidate" value="false" title="否">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<input type="radio" name="disabled" value="true" title="启用">
<input type="radio" name="disabled" value="false" title="<span class='x-red'>禁用</span>">
</div>
</div>
</form>
</div>
<script type="text/javascript" src="../../assets/js/lib.js"></script>
<script type="text/javascript" src="routeManager.js"></script>

@ -3,8 +3,8 @@ lib.use(['element', 'table', 'tree', 'form'], function () {
var table = layui.table;
var currentServiceId;
var serverTable = table.render({
elem: '#table'
var routeTable = table.render({
elem: '#routeTable'
, url: ApiUtil.createUrl('route.list')
, cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
, cols: [[
@ -28,6 +28,31 @@ lib.use(['element', 'table', 'tree', 'form'], function () {
]]
});
//监听单元格事件
table.on('tool(routeTable)', function(obj){
var data = obj.data;
if(obj.event === 'edit'){
//表单初始赋值
data.disabled = !data.disabled + '';
data.ignoreValidate = data.ignoreValidate + '';
form.val('updateWinFilter', data)
layer.open({
type: 1
,title: '修改路由'
,area: ['490px', '360px']
,content: $('#updateWin') //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
,btn: ['保存', '取消']
,yes: function(index, layero){
}
,btn2: function(index, layero){
layer.close(index);
}
});
}
});
$('#profileList').find('li').on('click', function () {
initTree($(this).text());
})
@ -83,7 +108,7 @@ lib.use(['element', 'table', 'tree', 'form'], function () {
});
function searchTable(param) {
serverTable.reload({
routeTable.reload({
where: {
data: JSON.stringify(param)
, profile: window.profile

Loading…
Cancel
Save