Browse Source

feat:场景评价&&场景上传

linchengzhe 1 năm trước cách đây
mục cha
commit
860aab5273

+ 2 - 0
src/api/sceneLibrary.js

@@ -2,6 +2,7 @@ const basePart = '/simulation/resource/server';
 
 
 const queryScoringRulesList = basePart + '/ScoringRules/queryScoringRulesList'; // 评分规则列表
+const querySceneScoringRulesList = basePart + '/ScoringRules/querySceneEvaluationRuleList'; // 场景评价列表
 const queryScoringRules = basePart + '/ScoringRules/queryScoringRules'; // 查询评分规则详情
 const saveScoringRules = basePart + '/ScoringRules/saveScoringRules'; // 保存评分规则详情
 const fxScoringRules = basePart + '/ScoringRules/fxScoringRules'; // 分享评分规则
@@ -45,6 +46,7 @@ const queryGeneralTemplateByFh = basePart + '/SceneGeneralTemplate/queryGeneralT
 
 export default {
     queryScoringRulesList,
+    querySceneScoringRulesList,
     queryScoringRules,
     saveScoringRules,
     fxScoringRules,

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

@@ -339,7 +339,7 @@
                 dropCol: this.columns,
                 rowHeight: 48,
                 headerHeight: 48,
-                tableData: [],
+                tableData: [{}],
                 setPagination: {}, // 真实的分页对象
                 multipleSelection: [],
                 tempTotalData: {}, //临时模拟数据用

+ 10 - 0
src/router/sceneLibrary.js

@@ -38,6 +38,16 @@ export default [{
         },
         component: () => import("@/views/sceneLibrary/generalizationScenarioList")
     },
+    {
+        path:"/test",
+        name:"test",
+        meta:{
+            tabname: "基准场景库",
+            menuKind: "test",
+            login: true
+        },
+        component: () => import("@/views/sceneLibrary/benchmarkScenarioList")
+    },
     {
         path: "/scenarioTestPackageManagementList",
         name: "scenarioTestPackageManagementList",

+ 0 - 0
src/views/sceneLibrary/benchmarkScenarioList.vue


+ 18 - 0
src/views/sceneLibrary/common.js

@@ -0,0 +1,18 @@
+export  const ruleTypeOpts = [
+  {
+    value: '1',
+    label: '危险度',
+  },
+  {
+    value: '2',
+    label: '覆盖率',
+  },
+  {
+    value: '3',
+    label: '暴露率',
+  },
+  {
+    value: '4',
+    label: '复杂度',
+  },
+]

+ 217 - 190
src/views/sceneLibrary/gradingRuleDetail.vue

@@ -1,28 +1,28 @@
 <template>
-    <div>
-        <el-form ref="form" :model="form" :rules="rules" label-width="108px">
-            <el-form-item label="规则名称:" prop="ruleName">
-                <el-input
-                    placeholder="请输入"
-                    maxlength="50"
-                    v-autoTrim="{ obj: form, key: 'ruleName' }"
-                    v-model="form.ruleName"
-                >
-                </el-input>
-            </el-form-item>
-
-            <el-form-item label="规则描述:" prop="ruleDescription">
-                <el-input
-                    placeholder="请输入"
-                    maxlength="300"
-                    v-autoTrim="{ obj: form, key: 'ruleDescription' }"
-                    v-model="form.ruleDescription"
-                >
-                </el-input>
-            </el-form-item>
-
-            <el-form-item label="规则详情:" prop="ruleDetails">
-                <!-- <el-input
+  <div>
+    <el-form ref="form" :model="form" :rules="rules" label-width="108px">
+      <el-form-item label="规则名称:" prop="ruleName">
+        <el-input
+          placeholder="请输入"
+          maxlength="50"
+          v-autoTrim="{ obj: form, key: 'ruleName' }"
+          v-model="form.ruleName"
+        >
+        </el-input>
+      </el-form-item>
+
+      <el-form-item label="规则描述:" prop="ruleDescription">
+        <el-input
+          placeholder="请输入"
+          maxlength="300"
+          v-autoTrim="{ obj: form, key: 'ruleDescription' }"
+          v-model="form.ruleDescription"
+        >
+        </el-input>
+      </el-form-item>
+
+      <el-form-item label="规则详情:" prop="ruleDetails" v-if="!isScore">
+        <!-- <el-input
                     v-autoTrim="{
                         obj: form,
                         key: 'ruleDetails',
@@ -34,190 +34,217 @@
                     maxlength="10000"
                     show-word-limit
                 ></el-input> -->
-                <editor
-                    :content="content"
-                    ref="editor"
-                    :isEdit="!!$route.query.rulesId"
-                ></editor>
-            </el-form-item>
-
-            <div class="btns">
-                <!-- 公有列表进,另存为+取消 另存为为新增一条数据 新增数据均为私有 1 -->
-                <!-- 私有列表进,保存+另存为+取消 0 -->
-                <!-- 新增进,保存+取消 -1 -->
-                <el-button
-                    type="primary"
-                    v-if="share === '0' || share === '-1'"
-                    @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-form>
-    </div>
+        <editor
+          :content="content"
+          ref="editor"
+          :isEdit="!!$route.query.rulesId"
+        ></editor>
+      </el-form-item>
+      <el-form-item v-else label="规则类型:" prop="ruleType">
+        <el-select
+          v-model="form.ruleType"
+          size="small"
+          clearable
+          placeholder="请选择规则类型"
+        >
+          <el-option
+            v-for="item in ruleTypeOpts"
+            :label="item.label"
+            :value="item.value"
+            :key="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <!-- 文件上传 -->
+      <el-form-item label="文件上传" v-if="isScore">
+      <el-upload
+        class="upload-demo"
+        action=""
+        :file-list="fileList"
+        list-type="text">
+        <el-button size="small" type="primary">点击上传</el-button>
+      </el-upload>
+    </el-form-item>
+
+
+      <div class="btns">
+        <!-- 公有列表进,另存为+取消 另存为为新增一条数据 新增数据均为私有 1 -->
+        <!-- 私有列表进,保存+另存为+取消 0 -->
+        <!-- 新增进,保存+取消 -1 -->
+        <el-button
+          type="primary"
+          v-if="share === '0' || share === '-1'"
+          @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-form>
+  </div>
 </template>
 
 <script>
-import editor from "./components/editor";
+import editor from './components/editor'
+import { ruleTypeOpts } from './common'
 
 export default {
-    name: "gradingRuleDetail", // 评分规则
-    components: { editor },
-    data() {
-        return {
-            share: "-1", //控制显示按钮
-            form: {
-                rulesId: "",
-                ruleName: "",
-                share: "-1",
-                ruleDescription: "",
-                ruleDetails: "",
-            },
-            content: "",
-            rules: {
-                ruleName: [
-                    { required: true, message: "请输入", trigger: "blur" },
-                ],
-                ruleDescription: [
-                    { required: true, message: "请输入", trigger: "blur" },
-                ],
-                ruleDetails: [
-                    { required: true, message: "请输入", trigger: "blur" },
-                ],
-            },
-        };
-    },
-
-    computed: {},
-
-    methods: {
-        save(isAdd) {
-            let ruleDetails = this.$refs.editor.editor.getText().trim();
-            this.form.ruleDetails = ruleDetails;
-
-            // 调用save时,应写成save(),给不给参数均可,不写小括号的话,isAdd会是事件源,则为true
-            this.$refs.form.validate((valid) => {
-                if (valid) {
-                    if (ruleDetails && ruleDetails.length > 1000000) {
-                        this.$message.error("规则详情长度不得超过100万!");
-                        return;
-                    }
-
-                    if (isAdd || !this.$route.query.rulesId) {
-                        // 另存为或新增页面
-                        this.form.rulesId = "";
-                        this.form.share = "0";
-                    }
-
-                    if (this.form.rulesId) {
-                        this.$axios({
-                            method: "post",
-                            url: this.$api.sceneLibrary.queryCsbById,
-                            data: {
-                                rulesId: this.form.rulesId,
-                            },
-                        }).then((res) => {
-                            if (res.code === 200) {
-                                if (res.info === 0) {
-                                    this.saveFn();
-                                    return;
-                                }
-
-                                this.$confirm(
-                                    "该评分规则已经被场景测试包引用,保存后同步更新场景测试包中的评分规则,是否确认保存?",
-                                    "提示",
-                                    {
-                                        confirmButtonText: "确定",
-                                        cancelButtonText: "取消",
-                                        type: "warning",
-                                    }
-                                ).then(() => {
-                                    this.saveFn();
-                                });
-                            } else {
-                                this.$message.error(
-                                    res.message ||
-                                        "获取该评分规则是否被场景测试包引用失败"
-                                );
-                            }
-                        });
-                        return;
-                    }
-
-                    this.saveFn();
-                }
-            });
-        },
-        saveFn() {
+  name: 'gradingRuleDetail', // 评分规则
+  components: { editor },
+  data() {
+    return {
+      share: '-1', //控制显示按钮
+      form: {
+        rulesId: '',
+        ruleName: '',
+        share: '-1',
+        ruleDescription: '',
+        ruleDetails: '',
+        ruleType: '',
+      },
+      fileList:[], // 文件上传列表
+      content: '',
+      rules: {
+        ruleName: [{ required: true, message: '请输入', trigger: 'blur' }],
+        ruleDescription: [
+          { required: true, message: '请输入', trigger: 'blur' },
+        ],
+        ruleDetails: [{ required: true, message: '请输入', trigger: 'blur' }],
+      },
+      isScore: false, // 评分规则新增类型
+      ruleTypeOpts, // 规则类型
+    }
+  },
+
+  computed: {},
+
+  methods: {
+    save(isAdd) {
+      let ruleDetails = this.$refs.editor.editor.getText().trim()
+      this.form.ruleDetails = ruleDetails
+
+      // 调用save时,应写成save(),给不给参数均可,不写小括号的话,isAdd会是事件源,则为true
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          if (ruleDetails && ruleDetails.length > 1000000) {
+            this.$message.error('规则详情长度不得超过100万!')
+            return
+          }
+
+          if (isAdd || !this.$route.query.rulesId) {
+            // 另存为或新增页面
+            this.form.rulesId = ''
+            this.form.share = '0'
+          }
+
+          if (this.form.rulesId) {
             this.$axios({
-                method: "post",
-                url: this.$api.sceneLibrary.saveScoringRules,
-                data: {
-                    ...this.form,
-                },
+              method: 'post',
+              url: this.$api.sceneLibrary.queryCsbById,
+              data: {
+                rulesId: this.form.rulesId,
+              },
             }).then((res) => {
-                if (res.code === 200) {
-                    this.$message.success("保存成功");
-                    this.cancel();
-                } else {
-                    this.$message.error(res.message || "保存失败");
+              if (res.code === 200) {
+                if (res.info === 0) {
+                  this.saveFn()
+                  return
                 }
-            });
-            // .catch((error) => {
-            //     this.$message.error(error || "保存失败!");
-            // });
-        },
-        cancel() {
-            this.$router.replace({ path: "/gradingRulesList" });
-        },
-    },
 
-    mounted() {
-        if (this.$route.query.rulesId) {
-            let rulesId = "";
-            this.form.rulesId = rulesId = this.$route.query.rulesId;
-            this.form.share = this.share = this.$route.query.share;
-
-            if (rulesId) {
-                this.$axios({
-                    method: "post",
-                    url: this.$api.sceneLibrary.queryScoringRules,
-                    data: {
-                        rulesId,
-                    },
-                }).then((res) => {
-                    if (res.code == 200 && res.info) {
-                        this.form = res.info;
-                        this.content = res.info.ruleDetails;
-                    } else {
-                        this.$message.error(res.message || "获取信息失败");
-                    }
-                });
-            }
+                this.$confirm(
+                  '该评分规则已经被场景测试包引用,保存后同步更新场景测试包中的评分规则,是否确认保存?',
+                  '提示',
+                  {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning',
+                  }
+                ).then(() => {
+                  this.saveFn()
+                })
+              } else {
+                this.$message.error(
+                  res.message || '获取该评分规则是否被场景测试包引用失败'
+                )
+              }
+            })
+            return
+          }
+
+          this.saveFn()
+        }
+      })
+    },
+    saveFn() {
+      this.$axios({
+        method: 'post',
+        url: this.$api.sceneLibrary.saveScoringRules,
+        data: {
+          ...this.form,
+        },
+      }).then((res) => {
+        if (res.code === 200) {
+          this.$message.success('保存成功')
+          this.cancel()
+        } else {
+          this.$message.error(res.message || '保存失败')
         }
+      })
+      // .catch((error) => {
+      //     this.$message.error(error || "保存失败!");
+      // });
     },
-};
+    cancel() {
+      this.$router.replace({ path: '/gradingRulesList' })
+    },
+  },
+
+  mounted() {
+    this.isScore = this.$route.query.isScore ? true : false // 判断是否评分规则新增
+    if (this.$route.query.rulesId) {
+      let rulesId = ''
+      this.form.rulesId = rulesId = this.$route.query.rulesId
+      this.form.share = this.share = this.$route.query.share
+
+      if (rulesId) {
+        this.$axios({
+          method: 'post',
+          url: this.$api.sceneLibrary.queryScoringRules,
+          data: {
+            rulesId,
+          },
+        }).then((res) => {
+          if (res.code == 200 && res.info) {
+            this.form = res.info
+            this.content = res.info.ruleDetails
+          } else {
+            this.$message.error(res.message || '获取信息失败')
+          }
+        })
+      }
+    }
+  },
+}
 </script>
 
 <style lang='less' scoped>
 .el-form {
-    width: 60%;
-    padding-top: 60px;
-    margin: 0 auto;
+  width: 60%;
+  padding-top: 60px;
+  margin: 0 auto;
 
-    .el-input {
-        width: 100%;
-    }
+  .el-input {
+    width: 100%;
+  }
 }
 
 .btns {
-    padding-top: 30px;
-    text-align: center;
+  padding-top: 30px;
+  text-align: center;
 }
 </style>

