调整前端代码格式符合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'
}
}
+1 -1
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"
+17 -19
View File
@@ -5,35 +5,35 @@
</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() { closeLoading () {
loading.close(); loading.close()
this.$store.commit('saveIsLoading', false); this.$store.commit('saveIsLoading', false)
}
}, },
}, created () {
created() { const _that = this
let _that = this
// var path = window.location.search // var path = window.location.search
// var ticket = this.getQueryVariable(path, 'ticket') // var ticket = this.getQueryVariable(path, 'ticket')
// var loginType = this.getQueryVariable(path, 'loginType') // var loginType = this.getQueryVariable(path, 'loginType')
@@ -63,7 +63,7 @@
// // } // // }
// } // }
} }
} }
</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;
+11 -11
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
} }
}; }
+11 -11
View File
@@ -1,10 +1,10 @@
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
}) })
@@ -16,27 +16,27 @@ export default {
// 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
}) })
}, }
} }
+12 -13
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
}) })
}, }
} }
+37 -37
View File
@@ -1,7 +1,7 @@
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: {
@@ -11,49 +11,49 @@ export function reportUploadPicFile(data){
} }
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: {
@@ -62,58 +62,58 @@ export default {
}) })
}, },
// 获取报告预览 // 获取报告预览
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: {
@@ -122,11 +122,11 @@ export default {
}) })
}, },
// 标签顺序 // 标签顺序
labelMove(data){ labelMove (data) {
return request({ return request({
url: `/api/label/move`, url: '/api/label/move',
method: 'POST', method: 'POST',
params: data, params: data
}) })
}, }
} }
+12 -13
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
}) })
}, }
} }
+10 -10
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
+89 -89
View File
@@ -88,75 +88,75 @@
</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() { data () {
return { return {
option1: { option1: {
xAxis: { xAxis: {
type: "category", type: 'category',
data: [], data: []
}, },
yAxis: { yAxis: {
type: "value", type: 'value'
}, },
series: [ series: [
{ {
data: [], data: [],
type: "scatter", type: 'scatter',
symbolSize: function (data) { symbolSize: function (data) {
return data[1] / 2.5; return data[1] / 2.5
}, }
}, }
], ]
}, },
sortData: [ sortData: [
{id: uuidv4(), name: 'Mon', value: 150}, { id: uuidv4(), name: 'Mon', value: 150 },
{id: uuidv4(), name: 'Tue', value: 230}, { id: uuidv4(), name: 'Tue', value: 230 },
{id: uuidv4(), name: 'Wed', value: 224}, { id: uuidv4(), name: 'Wed', value: 224 },
{id: uuidv4(), name: 'Thu', value: 218}, { id: uuidv4(), name: 'Thu', value: 218 },
{id: uuidv4(), name: 'Fri', value: 135}, { id: uuidv4(), name: 'Fri', value: 135 },
{id: uuidv4(), name: 'Sat', value: 147}, { id: uuidv4(), name: 'Sat', value: 147 },
{id: uuidv4(), name: 'Sun', value: 260}, { id: uuidv4(), name: 'Sun', value: 260 }
], ],
week: "", week: '',
year_week: "", year_week: '',
startDate: "", startDate: '',
endDate: "", endDate: '',
option: { option: {
xAxis: { xAxis: {
type: "category", type: 'category',
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}, },
yAxis: { yAxis: {
type: "value", type: 'value'
}, },
series: [ series: [
{ {
data: [150, 230, 224, 218, 135, 147, 260], data: [150, 230, 224, 218, 135, 147, 260],
type: "line", type: 'line'
}, }
], ]
}, },
max: 0, max: 0,
value: 0, value: 0,
q: { q: {
page: 1, page: 1,
size: 20, size: 20,
total: 200, total: 200
}, },
uuid: uuidv4(), uuid: uuidv4(),
tableHeader: [ tableHeader: [
{ field: 'a', title: '2020-01'}, { field: 'a', title: '2020-01' },
{ field: 'b', title: '2020-02'}, { field: 'b', title: '2020-02' },
{ field: 'c', title: '2020-03'}, { field: 'c', title: '2020-03' },
{ field: 'd', title: '2020-04'}, { field: 'd', title: '2020-04' }
], ],
treeData: [ treeData: [
{ id: 10000, parentId: null, a: 'Test1', b: '1111', c: '222', d: '3333' }, { id: 10000, parentId: null, a: 'Test1', b: '1111', c: '222', d: '3333' },
@@ -170,112 +170,112 @@ export default {
{ id: 20004, 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: 30000, parentId: null, a: 'Test3', b: '1111', c: '222', d: '3333' },
{ id: 30001, parentId: 30000, 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' }, { id: 40000, parentId: null, a: 'Test4', b: '1111', c: '222', d: '3333' }
], ]
}; }
}, },
methods: { methods: {
handleTree(arr){ handleTree (arr) {
let cloneData = JSON.parse(JSON.stringify(arr)) // 对源数据深度克隆 const cloneData = JSON.parse(JSON.stringify(arr)) // 对源数据深度克隆
return cloneData.filter((father) => { return cloneData.filter((father) => {
let branchArr = cloneData.filter(child => father.id == child.parentId); //返回每一项的子级数组 const branchArr = cloneData.filter(child => father.id == child.parentId) // 返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null; //如果存在子级,则给父级添加一个children属性,并赋值 father.children = branchArr.length > 0 ? branchArr : null // 如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId == -1; //返回第一层 return father.parentId == -1 // 返回第一层
}) })
}, },
handleWeekChange(val) { handleWeekChange (val) {
let date = `${new Date(val).getFullYear()}-${new Date(val).getMonth() + 1}-${new Date(val).getDate()}`; const date = `${new Date(val).getFullYear()}-${new Date(val).getMonth() + 1}-${new Date(val).getDate()}`
let firstTime = new Date(date).getTime() - 24 * 60 * 60 * 1000; const firstTime = new Date(date).getTime() - 24 * 60 * 60 * 1000
this.startDate = `${new Date(firstTime).getFullYear()}-${new Date(firstTime).getMonth() + 1}-${new Date(firstTime).getDate()}`; this.startDate = `${new Date(firstTime).getFullYear()}-${new Date(firstTime).getMonth() + 1}-${new Date(firstTime).getDate()}`
let lastTime = new Date(date).getTime() + 5 * 24 * 60 * 60 * 1000; const lastTime = new Date(date).getTime() + 5 * 24 * 60 * 60 * 1000
this.endDate = `${new Date(lastTime).getFullYear()}-${new Date(lastTime).getMonth() + 1}-${new Date(lastTime).getDate()}`; 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"); const year = require('moment')(val).utcOffset('+08:00').format('yyyy')
let week = require("moment")(val).utcOffset("+08:00").format("WW"); const week = require('moment')(val).utcOffset('+08:00').format('WW')
this.year_week = `${year}${week}`; this.year_week = `${year}${week}`
}, },
// Api // Api
exFun() { exFun () {
console.log(require("moment")); console.log(require('moment'))
this.$api.ex this.$api.ex
.exFun() .exFun()
.then((res) => { .then((res) => {
console.log(res); console.log(res)
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, },
// vue-echarts // vue-echarts
changeOption() { changeOption () {
this.option.series[0].type = "bar"; this.option.series[0].type = 'bar'
}, },
// el-scrollbar // el-scrollbar
scrollChange() { scrollChange () {
this.max = 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 () {
console.log('created')
}, },
created() { mounted () {
console.log("created"); this.scrollChange()
this.getTableData()
console.log('mounted')
}, },
mounted() { updated () {
this.scrollChange();
this.getTableData();
console.log("mounted");
},
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>
+36 -36
View File
@@ -5,7 +5,7 @@
<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 = [
@@ -69,19 +69,19 @@ export default {
watchShallow: Boolean, watchShallow: Boolean,
manualUpdate: Boolean manualUpdate: Boolean
}, },
data() { data () {
return { return {
lastArea: 0 lastArea: 0
} }
}, },
watch: { watch: {
group(group) { group (group) {
this.chart.group = group this.chart.group = group
}, }
}, },
methods: { methods: {
// provide an explicit merge option method // provide an explicit merge option method
mergeOptions(options, notMerge, lazyUpdate) { mergeOptions (options, notMerge, lazyUpdate) {
if (this.manualUpdate) { if (this.manualUpdate) {
this.manualOptions = options this.manualOptions = options
} }
@@ -94,63 +94,63 @@ export default {
}, },
// just delegates ECharts methods to Vue component // just delegates ECharts methods to Vue component
// use explicit params to reduce transpiled size for now // use explicit params to reduce transpiled size for now
appendData(params) { appendData (params) {
this.delegateMethod('appendData', params) this.delegateMethod('appendData', params)
}, },
resize(options) { resize (options) {
this.delegateMethod('resize', options) this.delegateMethod('resize', options)
}, },
dispatchAction(payload) { dispatchAction (payload) {
this.delegateMethod('dispatchAction', payload) this.delegateMethod('dispatchAction', payload)
}, },
convertToPixel(finder, value) { convertToPixel (finder, value) {
return this.delegateMethod('convertToPixel', finder, value) return this.delegateMethod('convertToPixel', finder, value)
}, },
convertFromPixel(finder, value) { convertFromPixel (finder, value) {
return this.delegateMethod('convertFromPixel', finder, value) return this.delegateMethod('convertFromPixel', finder, value)
}, },
containPixel(finder, value) { containPixel (finder, value) {
return this.delegateMethod('containPixel', finder, value) return this.delegateMethod('containPixel', finder, value)
}, },
showLoading(type, options) { showLoading (type, options) {
this.delegateMethod('showLoading', type, options) this.delegateMethod('showLoading', type, options)
}, },
hideLoading() { hideLoading () {
this.delegateMethod('hideLoading') this.delegateMethod('hideLoading')
}, },
getDataURL(options) { getDataURL (options) {
return this.delegateMethod('getDataURL', options) return this.delegateMethod('getDataURL', options)
}, },
getConnectedDataURL(options) { getConnectedDataURL (options) {
return this.delegateMethod('getConnectedDataURL', options) return this.delegateMethod('getConnectedDataURL', options)
}, },
clear() { clear () {
this.delegateMethod('clear') this.delegateMethod('clear')
}, },
dispose() { dispose () {
this.delegateMethod('dispose') this.delegateMethod('dispose')
}, },
delegateMethod(name, ...args) { delegateMethod (name, ...args) {
if (!this.chart) { if (!this.chart) {
this.init() this.init()
} }
return this.chart[name](...args) return this.chart[name](...args)
}, },
delegateGet(methodName) { delegateGet (methodName) {
if (!this.chart) { if (!this.chart) {
this.init() this.init()
} }
return this.chart[methodName]() return this.chart[methodName]()
}, },
getArea() { getArea () {
return this.$el.offsetWidth * this.$el.offsetHeight return this.$el.offsetWidth * this.$el.offsetHeight
}, },
init(options) { init (options) {
if (this.chart) { if (this.chart) {
return return
} }
let chart = echarts.init(this.$el, this.theme, this.initOptions) const chart = echarts.init(this.$el, this.theme, this.initOptions)
if (this.group) { if (this.group) {
chart.group = this.group chart.group = this.group
@@ -183,7 +183,7 @@ export default {
this.resize() this.resize()
} }
this.lastArea = this.getArea() this.lastArea = this.getArea()
}, 100, {leading: true}) }, 100, { leading: true })
addListener(this.$el, this.__resizeHandler) addListener(this.$el, this.__resizeHandler)
} }
@@ -219,7 +219,7 @@ export default {
this.chart = chart this.chart = chart
}, },
initOptionsWatcher() { initOptionsWatcher () {
if (this.__unwatchOptions) { if (this.__unwatchOptions) {
this.__unwatchOptions() this.__unwatchOptions()
this.__unwatchOptions = null this.__unwatchOptions = null
@@ -239,30 +239,30 @@ export default {
// will trigger `this.chart.setOption(val, false)` // will trigger `this.chart.setOption(val, false)`
this.chart.setOption(val, val !== oldVal) this.chart.setOption(val, val !== oldVal)
} }
}, {deep: !this.watchShallow}) }, { deep: !this.watchShallow })
} }
}, },
destroy() { destroy () {
if (this.autoresize) { if (this.autoresize) {
removeListener(this.$el, this.__resizeHandler) removeListener(this.$el, this.__resizeHandler)
} }
this.dispose() this.dispose()
this.chart = null this.chart = null
}, },
refresh() { refresh () {
if (this.chart) { if (this.chart) {
this.destroy() this.destroy()
this.init() this.init()
} }
} }
}, },
created() { created () {
this.initOptionsWatcher() this.initOptionsWatcher()
INIT_TRIGGERS.forEach(prop => { INIT_TRIGGERS.forEach(prop => {
this.$watch(prop, () => { this.$watch(prop, () => {
this.refresh() this.refresh()
}, {deep: true}) }, { deep: true })
}) })
REWATCH_TRIGGERS.forEach(prop => { REWATCH_TRIGGERS.forEach(prop => {
@@ -272,35 +272,35 @@ export default {
}) })
}) })
}, },
mounted() { mounted () {
// auto init if `options` is already provided // auto init if `options` is already provided
if (this.options) { if (this.options) {
this.init() this.init()
} }
}, },
activated() { activated () {
if (this.autoresize) { if (this.autoresize) {
this.chart && this.chart.resize() this.chart && this.chart.resize()
} }
}, },
destroyed() { destroyed () {
if (this.chart) { if (this.chart) {
this.destroy() this.destroy()
} }
}, },
connect(group) { connect (group) {
if (typeof group !== 'string') { if (typeof group !== 'string') {
group = group.map(chart => chart.chart) group = group.map(chart => chart.chart)
} }
echarts.connect(group) echarts.connect(group)
}, },
disconnect(group) { disconnect (group) {
echarts.disConnect(group) echarts.disConnect(group)
}, },
registerMap(mapName, geoJSON, specialAreas) { registerMap (mapName, geoJSON, specialAreas) {
echarts.registerMap(mapName, geoJSON, specialAreas) echarts.registerMap(mapName, geoJSON, specialAreas)
}, },
registerTheme(name, theme) { registerTheme (name, theme) {
echarts.registerTheme(name, theme) echarts.registerTheme(name, theme)
}, },
graphic: echarts.graphic graphic: echarts.graphic
+27 -27
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: { computed: {
...mapGetters({ ...mapGetters({
menuData: 'menuData', menuData: 'menuData'
}), }),
isSystemManager() { isSystemManager () {
return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF'); return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF')
},
isSystemManagerBelong() {
return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF' && menu.belong == 1);
}, },
isSystemManagerBelong () {
return this.menuData.some(menu => menu.id === 'AVL9YSB7ZF' && menu.belong == 1)
}
}, },
methods: { methods: {
// 退出系统 // 退出系统
logout() { logout () {
this.$confirm('确定退出系统?', '提示', { this.$confirm('确定退出系统?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$api.login.logout().then(_ => { this.$api.login.logout().then(_ => {
this.$message.success('退出成功'); this.$message.success('退出成功')
this.$store.commit('saveUserInfo', null); this.$store.commit('saveUserInfo', null)
// var sevice = "http://"+window.location.host+"/"; // var sevice = "http://"+window.location.host+"/";
// var serviceUrl = encodeURIComponent(sevice); // var serviceUrl = encodeURIComponent(sevice);
//正式 // 正式
// window.open("https://caddmuat.changan.com.cn/cas/logout?service=http://10.64.23.30:7766/home", '_self'); // 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'); // window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self');
this.$router.push('/login'); this.$router.push('/login')
}) })
}) })
}, },
goSystemPage() { goSystemPage () {
if(this.isSystemManagerBelong){ if (this.isSystemManagerBelong) {
if (this.$route.path === '/system/menu') return; if (this.$route.path === '/system/menu') return
this.$store.commit('savePathUrl', '/system/menu'); this.$store.commit('savePathUrl', '/system/menu')
this.$router.push({path: '/system/menu', query: {id: 'AVL9YSB7ZF'}}); this.$router.push({ path: '/system/menu', query: { id: 'AVL9YSB7ZF' } })
}else{ } else {
if(this.$route.path == '/system/401Page'){ if (this.$route.path == '/system/401Page') {
}else{ } else {
this.$router.replace({name: '401Page', query: {id: 'AVL9YSB7ZF'}}); this.$router.replace({ name: '401Page', query: { id: 'AVL9YSB7ZF' } })
}
} }
} }
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+27 -28
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{ } else {
this.$store.commit('savePathUrl', item.href); this.$store.commit('savePathUrl', item.href)
if (item.isUrl && Number(item.isUrl || 0)) { if (item.isUrl && Number(item.isUrl || 0)) {
var param = this.$route.query const param = this.$route.query
// delete(this.$route.query.itemHref) // delete(this.$route.query.itemHref)
// param.itemHref = item.href // param.itemHref = item.href
if(this.$route.path == '/system/urlIndex'){ if (this.$route.path == '/system/urlIndex') {
this.$store.commit('saveMenuName', item.label); this.$store.commit('saveMenuName', item.label)
login.pageLog(this.$store.state.menuName).then(res => { login.pageLog(this.$store.state.menuName).then(res => {
}).catch(_ => { }).catch(_ => {
}) })
}else{ } else {
this.$store.commit('saveMenuName', item.label); this.$store.commit('saveMenuName', item.label)
this.$router.push({name: 'urlIndex', query: param}); this.$router.push({ name: 'urlIndex', query: param })
} }
} else { } else {
if (this.$route.path === item.href) return; if (this.$route.path === item.href) return
// delete(this.$route.query.itemHref) // delete(this.$route.query.itemHref)
this.$router.push({path: item.href, query: this.$route.query}); this.$router.push({ path: item.href, query: this.$route.query })
} }
} }
}, },
collageMenu(item) { collageMenu (item) {
item.isCollage = !item.isCollage; item.isCollage = !item.isCollage
console.log(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;
+1 -1
View File
@@ -4,7 +4,7 @@
<script> <script>
export default { export default {
name: "MenuItem", name: 'MenuItem',
props: ['menuItemData'] props: ['menuItemData']
} }
</script> </script>
+20 -21
View File
@@ -32,8 +32,8 @@
</template> </template>
<script> <script>
export default { export default {
data() { data () {
return { return {
clicked: '', clicked: '',
options: [], options: [],
@@ -69,21 +69,21 @@
} }
}, },
props: ['callback'], props: ['callback'],
mounted() { mounted () {
this.getList() this.getList()
this.clicked = '' this.clicked = ''
}, },
methods: { methods: {
changeOpen() { changeOpen () {
this.dialogVisible = !this.dialogVisible this.dialogVisible = !this.dialogVisible
}, },
selectFun(item) { selectFun (item) {
if (this.callback && item.length == 3) { if (this.callback && item.length == 3) {
this.callback(item) this.callback(item)
this.dialogVisible = false this.dialogVisible = false
} }
}, },
getList() { getList () {
this.options = [] this.options = []
this.$api.config.gradient.chooseStyleAdd().then(res => { this.$api.config.gradient.chooseStyleAdd().then(res => {
this.options = this.formatDataFirst(res.data) this.options = this.formatDataFirst(res.data)
@@ -110,20 +110,20 @@
// //
}) })
}, },
formatDataFirst(data) { formatDataFirst (data) {
let list = [] const list = []
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => {
// tag // tag
let d = { const d = {
level: 1, level: 1,
value: key, value: key,
label: key label: key
} }
list.push(d) list.push(d)
// info // info
let info = data[key] const info = data[key]
Object.keys(info).forEach(newkey => { Object.keys(info).forEach(newkey => {
let ib = { const ib = {
level: 1, level: 1,
value: newkey, value: newkey,
label: newkey, label: newkey,
@@ -132,25 +132,24 @@
ib.children = this.formatData(info[newkey]) ib.children = this.formatData(info[newkey])
list.push(ib) list.push(ib)
}) })
})
});
return list return list
}, },
formatData(data) { formatData (data) {
let list = [] const list = []
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => {
let id = data[key] const id = data[key]
let d = { const d = {
level: 2, level: 2,
value: key, value: key,
label: key, label: key,
children: [] children: []
} }
id.forEach(newdata => { id.forEach(newdata => {
let ib = { const ib = {
level: 3, level: 3,
value: newdata, value: newdata,
label: newdata['kxmc'] + (newdata['msrpw'] ? (" " + newdata['msrpw']) : '') + " " + newdata['mix'], label: newdata.kxmc + (newdata.msrpw ? (' ' + newdata.msrpw) : '') + ' ' + newdata.mix,
data: newdata data: newdata
} }
d.children.push(ib) d.children.push(ib)
@@ -161,7 +160,7 @@
return list return list
}, },
goIndex(params) { goIndex (params) {
const groupRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize const groupRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize
const titleRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize.childNodes const titleRef = this.$refs.groupRef.$children[0].$children[0].$refs.resize.childNodes
this.clicked = params this.clicked = params
@@ -177,7 +176,7 @@
// groupRef.scrollTop = offsetTop // groupRef.scrollTop = offsetTop
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+7 -7
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')
}, }
} }
} }
+7 -7
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])
} }
}); })
} }
}; }
+5 -5
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}`
} }
} }
+24 -24
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,34 +24,34 @@ 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'
Vue.use(VueQuillEditor)
Vue.use(ElementUI, {size: 'mini', zIndex: 3000}); VXETable.setup({
Vue.component('v-chart', ECharts); table: {
Vue.use(Api); resizable: true
Vue.use(Directive);
Vue.use(Filter);
Vue.prototype.$JSEncrypt = (data) => {
if(data === ''){
return '';
} }
let encryptor = new JSEncrypt(); })
encryptor.setPublicKey(config.PUBLIC_KEY);
return encryptor.encrypt(data) || ''; Vue.use(VXETable)
Vue.use(VueQuillEditor)
Vue.use(ElementUI, { size: 'mini', zIndex: 3000 })
Vue.component('v-chart', ECharts)
Vue.use(Api)
Vue.use(Directive)
Vue.use(Filter)
Vue.prototype.$JSEncrypt = (data) => {
if (data === '') {
return ''
}
const encryptor = new JSEncrypt()
encryptor.setPublicKey(config.PUBLIC_KEY)
return encryptor.encrypt(data) || ''
} }
VXETable.renderer.add('NotData', { VXETable.renderer.add('NotData', {
+11 -11
View File
@@ -2,22 +2,22 @@ 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
}, }
}) })
// 路由守卫 // 路由守卫
@@ -34,13 +34,13 @@ router.beforeEach((to, from, next) => {
// 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(_ => {
}) })
@@ -74,7 +74,7 @@ router.beforeEach((to, from, next) => {
// } // }
// next(); // next();
// } else { // } else {
next(); next()
// } // }
}) })
+6 -5
View File
@@ -9,9 +9,10 @@ const routes = [
name: 'urlIndex', name: 'urlIndex',
component: () => import('../../views/System/urlIndex.vue'), component: () => import('../../views/System/urlIndex.vue'),
meta: { meta: {
crumb: ['urlIndex'], crumb: ['urlIndex']
} }
}]}, }]
},
{ {
path: '/', path: '/',
redirect: { redirect: {
@@ -41,13 +42,13 @@ const routes = [
path: '/layout', path: '/layout',
name: 'LayoutBox', name: 'LayoutBox',
component: () => import('../../views/Layout.vue') component: () => import('../../views/Layout.vue')
}, }
// // Demo // // Demo
// { // {
// path: '/demo', // path: '/demo',
// name: 'Demo', // name: 'Demo',
// component: () => import('../../components/Demo.vue') // component: () => import('../../components/Demo.vue')
// }, // },
]; ]
export default routes; export default routes
+7 -7
View File
@@ -11,7 +11,7 @@ const routes = [
name: 'ReportList', name: 'ReportList',
component: () => import('../../views/Report/ReportList.vue'), component: () => import('../../views/Report/ReportList.vue'),
meta: { meta: {
crumb: ['报告列表'], crumb: ['报告列表']
} }
}, },
// 报告详情 // 报告详情
@@ -20,7 +20,7 @@ const routes = [
name: 'ReportDetail', name: 'ReportDetail',
component: () => import('../../views/Report/ReportDetail.vue'), component: () => import('../../views/Report/ReportDetail.vue'),
meta: { meta: {
crumb: ['报告详情'], crumb: ['报告详情']
} }
}, },
// 报告管理 // 报告管理
@@ -29,11 +29,11 @@ const routes = [
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
+8 -8
View File
@@ -11,7 +11,7 @@ const routes = [
name: 'MenuManager', name: 'MenuManager',
component: () => import('../../views/System/MenuManager.vue'), component: () => import('../../views/System/MenuManager.vue'),
meta: { meta: {
crumb: ['菜单管理'], crumb: ['菜单管理']
} }
}, },
// 用户管理 // 用户管理
@@ -20,7 +20,7 @@ const routes = [
name: 'User', name: 'User',
component: () => import('../../views/System/User.vue'), component: () => import('../../views/System/User.vue'),
meta: { meta: {
crumb: ['用户管理'], crumb: ['用户管理']
} }
}, },
// 角色管理 // 角色管理
@@ -29,7 +29,7 @@ const routes = [
name: 'Role', name: 'Role',
component: () => import('../../views/System/Role.vue'), component: () => import('../../views/System/Role.vue'),
meta: { meta: {
crumb: ['角色管理'], crumb: ['角色管理']
} }
}, },
// // 角色管理 // // 角色管理
@@ -55,11 +55,11 @@ const routes = [
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
+15 -15
View File
@@ -11,31 +11,31 @@ export default new Vuex.Store({
rememberData: null, rememberData: null,
menuData: [], menuData: [],
pathUrl: '', pathUrl: '',
menuName: '', menuName: ''
}, },
getters: { getters: {
menuData: (state) => state.menuData, menuData: (state) => state.menuData,
menuName: (state) => state.menuName, menuName: (state) => state.menuName
}, },
mutations: { mutations: {
saveUserInfo(state, data) { saveUserInfo (state, data) {
state.userInfo = data; state.userInfo = data
}, },
saveIsLoading(state, data){ saveIsLoading (state, data) {
state.isLoading = data; state.isLoading = data
}, },
saveRememberData(state, data){ saveRememberData (state, data) {
state.rememberData = data; state.rememberData = data
}, },
saveMenuData(state, data){ saveMenuData (state, data) {
state.menuData = data; state.menuData = data
}, },
savePathUrl(state, data){ savePathUrl (state, data) {
state.pathUrl = data; state.pathUrl = data
},
saveMenuName(state, data){
state.menuName = data;
}, },
saveMenuName (state, data) {
state.menuName = data
}
}, },
actions: {}, actions: {},
modules: {}, modules: {},
+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'
} }
+7 -7
View File
@@ -4,24 +4,24 @@
* @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)))
} }
+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)
} }
+1 -1
View File
@@ -9,5 +9,5 @@ export const fileType = {
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'
} }
+3 -3
View File
@@ -2,10 +2,10 @@ 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',
+6 -6
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 }
+44 -45
View File
@@ -1,11 +1,11 @@
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({
@@ -13,41 +13,41 @@ const instance = axios.create({
// 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'
// //
@@ -58,32 +58,31 @@ instance.interceptors.response.use(function (response) {
// 请求成功 // 请求成功
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 { } else {
return response; return response
} }
} else { // 请求失败 } else { // 请求失败
Message.error(response.data.message); Message.error(response.data.message)
return Promise.reject(response); return Promise.reject(response)
} }
}, function (error) { }, function (error) {
// 对响应错误做点什么 // 对响应错误做点什么
count--; count--
if (count < 1) { if (count < 1) {
loading.close(); loading.close()
store.commit('saveIsLoading', false); store.commit('saveIsLoading', false)
} }
// 登录过期 // 登录过期
if (error.response.status === 401) { if (error.response.status === 401) {
store.commit('saveUserInfo', null); store.commit('saveUserInfo', null)
router.push('/login'); router.push('/login')
Message.error('登录超时过期'); Message.error('登录超时过期')
// 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');
// 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'
@@ -93,12 +92,12 @@ instance.interceptors.response.use(function (response) {
} }
// 判断超时 // 判断超时
if (error.code === "ECONNABORTED" && error.message.indexOf('timeout') !== -1 && !error.config._retry) { if (error.code === 'ECONNABORTED' && error.message.indexOf('timeout') !== -1 && !error.config._retry) {
Message.error(error.message); Message.error(error.message)
} else { } else {
Message.error(error.message); Message.error(error.message)
} }
return Promise.reject(error); return Promise.reject(error)
}); })
export {instance, loading}; 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'
+47 -49
View File
@@ -20,83 +20,82 @@
</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: { watch: {
'$route.path': { '$route.path': {
handler(val) { handler (val) {
this.getMenu(); this.getMenu()
}, },
deep: true deep: true
} }
}, },
methods: { methods: {
handleTree(arr, parentId) { handleTree (arr, parentId) {
let cloneData = JSON.parse(JSON.stringify(arr)); // 对源数据深度克隆 const cloneData = JSON.parse(JSON.stringify(arr)) // 对源数据深度克隆
return cloneData.filter((father) => { return cloneData.filter((father) => {
let branchArr = cloneData.filter(child => father.id === child.parentId); //返回每一项的子级数组 const branchArr = cloneData.filter(child => father.id === child.parentId) // 返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null; //如果存在子级,则给父级添加一个children属性,并赋值 father.children = branchArr.length > 0 ? branchArr : null // 如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId === parentId; //返回第一层 return father.parentId === parentId // 返回第一层
}) })
}, },
addLevel(data, level) { addLevel (data, level) {
data.forEach(item => { data.forEach(item => {
item.level = level; item.level = level
if (item.children) { if (item.children) {
this.addLevel(item.children, level + 1); this.addLevel(item.children, level + 1)
} }
}); })
return data; return data
}, },
getMenu() { getMenu () {
if (!this.$route.query.id) { if (!this.$route.query.id) {
return this.$router.push({path: '/report/list', query:{"id": "AEHJB8YNJ3"}}); return this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } })
} }
let data = JSON.parse(JSON.stringify(this.$store.state.menuData)); const data = JSON.parse(JSON.stringify(this.$store.state.menuData))
let menu = data.filter(item => item.parentId === this.$route.query.id); const menu = data.filter(item => item.parentId === this.$route.query.id)
let menuData = []; let menuData = []
let menuFun = (menu) => { const menuFun = (menu) => {
menuData = [...menuData, ...menu]; menuData = [...menuData, ...menu]
let parentIds = menu.map(item => item.id); const parentIds = menu.map(item => item.id)
if (parentIds.length) { if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.parentId))) menuFun(data.filter(item => parentIds.find(el => el === item.parentId)))
} }
}; }
menuFun(menu); menuFun(menu)
let treeData = this.handleTree(menuData, this.$route.query.id); const treeData = this.handleTree(menuData, this.$route.query.id)
this.menuData = this.addLevel(treeData, 1); this.menuData = this.addLevel(treeData, 1)
}, },
getSysMenu() { getSysMenu () {
this.$api.menu.getSysMenu({roleId: this.$store.state.userInfo.roleIdList[0]}).then(({data}) => { this.$api.menu.getSysMenu({ roleId: this.$store.state.userInfo.roleIdList[0] }).then(({ data }) => {
debugger
if (data === null) { if (data === null) {
data = [] data = []
} }
data = data.sort((a, b) => a.sort - b.sort); data = data.sort((a, b) => a.sort - b.sort)
let menu = data.filter(item => item.belong); const menu = data.filter(item => item.belong)
let menuData = []; let menuData = []
let menuFun = (menu) => { const menuFun = (menu) => {
menuData = [...menuData, ...menu] menuData = [...menuData, ...menu]
let parentIds = menu.map(item => item.parentId); const parentIds = menu.map(item => item.parentId)
if (parentIds.length) { if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.id))) menuFun(data.filter(item => parentIds.find(el => el === item.id)))
} }
} }
menuFun(menu); menuFun(menu)
let treeData = menuData.map(item => ({ const treeData = menuData.map(item => ({
id: item.id, id: item.id,
parentId: item.parentId, parentId: item.parentId,
label: item.name, label: item.name,
@@ -105,30 +104,29 @@
isCollage: true, isCollage: true,
belong: item.belong, belong: item.belong,
isUrl: item.isUrl isUrl: item.isUrl
})); }))
// 去重 // 去重
let obj = {}; const obj = {}
treeData.forEach(item => { treeData.forEach(item => {
obj[item.id] = item; obj[item.id] = item
}) })
debugger this.$store.commit('saveMenuData', Object.values(obj))
this.$store.commit('saveMenuData', Object.values(obj));
this.getMenu(); this.getMenu()
}); })
} }
}, },
created() { created () {
// 判定菜单是否存在,存在则不加载 // 判定菜单是否存在,存在则不加载
// let menuData = this.$store.state.menuData; // let menuData = this.$store.state.menuData;
// debugger // debugger
// if (menuData.length == 0) { // if (menuData.length == 0) {
this.getSysMenu(); this.getSysMenu()
// } else { // } else {
// this.getMenu(); // this.getMenu();
// } // }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+36 -35
View File
@@ -37,49 +37,49 @@
</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() { created () {
this.init(); this.init()
}, },
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]
} }
} }
} }
} }
}, },
init() { init () {
this.isChecked = !!this.$store.state.rememberData; this.isChecked = !!this.$store.state.rememberData
if (this.isChecked) { if (this.isChecked) {
this.form.username = this.$store.state.rememberData.username; this.form.username = this.$store.state.rememberData.username
this.form.password = this.$store.state.rememberData.password; this.form.password = this.$store.state.rememberData.password
} }
this.verifyCode(); this.verifyCode()
}, },
// 登录 // 登录
login() { login () {
if (!this.form.username) { if (!this.form.username) {
return this.$message.warning('请输入用户名') return this.$message.warning('请输入用户名')
} }
@@ -92,36 +92,37 @@
if (this.form.verifyCode.length !== 4) { if (this.form.verifyCode.length !== 4) {
return this.$message.warning('请检查验证码') return this.$message.warning('请检查验证码')
} }
this.$store.commit('saveRememberData', this.isChecked ? { this.$store.commit('saveRememberData', this.isChecked
? {
username: this.form.username, username: this.form.username,
password: this.form.password password: this.form.password
} : null); }
let data = JSON.parse(JSON.stringify(this.form)); : null)
data.username = this.$JSEncrypt(data.username); const data = JSON.parse(JSON.stringify(this.form))
data.password = this.$JSEncrypt(data.password); data.username = this.$JSEncrypt(data.username)
let jsonData = JSON.stringify(data); data.password = this.$JSEncrypt(data.password)
const jsonData = JSON.stringify(data)
this.$api.login.login(Base64.encode(jsonData)).then(res => { this.$api.login.login(Base64.encode(jsonData)).then(res => {
if (res.respCode !== '0') { if (res.respCode !== '0') {
this.verifyCode(); this.verifyCode()
return this.$message.error(res.data.message); return this.$message.error(res.data.message)
} }
this.$message.success('登录成功'); this.$message.success('登录成功')
this.$store.commit('saveUserInfo', res.data); this.$store.commit('saveUserInfo', res.data)
this.$router.push({path: '/report/list', query:{"id": "AEHJB8YNJ3"}}); this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } })
}).catch(_ => { }).catch(_ => {
this.verifyCode(); this.verifyCode()
}) })
}, },
// 获取验证码 // 获取验证码
verifyCode() { verifyCode () {
this.$api.login.verifyCode({}) this.$api.login.verifyCode({})
.then(res => { .then(res => {
this.verifyImg = `data: image/jpeg;base64,${btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))}` 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>
+19 -19
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: { methods: {
// 预览 // 预览
previewRow() { previewRow () {
if(!this.$route.query.row){ if (!this.$route.query.row) {
this.$router.push({path: '/report/list', query: {id: this.$route.query.id}}); this.$router.push({ path: '/report/list', query: { id: this.$route.query.id } })
return return
} }
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`; 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.row = JSON.parse(this.$route.query.row)
this.$api.report.reportGetReportHtmlId({id: this.row.id}).then(({data}) => { this.$api.report.reportGetReportHtmlId({ id: this.row.id }).then(({ data }) => {
this.content = data.content; this.content = data.content
}) })
}, },
// 下载 // 下载
downloadRow(row){ downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', { // this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning' // type: 'warning'
// }).then(() => { // }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => { this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res); downloadFile(res)
}) })
// }) // })
} }
}, },
created() { created () {
this.previewRow(); this.previewRow()
}
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+82 -82
View File
@@ -163,12 +163,12 @@
</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,
@@ -179,7 +179,7 @@ export default {
labelTwoId: [], labelTwoId: [],
labelThreeId: [], labelThreeId: [],
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
}, },
total: 0, total: 0,
tableData: [], tableData: [],
@@ -190,114 +190,114 @@ export default {
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, // 预览 dialogPreview: false, // 预览
content: '', content: ''
} }
}, },
methods: { methods: {
init() { init () {
this.labelList(); this.labelList()
this.reportDateList(); this.reportDateList()
this.reportList(); this.reportList()
}, },
// 标签列表 // 标签列表
labelList() { labelList () {
this.$api.report.labelList().then(({data}) => { this.$api.report.labelList().then(({ data }) => {
this.tagData[1].name = data.labelOne.name; this.tagData[1].name = data.labelOne.name
this.tagData[2].name = data.labelTwo.name; this.tagData[2].name = data.labelTwo.name
this.tagData[3].name = data.labelThree.name; this.tagData[3].name = data.labelThree.name
this.tagData[1].tags = data.labelOne.childList; this.tagData[1].tags = data.labelOne.childList
this.tagData[2].tags = data.labelTwo.childList; this.tagData[2].tags = data.labelTwo.childList
this.tagData[3].tags = data.labelThree.childList; this.tagData[3].tags = data.labelThree.childList
}) })
}, },
search(){ search () {
this.q.pageNo = 1; this.q.pageNo = 1
this.reportList(); this.reportList()
}, },
// 列表 // 列表
reportList() { reportList () {
this.$api.report.reportList(this.q).then(({data}) => { this.$api.report.reportList(this.q).then(({ data }) => {
this.tableData = data.records; this.tableData = data.records
this.total = data.total; this.total = data.total
this.q.pageNo = data.current; this.q.pageNo = data.current
this.q.pageSize = data.size; this.q.pageSize = data.size
if(!data.records.length && this.q.pageNo !== 1){ if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1; this.q.pageNo = 1
this.reportList(); this.reportList()
} }
}) })
}, },
// 监听全选按钮 // 监听全选按钮
handleCheckAllChange(val, type) { handleCheckAllChange (val, type) {
switch (type) { switch (type) {
case 1: case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : []; this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : []
break; break
case 2: case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : []; this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : []
break; break
case 3: case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : []; this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : []
break; break
} }
this.tagData[type].isIndeterminate = !val; this.tagData[type].isIndeterminate = !val
}, },
// 监听group checkbox // 监听group checkbox
handleCheckedTagsChange(val, type) { handleCheckedTagsChange (val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length); this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length)
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length; this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length
}, },
// 切换展开隐藏 // 切换展开隐藏
switchTagShow(type) { switchTagShow (type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow; this.tagData[type].tagShow = !this.tagData[type].tagShow
}, },
// 日期列表 // 日期列表
reportDateList() { reportDateList () {
this.$api.report.reportDateList().then(({data}) => { this.$api.report.reportDateList().then(({ data }) => {
this.yearList = data.list; this.yearList = data.list
}) })
}, },
// 单页数据量 // 单页数据量
handleSizeChange(val) { handleSizeChange (val) {
this.q.pageSize = val; this.q.pageSize = val
this.q.pageNo = 1; this.q.pageNo = 1
this.reportList(); this.reportList()
}, },
// 第几页 // 第几页
handleCurrentChange(val) { handleCurrentChange (val) {
this.q.pageNo = val; this.q.pageNo = val
this.reportList(); this.reportList()
}, },
// 预览 // 预览
previewRow(row) { previewRow (row) {
this.fullscreen = false; this.fullscreen = false
// 更新预览水印的时间戳 // 更新预览水印的时间戳
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`; 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.$api.report.reportGetReportHtmlId({ id: row.id }).then(({ data }) => {
this.content = data.content; this.content = data.content
this.dialogPreview = true; this.dialogPreview = true
}) })
}, },
// 重置 // 重置
reset() { reset () {
this.q = { this.q = {
keyContent: '', keyContent: '',
year: [], year: [],
@@ -305,37 +305,37 @@ export default {
labelTwoId: [], labelTwoId: [],
labelThreeId: [], labelThreeId: [],
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
}; }
this.total = 0; this.total = 0
this.tableData = []; this.tableData = []
this.tagData[1].checkAll = false; this.tagData[1].checkAll = false
this.tagData[1].isIndeterminate = true; this.tagData[1].isIndeterminate = true
this.tagData[2].checkAll = false; this.tagData[2].checkAll = false
this.tagData[2].isIndeterminate = true; this.tagData[2].isIndeterminate = true
this.tagData[3].checkAll = false; this.tagData[3].checkAll = false
this.tagData[3].isIndeterminate = true; this.tagData[3].isIndeterminate = true
this.reportList(); this.reportList()
}, },
// 下载 // 下载
downloadRow(row) { downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', { // this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning' // type: 'warning'
// }).then(() => { // }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => { this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res); downloadFile(res)
}) })
// }) // })
}, },
// 跳转到详情 // 跳转到详情
goReportDetail(row) { goReportDetail (row) {
this.$router.push({path: '/report/detail', query: {id: this.$route.query.id, row: JSON.stringify(row)}}); this.$router.push({ path: '/report/detail', query: { id: this.$route.query.id, row: JSON.stringify(row) } })
} }
}, },
created() { created () {
this.init(); this.init()
} }
} }
</script> </script>
+277 -278
View File
@@ -377,13 +377,13 @@
</template> </template>
<script> <script>
import {fileType} from '@/utils/fileType' import { fileType } from '@/utils/fileType'
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: "ReportManager", name: 'ReportManager',
data() { data () {
return { return {
watermarkText: '', // 水印 watermarkText: '', // 水印
fullscreen: false, fullscreen: false,
@@ -395,7 +395,7 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
reportName: '', // 报告名称 reportName: '', // 报告名称
startDate: '', // 开始时间 startDate: '' // 开始时间
}, },
qLogTotal: 0, qLogTotal: 0,
qLogDateRange: '', // 开始结束时间 qLogDateRange: '', // 开始结束时间
@@ -430,7 +430,7 @@ export default {
childList: [ childList: [
// {name: '无', type: '3', id: '', parentId: ''}, // {name: '无', type: '3', id: '', parentId: ''},
] ]
}, }
}, },
/* =============================================== 报告上传 =============================================== */ /* =============================================== 报告上传 =============================================== */
dialogReport: false, // 报告上传 dialogReport: false, // 报告上传
@@ -448,7 +448,7 @@ export default {
labelTwoName: '', // 标签2 labelTwoName: '', // 标签2
labelThreeId: '', // 标签3 labelThreeId: '', // 标签3
labelThreeName: '', // 标签3 labelThreeName: '', // 标签3
reportUserIdList: [], // 权限 reportUserIdList: [] // 权限
}, },
labelOne: {}, labelOne: {},
labelTwo: {}, labelTwo: {},
@@ -456,9 +456,9 @@ export default {
mode: '', mode: '',
userList: [], userList: [],
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate (time) {
return time.getFullYear() > new Date().getFullYear() + 1 || time.getFullYear() < new Date().getFullYear() - 10; return time.getFullYear() > new Date().getFullYear() + 1 || time.getFullYear() < new Date().getFullYear() - 10
}, }
}, },
/* =============================================== 列表展示 =============================================== */ /* =============================================== 列表展示 =============================================== */
q: { q: {
@@ -468,7 +468,7 @@ export default {
labelTwoId: [], labelTwoId: [],
labelThreeId: [], labelThreeId: [],
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
}, },
total: 0, total: 0,
tableData: [], tableData: [],
@@ -478,279 +478,278 @@ export default {
} }
}, },
methods: { methods: {
init() { init () {
this.labelList(); this.labelList()
this.reset(); this.reset()
this.reportDateList(); this.reportDateList()
this.sysUserList(); this.sysUserList()
}, },
/* =============================================== 操作日志 =============================================== */ /* =============================================== 操作日志 =============================================== */
// 操作日志 // 操作日志
openLog() { openLog () {
this.dialogLog = true; this.dialogLog = true
this.logReset(); this.logReset()
}, },
// 日志重置搜索 // 日志重置搜索
logReset() { logReset () {
this.qLogDateRange = ''; this.qLogDateRange = ''
this.qLog = { this.qLog = {
doName: '', // 操作类型 doName: '', // 操作类型
endDate: '', // 结束时间 endDate: '', // 结束时间
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
reportName: '', // 报告名称 reportName: '', // 报告名称
startDate: '', // 开始时间 startDate: '' // 开始时间
}; }
this.qLogTotal = 0; this.qLogTotal = 0
this.qLogDateRange = ''; // 开始结束时间 this.qLogDateRange = '' // 开始结束时间
this.logTableData = []; this.logTableData = []
this.doNames = []; this.doNames = []
this.reportLogList(); this.reportLogList()
}, },
// 搜索 // 搜索
searchLog() { searchLog () {
this.qLog.pageNo = 1; this.qLog.pageNo = 1
this.reportLogList(); this.reportLogList()
}, },
// 报告列表 // 报告列表
reportLogList() { reportLogList () {
this.$api.report.reportLogList(this.qLog) this.$api.report.reportLogList(this.qLog)
.then(({data}) => { .then(({ data }) => {
this.logTableData = data.records; this.logTableData = data.records
this.qLogTotal = data.total; this.qLogTotal = data.total
this.qLog.pageNo = data.current; this.qLog.pageNo = data.current
this.qLog.pageSize = data.size; this.qLog.pageSize = data.size
if (!data.records.length && this.qLog.pageNo !== 1) { if (!data.records.length && this.qLog.pageNo !== 1) {
this.qLog.pageNo = 1; this.qLog.pageNo = 1
this.reportLogList(); this.reportLogList()
} }
}) })
}, },
// 单页数据量 // 单页数据量
handleLogSizeChange(val) { handleLogSizeChange (val) {
this.qLog.pageSize = val; this.qLog.pageSize = val
this.qLog.pageNo = 1; this.qLog.pageNo = 1
this.reportLogList(); this.reportLogList()
}, },
// 第几页 // 第几页
handleLogCurrentChange(val) { handleLogCurrentChange (val) {
this.qLog.pageNo = val; this.qLog.pageNo = val
this.reportLogList(); this.reportLogList()
}, },
// 日期 // 日期
handleLogDate(val) { handleLogDate (val) {
if (val) { if (val) {
this.qLog.startDate = val[0]; this.qLog.startDate = val[0]
this.qLog.endDate = val[1]; this.qLog.endDate = val[1]
} else { } else {
this.qLog.startDate = ''; this.qLog.startDate = ''
this.qLog.endDate = ''; this.qLog.endDate = ''
} }
}, },
handleTyleChange(val){ handleTyleChange (val) {
this.qLog.doName = val.join(','); this.qLog.doName = val.join(',')
}, },
/* =============================================== 标签维护 =============================================== */ /* =============================================== 标签维护 =============================================== */
// 标签维护 新增 // 标签维护 新增
addTag(index, type) { addTag (index, type) {
if (this.tagsForm['tags0' + type].childList.length >= 20) { if (this.tagsForm['tags0' + type].childList.length >= 20) {
return this.$message.warning("最多添加20个标签"); return this.$message.warning('最多添加20个标签')
} }
let itemData = {name: '', id: "", parentId: this.tagsForm['tags0' + type].id, type: String(type)}; const itemData = { name: '', id: '', parentId: this.tagsForm['tags0' + type].id, type: String(type) }
this.tagsForm['tags0' + type].childList.splice(index + 1, 0, itemData); this.tagsForm['tags0' + type].childList.splice(index + 1, 0, itemData)
}, },
// 标签维护 删除 // 标签维护 删除
delTag(index, type) { delTag (index, type) {
let {id, status} = this.tagsForm['tags0' + type].childList[index]; const { id, status } = this.tagsForm['tags0' + type].childList[index]
if(status === '1'){ if (status === '1') {
this.$confirm('此标签已应用于报告, 是否删除?', '提示', { this.$confirm('此标签已应用于报告, 是否删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
if (id) { if (id) {
this.$api.report.labelDeleteId({id}).then(_ => { this.$api.report.labelDeleteId({ id }).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.labelList(); this.labelList()
}) })
} else { } else {
this.tagsForm['tags0' + type].childList.splice(index, 1); this.tagsForm['tags0' + type].childList.splice(index, 1)
this.$message.success('操作成功'); this.$message.success('操作成功')
} }
}) })
}else{ } else {
if (id) { if (id) {
this.$api.report.labelDeleteId({id}).then(_ => { this.$api.report.labelDeleteId({ id }).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.labelList(); this.labelList()
}) })
} else { } else {
this.tagsForm['tags0' + type].childList.splice(index, 1); this.tagsForm['tags0' + type].childList.splice(index, 1)
this.$message.success('操作成功'); this.$message.success('操作成功')
} }
} }
}, },
// 上移 // 上移
upTag(item, index, type){ upTag (item, index, type) {
this.$api.report.labelMove({ this.$api.report.labelMove({
id: item.id, id: item.id,
moveType: 'up', moveType: 'up',
type: String(type) type: String(type)
}).then(_=>{ }).then(_ => {
this.labelList(); this.labelList()
}) })
}, },
// 下移 // 下移
downTag(item, index, type){ downTag (item, index, type) {
this.$api.report.labelMove({ this.$api.report.labelMove({
id: item.id, id: item.id,
moveType: 'down', moveType: 'down',
type: String(type) type: String(type)
}).then(_=>{ }).then(_ => {
this.labelList(); this.labelList()
}) })
}, },
// 标签维护 // 标签维护
openTags() { openTags () {
this.dialogTags = true; this.dialogTags = true
this.labelList(); this.labelList()
}, },
// 单个标签保存 // 单个标签保存
handleSaveTag(val, item, type) { handleSaveTag (val, item, type) {
if(val === ''){ if (val === '') {
this.$message.warning('标签名称不能为空'); this.$message.warning('标签名称不能为空')
this.labelList(); this.labelList()
return; return
} }
if(val === '-'){ if (val === '-') {
this.$message.warning('标签名称不能为-'); this.$message.warning('标签名称不能为-')
this.labelList(); this.labelList()
return; return
} }
if(this.tagsForm['tags0' + type].childList.filter(item => item.name === val).length > 1){ if (this.tagsForm['tags0' + type].childList.filter(item => item.name === val).length > 1) {
this.$message.warning('标签名称不能重复'); this.$message.warning('标签名称不能重复')
this.labelList(); this.labelList()
return; return
} }
let params = {name: val, parentId: this.tagsForm['tags0' + type].id, type: String(type), id: item.id || ''} const params = { name: val, parentId: this.tagsForm['tags0' + type].id, type: String(type), id: item.id || '' }
if(item.status === '1'){ if (item.status === '1') {
this.$confirm('此标签已应用于报告, 是否编辑?', '提示', { this.$confirm('此标签已应用于报告, 是否编辑?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$api.report.labelAdd(params).then(_ => { this.$api.report.labelAdd(params).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.labelList(); this.labelList()
}).catch(_ => { }).catch(_ => {
this.labelList(); this.labelList()
}) })
}).catch(_=>{ }).catch(_ => {
this.labelList(); this.labelList()
}) })
}else{ } else {
this.$api.report.labelAdd(params).then(_ => { this.$api.report.labelAdd(params).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.labelList(); this.labelList()
}).catch(_ => { }).catch(_ => {
this.labelList(); this.labelList()
}) })
} }
}, },
// 单个顶级标签保存 // 单个顶级标签保存
handleSaveTopTag(val, type) { handleSaveTopTag (val, type) {
if(val === ''){ if (val === '') {
this.$message.warning('标签名称不能为空'); this.$message.warning('标签名称不能为空')
this.labelList(); this.labelList()
return; return
} }
if(val === '-'){ if (val === '-') {
this.$message.warning('标签名称不能为-'); this.$message.warning('标签名称不能为-')
this.labelList(); this.labelList()
return; return
} }
if(type === 1 && (val === this.tagsForm.tags02.name || val === this.tagsForm.tags03.name)){ if (type === 1 && (val === this.tagsForm.tags02.name || val === this.tagsForm.tags03.name)) {
this.$message.warning('标签名称不能重复'); this.$message.warning('标签名称不能重复')
this.labelList(); this.labelList()
return; return
} }
if(type === 2 && (val === this.tagsForm.tags01.name || val === this.tagsForm.tags03.name)){ if (type === 2 && (val === this.tagsForm.tags01.name || val === this.tagsForm.tags03.name)) {
this.$message.warning('标签名称不能重复'); this.$message.warning('标签名称不能重复')
this.labelList(); this.labelList()
return; return
} }
if(type === 3 && (val === this.tagsForm.tags01.name || val === this.tagsForm.tags02.name)){ if (type === 3 && (val === this.tagsForm.tags01.name || val === this.tagsForm.tags02.name)) {
this.$message.warning('标签名称不能重复'); this.$message.warning('标签名称不能重复')
this.labelList(); this.labelList()
return; return
} }
let params = {name: val, id: this.tagsForm['tags0' + type].id, parentId: '0', type: String(type)}; const params = { name: val, id: this.tagsForm['tags0' + type].id, parentId: '0', type: String(type) }
this.$api.report.labelAdd(params).then(_ => { this.$api.report.labelAdd(params).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.labelList(); this.labelList()
}).catch(_ => { }).catch(_ => {
this.labelList(); this.labelList()
}) })
}, },
// 标签列表 // 标签列表
labelList() { labelList () {
this.$api.report.labelList().then(({data}) => { this.$api.report.labelList().then(({ data }) => {
if(!data.labelOne.childList.length){ if (!data.labelOne.childList.length) {
data.labelOne.childList = [{name: '', id: '', parentId: this.tagsForm.tags01.id, type: '1'}] data.labelOne.childList = [{ name: '', id: '', parentId: this.tagsForm.tags01.id, type: '1' }]
} }
if(!data.labelTwo.childList.length){ if (!data.labelTwo.childList.length) {
data.labelTwo.childList = [{name: '', id: '', parentId: this.tagsForm.tags02.id, type: '2'}] data.labelTwo.childList = [{ name: '', id: '', parentId: this.tagsForm.tags02.id, type: '2' }]
} }
if(!data.labelThree.childList.length){ if (!data.labelThree.childList.length) {
data.labelThree.childList = [{name: '', id: '', parentId: this.tagsForm.tags03.id, type: '3'}] data.labelThree.childList = [{ name: '', id: '', parentId: this.tagsForm.tags03.id, type: '3' }]
} }
this.tagsForm.tags01 = data.labelOne; this.tagsForm.tags01 = data.labelOne
this.tagsForm.tags02 = data.labelTwo; this.tagsForm.tags02 = data.labelTwo
this.tagsForm.tags03 = data.labelThree; this.tagsForm.tags03 = data.labelThree
}) })
}, },
handleTagsClose(){ handleTagsClose () {
this.dialogTags = false; this.dialogTags = false
this.labelList(); this.labelList()
this.reset(); this.reset()
}, },
// 保存标签 // 保存标签
saveTags() { saveTags () {
let tagsForm = JSON.parse(JSON.stringify(this.tagsForm)); const tagsForm = JSON.parse(JSON.stringify(this.tagsForm))
let params = { const params = {
labelList: [ labelList: [
tagsForm.tags01, tagsForm.tags01,
tagsForm.tags02, tagsForm.tags02,
tagsForm.tags03 tagsForm.tags03
] ]
} }
let isSave = true; let isSave = true
params.labelList.forEach(item => { params.labelList.forEach(item => {
if(!item.name || item.name === '-'){ if (!item.name || item.name === '-') {
isSave = false; isSave = false
return return
} }
item.childList.forEach(ele => { item.childList.forEach(ele => {
if(!ele.name || item.name === '-'){ if (!ele.name || item.name === '-') {
isSave = false; isSave = false
return
} }
}) })
}) })
if(!isSave){ if (!isSave) {
return this.$message.warning('标签名称不能为空'); return this.$message.warning('标签名称不能为空')
} }
this.$api.report.labelSave(params).then(_ => { this.$api.report.labelSave(params).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogTags = false; this.dialogTags = false
this.labelList(); this.labelList()
this.reset(); this.reset()
}) })
}, },
/* =============================================== 报告上传 =============================================== */ /* =============================================== 报告上传 =============================================== */
// 打开报告上传 // 打开报告上传
openReportAdd() { openReportAdd () {
this.mode = 'add'; this.mode = 'add'
this.reportF = { this.reportF = {
name: '', // 报告名称 name: '', // 报告名称
keyContent: '', // 关键词 keyContent: '', // 关键词
@@ -765,127 +764,127 @@ export default {
labelTwoName: '', // 标签2 labelTwoName: '', // 标签2
labelThreeId: '', // 标签3 labelThreeId: '', // 标签3
labelThreeName: '', // 标签3 labelThreeName: '', // 标签3
reportUserIdList: [], // 权限 reportUserIdList: [] // 权限
}; }
this.labelOne = {}; this.labelOne = {}
this.labelTwo = {}; this.labelTwo = {}
this.labelThree = {}; this.labelThree = {}
this.labelList(); this.labelList()
this.dialogReport = true; this.dialogReport = true
}, },
// 选择标签 // 选择标签
handleSelectTag(val, type) { handleSelectTag (val, type) {
switch (type) { switch (type) {
case 1: case 1:
this.reportF.labelOneId = val.id; this.reportF.labelOneId = val.id
this.reportF.labelOneName = val.name; this.reportF.labelOneName = val.name
break; break
case 2: case 2:
this.reportF.labelTwoId = val.id; this.reportF.labelTwoId = val.id
this.reportF.labelTwoName = val.name; this.reportF.labelTwoName = val.name
break; break
case 3: case 3:
this.reportF.labelThreeId = val.id; this.reportF.labelThreeId = val.id
this.reportF.labelThreeName = val.name; this.reportF.labelThreeName = val.name
break; break
} }
}, },
// 必填项 // 必填项
checkReportF() { checkReportF () {
if (!this.reportF.name) { if (!this.reportF.name) {
return this.$message.warning('请检查报告名称') && false; return this.$message.warning('请检查报告名称') && false
} }
if (!this.reportF.fileId || !this.reportF.fileName) { if (!this.reportF.fileId || !this.reportF.fileName) {
return this.$message.warning('请检查上传文件') && false; return this.$message.warning('请检查上传文件') && false
} }
if (!this.reportF.year) { if (!this.reportF.year) {
return this.$message.warning('请检查报告年份') && false; return this.$message.warning('请检查报告年份') && false
} }
if (!this.reportF.labelOneId || !this.reportF.labelOneName || this.reportF.labelOneName === '-' ) { if (!this.reportF.labelOneId || !this.reportF.labelOneName || this.reportF.labelOneName === '-') {
return this.$message.warning(`请检查${this.tagsForm.tags01.name}`) && false; return this.$message.warning(`请检查${this.tagsForm.tags01.name}`) && false
} }
if (!this.reportF.labelTwoId || !this.reportF.labelTwoName || this.reportF.labelTwoName === '-') { if (!this.reportF.labelTwoId || !this.reportF.labelTwoName || this.reportF.labelTwoName === '-') {
return this.$message.warning(`请检查${this.tagsForm.tags02.name}`) && false; return this.$message.warning(`请检查${this.tagsForm.tags02.name}`) && false
} }
if (!this.reportF.labelThreeId || !this.reportF.labelThreeName || this.reportF.labelThreeName === '-') { if (!this.reportF.labelThreeId || !this.reportF.labelThreeName || this.reportF.labelThreeName === '-') {
return this.$message.warning(`请检查${this.tagsForm.tags03.name}`) && false; return this.$message.warning(`请检查${this.tagsForm.tags03.name}`) && false
} }
if (!this.reportF.reportUserIdList || !this.reportF.reportUserIdList.length) { if (!this.reportF.reportUserIdList || !this.reportF.reportUserIdList.length) {
return this.$message.warning('请检查权限') && false; return this.$message.warning('请检查权限') && false
} }
return true; return true
}, },
// 新增或编辑报告 // 新增或编辑报告
reportAdd() { reportAdd () {
if (!this.checkReportF()) return; if (!this.checkReportF()) return
this.$api.report.reportAdd(this.reportF).then(_ => { this.$api.report.reportAdd(this.reportF).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogReport = false; this.dialogReport = false
this.reset(); this.reset()
}) })
}, },
// 上传文件 // 上传文件
uploadFile(params) { uploadFile (params) {
let fd = new FormData(); const fd = new FormData()
fd.append('file', params.file); fd.append('file', params.file)
this.$api.report.reportUploadFile(fd).then(({data}) => { this.$api.report.reportUploadFile(fd).then(({ data }) => {
this.reportF.fileName = data.name; this.reportF.fileName = data.name
this.reportF.fileId = data.key; this.reportF.fileId = data.key
}) })
}, },
// 上传文件前 // 上传文件前
beforeUploadFile(file) { beforeUploadFile (file) {
let realFileType = file.name.split('.')[file.name.split('.').length - 1]; const realFileType = file.name.split('.')[file.name.split('.').length - 1]
const isType = ( const isType = (
file.type === fileType.pdf || file.type === fileType.xls || file.type === fileType.xlsx || file.type === fileType.doc || file.type === fileType.docx || file.type === fileType.ppt || file.type === fileType.pptx file.type === fileType.pdf || file.type === fileType.xls || file.type === fileType.xlsx || file.type === fileType.doc || file.type === fileType.docx || file.type === fileType.ppt || file.type === fileType.pptx ||
|| realFileType === 'pdf' || realFileType === 'xls' || realFileType === 'xlsx' || realFileType === 'doc' || realFileType === 'docx' || realFileType === 'ppt' || realFileType === 'pptx' realFileType === 'pdf' || realFileType === 'xls' || realFileType === 'xlsx' || realFileType === 'doc' || realFileType === 'docx' || realFileType === 'ppt' || realFileType === 'pptx'
); )
const isSize = file.size / 1024 / 1024 < 200; const isSize = file.size / 1024 / 1024 < 200
if (!isType) { if (!isType) {
this.$message.error('仅能上传 pdfxlsxlsxdocdocxpptpptx 格式文件'); this.$message.error('仅能上传 pdfxlsxlsxdocdocxpptpptx 格式文件')
} }
if (!isSize) { if (!isSize) {
this.$message.error('您最大可上传200M文件'); this.$message.error('您最大可上传200M文件')
} }
return isType && isSize; return isType && isSize
}, },
// 重置 // 重置
resetUploadFile() { resetUploadFile () {
this.reportF.fileId = ''; this.reportF.fileId = ''
this.reportF.fileName = ''; this.reportF.fileName = ''
}, },
// 打开报告上传 // 打开报告上传
openReportModify(mode, row) { openReportModify (mode, row) {
this.mode = mode; this.mode = mode
this.labelList(); this.labelList()
let rowData = JSON.parse(JSON.stringify(row)); const rowData = JSON.parse(JSON.stringify(row))
if(rowData.labelOneName !== '-'){ if (rowData.labelOneName !== '-') {
this.labelOne = {id: rowData.labelOneId, rowData: rowData.labelOneName}; this.labelOne = { id: rowData.labelOneId, rowData: rowData.labelOneName }
}else{ } else {
this.labelOne = {}; this.labelOne = {}
} }
if(rowData.labelTwoName !== '-'){ if (rowData.labelTwoName !== '-') {
this.labelTwo = {id: rowData.labelTwoId, name: rowData.labelTwoName}; this.labelTwo = { id: rowData.labelTwoId, name: rowData.labelTwoName }
}else{ } else {
this.labelTwo = {}; this.labelTwo = {}
} }
if(rowData.labelThreeName !== '-'){ if (rowData.labelThreeName !== '-') {
this.labelThree = {id: rowData.labelThreeId, name: rowData.labelThreeName}; this.labelThree = { id: rowData.labelThreeId, name: rowData.labelThreeName }
}else{ } else {
this.labelThree = {}; this.labelThree = {}
} }
this.reportF = rowData; this.reportF = rowData
this.dialogReport = true; this.dialogReport = true
}, },
// 获取所有用户 // 获取所有用户
sysUserList() { sysUserList () {
this.$api.user.sysUserList({pageNo: 1, pageSize: 999999}).then(({data}) => { this.$api.user.sysUserList({ pageNo: 1, pageSize: 999999 }).then(({ data }) => {
this.userList = data.records; this.userList = data.records
}) })
}, },
/* =============================================== 列表展示 =============================================== */ /* =============================================== 列表展示 =============================================== */
// 重置 // 重置
reset() { reset () {
this.q = { this.q = {
keyContent: '', keyContent: '',
year: [], year: [],
@@ -893,86 +892,86 @@ export default {
labelTwoId: [], labelTwoId: [],
labelThreeId: [], labelThreeId: [],
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
}; }
this.total = 0; this.total = 0
this.tableData = []; this.tableData = []
this.reportList(); this.reportList()
this.reportDateList(); this.reportDateList()
}, },
// 报告删除 // 报告删除
reportDelete(ids) { reportDelete (ids) {
this.$confirm('此操作将删除所选数据, 是否继续?', '提示', { this.$confirm('此操作将删除所选数据, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$api.report.reportDelete({ids}).then(_ => { this.$api.report.reportDelete({ ids }).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.reportList(); this.reportList()
this.reportDateList(); this.reportDateList()
}) })
}) })
}, },
search() { search () {
this.q.pageNo = 1; this.q.pageNo = 1
this.reportList(); this.reportList()
}, },
// 列表 // 列表
reportList() { reportList () {
this.$api.report.reportList(this.q).then(({data}) => { this.$api.report.reportList(this.q).then(({ data }) => {
this.tableData = data.records; this.tableData = data.records
this.total = data.total; this.total = data.total
this.q.pageNo = data.current; this.q.pageNo = data.current
this.q.pageSize = data.size; this.q.pageSize = data.size
if (!data.records.length && this.q.pageNo !== 1) { if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1; this.q.pageNo = 1
this.reportList(); this.reportList()
} }
}) })
}, },
// 日期列表 // 日期列表
reportDateList() { reportDateList () {
this.$api.report.reportDateList().then(({data}) => { this.$api.report.reportDateList().then(({ data }) => {
this.yearList = data.list; this.yearList = data.list
}) })
}, },
// 单页数据量 // 单页数据量
handleSizeChange(val) { handleSizeChange (val) {
this.q.pageSize = val; this.q.pageSize = val
this.q.pageNo = 1; this.q.pageNo = 1
this.reportList(); this.reportList()
}, },
// 第几页 // 第几页
handleCurrentChange(val) { handleCurrentChange (val) {
this.q.pageNo = val; this.q.pageNo = val
this.reportList(); this.reportList()
}, },
// 预览 // 预览
previewRow(row) { previewRow (row) {
this.fullscreen = false; this.fullscreen = false
// 更新预览水印的时间戳 // 更新预览水印的时间戳
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`; 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.$api.report.reportGetReportHtmlId({ id: row.id }).then(({ data }) => {
this.content = data.content; this.content = data.content
this.dialogPreview = true; this.dialogPreview = true
}) })
}, },
// 下载 // 下载
downloadRow(row) { downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', { // this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning' // type: 'warning'
// }).then(() => { // }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => { this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res); downloadFile(res)
}) })
// }) // })
}
}, },
}, created () {
created() { this.init()
this.init();
} }
} }
</script> </script>
+3 -3
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>
+64 -66
View File
@@ -87,11 +87,11 @@
</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: '', // 名称
@@ -102,32 +102,32 @@
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: { methods: {
init() { init () {
this.sysMenuFindAllMenus(); this.sysMenuFindAllMenus()
this.getRouterPath(); this.getRouterPath()
}, },
// 菜单 // 菜单
sysMenuFindAllMenus() { sysMenuFindAllMenus () {
this.$api.menu.sysMenuFindAllMenus().then(({data}) => { this.$api.menu.sysMenuFindAllMenus().then(({ data }) => {
this.tableData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => { this.tableData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort; return a.sort - b.sort
}); })
}) })
}, },
// 新增弹窗 // 新增弹窗
addMenu(row, level) { addMenu (row, level) {
this.mode = 'add'; this.mode = 'add'
this.level = level + 1; this.level = level + 1
this.form = { this.form = {
name: '', // 名称 name: '', // 名称
href: '', // 路径 href: '', // 路径
@@ -137,15 +137,15 @@
remarks: '', // 描述 remarks: '', // 描述
id: '', id: '',
parentId: '', parentId: '',
isUrl: 0, isUrl: 0
}; }
this.form.parentId = row ? row.id : '6f6fafb4a7'; this.form.parentId = row ? row.id : '6f6fafb4a7'
this.dialogMenu = true; this.dialogMenu = true
}, },
// 新增 修改 // 新增 修改
postOrPutSysMenu() { postOrPutSysMenu () {
if (!this.form.name) { if (!this.form.name) {
return this.$message.warning('请输入菜单名称'); return this.$message.warning('请输入菜单名称')
} }
if (this.level === 0 || this.level === 2) { if (this.level === 0 || this.level === 2) {
// if (!this.form.icon) { // if (!this.form.icon) {
@@ -154,91 +154,91 @@
} }
if (this.mode === 'add') { if (this.mode === 'add') {
this.$api.menu.postSysMenu(this.form).then(_ => { this.$api.menu.postSysMenu(this.form).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogMenu = false; this.dialogMenu = false
this.sysMenuFindAllMenus(); this.sysMenuFindAllMenus()
}) })
} }
if (this.mode === 'modify') { if (this.mode === 'modify') {
this.$api.menu.putSysMenu(this.form).then(_ => { this.$api.menu.putSysMenu(this.form).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogMenu = false; this.dialogMenu = false
this.sysMenuFindAllMenus(); this.sysMenuFindAllMenus()
}) })
} }
}, },
// 图标上传 // 图标上传
uploadFile(params) { uploadFile (params) {
let fd = new FormData(); const fd = new FormData()
fd.append('file', params.file); fd.append('file', params.file)
this.$api.report.reportUploadPicFile(fd).then(({data}) => { this.$api.report.reportUploadPicFile(fd).then(({ data }) => {
this.form.icon = data.key; this.form.icon = data.key
this.form.iconHref = data.value; this.form.iconHref = data.value
}) })
}, },
beforeUploadFile(file) { beforeUploadFile (file) {
const isType = (file.type === fileType.png || file.type === fileType.jpg); const isType = (file.type === fileType.png || file.type === fileType.jpg)
const isSize = file.size / 1024 / 1024 < 2; const isSize = file.size / 1024 / 1024 < 2
if (!isType) { if (!isType) {
this.$message.error('仅能上传 pngjpg 格式文件'); this.$message.error('仅能上传 pngjpg 格式文件')
} }
if (!isSize) { if (!isSize) {
this.$message.error('您最大可上传2M文件'); this.$message.error('您最大可上传2M文件')
} }
return isType && isSize; return isType && isSize
}, },
// 删除 // 删除
deleteRow(row) { deleteRow (row) {
this.$confirm('此操作将删除所选数据, 是否继续?', '提示', { this.$confirm('此操作将删除所选数据, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$api.menu.sysMenuDeleteId({ids: row.id}).then(_ => { this.$api.menu.sysMenuDeleteId({ ids: row.id }).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.sysMenuFindAllMenus(); this.sysMenuFindAllMenus()
}) })
}) })
}, },
// 编辑 // 编辑
modifyRow(row, level) { modifyRow (row, level) {
this.level = level; this.level = level
this.mode = 'modify'; this.mode = 'modify'
this.form = JSON.parse(JSON.stringify(row)); this.form = JSON.parse(JSON.stringify(row))
this.dialogMenu = true; this.dialogMenu = true
}, },
// 获取存在路径 // 获取存在路径
getRouterPath() { getRouterPath () {
let pathList = []; const pathList = []
let pathFun = (data, url) => { const pathFun = (data, url) => {
data.forEach(item => { data.forEach(item => {
if (item.children) { if (item.children) {
pathFun(item.children, item.path); pathFun(item.children, item.path)
} else { } else {
pathList.push(`${url ? (url + '/') : ''}${item.path}`); pathList.push(`${url ? (url + '/') : ''}${item.path}`)
} }
}) })
} }
pathFun(this.$router.options.routes); pathFun(this.$router.options.routes)
this.pathList = pathList; this.pathList = pathList
}, }
}, },
computed: { computed: {
dialogTitle() { dialogTitle () {
switch (this.mode) { switch (this.mode) {
case 'add': case 'add':
return '新增'; return '新增'
case 'modify': case 'modify':
return '编辑'; return '编辑'
case 'view': case 'view':
return '查看'; return '查看'
} }
} }
}, },
created() { created () {
this.init(); 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;
+58 -58
View File
@@ -80,10 +80,10 @@
</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,
@@ -100,86 +100,86 @@ export default {
checkStrictly: true checkStrictly: true
}, },
roleId: '', roleId: '',
tableKey: uuidv4(), tableKey: uuidv4()
// isHomePage: null, // 配置首页 1首页 2权限 // isHomePage: null, // 配置首页 1首页 2权限
} }
}, },
methods: { methods: {
init() { init () {
this.getSysRole(); this.getSysRole()
this.sysMenuFindAllMenus(); this.sysMenuFindAllMenus()
}, },
/* =============================================== 角色列表 =============================================== */ /* =============================================== 角色列表 =============================================== */
// 角色列表 // 角色列表
getSysRole() { getSysRole () {
this.$api.role.getSysRole().then(({data}) => { this.$api.role.getSysRole().then(({ data }) => {
this.tableData = data; this.tableData = data
}) })
}, },
// 删除角色 // 删除角色
delSysRole(row) { delSysRole (row) {
this.$confirm('此操作将删除所选角色, 是否继续?', '提示', { this.$confirm('此操作将删除所选角色, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$api.role.delSysRole({id: row.rid}).then(({data}) => { this.$api.role.delSysRole({ id: row.rid }).then(({ data }) => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.getSysRole(); this.getSysRole()
}) })
}) })
}, },
/* =============================================== 角色弹窗 =============================================== */ /* =============================================== 角色弹窗 =============================================== */
// 新增角色 // 新增角色
addRole() { addRole () {
this.mode = 'add'; this.mode = 'add'
this.form = { this.form = {
rname: '', rname: '',
rdesc: '', rdesc: '',
rid: '' rid: ''
} }
this.dialogRole = true; this.dialogRole = true
}, },
// 编辑角色 // 编辑角色
modifyRow(row) { modifyRow (row) {
this.mode = 'modify'; this.mode = 'modify'
this.form = { this.form = {
rname: row.rname, rname: row.rname,
rdesc: row.rdesc, rdesc: row.rdesc,
rid: row.rid rid: row.rid
} }
this.dialogRole = true; this.dialogRole = true
}, },
// 新增 修改 // 新增 修改
postOrPutSysRole() { postOrPutSysRole () {
if (!this.form.rname) { if (!this.form.rname) {
return this.$message.warning('请输入角色名称'); return this.$message.warning('请输入角色名称')
} }
if (this.mode === 'add') { if (this.mode === 'add') {
this.$api.role.postSysRole(this.form).then(_ => { this.$api.role.postSysRole(this.form).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogRole = false; this.dialogRole = false
this.getSysRole(); this.getSysRole()
}) })
} }
if (this.mode === 'modify') { if (this.mode === 'modify') {
this.$api.role.putSysRole(this.form).then(_ => { this.$api.role.putSysRole(this.form).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogRole = false; this.dialogRole = false
this.getSysRole(); this.getSysRole()
}) })
} }
}, },
/* =============================================== 角色权限 =============================================== */ /* =============================================== 角色权限 =============================================== */
// 获取菜单 // 获取菜单
openPermission(row) { openPermission (row) {
this.roleId = row.rid; this.roleId = row.rid
// this.isHomePage = type; // this.isHomePage = type;
// if(type === 2){ // if(type === 2){
this.$api.menu.getSysMenu({roleId: row.rid}).then(({data}) => { this.$api.menu.getSysMenu({ roleId: row.rid }).then(({ data }) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id); this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id)
this.tableKey = uuidv4(); this.tableKey = uuidv4()
this.dialogPermission = true; this.dialogPermission = true
}) })
// }else if(type === 1) { // }else if(type === 1) {
// this.$api.role.sysRoleGetRoleHome({roleId: row.rid}).then(({data}) => { // this.$api.role.sysRoleGetRoleHome({roleId: row.rid}).then(({data}) => {
@@ -193,10 +193,10 @@ export default {
// } // }
}, },
// 获取权限 // 获取权限
getSysMenu(roleId){ getSysMenu (roleId) {
this.$api.menu.getSysMenu({roleId}).then(({data}) => { this.$api.menu.getSysMenu({ roleId }).then(({ data }) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id); this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id)
this.tableKey = uuidv4(); this.tableKey = uuidv4()
}) })
}, },
// 获取首页 // 获取首页
@@ -210,22 +210,22 @@ export default {
// }) // })
// }, // },
// 添加权限 // 添加权限
sysRoleSaveRoleMenu() { sysRoleSaveRoleMenu () {
// 获取全部选中和半选中的数据 // 获取全部选中和半选中的数据
let checkedData = this.$refs.rolePermission.getCheckboxRecords(); const checkedData = this.$refs.rolePermission.getCheckboxRecords()
let indeterminateData = this.$refs.rolePermission.getCheckboxIndeterminateRecords(); const indeterminateData = this.$refs.rolePermission.getCheckboxIndeterminateRecords()
let allCheckData = []; let allCheckData = []
allCheckData = checkedData.concat(indeterminateData); allCheckData = checkedData.concat(indeterminateData)
let ids = allCheckData.map(item => item.id); const ids = allCheckData.map(item => item.id)
let params = { const params = {
rid: this.roleId, rid: this.roleId,
menusstr: ids menusstr: ids
} }
this.$api.role.sysRoleSaveRoleMenu(params).then(_ => { this.$api.role.sysRoleSaveRoleMenu(params).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogPermission = false; this.dialogPermission = false
}) })
}, },
// // 首页配置 // // 首页配置
@@ -242,29 +242,29 @@ export default {
// }, // },
// 菜单 // 菜单
sysMenuFindAllMenus() { sysMenuFindAllMenus () {
this.$api.menu.sysMenuFindAllMenus().then(({data}) => { this.$api.menu.sysMenuFindAllMenus().then(({ data }) => {
this.treeData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => { this.treeData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort; return a.sort - b.sort
});
}) })
}, })
}
}, },
computed: { computed: {
dialogTitle() { dialogTitle () {
switch (this.mode) { switch (this.mode) {
case 'add': case 'add':
return '新增'; return '新增'
case 'modify': case 'modify':
return '编辑'; return '编辑'
case 'view': case 'view':
return '查看'; return '查看'
} }
} }
}, },
created() { created () {
this.init(); this.init()
} }
} }
</script> </script>
+92 -93
View File
@@ -123,17 +123,17 @@
</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: [],
@@ -147,56 +147,56 @@ export default {
password: '', // 密码 password: '', // 密码
usid: '', usid: '',
usname: '', // 姓名 usname: '', // 姓名
roleIdList: [''], // 角色 roleIdList: [''] // 角色
}, },
repassword: '', repassword: '',
roleList: [], roleList: []
} }
}, },
methods: { methods: {
search(){ search () {
this.q.pageNo = 1; this.q.pageNo = 1
this.sysUserList(); this.sysUserList()
}, },
// 获取所有用户 // 获取所有用户
sysUserList() { sysUserList () {
this.$api.user.sysUserList(this.q).then(({data}) => { this.$api.user.sysUserList(this.q).then(({ data }) => {
this.tableData = data.records; this.tableData = data.records
this.total = data.total; this.total = data.total
this.q.pageNo = data.current; this.q.pageNo = data.current
this.q.pageSize = data.size; this.q.pageSize = data.size
if(!data.records.length && this.q.pageNo !== 1){ if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1; this.q.pageNo = 1
this.sysUserList(); this.sysUserList()
} }
}) })
}, },
// 重置 // 重置
reset() { reset () {
this.q = { this.q = {
account: '', // 用户名 account: '', // 用户名
roleName: '', // 角色名称 roleName: '', // 角色名称
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
}; }
this.total = 0; this.total = 0
this.tableData = []; this.tableData = []
this.sysUserList(); this.sysUserList()
}, },
// 单页数据量 // 单页数据量
handleSizeChange(val) { handleSizeChange (val) {
this.q.pageSize = val; this.q.pageSize = val
this.q.pageNo = 1; this.q.pageNo = 1
this.sysUserList(); this.sysUserList()
}, },
// 第几页 // 第几页
handleCurrentChange(val) { handleCurrentChange (val) {
this.q.pageNo = val; this.q.pageNo = val
this.sysUserList(); this.sysUserList()
}, },
// 新增 // 新增
add() { add () {
this.mode = 'add'; this.mode = 'add'
this.form = { this.form = {
account: '', // 用户名 account: '', // 用户名
cellPhoneNumber: '', // 手机号 cellPhoneNumber: '', // 手机号
@@ -205,35 +205,35 @@ export default {
password: '', // 密码 password: '', // 密码
usid: '', usid: '',
usname: '', // 姓名 usname: '', // 姓名
roleIdList: [''], // 角色 roleIdList: [''] // 角色
}; }
this.repassword = ''; this.repassword = ''
this.dialogUser = true; this.dialogUser = true
}, },
// 启用/禁用 // 启用/禁用
sysUserIsUse(val, row) { sysUserIsUse (val, row) {
this.$confirm(val === '0' ? '此操作将禁用所选用户, 是否继续?' : '此操作将启用所选用户, 是否继续?', '提示', { this.$confirm(val === '0' ? '此操作将禁用所选用户, 是否继续?' : '此操作将启用所选用户, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$api.user.sysUserIsUse({USID: row.USID, type: val}).then(_ => { this.$api.user.sysUserIsUse({ USID: row.USID, type: val }).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.sysUserList(); this.sysUserList()
}) })
}).catch(() => { }).catch(() => {
row.ISUSE = val === '1' ? '0' : '1'; row.ISUSE = val === '1' ? '0' : '1'
}); })
}, },
// 删除 // 删除
deleteRow(row) { deleteRow (row) {
this.deleteUser(row.USID); this.deleteUser(row.USID)
}, },
// 验证 // 验证
checkUserForm() { checkUserForm () {
if (this.mode === 'add') { if (this.mode === 'add') {
if (!this.form.account || !(/^[a-zA-Z0-9]*$/.test(this.form.account))) { if (!this.form.account || !(/^[a-zA-Z0-9]*$/.test(this.form.account))) {
return this.$message.warning('用户名只能为纯数字、纯字母或字母数字组合') && false; return this.$message.warning('用户名只能为纯数字、纯字母或字母数字组合') && false
} }
// // 密码 // // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) { // if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
@@ -243,7 +243,7 @@ export default {
// return this.$message.warning('请检查密码') && false; // return this.$message.warning('请检查密码') && false;
// } // }
} }
if(this.mode === 'modify'){ if (this.mode === 'modify') {
// if (this.form.password || this.repassword) { // if (this.form.password || this.repassword) {
// // 密码 // // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) { // if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
@@ -255,35 +255,35 @@ export default {
// } // }
} }
if (this.form.cellPhoneNumber && !(/^1[3|4|5|7|8|9][0-9]{9}$/.test(this.form.cellPhoneNumber))) { if (this.form.cellPhoneNumber && !(/^1[3|4|5|7|8|9][0-9]{9}$/.test(this.form.cellPhoneNumber))) {
return this.$message.warning('请检查手机号') && false; 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))) { 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; return this.$message.warning('请检查邮箱') && false
} }
if (!this.form.roleIdList[0]) { if (!this.form.roleIdList[0]) {
return this.$message.warning('请选择角色') && false; return this.$message.warning('请选择角色') && false
} }
if (!this.form.usname) { if (!this.form.usname) {
return this.$message.warning('请输入姓名') && false; return this.$message.warning('请输入姓名') && false
} }
return true; return true
}, },
// 新增用户 // 新增用户
sysUserAddUser() { sysUserAddUser () {
if (!this.checkUserForm()) return; if (!this.checkUserForm()) return
let data = JSON.parse(JSON.stringify(this.form)); const data = JSON.parse(JSON.stringify(this.form))
data.account = this.$JSEncrypt(data.account); data.account = this.$JSEncrypt(data.account)
data.password = this.$JSEncrypt(data.password); data.password = this.$JSEncrypt(data.password)
let jsonData = JSON.stringify(data); const jsonData = JSON.stringify(data)
this.$api.user.sysUserAddUser(Base64.encodeURI(jsonData)).then(_ => { this.$api.user.sysUserAddUser(Base64.encodeURI(jsonData)).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.dialogUser = false; this.dialogUser = false
this.reset(); this.reset()
}) })
}, },
// 编辑查看用户 // 编辑查看用户
openRowData(mode, row) { openRowData (mode, row) {
this.mode = mode; this.mode = mode
this.form = { this.form = {
account: row.ACCOUNT, // 用户名 account: row.ACCOUNT, // 用户名
cellPhoneNumber: row.CELLPHONE_NUMBER, // 手机号 cellPhoneNumber: row.CELLPHONE_NUMBER, // 手机号
@@ -292,75 +292,74 @@ export default {
password: '', // 密码 password: '', // 密码
usid: row.USID, // 用户ID usid: row.USID, // 用户ID
usname: row.USNAME, // 姓名 usname: row.USNAME, // 姓名
roleIdList: [row.ROLEID], // 角色 roleIdList: [row.ROLEID] // 角色
} }
this.repassword = ''; this.repassword = ''
this.dialogUser = true; this.dialogUser = true
}, },
newAddFunc(){ newAddFunc () {
}, },
uploadPDFSuccess(response, file, fileList) { uploadPDFSuccess (response, file, fileList) {
if (response.ok) { if (response.ok) {
this.$message.success('导入成功'); this.$message.success('导入成功')
this.reset() this.reset()
} else { } else {
this.$message.error(response.message); this.$message.error(response.message)
} }
}, },
downloadTemp(){ downloadTemp () {
window.open('/library/api/sys/user/template') window.open('/library/api/sys/user/template')
}, },
// 多选用户 // 多选用户
getSelectUser() { getSelectUser () {
let users = this.$refs.userTable.getCheckboxRecords(); const users = this.$refs.userTable.getCheckboxRecords()
if (!users.length) { if (!users.length) {
return this.$message.warning('请选择数据后在进行操作'); return this.$message.warning('请选择数据后在进行操作')
} }
let ids = users.map(item => item.USID).join(','); const ids = users.map(item => item.USID).join(',')
this.deleteUser(ids); this.deleteUser(ids)
}, },
// 删除用户 // 删除用户
deleteUser(ids) { deleteUser (ids) {
this.$confirm('此操作将删除所选用户, 是否继续?', '提示', { this.$confirm('此操作将删除所选用户, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$api.user.sysUserDelete({ids}).then(_ => { this.$api.user.sysUserDelete({ ids }).then(_ => {
this.$message.success('操作成功'); this.$message.success('操作成功')
this.sysUserList(); this.sysUserList()
}) })
}) })
}, },
// 角色列表 // 角色列表
getSysRole() { getSysRole () {
this.$api.role.getSysRole().then(({data}) => { this.$api.role.getSysRole().then(({ data }) => {
this.roleList = data; this.roleList = data
}) })
}, }
}, },
computed: { computed: {
dialogTitle() { dialogTitle () {
switch (this.mode) { switch (this.mode) {
case 'add': case 'add':
return '新增'; return '新增'
case 'modify': case 'modify':
return '编辑'; return '编辑'
case 'view': case 'view':
return '查看'; return '查看'
} }
} }
}, },
created() { created () {
this.sysUserList(); this.sysUserList()
this.getSysRole(); this.getSysRole()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.system-user { .system-user {
.title { .title {
+12 -13
View File
@@ -7,28 +7,28 @@
<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() changeMobsfIframe()
@@ -37,7 +37,7 @@
changeMobsfIframe() 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;
+5 -5
View File
@@ -1,8 +1,8 @@
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',
@@ -13,7 +13,7 @@ module.exports = {
// 配置跨域 // 配置跨域
'/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': {
@@ -45,9 +45,9 @@ module.exports = {
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"
}) })
] ]
}, }
} }