Commit 78c0e7c3 authored by 冯超鹏's avatar 冯超鹏

登入模块

parent 39e053e5
Pipeline #50 canceled with stages
......@@ -71,6 +71,7 @@ class AuthController extends Controller
$token = $tokenResult->token;
$token->save();
return response()->json(new UserResource($BackgroundUser), Response::HTTP_OK)->header('Authorization', $tokenResult->accessToken);
}else{
return response()->json(new JsonResponse([], 'login_error'), Response::HTTP_UNAUTHORIZED);
}
......
......@@ -184,8 +184,6 @@ class DevicesController extends Controller
$databadevice = DB::table('device');
$devicelist = $databadevice
->where('dtype', '=', $type)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
......@@ -196,8 +194,6 @@ class DevicesController extends Controller
->get()->toArray();
$count = $databadevice
->where('dtype', '=', $type)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->count();
return ['devicelist' => $devicelist, 'count' => $count];
}
......@@ -209,8 +205,6 @@ class DevicesController extends Controller
$devicelist = $databadevice
->where('dtype', '=', $type)
->where('uid', '=', Auth::id())
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
......@@ -222,8 +216,6 @@ class DevicesController extends Controller
$count = $databadevice
->where('dtype', '=', $type)
->where('uid', '=', Auth::id())
// ->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->count();
return ['devicelist' => $devicelist, 'count' => $count];
}
......@@ -233,8 +225,6 @@ class DevicesController extends Controller
$databadevice = DB::table('device');
$devicelist = $databadevice
->where('devicenum', '=', $devicenum)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
......@@ -245,8 +235,6 @@ class DevicesController extends Controller
->get()->toArray();
$count = $databadevice
->where('dtype', '=', $devicenum)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->count();
return ['devicelist' => $devicelist, 'count' => $count];
}
......@@ -319,7 +307,6 @@ class DevicesController extends Controller
public function police()
{
$data = DB::table('reportpolice as r')
//->where('r.status', '=', '1')
->join('status as s', 'r.policestatus', '=', 's.id')
->select('r.*', 's.status_name')
->get();
......@@ -369,6 +356,43 @@ class DevicesController extends Controller
return $this->jsonSuccessData(DB::table('device_type')->where('tid', '=', $id)->delete());
}
public function deviceLocation()
{
//返回用户安装位置
return $this->jsonSuccessData(DB::table('device')->select('id','devicenum','devicecoord','devicepolice')->get());
}
//返回消防监测
public function control(Request $request)
{
$pagenNum = $request->input('page') - 1;//页数
$limit = $request->input('limit');
$type = $request->input('type');
if ($pagenNum === '' || $limit == '' || $type === '') {
return $this->jsonErrorData(105, '页数或limit不能为空');
}
if($type ==1){//返回消防监测
$wherein = [1,2,4,7,8,11];
}else{
//返回危化
$wherein = [5,6,9,10];
}
$databadevice = DB::table('device');
$devicelist = $databadevice
->whereIn('dtype', $wherein)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
$count = $databadevice
->whereIn('dtype',$wherein)
->count();
return $this->jsonSuccessData(['devicelist' => $devicelist, 'count' => $count]);
}
/**
* @param bool $isNew
* @return array
......
......@@ -267,7 +267,6 @@ class UserController extends Controller
return $this->jsonErrorData(105, 'limit不能为空');
}
$users = DB::table('BackgroundUser as b')
//->where('b.state', '>', '1')
->leftjoin('areachina as p', 'b.provinceid', '=', 'p.areaid')
->leftjoin('areachina as c', 'b.cityid', '=', 'c.areaid')
->leftjoin('areachina as a', 'b.areaid', '=', 'a.areaid')
......@@ -277,10 +276,8 @@ class UserController extends Controller
->limit($limit)
->get();
$count = DB::table('BackgroundUser')
//->where('state', '>', '1')
->count();
$davicenum = DB::table('BackgroundUser')
//->where('state', '>', '1')
->select('id')
->get()->toArray();
$data = [];
......@@ -507,6 +504,11 @@ class UserController extends Controller
return $this->jsonSuccessData(DB::table('BackgroundUser')->where('state','=','1')->count());
}
//返回用户的经纬度
public function userLocation()
{
return $this->jsonSuccessData(DB::table('BackgroundUser')->select('id','nickname','mapcenter','company')->get());
}
/*
* 返回废纸篓 和状态
......
......@@ -21,13 +21,11 @@ class Authenticate extends Middleware
if (empty($guards)) {
$guards = [null];
}
foreach ($guards as $guard) {
if ($this->auth->guard($guard)->check()) {
return $this->auth->shouldUse($guard);
}
}
return 'authentication_error';
}
......@@ -35,7 +33,7 @@ class Authenticate extends Middleware
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string
* @ string
*/
protected function redirectTo($request)
{
......
No preview for this file type
......@@ -3373,6 +3373,34 @@
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
},
"bmaplib.curveline": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/bmaplib.curveline/-/bmaplib.curveline-1.0.0.tgz",
"integrity": "sha512-9wcFMVhiYxNPqpvsLDAADn3qDhNzXp2mA6VyHSHg2XOAgSooC7ZiujdFhy0sp+0QYjTfJ/MjmLuNoUg2HHxH4Q=="
},
"bmaplib.heatmap": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/bmaplib.heatmap/-/bmaplib.heatmap-1.0.4.tgz",
"integrity": "sha512-rmhqUARBpUSJ9jXzUI2j7dIOqnc38bqubkx/8a349U2qtw/ulLUwyzRD535OrA8G7w5cz4aPKm6/rNvUAarg/Q=="
},
"bmaplib.lushu": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/bmaplib.lushu/-/bmaplib.lushu-1.0.7.tgz",
"integrity": "sha512-LVvgpESPii6xGxyjnQjq8u+ic4NjvhdCPV/RiSS/PGTUdZKeTDS7prSpleJLZH3ES0+oc0gYn8bw0LtPYUSz2w=="
},
"bmaplib.markerclusterer": {
"version": "1.0.13",
"resolved": "https://registry.npmjs.org/bmaplib.markerclusterer/-/bmaplib.markerclusterer-1.0.13.tgz",
"integrity": "sha512-VrLyWSiuDEVNi0yUfwOhFQ6z1oEEHS4w36GNu3iASu6p52QIx9uAXMUkuSCHReNR0bj2Cp9SA1dSx5RpojXajQ==",
"requires": {
"bmaplib.texticonoverlay": "^1.0.2"
}
},
"bmaplib.texticonoverlay": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bmaplib.texticonoverlay/-/bmaplib.texticonoverlay-1.0.2.tgz",
"integrity": "sha512-4ZTWr4ZP3B6qEWput5Tut16CfZgII38YwM3bpyb4gFTQyORlKYryFp9WHWrwZZaHlOyYDAXG9SX0hka43jTADg=="
},
"bn.js": {
"version": "4.11.8",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
......@@ -8486,6 +8514,11 @@
"integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==",
"dev": true
},
"js-md5": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.7.3.tgz",
"integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
......@@ -11765,6 +11798,11 @@
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
"dev": true
},
"qqmap": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/qqmap/-/qqmap-1.0.1.tgz",
"integrity": "sha1-Rieej5zWgALi4MxaX8FV9wH0AdM="
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
......@@ -14505,6 +14543,21 @@
"integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=",
"dev": true
},
"uppercamelcase": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/uppercamelcase/-/uppercamelcase-1.1.0.tgz",
"integrity": "sha1-Mk2YprOvx+iolT4QZBUJsOTiP5c=",
"requires": {
"camelcase": "^1.2.1"
},
"dependencies": {
"camelcase": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
"integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk="
}
}
},
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
......@@ -14689,6 +14742,40 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz",
"integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ=="
},
"vue-amap": {
"version": "0.5.10",
"resolved": "https://registry.npmjs.org/vue-amap/-/vue-amap-0.5.10.tgz",
"integrity": "sha512-9ViNCev1vx32+zZ5RvF/TmUZNbwL9QrdA2/OnD2GlXMfQBkJy7D08Vb7379t6guqnopDPtWJ8K6gg72h9+4GUg==",
"requires": {
"uppercamelcase": "^1.1.0"
}
},
"vue-baidu-map": {
"version": "0.21.22",
"resolved": "https://registry.npmjs.org/vue-baidu-map/-/vue-baidu-map-0.21.22.tgz",
"integrity": "sha512-WQMPCih4UTh0AZCKKH/OVOYnyAWjfRNeK6BIeoLmscyY5aF8zzlJhz/NOHLb3mdztIpB0Z6aohn4Jd9mfCSjQw==",
"requires": {
"bmaplib.curveline": "^1.0.0",
"bmaplib.heatmap": "^1.0.4",
"bmaplib.lushu": "^1.0.7",
"bmaplib.markerclusterer": "^1.0.13",
"markdown-it": "^8.4.0"
},
"dependencies": {
"markdown-it": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz",
"integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==",
"requires": {
"argparse": "^1.0.7",
"entities": "~1.1.1",
"linkify-it": "^2.0.0",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.5"
}
}
}
},
"vue-count-to": {
"version": "1.0.13",
"resolved": "https://registry.npmjs.org/vue-count-to/-/vue-count-to-1.0.13.tgz",
......
......@@ -77,17 +77,21 @@
"file-saver": "^2.0.2",
"fuse.js": "^3.6.1",
"js-cookie": "^2.2.1",
"js-md5": "^0.7.3",
"jsonlint": "^1.6.3",
"jszip": "^3.2.2",
"node-sass": "^4.13.1",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^3.1.0",
"qqmap": "^1.0.1",
"screenfull": "^4.2.1",
"sortablejs": "^1.10.2",
"tui-editor": "^1.4.6",
"v-viewer": "^1.5.1",
"vue": "2.6.10",
"vue-amap": "^0.5.10",
"vue-baidu-map": "^0.21.22",
"vue-count-to": "^1.0.13",
"vue-i18n": "^8.15.5",
"vue-loader": "^15.9.1",
......
......@@ -8,6 +8,14 @@ export function login(data) {
});
}
export function userlogin(data) {
return request({
url: '/auth/userslogin',
method: 'post',
data: data,
});
}
export function getInfo(token) {
return request({
url: '/auth/user',
......@@ -21,3 +29,10 @@ export function logout() {
method: 'post',
});
}
export function userdevicelist(page, limit, id) {
return request({
url: 'devices/userdevicelist?page=' + page + '&limit=' + limit + '&id=' + id,
method: 'get',
});
}
......@@ -92,3 +92,16 @@ export function police(dete) {
});
}
export function deviceLocation() {
return request({
url: '/devices/deviceLocation',
method: 'get',
});
}
export function control(page, limit, type) {
return request({
url: 'devices/control?page=' + page + '&limit=' + limit + '&type=' + type,
method: 'get',
});
}
......@@ -65,3 +65,11 @@ export function paperBasketList() {
method: 'get',
});
}
export function userLocation() {
return request({
url: '/user/userLocation',
method: 'get',
});
}
......@@ -7,7 +7,7 @@ import router from '@/router';
import i18n from './lang'; // Internationalization
import '@/icons'; // icon
import '@/permission'; // permission control
import AMap from 'vue-amap';
import * as filters from './filters'; // global filters
Vue.use(ElementUI, {
......@@ -27,4 +27,5 @@ new Vue({
store,
i18n,
render: h => h(App),
AMap,
});
......@@ -5,7 +5,7 @@
<script>
import echarts from 'echarts';
import resize from './mixins/resize';
import { getcount } from '@/api/homepage';
export default {
mixins: [resize],
props: {
......@@ -29,10 +29,13 @@ export default {
data() {
return {
chart: null,
devicemover: [], // 设备数量
policedata: [], // 报警数量
userdata: [], // 用户数量
};
},
mounted() {
this.initChart();
created() {
this.getcount();
},
beforeDestroy() {
if (!this.chart) {
......@@ -46,15 +49,16 @@ export default {
this.chart = echarts.init(document.getElementById(this.id));
const xData = (function() {
const data = [];
for (let i = 1; i < 13; i++) {
data.push(i + 'month');
const date = new Date();
for (let i = 1; i < date.getMonth() + 1 + 1; i++) {
data.push(i + '月');
}
return data;
}());
this.chart.setOption({
backgroundColor: '#344b58',
title: {
text: 'statistics',
text: '统计记录',
x: '20',
top: '20',
textStyle: {
......@@ -90,7 +94,7 @@ export default {
textStyle: {
color: '#90979c',
},
data: ['female', 'male', 'average'],
data: ['设备数量', '用户数量', '设备报警次数'],
},
calculable: true,
xAxis: [{
......@@ -160,7 +164,7 @@ export default {
}],
series: [
{
name: 'female',
name: '设备数量',
type: 'bar',
stack: 'total',
barMaxWidth: 35,
......@@ -180,23 +184,10 @@ export default {
},
},
},
data: [
709,
1917,
2455,
2610,
1719,
1433,
1544,
3285,
5208,
3372,
2484,
4078,
],
data: this.devicemover,
},
{
name: 'male',
name: '用户数量',
type: 'bar',
stack: 'total',
itemStyle: {
......@@ -212,22 +203,9 @@ export default {
},
},
},
data: [
327,
1776,
507,
1200,
800,
482,
204,
1390,
1001,
951,
381,
220,
],
data: this.userdata,
}, {
name: 'average',
name: '设备报警次数',
type: 'line',
stack: 'total',
symbolSize: 10,
......@@ -245,24 +223,25 @@ export default {
},
},
},
data: [
1036,
3693,
2962,
3810,
2519,
1915,
1748,
4675,
6209,
4323,
2865,
4298,
],
data: this.policedata,
},
],
});
},
getcount() {
getcount()
.then(response => {
if (response.code === 200) {
this.devicemover = response.data.devicedata;
this.policedata = response.data.devicepolice;
this.userdata = response.data.policedata;
this.initChart();
}
})
.catch(err => {
console.log(err);
});
},
},
};
</script>
......@@ -88,6 +88,8 @@ export default {
thirdparty: 'Or connect with',
thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !',
email: 'Email',
adminLogin: 'Administrator login',
userLogin: 'User login',
},
documentation: {
documentation: 'Documentation',
......
......@@ -88,6 +88,8 @@ export default {
thirdparty: 'Или войдите с помощью',
thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !',
email: 'Email',
adminLogin: 'Administrator login',
userLogin: 'User login',
},
documentation: {
documentation: 'Документация',
......
......@@ -91,6 +91,8 @@ export default {
any: 'any',
thirdparty: 'Hoặc đăng nhập với',
thirdpartyTips: 'Không thể giả lập, xi vui lòng áp dụng tùy theo tình huống nghiệp vụ của bạn! ! !',
adminLogin: 'Administrator login',
userLogin: 'User login',
},
documentation: {
documentation: 'Tài liệu',
......
......@@ -93,6 +93,8 @@ export default {
any: '随便填',
thirdparty: '第三方登录',
thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!',
adminLogin: '管理者登入',
userLogin: '用户登入',
},
documentation: {
documentation: '文档',
......
......@@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title';
NProgress.configure({ showSpinner: false }); // NProgress Configuration
const whiteList = ['/login', '/auth-redirect', '/userslogin']; // no redirect whitelist
const whiteList = ['/login', '/auth-redirect', '/userlogin']; // no redirect whitelist
router.beforeEach(async(to, from, next) => {
// start progress bar
......
import { login, logout, getInfo } from '@/api/auth';
import { login, logout, getInfo, userlogin } from '@/api/auth';
import { getToken, setToken, removeToken } from '@/utils/auth';
import router, { resetRouter } from '@/router';
import store from '@/store';
......@@ -53,7 +53,20 @@ const actions = {
});
});
},
userlogin({ commit }, userInfo) {
const { email, password } = userInfo;
return new Promise((resolve, reject) => {
userlogin({ email: email.trim(), password: password })
.then(response => {
commit('SET_TOKEN', response.token);
setToken(response.token);
resolve();
})
.catch(error => {
reject(error);
});
});
},
// get user info
getInfo({ commit, state }) {
return new Promise((resolve, reject) => {
......
<template>
<div class="dashboard-editor-container">
<github-corner style="position: absolute; top: 0px; border: 0; right: 0;" />
<panel-group @handleSetLineChartData="handleSetLineChartData" />
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
......@@ -41,7 +39,6 @@
</template>
<script>
// import GithubCorner from '@/components/GithubCorner';
import PanelGroup from './components/PanelGroup';
import LineChart from './components/LineChart';
import RaddarChart from './components/RaddarChart';
......
......@@ -20,7 +20,6 @@
<script>
import { mapGetters } from 'vuex';
import PanThumb from '@/components/PanThumb';
// import GithubCorner from '@/components/GithubCorner';
export default {
name: 'DashboardEditor',
......
<template>
<div class="dashboard-container">
<component :is="currentRole" />
<div class="app-container">
<el-row :gutter="20">
<el-col :span="20">
<!-- 用户操作 -->
<div>
<el-row :gutter="20">
<el-col :span="6"><el-card shadow="always">用户数量<span style="margin-left: 12px;color: #606266;">{{ synthesizecount.usercount }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">设备数量<span style="margin-left: 12px;color: #409EFF;">{{ synthesizecount.devicecount }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">报警数量<span style="margin-left: 12px;color: #E6A23C;">{{ synthesizecount.devicepolice }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">今天报警次数<span style="margin-left: 12px;color: #F56C6C;">{{ synthesizecount.timedevicepolice }}</span></el-card></el-col>
</el-row>
</div>
<!-- 混合统计 -->
<div class="chart-container" style="position: relative; top: 20px; height: 500px;">
<chart height="100%" width="100%" />
</div>
</el-col>
<el-col :span="4">
<!-- 时间线 -->
<div>
<el-timeline :reverse="reverse">
<el-timeline-item v-for="(activity, index) in activities" :key="index" :timestamp="activity.timestamp">{{ activity.content }}</el-timeline-item>
</el-timeline>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import adminDashboard from './admin';
import editorDashboard from './editor';
import Chart from '@/components/Charts/MixChart';
import { homepagecount } from '@/api/homepage';
export default {
name: 'Dashboard',
components: { adminDashboard, editorDashboard },
components: { Chart },
data() {
return {
currentRole: 'adminDashboard',
reverse: true,
synthesizecount: [],
activities: [{
content: '活动按期开始',
timestamp: '2018-04-15',
}, {
content: '创建成功',
timestamp: '2018-04-11',
}],
};
},
computed: {
...mapGetters([
'roles',
]),
},
created() {
if (!this.roles.includes('admin')) {
this.currentRole = 'editorDashboard';
}
this.getList();
},
methods: {
getList() {
homepagecount()
.then(response => {
this.synthesizecount = response.data;
})
.catch(err => {
console.log(err);
});
},
},
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.app-container{
.chart-container{
position: relative;
width: 100%;
top: 40px;
// height: calc(100vh - 84px);
}
}
</select>
......@@ -79,7 +79,8 @@
</el-table-column>
<el-table-column align="center" label="状态" width="170">
<template slot-scope="scope">
<span :style="{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">{{ scope.row.devicestatus==1 ? '正常' : '设备错误' }}</span>
<span v-if="scope.row.status_name=='正常' " :style="{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">{{ scope.row.devicestatus==1 ? '正常' : '设备错误' }}</span>
<span v-if="scope.row.status_name!='正常' " :style="{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">{{ scope.row.status_name=='正常' ? '正常' : '设备异常' }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="170">
......@@ -95,7 +96,7 @@
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="getList" />
<pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="devicelist" />
<el-dialog :visible.sync="dialogPvVisible" title="设备详情信息" width="50%">
<el-table :data="devicefistr">
......
This diff is collapsed.
<template>
<div>地图模式</div>
<div>
</div>
</template>
<script>
export default {
data() {
return {
type: 'permit',
};
},
created() {
this.getmap(); // 列表
},
methods: {
getmap() {
window.open('npm.html?type=' + this.compileStr(this.type));
},
compileStr(code) {
var c = String.fromCharCode(code.charCodeAt(0) + code.length);
for (var i = 1; i < code.length; i++) {
c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1));
}
return escape(c);
},
},
};
</script>
<style>
......
<template>
<div>危化监测</div>
<div class="app-container">
<el-table :key="tableKey" v-loading="loading" :data="device" border fit highlight-current-rows>
<el-table-column align="center" label="id" width="80">
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备编号" width="150">
<template slot-scope="scope">
<span @click="handleCopy(scope.row.devicenum,$event)">{{ scope.row.devicenum }}</span>
</template>
</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">
<template slot-scope="scope">
<span>{{ scope.row.username }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="浓度" width="170">
<template slot-scope="scope">
<span>{{ scope.row.nd }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="是否已删除设备" width="170">
<template slot-scope="scope">
<span :style="{color:( scope.row.delete==1 ? '#F56C6C' : '#67C23A' )}">{{ scope.row.delete ==1 ? '设备已被丢弃废纸篓' : '设备正常' }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备备注" width="170">
<template slot-scope="scope">
<span>{{ scope.row.deviceremark }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备详情" width="170">
<template slot-scope="scope">
<span>{{ scope.row.deviceinfo }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" width="170">
<template slot-scope="scope">
<span>{{ scope.row.deviceaddtime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备实时状态" width="170">
<template slot-scope="scope">
<span>
<el-tag :type=" scope.row.status_name=='正常' ? 'success' : 'warning' " effect="dark">{{ scope.row.status_name }}</el-tag>
</span>
</template>
</el-table-column>
<el-table-column align="center" label="状态" width="170">
<template slot-scope="scope">
<span v-if="scope.row.status_name=='正常' " :style="{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">{{ scope.row.devicestatus==1 ? '正常' : '设备错误' }}</span>
<span v-if="scope.row.status_name!='正常' " :style="{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">{{ scope.row.status_name=='正常' ? '正常' : '设备异常' }}</span>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="devicelist" />
</div>
</template>
<script>
import { control } from '@/api/device';
import Pagination from '@/components/Pagination'; // 分页
import clip from '@/utils/clipboard';
export default {
name: 'Devicetype',
components: { Pagination },
data() {
return {
tableKey: 0,
loading: true,
device: [],
page: 1,
limit: 10,
type: 2,
total: 0,
paper: undefined,
};
},
created() {
this.devicelist(); // 设备状态
},
methods: {
devicelist() {
const limit = this.limit;
const page = this.page;
this.loading = true;
control(page, limit, this.type)
.then(response => {
var devicetype = response.data['devicelist'];
this.device = devicetype;
this.device.forEach((element, index) => {
element['index'] = (page - 1) * limit + index + 1;
});
this.total = response.data.count;
this.loading = false;
})
.catch(err => {
console.log(err);
});
},
handleClick(tab) {
this.type = tab.$attrs.tid;
this.devicelist();
},
handleCopy(text, event) {
clip(text, event);
},
handleCopyphone(text, event){
clip(text, event);
},
},
};
</script>
<style>
......
<template>
<div>消防监测</div>
<div class="app-container">
<el-table :key="tableKey" v-loading="loading" :data="device" border fit highlight-current-rows>
<el-table-column align="center" label="id" width="80">
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备编号" width="150">
<template slot-scope="scope">
<span @click="handleCopy(scope.row.devicenum,$event)">{{ scope.row.devicenum }}</span>
</template>
</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">
<template slot-scope="scope">
<span>{{ scope.row.username }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="浓度" width="170">
<template slot-scope="scope">
<span>{{ scope.row.nd }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="是否已删除设备" width="170">
<template slot-scope="scope">
<span :style="{color:( scope.row.delete==1 ? '#F56C6C' : '#67C23A' )}">{{ scope.row.delete ==1 ? '设备已被丢弃废纸篓' : '设备正常' }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备备注" width="170">
<template slot-scope="scope">
<span>{{ scope.row.deviceremark }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备详情" width="170">
<template slot-scope="scope">
<span>{{ scope.row.deviceinfo }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" width="170">
<template slot-scope="scope">
<span>{{ scope.row.deviceaddtime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设备实时状态" width="170">
<template slot-scope="scope">
<span>
<el-tag :type=" scope.row.status_name=='正常' ? 'success' : 'warning' " effect="dark">{{ scope.row.status_name }}</el-tag>
</span>
</template>
</el-table-column>
<el-table-column align="center" label="状态" width="170">
<template slot-scope="scope">
<span v-if="scope.row.status_name=='正常' " :style="{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">{{ scope.row.devicestatus==1 ? '正常' : '设备错误' }}</span>
<span v-if="scope.row.status_name!='正常' " :style="{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">{{ scope.row.status_name=='正常' ? '正常' : '设备异常' }}</span>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="page" :limit.sync="limit" @pagination="devicelist" />
</div>
</template>
<script>
import { control } from '@/api/device';
import Pagination from '@/components/Pagination'; // 分页
import clip from '@/utils/clipboard';
export default {
name: 'Devicetype',
components: { Pagination },
data() {
return {
tableKey: 0,
loading: true,
device: [],
page: 1,
limit: 10,
type: 1,
total: 0,
paper: undefined,
};
},
created() {
this.devicelist(); // 设备状态
},
methods: {
devicelist() {
const limit = this.limit;
const page = this.page;
this.loading = true;
control(page, limit, this.type)
.then(response => {
var devicetype = response.data['devicelist'];
this.device = devicetype;
this.device.forEach((element, index) => {
element['index'] = (page - 1) * limit + index + 1;
});
this.total = response.data.count;
this.loading = false;
})
.catch(err => {
console.log(err);
});
},
handleClick(tab) {
this.type = tab.$attrs.tid;
this.devicelist();
},
handleCopy(text, event) {
clip(text, event);
},
handleCopyphone(text, event){
clip(text, event);
},
},
};
</script>
<style>
......
......@@ -71,6 +71,7 @@
<script>
import { deviceTypeList } from '@/api/device';
import websocketurl from '@/api/configurl';
import BackToTop from '@/components/BackToTop';
export default {
components: { BackToTop },
......@@ -115,7 +116,7 @@ export default {
});
},
initWebSocket(){ // 初始化weosocket
const wsuri = 'ws://127.0.0.1:9502';
const wsuri = websocketurl.baseURL;
this.websock = new WebSocket(wsuri);
this.websock.onmessage = this.websocketonmessage;
this.websock.onopen = this.websocketonopen;
......
......@@ -29,7 +29,6 @@
<div id="app">
<app></app>
</div>
<script src=/static/tinymce4.7.5/tinymce.min.js></script>
<script src="{{ mix('js/vendor.js') }}"></script>
<script src="{{ mix('js/manifest.js') }}"></script>
......
......@@ -29,7 +29,6 @@
<div id="app">
<app></app>
</div>
<script src=/static/tinymce4.7.5/tinymce.min.js></script>
<script src="{{ mix('js/app.js') }}"></script>
</body>
......
......@@ -41,10 +41,11 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::get('user/UpPaperBasket/{id}','UserController@UpPaperBasket');//更新废纸篓和禁用用户
Route::get('user/UpuserForbidden/{id}','UserController@UpuserForbidden');//禁用此用户
Route::get('user/paperBasket','UserController@paperBasket');//返回废纸篓数量
Route::get('user/paperBasketList','UserController@paperBasketList');//返回废纸篓和用户状态
Route::get('user/userLocation','UserController@userLocation');//返回用户安装位置
Route::get('user/textcountuser','UserController@textcountuser');//用户测试接口
Route::get('user/textcountuser','UserController@textcountuser');//返回废纸篓和用户状态
});
//上传图片路由
......@@ -61,6 +62,12 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::post('SwooleCommand/SwooleCommand','SwooleCommandController@index');
});
//首页路由
Route::group(['middleware'=>'auth:api'],function (){
Route::get('homepagecount/homepagecount','HomepageController@homepagecount');//删除图片
Route::get('homepagecount/devicemonthcount','HomepageController@devicemonthcount');//删除图片
});
//设备路由
Route::group(['middleware'=>'auth:api'],function (){
Route::get('devices/devicelist', 'DevicesController@devicelist');//设备列表
......@@ -81,6 +88,8 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::get('devices/addClassify/{data}','DevicesController@addClassify');//添加分类
Route::get('devices/delteClassify/{id}','DevicesController@delteClassify');//删除分类
Route::get('devices/detedevice','DevicesController@detedevice');//查看历史数据
Route::get('devices/control','DevicesController@control');//返回消防监测
Route::get('devices/deviceLocation','DevicesController@deviceLocation');//返回设备安装位置
});
//装维中心
......
......@@ -39,5 +39,10 @@ module.exports = {
},
],
},
externals: {
'AMap': 'AMap',
'Loca': 'Loca',
'AMapUI': 'AMapUI',
},
plugins: plugins,
};
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