+ 375 - 285
src/views/sceneLibrary/gradingRulesList.vue

@@ -1,308 +1,398 @@
 <template>
-    <div>
-        <div v-show="!$route.path.includes('gradingRuleDetail')">
-            <search-layout :needBox="true">
-                <!-- <template slot="searchItem1">
-                            <span class="label">规则ID</span>
-                            <el-input
-                                v-model="searchParams.rulesCode"
-                                size="small"
-                                clearable
-                                placeholder="请输入"
-                                maxlength="60"
-                                @keyup.enter.native="doSearch"
-                            >
-                            </el-input>
-                        </template> -->
-                <template slot="searchItem1">
-                    <span class="label">规则名称</span>
-                    <el-input v-model="searchParams.ruleName" size="small" clearable placeholder="请输入" maxlength="50"
-                        @keyup.enter.native="doSearch(false)">
-                    </el-input>
-                </template>
-                <template slot="searchItem2">
-                    <span class="label">规则描述</span>
-                    <el-input v-model="searchParams.ruleDescription" size="small" clearable placeholder="请输入"
-                        maxlength="300" @keyup.enter.native="doSearch(false)">
-                    </el-input>
-                </template>
-                <template slot="searchItem3">
-                    <span class="label">创建时间</span>
-                    <!-- <el-date-picker
-                        v-model="searchDate"
-                        type="daterange"
-                        format="yyyy-MM-dd"
-                        value-format="yyyy-MM-dd"
-                        range-separator="至"
-                        start-placeholder="开始日期"
-                        end-placeholder="结束日期"
-                    >
-                    </el-date-picker> -->
-                    <el-date-picker v-model="searchParams.yearMin" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
-                        placeholder="开始日期" class="dateRangeInput">
-                    </el-date-picker>
-                    <span class="dateSeparator">至</span>
-                    <el-date-picker v-model="searchParams.yearMax" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
-                        placeholder="结束日期" class="dateRangeInput">
-                    </el-date-picker>
-                </template>
-                <template slot="searchBtn1">
-                    <el-button type="primary" @click="doSearch(false)">查询</el-button>
-                </template>
-                <template slot="searchBtn2">
-                    <el-button type="primary" @click="doReset">重置</el-button>
-                </template>
-            </search-layout>
+  <div>
+    <div v-show="!$route.path.includes('gradingRuleDetail')">
+      <search-layout :needBox="true">
+        <!-- <template slot="searchItem1">
+                              <span class="label">规则ID</span>
+                              <el-input
+                                  v-model="searchParams.rulesCode"
+                                  size="small"
+                                  clearable
+                                  placeholder="请输入"
+                                  maxlength="60"
+                                  @keyup.enter.native="doSearch"
+                              >
+                              </el-input>
+                          </template> -->
+        <template slot="searchItem1">
+          <span class="label">规则名称</span>
+          <el-input
+            v-model="searchParams.ruleName"
+            size="small"
+            clearable
+            placeholder="请输入"
+            maxlength="50"
+            @keyup.enter.native="doSearch(false)"
+          >
+          </el-input>
+        </template>
+        <template slot="searchItem2">
+          <span class="label">规则描述</span>
+          <el-input
+            v-model="searchParams.ruleDescription"
+            size="small"
+            clearable
+            placeholder="请输入"
+            maxlength="300"
+            @keyup.enter.native="doSearch(false)"
+          >
+          </el-input>
+        </template>
+        <template slot="searchItem3" v-if="activeName !== '3'">
+          <span class="label">创建时间</span>
+          <!-- <el-date-picker
+                          v-model="searchDate"
+                          type="daterange"
+                          format="yyyy-MM-dd"
+                          value-format="yyyy-MM-dd"
+                          range-separator="至"
+                          start-placeholder="开始日期"
+                          end-placeholder="结束日期"
+                      >
+                      </el-date-picker> -->
+          <el-date-picker
+            v-model="searchParams.yearMin"
+            type="date"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            placeholder="开始日期"
+            class="dateRangeInput"
+          >
+          </el-date-picker>
+          <span class="dateSeparator">至</span>
+          <el-date-picker
+            v-model="searchParams.yearMax"
+            type="date"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            placeholder="结束日期"
+            class="dateRangeInput"
+          >
+          </el-date-picker>
+        </template>
+        <template slot="searchItem4" v-else>
+          <span class="label">规则类型</span>
+          <el-select
+            v-model="searchParams.ruleType"
+            size="small"
+            clearable
+            placeholder="请选择规则类型"
+          >
+            <el-option
+              v-for="item in ruleTypeOpts"
+              :label="item.label"
+              :value="item.value"
+              :key="item.value"
+            ></el-option>
+          </el-select>
+        </template>
+        <template slot="searchBtn1">
+          <el-button type="primary" @click="doSearch(false)">查询</el-button>
+        </template>
+        <template slot="searchBtn2">
+          <el-button type="primary" @click="doReset">重置</el-button>
+        </template>
+      </search-layout>
 
