From 7fd74cafb955021f4f3c287d9edba969645095f1 Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期六, 30 十一月 2024 21:48:35 +0800
Subject: [PATCH] 1

---
 src/views/mdc/first-workpiece-detail.vue    |  131 ++++++++++++++++++++++++++------
 src/views/mdc/processParam/index.vue        |   10 +-
 src/views/mdc/first-workpiece.vue           |   26 +++---
 src/views/mdc/first-workpiece-process.vue   |   42 +++++++---
 src/views/mdc/components/process-charts.vue |    2 
 5 files changed, 154 insertions(+), 57 deletions(-)

diff --git a/src/views/mdc/components/process-charts.vue b/src/views/mdc/components/process-charts.vue
index 998947a..1e375d7 100644
--- a/src/views/mdc/components/process-charts.vue
+++ b/src/views/mdc/components/process-charts.vue
@@ -75,7 +75,7 @@
             arr.push(obj)
         }
         this.option.series = arr;
-        console.log(this.option.series)
+        //console.log(this.option.series)
         var recordDom = this.$refs.processCharts;
         var myChart = echarts.init(recordDom);
         myChart.setOption(this.option);
diff --git a/src/views/mdc/first-workpiece-detail.vue b/src/views/mdc/first-workpiece-detail.vue
index 6bf59b3..7f90678 100644
--- a/src/views/mdc/first-workpiece-detail.vue
+++ b/src/views/mdc/first-workpiece-detail.vue
@@ -28,24 +28,55 @@
             </div>
         </el-card>
         <el-card body-style="height: 100%;padding: 0;" style="margin-bottom: 12px;">
