mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-12 21:53:48 +08:00
v1.1.0
This commit is contained in:
28
smart-admin-web/src/api/peony.js
Normal file
28
smart-admin-web/src/api/peony.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { postAxios, getAxios, postDownloadAxios } from '@/lib/http';
|
||||
|
||||
export const peonyApi = {
|
||||
// 添加牡丹花 @author 卓大
|
||||
addPeony: (data) => {
|
||||
return postAxios('/peony/add', data);
|
||||
},
|
||||
// 分页查询牡丹花 @author 卓大
|
||||
queryPeony: (data) => {
|
||||
return postAxios('/peony/page/query', data);
|
||||
},
|
||||
// 批量删除牡丹花 @author 卓大
|
||||
batchDeletePeony: (idList) => {
|
||||
return postAxios('/peony/deleteByIds', idList);
|
||||
},
|
||||
// 修改牡丹花 @author 卓大
|
||||
updatePeony: (data) => {
|
||||
return postAxios('/peony/update',data);
|
||||
},
|
||||
// 导出全部 @author 卓大
|
||||
exportAll:(data)=>{
|
||||
return postDownloadAxios('/peony/export/all',data);
|
||||
},
|
||||
// 批量导出 @author 卓大
|
||||
batchExport: (idList) => {
|
||||
return postDownloadAxios('/peony/export/batch', idList);
|
||||
},
|
||||
};
|
||||
@@ -29,7 +29,7 @@ export const taskApi = {
|
||||
return getAxios(`/quartz/task/resume/${taskId}`);
|
||||
},
|
||||
// 删除任务
|
||||
deleteTasks: (taskId) => {
|
||||
deleteTask: (taskId) => {
|
||||
return getAxios(`/quartz/task/delete/${taskId}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<Select clearable filterable :multiple="multiple" :style="selectorStyle" v-model="selectValue">
|
||||
<Option :key="item.id" :value="item.id" v-for="item in dataList">{{ item.actualName }}</Option>
|
||||
</Select>
|
||||
</template>
|
||||
<script>
|
||||
import { employeeApi } from '@/api/employee';
|
||||
export default {
|
||||
name: 'EmployeeSelector',
|
||||
props: {
|
||||
// 选中的员工
|
||||
value: null,
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
selectorStyle:{
|
||||
type:String,
|
||||
default:'width:180px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataList: [],
|
||||
selectValue: this.value
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.reset();
|
||||
this.query();
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
if (this.multiple) {
|
||||
this.selectValue = [];
|
||||
} else {
|
||||
this.selectValue = -1;
|
||||
}
|
||||
},
|
||||
updateSelect(value) {
|
||||
this.selectValue = value;
|
||||
},
|
||||
getSelectValue() {
|
||||
return this.selectValue;
|
||||
},
|
||||
query() {
|
||||
(async () => {
|
||||
let res = await employeeApi.getAllEmployee();
|
||||
this.dataList = res.data;
|
||||
})();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
// 面包屑显示字体大小
|
||||
fontSize: {
|
||||
type: Number,
|
||||
default: 14
|
||||
default: 12
|
||||
},
|
||||
// 是否显示图标
|
||||
showIcon: {
|
||||
|
||||
@@ -1,7 +1,37 @@
|
||||
<template>
|
||||
<div class="header-bar">
|
||||
<SiderTrigger :collapsed="collapsed" icon="icon iconfont icondaohangzhedie" @on-change="handleCollpasedChange"/>
|
||||
<CustomBreadCrumb show-icon style="margin-left: 30px;" :list="breadCrumbList"/>
|
||||
<SiderTrigger
|
||||
:collapsed="collapsed"
|
||||
@on-change="handleCollpasedChange"
|
||||
icon="icon iconfont icondaohangzhedie"
|
||||
/>
|
||||
|
||||
<div class="custom-bread-crumb" style="margin-left: 30px;">
|
||||
<div class="ivu-breadcrumb" >
|
||||
<Dropdown @on-click="changeTopMenu">
|
||||
<a href="javascript:void(0)" style="font-size:15px;font-weight:600">
|
||||
{{currentTopMenuTitle}}
|
||||
<Icon type="ios-arrow-down" style="font-size:16px"></Icon>
|
||||
</a>
|
||||
<DropdownMenu slot="list">
|
||||
<DropdownItem :key="i" v-for="(item,i) in topMenuArray" :name="item.name">
|
||||
<Icon :type="item.meta.icon" style="font-size: 14px;"/>
|
||||
<span style="font-size: 14px;"> {{item.meta.title}} </span>
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
<i>
|
||||
<CustomBreadCrumb :list="breadCrumbList" show-icon style="margin-left: 20px;" />
|
||||
</i>
|
||||
<!-- <Tabs value="name1">
|
||||
<TabPane style="font-size:16px;font-weight:700;padding:12px 16px" label="标签一" name="name1"/>
|
||||
<TabPane style="font-size:16px;font-weight:700;padding:12px 16px" label="标签二" name="name2"/>
|
||||
<TabPane style="font-size:16px;font-weight:700;padding:12px 16px" label="标签三" name="name3">标签三的内容</TabPane>
|
||||
</Tabs> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="custom-content-con">
|
||||
<slot></slot>
|
||||
</div>
|
||||
@@ -22,17 +52,30 @@ export default {
|
||||
collapsed: {
|
||||
type: Boolean,
|
||||
require: false
|
||||
},
|
||||
//顶级菜单
|
||||
topMenuArray:{
|
||||
type:Array,
|
||||
required:true
|
||||
},
|
||||
//当前顶级菜单名字
|
||||
currentTopMenuTitle:{
|
||||
type:String,
|
||||
required:true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 面包屑集合
|
||||
breadCrumbList () {
|
||||
breadCrumbList() {
|
||||
return this.$store.state.app.breadCrumbList;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCollpasedChange (state) {
|
||||
handleCollpasedChange(state) {
|
||||
this.$emit('on-coll-change', state);
|
||||
},
|
||||
changeTopMenu(name){
|
||||
this.$emit('on-change-top-menu', name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ export default {
|
||||
return showTitle(item, this);
|
||||
},
|
||||
showChildren (item) {
|
||||
return item.children && (item.children.length > 1 || (item.meta && item.meta.showAlways));
|
||||
return item.children && (item.children.length > 0 || (item.meta && item.meta.showAlways));
|
||||
},
|
||||
getNameOrHref (item, children0) {
|
||||
return item.href ? `isTurnByHref_${item.href}` : (children0 ? item.children[0].name : item.name);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
>
|
||||
<template v-for="item in menuList">
|
||||
<template v-if="item.children && item.children.length === 1">
|
||||
<side-menu-item :key="`menu-${item.name}`" :parent-item="item" v-if="showChildren(item)"></side-menu-item>
|
||||
<side-menu-item :key="`menu-${item.name}`" :parent-item="item.children[0]" v-if="item.children[0].children && item.children[0].children.length > 0 "></side-menu-item>
|
||||
<menu-item
|
||||
:key="`menu-${item.children[0].name}`"
|
||||
:name="getNameOrHref(item, true)"
|
||||
@@ -24,7 +24,7 @@
|
||||
</menu-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<side-menu-item :key="`menu-${item.name}`" :parent-item="item" v-if="showChildren(item)"></side-menu-item>
|
||||
<side-menu-item :key="`menu-${item.name}`" :parent-item="item" v-if="item.children && item.children.length > 0"></side-menu-item>
|
||||
<menu-item :key="`menu-${item.name}`" :name="getNameOrHref(item)" v-else>
|
||||
<common-icon :type="item.icon || ''" />
|
||||
<span>{{ showTitle(item) }}</span>
|
||||
@@ -81,6 +81,13 @@ export default {
|
||||
CollapsedMenu
|
||||
},
|
||||
props: {
|
||||
// 菜单path数组
|
||||
menuNameMatchedMap:{
|
||||
type: Map,
|
||||
default() {
|
||||
return new Map();
|
||||
}
|
||||
},
|
||||
// 菜单集合
|
||||
menuList: {
|
||||
type: Array,
|
||||
@@ -161,6 +168,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
updateActiveName(name){
|
||||
this.updateOpenName(name)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.menu.updateOpened();
|
||||
this.$refs.menu.updateActiveName(name);
|
||||
@@ -171,13 +179,20 @@ export default {
|
||||
},
|
||||
// 从激活菜单的名称中获取打开的菜单
|
||||
getOpenedNamesByActiveName(name) {
|
||||
return this.$route.matched
|
||||
.map(item => item.name)
|
||||
.filter(item => item !== name);
|
||||
// return this.$route.matched
|
||||
// .map(item => item.name)
|
||||
// .filter(item => item !== name);
|
||||
let array = this.menuNameMatchedMap.get(name);
|
||||
if(array){
|
||||
return array;
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
},
|
||||
updateOpenName(name) {
|
||||
if (name === this.$config.homeName) this.openedNames = [];
|
||||
else this.openedNames = this.getOpenedNamesByActiveName(name);
|
||||
// if (name === this.$config.homeName) this.openedNames = [];
|
||||
// else this.openedNames = this.getOpenedNamesByActiveName(name);
|
||||
this.openedNames = this.menuNameMatchedMap.get(name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
:active-name="$route.name"
|
||||
:collapsed="collapsed"
|
||||
:menu-list="menuList"
|
||||
:menuNameMatchedMap="menuNameMatchedMap"
|
||||
@on-select="turnToPage"
|
||||
accordion
|
||||
ref="sideMenu"
|
||||
@@ -47,7 +48,13 @@
|
||||
</Sider>
|
||||
<Layout>
|
||||
<Header class="header-con">
|
||||
<HeaderBar :collapsed="collapsed" @on-coll-change="handleCollapsedChange">
|
||||
<HeaderBar
|
||||
:collapsed="collapsed"
|
||||
:currentTopMenuTitle="currentTopMenuTitle"
|
||||
:topMenuArray="userTopMenuArray"
|
||||
@on-change-top-menu="handleChangeTopMenu"
|
||||
@on-coll-change="handleCollapsedChange"
|
||||
>
|
||||
<User :message-unread-count="unreadCount" />
|
||||
<language
|
||||
:lang="local"
|
||||
@@ -59,7 +66,7 @@
|
||||
<Fullscreen style="margin-right: 10px;" v-model="isFullscreen" />
|
||||
</HeaderBar>
|
||||
</Header>
|
||||
<Content class="main-content-con">
|
||||
<Content class="main-content-con" v-if="isLoadedPrvileges">
|
||||
<Layout class="main-layout-con">
|
||||
<div class="tag-nav-wrapper">
|
||||
<TagsNav
|
||||
@@ -89,6 +96,7 @@ import HeaderBar from './components/header-bar';
|
||||
import TagsNav from './components/tags-nav';
|
||||
import Notice from './components/notice/notice';
|
||||
import User from './components/user';
|
||||
import { topMenuArray } from '@/router';
|
||||
import Fullscreen from './components/fullscreen';
|
||||
import Language from './components/language';
|
||||
import { mapMutations, mapActions, mapGetters } from 'vuex';
|
||||
@@ -112,6 +120,13 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//是否加载完了权限
|
||||
isLoadedPrvileges:false,
|
||||
//用户所拥有的顶级菜单数组
|
||||
userTopMenuArray: [],
|
||||
//当前顶级菜单名字
|
||||
currentTopMenuName: '',
|
||||
currentTopMenuTitle: '',
|
||||
// 是否折叠
|
||||
collapsed: false,
|
||||
minLogo,
|
||||
@@ -123,7 +138,8 @@ export default {
|
||||
searchKeyWord: '',
|
||||
searchList: [],
|
||||
searchListResult: [],
|
||||
menuList: []
|
||||
menuList: [],
|
||||
menuNameMatchedMap: new Map()
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -183,6 +199,7 @@ export default {
|
||||
this.setBreadCrumb(newRoute);
|
||||
// this.pushKeepAliveIncludes(newRoute);
|
||||
this.setTagNavList(getNewTagList(this.tagNavList, newRoute));
|
||||
//更新左侧目录打开
|
||||
this.$refs.sideMenu.updateOpenName(newRoute.name);
|
||||
// 如果param参数 存在 noKeepAlive切位true
|
||||
let isParamNoKeepAlive = params && params.noKeepAlive === true;
|
||||
@@ -202,32 +219,18 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
/**
|
||||
* @description 初始化设置面包屑导航和标签导航
|
||||
* 初始化设置面包屑导航和标签导航
|
||||
*/
|
||||
this.setTagNavList();
|
||||
this.setHomeRoute(routers);
|
||||
this.setCollapsed();
|
||||
this.setBreadCrumb(this.$route);
|
||||
//初始化左侧菜单
|
||||
this.initSideMenu();
|
||||
const { name, params, query, meta } = this.$route;
|
||||
this.addTag({
|
||||
route: {
|
||||
name,
|
||||
params,
|
||||
query,
|
||||
meta
|
||||
}
|
||||
});
|
||||
|
||||
this.buildTopMenu();
|
||||
// 设置初始语言
|
||||
this.setLocal(this.$i18n.locale);
|
||||
// 如果当前打开页面不在标签栏中,跳到homeName页
|
||||
if (!this.tagNavList.find(item => item.name === this.$route.name)) {
|
||||
this.$router.push({
|
||||
name: this.$config.homeName
|
||||
});
|
||||
}
|
||||
//初始化左侧菜单
|
||||
this.initSideMenu();
|
||||
this.jumpRouter();
|
||||
},
|
||||
methods: {
|
||||
...mapMutations([
|
||||
@@ -244,13 +247,34 @@ export default {
|
||||
]),
|
||||
...mapActions(['handleLogin']),
|
||||
|
||||
jumpRouter() {
|
||||
const { name, params, query, meta } = this.$route;
|
||||
this.addTag({
|
||||
route: {
|
||||
name,
|
||||
params,
|
||||
query,
|
||||
meta
|
||||
}
|
||||
});
|
||||
// 如果当前打开页面不在标签栏中,跳到homeName页
|
||||
if (!this.tagNavList.find(item => item.name === this.$route.name)) {
|
||||
this.$router.push({
|
||||
name: this.$config.homeName
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
initSideMenu() {
|
||||
//如果是登录跳转过来
|
||||
if (this.$store.state.user.isUpdatePrivilege) {
|
||||
this.isLoadedPrvileges = true;
|
||||
this.$Spin.show();
|
||||
this.buildMenuTree();
|
||||
this.$refs.sideMenu.updateActiveName(this.$route.name);
|
||||
this.jumpRouter();
|
||||
this.$Spin.hide();
|
||||
|
||||
} else {
|
||||
//如果页面刷新,需要重新获取权限
|
||||
(async () => {
|
||||
@@ -261,22 +285,68 @@ export default {
|
||||
'setUserPrivilege',
|
||||
sessionResult.data.privilegeList
|
||||
);
|
||||
this.isLoadedPrvileges = true;
|
||||
this.buildTopMenu();
|
||||
this.buildMenuTree();
|
||||
//刷新以后手动更新左侧菜单打开和选中
|
||||
this.$refs.sideMenu.updateActiveName(this.$route.name);
|
||||
this.jumpRouter();
|
||||
this.$Spin.hide();
|
||||
})();
|
||||
}
|
||||
},
|
||||
buildTopMenu() {
|
||||
let arr = [];
|
||||
for (let topMenu of topMenuArray) {
|
||||
if (
|
||||
this.$store.state.user.userLoginInfo.isSuperMan ||
|
||||
this.$store.state.user.privilegeMenuKeyList.indexOf(topMenu.name) !==
|
||||
-1
|
||||
) {
|
||||
arr.push(topMenu);
|
||||
}
|
||||
}
|
||||
if (arr.length > 0) {
|
||||
this.currentTopMenuName = arr[0].name;
|
||||
this.currentTopMenuTitle = arr[0].meta.title;
|
||||
} else {
|
||||
this.currentTopMenuName = '';
|
||||
this.currentTopMenuTitle = '';
|
||||
}
|
||||
this.userTopMenuArray = arr;
|
||||
},
|
||||
handleChangeTopMenu(name) {
|
||||
this.currentTopMenuName = name;
|
||||
for (let topMenu of this.userTopMenuArray) {
|
||||
if (topMenu.name === name) {
|
||||
this.currentTopMenuTitle = topMenu.meta.title;
|
||||
}
|
||||
}
|
||||
this.initSideMenu();
|
||||
},
|
||||
getCurrentTopMenuChild() {
|
||||
if (this.userTopMenuArray.length === 0) {
|
||||
return [];
|
||||
} else {
|
||||
for (const router of this.userTopMenuArray) {
|
||||
if (router.name === this.currentTopMenuName) {
|
||||
return router.children;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
},
|
||||
buildMenuTree() {
|
||||
let privilegeTree = [];
|
||||
for (const router of routers) {
|
||||
let routerArray = this.getCurrentTopMenuChild();
|
||||
for (const router of routerArray) {
|
||||
//过滤非菜单
|
||||
if (!router.meta.hideInMenu) {
|
||||
//判断是否有权限
|
||||
if (
|
||||
this.$store.state.user.userLoginInfo.isSuperMan ||
|
||||
this.$store.state.user.privilegeMenuKeyList.indexOf(router.name) !==
|
||||
-1
|
||||
-1
|
||||
) {
|
||||
let menu = {
|
||||
name: router.name,
|
||||
@@ -284,6 +354,7 @@ export default {
|
||||
icon: _.isUndefined(router.meta.icon) ? '' : router.meta.icon,
|
||||
children: []
|
||||
};
|
||||
this.menuNameMatchedMap.set(menu.name, [menu.name]);
|
||||
privilegeTree.push(menu);
|
||||
//存在孩子节点,开始递归
|
||||
if (router.children && router.children.length > 0) {
|
||||
@@ -299,6 +370,16 @@ export default {
|
||||
for (const router of children) {
|
||||
//过滤非菜单
|
||||
if (!router.meta.hideInMenu) {
|
||||
//验证权限
|
||||
if (!this.$store.state.user.userLoginInfo.isSuperMan) {
|
||||
if (
|
||||
this.$store.state.user.privilegeMenuKeyList.indexOf(
|
||||
router.name
|
||||
) === -1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let menu = {
|
||||
name: router.name,
|
||||
meta: router.meta,
|
||||
@@ -309,6 +390,10 @@ export default {
|
||||
name: router.name,
|
||||
title: router.meta.title
|
||||
});
|
||||
|
||||
let menuNameArray = this.menuNameMatchedMap.get(parentMenu.name);
|
||||
this.menuNameMatchedMap.set(menu.name, [...menuNameArray, menu.name]);
|
||||
|
||||
parentMenu.children.push(menu);
|
||||
//存在孩子节点,开始递归
|
||||
if (router.children && router.children.length > 0) {
|
||||
|
||||
6
smart-admin-web/src/constants/table-page.js
Normal file
6
smart-admin-web/src/constants/table-page.js
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/**
|
||||
* table分页 每页条数切换的配置
|
||||
*/
|
||||
export const PAGE_SIZE_OPTIONS = [10,20,30,50,75,100,150,200,300,500,1000];
|
||||
|
||||
@@ -13,18 +13,6 @@ let axios = Axios.create({
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
}
|
||||
});
|
||||
// 添加请求拦截器
|
||||
|
||||
// download url
|
||||
const downloadUrl = url => {
|
||||
let iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = url;
|
||||
iframe.onload = function () {
|
||||
document.body.removeChild(iframe);
|
||||
};
|
||||
document.body.appendChild(iframe);
|
||||
};
|
||||
|
||||
axios.interceptors.request.use(
|
||||
function (config) {
|
||||
@@ -43,34 +31,28 @@ axios.interceptors.request.use(
|
||||
// 添加响应拦截器
|
||||
axios.interceptors.response.use(
|
||||
res => {
|
||||
// 处理请求是下载的接口
|
||||
if (
|
||||
res.headers &&
|
||||
(res.headers['content-type'] === 'application/x-msdownload' ||
|
||||
res.headers['content-type'] ===
|
||||
'application/octet-stream;charset=utf-8')
|
||||
) {
|
||||
downloadUrl(res.request.responseURL);
|
||||
res.data = '';
|
||||
res.headers['content-type'] = 'text/json';
|
||||
return res;
|
||||
}
|
||||
let { data } = res;
|
||||
if (data.code !== 1) {
|
||||
if (data.code === 1001) {
|
||||
cookie.clearToken();
|
||||
localStorage.clear();
|
||||
window.location.href = window.location.pathname + '#/login';
|
||||
Message.error('未登录,或登录失效,请登录');
|
||||
} else if (data.code === 502) {
|
||||
window.location.href = window.location.pathname + '#/500';
|
||||
if (res.config.responseType === 'blob') {
|
||||
let isReturnJson = res.headers && res.headers['content-type'] && res.headers['content-type'].indexOf("json") > -1;
|
||||
//后端返回错误信息
|
||||
if (isReturnJson) {
|
||||
let reader = new FileReader()
|
||||
reader.onload = function (event) {
|
||||
let content = reader.result
|
||||
let parseRes = JSON.parse(content) // 错误信息
|
||||
return validateResponseCode({
|
||||
data: parseRes
|
||||
});
|
||||
}
|
||||
reader.readAsText(res.data);
|
||||
return true
|
||||
} else {
|
||||
Message.error(data.msg);
|
||||
//下载文件
|
||||
download(res);
|
||||
}
|
||||
Spin.hide();
|
||||
return Promise.reject(res);
|
||||
} else {
|
||||
//正常json请求
|
||||
return validateResponseCode(res);
|
||||
}
|
||||
return data;
|
||||
},
|
||||
error => {
|
||||
Spin.hide();
|
||||
@@ -81,11 +63,95 @@ axios.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
function validateResponseCode (res) {
|
||||
let { data } = res;
|
||||
if (data && data.code && data.code !== 1) {
|
||||
if (data.code === 1001) {
|
||||
cookie.clearToken();
|
||||
localStorage.clear();
|
||||
window.location.href = window.location.pathname + '#/login';
|
||||
Message.error('未登录,或登录失效,请登录');
|
||||
return;
|
||||
} else if (data.code === 502) {
|
||||
window.location.href = window.location.pathname + '#/500';
|
||||
return;
|
||||
} else {
|
||||
Spin.hide();
|
||||
Message.error(data.msg);
|
||||
return Promise.reject(res);
|
||||
}
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
|
||||
function blobToText (blob) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsText(blob);
|
||||
fileReader.onload = function () {
|
||||
try {
|
||||
const result = JSON.parse(this.result);
|
||||
if (result && result['resultCode'] === 'fail') {
|
||||
resolve(result);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
reject();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const postAxios = (url, data) => {
|
||||
return axios.post(url, data);
|
||||
};
|
||||
|
||||
export const postFileUploadAxios = (url, data) => {
|
||||
return axios.post(url, data, { headers: { 'Content-Type': 'multipart/form-data' } });
|
||||
};
|
||||
|
||||
export const postDownloadAxios = (url, data) => {
|
||||
return axios.post(url, data, { responseType: 'blob' });
|
||||
};
|
||||
|
||||
export const getAxios = (url, data) => {
|
||||
return axios.get(url, {
|
||||
params: data
|
||||
});
|
||||
};
|
||||
|
||||
function download (res) {
|
||||
let reader = new FileReader();
|
||||
let data = res.data;
|
||||
reader.onload = e => {
|
||||
if (e.target.result.indexOf('Result') != -1 && JSON.parse(e.target.result).Result == false) {
|
||||
// 进行错误处理
|
||||
} else {
|
||||
let fileName = "download";
|
||||
let contentDisposition = res.headers['Content-Disposition'];
|
||||
contentDisposition = contentDisposition ? contentDisposition : res.headers['content-disposition'];
|
||||
if (contentDisposition) {
|
||||
fileName = window.decodeURI(contentDisposition.split('=')[1], "UTF-8");
|
||||
}
|
||||
executeDownload(data, fileName);
|
||||
}
|
||||
};
|
||||
reader.readAsText(data);
|
||||
}
|
||||
|
||||
// 模拟点击a 标签进行下载
|
||||
function executeDownload (data, fileName) {
|
||||
if (!data) {
|
||||
return
|
||||
}
|
||||
let url = window.URL.createObjectURL(new Blob([data]));
|
||||
let link = document.createElement('a');
|
||||
link.style.display = 'none';
|
||||
link.href = url;
|
||||
link.setAttribute('download', fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import moment from 'moment';
|
||||
/**
|
||||
* @param {String} url
|
||||
* @description 从URL中解析参数
|
||||
@@ -125,8 +126,8 @@ const getDate = (timeStamp, startType) => {
|
||||
const minutes = getHandledValue(d.getMinutes());
|
||||
const second = getHandledValue(d.getSeconds());
|
||||
let resStr = '';
|
||||
if (startType === 'year')
|
||||
{resStr =
|
||||
if (startType === 'year') {
|
||||
resStr =
|
||||
year +
|
||||
'-' +
|
||||
month +
|
||||
@@ -137,7 +138,8 @@ const getDate = (timeStamp, startType) => {
|
||||
':' +
|
||||
minutes +
|
||||
':' +
|
||||
second;}
|
||||
second;
|
||||
}
|
||||
else resStr = month + '-' + date + ' ' + hours + ':' + minutes;
|
||||
return resStr;
|
||||
};
|
||||
@@ -166,17 +168,13 @@ export const getRelativeTime = timeStamp => {
|
||||
// 少于等于59秒
|
||||
if (diff <= 59) resStr = diff + '秒' + dirStr;
|
||||
// 多于59秒,少于等于59分钟59秒
|
||||
else if (diff > 59 && diff <= 3599)
|
||||
{resStr = Math.floor(diff / 60) + '分钟' + dirStr;}
|
||||
else if (diff > 59 && diff <= 3599) { resStr = Math.floor(diff / 60) + '分钟' + dirStr; }
|
||||
// 多于59分钟59秒,少于等于23小时59分钟59秒
|
||||
else if (diff > 3599 && diff <= 86399)
|
||||
{resStr = Math.floor(diff / 3600) + '小时' + dirStr;}
|
||||
else if (diff > 3599 && diff <= 86399) { resStr = Math.floor(diff / 3600) + '小时' + dirStr; }
|
||||
// 多于23小时59分钟59秒,少于等于29天59分钟59秒
|
||||
else if (diff > 86399 && diff <= 2623859)
|
||||
{resStr = Math.floor(diff / 86400) + '天' + dirStr;}
|
||||
else if (diff > 86399 && diff <= 2623859) { resStr = Math.floor(diff / 86400) + '天' + dirStr; }
|
||||
// 多于29天59分钟59秒,少于364天23小时59分钟59秒,且传入的时间戳早于当前
|
||||
else if (diff > 2623859 && diff <= 31567859 && IS_EARLY)
|
||||
{resStr = getDate(timeStamp);}
|
||||
else if (diff > 2623859 && diff <= 31567859 && IS_EARLY) { resStr = getDate(timeStamp); }
|
||||
else resStr = getDate(timeStamp, 'year');
|
||||
return resStr;
|
||||
};
|
||||
@@ -256,8 +254,7 @@ export const objEqual = (obj1, obj2) => {
|
||||
const keysArr2 = Object.keys(obj2);
|
||||
if (keysArr1.length !== keysArr2.length) return false;
|
||||
else if (keysArr1.length === 0 && keysArr2.length === 0) return true;
|
||||
/* eslint-disable-next-line */ else
|
||||
{return !keysArr1.some(key => obj1[key] != obj2[key]);}
|
||||
/* eslint-disable-next-line */ else { return !keysArr1.some(key => obj1[key] != obj2[key]); }
|
||||
};
|
||||
|
||||
// 相关工具类
|
||||
@@ -497,3 +494,22 @@ export const utils = {
|
||||
return chineseStr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const dateTimeRangeConvert = (timerange) => {
|
||||
// timerange
|
||||
let arr = [];
|
||||
if (timerange[0] === '') {
|
||||
arr.push(null);
|
||||
} else {
|
||||
arr.push(moment(timerange[0]).format("YYYY-MM-DD 00:00:00"));
|
||||
}
|
||||
|
||||
if (timerange[1] === '') {
|
||||
arr.push(null);
|
||||
} else {
|
||||
arr.push(moment(timerange[1]).format("YYYY-MM-DD 23:59:59"));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ import Enum from 'vue-enum';
|
||||
import enumInfo from '@/constants';
|
||||
// 处理table操作按钮
|
||||
import tableAction from './lib/table-action';
|
||||
|
||||
//时间
|
||||
import moment from 'moment';
|
||||
|
||||
|
||||
Vue.prototype.$tableAction = tableAction;
|
||||
Vue.use(Enum, { enumInfo });
|
||||
Vue.use(ViewUI, {
|
||||
@@ -29,11 +34,18 @@ Vue.use(ViewUI, {
|
||||
});
|
||||
Vue.use(JsonViewer);
|
||||
Vue.use(vClickOutside);
|
||||
|
||||
|
||||
Number.prototype.toFixed = function (length) {
|
||||
let x = new Decimal(this);
|
||||
return x.toFixed(length);
|
||||
};
|
||||
|
||||
//时间处理
|
||||
moment.locale('zh-cn'); //设置语言 或 moment.lang('zh-cn');
|
||||
Vue.prototype.$moment = moment;//赋值使用
|
||||
|
||||
|
||||
/**
|
||||
* @description 注册admin内置插件
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,8 @@ const { homeName } = config;
|
||||
|
||||
Vue.use(Router);
|
||||
const router = new Router({
|
||||
routes: routers
|
||||
// routes: routers,
|
||||
routes: buildRouters(routers)
|
||||
// mode: 'history'
|
||||
});
|
||||
const LOGIN_PAGE_NAME = 'login';
|
||||
@@ -102,12 +103,69 @@ router.afterEach(to => {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
|
||||
function buildRouters (routerArray) {
|
||||
let lineRouters = [];
|
||||
for (let routerItem of routerArray) {
|
||||
//如果是顶层菜单
|
||||
if (routerItem.meta.topMenu) {
|
||||
// for (let children of routerItem.children) {
|
||||
let lineRouterArray = convertRouterTree2Line(routerItem.children);
|
||||
lineRouters.push(...lineRouterArray);
|
||||
// }
|
||||
} else {
|
||||
let lineRouterArray = convertRouterTree2Line([routerItem]);
|
||||
lineRouters.push(...lineRouterArray);
|
||||
}
|
||||
}
|
||||
return lineRouters;
|
||||
}
|
||||
|
||||
function convertRouterTree2Line (routerArray) {
|
||||
//一级,比如 人员管理
|
||||
let topArray = [];
|
||||
for (let router1Item of routerArray) {
|
||||
let level2Array = [];
|
||||
//二级,比如员工管理
|
||||
if (router1Item.children) {
|
||||
for (let level2Item of router1Item.children) {
|
||||
|
||||
let level2ItemCopy = {};
|
||||
for (let property in level2Item) {
|
||||
if ('children' !== property) {
|
||||
level2ItemCopy[property] = level2Item[property];
|
||||
}
|
||||
}
|
||||
|
||||
//三级,
|
||||
if (level2Item.children) {
|
||||
level2Array.push(...level2Item.children)
|
||||
}
|
||||
|
||||
level2ItemCopy.children = [];
|
||||
level2Array.push(level2Item);
|
||||
}
|
||||
}
|
||||
|
||||
let newTopRouterItem = {};
|
||||
for (let property in router1Item) {
|
||||
if ('children' !== property) {
|
||||
newTopRouterItem[property] = router1Item[property];
|
||||
}
|
||||
}
|
||||
|
||||
newTopRouterItem.children = level2Array;
|
||||
topArray.push(newTopRouterItem);
|
||||
}
|
||||
|
||||
return topArray;
|
||||
}
|
||||
|
||||
let tempCheckObj = {
|
||||
checkRouterNameMap: new Map(),
|
||||
checkRouterPathMap: new Map()
|
||||
};
|
||||
|
||||
function recursionRouter (routerArray) {
|
||||
function recursionCheckRouter (routerArray) {
|
||||
for (let routerItem of routerArray) {
|
||||
if (!routerItem.name) {
|
||||
console.error('没有配置router name', routerItem);
|
||||
@@ -141,14 +199,23 @@ function recursionRouter (routerArray) {
|
||||
}
|
||||
|
||||
if (routerItem.children) {
|
||||
recursionRouter(routerItem.children);
|
||||
recursionCheckRouter(routerItem.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recursionRouter(routers);
|
||||
//如果是开发环境,需要检测router的规范性
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
recursionCheckRouter(routers);
|
||||
delete tempCheckObj.checkRouterNameMap;
|
||||
delete tempCheckObj.checkRouterPathMap;
|
||||
}
|
||||
|
||||
delete tempCheckObj.checkRouterNameMap;
|
||||
delete tempCheckObj.checkRouterPathMap;
|
||||
|
||||
const topMenuArray = routers.filter(e => e.meta.topMenu);
|
||||
export { topMenuArray };
|
||||
|
||||
export default router;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export const emailSetting = [
|
||||
{ title: '删除', name: 'email-delete' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/email/email-list.vue')
|
||||
component: () => import('@/views/business/email/email-list.vue')
|
||||
},
|
||||
// 发送email
|
||||
{
|
||||
@@ -33,7 +33,7 @@ export const emailSetting = [
|
||||
title: '发送邮件',
|
||||
privilege: [{ title: '发送', name: 'email-send' }]
|
||||
},
|
||||
component: () => import('@/views/email/send-mail.vue')
|
||||
component: () => import('@/views/business/email/send-mail.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
29
smart-admin-web/src/router/module/business/index.js
Normal file
29
smart-admin-web/src/router/module/business/index.js
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
import Main from '@/components/main';
|
||||
|
||||
import { peony } from './peony';
|
||||
import { emailSetting } from './email';
|
||||
import { keepAlive } from './keep-alive';
|
||||
import { notice } from './notice';
|
||||
import { threeRouter } from './three-router';
|
||||
|
||||
// 业务
|
||||
export const business = [
|
||||
{
|
||||
path: '/business',
|
||||
name: 'Business',
|
||||
component: Main,
|
||||
meta: {
|
||||
title: '业务功能',
|
||||
topMenu:true,
|
||||
icon: 'icon iconfont iconyoujianguanli'
|
||||
},
|
||||
children: [
|
||||
...peony,
|
||||
...emailSetting,
|
||||
...keepAlive,
|
||||
...notice,
|
||||
...threeRouter
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -16,7 +16,7 @@ export const keepAlive = [
|
||||
meta: {
|
||||
title: 'KeepAlive列表'
|
||||
},
|
||||
component: () => import('@/views/keep-alive/content-list.vue')
|
||||
component: () => import('@/views/business/keep-alive/content-list.vue')
|
||||
},
|
||||
{
|
||||
path: '/keep-alive/add-content',
|
||||
@@ -24,7 +24,7 @@ export const keepAlive = [
|
||||
meta: {
|
||||
title: 'KeepAlive表单'
|
||||
},
|
||||
component: () => import('@/views/keep-alive/add-content.vue')
|
||||
component: () => import('@/views/business/keep-alive/add-content.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export const notice = [
|
||||
{ title: '发送', name: 'notice-send' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/notice/notice-list.vue')
|
||||
component: () => import('@/views/business/notice/notice-list.vue')
|
||||
},
|
||||
{
|
||||
path: '/notice/person-notice',
|
||||
@@ -36,7 +36,7 @@ export const notice = [
|
||||
{ title: '详情', name: 'person-notice-detail' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/notice/person-notice.vue')
|
||||
component: () => import('@/views/business/notice/person-notice.vue')
|
||||
},
|
||||
{
|
||||
path: '/notice/notice-detail',
|
||||
@@ -45,7 +45,7 @@ export const notice = [
|
||||
title: '消息详情',
|
||||
hideInMenu:true
|
||||
},
|
||||
component: () => import('@/views/notice/notice-detail.vue')
|
||||
component: () => import('@/views/business/notice/notice-detail.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
49
smart-admin-web/src/router/module/business/peony.js
Normal file
49
smart-admin-web/src/router/module/business/peony.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import Main from '@/components/main';
|
||||
// t_peony路由
|
||||
export const peony = [
|
||||
{
|
||||
path: '/peony',
|
||||
name: 'Peony',
|
||||
component: Main,
|
||||
meta: {
|
||||
title: '牡丹管理',
|
||||
icon: 'icon iconfont iconyoujianguanli'
|
||||
},
|
||||
children: [
|
||||
// 牡丹花 列表
|
||||
{
|
||||
path: '/peony/peony-list',
|
||||
name: 'PeonyList',
|
||||
meta: {
|
||||
title: '牡丹花列表',
|
||||
privilege: [
|
||||
{ title: '查询', name: 'peony-list-query' },
|
||||
{ title: '新增', name: 'peony-list-add' },
|
||||
{ title: '编辑', name: 'peony-list-update' },
|
||||
{ title: '批量删除', name: 'peony-list-batch-delete' },
|
||||
{ title: '批量导出', name: 'peony-list-batch-export' },
|
||||
{ title: '导出全部', name: 'peony-list-export-all' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/business/peony/peony-list.vue')
|
||||
},
|
||||
// 牡丹花 列表 1
|
||||
{
|
||||
path: '/peony/peony-list1',
|
||||
name: 'PeonyList1',
|
||||
meta: {
|
||||
title: '牡丹花列表1',
|
||||
privilege: [
|
||||
{ title: '查询', name: 'peony1-list-query' },
|
||||
{ title: '新增', name: 'peony1-list-add' },
|
||||
{ title: '编辑', name: 'peony1-list-update' },
|
||||
{ title: '批量删除', name: 'peony1-list-batch-delete' },
|
||||
{ title: '批量导出', name: 'peony1-list-batch-export' },
|
||||
{ title: '导出全部', name: 'peony1-list-export-all' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/business/peony/peony-list.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -17,7 +17,6 @@ export const threeRouter = [
|
||||
meta: {
|
||||
title: '三级菜单'
|
||||
},
|
||||
component: () => import('@/views/home'),
|
||||
children: [
|
||||
{
|
||||
path: '/three-router/level-two/level-three1',
|
||||
@@ -29,7 +28,7 @@ export const threeRouter = [
|
||||
{ title: '删除', name: 'roleOneTwo-delete' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/home')
|
||||
component: () => import('@/views/system/system-setting/system-config/system-config.vue')
|
||||
},
|
||||
{
|
||||
path: '/three-router/level-two/level-three2',
|
||||
@@ -41,7 +40,7 @@ export const threeRouter = [
|
||||
{ title: '删除', name: 'roleTwoTwo-delete' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/home')
|
||||
component: () => import('@/views/support/monitor/sql.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -55,7 +54,7 @@ export const threeRouter = [
|
||||
{ title: '删除', name: 'roleOneOne-delete' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/home')
|
||||
component: () => import('@/views/support/monitor/sql.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,6 +5,7 @@ export const error = [
|
||||
name: 'Error401',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
access: true,
|
||||
noValidatePrivilege: true
|
||||
},
|
||||
component: () => import('@/views/error-page/401.vue')
|
||||
@@ -14,6 +15,7 @@ export const error = [
|
||||
name: 'Error500',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
access: true,
|
||||
noValidatePrivilege: true
|
||||
},
|
||||
component: () => import('@/views/error-page/500.vue')
|
||||
@@ -23,6 +25,7 @@ export const error = [
|
||||
name: 'http://localhost:8080/#employee/role-employee-manage',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
access: true,
|
||||
noValidatePrivilege: true
|
||||
},
|
||||
component: () => import('@/views/error-page/404.vue')
|
||||
|
||||
@@ -18,7 +18,7 @@ export const apiDoc = [
|
||||
title: 'Swagger接口文档',
|
||||
icon: 'icon iconfont iconjiekouwendang'
|
||||
},
|
||||
component: () => import('@/views/api-doc/swagger.vue')
|
||||
component: () => import('@/views/support/api-doc/swagger.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export const heartBeat = [
|
||||
}
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/heart-beat/heart-beat-list.vue')
|
||||
component: () => import('@/views/support/heart-beat/heart-beat-list.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
30
smart-admin-web/src/router/module/support/index.js
Normal file
30
smart-admin-web/src/router/module/support/index.js
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
import Main from '@/components/main';
|
||||
|
||||
|
||||
import { apiDoc } from './api-doc';
|
||||
import { heartBeat } from './heart-beat';
|
||||
import { monitor } from './monitor';
|
||||
import { reload } from './reload';
|
||||
import { task } from './task';
|
||||
|
||||
// 业务
|
||||
export const support = [
|
||||
{
|
||||
path: '/support',
|
||||
name: 'Support',
|
||||
component: Main,
|
||||
meta: {
|
||||
title: '开发专用',
|
||||
topMenu: true,
|
||||
icon: 'icon iconfont iconjiekouwendang'
|
||||
},
|
||||
children: [
|
||||
...apiDoc,
|
||||
...heartBeat,
|
||||
...monitor,
|
||||
...reload,
|
||||
...task
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -18,7 +18,7 @@ export const monitor = [
|
||||
title: '在线人数',
|
||||
privilege: [{ title: '查询', name: 'online-user-search' }]
|
||||
},
|
||||
component: () => import('@/views/monitor/online-user.vue')
|
||||
component: () => import('@/views/support/monitor/online-user.vue')
|
||||
},
|
||||
// SQL监控
|
||||
{
|
||||
@@ -27,7 +27,7 @@ export const monitor = [
|
||||
meta: {
|
||||
title: 'SQL监控'
|
||||
},
|
||||
component: () => import('@/views/monitor/sql.vue')
|
||||
component: () => import('@/views/support/monitor/sql.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -33,7 +33,7 @@ export const reload = [
|
||||
]
|
||||
},
|
||||
component: () =>
|
||||
import('@/views/reload/smart-reload/smart-reload-list.vue')
|
||||
import('@/views/support/reload/smart-reload/smart-reload-list.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export const task = [
|
||||
}
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/task/task-list.vue')
|
||||
component: () => import('@/views/support/task/task-list.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export const employee = [
|
||||
}
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/employee/role/role-manage.vue')
|
||||
component: () => import('@/views/system/employee/role/role-manage.vue')
|
||||
},
|
||||
// 岗位管理页面路由 新
|
||||
{
|
||||
@@ -86,7 +86,7 @@ export const employee = [
|
||||
}
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/employee/position/position-list.vue')
|
||||
component: () => import('@/views/system/employee/position/position-list.vue')
|
||||
},
|
||||
// 人员管理页面路由
|
||||
{
|
||||
@@ -142,7 +142,7 @@ export const employee = [
|
||||
]
|
||||
},
|
||||
component: () =>
|
||||
import('@/views/employee/role-employee/role-employee-manage.vue')
|
||||
import('@/views/system/employee/role-employee/role-employee-manage.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@ export const file = [
|
||||
{ title: '下载', name: 'file-filePage-download' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/file/file-list.vue')
|
||||
component: () => import('@/views/system/file/file-list.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
28
smart-admin-web/src/router/module/system/index.js
Normal file
28
smart-admin-web/src/router/module/system/index.js
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
import Main from '@/components/main';
|
||||
|
||||
|
||||
import { employee } from './employee';
|
||||
import { file } from './file';
|
||||
import { userLog } from './user-log';
|
||||
import { systemSetting } from './system-setting';
|
||||
|
||||
// 业务
|
||||
export const system = [
|
||||
{
|
||||
path: '/system',
|
||||
name: 'System',
|
||||
component: Main,
|
||||
meta: {
|
||||
title: '系统设置',
|
||||
topMenu: true,
|
||||
icon: 'icon iconfont iconxitongshezhi'
|
||||
},
|
||||
children: [
|
||||
...employee,
|
||||
...file,
|
||||
...userLog,
|
||||
...systemSetting
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -36,7 +36,7 @@ export const systemSetting = [
|
||||
]
|
||||
},
|
||||
component: () =>
|
||||
import('@/views/system-setting/system-config/system-config.vue')
|
||||
import('@/views/system/system-setting/system-config/system-config.vue')
|
||||
},
|
||||
{
|
||||
path: '/system-setting/system-privilege',
|
||||
@@ -54,8 +54,7 @@ export const systemSetting = [
|
||||
}
|
||||
]
|
||||
},
|
||||
component: () =>
|
||||
import('@/views/system-setting/system-privilege/system-privilege.vue')
|
||||
component: () => import('@/views/system/system-setting/system-privilege/system-privilege.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@ export const userLog = [
|
||||
{ title: '删除', name: 'user-operate-log-delete' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/user-log/user-operate-log.vue')
|
||||
component: () => import('@/views/system/user-log/user-operate-log.vue')
|
||||
},
|
||||
// 人员管理页面路由
|
||||
{
|
||||
@@ -35,7 +35,7 @@ export const userLog = [
|
||||
{ title: '删除', name: 'user-login-log-delete' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/user-log/user-login-log.vue')
|
||||
component: () => import('@/views/system/user-log/user-login-log.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,18 +1,8 @@
|
||||
import { home } from './module/home';
|
||||
import { employee } from './module/employee';
|
||||
import { systemSetting } from './module/system-setting';
|
||||
import { notice } from './module/notice';
|
||||
import { emailSetting } from './module/email';
|
||||
import { monitor } from './module/monitor';
|
||||
import { userLog } from './module/user-log';
|
||||
import { error } from './module/error';
|
||||
import { task } from './module/task';
|
||||
import { reload } from './module/reload';
|
||||
import { apiDoc } from './module/api-doc';
|
||||
import { threeRouter } from './module/three-router';
|
||||
import { keepAlive } from './module/keep-alive';
|
||||
import { heartBeat } from './module/heart-beat';
|
||||
import { file } from './module/file';
|
||||
import { business } from './module/business';
|
||||
import { support } from './module/support';
|
||||
import { system } from './module/system';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,6 +17,7 @@ import { file } from './module/file';
|
||||
* privilegeExtend:{String} 同一功能模块下子页面的功能点权限继承菜单模块创建的路由权限 by lihaifan&lipeng
|
||||
* noKeepAlive: (false) 设为true后页面在切换标签后不会缓存,如果需要缓存,无需设置这个字段,而且需要设置页面组件name属性和路由配置的name一致
|
||||
* noValidatePrivilege: (true) 表示此路由不需要验证权限
|
||||
* topMenu:(true),表示为顶级菜单
|
||||
* }
|
||||
*/
|
||||
// 登录模块
|
||||
@@ -36,7 +27,7 @@ export const login = {
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
title: 'Login - 登录',
|
||||
noValidatePrivilege:true
|
||||
noValidatePrivilege: true
|
||||
},
|
||||
component: () => import('@/views/login/login.vue')
|
||||
};
|
||||
@@ -45,18 +36,8 @@ export const login = {
|
||||
export const routers = [
|
||||
login,
|
||||
...home,
|
||||
...employee,
|
||||
...systemSetting,
|
||||
...notice,
|
||||
...emailSetting,
|
||||
...userLog,
|
||||
...monitor,
|
||||
...error,
|
||||
...task,
|
||||
...reload,
|
||||
...apiDoc,
|
||||
...threeRouter,
|
||||
...keepAlive,
|
||||
...heartBeat,
|
||||
...file
|
||||
...business,
|
||||
...system,
|
||||
...support
|
||||
];
|
||||
|
||||
@@ -176,6 +176,7 @@
|
||||
}
|
||||
.ivu-table-cell {
|
||||
padding: 0 8px;
|
||||
overflow: inherit;
|
||||
}
|
||||
.table-line {
|
||||
background: @tableColor;
|
||||
@@ -261,24 +262,6 @@
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
// 重写4.0 table样式
|
||||
.ivu-table-wrapper{
|
||||
border: 1px solid #dcdee2;
|
||||
border-bottom: 0;
|
||||
border-right: 0;
|
||||
.ivu-table{
|
||||
&:after{
|
||||
content: "";
|
||||
position: absolute;
|
||||
background-color: #dcdee2;
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 重写字体大小
|
||||
.ivu-select,
|
||||
.ivu-select-single .ivu-select-selection .ivu-select-placeholder,
|
||||
@@ -297,4 +280,49 @@ textarea.ivu-input,
|
||||
.ivu-select-item,
|
||||
.ivu-dropdown-item{
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
/****自定义样式***/
|
||||
|
||||
.search-card .ivu-form-item {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.marginRight10{
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
.marginLeft10{
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
.marginBottom10{
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.float-right{
|
||||
float:right;
|
||||
}
|
||||
|
||||
.float-left{
|
||||
float:left;
|
||||
}
|
||||
|
||||
.error-color{
|
||||
color: #ed4014;
|
||||
}
|
||||
|
||||
.smart-query-card .ivu-card-body{
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.smart-query-form-row:not(:first-child){
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.smart-query-form-row span{
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.smart-query-table-page{
|
||||
margin-top: 10px;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<div>
|
||||
<Form ref="form" :rules="formValidate" :label-width="90" :model="form">
|
||||
<FormItem label="品种" prop="kind">
|
||||
<Input v-model="form.kind" />
|
||||
</FormItem>
|
||||
<FormItem label="名字" prop="name">
|
||||
<Input v-model="form.name" />
|
||||
</FormItem>
|
||||
<FormItem label="颜色" prop="color">
|
||||
<Input v-model="form.color" />
|
||||
</FormItem>
|
||||
<FormItem label="图片链接" prop="imageUrl">
|
||||
<Input v-model="form.imageUrl" />
|
||||
</FormItem>
|
||||
</Form>
|
||||
<Row class="code-row-bg" justify="end" type="flex">
|
||||
<Button @click="cancel" style="margin-right:10px">取消</Button>
|
||||
<Button @click="save" type="primary">保存</Button>
|
||||
</Row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { peonyApi } from '@/api/peony';
|
||||
export default {
|
||||
name: 'CodeReviewListForm',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
//是否为更新表单
|
||||
isUpdate: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
//更新的表单数据对象
|
||||
updateData: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//表单数据
|
||||
form: {
|
||||
//品种
|
||||
kind:null,
|
||||
//名字
|
||||
name:null,
|
||||
//颜色
|
||||
color:null,
|
||||
//图片链接
|
||||
imageUrl:null,
|
||||
},
|
||||
//表单验证
|
||||
formValidate: {
|
||||
//品种
|
||||
kind:[{ required: true, message: '请输入品种', trigger: 'blur' }],
|
||||
//名字
|
||||
name:[{ required: true, message: '请输入名字', trigger: 'blur' }],
|
||||
//颜色
|
||||
color:[{ required: true, message: '请输入颜色', trigger: 'blur' }],
|
||||
//图片链接
|
||||
imageUrl:[{ required: true, message: '请输入图片链接', trigger: 'blur' }],
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
updateData: function(newValue, oldValue) {
|
||||
this.$refs['form'].resetFields();
|
||||
if (this.isUpdate) {
|
||||
for (let k in this.form) {
|
||||
this.$set(this.form, k, newValue[k]);
|
||||
}
|
||||
this.$set(this.form, 'id', newValue['id']);
|
||||
}
|
||||
},
|
||||
isUpdate: function(newValue, oldValue) {
|
||||
if (!newValue) {
|
||||
this.resetForm();
|
||||
this.$refs['form'].resetFields();
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.$emit('on-form-close');
|
||||
},
|
||||
save() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.isUpdate) {
|
||||
this.update();
|
||||
} else {
|
||||
this.add();
|
||||
}
|
||||
} else {
|
||||
this.$Message.error('参数验证错误,请仔细填写表单数据!');
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm() {
|
||||
this.form = {
|
||||
//品种
|
||||
kind:null,
|
||||
//名字
|
||||
name:null,
|
||||
//颜色
|
||||
color:null,
|
||||
//图片链接
|
||||
imageUrl:null,
|
||||
};
|
||||
this.$refs['form'].resetFields();
|
||||
},
|
||||
async add() {
|
||||
this.$Spin.show();
|
||||
let res = await peonyApi.addPeony(this.form);
|
||||
this.$Message.success(res.msg);
|
||||
this.$Spin.hide();
|
||||
this.resetForm();
|
||||
this.$emit('on-form-close');
|
||||
},
|
||||
async update() {
|
||||
this.$Spin.show();
|
||||
let res = await peonyApi.updatePeony(this.form);
|
||||
this.$Message.success(res.msg);
|
||||
this.$Spin.hide();
|
||||
this.resetForm();
|
||||
this.$emit('on-form-close');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
495
smart-admin-web/src/views/business/peony/peony-list.vue
Normal file
495
smart-admin-web/src/views/business/peony/peony-list.vue
Normal file
@@ -0,0 +1,495 @@
|
||||
<template>
|
||||
<div>
|
||||
<Card class="smart-query-card">
|
||||
<!------ 查询条件第一行 begin------->
|
||||
<Row class="smart-query-form-row">
|
||||
<span>
|
||||
ID :
|
||||
<Input placeholder="请输入ID" style="width: 180px" v-model="queryForm.id" />
|
||||
</span>
|
||||
<span>
|
||||
品种 :
|
||||
<Input placeholder="请输入品种" style="width: 180px" v-model="queryForm.kind" />
|
||||
</span>
|
||||
<span>
|
||||
名字 :
|
||||
<Input placeholder="请输入名字" style="width: 180px" v-model="queryForm.name" />
|
||||
</span>
|
||||
<span>
|
||||
颜色 :
|
||||
<Input placeholder="请输入颜色" style="width: 180px" v-model="queryForm.color" />
|
||||
</span>
|
||||
<ButtonGroup>
|
||||
<Button
|
||||
@click="queryList"
|
||||
icon="ios-search"
|
||||
type="primary"
|
||||
v-privilege="'peony-list-query'"
|
||||
>查询</Button>
|
||||
<Button
|
||||
@click="resetQueryList"
|
||||
icon="md-refresh"
|
||||
type="default"
|
||||
v-privilege="'peony-list-query'"
|
||||
>重置</Button>
|
||||
</ButtonGroup>
|
||||
|
||||
<Button
|
||||
@click="showMoreQueryConditionFlag = !showMoreQueryConditionFlag"
|
||||
icon="md-more"
|
||||
style="margin-left: 20px"
|
||||
type="primary"
|
||||
v-privilege="'peony-list-query'"
|
||||
>{{showMoreQueryConditionFlag?'隐藏':'展开'}}</Button>
|
||||
</Row>
|
||||
<!------ 查询条件第一行 begin------->
|
||||
|
||||
<!------ 查询条件第二行 begin------->
|
||||
<Row class="smart-query-form-row" v-show="showMoreQueryConditionFlag">
|
||||
<span>
|
||||
xxx:
|
||||
<Input placeholder="请输入xxx" style="width: 250px" />
|
||||
</span>
|
||||
<span>
|
||||
创建时间:
|
||||
<DatePicker
|
||||
placeholder="选择创建日期范围"
|
||||
split-panels
|
||||
style="width: 200px"
|
||||
type="daterange"
|
||||
v-model="queryForm.createTimeRange"
|
||||
></DatePicker>
|
||||
</span>
|
||||
<span>
|
||||
更新时间:
|
||||
<DatePicker
|
||||
placeholder="选择更新日期范围"
|
||||
split-panels
|
||||
style="width: 200px"
|
||||
type="daterange"
|
||||
v-model="queryForm.updateTimeRange"
|
||||
></DatePicker>
|
||||
</span>
|
||||
</Row>
|
||||
<!------ 查询条件第二行 end------->
|
||||
</Card>
|
||||
|
||||
<Card class="warp-card">
|
||||
<!-------操作按钮行 begin------->
|
||||
<Row class="marginBottom10">
|
||||
<Button
|
||||
@click="showAddPeonyForm"
|
||||
icon="md-add"
|
||||
size="small"
|
||||
type="primary"
|
||||
v-privilege="'peony-list-add'"
|
||||
>新建数据</Button>
|
||||
<Button
|
||||
@click="showBatchDeleteModal"
|
||||
class="marginLeft10"
|
||||
icon="ios-trash-outline"
|
||||
size="small"
|
||||
type="error"
|
||||
v-privilege="'peony-list-batch-delete'"
|
||||
>批量删除</Button>
|
||||
|
||||
<Button
|
||||
:loading="allExportBtnLoading"
|
||||
@click="exportAll"
|
||||
class="marginLeft10 float-right"
|
||||
icon="ios-cloud-download-outline"
|
||||
size="small"
|
||||
type="warning"
|
||||
v-privilege="'peony-list-export-all'"
|
||||
>导出全部</Button>
|
||||
|
||||
<Button
|
||||
:loading="batchExportBtnLoading"
|
||||
@click="batchExport"
|
||||
class="marginLeft10 float-right"
|
||||
icon="ios-download-outline"
|
||||
size="small"
|
||||
type="warning"
|
||||
v-privilege="'peony-list-batch-export'"
|
||||
>批量导出</Button>
|
||||
|
||||
</Row>
|
||||
<!-------操作按钮行 end------->
|
||||
|
||||
<!-------表格列表 begin------->
|
||||
<Table
|
||||
:columns="mainTable.columnArray"
|
||||
:data="mainTable.data"
|
||||
:loading="mainTable.loading"
|
||||
@on-sort-change="handleSortChange"
|
||||
border
|
||||
highlight-row
|
||||
ref="mainTable"
|
||||
>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="imageUrl">
|
||||
<img width="40" height="40" v-if="index % 2 === 0" src="http://q8deiydpv.bkt.clouddn.com/image/peony1.jpg"/>
|
||||
<img v-if="index % 2 === 1" width="40" height="40" src="http://q8deiydpv.bkt.clouddn.com/image/peony2.jpg"/>
|
||||
</template>
|
||||
</Table>
|
||||
|
||||
<Page
|
||||
:current="queryForm.pageNum"
|
||||
:page-size="queryForm.pageSize"
|
||||
:page-size-opts="mainTablePage.pageSizeOps"
|
||||
:total="mainTablePage.total"
|
||||
@on-change="changeMainTablePagePageNum"
|
||||
@on-page-size-change="changeMainTablePagePageSize"
|
||||
class="smart-query-table-page"
|
||||
show-elevator
|
||||
show-sizer
|
||||
show-total
|
||||
/>
|
||||
</Card>
|
||||
<!-------表格列表 end------->
|
||||
|
||||
<!-------批量删除Modal begin------->
|
||||
<Modal title="批量删除" v-model="batchDeleteModal.show" width="450">
|
||||
<Form :label-width="80">
|
||||
<FormItem>
|
||||
<h3 class="error-color">确定要删除以下数据吗?</h3>
|
||||
</FormItem>
|
||||
<FormItem label="删除数据">
|
||||
<Card style="width:350px;height:250px;overflow-y:scroll;">
|
||||
<ul>
|
||||
<li v-for="item in mainTableSelectArray">
|
||||
<a href="#">{{ item.id }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</Card>
|
||||
</FormItem>
|
||||
</Form>
|
||||
<div slot="footer">
|
||||
<Button @click="batchDeleteModal.show = false" size="small" type="default">取消</Button>
|
||||
<Button @click="batchDelete" size="small" type="primary">确定删除</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
<!-------批量删除Modal end------->
|
||||
|
||||
<!-------添加、更新 Form表单 begin------->
|
||||
<Modal
|
||||
:footer-hide="true"
|
||||
:title="saveModal.isUpdate?'更新':'新建'"
|
||||
v-model="saveModal.show"
|
||||
@on-cancel="saveFormClose"
|
||||
width="500"
|
||||
>
|
||||
<PeonyListForm
|
||||
:isUpdate="saveModal.isUpdate"
|
||||
:updateData="saveModal.updateData"
|
||||
@on-form-close="saveFormClose"
|
||||
/>
|
||||
</Modal>
|
||||
<!-------添加、更新 Form表单 end------->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {dateTimeRangeConvert} from '@/lib/util'
|
||||
import { PAGE_SIZE_OPTIONS } from '@/constants/table-page';
|
||||
import { peonyApi } from '@/api/peony';
|
||||
import PeonyListForm from './components/peony-list-form';
|
||||
const PAGE_SIZE_INIT = 20;
|
||||
export default {
|
||||
name: 'PeonyList',
|
||||
components: {
|
||||
PeonyListForm
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
/* -------------------------添加、更新表单 ------------------------- */
|
||||
saveModal: {
|
||||
show: false,
|
||||
isUpdate: false,
|
||||
updateData: null
|
||||
},
|
||||
/* -------------------------批量操作------------------------- */
|
||||
//批量刪除彈出框
|
||||
batchDeleteModal: {
|
||||
show: false
|
||||
},
|
||||
//表格多选选中的元素数组
|
||||
mainTableSelectArray: [],
|
||||
/* -------------------------导出操作------------------------- */
|
||||
//批量导出loading按钮
|
||||
batchExportBtnLoading:false,
|
||||
//导出全部loading按钮
|
||||
allExportBtnLoading:false,
|
||||
/* -------------------------查询条件相关数据-------------------- */
|
||||
//搜索表单
|
||||
queryForm: {
|
||||
//ID
|
||||
id:null,
|
||||
//品种
|
||||
kind:null,
|
||||
//名字
|
||||
name:null,
|
||||
//颜色
|
||||
color:null,
|
||||
createTimeRange: ["",""],
|
||||
updateTimeRange: ["",""],
|
||||
pageNum: 1,
|
||||
pageSize: PAGE_SIZE_INIT,
|
||||
orders: []
|
||||
},
|
||||
//是否展示更多搜索条件
|
||||
showMoreQueryConditionFlag: false,
|
||||
/* -------------------------表格相关数据------------------------- */
|
||||
//表格分页
|
||||
mainTablePage: {
|
||||
total: 0,
|
||||
pageSizeOps: PAGE_SIZE_OPTIONS
|
||||
},
|
||||
//表格
|
||||
mainTable: {
|
||||
//加载中
|
||||
loading: false,
|
||||
//表格数据
|
||||
data: [],
|
||||
//表格列
|
||||
columnArray: [
|
||||
{
|
||||
type: 'selection',
|
||||
width: 30,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: 'ID',
|
||||
key: 'id',
|
||||
tableColumn: 't_peony.id',
|
||||
sortable: 'custom'
|
||||
},
|
||||
{
|
||||
title: '品种',
|
||||
key: 'kind',
|
||||
tableColumn: 't_peony.kind',
|
||||
sortable: 'custom'
|
||||
},
|
||||
{
|
||||
title: '名字',
|
||||
key: 'name',
|
||||
tableColumn: 't_peony.name',
|
||||
sortable: 'custom'
|
||||
},
|
||||
{
|
||||
title: '颜色',
|
||||
key: 'color',
|
||||
tableColumn: 't_peony.color',
|
||||
sortable: 'custom'
|
||||
},
|
||||
{
|
||||
title: '图片链接',
|
||||
key: 'imageUrl',
|
||||
tableColumn: 't_peony.image_url',
|
||||
sortable: 'custom',
|
||||
slot:'imageUrl'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
key: 'createTime',
|
||||
tableColumn: 't_peony.create_time',
|
||||
sortable: 'custom'
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
key: 'updateTime',
|
||||
tableColumn: 't_peony.update_time',
|
||||
sortable: 'custom'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
align: 'right',
|
||||
width: 130,
|
||||
className: 'action-hide',
|
||||
render: (h, params) => {
|
||||
let actions = [
|
||||
{
|
||||
title: '编辑',
|
||||
directives: [
|
||||
{
|
||||
name: 'privilege',
|
||||
value: 'peony-list-update'
|
||||
}
|
||||
],
|
||||
action: () => {
|
||||
this.showEditPeonyForm(params.row);
|
||||
}
|
||||
}
|
||||
];
|
||||
return this.$tableAction(h, actions);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
filters: {},
|
||||
created() {},
|
||||
mounted() {
|
||||
this.queryList();
|
||||
},
|
||||
beforeCreate() {},
|
||||
beforeMount() {},
|
||||
beforeUpdate() {},
|
||||
updated() {},
|
||||
beforeDestroy() {},
|
||||
destroyed() {},
|
||||
activated() {},
|
||||
methods: {
|
||||
/* -------------------------查询相关 begin------------------------- */
|
||||
convertQueryParam(){
|
||||
let createTimeArray = dateTimeRangeConvert(this.queryForm.createTimeRange);
|
||||
let updateTimeArray = dateTimeRangeConvert(this.queryForm.updateTimeRange);
|
||||
return {...this.queryForm,
|
||||
createTimeBegin:createTimeArray[0],
|
||||
createTimeEnd:createTimeArray[1],
|
||||
updateTimeBegin:updateTimeArray[0],
|
||||
updateTimeEnd:updateTimeArray[1]
|
||||
};
|
||||
},
|
||||
//查询
|
||||
async queryList() {
|
||||
this.mainTable.loading = true;
|
||||
try {
|
||||
let params = this.convertQueryParam();
|
||||
let result = await peonyApi.queryPeony(params);
|
||||
this.mainTable.data = result.data.list;
|
||||
this.mainTablePage.total = result.data.total;
|
||||
} finally {
|
||||
this.mainTable.loading = false;
|
||||
}
|
||||
},
|
||||
//重置查询
|
||||
resetQueryList() {
|
||||
let pageSize = this.queryForm.pageSize;
|
||||
this.queryForm = {
|
||||
id:null,
|
||||
kind:null,
|
||||
name:null,
|
||||
color:null,
|
||||
createTimeRange: ["",""],
|
||||
updateTimeRange: ["",""],
|
||||
pageNum: 1,
|
||||
pageSize: pageSize,
|
||||
orders: []
|
||||
};
|
||||
this.queryList();
|
||||
},
|
||||
//修改页码
|
||||
changeMainTablePagePageNum(pageNum) {
|
||||
this.queryForm.pageNum = pageNum;
|
||||
this.queryList();
|
||||
},
|
||||
//修改页大小
|
||||
changeMainTablePagePageSize(pageSize) {
|
||||
this.queryForm.pageNum = 1;
|
||||
this.queryForm.pageSize = pageSize;
|
||||
this.queryList();
|
||||
},
|
||||
//处理排序
|
||||
handleSortChange(column) {
|
||||
if (column.order === 'normal') {
|
||||
this.queryForm.orders = [];
|
||||
} else {
|
||||
this.queryForm.orders = [
|
||||
{
|
||||
column: column.column.tableColumn,
|
||||
asc: 'asc' === column.order
|
||||
}
|
||||
];
|
||||
}
|
||||
this.queryList();
|
||||
},
|
||||
/*-------------------------查询相关 end------------------------- */
|
||||
|
||||
/*-------------------------批量操作 begin------------------------- */
|
||||
//显示批量删除弹窗
|
||||
showBatchDeleteModal() {
|
||||
if (!this.validateMainTableSelection()) {
|
||||
return;
|
||||
}
|
||||
this.batchDeleteModal.show = true;
|
||||
},
|
||||
//批量删除
|
||||
async batchDelete() {
|
||||
this.$Spin.show();
|
||||
await peonyApi.batchDeletePeony(
|
||||
this.mainTableSelectArray.map(e => e.id)
|
||||
);
|
||||
this.batchDeleteModal.show = false;
|
||||
this.$Message.success('刪除成功');
|
||||
this.$Spin.hide();
|
||||
this.queryList();
|
||||
},
|
||||
//清空选中
|
||||
clearMainTableSelection() {
|
||||
this.mainTableSelectArray = [];
|
||||
},
|
||||
//校验是否有选中
|
||||
validateMainTableSelection() {
|
||||
this.mainTableSelectArray = this.$refs.mainTable.getSelection();
|
||||
if (this.mainTableSelectArray.length < 1) {
|
||||
this.$Message.error('请选择至少一条数据');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
/*-------------------------批量操作 end------------------------- */
|
||||
|
||||
/*-------------------------导入导出 begin------------------------- */
|
||||
//导出全部
|
||||
async exportAll(){
|
||||
try{
|
||||
this.allExportBtnLoading = true;
|
||||
let params = this.convertQueryParam();
|
||||
await peonyApi.exportAll(params);
|
||||
} catch(e){
|
||||
console.log(e);
|
||||
}finally{
|
||||
this.allExportBtnLoading = false;
|
||||
}
|
||||
},
|
||||
//批量导出
|
||||
async batchExport(){
|
||||
if (!this.validateMainTableSelection()) {
|
||||
return;
|
||||
}
|
||||
try{
|
||||
this.batchExportBtnLoading = true;
|
||||
await peonyApi.batchExport(this.mainTableSelectArray.map(e => e.id));
|
||||
} catch(e){
|
||||
console.log(e);
|
||||
}finally{
|
||||
this.batchExportBtnLoading = false;
|
||||
}
|
||||
},
|
||||
/*-------------------------导入导出 end------------------------- */
|
||||
|
||||
/*-------------------------添加,修改 表单 begin------------------------- */
|
||||
//显示添加表单
|
||||
showAddPeonyForm() {
|
||||
this.saveModal.isUpdate = false;
|
||||
this.saveModal.show = true;
|
||||
},
|
||||
showEditPeonyForm(updateObject){
|
||||
this.saveModal.isUpdate =true;
|
||||
this.saveModal.updateData = updateObject;
|
||||
this.saveModal.show = true;
|
||||
},
|
||||
saveFormClose(){
|
||||
this.saveModal.show = false;
|
||||
this.queryList();
|
||||
}
|
||||
/*-------------------------添加,修改 表单 end------------------------- */
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -80,19 +80,8 @@
|
||||
<span>任务调度日志</span>
|
||||
</Col>
|
||||
</Row>
|
||||
<Tables
|
||||
:columns="logColumns"
|
||||
:current="logPageNum"
|
||||
:page-size="changeLogPageSize"
|
||||
:pageShow="true"
|
||||
:show-elevator="false"
|
||||
:show-sizer="false"
|
||||
:total="logPageTotal"
|
||||
:value="logData"
|
||||
@on-change="logChangePage"
|
||||
style="height: 420px;"
|
||||
v-if="hasLog"
|
||||
></Tables>
|
||||
<Table border :columns="logColumns" :data="logData"></Table>
|
||||
<Page show-total @on-change="changeLogPageNum" :current="logPageNum" :total="logTotal" show-sizer />
|
||||
<div slot="footer">
|
||||
<Button @click="closeLog" type="primary">关闭</Button>
|
||||
</div>
|
||||
@@ -125,8 +114,8 @@ export default {
|
||||
pageSize: 10,
|
||||
pageTotal: 0,
|
||||
logPageNum: 1,
|
||||
logPageSize: 6,
|
||||
logPageTotal: 0,
|
||||
logPageSize: 10,
|
||||
logTotal: 0,
|
||||
updateItem: {
|
||||
taskBean: '',
|
||||
taskCron: '',
|
||||
@@ -387,7 +376,7 @@ export default {
|
||||
taskId: this.taskId
|
||||
});
|
||||
this.logData = result.data.list;
|
||||
this.logPageTotal = result.data.total;
|
||||
this.logTotal = result.data.total;
|
||||
this.logPageNum = result.data.pageNum;
|
||||
this.logPageSize = result.data.pageSize;
|
||||
this.hasLog = true;
|
||||
@@ -405,7 +394,7 @@ export default {
|
||||
this.getTaskList();
|
||||
},
|
||||
// 日志分页
|
||||
changeLogPageSize(pageNum) {
|
||||
changeLogPageNum(pageNum) {
|
||||
this.logPageNum = pageNum;
|
||||
this.getTaskLog();
|
||||
},
|
||||
@@ -41,7 +41,26 @@
|
||||
</template>
|
||||
<!--遍历得到子模块页面-->
|
||||
<template v-for="(childrenPages, k) in children.children">
|
||||
<MenuItem :key="k" :name="childrenPages.menuKey">
|
||||
<Submenu :key="k" :name="childrenPages.menuKey" v-if="childrenPages.children.length > 0">
|
||||
<template slot="title">
|
||||
<template v-if="childrenPages.hideInMenu">
|
||||
<Icon type="md-open" /><i style="font-size:0.85rem"> {{childrenPages.menuName}}</i>
|
||||
</template>
|
||||
<template v-else>
|
||||
<Icon type="md-menu" /> {{childrenPages.menuName}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-for="(fourLevelItem,m) in childrenPages.children">
|
||||
<MenuItem :key="m" v-if="fourLevelItem.hideInMenu" :name="hideInMenu.menuKey">
|
||||
<Icon type="md-open" /><i style="font-size:0.85rem"> {{fourLevelItem.menuName}}</i>
|
||||
</MenuItem>
|
||||
<MenuItem :key="m" v-else :name="fourLevelItem.menuKey">
|
||||
<Icon type="md-menu" /> {{fourLevelItem.menuName}}
|
||||
</MenuItem>
|
||||
</template>
|
||||
</Submenu>
|
||||
|
||||
<MenuItem :key="k" :name="childrenPages.menuKey" v-else>
|
||||
<template v-if="childrenPages.hideInMenu">
|
||||
<Icon type="md-open" /><i style="font-size:0.85rem"> {{childrenPages.menuName}}</i>
|
||||
</template>
|
||||
@@ -49,6 +68,7 @@
|
||||
<Icon type="md-menu" /> {{childrenPages.menuName}}
|
||||
</template>
|
||||
</MenuItem>
|
||||
|
||||
</template>
|
||||
</Submenu>
|
||||
<MenuItem :key="j" :name="children.menuKey" v-else>
|
||||
@@ -206,7 +226,7 @@ export default {
|
||||
this.menusChangeNum +
|
||||
Math.abs(privilegeList.length - serverMenuList.length);
|
||||
}
|
||||
|
||||
console.error(privilegeTree)
|
||||
this.menuTree = privilegeTree;
|
||||
this.menuList = privilegeList;
|
||||
this.$Spin.hide();
|
||||
Reference in New Issue
Block a user