123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
- <jsp:include page="../../common/include.jsp" />
- <% String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
- <script type="text/javascript">
- /**用户显示区*/
- $(function() {
- $.ajax({
- type: "post",
- dataType: "json",
- url: "columnSetAction_listColumn?tname=foreignCompany",
- complete :function(){$("#load").hide();},
- success: function(msg){
- if(msg.success){
- setId();
- var data = msg.obj;
- for(var i = 0;i<data.length;i++){
- if("1"==data[i].type){
- if(typeof(data[i].formatter)!="undefined"){
- data[i].formatter=eval(data[i].formatter);
- }
- user_columns.push(data[i]);
- }else{
- user_frozenColumns.push(data[i]);
- }
- }
- columns.push(user_columns);
- frozenColumns.push(user_frozenColumns);
-
- $('#foreignCompanyDataGrid').datagrid({
- rownumbers:true,
- fit:true,
- pageSize:20,
- pageList : [ 10, 20, 30, 40, 50 ],
- fitColumns:false,
- border:false,
- sortOrder:'desc',
- pagination:true,
- idField:'id',
- url:whzl.basePath + '/foreignCompanyAction_list',
- toolbar:'#searchtool',
- checkOnSelect:true,
- selectOnCheck:true,
- singleSelect:true,
- showFooter: true,
- columns:columns,
- frozenColumns:frozenColumns,
- loadFilter:function(result){
- if(result.success){
- return result.obj;
- }else{
- $.messager.alert("提示",result.message);
- return ;
- }
- }
- });
- toolBar("foreignCompanyDataGrid","setForeignCompanyDialog","foreignCompany");
- }
- }
- });
-
- /* $('#foreignCompanyDataGrid').datagrid({
- rownumbers:true,
- fit:true,
- pageSize:20,
- pageList : [ 10, 20, 30, 40, 50 ],
- fitColumns:false,
- border:false,
- sortOrder:'desc',
- pagination:true,
- idField:'id',
- url:whzl.basePath + '/foreignCompanyAction_list',
- toolbar:'#searchtool',
- checkOnSelect:true,
- selectOnCheck:false,
- nowrap:true,
- loadFilter:function(result){
- if(result.success){
- return result.obj;
- }else{
- $.messager.alert("提示",result.message);
- return ;
- }
- }
- }
- );*/
- });
-
- /**查询*/
- function searchFun(){
- /*var params = encodeURI("foreignCompany.name="+trim($('#name').val())+
- "&foreignCompany.contacts="+trim($('#contacts').val())
- );*/
- $("#foreignCompanyDataGrid").datagrid("load", {
- "foreignCompany.name":$("#tblQuery").find("input[id='name']").val(),
- "foreignCompany.contacts":$("#tblQuery").find("input[id='contacts']").val()
- });
- $('#foreignCompanyDataGrid').datagrid({url:whzl.basePath + '/foreignCompanyAction_list',pageNumber:1});
- $('#foreignCompanyDataGrid').datagrid({
- columns:columns,
- frozenColumns:frozenColumns
- //url:whzl.basePath + '/foreignCompanyAction_list?'+params,pageNumber:1
- });
- toolBar("foreignCompanyDataGrid","setForeignCompanyDialog","foreignCompany");
-
- }
-
- /*清除查询条件**/
- function ClearQuery() {
- $("#tblQuery").find("input").val("");
- $("#tblQuery").find("select").val("-1");
- }
-
- /**录入人*/
- var userNameFormatter = function(value , row , index){
- return row.createUser.fullName;
- };
-
- /**详细*/
- var detailsFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/js/easyui/themes/itemicon/detail.png' title='查看详情' onclick=foreignCompanyDetails(" + row.id + ") style='cursor:pointer' />";
- };
-
-
- /**详细页面对话框*/
- var foreignCompanyDetails = function(id){
- $("#detailforeignCompanyDialog").dialog(
- {
- buttons : [
- {
- text : '确定',
- iconCls : 'icon-ok',
- handler : function(){
- $("#detailforeignCompanyDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "foreignCompanyAction_findById",//要访问的后台地址
- data: "foreignCompany.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- $("#name_detail").html(msg.obj.name);
- $("#address_detail").html(msg.obj.address);
- $("#contacts_detail").html(msg.obj.contacts);
- $("#phone_detail").html(msg.obj.phone);
- }
- });
- }
- }
- );
- };
-
- /**更新*/
- var updateFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/images/pencil.png' title='修改' onclick=updateRow(" + row.id + ") style='cursor:pointer' />";
- };
-
- /**更新事件*/
- function updateRow(){
- //var updateIndex = $('#foreignCompanyDataGrid').datagrid('getRowIndex', id);
- var row = $('#foreignCompanyDataGrid').datagrid('getSelected');
- if(row == null){
- $.messager.alert("提示","请先选择要修改的外方单位!");
- }
- var id = row.id;
- $('#updateforeignCompanyDialog').dialog(
- {
- buttons : [
- {
- text : '提交',
- iconCls : 'icon-ok',
- handler : function(){
- $('#updateForeignCompanyForm').form('submit',
- {
- url : whzl.basePath+'/foreignCompanyAction_update',
- success : function(result){
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- //修改完数据,更新对应行的数据
- $("#updateforeignCompanyDialog").dialog("close");
- $('#foreignCompanyDataGrid').datagrid('reload');
- }else{
- $.messager.alert("提示",parseResult.message);
- }
- }
- }
- );
- }
- },
- {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function(){
- $("#updateforeignCompanyDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "foreignCompanyAction_findById",//要访问的后台地址
- data: "foreignCompany.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- $("#id_update").val(msg.obj.id);
- $("#name_update").val(msg.obj.name);
- $("#address_update").val(msg.obj.address);
- $("#contacts_update").val(msg.obj.contacts);
- $("#phone_update").val(msg.obj.phone);
- }
- });
- }
- }
- );
- }
- /**增加用户*/
- function add(){
- $('#addforeignCompanyDialog').dialog(
- {
- buttons : [
- {
- text : '提交',
- iconCls : 'icon-ok',
- handler : function(){
- $('#addForeignCompanyForm').form('submit',
- {
- url : whzl.basePath+'/foreignCompanyAction_add',
- success : function(result){
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- $("#addforeignCompanyDialog").dialog("close");
- $('#foreignCompanyDataGrid').datagrid('reload');
- }else{
- $.messager.alert("提示",parseResult.message);
- }
- }
- }
- );
- }
- },
- {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function(){
- $("#addforeignCompanyDialog").dialog("close");
- }
- }
- ]
- }
- );
- }
- /**删除*/
- var delFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/images/edit_remove.png' title='删除' onclick=deleteRow(" + row.id + ") style='cursor:pointer' />";
- };
-
- /**删除功能*/
- function deleteRow(){
- var row = $('#foreignCompanyDataGrid').datagrid('getSelected');
- if(row == null){
- $.messager.alert("提示","请先选择要删除的外方单位!");
- }
- var id = row.id;
- $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
- if (r){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "foreignCompanyAction_delete",//要访问的后台地址
- data: "foreignCompany.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- $.messager.alert('提示','删除成功!');
- $('#foreignCompanyDataGrid').datagrid('reload');
- }else{
- $.messager.alert('提示','删除失败!');
- }
- }
- });
- }
- });
- }
- </script>
- <div class="easyui-layout" data-options="fit:true,border:false">
- <div data-options="region:'center',border:false">
- <div id="searchtool" data-options="region:'north' , border:false">
- <div class="clear"></div>
- <table id="tblQuery" style="width:100%;">
- <tr>
- <td align="right" style="width: 10%;"><span>单位名称</span></td><td style="width: 10%;"><input id="name" type="text" style="width: 140px;"/></td>
- <td align="right" style="width: 8%;"><span>单位联系人</span></td><td style="width: 14%;"><input id="contacts" type="text" style="width: 100px;"/></td>
- <td align="left" style="width: 58%;">
- <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
- <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
- <a href="javascript:add();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">增加</a>
- <a href="javascript:updateRow();" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">修改</a>
- <a href="javascript:deleteRow();" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>
- </td>
- </tr>
- </table>
- <div class="clear"></div>
- </div>
-
- <table id="foreignCompanyDataGrid">
- <!--<thead frozen="true">
- <tr>
- <th data-options="field:'id',checkbox:true,width:30">ID</th>
- </tr>
- </thead>
- <thead>
- <tr>
- <th data-options="field:'name',sortable:true,width:150">单位名称</th>
- <th data-options="field:'address',sortable:true,width:200">单位地址</th>
- <th data-options="field:'contacts',sortable:true,width:100">单位联系人</th>
- <th data-options="field:'phone',align:'center',width:100">单位联系电话</th>
- <th data-options="field:'userName',align:'center',width:100,formatter:userNameFormatter">录入人</th>
- <th data-options="field:'details',align:'center',width:60,formatter:detailsFormatter">查看详情</th>
- <th data-options="field:'update',align:'center',width:38,formatter:updateFormatter">修改</th>
- <th data-options="field:'delete',align:'center',width:38,formatter:delFormatter">删除</th>
- </tr>
- </thead>-->
- </table>
-
- </div>
- </div>
- <div id="detailforeignCompanyDialog" data-options="title:' 外方单位详细信息',iconCls:'icon-details',width:500,height:250,modal:true,href:'<%=basePath %>/foreignCompanyAction_toDetail'">
- </div>
- <div id="updateforeignCompanyDialog" data-options="title:' 修改外方单位信息',iconCls:'icon-edit',width:500,height:250,modal:true,href:'<%=basePath %>/foreignCompanyAction_toUpdate'">
- </div>
- <div id="addforeignCompanyDialog" data-options="title:' 增加外方单位信息',iconCls:'icon-add',width:500,height:250,modal:true,href:'<%=basePath %>/foreignCompanyAction_toAdd'">
- </div>
- <div id="setForeignCompanyDialog" data-options="title:' 个性化设置',iconCls:'icon-cog',width:500,height:370,modal:true,href:'<%=basePath %>/columnSetAction_toSet?tname=foreignCompany'">
- </div>
- <script type="text/javascript">
- parent.$.messager.progress('close');
- </script>
|