|
@@ -979,36 +979,7 @@ export default {
|
|
|
this.zhuiwen = false;
|
|
|
this.showQuery = true;
|
|
|
//模拟数据
|
|
|
- if (this.listType === '1') {
|
|
|
- const str = 'Question:用户想要打开永久基本农田图层,我需要调用LayerAgent来执行操作,已找到永久基本农田图层,任务执行中';
|
|
|
- this.hzData = [{
|
|
|
- name: '请帮我打开永久基本农田图层',
|
|
|
- summary: '',
|
|
|
- loading: true
|
|
|
- }]
|
|
|
- let index = 1;
|
|
|
- const timer1 = setInterval(() => {
|
|
|
- this.hzData[0]['summary'] += str.substring(index - 1, index)
|
|
|
- index++;
|
|
|
- if (index === str.length + 1) {
|
|
|
- const timer2 = setTimeout(() => {
|
|
|
- this.hintText = '思考完成'
|
|
|
- this.hzData = [{
|
|
|
- name: '请帮我打开永久基本农田图层',
|
|
|
- summary: `已成功打开永久基本农田图层`,
|
|
|
- loading: false
|
|
|
- }]
|
|
|
- this.showResult = true
|
|
|
- this.openYjjbnt();
|
|
|
- clearTimeout(timer2)
|
|
|
- }, 5000)
|
|
|
- _timers2.push(timer2)
|
|
|
- clearInterval(timer1);
|
|
|
- }
|
|
|
- }, 50 * index);
|
|
|
- _timers1.push(timer1)
|
|
|
- return;
|
|
|
- }else if (this.listType === '3') {
|
|
|
+ if (this.listType === '3') {
|
|
|
const str1 = 'Question: 请帮统计萧山区永久基本农田规模,Thought: 用户的需求是统计萧山区永久基本农田总面积。首先我要先打开永久基本农田图层';
|
|
|
const str2 = '图层打开操作已执行完毕。\n\n\n其次,我要定位到萧山区';
|
|
|
const str3 = '已定位到萧山区\n\n\n然后我要进行规模统计,因此选择LandSiteSelectionPlan执行用户需求最为合适。根据用户的需求,需要生成一个SQL查询语句来从永久基本农田表中统计出总面积: Action: LandFindSqlAgent Action Input: {“sql_code”: “SELECT Sum(yjjbnttbmj) FROM dlgis.gcs330000g2001_yjjbnt_gx_xsb WHERE xzqmc = ‘萧山区‘”;} \n\n\n以上是我思考的所有内容。';
|
|
@@ -1144,7 +1115,7 @@ export default {
|
|
|
this.map.removeLayer(this.xzqLayer);
|
|
|
this.xzqLayer = null;
|
|
|
}
|
|
|
- this.closeYjjbnt();
|
|
|
+ this.closeLayers();
|
|
|
},
|
|
|
locationByGeojson(geojson, name) {
|
|
|
if (this.cyyqLayer) {
|
|
@@ -1431,11 +1402,51 @@ export default {
|
|
|
this.switchMapLayer(yjjbntLayer);
|
|
|
}
|
|
|
},
|
|
|
- closeYjjbnt () {
|
|
|
- let yjjbntLayer = this.layers[5].layers[0];
|
|
|
- if(yjjbntLayer.checked) {
|
|
|
- yjjbntLayer.checked = false;
|
|
|
- this.switchMapLayer(yjjbntLayer);
|
|
|
+ handleGisOperation(comand){
|
|
|
+ let operationGroup= comand["operations"];
|
|
|
+ operationGroup.forEach(ele=>{
|
|
|
+ let action= ele["action"]
|
|
|
+ let layer= ele["layer"]
|
|
|
+ if(action=="open"){
|
|
|
+ this.openaLayerByName(layer);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openaLayerByName (layerName) {
|
|
|
+ if(!layerName){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let layer= this.findLayer(layerName);
|
|
|
+ if(!layer){
|
|
|
+ console.log('未找到相关图层:'+layerName)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(!layer.checked) {
|
|
|
+ layer.checked = true;
|
|
|
+ this.switchMapLayer(layer);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ findLayer(layerName){
|
|
|
+ let len= this.layers.length;
|
|
|
+ for(let i =0;i<len;i++){
|
|
|
+ let layerGroup = this.layers[i].layers;
|
|
|
+ let findItem= layerGroup.find(item=>item.name == layerName);
|
|
|
+ if(findItem){
|
|
|
+ return findItem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //除底图和行政区外,其他的图层都关闭
|
|
|
+ closeLayers() {
|
|
|
+ let len= this.layers.length;
|
|
|
+ for(let i =2;i<len;i++){
|
|
|
+ let layerGroup = this.layers[i].layers;
|
|
|
+ layerGroup.forEach(item=>{
|
|
|
+ if(item.checked){
|
|
|
+ item.checked=false;
|
|
|
+ this.switchMapLayer(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
//所有地块仿百度地图绘制
|
|
@@ -1662,18 +1673,24 @@ export default {
|
|
|
.replaceAll("\n```json\n", "")
|
|
|
.replaceAll("```json\n", "")
|
|
|
.replaceAll("\n```\n", "");
|
|
|
- exec_res = JSON.parse(exec_res);
|
|
|
- var dk = exec_res;
|
|
|
-
|
|
|
- T.getDetailByIdList(dk, (data) => {
|
|
|
+ let json_exec = JSON.parse(exec_res);
|
|
|
+
|
|
|
+ if(exec_res.indexOf('operations')>-1){
|
|
|
+ T.handleGisOperation(json_exec)
|
|
|
+ } else {
|
|
|
+ var dk = json_exec;
|
|
|
+ T.getDetailByIdList(dk, (data) => {
|
|
|
T.clearMark();
|
|
|
// T.addGdLayer(data);
|
|
|
T.xgdk = data;
|
|
|
T.showXgdkCenterPoint();
|
|
|
T.addGdLayer(T.xgdk);
|
|
|
});
|
|
|
-
|
|
|
T.answer = e.data;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
T.xgdk = [];
|
|
|
T.clearMark();
|