调整前端代码格式符合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 = { module.exports = {
presets: [ presets: [
'@vue/cli-plugin-babel/preset' '@vue/cli-plugin-babel/preset'
], ]
} }
+10
View File
@@ -5,6 +5,7 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"vueui": "vue ui" "vueui": "vue ui"
}, },
"dependencies": { "dependencies": {
@@ -33,10 +34,19 @@
"xe-utils": "^3.4.0" "xe-utils": "^3.4.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~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": "^1.43.4",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
+56 -58
View File
@@ -5,65 +5,65 @@
</div> </div>
</template> </template>
<script> <script>
import {loading} from "./utils/request"; import { loading } from './utils/request'
export default { export default {
name: "ReportManager", name: 'ReportManager',
data() { data () {
return {} return {}
}, },
methods: { methods: {
getQueryVariable(r, variable) { getQueryVariable (r, variable) {
if (r) { if (r) {
var query = r.split('?'); const query = r.split('?')
if (query && query.length == 2) { if (query && query.length == 2) {
var vars = query[1].split("&"); const vars = query[1].split('&')
for (var i = 0; i < vars.length; i++) { for (let i = 0; i < vars.length; i++) {
var pair = vars[i].split("="); const pair = vars[i].split('=')
if (pair[0] == variable) { if (pair[0] == variable) {
return pair[1]; 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('/');
// // }
// }
} }
}
},
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> </script>
<style lang="scss"> <style lang="scss">
@@ -118,7 +118,6 @@
height: 24px !important; height: 24px !important;
} }
/* =============================================== 页面加载 =============================================== */ /* =============================================== 页面加载 =============================================== */
.el-loading-mask.is-fullscreen { .el-loading-mask.is-fullscreen {
z-index: 8888 !important; z-index: 8888 !important;
@@ -311,7 +310,6 @@
} }
} }
/* =============================================== search-tag =============================================== */ /* =============================================== search-tag =============================================== */
.search-tag { .search-tag {
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0) !important; 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 资源(拥有的对象) * @param source 资源(拥有的对象)
* @returns {target} 合并后的对象 * @returns {target} 合并后的对象
*/ */
function assignObj(target, source) { function assignObj (target, source) {
if (typeof (target) !== 'object' || typeof (source) !== 'object') { if (typeof (target) !== 'object' || typeof (source) !== 'object') {
return source; return source
} }
for (let key in source) { for (const key in source) {
target[key] = assignObj(target[key], source[key]); target[key] = assignObj(target[key], source[key])
} }
return target; return target
} }
/** /**
@@ -21,15 +21,15 @@ function assignObj(target, source) {
* @type {{install(): *|{}}} Vue.use默认执行的方法 * @type {{install(): *|{}}} Vue.use默认执行的方法
*/ */
export default { export default {
install() { install () {
Vue.prototype.$api = {} Vue.prototype.$api = {}
const requireComponents = require.context('./modules', true, /\.js/) const requireComponents = require.context('./modules', true, /\.js/)
requireComponents.keys().forEach(file => { requireComponents.keys().forEach(file => {
const mod = requireComponents(file); const mod = requireComponents(file)
let fileName = file.replace(/\.\/|\.js/g, ''); let fileName = file.replace(/\.\/|\.js/g, '')
fileName = fileName.split('/').map(item => item.replace(/\./g, '_')).reverse().reduce((p, c) => ({[c]: p}), mod.default); fileName = fileName.split('/').map(item => item.replace(/\./g, '_')).reverse().reduce((p, c) => ({ [c]: p }), mod.default)
Vue.prototype.$api = assignObj(Vue.prototype.$api, fileName) Vue.prototype.$api = assignObj(Vue.prototype.$api, fileName)
}) })
return Vue.prototype.$api 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 { export default {
// 登录 // 登录
login(data) { login (data) {
return request({ return request({
url: `/api/login`, url: '/api/login',
method: 'post', method: 'post',
data data
}) })
}, },
// 长按ticket登录 // 长按ticket登录
// loginByTicket(data) { // loginByTicket(data) {
// return request({ // return request({
// url: `/api/cas/validateLogin?service=`+data.service+'&ticket='+data.ticket, // url: `/api/cas/validateLogin?service=`+data.service+'&ticket='+data.ticket,
// method: 'get' // method: 'get'
// }) // })
// }, // },
pageLog(data) { pageLog (data) {
return request({ return request({
url: `/api/log/log/save?accessPage=`+data, url: '/api/log/log/save?accessPage=' + data,
method: 'get' method: 'get'
}) })
}, },
// 获取验证码 // 获取验证码
verifyCode(data) { verifyCode (data) {
return request({ return request({
url: `/api/verifyCode`, url: '/api/verifyCode',
method: 'get', method: 'get',
params: data, params: data,
responseType: 'arraybuffer' responseType: 'arraybuffer'
}) })
}, },
// 退出登录 // 退出登录
logout(data) { logout (data) {
return request({ return request({
url: `/api/logout`, url: '/api/logout',
method: 'get', method: 'get',
param: data, 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 { export default {
// 查询菜单 // 查询菜单
sysMenuFindAllMenus(data) { sysMenuFindAllMenus (data) {
return request({ return request({
url: `/api/sys/menu/findAllMenus`, url: '/api/sys/menu/findAllMenus',
method: 'GET', method: 'GET',
params: data params: data
}) })
}, },
// 新增 // 新增
postSysMenu(data) { postSysMenu (data) {
return request({ return request({
url: `/api/sys/menu`, url: '/api/sys/menu',
method: 'POST', method: 'POST',
data data
}) })
}, },
// 删除 // 删除
sysMenuDeleteId(data) { sysMenuDeleteId (data) {
return request({ return request({
url: `/api/sys/menu/${data.ids}`, url: `/api/sys/menu/${data.ids}`,
method: 'DELETE', method: 'DELETE'
}) })
}, },
// 修改 // 修改
putSysMenu(data) { putSysMenu (data) {
return request({ return request({
url: `/api/sys/menu`, url: '/api/sys/menu',
method: 'PUT', method: 'PUT',
data data
}) })
}, },
// 角色对应的菜单 // 角色对应的菜单
getSysMenu(data) { getSysMenu (data) {
return request({ return request({
url: `/api/sys/menu`, url: '/api/sys/menu',
method: 'GET', method: 'GET',
params: data params: data
}) })
}, }
} }
+127 -127
View File
@@ -1,132 +1,132 @@
import {instance as request} from "@/utils/request"; import { instance as request } from '@/utils/request'
export function reportUploadPicFile(data){ export function reportUploadPicFile (data) {
return request({ return request({
url: `/api/report/uploadPicFile`, url: '/api/report/uploadPicFile',
method: 'POST', method: 'POST',
data, data,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
}) })
} }
export default { export default {
// 日志列表 // 日志列表
reportLogList(data){ reportLogList (data) {
return request({ return request({
url: `/api/reportLog/list`, url: '/api/reportLog/list',
method: 'GET', method: 'GET',
params: data params: data
}) })
}, },
// 标签管理 // 标签管理
labelAdd(data){ labelAdd (data) {
return request({ return request({
url: `/api/label/add`, url: '/api/label/add',
method: 'POST', method: 'POST',
data data
}) })
}, },
// 标签列表 // 标签列表
labelList(data){ labelList (data) {
return request({ return request({
url: `/api/label/list`, url: '/api/label/list',
method: 'GET', method: 'GET',
params: data params: data
}) })
}, },
// 标签删除|单个 // 标签删除|单个
labelDeleteId(data){ labelDeleteId (data) {
return request({ return request({
url: `/api/label/delete/${data.id}`, url: `/api/label/delete/${data.id}`,
method: 'POST', method: 'POST'
}) })
}, },
// 新增或编辑报告 // 新增或编辑报告
reportAdd(data){ reportAdd (data) {
return request({ return request({
url: `/api/report/add`, url: '/api/report/add',
method: 'POST', method: 'POST',
data data
}) })
}, },
// 详情||上传文件 // 详情||上传文件
reportUploadFile(data){ reportUploadFile (data) {
return request({ return request({
url: `/api/report/uploadFile`, url: '/api/report/uploadFile',
method: 'POST', method: 'POST',
data, data,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
}) })
}, },
// 获取报告预览 // 获取报告预览
reportGetReportHtmlId(data){ reportGetReportHtmlId (data) {
return request({ return request({
url: `/api/report/getReportHtml/${data.id}`, url: `/api/report/getReportHtml/${data.id}`,
method: 'GET', method: 'GET'
}) })
}, },
// 删除报告 // 删除报告
reportDelete(data){ reportDelete (data) {
return request({ return request({
url: `/api/report/delete`, url: '/api/report/delete',
method: 'POST', method: 'POST',
params: data, params: data
}) })
}, },
// 报告列表 // 报告列表
reportList(data){ reportList (data) {
return request({ return request({
url: `/api/report/list`, url: '/api/report/list',
method: 'POST', method: 'POST',
data, data
}) })
}, },
// 获取报告日期列表 // 获取报告日期列表
reportDateList(data){ reportDateList (data) {
return request({ return request({
url: `/api/report/reportDateList`, url: '/api/report/reportDateList',
method: 'GET', method: 'GET',
params: data, params: data
}) })
}, },
// 标签批量保存 // 标签批量保存
labelSave(data){ labelSave (data) {
return request({ return request({
url: `/api/label/save`, url: '/api/label/save',
method: 'POST', method: 'POST',
data, data
}) })
}, },
// 下载文件 // 下载文件
reportDownload(data){ reportDownload (data) {
return request({ return request({
url: `/api/report/download`, url: '/api/report/download',
method: 'GET', method: 'GET',
params: data, params: data,
responseType: 'blob' responseType: 'blob'
}) })
}, },
// 上传图片 // 上传图片
reportUploadPicFile(data){ reportUploadPicFile (data) {
return request({ return request({
url: `/api/report/uploadPicFile`, url: '/api/report/uploadPicFile',
method: 'POST', method: 'POST',
data, data,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
}) })
}, },
// 标签顺序 // 标签顺序
labelMove(data){ labelMove (data) {
return request({ return request({
url: `/api/label/move`, url: '/api/label/move',
method: 'POST', method: 'POST',
params: data, 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 { export default {
// 列表 // 列表
getSysRole(data){ getSysRole (data) {
return request({ return request({
url: `/api/sys/role`, url: '/api/sys/role',
method: 'GET', method: 'GET',
params: data params: data
}) })
}, },
// 删除 // 删除
delSysRole(data){ delSysRole (data) {
return request({ return request({
url: `/api/sys/role/${data.id}`, url: `/api/sys/role/${data.id}`,
method: 'DELETE', method: 'DELETE'
}) })
}, },
// 新增
// 新增 postSysRole (data) {
postSysRole(data){ return request({
return request({ url: '/api/sys/role',
url: `/api/sys/role`, method: 'POST',
method: 'POST', data
data })
}) },
}, // 修改
// 修改 putSysRole (data) {
putSysRole(data){ return request({
return request({ url: '/api/sys/role',
url: `/api/sys/role`, method: 'PUT',
method: 'PUT', data
data })
}) },
}, // 配置角色菜单
// 配置角色菜单 sysRoleSaveRoleMenu (data) {
sysRoleSaveRoleMenu(data){ return request({
return request({ url: '/api/sys/role/saveRoleMenu',
url: `/api/sys/role/saveRoleMenu`, method: 'POST',
method: 'POST', data
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 { export default {
// 新增|编辑 // 新增|编辑
sysUserAddUser(data){ sysUserAddUser (data) {
return request({ return request({
url: `/api/sys/user/addUser`, url: '/api/sys/user/addUser',
method: 'POST', method: 'POST',
data data
}) })
}, },
// 用户启用或禁用 // 用户启用或禁用
sysUserIsUse(data){ sysUserIsUse (data) {
return request({ return request({
url: `/api/sys/user/isUse/${data.USID}/${data.type}`, url: `/api/sys/user/isUse/${data.USID}/${data.type}`,
method: 'POST', method: 'POST'
}) })
}, },
// 获取所有用户 // 获取所有用户
sysUserList(data){ sysUserList (data) {
return request({ return request({
url: `/api/sys/user/list`, url: '/api/sys/user/list',
method: 'GET', method: 'GET',
params: data params: data
}) })
}, },
// 删除用户 // 删除用户
sysUserDelete(data){ sysUserDelete (data) {
return request({ return request({
url: `/api/sys/user/delete`, url: '/api/sys/user/delete',
method: 'POST', method: 'POST',
params: data 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> </template>
<script> <script>
import {v4 as uuidv4} from "uuid"; import { v4 as uuidv4 } from 'uuid'
import vuedraggable from 'vuedraggable' import vuedraggable from 'vuedraggable'
export default { export default {
name: "Demo", name: 'Demo',
components: { components: {
vuedraggable 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 { handleWeekChange (val) {
option1: { const date = `${new Date(val).getFullYear()}-${new Date(val).getMonth() + 1}-${new Date(val).getDate()}`
xAxis: {
type: "category", const firstTime = new Date(date).getTime() - 24 * 60 * 60 * 1000
data: [], this.startDate = `${new Date(firstTime).getFullYear()}-${new Date(firstTime).getMonth() + 1}-${new Date(firstTime).getDate()}`
},
yAxis: { const lastTime = new Date(date).getTime() + 5 * 24 * 60 * 60 * 1000
type: "value", this.endDate = `${new Date(lastTime).getFullYear()}-${new Date(lastTime).getMonth() + 1}-${new Date(lastTime).getDate()}`
},
series: [ const year = require('moment')(val).utcOffset('+08:00').format('yyyy')
{ const week = require('moment')(val).utcOffset('+08:00').format('WW')
data: [], this.year_week = `${year}${week}`
type: "scatter", },
symbolSize: function (data) { // Api
return data[1] / 2.5; exFun () {
}, console.log(require('moment'))
}, this.$api.ex
], .exFun()
}, .then((res) => {
sortData: [ console.log(res)
{id: uuidv4(), name: 'Mon', value: 150}, })
{id: uuidv4(), name: 'Tue', value: 230}, .catch((err) => {
{id: uuidv4(), name: 'Wed', value: 224}, console.log(err)
{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){
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) { // vue-echarts
let date = `${new Date(val).getFullYear()}-${new Date(val).getMonth() + 1}-${new Date(val).getDate()}`; changeOption () {
this.option.series[0].type = 'bar'
},
let firstTime = new Date(date).getTime() - 24 * 60 * 60 * 1000; // el-scrollbar
this.startDate = `${new Date(firstTime).getFullYear()}-${new Date(firstTime).getMonth() + 1}-${new Date(firstTime).getDate()}`; scrollChange () {
this.max =
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 =
this.$refs.scrollbar.wrap.scrollHeight - this.$refs.scrollbar.wrap.scrollHeight -
this.$refs.scrollbar.wrap.clientHeight; this.$refs.scrollbar.wrap.clientHeight
this.$refs.scrollbar.wrap.onscroll = (e) => { this.$refs.scrollbar.wrap.onscroll = (e) => {
this.value = e.target.scrollTop; this.value = e.target.scrollTop
}; }
}, },
formatTooltip(value) { formatTooltip (value) {
this.$refs.scrollbar.wrap.scrollTop = value; this.$refs.scrollbar.wrap.scrollTop = value
}, },
// VXETable // VXETable
getTableData() { getTableData () {
this.$nextTick(() => { this.$nextTick(() => {
const $table = this.$refs.xTable; const $table = this.$refs.xTable
const list = []; const list = []
for (let index = 0; index < 50; index++) { for (let index = 0; index < 50; index++) {
list.push({ list.push({
name: `名称${index}`, name: `名称${index}`,
sex: "0", sex: '0',
num: 123, num: 123,
age: 18, age: 18,
num2: 234, num2: 234,
rate: 3, rate: 3,
address: "shenzhen", address: 'shenzhen'
}); })
} }
$table.loadData(list); $table.loadData(list)
}); })
}, },
// vuex-persistedstate // vuex-persistedstate
saveUserInfo() { saveUserInfo () {
// this.$store.commit("saveUserInfo", {name: "Lee"}); // this.$store.commit("saveUserInfo", {name: "Lee"});
}, }
}, },
created() { created () {
console.log("created"); console.log('created')
}, },
mounted() { mounted () {
this.scrollChange(); this.scrollChange()
this.getTableData(); this.getTableData()
console.log("mounted"); console.log('mounted')
}, },
updated(){ updated () {
// 修改统计顺序 // 修改统计顺序
this.option1.xAxis.data = this.sortData.map(item => item.name); this.option1.xAxis.data = this.sortData.map(item => item.name)
this.option1.series[0].data = this.sortData.map(item => [item.name, item.value]); this.option1.series[0].data = this.sortData.map(item => [item.name, item.value])
}, },
// 进入组件执行 仅在keep-alive时起作用 // 进入组件执行 仅在keep-alive时起作用
activated() { activated () {
this.$refs.scrollbar.wrap.scrollTop = this.value; this.$refs.scrollbar.wrap.scrollTop = this.value
console.log("activated"); console.log('activated')
}, },
// 离开组件执行 仅在keep-alive时起作用 // 离开组件执行 仅在keep-alive时起作用
deactivated() { deactivated () {
console.log("deactivated"); console.log('deactivated')
}, }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+275 -275
View File
@@ -5,304 +5,304 @@
<script> <script>
import * as echarts from 'echarts/lib/echarts' import * as echarts from 'echarts/lib/echarts'
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
import {addListener, removeListener} from 'resize-detector' import { addListener, removeListener } from 'resize-detector'
// enumerating ECharts events for now // enumerating ECharts events for now
const EVENTS = [ const EVENTS = [
'legendselectchanged', 'legendselectchanged',
'legendselected', 'legendselected',
'legendunselected', 'legendunselected',
'legendscroll', 'legendscroll',
'datazoom', 'datazoom',
'datarangeselected', 'datarangeselected',
'timelinechanged', 'timelinechanged',
'timelineplaychanged', 'timelineplaychanged',
'restore', 'restore',
'dataviewchanged', 'dataviewchanged',
'magictypechanged', 'magictypechanged',
'geoselectchanged', 'geoselectchanged',
'geoselected', 'geoselected',
'geounselected', 'geounselected',
'pieselectchanged', 'pieselectchanged',
'pieselected', 'pieselected',
'pieunselected', 'pieunselected',
'mapselectchanged', 'mapselectchanged',
'mapselected', 'mapselected',
'mapunselected', 'mapunselected',
'axisareaselected', 'axisareaselected',
'focusnodeadjacency', 'focusnodeadjacency',
'unfocusnodeadjacency', 'unfocusnodeadjacency',
'brush', 'brush',
'brushselected', 'brushselected',
'rendered', 'rendered',
'finished', 'finished',
'click', 'click',
'dblclick', 'dblclick',
'mouseover', 'mouseover',
'mouseout', 'mouseout',
'mousemove', 'mousemove',
'mousedown', 'mousedown',
'mouseup', 'mouseup',
'globalout', 'globalout',
'contextmenu' 'contextmenu'
] ]
const ZR_EVENTS = [ const ZR_EVENTS = [
'click', 'click',
'mousedown', 'mousedown',
'mouseup', 'mouseup',
'mousewheel', 'mousewheel',
'dblclick', 'dblclick',
'contextmenu' 'contextmenu'
] ]
const INIT_TRIGGERS = ['theme', 'initOptions', 'autoresize'] const INIT_TRIGGERS = ['theme', 'initOptions', 'autoresize']
const REWATCH_TRIGGERS = ['manualUpdate', 'watchShallow'] const REWATCH_TRIGGERS = ['manualUpdate', 'watchShallow']
export default { export default {
props: { props: {
options: Object, options: Object,
theme: [String, Object], theme: [String, Object],
initOptions: Object, initOptions: Object,
group: String, group: String,
autoresize: Boolean, autoresize: Boolean,
watchShallow: Boolean, watchShallow: Boolean,
manualUpdate: 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() { // just delegates ECharts methods to Vue component
return { // use explicit params to reduce transpiled size for now
lastArea: 0 appendData (params) {
} this.delegateMethod('appendData', params)
}, },
watch: { resize (options) {
group(group) { this.delegateMethod('resize', options)
this.chart.group = group
},
}, },
methods: { dispatchAction (payload) {
// provide an explicit merge option method this.delegateMethod('dispatchAction', payload)
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()
}
}
}, },
created() { convertToPixel (finder, value) {
this.initOptionsWatcher() 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 => { const chart = echarts.init(this.$el, this.theme, this.initOptions)
this.$watch(prop, () => {
this.refresh() if (this.group) {
}, {deep: true}) 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 => { ZR_EVENTS.forEach(event => {
this.$watch(prop, () => { chart.getZr().on(event, params => {
this.initOptionsWatcher() this.$emit(`zr:${event}`, params)
this.refresh()
})
}) })
})
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() { initOptionsWatcher () {
// auto init if `options` is already provided if (this.__unwatchOptions) {
if (this.options) { this.__unwatchOptions()
this.__unwatchOptions = null
}
if (!this.manualUpdate) {
this.__unwatchOptions = this.$watch('options', (val, oldVal) => {
if (!this.chart && val) {
this.init() 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() { destroy () {
if (this.autoresize) { if (this.autoresize) {
this.chart && this.chart.resize() removeListener(this.$el, this.__resizeHandler)
} }
this.dispose()
this.chart = null
}, },
destroyed() { refresh () {
if (this.chart) { if (this.chart) {
this.destroy() this.destroy()
} this.init()
}, }
connect(group) { }
if (typeof group !== 'string') { },
group = group.map(chart => chart.chart) created () {
} this.initOptionsWatcher()
echarts.connect(group)
}, INIT_TRIGGERS.forEach(prop => {
disconnect(group) { this.$watch(prop, () => {
echarts.disConnect(group) this.refresh()
}, }, { deep: true })
registerMap(mapName, geoJSON, specialAreas) { })
echarts.registerMap(mapName, geoJSON, specialAreas)
}, REWATCH_TRIGGERS.forEach(prop => {
registerTheme(name, theme) { this.$watch(prop, () => {
echarts.registerTheme(name, theme) this.initOptionsWatcher()
}, this.refresh()
graphic: echarts.graphic })
})
},
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> </script>
+56 -56
View File
@@ -44,64 +44,64 @@
</template> </template>
<script> <script>
import {mapGetters} from 'vuex'; import { mapGetters } from 'vuex'
import {BASE_URL} from "../utils/http"; import { BASE_URL } from '../utils/http'
export default { export default {
name: "Header", name: 'Header',
data() { data () {
return { return {
popoverValue: false 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'}});
}
}
}
}
} }
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+45 -46
View File
@@ -44,54 +44,54 @@
</template> </template>
<script> <script>
import {createLogger} from 'vuex'; import { createLogger } from 'vuex'
import MenuItem from "./MenuItem"; import MenuItem from './MenuItem'
import login from '../api/modules/login' import login from '../api/modules/login'
import store from '../store' import store from '../store'
export default { export default {
name: "Menu", name: 'Menu',
props: ["menuData", "path"], props: ['menuData', 'path'],
components: { components: {
MenuItem MenuItem
}, },
methods: { methods: {
handleRouter(item) { handleRouter (item) {
if(item.belong == 0){ if (item.belong == 0) {
this.$store.commit('saveMenuName', item.label); this.$store.commit('saveMenuName', item.label)
if(this.$route.path == '/system/401Page'){ if (this.$route.path == '/system/401Page') {
}else{ } else {
this.$router.push({name: '401Page', query: this.$route.query}); 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.$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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -175,7 +175,6 @@
} }
} }
.icon-level2 { .icon-level2 {
display: inline-block; display: inline-block;
width: 3px; width: 3px;
+2 -2
View File
@@ -4,8 +4,8 @@
<script> <script>
export default { export default {
name: "MenuItem", name: 'MenuItem',
props: ['menuItemData'] props: ['menuItemData']
} }
</script> </script>
+145 -146
View File
@@ -32,152 +32,151 @@
</template> </template>
<script> <script>
export default { export default {
data() { data () {
return { return {
clicked: '', clicked: '',
options: [], options: [],
wordList: [ wordList: [
'A', 'A',
'B', 'B',
'C', 'C',
'D', 'D',
'E', 'E',
'F', 'F',
'G', 'G',
'H', 'H',
'I', 'I',
'J', 'J',
'K', 'K',
'L', 'L',
'M', 'M',
'N', 'N',
'O', 'O',
'P', 'P',
'Q', 'Q',
'R', 'R',
'S', 'S',
'T', 'T',
'U', 'U',
'V', 'V',
'W', 'W',
'X', 'X',
'Y', 'Y',
'Z' 'Z'
], ],
dialogVisible: false 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
}
}
} }
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -253,4 +252,4 @@
height: auto; height: auto;
line-height: 17px; line-height: 17px;
} }
</style> </style>
+11 -11
View File
@@ -1,17 +1,17 @@
import Vue from "vue"; import Vue from 'vue'
/** /**
* 获取API * 获取API
* @type {{install(): *|{}}} Vue.use默认执行的方法 * @type {{install(): *|{}}} Vue.use默认执行的方法
*/ */
export default { export default {
install() { install () {
const requireComponents = require.context('./modules', false, /\.js/); const requireComponents = require.context('./modules', false, /\.js/)
requireComponents.keys().forEach(file => { requireComponents.keys().forEach(file => {
const directives = requireComponents(file).default; const directives = requireComponents(file).default
for (const directive in directives) { for (const directive in directives) {
Vue.directive(directive, directives[directive]); Vue.directive(directive, directives[directive])
} }
}); })
} }
}; }
@@ -1,11 +1,11 @@
import Vue from "vue"; import Vue from 'vue'
export default { export default {
tableMinHeight: { tableMinHeight: {
// 指令的定义 // 指令的定义
inserted(el, binding, vnode) { inserted (el, binding, vnode) {
let dom = el.getElementsByClassName('vxe-table--body-wrapper body--wrapper').item(0); const dom = el.getElementsByClassName('vxe-table--body-wrapper body--wrapper').item(0)
dom.style.setProperty('min-height', binding.value, 'important') 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 * 获取API
* @type {{install(): *|{}}} Vue.use默认执行的方法 * @type {{install(): *|{}}} Vue.use默认执行的方法
*/ */
export default { export default {
install() { install () {
const requireComponents = require.context('./modules', false, /\.js/); const requireComponents = require.context('./modules', false, /\.js/)
requireComponents.keys().forEach(file => { requireComponents.keys().forEach(file => {
const filters = requireComponents(file).default; const filters = requireComponents(file).default
for (const filter in filters) { for (const filter in filters) {
Vue.filter(filter, filters[filter]); Vue.filter(filter, filters[filter])
} }
}); })
} }
}; }
+7 -7
View File
@@ -1,9 +1,9 @@
export default { export default {
formatDate: function (value) { formatDate: function (value) {
let date = new Date(value); const date = new Date(value)
let y = date.getFullYear(); const y = date.getFullYear()
let m = date.getMonth() + 1; const m = date.getMonth() + 1
let d = date.getDate(); const d = date.getDate()
return `${y}/${m}/${d}`; return `${y}/${m}/${d}`
} }
} }
+31 -31
View File
@@ -3,17 +3,17 @@ import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
import config from "@/utils/config"; import config from '@/utils/config'
// VXETable // VXETable
import 'xe-utils' import 'xe-utils'
import VXETable from 'vxe-table' import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css' import 'vxe-table/lib/style.css'
// ElementUI // ElementUI
import ElementUI from 'element-ui'; import ElementUI from 'element-ui'
import './assets/css/element-variables.scss' import './assets/css/element-variables.scss'
// ECharts // ECharts
import 'echarts' import 'echarts'
import ECharts from './components/ECharts'; import ECharts from './components/ECharts'
// Api // Api
import Api from './api' import Api from './api'
@@ -24,52 +24,52 @@ import Filter from './filters'
// 自定义水印指令 // 自定义水印指令
import '@/utils/waterMark' import '@/utils/waterMark'
// 加密函数 // 加密函数
import JSEncrypt from '../src/assets/js/jsencrypt.min.js'; import JSEncrypt from '../src/assets/js/jsencrypt.min.js'
VXETable.setup({
table: {
resizable: true,
}
})
Vue.use(VXETable);
// 富文本引用 // 富文本引用
import VueQuillEditor from 'vue-quill-editor' import VueQuillEditor from 'vue-quill-editor'
// require styles 引入样式 // require styles 引入样式
import 'quill/dist/quill.core.css' import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css' import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css' import 'quill/dist/quill.bubble.css'
VXETable.setup({
table: {
resizable: true
}
})
Vue.use(VXETable)
Vue.use(VueQuillEditor) Vue.use(VueQuillEditor)
Vue.use(ElementUI, {size: 'mini', zIndex: 3000}); Vue.use(ElementUI, { size: 'mini', zIndex: 3000 })
Vue.component('v-chart', ECharts); Vue.component('v-chart', ECharts)
Vue.use(Api); Vue.use(Api)
Vue.use(Directive); Vue.use(Directive)
Vue.use(Filter); Vue.use(Filter)
Vue.prototype.$JSEncrypt = (data) => { Vue.prototype.$JSEncrypt = (data) => {
if(data === ''){ if (data === '') {
return ''; return ''
} }
let encryptor = new JSEncrypt(); const encryptor = new JSEncrypt()
encryptor.setPublicKey(config.PUBLIC_KEY); encryptor.setPublicKey(config.PUBLIC_KEY)
return encryptor.encrypt(data) || ''; return encryptor.encrypt(data) || ''
} }
VXETable.renderer.add('NotData', { VXETable.renderer.add('NotData', {
// 空内容模板 // 空内容模板
renderEmpty (h, renderOpts) { renderEmpty (h, renderOpts) {
return [ return [
<span> <span>
<img width="100" src={require('./assets/imgs/icon-nodata.png')}/> <img width="100" src={require('./assets/imgs/icon-nodata.png')}/>
<p style="margin-top: 10px;">暂无数据</p> <p style="margin-top: 10px;">暂无数据</p>
</span> </span>
] ]
} }
}) })
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({
router, router,
store, store,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')
+58 -58
View File
@@ -2,80 +2,80 @@ import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import store from '../store' import store from '../store'
import login from '../api/modules/login' import login from '../api/modules/login'
import {BASE_URL} from "../utils/http" import { BASE_URL } from '../utils/http'
Vue.use(VueRouter) Vue.use(VueRouter)
let routes = []; let routes = []
const requireComponents = require.context('./modules', false, /\.js/); const requireComponents = require.context('./modules', false, /\.js/)
requireComponents.keys().forEach(file => routes = [...routes, ...requireComponents(file).default]); requireComponents.keys().forEach(file => routes = [...routes, ...requireComponents(file).default])
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes, routes,
scrollBehavior(to, from, position) { scrollBehavior (to, from, position) {
return position; return position
}, }
}) })
// 路由守卫 // 路由守卫
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
/** /**
* 仅报告价格板块 * 仅报告价格板块
* 报告板块 http://10.10.1.184:8080/#/report/list?id=XBFBR7UADZ * 报告板块 http://10.10.1.184:8080/#/report/list?id=XBFBR7UADZ
* 价格板块 http://10.10.1.184:8080/#/overall/opricetrend?id=SBME88VTUD * 价格板块 http://10.10.1.184:8080/#/overall/opricetrend?id=SBME88VTUD
*/ */
// store.commit('saveUserInfo', {}); // store.commit('saveUserInfo', {});
// store.commit('saveMenuData', menuTree); // store.commit('saveMenuData', menuTree);
// var url = BASE_URL.BASE_LOCAL + '/login?loginType=1' // var url = BASE_URL.BASE_LOCAL + '/login?loginType=1'
// var loginUrl = BASE_URL.BASE_CHANGAN + "/login?service=" + url; // var loginUrl = BASE_URL.BASE_CHANGAN + "/login?service=" + url;
// var logoutUrl = BASE_URL.BASE_CHANGAN + "/logout?service=" + url // var logoutUrl = BASE_URL.BASE_CHANGAN + "/logout?service=" + url
if (to.meta.crumb) { if (to.meta.crumb) {
var jumpStr = to.meta.crumb.join('/') const jumpStr = to.meta.crumb.join('/')
if(jumpStr){ if (jumpStr) {
if (jumpStr == 'urlIndex' && to.path != '/system/401Page') { if (jumpStr == 'urlIndex' && to.path != '/system/401Page') {
login.pageLog(store.state.menuName).then(res => { login.pageLog(store.state.menuName).then(res => {
}).catch(_ => { }).catch(_ => {
}) })
}else{ } else {
login.pageLog(jumpStr).then(res => { login.pageLog(jumpStr).then(res => {
}).catch(_ => { }).catch(_ => {
}) })
} }
}
} }
// debugger }
// if (to.query.loginType) { // debugger
// if (to.query.loginType == 1 && to.query.ticket) { // if (to.query.loginType) {
// var params = { // if (to.query.loginType == 1 && to.query.ticket) {
// service: url, // var params = {
// ticket: to.query.ticket // service: url,
// } // ticket: to.query.ticket
// login.loginByTicket(params).then(res => { // }
// if (res.respCode !== '0') { // login.loginByTicket(params).then(res => {
// // this.verifyCode(); // if (res.respCode !== '0') {
// // return this.$message.error(res.data.message); // // this.verifyCode();
// } // // return this.$message.error(res.data.message);
// // this.$message.success('登录成功'); // }
// store.commit('saveUserInfo', res.data); // // this.$message.success('登录成功');
// next('/home'); // store.commit('saveUserInfo', res.data);
// }).catch(_ => { // next('/home');
// window.open(logoutUrl, '_self'); // }).catch(_ => {
// }) // window.open(logoutUrl, '_self');
// } else { // })
// window.open(loginUrl, '_self'); // } else {
// } // window.open(loginUrl, '_self');
// } else if (to.path.toLowerCase() !== '/login') { // }
// if (!store.state.userInfo) { // } else if (to.path.toLowerCase() !== '/login') {
// window.open(logoutUrl, '_self'); // if (!store.state.userInfo) {
// } // window.open(logoutUrl, '_self');
// next(); // }
// } else { // next();
next(); // } else {
// } next()
// }
}) })
export default router export default router
+51 -50
View File
@@ -1,53 +1,54 @@
const routes = [ const routes = [
{ {
path: '/system', path: '/system',
name: '', name: '',
component: () => import('../../views/Layout.vue'), component: () => import('../../views/Layout.vue'),
children: [ children: [
{ {
path: 'urlIndex', path: 'urlIndex',
name: 'urlIndex', name: 'urlIndex',
component: () => import('../../views/System/urlIndex.vue'), component: () => import('../../views/System/urlIndex.vue'),
meta: { meta: {
crumb: ['urlIndex'], crumb: ['urlIndex']
}
}]},
{
path: '/',
redirect: {
name: 'Login'
// path: '/report/list?id=XBFBR7UADZ'
} }
}, }]
// 登录 },
{ {
path: '/login', path: '/',
name: 'Login', redirect: {
component: () => import('../../views/Login.vue') name: 'Login'
}, // path: '/report/list?id=XBFBR7UADZ'
// // 注册 }
// { },
// path: '/register', // 登录
// name: 'Register', {
// component: () => import('../../views/Register.vue') path: '/login',
// }, name: 'Login',
// 首页 component: () => import('../../views/Login.vue')
// { },
// path: '/home', // // 注册
// name: 'Home', // {
// component: () => import('../../views/Home.vue') // path: '/register',
// }, // name: 'Register',
{ // component: () => import('../../views/Register.vue')
path: '/layout', // },
name: 'LayoutBox', // 首页
component: () => import('../../views/Layout.vue') // {
}, // path: '/home',
// // Demo // name: 'Home',
// { // component: () => import('../../views/Home.vue')
// path: '/demo', // },
// name: 'Demo', {
// component: () => import('../../components/Demo.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 = [ const routes = [
// 报告管理 // 报告管理
{ {
path: '/report', path: '/report',
name: 'Layout', name: 'Layout',
component: () => import('../../views/Layout.vue'), component: () => import('../../views/Layout.vue'),
children: [ children: [
// 报告列表 // 报告列表
{ {
path: 'list', path: 'list',
name: 'ReportList', name: 'ReportList',
component: () => import('../../views/Report/ReportList.vue'), component: () => import('../../views/Report/ReportList.vue'),
meta: { meta: {
crumb: ['报告列表'], crumb: ['报告列表']
} }
}, },
// 报告详情 // 报告详情
{ {
path: 'detail', path: 'detail',
name: 'ReportDetail', name: 'ReportDetail',
component: () => import('../../views/Report/ReportDetail.vue'), component: () => import('../../views/Report/ReportDetail.vue'),
meta: { meta: {
crumb: ['报告详情'], crumb: ['报告详情']
} }
}, },
// 报告管理 // 报告管理
{ {
path: '/report/manager', path: '/report/manager',
name: 'ReportManager', name: 'ReportManager',
component: () => import('../../views/Report/ReportManager.vue'), component: () => import('../../views/Report/ReportManager.vue'),
meta: { meta: {
crumb: ['报告管理'], crumb: ['报告管理']
} }
}, }
] ]
}, }
]; ]
export default routes; export default routes
+63 -63
View File
@@ -1,65 +1,65 @@
const routes = [ const routes = [
// 系统管理 // 系统管理
{ {
path: '/system', path: '/system',
name: '', name: '',
component: () => import('../../views/Layout.vue'), component: () => import('../../views/Layout.vue'),
children: [ children: [
// 菜单管理 // 菜单管理
{ {
path: 'menu', path: 'menu',
name: 'MenuManager', name: 'MenuManager',
component: () => import('../../views/System/MenuManager.vue'), component: () => import('../../views/System/MenuManager.vue'),
meta: { meta: {
crumb: ['菜单管理'], crumb: ['菜单管理']
} }
}, },
// 用户管理 // 用户管理
{ {
path: 'user', path: 'user',
name: 'User', name: 'User',
component: () => import('../../views/System/User.vue'), component: () => import('../../views/System/User.vue'),
meta: { meta: {
crumb: ['用户管理'], crumb: ['用户管理']
} }
}, },
// 角色管理 // 角色管理
{ {
path: 'role', path: 'role',
name: 'Role', name: 'Role',
component: () => import('../../views/System/Role.vue'), component: () => import('../../views/System/Role.vue'),
meta: { meta: {
crumb: ['角色管理'], crumb: ['角色管理']
} }
}, },
// // 角色管理 // // 角色管理
// { // {
// path: 'mail', // path: 'mail',
// name: 'Mail', // name: 'Mail',
// component: () => import('../../views/System/mail.vue'), // component: () => import('../../views/System/mail.vue'),
// meta: { // meta: {
// crumb: ['邮件管理'], // crumb: ['邮件管理'],
// } // }
// }, // },
// // 角色管理 // // 角色管理
// { // {
// path: 'notification', // path: 'notification',
// name: 'Notification', // name: 'Notification',
// component: () => import('../../views/System/notification.vue'), // component: () => import('../../views/System/notification.vue'),
// meta: { // meta: {
// crumb: ['通知管理'], // crumb: ['通知管理'],
// } // }
// }, // },
{ {
path: '401Page', path: '401Page',
name: '401Page', name: '401Page',
component: () => import('../../views/System/401Page.vue'), component: () => import('../../views/System/401Page.vue'),
meta: { meta: {
crumb: ['暂无权限'], crumb: ['暂无权限']
} }
}, }
] ]
}, }
]; ]
export default routes; export default routes
+32 -32
View File
@@ -5,39 +5,39 @@ import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex) Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
userInfo: null, userInfo: null,
isLoading: false, isLoading: false,
rememberData: null, rememberData: null,
menuData: [], menuData: [],
pathUrl: '', pathUrl: '',
menuName: '', menuName: ''
},
getters: {
menuData: (state) => state.menuData,
menuName: (state) => state.menuName
},
mutations: {
saveUserInfo (state, data) {
state.userInfo = data
}, },
getters: { saveIsLoading (state, data) {
menuData: (state) => state.menuData, state.isLoading = data
menuName: (state) => state.menuName,
}, },
mutations: { saveRememberData (state, data) {
saveUserInfo(state, data) { state.rememberData = 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;
},
}, },
actions: {}, saveMenuData (state, data) {
modules: {}, state.menuData = data
plugins: [createPersistedState()] },
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 { 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 * @param fmt
* @returns {*} * @returns {*}
*/ */
export function formatDate(value, fmt) { export function formatDate (value, fmt) {
let regPos = /^\d+(\.\d+)?$/ const regPos = /^\d+(\.\d+)?$/
if (regPos.test(value)) { if (regPos.test(value)) {
//如果是数字 // 如果是数字
let getDate = new Date(value) const getDate = new Date(value)
let o = { const o = {
'M+': getDate.getMonth() + 1, 'M+': getDate.getMonth() + 1,
'd+': getDate.getDate(), 'd+': getDate.getDate(),
'h+': getDate.getHours(), 'h+': getDate.getHours(),
'm+': getDate.getMinutes(), 'm+': getDate.getMinutes(),
's+': getDate.getSeconds(), 's+': getDate.getSeconds(),
'q+': Math.floor((getDate.getMonth() + 3) / 3), 'q+': Math.floor((getDate.getMonth() + 3) / 3),
'S': getDate.getMilliseconds() S: getDate.getMilliseconds()
} }
if (/(y+)/.test(fmt)) { if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length)) fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
} }
for (let k in o) { for (const k in o) {
if (new RegExp('(' + k + ')').test(fmt)) { if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
} }
} }
return fmt return fmt
} else { } else {
value = value.trim() value = value.trim()
return value.substr(0, fmt.length) 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) => { export const downloadFile = (res) => {
let file_name = decodeURI(res.headers["content-disposition"]).split('=').pop(); const file_name = decodeURI(res.headers['content-disposition']).split('=').pop()
let file_type = file_name.split('.').pop(); const file_type = file_name.split('.').pop()
let blobData = new Blob([res.data], {type: fileType[file_type]}); const blobData = new Blob([res.data], { type: fileType[file_type] })
let downloadUrl = window.URL.createObjectURL(blobData); const downloadUrl = window.URL.createObjectURL(blobData)
let anchor = document.createElement("a"); const anchor = document.createElement('a')
anchor.href = downloadUrl; anchor.href = downloadUrl
anchor.download = file_name; anchor.download = file_name
anchor.click(); anchor.click()
window.URL.revokeObjectURL(blobData); window.URL.revokeObjectURL(blobData)
} }
+11 -11
View File
@@ -1,13 +1,13 @@
export const fileType = { export const fileType = {
pdf: 'application/pdf', pdf: 'application/pdf',
xls: 'application/vnd.ms-excel', xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
doc: 'application/msword', doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
ppt: 'application/vnd.ms-powerpoint', ppt: 'application/vnd.ms-powerpoint',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
png: 'image/png', png: 'image/png',
jpg: 'image/jpeg', jpg: 'image/jpeg',
rar: 'application/x-rar', rar: 'application/x-rar',
zip: 'application/zip', zip: 'application/zip'
} }
+10 -10
View File
@@ -1,15 +1,15 @@
export const BASE_URL = { export const BASE_URL = {
// LOGIN_URL : "http://192.168.144.29:9090/cas/login?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", // 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_CHANGAN:'http://192.168.144.29:9090/cas',
BASE_LOCAL:'http://127.0.0.1:8080', BASE_LOCAL: 'http://127.0.0.1:8080',
BASE_LOCAL_IMG:'http://127.0.0.1:8080', BASE_LOCAL_IMG: 'http://127.0.0.1:8080'
// //企业测试 // //企业测试
// BASE_CHANGAN:'https://caddmuat.changan.com.cn/cas', // BASE_CHANGAN:'https://caddmuat.changan.com.cn/cas',
// BASE_LOCAL:'https://caddmuat.changan.com.cn/mi', // BASE_LOCAL:'https://caddmuat.changan.com.cn/mi',
// BASE_LOCAL_IMG:'https://caddmuat.changan.com.cn', // 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 { class lineHeightAttributor extends Parchment.Attributor.Style {
} }
const lineHeightStyle = new lineHeightAttributor("lineHeight", "line-height", { const lineHeightStyle = new lineHeightAttributor('lineHeight', 'line-height', {
scope: Parchment.Scope.INLINE, scope: Parchment.Scope.INLINE,
whitelist: ["initial", "1", "1.5", "1.75", "2", "3", "4"] 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 axios from 'axios'
import {Message, Loading} from 'element-ui'; import { Message, Loading } from 'element-ui'
import store from '../store'; import store from '../store'
import router from "../router"; import router from '../router'
import {BASE_URL} from "../utils/http"; import { BASE_URL } from '../utils/http'
// 记录请求个数、加载 // 记录请求个数、加载
let count = 0, loading = null; let count = 0; let loading = null
// axios实例化 // axios实例化
const instance = axios.create({ const instance = axios.create({
baseURL: '/library', baseURL: '/library',
// timeout: 60000, // timeout: 60000,
headers: { headers: {
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
'Pragma': 'no-cache' Pragma: 'no-cache'
} }
}); })
// 添加请求拦截器 // 添加请求拦截器
instance.interceptors.request.use(function (config) { instance.interceptors.request.use(function (config) {
// 在发送请求之前做些什么 // 在发送请求之前做些什么
loading = Loading.service(null); loading = Loading.service(null)
count++; count++
store.commit('saveIsLoading', true); store.commit('saveIsLoading', true)
return config; return config
}, function (error) { }, function (error) {
// 对请求错误做些什么 // 对请求错误做些什么
count--; count--
if (count < 1) { if (count < 1) {
loading.close(); loading.close()
store.commit('saveIsLoading', false); store.commit('saveIsLoading', false)
} }
Message.error(error); Message.error(error)
return Promise.reject(error); return Promise.reject(error)
}); })
// 添加响应拦截器 // 添加响应拦截器
instance.interceptors.response.use(function (response) { instance.interceptors.response.use(function (response) {
// 对响应数据做点什么 // 对响应数据做点什么
count--; count--
if (count < 1) { if (count < 1) {
loading.close(); loading.close()
store.commit('saveIsLoading', false); store.commit('saveIsLoading', false)
} }
// 登录超时 // 登录超时
if (response.data.respCode === '401') { if (response.data.respCode === '401') {
store.commit('saveUserInfo', null); store.commit('saveUserInfo', null)
router.push('/login'); router.push('/login')
Message.error('登录超时过期'); Message.error('登录超时过期')
// var url = 'http://192.168.144.22:9966/login?loginType=1' // var url = 'http://192.168.144.22:9966/login?loginType=1'
// // var url = 'http://10.64.23.30:7766/home' // // 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('http://192.168.144.29:9090/cas/login?service='+url, '_self');
// return window.open('https://caddmuat.changan.com.cn/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'); // window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
} }
// 请求成功 // 请求成功
if (response.status === 200) { if (response.status === 200) {
if (response.data.respCode === "0") { if (response.data.respCode === '0') {
return response.data; return response.data
} else if (response.data.respCode === "-1") { } else if (response.data.respCode === '-1') {
Message.error(response.data.message); Message.error(response.data.message)
return Promise.reject(response); 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);
} else { } 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)'}" * v-watermark="{text: '水印名称', textColor: 'rgba(100, 100, 100, 0.6)'}"
*/ */
Vue.directive('watermark', { 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 elementContains = (parent, child) => parent !== child && parent.contains(child)
const flag = elementContains(parentNode, document.querySelector('canvas')) const flag = elementContains(parentNode, document.querySelector('canvas'))
// 防止重复创建 // 防止重复创建
if (!flag) { if (!flag) {
let can = document.createElement('canvas') const can = document.createElement('canvas')
parentNode.appendChild(can) parentNode.appendChild(can)
can.width = width || 300 can.width = width || 300
can.height = height || 140 can.height = height || 140
can.style.display = 'none' can.style.display = 'none'
let cans = can.getContext('2d') const cans = can.getContext('2d')
cans.rotate(-20 * Math.PI / 180) cans.rotate(-20 * Math.PI / 180)
cans.font = font || '13px Microsoft Yahei' cans.font = font || '13px Microsoft Yahei'
cans.fillStyle = textColor || 'rgba(100, 100, 100, 0.2)' cans.fillStyle = textColor || 'rgba(100, 100, 100, 0.2)'
@@ -31,7 +31,7 @@ Vue.directive('watermark', {
// parentNode.style.backgroundImage = "url(" + can.toDataURL("image/png") + ")"; // parentNode.style.backgroundImage = "url(" + can.toDataURL("image/png") + ")";
// 创建div 定位覆盖(某个元素,如图片添加水印建议使用此方法) // 创建div 定位覆盖(某个元素,如图片添加水印建议使用此方法)
let div = document.createElement('div') const div = document.createElement('div')
div.id = str div.id = str
div.className = 'waterMark' div.className = 'waterMark'
div.style.pointerEvents = 'none' div.style.pointerEvents = 'none'
+105 -107
View File
@@ -20,115 +20,113 @@
</template> </template>
<script> <script>
import Header from '@/components/Header'; import Header from '@/components/Header'
import Menu from '@/components/Menu'; import Menu from '@/components/Menu'
export default { export default {
name: "Layout", name: 'Layout',
components: { components: {
Header, Header,
Menu Menu
}, },
data() { data () {
return { return {
menuData: [] 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();
// }
}
} }
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+84 -83
View File
@@ -37,91 +37,92 @@
</template> </template>
<script> <script>
import {Base64} from "js-base64"; import { Base64 } from 'js-base64'
export default { export default {
name: "Login", name: 'Login',
data() { data () {
return { return {
form: { form: {
username: '', username: '',
password: '', password: '',
verifyCode: '', verifyCode: ''
}, },
verifyImg: '', verifyImg: '',
isChecked: false, 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), ''))}`
})
},
}
} }
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+1 -1
View File
@@ -6,7 +6,7 @@
<script> <script>
export default { export default {
name: "Register" name: 'Register'
} }
</script> </script>
+40 -40
View File
@@ -32,48 +32,48 @@
</template> </template>
<script> <script>
import {downloadFile} from "@/utils/downloadFile"; import { downloadFile } from '@/utils/downloadFile'
import {formatDate} from '@/utils/date' import { formatDate } from '@/utils/date'
export default { export default {
name: "ReportDetail", name: 'ReportDetail',
data(){ data () {
return { return {
watermarkText: '', // 水印 watermarkText: '', // 水印
content: '', content: '',
row: {}, 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();
}
} }
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+170 -170
View File
@@ -163,180 +163,180 @@
</template> </template>
<script> <script>
import {downloadFile} from "@/utils/downloadFile"; import { downloadFile } from '@/utils/downloadFile'
import {formatDate} from '@/utils/date' import { formatDate } from '@/utils/date'
export default { export default {
name: "ReportList", name: 'ReportList',
data() { data () {
return { return {
watermarkText: '', // 水印 watermarkText: '', // 水印
fullscreen: false, fullscreen: false,
q: { q: {
keyContent: '', keyContent: '',
year: [], year: [],
labelOneId: [], labelOneId: [],
labelTwoId: [], labelTwoId: [],
labelThreeId: [], labelThreeId: [],
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
}, },
total: 0, total: 0,
tableData: [], tableData: [],
yearList: [], yearList: [],
tagData: { tagData: {
1: { 1: {
name: '', name: '',
tagShow: false, tagShow: false,
tags: [], tags: [],
isIndeterminate: true, isIndeterminate: true,
checkAll: false, checkAll: false
}, },
2: { 2: {
name: '', name: '',
tagShow: false, tagShow: false,
tags: [], tags: [],
isIndeterminate: true, isIndeterminate: true,
checkAll: false, checkAll: false
}, },
3: { 3: {
name: '', name: '',
tagShow: false, tagShow: false,
tags: [], tags: [],
isIndeterminate: true, isIndeterminate: true,
checkAll: false, checkAll: false
},
},
dialogPreview: false, // 预览
content: '',
} }
}, },
methods: { dialogPreview: false, // 预览
init() { content: ''
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();
} }
},
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> </script>
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -5,13 +5,13 @@
</template> </template>
<script> <script>
export default { export default {
name: 'Page401', name: 'Page401',
data() { data () {
return {} return {}
}, },
methods: {} methods: {}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+150 -152
View File
@@ -87,158 +87,158 @@
</template> </template>
<script> <script>
import {fileType} from "@/utils/fileType"; import { fileType } from '@/utils/fileType'
export default { export default {
name: "MenuManager", name: 'MenuManager',
data() { data () {
return { return {
form: { form: {
name: '', // 名称 name: '', // 名称
href: '', // 路径 href: '', // 路径
icon: '', // 图标 icon: '', // 图标
iconHref: '', // 图标路径 iconHref: '', // 图标路径
sort: '', // 排序 sort: '', // 排序
remarks: '', // 描述 remarks: '', // 描述
id: '', id: '',
parentId: '', parentId: '',
isUrl: 0, isUrl: 0
}, },
tableData: [], tableData: [],
dialogMenu: false, dialogMenu: false,
mode: '', mode: '',
pathList: [], pathList: [],
level: 0, 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();
}
} }
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -324,7 +324,6 @@
// margin-left: -1.5px; // margin-left: -1.5px;
// } // }
.menu-image { .menu-image {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -434,7 +433,6 @@
} }
} }
.icon-menu-text { .icon-menu-text {
display: flex; display: flex;
width: 36px; width: 36px;
+184 -184
View File
@@ -80,192 +80,192 @@
</template> </template>
<script> <script>
import {v4 as uuidv4} from 'uuid'; import { v4 as uuidv4 } from 'uuid'
export default { export default {
name: "Role", name: 'Role',
data() { data () {
return { return {
tableData: [], // 角色列表 tableData: [], // 角色列表
dialogRole: false, dialogRole: false,
mode: '', mode: '',
form: { form: {
rname: '', rname: '',
rdesc: '', rdesc: '',
rid: '' rid: ''
}, },
dialogPermission: false, dialogPermission: false,
treeData: [], treeData: [],
checkboxConfig: { checkboxConfig: {
checkRowKeys: [], checkRowKeys: [],
checkStrictly: true checkStrictly: true
}, },
roleId: '', roleId: '',
tableKey: uuidv4(), tableKey: uuidv4()
// isHomePage: null, // 配置首页 1首页 2权限 // 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();
} }
},
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> </script>
+231 -232
View File
@@ -123,244 +123,243 @@
</template> </template>
<script> <script>
import {Base64} from "js-base64"; import { Base64 } from 'js-base64'
export default { export default {
name: "User", name: 'User',
data() { data () {
return { return {
q: { q: {
account: '', // 用户名 account: '', // 用户名
roleName: '', // 角色名称 roleName: '', // 角色名称
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
}, },
total: 0, total: 0,
tableData: [], tableData: [],
mode: '', mode: '',
dialogUser: false, dialogUser: false,
form: { form: {
account: '', // 用户名 account: '', // 用户名
cellPhoneNumber: '', // 手机号 cellPhoneNumber: '', // 手机号
department: '', // 部门 department: '', // 部门
email: '', // 邮箱 email: '', // 邮箱
password: '', // 密码 password: '', // 密码
usid: '', usid: '',
usname: '', // 姓名 usname: '', // 姓名
roleIdList: [''], // 角色 roleIdList: [''] // 角色
}, },
repassword: '', repassword: '',
roleList: [], 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();
} }
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.system-user { .system-user {
.title { .title {
+28 -29
View File
@@ -7,37 +7,37 @@
<script> <script>
export default { export default {
name: "MenuManager", name: 'MenuManager',
data() { data () {
return { return {
url: '' url: ''
} }
}, },
methods: {}, methods: {},
computed: {}, computed: {},
created() { created () {
this.url = this.$store.state.pathUrl this.url = this.$store.state.pathUrl
}, },
mounted() { mounted () {
/** /**
* iframe-宽高自适应显示 * iframe-宽高自适应显示
*/ */
function changeMobsfIframe() { function changeMobsfIframe () {
const mobsf = document.getElementById('mobsf'); const mobsf = document.getElementById('mobsf')
const deviceWidth = document.body.clientWidth; const deviceWidth = document.body.clientWidth
const deviceHeight = document.body.clientHeight; const deviceHeight = document.body.clientHeight
mobsf.style.width = '100%'; //数字是页面布局宽度差值 mobsf.style.width = '100%' // 数字是页面布局宽度差值
mobsf.style.height = (Number(deviceHeight) - 86) + 'px'; //数字是页面布局高度差 mobsf.style.height = (Number(deviceHeight) - 86) + 'px' // 数字是页面布局高度差
}
changeMobsfIframe()
window.onresize = function () {
changeMobsfIframe()
}
}
} }
changeMobsfIframe()
window.onresize = function () {
changeMobsfIframe()
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -225,7 +225,6 @@
} }
} }
.icon-menu-text { .icon-menu-text {
display: flex; display: flex;
width: 36px; width: 36px;
+49 -49
View File
@@ -1,53 +1,53 @@
const webpack = require('webpack') const webpack = require('webpack')
module.exports = { module.exports = {
// publicPath: '/mi', // publicPath: '/mi',
outputDir: 'dist',// 运行时生成的生产环境构建文件的目录(默认''dist'',构建之前会被清除) outputDir: 'dist', // 运行时生成的生产环境构建文件的目录(默认''dist'',构建之前会被清除)
assetsDir: 'static',//放置生成的静态资源(s、css、img、fonts)的(相对于 outputDir 的)目录(默认'') assetsDir: 'static', // 放置生成的静态资源(s、css、img、fonts)的(相对于 outputDir 的)目录(默认'')
// 过滤掉打包会报错的插件依赖 // 过滤掉打包会报错的插件依赖
transpileDependencies: ['vue-echarts', 'resize-detector', 'resize-detector', transpileDependencies: ['vue-echarts', 'resize-detector', 'resize-detector',
'vue-quill-editor', 'vue-quill-editor',
'quill-image-drop-module'], 'quill-image-drop-module'],
devServer: { devServer: {
port: 8080, port: 8080,
proxy: { proxy: {
// 配置跨域 // 配置跨域
'/api': { '/api': {
target: 'http://10.94.1.164:7060', // 服务器 target: 'http://10.94.1.164:7060', // 服务器
changeOrigin: true, changeOrigin: true
}, },
// 请求静态图片配置项 // 请求静态图片配置项
'/api/home/pic': { '/api/home/pic': {
target: 'http://10.94.1.164:7061', // 图片请求的nginx网址 target: 'http://10.94.1.164:7061', // 图片请求的nginx网址
changeOrigin: true changeOrigin: true
} }
} }
}, },
chainWebpack: config => { chainWebpack: config => {
config.plugin('html').tap(args => { config.plugin('html').tap(args => {
args[0].title = '大众' args[0].title = '大众'
return args return args
}) })
}, },
configureWebpack: { configureWebpack: {
// provide the app's title in webpack's name field, so that // provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title. // it can be accessed in index.html to inject the correct title.
// externals: { // externals: {
// 'AMap': 'AMap' // 高德地图配置 // 'AMap': 'AMap' // 高德地图配置
// }, // },
// name: name, // name: name,
// devtool: 'source-map', // devtool: 'source-map',
// resolve: { // resolve: {
// alias: { // alias: {
// '@': resolve('src') // '@': resolve('src')
// } // }
// }, // },
plugins: [ plugins: [
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js', 'window.Quill': 'quill/dist/quill.js',
'Quill': 'quill/dist/quill.js' Quill: 'quill/dist/quill.js'
// Enumerable: "linq" // Enumerable: "linq"
}) })
] ]
}, }
} }