Quellcode durchsuchen

工作管理展示优化

zhangliang2 vor 2 Jahren
Ursprung
Commit
e14f4ceace

+ 18 - 9
src/store/index.js

@@ -13,24 +13,33 @@ export default new Vuex.Store({
     fileHost: 'http://47.94.105.148:80', // 开发环境需要连开发服务器地址,上线后会用相对地址拼接fileUrl
     fileUrl: '/simulation/resource/common/minio/preview',
     themeColor: '#3397FF',
-    id: '',   //用户id
-    username: '',  //用户名称
-    roleCode: '',   //用户角色
-    useType: '',   //独占类型
+    id: '', //用户id
+    username: '', //用户名称
+    roleCode: '', //用户角色
+    useType: '', //独占类型
+    scale: 1.5, // 物体加载换算倍数
+    projectInfoTabname: "",
+    taskInfoTabname: "",
   },
   mutations: {
-    getUserId(state, data){
+    getUserId(state, data) {
       state.id = data
     },
-    getUsername(state, data){
+    getUsername(state, data) {
       state.username = data
     },
-    getRoleCode(state, data){
+    getRoleCode(state, data) {
       state.roleCode = data
     },
-    getUseType(state, data){
+    getUseType(state, data) {
       state.useType = data
-    }
+    },
+    getProjectInfoTabname(state, data) {
+      state.projectInfoTabname = data
+    },
+    getTaskInfoTabname(state, data) {
+      state.taskInfoTabname = data
+    },
   },
   actions: {},
   modules: {},

+ 20 - 2
src/views/page/breadCrumb.vue

@@ -45,6 +45,7 @@
 </template>
 
 <script>
+import { mapState } from "vuex";
 export default {
     name: "breadCrumb",
     data() {
@@ -57,7 +58,7 @@ export default {
                 "systemManagement",
                 "workManagement",
             ],
-            imgSrc: require("@/assets/common/image/photoF.png"),
+            // imgSrc: require("@/assets/common/image/photoF.png"),
         };
     },
     methods: {
@@ -79,13 +80,30 @@ export default {
         },
     },
     computed: {
+        ...mapState(["projectInfoTabname", "taskInfoTabname"]),
         list() {
             // console.log(this.$route);
             let isMainPage = false;
             this.$route.matched.filter((item) => {
+                // 项目详情和任务详情的tabname需要动态获取
+                if (item.name === "projectInfo") {
+                    item.meta.tabname =
+                        this.projectInfoTabname ||
+                        localStorage.getItem("projectInfoTabname") ||
+                        "项目详情";
+                }
+
+                if (item.name === "taskInfo") {
+                    item.meta.tabname =
+                        this.taskInfoTabname ||
+                        localStorage.getItem("taskInfoTabname") ||
+                        "任务详情";
+                }
+
                 if (item.name === this.$route.name) {
                     item.fullPath = this.$route.fullPath;
                 }
+
                 if (item.name === "mainPage") {
                     isMainPage = true;
                 }
@@ -172,7 +190,7 @@ export default {
 
         .exit {
             margin-left: 10px;
-            font-size: 30px;
+            font-size: 20px;
             cursor: pointer;
         }
 

+ 8 - 2
src/views/workManagement/autoRunSubProjectList.vue

@@ -51,7 +51,9 @@
                 <el-table-column label="操作" slot="cgInfos" align="center">
                     <template v-slot="scope">
                         <i
-                            @click="viewRow(scope.row.id)"
+                            @click="
+                                viewRow(scope.row.id, scope.row.projectName)
+                            "
                             class="el-icon-view elIcon"
                             title="查看"
                         ></i>
@@ -276,7 +278,11 @@ export default {
                 });
             });
         },
-        viewRow(id) {
+        viewRow(id, name) {
+            // 修改项目详情的tabname
+            this.$store.commit("getProjectInfoTabname", name);
+            localStorage.setItem("projectInfoTabname", name);
+
             this.$router.push({
                 path: "/autoRunProjectList/autoRunSubProjectList/projectInfo",
                 query: { id, projectType: "2" },

+ 46 - 9
src/views/workManagement/manualRunProjectList.vue

@@ -150,7 +150,9 @@
                 <el-table-column label="操作" slot="cgInfos" align="center">
                     <template v-slot="scope">
                         <i
-                            @click="viewRow(scope.row.id)"
+                            @click="
+                                viewRow(scope.row.id, scope.row.projectName)
+                            "
                             class="el-icon-view elIcon"
                             title="查看"
                         ></i>
@@ -163,15 +165,33 @@
                             class="el-icon-edit-outline elIcon"
                             title="编辑"
                         ></i>
+                        <!-- 10待执行 20执行中 30已完成 40已中止 -->
+                        <i
+                            v-if="scope.row.nowRunState === '10'"
+                            @click="
+                                runRow(
+                                    scope.row.id,
+                                    scope.row.parallelism,
+                                    scope.row.nowRunState
+                                )
+                            "
+                            class="el-icon-refresh-right elIcon"
+                            title="运行"
+                        ></i>
                         <i
                             v-if="
-                                scope.row.nowRunState === '10' ||
                                 scope.row.nowRunState === '30' ||
                                 scope.row.nowRunState === '40'
                             "
-                            @click="runRow(scope.row.id, scope.row.parallelism)"
+                            @click="
+                                runRow(
+                                    scope.row.id,
+                                    scope.row.parallelism,
+                                    scope.row.nowRunState
+                                )
+                            "
                             class="el-icon-refresh-right elIcon"
-                            title="运行"
+                            title="重新运行"
                         ></i>
                         <i
                             v-if="scope.row.nowRunState === '20'"
@@ -355,7 +375,11 @@ export default {
                 createEndDate = `${this.searchParams.createEndDate} 23:59:59`;
             }
 
-            if (createStartDate && createEndDate && createStartDate > createEndDate) {
+            if (
+                createStartDate &&
+                createEndDate &&
+                createStartDate > createEndDate
+            ) {
                 this.$message.error("结束时间不能早于开始时间");
                 return;
             }
@@ -370,7 +394,11 @@ export default {
                 finishDateEnd = `${this.searchParams.finishDateEnd} 23:59:59`;
             }
 
-            if (finishDateStart && finishDateEnd && finishDateStart > finishDateEnd) {
+            if (
+                finishDateStart &&
+                finishDateEnd &&
+                finishDateStart > finishDateEnd
+            ) {
                 this.$message.error("结束时间不能早于开始时间");
                 return;
             }
@@ -425,8 +453,13 @@ export default {
                 },
             });
         },
-        runRow(id, parallelism) {
-            this.$confirm("确认是否运行?", "提示", {
+        runRow(id, parallelism, nowRunState) {
+            let str = "确认是否运行?";
+            if (nowRunState === "30" || nowRunState === "40") {
+                str = "确认是否重新运行?";
+            }
+
+            this.$confirm(str, "提示", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",
@@ -519,7 +552,11 @@ export default {
             this.delRow(arr.join(","));
         },
 
-        viewRow(id) {
+        viewRow(id, name) {
+            // 修改项目详情的tabname
+            this.$store.commit("getProjectInfoTabname", name);
+            localStorage.setItem("projectInfoTabname", name);
+
             this.$router.push({
                 path: "/manualRunProjectList/projectInfo",
                 query: { id, projectType: "1" },

+ 15 - 1
src/views/workManagement/projectInfo.vue

@@ -356,6 +356,10 @@ export default {
                     "/autoRunProjectList/autoRunSubProjectList/projectInfo/taskInfo";
             }
 
+            // 修改任务详情的tabname
+            this.$store.commit("getTaskInfoTabname", row.sceneName);
+            localStorage.setItem("taskInfoTabname", row.sceneName);
+
             this.$router.push({
                 path,
                 query: {
@@ -436,8 +440,18 @@ export default {
         },
     },
 
+    watch: {
+        $route(to, from) {
+            if (to.name === "projectInfo") {
+                this.$nextTick(() => {
+                    if (this.$refs.threeShow)
+                        this.$refs.threeShow.showAll(this.configList);
+                });
+            }
+        },
+    },
+
     mounted() {
-        // console.log(this.$route);
         if (this.$route.query.id) {
             this.id = this.$route.query.id;
             this.projectType = this.$route.query.projectType || "1";