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 @@ +