【Dict】移除列表页面,统一使用新版

pull/65/head
chenjinlong 4 years ago
parent 0fac815491
commit 820fdc3ea1

@ -1,153 +0,0 @@
layui.use(['table', 'treeTable', 'func', 'HttpRequest'], function () {
var $ = layui.$;
var treeTable = layui.treeTable;
var table = layui.table;
var func = layui.func;
var HttpRequest = layui.HttpRequest;
//table的初始化实例
var insTb;
/**
* 基础字典管理
*/
var Dict = {
tableId: "dictTable"
};
/**
* 初始化表格的列
*/
Dict.initColumn = function () {
return [
{type: 'checkbox'},
{field: 'dictName', align: "center", title: '字典名称'},
{field: 'dictCode', align: "center", title: '字典编码'},
{align: 'center', toolbar: '#tableBar', title: '操作'}
];
};
/**
* 点击查询按钮
*/
Dict.search = function () {
var queryData = {};
queryData['dictName'] = $("#condition").val();
queryData['dictCode'] = $("#condition").val();
Dict.initTable(Dict.tableId, queryData);
};
/**
* 弹出添加对话框
*/
Dict.openAddDlg = function () {
func.open({
height: 680,
title: '添加字典',
content: Feng.ctxPath + '/view/dict/addView?dictTypeId=' + $("#dictTypeId").val(),
tableId: Dict.tableId,
endCallback: function () {
Dict.initTable(Dict.tableId);
}
});
};
/**
* 点击编辑
*
* @param data 点击按钮时候的行数据
*/
Dict.openEditDlg = function (data) {
func.open({
height: 680,
title: '修改字典',
content: Feng.ctxPath + '/view/dict/editView?dictId=' + data.dictId,
tableId: Dict.tableId,
endCallback: function () {
Dict.initTable(Dict.tableId);
}
});
};
/**
* 点击删除
*
* @param data 点击按钮时候的行数据
*/
Dict.onDeleteItem = function (data) {
var operation = function () {
var httpRequest = new HttpRequest(Feng.ctxPath + "/dict/deleteDict", 'post', function (data) {
Feng.success("删除成功!");
Dict.search();
}, function (data) {
Feng.error("删除失败!" + data.message + "!");
});
httpRequest.set(data);
httpRequest.start(true);
};
Feng.confirm("是否删除?", operation);
};
/**
* 渲染表格
*/
Dict.initTable = function (dictId, data) {
return treeTable.render({
elem: '#' + dictId,
tree: {
iconIndex: 1, // 折叠图标显示在第几列
idName: 'dictId', // 自定义id字段的名称
pidName: 'parentId', // 自定义标识是否还有子节点的字段名称
haveChildName: 'haveChild', // 自定义标识是否还有子节点的字段名称
isPidData: true // 是否是pid形式数据
},
page: true,
request: {pageName: 'pageNo', limitName: 'pageSize'}, //自定义分页参数
height: "full-98",
cols: Dict.initColumn(),
reqData: function (d, callback) {
var httpRequest = new HttpRequest(Feng.ctxPath + '/dict/getDictTreeList?dictTypeCode=' + $("#dictTypeCode").val(), 'get', function (result) {
callback(result.data);
}, function (result) {
Feng.error("加载失败!" + result.message + "!");
});
httpRequest.set(data);
httpRequest.start();
},
});
};
insTb = Dict.initTable(Dict.tableId);
// 搜索按钮点击事件
$('#btnSearch').click(function () {
Dict.search();
});
// 添加按钮点击事件
$('#btnAdd').click(function () {
Dict.openAddDlg();
});
// 导出excel
$('#btnExp').click(function () {
Dict.exportExcel();
});
// 关闭页面
$('#btnBack').click(function () {
window.location.href = Feng.ctxPath + "/view/dictType";
});
// 工具条点击事件
treeTable.on('tool(' + Dict.tableId + ')', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') {
Dict.openEditDlg(data);
} else if (layEvent === 'delete') {
Dict.onDeleteItem(data);
}
});
});

