Commit 4e10ae55 authored by wangxiaoming's avatar wangxiaoming

平台修改 维护

parent 858179d4
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>巡检平台</title> <title>巡检平台</title>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script> <script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
...@@ -27,4 +27,5 @@ ...@@ -27,4 +27,5 @@
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
</html> </html>
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
* @see http://blog.csdn.net/win_lin/article/details/12065413 * @see http://blog.csdn.net/win_lin/article/details/12065413
*/ */
function padding(number, length, prefix) { function padding(number, length, prefix) {
if(String(number).length >= length){ if (String(number).length >= length) {
return String(number); return String(number);
} }
return padding(prefix+number, length, prefix); return padding(prefix + number, length, prefix);
} }
/** /**
...@@ -36,8 +36,8 @@ function system_array_remove(arr, elem) { ...@@ -36,8 +36,8 @@ function system_array_remove(arr, elem) {
return; return;
} }
var removed = true; let removed = true;
var i = 0; let i = 0;
while (removed) { while (removed) {
removed = false; removed = false;
for (; i < arr.length; i++) { for (; i < arr.length; i++) {
...@@ -79,17 +79,15 @@ function system_array_contains(arr, elem_or_function) { ...@@ -79,17 +79,15 @@ function system_array_contains(arr, elem_or_function) {
* system_array_get(arr, function(elem){return elem == 60;}); // null * system_array_get(arr, function(elem){return elem == 60;}); // null
*/ */
function system_array_get(arr, elem_or_function) { function system_array_get(arr, elem_or_function) {
for (var i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (typeof elem_or_function == "function") { if (typeof elem_or_function === 'function') {
if (elem_or_function(arr[i])) { if (elem_or_function(arr[i])) {
return arr[i]; return arr[i];
} }
} else { } else if (elem_or_function == arr[i]) {
if (elem_or_function == arr[i]) {
return arr[i]; return arr[i];
} }
} }
}
return null; return null;
} }
...@@ -109,7 +107,7 @@ function system_array_foreach(arr, pfn) { ...@@ -109,7 +107,7 @@ function system_array_foreach(arr, pfn) {
return false; return false;
} }
for (var i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (!pfn(arr[i], i)) { if (!pfn(arr[i], i)) {
return false; return false;
} }
...@@ -122,8 +120,8 @@ function system_array_foreach(arr, pfn) { ...@@ -122,8 +120,8 @@ function system_array_foreach(arr, pfn) {
* whether the str starts with flag. * whether the str starts with flag.
*/ */
function system_string_startswith(str, flag) { function system_string_startswith(str, flag) {
if (typeof flag == "object" && flag.constructor == Array) { if (typeof flag === 'object' && flag.constructor == Array) {
for (var i = 0; i < flag.length; i++) { for (let i = 0; i < flag.length; i++) {
if (system_string_startswith(str, flag[i])) { if (system_string_startswith(str, flag[i])) {
return true; return true;
} }
...@@ -137,8 +135,8 @@ function system_string_startswith(str, flag) { ...@@ -137,8 +135,8 @@ function system_string_startswith(str, flag) {
* whether the str ends with flag. * whether the str ends with flag.
*/ */
function system_string_endswith(str, flag) { function system_string_endswith(str, flag) {
if (typeof flag == "object" && flag.constructor == Array) { if (typeof flag === 'object' && flag.constructor == Array) {
for (var i = 0; i < flag.length; i++) { for (let i = 0; i < flag.length; i++) {
if (system_string_endswith(str, flag[i])) { if (system_string_endswith(str, flag[i])) {
return true; return true;
} }
...@@ -153,7 +151,7 @@ function system_string_endswith(str, flag) { ...@@ -153,7 +151,7 @@ function system_string_endswith(str, flag) {
* @param flag a string to trim. * @param flag a string to trim.
*/ */
function system_string_trim(str, flag) { function system_string_trim(str, flag) {
if (!flag || !flag.length || typeof flag != "string") { if (!flag || !flag.length || typeof flag !== 'string') {
return str; return str;
} }
...@@ -183,7 +181,7 @@ function array_sort_asc(elem_a, elem_b) { ...@@ -183,7 +181,7 @@ function array_sort_asc(elem_a, elem_b) {
if (elem_a > elem_b) { if (elem_a > elem_b) {
return 1; return 1;
} }
return (elem_a < elem_b)? -1 : 0; return (elem_a < elem_b) ? -1 : 0;
} }
function array_sort_desc(elem_a, elem_b) { function array_sort_desc(elem_a, elem_b) {
return -1 * array_sort_asc(elem_a, elem_b); return -1 * array_sort_asc(elem_a, elem_b);
...@@ -214,31 +212,31 @@ function system_array_sort_desc(elem_a, elem_b) { ...@@ -214,31 +212,31 @@ function system_array_sort_desc(elem_a, elem_b) {
} }
* @see: http://blog.csdn.net/win_lin/article/details/17994347 * @see: http://blog.csdn.net/win_lin/article/details/17994347
*/ */
function parse_query_string(){ function parse_query_string() {
var obj = {}; const obj = {};
// add the uri object. // add the uri object.
// parse the host(hostname:http_port), pathname(dir/filename) // parse the host(hostname:http_port), pathname(dir/filename)
obj.host = window.location.host; obj.host = window.location.host;
obj.hostname = window.location.hostname; obj.hostname = window.location.hostname;
obj.http_port = (window.location.port == "")? 80:window.location.port; obj.http_port = (window.location.port == '') ? 80 : window.location.port;
obj.pathname = window.location.pathname; obj.pathname = window.location.pathname;
if (obj.pathname.lastIndexOf("/") <= 0) { if (obj.pathname.lastIndexOf('/') <= 0) {
obj.dir = "/"; obj.dir = '/';
obj.filename = ""; obj.filename = '';
} else { } else {
obj.dir = obj.pathname.substr(0, obj.pathname.lastIndexOf("/")); obj.dir = obj.pathname.substr(0, obj.pathname.lastIndexOf('/'));
obj.filename = obj.pathname.substr(obj.pathname.lastIndexOf("/")); obj.filename = obj.pathname.substr(obj.pathname.lastIndexOf('/'));
} }
// pure user query object. // pure user query object.
obj.user_query = {}; obj.user_query = {};
// parse the query string. // parse the query string.
var query_string = String(window.location.search).replace(" ", "").split("?")[1]; let query_string = String(window.location.search).replace(' ', '').split('?')[1];
if(query_string == undefined){ if (query_string == undefined) {
query_string = String(window.location.hash).replace(" ", "").split("#")[1]; query_string = String(window.location.hash).replace(' ', '').split('#')[1];
if(query_string == undefined){ if (query_string == undefined) {
return obj; return obj;
} }
} }
...@@ -257,15 +255,15 @@ function __fill_query(query_string, obj) { ...@@ -257,15 +255,15 @@ function __fill_query(query_string, obj) {
} }
// split again for angularjs. // split again for angularjs.
if (query_string.indexOf("?") >= 0) { if (query_string.indexOf('?') >= 0) {
query_string = query_string.split("?")[1]; query_string = query_string.split('?')[1];
} }
var queries = query_string.split("&"); const queries = query_string.split('&');
for (var i = 0; i < queries.length; i++) { for (let i = 0; i < queries.length; i++) {
var elem = queries[i]; const elem = queries[i];
var query = elem.split("="); const query = elem.split('=');
obj[query[0]] = query[1]; obj[query[0]] = query[1];
obj.user_query[query[0]] = query[1]; obj.user_query[query[0]] = query[1];
} }
...@@ -292,25 +290,25 @@ function __fill_query(query_string, obj) { ...@@ -292,25 +290,25 @@ function __fill_query(query_string, obj) {
*/ */
function parse_rtmp_url(rtmp_url) { function parse_rtmp_url(rtmp_url) {
// @see: http://stackoverflow.com/questions/10469575/how-to-use-location-object-to-parse-url-without-redirecting-the-page-in-javascri // @see: http://stackoverflow.com/questions/10469575/how-to-use-location-object-to-parse-url-without-redirecting-the-page-in-javascri
var a = document.createElement("a"); const a = document.createElement('a');
a.href = rtmp_url.replace("rtmp://", "http://") a.href = rtmp_url.replace('rtmp://', 'http://')
.replace("webrtc://", "http://") .replace('webrtc://', 'http://')
.replace("rtc://", "http://"); .replace('rtc://', 'http://');
var vhost = a.hostname; let vhost = a.hostname;
var app = a.pathname.substr(1, a.pathname.lastIndexOf("/") - 1); let app = a.pathname.substr(1, a.pathname.lastIndexOf('/') - 1);
var stream = a.pathname.substr(a.pathname.lastIndexOf("/") + 1); const stream = a.pathname.substr(a.pathname.lastIndexOf('/') + 1);
// parse the vhost in the params of app, that srs supports. // parse the vhost in the params of app, that srs supports.
app = app.replace("...vhost...", "?vhost="); app = app.replace('...vhost...', '?vhost=');
if (app.indexOf("?") >= 0) { if (app.indexOf('?') >= 0) {
var params = app.substr(app.indexOf("?")); const params = app.substr(app.indexOf('?'));
app = app.substr(0, app.indexOf("?")); app = app.substr(0, app.indexOf('?'));
if (params.indexOf("vhost=") > 0) { if (params.indexOf('vhost=') > 0) {
vhost = params.substr(params.indexOf("vhost=") + "vhost=".length); vhost = params.substr(params.indexOf('vhost=') + 'vhost='.length);
if (vhost.indexOf("&") > 0) { if (vhost.indexOf('&') > 0) {
vhost = vhost.substr(0, vhost.indexOf("&")); vhost = vhost.substr(0, vhost.indexOf('&'));
} }
} }
} }
...@@ -318,19 +316,19 @@ function parse_rtmp_url(rtmp_url) { ...@@ -318,19 +316,19 @@ function parse_rtmp_url(rtmp_url) {
// when vhost equals to server, and server is ip, // when vhost equals to server, and server is ip,
// the vhost is __defaultVhost__ // the vhost is __defaultVhost__
if (a.hostname == vhost) { if (a.hostname == vhost) {
var re = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; const re = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
if (re.test(a.hostname)) { if (re.test(a.hostname)) {
vhost = "__defaultVhost__"; vhost = '__defaultVhost__';
} }
} }
// parse the schema // parse the schema
var schema = "rtmp"; let schema = 'rtmp';
if (rtmp_url.indexOf("://") > 0) { if (rtmp_url.indexOf('://') > 0) {
schema = rtmp_url.substr(0, rtmp_url.indexOf("://")); schema = rtmp_url.substr(0, rtmp_url.indexOf('://'));
} }
var port = a.port; let { port } = a;
if (!port) { if (!port) {
if (schema === 'http') { if (schema === 'http') {
port = 80; port = 80;
...@@ -339,15 +337,18 @@ function parse_rtmp_url(rtmp_url) { ...@@ -339,15 +337,18 @@ function parse_rtmp_url(rtmp_url) {
} else if (schema === 'rtmp') { } else if (schema === 'rtmp') {
port = 1935; port = 1935;
} else if (schema === 'webrtc' || schema === 'rtc') { } else if (schema === 'webrtc' || schema === 'rtc') {
port = (window.location.href.indexOf('https://')==0)? 443:1985; port = (window.location.href.indexOf('https://') == 0) ? 443 : 1985;
} }
} }
var ret = { const ret = {
url: rtmp_url, url: rtmp_url,
schema: schema, schema,
server: a.hostname, port: port, server: a.hostname,
vhost: vhost, app: app, stream: stream port,
vhost,
app,
stream,
}; };
__fill_query(a.search, ret); __fill_query(a.search, ret);
...@@ -361,7 +362,7 @@ function parse_rtmp_url(rtmp_url) { ...@@ -361,7 +362,7 @@ function parse_rtmp_url(rtmp_url) {
* @see: http://blog.csdn.net/win_lin/article/details/17994347 * @see: http://blog.csdn.net/win_lin/article/details/17994347
*/ */
function get_browser_agents() { function get_browser_agents() {
var agent = navigator.userAgent; const agent = navigator.userAgent;
/** /**
WindowsPC platform, Win7: WindowsPC platform, Win7:
...@@ -392,17 +393,17 @@ function get_browser_agents() { ...@@ -392,17 +393,17 @@ function get_browser_agents() {
return { return {
// platform // platform
Android: agent.indexOf("Android") != -1, Android: agent.indexOf('Android') != -1,
Windows: agent.indexOf("Windows") != -1, Windows: agent.indexOf('Windows') != -1,
iPhone: agent.indexOf("iPhone") != -1, iPhone: agent.indexOf('iPhone') != -1,
// Windows Browsers // Windows Browsers
Chrome: agent.indexOf("Chrome") != -1, Chrome: agent.indexOf('Chrome') != -1,
Firefox: agent.indexOf("Firefox") != -1, Firefox: agent.indexOf('Firefox') != -1,
QQBrowser: agent.indexOf("QQBrowser") != -1, QQBrowser: agent.indexOf('QQBrowser') != -1,
MSIE: agent.indexOf("MSIE") != -1, MSIE: agent.indexOf('MSIE') != -1,
// Android Browsers // Android Browsers
Opera: agent.indexOf("Presto") != -1, Opera: agent.indexOf('Presto') != -1,
MQQBrowser: agent.indexOf("MQQBrowser") != -1 MQQBrowser: agent.indexOf('MQQBrowser') != -1,
}; };
} }
...@@ -412,13 +413,13 @@ function get_browser_agents() { ...@@ -412,13 +413,13 @@ function get_browser_agents() {
* @see: http://blog.csdn.net/win_lin/article/details/17994347 * @see: http://blog.csdn.net/win_lin/article/details/17994347
* @usage relative_seconds_to_HHMMSS(210) * @usage relative_seconds_to_HHMMSS(210)
*/ */
function relative_seconds_to_HHMMSS(seconds){ function relative_seconds_to_HHMMSS(seconds) {
var date = new Date(); const date = new Date();
date.setTime(Number(seconds) * 1000); date.setTime(Number(seconds) * 1000);
var ret = padding(date.getUTCHours(), 2, '0') const ret = `${padding(date.getUTCHours(), 2, '0')
+ ":" + padding(date.getUTCMinutes(), 2, '0') }:${padding(date.getUTCMinutes(), 2, '0')
+ ":" + padding(date.getUTCSeconds(), 2, '0'); }:${padding(date.getUTCSeconds(), 2, '0')}`;
return ret; return ret;
} }
...@@ -429,13 +430,13 @@ function relative_seconds_to_HHMMSS(seconds){ ...@@ -429,13 +430,13 @@ function relative_seconds_to_HHMMSS(seconds){
* @see: http://blog.csdn.net/win_lin/article/details/17994347 * @see: http://blog.csdn.net/win_lin/article/details/17994347
* @usage absolute_seconds_to_HHMMSS(new Date().getTime() / 1000) * @usage absolute_seconds_to_HHMMSS(new Date().getTime() / 1000)
*/ */
function absolute_seconds_to_HHMMSS(seconds){ function absolute_seconds_to_HHMMSS(seconds) {
var date = new Date(); const date = new Date();
date.setTime(Number(seconds) * 1000); date.setTime(Number(seconds) * 1000);
var ret = padding(date.getHours(), 2, '0') const ret = `${padding(date.getHours(), 2, '0')
+ ":" + padding(date.getMinutes(), 2, '0') }:${padding(date.getMinutes(), 2, '0')
+ ":" + padding(date.getSeconds(), 2, '0'); }:${padding(date.getSeconds(), 2, '0')}`;
return ret; return ret;
} }
...@@ -447,12 +448,12 @@ function absolute_seconds_to_HHMMSS(seconds){ ...@@ -447,12 +448,12 @@ function absolute_seconds_to_HHMMSS(seconds){
* @usage absolute_seconds_to_YYYYmmdd(new Date().getTime() / 1000) * @usage absolute_seconds_to_YYYYmmdd(new Date().getTime() / 1000)
*/ */
function absolute_seconds_to_YYYYmmdd(seconds) { function absolute_seconds_to_YYYYmmdd(seconds) {
var date = new Date(); const date = new Date();
date.setTime(Number(seconds) * 1000); date.setTime(Number(seconds) * 1000);
var ret = date.getFullYear() const ret = `${date.getFullYear()
+ "-" + padding(date.getMonth() + 1, 2, '0') }-${padding(date.getMonth() + 1, 2, '0')
+ "-" + padding(date.getDate(), 2, '0'); }-${padding(date.getDate(), 2, '0')}`;
return ret; return ret;
} }
...@@ -464,7 +465,7 @@ function absolute_seconds_to_YYYYmmdd(seconds) { ...@@ -464,7 +465,7 @@ function absolute_seconds_to_YYYYmmdd(seconds) {
* @usage YYYYmmdd_parse("2014-12-11") * @usage YYYYmmdd_parse("2014-12-11")
*/ */
function YYYYmmdd_parse(str) { function YYYYmmdd_parse(str) {
var date = new Date(); const date = new Date();
date.setTime(Date.parse(str)); date.setTime(Date.parse(str));
return date; return date;
} }
...@@ -513,28 +514,28 @@ function AsyncRefresh(pfn, refresh_interval) { ...@@ -513,28 +514,28 @@ function AsyncRefresh(pfn, refresh_interval) {
/** /**
* disable the refresher, the pfn must check the refresh state. * disable the refresher, the pfn must check the refresh state.
*/ */
AsyncRefresh.prototype.refresh_disable = function() { AsyncRefresh.prototype.refresh_disable = function () {
this.__enabled = false; this.__enabled = false;
} };
AsyncRefresh.prototype.refresh_enable = function() { AsyncRefresh.prototype.refresh_enable = function () {
this.__enabled = true; this.__enabled = true;
} };
AsyncRefresh.prototype.refresh_is_enabled = function() { AsyncRefresh.prototype.refresh_is_enabled = function () {
return this.__enabled; return this.__enabled;
} };
/** /**
* start new async request * start new async request
* @param timeout the timeout in ms. * @param timeout the timeout in ms.
* user can use the refresh_interval of the AsyncRefresh object, * user can use the refresh_interval of the AsyncRefresh object,
* which initialized in constructor. * which initialized in constructor.
*/ */
AsyncRefresh.prototype.request = function(timeout) { AsyncRefresh.prototype.request = function (timeout) {
if (this.__handler) { if (this.__handler) {
clearTimeout(this.__handler); clearTimeout(this.__handler);
} }
this.__handler = setTimeout(this.__pfn, timeout); this.__handler = setTimeout(this.__pfn, timeout);
} };
/** /**
* async refresh v2, support cancellable refresh, and change the refresh pfn. * async refresh v2, support cancellable refresh, and change the refresh pfn.
...@@ -586,36 +587,36 @@ function AsyncRefresh2() { ...@@ -586,36 +587,36 @@ function AsyncRefresh2() {
pfn: null, pfn: null,
timeout: 0, timeout: 0,
__enabled: false, __enabled: false,
__handler: null __handler: null,
}; };
} }
// singleton // singleton
var async_refresh2 = new AsyncRefresh2(); const async_refresh2 = new AsyncRefresh2();
/** /**
* initialize or refresh change. cancel previous request, setup new request. * initialize or refresh change. cancel previous request, setup new request.
* @param pfn a function():void to request after timeout. null to disable refresher. * @param pfn a function():void to request after timeout. null to disable refresher.
* @param timeout the timeout in ms, to call pfn. null to disable refresher. * @param timeout the timeout in ms, to call pfn. null to disable refresher.
*/ */
AsyncRefresh2.prototype.initialize = function(pfn, timeout) { AsyncRefresh2.prototype.initialize = function (pfn, timeout) {
this.refresh_change(pfn, timeout); this.refresh_change(pfn, timeout);
} };
/** /**
* stop refresh, the refresh pfn is set to null. * stop refresh, the refresh pfn is set to null.
*/ */
AsyncRefresh2.prototype.stop = function() { AsyncRefresh2.prototype.stop = function () {
this.__call.__enabled = false; this.__call.__enabled = false;
} };
/** /**
* restart refresh, use previous config. * restart refresh, use previous config.
*/ */
AsyncRefresh2.prototype.restart = function() { AsyncRefresh2.prototype.restart = function () {
this.__call.__enabled = true; this.__call.__enabled = true;
this.request(0); this.request(0);
} };
/** /**
* change refresh pfn, the old pfn will set to disabled. * change refresh pfn, the old pfn will set to disabled.
*/ */
AsyncRefresh2.prototype.refresh_change = function(pfn, timeout) { AsyncRefresh2.prototype.refresh_change = function (pfn, timeout) {
// cancel the previous call. // cancel the previous call.
if (this.__call.__handler) { if (this.__call.__handler) {
clearTimeout(this.__handler); clearTimeout(this.__handler);
...@@ -624,20 +625,20 @@ AsyncRefresh2.prototype.refresh_change = function(pfn, timeout) { ...@@ -624,20 +625,20 @@ AsyncRefresh2.prototype.refresh_change = function(pfn, timeout) {
// setup new call. // setup new call.
this.__call = { this.__call = {
pfn: pfn, pfn,
timeout: timeout, timeout,
__enabled: true, __enabled: true,
__handler: null __handler: null,
}; };
} };
/** /**
* start new request, we never auto start the request, * start new request, we never auto start the request,
* user must start new request when previous completed. * user must start new request when previous completed.
* @param timeout [optional] if not specified, use the timeout in initialize or refresh_change. * @param timeout [optional] if not specified, use the timeout in initialize or refresh_change.
*/ */
AsyncRefresh2.prototype.request = function(timeout) { AsyncRefresh2.prototype.request = function (timeout) {
var self = this; const self = this;
var this_call = this.__call; const this_call = this.__call;
// clear previous timeout. // clear previous timeout.
if (this_call.__handler) { if (this_call.__handler) {
...@@ -654,7 +655,7 @@ AsyncRefresh2.prototype.request = function(timeout) { ...@@ -654,7 +655,7 @@ AsyncRefresh2.prototype.request = function(timeout) {
return; return;
} }
this_call.__handler = setTimeout(function(){ this_call.__handler = setTimeout(() => {
// cancelled by refresh_change, ignore. // cancelled by refresh_change, ignore.
if (!this_call.__enabled) { if (!this_call.__enabled) {
return; return;
...@@ -670,7 +671,7 @@ AsyncRefresh2.prototype.request = function(timeout) { ...@@ -670,7 +671,7 @@ AsyncRefresh2.prototype.request = function(timeout) {
// do the actual call. // do the actual call.
this_call.pfn(); this_call.pfn();
}, timeout); }, timeout);
} };
// other components. // other components.
/** /**
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
console.log("liveUrl"+url); console.log("liveUrl"+url);
//"webrtc://152.136.233.116/live/livestream" //"webrtc://152.136.233.116/live/livestream"
var urlObject = parse_rtmp_url(url); var urlObject = parse_rtmp_url(url);
/*urlObject*/
var schema = window.location.protocol; var schema = window.location.protocol;
// Close PC when user replay. // Close PC when user replay.
...@@ -78,7 +79,7 @@ ...@@ -78,7 +79,7 @@
return pc.setLocalDescription(offer).then(function(){ return offer; }); return pc.setLocalDescription(offer).then(function(){ return offer; });
}).then(function(offer) { }).then(function(offer) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
var port = urlObject.port || 1985; var port = 1985;
// @see https://github.com/rtcdn/rtcdn-draft // @see https://github.com/rtcdn/rtcdn-draft
var api = urlObject.user_query.play || '/rtc/v1/play/'; var api = urlObject.user_query.play || '/rtc/v1/play/';
...@@ -94,7 +95,7 @@ ...@@ -94,7 +95,7 @@
} }
// Replace /rtc/v1/play/&k=v to /rtc/v1/play/?k=v // Replace /rtc/v1/play/&k=v to /rtc/v1/play/?k=v
url = url.replace(api + '&', api + '?'); url = url.replace(api + '&', api + '?');
url=url.replace('https', 'http');
// @see https://github.com/rtcdn/rtcdn-draft // @see https://github.com/rtcdn/rtcdn-draft
var data = { var data = {
api: url, streamurl: urlObject.url, clientip: null, sdp: offer.sdp api: url, streamurl: urlObject.url, clientip: null, sdp: offer.sdp
...@@ -102,7 +103,7 @@ ...@@ -102,7 +103,7 @@
console.log("Generated offer: ", data); console.log("Generated offer: ", data);
$.ajax({ $.ajax({
type: "POST", url: url, data: JSON.stringify(data), type: "POST", url: "https://xj.roadgrids.com/liveUrl", data: JSON.stringify(data),
contentType:'application/json', dataType: 'json' contentType:'application/json', dataType: 'json'
}).done(function(data) { }).done(function(data) {
console.log("Got answer: ", data); console.log("Got answer: ", data);
......
src/assets/logo_new.png

6.47 KB | W: | H:

src/assets/logo_new.png

19.6 KB | W: | H:

src/assets/logo_new.png
src/assets/logo_new.png
src/assets/logo_new.png
src/assets/logo_new.png
  • 2-up
  • Swipe
  • Onion skin
const address = '/roadlinks/'; const address = '/roadlinks/';
const videoAddress = 'http://106.52.130.113:8000'; const videoAddress = 'https://xj.roadgrids.com';
const photoAddress = 'http://106.52.130.113:8000'; const photoAddress = 'https://xj.roadgrids.com';
const imgAddress = '/roadlinks/';// 测试环境 const imgAddress = '/roadlinks/';// 测试环境
const title = '安徽省道路综合巡检平台'; const title = '道路综合巡检平台';
export { export {
address, photoAddress, imgAddress, videoAddress, address, photoAddress, imgAddress, videoAddress,
}; };
...@@ -2,7 +2,7 @@ const address = '/roadlinks/'; ...@@ -2,7 +2,7 @@ const address = '/roadlinks/';
const videoAddress = 'http://106.52.130.113:8000'; const videoAddress = 'http://106.52.130.113:8000';
const photoAddress = 'http://106.52.130.113:8000'; const photoAddress = 'http://106.52.130.113:8000';
const imgAddress = '/roadlinks/';// 测试环境 const imgAddress = '/roadlinks/';// 测试环境
const title = '安徽省道路综合巡检平台'; const title = '道路综合巡检平台';
export { export {
address, photoAddress, imgAddress, videoAddress, address, photoAddress, imgAddress, videoAddress,
}; };
const address = '/roadlinks/'; const address = 'http://localhost:8088/roadlinks/';
const videoAddress = 'http://106.52.130.113:8000'; const videoAddress = 'https://xj.roadgrids.com';
const photoAddress = 'http://106.52.130.113:8000'; const photoAddress = 'https://xj.roadgrids.com';
const imgAddress = '/roadlinks/';// 测试环境 const imgAddress = '/roadlinks/';// 测试环境
const title = '安徽省道路综合巡检平台'; const title = '道路综合巡检平台';
export { export {
address, photoAddress, imgAddress, videoAddress, address, photoAddress, imgAddress, videoAddress,
}; };
// eslint-disable-next-line import/extensions
import requestBlob from '@/excel/request-blob.js';
import { address } from '../config';
export function exportResultDetail(data) {
return requestBlob({
url: `${address}exportResultDetail`,
method: 'post',
data,
});
}
import axios from 'axios';
import Cookies from 'js-cookie';
// create an axios instance
const service = axios.create({
baseURL: '/', // url = base url + request url
withCredentials: true, // send cookies when cross-domain requests
timeout: 1800000, // request timeout
});
// request interceptor
service.interceptors.request.use(
(config) => {
// do something before request is sent
const token = Cookies.get('id');
if (token) {
config.headers = {
AuthId: token,
Authorization: `Bearer ${token}`,
};
}
config.responseType = 'blob';
return config;
},
(error) => {
// do something with request error
console.log(error); // for debug
return Promise.reject(error);
},
);
export default service;
...@@ -32,12 +32,28 @@ Vue.use(BaiduMap, { ...@@ -32,12 +32,28 @@ Vue.use(BaiduMap, {
Object.defineProperty(Vue.prototype, '$moment', { value: moment }); Object.defineProperty(Vue.prototype, '$moment', { value: moment });
Object.defineProperty(Vue.prototype, '$_', { value: _ }); Object.defineProperty(Vue.prototype, '$_', { value: _ });
var _hmt = _hmt || [];
window._hmt = _hmt; // 必须把_hmt挂载到window下,否则找不到
(function () {
const hm = document.createElement('script');
hm.src = 'https://hm.baidu.com/hm.js?264c2115edc746cbdd76f5fa44b60c26';
const s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
}());
Vue.config.productionTip = false; Vue.config.productionTip = false;
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
window.scrollTo(0, 0); window.scrollTo(0, 0);
if (to.matched.some(record => record.meta.requireAuth)) { if (to.matched.some(record => record.meta.requireAuth)) {
// 判断该路由是否需要登录权限 // 判断该路由是否需要登录权限
if (Cookies.get('id')) { // 判断当前的token是否存在 if (Cookies.get('id')) { // 判断当前的token是否存在
if (_hmt) {
if (to.path) {
_hmt.push(['_trackPageview', `/#${to.fullPath}`]);
}
}
next(); next();
} else { } else {
// next(); // next();
...@@ -55,7 +71,7 @@ axios.interceptors.request.use( ...@@ -55,7 +71,7 @@ axios.interceptors.request.use(
(config) => { (config) => {
config.baseURL = '/'; config.baseURL = '/';
config.withCredentials = true; // 允许携带token ,这个是解决跨域产生的相关问题 config.withCredentials = true; // 允许携带token ,这个是解决跨域产生的相关问题
config.timeout = 6000; config.timeout = 60000;
const token = Cookies.get('id'); const token = Cookies.get('id');
if (token) { if (token) {
config.headers = { config.headers = {
...@@ -84,7 +100,8 @@ const permission = { ...@@ -84,7 +100,8 @@ const permission = {
const roles = JSON.parse(localStorage.getItem('permission')); const roles = JSON.parse(localStorage.getItem('permission'));
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {
const permissionRoles = value; const permissionRoles = value;
const hasPermission = roles.some(role => permissionRoles.includes(role));
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (!hasPermission) { if (!hasPermission) {
el.parentNode && el.parentNode.removeChild(el); el.parentNode && el.parentNode.removeChild(el);
} }
......
...@@ -5,6 +5,9 @@ const permission = { ...@@ -5,6 +5,9 @@ const permission = {
userAuthorization: '004', userAuthorization: '004',
equipmentList_edit: '002.001', equipmentList_edit: '002.001',
userManagement_edit: '003.001', userManagement_edit: '003.001',
resultCheck_edit: '005.001',
provincePermission: '2',
cityPermission: '3',
}; };
export { export {
permission, permission,
......
...@@ -7,6 +7,46 @@ ...@@ -7,6 +7,46 @@
<!--搜索栏--> <!--搜索栏-->
<el-col :span="24" class="toolbar"> <el-col :span="24" class="toolbar">
<el-form :inline="true" :model="filters"> <el-form :inline="true" :model="filters">
<el-form-item v-permission="[permission.provincePermission]">
<el-select
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:260px"
multiple
collapse-tags
clearable
filterable
placeholder="请选择省份"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select
v-permission="[permission.provincePermission]"
v-model="filters.cityIds"
multiple
collapse-tags
style="width:260px"
clearable
filterable
placeholder="请选择管理处"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-model="filters.capitalType" v-model="filters.capitalType"
...@@ -30,7 +70,7 @@ ...@@ -30,7 +70,7 @@
></el-autocomplete>--> ></el-autocomplete>-->
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="getCapitalDetails">搜索</el-button> <el-button type="primary" @click="getCapitalDetails" v-loading="searchLoading">搜索</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
...@@ -44,6 +84,7 @@ ...@@ -44,6 +84,7 @@
:highlight-current-row="true" :highlight-current-row="true"
> >
<el-table-column label="序号" prop="no"></el-table-column> <el-table-column label="序号" prop="no"></el-table-column>
<el-table-column label="管理单位" prop="office"></el-table-column>
<el-table-column label="道路资产名称" prop="name"></el-table-column> <el-table-column label="道路资产名称" prop="name"></el-table-column>
<el-table-column label="道路资产位置信息" prop="position"></el-table-column> <el-table-column label="道路资产位置信息" prop="position"></el-table-column>
</el-table> </el-table>
...@@ -74,13 +115,20 @@ import { Message } from 'element-ui'; ...@@ -74,13 +115,20 @@ import { Message } from 'element-ui';
import echarts from 'echarts'; import echarts from 'echarts';
import moment from 'moment'; import moment from 'moment';
import { address, photoAddress } from '../config'; import { address, photoAddress } from '../config';
import { permission } from '../permission';
export default { export default {
name: 'detail', name: 'detail',
data() { data() {
return { return {
searchLoading: false,
permission,
provinceOptions: [],
cityOptions: [],
tableData: [], tableData: [],
filters: { filters: {
cityIds: [],
provinceIds: [],
capitalType: [], capitalType: [],
}, },
showCol: false, showCol: false,
...@@ -94,14 +142,68 @@ export default { ...@@ -94,14 +142,68 @@ export default {
}, },
mounted() {}, mounted() {},
created() { created() {
const searchVal = sessionStorage.getItem('detailSearchVal');
if (searchVal) {
this.filters = JSON.parse(searchVal);
}
if (this.$route.params.provinceIds) {
this.filters.provinceIds = this.$route.params.provinceIds;
}
if (this.$route.params.cityIds) {
this.filters.cityIds = this.$route.params.cityIds;
}
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
this.filters.capitalType = []; this.filters.capitalType = [];
if (this.$route.params.capitalName) { if (this.$route.params.capitalName) {
this.filters.capitalType.push(this.$route.params.capitalName); this.filters.capitalType.push(this.$route.params.capitalName);
} }
this.getCapitalDetails(); this.getCapitalDetails();
this.getAllCapitals(); this.getAllCapitals();
this.queryAllProvinceByPermission();
}, },
methods: { methods: {
queryAllProvinceByPermission() {
axios
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.provinceOptions = response.data.data;
}
}
})
.catch((error) => {
console.log(error);
});
},
queryCityByProvince(provinceId) {
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentIds: provinceId,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.cityOptions = response.data.data;
this.cityOptions.forEach((e) => {
e.name += '管理处';
});
}
}
})
.catch((error) => {
console.log(error);
});
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds.length > 0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
linkPic(index, row) { linkPic(index, row) {
this.getCurrentDate(); this.getCurrentDate();
const photoDate = row.finalOnlineTime const photoDate = row.finalOnlineTime
...@@ -235,8 +337,8 @@ export default { ...@@ -235,8 +337,8 @@ export default {
if (response.data.code === 200) { if (response.data.code === 200) {
this.capitalOptions = []; this.capitalOptions = [];
if (response.data.data) { if (response.data.data) {
/* console.log(response.data.data);*/ /* console.log(response.data.data); */
const capitals = response.data.data; const capitals = response.data.data.sdServices;
const nameSet = new Set(); const nameSet = new Set();
capitals.forEach((val) => { capitals.forEach((val) => {
nameSet.add(val.capitalName); nameSet.add(val.capitalName);
...@@ -254,6 +356,12 @@ export default { ...@@ -254,6 +356,12 @@ export default {
}); });
}, },
getCapitalDetails() { getCapitalDetails() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (hasPermission && this.filters.provinceIds.length == 0) {
return;
}
this.currentPage = 1; this.currentPage = 1;
let capitalName = ''; let capitalName = '';
if (this.filters.capitalType) { if (this.filters.capitalType) {
...@@ -265,12 +373,21 @@ export default { ...@@ -265,12 +373,21 @@ export default {
} }
}); });
} }
this.searchLoading = true;
sessionStorage.setItem(
'detailSearchVal',
JSON.stringify(this.filters),
);
axios axios
.post(`${address}getCapitalDetails`, { .post(`${address}getCapitalDetails`, {
capitalName, capitalName,
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
}) })
.then((response) => { .then((response) => {
if (response.data.code === 200) { if (response.data.code === 200) {
this.searchLoading = false;
this.tableData = []; this.tableData = [];
this.no = 0; this.no = 0;
if (response.data.data) { if (response.data.data) {
...@@ -286,6 +403,7 @@ export default { ...@@ -286,6 +403,7 @@ export default {
nameMap.set(val.capitalName, num); nameMap.set(val.capitalName, num);
} }
this.tableData.push({ this.tableData.push({
office: val.office,
no: ++this.no, no: ++this.no,
name: val.capitalName + num, name: val.capitalName + num,
position: val.position, position: val.position,
...@@ -295,6 +413,7 @@ export default { ...@@ -295,6 +413,7 @@ export default {
} }
}) })
.catch((error) => { .catch((error) => {
this.searchLoading = false;
console.log(error); console.log(error);
}); });
}, },
......
...@@ -13,9 +13,16 @@ ...@@ -13,9 +13,16 @@
<div v-if="provinceId ==109"> <div v-if="provinceId ==109">
<img style="width:100px;height:80px" src="../assets/logo_anhui.png" alt /> <img style="width:100px;height:80px" src="../assets/logo_anhui.png" alt />
</div> </div>
<div v-else-if="provinceId != 109"> <div v-else-if="provinceId == 239">
<img style="width:100px;height:80px" src="../assets/logo_new.png" alt /> <img style="width:100px;height:100px" src="../assets/logo_guangxi.png" alt />
</div> </div>
<div v-else-if="provinceId == 1 && myId==9">
<img style="width:100px;height:100px" src="../assets/logo_zhongguogonglu.png" alt />
</div>
<div v-else-if="provinceId!=109">
<img style="width:180px;height:45px" src="../assets/logo_new.png" alt />
</div>
</div> </div>
<el-submenu index="1"> <el-submenu index="1">
...@@ -94,7 +101,7 @@ ...@@ -94,7 +101,7 @@
</el-menu-item> </el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="6" v-permission="[permission.userAuthorization,permission.userManagement]"> <el-submenu index="6" >
<span slot="title" class="submenu_parent" >&nbsp;&nbsp;账户管理&nbsp;&nbsp;</span> <span slot="title" class="submenu_parent" >&nbsp;&nbsp;账户管理&nbsp;&nbsp;</span>
<el-menu-item <el-menu-item
v-permission="[permission.userManagement]" v-permission="[permission.userManagement]"
...@@ -112,13 +119,13 @@ ...@@ -112,13 +119,13 @@
> >
<span slot="title" style="font-size: 16px">授权账户</span> <span slot="title" style="font-size: 16px">授权账户</span>
</el-menu-item> </el-menu-item>
<!-- <el-menu-item <el-menu-item
index="6-3" index="6-3"
@click="goTo('/resetPassword')" @click="goTo('/resetPassword')"
style="background:#252639 !important" style="background:#252639 !important"
> >
<span slot="title" style="font-size: 16px">修改密码</span> <span slot="title" style="font-size: 16px">修改密码</span>
</el-menu-item>--> </el-menu-item>
</el-submenu> </el-submenu>
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
......
...@@ -6,6 +6,45 @@ ...@@ -6,6 +6,45 @@
<!--搜索栏--> <!--搜索栏-->
<el-col :span="24" class="toolbar"> <el-col :span="24" class="toolbar">
<el-form :inline="true" :model="filters"> <el-form :inline="true" :model="filters">
<el-form-item v-permission="[permission.provincePermission]">
<el-select
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:260px"
multiple
collapse-tags
clearable
filterable
placeholder="请选择省份"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item v-permission="[permission.provincePermission]">
<el-select
v-model="filters.cityIds"
multiple
collapse-tags
style="width:260px"
clearable
filterable
placeholder="请选择管理处"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-model="filters.equipment" v-model="filters.equipment"
...@@ -60,8 +99,8 @@ ...@@ -60,8 +99,8 @@
</div> </div>
</div> </div>
<el-dialog :visible.sync="isShowVideo" width="1000px" height="5900px"> <el-dialog :visible.sync="isShowVideo" width="760px" height="550px">
<iframe style="width:100%;height:600px" id="live" :src=playerSrc></iframe> <iframe style="width:100%;height:580px" id="live" :src=playerSrc></iframe>
<!-- <video-player <!-- <video-player
@play="onPlayerPlay($event)" @play="onPlayerPlay($event)"
...@@ -105,11 +144,15 @@ import 'video.js/dist/video-js.css'; ...@@ -105,11 +144,15 @@ import 'video.js/dist/video-js.css';
import 'vue-video-player/src/custom-theme.css'; import 'vue-video-player/src/custom-theme.css';
import 'videojs-flash'; import 'videojs-flash';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { permission } from '../permission';
export default { export default {
name: 'video', name: 'video',
data() { data() {
return { return {
permission,
provinceOptions: [],
cityOptions: [],
playerSrc: '', playerSrc: '',
isShowTip: false, isShowTip: false,
plateNoOptions: [], plateNoOptions: [],
...@@ -123,6 +166,8 @@ export default { ...@@ -123,6 +166,8 @@ export default {
totalCount: 0, totalCount: 0,
}, },
filters: { filters: {
cityIds: [],
provinceIds: [],
equipment: [], equipment: [],
}, },
loading: false, loading: false,
...@@ -174,8 +219,8 @@ export default { ...@@ -174,8 +219,8 @@ export default {
}, },
timer: '', timer: '',
liveUrl: 'webrtc://152.136.233.116/live/', liveUrl: 'webrtc://146.56.198.18:8080/live/',
liveIp: '?eip=152.136.233.116', liveIp: '?eip=146.56.198.18',
}; };
}, },
watch: { watch: {
...@@ -189,8 +234,9 @@ export default { ...@@ -189,8 +234,9 @@ export default {
this.timer = setInterval(this.watchLive, 10000); this.timer = setInterval(this.watchLive, 10000);
}, },
created() { created() {
this.queryAllProvinceByPermission();
this.queryAllEquipment(); this.queryAllEquipment();
const searchVal = sessionStorage.getItem('videoSearchVal'); const searchVal = sessionStorage.getItem('liveSearchVal');
const that = this; const that = this;
if (this.$route.params.startTime) { if (this.$route.params.startTime) {
...@@ -211,10 +257,62 @@ export default { ...@@ -211,10 +257,62 @@ export default {
} else if (searchVal) { } else if (searchVal) {
this.filters = JSON.parse(searchVal); this.filters = JSON.parse(searchVal);
} }
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
this.getParkVideos(); this.getParkVideos();
this.getLiveUrl();
}, },
methods: { methods: {
getLiveUrl() {
axios
.get(`${address}getLiveIp`, {})
.then((response) => {
if (response.data.code === 200) {
this.liveUrl = `webrtc://${response.data.data}/live/`;
this.liveIp = `?eip=${response.data.data}`;
}
});
},
queryAllProvinceByPermission() {
axios
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.provinceOptions = response.data.data;
}
}
})
.catch((error) => {
console.log(error);
});
},
queryCityByProvince(provinceId) {
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentIds: provinceId,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.cityOptions = response.data.data;
this.cityOptions.forEach((e) => {
e.name += '管理处';
});
}
}
})
.catch((error) => {
console.log(error);
});
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds.length>0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
liveStop() { liveStop() {
this.playerOptions.sources[0].src = ''; this.playerOptions.sources[0].src = '';
axios axios
...@@ -314,9 +412,10 @@ export default { ...@@ -314,9 +412,10 @@ export default {
if (response.data.data && response.data.data.length > 0) { if (response.data.data && response.data.data.length > 0) {
const channelAndDevid = `${item.code}_${item.channelCode}`; const channelAndDevid = `${item.code}_${item.channelCode}`;
const random = Math.random(); const random = Math.random();
//webrtc:// 152.136.233.116/live/DefaultstringE3060400FFFBEBBF_zjhn?eip=152.136.233.116 // webrtc:// 152.136.233.116/live/DefaultstringE3060400FFFBEBBF_zjhn?eip=152.136.233.116
// this.playerSrc = `players/rtc_player.html?url=${this.liveUrl}DefaultstringE3060400FFFBEBBF_zjhn${this.liveIp}&random=${random}`; // this.playerSrc = `players/rtc_player.html?url=${this.liveUrl}DefaultstringE3060400FFFBEBBF_zjhn${this.liveIp}&random=${random}`;
this.playerSrc = `players/rtc_player.html?url=${this.liveUrl}${channelAndDevid}${this.liveIp}&random=${random}`; this.playerSrc = `players/rtc_player.html?url=${this.liveUrl}${channelAndDevid}${this.liveIp}&random=${random}`;
/* const channel = item.channelCode; /* const channel = item.channelCode;
const devid = item.code; const devid = item.code;
const src = `http://152.136.233.116:1965/live/${devid}_${channel}.m3u8`; const src = `http://152.136.233.116:1965/live/${devid}_${channel}.m3u8`;
...@@ -366,13 +465,23 @@ export default { ...@@ -366,13 +465,23 @@ export default {
}, },
getParkVideos() { getParkVideos() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (hasPermission && this.filters.provinceIds.length == 0 && this.filters.equipment.length == 0) {
return;
}
this.searchLoading = true; this.searchLoading = true;
const that = this; const that = this;
sessionStorage.setItem('liveSearchVal', JSON.stringify(this.filters));
axios axios
.post(`${address}getParkLives`, { .post(`${address}getParkLives`, {
cityIds: that.filters.cityIds,
provinceIds: that.filters.provinceIds,
equipment: that.filters.equipment, equipment: that.filters.equipment,
pageIndex: this.pageOption.pageIndex, pageIndex: that.pageOption.pageIndex,
pageSize: this.pageOption.pageSize, pageSize: that.pageOption.pageSize,
}) })
.then((response) => { .then((response) => {
that.searchLoading = false; that.searchLoading = false;
......
...@@ -14,20 +14,20 @@ ...@@ -14,20 +14,20 @@
> >
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input
auto-complete="new-password"
@keyup.enter.native="handleLogin" @keyup.enter.native="handleLogin"
v-model="loginForm.username" v-model="loginForm.username"
auto-complete="off" placeholder="请输入用户名"
placeholder="请输入手机号"
> >
<i slot="prefix" class="elxingmingyonghumingnicheng"></i> <i slot="prefix" class="elxingmingyonghumingnicheng"></i>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input
auto-complete="new-password"
@keyup.enter.native="handleLogin" @keyup.enter.native="handleLogin"
:type="passwordType" :type="passwordType"
v-model="loginForm.password" v-model="loginForm.password"
auto-complete="off"
placeholder="请输入密码" placeholder="请输入密码"
> >
<i <i
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
...@@ -84,7 +86,7 @@ export default { ...@@ -84,7 +86,7 @@ export default {
loginRules: { loginRules: {
// 绑定在form表单中的验证规则 // 绑定在form表单中的验证规则
username: [ username: [
{ required: true, message: '请输入手机号', trigger: 'blur' }, { required: true, message: '请输入用户名', trigger: 'blur' },
{ validator: this.isExists, trigger: 'blur' }, { validator: this.isExists, trigger: 'blur' },
], ],
...@@ -104,6 +106,21 @@ export default { ...@@ -104,6 +106,21 @@ export default {
computed: {}, computed: {},
props: [], props: [],
methods: { methods: {
changeFavicon(provinceId) {
const $favicon = document.querySelector('link[rel="icon"]');
// If a <link rel="icon"> element already exists,
// change its href to the given link.
if ($favicon !== null) {
if (provinceId == 239) {
$favicon.href = 'favicon_guangxi.ico';
} else {
$favicon.href = 'favicon.ico';
}
// Otherwise, create a new element and append it to <head>.
}
},
isExists(rule, value, callback) { isExists(rule, value, callback) {
axios axios
.post(`${address}getUserInfoByUserName`, { .post(`${address}getUserInfoByUserName`, {
...@@ -111,12 +128,12 @@ export default { ...@@ -111,12 +128,12 @@ export default {
}).then((res) => { }).then((res) => {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (res.data.code != 200) { if (res.data.code != 200) {
callback(new Error('手机号不存在')); callback(new Error('用户名不存在'));
} else { } else {
callback(); callback();
} }
}).catch(() => { }).catch(() => {
callback(new Error('手机号不存在')); callback(new Error('用户名不存在'));
}); });
}, },
// 跳转到home页 // 跳转到home页
...@@ -142,6 +159,8 @@ export default { ...@@ -142,6 +159,8 @@ export default {
? (this.passwordType = 'password') ? (this.passwordType = 'password')
: (this.passwordType = ''); : (this.passwordType = '');
}, },
// 点击登入按钮 // 点击登入按钮
handleLogin() { handleLogin() {
this.$refs.loginForm.validate((valid) => { this.$refs.loginForm.validate((valid) => {
...@@ -154,13 +173,16 @@ export default { ...@@ -154,13 +173,16 @@ export default {
}) })
.then((response) => { .then((response) => {
if (response.data.code === 200) { if (response.data.code === 200) {
sessionStorage.clear();
Cookies.set('id', response.data.data.id); Cookies.set('id', response.data.data.id);
Cookies.set('username', this.loginForm.username); Cookies.set('username', this.loginForm.username);
Cookies.set('sessionId', response.data.data.sessionId); Cookies.set('sessionId', response.data.data.sessionId);
sessionStorage.setItem('modifyPasswordStatus', response.data.data.modifyStatus);
store.state.provinceId = response.data.data.provinceId; store.state.provinceId = response.data.data.provinceId;
store.state.permissionList = response.data.data.permissionList; store.state.permissionList = response.data.data.permissionList;
localStorage.setItem('permission', JSON.stringify(store.state.permissionList)); localStorage.setItem('permission', JSON.stringify(store.state.permissionList));
localStorage.setItem('provinceId', store.state.provinceId); localStorage.setItem('provinceId', store.state.provinceId);
this.changeFavicon(store.state.provinceId);
this.goToHome(); this.goToHome();
} else { } else {
Message({ Message({
......
<template> <template>
<div class="overview"> <div class="overview">
<div class="box"> <div class="box">
<el-row class="warp"> <el-row class="warp">
<div class="overview-line">{{office}}管理处道路资产汇总情况如下,总共{{totalnum}}个。</div> <el-col :span="24" class="warp-breadcrum" v-permission="[permission.provincePermission]">
<!--搜索栏-->
<el-form :inline="true" :model="filters">
<el-form-item>
<el-select
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:260px"
multiple
collapse-tags
clearable
filterable
placeholder="请选择省份"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select
v-model="filters.cityIds"
multiple
collapse-tags
style="width:260px"
clearable
filterable
placeholder="请选择管理处"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item style="margin-left:50px">
<el-button type="primary" v-loading="searchLoading"
@click="getAllCapitals">搜索
</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<div class="overview-line" v-show="totalnum>0">{{office}} 资产汇总情况如下,总共{{totalnum}}个。</div>
<!-- 任务表 --> <!-- 任务表 -->
<div class="overview-table"> <div class="overview-table">
<el-table <el-table
...@@ -45,9 +94,22 @@ ...@@ -45,9 +94,22 @@
<h3>任务统计</h3> <h3>任务统计</h3>
<div class="echarts-box" id="echarts-box"></div> <div class="echarts-box" id="echarts-box"></div>
</div>--> </div>-->
</el-row>
</div> </div>
<el-dialog
:before-close="handleClose"
:visible.sync="dialogVisible"
width="30%">
<span style="color: orangered;font-size: large">为了保障您的账户安全,请修改密码</span>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="goModifyPass">确 定</el-button>
<el-button @click="handleClose">取 消</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -55,13 +117,20 @@ import axios from 'axios'; ...@@ -55,13 +117,20 @@ import axios from 'axios';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
import echarts from 'echarts'; import echarts from 'echarts';
import moment from 'moment'; import moment from 'moment';
import Cookies from 'js-cookie';
import { address } from '../config'; import { address } from '../config';
import { permission } from '../permission';
export default { export default {
name: 'overview', name: 'overview',
data() { data() {
return { return {
office: '淮南', dialogVisible: false,
permission,
searchLoading: false,
provinceOptions: [],
cityOptions: [],
office: '',
tableData: [], tableData: [],
typeData: [ typeData: [
{ value: 0, label: '全部' }, { value: 0, label: '全部' },
...@@ -74,6 +143,8 @@ export default { ...@@ -74,6 +143,8 @@ export default {
{ value: false, label: '未启用' }, { value: false, label: '未启用' },
], ],
filters: { filters: {
cityIds: [],
provinceIds: [],
equipmentNo: '', equipmentNo: '',
plateNo: '', plateNo: '',
channel: '', channel: '',
...@@ -97,10 +168,110 @@ export default { ...@@ -97,10 +168,110 @@ export default {
}, },
mounted() {}, mounted() {},
created() { created() {
this.dialogVisible = sessionStorage.getItem('modifyPasswordStatus') == 0;
const searchVal = sessionStorage.getItem('overviewSearchVal');
if (searchVal) {
this.filters = JSON.parse(searchVal);
}
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
// this.getCurrentDate(); // this.getCurrentDate();
this.getAllCapitals(); this.getAllCapitals();
this.queryAllProvinceByPermission();
this.changeFavicon(localStorage.getItem('provinceId'));
/* this.awaitDemo(); */
}, },
methods: { methods: {
/* sleep(second) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(' enough sleep~');
}, second);
});
},
normalFunc() {
console.log('normalFunc');
},
async awaitDemo() {
await this.normalFunc();
console.log('something, ~~');
const result = await this.sleep(2000);
console.log(result);// 两秒之后会被打印出来
},
*/
changeFavicon(provinceId) {
const $favicon = document.querySelector('link[rel="icon"]');
// If a <link rel="icon"> element already exists,
// change its href to the given link.
if ($favicon !== null) {
if (provinceId == 239) {
$favicon.href = 'favicon_guangxi.ico';
} else if (provinceId == 1 && Cookies.get('id') == 9) {
$favicon.href = 'favicon_zhongguo.ico';
} else {
$favicon.href = 'favicon.ico';
}
// Otherwise, create a new element and append it to <head>.
}
},
handleClose() {
sessionStorage.removeItem('modifyPasswordStatus');
this.dialogVisible = false;
},
goModifyPass() {
sessionStorage.removeItem('modifyPasswordStatus');
this.$router.push({
name: 'resetPassword',
params: {
},
});
},
queryAllProvinceByPermission() {
axios
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.provinceOptions = response.data.data;
}
}
})
.catch((error) => {
console.log(error);
});
},
queryCityByProvince(provinceId) {
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentIds: provinceId,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.cityOptions = response.data.data;
this.cityOptions.forEach((e) => {
e.name += '管理处';
});
}
}
})
.catch((error) => {
console.log(error);
});
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds.length > 0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
setUpFont({ setUpFont({
row, column, rowIndex, columnIndex, row, column, rowIndex, columnIndex,
}) { }) {
...@@ -113,6 +284,8 @@ export default { ...@@ -113,6 +284,8 @@ export default {
this.$router.push({ this.$router.push({
name: 'detail', name: 'detail',
params: { params: {
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
capitalName: row.name, capitalName: row.name,
}, },
}); });
...@@ -196,16 +369,33 @@ export default { ...@@ -196,16 +369,33 @@ export default {
console.log(this.currentPage); // 点击第几页 console.log(this.currentPage); // 点击第几页
}, },
getAllCapitals() { getAllCapitals() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (hasPermission && this.filters.provinceIds.length == 0) {
return;
}
this.searchLoading = true;
sessionStorage.setItem(
'overviewSearchVal',
JSON.stringify(this.filters),
);
axios axios
.post(`${address}getAllCapitals`, {}) .post(`${address}getAllCapitals`, {
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
})
.then((response) => { .then((response) => {
if (response.data.code === 200) { if (response.data.code === 200) {
this.searchLoading = false;
this.tableData = []; this.tableData = [];
this.no = 0; this.no = 0;
this.tableId = 0; this.tableId = 0;
if (response.data.data) { if (response.data.data) {
/* console.log(`llllll${JSON.stringify(response.data.data)}`); */ /* console.log(`llllll${JSON.stringify(response.data.data)}`); */
const capitals = response.data.data; this.office = response.data.data.office;
const capitals = response.data.data.sdServices;
this.totalnum = capitals.length; this.totalnum = capitals.length;
const capitalTypeMap = new Map(); const capitalTypeMap = new Map();
const capitalNameMap = new Map(); const capitalNameMap = new Map();
...@@ -269,11 +459,11 @@ export default { ...@@ -269,11 +459,11 @@ export default {
} }
this.tableData.push(tableItem); this.tableData.push(tableItem);
} }
/* console.log(`llllllll${JSON.stringify(this.tableData)}`); */
} }
} }
}) })
.catch((error) => { .catch((error) => {
this.searchLoading = false;
console.log(error); console.log(error);
}); });
}, },
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
</div> </div>
<div class="formBody"> <div class="formBody">
<h1 class="section-title" data-i18n-text>注册账户</h1> <h1 class="section-title" data-i18n-text>注册账户</h1>
<el-form <el-form
:model="ruleForm2" :model="ruleForm2"
status-icon status-icon
...@@ -15,8 +16,13 @@ ...@@ -15,8 +16,13 @@
label-width="120px" label-width="120px"
class="demo-ruleForm" class="demo-ruleForm"
> >
<el-form-item label="手机号" prop="user"> <input type="text" style="display: none;" >
<el-input v-model="ruleForm2.user" placeholder="请输入手机号"></el-input> <input type="password" style="display: none;" >
<el-form-item label="用户名" prop="user">
<el-input v-model="ruleForm2.user" placeholder="请输入用户名"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phoneNum">
<el-input v-model="ruleForm2.phoneNum" placeholder="请输入手机号"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="姓名" prop="realName"> <el-form-item label="姓名" prop="realName">
<el-input v-model="ruleForm2.realName" placeholder="请输入姓名"></el-input> <el-input v-model="ruleForm2.realName" placeholder="请输入姓名"></el-input>
...@@ -43,6 +49,7 @@ ...@@ -43,6 +49,7 @@
clearable clearable
filterable filterable
placeholder="请选择市区" placeholder="请选择市区"
autocomplete="new-password"
> >
<el-option <el-option
v-for="item in cityOptions" v-for="item in cityOptions"
...@@ -56,10 +63,10 @@ ...@@ -56,10 +63,10 @@
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="pass"> <el-form-item label="密码" prop="pass">
<el-input type="password" v-model="ruleForm2.pass" autocomplete="off"></el-input> <el-input type="password" v-model="ruleForm2.pass" auto-complete="new-password" ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="checkPass"> <el-form-item label="确认密码" prop="checkPass">
<el-input type="password" v-model="ruleForm2.checkPass" autocomplete="off"></el-input> <el-input type="password" v-model="ruleForm2.checkPass" auto-complete="new-password" ></el-input>
</el-form-item> </el-form-item>
<el-form-item style="text-align: center ;margin-left:-120px"> <el-form-item style="text-align: center ;margin-left:-120px">
...@@ -103,6 +110,7 @@ export default { ...@@ -103,6 +110,7 @@ export default {
provinceOptions: [], provinceOptions: [],
cityOptions: [], cityOptions: [],
ruleForm2: { ruleForm2: {
phoneNum: '',
provinceId: '', provinceId: '',
cityId: '', cityId: '',
realName: '', realName: '',
...@@ -119,16 +127,21 @@ export default { ...@@ -119,16 +127,21 @@ export default {
{ validator: validatePass2, trigger: 'blur' }, { validator: validatePass2, trigger: 'blur' },
{ min: 6, message: '密码长度最少为6位', trigger: 'blur' }, { min: 6, message: '密码长度最少为6位', trigger: 'blur' },
], ],
user: [{ required: true, message: '请输入手机号', trigger: 'blur' }, user: [{ required: true, message: '请输入用户名', trigger: 'blur' },
],
phoneNum: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ {
min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur', min: 11, max: 11, message: '请输入11位用户名', trigger: 'blur',
}, },
{ validator: this.isAuth, trigger: 'blur' },
{ {
pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/, pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
message: '请输入正确的手机号码', message: '请输入正确的用户名',
trigger: 'blur', trigger: 'blur',
}, },
{ validator: this.isAuth, trigger: 'blur' }], ],
}, },
}; };
...@@ -140,7 +153,7 @@ export default { ...@@ -140,7 +153,7 @@ export default {
isAuth(rule, value, callback) { isAuth(rule, value, callback) {
axios axios
.post(`${address}getUserAuthInfoByUserName`, { .post(`${address}getUserAuthInfoByUserName`, {
username: this.ruleForm2.user, username: this.ruleForm2.phoneNum,
}).then((res) => { }).then((res) => {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (res.data.code != 200) { if (res.data.code != 200) {
...@@ -154,14 +167,17 @@ export default { ...@@ -154,14 +167,17 @@ export default {
}, },
getCityOptions() { getCityOptions() {
this.cityOptions = []; this.cityOptions = [];
if (this.ruleForm2.provinceId) { if (this.ruleForm2.provinceId) {
this.queryCityByProvince(this.ruleForm2.provinceId); this.queryCityByProvince(this.ruleForm2.provinceId);
} }
}, },
queryCityByProvince(provinceId) { queryCityByProvince(provinceId) {
const parentIds = [];
parentIds.push(provinceId);
axios axios
.post(`${address}selectAllAreasByLevelByParent`, { .post(`${address}selectAllAreasByLevelByParent`, {
parentId: provinceId, parentIds,
}) })
.then((response) => { .then((response) => {
if (response.data.code === 200) { if (response.data.code === 200) {
...@@ -208,12 +224,13 @@ export default { ...@@ -208,12 +224,13 @@ export default {
console.log(this.ruleForm2.user + this.ruleForm2.pass); console.log(this.ruleForm2.user + this.ruleForm2.pass);
axios axios
.post(`${address}register`, { .post(`${address}register`, {
phoneNum: this.ruleForm2.phoneNum,
username: this.ruleForm2.user, username: this.ruleForm2.user,
password: this.ruleForm2.pass, password: this.ruleForm2.pass,
status: 1, status: 1,
cityId:this.ruleForm2.cityId, cityId: this.ruleForm2.cityId,
provinceId:this.ruleForm2.provinceId, provinceId: this.ruleForm2.provinceId,
realName:this.ruleForm2.realName, realName: this.ruleForm2.realName,
}) })
.then((response) => { .then((response) => {
if (response.data.code === 200) { if (response.data.code === 200) {
......
...@@ -7,6 +7,47 @@ ...@@ -7,6 +7,47 @@
<!--搜索栏--> <!--搜索栏-->
<el-col :span="24" class="toolbar"> <el-col :span="24" class="toolbar">
<el-form :inline="true" :model="filters"> <el-form :inline="true" :model="filters">
<el-form-item
v-permission="[permission.provincePermission]">
<el-select
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:260px"
multiple
collapse-tags
clearable
filterable
placeholder="请选择省份"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
v-permission="[permission.provincePermission]">
<el-select
v-model="filters.cityIds"
multiple
collapse-tags
style="width:260px"
clearable
filterable
placeholder="请选择管理处"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-model="filters.plateNo" v-model="filters.plateNo"
...@@ -72,6 +113,7 @@ ...@@ -72,6 +113,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="80" label="序号" type="index" prop="index" align="center"></el-table-column> <el-table-column width="80" label="序号" type="index" prop="index" align="center"></el-table-column>
<el-table-column width="120" label="管理单位" prop="office" align="center"></el-table-column>
<el-table-column width="120" label="车牌号" prop="plateNo" align="center"></el-table-column> <el-table-column width="120" label="车牌号" prop="plateNo" align="center"></el-table-column>
<el-table-column width="240" label="起始时间 - 终止时间" prop="startEndTime" align="center"></el-table-column> <el-table-column width="240" label="起始时间 - 终止时间" prop="startEndTime" align="center"></el-table-column>
<el-table-column width="200" label="起点 - 终点" prop="startEndPoint" align="center"></el-table-column> <el-table-column width="200" label="起点 - 终点" prop="startEndPoint" align="center"></el-table-column>
...@@ -359,16 +401,20 @@ import gcoord from 'gcoord'; ...@@ -359,16 +401,20 @@ import gcoord from 'gcoord';
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
import moment from 'moment'; import moment from 'moment';
import { export_json_to_excel } from '@/excel/Export2Excel'; import { export_json_to_excel } from '@/excel/Export2Excel';
import Cookies from 'js-cookie';
import { permission } from '../permission';
import { import {
address, photoAddress, address, photoAddress,
} from '../config'; } from '../config';
export default { export default {
name: 'result', name: 'result',
data() { data() {
return { return {
permission,
provinceOptions: [],
cityOptions: [],
contentstr: '', contentstr: '',
isShowMark: false, isShowMark: false,
markObj: { markObj: {
...@@ -389,6 +435,8 @@ export default { ...@@ -389,6 +435,8 @@ export default {
allPoints: [], allPoints: [],
imgs: [], imgs: [],
filters: { filters: {
cityIds: [],
provinceIds: [],
plateNo: [], plateNo: [],
dateTime: [], dateTime: [],
}, },
...@@ -557,17 +605,30 @@ export default { ...@@ -557,17 +605,30 @@ export default {
}; };
}, },
mounted() { mounted() {
},
created() {
if (this.$route.params.startTime && this.$route.params.endTime) { if (this.$route.params.startTime && this.$route.params.endTime) {
this.filters.dateTime = [ this.filters.dateTime = [
this.$route.params.startTime, this.$route.params.startTime,
this.$route.params.endTime, this.$route.params.endTime,
]; ];
} }
if (this.$route.params.provinceIds) {
this.filters.provinceIds = this.$route.params.provinceIds;
}
if (this.$route.params.cityIds) {
this.filters.cityIds = this.$route.params.cityIds;
}
if (this.$route.params.equipment) { if (this.$route.params.equipment) {
const { equipment } = this.$route.params.equipment; const { equipment } = this.$route.params;
if (equipment) {
this.filters.plateNo = equipment.split(','); this.filters.plateNo = equipment.split(',');
} }
}
if (this.filters.dateTime.length > 0 || this.filters.plateNo.length > 0) { if (this.filters.dateTime.length > 0 || this.filters.plateNo.length > 0) {
// do nothing // do nothing
...@@ -577,7 +638,22 @@ export default { ...@@ -577,7 +638,22 @@ export default {
this.filters = JSON.parse(searchVal); this.filters = JSON.parse(searchVal);
} }
} }
if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment(
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 00:00:00`;
this.filters.dateTime[1] = `${moment(
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 23:59:59`;
}
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
this.radioIndex = 0; this.radioIndex = 0;
this.queryAllProvinceByPermission();
this.queryAllEquipment(); this.queryAllEquipment();
this.getInspectResultForTableData(); this.getInspectResultForTableData();
this.queryTravel(); this.queryTravel();
...@@ -587,7 +663,45 @@ export default { ...@@ -587,7 +663,45 @@ export default {
}, },
methods: { methods: {
queryAllProvinceByPermission() {
axios
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.provinceOptions = response.data.data;
}
}
})
.catch((error) => {
console.log(error);
});
},
queryCityByProvince(provinceId) {
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentIds: provinceId,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.cityOptions = response.data.data;
this.cityOptions.forEach((e) => {
e.name += '管理处';
});
}
}
})
.catch((error) => {
console.log(error);
});
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds.length > 0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
handleSizeChange(size) { handleSizeChange(size) {
this.pagesize = size; this.pagesize = size;
}, },
...@@ -654,9 +768,11 @@ export default { ...@@ -654,9 +768,11 @@ export default {
'巡检里程', '巡检里程',
'巡检资产', '巡检资产',
'正常资产', '正常资产',
'丢失资产',
'新增资产',
'路面抛洒物', '路面抛洒物',
'护栏弯曲', '护栏弯曲',
'新增资产',
]; ];
// filterVal为tHeader标题对应的键值 // filterVal为tHeader标题对应的键值
const filterVal = [ const filterVal = [
...@@ -667,16 +783,17 @@ export default { ...@@ -667,16 +783,17 @@ export default {
'inspectDistance', 'inspectDistance',
'inspectNum', 'inspectNum',
'normalNum', 'normalNum',
'abNormalNum',
'newInspectNum',
'roadLetterNum', 'roadLetterNum',
'guardrailNum', 'guardrailNum',
'newInspectNum',
]; ];
// list为要转化为excel文件的数据,是一个数组 // list为要转化为excel文件的数据,是一个数组
const list = this.tableData; const list = this.tableData;
// 用map方法处理list数据 // 用map方法处理list数据
const data = list.map(v => filterVal.map(j => v[j])); const data = list.map(v => filterVal.map(j => v[j]));
// 自定义excel文件名 // 自定义excel文件名
const fileName = '巡检结果'; const fileName = '巡检结果查看';
export_json_to_excel(tHeader, data, fileName); export_json_to_excel(tHeader, data, fileName);
}); });
}, },
...@@ -871,6 +988,13 @@ export default { ...@@ -871,6 +988,13 @@ export default {
}, },
getInspectResultForTableData() { getInspectResultForTableData() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (hasPermission && this.filters.provinceIds.length == 0 && this.filters.plateNo.length == 0) {
return;
}
if (this.filters.dateTime.length === 0) { if (this.filters.dateTime.length === 0) {
this.filters.dateTime = [ this.filters.dateTime = [
`${moment( `${moment(
...@@ -901,6 +1025,8 @@ export default { ...@@ -901,6 +1025,8 @@ export default {
startTime: that.filters.dateTime[0], startTime: that.filters.dateTime[0],
endTime: that.filters.dateTime[1], endTime: that.filters.dateTime[1],
equipment: equipmentCode, equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
}) })
.then((response) => { .then((response) => {
that.tableData = []; that.tableData = [];
...@@ -908,6 +1034,7 @@ export default { ...@@ -908,6 +1034,7 @@ export default {
// console.log(JSON.stringify(response.data.data)); // console.log(JSON.stringify(response.data.data));
response.data.data.forEach((val) => { response.data.data.forEach((val) => {
that.tableData.push({ that.tableData.push({
office: `${val.office}管理处`,
startUrl: require('../assets/img/qidian.png'), startUrl: require('../assets/img/qidian.png'),
endUrl: require('../assets/img/zhongdian.png'), endUrl: require('../assets/img/zhongdian.png'),
startLng: val.startLng, startLng: val.startLng,
...@@ -965,7 +1092,13 @@ export default { ...@@ -965,7 +1092,13 @@ export default {
}, },
queryTravel() { queryTravel() {
sessionStorage.setItem('searchVal', JSON.stringify(this.filters)); const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (hasPermission && this.filters.provinceIds.length == 0 && this.filters.plateNo.length == 0) {
return;
}
if (this.filters.dateTime.length === 0) { if (this.filters.dateTime.length === 0) {
this.filters.dateTime = [ this.filters.dateTime = [
`${moment( `${moment(
...@@ -981,13 +1114,13 @@ export default { ...@@ -981,13 +1114,13 @@ export default {
if (this.filters.plateNo && this.filters.plateNo.length > 0) { if (this.filters.plateNo && this.filters.plateNo.length > 0) {
this.filters.plateNo.forEach((item) => { this.filters.plateNo.forEach((item) => {
if (equipmentCode === '') { if (equipmentCode === '') {
equipmentCode += item.code; equipmentCode += item;
} else { } else {
equipmentCode += `,${item.code}`; equipmentCode += `,${item}`;
} }
}); });
} }
sessionStorage.setItem('searchVal', JSON.stringify(this.filters));
this.searchLoading = true; this.searchLoading = true;
const that = this; const that = this;
axios axios
...@@ -995,6 +1128,8 @@ export default { ...@@ -995,6 +1128,8 @@ export default {
startTime: that.filters.dateTime[0], startTime: that.filters.dateTime[0],
endTime: that.filters.dateTime[1], endTime: that.filters.dateTime[1],
equipment: equipmentCode, equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
}) })
.then((response) => { .then((response) => {
that.searchLoading = false; that.searchLoading = false;
...@@ -1009,7 +1144,7 @@ export default { ...@@ -1009,7 +1144,7 @@ export default {
that.imgs = []; that.imgs = [];
that.allImgs = []; that.allImgs = [];
that.no = 0; that.no = 0;
const newStr = Cookies.get('id') == 1 ? '新增' : '正常';
// eslint-disable-next-line no-var,no-restricted-syntax,vars-on-top // eslint-disable-next-line no-var,no-restricted-syntax,vars-on-top
// 循环 轨迹信息 // 循环 轨迹信息
for (const key in response.data.data) { for (const key in response.data.data) {
...@@ -1029,6 +1164,7 @@ export default { ...@@ -1029,6 +1164,7 @@ export default {
if (item.images) { if (item.images) {
// 资产及对应图片信息 // 资产及对应图片信息
item.images.forEach((info) => { item.images.forEach((info) => {
if (info.status !== 2) {
// eslint-disable-next-line no-plusplus // eslint-disable-next-line no-plusplus
that.no = ++that.no; that.no = ++that.no;
// 根据经纬度 计算地图的 lng 和lat // 根据经纬度 计算地图的 lng 和lat
...@@ -1070,7 +1206,7 @@ export default { ...@@ -1070,7 +1206,7 @@ export default {
info.status === 0 info.status === 0
? '正常' ? '正常'
: info.status === 1 : info.status === 1
? '新增' ? newStr
: info.status === 2 : info.status === 2
? '丢失' : '异常' ? '丢失' : '异常'
}`, }`,
...@@ -1096,7 +1232,7 @@ export default { ...@@ -1096,7 +1232,7 @@ export default {
info.status === 0 info.status === 0
? '正常' ? '正常'
: info.status === 1 : info.status === 1
? '新增' ? newStr
: info.status === 2 : info.status === 2
? '丢失' : '异常' ? '丢失' : '异常'
} | ${info.position}`, } | ${info.position}`,
...@@ -1105,8 +1241,10 @@ export default { ...@@ -1105,8 +1241,10 @@ export default {
vector: info.vector, vector: info.vector,
}); });
} }
}
}); });
} }
// 这个是计算距离的 // 这个是计算距离的
if (index < val.length - 1) { if (index < val.length - 1) {
if ( if (
...@@ -1201,22 +1339,45 @@ export default { ...@@ -1201,22 +1339,45 @@ export default {
const contentTypeMap = []; const contentTypeMap = [];
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
contents.forEach((c, index) => { contents.forEach((c, index) => {
// eslint-disable-next-line eqeqeq
if (c.type == 0) {
contentTypeMap.push(c.type1); contentTypeMap.push(c.type1);
} else {
contentTypeMap.push(3);
}
ImgGroups.push({ index: index + 1, name: c.name }); ImgGroups.push({ index: index + 1, name: c.name });
}); });
let normalNum = 0; let normalNum = 0;
let insertNum = 0; let insertNum = 0;
let loseNum = 0; let loseNum = 0;
let abNormalNum = 0;
contentTypeMap.forEach((ct) => { contentTypeMap.forEach((ct) => {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (ct == 0) { if (ct == 0) {
normalNum += 1; normalNum += 1;
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
} else if (ct == 1) { } else if (ct == 1) {
// eslint-disable-next-line eqeqeq
if (Cookies.get('id') == 1) {
insertNum += 1; insertNum += 1;
} else {
normalNum += 1; // insertNum 平台修改 修改新增
}
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
} else if (ct == 2) { } else if (ct == 2) {
// eslint-disable-next-line eqeqeq
if (Cookies.get('id') == 1) {
loseNum += 1; loseNum += 1;
} else {
// loseNum += 1;
}
// eslint-disable-next-line eqeqeq
} else if (ct == 3) {
abNormalNum += 1;
} }
}); });
if (normalNum > 0) { if (normalNum > 0) {
...@@ -1228,6 +1389,9 @@ export default { ...@@ -1228,6 +1389,9 @@ export default {
if (loseNum > 0) { if (loseNum > 0) {
contentTypeStr += `丢失:${loseNum}个,`; contentTypeStr += `丢失:${loseNum}个,`;
} }
if (abNormalNum > 0) {
contentTypeStr += `异常:${abNormalNum}个,`;
}
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
let groupedItems = that.$_(ImgGroups) let groupedItems = that.$_(ImgGroups)
.groupBy(item => item.name); .groupBy(item => item.name);
...@@ -1264,7 +1428,7 @@ export default { ...@@ -1264,7 +1428,7 @@ export default {
e.status === 0 e.status === 0
? '正常' ? '正常'
: e.status === 1 : e.status === 1
? '新增' ? newStr
: e.status === 2 : e.status === 2
? '丢失' : '异常' ? '丢失' : '异常'
}`, }`,
...@@ -1329,12 +1493,20 @@ export default { ...@@ -1329,12 +1493,20 @@ export default {
return (d * Math.PI) / 180.0; return (d * Math.PI) / 180.0;
}, },
linkDetail(index, row) { linkDetail(index, row) {
let equipment = '';
this.plateNoOptions.forEach((e) => {
if (e.plateNo == row.plateNo) {
equipment = e.code;
}
});
this.$router.push({ this.$router.push({
name: 'resultDetail', name: 'resultDetail',
params: { params: {
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
startTime: row.startTime, startTime: row.startTime,
endTime: row.endTime, endTime: row.endTime,
equipment: row.plateNo, equipment,
}, },
}); });
}, },
......
...@@ -6,16 +6,75 @@ ...@@ -6,16 +6,75 @@
<!--搜索栏--> <!--搜索栏-->
<el-col :span="24" class="toolbar"> <el-col :span="24" class="toolbar">
<el-form :inline="true" :model="filters"> <el-form :inline="true" :model="filters">
<el-form-item
v-permission="[permission.provincePermission]">
<el-select
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:200px"
multiple
collapse-tags
clearable
filterable
placeholder="请选择省份"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
v-permission="[permission.provincePermission]">
<el-select
v-model="filters.cityIds"
multiple
collapse-tags
style="width:200px"
clearable
filterable
placeholder="请选择管理处"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select
v-model="filters.plateNo"
multiple
collapse-tags
style="width:180px"
filterable
placeholder="车牌号"
>
<el-option
v-for="item in plateNoOptions"
:key="item.code"
:label="item.plateNo"
:value="item.code"
></el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-model="filters.capitalType" v-model="filters.capitalType"
collapse-tags collapse-tags
clearable style="width:180px"
filterable filterable
placeholder="巡检目标" placeholder="巡检目标"
> >
<!--@change="selectCapitalType"-->
<el-option <el-option
v-for="item in capitalOptions" v-for="item in capitalOptions"
:key="item.value" :key="item.value"
...@@ -23,19 +82,13 @@ ...@@ -23,19 +82,13 @@
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>
<!-- <el-autocomplete
v-model="filters.channelName"
:fetch-suggestions="queryChannelSearchAsync"
placeholder="渠道"
@select="handleChannelSelect"
></el-autocomplete>-->
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-model="filters.status" v-model="filters.status"
collapse-tags collapse-tags
clearable
filterable filterable
style="width:180px"
placeholder="目标状态" placeholder="目标状态"
@change="selectStatus" @change="selectStatus"
> >
...@@ -94,6 +147,7 @@ ...@@ -94,6 +147,7 @@
highlight-current-row highlight-current-row
> >
<el-table-column width="80" type="index" label="序号" align="center"></el-table-column> <el-table-column width="80" type="index" label="序号" align="center"></el-table-column>
<el-table-column width="180" label="管理单位" prop="office" align="center"></el-table-column>
<el-table-column width="180" label="巡检时间" prop="imageTime" align="center"></el-table-column> <el-table-column width="180" label="巡检时间" prop="imageTime" align="center"></el-table-column>
<el-table-column width="120" label="巡检目标" prop="info" align="center"></el-table-column> <el-table-column width="120" label="巡检目标" prop="info" align="center"></el-table-column>
<el-table-column width="400" label="目标位置" prop="position" align="center"></el-table-column> <el-table-column width="400" label="目标位置" prop="position" align="center"></el-table-column>
...@@ -156,6 +210,7 @@ ...@@ -156,6 +210,7 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
v-permission="[permission.resultCheck_edit]"
title="确认信息" title="确认信息"
v-el-drag-dialog v-el-drag-dialog
:visible.sync="dialogVisible1" :visible.sync="dialogVisible1"
...@@ -169,6 +224,7 @@ ...@@ -169,6 +224,7 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
v-permission="[permission.resultCheck_edit]"
title="确认信息" title="确认信息"
v-el-drag-dialog v-el-drag-dialog
:visible.sync="dialogVisible2" :visible.sync="dialogVisible2"
...@@ -204,13 +260,19 @@ import echarts from 'echarts'; ...@@ -204,13 +260,19 @@ import echarts from 'echarts';
import moment from 'moment'; import moment from 'moment';
import { export_json_to_excel } from '@/excel/Export2Excel'; import { export_json_to_excel } from '@/excel/Export2Excel';
import elDragDialog from '@/components/el-drag-dialog'; import elDragDialog from '@/components/el-drag-dialog';
import { exportResultDetail } from '@/excel/export';
import { address, photoAddress } from '../config'; import { address, photoAddress } from '../config';
import { permission } from '../permission';
export default { export default {
name: 'detail', name: 'detail',
directives: { elDragDialog }, directives: { elDragDialog },
data() { data() {
return { return {
provinceOptions: [],
cityOptions: [],
permission,
linkDetail: false, linkDetail: false,
searchData: [], searchData: [],
tableData: [], tableData: [],
...@@ -224,6 +286,9 @@ export default { ...@@ -224,6 +286,9 @@ export default {
currentPage: 1, // 初始页 currentPage: 1, // 初始页
pagesize: 10, // 每页的数据 pagesize: 10, // 每页的数据
filters: { filters: {
plateNo: [],
cityIds: [],
provinceIds: [],
capitalType: null, capitalType: null,
status: null, status: null,
dateTime: [], dateTime: [],
...@@ -242,7 +307,7 @@ export default { ...@@ -242,7 +307,7 @@ export default {
tableIndex: -1, tableIndex: -1,
capitalOptions: [ capitalOptions: [
{ {
label: '全部', label: '全部目标',
value: -2, value: -2,
}, },
{ {
...@@ -320,7 +385,7 @@ export default { ...@@ -320,7 +385,7 @@ export default {
], ],
statusOptions: [ statusOptions: [
{ {
label: '全部', label: '全部状态',
value: 0, value: 0,
}, },
{ {
...@@ -387,12 +452,13 @@ export default { ...@@ -387,12 +452,13 @@ export default {
scale: 0, // 适应比例 scale: 0, // 适应比例
hscale: 0, hscale: 0,
searchLoading: false, searchLoading: false,
plateNoOptions: [],
}; };
}, },
mounted() {}, mounted() {},
created() { created() {
const searchVal = sessionStorage.getItem('resultDetailSearchVal'); const searchVal = sessionStorage.getItem('resultDetailSearchVal');
this.queryAllProvinceByPermission();
const that = this; const that = this;
if (this.$route.params.startTime) { if (this.$route.params.startTime) {
this.linkDetail = true; this.linkDetail = true;
...@@ -401,8 +467,20 @@ export default { ...@@ -401,8 +467,20 @@ export default {
if (this.$route.params.endTime) { if (this.$route.params.endTime) {
that.endTime = this.$route.params.endTime; that.endTime = this.$route.params.endTime;
} }
if (this.$route.params.provinceIds) {
this.filters.provinceIds = this.$route.params.provinceIds;
}
if (this.$route.params.cityIds) {
this.filters.cityIds = this.$route.params.cityIds;
}
if (this.$route.params.equipment) { if (this.$route.params.equipment) {
that.filters.equipment = this.$route.params.equipment; const { equipment } = this.$route.params;
if (equipment) {
this.filters.plateNo = equipment.split(',');
}
} }
if (that.startTime && that.endTime) { if (that.startTime && that.endTime) {
...@@ -414,6 +492,14 @@ export default { ...@@ -414,6 +492,14 @@ export default {
this.filters = JSON.parse(searchVal); this.filters = JSON.parse(searchVal);
} else { } else {
this.filters.status = 0; this.filters.status = 0;
if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment(
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 00:00:00`;
this.filters.dateTime[1] = `${moment(
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 23:59:59`;
}
} }
if (this.filters.status == null) { if (this.filters.status == null) {
...@@ -423,22 +509,102 @@ export default { ...@@ -423,22 +509,102 @@ export default {
if (this.filters.capitalType == null) { if (this.filters.capitalType == null) {
this.filters.capitalType = -2; this.filters.capitalType = -2;
} }
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
this.getImageFeatures(); this.getImageFeatures();
this.queryAllEquipment();
}, },
methods: { methods: {
queryAllEquipment() {
axios
.post(`${address}queryAllEquipment`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.plateNoOptions = [];
response.data.data.forEach((item) => {
this.plateNoOptions.push(item);
});
}
} else {
Message({
message: response.data.message,
duration: 3 * 1000,
type: 'error',
// duration: '800',
});
}
})
.catch((error) => {
console.log(error);
});
},
queryAllProvinceByPermission() {
axios
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.provinceOptions = response.data.data;
}
}
})
.catch((error) => {
console.log(error);
});
},
queryCityByProvince(provinceId) {
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentIds: provinceId,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.cityOptions = response.data.data;
this.cityOptions.forEach((e) => {
e.name += '管理处';
});
}
}
})
.catch((error) => {
console.log(error);
});
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds.length > 0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
getImageFeatures() { getImageFeatures() {
if (this.filters.dateTime.length == 0) { const roles = JSON.parse(localStorage.getItem('permission'));
this.filters.dateTime[0] = `${moment( const permissionRoles = [permission.provincePermission];
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24), const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
).format('YYYY-MM-DD')} 00:00:00`; // eslint-disable-next-line eqeqeq
this.filters.dateTime[1] = `${moment( if (!this.linkDetail && hasPermission && this.filters.provinceIds.length == 0 && this.filters.plateNo.length == 0) {
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24), return;
).format('YYYY-MM-DD')} 23:59:59`;
} }
const startTime = this.filters.dateTime[0]; const startTime = this.filters.dateTime[0];
const endTime = this.filters.dateTime[1]; const endTime = this.filters.dateTime[1];
let equipmentCode = '';
if (this.filters.plateNo && this.filters.plateNo.length > 0) {
this.filters.plateNo.forEach((item) => {
if (equipmentCode === '') {
equipmentCode += item;
} else {
equipmentCode += `,${item}`;
}
});
}
sessionStorage.setItem('resultDetailSearchVal', JSON.stringify(this.filters)); sessionStorage.setItem('resultDetailSearchVal', JSON.stringify(this.filters));
this.searchLoading = true; this.searchLoading = true;
const that = this; const that = this;
...@@ -446,7 +612,9 @@ export default { ...@@ -446,7 +612,9 @@ export default {
.post(`${address}getImageFeaturesByGroup`, { .post(`${address}getImageFeaturesByGroup`, {
startTime, startTime,
endTime, endTime,
equipment: that.filters.equipment, cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
equipment: equipmentCode,
status: that.filters.status, status: that.filters.status,
capitalType: that.filters.capitalType, capitalType: that.filters.capitalType,
pageIndex: this.pageOption.pageIndex, pageIndex: this.pageOption.pageIndex,
...@@ -469,6 +637,9 @@ export default { ...@@ -469,6 +637,9 @@ export default {
}); */ }); */
}); });
that.tableData = response.data.data.list; that.tableData = response.data.data.list;
that.tableData.forEach((e) => {
e.office += '管理处';
});
} else { } else {
that.tableData = []; that.tableData = [];
} }
...@@ -562,9 +733,15 @@ export default { ...@@ -562,9 +733,15 @@ export default {
}, },
loadBigImg() { loadBigImg() {
// console.log('---'); // console.log('---');
const scale = this.$refs.BGIMG.naturalWidth / this.$refs.mainW.offsetWidth;
const hscal = this.$refs.BGIMG.naturalHeight / this.$refs.mainW.offsetHeight;
if (isFinite(scale)) {
this.scale = this.$refs.BGIMG.naturalWidth / this.$refs.mainW.offsetWidth; this.scale = this.$refs.BGIMG.naturalWidth / this.$refs.mainW.offsetWidth;
}
if (isFinite(hscal)) {
this.hscale = this.$refs.BGIMG.naturalHeight / this.$refs.mainW.offsetHeight; this.hscale = this.$refs.BGIMG.naturalHeight / this.$refs.mainW.offsetHeight;
}
this.customStyle = { this.customStyle = {
top: `${this.positionRight / this.hscale}px`, top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`, left: `${this.positionLeft / this.scale}px`,
...@@ -617,6 +794,17 @@ export default { ...@@ -617,6 +794,17 @@ export default {
this.imgContent = `${row.info}|${row.status}|${row.position}`; this.imgContent = `${row.info}|${row.status}|${row.position}`;
this.bigImgUrl = photoAddress + row.imagePath; this.bigImgUrl = photoAddress + row.imagePath;
const statusStr = `${row.type},${row.type1}`; const statusStr = `${row.type},${row.type1}`;
const that = this;
setTimeout(() => {
axios
.get(
`${address}getStatisticIndex?imageId=${row.imageId}&status=${statusStr}&type2=${row.type2}&id=${row.id}`,
)
// eslint-disable-next-line no-unused-vars
.then((res) => {
// 查出来的 static 分组index
const trueStyleIndex = res.data.data;
axios axios
.get( .get(
`${address}getTrajectImgLocationByImageId?imageId=${row.imageId}&status=${statusStr}&type2=${row.type2}`, `${address}getTrajectImgLocationByImageId?imageId=${row.imageId}&status=${statusStr}&type2=${row.type2}`,
...@@ -627,49 +815,55 @@ export default { ...@@ -627,49 +815,55 @@ export default {
this.customStyle = []; this.customStyle = [];
// 拼接 展示的资产信息 // 拼接 展示的资产信息
styleArray.forEach((e, styleIndex) => { styleArray.forEach((e, styleIndex) => {
// eslint-disable-next-line eqeqeq
if (styleIndex == trueStyleIndex) {
e.index = styleIndex + 1; e.index = styleIndex + 1;
const point = JSON.parse(e.vector).location; const point = JSON.parse(e.vector).location;
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (point.length == 4) { if (point.length == 4) {
this.positionLeft = point[0]; that.positionLeft = point[0];
this.positionRight = point[1]; that.positionRight = point[1];
this.positionWidth = point[2] - point[0]; that.positionWidth = point[2] - point[0];
this.positionHeight = point[3] - point[1]; that.positionHeight = point[3] - point[1];
this.customStyle = { that.customStyle = {
top: `${this.positionRight / this.hscale}px`, top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`, left: `${this.positionLeft / this.scale}px`,
width: `${this.positionWidth / this.scale}px`, width: `${this.positionWidth / this.scale}px`,
height: `${this.positionHeight / this.hscale}px`, height: `${this.positionHeight / this.hscale}px`,
}; };
} }
}); /* const vectorData = JSON.parse(row.vector);
});
const vectorData = JSON.parse(row.vector);
if (vectorData && vectorData.location) { if (vectorData && vectorData.location) {
// eslint-disable-next-line no-shadow
const point = vectorData.location; const point = vectorData.location;
if (point.length == 4) { if (point.length == 4) {
this.positionLeft = point[0]; that.positionLeft = point[0];
this.positionRight = point[1]; that.positionRight = point[1];
this.positionWidth = point[2] - point[0]; that.positionWidth = point[2] - point[0];
this.positionHeight = point[3] - point[1]; that.positionHeight = point[3] - point[1];
this.customStyle = { that.customStyle = {
top: `${this.positionRight / this.hscale}px`, top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`, left: `${this.positionLeft / this.scale}px`,
width: `${this.positionWidth / this.scale}px`, width: `${this.positionWidth / this.scale}px`,
height: `${this.positionHeight / this.hscale}px`, height: `${this.positionHeight / this.hscale}px`,
}; };
} }
} } */
this.showRedBox = true;
this.isShowPicture = true;
if (row.status == '异常') { if (row.status == '异常') {
this.dialogVisible1 = true; that.dialogVisible1 = true;
this.groupId = row.id; that.groupId = row.id;
this.tableIndex = index; that.tableIndex = index;
} }
}
});
that.showRedBox = true;
that.isShowPicture = true;
});
});
}, 500);
}, },
updatePicStatus() { updatePicStatus() {
this.dialogVisible1 = false; this.dialogVisible1 = false;
...@@ -691,7 +885,38 @@ export default { ...@@ -691,7 +885,38 @@ export default {
console.log(error); console.log(error);
}); });
}, },
exportTravel() { exportTravel() {
const startTime = this.filters.dateTime[0];
const endTime = this.filters.dateTime[1];
const data = {
startTime,
endTime,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
};
exportResultDetail(data).then((res) => {
const blob = new Blob([res.data], {
type: 'application/vnd.ms-excel',
});
const fileName = '巡检结果明细.xlsx';
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, fileName);
} else {
const link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = fileName;
link.click();
// 释放内存
window.URL.revokeObjectURL(link.href);
}
}).catch(() => {
this.listLoading = false;
this.$message.error('导出失败');
});
},
/* exportTravel() {
this.tableData.forEach((item, index) => { this.tableData.forEach((item, index) => {
item.no = `${index + 1}`; item.no = `${index + 1}`;
}); });
...@@ -714,7 +939,7 @@ export default { ...@@ -714,7 +939,7 @@ export default {
const fileName = '巡检结果明细'; const fileName = '巡检结果明细';
export_json_to_excel(tHeader, data, fileName); export_json_to_excel(tHeader, data, fileName);
}); });
}, }, */
selectStatus(status) { selectStatus(status) {
this.filters.status = status; this.filters.status = status;
}, },
......
...@@ -6,6 +6,45 @@ ...@@ -6,6 +6,45 @@
<!--搜索栏--> <!--搜索栏-->
<el-col :span="24" class="toolbar"> <el-col :span="24" class="toolbar">
<el-form :inline="true" :model="filters"> <el-form :inline="true" :model="filters">
<el-form-item v-permission="[permission.provincePermission]">
<el-select
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:260px"
multiple
collapse-tags
clearable
filterable
placeholder="请选择省份"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item v-permission="[permission.provincePermission]">
<el-select
v-model="filters.cityIds"
multiple
collapse-tags
style="width:260px"
clearable
filterable
placeholder="请选择管理处"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-model="filters.plateNo" v-model="filters.plateNo"
...@@ -60,6 +99,7 @@ ...@@ -60,6 +99,7 @@
highlight-current-row highlight-current-row
> >
<el-table-column label="序号" width="50" prop="no"></el-table-column> <el-table-column label="序号" width="50" prop="no"></el-table-column>
<el-table-column label="管理单位" width="120" prop="office"></el-table-column>
<el-table-column label="车牌号" width="100" prop="plateNo"></el-table-column> <el-table-column label="车牌号" width="100" prop="plateNo"></el-table-column>
<el-table-column label="开始时间" prop="startTime"></el-table-column> <el-table-column label="开始时间" prop="startTime"></el-table-column>
<el-table-column label="结束时间" prop="endTime"></el-table-column> <el-table-column label="结束时间" prop="endTime"></el-table-column>
...@@ -183,11 +223,13 @@ import moment from 'moment'; ...@@ -183,11 +223,13 @@ import moment from 'moment';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
import { export_json_to_excel } from '@/excel/Export2Excel'; import { export_json_to_excel } from '@/excel/Export2Excel';
import { address, photoAddress, videoAddress } from '../config'; import { address, photoAddress, videoAddress } from '../config';
import { permission } from '../permission';
export default { export default {
name: 'task', name: 'task',
data() { data() {
return { return {
permission,
videoUrl: '', videoUrl: '',
allVideoPoints: [], allVideoPoints: [],
screenLoading: false, screenLoading: false,
...@@ -223,6 +265,8 @@ export default { ...@@ -223,6 +265,8 @@ export default {
points: [ points: [
], ],
provinceOptions: [],
cityOptions: [],
dialogTableVisible: false, dialogTableVisible: false,
dataList: [], dataList: [],
isShowPicture: false, isShowPicture: false,
...@@ -230,6 +274,8 @@ export default { ...@@ -230,6 +274,8 @@ export default {
timeout: null, timeout: null,
bigImgUrl: '', bigImgUrl: '',
filters: { filters: {
cityIds: [],
provinceIds: [],
equipmentNo: '', equipmentNo: '',
plateNo: '', plateNo: '',
channel: '', channel: '',
...@@ -305,6 +351,7 @@ export default { ...@@ -305,6 +351,7 @@ export default {
this.queryTravel(); this.queryTravel();
this.queryImagesTravel(); this.queryImagesTravel();
this.queryVideosTravel(); this.queryVideosTravel();
this.queryAllProvinceByPermission();
}, },
created() { created() {
const that = this; const that = this;
...@@ -332,8 +379,51 @@ export default { ...@@ -332,8 +379,51 @@ export default {
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 23:59:59`; ).format('YYYY-MM-DD')} 23:59:59`;
} }
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
}, },
methods: { methods: {
queryAllProvinceByPermission() {
axios
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.provinceOptions = response.data.data;
}
}
})
.catch((error) => {
console.log(error);
});
},
queryCityByProvince(provinceId) {
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentIds: provinceId,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.cityOptions = response.data.data;
this.cityOptions.forEach((e) => {
e.name += '管理处';
});
}
}
})
.catch((error) => {
console.log(error);
});
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds.length > 0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
playVideos(item) { playVideos(item) {
const videoUrl = videoAddress + item.filePath; const videoUrl = videoAddress + item.filePath;
this.playerOptions.sources[0].src = videoUrl; this.playerOptions.sources[0].src = videoUrl;
...@@ -440,47 +530,6 @@ export default { ...@@ -440,47 +530,6 @@ export default {
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
}); });
/* axios
.get(
`${address}getTrajectImgLocationByImageId?imageId=${id}`,
)
// eslint-disable-next-line no-unused-vars
.then((response) => {
const styleArray = response.data.data;
const nowBigImgUrl = `${address
}getTrajectImgByImageId?imageId=${id}`;
this.screenLoading = true;
// eslint-disable-next-line eqeqeq
if (this.bigImgUrl == nowBigImgUrl) {
this.screenLoading = false;
this.isShowPicture = true;
return;
}
this.bigImgUrl = nowBigImgUrl;
this.customStyleArray = [];
styleArray.forEach((e) => {
const point = JSON.parse(e).location;
if (point.length === 4) {
const style = {
positionLeft: point[0],
positionRight: point[1],
positionWidth: point[2] - point[0],
positionHeight: point[3] - point[1],
};
this.customStyleArray.push(style);
}
});
this.isShowPicture = true;
})
.catch((error) => {
console.log(error);
}); */
}, },
...@@ -543,6 +592,7 @@ export default { ...@@ -543,6 +592,7 @@ export default {
// tHeader为存放excel表头标题的数组 // tHeader为存放excel表头标题的数组
const tHeader = [ const tHeader = [
'序号', '序号',
'管理单位',
'车牌号', '车牌号',
'开始时间', '开始时间',
'结束时间', '结束时间',
...@@ -555,6 +605,7 @@ export default { ...@@ -555,6 +605,7 @@ export default {
// filterVal为tHeader标题对应的键值 // filterVal为tHeader标题对应的键值
const filterVal = [ const filterVal = [
'no', 'no',
'office',
'plateNo', 'plateNo',
'startTime', 'startTime',
'endTime', 'endTime',
...@@ -569,7 +620,7 @@ export default { ...@@ -569,7 +620,7 @@ export default {
// 用map方法处理list数据 // 用map方法处理list数据
const data = list.map(v => filterVal.map(j => v[j])); const data = list.map(v => filterVal.map(j => v[j]));
// 自定义excel文件名 // 自定义excel文件名
const fileName = '巡检任务'; const fileName = '巡检任务管理';
export_json_to_excel(tHeader, data, fileName); export_json_to_excel(tHeader, data, fileName);
}); });
}, },
...@@ -601,6 +652,14 @@ export default { ...@@ -601,6 +652,14 @@ export default {
// 获取图片信息 // 获取图片信息
queryImagesTravel() { queryImagesTravel() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
// eslint-disable-next-line eqeqeq
if (hasPermission && this.filters.provinceIds.length == 0
&& this.filters.plateNo.length == 0) {
return;
}
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (this.filters.dateTime.length == 0) { if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment( this.filters.dateTime[0] = `${moment(
...@@ -628,6 +687,8 @@ export default { ...@@ -628,6 +687,8 @@ export default {
startTime: this.filters.dateTime[0], startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1], endTime: this.filters.dateTime[1],
equipment: equipmentCode, equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
}) })
.then((res) => { .then((res) => {
this.points = []; this.points = [];
...@@ -674,6 +735,14 @@ export default { ...@@ -674,6 +735,14 @@ export default {
// 获取图片信息 // 获取图片信息
queryVideosTravel() { queryVideosTravel() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
// eslint-disable-next-line eqeqeq
if (hasPermission && this.filters.provinceIds.length == 0
&& this.filters.plateNo.length == 0) {
return;
}
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (this.filters.dateTime.length == 0) { if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment( this.filters.dateTime[0] = `${moment(
...@@ -701,6 +770,8 @@ export default { ...@@ -701,6 +770,8 @@ export default {
startTime: this.filters.dateTime[0], startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1], endTime: this.filters.dateTime[1],
equipment: equipmentCode, equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
}) })
.then((res) => { .then((res) => {
this.allVideoPoints = []; this.allVideoPoints = [];
...@@ -742,6 +813,14 @@ export default { ...@@ -742,6 +813,14 @@ export default {
// 获取轨迹点 TODO 重点优化 // 获取轨迹点 TODO 重点优化
queryTravel() { queryTravel() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
// eslint-disable-next-line eqeqeq
if (hasPermission && this.filters.provinceIds.length == 0
&& this.filters.plateNo.length == 0) {
return;
}
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (this.filters.dateTime.length == 0) { if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment( this.filters.dateTime[0] = `${moment(
...@@ -768,8 +847,11 @@ export default { ...@@ -768,8 +847,11 @@ export default {
); );
this.searchLoading = true; this.searchLoading = true;
const that = this; const that = this;
axios axios
.post(`${address}getTravel`, { .post(`${address}getTravel`, {
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
startTime: this.filters.dateTime[0], startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1], endTime: this.filters.dateTime[1],
equipment: equipmentCode, equipment: equipmentCode,
...@@ -854,6 +936,7 @@ export default { ...@@ -854,6 +936,7 @@ export default {
// eslint-disable-next-line no-plusplus // eslint-disable-next-line no-plusplus
no: ++this.no, no: ++this.no,
plateNo: gis.plateNo, plateNo: gis.plateNo,
office: `${gis.office}管理处`,
startTime: this.$moment.unix(gis.startTime) startTime: this.$moment.unix(gis.startTime)
.format( .format(
'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss',
...@@ -865,7 +948,7 @@ export default { ...@@ -865,7 +948,7 @@ export default {
startPoint: gis.startPoint, startPoint: gis.startPoint,
endPoint: gis.endPoint, endPoint: gis.endPoint,
inspectDistance: gis.inspectDistance, inspectDistance: gis.inspectDistance,
equipment: gis.equipment,
inspectTime: gis.inspectTime, inspectTime: gis.inspectTime,
averageSpeed: gis.averageSpeed, averageSpeed: gis.averageSpeed,
}); });
...@@ -970,6 +1053,7 @@ export default { ...@@ -970,6 +1053,7 @@ export default {
// this.points // this.points
const thisPoints = that.allPicPoints; const thisPoints = that.allPicPoints;
const { allVideoPoints } = that;
const trajectoryWithLinkId = that.trajectoryWithLinkId[index].linkIds; const trajectoryWithLinkId = that.trajectoryWithLinkId[index].linkIds;
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
...@@ -981,6 +1065,14 @@ export default { ...@@ -981,6 +1065,14 @@ export default {
return include; return include;
}); });
const videoPoints = this.$_.filter(that.videoPoints,
(e) => {
// eslint-disable-next-line no-underscore-dangle
const include = that.$_.includes(trajectoryWithLinkId, e.linkId);
return include;
});
this.videoPoints = videoPoints;
this.points = points; this.points = points;
const point = this.allPoints[index]; const point = this.allPoints[index];
this.carPoints = []; this.carPoints = [];
...@@ -990,8 +1082,8 @@ export default { ...@@ -990,8 +1082,8 @@ export default {
}, },
// 巡检结果查看 // 巡检结果查看
linkResult(index, row) { linkResult(index, row) {
let equipmentCode = ''; const equipmentCode = row.equipment;
if (this.filters.plateNo && this.filters.plateNo.length > 0) { /* if (this.filters.plateNo && this.filters.plateNo.length > 0) {
this.filters.plateNo.forEach((item) => { this.filters.plateNo.forEach((item) => {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (equipmentCode == '') { if (equipmentCode == '') {
...@@ -1000,12 +1092,14 @@ export default { ...@@ -1000,12 +1092,14 @@ export default {
equipmentCode += `,${item}`; equipmentCode += `,${item}`;
} }
}); });
} } */
this.$router.push({ this.$router.push({
name: 'result', name: 'result',
params: { params: {
startTime: this.filters.dateTime[0], provinceIds: this.filters.provinceIds,
endTime: this.filters.dateTime[1], cityIds: this.filters.cityIds,
startTime: row.startTime,
endTime: row.endTime,
equipment: equipmentCode, equipment: equipmentCode,
}, },
}); });
......
...@@ -6,6 +6,46 @@ ...@@ -6,6 +6,46 @@
<!--搜索栏--> <!--搜索栏-->
<el-col :span="24" class="toolbar"> <el-col :span="24" class="toolbar">
<el-form :inline="true" :model="filters"> <el-form :inline="true" :model="filters">
<el-form-item
v-permission="[permission.provincePermission]">
<el-select
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:260px"
multiple
collapse-tags
clearable
filterable
placeholder="请选择省份"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
v-permission="[permission.provincePermission]">
<el-select
v-model="filters.cityIds"
multiple
collapse-tags
style="width:260px"
clearable
filterable
placeholder="请选择管理处"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-model="filters.equipment" v-model="filters.equipment"
...@@ -98,11 +138,15 @@ import axios from 'axios'; ...@@ -98,11 +138,15 @@ import axios from 'axios';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
import moment from 'moment'; import moment from 'moment';
import { address, videoAddress } from '../config'; import { address, videoAddress } from '../config';
import { permission } from '../permission';
export default { export default {
name: 'video', name: 'video',
data() { data() {
return { return {
permission,
provinceOptions: [],
cityOptions: [],
plateNoOptions: [], plateNoOptions: [],
searchData: [], searchData: [],
tableData: [], tableData: [],
...@@ -114,6 +158,8 @@ export default { ...@@ -114,6 +158,8 @@ export default {
totalCount: 0, totalCount: 0,
}, },
filters: { filters: {
cityIds: [],
provinceIds: [],
equipment: [], equipment: [],
dateTime: [], dateTime: [],
}, },
...@@ -173,9 +219,9 @@ export default { ...@@ -173,9 +219,9 @@ export default {
}, },
mounted() {}, mounted() {},
created() { created() {
this.queryAllProvinceByPermission();
this.queryAllEquipment(); this.queryAllEquipment();
const searchVal = sessionStorage.getItem('videoSearchVal'); const searchVal = localStorage.getItem('videoSearchVal');
const that = this; const that = this;
if (this.$route.params.startTime) { if (this.$route.params.startTime) {
that.startTime = this.$route.params.startTime; that.startTime = this.$route.params.startTime;
...@@ -196,9 +242,60 @@ export default { ...@@ -196,9 +242,60 @@ export default {
this.filters = JSON.parse(searchVal); this.filters = JSON.parse(searchVal);
} }
if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment(
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 00:00:00`;
this.filters.dateTime[1] = `${moment(
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 23:59:59`;
}
if (this.filters.provinceIds.length>0) {
this.getCityOptions();
}
this.getParkVideos(); this.getParkVideos();
}, },
methods: { methods: {
queryAllProvinceByPermission() {
axios
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.provinceOptions = response.data.data;
}
}
})
.catch((error) => {
console.log(error);
});
},
queryCityByProvince(provinceId) {
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentIds: provinceId,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.cityOptions = response.data.data;
this.cityOptions.forEach((e) => {
e.name += '管理处';
});
}
}
})
.catch((error) => {
console.log(error);
});
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds.length>0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
playVideos(item) { playVideos(item) {
const videoUrl = videoAddress + item.filePath; const videoUrl = videoAddress + item.filePath;
this.playerOptions.sources[0].src = videoUrl; this.playerOptions.sources[0].src = videoUrl;
...@@ -238,6 +335,12 @@ export default { ...@@ -238,6 +335,12 @@ export default {
}); });
}, },
getParkVideos() { getParkVideos() {
const roles = JSON.parse(localStorage.getItem('permission'));
const permissionRoles = [permission.provincePermission];
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (hasPermission && this.filters.provinceIds.length == 0 && this.filters.equipment.length == 0) {
return;
}
if (this.filters.dateTime) { if (this.filters.dateTime) {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (this.filters.dateTime.length == 0) { if (this.filters.dateTime.length == 0) {
...@@ -257,10 +360,13 @@ export default { ...@@ -257,10 +360,13 @@ export default {
} else { } else {
this.$message.info('请选择时间'); this.$message.info('请选择时间');
} }
localStorage.setItem('videoSearchVal', JSON.stringify(this.filters));
this.searchLoading = true; this.searchLoading = true;
const that = this; const that = this;
axios axios
.post(`${address}getParkVideos`, { .post(`${address}getParkVideos`, {
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
startTime: this.filters.dateTime[0], startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1], endTime: this.filters.dateTime[1],
equipment: that.filters.equipment, equipment: that.filters.equipment,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<el-table-column width="240" label="车身照片" prop="images" align="center"> <el-table-column width="240" label="车身照片" prop="images" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<img v-for="(item,index) in scope.row.images" <img v-for="(item,index) in scope.row.images" @click="showBigPicture(item)"
:key="index" :key="index"
:src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/> :src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<el-table-column width="240" label="车身照片" prop="images" align="center"> <el-table-column width="240" label="车身照片" prop="images" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<img v-for="(item,index) in scope.row.images" <img v-for="(item,index) in scope.row.images" @click="showBigPicture(item)"
:key="index" :key="index"
:src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/> :src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/>
...@@ -144,6 +144,11 @@ ...@@ -144,6 +144,11 @@
<el-button type="primary" @click="isShowDialog = false">取消</el-button> <el-button type="primary" @click="isShowDialog = false">取消</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="isShowPicture" custom-class="customWidth" width="900px" >
<img :src="bigImgUrl" ref="BGIMG" style="height:500px;width:860px" />
</el-dialog>
</div> </div>
</template> </template>
...@@ -162,6 +167,8 @@ export default { ...@@ -162,6 +167,8 @@ export default {
name: 'equipmentCheck', name: 'equipmentCheck',
data() { data() {
return { return {
bigImgUrl: '',
isShowPicture: false,
thisPhotoAddress: photoAddress, thisPhotoAddress: photoAddress,
rejectReason: '', rejectReason: '',
operateOptions: [{ operateOptions: [{
...@@ -195,6 +202,10 @@ export default { ...@@ -195,6 +202,10 @@ export default {
this.queryAllEquipment(); this.queryAllEquipment();
}, },
methods: { methods: {
showBigPicture(row) {
this.bigImgUrl = photoAddress + row.filePath;
this.isShowPicture = true;
},
doCheckReject() { doCheckReject() {
if (this.rejectReason) { if (this.rejectReason) {
this.checkFail(this.checkFailId, this.rejectReason); this.checkFail(this.checkFailId, this.rejectReason);
...@@ -266,7 +277,7 @@ export default { ...@@ -266,7 +277,7 @@ export default {
type: 'success', type: 'success',
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
showClose: true, showClose: true,
duration:3000, duration: 3000,
message: '驳回成功', message: '驳回成功',
}); });
this.queryAllEquipment(); this.queryAllEquipment();
...@@ -298,7 +309,7 @@ export default { ...@@ -298,7 +309,7 @@ export default {
type: 'success', type: 'success',
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
showClose: true, showClose: true,
duration:3000, duration: 3000,
message: '审核成功', message: '审核成功',
}); });
this.queryAllEquipment(); this.queryAllEquipment();
......
<template> <template>
<div class="detail"> <el-container>
<el-tabs v-model="activeName" type="card" @tab-click="handleClick"> <div class="box" style="height:600px;margin-left:20%;margin-top:30px">
<el-tab-pane label="待审核" name="first"> <el-form label-width="100px" ref="ruleForm2" :model="ruleForm2" :rules="rules2" >
<div class="box"> <el-footer style="text-align: center">
<!-- 停车视频表 --> 修改密码
<div class="detail-table"> </el-footer>
<el-table <el-form-item label="输入新密码" prop="pass">
:data="tableData" <el-input type="password" style="width:300px" v-model="ruleForm2.pass" auto-complete="new-password" placeholder="6-10个字符,由字母和数字组合"></el-input>
style="width: calc(100vw - 240px);overflow:hidden;" </el-form-item>
border <el-form-item label="确认新密码" prop="checkPass">
fit <el-input type="password" style="width:300px" v-model="ruleForm2.checkPass" auto-complete="new-password" placeholder="6-10个字符,由字母和数字组合"></el-input>
highlight-current-row
>
<el-table-column width="50" type="index" label="序号" align="center"></el-table-column>
<el-table-column width="100" label="管理单位" prop="company" align="center"></el-table-column>
<el-table-column width="100" label="车牌号" prop="plateNo" align="center"></el-table-column>
<el-table-column width="240" label="车身照片" prop="images" align="center">
<template slot-scope="scope">
<img v-for="(item,index) in scope.row.images"
:key="index"
:src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/>
</template>
</el-table-column>
<el-table-column width="160" label="上传时间" prop="createTime" align="center"></el-table-column>
<el-table-column width="160" label="操作员" prop="liaisonMan" align="center">
<template slot-scope="scope">
{{scope.row.liaisonMan}}
<br/>
{{scope.row.telephone}}
</template>
</el-table-column>
<el-table-column fixed="right" min-width="100" label="审核状态" align="center">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="checkPass(scope.row.id)" v-loading="checkLoadingList.indexOf(scope.row.id)>-1">审核通过</el-button>
<br/>
<span style="color: red"> <i class="el-icon-warning" v-show="scope.row.rejectReason"></i>{{scope.row.rejectReason}}</span>
</template>
</el-table-column>
</el-table>
<!-- 分页 修改 -->
<el-pagination
:current-page="pageOption.pageIndex"
:page-sizes="[5, 10, 20, 40]"
:page-size="pageOption.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageOption.totalCount"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="已审核" name="second">
<div class="box">
<!-- 停车视频表 -->
<div class="detail-table">
<el-table
:data="tableData"
style="width: calc(100vw - 240px);overflow:hidden;"
border
fit
highlight-current-row
>
<el-table-column width="50" type="index" label="序号" align="center"></el-table-column>
<el-table-column width="100" label="管理单位" prop="company" align="center"></el-table-column>
<el-table-column width="100" label="车牌号" prop="plateNo" align="center"></el-table-column>
<el-table-column width="240" label="车身照片" prop="images" align="center">
<template slot-scope="scope">
<img v-for="(item,index) in scope.row.images"
:key="index"
:src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/>
</template>
</el-table-column>
<el-table-column width="160" label="上传时间" prop="createTime" align="center"></el-table-column>
<el-table-column width="160" label="操作员" prop="liaisonMan" align="center">
<template slot-scope="scope">
{{scope.row.liaisonMan}}
<br/>
{{scope.row.telephone}}
</template>
</el-table-column>
<el-table-column fixed="right" min-width="100" label="审核状态" align="center">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="chooseCheckFailReason(scope.row.id)" >驳回</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 修改 -->
<el-pagination
:current-page="pageOption.pageIndex"
:page-sizes="[5, 10, 20, 40]"
:page-size="pageOption.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageOption.totalCount"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</el-tab-pane>
</el-tabs>
<el-dialog :visible.sync="isShowDialog" width="500px">
<el-form label-width="100px">
<el-form-item label="驳回原因:">
<el-autocomplete
style="width: 350px"
popper-class="my-autocomplete"
v-model="rejectReason"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect">
<i
class="el-icon-edit el-input__icon"
slot="suffix"
@click="handleIconClick">
</i>
<template slot-scope="{ item }">
<div class="name">{{ item.label }}</div>
</template>
</el-autocomplete>
</el-form-item> </el-form-item>
<el-footer style="text-align: center">
<el-button type="warning" @click="setNewPassword('ruleForm2')">确定</el-button>
</el-footer>
</el-form> </el-form>
<span slot="footer" class="dialog-footer">
<el-button v-loading="rejectLoading" type="warning" @click="doCheckReject()">确定</el-button>
<el-button type="primary" @click="isShowDialog = false">取消</el-button>
</span>
</el-dialog>
</div> </div>
</el-container>
</template> </template>
<style lang="less" scope> <style lang="less" scope>
...@@ -153,157 +27,75 @@ ...@@ -153,157 +27,75 @@
import axios from 'axios'; import axios from 'axios';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
import moment from 'moment'; import moment from 'moment';
import Cookies from 'js-cookie';
import { address, photoAddress } from '../../config'; import { address, photoAddress } from '../../config';
export default { export default {
name: 'equipmentCheck', name: 'resetPassword',
data() { data() {
const validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
} else {
if (this.ruleForm2.checkPass !== '') {
this.$refs.ruleForm2.validateField('checkPass');
}
callback();
}
};
const validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.ruleForm2.pass) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return { return {
thisPhotoAddress: photoAddress,
rejectReason: '',
operateOptions: [{
value: '车身照片不符',
label: '车身照片不符',
},
{
value: '车牌号格式不正确',
label: '车牌号格式不正确',
}],
isShowDialog: false,
activeName: 'first',
tableData: [],
pageOption: {
pageIndex: 1,
pageSize: 10,
totalCount: 0,
},
filters: {
rules2: {
pass: [
{ validator: validatePass, trigger: 'blur' },
{ min: 6, message: '密码长度最少为6位', trigger: 'blur' },
],
checkPass: [
{ validator: validatePass2, trigger: 'blur' },
{ min: 6, message: '密码长度最少为6位', trigger: 'blur' },
],
},
ruleForm2: {
pass: '',
checkPass: '',
}, },
checkStatus: 0,
loading: false,
checkLoadingList: [],
checkFailId: '',
rejectLoading: false,
}; };
}, },
mounted() {}, mounted() {},
created() { created() {
this.queryAllEquipment();
}, },
methods: { methods: {
doCheckReject() { setNewPassword(formName) {
if (this.rejectReason) { this.$refs[formName].validate((valid) => {
this.checkFail(this.checkFailId, this.rejectReason); if (valid) {
} else {
this.$message({
type: 'warn',
dangerouslyUseHTMLString: true,
showClose: true,
duration: 3000,
message: '驳回原因不能为空',
});
}
},
handleSelect(item) {
console.log(item);
},
handleIconClick(ev) {
console.log(ev);
},
querySearch(queryString, cb) {
const { operateOptions } = this;
const results = queryString ? operateOptions.filter(this.createFilter(queryString)) : operateOptions;
// 调用 callback 返回建议列表的数据
cb(results);
},
createFilter(queryString) {
return restaurant => (restaurant.label.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
},
handleClick() {
if (this.activeName === 'first') {
this.pageOption = {
pageIndex: 1,
pageSize: 10,
totalCount: 0,
};
this.checkStatus = 0;
this.queryAllEquipment();
} else if (this.activeName === 'second') {
this.pageOption = {
pageIndex: 1,
pageSize: 10,
totalCount: 0,
};
this.checkStatus = 1;
this.queryAllEquipment();
}
},
/** 待审核的 start *** */
chooseCheckFailReason(id) {
this.rejectReason = '';
this.checkFailId = id;
this.isShowDialog = true;
},
checkFail(id, rejectReason) {
this.rejectLoading = true;
this.checkLoadingList.push(id);
axios
.post(`${address}checkVehicle`, {
id,
checkStatus: 0,
rejectReason,
})
.then((response) => {
this.isShowDialog = false;
this.rejectLoading = false;
this.checkLoadingList.splice(this.checkLoadingList.indexOf(id), 1);
if (response.data.code === 200) {
this.$message({
type: 'success',
dangerouslyUseHTMLString: true,
showClose: true,
duration: 3000,
message: '驳回成功',
});
this.queryAllEquipment();
} else {
Message({
message: response.data.message,
duration: 3 * 1000,
});
}
})
.catch((error) => {
this.rejectLoading = false;
this.checkLoadingList.splice(this.checkLoadingList.indexOf(id), 1);
console.log(error);
});
},
checkPass(id) {
this.checkLoadingList.push(id);
axios axios
.post(`${address}checkVehicle`, { .post(`${address}setNewPassword`, {
id, id: Cookies.get('id'),
checkStatus: 1, password: this.ruleForm2.pass,
}) })
.then((response) => { .then((response) => {
this.checkLoadingList.splice(this.checkLoadingList.indexOf(id), 1);
if (response.data.code === 200) { if (response.data.code === 200) {
this.ruleForm2.checkPass = '';
this.ruleForm2.pass = '';
this.$message({ this.$message({
type: 'success', type: 'success',
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
showClose: true, showClose: true,
duration: 3000, duration: 3000,
message: '驳回成功', message: '修改密码成功',
}); });
this.queryAllEquipment();
} else { } else {
Message({ Message({
message: response.data.message, message: response.data.message,
duration: 3 * 1000,
}); });
} }
}) })
...@@ -311,46 +103,10 @@ export default { ...@@ -311,46 +103,10 @@ export default {
this.checkLoadingList.splice(this.checkLoadingList.indexOf(id), 1); this.checkLoadingList.splice(this.checkLoadingList.indexOf(id), 1);
console.log(error); console.log(error);
}); });
},
handleSizeChange(size) {
this.pageOption.pageSize = size;
this.queryAllEquipment();
},
handleCurrentChange(currentPage) {
this.pageOption.pageIndex = currentPage;
this.queryAllEquipment();
},
queryAllEquipment() {
axios
.post(`${address}getVehicleInfos`, {
checkStatus: this.checkStatus,
pageIndex: this.pageOption.pageIndex,
pageSize: this.pageOption.pageSize,
})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
this.pageOption.totalCount = response.data.data.total;
this.tableData = response.data.data.list;
} }
} else {
Message({
message: response.data.message,
duration: 3 * 1000,
// type: 'error',
// duration: '800',
});
}
})
.catch((error) => {
console.log(error);
}); });
}, },
/** 待审核的 end *** */
}, },
}; };
</script> </script>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<el-form-item label="手机号:" prop="phoneNum"> <el-form-item label="手机号:" prop="phoneNum">
<el-input placeholder="请输入手机号" style="width:325px" <el-input placeholder="请输入手机号" style="width:325px"
v-model="createForm.phoneNum" clearable /> v-model="createForm.phoneNum" clearable />
</el-form-item> </el-form-item>
...@@ -108,13 +108,13 @@ export default { ...@@ -108,13 +108,13 @@ export default {
rules: { rules: {
phoneNum: [ phoneNum: [
{ required: true, message: '请输入手机号', trigger: 'blur' }, { required: true, message: '请输入手机号', trigger: 'blur' },
{ {
min: 11, max: 11, message: '请输入11位手机号', trigger: 'blur', min: 11, max: 11, message: '请输入11位手机号', trigger: 'blur',
}, },
{ {
pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/, pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
message: '请输入正确的手机号', message: '请输入正确的手机号',
trigger: 'blur', trigger: 'blur',
}, },
], ],
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
}, },
queryAllProvince() { queryAllProvince() {
axios axios
.post(`${address}selectAllAreasByLevelByParent`, {}) .post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => { .then((response) => {
if (response.data.code === 200) { if (response.data.code === 200) {
if (response.data.data) { if (response.data.data) {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<el-form :inline="true" :model="filters"> <el-form :inline="true" :model="filters">
<el-form-item> <el-form-item>
<el-select <el-select
v-permission="[permission.provincePermission]"
@change="getCityOptions" @change="getCityOptions"
v-model="filters.provinceIds" v-model="filters.provinceIds"
style="width:160px" style="width:160px"
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-select <el-select
v-permission="[permission.provincePermission]"
v-model="filters.cityIds" v-model="filters.cityIds"
multiple multiple
collapse-tags collapse-tags
...@@ -41,7 +43,7 @@ ...@@ -41,7 +43,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input placeholder="请输入手机号码" style="width:160px" <el-input placeholder="请输入用户名" style="width:160px"
v-model="filters.phoneNum" clearable /> v-model="filters.phoneNum" clearable />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -134,7 +136,9 @@ ...@@ -134,7 +136,9 @@
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column width="100" label="市" prop="cityStr" <el-table-column width="100" label="市" prop="cityStr"
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column width="160" label="手机号" prop="userName" <el-table-column width="160" label="用户名" prop="userName"
align="center"></el-table-column>
<el-table-column width="160" label="手机号" prop="phoneNum"
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column width="160" label="创建人" prop="createByStr" <el-table-column width="160" label="创建人" prop="createByStr"
align="center"></el-table-column> align="center"></el-table-column>
...@@ -316,7 +320,7 @@ export default { ...@@ -316,7 +320,7 @@ export default {
const tHeader = [ const tHeader = [
'省', '省',
'市', '市',
'手机号', '用户名',
'创建人', '创建人',
'创建时间', '创建时间',
'状态', '状态',
...@@ -342,7 +346,7 @@ export default { ...@@ -342,7 +346,7 @@ export default {
}, },
getCityOptions() { getCityOptions() {
this.cityOptions = []; this.cityOptions = [];
if (this.filters.provinceIds) { if (this.filters.provinceIds.length>0) {
this.queryCityByProvince(this.filters.provinceIds); this.queryCityByProvince(this.filters.provinceIds);
} }
}, },
...@@ -443,8 +447,9 @@ export default { ...@@ -443,8 +447,9 @@ export default {
this.tableData = response.data.data.list; this.tableData = response.data.data.list;
this.tableData.forEach((e) => { this.tableData.forEach((e) => {
const reg = /^(\d{3})\d{4}(\d{4})$/; const reg = /^(\d{3})\d{4}(\d{4})$/;
if (e.phoneNum) {
e.userName = e.userName.replace(reg, '$1****$2'); e.phoneNum = e.phoneNum.replace(reg, '$1****$2');
}
}); });
} }
} else { } else {
......
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