Commit fd33c9ed by zhangxw
2 parents 2df94fd2 589c39eb
......@@ -15,6 +15,13 @@
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
],
[
"import",
{
"libraryName": "vxe-table",
"style": true // 样式是否也按需加载
}
]
]
}
......@@ -34,7 +34,7 @@ module.exports = {
},
externals: {
vue: 'Vue',
'element-ui': 'ElementUI'
//'element-ui': 'ElementUI'
},
module: {
rules: [
......@@ -90,6 +90,7 @@ module.exports = {
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
limit: 10000,
name: 'images/[name].[ext]?[hash]',
publicPath: resourcesPath
}
......
This diff could not be displayed because it is too large.
......@@ -11,6 +11,7 @@
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules --config config/webpack.config.js"
},
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"animate.css": "^3.7.0",
"axios": "^0.18.0",
"calendar-months": "^1.0.1",
......@@ -22,14 +23,16 @@
"es6-promise": "^4.2.4",
"font-awesome": "^4.7.0",
"moment": "^2.22.0",
"node-sass": "^7.0.1",
"qs": "^6.5.1",
"sass": "^1.45.1",
"vue": "^2.5.11",
"vue-infinite-loading": "^2.3.1",
"vue-router": "^3.0.1",
"vue-template-compiler": "^2.6.14",
"vuex": "^3.0.1",
"xlsx": "^0.14.0",
"node-sass":"7.0.1"
"vxe-table": "^3.5.5",
"xe-utils": "^3.5.4",
"xlsx": "^0.14.0"
},
"browserslist": [
"> 1%",
......@@ -60,7 +63,6 @@
"url-loader": "^1.0.1",
"vue-loader": "^14.2.2",
"vue-style-loader": "^4.1.0",
"vue-template-compiler": "^2.5.16",
"webpack": "^4.6.0",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^2.0.14",
......
......@@ -25,26 +25,26 @@
</template>
<script>
import store from './vuex/store.js'
import { mapGetters, mapActions } from 'vuex'
import vSideBar from 'components/SideBar.vue'
import store from "./vuex/store.js";
import { mapGetters, mapActions } from "vuex";
import vSideBar from "components/SideBar.vue";
export default {
name: 'app',
name: "app",
data() {
return {
isQiankun: window.__POWERED_BY_QIANKUN__,
logo: require('images/logo.png')
}
logo: require("images/logo.png"),
};
},
watch: {
$route(to, from) {
if(this.isQiankun) {
if (this.isQiankun) {
this.getBreadcrumb();
}
}
},
mounted(){
},
mounted() {
// store.dispatch('getDeviceResources')
// store.dispatch('getLoginUser').then((res)=>{
// if(store.state.common.username === 'gqgdcx'){
......@@ -67,85 +67,102 @@ export default {
// }
// window.onresize()
this.$onGlobalStateChange((state, prev) => {
if(state.isCollapsed != this.isCollapse) {
this.toggleCollapse()
if (state.isCollapsed != this.isCollapse) {
this.toggleCollapse();
}
})
});
},
computed: {
...mapGetters([
'isCollapse',
'isFullsize'
])
...mapGetters(["isCollapse", "isFullsize"]),
},
methods: {
getBreadcrumb() {
const { getters: {curBreadCrumb}} = this.$root.parentVuex;
let matched = this.$route.matched.filter(item => item.name); // this.$route.matched 可以获取到一个数组,包含当前路由的所有嵌套路径片段的路由记录
const {
getters: { curBreadCrumb },
} = this.$root.parentVuex;
let matched = this.$route.matched.filter((item) => item.name); // this.$route.matched 可以获取到一个数组,包含当前路由的所有嵌套路径片段的路由记录
const first = matched[0];
const { meta, path } = first;
const basePath = '/oEshield#';
const basePath = "/oEshield#";
let breadcrumb = [];
if(meta) {
if (meta) {
const { title, pushState } = meta;
if(pushState && title) {
if (pushState && title) {
breadcrumb.push({
name: title,
path: basePath + path
})
path: basePath + path,
});
history.state.pushState = pushState;
history.state.breadcrumb = [...curBreadCrumb, breadcrumb[0]];
// this.$root.parentVuex.dispatch('menu/setBreadCrumb', [...curBreadCrumb, breadcrumb]);
}
}
},
toggle(){
this.toggleCollapse()
toggle() {
this.toggleCollapse();
},
...mapActions([
'toggleCollapse'
]),
navigate(){
...mapActions(["toggleCollapse"]),
navigate() {
let routeData = this.$router.resolve({
path: '/notice',
query: {
}
path: "/notice",
query: {},
});
window.open(routeData.href, '_blank');
}
window.open(routeData.href, "_blank");
},
},
components: {
vSideBar
vSideBar,
},
store
}
store,
};
</script>
<style scoped>
.topbar {
.topbar {
min-height: 50px;
padding: 15px 10px;
}
.toggle-btn, .logo{
}
.toggle-btn,
.logo {
vertical-align: middle;
}
.logo{
}
.logo {
margin-left: 10px;
}
a.right-link{
}
a.right-link {
color: #999;
font-size: 14px;
margin-right: 20px;
line-height: 30px;
text-decoration: none;
}
.full-size main{
}
.full-size main {
margin: 0;
}
.full-size .sidebar, .full-size .topbar{
}
.full-size .sidebar,
.full-size .topbar {
display: none;
}
</style>
<style lang="scss">
.el_table {
thead {
th {
background: rgba($color: #f2f2f2, $alpha: 0.5) !important;
}
}
}
.links_group {
position: relative;
display: flex;
align-items: flex-end;
justify-content: space-between;
padding: 10px 0;
.name {
font-size: 18px;
font-weight: bold;
color: #666;
}
}
</style>
import api from '../config.js'
import request from './request'
export default {
getLoginUser (request = {}) {
getLoginUser(request = {}) {
return api.get('common/getLoginUser', request)
},
......@@ -11,7 +12,7 @@ export default {
},
/*车辆品牌*/
getAllVehicleBrand (request = {}) {
getAllVehicleBrand(request = {}) {
return api.get('vehicle/getAllVehicleBrand', request)
},
getBrandTypeByBrandId(request = {}) {
......@@ -19,15 +20,21 @@ export default {
},
/*车辆分组分类*/
getAllVehicleGroup (request = {}) {
getAllVehicleGroup(request = {}) {
return api.get('vehiclegroup/getAllVehicleGroup', request)
},
getClassListByGroupId (request = {}) {
getClassListByGroupId(request = {}) {
return api.get('vehicleclass/getClassListByGroupId', request)
},
/*获取菜单权限*/
getDeviceResources (request = {}) {
getDeviceResources(request = {}) {
return api.get('user/userDeviceResources', request)
}
}
// 获取车辆树
export const GET_ORGANIZATION_TREE = params => {
return request(params, '/usercenter/organization/orgtree')
}
\ No newline at end of file
import request from './request'
import store from "@/vuex/store";
// 新增围栏
export const SAVE_ELECFENCE_INFO = params => {
return request(params, '/trialdrive/elecfence/add', 'POST')
}
// 更新围栏
export const UPDATE_ELECFENCE_INFO = params => {
return request(params, '/trialdrive/elecfence/edit', 'POST')
}
// 获取围栏详情
export const GET_ELECFENCE_INFO = params => {
return request(params, '/trialdrive/elecfence/info')
}
//新增、编辑围栏-获取关联设备列表
export const GET_ELECFENCE_LINKEDDEVICES = params => {
return request(params, '/trialdrive/elecfence/linkedDevices')
}
//新增、编辑围栏-关联设备-获取用户权限设备列表接口
export const GET_ELECFENCE_LINKSNS = params => {
return request(params, '/trialdrive/elecfence/linksns/search')
}
//新增、编辑围栏-批量删除关联设备
export const REMOVE_ELECFENCE_LINKEDDEVICES = params => {
return request(params, '/trialdrive/elecfence/batchUnlink')
}
//新增、编辑围栏-批量导入关联设备
export const IMPORT_ELECFENCE_LINKEDDEVICES = `${store.getters.baseURL}/trialdrive/elecfence/batchImport`
//新增、编辑围栏-批量导入模板下载
export const DOWN_ELECFENCE_EXCELTEMPLATE = params => {
return request(params, '/publiccenter/dict/data/type/excelTemplate/batchLinkFenceSns')
}
\ No newline at end of file
......@@ -142,3 +142,13 @@ export default {
export const GET_DEVICEINFO_BYSNS = params => {
return request(params, '/trialdrive/monitor/vehiclelocation')
}
// 批量查询设备位置点
export const GET_DEVICE_LOCATION = params => {
return request(params, '/trialdrive/monitor/vehiclelocation', 'get')
}
// 批量查询设备在线状态
export const GET_MONITOR_ONLINELIST = params => {
return request(params, '/devicemonitor/monitor/onlinelist', 'get')
}
\ No newline at end of file
import request from './request'
// 轨迹回放-获取轨迹回放位置点
export const GET_DEVICE_LISTTRACKPOINT = params => {
return request(params, '/devicemonitor/monitor/listtrackpoint')
}
\ No newline at end of file
This diff could not be displayed because it is too large.
......@@ -6,13 +6,14 @@
margin: 0;
//background-color: #f3f3f4;
/*min-height: 949px;
*/position: relative;
*/
position: relative;
-webkit-transition: margin .1s linear;
transition: margin .1s linear;
-moz-transition: margin .1s linear;
-ms-transition: margin .1s linear;
-o-transition: margin .1s linear;
}
}
.sidebar {
position: absolute;
......@@ -23,9 +24,11 @@
-webkit-transition: width .1s linear;
transition: width .1s linear;
font-size: 13px !important;
* {
font-size: 13px !important;
}
color:#a7b1c2;
}
......@@ -36,13 +39,15 @@
/* -webkit-transition: margin .3s linear;
transition: margin .3s linear; */
}
.sidebar {
width: 64px;
/* -webkit-transition: width .3s linear;
transition: width .3s linear; */
}
.nav-footer{
.nav-footer {
display: none;
}
}
......@@ -69,33 +74,38 @@
.el-popper[x-placement^="bottom"] {
margin-top: 2px;
}
.el-input.is-disabled .el-input__inner{
.el-input.is-disabled .el-input__inner {
color: #666;
}
/* .el-table--scrollable-x .el-table__body-wrapper{解决被遮挡
z-index: 100;
} */
.el-date-editor{
.el-date-editor {
vertical-align: middle;
}
.table-header-ctrl {
margin: 0px;
min-height: 70px;
.el-input,
.el-date-editor,
.el-select {
width: 100%;
}
.el-input__suffix {
right: 15px;
}
input{
input {
border-radius: 0px;
}
.el-date-editor{
.el-date-editor {
border-radius: 0px;
margin-top: 7px;
}
......@@ -103,6 +113,7 @@
td.ctrl-column {
padding-left: 50px;
.el-dropdown {
margin-top: 5px;
}
......@@ -120,37 +131,62 @@ td.ctrl-column {
.el-table th>.cell {
color: #666;
}
.pull-right{
.pull-right {
float: right;
}
.pull-left{
.pull-left {
float: left;
}
.text-center{
.text-center {
text-align: center;
}
.table-page-wrap{
.table-page-wrap {
float: right;
margin: 20px 0px;
}
.el-message{//避免被el-dialog遮罩层遮住
.el-message {
//避免被el-dialog遮罩层遮住
z-index: 3000 !important;
}
.el-tree .device-invalid{
.el-tree .device-invalid {
color: #999;
}
.el-tree-node:focus > .el-tree-node__content{
.el-tree-node:focus>.el-tree-node__content {
background-color: inherit;
}
#editOrderModal #color .el-form-item__label{
#editOrderModal #color .el-form-item__label {
color: red !important;
}
.el-alert--success {
background-color: #f0f9eb;
color: #67c23a;
}
.el-alert--error {
background-color: #fef0f0;
color: #f56c6c;
}
// 监控页面图标
.icon_info_shop {
width: 24px;
height: 24px;
background: url('../images/info_shop.png') no-repeat;
background-size: 24px auto;
}
.icon_info_plate {
background: url('../images/info_plate.png') no-repeat;
background-size: 24px auto;
width: 24px;
height: 24px;
}
\ No newline at end of file
......@@ -34,7 +34,10 @@ h3.uimap-info-title{
word-break: break-all;
}
.amap-controls{
display: none;
//display: none;
}
.amap-logo,.amap-copyright{
display: none !important;
}
.navg-info-window{
background-color: #fff;
......
<template>
<el-cascader v-model="city" :options="cityList" :props="cascaderProps" :disabled="disabled" @change="onChange"></el-cascader>
</template>
<script>
import cityJson from "@/assets/json/city.json";
export default {
name: "CitySelect",
props: {
value: {
type: [String, Number],
default: "",
},
checkStrictly: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
},
data() {
return {
cityList: cityJson,
city: "",
cascaderProps: {
value: "code",
label: "name",
children: "children",
checkStrictly: this.checkStrictly,
},
};
},
watch: {
// value: {
// handler: function (n, o) {
// if (n) {
// this.init();
// }
// },
// immediate: true,
// },
},
mounted() {
//this.city = this.value;
this.init();
},
methods: {
onChange(e) {
console.log(e);
let list = this.cityList;
let nameList = []
let m = list.find((k) => k.code == e[0]);
console.log(m)
nameList.push(m.name)
let n = m.children.find((k) => k.code == e[1]);
let b = (n && n.children || []).find((k) => k.code == e[2]);
if (n) {
this.$emit("input", n.name);
nameList.push(n.name)
}
if(b){
nameList.push(b.name)
}
this.$emit("change", { code: e, name: nameList });
},
// 初始化
init() {
let o = this.value.toString();
let list = this.cityList;
let arr = [];
if (!o) {
return false;
}
// for(let i =0,len=list.length;i<len;i++){
// let k = list[i]
// if(k.code == o){
// arr.push(k.code)
// return false;
// }
// }
list.forEach((k) => {
// 只有省份
if (k.code == o) {
arr.push(k.code);
return;
}
if (k.children) {
k.children.forEach((j) => {
// 只有省市
if (j.code == o) {
arr.push(k.code);
arr.push(j.code);
return;
}
j.children &&
j.children.forEach((h) => {
// 只有省市区
if (h.code == o) {
arr.push(k.code);
arr.push(j.code);
arr.push(h.code);
return;
}
});
});
}
});
// let m = list.find((k) => {
// let n = k.children.find((j) => j.name == o || j.code == o);
// if (n) {
// arr.push(k.code);
// arr.push(n.code);
// return false;
// }
// });
this.city = arr;
console.log(arr);
},
// 展开数组
unfoldTree(arr, afterArray = []) {
let _this = this;
arr.map((k) => {
afterArray.push(k);
if (k.children) {
_this.unfoldTree(k.children, afterArray);
}
});
return afterArray;
},
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div class="">
<el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small">
</el-input>
<div v-loading="loading">
<el-tree style="max-height:50vh;overflow:auto" class="filter-tree" :data="filterTextData" :filter-node-method="filterNode" highlight-current ref="tree" node-key="id" check-on-click-node>
</el-tree>
</div>
<p style="text-align: right; margin-top: 10px">
<el-button @click="filterConfirm" type="primary">确定</el-button>
<el-button @click="closeFilter">取消</el-button>
</p>
</div>
</template>
<script>
import { GET_ORGANIZATION_TREE } from "@/api/services/common";
import { showToast } from "@/utils/utils";
export default {
name: "GlsxOrganization",
data() {
return {
filterText: "",
filterTextData: [],
_timeout: "",
loading: false,
};
},
mounted() {
this.getTree();
},
watch: {
filterText(n) {
let _this = this;
_this.loading = true;
setTimeout(function () {
_this.$refs.tree.filter(n);
}, 100);
},
},
methods: {
// 确认选择树
filterConfirm() {
let o = this.$refs.tree.getCurrentNode();
if (!o) {
showToast({
message: "请选择所属组织",
type: "error",
});
return false;
}
const { label, id, origin } = o;
// if (origin && origin.type != "u") {
// showToast({
// message: "请选择下级所属组织",
// type: "error",
// });
// return false;
// }
console.log(o);
this.$emit("change", o);
// this.searchForm.specialShopName = label.split("/")[1];
// this.searchForm.specialShopCode = label.split("/")[0];
//this.$set(this, "form.specialShopName", label);
//this.searchForm.specialShopId = id;
//this.closeFilter();
},
// 获取组织机构树数据
getTree() {
GET_ORGANIZATION_TREE({ hasUserLeaf: true }).then((res) => {
const { data } = res;
this.filterTextData = data || [];
});
},
// 搜索树
filterNode(value, data) {
let _this = this;
if (!value) {
_this.loading = false;
return true;
}
setTimeout(function () {
_this.loading = false;
}, 1500);
return data.label.indexOf(value) !== -1;
},
// 关闭树
closeFilter() {
this.$emit("change");
},
// 搜索树
onChange(val) {
this.loading = true;
this.$refs.tree.filter(val);
},
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
const MAP_KEY = '75116f653f3b2e4568116dad8cd9b899'
export const MAP_KEY = '75116f653f3b2e4568116dad8cd9b899'
// 地图插件
export const MAP_PLUGINS = [
'AMap.PolyEditor',
'AMap.CircleEditor',
'AMap.DistrictSearch',
'AMap.Autocomplete',
'AMap.MarkerClusterer',
'AMap.MouseTool',
'AMap.Text',
"AMap.RangingTool",
"AMap.Geolocation",
"AMap.PolygonEditor",
"AMap.PolylineEditor",
'AMap.Scale'
]
export const CONSTANT = {
//ROOT: process.env.NODE_ENV === 'development'?'ots/':'',
API_URL: '/ots/',
MAP_KEY,
AMAP_URL: `https://webapi.amap.com/maps?v=1.4.2&key=${MAP_KEY}&plugin=AMap.PolyEditor,AMap.CircleEditor,AMap.DistrictSearch,AMap.Autocomplete,AMap.MarkerClusterer,AMap.MouseTool,AMap.Text`
MAP_PLUGINS,
AMAP_URL: `https://webapi.amap.com/maps?v=1.4.2&key=${MAP_KEY}&plugin=${MAP_PLUGINS.toString()}`
}
\ No newline at end of file
import 'font-awesome/css/font-awesome.min.css'
import './assets/scss/element-variables.scss'
import '@/assets/scss/element-variables.scss'
//import Vue from 'vue'
//import ElementUI from 'element-ui';
import ElementUI from 'element-ui';
import 'animate.css/animate.min.css'
import './assets/scss/style.scss'
//import 'element-ui/lib/theme-chalk/index.css';
import './assets/spritesmith-generated/sprite.css'
import '@/assets/scss/style.scss'
import 'element-ui/lib/theme-chalk/index.css';
import '@/assets/spritesmith-generated/sprite.css'
import Router from 'vue-router'
import routes from './router'
import './core/public-path';
import actions from './core/actions';
import routes from '@/router'
import '@/core/public-path';
import actions from '@/core/actions';
import vLayout from 'pages/Layout.vue'
import vFullLayout from 'pages/FullWidthLayout.vue'
import vLayout from '@/pages/Layout.vue'
import vFullLayout from '@/pages/FullWidthLayout.vue'
import store from './vuex/store.js'
import store from '@/vuex/store.js'
import App from './App.vue'
import App from '@/App.vue'
import Vue from 'vue'
Vue.component('vLayout',vLayout)
Vue.component('vFullLayout',vFullLayout)
Vue.component('vLayout', vLayout)
Vue.component('vFullLayout', vFullLayout)
//Vue.use(ElementUI)
Vue.use(ElementUI)
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
Vue.use(VXETable)
// new Vue({
// el: '#app',
......@@ -34,16 +41,19 @@ Vue.component('vFullLayout',vFullLayout)
let router = null;
let instance = null;
function render({ data = {} , container } = {}) {
function render({ data = {}, container } = {}) {
router = new Router({
base: window.__POWERED_BY_QIANKUN__ ? '/oEshield' : '/',
routes
});
store.commit('SET_BASE_URL', data.baseURL);
Vue.prototype.$parentCommon = data.common;
Vue.prototype.$parentRouter = data.router;
Vue.prototype.$parentVuex = data.store;
instance = new Vue({
router,
store,
data(){
data() {
return {
parentRouter: data.router,
parentVuex: data.store,
......
......@@ -10,7 +10,7 @@
<div class="controll-wrap">
<div class="search-box" :class="resultBoxHidden?'active':''">
<h3>轨迹回放</h3>
<p class="info">{{name}}/{{standno}}/{{sn}}</p>
<p class="info">{{name||'--'}}/{{standno||'--'}}/{{sn||'--'}}</p>
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini" class="form">
<el-form-item label="查询范围" prop="daterange">
<el-date-picker class="pull-left" style="width: 100%;" v-model="form.dateRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" format="yyyy-MM-dd HH:mm" :clearable="false" :editable="false" :picker-options="{
......@@ -98,6 +98,7 @@ import { exportExcel } from "utils";
import { CONSTANT } from "../../constant";
import InfiniteLoading from "vue-infinite-loading";
import MapControll from "./MapControll.vue";
import { GET_ELECFENCE_INFO } from "@/api/services/fence";
export default {
data() {
......@@ -239,8 +240,12 @@ export default {
//this.bindEvent();
_this.isInitMap = true;
//_this.drawPoi();
console.log(_this.fenceId != 'undefined')
if (_this.isInitFence && _this.fenceId && _this.fenceId != 'undefined') {
console.log(_this.fenceId != "undefined");
if (
_this.isInitFence &&
_this.fenceId &&
_this.fenceId != "undefined"
) {
//_this.drawFence();
_this.getFence();
}
......@@ -483,8 +488,8 @@ export default {
if (data.length) {
data.forEach((item, idx) => {
item.idx = idx;
item.standno = _this.standno
item.name = _this.name
item.standno = _this.standno;
item.name = _this.name;
});
this.resultList = data;
}
......@@ -603,6 +608,8 @@ export default {
}
});
},
// 行政区域围栏
drawDistrict(areaCode) {
this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId);
......@@ -610,6 +617,8 @@ export default {
EventBus.$emit("uiMap.fence.drawDistrict", areaCode);
}, 500);
},
// 多边形围栏
drawPolygon(path) {
console.log("path");
EventBus.$emit("uiMap.fence.drawPolygon", {
......@@ -620,56 +629,38 @@ export default {
// 获取围栏信息-并画围栏
getFence() {
MONITOR_SERVICE.getFenceInfo({
sn: this.sn,
GET_ELECFENCE_INFO({
//sn: this.sn,
fenceId: this.fenceId,
}).then((res) => {
console.log(res);
let list = res.data || [];
if (res.code != 200) {
return false;
// const data = res.data || [];
// if (data) {
// if (data.shapeType === 2) {
// EventBus.$emit("uiMap.fence.createFenceCircle", {
// lng: data.lng,
// lat: data.lat,
// radius: data.radius,
// isEdit: false,
// });
// } else if (data.shapeType === 3) {
// this.drawDistrict(data.areaCode);
// } else if (data.shapeType === 5) {
// if (data.lnglat) {
// let polygonPath = data.lnglat.split("|").map((item) => {
// return [item.split(",")[0], item.split(",")[1]];
// });
// this.drawPolygon(polygonPath);
// }
// }
// }
}
// 循环画围栏
list.map((k) => {
}
let obj = res.data || {};
// 圆形围栏
if (k.shapeType == 1) {
if (obj.shapeType == 1) {
EventBus.$emit("uiMap.fence.createFenceCircle", {
lng: k.lnglat.split(",")[0],
lat: k.lnglat.split(",")[1],
radius: k.radius,
lng: obj.lnglat.split(",")[0],
lat: obj.lnglat.split(",")[1],
radius: obj.radius,
isEdit: false,
});
}
// 多边形围栏
if (k.shapeType == 3) {
let polygonPath = k.lnglat.split("|").map((item) => {
if (obj.shapeType == 3) {
let polygonPath = obj.lnglat.split("|").map((item) => {
return [item.split(",")[0], item.split(",")[1]];
});
this.drawPolygon(polygonPath);
}
});
// 行政区域围栏
if (obj.shapeType == 4) {
this.drawDistrict([obj.areaCode]);
}
});
},
},
......
......@@ -3,18 +3,10 @@
<el-dialog class="import-dialog" title="批量导入" :visible="userImportModalVisible" @open="openDialog" @close="closeDialog" append-to-body width="600px" :close-on-click-modal="false">
<el-form ref="form" :model="form" :inline="false" size="mini" v-show="!showResult">
<el-upload ref="upload" class="upload-wrap"
action="ecFence/importDeviceManage"
:on-change="changeFile"
:before-upload="beforeUpload"
:multiple="false"
:show-file-list="false"
:on-success="successUpload"
:on-error="errorUpload"
:auto-upload="false">
<el-upload ref="upload" class="upload-wrap" :action="IMPORT_ELECFENCE_LINKEDDEVICES" :data="uploadParams" :headers="uploadHeaders" :on-change="changeFile" :before-upload="beforeUpload" :multiple="false" :show-file-list="false" :on-success="successUpload" :on-error="errorUpload" :auto-upload="false">
<el-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small" >
<el-button slot="append" >浏览</el-button>
<el-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small">
<el-button slot="append">浏览</el-button>
</el-input>
<div slot="tip" class="el-upload__tip">请选择需要导入的工单表格</div>
......@@ -48,65 +40,76 @@
</template>
<script>
import {exportExcel} from 'utils'
export default{
props: ['userImportModalVisible'],
data(){
import { exportExcel } from "utils";
import {
IMPORT_ELECFENCE_LINKEDDEVICES,
DOWN_ELECFENCE_EXCELTEMPLATE,
} from "@/api/services/fence";
import { downFileByPath } from "@/utils/utils";
export default {
props: ["userImportModalVisible"],
data() {
return {
form: {
},
form: {},
showResult: false,
successNum: '',
errorNum: '',
seqNo: '',
successNum: "",
errorNum: "",
seqNo: "",
importing: false,
filename: '',
flag:[]
filename: "",
flag: [],
IMPORT_ELECFENCE_LINKEDDEVICES,
uploadHeaders: {},
uploadParams: {},
};
},
created() {
let query = this.$route.query;
let token = localStorage.getItem("token");
this.uploadHeaders = { Authorization: token };
if (query.id) {
this.uploadParams = { fenceId: query.id };
}
},
methods: {
doneResult(){
this.$emit('onUserImportModalChange', false);
this.$emit('onRefreshList');
doneResult() {
this.$emit("onUserImportModalChange", false);
this.$emit("onRefreshList");
this.showResult = false;
this.successNum = '';
this.errorNum = '';
this.seqNo = '';
this.successNum = "";
this.errorNum = "";
this.seqNo = "";
this.importing = false;
this.filename = '';
this.filename = "";
},
exportErrorResult(){
if(this.errorNum!=0){
exportExcel('ecFence/exportFailSn', {seqNo: this.seqNo})
}else{
exportErrorResult() {
if (this.errorNum != 0) {
exportExcel("ecFence/exportFailSn", { seqNo: this.seqNo });
} else {
return false;
}
},
successUpload(res){
successUpload(res) {
this.importing = false;
if(typeof res === 'object'){
if(res.returnCode == 0){
if (typeof res === "object") {
if (res.returnCode == 0) {
const data = res.data;
let returnDate=[];
if(this.flag.length!=0){
function noRepeat(obj1,obj2){
for(var key in obj2){
if(obj1[key]){
if(obj1[key].sn!=obj2[key].sn){
returnDate.push(obj2[key])
let returnDate = [];
if (this.flag.length != 0) {
function noRepeat(obj1, obj2) {
for (var key in obj2) {
if (obj1[key]) {
if (obj1[key].sn != obj2[key].sn) {
returnDate.push(obj2[key]);
}
}else{
returnDate.push(obj2[key])
} else {
returnDate.push(obj2[key]);
}
}
}
noRepeat(this.flag,res.data.returnDate)
noRepeat(this.flag, res.data.returnDate);
this.$emit('exportDate', returnDate);
this.$emit("exportDate", returnDate);
this.flag.push(...returnDate);
//console.log(this.flag)
......@@ -115,10 +118,9 @@
this.seqNo = data.seqNo;
this.$refs.upload.clearFiles();
this.showResult = true;
}else{
this.flag = res.data.returnDate
this.$emit('exportDate', res.data.returnDate)
} else {
this.flag = res.data.returnDate;
this.$emit("exportDate", res.data.returnDate);
this.successNum = data.success;
this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo;
......@@ -126,13 +128,10 @@
this.$refs.upload.clearFiles();
this.showResult = true;
}
}
}else{
window.location.href = '../ots/login';
} else {
//window.location.href = '../ots/login';
}
},
submitUpload() {
this.$refs.upload.submit();
......@@ -140,41 +139,45 @@
changeFile(file, filelist) {
this.filename = file.name;
},
beforeUpload(file){
if(file.name == this.filename){
beforeUpload(file) {
if (file.name == this.filename) {
this.importing = true;
return true
return true;
}
return false
return false;
},
downloadTpl(){
exportExcel('ecFence/downTemplates')
// 批量导入模板下载
downloadTpl() {
DOWN_ELECFENCE_EXCELTEMPLATE().then((res) => {
let obj = res.data;
if (obj.dictValue) {
downFileByPath(obj.dictValue);
}
});
},
openDialog(){
this.$emit('onUserImportModalChange', true)
openDialog() {
this.$emit("onUserImportModalChange", true);
},
closeDialog(){
this.$emit('onUserImportModalChange', false);
closeDialog() {
this.$emit("onUserImportModalChange", false);
},
errorUpload(err){
window.location.href = '../ots/login';
}
}
}
errorUpload(err) {
//window.location.href = '../ots/login';
},
},
};
</script>
<style>
.import-dialog .upload-wrap .el-upload{
.import-dialog .upload-wrap .el-upload {
width: 100%;
}
.import-dialog .el-icon-success, .import-dialog .el-icon-error{
}
.import-dialog .el-icon-success,
.import-dialog .el-icon-error {
font-size: 30px;
}
.import-dialog .result-row .el-col+.el-col{
}
.import-dialog .result-row .el-col + .el-col {
border-left: 1px solid #eee;
}
}
</style>
\ No newline at end of file
......@@ -194,7 +194,7 @@ const monitor = {
});
//mapService.setFitView(MAP);
mapService.setFitView(MAP);
this.allData = this.allData.concat(data);
EventBus.$emit('uiMap.monitor.drawDone');
if(this.isCompare){
......
import Vue from 'vue'
const EventBus = new Vue()
import { Message, MessageBox, Loading } from 'element-ui'
import moment from 'moment'
let loadingInstance = ''
export const Util = {
/**
* 简单alert
* title 标题
* message 内容
* className 自定义class
* showCancelButton 是否展示取消按钮
* confirmButtonText 确认按钮文案
* cancelButtonText 取消按钮文案
* confirmButtonColor 确认按钮颜色
* cancelButtonColor 取消按钮颜色
* type: success / info / warning / error
*/
msg: function (options) {
MessageBox({
title: options.title || '',
type: options.type || 'error',
message: options.message || '',
className: options.className || '',
showCancelButton: options.showCancelButton || false,
confirmButtonText: options.confirmButtonText || '确认',
cancelButtonText: options.cancelButtonText || '取消',
confirmButtonColor: options.confirmButtonColor || '#1989fa',
cancelButtonColor: options.cancelButtonColor || '#000',
dangerouslyUseHTMLString: true,
center: options.center || false,
callback: function (action, done) {
if (action == 'confirm') {
if (options.success) {
options.success(done)
}
} else {
console.log(done)
//done.close()
}
},
})
/* Vue.$vux.alert.show({
title: options.title||'',
content: options.message||'',
onShow() {
options.onShow?(options.onShow)():'';
},
onHide() {
options.onHide?(options.onHide)():'';
}
}) */
},
/**
* 提示框
*/
Info: function (options) {
Message({
message: options.message || '提示',
type: options.type || 'error',
duration: options.time || 2000,
onClose: options.onClose || '',
})
},
/**
* 轻提示
*/
Tips: function (options) {
Message({
message: options.message || '提示',
duration: options.duration || 3000,
type: options.type || 'text',
icon: options.icon || '',
})
},
/**
* loading
*/
loading: function (message) {
loadingInstance = Loading.service({
text: message || '加载中...',
})
},
/**
* 关闭loading
*/
closeLoading: function () {
loadingInstance.close()
},
/**
* 校验手机号码格式
*/
checkPhone: function (mobile) {
let myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return myreg.test(mobile)
},
/**
* 校验固定电话
*/
validationTel: function (tel) {
let reg = /^0[\d]{2,3}-[\d]{7,8}$/
return reg.test(tel)
},
/**
* 是否特殊字符
*/
isSpecialLetter: function (str) {
let reg = new RegExp(
"[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"
)
return reg.test(str)
},
/**
* 获取当前时间
*/
getCurrentDate: function () {
let time = new Date()
let y = time.getFullYear()
let m = time.getMonth() + 1
let d = time.getDate()
return {
date: y + '/' + m + '/' + d,
}
},
/**
* 获取浏览器参数
*/
getUrlParams: function (name) {
let vars = [],
hash
let oParams = {}
let hashes = window.location.href
.slice(window.location.href.indexOf('?') + 1)
.split('&')
for (let i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=')
vars.push(hash[0])
oParams[hash[0]] = hash[1]
}
console.log(vars)
if (name) {
return oParams[name]
} else {
return oParams
}
},
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate: function (day) {
let date1 = new Date()
let date2 = new Date(date1)
let time = 30
if (day) {
time = day
}
date2.setDate(date1.getDate() + time)
let _date =
date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate()
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate(),
}
},
/**
* 日期格式转换
*/
dateFormate: function (str, type) {
let txt = 'YYYY-MM-DD'
if (!str) {
return ''
}
if (type) {
txt = type
}
const m = moment(str).format(txt)
return m
},
/**
* 字段截取
*/
cutStr: function (str, num) {
if (!str) {
return ''
}
let m = 10
let n = str
if (num) {
m = num
}
if (str.length > m) {
n = str.slice(0, m) + '...'
}
return n
},
/**
* 深克隆 所有原型链上的对象和属性
* 例: const bar=deepClone(foo)
* console.log(bar===foo) false
* @param {*} obj
*/
deepClone: function (obj) {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj
// Handle Date
if (obj instanceof Date) {
const copy = new Date()
copy.setTime(obj.getTime())
return copy
}
// Handle Array or Object
if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = obj instanceof Array ? [] : {}
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = Util.deepClone(obj[attr])
}
}
return copy
}
throw new Error("Unable to clone obj! Its type isn't supported.")
},
// 传递消息
broadcast: function (msg, data) {
EventBus.$emit(msg, data)
},
// 接收消息
received: function (msg, callBack) {
EventBus.$off(msg)
EventBus.$on(msg, function (row) {
callBack(row)
})
},
}
// 通过url下载文件
export const downFileByPath = function(url){
if (!url) {
return false;
};
// let link = document.createElement('a')
// link.style.display = 'none'
// link.src = url
// link.target = '_blank'
// document.body.appendChild(link);
// link.click();
window.location.href = url
}
export const showModal = Util.msg
export const showToast = Util.Info
export const showLoading = Util.loading
export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone
// export const broadcast = Util.broadcast
// export const received = Util.received
......@@ -84,6 +84,7 @@ const mutations = {
[types.vehicleGenerate](state, data) {
state.vehicleGenerate = data
},
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!