-            <div class="myTabsBox">
-                <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-tabs>
-                <el-button v-show="activeName === '2'" class="addBtn" icon="el-icon-circle-plus-outline" @click="addOne"
-                    type="primary">新增</el-button>
-            </div>
+      <div class="myTabsBox">
+        <el-tabs
+          style="width: 350px"
+          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>
+        <el-button
+          v-show="['2', '3'].includes(activeName)"
+          class="addBtn"
+          icon="el-icon-circle-plus-outline"
+          @click="addOne"
+          type="primary"
+          >新增</el-button
+        >
+      </div>
 
-            <tableList ref="table" style="margin: 0 30px" :columns="columns" :getDataWay="getDataWay"
-                :pagination="pagination" index>
-                <el-table-column label="规则描述" slot="ruleDescription" align="center">
-                    <template v-slot="scope">
-                        <span>{{ scope.row.ruleDescription }}</span>
-                    </template>
-                </el-table-column>
-                <el-table-column label="操作" slot="cgInfos" align="center" width="180">
-                    <template v-slot="scope">
-                        <i v-if="
-                            (roleCode === '0' || roleCode === '1') &&
-                            activeName === '2'
-                        " @click="shareRow(scope.row)" class="el-icon-share elIcon" title="分享"></i>
-                        <i @click="editRow(scope.row)" class="el-icon-edit-outline elIcon" title="编辑"></i>
-                        <i v-if="((roleCode === '0' || roleCode === '1') && activeName === '1') || activeName === '2'"
-                            @click="delRow(scope.row)" class="el-icon-delete elIcon" title="删除"></i>
-                    </template>
-                </el-table-column>
-            </tableList>
-        </div>
-
-        <router-view v-show="$route.path.includes('gradingRuleDetail')"></router-view>
+      <tableList
+        ref="table"
+        style="margin: 0 30px"
+        :columns="columns"
+        :getDataWay="getDataWay"
+        :pagination="pagination"
+        index
+      >
+        <el-table-column label="规则描述" slot="ruleDescription" align="center">
+          <template v-slot="scope">
+            <span>{{ scope.row.ruleDescription }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" slot="cgInfos" align="center" width="180">
+          <template v-slot="scope">
+            <i
+              v-if="
+                (roleCode === '0' || roleCode === '1') && activeName === '2'
+              "
+              @click="shareRow(scope.row)"
+              class="el-icon-share elIcon"
+              title="分享"
+            ></i>
+            <i
+              @click="editRow(scope.row)"
+              class="el-icon-edit-outline elIcon"
+              title="编辑"
+            ></i>
+            <i
+              v-if="
+                ((roleCode === '0' || roleCode === '1') &&
+                  activeName === '1') ||
+                activeName === '2'
+              "
+              @click="delRow(scope.row)"
+              class="el-icon-delete elIcon"
+              title="删除"
+            ></i>
+          </template>
+        </el-table-column>
+      </tableList>
     </div>
-</template>
 
-<script>
-import searchLayout from "@/components/grid/searchLayout";
-import tableList from "@/components/grid/TableList";
-import toolbarTab from "@/components/toolbar/toolbarTab";
-import { mapState } from "vuex";
+    <router-view
+      v-show="$route.path.includes('gradingRuleDetail')"
+    ></router-view>
+  </div>
+</template>
+  
+  <script>
+import searchLayout from '@/components/grid/searchLayout'
+import tableList from '@/components/grid/TableList'
+import toolbarTab from '@/components/toolbar/toolbarTab'
+import {ruleTypeOpts} from './common'
+import { mapState } from 'vuex'
 
 export default {
-    name: "gradingRulesList", // 评分规则列表
-    components: { searchLayout, tableList, toolbarTab },
-    data() {
-        return {
-            activeName: "2",
-            searchParams: {
-                //搜索参数
-                // rulesCode: "", //规则Id
-                ruleName: "", //规则名称
-                ruleDescription: "", //规则描述
-                yearMin: "", // 开始时间
-                yearMax: "", // 结束时间
-            },
-            searchDate: "", // 创建时间
-            columns: [
-                //表格列
-                {
-                    label: "规则名称",
-                    prop: "ruleName",
-                },
-                {
-                    label: "规则描述",
-                    prop: "ruleDescription",
-                    showOverflowTooltip: true,
-                    template: true,
-                },
-                {
-                    label: "创建时间",
-                    prop: "createTime",
-                    formatter(row) {
-                        return row.createTime.slice(0, 10);
-                    },
-                },
-                {
-                    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.queryScoringRulesList,
-                param: {
-                    packageId: "11111111",
-                    share: "0",
-                },
-            },
-            dialogVisible: false,
-        };
-    },
+  name: 'gradingRulesList', // 评分规则列表
+  components: { searchLayout, tableList, toolbarTab },
+  data() {
+    return {
+      activeName: '2',
+      searchParams: {
+        //搜索参数
+        // rulesCode: "", //规则Id
+        ruleName: '', //规则名称
+        ruleDescription: '', //规则描述
+        yearMin: '', // 开始时间
+        yearMax: '', // 结束时间
+        ruleType: '',
+      },
+      ruleTypeOpts, // 规则类型
+      searchDate: '', // 创建时间
+      columns: [
+        //表格列
+        {
+          label: '规则名称',
+          prop: 'ruleName',
+        },
+        {
+          label: '规则描述',
+          prop: 'ruleDescription',
+          showOverflowTooltip: true,
+          template: true,
+        },
+        {
+          label: '创建时间',
+          prop: 'createTime',
+          formatter(row) {
+            return row.createTime.slice(0, 10)
+          },
+        },
+        {
+          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.queryScoringRulesList,
+        param: {
+          packageId: '11111111',
+          share: '0',
+        },
+      },
+      dialogVisible: false,
+    }
+  },
 
-    computed: { ...mapState(["roleCode"]) },
+  computed: { ...mapState(['roleCode']) },
 
-    watch: {
-        $route(to, from) {
-            if (to.name === "gradingRulesList") {
-                this.$nextTick(() => {
-                    this.doSearch(true);
-                });
-            }
-        },
+  watch: {
+    $route(to, from) {
+      if (to.name === 'gradingRulesList') {
+        this.$nextTick(() => {
+          this.doSearch(true)
+        })
+      }
     },
+  },
 
-    methods: {
-        pageControl(data) {
-            this.activeName = data.name;
-            this.doSearch(false);
-        },
-        // isBack为解决从详情回退时列表在当前页刷新
-        doSearch(isBack = false) {
-            // if (this.searchDate) {
-            //     this.searchParams.yearMin = `${this.searchDate[0]} 00:00:00`;
-            //     this.searchParams.yearMax = `${this.searchDate[1]} 23:59:59`;
-            // } else {
-            //     this.searchParams.yearMin = "";
-            //     this.searchParams.yearMax = "";
-            // }
+  methods: {
+    pageControl(data) {
+      // 场景评价 切换接口地址
+      if(data.name=='3'){
+        this.getDataWay.data = this.$api.sceneLibrary.querySceneScoringRulesList
+      }else{
+        // 公有 私有
+        this.getDataWay.data = this.$api.sceneLibrary.queryScoringRulesList
+      }
+      this.activeName = data.name
+      this.doSearch(false)
+    },
+    // isBack为解决从详情回退时列表在当前页刷新
+    doSearch(isBack = false) {
+      // if (this.searchDate) {
+      //     this.searchParams.yearMin = `${this.searchDate[0]} 00:00:00`;
+      //     this.searchParams.yearMax = `${this.searchDate[1]} 23:59:59`;
+      // } else {
+      //     this.searchParams.yearMin = "";
+      //     this.searchParams.yearMax = "";
+      // }
 
-            let yearMin = "";
-            if (this.searchParams.yearMin) {
-                yearMin = `${this.searchParams.yearMin} 00:00:00`;
-            }
+      let yearMin = ''
+      if (this.searchParams.yearMin) {
+        yearMin = `${this.searchParams.yearMin} 00:00:00`
+      }
 
-            let yearMax = "";
-            if (this.searchParams.yearMax) {
-                yearMax = `${this.searchParams.yearMax} 23:59:59`;
-            }
+      let yearMax = ''
+      if (this.searchParams.yearMax) {
+        yearMax = `${this.searchParams.yearMax} 23:59:59`
+      }
 
-            if (yearMin && yearMax && yearMin > yearMax) {
-                this.$message.error("结束时间不能早于开始时间");
-                return;
-            }
+      if (yearMin && yearMax && yearMin > yearMax) {
+        this.$message.error('结束时间不能早于开始时间')
+        return
+      }
 
-            let pageMap = {
-                // rulesCode: this.searchParams.rulesCode,
-                ruleName: this.searchParams.ruleName,
-                ruleDescription: this.searchParams.ruleDescription,
-                yearMin,
-                yearMax,
-                share: this.activeName === "1" ? "1" : "0",
-                resetPageNum: !isBack ? false : (this.pagination.currentPage || 1),
-            };
+      let pageMap = {
+        // rulesCode: this.searchParams.rulesCode,
+        ruleName: this.searchParams.ruleName,
+        ruleDescription: this.searchParams.ruleDescription,
+        ruleType: this.searchParams.ruleType, // 规则类型
+        yearMin,
+        yearMax,
+        share: this.activeName === '1' ? '1' : '0',
+        resetPageNum: !isBack ? false : this.pagination.currentPage || 1,
+      }
 
-            if (!isBack) this.pagination.currentPage = 1;
+      if (!isBack) this.pagination.currentPage = 1
 
-            this.refreshList(pageMap);
-        },
-        //刷新table
-        refreshList(param) {
-            param
-                ? this.$refs["table"].loadData(param)
-                : this.$refs["table"].loadData();
-        },
-        doReset() {
-            this.searchParams = {
-                // rulesCode: "",
-                ruleName: "",
-                ruleDescription: "",
-                yearMin: "",
-                yearMax: "",
-            };
-            // this.searchDate = "";
-            this.doSearch();
-        },
-        viewRow(row) {
-            this.dialogVisible = true;
-        },
-        addOne() {
-            this.$store.commit("getTabname", "gradingRuleDetailTabName", "");
-            localStorage.setItem("gradingRuleDetailTabName", "");
+      this.refreshList(pageMap)
+    },
+    //刷新table
+    refreshList(param) {
+      param
+        ? this.$refs['table'].loadData(param)
+        : this.$refs['table'].loadData()
+    },
+    doReset() {
+      this.searchParams = {
+        // rulesCode: "",
+        ruleName: '',
+        ruleDescription: '',
+        yearMin: '',
+        yearMax: '',
+      }
+      // this.searchDate = "";
+      this.doSearch()
+    },
+    viewRow(row) {
+      this.dialogVisible = true
+    },
+    addOne() {
+      this.$store.commit('getTabname', 'gradingRuleDetailTabName', '')
+      localStorage.setItem('gradingRuleDetailTabName', '')
 
-            this.$router.push({ path: "/gradingRuleDetail" });
-        },
-        shareRow(row) {
-            this.$confirm("确认是否分享?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            }).then(() => {
-                this.$axios({
-                    method: "post",
-                    url: this.$api.sceneLibrary.fxScoringRules,
-                    data: {
-                        rulesId: row.rulesId,
-                    },
-                }).then((res) => {
-                    if (res.code == 200) {
-                        this.$message.success("分享成功");
-                    } else {
-                        this.$message.error(res.message || "分享失败");
-                    }
-                    this.doSearch();
-                });
-            });
-        },
-        delRow(row) {
-            this.$confirm("确认是否删除?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            }).then(() => {
-                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();
-                });
-            });
-        },
-        editRow(row) {
-            this.$store.commit("getTabname", "gradingRuleDetailTabName", row.ruleName);
-            localStorage.setItem("gradingRuleDetailTabName", row.ruleName);
+      this.$router.push({
+        path: '/gradingRuleDetail',
+        query: this.activeName == '3' ? { isScore: true } : {}, // 评分规则新增路由跳转标识
+      })
+    },
+    shareRow(row) {
+      this.$confirm('确认是否分享?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(() => {
+        this.$axios({
+          method: 'post',
+          url: this.$api.sceneLibrary.fxScoringRules,
+          data: {
+            rulesId: row.rulesId,
+          },
+        }).then((res) => {
+          if (res.code == 200) {
+            this.$message.success('分享成功')
+          } else {
+            this.$message.error(res.message || '分享失败')
+          }
+          this.doSearch()
+        })
+      })
+    },
+    delRow(row) {
+      this.$confirm('确认是否删除?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(() => {
+        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()
+        })
+      })
+    },
+    editRow(row) {
+      this.$store.commit('getTabname', 'gradingRuleDetailTabName', row.ruleName)
+      localStorage.setItem('gradingRuleDetailTabName', row.ruleName)
 
-            this.$router.push({
-                path: "/gradingRuleDetail",
-                // params: {
-                //     rulesId: row.rulesId,
-                //     share: row.share,
-                // },
-                query: {
-                    rulesId: row.rulesId,
-                    share: row.share,
-                },
-            });
+      this.$router.push({
+        path: '/gradingRuleDetail',
+        // params: {
+        //     rulesId: row.rulesId,
+        //     share: row.share,
+        // },
+        query: {
+          rulesId: row.rulesId,
+          share: row.share,
         },
+      })
     },
