Commit 4e10ae55 authored by wangxiaoming's avatar wangxiaoming

平台修改 维护

parent 858179d4
......@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<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">
......@@ -27,4 +27,5 @@
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
......@@ -15,10 +15,10 @@
* @see http://blog.csdn.net/win_lin/article/details/12065413
*/
function padding(number, length, prefix) {
if(String(number).length >= length){
return String(number);
}
return padding(prefix+number, length, prefix);
if (String(number).length >= length) {
return String(number);
}
return padding(prefix + number, length, prefix);
}
/**
......@@ -32,22 +32,22 @@ function padding(number, length, prefix) {
* system_array_remove(arr, 20) // arr=[15, 30, 40]
*/
function system_array_remove(arr, elem) {
if (!arr) {
return;
}
var removed = true;
var i = 0;
while (removed) {
removed = false;
for (; i < arr.length; i++) {
if (elem == arr[i]) {
arr.splice(i, 1);
removed = true;
break;
}
}
if (!arr) {
return;
}
let removed = true;
let i = 0;
while (removed) {
removed = false;
for (; i < arr.length; i++) {
if (elem == arr[i]) {
arr.splice(i, 1);
removed = true;
break;
}
}
}
}
/**
......@@ -63,7 +63,7 @@ function system_array_remove(arr, elem) {
* system_array_contains(arr, function(elem){return elem == 60;}); // false
*/
function system_array_contains(arr, elem_or_function) {
return system_array_get(arr, elem_or_function) != null;
return system_array_get(arr, elem_or_function) != null;
}
/**
......@@ -79,18 +79,16 @@ function system_array_contains(arr, elem_or_function) {
* system_array_get(arr, function(elem){return elem == 60;}); // null
*/
function system_array_get(arr, elem_or_function) {
for (var i = 0; i < arr.length; i++) {
if (typeof elem_or_function == "function") {
if (elem_or_function(arr[i])) {
return arr[i];
}
} else {
if (elem_or_function == arr[i]) {
return arr[i];
}
}
for (let i = 0; i < arr.length; i++) {
if (typeof elem_or_function === 'function') {
if (elem_or_function(arr[i])) {
return arr[i];
}
} else if (elem_or_function == arr[i]) {
return arr[i];
}
return null;
}
return null;
}
/**
......@@ -105,47 +103,47 @@ function system_array_get(arr, elem_or_function) {
* @return true when iterate all elems.
*/
function system_array_foreach(arr, pfn) {
if (!pfn) {
return false;
}
if (!pfn) {
return false;
}
for (var i = 0; i < arr.length; i++) {
if (!pfn(arr[i], i)) {
return false;
}
for (let i = 0; i < arr.length; i++) {
if (!pfn(arr[i], i)) {
return false;
}
}
return true;
return true;
}
/**
* whether the str starts with flag.
*/
function system_string_startswith(str, flag) {
if (typeof flag == "object" && flag.constructor == Array) {
for (var i = 0; i < flag.length; i++) {
if (system_string_startswith(str, flag[i])) {
return true;
}
}
if (typeof flag === 'object' && flag.constructor == Array) {
for (let i = 0; i < flag.length; i++) {
if (system_string_startswith(str, flag[i])) {
return true;
}
}
}
return str && flag && str.length >= flag.length && str.indexOf(flag) == 0;
return str && flag && str.length >= flag.length && str.indexOf(flag) == 0;
}
/**
* whether the str ends with flag.
*/
function system_string_endswith(str, flag) {
if (typeof flag == "object" && flag.constructor == Array) {
for (var i = 0; i < flag.length; i++) {
if (system_string_endswith(str, flag[i])) {
return true;
}
}
if (typeof flag === 'object' && flag.constructor == Array) {
for (let i = 0; i < flag.length; i++) {
if (system_string_endswith(str, flag[i])) {
return true;
}
}
}
return str && flag && str.length >= flag.length && str.indexOf(flag) == str.length - flag.length;
return str && flag && str.length >= flag.length && str.indexOf(flag) == str.length - flag.length;
}
/**
......@@ -153,19 +151,19 @@ function system_string_endswith(str, flag) {
* @param flag a string to trim.
*/
function system_string_trim(str, flag) {
if (!flag || !flag.length || typeof flag != "string") {
return str;
}
if (!flag || !flag.length || typeof flag !== 'string') {
return str;
}
while (system_string_startswith(str, flag)) {
str = str.substr(flag.length);
}
while (system_string_startswith(str, flag)) {
str = str.substr(flag.length);
}
while (system_string_endswith(str, flag)) {
str = str.substr(0, str.length - flag.length);
}
while (system_string_endswith(str, flag)) {
str = str.substr(0, str.length - flag.length);
}
return str;
return str;
}
/**
......@@ -180,19 +178,19 @@ function system_string_trim(str, flag) {
* @remark, if need desc, use -1*array_sort_asc(a,b)
*/
function array_sort_asc(elem_a, elem_b) {
if (elem_a > elem_b) {
return 1;
}
return (elem_a < elem_b)? -1 : 0;
if (elem_a > elem_b) {
return 1;
}
return (elem_a < elem_b) ? -1 : 0;
}
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);
}
function system_array_sort_asc(elem_a, elem_b) {
return array_sort_asc(elem_a, elem_b);
return array_sort_asc(elem_a, elem_b);
}
function system_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,66 +212,66 @@ function system_array_sort_desc(elem_a, elem_b) {
}
* @see: http://blog.csdn.net/win_lin/article/details/17994347
*/
function parse_query_string(){
var obj = {};
// add the uri object.
// parse the host(hostname:http_port), pathname(dir/filename)
obj.host = window.location.host;
obj.hostname = window.location.hostname;
obj.http_port = (window.location.port == "")? 80:window.location.port;
obj.pathname = window.location.pathname;
if (obj.pathname.lastIndexOf("/") <= 0) {
obj.dir = "/";
obj.filename = "";
} else {
obj.dir = obj.pathname.substr(0, obj.pathname.lastIndexOf("/"));
obj.filename = obj.pathname.substr(obj.pathname.lastIndexOf("/"));
}
// pure user query object.
obj.user_query = {};
// parse the query string.
var query_string = String(window.location.search).replace(" ", "").split("?")[1];
if(query_string == undefined){
query_string = String(window.location.hash).replace(" ", "").split("#")[1];
if(query_string == undefined){
return obj;
}
function parse_query_string() {
const obj = {};
// add the uri object.
// parse the host(hostname:http_port), pathname(dir/filename)
obj.host = window.location.host;
obj.hostname = window.location.hostname;
obj.http_port = (window.location.port == '') ? 80 : window.location.port;
obj.pathname = window.location.pathname;
if (obj.pathname.lastIndexOf('/') <= 0) {
obj.dir = '/';
obj.filename = '';
} else {
obj.dir = obj.pathname.substr(0, obj.pathname.lastIndexOf('/'));
obj.filename = obj.pathname.substr(obj.pathname.lastIndexOf('/'));
}
// pure user query object.
obj.user_query = {};
// parse the query string.
let query_string = String(window.location.search).replace(' ', '').split('?')[1];
if (query_string == undefined) {
query_string = String(window.location.hash).replace(' ', '').split('#')[1];
if (query_string == undefined) {
return obj;
}
}
__fill_query(query_string, obj);
__fill_query(query_string, obj);
return obj;
return obj;
}
function __fill_query(query_string, obj) {
// pure user query object.
obj.user_query = {};
if (query_string.length == 0) {
return;
}
// split again for angularjs.
if (query_string.indexOf("?") >= 0) {
query_string = query_string.split("?")[1];
}
var queries = query_string.split("&");
for (var i = 0; i < queries.length; i++) {
var elem = queries[i];
var query = elem.split("=");
obj[query[0]] = query[1];
obj.user_query[query[0]] = query[1];
}
// alias domain for vhost.
if (obj.domain) {
obj.vhost = obj.domain;
}
// pure user query object.
obj.user_query = {};
if (query_string.length == 0) {
return;
}
// split again for angularjs.
if (query_string.indexOf('?') >= 0) {
query_string = query_string.split('?')[1];
}
const queries = query_string.split('&');
for (let i = 0; i < queries.length; i++) {
const elem = queries[i];
const query = elem.split('=');
obj[query[0]] = query[1];
obj.user_query[query[0]] = query[1];
}
// alias domain for vhost.
if (obj.domain) {
obj.vhost = obj.domain;
}
}
/**
......@@ -291,67 +289,70 @@ function __fill_query(query_string, obj) {
}
*/
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
var a = document.createElement("a");
a.href = rtmp_url.replace("rtmp://", "http://")
.replace("webrtc://", "http://")
.replace("rtc://", "http://");
var vhost = a.hostname;
var app = a.pathname.substr(1, a.pathname.lastIndexOf("/") - 1);
var stream = a.pathname.substr(a.pathname.lastIndexOf("/") + 1);
// parse the vhost in the params of app, that srs supports.
app = app.replace("...vhost...", "?vhost=");
if (app.indexOf("?") >= 0) {
var params = app.substr(app.indexOf("?"));
app = app.substr(0, app.indexOf("?"));
if (params.indexOf("vhost=") > 0) {
vhost = params.substr(params.indexOf("vhost=") + "vhost=".length);
if (vhost.indexOf("&") > 0) {
vhost = vhost.substr(0, vhost.indexOf("&"));
}
}
// @see: http://stackoverflow.com/questions/10469575/how-to-use-location-object-to-parse-url-without-redirecting-the-page-in-javascri
const a = document.createElement('a');
a.href = rtmp_url.replace('rtmp://', 'http://')
.replace('webrtc://', 'http://')
.replace('rtc://', 'http://');
let vhost = a.hostname;
let app = a.pathname.substr(1, a.pathname.lastIndexOf('/') - 1);
const stream = a.pathname.substr(a.pathname.lastIndexOf('/') + 1);
// parse the vhost in the params of app, that srs supports.
app = app.replace('...vhost...', '?vhost=');
if (app.indexOf('?') >= 0) {
const params = app.substr(app.indexOf('?'));
app = app.substr(0, app.indexOf('?'));
if (params.indexOf('vhost=') > 0) {
vhost = params.substr(params.indexOf('vhost=') + 'vhost='.length);
if (vhost.indexOf('&') > 0) {
vhost = vhost.substr(0, vhost.indexOf('&'));
}
}
// when vhost equals to server, and server is ip,
// the vhost is __defaultVhost__
if (a.hostname == vhost) {
var re = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
if (re.test(a.hostname)) {
vhost = "__defaultVhost__";
}
}
// when vhost equals to server, and server is ip,
// the vhost is __defaultVhost__
if (a.hostname == vhost) {
const re = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
if (re.test(a.hostname)) {
vhost = '__defaultVhost__';
}
// parse the schema
var schema = "rtmp";
if (rtmp_url.indexOf("://") > 0) {
schema = rtmp_url.substr(0, rtmp_url.indexOf("://"));
}
var port = a.port;
if (!port) {
if (schema === 'http') {
port = 80;
} else if (schema === 'https') {
port = 443;
} else if (schema === 'rtmp') {
port = 1935;
} else if (schema === 'webrtc' || schema === 'rtc') {
port = (window.location.href.indexOf('https://')==0)? 443:1985;
}
}
// parse the schema
let schema = 'rtmp';
if (rtmp_url.indexOf('://') > 0) {
schema = rtmp_url.substr(0, rtmp_url.indexOf('://'));
}
let { port } = a;
if (!port) {
if (schema === 'http') {
port = 80;
} else if (schema === 'https') {
port = 443;
} else if (schema === 'rtmp') {
port = 1935;
} else if (schema === 'webrtc' || schema === 'rtc') {
port = (window.location.href.indexOf('https://') == 0) ? 443 : 1985;
}
var ret = {
url: rtmp_url,
schema: schema,
server: a.hostname, port: port,
vhost: vhost, app: app, stream: stream
};
__fill_query(a.search, ret);
return ret;
}
const ret = {
url: rtmp_url,
schema,
server: a.hostname,
port,
vhost,
app,
stream,
};
__fill_query(a.search, ret);
return ret;
}
/**
......@@ -361,9 +362,9 @@ function parse_rtmp_url(rtmp_url) {
* @see: http://blog.csdn.net/win_lin/article/details/17994347
*/
function get_browser_agents() {
var agent = navigator.userAgent;
const agent = navigator.userAgent;
/**
/**
WindowsPC platform, Win7:
chrome 31.0.1650.63:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
......@@ -390,20 +391,20 @@ function get_browser_agents() {
.NET4.0E)
*/
return {
// platform
Android: agent.indexOf("Android") != -1,
Windows: agent.indexOf("Windows") != -1,
iPhone: agent.indexOf("iPhone") != -1,
// Windows Browsers
Chrome: agent.indexOf("Chrome") != -1,
Firefox: agent.indexOf("Firefox") != -1,
QQBrowser: agent.indexOf("QQBrowser") != -1,
MSIE: agent.indexOf("MSIE") != -1,
// Android Browsers
Opera: agent.indexOf("Presto") != -1,
MQQBrowser: agent.indexOf("MQQBrowser") != -1
};
return {
// platform
Android: agent.indexOf('Android') != -1,
Windows: agent.indexOf('Windows') != -1,
iPhone: agent.indexOf('iPhone') != -1,
// Windows Browsers
Chrome: agent.indexOf('Chrome') != -1,
Firefox: agent.indexOf('Firefox') != -1,
QQBrowser: agent.indexOf('QQBrowser') != -1,
MSIE: agent.indexOf('MSIE') != -1,
// Android Browsers
Opera: agent.indexOf('Presto') != -1,
MQQBrowser: agent.indexOf('MQQBrowser') != -1,
};
}
/**
......@@ -412,15 +413,15 @@ function get_browser_agents() {
* @see: http://blog.csdn.net/win_lin/article/details/17994347
* @usage relative_seconds_to_HHMMSS(210)
*/
function relative_seconds_to_HHMMSS(seconds){
var date = new Date();
date.setTime(Number(seconds) * 1000);
function relative_seconds_to_HHMMSS(seconds) {
const date = new Date();
date.setTime(Number(seconds) * 1000);
var ret = padding(date.getUTCHours(), 2, '0')
+ ":" + padding(date.getUTCMinutes(), 2, '0')
+ ":" + padding(date.getUTCSeconds(), 2, '0');
const ret = `${padding(date.getUTCHours(), 2, '0')
}:${padding(date.getUTCMinutes(), 2, '0')
}:${padding(date.getUTCSeconds(), 2, '0')}`;
return ret;
return ret;
}
/**
......@@ -429,15 +430,15 @@ function relative_seconds_to_HHMMSS(seconds){
* @see: http://blog.csdn.net/win_lin/article/details/17994347
* @usage absolute_seconds_to_HHMMSS(new Date().getTime() / 1000)
*/
function absolute_seconds_to_HHMMSS(seconds){
var date = new Date();
date.setTime(Number(seconds) * 1000);
function absolute_seconds_to_HHMMSS(seconds) {
const date = new Date();
date.setTime(Number(seconds) * 1000);
var ret = padding(date.getHours(), 2, '0')
+ ":" + padding(date.getMinutes(), 2, '0')
+ ":" + padding(date.getSeconds(), 2, '0');
const ret = `${padding(date.getHours(), 2, '0')
}:${padding(date.getMinutes(), 2, '0')
}:${padding(date.getSeconds(), 2, '0')}`;
return ret;
return ret;
}
/**
......@@ -447,14 +448,14 @@ function absolute_seconds_to_HHMMSS(seconds){
* @usage absolute_seconds_to_YYYYmmdd(new Date().getTime() / 1000)
*/
function absolute_seconds_to_YYYYmmdd(seconds) {
var date = new Date();
date.setTime(Number(seconds) * 1000);
const date = new Date();
date.setTime(Number(seconds) * 1000);
var ret = date.getFullYear()
+ "-" + padding(date.getMonth() + 1, 2, '0')
+ "-" + padding(date.getDate(), 2, '0');
const ret = `${date.getFullYear()
}-${padding(date.getMonth() + 1, 2, '0')
}-${padding(date.getDate(), 2, '0')}`;
return ret;
return ret;
}
/**
......@@ -464,9 +465,9 @@ function absolute_seconds_to_YYYYmmdd(seconds) {
* @usage YYYYmmdd_parse("2014-12-11")
*/
function YYYYmmdd_parse(str) {
var date = new Date();
date.setTime(Date.parse(str));
return date;
const date = new Date();
date.setTime(Date.parse(str));
return date;
}
/**
......@@ -503,38 +504,38 @@ function YYYYmmdd_parse(str) {
}
*/
function AsyncRefresh(pfn, refresh_interval) {
this.refresh_interval = refresh_interval;
this.refresh_interval = refresh_interval;
this.__handler = null;
this.__pfn = pfn;
this.__handler = null;
this.__pfn = pfn;
this.__enabled = true;
this.__enabled = true;
}
/**
* disable the refresher, the pfn must check the refresh state.
*/
AsyncRefresh.prototype.refresh_disable = function() {
this.__enabled = false;
}
AsyncRefresh.prototype.refresh_enable = function() {
this.__enabled = true;
}
AsyncRefresh.prototype.refresh_is_enabled = function() {
return this.__enabled;
}
AsyncRefresh.prototype.refresh_disable = function () {
this.__enabled = false;
};
AsyncRefresh.prototype.refresh_enable = function () {
this.__enabled = true;
};
AsyncRefresh.prototype.refresh_is_enabled = function () {
return this.__enabled;
};
/**
* start new async request
* @param timeout the timeout in ms.
* user can use the refresh_interval of the AsyncRefresh object,
* which initialized in constructor.
*/
AsyncRefresh.prototype.request = function(timeout) {
if (this.__handler) {
clearTimeout(this.__handler);
}
AsyncRefresh.prototype.request = function (timeout) {
if (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.
......@@ -565,7 +566,7 @@ AsyncRefresh.prototype.request = function(timeout) {
}]);
*/
function AsyncRefresh2() {
/**
/**
* the function callback before call the pfn.
* the protype is function():bool, which return true to invoke, false to abort the call.
* null to ignore this callback.
......@@ -579,98 +580,98 @@ function AsyncRefresh2() {
* return true;
* };
*/
this.on_before_call_pfn = null;
// use a anonymous function to call, and check the enabled when actually invoke.
this.__call = {
pfn: null,
timeout: 0,
__enabled: false,
__handler: null
};
this.on_before_call_pfn = null;
// use a anonymous function to call, and check the enabled when actually invoke.
this.__call = {
pfn: null,
timeout: 0,
__enabled: false,
__handler: null,
};
}
// singleton
var async_refresh2 = new AsyncRefresh2();
const async_refresh2 = new AsyncRefresh2();
/**
* initialize or refresh change. cancel previous request, setup new request.
* @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.
*/
AsyncRefresh2.prototype.initialize = function(pfn, timeout) {
this.refresh_change(pfn, timeout);
}
AsyncRefresh2.prototype.initialize = function (pfn, timeout) {
this.refresh_change(pfn, timeout);
};
/**
* stop refresh, the refresh pfn is set to null.
*/
AsyncRefresh2.prototype.stop = function() {
this.__call.__enabled = false;
}
AsyncRefresh2.prototype.stop = function () {
this.__call.__enabled = false;
};
/**
* restart refresh, use previous config.
*/
AsyncRefresh2.prototype.restart = function() {
this.__call.__enabled = true;
this.request(0);
}
AsyncRefresh2.prototype.restart = function () {
this.__call.__enabled = true;
this.request(0);
};
/**
* change refresh pfn, the old pfn will set to disabled.
*/
AsyncRefresh2.prototype.refresh_change = function(pfn, timeout) {
// cancel the previous call.
if (this.__call.__handler) {
clearTimeout(this.__handler);
}
this.__call.__enabled = false;
// setup new call.
this.__call = {
pfn: pfn,
timeout: timeout,
__enabled: true,
__handler: null
};
}
AsyncRefresh2.prototype.refresh_change = function (pfn, timeout) {
// cancel the previous call.
if (this.__call.__handler) {
clearTimeout(this.__handler);
}
this.__call.__enabled = false;
// setup new call.
this.__call = {
pfn,
timeout,
__enabled: true,
__handler: null,
};
};
/**
* start new request, we never auto start the request,
* user must start new request when previous completed.
* @param timeout [optional] if not specified, use the timeout in initialize or refresh_change.
*/
AsyncRefresh2.prototype.request = function(timeout) {
var self = this;
var this_call = this.__call;
// clear previous timeout.
if (this_call.__handler) {
clearTimeout(this_call.__handler);
}
// override the timeout
if (timeout == undefined) {
timeout = this_call.timeout;
AsyncRefresh2.prototype.request = function (timeout) {
const self = this;
const this_call = this.__call;
// clear previous timeout.
if (this_call.__handler) {
clearTimeout(this_call.__handler);
}
// override the timeout
if (timeout == undefined) {
timeout = this_call.timeout;
}
// if user disabled refresher.
if (this_call.pfn == null || timeout == null) {
return;
}
this_call.__handler = setTimeout(() => {
// cancelled by refresh_change, ignore.
if (!this_call.__enabled) {
return;
}
// if user disabled refresher.
if (this_call.pfn == null || timeout == null) {
// callback if the handler installled.
if (self.on_before_call_pfn) {
if (!self.on_before_call_pfn()) {
return;
}
}
this_call.__handler = setTimeout(function(){
// cancelled by refresh_change, ignore.
if (!this_call.__enabled) {
return;
}
// callback if the handler installled.
if (self.on_before_call_pfn) {
if (!self.on_before_call_pfn()) {
return;
}
}
// do the actual call.
this_call.pfn();
}, timeout);
}
// do the actual call.
this_call.pfn();
}, timeout);
};
// other components.
/**
......@@ -678,4 +679,4 @@ AsyncRefresh2.prototype.request = function(timeout) {
* depends: jquery1.10, boostrap2
* https://code.csdn.net/snippets/146160
* @see: http://blog.csdn.net/win_lin/article/details/17628631
*/
\ No newline at end of file
*/
......@@ -53,6 +53,7 @@
console.log("liveUrl"+url);
//"webrtc://152.136.233.116/live/livestream"
var urlObject = parse_rtmp_url(url);
/*urlObject*/
var schema = window.location.protocol;
// Close PC when user replay.
......@@ -78,7 +79,7 @@
return pc.setLocalDescription(offer).then(function(){ return offer; });
}).then(function(offer) {
return new Promise(function(resolve, reject) {
var port = urlObject.port || 1985;
var port = 1985;
// @see https://github.com/rtcdn/rtcdn-draft
var api = urlObject.user_query.play || '/rtc/v1/play/';
......@@ -94,7 +95,7 @@
}
// Replace /rtc/v1/play/&k=v to /rtc/v1/play/?k=v
url = url.replace(api + '&', api + '?');
url=url.replace('https', 'http');
// @see https://github.com/rtcdn/rtcdn-draft
var data = {
api: url, streamurl: urlObject.url, clientip: null, sdp: offer.sdp
......@@ -102,7 +103,7 @@
console.log("Generated offer: ", data);
$.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'
}).done(function(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 videoAddress = 'http://106.52.130.113:8000';
const photoAddress = 'http://106.52.130.113:8000';
const videoAddress = 'https://xj.roadgrids.com';
const photoAddress = 'https://xj.roadgrids.com';
const imgAddress = '/roadlinks/';// 测试环境
const title = '安徽省道路综合巡检平台';
const title = '道路综合巡检平台';
export {
address, photoAddress, imgAddress, videoAddress,
};
......@@ -2,7 +2,7 @@ const address = '/roadlinks/';
const videoAddress = 'http://106.52.130.113:8000';
const photoAddress = 'http://106.52.130.113:8000';
const imgAddress = '/roadlinks/';// 测试环境
const title = '安徽省道路综合巡检平台';
const title = '道路综合巡检平台';
export {
address, photoAddress, imgAddress, videoAddress,
};
const address = '/roadlinks/';
const videoAddress = 'http://106.52.130.113:8000';
const photoAddress = 'http://106.52.130.113:8000';
const address = 'http://localhost:8088/roadlinks/';
const videoAddress = 'https://xj.roadgrids.com';
const photoAddress = 'https://xj.roadgrids.com';
const imgAddress = '/roadlinks/';// 测试环境
const title = '安徽省道路综合巡检平台';
const title = '道路综合巡检平台';
export {
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, {
Object.defineProperty(Vue.prototype, '$moment', { value: moment });
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;
router.beforeEach((to, from, next) => {
window.scrollTo(0, 0);
if (to.matched.some(record => record.meta.requireAuth)) {
// 判断该路由是否需要登录权限
if (Cookies.get('id')) { // 判断当前的token是否存在
if (_hmt) {
if (to.path) {
_hmt.push(['_trackPageview', `/#${to.fullPath}`]);
}
}
next();
} else {
// next();
......@@ -55,7 +71,7 @@ axios.interceptors.request.use(
(config) => {
config.baseURL = '/';
config.withCredentials = true; // 允许携带token ,这个是解决跨域产生的相关问题
config.timeout = 6000;
config.timeout = 60000;
const token = Cookies.get('id');
if (token) {
config.headers = {
......@@ -84,7 +100,8 @@ const permission = {
const roles = JSON.parse(localStorage.getItem('permission'));
if (value && value instanceof Array && value.length > 0) {
const permissionRoles = value;
const hasPermission = roles.some(role => permissionRoles.includes(role));
const hasPermission = roles ? roles.some(role => permissionRoles.includes(role)) : false;
if (!hasPermission) {
el.parentNode && el.parentNode.removeChild(el);
}
......
......@@ -5,6 +5,9 @@ const permission = {
userAuthorization: '004',
equipmentList_edit: '002.001',
userManagement_edit: '003.001',
resultCheck_edit: '005.001',
provincePermission: '2',
cityPermission: '3',
};
export {
permission,
......
......@@ -7,6 +7,46 @@
<!--搜索栏-->
<el-col :span="24" class="toolbar">
<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-select
v-model="filters.capitalType"
......@@ -30,7 +70,7 @@
></el-autocomplete>-->
</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>
</el-col>
......@@ -44,6 +84,7 @@
:highlight-current-row="true"
>
<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="position"></el-table-column>
</el-table>
......@@ -74,13 +115,20 @@ import { Message } from 'element-ui';
import echarts from 'echarts';
import moment from 'moment';
import { address, photoAddress } from '../config';
import { permission } from '../permission';
export default {
name: 'detail',
data() {
return {
searchLoading: false,
permission,
provinceOptions: [],
cityOptions: [],
tableData: [],
filters: {
cityIds: [],
provinceIds: [],
capitalType: [],
},
showCol: false,
......@@ -94,14 +142,68 @@ export default {
},
mounted() {},
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 = [];
if (this.$route.params.capitalName) {
this.filters.capitalType.push(this.$route.params.capitalName);
}
this.getCapitalDetails();
this.getAllCapitals();
this.queryAllProvinceByPermission();
},
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) {
this.getCurrentDate();
const photoDate = row.finalOnlineTime
......@@ -235,8 +337,8 @@ export default {
if (response.data.code === 200) {
this.capitalOptions = [];
if (response.data.data) {
/* console.log(response.data.data);*/
const capitals = response.data.data;
/* console.log(response.data.data); */
const capitals = response.data.data.sdServices;
const nameSet = new Set();
capitals.forEach((val) => {
nameSet.add(val.capitalName);
......@@ -254,6 +356,12 @@ export default {
});
},
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;
let capitalName = '';
if (this.filters.capitalType) {
......@@ -265,12 +373,21 @@ export default {
}
});
}
this.searchLoading = true;
sessionStorage.setItem(
'detailSearchVal',
JSON.stringify(this.filters),
);
axios
.post(`${address}getCapitalDetails`, {
capitalName,
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
})
.then((response) => {
if (response.data.code === 200) {
this.searchLoading = false;
this.tableData = [];
this.no = 0;
if (response.data.data) {
......@@ -286,6 +403,7 @@ export default {
nameMap.set(val.capitalName, num);
}
this.tableData.push({
office: val.office,
no: ++this.no,
name: val.capitalName + num,
position: val.position,
......@@ -295,6 +413,7 @@ export default {
}
})
.catch((error) => {
this.searchLoading = false;
console.log(error);
});
},
......
......@@ -13,9 +13,16 @@
<div v-if="provinceId ==109">
<img style="width:100px;height:80px" src="../assets/logo_anhui.png" alt />
</div>
<div v-else-if="provinceId != 109">
<img style="width:100px;height:80px" src="../assets/logo_new.png" alt />
<div v-else-if="provinceId == 239">
<img style="width:100px;height:100px" src="../assets/logo_guangxi.png" alt />
</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>
<el-submenu index="1">
......@@ -94,7 +101,7 @@
</el-menu-item>
</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>
<el-menu-item
v-permission="[permission.userManagement]"
......@@ -112,13 +119,13 @@
>
<span slot="title" style="font-size: 16px">授权账户</span>
</el-menu-item>
<!-- <el-menu-item
<el-menu-item
index="6-3"
@click="goTo('/resetPassword')"
style="background:#252639 !important"
>
<span slot="title" style="font-size: 16px">修改密码</span>
</el-menu-item>-->
</el-menu-item>
</el-submenu>
</el-menu>
</el-scrollbar>
......
......@@ -6,6 +6,45 @@
<!--搜索栏-->
<el-col :span="24" class="toolbar">
<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-select
v-model="filters.equipment"
......@@ -60,8 +99,8 @@
</div>
</div>
<el-dialog :visible.sync="isShowVideo" width="1000px" height="5900px">
<iframe style="width:100%;height:600px" id="live" :src=playerSrc></iframe>
<el-dialog :visible.sync="isShowVideo" width="760px" height="550px">
<iframe style="width:100%;height:580px" id="live" :src=playerSrc></iframe>
<!-- <video-player
@play="onPlayerPlay($event)"
......@@ -105,11 +144,15 @@ import 'video.js/dist/video-js.css';
import 'vue-video-player/src/custom-theme.css';
import 'videojs-flash';
import Cookies from 'js-cookie';
import { permission } from '../permission';
export default {
name: 'video',
data() {
return {
permission,
provinceOptions: [],
cityOptions: [],
playerSrc: '',
isShowTip: false,
plateNoOptions: [],
......@@ -123,6 +166,8 @@ export default {
totalCount: 0,
},
filters: {
cityIds: [],
provinceIds: [],
equipment: [],
},
loading: false,
......@@ -174,8 +219,8 @@ export default {
},
timer: '',
liveUrl: 'webrtc://152.136.233.116/live/',
liveIp: '?eip=152.136.233.116',
liveUrl: 'webrtc://146.56.198.18:8080/live/',
liveIp: '?eip=146.56.198.18',
};
},
watch: {
......@@ -189,8 +234,9 @@ export default {
this.timer = setInterval(this.watchLive, 10000);
},
created() {
this.queryAllProvinceByPermission();
this.queryAllEquipment();
const searchVal = sessionStorage.getItem('videoSearchVal');
const searchVal = sessionStorage.getItem('liveSearchVal');
const that = this;
if (this.$route.params.startTime) {
......@@ -211,10 +257,62 @@ export default {
} else if (searchVal) {
this.filters = JSON.parse(searchVal);
}
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
this.getParkVideos();
this.getLiveUrl();
},
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() {
this.playerOptions.sources[0].src = '';
axios
......@@ -314,9 +412,10 @@ export default {
if (response.data.data && response.data.data.length > 0) {
const channelAndDevid = `${item.code}_${item.channelCode}`;
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}${channelAndDevid}${this.liveIp}&random=${random}`;
/* const channel = item.channelCode;
const devid = item.code;
const src = `http://152.136.233.116:1965/live/${devid}_${channel}.m3u8`;
......@@ -355,7 +454,7 @@ export default {
Message({
message: response.data.message,
duration: 3 * 1000,
type: 'error',
type: 'error',
// duration: '800',
});
}
......@@ -366,13 +465,23 @@ export default {
},
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;
const that = this;
sessionStorage.setItem('liveSearchVal', JSON.stringify(this.filters));
axios
.post(`${address}getParkLives`, {
cityIds: that.filters.cityIds,
provinceIds: that.filters.provinceIds,
equipment: that.filters.equipment,
pageIndex: this.pageOption.pageIndex,
pageSize: this.pageOption.pageSize,
pageIndex: that.pageOption.pageIndex,
pageSize: that.pageOption.pageSize,
})
.then((response) => {
that.searchLoading = false;
......
......@@ -14,20 +14,20 @@
>
<el-form-item prop="username">
<el-input
auto-complete="new-password"
@keyup.enter.native="handleLogin"
v-model="loginForm.username"
auto-complete="off"
placeholder="请输入手机号"
placeholder="请输入用户名"
>
<i slot="prefix" class="elxingmingyonghumingnicheng"></i>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
auto-complete="new-password"
@keyup.enter.native="handleLogin"
:type="passwordType"
v-model="loginForm.password"
auto-complete="off"
placeholder="请输入密码"
>
<i
......@@ -57,6 +57,8 @@
</div>
</div>
</div>
</template>
<script>
......@@ -84,7 +86,7 @@ export default {
loginRules: {
// 绑定在form表单中的验证规则
username: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ required: true, message: '请输入用户名', trigger: 'blur' },
{ validator: this.isExists, trigger: 'blur' },
],
......@@ -104,6 +106,21 @@ export default {
computed: {},
props: [],
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) {
axios
.post(`${address}getUserInfoByUserName`, {
......@@ -111,12 +128,12 @@ export default {
}).then((res) => {
// eslint-disable-next-line eqeqeq
if (res.data.code != 200) {
callback(new Error('手机号不存在'));
callback(new Error('用户名不存在'));
} else {
callback();
}
}).catch(() => {
callback(new Error('手机号不存在'));
callback(new Error('用户名不存在'));
});
},
// 跳转到home页
......@@ -142,6 +159,8 @@ export default {
? (this.passwordType = 'password')
: (this.passwordType = '');
},
// 点击登入按钮
handleLogin() {
this.$refs.loginForm.validate((valid) => {
......@@ -154,13 +173,16 @@ export default {
})
.then((response) => {
if (response.data.code === 200) {
sessionStorage.clear();
Cookies.set('id', response.data.data.id);
Cookies.set('username', this.loginForm.username);
Cookies.set('sessionId', response.data.data.sessionId);
sessionStorage.setItem('modifyPasswordStatus', response.data.data.modifyStatus);
store.state.provinceId = response.data.data.provinceId;
store.state.permissionList = response.data.data.permissionList;
localStorage.setItem('permission', JSON.stringify(store.state.permissionList));
localStorage.setItem('provinceId', store.state.provinceId);
this.changeFavicon(store.state.provinceId);
this.goToHome();
} else {
Message({
......
<template>
<div class="overview">
<div class="box">
<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">
<el-table
......@@ -45,9 +94,22 @@
<h3>任务统计</h3>
<div class="echarts-box" id="echarts-box"></div>
</div>-->
</el-row>
</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>
</template>
<script>
......@@ -55,13 +117,20 @@ import axios from 'axios';
import { Message } from 'element-ui';
import echarts from 'echarts';
import moment from 'moment';
import Cookies from 'js-cookie';
import { address } from '../config';
import { permission } from '../permission';
export default {
name: 'overview',
data() {
return {
office: '淮南',
dialogVisible: false,
permission,
searchLoading: false,
provinceOptions: [],
cityOptions: [],
office: '',
tableData: [],
typeData: [
{ value: 0, label: '全部' },
......@@ -74,6 +143,8 @@ export default {
{ value: false, label: '未启用' },
],
filters: {
cityIds: [],
provinceIds: [],
equipmentNo: '',
plateNo: '',
channel: '',
......@@ -97,10 +168,110 @@ export default {
},
mounted() {},
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.getAllCapitals();
this.queryAllProvinceByPermission();
this.changeFavicon(localStorage.getItem('provinceId'));
/* this.awaitDemo(); */
},
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({
row, column, rowIndex, columnIndex,
}) {
......@@ -113,6 +284,8 @@ export default {
this.$router.push({
name: 'detail',
params: {
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
capitalName: row.name,
},
});
......@@ -196,16 +369,33 @@ export default {
console.log(this.currentPage); // 点击第几页
},
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
.post(`${address}getAllCapitals`, {})
.post(`${address}getAllCapitals`, {
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
})
.then((response) => {
if (response.data.code === 200) {
this.searchLoading = false;
this.tableData = [];
this.no = 0;
this.tableId = 0;
if (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;
const capitalTypeMap = new Map();
const capitalNameMap = new Map();
......@@ -269,11 +459,11 @@ export default {
}
this.tableData.push(tableItem);
}
/* console.log(`llllllll${JSON.stringify(this.tableData)}`); */
}
}
})
.catch((error) => {
this.searchLoading = false;
console.log(error);
});
},
......
......@@ -7,6 +7,7 @@
</div>
<div class="formBody">
<h1 class="section-title" data-i18n-text>注册账户</h1>
<el-form
:model="ruleForm2"
status-icon
......@@ -15,8 +16,13 @@
label-width="120px"
class="demo-ruleForm"
>
<el-form-item label="手机号" prop="user">
<el-input v-model="ruleForm2.user" placeholder="请输入手机号"></el-input>
<input type="text" style="display: none;" >
<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 label="姓名" prop="realName">
<el-input v-model="ruleForm2.realName" placeholder="请输入姓名"></el-input>
......@@ -43,6 +49,7 @@
clearable
filterable
placeholder="请选择市区"
autocomplete="new-password"
>
<el-option
v-for="item in cityOptions"
......@@ -56,10 +63,10 @@
</el-form-item>
<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 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 style="text-align: center ;margin-left:-120px">
......@@ -103,6 +110,7 @@ export default {
provinceOptions: [],
cityOptions: [],
ruleForm2: {
phoneNum: '',
provinceId: '',
cityId: '',
realName: '',
......@@ -119,16 +127,21 @@ export default {
{ validator: validatePass2, 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}$/,
message: '请输入正确的手机号码',
message: '请输入正确的用户名',
trigger: 'blur',
},
{ validator: this.isAuth, trigger: 'blur' }],
],
},
};
......@@ -140,7 +153,7 @@ export default {
isAuth(rule, value, callback) {
axios
.post(`${address}getUserAuthInfoByUserName`, {
username: this.ruleForm2.user,
username: this.ruleForm2.phoneNum,
}).then((res) => {
// eslint-disable-next-line eqeqeq
if (res.data.code != 200) {
......@@ -154,14 +167,17 @@ export default {
},
getCityOptions() {
this.cityOptions = [];
if (this.ruleForm2.provinceId) {
this.queryCityByProvince(this.ruleForm2.provinceId);
}
},
queryCityByProvince(provinceId) {
const parentIds = [];
parentIds.push(provinceId);
axios
.post(`${address}selectAllAreasByLevelByParent`, {
parentId: provinceId,
parentIds,
})
.then((response) => {
if (response.data.code === 200) {
......@@ -208,12 +224,13 @@ export default {
console.log(this.ruleForm2.user + this.ruleForm2.pass);
axios
.post(`${address}register`, {
phoneNum: this.ruleForm2.phoneNum,
username: this.ruleForm2.user,
password: this.ruleForm2.pass,
status: 1,
cityId:this.ruleForm2.cityId,
provinceId:this.ruleForm2.provinceId,
realName:this.ruleForm2.realName,
cityId: this.ruleForm2.cityId,
provinceId: this.ruleForm2.provinceId,
realName: this.ruleForm2.realName,
})
.then((response) => {
if (response.data.code === 200) {
......
......@@ -7,6 +7,47 @@
<!--搜索栏-->
<el-col :span="24" class="toolbar">
<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-select
v-model="filters.plateNo"
......@@ -72,6 +113,7 @@
</template>
</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="240" label="起始时间 - 终止时间" prop="startEndTime" 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';
// eslint-disable-next-line import/no-extraneous-dependencies
import moment from 'moment';
import { export_json_to_excel } from '@/excel/Export2Excel';
import Cookies from 'js-cookie';
import { permission } from '../permission';
import {
address, photoAddress,
} from '../config';
export default {
name: 'result',
data() {
return {
permission,
provinceOptions: [],
cityOptions: [],
contentstr: '',
isShowMark: false,
markObj: {
......@@ -389,6 +435,8 @@ export default {
allPoints: [],
imgs: [],
filters: {
cityIds: [],
provinceIds: [],
plateNo: [],
dateTime: [],
},
......@@ -557,18 +605,31 @@ export default {
};
},
mounted() {
},
created() {
if (this.$route.params.startTime && this.$route.params.endTime) {
this.filters.dateTime = [
this.$route.params.startTime,
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) {
const { equipment } = this.$route.params.equipment;
this.filters.plateNo = equipment.split(',');
const { equipment } = this.$route.params;
if (equipment) {
this.filters.plateNo = equipment.split(',');
}
}
if (this.filters.dateTime.length > 0 || this.filters.plateNo.length > 0) {
// do nothing
} else {
......@@ -577,7 +638,22 @@ export default {
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.queryAllProvinceByPermission();
this.queryAllEquipment();
this.getInspectResultForTableData();
this.queryTravel();
......@@ -587,7 +663,45 @@ export default {
},
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) {
this.pagesize = size;
},
......@@ -654,9 +768,11 @@ export default {
'巡检里程',
'巡检资产',
'正常资产',
'丢失资产',
'新增资产',
'路面抛洒物',
'护栏弯曲',
'新增资产',
];
// filterVal为tHeader标题对应的键值
const filterVal = [
......@@ -667,16 +783,17 @@ export default {
'inspectDistance',
'inspectNum',
'normalNum',
'abNormalNum',
'newInspectNum',
'roadLetterNum',
'guardrailNum',
'newInspectNum',
];
// list为要转化为excel文件的数据,是一个数组
const list = this.tableData;
// 用map方法处理list数据
const data = list.map(v => filterVal.map(j => v[j]));
// 自定义excel文件名
const fileName = '巡检结果';
const fileName = '巡检结果查看';
export_json_to_excel(tHeader, data, fileName);
});
},
......@@ -871,6 +988,13 @@ export default {
},
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) {
this.filters.dateTime = [
`${moment(
......@@ -901,6 +1025,8 @@ export default {
startTime: that.filters.dateTime[0],
endTime: that.filters.dateTime[1],
equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
})
.then((response) => {
that.tableData = [];
......@@ -908,6 +1034,7 @@ export default {
// console.log(JSON.stringify(response.data.data));
response.data.data.forEach((val) => {
that.tableData.push({
office: `${val.office}管理处`,
startUrl: require('../assets/img/qidian.png'),
endUrl: require('../assets/img/zhongdian.png'),
startLng: val.startLng,
......@@ -965,7 +1092,13 @@ export default {
},
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) {
this.filters.dateTime = [
`${moment(
......@@ -981,13 +1114,13 @@ export default {
if (this.filters.plateNo && this.filters.plateNo.length > 0) {
this.filters.plateNo.forEach((item) => {
if (equipmentCode === '') {
equipmentCode += item.code;
equipmentCode += item;
} else {
equipmentCode += `,${item.code}`;
equipmentCode += `,${item}`;
}
});
}
sessionStorage.setItem('searchVal', JSON.stringify(this.filters));
this.searchLoading = true;
const that = this;
axios
......@@ -995,6 +1128,8 @@ export default {
startTime: that.filters.dateTime[0],
endTime: that.filters.dateTime[1],
equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
})
.then((response) => {
that.searchLoading = false;
......@@ -1009,7 +1144,7 @@ export default {
that.imgs = [];
that.allImgs = [];
that.no = 0;
const newStr = Cookies.get('id') == 1 ? '新增' : '正常';
// eslint-disable-next-line no-var,no-restricted-syntax,vars-on-top
// 循环 轨迹信息
for (const key in response.data.data) {
......@@ -1029,84 +1164,87 @@ export default {
if (item.images) {
// 资产及对应图片信息
item.images.forEach((info) => {
// eslint-disable-next-line no-plusplus
that.no = ++that.no;
// 根据经纬度 计算地图的 lng 和lat
if (info.longitude && info.latitude) {
const result = gcoord.transform(
[info.longitude, info.latitude],
gcoord.WGS84,
gcoord.BD09,
);
if (info.status !== 2) {
// eslint-disable-next-line no-plusplus
that.no = ++that.no;
// 根据经纬度 计算地图的 lng 和lat
if (info.longitude && info.latitude) {
const result = gcoord.transform(
[info.longitude, info.latitude],
gcoord.WGS84,
gcoord.BD09,
);
// 这个是看类型的
that.capitalOptions.forEach((capital) => {
if (capital.value === info.type2) {
// eslint-disable-next-line no-param-reassign
info.type2 = capital.label;
}
});
// 这个是地图点
carPointsTmp.push({
// eslint-disable-next-line global-require,no-nested-ternary
lng: result[0],
lat: result[1],
markerAnim: '',
url:
that.capitalOptions.forEach((capital) => {
if (capital.value === info.type2) {
// eslint-disable-next-line no-param-reassign
info.type2 = capital.label;
}
});
// 这个是地图点
carPointsTmp.push({
// eslint-disable-next-line global-require,no-nested-ternary
lng: result[0],
lat: result[1],
markerAnim: '',
url:
info.status === 1 || info.status === 3
// eslint-disable-next-line global-require
? require('../assets/img/map-marker_orange.png')
// eslint-disable-next-line global-require
: require('../assets/img/jingbao_red.png'),
status: info.status,
statusStr: info.statusStr,
content: that.no.toString(),
title: '',
position: info.position,
titleList: [
`资产类型:${info.type2}`,
`资产状态:${
status: info.status,
statusStr: info.statusStr,
content: that.no.toString(),
title: '',
position: info.position,
titleList: [
`资产类型:${info.type2}`,
`资产状态:${
// eslint-disable-next-line no-nested-ternary
info.status === 0
? '正常'
: info.status === 1
? newStr
: info.status === 2
? '丢失' : '异常'
}`,
`位置:${info.position}`,
],
});
// 这个应该是右边的图片
carImgsTmp.push({
type1: info.type1,
type: info.type,
timestamp: info.imageTime,
position: info.position,
status: info.status,
statusStr: info.statusStr,
lng: result[0],
lat: result[1],
imageId: info.imageId,
// eslint-disable-next-line no-nested-ternary
url: photoAddress + info.smallImagePath,
content: `${info.info} | ${
// eslint-disable-next-line no-nested-ternary
info.status === 0
? '正常'
: info.status === 1
? '新增'
? newStr
: info.status === 2
? '丢失' : '异常'
}`,
`位置:${info.position}`,
],
});
// 这个应该是右边的图片
carImgsTmp.push({
type1: info.type1,
type: info.type,
timestamp: info.imageTime,
position: info.position,
status: info.status,
statusStr: info.statusStr,
lng: result[0],
lat: result[1],
imageId: info.imageId,
// eslint-disable-next-line no-nested-ternary
url: photoAddress + info.smallImagePath,
content: `${info.info} | ${
// eslint-disable-next-line no-nested-ternary
info.status === 0
? '正常'
: info.status === 1
? '新增'
: info.status === 2
? '丢失' : '异常'
} | ${info.position}`,
number: that.no,
id: `imageCard${that.no}`,
vector: info.vector,
});
} | ${info.position}`,
number: that.no,
id: `imageCard${that.no}`,
vector: info.vector,
});
}
}
});
}
// 这个是计算距离的
if (index < val.length - 1) {
if (
......@@ -1201,22 +1339,45 @@ export default {
const contentTypeMap = [];
// eslint-disable-next-line no-shadow
contents.forEach((c, index) => {
contentTypeMap.push(c.type1);
// eslint-disable-next-line eqeqeq
if (c.type == 0) {
contentTypeMap.push(c.type1);
} else {
contentTypeMap.push(3);
}
ImgGroups.push({ index: index + 1, name: c.name });
});
let normalNum = 0;
let insertNum = 0;
let loseNum = 0;
let abNormalNum = 0;
contentTypeMap.forEach((ct) => {
// eslint-disable-next-line eqeqeq
if (ct == 0) {
normalNum += 1;
// eslint-disable-next-line eqeqeq
} else if (ct == 1) {
insertNum += 1;
// eslint-disable-next-line eqeqeq
if (Cookies.get('id') == 1) {
insertNum += 1;
} else {
normalNum += 1; // insertNum 平台修改 修改新增
}
// eslint-disable-next-line eqeqeq
} else if (ct == 2) {
loseNum += 1;
// eslint-disable-next-line eqeqeq
if (Cookies.get('id') == 1) {
loseNum += 1;
} else {
// loseNum += 1;
}
// eslint-disable-next-line eqeqeq
} else if (ct == 3) {
abNormalNum += 1;
}
});
if (normalNum > 0) {
......@@ -1228,6 +1389,9 @@ export default {
if (loseNum > 0) {
contentTypeStr += `丢失:${loseNum}个,`;
}
if (abNormalNum > 0) {
contentTypeStr += `异常:${abNormalNum}个,`;
}
// eslint-disable-next-line no-underscore-dangle
let groupedItems = that.$_(ImgGroups)
.groupBy(item => item.name);
......@@ -1264,7 +1428,7 @@ export default {
e.status === 0
? '正常'
: e.status === 1
? '新增'
? newStr
: e.status === 2
? '丢失' : '异常'
}`,
......@@ -1329,12 +1493,20 @@ export default {
return (d * Math.PI) / 180.0;
},
linkDetail(index, row) {
let equipment = '';
this.plateNoOptions.forEach((e) => {
if (e.plateNo == row.plateNo) {
equipment = e.code;
}
});
this.$router.push({
name: 'resultDetail',
params: {
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
startTime: row.startTime,
endTime: row.endTime,
equipment: row.plateNo,
equipment,
},
});
},
......
......@@ -6,16 +6,75 @@
<!--搜索栏-->
<el-col :span="24" class="toolbar">
<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-select
v-model="filters.capitalType"
collapse-tags
clearable
style="width:180px"
filterable
placeholder="巡检目标"
>
<!--@change="selectCapitalType"-->
<el-option
v-for="item in capitalOptions"
:key="item.value"
......@@ -23,19 +82,13 @@
:value="item.value"
></el-option>
</el-select>
<!-- <el-autocomplete
v-model="filters.channelName"
:fetch-suggestions="queryChannelSearchAsync"
placeholder="渠道"
@select="handleChannelSelect"
></el-autocomplete>-->
</el-form-item>
<el-form-item>
<el-select
v-model="filters.status"
collapse-tags
clearable
filterable
style="width:180px"
placeholder="目标状态"
@change="selectStatus"
>
......@@ -94,6 +147,7 @@
highlight-current-row
>
<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="120" label="巡检目标" prop="info" align="center"></el-table-column>
<el-table-column width="400" label="目标位置" prop="position" align="center"></el-table-column>
......@@ -156,6 +210,7 @@
</div>
</el-dialog>
<el-dialog
v-permission="[permission.resultCheck_edit]"
title="确认信息"
v-el-drag-dialog
:visible.sync="dialogVisible1"
......@@ -169,6 +224,7 @@
</span>
</el-dialog>
<el-dialog
v-permission="[permission.resultCheck_edit]"
title="确认信息"
v-el-drag-dialog
:visible.sync="dialogVisible2"
......@@ -204,13 +260,19 @@ import echarts from 'echarts';
import moment from 'moment';
import { export_json_to_excel } from '@/excel/Export2Excel';
import elDragDialog from '@/components/el-drag-dialog';
import { exportResultDetail } from '@/excel/export';
import { address, photoAddress } from '../config';
import { permission } from '../permission';
export default {
name: 'detail',
directives: { elDragDialog },
data() {
return {
provinceOptions: [],
cityOptions: [],
permission,
linkDetail: false,
searchData: [],
tableData: [],
......@@ -224,6 +286,9 @@ export default {
currentPage: 1, // 初始页
pagesize: 10, // 每页的数据
filters: {
plateNo: [],
cityIds: [],
provinceIds: [],
capitalType: null,
status: null,
dateTime: [],
......@@ -242,7 +307,7 @@ export default {
tableIndex: -1,
capitalOptions: [
{
label: '全部',
label: '全部目标',
value: -2,
},
{
......@@ -320,7 +385,7 @@ export default {
],
statusOptions: [
{
label: '全部',
label: '全部状态',
value: 0,
},
{
......@@ -387,12 +452,13 @@ export default {
scale: 0, // 适应比例
hscale: 0,
searchLoading: false,
plateNoOptions: [],
};
},
mounted() {},
created() {
const searchVal = sessionStorage.getItem('resultDetailSearchVal');
this.queryAllProvinceByPermission();
const that = this;
if (this.$route.params.startTime) {
this.linkDetail = true;
......@@ -401,8 +467,20 @@ export default {
if (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) {
that.filters.equipment = this.$route.params.equipment;
const { equipment } = this.$route.params;
if (equipment) {
this.filters.plateNo = equipment.split(',');
}
}
if (that.startTime && that.endTime) {
......@@ -414,6 +492,14 @@ export default {
this.filters = JSON.parse(searchVal);
} else {
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) {
......@@ -423,22 +509,102 @@ export default {
if (this.filters.capitalType == null) {
this.filters.capitalType = -2;
}
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
this.getImageFeatures();
this.queryAllEquipment();
},
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() {
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`;
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 (!this.linkDetail && hasPermission && this.filters.provinceIds.length == 0 && this.filters.plateNo.length == 0) {
return;
}
const startTime = this.filters.dateTime[0];
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));
this.searchLoading = true;
const that = this;
......@@ -446,7 +612,9 @@ export default {
.post(`${address}getImageFeaturesByGroup`, {
startTime,
endTime,
equipment: that.filters.equipment,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
equipment: equipmentCode,
status: that.filters.status,
capitalType: that.filters.capitalType,
pageIndex: this.pageOption.pageIndex,
......@@ -469,6 +637,9 @@ export default {
}); */
});
that.tableData = response.data.data.list;
that.tableData.forEach((e) => {
e.office += '管理处';
});
} else {
that.tableData = [];
}
......@@ -562,9 +733,15 @@ export default {
},
loadBigImg() {
// console.log('---');
this.scale = this.$refs.BGIMG.naturalWidth / this.$refs.mainW.offsetWidth;
this.hscale = this.$refs.BGIMG.naturalHeight / this.$refs.mainW.offsetHeight;
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;
}
if (isFinite(hscal)) {
this.hscale = this.$refs.BGIMG.naturalHeight / this.$refs.mainW.offsetHeight;
}
this.customStyle = {
top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`,
......@@ -617,59 +794,76 @@ export default {
this.imgContent = `${row.info}|${row.status}|${row.position}`;
this.bigImgUrl = photoAddress + row.imagePath;
const statusStr = `${row.type},${row.type1}`;
axios
.get(
`${address}getTrajectImgLocationByImageId?imageId=${row.imageId}&status=${statusStr}&type2=${row.type2}`,
)
// eslint-disable-next-line no-unused-vars
.then((response) => {
const styleArray = response.data.data;
this.customStyle = [];
// 拼接 展示的资产信息
styleArray.forEach((e, styleIndex) => {
e.index = styleIndex + 1;
const point = JSON.parse(e.vector).location;
// eslint-disable-next-line eqeqeq
if (point.length == 4) {
this.positionLeft = point[0];
this.positionRight = point[1];
this.positionWidth = point[2] - point[0];
this.positionHeight = point[3] - point[1];
this.customStyle = {
top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`,
width: `${this.positionWidth / this.scale}px`,
height: `${this.positionHeight / this.hscale}px`,
};
}
});
});
const vectorData = JSON.parse(row.vector);
if (vectorData && vectorData.location) {
const point = vectorData.location;
if (point.length == 4) {
this.positionLeft = point[0];
this.positionRight = point[1];
this.positionWidth = point[2] - point[0];
this.positionHeight = point[3] - point[1];
this.customStyle = {
top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`,
width: `${this.positionWidth / this.scale}px`,
height: `${this.positionHeight / this.hscale}px`,
};
}
}
this.showRedBox = true;
this.isShowPicture = true;
if (row.status == '异常') {
this.dialogVisible1 = true;
this.groupId = row.id;
this.tableIndex = index;
}
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
.get(
`${address}getTrajectImgLocationByImageId?imageId=${row.imageId}&status=${statusStr}&type2=${row.type2}`,
)
// eslint-disable-next-line no-unused-vars
.then((response) => {
const styleArray = response.data.data;
this.customStyle = [];
// 拼接 展示的资产信息
styleArray.forEach((e, styleIndex) => {
// eslint-disable-next-line eqeqeq
if (styleIndex == trueStyleIndex) {
e.index = styleIndex + 1;
const point = JSON.parse(e.vector).location;
// eslint-disable-next-line eqeqeq
if (point.length == 4) {
that.positionLeft = point[0];
that.positionRight = point[1];
that.positionWidth = point[2] - point[0];
that.positionHeight = point[3] - point[1];
that.customStyle = {
top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`,
width: `${this.positionWidth / this.scale}px`,
height: `${this.positionHeight / this.hscale}px`,
};
}
/* const vectorData = JSON.parse(row.vector);
if (vectorData && vectorData.location) {
// eslint-disable-next-line no-shadow
const point = vectorData.location;
if (point.length == 4) {
that.positionLeft = point[0];
that.positionRight = point[1];
that.positionWidth = point[2] - point[0];
that.positionHeight = point[3] - point[1];
that.customStyle = {
top: `${this.positionRight / this.hscale}px`,
left: `${this.positionLeft / this.scale}px`,
width: `${this.positionWidth / this.scale}px`,
height: `${this.positionHeight / this.hscale}px`,
};
}
} */
if (row.status == '异常') {
that.dialogVisible1 = true;
that.groupId = row.id;
that.tableIndex = index;
}
}
});
that.showRedBox = true;
that.isShowPicture = true;
});
});
}, 500);
},
updatePicStatus() {
this.dialogVisible1 = false;
......@@ -691,7 +885,38 @@ export default {
console.log(error);
});
},
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) => {
item.no = `${index + 1}`;
});
......@@ -714,7 +939,7 @@ export default {
const fileName = '巡检结果明细';
export_json_to_excel(tHeader, data, fileName);
});
},
}, */
selectStatus(status) {
this.filters.status = status;
},
......
......@@ -6,6 +6,45 @@
<!--搜索栏-->
<el-col :span="24" class="toolbar">
<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-select
v-model="filters.plateNo"
......@@ -60,6 +99,7 @@
highlight-current-row
>
<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="开始时间" prop="startTime"></el-table-column>
<el-table-column label="结束时间" prop="endTime"></el-table-column>
......@@ -183,11 +223,13 @@ import moment from 'moment';
import { Message } from 'element-ui';
import { export_json_to_excel } from '@/excel/Export2Excel';
import { address, photoAddress, videoAddress } from '../config';
import { permission } from '../permission';
export default {
name: 'task',
data() {
return {
permission,
videoUrl: '',
allVideoPoints: [],
screenLoading: false,
......@@ -223,6 +265,8 @@ export default {
points: [
],
provinceOptions: [],
cityOptions: [],
dialogTableVisible: false,
dataList: [],
isShowPicture: false,
......@@ -230,6 +274,8 @@ export default {
timeout: null,
bigImgUrl: '',
filters: {
cityIds: [],
provinceIds: [],
equipmentNo: '',
plateNo: '',
channel: '',
......@@ -305,6 +351,7 @@ export default {
this.queryTravel();
this.queryImagesTravel();
this.queryVideosTravel();
this.queryAllProvinceByPermission();
},
created() {
const that = this;
......@@ -332,8 +379,51 @@ export default {
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24),
).format('YYYY-MM-DD')} 23:59:59`;
}
if (this.filters.provinceIds.length > 0) {
this.getCityOptions();
}
},
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) {
const videoUrl = videoAddress + item.filePath;
this.playerOptions.sources[0].src = videoUrl;
......@@ -440,47 +530,6 @@ export default {
.catch((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 {
// tHeader为存放excel表头标题的数组
const tHeader = [
'序号',
'管理单位',
'车牌号',
'开始时间',
'结束时间',
......@@ -555,6 +605,7 @@ export default {
// filterVal为tHeader标题对应的键值
const filterVal = [
'no',
'office',
'plateNo',
'startTime',
'endTime',
......@@ -569,7 +620,7 @@ export default {
// 用map方法处理list数据
const data = list.map(v => filterVal.map(j => v[j]));
// 自定义excel文件名
const fileName = '巡检任务';
const fileName = '巡检任务管理';
export_json_to_excel(tHeader, data, fileName);
});
},
......@@ -601,6 +652,14 @@ export default {
// 获取图片信息
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
if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment(
......@@ -628,6 +687,8 @@ export default {
startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1],
equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
})
.then((res) => {
this.points = [];
......@@ -674,6 +735,14 @@ export default {
// 获取图片信息
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
if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment(
......@@ -701,6 +770,8 @@ export default {
startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1],
equipment: equipmentCode,
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
})
.then((res) => {
this.allVideoPoints = [];
......@@ -742,6 +813,14 @@ export default {
// 获取轨迹点 TODO 重点优化
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
if (this.filters.dateTime.length == 0) {
this.filters.dateTime[0] = `${moment(
......@@ -768,8 +847,11 @@ export default {
);
this.searchLoading = true;
const that = this;
axios
.post(`${address}getTravel`, {
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1],
equipment: equipmentCode,
......@@ -854,6 +936,7 @@ export default {
// eslint-disable-next-line no-plusplus
no: ++this.no,
plateNo: gis.plateNo,
office: `${gis.office}管理处`,
startTime: this.$moment.unix(gis.startTime)
.format(
'YYYY-MM-DD HH:mm:ss',
......@@ -865,7 +948,7 @@ export default {
startPoint: gis.startPoint,
endPoint: gis.endPoint,
inspectDistance: gis.inspectDistance,
equipment: gis.equipment,
inspectTime: gis.inspectTime,
averageSpeed: gis.averageSpeed,
});
......@@ -970,6 +1053,7 @@ export default {
// this.points
const thisPoints = that.allPicPoints;
const { allVideoPoints } = that;
const trajectoryWithLinkId = that.trajectoryWithLinkId[index].linkIds;
// eslint-disable-next-line no-underscore-dangle
......@@ -981,6 +1065,14 @@ export default {
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;
const point = this.allPoints[index];
this.carPoints = [];
......@@ -990,8 +1082,8 @@ export default {
},
// 巡检结果查看
linkResult(index, row) {
let equipmentCode = '';
if (this.filters.plateNo && this.filters.plateNo.length > 0) {
const equipmentCode = row.equipment;
/* if (this.filters.plateNo && this.filters.plateNo.length > 0) {
this.filters.plateNo.forEach((item) => {
// eslint-disable-next-line eqeqeq
if (equipmentCode == '') {
......@@ -1000,12 +1092,14 @@ export default {
equipmentCode += `,${item}`;
}
});
}
} */
this.$router.push({
name: 'result',
params: {
startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1],
provinceIds: this.filters.provinceIds,
cityIds: this.filters.cityIds,
startTime: row.startTime,
endTime: row.endTime,
equipment: equipmentCode,
},
});
......
......@@ -6,6 +6,46 @@
<!--搜索栏-->
<el-col :span="24" class="toolbar">
<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-select
v-model="filters.equipment"
......@@ -98,11 +138,15 @@ import axios from 'axios';
import { Message } from 'element-ui';
import moment from 'moment';
import { address, videoAddress } from '../config';
import { permission } from '../permission';
export default {
name: 'video',
data() {
return {
permission,
provinceOptions: [],
cityOptions: [],
plateNoOptions: [],
searchData: [],
tableData: [],
......@@ -114,6 +158,8 @@ export default {
totalCount: 0,
},
filters: {
cityIds: [],
provinceIds: [],
equipment: [],
dateTime: [],
},
......@@ -173,9 +219,9 @@ export default {
},
mounted() {},
created() {
this.queryAllProvinceByPermission();
this.queryAllEquipment();
const searchVal = sessionStorage.getItem('videoSearchVal');
const searchVal = localStorage.getItem('videoSearchVal');
const that = this;
if (this.$route.params.startTime) {
that.startTime = this.$route.params.startTime;
......@@ -196,9 +242,60 @@ export default {
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();
},
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) {
const videoUrl = videoAddress + item.filePath;
this.playerOptions.sources[0].src = videoUrl;
......@@ -228,7 +325,7 @@ export default {
Message({
message: response.data.message,
duration: 3 * 1000,
type: 'error',
type: 'error',
// duration: '800',
});
}
......@@ -238,6 +335,12 @@ export default {
});
},
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) {
// eslint-disable-next-line eqeqeq
if (this.filters.dateTime.length == 0) {
......@@ -257,10 +360,13 @@ export default {
} else {
this.$message.info('请选择时间');
}
localStorage.setItem('videoSearchVal', JSON.stringify(this.filters));
this.searchLoading = true;
const that = this;
axios
.post(`${address}getParkVideos`, {
cityIds: this.filters.cityIds,
provinceIds: this.filters.provinceIds,
startTime: this.filters.dateTime[0],
endTime: this.filters.dateTime[1],
equipment: that.filters.equipment,
......
......@@ -18,7 +18,7 @@
<el-table-column width="240" label="车身照片" prop="images" align="center">
<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"
:src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/>
......@@ -77,7 +77,7 @@
<el-table-column width="240" label="车身照片" prop="images" align="center">
<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"
:src="thisPhotoAddress+item.smallFilePath" style="width: 70px"/>
......@@ -144,6 +144,11 @@
<el-button type="primary" @click="isShowDialog = false">取消</el-button>
</span>
</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>
</template>
......@@ -162,6 +167,8 @@ export default {
name: 'equipmentCheck',
data() {
return {
bigImgUrl: '',
isShowPicture: false,
thisPhotoAddress: photoAddress,
rejectReason: '',
operateOptions: [{
......@@ -195,6 +202,10 @@ export default {
this.queryAllEquipment();
},
methods: {
showBigPicture(row) {
this.bigImgUrl = photoAddress + row.filePath;
this.isShowPicture = true;
},
doCheckReject() {
if (this.rejectReason) {
this.checkFail(this.checkFailId, this.rejectReason);
......@@ -266,7 +277,7 @@ export default {
type: 'success',
dangerouslyUseHTMLString: true,
showClose: true,
duration:3000,
duration: 3000,
message: '驳回成功',
});
this.queryAllEquipment();
......@@ -298,7 +309,7 @@ export default {
type: 'success',
dangerouslyUseHTMLString: true,
showClose: true,
duration:3000,
duration: 3000,
message: '审核成功',
});
this.queryAllEquipment();
......@@ -341,7 +352,7 @@ export default {
Message({
message: response.data.message,
duration: 3 * 1000,
type: 'error',
type: 'error',
// duration: '800',
});
}
......
<template>
<div class="detail">
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="待审核" name="first">
<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="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>
<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>
<el-container>
<div class="box" style="height:600px;margin-left:20%;margin-top:30px">
<el-form label-width="100px" ref="ruleForm2" :model="ruleForm2" :rules="rules2" >
<el-footer style="text-align: center">
修改密码
</el-footer>
<el-form-item label="输入新密码" prop="pass">
<el-input type="password" style="width:300px" v-model="ruleForm2.pass" auto-complete="new-password" placeholder="6-10个字符,由字母和数字组合"></el-input>
</el-form-item>
<el-form-item label="确认新密码" prop="checkPass">
<el-input type="password" style="width:300px" v-model="ruleForm2.checkPass" auto-complete="new-password" placeholder="6-10个字符,由字母和数字组合"></el-input>
</el-form-item>
<el-footer style="text-align: center">
<el-button type="warning" @click="setNewPassword('ruleForm2')">确定</el-button>
</el-footer>
</el-form>
</div>
</el-container>
</template>
<style lang="less" scope>
......@@ -153,203 +27,85 @@
import axios from 'axios';
import { Message } from 'element-ui';
import moment from 'moment';
import Cookies from 'js-cookie';
import { address, photoAddress } from '../../config';
export default {
name: 'equipmentCheck',
name: 'resetPassword',
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 {
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() {},
created() {
this.queryAllEquipment();
},
methods: {
doCheckReject() {
if (this.rejectReason) {
this.checkFail(this.checkFailId, this.rejectReason);
} 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: '驳回成功',
setNewPassword(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
axios
.post(`${address}setNewPassword`, {
id: Cookies.get('id'),
password: this.ruleForm2.pass,
})
.then((response) => {
if (response.data.code === 200) {
this.ruleForm2.checkPass = '';
this.ruleForm2.pass = '';
this.$message({
type: 'success',
dangerouslyUseHTMLString: true,
showClose: true,
duration: 3000,
message: '修改密码成功',
});
} else {
Message({
message: response.data.message,
});
}
})
.catch((error) => {
this.checkLoadingList.splice(this.checkLoadingList.indexOf(id), 1);
console.log(error);
});
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
.post(`${address}checkVehicle`, {
id,
checkStatus: 1,
})
.then((response) => {
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.checkLoadingList.splice(this.checkLoadingList.indexOf(id), 1);
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 *** */
},
};
......
......@@ -6,7 +6,7 @@
<el-form-item label="手机号:" prop="phoneNum">
<el-input placeholder="请输入手机号" style="width:325px"
<el-input placeholder="请输入手机号" style="width:325px"
v-model="createForm.phoneNum" clearable />
</el-form-item>
......@@ -108,13 +108,13 @@ export default {
rules: {
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}$/,
message: '请输入正确的手机号',
message: '请输入正确的手机号',
trigger: 'blur',
},
],
......@@ -159,7 +159,7 @@ export default {
},
queryAllProvince() {
axios
.post(`${address}selectAllAreasByLevelByParent`, {})
.post(`${address}selectAllAreasByLevelByParentByPermission`, {})
.then((response) => {
if (response.data.code === 200) {
if (response.data.data) {
......
......@@ -5,6 +5,7 @@
<el-form :inline="true" :model="filters">
<el-form-item>
<el-select
v-permission="[permission.provincePermission]"
@change="getCityOptions"
v-model="filters.provinceIds"
style="width:160px"
......@@ -24,6 +25,7 @@
</el-form-item>
<el-form-item>
<el-select
v-permission="[permission.provincePermission]"
v-model="filters.cityIds"
multiple
collapse-tags
......@@ -41,7 +43,7 @@
</el-select>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入手机号码" style="width:160px"
<el-input placeholder="请输入用户名" style="width:160px"
v-model="filters.phoneNum" clearable />
</el-form-item>
<el-form-item>
......@@ -134,7 +136,9 @@
align="center"></el-table-column>
<el-table-column width="100" label="市" prop="cityStr"
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>
<el-table-column width="160" label="创建人" prop="createByStr"
align="center"></el-table-column>
......@@ -316,7 +320,7 @@ export default {
const tHeader = [
'省',
'市',
'手机号',
'用户名',
'创建人',
'创建时间',
'状态',
......@@ -342,7 +346,7 @@ export default {
},
getCityOptions() {
this.cityOptions = [];
if (this.filters.provinceIds) {
if (this.filters.provinceIds.length>0) {
this.queryCityByProvince(this.filters.provinceIds);
}
},
......@@ -443,8 +447,9 @@ export default {
this.tableData = response.data.data.list;
this.tableData.forEach((e) => {
const reg = /^(\d{3})\d{4}(\d{4})$/;
e.userName = e.userName.replace(reg, '$1****$2');
if (e.phoneNum) {
e.phoneNum = e.phoneNum.replace(reg, '$1****$2');
}
});
}
} 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