|
@@ -104,26 +104,10 @@
|
|
|
</el-checkbox-group>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div
|
|
|
- v-if="overlayBtnShow"
|
|
|
- class="overlay-container"
|
|
|
- :class="{ forbidden: forbidOverlayBtn }"
|
|
|
- @click="executeOverlay"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="overlay-container-icon"
|
|
|
- :class="{ checked: overlayBtnChecked }"
|
|
|
- ></div>
|
|
|
- <div
|
|
|
- class="overlay-container-btn"
|
|
|
- :class="{ checked: overlayBtnChecked }"
|
|
|
- >
|
|
|
- 叠置分析
|
|
|
- </div>
|
|
|
- </div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="clearDialogVisible()">取 消</el-button>
|
|
|
- <el-button type="primary" @click="saveModel()">保存模型</el-button>
|
|
|
+ <!-- 保存模型时直接进行叠置分析 -->
|
|
|
+ <el-button type="primary" @click="saveModel()">叠置分析</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
@@ -139,13 +123,13 @@ export default {
|
|
|
components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
- layerLoading:false,
|
|
|
+ layerLoading: false,
|
|
|
uploadBaseUrl: "/dms",
|
|
|
classTextToIndex: {},
|
|
|
overlayBtnChecked: false,
|
|
|
outerDialogVisible: false,
|
|
|
innerDialogVisible: false,
|
|
|
- overlayBtnShow: false,
|
|
|
+ // overlayBtnShow: false,
|
|
|
modelTitle: null,
|
|
|
inputName: "自定义模型1",
|
|
|
checkArr: [],
|
|
@@ -182,8 +166,6 @@ export default {
|
|
|
cursor: "pointer",
|
|
|
},
|
|
|
currentModifiedModelId: "",
|
|
|
- currentOverlayFile: "",
|
|
|
- forbidOverlayBtn: "",
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -236,23 +218,7 @@ export default {
|
|
|
// 监听模型修改事件
|
|
|
this.$bus.$off("updateModel");
|
|
|
this.$bus.$on("updateModel", (node) => {
|
|
|
- // console.log("监听模型中");
|
|
|
- this.overlayBtnChecked = false;
|
|
|
- // console.log(node, "节点数据");
|
|
|
-
|
|
|
- // 允许多次叠置 -- 后续根据需求调整
|
|
|
- // if (node.data.c_dzfx_file) {
|
|
|
- // // console.log("已有叠置分析结果");
|
|
|
- // this.forbidOverlayBtn = true;
|
|
|
- // }
|
|
|
-
|
|
|
- if (!node.data.c_dzfx_file) {
|
|
|
- // console.log("未进行叠置分析");
|
|
|
- this.forbidOverlayBtn = false;
|
|
|
- }
|
|
|
this.currentModifiedModelId = node.data.modelId;
|
|
|
- console.log(this.currentModifiedModelId);
|
|
|
- this.currentOverlayFile = node.data.c_dzfx_file;
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
if (this.$refs.transferTree) {
|
|
@@ -279,7 +245,7 @@ export default {
|
|
|
}
|
|
|
// this.checkedList = node.data.data;
|
|
|
this.inputName = node.data.label;
|
|
|
- this.overlayBtnShow = true;
|
|
|
+ // this.overlayBtnShow = true;
|
|
|
this.modelTitle = node.data.label;
|
|
|
this.$store.state.modelStatus = "modify";
|
|
|
});
|
|
@@ -288,7 +254,7 @@ export default {
|
|
|
// 当容器销毁时,需要停止监听该事件
|
|
|
this.$bus.$off("customModelEvent");
|
|
|
this.$bus.$off("updateModel");
|
|
|
- this.overlayBtnShow = false;
|
|
|
+ // this.overlayBtnShow = false;
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
@@ -478,10 +444,8 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
// 转为树结构的数据格式
|
|
|
let finalData = this.createTree(treeArr);
|
|
|
-
|
|
|
this.createModelParams.c_layer_name = JSON.stringify(this.checkedList);
|
|
|
this.createModelParams.c_bind_layer = JSON.stringify(finalData);
|
|
|
let params = new FormData();
|
|
@@ -492,14 +456,31 @@ export default {
|
|
|
};
|
|
|
this.$Post(this.urlsCollection.addContent, params)
|
|
|
.then((res) => {
|
|
|
- // console.log(res, "保存自定义模型的res");
|
|
|
+ console.log(res, "保存自定义模型的res");
|
|
|
if (res.code === 200) {
|
|
|
- this.$message.success("模型已保存");
|
|
|
- this.$store.state.customModelsArr.push({
|
|
|
- name: this.inputName,
|
|
|
- data: JSON.stringify(finalData),
|
|
|
+ // 获取模型id
|
|
|
+ let myModelParams = new FormData();
|
|
|
+ myModelParams = {
|
|
|
+ columnId: 49,
|
|
|
+ states: "0,1,2,3",
|
|
|
+ pageSize: 50,
|
|
|
+ page: 0,
|
|
|
+ };
|
|
|
+ this.$Post(
|
|
|
+ this.urlsCollection.selectContentList,
|
|
|
+ myModelParams
|
|
|
+ ).then((overlayRes) => {
|
|
|
+ if (
|
|
|
+ overlayRes.code === 200 &&
|
|
|
+ overlayRes.content.data.length > 0
|
|
|
+ ) {
|
|
|
+ overlayRes.content.data.forEach((ele) => {
|
|
|
+ if (this.inputName === ele.title) {
|
|
|
+ this.startModelOverlay(ele.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
- this.clearDialogVisible();
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -508,16 +489,25 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 修改模型 -- 直接调用修改模型接口
|
|
|
- modifyModel(type, bindData) {
|
|
|
+ modifyModel() {
|
|
|
+ let treeArr = [];
|
|
|
+ this.customTreeMap.forEach((v, i) => {
|
|
|
+ if (this.checkedList.includes(i)) {
|
|
|
+ treeArr.push(v);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let bindLayer = this.createTree(treeArr);
|
|
|
+ console.log(bindLayer);
|
|
|
let obj = {
|
|
|
id: this.currentModifiedModelId,
|
|
|
title: this.inputName,
|
|
|
content: this.inputName,
|
|
|
// c_level: "1",
|
|
|
c_layer_name: JSON.stringify(this.checkedList),
|
|
|
- c_bind_layer: JSON.stringify(bindData),
|
|
|
+ c_bind_layer: JSON.stringify(bindLayer),
|
|
|
c_user_id: localStorage.getItem("USER_ID"),
|
|
|
};
|
|
|
+ // 修改当前模型图层数据,并重新进行叠置
|
|
|
let modifyParams = new FormData();
|
|
|
modifyParams = {
|
|
|
columnId: 49,
|
|
@@ -527,21 +517,8 @@ export default {
|
|
|
this.$Post(this.urlsCollection.updateContent, modifyParams).then(
|
|
|
(res) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.$store.state.customModelsArr.filter((v) => {
|
|
|
- return v.name !== this.inputName;
|
|
|
- });
|
|
|
- this.$store.state.customModelsArr.push({
|
|
|
- name: this.inputName,
|
|
|
- data: JSON.stringify(bindData),
|
|
|
- });
|
|
|
- this.clearDialogVisible();
|
|
|
- if (type === "alreadyOverlay") {
|
|
|
- this.$message.success("系统已完成叠置分析,数据已保存!");
|
|
|
- }
|
|
|
-
|
|
|
- if (type === "notOverlay") {
|
|
|
- this.$message.success("模型修改成功");
|
|
|
- }
|
|
|
+ console.log("当前模型已修改,系统重新进行叠置分析!");
|
|
|
+ this.startModelOverlay(this.currentModifiedModelId);
|
|
|
}
|
|
|
}
|
|
|
);
|
|
@@ -570,14 +547,6 @@ export default {
|
|
|
if (!value) return true;
|
|
|
return data.label.indexOf(value) !== -1;
|
|
|
},
|
|
|
- // 弹窗关闭时询问
|
|
|
- handleClose() {
|
|
|
- // if (this.outerDialogVisible) {
|
|
|
- // this.$confirm("").then(() => {
|
|
|
- // this.clearDialogVisible();
|
|
|
- // });
|
|
|
- // }
|
|
|
- },
|
|
|
clearDialogVisible() {
|
|
|
this.outerDialogVisible = false;
|
|
|
this.innerDialogVisible = false;
|
|
@@ -590,7 +559,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
this.modelTitle = null;
|
|
|
- this.overlayBtnShow = false;
|
|
|
+ // this.overlayBtnShow = false;
|
|
|
this.$store.state.modelStatus = "create";
|
|
|
this.outerDialogVisible = true;
|
|
|
this.checkedList = [];
|
|
@@ -608,6 +577,9 @@ export default {
|
|
|
|
|
|
this.inputName = `自定义模型${Math.round(Math.random() * 100)}`;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 保存模型时直接进行叠置分析,若叠置分析失败显示默认图层
|
|
|
+ */
|
|
|
saveModel() {
|
|
|
if (this.checkedList.length < 2) {
|
|
|
this.$message.info("请至少选择两个类型!");
|
|
@@ -621,67 +593,64 @@ export default {
|
|
|
},
|
|
|
confirm() {
|
|
|
this.$confirm("确认保存吗?").then(() => {
|
|
|
- // modify -- 改变数组类型
|
|
|
+ // 修改模型所选图层
|
|
|
if (this.$store.state.modelStatus === "modify") {
|
|
|
- let treeArr = [];
|
|
|
- this.customTreeMap.forEach((v, i) => {
|
|
|
- if (this.checkedList.includes(i)) {
|
|
|
- treeArr.push(v);
|
|
|
- }
|
|
|
- });
|
|
|
- let bindLayer = this.createTree(treeArr);
|
|
|
- console.log(bindLayer);
|
|
|
- this.modifyModel("notOverlay", bindLayer);
|
|
|
+ this.modifyModel();
|
|
|
}
|
|
|
|
|
|
- // console.log(this.$store.state.customModelsArr, "先获取的模型数据");
|
|
|
- // create -- 创建新的数组
|
|
|
+ // 新建模型
|
|
|
if (this.$store.state.modelStatus === "create") {
|
|
|
this.addModel();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 呈现叠置分析的数据
|
|
|
+ // 打印叠置分析的结果数据
|
|
|
displayOverlayGeometry(url) {
|
|
|
// console.log(url);
|
|
|
this.$Get(url).then((res) => {
|
|
|
console.log(res, "叠置分析的结果数据");
|
|
|
});
|
|
|
},
|
|
|
- // 执行叠置分析
|
|
|
- executeOverlay() {
|
|
|
- this.overlayBtnChecked = !this.overlayBtnChecked;
|
|
|
- if (this.overlayBtnChecked && !this.forbidOverlayBtn) {
|
|
|
- // 进行叠置分析后,叠置分析结果会自动保存
|
|
|
- // 当前勾选的图层并未自动保存,需要重新调用一次保存接口
|
|
|
- let treeArr = [];
|
|
|
- this.customTreeMap.forEach((v, i) => {
|
|
|
- if (this.checkedList.includes(i)) {
|
|
|
- treeArr.push(v);
|
|
|
- }
|
|
|
- });
|
|
|
|
|
|
- let bindLayer = this.createTree(treeArr);
|
|
|
- let params = new FormData();
|
|
|
- params = {
|
|
|
- modelId: this.currentModifiedModelId,
|
|
|
- userId: localStorage.getItem("USER_ID"),
|
|
|
- };
|
|
|
- this.layerLoading = true
|
|
|
- this.$Post(this.urlsCollection.overlayAnalysis, params).then((res) => {
|
|
|
- console.log(res, "res");
|
|
|
- if (res.code === 200) {
|
|
|
- this.layerLoading = false
|
|
|
- let address = this.uploadBaseUrl + res.content;
|
|
|
+ // 创建模型时进行的叠置分析
|
|
|
+ startModelOverlay(modelId) {
|
|
|
+ let overlayParams = new FormData();
|
|
|
+ overlayParams.append("modelId", modelId);
|
|
|
+ overlayParams.append("userId", localStorage.getItem("USER_ID"));
|
|
|
+ this.layerLoading = true;
|
|
|
+ this.$Post(this.urlsCollection.overlayAnalysis, overlayParams)
|
|
|
+ .then((response) => {
|
|
|
+ console.log(response, "创建模型时进行的叠置分析");
|
|
|
+ if (response.message === "未申请任务权限") {
|
|
|
+ this.layerLoading = false;
|
|
|
+ this.$message.info(
|
|
|
+ "所选的图层未申请任务权限,叠置分析失败,将呈现默认选中的图层!"
|
|
|
+ );
|
|
|
+ // 呈现默认选中的图层
|
|
|
+ this.$store.state.mapMethodsCollection
|
|
|
+ .get("METHODS")
|
|
|
+ .getMyModelData(false, "");
|
|
|
+ this.clearDialogVisible();
|
|
|
+ }
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.layerLoading = false;
|
|
|
+ let address = this.uploadBaseUrl + response.content;
|
|
|
this.displayOverlayGeometry(address);
|
|
|
- this.modifyModel("alreadyOverlay", bindLayer);
|
|
|
+ this.$store.state.mapMethodsCollection
|
|
|
+ .get("METHODS")
|
|
|
+ .getMyModelData(true, modelId);
|
|
|
+ this.clearDialogVisible();
|
|
|
}
|
|
|
- }).catch((err)=>{
|
|
|
- this.$message.error("叠置分析失败")
|
|
|
- this.layerLoading = false
|
|
|
- console.log(err,"请求错误");
|
|
|
})
|
|
|
- }
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("叠置分析失败,将呈现默认选中的图层!");
|
|
|
+ // 呈现默认选中的图层
|
|
|
+ this.layerLoading = false;
|
|
|
+ this.$store.state.mapMethodsCollection
|
|
|
+ .get("METHODS")
|
|
|
+ .getMyModelData(false, "");
|
|
|
+ this.clearDialogVisible();
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
};
|