Commit 1fafb847 authored by Administrator's avatar Administrator

实时监测

parent 627db3dd
Pipeline #87 failed with stages
...@@ -34,7 +34,8 @@ class SwooleCommandController extends Controller ...@@ -34,7 +34,8 @@ class SwooleCommandController extends Controller
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid') ->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id') ->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id') ->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name') ->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->orderBy('device.id', 'desc') ->orderBy('device.id', 'desc')
->get()->toArray(); ->get()->toArray();
$count = $databadevice $count = $databadevice
...@@ -51,7 +52,8 @@ class SwooleCommandController extends Controller ...@@ -51,7 +52,8 @@ class SwooleCommandController extends Controller
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid') ->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id') ->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id') ->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name') ->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->orderBy('device.id', 'desc') ->orderBy('device.id', 'desc')
->get()->toArray(); ->get()->toArray();
$count = $databadevice $count = $databadevice
......
...@@ -137,7 +137,7 @@ class SwooleCommandMeTcpController extends Controller ...@@ -137,7 +137,7 @@ class SwooleCommandMeTcpController extends Controller
} }
$updavice = DB::table('device') $updavice = DB::table('device')
->where('devicenum', '=', $davicedata[0]) ->where('devicenum', '=', $davicedata[0])
->update(['devicepolice' => $davicedata[1], 'nd' => $davicedata[2]]); ->update(['devicepolice' => $davicedata[1], 'nd' => $davicedata[2], 'update_time' => time()]);
} }
} }
......
...@@ -491,7 +491,8 @@ class DevicesController extends Controller ...@@ -491,7 +491,8 @@ class DevicesController extends Controller
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid') ->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id') ->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id') ->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name') ->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->orderBy('device.id', 'desc') ->orderBy('device.id', 'desc')
->offset($pagenNum) ->offset($pagenNum)
->limit($limit) ->limit($limit)
......
...@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; ...@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
class CreateDeviceTable extends Migration class AddUpdateTimeToDeviceTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
...@@ -13,9 +13,8 @@ class CreateDeviceTable extends Migration ...@@ -13,9 +13,8 @@ class CreateDeviceTable extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('device', function (Blueprint $table) { Schema::table('device', function (Blueprint $table) {
$table->id(); $table->integer('update_time')->default(null)->comment('最后更新时间');
$table->timestamps();
}); });
} }
...@@ -26,6 +25,8 @@ class CreateDeviceTable extends Migration ...@@ -26,6 +25,8 @@ class CreateDeviceTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::dropIfExists('device'); Schema::table('device', function (Blueprint $table) {
$table->dropColumn('update_time');
});
} }
} }
<template> <template>
<div class="app-container"> <div class="app-container">
<el-table :key="tableKey" v-loading="loading" :data="device" border fit highlight-current-rows> <el-table :key="tableKey" v-loading="loading" :data="device" border fit highlight-current-rows>
<el-table-column align="center" label="id" width="80"> <el-table-column align="center" label="ID" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.id }}</span> <span>{{ scope.row.id }}</span>
</template> </template>
...@@ -11,44 +11,34 @@ ...@@ -11,44 +11,34 @@
<span @click="handleCopy(scope.row.devicenum,$event)">{{ scope.row.devicenum }}</span> <span @click="handleCopy(scope.row.devicenum,$event)">{{ scope.row.devicenum }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备类型" width="150">
<template slot-scope="scope">
<span>{{ scope.row.tname }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="介质状态" width="170">
<template slot-scope="scope">
<span>{{ scope.row.gas }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备名称" width="170"> <el-table-column align="center" label="设备名称" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.username }}</span> <span>{{ scope.row.username }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="浓度" width="170"> <el-table-column align="center" label="设备详情">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.nd }}</span> <span>{{ scope.row.deviceinfo }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="是否已删除设备" width="170"> <el-table-column align="center" label="设备类型" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{color:( scope.row.delete==1 ? '#F56C6C' : '#67C23A' )}">{{ scope.row.delete ==1 ? '设备已被丢弃废纸篓' : '设备正常' }}</span> <span>{{ scope.row.tname }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备备注" width="170"> <el-table-column align="center" label="检测介质" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.deviceremark }}</span> <span>{{ scope.row.gas }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备详情" width="170"> <el-table-column align="center" label="检测值" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.deviceinfo }}</span> <span>{{ scope.row.nd }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="创建时间" width="170"> <el-table-column align="center" label="单位" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.deviceaddtime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span> <span>{{ scope.row.danwei }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备实时状态" width="170"> <el-table-column align="center" label="设备实时状态" width="170">
...@@ -64,6 +54,11 @@ ...@@ -64,6 +54,11 @@
<span v-if="scope.row.status_name!='正常' " :style="{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">{{ scope.row.status_name=='正常' ? '正常' : '设备异常' }}</span> <span v-if="scope.row.status_name!='正常' " :style="{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">{{ scope.row.status_name=='正常' ? '正常' : '设备异常' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="最后更新时间" width="170">
<template slot-scope="scope">
<span>{{ scope.row.update_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="devicelist" /> <pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="devicelist" />
</div> </div>
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-table :key="tableKey" v-loading="loading" :data="device" border fit highlight-current-rows> <el-table :key="tableKey" v-loading="loading" :data="device" border fit highlight-current-rows>
<el-table-column align="center" label="id" width="80"> <el-table-column align="center" label="ID" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.id }}</span> <span>{{ scope.row.id }}</span>
</template> </template>
...@@ -11,44 +11,34 @@ ...@@ -11,44 +11,34 @@
<span @click="handleCopy(scope.row.devicenum,$event)">{{ scope.row.devicenum }}</span> <span @click="handleCopy(scope.row.devicenum,$event)">{{ scope.row.devicenum }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备类型" width="150">
<template slot-scope="scope">
<span>{{ scope.row.tname }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="介质状态" width="170">
<template slot-scope="scope">
<span>{{ scope.row.gas }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备名称" width="170"> <el-table-column align="center" label="设备名称" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.username }}</span> <span>{{ scope.row.username }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="浓度" width="170"> <el-table-column align="center" label="设备详情">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.nd }}</span> <span>{{ scope.row.deviceinfo }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="是否已删除设备" width="170"> <el-table-column align="center" label="设备类型" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{color:( scope.row.delete==1 ? '#F56C6C' : '#67C23A' )}">{{ scope.row.delete ==1 ? '设备已被丢弃废纸篓' : '设备正常' }}</span> <span>{{ scope.row.tname }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备备注" width="170"> <el-table-column align="center" label="检测介质" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.deviceremark }}</span> <span>{{ scope.row.gas }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备详情" width="170"> <el-table-column align="center" label="检测值" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.deviceinfo }}</span> <span>{{ scope.row.nd }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="创建时间" width="170"> <el-table-column align="center" label="单位" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.deviceaddtime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span> <span>{{ scope.row.danwei }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设备实时状态" width="170"> <el-table-column align="center" label="设备实时状态" width="170">
...@@ -64,6 +54,11 @@ ...@@ -64,6 +54,11 @@
<span v-if="scope.row.status_name!='正常' " :style="{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">{{ scope.row.status_name=='正常' ? '正常' : '设备异常' }}</span> <span v-if="scope.row.status_name!='正常' " :style="{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">{{ scope.row.status_name=='正常' ? '正常' : '设备异常' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="最后更新时间" width="170">
<template slot-scope="scope">
<span>{{ scope.row.update_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="devicelist" /> <pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="devicelist" />
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment