Commit 06000af4 by 张立顺

chore: migrate legacy master snapshot

Source: git@192.168.3.233:micro-customization-system/system.git
Source-Commit: 9b456a9744a56b0f351ecbc86f5cb4d017897212
1 parent 3c953207
Showing 98 changed files with 15224 additions and 0 deletions
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true
},
extends: 'eslint:recommended',
// required to lint *.vue files
plugins: [
'html'
],
// check if imports actually resolve
'settings': {
'import/resolver': {
'webpack': {
'config': 'build/webpack.base.conf.js'
}
}
},
// add your custom rules here
// it is base on https://github.com/vuejs/eslint-config-vue
rules: {
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'camelcase': [0, {
'properties': 'always'
}],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'],
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': [2, 'allow-null'],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'SwitchCase': 1
}],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 2,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [2, {
'allowLoop': false,
'allowSwitch': false
}],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [2, {
'defaultAssignment': false
}],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [2, {
'vars': 'all',
'args': 'none'
}],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [2, {
'initialized': 'never'
}],
'operator-linebreak': [2, 'after', {
'overrides': {
'?': 'before',
':': 'before'
}
}],
'padded-blocks': [2, 'never'],
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'semi-spacing': [2, {
'before': false,
'after': true
}],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'spaced-comment': [2, 'always', {
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
}],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
'yoda': [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}],
'array-bracket-spacing': [2, 'never']
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# glsx-micro-system-child
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
This diff could not be displayed because it is too large.
{
"name": "glsx-micro-system-child",
"version": "0.1.0",
"private": true,
"port": 10200,
"scripts": {
"serve": "vue-cli-service serve",
"dev": "vue-cli-service serve --progress",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.20.0",
"core-js": "^3.6.5",
"echarts": "^5.2.2",
"element-ui": "^2.15.7",
"js-md5": "^0.7.3",
"moment": "^2.29.1",
"sass": "^1.45.1",
"vue": "^2.6.11",
"vue-router": "^3.4.6",
"vuex": "^3.5.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"sass-loader": "^10.0.3",
"vue-template-compiler": "^2.6.11",
"webpack-bundle-analyzer": "^4.6.1"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="glsx-sub-system"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="glsx-system-sub" class="glsx-system-sub">
<!-- <div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/user">user</router-link> |
<router-link to="/role">role</router-link> |
<router-link to="/orginizaManage">orginizaManage</router-link> |
<router-link to="/menuManage">menuManage</router-link> |
<router-link to="/dictionaryManage">dictionaryManage</router-link> |
<router-link to="/dictionaryData">dictionaryData</router-link> |
<router-link to="/workLog">workLog</router-link>
<p>a链接跳转到主项目/其他子项目的页面,页面会刷新,效果不好<a href="/about">parent About</a></p>
<p v-if="isQiankun">
主项目把router传给子项目,子项目用这个router来跳转
<span @click="goToPage('/about')">parent About</span>
<span @click="goToPage('/app-vue-history/about')">app-vue-history About</span>
</p>
</div> -->
<keep-alive exclude="vehicleAddUpadate,vehicleTypeManage">
<router-view />
</keep-alive>
</div>
</template>
<script>
import { mapMutations } from "vuex";
export default {
data() {
return {
isQiankun: window.__POWERED_BY_QIANKUN__,
};
},
watch: {
$route(to, from) {
if (this.isQiankun) {
this.getBreadcrumb();
}
},
},
methods: {
...mapMutations(["updateBaseURL"]),
getBreadcrumb() {
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 = "/system#";
let breadcrumb = [];
if (meta) {
const { title, pushState } = meta;
if (pushState && title) {
breadcrumb.push({
name: title,
path: basePath + path,
});
history.state.pushState = pushState;
history.state.breadcrumb = [...curBreadCrumb, breadcrumb[0]];
// this.$root.parentVuex.dispatch('menu/setBreadCrumb', [...curBreadCrumb, breadcrumb[0]]);
}
}
},
goToPage(path) {
this.$root.parentRouter.push(path);
},
},
created() {},
};
</script>
<style lang="scss">
#glsx-system-sub {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* text-align: center; */
color: #2c3e50;
/* height: 800px; */
/* overflow-y: auto; */
}
/* .glsx-system-sub #nav {
padding: 30px;
} */
.glsx-system-sub #nav a {
font-weight: bold;
color: #2c3e50;
}
.glsx-system-sub #nav a.router-link-exact-active {
color: #42b983;
}
/* .glsx-system-sub span {
font-weight: bold;
color: #2c3e50;
cursor: pointer;
margin: 0 15px;
text-decoration: underline;
} */
.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;
}
}
.links_group:after {
display: block;
content: "";
height: 1px;
position: absolute;
left: 0;
right: 0;
bottom: 0;
background: #d8d8d8;
transform: scaleY(0.5);
}
.el_table {
thead {
th {
background: rgba($color: #f2f2f2, $alpha: 0.5) !important;
}
}
}
.pagination_list {
text-align: right;
padding: 10px 0;
}
// 下划线
.glsx_hairline {
position: relative;
}
.glsx_hairline:after {
display: block;
content: "";
height: 1px;
background: #d8d8d8;
position: absolute;
left: 0;
right: 0;
bottom: 0;
transform: scaleY(0.5);
}
.el_link{
margin:0 4px;
}
</style>
const MAP_KEY = '75116f653f3b2e4568116dad8cd9b899'
export const CONSTANT = {
//ROOT: process.env.NODE_ENV === 'development'?'ots/':'',
API_URL: '/ots/',
MAP_KEY,
}
\ No newline at end of file
//import ClipboardJS from 'clipboard'
//window.ClipboardJS = ClipboardJS
//import EventBus from '../event-bus'
import { Message } from "element-ui";
// EventBus.$on('uiMap.copySuccess', (data)=>{
// Message({
// type: 'success',
// message: '已复制内容至粘贴板'
// });
// });
function MapService() {
this.map = null;
this.restainLayer = null;
}
MapService.prototype = {
// 设置默认图标
setDefaultIcon(marker) {
marker.setIcon(require('@/assets/images/icon_car.png'))
},
// 获取经纬度
getLngLat: function (lng, lat) {
return new AMap.LngLat(lng, lat);
},
// 清空地图覆盖物
clearMap: function (map) {
this.map.clearMap();
},
// 设置地图视角
setFitView: function (map) {
this.map.setFitView();
},
// 创建车辆位置点
createCarMarker: function (lnglatXY, map) {
var marker = new AMap.Marker({
position: lnglatXY,
icon: require('@/assets/images/icon_car.png'),
map: map,
autoRotation: true,
offset: new AMap.Pixel(-18, -11),
zIndex: 1020,
animation: 'AMAP_ANIMATION_DROP'
});
return marker;
},
// 创建位置点弹框
createActiveInfo(info) {
let msg = '报警'
// 激活
if (info.type == 1) {
msg = '激活'
}
// 定位
if (info.type == 2) {
msg = '定位'
}
let _html = `<h3 class="map-infowindow-title">${info.name}/${info.standNo}</h3>
<div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn} (${info.source == 1 ? '有线' : '无线'})</span></p>`
// 是否包含断电、光感报警
if (info.alarmTypeSet && info.alarmTypeSet.length > 0) {
let tg = '';
let cHmtl = ''
let typeList = {
1: '断电',
99: '光感'
}
info.alarmTypeSet.forEach((alarmType) => {
tg += `<a class="btn_danger">${typeList[alarmType]}</a>`
});
cHmtl = '<p><i class="icon icon-info_device_alarm"></i><span>报警状态:</span>' + tg + '</p>';
_html += cHmtl
}
_html += `<p><i class="icon icon-info_time"></i>${msg}时间: <span class="des"data-time>${info.time}</span></p>
<p style="display:${info.bsLng ? 'flex' : 'none'}"><i class="icon icon-info_type"></i>定位类型: <a class="locate-btn active" id="locateTypeGps">GPS</a><a class="locate-btn" id="locateTypeBase">基站</a></p>
<p class="long_p"><i class="icon icon-info_location"></i><span>${msg}地址:</span><span class="des" data-transferAddress>${info.address}</span></p>
</div>`;
return _html
},
// 位置点弹框
bindActiveLocationInfoWindow(marker, map, info) {
var self = this
var infoDiv = document.createElement('div')
infoDiv.innerHTML = self.createActiveInfo(info)
// gps位置信息
function fillGPS() {
infoDiv.querySelector('[data-time]').textContent = info.time;
infoDiv.querySelector('[data-transferAddress]').textContent = info.address;
infoDiv.querySelector('#locateTypeGps').classList.add('active');
infoDiv.querySelector('#locateTypeBase').classList.remove('active');
marker.setPosition(self.getLngLat(info.lng, info.lat));
marker.infoWindow && marker.infoWindow.open(map, marker.getPosition());
}
// 基站位置信息
function fillBase() {
infoDiv.querySelector('[data-time]').textContent = info.bsTime;
infoDiv.querySelector('[data-transferAddress]').textContent = info.bsAddress;
infoDiv.querySelector('#locateTypeGps').classList.remove('active');
infoDiv.querySelector('#locateTypeBase').classList.add('active');
marker.setPosition(self.getLngLat(info.bsLng, info.bsLat));
marker.infoWindow && marker.infoWindow.open(map, marker.getPosition());
}
infoDiv.querySelector('#locateTypeGps').onclick = function (e) {
fillGPS()
}
infoDiv.querySelector('#locateTypeBase').onclick = function (e) {
fillBase()
}
if (info.lng) {
fillGPS()
}
if (!info.lng && info.bsLng) {
fillBase()
}
return this.createActiveInfoWindow(marker, map, infoDiv)
},
// 创建位置点弹框
createActiveInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
var infoWindow = new AMap.InfoWindow({
offset: new AMap.Pixel(0, 0),
content: div,
autoMove: !!isInfoAutoMove,
})
console.log(infoWindow)
marker.infoWindow = infoWindow
if (isInfoOpen) {
infoWindow.open(map, marker.getPosition())
}
//给Marker绑定单击事件
marker.on('click', markerClick)
function markerClick(e) {
//infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition())
}
return infoWindow
},
// 打开激活位置点弹框
openActiveInfoWindow(map, makers, infoWindow) {
const MAP = map
const lnglat = makers.getPosition()
infoWindow.open(MAP, lnglat)
MAP.setZoomAndCenter(MAP.getZoom(), lnglat)
}
}
const mapService = new MapService();
export default mapService
\ No newline at end of file
.icon {display: inline-block;background-image: url(./sprite.png);background-size: 119px 97px; vertical-align: middle;}
.icon-battery_empty { width: 42px; height: 20px; background-position: 0px 0px; }
.icon-battery_enough { width: 42px; height: 20px; background-position: 0px -20px; }
.icon-fullsize.active { width: 18px; height: 18px; background-position: 0px -79px; }
.icon-fullsize:active { width: 18px; height: 18px; background-position: 0px -79px; }
.icon-fullsize:hover { background-position: 0px -79px; }
.icon-fullsize { width: 18px; height: 18px; background-position: -18px -79px; }
.icon-icon_zoom_out.active { width: 18px; height: 18px; background-position: -36px -79px; }
.icon-icon_zoom_out:active { width: 18px; height: 18px; background-position: -36px -79px; }
.icon-icon_zoom_out:hover { background-position: -36px -79px; }
.icon-icon_zoom_out { width: 18px; height: 18px; background-position: -54px -79px; }
.icon-info_copy.active { width: 16px; height: 16px; background-position: -101px -36px; }
.icon-info_copy:active { width: 16px; height: 16px; background-position: -101px -36px; }
.icon-info_copy:hover { background-position: -101px -36px; }
.icon-info_copy { width: 16px; height: 16px; background-position: -101px -52px; }
.icon-info_device_alarm { width: 20px; height: 20px; background-position: -42px 0px; }
.icon-info_device_status { width: 20px; height: 20px; background-position: -42px -20px; }
.icon-info_device { width: 20px; height: 20px; background-position: 0px -40px; }
.icon-info_location { width: 20px; height: 20px; background-position: -20px -40px; }
.icon-info_stop { width: 20px; height: 20px; background-position: -40px -40px; }
.icon-info_time { width: 20px; height: 20px; background-position: -62px 0px; }
.icon-info_type { width: 20px; height: 20px; background-position: -62px -20px; }
.icon-locate.active { width: 19px; height: 19px; background-position: -62px -40px; }
.icon-locate:active { width: 19px; height: 19px; background-position: -62px -40px; }
.icon-locate:hover { background-position: -62px -40px; }
.icon-locate { width: 19px; height: 19px; background-position: 0px -60px; }
.icon-minisize.active { width: 18px; height: 19px; background-position: -82px -19px; }
.icon-minisize:active { width: 18px; height: 19px; background-position: -82px -19px; }
.icon-minisize:hover { background-position: -82px -19px; }
.icon-minisize { width: 18px; height: 18px; background-position: -72px -79px; }
.icon-refresh.active { width: 18px; height: 19px; background-position: -82px -38px; }
.icon-refresh:active { width: 18px; height: 19px; background-position: -82px -38px; }
.icon-refresh:hover { background-position: -82px -38px; }
.icon-refresh { width: 18px; height: 19px; background-position: -82px -57px; }
.icon-ruler.active { width: 19px; height: 19px; background-position: -19px -60px; }
.icon-ruler:active { width: 19px; height: 19px; background-position: -19px -60px; }
.icon-ruler:hover { background-position: -19px -60px; }
.icon-ruler { width: 19px; height: 19px; background-position: -38px -60px; }
.icon-satellite.active { width: 18px; height: 18px; background-position: -101px 0px; }
.icon-satellite:active { width: 18px; height: 18px; background-position: -101px 0px; }
.icon-satellite:hover { background-position: -101px 0px; }
.icon-satellite { width: 18px; height: 18px; background-position: -101px -18px; }
.icon-zoom_in.active { width: 19px; height: 19px; background-position: -57px -60px; }
.icon-zoom_in:active { width: 19px; height: 19px; background-position: -57px -60px; }
.icon-zoom_in:hover { background-position: -57px -60px; }
.icon-zoom_in { width: 19px; height: 19px; background-position: -82px 0px; }
\ No newline at end of file
/*
Stylus variables are information about icon's compiled state, stored under its original file name
.icon-home {
width: $icon_home_width;
}
The large array-like variables contain all information about a single icon
$icon_home = x y offset_x offset_y width height total_width total_height image_path;
At the bottom of this section, we provide information about the spritesheet itself
$spritesheet = width height image $spritesheet_sprites;
*/
$icon_fullsize_active_name = 'icon_fullsize_active';
$icon_fullsize_active_x = 54px;
$icon_fullsize_active_y = 57px;
$icon_fullsize_active_offset_x = -54px;
$icon_fullsize_active_offset_y = -57px;
$icon_fullsize_active_width = 18px;
$icon_fullsize_active_height = 18px;
$icon_fullsize_active_total_width = 76px;
$icon_fullsize_active_total_height = 75px;
$icon_fullsize_active_image = '~sprite.png';
$icon_fullsize_active = 54px 57px -54px -57px 18px 18px 76px 75px '~sprite.png' 'icon_fullsize_active';
$icon_fullsize_name = 'icon_fullsize';
$icon_fullsize_x = 0px;
$icon_fullsize_y = 57px;
$icon_fullsize_offset_x = 0px;
$icon_fullsize_offset_y = -57px;
$icon_fullsize_width = 18px;
$icon_fullsize_height = 18px;
$icon_fullsize_total_width = 76px;
$icon_fullsize_total_height = 75px;
$icon_fullsize_image = '~sprite.png';
$icon_fullsize = 0px 57px 0px -57px 18px 18px 76px 75px '~sprite.png' 'icon_fullsize';
$icon_locate_active_name = 'icon_locate_active';
$icon_locate_active_x = 19px;
$icon_locate_active_y = 0px;
$icon_locate_active_offset_x = -19px;
$icon_locate_active_offset_y = 0px;
$icon_locate_active_width = 19px;
$icon_locate_active_height = 19px;
$icon_locate_active_total_width = 76px;
$icon_locate_active_total_height = 75px;
$icon_locate_active_image = '~sprite.png';
$icon_locate_active = 19px 0px -19px 0px 19px 19px 76px 75px '~sprite.png' 'icon_locate_active';
$icon_locate_name = 'icon_locate';
$icon_locate_x = 0px;
$icon_locate_y = 19px;
$icon_locate_offset_x = 0px;
$icon_locate_offset_y = -19px;
$icon_locate_width = 19px;
$icon_locate_height = 19px;
$icon_locate_total_width = 76px;
$icon_locate_total_height = 75px;
$icon_locate_image = '~sprite.png';
$icon_locate = 0px 19px 0px -19px 19px 19px 76px 75px '~sprite.png' 'icon_locate';
$icon_minisize_active_name = 'icon_minisize_active';
$icon_minisize_active_x = 36px;
$icon_minisize_active_y = 38px;
$icon_minisize_active_offset_x = -36px;
$icon_minisize_active_offset_y = -38px;
$icon_minisize_active_width = 18px;
$icon_minisize_active_height = 19px;
$icon_minisize_active_total_width = 76px;
$icon_minisize_active_total_height = 75px;
$icon_minisize_active_image = '~sprite.png';
$icon_minisize_active = 36px 38px -36px -38px 18px 19px 76px 75px '~sprite.png' 'icon_minisize_active';
$icon_minisize_name = 'icon_minisize';
$icon_minisize_x = 18px;
$icon_minisize_y = 57px;
$icon_minisize_offset_x = -18px;
$icon_minisize_offset_y = -57px;
$icon_minisize_width = 18px;
$icon_minisize_height = 18px;
$icon_minisize_total_width = 76px;
$icon_minisize_total_height = 75px;
$icon_minisize_image = '~sprite.png';
$icon_minisize = 18px 57px -18px -57px 18px 18px 76px 75px '~sprite.png' 'icon_minisize';
$icon_refresh_active_name = 'icon_refresh_active';
$icon_refresh_active_x = 0px;
$icon_refresh_active_y = 38px;
$icon_refresh_active_offset_x = 0px;
$icon_refresh_active_offset_y = -38px;
$icon_refresh_active_width = 18px;
$icon_refresh_active_height = 19px;
$icon_refresh_active_total_width = 76px;
$icon_refresh_active_total_height = 75px;
$icon_refresh_active_image = '~sprite.png';
$icon_refresh_active = 0px 38px 0px -38px 18px 19px 76px 75px '~sprite.png' 'icon_refresh_active';
$icon_refresh_name = 'icon_refresh';
$icon_refresh_x = 18px;
$icon_refresh_y = 38px;
$icon_refresh_offset_x = -18px;
$icon_refresh_offset_y = -38px;
$icon_refresh_width = 18px;
$icon_refresh_height = 19px;
$icon_refresh_total_width = 76px;
$icon_refresh_total_height = 75px;
$icon_refresh_image = '~sprite.png';
$icon_refresh = 18px 38px -18px -38px 18px 19px 76px 75px '~sprite.png' 'icon_refresh';
$icon_ruler_active_name = 'icon_ruler_active';
$icon_ruler_active_x = 0px;
$icon_ruler_active_y = 0px;
$icon_ruler_active_offset_x = 0px;
$icon_ruler_active_offset_y = 0px;
$icon_ruler_active_width = 19px;
$icon_ruler_active_height = 19px;
$icon_ruler_active_total_width = 76px;
$icon_ruler_active_total_height = 75px;
$icon_ruler_active_image = '~sprite.png';
$icon_ruler_active = 0px 0px 0px 0px 19px 19px 76px 75px '~sprite.png' 'icon_ruler_active';
$icon_ruler_name = 'icon_ruler';
$icon_ruler_x = 38px;
$icon_ruler_y = 19px;
$icon_ruler_offset_x = -38px;
$icon_ruler_offset_y = -19px;
$icon_ruler_width = 19px;
$icon_ruler_height = 19px;
$icon_ruler_total_width = 76px;
$icon_ruler_total_height = 75px;
$icon_ruler_image = '~sprite.png';
$icon_ruler = 38px 19px -38px -19px 19px 19px 76px 75px '~sprite.png' 'icon_ruler';
$icon_satellite_active_name = 'icon_satellite_active';
$icon_satellite_active_x = 57px;
$icon_satellite_active_y = 37px;
$icon_satellite_active_offset_x = -57px;
$icon_satellite_active_offset_y = -37px;
$icon_satellite_active_width = 18px;
$icon_satellite_active_height = 18px;
$icon_satellite_active_total_width = 76px;
$icon_satellite_active_total_height = 75px;
$icon_satellite_active_image = '~sprite.png';
$icon_satellite_active = 57px 37px -57px -37px 18px 18px 76px 75px '~sprite.png' 'icon_satellite_active';
$icon_satellite_name = 'icon_satellite';
$icon_satellite_x = 57px;
$icon_satellite_y = 18px;
$icon_satellite_offset_x = -57px;
$icon_satellite_offset_y = -18px;
$icon_satellite_width = 18px;
$icon_satellite_height = 19px;
$icon_satellite_total_width = 76px;
$icon_satellite_total_height = 75px;
$icon_satellite_image = '~sprite.png';
$icon_satellite = 57px 18px -57px -18px 18px 19px 76px 75px '~sprite.png' 'icon_satellite';
$icon_zoom_in_active_name = 'icon_zoom_in_active';
$icon_zoom_in_active_x = 38px;
$icon_zoom_in_active_y = 0px;
$icon_zoom_in_active_offset_x = -38px;
$icon_zoom_in_active_offset_y = 0px;
$icon_zoom_in_active_width = 19px;
$icon_zoom_in_active_height = 19px;
$icon_zoom_in_active_total_width = 76px;
$icon_zoom_in_active_total_height = 75px;
$icon_zoom_in_active_image = '~sprite.png';
$icon_zoom_in_active = 38px 0px -38px 0px 19px 19px 76px 75px '~sprite.png' 'icon_zoom_in_active';
$icon_zoom_in_name = 'icon_zoom_in';
$icon_zoom_in_x = 19px;
$icon_zoom_in_y = 19px;
$icon_zoom_in_offset_x = -19px;
$icon_zoom_in_offset_y = -19px;
$icon_zoom_in_width = 19px;
$icon_zoom_in_height = 19px;
$icon_zoom_in_total_width = 76px;
$icon_zoom_in_total_height = 75px;
$icon_zoom_in_image = '~sprite.png';
$icon_zoom_in = 19px 19px -19px -19px 19px 19px 76px 75px '~sprite.png' 'icon_zoom_in';
$icon_zoom_out_active_name = 'icon_zoom_out_active';
$icon_zoom_out_active_x = 36px;
$icon_zoom_out_active_y = 57px;
$icon_zoom_out_active_offset_x = -36px;
$icon_zoom_out_active_offset_y = -57px;
$icon_zoom_out_active_width = 18px;
$icon_zoom_out_active_height = 18px;
$icon_zoom_out_active_total_width = 76px;
$icon_zoom_out_active_total_height = 75px;
$icon_zoom_out_active_image = '~sprite.png';
$icon_zoom_out_active = 36px 57px -36px -57px 18px 18px 76px 75px '~sprite.png' 'icon_zoom_out_active';
$icon_zoom_out_name = 'icon_zoom_out';
$icon_zoom_out_x = 57px;
$icon_zoom_out_y = 0px;
$icon_zoom_out_offset_x = -57px;
$icon_zoom_out_offset_y = 0px;
$icon_zoom_out_width = 19px;
$icon_zoom_out_height = 18px;
$icon_zoom_out_total_width = 76px;
$icon_zoom_out_total_height = 75px;
$icon_zoom_out_image = '~sprite.png';
$icon_zoom_out = 57px 0px -57px 0px 19px 18px 76px 75px '~sprite.png' 'icon_zoom_out';
$spritesheet_width = 76px;
$spritesheet_height = 75px;
$spritesheet_image = '~sprite.png';
$spritesheet_sprites = $icon_fullsize_active $icon_fullsize $icon_locate_active $icon_locate $icon_minisize_active $icon_minisize $icon_refresh_active $icon_refresh $icon_ruler_active $icon_ruler $icon_satellite_active $icon_satellite $icon_zoom_in_active $icon_zoom_in $icon_zoom_out_active $icon_zoom_out;
$spritesheet = 76px 75px '~sprite.png' $spritesheet_sprites;
/*
The provided mixins are intended to be used with the array-like variables
.icon-home {
spriteWidth($icon_home)
}
.icon-email {
sprite($icon_email)
}
Example usage in HTML:
`display: block` sprite:
<div class="icon-home"></div>
To change `display` (e.g. `display: inline-block;`), we suggest using a common CSS class:
// CSS
.icon {
display: inline-block;
}
// HTML
<i class="icon icon-home"></i>
*/
spriteWidth($sprite) {
width: $sprite[4];
}
spriteHeight($sprite) {
height: $sprite[5];
}
spritePosition($sprite) {
background-position: $sprite[2] $sprite[3];
}
spriteImage($sprite) {
background-image: url($sprite[8]);
}
sprite($sprite) {
spriteImage($sprite)
spritePosition($sprite)
spriteWidth($sprite)
spriteHeight($sprite)
}
/*
The `sprites` mixin generates identical output to the CSS template
but can be overridden inside of Stylus
This must be run when you have at least 2 sprites.
If run with a single sprite, then there will be reference errors.
sprites($spritesheet_sprites);
*/
sprites($sprites) {
for $sprite in $sprites {
$sprite_name = $sprite[9];
.{$sprite_name} {
sprite($sprite);
}
}
}
.map-wrap{
// position: absolute;
// top: 100px;
// left: 0;
width: 100%;
height: calc(100% - 100px);
overflow: hidden;
.map-controll{
position: absolute;
top: 40px;
right: 250px;
z-index: 102;
.fullsize-btn{
margin-left: 20px;
}
}
.map-bottom-controll{
position: absolute;
bottom: 30px;
right: 20px;
z-index: 102;
ul{
border: 1px solid #eee;
color: #094;
}
.ctrl-item{
background-color: #fff;
padding: 6px 10px;
font-size: 16px;
}
}
.controll-wrap{
position: absolute;
top: 40px;
left: 40px;
z-index: 101;
width: 320px;
max-height: 716px;
}
.menu-search{
.el-select{
width: 100px;
}
.input-with-select{
width: 100%;
}
.el-input-group__append{
background: #094;
border-color: #094;
color: #fff;
font-size: 16px;
}
.el-input-group__append:hover, .el-input-group__append:focus {
background: #33ad69;
border-color: #33ad69;
}
}
.filter-entrance{
margin-top: 10px;
background-color: rgba(255,255,255,0.9);
//border: 1px solid #dcdfe6;
box-shadow: 1px 1px 5px #dcdfe6;
.el-button{
padding: 6px;
}
}
.filter-dialog-set{
margin-top: 10px;
height: 100%;
position: relative;
}
.filter-dialog{
position: absolute;
top: 0;
left: 0;
width: 100%;
background-color: #fff;
border: 1px solid #dcdfe6;
box-sizing: border-box;
.filter-dialog-header{
text-align: center;
padding: 8px;
border-bottom: 1px solid #eee;
.el-icon-close{
font-size: 16px;
cursor: pointer;
}
}
.filter-dialog-body{
padding: 15px;
.upload-wrap{
.el-select{
width: 100px;
}
.input-with-select{
width: 100%;
}
}
}
.upload-sure-btn{
width: 100%;
}
animation-duration: .5s;
animation-delay: 0s;
display: none;
&.active{
display: block
}
.sub-filter{
padding-bottom: 15px;
border-bottom: 1px solid #eee;
}
.monitor-list{
max-height: calc(100vh - 280px);
/* max-height: 568px; */
overflow: auto;
margin-right: -10px;
padding-right: 10px;
}
.monitor-list-item{
display: flex;
border-bottom: 1px solid #eee;
.user-info{
flex: 1;
color: #666;
&>p{
margin: 8px 0;
}
.name{
color: #333;
margin-right: 15px;
}
}
&:last-child{
border-bottom: none;
}
.device-icon{
margin-right: 5px;
margin-top: 12px;
}
}
.device-icon-label{
display: inline-block;
margin-left: 5px;
}
.device-icon{
display: inline-block;
vertical-align: middle;
width: 8px;
height: 8px;
border-radius: 5px;
background-color: rgba(0,153,68,0.8);
&.offline{
background-color: rgba(255,0,0,0.8);
}
}
.filter-dialog-footer{
border-top: 1px solid #eee;
padding: 10px;
span{
vertical-align: middle;
}
}
}
.search-box{
.date-filter{
position: absolute;
top: 0px;
right: 0px;
}
.el-form--inline .el-form-item{
margin-right: 0px;
}
.stay-ctrl{
margin-top: 5px;
input{
width: 100%;
}
.el-form-item{
margin-bottom: 0px;
}
.unit{
line-height: 30px;
margin-left: 10px;
}
}
.el-range-editor--mini .el-range-input{
width: 115px;
}
.el-form-item{
margin-bottom: 15px;
}
.submit-el-form-item{
margin-top: 20px;
}
}
.search-box, .result-box{
padding: 20px;
background: #fff;
box-shadow: 1px 1px 4px #ccc;
display: none;
}
.search-box.active, .result-box.active{
display: block;
}
.result-box{
/* height: 100%;
max-height: 660px; */
padding: 0px;
.result-box-head{
text-align: center;
border-bottom: 1px solid #ddd;
padding: 10px 15px;
&>*{
vertical-align: middle;
}
}
.result-box-filter{
font-size: 0px;
padding: 5px 0px;
border-bottom: 1px solid #eee;
.el-button{
font-size: 13px;
padding: 2px 10px;
margin: 0;
&:first-child{
border-right: 1px solid #eee;
}
i{
margin: 0 3px;
}
}
}
.stay-list{
/* height: calc(100% - 70px); */
max-height: calc(100vh - 200px);
overflow-y: auto;
}
.stay-list-item{
line-height: 1.5;
padding: 10px 15px;
border-bottom: 1px solid #eee;
p{
margin: 0px;
}
.datetime{
font-size: 13px;
color: #666;
}
}
}
.replay-player{
max-width: 400px;
position: absolute;
top: 20px;
right: 20px;
z-index: 500;
background: #fff;
padding: 5px 10px;
margin-top: 10px;
.el-progress{
display: inline-block;
width: 200px;
margin: 0;
height: 10px;
border-radius: 0;
}
&>a{
margin: 0 5px;
cursor: pointer;
&:hover{
color: #094;
}
}
}
.row-form-item .el-form-item__label{
float: none;
}
}
.full-width .map-wrap{
// top: 0px;
height: 100%;
}
.map-container{
width: 100%;
height: 100%;
z-index: 100;
}
.el-loading-mask{
z-index: 500;
}
.map-infowindow-ct{
&>p{
display: flex;
align-items: center;
}
.long_p{
align-items: flex-start;
}
.des{
flex: 1;
word-break: break-all;
}
.icon{
display: block;
margin-right: 5px;
}
.battery{
position: relative;
width: 42px;
height: 20px;
i{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.fill{
width: 39px;
}
.fill-percentage{
padding: 3px;
box-sizing: border-box;
background-color: #d4f1dc;
}
.text{
color: #37c060;
font-size: 12px;
text-align: center;
}
&.empty .fill-percentage{
background-color: #f0d0d0;
}
&.empty .fill-percentage{
color: #df2222;
}
&.hide{
display: none;
}
}
.redirect-row{
display: flex;
}
a.redirect-btn{
flex: 1;
border: 1px solid rgba(0,153,68,0.8);
border-radius: 2px;
text-align: center;
padding: 4px 0px;
color: rgba(0,153,68,0.8);
margin: 2px;
cursor: pointer;
&:hover{
color: rgba(0,153,68, 1);
border-color: rgba(0,153,68, 1);
}
}
a.locate-btn{
padding: 2px 8px;
border: 1px solid #094;
border-radius: 4px 0 0 4px;
line-height: 16px;
& + .locate-btn{
border-radius: 0 4px 4px 0;
border-left: none;
}
&.active{
background-color: #094;
color: #fff;
}
}
.btn_danger{
background:#f00;
color:#fff;
font-size:12px;
margin:0 4px;
border-radius:4px;
padding:2px 8px;
border:1px solid #f00;
}
}
.poi_marker{
display: inline-block;
width: 40px;
height: 48px;
//background-image: url('./assets/images/poi-marker-default.png');
background-size: 40px 50px;
text-align: center;
color: #fff;
padding-top: 2px;
}
.poi_infowin{
.poi_item{
display: flex;
justify-content: space-between;
label{
color: #666;
}
span, input{
flex: 1;
}
input{
border: 1px solid #ccc;
height: 22px;
padding: 2px 8px;
}
}
.poi_ctrl{
justify-content: flex-end;
&>a{
display: inline-block;
border: 1px solid rgba(0, 153, 68, 0.8);
border-radius: 12px;
text-align: center;
padding: 2px 10px;
color: rgba(0, 153, 68, 0.8);
margin-left: 10px;
cursor: pointer;
}
&>a[data-delete]{
border: 1px solid #dcdfe6;
color: #606266;
}
}
}
\ No newline at end of file
const chartConfig = {
type: 'line',
data: {
labels: [],
datasets: [{
data: [],
label: '设备激活数(个)',
borderDash: [1],
backgroundColor: 'rgba(0,153,68,0.3)',
borderColor: 'rgba(0,153,68,0.8)',
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
legend: false,
tooltips: {
intersect: false,
displayColors: false
},
scales: {
yAxes: [{
ticks: {
beginAtZero:true,
//stepSize: 1,
callback: function(value, index, values) {
if (Math.floor(value) === value) {
return value;
}
},
autoSkip: true,
maxRotation: 10,
maxTicksLimit: 10
}
}],
xAxes: []
}
}
}
export default chartConfig;
\ No newline at end of file
This diff could not be displayed because it is too large.
export const Validator = {
/*手机号码格式校验正则*/
PHONEREG: /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/,
/*同时包含字母和数字*/
ISNUMANDLETTERS: /^[a-zA-Z0-9]+$/,
/*特殊字符正则*/
SPECIALLETTER:new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"),
/*邮箱地址格式正则*/
//EMAILREG:/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/,
EMAILREG:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
/*判断是否为中文*/
ISCHINESE:/^[\u0391-\uFFE5]+$/,
/*判断是否为英文字母*/
ISENGLISH:/^[a-zA-Z]+$/,
/*是否包含空格*/
ISHAVENULL:/^[^\s]*$/,
/*保留两位小数*/
TWODECIMAL: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
/*判断是否为正整数*/
ISDECIMAL:/^[0-9]*$/,
/**
* 账号管理-手机号码校验
*/
checkPhoneNumber:function(str){
return Validator.PHONEREG.test(str);
},
// 车架号
CHECKVINNUMBER:/(?!^[0-9]{17}$)(?!^[a-zA-Z]{17}$)^[0-9A-Za-z]{17}$/
};
<template>
<div>
<div id="mapContainer" class="map-container"></div>
</div>
</template>
<script>
// import mapService from "@/amap/mapService";
import "@/assets/spritesmith-generated/sprite.css";
import "@/assets/styles/monitor.scss";
import GLMapSdk from "@/utils/glsk-mapapi-sdk";
/**
* address: gps地址
* bsAddress:基站地址
* bsLat,bsLng:基站经纬度
* gpsLat,gpsLng:gps经纬度
* name:车主姓名
* standNo:车架号
* time:定位时间
*/
export default {
name: "MapLocation",
props: {
info: {
type: Object,
default: function () {
return {
};
},
},
},
data() {
return {
mapObj: "",
zoom: 12,
};
},
mounted() {
this.initMap();
console.log('地图');
},
methods: {
async initMap() {
// console.log(GLMapSdk);
try {
// new GLMapSdk(async (mapapi) => {
console.log(this.mapapi, 'mapapi');
const mapapi = this.mapapi
const map = await mapapi.invoke("Map", "mapContainer");
const { lng, lat } = this.info;
mapapi.invoke("centerAndZoom", mapapi.invoke("Point", lng, lat), this.zoom);
mapapi.invoke('NavigationControl')
// mapapi.invoke('enableScrollWheelZoom')
this.drawMaker(mapapi, map);
// })
} catch (error) {
console.log(error);
}
},
// 激活位置
drawMaker(mapapi, map) {
let data = this.info;
const lng = parseFloat(data.lng || data.bsLng);
const lat = parseFloat(data.lat || data.bsLat);
var marker = mapapi.invoke("Marker", mapapi.invoke("Point", lng, lat), {
icon: mapapi.invoke(
"Icon",
require("@/assets/images/icon_car.png"),
mapapi.invoke("Size", 60, 60),
{
anchor: mapapi.invoke("Size", 10, 15),
infoWindowAnchor: mapapi.invoke("Size", 10, 0),
}
),
});
this.bindActiveLocationInfoWindow(marker, map, data);
mapapi.invoke("addOverlay", marker);
},
// 创建位置点弹框
createActiveInfo(info) {
let msg = "报警";
// 激活
if (info.type == 1) {
msg = "激活";
}
// 定位
if (info.type == 2) {
msg = "定位";
}
let _html = `<h3 class="map-infowindow-title">${info.name}/${info.standNo}</h3>
<div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号: <span class="des">${
info.sn
} (${info.source == 1 ? "有线" : "无线"})</span></p>`;
// 是否包含断电、光感报警
if (info.alarmTypeSet && info.alarmTypeSet.length > 0) {
let tg = "";
let cHmtl = "";
let typeList = {
1: "断电",
99: "光感",
};
info.alarmTypeSet.forEach((alarmType) => {
tg += `<a class="btn_danger">${typeList[alarmType]}</a>`;
});
cHmtl =
'<p><i class="icon icon-info_device_alarm"></i><span>报警状态:</span>' +
tg +
"</p>";
_html += cHmtl;
}
_html += `<p><i class="icon icon-info_time"></i>${msg}时间: <span class="des"data-time>${
info.time
}</span></p>
<p style="display:${
info.bsLng ? "flex" : "none"
}"><i class="icon icon-info_type"></i>定位类型: <a class="locate-btn active" id="locateTypeGps">GPS</a><a class="locate-btn" id="locateTypeBase">基站</a></p>
<p class="long_p"><i class="icon icon-info_location"></i><span>${msg}地址:</span><span class="des" data-transferAddress>${
info.address
}</span></p>
</div>`;
return _html;
},
// 位置点弹框
bindActiveLocationInfoWindow(marker, map, info) {
var self = this;
var infoDiv = document.createElement("div");
infoDiv.innerHTML = self.createActiveInfo(info);
// gps位置信息
function fillGPS() {
infoDiv.querySelector("[data-time]").textContent = info.time;
infoDiv.querySelector("[data-transferAddress]").textContent = info.address;
infoDiv.querySelector("#locateTypeGps").classList.add("active");
infoDiv.querySelector("#locateTypeBase").classList.remove("active");
marker.setPosition(self.mapapi.invoke("Point", info.lng, info.lat));
// map.openInfoWindow(marker.infoWindow, marker.getPosition());
self.mapapi.invoke("mapOpenInfoWindow", marker.infoWindow, self.mapapi.invoke('markerGetPosition'));
}
// 基站位置信息
function fillBase() {
infoDiv.querySelector("[data-time]").textContent = info.bsTime;
infoDiv.querySelector("[data-transferAddress]").textContent = info.bsAddress;
infoDiv.querySelector("#locateTypeGps").classList.remove("active");
infoDiv.querySelector("#locateTypeBase").classList.add("active");
console.log(self.mapapi.invoke("Point", info.bsLng, info.bsLat), "基站点位置", map);
marker.setPosition(self.mapapi.invoke("Point", info.bsLng, info.bsLat));
// map.openInfoWindow(marker.infoWindow, marker.getPosition());
self.mapapi.invoke("mapOpenInfoWindow", marker.infoWindow, self.mapapi.invoke('markerGetPosition'));
}
infoDiv.querySelector("#locateTypeGps").onclick = function (e) {
fillGPS();
};
infoDiv.querySelector("#locateTypeBase").onclick = function (e) {
fillBase();
};
if (info.lng) {
fillGPS();
}
if (!info.lng && info.bsLng) {
fillBase();
}
return this.createActiveInfoWindow(marker, map, infoDiv);
},
// 创建位置点弹框
createActiveInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
const { mapapi } = this;
let opts = {
width: 150, // 信息窗口宽度
// height: 170, // 信息窗口高度
};
let infoWindow = mapapi.invoke("InfoWindow", div, opts);
marker.infoWindow = infoWindow;
// map.openInfoWindow(infoWindow, marker.getPosition());
mapapi.invoke("mapOpenInfoWindow", infoWindow, mapapi.invoke('markerGetPosition'));
//给Marker绑定单击事件
// marker.addEventListener("click", markerClick);
mapapi.invoke("markerAddEventListener", 'click', markerClick)
function markerClick(e) {
// map.openInfoWindow(infoWindow, marker.getPosition());
mapapi.invoke("mapOpenInfoWindow", infoWindow, mapapi.invoke('markerGetPosition'));
}
return infoWindow;
},
// 打开激活位置点弹框
openActiveInfoWindow(map, makers, infoWindow) {
const MAP = map;
const lnglat = makers.getPosition();
infoWindow.open(MAP, lnglat);
MAP.setZoomAndCenter(MAP.getZoom(), lnglat);
},
},
};
</script>
<style lang="scss" scoped>
p {
margin: 0;
padding: 0;
}
.map-container {
width: 100%;
min-width: 600px;
height: 400px;
font-size: 13px;
}
</style>
<template>
<el-button :type="type" v-if="hasPermission()" :size="size">
<slot />
</el-button>
<!-- <el-link :type="type" v-if="link && hasPermission()">
<slot />
</el-link> -->
</template>
<script>
export default {
name: "AuthButton",
props: {
uid: {
type: [String, Number],
default: "",
},
type: {
type: [String, Number],
default: "default",
},
link: {
type: Boolean,
default: false,
},
size:{
type:String,
default:''
},
permissionTag:{
type:[String,Number],
default:''
}
},
data() {
return {};
},
mounted() {
},
methods: {
// 判断是否有权限
hasPermission() {
let id = this.uid;
let _name = this.name;
let _tag = this.permissionTag;
let list = this.$root.parentCommon.getAuthData();
let idx = list.findIndex((k) => k.id == id || k.label == _name || k.origin.permissionTag == _tag);
if (idx < 0) {
return false;
} else {
return true;
}
},
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<el-link class="el_link" :underline="false" :type="type" v-if="hasPermission()">
<slot />
</el-link>
</template>
<script>
export default {
name: "AuthLink",
props: {
uid: {
type: [String, Number],
default: "",
},
name: {
type: String,
default: "",
},
type: {
type: [String, Number],
default: "default",
},
link: {
type: Boolean,
default: false,
},
permissionTag:{
type:[String,Number],
default:''
}
},
data() {
return {};
},
mounted() {},
methods: {
// 判断是否有权限
hasPermission() {
let id = this.uid;
let _name = this.name;
let _tag = this.permissionTag;
let list = this.$root.parentCommon.getAuthData();
let idx = list.findIndex((k) => k.id == id || k.label == _name || k.origin.permissionTag == _tag);
if (idx < 0) {
return false;
} else {
return true;
}
},
},
};
</script>
<style lang="scss" scoped>
.el_link:hover {
text-decoration: none;
}
</style>
\ No newline at end of file
<template>
<div>
<el-dialog
:title="title"
:visible.sync="isVisible"
:before-close="handleClose"
:close-on-click-modal="false"
:width="width"
class="app-dialog"
>
<div class="container">
<slot></slot>
</div>
<div slot="footer">
<slot name="btn-front"></slot>
<el-button @click="handleClose">取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
:loading="btnLoading"
>{{btnOkLabel}}</el-button>
<slot name="btn-behind"></slot>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'basic-dialog',
props: {
title: {
type: String,
default: ''
},
isVisible: {
type: Boolean,
default: false
},
btnOkLabel: {
type: String,
default: '确定'
},
width: {
type: String,
default: '580px'
},
btnLoading: {
type: Boolean,
default: false
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
<style lang="scss">
.app-dialog {
.el-dialog__header {
padding: 20px;
}
.el-dialog__footer {
padding: 10px;
background: #fff;
}
.el-dialog__body {
padding: 0;
border-top: 1px solid #eaeefb;
border-bottom: 1px solid #eaeefb;
min-height: 250px;
max-height: 500px;
overflow-y: auto;
.container {
> span {
display: block;
}
overflow-y: auto;
padding: 20px 20px;
}
}
}
</style>
<!-- 表格+分页 -->
<template>
<div class="d2-table">
<el-table
:ref="tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'"
:data="getListApi ? data : tableData"
:row-key="tableParams.mutiSelectUniqueKey || ''"
v-loading="loading"
:border="tableParams.border || false"
:highlight-current-row="true"
:stripe="tableParams.stripe || true"
:size="tableParams.size || 'mini'"
@sort-change="sortChange"
@selection-change="handleSelect"
:header-cell-style="{background:'#f5f7fa'}"
>
<el-table-column
v-if="tableParams.mutiSelectUniqueKey"
type="selection"
width="55"
:reserve-selection="true"
>
</el-table-column>
<el-table-column
v-if="hasNum"
align="center"
width="70px"
:label="tableParams.numName || '序号'"
type='index'
:index="index=>index+(page.pageNumber - 1) * page.pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableParams.tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
:min-width="item.minWidth"
:align="item.align||'center'"
:sortable="item.sortable"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<slot
v-if="item.addHtml"
:name="item.addHtml"
:scope="scope.row"
:prop="item.prop"
:width="item.width"
></slot>
<template v-else-if="item.tagLabel">
<el-tag
v-if="!item.tagName"
:type="tableParams.tag.type[scope.row[item.prop]]"
v-text="tableParams.tag.label[scope.row[item.prop]]"
>
</el-tag>
<el-tag
v-else
:type="tableParams[item.tagName].type[scope.row[item.prop]]"
v-text="tableParams[item.tagName].label[scope.row[item.prop]]"
></el-tag>
</template>
<template v-else-if="item.formatter">
<span v-text="item.formatter(scope.row)"></span>
</template>
<template v-else-if="getListApi">
<span v-text="data[scope.$index][item.prop]"></span>
</template>
<template v-else>
<span v-text="tableData[scope.$index][item.prop]"></span>
</template>
</template>
</el-table-column>
<el-table-column
v-if="tableParams.tableOption"
label="操作"
:align="tableParams.tableOption.align||'center'"
:width="tableParams.tableOption.width||'200'"
fixed="right"
>
<!-- <template>
<el-button
v-for="(j, idx) in tableParams.tableOption"
:key="idx"
:type="j.type"
size="mini"
>{{j.name}}</el-button>
</template> -->
<template slot-scope="scope">
<slot
name="table-button"
:scope="scope.row"
></slot>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="!tableParams.hasPage && hasPage"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageNumber"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:total="getListApi ? total : tableTotal"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
</div>
</template>
<script>
export default {
name: 'basic-table',
data() {
return {
loading: false,
oldValue: {},
data: [],
page: {
pageSize: 10,
pageNumber: 1
},
total: 10,
// 排序
sortColum: '',
sort: '',
// pagination: {},
// 多选数组
mutiSelectArr: {}
}
},
props: {
// 搜索条件
searchForm: {
type: Object,
default: () => { }
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => [
// {
// id: 1,
// account: '胡悦',
// username: 'jkjk',
// departmentName: '平台研发中心',
// phoneNumber: '1546861321',
// enablesStatus: 1,
// createDate: '2013556'
// }
]
},
tableTotal: {
type: Number,
default: 10
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 搜索前操作
beforeSearchFn: {
type: Function,
default: () => {
return new Promise((resolve, reject) => {
resolve()
})
}
},
// 分页,默认有
hasPage: {
type: Boolean,
default: true
},
// 序号,默认有
hasNum: {
type: Boolean,
default: true
},
tableParams: {
type: Object,
default: () => {
return {
// 多选-判断来自哪个页面
// mutiSelectName: {
// type: String,
// default: ''
// },
// 多选-唯一标识
// mutiSelectUniqueKey: {
// type: String,
// default: ''
// },
// 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// btnId: {
// type: String,
// default: ''
// },
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// tag: {
// type: Array,
// default: () => []
// },
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
}
},
watch: {
},
mounted() {
const btn = document.getElementById(this.tableParams.btnId)
// this.tableData = [
// {
// id: 1,
// account: '胡悦',
// username: 'jkjk',
// departmentName: '平台研发中心',
// phoneNumber: '1546861321',
// enablesStatus: 1,
// createDate: '2013556'
// }
// ]
btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable()
},
methods: {
// 排序
sortChange({ column, prop, order }) {
this.sortColum = order ? prop : ''
this.sort = order
this.refreshTable()
},
// 多选
handleSelect(val) {
this.mutiSelectArr[this.tableParams.mutiSelectName] = val
},
// 清空多选
clearMutiSelect() {
this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
},
// 发布事件,以期查询条件改变后,页面图表需要刷新
refreshEmit() {
this.$emit('searchChange')
this.refreshTable(true, true)
},
refreshTable(clearMuti = true, resetCurrentPage = false) {
this.beforeSearchFn().then(res => {
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
console.log(this.searchForm)
resetCurrentPage && (this.page.pageNumber = 1)
var params = {
...this.page,
...this.searchForm
}
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
var data = res.data
this.data = data[this.tableParams.listName]
this.total = data.totalElements
this.loading = false
}).catch(() => {
this.loading = false
})
})
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
},
handleCurrentChange(value) {
this.page.pageNumber = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
}
}
}
</script>
<style>
.el-table thead {
color: #909399;
font-weight: 500;
}
</style>
<template>
<div class="dialog_page">
<el-dialog ref="glsxDialogCom" :title="title" :visible.sync="show" :width="width" :append-to-body="appendtobody" :show-close="showClose" custom-class="glsx_dialog" :close-on-press-escape="false" :close-on-click-modal="false" @close="onCancel" @opened="onDialogOpened">
<div slot="title" class="test" v-if="slotInfo.title">
<slot name="title" />
</div>
<div class="dialog_content">
<slot />
</div>
<div class="dialog_footer" v-show="hasFooter">
<slot name="footer"></slot>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "GlsxDialog",
props: {
show: {
type: Boolean,
default: false,
},
title: {
type: String,
default: "提示",
},
width: {
type: String,
default: "46%",
},
cancel: {
required: false,
type: Function,
},
confirm: {
required: false,
type: Function,
},
usefooter: {
required: false,
type: Boolean,
default: false,
},
appendtobody: {
required: false,
type: Boolean,
default: false,
},
value: {
type: Boolean,
default: false,
},
showClose: {
required: false,
type: Boolean,
default: true,
},
},
data() {
return {
hasFooter: false,
hasTitle: false,
slotInfo: {},
};
},
created() {
let o = this.$slots;
this.hasFooter = o.footer;
this.hasTitle = o.title;
this.slotInfo = o;
},
mounted: function () {
//this.$refs.glsxDialogCom.rendered = true;
},
methods: {
/**
* 取消关闭弹框
*/
onCancel: function () {
// 兼容以前的页面
this.$emit("close");
//this.$emit("input", false);
},
/**
* 确定
*/
onConfirm: function () {},
//
onDialogOpened() {},
},
};
</script>
<style lang="scss">
.glsx_dialog {
.el-dialog__header {
border-bottom: 1px solid #ddd !important;
padding-top: 10px;
font-size: 14px;
}
.el-dialog__headerbtn {
top: 10px;
right: 10px;
}
.el-dialog__body {
padding: 0;
}
.el-dialog__footer {
border-top: 1px solid #ddd;
}
}
</style>
<style lang="scss" scoped>
.dialog_content {
max-height: 600px;
overflow-y: auto;
padding: 20px;
}
.dialog_footer {
padding: 10px 15px;
border-top: 1px solid #e1e1e1;
text-align: right;
}
</style>
<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 { getOrgTree } from "services/common";
import { showToast } from "@/utils/util";
export default {
name: "GlsxOrganization",
props: {
isLast: {
type: Boolean,
default: false,
},
},
data() {
return {
filterText: "",
filterTextData: this.$store.state.organizationTree,
_timeout: "",
loading: false,
};
},
mounted() {
let o = this.$store.state.organizationTree;
if (!o || o.length <= 0) {
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 (this.isLast) {
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() {
getOrgTree({ hasUserLeaf: true }).then((res) => {
const { data } = res;
this.filterTextData = data || [];
this.$store.commit("updateOrganizationTree", 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
import Vue from 'vue'
// 注意 有些组件使用异步加载会有影响
Vue.component('basic-table', () => import('./basic-table/index.vue'))
Vue.component('search-form', () => import('./search-form/index.vue'))
Vue.component('sticky-table', () => import('./sticky-table/index.vue'))
Vue.component('basic-dialog', () => import('./basic-dialog/index.vue'))
Vue.component('rule-form', () => import('./rule-form/index.vue'))
<template>
<div>
<el-input placeholder="请输入内容" v-model="plateNo" maxlength="6" @input="onInput" :disabled="disabled">
<template slot="prepend">
<el-popover v-model="showPopover" ref="popover" placement="bottom-start" width="490" trigger="click" :disabled="disabled">
<div>
<div class="province-select">
<el-tag class="el_tag" v-for="item in provinceArr" :key="item" :effect="plateProvince==item ?'dark':'light'" :type="plateProvince==item?'primary':'info'" @click="selectProvince(item)">{{ item }}</el-tag>
</div>
<div class="no-select">
<el-tag class="el_tag" v-for="item in letterArr" :key="item" :effect="plateLetter==item ?'dark':'light'" :type="plateLetter==item?'primary':'info'" @click="selectLetter(item)">{{ item }}</el-tag>
</div>
</div>
<template slot="reference">
<div class="plate_show">
<span class="plate_name" v-if="!plateProvince && !plateLetter">请选择</span>
<span class="plate_name">{{plateProvince}}</span>
<span class="plate_name">{{plateLetter}}</span>
<i :class="showPopover?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
</div>
</template>
</el-popover>
</template>
</el-input>
</div>
</template>
<script>
export default {
name: "PlateNumberInput",
props: {
value: {
type: String,
default: "",
},
disabled: {
type: Boolean,
default: false,
},
},
model: {
prop: "",
},
data() {
return {
provinceArr: [
"粤",
"京",
"沪",
"闽",
"川",
"辽",
"皖",
"苏",
"鄂",
"晋",
"吉",
"冀",
"宁",
"豫",
"黑",
"鲁",
"浙",
"桂",
"蒙",
"渝",
"津",
"云",
"湘",
"新",
"赣",
"甘",
"陕",
"贵",
"青",
"藏",
"琼",
],
letterArr: [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
],
showPopover: false,
plateNo: "",
plateProvince: "",
plateLetter: "",
};
},
watch: {
value: {
handler: function (n, o) {
console.log(n);
this.value = n;
if (!n) {
this.plateNo = "";
this.plateProvince = "";
this.plateLetter = "";
}
if (n) {
this.plateProvince = n.substr(0, 1);
this.plateLetter = n.substr(1, 1);
this.plateNo = n.substr(2, n.length - 2);
}
},
},
},
created() {
console.log(this.disabled)
},
methods: {
// 选择省份
selectProvince(e) {
this.plateProvince = e;
this.toParent();
},
// 选择字母
selectLetter(e) {
this.plateLetter = e;
this.toParent();
},
// 监听输入
onInput(e) {
this.toParent();
},
// 传递参数给父组件
toParent() {
let plate = `${this.plateProvince || ""}${this.plateLetter || ""}${
this.plateNo || ""
}`;
this.$emit("input", plate);
},
// 打开键盘
openKeyboard() {
console.log(this.disabled);
if (this.disabled) {
return false;
}
this.showPopover = !this.showPopover;
},
},
};
</script>
<style lang="scss" scoped>
.el_tag {
cursor: pointer;
margin: 4px;
}
.plate_show {
cursor: pointer;
}
.plate_name {
margin: 0 2px 0 0;
}
</style>
\ No newline at end of file
<template>
<div>
<el-form
:model="ruleForm"
:rules="rules"
:label-position="labelPosition"
:label-width="labelWidth"
:size="size"
>
<el-form-item
v-for="(item, index) in ruleData"
:key="index"
:label="item.label"
:prop="item.prop || ''"
:class="item.class"
v-show="!item.hidden"
>
<template slot-scope="scope">
<template v-if="item.type === 'input'">
<el-input
v-if="item.clickFunc"
:type="item.inputText || 'text'"
:readonly="item.readonly || false"
@click.native="item.clickFunc"
:class="item.clickFunc ? 'pointer' : ''"
:ref="item.ref"
v-model="ruleForm[item.prop]"
@input="update($event)"
>
</el-input>
<el-input
v-else
:type="item.inputText || 'text'"
:readonly="item.readonly || false"
:disabled="item.disabled || false"
v-model="ruleForm[item.prop]"
:maxlength="item.maxlength"
:minlength="item.minlength"
:show-password="item.showPassword || false"
:clearable="item.clearable"
:show-word-limit="item.showWordLimit || false"
>
</el-input>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-if="item.visibleFunc"
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
:filterable="item.filterable || false"
@change="selectChange"
@visible-change="item.visibleFunc"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
<el-select
v-else
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
:filterable="item.filterable || false"
@change="selectChange"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
</template>
<template v-else-if="item.type === 'switch'">
<el-switch
v-model="ruleForm[item.prop]"
:active-text="item.activeText || '开'"
:inactive-text="item.inactiveText || '关'"
></el-switch>
</template>
<template v-else-if="item.type === 'radio'">
<el-radio-group
@change="radioChange($event, item.prop)"
v-model="ruleForm[item.prop]"
:disabled="item.disabled"
>
{{ ruleForm[item.prop] }}
<el-radio
v-for="(child, childIndex) in item.children"
:key="childIndex"
:label="childIndex"
>{{ child }}</el-radio
>
</el-radio-group>
<el-select
v-if="item.hasSelect"
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
@change="selectChange"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
</template>
<template v-else-if="item.type == 'customize'">
<slot :scope="scope" :name="item.slotName"> </slot>
</template>
</template>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: "rule-form",
data() {
return {
// labelPosition: 'left'
};
},
props: {
// 表单数据
ruleData: {
type: Array,
default: () => {
return [];
},
},
// 表单model
ruleForm: {
type: Object,
default: () => {
return {};
},
},
// 表单验证规则
rules: {
type: Object,
default: () => {
return {};
},
},
// 标签位置
labelPosition: {
type: String,
default: "right",
},
size: {
type: String,
default: "small",
},
labelWidth: {
type: String,
default: "100px",
},
},
mounted() {},
methods: {
selectChange(val) {
this.$emit("selectChange", val);
},
radioChange(event, prop) {
this.$emit("radioChange", event, prop);
},
update(e) {
this.$forceUpdate();
},
},
};
</script>
<style lang="scss">
.pointer input {
cursor: pointer;
}
</style>
\ No newline at end of file
<template>
<div>
<el-form
class="clearfix search-form"
:model="formModel"
:size="size"
@submit.native.prevent
>
<el-form-item
v-for="(item, index) in formList"
:key="index"
:label="item.label || ''"
>
<template>
<template v-if="item.type === 'input'">
<el-input
v-model="formModel[item.prop]"
:type="item.inputType || 'text'"
:placeholder="item.placeholder || '请输入'"
:readonly="item.readonly || false"
@keyup.enter.native="onInput"
></el-input>
</template>
<template v-else-if="item.type === 'select'">
<el-select
v-model="formModel[item.prop]"
:placeholder="item.placeholder || '请选择'"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
</template>
<template v-else-if="item.type === 'daterange'">
<el-date-picker
v-model="formModel[item.prop]"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:picker-options="item.pickerOptions || {}"
>
</el-date-picker>
</template>
</template>
</el-form-item>
<el-form-item>
<template>
<slot name="form-slot">
</slot>
</template>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'search-form',
props: {
formModel: {
type: Object,
default: () => { }
},
size: {
type: String,
default: 'small'
},
formList: {
type: Array,
default: () => []
}
},
methods:{
onInput(e){
this.$emit('input',e)
}
}
}
</script>
<style lang="scss">
.search-form {
padding: 18px 18px 0;
.el-form-item {
display: inline-block;
// float: left;
width: calc(50% - 20px);
max-width: 420px;
margin-right: 18px;
}
.el-form-item__content {
width: 100%;
}
}
</style>
\ No newline at end of file
<template>
<div>
<basic-table
class="head-table"
v-show="showHead"
ref="headTable"
:tableParams="headTableParams"
>
</basic-table>
<basic-table
ref="addStoreTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
</basic-table>
</div>
</template>
<script>
export default {
name: 'sticky-table',
props: {
tableParams: {
type: Object,
default: () => {
return {
// 多选-判断来自哪个页面
// mutiSelectName: {
// type: String,
// default: ''
// },
// 多选-唯一标识
// mutiSelectUniqueKey: {
// type: String,
// default: ''
// },
// 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// btnId: {
// type: String,
// default: ''
// },
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// tag: {
// type: Array,
// default: () => []
// },
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
},
headTableParams: {
type: Object
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 搜索条件
searchForm: {
type: Object,
default: () => { }
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => []
},
tableTotal: {
type: Number,
default: 10
}
},
data() {
return {
showHead: false,
scrollTop: 0,
headTableHeight: 0,
tableOffset: {
top: 0,
height: 0
}
}
},
watch: {
scrollTop(val, oldVal) {
if (val > this.tableOffset.top - this.headTableHeight) {
this.showHead = true
} else {
this.showHead = false
}
}
},
mounted() {
window.addEventListener('scroll', () => {
this.scrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
// console.log(this.scrollTop)
})
setTimeout(() => {
this.$refs.headTable.$children[0].bodyWrapper.setAttribute('style', 'display: none')
console.log(this.$refs.addStoreTable, this.$refs.addStoreTable.$el.offsetTop)
this.tableOffset.top = this.$refs.addStoreTable.$el.offsetTop
this.tableOffset.height = this.$refs.addStoreTable.$el.offsetHeight
this.headTableHeight = this.$refs.headTable.$el.offsetHeight
}, 1000)
}
}
</script>
<style scoped>
.head-table {
position: sticky;
top: 0;
z-index: 1;
}
</style>
\ No newline at end of file
// import store from '@/store/index'
// let BASE_URL = store.state.baseURL
// const MOCK_CONFIG_URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
// const env = process.env.NODE_ENV
// https://oss-config.test.glsx.com.cn/mock/5f8fda237ec90706c0f89d05/service
// http://192.168.0.63:8880
const API = {
getMockConfig() {
return MOCK_CONFIG_URL + '/test_config'
},
LOGIN_ACTION: '/login_action'
}
const USER_API = {
USER_SEARCH: '/usercenter/user/search',
USER_SUPER: '/usercenter/user/suitableSuperUsers',
USER_ADD: '/usercenter/user/add',
USER_EDIT: '/usercenter/user/edit',
USER_INFO: '/usercenter/user/info',
USER_DELETE: '/usercenter/user/delete',
ROLE_SIMPLELIST: '/usercenter/role/simplelist'
}
const VEHICLETYPE_API={
VEHICLETYPE_SEARCH:'/trialdrive/vehicle/tenanttypes/search',
TENANT_SIMPLELIST: '/usercenter/tenant/simplelist',
MENU_TREE:'/trialdrive/vehicle/brandseries',
MENU_TREE_ONE:'/vehicle/brands',
MENU_TREE_TWO:'/vehicle/subbrands',
MENU_TREE_THREE:'/vehicle/series',
VEHICLETYPE_TYPES:'/trialdrive/vehicle/types',
VEHICLETYPE_ADD:'/trialdrive/vehicle/savetypes',
VEHICLETYPE_EDIT:'/trialdrive/vehicle/gettenanttypes',
VEHICLETYPE_DELETE:'/trialdrive/vehicle/tenanttypes/delete',
VEHICLETYPE_INFO:'/trialdrive/vehicle/gettenanttypes'
}
const ROLE_API = {
ROLE_SEARCH: '/usercenter/role/search',
ROLE_INFO: '/usercenter/role/info',
TENANT_SIMPLELIST: '/usercenter/tenant/simplelist',
ROLE_ADD: '/usercenter/role/add',
ROLE_EDIT: '/usercenter/role/edit',
ROLE_DELETE: '/usercenter/role/delete',
MENU_TREE: '/usercenter/menu/checkedtree',
ROLE_VISIBILITY: '/usercenter/role/visibility',
ROLE_PERMISSION: '/usercenter/tenant/rolepermission'
}
const MENU_API = {
MENU_SEARCH: '/usercenter/menu/search',
MENU_CHILDREN: '/usercenter/menu/children',
MENU_ADD: '/usercenter/menu/add',
MENU_EDIT: '/usercenter/menu/edit',
MENU_DELETE: '/usercenter/menu/delete',
MENU_INFO: '/usercenter/menu/info',
MENU_PERMTREE: '/usercenter/menu/permtree'
}
const ORGINIZA_API = {
ORGINIZA_SEARCH: '/usercenter/organization/search',
ORGINIZA_CHILDREN: '/usercenter/organization/children',
ORGINIZA_SIMPLElIST: '/usercenter/organization/simplelist',
ORGINIZA_TREEORY: '/usercenter/organization/orgtree',
ORGINIZA_ADD: '/usercenter/organization/add',
ORGINIZA_EDIT: '/usercenter/organization/edit',
ORGINIZA_DELETE: '/usercenter/organization/delete',
ORGINIZA_INFO: '/usercenter/organization/info'
}
const DICT_API = {
DICT_SEARCH: '/publiccenter/dict/type/search',
DICT_ADD: '/publiccenter/dict/type/add',
DICT_EDIT: '/publiccenter/dict/type/edit',
DICT_DELETE: '/publiccenter/dict/type/delete',
DICTDATA_SEARCH: '/publiccenter/dict/data/search',
DICTDATA_EXPORT: '/publiccenter/dict/data/export',
DICTDATA_ADD: '/publiccenter/dict/data/add',
DICTDATA_EDIT: '/publiccenter/dict/data/edit',
DICTDATA_DELETE: '/publiccenter/dict/data/delete',
DICTDATA_TYPE: '/publiccenter/dict/data/type'
}
const WORKLOG_API = {
WORKLOG_SEARCH: '/loggincenter/loggin/search',
WORKLOG_EXPORT: '/loggincenter/loggin/export'
}
export { API, USER_API,VEHICLETYPE_API, ROLE_API, ORGINIZA_API, DICT_API, WORKLOG_API, MENU_API }
function emptyAction() {
// 警告:提示当前使用的是空 Action
console.warn("Current execute action is empty!");
}
class Actions {
// 默认值为空 Action
actions = {
onGlobalStateChange: emptyAction,
setGlobalState: emptyAction
};
/**
* 设置 actions
*/
setActions(actions) {
this.actions = actions;
}
/**
* 映射
*/
onGlobalStateChange(...args) {
return this.actions.onGlobalStateChange(...args);
}
/**
* 映射
*/
setGlobalState(...args) {
return this.actions.setGlobalState(...args);
}
}
const actions = new Actions();
export default actions;
\ No newline at end of file
if (window.__POWERED_BY_QIANKUN__) {
// 动态设置 webpack publicPath,防止资源加载出错
// eslint-disable-next-line no-undef
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
}
\ No newline at end of file
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueRouter from "vue-router";
import App from './App.vue'
import routes from "./routes";
import store from './store'
import '@/styles/index.scss'
import '@/components'
import './core/public-path';
import { Common } from '@/utils/common.js'
import Constants from '@/utils/constants.js'
import actions from '@/core/actions';
import GlsxDialog from "@/components/dialog";
import GlMapSdk from "@/utils/glsk-mapapi-sdk";
console.log(GlMapSdk);
// import axios from 'axios'
Vue.component('glsx-dialog', GlsxDialog)
Vue.prototype.btn_size = 'mini'
Vue.prototype.$Common = Common
Vue.prototype.$Constants = Constants
Vue.use(VueRouter);
Vue.use(ElementUI)
Vue.config.productionTip = false;
Vue.prototype.mapapi = new GlMapSdk()
let router = null;
let instance = null;
function render({ data = {}, container } = {}) {
router = new VueRouter({
base: window.__POWERED_BY_QIANKUN__ ? '/system' : '/',
routes,
});
console.log(data)
store.state.baseURL = data.baseURL;
instance = new Vue({
router,
store,
data() {
return {
parentRouter: data.router,
parentVuex: data.store,
parentCommon: data.common
}
},
render: h => h(App),
}).$mount(container ? container.querySelector('#glsx-sub-system') : '#glsx-sub-system');
}
if (!window.__POWERED_BY_QIANKUN__) {
render();
}
export async function bootstrap() {
console.log('vue app bootstraped');
}
export async function mount(props) {
console.log('props from main framework', props.data);
actions.setActions(props);
render(props);
props.setGlobalState({
})
}
export async function unmount() {
instance.$destroy();
instance.$el.innerHTML = "";
instance = null;
router = null;
}
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'user',
meta: { title: '用户管理' },
component: () => import('../views/user/index.vue')
},
{
path: '/user',
name: 'user',
meta: { title: '用户管理' },
component: () => import('../views/user/index.vue')
},
{
path: '/role',
name: 'role',
meta: { title: '角色管理' },
component: () => import('../views/role/index.vue')
},
{
path: '/vehicleTypeManage',
name: 'vehicleTypeManage',
meta: { title: '车型管理' },
keepAlive:false,
component: () => import('../views/vehicleTypeManage/index.vue')
},
{
path: '/vehicleTypeManage/vehicleAddUpadate',
name: 'vehicleAddUpadate',
meta: { title: '车型库' },
hidden:true,
keepAlive:false,
component: () => import('../views/vehicleTypeManage/vehicleAddUpadate.vue')
},
{
path: '/orginizaManage',
name: 'orginizaManage',
meta: { title: '组织管理' },
component: () => import('../views/orginizaManage/index.vue')
},
{
path: '/menuManage',
name: 'menuManage',
meta: { title: '菜单管理' },
component: () => import('../views/menuManage/index.vue')
},
{
path: '/dictionaryManage',
name: 'dictionaryManage',
meta: { title: '字典管理' },
component: () => import('../views/dictionaryManage/index.vue')
},
{
path: '/dictionaryManage/dictionaryData',
name: 'dictionaryData',
meta: {
title: '字典数据',
pushState: true
},
component: () => import('../views/dictionaryManage/dictionaryData/index.vue')
},
{
path: '/workLog',
name: 'workLog',
meta: { title: '操作日志' },
component: () => import('../views/workLog/index.vue')
},
{
path: '/home/index',
name: 'homeIndex',
meta: { title: '数据看板' },
component: () => import('../views/home/index.vue')
},
{
path: '/work/order',
name: 'workOrder',
meta: { title: '工单管理' },
component: () => import('../views/work/order.vue')
},
{
path: '/work/order/add',
name: 'workOrderAdd',
meta: { title: '新增工单' },
component: () => import('../views/work/add.vue')
}
]
export default routes
//import { COMMON_API } from '@/config/config'
import request from '@/services/request'
// // 获取用户列表
// function getProvinceList (params) {
// const url = COMMON_API.PROVINCE_LIST
// return request(params, url)
// }
// // 获取字典详情
// function dictInfo (params) {
// const url = `${COMMON_API.DICTDATA_TYPE}/${params}`
// return request({}, url)
// }
// // 获取第一级组织列表树
// function getSimpleRoot (params) {
// const url = COMMON_API.ORGINIZA_SIMPLEROOT
// return request(params, url)
// }
// // 获取组织列表树
// function getSimpleList (params) {
// const url = COMMON_API.ORGINIZA_SIMPLELIST
// return request(params, url)
// }
function getOrgTree(params) {
return request(params, '/usercenter/organization/orgtree')
}
export { getOrgTree }
import { DICT_API } from '@/config/config'
import request from '@/services/request'
// 字典列表
function getDictList (params) {
const url = DICT_API.DICT_SEARCH
return request(params, url)
}
// 新增字典
function addDict (params) {
const url = DICT_API.DICT_ADD
return request(params, url, 'post')
}
// 编辑字典
function editDict (params) {
const url = DICT_API.DICT_EDIT
return request(params, url, 'post')
}
// 删除字典
function deleteDict (params) {
const url = DICT_API.DICT_DELETE
return request(params, url)
}
// 字典数据列表
function getDictDataList (params) {
const url = DICT_API.DICTDATA_SEARCH
return request(params, url)
}
// 新增字典数据类型
function addDictData (params) {
const url = DICT_API.DICTDATA_ADD
return request(params, url, 'post')
}
// 编辑字典数据类型
function editDictData (params) {
const url = DICT_API.DICTDATA_EDIT
return request(params, url, 'post')
}
// 删除字典数据类型
function deleteDictData (params) {
const url = DICT_API.DICTDATA_DELETE
return request(params, url)
}
// 导出字典数据
function exportDictData (params) {
const url = DICT_API.DICTDATA_EXPORT
return request(params, url)
}
export { getDictList, addDict, editDict, deleteDict, getDictDataList, addDictData, editDictData, deleteDictData, exportDictData }
import request from "@/services/request";
// 首页-数据看板-获取统计数据
export const GET_HOME_DEVICENUMBER = (params) => {
return request(params, "/trialdrive/home/getdevicenumber");
};
// 首页-数据看板-获取警情统计数据
export const GET_HOME_ALARMNUMBER = (params) => {
return request(params, "/trialdrive/home/getalarmnumber");
};
// 首页-数据看板-获取设备激活趋势
export const GET_HOME_ACTIVEDEVICEINFO = (params) => {
return request(params, "/trialdrive/home/getactivedeviceinfo");
};
// 首页-数据看板-获取角色(判断是否为仲利)
export const GET_HOME_AUTHUSERORG = (params) => {
return request(params, "/trialdrive/home/authuserorg");
};
// 首页-数据看板-总绑定数图表
export const GET_HOME_NEWBINDDEVICEINFO = (params) => {
return request(params, "/trialdrive/home/getnewbinddeviceinfo");
};
// 首页-数据看板-获取围栏报警数量
export const GET_FENCE_ALARM = (params) => {
return request(params, "/alarmcenternew/fencealarm/getFenceAlarmCount");
};
import { MENU_API } from '@/config/config'
import request from '@/services/request'
// 获取菜单列表
function getMenuList (params) {
const url = MENU_API.MENU_SEARCH
return request(params, url)
}
// 根据菜单根节点获取子节点
function getMenuChildren (params) {
const url = MENU_API.MENU_CHILDREN
return request(params, url)
}
// 添加菜单
function addMenu (params) {
const url = MENU_API.MENU_ADD
return request(params, url, 'post')
}
// 编辑菜单
function editMenu (params) {
const url = MENU_API.MENU_EDIT
return request(params, url, 'post')
}
// 删除菜单
function deleteMenu (params) {
const url = MENU_API.MENU_DELETE
return request(params, url)
}
// 获取菜单列表
function menuInfo (params) {
const url = MENU_API.MENU_INFO
return request(params, url)
}
// 获取上级菜单
function getPermtree (params) {
const url = MENU_API.MENU_PERMTREE
return request(params, url)
}
export { getMenuList, getMenuChildren, addMenu, editMenu, menuInfo, deleteMenu, getPermtree }
import request from '@/services/request'
import store from '@/store'
// 工单管理-工单列表-获取列表
export const GET_WORKORDER_SEARCH = params => {
return request(params, '/trialdrive/workorder/search')
}
// 工单管理-工单列表-导出excel
export const GET_WORKORDER_EXPORT = '/trialdrive/workorder/export'
// 工单管理-工单列表-设备组合下拉列表接口
export const GET_DEVICE_COMPOSE = params => {
return request(params, '/trialdrive/device/compose')
}
// 工单管理-工单列表-新增工单
export const ADD_WORKORDER_INFO = params => {
return request(params, '/trialdrive/workorder/add', 'POST')
}
// 工单管理-工单列表-编辑工单
export const EDIT_WORKORDER_INFO = params => {
return request(params, '/trialdrive/workorder/edit', 'POST')
}
// 工单管理-工单列表-获取工单详情
export const GET_WORKORDER_INFO = params => {
return request(params, '/trialdrive/workorder/info')
}
// 工单管理-工单列表-验证工单设备有效位置接口
export const VERIFY_WORKORDER_INFO = params => {
return request(params, '/trialdrive/workorder/verify', 'POST')
}
// 工单管理-工单列表-激活工单接口
export const ACTIVATE_WORKORDER_INFO = params => {
return request(params, '/trialdrive/workorder/activate', 'POST')
}
// 工单管理-工单列表-新增工单-新增车辆-获取车型数据
export const GET_VEHICLE_SELECTEDTYPETREE = params => {
return request(params, '/trialdrive/vehicle/getSelectedTypeTree')
}
// 工单管理-工单列表-图片打包下载
//export const GET_WORKORDER_BATCHEXPORTPICS = "/trialdrive/workorder/batchExportPics";
export const GET_WORKORDER_BATCHEXPORTPICS = params => {
return request(params, '/trialdrive/workorder/batchExportPics')
}
// 工单管理-工单列表-导入工单-模板下载
export const GET_WORKORDER_TEMPLATEFILE = 'https://img01.glsx.com.cn/weapp/resource/e-shield/新E盾工单导入模板.xlsx'
// 工单管理-工单列表-导入工单
export const IMPORT_WORKORDER_FILES = store.state.baseURL + '/trialdrive/workorder/import'
// 工单管理-工单列表-激活工单-校验SN号
export const VERIFY_DEVICE_INFO = params => {
return request(params, '/trialdrive/vehicle/vehicleinfo/verifydevice')
}
// 工单管理-工单列表-激活工单-获取设备型号
export const GET_CLASSIFYNAME_INFO = params => {
return request(params, '/trialdrive/vehicle/vehicleinfo/getclassifynamebysn')
}
// 工单管理-工单列表-工单详情-获取工单日志列表
export const GET_WORKORDER_OPERLOG = params => {
return request(params, '/trialdrive/workorder/operlog')
}
// 工单管理-工单列表-获取工单状态
export const GET_WORKORDER_STATUSOPTION = params => {
return request(params, '/trialdrive/workorder/status/option')
}
// 工单管理-工单列表-工单详情-获取工单进度列表
export const GET_WORKORDER_PROGRESS = params => {
return request(params, '/trialdrive/workorder/getProgress')
}
// 工单管理-工单列表-工单详情-删除存量图片
export const DELETE_ORDER_IMAGE = params => {
return request(params, '/trialdrive/workorder/deleteImage')
}
// 工单管理-工单列表-工单详情-单独更新图片信息
export const UPDATE_ORDER_IMAGE = params => {
return request(params, '/trialdrive/workorder/updateImage', 'POST')
}
// 工单管理-工单列表-删除工单
export const DELETE_ORDER_INFO = params => {
return request(params, '/trialdrive/workorder/delete')
}
// 工单管理-工单列表-关联车辆-根据车架号获取车辆列表
export const GET_VEHICLE_LIST_BY_VIN = params => {
return request(params, '/trialdrive/workorder/getLinkVehicleList')
}
// 工单管理-工单列表-关联车辆-保存数据
export const SAVE_RELINKVEHICLE_INFO = params => {
return request(params, '/trialdrive/workorder/reLinkVehicle', 'POST')
}
// 工单管理-工单列表-关联车辆-校验车架号
export const CHECK_WORKORDER_VERIFYDUPLICATEVIM = params => {
return request(params, '/trialdrive/workorder/verifyDuplicateVim')
}
// 工单管理-工单列表-工单重推
export const REPUSH_TO_BHG = params => {
return request(params, '/trialdrive/workorder/repushToBhg')
}
import { ORGINIZA_API } from '@/config/config'
import request from '@/services/request'
// 获取组织列表
function getTableList(params) {
const url = ORGINIZA_API.ORGINIZA_SEARCH
return request(params, url)
}
// 根据根节点,获取子节点列表
function getChildren(params) {
const url = ORGINIZA_API.ORGINIZA_CHILDREN
return request(params, url)
}
// 获取组织列表树
function getSimpleList(params) {
const url = ORGINIZA_API.ORGINIZA_SIMPLElIST
return request(params, url)
}
// 组织架构
function getTreeOrg(params) {
const url = ORGINIZA_API.ORGINIZA_TREEORY
return request(params, url)
}
// 添加组织
function addOrganiza(params) {
const url = ORGINIZA_API.ORGINIZA_ADD
return request(params, url, 'post')
}
// 编辑组织
function editOrganiza(params) {
const url = ORGINIZA_API.ORGINIZA_EDIT
return request(params, url, 'post')
}
// 删除组织
function deleteOrganiza(params) {
const url = ORGINIZA_API.ORGINIZA_DELETE
return request(params, url)
}
// 组织详情
function organizaInfo(params) {
const url = ORGINIZA_API.ORGINIZA_INFO
return request(params, url)
}
// 获取组织架构
export const GET_ORIGINIZATION_LIST = params => {
return request(params, ORGINIZA_API.ORGINIZA_TREEORY);
}
export { getTableList, getChildren, getSimpleList, getTreeOrg, addOrganiza, editOrganiza, deleteOrganiza, organizaInfo }
import HTTP from '@/utils/http'
const axiosHttp = new HTTP()
function request (data = {} , url, method = 'GET') {
return new Promise((resolve, reject) => {
var reqMethod = method.toLocaleLowerCase() === 'get' ? 'axiosGet' : 'axiosPost'
axiosHttp[reqMethod]({
url: url,
data: data,
success(data) {
resolve(data)
},
error(error) {
reject(error)
}
})
})
}
export default request
import { ROLE_API } from '@/config/config'
import request from '@/services/request'
// 获取用户列表
function getRoleList (params) {
const url = ROLE_API.ROLE_SEARCH
return request(params, url)
}
// 获取用户详情
function roleInfo (params) {
const url = ROLE_API.ROLE_INFO
return request(params, url)
}
// 获取租户列表
function getTenantList (params) {
const url = ROLE_API.TENANT_SIMPLELIST
return request(params, url)
}
// 获取用户列表
function addRole (params) {
const url = ROLE_API.ROLE_ADD
return request(params, url, 'post')
}
// 获取用户列表
function editRole (params) {
const url = ROLE_API.ROLE_EDIT
return request(params, url, 'post')
}
// 获取用户列表
function deleteRole (params) {
const url = ROLE_API.ROLE_DELETE
return request(params, url)
}
// 获取菜单权限
function getMenuTree (params) {
const url = ROLE_API.MENU_TREE
return request(params, url)
}
// 角色可见度接口
function getVisibility (params) {
const url = ROLE_API.ROLE_VISIBILITY
return request(params, url)
}
// 数据权限租户列表接口
function getPermission (params) {
const url = ROLE_API.ROLE_PERMISSION
return request(params, url)
}
export { getRoleList, roleInfo, getTenantList, addRole, editRole, deleteRole, getMenuTree, getVisibility, getPermission }
import { USER_API, DICT_API } from '@/config/config'
import request from '@/services/request'
// 获取用户列表
function getUserList (params) {
const url = USER_API.USER_SEARCH
return request(params, url)
}
// 获取上级树
function getSuperUser (params) {
const url = USER_API.USER_SUPER
return request(params, url)
}
// 新增用户
function addUser (params) {
const url = USER_API.USER_ADD
return request(params, url, 'post')
}
// 编辑用户
function editUser (params) {
const url = USER_API.USER_EDIT
return request(params, url, 'post')
}
// 用户详情
function detailUser (params) {
const url = USER_API.USER_INFO
return request(params, url)
}
// 删除用户
function deleteUser (params) {
const url = USER_API.USER_DELETE
return request(params, url)
}
// 下拉角色列表
function roleList (params) {
const url = USER_API.ROLE_SIMPLELIST
return request(params, url)
}
// 字典
function dictInfo (params) {
const url = `${DICT_API.DICTDATA_TYPE}/${params}`
return request({}, url)
}
function resetPassword(params) {
return request(params, '/usercenter/user/resetPassword')
}
// 获取车辆树列表
export const GET_VEHICLE_TREE = params => {
return request(params,'/trialdrive/vehicle/tree')
}
// 获取车辆树列表-查询用户下面的车辆
export const GET_USER_VEHICLE_LIST = params => {
return request(params,'/trialdrive/vehicle/uvlist')
}
// 获取车辆树列表-查询组织下面的车辆
export const GET_ORGANIZATION_VEHICLE_LIST = params => {
return request(params,'/trialdrive/vehicle/ovlist')
}
// 用户管理-指定数据-保存数据
export const SAVE_USER_ASSIGN_INFO = params => {
return request(params,'/trialdrive/vehicle/permit/assign','post')
}
// 用户管理-指定数据-获取用户指定数据
export const GET_USER_ASSIGN_INFO = params => {
return request(params,'/trialdrive/vehicle/permit/assigndetails')
}
// 用户管理-指定数据-按组织授权-获取详情
export const GET_ORGZ_ASSIGN_INFO = params => {
return request(params,'/trialdrive/vehicle/orgz/assigndetails')
}
// 用户管理-指定数据-按组织授权-保存数据
export const SAVE_ORGZ_ASSIGN_INFO = params => {
return request(params,'/trialdrive/vehicle/orgz/assign','POST')
}
// 用户管理-指定数据-文件导入接口
export const IMPORT_VEHICLE_TEMPLATE = '/trialdrive/vehicle/permit/import'
// 用户管理-指定数据-文件导入-模板下载
export const DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE = params => {
return request(params,'/publiccenter/dict/data/type/excelTemplate/assignPermit')
}
// 用户管理-删除用户-查询用户是否绑定车辆
export const JUDGE_USER_BINDVEHICLE = params => {
return request(params,'/trialdrive/data/sniff','POST')
}
// 重置用户uuid
export const REST_USER_UUID = params => {
return request(params,'/usercenter/user/resetUID')
}
export { getUserList, getSuperUser, addUser, editUser, detailUser, deleteUser, roleList, dictInfo, resetPassword}
import { VEHICLETYPE_API } from '@/config/config'
import request from '@/services/request'
// 获取车型管理列表
function getTableList(params) {
const url = VEHICLETYPE_API.VEHICLETYPE_SEARCH
return request(params, url)
}
// 获取租户列表
function getTenantList(params) {
const url = VEHICLETYPE_API.TENANT_SIMPLELIST
return request(params, url)
}
// 获取菜单权限
function getMenuTree(params) {
const url = VEHICLETYPE_API.MENU_TREE
return request(params, url)
}
//1层
function getMenuTreeFirst(params) {
const url = VEHICLETYPE_API.MENU_TREE_ONE
return request(params, url)
}
//2层
function getMenuTreeSecond(params) {
const url = VEHICLETYPE_API.MENU_TREE_TWO
return request(params, url)
}
//3层
function getMenuTreeThird(params) {
const url = VEHICLETYPE_API.MENU_TREE_THREE
return request(params, url)
}
//获取菜单的叶子节点(车型)
function geMenuTreeLeaf(params) {
const url = VEHICLETYPE_API.VEHICLETYPE_TYPES
return request(params, url)
}
//新增车型接口
function addVehicleType(params) {
const url = VEHICLETYPE_API.VEHICLETYPE_ADD
return request(params, url, 'post')
}
// 获取车型库
function GETVEHICLEINFO(params) {
const url = VEHICLETYPE_API.VEHICLETYPE_INFO
return request(params, url)
}
//删除一条表数据
function delelteTableRowData(params) {
const url = VEHICLETYPE_API.VEHICLETYPE_DELETE
return request(params, url)
}
//获取编辑的接口,获取页面信息
function editVehicleType(params) {
const url = VEHICLETYPE_API.VEHICLETYPE_EDIT
return request(params, url)
}
export { getTableList, getTenantList, getMenuTree, getMenuTreeFirst, getMenuTreeSecond,getMenuTreeThird, geMenuTreeLeaf, addVehicleType, GETVEHICLEINFO,delelteTableRowData,editVehicleType}
import { WORKLOG_API } from '@/config/config'
import request from '@/services/request'
// 获取用户列表
function getWorkLogList (params) {
const url = WORKLOG_API.WORKLOG_SEARCH
return request(params, url)
}
// 导出日志
function exportWorkLog (params) {
const url = WORKLOG_API.WORKLOG_EXPORT
return request(params, url)
}
export { getWorkLogList, exportWorkLog }
const getters = {
// 获取车型数据
getTreeData:state => {
let arr = state.vehicleTree;
//let n = localStorage.getItem('carTree') ? JSON.parse(localStorage.getItem('carTree')) : []
let n = state.vehicleCarTree
if(!arr || arr.length<=0){
arr = n;
}
return arr;
},
}
export default getters;
\ No newline at end of file
import Vue from 'vue';
import Vuex from 'vuex';
import state from './state';
import mutations from './mutations';
import getters from './getter'
Vue.use(Vuex);
const store = new Vuex.Store({
state,
getters,
mutations
})
export default store;
\ No newline at end of file
import state from "./state";
export default {
//更新全局baseURL
updateBaseURL(state, newBaseURL) {
state.baseURL = newBaseURL;
},
// 更新车型数据
updateVehicleTree(state, list) {
state.vehicleTree = list;
},
// 更新车型数据
updateVehicleCarTree(state, list) {
state.vehicleCarTree = list;
},
// 更新定制后的车型数据
updateVehicleCustomTree(state, list) {
state.vehicleCustomTree = list;
},
// 更新设备组合数据
updateDeviceAssembly(state, list) {
state.deviceAssembly = list;
},
// 更新组织树数据
updateOrganizationTree(state, list) {
state.organizationTree = list;
},
// 更新用户组织树数据
updateUserOrganizationTree(state, list) {
state.userVehicleTree = list;
},
// 系统管理-用户管理-指定数据-按组织授权-更新组织树
updateTreeByOrganization(state,list){
state.organizationUserTree = list
}
};
const state = {
baseURL: '',
token: '', // 令牌
loginStatus: false, // 是否登录
userInfo: {
username: '', // 用户名
phoneNumber: '', // 手机号
tenantId: '', // 租户id
superiorId: '', // 上级id
account: '', // 登录名
email: '',
gender: '',
position: ''
},
vehicleTree:[], // 车形数据
vehicleCarTree:[],// 车型原始数据
vehicleCustomTree:[], // 新增工单-新增车辆-车型数据
deviceAssembly:[], // 新增工单-新增车辆-设备组合
organizationTree:[], // 组织树
userVehicleTree:[], // 用户管理-指定数据-组织树
organizationUserTree:[], // 用户管理-指定数据-按组织授权-树
}
try {
} catch(e) {}
export default state;
\ No newline at end of file
.add_work_page {
padding-bottom: 60px;
}
.head_title {
position: relative;
font-size: 18px;
font-weight: bold;
padding: 10px 0;
//margin-bottom: 30px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.mb30 {
margin-bottom: 30px;
}
.el_form_box {
display: flex;
flex-wrap: wrap;
.el-form-item {
flex: 0 0 50%;
padding-right: 30px;
box-sizing: border-box;
}
.long_form_item {
flex: 0 0 100%;
}
.el_date_picker {
margin-right: 10px;
}
}
// 提交按钮区域
.submit_box {
position: fixed;
bottom: 0;
right: 16px;
z-index: 10;
padding: 10px 24px;
display: flex;
align-items: center;
justify-content: flex-end;
background: #fff;
}
.city_box {
display: flex;
.el-form-item {
flex: 2;
padding-right: 0;
}
.cascader_item {
flex: 1;
padding-right: 4px;
.el_cascader {
width: 100%;
}
}
// .el_cascader {
// width:40%;
// margin-right:4px;
// }
}
.inline-b {
display: inline-block;
}
.pull-right {
float: right;
}
.table-btn {
margin-bottom: 20px;
}
.searchTop {
margin-bottom: 30px;
}
.border-shadow {
border: 1px solid rgb(235, 235, 235);
border-image: initial;
border-radius: 3px;
transition: all 0.2s ease 0s;
}
.border-shadow:hover {
box-shadow: rgba(232, 237, 250, 0.6) 0px 0px 8px 0px,
rgba(232, 237, 250, 0.5) 0px 2px 4px 0px;
}
.system-container {
// padding: 0 0 0 10px;
// margin: 20px 24px;
background-color: #ffffff;
overflow: hidden;
.user-tree {
margin-top: 20px;
padding: 10px;
// float: left;
display: inline-block;
width: 270px;
overflow-x: auto;
.el-tree {
font-size: 14px;
}
.user-tree-top {
height: 30px;
}
}
.container {
padding: 20px 10px 0px 20px;
width: 100%;
}
.user-container {
padding: 20px 10px 0px 20px;
// float: left;
display: inline-block;
vertical-align: top;
width: calc(100% - 270px);
}
}
.el-tree {
margin-top: 20px;
}
// 状态
.dot {
display: inline-block;
width: 7px;
height: 7px;
border-radius: 5px;
vertical-align: middle;
margin-right: 2px;
}
.green-text {
color: #00A854;
}
.red-text {
color: rgb(255, 0, 0);
}
.green {
background-color: #00A854;
}
.gray {
background-color: #BFBFBF;
}
.blue {
background-color: rgb(0, 81, 255);
}
.red {
background-color: rgb(255, 0, 0);
}
.yellow {
background-color: rgb(217, 255, 0);
}
.orange {
background-color: rgb(255, 145, 0);
}
.statusText {
vertical-align: middle;
}
\ No newline at end of file
.c_canvas {
width: 100%;
height: 100px;
}
.c_canvass {
width: 100px;
height: 134px;
}
.static_list_box {
display: flex;
align-items: center;
position: relative;
.mask {
position: absolute;
width: 100%;
height: 234px;
background-color: #fbfbfb;
top: 0;
z-index: 2;
display: flex;
align-items: center;
justify-content: center;
}
.cell_box {
flex: 1;
margin: 0 10px 0 0;
border: 1px solid #d8d8d8;
border-radius: 4px;
background: rgba($color: #d8d8d8, $alpha: 0.1);
.head {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
font-size: 14px;
color: #666;
font-weight: bold;
}
.head:after {
display: block;
content: "";
height: 1px;
background: #d8d8d8;
position: absolute;
left: 0;
right: 0;
bottom: 0;
transform: scaleY(0.5);
}
.info_box {
padding: 10px;
.title {
font-size: 30px;
color: #666;
}
.footer {
padding: 10px 0;
border-top: 2px solid #eee;
font-size: 13px;
display: flex;
.footer-box {
flex: 1;
}
}
.equipment_box {
display: flex;
.equipment_boxs {
display: flex;
flex: 1;
}
}
}
}
.cell_box:last-child {
margin: 0;
}
}
// 常规报警
.alarm_box {
margin: 20px 0;
background: #fff;
.head {
position: relative;
padding: 10px;
font-size: 14px;
color: #666;
font-weight: bold;
border: 1px solid #d8d8d8;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
display: flex;
align-items: center;
justify-content: space-between;
}
.alarm_list {
display: flex;
align-items: center;
padding: 10px 0;
.cell {
flex: 1;
margin: 0 20px 0 0;
border: 1px solid #d8d8d8;
border-radius: 4px;
background: rgba($color: #d8d8d8, $alpha: 0.1);
cursor: pointer;
.title {
display: flex;
align-items: center;
padding: 10px;
font-size: 12px;
font-weight: bold;
color: #666;
img {
width: 20px;
height: 20px;
margin-right: 10px;
}
}
.num {
font-size: 30px;
color: #666;
padding: 10px;
}
}
.cell:hover {
background: rgba($color: #2196f3, $alpha: 0.1);
border: 1px solid #2196f3;
}
.cell:last-child {
margin: 0;
}
}
}
// 设备激活趋势
.device_box {
border: 1px solid #d8d8d8;
border-radius: 4px;
.head {
border: 0;
}
.head:after {
display: block;
content: "";
height: 1px;
background: #d8d8d8;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
.chart_box {
padding: 20px 0;
.chart_wrapper {
width: 100%;
height: 300px;
}
}
}
.area_car{
position: fixed;
top:100px;
right:40px;
z-index:99;
cursor: pointer;
.img{
width:80px;
height: 80px;
}
}
\ No newline at end of file
@import './common.scss';
@import './reset.scss';
body {
overflow: hidden;
height: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
}
html {
height: 100%;
box-sizing: border-box;
}
#app {
height: 100%;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
hr {
height: 1px;
border: 0px;
background-color: #e7eaec
}
a,
a:focus,
a:hover {
cursor: pointer;
color: inherit;
outline: none;
text-decoration: none;
}
div:focus {
outline: none;
}
a:focus,
a:active {
outline: none;
}
a,
a:focus,
a:hover {
cursor: pointer;
color: inherit;
text-decoration: none;
}
.clearfix {
zoom: 1;
&:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
}
//main-container全局样式
.app-main {
overflow: auto;
}
.app-container {
padding: 20px;
}
\ No newline at end of file
.sort_select {
width: 120px;
}
.small_select {
width: 120px;
}
.long_input {
width: 300px;
}
.data_picker {
width: 240px;
}
.table_box {
margin: 10px 0;
}
.el_link {
margin: 0 4px;
}
.upload_box {
.input_box {
display: flex;
align-items: center;
.a_input {
margin-right: 10px;
width: 320px;
}
}
.tips {
font-size: 12px;
color: #999;
line-height: 2;
}
}
.dialog_links {
display: flex;
align-items: center;
justify-content: space-between;
}
.upload_result {
display: flex;
justify-content: center;
.cell {
position: relative;
width: 200px;
display: flex;
flex-direction: column;
text-align: center;
span {
line-height: 2;
}
.num {
font-size: 18px;
font-weight: bold;
color: #666;
}
.cred {
color: #f00;
}
}
.cell:after {
display: block;
content: "";
width: 1px;
background: #d8d8d8;
position: absolute;
top: 50%;
right: 0;
height: 70%;
transform: translateY(-50%);
opacity: 0.8;
}
.cell:last-child:after {
display: none;
}
}
.pre_select_box {
display: flex;
align-items: center;
.sort_select {
margin-right: 4px;
}
}
// 自定义弹框标题
.custom_title {
display: flex;
align-items: center;
justify-content: space-between;
.name {
font-size: 16px;
}
.dialog_menu {
display: flex;
align-items: center;
padding-right: 10px;
a {
padding: 10px;
margin:0 0 0 10px;
}
.active {
position: relative;
color: #409eff;
}
.active:after {
display: block;
content: "";
height: 2px;
background: #409eff;
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 80%;
}
}
}
/* 关联车辆 */
.car_info_box{
.cell{
display:flex;
align-items: center;
line-height:30px;
}
}
.btn_mini_size{
padding:2px 12px !important;
min-height: 24px;
}
\ No newline at end of file
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
background-color: #409EFF;
color: #ffffff;
}
.el-radio-group {
line-height: 32px;
vertical-align: text-top;
}
.el-select {
width: 100%;
}
\ No newline at end of file
import actions from '@/core/actions';
import Vue from 'vue';
import { Message } from 'element-ui';
import { debounce } from 'utils/tools';
const error = debounce((msg, getToken) => {
if(window.__POWERED_BY_QIANKUN__) {
let stateRes = {
errorMsg: msg,
showLoading: false
};
if(getToken === 'removeToken') {
stateRes.token = getToken;
localStorage.removeItem('token');
}
actions.setGlobalState(stateRes);
} else {
if(msg) {
Message({
message: msg,
type: 'error'
});
}
}
}, 1000, true);
const showLoading = (status) => {
if(window.__POWERED_BY_QIANKUN__) {
actions.setGlobalState({
token: localStorage.getItem('token') || '',
errorMsg: '',
showLoading: status
})
}
}
const checkStatus = (status, msg) => {
switch (status) {
case 400:
error(`Bad Request 错误的请求`);
break;
case 401:
error('用户没有权限(令牌、用户名、密码错误)!');
break;
case 403:
error('用户得到授权,但是访问是被禁止的。!');
break;
// 404请求不存在
case 404:
error('网络请求错误,未找到该资源!');
break;
case 405:
error('网络请求错误,请求方法未允许!');
break;
case 408:
error('网络请求超时!');
break;
case 500:
error('服务器错误,请联系管理员!');
break;
case 501:
error('网络未实现!');
break;
case 502:
error('网络错误!');
break;
case 503:
error('服务不可用,服务器暂时过载或维护!');
break;
case 504:
error('网络超时!');
break;
case 505:
error('http版本不支持该请求!');
break;
case 603:
error('尚未登录或登录已过期,请重新登录', 'removeToken');
break;
case 505:
error('http版本不支持该请求!');
break;
case 'fail':
error('网络连接错误');
break;
case 'custom':
error(`${msg}`);
break;
default:
}
}
export {
checkStatus,
showLoading
}
\ No newline at end of file
import axios from "axios";
export const Common = {
// 提示框
confirmDialog: (tipData) => {
tipData.that
.$confirm(tipData.tipText, tipData.tipTitle, {
confirmButtonText: tipData.confirmButtonText || "确定",
cancelButtonText: tipData.cancelButtonText || "取消",
type: tipData.type,
showCancelButton: tipData.showCancelButton,
})
.then(() => {
tipData.callBack ? tipData.callBack() : "";
})
.catch(() => {
tipData.errorCallBack ? tipData.errorCallBack() : "";
});
},
/**
* 导出excel
* */
exportExcel: function(options) {
if (!options) {
return false;
}
console.log(options.data);
axios({
method: options.method || "POST",
url: options.url,
params: options.data,
responseType: "blob",
headers: {
Authorization: localStorage.getItem("token") || "",
},
})
.then((response) => {
if (!response) {
return;
}
let url = window.URL.createObjectURL(
new Blob([response.data], {
type:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
})
);
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", options.fileName || "excel.xlsx");
document.body.appendChild(link);
link.click();
if (options.success) {
options.success();
}
})
.catch((error) => {
if (options.errorFunc) {
options.errorFunc(error);
}
});
},
/**
* 正整数
* */
checkRegExpNumber(rule, value, callback) {
var rxp = /^\+?[1-9][0-9]*$/;
if (!rule.required) {
if (!value) {
callback();
} else if (!rxp.test(value)) {
return callback(new Error("只支持正整数"));
}
}
if (!value) {
return callback(new Error("请输入正整数"));
} else {
callback();
}
},
/**
* 手机号
* */
checkRegExpPhoneTel(rule, value, callback) {
var rxpPhone = /^1[3456789]\d{9}$/;
var rxpTel = /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/;
if (!rule.required) {
if (!value) {
callback();
} else if (!rxpPhone.test(value)) {
return callback(new Error("请输入正确的手机号码"));
}
}
if (!value) {
return callback(new Error("请输入手机号码或固话"));
} else if (!rxpPhone.test(value) && !rxpTel.test(value)) {
return callback(new Error("请输入正确的手机号码或固话"));
} else {
callback();
}
},
/**
* 中文英文数字下划线括号
*/
checkName(rule, value, callback) {
var rxp = /^[\u4e00-\u9fa5-a-zA-Z0-9.-_\\()\\()]+$/;
if (!rule.required) {
if (!value) {
callback();
} else if (!rxp.test(value)) {
return callback(new Error("请输入中文英文数字下划线或括号"));
}
}
if (!value) {
return callback(new Error("请输入"));
} else {
callback();
}
},
};
// 通过url下载文件
export const downPackFile = (options) => {
if (!options) {
return false;
}
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", options.fileName || "excel.xlsx");
document.body.appendChild(link);
link.click();
};
const Constants = {
// 用户状态
USER_STATUS: {
'1': '正常, green',
'2': '停用, red'
},
// 角色数据权限
ROLE_AUTH: {
'0': '本人',
'1': '本人及下属',
'2': '本人部门',
'3': '本部门及下级部门',
'6': '指定数据权限',
'4': '全部'
},
ROLEAUTH_LIST: [
{
label: '本人',
value: 0
},
{
label: '本人及下属',
value: 1
},
{
label: '本人部门',
value: 2
},
{
label: '本部门及下级部门',
value: 3
},
{
label: '指定数据权限',
value: 6
},
{
label: '全部',
value: 4
}
],
// 租户可见度
ROLE_VISIBLE: {
0: '共享',
1: '仅系统管理员',
2: '可见租户'
},
// 菜单类型
MENU_TYPE: {
1: '目录'
},
MENU_OTYPE: {
2: '菜单',
3: '按钮',
4: '文本按钮'
},
MENU_NAME: {
1: '目录',
2: '菜单',
3: '按钮',
4: '文本按钮'
},
// 菜单状态
MENU_STATUS: {
1: '正常, green',
2: '不显示, gray'
},
// 组织状态
ORGINIZA_STATUS: {
'1': '正常',
'2': '停用'
},
// 字典状态
DICT_STATUS: {
'1': '启用, green',
'2': '停用, red'
},
// 日志操作状态
WORKLOG_STATUS: {
'0': '成功, green-text',
'-1': '失败, red-text'
}
}
export default Constants
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).GlMap=r()}(this,(function(){"use strict";function t(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function r(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function e(t,r,e){return r&&function(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(){n=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof g?r:g,a=Object.create(o.prototype),c=new P(n||[]);return i(a,"_invoke",{value:O(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var p="suspendedStart",y="suspendedYield",v="executing",d="completed",m={};function g(){}function w(){}function b(){}var L={};l(L,c,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));E&&E!==e&&o.call(E,c)&&(L=E);var j=b.prototype=g.prototype=Object.create(L);function G(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function S(t,r){function e(n,i,a,c){var u=h(t[n],t,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function O(r,e,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=_(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var f=h(r,e,n);if("normal"===f.type){if(o=n.done?d:y,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=d,n.method="throw",n.arg=f.arg)}}}function _(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function k(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function A(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function T(r){if(r||""===r){var e=r[c];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return w.prototype=b,i(j,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=l(b,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,f,"GeneratorFunction")),t.prototype=Object.create(j),t},r.awrap=function(t){return{__await:t}},G(S.prototype),l(S.prototype,u,(function(){return this})),r.AsyncIterator=S,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new S(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},G(j),l(j,f,"Generator"),l(j,c,(function(){return this})),l(j,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,P.prototype={constructor:P,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),A(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;A(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:T(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function o(r){return function(r){if(Array.isArray(r))return t(r)}(r)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(r,e){if(r){if("string"==typeof r)return t(r,e);var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(r,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof r?r:r+""}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}var c={1:"develop",2:"test",3:"production",4:"beta"},u=function(){return e((function t(){var e=this;!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t);var o,i,u={env:3,version:3},f=arguments[0];if(arguments.length>1&&(u="object"==a(arguments[0])?arguments[0]:u,f=arguments[1],null!==(o=u)&&void 0!==o&&o.env||(u.env=3),null!==(i=u)&&void 0!==i&&i.version||(u.version=3)),"undefined"!=typeof window){var l=function(){var t,o=(t=n().mark((function t(){var r,o,i,a;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=map-api-js&env=".concat(c[u.env]));case 3:return r=t.sent,t.next=6,r.json();case 6:o=t.sent,i=Array.from(document.head.getElementsByTagName("script")).some((function(t){return t.src===o.apiUrl})),i?f&&"function"==typeof f&&(e.GLMap=new window.$GlMapApi(u,(function(){f&&"function"==typeof f&&f(e)}))):((a=document.createElement("script")).src=o.apiUrl,document.head.appendChild(a),a.onload=function(){e.GLMap=new window.$GlMapApi(u,(function(){f&&"function"==typeof f&&f(e)}))}),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),console.error("Failed to fetch configuration:",t.t0);case 14:case"end":return t.stop()}}),t,null,[[0,11]])})),function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(){return o.apply(this,arguments)}}();l()}}),[{key:"invoke",value:function(t){var r,e=Array.prototype.slice.call(arguments,1);return(r=this.GLMap)[t].apply(r,o(e))}},{key:"map",get:function(){return this.GLMap._BMAP}},{key:"mapGL",get:function(){return this.GLMap._BMapGL}}])}();return u}));
import axios from 'axios'
import store from '@/store'
import { checkStatus, showLoading } from './checkStatus'
const instance = axios.create({
// 创建axios实例,在这里可以设置请求的默认配置
timeout: 180000, // 设置超时时间3分钟
retry: 3,
retryDelay: 1000
})
// 统一设置post请求头
instance.defaults.headers.post['Content-Type'] = 'application/json'
/** 添加请求拦截器 **/
instance.interceptors.request.use(
config => {
config.headers['Authorization'] = localStorage.getItem('token') || ''
showLoading(true)
return config
},
error => {
console.log('请求错误,原因:', error)
showLoading(false)
return Promise.reject(error)
}
)
/** 添加响应拦截器 **/
instance.interceptors.response.use(
response => {
showLoading(false)
const serverCode = response.data.code,
token = response.headers['authorization']
if (token || token === '') {
localStorage.setItem('token', token)
}
if (serverCode === 200 || response.status === 200) {
if (serverCode !== 200) {
checkStatus(serverCode)
}
if (response.status) {
return Promise.resolve(response)
}
return Promise.resolve(response.data)
} else {
checkStatus(serverCode)
return Promise.reject(response.data.message)
}
},
error => {
showLoading(false)
const errRes = error.response
if (errRes) {
const { data, config, status, statusText } = errRes
checkStatus(status)
console.log(`${config.url} 接口请求出错,状态码${status}`)
return Promise.reject(error)
} else {
checkStatus('fail')
console.log('http request fail 请求失败')
return Promise.reject(new Error('请求失败'))
}
// 超时处理
var config = error.config
if (!config || !config.retry) return Promise.reject(error)
// 设置用于跟踪重试次数的变量
config.__retryCount = config.__retryCount || 0
// 检查我们是否已将重试总数最大化
if (config.__retryCount >= config.retry) {
// 错误拒绝
return Promise.reject(error)
}
// 增加重试次数
config.__retryCount += 1
// 创造新的承诺来处理指数退避
var backoff = new Promise(function(resolve) {
setTimeout(function() {
resolve()
}, config.retryDelay || 1)
})
// 返回承诺,其中将撤回axios以重试请求
return backoff.then(function() {
return axios(config)
})
}
)
// 从mock获取基础域名配置
const MOCK_CONFIG_URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/test_config'
let baseFlag = true
const getBaseUrl = () => {
return new Promise((resolve, reject) => {
let BASE_URL = store.state.baseURL
// let BASE_URL = 'http://eshield.dev.glsx.com.cn'
if (!BASE_URL && baseFlag) {
baseFlag = false
instance({
url: MOCK_CONFIG_URL,
method: 'get'
})
.then(res => {
const resData = res.data
console.log(resData)
if (resData) {
const resBaseURL = resData.axios.baseURL
store.commit('updateBaseURL', resBaseURL)
baseFlag = !resBaseURL
resolve(resBaseURL)
} else {
baseFlag = true
resolve(BASE_URL)
}
})
.catch(err => {
baseFlag = true
resolve(BASE_URL)
})
} else {
resolve(BASE_URL)
}
})
}
const HTTP_POST = (baseUrl, options) => {
instance({
url: baseUrl + options.url,
method: 'post',
data: JSON.stringify(options.data)
})
.then(res => {
options.success(res.data)
})
.catch(err => {
options.error(err)
})
}
const HTTP_GET = (baseUrl, options) => {
instance({
url: baseUrl + options.url,
method: 'get',
params: options.data
})
.then(res => {
options.success(res.data)
})
.catch(err => {
options.error(err)
})
}
export default class HTTP {
axiosPost(options) {
getBaseUrl().then(
baseUrl => {
HTTP_POST(baseUrl, options)
},
err => {
HTTP_POST('')
}
)
}
axiosGet(options) {
getBaseUrl().then(
baseUrl => {
HTTP_GET(baseUrl, options)
},
err => {
HTTP_GET('')
}
)
}
}
//浏览器indexDb封装
var _db = '';
var _dbQuest = ''
var _indexDb = {};
/**
* 打开数据库、创建数据库
* name:数据库名称
* version:数据库版本号
*/
_indexDb.creatIndexDb = function (options) {
console.log('666666666666666666666')
let oParams = options || {}
if (!window.indexedDB) {
console.log('您的浏览器暂时不支持indexDb');
return false;
}
let databaseName = oParams.name || 'cookie';
let version = oParams.version || 1;
_db = window.indexedDB.open(databaseName, version);
console.log(_db)
// 监听数据库打开失败、连接失败
_db.onerror = function (event) {
console.log('打开失败');
// if (oParams.onerror) {
// (oParams.onerror)(event)
// }
}
// 监听数据库打开成功
_db.onsuccess = function (event) {
console.log(event)
console.log('打开成功');
_dbQuest = event.result
// if (oParams.success) {
// (oParams.success)(event)
// }
}
// 监听数据库升级事件
_db.upgradeneeded = function (event) {
console.log('监听数据库升级事件')
// if (oParams.upgradeneeded) {
// (oParams.upgradeneeded)(event)
// }
}
}
/**
* 添加数据
* key:存入数据库的键值
* data:存入数据库的值
*
*/
_indexDb.addItem = function (key, data) {
if (!_db) {
this.creatIndexDb().then(res => {
var request = _dbQuest.transaction(['cookie'], 'readwrite')
.objectStore('person')
.put({ id: 1, name: '李四', age: 35, email: 'lisi@example.com' })
request.onsuccess = function (event) {
console.log('数据更新成功');
};
});
}
console.log(_dbQuest)
var request = _dbQuest.transaction(['cookie'], 'readwrite')
.objectStore('person')
.put({ id: 1, name: '李四', age: 35, email: 'lisi@example.com' })
request.onsuccess = function (event) {
console.log('数据更新成功2');
};
}
/**
* 获取数据
*/
_indexDb.getItem = function (key) {
var request = _db.transaction(['cookie'], 'readwrite')
.objectStore('person')
.get('person');
request.onsuccess = function (event) {
console.log(event);
};
}
// 暴露方法
export const creatIndexDb = _indexDb.creatIndexDb;
export const addItem = _indexDb.addItem;
export const getItem = _indexDb.getItem;
import MD5 from 'js-md5'
const sign = (params, noSignAttr = []) => {
delete params.sign
const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const keys = Object.keys(params).sort()
var str = []
// for (const key in params) {
// if (typeof params[key] === 'object') params[key] = JSON.stringify(params[key])
// }
var obj = null
for (const key in params) {
obj = params[key]
if (obj === null || obj === undefined) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
params[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + params[e])
})
params.sign = MD5(secret + str.join('') + secret)
return params
}
export default sign
function trimSpace(str) {
return str.replace(/\s+/g, '');
}
// trimSpace(str).length < = 0弹出提示
function throttle (fn, delay) {
var t = null,
begin = new Date().getTime();
return function () {
var _self = this,
args = arguments,
cur = new Date().getTime();
clearTimeout(t);
if(cur - begin >= delay) {
fn.apply(_self, args);
begin = cur;
} else {
t = setTimeout(function () {
fn.apply(_self, args);
}, delay);
}
}
}
function debounce(fn, delay, triggerNow) {
var t = null;
var debounced = function(){
var _self = this,
args = arguments;
if(t){
clearTimeout(t);
}
if(triggerNow){
var exec = !t;
t = setTimeout(function(){
t = null;
}, delay);
if(exec){
// 初次进来
fn.apply(_self, args);
}
}else{
t = setTimeout(function(){
fn.apply(_self, args);
}, delay);
}
}
debounced.remove = function(){
clearTimeout(t);
t = null;
}
return debounced;
}
export {
trimSpace,
throttle,
debounce
}
\ No newline at end of file
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)
})
},
}
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
<template>
<div class="home">
</div>
</template>
<script>
export default {
name: 'Home',
components: {
},
data() {
return {
}
},
mounted() {
this.$root.parentVuex.dispatch('app/setCommonData', { showEmpty: true });
},
methods: {
// changeParentState(){
// if(this.isQiankun){
// this.$root.parentVuex.commit('setCommonData', { parent: this.num++ });
// }
// }
}
}
</script>
<template>
<div class="system-container">
<div class="container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="dictDataFormList"
>
<span
class="inline-b"
slot="form-slot"
>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</span>
</search-form>
<h3>字典列表
<div class="pull-right">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="btnClick('create')"
>新增</el-button>
</div>
</h3>
<basic-table
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
:searchForm="searchForm"
:hasNum="true"
ref="dictDataTable"
>
<span
slot="status"
slot-scope="scope"
>
<span
class="dot"
:class="scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[1] : ''"
></span><span class="statusText">{{ scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span>
</span>
<span
slot="table-button"
slot-scope="scope"
>
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</span>
</basic-table>
<basic-dialog
:title="dictDataDialogTitle"
:isVisible="dictDataVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictDataForm"
:rules="dictDataRules"
:ruleData="dictDataData"
ref='dictDataForm'
></rule-form>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
import { getDictDataList, addDictData, editDictData, deleteDictData, exportDictData } from 'services/dictionary';
export default {
data() {
return {
DICTSTATUS: this.$Constants.DICT_STATUS,
storageParams: {},
searchForm: {
name: ''
},
dictDataFormList: [
{
type: 'input',
inputType: 'text',
prop: 'name',
readonly: true,
placeholder: '请输入字典名称'
},
{
type: 'input',
inputType: 'text',
prop: 'tag',
placeholder: '请输入字典标签'
},
{
type: 'select',
prop: 'status',
placeholder: '请选择字典状态',
options: [
{
label: '启用',
value: 1
}, {
label: '停用',
value: 2
}
]
},
{
type: 'daterange',
prop: 'daterange',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
}
],
tableParams: {
numName: '字典编码',
// mutiSelectName: 'dictDataData',
// mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
// label: '字典编码',
// prop: 'id'
// }, {
label: '字典标签',
prop: 'dictLabel'
}, {
label: '字典键值',
prop: 'dictValue'
}, {
label: '字典排序',
prop: 'dictSort'
}, {
label: '备注',
prop: 'remark'
}, {
label: '字典状态',
prop: 'enableStatus',
addHtml: 'status'
}, {
label: '创建时间',
prop: 'createdDate'
}
],
tableOption: {
width: 140,
btnList: [
{
name: '编辑',
pType: 'edit'
},
{
name: '删除',
pType: 'delete'
}
]
}
},
getListApi: getDictDataList,
// 弹窗
dictDataDialogTitle: '新增字典',
dictDataVisible: false,
dictDataForm: {},
dictDataData: [
{ label: '字典类型:', prop: 'dictType', type: 'input', readonly: true },
{ label: '字典标签:', prop: 'dictLabel', type: 'input', maxlength: 20 },
{ label: '字典键值:', prop: 'dictValue', type: 'input', maxlength: 50 },
{ label: '字典排序:', prop: 'dictSort', type: 'input', maxlength: 5 },
{ label: '状态:', prop: 'enableStatus', type: 'switch' },
{ label: '备注:', prop: 'remark', type: 'input', inputText: 'textarea', maxlength: 200, showWordLimit: true }
],
dictDataRules: {
dictType: [{ required: true }],
dictLabel: [{ required: true, message: '请输入字典标签', trigger: 'blur' }],
dictValue: [{ required: true, message: '请输入字典键值', trigger: 'blur' }],
dictSort: [{ required: true, message: '请输入字典排序', trigger: 'blur' },
{ validator: this.$Common.checkRegExpNumber, trigger: 'blur' }],
enableStatus: [{ required: true }]
}
}
},
mounted() {
let params = this.$route.params
if ((JSON.stringify(params) === '{}' || !params)) {
params = this.getInitStorage()
this.storageParams = params
}
if (params) {
this.searchForm.name = params.row.dictName
// this.dictDataForm.dictType = params.row.dictType
// this.dictDataForm.enableStatus = params.row.enableStatus == 1
}
},
methods: {
getInitStorage() {
const getStorageParams = localStorage.getItem('dictionaryParams')
if (getStorageParams) {
return JSON.parse(getStorageParams)
} else {
return ''
}
},
// 重置搜索条件
refresh() {
let name = '';
if (this.$route.params.row) {
name = this.$route.params.row.dictName;
} else if (this.storageParams.row) {
name = this.storageParams.row.dictName;
}
this.searchForm = {
name
}
this.$refs.dictDataTable.refreshTable()
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
let getDictType = '';
setTimeout(() => {
if (this.$route.params.row) {
getDictType = this.$route.params.row.dictType;
} else if (this.storageParams.row) {
getDictType = this.storageParams.row.dictType;
}
this.searchForm.type = getDictType;
if (this.searchForm.daterange) {
this.searchForm.sDate = this.searchForm.daterange[0]
this.searchForm.eDate = this.searchForm.daterange[1]
delete this.searchForm.daterange
} else {
if (this.searchForm.sDate) delete this.searchForm.sDate && delete this.searchForm.eDate
}
resolve()
}, 100)
})
},
// 确定
handleConfirm() {
this.$refs.dictDataForm.$children[0].validate((valid) => {
if (valid) {
let params = JSON.parse(JSON.stringify(this.dictDataForm))
params.enableStatus = this.dictDataForm.enableStatus ? 1 : 2
let api = addDictData
if (params.id) {
api = editDictData
delete params.delFlag
delete params.disabled
delete params.deleted
delete params.typeDeleted
delete params.typeDisabled
}
api(params).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleClose()
this.$refs.dictDataTable.refreshTable()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
})
},
// 取消
handleClose() {
if (!this.dictDataVisible && this.$refs.dictDataForm) {
this.$refs.dictDataForm.$children[0].resetFields()
}
this.dictDataVisible = !this.dictDataVisible
},
// 按钮事件
btnClick(pType, scope) {
switch (pType) {
case 'create':
this.dictDataDialogTitle = '新增字典'
const params = this.getInitStorage()
this.dictDataForm = {
dictType: params.row.dictType,
enableStatus: params.row.enableStatus == 1
}
this.handleClose()
break
case 'edit':
this.dictDataDialogTitle = '编辑字典'
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
}
},
// 编辑触发事件
editEvent(row) {
this.dictDataForm = JSON.parse(JSON.stringify(row))
this.dictDataForm.enableStatus = row.enableStatus == 1 ? true : false
delete this.dictDataForm.createdDate
delete this.dictDataForm.isDefault
this.handleClose()
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
const params = {
dataId: id
}
deleteDictData(params).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$refs.dictDataTable.refreshTable()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
}
this.$Common.confirmDialog(tipData)
}
}
}
</script>
<style>
.el-table__indent {
padding-left: 16px;
}
</style>
\ No newline at end of file
<template>
<div class="system-container">
<div class="container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="dictionaryFormList"
>
<span
class="inline-b"
slot="form-slot"
>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh "
>重置</el-button>
</span>
</search-form>
<h3>字典管理
<div class="pull-right">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="btnClick('create')"
>新增</el-button>
</div>
</h3>
<basic-table
ref="dictManage"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
:searchForm="searchForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
>
<span
class="dot"
:class="scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[1] : ''"
></span><span class="statusText">{{ scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span>
</span>
<span
slot="table-button"
slot-scope="scope"
>
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</span>
</basic-table>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictionaryForm"
:rules="dictionaryRules"
:ruleData="dictionaryData"
ref='dictionaryForm'
></rule-form>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
import { getDictList, addDict, editDict, deleteDict } from 'services/dictionary';
export default {
data() {
return {
DICTSTATUS: this.$Constants.DICT_STATUS,
searchForm: {},
searchDataForm: {},
dictionaryFormList: [
{
type: 'input',
inputType: 'text',
prop: 'name',
placeholder: '请输入字典名称'
},
{
type: 'input',
inputType: 'text',
prop: 'type',
placeholder: '请输入字典类型'
},
{
type: 'select',
prop: 'status',
placeholder: '请选择字典状态',
options: [
{
label: '启用',
value: 1
}, {
label: '停用',
value: 2
}
]
},
{
type: 'daterange',
prop: 'daterange',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
}
],
tableParams: {
// mutiSelectName: 'dictionary',
// mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '字典主键',
prop: 'id'
}, {
label: '字典名称',
prop: 'dictName'
}, {
label: '字典类型',
prop: 'dictType'
}, {
label: '字典备注',
prop: 'remark'
}, {
label: '字典状态',
prop: 'enableStatus',
addHtml: 'status'
}, {
label: '创建时间',
prop: 'createdDate'
}
],
tableOption: {
width: 150,
btnList: [
{
name: '列表',
pType: 'list'
},
{
name: '编辑',
pType: 'edit'
},
{
name: '删除',
pType: 'delete'
}
]
}
},
getListApi: getDictList,
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
dictionaryForm: {
enableStatus: true
},
dictionaryData: [
{ label: '字典名称:', prop: 'dictName', type: 'input', maxlength: 20 },
{ label: '字典类型:', prop: 'dictType', type: 'input', maxlength: 50, readonly: false },
{ label: '状态:', prop: 'enableStatus', type: 'switch' },
{ label: '备注:', prop: 'remark', type: 'input', inputText: 'textarea', maxlength: 200, showWordLimit: true }
],
dictionaryRules: {
dictName: [{ required: true, message: '请输入字典名称', trigger: blur }],
dictType: [{ required: true, message: '请输入字典类型', trigger: blur }],
enableStatus: [{ required: true }]
}
}
},
methods: {
// 重置搜索条件
refresh() {
this.searchForm = {}
this.searchDataForm = {}
this.$refs.dictManage.refreshTable()
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
console.log(this.searchForm)
if (this.searchForm.daterange) {
this.searchForm.sDate = this.searchForm.daterange[0]
this.searchForm.eDate = this.searchForm.daterange[1]
delete this.searchForm.daterange
} else {
if (this.searchForm.sDate) delete this.searchForm.sDate && delete this.searchForm.eDate
}
resolve()
})
},
// 确定
handleConfirm() {
console.log(this.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate((valid) => {
if (valid) {
let params = JSON.parse(JSON.stringify(this.dictionaryForm))
params.enableStatus = this.dictionaryForm.enableStatus ? 1 : 2
console.log(params)
let api = addDict
if (params.id) api = editDict
api(params).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.$refs.dictManage.refreshTable()
this.handleClose()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
})
},
// 取消
handleClose() {
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
},
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'create':
this.dictionaryDialogTitle = '新增字典'
this.dictionaryForm = {
enableStatus: true
}
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = false
}
})
this.handleClose()
break
case 'edit':
this.dictionaryDialogTitle = '编辑字典'
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = true
}
})
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
case 'list':
console.log('list', scope)
const listData = { row: scope };
localStorage.setItem('dictionaryParams', JSON.stringify(listData));
this.$router.push({ name: 'dictionaryData', params: listData });
break
}
},
// 编辑触发时间
editEvent(row) {
this.dictionaryForm = JSON.parse(JSON.stringify(row))
this.dictionaryForm.enableStatus = row.enableStatus == 1 ? true : false
delete this.dictionaryForm.createdDate
this.handleClose()
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
const params = {
typeId: id
}
deleteDict(params).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$refs.dictManage.refreshTable()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
}
this.$Common.confirmDialog(tipData)
}
}
}
</script>
\ No newline at end of file
<template>
<div class="home_page">
<!-- 区域查车按钮 开始 -->
<div class="area_car" @click="openAreaCar()" v-if="hasPermission('INDEX_AREA_SEARCH_CAR')">
<img src="https://img01.glsx.com.cn/weapp/resource/e-shield/car.png" alt="" class="img" />
</div>
<!-- 区域查车按钮 end -->
<!-- 数据列表 开始 -->
<div class="static_list_box">
<div class="mask" v-show="maskFlag"><i class="el-icon-loading" style="font-size: 20px;"></i>loading...</div>
<!-- 总绑定数 开始 -->
<div class="cell_box">
<!-- 表头 开始 -->
<div class="head">
<span>总绑定数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>总绑定数:统计该账号权限下,车辆绑定总数</p>
<p>趋势图:统计该账号权限下,最近30天的日车辆绑定数趋势</p>
<p>今日绑定数:统计该账号权限下,今日车辆绑定数</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
</div>
<!-- 表头 end -->
<!-- 数据 开始 -->
<div class="info_box">
<div class="title">{{staticInfo.allBindNumber}}</div>
<div id="bindChart" class="c_canvas"></div>
<div class="footer">
今日绑定数:{{staticInfo.bindNumForToday}}
</div>
</div>
<!-- 数据 end -->
</div>
<!-- 总绑定数 end -->
<!-- 总激活数 开始 -->
<div class="cell_box">
<!-- 表头 开始 -->
<div class="head">
<span>总激活数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>总激活数:统计该账号权限下,有线设备和无线设备的激活数之和;</p>
<p>趋势图:统计该账号权限下,最近30天的日激活数趋势;</p>
<p>今日激活数:统计该账号权限下,今日有线设备和无线设备的激活数之和;</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
</div>
<!-- 表头 end -->
<!-- 数据 开始 -->
<div class="info_box">
<div class="title">{{staticInfo.allActiveNumber}}</div>
<div id="activedChart" class="c_canvas"></div>
<div class="footer">
今日激活数:{{staticInfo.activeNumForToday}}
</div>
</div>
<!-- 数据 end -->
</div>
<!-- 总激活数 end -->
<!-- 设备数 开始 -->
<div class="cell_box" style="flex: 2;">
<!-- 表头 开始 -->
<div class="head">
<span>设备数</span>
</div>
<!-- 表头 end -->
<!-- 数据 开始 -->
<div class="info_box">
<div class="equipment_box">
<!-- 设备在线数 -->
<div class="equipment_boxs">
<div>
<span>设备在线数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>{{hasPermission('data_doard_offLine') ? '在线数 = 总在线数 + 假性离线数' : '在线数 = 有线设备在线数 + 无线设备在线数'}}</p>
<p>{{hasPermission('data_doard_offLine') ? '总在线数:' : '有线设备在线数:'}}</p>
<p>
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>连接服务器即认为在线;
</p>
<p v-show="!hasPermission('data_doard_offLine')">无线设备在线数:</p>
<p v-show="!hasPermission('data_doard_offLine')">
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>连接服务器即认为在线;
</p>
<p v-show="hasPermission('data_doard_offLine')">假性离线数:</p>
<p v-show="hasPermission('data_doard_offLine')">
统计该账号权限下,在统计当日所有设备假性离线情况,
<span>若满足对应条件则判定为假性离线,即在线;</span>
</p>
<p>{{hasPermission('data_doard_offLine') ? '总在线率 = (设备在线数 + 假性离线数)/ 总激活数;' : '在线率 = 在线数 / 总激活数;'}}</p>
<p>{{hasPermission('data_doard_offLine') ? '总在线率保留百分位,四舍五入' : '在线率保留百分位,四舍五入'}}</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
<div class="title" style="margin-top: 10px;">{{staticInfo.onlineNumber}}</div>
</div>
<div id="onlineChart" class="c_canvass"></div>
</div>
<!-- 假性离线数 -->
<div class="equipment_boxs" v-show="hasPermission('data_doard_offLine')">
<div>
<span>假性离线数</span>
<div class="title" style="margin-top: 10px;">{{staticInfo.fakeOfflineNumber}}</div>
</div>
<div id="fakeOfflineChart" class="c_canvass"></div>
</div>
<!-- 设备离线数 -->
<div class="equipment_boxs">
<div>
<span>设备离线数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>{{hasPermission('data_doard_offLine') ? '离线数 = 总离线数 - 假性离线数' : '离线数 = 有线设备离线数 + 无线设备离线数'}}</p>
<p>{{hasPermission('data_doard_offLine') ? '总离线数:' : '有线设备离线数:'}}</p>
<p>
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>
无连接服务器即认为离线;
</p>
<p v-show="!hasPermission('data_doard_offLine')">无线设备离线数:</p>
<p v-show="!hasPermission('data_doard_offLine')">
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>
无连接服务器即认为离线;
</p>
<p v-show="hasPermission('data_doard_offLine')">假性离线数:</p>
<p v-show="hasPermission('data_doard_offLine')">
统计该账号权限下,在统计当日所有设备假性离线情况,若满足对应条件则判定为假性离线,即在线,并从离线率中剔除;
</p>
<p>{{hasPermission('data_doard_offLine') ? '离线率 = (总离线数 - 假性离线数)/ 总激活数;' : '离线率 = 离线数 / 总激活数;'}}</p>
<p>离线率保留百分位,四舍五入</p>
<p v-if="isZhongli && staticInfo.offlineSnNum>0">确认{{staticInfo.offlineSnNum}}台设备加入白名单,不予统计</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
<div class="title" style="margin-top: 10px;" v-show="staticInfo.offlineNumber != undefined">{{hasPermission('data_doard_offLine') ? staticInfo.offlineNumber - staticInfo.fakeOfflineNumber : staticInfo.offlineNumber}}</div>
</div>
<div id="offlineChart" class="c_canvass"></div>
</div>
</div>
<div class="footer">
<div class="footer-box">
<span style="color: #0196FA;">{{hasPermission('data_doard_offLine') ? '设备总在线率:' : '设备在线率:'}}</span>
<span style="color: #0196FA;" v-show="staticInfo.onlineRate != undefined">{{hasPermission('data_doard_offLine') ? addSub(staticInfo.onlineRate, staticInfo.fakeOfflineRate) : staticInfo.onlineRate}}%</span>
</div>
<div class="footer-box" v-show="hasPermission('data_doard_offLine')"></div>
<div class="footer-box">
<span style="color: #F47F13;">设备离线率:</span>
<span style="color: #F47F13;" v-show="staticInfo.offlineRate != undefined">{{hasPermission('data_doard_offLine') ? accSub(staticInfo.offlineRate, staticInfo.fakeOfflineRate) : staticInfo.offlineRate}}%</span>
</div>
</div>
</div>
<!-- 数据 end -->
</div>
<!-- 设备数 end -->
</div>
<!-- 数据列表 end -->
<!-- 常规报警 开始 -->
<div class="alarm_box">
<div class="head">常规报警</div>
<div class="alarm_list">
<!-- 防拆报警 开始 -->
<div class="cell" @click="linkToPage('/trialRun#/alarmCenter/fence')">
<div class="title">
<img src="@/assets/images/enclosureicon.png" />
<span>围栏报警</span>
</div>
<div class="num">{{fenceAlarmCount||0}}</div>
</div>
<!-- 防拆报警 end -->
<!-- 防拆报警 开始 -->
<div class="cell" @click="linkToPage('/trialRun#/alarmCenter/tamper')">
<div class="title">
<img src="@/assets/images/stopicon.png" />
<span>防拆报警</span>
</div>
<div class="num">{{alarmInfo.tearDownAlarmCount||0}}</div>
</div>
<!-- 防拆报警 end -->
<!-- 离线预警 开始 -->
<div class="cell" @click="linkToPage('/trialRun#/alarmCenter/offline',alarmInfo.offLineAlarmStartTime,alarmInfo.offLineAlarmEndTime)">
<div class="title">
<img src="@/assets/images/off-lineicon.png" />
<span>离线预警</span>
</div>
<div class="num">{{alarmInfo.offLineAlarmCount||0}}</div>
</div>
<!-- 离线预警 end -->
<!-- 大数据研判警情 开始 -->
<div class="cell" @click="linkToPage('/trialRun#/alarmCenter/hadoop')">
<div class="title">
<img src="@/assets/images/equipmenticon.png" />
<span>大数据研判警情</span>
</div>
<div class="num">{{alarmInfo.stuJudgeAlarmCount||0}}</div>
</div>
<!-- 大数据研判警情 end -->
</div>
</div>
<!-- 常规报警 end -->
<!-- 设备激活趋势 开始 -->
<div class="alarm_box device_box">
<div class="head">
<span>设备激活趋势</span>
<div>
<el-button-group>
<el-button v-for="(item,index) in links" :key="index" :type="active == item.id?'success':'default'" @click="linkEvent(item)" size="mini">{{item.name}}</el-button>
</el-button-group>
</div>
</div>
<div class="chart_box">
<div class="chart_wrapper" id="activedChartBox"></div>
</div>
</div>
<!-- 设备激活趋势 开始 -->
</div>
</template>
<script>
import {
GET_HOME_DEVICENUMBER,
GET_HOME_ALARMNUMBER,
GET_HOME_ACTIVEDEVICEINFO,
GET_HOME_AUTHUSERORG,
GET_HOME_NEWBINDDEVICEINFO,
GET_FENCE_ALARM
} from "@/services/home";
//import chartConfig from "@/chart/chartConfig.js";
import * as echarts from "echarts/core";
import { LineChart,PieChart } from 'echarts/charts';
import {
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent
} from 'echarts/components';
import { CanvasRenderer } from 'echarts/renderers';
echarts.use([
LineChart,
PieChart,
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent,
CanvasRenderer
])
export default {
data() {
return {
links: [
{ name: "今天", id: 1 },
{ name: "昨天", id: 2 },
{ name: "近7天", id: 10 },
{ name: "本月", id: 5 },
{ name: "上月", id: 6 },
{ name: "近30日", id: 11 },
],
active: 2,
staticInfo: {},
alarmInfo: {},
isZhongli: false,
maskFlag: true,
fenceAlarmCount:0
};
},
mounted() {
this.getAlarm();
this.getFenceAlarm()
this.getActived(this.createActivedLineChart);
this.getActived(this.createAllActivedLineChart, 11);
this.getBindEchart();
//GET_HOME_AUTHUSERORG().then((res) => {});
this.getRoles();
},
activated() {
this.getStatic();
},
methods: {
// 是否有权限
hasPermission(id) {
let list = this.$root.parentCommon.getAuthData();
let idx = list.findIndex((k) => k.origin.permissionTag == id);
if (idx < 0) {
return false;
} else {
return true;
}
},
// 切换日期
linkEvent(row) {
this.active = row.id;
this.getActived(this.createActivedLineChart);
},
// 获取统计数据
getStatic() {
GET_HOME_DEVICENUMBER().then((res) => {
let obj = res.data || {};
this.staticInfo = obj;
// 在线率
let m = [];
m.push({ value: this.accSub(100, obj.onlineRate), name: "" });
m.push({ value: obj.onlineRate, name: "" });
if (obj.onlineRate == 0 || obj.onlineRate == 100) {
this.unCreateBindChart("onlineChart", m);
} else {
this.createBindChart("onlineChart", m);
}
// 离线率
let n = [];
n.push({ value: obj.offlineRate, name: "" });
n.push({ value: this.accSub(100, obj.offlineRate), name: "" });
if (this.hasPermission('data_doard_offLine')) {
n = []
const b = this.accSub(100, obj.offlineRate)
n.push({ value: this.accSub(obj.offlineRate, obj.fakeOfflineRate), name: "" });
n.push({ value: this.addSub(b, obj.fakeOfflineRate), name: "" });
}
if (this.accSub(obj.offlineRate, obj.fakeOfflineRate) == 0 || this.accSub(obj.offlineRate, obj.fakeOfflineRate) == 100 || obj.offlineRate == 0 || obj.offlineRate == 100) {
this.unCreateChart("offlineChart", n);
} else {
this.createChart("offlineChart", n);
}
// 假性离线率
let x = []
if (this.hasPermission('data_doard_offLine')) {
x.push({ value: this.accSub(100, obj.fakeOfflineRate), name: "" });
x.push({ value: obj.fakeOfflineRate, name: "" });
}
if (obj.fakeOfflineRate == 0 || obj.fakeOfflineRate == 100) {
this.unCreateBindChart("fakeOfflineChart", x);
} else {
this.createBindChart("fakeOfflineChart", x);
}
this.maskFlag = false
});
},
// 减法计算函数
accSub(arg1, arg2) {
let a = arg1 - arg2
a = Math.round((a) * 100) / 100
a.toFixed(2)
return a
},
// 加法计算函数
addSub(arg1, arg2) {
let b = Number(arg1) + Number(arg2)
b = Math.round((b) * 100) / 100
b.toFixed(2)
return b
},
// 获取警情统计
getAlarm() {
GET_HOME_ALARMNUMBER().then((res) => {
this.alarmInfo = res.data || {};
});
},
// 获取设备激活趋势
getActived(callBack, id) {
let oParams = {};
oParams.period = id || this.active;
console.log(oParams);
GET_HOME_ACTIVEDEVICEINFO(oParams).then((res) => {
console.log(res);
if (res.code != 200) {
return false;
}
let m = res.data || [];
callBack(m);
});
},
// 创建设备激活趋势折线图
createActivedLineChart(m) {
let xAxis = [];
let yAxis = [];
m.map((k) => {
xAxis.push(k.activeDate);
yAxis.push(k.activeNumber);
});
var aChart = echarts.init(document.getElementById("activedChartBox"));
aChart.setOption({
tooltip: {
trigger: "axis",
},
xAxis: {
type: "category",
boundaryGap: false,
data: xAxis,
axisLabel: {
rotate: 45,
},
},
yAxis: {
type: "value",
minInterval: 1,
},
series: [
{
symbol: "none",
smooth: true,
data: yAxis,
type: "line",
areaStyle: {},
},
],
});
},
// 创建含有最小比例环形图表
createBindChart(id, data) {
var aChart = echarts.init(document.getElementById(id));
aChart.setOption({
tooltip: {
show: true,
formatter: "{c0}%",
},
legendHoverLink: false,
color: [
"#c0c0c0",
"#0096fa",
"#fac858",
"#ee6666",
"#73c0de",
"#3ba272",
"#fc8452",
"#9a60b4",
"#ea7ccc",
],
series: [
{
type: "pie",
radius: ["40%", "70%"],
labelLine: {
show: false,
},
data: data,
minAngle: 11
},
],
});
},
// 创建没有最小比例环形图表
unCreateBindChart(id, data) {
var aChart = echarts.init(document.getElementById(id));
aChart.setOption({
tooltip: {
show: true,
formatter: "{c0}%",
},
legendHoverLink: false,
color: [
"#c0c0c0",
"#0096fa",
"#fac858",
"#ee6666",
"#73c0de",
"#3ba272",
"#fc8452",
"#9a60b4",
"#ea7ccc",
],
series: [
{
type: "pie",
radius: ["40%", "70%"],
labelLine: {
show: false,
},
data: data
},
],
});
},
// 含有最小比例离线率环形图表
createChart(id, data) {
var aChart = echarts.init(document.getElementById(id));
aChart.setOption({
tooltip: {
show: true,
formatter: "{c0}%",
},
legendHoverLink: false,
color: [
"#F6B06F",
"#c0c0c0",
"#fac858",
"#ee6666",
"#73c0de",
"#3ba272",
"#fc8452",
"#9a60b4",
"#ea7ccc",
],
series: [
{
type: "pie",
radius: ["40%", "70%"],
labelLine: {
show: false,
},
data: data,
minAngle: 11
},
],
});
},
// 没有最小比例离线率环形图表
unCreateChart(id, data) {
var aChart = echarts.init(document.getElementById(id));
aChart.setOption({
tooltip: {
show: true,
formatter: "{c0}%",
},
legendHoverLink: false,
color: [
"#F6B06F",
"#c0c0c0",
"#fac858",
"#ee6666",
"#73c0de",
"#3ba272",
"#fc8452",
"#9a60b4",
"#ea7ccc",
],
series: [
{
type: "pie",
radius: ["40%", "70%"],
labelLine: {
show: false,
},
data: data
},
],
});
},
// 页面跳转
linkToPage(path, start, end) {
let row = { alarmStatus: 1 };
this.$root.parentCommon.setBreadCrumbs(path);
let url = path;
if (start) {
url = `${path}?startTime=${start}&endTime=${end}`;
}
history.pushState(row, "", url);
},
// 获取总绑定数报表
getBindEchart() {
GET_HOME_NEWBINDDEVICEINFO().then((res) => {
let obj = res.data || [];
let xAxis = [];
let yAxis = [];
obj.map((k) => {
xAxis.push(k.bindDate);
yAxis.push(k.bindDeviceNumber);
});
this.createLineChart("bindChart", xAxis, yAxis);
});
},
// 创建折线图
createLineChart(id, xDate, yDate) {
var aChart = echarts.init(document.getElementById(id));
aChart.setOption({
tooltip: {
trigger: "axis",
},
xAxis: {
show: false,
type: "category",
boundaryGap: false,
data: xDate,
},
yAxis: {
show: false,
type: "value",
},
series: [
{
symbol: "none",
smooth: true,
data: yDate,
type: "line",
areaStyle: {},
},
],
});
},
// 总激活数,折线图
createAllActivedLineChart(m) {
let xAxis = [];
let yAxis = [];
m.map((k) => {
xAxis.push(k.activeDate);
yAxis.push(k.activeNumber);
});
this.createLineChart("activedChart", xAxis, yAxis);
},
// 获取角色属性(针对仲利)
getRoles() {
GET_HOME_AUTHUSERORG().then((res) => {
this.isZhongli = res.data;
});
},
// 打开区域查车
openAreaCar(){
let _path = 'oEshield#/monitor/zoneCar?type=full'
window.open(_path)
},
// 获取围栏报警数量
getFenceAlarm(){
GET_FENCE_ALARM().then(res => {
console.log(res)
let _obj = res.data || {};
this.fenceAlarmCount = _obj.fenceAlarmCount || 0
})
}
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/home.scss";
</style>
<template>
<div class="system-container">
<div class="container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="menuFormList"
>
<span
class="inline-b"
slot="form-slot"
>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
@click="search"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</span>
</search-form>
<h3>菜单管理
<div class="pull-right">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="btnClick('create')"
>新增目录</el-button>
</div>
</h3>
<el-table
ref="menuTable"
:data="menuTableData"
style="width: 100%"
row-key="id"
highlight-current-row
stripe
lazy
:load="load"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column
v-for="(item,index) in listHeadData"
:key="index"
:prop="item.prop"
:sortable="item.sortable"
:ref="item.ref"
:width="item.width"
:label="item.label"
show-overflow-tooltip
>
<template slot-scope="scope">
<template v-if="item.prop === 'enableStatus'">
<span
class="dot"
:class="scope.row.enableStatus ? MENUSTATUS[scope.row.enableStatus].split(',')[1] : ''"
></span>
<span class="statusText">{{ scope.row.enableStatus ? MENUSTATUS[scope.row.enableStatus].split(',')[0] : '--'}}</span>
</template>
<template v-else-if="item.prop === 'type'">
<span>
{{scope.row.type ? MENU_NAME[scope.row.type] : '--'}}
</span>
</template>
<template v-else>
{{scope.row[item.prop]?scope.row[item.prop]:'--'}}
</template>
</template>
</el-table-column>
<el-table-column
align="center"
width="250"
fixed="right"
prop="btn"
label="操作"
>
<template slot-scope="scope">
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.row)"
>{{j.name}}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageNum"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<basic-dialog
:title="menuDialogTitle"
:isVisible="menuVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="menuForm"
:rules="menuRules"
:ruleData="menuData"
@radioChange="radioChange"
ref='menuForm'
></rule-form>
</slot>
</basic-dialog>
<basic-dialog
:title="filterDialogTitle"
:isVisible="filterVisible"
@confirmDialog="filterConfirm"
@closeDialog="closeFilter"
>
<slot>
<el-input
placeholder="输入关键字进行过滤"
v-model="filterText"
>
</el-input>
<el-tree
class="filter-tree"
:data="filterTextData"
:props="defaultProps"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
check-on-click-node
>
</el-tree>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
import _ from 'lodash'
import { getMenuList, getMenuChildren, addMenu, editMenu, menuInfo, deleteMenu, getPermtree } from 'services/menu';
export default {
data() {
return {
MENUSTATUS: this.$Constants.MENU_STATUS,
MENU_NAME: this.$Constants.MENU_NAME,
searchForm: {},
menuFormList: [
{
type: 'input',
inputType: 'text',
prop: 'name',
placeholder: '请输入菜单名称'
},
{
type: 'select',
prop: 'enableStatus',
placeholder: '请选择菜单状态',
options: [{
value: '1',
label: '正常'
}, {
value: '2',
label: '不显示'
}]
}
],
menuTableData: [],
// 列表 头部设置 数据
listHeadData: [
{ prop: 'menuName', label: '菜单名称', width: '200' },
{ prop: 'orderNum', label: '排序' },
{ prop: 'frontRoute', label: '请求地址' },
{ prop: 'type', label: '菜单类型' },
{ prop: 'enableStatus', label: '状态' },
{ prop: 'permissionTag', label: '权限标识' }
],
page: {
pageSize: 10,
pageNumber: 1
},
total: 10,
tableParams: {
tableOption: {
btnList: [
{
name: '新增',
pType: 'btnCreate'
},
{
name: '编辑',
pType: 'edit'
},
{
name: '删除',
pType: 'delete'
}
]
}
},
// 弹窗数据
menuDialogTitle: '新增菜单',
menuVisible: false,
menuForm: {
type: '1',
parentName: '',
enableStatus: true
},
form: {
// type: '1',
parentName: '',
enableStatus: true
},
menuData: [
{ label: '菜单类型:', prop: 'type', type: 'radio', children: this.$Constants.MENU_TYPE, disabled: false },
{ label: '上级菜单:', prop: 'parentName', type: 'input', readonly: true, clickFunc: this.selectSuperior, hidden: true },
{ label: '菜单名称:', prop: 'menuName', type: 'input', maxlength: 20 },
{ label: '权限标识:', prop: 'permissionTag', type: 'input' },
{ label: '前端路由:', prop: 'frontRoute', type: 'input' },
{ label: '显示排序:', prop: 'orderNum', type: 'input', maxlength: 5 },
{ label: '显示状态:', prop: 'enableStatus', type: 'switch' },
{ label: '图标:', prop: 'icon', type: 'input', hidden: false }
],
menuRules: {
type: [{ required: true, message: '请选择菜单类型', trigger: 'blur' }],
menuName: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
orderNum: [{ required: true, message: '请输入显示排序', trigger: 'blur' },
{ validator: this.$Common.checkRegExpNumber, trigger: 'blur' }],
enableStatus: [{ required: true }],
},
// 部门弹窗
filterDialogTitle: '选择上级',
filterVisible: false,
filterText: '',
filterTextData: [],
defaultProps: {
children: 'children',
label: 'label'
},
loading: false,
isOpen: true
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val)
}
},
mounted() {
this.search()
},
methods: {
search() {
let params = Object.assign({}, this.searchForm, this.page)
this.getList(params)
},
// 重置搜索条件
refresh() {
this.searchForm = {}
this.search()
},
emptyData(params, hasArr) {
let arr = params
for (let key in arr) {
if (params[key] == null || params[key] == '' || params[key] == []) {
if (!hasArr.find(item => item == key)) delete params[key]
}
}
return arr
},
// 确定,新增、编辑
handleConfirm() {
this.$refs.menuForm.$children[0].validate((valid) => {
if (valid) {
let params = JSON.parse(JSON.stringify(this.menuForm))
params.enableStatus = this.menuForm.enableStatus ? 1 : 2
if (params.parentName) delete params.parentName
if (params.menuNo) delete params.menuNo
if (params.ppId) delete params.ppId
this.emptyData(params, ['frontRoute', 'permissionTag', 'icon'])
let api = addMenu
if (params.id) api = editMenu
api(params).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleClose()
this.$root.parentVuex.dispatch('menu/updateMenu', params)
if (params.parentId) {
getMenuChildren({ parentId: params.parentId }).then(res => {
this.$set(this.$refs.menuTable.store.states.lazyTreeNodeMap, this.menuForm.ppId, res.data)
})
} else {
this.search()
}
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
})
},
// 取消
handleClose() {
if (!this.menuVisible && this.$refs.menuForm) {
this.$refs.menuForm.$children[0].resetFields()
}
this.menuVisible = !this.menuVisible
},
// 按钮事件
btnClick(pType, scope) {
switch (pType) {
case 'create':
this.isOpen = true
this.menuDialogTitle = '新增目录'
this.menuData.map(item => {
if (item.prop == 'parentName') {
item.hidden = true
} else if (item.prop == 'type') {
item.children = this.$Constants.MENU_TYPE
item.disabled = false
} else if (item.prop == 'icon') {
item.hidden = false
}
})
this.menuForm = _.cloneDeep(this.form)
this.handleClose()
break
case 'btnCreate':
this.isOpen = true
this.menuDialogTitle = '新增菜单'
this.menuData.map(item => {
if (item.prop == 'type') {
item.children = this.$Constants.MENU_OTYPE
item.disabled = false
} else if (item.prop == 'icon') {
item.hidden = true
}
})
this.menuForm = _.cloneDeep(this.form)
this.menuForm.ppId = scope.id
this.handleClose()
break
case 'edit':
this.menuDialogTitle = '编辑菜单'
this.menuData.map(item => {
if (item.prop == 'type') {
item.disabled = true
} else if (item.prop == 'icon') {
item.hidden = !(scope.parentId == 0)
}
})
this.isOpen = false
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope)
break
}
},
// 编辑触发事件
editEvent(row) {
if (row.parentId == 0) {
this.menuData[0].children = this.$Constants.MENU_TYPE
this.menuData[1].hidden = true
} else {
this.menuData[0].children = this.$Constants.MENU_OTYPE
this.menuData[1].hidden = false
}
menuInfo({ menuId: row.id }).then(res => {
this.menuForm = JSON.parse(JSON.stringify(res.data))
this.menuForm.enableStatus = res.data.enableStatus == 1 ? true : false
this.menuForm.type = res.data.type + ''
this.handleClose(res.data)
})
},
// 删除触发事件
deleteEvent(row) {
console.log(row)
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
deleteMenu({ menuId: row.id }).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$root.parentVuex.dispatch('menu/updateMenu', row.id);
if (row.parentId == 0) {
this.getList()
} else {
getMenuChildren({ parentId: row.parentId }).then(res => {
const nodes = res.data
this.$set(this.$refs.menuTable.store.states.lazyTreeNodeMap, row.ppId, nodes)
})
}
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
}
this.$Common.confirmDialog(tipData)
},
load(tree, treeNode, resolve) {
getMenuChildren({ parentId: tree.menuNo }).then(res => {
resolve(res.data)
})
},
// 上级弹窗
selectSuperior() {
if (this.isOpen) {
this.getPermtree()
this.closeFilter()
}
},
closeFilter() {
this.filterVisible = !this.filterVisible
},
filterConfirm() {
this.menuForm.parentId = this.$refs.tree.getCurrentNode().id
this.menuForm.parentName = this.$refs.tree.getCurrentNode().label
this.closeFilter()
},
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
getList(params) {
getMenuList(params).then((res) => {
if (res.code == 200) {
this.total = res.data.totalElements
this.menuTableData = res.data.list
} else {
this.menuTableData = []
}
})
},
// 获取上级菜单
getPermtree() {
getPermtree().then(res => {
if (res.code = 200) {
this.filterTextData = res.data
}
})
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value
this.search()
},
handleCurrentChange(value) {
this.page.pageNumber = value
this.search()
},
radioChange(event, prop) {
if (event != 1) {
this.menuData.map(item => {
if (item.prop == 'parentName') {
item.hidden = false
}
})
} else {
this.menuData.map(item => {
if (item.prop == 'parentName') {
item.hidden = true
}
})
}
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div class="system-container">
<div class="orginiza-container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="orginizaFormList"
>
<span
class="inline-b"
slot="form-slot"
>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
@click="search"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</span>
</search-form>
<h3>组织管理
<div class="pull-right">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="btnClick('root')"
>新增根组织</el-button>
</div>
</h3>
<el-table
ref="table"
:data="orginTableData"
style="width: 100%"
row-key="id"
highlight-current-row
lazy
stripe
:load="load"
:row-style="tableRowClassName"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column
v-for="(item,index) in listHeadData"
:key="index"
:prop="item.prop"
:sortable="item.sortable"
:ref="item.ref"
:width="item.width"
:label="item.label"
show-overflow-tooltip
>
<template slot-scope="scope">
<template v-if="item.prop === 'enableStatus'">
<span
class="dot"
:class="scope.row.enableStatus ? ORGINIZASTATUS[scope.row.enableStatus].split(',')[1] : ''"
></span>
<span class="statusText">{{ scope.row.enableStatus ? ORGINIZASTATUS[scope.row.enableStatus].split(',')[0] : '--'}}</span>
</template>
<template v-else>
{{scope.row[item.prop]?scope.row[item.prop]:'--'}}
</template>
</template>
</el-table-column>
<el-table-column
align="center"
width="250"
fixed="right"
prop="btn"
label="操作"
>
<template slot-scope="scope">
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.row)"
>{{j.name}}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageNum"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<basic-dialog
:title="orginizaDialogTitle"
:isVisible="orginizaVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="orginizaForm"
:rules="orginizaRules"
:ruleData="orginizaData"
ref='orginizaForm'
></rule-form>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
import _ from 'lodash'
import { getTableList, getChildren, addOrganiza, editOrganiza, deleteOrganiza, organizaInfo } from 'services/orginizaManage'
export default {
data() {
return {
ORGINIZASTATUS: this.$Constants.ORGINIZA_STATUS,
searchForm: {},
orginizaFormList: [
{
type: 'input',
inputType: 'text',
prop: 'orgName',
placeholder: '请输入组织名称'
},
{
type: 'select',
prop: 'enableStatus',
placeholder: '请选择组织状态',
options: [{
value: '1',
label: '正常'
}, {
value: '2',
label: '停用'
}]
}
],
orginTableData: [],
listHeadData: [ // 列表 头部设置 数据
{ prop: 'departmentName', label: '组织名称', width: 300 },
{ prop: 'orderNum', label: '排序' },
{ prop: 'enableStatus', label: '状态' },
{ prop: 'createdDate', label: '创建时间' }
],
page: {
pageSize: 10,
pageNumber: 1
},
total: 10,
tableParams: {
tableOption: {
btnList: [
{
name: '新增',
pType: 'create'
},
{
name: '编辑',
pType: 'edit'
},
{
name: '删除',
pType: 'delete'
}
]
}
},
// 弹窗数据
orginizaDialogTitle: '新增组织',
orginizaVisible: false,
orginizaForm: {
superiorName: '',
enableStatus: true
},
form: {
enableStatus: true
},
orginizaData: [
{ label: '上级组织:', prop: 'superiorName', type: 'input', hidden: false, readonly: true },
{ label: '组织名称:', prop: 'departmentName', type: 'input', maxlength: 20 },
{ label: '显示排序:', prop: 'orderNum', type: 'input', maxlength: 5 },
{ label: '组织状态:', prop: 'enableStatus', type: 'switch' }
],
orginizaRules: {
departmentName: [{ required: true, message: '请输入组织名称', trigger: 'blur' }],
orderNum: [{ required: true, message: '请输入显示排序', trigger: 'blur' },
{ validator: this.$Common.checkRegExpNumber, trigger: 'blur' }],
enableStatus: [{ required: true }]
},
// 部门弹窗
isRoot: false
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val)
}
},
mounted() {
this.search()
},
methods: {
search() {
let params = Object.assign({}, this.searchForm, this.page)
this.getList(params)
},
// 重置搜索条件
refresh() {
this.searchForm = {}
this.search()
},
emptyData(params) {
let arr = params
for (let key in arr) {
if (params[key] == null || params[key] == '' || params[key] == []) {
delete params[key]
}
}
return arr
},
// 确定,新增组织、编辑组织
handleConfirm() {
this.$refs.orginizaForm.$children[0].validate((valid) => {
if (valid) {
let params = {
departmentName: this.orginizaForm.departmentName,
enableStatus: this.orginizaForm.enableStatus ? 1 : 2,
orderNum: this.orginizaForm.orderNum
}
if (this.orginizaForm.superiorId) params.superiorId = this.orginizaForm.superiorId
let api = addOrganiza
if (this.orginizaForm.id) {
api = editOrganiza
params.id = this.orginizaForm.id
}
api(params).then(res => {
if (res.code = 200) {
this.$message({
type: 'success',
message: '操作成功'
})
if (this.isRoot) {
this.search()
} else {
getChildren({ rootId: params.superiorId }).then(res => {
const nodes = res.data
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, params.superiorId, nodes)
})
}
this.handleClose()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
})
},
// 取消
handleClose() {
if (!this.orginizaVisible && this.$refs.orginizaForm) {
this.$refs.orginizaForm.$children[0].resetFields()
}
this.orginizaVisible = !this.orginizaVisible
},
// 按钮事件
btnClick(pType, scope) {
switch (pType) {
case 'root':
this.isRoot = true
this.orginizaData[0].hidden = true
this.orginizaForm = {
enableStatus: true
}
this.orginizaDialogTitle = '新增根组织'
this.handleClose()
break
case 'create':
this.isRoot = false
this.orginizaData[0].hidden = false
const obj = {
superiorId: scope.id,
superiorName: scope.departmentName,
enableStatus: true
}
this.orginizaForm = obj
this.orginizaDialogTitle = '新增组织'
this.handleClose()
break
case 'edit':
this.orginizaDialogTitle = '编辑组织'
this.editEvent(scope)
break
case 'delete':
organizaInfo({ id: scope.id }).then(res => {
this.deleteEvent(res.data)
})
break
}
},
// 编辑触发事件
editEvent(row) {
organizaInfo({ id: row.id }).then(res => {
this.orginizaForm = _.cloneDeep(res.data)
this.orginizaForm.enableStatus = row.enableStatus == 1 ? true : false
if (!this.orginizaForm.superiorId) {
this.orginizaData[0].hidden = true
this.isRoot = true
} else {
this.isRoot = false
}
this.handleClose()
})
},
// 删除触发事件
deleteEvent(row) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
deleteOrganiza({ id: row.id }).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
})
if (!row.superiorId) {
this.search()
} else {
getChildren({ rootId: row.superiorId }).then(res => {
const nodes = res.data
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, row.superiorId, nodes)
})
}
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
}
this.$Common.confirmDialog(tipData)
},
// 树形table懒加载
load(tree, treeNode, resolve) {
console.log(tree, treeNode, resolve)
getChildren({ rootId: tree.id }).then(res => {
let nodes = res.data
resolve(nodes)
})
},
// 获取根节点列表
getList(params) {
getTableList(params).then((res) => {
if (res.code == 200) {
this.total = res.data.totalElements
this.orginTableData = res.data.list
} else {
this.orginTableData = []
}
})
},
// 子节点列表
getChildren(id) {
getChildren({ rootId: id }).then(res => {
return res.data
})
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value
this.search()
},
handleCurrentChange(value) {
this.page.pageNumber = value
this.search()
},
tableRowClassName() {
return 'padding-left: 16px;'
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div class="system-container">
<div class="container">
<search-form class="searchTop border-shadow" :formModel="searchForm" :formList="roleFormList">
<span class="inline-b" slot="form-slot">
<el-button type="primary" :size="btn_size" icon="el-icon-search" :id="tableParams.btnId">搜索</el-button>
<el-button type="primary" :size="btn_size" icon="el-icon-refresh" @click="refresh">重置</el-button>
</span>
</search-form>
<h3>
角色管理
<div class="pull-right">
<el-button type="primary" :size="btn_size" icon="el-icon-plus" @click="btnClick('create')">新增</el-button>
</div>
</h3>
<basic-table ref="roleTable" :tableParams="tableParams" :getListApi="getListApi" :searchForm="searchForm" :hasNum="false">
<span slot="status" slot-scope="scope">
<span class="dot" :class="
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(',')[1]
: ''
"></span>
<span class="statusText">{{
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(",")[0]
: "--"
}}</span>
</span>
<span slot="table-button" slot-scope="scope">
<el-button v-for="(j, idx) in tableParams.tableOption.btnList" :key="idx" :type="j.type || 'text'" :size="btn_size" @click="btnClick(j.pType, scope.scope)">{{ j.name }}</el-button>
</span>
</basic-table>
<basic-dialog class="role" :title="roleDialogTitle" :isVisible="roleVisible" @confirmDialog="handleConfirm" @closeDialog="handleClose">
<slot>
<rule-form :ruleForm="roleForm" :rules="roleRules" :ruleData="roleData" :labelWidth="'140px'" ref="roleForm">
<div slot="visible-type">
<el-radio-group @change="radioChange(roleForm.roleVisibility)" v-model="roleForm.roleVisibility">
<el-radio v-for="(child, childIndex) in visibilityList" :key="childIndex" :label="child.code">{{ child.value }}</el-radio>
</el-radio-group>
<el-select v-if="roleForm.roleVisibility == 2" v-model="roleForm.roleTenants" placeholder="请选择" multiple filterable>
<el-option v-for="i in tenantList" :key="i.tenantId" :label="i.departmentName" :value="i.tenantId">
</el-option>
</el-select>
</div>
<div slot="service-visibility" class="settle_box">
<el-select v-model="roleForm.bizPermissionType">
<el-option v-for="(item,index) in permissionTypeList" :key="index" :label="item.label" :value="item.value"></el-option>
<!-- <el-option label="结清数据2" value="2"></el-option> -->
</el-select>
<div class="el_switch_box">
<el-switch v-model="dataVisibilityList[roleForm.bizPermissionType]" :active-value="1" :inactive-value="2">
</el-switch>
<span class="tips">{{dataVisibilityList[roleForm.bizPermissionType] == 1?'可见':'不可见'}}</span>
</div>
</div>
<div slot="data-auth">
<el-radio-group @change="radioChange(roleForm.roleVisibility)" v-model="roleForm.rolePermissionType">
<el-radio v-for="(child, childIndex) in $Constants.ROLEAUTH_LIST" :key="childIndex" :label="child.value">{{ child.label }}</el-radio>
</el-radio-group>
<el-select v-if="roleForm.rolePermissionType == 6" v-model="roleForm.permTenants" placeholder="请选择" multiple filterable>
<el-option v-for="i in permissionList" :key="i.tenantId" :label="i.tenantName" :value="i.tenantId">
</el-option>
</el-select>
</div>
<el-tree slot="menu-list" :data="treedata" show-checkbox default-expand-all node-key="id" ref="tree" :check-strictly="true" highlight-current>
</el-tree>
</rule-form>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
import {
getRoleList,
roleInfo,
getTenantList,
addRole,
editRole,
deleteRole,
getMenuTree,
getVisibility,
getPermission,
} from "services/role";
export default {
data() {
var checkMenu = (rule, value, callBack) => {
if (value && value.length == 0) {
return callBack(new Error("请选择菜单列表"));
} else {
return callBack();
}
};
var checkRoleVisibility = (rule, value, callBack) => {
if (value && value == 2 && this.roleForm.roleTenants.length == 0) {
return callBack(new Error("请选择指定租户"));
} else {
return callBack();
}
};
var checkRolePermissionType = (rule, value, callBack) => {
if (value && value == 6 && this.roleForm.permTenants.length == 0) {
return callBack(new Error("请选择指定数据权限"));
} else {
return callBack();
}
};
return {
USERSTATUS: this.$Constants.USER_STATUS,
searchForm: {},
roleFormList: [
{
type: "input",
inputType: "text",
prop: "roleName",
placeholder: "请输入角色名称",
},
],
tableParams: {
// mutiSelectName: 'role',
// mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: "角色名称",
prop: "roleName",
},
{
label: "备注",
prop: "remark",
},
{
label: "状态",
prop: "enableStatus",
addHtml: "status",
},
{
label: "创建时间",
prop: "createdDate",
},
],
tableOption: {
width: 300,
btnList: [
{
name: "编辑",
pType: "edit",
},
{
name: "删除",
pType: "delete",
},
],
},
},
getListApi: getRoleList,
// 弹窗数据
roleDialogTitle: "新增角色",
roleVisible: false,
roleForm: {
enableStatus: true,
menuIdList: [],
bizPermissionType: 1,
},
roleData: [
{ label: "角色名称:", prop: "roleName", type: "input", maxlength: 50 },
{
label: "备注:",
prop: "remark",
type: "input",
inputText: "textarea",
maxlength: 200,
showWordLimit: true,
},
{ label: "状态:", prop: "enableStatus", type: "switch" },
{
label: "租户可见度:",
prop: "roleVisibility",
type: "customize",
slotName: "visible-type",
},
{
label: "数据权限:",
prop: "rolePermissionType",
type: "customize",
slotName: "data-auth",
// children: this.$Constants.ROLE_AUTH
},
{
label: "业务数据可见度:",
prop: "bizPermissionType",
type: "customize",
slotName: "service-visibility",
// children: this.$Constants.ROLE_AUTH
},
{
label: "菜单权限:",
prop: "menuIdList",
type: "customize",
slotName: "menu-list",
},
],
roleRules: {
roleName: [
{ required: true, message: "请输入角色名称", trigger: "blur" },
{ validator: this.$Common.checkName, trigger: "blur" },
{
min: 3,
max: 50,
message: "长度在 3 到 50 个字符",
trigger: "blur",
},
],
enableStatus: [{ required: true }],
roleVisibility: [
{ required: true, message: "请选择租户可见度" },
{ validator: checkRoleVisibility, trigger: "change" },
],
rolePermissionType: [
{ required: true, message: "请选择数据权限" },
{ validator: checkRolePermissionType, trigger: "change" },
],
bizPermissionType: [
{
required: true,
message: "请选择业务数据可见度",
trigger: "change",
},
],
menuIdList: [{ required: true, validator: checkMenu, trigger: "blur" }],
},
treedata: [],
tenantList: [],
visibilityList: [],
permissionList: [],
dataVisibilityList: { 1: 2 },
permissionTypeList: [{ label: "结清数据", value: 1 }],
};
},
mounted() {
// this.getTenantList();
this.getVisibility();
// this.getPermission();
},
methods: {
// 重置搜索条件
refresh() {
this.searchForm = {};
this.$refs.roleTable.refreshTable();
},
// 确定
handleConfirm() {
this.getCheckedKeys();
this.$refs.roleForm.$children[0].validate((valid) => {
if (valid) {
let api = addRole;
let params = {
remark: this.roleForm.remark,
roleName: this.roleForm.roleName,
menuIdList: this.roleForm.menuIdList,
};
params.enableStatus = this.roleForm.enableStatus ? 1 : 2;
params.roleVisibility = Number(this.roleForm.roleVisibility);
params.rolePermissionType = Number(this.roleForm.rolePermissionType);
// params.bizPermissionType = this.roleForm.bizPermissionType;
// params.bizPermissionVisibility =
// this.roleForm.bizPermissionVisibility;
// 业务数据可见度
let row = this.dataVisibilityList;
let arr = [];
for (let k in row) {
let m = {};
m.type = k;
m.visibility = row[k];
arr.push(m);
}
params.bizDataPermissions = arr;
if (params.roleVisibility == 2) {
params.roleTenants = this.roleForm.roleTenants.toString();
}
if (params.rolePermissionType == 6) {
params.permTenants = this.roleForm.permTenants.toString();
}
if (this.roleForm.id) {
api = editRole;
params.roleId = this.roleForm.id;
}
api(params).then((res) => {
if (res.code == "200") {
this.$message({
type: "success",
message: "操作成功!",
});
this.handleClose();
this.$refs.roleTable.refreshTable();
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
}
});
},
// 取消
handleClose() {
if (!this.roleVisible && this.$refs.roleForm) {
this.$refs.roleForm.$children[0].resetFields();
}
this.roleVisible = !this.roleVisible;
if (!this.roleVisible) this.$refs.tree.setCheckedKeys([]);
},
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope);
switch (pType) {
case "create":
this.roleDialogTitle = "新增角色";
this.roleForm = {
enableStatus: true,
menuIdList: [],
bizPermissionType: 1,
};
this.getMenuTree();
this.getTenantList();
this.getPermission();
this.handleClose();
break;
case "edit":
this.roleDialogTitle = "编辑角色";
const params = { roleId: scope.id };
this.getTenantList(params);
this.getPermission(params);
this.editEvent(scope);
break;
case "delete":
this.deleteEvent(scope.id);
break;
}
},
// 编辑触发事件
editEvent(row) {
const that = this;
roleInfo({ id: row.id }).then((res) => {
let obj = res.data || {};
this.roleForm = JSON.parse(JSON.stringify(res.data));
this.roleForm.enableStatus = res.data.enableStatus == 1 ? true : false;
this.roleForm.roleVisibility = res.data.roleVisibility;
this.roleForm.rolePermissionType = res.data.rolePermissionType;
let list = obj.bizDataPermissions || [];
let options = {};
if (list && list.length > 0) {
list.map((k) => {
options[k.type] = k.visibility;
});
this.$set(this.roleForm, "bizPermissionType", Number(list[0].type));
} else {
// 针对历史数据,写个默认数据
options[1] = 2;
this.$set(this.roleForm, "bizPermissionType", 1);
}
this.dataVisibilityList = options;
if (res.data.roleTenants) {
this.roleForm.roleTenants = res.data.roleTenants
.split(",")
.map(Number);
}
if (res.data.permTenants) {
this.roleForm.permTenants = res.data.permTenants
.split(",")
.map(Number);
}
this.getMenuTree({ roleId: row.id });
this.handleClose(res.data);
});
},
// 删除触发事件
deleteEvent(id) {
const that = this;
const tipData = {
that: that,
tipText: "是否删除当前记录",
tipTitle: "提示",
type: "error",
callBack: () => {
deleteRole({ id: id }).then((res) => {
if (res.code == "200") {
this.$message({
type: "success",
message: "删除成功!",
});
this.$refs.roleTable.refreshTable();
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
},
};
this.$Common.confirmDialog(tipData);
},
// 获取菜单权限列表
getMenuTree(params) {
getMenuTree(params).then((res) => {
this.treedata = res.data.menuTree;
setTimeout(() => {
this.$refs.tree.setCheckedKeys(res.data.checkedIds);
}, 1000 / 60);
});
},
// 获取选中菜单数组
getCheckedKeys() {
this.roleForm.menuIdList = this.$refs.tree.getCheckedKeys();
},
// 获取角色可见度可选项
getVisibility() {
getVisibility().then((res) => {
console.log(res.data);
this.visibilityList = res.data;
});
},
// 获取数据权限租户列表
getPermission(params) {
getPermission(params).then((res) => {
this.permissionList = res.data;
});
},
// 获取租户列表
getTenantList(params) {
getTenantList(params).then((res) => {
this.tenantList = res.data;
});
},
radioChange(e) {
this.$set(this.roleForm, "roleVisibility", e);
},
},
};
</script>
<style lang="scss">
.role .el-tree {
margin-top: 7px;
}
</style>
<style lang="scss" scoped>
.el_switch_box {
flex-shrink: 0;
display: flex;
align-items: center;
margin-left: 10px;
.tips {
font-size: 12px;
color: #333;
margin-left: 10px;
}
}
.settle_box {
display: flex;
align-items: center;
}
</style>
<template>
<div class="">
<el-tabs v-model="activeTabs">
<el-tab-pane label="选择数据" name="1">
<select-info ref="selectInfoCom" :id="id" :key="id"></select-info>
</el-tab-pane>
<el-tab-pane label="导入数据" name="2">
<import-vehicle ref="importVehicleCom" :id="id" :key="id" @monitorFlag="monitorFlag" @monitorChangeFlag="monitorChangeFlag"></import-vehicle>
</el-tab-pane>
<el-tab-pane label="按组织授权" name="3">
<authorization-info ref="authorizationInfoCom" :id="id" :key="id"></authorization-info>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import SelectInfo from "./select.vue";
import ImportVehicle from "./import.vue";
import AuthorizationInfo from "./authorization";
export default {
name: "AssignInfo",
components: {
SelectInfo,
ImportVehicle,
AuthorizationInfo,
},
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
activeTabs: "1",
userId: "",
randomKey: "",
monitorFlags: false,
showBtnFlag: true
};
},
watch: {
id: {
handler: function () {
console.log("key:", Math.random());
this.randomKey = Math.random();
},
},
},
mounted() {
this.userId = this.id;
},
methods: {
// 保存数据
saveInfo() {
let _id = this.activeTabs;
if (_id == 1) {
this.$refs.selectInfoCom.saveInfo();
return false;
}
if (_id == 3) {
this.$refs.authorizationInfoCom.saveInfo();
return false;
}
this.$refs.importVehicleCom.saveInfo();
},
monitorFlag(val) {
this.monitorFlags = val
},
monitorChangeFlag(val) {
if (val && !this.monitorFlags) {
this.showBtnFlag = true
}
if (this.monitorFlags) {
this.showBtnFlag = false
this.monitorFlags = !this.monitorFlags
}
this.$emit('showBtnFlags', this.showBtnFlag)
}
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div class="select_info_page">
<h2 class="title">注:按车辆所属组织层级直接授权数据,包括后续增加的车辆</h2>
<div class="device_box">
<div class="card_box">
<div class="head">请选择组织层级(支持多选)</div>
<div class="info_box">
<div class="search_box">
<el-input v-model="term" placeholder="请输入两位以上组织层级名称" suffix-icon="el-icon-search" @input="onSearch" @keyup.enter.native="onSearch"></el-input>
</div>
<div class="tree_box" v-loading="treeLoading">
<el-scrollbar class="el_scroll">
<el-tree ref="elTree" :data="organizationList" default-expand-all :props="treeProps" :default-checked-keys="checkKeys" show-checkbox node-key="id" :filter-node-method="filterNode">
</el-tree>
</el-scrollbar>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { GET_ORGZ_ASSIGN_INFO, SAVE_ORGZ_ASSIGN_INFO } from "@/services/user";
import { GET_ORIGINIZATION_LIST } from "@/services/orginizaManage";
import { deepClone, showToast, broadcast, received } from "@/utils/util";
export default {
name: "AuthorizationInfo",
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
term: "",
organizationList: this.$store.state.organizationUserTree,
treeLoading: false,
treeProps: {
label: "label",
children: "children",
isLeaf: "leaf",
["node-key"]: "id",
},
checkKeys: [],
};
},
created() {
},
mounted() {
let list = this.$store.state.organizationUserTree;
if (!list || list.length <= 0) {
this.getList();
}
this.getInfo();
},
methods: {
// 获取组织树列表
getList() {
this.treeLoading = true;
GET_ORIGINIZATION_LIST().then((res) => {
this.treeLoading = false;
this.organizationList = res.data || [];
this.$store.commit("updateTreeByOrganization", res.data || []);
});
},
// 搜索树
onSearch() {
let term = this.term;
if (term && term.length < 2) {
return false;
}
this.$refs.elTree.filter(term);
},
// 筛选树
filterNode(value, data) {
return data.label.indexOf(value) !== -1;
},
// 保存数据
async saveInfo() {
let _keys = this.$refs.elTree.getCheckedKeys();
let oParams = {};
oParams.receiverId = this.id;
oParams.orgzIds = _keys;
console.log(_keys);
let res = await SAVE_ORGZ_ASSIGN_INFO(oParams);
console.log(res);
broadcast("cancel-loading");
if (res.code == 200) {
showToast({
message: "保存成功",
type: "success",
});
broadcast("assign-success");
}
},
// 获取详情
getInfo() {
let oParams = {};
oParams.receiverId = this.id;
GET_ORGZ_ASSIGN_INFO(oParams).then((res) => {
this.checkKeys = res.data || [];
});
},
},
};
</script>
<style lang="scss" scoped>
.select_info_page {
.title {
font-family: PingFangSC-Regular;
font-size: 14px;
color: #666666;
font-weight: 400;
}
.device_box {
display: flex;
justify-content: space-between;
.card_box {
flex: 1;
//width: 380px;
flex-shrink: 0;
box-sizing: border-box;
.head {
height: 54px;
line-height: 54px;
background: #f5f7fa;
padding: 0 16px;
font-family: PingFangSC-Regular;
font-size: 14px;
color: #333333;
font-weight: 400;
}
.info_box {
border: 1px solid #eee;
.search_box {
padding: 10px;
.input_select {
width: 100%;
::v-deep .el-input-group__prepend {
background: #fff !important;
//padding: 0 10px;
padding-left: 10px;
.el-select {
width: 90px;
box-sizing: border-box;
}
}
}
}
.tree_box {
border-top: 1px solid #eee;
.el_scroll {
padding: 10px 0;
height: 340px;
box-sizing: border-box;
overflow-y: auto;
}
}
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="imort_page">
<div class="choose_box">
<div class="upload_wrap">
<el-input placeholder="请选择需要导入的车辆表格" v-model="uploadFile.name" readonly>
<el-button slot="append">选择文件</el-button>
</el-input>
<!-- 隐藏上传文件按钮 开始 -->
<el-upload ref="uploadBox" class="upload_box" :auto-upload="false" :headers="uploadHead" :accept="acceptFile" :data="uploadParams" :action="uploadPath" multiple :show-file-list="false" :on-change="onChange" :on-success="onSuccess" :before-upload="beforeUpload" :on-error="onError" :file-list="fileList">
<el-button type="primary">点击上传</el-button>
</el-upload>
<!-- 隐藏上传文件按钮 end -->
</div>
<el-link type="primary" class="el_link" @click="downTemplate">下载模版</el-link>
</div>
<!-- <div class="btn_group">
<el-button type="default" size="small">取消</el-button>
<el-button type="primary" size="small">确定</el-button>
</div> -->
<!-- 导入结果 开始 -->
<div class="upload_result" v-if="uploadResult && (uploadResult.total || uploadResult.total == 0)">
<h2 class="title">导入结果</h2>
<div class="result_box">
<div class="cell">
<div class="name">
<span>成功记录</span>
</div>
<span class="txt">{{uploadResult.succNum||0}}</span>
</div>
<div class="cell">
<div class="name">
<span>失败记录</span>
<span class="btn" v-if="uploadResult.failFile" @click="downloadFail()">导出记录</span>
</div>
<span class="txt">{{uploadResult.failNum||0}}</span>
</div>
</div>
</div>
<!-- 导入结果 end -->
</div>
</template>
<script>
import {
IMPORT_VEHICLE_TEMPLATE,
DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE,
} from "@/services/user";
import { showToast, broadcast } from "@/utils/util";
export default {
name: "ImportVehicle",
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
fileInfo: "",
uploadPath: "",
uploadHead: {},
uploadFile: {},
uploadParams: {},
uploadResult: {},
acceptFile: ".xlsx,.xls",
fileList: []
};
},
mounted() {
let id = this.id;
let token = localStorage.getItem("token");
this.uploadPath =
this.$root.parentVuex.getters.baseURL + IMPORT_VEHICLE_TEMPLATE;
this.uploadHead = { Authorization: token };
this.uploadParams = { receiverId: id };
},
methods: {
// 监听文件选择
onChange(file, fileList) {
console.log(file);
console.log(fileList);
if (!file.response) {
this.uploadFile = file;
this.fileList = [file];
}
this.$emit('monitorChangeFlag', true)
},
// 下载失败文件
downloadFail() {
let o = this.uploadResult;
window.open(o.failFile);
},
// 文件上传前
beforeUpload() {
this.uploadResult = {};
},
// 文件上传失败
onError(err, file, fileList) {
console.log(err);
},
// 监听文件上传成功
onSuccess(response, file, fileList) {
console.log(response);
this.$emit('monitorFlag', true)
let _this = this;
broadcast("cancel-loading");
_this.$refs.uploadBox.clearFiles();
if (response.code != 200) {
showToast({
message: response.message,
});
_this.uploadFile = {};
_this.fileList = [];
return false;
}
this.uploadResult = response.data;
broadcast("import-success");
},
// 上传文档
saveInfo() {
let o = this.uploadFile;
console.log(this.fileList);
console.log(o);
if (!o || !o.name) {
showToast({
message: "请选择文件",
});
broadcast("cancel-loading");
return false;
}
let list = o.name.split('.')
let acceptFile = this.acceptFile;
let _type = list[list.length-1];
let idx = acceptFile.includes(_type)
if(!idx){
showToast({
message: `导入文件只支持${acceptFile}`,
});
broadcast("cancel-loading");
return false;
}
this.$refs.uploadBox.submit();
},
// 下载模板
downTemplate() {
DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE().then((res) => {
let { data } = res;
window.open(data.dictValue);
});
},
},
};
</script>
<style lang="scss" scoped>
.choose_box {
display: flex;
align-items: center;
padding: 10px 72px;
.el_link {
flex-shrink: 0;
text-align: left;
margin: 0 10px;
}
.upload_wrap {
flex: 1;
position: relative;
.upload_box {
position: absolute;
right: 0;
bottom: 0;
top: 0;
opacity: 0;
}
}
}
.btn_group {
padding: 20px 0 10px 0;
text-align: center;
}
.upload_result {
border-top: 1px solid #eee;
margin-top: 30px;
.title {
font-family: PingFangSC-Medium;
font-size: 20px;
color: #333333;
font-weight: 500;
}
.result_box {
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 30px;
.cell {
width: 248px;
height: 108px;
background: #fbfbfb;
border: 1px solid rgba(215, 215, 215, 1);
border-radius: 4px;
margin: 0 20px;
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px;
box-sizing: border-box;
.name {
font-family: PingFangSC-Medium;
font-size: 14px;
color: #666666;
font-weight: 500;
display: flex;
align-items: center;
.btn {
width: 76px;
height: 30px;
border: 1px solid rgba(33, 150, 243, 1);
border-radius: 4px;
text-align: center;
line-height: 28px;
font-family: PingFangSC-Regular;
font-size: 14px;
color: #409eff;
font-weight: 400;
cursor: pointer;
margin-left: 10px;
}
.btn:hover {
opacity: 0.8;
}
}
.txt {
font-family: PingFangSC-Medium;
font-size: 30px;
color: #333333;
font-weight: 500;
line-height: 1.5;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="system-container">
<div class="user-tree border-shadow">
<div class="user-tree-top">
<span>组织架构</span>
</div>
<el-input size="mini"
placeholder="输入内容搜索"
v-model="orgName"
@input="treeInput"></el-input>
<el-tree :data="treedata"
accordion
node-key="id"
highlight-current
@node-click="handleNodeClick"
:render-content="renderContent">
</el-tree>
</div>
<div class="user-container">
<search-form class="searchTop border-shadow"
:formModel="searchForm"
:formList="userFormList">
<span class="inline-b"
slot="form-slot">
<el-button type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId">搜索</el-button>
<el-button type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh">重置</el-button>
</span>
</search-form>
<h3>
用户管理
<div class="pull-right">
<el-button type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="btnClick('create')">新增</el-button>
</div>
</h3>
<basic-table ref="userTable"
:tableParams="tableParams"
:searchForm="searchForm"
:getListApi="getListApi"
:hasNum="false">
<span slot="status"
slot-scope="scope">
<span class="dot"
:class="
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(',')[1]
: ''
"></span>
<span class="statusText">{{
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(",")[0]
: "--"
}}</span>
</span>
<span slot="table-button"
slot-scope="scope">
<el-button v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.scope)">{{ j.name }}</el-button>
<!-- <el-link @click="openDialog(scope.scope)">指定数据</el-link> -->
<auth-link type="primary"
size="mini"
class="auth_link"
name="指定数据"
@click.native="openDialog(scope.scope)">指定数据</auth-link>
</span>
</basic-table>
<basic-dialog :title="userDialogTitle"
:isVisible="userVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
:btnLoading="btnLoading">
<slot>
<rule-form :ruleForm="userForm"
:rules="userRules"
:ruleData="userData"
ref="userForm">
<div class=""
slot="specialLogin">
<el-switch v-model="userForm.specialLogin"
active-text="开"
inactive-text="关"
:active-value="1"
:inactive-value="0"></el-switch>
<el-tooltip class="item"
effect="dark"
content="“特殊登录”开关打开后,会限制用户只能在某一台电脑登录,并且无法登录“e盾+”小程序,请谨慎使用!"
placement="top-start">
<i class="el-icon-question form_tips"></i>
</el-tooltip>
<template v-if="userForm.id && userForm.resetFlag">
<el-button type="primary"
size="mini"
class="rest_button"
@click="restLogin(userForm.id)">重置UID</el-button>
<el-tooltip class="item"
effect="dark"
content="用户更换常用电脑后,无法正常登录新e盾系统,可使用“重置UID”功能重置认证状态,二次确定即生效。"
placement="top-start">
<i class="el-icon-question form_tips"></i>
</el-tooltip>
</template>
</div>
</rule-form>
</slot>
</basic-dialog>
<basic-dialog :title="filterDialogTitle"
:isVisible="filterVisible"
@confirmDialog="filterConfirm"
@closeDialog="closeFilter">
<slot>
<el-input placeholder="输入关键字进行过滤"
v-model="filterText"
size="small">
</el-input>
<el-tree class="filter-tree"
:data="filterTextData"
:filter-node-method="filterNode"
highlight-current
ref="tree"
node-key="id"
check-on-click-node>
</el-tree>
</slot>
</basic-dialog>
</div>
<!-- 指定数据弹框 开始 -->
<glsx-dialog :show="showDialog"
title="指定数据"
@close="closeDialog()"
width="900px">
<div>
<assign-info ref="assignInfo"
v-if="showDialog"
:id="currentUserId"
@showBtnFlags="showBtnFlags"></assign-info>
</div>
<template slot="footer">
<el-button type="default"
size="small"
@click="closeDialog">取消</el-button>
<el-button type="primary"
size="small"
:loading="loading"
@click="saveInfo"
v-show="showFlags">确定</el-button>
</template>
</glsx-dialog>
<!-- 指定数据弹框 end -->
</div>
</template>
<script>
import {
getUserList,
getSuperUser,
addUser,
editUser,
detailUser,
deleteUser,
roleList,
dictInfo,
resetPassword,
JUDGE_USER_BINDVEHICLE,
REST_USER_UUID,
} from "services/user";
import { getSimpleList, getTreeOrg } from "services/orginizaManage";
import GlsxDialog from "@/components/dialog";
import AssignInfo from "./assign.vue";
import AuthLink from "@/components/auth-button/link";
import { received, showModal, showToast } from "@/utils/util";
export default {
components: {
GlsxDialog,
AssignInfo,
AuthLink,
},
data() {
return {
USERSTATUS: this.$Constants.USER_STATUS,
orgName: "",
isExpand: false,
searchForm: {},
userFormList: [
{
type: "input",
inputType: "text",
prop: "searchField",
placeholder: "请输入登录名称、用户名称、手机号码、用户ID",
},
{
type: "select",
prop: "userStatus",
placeholder: "请选择用户状态",
options: [
{
value: "1",
label: "正常",
},
{
value: "2",
label: "停用",
},
],
},
],
tableParams: {
// mutiSelectName: 'user',
// mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: "用户ID",
prop: "id",
},
{
label: "登录名称",
prop: "account",
},
{
label: "用户名称",
prop: "username",
},
{
label: "部门",
prop: "departmentName",
},
{
label: "手机号",
prop: "phoneNumber",
},
{
label: "状态",
prop: "enableStatus",
addHtml: "status",
},
{
label: "创建时间",
prop: "createdDate",
},
],
tableOption: {
width: 150,
btnList: [
{
name: "编辑",
pType: "edit",
},
{
name: "删除",
pType: "delete",
},
{
name: "重置密码",
pType: "reset",
},
],
},
},
getListApi: getUserList,
// 折叠菜单数据
treedata: [],
// 弹窗数据
userDialogTitle: "新增用户",
userVisible: false,
userForm: {
account: "",
departmentName: "",
superiorName: "",
enableStatus: true,
},
roleList: [],
userData: [
{
label: "登录名称:",
prop: "account",
type: "input",
clearable: true,
maxlength: 50,
},
{
label: "部门名称:",
prop: "departmentName",
type: "input",
readonly: true,
clickFunc: this.selectDepart,
},
{
label: "直接上级:",
prop: "superiorName",
type: "input",
readonly: true,
clickFunc: this.selectSuperior,
hidden: true,
},
{
label: "用户名称:",
prop: "username",
type: "input",
clearable: true,
maxlength: 50,
},
{
label: "密码:",
prop: "password",
type: "input",
inputText: "password",
showPassword: true,
},
{
label: "角色:",
prop: "roleId",
type: "select",
options: [],
key: "roleName",
value: "roleId",
filterable: true,
},
{ label: "邮箱:", prop: "email", type: "input" },
{ label: "手机:", prop: "phoneNumber", type: "input", maxlength: 11 },
{
label: "性别:",
prop: "gender",
type: "select",
options: [],
key: "dictLabel",
value: "dictValue",
visibleFunc: this.genderChange,
},
{ label: "状态:", prop: "enableStatus", type: "switch" },
{
label: "特殊登录:",
prop: "specialLogin",
type: "customize",
slotName: "specialLogin",
tips: "",
},
{
label: "岗位:",
prop: "position",
type: "select",
options: [],
key: "dictLabel",
value: "dictValue",
visibleFunc: this.positionChange,
},
],
userRules: {
account: [
{ required: true, message: "请输入登录名称", trigger: "blur" },
{ validator: this.$Common.checkName, trigger: "blur" },
{
min: 3,
max: 50,
message: "长度在 3 到 50 个字符",
trigger: "blur",
},
],
departmentName: [
{ required: true, message: "请选择部门名称", trigger: "change" },
],
username: [
{ required: true, message: "请输入用户名称", trigger: "blur" },
{ validator: this.$Common.checkName, trigger: "blur" },
{
min: 2,
max: 50,
message: "长度在 2 到 50 个字符",
trigger: "blur",
},
],
roleId: [{ required: true, message: "请选择角色", trigger: "change" }],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"],
},
],
phoneNumber: [
// { required: true, message: "请输入手机号", trigger: "blur" },
{ validator: this.$Common.checkRegExpPhoneTel, trigger: "blur" },
],
enableStatus: [{ required: true }],
},
addRule: [
{ required: true, message: "请输入密码", trigger: "blur" },
{ min: 6, max: 50, message: "长度在 6 到 50 个字符", trigger: "blur" },
],
sexList: [],
positionList: [],
btnLoading: false,
// 部门弹窗
filterDialogTitle: "选择组织",
filterVisible: false,
filterText: "",
filterTextData: [],
isOpen: true,
// 指定数据弹框
showDialog: false,
loading: false,
currentUserId: "",
showFlags: true,
};
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
$route(val) {
if (val.path == "/user") {
this.init();
}
},
},
mounted() {
let _this = this;
received("assign-success", this.closeDialog);
received("cancel-loading", function () {
_this.loading = false;
});
this.init();
},
methods: {
showBtnFlags(val) {
this.showFlags = val;
},
init() {
this.getTreeOrg();
// this.getRoleList();
this.getPosti();
this.getSex();
},
emptyData(params) {
let arr = params;
for (let key in arr) {
if (params[key] === null || params[key] === "" || params[key] === []) {
delete params[key];
}
}
return arr;
},
// 重置搜索条件
refresh() {
this.searchForm = {};
this.orgName = "";
this.getTreeOrg();
this.$refs.userTable.refreshTable();
},
// 确定,新增用户、编辑用户
handleConfirm() {
console.log(this.userForm);
this.$refs.userForm.$children[0].validate((valid) => {
if (valid) {
this.btnLoading = true;
let params = JSON.parse(JSON.stringify(this.userForm));
params.enableStatus = this.userForm.enableStatus ? 1 : 2;
//params.specialLogin = this.userForm.specialLogin ? 1 : 0;
delete params.departmentName;
delete params.superiorName;
delete params.createdDate;
delete params.roleName;
delete params.deptDepth;
delete params.tenant;
delete params.resetFlag;
this.emptyData(params);
let api = addUser;
if (params.id) api = editUser;
if (!params.phoneNumber) {
params.phoneNumber = 13800138000
}
api(params).then((res) => {
this.btnLoading = false;
if (res.code == "200") {
this.getTreeOrg();
this.$refs.userTable.refreshTable();
this.handleClose();
this.$message({
type: "success",
message: "操作成功!",
});
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
}
});
},
// 取消
handleClose(row) {
if (!this.userVisible && this.$refs.userForm) {
this.$refs.userForm.$children[0].resetFields();
}
this.userVisible = !this.userVisible;
},
// 组织架构节点
handleNodeClick(data) {
this.searchForm.departmentId = data.id;
this.$refs.userTable.handleCurrentChange(1);
// this.$refs.userTable.refreshTable();
},
// 树节点内容区的渲染
renderContent(h, { node, data, store }) {
const text =
node.data.userNumber === 0
? `${node.label}`
: `${node.label}(${node.data.userNumber}人)`;
return <span>{text}</span>;
},
// 按钮事件
btnClick(pType, scope) {
switch (pType) {
case "create":
this.isOpen = true;
this.userDialogTitle = "新增用户";
this.$set(this.userRules, "password", this.addRule);
this.userForm = {
departmentName: "",
superiorName: "",
enableStatus: true,
};
let gender = "";
if (this.sexList.length > 0) {
gender = this.sexList[0].dictValue;
}
this.getRoleList();
// this.userForm.gender = this.sexList.length > 0 ? this.sexList[0].dictValue + '' : ''
this.$set(this.userForm, "gender", gender);
this.userData.map((item) => {
if (item.prop == "superiorName") {
item.hidden = true;
}
});
this.handleClose();
break;
case "edit":
this.isOpen = false;
this.userDialogTitle = "编辑用户";
if (this.userRules.password) {
this.$set(this.userRules, "password", null);
}
this.getRoleList({ userId: scope.id });
this.editEvent(scope);
break;
case "delete":
this.deleteEvent(scope.id);
break;
case "reset":
const tipData = {
that: this,
tipText: "是否重置该用户密码",
tipTitle: "提示",
type: "warnning",
callBack: () => {
resetPassword({ id: scope.id }).then((res) => {
if (res.code == "200") {
this.$message({
type: "success",
message: "重置密码成功!",
});
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
},
};
this.$Common.confirmDialog(tipData);
break;
}
},
// 编辑触发事件
editEvent(row) {
detailUser({ id: row.id }).then((res) => {
this.userDialogTitle = "编辑用户";
this.userForm = JSON.parse(JSON.stringify(res.data));
this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false;
this.userData.map((item) => {
if (item.prop == "superiorName") {
item.hidden = this.userForm.deptDepth == 0;
} else if (item.prop == "gender") {
let flag = false;
item.options.map((i) => {
if (i.dictValue == this.userForm.gender) flag = true;
});
this.userForm.gender = flag ? this.userForm.gender + "" : "";
} else if (item.prop == "position") {
let isFlag = false;
item.options.map((j) => {
if (j.dictValue == this.userForm.position) isFlag = true;
});
this.userForm.position = isFlag ? this.userForm.position + "" : "";
}
});
this.handleClose(res.data);
});
},
// 删除触发事件
async deleteEvent(id) {
const that = this;
let res = await JUDGE_USER_BINDVEHICLE({ userId: id, types: [1] });
// true:可以删除,false:不能删除用户
if (!res.data) {
showModal({
title: "提示",
message: "该账户下有绑定车辆,若需要删除账户,请先移除对应车辆!",
type: "warning",
});
return false;
}
// const tipData = {
// that: that,
// tipText: "是否删除当前记录",
// tipTitle: "提示",
// type: "error",
// callBack: () => {
// deleteUser({ id: id }).then((res) => {
// if (res.code == "200") {
// this.$message({
// type: "success",
// message: "删除成功!",
// });
// this.$refs.userTable.refreshTable();
// } else {
// this.$message({
// type: "error",
// message: res.message,
// });
// }
// });
// },
// };
// this.$Common.confirmDialog(tipData);
showModal({
title: "提示",
message: "是否删除当前记录?",
type: "error",
showCancelButton: true,
success: function () {
deleteUser({ id: id }).then((res) => {
if (res.code == "200") {
showToast({
type: "success",
message: "删除成功!",
});
that.$refs.userTable.refreshTable();
} else {
showToast({
type: "error",
message: res.message,
});
}
});
},
});
},
// 部门弹窗
selectDepart() {
if (this.isOpen) {
this.filterText = "";
this.filterDialogTitle = "选择组织";
this.getSimpleList();
this.closeFilter();
}
},
// 上级弹窗
selectSuperior() {
this.filterText = "";
this.filterDialogTitle = "选择直接上级";
this.userForm.superiorName = "";
this.userForm.superiorId = "";
this.getSuperUser({ departmentId: this.userForm.departmentId });
this.closeFilter();
},
closeFilter() {
this.filterVisible = !this.filterVisible;
},
filterConfirm() {
if (this.filterDialogTitle == "选择直接上级") {
if (this.$refs.tree.getCurrentNode().disabled) {
this.$message("该选项不可选择为直接上级");
} else {
this.userForm.superiorId = this.$refs.tree.getCurrentNode().id;
this.userForm.superiorName = this.$refs.tree.getCurrentNode().label;
this.closeFilter();
}
} else {
this.userForm.departmentId = this.$refs.tree.getCurrentNode().id;
this.userForm.departmentName = this.$refs.tree.getCurrentNode().label;
this.userData.map((item) => {
if (item.prop == "superiorName") {
item.hidden = this.$refs.tree.getCurrentNode().depth == 0;
if (this.$refs.tree.getCurrentNode().depth == 0) {
delete this.userForm.superiorId;
delete this.userForm.superiorName;
}
}
});
this.closeFilter();
}
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 获取上级树
getSuperUser(params) {
getSuperUser(params).then((res) => {
this.filterTextData = res.data;
});
},
// 获取组织树
getSimpleList() {
getTreeOrg().then((res) => {
this.filterTextData = res.data;
});
},
// 获取组织架构
getTreeOrg(params) {
getTreeOrg(params).then((res) => {
this.treedata = res.data;
});
},
// 角色下拉列表
getRoleList(params = {}) {
roleList(params).then((res) => {
this.roleList = res.data;
this.userData[5].options = res.data;
});
},
// 组织架构搜索
treeInput(value) {
const params = {
orgName: value,
};
this.getTreeOrg(params);
this.isExpand = true;
},
// 岗位列表
getPosti(value) {
dictInfo("sys_position").then((res) => {
if (res.data.length > 0) {
this.deleteDict(res.data, "position", this.positionList);
}
});
},
// 获取性别列表
getSex() {
dictInfo("sys_user_sex").then((res) => {
if (res.data.length > 0) {
this.deleteDict(res.data, "gender", this.sexList);
}
});
},
/**
* 字典删除处理
* 参数:1.data: 字典数据, Array
* 2.name: 字段名, String
* 3.list: 可选择项的数组,Array
*/
deleteDict(data, name, list) {
const arr = [];
if (!data[0].typeDeleted) {
// 过滤未删除列表
data.map((item) => {
if (!item.deleted) arr.push(item);
});
this.userData.map((item) => {
if (item.prop == name) {
item.options = arr;
}
});
arr &&
arr.map((i) => {
if (!i.disabled) list.push(i);
});
}
},
/**
* 字典禁用处理
* 参数:1.name,字段名, String
* 2.label,字典名称,Strign
*/
disabledDict(name, label) {
this.userData.map((item) => {
if (item.prop == name) {
if (item.options[0].typeDeleted) {
this.$message({
type: "error",
message: `${label}已删除,请联系管理员解决`,
});
} else if (item.options[0].typeDisabled) {
this.$message({
type: "error",
message: `${label}已停用,请联系管理员解决`,
});
}
}
});
},
// 性别下拉框出现/隐藏回调
genderChange(e) {
if (e) this.disabledDict("gender", "性别");
},
// 岗位下拉框出现/隐藏回调
positionChange(e) {
if (e) this.disabledDict("position", "岗位");
},
selectChange(e) { },
// 指定数据
openDialog(row) {
console.log(row);
this.showDialog = true;
this.currentUserId = row.id;
},
// 关闭弹框
closeDialog() {
this.showDialog = false;
this.showFlags = true;
},
// 保存数据
saveInfo() {
this.loading = true;
this.$refs.assignInfo.saveInfo();
},
// 重置uuid
restLogin(id) {
let _this = this;
showModal({
message: "是否删除当前记录?",
showCancelButton: true,
success: function () {
REST_USER_UUID({ id: id }).then((res) => {
if (res.code == 200) {
showToast({
message: "重置成功",
type: "success",
});
}
});
},
});
},
},
};
</script>
<style rel="stylesheet/scss" lang="scss">
.el-tree-node > .el-tree-node__children {
overflow: initial !important;
}
</style>
<style lang="scss" scoped>
.auth_link {
font-size: 12px;
}
.form_tips {
margin: 0 10px;
cursor: pointer;
}
.rest_button {
margin-left: 10px;
}
</style>
<template>
<div class="select_info_page">
<h2 class="title">注:仅选择已安装设备的车辆,账户所属组织细节数据不可选</h2>
<div class="device_box">
<!-- 左侧未选择 开始 -->
<div class="card_box">
<div class="head">全部列表</div>
<div class="info_box">
<div class="search_box">
<el-autocomplete :placeholder="placeholderText" v-model="term" :trigger-on-focus="false" clearable class="input_select" :size="inputSize" :fetch-suggestions="searchEvent" @select="joinToRight">
<el-select v-model="termType" slot="prepend" placeholder="请选择" :size="inputSize" @change="changeSearchType">
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
</el-select>
</el-autocomplete>
<!-- <el-popover placement="bottom" width="200" trigger="manual" v-model="showPopover">
<div class="" slot="content">
</div>
<el-input slot="reference" :placeholder="placeholderText" v-model="term" class="input_select" :size="inputSize" @keyup.enter.native="searchEvent">
<el-select v-model="termType" slot="prepend" placeholder="请选择" :size="inputSize" @change="changeSearchType">
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
</el-select>
</el-input>
</el-popover> -->
</div>
<div class="tree_box">
<el-scrollbar class="el_scroll" v-loading="treeLoading">
<el-tree :data="vehicleList" :props="treeProps" :default-checked-keys="checkKeys" show-checkbox lazy node-key="id" :load="loadNode" :render-content="renderTreeContent" @check="onCheckChange">
</el-tree>
</el-scrollbar>
</div>
</div>
</div>
<!-- 左侧未选择 end -->
<!-- 中间按钮区域 开始 -->
<div class="middle_box">
<el-button type="primary" class="btn" icon="el-icon-arrow-right" size="small" :loading="ajaxloding" @click="moveToRight"></el-button>
<el-button type="primary" class="btn" icon="el-icon-arrow-left" size="small" :loading="ajaxloding" :disabled="!rightCheckList || rightCheckList.length<=0" @click="moveToLeft"></el-button>
<el-button type="primary" class="btn" icon="el-icon-d-arrow-left" size="small" :loading="ajaxloding" @click="clearSelect"></el-button>
</div>
<!-- 中间按钮区域 end -->
<!-- 右侧已选择 开始 -->
<div class="card_box">
<div class="head">已选列表({{checkList.length}}条)</div>
<div class="info_box">
<div class="search_box">
<el-input placeholder="请输入姓名|车架号" prefix-icon="el-icon-search" clearable :size="inputSize" v-model="checkSearchText" @keyup.enter.native="filterCars" @clear="filterCars">
</el-input>
</div>
<div class="tree_box">
<el-scrollbar ref="scrollbar" class="el_scroll" v-loading="rightLoading">
<el-checkbox-group class="el_checkbox_group" v-model="rightCheckList">
<el-checkbox v-for="(item,index) in showCheckList" :key="index" :label="item.id">
<span class="checkbox_label" :title="`${item.label}/${item.label1}`">{{showLabels(item)}}</span>
</el-checkbox>
</el-checkbox-group>
</el-scrollbar>
</div>
</div>
</div>
<!-- 右侧已选择 end -->
</div>
</div>
</template>
<script>
import {
GET_VEHICLE_TREE,
GET_USER_VEHICLE_LIST,
GET_ORGANIZATION_VEHICLE_LIST,
SAVE_USER_ASSIGN_INFO,
GET_USER_ASSIGN_INFO,
} from "@/services/user";
import { deepClone, showToast, broadcast, received } from "@/utils/util";
export default {
name: "SelectInfo",
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
term: "",
termType: "1",
inputSize: "medium",
checkSearchText: "",
checkList: [], // 所有已选择的车辆
showCheckList: [], // 动态渲染的列表
pageNum: 1, // 渲染下标
vehicleList: [],
treeProps: {
label: "label",
children: "children",
isLeaf: "leaf",
["node-key"]: "id",
},
temList: {}, // 临时存储车辆数据
checkKeys: [],
ajaxloding: false,
rightCheckList: [],
userId: "",
showPopover: false,
resultList: [],
placeholderText: "请输入至少两个关键字",
treeLoading: true,
rightLoading: true,
};
},
mounted() {
let list = this.$store.state.userVehicleTree;
console.log("树数据:", list);
if (!list || list.length <= 0) {
this.getList();
} else {
this.treeLoading = false;
this.vehicleList = list;
}
received("import-success", this.getInfo);
this.handleScroll();
this.getInfo();
},
methods: {
// 获取车辆树
getList() {
GET_VEHICLE_TREE().then((res) => {
this.treeLoading = false;
this.vehicleList = res.data || [];
this.$store.commit("updateUserOrganizationTree", res.data || []);
});
},
// 异步加载树
loadNode(node, resolve) {
console.log(node);
let _this = this;
let _cur = node.data;
let child = _cur.children || [];
let origin = _cur.origin;
if (child && child.length > 0) {
return resolve(child);
}
// 用户层级,查询该用户下面的车辆
if (origin && origin.type === "u") {
GET_USER_VEHICLE_LIST({ uIds: _cur.id,receiverId:_this.id }).then((res) => {
let list = res.data || [];
list.map((k) => {
k.leaf = true;
return k;
});
return resolve(list);
});
return false;
}
return resolve([]);
},
// 自定义展示数节点
renderTreeContent(h, { node, data, store }) {
if (data.leaf) {
return h("div", { class: "custom-tree-node" }, [
h("div", {
domProps: {
innerHTML: "姓名:" + node.data.label1 || "--",
},
}),
h("div", {
domProps: {
innerHTML: "车架号:" + node.data.label || "--",
},
}),
]);
}
return h("span", {
domProps: {
innerHTML: node.data.label,
},
});
},
// 监听组织树勾选
onCheckChange(data, e) {
console.log(data);
let _this = this;
let checkKeys = e.checkedKeys || [];
let idx = checkKeys.findIndex((k) => k == data.id);
let checked = idx >= 0 ? true : false;
_this.ajaxloding = true;
// 直接勾选车辆
if (data.leaf) {
_this.setList(data, [data], checked);
_this.ajaxloding = false;
return false;
}
// 如果是用户
if (data.origin.type == "u") {
GET_USER_VEHICLE_LIST({ uIds: data.id,receiverId:_this.id }).then((res) => {
_this.ajaxloding = false;
let list = res.data || [];
_this.setList(data, list, checked);
});
return false;
}
// 取消勾选,不查询接口
if (!checked) {
_this.ajaxloding = false;
_this.setList(data, [], checked);
return false;
}
GET_ORGANIZATION_VEHICLE_LIST({ oIds: data.id,receiverId:_this.id })
.then((res) => {
_this.ajaxloding = false;
_this.setList(data, res.data, checked);
})
.catch((error) => {
_this.ajaxloding = false;
});
},
// 处理车辆数据
setList(data, list, checked) {
let _this = this;
let temList = deepClone(_this.temList);
console.log(temList);
// 勾选状态
if (checked) {
temList[data.id] = list;
_this.temList = temList;
return false;
}
// 取消勾选
delete temList[data.id];
_this.temList = temList;
console.log(_this.temList);
},
// 移动到已选择
moveToRight() {
let _this = this;
let list = deepClone(_this.checkList);
let temList = deepClone(_this.temList);
let arr = [];
for (var k in temList) {
arr = arr.concat(temList[k]);
}
// 去重
// 首先构造Object
const idSet = list.reduce((acc, v) => {
acc[v.id] = true;
return acc;
}, {});
// 遍历arr,去掉在idSet中存在的id
const result = arr.filter((v) => !idSet[v.id]);
if (result && result.length > 0) {
list = result.concat(list);
}
_this.checkList = list;
// 每次添加新数据,先清空,然后重新渲染
_this.pageNum = 1;
_this.showCheckList = [];
_this.loadList();
//_this.temList = {};
},
// 删除已选择
moveToLeft() {
let cList = this.rightCheckList;
let list = this.checkList;
let showList = this.showCheckList;
// 首先构造Object
const idSet = cList.reduce((acc, v) => {
acc[v] = true;
return acc;
}, {});
// 遍历arr,去掉在idSet中存在的id
let result = list.filter((v) => !idSet[v.id]);
let showResult = showList.filter((v) => !idSet[v.id]);
console.log(result);
this.showCheckList = showResult;
this.checkList = result;
this.rightCheckList = [];
},
// 加载列表
loadList() {
let list = deepClone(this.checkList);
let arr = deepClone(this.showCheckList);
let size = 100;
let pageNum = Number(this.pageNum);
let start = (pageNum - 1) * size;
let end = pageNum * size;
let filterList = list;
// 从筛选的数据查询
if (this.checkSearchText) {
filterList = this.filterDate();
}
let next = filterList.slice(start, end);
let newList = arr.concat(next);
this.showCheckList = newList;
console.log(newList);
this.pageNum += 1;
},
// 监听滚动
handleScroll() {
let _this = this;
let scrollbarEl = this.$refs.scrollbar.wrap;
let h = scrollbarEl.offsetHeight; // 可视区域高度
scrollbarEl.onscroll = () => {
let sTop = scrollbarEl.scrollTop; // 滚动条当前位置
let sHeight = scrollbarEl.scrollHeight; //整个滚动高度
if (sHeight - h - sTop <= 60) {
_this.loadList();
}
};
},
// 展示数据
showLabels(row) {
if (!row) {
return "";
}
let str = "";
let vin = row.label||'--';
let _name = row.label1||'--';
let _label = _name||'--';
// if (_name && _name.length >= 10) {
// _label = _name.split(0, 5) + "...";
// }
str = vin + "/" + _label;
return str;
},
// 保存数据
saveInfo() {
let list = this.checkList;
let arr = [];
// if (!list || list.length <= 0) {
// showToast({
// message: "请选择数据",
// });
// this.$emit("cancel-loading");
// return false;
// }
list.map((k) => {
arr.push(k.vid);
});
let oParams = {};
oParams.receiverId = this.id;
oParams.vehicleIds = arr;
SAVE_USER_ASSIGN_INFO(oParams)
.then((res) => {
broadcast("cancel-loading");
if (res.code == 200) {
showToast({
message: "保存成功",
type: "success",
});
broadcast("assign-success");
}
})
.catch((error) => {
broadcast("cancel-loading");
});
},
// 获取用户信息
getInfo() {
let oParams = {};
oParams.receiverId = this.id;
GET_USER_ASSIGN_INFO(oParams)
.then((res) => {
this.rightLoading = false;
let list = res.data || [];
let arr = [];
list.map((k) => {
let idx = arr.findIndex((j) => j == k.pid);
if (idx < 0) {
arr.push(k.pid.replace("u", ""));
}
k.vid = k.vehicleId;
k.label = k.vin;
k.label1 = k.ownerName;
return k;
});
this.checkList = list;
this.checkKeys = arr;
console.log(arr);
this.loadList();
})
.catch((error) => {
this.rightLoading = false;
});
},
// 筛选数据
filterDate() {
let txt = this.checkSearchText;
let list = deepClone(this.checkList);
let result = list;
//if (txt) {
result = list.filter((k) => {
let isTrue =
(k.label || "").includes(txt) || (k.label1 || "").includes(txt);
return isTrue;
});
///}
console.log(result);
return result;
},
// 本地搜索
filterCars() {
this.pageNum = 1;
this.showCheckList = [];
this.loadList();
},
// 搜索组织机构-车辆
searchEvent(e, cb) {
let msg = this.placeholderText;
let oParams = {};
oParams.termType = this.termType;
oParams.term = this.term;
// 设备号
if (oParams.termType == 1 && oParams.term.length < 4) {
return false;
}
// 车架号
if (oParams.termType == 2 && oParams.term.length < 6) {
return false;
}
// 姓名
if (oParams.termType == 3 && oParams.term.length < 1) {
return false;
}
GET_VEHICLE_TREE(oParams).then((res) => {
let list = res.data || [];
list.map((k) => {
k.value = `${k.label}/${k.label1}`;
return k;
});
cb(list);
});
},
// 切换设备号、车架号、姓名
changeSearchType(id) {
let txt = "请输入至少四个关键字";
switch (id) {
case "2":
txt = "请输入至少六个关键字";
break;
case "3":
txt = "请输入至少一个关键字";
break;
default:
txt = "请输入至少四个关键字";
break;
}
this.placeholderText = txt;
},
// 搜索车辆,点击加入到右侧
joinToRight(e) {
console.log(e);
let list = deepClone(this.checkList);
// 首先构造Object
const idSet = list.reduce((acc, v) => {
acc[v.id] = true;
return acc;
}, {});
if (!idSet[e.id]) {
this.checkList.unshift(e);
this.showCheckList.unshift(e);
}
},
// 清空右侧选择
clearSelect(){
this.checkList = [];
this.showCheckList = [];
}
},
};
</script>
<style lang="scss">
.el-tree-node__content {
height: auto;
padding: 2px;
}
.custom-tree-node {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
font-size: 12px;
padding-right: 8px;
line-height: 26px;
}
.el_scroll {
.el-scrollbar__wrap {
overflow-x: hidden;
}
}
</style>
<style lang="scss" scoped>
.select_info_page {
.title {
font-family: PingFangSC-Regular;
font-size: 14px;
color: #666666;
font-weight: 400;
}
.device_box {
display: flex;
justify-content: space-between;
.middle_box {
padding: 0 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.btn {
margin: 10px 0;
}
}
.card_box {
//flex: 1;
width: 380px;
flex-shrink: 0;
box-sizing: border-box;
.head {
height: 54px;
line-height: 54px;
background: #f5f7fa;
padding: 0 16px;
font-family: PingFangSC-Regular;
font-size: 14px;
color: #333333;
font-weight: 400;
}
.info_box {
border: 1px solid #eee;
.search_box {
padding: 10px;
.input_select {
width: 100%;
::v-deep .el-input-group__prepend {
background: #fff !important;
//padding: 0 10px;
padding-left: 10px;
.el-select {
width: 90px;
box-sizing: border-box;
}
}
}
}
.tree_box {
border-top: 1px solid #eee;
.el_scroll {
padding: 10px 0;
height: 340px;
box-sizing: border-box;
overflow-y: auto;
}
}
}
}
}
}
.el_checkbox_group {
height: 100%;
padding: 0 10px;
display: flex;
flex-direction: column;
.el-checkbox {
margin: 4px 0;
}
}
</style>
\ No newline at end of file
<template>
<div class="system-container">
<div class="container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="vehicleTypeFormList"
@input="onInput"
>
<span class="inline-b" slot="form-slot">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
ref="searchButton"
>搜索</el-button
>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button
>
</span>
</search-form>
<h3>
车型管理
<div class="pull-right">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="btnClick('create')"
>定制车型库</el-button
>
</div>
</h3>
<basic-table
ref="vehicleTypeTable"
:tableParams="tableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
<span slot="status" slot-scope="scope">
<span
class="dot"
:class="
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(',')[1]
: ''
"
></span>
<span class="statusText">{{
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(",")[0]
: "--"
}}</span>
</span>
<span slot="table-button" slot-scope="scope">
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.scope)"
>{{ j.name }}</el-button
>
</span>
</basic-table>
</div>
</div>
</template>
<script>
import { getTableList, delelteTableRowData } from "services/vehicletype";
// import {creatIndexDb,addItem,getItem} from '@/utils/indexDb'
export default {
name: "vehicleTypeManage",
data() {
return {
USERSTATUS: this.$Constants.USER_STATUS,
searchForm: {},
vehicleTypeFormList: [
{
type: "input",
inputType: "text",
prop: "term",
placeholder: "所属组织|车型库名称",
},
],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: "所属组织",
prop: "tenantName",
},
{
label: "车型库名称",
prop: "name",
},
{
label: "创建人",
prop: "creator",
},
{
label: "创建时间",
prop: "createdDate",
},
{
label: "状态",
prop: "enableStatus",
addHtml: "status",
width: 110,
},
],
tableOption: {
width: 170,
btnList: [
{
name: "编辑",
pType: "edit",
},
{
name: "删除",
pType: "delete",
},
{
name: "查看",
pType: "view",
},
],
},
},
getListApi: getTableList,
vehicleTypeTitle: "add",
//以下为弹出框表单
vehicleTypeForm: {
enableStatus: true,
},
vehicleTypeData: [
{ label: "车型库名称:", prop: "name", type: "input", maxlength: 50 },
// { label: "组织:", prop: "tenantId", type: "select" },
{ label: "状态:", prop: "enableStatus", type: "switch" },
],
vehicleTypeRules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
tenantList: [],
};
},
created(){
},
mounted() {
console.log(this.$store.state)
localStorage.removeItem('carTree');
// creatIndexDb();
// addItem()
},
activated() {
this.$refs.searchButton.$el.click();
},
methods: {
// 重置搜索条件
refresh() {
this.searchForm = {};
this.$refs.vehicleTypeTable.refreshTable();
},
//按钮事件
btnClick(pType, scope) {
console.log(pType, scope);
switch (pType) {
case "create":
this.vehicleTypeTitle = "add";
this.vehicleTypeForm = {
enableStatus: true,
};
this.$router.push({ name: "vehicleAddUpadate", query: { title: this.vehicleTypeTitle } });
//this.handleClose(); //控制弹窗打开
break;
case "edit":
this.vehicleTypeTitle = "edit";
this.$router.push({
name: "vehicleAddUpadate",
query: { title: this.vehicleTypeTitle, id: scope.tenantId },
});
break;
case "view":
this.vehicleTypeTitle = "view";
this.$router.push({
name: "vehicleAddUpadate",
query: { title: this.vehicleTypeTitle, id: scope.tenantId },
});
break;
case "delete":
this.delelteTableRowData(scope.tenantId);
break;
}
},
//编辑触发事件
editEvent() {
const that = this;
this.handleClose();
},
// 删除触发事件
delelteTableRowData(id) {
const that = this;
const tipData = {
that: that,
tipText: "是否删除当前记录",
tipTitle: "提示",
type: "error",
callBack: () => {
delelteTableRowData({ tenantId: id }).then((res) => {
if (res.code == "200") {
this.$message({
type: "success",
message: "删除成功!",
});
this.$refs.vehicleTypeTable.refreshTable();
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
},
};
this.$Common.confirmDialog(tipData);
},
//监听回车搜索
onInput(){
this.$refs.searchButton.$el.click();
},
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div class="system-container">
<div class="container">
<div class="topform">
<rule-form :ruleForm="addUpdateForm" :rules="rules" :ruleData="addUpdateData" :labelWidth="'120px'" ref="addUpdateForm">
<div slot="select-type">
<el-select v-model="addUpdateForm.initOrganize" placeholder="请选择" :disabled="
this.$route.query.title == 'view' ||
this.$route.query.title == 'edit'
" filterable>
<el-option v-for="i in tenantList" :key="i.tenantId" :label="i.departmentName" :value="i.tenantId">
</el-option>
</el-select>
</div>
</rule-form>
</div>
<div class="treebox">
<!-- <span class="el-icon-loading"></span> -->
<div class="layer" v-if="!showTree">
<i class="el-icon-loading"></i> 正在加载中...
</div>
<el-tree v-if="showTree" :data="treedata" :default-expanded-keys="expandedKey" :props="defaultProps" show-checkbox node-key="treeId" ref="tree" highlight-current lazy :load="loadNode">
</el-tree>
</div>
</div>
<div class="pull-right">
<el-button type="primary" @click="submitForm" :loading="aloading" v-if="!(setPageTitle == 'view')">保存</el-button>
<el-button @click="handCancle('addUpdateForm')" :loading="bloading">取消</el-button>
</div>
</div>
</template>
<script>
import {
getTenantList,
getMenuTree,
addVehicleType,
GETVEHICLEINFO,
} from "services/vehicletype";
export default {
name: "vehicleAddUpadate",
data() {
var checkMenu = (rule, value, callBack) => {
if (value && value.length == 0) {
return callBack(new Error("请选择菜单列表"));
} else {
return callBack();
}
};
return {
addUpdateForm: {
name: "",
initOrganize: "",
enableStatus: true,
// menuIdList: [],
},
addUpdateData: [
{
label: "车型库名称:",
prop: "name",
type: "input",
maxlength: 50,
disabled: this.$route.query.title == "view",
},
{
label: "组织:",
prop: "initOrganize",
type: "customize",
slotName: "select-type",
},
{ label: "状态:", prop: "enableStatus", type: "switch" },
// { type: "customize", slotName: "btns-type" },
],
// {
// prop: "menuIdList",
// type: "customize",
// slotName: "menu-list",
// },
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
initOrganize: [
{ required: true, message: "请选择组织", trigger: "change" },
],
enableStatus: [{ required: true }],
// menuIdList: [{ required: true, validator: checkMenu, trigger: "blur" }],
},
filterText: "",
treedata: [],
treeLeafData: [],
tenantList: [],
defaultProps: {
children: "childs",
label: "name",
isLeaf: "leaf",
},
loading: true,
newArr: [],
showTree: false,
checkList: [],
aloading: false,
bloading: false,
expandedKey: [],
tenantListElement: {},
type: 1,
typeList: [],
vehicleId: "",
checkedKeys: [],
};
},
computed: {
setPageTitle() {
return this.$route.query.title == "add"
? "add"
: this.$route.query.title == "edit"
? "edit"
: "view";
},
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
created() {},
mounted() {
let _this = this;
let o = _this.$route.query;
let n = _this.$store.getters.getTreeData;
this.vehicleId = o.id;
//判断
this.getTenantList();
setTimeout(function () {
if (n && n.length > 0) {
_this.mainWorker(n).then((res) => {
if (o.id) {
_this.getInfo(o.id);
return false;
}
_this.loading = false;
_this.showTree = true;
});
return false;
}
_this.getMenuTree();
}, 10);
if (o.title == "add") {
this.type = 1; //后台要区分新增,和编辑,1:新增,2:编辑
} else if (o.title == "edit") {
this.type = 2;
} else if (o.title == "view") {
this.rules = {};
}
},
activated() {
let _this = this;
let o = _this.$route.query;
if (o.id) {
this.getInfo(o.id);
}
},
methods: {
// 获取租户列表
getTenantList(params) {
getTenantList(params).then((res) => {
this.tenantList = res.data || [];
});
},
// 获取菜单权限列表
getMenuTree() {
let _this = this;
let oParams = {};
oParams.full = true;
getMenuTree(oParams).then((res) => {
//localStorage.setItem("carTree", JSON.stringify(res.data || []));
_this.$store.commit("updateVehicleCarTree", res.data);
// 分线程处理数据
_this.mainWorker(res.data).then((e) => {
let _obj = e.data;
_this.$store.commit("updateVehicleTree", _obj.data);
if (_this.vehicleId) {
_this.getInfo(_this.vehicleId);
}
_this.showTree = true;
_this.loading = false;
});
// this.showTree = true;
// this.loading = false;
});
},
// 异步加载树数据
loadNode(node, resolve) {
let arr = [];
let id = node.key;
let _list = this.newArr;
let _types = { 0: "first_", 1: "second_", 2: "three_", 3: "four_" };
if (node.level == 0) {
id = 0;
}
arr = _list.filter((item) => {
let _pass = item.pid == id && item.level == node.level;
return _pass;
});
resolve(arr);
},
//保存按钮,提交当前表单
submitForm() {
let _this = this;
_this.$refs.addUpdateForm.$children[0].validate((valid) => {
if (!valid) {
return false;
}
_this.checkList = [];
let _list = _this.$refs.tree.getCheckedNodes();
_this.getChilds(_list);
console.log(_this.checkList);
if (_this.checkList.length <= 0) {
_this.$message.warning("菜单不能为空");
return false;
}
let params = {
name: _this.addUpdateForm.name,
};
this.tenantListElement = this.tenantList.find(
(item) => item.tenantId == this.addUpdateForm.initOrganize
);
params.from = this.type;
params.tenantId = Number(_this.addUpdateForm.initOrganize);
params.tenantName = this.tenantListElement.departmentName;
params.enableStatus = _this.addUpdateForm.enableStatus ? 1 : 2;
params.typeIds = _this.checkList;
// 保存车型库
_this.aloading = true;
addVehicleType(params)
.then((res) => {
_this.aloading = false;
if (res.code != 200) {
_this.$message.error(res.message || res.msg);
return false;
}
_this.$message({
message: "提交成功",
type: "success",
});
_this.goBack();
})
.catch((error) => {
console.log("错误信息:", error);
_this.aloading = false;
});
});
},
// 取消保存
handCancle(formName) {
this.bloading = true;
this.goBack();
},
// 获取所有的子节点数据
getChilds(arr) {
if (!arr || arr.length <= 0) {
return false;
}
let list = this.checkList;
arr.map((k) => {
if (k.childs && k.childs.length > 0) {
this.getChilds(k.childs);
} else {
list.push(k.id);
}
});
},
// 返回上一页面
goBack() {
this.$refs.addUpdateForm.$children[0].resetFields();
this.$router.go(-1);
this.$refs.tree.setCheckedKeys([]);
},
// 获取车型库详情
getInfo(id) {
let _this = this;
let oParams = { tenantId: id };
GETVEHICLEINFO(oParams).then((res) => {
if (res.code != 200) {
return false;
}
let o = res.data || {};
let typeList = o.typeIds;
console.log("开始", new Date().getTime());
_this.treeMainWorker(o).then((j) => {
console.log(_this.newArr);
_this.expandedKey = j;
// _this.checkedKeys = []
// _this.checkedKeys = o.typeIds;
let _arr = [];
typeList.map((k) => {
_arr.push("four_" + k);
});
// 防止多勾选
_this.$nextTick(function(){
_this.$refs.tree.setCheckedKeys(_arr);
})
});
console.log("结束", new Date().getTime());
this.addUpdateForm.name = o.name || "暂无";
this.addUpdateForm.initOrganize = o.tenantId;
this.addUpdateForm.enableStatus = o.enableStatus == 2 ? false : true;
//this.typeList = o.typeIds || [];
});
},
// 创建分线程
createWorker() {
let myWorker = function () {
let that = this;
let _tree = [];
let _allTree = [];
let _types = { 0: "first_", 1: "second_", 2: "three_", 3: "four_" };
that.addEventListener("message", function (e) {
if (e.data) {
flatData(e.data);
that.postMessage({ tree: _tree, data: _allTree });
}
});
// 数据扁平化
let flatData = function (arr, id, index) {
let n = _allTree;
let i = index || 0;
(arr || []).forEach((item) => {
item.pid = id || 0;
item.level = i;
//console.log(item.id)
item.treeId = _types[i] + item.id;
n.push(item);
if (!id) {
_tree.push(item);
}
if(!item.childs){
item.leaf=true;
}
item.childs && item.childs.length > 0
? flatData(item.childs, item.treeId, i + 1)
: "";
//item.childs = ""; //如果扁平化后的数组需要显示父子层级,可以把这一项删除
});
};
};
let workerData = new Blob(["(" + myWorker.toString() + ")()"], {
type: "text/javascript",
});
return workerData;
},
// 主线程
mainWorker(data) {
let _this = this;
return new Promise((resolve, reject) => {
let _workerJs = _this.createWorker();
let webWorker = new Worker(window.URL.createObjectURL(_workerJs));
webWorker.postMessage(data);
webWorker.onmessage = function (e) {
let _obj = e.data;
_this.treedata = _obj.tree;
_this.newArr = _obj.data;
resolve(_obj);
//关闭线程
// webWorker.terminate();
};
// 监听文件失败
webWorker.onmessageerror = function (e) {
reject(e);
};
});
},
// 创建树形结构回显分线程
creatTreeWorker() {
let myWorker = function () {
let that = this;
that.addEventListener("message", function (e) {
if (!e.data) {
return false;
}
console.log(e.data);
let _obj = e.data;
let list = _obj.list;
let typeList = _obj.typeList || [];
let _earr = [];
let _brand = [];
// 筛选第四级
let _four = list.filter((k) => {
let idx = typeList.findIndex((j) => j == k.id && k.level == 3);
return idx >= 0;
});
// 筛选第四级
let _three = list.filter((k) => {
let idx = (_four || []).findIndex(
(j) => j.pid == k.treeId && k.level == 2
);
return idx >= 0;
});
// 筛选第二级
let _second = list.filter((k) => {
let idx = (_three || []).findIndex(
(j) => j.pid == k.treeId && k.level == 1
);
return idx >= 0;
});
// 筛选第一级
let _first = list.filter((k) => {
let idx = (_second || []).findIndex(
(j) => j.pid == k.treeId && k.level == 0
);
return idx >= 0;
});
let arr = _second.concat(_first, _three);
arr.map((k) => {
_earr.push(k.treeId);
});
//console.log(arr);
//console.log(_first)
//console.log(_second)
console.log(_earr);
that.postMessage({ brand: _brand, expanded: _earr });
});
};
let workerData = new Blob(["(" + myWorker.toString() + ")()"], {
type: "text/javascript",
});
return workerData;
},
// 回显树形数据,主线程
treeMainWorker(data) {
let _this = this;
return new Promise((resolve, reject) => {
let _workerJs = _this.creatTreeWorker();
let webWorker = new Worker(window.URL.createObjectURL(_workerJs));
let oParams = {};
oParams.typeList = data.typeIds;
oParams.list = _this.newArr;
webWorker.postMessage(oParams);
webWorker.onmessage = function (e) {
let _obj = e.data;
_this.showTree = true;
resolve(_obj.expanded);
//关闭线程
// webWorker.terminate();
};
// 监听文件失败
webWorker.onmessageerror = function (e) {
reject(e);
};
});
},
},
};
</script>
<style lang="scss" scoped>
.topform {
width: 40%;
}
.treebox {
height: 385px;
overflow-y: scroll;
position: relative;
.layer {
width: 100%;
height: 385px;
text-align: center;
line-height: 385px;
position: absolute;
z-index: 10;
}
.searchInput {
width: 30%;
}
}
.pull-right {
margin-top: 20px;
}
</style>
\ No newline at end of file
<template>
<div class="image_list_page">
<template v-if="imgList && imgList.length">
<template v-for="(item, index) in imgList">
<div class="image_cell" :key="`img_upload_${index}`" v-if="index < 20">
<image-upload
:value="item"
:status="status"
:limit="1"
:list="workOrderDocs"
@change="onChange('imgList')"
></image-upload>
<div class="image_name" :title="item.originName">
{{ item.originName || item.name }}
</div>
</div>
</template>
</template>
<ImageOtherUpload
v-model="otherList"
:list="workOrderDocs"
:limit="20-imgList.length"
:status="status"
:nameIndex="otherList.length"
@change="onChange('otherList')"
></ImageOtherUpload>
</div>
</template>
<script>
import ImageUpload from "./image.vue";
import ImageOtherUpload from "./otherImage.vue";
import {deepClone} from '@/utils/util';
export default {
name: "ImageList",
components: {
ImageUpload,
ImageOtherUpload,
},
props: {
value: {
type: Array,
default: function () {
return [];
},
},
type: {
type: [String, Number],
default: 1, //
},
status: {
//1:查看工单,不可编辑 2:编辑工单 3:激活工单 4:审核工单 5: 单独编辑图片
type: [String, Number],
default: "",
},
},
watch: {
value: {
handler: function (n, o) {
let m = [];
let _other = [];
n.map((k) => {
// 固定位置
if (k.source == "bhg") {
m.push(k);
} else {
_other.push(k);
}
});
// let len = m.length;
// if (len <= 20) {
// this.limit = 20 - len - _other.length;
// } else {
// this.limit = 1;
// }
// let _num = 20 - len - Number(_other.length);
// this.limit = _num > 0 ? _num : 0;
// console.log(this.limit);
this.imgList = m;
this.otherList = _other;
this.workOrderDocs = n
},
immediate: true,
},
},
data() {
return {
imgList: [], // 固定位置
otherList: [], // 其他
limit: 1,
workOrderDocs:[], // 所有图片
};
},
methods: {
// 监听图片组件删除、上传更新
onChange(id) {
let m = deepClone(this.imgList);
let _list = m.concat(this.otherList);
console.log(_list);
this.$emit("input", _list);
},
},
};
</script>
<style lang="scss" scoped>
.image_list_page {
// display: flex;
// flex-wrap: wrap;
overflow: hidden;
.image_cell {
width: 120px;
margin: 0 10px 10px 0;
float: left;
}
.image_name {
height: 30px;
width: 100%;
text-align: center;
overflow: hidden;
white-space: nowrap;
word-break: break-all;
text-overflow: ellipsis;
line-height: 30px;
}
}
</style>
\ No newline at end of file
<template>
<div class="add_work_page">
<!-- 工单信息 开始 -->
<div class="head_title glsx_hairline mb30">工单信息</div>
<el-form ref="addForm"
:model="addForm"
class="el_form_box"
:rules="addFormRules"
size="small"
label-width="120px">
<el-form-item label="店面名称:"
prop="shopName">
<el-input v-model.trim="addForm.shopName"
maxlength="128"
placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="店面联系人:"
prop="shopContactInfo">
<el-input v-model="addForm.shopContactInfo"
maxlength="50"
placeholder="输入格式:姓名,手机号码"></el-input>
</el-form-item>
<el-form-item label="是否需要安装:"
class="long_form_item"
prop="needInstall">
<el-radio-group v-model="addForm.needInstall">
<el-radio label="Y">需要安装</el-radio>
<el-radio label="N">无需安装</el-radio>
</el-radio-group>
</el-form-item>
<el-collapse-transition>
<div v-if="addForm.needInstall == 'Y'"
class="long_form_item el_form_box">
<el-form-item label="被服务联系人:"
prop="serviceLinkInfo">
<el-input v-model="addForm.serviceLinkInfo"
maxlength="50"
placeholder="输入格式:姓名,手机号码"></el-input>
</el-form-item>
<el-form-item label="手机号:"
prop="notifyTarget">
<el-input v-model="addForm.notifyTarget"
maxlength="23"
placeholder="安装完成后短信通知对象,输入格式:手机号码,手机号码"></el-input>
</el-form-item>
<el-form-item label="服务时间:"
prop="serviceTime">
<el-date-picker v-model="addForm.serviceTime"
class="el_date_picker"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
<el-radio-group v-model="addForm.serviceApm">
<el-radio label="上午">上午</el-radio>
<el-radio label="下午">下午</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="服务地点:"
required>
<div class="city_box">
<el-form-item class="cascader_item"
prop="areaId">
<el-cascader v-model="addForm.areaId"
class="el_cascader"
:options="provinceList"
:props="cascaderProps"
@change="onCityChange"></el-cascader>
</el-form-item>
<el-form-item prop="serviceAddress">
<el-input v-model="addForm.serviceAddress"
maxlength="200"
placeholder="请输入详细地址"></el-input>
</el-form-item>
</div>
<!-- <div class="city_box">
<el-cascader v-model="addForm.province" class="el_cascader" :options="provinceList" :props="cascaderProps" @change="onChange"></el-cascader>
<el-input v-model="addForm.address" placeholder="请输入详细地址"></el-input>
</div> -->
</el-form-item>
<el-form-item label="服务备注:">
<el-input type="textarea"
v-model="addForm.serviceExplain"
maxlength="200"
placeholder="补充说明,安装人员可见"
rows="5"
resize="none"></el-input>
</el-form-item>
</div>
</el-collapse-transition>
</el-form>
<!-- 工单信息 end -->
<!-- 安装车辆 开始 -->
<div class="head_title glsx_hairline">
<span>安装车辆:共{{tableData.length}}台</span>
<el-button type="success"
size="small"
plain
icon="el-icon-plus"
@click="openDialog()">新增车辆</el-button>
</div>
<!-- 安装车辆 end -->
<!-- 表格区域 开始 -->
<div class="table_box">
<el-table class="el_table"
:data="tableData"
border
size="small">
<el-table-column label="承租人姓名"
prop="lesseeName"></el-table-column>
<el-table-column label="车架号"
prop="vin"></el-table-column>
<el-table-column label="发动机号"
prop="engineNo"></el-table-column>
<el-table-column label="承租人电话号码"
prop="lesseePhone"></el-table-column>
<el-table-column label="车牌号码"
prop="plateNo"></el-table-column>
<el-table-column label="品牌/车型"
prop="">
<template
slot-scope="{row}">{{row.brandName}}{{row.subBrandName}}{{row.seriesName}}{{row.typeName}}</template>
</el-table-column>
<el-table-column label="设备组合"
prop="deviceComposeName"></el-table-column>
<el-table-column label="操作"
fixed="right"
align="center"
width="120px">
<template slot-scope="{row}">
<el-link class="el_link"
type="primary"
@click="editCar(row)">编辑</el-link>
<el-link class="el_link"
type="danger"
@click="removeCar(row)">删除</el-link>
</template>
</el-table-column>
</el-table>
</div>
<!-- 表格区域 end -->
<!-- 按钮区域 开始 -->
<div class="submit_box"
:style="`width:${pageWidth}px`">
<el-button type="primary"
size="small"
:loading="aloading"
@click="saveInfo()">保存</el-button>
<el-button type="default"
size="small"
@click="goBack()">返回</el-button>
</div>
<!-- 按钮区域 开始 -->
<!-- 弹框 开始 -->
<glsx-dialog :show="showDialog"
:title="current.id?'编辑车辆':'新增车辆'"
@close="closeDialog()">
<div>
<add-car ref="addCarCom"
:info="current"
:list="tableData"
@change="onChange"></add-car>
</div>
<template slot="footer">
<el-button type="primary"
size="small"
@click="saveCar()">保存</el-button>
<el-button type="default"
size="small"
@click="closeDialog()">取消</el-button>
</template>
</glsx-dialog>
<!-- 弹框 end -->
</div>
</template>
<script>
import AddCar from "./addCar";
import GlsxDialog from "@/components/dialog";
import { ADD_WORKORDER_INFO } from "@/services/order";
// import provinceList from "@/common/province.json";
import { Validator } from "@/common/validator";
import { showToast, deepClone, showModal } from "@/utils/util";
export default {
components: {
AddCar,
GlsxDialog,
},
data() {
let checkNamePhone = (rule, value, cb) => {
let reg = /^.+[,,]{1}1\d{10}$/;
let index = value
.split("")
.findIndex((item) => item === "," || item === ",");
if (index != -1) {
let otherIndex = value
.slice(index + 1, value.length)
.split("")
.findIndex((item) => item === "," || item === ",");
if (otherIndex != -1) {
cb(new Error("请输入正确的格式(姓名,手机号)"));
}
}
if (!reg.test(value)) {
cb(new Error("请输入正确的格式(姓名,手机号)"));
}
cb();
};
// 校验两个手机号码
let checkDoublePhone = (rule, value, cb) => {
let reg = Validator.PHONEREG;
if (!value) {
cb();
return false;
}
let arr = value.split(",");
if (value.indexOf(",") > 0) {
arr = value.split(",");
}
arr.forEach((k, i) => {
if (!reg.test(k)) {
console.log(`${k}----${i}`);
cb(new Error("请输入正确的手机号"));
return false;
}
});
if (arr[0] == arr[1]) {
cb(new Error("存在重复的手机号"));
return false;
}
cb();
};
return {
addForm: { needInstall: "Y", serviceApm: "上午" },
addFormRules: {
shopName: [
{ required: true, message: "请输入店面名称", trigger: "blur" },
{ pattern: /^\S{2,128}$/, message: "2至128个字", trigger: "blur" },
],
shopContactInfo: [
{ required: true, message: "请输入店面联系人", trigger: "blur" },
{ validator: checkNamePhone, trigger: "blur" },
],
needInstall: [
{ required: true, message: "请选择是否需要安装", trigger: "change" },
],
serviceLinkInfo: [
{ required: true, message: "请输入被服务联系人", trigger: "blur" },
{ validator: checkNamePhone, trigger: "blur" },
],
notifyTarget: [
// {
// pattern: Validator.PHONEREG,
// message: "请输入正确的手机号",
// trigger: "blur",
// },
{ validator: checkDoublePhone, trigger: "blur" },
],
serviceTime: [
{ required: true, message: "请选择服务时间", trigger: "change" },
],
areaId: [
{ required: true, message: "请选择服务地点", trigger: "change" },
],
serviceAddress: [
{ required: true, message: "请输入详细地址", trigger: "blur" },
],
},
tableData: [],
showDialog: false,
pageWidth: 0,
provinceList: {},
cascaderProps: {
label: "name",
value: "id",
children: "districts",
},
aloading: false,
current: {},
};
},
mounted() {
let o = document.getElementById("glsxRightSide");
this.pageWidth = o.offsetWidth;
this.manageProvice()
},
methods: {
// 打开弹框
openDialog() {
let list = this.tableData;
if (list.length >= 100) {
showToast({
message: "新增车辆已达上限",
});
return false;
}
this.showDialog = true;
console.log(new Date());
},
// 关闭弹框
closeDialog() {
this.showDialog = false;
this.current = {};
//this.$refs.addCarCom.rest();
},
// 监听新增车辆组件变化
onChange(e) {
console.log(e);
if (!e) {
return false;
}
let list = this.tableData;
let idx = list.findIndex((k) => k.id == e.id);
console.log(idx);
if (idx >= 0) {
this.$set(this.tableData, idx, e);
} else {
list.push(e);
}
this.showDialog = false;
},
// 新增车辆
saveCar() {
this.$refs.addCarCom.saveInfo();
},
// 新增工单
saveInfo() {
let _this = this;
_this.$refs.addForm.validate((valid) => {
if (!valid) {
return false;
}
let m = deepClone(_this.tableData);
if (!m || m.length <= 0) {
showToast({
message: "请您新增至少一台车辆信息,否则无法正常提交工单!",
});
return false;
}
let oParams = _this.getWorkParams();
_this.aloading = true;
ADD_WORKORDER_INFO(oParams).then((res) => {
_this.aloading = false;
if (res.code == 200) {
showToast({
message: "新增成功",
type: "success",
});
_this.goBack();
return false;
}
});
console.log(oParams);
});
},
// 处理省市区数据
manageProvice() {
const url = new URL('https:/img01.glsx.com.cn/js/province.json')
fetch(url)
.then(response => response.json())
.then(data => {
this.provinceList = data;
this.provinceList.map((k) => {
if (k.districts.length == 0) {
k.districts = undefined
} else {
k.districts.map((j) => {
if (j.districts.length == 0) {
j.districts = undefined
}
return j;
});
}
return k;
});
console.log(this.provinceList);
})
.catch(error => {
console.error('Error:', error)
})
},
// 监听省市区选择
onCityChange(e) {
console.log('e', e);
let list = this.provinceList;
// 查找省份
let p = list.find((k) => k.id == e[0]);
// 查找市
let c = (p && p.districts) ? p.districts.find((k) => k.id == e[1]) : null;
// 查找区
let a = (c && c.districts) ? c.districts.find((k) => k.id == e[2]) : null;
this.$set(this.addForm, "province", p.name);
this.$set(this.addForm, "city", c ? c.name : '');
this.$set(this.addForm, "district", a ? a.name : '');
},
// 删除车辆
removeCar(e) {
let _this = this;
showModal({
message: "确认删除该车辆吗?",
showCancelButton: true,
success: () => {
let list = _this.tableData;
_this.tableData = list.filter((k) => k != e);
},
});
},
// 处理新增订单数据
getWorkParams() {
let _this = this;
let oParams = {};
let n = deepClone(_this.addForm);
let m = deepClone(_this.tableData);
delete n.areaId;
// 判断是否需要安装
if (n.needInstall == "Y") {
oParams = { ...n };
} else {
oParams.needInstall = n.needInstall;
oParams.shopName = n.shopName;
oParams.shopContactInfo = n.shopContactInfo;
}
// 车辆信息
m.map((k) => {
delete k.deviceComposeName;
delete k.test;
delete k.id;
return k;
});
oParams.serviceType = "IS";
oParams.vehicles = m;
oParams.shopAddress = "店面默认地址";
return oParams;
},
// 返回上一页
goBack() {
let _this = this;
this.addForm = { needInstall: "Y", serviceApm: "上午" };
this.tableData = [];
setTimeout(function () {
_this.$refs.addForm.clearValidate();
}, 100);
history.pushState(
{ refresh: true },
"工单列表",
"system#/work/order?refresh=true"
);
},
// 编辑车辆信息
editCar(row) {
this.current = deepClone(row);
this.showDialog = true;
console.log(new Date());
},
},
};
</script>
<style lang="scss" scoped>
@import '@/styles/addWork.scss';
</style>
\ No newline at end of file
<template>
<div class="add_car_page">
<el-form ref="addCarForm" :model="addForm" :rules="addFormRules" size="small" class="el_form">
<el-form-item label="承租人姓名">
<el-input v-model="addForm.lesseeName" maxlength="50" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="车架号" prop="vin">
<el-input v-model="addForm.vin" maxlength="17" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="设备组合" prop="deviceCompose">
<el-select v-model="addForm.deviceCompose">
<el-option v-for="(item,index) in deviceList" :key="index" :label="item.name" :value="item.code"></el-option>
</el-select>
</el-form-item>
<el-form-item label="车牌号码">
<plate-number-input v-model="addForm.plateNo"></plate-number-input>
</el-form-item>
<el-form-item label="承租人电话号码" prop="lesseePhone">
<el-input v-model="addForm.lesseePhone" maxlength="11" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="品牌/车型">
<el-cascader v-model="addForm.test" class="el_cascader" :options="carBrands" :props="cascaderProps" @change="onChange"></el-cascader>
</el-form-item>
<el-form-item label="发动机号">
<el-input v-model="addForm.engineNo" maxlength="17" placeholder="请输入"></el-input>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
GET_DEVICE_COMPOSE,
GET_VEHICLE_SELECTEDTYPETREE,
CHECK_WORKORDER_VERIFYDUPLICATEVIM,
} from "@/services/order";
import { Validator } from "@/common/validator";
import PlateNumberInput from "@/components/plateNumberInput";
import { deepClone, showModal } from "@/utils/util";
export default {
name: "AddCar",
components: {
PlateNumberInput,
},
props: {
info: {
type: Object,
default: function () {
return {};
},
},
list: {
type: Array,
default: function () {
return [];
},
},
},
data() {
var validCarVin = (rule, value, callback) => {
console.log(this.list);
let info = this.info;
let list = this.list;
let idx = list.findIndex((k) => k.vin == value);
console.log(info.vin +'---------'+ value)
// 编辑车辆,不修改车架号,不校验
if (info && info.vin == value) {
console.log('7777777777')
return callback();
}
if (idx >= 0) {
console.log('66666666')
return callback(new Error("该车架号已新增,请修改后再保存"));
}
callback();
};
return {
addForm: {},
addFormRules: {
vin: [
{ required: true, message: "请输入车架号", trigger: "blur" },
{
pattern: Validator.CHECKVINNUMBER,
message: "17位英文和数字组合",
trigger: "blur",
},
{ validator: validCarVin, trigger: "blur" },
],
deviceCompose: [
{ required: true, message: "请选择设备组合", trigger: "change" },
],
lesseePhone: [
{
pattern: Validator.PHONEREG,
message: "请输入正确的承租人电话号码",
trigger: "blur",
},
],
},
deviceList: this.$store.state.deviceAssembly,
carBrands: this.$store.state.vehicleCustomTree,
cascaderProps: {
label: "name",
value: "id",
children: "childs",
},
};
},
watch: {
info: {
handler: function (n, o) {
console.log(n);
this.addForm = deepClone(n);
},
immediate: true,
},
},
created() {
let o = this.$store.state;
if (!o.vehicleCustomTree || o.vehicleCustomTree.length <= 0) {
this.getCarBrand();
}
if (!o.deviceList || o.deviceList.length <= 0) {
this.getDevice();
}
},
mounted() {},
methods: {
// 获取设备组合
getDevice() {
GET_DEVICE_COMPOSE().then((res) => {
let list = res.data || [];
this.deviceList = list;
this.$store.commit("updateDeviceAssembly", list);
});
},
// 获取车型
getCarBrand() {
GET_VEHICLE_SELECTEDTYPETREE().then((res) => {
let list = res.data || [];
this.carBrands = list;
this.$store.commit("updateVehicleCustomTree", list);
});
},
// 监听车型选择
onChange(e) {
if (!e || e.length <= 0) {
return false;
}
let list = this.carBrands;
// 找第一级
let m = list.find((k) => k.id == e[0]);
// 找第二级
let n = (m.childs || []).find((k) => k.id == e[1]);
// 找第三级
let s = (n.childs || []).find((k) => k.id == e[2]);
// 找第四级
let f = (s.childs || []).find((k) => k.id == e[3]);
let o = {};
o.brandId = e[0];
o.subBrandId = e[1];
o.seriesId = e[2];
o.typeId = e[3];
o.brandName = m.name;
o.subBrandName = n.name;
o.seriesName = s.name;
o.typeName = f.name;
this.addForm = Object.assign(this.addForm, o);
},
// 保存数据
saveInfo() {
let _this = this;
_this.$refs.addCarForm.validate((valid) => {
if (!valid) {
return false;
}
let o = deepClone(_this.addForm);
// 校验车架号
CHECK_WORKORDER_VERIFYDUPLICATEVIM({ vin: o.vin }).then((res) => {
// true:标识存在相同的车架号,false:表示不存在相同车架号的车辆
if (res.data) {
showModal({
message: "该车架号已存在,请核对!",
showCancelButton: true,
success: function () {
_this.addCarInfo();
},
});
return false;
}
_this.addCarInfo();
});
});
},
// 切换车牌号
onPlateChange(e) {
this.$set(this.addForm, "plateNo", e);
},
// 重置
rest() {
let _this = this;
this.addForm = {};
setTimeout(function () {
_this.$refs.addCarForm.clearValidate();
}, 100);
},
// 添加车辆
addCarInfo() {
let o = deepClone(this.addForm);
let list = this.deviceList;
let n = list.find((k) => k.code == o.deviceCompose);
if (!o.id) {
o.id = new Date().getTime();
}
o.deviceComposeName = n.name;
this.$emit("change", o);
this.rest();
},
},
};
</script>
<style lang="scss" scoped>
.el_form {
display: flex;
flex-wrap: wrap;
.el-form-item {
flex: 0 0 50%;
padding: 0 30px 0 0;
.el_cascader {
width: 100%;
}
}
}
</style>
\ No newline at end of file
<template>
<div id="orderModal" v-loading="loading">
<div class="baseInfo" v-show="activeMenu != 'orderProgress'">
<el-form
ref="editForm"
:model="editForm"
:rules="formRules"
:validate-on-rule-change="false"
label-width="120px"
size="small"
:disabled="type == 1"
>
<div ref="orderInfo" class="line_title glsx_hairline">工单信息</div>
<el-form-item label="系统工单号:">
<el-input
v-model="editForm.orderNo"
placeholder="系统自动生成,不可编辑"
disabled
></el-input>
</el-form-item>
<el-form-item label="工单状态:" v-if="type != 3">
<el-input
v-model="editForm.orderStatusDesc"
placeholder="系统自动生成,不可编辑"
disabled
></el-input>
</el-form-item>
<el-form-item label="业务工单号:">
<el-input
v-model="editForm.bizOrderNo"
maxlength="64"
placeholder="请输入"
disabled
></el-input>
</el-form-item>
<el-form-item label="店面名称:" prop="shopName">
<el-input
v-model.trim="editForm.shopName"
maxlength="128"
:disabled="isDisabled"
></el-input>
</el-form-item>
<div class="form_flex">
<el-form-item label="联系人:" prop="shopContactor">
<el-input
v-model.trim="editForm.shopContactor"
maxlength="50"
:disabled="isDisabled"
></el-input>
</el-form-item>
<el-form-item label="联系电话:" prop="shopTelephone">
<el-input
v-model.trim="editForm.shopTelephone"
maxlength="11"
:disabled="isDisabled"
></el-input>
</el-form-item>
</div>
<el-form-item label="联系地址:" prop="shopAddress">
<el-input
type="textarea"
rows="4"
resize="none"
v-model.trim="editForm.shopAddress"
maxlength="200"
:disabled="isDisabled"
></el-input>
</el-form-item>
<el-form-item label="是否需要安装:" prop="needInstall">
<el-select v-model="editForm.needInstall" :disabled="isDisabled">
<el-option label="需要安装" value="Y"></el-option>
<el-option label="无需安装" value="N"></el-option>
</el-select>
</el-form-item>
<div v-if="editForm.needInstall == 'Y'">
<el-form-item label="期望服务日期:" :required="type != 3">
<div class="line_form_flex">
<el-form-item label="" prop="serviceTime">
<el-date-picker
v-model="editForm.serviceTime"
:disabled="isDisabled"
class="el_datepicker"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
>
</el-date-picker>
</el-form-item>
<el-form-item label="" prop="serviceApm">
<el-select v-model="editForm.serviceApm" :disabled="isDisabled">
<el-option label="上午" value="上午"></el-option>
<el-option label="下午" value="下午"></el-option>
</el-select>
</el-form-item>
</div>
</el-form-item>
<el-form-item label="服务区域:" prop="areaId">
<el-cascader
v-model="editForm.areaId"
class="el_cascader"
:disabled="isDisabled"
:options="provinceList"
:props="cascaderPropsForArea"
@change="onCityChange"
></el-cascader>
</el-form-item>
<el-form-item label="详细地址:" prop="serviceAddress">
<el-input
type="textarea"
rows="4"
resize="none"
v-model.trim="editForm.serviceAddress"
maxlength="200"
:disabled="isDisabled"
></el-input>
</el-form-item>
<el-form-item label="服务联系电话:" prop="serviceLinkerPhone">
<el-input
v-model.trim="editForm.serviceLinkerPhone"
maxlength="11"
:disabled="isDisabled"
></el-input>
</el-form-item>
</div>
<div v-if="editForm.needCarKeyVideo == 'Y' && this.type == 1">
<el-form-item label="邮寄信息:" prop="needCarKeyVideo">
<el-input
v-model.trim="editForm.receiverInfo"
maxlength="11"
:disabled="isDisabled"
></el-input>
</el-form-item>
</div>
<!-- 设备信息 开始 -->
<div ref="deviceInfo" class="line_title glsx_hairline">设备信息</div>
<el-form-item label="设备套餐:" prop="deviceCompose">
<el-select v-model="editForm.deviceCompose" :disabled="isDisabled">
<el-option
v-for="(item, index) in deviceList"
:key="index"
:label="item.name"
:value="item.code"
></el-option>
</el-select>
</el-form-item>
<template
v-if="
type == 3 || editForm.orderStatus == 2 || editForm.orderStatus == 5
"
>
<el-form-item label="车辆归属:" prop="orgName">
<el-popover
v-model="filterVisible"
placement="bottom-start"
width="400"
trigger="click"
:disabled="editForm.orderStatus == 2"
>
<div>
<glsx-organization
:isLast="true"
@change="onOrganizationChange"
></glsx-organization>
</div>
<el-input
v-model="editForm.orgName"
:placeholder="editForm.specialShopName || '所属组织'"
slot="reference"
readonly
clearable
>
</el-input>
</el-popover>
</el-form-item>
<template v-for="(item, index) in editForm.snList">
<div
class="form_flex form_device_flex"
:key="index"
v-if="index >= 0"
>
<el-form-item
label="设备SN号:"
:prop="'snList.' + index + '.sn'"
:rules="deviceRules"
>
<el-input
v-model.number="item.sn"
maxlength="20"
placeholder="请输入设备号"
:disabled="
editForm.orderStatus == 5 || editForm.orderStatus == 2
"
></el-input>
</el-form-item>
<el-form-item
label="设备型号:"
:prop="'snList.' + index + '.deviceClassifyName'"
:rules="[
{
required: true,
message: '未识别到正确设备型号',
trigger: ['blur', 'change'],
},
]"
>
<el-input v-model="item.deviceClassifyName" disabled></el-input>
</el-form-item>
<template v-if="type == 4 || type == 3">
<span
class="device_tips"
:class="!item.checkResult ? 'cred' : ''"
v-if="item.sn"
>{{ item.checkResult ? "验证通过" : "验证不通过" }}</span
>
<el-button
type="primary"
size="mini"
class="el_btn"
:loading="gpsloading"
@click="lookLocation(item, index)"
>查看定位</el-button
>
</template>
</div>
<div class="map_wrapper" :key="`map_${index}`" v-if="item.showMap">
<i
class="el-icon-error el_icon"
@click="closeMapLocation(item, index)"
></i>
<map-location
:info="getMapInfo(item)"
v-if="item.showMap"
></map-location>
</div>
</template>
</template>
<!-- 设备信息 end -->
<!-- 承租人信息 开始 -->
<div ref="lesseeInfo" class="line_title glsx_hairline">承租人信息</div>
<div class="form_flex">
<el-form-item label="承租人姓名:" prop="lesseeName">
<el-input
v-model.trim="editForm.lesseeName"
maxlength="50"
:disabled="isDisabled"
></el-input>
</el-form-item>
<el-form-item label="性别:">
<!-- <el-input v-model.trim="editForm.lesseeGender" :disabled="isDisabled"></el-input> -->
<el-select v-model="editForm.lesseeGender" :disabled="isDisabled">
<el-option label="男" value="男"></el-option>
<el-option label="女" value="女"></el-option>
</el-select>
</el-form-item>
</div>
<div class="form_flex">
<el-form-item label="承租人电话:" prop="lesseePhone">
<el-input
v-model.trim="editForm.lesseePhone"
maxlength="11"
:disabled="isDisabled"
></el-input>
</el-form-item>
</div>
<!-- 承租人信息 end -->
<!-- 车辆信息 开始 -->
<div ref="carInfo" class="line_title glsx_hairline">车辆信息</div>
<div class="form_flex">
<el-form-item label="车牌号:">
<!-- <plate-number-input v-model="editForm.plateNo" :disabled="editForm.orderStatus == 2"></plate-number-input> -->
<plate-number-input
v-model="editForm.plateNo"
:disabled="type == 1 || type == 5"
></plate-number-input>
</el-form-item>
<el-form-item label="车架号:" prop="vin">
<el-input
v-model.trim="editForm.vin"
maxlength="17"
placeholder="请输入"
:disabled="type == 1 || type == 5"
></el-input>
</el-form-item>
</div>
<div class="form_flex">
<el-form-item label="发动机号:" prop="engineNo">
<el-input
v-model="editForm.engineNo"
maxlength="8"
placeholder="请输入"
:disabled="isDisabled"
></el-input>
</el-form-item>
<el-form-item label="排量:">
<el-input
v-model.trim="editForm.displacement"
maxlength="4"
placeholder="请输入"
:disabled="isDisabled"
>
<template slot="append">L</template>
</el-input>
</el-form-item>
</div>
<div class="form_flex">
<el-form-item label="品牌/车型:" prop="brandIds">
<el-cascader
v-model="editForm.brandIds"
class="el_cascader"
:disabled="isDisabled"
:options="carBrands"
:props="cascaderProps"
@change="onChange"
></el-cascader>
</el-form-item>
<el-form-item label="颜色:" prop="color">
<el-input
v-model="editForm.color"
maxlength="128"
placeholder="请输入"
:disabled="isDisabled"
></el-input>
</el-form-item>
</div>
<el-form-item label="备注:">
<el-input
type="textarea"
rows="4"
resize="none"
v-model.trim="editForm.remark"
maxlength="500"
:disabled="isDisabled"
></el-input>
</el-form-item>
<!-- 车辆信息 end -->
<!-- 安装照片 开始 -->
<div ref="imageUpload" class="line_title glsx_hairline">安装照片</div>
<!-- <image-upload v-model="editForm.workOrderDocs" :status="type"></image-upload> -->
<image-list
v-model="editForm.workOrderDocs"
:status="type"
></image-list>
<!-- 安装照片 end -->
<!-- 操作日志 开始 -->
<div ref="logInfo" class="line_title glsx_hairline">操作日志</div>
<el-form-item label="操作记录:">
<div class="log_list">
<div class="cell" v-for="(item, index) in logList" :key="index">
<span class="time">操作时间:{{ item.operateTime }}</span>
<span class="name">操作人:{{ item.operator }}</span>
</div>
</div>
</el-form-item>
<!-- 操作日志 end -->
</el-form>
</div>
<!-- 工单进度 开始 -->
<div v-show="activeMenu == 'orderProgress'">
<div class="line_title glsx_hairline">工单进度</div>
<order-progress :id="editForm.bizOrderNo"></order-progress>
</div>
<!-- 工单进度 end -->
</div>
</template>
<script>
// import provinceList from "@/common/province.json";
import PlateNumberInput from "@/components/plateNumberInput";
import GlsxOrganization from "@/components/glsx-organization";
import {
GET_DEVICE_COMPOSE,
GET_VEHICLE_SELECTEDTYPETREE,
GET_WORKORDER_INFO,
EDIT_WORKORDER_INFO,
VERIFY_DEVICE_INFO,
GET_CLASSIFYNAME_INFO,
ACTIVATE_WORKORDER_INFO,
GET_WORKORDER_OPERLOG,
VERIFY_WORKORDER_INFO,
UPDATE_ORDER_IMAGE,
} from "@/services/order";
import { Validator } from "@/common/validator";
import { showToast, deepClone, showModal } from "@/utils/util";
import moment from "moment";
import MapLocation from "@/components/amap";
import OrderProgress from "./progress";
import ImageUpload from "./image";
import ImageList from "./ImageList.vue";
/**
* type 1:查看工单,不可编辑 2:编辑工单 3:激活工单 4:审核工单 5: 单独编辑图片
* id 工单id
*/
export default {
name: "EditOrder",
components: {
PlateNumberInput,
GlsxOrganization,
MapLocation,
OrderProgress,
ImageUpload,
ImageList,
},
props: {
id: {
type: [String, Number],
default: "",
},
type: {
type: [String, Number],
default: 1,
},
status: {
type: [String, Number],
default: "",
},
},
data() {
// 校验
let _this = this;
function checkDevice(rule, value, cb) {
//let idx = rule.field.split(".")[1];
if (value && value.toString().length >= 6) {
let oParams = {
devices: [{ sn: value }],
workOrderId: _this.editForm.id,
};
_this.gpsloading = true;
VERIFY_WORKORDER_INFO(oParams).then((res) => {
_this.gpsloading = false;
if (res.code == 200) {
console.log(res);
let m = _this.editForm.snList;
let idx = m.findIndex((k) => k.sn == value);
let _arr = res.data || [];
let nd = _arr.find((k) => k.sn == value);
//if (nd) {
_this.$set(_this.editForm.snList, idx, nd || { sn: value });
//}
// GET_CLASSIFYNAME_INFO({ sn: value }).then((response) => {
// if (response.data) {
// //let idx = m.findIndex((k) => k.sn == value);
// let o = m[idx];
// //o = Object.assign(o, res.data);
// o.model = response.data;
// _this.$set(_this.editForm.snList, idx, o);
// }
// });
cb();
} else {
_this.gpsloading = false;
cb(new Error(res.message));
}
});
}
}
return {
activeMenu: "",
activeName: "first",
editForm: { needInstall: "Y", snList: [] },
provinceList: {},
cascaderProps: {
label: "name",
value: "id",
children: "childs",
},
cascaderPropsForArea: {
label: "name",
value: "id",
children: "districts",
},
deviceList: this.$store.state.deviceList,
carBrands: this.$store.state.vehicleCustomTree,
loading: false,
editFormRules: {
shopName: [
{ required: true, message: "请输入店面名称", trigger: "blur" },
],
shopContactor: [
{ required: true, message: "请输入联系人", trigger: "blur" },
],
shopTelephone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
{
pattern: Validator.PHONEREG,
message: "请输入正确的联系电话",
trigger: "blur",
},
],
shopAddress: [
{ required: true, message: "请输入联系地址", trigger: "blur" },
],
needInstall: [
{ required: true, message: "请选择是否需要安装", trigger: "change" },
],
serviceTime: [
{
required: true,
message: "请选择是否期望服务日期",
trigger: "change",
},
],
serviceApm: [
{
required: true,
message: "请选择是否期望服务日期",
trigger: "change",
},
],
areaId: [
{ required: true, message: "请选择服务区域", trigger: "change" },
],
serviceAddress: [
{ required: true, message: "请输入详细地址", trigger: "blur" },
],
deviceCompose: [
{ required: true, message: "请选择设备套餐", trigger: "change" },
],
lesseeName: [
{ required: true, message: "请输入承租人姓名", trigger: "blur" },
],
lesseePhone: [
{ required: true, message: "请输入承租人电话", trigger: "blur" },
{
pattern: Validator.PHONEREG,
message: "请输入正确的承租人电话",
trigger: "blur",
},
],
vin: [
{ required: true, message: "请输入车架号", trigger: "blur" },
{
pattern: Validator.CHECKVINNUMBER,
message: "17位英文和数字组合",
trigger: "blur",
},
],
engineNo: [
{ required: true, message: "请输入发动机号", trigger: "blur" },
],
brandIds: [
{ required: true, message: "请选择品牌/车型", trigger: "change" },
],
color: [{ required: true, message: "请输入颜色", trigger: "blur" }],
orgName: [
{
required: true,
message: "请选择车辆归属",
trigger: "change",
},
],
},
filterVisible: false,
deviceRules: [
{ required: true, message: "请输入设备SN号", trigger: "blur" },
{ validator: checkDevice },
],
activeRules: {
orgName: [
{
required: true,
message: "请选择车辆归属",
trigger: "change",
},
],
deviceCompose: [
{ required: true, message: "请选择设备套餐", trigger: "change" },
],
vin: [
{ required: true, message: "请输入车架号", trigger: "blur" },
{
pattern: Validator.CHECKVINNUMBER,
message: "17位英文和数字组合",
trigger: "blur",
},
],
},
formRules: {},
logList: [],
isDisabled: false,
gpsloading: false,
};
},
watch: {
id: {
handler: function(n, o) {
if (!n) {
return false;
}
this.getInfo();
this.getLogList();
},
immediate: true,
},
status: {
handler: function(n, o) {
if (n == 2) {
this.isDisabled = true;
}
},
},
},
created() {
let o = this.$store.state;
if (!o.deviceList || o.deviceList.length <= 0) {
this.getDevice();
}
if (!o.vehicleCustomTree || o.vehicleCustomTree.length <= 0) {
this.getCarBrand();
}
this.manageProvice();
},
mounted() {},
methods: {
// 处理省市区数据
manageProvice() {
const url = new URL("https:/img01.glsx.com.cn/js/province.json");
fetch(url)
.then((response) => response.json())
.then((data) => {
this.provinceList = data;
this.provinceList.map((k) => {
if (k.districts.length == 0) {
k.districts = undefined;
} else {
k.districts.map((j) => {
if (j.districts.length == 0) {
j.districts = undefined;
}
return j;
});
}
return k;
});
console.log(this.provinceList);
})
.catch((error) => {
console.error("Error:", error);
});
},
// 监听省市区选择
onCityChange(e) {
let list = this.provinceList;
// 查找省份
let p = list.find((k) => k.id == e[0]);
// 查找市
// let c = (p.childs || []).find((k) => k.id == e[1]);
let c = p && p.districts ? p.districts.find((k) => k.id == e[1]) : null;
// 查找区
// let a = (c.childs || []).find((k) => k.id == e[2]);
let a = c && c.districts ? c.districts.find((k) => k.id == e[2]) : null;
let o = {
province: p.name,
city: c ? c.name : "",
district: a ? a.name : "",
};
this.editForm = Object.assign(this.editForm, o);
},
// 获取设备组合
getDevice() {
GET_DEVICE_COMPOSE().then((res) => {
let list = res.data || [];
this.deviceList = list;
this.$store.commit("updateDeviceAssembly", list);
});
},
// 获取车型
getCarBrand() {
GET_VEHICLE_SELECTEDTYPETREE().then((res) => {
let list = res.data || [];
this.carBrands = list;
this.$store.commit("updateVehicleCustomTree", list);
});
},
// 监听车型选择
onChange(e) {
if (!e || e.length <= 0) {
return false;
}
let list = this.carBrands;
// 找第一级
let m = list.find((k) => k.id == e[0]);
// 找第二级
let n = (m.childs || []).find((k) => k.id == e[1]);
// 找第三级
let s = (n.childs || []).find((k) => k.id == e[2]);
// 找第四级
let f = (s.childs || []).find((k) => k.id == e[3]);
let o = {};
o.brandId = e[0];
o.subBrandId = e[1];
o.seriesId = e[2];
o.typeId = e[3];
o.brandName = m.name;
o.subBrandName = n.name;
o.seriesName = s.name;
o.typeName = f.name;
this.editForm = Object.assign(this.editForm, o);
},
// 获取工单详情
getInfo() {
let _this = this;
let oParams = {};
oParams.orderId = this.id;
this.loading = true;
GET_WORKORDER_INFO(oParams).then((res) => {
this.loading = false;
let { data } = res;
let o = { ...data };
let n =
data.vehicles && data.vehicles.length >= 0 ? data.vehicles[0] : {};
let m = Object.assign(o, n);
// 品牌车型回显用
if (m.brandId && m.subBrandId && m.seriesId && m.typeId) {
m.brandIds = [m.brandId, m.subBrandId, m.seriesId, m.typeId];
}
//省市区 回显用
m.areaId = this.getProvince(m);
// 循环设备
let arr = [];
if (n.devices && n.devices.length > 0) {
n.devices.map((k) => {
k.deviceClassifyName = k.model;
return k;
});
arr = n.devices;
} else {
for (var i = 0; i < m.deviceCnt; i++) {
arr.push({ id: moment().format("x") });
}
}
m.snList = arr;
const receiverParts = [
m.receiverName,
m.receiverPhone,
m.receiverAddress,
].filter((item) => item);
m.receiverInfo =
receiverParts.length > 0 ? receiverParts.join("/") : "";
this.editForm = m;
this.batchCheckDevices(arr);
setTimeout(() => {
_this.initRules();
}, 100);
});
},
// 控制页面滚动
scrollTo(refName) {
let _this = this;
let element = this.$refs[refName];
_this.activeMenu = refName;
if (refName == "orderProgress") {
return false;
}
let m = setInterval(function() {
if (element) {
console.log(new Date());
clearInterval(m);
const top = element.offsetTop;
console.log(top);
_this.$nextTick(() => {
setTimeout(() => {
window.document.querySelector(".dialog_content").scrollTop =
top - 60;
}, 100);
});
}
}, 100);
},
// 获取省市区
getProvince(row) {
let list = this.provinceList;
if (!row.province && !row.city && !row.district) {
return [];
}
// 查找省份
let p = list.find((k) => k.name == row.province);
console.log("p", p);
// 查找市
// let c = p ? (p.childs || []).find((k) => k.name == row.city) : {};
let c =
p && p.districts ? p.districts.find((k) => k.name == row.city) : null;
console.log("c", c);
// 查找区
// let a = c ? (c.childs || []).find((k) => k.name == row.district) : {};
let a =
c && c.districts
? c.districts.find((k) => k.name == row.district)
: null;
console.log("a", a);
let arr = [];
if (p) {
arr.push(p.id);
}
if (c) {
arr.push(c.id);
}
if (a) {
arr.push(a.id);
}
return arr;
// return [p ? p.id : "", c ? c.id : "", a ? a.id : ""];
},
// 编辑工单信息
saveInfo() {
let _this = this;
_this.$refs.editForm.validate((valid) => {
if (!valid) {
_this.$emit("change", false);
return false;
}
// 校验固定位置照片是否为空
if (!_this.checkFixedImage()) {
return false;
}
let oParams = _this.getEditParams();
console.log(oParams);
EDIT_WORKORDER_INFO(oParams).then((res) => {
if (res.code != 200) {
showToast({
message: res.message,
});
_this.$emit("change", false);
return false;
}
showToast({
message: "编辑成功",
type: "success",
});
_this.$emit("change", true);
});
});
},
// 组合编辑工单信息
getEditParams() {
let oParams = {};
let o = deepClone(this.editForm);
console.log(o);
let m = {};
oParams.id = o.id;
oParams.shopName = o.shopName;
oParams.shopContactor = o.shopContactor;
oParams.shopTelephone = o.shopTelephone;
oParams.shopAddress = o.shopAddress;
oParams.serviceType = o.serviceType;
oParams.needInstall = o.needInstall;
// 有安装
if (oParams.needInstall == "Y") {
oParams.serviceLinkerPhone = o.serviceLinkerPhone;
//oParams.notifyTarget = o.notifyTarget;
//oParams.serviceLinker = o.serviceLinker;
oParams.serviceTime = o.serviceTime;
oParams.serviceApm = o.serviceApm;
oParams.province = o.province;
oParams.city = o.city;
oParams.district = o.district;
oParams.serviceAddress = o.serviceAddress;
}
//oParams.serviceExplain = o.serviceExplain;
oParams.bizOrderNo = o.bizOrderNo;
// 车辆信息
m.lesseeName = o.lesseeName;
m.lesseeGender = o.lesseeGender;
m.vin = o.vin;
m.deviceCompose = o.deviceCompose;
m.plateNo = o.plateNo;
m.lesseePhone = o.lesseePhone;
m.brandId = o.brandId;
m.brandName = o.brandName;
m.subBrandId = o.subBrandId;
m.subBrandName = o.subBrandName;
m.seriesId = o.seriesId;
m.seriesName = o.seriesName;
m.typeId = o.typeId;
m.typeName = o.typeName;
m.engineNo = o.engineNo;
m.color = o.color;
m.remark = o.remark;
m.displacement = o.displacement;
oParams.vehicles = [m];
// 图片
oParams.workOrderDocs = o.workOrderDocs;
return oParams;
},
// 监听组织树树
onOrganizationChange(e) {
this.filterVisible = false;
if (e) {
this.editForm.orgId = e.origin.orgId;
this.editForm.orgType = e.origin.type;
this.editForm.orgName = e.origin.orgName;
this.$refs.editForm.validateField("orgName");
}
},
// 激活工单
activeDevice(type) {
let _this = this;
let o = deepClone(this.editForm);
let m = o.snList;
let arr = [];
let oParams = {};
_this.$refs.editForm.validate((valid) => {
if (!valid) {
_this.$emit("change", false);
return false;
}
// 校验固定位置照片是否为空
if (!_this.checkFixedImage()) {
return false;
}
m.map((k) => {
arr.push({ sn: k.sn });
});
oParams.devices = arr;
oParams.workOrderId = o.id;
oParams.orgId = o.orgId;
oParams.activateType = type || 1;
oParams.workOrderDocs = o.workOrderDocs;
oParams.plateNo = o.plateNo;
oParams.vin = o.vin;
// oParams.plateNo = o.plateNo;
// oParams.vin = o.vin;
ACTIVATE_WORKORDER_INFO(oParams).then((res) => {
if (res.code != 200) {
showToast({
message: res.message,
});
_this.$emit("change", false);
return false;
}
showToast({
message: "激活成功",
type: "success",
});
_this.$emit("change", true);
});
});
},
// 重置
rest() {
let _this = this;
setTimeout(function() {
_this.editForm = {};
_this.$refs.editForm.clearValidate();
}, 100);
},
// 获取工单日志
getLogList() {
let oParams = {};
oParams.orderId = this.id;
GET_WORKORDER_OPERLOG(oParams).then((res) => {
this.logList = res.data || [];
});
},
// 初始化页面校验条件
initRules() {
let _id = "orderInfo";
switch (this.type) {
case 5:
// 编辑照片
this.formRules = {};
this.isDisabled = true;
_id = "imageUpload";
break;
case 4:
// 审核工单
this.formRules = this.activeRules;
this.isDisabled = true;
_id = "deviceInfo";
break;
case 3:
// 激活工单
this.formRules = this.activeRules;
this.isDisabled = true;
_id = "deviceInfo";
break;
case 2:
// 编辑工单
this.formRules = this.editFormRules;
this.isDisabled = false;
_id = "orderInfo";
break;
default:
// 查看工单
this.formRules = this.editFormRules;
this.isDisabled = false;
_id = "orderInfo";
break;
}
this.scrollTo(_id);
},
// 审核工单
auditWorkOrderInfo() {
this.activeDevice(2);
},
// 获取地图数据
getMapInfo(row) {
console.log(row);
let m = this.editForm;
let gpsInfo = row.gpsBsData ? row.gpsBsData.gpsLocation : {};
let bsInfo = row.gpsBsData ? row.gpsBsData.bsLocation : {};
let oParams = {};
oParams.sn = row.sn || "";
//oParams.gpsData
oParams.name = row.ownerName || "";
oParams.standNo = m.vin || "";
oParams.source = row.source || "";
// gps 信息
oParams.lng = gpsInfo.lng;
oParams.lat = gpsInfo.lat;
oParams.address = gpsInfo.address || "";
oParams.time = gpsInfo.dateTime || "";
//基站信息
oParams.bsLng = bsInfo.lng;
oParams.bsLat = bsInfo.lat;
oParams.bsAddress = bsInfo.address || "";
oParams.bsTime = bsInfo.dateTime || "";
// 定位类型
oParams.type = 2;
oParams.alarmTypeSet = row.alarmTypeSet || [];
return oParams;
},
// 展开地图
lookLocation(row, index) {
let list = deepClone(this.editForm.snList);
let gpsInfo = row.gpsBsData ? row.gpsBsData.gpsLocation : {};
let bsInfo = row.gpsBsData ? row.gpsBsData.bsLocation : {};
if (!gpsInfo.lng || !bsInfo.lng) {
showToast({
message: "暂无位置点信息",
});
return false;
}
list.map((k) => {
if (k.sn != row.sn) {
k.showMap = false;
} else {
k.showMap = true;
}
return k;
});
//row.showMap = true;
this.$set(this.editForm, "snList", list);
},
// 批量查询校验sn
batchCheckDevices(arr) {
let _this = this;
if (this.type != 4) {
return false;
}
if (!arr || arr.length <= 0) {
return false;
}
let oParams = {};
let list = [];
arr.map((k) => {
if (k.sn) {
list.push({ sn: k.sn });
}
});
oParams.workOrderId = this.editForm.id;
oParams.devices = list;
VERIFY_WORKORDER_INFO(oParams).then((res) => {
if (res.code == 200) {
let { data } = res;
_this.$set(_this.editForm, "snList", data || []);
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
},
// 关闭地图
closeMapLocation(row, index) {
row.showMap = false;
this.$set(this.editForm.snList, index, row);
},
// 单独保存照片
saveImageInfo() {
let _this = this;
let m = this.editForm;
let oParams = {};
oParams.workOrderId = m.id;
oParams.workOrderDocs = m.workOrderDocs;
if (!this.checkFixedImage()) {
return false;
}
// for (let i = 0, len = m.workOrderDocs.length; i < len; i++) {
// let o = m.workOrderDocs[i];
// if (!o.path && o.source == "bhg") {
// showToast({
// message: `请上传${o.originName}`,
// });
// this.$emit("change", false);
// return false;
// }
// }
UPDATE_ORDER_IMAGE(oParams).then((res) => {
if (res.code != 200) {
showToast({
message: res.message,
});
_this.$emit("change", false);
return false;
}
showToast({
message: "保存成功",
type: "success",
});
_this.$emit("change", true);
});
},
// 校验固定位置照片
checkFixedImage() {
let m = this.editForm || {};
let _list = m.workOrderDocs || [];
for (let i = 0, len = _list.length; i < len; i++) {
let o = _list[i];
if (!o.path && o.source == "bhg") {
showToast({
message: `请上传${o.originName}`,
});
this.$emit("change", false);
return false;
}
}
return true;
},
},
};
</script>
<style lang="scss" scoped>
.form_flex {
display: flex;
align-items: center;
.el-form-item {
flex: 0 0 50%;
}
}
.line_form_flex {
display: flex;
.el_datepicker {
margin-right: 10px;
}
}
.line_title {
font-size: 14px;
color: #606266;
font-weight: bold;
line-height: 2;
padding: 10px 0;
margin-bottom: 30px;
}
.form_device_flex {
align-items: center;
.el-form-item {
flex: auto;
}
.device_tips {
margin-bottom: 18px;
padding-left: 10px;
color: #439900;
font-size: 12px;
}
.cred {
color: #f00;
}
.el_btn {
margin-left: 4px;
margin-bottom: 18px;
}
}
.log_list {
.cell {
display: flex;
align-items: center;
// justify-content: space-between;
font-size: 14px;
color: #999;
.name,
.time {
margin-right: 16px;
}
}
}
.map_wrapper {
position: relative;
.el_icon {
position: absolute;
top: 0;
right: 0;
z-index: 99999;
cursor: pointer;
font-size: 24px;
}
}
</style>
<template>
<div class="image_upload_page">
<!-- 图片列表 开始 -->
<div class="img_cell" v-if="imgInfo.path">
<div class="el_img_box">
<i
class="el-icon-error el_icon"
@click="removeImage(imgInfo)"
v-if="readStatus != 1"
></i>
<el-image
class="el_img"
:src="imgInfo.path"
:preview-src-list="getPreViewList(imgInfo.path)"
></el-image>
</div>
</div>
<!-- 图片列表 end -->
<!-- 上传 开始 -->
<el-upload
class="el_upload"
v-if="showUpload()"
:action="uploadUrl"
list-type="picture-card"
:accept="acceptFile"
:show-file-list="false"
:on-change="onChange"
:http-request="uploadRequest"
>
<i class="el-icon-upload2"></i>
</el-upload>
<!-- 上传 end -->
</div>
</template>
<script>
import axios from "axios";
import sign from "@/utils/sign";
import qs from "qs";
import { DELETE_ORDER_IMAGE } from "@/services/order";
import { showToast } from "@/utils/util";
export default {
name: "ImageUpload",
props: {
value: {
type: Object,
default: function () {
return [];
},
},
status: {
type: [String, Number],
default: "",
},
limit: {
type: [String, Number],
default: 1,
},
list: {
type: Array,
default: function () {
return [];
},
},
},
data() {
return {
imgInfo: {},
uploadUrl: "",
readStatus: "",
acceptFile: ".jpg,.png",
previewList: [],
};
},
watch: {
value: {
handler: function (n, o) {
this.imgInfo = n;
},
immediate: true,
},
status: {
handler: function (n, o) {
console.log(n);
this.readStatus = n;
},
immediate: true,
},
},
mounted() {},
methods: {
// 监听选择图片
onChange(file, fileList) {
console.log(file);
},
// 图片转换成base64
toBase64(file) {
let _this = this;
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (event) => {
const imgFile = event.target.result;
const arrBase64 = imgFile.split(",");
let arr = file.name.split(".");
let _type = arr[arr.length - 1];
let fileInfo = _type + "@" + arrBase64[1];
let oParams = {
fileName: file.name,
file: fileInfo,
};
_this.uploadImage(oParams);
};
},
// 自定义上传
uploadRequest(e) {
let file = e.file;
if (file.size > 10 * 1024 * 1024) {
showToast({
message: "图片最大上传10M",
});
return false;
}
this.toBase64(file);
},
// 上传图片到服务器
uploadImage(params = {}, noSignAttr = ["file"]) {
let _this = this;
const fileUploadURL =
"https://didicb.glsx.com.cn" || localStorage.getItem("FILE_UPLOAD_URL");
//const fileUploadURL = 'http://qcdidicb.dev.glsx.com.cn:7060' // 给java后台测试用的地址
params.source = "glsx-oss-carowner";
params.app_key = "48e5e13229b82c1b4e6e8c96151f0637";
params.timestamp = new Date().getTime();
params.v = "1.0.0";
params.format = "json";
params.method = "glsx.accounts.biz.common.pictureUpload";
const data = sign(params, noSignAttr);
axios
.post(
`${fileUploadURL}/router?method=${params.method}`,
qs.stringify(data)
)
.then((res) => {
console.log(res);
let response = res.data;
if (response.returnCode == 0) {
// _this.imgList.push({ path: response.data });
// _this.previewList.push(res.data);
_this.$set(_this.imgInfo, "path", response.data);
//
//this.$emit("change", response.data);
_this.$emit("input", _this.imgInfo);
_this.$emit("change");
}
});
},
// 删除图片
removeImage(row) {
//数组中删除对应img
//this.imgList = this.imgList.filter((k) => k.path != row.path);
row.path = "";
row.changed = true;
this.$emit("input", row);
this.$emit("change");
// 删除存量图片
// if (row.id) {
// DELETE_ORDER_IMAGE({ id: row.id });
// }
},
// 是否可以上传
showUpload() {
let o = this.imgInfo || {};
if (this.readStatus == 1) {
return false;
}
if (o.source == "bhg" && o.path) {
return false;
}
// if (this.imgList && this.imgList.length >= this.limit) {
// return false;
// }
return true;
},
// 获取图片预览列表
getPreViewList(url) {
let _this = this;
let list = this.list || [];
let arr = [];
if (list.length > 20) {
list.length = 20;
}
list.map((k) => {
if (k.pah == url) {
arr.unshift(k.path);
} else {
if(k.path){
arr.push(k.path);
}
}
});
return arr;
},
},
};
</script>
<style lang="scss">
.el_upload {
.el-upload--picture-card {
width: 120px !important;
height: 120px;
line-height: 118px;
}
}
</style>
<style lang="scss" scoped>
.image_upload_page {
display: flex;
flex-wrap: wrap;
}
.el_upload {
margin: 0 10px 0px 0;
}
.img_cell {
display: flex;
flex-wrap: wrap;
.el_img_box {
position: relative;
width: 120px;
height: 120px;
border-radius: 4px;
border: 1px dashed #d8d8d8;
padding: 4px;
margin: 0 10px 0px 0;
box-sizing: border-box;
.el_icon {
position: absolute;
top: 0;
right: 0;
z-index: 2;
color: #f00;
font-size: 20px;
display: none;
cursor: pointer;
}
.el_img {
width: 100%;
height: 100%;
border-radius: 4px;
}
}
.el_img_box:hover {
.el_icon {
display: block;
}
}
}
</style>
\ No newline at end of file
<template>
<div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div class="">
<!-- 搜索区域 开始 -->
<div class="search_box">
<el-form :inline="true" size="small">
<el-form-item>
<div class="pre_select_box">
<el-select
v-model="searchForm.timeType"
class="sort_select"
placeholder="请选择"
>
<el-option label="创建时间" value="1"></el-option>
<el-option label="期望服务时间" value="2"></el-option>
</el-select>
<el-date-picker
v-model="searchForm.dateRange"
class="data_picker"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="~"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="是否需要安装">
<el-select v-model="searchForm.needInstall" class="small_select">
<el-option label="全部" value=""></el-option>
<el-option label="无需安装" value="N"></el-option>
<el-option label="需要安装" value="Y"></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单归属:">
<el-popover
v-model="filterVisible"
placement="bottom-start"
width="400"
trigger="click"
>
<div>
<glsx-organization @change="onChange"></glsx-organization>
</div>
<el-input
v-model="searchForm.orgName"
:placeholder="searchForm.specialShopName || '所属组织'"
slot="reference"
readonly
clearable
>
</el-input>
</el-popover>
</el-form-item>
<el-form-item label="服务类型:">
<el-select
v-model="searchForm.serviceType"
class="small_select"
placeholder="请选择"
>
<el-option label="全部" value=""></el-option>
<el-option label="安装工单" value="IS"></el-option>
</el-select>
</el-form-item>
<el-form-item label="系统工单状态:">
<el-select
v-model="searchForm.orderStatus"
class="small_select"
placeholder="请选择"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in statusList"
:key="`s_${index}`"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字:">
<el-input
v-model="searchForm.term"
class="long_input"
maxlength="50"
placeholder="设备号|车架号|姓名|业务工单号|系统工单号"
></el-input>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="getList(1)"
>搜索</el-button
>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh" type="default" @click="rest()"
>重置</el-button
>
</el-form-item>
</el-form>
</div>
<!-- 搜索区域 end -->
<!-- 操作区域 开始 -->
<div class="links_group">
<span class="name">工单管理</span>
<div>
<el-button
type="primary"
icon="el-icon-download"
size="small"
:loading="iloading"
@click="dowloadZipFiles()"
>图片导出</el-button
>
<el-button
type="primary"
icon="el-icon-upload2"
size="small"
@click="openDialog()"
>批量导入</el-button
>
<el-button
type="primary"
icon="el-icon-plus"
size="small"
@click="addOrder"
>工单新增</el-button
>
<el-button
type="primary"
icon="el-icon-download"
size="small"
:loading="dloading"
@click="downloadExcel()"
>导出excel</el-button
>
</div>
</div>
<!-- 操作区域 end -->
<!-- 表格区域 开始 -->
<div class="table_box">
<el-table
class="el_table"
:data="tableData"
border
size="small"
v-loading="tabLoading"
@selection-change="onSelectionChange"
>
<el-table-column type="selection" width="50" />
<el-table-column label="序号" type="index"></el-table-column>
<!-- <el-table-column label="系统工单号" prop="orderNo" :width="tdWidth"></el-table-column> -->
<el-table-column label="服务类型" prop="serviceType"></el-table-column>
<el-table-column
label="店面名称"
prop="shopName"
:width="tdWidth"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="业务工单号"
prop="bizOrderNo"
:width="longTdWidth"
></el-table-column>
<el-table-column
label="姓名"
prop="ownerName"
:width="tdWidth"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="车架号"
prop="vin"
:width="longTdWidth"
></el-table-column>
<el-table-column
label="设备组合"
prop="deviceCompose"
:width="tdWidth"
show-overflow-tooltip
></el-table-column>
<el-table-column label="设备数量" prop="deviceCnt"></el-table-column>
<el-table-column
label="期望服务时间"
prop="serviceTime"
:width="tdWidth"
></el-table-column>
<el-table-column label="所属组织" prop="tenantName"></el-table-column>
<el-table-column
label="系统工单状态"
prop="statusDesc"
:width="tdWidth"
></el-table-column>
<!-- <el-table-column label="安装服务商" prop="serviceProvider" :width="tdWidth"></el-table-column>
<el-table-column label="安装技工" prop="mechanicName" :width="tdWidth"></el-table-column> -->
<el-table-column
label="工单归属"
prop="createdBy"
:width="longTdWidth"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="创建时间"
prop="createdDate"
:width="tdWidth"
></el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="210px">
<template slot-scope="{ row }">
<el-link class="el_link" type="primary" @click="lookDetail(row, 1)"
>查看</el-link
>
<el-link
class="el_link"
type="primary"
v-if="row.status == 0 || row.status == 1"
@click="lookDetail(row, 2)"
>编辑</el-link
>
<auth-link
class="el_link"
type="primary"
name="删除"
v-if="row.status != 4"
@click.native="removeOrder(row)"
>删除</auth-link
>
<!-- <el-link class="el_link" type="primary" v-if="row.status == 0 ||row.status == 1" @click="lookDetail(row,3)">激活</el-link>
<el-link class="el_link" type="primary" v-if="row.status == 5" @click="lookDetail(row,4)">审核</el-link> -->
<auth-link
class="el_link"
type="primary"
permission-tag="WORK_ORDER_ACTIVATE_BUTTON"
v-if="row.status == 0 || row.status == 1"
@click.native="lookDetail(row, 3)"
>激活</auth-link
>
<auth-link
class="el_link"
type="primary"
permission-tag="WORK_ORDER_APPROVE_BUTTON"
v-if="row.status == 5"
@click.native="lookDetail(row, 4)"
>审核</auth-link
>
<auth-link
class="el_link"
type="primary"
v-if="row.status == 2"
uid="14010101"
name="照片编辑"
@click.native="lookDetail(row, 5)"
>照片编辑</auth-link
>
<el-dropdown
trigger="click"
@command="(e) => onCommand(e, row)"
v-if="
hasPermission('work_order_associated') &&
(row.status == 1 || row.status == 0)
"
>
<el-button
class="btn_mini_size"
icon="el-icon-arrow-down"
size="mini"
></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
command="1"
v-if="hasPermission('work_order_associated')"
>关联车辆</el-dropdown-item
>
<el-dropdown-item
v-if="hasPermission('WORK_ORDER_REPUSH_BUTTON')"
@click.native="workOrderRePush(row)"
>工单重推</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination
background
layout="sizes, total,prev, pager, next, jumper"
:total="pageTotal"
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:page-sizes="pageSizes"
@current-change="getList"
@size-change="changePageSize"
/>
</div>
</div>
<!-- 表格区域 end -->
<!-- 弹框 开始 -->
<glsx-dialog
:show="showDialog"
title="批量操作"
width="560px"
@close="closeDialog()"
>
<div>
<div class="upload_box" v-show="!showResult">
<div class="input_box">
<el-input
v-model="uploadFile.name"
placeholder="请选择需要导入的工单表格"
class="a_input"
size="small"
readonly
></el-input>
<el-upload
ref="elUpload"
:action="IMPORT_WORKORDER_FILES"
:headers="uploadHeaders"
:show-file-list="false"
:auto-upload="false"
:on-change="onFileChange"
:on-success="onSuccess"
>
<el-button size="small" type="primary">选择文件</el-button>
</el-upload>
</div>
<div class="tips">*请选择需要导入的工单表格*</div>
</div>
<div class="upload_result" v-show="showResult">
<div class="cell">
<span class="num">{{ uploadResult.succNum }}</span>
<span>成功记录</span>
</div>
<div class="cell">
<span class="num cred">{{ uploadResult.failNum }}</span>
<span>失败记录</span>
</div>
</div>
</div>
<div slot="footer">
<div class="dialog_links">
<div>
<el-button
type="primary"
size="small"
v-if="!showResult"
@click="downloadTemplate()"
>下载模板</el-button
>
<el-button
type="primary"
size="small"
v-if="showResult && uploadResult.failFile"
@click="downloadFail()"
>导出失败记录</el-button
>
</div>
<div class="">
<el-button
type="primary"
size="small"
:loading="loading"
:disabled="!uploadFile.name"
v-if="!showResult"
@click="saveFile()"
>确认</el-button
>
<el-button type="default" size="small" @click="closeDialog()"
>关闭</el-button
>
</div>
</div>
</div>
</glsx-dialog>
<!-- 弹框 end -->
<!-- 查看工单 开始 -->
<glsx-dialog
:show="showWorkDialog"
:show-close="false"
@close="closeDetailDialog()"
:appendtobody="true"
>
<div class="custom_title" slot="title">
<span class="name">{{ dialogTitle[orderType] }}</span>
<div class="dialog_menu">
<a
href="javascript:void(0)"
:class="activeId == item.id ? 'active' : ''"
v-for="(item, index) in menus"
:key="index"
@click="linkEvent(item)"
>{{ item.name }}</a
>
</div>
</div>
<div>
<edit-order
ref="editOrderCom"
:id="orderId"
:type="orderType"
@change="onEditChange"
></edit-order>
</div>
<div slot="footer">
<el-button
type="primary"
size="small"
:loading="aloading"
v-if="orderType == 1 && orderInfo.status == 2"
@click="goCarDetail()"
>车辆详情</el-button
>
<el-button
type="primary"
size="small"
:loading="aloading"
v-if="orderType == 3"
@click="activeDevice()"
>激活</el-button
>
<el-button
type="primary"
size="small"
:loading="aloading"
v-if="orderType == 2"
@click="saveInfo()"
>提交</el-button
>
<el-button
type="primary"
size="small"
:loading="aloading"
v-if="orderType == 4"
@click="auditWorkOrderInfo()"
>审核</el-button
>
<el-button
type="primary"
size="small"
:loading="aloading"
v-if="orderType == 5"
@click="saveImageInfo()"
>保存</el-button
>
<el-button type="default" size="small" @click="closeDetailDialog()"
>关闭</el-button
>
</div>
</glsx-dialog>
<!-- 查看工单 end -->
<!-- 关联车辆 开始 -->
<glsx-dialog
:show="showCarDialog"
title="关联车辆"
width="600px"
:appendtobody="true"
@close="closeCarDialog()"
>
<div v-loading="carLoading">
<el-form
ref="carInfoForm"
:model="carInfoForm"
:rules="carInfoFormRules"
label-width="140px"
>
<el-form-item label="请选择对应车辆:" prop="vehicleId">
<el-select
class="a_select"
v-model="carInfoForm.vehicleId"
@change="onCarChange"
>
<el-option
v-for="(item, index) in vehicleList"
:key="index"
:value="item.vehicleId"
:label="item.vin"
></el-option>
</el-select>
</el-form-item>
<el-form-item
v-if="
currentVehicle.ownerName ||
currentVehicle.shopName ||
currentVehicle.bizOrderNo
"
>
<div class="car_info_box">
<div class="cell">
<div class="name">姓名:</div>
<div class="txt">{{ currentVehicle.ownerName || "--" }}</div>
</div>
<div class="cell">
<div class="name">店面名称:</div>
<div class="txt">{{ currentVehicle.shopName || "--" }}</div>
</div>
<div class="cell">
<div class="name">业务工单:</div>
<div class="txt">{{ currentVehicle.bizOrderNo || "--" }}</div>
</div>
</div>
</el-form-item>
</el-form>
</div>
<div slot="footer">
<el-button
type="primary"
size="small"
:loading="aloading"
@click="saveLinkInfo()"
>保存</el-button
>
<el-button type="default" size="small" @click="closeCarDialog()"
>关闭</el-button
>
</div>
</glsx-dialog>
<!-- 关联车辆 end -->
</div>
</template>
<script>
// import GlsxDialog from "@/components/dialog";
import {
GET_WORKORDER_SEARCH,
GET_WORKORDER_EXPORT,
GET_WORKORDER_BATCHEXPORTPICS,
GET_WORKORDER_TEMPLATEFILE,
IMPORT_WORKORDER_FILES,
GET_WORKORDER_STATUSOPTION,
DELETE_ORDER_INFO,
GET_VEHICLE_LIST_BY_VIN,
SAVE_RELINKVEHICLE_INFO,
REPUSH_TO_BHG,
} from "@/services/order";
import { deepClone, showToast, showModal } from "@/utils/util";
import store from "@/store";
import GlsxOrganization from "@/components/glsx-organization";
import EditOrder from "./edit.vue";
import AuthLink from "@/components/auth-button/link";
export default {
components: {
// GlsxDialog,
GlsxOrganization,
EditOrder,
AuthLink,
},
data() {
return {
searchForm: { timeType: "1" },
currentPage: 1,
pageSizes: [10, 20, 30, 40],
pageSize: 10,
pageTotal: 0,
tableData: [],
showDialog: false,
uploadFile: {},
showResult: false,
loading: false,
dloading: false,
tabLoading: false,
filterVisible: false,
showWorkDialog: false,
orderId: "",
menus: [
{ id: "orderInfo", name: "工单信息" },
{ id: "orderProgress", name: "工单进度" },
{ id: "deviceInfo", name: "设备信息" },
{ id: "lesseeInfo", name: "承租人信息" },
{ id: "carInfo", name: "车辆信息" },
{ id: "logInfo", name: "操作日志" },
],
activeId: "orderInfo",
checkList: [],
iloading: false,
orderType: 1,
aloading: false,
IMPORT_WORKORDER_FILES,
uploadHeaders: {},
uploadResult: {},
dialogTitle: {
1: "查看工单",
2: "编辑工单",
3: "激活工单",
4: "审核工单",
5: "照片编辑",
},
statusList: [],
tdWidth: 140,
longTdWidth: 180,
orderInfo: {},
// 关联车辆弹框
showCarDialog: false,
carInfoForm: {},
vehicleList: [],
currentVehicle: {},
carInfoFormRules: {
vehicleId: [
{ required: true, message: "请选择对应车辆", trigger: "change" },
],
},
carLoading: false,
};
},
watch: {
$route: {
handler: function(n, o) {
if (n.query && n.query.refresh) {
this.currentPage = 1;
this.getList();
}
},
immediate: true,
},
},
created() {
let token = localStorage.getItem("token");
this.uploadHeaders = { Authorization: token };
this.getStatus();
},
mounted() {
this.getList();
},
methods: {
// 重置
rest() {
this.searchForm = { timeType: "1" };
this.pageSize = 10;
this.currentPage = 1;
this.getList();
},
// 获取查询参数
getParams() {
let oParams = deepClone(this.searchForm);
let m = oParams.dateRange;
if (m && m.length > 0) {
oParams.sDate = m[0];
oParams.eDate = m[1];
}
oParams.pageSize = this.pageSize;
delete oParams.dateRange;
delete oParams.orgName;
return oParams;
},
// 获取数据列表
getList(current) {
let oParams = this.getParams();
oParams.pageNumber = current || this.currentPage;
this.tabLoading = true;
GET_WORKORDER_SEARCH(oParams).then((res) => {
this.tabLoading = false;
let {
data: { list, totalElements },
} = res;
this.tableData = list;
this.pageTotal = totalElements;
});
},
//每页展示
changePageSize(e) {
this.pageSize = e;
this.getList();
},
// 监听文件导入
onFileChange(file, fileList) {
if (!file.response) {
this.uploadFile = file;
}
},
// 打开批量导入弹框
openDialog() {
this.showDialog = true;
},
// 关闭弹框
closeDialog() {
this.showDialog = false;
this.uploadFile = {};
this.uploadResult = {};
this.showResult = false;
},
// 上传文件
saveFile() {
if (!this.uploadFile.name) {
showToast({
message: "请选择上传文件",
});
return false;
}
this.loading = true;
this.$refs.elUpload.submit();
},
// 监听文件上传成功
onSuccess(response, file, fileList) {
this.loading = false;
if (response.code != 200) {
showToast({
message: response.message,
});
this.uploadFile = {};
this.$refs.elUpload.clearFiles();
return false;
}
this.uploadResult = response.data;
this.showResult = true;
this.getList();
},
// 新增工单
addOrder() {
this.$router.push({
name: "workOrderAdd",
});
},
// 图片批量导出
dowloadZipFiles() {
let _this = this;
let oParams = {};
let arr = [];
let list = this.checkList;
if (!list || list.length <= 0) {
showToast({
message: "请选择要导出的工单图片",
});
return false;
}
list.map((k) => {
arr.push(k.id);
});
oParams.orderIds = arr.toString();
_this.iloading = true;
GET_WORKORDER_BATCHEXPORTPICS(oParams)
.then((res) => {
_this.iloading = false;
if (res.code != 200) {
showToast({
message: res.message,
});
return false;
}
if (res.data) {
window.open(res.data);
}
})
.catch((error) => {
_this.iloading = false;
});
// _this.$Common.exportExcel({
// url: `${store.state.baseURL}${GET_WORKORDER_BATCHEXPORTPICS}`,
// method: "GET",
// data: oParams,
// fileName: `图片${moment().format("YYYY-MM-DD")}.zip`,
// success: () => {
// _this.iloading = false;
// },
// fail: () => {
// _this.iloading = false;
// },
// });
},
// 导出excel
downloadExcel() {
let _this = this;
let oParams = this.getParams();
_this.dloading = true;
_this.$Common.exportExcel({
url: `${store.state.baseURL}${GET_WORKORDER_EXPORT}`,
method: "GET",
data: oParams,
fileName: "工单列表.xlsx",
success: () => {
_this.dloading = false;
},
fail: () => {
_this.dloading = false;
},
});
},
// 监听树
onChange(e) {
this.filterVisible = false;
if (e) {
this.orgInfo = e.origin;
this.searchForm.orgId = e.origin.orgId;
this.searchForm.orgType = e.origin.type;
this.searchForm.orgName = e.origin.orgName;
}
},
// 查看、编辑工单
lookDetail(row, type) {
this.showWorkDialog = true;
this.orderId = row.id;
this.orderType = type;
this.orderInfo = row;
this.menus = [
{ id: "orderInfo", name: "工单信息" },
{ id: "orderProgress", name: "工单进度" },
{ id: "deviceInfo", name: "设备信息" },
{ id: "lesseeInfo", name: "承租人信息" },
{ id: "carInfo", name: "车辆信息" },
{ id: "logInfo", name: "操作日志" },
];
if (row.needInstall != "Y") {
this.menus = [
{ id: "orderInfo", name: "工单信息" },
{ id: "deviceInfo", name: "设备信息" },
{ id: "lesseeInfo", name: "承租人信息" },
{ id: "carInfo", name: "车辆信息" },
{ id: "logInfo", name: "操作日志" },
];
}
if (type == 3) {
this.activeId = "deviceInfo";
}
},
// 菜单切换
linkEvent(row) {
this.activeId = row.id;
this.$refs.editOrderCom.scrollTo(row.id);
},
// 监听表格选择
onSelectionChange(e) {
this.checkList = e;
},
// 关闭查看工单详情弹框
closeDetailDialog() {
this.showWorkDialog = false;
this.activeId = "orderInfo";
this.orderId = "";
this.orderInfo = {};
this.$refs.editOrderCom.rest();
},
// 下载模板
downloadTemplate() {
window.open(GET_WORKORDER_TEMPLATEFILE);
},
// 编辑工单
saveInfo() {
this.aloading = true;
this.$refs.editOrderCom.saveInfo();
},
// 监听编辑工单组件
onEditChange(e) {
this.aloading = false;
if (e) {
this.getList();
this.closeDetailDialog();
}
},
// 下载失败模板
downloadFail() {
let o = this.uploadResult;
window.open(o.failFile);
},
// 激活工单
activeDevice() {
this.aloading = true;
this.$refs.editOrderCom.activeDevice();
},
// 获取工单状态
getStatus() {
GET_WORKORDER_STATUSOPTION().then((res) => {
this.statusList = res.data || [];
});
},
// 查看车辆详情
goCarDetail() {
let row = this.orderInfo;
let oParams = {};
oParams.vin = row.vin;
let path = `/trialRun#/vehicleManage/vehicleList`;
this.$root.parentCommon.setBreadCrumbs(path);
history.pushState(oParams, "车辆列表", path);
},
// 审核工单
auditWorkOrderInfo() {
this.aloading = true;
this.$refs.editOrderCom.auditWorkOrderInfo();
},
// 保存工单
saveImageInfo() {
this.aloading = true;
this.$refs.editOrderCom.saveImageInfo();
},
// 删除工单
removeOrder(row) {
let _this = this;
showModal({
message: "确认删除该工单吗?",
showCancelButton: true,
success: function() {
let oParams = {};
oParams.orderId = row.id;
DELETE_ORDER_INFO(oParams).then((res) => {
if (res.code != 200) {
showToast({
message: res.message,
});
return false;
}
showToast({
message: "删除成功",
type: "success",
});
_this.getList();
});
},
});
},
// 关闭关联车辆弹框
closeCarDialog() {
let _this = this;
this.showCarDialog = false;
this.vehicleList = [];
this.currentVehicle = {};
this.carInfoForm = {};
this.orderId = "";
setTimeout(function() {
_this.$refs.carInfoForm.clearValidate();
}, 100);
},
// 点击下拉菜单
onCommand(e, row) {
console.log(row);
if (e == 1) {
this.showCarDialog = true;
this.orderId = row.id;
this.getVehicleList(row.vin);
}
},
// 是否有权限
hasPermission(id) {
let list = this.$root.parentCommon.getAuthData();
let idx = list.findIndex((k) => k.origin.permissionTag == id);
if (idx < 0) {
return false;
} else {
return true;
}
},
// 获取车辆列表
getVehicleList(vin) {
let _this = this;
_this.carLoading = true;
GET_VEHICLE_LIST_BY_VIN({ vin: vin })
.then((res) => {
_this.carLoading = false;
let list = res.data || [];
_this.vehicleList = list;
_this.currentVehicle = list[0] || {};
if (list[0]) {
_this.$set(_this.carInfoForm, "vehicleId", list[0].vehicleId);
}
})
.catch((error) => {
_this.carLoading = false;
});
},
// 订单关联车辆
async saveLinkInfo() {
let _this = this;
let oParams = {};
let _pass = await _this.$refs.carInfoForm
.validate()
.catch((err) => false);
console.log(_pass);
if (!_pass) {
return false;
}
_this.aloading = true;
oParams.orderId = this.orderId;
oParams.vehicleId = this.currentVehicle.vehicleId;
let res = await SAVE_RELINKVEHICLE_INFO(oParams);
_this.aloading = false;
if (res.code != 200) {
showToast({
message: res.message,
type: "error",
});
return false;
}
showToast({
message: "关联成功",
type: "success",
});
_this.closeCarDialog();
_this.getList(1);
console.log(res);
},
// 监听车辆选择
onCarChange(e) {
console.log(e);
let list = this.vehicleList;
let n = list.find((k) => k.vehicleId == e);
this.currentVehicle = n || {};
},
// 工单重推
workOrderRePush(row) {
this.$confirm(`是否工单重推?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
REPUSH_TO_BHG({ id: row.id }).then((res) => {
if (res.code == 200) {
this.$message({
type: "success",
message: "操作成功",
});
_this.getList();
} else {
this.$message({
type: "error",
message: "操作失败",
});
}
});
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/order.scss";
</style>
<template>
<div class="image_upload_page">
<!-- 图片列表 开始 -->
<template v-for="(item, index) in imgList">
<div class="img_cell" :key="index" v-if="limit > 0">
<div class="el_img_box">
<i
class="el-icon-error el_icon"
@click="removeImage(item)"
v-if="readStatus != 1"
></i>
<el-image
class="el_img"
:src="item.path"
:preview-src-list="getPreViewList(item.path, imgList)"
></el-image>
</div>
<div class="image_name" :title="item.originName">
{{ item.originName || item.name }}
</div>
</div>
</template>
<!-- 图片列表 end -->
<!-- 上传 开始 -->
<el-upload
class="el_upload"
v-if="showUpload()"
:action="uploadUrl"
list-type="picture-card"
:accept="acceptFile"
:show-file-list="false"
:on-change="onChange"
:http-request="uploadRequest"
>
<i class="el-icon-plus"></i>
</el-upload>
<!-- 上传 end -->
</div>
</template>
<script>
import axios from "axios";
import sign from "@/utils/sign";
import qs from "qs";
import { DELETE_ORDER_IMAGE } from "@/services/order";
import { showToast } from "@/utils/util";
export default {
name: "ImageOtherUpload",
props: {
value: {
type: Array,
default: function () {
return [];
},
},
status: {
type: [String, Number],
default: "",
},
limit: {
type: [String, Number],
default: 20,
},
nameIndex: {
type: Number,
default: 0,
},
list: {
type: Array,
default: function () {
return [];
},
},
},
data() {
return {
imgList: [],
uploadUrl: "",
readStatus: "",
acceptFile: ".jpg,.png",
previewList: [],
idx: 0,
};
},
watch: {
value: {
handler: function (n, o) {
this.imgList = n;
// if(!this.nameIndex){
// this.nameIndex = n.length;
// }
// console.log('666666666')
},
immediate: true,
},
status: {
handler: function (n, o) {
this.readStatus = n;
},
immediate: true,
},
nameIndex: {
handler: function (n) {
this.idx = n;
},
immediate: true,
},
},
mounted() {},
methods: {
// 监听选择图片
onChange(file, fileList) {
console.log(file);
},
// 图片转换成base64
toBase64(file) {
let _this = this;
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (event) => {
const imgFile = event.target.result;
const arrBase64 = imgFile.split(",");
let arr = file.name.split(".");
let _type = arr[arr.length - 1];
let fileInfo = _type + "@" + arrBase64[1];
let oParams = {
fileName: file.name,
file: fileInfo,
};
_this.uploadImage(oParams);
};
},
// 自定义上传
uploadRequest(e) {
let file = e.file;
if (file.size > 10 * 1024 * 1024) {
showToast({
message: "图片最大上传10M",
});
return false;
}
this.toBase64(file);
},
// 上传图片到服务器
uploadImage(params = {}, noSignAttr = ["file"]) {
let _this = this;
const fileUploadURL =
"https://didicb.glsx.com.cn" || localStorage.getItem("FILE_UPLOAD_URL");
//const fileUploadURL = 'http://qcdidicb.dev.glsx.com.cn:7060' // 给java后台测试用的地址
params.source = "glsx-oss-carowner";
params.app_key = "48e5e13229b82c1b4e6e8c96151f0637";
params.timestamp = new Date().getTime();
params.v = "1.0.0";
params.format = "json";
params.method = "glsx.accounts.biz.common.pictureUpload";
const data = sign(params, noSignAttr);
axios
.post(
`${fileUploadURL}/router?method=${params.method}`,
qs.stringify(data)
)
.then((res) => {
console.log(res);
let response = res.data;
if (response.returnCode == 0) {
_this.imgList.push({
path: response.data,
name: `照片${_this.idx + 1}`,
});
_this.previewList.push(res.data);
_this.idx += 1;
console.log(_this.imgList);
//
//this.$emit("change", response.data);
_this.$emit("input", _this.imgList);
_this.$emit("change");
}
});
},
// 删除图片
removeImage(row) {
//数组中删除对应img
//this.imgList = this.imgList.filter((k) => k.id != row.id);
this.imgList = this.imgList.filter((k) => k !== row);
this.$emit("input", this.imgList);
this.$emit("change");
// 删除存量图片
// if (row.id) {
// DELETE_ORDER_IMAGE({ id: row.id });
// }
},
// 是否可以上传
showUpload() {
console.log(this.readStatus);
if (this.readStatus == 1) {
return false;
}
console.log(
this.imgList + "----" + "-----" + this.imgList.length + this.limit
);
if (this.imgList && this.imgList.length >= this.limit) {
return false;
}
return true;
},
// 获取图片预览列表
getPreViewList(url) {
let _this = this;
let list = this.list || [];
let arr = [];
if (list.length > 20) {
list.length = 20;
}
list.map((k) => {
if (k.pah == url) {
arr.unshift(k.path);
} else {
if (k.path) {
arr.push(k.path);
}
}
});
return arr;
},
},
};
</script>
<style lang="scss">
.el_upload {
.el-upload--picture-card {
width: 120px !important;
height: 120px;
line-height: 118px;
}
}
</style>
<style lang="scss" scoped>
// .image_upload_page {
// // display: flex;
// // flex-wrap: wrap;
// }
.img_cell {
float: left;
display: flex;
flex-wrap: wrap;
flex-direction: column;
margin-bottom: 10px;
.el_img_box {
position: relative;
width: 120px;
height: 120px;
border-radius: 4px;
border: 1px dashed #d8d8d8;
padding: 4px;
margin: 0 10px 0px 0;
box-sizing: border-box;
.el_icon {
position: absolute;
top: 0;
right: 0;
z-index: 2;
color: #f00;
font-size: 20px;
display: none;
cursor: pointer;
}
.el_img {
width: 100%;
height: 100%;
border-radius: 4px;
}
}
.el_img_box:hover {
.el_icon {
display: block;
}
}
}
.image_name {
height: 30px;
width: 120px;
text-align: center;
overflow: hidden;
white-space: nowrap;
word-break: break-all;
text-overflow: ellipsis;
line-height: 30px;
}
</style>
\ No newline at end of file
<template>
<div>
<el-timeline>
<el-timeline-item v-for="(item, index) in list" :key="index" hide-timestamp>
<el-card class="el_card" :body-style="{ padding: '0px' }">
<h2 class="title">
<div class="name">【{{ item.userName?item.userName:'--' }}】{{ item.status?item.status:'--' }}</div>
<span class="time">{{ item.updateTime?item.updateTime:'--' }}</span>
</h2>
<template v-if="item.activeStatus == 8">
<p v-if="item.property1">安装地址:{{ item.property1?item.property1:'--' }}</p>
<p v-if="item.property2">激活地址:{{ item.property2?item.property2:'--' }}</p>
</template>
<template v-if="item.activeStatus == 125">
<p>打卡地址:{{ item.property1?item.property1:'--' }}</p>
<p v-if="item.property2">超时打卡原因:{{ item.property2?item.property2:'--' }}</p>
<p v-if="item.property2">超时备注:{{ item.reason?item.reason:'--' }}</p>
</template>
<template v-if="item.activeStatus == 120 || item.activeStatus == 7">
<p>联系人:{{ item.property1?item.property1 +' '+item.phone1:'--' }}</p>
<p>预约上门时间:{{ item.property2?item.property2:'--' }}</p>
<p>预约原因:{{ item.reason?item.reason:'--' }}</p>
</template>
<template v-if="item.activeStatus == 110">
<p>原指派技工:{{ item.property1?item.property1 +' '+item.phone1:'--' }}</p>
<p>新指派技工:{{ item.property2?item.property2 +' '+item.phone2:'--' }}</p>
</template>
<template v-if="item.activeStatus == 115">
<p>原安装地址:{{ item.property1?item.property1:'--' }}</p>
<p>新安装地址:{{ item.property2?item.property2:'--' }}</p>
</template>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</template>
<script>
import { GET_WORKORDER_PROGRESS } from "@/services/order";
export default {
name: "OrderProgress",
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
list: [],
};
},
watch: {
id: {
handler: function (n, o) {
if (n) {
this.getList();
}
},
immediate: true,
},
},
mounted() {
//this.getList();
},
methods: {
// 获取工单进度
getList() {
let oParams = {};
oParams.workOrderNo = this.id;
GET_WORKORDER_PROGRESS(oParams).then((res) => {
this.list = res.data || [];
});
},
},
};
</script>
<style lang="scss" scoped>
.el_card {
padding: 0 10px;
.title {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: normal;
font-size: 14px;
color: #999;
.name {
font-weight: bold;
color: #333;
}
}
}
</style>
\ No newline at end of file
<template>
<div class="system-container">
<div class="container">
<!-- <search-form class="searchTop border-shadow log_search" :formModel="searchForm" :formList="worklogFormList">
<span slot="form-slot">
<el-button type="primary" :size="btn_size" icon="el-icon-search" :id="tableParams.btnId">搜索</el-button>
<el-button type="primary" :size="btn_size" icon="el-icon-refresh" @click="refresh">重置</el-button>
</span>
</search-form> -->
<div class="log_search border-shadow">
<el-form :model="searchForm" label-width="80px" :inline="true" size="small">
<el-form-item label="">
<el-date-picker v-model="searchForm.daterange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item label="操作类型">
<el-select v-model="searchForm.term">
<el-option label="车辆绑定" value="车辆绑定"></el-option>
<el-option label="车辆解绑" value="车辆解绑"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :size="btn_size" icon="el-icon-search" :id="tableParams.btnId">搜索</el-button>
<el-button type="primary" :size="btn_size" icon="el-icon-refresh" @click="refresh">重置</el-button>
</el-form-item>
</el-form>
</div>
<h3>操作日志
<div class="pull-right">
<el-button type="primary" :size="btn_size" @click="exportTable">导出</el-button>
</div>
</h3>
<basic-table ref="worklogTable" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :searchForm="searchDataForm" :hasNum="false">
</basic-table>
</div>
</div>
</template>
<script>
import store from "@/store";
import { WORKLOG_API } from "@/config/config";
import { getWorkLogList, exportWorkLog } from "services/worklog";
export default {
data() {
return {
WORKLOGSTATUS: this.$Constants.WORKLOG_STATUS,
searchForm: {},
searchDataForm: {},
pickerOptions: {
disabledDate(time) {
return (
time.getTime() > Date.now() ||
time.getTime() < new Date("2017-12-31").getTime()
);
},
},
worklogFormList: [
{
type: "daterange",
prop: "daterange",
pickerOptions: {
disabledDate(time) {
return (
time.getTime() > Date.now() ||
time.getTime() < new Date("2017-12-31").getTime()
);
},
},
},
{
type: "select",
prop: "term",
label: "操作类型",
width: "80px",
placeholder: "请选择",
options: [
{ label: "车辆绑定", value: "车辆绑定" },
{ label: "车辆解绑", value: "车辆解绑" },
],
},
],
tableParams: {
// mutiSelectName: 'worklog',
// mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: "日志编号",
prop: "id",
width: 200,
},
{
label: "系统菜单",
prop: "module",
},
{
label: "操作类型",
prop: "action",
},
{
label: "操作账号",
prop: "operatorName",
},
{
label: "所属组织",
prop: "belongOrg",
},
{
label: "主机IP",
prop: "ip",
},
{
label: "操作状态",
prop: "result",
// addHtml: 'status'
},
{
label: "创建时间",
prop: "createdDate",
width: 150,
},
],
},
getListApi: getWorkLogList,
};
},
methods: {
refresh() {
this.searchForm = {};
this.searchDataForm = {};
this.$refs.worklogTable.refreshTable();
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
if (this.searchForm.daterange) {
this.searchDataForm.sDate = this.searchForm.daterange[0];
this.searchDataForm.eDate = this.searchForm.daterange[1];
} else {
if (this.searchDataForm.sDate)
delete this.searchDataForm.sDate &&
delete this.searchDataForm.eDate;
}
this.searchDataForm.term = this.searchForm.term;
resolve();
});
},
// 导出列表
exportTable() {
const params = this.$refs.worklogTable.page;
this.$Common.exportExcel({
url: store.state.baseURL + WORKLOG_API.WORKLOG_EXPORT,
data: params,
method: "GET",
fileName: "操作日志.xlsx",
});
},
},
};
</script>
<style lang="scss" scoped>
.log_search {
padding: 18px 18px 0 18px;
}
</style>
\ No newline at end of file
const path = require('path')
const { name, port } = require("./package");
function resolve(dir) {
return path.join(__dirname, dir)
}
const dev = process.env.NODE_ENV === "development";
const getPublicPath = dev ? `//localhost:${port}` : 'http://e-shield-system.glsx.com.cn';
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = {
// publicPath: dev ? `//localhost:${port}` : "/",
outputDir: "dist",
assetsDir: "static",
filenameHashing: true,
productionSourceMap: false,
devServer: {
overlay: {
warning: false,
errors: false
},
// 监听端口
port,
// 关闭主机检查,使微应用可以被 fetch
disableHostCheck: true,
// 配置跨域请求头,解决开发环境的跨域问题
headers: {
'Access-Control-Allow-Origin': '*'
}
},
lintOnSave: false,
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src'))
.set('components', resolve('src/components'))
.set('config', resolve('src/config'))
.set('utils', resolve('src/utils'))
.set('services', resolve('src/services'))
// const fontRule = config.module.rule('fonts');
// fontRule.uses.clear();
// fontRule
// .use('file-loader')
// .loader('file-loader')
// .options({
// name: 'fonts/[name].[hash:8].[ext]',
// //publicPath: getPublicPath
// })
// .end()
},
configureWebpack: {
output: {
// 微应用的包名,这里与主应用中注册的微应用名称一致
library: `${name}-[name]`,
// 将你的 library 暴露为所有的模块定义下都可运行的方式
libraryTarget: 'umd',
// 按需加载相关
jsonpFunction: `webpackJsonp_${name}`
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'disabled', // 不启动打包报告http服务器
generateStatsFile: false, // 是否生成stats.json文件
})
],
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!