Ver Fonte

场景库联调

zhangliang2 há 3 anos atrás
pai
commit
3850a2c6a3

+ 11 - 7
src/api/sceneLibrary.js

@@ -1,5 +1,4 @@
 const basePart = '/simulation/resource/server';
-// const queryScenePackageSublistList = basePart + '/ScenePackage/queryScenePackageSublistList';
 
 
 const queryScoringRulesList = basePart + '/ScoringRules/queryScoringRulesList'; // 打分规则列表
@@ -18,12 +17,16 @@ const querySceneNaturalList = basePart + '/SceneNatural/querySceneNaturalList';
 const saveSceneNatural = basePart + '/SceneNatural/saveSceneNatural'; // 新增自然驾驶场景
 
 const queryScenePackageList = basePart + '/ScenePackage/queryScenePackageList'; // 场景测试包管理列表
+const instShareList = basePart + '/ScenePackage/instShareList'; // 分享场景测试包
+const deleteList = basePart + '/ScenePackage/deleteList'; // 删除场景测试包
+
 const queryScenePackageSublistList = basePart + '/ScenePackage/queryScenePackageSublistList'; // 场景数据包列表
+const saveScenePackage = basePart + '/ScenePackage/saveScenePackage'; // 场景数据包列表保存
+const queryCsb = basePart + '/ScoringRules/queryCsb'; // 测试包添加打分规则下拉
 
 
 
 export default {
-    // queryScenePackageSublistList,
     queryScoringRulesList,
     queryScoringRules,
     saveScoringRules,
@@ -40,9 +43,10 @@ export default {
     saveSceneNatural,
 
     queryScenePackageList,
-    queryScenePackageSublistList,
-
-}
+    instShareList,
+    deleteList,
 
-
-//localhost:7003/simulation/resource/server/ScenePackage/queryScenePackageSublistList
+    queryScenePackageSublistList,
+    saveScenePackage,
+    queryCsb
+}

BIN
src/assets/common/image/sensor/001.png


BIN
src/assets/common/image/sensor/002.png


BIN
src/assets/common/image/sensor/004.png


BIN
src/assets/common/image/sensor/005.png


+ 1 - 1
src/axios/filter.js

@@ -40,7 +40,7 @@ Vue.use(VueAxios, axios);
 axios.defaults.baseURL = ''; //项目的的基础url
 axios.defaults.headers.common['Authorization'] = ""; //请求token信息配置
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; //请求type设置
-axios.defaults.timeout = 15000; //在超时前,所有请求都会等待10
+axios.defaults.timeout = 24000; //在超时前,所有请求都会等待24
 axios.defaults.withCredentials = true;
 
 // 添加请求拦截器

+ 46 - 1
src/components/grid/TableList.vue

