|
@@ -195,6 +195,62 @@
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <el-dialog
|
|
|
+ v-if="generalizationVisible"
|
|
|
+ :visible.sync="generalizationVisible"
|
|
|
+ title="泛化场景"
|
|
|
+ width="90%"
|
|
|
+ class="generalizationDia"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ :before-close="generalizationCancel"
|
|
|
+ >
|
|
|
+ <el-steps :active="stepActive" align-center>
|
|
|
+ <el-step title="第一步" description="选择场景模板"></el-step>
|
|
|
+ <el-step title="第二步" description="场景泛化"></el-step>
|
|
|
+ </el-steps>
|
|
|
+ <div>
|
|
|
+ <generalization-list
|
|
|
+ v-if="stepActive === 1"
|
|
|
+ ref="generalizationList"
|
|
|
+ ></generalization-list>
|
|
|
+ <generalization-detail
|
|
|
+ v-if="stepActive === 2"
|
|
|
+ ref="generalizationDetail"
|
|
|
+ :id="generalizationId"
|
|
|
+ :curId="curNode.id"
|
|
|
+ :exampleId="curNode.exampleId"
|
|
|
+ :ruleName="formA.ruleName"
|
|
|
+ :rulesId="formA.rulesId"
|
|
|
+ :genUrlType="genUrlType"
|
|
|
+ @generalizationBegin="generalizationBegin"
|
|
|
+ @generalizationDone="generalizationDone"
|
|
|
+ @changeTemplate="changeTemplate"
|
|
|
+ ></generalization-detail>
|
|
|
+ </div>
|
|
|
+ <span slot="footer">
|
|
|
+ <!-- <el-button
|
|
|
+ v-if="stepActive === 2"
|
|
|
+ type="primary"
|
|
|
+ @click="generalizationPrev"
|
|
|
+ >上一步</el-button
|
|
|
+ > -->
|
|
|
+ <el-button
|
|
|
+ v-if="stepActive === 1"
|
|
|
+ type="primary"
|
|
|
+ @click="generalizationNext"
|
|
|
+ >下一步</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="stepActive === 2"
|
|
|
+ type="primary"
|
|
|
+ @click="generalizationConfirm"
|
|
|
+ >完成</el-button
|
|
|
+ >
|
|
|
+ <el-button @click="generalizationCancel">取 消</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<el-dialog
|
|
|
title="模板预览"
|
|
|
:visible.sync="templateViewVisible"
|
|
@@ -223,6 +279,8 @@ import searchLayout from "@/components/grid/searchLayout";
|
|
|
import tableList from "@/components/grid/TableList";
|
|
|
import toolbarTab from "@/components/toolbar/toolbarTab";
|
|
|
import realSceneList from "./components/realSceneList";
|
|
|
+import generalizationList from "./components/generalizationList";
|
|
|
+import generalizationDetail from "./components/generalizationDetail";
|
|
|
// import viewTree from "./components/elTree";
|
|
|
import templateView from "./components/templateView";
|
|
|
|
|
@@ -233,6 +291,8 @@ export default {
|
|
|
tableList,
|
|
|
toolbarTab,
|
|
|
realSceneList,
|
|
|
+ generalizationList,
|
|
|
+ generalizationDetail,
|
|
|
// viewTree,
|
|
|
templateView,
|
|
|
},
|
|
@@ -334,9 +394,9 @@ export default {
|
|
|
},
|
|
|
idIndex: 1, // 用做新增加点id自加,因为id为空会报错
|
|
|
nameDiaTitle: "", // 编辑该级节点信息的dialog的title
|
|
|
- indicatorsVisible: false, // 编辑指标
|
|
|
- scenarioVisible: false, // 选择场景
|
|
|
- scenarioListsVisible: false, // 真实场景列表
|
|
|
+ indicatorsVisible: false, // 编辑指标dialog
|
|
|
+ scenarioVisible: false, // 选择场景dialog
|
|
|
+ scenarioListsVisible: false, // 真实场景列表dialog
|
|
|
form: {
|
|
|
sublistName: "",
|
|
|
weight: "",
|
|
@@ -375,7 +435,10 @@ export default {
|
|
|
{ required: true, message: "请选择", trigger: "change" },
|
|
|
],
|
|
|
},
|
|
|
- sceneTypeList: [{ caption: "真实场景", code: "1" }],
|
|
|
+ sceneTypeList: [
|
|
|
+ { caption: "真实场景", code: "1" },
|
|
|
+ { caption: "泛化场景", code: "2" },
|
|
|
+ ],
|
|
|
nodeList: [], // 把当前所有节点遍历到一个扁平数组
|
|
|
curNode: {}, // 当前操作的节点
|
|
|
editType: "", // 点操作编辑的类型 新增or编辑
|
|
@@ -383,9 +446,13 @@ export default {
|
|
|
checkedIdsB: [], // 自然驾驶列表已选
|
|
|
checkedIdsC: [], // 标准法规列表已选
|
|
|
isRoot: false, // 是否是根节点
|
|
|
- templateViewVisible: false,
|
|
|
+ templateViewVisible: false, // 模板预览dialog
|
|
|
treeData: [],
|
|
|
weightErrIds: [], // 存储weightErr为false的节点id的数组
|
|
|
+ generalizationVisible: false, // 泛化dialog
|
|
|
+ stepActive: 1, // 泛化步骤
|
|
|
+ generalizationId: "", // 泛化详情id
|
|
|
+ genUrlType: 1, // 1为从列表跳入的模板信息,2为泛化后的详情
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -440,6 +507,19 @@ export default {
|
|
|
);
|
|
|
this.curNode.children.splice(index, 1);
|
|
|
|
|
|
+ let node = null;
|
|
|
+ if (this.curNode.children && this.curNode.children.length > 0) {
|
|
|
+ node = this.curNode.children[0];
|
|
|
+ } else {
|
|
|
+ node = this.curNode;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (node.parentId != "0") {
|
|
|
+ this.sceneNumUpdate(node);
|
|
|
+ } else {
|
|
|
+ this.curNode.sceneNum = 0;
|
|
|
+ }
|
|
|
+
|
|
|
this.checkWeightValidate();
|
|
|
});
|
|
|
},
|
|
@@ -475,11 +555,17 @@ export default {
|
|
|
addScenario(row) {
|
|
|
this.curNode = row;
|
|
|
|
|
|
+ if (row.sceneGeneralizationIds) {
|
|
|
+ this.formA.sceneType = "2";
|
|
|
+ } else {
|
|
|
+ this.formA.sceneType = "1";
|
|
|
+ }
|
|
|
+
|
|
|
if (row.packageAndRules) {
|
|
|
this.formA.rulesId = row.packageAndRules;
|
|
|
- this.formA.ruleName = this.ruleList.find(
|
|
|
- (i) => i.rulesId === row.packageAndRules
|
|
|
- ).ruleName;
|
|
|
+ this.formA.ruleName =
|
|
|
+ this.ruleList.find((i) => i.rulesId === row.packageAndRules)
|
|
|
+ .ruleName || "";
|
|
|
}
|
|
|
|
|
|
this.scenarioVisible = true;
|
|
@@ -538,6 +624,8 @@ export default {
|
|
|
this.nodeList
|
|
|
);
|
|
|
|
|
|
+ // console.log(this.getDataWay.data);
|
|
|
+
|
|
|
this.checkWeightValidate();
|
|
|
|
|
|
this.indicatorsCancel();
|
|
@@ -559,30 +647,47 @@ export default {
|
|
|
this.$refs.formA.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.scenarioVisible = false;
|
|
|
- this.scenarioListsVisible = true;
|
|
|
|
|
|
- // 切换到第一个tab页并清空所有tab页中查询条件
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.realScene.activeName = "1";
|
|
|
+ // 真实场景
|
|
|
+ if (this.formA.sceneType === "1") {
|
|
|
+ this.scenarioListsVisible = true;
|
|
|
|
|
|
- this.$refs.realScene.doResetA();
|
|
|
- this.$refs.realScene.doResetB();
|
|
|
- this.$refs.realScene.doResetC();
|
|
|
+ // 切换到第一个tab页并清空所有tab页中查询条件
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.realScene.activeName = "1";
|
|
|
|
|
|
- // 把选中数据对应的ids组分别传入tabs中,用于后续操作数据进行存储
|
|
|
- if (this.curNode.sceneTrafficIds) {
|
|
|
- this.$refs.realScene.checkedIdsA =
|
|
|
- this.curNode.sceneTrafficIds.split(",");
|
|
|
- }
|
|
|
- if (this.curNode.sceneNaturalIds) {
|
|
|
- this.$refs.realScene.checkedIdsB =
|
|
|
- this.curNode.sceneNaturalIds.split(",");
|
|
|
- }
|
|
|
- if (this.curNode.sceneStatueIds) {
|
|
|
- this.$refs.realScene.checkedIdsC =
|
|
|
- this.curNode.sceneStatueIds.split(",");
|
|
|
+ this.$refs.realScene.doResetA();
|
|
|
+ this.$refs.realScene.doResetB();
|
|
|
+ this.$refs.realScene.doResetC();
|
|
|
+
|
|
|
+ // 把选中数据对应的ids组分别传入tabs中,用于后续操作数据进行存储
|
|
|
+ if (this.curNode.sceneTrafficIds) {
|
|
|
+ this.$refs.realScene.checkedIdsA =
|
|
|
+ this.curNode.sceneTrafficIds.split(",");
|
|
|
+ }
|
|
|
+ if (this.curNode.sceneNaturalIds) {
|
|
|
+ this.$refs.realScene.checkedIdsB =
|
|
|
+ this.curNode.sceneNaturalIds.split(",");
|
|
|
+ }
|
|
|
+ if (this.curNode.sceneStatueIds) {
|
|
|
+ this.$refs.realScene.checkedIdsC =
|
|
|
+ this.curNode.sceneStatueIds.split(",");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 泛化场景
|
|
|
+ if (this.curNode.exampleId) {
|
|
|
+ // 进详情
|
|
|
+ this.genUrlType = 2;
|
|
|
+ this.stepActive = 2;
|
|
|
+ } else {
|
|
|
+ // 进列表
|
|
|
+ this.genUrlType = 1;
|
|
|
+ this.stepActive = 1;
|
|
|
}
|
|
|
- });
|
|
|
+
|
|
|
+ this.generalizationVisible = true;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -624,13 +729,16 @@ export default {
|
|
|
this.curNode.sceneNaturalIds = this.checkedIdsB.join(",");
|
|
|
this.curNode.sceneStatueIds = this.checkedIdsC.join(",");
|
|
|
|
|
|
+ // 清空泛化场景的数据
|
|
|
+ this.curNode.exampleId = "";
|
|
|
+ this.curNode.sceneGeneralizationIds = "";
|
|
|
+ this.curNode.templateId = "";
|
|
|
+
|
|
|
this.nodeList = [];
|
|
|
// 遍历当前树 拿到所有节点的平行展开数组
|
|
|
this.deepFirstSearch(this.getDataWay.data[0], this.nodeList);
|
|
|
|
|
|
- if (this.curNode.parentId != "0") {
|
|
|
- this.sceneNumUpdate(this.curNode);
|
|
|
- }
|
|
|
+ this.sceneNumUpdate(this.curNode);
|
|
|
|
|
|
this.scenarioListsCancel();
|
|
|
},
|
|
@@ -657,6 +765,84 @@ export default {
|
|
|
|
|
|
this.scenarioListsVisible = false;
|
|
|
},
|
|
|
+ // 泛化-上一步
|
|
|
+ generalizationPrev() {
|
|
|
+ this.stepActive = 1;
|
|
|
+ },
|
|
|
+ // 泛化-下一步
|
|
|
+ generalizationNext() {
|
|
|
+ let arr = [];
|
|
|
+ if (
|
|
|
+ this.$refs.generalizationList &&
|
|
|
+ this.$refs.generalizationList.checkedArr
|
|
|
+ ) {
|
|
|
+ arr = this.$refs.generalizationList.checkedArr;
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (arr.length === 0) {
|
|
|
+ this.$message.warning("请先选择一条数据");
|
|
|
+ return;
|
|
|
+ } else if (arr.length > 1) {
|
|
|
+ this.$message.warning("只能选择一条数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.generalizationId = arr[0].id;
|
|
|
+ this.genUrlType = 1;
|
|
|
+ this.stepActive = 2;
|
|
|
+ },
|
|
|
+ // 泛化-完成按钮
|
|
|
+ generalizationConfirm() {
|
|
|
+ this.$refs.generalizationDetail.done();
|
|
|
+ },
|
|
|
+ // 泛化-取消
|
|
|
+ generalizationCancel() {
|
|
|
+ this.generalizationVisible = false;
|
|
|
+ },
|
|
|
+ // 开始泛化
|
|
|
+ generalizationBegin() {
|
|
|
+ this.generalizationCancel();
|
|
|
+ this.curNode.sceneNum = "泛化中";
|
|
|
+ },
|
|
|
+ // 泛化完成回调
|
|
|
+ generalizationDone(info, obj, isSuccess = true) {
|
|
|
+ this.nodeList = [];
|
|
|
+ // 遍历当前树 拿到所有节点的平行展开数组
|
|
|
+ this.deepFirstSearch(this.getDataWay.data[0], this.nodeList);
|
|
|
+
|
|
|
+ let node = this.nodeList.find((i) => i.id === obj.curId);
|
|
|
+ if (node) {
|
|
|
+ if (isSuccess) {
|
|
|
+ node.exampleId = info.exampleId;
|
|
|
+ node.sceneGeneralizationIds = info.sceneGeneralizationIds;
|
|
|
+ node.sceneNum = info.sceneNum;
|
|
|
+ node.id = info.sublistId;
|
|
|
+ node.templateId = info.templateId;
|
|
|
+
|
|
|
+ node.packageAndRules = obj.rulesId;
|
|
|
+ node.ruleName = obj.ruleName;
|
|
|
+ } else {
|
|
|
+ // 若泛化失败则清空对应字段
|
|
|
+ node.exampleId = "";
|
|
|
+ node.sceneGeneralizationIds = "";
|
|
|
+ node.sceneNum = 0;
|
|
|
+ node.templateId = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清空真实场景的数据
|
|
|
+ node.sceneTrafficIds = "";
|
|
|
+ node.sceneNaturalIds = "";
|
|
|
+ node.sceneStatueIds = "";
|
|
|
+
|
|
|
+ this.sceneNumUpdate(node);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 更换模板
|
|
|
+ changeTemplate() {
|
|
|
+ this.stepActive = 1;
|
|
|
+ },
|
|
|
// 校验权重
|
|
|
checkWeightValidate() {
|
|
|
this.allRowWeightErrFalse(this.getDataWay.data[0]);
|
|
@@ -727,6 +913,16 @@ export default {
|
|
|
|
|
|
for (let index = 0; index < this.nodeList.length; index++) {
|
|
|
const element = this.nodeList[index];
|
|
|
+ if (element.sceneNum === "泛化中") {
|
|
|
+ this.$message.error("存在泛化中场景,请稍后进行保存");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (element.sceneNum == 0) {
|
|
|
+ this.$message.error("场景数量不能为0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (element.children && element.children.length > 0) {
|
|
|
let total = 0;
|
|
|
let arr = [];
|
|
@@ -794,7 +990,7 @@ export default {
|
|
|
let node = this.nodeList.find((i) => i.id === curNode.parentId);
|
|
|
let sceneNum = 0;
|
|
|
node.children.forEach((i) => {
|
|
|
- sceneNum += i.sceneNum;
|
|
|
+ i.sceneNum != "泛化中" ? (sceneNum += i.sceneNum) : null;
|
|
|
});
|
|
|
|
|
|
node.sceneNum = sceneNum;
|
|
@@ -851,7 +1047,8 @@ export default {
|
|
|
color: @gray;
|
|
|
}
|
|
|
|
|
|
- .scenarioListsDia {
|
|
|
+ .scenarioListsDia,
|
|
|
+ .generalizationDia {
|
|
|
/deep/ .el-dialog__body {
|
|
|
padding: 20px 60px;
|
|
|
}
|