From bf505e36ebfc1602872309acfd3fbbcd67a1666a Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Sat, 8 Mar 2025 11:54:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community/addCityArea/addCityArea.html | 53 ++++++++ .../community/addCityArea/addCityArea.js | 104 +++++++++++++++ .../community/cityAreaTree/cityAreaTree.html | 18 +++ .../community/cityAreaTree/cityAreaTree.js | 118 +++++++++++++++++ .../deleteCityArea/deleteCityArea.html | 29 +++++ .../deleteCityArea/deleteCityArea.js | 48 +++++++ .../community/editCityArea/editCityArea.html | 53 ++++++++ .../community/editCityArea/editCityArea.js | 123 ++++++++++++++++++ public/pages/community/cityArea/cityArea.html | 73 +++++++++++ public/pages/community/cityArea/cityArea.js | 53 ++++++++ 10 files changed, 672 insertions(+) create mode 100644 public/components/community/addCityArea/addCityArea.html create mode 100644 public/components/community/addCityArea/addCityArea.js create mode 100644 public/components/community/cityAreaTree/cityAreaTree.html create mode 100644 public/components/community/cityAreaTree/cityAreaTree.js create mode 100644 public/components/community/deleteCityArea/deleteCityArea.html create mode 100644 public/components/community/deleteCityArea/deleteCityArea.js create mode 100644 public/components/community/editCityArea/editCityArea.html create mode 100644 public/components/community/editCityArea/editCityArea.js create mode 100644 public/pages/community/cityArea/cityArea.html create mode 100644 public/pages/community/cityArea/cityArea.js diff --git a/public/components/community/addCityArea/addCityArea.html b/public/components/community/addCityArea/addCityArea.html new file mode 100644 index 000000000..80ac427bf --- /dev/null +++ b/public/components/community/addCityArea/addCityArea.html @@ -0,0 +1,53 @@ + \ No newline at end of file diff --git a/public/components/community/addCityArea/addCityArea.js b/public/components/community/addCityArea/addCityArea.js new file mode 100644 index 000000000..98cd6f9ab --- /dev/null +++ b/public/components/community/addCityArea/addCityArea.js @@ -0,0 +1,104 @@ +(function(vc) { + + vc.extends({ + data: { + addCityAreaInfo: { + areaCode: '', + areaName: '', + areaLevel: '', + parentAreaId: '', + parentAreaName: '', + lon: '', + lat: '', + + }, + flagOrgName: false + }, + _initMethod: function() { + + }, + _initEvent: function() { + vc.on('addCityArea', 'openAddCityAreaModal', function(_param) { + if (_param.hasOwnProperty('parentAreaCode')) { + $that.addCityAreaInfo.parentAreaCode = _param.parentAreaCode; + $that.addCityAreaInfo.areaLevel = _param.areaLevel; + $that.addCityAreaInfo.parentAreaName = _param.parentAreaName; + } + $('#addCityAreaModel').modal('show'); + }); + }, + methods: { + addCityAreaValidate: function() { + return vc.validate.validate({ + addCityAreaInfo: $that.addCityAreaInfo + }, { + 'addCityAreaInfo.areaCode': [{ + limit: "required", + param: "", + errInfo: "地区编码不能为空" + }, + ], + 'addCityAreaInfo.areaName': [{ + limit: "required", + param: "", + errInfo: "地区名称不能为空" + }, + ], + 'addCityAreaInfo.parentAreaCode': [ + + { + limit: "maxLength", + param: "200", + errInfo: "上级编码不能为空" + }, + ], + }); + }, + saveOrgInfo: function() { + if (!$that.addCityAreaValidate()) { + vc.toast(vc.validate.errInfo); + return; + } + + vc.http.apiPost( + '/area.saveCityArea', + JSON.stringify($that.addCityAreaInfo), { + emulateJSON: true + }, + function(json, res) { + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + if (res.status == 200) { + //关闭model + $('#addCityAreaModel').modal('hide'); + $that.clearAddCityAreaInfo(); + vc.emit('cityAreaTree', 'refreshTree', {}); + + return; + } + vc.toast(json); + + }, + function(errInfo, error) { + console.log('请求失败处理'); + + vc.toast(errInfo); + + }); + }, + clearAddCityAreaInfo: function() { + $that.addCityAreaInfo = { + areaCode: '', + areaName: '', + areaLevel: '', + parentAreaId: '', + parentAreaName: '', + lon: '', + lat: '', + }; + }, + + + } + }); + +})(window.vc); \ No newline at end of file diff --git a/public/components/community/cityAreaTree/cityAreaTree.html b/public/components/community/cityAreaTree/cityAreaTree.html new file mode 100644 index 000000000..a9edfa4e4 --- /dev/null +++ b/public/components/community/cityAreaTree/cityAreaTree.html @@ -0,0 +1,18 @@ +
+
+ + + +
+
+
+ + + +
\ No newline at end of file diff --git a/public/components/community/cityAreaTree/cityAreaTree.js b/public/components/community/cityAreaTree/cityAreaTree.js new file mode 100644 index 000000000..3c13b3302 --- /dev/null +++ b/public/components/community/cityAreaTree/cityAreaTree.js @@ -0,0 +1,118 @@ +/** + 入驻小区 + **/ +(function (vc) { + vc.extends({ + propTypes: { + callBackListener: vc.propTypes.string, //父组件名称 + }, + data: { + cityAreaTreeInfo: { + orgs: [], + orgId: '', + curCityArea: {} + } + }, + _initMethod: function () { + $that._loadCityAreaTrees(); + }, + _initEvent: function () { + vc.on('cityAreaTree', 'refreshTree', function (_param) { + $that._loadCityAreaTrees(); + }); + }, + methods: { + _loadCityAreaTrees: function () { + let param = { + params: { + hc: 1.8 + } + }; + //发送get请求 + vc.http.apiGet('/area.queryAreaTree', + param, + function (json) { + let _orgs = JSON.parse(json).data; + $that.cityAreaTreeInfo.orgs = _orgs; + $that._initJsTreeFloorUnit(); + }, + function () { + console.log('请求失败处理'); + }); + }, + _initJsTreeFloorUnit: function () { + let _data = $that.cityAreaTreeInfo.orgs; + $.jstree.destroy() + $("#jstree_org").jstree({ + "checkbox": { + "keep_selected_style": false + }, + 'state': { //一些初始化状态 + "opened": false, + }, + // 'plugins': ['contextmenu'], + 'core': { + 'data': _data + }, + }); + $("#jstree_org").on("ready.jstree", function (e, data) { + //data.instance.open_all(); //打开所有节点 + }); + $('#jstree_org').on("changed.jstree", function (e, data) { + if (data.action == 'model' || data.action == 'ready') { + //默认合并 + //$("#jstree_org").jstree("close_all"); + return; + } + $that.cityAreaTreeInfo.curCityArea = data.node.original; + $that.cityAreaTreeInfo.curCityArea.orgId = $that.cityAreaTreeInfo.curCityArea.id; + vc.emit($props.callBackListener, 'switchCityAreaTree', { + areaCode: data.node.original.areaCode, + areaLevel: data.node.original.areaLevel, + areaName: $that.cityAreaTreeInfo.curCityArea.text + }) + }); + // $('#jstree_org') + // .on('click', '.jstree-anchor', function(e) { + // $(this).jstree(true).toggle_node(e.target); + // }) + }, + _openAddCityAreaModal: function () { + if (!$that.cityAreaTreeInfo.curCityArea.id) { + vc.toast('未选择组织'); + return; + } + let _areaLevel = $that.cityAreaTreeInfo.curCityArea.areaLevel; + if( _areaLevel== '101'){ + _areaLevel = "202"; + }else if(_areaLevel == '202'){ + _areaLevel = "303"; + }else if(_areaLevel == '303'){ + vc.toast('不能添加子节点'); + return; + }else{ + _areaLevel = "101"; + } + vc.emit('addCityArea', 'openAddCityAreaModal', { + parentAreaCode: $that.cityAreaTreeInfo.curCityArea.areaCode, + areaLevel:_areaLevel, + parentAreaName: $that.cityAreaTreeInfo.curCityArea.text + }); + }, + _openEditCityAreaTreeModel: function () { + if (!$that.cityAreaTreeInfo.curCityArea.id) { + vc.toast('未选择组织'); + return; + } + vc.emit('editCityArea', 'openEditCityAreaModal', $that.cityAreaTreeInfo.curCityArea); + }, + _openDeleteCityAreaTreeModel: function () { + if (!$that.cityAreaTreeInfo.curCityArea.id) { + vc.toast('未选择组织'); + return; + } + vc.emit('deleteCityArea', 'openDeleteCityAreaModal', $that.cityAreaTreeInfo.curCityArea); + }, + } + }); +})(window.vc); \ No newline at end of file diff --git a/public/components/community/deleteCityArea/deleteCityArea.html b/public/components/community/deleteCityArea/deleteCityArea.html new file mode 100644 index 000000000..3df0e67ae --- /dev/null +++ b/public/components/community/deleteCityArea/deleteCityArea.html @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/public/components/community/deleteCityArea/deleteCityArea.js b/public/components/community/deleteCityArea/deleteCityArea.js new file mode 100644 index 000000000..5d48c9178 --- /dev/null +++ b/public/components/community/deleteCityArea/deleteCityArea.js @@ -0,0 +1,48 @@ +(function(vc, vm) { + + vc.extends({ + data: { + deleteCityAreaInfo: { + + } + }, + _initMethod: function() { + + }, + _initEvent: function() { + vc.on('deleteCityArea', 'openDeleteCityAreaModal', function(_params) { + $that.deleteCityAreaInfo = _params; + $('#deleteCityAreaModel').modal('show'); + }); + }, + methods: { + deleteCityArea: function() { + vc.http.apiPost( + '/area.deleteCityArea', + JSON.stringify($that.deleteCityAreaInfo), { + emulateJSON: true + }, + function(json, res) { + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + let _json = JSON.parse(json); + if (_json.code == 0) { + //关闭model + $('#deleteCityAreaModel').modal('hide'); + vc.emit('cityAreaTree', 'refreshTree', {}); + return; + } + vc.toast(_json.msg); + }, + function(errInfo, error) { + console.log('请求失败处理'); + vc.toast(json); + + }); + }, + closeDeleteCityAreaModel: function() { + $('#deleteCityAreaModel').modal('hide'); + } + } + }); + +})(window.vc, window.$that); \ No newline at end of file diff --git a/public/components/community/editCityArea/editCityArea.html b/public/components/community/editCityArea/editCityArea.html new file mode 100644 index 000000000..c21249dea --- /dev/null +++ b/public/components/community/editCityArea/editCityArea.html @@ -0,0 +1,53 @@ + \ No newline at end of file diff --git a/public/components/community/editCityArea/editCityArea.js b/public/components/community/editCityArea/editCityArea.js new file mode 100644 index 000000000..83b0027cb --- /dev/null +++ b/public/components/community/editCityArea/editCityArea.js @@ -0,0 +1,123 @@ +(function(vc) { + + vc.extends({ + data: { + editCityAreaInfo: { + id:'', + areaCode: '', + areaName: '', + areaLevel: '', + parentAreaId: '', + parentAreaName: '', + parentAreaCode:'', + lon: '', + lat: '', + + }, + flagOrgName: false + }, + _initMethod: function() { + + }, + _initEvent: function() { + vc.on('editCityArea', 'openEditCityAreaModal', function(_param) { + vc.copyObject(_param,$that.editCityAreaInfo); + $that.loadEditCityArea(); + $('#editCityAreaModel').modal('show'); + }); + }, + methods: { + editCityAreaValidate: function() { + return vc.validate.validate({ + editCityAreaInfo: $that.editCityAreaInfo + }, { + 'editCityAreaInfo.areaCode': [{ + limit: "required", + param: "", + errInfo: "地区编码不能为空" + }, + ], + 'editCityAreaInfo.areaName': [{ + limit: "required", + param: "", + errInfo: "地区名称不能为空" + }, + ], + 'editCityAreaInfo.parentAreaCode': [ + { + limit: "maxLength", + param: "200", + errInfo: "上级编码不能为空" + }, + ], + }); + }, + _editCityArea: function() { + if (!$that.editCityAreaValidate()) { + vc.toast(vc.validate.errInfo); + return; + } + + vc.http.apiPost( + '/area.updateCityArea', + JSON.stringify($that.editCityAreaInfo), { + emulateJSON: true + }, + function(json, res) { + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + if (res.status == 200) { + //关闭model + $('#editCityAreaModel').modal('hide'); + $that.clearEditCityAreaInfo(); + vc.emit('cityAreaTree', 'refreshTree', {}); + + return; + } + vc.toast(json); + + }, + function(errInfo, error) { + console.log('请求失败处理'); + + vc.toast(errInfo); + + }); + }, + clearEditCityAreaInfo: function() { + $that.editCityAreaInfo = { + id:'', + areaCode: '', + areaName: '', + areaLevel: '', + parentAreaId: '', + parentAreaCode:'', + parentAreaName: '', + lon: '', + lat: '', + }; + }, + loadEditCityArea:function(){ + let param = { + params: { + id: $that.editCityAreaInfo.id, + page:1, + row:1 + } + }; + //发送get请求 + vc.http.apiGet('/area.listAreas', + param, + function (json) { + let _cityArea = JSON.parse(json).areas; + vc.copyObject(_cityArea[0],$that.editCityAreaInfo); + }, + function () { + console.log('请求失败处理'); + }); + } + + + } + }); + +})(window.vc); \ No newline at end of file diff --git a/public/pages/community/cityArea/cityArea.html b/public/pages/community/cityArea/cityArea.html new file mode 100644 index 000000000..44c4b8036 --- /dev/null +++ b/public/pages/community/cityArea/cityArea.html @@ -0,0 +1,73 @@ +
+
+ +
+
+
+
+
+ 地区详情 +
+
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+
+
\ No newline at end of file diff --git a/public/pages/community/cityArea/cityArea.js b/public/pages/community/cityArea/cityArea.js new file mode 100644 index 000000000..6045b7017 --- /dev/null +++ b/public/pages/community/cityArea/cityArea.js @@ -0,0 +1,53 @@ +/** +业主详情页面 + **/ +(function (vc) { + vc.extends({ + data: { + cityAreaInfo: { + id: '', + areaCode: '', + areaName: '', + areaLevel:'', + parentAreaCode: '', + parentAreaName: '', + } + }, + _initMethod: function () { + + }, + _initEvent: function () { + vc.on('cityArea','switchCityAreaTree',function(_param){ + $that.cityAreaInfo.id = _param.id; + $that.cityAreaInfo.areaCode = _param.areaCode; + $that.cityAreaInfo.areaName = _param.areaName; + $that._listCityArea(); + }); + }, + methods: { + _listCityArea: function () { + + let param = { + params: { + page:1, + row:1, + areaCode:$that.cityAreaInfo.areaCode, + id:$that.cityAreaInfo.id, + } + }; + + //发送get请求 + vc.http.apiGet('/area.listAreas', + param, + function (json, res) { + let _json = JSON.parse(json); + vc.copyObject(_json.data[0],$that.cityAreaInfo); + }, function (errInfo, error) { + console.log('请求失败处理'); + } + ); + }, + + } + }); +})(window.vc); \ No newline at end of file