分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-06-26 54ed2050bacec14a51ff96c6e0e2ec7033cd727a
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
175
176
177
178
179
180
181
<template>
  <div class="fixed-row">
 
    <span style="margin-left: 40px;font-size: 20px;">
        <el-button  circle style="background-color: #409eff;color: #000;width: 70px;height: 50px;">有货</el-button>
        <el-button  circle style="background-color: lightgreen;color: #000;width: 70px;height: 50px;">空货位</el-button>
        <el-button  circle style="background-color: yellow;color: #000;width: 70px;height: 50px;">出入库占用</el-button>
        <el-button  circle style="background-color: red;color: #000;width: 70px;height: 50px;">异常</el-button>
        <el-button  circle style="background-color: #C0C4CC;color: #000;width: 70px;height: 50px;">禁用</el-button>
      </span>
  </div>
  <div style="height: 50px;">
    
  </div>
  <div v-for="(index,inst) in datalist.length" :key="inst" style="padding: 10px;">
    <h1 style="border-bottom: 1px dashed silver; padding: 5px;;height: 52px;">
      <span v-if="inst==0">外协区</span>
      <span v-else-if="inst==1">托盘叠放区</span>
      <!-- <span v-else-if="inst==1">上料区</span>
      <span v-else-if="inst==2">下料区</span>
      <span v-else-if="inst==3">外协区</span>
      <span v-else-if="inst==4">叠盘区</span> -->
      <span v-else>{{inst}}库区</span>
    </h1>
  <div class="table-container">
    <div class="scrollable-table">
      <table class="one_tal" >
        <tr 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.bindSN !== '' && items.stationType!==null && items.bindSN !== null">
                <div>库位编号:{{ items.stationCode }}</div>
                <div>物料类型(图号): {{ items.stationType }}</div>
                <div>炉号: {{ items.heatNumber }}</div>
                <div>车轮SN号:{{ items.bindSN }}</div>
                <div>钢坯号:{{ items.billetID }}</div>
              </template>
              <template #content v-else-if="items.area==3 && items.tray_status=='EmptyTray'">
                <div v-if="item.tray_type==SmallTray">小托盘</div>
                <div v-else>大托盘</div>
                <div>数量:{{ items.quantity }}</div>
              </template>
              <template #content v-else>
                <div>目前暂无信息</div>
              </template>
              <template #content v-if="items.area==11">
                <div>小托盘</div>
                <div>数量:{{ items.quantity }}</div>
              </template>
              <template #content v-if="items.area==10">
                <div>大托盘</div>
                <div>数量:{{ items.quantity }}</div>
              </template>
              <template #content v-if="items.area==12">
                <div v-if="item.tray_type==SmallTray">小托盘</div>
                <div v-else>大托盘</div>
                <div>数量:{{ items.quantity }}</div>
              </template>
              
              <div>{{ items.stationCode}}</div>
            </el-tooltip>
          </td>
        </tr>
      </table>
    </div>
  </div>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      visible: false,
      datalist:[],
    };
  },
  mounted() {
    setInterval(() => {
    this.selList(); // 使用箭头函数绑定this
  }, 3000);
  },
  methods: {
    
    selList(){
      this.loading=true
      this.http.post("/api/dt_stationinfo/dt_stationinfolist").then(x => {
        this.datalist = x.data;
                  })
      .catch(error => {
        console.error('请求出错:', error);
      });
    },
    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';
      }
      }
      
    }
 
  },
  computed: {
    filteredItems() {
      return (itemList, line) => {
        return itemList.filter(item => item.line === line);
      };
    }
  }
};
</script>
 
<style scoped>
.table-container {
  overflow-x: auto;
}
 
.scrollable-table {
  width: 100%; 
}
 
.one_tal {
  margin-top: 10px;
  padding: 5px;
  white-space: nowrap;
  border-spacing: 10px;
  padding-right: 500px;
}
.one_tal tr{
 
  margin-top: 10px; 
  margin-bottom: 10px;
}
.one_tal td {
  width: 200px; 
  height: 40px;
  background-color: rgb(36, 227, 241);
  text-align: center;
  border-radius: 10px;
}
.table-container::-webkit-scrollbar {
  width: 1px;
  height: 15px;
}
 
.table-container::-webkit-scrollbar-track {
  background: transparent; 
}
 
.table-container::-webkit-scrollbar-thumb {
  background-color: #ccc; 
}
 
.fixed-row {
  position: fixed;
  width: 100%; /* 让行的宽度占满整个视窗 */
  background-color: #fff; /* 如果需要,设置背景色 */
  z-index: 3; /* 确保固定行在其他内容之上 */
}
</style>