添加机构信息管理功能
This commit is contained in:
310
erp_web/pages/manage/organization.html
Normal file
310
erp_web/pages/manage/organization.html
Normal file
@@ -0,0 +1,310 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>机构管理</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Cache-Control" content="no-cache">
|
||||
<meta http-equiv="Expires" content="-1">
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" style="padding:1px;top:300px;" title="机构列表" iconCls="icon-list"
|
||||
collapsible="true" closable="false">
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF">
|
||||
</table>
|
||||
</div>
|
||||
<div id="organizationDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="organizationFM" method="post" novalidate>
|
||||
<table>
|
||||
<tr>
|
||||
<td>上级机构</td>
|
||||
<td style="padding:5px">
|
||||
<input name="orgParentName" id="orgParentName" style="width: 200px;height: 20px" readonly="readonly"/>
|
||||
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectOrganization">
|
||||
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
|
||||
<input name="orgParentNo" id="orgParentNo" type="hidden"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>全称</td>
|
||||
<td style="padding:5px">
|
||||
<input name="orgFullName" id="orgFullName" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
|
||||
<input name="id" id="id" type="hidden"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>简称</td>
|
||||
<td style="padding:5px">
|
||||
<input name="orgAbr" id="orgAbr" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<!--<tr>
|
||||
<td>类型</td>
|
||||
<td style="padding:5px">
|
||||
<input name="orgTpcd" id="orgTpcd" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
|
||||
</td>
|
||||
</tr>-->
|
||||
<tr>
|
||||
<td>状态</td>
|
||||
<td style="padding:5px">
|
||||
<input name="orgStcd" id="orgStcd" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>编号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="orgNo" id="orgNo" style="width: 200px;height: 20px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>序号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="sort" id="sort" style="width: 200px;height: 20px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>开创时间</td>
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="orgCreateTime" id="orgCreateTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate" style="width:200px;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>停业时间</td>
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="orgStopTime" id="orgStopTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate" style="width:200px;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>备注</td>
|
||||
<td style="padding:5px">
|
||||
<textarea name="remark" id="remark" placeholder="暂无备注信息"
|
||||
style="width: 200px; height:40px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="saveOrganization" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelOrganization" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#organizationDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="forSelectOrganizationDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var url;
|
||||
//初始化界面
|
||||
$(function () {
|
||||
var treeHeight=webH-35;
|
||||
//初始化系统基础信息
|
||||
$('#tableData').datagrid({
|
||||
height: treeHeight,
|
||||
toolbar: [
|
||||
{
|
||||
id: 'addOrganization',
|
||||
text: '增加',
|
||||
iconCls: 'icon-add',
|
||||
handler: function () {
|
||||
addOrganization();
|
||||
}
|
||||
},
|
||||
'-',
|
||||
{
|
||||
id: 'deleteOrganization',
|
||||
text: '删除',
|
||||
iconCls: 'icon-remove',
|
||||
handler: function () {
|
||||
batDeleteOrganization();
|
||||
}
|
||||
}
|
||||
],
|
||||
});
|
||||
$('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>");
|
||||
$('#tt').tree({
|
||||
url: '/organization/getOrganizationTree',
|
||||
animate: true,
|
||||
checkbox: true,
|
||||
onDblClick: function(node){
|
||||
//双击修改
|
||||
editOrganization(node);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function addOrganization() {
|
||||
$('#OrganizationFM').form('clear');
|
||||
$('#organizationDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加机构信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$("#orgAbr").val("").focus();
|
||||
$("#orgParentName").val("");
|
||||
$("#orgParentNo").val("");
|
||||
$("#orgFullName").val("");
|
||||
$("#orgTpcd").val("");
|
||||
$("#orgStcd").val("");
|
||||
$("#orgNo").val("");
|
||||
$("#sort").val("");
|
||||
$("#orgCreateTime").val("");
|
||||
$("#orgStopTime").val("");
|
||||
$("#remark").val("");
|
||||
$("#id").val("");
|
||||
url = '/organization/addOrganization';
|
||||
}
|
||||
function editOrganization(node) {
|
||||
var id=node.id;
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: '/organization/findById',
|
||||
dataType: "json",
|
||||
data: ({
|
||||
id: id
|
||||
}),
|
||||
success: function(res) {
|
||||
if(res) {
|
||||
if(res.code!=200){
|
||||
$.messager.alert('提示', res.msg, 'error');
|
||||
return;
|
||||
}
|
||||
$('#organizationFM').form('clear');
|
||||
$('#organizationDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 修改机构信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$("#orgAbr").val(res.data.orgAbr).focus();
|
||||
$("#orgParentName").val(res.data.orgParentName);
|
||||
$("#orgParentNo").val(res.data.orgParentNo);
|
||||
$("#orgFullName").val(res.data.orgFullName);
|
||||
$("#orgTpcd").val(res.data.orgTpcd);
|
||||
$("#orgStcd").val(res.data.orgStcd);
|
||||
$("#orgNo").val(res.data.orgNo);
|
||||
$("#orgFullName").val(res.data.orgFullName);
|
||||
$("#sort").val(res.data.sort);
|
||||
$("#orgCreateTime").val(res.data.orgCreateTime);
|
||||
$("#orgStopTime").val(res.data.orgStopTime);
|
||||
$("#remark").val(res.data.remark);
|
||||
$("#id").val(res.data.id);
|
||||
url = '/organization/editOrganization';
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('提示', '修改机构信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//批量删除机构信息
|
||||
function batDeleteOrganization() {
|
||||
var nodes = $('#tt').tree('getChecked');
|
||||
if (nodes.length == 0) {
|
||||
$.messager.alert('删除提示', '没有记录被选中!', 'info');
|
||||
return;
|
||||
}
|
||||
if (nodes.length > 0) {
|
||||
$.messager.confirm('删除确认', '确定要删除选中的' + nodes.length + '条机构信息吗?', function (r) {
|
||||
if (r) {
|
||||
var ids = "";
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (i == nodes.length - 1) {
|
||||
ids += nodes[i].id;
|
||||
break;
|
||||
}
|
||||
//alert(row[i].id);
|
||||
ids += nodes[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/organization/batchDeleteOrganization",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
ids: ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res.code!=200){
|
||||
$.messager.alert('提示', res.msg, 'error');
|
||||
return;
|
||||
}
|
||||
$('#tt').tree('reload');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示', '删除机构信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//保存信息
|
||||
$("#saveOrganization").off("click").on("click", function () {
|
||||
if (!$("#orgAbr").val()) {
|
||||
$.messager.alert('提示', '机构名称不能为空!', 'warning');
|
||||
return;
|
||||
}
|
||||
var objInfo = $("#organizationFM").serializeObject();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: ({
|
||||
info: JSON.stringify(objInfo)
|
||||
}),
|
||||
success: function(res) {
|
||||
if(res) {
|
||||
if(res.code!=200){
|
||||
$.messager.alert('提示', res.msg, 'error');
|
||||
return;
|
||||
}
|
||||
$('#organizationDlg').dialog('close');
|
||||
//加载完以后重新初始化
|
||||
$('#tt').tree('reload');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('提示', '保存机构信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
//查询父级机构信息
|
||||
$("#lookForSelectOrganization").on("click", function () {
|
||||
$('#forSelectOrganizationDlg').dialog({
|
||||
title: '机构选择',
|
||||
width: webW/2,
|
||||
height: webH/2,
|
||||
closed: false,
|
||||
cache: false,
|
||||
href: '/pages/manage/organization_forselect.html',
|
||||
modal: true,
|
||||
resizable:true
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user