-            <el-table :data="tableData" border @selection-change="handleSelectionChange">
-                <el-table-column prop="test" label="搴忓彿" width="60"></el-table-column>
-                <el-table-column prop="test" label="闆朵欢鍙�" width="80"></el-table-column>
-                <el-table-column prop="test" label="宸ュ簭鍙�" width="80"></el-table-column>
-                <el-table-column prop="test" label="鐗堟" width="60"></el-table-column>
-                <el-table-column prop="test" label="鏈哄簥" width="60"></el-table-column>
-                <el-table-column prop="test" label="寮�鏈烘椂闂�" width="80"></el-table-column>
-                <el-table-column prop="test" label="缁撴潫鏃堕棿" width="80"></el-table-column>
-                <el-table-column prop="test" label="鍗犳満鏃堕棿" width="100"></el-table-column>
-                <el-table-column prop="test" label="瑁呭す璋冭瘯鏃堕棿" width="100"></el-table-column>
-                <el-table-column prop="test" label="棣栦欢鍒囧墛鏃堕棿" width="100"></el-table-column>
-                <el-table-column prop="test" label="棣栦欢鍒囧墛鏃堕棿" width="100"></el-table-column>
-                <el-table-column prop="test" label="鏈欢鎷嗗嵏鏃堕棿" width="100"></el-table-column>
-                <el-table-column prop="test" label="棣栦欢璁¢噺鏃堕棿" width="100"></el-table-column>
-                <el-table-column prop="test" label="鍔犲伐鏃堕棿" width="80"></el-table-column>
-                <el-table-column prop="test" label="鍑嗗鏃堕棿" width="80"></el-table-column>
-                <el-table-column prop="test" label="鍗曚欢宸ユ椂" width="80"></el-table-column>
-                <el-table-column prop="test" label="鏁伴噺" width="60"></el-table-column>
+            <el-table :data="tableData" border>
+                <el-table-column prop="index" label="搴忓彿" width="60"></el-table-column>
+                    <el-table-column prop="partNo" label="闆朵欢鍙�" width="80"></el-table-column>
+                    <el-table-column prop="processNo" label="宸ュ簭鍙�" width="80"></el-table-column>
+                    <el-table-column prop="version" label="鐗堟" width="60"></el-table-column>
+                    <el-table-column prop="workstationName" label="鏈哄簥" width="100"></el-table-column>
+                    <el-table-column prop="startTime" label="寮�鏈烘椂闂�" width="145"></el-table-column>
+                    <el-table-column prop="endTime" label="缁撴潫鏃堕棿" width="145"></el-table-column>
+                    <el-table-column prop="occupancySecs" label="鍗犳満鏃堕棿" width="100">
+                        <template #default="scope">
+                            {{ convertSeconds(scope.row.occupancySecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="clampingSecs" label="瑁呭す璋冭瘯鏃堕棿" width="100">
+                         <template #default="scope">
+                            {{ convertSeconds(scope.row.clampingSecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="firstWorkingSecs" label="棣栦欢鍒囧墛鏃堕棿" width="100">
+                        <template #default="scope">
+                            {{ convertSeconds(scope.row.firstWorkingSecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="firstMeasureSecs" label="棣栦欢璁¢噺鏃堕棿" width="100">
+                        <template #default="scope">
+                            {{ convertSeconds(scope.row.firstMeasureSecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="lastRemoveSecs" label="鏈欢鎷嗗嵏鏃堕棿" width="100">
+                        <template #default="scope">
+                            {{ convertSeconds(scope.row.lastRemoveSecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="processingSecs" label="鍔犲伐鏃堕棿" width="80">
+                        <template #default="scope">
+                            {{ convertSeconds(scope.row.processingSecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="prepareSecs" label="鍑嗗鏃堕棿" width="80">
+                        <template #default="scope">
+                            {{ convertSeconds(scope.row.prepareSecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="singleProcessSecs" label="鍗曚欢宸ユ椂" width="80">
+                        <template #default="scope">
+                            {{ convertSeconds(scope.row.singleProcessSecs || 0) }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="amount" label="鏁伴噺" width="60"></el-table-column>
             </el-table>
             <el-footer>
                 <el-button type="primary">杈撳嚭</el-button>
@@ -73,23 +104,69 @@
         }
     },
     created() {
-        var idList = this.$route.query.idList.split(",");
+    },
+    mounted() {
+        this.getTableData();
+        var idList = this.$route.query.ids.split(",");
         idList.forEach(item=> {
             this.detailModelList.push({id: item});
         })
-        // console.log(this.detailModelList,222);
-        for(var i=0;i<10;i++) {
-            this.tableData.push({test: 1})
-        }
-    },
-    mounted() {
     },
     methods: {
-        handleSelectionChange() {
+        convertSeconds(seconds) {  //杞崲鏃堕棿
+            // 瀹氫箟鏃堕棿鍗曚綅杞崲鍏崇郴
+            const daysInSeconds = 24 * 60 * 60;
+            const hoursInSeconds = 60 * 60;
+            const minutesInSeconds = 60;
 
+            // 璁$畻澶╂暟
+            let days = Math.floor(seconds / daysInSeconds);
+            seconds %= daysInSeconds;
+
+            // 璁$畻灏忔椂鏁�
+            let hours = Math.floor(seconds / hoursInSeconds);
+            seconds %= hoursInSeconds;
+
+            // 璁$畻鍒嗛挓鏁�
+            let minutes = Math.floor(seconds / minutesInSeconds);
+            seconds %= minutesInSeconds;
+
+            // 鍑嗗缁撴灉鏁扮粍
+            let result = [];
+
+            // 鏍规嵁闇�瑕佹坊鍔犲ぉ鏁板埌缁撴灉鏁扮粍
+            if (days > 0) {
+                result.push(`${days}澶ー);
+            }
+
+            // 鏍规嵁闇�瑕佹坊鍔犲皬鏃舵暟鍒扮粨鏋滄暟缁�
+            if (hours > 0) {
+                result.push(`${hours}灏忔椂`);
+            }
+
+            // 鏍规嵁闇�瑕佹坊鍔犲垎閽熸暟鍒扮粨鏋滄暟缁�
+            if (minutes > 0) {
+                result.push(`${minutes}鍒嗛挓`);
+            }
+
+            // 濮嬬粓娣诲姞绉掓暟鍒扮粨鏋滄暟缁勶紙鍥犱负绉掓暟鎬绘槸鏈夋剰涔夌殑锛�
+            result.push(`${seconds}绉抈);
+
+            // 杩斿洖鏍煎紡鍖栧悗鐨勫瓧绗︿覆
+            return result.join(' ');
         },
         goFirstWorkProcess(item) {
-            this.$router.push({path: `/mdc/first-workpiece-process`,query: {id:item.id}})
+            sthis.$router.push({path: `/mdc/first-workpiece-process`,query: {id:item.id}})
+        },
+        getTableData() {
+            this.$HTTP.post(`/api/workinghour/listByIds`, {ids: this.$route.query.ids.split(',')}).then(res => {
+                if (res.code === 200) {
+                    res.data.forEach((item,index)=> {
+                        item.index = index + 1;
+                    })
+                    this.tableData = res.data;
+                }
+            })
         }
     }
 }
diff --git a/src/views/mdc/first-workpiece-process.vue b/src/views/mdc/first-workpiece-process.vue
index cfb10fc..e4ce2ff 100644
--- a/src/views/mdc/first-workpiece-process.vue
+++ b/src/views/mdc/first-workpiece-process.vue
@@ -9,12 +9,12 @@
 <template>
     <el-main style="height: 100%;" class="timeAnalysis">
         <el-card body-style="height: 100%;padding: 0;" style="margin-bottom: 12px;">
-            <el-table :data="tableData" border @selection-change="handleSelectionChange">
-                <el-table-column prop="test" label="绋嬪簭鍚嶇О"></el-table-column>
-                <el-table-column prop="test" label="寮�鏈烘椂闂�"></el-table-column>
-                <el-table-column prop="test" label="缁撴潫鏃堕棿"></el-table-column>
-                <el-table-column prop="test" label="鎸佺画鏃堕暱"></el-table-column>
-                <el-table-column prop="test" label="鐘舵��"></el-table-column>
+            <el-table :data="tableData" border>
+                <el-table-column prop="progName" label="绋嬪簭鍚嶇О"></el-table-column>
+                <el-table-column prop="startTime" label="寮�鏈烘椂闂�"></el-table-column>
+                <el-table-column prop="endTime" label="缁撴潫鏃堕棿"></el-table-column>
+                <el-table-column prop="duration" label="鎸佺画鏃堕暱"></el-table-column>
+                <el-table-column prop="deviceStatus" label="鐘舵��"></el-table-column>
             </el-table>
             <el-footer>
                 <el-button type="primary">杈撳嚭</el-button>
@@ -40,16 +40,34 @@
         }
     },
     created() {
-        for(var i=0;i<10;i++) {
-            this.tableData.push({test: 1})
-        }
+        
     },
     mounted() {
+        this.getTableData();
     },
     methods: {
-        handleSelectionChange() {
-
-        }
+        getTableData() {
+            this.$HTTP.get(`/api/workinghour/working-process`, {id: this.$route.query.id}).then(res => {
+                if (res.code === 200) {
+                    this.getprocess(res);
+                }
+            })
+        },
+        getprocess(res) {  //棰滆壊鐘舵��
+            this.$HTTP.get(`/api/smis/global_wcs/list?code=&name=`).then(resp => {
+                if (resp.code == 200) {
+                    res.data.forEach(item=> {
+                        resp.data.forEach(item1=> {
+                            if(item.deviceStatus == item1.code) {
+                                item.deviceStatus = item1.name;
+                            }
+                        })
+                    })
+                    this.tableData = res.data;
+                    console.log(res.data,111)
+                }
+            })
+        },
     }
 }
 </script>
diff --git a/src/views/mdc/first-workpiece.vue b/src/views/mdc/first-workpiece.vue
index ac43190..fb76a12 100644
--- a/src/views/mdc/first-workpiece.vue
+++ b/src/views/mdc/first-workpiece.vue
@@ -62,19 +62,14 @@
                                     {{ convertSeconds(scope.row.firstWorkingSecs || 0) }}
                                 </template>
                             </el-table-column>
-                            <el-table-column prop="firstWorkingSecs" label="棣栦欢鍒囧墛鏃堕棿" width="100">
+                            <el-table-column prop="firstMeasureSecs" label="棣栦欢璁¢噺鏃堕棿" width="100">
                                 <template #default="scope">
-                                    {{ convertSeconds(scope.row.firstWorkingSecs || 0) }}
+                                    {{ convertSeconds(scope.row.firstMeasureSecs || 0) }}
                                 </template>
                             </el-table-column>
                             <el-table-column prop="lastRemoveSecs" label="鏈欢鎷嗗嵏鏃堕棿" width="100">
                                 <template #default="scope">
                                     {{ convertSeconds(scope.row.lastRemoveSecs || 0) }}
-                                </template>
-                            </el-table-column>
-                            <el-table-column prop="firstMeasureSecs" label="棣栦欢璁¢噺鏃堕棿" width="100">
-                                <template #default="scope">
-                                    {{ convertSeconds(scope.row.firstMeasureSecs || 0) }}
                                 </template>
                             </el-table-column>
                             <el-table-column prop="processingSecs" label="鍔犲伐鏃堕棿" width="80">
@@ -129,7 +124,7 @@
             tabPosition: "璁惧缁撴瀯鏍�",
             tableData: [],
             treeChecked: [],
-            workstationIdList: [],
+            ids: [],
             total: 0,
             current: 1,
             size: 20
@@ -142,7 +137,12 @@
         // }
     },
     mounted() {
-        //this.getTableData();
+        var date = new Date();
+        var threeDaysInMilliseconds = 3 * 24 * 60 * 60 * 1000;
+        var threeDaysAgo = new Date(date.getTime() - threeDaysInMilliseconds);
+        this.searchInfo.startDate = threeDaysAgo.toLocaleDateString().replace(/\//g,"-");
+        this.searchInfo.endDate = date.toLocaleDateString().replace(/\//g,"-");
+        this.getTableData();
     },
     methods: {
         handleCurrentChange(val) {
@@ -212,16 +212,16 @@
             })
         },
         goFirstWorkDetail() {
-            if(this.workstationIdList.length == 0) {
+            if(this.ids.length == 0) {
                 this.$message.error("璇峰厛閫夋嫨鏁版嵁");
                 return;
             }
-            this.$router.push({path: `/mdc/first-workpiece-detail`,query: {idList: this.workstationIdList.join(',')}})
+            this.$router.push({path: `/mdc/first-workpiece-detail`,query: {ids: this.ids.join(',')}})
         },
         handleSelectionChange(val) {
-            this.workstationIdList = [];
+            this.ids = [];
             val.forEach(item=> {
-                this.workstationIdList.push(item.workstationId);
+                this.ids.push(item.id);
             })
         },
         query() {
diff --git a/src/views/mdc/processParam/index.vue b/src/views/mdc/processParam/index.vue
index 4105da8..8d7781c 100644
--- a/src/views/mdc/processParam/index.vue
+++ b/src/views/mdc/processParam/index.vue
@@ -455,10 +455,12 @@
                 }
             }).map(v => {
                 if (myname === 'DeviceStatus') {
-                    return {
-                        ...v,
-                        itemStyle: {
-                            color: this.legend.find(item => item.name === v.name).color
+                    if(v.name != 'undefined') {
+                        return {
+                            ...v,
+                            itemStyle: {
+                                color: this.legend.find(item => item.name === v.name).color
+                            }
                         }
                     }
                 }

--
Gitblit v1.9.3