联动地图完成
This commit is contained in:
		| @@ -38,22 +38,22 @@ export class DvCompData { | ||||
|     staticData: "静态数据", dynamicData: "动态数据", apiData: "接口数据", htmlData: "HTML数据" | ||||
|   } | ||||
|  | ||||
|   constructor(type, dataConfig = {}, instance) { | ||||
|   constructor(dataConfig = {dataType: ""}, instance) { | ||||
|     this.instance = instance | ||||
|     this.type = type | ||||
|     this.type = dataConfig.dataType | ||||
|     this.params = dataConfig | ||||
|   } | ||||
|  | ||||
|   getData() { | ||||
|   getData(params) { | ||||
|     return this.type == 'staticData' ? this.getStaticData() : | ||||
|       this.type == 'htmlData' ? this.getStaticData() : | ||||
|         this.type == 'dynamicData' ? this.getDynamicData() : | ||||
|           this.type == 'apiData' ? this.getApiData() : [] | ||||
|         this.type == 'dynamicData' ? this.getDynamicData(params) : | ||||
|           this.type == 'apiData' ? this.getApiData(params) : Promise.resolve([]) | ||||
|   } | ||||
|  | ||||
|   getDynamicData() { | ||||
|   getDynamicData(params) { | ||||
|     const {sourceDataId: id} = this.params | ||||
|     return id ? this.getAsyncData(`/app/appdiylargescreen/statisticsByLsid?id=${id}`) : Promise.reject("未获取到数据源id") | ||||
|     return id ? this.getAsyncData(`/app/appdiylargescreen/statisticsByLsid?id=${id}`, params) : Promise.reject("未获取到数据源id") | ||||
|   } | ||||
|  | ||||
|   getStaticData() { | ||||
| @@ -63,13 +63,13 @@ export class DvCompData { | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   getApiData() { | ||||
|   getApiData(params) { | ||||
|     const {api} = this.params | ||||
|     return api ? this.getAsyncData(api) : Promise.reject("未获取到api") | ||||
|     return api ? this.getAsyncData(api, params) : Promise.reject("未获取到api") | ||||
|   } | ||||
|  | ||||
|   getAsyncData(api) { | ||||
|     return this.instance.post(api).then(res => { | ||||
|   getAsyncData(api, params) { | ||||
|     return this.instance.post(api, null, {params}).then(res => { | ||||
|       if (res?.data) { | ||||
|         const list = res.data, | ||||
|           firstRecord = list?.[0] || {}, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user