zhangliang2 3 éve
szülő
commit
df8bab6567

+ 7 - 5
src/api/sceneLibrary.js

@@ -28,10 +28,11 @@ const saveScenePackage = basePart + '/ScenePackage/saveScenePackage'; // 场景
 const queryCsb = basePart + '/ScoringRules/queryCsb'; // 测试包添加评分规则下拉
 
 const querySceneGeneralTemplateList = basePart + '/SceneGeneralTemplate/querySceneGeneralTemplateList'; // 泛化列表
-const queryType  = basePart + '/SceneGeneralTemplate/queryType '; // 功能模块查询
-const querySceneGeneralTemplateById  = basePart + '/SceneGeneralTemplate/querySceneGeneralTemplateById '; // 选中模板展示详情
-const saveSceneGeneralTemplate  = basePart + '/SceneGeneralTemplate/saveSceneGeneralTemplate '; // 新增泛化场景
-const saveSceneGeneralExample  = basePart + '/SceneGeneralTemplate/saveSceneGeneralExample '; // 保存泛化场景
+const queryType = basePart + '/SceneGeneralTemplate/queryType '; // 功能模块查询
+const querySceneGeneralTemplateById = basePart + '/SceneGeneralTemplate/querySceneGeneralTemplateById '; // 选中模板展示详情
+const saveSceneGeneralTemplate = basePart + '/SceneGeneralTemplate/saveSceneGeneralTemplate '; // 新增泛化场景
+const saveSceneGeneralExample = basePart + '/SceneGeneralTemplate/saveSceneGeneralExample '; // 保存泛化场景
+const queryGeneralTemplateByFh = basePart + '/SceneGeneralTemplate/queryGeneralTemplateByFh '; // 泛化过的详情
 
 
 export default {
@@ -65,5 +66,6 @@ export default {
     queryType,
     querySceneGeneralTemplateById,
     saveSceneGeneralTemplate,
-    saveSceneGeneralExample
+    saveSceneGeneralExample,
+    queryGeneralTemplateByFh
 }

+ 9 - 0
src/router/sceneLibrary.js

@@ -25,6 +25,15 @@ export default [{
         },
         component: () => import("@/views/sceneLibrary/trafficAccidentSimulationScenarioList")
     },
+    {
+        path: "/generalizationScenarioList",
+        name: "generalizationScenarioList",
+        meta: {
+            tabname: "泛化场景",
+            menuKind: "sceneLibrary"
+        },
+        component: () => import("@/views/sceneLibrary/generalizationScenarioList")
+    },
     {
         path: "/scenarioTestPackageManagementList",
         name: "scenarioTestPackageManagementList",

+ 76 - 34
src/views/sceneLibrary/components/generalizationDetail.vue

@@ -1382,22 +1382,52 @@ export default {
             type: String,
             default: "",
         },
+        curId: {
+            type: String,
+            default: "",
+        },
+        exampleId: {
+            type: String,
+            default: "",
+        },
+        ruleName: {
+            type: String,
+            default: "",
+        },
+        rulesId: {
+            type: String,
+            default: "",
+        },
+        genUrlType: {
+            type: Number,
+            default: 1,
+        },
     },
 
     methods: {
-        getInfo(id) {
+        getInfo() {
+            let url = this.$api.sceneLibrary.querySceneGeneralTemplateById;
+            let id = this.id;
+
+            if (this.genUrlType === 2) {
+                url = this.$api.sceneLibrary.queryGeneralTemplateByFh;
+                id = this.exampleId;
+            }
+
             this.$axios({
                 method: "post",
-                url: this.$api.sceneLibrary.querySceneGeneralTemplateById,
-                data: {
-                    id,
-                },
+                url,
+                data: { id },
             }).then((res) => {
                 if (res.code == 200 && res.info) {
                     // res.info.listMb[0].obsLateralAcceleration =
                     //     "[-1,[2,4,1],-1,[1,2,3],-1]|ovaslkdkjhlaskjdlkj";
                     // res.info.listMb[0].generalizationType =
                     //     '{"obsStartVelocity":2,"obsLongitudinalAcceleration":2,"obsLateralAcceleration":4}';
+                    if (this.genUrlType === 2 && res.info.isTure === "1") {
+                        this.$message.warning("该模板已变更");
+                    }
+
                     let listMb = res.info.listMb;
                     res.info.listMb = [];
                     Object.assign(this.form, res.info);
@@ -1491,12 +1521,6 @@ export default {
                     }
                 });
 
-                // for (let k in this.form) {
-                //     if (this.form.hasOwnProperty(k) && k != "listMb") {
-                //         data[k] = this.form[k];
-                //     }
-                // }
-
                 this.generalizationTypeToData(
                     this.generalizationType,
                     data,
@@ -1506,20 +1530,9 @@ export default {
                 data.listMb = [];
 
                 for (let index = 0; index < this.form.listMb.length; index++) {
-                    // let obj = {};
-                    // for (let j in this.form[index]) {
-                    //     if (this.form[index].hasOwnProperty(j)) {
-                    //         obj[j] = this.form[index][j];
-                    //     }
-                    // }
-                    // let obj = Object.assign({}, this.form[index]);
-
                     let ele = this.form.listMb[index];
                     let obj = Object.assign({}, ele);
-                    let generalizationType = JSON.parse(
-                        // this.form[index].generalizationType
-                        ele.generalizationType
-                    );
+                    let generalizationType = JSON.parse(ele.generalizationType);
                     this.generalizationTypeToData(
                         generalizationType,
                         obj,
@@ -1528,20 +1541,47 @@ export default {
                     );
                     data.listMb[index] = obj;
                 }
-                // console.log(data);
-                // return;
+
+                let obj = {
+                    curId: this.curId,
+                    ruleName: this.ruleName,
+                    rulesId: this.rulesId,
+                };
+                this.$emit("generalizationBegin");
 
                 this.$axios({
                     method: "post",
                     url: this.$api.sceneLibrary.saveSceneGeneralExample,
                     data,
-                }).then((res) => {
-                    if (res.code == 200 && res.info) {
-                        // console.log(123);
-                    } else {
-                        this.$message.error(res.message || "获取模板详情失败");
-                    }
-                });
+                })
+                    .then((res) => {
+                        if (res.code == 200 && res.info) {
+                            /* setTimeout(() => {
+                            // 此写法有问题 覆盖?不全部执行? 只执行最后一个
+                            // this.$emit("generalizationDone", res.info, obj);
+                        }, 20000); */
+                            this.$parent.$parent.generalizationDone(
+                                res.info,
+                                obj
+                            );
+                            this.$message.success("泛化成功");
+                        } else {
+                            this.$parent.$parent.generalizationDone(
+                                null,
+                                obj,
+                                false
+                            );
+                            this.$message.error(res.message || "泛化失败");
+                        }
+                    })
+                    .catch((error) => {
+                        this.$parent.$parent.generalizationDone(
+                            null,
+                            obj,
+                            false
+                        );
+                        this.$message.error("泛化失败");
+                    });
             }
         },
         // 数据转换展示
@@ -1838,7 +1878,9 @@ export default {
             if (ba % c != 0 || ba / c >= 20) return false;
             return true;
         },
-        changeTemplate() {},
+        changeTemplate() {
+            this.$emit("changeTemplate");
+        },
     },
 
     async mounted() {
@@ -1852,7 +1894,7 @@ export default {
             // scenarioRadiusCurvatureList: "scenarioRadiusCurvature",
         });
 
-        this.getInfo(this.id);
+        this.getInfo();
     },
 };
 </script>

+ 426 - 0
src/views/sceneLibrary/generalizationScenarioList.vue

@@ -0,0 +1,426 @@
+<template>
+    <div class="generalizationScenarioListPanel">
+        <search-layout :needBox="true">
+            <template slot="searchItem1">
+                <span class="label">场景类型编号</span>
+                <el-input
+                    v-model="searchParams.sceneId"
+                    size="small"
+                    clearable
+                    placeholder="请输入"
+                    maxlength="60"
+                    @keyup.enter.native="doSearch"
+                >
+                </el-input>
+            </template>
+            <template slot="searchItem2">
+                <span class="label">功能模块</span>
+                <el-select v-model="searchParams.fileName" multiple>
+                    <el-option
+                        v-for="item in fileNameList"
+                        :label="item.caption"
+                        :value="item.code"
+                        :key="item.code"
+                    ></el-option>
+                </el-select>
+            </template>
+            <template slot="searchItem3">
+                <span class="label">天气</span>
+                <el-select v-model="searchParams.scenarioWeather" multiple>
+                    <el-option
+                        v-for="item in scenarioWeatherList"
+                        :label="item.caption"
+                        :value="item.code"
+                        :key="item.code"
+                    ></el-option>
+                </el-select>
+            </template>
+            <template slot="searchItem4">
+                <span class="label">时间</span>
+                <el-time-picker
+                    v-model="searchParams.scenarioTime"
+                    value-format="HH:mm:ss"
+                    placeholder="时间"
+                >
+                </el-time-picker>
+            </template>
+            <!-- <template slot="searchItem27">
+                <el-checkbox-group v-model="labels">
+                    <el-checkbox-button label="1" :key="1" class="labelA"
+                        >高速</el-checkbox-button
+                    >
+                    <el-checkbox-button label="2" :key="2" class="labelB"
+                        >切入</el-checkbox-button
+                    >
+                    <el-checkbox-button label="3" :key="3" class="labelC"
+                        >切出</el-checkbox-button
+                    >
+                    <el-checkbox-button label="4" :key="4" class="labelD"
+                        >变道</el-checkbox-button
+                    >
+                    <el-checkbox-button label="5" :key="5" class="labelA"
+                        >匝道</el-checkbox-button
+                    >
+                    <el-checkbox-button label="6" :key="6" class="labelB"
+                        >隧道</el-checkbox-button
+                    >
+                    <el-checkbox-button label="7" :key="7" class="labelC"
+                        >掉头</el-checkbox-button
+                    >
+                </el-checkbox-group>
+            </template> -->
+            <template slot="searchBtn1">
+                <el-button type="primary" @click="doSearch">查询</el-button>
+            </template>
+            <template slot="searchBtn2">
+                <el-button type="primary" @click="doReset">重置</el-button>
+            </template>
+        </search-layout>
+
+        <div class="btnsPanel">
+            <upload ref="upload" :limit="1" @didUpload="didUpload"></upload>
+        </div>
+
+        <tableList
+            ref="table"
+            style="margin: 0 30px"
+            :columns="columns"
+            :getDataWay="getDataWay"
+            :pagination="pagination"
+            index
+        >
+            <el-table-column
+                label="操作"
+                slot="cgInfos"
+                align="center"
+                width="180"
+            >
+                <!-- <template v-slot="scope">
+                    <i
+                        @click="viewRow(scope.row)"
+                        class="el-icon-view elIcon cursor"
+                        title="查看"
+                    >
+                    </i>
+                </template> -->
+            </el-table-column>
+        </tableList>
+
+        <el-dialog
+            :title="videoDiaTitle"
+            :visible.sync="dialogVisible"
+            width="690px"
+            :close-on-click-modal="false"
+            :close-on-press-escape="false"
+            :before-close="diaClose"
+        >
+            <div class="videoBox">
+                <video autoplay :src="videoSrc" controls></video>
+            </div>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import searchLayout from "@/components/grid/searchLayout";
+import tableList from "@/components/grid/TableList";
+import upload from "./components/upload";
+import { mapState } from "vuex";
+
+export default {
+    name: "generalizationScenarioList", // 泛化场景
+    components: { searchLayout, tableList, upload },
+    data() {
+        return {
+            searchParams: {
+                //搜索参数
+                sceneId: "", // 场景类型编号
+                fileName: [], // 功能模块
+                scenarioWeather: [], // 天气
+                scenarioTime: "", // 时间
+
+                // highSpeed: [], // 高速
+                // ramp: [], // 匝道
+                // tunnel: [], // 隧道
+                // cutIn: [], // 切入
+                // cutOut: [], // 切出
+                // laneChange: [], // 变道
+                // turnAround: [], // 掉头
+            },
+            labels: [],
+            fileNameList: [],
+            scenarioWeatherList: [],
+            props: {
+                multiple: true,
+                label: "dictName",
+                value: "dictCode",
+            },
+            columns: [
+                //表格列
+                {
+                    label: "编号",
+                    prop: "sceneId",
+                },
+                {
+                    label: "场景名称",
+                    prop: "scenarioName",
+                },
+                {
+                    label: "功能模块",
+                    prop: "fileName",
+                },
+                {
+                    label: "道路类型",
+                    prop: "scenarioRoadType",
+                },
+                {
+                    label: "时间",
+                    prop: "scenarioTime",
+                },
+                {
+                    label: "天气",
+                    prop: "scenarioWeather",
+                },
+                // {
+                //     label: "标签",
+                //     prop: "label",
+                // },
+                // {
+                //     label: "操作",
+                //     prop: "cgInfos",
+                //     template: true,
+                // },
+            ],
+            pagination: {
+                //分页使用
+                currentPage: 1,
+                pageSize: 10,
+                position: "right",
+                pageSizes: [10, 30, 50, 100, 200],
+                layout: "sizes, total, prev, pager, next, jumper",
+            },
+            getDataWay: {
+                //加载表格数据
+                dataType: "url",
+                type: "post",
+                // firstRequest: false,
+                data: this.$api.sceneLibrary.querySceneGeneralTemplateList,
+                param: {},
+            },
+            dialogVisible: false,
+            autoplay: false,
+            videoSrc: "",
+            videoDiaTitle: "",
+        };
+    },
+
+    computed: {
+        ...mapState(["fileHost", "fileUrl"]),
+    },
+
+    methods: {
+        doSearch() {
+            /* this.searchParams.highSpeed = this.labels.includes("1")
+                ? [["roadType", "高速"]]
+                : [];
+            this.searchParams.cutIn = this.labels.includes("2")
+                ? [
+                      [
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "机动车从左侧切入成功",
+                      ],
+                      [
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "机动车从右侧切入成功",
+                      ],
+                  ]
+                : [];
+            this.searchParams.cutOut = this.labels.includes("3")
+                ? [
+                      [
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "机动车向左侧切出成功",
+                      ],
+                      [
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "targetBehavior",
+                          "机动车向右侧切出成功",
+                      ],
+                  ]
+                : [];
+            this.searchParams.laneChange = this.labels.includes("4")
+                ? [
+                      [
+                          "selfBehavior",
+                          "selfBehavior",
+                          "selfBehavior",
+                          "向左变道成功",
+                      ],
+                      [
+                          "selfBehavior",
+                          "selfBehavior",
+                          "selfBehavior",
+                          "向右变道成功",
+                      ],
+                      [
+                          "selfBehavior",
+                          "selfBehavior",
+                          "selfBehavior",
+                          "向左连续变道",
+                      ],
+                      [
+                          "selfBehavior",
+                          "selfBehavior",
+                          "selfBehavior",
+                          "向右连续变道",
+                      ],
+                      [
+                          "selfBehavior",
+                          "selfBehavior",
+                          "selfBehavior",
+                          "向左变道超车",
+                      ],
+                      [
+                          "selfBehavior",
+                          "selfBehavior",
+                          "selfBehavior",
+                          "向右变道超车",
+                      ],
+                  ]
+                : [];
+            this.searchParams.ramp = this.labels.includes("5")
+                ? [["ramp", "是"]]
+                : [];
+            this.searchParams.tunnel = this.labels.includes("6")
+                ? [["tunnel", "是"]]
+                : [];
+            this.searchParams.turnAround = this.labels.includes("7")
+                ? [
+                      ["selfBehavior", "直路掉头"],
+                      ["selfBehavior", "selfBehavior", "路口掉头"],
+                  ]
+                : []; */
+            this.refreshList(this.searchParams);
+        },
+        //刷新table
+        refreshList(param) {
+            param
+                ? this.$refs["table"].loadData(param)
+                : this.$refs["table"].loadData();
+        },
+        doReset() {
+            this.searchParams = {
+                sceneId: "",
+                fileName: [],
+                scenarioWeather: [],
+                scenarioTime: "",
+            };
+            this.labels = [];
+            this.doSearch();
+        },
+        viewRow(row) {
+            this.dialogVisible = true;
+            this.videoDiaTitle = row.naturalName;
+
+            let url = "";
+            if (process.env.VUE_APP_IS_DEV == "true") {
+                url = this.fileHost + this.fileUrl;
+            } else {
+                url = this.fileUrl;
+            }
+
+            let token = localStorage.getItem("Authorization").split(" ")[1];
+            this.videoSrc = `${url}?objectName=${row.videoAddress}&access_token=${token}`;
+            this.autoplay = true;
+        },
+        delRow(row) {
+            this.$confirm("确认是否删除?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+            }).then(() => {
+                this.$axios({
+                    method: "post",
+                    url: this.$api.sceneLibrary.deleteSceneNatural,
+                    data: {
+                        naturalId: row.naturalId,
+                    },
+                }).then((res) => {
+                    if (res.code == 200) {
+                        this.$message.success("删除成功");
+                    } else {
+                        this.$message.error(res.message || "删除失败");
+                    }
+                    this.doSearch();
+                });
+            });
+        },
+        diaClose(done) {
+            this.autoplay = false;
+            this.videoSrc = "";
+            done();
+        },
+        didUpload() {
+            this.doSearch();
+        },
+        getFileNameList() {
+            this.$axios({
+                method: "post",
+                url: this.$api.sceneLibrary.queryType,
+                data: {},
+            }).then((res) => {
+                if (res.code == 200 && res.info) {
+                    let arr = [];
+                    res.info.forEach((item, i) => {
+                        arr[i] = {
+                            code: item,
+                            caption: item,
+                        };
+                    });
+                    this.fileNameList = arr;
+                } else {
+                    this.$message.error(res.message || "获取功能模块列表失败");
+                }
+            });
+        },
+    },
+
+    async mounted() {
+        await this.$dicsListsInit({
+            scenarioWeatherList: "scenarioWeather",
+        });
+
+        this.getFileNameList();
+    },
+};
+</script>
+
+<style lang='less' scoped>
+@import "./common/util.less";
+.generalizationScenarioListPanel {
+    .inputBox {
+        .label {
+            min-width: 90px;
+        }
+    }
+
+    .btnsPanel {
+        text-align: right;
+    }
+}
+</style>

+ 230 - 33
src/views/sceneLibrary/scenePacketList.vue

@@ -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;
         }

+ 2 - 0
vue.config.js

@@ -94,6 +94,7 @@ module.exports = {
                 // target: 'http://10.12.10.72:8001',  // 王晓峰
                 // target: 'http://192.168.30.75',  // gq
                 // target: 'http://47.94.105.148',  // aliyun
+                // target: 'http://47.93.217.159',  // aliyun-dev
                 // target: 'http://10.12.10.74:8001',
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数
@@ -109,6 +110,7 @@ module.exports = {
                 target: 'http://10.12.10.70',  // windowstest
                 // target: 'http://192.168.30.75',  // gq
                 // target: 'http://47.94.105.148',  // aliyun
+                // target: 'http://47.93.217.159',  // aliyun-dev
                 // target: 'http://10.12.10.74:7003', // 孟令鑫
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数