Ver código fonte

Merge branch 'master' of http://112.74.164.79:3000/chenying/X-web

chenying 6 meses atrás
pai
commit
e6ee2e303e
2 arquivos alterados com 308 adições e 7 exclusões
  1. 21 0
      src/utils/date-util.js
  2. 287 7
      src/views/modules/device/device-history.vue

+ 21 - 0
src/utils/date-util.js

@@ -0,0 +1,21 @@
+/**
+ * 时间格式
+ */
+export function formatTime (time) {
+  if (!time || time.length < 6) return ''
+  let seconds = time.slice(-2)
+  let minutes = time.slice(-4, -2)
+  let hours = time.slice(0, -4)
+  return hours + ':' + minutes + ':' + seconds
+}
+
+/**
+ * 日期格式
+ */
+export function formatDate (date) {
+  if (!date || date.length < 6) return ''
+  let day = date.slice(-2)
+  let month = date.slice(-4, -2)
+  let year = date.slice(0, -4)
+  return year + '.' + month + '.' + day
+}

+ 287 - 7
src/views/modules/device/device-history.vue

@@ -102,6 +102,7 @@
       <el-table-column
         header-align="center"
         align="center"
+        min-width="100"
         label="第一轴下一指令">
         <template slot-scope="scope">
           <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos1'">{{ item.value }}</span>
@@ -110,6 +111,7 @@
       <el-table-column
         header-align="center"
         align="center"
+        min-width="100"
         label="第二轴下一指令">
         <template slot-scope="scope">
           <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos2'">{{ item.value }}</span>
@@ -118,6 +120,7 @@
       <el-table-column
         header-align="center"
         align="center"
+        min-width="100"
         label="第三轴下一指令">
         <template slot-scope="scope">
           <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos3'">{{ item.value }}</span>
@@ -126,6 +129,7 @@
       <el-table-column
         header-align="center"
         align="center"
+        min-width="100"
         label="第四轴下一指令">
         <template slot-scope="scope">
           <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos4'">{{ item.value }}</span>
@@ -134,6 +138,7 @@
       <el-table-column
         header-align="center"
         align="center"
+        min-width="100"
         label="第五轴下一指令">
         <template slot-scope="scope">
           <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos5'">{{ item.value }}</span>
@@ -142,6 +147,7 @@
       <el-table-column
         header-align="center"
         align="center"
+        min-width="100"
         label="第六轴下一指令">
         <template slot-scope="scope">
           <span v-for="item in scope.row.points" v-if="item.name==='NextDistancePos6'">{{ item.value }}</span>
@@ -150,19 +156,19 @@
       <el-table-column
         header-align="center"
         align="center"
-        min-width="90"
+        min-width="100"
         label="自动运行时间">
         <template slot-scope="scope">
-          <span v-for="item in scope.row.points" v-if="item.name==='RunTime'">{{ item.value }}</span>
+          <span v-for="item in scope.row.points" v-if="item.name==='RunTime'">{{ formatTime(item.value) }}</span>
         </template>
       </el-table-column>
       <el-table-column
         header-align="center"
         align="center"
-        min-width="90"
+        min-width="100"
         label="自动启动时间">
         <template slot-scope="scope">
-          <span v-for="item in scope.row.points" v-if="item.name==='StartTime'">{{ item.value }}</span>
+          <span v-for="item in scope.row.points" v-if="item.name==='StartTime'">{{ formatTime(item.value) }}</span>
         </template>
       </el-table-column>
       <el-table-column
@@ -180,7 +186,7 @@
         min-width="90"
         label="上电时间">
         <template slot-scope="scope">
-          <span v-for="item in scope.row.points" v-if="item.name==='KeepAliveTime'">{{ item.value }}</span>
+          <span v-for="item in scope.row.points" v-if="item.name==='KeepAliveTime'">{{ formatTime(item.value) }}</span>
         </template>
       </el-table-column>
       <el-table-column
@@ -189,7 +195,7 @@
         min-width="90"
         label="系统日期">
         <template slot-scope="scope">
-          <span v-for="item in scope.row.points" v-if="item.name==='SystemDate'">{{ item.value }}</span>
+          <span v-for="item in scope.row.points" v-if="item.name==='SystemDate'">{{ formatDate(item.value) }}</span>
         </template>
       </el-table-column>
       <el-table-column
@@ -198,7 +204,7 @@
         min-width="90"
         label="系统时间">
         <template slot-scope="scope">
-          <span v-for="item in scope.row.points" v-if="item.name==='SystemTime'">{{ item.value }}</span>
+          <span v-for="item in scope.row.points" v-if="item.name==='SystemTime'">{{ formatTime(item.value) }}</span>
         </template>
       </el-table-column>
       <el-table-column
@@ -368,6 +374,276 @@
           <span v-for="item in scope.row.points" v-if="item.name==='ServoLoad6'">{{ item.value }}</span>
         </template>
       </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="设备运行模式">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='RunMode'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="设备运行状态">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='RunStatus'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="当前刀具号">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='CulToolNum'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="设备急停状态">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='EmergencyStop'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="G代码状态">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='GCodeStatus'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="累计生产件数">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='ProductCounts'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第一轴机械坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='MacPos1'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第二轴机械坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='MacPos2'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第三轴机械坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='MacPos3'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第四轴机械坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='MacPos4'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第五轴机械坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='MacPos5'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第六轴机械坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='MacPos6'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第一轴工件坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='WorkPos1'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第二轴工件坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='WorkPos2'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第三轴工件坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='WorkPos3'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第四轴工件坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='WorkPos4'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第五轴工件坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='WorkPos5'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第六轴工件坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='WorkPos6'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第一轴当前(相对)坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos1'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第二轴当前(相对)坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos2'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第三轴当前(相对)坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos3'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第四轴当前(相对)坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos4'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第五轴当前(相对)坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos5'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第六轴当前(相对)坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='CurrentPos6'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第一轴剩余坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='DistancePos1'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第二轴剩余坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='DistancePos2'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第三轴剩余坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='DistancePos3'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第四轴剩余坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='DistancePos4'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第五轴剩余坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='DistancePos5'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="第六轴剩余坐标">
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.points" v-if="item.name==='DistancePos6'">{{ item.value }}</span>
+        </template>
+      </el-table-column>
     </el-table>
     <el-pagination
       @size-change="sizeChangeHandle"
@@ -385,6 +661,8 @@
 </template>
 
 <script>
+import {formatDate, formatTime} from '@/utils/date-util'
+
 export default {
   name: 'device-history',
   components: {
@@ -402,6 +680,8 @@ export default {
     }
   },
   methods: {
+    formatDate,
+    formatTime,
     async init (code) {
       this.code = code
       this.search()