瀏覽代碼

手动运行项目列表下载及图表优化

zhangliang2 3 年之前
父節點
當前提交
176aaa4683

+ 4 - 0
src/api/workManagement.js

@@ -8,6 +8,8 @@ const updateProjectNowRunState = basePart + '/simulationProject/updateProjectNow
 
 const selectProject = basePart + '/simulationProject/selectProject'; // 手动运行项目列表
 const deleteProjectByids = basePart + '/simulationProject/deleteProjectByids'; // 删除手动运行项目
+const exportProjectReportAndTaskFileById = basePart + '/simulationProject/exportProjectReportAndTaskFileById'; // 导出报告和任务包
+const exportProjectTaskFileById = basePart + '/simulationProject/exportProjectTaskFileById'; // 导出任务包
 
 const selectProjectDetailsById = basePart + '/simulationProject/selectProjectDetailsById'; // 获取手动运行项目工作详情
 const selectProjectTaskList = basePart + '/simulationProject/selectProjectTaskList'; // 获取手动运行项目工作详情-任务列表
@@ -25,6 +27,8 @@ export default {
 
     selectProject,
     deleteProjectByids,
+    exportProjectReportAndTaskFileById,
+    exportProjectTaskFileById,
 
     selectProjectDetailsById,
     selectProjectTaskList,

+ 1 - 1
src/axios/filter.js

@@ -90,7 +90,7 @@ const instance = axios.create({
 
 instance.defaults.headers.common['Authorization'] = ""; //请求token信息配置
 instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; //请求type设置
-instance.defaults.timeout = 1000 * 60 * 30; //在超时前,所有请求都会等待
+instance.defaults.timeout = 1000 * 60 * 60; //在超时前,所有请求都会等待
 instance.defaults.withCredentials = true;
 
 instance.interceptors.request.use(function (config) {

+ 9 - 1
src/components/echarts/lineChartMainPageA.vue

@@ -50,6 +50,12 @@ export default {
             }
 
             let option = {
+                title: {
+                    text: "暂无数据",
+                    show: this.dataList.length === 0,
+                    left: "center",
+                    top: "center",
+                },
                 tooltip: {
                     //提示框,可以在全局也可以在
                     trigger: "item", //提示框的样式
@@ -77,7 +83,7 @@ export default {
                     data: xData,
                 },
                 yAxis: {
-                    minInterval: 1
+                    minInterval: 1,
                 },
                 series: [
                     {
@@ -146,6 +152,8 @@ export default {
     mounted() {
         this.charts = this.$echarts.init(document.getElementById(this.id));
 
+        this.initStateList();
+        
         this.$nextTick(() => {
             window.addEventListener("resize", () => {
                 this.charts.resize();

+ 8 - 0
src/components/echarts/lineChartTaskInfo.vue

@@ -50,6 +50,12 @@ export default {
             let yData = this.yList;
 
             let option = {
+                title: {
+                    text: "暂无数据",
+                    show: yData.length === 0,
+                    left: "center",
+                    top: "center",
+                },
                 tooltip: {
                     //提示框,可以在全局也可以在
                     trigger: "item", //提示框的样式
@@ -110,6 +116,8 @@ export default {
     mounted() {
         this.charts = this.$echarts.init(document.getElementById(this.id));
 
+        this.initStateList();
+
         this.$nextTick(() => {
             window.addEventListener("resize", () => {
                 this.charts.resize();

+ 9 - 12
src/components/echarts/pieChartMainPage.vue

@@ -82,6 +82,12 @@ export default {
             }
 
             let option = {
+                title: {
+                    text: "暂无数据",
+                    show: dataList.length === 0,
+                    left: "center",
+                    top: "center",
+                },
                 tooltip: {
                     //提示框,可以在全局也可以在
                     trigger: "item", //提示框的样式
@@ -98,23 +104,12 @@ export default {
                     {
                         name: this.seriesName,
                         type: "pie",
-                        // radius: '55%',
                         data,
                         top: 15,
                         avoidLabelOverlap: true,
                         label: {
-                            // alignTo: "edge",
-                            // formatter: "{name|{b}}\n{time|{c} 小时}",
-                            // minMargin: 5,
                             edgeDistance: 15,
                             distance: 25,
-                            // lineHeight: 15,
-                            // rich: {
-                            //     time: {
-                            //         fontSize: 10,
-                            //         color: "#999",
-                            //     },
-                            // },
                         },
                     },
                 ],
@@ -127,6 +122,8 @@ export default {
     mounted() {
         this.charts = this.$echarts.init(document.getElementById(this.id));
 
+        this.initStateList();
+
         this.$nextTick(() => {
             window.addEventListener("resize", () => {
                 this.charts.resize();
@@ -134,7 +131,7 @@ export default {
         });
     },
     destroyed() {
-        // console.log("destroyed");
+        // console.log("pie destroyed");
         this.charts.dispose();
     },
 };

+ 8 - 0
src/components/echarts/pieChartProjectInfo.vue

@@ -78,6 +78,12 @@ export default {
             }
 
             let option = {
+                title: {
+                    text: "暂无数据",
+                    show: stateList.length === 0,
+                    left: "center",
+                    top: "center",
+                },
                 tooltip: {
                     //提示框,可以在全局也可以在
                     trigger: "item", //提示框的样式
@@ -109,6 +115,8 @@ export default {
     mounted() {
         this.charts = this.$echarts.init(document.getElementById(this.id));
 
+        this.initStateList();
+
         this.$nextTick(() => {
             window.addEventListener("resize", () => {
                 this.charts.resize();

+ 1 - 6
src/views/index.vue

@@ -28,11 +28,6 @@ export default {
         },
     },
     mounted() {
-        // localStorage.setItem(
-        //     "Authorization",
-        //     "Bearer 9882c634-9af6-4647-89dc-8ad53c04a56b"
-        // );
-
         let { code, ticket } = this.$route.query;
         if (code && ticket) {
             this.$axios({
@@ -50,7 +45,7 @@ export default {
                             this.$refs.curRouter.init();
                     });
                 } else {
-                    alert(res);
+                    this.$message.error(res.message || "网络异常");
                 }
             });
         }

+ 64 - 8
src/views/workManagement/manualRunProjectList.vue

@@ -158,22 +158,23 @@
                         class="el-icon-delete elIcon"
                         title="删除"
                     ></i>
-                    <!-- <i
+                    <i
                         v-if="scope.row.nowRunState != '10'"
                         @click="downRow(scope.row)"
                         class="el-icon-download elIcon"
                         title="下载"
-                    ></i> -->
+                    ></i>
                 </template>
             </el-table-column>
         </tableList>
 
         <el-dialog
-            title="编辑"
+            title="下载"
             :visible.sync="dialogVisible"
             width="690px"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
+            :before-close="cancelDown"
         >
             <div class="checkboxPanel">
                 <el-checkbox-group v-model="downType">
@@ -182,10 +183,8 @@
                 </el-checkbox-group>
             </div>
             <span slot="footer">
-                <el-button type="primary" @click="dialogVisible = false"
-                    >确 定</el-button
-                >
-                <el-button @click="dialogVisible = false">取 消</el-button>
+                <el-button type="primary" @click="confirmDown">确 定</el-button>
+                <el-button @click="cancelDown">取 消</el-button>
             </span>
         </el-dialog>
     </div>
@@ -270,6 +269,7 @@ export default {
             checkedArr: [],
             downType: [],
             dialogVisible: false,
+            curRow: {}, // 当前row
         };
     },
     methods: {
@@ -426,10 +426,66 @@ export default {
         viewRow(id) {
             this.$router.push({ path: "/projectInfo", query: { id } });
         },
-        addMarkDia() {},
         downRow(row) {
+            this.curRow = row;
             this.dialogVisible = true;
         },
+        confirmDown() {
+            let url = "";
+            let fileName = this.curRow.projectName;
+            
+            if (this.downType.length === 0) {
+                this.$message.info("请先选择下载类型");
+                return;
+            } else if (this.downType.length === 1) {
+                if (this.downType[0] === "工作报告") {
+                    url = this.$api.workManagement.exportProjectReportById;
+                    fileName += ".pdf";
+                } else {
+                    url = this.$api.workManagement.exportProjectTaskFileById;
+                    fileName += ".zip";
+                }
+            } else {
+                url =
+                    this.$api.workManagement.exportProjectReportAndTaskFileById;
+                fileName += ".zip";
+            }
+
+            let id = this.curRow.id;
+            this.curRow = {};
+
+            this.$axios({
+                method: "post",
+                url,
+                responseType: "blob",
+                data: {
+                    id,
+                },
+            }).then((res) => {
+                let blob = new Blob([res]);
+                if ("download" in document.createElement("a")) {
+                    // 非IE下载
+                    let emlink = document.createElement("a");
+                    emlink.download = fileName;
+                    emlink.style.display = "none";
+                    emlink.href = URL.createObjectURL(blob);
+                    document.body.appendChild(emlink);
+                    emlink.click();
+                    URL.revokeObjectURL(emlink.href);
+                    document.body.removeChild(emlink);
+                } else {
+                    // IE下载
+                    navigator.msSaveBlob(blob, fileName);
+                }
+            });
+
+            this.downType = [];
+            this.dialogVisible = false;
+        },
+        cancelDown() {
+            this.downType = [];
+            this.dialogVisible = false;
+        },
     },
 
     async mounted() {

+ 7 - 7
src/views/workManagement/taskInfo.vue

@@ -306,13 +306,13 @@ export default {
                     this.info = res.info;
                     this.xList = res.info.curveData.time;
 
-                    this.yListA = res.info.curveData.acceleration;
-                    this.yListB = res.info.curveData.lane_offset;
-                    this.yListC = res.info.curveData.brake;
-                    this.yListD = res.info.curveData.steeting;
-                    this.yListE = res.info.curveData.throttle;
-                    this.yListF = res.info.curveData.yaw_rate;
-                    this.yListG = res.info.curveData.velocity;
+                    this.yListA = res.info.curveData.acceleration || [];
+                    this.yListB = res.info.curveData.lane_offset || [];
+                    this.yListC = res.info.curveData.brake || [];
+                    this.yListD = res.info.curveData.steeting || [];
+                    this.yListE = res.info.curveData.throttle || [];
+                    this.yListF = res.info.curveData.yaw_rate || [];
+                    this.yListG = res.info.curveData.velocity || [];
                 } else {
                     this.$message.error(res.message || "获取信息失败");
                 }

+ 3 - 2
vue.config.js

@@ -102,12 +102,13 @@ module.exports = {
             },
             '/simulation/resource/server': {
                 // target: 'http://10.15.12.73:7003', // 王志强
-                // target: 'http://10.15.12.88:7003', // 王耀栋
+                target: 'http://10.15.12.88:7003', // 王耀栋
                 // target: 'http://10.15.12.72:7003',  // 王晓峰
                 // target: 'http://10.15.12.87:7003',  // 赵艳
-                target: 'http://10.15.12.70',  // windowstest
+                // target: 'http://10.15.12.70',  // windowstest
                 // target: 'http://192.168.30.75',  // gq
                 // target: 'http://47.94.105.148',  // aliyun
+                // target: 'http://10.15.12.74:7003', // 孟令鑫
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数
                 pathRewrite: {