物理沙盘
This commit is contained in:
@ -25,14 +25,14 @@
|
||||
<input v-bind="searchKey" style="width: 50px;" id="keyword" type="text"
|
||||
:placeholder="$t('btn.treePlaceholder')" @input="clearResult" @change="searchPlace" />
|
||||
<el-button type="primary" plain id="queryButton" size="small" @click="searchPlace" :loading="loading">{{
|
||||
$t("btn.search") }}
|
||||
$t("btn.search") }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div id="selectorBox">
|
||||
<el-select ref="select1" @change="locationChange" v-model="value" size="small"
|
||||
:placeholder="$t('btn.selectPlaceholder')" :no-data-text="$t('btn.selectNoText')">
|
||||
<el-option v-for="(item, index) in poiOptions" :key="item.search_key + index" :label="item.search_key"
|
||||
:value="item.address">
|
||||
:value="index">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
@ -170,7 +170,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//
|
||||
//
|
||||
cancel() {
|
||||
YJ.Global.splitScreen.setActiveId([]);
|
||||
},
|
||||
@ -442,14 +442,15 @@ export default {
|
||||
window.searchPlaceEntity.remove();
|
||||
}
|
||||
},
|
||||
//
|
||||
//
|
||||
|
||||
//鼠标移出关闭二级菜单
|
||||
treeMouseOver() {
|
||||
this.$changeComponentShow(".rightMenu", false);
|
||||
},
|
||||
locationChange() {
|
||||
let item = this.poiOptions.find((item) => item.address == this.value);
|
||||
// let item = this.poiOptions.find((item) => item.address == this.value);
|
||||
let item = this.poiOptions[this.value];
|
||||
let id = new YJ.Tools().randomString();
|
||||
this.$nextTick(() => {
|
||||
this.$refs.select1.blur();
|
||||
@ -522,7 +523,7 @@ export default {
|
||||
let string = $("#keyword")
|
||||
.val()
|
||||
.trim();
|
||||
if (string == "") {
|
||||
if (string === "") {
|
||||
let arr = [];
|
||||
if (window.searchPlaceMap) {
|
||||
arr = Array.from(window.searchPlaceMap);
|
||||
@ -533,10 +534,10 @@ export default {
|
||||
}
|
||||
this.poiOptions = [];
|
||||
this.value = "";
|
||||
window.treeSearchCb();
|
||||
// window.treeSearchCb();
|
||||
}
|
||||
},
|
||||
searchPlace: debounce(function () {
|
||||
searchPlace: debounce(function (e) {
|
||||
if (this.select == "poi") {
|
||||
this.poiOptions = [];
|
||||
this.value = "";
|
||||
@ -550,41 +551,47 @@ export default {
|
||||
() => {
|
||||
this.placeSearch = new AMap.PlaceSearch();
|
||||
try {
|
||||
this.placeSearch.search(
|
||||
$("#keyword").val().trim(),
|
||||
(status, result) => {
|
||||
if (result.info && result.info === "OK") {
|
||||
let arr = [];
|
||||
result.poiList.pois.forEach((item) => {
|
||||
const location = YJ.CoordTransform.GCJ02ToWGS84(
|
||||
item.location.lng,
|
||||
item.location.lat
|
||||
);
|
||||
arr.push({
|
||||
address: item.name,
|
||||
search_key: item.name,
|
||||
search_type: item.id,
|
||||
lat: location[1],
|
||||
lng: location[0],
|
||||
let string = $("#keyword").val().trim();
|
||||
if (string || e.type !== 'change') {
|
||||
this.placeSearch.search(
|
||||
$("#keyword").val().trim(),
|
||||
(status, result) => {
|
||||
if (result.info && result.info === "OK") {
|
||||
let arr = [];
|
||||
result.poiList.pois.forEach((item) => {
|
||||
const location = YJ.CoordTransform.GCJ02ToWGS84(
|
||||
item.location.lng,
|
||||
item.location.lat
|
||||
);
|
||||
arr.push({
|
||||
address: item.name,
|
||||
search_key: item.name,
|
||||
search_type: item.id,
|
||||
lat: location[1],
|
||||
lng: location[0],
|
||||
});
|
||||
});
|
||||
});
|
||||
this.poiOptions = arr;
|
||||
if (this.poiOptions.length) {
|
||||
this.poiOptions = arr;
|
||||
if (this.poiOptions.length) {
|
||||
this.loading = false;
|
||||
this.$refs.select1.toggleMenu();
|
||||
}
|
||||
} else if (status == "error" || result === 'INVALID_PARAMS') {
|
||||
this.$message.error("请填写正确的搜索关键字");
|
||||
this.loading = false;
|
||||
} else if (status == "error") {
|
||||
this.$message.error("网络异常");
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.$message.warning("没有搜索结果");
|
||||
this.loading = false;
|
||||
this.$refs.select1.toggleMenu();
|
||||
}
|
||||
} else if (status == "error" || result === 'INVALID_PARAMS') {
|
||||
this.$message.error("请填写正确的搜索关键字");
|
||||
this.loading = false;
|
||||
} else if (status == "error") {
|
||||
this.$message.error("网络异常");
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.$message.warning("没有搜索结果");
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
else {
|
||||
this.loading = false;
|
||||
}
|
||||
} catch (e) {
|
||||
this.loading = false;
|
||||
}
|
||||
@ -609,11 +616,20 @@ export default {
|
||||
queryPOI({ key: string }, (res) => {
|
||||
this.poiOptions = res.list;
|
||||
if (this.poiOptions.length) {
|
||||
this.$message.success("操作成功");
|
||||
this.$refs.select1.toggleMenu();
|
||||
}
|
||||
else {
|
||||
this.$message.warning("搜索无数据");
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
else this.$message.warning("请输入搜索关键字");
|
||||
else {
|
||||
if (e.type === 'change') {
|
||||
return
|
||||
}
|
||||
this.$message.warning("请输入搜索关键字");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.poiOptions = [];
|
||||
@ -682,10 +698,23 @@ export default {
|
||||
if (typeof node.detail == "string") {
|
||||
obj = JSON.parse(node.detail);
|
||||
}
|
||||
console.log('pressModelMap', obj);
|
||||
// console.log('pressModelMap', obj);
|
||||
|
||||
pressModelMap.set(node.source_id + "_" + obj.model_id, node);
|
||||
}
|
||||
// 找出所有的点标注,detail中instruct的值不为空的存入udp_pointMap
|
||||
if (node.source_type == 'point') {
|
||||
let obj = JSON.parse(JSON.stringify(node.detail));
|
||||
if (typeof node.detail == "string") {
|
||||
obj = JSON.parse(node.detail);
|
||||
}
|
||||
let key = obj.instruct
|
||||
if (key) {
|
||||
udp_pointMap.set(key, { source_id: node.source_id })
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
//给node设置树形如icon;是否允许添加子节点,以及右键菜单
|
||||
data.forEach((node) => {
|
||||
@ -770,28 +799,28 @@ export default {
|
||||
// this.$changeComponentShow(".textModelBox", true);
|
||||
// this.$recvChanel("textModelContent", (data) => {
|
||||
// console.log(data.text);
|
||||
let that = this;
|
||||
let source_id = that.$md5(new Date().getTime() + "文本框");
|
||||
let textBox = {
|
||||
id: source_id,
|
||||
position: position,
|
||||
text: '',
|
||||
show: true,
|
||||
};
|
||||
let DbOption = {
|
||||
source_id,
|
||||
source_name: '文本框',
|
||||
source_type: "textBox",
|
||||
p_id: findParentId(that.treeObj),
|
||||
};
|
||||
let detailOption = JSON.parse(JSON.stringify(textBox));
|
||||
let node = getNodeData(DbOption, detailOption);
|
||||
renderTextBox(node);
|
||||
addSource(node).then((res) => {
|
||||
if ([0, 200].includes(res.code)) {
|
||||
cusAddNodes(that.$parent.treeObj, DbOption.p_id, [node]);
|
||||
}
|
||||
});
|
||||
let that = this;
|
||||
let source_id = that.$md5(new Date().getTime() + "文本框");
|
||||
let textBox = {
|
||||
id: source_id,
|
||||
position: position,
|
||||
text: '',
|
||||
show: true,
|
||||
};
|
||||
let DbOption = {
|
||||
source_id,
|
||||
source_name: '文本框',
|
||||
source_type: "textBox",
|
||||
p_id: findParentId(that.treeObj),
|
||||
};
|
||||
let detailOption = JSON.parse(JSON.stringify(textBox));
|
||||
let node = getNodeData(DbOption, detailOption);
|
||||
renderTextBox(node);
|
||||
addSource(node).then((res) => {
|
||||
if ([0, 200].includes(res.code)) {
|
||||
cusAddNodes(that.$parent.treeObj, DbOption.p_id, [node]);
|
||||
}
|
||||
});
|
||||
// })
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user