| | |
| | | <!-- |
| | | * @Date: 2024-01-13 20:46:33 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-01-28 14:08:41 |
| | | * @LastEditTime: 2024-03-11 19:20:55 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/device.vue |
| | | --> |
| | | <template> |
| | | <div class="device-item"> |
| | | <el-checkbox v-show="canconcern" class="care" v-model="concern" @change="change"></el-checkbox> |
| | | <p>{{ machineName }}</p> |
| | | <div class="device-item-box"> |
| | | <div class="device-item-box" @click="toDetail"> |
| | | <div class="img"> |
| | | <span class="img-status" v-if="item.status === 'STOP'">停机</span> |
| | | <span class="img-status run" v-if="item.status === 'RUN'">运行</span> |
| | |
| | | data() { |
| | | return { |
| | | devicePng, |
| | | scale: 1, |
| | | concern: false, |
| | | item: {} |
| | | } |
| | |
| | | return this.info.cycleCount || 0 |
| | | }, |
| | | machineName() { |
| | | debugger |
| | | let machineName = '' |
| | | if (this.info.machineName) return this.info.machineName |
| | | if (this.plantDeviceList.length > 0) { |
| | |
| | | return '' |
| | | } |
| | | }, |
| | | mounted () { |
| | | this.concern = !!this.info.concern |
| | | console.log(this.$el.getBoundingClientRect().width,'/////',this.$el.getBoundingClientRect().width / 200) |
| | | this.$nextTick(() => { |
| | | //if (this.$el.getBoundingClientRect().width < 400) { |
| | | //this.$el.querySelector('.device-item-box').style = `transform:scale(${this.$el.getBoundingClientRect().width / 360})` |
| | | //} |
| | | }) |
| | | |
| | | |
| | | |
| | | }, |
| | | methods: { |
| | | toDetail () { |
| | | this.$emit('toDetail') |
| | | }, |
| | | change(val) { |
| | | console.log(val) |
| | | getRequest('machineConcern', { concern: val ? 1 : 0, id: this.id }).then(res => { |
| | |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .device-item { |
| | | width: 394px; |
| | | height: 321px; |
| | | width: 100%; |
| | | height: 100%; |
| | | max-width: 394px; |
| | | max-height: 394px; |
| | | border-radius: 10px; |
| | | border: 1px solid #3C4249; |
| | | padding: 20px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | position: relative; |
| | | |
| | | p { |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |
| | | } |
| | | .care { |
| | | position: absolute; |
| | | right: 5px; |
| | |
| | | } |
| | | |
| | | &>div.device-item-box { |
| | | min-width: 100px; |
| | | flex: 1 1 auto; |
| | | margin-top: 20px; |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | |
| | | overflow: hidden; |
| | | |
| | | .img { |
| | | width: 50%; |
| | | height: 100%; |
| | | // min-width: 100px; |
| | | width: 60%; |
| | | height: 150px; |
| | | border: 1px solid #444C55; |
| | | border-radius: 10px; |
| | | position: relative; |
| | | |
| | | flex: 0 0 auto; |
| | | overflow: hidden; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | .img-status { |
| | | position: absolute; |
| | | font-size: 12px; |
| | |
| | | } |
| | | |
| | | img { |
| | | position: absolute; |
| | | top: 50%; |
| | | left: 50%; |
| | | transform: translate(-50%, -50%); |
| | | // position: absolute; |
| | | // top: 50%; |
| | | // left: 50%; |
| | | // transform: translate(-50%, -50%); |
| | | height: auto; |
| | | width: 80%; |
| | | } |
| | | } |
| | |
| | | align-items: center; |
| | | |
| | | &>div { |
| | | margin-left: 20px; |
| | | margin-left: 10px; |
| | | ; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | img { |
| | | width: 40px; |
| | | height: 40px; |
| | | width: 25px; |
| | | height: 25px; |
| | | } |
| | | } |
| | | } |