+  },
 
-    // mounted() {}
-};
+  // mounted() {}
+}
 </script>
-
-<style lang='less' scoped></style>
+  
+  <style lang='less' scoped></style>

+ 487 - 464
src/views/systemManagement/sceneUploadList.vue

@@ -1,21 +1,21 @@
 <template>
-    <div>
-        <search-layout :needBox="true">
-            <template slot="searchItem1">
-                <span class="label">任务名称</span>
-                <el-input
-                    v-model="searchParams.name"
-                    size="small"
-                    clearable
-                    placeholder="请输入"
-                    maxlength="60"
-                    @keyup.enter.native="doSearch(false)"
-                >
-                </el-input>
-            </template>
-            <template slot="searchItem2">
-                <span class="label">上传时间</span>
-                <!-- <el-date-picker
+  <div>
+    <search-layout :needBox="true">
+      <template slot="searchItem1">
+        <span class="label">任务名称</span>
+        <el-input
+          v-model="searchParams.name"
+          size="small"
+          clearable
+          placeholder="请输入"
+          maxlength="60"
+          @keyup.enter.native="doSearch(false)"
+        >
+        </el-input>
+      </template>
+      <template slot="searchItem2">
+        <span class="label">上传时间</span>
+        <!-- <el-date-picker
                     v-model="uploadDate"
                     type="daterange"
                     format="yyyy-MM-dd"
