Browse Source

前后端对接

oyq28 4 months ago
parent
commit
a2a676e83b

+ 10 - 0
imcs-ui/src/api/runManageCenter/taskMgr.js

@@ -128,6 +128,10 @@ const apiList = {
       method: 'POST',
       url: `/authority/task/chfPlcWarning`
     },
+    chfTwoDatas: {
+      method: 'POST',
+      url: `/authority/task/chfTwoDatas`
+    },
 }
 
 export default {
@@ -334,4 +338,10 @@ export default {
       data
     })
   },
+  chfTwoDatas (data) {
+    return axiosApi({
+      ...apiList.chfTwoDatas,
+      data
+    })
+  },
 }

+ 33 - 8
imcs-ui/src/views/zuihou/chfLargeScreen/twoDatasModel/component/machine.vue

@@ -7,17 +7,23 @@
         style="height: 100%; width: 100%;"
       >
       <div
-        v-if="!isOnline"
+        v-if="isOnline === '0'"
         class="offLine"
       >
         离线
       </div>
       <div
-        v-if="isOnline"
-        class="onLine"
+        v-if="isOnline === '1'"
+        class="onLineGreen"
       >
         在线
       </div>
+      <div
+        v-if="isOnline === '2'"
+        class="onLine"
+      >
+        生产中
+      </div>
     </div>
     <div class="title">
       {{ title }}
@@ -27,7 +33,6 @@
       class="chart"
     />
   </div>
-  </div>
 </template>
 <script>
 // Echarts的组件
