123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- <%@ 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">
- //区
- var areaObj = null;
-
- var area_array = null;
-
- //获取区
- $.ajax({
- type: "post",//使用post方法访问后台
- dataType: "json",//返回json格式的数据
- url: "houseRegisterAction_listChildren",//要访问的后台地址
- //data:{"id":id},
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- areaObj = msg.obj.rows;
- var select_arr = [];
- var data = areaObj;
- for(var nItem = 0; nItem < data.length; nItem++ ){
- select_arr.push("<option value="+data[nItem].id+">"+data[nItem].name+"</option>");
- }
- area_array = select_arr.join("");
- $("#area").append(area_array);
- }
- }
- });
- /**小区显示区*/
- $(function() {
- $('#communityDataGrid').datagrid({
- rownumbers:true,
- fit:true,
- pageSize:10,
- pageList : [ 10, 20, 30, 40, 50 ],
- fitColumns:false,
- border:false,
- sortOrder:'desc',
- pagination:true,
- idField:'id',
- url:whzl.basePath + '/communityAction_listCommunity',
- 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(){
-
- $("#communityDataGrid").datagrid("load", {
- "community.name":trim($("#name").val()),
- "community.area":$("#tblQuery").find("select[id='area']").val()
- });
- }
-
- /*清除查询条件**/
- function ClearQuery() {
- $("#tblQuery").find("input").val("");
- $("#tblQuery").find("select").val("-1");
- }
-
- /**详细*/
- var detailsFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/js/easyui/themes/itemicon/detail.png' title='查看详情' onclick=communityDetails(" + row.id + ") style='cursor:pointer' />";
- };
-
- /**创建人*/
- var createByFormatter = function(value , row , index){
- return row.createdUser.fullName;
- };
-
- /**修改人*/
- var modifiedByFormatter = function(value , row , index){
- if(row.modifiedUser != null){
- return row.modifiedUser.fullName;
- }
- };
-
- /**区域*/
- var areaFormatter = function(value , row , index){
- for(var nItem = 0; nItem < areaObj.length; nItem++ ){
- if(areaObj[nItem].id == value){
- return areaObj[nItem].name;
- break;
- }
- }
- };
-
- /**详细页面对话框*/
- var communityDetails = function(id){
- $("#detailCommunityDialog").dialog(
- {
- buttons : [
- {
- text : '确定',
- iconCls : 'icon-ok',
- handler : function(){
- $("#detailCommunityDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "communityAction_findById",//要访问的后台地址
- data: "community.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- $("#name_detail").text(msg.obj.name);
- $("#phone_detail").text(msg.obj.phone);
- $("#contacts_detail").text(msg.obj.contacts);
- $("#address_detail").text(msg.obj.address);
- $("#remark_detail").text(msg.obj.remark);
- $("#createBy_detail").text(msg.obj.createdUser.fullName);
- $("#createOn_detail").text(msg.obj.createdOn);
- $("#abbreviation_detail").text(msg.obj.abbreviation);
- $("#price_detail").text(msg.obj.price);
- $("#garagePrice_detail").text(msg.obj.garagePrice);
- if (typeof(msg.obj.modifiedOn) != "undefined") {
- $("#modifiedBy_tr").show();
- $("#modifiedOn_detail").text(msg.obj.modifiedOn);
- $("#modifiedBy_detail").text(msg.obj.modifiedUser.fullName);
- }
- for(var nItem = 0; nItem < areaObj.length; nItem++ ){
- if(areaObj[nItem].id == msg.obj.area){
- $("#area_detail").text(areaObj[nItem].name);
- }
- }
- }
- });
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "communityAction_workRecord",//要访问的后台地址
- data: "community.id="+id,//要发送的数据
- complete :function(){$("#load").hide();}
- })
- }
- }
- );
- };
-
-
-
- /**更新*/
- var updateFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/images/pencil.png' title='修改' onclick=updateRow(" + row.id + ") style='cursor:pointer' />";
- };
-
- /**更新事件*/
- function updateRow(){
- var row = $('#communityDataGrid').datagrid('getSelected');
- if(row == null){
- $.messager.alert("提示","请先选择要修改的房源!");
- }
- var id = row.id;
- $('#updateCommunityDialog').dialog(
- {
- buttons : [
- {
- text : '提交',
- iconCls : 'icon-ok',
- handler : function(){
- $('#updateCommunityForm').form('submit',
- {
- url : whzl.basePath+'/communityAction_updateCommunity',
- success : function(result){
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- $("#updateCommunityDialog").dialog("close");
- $('#communityDataGrid').datagrid('reload');
- }else{
- $.messager.alert("提示",parseResult.message);
- }
- }
- }
- );
- }
- },
- {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function(){
- $("#updateCommunityDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $("#area_update").append(area_array);
-
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "communityAction_findById",//要访问的后台地址
- data: "community.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- $("#id_update").val(msg.obj.id);
- $("#name_update").val(msg.obj.name);
- $("#area_update").val(msg.obj.area);
- $("#address_update").val(msg.obj.address);
- $("#contacts_update").val(msg.obj.contacts);
- $("#phone_update").val(msg.obj.phone);
- $("#remark_update").val(msg.obj.remark);
- $("#abbreviation_update").val(msg.obj.abbreviation);
- $("#price_update").numberbox('setValue', msg.obj.price);
- $("#garagePrice_update").numberbox('setValue', msg.obj.garagePrice);
- $("#btprice1_update").numberbox('setValue', msg.obj.btprice1);
- $("#btprice2_update").numberbox('setValue', msg.obj.btprice2);
- $("#btprice3_update").numberbox('setValue', msg.obj.btprice3);
- $("#ssprice1_update").numberbox('setValue', msg.obj.ssprice1);
- $("#ssprice2_update").numberbox('setValue', msg.obj.ssprice2);
- $("#ssprice3_update").numberbox('setValue', msg.obj.ssprice3);
- }
- });
- }
- }
- );
- }
-
- /**删除*/
- var delFormatter = function(value , row , index){
- return "<img src='<%=basePath%>/images/edit_remove.png' title='删除' onclick=deleteRow(" + row.id+",'"+row.name + "') style='cursor:pointer' />";
- };
-
- /**删除功能*/
- function deleteRow(){
- var row = $('#communityDataGrid').datagrid('getSelected');
- var id = row.id;
- var name = row.name;
- $.messager.confirm('删除提示', '确定删除这条记录吗?', function(r){
- if (r){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- url: "communityAction_deleteCommunity",//要访问的后台地址
- data: "community.id="+id,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- $.messager.alert('提示','删除成功!');
- $('#communityDataGrid').datagrid('reload');
- }else{
- $.messager.alert('提示',msg.message);
- }
- }
- });
- }
- });
- }
-
- /**增加小区*/
- function communityAdd(){
- $('#addCommunityDialog').dialog(
- {
- closable: false,
- buttons : [
- {
- text : '提交',
- iconCls : 'icon-ok',
- handler : function(){
- parent.$.messager.progress({
- title : '提示',
- text : '保存中,请稍后....'
- });
- $('#addCommunityForm').form('submit',
- {
- url : whzl.basePath+'/communityAction_addCommunity',
- onSubmit: function(){
- var isValid =$('#addCommunityForm').form('validate');
- if(isValid == false){
- parent.$.messager.progress('close');
- }
- return isValid;
- },
- success : function(result){
- parent.$.messager.progress('close');
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- $("#addCommunityDialog").dialog("close");
- searchFun();
- }else{
- $.messager.alert("提示",parseResult.message);
- }
- }
- }
- );
- }
- },
- {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function(){
- $("#addCommunityDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- $("#area_add").append(area_array);
- }
- }
- );
- }
-
- function showTree(){
- $('#treeDialog').dialog(
- {
- title: '选择小区',
- href : whzl.basePath + '/communityAction_toTree.do',
- width: 600,
- height: 400
- }
- );
- }
-
- </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%;font-size:12px;">
- <tr>
- <td align="right" width="80px"><span>县区</span></td>
- <td width="100px">
- <select id="area" style="width:100px">
- <option value="">全部</option>
- </select>
- </td>
- <td align="right"><span>小区名称</span></td>
- <td width="250px"><input id="name" name="community.name" type="text"/></td>
- <td align="left">
- <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:communityAdd();" 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="communityDataGrid">
- <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:'price',sortable:true,width:100">小区单价(元)</th>
- <th data-options="field:'garagePrice',sortable:true,width:100">车库单价(元)</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="detailCommunityDialog" data-options="title:' 小区详细信息',iconCls:'icon-details',width:700,height:350,modal:true,href:'<%=basePath %>/communityAction_toDetail'">
- </div>
- <div id="updateCommunityDialog" data-options="title:' 修改小区信息',iconCls:'icon-edit',width:700,height:350,modal:true,href:'<%=basePath %>/communityAction_toUpdate'">
- </div>
- <div id="addCommunityDialog" data-options="title:' 增加小区信息',iconCls:'icon-add',width:700,height:350,modal:true,href:'<%=basePath %>/communityAction_toAdd'">
- </div>
- <div id="setCommunityDialog" data-options="title:' 个性化设置',iconCls:'icon-cog',width:500,height:370,modal:true,href:'<%=basePath %>/columnSetAction_toSet?tname=community'">
- </div>
- <script type="text/javascript">
- <!--
- $(function(){
- parent.$.messager.progress('close');
- });
- //-->
- </script>
|