调整前端代码格式符合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
+105 -107
View File
@@ -20,115 +20,113 @@
</template>
<script>
import Header from '@/components/Header';
import Menu from '@/components/Menu';
import Header from '@/components/Header'
import Menu from '@/components/Menu'
export default {
name: "Layout",
components: {
Header,
Menu
},
data() {
return {
menuData: []
}
},
watch: {
'$route.path': {
handler(val) {
this.getMenu();
},
deep: true
}
},
methods: {
handleTree(arr, parentId) {
let cloneData = JSON.parse(JSON.stringify(arr)); // 对源数据深度克隆
return cloneData.filter((father) => {
let branchArr = cloneData.filter(child => father.id === child.parentId); //返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null; //如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId === parentId; //返回第一层
})
},
addLevel(data, level) {
data.forEach(item => {
item.level = level;
if (item.children) {
this.addLevel(item.children, level + 1);
}
});
return data;
},
getMenu() {
if (!this.$route.query.id) {
return this.$router.push({path: '/report/list', query:{"id": "AEHJB8YNJ3"}});
}
let data = JSON.parse(JSON.stringify(this.$store.state.menuData));
let menu = data.filter(item => item.parentId === this.$route.query.id);
let menuData = [];
let menuFun = (menu) => {
menuData = [...menuData, ...menu];
let parentIds = menu.map(item => item.id);
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.parentId)))
}
};
menuFun(menu);
let treeData = this.handleTree(menuData, this.$route.query.id);
this.menuData = this.addLevel(treeData, 1);
},
getSysMenu() {
this.$api.menu.getSysMenu({roleId: this.$store.state.userInfo.roleIdList[0]}).then(({data}) => {
debugger
if (data === null) {
data = []
}
data = data.sort((a, b) => a.sort - b.sort);
let menu = data.filter(item => item.belong);
let menuData = [];
let menuFun = (menu) => {
menuData = [...menuData, ...menu]
let parentIds = menu.map(item => item.parentId);
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.id)))
}
}
menuFun(menu);
let treeData = menuData.map(item => ({
id: item.id,
parentId: item.parentId,
label: item.name,
href: item.href,
icon: item.iconHref,
isCollage: true,
belong: item.belong,
isUrl: item.isUrl
}));
// 去重
let obj = {};
treeData.forEach(item => {
obj[item.id] = item;
})
debugger
this.$store.commit('saveMenuData', Object.values(obj));
this.getMenu();
});
}
},
created() {
// 判定菜单是否存在,存在则不加载
// let menuData = this.$store.state.menuData;
// debugger
// if (menuData.length == 0) {
this.getSysMenu();
// } else {
// this.getMenu();
// }
}
export default {
name: 'Layout',
components: {
Header,
Menu
},
data () {
return {
menuData: []
}
},
watch: {
'$route.path': {
handler (val) {
this.getMenu()
},
deep: true
}
},
methods: {
handleTree (arr, parentId) {
const cloneData = JSON.parse(JSON.stringify(arr)) // 对源数据深度克隆
return cloneData.filter((father) => {
const branchArr = cloneData.filter(child => father.id === child.parentId) // 返回每一项的子级数组
father.children = branchArr.length > 0 ? branchArr : null // 如果存在子级,则给父级添加一个children属性,并赋值
return father.parentId === parentId // 返回第一层
})
},
addLevel (data, level) {
data.forEach(item => {
item.level = level
if (item.children) {
this.addLevel(item.children, level + 1)
}
})
return data
},
getMenu () {
if (!this.$route.query.id) {
return this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } })
}
const data = JSON.parse(JSON.stringify(this.$store.state.menuData))
const menu = data.filter(item => item.parentId === this.$route.query.id)
let menuData = []
const menuFun = (menu) => {
menuData = [...menuData, ...menu]
const parentIds = menu.map(item => item.id)
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.parentId)))
}
}
menuFun(menu)
const treeData = this.handleTree(menuData, this.$route.query.id)
this.menuData = this.addLevel(treeData, 1)
},
getSysMenu () {
this.$api.menu.getSysMenu({ roleId: this.$store.state.userInfo.roleIdList[0] }).then(({ data }) => {
if (data === null) {
data = []
}
data = data.sort((a, b) => a.sort - b.sort)
const menu = data.filter(item => item.belong)
let menuData = []
const menuFun = (menu) => {
menuData = [...menuData, ...menu]
const parentIds = menu.map(item => item.parentId)
if (parentIds.length) {
menuFun(data.filter(item => parentIds.find(el => el === item.id)))
}
}
menuFun(menu)
const treeData = menuData.map(item => ({
id: item.id,
parentId: item.parentId,
label: item.name,
href: item.href,
icon: item.iconHref,
isCollage: true,
belong: item.belong,
isUrl: item.isUrl
}))
// 去重
const obj = {}
treeData.forEach(item => {
obj[item.id] = item
})
this.$store.commit('saveMenuData', Object.values(obj))
this.getMenu()
})
}
},
created () {
// 判定菜单是否存在,存在则不加载
// let menuData = this.$store.state.menuData;
// debugger
// if (menuData.length == 0) {
this.getSysMenu()
// } else {
// this.getMenu();
// }
}
}
</script>
<style lang="scss" scoped>
+84 -83
View File
@@ -37,91 +37,92 @@
</template>
<script>
import {Base64} from "js-base64";
import { Base64 } from 'js-base64'
export default {
name: "Login",
data() {
return {
form: {
username: '',
password: '',
verifyCode: '',
},
verifyImg: '',
isChecked: false,
}
},
created() {
this.init();
},
methods: {
getQueryVariable(r, variable) {
if (r) {
var query = r.split('?');
if (query && query.length == 2) {
var vars = query[1].split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
}
},
init() {
this.isChecked = !!this.$store.state.rememberData;
if (this.isChecked) {
this.form.username = this.$store.state.rememberData.username;
this.form.password = this.$store.state.rememberData.password;
}
this.verifyCode();
},
// 登录
login() {
if (!this.form.username) {
return this.$message.warning('请输入用户名')
}
if (!this.form.password) {
return this.$message.warning('请输入密码')
}
if (!this.form.verifyCode) {
return this.$message.warning('请输入验证码')
}
if (this.form.verifyCode.length !== 4) {
return this.$message.warning('请检查验证码')
}
this.$store.commit('saveRememberData', this.isChecked ? {
username: this.form.username,
password: this.form.password
} : null);
let data = JSON.parse(JSON.stringify(this.form));
data.username = this.$JSEncrypt(data.username);
data.password = this.$JSEncrypt(data.password);
let jsonData = JSON.stringify(data);
this.$api.login.login(Base64.encode(jsonData)).then(res => {
if (res.respCode !== '0') {
this.verifyCode();
return this.$message.error(res.data.message);
}
this.$message.success('登录成功');
this.$store.commit('saveUserInfo', res.data);
this.$router.push({path: '/report/list', query:{"id": "AEHJB8YNJ3"}});
}).catch(_ => {
this.verifyCode();
})
},
// 获取验证码
verifyCode() {
this.$api.login.verifyCode({})
.then(res => {
this.verifyImg = `data: image/jpeg;base64,${btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))}`
})
},
}
export default {
name: 'Login',
data () {
return {
form: {
username: '',
password: '',
verifyCode: ''
},
verifyImg: '',
isChecked: false
}
},
created () {
this.init()
},
methods: {
getQueryVariable (r, variable) {
if (r) {
const query = r.split('?')
if (query && query.length == 2) {
const vars = query[1].split('&')
for (let i = 0; i < vars.length; i++) {
const pair = vars[i].split('=')
if (pair[0] == variable) {
return pair[1]
}
}
}
}
},
init () {
this.isChecked = !!this.$store.state.rememberData
if (this.isChecked) {
this.form.username = this.$store.state.rememberData.username
this.form.password = this.$store.state.rememberData.password
}
this.verifyCode()
},
// 登录
login () {
if (!this.form.username) {
return this.$message.warning('请输入用户名')
}
if (!this.form.password) {
return this.$message.warning('请输入密码')
}
if (!this.form.verifyCode) {
return this.$message.warning('请输入验证码')
}
if (this.form.verifyCode.length !== 4) {
return this.$message.warning('请检查验证码')
}
this.$store.commit('saveRememberData', this.isChecked
? {
username: this.form.username,
password: this.form.password
}
: null)
const data = JSON.parse(JSON.stringify(this.form))
data.username = this.$JSEncrypt(data.username)
data.password = this.$JSEncrypt(data.password)
const jsonData = JSON.stringify(data)
this.$api.login.login(Base64.encode(jsonData)).then(res => {
if (res.respCode !== '0') {
this.verifyCode()
return this.$message.error(res.data.message)
}
this.$message.success('登录成功')
this.$store.commit('saveUserInfo', res.data)
this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } })
}).catch(_ => {
this.verifyCode()
})
},
// 获取验证码
verifyCode () {
this.$api.login.verifyCode({})
.then(res => {
this.verifyImg = `data: image/jpeg;base64,${btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))}`
})
}
}
}
</script>
<style lang="scss" scoped>
+1 -1
View File
@@ -6,7 +6,7 @@
<script>
export default {
name: "Register"
name: 'Register'
}
</script>
+40 -40
View File
@@ -32,48 +32,48 @@
</template>
<script>
import {downloadFile} from "@/utils/downloadFile";
import {formatDate} from '@/utils/date'
import { downloadFile } from '@/utils/downloadFile'
import { formatDate } from '@/utils/date'
export default {
name: "ReportDetail",
data(){
return {
watermarkText: '', // 水印
content: '',
row: {},
}
},
methods: {
// 预览
previewRow() {
if(!this.$route.query.row){
this.$router.push({path: '/report/list', query: {id: this.$route.query.id}});
return
}
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`;
this.row = JSON.parse(this.$route.query.row);
this.$api.report.reportGetReportHtmlId({id: this.row.id}).then(({data}) => {
this.content = data.content;
})
},
// 下载
downloadRow(row){
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => {
downloadFile(res);
})
// })
}
},
created() {
this.previewRow();
}
export default {
name: 'ReportDetail',
data () {
return {
watermarkText: '', // 水印
content: '',
row: {}
}
},
methods: {
// 预览
previewRow () {
if (!this.$route.query.row) {
this.$router.push({ path: '/report/list', query: { id: this.$route.query.id } })
return
}
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`
this.row = JSON.parse(this.$route.query.row)
this.$api.report.reportGetReportHtmlId({ id: this.row.id }).then(({ data }) => {
this.content = data.content
})
},
// 下载
downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res)
})
// })
}
},
created () {
this.previewRow()
}
}
</script>
<style lang="scss" scoped>
+170 -170
View File
@@ -163,180 +163,180 @@
</template>
<script>
import {downloadFile} from "@/utils/downloadFile";
import {formatDate} from '@/utils/date'
import { downloadFile } from '@/utils/downloadFile'
import { formatDate } from '@/utils/date'
export default {
name: "ReportList",
data() {
return {
watermarkText: '', // 水印
fullscreen: false,
q: {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10,
},
total: 0,
tableData: [],
yearList: [],
tagData: {
1: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
2: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
3: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
},
dialogPreview: false, // 预览
content: '',
name: 'ReportList',
data () {
return {
watermarkText: '', // 水印
fullscreen: false,
q: {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
},
total: 0,
tableData: [],
yearList: [],
tagData: {
1: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
},
2: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
},
3: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
}
},
methods: {
init() {
this.labelList();
this.reportDateList();
this.reportList();
},
// 标签列表
labelList() {
this.$api.report.labelList().then(({data}) => {
this.tagData[1].name = data.labelOne.name;
this.tagData[2].name = data.labelTwo.name;
this.tagData[3].name = data.labelThree.name;
this.tagData[1].tags = data.labelOne.childList;
this.tagData[2].tags = data.labelTwo.childList;
this.tagData[3].tags = data.labelThree.childList;
})
},
search(){
this.q.pageNo = 1;
this.reportList();
},
// 列表
reportList() {
this.$api.report.reportList(this.q).then(({data}) => {
this.tableData = data.records;
this.total = data.total;
this.q.pageNo = data.current;
this.q.pageSize = data.size;
if(!data.records.length && this.q.pageNo !== 1){
this.q.pageNo = 1;
this.reportList();
}
})
},
// 监听全选按钮
handleCheckAllChange(val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
}
this.tagData[type].isIndeterminate = !val;
},
// 监听group checkbox
handleCheckedTagsChange(val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length);
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length;
},
// 切换展开隐藏
switchTagShow(type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow;
},
// 日期列表
reportDateList() {
this.$api.report.reportDateList().then(({data}) => {
this.yearList = data.list;
})
},
// 单页数据量
handleSizeChange(val) {
this.q.pageSize = val;
this.q.pageNo = 1;
this.reportList();
},
// 第几页
handleCurrentChange(val) {
this.q.pageNo = val;
this.reportList();
},
// 预览
previewRow(row) {
this.fullscreen = false;
// 更新预览水印的时间戳
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`;
this.$api.report.reportGetReportHtmlId({id: row.id}).then(({data}) => {
this.content = data.content;
this.dialogPreview = true;
})
},
// 重置
reset() {
this.q = {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10,
};
this.total = 0;
this.tableData = [];
this.tagData[1].checkAll = false;
this.tagData[1].isIndeterminate = true;
this.tagData[2].checkAll = false;
this.tagData[2].isIndeterminate = true;
this.tagData[3].checkAll = false;
this.tagData[3].isIndeterminate = true;
this.reportList();
},
// 下载
downloadRow(row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => {
downloadFile(res);
})
// })
},
// 跳转到详情
goReportDetail(row) {
this.$router.push({path: '/report/detail', query: {id: this.$route.query.id, row: JSON.stringify(row)}});
}
},
created() {
this.init();
},
dialogPreview: false, // 预览
content: ''
}
},
methods: {
init () {
this.labelList()
this.reportDateList()
this.reportList()
},
// 标签列表
labelList () {
this.$api.report.labelList().then(({ data }) => {
this.tagData[1].name = data.labelOne.name
this.tagData[2].name = data.labelTwo.name
this.tagData[3].name = data.labelThree.name
this.tagData[1].tags = data.labelOne.childList
this.tagData[2].tags = data.labelTwo.childList
this.tagData[3].tags = data.labelThree.childList
})
},
search () {
this.q.pageNo = 1
this.reportList()
},
// 列表
reportList () {
this.$api.report.reportList(this.q).then(({ data }) => {
this.tableData = data.records
this.total = data.total
this.q.pageNo = data.current
this.q.pageSize = data.size
if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1
this.reportList()
}
})
},
// 监听全选按钮
handleCheckAllChange (val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : []
break
}
this.tagData[type].isIndeterminate = !val
},
// 监听group checkbox
handleCheckedTagsChange (val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length)
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length
},
// 切换展开隐藏
switchTagShow (type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow
},
// 日期列表
reportDateList () {
this.$api.report.reportDateList().then(({ data }) => {
this.yearList = data.list
})
},
// 单页数据量
handleSizeChange (val) {
this.q.pageSize = val
this.q.pageNo = 1
this.reportList()
},
// 第几页
handleCurrentChange (val) {
this.q.pageNo = val
this.reportList()
},
// 预览
previewRow (row) {
this.fullscreen = false
// 更新预览水印的时间戳
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`
this.$api.report.reportGetReportHtmlId({ id: row.id }).then(({ data }) => {
this.content = data.content
this.dialogPreview = true
})
},
// 重置
reset () {
this.q = {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
}
this.total = 0
this.tableData = []
this.tagData[1].checkAll = false
this.tagData[1].isIndeterminate = true
this.tagData[2].checkAll = false
this.tagData[2].isIndeterminate = true
this.tagData[3].checkAll = false
this.tagData[3].isIndeterminate = true
this.reportList()
},
// 下载
downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res)
})
// })
},
// 跳转到详情
goReportDetail (row) {
this.$router.push({ path: '/report/detail', query: { id: this.$route.query.id, row: JSON.stringify(row) } })
}
},
created () {
this.init()
}
}
</script>
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -5,13 +5,13 @@
</template>
<script>
export default {
name: 'Page401',
data() {
return {}
},
methods: {}
}
export default {
name: 'Page401',
data () {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
+150 -152
View File
@@ -87,158 +87,158 @@
</template>
<script>
import {fileType} from "@/utils/fileType";
import { fileType } from '@/utils/fileType'
export default {
name: "MenuManager",
data() {
return {
form: {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0,
},
tableData: [],
dialogMenu: false,
mode: '',
pathList: [],
level: 0,
}
},
methods: {
init() {
this.sysMenuFindAllMenus();
this.getRouterPath();
},
// 菜单
sysMenuFindAllMenus() {
this.$api.menu.sysMenuFindAllMenus().then(({data}) => {
this.tableData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort;
});
})
},
// 新增弹窗
addMenu(row, level) {
this.mode = 'add';
this.level = level + 1;
this.form = {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0,
};
this.form.parentId = row ? row.id : '6f6fafb4a7';
this.dialogMenu = true;
},
// 新增 修改
postOrPutSysMenu() {
if (!this.form.name) {
return this.$message.warning('请输入菜单名称');
}
if (this.level === 0 || this.level === 2) {
// if (!this.form.icon) {
// return this.$message.warning('请上传菜单图标');
// }
}
if (this.mode === 'add') {
this.$api.menu.postSysMenu(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogMenu = false;
this.sysMenuFindAllMenus();
})
}
if (this.mode === 'modify') {
this.$api.menu.putSysMenu(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogMenu = false;
this.sysMenuFindAllMenus();
})
}
},
// 图标上传
uploadFile(params) {
let fd = new FormData();
fd.append('file', params.file);
this.$api.report.reportUploadPicFile(fd).then(({data}) => {
this.form.icon = data.key;
this.form.iconHref = data.value;
})
},
beforeUploadFile(file) {
const isType = (file.type === fileType.png || file.type === fileType.jpg);
const isSize = file.size / 1024 / 1024 < 2;
if (!isType) {
this.$message.error('仅能上传 pngjpg 格式文件');
}
if (!isSize) {
this.$message.error('您最大可上传2M文件');
}
return isType && isSize;
},
// 删除
deleteRow(row) {
this.$confirm('此操作将删除所选数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.menu.sysMenuDeleteId({ids: row.id}).then(_ => {
this.$message.success('操作成功');
this.sysMenuFindAllMenus();
})
})
},
// 编辑
modifyRow(row, level) {
this.level = level;
this.mode = 'modify';
this.form = JSON.parse(JSON.stringify(row));
this.dialogMenu = true;
},
// 获取存在路径
getRouterPath() {
let pathList = [];
let pathFun = (data, url) => {
data.forEach(item => {
if (item.children) {
pathFun(item.children, item.path);
} else {
pathList.push(`${url ? (url + '/') : ''}${item.path}`);
}
})
}
pathFun(this.$router.options.routes);
this.pathList = pathList;
},
},
computed: {
dialogTitle() {
switch (this.mode) {
case 'add':
return '新增';
case 'modify':
return '编辑';
case 'view':
return '查看';
}
}
},
created() {
this.init();
}
export default {
name: 'MenuManager',
data () {
return {
form: {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0
},
tableData: [],
dialogMenu: false,
mode: '',
pathList: [],
level: 0
}
},
methods: {
init () {
this.sysMenuFindAllMenus()
this.getRouterPath()
},
// 菜单
sysMenuFindAllMenus () {
this.$api.menu.sysMenuFindAllMenus().then(({ data }) => {
this.tableData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort
})
})
},
// 新增弹窗
addMenu (row, level) {
this.mode = 'add'
this.level = level + 1
this.form = {
name: '', // 名称
href: '', // 路径
icon: '', // 图标
iconHref: '', // 图标路径
sort: '', // 排序
remarks: '', // 描述
id: '',
parentId: '',
isUrl: 0
}
this.form.parentId = row ? row.id : '6f6fafb4a7'
this.dialogMenu = true
},
// 新增 修改
postOrPutSysMenu () {
if (!this.form.name) {
return this.$message.warning('请输入菜单名称')
}
if (this.level === 0 || this.level === 2) {
// if (!this.form.icon) {
// return this.$message.warning('请上传菜单图标');
// }
}
if (this.mode === 'add') {
this.$api.menu.postSysMenu(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogMenu = false
this.sysMenuFindAllMenus()
})
}
if (this.mode === 'modify') {
this.$api.menu.putSysMenu(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogMenu = false
this.sysMenuFindAllMenus()
})
}
},
// 图标上传
uploadFile (params) {
const fd = new FormData()
fd.append('file', params.file)
this.$api.report.reportUploadPicFile(fd).then(({ data }) => {
this.form.icon = data.key
this.form.iconHref = data.value
})
},
beforeUploadFile (file) {
const isType = (file.type === fileType.png || file.type === fileType.jpg)
const isSize = file.size / 1024 / 1024 < 2
if (!isType) {
this.$message.error('仅能上传 pngjpg 格式文件')
}
if (!isSize) {
this.$message.error('您最大可上传2M文件')
}
return isType && isSize
},
// 删除
deleteRow (row) {
this.$confirm('此操作将删除所选数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.menu.sysMenuDeleteId({ ids: row.id }).then(_ => {
this.$message.success('操作成功')
this.sysMenuFindAllMenus()
})
})
},
// 编辑
modifyRow (row, level) {
this.level = level
this.mode = 'modify'
this.form = JSON.parse(JSON.stringify(row))
this.dialogMenu = true
},
// 获取存在路径
getRouterPath () {
const pathList = []
const pathFun = (data, url) => {
data.forEach(item => {
if (item.children) {
pathFun(item.children, item.path)
} else {
pathList.push(`${url ? (url + '/') : ''}${item.path}`)
}
})
}
pathFun(this.$router.options.routes)
this.pathList = pathList
}
},
computed: {
dialogTitle () {
switch (this.mode) {
case 'add':
return '新增'
case 'modify':
return '编辑'
case 'view':
return '查看'
}
}
},
created () {
this.init()
}
}
</script>
<style lang="scss" scoped>
@@ -324,7 +324,6 @@
// margin-left: -1.5px;
// }
.menu-image {
display: flex;
align-items: center;
@@ -434,7 +433,6 @@
}
}
.icon-menu-text {
display: flex;
width: 36px;
+184 -184
View File
@@ -80,192 +80,192 @@
</template>
<script>
import {v4 as uuidv4} from 'uuid';
import { v4 as uuidv4 } from 'uuid'
export default {
name: "Role",
data() {
return {
tableData: [], // 角色列表
dialogRole: false,
mode: '',
form: {
rname: '',
rdesc: '',
rid: ''
},
dialogPermission: false,
treeData: [],
checkboxConfig: {
checkRowKeys: [],
checkStrictly: true
},
roleId: '',
tableKey: uuidv4(),
// isHomePage: null, // 配置首页 1首页 2权限
}
},
methods: {
init() {
this.getSysRole();
this.sysMenuFindAllMenus();
},
/* =============================================== 角色列表 =============================================== */
// 角色列表
getSysRole() {
this.$api.role.getSysRole().then(({data}) => {
this.tableData = data;
})
},
// 删除角色
delSysRole(row) {
this.$confirm('此操作将删除所选角色, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.role.delSysRole({id: row.rid}).then(({data}) => {
this.$message.success('操作成功');
this.getSysRole();
})
})
},
/* =============================================== 角色弹窗 =============================================== */
// 新增角色
addRole() {
this.mode = 'add';
this.form = {
rname: '',
rdesc: '',
rid: ''
}
this.dialogRole = true;
},
// 编辑角色
modifyRow(row) {
this.mode = 'modify';
this.form = {
rname: row.rname,
rdesc: row.rdesc,
rid: row.rid
}
this.dialogRole = true;
},
// 新增 修改
postOrPutSysRole() {
if (!this.form.rname) {
return this.$message.warning('请输入角色名称');
}
if (this.mode === 'add') {
this.$api.role.postSysRole(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogRole = false;
this.getSysRole();
})
}
if (this.mode === 'modify') {
this.$api.role.putSysRole(this.form).then(_ => {
this.$message.success('操作成功');
this.dialogRole = false;
this.getSysRole();
})
}
},
/* =============================================== 角色权限 =============================================== */
// 获取菜单
openPermission(row) {
this.roleId = row.rid;
// this.isHomePage = type;
// if(type === 2){
this.$api.menu.getSysMenu({roleId: row.rid}).then(({data}) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
this.tableKey = uuidv4();
this.dialogPermission = true;
})
// }else if(type === 1) {
// this.$api.role.sysRoleGetRoleHome({roleId: row.rid}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// this.dialogPermission = true;
// })
// }
},
// 获取权限
getSysMenu(roleId){
this.$api.menu.getSysMenu({roleId}).then(({data}) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
this.tableKey = uuidv4();
})
},
// 获取首页
// getSysHome(roleId){
// this.$api.role.sysRoleGetRoleHome({roleId}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// })
// },
// 添加权限
sysRoleSaveRoleMenu() {
// 获取全部选中和半选中的数据
let checkedData = this.$refs.rolePermission.getCheckboxRecords();
let indeterminateData = this.$refs.rolePermission.getCheckboxIndeterminateRecords();
let allCheckData = [];
allCheckData = checkedData.concat(indeterminateData);
let ids = allCheckData.map(item => item.id);
let params = {
rid: this.roleId,
menusstr: ids
}
this.$api.role.sysRoleSaveRoleMenu(params).then(_ => {
this.$message.success('操作成功');
this.dialogPermission = false;
})
},
// // 首页配置
// sysRoleSaveRoleHome(){
// let ids = this.$refs.rolePermission.getCheckboxRecords().map(item => item.id);
// let params = {
// rid: this.roleId,
// menusstr: ids
// }
// this.$api.role.sysRoleSaveRoleHome(params).then(_ => {
// this.$message.success('操作成功');
// this.dialogPermission = false;
// })
// },
// 菜单
sysMenuFindAllMenus() {
this.$api.menu.sysMenuFindAllMenus().then(({data}) => {
this.treeData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort;
});
})
},
},
computed: {
dialogTitle() {
switch (this.mode) {
case 'add':
return '新增';
case 'modify':
return '编辑';
case 'view':
return '查看';
}
}
},
created() {
this.init();
name: 'Role',
data () {
return {
tableData: [], // 角色列表
dialogRole: false,
mode: '',
form: {
rname: '',
rdesc: '',
rid: ''
},
dialogPermission: false,
treeData: [],
checkboxConfig: {
checkRowKeys: [],
checkStrictly: true
},
roleId: '',
tableKey: uuidv4()
// isHomePage: null, // 配置首页 1首页 2权限
}
},
methods: {
init () {
this.getSysRole()
this.sysMenuFindAllMenus()
},
/* =============================================== 角色列表 =============================================== */
// 角色列表
getSysRole () {
this.$api.role.getSysRole().then(({ data }) => {
this.tableData = data
})
},
// 删除角色
delSysRole (row) {
this.$confirm('此操作将删除所选角色, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.role.delSysRole({ id: row.rid }).then(({ data }) => {
this.$message.success('操作成功')
this.getSysRole()
})
})
},
/* =============================================== 角色弹窗 =============================================== */
// 新增角色
addRole () {
this.mode = 'add'
this.form = {
rname: '',
rdesc: '',
rid: ''
}
this.dialogRole = true
},
// 编辑角色
modifyRow (row) {
this.mode = 'modify'
this.form = {
rname: row.rname,
rdesc: row.rdesc,
rid: row.rid
}
this.dialogRole = true
},
// 新增 修改
postOrPutSysRole () {
if (!this.form.rname) {
return this.$message.warning('请输入角色名称')
}
if (this.mode === 'add') {
this.$api.role.postSysRole(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogRole = false
this.getSysRole()
})
}
if (this.mode === 'modify') {
this.$api.role.putSysRole(this.form).then(_ => {
this.$message.success('操作成功')
this.dialogRole = false
this.getSysRole()
})
}
},
/* =============================================== 角色权限 =============================================== */
// 获取菜单
openPermission (row) {
this.roleId = row.rid
// this.isHomePage = type;
// if(type === 2){
this.$api.menu.getSysMenu({ roleId: row.rid }).then(({ data }) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id)
this.tableKey = uuidv4()
this.dialogPermission = true
})
// }else if(type === 1) {
// this.$api.role.sysRoleGetRoleHome({roleId: row.rid}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// this.dialogPermission = true;
// })
// }
},
// 获取权限
getSysMenu (roleId) {
this.$api.menu.getSysMenu({ roleId }).then(({ data }) => {
this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id)
this.tableKey = uuidv4()
})
},
// 获取首页
// getSysHome(roleId){
// this.$api.role.sysRoleGetRoleHome({roleId}).then(({data}) => {
// if(data === null){
// data = []
// }
// this.checkboxConfig.checkRowKeys = data.filter(item => item.belong === 1).map(item => item.id);
// this.tableKey = uuidv4();
// })
// },
// 添加权限
sysRoleSaveRoleMenu () {
// 获取全部选中和半选中的数据
const checkedData = this.$refs.rolePermission.getCheckboxRecords()
const indeterminateData = this.$refs.rolePermission.getCheckboxIndeterminateRecords()
let allCheckData = []
allCheckData = checkedData.concat(indeterminateData)
const ids = allCheckData.map(item => item.id)
const params = {
rid: this.roleId,
menusstr: ids
}
this.$api.role.sysRoleSaveRoleMenu(params).then(_ => {
this.$message.success('操作成功')
this.dialogPermission = false
})
},
// // 首页配置
// sysRoleSaveRoleHome(){
// let ids = this.$refs.rolePermission.getCheckboxRecords().map(item => item.id);
// let params = {
// rid: this.roleId,
// menusstr: ids
// }
// this.$api.role.sysRoleSaveRoleHome(params).then(_ => {
// this.$message.success('操作成功');
// this.dialogPermission = false;
// })
// },
// 菜单
sysMenuFindAllMenus () {
this.$api.menu.sysMenuFindAllMenus().then(({ data }) => {
this.treeData = data.filter(item => item.id !== '6f6fafb4a7').sort((a, b) => {
return a.sort - b.sort
})
})
}
},
computed: {
dialogTitle () {
switch (this.mode) {
case 'add':
return '新增'
case 'modify':
return '编辑'
case 'view':
return '查看'
}
}
},
created () {
this.init()
}
}
</script>
+231 -232
View File
@@ -123,244 +123,243 @@
</template>
<script>
import {Base64} from "js-base64";
import { Base64 } from 'js-base64'
export default {
name: "User",
data() {
return {
q: {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10,
},
total: 0,
tableData: [],
mode: '',
dialogUser: false,
form: {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''], // 角色
},
repassword: '',
roleList: [],
}
},
methods: {
search(){
this.q.pageNo = 1;
this.sysUserList();
},
// 获取所有用户
sysUserList() {
this.$api.user.sysUserList(this.q).then(({data}) => {
this.tableData = data.records;
this.total = data.total;
this.q.pageNo = data.current;
this.q.pageSize = data.size;
if(!data.records.length && this.q.pageNo !== 1){
this.q.pageNo = 1;
this.sysUserList();
}
})
},
// 重置
reset() {
this.q = {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10,
};
this.total = 0;
this.tableData = [];
this.sysUserList();
},
// 单页数据量
handleSizeChange(val) {
this.q.pageSize = val;
this.q.pageNo = 1;
this.sysUserList();
},
// 第几页
handleCurrentChange(val) {
this.q.pageNo = val;
this.sysUserList();
},
// 新增
add() {
this.mode = 'add';
this.form = {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''], // 角色
};
this.repassword = '';
this.dialogUser = true;
},
// 启用/禁用
sysUserIsUse(val, row) {
this.$confirm(val === '0' ? '此操作将禁用所选用户, 是否继续?' : '此操作将启用所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserIsUse({USID: row.USID, type: val}).then(_ => {
this.$message.success('操作成功');
this.sysUserList();
})
}).catch(() => {
row.ISUSE = val === '1' ? '0' : '1';
});
},
// 删除
deleteRow(row) {
this.deleteUser(row.USID);
},
// 验证
checkUserForm() {
if (this.mode === 'add') {
if (!this.form.account || !(/^[a-zA-Z0-9]*$/.test(this.form.account))) {
return this.$message.warning('用户名只能为纯数字、纯字母或字母数字组合') && false;
}
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
}
if(this.mode === 'modify'){
// if (this.form.password || this.repassword) {
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
// }
}
if (this.form.cellPhoneNumber && !(/^1[3|4|5|7|8|9][0-9]{9}$/.test(this.form.cellPhoneNumber))) {
return this.$message.warning('请检查手机号') && false;
}
if (this.form.email && !(/^[\w-.]+@[a-z\d-]+(\.[a-z\d-]+)*\.[a-z\d]{2,6}$/i.test(this.form.email))) {
return this.$message.warning('请检查邮箱') && false;
}
if (!this.form.roleIdList[0]) {
return this.$message.warning('请选择角色') && false;
}
if (!this.form.usname) {
return this.$message.warning('请输入姓名') && false;
}
return true;
},
// 新增用户
sysUserAddUser() {
if (!this.checkUserForm()) return;
let data = JSON.parse(JSON.stringify(this.form));
data.account = this.$JSEncrypt(data.account);
data.password = this.$JSEncrypt(data.password);
let jsonData = JSON.stringify(data);
this.$api.user.sysUserAddUser(Base64.encodeURI(jsonData)).then(_ => {
this.$message.success('操作成功');
this.dialogUser = false;
this.reset();
})
},
// 编辑查看用户
openRowData(mode, row) {
this.mode = mode;
this.form = {
account: row.ACCOUNT, // 用户名
cellPhoneNumber: row.CELLPHONE_NUMBER, // 手机号
department: row.DEPARTMENT, // 部门
email: row.EMAIL, // 邮箱
password: '', // 密码
usid: row.USID, // 用户ID
usname: row.USNAME, // 姓名
roleIdList: [row.ROLEID], // 角色
}
this.repassword = '';
this.dialogUser = true;
},
newAddFunc(){
},
uploadPDFSuccess(response, file, fileList) {
if (response.ok) {
this.$message.success('导入成功');
this.reset()
} else {
this.$message.error(response.message);
}
},
downloadTemp(){
window.open('/library/api/sys/user/template')
},
// 多选用户
getSelectUser() {
let users = this.$refs.userTable.getCheckboxRecords();
if (!users.length) {
return this.$message.warning('请选择数据后在进行操作');
}
let ids = users.map(item => item.USID).join(',');
this.deleteUser(ids);
},
// 删除用户
deleteUser(ids) {
this.$confirm('此操作将删除所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserDelete({ids}).then(_ => {
this.$message.success('操作成功');
this.sysUserList();
})
})
},
// 角色列表
getSysRole() {
this.$api.role.getSysRole().then(({data}) => {
this.roleList = data;
})
},
},
computed: {
dialogTitle() {
switch (this.mode) {
case 'add':
return '新增';
case 'modify':
return '编辑';
case 'view':
return '查看';
}
}
},
created() {
this.sysUserList();
this.getSysRole();
name: 'User',
data () {
return {
q: {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10
},
total: 0,
tableData: [],
mode: '',
dialogUser: false,
form: {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''] // 角色
},
repassword: '',
roleList: []
}
},
methods: {
search () {
this.q.pageNo = 1
this.sysUserList()
},
// 获取所有用户
sysUserList () {
this.$api.user.sysUserList(this.q).then(({ data }) => {
this.tableData = data.records
this.total = data.total
this.q.pageNo = data.current
this.q.pageSize = data.size
if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1
this.sysUserList()
}
})
},
// 重置
reset () {
this.q = {
account: '', // 用户名
roleName: '', // 角色名称
pageNo: 1,
pageSize: 10
}
this.total = 0
this.tableData = []
this.sysUserList()
},
// 单页数据量
handleSizeChange (val) {
this.q.pageSize = val
this.q.pageNo = 1
this.sysUserList()
},
// 第几页
handleCurrentChange (val) {
this.q.pageNo = val
this.sysUserList()
},
// 新增
add () {
this.mode = 'add'
this.form = {
account: '', // 用户名
cellPhoneNumber: '', // 手机号
department: '', // 部门
email: '', // 邮箱
password: '', // 密码
usid: '',
usname: '', // 姓名
roleIdList: [''] // 角色
}
this.repassword = ''
this.dialogUser = true
},
// 启用/禁用
sysUserIsUse (val, row) {
this.$confirm(val === '0' ? '此操作将禁用所选用户, 是否继续?' : '此操作将启用所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserIsUse({ USID: row.USID, type: val }).then(_ => {
this.$message.success('操作成功')
this.sysUserList()
})
}).catch(() => {
row.ISUSE = val === '1' ? '0' : '1'
})
},
// 删除
deleteRow (row) {
this.deleteUser(row.USID)
},
// 验证
checkUserForm () {
if (this.mode === 'add') {
if (!this.form.account || !(/^[a-zA-Z0-9]*$/.test(this.form.account))) {
return this.$message.warning('用户名只能为纯数字、纯字母或字母数字组合') && false
}
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
}
if (this.mode === 'modify') {
// if (this.form.password || this.repassword) {
// // 密码
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
// }
// if (this.repassword !== this.form.password) {
// return this.$message.warning('请检查密码') && false;
// }
// }
}
if (this.form.cellPhoneNumber && !(/^1[3|4|5|7|8|9][0-9]{9}$/.test(this.form.cellPhoneNumber))) {
return this.$message.warning('请检查手机号') && false
}
if (this.form.email && !(/^[\w-.]+@[a-z\d-]+(\.[a-z\d-]+)*\.[a-z\d]{2,6}$/i.test(this.form.email))) {
return this.$message.warning('请检查邮箱') && false
}
if (!this.form.roleIdList[0]) {
return this.$message.warning('请选择角色') && false
}
if (!this.form.usname) {
return this.$message.warning('请输入姓名') && false
}
return true
},
// 新增用户
sysUserAddUser () {
if (!this.checkUserForm()) return
const data = JSON.parse(JSON.stringify(this.form))
data.account = this.$JSEncrypt(data.account)
data.password = this.$JSEncrypt(data.password)
const jsonData = JSON.stringify(data)
this.$api.user.sysUserAddUser(Base64.encodeURI(jsonData)).then(_ => {
this.$message.success('操作成功')
this.dialogUser = false
this.reset()
})
},
// 编辑查看用户
openRowData (mode, row) {
this.mode = mode
this.form = {
account: row.ACCOUNT, // 用户名
cellPhoneNumber: row.CELLPHONE_NUMBER, // 手机号
department: row.DEPARTMENT, // 部门
email: row.EMAIL, // 邮箱
password: '', // 密码
usid: row.USID, // 用户ID
usname: row.USNAME, // 姓名
roleIdList: [row.ROLEID] // 角色
}
this.repassword = ''
this.dialogUser = true
},
newAddFunc () {
},
uploadPDFSuccess (response, file, fileList) {
if (response.ok) {
this.$message.success('导入成功')
this.reset()
} else {
this.$message.error(response.message)
}
},
downloadTemp () {
window.open('/library/api/sys/user/template')
},
// 多选用户
getSelectUser () {
const users = this.$refs.userTable.getCheckboxRecords()
if (!users.length) {
return this.$message.warning('请选择数据后在进行操作')
}
const ids = users.map(item => item.USID).join(',')
this.deleteUser(ids)
},
// 删除用户
deleteUser (ids) {
this.$confirm('此操作将删除所选用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.user.sysUserDelete({ ids }).then(_ => {
this.$message.success('操作成功')
this.sysUserList()
})
})
},
// 角色列表
getSysRole () {
this.$api.role.getSysRole().then(({ data }) => {
this.roleList = data
})
}
},
computed: {
dialogTitle () {
switch (this.mode) {
case 'add':
return '新增'
case 'modify':
return '编辑'
case 'view':
return '查看'
}
}
},
created () {
this.sysUserList()
this.getSysRole()
}
}
</script>
<style lang="scss" scoped>
.system-user {
.title {
+28 -29
View File
@@ -7,37 +7,37 @@
<script>
export default {
name: "MenuManager",
data() {
return {
url: ''
}
},
methods: {},
computed: {},
created() {
this.url = this.$store.state.pathUrl
},
mounted() {
/**
export default {
name: 'MenuManager',
data () {
return {
url: ''
}
},
methods: {},
computed: {},
created () {
this.url = this.$store.state.pathUrl
},
mounted () {
/**
* iframe-宽高自适应显示
*/
function changeMobsfIframe() {
const mobsf = document.getElementById('mobsf');
const deviceWidth = document.body.clientWidth;
const deviceHeight = document.body.clientHeight;
mobsf.style.width = '100%'; //数字是页面布局宽度差值
mobsf.style.height = (Number(deviceHeight) - 86) + 'px'; //数字是页面布局高度差
}
changeMobsfIframe()
window.onresize = function () {
changeMobsfIframe()
}
}
function changeMobsfIframe () {
const mobsf = document.getElementById('mobsf')
const deviceWidth = document.body.clientWidth
const deviceHeight = document.body.clientHeight
mobsf.style.width = '100%' // 数字是页面布局宽度差值
mobsf.style.height = (Number(deviceHeight) - 86) + 'px' // 数字是页面布局高度差
}
changeMobsfIframe()
window.onresize = function () {
changeMobsfIframe()
}
}
}
</script>
<style lang="scss" scoped>
@@ -225,7 +225,6 @@
}
}
.icon-menu-text {
display: flex;
width: 36px;