@ -1,164 +0,0 @@
layui.use(['table', 'func', 'HttpRequest', 'form'], function () {
var $ = layui.$;
var table = layui.table;
var func = layui.func;
var HttpRequest = layui.HttpRequest;
var form = layui.form;
/**
* 字典类型表管理
*/
var DictType = {
tableId: "dictTypeTable"
};
/**
* 初始化表格的列
*/
DictType.initColumn = function () {
return [[
{type: 'checkbox'},
{field: 'dictTypeId', hide: true, title: '字典类型id'},
{
field: 'dictTypeName', align: "center", sort: true, title: '类型名称', templet: function (d) {
var url = Feng.ctxPath + '/view/dict?dictTypeId=' + d.dictTypeId;
return '<a style="color: #01AAED;" href="' + url + '">' + d.dictTypeName + '</a>';
}
},
{
field: 'dictTypeClass', align: "center", sort: true, title: '字典类型', templet: function (d) {
if (d.dictTypeClass === 1) {
return "业务类型";
} else {
return "系统类型";
}
}
},
{field: 'dictTypeNamePinyin', align: "center", sort: true, title: '名词拼音'},
{field: 'dictTypeCode', align: "center", sort: true, title: '类型编码', minWidth: 166},
{field: 'dictTypeBusCode', align: "center", sort: true, title: '业务编码', minWidth: 166},
{field: 'dictTypeDesc', align: "center", sort: true, title: '字典描述'},
{field: 'statusFlag', sort: true, align: "center", title: '状态', templet: '#statusFlagTpl'},
{align: 'center', toolbar: '#tableBar', title: '操作'}
]];
};
/**
* 点击查询按钮
*/
DictType.search = function () {
var queryData = {};
queryData['dictTypeName'] = $("#dictTypeName").val();
queryData['dictTypeClass'] = $("#dictTypeClass").val();
queryData['statusFlag'] = $("#statusFlag").val();
table.reload(DictType.tableId, {
where: queryData, page: {curr: 1}
});
};
/**
* 弹出添加对话框
*/
DictType.openAddDlg = function () {
func.open({
height: 700,
title: '添加字典类型',
content: Feng.ctxPath + '/view/dictType/addView',
tableId: DictType.tableId
});
};
/**
* 点击编辑
*
* @param data 点击按钮时候的行数据
*/
DictType.openEditDlg = function (data) {
func.open({
height: 700,
title: '修改字典类型',
content: Feng.ctxPath + '/view/dictType/editView?dictTypeId=' + data.dictTypeId,
tableId: DictType.tableId
});
};
/**
* 点击删除
*
* @param data 点击按钮时候的行数据
*/
DictType.onDeleteItem = function (data) {
if (data.dictTypeClass === 2) {
Feng.error("系统类型无法删除");
return;
}
var operation = function () {
var httpRequest = new HttpRequest(Feng.ctxPath + "/dictType/deleteDictType", 'post', function (data) {
Feng.success("删除成功!");
table.reload(DictType.tableId);
}, function (data) {
Feng.error("删除失败!" + data.message + "!");
});
httpRequest.set(data);
httpRequest.start(true);
};
Feng.confirm("是否删除?", operation);
};
// 修改字典类型状态
DictType.updateStatus = function (dictTypeId, checked) {
var httpRequest = new HttpRequest(Feng.ctxPath + "/dictType/updateStatus", 'post', function (data) {
table.reload(DictType.tableId);
Feng.success("修改成功!");
}, function (data) {
table.reload(DictType.tableId);
Feng.error("修改失败!" + data.message);
});
httpRequest.set({"dictTypeId": dictTypeId, "statusFlag": checked});
httpRequest.start(true);
};
// 渲染表格
var tableResult = table.render({
elem: '#' + DictType.tableId,
url: Feng.ctxPath + '/dictType/getDictTypePageList',
page: true,
request: {pageName: 'pageNo', limitName: 'pageSize'}, //自定义分页参数
height: "full-158",
cellMinWidth: 100,
cols: DictType.initColumn(),
parseData: Feng.parseData
});
// 搜索按钮点击事件
$('#btnSearch').click(function () {
DictType.search();
});
// 添加按钮点击事件
$('#btnAdd').click(function () {
DictType.openAddDlg();
});
// 工具条点击事件
table.on('tool(' + DictType.tableId + ')', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') {
DictType.openEditDlg(data);
} else if (layEvent === 'delete') {
DictType.onDeleteItem(data);
}
});
// 修改状态
form.on('switch(statusFlag)', function (obj) {
var dictTypeId = obj.elem.value;
var checked = obj.elem.checked ? 1 : 2;
DictType.updateStatus(dictTypeId, checked);
});
});

@ -1,38 +0,0 @@
@layout("/layout/_container.html",{js:["/assets/modular/system/dict/dict.js"]}){
<div class="layui-body-header">
<span class="layui-body-header-title">字典管理(字典类型:<span style="color: #1E9FFF;">${dictTypeName}</span></span>
</div>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form toolbar">
<div class="layui-form-item">
<div class="layui-inline">
<input type="hidden" id="dictTypeId" value="${dictTypeId}"/>
<input type="hidden" id="dictTypeCode" value="${dictTypeCode}"/>
<input id="condition" class="layui-input" type="text" placeholder="名称/编码" autocomplete="off"/>
</div>
<div class="layui-inline">
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
<button id="btnAdd" class="layui-btn icon-btn"><i class="layui-icon">&#xe654;</i>添加</button>
<button id="btnBack" class="layui-btn icon-btn layui-btn-normal"><i class="layui-icon">&#xe65c;</i>返回</button>
</div>
</div>
</div>
<table class="layui-table" id="dictTable" lay-filter="dictTable"></table>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
</script>
@}

@ -1,53 +0,0 @@
@layout("/layout/_container.html",{js:["/assets/modular/system/dictType/dictType.js"]}){
<div class="layui-body-header">
<span class="layui-body-header-title">字典类型表管理</span>
</div>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form toolbar">
<div class="layui-form-item">
<div class="layui-inline">
<input id="dictTypeName" class="layui-input" type="text" placeholder="名称/编码" autocomplete="off"/>
</div>
<div class="layui-inline">
<select id="dictTypeClass">
<option value="">字典类型</option>
<option value="1">业务类型</option>
<option value="2">系统类型</option>
</select>
</div>
<div class="layui-inline">
<select id="statusFlag">
<option value="">状态</option>
<option value="1">启用</option>
<option value="2">禁用</option>
</select>
</div>
<div class="layui-inline">
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
<button id="btnAdd" class="layui-btn icon-btn"><i class="layui-icon">&#xe654;</i>添加类型</button>
</div>
</div>
</div>
<table class="layui-table" id="dictTypeTable" lay-filter="dictTypeTable"></table>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
</script>
<script type="text/html" id="statusFlagTpl">
<input type="checkbox" lay-filter="statusFlag" value="{{d.dictTypeId}}" lay-skin="switch" lay-text="正常|禁用" {{d.statusFlag=='1'?'checked':''}}/>
</script>
@}
Loading…
Cancel
Save