@@ -288,7 +288,38 @@
             errorClearing: {
                 type: Boolean,
                 default: false
-            }
+            },
+            // 是否需要在表格通过请求后,加载传进来的callback
+            needLoadedCallBack: {
+                default: false,
+                type: Boolean
+            },
+            // 传进来的callback
+            loadedCallBack:{
+                default:function () {
+
+                },
+                type: Function
+            },
+            // 当用户手动勾选数据行的 Checkbox 时触发的事件后是否需要回调
+            needSelectedCallBack: {
+                default: false,
+                type: Boolean
+            },
+            // 当用户手动勾选数据行的 Checkbox 时触发的事件后传递的回调
+            selectedCallBack:{
+                default:function () {
+
+                },
+                type: Function
+            },
+            // 当用户手动勾选数据行全选时触发的事件后传递的回调
+            selectedAllCallBack:{
+                default:function () {
+
+                },
+                type: Function
+            },
         },
         data: function () {
             return {
@@ -557,6 +588,9 @@
                         return data; //grid表格promise参数传递 2020-5-27 add 张朋博
                     }).then((data)=>{
                         _this.selectData()
+                        if(this.needLoadedCallBack) {
+                            this.loadedCallBack();
+                        }
                         return data; //grid表格promise参数传递 2020-5-27 add 张朋博
                     }).catch(function (error) {
                         _this.loading=false
@@ -565,11 +599,13 @@
 
             },
             select(selection, row) {
+                var type = 1; // 判断是选中 1 还是取消选中 0
                 if (selection.indexOf(row) >= 0) {
                     if (this.checkedData.indexOf(row) == -1) {
                         this.checkedData.push(row)
                     }
                 } else {
+                    type = 0;
                     this.checkedData.forEach((item, index) => {
                         if(item.id && row.id){
                             if (item.id == row.id) {
@@ -582,9 +618,14 @@
                         }
                     })
                 }
+
+                if(this.needSelectedCallBack) {
+                    this.selectedCallBack(row, type);
+                }
             },
             selectAll(selection=[]) {
                 let _this = this
+                var type = 1; // 判断是选中 1 还是取消选中 0
                 if (selection.length > 0) {
                     selection.forEach(row => {
                         let item = JSON.stringify(row)
@@ -593,6 +634,7 @@
                         }
                     })
                 } else {
+                    type = 0;
                     _this.tableData.forEach(row => {
                         let item = JSON.stringify(row)
                         _this.checkedData.forEach((item1, index) => {
@@ -606,6 +648,9 @@
                     this.$refs.ListTable.clearSelection()
                     this.checkedData.length=0
                 }
+                if(this.needSelectedCallBack) {
+                    this.selectedAllCallBack(selection, type);
+                }
             },
 
             //选中用户默认要选中的数据

+ 1 - 6
src/views/algorithmsLibrary/algorithmsLibraryList.vue

@@ -104,11 +104,10 @@
 <script>
 import searchLayout from "@/components/grid/searchLayout";
 import tableList from "@/components/grid/TableList";
-import toolbarTab from "@/components/toolbar/toolbarTab";
 
 export default {
     name: "algorithmsLibraryList", // 算法库列表
-    components: { searchLayout, tableList, toolbarTab },
+    components: { searchLayout, tableList },
     data() {
         return {
             activeName: "1",
@@ -304,8 +303,4 @@ export default {
         top: 45px;
     }
 }
-
-.toolbarTab {
-    margin: 45px 40px 15px;
-}
 </style>

+ 5 - 5
src/views/modelLibrary/components/handleConfigList.vue

@@ -428,23 +428,23 @@ export default {
         }
 
         .sensorIconA {
-            background: url("../../../assets/common/image/sensor/01.png") center
+            background: url("../../../assets/common/image/sensor/001.png") center
                 no-repeat;
         }
         .sensorIconB {
-            background: url("../../../assets/common/image/sensor/02.png") center
+            background: url("../../../assets/common/image/sensor/002.png") center
                 no-repeat;
         }
         .sensorIconC {
-            background: url("../../../assets/common/image/sensor/03.png") center
+            background: url("../../../assets/common/image/sensor/003.png") center
                 no-repeat;
         }
         .sensorIconD {
-            background: url("../../../assets/common/image/sensor/04.png") center
+            background: url("../../../assets/common/image/sensor/004.png") center
                 no-repeat;
         }
         .sensorIconE {
-            background: url("../../../assets/common/image/sensor/05.png") center
+            background: url("../../../assets/common/image/sensor/005.png") center
                 no-repeat;
         }
 

+ 1 - 1
src/views/modelLibrary/vehicleConfigurationDetail.vue

@@ -184,7 +184,7 @@ export default {
         let validateNum = (rule, value, callback) => {
             // !/^(-?\d+)(\.\d{1,2})?$/.test(value) &&
             // !(/^(-?(0|[1-9][0-9]+))(\.\d{1,2})?$/.test(value)) &&
-            !/^(-?(0|[1-9]+))(\.\d{1,2})?$/.test(value) &&
+            !/^(-?(0|[1-9]+))[(\.\d{1,2})]?$/.test(value) &&
                 callback(new Error(rule.message));
             callback();
         };

+ 4 - 4
src/views/page/pageMenu.vue

@@ -60,15 +60,15 @@
                             <i class="my-icon-menuA"></i>
                             <span>模型库</span>
                         </template>
-                        <el-menu-item index="vehicleConfigurationList"
-                            >车辆配置</el-menu-item
-                        >
                         <el-menu-item index="sensorModel"
                             >传感器模型</el-menu-item
                         >
                         <el-menu-item index="vehicleModel"
                             >车辆模型</el-menu-item
                         >
+                        <el-menu-item index="vehicleConfigurationList"
+                            >车辆配置</el-menu-item
+                        >
                     </el-submenu>
                     <el-submenu index="algorithmsLibrary">
                         <template slot="title">
@@ -159,7 +159,7 @@ export default {
     created() {
         localStorage.setItem(
             "Authorization",
-            "Bearer 4104c3ac-1756-4da4-aa80-d7bfcf8bc035"
+            "Bearer fd135698-d12d-43de-b923-1585c2a3d07c"
         );
         // document.cookie = 'Authorization=Bearer 52de2c22-c2f9-4307-b49d-5b5593792352'
         // console.log(this.$route);

+ 1 - 0
src/views/sceneLibrary/components/fileDialog.vue

@@ -67,6 +67,7 @@ export default {
         },
         dataHandel(data, type) {
             if (type === "video") {
+                // 通过文件类型判断是否有video文件
                 let video = this.attachmentList.find((i) =>
                     i.fileType.includes("video")
                 );

+ 496 - 239
src/views/sceneLibrary/components/realSceneList.vue

@@ -1,33 +1,36 @@
 <template>
     <div>
         <div class="tabsBox">
-            <toolbarTab
-                :isConnect="true"
-                position="top"
-                :subPageActiveName="subPageActiveName"
-                :toolbarItem="pageBtnList"
-                @toolbarClick="pageControl"
-                class="toolbarTab"
-            >
-            </toolbarTab>
+            <div class="myTabsBox myTabsBoxThreeTabs">
+                <el-tabs
+                    v-model="activeName"
+                    type="card"
+                    @tab-click="pageControl"
+                >
+                    <el-tab-pane label="交通事故场景" name="1"></el-tab-pane>
+                    <el-tab-pane label="自然驾驶场景" name="2"></el-tab-pane>
+                    <el-tab-pane label="标准法规场景" name="3"></el-tab-pane>
+                </el-tabs>
+            </div>
 
-            <div v-show="activitedPageNum === 1">
+            <div v-show="activeName === '1'">
                 <search-layout>
                     <template slot="searchItem1">
                         <span class="label">场景名称</span>
                         <el-input
-                            v-model="searchParamsA.id"
+                            v-model="searchParamsA.sceneName"
                             size="small"
                             clearable
                             placeholder="请输入"
+                            maxlength="60"
                         >
                         </el-input>
                     </template>
                     <template slot="searchItem2">
                         <span class="label">自车驾驶行为</span>
-                        <el-select v-model="searchParamsA.status" multiple>
+                        <el-select v-model="searchParamsA.selfDriving" multiple>
                             <el-option
-                                v-for="item in list"
+                                v-for="item in selfDrivingList"
                                 :label="item.caption"
                                 :value="item.code"
                                 :key="item.code"
@@ -36,9 +39,12 @@
                     </template>
                     <template slot="searchItem3">
                         <span class="label">目标驾驶行为</span>
-                        <el-select v-model="searchParamsA.status" multiple>
+                        <el-select
+                            v-model="searchParamsA.targetDriving"
+                            multiple
+                        >
                             <el-option
-                                v-for="item in list"
+                                v-for="item in targetDrivingList"
                                 :label="item.caption"
                                 :value="item.code"
                                 :key="item.code"
@@ -47,9 +53,12 @@
                     </template>
                     <template slot="searchItem4">
                         <span class="label">自车反应行为</span>
-                        <el-select v-model="searchParamsA.status" multiple>
+                        <el-select
+                            v-model="searchParamsA.selfReaction"
+                            multiple
+                        >
                             <el-option
-                                v-for="item in list"
+                                v-for="item in selfReactionList"
                                 :label="item.caption"
                                 :value="item.code"
                                 :key="item.code"
@@ -58,9 +67,12 @@
                     </template>
                     <template slot="searchItem5">
                         <span class="label">冲突行为</span>
-                        <el-select v-model="searchParamsA.status" multiple>
+                        <el-select
+                            v-model="searchParamsA.conflictBehavior"
+                            multiple
+                        >
                             <el-option
-                                v-for="item in list"
+                                v-for="item in conflictBehaviorList"
                                 :label="item.caption"
                                 :value="item.code"
                                 :key="item.code"
@@ -69,9 +81,12 @@
                     </template>
                     <template slot="searchItem6">
                         <span class="label">冲突类型</span>
-                        <el-select v-model="searchParamsA.status" multiple>
+                        <el-select
+                            v-model="searchParamsA.conflictType"
+                            multiple
+                        >
                             <el-option
-                                v-for="item in list"
+                                v-for="item in conflictTypeList"
                                 :label="item.caption"
                                 :value="item.code"
                                 :key="item.code"
@@ -79,122 +94,155 @@
                         </el-select>
                     </template>
                     <template slot="searchBtn1">
-                        <el-button type="primary">查询</el-button>
+                        <el-button type="primary" @click="doSearchA"
+                            >查询</el-button
+                        >
                     </template>
                     <template slot="searchBtn2">
-                        <el-button type="primary">重置</el-button>
+                        <el-button type="primary" @click="doResetA"
+                            >重置</el-button
+                        >
                     </template>
                 </search-layout>
                 <div class="isSelected">
-                    <el-checkbox v-model="selectedA">已选择</el-checkbox>
+                    <el-checkbox v-model="selectedA" @change="selectedShowA"
+                        >已选择</el-checkbox
+                    >
                 </div>
                 <tableList
                     ref="tableA"
                     :columns="columnsA"
                     :getDataWay="getDataWayA"
                     :pagination="paginationA"
+                    :checkedData="checkedArrA"
+                    :needLoadedCallBack="true"
+                    :loadedCallBack="loadedCallBackA"
+                    :needSelectedCallBack="true"
+                    :selectedCallBack="selectedCallBackA"
+                    :selectedAllCallBack="selectedAllCallBackA"
                     index
                     selection
                 >
                 </tableList>
             </div>
 
-            <div v-show="activitedPageNum === 2">
+            <div v-show="activeName === '2'">
                 <search-layout>
                     <template slot="searchItem1">
-                        <span class="label">道路</span>
-                        <el-select v-model="searchParamsB.status">
-                            <el-option
-                                v-for="item in list"
-                                :label="item.caption"
-                                :value="item.code"
-                                :key="item.code"
-                            ></el-option>
-                        </el-select>
+                        <span class="label">场景编号</span>
+                        <el-input
+                            v-model="searchParamsB.naturalName"
+                            size="small"
+                            clearable
+                            placeholder="请输入"
+                            maxlength="60"
+                        >
+                        </el-input>
                     </template>
                     <template slot="searchItem2">
-                        <span class="label">基础设施</span>
-                        <el-select v-model="searchParamsB.status">
-                            <el-option
-                                v-for="item in list"
-                                :label="item.caption"
-                                :value="item.code"
-                                :key="item.code"
-                            ></el-option>
-                        </el-select>
+                        <span class="label">道路</span>
+                        <el-cascader
+                            v-model="searchParamsB.road"
+                            :options="roadList"
+                            :props="props"
+                            clearable=""
+                        ></el-cascader>
                     </template>
                     <template slot="searchItem3">
-                        <span class="label">交通情况</span>
-                        <el-select v-model="searchParamsB.status">
-                            <el-option
-                                v-for="item in list"
-                                :label="item.caption"
-                                :value="item.code"
-                                :key="item.code"
-                            ></el-option>
-                        </el-select>
+                        <span class="label">基础设施</span>
+                        <el-cascader
+                            v-model="searchParamsB.infrastructure"
+                            :options="infrastructureList"
+                            :props="props"
+                            clearable=""
+                        ></el-cascader>
                     </template>
                     <template slot="searchItem4">
-                        <span class="label">自车行为</span>
-                        <el-select v-model="searchParamsB.status">
-                            <el-option
-                                v-for="item in list"
-                                :label="item.caption"
-                                :value="item.code"
-                                :key="item.code"
-                            ></el-option>
-                        </el-select>
+                        <span class="label">交通情况</span>
+                        <el-cascader
+                            v-model="searchParamsB.trafficCondition"
+                            :options="trafficConditionList"
+                            :props="props"
+                            clearable=""
+                        ></el-cascader>
                     </template>
                     <template slot="searchItem5">
-                        <span class="label">目标行为</span>
-                        <el-select v-model="searchParamsB.status">
-                            <el-option
-                                v-for="item in list"
-                                :label="item.caption"
-                                :value="item.code"
-                                :key="item.code"
-                            ></el-option>
-                        </el-select>
+                        <span class="label">自车行为</span>
+                        <el-cascader
+                            v-model="searchParamsB.selfBehavior"
+                            :options="selfBehaviorList"
+                            :props="props"
+                            clearable=""
+                        ></el-cascader>
                     </template>
                     <template slot="searchItem6">
+                        <span class="label">目标行为</span>
+                        <el-cascader
+                            v-model="searchParamsB.targetBehavior"
+                            :options="targetBehaviorList"
+                            :props="props"
+                            clearable=""
+                        ></el-cascader>
+                    </template>
+                    <template slot="searchItem7">
                         <span class="label">自然环境</span>
-                        <el-select v-model="searchParamsB.status">
-                            <el-option
-                                v-for="item in list"
-                                :label="item.caption"
-                                :value="item.code"
-                                :key="item.code"
-                            ></el-option>
-                        </el-select>
+                        <el-cascader
+                            v-model="searchParamsB.naturalEnvironment"
+                            :options="naturalEnvironmentList"
+                            :props="props"
+                            clearable=""
+                        ></el-cascader>
+                    </template>
+                    <template slot="searchItem8">
+                        <span class="label">临时性操纵</span>
+                        <el-cascader
+                            v-model="searchParamsB.temporaryOperation"
+                            :options="temporaryOperationList"
+                            :props="props"
+                            clearable=""
+                        ></el-cascader>
                     </template>
                     <template slot="searchBtn1">
-                        <el-button type="primary">查询</el-button>
+                        <el-button type="primary" @click="doSearchB"
+                            >查询</el-button
+                        >
                     </template>
                     <template slot="searchBtn2">
-                        <el-button type="primary">重置</el-button>
+                        <el-button type="primary" @click="doResetB"
+                            >重置</el-button
+                        >
                     </template>
                 </search-layout>
                 <div class="isSelected">
-                    <el-checkbox v-model="selectedB">已选择</el-checkbox>
+                    <el-checkbox v-model="selectedB" @change="selectedShowB"
+                        >已选择</el-checkbox
+                    >
                 </div>
                 <tableList
                     ref="tableB"
                     :columns="columnsB"
                     :getDataWay="getDataWayB"
                     :pagination="paginationB"
+                    :checkedData="checkedArrB"
+                    :needLoadedCallBack="true"
+                    :loadedCallBack="loadedCallBackB"
+                    :needSelectedCallBack="true"
+                    :selectedCallBack="selectedCallBackB"
+                    :selectedAllCallBack="selectedAllCallBackB"
                     index
                     selection
                 >
                 </tableList>
             </div>
 
-            <div v-show="activitedPageNum === 3">
+            <div v-show="activeName === '3'">
                 <search-layout>
                     <template slot="searchItem1">
                         <span class="label">场景名称</span>
                         <el-input
-                            v-model="searchParamsC.id"
+                            v-model="searchParamsC.sceneName"
                             size="small"
+                            maxlength="60"
                             clearable
                             placeholder="请输入"
                         >
@@ -202,9 +250,12 @@
                     </template>
                     <template slot="searchItem2">
                         <span class="label">法规类型</span>
-                        <el-select v-model="searchParamsC.status" multiple>
+                        <el-select
+                            v-model="searchParamsC.regulationType"
+                            multiple
+                        >
                             <el-option
-                                v-for="item in list"
+                                v-for="item in regulationTypeList"
                                 :label="item.caption"
                                 :value="item.code"
                                 :key="item.code"
@@ -214,28 +265,41 @@
                     <template slot="searchItem3">
                         <span class="label">标准类型</span>
                         <el-input
-                            v-model="searchParamsC.id"
+                            v-model="searchParamsC.standardType"
                             size="small"
+                            maxlength="60"
                             clearable
                             placeholder="请输入"
                         >
                         </el-input>
                     </template>
                     <template slot="searchBtn1">
-                        <el-button type="primary">查询</el-button>
+                        <el-button type="primary" @click="doSearchC"
+                            >查询</el-button
+                        >
                     </template>
                     <template slot="searchBtn2">
-                        <el-button type="primary">重置</el-button>
+                        <el-button type="primary" @click="doResetC"
+                            >重置</el-button
+                        >
                     </template>
                 </search-layout>
                 <div class="isSelected">
-                    <el-checkbox v-model="selectedC">已选择</el-checkbox>
+                    <el-checkbox v-model="selectedC" @change="selectedShowC"
+                        >已选择</el-checkbox
+                    >
                 </div>
                 <tableList
                     ref="tableC"
                     :columns="columnsC"
                     :getDataWay="getDataWayC"
                     :pagination="paginationC"
+                    :checkedData="checkedArrC"
+                    :needLoadedCallBack="true"
+                    :loadedCallBack="loadedCallBackC"
+                    :needSelectedCallBack="true"
+                    :selectedCallBack="selectedCallBackC"
+                    :selectedAllCallBack="selectedAllCallBackC"
                     index
                     selection
                 >
@@ -244,10 +308,15 @@
         </div>
 
         <div class="flexBox summaryBox">
-            <div>场景总数: {{ sceneTotal }}</div>
-            <div>交通事故场景: {{ sceneA }}</div>
-            <div>自然驾驶场景: {{ sceneB }}</div>
-            <div>标准法规场景: {{ sceneC }}</div>
+            <div>
+                场景总数:
+                {{
+                    checkedIdsA.length + checkedIdsB.length + checkedIdsC.length
+                }}
+            </div>
+            <div>交通事故场景: {{ checkedIdsA.length }}</div>
+            <div>自然驾驶场景: {{ checkedIdsB.length }}</div>
+            <div>标准法规场景: {{ checkedIdsC.length }}</div>
         </div>
     </div>
 </template>
@@ -263,82 +332,46 @@ export default {
     data() {
         return {
             list: [],
-            activitedPageNum: 1,
-            subPageActiveName: 1,
-            pageBtnList: [
-                {
-                    type: "primary",
-                    title: "交通事故场景",
-                    key: "all",
-                    fromId: 1,
-                    method: "showAll",
-                    plain: true,
-                    disabled: false,
-                },
-                {
-                    type: "primary",
-                    title: "自然驾驶场景",
-                    key: "notRead",
-                    fromId: 2,
-                    method: "showNotRead",
-                    plain: true,
-                    disabled: false,
-                },
-                {
-                    type: "primary",
-                    title: "标准法规场景",
-                    key: "notRead1",
-                    fromId: 3,
-                    method: "showNotRead1",
-                    plain: true,
-                    disabled: false,
-                },
-            ],
+            activeName: "1",
             searchParamsA: {
                 //搜索参数
-                id: "", //ID
-                clientOrgName: "", //车辆名称
-                clientOrgName1: "", //配置名称
-                clientOrgName2: "", //配置描述
-                status: "",
-                x: "1",
-                c: [],
+                sceneName: "", //场景名称
+                selfDriving: [], //自车驾驶行为
+                targetDriving: [], //目标驾驶行为
+                selfReaction: [], //自车反应行为
+                conflictBehavior: [], //冲突行为
+                conflictType: [], //冲突类型
             },
+            selfDrivingList: [],
+            targetDrivingList: [],
+            selfReactionList: [],
+            conflictBehaviorList: [],
+            conflictTypeList: [],
             columnsA: [
                 //表格列
                 {
                     label: "场景名称",
-                    prop: "id",
+                    prop: "sceneName",
                 },
                 {
                     label: "自车驾驶行为",
-                    prop: "aid1",
+                    prop: "selfDriving",
                 },
                 {
                     label: "目标驾驶行为",
-                    prop: "ktName",
+                    prop: "targetDriving",
                 },
                 {
                     label: "自车反应行为",
-                    prop: "jbSource",
+                    prop: "selfReaction",
                 },
                 {
                     label: "冲突行为",
-                    prop: "jbSource",
+                    prop: "conflictBehavior",
                 },
                 {
                     label: "冲突类型",
-                    prop: "jbSource",
-                },
-                {
-                    label: "标签",
-                    prop: "asd",
-                    template: true,
-                },
-                {
-                    label: "操作",
-                    prop: "cgInfos",
-                    template: true,
+                    prop: "conflictType",
                 },
             ],
             paginationA: {
@@ -351,61 +384,52 @@ export default {
             },
             getDataWayA: {
                 //加载表格数据
-                dataType: "data",
+                dataType: "url",
                 type: "post",
-                firstRequest: false,
-                data: [
-                    {
-                        id: 1,
-                        ktName: "kjdhfkjsdhfkjsjhdfksdjhfkhwoieyrhfisdhfksjhdf",
-                        jbSource: "收到就好付款时间的回复可见收到货覅无痕",
-                    },
-                    { id: 2 },
-                    { id: 3 },
-                    { id: 4 },
-                    { id: 51 },
-                    { id: 6 },
-                ],
-                // data: this.$api.scientificStatistics.typeProjectStatistics,
+                // firstRequest: false,
+                data: this.$api.sceneLibrary.querySceneAccidentList,
                 param: {},
             },
-            selectedA: false,
+            selectedA: false, // 是否选中展示已选择项
             searchParamsB: {
                 //搜索参数
-                id: "", //ID
-                clientOrgName: "", //车辆名称
-                clientOrgName1: "", //配置名称
-                clientOrgName2: "", //配置描述
-                status: "",
-                c: [],
+                naturalName: "", // 场景编号
+                road: [], // 道路
+                infrastructure: [], // 基础设施
+                trafficCondition: [], // 交通情况
+                selfBehavior: [], // 自车行为
+                targetBehavior: [], // 目标行为
+                naturalEnvironment: [], // 自然环境
+            },
+            roadList: [],
+            infrastructureList: [],
+            trafficConditionList: [],
+            selfBehaviorList: [],
+            targetBehaviorList: [],
+            naturalEnvironmentList: [],
+            temporaryOperationList: [],
+            props: {
+                multiple: true,
+                label: "dictName",
+                value: "dictCode",
             },
             columnsB: [
                 //表格列
                 {
-                    label: "场景名称",
-                    prop: "aid1",
+                    label: "场景编号",
+                    prop: "naturalName",
                 },
                 {
                     label: "天气",
-                    prop: "ktName",
+                    prop: "weather",
                 },
                 {
                     label: "自车行为",
-                    prop: "jbSource",
+                    prop: "selfBehavior",
                 },
                 {
                     label: "目标行为",
-                    prop: "jbSource",
-                },
-                {
-                    label: "标签",
-                    prop: "asd",
-                    template: true,
-                },
-                {
-                    label: "操作",
-                    prop: "cgInfos",
-                    template: true,
+                    prop: "targetBehavior",
                 },
             ],
             paginationB: {
@@ -418,56 +442,33 @@ export default {
             },
             getDataWayB: {
                 //加载表格数据
-                dataType: "data",
+                dataType: "url",
                 type: "post",
-                firstRequest: false,
-                data: [
-                    {
-                        id: 1,
-                        ktName: "kjdhfkjsdhfkjsjhdfksdjhfkhwoieyrhfisdhfksjhdf",
-                        jbSource: "收到就好付款时间的回复可见收到货覅无痕",
-                    },
-                    { id: 2 },
-                    { id: 3 },
-                    { id: 4 },
-                    { id: 51 },
-                    { id: 6 },
-                ],
+                // firstRequest: false,
+                data: this.$api.sceneLibrary.querySceneNaturalList,
                 param: {},
             },
             selectedB: false,
             searchParamsC: {
                 //搜索参数
-                id: "", //ID
-                clientOrgName: "", //车辆名称
-                clientOrgName1: "", //配置名称
-                clientOrgName2: "", //配置描述
-                status: "",
-                c: [],
+                sceneName: "", //场景名称
+                regulationType: [], //法规类型
+                standardType: "", //标准类型
             },
+            regulationTypeList: [],
             columnsC: [
                 //表格列
                 {
                     label: "场景名称",
-                    prop: "id",
+                    prop: "sceneName",
                 },
                 {
                     label: "法规类型",
-                    prop: "aid1",
+                    prop: "regulationType",
                 },
                 {
                     label: "标准类型",
-                    prop: "ktName",
-                },
-                {
-                    label: "标签",
-                    prop: "asd",
-                    template: true,
-                },
-                {
-                    label: "操作",
-                    prop: "cgInfos",
-                    template: true,
+                    prop: "standardType",
                 },
             ],
             paginationC: {
@@ -480,29 +481,20 @@ export default {
             },
             getDataWayC: {
                 //加载表格数据
-                dataType: "data",
+                dataType: "url",
                 type: "post",
-                firstRequest: false,
-                data: [
-                    {
-                        id: 1,
-                        ktName: "kjdhfkjsdhfkjsjhdfksdjhfkhwoieyrhfisdhfksjhdf",
-                        jbSource: "收到就好付款时间的回复可见收到货覅无痕",
-                    },
-                    { id: 2 },
-                    { id: 3 },
-                    { id: 4 },
-                    { id: 51 },
-                    { id: 6 },
-                ],
-                // data: this.$api.scientificStatistics.typeProjectStatistics,
+                // firstRequest: false,
+                data: this.$api.sceneLibrary.queryStandardsRegulationsList,
                 param: {},
             },
             selectedC: false,
-            sceneTotal: 0,
-            sceneA: 0,
-            sceneB: 0,
-            sceneC: 0,
+            checkedArrA: [], // 交通事故列表已选
+            checkedArrB: [], // 自然驾驶列表已选
+            checkedArrC: [], // 标准法规列表已选
+
+            checkedIdsA: [], // 当前交通事故列表已选
+            checkedIdsB: [], // 当前自然驾驶列表已选
+            checkedIdsC: [], // 当前标准法规列表已选
         };
     },
 
@@ -510,11 +502,246 @@ export default {
 
     methods: {
         pageControl(data) {
-            this.activitedPageNum = data.fromId;
+            this.activeName = data.name;
+            if (this.activeName === "1") {
+                this.doSearchA();
+            } else if (this.activeName === "2") {
+                this.doSearchB();
+            } else {
+                this.doSearchC();
+            }
+        },
+        doSearchA() {
+            let data = { ...this.searchParamsA };
+            if (this.selectedA) {
+                data.ids = this.checkedIdsA;
+            } else {
+                data.ids = null;
+            }
+
+            this.refreshListA(data);
+        },
+        //刷新table
+        refreshListA(param) {
+            param
+                ? this.$refs["tableA"].loadData(param)
+                : this.$refs["tableA"].loadData();
+        },
+        doResetA() {
+            this.searchParamsA = {
+                sceneName: "",
+                selfDriving: [],
+                targetDriving: [],
+                selfReaction: [],
+                conflictBehavior: [],
+                conflictType: [],
+            };
+            this.doSearchA();
+        },
+        // 数据加载后的回调
+        loadedCallBackA() {
+            this.checkedArrA = [];
+            this.$refs.tableA.tableData.forEach((i) => {
+                if (this.checkedIdsA.includes(i.accidentId)) {
+                    // 显示已选中的项
+                    this.$refs.tableA.$refs.ListTable.toggleRowSelection(
+                        i,
+                        true
+                    );
+                    this.checkedArrA.push(i);
+                }
+            });
+        },
+        // 用户勾选完执行函数后的回调
+        selectedCallBackA(row, type) {
+            if (type === 1) {
+                if (!this.checkedIdsA.includes(row.accidentId)) {
+                    this.checkedIdsA.push(row.accidentId);
+                }
+            } else {
+                let index = this.checkedIdsA.indexOf(row.accidentId);
+                if (index > -1) {
+                    this.checkedIdsA.splice(index, 1);
+                }
+            }
+        },
+        // 用户勾选全选执行函数后的回调
+        selectedAllCallBackA(selection, type) {
+            if (type === 1) {
+                selection.forEach((i) => {
+                    if (!this.checkedIdsA.includes(i.accidentId)) {
+                        this.checkedIdsA.push(i.accidentId);
+                    }
+                });
+            } else {
+                this.$refs.tableA.tableData.forEach((i) => {
+                    let index = this.checkedIdsA.indexOf(i.accidentId);
+                    if (index > -1) {
+                        this.checkedIdsA.splice(index, 1);
+                    }
+                });
+            }
+        },
+        doSearchB() {
+            let data = { ...this.searchParamsB };
+            if (this.selectedB) {
+                data.ids = this.checkedIdsB;
+            } else {
+                data.ids = null;
+            }
+
+            this.refreshListB(data);
+        },
+        //刷新table
+        refreshListB(param) {
+            param
+                ? this.$refs["tableB"].loadData(param)
+                : this.$refs["tableB"].loadData();
+        },
+        doResetB() {
+            this.searchParamsB = {
+                naturalName: "",
+                road: [],
+                infrastructure: [],
+                trafficCondition: [],
+                selfBehavior: [],
+                targetBehavior: [],
+                naturalEnvironment: [],
+                temporaryOperation: [],
+            };
+            this.doSearchB();
+        },
+        loadedCallBackB() {
+            this.checkedArrB = [];
+            this.$refs.tableB.tableData.forEach((i) => {
+                if (this.checkedIdsB.includes(i.naturalId)) {
+                    this.$refs.tableB.$refs.ListTable.toggleRowSelection(
+                        i,
+                        true
+                    );
+                    this.checkedArrB.push(i);
+                }
+            });
+        },
+        selectedCallBackB(row, type) {
+            if (type === 1) {
+                this.checkedIdsB.push(row.naturalId);
+            } else {
+                let index = this.checkedIdsB.indexOf(row.naturalId);
+                if (index > -1) {
+                    this.checkedIdsB.splice(index, 1);
+                }
+            }
+        },
+        selectedAllCallBackB(selection, type) {
+            if (type === 1) {
+                selection.forEach((i) => {
+                    if (!this.checkedIdsB.includes(i.naturalId)) {
+                        this.checkedIdsB.push(i.naturalId);
+                    }
+                });
+            } else {
+                this.$refs.tableB.tableData.forEach((i) => {
+                    let index = this.checkedIdsB.indexOf(i.naturalId);
+                    if (index > -1) {
+                        this.checkedIdsB.splice(index, 1);
+                    }
+                });
+            }
+        },
+        doSearchC() {
+            let data = { ...this.searchParamsC };
+            if (this.selectedC) {
+                data.ids = this.checkedIdsC;
+            } else {
+                data.ids = null;
+            }
+
+            this.refreshListC(data);
+        },
+        //刷新table
+        refreshListC(param) {
+            param
+                ? this.$refs["tableC"].loadData(param)
+                : this.$refs["tableC"].loadData();
+        },
+        doResetC() {
+            this.searchParamsC = {
+                sceneName: "",
+                regulationType: [],
+                standardType: "",
+            };
+            this.doSearchC();
+        },
+        loadedCallBackC() {
+            this.checkedArrC = [];
+            this.$refs.tableC.tableData.forEach((i) => {
+                if (this.checkedIdsC.includes(i.regulationsId)) {
+                    this.$refs.tableC.$refs.ListTable.toggleRowSelection(
+                        i,
+                        true
+                    );
+                    this.checkedArrC.push(i);
+                }
+            });
+        },
+        selectedCallBackC(row, type) {
+            if (type === 1) {
+                this.checkedIdsC.push(row.regulationsId);
+            } else {
+                let index = this.checkedIdsC.indexOf(row.regulationsId);
+                if (index > -1) {
+                    this.checkedIdsC.splice(index, 1);
+                }
+            }
+        },
+        selectedAllCallBackC(selection, type) {
+            if (type === 1) {
+                selection.forEach((i) => {
+                    if (!this.checkedIdsC.includes(i.regulationsId)) {
+                        this.checkedIdsC.push(i.regulationsId);
+                    }
+                });
+            } else {
+                this.$refs.tableC.tableData.forEach((i) => {
+                    let index = this.checkedIdsC.indexOf(i.regulationsId);
+                    if (index > -1) {
+                        this.checkedIdsC.splice(index, 1);
+                    }
+                });
+            }
+        },
+        selectedShowA() {
+            this.doSearchA();
+        },
+        selectedShowB() {
+            this.doSearchB();
+        },
+        selectedShowC() {
+            this.doSearchC();
         },
     },
 
-    // mounted() {},
+    async mounted() {
+        await this.$dicsListsInit({
+            selfDrivingList: "selfDriving",
+            targetDrivingList: "targetDriving",
+            selfReactionList: "selfReaction",
+            conflictBehaviorList: "conflictBehavior",
+            conflictTypeList: "conflictType",
+            regulationTypeList: "regulationType",
+        });
+
+        await this.$dicsTreesInit({
+            roadList: "road",
+            infrastructureList: "infrastructure",
+            trafficConditionList: "trafficCondition",
+            selfBehaviorList: "selfBehavior",
+            targetBehaviorList: "targetBehavior",
+            naturalEnvironmentList: "naturalEnvironment",
+            temporaryOperationList: "temporaryOperation",
+        });
+    },
 };
 </script>
 
@@ -530,7 +757,7 @@ export default {
     }
 
     .isSelected {
-        padding: 10px 0 10px 30px;
+        padding: 10px 0 10px 10px;
     }
 }
 
@@ -546,4 +773,34 @@ export default {
         margin-right: 30px;
     }
 }
+
+.myTabsBox {
+    /deep/ .el-tabs__nav-scroll {
+        &:after {
+            width: 100%;
+        }
+    }
+
+    &.myTabsBoxThreeTabs {
+        /deep/ .el-tabs {
+            width: auto;
+            margin: 0;
+        }
+
+        /deep/ .el-tabs__item {
+            width: 120px;
+        }
+    }
+
+    /deep/
+        .el-tabs--top.el-tabs--card
+        > .el-tabs__header
+        .el-tabs__item:nth-child(2) {
+        border-left-color: @gray;
+
+        &.is-active {
+            border-left-color: @themeColor;
+        }
+    }
+}
 </style>

+ 6 - 6
src/views/sceneLibrary/scenarioTestPackageManagementList.vue

@@ -205,12 +205,12 @@ export default {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",
-            }).then((e) => {
+            }).then(() => {
                 this.$axios({
                     method: "post",
-                    url: this.$api.sceneLibrary.fxScoringRules,
+                    url: this.$api.sceneLibrary.instShareList,
                     data: {
-                        rulesId: row.rulesId,
+                        packageId: row.packageId,
                     },
                 }).then((res) => {
                     if (res.code == 200) {
@@ -230,9 +230,9 @@ export default {
             }).then((e) => {
                 this.$axios({
                     method: "post",
-                    url: this.$api.sceneLibrary.deleteScoringRules,
+                    url: this.$api.sceneLibrary.deleteList,
                     data: {
-                        rulesId: row.rulesId,
+                        packageId: row.packageId,
                     },
                 }).then((res) => {
                     if (res.code == 200) {
@@ -247,7 +247,7 @@ export default {
         editRow(row) {
             this.$router.push({
                 path: "/scenePacketList",
-                query: { packageId: row.packageId },
+                query: { packageId: row.packageId, share: row.share },
             });
         },
     },

+ 428 - 84
src/views/sceneLibrary/scenePacketList.vue

@@ -7,9 +7,17 @@
         </div>
 
         <tableList ref="table" :columns="columns" :getDataWay="getDataWay">
-            <el-table-column label="操作" slot="cgInfos" align="center">
+            <el-table-column label="操作" slot="cgInfos" align="center" type="">
                 <template v-slot="scope">
                     <i
+                        v-if="
+                            (scope.row.children &&
+                                scope.row.children.length > 0) ||
+                            (!scope.row.children && scope.row.sceneNum === 0) ||
+                            (scope.row.children &&
+                                scope.row.children.length === 0 &&
+                                scope.row.sceneNum === 0)
+                        "
                         @click="addIndicators(scope.row)"
                         class="el-icon-plus elIcon"
                         title="添加"
@@ -20,25 +28,52 @@
                         title="编辑"
                     ></i>
                     <i
+                        v-if="scope.row.parentId != '0'"
                         @click="delRow(scope.row)"
                         class="el-icon-delete elIcon"
                         title="删除"
                     ></i>
                     <i
+                        v-if="
+                            !scope.row.children ||
+                            scope.row.children.length === 0
+                        "
                         @click="addScenario(scope.row)"
                         class="el-icon-document-add elIcon"
                         title="添加场景"
                     ></i>
                 </template>
             </el-table-column>
+            <el-table-column label="指标名称" slot="sublistName" align="left">
+                <template v-slot="scope">
+                    <span>{{ scope.row.sublistName }}</span>
+                </template>
+            </el-table-column>
         </tableList>
 
+        <div class="btns">
+            <el-button
+                type="primary"
+                v-if="share === '0' || share === ''"
+                @click="save(false)"
+                >保存</el-button
+            >
+            <el-button
+                type="primary"
+                v-if="share === '0' || share === '1'"
+                @click="save(true)"
+                >另存为</el-button
+            >
+            <el-button type="primary" plain @click="cancel">取消</el-button>
+        </div>
+
         <el-dialog
-            :title="diaTitle"
+            :title="nameDiaTitle"
             :visible.sync="indicatorsVisible"
             width="690px"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
+            :before-close="indicatorsCancel"
         >
             <el-form
                 ref="form"
@@ -46,35 +81,35 @@
                 :rules="rules"
                 label-width="108px"
             >
-                <el-form-item label="指标名称:" prop="name">
+                <el-form-item label="指标名称:" prop="sublistName">
                     <el-input
                         placeholder="请输入"
-                        maxlength="30"
-                        v-autoTrim="{ obj: form, key: 'name' }"
-                        v-model="form.name"
+                        maxlength="20"
+                        v-autoTrim="{ obj: form, key: 'sublistName' }"
+                        v-model="form.sublistName"
                     >
                     </el-input>
                 </el-form-item>
-                <el-form-item label="权重:" prop="x">
+                <el-form-item label="权重:" prop="weight">
                     <el-input
                         placeholder="请输入"
-                        maxlength="30"
-                        v-autoTrim="{ obj: form, key: 'x' }"
-                        v-model="form.x"
+                        maxlength="6"
+                        v-autoTrim="{ obj: form, key: 'weight' }"
+                        v-model="form.weight"
                     >
                     </el-input>
                 </el-form-item>
-                <el-form-item label="备注:" prop="des">
+                <el-form-item label="备注:" prop="remarks">
                     <el-input
                         v-autoTrim="{
                             obj: form,
-                            key: 'des',
+                            key: 'remarks',
                         }"
-                        v-model="form.des"
+                        v-model="form.remarks"
                         type="textarea"
                         placeholder="请输入"
                         :autosize="{ minRows: 4, maxRows: 4 }"
-                        maxlength="200"
+                        maxlength="300"
                     ></el-input>
                 </el-form-item>
             </el-form>
@@ -82,7 +117,7 @@
                 <el-button type="primary" @click="indicatorsConfirm"
                     >确 定</el-button
                 >
-                <el-button @click="indicatorsVisible = false">取 消</el-button>
+                <el-button @click="indicatorsCancel">取 消</el-button>
             </span>
         </el-dialog>
 
@@ -92,6 +127,7 @@
             width="690px"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
+            :before-close="scenarioCancel"
         >
             <el-form
                 ref="formA"
@@ -99,23 +135,23 @@
                 :rules="rulesA"
                 label-width="108px"
             >
-                <el-form-item label="场景分类:" prop="x">
-                    <el-select v-model="formA.y">
+                <el-form-item label="场景分类:" prop="sceneType">
+                    <el-select v-model="formA.sceneType">
                         <el-option
-                            v-for="item in listA"
+                            v-for="item in sceneTypeList"
                             :label="item.caption"
                             :value="item.code"
                             :key="item.code"
                         ></el-option>
                     </el-select>
                 </el-form-item>
-                <el-form-item label="评分规则:" prop="y">
-                    <el-select v-model="form.y">
+                <el-form-item label="评分规则:" prop="rulesId">
+                    <el-select v-model="formA.rulesId" @change="ruleSelChange">
                         <el-option
-                            v-for="item in list"
-                            :label="item.caption"
-                            :value="item.code"
-                            :key="item.code"
+                            v-for="item in ruleList"
+                            :label="item.ruleName"
+                            :value="item.rulesId"
+                            :key="item.rulesId"
                         ></el-option>
                     </el-select>
                 </el-form-item>
@@ -125,9 +161,9 @@
             </div>
             <span slot="footer">
                 <el-button type="primary" @click="scenarioConfirm"
-                    >确 定</el-button
+                    >下一步</el-button
                 >
-                <el-button @click="scenarioVisible = false">取 消</el-button>
+                <el-button @click="scenarioCancel">取 消</el-button>
             </span>
         </el-dialog>
 
@@ -135,17 +171,17 @@
             title="真实场景"
             :visible.sync="scenarioListsVisible"
             width="90%"
+            class="scenarioListsDia"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
+            :before-close="scenarioListsCancel"
         >
-            <real-scene-list></real-scene-list>
+            <real-scene-list ref="realScene"></real-scene-list>
             <span slot="footer">
                 <el-button type="primary" @click="scenarioListsConfirm"
                     >确 定</el-button
                 >
-                <el-button @click="scenarioListsVisible = false"
-                    >取 消</el-button
-                >
+                <el-button @click="scenarioListsCancel">取 消</el-button>
             </span>
         </el-dialog>
     </div>
@@ -161,14 +197,18 @@ export default {
     name: "scenePacketList", // 场景数据包
     components: { searchLayout, tableList, toolbarTab, realSceneList },
     data() {
+        let validateNum = (rule, value, callback) => {
+            if (value == 0) {
+                callback(new Error(rule.message));
+                return;
+            }
+            !/^(0|[1-9]+[0]*)[(\.\d{1,2})]?$/.test(value) &&
+                callback(new Error(rule.message));
+            callback();
+        };
         return {
-            searchParams: {
-                //搜索参数
-                id: "", //ID
-                clientOrgName: "", //车辆名称
-                clientOrgName1: "", //配置名称
-                clientOrgName2: "", //配置描述
-            },
+            packageId: "",
+            share: "",
             columns: [
                 {
                     label: "操作",
@@ -178,6 +218,7 @@ export default {
                 {
                     label: "指标名称",
                     prop: "sublistName",
+                    template: true,
                 },
                 {
                     label: "权重",
@@ -199,36 +240,72 @@ export default {
             getDataWay: {
                 //加载表格数据
                 dataType: "data",
-                // type: "post",
-                // firstRequest: false,
-                data: [],
-                // param: {},
+                // 给出根节点
+                data: [
+                    {
+                        children: null,
+                        id: "1",
+                        packageAndRules: "",
+                        packageLevel: 1,
+                        parentId: "0",
+                        remarks: "",
+                        rootId: null,
+                        ruleName: "",
+                        sceneGeneralizationIds: null,
+                        sceneNaturalIds: "",
+                        sceneNum: 0,
+                        sceneStatueIds: null,
+                        sceneTrafficIds: null,
+                        seq: 0,
+                        sublistName: "根节点",
+                        weight: 100,
+                    },
+                ],
             },
-            diaTitle: "",
+            idIndex: 1, // 用做新增加点id自加,因为id为空会报错
+            nameDiaTitle: "", // 编辑该级节点信息的dialog的title
             indicatorsVisible: false, // 编辑指标
             scenarioVisible: false, // 选择场景
             scenarioListsVisible: false, // 真实场景列表
             form: {
-                name: "",
-                des: "",
-                x: "",
-                y: "",
+                sublistName: "",
+                weight: "",
+                remarks: "",
             },
             rules: {
-                name: [{ required: true, message: "请输入", trigger: "blur" }],
-                x: [{ required: true, message: "请输入", trigger: "blur" }],
-                y: [{ required: true, message: "请选择", trigger: "change" }],
+                sublistName: [
+                    { required: true, message: "请输入", trigger: "blur" },
+                ],
+                weight: [
+                    { required: true, message: "请输入", trigger: "blur" },
+                    {
+                        validator: validateNum,
+                        message: "请输入最多带有2位小数的正数",
+                        trigger: ["blur"],
+                    },
+                ],
             },
-            list: [],
+            ruleList: [],
             formA: {
-                x: "",
-                y: "",
+                sceneType: "1",
+                ruleName: "",
+                rulesId: "",
             },
             rulesA: {
-                x: [{ required: true, message: "请选择", trigger: "change" }],
-                y: [{ required: true, message: "请选择", trigger: "change" }],
+                sceneType: [
+                    { required: true, message: "请选择", trigger: "change" },
+                ],
+                rulesId: [
+                    { required: true, message: "请选择", trigger: "change" },
+                ],
             },
-            listA: [],
+            sceneTypeList: [{ caption: "真实场景", code: "1" }],
+            nodeList: [], // 把当前所有节点遍历到一个扁平数组
+            curNode: {}, // 当前操作的节点
+            editType: "", // 点操作编辑的类型 新增or编辑
+            checkedIdsA: [], // 交通事故列表已选
+            checkedIdsB: [], // 自然驾驶列表已选
+            checkedIdsC: [], // 标准法规列表已选
         };
     },
 
@@ -243,72 +320,328 @@ export default {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",
-            }).then((e) => {
-                this.$axios({
-                    method: "post",
-                    url: this.$api.sceneLibrary.deleteScoringRules,
-                    data: {
-                        rulesId: row.rulesId,
-                    },
-                }).then((res) => {
-                    if (res.code == 200) {
-                        this.$message.success("删除成功");
-                    } else {
-                        this.$message.error(res.message || "删除失败");
-                    }
-                    this.doSearch();
-                });
+            }).then(() => {
+                this.deepFirstSearch(
+                    this.getDataWay.data[0],
+                    this.nodeList,
+                    row.parentId
+                );
+
+                let index = this.curNode.children.findIndex(
+                    (i) => i.id === row.id
+                );
+                this.curNode.children.splice(index, 1);
             });
         },
+        // 编辑该级节点信息
         editRow(row) {
-            this.$router.push({
-                path: "/scenePacketList",
-                query: {
-                    formData: {
-                        packageId: row.packageId,
-                    },
-                },
-            });
+            this.nameDiaTitle = "编辑指标";
+            this.editType = "edit";
+            this.indicatorsVisible = true;
+            this.form.sublistName = row.sublistName;
+            this.form.weight = row.weight;
+            this.form.remarks = row.remarks;
+
+            this.curNode = row;
         },
+        // 增加该级节点的子节点
         addIndicators(row) {
-            this.diaTitle = "添加指标";
+            this.nameDiaTitle = "添加指标";
+            this.editType = "add";
             this.indicatorsVisible = true;
+
+            this.curNode = row;
         },
+        // 添加场景
         addScenario(row) {
+            this.curNode = row;
+
+            if (row.packageAndRules) {
+                this.formA.rulesId = row.packageAndRules;
+                this.formA.ruleName = this.ruleList.find(
+                    (i) => i.rulesId === row.packageAndRules
+                ).ruleName;
+            }
+
             this.scenarioVisible = true;
         },
+        // 操作节点dialog的确定
         indicatorsConfirm() {
+            this.$refs.form.validate((valid) => {
+                if (valid) {
+                    if (this.editType == "edit") {
+                        // 编辑节点
+                        this.curNode.sublistName = this.form.sublistName;
+                        this.curNode.weight = this.form.weight;
+                        this.curNode.remarks = this.form.remarks;
+                    } else {
+                        // 新增节点
+                        ++this.idIndex;
+                        let node = {
+                            children: null,
+                            id: this.idIndex + "",
+                            packageAndRules: "",
+                            packageLevel: 1,
+                            parentId: this.curNode.id || "",
+                            remarks: this.form.remarks || "",
+                            rootId: this.packageId,
+                            ruleName: "",
+                            sceneGeneralizationIds: null,
+                            sceneNaturalIds: "",
+                            sceneNum: 0,
+                            sceneStatueIds: null,
+                            sceneTrafficIds: null,
+                            seq: 0,
+                            sublistName: this.form.sublistName,
+                            weight: this.form.weight,
+                        };
+                        if (!this.curNode.children) {
+                            this.curNode.children = [];
+                        }
+                        this.curNode.children.push(node);
+                    }
+
+                    this.indicatorsCancel();
+                }
+            });
+        },
+        // 操作节点dialog的取消
+        indicatorsCancel() {
+            this.$refs.form.resetFields();
+            this.form.sublistName = "";
+            this.form.weight = "";
+            this.form.remarks = "";
+            this.curNode = {};
             this.indicatorsVisible = false;
         },
+        // 场景分类dialog的确定 下一步
         scenarioConfirm() {
+            this.$refs.formA.validate((valid) => {
+                if (valid) {
+                    this.scenarioVisible = false;
+                    this.scenarioListsVisible = true;
+
+                    // 切换到第一个tab页并清空所有tab页中查询条件
+                    this.$nextTick(() => {
+                        this.$refs.realScene.activeName = "1";
+
+                        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(",");
+                        }
+                    });
+                }
+            });
+        },
+        // 场景分类dialog的取消
+        scenarioCancel() {
+            this.$refs.formA.resetFields();
+            this.formA.sceneType = "1";
+            this.formA.ruleName = "";
+            this.formA.rulesId = "";
             this.scenarioVisible = false;
-            this.scenarioListsVisible = true;
+            this.curNode = {};
         },
+        // 选择真实场景dialog的确定
         scenarioListsConfirm() {
+            // 获取选中的数据
+            this.checkedIdsA = this.$refs.realScene.checkedIdsA;
+            this.checkedIdsB = this.$refs.realScene.checkedIdsB;
+            this.checkedIdsC = this.$refs.realScene.checkedIdsC;
+
+            this.curNode.packageAndRules = this.formA.rulesId;
+            this.curNode.ruleName = this.formA.ruleName;
+
+            this.curNode.sceneNum =
+                this.checkedIdsA.length +
+                this.checkedIdsB.length +
+                this.checkedIdsC.length;
+
+            // 选中数据分别传入对应的ids组
+            this.curNode.sceneTrafficIds = this.checkedIdsA.join(",");
+            this.curNode.sceneNaturalIds = this.checkedIdsB.join(",");
+            this.curNode.sceneStatueIds = this.checkedIdsC.join(",");
+
+            // 遍历当前树 拿到所有节点的平行展开数组
+            this.deepFirstSearch(this.getDataWay.data[0], this.nodeList);
+
+            this.sceneNumUpdate(this.curNode);
+
+            this.scenarioListsCancel();
+        },
+        // 选择真实场景dialog的取消
+        scenarioListsCancel() {
+            this.scenarioCancel();
+
+            // 清空选中行数据
+            this.$refs.realScene.$refs.tableA.$refs.ListTable.clearSelection();
+            this.$refs.realScene.$refs.tableB.$refs.ListTable.clearSelection();
+            this.$refs.realScene.$refs.tableC.$refs.ListTable.clearSelection();
+
+            this.$refs.realScene.checkedIdsA = [];
+            this.$refs.realScene.checkedIdsB = [];
+            this.$refs.realScene.checkedIdsC = [];
+
+            this.$refs.realScene.checkedArrA = [];
+            this.$refs.realScene.checkedArrB = [];
+            this.$refs.realScene.checkedArrC = [];
+
+            this.$refs.realScene.selectedA = false;
+            this.$refs.realScene.selectedB = false;
+            this.$refs.realScene.selectedC = false;
+
             this.scenarioListsVisible = false;
         },
+        // 深度优先遍历
+        /* deepFirstSearch(node, nodeList) {
+            if (node) {
+                nodeList.push(node);
+                var children = node.children;
+                if (children) {
+                    for (var i = 0; i < children.length; i++)
+                        //每次递归的时候将 需要遍历的节点 和 节点所存储的数组传下去
+                        this.deepFirstSearch(children[i], nodeList);
+                }
+            }
+            return nodeList;
+        }, */
+        // 通过深度优先找节点
+        deepFirstSearch(node, nodeList, id) {
+            if (node) {
+                if (id && node.id === id) {
+                    this.curNode = node;
+                }
+                nodeList.push(node);
+                var children = node.children;
+                if (children) {
+                    for (var i = 0; i < children.length; i++)
+                        //每次递归的时候将 需要遍历的节点 和 节点所存储的数组传下去
+                        this.deepFirstSearch(children[i], nodeList, id);
+                }
+            }
+            return nodeList;
+        },
+        save(isAdd) {
+            this.nodeList = [];
+            this.deepFirstSearch(this.getDataWay.data[0], this.nodeList);
+
+            for (let index = 0; index < this.nodeList.length; index++) {
+                const element = this.nodeList[index];
+                if (element.children && element.children.length > 0) {
+                    let total = 0;
+                    let arr = [];
+                    element.children.forEach((item) => {
+                        total += +this.nodeList.find((i) => i.id === item.id)
+                            .weight;
+                        arr.push(item.sublistName);
+                    });
+                    if (total != 100) {
+                        this.$message.error(
+                            `${arr.join(",")}等权重相加应为100`
+                        );
+                        return;
+                    }
+                }
+            }
+
+            if (isAdd || !this.$route.query.packageId) {
+                // 另存为或新增页面
+                this.getDataWay.data[0].packageLevel = 1;
+            } else {
+                this.getDataWay.data[0].packageLevel = 0;
+            }
+
+            this.$axios({
+                method: "post",
+                url: this.$api.sceneLibrary.saveScenePackage,
+                data: {
+                    params: this.getDataWay.data,
+                },
+            }).then((res) => {
+                if (res.code == 200) {
+                    this.$message.success("保存成功");
+                    this.cancel();
+                } else {
+                    this.$message.error(res.message || "保存失败");
+                }
+            });
+        },
+        cancel() {
+            this.$router.replace({
+                path: "/scenarioTestPackageManagementList",
+            });
+        },
+        async getRuleList() {
+            await this.$axios({
+                method: "post",
+                url: this.$api.sceneLibrary.queryCsb,
+                data: {},
+            }).then((res) => {
+                if (res.code == 200 && res.info) {
+                    this.ruleList = res.info;
+                } else {
+                    this.$message.error(res.message || "获取打分规则列表失败");
+                }
+            });
+        },
+        ruleSelChange(val) {
+            this.formA.ruleName = this.ruleList.find(
+                (i) => i.rulesId === val
+            ).ruleName;
+        },
+        // 场景数量更新
+        sceneNumUpdate(curNode) {
+            let node = this.nodeList.find((i) => i.id === curNode.parentId);
+            let sceneNum = 0;
+            node.children.forEach((i) => {
+                sceneNum += i.sceneNum;
+            });
+
+            node.sceneNum = sceneNum;
+            
+            if (node.parentId === "0") {
+                return;
+            }
+            this.sceneNumUpdate(node);
+        },
     },
 
     mounted() {
         if (this.$route.query.packageId) {
-            let packageId = this.$route.query.packageId;
+            this.packageId = this.$route.query.packageId;
+            this.share = this.$route.query.share;
 
-            if (packageId) {
+            if (this.packageId) {
                 this.$axios({
                     method: "post",
                     url: this.$api.sceneLibrary.queryScenePackageSublistList,
                     data: {
-                        packageId,
+                        packageId: this.packageId,
                     },
                 }).then((res) => {
                     if (res.code == 200 && res.info) {
-                        this.getDataWay.data = res.info.list;
+                        this.getDataWay.data = res.info;
                     } else {
                         this.$message.error(res.message || "获取信息失败");
                     }
                 });
             }
         }
+
+        this.getRuleList();
     },
 };
 </script>
@@ -326,5 +659,16 @@ export default {
         font-size: 12px;
         color: @gray;
     }
+
+    .scenarioListsDia {
+        /deep/ .el-dialog__body {
+            padding: 20px 60px;
+        }
+    }
+
+    .btns {
+        padding: 30px 0;
+        text-align: center;
+    }
 }
 </style>