分支自 SuZhouGuanHong/TaiYuanTaiZhong

huanghongfeng
2024-07-08 32678f5c24c7681a198b517fa72db1de2e98646d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<template>
  <div class="fixed-row">
    <span style="margin-left: 40px;font-size: 20px;">
      <el-button style="background-color: #409eff;color: #000;width: 70px;height: 50px;">有货</el-button>
      <el-button style="background-color: lightgreen;color: #000;width: 70px;height: 50px;">空货位</el-button>
      <el-button style="background-color: yellow;color: #000;width: 70px;height: 50px;">出入库占用</el-button>
      <el-button style="background-color: red;color: #000;width: 70px;height: 50px;">异常</el-button>
      <el-button style="background-color: #C0C4CC;color: #000;width: 70px;height: 50px;">禁用</el-button>
    </span>
  </div>
  <div style="height: 60px;">
 
  </div>
  <div style="width: 1100px;">
    <!--外协区-->
    <div style="width: 100px;float: right;height: 180px;">
      <div v-for="(items, inst) in dataList[0].item1" :key="inst">
        <div>
          <el-tooltip class="item" effect="dark" placement="right">
            <template #content
              v-if="items.stationType !== ''  && items.stationType !== null && items.bindSN !== null">
              <div>库位编号:{{ items.stationCode }}</div>
              <div>物料类型(图号): {{ items.stationType }}</div>
              <div>炉号: {{ items.heatNumber }}</div>
              <div style="width: 76px;">车轮SN号:{{ items.bindSN }}</div>
              <div>钢坯号:{{ items.billetID }}</div>
            </template>
            <template #content v-else>
              <div>库位编号:{{ items.stationCode }}</div>
              <div>目前暂无车轮信息</div>
 
            </template>
            <div class="w_div" :style="{ 'background-color': getBackgroundColor(items.enable, items.location_state) }">
            </div>
          </el-tooltip>
        </div>
      </div>
    </div>
  </div>
  <div v-for="(item, inst) in dataList" :key="inst" :style="{ 'margin-left': getmargin(inst) }" v-if="inst !=='1'">
    <div class="table-container">
      <div class="scrollable-table">
        <table class="one_tal" >
          <tr v-if="inst !== 1 && inst !== 0" v-for="(item, k) in dataList[inst].item2" :key="k">
            <td v-for="items in filteredItems(dataList[inst].item1, k+1)" :key="items.stationCode"
              :style="{ 'background-color': getBackgroundColor(items.enable,items.location_state) }">
              <el-tooltip class="item" effect="dark" placement="right">
                <template #content
                  v-if="items.stationType!==''  && items.stationType!==null && items.bindSN !== null">
                  <div>库位编号:{{ items.stationCode }}</div>
                  <div>物料类型(图号): {{ items.stationType }}</div>
                  <div>炉号: {{ items.heatNumber }}</div>
                  <div style="width: 76px;">车轮SN号:{{ items.bindSN }}</div>
                  <div>钢坯号:{{ items.billetID }}</div>
                </template>
                <template #content v-else>
                  <div>库位编号:{{ items.stationCode }}</div>
                  <div>目前暂无车轮信息</div>
                </template>
                <div style="height: 20px;writing-mode: vertical-lr;" :style="{ 'width': getwidth(inst) }"></div>
              </el-tooltip>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>
 
<script>
import axios from 'axios';
 
export default {
  props: {
    dataList: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      visible: false,
    };
  },
  methods: {
    getmargin(inst){
      if(inst =="2"){
        return '190px'; 
      }
    },
    getwidth(inst){
      if(inst =="4"){
        return '23px'; 
      }else{
        return '20px'; 
      }
    },
    getBackgroundColor(enable,locationState) {
      if (enable=='0') {
          return '#C0C4CC'; 
      }
      else{
        switch (locationState) {
        case 'Stroge':
        return '#409eff';
        case 'Empty':
          return 'lightgreen';
        case 'InBusy':
          return 'yellow';
        case 'OutBusy':
          return 'yellow';
        case 'Busy':
          return 'yellow';
        case 'Abnormal':
          return 'red';
        case 'Abnormal':
          return 'yellow';
        default:
          return 'transparent';
      }
      }
      
    }
  },
  mounted() {
  },
  computed: {
    filteredItems() {
      return (itemList, line) => {
        return itemList.filter(item => item.line === line);
      };
    }
  }
};
</script>
 
<style scoped>
.scrollable-table {
  width: 100%;
}
 
.one_tal {
  padding-right: 100px;
}
 
.one_tal tr {
  margin-top: 5px;
  margin-bottom: 5px;
}
.w_div{
  height: 20px;
  width: 20px;
  margin-top: 4px;
}
.one_tal td {
  background-color: rgb(36, 227, 241);
  text-align: center;
 
}
 
.table-container::-webkit-scrollbar {
  width: 1px;
  height: 15px;
}
 
 
 
.fixed-row {
  position: fixed;
  width: 100%;
  
  z-index: 3;
}
</style>