Browse Source

RFID

master
lucky 5 years ago
parent
commit
27e5e66df5
  1. 1
      public/index.html
  2. 7
      src/common/index.styl
  3. 13
      src/components/FastEd/FastEd.vue
  4. 7
      src/components/LoadCells/LoadCells.vue
  5. 32
      src/components/Panel/Panel.vue
  6. 98
      src/components/RFID/RFID++.vue
  7. 142
      src/components/RFID/RFID.styl
  8. 268
      src/components/RFID/RFID.vue
  9. 2
      src/plugins/ant-design-vue.js
  10. 54
      src/views/Index/Index.vue

1
public/index.html

@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>

7
src/common/index.styl

@ -96,17 +96,18 @@
.box-top{
width:100%;
height: 10px;
background: url('assets/box-top.png') repeat fixed center;
background: url('assets/box-top.png') no-repeat center;
background-size: 100% 100%;
text-align: center;
}
.box-top span{
display: inline-block;
position: relative;
top: -11px;
top: -10px;
text-shadow: rgb(0, 117, 255) 0px 0px 8px;
font-family: SourceHanSansCN-Bold;
font-size: 20px;
font-size: 1.2rem;
font-weight: bold;
text-align: center;
letter-spacing: 0px;

13
src/components/FastEd/FastEd.vue

@ -1,15 +1,20 @@
<template>
<div class="fast-box">
<div style="flex: 1" class="bg-box">
<div v-for="a in 4" :key="a"></div>
<div class="bg-box" style="flex: 1">
<div :key="a" v-for="a in 4"></div>
</div>
<div class="con-box" id="bobaodiv">
<div v-for="item in dataList" :key="item.a" style="height: 25%" class="flex-1 flex-row">
<div :key="item.a" class="flex-1 flex-row" style="height: 25%" v-for="item in dataList">
<div class="flex-1">{{ item.a }}</div>
<div class="flex-1">{{ item.b }}</div>
<div class="flex-1">{{ item.c }}</div>
</div>
<div v-for="item in dataList" :key="item.b" style="height: 25%" class="flex-1 flex-row">
<div
:key="index"
class="flex-1 flex-row"
style="height: 25%"
v-for="(item,index) in dataList"
>
<div class="flex-1">{{ item.a }}</div>
<div class="flex-1">{{ item.b }}</div>
<div class="flex-1">{{ item.c }}</div>

7
src/components/LoadCells/LoadCells.vue

@ -92,12 +92,15 @@ export default {
.number .num_item {
background: url('~assets/cz-bg.png') no-repeat bottom left;
background-size: auto 90%;
position: relative;
top: -6px;
left: 2px;
}
.number span {
display: inline-block;
position: relative;
top: -10px;
top: -8px;
left: 2px;
font-size: 38px;
font-style: oblique;
@ -113,7 +116,7 @@ export default {
}
.number span {
top: -10px;
top: -8px;
font-size: 23px;
letter-spacing: 16px;
}

32
src/components/Panel/Panel.vue

@ -1,7 +1,7 @@
<template>
<div>
<div class="panel-box">
<div class="d-flex">
<div class="d-flex panel-box-1">
<div class="flex-1">
<span class="panel-tips">患者体重kg</span>
<span class="panel-con">60.00</span>
@ -11,7 +11,7 @@
<span class="panel-con">55.00</span>
</div>
</div>
<div class="d-flex">
<div class="d-flex panel-box-1">
<div class="flex-1">
<span class="panel-tips">团注剂量mg</span>
<span class="panel-con">5.40</span>
@ -77,28 +77,37 @@ export default {
width: 100%;
padding: 10px;
.panel-box-1 {
padding: 0 3rem;
}
div {
height: 33%;
align-items: center;
position: relative;
}
span {
flex: 1;
text-align: center;
position: absolute;
left: 0;
}
}
.panel-tips {
font-size: 20px;
font-size: 1.2rem;
color: #ccc;
}
.panel-con {
font-size: 48px;
font-size: 3rem;
font-weight: 600;
text-shadow: #0075ff 0px 0px 8px;
letter-spacing: 8px;
transform: rotateX(0deg) rotateY(0deg) scaleX(1) scaleY(0.8) translate(0px, 0px);
left: auto !important;
right: 3rem;
}
.tips {
@ -116,4 +125,19 @@ export default {
bottom: -8px;
left: -10%;
}
@media (max-width: 1500px) {
.panel-box .panel-box-1 {
padding: 0 2rem;
}
.panel-tips {
font-size: 1rem;
}
.panel-con {
font-size: 2rem;
right: 1rem;
}
}
</style>

98
src/components/RFID/RFID++.vue

@ -1,98 +0,0 @@
<template>
<div class="flex-1 flex-column rfid" id="rfid">
<!-- <div class="box" id="box">
<span>专科护士</span>
</div>
<div class="box active">
<span>专科护士</span>
</div>-->
<div :key="index" class="list" v-for="(list,index) in lists">
<span>{{ list.name }}</span>
</div>
</div>
</template>
<script>
export default {
name: 'RFID',
data() {
return {
lists: [
{ top: '10px', left: '10px', name: '专科护士' },
{ top: '50px', left: '50px', name: '专科医生' },
{ top: '70px', left: '70px', name: '采血推车' },
{ top: '90px', left: '90px', name: '心电图推车' },
{ top: '100px', left: '100px', name: '介入室' },
{ top: '80px', left: '80px', name: 'CT室' },
{ top: '60px', left: '60px', name: '急救室' },
{ top: '40px', left: '40px', name: '急诊医生' },
],
};
},
mounted() {
console.log('开始');
//
let wrap = document.getElementById('rfid');
// let box = document.getElementById('box');
let box = document.getElementsByClassName('list');
console.log('box: ', box);
//
//
let a = 1;
let b = 1;
//
let w = wrap.offsetWidth - box.offsetWidth;
let h = wrap.offsetHeight - box.offsetHeight;
setInterval(function() {
// left
let l = box.offsetLeft;
if (l == w || l == 0) {
// a
a *= -1;
}
// 10ms1px
// a
box.style.left = l + a + 'px';
console.log('box.style.left: ', box.style.left);
//
let t = box.offsetTop;
if (t == h || t == 0) {
b *= -1;
}
box.style.top = t + b + 'px';
}, 100);
},
methods: {},
};
</script>
<style lang="stylus" scoped >
.rfid {
position: relative;
}
.list {
width: 69px;
height: 69px;
line-height: 69px;
text-align: center;
font-size: 12px;
color: #C8CED5;
background: url('~assets/rfid-bg.png') no-repeat center;
position: absolute;
top: 100px;
left: 200px;
}
.active {
width: 86px;
height: 86px;
line-height: 86px;
font-size: 12px;
background: url('~assets/rfid-bg-active.png') no-repeat center;
}
</style>

142
src/components/RFID/RFID.styl

@ -0,0 +1,142 @@
.rfid {
position: relative;
}
.list {
width: 4.4rem;
height: 4.4rem;
line-height: 4.4rem;
text-align: center;
font-size: 12px;
color: #C8CED5;
background: url('~assets/rfid-bg.png') no-repeat center;
background-size: contain;
position: absolute;
}
.active {
width: 5rem;
height: 5rem;
line-height: 5rem;
font-size: 12px;
background: url('~assets/rfid-bg-active.png') no-repeat center;
background-size: contain;
}
.list1 {
top: 0.5rem;
left: 4rem;
}
.list2 {
top: 0.5rem;
left: 11.5rem;
}
.list3 {
top: 0.5rem;
left: 19rem;
}
.list4 {
top: 5.5rem;
left: 0.5rem;
}
.list5 {
top: 5.5rem;
left: 8rem;
}
.list6 {
top: 5.5rem;
left: 15.5rem;
}
.list7 {
top: 5.5rem;
left: 23rem;
}
.list8 {
top: 10.5rem;
left: 4rem;
}
.list9 {
top: 10.5rem;
left: 11.5rem;
}
.list10 {
top: 10.5rem;
left: 19rem;
}
@media (max-width: 1500px){
.list {
width: 4rem;
height: 3.4rem;
line-height: 3.4rem;
font-size: 12px;
}
.active {
width: 4rem;
height: 4rem;
line-height: 4rem;
font-size: 12px;
}
.list1 {
top: 0.5rem;
left: 3rem;
}
.list2 {
top: 0.5rem;
left: 8rem;
}
.list3 {
top: 0.5rem;
left: 13rem;
}
.list4 {
top: 3.5rem;
left: 0.5rem;
}
.list5 {
top: 3.5rem;
left: 5.5rem;
}
.list6 {
top: 3.5rem;
left: 10.5rem;
}
.list7 {
top: 3.5rem;
left: 15.5rem;
}
.list8 {
top: 6.5rem;
left: 3rem;
}
.list9 {
top: 6.5rem;
left: 8rem;
}
.list10 {
top: 6.5rem;
left: 13rem;
}
}

268
src/components/RFID/RFID.vue

@ -1,12 +1,15 @@
<template>
<div class="flex-1 flex-column rfid" id="rfid">
<!-- <div :key="index" class="list" v-for="(list,index) in lists">
<span>{{ list.name }}</span>
<div class="flex-1 flex-column rfid">
<div :key="i+1" v-for="(lists,i) in newArr" v-show="i===num">
<div
:class="`list${index+1} ${item.active ? 'active' : ''}`"
:key="index"
class="list"
v-for="(item,index) in lists"
>
<span>{{ item.name }}</span>
</div>
</div>
<div class="list active">
<span>专科护士</span>
</div>-->
<div id="wrap"></div>
</div>
</template>
<script>
@ -15,218 +18,73 @@ export default {
data() {
return {
lists: [
{ top: '10px', left: '10px', name: '专科护士' },
{ top: '50px', left: '50px', name: '专科医生' },
{ top: '70px', left: '70px', name: '采血推车' },
{ top: '90px', left: '90px', name: '心电图推车' },
{ top: '100px', left: '100px', name: '介入室' },
{ top: '80px', left: '80px', name: 'CT室' },
{ top: '60px', left: '60px', name: '急救室' },
{ top: '40px', left: '40px', name: '急诊医生' },
{ id: 1, active: false, name: '专科护士' },
{ id: 2, active: false, name: '专科医生' },
{ id: 3, active: false, name: '采血推车' },
{ id: 4, active: false, name: '心电图推车' },
{ id: 5, active: false, name: '介入室' },
{ id: 6, active: false, name: 'CT室' },
{ id: 7, active: false, name: '急救室' },
{ id: 8, active: false, name: '急诊医生' },
{ id: 9, active: false, name: '专科护士' },
{ id: 10, active: false, name: '专科医生' },
{ id: 11, active: false, name: '采血推车' },
{ id: 12, active: false, name: '心电图推车' },
{ id: 13, active: false, name: '介入室' },
{ id: 14, active: false, name: 'CT室' },
{ id: 15, active: false, name: '急救室' },
{ id: 16, active: false, name: '急诊医生' },
],
picSrc: '~assets/rfid-bg.png',
num: 0, //div
};
},
mounted() {
let wrap = document.getElementById('wrap');
let lists = this.lists;
/**
* 生成并返回一个从m到n全区间的随机数
* @param {Object} m
* @param {Object} n
*/
function randomNum(m, n) {
return Math.floor(Math.random() * (n - m + 1) + m);
}
/**
* 生成一个随机颜色并返回rgb字符串值
*/
function randomColor() {
var r = randomNum(0, 255);
var g = randomNum(0, 255);
var b = randomNum(0, 255);
return 'rgb(' + r + ',' + g + ',' + b + ')';
}
//wrapDiv
var wrapDiv = document.getElementById('wrap'); //
var balls = [];
//
function createBalls() {
for (var i = 0; lists.length > i; i++) {
var ball = document.createElement('div'); //XY
ball.x = randomNum(0, 120);
ball.y = randomNum(0, 70); //
ball.speed = randomNum(1, 2); //
if (Math.random() - 0.5 > 0) {
ball.xflag = true;
} else {
ball.xflag = false;
}
if (Math.random() - 0.5 > 0) {
ball.yflag = true;
} else {
ball.yflag = false;
}
ball.innerHTML = lists[i].name; //wrapDiv
wrapDiv.appendChild(ball); //
// ball.classList = 'box';
ball.style.backgroundColor = randomColor();
// ball.style =
// 'width: 69px;height: 69px;line-height: 69px;text-align: center;font-size: 12px; color: #C8CED5; position: absolute;top: 100px; left: 200px;';
balls.push(ball);
}
}
createBalls();
computed: {
newArr() {
const arr = this.group(this.lists, 10);
return arr;
},
},
//
function moveBalls(ballObj) {
setInterval(function() {
ballObj.style.top = ballObj.y + 'px';
ballObj.style.left = ballObj.x + 'px'; //
if (ballObj.yflag) {
//
ballObj.y += ballObj.speed;
if (ballObj.y >= wrap.offsetHeight - ballObj.offsetHeight) {
ballObj.y = wrap.offsetHeight - ballObj.offsetHeight;
ballObj.yflag = false;
}
} else {
//
ballObj.y -= ballObj.speed;
if (ballObj.y <= 0) {
ballObj.y = 0;
ballObj.yflag = true;
}
}
if (ballObj.xflag) {
//
ballObj.x += ballObj.speed;
if (ballObj.x >= wrap.offsetWidth - ballObj.offsetWidth) {
ballObj.x = wrap.offsetWidth - ballObj.offsetWidth;
ballObj.xflag = false;
}
} else {
//
ballObj.x -= ballObj.speed;
if (ballObj.x <= 0) {
ballObj.x = 0;
ballObj.xflag = true;
}
}
crash(ballObj);
}, 100);
mounted() {
let i = 0;
var t = setInterval(() => {
this.lists.forEach((element, j) => {
if (j === i) {
element.active = true;
//
for (let a = 0; a < this.newArr.length; a++) {
const arr = this.newArr[a];
const item = arr.find(item => item.id === element.id);
if (item) {
this.num = a;
}
var x1, y1, x2, y2;
//
function crash(ballObj) {
//XY
x1 = ballObj.x;
y1 = ballObj.y;
for (var i = 0; i < balls.length; i++) {
//
if (ballObj != balls[i]) {
x2 = balls[i].x;
y2 = balls[i].y; //
if (Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + 800 <= Math.pow(ballObj.offsetWidth + balls[i].offsetWidth, 2)) {
//
if (ballObj.x < balls[i].x) {
if (ballObj.y < balls[i].y) {
//
ballObj.yflag = false;
ballObj.xflag = false;
} else if (ballObj.y > balls[i].y) {
//
ballObj.xflag = false;
ballObj.yflag = true;
} else {
//
ballObj.xflag = false;
}
} else if (ballObj.x > balls[i].x) {
if (ballObj.y < balls[i].y) {
//
ballObj.yflag = false;
ballObj.xflag = true;
} else if (ballObj.y > balls[i].y) {
//
ballObj.xflag = true;
ballObj.yflag = true;
} else {
//
ballObj.xflag = true;
}
} else if (ballObj.y > balls[i].y) {
//
ballObj.yflag = true;
} else if (ballObj.y < balls[i].y) {
//
ballObj.yflag = false;
element.active = false;
}
});
i++;
//
if (i === this.lists.length) {
i = 0;
}
}
}
}
for (var i = 0; i < balls.length; i++) {
//,
moveBalls(balls[i]);
}
}, 1500);
},
methods: {},
methods: {
group(array, subGroupLength) {
let index = 0;
let newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, (index += subGroupLength)));
}
return newArray;
},
},
};
</script>
<style lang="stylus" scoped >
#wrap {
height: 100%;
width: 100%;
/* 小球设置相对定位 */
position: relative;
margin: 0 auto;
overflow: hidden;
}
// p.box {
// width: 40px;
// height: 40px;
// border-radius: 50%;
// background-color: red;
// position: absolute;
// top: 0;
// left: 0;
// color: white;
// font-size: 25px;
// text-align: center;
// line-height: 40px;
// }
.rfid {
position: relative;
}
.list {
width: 69px;
height: 69px;
line-height: 69px;
text-align: center;
font-size: 12px;
color: #C8CED5;
background: url('~assets/rfid-bg.png') no-repeat center;
position: absolute;
left: 200px;
top: 100px;
}
.active {
width: 86px;
height: 86px;
line-height: 86px;
font-size: 12px;
background: url('~assets/rfid-bg-active.png') no-repeat center;
}
@import './RFID.styl';
</style>

2
src/plugins/ant-design-vue.js

@ -27,6 +27,7 @@ import {
Checkbox,
BackTop,
Progress,
carousel,
} from 'ant-design-vue';
import { ConfigProvider } from 'ant-design-vue';
Vue.component(ConfigProvider.name, ConfigProvider);
@ -55,6 +56,7 @@ Vue.use(Timeline);
Vue.use(Checkbox);
Vue.use(BackTop);
Vue.use(Progress);
Vue.use(carousel);
Vue.prototype.$message = message;
Vue.prototype.$notification = notification;

54
src/views/Index/Index.vue

@ -23,6 +23,7 @@
<div class="bg-bottom">
<img class="pic" src="~assets/bg-bottom.png" />
</div>
<div class="time">{{ nowTime }}</div>
<!--内容区-->
<div class="content d-flex flex-column">
<!-- 第一行 -->
@ -49,6 +50,7 @@
</div>
</div>
<div class="flex-2 ma-2">
<!-- <iframe src="https://www.thingjs.com/pp/6dab0a018283ef357a85684c"></iframe> -->
<div class="bg s-pic"></div>
</div>
<div class="flex-1 ma-2">
@ -127,9 +129,57 @@ export default {
name: 'Index',
components: { Statistics, Duration, Sensor, LoadCells, RFID, FastEd, Panel },
data() {
return {};
return {
nowTime: new Date(),
};
},
mounted() {
this.nowTimes();
},
methods: {
//
timeFormate(timeStamp) {
let data = new Date(timeStamp);
let year = data.getFullYear();
let month = data.getMonth() + 1 < 10 ? '0' + (data.getMonth() + 1) : data.getMonth() + 1;
let date = data.getDate() < 10 ? '0' + data.getDate() : data.getDate();
let hh = data.getHours() < 10 ? '0' + data.getHours() : data.getHours();
let mm = data.getMinutes() < 10 ? '0' + data.getMinutes() : data.getMinutes();
let ss = data.getSeconds() < 10 ? '0' + data.getSeconds() : data.getSeconds();
this.nowTime = year + '年' + month + '月' + date + '日' + ' ' + hh + ':' + mm + ':' + ss;
},
nowTimes() {
this.timeFormate(new Date());
setInterval(this.nowTimes, 1000);
this.clear();
},
clear() {
clearInterval(this.nowTimes);
this.nowTimes = null;
},
},
};
</script>
<style lang="stylus" scoped></style>
<style lang="stylus" scoped>
.time {
position: absolute;
top: 2.5rem;
left: 8rem;
font-family: SourceHanSansCN-Medium;
font-size: 1.5rem;
color: #fff;
text-align: left;
transform: rotateX(0deg) rotateY(0deg) scaleX(1) scaleY(0.8) translate(0px, 0px);
}
@media (max-width: 1500px) {
.time {
top: 2rem;
left: 6rem;
font-size: 1rem;
}
}
</style>

Loading…
Cancel
Save