调整前端代码格式符合ESLint规范

This commit is contained in:
zer0Black
2023-02-28 22:43:03 +08:00
parent f5e5990a3b
commit 77b1ca8f0d
48 changed files with 3199 additions and 3179 deletions
+5
View File
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
+17
View File
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: '@babel/eslint-parser'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
presets: [
'@vue/cli-plugin-babel/preset'
]
}
+10
View File
@@ -5,6 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"vueui": "vue ui"
},
"dependencies": {
@@ -33,10 +34,19 @@
"xe-utils": "^3.4.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-standard": "^6.1.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^8.0.3",
"sass": "^1.43.4",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
+56 -58
View File
@@ -5,65 +5,65 @@
</div>
</template>
<script>
import {loading} from "./utils/request";
import { loading } from './utils/request'
export default {
name: "ReportManager",
data() {
return {}
},
methods: {
getQueryVariable(r, variable) {
if (r) {
var query = r.split('?');
if (query && query.length == 2) {
var vars = query[1].split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
}
},
closeLoading() {
loading.close();
this.$store.commit('saveIsLoading', false);
},
},
created() {
let _that = this
// var path = window.location.search
// var ticket = this.getQueryVariable(path, 'ticket')
// var loginType = this.getQueryVariable(path, 'loginType')
// if (loginType == 1) {
// window.open('http://10.12.1.78:9090/cas/login?service=http://192.168.144.22:9966/home', '_self');
// } else {
// // if (ticket) {
// // var params = {
// // service: 'http://localhost:8080/home',
// // ticket: ticket
// // }
// // this.$api.login.loginByTicket(params).then(res => {
// // if (res.respCode !== '0') {
// // // this.verifyCode();
// // return this.$message.error(res.data.message);
// // }
// // this.$message.success('登录成功');
// // _that.$store.commit('saveUserInfo', res.data);
// // _that.$router.push('/home');
// // }).catch(_ => {
// // // this.verifyCode();
// // this.$router.push('/');
// // })
// //
// // } else {
// // this.$router.push('/');
// // }
// }
export default {
name: 'ReportManager',
data () {
return {}
},
methods: {
getQueryVariable (r, variable) {
if (r) {
const query = r.split('?')
if (query && query.length == 2) {
const vars = query[1].split('&')
for (let i = 0; i < vars.length; i++) {
const pair = vars[i].split('=')
if (pair[0] == variable) {
return pair[1]
}
}
}
}
},
closeLoading () {
loading.close()
this.$store.commit('saveIsLoading', false)
}
},
created () {
const _that = this
// var path = window.location.search
// var ticket = this.getQueryVariable(path, 'ticket')
// var loginType = this.getQueryVariable(path, 'loginType')
// if (loginType == 1) {
// window.open('http://10.12.1.78:9090/cas/login?service=http://192.168.144.22:9966/home', '_self');
// } else {
// // if (ticket) {
// // var params = {
// // service: 'http://localhost:8080/home',
// // ticket: ticket
// // }
// // this.$api.login.loginByTicket(params).then(res => {
// // if (res.respCode !== '0') {
// // // this.verifyCode();
// // return this.$message.error(res.data.message);
// // }
// // this.$message.success('登录成功');
// // _that.$store.commit('saveUserInfo', res.data);
// // _that.$router.push('/home');
// // }).catch(_ => {
// // // this.verifyCode();
// // this.$router.push('/');
// // })
// //
// // } else {
// // this.$router.push('/');
// // }
// }
}
}
</script>
<style lang="scss">
@@ -118,7 +118,6 @@
height: 24px !important;
}
/* =============================================== 页面加载 =============================================== */
.el-loading-mask.is-fullscreen {
z-index: 8888 !important;
@@ -311,7 +310,6 @@
}
}
/* =============================================== search-tag =============================================== */
.search-tag {
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0) !important;
+21 -21
View File
@@ -1,4 +1,4 @@
import Vue from "vue";
import Vue from 'vue'
/**
* 多层级的对象合并
@@ -6,14 +6,14 @@ import Vue from "vue";
* @param source 资源(拥有的对象)
* @returns {target} 合并后的对象
*/
function assignObj(target, source) {
if (typeof (target) !== 'object' || typeof (source) !== 'object') {
return source;
}
for (let key in source) {
target[key] = assignObj(target[key], source[key]);
}
return target;
function assignObj (target, source) {
if (typeof (target) !== 'object' || typeof (source) !== 'object') {
return source
}
for (const key in source) {
target[key] = assignObj(target[key], source[key])
}
return target
}
/**
@@ -21,15 +21,15 @@ function assignObj(target, source) {
* @type {{install(): *|{}}} Vue.use默认执行的方法
*/
export default {
install() {
Vue.prototype.$api = {}
const requireComponents = require.context('./modules', true, /\.js/)
requireComponents.keys().forEach(file => {
const mod = requireComponents(file);
let fileName = file.replace(/\.\/|\.js/g, '');
fileName = fileName.split('/').map(item => item.replace(/\./g, '_')).reverse().reduce((p, c) => ({[c]: p}), mod.default);
Vue.prototype.$api = assignObj(Vue.prototype.$api, fileName)
})
return Vue.prototype.$api
}
};
install () {
Vue.prototype.$api = {}
const requireComponents = require.context('./modules', true, /\.js/)
requireComponents.keys().forEach(file => {
const mod = requireComponents(file)
let fileName = file.replace(/\.\/|\.js/g, '')
fileName = fileName.split('/').map(item => item.replace(/\./g, '_')).reverse().reduce((p, c) => ({ [c]: p }), mod.default)
Vue.prototype.$api = assignObj(Vue.prototype.$api, fileName)
})
return Vue.prototype.$api
}
}
+39 -39
View File
@@ -1,42 +1,42 @@
import {instance as request} from "@/utils/request";
import { instance as request } from '@/utils/request'
export default {
// 登录
login(data) {
return request({
url: `/api/login`,
method: 'post',
data
})
},
// 长按ticket登录
// loginByTicket(data) {
// return request({
// url: `/api/cas/validateLogin?service=`+data.service+'&ticket='+data.ticket,
// method: 'get'
// })
// },
pageLog(data) {
return request({
url: `/api/log/log/save?accessPage=`+data,
method: 'get'
})
},
// 获取验证码
verifyCode(data) {
return request({
url: `/api/verifyCode`,
method: 'get',
params: data,
responseType: 'arraybuffer'
})
},
// 退出登录
logout(data) {
return request({
url: `/api/logout`,
method: 'get',
param: data,
})
},
// 登录
login (data) {
return request({
url: '/api/login',
method: 'post',
data
})
},
// 长按ticket登录
// loginByTicket(data) {
// return request({
// url: `/api/cas/validateLogin?service=`+data.service+'&ticket='+data.ticket,
// method: 'get'
// })
// },
pageLog (data) {
return request({
url: '/api/log/log/save?accessPage=' + data,
method: 'get'
})
},
// 获取验证码
verifyCode (data) {
return request({
url: '/api/verifyCode',
method: 'get',
params: data,
responseType: 'arraybuffer'
})
},
// 退出登录
logout (data) {
return request({
url: '/api/logout',
method: 'get',
param: data
})
}
}
+40 -41
View File
@@ -1,45 +1,44 @@
import {instance as request} from "@/utils/request";
import { instance as request } from '@/utils/request'
export default {
// 查询菜单
sysMenuFindAllMenus(data) {
return request({
url: `/api/sys/menu/findAllMenus`,
method: 'GET',
params: data
})
},
// 新增
postSysMenu(data) {
return request({
url: `/api/sys/menu`,
method: 'POST',
data
})
},
// 删除
sysMenuDeleteId(data) {
return request({
url: `/api/sys/menu/${data.ids}`,
method: 'DELETE',
})
},
// 修改
putSysMenu(data) {
return request({
url: `/api/sys/menu`,
method: 'PUT',
data
})
},
// 角色对应的菜单
getSysMenu(data) {
return request({
url: `/api/sys/menu`,
method: 'GET',
params: data
})
},
// 查询菜单
sysMenuFindAllMenus (data) {
return request({
url: '/api/sys/menu/findAllMenus',
method: 'GET',
params: data
})
},
// 新增
postSysMenu (data) {
return request({
url: '/api/sys/menu',
method: 'POST',
data
})
},
// 删除
sysMenuDeleteId (data) {
return request({
url: `/api/sys/menu/${data.ids}`,
method: 'DELETE'
})
},
// 修改
putSysMenu (data) {
return request({
url: '/api/sys/menu',
method: 'PUT',
data
})
},
// 角色对应的菜单
getSysMenu (data) {
return request({
url: '/api/sys/menu',
method: 'GET',
params: data
})
}
}
+127 -127
View File
@@ -1,132 +1,132 @@
import {instance as request} from "@/utils/request";
export function reportUploadPicFile(data){
return request({
url: `/api/report/uploadPicFile`,
method: 'POST',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
import { instance as request } from '@/utils/request'
export function reportUploadPicFile (data) {
return request({
url: '/api/report/uploadPicFile',
method: 'POST',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
export default {
// 日志列表
reportLogList(data){
return request({
url: `/api/reportLog/list`,
method: 'GET',
params: data
})
},
// 标签管理
labelAdd(data){
return request({
url: `/api/label/add`,
method: 'POST',
data
})
},
// 标签列表
labelList(data){
return request({
url: `/api/label/list`,
method: 'GET',
params: data
})
},
// 标签删除|单个
labelDeleteId(data){
return request({
url: `/api/label/delete/${data.id}`,
method: 'POST',
})
},
// 日志列表
reportLogList (data) {
return request({
url: '/api/reportLog/list',
method: 'GET',
params: data
})
},
// 标签管理
labelAdd (data) {
return request({
url: '/api/label/add',
method: 'POST',
data
})
},
// 标签列表
labelList (data) {
return request({
url: '/api/label/list',
method: 'GET',
params: data
})
},
// 标签删除|单个
labelDeleteId (data) {
return request({
url: `/api/label/delete/${data.id}`,
method: 'POST'
})
},
// 新增或编辑报告
reportAdd(data){
return request({
url: `/api/report/add`,
method: 'POST',
data
})
},
// 详情||上传文件
reportUploadFile(data){
return request({
url: `/api/report/uploadFile`,
method: 'POST',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
},
// 获取报告预览
reportGetReportHtmlId(data){
return request({
url: `/api/report/getReportHtml/${data.id}`,
method: 'GET',
})
},
// 新增或编辑报告
reportAdd (data) {
return request({
url: '/api/report/add',
method: 'POST',
data
})
},
// 详情||上传文件
reportUploadFile (data) {
return request({
url: '/api/report/uploadFile',
method: 'POST',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
},
// 获取报告预览
reportGetReportHtmlId (data) {
return request({
url: `/api/report/getReportHtml/${data.id}`,
method: 'GET'
})
},
// 删除报告
reportDelete(data){
return request({
url: `/api/report/delete`,
method: 'POST',
params: data,
})
},
// 报告列表
reportList(data){
return request({
url: `/api/report/list`,
method: 'POST',
data,
})
},
// 获取报告日期列表
reportDateList(data){
return request({
url: `/api/report/reportDateList`,
method: 'GET',
params: data,
})
},
// 标签批量保存
labelSave(data){
return request({
url: `/api/label/save`,
method: 'POST',
data,
})
},
// 下载文件
reportDownload(data){
return request({
url: `/api/report/download`,
method: 'GET',
params: data,
responseType: 'blob'
})
},
// 上传图片
reportUploadPicFile(data){
return request({
url: `/api/report/uploadPicFile`,
method: 'POST',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
},
// 标签顺序
labelMove(data){
return request({
url: `/api/label/move`,
method: 'POST',
params: data,
})
},
// 删除报告
reportDelete (data) {
return request({
url: '/api/report/delete',
method: 'POST',
params: data
})
},
// 报告列表
reportList (data) {
return request({
url: '/api/report/list',
method: 'POST',
data
})
},
// 获取报告日期列表
reportDateList (data) {
return request({
url: '/api/report/reportDateList',
method: 'GET',
params: data
})
},
// 标签批量保存
labelSave (data) {
return request({
url: '/api/label/save',
method: 'POST',
data
})
},
// 下载文件
reportDownload (data) {
return request({
url: '/api/report/download',
method: 'GET',
params: data,
responseType: 'blob'
})
},
// 上传图片
reportUploadPicFile (data) {
return request({
url: '/api/report/uploadPicFile',
method: 'POST',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
},
// 标签顺序
labelMove (data) {
return request({
url: '/api/label/move',
method: 'POST',
params: data
})
}
}
+40 -41
View File
@@ -1,46 +1,45 @@
import {instance as request} from "@/utils/request";
import { instance as request } from '@/utils/request'
export default {
// 列表
getSysRole(data){
return request({
url: `/api/sys/role`,
method: 'GET',
params: data
})
},
// 删除
delSysRole(data){
return request({
url: `/api/sys/role/${data.id}`,
method: 'DELETE',
})
},
// 列表
getSysRole (data) {
return request({
url: '/api/sys/role',
method: 'GET',
params: data
})
},
// 删除
delSysRole (data) {
return request({
url: `/api/sys/role/${data.id}`,
method: 'DELETE'
})
},
// 新增
postSysRole(data){
return request({
url: `/api/sys/role`,
method: 'POST',
data
})
},
// 修改
putSysRole(data){
return request({
url: `/api/sys/role`,
method: 'PUT',
data
})
},
// 配置角色菜单
sysRoleSaveRoleMenu(data){
return request({
url: `/api/sys/role/saveRoleMenu`,
method: 'POST',
data
})
},
// 新增
postSysRole (data) {
return request({
url: '/api/sys/role',
method: 'POST',
data
})
},
// 修改
putSysRole (data) {
return request({
url: '/api/sys/role',
method: 'PUT',
data
})
},
// 配置角色菜单
sysRoleSaveRoleMenu (data) {
return request({
url: '/api/sys/role/saveRoleMenu',
method: 'POST',
data
})
}
}
+32 -32
View File
@@ -1,35 +1,35 @@
import {instance as request} from "@/utils/request";
import { instance as request } from '@/utils/request'
export default {
// 新增|编辑
sysUserAddUser(data){
return request({
url: `/api/sys/user/addUser`,
method: 'POST',
data
})
},
// 用户启用或禁用
sysUserIsUse(data){
return request({
url: `/api/sys/user/isUse/${data.USID}/${data.type}`,
method: 'POST',
})
},
// 获取所有用户
sysUserList(data){
return request({
url: `/api/sys/user/list`,
method: 'GET',
params: data
})
},
// 删除用户
sysUserDelete(data){
return request({
url: `/api/sys/user/delete`,
method: 'POST',
params: data
})
},
// 新增|编辑
sysUserAddUser (data) {
return request({
url: '/api/sys/user/addUser',
method: 'POST',
data
})
},
// 用户启用或禁用
sysUserIsUse (data) {
return request({
url: `/api/sys/user/isUse/${data.USID}/${data.type}`,
method: 'POST'
})
},
// 获取所有用户
sysUserList (data) {
return request({
url: '/api/sys/user/list',
method: 'GET',
params: data
})
},
// 删除用户
sysUserDelete (data) {
return request({
url: '/api/sys/user/delete',
method: 'POST',
params: data
})
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long
+178 -178
View File
@@ -88,194 +88,194 @@
</template>
<script>
import {v4 as uuidv4} from "uuid";
import { v4 as uuidv4 } from 'uuid'
import vuedraggable from 'vuedraggable'
export default {
name: "Demo",
components: {
vuedraggable
name: 'Demo',
components: {
vuedraggable
},
data () {
return {
option1: {
xAxis: {
type: 'category',
data: []
},
yAxis: {
type: 'value'
},
series: [
{
data: [],
type: 'scatter',
symbolSize: function (data) {
return data[1] / 2.5
}
}
]
},
sortData: [
{ id: uuidv4(), name: 'Mon', value: 150 },
{ id: uuidv4(), name: 'Tue', value: 230 },
{ id: uuidv4(), name: 'Wed', value: 224 },
{ id: uuidv4(), name: 'Thu', value: 218 },
{ id: uuidv4(), name: 'Fri', value: 135 },
{ id: uuidv4(), name: 'Sat', value: 147 },
{ id: uuidv4(), name: 'Sun', value: 260 }
],
week: '',
year_week: '',
startDate: '',
endDate: '',
option: {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
}
]
},
max: 0,
value: 0,
q: {
page: 1,
size: 20,
total: 200
},
uuid: uuidv4(),
tableHeader: [
{ field: 'a', title: '2020-01' },
{ field: 'b', title: '2020-02' },
{ field: 'c', title: '2020-03' },
{ field: 'd', title: '2020-04' }
],
treeData: [
{ id: 10000, parentId: null, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 10001, parentId: 10000, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 10002, parentId: 10000, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 10003, parentId: 10000, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 20000, parentId: null, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20001, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20002, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20003, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20004, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 30000, parentId: null, a: 'Test3', b: '1111', c: '222', d: '3333' },
{ id: 30001, parentId: 30000, a: 'Test3', b: '1111', c: '222', d: '3333' },
{ id: 40000, parentId: null, a: 'Test4', b: '1111', c: '222', d: '3333' }
]
}
},
methods: {
handleTree (arr) {
const cloneData = JSON.parse(JSON.stringify(arr)) // 对源数据深度克隆
return cloneData.filter((father) => {
const branchArr = cloneData.filter(child => father.id == child.parentId) // 返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null // 如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId == -1 // 返回第一层
})
},
data() {
return {
option1: {
xAxis: {
type: "category",
data: [],
},
yAxis: {
type: "value",
},
series: [
{
data: [],
type: "scatter",
symbolSize: function (data) {
return data[1] / 2.5;
},
},
],
},
sortData: [
{id: uuidv4(), name: 'Mon', value: 150},
{id: uuidv4(), name: 'Tue', value: 230},
{id: uuidv4(), name: 'Wed', value: 224},
{id: uuidv4(), name: 'Thu', value: 218},
{id: uuidv4(), name: 'Fri', value: 135},
{id: uuidv4(), name: 'Sat', value: 147},
{id: uuidv4(), name: 'Sun', value: 260},
],
week: "",
year_week: "",
startDate: "",
endDate: "",
option: {
xAxis: {
type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
yAxis: {
type: "value",
},
series: [
{
data: [150, 230, 224, 218, 135, 147, 260],
type: "line",
},
],
},
max: 0,
value: 0,
q: {
page: 1,
size: 20,
total: 200,
},
uuid: uuidv4(),
tableHeader: [
{ field: 'a', title: '2020-01'},
{ field: 'b', title: '2020-02'},
{ field: 'c', title: '2020-03'},
{ field: 'd', title: '2020-04'},
],
treeData: [
{ id: 10000, parentId: null, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 10001, parentId: 10000, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 10002, parentId: 10000, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 10003, parentId: 10000, a: 'Test1', b: '1111', c: '222', d: '3333' },
{ id: 20000, parentId: null, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20001, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20002, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20003, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 20004, parentId: 20000, a: 'Test2', b: '1111', c: '222', d: '3333' },
{ id: 30000, parentId: null, a: 'Test3', b: '1111', c: '222', d: '3333' },
{ id: 30001, parentId: 30000, a: 'Test3', b: '1111', c: '222', d: '3333' },
{ id: 40000, parentId: null, a: 'Test4', b: '1111', c: '222', d: '3333' },
],
};
handleWeekChange (val) {
const date = `${new Date(val).getFullYear()}-${new Date(val).getMonth() + 1}-${new Date(val).getDate()}`
const firstTime = new Date(date).getTime() - 24 * 60 * 60 * 1000
this.startDate = `${new Date(firstTime).getFullYear()}-${new Date(firstTime).getMonth() + 1}-${new Date(firstTime).getDate()}`
const lastTime = new Date(date).getTime() + 5 * 24 * 60 * 60 * 1000
this.endDate = `${new Date(lastTime).getFullYear()}-${new Date(lastTime).getMonth() + 1}-${new Date(lastTime).getDate()}`
const year = require('moment')(val).utcOffset('+08:00').format('yyyy')
const week = require('moment')(val).utcOffset('+08:00').format('WW')
this.year_week = `${year}${week}`
},
// Api
exFun () {
console.log(require('moment'))
this.$api.ex
.exFun()
.then((res) => {
console.log(res)
})
.catch((err) => {
console.log(err)
})
},
methods: {
handleTree(arr){
let cloneData = JSON.parse(JSON.stringify(arr)) // 对源数据深度克隆
return cloneData.filter((father) => {
let branchArr = cloneData.filter(child => father.id == child.parentId); //返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null; //如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId == -1; //返回第一层
})
},
handleWeekChange(val) {
let date = `${new Date(val).getFullYear()}-${new Date(val).getMonth() + 1}-${new Date(val).getDate()}`;
// vue-echarts
changeOption () {
this.option.series[0].type = 'bar'
},
let firstTime = new Date(date).getTime() - 24 * 60 * 60 * 1000;
this.startDate = `${new Date(firstTime).getFullYear()}-${new Date(firstTime).getMonth() + 1}-${new Date(firstTime).getDate()}`;
let lastTime = new Date(date).getTime() + 5 * 24 * 60 * 60 * 1000;
this.endDate = `${new Date(lastTime).getFullYear()}-${new Date(lastTime).getMonth() + 1}-${new Date(lastTime).getDate()}`;
let year = require("moment")(val).utcOffset("+08:00").format("yyyy");
let week = require("moment")(val).utcOffset("+08:00").format("WW");
this.year_week = `${year}${week}`;
},
// Api
exFun() {
console.log(require("moment"));
this.$api.ex
.exFun()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
},
// vue-echarts
changeOption() {
this.option.series[0].type = "bar";
},
// el-scrollbar
scrollChange() {
this.max =
// el-scrollbar
scrollChange () {
this.max =
this.$refs.scrollbar.wrap.scrollHeight -
this.$refs.scrollbar.wrap.clientHeight;
this.$refs.scrollbar.wrap.onscroll = (e) => {
this.value = e.target.scrollTop;
};
},
formatTooltip(value) {
this.$refs.scrollbar.wrap.scrollTop = value;
},
this.$refs.scrollbar.wrap.clientHeight
this.$refs.scrollbar.wrap.onscroll = (e) => {
this.value = e.target.scrollTop
}
},
formatTooltip (value) {
this.$refs.scrollbar.wrap.scrollTop = value
},
// VXETable
getTableData() {
this.$nextTick(() => {
const $table = this.$refs.xTable;
const list = [];
for (let index = 0; index < 50; index++) {
list.push({
name: `名称${index}`,
sex: "0",
num: 123,
age: 18,
num2: 234,
rate: 3,
address: "shenzhen",
});
}
$table.loadData(list);
});
},
// VXETable
getTableData () {
this.$nextTick(() => {
const $table = this.$refs.xTable
const list = []
for (let index = 0; index < 50; index++) {
list.push({
name: `名称${index}`,
sex: '0',
num: 123,
age: 18,
num2: 234,
rate: 3,
address: 'shenzhen'
})
}
$table.loadData(list)
})
},
// vuex-persistedstate
saveUserInfo() {
// this.$store.commit("saveUserInfo", {name: "Lee"});
},
},
created() {
console.log("created");
},
mounted() {
this.scrollChange();
this.getTableData();
console.log("mounted");
},
updated(){
// 修改统计顺序
this.option1.xAxis.data = this.sortData.map(item => item.name);
this.option1.series[0].data = this.sortData.map(item => [item.name, item.value]);
},
// 进入组件执行 仅在keep-alive时起作用
activated() {
this.$refs.scrollbar.wrap.scrollTop = this.value;
console.log("activated");
},
// 离开组件执行 仅在keep-alive时起作用
deactivated() {
console.log("deactivated");
},
};
// vuex-persistedstate
saveUserInfo () {
// this.$store.commit("saveUserInfo", {name: "Lee"});
}
},
created () {
console.log('created')
},
mounted () {
this.scrollChange()
this.getTableData()
console.log('mounted')
},
updated () {
// 修改统计顺序
this.option1.xAxis.data = this.sortData.map(item => item.name)
this.option1.series[0].data = this.sortData.map(item => [item.name, item.value])
},
// 进入组件执行 仅在keep-alive时起作用
activated () {
this.$refs.scrollbar.wrap.scrollTop = this.value
console.log('activated')
},
// 离开组件执行 仅在keep-alive时起作用
deactivated () {
console.log('deactivated')
}
}
</script>
<style lang="scss" scoped>
+275 -275
View File
@@ -5,304 +5,304 @@
<script>
import * as echarts from 'echarts/lib/echarts'
import debounce from 'lodash/debounce'
import {addListener, removeListener} from 'resize-detector'
import { addListener, removeListener } from 'resize-detector'
// enumerating ECharts events for now
const EVENTS = [
'legendselectchanged',
'legendselected',
'legendunselected',
'legendscroll',
'datazoom',
'datarangeselected',
'timelinechanged',
'timelineplaychanged',
'restore',
'dataviewchanged',
'magictypechanged',
'geoselectchanged',
'geoselected',
'geounselected',
'pieselectchanged',
'pieselected',
'pieunselected',
'mapselectchanged',
'mapselected',
'mapunselected',
'axisareaselected',
'focusnodeadjacency',
'unfocusnodeadjacency',
'brush',
'brushselected',
'rendered',
'finished',
'click',
'dblclick',
'mouseover',
'mouseout',
'mousemove',
'mousedown',
'mouseup',
'globalout',
'contextmenu'
'legendselectchanged',
'legendselected',
'legendunselected',
'legendscroll',
'datazoom',
'datarangeselected',
'timelinechanged',
'timelineplaychanged',
'restore',
'dataviewchanged',
'magictypechanged',
'geoselectchanged',
'geoselected',
'geounselected',
'pieselectchanged',
'pieselected',
'pieunselected',
'mapselectchanged',
'mapselected',
'mapunselected',
'axisareaselected',
'focusnodeadjacency',
'unfocusnodeadjacency',
'brush',
'brushselected',
'rendered',
'finished',
'click',
'dblclick',
'mouseover',
'mouseout',
'mousemove',
'mousedown',
'mouseup',
'globalout',
'contextmenu'
]
const ZR_EVENTS = [
'click',
'mousedown',
'mouseup',
'mousewheel',
'dblclick',
'contextmenu'
'click',
'mousedown',
'mouseup',
'mousewheel',
'dblclick',
'contextmenu'
]
const INIT_TRIGGERS = ['theme', 'initOptions', 'autoresize']
const REWATCH_TRIGGERS = ['manualUpdate', 'watchShallow']
export default {
props: {
options: Object,
theme: [String, Object],
initOptions: Object,
group: String,
autoresize: Boolean,
watchShallow: Boolean,
manualUpdate: Boolean
props: {
options: Object,
theme: [String, Object],
initOptions: Object,
group: String,
autoresize: Boolean,
watchShallow: Boolean,
manualUpdate: Boolean
},
data () {
return {
lastArea: 0
}
},
watch: {
group (group) {
this.chart.group = group
}
},
methods: {
// provide an explicit merge option method
mergeOptions (options, notMerge, lazyUpdate) {
if (this.manualUpdate) {
this.manualOptions = options
}
if (!this.chart) {
this.init(options)
} else {
this.delegateMethod('setOption', options, notMerge, lazyUpdate)
}
},
data() {
return {
lastArea: 0
}
// just delegates ECharts methods to Vue component
// use explicit params to reduce transpiled size for now
appendData (params) {
this.delegateMethod('appendData', params)
},
watch: {
group(group) {
this.chart.group = group
},
resize (options) {
this.delegateMethod('resize', options)
},
methods: {
// provide an explicit merge option method
mergeOptions(options, notMerge, lazyUpdate) {
if (this.manualUpdate) {
this.manualOptions = options
}
if (!this.chart) {
this.init(options)
} else {
this.delegateMethod('setOption', options, notMerge, lazyUpdate)
}
},
// just delegates ECharts methods to Vue component
// use explicit params to reduce transpiled size for now
appendData(params) {
this.delegateMethod('appendData', params)
},
resize(options) {
this.delegateMethod('resize', options)
},
dispatchAction(payload) {
this.delegateMethod('dispatchAction', payload)
},
convertToPixel(finder, value) {
return this.delegateMethod('convertToPixel', finder, value)
},
convertFromPixel(finder, value) {
return this.delegateMethod('convertFromPixel', finder, value)
},
containPixel(finder, value) {
return this.delegateMethod('containPixel', finder, value)
},
showLoading(type, options) {
this.delegateMethod('showLoading', type, options)
},
hideLoading() {
this.delegateMethod('hideLoading')
},
getDataURL(options) {
return this.delegateMethod('getDataURL', options)
},
getConnectedDataURL(options) {
return this.delegateMethod('getConnectedDataURL', options)
},
clear() {
this.delegateMethod('clear')
},
dispose() {
this.delegateMethod('dispose')
},
delegateMethod(name, ...args) {
if (!this.chart) {
this.init()
}
return this.chart[name](...args)
},
delegateGet(methodName) {
if (!this.chart) {
this.init()
}
return this.chart[methodName]()
},
getArea() {
return this.$el.offsetWidth * this.$el.offsetHeight
},
init(options) {
if (this.chart) {
return
}
let chart = echarts.init(this.$el, this.theme, this.initOptions)
if (this.group) {
chart.group = this.group
}
chart.setOption(options || this.manualOptions || this.options || {}, true)
// expose ECharts events as custom events
EVENTS.forEach(event => {
chart.on(event, params => {
this.$emit(event, params)
})
})
ZR_EVENTS.forEach(event => {
chart.getZr().on(event, params => {
this.$emit(`zr:${event}`, params)
})
})
if (this.autoresize) {
this.lastArea = this.getArea()
this.__resizeHandler = debounce(() => {
if (this.lastArea === 0) {
// emulate initial render for initially hidden charts
this.mergeOptions({}, true)
this.resize()
this.mergeOptions(this.options || this.manualOptions || {}, true)
} else {
this.resize()
}
this.lastArea = this.getArea()
}, 100, {leading: true})
addListener(this.$el, this.__resizeHandler)
}
Object.defineProperties(this, {
// Only recalculated when accessed from JavaScript.
// Won't update DOM on value change because getters
// don't depend on reactive values
width: {
configurable: true,
get: () => {
return this.delegateGet('getWidth')
}
},
height: {
configurable: true,
get: () => {
return this.delegateGet('getHeight')
}
},
isDisposed: {
configurable: true,
get: () => {
return !!this.delegateGet('isDisposed')
}
},
computedOptions: {
configurable: true,
get: () => {
return this.delegateGet('getOption')
}
}
})
this.chart = chart
},
initOptionsWatcher() {
if (this.__unwatchOptions) {
this.__unwatchOptions()
this.__unwatchOptions = null
}
if (!this.manualUpdate) {
this.__unwatchOptions = this.$watch('options', (val, oldVal) => {
if (!this.chart && val) {
this.init()
} else {
// mutating `options` will lead to merging
// replacing it with new reference will lead to not merging
// eg.
// `this.options = Object.assign({}, this.options, { ... })`
// will trigger `this.chart.setOption(val, true)
// `this.options.title.text = 'Trends'`
// will trigger `this.chart.setOption(val, false)`
this.chart.setOption(val, val !== oldVal)
}
}, {deep: !this.watchShallow})
}
},
destroy() {
if (this.autoresize) {
removeListener(this.$el, this.__resizeHandler)
}
this.dispose()
this.chart = null
},
refresh() {
if (this.chart) {
this.destroy()
this.init()
}
}
dispatchAction (payload) {
this.delegateMethod('dispatchAction', payload)
},
created() {
this.initOptionsWatcher()
convertToPixel (finder, value) {
return this.delegateMethod('convertToPixel', finder, value)
},
convertFromPixel (finder, value) {
return this.delegateMethod('convertFromPixel', finder, value)
},
containPixel (finder, value) {
return this.delegateMethod('containPixel', finder, value)
},
showLoading (type, options) {
this.delegateMethod('showLoading', type, options)
},
hideLoading () {
this.delegateMethod('hideLoading')
},
getDataURL (options) {
return this.delegateMethod('getDataURL', options)
},
getConnectedDataURL (options) {
return this.delegateMethod('getConnectedDataURL', options)
},
clear () {
this.delegateMethod('clear')
},
dispose () {
this.delegateMethod('dispose')
},
delegateMethod (name, ...args) {
if (!this.chart) {
this.init()
}
return this.chart[name](...args)
},
delegateGet (methodName) {
if (!this.chart) {
this.init()
}
return this.chart[methodName]()
},
getArea () {
return this.$el.offsetWidth * this.$el.offsetHeight
},
init (options) {
if (this.chart) {
return
}
INIT_TRIGGERS.forEach(prop => {
this.$watch(prop, () => {
this.refresh()
}, {deep: true})
const chart = echarts.init(this.$el, this.theme, this.initOptions)
if (this.group) {
chart.group = this.group
}
chart.setOption(options || this.manualOptions || this.options || {}, true)
// expose ECharts events as custom events
EVENTS.forEach(event => {
chart.on(event, params => {
this.$emit(event, params)
})
})
REWATCH_TRIGGERS.forEach(prop => {
this.$watch(prop, () => {
this.initOptionsWatcher()
this.refresh()
})
ZR_EVENTS.forEach(event => {
chart.getZr().on(event, params => {
this.$emit(`zr:${event}`, params)
})
})
if (this.autoresize) {
this.lastArea = this.getArea()
this.__resizeHandler = debounce(() => {
if (this.lastArea === 0) {
// emulate initial render for initially hidden charts
this.mergeOptions({}, true)
this.resize()
this.mergeOptions(this.options || this.manualOptions || {}, true)
} else {
this.resize()
}
this.lastArea = this.getArea()
}, 100, { leading: true })
addListener(this.$el, this.__resizeHandler)
}
Object.defineProperties(this, {
// Only recalculated when accessed from JavaScript.
// Won't update DOM on value change because getters
// don't depend on reactive values
width: {
configurable: true,
get: () => {
return this.delegateGet('getWidth')
}
},
height: {
configurable: true,
get: () => {
return this.delegateGet('getHeight')
}
},
isDisposed: {
configurable: true,
get: () => {
return !!this.delegateGet('isDisposed')
}
},
computedOptions: {
configurable: true,
get: () => {
return this.delegateGet('getOption')
}
}
})
this.chart = chart
},
mounted() {
// auto init if `options` is already provided
if (this.options) {
initOptionsWatcher () {
if (this.__unwatchOptions) {
this.__unwatchOptions()
this.__unwatchOptions = null
}
if (!this.manualUpdate) {
this.__unwatchOptions = this.$watch('options', (val, oldVal) => {
if (!this.chart && val) {
this.init()
}
} else {
// mutating `options` will lead to merging
// replacing it with new reference will lead to not merging
// eg.
// `this.options = Object.assign({}, this.options, { ... })`
// will trigger `this.chart.setOption(val, true)
// `this.options.title.text = 'Trends'`
// will trigger `this.chart.setOption(val, false)`
this.chart.setOption(val, val !== oldVal)
}
}, { deep: !this.watchShallow })
}
},
activated() {
if (this.autoresize) {
this.chart && this.chart.resize()
}
destroy () {
if (this.autoresize) {
removeListener(this.$el, this.__resizeHandler)
}
this.dispose()
this.chart = null
},
destroyed() {
if (this.chart) {
this.destroy()
}
},
connect(group) {
if (typeof group !== 'string') {
group = group.map(chart => chart.chart)
}
echarts.connect(group)
},
disconnect(group) {
echarts.disConnect(group)
},
registerMap(mapName, geoJSON, specialAreas) {
echarts.registerMap(mapName, geoJSON, specialAreas)
},
registerTheme(name, theme) {
echarts.registerTheme(name, theme)
},
graphic: echarts.graphic
refresh () {
if (this.chart) {
this.destroy()
this.init()
}
}
},
created () {
this.initOptionsWatcher()
INIT_TRIGGERS.forEach(prop => {
this.$watch(prop, () => {
this.refresh()
}, { deep: true })
})
REWATCH_TRIGGERS.forEach(prop => {
this.$watch(prop, () => {
this.initOptionsWatcher()
this.refresh()
})
})
},
mounted () {
// auto init if `options` is already provided
if (this.options) {
this.init()
}
},
activated () {
if (this.autoresize) {
this.chart && this.chart.resize()
}
},
destroyed () {
if (this.chart) {
this.destroy()
}
},
connect (group) {
if (typeof group !== 'string') {
group = group.map(chart => chart.chart)
}
echarts.connect(group)
},
disconnect (group) {
echarts.disConnect(group)
},
registerMap (mapName, geoJSON, specialAreas) {
echarts.registerMap(mapName, geoJSON, specialAreas)
},
registerTheme (name, theme) {
echarts.registerTheme(name, theme)
},
graphic: echarts.graphic
}
</script>
+56 -56
View File
@@ -44,64 +44,64 @@
</template>
<script>
import {mapGetters} from 'vuex';
import {BASE_URL} from "../utils/http";
import { mapGetters } from 'vuex'
import { BASE_URL } from '../utils/http'
export default {
name: "Header",
data() {
return {
popoverValue: false
}
},
computed: {
...mapGetters({
menuData: 'menuData',
}),
isSystemManager() {
return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF');
},
isSystemManagerBelong() {
return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF' && menu.belong == 1);
},
},
methods: {
// 退出系统
logout() {
this.$confirm('确定退出系统?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.login.logout().then(_ => {
this.$message.success('退出成功');
this.$store.commit('saveUserInfo', null);
// var sevice = "http://"+window.location.host+"/";
// var serviceUrl = encodeURIComponent(sevice);
//正式
// window.open("https://caddmuat.changan.com.cn/cas/logout?service=http://10.64.23.30:7766/home", '_self');
//测试
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
this.$router.push('/login');
})
})
},
goSystemPage() {
if(this.isSystemManagerBelong){
if (this.$route.path === '/system/menu') return;
this.$store.commit('savePathUrl', '/system/menu');
this.$router.push({path: '/system/menu', query: {id: 'AVL9YSB7ZF'}});
}else{
if(this.$route.path == '/system/401Page'){
}else{
this.$router.replace({name: '401Page', query: {id: 'AVL9YSB7ZF'}});
}
}
}
}
export default {
name: 'Header',
data () {
return {
popoverValue: false
}
},
computed: {
...mapGetters({
menuData: 'menuData'
}),
isSystemManager () {
return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF')
},
isSystemManagerBelong () {
return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF' && menu.belong == 1)
}
},
methods: {
// 退出系统
logout () {
this.$confirm('确定退出系统?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.login.logout().then(_ => {
this.$message.success('退出成功')
this.$store.commit('saveUserInfo', null)
// var sevice = "http://"+window.location.host+"/";
// var serviceUrl = encodeURIComponent(sevice);
// 正式
// window.open("https://caddmuat.changan.com.cn/cas/logout?service=http://10.64.23.30:7766/home", '_self');
// 测试
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
this.$router.push('/login')
})
})
},
goSystemPage () {
if (this.isSystemManagerBelong) {
if (this.$route.path === '/system/menu') return
this.$store.commit('savePathUrl', '/system/menu')
this.$router.push({ path: '/system/menu', query: { id: 'AVL9YSB7ZF' } })
} else {
if (this.$route.path == '/system/401Page') {
} else {
this.$router.replace({ name: '401Page', query: { id: 'AVL9YSB7ZF' } })
}
}
}
}
}
</script>
<style lang="scss" scoped>
+45 -46
View File
@@ -44,54 +44,54 @@
</template>
<script>
import {createLogger} from 'vuex';
import MenuItem from "./MenuItem";
import login from '../api/modules/login'
import store from '../store'
export default {
name: "Menu",
props: ["menuData", "path"],
components: {
MenuItem
},
methods: {
handleRouter(item) {
if(item.belong == 0){
this.$store.commit('saveMenuName', item.label);
if(this.$route.path == '/system/401Page'){
import { createLogger } from 'vuex'
import MenuItem from './MenuItem'
import login from '../api/modules/login'
import store from '../store'
export default {
name: 'Menu',
props: ['menuData', 'path'],
components: {
MenuItem
},
methods: {
handleRouter (item) {
if (item.belong == 0) {
this.$store.commit('saveMenuName', item.label)
if (this.$route.path == '/system/401Page') {
}else{
this.$router.push({name: '401Page', query: this.$route.query});
}
}else{
this.$store.commit('savePathUrl', item.href);
if (item.isUrl && Number(item.isUrl || 0)) {
var param = this.$route.query
// delete(this.$route.query.itemHref)
// param.itemHref = item.href
if(this.$route.path == '/system/urlIndex'){
this.$store.commit('saveMenuName', item.label);
login.pageLog(this.$store.state.menuName).then(res => {
}).catch(_ => {
})
}else{
this.$store.commit('saveMenuName', item.label);
this.$router.push({name: 'urlIndex', query: param});
}
} else {
if (this.$route.path === item.href) return;
// delete(this.$route.query.itemHref)
this.$router.push({path: item.href, query: this.$route.query});
}
}
},
collageMenu(item) {
item.isCollage = !item.isCollage;
console.log(item.isCollage);
}
} else {
this.$router.push({ name: '401Page', query: this.$route.query })
}
} else {
this.$store.commit('savePathUrl', item.href)
if (item.isUrl && Number(item.isUrl || 0)) {
const param = this.$route.query
// delete(this.$route.query.itemHref)
// param.itemHref = item.href
if (this.$route.path == '/system/urlIndex') {
this.$store.commit('saveMenuName', item.label)
login.pageLog(this.$store.state.menuName).then(res => {
}).catch(_ => {
})
} else {
this.$store.commit('saveMenuName', item.label)
this.$router.push({ name: 'urlIndex', query: param })
}
} else {
if (this.$route.path === item.href) return
// delete(this.$route.query.itemHref)
this.$router.push({ path: item.href, query: this.$route.query })
}
}
},
collageMenu (item) {
item.isCollage = !item.isCollage
console.log(item.isCollage)
}
}
}
</script>
<style lang="scss" scoped>
@@ -175,7 +175,6 @@
}
}
.icon-level2 {
display: inline-block;
width: 3px;
+2 -2
View File
@@ -4,8 +4,8 @@
<script>
export default {
name: "MenuItem",
props: ['menuItemData']
name: 'MenuItem',
props: ['menuItemData']
}
</script>
+145 -146
View File
@@ -32,152 +32,151 @@
</template>
<script>
export default {
data() {
return {
clicked: '',
options: [],
wordList: [
'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'
],
dialogVisible: false
}
},
props: ['callback'],
mounted() {
this.getList()
this.clicked = ''
},
methods: {
changeOpen() {
this.dialogVisible = !this.dialogVisible
},
selectFun(item) {
if (this.callback && item.length == 3) {
this.callback(item)
this.dialogVisible = false
}
},
getList() {
this.options = []
this.$api.config.gradient.chooseStyleAdd().then(res => {
this.options = this.formatDataFirst(res.data)
// Object.keys(res.data).forEach(key => {
// // tag
// let d = {
// value:key,
// label:key
// }
// this.options.push(d)
// // info
// let info = res.data[key]
// Object.keys(info).forEach(newkey => {
// debugger
// let ib = {
// value:newkey,
// label:newkey,
// children:info[newkey]
// }
// this.options.push(ib)
// })
// });
//
})
},
formatDataFirst(data) {
let list = []
Object.keys(data).forEach(key => {
// tag
let d = {
level: 1,
value: key,
label: key
}
list.push(d)
// info
let info = data[key]
Object.keys(info).forEach(newkey => {
let ib = {
level: 1,
value: newkey,
label: newkey,
children: []
}
ib.children = this.formatData(info[newkey])
list.push(ib)
})
});
return list
},
formatData(data) {
let list = []
Object.keys(data).forEach(key => {
let id = data[key]
let d = {
level: 2,
value: key,
label: key,
children: []
}
id.forEach(newdata => {
let ib = {
level: 3,
value: newdata,
label: newdata['kxmc'] + (newdata['msrpw'] ? (" " + newdata['msrpw']) : '') + " " + newdata['mix'],
data: newdata
}
d.children.push(ib)
})
// debugger
list.push(d)
})
return list
},
goIndex(params) {
const groupRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize
const titleRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize.childNodes
this.clicked = params
titleRef.forEach((item) => {
if (item.innerText === params) {
// debugger
groupRef.parentElement.scrollTo({
top: item.offsetTop,
behavior: 'smooth' // 平滑移动
})
}
})
// groupRef.scrollTop = offsetTop
}
}
export default {
data () {
return {
clicked: '',
options: [],
wordList: [
'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'
],
dialogVisible: false
}
},
props: ['callback'],
mounted () {
this.getList()
this.clicked = ''
},
methods: {
changeOpen () {
this.dialogVisible = !this.dialogVisible
},
selectFun (item) {
if (this.callback && item.length == 3) {
this.callback(item)
this.dialogVisible = false
}
},
getList () {
this.options = []
this.$api.config.gradient.chooseStyleAdd().then(res => {
this.options = this.formatDataFirst(res.data)
// Object.keys(res.data).forEach(key => {
// // tag
// let d = {
// value:key,
// label:key
// }
// this.options.push(d)
// // info
// let info = res.data[key]
// Object.keys(info).forEach(newkey => {
// debugger
// let ib = {
// value:newkey,
// label:newkey,
// children:info[newkey]
// }
// this.options.push(ib)
// })
// });
//
})
},
formatDataFirst (data) {
const list = []
Object.keys(data).forEach(key => {
// tag
const d = {
level: 1,
value: key,
label: key
}
list.push(d)
// info
const info = data[key]
Object.keys(info).forEach(newkey => {
const ib = {
level: 1,
value: newkey,
label: newkey,
children: []
}
ib.children = this.formatData(info[newkey])
list.push(ib)
})
})
return list
},
formatData (data) {
const list = []
Object.keys(data).forEach(key => {
const id = data[key]
const d = {
level: 2,
value: key,
label: key,
children: []
}
id.forEach(newdata => {
const ib = {
level: 3,
value: newdata,
label: newdata.kxmc + (newdata.msrpw ? (' ' + newdata.msrpw) : '') + ' ' + newdata.mix,
data: newdata
}
d.children.push(ib)
})
// debugger
list.push(d)
})
return list
},
goIndex (params) {
const groupRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize
const titleRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize.childNodes
this.clicked = params
titleRef.forEach((item) => {
if (item.innerText === params) {
// debugger
groupRef.parentElement.scrollTo({
top: item.offsetTop,
behavior: 'smooth' // 平滑移动
})
}
})
// groupRef.scrollTop = offsetTop
}
}
}
</script>
<style lang="scss" scoped>
@@ -253,4 +252,4 @@
height: auto;
line-height: 17px;
}
</style>
</style>
+11 -11
View File
@@ -1,17 +1,17 @@
import Vue from "vue";
import Vue from 'vue'
/**
* 获取API
* @type {{install(): *|{}}} Vue.use默认执行的方法
*/
export default {
install() {
const requireComponents = require.context('./modules', false, /\.js/);
requireComponents.keys().forEach(file => {
const directives = requireComponents(file).default;
for (const directive in directives) {
Vue.directive(directive, directives[directive]);
}
});
}
};
install () {
const requireComponents = require.context('./modules', false, /\.js/)
requireComponents.keys().forEach(file => {
const directives = requireComponents(file).default
for (const directive in directives) {
Vue.directive(directive, directives[directive])
}
})
}
}
@@ -1,11 +1,11 @@
import Vue from "vue";
import Vue from 'vue'
export default {
tableMinHeight: {
// 指令的定义
inserted(el, binding, vnode) {
let dom = el.getElementsByClassName('vxe-table--body-wrapper body--wrapper').item(0);
dom.style.setProperty('min-height', binding.value, 'important')
},
tableMinHeight: {
// 指令的定义
inserted (el, binding, vnode) {
const dom = el.getElementsByClassName('vxe-table--body-wrapper body--wrapper').item(0)
dom.style.setProperty('min-height', binding.value, 'important')
}
}
}
+11 -11
View File
@@ -1,17 +1,17 @@
import Vue from "vue";
import Vue from 'vue'
/**
* 获取API
* @type {{install(): *|{}}} Vue.use默认执行的方法
*/
export default {
install() {
const requireComponents = require.context('./modules', false, /\.js/);
requireComponents.keys().forEach(file => {
const filters = requireComponents(file).default;
for (const filter in filters) {
Vue.filter(filter, filters[filter]);
}
});
}
};
install () {
const requireComponents = require.context('./modules', false, /\.js/)
requireComponents.keys().forEach(file => {
const filters = requireComponents(file).default
for (const filter in filters) {
Vue.filter(filter, filters[filter])
}
})
}
}
+7 -7
View File
@@ -1,9 +1,9 @@
export default {
formatDate: function (value) {
let date = new Date(value);
let y = date.getFullYear();
let m = date.getMonth() + 1;
let d = date.getDate();
return `${y}/${m}/${d}`;
}
formatDate: function (value) {
const date = new Date(value)
const y = date.getFullYear()
const m = date.getMonth() + 1
const d = date.getDate()
return `${y}/${m}/${d}`
}
}
+31 -31
View File
@@ -3,17 +3,17 @@ import App from './App.vue'
import router from './router'
import store from './store'
import config from "@/utils/config";
import config from '@/utils/config'
// VXETable
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
// ElementUI
import ElementUI from 'element-ui';
import ElementUI from 'element-ui'
import './assets/css/element-variables.scss'
// ECharts
import 'echarts'
import ECharts from './components/ECharts';
import ECharts from './components/ECharts'
// Api
import Api from './api'
@@ -24,52 +24,52 @@ import Filter from './filters'
// 自定义水印指令
import '@/utils/waterMark'
// 加密函数
import JSEncrypt from '../src/assets/js/jsencrypt.min.js';
VXETable.setup({
table: {
resizable: true,
}
})
Vue.use(VXETable);
import JSEncrypt from '../src/assets/js/jsencrypt.min.js'
// 富文本引用
import VueQuillEditor from 'vue-quill-editor'
// require styles 引入样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
VXETable.setup({
table: {
resizable: true
}
})
Vue.use(VXETable)
Vue.use(VueQuillEditor)
Vue.use(ElementUI, {size: 'mini', zIndex: 3000});
Vue.component('v-chart', ECharts);
Vue.use(Api);
Vue.use(Directive);
Vue.use(Filter);
Vue.use(ElementUI, { size: 'mini', zIndex: 3000 })
Vue.component('v-chart', ECharts)
Vue.use(Api)
Vue.use(Directive)
Vue.use(Filter)
Vue.prototype.$JSEncrypt = (data) => {
if(data === ''){
return '';
}
let encryptor = new JSEncrypt();
encryptor.setPublicKey(config.PUBLIC_KEY);
return encryptor.encrypt(data) || '';
if (data === '') {
return ''
}
const encryptor = new JSEncrypt()
encryptor.setPublicKey(config.PUBLIC_KEY)
return encryptor.encrypt(data) || ''
}
VXETable.renderer.add('NotData', {
// 空内容模板
renderEmpty (h, renderOpts) {
return [
// 空内容模板
renderEmpty (h, renderOpts) {
return [
<span>
<img width="100" src={require('./assets/imgs/icon-nodata.png')}/>
<p style="margin-top: 10px;">暂无数据</p>
</span>
]
}
]
}
})
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
router,
store,
render: h => h(App)
}).$mount('#app')
+58 -58
View File
@@ -2,80 +2,80 @@ import Vue from 'vue'
import VueRouter from 'vue-router'
import store from '../store'
import login from '../api/modules/login'
import {BASE_URL} from "../utils/http"
import { BASE_URL } from '../utils/http'
Vue.use(VueRouter)
let routes = [];
let routes = []
const requireComponents = require.context('./modules', false, /\.js/);
requireComponents.keys().forEach(file => routes = [...routes, ...requireComponents(file).default]);
const requireComponents = require.context('./modules', false, /\.js/)
requireComponents.keys().forEach(file => routes = [...routes, ...requireComponents(file).default])
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes,
scrollBehavior(to, from, position) {
return position;
},
mode: 'history',
base: process.env.BASE_URL,
routes,
scrollBehavior (to, from, position) {
return position
}
})
// 路由守卫
router.beforeEach((to, from, next) => {
/**
/**
* 仅报告价格板块
* 报告板块 http://10.10.1.184:8080/#/report/list?id=XBFBR7UADZ
* 价格板块 http://10.10.1.184:8080/#/overall/opricetrend?id=SBME88VTUD
*/
// store.commit('saveUserInfo', {});
// store.commit('saveMenuData', menuTree);
// var url = BASE_URL.BASE_LOCAL + '/login?loginType=1'
// store.commit('saveUserInfo', {});
// store.commit('saveMenuData', menuTree);
// var url = BASE_URL.BASE_LOCAL + '/login?loginType=1'
// var loginUrl = BASE_URL.BASE_CHANGAN + "/login?service=" + url;
// var logoutUrl = BASE_URL.BASE_CHANGAN + "/logout?service=" + url
if (to.meta.crumb) {
var jumpStr = to.meta.crumb.join('/')
if(jumpStr){
if (jumpStr == 'urlIndex' && to.path != '/system/401Page') {
login.pageLog(store.state.menuName).then(res => {
}).catch(_ => {
})
}else{
login.pageLog(jumpStr).then(res => {
}).catch(_ => {
})
}
}
// var loginUrl = BASE_URL.BASE_CHANGAN + "/login?service=" + url;
// var logoutUrl = BASE_URL.BASE_CHANGAN + "/logout?service=" + url
if (to.meta.crumb) {
const jumpStr = to.meta.crumb.join('/')
if (jumpStr) {
if (jumpStr == 'urlIndex' && to.path != '/system/401Page') {
login.pageLog(store.state.menuName).then(res => {
}).catch(_ => {
})
} else {
login.pageLog(jumpStr).then(res => {
}).catch(_ => {
})
}
}
// debugger
// if (to.query.loginType) {
// if (to.query.loginType == 1 && to.query.ticket) {
// var params = {
// service: url,
// ticket: to.query.ticket
// }
// login.loginByTicket(params).then(res => {
// if (res.respCode !== '0') {
// // this.verifyCode();
// // return this.$message.error(res.data.message);
// }
// // this.$message.success('登录成功');
// store.commit('saveUserInfo', res.data);
// next('/home');
// }).catch(_ => {
// window.open(logoutUrl, '_self');
// })
// } else {
// window.open(loginUrl, '_self');
// }
// } else if (to.path.toLowerCase() !== '/login') {
// if (!store.state.userInfo) {
// window.open(logoutUrl, '_self');
// }
// next();
// } else {
next();
// }
}
// debugger
// if (to.query.loginType) {
// if (to.query.loginType == 1 && to.query.ticket) {
// var params = {
// service: url,
// ticket: to.query.ticket
// }
// login.loginByTicket(params).then(res => {
// if (res.respCode !== '0') {
// // this.verifyCode();
// // return this.$message.error(res.data.message);
// }
// // this.$message.success('登录成功');
// store.commit('saveUserInfo', res.data);
// next('/home');
// }).catch(_ => {
// window.open(logoutUrl, '_self');
// })
// } else {
// window.open(loginUrl, '_self');
// }
// } else if (to.path.toLowerCase() !== '/login') {
// if (!store.state.userInfo) {
// window.open(logoutUrl, '_self');
// }
// next();
// } else {
next()
// }
})
export default router
+51 -50
View File
@@ -1,53 +1,54 @@
const routes = [
{
path: '/system',
name: '',
component: () => import('../../views/Layout.vue'),
children: [
{
path: 'urlIndex',
name: 'urlIndex',
component: () => import('../../views/System/urlIndex.vue'),
meta: {
crumb: ['urlIndex'],
}
}]},
{
path: '/',
redirect: {
name: 'Login'
// path: '/report/list?id=XBFBR7UADZ'
{
path: '/system',
name: '',
component: () => import('../../views/Layout.vue'),
children: [
{
path: 'urlIndex',
name: 'urlIndex',
component: () => import('../../views/System/urlIndex.vue'),
meta: {
crumb: ['urlIndex']
}
},
// 登录
{
path: '/login',
name: 'Login',
component: () => import('../../views/Login.vue')
},
// // 注册
// {
// path: '/register',
// name: 'Register',
// component: () => import('../../views/Register.vue')
// },
// 首页
// {
// path: '/home',
// name: 'Home',
// component: () => import('../../views/Home.vue')
// },
{
path: '/layout',
name: 'LayoutBox',
component: () => import('../../views/Layout.vue')
},
// // Demo
// {
// path: '/demo',
// name: 'Demo',
// component: () => import('../../components/Demo.vue')
// },
];
}]
},
{
path: '/',
redirect: {
name: 'Login'
// path: '/report/list?id=XBFBR7UADZ'
}
},
// 登录
{
path: '/login',
name: 'Login',
component: () => import('../../views/Login.vue')
},
// // 注册
// {
// path: '/register',
// name: 'Register',
// component: () => import('../../views/Register.vue')
// },
// 首页
// {
// path: '/home',
// name: 'Home',
// component: () => import('../../views/Home.vue')
// },
{
path: '/layout',
name: 'LayoutBox',
component: () => import('../../views/Layout.vue')
}
// // Demo
// {
// path: '/demo',
// name: 'Demo',
// component: () => import('../../components/Demo.vue')
// },
]
export default routes;
export default routes
+37 -37
View File
@@ -1,39 +1,39 @@
const routes = [
// 报告管理
{
path: '/report',
name: 'Layout',
component: () => import('../../views/Layout.vue'),
children: [
// 报告列表
{
path: 'list',
name: 'ReportList',
component: () => import('../../views/Report/ReportList.vue'),
meta: {
crumb: ['报告列表'],
}
},
// 报告详情
{
path: 'detail',
name: 'ReportDetail',
component: () => import('../../views/Report/ReportDetail.vue'),
meta: {
crumb: ['报告详情'],
}
},
// 报告管理
{
path: '/report/manager',
name: 'ReportManager',
component: () => import('../../views/Report/ReportManager.vue'),
meta: {
crumb: ['报告管理'],
}
},
]
},
];
// 报告管理
{
path: '/report',
name: 'Layout',
component: () => import('../../views/Layout.vue'),
children: [
// 报告列表
{
path: 'list',
name: 'ReportList',
component: () => import('../../views/Report/ReportList.vue'),
meta: {
crumb: ['报告列表']
}
},
// 报告详情
{
path: 'detail',
name: 'ReportDetail',
component: () => import('../../views/Report/ReportDetail.vue'),
meta: {
crumb: ['报告详情']
}
},
// 报告管理
{
path: '/report/manager',
name: 'ReportManager',
component: () => import('../../views/Report/ReportManager.vue'),
meta: {
crumb: ['报告管理']
}
}
]
}
]
export default routes;
export default routes
+63 -63
View File
@@ -1,65 +1,65 @@
const routes = [
// 系统管理
{
path: '/system',
name: '',
component: () => import('../../views/Layout.vue'),
children: [
// 菜单管理
{
path: 'menu',
name: 'MenuManager',
component: () => import('../../views/System/MenuManager.vue'),
meta: {
crumb: ['菜单管理'],
}
},
// 用户管理
{
path: 'user',
name: 'User',
component: () => import('../../views/System/User.vue'),
meta: {
crumb: ['用户管理'],
}
},
// 角色管理
{
path: 'role',
name: 'Role',
component: () => import('../../views/System/Role.vue'),
meta: {
crumb: ['角色管理'],
}
},
// // 角色管理
// {
// path: 'mail',
// name: 'Mail',
// component: () => import('../../views/System/mail.vue'),
// meta: {
// crumb: ['邮件管理'],
// }
// },
// // 角色管理
// {
// path: 'notification',
// name: 'Notification',
// component: () => import('../../views/System/notification.vue'),
// meta: {
// crumb: ['通知管理'],
// }
// },
{
path: '401Page',
name: '401Page',
component: () => import('../../views/System/401Page.vue'),
meta: {
crumb: ['暂无权限'],
}
},
]
},
];
// 系统管理
{
path: '/system',
name: '',
component: () => import('../../views/Layout.vue'),
children: [
// 菜单管理
{
path: 'menu',
name: 'MenuManager',
component: () => import('../../views/System/MenuManager.vue'),
meta: {
crumb: ['菜单管理']
}
},
// 用户管理
{
path: 'user',
name: 'User',
component: () => import('../../views/System/User.vue'),
meta: {
crumb: ['用户管理']
}
},
// 角色管理
{
path: 'role',
name: 'Role',
component: () => import('../../views/System/Role.vue'),
meta: {
crumb: ['角色管理']
}
},
// // 角色管理
// {
// path: 'mail',
// name: 'Mail',
// component: () => import('../../views/System/mail.vue'),
// meta: {
// crumb: ['邮件管理'],
// }
// },
// // 角色管理
// {
// path: 'notification',
// name: 'Notification',
// component: () => import('../../views/System/notification.vue'),
// meta: {
// crumb: ['通知管理'],
// }
// },
{
path: '401Page',
name: '401Page',
component: () => import('../../views/System/401Page.vue'),
meta: {
crumb: ['暂无权限']
}
}
]
}
]
export default routes;
export default routes
+32 -32
View File
@@ -5,39 +5,39 @@ import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
userInfo: null,
isLoading: false,
rememberData: null,
menuData: [],
pathUrl: '',
menuName: '',
state: {
userInfo: null,
isLoading: false,
rememberData: null,
menuData: [],
pathUrl: '',
menuName: ''
},
getters: {
menuData: (state) => state.menuData,
menuName: (state) => state.menuName
},
mutations: {
saveUserInfo (state, data) {
state.userInfo = data
},
getters: {
menuData: (state) => state.menuData,
menuName: (state) => state.menuName,
saveIsLoading (state, data) {
state.isLoading = data
},
mutations: {
saveUserInfo(state, data) {
state.userInfo = data;
},
saveIsLoading(state, data){
state.isLoading = data;
},
saveRememberData(state, data){
state.rememberData = data;
},
saveMenuData(state, data){
state.menuData = data;
},
savePathUrl(state, data){
state.pathUrl = data;
},
saveMenuName(state, data){
state.menuName = data;
},
saveRememberData (state, data) {
state.rememberData = data
},
actions: {},
modules: {},
plugins: [createPersistedState()]
saveMenuData (state, data) {
state.menuData = data
},
savePathUrl (state, data) {
state.pathUrl = data
},
saveMenuName (state, data) {
state.menuName = data
}
},
actions: {},
modules: {},
plugins: [createPersistedState()]
})
+1 -1
View File
@@ -1,3 +1,3 @@
export default {
PUBLIC_KEY: `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKwvimHNGEiyV5L73llAeTv8O/3c9KLZLjNDpzNVOvzowk1MJySdSh6BiZPFXGLJ49Rrp/0U1L68ZCvC2Zv07YYTrr7Bd8o8lKB9HlUqcJo/seIHrLCLl2ePuLn+NYtIM4xxbbvAOdy5Ep/QbK4aWz8G7vsx8pctijLksYKNBQyQIDAQAB`,
PUBLIC_KEY: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKwvimHNGEiyV5L73llAeTv8O/3c9KLZLjNDpzNVOvzowk1MJySdSh6BiZPFXGLJ49Rrp/0U1L68ZCvC2Zv07YYTrr7Bd8o8lKB9HlUqcJo/seIHrLCLl2ePuLn+NYtIM4xxbbvAOdy5Ep/QbK4aWz8G7vsx8pctijLksYKNBQyQIDAQAB'
}
+27 -27
View File
@@ -4,31 +4,31 @@
* @param fmt
* @returns {*}
*/
export function formatDate(value, fmt) {
let regPos = /^\d+(\.\d+)?$/
if (regPos.test(value)) {
//如果是数字
let getDate = new Date(value)
let o = {
'M+': getDate.getMonth() + 1,
'd+': getDate.getDate(),
'h+': getDate.getHours(),
'm+': getDate.getMinutes(),
's+': getDate.getSeconds(),
'q+': Math.floor((getDate.getMonth() + 3) / 3),
'S': getDate.getMilliseconds()
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt
} else {
value = value.trim()
return value.substr(0, fmt.length)
}
export function formatDate (value, fmt) {
const regPos = /^\d+(\.\d+)?$/
if (regPos.test(value)) {
// 如果是数字
const getDate = new Date(value)
const o = {
'M+': getDate.getMonth() + 1,
'd+': getDate.getDate(),
'h+': getDate.getHours(),
'm+': getDate.getMinutes(),
's+': getDate.getSeconds(),
'q+': Math.floor((getDate.getMonth() + 3) / 3),
S: getDate.getMilliseconds()
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (const k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt
} else {
value = value.trim()
return value.substr(0, fmt.length)
}
}
+10 -10
View File
@@ -1,13 +1,13 @@
import {fileType} from "./fileType";
import { fileType } from './fileType'
export const downloadFile = (res) => {
let file_name = decodeURI(res.headers["content-disposition"]).split('=').pop();
let file_type = file_name.split('.').pop();
let blobData = new Blob([res.data], {type: fileType[file_type]});
let downloadUrl = window.URL.createObjectURL(blobData);
let anchor = document.createElement("a");
anchor.href = downloadUrl;
anchor.download = file_name;
anchor.click();
window.URL.revokeObjectURL(blobData);
const file_name = decodeURI(res.headers['content-disposition']).split('=').pop()
const file_type = file_name.split('.').pop()
const blobData = new Blob([res.data], { type: fileType[file_type] })
const downloadUrl = window.URL.createObjectURL(blobData)
const anchor = document.createElement('a')
anchor.href = downloadUrl
anchor.download = file_name
anchor.click()
window.URL.revokeObjectURL(blobData)
}
+11 -11
View File
@@ -1,13 +1,13 @@
export const fileType = {
pdf: 'application/pdf',
xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
ppt: 'application/vnd.ms-powerpoint',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
png: 'image/png',
jpg: 'image/jpeg',
rar: 'application/x-rar',
zip: 'application/zip',
pdf: 'application/pdf',
xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
ppt: 'application/vnd.ms-powerpoint',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
png: 'image/png',
jpg: 'image/jpeg',
rar: 'application/x-rar',
zip: 'application/zip'
}
+10 -10
View File
@@ -1,15 +1,15 @@
export const BASE_URL = {
// LOGIN_URL : "http://192.168.144.29:9090/cas/login?service=http://192.168.144.22:9966/login?loginType=1",
// LOGOUT_URL : "http://192.168.144.29:9090/cas/logout?service=http://192.168.144.22:9966/login?loginType=1",
// LOGIN_URL : "http://192.168.144.29:9090/cas/login?service=http://192.168.144.22:9966/login?loginType=1",
// LOGOUT_URL : "http://192.168.144.29:9090/cas/logout?service=http://192.168.144.22:9966/login?loginType=1",
//内部测试
// BASE_CHANGAN:'http://192.168.144.29:9090/cas',
BASE_LOCAL:'http://127.0.0.1:8080',
BASE_LOCAL_IMG:'http://127.0.0.1:8080',
// 内部测试
// BASE_CHANGAN:'http://192.168.144.29:9090/cas',
BASE_LOCAL: 'http://127.0.0.1:8080',
BASE_LOCAL_IMG: 'http://127.0.0.1:8080'
// //企业测试
// BASE_CHANGAN:'https://caddmuat.changan.com.cn/cas',
// BASE_LOCAL:'https://caddmuat.changan.com.cn/mi',
// BASE_LOCAL_IMG:'https://caddmuat.changan.com.cn',
// //企业测试
// BASE_CHANGAN:'https://caddmuat.changan.com.cn/cas',
// BASE_LOCAL:'https://caddmuat.changan.com.cn/mi',
// BASE_LOCAL_IMG:'https://caddmuat.changan.com.cn',
}
+7 -7
View File
@@ -1,13 +1,13 @@
import Quill from "quill";
import Quill from 'quill'
let Parchment = Quill.import("parchment");
const Parchment = Quill.import('parchment')
class lineHeightAttributor extends Parchment.Attributor.Style {
}
const lineHeightStyle = new lineHeightAttributor("lineHeight", "line-height", {
scope: Parchment.Scope.INLINE,
whitelist: ["initial", "1", "1.5", "1.75", "2", "3", "4"]
});
const lineHeightStyle = new lineHeightAttributor('lineHeight', 'line-height', {
scope: Parchment.Scope.INLINE,
whitelist: ['initial', '1', '1.5', '1.75', '2', '3', '4']
})
export {lineHeightStyle};
export { lineHeightStyle }
+87 -88
View File
@@ -1,104 +1,103 @@
import axios from 'axios';
import {Message, Loading} from 'element-ui';
import store from '../store';
import router from "../router";
import {BASE_URL} from "../utils/http";
import axios from 'axios'
import { Message, Loading } from 'element-ui'
import store from '../store'
import router from '../router'
import { BASE_URL } from '../utils/http'
// 记录请求个数、加载
let count = 0, loading = null;
let count = 0; let loading = null
// axios实例化
const instance = axios.create({
baseURL: '/library',
// timeout: 60000,
headers: {
'Cache-Control': 'no-cache',
'Pragma': 'no-cache'
}
});
baseURL: '/library',
// timeout: 60000,
headers: {
'Cache-Control': 'no-cache',
Pragma: 'no-cache'
}
})
// 添加请求拦截器
instance.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
loading = Loading.service(null);
count++;
store.commit('saveIsLoading', true);
return config;
// 在发送请求之前做些什么
loading = Loading.service(null)
count++
store.commit('saveIsLoading', true)
return config
}, function (error) {
// 对请求错误做些什么
count--;
if (count < 1) {
loading.close();
store.commit('saveIsLoading', false);
}
Message.error(error);
return Promise.reject(error);
});
// 对请求错误做些什么
count--
if (count < 1) {
loading.close()
store.commit('saveIsLoading', false)
}
Message.error(error)
return Promise.reject(error)
})
// 添加响应拦截器
instance.interceptors.response.use(function (response) {
// 对响应数据做点什么
count--;
if (count < 1) {
loading.close();
store.commit('saveIsLoading', false);
}
// 对响应数据做点什么
count--
if (count < 1) {
loading.close()
store.commit('saveIsLoading', false)
}
// 登录超时
if (response.data.respCode === '401') {
store.commit('saveUserInfo', null);
router.push('/login');
Message.error('登录超时过期');
// var url = 'http://192.168.144.22:9966/login?loginType=1'
// // var url = 'http://10.64.23.30:7766/home'
//
// return window.open('http://192.168.144.29:9090/cas/login?service='+url, '_self');
// return window.open('https://caddmuat.changan.com.cn/cas/login?service='+url, '_self');
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
}
// 登录超时
if (response.data.respCode === '401') {
store.commit('saveUserInfo', null)
router.push('/login')
Message.error('登录超时过期')
// var url = 'http://192.168.144.22:9966/login?loginType=1'
// // var url = 'http://10.64.23.30:7766/home'
//
// return window.open('http://192.168.144.29:9090/cas/login?service='+url, '_self');
// return window.open('https://caddmuat.changan.com.cn/cas/login?service='+url, '_self');
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
}
// 请求成功
if (response.status === 200) {
if (response.data.respCode === "0") {
return response.data;
} else if (response.data.respCode === "-1") {
Message.error(response.data.message);
return Promise.reject(response);
} else {
return response;
}
} else { // 请求失败
Message.error(response.data.message);
return Promise.reject(response);
}
}, function (error) {
// 对响应错误做点什么
count--;
if (count < 1) {
loading.close();
store.commit('saveIsLoading', false);
}
// 登录过期
if (error.response.status === 401) {
store.commit('saveUserInfo', null);
router.push('/login');
Message.error('登录超时过期');
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
// var url = 'http://192.168.144.22:9966/login?loginType=1'
// // var url = 'http://10.64.23.30:7766/home'
//
// return window.open('http://192.168.144.29:9090/cas/login?service='+url, '_self');
// // return window.open('https://caddmuat.changan.com.cn/cas/login?service='+url, '_self');
}
// 判断超时
if (error.code === "ECONNABORTED" && error.message.indexOf('timeout') !== -1 && !error.config._retry) {
Message.error(error.message);
// 请求成功
if (response.status === 200) {
if (response.data.respCode === '0') {
return response.data
} else if (response.data.respCode === '-1') {
Message.error(response.data.message)
return Promise.reject(response)
} else {
Message.error(error.message);
return response
}
return Promise.reject(error);
});
} else { // 请求失败
Message.error(response.data.message)
return Promise.reject(response)
}
}, function (error) {
// 对响应错误做点什么
count--
if (count < 1) {
loading.close()
store.commit('saveIsLoading', false)
}
export {instance, loading};
// 登录过期
if (error.response.status === 401) {
store.commit('saveUserInfo', null)
router.push('/login')
Message.error('登录超时过期')
// window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
// var url = 'http://192.168.144.22:9966/login?loginType=1'
// // var url = 'http://10.64.23.30:7766/home'
//
// return window.open('http://192.168.144.29:9090/cas/login?service='+url, '_self');
// // return window.open('https://caddmuat.changan.com.cn/cas/login?service='+url, '_self');
}
// 判断超时
if (error.code === 'ECONNABORTED' && error.message.indexOf('timeout') !== -1 && !error.config._retry) {
Message.error(error.message)
} else {
Message.error(error.message)
}
return Promise.reject(error)
})
export { instance, loading }
+5 -5
View File
@@ -7,20 +7,20 @@ import Vue from 'vue'
* v-watermark="{text: '水印名称', textColor: 'rgba(100, 100, 100, 0.6)'}"
*/
Vue.directive('watermark', {
bind: function(el, binding){
bind: function (el, binding) {
// 水印文字,父元素,画布宽度,画布高度,字体,文字颜色,画布横坐标,是否铺满全页
function addWaterMarker(str, parentNode, width, height, font, textColor, fillTextX = '10'){
function addWaterMarker (str, parentNode, width, height, font, textColor, fillTextX = '10') {
// 检查父元素是否包含子元素
const elementContains = (parent, child) => parent !== child && parent.contains(child)
const flag = elementContains(parentNode, document.querySelector('canvas'))
// 防止重复创建
if (!flag) {
let can = document.createElement('canvas')
const can = document.createElement('canvas')
parentNode.appendChild(can)
can.width = width || 300
can.height = height || 140
can.style.display = 'none'
let cans = can.getContext('2d')
const cans = can.getContext('2d')
cans.rotate(-20 * Math.PI / 180)
cans.font = font || '13px Microsoft Yahei'
cans.fillStyle = textColor || 'rgba(100, 100, 100, 0.2)'
@@ -31,7 +31,7 @@ Vue.directive('watermark', {
// parentNode.style.backgroundImage = "url(" + can.toDataURL("image/png") + ")";
// 创建div 定位覆盖(某个元素,如图片添加水印建议使用此方法)
let div = document.createElement('div')
const div = document.createElement('div')
div.id = str
div.className = 'waterMark'
div.style.pointerEvents = 'none'
+105 -107
View File
@@ -20,115 +20,113 @@
</template>
<script>
import Header from '@/components/Header';
import Menu from '@/components/Menu';
import Header from '@/components/Header'
import Menu from '@/components/Menu'
export default {
name: "Layout",
components: {
Header,
Menu
},
data() {
return {
menuData: []
}
},
watch: {
'$route.path': {
handler(val) {
this.getMenu();
},
deep: true
}
},
methods: {
handleTree(arr, parentId) {
let cloneData = JSON.parse(JSON.stringify(arr)); // 对源数据深度克隆
return cloneData.filter((father) => {
let branchArr = cloneData.filter(child => father.id === child.parentId); //返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null; //如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId === parentId; //返回第一层
})
},
addLevel(data, level) {
data.forEach(item => {
item.level = level;
if (item.children) {
this.addLevel(item.children, level + 1);
}
});
return data;
},
getMenu() {
if (!this.$route.query.id) {
return this.$router.push({path: '/report/list', query:{"id": "AEHJB8YNJ3"}});
}
let data = JSON.parse(JSON.stringify(this.$store.state.menuData));
let menu = data.filter(item => item.parentId === this.$route.query.id);
let menuData = [];
let menuFun = (menu) => {
menuData = [...menuData, ...menu];
let parentIds = menu.map(item => item.id);
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.parentId)))
}
};
menuFun(menu);
let treeData = this.handleTree(menuData, this.$route.query.id);
this.menuData = this.addLevel(treeData, 1);
},
getSysMenu() {
this.$api.menu.getSysMenu({roleId: this.$store.state.userInfo.roleIdList[0]}).then(({data}) => {
debugger
if (data === null) {
data = []
}
data = data.sort((a, b) => a.sort - b.sort);
let menu = data.filter(item => item.belong);
let menuData = [];
let menuFun = (menu) => {
menuData = [...menuData, ...menu]
let parentIds = menu.map(item => item.parentId);
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.id)))
}
}
menuFun(menu);
let treeData = menuData.map(item => ({
id: item.id,
parentId: item.parentId,
label: item.name,
href: item.href,
icon: item.iconHref,
isCollage: true,
belong: item.belong,
isUrl: item.isUrl
}));
// 去重
let obj = {};
treeData.forEach(item => {
obj[item.id] = item;
})
debugger
this.$store.commit('saveMenuData', Object.values(obj));
this.getMenu();
});
}
},
created() {
// 判定菜单是否存在,存在则不加载
// let menuData = this.$store.state.menuData;
// debugger
// if (menuData.length == 0) {
this.getSysMenu();
// } else {
// this.getMenu();
// }
}
export default {
name: 'Layout',
components: {
Header,
Menu
},
data () {
return {
menuData: []
}
},
watch: {
'$route.path': {
handler (val) {
this.getMenu()
},
deep: true
}
},
methods: {
handleTree (arr, parentId) {
const cloneData = JSON.parse(JSON.stringify(arr)) // 对源数据深度克隆
return cloneData.filter((father) => {
const branchArr = cloneData.filter(child => father.id === child.parentId) // 返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null // 如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId === parentId // 返回第一层
})
},
addLevel (data, level) {
data.forEach(item => {
item.level = level
if (item.children) {
this.addLevel(item.children, level + 1)
}
})
return data
},
getMenu () {
if (!this.$route.query.id) {
return this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } })
}
const data = JSON.parse(JSON.stringify(this.$store.state.menuData))
const menu = data.filter(item => item.parentId === this.$route.query.id)
let menuData = []
const menuFun = (menu) => {
menuData = [...menuData, ...menu]
const parentIds = menu.map(item => item.id)
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.parentId)))
}
}
menuFun(menu)
const treeData = this.handleTree(menuData, this.$route.query.id)
this.menuData = this.addLevel(treeData, 1)
},
getSysMenu () {
this.$api.menu.getSysMenu({ roleId: this.$store.state.userInfo.roleIdList[0] }).then(({ data }) => {
if (data === null) {
data = []
}
data = data.sort((a, b) => a.sort - b.sort)
const menu = data.filter(item => item.belong)
let menuData = []
const menuFun = (menu) => {
menuData = [...menuData, ...menu]
const parentIds = menu.map(item => item.parentId)
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.id)))
}
}
menuFun(menu)
const treeData = menuData.map(item => ({
id: item.id,
parentId: item.parentId,
label: item.name,
href: item.href,
icon: item.iconHref,
isCollage: true,
belong: item.belong,
isUrl: item.isUrl
}))
// 去重
const obj = {}
treeData.forEach(item => {
obj[item.id] = item
})
this.$store.commit('saveMenuData', Object.values(obj))
this.getMenu()
})
}
},
created () {
// 判定菜单是否存在,存在则不加载
// let menuData = this.$store.state.menuData;
// debugger
// if (menuData.length == 0) {
this.getSysMenu()
// } else {
// this.getMenu();
// }
}
}
</script>
<style lang="scss" scoped>
+84 -83
View File
@@ -37,91 +37,92 @@
</template>
<script>
import {Base64} from "js-base64";
import { Base64 } from 'js-base64'
export default {
name: "Login",
data() {
return {
form: {
username: '',
password: '',
verifyCode: '',
},
verifyImg: '',
isChecked: false,
}
},
created() {
this.init();
},
methods: {
getQueryVariable(r, variable) {
if (r) {
var query = r.split('?');
if (query && query.length == 2) {
var vars = query[1].split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
}
},
init() {
this.isChecked = !!this.$store.state.rememberData;
if (this.isChecked) {
this.form.username = this.$store.state.rememberData.username;
this.form.password = this.$store.state.rememberData.password;
}
this.verifyCode();
},
// 登录
login() {
if (!this.form.username) {
return this.$message.warning('请输入用户名')
}
if (!this.form.password) {
return this.$message.warning('请输入密码')
}
if (!this.form.verifyCode) {
return this.$message.warning('请输入验证码')
}
if (this.form.verifyCode.length !== 4) {
return this.$message.warning('请检查验证码')
}
this.$store.commit('saveRememberData', this.isChecked ? {
username: this.form.username,
password: this.form.password
} : null);
let data = JSON.parse(JSON.stringify(this.form));
data.username = this.$JSEncrypt(data.username);
data.password = this.$JSEncrypt(data.password);
let jsonData = JSON.stringify(data);
this.$api.login.login(Base64.encode(jsonData)).then(res => {
if (res.respCode !== '0') {
this.verifyCode();
return this.$message.error(res.data.message);
}
this.$message.success('登录成功');
this.$store.commit('saveUserInfo', res.data);
this.$router.push({path: '/report/list', query:{"id": "AEHJB8YNJ3"}});
}).catch(_ => {
this.verifyCode();
})
},
// 获取验证码
verifyCode() {
this.$api.login.verifyCode({})
.then(res => {
this.verifyImg = `data: image/jpeg;base64,${btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))}`
})
},
}
export default {
name: 'Login',
data () {
return {
form: {
username: '',
password: '',
verifyCode: ''
},
verifyImg: '',
isChecked: false
}
},
created () {
this.init()
},
methods: {
getQueryVariable (r, variable) {
if (r) {
const query = r.split('?')
if (query && query.length == 2) {
const vars = query[1].split('&')
for (let i = 0; i < vars.length; i++) {
const pair = vars[i].split('=')
if (pair[0] == variable) {
return pair[1]
}
}
}
}
},
init () {
this.isChecked = !!this.$store.state.rememberData
if (this.isChecked) {
this.form.username = this.$store.state.rememberData.username
this.form.password = this.$store.state.rememberData.password
}
this.verifyCode()
},
// 登录
login () {
if (!this.form.username) {
return this.$message.warning('请输入用户名')
}
if (!this.form.password) {
return this.$message.warning('请输入密码')
}
if (!this.form.verifyCode) {
return this.$message.warning('请输入验证码')
}
if (this.form.verifyCode.length !== 4) {
return this.$message.warning('请检查验证码')
}
this.$store.commit('saveRememberData', this.isChecked
? {
username: this.form.username,
password: this.form.password
}
: null)
const data = JSON.parse(JSON.stringify(this.form))
data.username = this.$JSEncrypt(data.username)
data.password = this.$JSEncrypt(data.password)
const jsonData = JSON.stringify(data)
this.$api.login.login(Base64.encode(jsonData)).then(res => {
if (res.respCode !== '0') {
this.verifyCode()
return this.$message.error(res.data.message)
}
this.$message.success('登录成功')
this.$store.commit('saveUserInfo', res.data)
this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } })
}).catch(_ => {
this.verifyCode()
})
},
// 获取验证码
verifyCode () {
this.$api.login.verifyCode({})
.then(res => {
this.verifyImg = `data: image/jpeg;base64,${btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))}`
})
}
}
}
</script>
<style lang="scss" scoped>
+1 -1
View File
@@ -6,7 +6,7 @@
<script>
export default {
name: "Register"
name: 'Register'
}
</script>
+40 -40
View File
@@ -32,48 +32,48 @@
</template>
<script>
import {downloadFile} from "@/utils/downloadFile";
import {formatDate} from '@/utils/date'
import { downloadFile } from '@/utils/downloadFile'
import { formatDate } from '@/utils/date'
export default {
name: "ReportDetail",
data(){
return {
watermarkText: '', // 水印
content: '',
row: {},
}
},
methods: {
// 预览
previewRow() {
if(!this.$route.query.row){
this.$router.push({path: '/report/list', query: {id: this.$route.query.id}});
return
}
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`;
this.row = JSON.parse(this.$route.query.row);
this.$api.report.reportGetReportHtmlId({id: this.row.id}).then(({data}) => {
this.content = data.content;
})
},
// 下载
downloadRow(row){
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => {
downloadFile(res);
})
// })
}
},
created() {
this.previewRow();
}
export default {
name: 'ReportDetail',
data () {
return {
watermarkText: '', // 水印
content: '',
row: {}
}
},
methods: {
// 预览
previewRow () {
if (!this.$route.query.row) {
this.$router.push({ path: '/report/list', query: { id: this.$route.query.id } })
return
}
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`
this.row = JSON.parse(this.$route.query.row)
this.$api.report.reportGetReportHtmlId({ id: this.row.id }).then(({ data }) => {
this.content = data.content
})
},
// 下载
downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res)
})
// })
}
},
created () {
this.previewRow()
}
}
</script>
<style lang="scss" scoped>
+170 -170
View File
@@ -163,180 +163,180 @@
</template>
<script>
import {downloadFile} from "@/utils/downloadFile";
import {formatDate} from '@/utils/date'
import { downloadFile } from '@/utils/downloadFile'
import { formatDate } from '@/utils/date'
export default {
name: "ReportList",
data() {
return {
watermarkText: '', // 水印
fullscreen: false,
q: {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10,
},
total: 0,
tableData: [],
yearList: [],
tagData: {
1: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
2: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
3: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
},
dialogPreview: false, // 预览
content: '',
name: 'ReportList',
data () {
return {
watermarkText: '', // 水印
fullscreen: false,
q: {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
},
total: 0,
tableData: [],
yearList: [],
tagData: {
1: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
},
2: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
},
3: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
}
},
methods: {
init() {
this.labelList();
this.reportDateList();
this.reportList();
},
// 标签列表
labelList() {
this.$api.report.labelList().then(({data}) => {
this.tagData[1].name = data.labelOne.name;
this.tagData[2].name = data.labelTwo.name;
this.tagData[3].name = data.labelThree.name;
this.tagData[1].tags = data.labelOne.childList;
this.tagData[2].tags = data.labelTwo.childList;
this.tagData[3].tags = data.labelThree.childList;
})
},
search(){
this.q.pageNo = 1;
this.reportList();
},
// 列表
reportList() {
this.$api.report.reportList(this.q).then(({data}) => {
this.tableData = data.records;
this.total = data.total;
this.q.pageNo = data.current;
this.q.pageSize = data.size;
if(!data.records.length && this.q.pageNo !== 1){
this.q.pageNo = 1;
this.reportList();
}
})
},
// 监听全选按钮
handleCheckAllChange(val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
}
this.tagData[type].isIndeterminate = !val;
},
// 监听group checkbox
handleCheckedTagsChange(val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length);
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length;
},
// 切换展开隐藏
switchTagShow(type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow;
},
// 日期列表
reportDateList() {
this.$api.report.reportDateList().then(({data}) => {
this.yearList = data.list;
})
},
// 单页数据量
handleSizeChange(val) {
this.q.pageSize = val;
this.q.pageNo = 1;
this.reportList();
},
// 第几页
handleCurrentChange(val) {
this.q.pageNo = val;
this.reportList();
},
// 预览
previewRow(row) {
this.fullscreen = false;
// 更新预览水印的时间戳
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`;
this.$api.report.reportGetReportHtmlId({id: row.id}).then(({data}) => {
this.content = data.content;
this.dialogPreview = true;
})
},
// 重置
reset() {
this.q = {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10,
};
this.total = 0;
this.tableData = [];
this.tagData[1].checkAll = false;
this.tagData[1].isIndeterminate = true;
this.tagData[2].checkAll = false;
this.tagData[2].isIndeterminate = true;
this.tagData[3].checkAll = false;
this.tagData[3].isIndeterminate = true;
this.reportList();
},
// 下载
downloadRow(row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => {
downloadFile(res);
})
// })
},
// 跳转到详情
goReportDetail(row) {
this.$router.push({path: '/report/detail', query: {id: this.$route.query.id, row: JSON.stringify(row)}});
}
},
created() {
this.init();
},
dialogPreview: false, // 预览
content: ''
}
},
methods: {
init () {
this.labelList()
this.reportDateList()
this.reportList()
},
// 标签列表
labelList () {
this.$api.report.labelList().then(({ data }) => {
this.tagData[1].name = data.labelOne.name
this.tagData[2].name = data.labelTwo.name
this.tagData[3].name = data.labelThree.name
this.tagData[1].tags = data.labelOne.childList
this.tagData[2].tags = data.labelTwo.childList
this.tagData[3].tags = data.labelThree.childList
})
},
search () {
this.q.pageNo = 1
this.reportList()
},
// 列表
reportList () {
this.$api.report.reportList(this.q).then(({ data }) => {
this.tableData = data.records
this.total = data.total
this.q.pageNo = data.current
this.q.pageSize = data.size
if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1
this.reportList()
}
})
},
// 监听全选按钮
handleCheckAllChange (val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : []
break
}
this.tagData[type].isIndeterminate = !val
},
// 监听group checkbox
handleCheckedTagsChange (val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length)
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length
},
// 切换展开隐藏
switchTagShow (type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow
},
// 日期列表
reportDateList () {
this.$api.report.reportDateList().then(({ data }) => {
this.yearList = data.list
})
},
// 单页数据量
handleSizeChange (val) {
this.q.pageSize = val
this.q.pageNo = 1
this.reportList()
},
// 第几页
handleCurrentChange (val) {
this.q.pageNo = val
this.reportList()
},
// 预览
previewRow (row) {
this.fullscreen = false
// 更新预览水印的时间戳
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`
this.$api.report.reportGetReportHtmlId({ id: row.id }).then(({ data }) => {
this.content = data.content
this.dialogPreview = true
})
},
// 重置
reset () {
this.q = {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
}
this.total = 0
this.tableData = []
this.tagData[1].checkAll = false
this.tagData[1].isIndeterminate = true
this.tagData[2].checkAll = false
this.tagData[2].isIndeterminate = true
this.tagData[3].checkAll = false
this.tagData[3].isIndeterminate = true
this.reportList()
},
// 下载
downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res)
})
// })
},
// 跳转到详情
goReportDetail (row) {
this.$router.push({ path: '/report/detail', query: { id: this.$route.query.id, row: JSON.stringify(row) } })
}
},
created () {
this.init()
}
}
</script>
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -5,13 +5,13 @@
</template>
<script>
export default {
name: 'Page401',
data() {
return {}
},
methods: {}
}
export default {
name: 'Page401',
data () {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
+150 -152
View File
@@ -87,158 +87,158 @@
</template>
<script>
import {fileType} from "@/utils/fileType";
import { fileType } from '@/utils/fileType'
export default {
name: "MenuManager",
data() {
return {
form: {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0,
},
tableData: [],
dialogMenu: false,
mode: '',
pathList: [],
level: 0,
}
},
methods: {
init() {
this.sysMenuFindAllMenus();
this.getRouterPath();
},
// 菜单
sysMenuFindAllMenus() {
this.$api.menu.sysMenuFindAllMenus().then(({data}) => {
this.tableData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort;
});
})
},
// 新增弹窗
addMenu(row, level) {
this.mode = 'add';
this.level = level + 1;
this.form = {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0,
};
this.form.parentId = row ? row.id : '6f6fafb4a7';
this.dialogMenu = true;
},
// 新增 修改
postOrPutSysMenu() {
if (!this.form.name) {
return this.$message.warning('请输入菜单名称');
}
if (this.level === 0 || this.level === 2) {
// if (!this.form.icon) {
// return this.$message.warning('请上传菜单图标');
// }
}
if (this.mode === 'add') {
this.$api.menu.postSysMenu(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogMenu = false;
this.sysMenuFindAllMenus();
})
}
if (this.mode === 'modify') {
this.$api.menu.putSysMenu(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogMenu = false;
this.sysMenuFindAllMenus();
})
}
},
// 图标上传
uploadFile(params) {
let fd = new FormData();
fd.append('file', params.file);
this.$api.report.reportUploadPicFile(fd).then(({data}) => {
this.form.icon = data.key;
this.form.iconHref = data.value;
})
},
beforeUploadFile(file) {
const isType = (file.type === fileType.png || file.type === fileType.jpg);
const isSize = file.size / 1024 / 1024 < 2;
if (!isType) {
this.$message.error('仅能上传 pngjpg 格式文件');
}
if (!isSize) {
this.$message.error('您最大可上传2M文件');
}
return isType && isSize;
},
// 删除
deleteRow(row) {
this.$confirm('此操作将删除所选数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.menu.sysMenuDeleteId({ids: row.id}).then(_ => {
this.$message.success('操作成功');
this.sysMenuFindAllMenus();
})
})
},
// 编辑
modifyRow(row, level) {
this.level = level;
this.mode = 'modify';
this.form = JSON.parse(JSON.stringify(row));
this.dialogMenu = true;
},
// 获取存在路径
getRouterPath() {
let pathList = [];
let pathFun = (data, url) => {
data.forEach(item => {
if (item.children) {
pathFun(item.children, item.path);
} else {
pathList.push(`${url ? (url + '/') : ''}${item.path}`);
}
})
}
pathFun(this.$router.options.routes);
this.pathList = pathList;
},
},
computed: {
dialogTitle() {
switch (this.mode) {
case 'add':
return '新增';
case 'modify':
return '编辑';
case 'view':
return '查看';
}
}
},
created() {
this.init();
}
export default {
name: 'MenuManager',
data () {
return {
form: {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0
},
tableData: [],
dialogMenu: false,
mode: '',
pathList: [],
level: 0
}
},
methods: {
init () {
this.sysMenuFindAllMenus()
this.getRouterPath()
},
// 菜单
sysMenuFindAllMenus () {
this.$api.menu.sysMenuFindAllMenus().then(({ data }) => {
this.tableData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort
})
})
},
// 新增弹窗
addMenu (row, level) {
this.mode = 'add'
this.level = level + 1
this.form = {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0
}
this.form.parentId = row ? row.id : '6f6fafb4a7'
this.dialogMenu = true
},
// 新增 修改
postOrPutSysMenu () {
if (!this.form.name) {
return this.$message.warning('请输入菜单名称')
}
if (this.level === 0 || this.level === 2) {
// if (!this.form.icon) {
// return this.$message.warning('请上传菜单图标');
// }
}
if (this.mode === 'add') {
this.$api.menu.postSysMenu(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogMenu = false
this.sysMenuFindAllMenus()
})
}
if (this.mode === 'modify') {
this.$api.menu.putSysMenu(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogMenu = false
this.sysMenuFindAllMenus()
})
}
},
// 图标上传
uploadFile (params) {
const fd = new FormData()
fd.append('file', params.file)
this.$api.report.reportUploadPicFile(fd).then(({ data }) => {
this.form.icon = data.key
this.form.iconHref = data.value
})
},
beforeUploadFile (file) {
const isType = (file.type === fileType.png || file.type === fileType.jpg)
const isSize = file.size / 1024 / 1024 < 2
if (!isType) {
this.$message.error('仅能上传 pngjpg 格式文件')
}
if (!isSize) {
this.$message.error('您最大可上传2M文件')
}
return isType && isSize
},
// 删除
deleteRow (row) {
this.$confirm('此操作将删除所选数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.menu.sysMenuDeleteId({ ids: row.id }).then(_ => {
this.$message.success('操作成功')
this.sysMenuFindAllMenus()
})
})
},
// 编辑
modifyRow (row, level) {
this.level = level
this.mode = 'modify'
this.form = JSON.parse(JSON.stringify(row))
this.dialogMenu = true
},
// 获取存在路径
getRouterPath () {
const pathList = []
const pathFun = (data, url) => {
data.forEach(item => {
if (item.children) {
pathFun(item.children, item.path)
} else {
pathList.push(`${url ? (url + '/') : ''}${item.path}`)
}
})
}
pathFun(this.$router.options.routes)
this.pathList = pathList
}
},
computed: {
dialogTitle () {
switch (this.mode) {
case 'add':
return '新增'
case 'modify':
return '编辑'
case 'view':
return '查看'
}
}
},
created () {
this.init()
}
}
</script>
<style lang="scss" scoped>
@@ -324,7 +324,6 @@
// margin-left: -1.5px;
// }
.menu-image {
display: flex;
align-items: center;
@@ -434,7 +433,6 @@
}
}
.icon-menu-text {
display: flex;
width: 36px;
+184 -184
View File
@@ -80,192 +80,192 @@
</template>
<script>
import {v4 as uuidv4} from 'uuid';
import { v4 as uuidv4 } from 'uuid'
export default {
name: "Role",
data() {
return {
tableData: [], // 角色列表
dialogRole: false,
mode: '',
form: {
rname: '',
rdesc: '',
rid: ''
},
dialogPermission: false,
treeData: [],
checkboxConfig: {
checkRowKeys: [],
checkStrictly: true
},
roleId: '',
tableKey: uuidv4(),
// isHomePage: null, // 配置首页 1首页 2权限
}
},
methods: {
init() {
this.getSysRole();
this.sysMenuFindAllMenus();
},
/* =============================================== 角色列表 =============================================== */
// 角色列表
getSysRole() {
this.$api.role.getSysRole().then(({data}) => {
this.tableData = data;
})
},
// 删除角色
delSysRole(row) {
this.$confirm('此操作将删除所选角色, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.role.delSysRole({id: row.rid}).then(({data}) => {
this.$message.success('操作成功');
this.getSysRole();
})
})
},
/* =============================================== 角色弹窗 =============================================== */
// 新增角色
addRole() {
this.mode = 'add';
this.form = {
rname: '',
rdesc: '',
rid: ''
}
this.dialogRole = true;
},
// 编辑角色
modifyRow(row) {
this.mode = 'modify';
this.form = {
rname: row.rname,
rdesc: row.rdesc,
rid: row.rid
}
this.dialogRole = true;
},
// 新增 修改
postOrPutSysRole() {
if (!this.form.rname) {
return this.$message.warning('请输入角色名称');
}
if (this.mode === 'add') {
this.$api.role.postSysRole(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogRole = false;
this.getSysRole();
})
}
if (this.mode === 'modify') {
this.$api.role.putSysRole(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogRole = false;
this.getSysRole();
})
}
},
/* =============================================== 角色权限 =============================================== */
// 获取菜单
openPermission(row) {
this.roleId = row.rid;
// this.isHomePage = type;
// if(type === 2){
this.$api.menu.getSysMenu({roleId: row.rid}).then(({data}) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
this.tableKey = uuidv4();
this.dialogPermission = true;
})
// }else if(type === 1) {
// this.$api.role.sysRoleGetRoleHome({roleId: row.rid}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// this.dialogPermission = true;
// })
// }
},
// 获取权限
getSysMenu(roleId){
this.$api.menu.getSysMenu({roleId}).then(({data}) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
this.tableKey = uuidv4();
})
},
// 获取首页
// getSysHome(roleId){
// this.$api.role.sysRoleGetRoleHome({roleId}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// })
// },
// 添加权限
sysRoleSaveRoleMenu() {
// 获取全部选中和半选中的数据
let checkedData = this.$refs.rolePermission.getCheckboxRecords();
let indeterminateData = this.$refs.rolePermission.getCheckboxIndeterminateRecords();
let allCheckData = [];
allCheckData = checkedData.concat(indeterminateData);
let ids = allCheckData.map(item => item.id);
let params = {
rid: this.roleId,
menusstr: ids
}
this.$api.role.sysRoleSaveRoleMenu(params).then(_ => {
this.$message.success('操作成功');
this.dialogPermission = false;
})
},
// // 首页配置
// sysRoleSaveRoleHome(){
// let ids = this.$refs.rolePermission.getCheckboxRecords().map(item => item.id);
// let params = {
// rid: this.roleId,
// menusstr: ids
// }
// this.$api.role.sysRoleSaveRoleHome(params).then(_ => {
// this.$message.success('操作成功');
// this.dialogPermission = false;
// })
// },
// 菜单
sysMenuFindAllMenus() {
this.$api.menu.sysMenuFindAllMenus().then(({data}) => {
this.treeData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort;
});
})
},
},
computed: {
dialogTitle() {
switch (this.mode) {
case 'add':
return '新增';
case 'modify':
return '编辑';
case 'view':
return '查看';
}
}
},
created() {
this.init();
name: 'Role',
data () {
return {
tableData: [], // 角色列表
dialogRole: false,
mode: '',
form: {
rname: '',
rdesc: '',
rid: ''
},
dialogPermission: false,
treeData: [],
checkboxConfig: {
checkRowKeys: [],
checkStrictly: true
},
roleId: '',
tableKey: uuidv4()
// isHomePage: null, // 配置首页 1首页 2权限
}
},
methods: {
init () {
this.getSysRole()
this.sysMenuFindAllMenus()
},
/* =============================================== 角色列表 =============================================== */
// 角色列表
getSysRole () {
this.$api.role.getSysRole().then(({ data }) => {
this.tableData = data
})
},
// 删除角色
delSysRole (row) {
this.$confirm('此操作将删除所选角色, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.role.delSysRole({ id: row.rid }).then(({ data }) => {
this.$message.success('操作成功')
this.getSysRole()
})
})
},
/* =============================================== 角色弹窗 =============================================== */
// 新增角色
addRole () {
this.mode = 'add'
this.form = {
rname: '',
rdesc: '',
rid: ''
}
this.dialogRole = true
},
// 编辑角色
modifyRow (row) {
this.mode = 'modify'
this.form = {
rname: row.rname,
rdesc: row.rdesc,
rid: row.rid
}
this.dialogRole = true
},
// 新增 修改
postOrPutSysRole () {
if (!this.form.rname) {
return this.$message.warning('请输入角色名称')
}
if (this.mode === 'add') {
this.$api.role.postSysRole(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogRole = false
this.getSysRole()
})
}
if (this.mode === 'modify') {
this.$api.role.putSysRole(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogRole = false
this.getSysRole()
})
}
},
/* =============================================== 角色权限 =============================================== */
// 获取菜单
openPermission (row) {
this.roleId = row.rid
// this.isHomePage = type;
// if(type === 2){
this.$api.menu.getSysMenu({ roleId: row.rid }).then(({ data }) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id)
this.tableKey = uuidv4()
this.dialogPermission = true
})
// }else if(type === 1) {
// this.$api.role.sysRoleGetRoleHome({roleId: row.rid}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// this.dialogPermission = true;
// })
// }
},
// 获取权限
getSysMenu (roleId) {
this.$api.menu.getSysMenu({ roleId }).then(({ data }) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id)
this.tableKey = uuidv4()
})
},
// 获取首页
// getSysHome(roleId){
// this.$api.role.sysRoleGetRoleHome({roleId}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// })
// },
// 添加权限
sysRoleSaveRoleMenu () {
// 获取全部选中和半选中的数据
const checkedData = this.$refs.rolePermission.getCheckboxRecords()
const indeterminateData = this.$refs.rolePermission.getCheckboxIndeterminateRecords()
let allCheckData = []
allCheckData = checkedData.concat(indeterminateData)
const ids = allCheckData.map(item => item.id)
const params = {
rid: this.roleId,
menusstr: ids
}
this.$api.role.sysRoleSaveRoleMenu(params).then(_ => {
this.$message.success('操作成功')
this.dialogPermission = false
})
},
// // 首页配置
// sysRoleSaveRoleHome(){
// let ids = this.$refs.rolePermission.getCheckboxRecords().map(item => item.id);
// let params = {
// rid: this.roleId,
// menusstr: ids
// }
// this.$api.role.sysRoleSaveRoleHome(params).then(_ => {
// this.$message.success('操作成功');
// this.dialogPermission = false;
// })
// },
// 菜单
sysMenuFindAllMenus () {
this.$api.menu.sysMenuFindAllMenus().then(({ data }) => {
this.treeData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort
})
})
}
},
computed: {
dialogTitle () {
switch (this.mode) {
case 'add':
return '新增'
case 'modify':
return '编辑'
case 'view':
return '查看'
}
}
},
created () {
this.init()
}
}
</script>
+231 -232
View File
@@ -123,244 +123,243 @@
</template>
<script>
import {Base64} from "js-base64";
import { Base64 } from 'js-base64'
export default {
name: "User",
data() {
return {
q: {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10,
},
total: 0,
tableData: [],
mode: '',
dialogUser: false,
form: {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''], // 角色
},
repassword: '',
roleList: [],
}
},
methods: {
search(){
this.q.pageNo = 1;
this.sysUserList();
},
// 获取所有用户
sysUserList() {
this.$api.user.sysUserList(this.q).then(({data}) => {
this.tableData = data.records;
this.total = data.total;
this.q.pageNo = data.current;
this.q.pageSize = data.size;
if(!data.records.length && this.q.pageNo !== 1){
this.q.pageNo = 1;
this.sysUserList();
}
})
},
// 重置
reset() {
this.q = {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10,
};
this.total = 0;
this.tableData = [];
this.sysUserList();
},
// 单页数据量
handleSizeChange(val) {
this.q.pageSize = val;
this.q.pageNo = 1;
this.sysUserList();
},
// 第几页
handleCurrentChange(val) {
this.q.pageNo = val;
this.sysUserList();
},
// 新增
add() {
this.mode = 'add';
this.form = {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''], // 角色
};
this.repassword = '';
this.dialogUser = true;
},
// 启用/禁用
sysUserIsUse(val, row) {
this.$confirm(val === '0' ? '此操作将禁用所选用户, 是否继续?' : '此操作将启用所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserIsUse({USID: row.USID, type: val}).then(_ => {
this.$message.success('操作成功');
this.sysUserList();
})
}).catch(() => {
row.ISUSE = val === '1' ? '0' : '1';
});
},
// 删除
deleteRow(row) {
this.deleteUser(row.USID);
},
// 验证
checkUserForm() {
if (this.mode === 'add') {
if (!this.form.account || !(/^[a-zA-Z0-9]*$/.test(this.form.account))) {
return this.$message.warning('用户名只能为纯数字、纯字母或字母数字组合') && false;
}
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
}
if(this.mode === 'modify'){
// if (this.form.password || this.repassword) {
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
// }
}
if (this.form.cellPhoneNumber && !(/^1[3|4|5|7|8|9][0-9]{9}$/.test(this.form.cellPhoneNumber))) {
return this.$message.warning('请检查手机号') && false;
}
if (this.form.email && !(/^[\w-.]+@[a-z\d-]+(\.[a-z\d-]+)*\.[a-z\d]{2,6}$/i.test(this.form.email))) {
return this.$message.warning('请检查邮箱') && false;
}
if (!this.form.roleIdList[0]) {
return this.$message.warning('请选择角色') && false;
}
if (!this.form.usname) {
return this.$message.warning('请输入姓名') && false;
}
return true;
},
// 新增用户
sysUserAddUser() {
if (!this.checkUserForm()) return;
let data = JSON.parse(JSON.stringify(this.form));
data.account = this.$JSEncrypt(data.account);
data.password = this.$JSEncrypt(data.password);
let jsonData = JSON.stringify(data);
this.$api.user.sysUserAddUser(Base64.encodeURI(jsonData)).then(_ => {
this.$message.success('操作成功');
this.dialogUser = false;
this.reset();
})
},
// 编辑查看用户
openRowData(mode, row) {
this.mode = mode;
this.form = {
account: row.ACCOUNT, // 用户名
cellPhoneNumber: row.CELLPHONE_NUMBER, // 手机号
department: row.DEPARTMENT, // 部门
email: row.EMAIL, // 邮箱
password: '', // 密码
usid: row.USID, // 用户ID
usname: row.USNAME, // 姓名
roleIdList: [row.ROLEID], // 角色
}
this.repassword = '';
this.dialogUser = true;
},
newAddFunc(){
},
uploadPDFSuccess(response, file, fileList) {
if (response.ok) {
this.$message.success('导入成功');
this.reset()
} else {
this.$message.error(response.message);
}
},
downloadTemp(){
window.open('/library/api/sys/user/template')
},
// 多选用户
getSelectUser() {
let users = this.$refs.userTable.getCheckboxRecords();
if (!users.length) {
return this.$message.warning('请选择数据后在进行操作');
}
let ids = users.map(item => item.USID).join(',');
this.deleteUser(ids);
},
// 删除用户
deleteUser(ids) {
this.$confirm('此操作将删除所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserDelete({ids}).then(_ => {
this.$message.success('操作成功');
this.sysUserList();
})
})
},
// 角色列表
getSysRole() {
this.$api.role.getSysRole().then(({data}) => {
this.roleList = data;
})
},
},
computed: {
dialogTitle() {
switch (this.mode) {
case 'add':
return '新增';
case 'modify':
return '编辑';
case 'view':
return '查看';
}
}
},
created() {
this.sysUserList();
this.getSysRole();
name: 'User',
data () {
return {
q: {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10
},
total: 0,
tableData: [],
mode: '',
dialogUser: false,
form: {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''] // 角色
},
repassword: '',
roleList: []
}
},
methods: {
search () {
this.q.pageNo = 1
this.sysUserList()
},
// 获取所有用户
sysUserList () {
this.$api.user.sysUserList(this.q).then(({ data }) => {
this.tableData = data.records
this.total = data.total
this.q.pageNo = data.current
this.q.pageSize = data.size
if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1
this.sysUserList()
}
})
},
// 重置
reset () {
this.q = {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10
}
this.total = 0
this.tableData = []
this.sysUserList()
},
// 单页数据量
handleSizeChange (val) {
this.q.pageSize = val
this.q.pageNo = 1
this.sysUserList()
},
// 第几页
handleCurrentChange (val) {
this.q.pageNo = val
this.sysUserList()
},
// 新增
add () {
this.mode = 'add'
this.form = {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''] // 角色
}
this.repassword = ''
this.dialogUser = true
},
// 启用/禁用
sysUserIsUse (val, row) {
this.$confirm(val === '0' ? '此操作将禁用所选用户, 是否继续?' : '此操作将启用所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserIsUse({ USID: row.USID, type: val }).then(_ => {
this.$message.success('操作成功')
this.sysUserList()
})
}).catch(() => {
row.ISUSE = val === '1' ? '0' : '1'
})
},
// 删除
deleteRow (row) {
this.deleteUser(row.USID)
},
// 验证
checkUserForm () {
if (this.mode === 'add') {
if (!this.form.account || !(/^[a-zA-Z0-9]*$/.test(this.form.account))) {
return this.$message.warning('用户名只能为纯数字、纯字母或字母数字组合') && false
}
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
}
if (this.mode === 'modify') {
// if (this.form.password || this.repassword) {
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
// }
}
if (this.form.cellPhoneNumber && !(/^1[3|4|5|7|8|9][0-9]{9}$/.test(this.form.cellPhoneNumber))) {
return this.$message.warning('请检查手机号') && false
}
if (this.form.email && !(/^[\w-.]+@[a-z\d-]+(\.[a-z\d-]+)*\.[a-z\d]{2,6}$/i.test(this.form.email))) {
return this.$message.warning('请检查邮箱') && false
}
if (!this.form.roleIdList[0]) {
return this.$message.warning('请选择角色') && false
}
if (!this.form.usname) {
return this.$message.warning('请输入姓名') && false
}
return true
},
// 新增用户
sysUserAddUser () {
if (!this.checkUserForm()) return
const data = JSON.parse(JSON.stringify(this.form))
data.account = this.$JSEncrypt(data.account)
data.password = this.$JSEncrypt(data.password)
const jsonData = JSON.stringify(data)
this.$api.user.sysUserAddUser(Base64.encodeURI(jsonData)).then(_ => {
this.$message.success('操作成功')
this.dialogUser = false
this.reset()
})
},
// 编辑查看用户
openRowData (mode, row) {
this.mode = mode
this.form = {
account: row.ACCOUNT, // 用户名
cellPhoneNumber: row.CELLPHONE_NUMBER, // 手机号
department: row.DEPARTMENT, // 部门
email: row.EMAIL, // 邮箱
password: '', // 密码
usid: row.USID, // 用户ID
usname: row.USNAME, // 姓名
roleIdList: [row.ROLEID] // 角色
}
this.repassword = ''
this.dialogUser = true
},
newAddFunc () {
},
uploadPDFSuccess (response, file, fileList) {
if (response.ok) {
this.$message.success('导入成功')
this.reset()
} else {
this.$message.error(response.message)
}
},
downloadTemp () {
window.open('/library/api/sys/user/template')
},
// 多选用户
getSelectUser () {
const users = this.$refs.userTable.getCheckboxRecords()
if (!users.length) {
return this.$message.warning('请选择数据后在进行操作')
}
const ids = users.map(item => item.USID).join(',')
this.deleteUser(ids)
},
// 删除用户
deleteUser (ids) {
this.$confirm('此操作将删除所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserDelete({ ids }).then(_ => {
this.$message.success('操作成功')
this.sysUserList()
})
})
},
// 角色列表
getSysRole () {
this.$api.role.getSysRole().then(({ data }) => {
this.roleList = data
})
}
},
computed: {
dialogTitle () {
switch (this.mode) {
case 'add':
return '新增'
case 'modify':
return '编辑'
case 'view':
return '查看'
}
}
},
created () {
this.sysUserList()
this.getSysRole()
}
}
</script>
<style lang="scss" scoped>
.system-user {
.title {
+28 -29
View File
@@ -7,37 +7,37 @@
<script>
export default {
name: "MenuManager",
data() {
return {
url: ''
}
},
methods: {},
computed: {},
created() {
this.url = this.$store.state.pathUrl
},
mounted() {
/**
export default {
name: 'MenuManager',
data () {
return {
url: ''
}
},
methods: {},
computed: {},
created () {
this.url = this.$store.state.pathUrl
},
mounted () {
/**
* iframe-宽高自适应显示
*/
function changeMobsfIframe() {
const mobsf = document.getElementById('mobsf');
const deviceWidth = document.body.clientWidth;
const deviceHeight = document.body.clientHeight;
mobsf.style.width = '100%'; //数字是页面布局宽度差值
mobsf.style.height = (Number(deviceHeight) - 86) + 'px'; //数字是页面布局高度差
}
changeMobsfIframe()
window.onresize = function () {
changeMobsfIframe()
}
}
function changeMobsfIframe () {
const mobsf = document.getElementById('mobsf')
const deviceWidth = document.body.clientWidth
const deviceHeight = document.body.clientHeight
mobsf.style.width = '100%' // 数字是页面布局宽度差值
mobsf.style.height = (Number(deviceHeight) - 86) + 'px' // 数字是页面布局高度差
}
changeMobsfIframe()
window.onresize = function () {
changeMobsfIframe()
}
}
}
</script>
<style lang="scss" scoped>
@@ -225,7 +225,6 @@
}
}
.icon-menu-text {
display: flex;
width: 36px;
+49 -49
View File
@@ -1,53 +1,53 @@
const webpack = require('webpack')
module.exports = {
// publicPath: '/mi',
outputDir: 'dist',// 运行时生成的生产环境构建文件的目录(默认''dist'',构建之前会被清除)
assetsDir: 'static',//放置生成的静态资源(s、css、img、fonts)的(相对于 outputDir 的)目录(默认'')
// 过滤掉打包会报错的插件依赖
transpileDependencies: ['vue-echarts', 'resize-detector', 'resize-detector',
'vue-quill-editor',
'quill-image-drop-module'],
devServer: {
port: 8080,
proxy: {
// 配置跨域
'/api': {
target: 'http://10.94.1.164:7060', // 服务器
changeOrigin: true,
},
// 请求静态图片配置项
'/api/home/pic': {
target: 'http://10.94.1.164:7061', // 图片请求的nginx网址
changeOrigin: true
}
// publicPath: '/mi',
outputDir: 'dist', // 运行时生成的生产环境构建文件的目录(默认''dist'',构建之前会被清除)
assetsDir: 'static', // 放置生成的静态资源(s、css、img、fonts)的(相对于 outputDir 的)目录(默认'')
// 过滤掉打包会报错的插件依赖
transpileDependencies: ['vue-echarts', 'resize-detector', 'resize-detector',
'vue-quill-editor',
'quill-image-drop-module'],
devServer: {
port: 8080,
proxy: {
// 配置跨域
'/api': {
target: 'http://10.94.1.164:7060', // 服务器
changeOrigin: true
},
// 请求静态图片配置项
'/api/home/pic': {
target: 'http://10.94.1.164:7061', // 图片请求的nginx网址
changeOrigin: true
}
}
},
chainWebpack: config => {
config.plugin('html').tap(args => {
args[0].title = '大众'
return args
})
},
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
// externals: {
// 'AMap': 'AMap' // 高德地图配置
// },
// name: name,
// devtool: 'source-map',
// resolve: {
// alias: {
// '@': resolve('src')
// }
// },
plugins: [
new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js',
'Quill': 'quill/dist/quill.js'
// Enumerable: "linq"
})
]
},
}
},
chainWebpack: config => {
config.plugin('html').tap(args => {
args[0].title = '大众'
return args
})
},
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
// externals: {
// 'AMap': 'AMap' // 高德地图配置
// },
// name: name,
// devtool: 'source-map',
// resolve: {
// alias: {
// '@': resolve('src')
// }
// },
plugins: [
new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js',
Quill: 'quill/dist/quill.js'
// Enumerable: "linq"
})
]
}
}