@@ -45,7 +50,7 @@ export default {
     title: {
       type: String,
       default: () => {
-        return "GMU800AVI-1";
+        return "";
       },
     },
     progress: {
@@ -59,13 +64,17 @@ export default {
       default: () => {
         return false;
       }
-    }
+    },
+
   },
   data() {
-    return {};
+    return {
+      machineId:""
+    };
   },
   mounted() {
     this.alarm(this.progress);
+    //this.alarm(99);
   },
   methods: {
     //水球图
@@ -77,7 +86,7 @@ export default {
       var option = {
         title: [
           {
-            text: value * 100 + "%",
+            text: value + "%",
             top: "25%",
             left: "40%",
             textStyle: {
@@ -251,6 +260,22 @@ export default {
       font-size: 2vh;
       border-radius: 5px;
     }
+
+    .onLineGreen {
+      position: absolute;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      top: 60%;
+      height: 20%;
+      width: 20%;
+      background-color: green;
+      color: #000;
+      font-size: 2vh;
+      border-radius: 5px;
+    }
+
+
   }
 
   .title {

+ 27 - 11
imcs-ui/src/views/zuihou/chfLargeScreen/twoDatasModel/component/main-item.vue

@@ -1,23 +1,28 @@
 <template>
   <div class="item-container">
-    <machine />
-    <Order
+    <machine :title="toolName" :is-online="machineData.onlineStatus" :progress="machineData.useRadio?machineData.useRadio:0"/>
+   <Order
       title="当前加工订单"
       :column="columnNow"
+      :tableData="machineData.chfTwoDatas"
       class="item-2"
     />
-    <Progress
-      title="当前加工订单进度"
-      class="item-3"
-    />
+      <Progress
+       title="当前加工订单进度"
+       :tableData="machineData.chfTwoDatas"
+       :point="machineData.chfTwoDatas[0]?machineData.chfTwoDatas[0].point:0"
+       class="item-3"
+     />
     <Order
       title="待加工订单"
       :column="columnNow"
+      :tableData="machineData.chfTwoDatasList"
       class="item-4"
     />
     <Order
       title="维保倒计时"
       :column="columnTime"
+      :tableData="machineData.repairList"
       class="item-5"
     />
   </div>
@@ -32,17 +37,28 @@ export default {
     Order,
     Progress,
   },
+  props: {
+    machineData: {
+      type: Object,
+      required: true, // 每个机床的数据必须传入
+      default: () => ({}) // 默认值为一个空对象
+    },
+    toolName: {
+      type: String,
+      required: true
+    }
+  },
   data() {
     return {
       columnNow: [
-        { prop: "name", label: "订单号" },
-        { prop: "name", label: "零件数量" },
-        { prop: "name", label: "已生产" },
-        { prop: "name", label: "交付时间" },
+        { prop: "orderName", label: "订单号" },
+        { prop: "productNum", label: "零件数量" },
+        { prop: "produceNum", label: "已生产" },
+        { prop: "deliveryTime", label: "交付时间" },
       ],
       columnTime: [
         { prop: "name", label: "设备" },
-        { prop: "name", label: "剩余时间" },
+        { prop: "downTime", label: "剩余时间" },
       ]
     };
   },

+ 37 - 10
imcs-ui/src/views/zuihou/chfLargeScreen/twoDatasModel/component/main.vue

@@ -1,23 +1,50 @@
 <template>
   <div class="mainCOntainer">
-    <div class="one">
-      <mainItem />
+    <div class="one" v-if="machines['GMU800AVI-1']">
+      <mainItem :machineData="machines['GMU800AVI-1']" :toolName="'GMU800AVI-1'"/>
     </div>
-    <div class="two">
-      <mainItem />
+    <div class="two" v-if="machines['GMU800AVI-2']">
+      <mainItem :machineData="machines['GMU800AVI-2']" :toolName="'GMU800AVI-2'"/>
     </div>
-    <div class="three">
-      <mainItem />
+    <div class="three" v-if="machines['GMU800AVI-3']">
+      <mainItem :machineData="machines['GMU800AVI-3']" :toolName="'GMU800AVI-3'"/>
     </div>
   </div>
 </template>
+
 <script>
 import mainItem from './main-item.vue';
+import taskMgrApi from "@/api/runManageCenter/taskMgr";
 export default {
-components: {
-  mainItem
-}
-}
+  components: {
+    mainItem
+  },
+  data() {
+    return {
+      machines: {}
+    };
+  },
+  async created() {
+    await this.fetchMachineData(); // 初始化时获取数据
+  },
+  methods: {
+    async fetchMachineData() {
+/*      try {
+        const response = await axios.get("/api/machine-orders");
+        this.machineData = response.data.data; // 假设响应数据格式如上所示
+      } catch (error) {
+        console.error("获取机床数据失败:", error);
+      }*/
+
+      taskMgrApi.chfTwoDatas().then(response => {
+        const res = response.data;
+        if (res.isSuccess) {
+          this.machines = response.data.data;
+        }
+      });
+    },
+  }
+};
 </script>
 <style lang="scss" scoped>
 .mainCOntainer {

+ 4 - 4
imcs-ui/src/views/zuihou/chfLargeScreen/twoDatasModel/component/order.vue

@@ -32,19 +32,19 @@ export default {
       type: Array,
       default: () => [
         {
-          prop: 'name',
+          prop: 'orderName',
           label: '订单号'
         },
         {
-          prop: 'name',
+          prop: 'productNum',
           label: '零件数量'
         },
         {
-          prop: 'name',
+          prop: 'produceNum',
           label: '已生产'
         },
         {
-          prop: 'name',
+          prop: 'deliveryTime',
           label: '交付时间'
         },
       ]

+ 13 - 9
imcs-ui/src/views/zuihou/chfLargeScreen/twoDatasModel/component/progress.vue

@@ -15,7 +15,7 @@
       />
     </el-table>
     <el-progress
-      :percentage="50"
+      :percentage="point"
       color="green"
       :show-text="false"
       style="margin-top: 4%"
@@ -30,6 +30,10 @@ export default {
       type: String,
       default: "试试看",
     },
+    point: {
+      type: Number,
+      default: 0
+    },
     tableData: {
       type: Array,
       default: () => [{name:123}],
@@ -38,20 +42,20 @@ export default {
       type: Array,
       default: () => [
         {
-          prop: "name",
-          label: "订单号",
+          prop: 'orderName',
+          label: '订单号'
         },
         {
-          prop: "name",
-          label: "零件数量",
+          prop: 'productNum',
+          label: '零件数量'
         },
         {
-          prop: "name",
-          label: "已生产",
+          prop: 'produceNum',
+          label: '已生产'
         },
         {
-          prop: "name",
-          label: "交付时间",
+          prop: 'deliveryTime',
+          label: '交付时间'
         },
       ],
     },

+ 4 - 4
imcs-ui/src/views/zuihou/chfLargeScreen/twoDatasModel/component/sidebar.vue

@@ -2,14 +2,14 @@
   <div class="sidebarCOntainer">
     <Metric />
     <productionCondition class="item-2" />
-    <warningInformation class="item-3" />
+<!--    <warningInformation class="item-3" />-->
     <div
-      style="margin: 5% 0;"
+      style="margin: 2% 7px;"
       class="item-4"
     >
       <img
         src="../../../../../assets/logo/productLine.png"
-        style="height: 100%;width: 100%;"
+        style="height: 250%;width: 110%;"
       >
     </div>
   </div>
@@ -34,6 +34,6 @@ components: {
   grid-template-rows: 20% 20% 20% 1fr;
   grid-gap: 1vh;
   margin-left: auto;
-  margin-right: 5%;
+  margin-right: 10%;
 }
 </style>