Browse Source

消息接口

master
lucky 5 years ago
parent
commit
43250d5c6d
  1. 4
      rest/project.http
  2. 37
      src/components/LoadCells/LoadCells.vue
  3. 7
      src/components/Map/Map.js
  4. 15
      src/components/Panel/Panel.vue
  5. 8
      src/components/RFID/RFID.styl
  6. 9
      src/components/RFID/RFID.vue
  7. 3
      src/components/Sensor/Sensor.js
  8. 17
      src/mixins/socket.js

4
rest/project.http

@ -65,8 +65,8 @@ POST {{record}}/debug/record
{ {
"param":{ "param":{
"authId": "1", "authId": "1",
"type": "2", "type": "10",
"value":"70000", "value":"3000",
"time":"1607937529000" "time":"1607937529000"
} }
} }

37
src/components/LoadCells/LoadCells.vue

@ -17,29 +17,6 @@
<span>{{ item.number[a-1] ? item.number[a-1] : 0 }}</span> <span>{{ item.number[a-1] ? item.number[a-1] : 0 }}</span>
</div> </div>
</div> </div>
<!-- <div class="number flex-1">
<div class="num_item">
<span>{{ item.number.split('')[0] }}</span>
</div>
<div class="num_item">
<span>{{ item.number.split('')[1] }}</span>
</div>
<div :style="item.number.split('')[2] === '.' ? 'padding-right:5%' : '' " class="num_item">
<span>{{ item.number.split('')[2] }}</span>
</div>
<div class="num_item">
<span>{{ item.number.split('')[3] }}</span>
</div>
<div class="num_item">
<span>{{ item.number.split('')[4] }}</span>
</div>
<div class="num_item">
<span>{{ item.number.split('')[5] }}</span>
</div>
<div class="num_item">
<span>{{ item.number.split('')[6] }}</span>
</div>
</div>-->
</div> </div>
</div> </div>
</template> </template>
@ -64,7 +41,7 @@ export default {
{ {
id: 3, id: 3,
name: '称重传感器3', name: '称重传感器3',
number: ['0', '0', '.', '0', '0', '0', '0'], number: ['0', '.', '0'],
}, },
{ {
id: 4, id: 4,
@ -75,15 +52,15 @@ export default {
}; };
}, },
computed: mapState('home', ['weighSensor1', 'weighSensor2', 'weighSensor3', 'weighSensor4']), computed: mapState('messages', ['weighSensor1', 'weighSensor2', 'weighSensor3', 'weighSensor4']),
watch: { watch: {
weighSensor1(value) { weighSensor1: {
console.log('value: ', value); handle(value) {
if (value) { console.log('weighSensor1: ', value);
this.lists[0].number = value.split(''); this.lists[0].number = value.split('');
console.log('this.lists: ', this.lists); },
} deep: true,
}, },
weighSensor2(value) { weighSensor2(value) {
if (value) { if (value) {

7
src/components/Map/Map.js

@ -8,7 +8,7 @@ var option = {
regionHeight: 6, //地图高度 regionHeight: 6, //地图高度
map: '山西', map: '山西',
viewControl: { viewControl: {
distance: 350, //地图视角 控制初始大小 distance: 300, //地图视角 控制初始大小
rotateSensitivity: 1, //禁止旋转 rotateSensitivity: 1, //禁止旋转
zoomSensitivity: 1, //禁止缩放 zoomSensitivity: 1, //禁止缩放
}, },
@ -44,10 +44,11 @@ var option = {
// regions: [ // regions: [
// { // {
// name: '运城', // name: '运城',
// selected: true,
// itemStyle: { // itemStyle: {
// borderWidth: 3, // borderWidth: 3,
// areaColor: 'red', // areaColor: '#f00',
// color: 'red', // color: '#f00',
// }, // },
// }, // },
// ], // ],

15
src/components/Panel/Panel.vue

@ -28,9 +28,20 @@
<a-icon class="down-icon" type="caret-down" /> <a-icon class="down-icon" type="caret-down" />
</span> </span>
</div> </div>
<a-progress :percent="percent" :show-info="false" :stroke-color="strokeColor" :stroke-width="strokeWidth" status="active" /> <a-progress
:percent="percent"
:show-info="false"
:stroke-color="strokeColor"
:stroke-width="strokeWidth"
status="active"
/>
<div class="flex-1" style="width: 106%; margin-left: -3%"> <div class="flex-1" style="width: 106%; margin-left: -3%">
<div class="flex-1" style="justify-content: center" v-for="(item, index) in lists" :key="index">{{ item }}</div> <div
:key="index"
class="flex-1"
style="justify-content: center"
v-for="(item, index) in lists"
>{{ item }}</div>
</div> </div>
</div> </div>
</div> </div>

8
src/components/RFID/RFID.styl

@ -84,15 +84,15 @@
.list { .list {
width: 4rem; width: 4rem;
height: 3.4rem; height: 3.4rem;
line-height: 3.4rem; }
font-size: 12px;
.list span {
width: 90%;
} }
.active { .active {
width: 4rem; width: 4rem;
height: 4rem; height: 4rem;
line-height: 4rem;
font-size: 12px;
} }
.list1 { .list1 {

9
src/components/RFID/RFID.vue

@ -42,7 +42,7 @@ export default {
}, },
computed: { computed: {
...mapState('home', ['rfidMessage']), ...mapState('messages', ['rfidMessage']),
newArr() { newArr() {
const arr = this.group(this.lists, 10); const arr = this.group(this.lists, 10);
return arr; return arr;
@ -50,12 +50,13 @@ export default {
}, },
watch: { watch: {
weighSensor1(value) { weighSensor1: {
handle(value) {
// console.log('value: ', value); // console.log('value: ', value);
// if (value) {
// this.lists[0].number = value.split(''); // this.lists[0].number = value.split('');
// console.log('this.lists: ', this.lists); // console.log('this.lists: ', this.lists);
// } },
deep: true,
}, },
}, },

3
src/components/Sensor/Sensor.js

@ -10,6 +10,8 @@ const mixin = {
computed: { computed: {
...mapState('messages', ['vibrationSensor']), ...mapState('messages', ['vibrationSensor']),
option() { option() {
// const that = this;
console.log('series1', this.series1, this.vibrationSensor);
return { return {
legend: { legend: {
x: 'center', x: 'center',
@ -49,6 +51,7 @@ const mixin = {
show: false, show: false,
}, },
}, },
series: [ series: [
{ {
name: '传感器1', name: '传感器1',

17
src/mixins/socket.js

@ -56,11 +56,13 @@ const mixin = {
*/ */
handleMessagesData(item) { handleMessagesData(item) {
const data = JSON.parse(item.data); const data = JSON.parse(item.data);
console.log('data: ', data.data);
switch (data.type) { switch (data.type) {
case 'ChannelStatus': // 认证消息 case 'ChannelStatus': // 认证消息
this.handleAuthMessage(data); this.handleAuthMessage(data);
break; break;
case 'CarRecord': // 平车
if (!data.data.type) return;
switch (data.data.type) {
case 0: // 开始 case 0: // 开始
// 收到开始消息 // 收到开始消息
this.setStartMessages(true); this.setStartMessages(true);
@ -87,19 +89,26 @@ const mixin = {
break; break;
case 7: // 震动传感器 case 7: // 震动传感器
this.messagesAddVibrationSensor(data.data); this.messagesAddVibrationSensor(data.data);
console.log('RFID.data: ', data.data);
break; break;
case 8: // 溶栓剂量(总量) case 8: // 溶栓剂量(总量)
this.messagesAddThrombolyticDose(data.data); this.messagesAddThrombolyticDose(data.data.value);
break; break;
case 9: // 团注剂量 case 9: // 团注剂量
this.messagesAddBolusDose(data.data); this.messagesAddBolusDose(data.data.value);
break; break;
case 10: // 维持剂量 case 10: // 维持剂量
this.messagesAddMaintenanceDose(data.data); this.messagesAddMaintenanceDose(data.data.value);
break; break;
default: default:
break; break;
} }
break;
default:
break;
}
}, },
/** /**

Loading…
Cancel
Save