diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index e2f24f7..dcc5405 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -74,8 +74,8 @@ security: oauth-server: http://192.168.0.15:7021/usercenter oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url} client: - client-id: b7eadbbb122044ecb4761db0b98ade3a - client-secret: Z3A3a1AvTHRZeCtPWXVkOXJaeGFYWGp5Q2F1VlhPYVY0Q0hFMCtuQ0tkVW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg== + client-id: 00b49298399641448405170d55a3614b + client-secret: Z0RQUmZTdENUckprWVRtdGQ3Sm5ldmlCZFJKT1NBNHJZWnNrM1RSSWU3NG1ac2wwZTJHWk5NbXh3L3h3U2c4Rg== user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token grant-type: authorization_code diff --git a/src/main/resources/templates/house/list-summary.html b/src/main/resources/templates/house/list-summary.html index 09c6560..8066cdb 100644 --- a/src/main/resources/templates/house/list-summary.html +++ b/src/main/resources/templates/house/list-summary.html @@ -18,7 +18,7 @@ .layui-form-pane .layui-form-select dl {top: 60px;} #treeHeader {padding: 0 10px 10px 10px; height: auto;} #treeBody {overflow: auto;} - #treeBody ul li{border-bottom: 1px solid #f6f6f6; cursor: pointer; width: 100%;} + #treeBody ul li{border-bottom: 1px solid #f6f6f6; cursor: pointer; width: 100%; height: 28px; line-height: 28px; padding: 0 5px;} #treeBody ul li:last-child{border-bottom: none;} #treeBody ul li.active{font-weight: bold;} #treeFooter {padding: 15px; border-top: 1px solid rgb(246, 246, 246);} @@ -213,7 +213,7 @@ var renderBuildingLise = function() { var lis = ''; $.each(buildingPager.datas, function(index, item) { - lis += `
  • ${index + 1}.${item.name}
  • `; + lis += `
  • ${item.name}
  • `; }); var $treeBody = $('#treeBody'); $treeBody.empty(); @@ -391,7 +391,7 @@ for(var i = 0; i < data.units.length; i++) { var count = data.units[i].maxHouseCount; count = count > 0 ? count : 1; - top += `
    ${i + 1}单元
    `; + top += `
    ${i + 1}单元/列
    `; } return top; } @@ -412,7 +412,7 @@
    编辑 | - 删除 + 删除
    @@ -513,11 +513,11 @@ type: 2, title: false, closeBtn: 0, - area: ['40%', '100%'], + area: ['60%', '100%'], offset: 'r', shadeClose: true, anim: 2, - content: top.restAjax.path('route/house/save-normal?buildingId={buildingId}', [selectedRelation.buildingId]), + content: top.restAjax.path('route/house/save?buildingId={buildingId}', [selectedRelation.buildingId]), end: function() { initHouse(); } @@ -548,12 +548,26 @@ }); $(document).on('click', '#contentBody .center .main .floor .unit .house .info .option .house-edit', function() { var houseId = this.dataset.id; - console.log('edit', houseId); + layer.open({ + type: 2, + title: false, + closeBtn: 0, + area: ['60%', '100%'], + offset: 'r', + shadeClose: true, + anim: 2, + content: top.restAjax.path('route/house/update?houseId={houseId}', [houseId]), + end: function() { + initHouse(); + } + }); }); $(document).on('click', '#contentBody .center .main .floor .unit .house .info .option .house-remove', function() { var houseId = this.dataset.id; var name = this.dataset.name; - top.dialog.msg(`确定删除【${name}】这个房间吗?`, { + var floor = this.dataset.floor; + var unit = this.dataset.unit; + top.dialog.msg(`确定删除【${floor}楼/排 ${unit}单元/列 ${name}】这个房间吗?`, { time: 0, btn: [top.dataMessage.button.yes, top.dataMessage.button.no], shade: 0.3, diff --git a/src/main/resources/templates/house/save.html b/src/main/resources/templates/house/save.html index 184c59d..2106483 100644 --- a/src/main/resources/templates/house/save.html +++ b/src/main/resources/templates/house/save.html @@ -436,6 +436,31 @@ var form = layui.form; var laytpl = layui.laytpl; var laydate = layui.laydate; + var buildingId = top.restAjax.params(window.location.href).buildingId; + + var renderBuildInfo = function() { + var loadLayerIndex; + top.restAjax.get(top.restAjax.path('api/building/get/{buildingId}', [buildingId]), {}, null, function (code, data) { + var dataFormData = {}; + for (var i in data) { + dataFormData[i] = data[i] + ''; + } + form.val('dataForm', dataFormData); + form.render(null, 'dataForm'); + initAffiliationUnit(data.unitNum); + initAffiliationFloors(data.floorsNum); + initBuildingNameSelect(data['residentialId'], `${buildingId}_${data.unitNum}_${data.floorsNum}`); + initResidentialNameSelect(data['street'], data['community'], data['residentialId']); + initStreetNameSelect(data['street']); + initCommunityNameSelect(data['street'], data['community']); + }, function (code, data) { + top.dialog.msg(data.msg); + }, function () { + loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3}); + }, function () { + top.dialog.close(loadLayerIndex); + }); + } form.on('select(street)', function(data){ if(data.value) { @@ -462,13 +487,18 @@ }); // 初始化社区下拉选择 - function initCommunityNameSelect(areaId) { + function initCommunityNameSelect(areaId, selectedValue) { top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId=' + areaId, []), {}, null, function(code, data, args) { - console.log(data) laytpl(document.getElementById('communityNameSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('communityNameSelectTemplateBox').innerHTML = html; }); form.render('select', 'communityNameSelectTemplateBox'); + + if(selectedValue) { + var selectObj = {}; + selectObj['community'] = selectedValue; + form.val('dataForm', selectObj); + } }, function(code, data) { top.dialog.msg(data.msg); }); @@ -477,12 +507,18 @@ // 初始化街道下拉选择 initStreetNameSelect(); - function initStreetNameSelect() { + function initStreetNameSelect(selectedValue) { top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function(code, data, args) { laytpl(document.getElementById('streetNameSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('streetNameSelectTemplateBox').innerHTML = html; }); form.render('select', 'streetNameSelectTemplateBox'); + + if(selectedValue) { + var selectObj = {}; + selectObj['street'] = selectedValue; + form.val('dataForm', selectObj); + } }, function(code, data) { top.dialog.msg(data.msg); }); @@ -628,13 +664,19 @@ // 初始化所在小区下拉选择 initResidentialNameSelect('9999', '9999'); - function initResidentialNameSelect(street, community) { + function initResidentialNameSelect(street, community, selectedValue) { top.restAjax.get(top.restAjax.path('api/residential/list?street={street}&community={community}', [street, community]), {}, null, function(code, data, args) { laytpl(document.getElementById('residentialNameSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('residentialNameSelectTemplateBox').innerHTML = html; }); form.render('select', 'residentialNameSelectTemplateBox'); + + if(selectedValue) { + var selectObj = {}; + selectObj['residentialId'] = selectedValue; + form.val('dataForm', selectObj); + } }, function(code, data) { top.dialog.msg(data.msg); }); @@ -650,12 +692,18 @@ }); // 初始化楼/排下拉选择 - function initBuildingNameSelect(residentialId) { + function initBuildingNameSelect(residentialId, selectedValue) { top.restAjax.get(top.restAjax.path('api/building/list?residentialId=' + residentialId, []), {}, null, function(code, data, args) { laytpl(document.getElementById('buildingNameSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('buildingNameSelectTemplateBox').innerHTML = html; }); form.render('select', 'buildingNameSelectTemplateBox'); + + if(selectedValue) { + var selectObj = {}; + selectObj['buildingId'] = selectedValue; + form.val('dataForm', selectObj); + } }, function(code, data) { top.dialog.msg(data.msg); }); @@ -809,8 +857,12 @@ // 初始化内容 function initData() { - initBuildingNameSelect('9999'); - initCommunityNameSelect('9999'); + if(buildingId) { + renderBuildInfo(); + } else { + initBuildingNameSelect('9999'); + initCommunityNameSelect('9999'); + } } initData();