@@ -25,496 +25,519 @@
                     end-placeholder="结束日期"
                 >
                 </el-date-picker> -->
-                <el-date-picker
-                    v-model="searchParams.timeBegin"
-                    type="date"
-                    format="yyyy-MM-dd"
-                    value-format="yyyy-MM-dd"
-                    placeholder="开始日期"
-                    class="dateRangeInput"
-                >
-                </el-date-picker>
-                <span class="dateSeparator">至</span>
-                <el-date-picker
-                    v-model="searchParams.timeEnd"
-                    type="date"
-                    format="yyyy-MM-dd"
-                    value-format="yyyy-MM-dd"
-                    placeholder="结束日期"
-                    class="dateRangeInput"
-                >
-                </el-date-picker>
-            </template>
-
-            <template slot="searchBtn1">
-                <el-button type="primary" @click="doSearch(false)">查询</el-button>
-            </template>
-            <template slot="searchBtn2">
-                <el-button type="primary" @click="doReset">重置</el-button>
-            </template>
-        </search-layout>
-
-        <div class="btnsPanel">
-            <el-button
-                type="primary"
-                icon="el-icon-circle-plus-outline"
-                @click="addOne"
-                >新增</el-button
-            >
-        </div>
-
-        <tableList
-            ref="table"
-            style="margin: 0 30px"
-            :columns="columns"
-            :getDataWay="getDataWay"
-            :pagination="pagination"
-            index
+        <el-date-picker
+          v-model="searchParams.timeBegin"
+          type="date"
+          format="yyyy-MM-dd"
+          value-format="yyyy-MM-dd"
+          placeholder="开始日期"
+          class="dateRangeInput"
         >
-            <el-table-column label="操作" slot="cgInfos" align="center">
-                <template v-slot="scope">
-                    <!-- <span
+        </el-date-picker>
+        <span class="dateSeparator">至</span>
+        <el-date-picker
+          v-model="searchParams.timeEnd"
+          type="date"
+          format="yyyy-MM-dd"
+          value-format="yyyy-MM-dd"
+          placeholder="结束日期"
+          class="dateRangeInput"
+        >
+        </el-date-picker>
+      </template>
+
+      <template slot="searchBtn1">
+        <el-button type="primary" @click="doSearch(false)">查询</el-button>
+      </template>
+      <template slot="searchBtn2">
+        <el-button type="primary" @click="doReset">重置</el-button>
+      </template>
+    </search-layout>
+
+    <div class="btnsPanel">
+      <el-button
+        type="primary"
+        icon="el-icon-circle-plus-outline"
+        @click="addOne"
+        >新增</el-button
+      >
+    </div>
+
+    <tableList
+      ref="table"
+      style="margin: 0 30px"
+      :columns="columns"
+      :getDataWay="getDataWay"
+      :pagination="pagination"
+      index
+    >
+      <el-table-column label="操作" slot="cgInfos" align="center">
+        <template v-slot="scope">
+          <!-- <span
                         v-if="scope.row.errorMessage"
                         @click="viewRow(scope.row.errorMessage)"
                         class="errRecord tdBtn"
                         >错误记录</span
                     > -->
