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

登入模块

parent 39e053e5
Pipeline #50 canceled with stages
...@@ -71,6 +71,7 @@ class AuthController extends Controller ...@@ -71,6 +71,7 @@ class AuthController extends Controller
$token = $tokenResult->token; $token = $tokenResult->token;
$token->save(); $token->save();
return response()->json(new UserResource($BackgroundUser), Response::HTTP_OK)->header('Authorization', $tokenResult->accessToken); return response()->json(new UserResource($BackgroundUser), Response::HTTP_OK)->header('Authorization', $tokenResult->accessToken);
}else{ }else{
return response()->json(new JsonResponse([], 'login_error'), Response::HTTP_UNAUTHORIZED); return response()->json(new JsonResponse([], 'login_error'), Response::HTTP_UNAUTHORIZED);
} }
......
...@@ -184,8 +184,6 @@ class DevicesController extends Controller ...@@ -184,8 +184,6 @@ class DevicesController extends Controller
$databadevice = DB::table('device'); $databadevice = DB::table('device');
$devicelist = $databadevice $devicelist = $databadevice
->where('dtype', '=', $type) ->where('dtype', '=', $type)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->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')
...@@ -196,8 +194,6 @@ class DevicesController extends Controller ...@@ -196,8 +194,6 @@ class DevicesController extends Controller
->get()->toArray(); ->get()->toArray();
$count = $databadevice $count = $databadevice
->where('dtype', '=', $type) ->where('dtype', '=', $type)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->count(); ->count();
return ['devicelist' => $devicelist, 'count' => $count]; return ['devicelist' => $devicelist, 'count' => $count];
} }
...@@ -209,8 +205,6 @@ class DevicesController extends Controller ...@@ -209,8 +205,6 @@ class DevicesController extends Controller
$devicelist = $databadevice $devicelist = $databadevice
->where('dtype', '=', $type) ->where('dtype', '=', $type)
->where('uid', '=', Auth::id()) ->where('uid', '=', Auth::id())
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->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')
...@@ -222,8 +216,6 @@ class DevicesController extends Controller ...@@ -222,8 +216,6 @@ class DevicesController extends Controller
$count = $databadevice $count = $databadevice
->where('dtype', '=', $type) ->where('dtype', '=', $type)
->where('uid', '=', Auth::id()) ->where('uid', '=', Auth::id())
// ->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->count(); ->count();
return ['devicelist' => $devicelist, 'count' => $count]; return ['devicelist' => $devicelist, 'count' => $count];
} }
...@@ -233,8 +225,6 @@ class DevicesController extends Controller ...@@ -233,8 +225,6 @@ class DevicesController extends Controller
$databadevice = DB::table('device'); $databadevice = DB::table('device');
$devicelist = $databadevice $devicelist = $databadevice
->where('devicenum', '=', $devicenum) ->where('devicenum', '=', $devicenum)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->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')
...@@ -245,8 +235,6 @@ class DevicesController extends Controller ...@@ -245,8 +235,6 @@ class DevicesController extends Controller
->get()->toArray(); ->get()->toArray();
$count = $databadevice $count = $databadevice
->where('dtype', '=', $devicenum) ->where('dtype', '=', $devicenum)
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
->count(); ->count();
return ['devicelist' => $devicelist, 'count' => $count]; return ['devicelist' => $devicelist, 'count' => $count];
} }
...@@ -319,7 +307,6 @@ class DevicesController extends Controller ...@@ -319,7 +307,6 @@ class DevicesController extends Controller
public function police() public function police()
{ {
$data = DB::table('reportpolice as r') $data = DB::table('reportpolice as r')
//->where('r.status', '=', '1')
->join('status as s', 'r.policestatus', '=', 's.id') ->join('status as s', 'r.policestatus', '=', 's.id')
->select('r.*', 's.status_name') ->select('r.*', 's.status_name')
->get(); ->get();
...@@ -369,6 +356,43 @@ class DevicesController extends Controller ...@@ -369,6 +356,43 @@ class DevicesController extends Controller
return $this->jsonSuccessData(DB::table('device_type')->where('tid', '=', $id)->delete()); 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 * @param bool $isNew
* @return array * @return array
......
...@@ -267,7 +267,6 @@ class UserController extends Controller ...@@ -267,7 +267,6 @@ class UserController extends Controller
return $this->jsonErrorData(105, 'limit不能为空'); return $this->jsonErrorData(105, 'limit不能为空');
} }
$users = DB::table('BackgroundUser as b') $users = DB::table('BackgroundUser as b')
//->where('b.state', '>', '1')
->leftjoin('areachina as p', 'b.provinceid', '=', 'p.areaid') ->leftjoin('areachina as p', 'b.provinceid', '=', 'p.areaid')
->leftjoin('areachina as c', 'b.cityid', '=', 'c.areaid') ->leftjoin('areachina as c', 'b.cityid', '=', 'c.areaid')
->leftjoin('areachina as a', 'b.areaid', '=', 'a.areaid') ->leftjoin('areachina as a', 'b.areaid', '=', 'a.areaid')
...@@ -277,10 +276,8 @@ class UserController extends Controller ...@@ -277,10 +276,8 @@ class UserController extends Controller
->limit($limit) ->limit($limit)
->get(); ->get();
$count = DB::table('BackgroundUser') $count = DB::table('BackgroundUser')
//->where('state', '>', '1')
->count(); ->count();
$davicenum = DB::table('BackgroundUser') $davicenum = DB::table('BackgroundUser')
//->where('state', '>', '1')
->select('id') ->select('id')
->get()->toArray(); ->get()->toArray();
$data = []; $data = [];
...@@ -507,6 +504,11 @@ class UserController extends Controller ...@@ -507,6 +504,11 @@ class UserController extends Controller
return $this->jsonSuccessData(DB::table('BackgroundUser')->where('state','=','1')->count()); 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 ...@@ -21,13 +21,11 @@ class Authenticate extends Middleware
if (empty($guards)) { if (empty($guards)) {
$guards = [null]; $guards = [null];
} }
foreach ($guards as $guard) { foreach ($guards as $guard) {
if ($this->auth->guard($guard)->check()) { if ($this->auth->guard($guard)->check()) {
return $this->auth->shouldUse($guard); return $this->auth->shouldUse($guard);
} }
} }
return 'authentication_error'; return 'authentication_error';
} }
...@@ -35,7 +33,7 @@ class Authenticate extends Middleware ...@@ -35,7 +33,7 @@ class Authenticate extends Middleware
* Get the path the user should be redirected to when they are not authenticated. * Get the path the user should be redirected to when they are not authenticated.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return string * @ string
*/ */
protected function redirectTo($request) protected function redirectTo($request)
{ {
......
No preview for this file type
...@@ -3373,6 +3373,34 @@ ...@@ -3373,6 +3373,34 @@
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" "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": { "bn.js": {
"version": "4.11.8", "version": "4.11.8",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
...@@ -8486,6 +8514,11 @@ ...@@ -8486,6 +8514,11 @@
"integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==",
"dev": true "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": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
...@@ -11765,6 +11798,11 @@ ...@@ -11765,6 +11798,11 @@
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
"dev": true "dev": true
}, },
"qqmap": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/qqmap/-/qqmap-1.0.1.tgz",
"integrity": "sha1-Rieej5zWgALi4MxaX8FV9wH0AdM="
},
"qs": { "qs": {
"version": "6.7.0", "version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
...@@ -14505,6 +14543,21 @@ ...@@ -14505,6 +14543,21 @@
"integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=",
"dev": true "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": { "uri-js": {
"version": "4.2.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
...@@ -14689,6 +14742,40 @@ ...@@ -14689,6 +14742,40 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz",
"integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" "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": { "vue-count-to": {
"version": "1.0.13", "version": "1.0.13",
"resolved": "https://registry.npmjs.org/vue-count-to/-/vue-count-to-1.0.13.tgz", "resolved": "https://registry.npmjs.org/vue-count-to/-/vue-count-to-1.0.13.tgz",
......
...@@ -77,17 +77,21 @@ ...@@ -77,17 +77,21 @@
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"fuse.js": "^3.6.1", "fuse.js": "^3.6.1",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"js-md5": "^0.7.3",
"jsonlint": "^1.6.3", "jsonlint": "^1.6.3",
"jszip": "^3.2.2", "jszip": "^3.2.2",
"node-sass": "^4.13.1", "node-sass": "^4.13.1",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"path-to-regexp": "^3.1.0", "path-to-regexp": "^3.1.0",
"qqmap": "^1.0.1",
"screenfull": "^4.2.1", "screenfull": "^4.2.1",
"sortablejs": "^1.10.2", "sortablejs": "^1.10.2",
"tui-editor": "^1.4.6", "tui-editor": "^1.4.6",
"v-viewer": "^1.5.1", "v-viewer": "^1.5.1",
"vue": "2.6.10", "vue": "2.6.10",
"vue-amap": "^0.5.10",
"vue-baidu-map": "^0.21.22",
"vue-count-to": "^1.0.13", "vue-count-to": "^1.0.13",
"vue-i18n": "^8.15.5", "vue-i18n": "^8.15.5",
"vue-loader": "^15.9.1", "vue-loader": "^15.9.1",
......
...@@ -8,6 +8,14 @@ export function login(data) { ...@@ -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) { export function getInfo(token) {
return request({ return request({
url: '/auth/user', url: '/auth/user',
...@@ -21,3 +29,10 @@ export function logout() { ...@@ -21,3 +29,10 @@ export function logout() {
method: 'post', 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) { ...@@ -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() { ...@@ -65,3 +65,11 @@ export function paperBasketList() {
method: 'get', method: 'get',
}); });
} }
export function userLocation() {
return request({
url: '/user/userLocation',
method: 'get',
});
}
...@@ -7,7 +7,7 @@ import router from '@/router'; ...@@ -7,7 +7,7 @@ import router from '@/router';
import i18n from './lang'; // Internationalization import i18n from './lang'; // Internationalization
import '@/icons'; // icon import '@/icons'; // icon
import '@/permission'; // permission control import '@/permission'; // permission control
import AMap from 'vue-amap';
import * as filters from './filters'; // global filters import * as filters from './filters'; // global filters
Vue.use(ElementUI, { Vue.use(ElementUI, {
...@@ -27,4 +27,5 @@ new Vue({ ...@@ -27,4 +27,5 @@ new Vue({
store, store,
i18n, i18n,
render: h => h(App), render: h => h(App),
AMap,
}); });
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<script> <script>
import echarts from 'echarts'; import echarts from 'echarts';
import resize from './mixins/resize'; import resize from './mixins/resize';
import { getcount } from '@/api/homepage';
export default { export default {
mixins: [resize], mixins: [resize],
props: { props: {
...@@ -29,10 +29,13 @@ export default { ...@@ -29,10 +29,13 @@ export default {
data() { data() {
return { return {
chart: null, chart: null,
devicemover: [], // 设备数量
policedata: [], // 报警数量
userdata: [], // 用户数量
}; };
}, },
mounted() { created() {
this.initChart(); this.getcount();
}, },
beforeDestroy() { beforeDestroy() {
if (!this.chart) { if (!this.chart) {
...@@ -46,15 +49,16 @@ export default { ...@@ -46,15 +49,16 @@ export default {
this.chart = echarts.init(document.getElementById(this.id)); this.chart = echarts.init(document.getElementById(this.id));
const xData = (function() { const xData = (function() {
const data = []; const data = [];
for (let i = 1; i < 13; i++) { const date = new Date();
data.push(i + 'month'); for (let i = 1; i < date.getMonth() + 1 + 1; i++) {
data.push(i + '月');
} }
return data; return data;
}()); }());
this.chart.setOption({ this.chart.setOption({
backgroundColor: '#344b58', backgroundColor: '#344b58',
title: { title: {
text: 'statistics', text: '统计记录',
x: '20', x: '20',
top: '20', top: '20',
textStyle: { textStyle: {
...@@ -90,7 +94,7 @@ export default { ...@@ -90,7 +94,7 @@ export default {
textStyle: { textStyle: {
color: '#90979c', color: '#90979c',
}, },
data: ['female', 'male', 'average'], data: ['设备数量', '用户数量', '设备报警次数'],
}, },
calculable: true, calculable: true,
xAxis: [{ xAxis: [{
...@@ -160,7 +164,7 @@ export default { ...@@ -160,7 +164,7 @@ export default {
}], }],
series: [ series: [
{ {
name: 'female', name: '设备数量',
type: 'bar', type: 'bar',
stack: 'total', stack: 'total',
barMaxWidth: 35, barMaxWidth: 35,
...@@ -180,23 +184,10 @@ export default { ...@@ -180,23 +184,10 @@ export default {
}, },
}, },
}, },
data: [ data: this.devicemover,
709,
1917,
2455,
2610,
1719,
1433,
1544,
3285,
5208,
3372,
2484,
4078,
],
}, },
{ {
name: 'male', name: '用户数量',
type: 'bar', type: 'bar',
stack: 'total', stack: 'total',
itemStyle: { itemStyle: {
...@@ -212,22 +203,9 @@ export default { ...@@ -212,22 +203,9 @@ export default {
}, },
}, },
}, },
data: [ data: this.userdata,
327,
1776,
507,
1200,
800,
482,
204,
1390,
1001,
951,
381,
220,
],
}, { }, {
name: 'average', name: '设备报警次数',
type: 'line', type: 'line',
stack: 'total', stack: 'total',
symbolSize: 10, symbolSize: 10,
...@@ -245,24 +223,25 @@ export default { ...@@ -245,24 +223,25 @@ export default {
}, },
}, },
}, },
data: [ data: this.policedata,
1036,
3693,
2962,
3810,
2519,
1915,
1748,
4675,
6209,
4323,
2865,
4298,
],
}, },
], ],
}); });
}, },
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> </script>
...@@ -88,6 +88,8 @@ export default { ...@@ -88,6 +88,8 @@ export default {
thirdparty: 'Or connect with', thirdparty: 'Or connect with',
thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !', thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !',
email: 'Email', email: 'Email',
adminLogin: 'Administrator login',
userLogin: 'User login',
}, },
documentation: { documentation: {
documentation: 'Documentation', documentation: 'Documentation',
......
...@@ -88,6 +88,8 @@ export default { ...@@ -88,6 +88,8 @@ export default {
thirdparty: 'Или войдите с помощью', thirdparty: 'Или войдите с помощью',
thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !', thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !',
email: 'Email', email: 'Email',
adminLogin: 'Administrator login',
userLogin: 'User login',
}, },
documentation: { documentation: {
documentation: 'Документация', documentation: 'Документация',
......
...@@ -91,6 +91,8 @@ export default { ...@@ -91,6 +91,8 @@ export default {
any: 'any', any: 'any',
thirdparty: 'Hoặc đăng nhập với', 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! ! !', 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: {
documentation: 'Tài liệu', documentation: 'Tài liệu',
......
...@@ -93,6 +93,8 @@ export default { ...@@ -93,6 +93,8 @@ export default {
any: '随便填', any: '随便填',
thirdparty: '第三方登录', thirdparty: '第三方登录',
thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!', thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!',
adminLogin: '管理者登入',
userLogin: '用户登入',
}, },
documentation: { documentation: {
documentation: '文档', documentation: '文档',
......
...@@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title'; ...@@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title';
NProgress.configure({ showSpinner: false }); // NProgress Configuration 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) => { router.beforeEach(async(to, from, next) => {
// start progress bar // 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 { getToken, setToken, removeToken } from '@/utils/auth';
import router, { resetRouter } from '@/router'; import router, { resetRouter } from '@/router';
import store from '@/store'; import store from '@/store';
...@@ -53,7 +53,20 @@ const actions = { ...@@ -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 // get user info
getInfo({ commit, state }) { getInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
<template> <template>
<div class="dashboard-editor-container"> <div class="dashboard-editor-container">
<github-corner style="position: absolute; top: 0px; border: 0; right: 0;" />
<panel-group @handleSetLineChartData="handleSetLineChartData" /> <panel-group @handleSetLineChartData="handleSetLineChartData" />
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;"> <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
...@@ -41,7 +39,6 @@ ...@@ -41,7 +39,6 @@
</template> </template>
<script> <script>
// import GithubCorner from '@/components/GithubCorner';
import PanelGroup from './components/PanelGroup'; import PanelGroup from './components/PanelGroup';
import LineChart from './components/LineChart'; import LineChart from './components/LineChart';
import RaddarChart from './components/RaddarChart'; import RaddarChart from './components/RaddarChart';
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import PanThumb from '@/components/PanThumb'; import PanThumb from '@/components/PanThumb';
// import GithubCorner from '@/components/GithubCorner';
export default { export default {
name: 'DashboardEditor', name: 'DashboardEditor',
......
<template> <template>
<div class="dashboard-container"> <div class="app-container">
<component :is="currentRole" /> <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> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import Chart from '@/components/Charts/MixChart';
import adminDashboard from './admin'; import { homepagecount } from '@/api/homepage';
import editorDashboard from './editor';
export default { export default {
name: 'Dashboard', name: 'Dashboard',
components: { adminDashboard, editorDashboard }, components: { Chart },
data() { data() {
return { return {
currentRole: 'adminDashboard', reverse: true,
synthesizecount: [],
activities: [{
content: '活动按期开始',
timestamp: '2018-04-15',
}, {
content: '创建成功',
timestamp: '2018-04-11',
}],
}; };
}, },
computed: {
...mapGetters([
'roles',
]),
},
created() { created() {
if (!this.roles.includes('admin')) { this.getList();
this.currentRole = 'editorDashboard'; },
} methods: {
getList() {
homepagecount()
.then(response => {
this.synthesizecount = response.data;
})
.catch(err => {
console.log(err);
});
},
}, },
}; };
</script> </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 @@ ...@@ -79,7 +79,8 @@
</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 :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> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="170"> <el-table-column align="center" label="操作" width="170">
...@@ -95,7 +96,7 @@ ...@@ -95,7 +96,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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-dialog :visible.sync="dialogPvVisible" title="设备详情信息" width="50%">
<el-table :data="devicefistr"> <el-table :data="devicefistr">
......
<template> <template>
<div class="login-container"> <div class="login-container">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> <!-- <el-form-item prop="email">
<h3 class="title">
{{ $t('login.title') }}
</h3>
<lang-select class="set-language" />
<el-form-item prop="email">
<span class="svg-container"> <span class="svg-container">
<svg-icon icon-class="user" /> <svg-icon icon-class="user" />
</span> </span>
<el-input v-model="loginForm.email" name="email" type="text" auto-complete="on" :placeholder="$t('login.email')" /> <el-input v-model="loginForm.email" name="email" type="text" auto-complete="on" :placeholder="$t('login.email')" />
</el-form-item> </el-form-item> -->
<el-form-item prop="password"> <!-- <el-form-item prop="password">
<span class="svg-container"> <span class="svg-container">
<svg-icon icon-class="password" /> <svg-icon icon-class="password" />
</span> </span>
...@@ -23,19 +18,71 @@ ...@@ -23,19 +18,71 @@
:placeholder="$t('login.password')" :placeholder="$t('login.password')"
@keyup.enter.native="handleLogin" @keyup.enter.native="handleLogin"
/> />
<span class="show-pwd" @click="showPwd"> </el-form-item> -->
<svg-icon icon-class="eye" /> <!-- <el-form-item>
</span>
</el-form-item>
<el-form-item>
<el-button :loading="loading" type="primary" style="width:100%;" @click.native.prevent="handleLogin"> <el-button :loading="loading" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
登录 登录
</el-button> </el-button>
</el-form-item> </el-form-item> -->
<!-- <div class="tips"> <el-form ref="loginForm" :model="loginForm" class="login-form" auto-complete="on" label-position="left">
<span style="margin-right:20px;">Email: admin@laravue.dev</span> <h3 class="title" style="position: relative;top: -91px;left: -54px;">
<span>Password: laravue</span> {{ $t('login.title') }}
</div> --> </h3>
<lang-select class="set-language" style="top: -49px;right: 152px;" />
<div :class="adminusertype" style="margin-top: -72px;">
<div class="form sign-in">
<h2>{{ $t('login.adminLogin') }}</h2>
<label>
<el-form-item prop="email">
<el-input v-model="loginForm.email" name="email" type="text" auto-complete="on" :placeholder="$t('login.email')" />
</el-form-item>
</label>
<label>
<el-form-item prop="password">
<el-input v-model="loginForm.password" :type="pwdType" name="password" auto-complete="on" :placeholder="$t('login.password')" @keyup.enter.native="handleLogin" />
</el-form-item>
</label>
<span class="show-pwd" style="top: 196px;left: 435px;" @click="showPwd">
<svg-icon icon-class="eye" />
</span>
<el-form-item @click.native.prevent="handleLogin">
<button :loading="loading" type="primary" class="submit" style="245px">{{ $t('login.logIn') }}</button>
</el-form-item>
</div>
<div class="sub-cont">
<div class="img">
<div class="img__text m--up">
<h2>{{ $t('login.userLogin') }}</h2>
</div>
<div class="img__text m--in">
<h2>{{ $t('login.adminLogin') }}</h2>
</div>
<div class="img__btn" @click="admintype">
<span class="m--up">{{ $t('login.userLogin') }}</span>
<span class="m--in">{{ $t('login.logIn') }}</span>
</div>
</div>
<div class="form sign-up">
<h2>{{ $t('login.userLogin') }}</h2>
<label>
<el-form-item prop="email">
<el-input v-model="userloginForm.email" name="email" type="text" auto-complete="on" :placeholder="$t('login.email')" />
</el-form-item>
</label>
<label>
<el-form-item prop="password">
<el-input v-model="userloginForm.password" :type="pwdType" name="password" auto-complete="on" :placeholder="$t('login.password')" @keyup.enter.native="handleLogin" />
</el-form-item>
</label>
<span class="show-pwd" style="top: 196px;left: 435px;" @click="showPwd">
<svg-icon icon-class="eye" />
</span>
<el-form-item @click.native.prevent="userLogin">
<button :loading="loading" type="button" class="submit">{{ $t('login.logIn') }}</button>
</el-form-item>
</div>
</div>
</div>
</el-form> </el-form>
</div> </div>
</template> </template>
...@@ -43,6 +90,7 @@ ...@@ -43,6 +90,7 @@
<script> <script>
import LangSelect from '@/components/LangSelect'; import LangSelect from '@/components/LangSelect';
import { validEmail } from '@/utils/validate'; import { validEmail } from '@/utils/validate';
// import { userlogin } from '@/api/auth';
export default { export default {
name: 'Login', name: 'Login',
components: { LangSelect }, components: { LangSelect },
...@@ -66,6 +114,10 @@ export default { ...@@ -66,6 +114,10 @@ export default {
email: '', email: '',
password: '', password: '',
}, },
userloginForm: {
email: '',
password: '',
},
loginRules: { loginRules: {
email: [{ required: true, trigger: 'blur', validator: validateEmail }], email: [{ required: true, trigger: 'blur', validator: validateEmail }],
password: [{ required: true, trigger: 'blur', validator: validatePass }], password: [{ required: true, trigger: 'blur', validator: validatePass }],
...@@ -74,6 +126,11 @@ export default { ...@@ -74,6 +126,11 @@ export default {
pwdType: 'password', pwdType: 'password',
redirect: undefined, redirect: undefined,
activeName: 'second', activeName: 'second',
adminusertype: 'content',
userOrAdmin: 1,
limit: 10,
page: 1,
command: '泽宏科技',
}; };
}, },
watch: { watch: {
...@@ -95,23 +152,73 @@ export default { ...@@ -95,23 +152,73 @@ export default {
this.pwdType = 'password'; this.pwdType = 'password';
} }
}, },
admintype() {
if (this.userOrAdmin === 1) { // 用户
this.adminusertype = 'content s--signup';
this.userOrAdmin = 2;
} else if (this.userOrAdmin === 2) {
this.adminusertype = 'content';
this.userOrAdmin = 1;
}
},
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { if (this.loginForm.email === '') {
if (valid) { this.$message.error('邮箱不能为空');
this.loading = true; } else if (this.loginForm.password === '') {
this.$store.dispatch('user/login', this.loginForm) this.$message.error('密码不能为空');
.then(() => { } else {
this.$router.push({ path: this.redirect || '/' }); this.$prompt('请输入登入口令', '提示', {
this.loading = false; confirmButtonText: '确定',
}) cancelButtonText: '取消',
.catch(() => { }).then(({ value }) => {
this.loading = false; if (this.command === value) {
this.$message({
message: '口令正确!',
type: 'success',
}); });
} else { this.loading = true;
console.log('error submit!!'); this.$store.dispatch('user/login', this.loginForm)
return false; .then(() => {
} this.$router.push({ path: this.redirect || '/' });
}); this.loading = false;
})
.catch(() => {
this.loading = false;
});
} else {
this.$message.error('口令错误');
}
}).catch(() => {
this.$message({
type: 'info',
message: '取消输入',
});
});
}
},
userLogin() {
// this.$router.push({ path: '/redirect' + 'user/userslist' });
// if (this.userloginForm.email === '') {
// this.$message.error('邮箱不能为空');
// } else if (this.userloginForm.password === '') {
// this.$message.error('密码不能为空');
// } else {
// userlogin(this.userloginForm)
// .then(response => {
// this.$router.push({ path: '/user/userslist' });
// })
// .catch(err => {
// console.log(err);
// });
this.$store.dispatch('user/userlogin', this.userloginForm)
.then(() => {
this.$router.push({ path: '/redirect' + 'user/userslist' });
this.loading = false;
})
.catch(() => {
this.loading = false;
});
// }
}, },
}, },
}; };
...@@ -219,3 +326,280 @@ $light_gray:#eee; ...@@ -219,3 +326,280 @@ $light_gray:#eee;
} }
} }
</style> </style>
<style rel="stylesheet/scss" lang="scss" scoped>
*, *:before, *:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
background: #ededed;
}
input, button {
border: none;
outline: none;
background: none;
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}
.tip {
font-size: 20px;
margin: 40px auto 50px;
text-align: center;
}
.login-container /deep/ .el-input input {
color:black;
}
.login-container /deep/ .el-form-item {
background: 0;
}
.content {
overflow: hidden;
position: absolute;
left: 50%;
top: 50%;
width: 900px;
height: 550px;
margin: -300px 0 0 -450px;
background: #fff;
}
.form {
position: relative;
width: 640px;
height: 100%;
transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
padding: 50px 30px 0;
}
.sub-cont {
overflow: hidden;
position: absolute;
left: 640px;
top: 0;
width: 900px;
height: 100%;
padding-left: 260px;
background: #fff;
transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
}
.content.s--signup .sub-cont {
-webkit-transform: translate3d(-640px, 0, 0);
transform: translate3d(-640px, 0, 0);
}
button {
display: block;
margin: 0 auto;
width: 260px;
height: 36px;
border-radius: 30px;
color: #fff;
font-size: 15px;
cursor: pointer;
}
.img {
overflow: hidden;
z-index: 2;
position: absolute;
left: 0;
top: 0;
width: 260px;
height: 100%;
padding-top: 360px;
}
.img:before {
content: '';
position: absolute;
right: 0;
top: 0;
width: 900px;
height: 100%;
background-image: url('bg.jpg');
background-size: cover;
transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
}
.img:after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
}
.content.s--signup .img:before {
-webkit-transform: translate3d(640px, 0, 0);
transform: translate3d(640px, 0, 0);
}
.img__text {
z-index: 2;
position: absolute;
left: 0;
top: 50px;
width: 100%;
padding: 0 20px;
text-align: center;
color: #fff;
transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
}
.img__text h2 {
margin-bottom: 10px;
font-weight: normal;
}
.img__text p {
font-size: 14px;
line-height: 1.5;
}
.content.s--signup .img__text.m--up {
-webkit-transform: translateX(520px);
transform: translateX(520px);
}
.img__text.m--in {
-webkit-transform: translateX(-520px);
transform: translateX(-520px);
}
.content.s--signup .img__text.m--in {
-webkit-transform: translateX(0);
transform: translateX(0);
}
.img__btn {
overflow: hidden;
z-index: 2;
position: relative;
width: 100px;
height: 36px;
margin: 0 auto;
background: transparent;
color: #fff;
text-transform: uppercase;
font-size: 15px;
cursor: pointer;
}
.img__btn:after {
content: '';
z-index: 2;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border: 2px solid #fff;
border-radius: 30px;
}
.img__btn span {
position: absolute;
left: 0;
top: 0;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
transition: -webkit-transform 0.6s;
transition: transform 0.6s;
transition: transform 0.6s, -webkit-transform 0.6s;
}
.img__btn span.m--in {
-webkit-transform: translateY(-72px);
transform: translateY(-72px);
}
.content.s--signup .img__btn span.m--in {
-webkit-transform: translateY(0);
transform: translateY(0);
}
.content.s--signup .img__btn span.m--up {
-webkit-transform: translateY(72px);
transform: translateY(72px);
}
h2 {
width: 100%;
font-size: 26px;
text-align: center;
}
label {
display: block;
width: 260px;
margin: 25px auto 0;
text-align: center;
}
label span {
font-size: 12px;
color: #909399;
text-transform: uppercase;
}
input {
display: block;
width: 100%;
margin-top: 5px;
padding-bottom: 5px;
font-size: 16px;
border-bottom: 1px solid rgba(0, 0, 0, 0.4);
text-align: center;
}
.forgot-pass {
margin-top: 15px;
text-align: center;
font-size: 12px;
color: #cfcfcf;
}
.forgot-pass a {
color: #cfcfcf;
}
.submit {
margin-top: 40px;
margin-bottom: 20px;
background: #d4af7a;
text-transform: uppercase;
}
.fb-btn {
border: 2px solid #d3dae9;
color: #8fa1c7;
}
.fb-btn span {
font-weight: bold;
color: #455a81;
}
.sign-in {
transition-timing-function: ease-out;
}
.content.s--signup .sign-in {
transition-timing-function: ease-in-out;
transition-duration: 0.6s;
-webkit-transform: translate3d(640px, 0, 0);
transform: translate3d(640px, 0, 0);
}
.sign-up {
-webkit-transform: translate3d(-900px, 0, 0);
transform: translate3d(-900px, 0, 0);
}
.content.s--signup .sign-up {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
</style>
<template> <template>
<div>地图模式</div> <div>
</div>
</template> </template>
<script> <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> </script>
<style> <style>
......
<template> <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> </template>
<script> <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> </script>
<style> <style>
......
<template> <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> </template>
<script> <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> </script>
<style> <style>
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<script> <script>
import { deviceTypeList } from '@/api/device'; import { deviceTypeList } from '@/api/device';
import websocketurl from '@/api/configurl';
import BackToTop from '@/components/BackToTop'; import BackToTop from '@/components/BackToTop';
export default { export default {
components: { BackToTop }, components: { BackToTop },
...@@ -115,7 +116,7 @@ export default { ...@@ -115,7 +116,7 @@ export default {
}); });
}, },
initWebSocket(){ // 初始化weosocket initWebSocket(){ // 初始化weosocket
const wsuri = 'ws://127.0.0.1:9502'; const wsuri = websocketurl.baseURL;
this.websock = new WebSocket(wsuri); this.websock = new WebSocket(wsuri);
this.websock.onmessage = this.websocketonmessage; this.websock.onmessage = this.websocketonmessage;
this.websock.onopen = this.websocketonopen; this.websock.onopen = this.websocketonopen;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<div id="app"> <div id="app">
<app></app> <app></app>
</div> </div>
<script src=/static/tinymce4.7.5/tinymce.min.js></script> <script src=/static/tinymce4.7.5/tinymce.min.js></script>
<script src="{{ mix('js/vendor.js') }}"></script> <script src="{{ mix('js/vendor.js') }}"></script>
<script src="{{ mix('js/manifest.js') }}"></script> <script src="{{ mix('js/manifest.js') }}"></script>
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<div id="app"> <div id="app">
<app></app> <app></app>
</div> </div>
<script src=/static/tinymce4.7.5/tinymce.min.js></script> <script src=/static/tinymce4.7.5/tinymce.min.js></script>
<script src="{{ mix('js/app.js') }}"></script> <script src="{{ mix('js/app.js') }}"></script>
</body> </body>
......
...@@ -41,10 +41,11 @@ Route::group(['middleware' => 'auth:api'], function () { ...@@ -41,10 +41,11 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::get('user/UpPaperBasket/{id}','UserController@UpPaperBasket');//更新废纸篓和禁用用户 Route::get('user/UpPaperBasket/{id}','UserController@UpPaperBasket');//更新废纸篓和禁用用户
Route::get('user/UpuserForbidden/{id}','UserController@UpuserForbidden');//禁用此用户 Route::get('user/UpuserForbidden/{id}','UserController@UpuserForbidden');//禁用此用户
Route::get('user/paperBasket','UserController@paperBasket');//返回废纸篓数量 Route::get('user/paperBasket','UserController@paperBasket');//返回废纸篓数量
Route::get('user/paperBasketList','UserController@paperBasketList');//返回废纸篓和用户状态 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 (){ ...@@ -61,6 +62,12 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::post('SwooleCommand/SwooleCommand','SwooleCommandController@index'); 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::group(['middleware'=>'auth:api'],function (){
Route::get('devices/devicelist', 'DevicesController@devicelist');//设备列表 Route::get('devices/devicelist', 'DevicesController@devicelist');//设备列表
...@@ -81,6 +88,8 @@ Route::group(['middleware'=>'auth:api'],function (){ ...@@ -81,6 +88,8 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::get('devices/addClassify/{data}','DevicesController@addClassify');//添加分类 Route::get('devices/addClassify/{data}','DevicesController@addClassify');//添加分类
Route::get('devices/delteClassify/{id}','DevicesController@delteClassify');//删除分类 Route::get('devices/delteClassify/{id}','DevicesController@delteClassify');//删除分类
Route::get('devices/detedevice','DevicesController@detedevice');//查看历史数据 Route::get('devices/detedevice','DevicesController@detedevice');//查看历史数据
Route::get('devices/control','DevicesController@control');//返回消防监测
Route::get('devices/deviceLocation','DevicesController@deviceLocation');//返回设备安装位置
}); });
//装维中心 //装维中心
......
...@@ -39,5 +39,10 @@ module.exports = { ...@@ -39,5 +39,10 @@ module.exports = {
}, },
], ],
}, },
externals: {
'AMap': 'AMap',
'Loca': 'Loca',
'AMapUI': 'AMapUI',
},
plugins: plugins, 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