From d96a9ccc7ad7daea62cd18f0abeb77ab6439e1b2 Mon Sep 17 00:00:00 2001 From: TS-QD1 Date: Thu, 16 Nov 2023 15:03:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=88=BF=E5=B1=8B=E7=BB=BC?= =?UTF-8?q?=E5=90=88=E7=AE=A1=E7=90=86=E3=80=81=E5=BF=AB=E9=80=9F=E5=BB=BA?= =?UTF-8?q?=E6=88=BF=E3=80=81=E6=89=B9=E9=87=8F=E5=BB=BA=E6=88=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../route/house/HouseRouteController.java | 14 +- .../templates/house/list-summary.html | 154 ++++++-- .../resources/templates/house/save-batch.html | 337 ++++++++++++++++++ .../resources/templates/house/save-quick.html | 101 ++++++ 4 files changed, 578 insertions(+), 28 deletions(-) create mode 100644 src/main/resources/templates/house/save-batch.html create mode 100644 src/main/resources/templates/house/save-quick.html diff --git a/src/main/java/com/cm/population/controller/route/house/HouseRouteController.java b/src/main/java/com/cm/population/controller/route/house/HouseRouteController.java index 0e5dd64..106f6e6 100644 --- a/src/main/java/com/cm/population/controller/route/house/HouseRouteController.java +++ b/src/main/java/com/cm/population/controller/route/house/HouseRouteController.java @@ -50,14 +50,18 @@ public class HouseRouteController extends AbstractController { return new ModelAndView("house/list-myself"); } - @GetMapping("save-batch") - public ModelAndView saveBatch() { - return new ModelAndView("house/save-batch"); - } - @GetMapping("list-summary") public ModelAndView listSummary() { return new ModelAndView("house/list-summary"); } + @GetMapping("save-quick") + public ModelAndView saveQuick() { + return new ModelAndView("house/save-quick"); + } + @GetMapping("save-batch") + public ModelAndView saveBatch() { + return new ModelAndView("house/save-batch"); + } + } \ No newline at end of file diff --git a/src/main/resources/templates/house/list-summary.html b/src/main/resources/templates/house/list-summary.html index fd9f25d..09c6560 100644 --- a/src/main/resources/templates/house/list-summary.html +++ b/src/main/resources/templates/house/list-summary.html @@ -64,9 +64,9 @@
@@ -74,10 +74,10 @@
-
- - - +
@@ -115,6 +115,8 @@ community: '', housingEstate: '', buildingId: '', + buildingFloorsNum: '', + buildingUnitNum: '', } var buildingPager = { currentPage: 1, @@ -208,20 +210,42 @@ } var renderBuilding = function() { - var lis = ''; - $.each(buildingPager.datas, function(index, item) { - lis += `
  • ${index + 1}.${item.name}
  • `; - }); - var $treeBody = $('#treeBody'); - $treeBody.empty(); - if(lis) { - $treeBody.append(`楼宇
      ${lis}
    `); - } else { - $treeBody.append('
    暂无数据
    ') + var renderBuildingLise = function() { + var lis = ''; + $.each(buildingPager.datas, function(index, item) { + lis += `
  • ${index + 1}.${item.name}
  • `; + }); + var $treeBody = $('#treeBody'); + $treeBody.empty(); + if(lis) { + $treeBody.append(`楼/排列表
      ${lis}
    `); + } else { + $treeBody.append('
    暂无数据
    ') + } } + + var renderPageBtn = function() { + var $buildingPageBtnGroup = $('#buildingPageBtnGroup'); + if(buildingPager.totalPage > 1) { + $buildingPageBtnGroup.show(); + } else { + $buildingPageBtnGroup.hide(); + } + } + + renderBuildingLise(); + renderPageBtn(); initHouse(); } + var renderCreateBtnGroup = function() { + if(selectedRelation.buildingId) { + $('#createBtnGroup').show(); + } else { + $('#createBtnGroup').hide(); + } + } + var initBuilding = function() { selectedRelation.buildingId = ''; top.restAjax.get(top.restAjax.path('api/building/listpage', []), { @@ -236,13 +260,13 @@ buildingPager.total = data.total; buildingPager.totalPage = buildingPager.total % buildingPager.rows === 0? buildingPager.total / buildingPager.rows : Math.floor(buildingPager.total / buildingPager.rows) + 1; renderBuilding(); - }, function(code, data) { top.dialog.msg(data.msg); }) } var initHouse = function() { + renderCreateBtnGroup(); var data = { floorCount: 18, // 层 unitCount: 3, // 单元 @@ -388,7 +412,7 @@
    @@ -403,7 +427,7 @@ var initData = function() { if(!selectedRelation.buildingId) { - $top.append(`
    请选择楼宇
    `) + $top.append(`
    请选择楼/排
    `) return; } var loadLayerIndex; @@ -433,8 +457,72 @@ $lis.filter('.active').removeClass('active'); $(this).addClass('active'); selectedRelation.buildingId = this.dataset.id; + selectedRelation.buildingFloorsNum = this.dataset.floorsNum; + selectedRelation.buildingUnitNum = this.dataset.unitNum; initHouse(); }); + $(document).on('click', '#nextBuildingPageBtn', function() { + if(buildingPager.currentPage <= 1) { + return; + } + buildingPager.currentPage -= 1; + initBuilding(); + }); + $(document).on('click', '#prevBuildingPageBtn', function() { + if(buildingPager.currentPage >= buildingPager.totalPage) { + return; + } + buildingPager.currentPage += 1; + initBuilding(); + }); + // 快速创建 + $(document).on('click', '#saveQuickBtn', function() { + layer.open({ + type: 2, + title: false, + closeBtn: 0, + area: ['40%', '100%'], + offset: 'r', + shadeClose: true, + anim: 2, + content: top.restAjax.path('route/house/save-quick?buildingId={buildingId}', [selectedRelation.buildingId]), + end: function() { + initHouse(); + } + }); + }) + // 批量创建 + $(document).on('click', '#saveBatchBtn', function() { + layer.open({ + type: 2, + title: false, + closeBtn: 0, + area: ['50%', '100%'], + offset: 'r', + shadeClose: true, + anim: 2, + content: top.restAjax.path(`route/house/save-batch?buildingId={buildingId}&floorsNum={buildingFloorsNum}&unitNum={buildingUnitNum}`, [selectedRelation.buildingId, selectedRelation.buildingFloorsNum, selectedRelation.buildingUnitNum]), + end: function() { + initHouse(); + } + }); + }) + // 普通创建 + $(document).on('click', '#saveNormalBtn', function() { + layer.open({ + type: 2, + title: false, + closeBtn: 0, + area: ['40%', '100%'], + offset: 'r', + shadeClose: true, + anim: 2, + content: top.restAjax.path('route/house/save-normal?buildingId={buildingId}', [selectedRelation.buildingId]), + end: function() { + initHouse(); + } + }); + }) $('#contentBody .center').scroll(function(e) { var $top = $('#contentBody .top'); var $left = $('#contentBody .left'); @@ -464,7 +552,27 @@ }); $(document).on('click', '#contentBody .center .main .floor .unit .house .info .option .house-remove', function() { var houseId = this.dataset.id; - console.log('remove', houseId); + var name = this.dataset.name; + top.dialog.msg(`确定删除【${name}】这个房间吗?`, { + time: 0, + btn: [top.dataMessage.button.yes, top.dataMessage.button.no], + shade: 0.3, + yes: function (index) { + top.dialog.close(index); + var layIndex; + top.restAjax.delete(top.restAjax.path('api/house/remove/{ids}', [houseId]), {}, null, function (code, data) { + top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}, function() { + initHouse(); + }); + }, function (code, data) { + top.dialog.msg(data.msg); + }, function () { + layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3}); + }, function () { + top.dialog.close(layIndex); + }); + } + }); }); } @@ -488,8 +596,8 @@ var $top = $center.find('.top'); var $left = $center.find('.left'); $center.css({ - width: `${contentBody.width - 80}px`, - height: `${contentBody.height - 30}px` + width: `${contentBody.width - 100}px`, + height: `${contentBody.height - 50}px` }) } diff --git a/src/main/resources/templates/house/save-batch.html b/src/main/resources/templates/house/save-batch.html new file mode 100644 index 0000000..daafed9 --- /dev/null +++ b/src/main/resources/templates/house/save-batch.html @@ -0,0 +1,337 @@ + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/src/main/resources/templates/house/save-quick.html b/src/main/resources/templates/house/save-quick.html new file mode 100644 index 0000000..07aefaa --- /dev/null +++ b/src/main/resources/templates/house/save-quick.html @@ -0,0 +1,101 @@ + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + + + \ No newline at end of file