-                    <i
-                        v-if="scope.row.errorMessage"
-                        @click="viewRow(scope.row.errorMessage)"
-                        class="el-icon-document elIcon tdBtn"
-                        title="错误记录"
-                    ></i>
-                    <i
-                        @click="delRow(scope.row.id)"
-                        class="el-icon-delete elIcon tdBtn"
-                        title="删除"
-                    ></i>
-                </template>
-            </el-table-column>
-        </tableList>
-
-        <el-dialog
-            title="场景上传"
-            :visible.sync="dialogVisible"
-            width="690px"
-            :close-on-click-modal="false"
-            :close-on-press-escape="false"
-            :before-close="uploadCancel"
+          <i
+            v-if="scope.row.errorMessage"
+            @click="viewRow(scope.row.errorMessage)"
+            class="el-icon-document elIcon tdBtn"
+            title="错误记录"
+          ></i>
+          <i
+            @click="delRow(scope.row.id)"
+            class="el-icon-delete elIcon tdBtn"
+            title="删除"
+          ></i>
+        </template>
+      </el-table-column>
+    </tableList>
+
+    <el-dialog
+      title="场景上传"
+      :visible.sync="dialogVisible"
+      width="690px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :before-close="uploadCancel"
+    >
+      <el-form ref="form" :model="form" :rules="rules" label-width="128px">
+        <el-form-item label="任务名称:" prop="name">
+          <el-input
+            placeholder="请输入"
+            maxlength="60"
+            v-autoTrim="{ obj: form, key: 'name' }"
+            v-model="form.name"
+          >
+          </el-input>
+        </el-form-item>
+
+        <el-form-item label="场景分类:" prop="sceneType">
+          <el-select v-model="form.sceneType" @change="sceneTypeChange">
+            <el-option
+              v-for="item in sceneTypeList"
+              :label="item.caption"
+              :value="item.code"
+              :key="item.code"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+
+        <!-- 三个真实场景时展示 -->
+        <el-form-item
+          v-if="form.sceneType != '4'"
+          label="场景路径:"
+          prop="dataDirectory"
+        >
+          <el-input
+            placeholder="请输入"
+            maxlength="300"
+            v-autoTrim="{ obj: form, key: 'dataDirectory' }"
+            v-model="form.dataDirectory"
+          >
+          </el-input>
+        </el-form-item>
+        <el-form-item
+          v-if="form.sceneType != '4'"
+          label="复杂度评价脚本:"
+          prop="script"
         >
-            <el-form
-                ref="form"
-                :model="form"
-                :rules="rules"
-                label-width="108px"
+          <el-select placeholder="请选择" v-model="form.script">
+            <el-option
+              v-for="item in scriptOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
             >
-                <el-form-item label="任务名称:" prop="name">
-                    <el-input
-                        placeholder="请输入"
-                        maxlength="60"
-                        v-autoTrim="{ obj: form, key: 'name' }"
-                        v-model="form.name"
-                    >
-                    </el-input>
-                </el-form-item>
-
-                <el-form-item label="场景分类:" prop="sceneType">
-                    <el-select
-                        v-model="form.sceneType"
-                        @change="sceneTypeChange"
-                    >
-                        <el-option
-                            v-for="item in sceneTypeList"
-                            :label="item.caption"
-                            :value="item.code"
-                            :key="item.code"
-                        ></el-option>
-                    </el-select>
-                </el-form-item>
-
-                <!-- 三个真实场景时展示 -->
-                <el-form-item
-                    v-if="form.sceneType != '4'"
-                    label="场景路径:"
-                    prop="dataDirectory"
-                >
-                    <el-input
-                        placeholder="请输入"
-                        maxlength="300"
-                        v-autoTrim="{ obj: form, key: 'dataDirectory' }"
-                        v-model="form.dataDirectory"
-                    >
-                    </el-input>
-                </el-form-item>
-
-                <!-- 泛化时展示 -->
-                <el-form-item
-                    v-if="form.sceneType === '4'"
-                    label="文件上传:"
-                    prop="fileName"
-                >
-                    <el-input
-                        placeholder="请输入"
-                        maxlength="600"
-                        v-autoTrim="{ obj: form, key: 'fileName' }"
-                        v-model="form.fileName"
-                        disabled
-                    >
-                    </el-input>
-                    <upload
-                        ref="upload"
-                        class="upload"
-                        @handleChange="handleChange"
-                    ></upload>
-                </el-form-item>
-            </el-form>
-            <span slot="footer">
-                <el-button type="primary" @click="uploadConfirm"
-                    >确 定</el-button
-                >
-                <el-button @click="uploadCancel">取 消</el-button>
-            </span>
-        </el-dialog>
-
-        <el-dialog
-            title="错误记录"
-            :visible.sync="errRocordVisible"
-            width="690px"
-            :close-on-click-modal="false"
-            :close-on-press-escape="false"
-            :before-close="errClose"
+            </el-option>
+          </el-select>
+        </el-form-item>
+
+        <!-- 泛化时展示 -->
+        <el-form-item
+          v-if="form.sceneType === '4'"
+          label="文件上传:"
+          prop="fileName"
         >
