c3afa824 by xiaomiao

路由前置守卫修改

1 parent 01fc196e
......@@ -8,10 +8,21 @@ export function getUserInfo () {
})
}
// // 获取菜单信息
// export function getMenuInfo () {
// return request({
// url: SERVER.SERVERAPI + '/rest/user/getUserAuthorizationMenus',
// method: 'get',
// })
// }
// 获取菜单信息
export function getMenuInfo () {
export function getMenuInfo (data) {
return request({
url: SERVER.SERVERAPI + '/rest/user/getUserAuthorizationMenus',
method: 'get',
params: {
productCode: data,
},
})
}
\ No newline at end of file
}
......
......@@ -16,247 +16,247 @@
<sidebarRight />
</div>
</div>
</div>
</div>
</template>
<script>
import sidebarLeft from "./Sidebar/sidebarLeft";
import sidebarRight from "./Sidebar/sidebarRight";
import { logout } from "@/api/login.js";
import { mapGetters } from "vuex";
export default {
components: {
sidebarLeft,
sidebarRight,
},
computed: {
...mapGetters(["sidebar", "dicData","userInfo"]),
logoName() {
return this.dicData['sysCode'] && this.dicData['sysCode'].filter(item =>
item.DCODE == "systemTitle"
)
import sidebarLeft from "./Sidebar/sidebarLeft";
import sidebarRight from "./Sidebar/sidebarRight";
import { logout } from "@/api/login.js";
import { mapGetters } from "vuex";
export default {
components: {
sidebarLeft,
sidebarRight,
},
userName(){
return this.userInfo ? this.userInfo.name : ""
}
},
methods: {
onCancel () {
logout()
.then((res) => {
sessionStorage.removeItem("token");
this.$store.dispatch("user/resetState");
this.$router.replace({
path: "/login/jg",
query: {
redirect: this.$route.fullPath,
},
computed: {
...mapGetters(["sidebar", "dicData", "userInfo"]),
logoName () {
return this.dicData['sysCode'] && this.dicData['sysCode'].filter(item =>
item.DCODE == "systemTitle"
)
},
userName () {
return this.userInfo ? this.userInfo.name : ""
}
},
methods: {
onCancel () {
logout()
.then((res) => {
sessionStorage.removeItem("token");
this.$store.dispatch("user/resetState");
this.$router.replace({
path: "/jg",
query: {
redirect: this.$route.fullPath,
},
});
})
.catch((error) => {
// console.dir(error);
});
})
.catch((error) => {
// console.dir(error);
});
},
},
},
};
};
</script>
<style lang="scss" scoped>
/deep/.el-menu--horizontal {
display: flex;
align-items: center;
}
.menubg {
height: 34px;
width: 130px;
text-align: center;
color: #ffffff;
margin-right: 20px;
background: url("~@/image/navbar.png") no-repeat;
background-size: 100% 100%;
}
/deep/.el-menu-item {
@extend .menubg;
}
/deep/.el-submenu {
@extend .menubg;
}
/deep/.el-submenu__title {
height: 34px;
color: #ffffff;
}
/deep/.el-menu--horizontal {
display: flex;
align-items: center;
}
/deep/.el-submenu__title span {
font-size: 14px;
}
.menubg {
height: 34px;
width: 130px;
text-align: center;
color: #ffffff;
margin-right: 20px;
background: url("~@/image/navbar.png") no-repeat;
background-size: 100% 100%;
}
.sidebarLeft {
position: relative;
top: 13px;
width: 30%;
}
/deep/.el-menu-item {
@extend .menubg;
}
/deep/.el-menu {
display: flex;
justify-content: space-between;
}
/deep/.el-submenu {
@extend .menubg;
}
/deep/.el-menu-item {
flex: 1;
width: 100%;
}
/deep/.el-submenu__title {
height: 34px;
color: #ffffff;
}
.sidebarRight {
position: relative;
top: 13px;
width: 30%;
padding-left: 20px;
}
/deep/.el-submenu__title span {
font-size: 14px;
}
// 导航选中背景色
.xuanzhong {
background: url("~@/image/selNavbar.png") no-repeat;
background-size: 100% 100%;
color: #ffffff !important;
font-weight: 700;
}
.sidebarLeft {
position: relative;
top: 13px;
width: 30%;
}
/deep/.el-menu-item:hover {
@extend .xuanzhong;
}
/deep/.el-menu {
display: flex;
justify-content: space-between;
}
/deep/.el-submenu__title:hover {
@extend .xuanzhong;
}
/deep/.el-menu-item {
flex: 1;
width: 100%;
}
/deep/.el-menu--horizontal .el-menu-item:not(.is-disabled):focus {
@extend .xuanzhong;
}
.sidebarRight {
position: relative;
top: 13px;
width: 30%;
padding-left: 20px;
}
/deep/.el-menu-item.is-active {
@extend .xuanzhong;
}
// 导航选中背景色
.xuanzhong {
background: url("~@/image/selNavbar.png") no-repeat;
background-size: 100% 100%;
color: #ffffff !important;
font-weight: 700;
}
.navbar {
height: $headerHeight;
overflow: hidden;
position: relative;
display: flex;
align-items: center;
padding: 0 20px;
justify-content: space-between;
background: url("~@/image/header.png") no-repeat;
background-size: 100% 100%;
/deep/.el-menu-item:hover {
@extend .xuanzhong;
}
.user {
font-size: 12px;
color: #ffffff;
position: absolute;
right: 20px;
top: 0;
cursor: pointer;
/deep/.el-submenu__title:hover {
@extend .xuanzhong;
}
.closeStyle {
margin-right: 5px;
}
/deep/.el-menu--horizontal .el-menu-item:not(.is-disabled):focus {
@extend .xuanzhong;
}
.title {
position: absolute;
left: 0;
top: 10px;
bottom: 0;
right: 0;
margin: 0 auto;
font-size: 32px;
color: #ffffff;
font-weight: 700;
text-align: center;
/deep/.el-menu-item.is-active {
@extend .xuanzhong;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
.navbar {
height: $headerHeight;
overflow: hidden;
position: relative;
display: flex;
align-items: center;
padding: 0 20px;
justify-content: space-between;
background: url("~@/image/header.png") no-repeat;
background-size: 100% 100%;
.shutdown {
font-size: 20px;
margin-left: 15px;
.user {
font-size: 12px;
color: #ffffff;
position: absolute;
right: 20px;
top: 0;
cursor: pointer;
.closeStyle {
margin-right: 5px;
}
}
.organization-item {
margin-right: 40px;
margin-top: -40px !important;
.title {
position: absolute;
left: 0;
top: 10px;
bottom: 0;
right: 0;
margin: 0 auto;
font-size: 32px;
color: #ffffff;
font-weight: 700;
text-align: center;
}
.item {
margin-right: 40px;
margin-top: -20px;
line-height: 18.4px;
cursor: pointer;
position: relative;
.right-menu {
float: right;
height: 100%;
line-height: 50px;
display: flex;
align-items: center;
.item-box {
position: absolute;
top: -5px;
left: 3px;
width: 100%;
min-width: 25px;
height: 25px;
.shutdown {
font-size: 20px;
margin-left: 15px;
cursor: pointer;
z-index: 100;
}
}
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
height: 100%;
font-size: 18px;
color: #fff;
vertical-align: text-bottom;
.organization-item {
margin-right: 40px;
margin-top: -40px !important;
}
&.hover-effect {
.item {
margin-right: 40px;
margin-top: -20px;
line-height: 18.4px;
cursor: pointer;
transition: background 0.3s;
display: flex;
align-items: center;
position: relative;
&:hover {
background: rgba(0, 0, 0, 0.025);
.item-box {
position: absolute;
top: -5px;
left: 3px;
width: 100%;
min-width: 25px;
height: 25px;
cursor: pointer;
z-index: 100;
}
}
}
.avatar-wrapper {
position: relative;
display: flex;
height: 40px;
align-items: center;
&:focus {
outline: none;
}
.user-avatar {
cursor: pointer;
width: 35px;
height: 35px;
border-radius: 50%;
.right-menu-item {
display: inline-block;
height: 100%;
font-size: 18px;
color: #fff;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
display: flex;
align-items: center;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -15px;
top: 17px;
font-size: 12px;
.avatar-wrapper {
position: relative;
display: flex;
height: 40px;
align-items: center;
.user-avatar {
cursor: pointer;
width: 35px;
height: 35px;
border-radius: 50%;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -15px;
top: 17px;
font-size: 12px;
}
}
}
}
}
</style>
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-09 21:06:38
*/
import router from "./router";
import store from "./store";
import { getMenuInfo } from "@/api/user";
import NProgress from "nprogress"; // progress bar
import "nprogress/nprogress.css"; // progress bar style
import getPageTitle from "@/utils/get-page-title";
import Cookies from "js-cookie";
NProgress.configure({ showSpinner: false }); // NProgress Configuration
router.beforeEach(async (to, from, next) => {
NProgress.start();
document.title = getPageTitle(to.meta.title);
let hasAddDict = store.state.dict.addDict;
let hasUser = store.state.user.hasUser;
let hasAddRoute = store.state.permission.addRoutes;
if (to.path == "/sb" || to.path == "/jg") {
sessionStorage.removeItem("token");
sessionStorage.setItem("psth", to.path)
next();
} else {
let code = sessionStorage.getItem("psth") == "/sb" ? "BDCSBPT" : "BDCJGPT"
//判断token是否存在
const hasToken = sessionStorage.getItem("token");
if (hasToken) {
//请求用户信息
if (!hasUser) {
store.dispatch("user/getUserInfo");
import("@/styles/public.scss");
}
if (hasAddRoute) {
next();
} else {
//请求菜单
const { result: getMenuData } = (await getMenuInfo(code)) || [];
const accessRoutes = await store.dispatch(
"permission/generateRoutes",
getMenuData
);
router.addRoutes([
...accessRoutes,
{ path: "*", redirect: "/404", hidden: true },
]);
const routeTo = Cookies.get("routerTo");
if (!hasAddDict) {
await store.dispatch("dict/generateDic");
}
if (routeTo && routeTo !== "/") {
next({ ...to, replace: true });
} else {
next("/home");
}
}
} else {
next(sessionStorage.getItem("psth"));
}
}
NProgress.done();
});
router.afterEach((to) => {
// 解决刷新页面报404问题
Cookies.set("routerTo", to.fullPath);
NProgress.done();
});
/*
* @Description:
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-07 09:43:25
* @LastEditTime: 2023-03-09 21:06:38
*/
import router from "./router";
import store from "./store";
......@@ -18,50 +18,12 @@ router.beforeEach(async (to, from, next) => {
let hasAddDict = store.state.dict.addDict;
let hasUser = store.state.user.hasUser;
let hasAddRoute = store.state.permission.addRoutes;
if (to.path == "/login/sb") {
sessionStorage.removeItem("token");
next();
} else if (to.path !== "/login/jg") {
//判断token是否存在
const hasToken = sessionStorage.getItem("token");
if (hasToken) {
//请求用户信息
if (!hasUser) {
store.dispatch("user/getUserInfo");
}
if (hasAddRoute) {
next();
} else {
//请求菜单
const { result: getMenuData } = (await getMenuInfo()) || [];
const accessRoutes = await store.dispatch(
"permission/generateRoutes",
getMenuData
);
router.addRoutes([
...accessRoutes,
{ path: "*", redirect: "/404", hidden: true },
]);
const routeTo = Cookies.get("routerTo");
if (!hasAddDict) {
await store.dispatch("dict/generateDic");
}
if (routeTo && routeTo !== "/") {
next({ ...to, replace: true });
} else {
alert("上报")
next("/home");
}
}
} else {
next("/login/sb");
}
}
if (to.path == "/login/jg") {
if (to.path == "/sb" || to.path == "/jg") {
sessionStorage.removeItem("token");
sessionStorage.setItem("psth", to.path)
next();
} else if (to.path !== "/login/sb") {
} else {
let code = sessionStorage.getItem("psth") == "/sb" ? "BDCSBPT" : "BDCJGPT"
//判断token是否存在
const hasToken = sessionStorage.getItem("token");
if (hasToken) {
......@@ -74,7 +36,7 @@ router.beforeEach(async (to, from, next) => {
next();
} else {
//请求菜单
const { result: getMenuData } = (await getMenuInfo()) || [];
const { result: getMenuData } = (await getMenuInfo(code)) || [];
const accessRoutes = await store.dispatch(
"permission/generateRoutes",
getMenuData
......@@ -90,14 +52,16 @@ router.beforeEach(async (to, from, next) => {
if (routeTo && routeTo !== "/") {
next({ ...to, replace: true });
} else {
alert("监管")
next("/home");
}
}
} else if (sessionStorage.getItem("psth")) {
next(sessionStorage.getItem("psth"));
} else {
next("/login/jg");
next("/jg");
}
}
NProgress.done();
});
router.afterEach((to) => {
......
......@@ -24,12 +24,12 @@ export const constantRoutes = [
},
//登录
{
path: "/login/jg",
path: "/jg",
name: "loginjg",
component: () => import("@/views/loginjg/index.vue"),
},
{
path: "/login/sb",
path: "/sb",
name: "loginsb",
component: () => import("@/views/loginsb/index.vue"),
},
......
<template>
<div class="bg">
<div class="login-inner-bg login">
<h2>{{ productName }}</h2>
<div class="user_style">
<h3>欢迎登录</h3>
<el-form :model="user" :rules="rules" ref="user" id="loginform" class="demo-ruleForm">
<el-form-item prop="account">
<el-input class="username" v-model="user.account" placeholder="请输入用户名"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input type="password" class="password" @keyup.enter.native="login('user')" v-model="user.password"
placeholder="请输入密码"></el-input>
</el-form-item>
<el-form-item class="login-btn">
<el-button type="primary" style="width: 100%" @click="login('user')">登录</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script>
import { loginIn } from "@/api/login.js";
import { api, getAction } from "@/api/manageApi";
export default {
name: "Login",
data () {
return {
user: {
account: "",
password: "",
checkStatus: false,
},
productName: "",
rules: {
account: [{ required: true, message: "请填写帐号", trigger: "blur" }],
password: [{ required: true, message: "请填写密码", trigger: "blur" }],
},
};
},
created () {
const params = {};
const queryOptions = {
conditionGroup: {
conditions: [
{
property: "code",
value: "BDCJGPT",
operator: "EQ",
},
],
queryRelation: "AND",
},
};
params.queryOptions = JSON.stringify(queryOptions);
//根据子系统code获取子系统详细信息
getAction(api.subsystem, params).then((res) => {
if (res.status === 1) {
this.productName = res.content[0].name;
this.$store.dispatch("products/setData", res.content[0]);
} else {
this.$message.error({ message: res.message, showClose: true });
}
});
},
mounted () {
// this.checkUserName();
},
methods: {
//记住用户名
checkUserName: function (flag) {
this.user.checkStatus = flag;
if (this.user.checkStatus) {
localStorage.setItem("accountId", this.user.account);
let name = localStorage.getItem("accountId");
if (name === "") {
return;
} else {
this.user.account = name;
}
} else {
this.user.account = localStorage.getItem("accountId");
}
},
login (user) {
var self = this;
this.$refs[user].validate((valid) => {
if (valid) {
loginIn(self.user.account, self.user.password)
.then((res) => {
if (res.status === 1) {
//存储token
sessionStorage.setItem("token", `Bearer ${res.content}`);
//登录成功后需判断有无重定向,没有重定向则跳转首页
this.$router.replace(this.$route.query.redirect || "/");
} else {
//错误处理
}
})
.catch((error) => {
// console.dir(error);
});
}
});
},
},
components: {},
};
</script>
<style scoped lang="scss">
.username,
.password {
position: relative;
&:before {
content: "";
display: block;
width: 16px;
height: 16px;
position: absolute;
left: 10px;
top: 7px;
background-size: 100% 100%;
}
/deep/ .el-input__inner {
text-indent: 24px;
border: 1px solid rgba(11, 161, 248, 0.4);
background-color: rgba(6, 135, 205, 0.3) !important;
}
}
.username::before {
background-image: url(../../image/username.png);
}
.password::before {
background-image: url(../../image/password.png);
}
.bg {
width: 100%;
height: 100%;
min-width: 1440px;
min-height: 560px;
background: url(../../image/loginBoxBg.png) no-repeat;
background-size: 100% 100%;
overflow: hidden;
position: relative;
}
.login-inner-bg {
background: url(../../image/loginBg.png) no-repeat;
width: 21.6%;
height: 43%;
min-width: 360px;
min-height: 380px;
top: 30%;
right: 20%;
position: absolute;
background-size: 100% 100%;
box-sizing: border-box;
padding: 56px;
h2 {
width: 100%;
font-size: 36px;
font-weight: 700;
color: #fff;
text-align: center;
white-space: nowrap;
position: absolute;
right: 0;
top: -70px;
background-image: linear-gradient(180deg,
rgba(99, 163, 255, 1) 0,
rgba(99, 163, 255, 1) 0,
rgba(182, 220, 255, 1) 49.731445%,
rgba(114, 190, 255, 1) 100%,
rgba(114, 190, 255, 1) 100%);
overflow-wrap: break-word;
color: rgba(255, 255, 255, 1);
font-size: 36px;
font-family: AlimamaShuHeiTi-Bold;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
.login {
.user_style {
h3 {
color: #fff;
font-size: 22px;
font-weight: normal;
text-align: center;
margin: 16px auto 34px;
font-weight: 400;
}
}
.btn {
width: 100%;
height: 6vh;
background-color: #00c2de;
border-radius: 5px;
font-size: 1.4vw;
color: #ffffff;
}
.btn:hover {
cursor: pointer;
background-color: #2d8cf0;
}
}
.login #loginform {
.el-form-item {
margin-bottom: 24px !important;
}
.login-btn {
margin-top: 40px !important;
}
.el-button {
font-size: 18px;
background: #0d8cc0 !important;
color: #ffffff !important;
cursor: pointer !important;
}
.el-input__inner {
width: 100% !important;
}
.el-checkbox__label {
color: #fff;
}
}
.inputUser .ivu-input {
padding: 6px 24px !important;
border: 1px solid #9f9f9f !important;
}
</style>
......@@ -60,7 +60,7 @@
getAction(api.subsystem, params).then((res) => {
if (res.status === 1) {
this.productName = res.content[0].name;
this.$store.dispatch("products/setData", res.content[0]);
this.$store.dispatch("products/setData", res.content[0].code);
} else {
this.$message.error({ message: res.message, showClose: true });
}
......
......@@ -67,7 +67,7 @@
getAction(api.subsystem, params).then((res) => {
if (res.status === 1) {
this.productName = res.content[0].name;
this.$store.dispatch("products/setData", res.content[0]);
this.$store.dispatch("products/setData", res.content[0].code);
} else {
this.$message.error({ message: res.message, showClose: true });
}
......
......@@ -77,14 +77,14 @@
userInfo: {
handler: function (val) {
if (val) {
this.getUserInfo(val.id)
this.getUserdata(val.id)
}
}
}
},
mounted () {
if (this.userInfo) {
this.getUserInfo(this.userInfo)
this.getUserdata(this.userInfo)
}
this.sexList = [
{
......@@ -105,7 +105,7 @@
]
},
methods: {
getUserInfo (p) {
getUserdata (p) {
getAction(`${api.users}/${p.id}`).then((res) => {
if (res.status === 1) {
this.form = res.content
......@@ -120,7 +120,7 @@
putAction(`${api.users}/${this.form.id}`, this.form).then((res) => {
if (res.status === 1) {
this.$message.success({ message: res.message, showClose: true })
this.getUserInfo(this.form.id)
this.getUserdata(this.form.id)
} else {
this.$message.error({ message: res.message, showClose: true })
}
......
......@@ -64,173 +64,174 @@
</template>
<script>
import Dialog from "@/components/Dialog/";
import { getParentMenuListAction } from '@/api/authorityManage'
import JsonEditor from '@/components/JsonEditors'
import IconList from '@/components/IconList'
import { validateCode } from '@/utils/validate';
import { api, httpAction } from '@/api/manageApi'
export default {
name: 'MenuModal',
components: {
IconList,
JsonEditor,
Dialog
},
props: {
productId: {
type: String,
default: ''
}
},
data () {
return {
form: {
icon: '',
code: ''
},
rules: {
name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
code: [
{ required: true, message: '必填', trigger: 'blur' },
{ validator: validateCode, trigger: 'blur' }
]
},
title: '',
type: '',
visible: false,
parentMenuList: [],
menuKey: 0,
jumpModeList: [
{ name: '在当前页面显示', value: 1 },
{ name: '跳转到新页面', value: 2 }
],
setProps: {
value: 'id',
label: 'name',
children: 'children',
expandTrigger: 'hover',
checkStrictly: true, // 可取消关联,选择任意一级选项
emitPath: false
},
dataUrl: api.menus
}
},
computed: {
codeComputed: {
get: function () {
return this.form.code
},
set: function (val) {
this.form.code = val.toUpperCase()
}
}
},
created () { },
mounted () { },
methods: {
// 获取父级菜单
getParentMenuList (id) {
getParentMenuListAction(id).then((res) => {
if (res.status === 1) {
const list = this.$dealArrChildren(res.content)
if (id) {
this.parentMenuList = this.$dealArrDisabled(
this.$deepCopy(list),
id
)
this.menuKey++
} else {
this.parentMenuList = list
}
} else {
this.$message.error({ message: res.message, showClose: true })
}
})
},
getIconList () {
this.$refs.iconList.show(true)
},
getIconName (data) {
this.form.icon = data
import Dialog from "@/components/Dialog/";
import { getParentMenuListAction } from '@/api/authorityManage'
import JsonEditor from '@/components/JsonEditors'
import IconList from '@/components/IconList'
import { validateCode } from '@/utils/validate';
import { api, httpAction } from '@/api/manageApi'
export default {
name: 'MenuModal',
components: {
IconList,
JsonEditor,
Dialog
},
// 配置参数
getJsonString (data) {
this.form.metadata = data
},
// 新增菜单
add () {
this.getParentMenuList(this.productId)
this.visible = true
this.type = 0
this.form.jumpMode = 1
props: {
productId: {
type: String,
default: ''
}
},
// 编辑菜单
edit (record) {
this.type = 1
// 若有id为编辑
if (record.id) {
this.$nextTick(() => {
this.form = Object.assign({}, record)
this.getParentMenuList(this.productId)
})
data () {
return {
form: {
icon: '',
code: ''
},
rules: {
name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
code: [
{ required: true, message: '必填', trigger: 'blur' },
{ validator: validateCode, trigger: 'blur' }
]
},
title: '',
type: '',
visible: false,
parentMenuList: [],
menuKey: 0,
jumpModeList: [
{ name: '在当前页面显示', value: 1 },
{ name: '跳转到新页面', value: 2 }
],
setProps: {
value: 'id',
label: 'name',
children: 'children',
expandTrigger: 'hover',
checkStrictly: true, // 可取消关联,选择任意一级选项
emitPath: false
},
dataUrl: api.menus
}
this.visible = true
},
// 选择上级菜单
handleChange (value) {
this.form.parentId = value
computed: {
codeComputed: {
get: function () {
return this.form.code
},
set: function (val) {
this.form.code = val.toUpperCase()
}
}
},
// 保存
submitForm (submitType) {
this.$refs.form.validate((valid) => {
if (valid) {
let method = ''
let url = ''
const formData = this.form
formData.productId = this.productId
if (!formData.id) {
method = 'post'
url = this.dataUrl
created () { },
mounted () { },
methods: {
// 获取父级菜单
getParentMenuList (id) {
getParentMenuListAction(id).then((res) => {
if (res.status === 1) {
const list = this.$dealArrChildren(res.content)
if (id) {
this.parentMenuList = this.$dealArrDisabled(
this.$deepCopy(list),
id
)
this.menuKey++
} else {
this.parentMenuList = list
}
} else {
method = 'put'
url = `${this.dataUrl}/${formData.id}`
this.$message.error({ message: res.message, showClose: true })
}
httpAction(url, formData, method)
.then((res) => {
if (res.status === 1) {
this.$message.success({
message: res.message,
showClose: true
})
})
},
getIconList () {
this.$refs.iconList.show(true)
},
getIconName (data) {
this.form.icon = data
},
// 配置参数
getJsonString (data) {
this.form.metadata = data
},
// 新增菜单
add () {
this.getParentMenuList(this.productId)
this.visible = true
this.type = 0
this.form.jumpMode = 1
},
// 编辑菜单
edit (record) {
this.type = 1
// 若有id为编辑
if (record.id) {
this.$nextTick(() => {
this.form = Object.assign({}, record)
this.getParentMenuList(this.productId)
})
}
this.visible = true
},
// 选择上级菜单
handleChange (value) {
this.form.parentId = value
},
// 保存
submitForm (submitType) {
this.$refs.form.validate((valid) => {
if (valid) {
let method = ''
let url = ''
const formData = this.form
formData.productId = this.productId
if (!formData.id) {
method = 'post'
url = this.dataUrl
} else {
method = 'put'
url = `${this.dataUrl}/${formData.id}`
}
debugger
httpAction(url, formData, method)
.then((res) => {
if (res.status === 1) {
this.$message.success({
message: res.message,
showClose: true
})
this.resetForm()
this.$emit('ok')
} else {
this.$message.error({ message: res.message, showClose: true })
}
})
.catch((err) => {
console.log(err)
})
this.resetForm()
this.$emit('ok')
} else {
this.$message.error({ message: res.message, showClose: true })
}
})
.catch((err) => {
console.log(err)
})
}
})
},
resetForm () {
this.$refs.form.resetFields()
this.form = {
icon: '',
code: ''
}
})
},
resetForm () {
this.$refs.form.resetFields()
this.form = {
icon: '',
code: ''
},
close () {
this.resetForm()
this.visible = false
}
},
close () {
this.resetForm()
this.visible = false
}
}
}
</script>
<style scoped lang="scss">
// @import "~@/styles/public.scss";
// @import "~@/styles/public.scss";
</style>
......
......@@ -23,165 +23,169 @@
</div>
</template>
<script>
// 定时任务
import data from "./data";
import { deleteAction, getAction, api } from "@/api/manageApi";
import EditDialog from "./edit-dialog.vue";
// import authorizationdiglog from "./authorizationdiglog.vue";
export default {
name: "menus",
components: {
EditDialog,
// authorizationdiglog,
},
data () {
return {
tablelistData: [],
resourceCategoryId: "",
taskData: null,
form: {
job_name: "",
currentPage: 1,
},
title: "",
queryParam: {},
selectType: "0",
queryName: "",
organizationId: "", // 组织机构ID
departmentId: "", // 部门ID
departmentList: [], // 部门列表
levelList: [], // 职务级别
sexList: [],
selectionList: [],
tableData: {
columns: [].concat(data.columns()).concat([
{
label: "操作",
width: 380,
render: (h, scope) => {
return (
<div>
<el-button
type="text"
size="mini"
icon="el-icon-edit"
onClick={() => {
this.handleEdit(scope.row);
}}
>
修改
</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-delete"
style="color:#F56C6C"
onClick={() => {
this.handleDelete(scope.row.id, scope.row.name);
}}
>
删除
</el-button>
</div>
);
},
},
]),
data: [],
},
pageData: {
total: 5,
pageSize: 15,
current: 1,
},
tableUrl: api.menus, // 菜单接口地址
meumurlid: api.subsystem,// 项目id接口地址
productId: ""//项目id
};
},
created () {
this.getTableList();
},
methods: {
// 加载表格数据
getTableList () {
// 定时任务
import data from "./data";
import { deleteAction, getAction, api } from "@/api/manageApi";
import EditDialog from "./edit-dialog.vue";
import { mapGetters } from "vuex";
// import authorizationdiglog from "./authorizationdiglog.vue";
export default {
name: "menus",
components: {
EditDialog,
// authorizationdiglog,
},
data () {
return {
tablelistData: [],
resourceCategoryId: "",
taskData: null,
form: {
job_name: "",
currentPage: 1,
},
title: "",
queryParam: {},
selectType: "0",
queryName: "",
organizationId: "", // 组织机构ID
departmentId: "", // 部门ID
departmentList: [], // 部门列表
levelList: [], // 职务级别
sexList: [],
const queryOptionsid = {
conditionGroup: {
queryRelation: "AND",
conditions: [
selectionList: [],
tableData: {
columns: [].concat(data.columns()).concat([
{
property: "code",
value: "BDCJGPT",
operator: "EQ",
label: "操作",
width: 380,
render: (h, scope) => {
return (
<div>
<el-button
type="text"
size="mini"
icon="el-icon-edit"
onClick={() => {
this.handleEdit(scope.row);
}}
>
修改
</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-delete"
style="color:#F56C6C"
onClick={() => {
this.handleDelete(scope.row.id, scope.row.name);
}}
>
删除
</el-button>
</div>
);
},
},
],
]),
data: [],
},
pageData: {
total: 5,
pageSize: 15,
current: 1,
},
tableUrl: api.menus, // 菜单接口地址
meumurlid: api.subsystem,// 项目id接口地址
productId: ""//项目id
};
const params = {
queryOptions: queryOptionsid,
};
// 获取系统id
getAction(this.meumurlid, params)
.then((res) => {
this.productId = res.content[0].id;
let queryOptions = {
conditionGroup: {
conditions: [
{
property: "productId",
value: this.productId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
if (!this.tableUrl) {
console.log("请设置tableUrl属性为接口地址!");
return;
}
if (this.queryOptions !== "") {
this.queryParam.queryOptions = JSON.stringify(queryOptions);
}
// 查询系统菜单
getAction(this.tableUrl, this.queryParam)
.then((res) => {
if (res.status === 1) {
this.loading = false;
this.tablelistData = res.content;
} else {
this.$message.error({ message: res.message, showClose: true });
this.loading = false;
}
})
.catch((error) => {
console.log("er", error);
this.loading = false;
});
})
.catch((error) => {
console.log("er", error);
});
},
// 新增菜单
handleAdd () {
this.$refs.dialogForm.add();
this.$refs.dialogForm.title = "添加";
created () {
this.getTableList();
},
// 修改
handleEdit (record) {
this.$refs.dialogForm.edit(record);
this.$refs.dialogForm.title = "修改";
computed: {
...mapGetters(["products"]),
},
// 删除
handleDelete (id, content) {
this.$confirm(
`<div class="customer-message-wrapper">
methods: {
// 加载表格数据
getTableList () {
const queryOptionsid = {
conditionGroup: {
queryRelation: "AND",
conditions: [
{
property: "code",
value: this.products,
operator: "EQ",
},
],
},
};
const params = {
queryOptions: queryOptionsid,
};
// 获取系统id
getAction(this.meumurlid, params)
.then((res) => {
this.productId = res.content[0].id;
let queryOptions = {
conditionGroup: {
conditions: [
{
property: "productId",
value: this.productId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
if (!this.tableUrl) {
console.log("请设置tableUrl属性为接口地址!");
return;
}
if (this.queryOptions !== "") {
this.queryParam.queryOptions = JSON.stringify(queryOptions);
}
// 查询系统菜单
getAction(this.tableUrl, this.queryParam)
.then((res) => {
if (res.status === 1) {
this.loading = false;
this.tablelistData = res.content;
} else {
this.$message.error({ message: res.message, showClose: true });
this.loading = false;
}
})
.catch((error) => {
console.log("er", error);
this.loading = false;
});
})
.catch((error) => {
console.log("er", error);
});
},
// 新增菜单
handleAdd () {
this.$refs.dialogForm.add();
this.$refs.dialogForm.title = "添加";
},
// 修改
handleEdit (record) {
this.$refs.dialogForm.edit(record);
this.$refs.dialogForm.title = "修改";
},
// 删除
handleDelete (id, content) {
this.$confirm(
`<div class="customer-message-wrapper">
<h5 class="title">您确认要执行该操作用于以下信息:</h5>
<p class="content" aria-controls="${content}">${content}
</p>
......@@ -189,51 +193,51 @@ export default {
<span >无法恢复</span>
</p>
</div>`,
'执行确认',
{
dangerouslyUseHTMLString: true,
customClass: 'customer-delete',
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
.then(() => {
if (!this.tableUrl) {
this.$message.error({
message: '请设置tableUrl属性为接口地址!',
showClose: true
})
return
'执行确认',
{
dangerouslyUseHTMLString: true,
customClass: 'customer-delete',
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
const url = this.tableUrl + '/' + id
deleteAction(url).then(res => {
if (res.status === 1) {
this.$message.success({ message: res.message, showClose: true })
this.reloadTableData()
} else {
this.$message.error({ message: res.message, showClose: true })
)
.then(() => {
if (!this.tableUrl) {
this.$message.error({
message: '请设置tableUrl属性为接口地址!',
showClose: true
})
return
}
const url = this.tableUrl + '/' + id
deleteAction(url).then(res => {
if (res.status === 1) {
this.$message.success({ message: res.message, showClose: true })
this.reloadTableData()
} else {
this.$message.error({ message: res.message, showClose: true })
}
})
})
})
.catch(() => { })
},
// 新增、编辑回显
reloadTableData () {
this.getTableList()
.catch(() => { })
},
// 新增、编辑回显
reloadTableData () {
this.getTableList()
},
},
},
};
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/mixin.scss";
// @import "~@/styles/public.scss";
.btnColRight {
margin-top: 20px;
}
// @import "~@/styles/public.scss";
.btnColRight {
margin-top: 20px;
}
/deep/.el-table__expand-icon {
color: #fff;
}
/deep/.el-table__expand-icon {
color: #fff;
}
</style>
......
......@@ -11,11 +11,6 @@ class data extends filter {
width: 130
},
{
prop: "type",
label: "类别",
width: 200
},
{
prop: "description",
label: "备注"
}
......
......@@ -18,16 +18,6 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="角色类型:" prop="roleType">
<el-input
v-model="dialogForm.roleType"
clearable
placeholder="角色类型" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注:" class="form-item-mb0">
......@@ -75,9 +65,6 @@
roleName: [
{ required: true, message: '请输入角色名称', trigger: 'blur' }
],
roleType: [
{ required: true, message: '请输入角色类型', trigger: 'blur' }
]
},
roleTypeOptions: [
{ name: '定制', value: '定制' },
......@@ -109,7 +96,6 @@
})
this.dialogForm = {
roleName: '',
roleType: ''
}
this.showAddEditDialog = val
this.$emit('ok', this.menuType)
......@@ -130,7 +116,6 @@
})
this.dialogForm = {
roleName: '',
roleType: ''
}
this.showAddEditDialog = val
this.$emit('ok', this.menuType)
......@@ -153,7 +138,6 @@
this.$refs.form.resetFields()
this.dialogForm = {
roleName: '',
roleType: ''
}
this.showAddEditDialog = false
}
......
......@@ -22,86 +22,87 @@
</div>
</template>
<script>
import {
getUuid,
judgeSort,
realMove,
findParents,
removeTreeListItem,
} from "@/utils/operation";
import { getRolesById, getAuthorityListAction } from "@/api/authorityManage";
import { getUserRoles } from "@/api/personnelManage";
import data from "./data";
import { api, getAction, deleteAction } from "@/api/manageApi";
import tableMixin from "@/mixins/tableMixin.js";
import EditDialog from "./edit-dialog.vue";
import Roleslistdiglog from "./roleslistdiglog.vue";
export default {
name: "menus",
mixins: [tableMixin],
components: {
EditDialog,
Roleslistdiglog,
},
data () {
return {
personlist: null,
waitMemberList: [],
keyList: [],
listdata: [],
tableUrl: api.roles,
form: {
job_name: "",
currentPage: 1,
},
// 当前所选角色id
roleId: "",
title: "",
queryParam: {},
multipleSelection: [],
// 菜单列表
menutablelistData: [],
tableUrl: api.menus, // 菜单接口地址
meumurlid: api.subsystem, // 项目id接口地址
selectType: "0",
queryName: "",
organizationId: "", // 组织机构ID
departmentId: "", // 部门ID
departmentList: [], // 部门列表
levelList: [], // 职务级别
sexList: [],
operationCodes: null, // 操作符对象
operationList: [], // 获取授权列表需要提交的操作符数组
typeOptions: [
{
value: "0",
label: "姓名",
},
{
value: "1",
label: "工号",
},
{
value: "2",
label: "部门",
},
{
value: "3",
label: "机构",
import {
getUuid,
judgeSort,
realMove,
findParents,
removeTreeListItem,
} from "@/utils/operation";
import { getRolesById, getAuthorityListAction } from "@/api/authorityManage";
import { getUserRoles } from "@/api/personnelManage";
import data from "./data";
import { api, getAction, deleteAction } from "@/api/manageApi";
import tableMixin from "@/mixins/tableMixin.js";
import EditDialog from "./edit-dialog.vue";
import Roleslistdiglog from "./roleslistdiglog.vue";
import { mapGetters } from "vuex";
export default {
name: "menus",
mixins: [tableMixin],
components: {
EditDialog,
Roleslistdiglog,
},
data () {
return {
personlist: null,
waitMemberList: [],
keyList: [],
listdata: [],
tableUrlroles: api.roles,
form: {
job_name: "",
currentPage: 1,
},
],
selectionList: [],
tableData: {
columns: [
// 当前所选角色id
roleId: "",
title: "",
queryParam: {},
multipleSelection: [],
// 菜单列表
menutablelistData: [],
tableUrl: api.menus, // 菜单接口地址
meumurlid: api.subsystem, // 项目id接口地址
selectType: "0",
queryName: "",
organizationId: "", // 组织机构ID
departmentId: "", // 部门ID
departmentList: [], // 部门列表
levelList: [], // 职务级别
sexList: [],
operationCodes: null, // 操作符对象
operationList: [], // 获取授权列表需要提交的操作符数组
typeOptions: [
{
label: "序号",
type: "index",
width: "50",
index: this.indexMethod,
value: "0",
label: "姓名",
},
]
.concat(data.columns())
{
value: "1",
label: "工号",
},
{
value: "2",
label: "部门",
},
{
value: "3",
label: "机构",
},
],
selectionList: [],
tableData: {
columns: [
{
label: "序号",
type: "index",
width: "50",
index: this.indexMethod,
},
]
.concat(data.columns())
.concat([
{
label: "排序",
......@@ -208,202 +209,204 @@ export default {
},
}]),
},
},
data: [],
}
},
computed: {
...mapGetters(["products"]),
},
created () {
this.getTableData();
this.getTableList()
},
mounted () { },
methods: {
// 获取角色列表
getTableData () {
let Builtinrole = [];
let Publicrole = [];
created () {
this.getTableData();
this.getTableList()
},
mounted () { },
methods: {
// 获取角色列表
getTableData () {
let Builtinrole = [];
let Publicrole = [];
getRolesById(1)
.then((res) => {
Builtinrole = res.content;
getRolesById(2)
.then((res) => {
console.log("角色列表", res);
Publicrole = res.content;
getRolesById(1)
.then((res) => {
Builtinrole = res.content;
getRolesById(2)
.then((res) => {
Publicrole = res.content;
this.listdata = Builtinrole.concat(Publicrole);
this.listdata = Builtinrole.concat(Publicrole);
this.listdata = judgeSort(this.listdata);
})
.catch((e) => console.error(e));
})
.catch((e) => console.error(e));
},
this.listdata = judgeSort(this.listdata);
})
.catch((e) => console.error(e));
})
.catch((e) => console.error(e));
},
// 获取菜单列表
getTableList () {
const queryOptionsid = {
conditionGroup: {
queryRelation: "AND",
conditions: [
{
property: "code",
value: "BDCJGPT",
operator: "EQ",
},
],
},
};
const params = {
queryOptions: queryOptionsid,
};
// 获取系统id
getAction(this.meumurlid, params)
.then((res) => {
this.productId = res.content[0].id;
this.getAuthorityList(res.content[0].id, res.content[0].code)
this.selectedSubsystemCode = res.content[0].code
let queryOptions = {
conditionGroup: {
conditions: [
{
property: "productId",
value: this.productId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
if (!this.tableUrl) {
console.log("请设置tableUrl属性为接口地址!");
return;
}
if (this.queryOptions !== "") {
this.queryParam.queryOptions = JSON.stringify(queryOptions);
}
// 查询系统菜单
getAction(this.tableUrl, this.queryParam)
.then((res) => {
if (res.status === 1) {
this.loading = false;
this.menutablelistData = res.content;
} else {
this.$message.error({ message: res.message, showClose: true });
// 获取菜单列表
getTableList () {
const queryOptionsid = {
conditionGroup: {
queryRelation: "AND",
conditions: [
{
property: "code",
value: this.products,
operator: "EQ",
},
],
},
};
const params = {
queryOptions: queryOptionsid,
};
// 获取系统id
getAction(this.meumurlid, params)
.then((res) => {
this.productId = res.content[0].id;
this.getAuthorityList(res.content[0].id, res.content[0].code)
this.selectedSubsystemCode = res.content[0].code
let queryOptions = {
conditionGroup: {
conditions: [
{
property: "productId",
value: this.productId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
if (!this.tableUrl) {
console.log("请设置tableUrl属性为接口地址!");
return;
}
if (this.queryOptions !== "") {
this.queryParam.queryOptions = JSON.stringify(queryOptions);
}
// 查询系统菜单
getAction(this.tableUrl, this.queryParam)
.then((res) => {
if (res.status === 1) {
this.loading = false;
this.menutablelistData = res.content;
} else {
this.$message.error({ message: res.message, showClose: true });
this.loading = false;
}
})
.catch((error) => {
console.log("er", error);
this.loading = false;
});
})
.catch((error) => {
console.log("er", error);
});
},
// 获取权限列表
getAuthorityList (productId, code) {
getAuthorityListAction(productId, code).then(
res => {
if (res.status === 1) {
if (res.content.length !== 0) {
this.operationCodes = res.content[0].operations
this.operationList = []
for (var k in this.operationCodes) {
this.operationList.push(k)
}
}
})
.catch((error) => {
console.log("er", error);
this.loading = false;
});
})
.catch((error) => {
console.log("er", error);
});
},
// 获取权限列表
getAuthorityList (productId, code) {
getAuthorityListAction(productId, code).then(
res => {
if (res.status === 1) {
if (res.content.length !== 0) {
this.operationCodes = res.content[0].operations
this.operationList = []
for (var k in this.operationCodes) {
this.operationList.push(k)
}
} else {
this.$message.error({ message: res.message, showClose: true })
}
} else {
this.$message.error({ message: res.message, showClose: true })
}
}
)
},
)
},
// 配置
getUserList (row) {
this.getTableList()
const params = {};
const queryOptions = {
conditionGroup: {
conditions: [
{
property: "organizationId",
value: row.organizationId,
operator: "EQ",
},
{
property: "departmentId",
value: row.departmentId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
params.queryOptions = JSON.stringify(queryOptions);
// 配置
getUserList (row) {
this.getTableList()
const params = {};
const queryOptions = {
conditionGroup: {
conditions: [
{
property: "organizationId",
value: row.organizationId,
operator: "EQ",
},
{
property: "departmentId",
value: row.departmentId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
params.queryOptions = JSON.stringify(queryOptions);
getUserRoles(row.id).then((res) => {
if (res.status === 1) {
this.personlist = res.content;
getAction(api.users, params).then((res) => {
if (res.status === 1) {
this.waitMemberList = res.content;
if (this.personlist) {
this.waitMemberList.forEach((item, i) => {
this.personlist.forEach((val) => {
if (item.id === val.id) {
this.waitMemberList[i].selectStatus = 0;
}
getUserRoles(row.id).then((res) => {
if (res.status === 1) {
this.personlist = res.content;
getAction(api.users, params).then((res) => {
if (res.status === 1) {
this.waitMemberList = res.content;
if (this.personlist) {
this.waitMemberList.forEach((item, i) => {
this.personlist.forEach((val) => {
if (item.id === val.id) {
this.waitMemberList[i].selectStatus = 0;
}
});
});
});
}
this.$refs.rolesForm.personlist(this.waitMemberList, row.id);
this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes);
} else {
this.$message.error({ message: res.message, showClose: true });
}
});
this.$refs.rolesForm.title = "人员配置";
} else this.$message.error({ message: res.message, showClose: true });
});
},
// 新增、修改角色
handleAddEdit (value) {
this.$refs.addEditDialog.menuType = this.menuType;
this.$refs.addEditDialog.roleId = value.id;
this.roleSort = value.sort ? value.sort : 0;
this.$refs.addEditDialog.dialogForm.roleType = this.products;
if (value.id) {
this.$refs.addEditDialog.dialogForm.roleName = value.name;
this.$refs.rolesForm.personlist(this.waitMemberList, row.id);
this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes);
} else {
this.$message.error({ message: res.message, showClose: true });
}
});
this.$refs.rolesForm.title = "人员配置";
} else this.$message.error({ message: res.message, showClose: true });
});
},
// 新增、修改角色
handleAddEdit (value) {
this.$refs.addEditDialog.menuType = this.menuType;
this.$refs.addEditDialog.roleId = value.id;
this.roleSort = value.sort ? value.sort : 0;
if (value.id) {
this.$refs.addEditDialog.dialogForm.roleName = value.name;
this.$refs.addEditDialog.dialogForm.roleType = value.type;
this.$refs.addEditDialog.dialogForm.roleTextArea = value.description;
}
this.$refs.addEditDialog.showAddEditDialog = true;
this.$refs.addEditDialog.dialogTitle = value.id ? "修改" : "新增";
},
// 上移下移
moveUpward (index, row) {
realMove(row.dictid, "UP", this.listdata);
this.key++;
let id = findParents(this.listdata, row.dictid);
this.keyList = id;
},
moveDown (index, row) {
realMove(row.dictid, "DOWN", this.listdata);
this.key++;
let id = findParents(this.listdata, row.dictid);
this.keyList = id;
},
this.$refs.addEditDialog.dialogForm.roleTextArea = value.description;
}
this.$refs.addEditDialog.showAddEditDialog = true;
this.$refs.addEditDialog.dialogTitle = value.id ? "修改" : "新增";
},
// 上移下移
moveUpward (index, row) {
realMove(row.dictid, "UP", this.listdata);
this.key++;
let id = findParents(this.listdata, row.dictid);
this.keyList = id;
},
moveDown (index, row) {
realMove(row.dictid, "DOWN", this.listdata);
this.key++;
let id = findParents(this.listdata, row.dictid);
this.keyList = id;
},
// 删除
handleDelete: function (id, content = "") {
this.$confirm(
`<div class="customer-message-wrapper">
// 删除
handleDelete: function (id, content = "") {
this.$confirm(
`<div class="customer-message-wrapper">
<h5 class="title">您确认要执行该操作用于以下信息:</h5>
<p class="content" aria-controls="${content}">${content}
</p>
......@@ -411,48 +414,48 @@ export default {
<span >无法恢复</span>
</p>
</div>`,
"执行确认",
{
dangerouslyUseHTMLString: true,
customClass: "customer-delete",
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
if (!this.tableUrl) {
this.$message.error({
message: "请设置tableUrl属性为接口地址!",
showClose: true,
});
return;
"执行确认",
{
dangerouslyUseHTMLString: true,
customClass: "customer-delete",
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
const url = this.tableUrl + "/" + id;
deleteAction(url).then((res) => {
if (res.status === 1) {
this.$message.success({ message: res.message, showClose: true });
this.getTableData();
} else {
this.$message.error({ message: res.message, showClose: true });
)
.then(() => {
if (!this.tableUrlroles) {
this.$message.error({
message: "请设置tableUrl属性为接口地址!",
showClose: true,
});
return;
}
});
})
.catch(() => { });
},
// 新增回显
reloadTableData () {
this.getTableData();
const url = this.tableUrlroles + "/" + id;
deleteAction(url).then((res) => {
if (res.status === 1) {
this.$message.success({ message: res.message, showClose: true });
this.getTableData();
} else {
this.$message.error({ message: res.message, showClose: true });
}
});
})
.catch(() => { });
},
// 新增回显
reloadTableData () {
this.getTableData();
},
},
},
};
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/mixin.scss";
// @import "~@/styles/public.scss";
.btnColRight {
margin-left: -30px;
margin-top: 20px;
}
// @import "~@/styles/public.scss";
.btnColRight {
margin-left: -30px;
margin-top: 20px;
}
</style>
......