修改地区相关信息接口

This commit is contained in:
Renpc-kilig 2020-07-29 16:34:04 +08:00
parent 91a7d7d44b
commit 5837de0c13
2 changed files with 104 additions and 6 deletions

View File

@ -96,7 +96,7 @@ Page({
teamAreaArray: []
})
this.getDataFromDict(self.data.teamCity[self.data.teamCityIndex].dictionaryId, 2).then(result => {
this.getDataFromArea(self.data.teamCity[self.data.teamCityIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) {
self.setData({
teamCounty: self.data.tempObj,
@ -122,7 +122,7 @@ Page({
teamCountyIndex: e.detail.value
})
this.getDataFromDict(self.data.teamCounty[self.data.teamCountyIndex].dictionaryId, 2).then(result => {
this.getDataFromArea(self.data.teamCounty[self.data.teamCountyIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) {
self.setData({
teamArea: self.data.tempObj,
@ -256,13 +256,62 @@ Page({
})
})
},
/**
*从区域表拉取数据
*/
getDataFromArea: function(dictId, type) {
var self = this;
return new Promise(resolve => {
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/app/dataarea/listareabyparentidrelease/' + dictId, []),
{}, {
headers: {
'token': self.data.token
}
}, function(code, data) {
if('200' == code) {
if(data || type === 2) {
var array = [];
for(var item of data) {
delete item.areaParentId;
delete item.areaParentName;
delete item.areaCode;
delete item.areaCityCode;
delete item.areaMergerName;
delete item.areaShortName;
delete item.areaZipCode;
delete item.areaLevel;
delete item.areaLng;
delete item.areaLat;
delete item.areaPinyin;
delete item.areaFirst;
delete item.subArea;
delete item.parent;
array.push(item.areaName);
}
self.setData({
tempArray: array
})
}
self.setData({
tempObj: data
})
}
return resolve();
}, function() {
}, function() {
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var self = this;
this.getToken().then(result => {
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => {
this.getDataFromArea('640332', 2).then(result => {
self.setData({
teamCity: self.data.tempObj,
teamCityArray: self.data.tempArray,

View File

@ -58,7 +58,7 @@ Page({
teamAreaArray: []
})
this.getDataFromDict(self.data.teamCity[self.data.teamCityIndex].dictionaryId, 2).then(result => {
this.getDataFromArea(self.data.teamCity[self.data.teamCityIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) {
self.setData({
teamCounty: self.data.tempObj,
@ -84,7 +84,7 @@ Page({
teamCountyIndex: e.detail.value
})
this.getDataFromDict(self.data.teamCounty[self.data.teamCountyIndex].dictionaryId, 2).then(result => {
this.getDataFromArea(self.data.teamCounty[self.data.teamCountyIndex].areaId, 2).then(result => {
if(self.data.tempObj.length > 0) {
self.setData({
teamArea: self.data.tempObj,
@ -280,6 +280,55 @@ Page({
})
})
},
/**
*从区域表拉取数据
*/
getDataFromArea: function(dictId, type) {
var self = this;
return new Promise(resolve => {
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/app/dataarea/listareabyparentidrelease/' + dictId, []),
{}, {
headers: {
'token': self.data.token
}
}, function(code, data) {
if('200' == code) {
if(data || type === 2) {
var array = [];
for(var item of data) {
delete item.areaParentId;
delete item.areaParentName;
delete item.areaCode;
delete item.areaCityCode;
delete item.areaMergerName;
delete item.areaShortName;
delete item.areaZipCode;
delete item.areaLevel;
delete item.areaLng;
delete item.areaLat;
delete item.areaPinyin;
delete item.areaFirst;
delete item.subArea;
delete item.parent;
array.push(item.areaName);
}
self.setData({
tempArray: array
})
}
self.setData({
tempObj: data
})
}
return resolve();
}, function() {
}, function() {
})
})
},
getVolunteerMsg() {
var self = this;
return new Promise(resolve => {
@ -323,7 +372,7 @@ Page({
})
})
}).then(result => {
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => {
this.getDataFromArea('640332', 2).then(result => {
self.setData({
teamCity: self.data.tempObj,
teamCityArray: self.data.tempArray,