-            <div>{{ errorMessage }}</div>
-            <span slot="footer">
-                <el-button type="primary" @click="errClose">关 闭</el-button>
-            </span>
-        </el-dialog>
-    </div>
+          <el-input
+            placeholder="请输入"
+            maxlength="600"
+            v-autoTrim="{ obj: form, key: 'fileName' }"
+            v-model="form.fileName"
+            disabled
+          >
+          </el-input>
+          <upload
+            ref="upload"
+            class="upload"
+            @handleChange="handleChange"
+          ></upload>
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button type="primary" @click="uploadConfirm">确 定</el-button>
+        <el-button @click="uploadCancel">取 消</el-button>
+      </span>
+    </el-dialog>
+
+    <el-dialog
+      title="错误记录"
+      :visible.sync="errRocordVisible"
+      width="690px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :before-close="errClose"
+    >
+      <div>{{ errorMessage }}</div>
+      <span slot="footer">
+        <el-button type="primary" @click="errClose">关 闭</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import searchLayout from "@/components/grid/searchLayout";
-import tableList from "@/components/grid/TableList";
-import upload from "./components/upload";
+import searchLayout from '@/components/grid/searchLayout'
+import tableList from '@/components/grid/TableList'
+import upload from './components/upload'
 
 export default {
-    name: "sceneUploadList", // 场景上传
-    components: { searchLayout, tableList, upload },
-
-    data() {
-        let formatSeconds = function formatSeconds(value) {
-            var theTime = parseInt(value); // 秒
-            var theTime1 = 0; // 分
-            var theTime2 = 0; // 小时
-            if (theTime > 60) {
-                theTime1 = parseInt(theTime / 60);
-                theTime = parseInt(theTime % 60);
-                if (theTime1 > 60) {
-                    theTime2 = parseInt(theTime1 / 60);
-                    theTime1 = parseInt(theTime1 % 60);
-                }
-            }
-            var result = "" + parseInt(theTime) + "秒";
-            if (theTime1 > 0) {
-                result = "" + parseInt(theTime1) + "分" + result;
-            }
-            if (theTime2 > 0) {
-                result = "" + parseInt(theTime2) + "小时" + result;
-            }
-            return result;
-        };
-
-        return {
-            searchParams: {
-                //搜索参数
-                name: "", // 任务名称
-                timeBegin: "", // 上传时间起
-                timeEnd: "", // 上传时间止
-            },
-            uploadDate: "",
-            columns: [
-                {
-                    label: "任务名称",
-                    prop: "name",
-                },
-                {
-                    label: "场景分类",
-                    prop: "sceneType",
-                },
-                {
-                    label: "上传时间",
-                    prop: "createTime",
-                },
-                {
-                    label: "上传状态",
-                    prop: "status",
-                },
-                {
-                    label: "总用时长",
-                    prop: "totalTime",
-                    formatter: (row) => {
-                        if (row.totalTime)
-                            if (row.totalTime && !isNaN(row.totalTime)) {
-                                return formatSeconds(row.totalTime);
-                            }
-                    },
-                },
-                {
-                    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.systemManagement.getSceneImporPagetList,
-                param: {},
-            },
-            form: {
-                name: "", // 任务名称
-                sceneType: "", // 场景分类
-                dataDirectory: "", // 场景路径
-                fileName: "", // 文件名称
-            },
-            rules: {
-                name: [{ required: true, message: "请输入", trigger: "blur" }],
-                sceneType: [
-                    { required: true, message: "请选择", trigger: "change" },
-                ],
-                dataDirectory: [
-                    { required: true, message: "请输入", trigger: "blur" },
-                ],
-                fileName: [
-                    { required: true, message: "请上传", trigger: "change" },
-                ],
-            },
-            sceneTypeList: [],
-            dialogVisible: false,
-            file: null,
-            errRocordVisible: false,
-            errorMessage: "",
-            timer: null,
-        };
-    },
+  name: 'sceneUploadList', // 场景上传
+  components: { searchLayout, tableList, upload },
+
+  data() {
+    let formatSeconds = function formatSeconds(value) {
+      var theTime = parseInt(value) // 秒
+      var theTime1 = 0 // 分
+      var theTime2 = 0 // 小时
+      if (theTime > 60) {
+        theTime1 = parseInt(theTime / 60)
+        theTime = parseInt(theTime % 60)
+        if (theTime1 > 60) {
+          theTime2 = parseInt(theTime1 / 60)
+          theTime1 = parseInt(theTime1 % 60)
+        }
+      }
+      var result = '' + parseInt(theTime) + '秒'
+      if (theTime1 > 0) {
+        result = '' + parseInt(theTime1) + '分' + result
+      }
+      if (theTime2 > 0) {
+        result = '' + parseInt(theTime2) + '小时' + result
+      }
+      return result
+    }
 
-    methods: {
-        doSearch(isTimer = false) {
-            // if (this.uploadDate) {
-            //     this.searchParams.timeBegin = `${this.uploadDate[0]}`;
-            //     this.searchParams.timeEnd = `${this.uploadDate[1]}`;
-            // } else {
-            //     this.searchParams.timeBegin = "";
-            //     this.searchParams.timeEnd = "";
-            // }
-
-            let timeBegin = "";
-            if (this.searchParams.timeBegin) {
-                timeBegin = `${this.searchParams.timeBegin} 00:00:00`;
-            }
-
-            let timeEnd = "";
-            if (this.searchParams.timeEnd) {
-                timeEnd = `${this.searchParams.timeEnd} 23:59:59`;
-            }
-
-            if (timeBegin && timeEnd && timeBegin > timeEnd) {
-                this.$message.error("结束时间不能早于开始时间");
-                return;
-            }
-
-            let pageMap = {
-                name: this.searchParams.name,
-                timeBegin,
-                timeEnd,
-                resetPageNum: !isTimer ? false : (this.pagination.currentPage || 1),
-            };
-
-            if(!isTimer) this.pagination.currentPage = 1;
-
-            this.refreshList(pageMap);
-
-            if (this.timer) clearInterval(this.timer);
-
-            this.timer = setInterval(() => {
-                if (this.$refs["table"]) this.doSearch(true);
-            }, 1000 * 60);
+    return {
+      searchParams: {
+        //搜索参数
+        name: '', // 任务名称
+        timeBegin: '', // 上传时间起
+        timeEnd: '', // 上传时间止
+      },
+      uploadDate: '',
+      columns: [
+        {
+          label: '任务名称',
+          prop: 'name',
         },
-        //刷新table
-        refreshList(param) {
-            param
-                ? this.$refs["table"].loadData(param)
-                : this.$refs["table"].loadData();
+        {
+          label: '场景分类',
+          prop: 'sceneType',
         },
-        doReset() {
-            this.searchParams = {
-                name: "",
-                timeBegin: "",
-                timeEnd: "",
-            };
-            // this.uploadDate = "";
-            this.doSearch(false);
+        {
+          label: '上传时间',
+          prop: 'createTime',
         },
-        addOne() {
-            this.form = {
-                name: "",
-                sceneType: "",
-                dataDirectory: "",
-                fileName: "",
-            };
-            this.file = null;
-
-            this.dialogVisible = true;
-
-            this.$nextTick(() => {
-                this.$refs.form.clearValidate();
-            });
+        {
+          label: '上传状态',
+          prop: 'status',
         },
-        viewRow(errorMessage) {
-            this.errorMessage = errorMessage;
-            this.errRocordVisible = true;
+        {
+          label: '总用时长',
+          prop: 'totalTime',
+          formatter: (row) => {
+            if (row.totalTime)
+              if (row.totalTime && !isNaN(row.totalTime)) {
+                return formatSeconds(row.totalTime)
+              }
+          },
         },
-        delRow(id) {
-            this.$confirm("确认是否删除?(温馨提示:文件较大,删除时间较长请您耐心等待)", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            }).then(() => {
-                this.$axios({
-                    method: "post",
-                    url: this.$api.systemManagement.deleteTask,
-                    timeout: 1000 * 60 * 30,
-                    data: {
-                        id,
-                    },
-                }).then((res) => {
-                    if (res.code == 200) {
-                        this.$message.success("删除成功");
-                    } else {
-                        this.$message.error(res.message || "删除失败");
-                    }
-                    this.doSearch();
-                });
-            });
+        {
+          label: '操作',
+          prop: 'cgInfos',
+          template: true,
         },
-        errClose() {
-            this.errRocordVisible = false;
-            this.errorMessage = "";
+      ],
+      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.systemManagement.getSceneImporPagetList,
+        param: {},
+      },
+      form: {
+        name: '', // 任务名称
+        sceneType: '', // 场景分类
+        dataDirectory: '', // 场景路径
+        fileName: '', // 文件名称
+        script: '', // 复杂度评价脚本
+      },
+      rules: {
+        name: [{ required: true, message: '请输入', trigger: 'blur' }],
+        sceneType: [{ required: true, message: '请选择', trigger: 'change' }],
+        dataDirectory: [{ required: true, message: '请输入', trigger: 'blur' }],
+        fileName: [{ required: true, message: '请上传', trigger: 'change' }],
+      },
+      sceneTypeList: [],
+      dialogVisible: false,
+      file: null,
+      errRocordVisible: false,
+      errorMessage: '',
+      timer: null,
+      //   测试mock数据
+      scriptOptions: [
+        {
+          label: '暂不评价',
+          value: 0,
         },
-        uploadConfirm() {
-            this.$refs.form.validate(async (valid) => {
-                if (valid) {
-                    if (this.form.sceneType === "4") {
-                        let formData = new FormData();
-                        await formData.append("taskName", this.form.name);
-                        await formData.append("name", this.file.name);
-                        await formData.append("file", this.file.raw);
-
-                        await this.$axios({
-                            method: "post",
-                            url: this.$api.systemManagement
-                                .saveSceneGeneralTemplateAll,
-                            data: formData,
-                            withCredentials: true,
-                            headers: {
-                                "Content-type": "multipart/form-data",
-                            },
-                        }).then((res) => {
-                            if (res.code == 200) {
-                                this.$message.success("保存成功");
-                                this.uploadCancel();
-                                this.doSearch();
-                            } else {
-                                this.$message.error(res.message || "保存失败");
-                            }
-                        });
-                    } else {
-                        this.$axios({
-                            method: "post",
-                            url: this.$api.systemManagement.saveTask,
-                            data: { ...this.form },
-                        }).then((res) => {
-                            if (res.code == 200) {
-                                this.$message.success("保存成功");
-                                this.uploadCancel();
-                                this.doSearch();
-                            } else {
-                                this.$message.error(res.message || "保存失败");
-                            }
-                        });
-                    }
-                }
-            });
+        {
+          label: '复杂度A',
+          value: 1,
         },
-        uploadCancel() {
-            this.dialogVisible = false;
+        {
+          label: '复杂度B',
+          value: 2,
         },
-        attachmentChange(obj) {
-            this.attachmentList = obj;
-        },
-        handleChange(file) {
-            this.file = file;
-            this.form.fileName = file.name;
-        },
-        sceneTypeChange(v) {
-            if (v === "4") {
-                this.$refs.form.clearValidate("dataDirectory");
-            } else {
-                this.file = null;
-                this.form.fileName = "";
-                this.$refs.form.clearValidate("fileName");
-            }
+        {
+          label: '复杂度C',
+          value: 3,
         },
+      ],
+    }
+  },
+
+  methods: {
+    doSearch(isTimer = false) {
+      // if (this.uploadDate) {
+      //     this.searchParams.timeBegin = `${this.uploadDate[0]}`;
+      //     this.searchParams.timeEnd = `${this.uploadDate[1]}`;
+      // } else {
+      //     this.searchParams.timeBegin = "";
+      //     this.searchParams.timeEnd = "";
+      // }
+
+      let timeBegin = ''
+      if (this.searchParams.timeBegin) {
+        timeBegin = `${this.searchParams.timeBegin} 00:00:00`
+      }
+
+      let timeEnd = ''
+      if (this.searchParams.timeEnd) {
+        timeEnd = `${this.searchParams.timeEnd} 23:59:59`
+      }
+
+      if (timeBegin && timeEnd && timeBegin > timeEnd) {
+        this.$message.error('结束时间不能早于开始时间')
+        return
+      }
+
+      let pageMap = {
+        name: this.searchParams.name,
+        timeBegin,
+        timeEnd,
+        resetPageNum: !isTimer ? false : this.pagination.currentPage || 1,
+      }
+
+      if (!isTimer) this.pagination.currentPage = 1
+
+      this.refreshList(pageMap)
+
+      if (this.timer) clearInterval(this.timer)
+
+      this.timer = setInterval(() => {
+        if (this.$refs['table']) this.doSearch(true)
+      }, 1000 * 60)
+    },
+    //刷新table
+    refreshList(param) {
+      param
+        ? this.$refs['table'].loadData(param)
+        : this.$refs['table'].loadData()
+    },
+    doReset() {
+      this.searchParams = {
+        name: '',
+        timeBegin: '',
+        timeEnd: '',
+      }
+      // this.uploadDate = "";
+      this.doSearch(false)
+    },
+    addOne() {
+      this.form = {
+        name: '', // 任务名称
+        sceneType: '', // 场景类型
+        dataDirectory: '', // 场景路径
+        fileName: '', // 文件上传
+        script: 0, // 复杂度评价脚本
+      }
+      this.file = null
+
+      this.dialogVisible = true
+
+      this.$nextTick(() => {
+        this.$refs.form.clearValidate()
+      })
+    },
+    viewRow(errorMessage) {
+      this.errorMessage = errorMessage
+      this.errRocordVisible = true
+    },
+    delRow(id) {
+      this.$confirm(
+        '确认是否删除?(温馨提示:文件较大,删除时间较长请您耐心等待)',
+        '提示',
+        {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        }
+      ).then(() => {
+        this.$axios({
+          method: 'post',
+          url: this.$api.systemManagement.deleteTask,
+          timeout: 1000 * 60 * 30,
+          data: {
+            id,
+          },
+        }).then((res) => {
+          if (res.code == 200) {
+            this.$message.success('删除成功')
+          } else {
+            this.$message.error(res.message || '删除失败')
+          }
+          this.doSearch()
+        })
+      })
     },
+    errClose() {
+      this.errRocordVisible = false
+      this.errorMessage = ''
+    },
+    uploadConfirm() {
+      this.$refs.form.validate(async (valid) => {
+        if (valid) {
+          if (this.form.sceneType === '4') {
+            let formData = new FormData()
+            await formData.append('taskName', this.form.name)
+            await formData.append('name', this.file.name)
+            await formData.append('file', this.file.raw)
+
+            await this.$axios({
+              method: 'post',
+              url: this.$api.systemManagement.saveSceneGeneralTemplateAll,
+              data: formData,
+              withCredentials: true,
+              headers: {
+                'Content-type': 'multipart/form-data',
+              },
+            }).then((res) => {
+              if (res.code == 200) {
+                this.$message.success('保存成功')
+                this.uploadCancel()
+                this.doSearch()
+              } else {
+                this.$message.error(res.message || '保存失败')
+              }
+            })
+          } else {
+            this.$axios({
+              method: 'post',
+              url: this.$api.systemManagement.saveTask,
+              data: { ...this.form },
+            }).then((res) => {
+              if (res.code == 200) {
+                this.$message.success('保存成功')
+                this.uploadCancel()
+                this.doSearch()
+              } else {
+                this.$message.error(res.message || '保存失败')
+              }
+            })
+          }
+        }
+      })
+    },
+    uploadCancel() {
+      this.dialogVisible = false
+    },
+    attachmentChange(obj) {
+      this.attachmentList = obj
+    },
+    handleChange(file) {
+      this.file = file
+      this.form.fileName = file.name
+    },
+    sceneTypeChange(v) {
+      if (v === '4') {
+        this.$refs.form.clearValidate('dataDirectory')
+      } else {
+        this.file = null
+        this.form.fileName = ''
+        this.$refs.form.clearValidate('fileName')
+      }
+    },
+  },
 
-    async mounted() {
-        if (this.timer) clearInterval(this.timer);
+  async mounted() {
+    if (this.timer) clearInterval(this.timer)
 
-        this.timer = setInterval(() => {
-            if (this.$refs["table"]) this.doSearch(true);
-        }, 1000 * 60);
+    this.timer = setInterval(() => {
+      if (this.$refs['table']) this.doSearch(true)
+    }, 1000 * 60)
 
-        await this.$dicsListsInit({
-            sceneTypeList: "sceneType",
-        });
-    },
+    await this.$dicsListsInit({
+      sceneTypeList: 'sceneType',
+    })
+  },
 
-    beforeDestroy() {
-        clearInterval(this.timer);
-    },
-};
+  beforeDestroy() {
+    clearInterval(this.timer)
+  },
+}
 </script>
 
 <style lang='less' scoped>
 .btnsPanel {
-    margin: 45px 40px 15px;
-    text-align: right;
+  margin: 45px 40px 15px;
+  text-align: right;
 }
 
 .errRecord {
-    color: @themeColor;
-    cursor: pointer;
+  color: @themeColor;
+  cursor: pointer;
 }
 
 .tdBtn {
-    margin-right: 10px;
+  margin-right: 10px;
 
-    &:last-child {
-        margin-right: 0;
-    }
+  &:last-child {
+    margin-right: 0;
+  }
 }
 
 .upload {
-    margin-top: 15px;
+  margin-top: 15px;
 }
 </style>

+ 4 - 4
vue.config.js

@@ -77,7 +77,7 @@ module.exports = {
         hot: true,
         proxy: { // 配置跨域处理 可以设置多个
             '/simulation/oauth': {
-                target: 'http://36.110.106.156', // online-new
+                target: 'http://60.205.245.110:7001', // online-new
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数
                 pathRewrite: {
@@ -85,7 +85,7 @@ module.exports = {
                 }
             },
             '/simulation/resource/common': {
-                target: 'http://36.110.106.156', // online-new
+                target: 'http://60.205.245.110:8001', // online-new
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数
                 pathRewrite: {
@@ -93,7 +93,7 @@ module.exports = {
                 }
             },
             '/simulation/resource/server': {
-                target: 'http://36.110.106.156', // online-new
+                target: 'http://60.205.245.110:8005', // online-new
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数
                 pathRewrite: {
@@ -101,7 +101,7 @@ module.exports = {
                 }
             },
             '/simulation/resource/video': {
-                target: 'http://36.110.106.156', // online-new
+                target: 'http://60.205.245.110:8007', // online-new
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数
                 pathRewrite: {