jinhui.wang

version:1.1.0,角色权限增加

import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/FedEx";
// // 修改用户
// export function updateUser(data) {
// return request({
// url: '/system/user',
// method: 'put',
// data: data
// })
// }
// // 导出用户
// export function exportUser(query) {
// return request({
// url: '/system/user/export',
// method: 'get',
// params: query
// })
// }
// // 用户密码重置
// export function resetUserPwd(userId, password) {
// const data = {
// userId,
// password
// }
// return request({
// url: '/system/user/resetPwd',
// method: 'put',
// data: data
// })
// }
// // 用户状态修改
// export function changeUserStatus(userId, status) {
// const data = {
// userId,
// status
// }
// return request({
// url: '/system/user/changeStatus',
// method: 'put',
// data: data
// })
// }
// // 查询用户个人信息
// export function getUserProfile() {
// return request({
// url: '/system/user/profile',
// method: 'get'
// })
// }
// // 修改用户个人信息
// export function updateUserProfile(data) {
// return request({
// url: '/system/user/profile',
// method: 'put',
// data: data
// })
// }
// // 用户密码重置
// export function updateUserPwd(oldPassword, newPassword) {
// const data = {
// oldPassword,
// newPassword
// }
// return request({
// url: '/system/user/profile/updatePwd',
// method: 'put',
// params: data
// })
// }
// // 用户头像上传
// export function uploadAvatar(data) {
// return request({
// url: '/system/user/profile/avatar',
// method: 'post',
// data: data
// })
// }
// // 下载用户导入模板
// export function importTemplate() {
// return request({
// url: '/system/user/importTemplate',
// method: 'get'
// })
// }
// 查询用户列表
export function listUser(query) {
export function listUser(data) {
return request({
url: '/system/user/list',
method: 'get',
params: query
url: '/sysUser/getUserList',
method: 'post',
data: data
})
}
// 查询用户详细
export function getUser(userId) {
export function detailUser(userId) {
return request({
url: '/system/user/' + praseStrEmpty(userId),
url: '/sysUser/detailUser?id=' + praseStrEmpty(userId),
method: 'get'
})
}
// 新增用户
export function addUser(data) {
export function addOrUpdateUser(data) {
return request({
url: '/system/user',
url: '/sysUser/addOrUpdateUser',
method: 'post',
data: data
})
}
// 修改用户
export function updateUser(data) {
// 修改用户状态
export function updateUserStatus(data) {
return request({
url: '/system/user',
method: 'put',
url: '/sysUser/updateUserStatus',
method: 'post',
data: data
})
}
// 删除用户
export function delUser(userId) {
//菜单信息
export function getAllAuth() {
return request({
url: '/system/user/' + userId,
method: 'delete'
url: '/sysMenu/getAllAuth',
method: 'get'
})
}
// 导出用户
export function exportUser(query) {
//菜单开启关闭
export function updateStatus(data) {
return request({
url: '/system/user/export',
method: 'get',
params: query
url: '/sysMenu/updateStatus',
method: 'post',
data: data
})
}
// 用户密码重置
export function resetUserPwd(userId, password) {
const data = {
userId,
password
}
//角色列表
export function getRoleList(data) {
return request({
url: '/system/user/resetPwd',
method: 'put',
url: '/role/getRoleList',
method: 'post',
data: data
})
}
// 用户状态修改
export function changeUserStatus(userId, status) {
const data = {
userId,
status
}
//角色详情
export function detailRole(id) {
return request({
url: '/system/user/changeStatus',
method: 'put',
data: data
url: '/role/detailRole?id=' + id,
method: 'get',
})
}
// 查询用户个人信息
export function getUserProfile() {
//新增修改角色
export function addOrUpdateRole(data) {
return request({
url: '/system/user/profile',
method: 'get'
url: '/role/addOrUpdateRole',
method: 'post',
data: data
})
}
// 修改用户个人信息
export function updateUserProfile(data) {
//角色状态修改
export function updateRoleStatus(data) {
return request({
url: '/system/user/profile',
method: 'put',
url: '/role/updateRoleStatus',
method: 'post',
data: data
})
}
// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
const data = {
oldPassword,
newPassword
}
//口岸列表
export function portNameList() {
return request({
url: '/system/user/profile/updatePwd',
method: 'put',
params: data
url: '/dictionary/port',
method: 'get',
})
}
// 用户头像上传
export function uploadAvatar(data) {
//口岸变更
export function changeCurrentPort(data) {
return request({
url: '/system/user/profile/avatar',
url: '/sysUser/changeCurrentPort',
method: 'post',
data: data
})
}
\ No newline at end of file
// 下载用户导入模板
export function importTemplate() {
return request({
url: '/system/user/importTemplate',
method: 'get'
})
}
......
......@@ -3,9 +3,9 @@
* Copyright (c) 2019 FedEx
*/
import store from '@/store'
import store from '@/store'
export default {
export default {
inserted(el, binding, vnode) {
const { value } = binding
const all_permission = "*:*:*";
......@@ -24,5 +24,23 @@ export default {
} else {
throw new Error(`请设置操作权限标签值`)
}
},
//路由权限处理
routerPer(router){
const permissions = store.getters && store.getters.permissions
let newRouter = [];
router.forEach(item => {
permissions.forEach(per=>{
if(item.meta.permissions == per){
newRouter.push(item)
}
})
if(item.children && item.children.length){
item.children = this.routerPer(item.children)
}
}
});
return newRouter
}
}
\ No newline at end of file
......
......@@ -6,7 +6,6 @@
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb
id="breadcrumb-container"
class="breadcrumb-container"
......@@ -16,7 +15,20 @@
<div class="right-menu">
<template v-if="device !== 'mobile'"> </template>
<el-select
v-model="portName"
size="mini"
style="width: 120px; top: -17px; right: 7px"
placeholder="选择口岸"
>
<el-option
v-for="item in portNameList"
:label="item"
:value="item"
:key="item"
>
</el-option>
</el-select>
<el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
......@@ -25,7 +37,6 @@
<img :src="avatar" class="user-avatar" />
</div>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item @click.native.stop="drawer = true">个人中心</el-dropdown-item> -->
<el-dropdown-item @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
......@@ -35,13 +46,12 @@
v-model="locale"
size="mini"
@change="local"
style="width: 75px;top:-17px;right:7px"
style="width: 75px; top: -17px; right: 7px"
>
<el-option label="中文" value="zh"> </el-option>
<el-option label="英文" value="en"> </el-option>
</el-select>
</div>
<Profile :drawer="drawer" @drawerHandleClose="drawerHandleClose"></Profile>
</div>
</template>
......@@ -50,21 +60,22 @@ import { mapGetters } from "vuex";
import Breadcrumb from "@/components/Breadcrumb";
import TopNav from "@/components/TopNav";
import Hamburger from "@/components/Hamburger";
import Profile from "@/views/systemConfig/userConfig/profile/index";
export default {
components: {
Breadcrumb,
TopNav,
Hamburger,
Profile,
},
data() {
return {
drawer: false,
portNameList: [],
locale: "zh",
};
},
created() {
this.portNameList = this.$store.state.user.portNames;
},
computed: {
...mapGetters(["sidebar", "avatar", "device"]),
setting: {
......@@ -83,6 +94,32 @@ export default {
return this.$store.state.settings.topNav;
},
},
//切换口岸
portName: {
get() {
return this.$store.state.user.activePortName;
},
set(val) {
this.$store
.dispatch("changePort", val)
.then((res) => {
if (res.code === 200) {
location.reload();
} else {
this.$confirm(res.msg, "提示", {
type: "warning",
}).then(()=>{
location.reload();
}).catch(()=>{
location.reload();
});
}
})
.catch((err) => {
console.log(err);
});
},
},
},
methods: {
toggleSideBar() {
......@@ -100,9 +137,6 @@ export default {
});
});
},
drawerHandleClose(val) {
this.drawer = val;
},
local(val) {
this.$i18n.locale = val; //此处val为 zh 或者 en
},
......
......@@ -42,5 +42,5 @@ module.exports = {
/**
* 版本号
*/
version:'version:1.0.0'
version:'version:1.1.0'
}
......
......@@ -2,14 +2,15 @@ import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView';
import hasPermi from '../../directive/permission/hasPermi';
const permission = {
state: {
routes: [],
addRoutes: [],
defaultRoutes: [],
topbarRouters: [],
sidebarRouters: []
sidebarRouters: [],
filghtAllData: {}
},
mutations: {
SET_ROUTES: (state, routes) => {
......@@ -23,13 +24,20 @@ const permission = {
// 顶部导航菜单默认添加统计报表栏指向首页
const index = [{
path: 'index',
meta: { title: '统计报表', icon: 'dashboard'}
meta: { title: '首页', icon: 'home' }
}]
state.topbarRouters = routes.concat(index);
},
SET_SIDEBAR_ROUTERS: (state, routes) => {
state.sidebarRouters = routes
},
SET_FILGHTALL: (state, data) => {
let name = data.name;
state.filghtAllData[name] = data.data;
},
REMOVE_FILGHTALL: (state, name) => {
delete state.filghtAllData[name]
}
},
actions: {
// 生成路由
......@@ -37,6 +45,7 @@ const permission = {
return new Promise(resolve => {
// 向后端请求路由数据
getRouters().then(res => {
res.data = hasPermi.routerPer(res.data);
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)
......
import { login, logout, getInfo } from '@/api/login'
import { changeCurrentPort } from "@/api/system/user.js";
import { getToken, setToken, removeToken } from '@/utils/auth'
const user = {
......@@ -6,6 +7,8 @@ const user = {
token: getToken(),
name: '',
avatar: '',
activePortName: '',
portNames:[],
roles: [],
permissions: []
},
......@@ -20,6 +23,13 @@ const user = {
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
SET_ACTIVEPORTNAME: (state, activePortName) => {
state.activePortName = activePortName
sessionStorage.setItem('portName', activePortName)
},
SET_PORTNAMES:(state,portNames)=>{
state.portNames = portNames
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
......@@ -29,6 +39,7 @@ const user = {
},
actions: {
// 登录
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
......@@ -36,7 +47,7 @@ const user = {
const rememberMe = userInfo.rememberMe
return new Promise((resolve, reject) => {
login(username, password,rememberMe).then(res => {
login(username, password, rememberMe).then(res => {
setToken(res.data)
commit('SET_TOKEN', res.data)
resolve()
......@@ -52,6 +63,7 @@ const user = {
getInfo().then(res => {
const user = res.data.user
const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
let ports = user.portName.split(',');
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.data.roles)
commit('SET_PERMISSIONS', res.data.permissions)
......@@ -60,6 +72,14 @@ const user = {
}
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
commit('SET_PORTNAMES',ports)
//口岸选择
if (sessionStorage.getItem('portName')) {
commit('SET_ACTIVEPORTNAME', sessionStorage.getItem('portName'))
} else {
commit('SET_ACTIVEPORTNAME', "PVG")
}
resolve(res)
}).catch(error => {
reject(error)
......@@ -67,11 +87,25 @@ const user = {
})
},
//切换口岸
changePort({ commit }, portName) {
return new Promise((resolve, reject) => {
changeCurrentPort({ portName: portName }).then(res=>{
if(res.code === 200){
commit('SET_ACTIVEPORTNAME',portName)
}
resolve(res)
}).catch(err=>{
reject(err)
})
})
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
// window.location.href = "https://sso.secure.fedex.com/logout";//wsso系统跳转
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
......@@ -86,6 +120,7 @@ const user = {
// 前端 登出
FedLogOut({ commit }) {
return new Promise(resolve => {
// window.location.href = "https://sso.secure.fedex.com/logout";//wsso系统跳转
commit('SET_TOKEN', '')
removeToken()
resolve()
......
......@@ -17,5 +17,6 @@ export function setToken(token) {
export function removeToken() {
//return Cookies.remove(TokenKey)
// return localStorage.removeItem(TokenKey)
sessionStorage.removeItem('portName')
return sessionStorage.removeItem(TokenKey)
}
......
......@@ -280,6 +280,7 @@
<el-button
:type="downLoadingTip.downloading ? 'warning' : 'primary'"
size="mini"
v-hasPermi="['allocation:cargo:export']"
@click="xlsx(0)"
:loading="downLoadingTip.downloading"
:disabled="tableData.length <= 0"
......@@ -290,6 +291,7 @@
<el-button
:type="downLoadingTip.downloading ? 'warning' : 'primary'"
size="mini"
v-hasPermi="['allocation:cargo:export']"
@click="xlsx(1)"
:loading="downLoadingTip.downloading"
:disabled="tableData.length <= 0"
......@@ -300,6 +302,7 @@
<el-button
type="primary"
size="mini"
v-hasPermi="['allocation:cargo:allocation']"
@click="addFit"
:disabled="tableSelection.length <= 0"
>添加到航班</el-button
......
......@@ -36,6 +36,7 @@
type="primary"
icon="el-icon-plus"
size="mini"
v-hasPermi="['allocation:alloc:add']"
@click="$router.push({ name: 'FlightAllocConfigAdd', params: { handle: 'add' } })"
>添加</el-button
>
......@@ -76,6 +77,7 @@
type="text"
size="mini"
icon="el-icon-edit"
v-hasPermi="['allocation:alloc:update']"
@click="handleClick(scope.row.id, 'update')"
>修改</el-button
>
......@@ -83,6 +85,7 @@
type="text"
size="mini"
icon="el-icon-delete"
v-hasPermi="['allocation:alloc:delete']"
@click="del(scope.row.id, scope.row.status)"
>删除</el-button
>
......@@ -90,6 +93,7 @@
type="text"
size="mini"
icon="el-icon-video-pause"
v-hasPermi="['allocation:alloc:openClose']"
@click="changeStatus(scope.row.id, 3)"
v-if="scope.row.status == '1'"
>停用</el-button
......@@ -98,6 +102,7 @@
type="text"
size="mini"
icon="el-icon-video-play"
v-hasPermi="['allocation:alloc:openClose']"
@click="changeStatus(scope.row.id, 1)"
v-else
>启用</el-button
......
<template>
<div>
<el-form class="form-header" :model="queryParams" ref="queryForm" size="medium" :inline="true" label-position="right" label-width="auto">
<el-form
class="form-header"
:model="queryParams"
ref="queryForm"
size="medium"
:inline="true"
label-position="right"
label-width="auto"
>
<el-form-item label="原航班">
<el-input type="text" v-model="upCase" placeholder="请输入原航班" clearable></el-input>
<el-input
type="text"
v-model="upCase"
placeholder="请输入原航班"
clearable
></el-input>
<!-- <el-input v-model="upCase" placeholder="请输入原航班" clearable size="small" /> -->
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择" clearable>
<el-option v-for="dict in statusList" :key="dict.id" :label="dict.name" :value="dict.id" />
<el-option
v-for="dict in statusList"
:key="dict.id"
:label="dict.name"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询原航班配置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>查询原航班配置</el-button
>
</el-form-item>
<br />
<el-form-item label="日期" prop="flightDate">
<el-date-picker value-format="yyyy-MM-dd" v-model="queryParams.flightDate" type="date" placeholder="选择日期">
<el-date-picker
value-format="yyyy-MM-dd"
v-model="queryParams.flightDate"
type="date"
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="findSourceFlightAndFlightDate">查询实际配载航班
</el-button>&#12288;
<span style="color: #ff4949;">注:原航班+日期查询该日期的航班实际情况</span>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="findSourceFlightAndFlightDate"
>查询实际配载航班 </el-button
>&#12288;
<span style="color:#ff4949">注:原航班+日期查询该日期的航班实际情况</span>
</el-form-item>
<br />
<el-form-item>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加规则</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
v-hasPermi="['allocation:rand:add']"
@click="handleAdd"
>添加规则</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table v-loading="loading" height="550" :data="sourceFlightRulesList" highlight-current-row border stripe>
<el-table
v-loading="loading"
height="550"
size="small"
:data="sourceFlightRulesList"
highlight-current-row
border
stripe
>
<el-table-column type="index" label="序号" align="center">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="原航班" align="center" prop="sourceFlightNo" />
<el-table-column label="配载航班排序" align="center" prop="flightRank" width="280" />
<el-table-column
label="配载航班排序"
align="center"
prop="flightRank"
width="280"
/>
<!-- <el-table-column label="优先级" align="center" prop="priority" /> -->
<el-table-column label="周期" align="center" prop="dayOfWeek" width="180" />
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="开始时间" align="center" prop="startDate" width="100" />
<el-table-column label="结束时间" align="center" prop="endDate" width="100" />
<el-table-column label="最后修改人" align="center" prop="updateUserName" width="100" />
<el-table-column label="最后修改时间" align="center" prop="updateTime" width="100" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" fixed="right">
<el-table-column
label="周期"
align="center"
prop="dayOfWeek"
width="180"
/>
<el-table-column
label="状态"
align="center"
prop="status"
:formatter="statusFormat"
/>
<el-table-column
label="开始时间"
align="center"
prop="startDate"
width="100"
/>
<el-table-column
label="结束时间"
align="center"
prop="endDate"
width="100"
/>
<el-table-column
label="最后修改人"
align="center"
prop="updateUserName"
width="100"
/>
<el-table-column
label="最后修改时间"
align="center"
prop="updateTime"
width="100"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="180"
fixed="right"
>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteorPlayorpause(scope.row,0,'删除')">
删除</el-button>
<el-button size="mini" type="text" icon="el-icon-video-play" v-if="scope.row.status == '3'"
@click="handleDeleteorPlayorpause(scope.row,1,'启用')">启用</el-button>
<el-button size="mini" type="text" icon="el-icon-video-pause" v-if="scope.row.status != '3'"
@click="handleDeleteorPlayorpause(scope.row,3,'停用')">停用</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['allocation:rand:update']"
@click="handleUpdate(scope.row)"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['allocation:rand:delete']"
@click="handleDeleteorPlayorpause(scope.row, 0, '删除')"
>
删除</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-video-play"
v-if="scope.row.status == '3'"
v-hasPermi="['allocation:rand:openClose']"
@click="handleDeleteorPlayorpause(scope.row, 1, '启用')"
>启用</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-video-pause"
v-if="scope.row.status != '3'"
v-hasPermi="['allocation:rand:openClose']"
@click="handleDeleteorPlayorpause(scope.row, 3, '停用')"
>停用</el-button
>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" layout=" prev, pager, next, jumper, sizes,total"
:page.sync="queryParams.pageNum" :limit.sync="queryParams.limit" @pagination="findSourceFlightRules" />
<pagination
v-show="total > 0"
:total="total"
layout=" prev, pager, next, jumper, sizes,total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.limit"
@pagination="findSourceFlightRules"
/>
<!-- 查看目的航班对话框 -->
<el-dialog title="实际配载航班" :visible.sync="openFlightDate" width="70%" :close-on-click-modal="false" :append-to-body="true">
<el-dialog
title="实际配载航班"
:visible.sync="openFlightDate"
width="70%"
:close-on-click-modal="false"
:append-to-body="true"
>
<el-table v-loading="loadingFlightDate" :data="sourceFlightAndFlightDate">
<el-table-column type="index" label="序号" align="center">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="原航班" align="center" prop="sourceFlightNo"/>
<el-table-column label="实际配载航班" align="center" prop="actualFlight" width="280" />
<el-table-column label="原航班" align="center" prop="sourceFlightNo" />
<el-table-column
label="实际配载航班"
align="center"
prop="actualFlight"
width="280"
/>
<el-table-column label="航班日期" align="center" prop="flightDate" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="200"
>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit"
@click="handleClick(scope.row.actualFlight, 'detail')">查看配置维度</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleClick(scope.row.actualFlight, 'detail')"
>查看配置维度</el-button
>
</template>
</el-table-column>
</el-table>
......@@ -87,50 +229,110 @@
</div>
</el-dialog>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="55%" :append-to-body="true" :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="auto">
<el-dialog
:title="title"
:visible.sync="open"
width="55%"
:append-to-body="true"
:close-on-click-modal="false"
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-position="right"
label-width="auto"
>
<el-row>
<el-col :span="10">
<el-col :span="8">
<el-form-item label="原航班" prop="sourceFlightNo">
<el-input v-model="form.sourceFlightNo" placeholder="请输入原航班号" maxlength="10"/>
<el-input
v-model="form.sourceFlightNo"
placeholder="请输入原航班号"
maxlength="10"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="口岸" prop="portName">
<el-select
:disabled="true"
v-model="form.portName"
size="mini"
placeholder="选择口岸"
>
<el-option
v-for="item in portNameList"
:label="item"
:value="item"
:key="item"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="有效开始时间" prop="startDate">
<el-date-picker clearable size="small" :picker-options="pickerOptionsStart" v-model="form.startDate"
type="date" value-format="yyyy-MM-dd" placeholder="选择开始时间">
<el-date-picker
clearable
size="small"
:picker-options="pickerOptionsStart"
v-model="form.startDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择开始时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="有效结束时间" prop="endDate">
<el-date-picker clearable size="small" :picker-options="pickerOptionsEnd" v-model="form.endDate"
type="date" value-format="yyyy-MM-dd" placeholder="选择结束时间">
<el-date-picker
clearable
size="small"
:picker-options="pickerOptionsEnd"
v-model="form.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择结束时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-bottom: 5%;">
<span style="color: #ff4949;margin-left: 10%;">提示:配载航班之间请用分号分隔【符号不区分中英文】,例:CA1053;C7433</span><br />
<span style="color: #ff4949;margin-left: 10%;">提示:如果需要设置配载航班延迟或提前可以直接在目的航斑后加减【+-】天数。如:CA1053+1;CZ433-1</span>
<el-col :span="24" style="margin-bottom: 5%">
<span style="color: #ff4949; margin-left: 10%"
>提示:配载航班之间请用分号分隔【符号不区分中英文】,例:CA1053;C7433</span
><br />
<span style="color: #ff4949; margin-left: 10%"
>提示:如果需要设置配载航班延迟或提前可以直接在目的航斑后加减【+-】天数。如:CA1053+1;CZ433-1</span
>
</el-col>
<el-col :span="24">
<el-form-item label="配载航班" prop="flightRank">
<el-input type="textarea" v-model="form.flightRank" :rows="4"></el-input>
<el-input
type="textarea"
v-model="form.flightRank"
:rows="4"
></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="周期段">
<el-checkbox-group v-model="dayOfWeek">
<el-checkbox v-for="item in dayOfWeekList" :key="item" :label="item" :name="item"></el-checkbox>
<el-checkbox
v-for="item in dayOfWeekList"
:key="item"
:label="item"
:name="item"
></el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -141,41 +343,44 @@
</div>
</template>
<script>
import {
import {
findSourceFlightRulesApi,
sourceFlightRulesSaveApi,
delOrEnableORDisableApi,
findSourceFlightAndFlightDateApi
} from "@/api/sourceFlightRules";
export default {
findSourceFlightAndFlightDateApi,
} from "@/api/sourceFlightRules";
export default {
name: "FlightRandConfig",
data() {
return {
portNameList: [],
// data 中设定
pickerOptionsStart: {
disabledDate: time => {
disabledDate: (time) => {
let endDateVal = this.form.endDate;
if (endDateVal) {
return time.getTime() > new Date(endDateVal).getTime() || time.getTime() < new Date().getTime() - 24 *
60 * 60 * 1000;
return (
time.getTime() > new Date(endDateVal).getTime() ||
time.getTime() < new Date().getTime() - 24 * 60 * 60 * 1000
);
} else {
return time.getTime() < new Date().getTime() - 24 * 60 * 60 * 1000;
}
}
},
},
pickerOptionsEnd: {
disabledDate: time => {
disabledDate: (time) => {
let beginDateVal = this.form.startDate;
if (beginDateVal) {
return time.getTime() < new Date(beginDateVal).getTime();
} else {
return time.getTime() < new Date().getTime() - 24 * 60 * 60 * 1000;
}
}
},
},
//周期段
dayOfWeekList: ['D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7'],
dayOfWeekList: ["D1", "D2", "D3", "D4", "D5", "D6", "D7"],
// 遮罩层
loading: false,
// 遮罩层
......@@ -188,71 +393,96 @@
sourceFlightRulesList: [],
//目的航班数据
sourceFlightAndFlightDate: [],
statusList: [{
'id': 1,
'name': '有效'
}, {
'id': 3,
'name': '停用'
}],
statusList: [
{
id: 1,
name: "有效",
},
{
id: 3,
name: "停用",
},
],
// 新增修改查看规则弹出层
open: false,
// 是否显示查看目的航班弹出层
openFlightDate: false,
// 查询参数
queryParams: {
portName: undefined,
start: 0, //当前条数【代表第几条数据 +1开始】
pageNum: 1,
limit: 20, //一页显示多少条数据
sourceFlightNo: undefined, //原航班号
status: undefined, //状态
flightDate: undefined //日期
flightDate: undefined, //日期
},
dayOfWeek: [],
// 表单参数
form: {
dayOfWeek: []
dayOfWeek: [],
},
// 表单校验
rules: {
sourceFlightNo: [{
sourceFlightNo: [
{
required: true,
message: "ACCS原航班号不能为空",
trigger: "blur"
}],
flightRank: [{
trigger: "blur",
},
],
flightRank: [
{
required: true,
message: "配载航班不能为空",
trigger: "blur"
}],
}
trigger: "blur",
},
],
},
};
},
created() {
this.queryParams.portName = this.$store.state.user.activePortName;
this.findSourceFlightRules();
this.portNameList = this.$store.state.user.portNames;
this.form.portName = this.$store.state.user.activePortName;
},
activated(){
this.queryParams.portName = this.$store.state.user.activePortName;
this.findSourceFlightRules();
this.portNameList = this.$store.state.user.portNames;
this.form.portName = this.$store.state.user.activePortName;
},
watch:{
open(val,oldVal){
if(val){
this.queryParams.portName = this.$store.state.user.activePortName;
this.form.portName = this.$store.state.user.activePortName;
}
}
},
methods: {
//跳转到查看,修改页面
handleClick(flightiId, handle) {
this.openFlightDate = false
this.openFlightDate = false;
this.$router.push({
name: "FlightAllocConfigInfo",
params: {
handle: handle,
id: flightiId
id: flightiId,
},
});
},
/** 查询原航班顺位规则*/
findSourceFlightRules() {
this.loading = true;
if (this.queryParams.pageNum > 1) {
this.queryParams.start = (this.queryParams.pageNum - 1) * this.queryParams.limit
this.queryParams.start =
(this.queryParams.pageNum - 1) * this.queryParams.limit;
} else {
this.queryParams.start = 0;
}
findSourceFlightRulesApi(this.queryParams).then(response => {
findSourceFlightRulesApi(this.queryParams).then((response) => {
if (response.code == 200) {
this.sourceFlightRulesList = response.data.list;
this.total = response.data.totalCount;
......@@ -260,9 +490,7 @@
} else {
this.msgError(response.msg);
}
});
},
/** 新增按钮操作 */
handleAdd() {
......@@ -271,61 +499,64 @@
this.title = "添加原航班顺位规则";
this.form.id = -1;
this.dayOfWeek = [];
// this.form.portName = this.$store.state.user.activePortName;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.form = {};
this.dayOfWeek = [];
this.open = true;
this.title = "修改原航班顺位规则";
this.form = JSON.parse(JSON.stringify(row));
this.dayOfWeek = this.form.dayOfWeek ? this.form.dayOfWeek.split(";") : [];
this.dayOfWeek = this.form.dayOfWeek
? this.form.dayOfWeek.split(";")
: [];
//this.form.dayOfWeek = this.form.dayOfWeek ? this.form.dayOfWeek.split(";") : [];
},
/** 删除 启用 停用按钮操作 */
handleDeleteorPlayorpause(row, status, statusText) {
//删除前需要停用
if (status === 0 && row.status != '3') {
if (status === 0 && row.status != "3") {
this.$message({
message: '请停用后删除',
type: 'warning'
message: "请停用后删除",
type: "warning",
});
return;
}
this.$confirm('是否确认' + statusText + '此数据项?', "警告", {
this.$confirm("是否确认" + statusText + "此数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
type: "warning",
})
.then(() => {
let disable = {
id: row.id,
status: status
status: status,
};
return delOrEnableORDisableApi(disable);
}).then(response => {
})
.then((response) => {
if (response.code == 200) {
this.findSourceFlightRules();
this.msgSuccess(statusText + "成功");
} else {
this.msgError(response.msg);
}
}).catch(function() {});
})
.catch(() => {});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
this.form.dayOfWeek = this.dayOfWeek.sort();
let formdata = JSON.parse(JSON.stringify(this.form));
formdata.sourceFlightNo=formdata.sourceFlightNo.trim().toUpperCase();
formdata.flightRank=formdata.flightRank.trim().toUpperCase();
formdata.sourceFlightNo = formdata.sourceFlightNo
.trim()
.toUpperCase();
formdata.flightRank = formdata.flightRank.trim().toUpperCase();
if (formdata.startDate === undefined || formdata.startDate == null) {
formdata.startDate = "";
}
......@@ -333,7 +564,7 @@
formdata.endDate = "";
}
//处理数据
sourceFlightRulesSaveApi(formdata).then(response => {
sourceFlightRulesSaveApi(formdata).then((response) => {
if (response.code === 200) {
this.msgSuccess("保存成功");
this.open = false;
......@@ -342,46 +573,46 @@
this.msgError(response.msg);
}
});
}
});
},
// 表单重置
reset() {
this.form = {
dayOfWeek: []
dayOfWeek: [],
};
this.resetForm("form");
},
/** 查询目的航班*/
findSourceFlightAndFlightDate() {
//校验原航班号非空
if (this.queryParams.sourceFlightNo === null || this.queryParams.sourceFlightNo === undefined || this
.queryParams.sourceFlightNo.trim() === '') {
if (
this.queryParams.sourceFlightNo === null ||
this.queryParams.sourceFlightNo === undefined ||
this.queryParams.sourceFlightNo.trim() === ""
) {
this.$message.warning("ACCS原航班号为空");
return
return;
}
//校验原日期非空
if (this.queryParams.flightDate === null || this.queryParams.flightDate === undefined) {
if (
this.queryParams.flightDate === null ||
this.queryParams.flightDate === undefined
) {
this.$message.warning("日期为空");
return
return;
}
this.openFlightDate = true;
this.loadingFlightDate = true;
this.sourceFlightAndFlightDate = [];
findSourceFlightAndFlightDateApi(this.queryParams).then(response => {
findSourceFlightAndFlightDateApi(this.queryParams).then((response) => {
if (response.code === 200) {
this.sourceFlightAndFlightDate = response.data;
this.loadingFlightDate = false;
} else {
this.msgError(response.msg);
}
});
},
// 目的航班弹出框返回
cancelFlightDate() {
......@@ -396,19 +627,18 @@
},
// 状态字典翻译
statusFormat(row) {
if (row.status === '1') {
return '有效'
} else if (row.status === '0') {
return '执行中'
} else if (row.status === '3') {
return '停用'
if (row.status === "1") {
return "有效";
} else if (row.status === "0") {
return "执行中";
} else if (row.status === "3") {
return "停用";
}
return row.status;
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.sourceFlightNo = undefined
this.queryParams.sourceFlightNo = undefined;
this.resetForm("queryForm");
this.handleQuery();
},
......@@ -418,21 +648,18 @@
this.queryParams.start = 0;
this.findSourceFlightRules();
},
},
computed: {
upCase: {
get: function() {
get: function () {
return this.queryParams.sourceFlightNo;
},
set: function(val) {
set: function (val) {
this.queryParams.sourceFlightNo = val.toUpperCase();
},
},
},
};
};
</script>
<style>
</style>
......
......@@ -102,6 +102,7 @@
:loading="downLoadingTip.downloading"
icon="el-icon-download"
size="mini"
v-hasPermi="['base:caExport:export']"
>{{
downLoadingTip.downloading ? downLoadingTip.tip : "导出"
}}</el-button
......
......@@ -4,12 +4,12 @@
<el-form-item>
<el-upload action="/caPreReviewImport/importFlight" name="file" :http-request="uploadExcel"
:on-remove="handleRemove" :limit="1" :on-exceed="handleExceed" :file-list="fileList" accept=".xlsx"
class="upload-demo">
class="upload-demo" v-hasPermi="['base:caImport:import']">
<el-button type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="downloadTempleate">下载模板</el-button>
<el-button type="primary" @click="downloadTempleate" v-hasPermi="['base:caImport:download']">下载模板</el-button>
</el-form-item>
</el-form>
<div style="font-size: 12px; font-weight: 700">
......
......@@ -23,12 +23,13 @@
:file-list="fileList"
accept=".xlsx"
class="upload-demo"
v-hasPermi="['base:flightImport:importFlight']"
>
<el-button type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="downloadTempleate"
<el-button type="primary" @click="downloadTempleate" v-hasPermi="['base:flightImport:exportExcel']"
>下载模板</el-button
>
</el-form-item>
......
......@@ -50,11 +50,11 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['base:flightInfo:add']">新增</el-button>
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['base:flightInfo:delete']">删除
</el-button>
<el-button type="primary" icon="el-icon-circle-check" size="mini" @click="handleFlightStatus('flightStatus10')">自动配舱开启</el-button>
<el-button type="primary" icon="el-icon-circle-close" size="mini" @click="handleFlightStatus('flightStatus80')">自动配舱关闭</el-button>
<el-button type="primary" icon="el-icon-circle-check" size="mini" @click="handleFlightStatus('flightStatus10')" v-hasPermi="['base:flightInfo:open']">自动配舱开启</el-button>
<el-button type="primary" icon="el-icon-circle-close" size="mini" @click="handleFlightStatus('flightStatus80')" v-hasPermi="['base:flightInfo:close']">自动配舱关闭</el-button>
</el-form>
<!-- <el-row :gutter="10" class="mb8">
......@@ -112,9 +112,9 @@
<el-table-column label="最后修改时间" align="center" prop="lastModifyTime" width="120" />
<el-table-column v-if="findAllFltDatList.length>0" label="操作" align="center"
class-name="small-padding fixed-width" width="130" fixed="right">
class-name="small-padding fixed-width" width="130" fixed="right" style="top:0!important">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['base:flightInfo:update']">修改</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row,'删除')">
删除</el-button> -->
</template>
......
......@@ -216,10 +216,10 @@
@click="select(0)"
>查询</el-button
>
<el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(0)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading"
<el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(0)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" v-hasPermi="['base:cargo:export']"
>{{downLoadingTip.downloading?downLoadingTip.tip:"导出本页查询结果"}}</el-button
>
<el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(1)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading"
<el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(1)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" v-hasPermi="['base:cargo:export']"
>{{downLoadingTip.downloading?downLoadingTip.tip:"导出全部查询结果"}}</el-button
>
<span style="marginLeft:20px;color:#ffba00">全部导出上限80000条数据</span>
......@@ -706,7 +706,7 @@ export default {
limitSize: 100, //无限制-1
page:1,
progress:0,
formShow:false,
formShow:true,
};
},
created() {
......
<template>
<div class="menuDrawer">
<el-dialog
:title="drawerTitle"
width="50%"
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:append-to-body="true"
>
<el-form
ref="userForm"
:model="menuForm"
:disabled="menuFormDisabled"
:rules="rules"
label-width="auto"
style="margin: 10px"
>
<el-row>
<el-col :span="12">
<el-form-item label="菜单名称" prop="">
<!-- <el-input
placeholder="请输入权限名"
:disabled="menuFormDisabled"
v-model="menuData.userName"
size="mini"
></el-input> -->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="菜单路由" prop="">
<!-- <el-input
placeholder="请输入权限名"
:disabled="menuFormDisabled"
v-model="menuData.userName"
size="mini"
></el-input> -->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="组件名称" prop="">
<!-- <el-input
placeholder="请输入权限名"
:disabled="menuFormDisabled"
v-model="menuData.userName"
size="mini"
></el-input> -->
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="菜单状态" prop="">
<el-switch
v-model="menuData.menuStatus"
active-color="#13ce66"
inactive-color="#ff4949"
:disabled="menuFormDisabled"
></el-switch>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="图标选择" prop="">
<iconSelect @selected="selected"></iconSelect>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="权限设置" prop="">
<el-col :span="6">
<el-radio label="页面" size="medium"></el-radio>
</el-col>
<el-col :span="6">
<el-radio label="按钮" size="medium"></el-radio>
</el-col>
<el-col :span="24">
<el-card shadow="never">
<el-input placeholder=""></el-input>
</el-card>
</el-col>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import iconSelect from "@/components/IconSelect";
export default {
components: {
iconSelect,
},
props: {
drawerTitle: {
type: String,
default: "",
},
menuFormDisabled: {
type: Boolean,
default: false,
},
dialogVisible: {
type: Boolean,
default: false,
},
menuData: {
type: Object,
default: null,
},
},
data() {
return {
menuForm: {},
rules:{}
};
},
updated() {
this.menuForm = this.menuData;
},
methods: {
handleClose() {
this.$emit("handleClose", false);
},
selected(val) {
console.log(val);
},
submit() {},
},
};
</script>
<style>
</style>
\ No newline at end of file
<template>
<div>
<el-form ref="selectionUserForm" label-width="auto" style="margin: 20px">
<el-row :gutter="50"> </el-row>
</el-form>
<!-- <div style="margin:20px">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addMenu"
>新增菜单</el-button
>
</div> -->
<el-table
:data="data"
row-key="id"
fit
border
stripe
highlightCurrentRow
v-loading="loading"
default-expand-all
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column
v-for="(item, index) in tableHeader"
:prop="item.value"
:label="item.name"
:key="index"
:align="item.align"
header-align="center"
showOverflowTooltip
:width="item.width"
:formatter="formatter"
>
</el-table-column>
<el-table-column
header-align="center"
align="center"
label="操作"
width="auto"
>
<template slot-scope="scope">
<!-- <el-button type="success" size="mini" @click="buttonClick(scope)">修改</el-button>
<el-button type="primary" size="mini" @click="buttonClick(scope)"
>查看</el-button
> -->
<el-button
:type="scope.row.status == 1 ? 'warning' : 'primary'"
v-hasPermi="['system:menu:openClose']"
size="mini"
@click="menuStatus(scope)"
v-if="scope.row.menuType == 'C'"
>{{ scope.row.status == 1 ? "停用菜单" : "启用菜单" }}</el-button
>
<el-button
type="danger"
size="mini"
v-hasPermi="['system:menu:delete']"
@click="removeMenu(scope)"
v-if="scope.row.menuType == 'C'"
>删除菜单</el-button
>
</template>
</el-table-column>
</el-table>
<!-- <Tables
ref="newTable"
:data="data"
:headerData="tableHeader"
size="medium"
rowKey="id"
:defaultExpandAll="true"
height="auto"
@tableSelect="tableSelect"
@tableSelectAll="tableSelectAll"
@SelectChange="SelectChange"
>
<el-table-column
header-align="center"
align="center"
label="操作"
width="auto"
>
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="menuStatus(scope)">{{
scope.menuStatus == 0 ? "停用" : "启用"
}}</el-button>
<el-button type="danger" size="mini" @click="removeMenu(scope)"
>删除菜单</el-button
>
</template>
</el-table-column>
</Tables> -->
<!-- <Drawer
:dialogVisible="drawer"
:drawerTitle="drawerTitle"
:menuFormDisabled="menuFormDisabled"
:menuData="menuData"
@handleClose="handleClose"
></Drawer> -->
</div>
</template>
<script>
import { getAllAuth, updateStatus } from "@/api/system/user.js";
import dictLabels from "@/assets/languages/dictLabels.js";
import Drawer from "./drawer.vue";
import { MessageBox } from "element-ui";
export default {
name:"menuConfig",
components: {
Drawer,
},
data() {
return {
drawer: false,
menuFormDisabled: false,
loading:false,
drawerTitle: "",
menuData: {},
data: [],
tableHeader: [
{
type: "",
name: "菜单名",
value: "title",
width: "200",
align: "left",
sorTable: false,
},
{
type: "",
name: "菜单类型",
value: "menuType",
width: "100",
align: "center",
sortable: false,
},
{
type: "",
name: "权限标识",
value: "permissionKey",
width: "auto",
align: "left",
sortable: false,
},
{
type: "",
name: "菜单状态",
value: "status",
width: "100",
align: "center",
sorTable: false,
},
{
type: "",
name: "菜单路由",
value: "path",
width: "auto",
align: "left",
sorTable: false,
},
],
};
},
created() {
this.menuAll();
},
methods: {
addMenu() {
this.menuData = {};
this.drawer = true;
this.drawerTitle = "新增菜单";
this.menuFormDisabled = false;
},
//关闭
handleClose(val) {
this.drawer = val;
},
buttonClick(row) {
this.menuData = row.row;
this.drawer = true;
this.drawerTitle = "查看/修改";
this.menuFormDisabled = true;
},
//表格数据
menuAll() {
this.loading = true;
getAllAuth().then((res) => {
this.loading = false;
if (res.code === 200) {
res.data.length > 0
? (this.data = res.data)
: this.$message({
message: "数据为空",
type: "warning",
});
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
}).catch(()=>{
this.loading = false;
});
},
//菜单状态改变
statusUpdate(data) {
updateStatus(data)
.then((res) => {
if (res.code === 200) {
this.menuAll();
this.$message({
message: "操作成功",
type: "success",
});
location.reload()
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
console.log(err);
});
},
//菜单开启关闭
menuStatus(row) {
MessageBox.confirm(
row.row.status == 1 ? "是否要关闭此菜单" : "是否要启用此菜单",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
let data = {};
data.id = row.row.id;
data.status = row.row.status == 1 ? "2" : "1";
this.statusUpdate(data);
})
.catch(() => {});
},
//菜单删除
removeMenu(row) {
MessageBox.confirm("是否要删除此菜单", "提示", {
confirmButtonText: "确定删除",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let data = {};
data.id = row.row.id;
data.status = "0";
this.statusUpdate(data);
})
.catch(() => {});
},
formatter(row, column, cellValue, index) {
if (dictLabels[column.property]) {
if (dictLabels[column.property][cellValue]) {
return dictLabels[column.property][cellValue];
}
}
return cellValue;
},
},
};
</script>
<style>
</style>
\ No newline at end of file
<template>
<div class="roleDrawer">
<el-drawer
:title="drawerTitle"
:visible.sync="drawer"
direction="rtl"
size="40%"
destroy-on-close
:close-on-click-modal="false"
:wrapperClosable="false"
:show-close="false"
>
<el-form
ref="roleForm"
:model="roleForm"
label-width="auto"
:rules="rules"
size="mini"
style="margin: 10px"
>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="角色名:" prop="name">
<el-input
placeholder="请输入角色名"
v-model.trim="roleForm.name"
:disabled="roleFormDisabled"
v-if="!roleFormDisabled"
></el-input>
<div v-else>{{ roleData.name }}</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="角色描述:" prop="remark">
<el-input
v-model="roleForm.remark"
type="textarea"
placeholder="请输入角色描述"
:disabled="roleFormDisabled"
v-if="!roleFormDisabled"
></el-input>
<div v-else>{{ roleData.remark }}</div>
</el-form-item>
</el-col>
<!-- <el-col :span="24">
<el-form-item label="角色状态:" prop="valid">
<el-switch
v-model="roleForm.valid"
:active-value="1"
:inactive-value="2"
active-color="#13ce66"
inactive-color="#ff4949"
:disabled="roleFormDisabled"
></el-switch>
</el-form-item>
</el-col> -->
<el-col :span="24">
<el-form-item label="角色权限:" prop="menuIdList">
<el-tree
ref="tree"
:data="treeData"
node-key="id"
:props="defaultProps"
:show-checkbox="true"
:default-checked-keys="roleData.menuIds"
check-strictly
accordion
>
</el-tree>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button
type="primary"
v-if="!roleFormDisabled"
size="mini"
:loading="loading"
@click="submit"
>提交</el-button
>
<el-button type="primary" size="mini" @click="handleClose"
>取消</el-button
>
</el-form-item>
</el-form>
</el-drawer>
</div>
</template>
<script>
import { getAllAuth, addOrUpdateRole } from "@/api/system/user.js";
export default {
props: {
drawerTitle: {
type: String,
default: "",
},
roleFormDisabled: {
type: Boolean,
default: false,
},
drawer: {
type: Boolean,
default: false,
},
roleData: {
type: Object,
default: null,
},
},
data() {
return {
roleForm: {
name: null,
},
treeData: [],
loading: false,
defaultProps: {
children: "children",
label: "title",
},
rules: {
name: [
{
required: true,
message: "角色名不能为空",
trigger: "blur",
},
],
},
};
},
created() {
//权限列表
getAllAuth()
.then((res) => {
if (res.code === 200) {
this.treeData = res.data;
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
console.log(err);
});
},
watch:{
roleFormDisabled(){
this.treeData = this.treeDisabled(this.treeData)
},
drawer(){
this.roleForm = this.roleData;
}
},
methods: {
//关闭
handleClose() {
this.$emit("handleClose", false);
},
//提交
submit() {
let formData = {};
this.loading = true;
formData.menuIdList = this.$refs.tree.getCheckedKeys();
this.roleData ? (formData.id = this.roleData.id) : "";
formData.remark = this.roleForm.remark;
formData.valid = this.roleForm.valid;
formData.name = this.roleForm.name;
addOrUpdateRole(formData)
.then((res) => {
if (res.code === 200) {
this.$message({
message: "操作成功",
type: "success",
});
this.loading = false;
this.$emit("handleClose", false);
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
console.log(err);
});
},
//权限结构禁用
treeDisabled(val) {
let data = [];
val.forEach((item) => {
item.disabled = this.roleFormDisabled;
data.push(item)
if (item.children && item.children.length) {
item.children = this.treeDisabled(item.children)
}
});
return data;
},
},
};
</script>
<style>
</style>
\ No newline at end of file
<template>
<div></div>
<div class="roleConfig">
<el-form ref="selectionRoleForm" label-width="auto" style="margin: 20px">
<el-row :gutter="50">
<el-col :span="6">
<el-form-item label="角色名称">
<el-input
v-model="formData.name"
placeholder="请输入角色名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="创建时间">
<el-date-picker
v-model="createTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态">
<el-select v-model="formData.valid" placeholder="角色状态">
<el-option label="开启" value="1"> </el-option>
<el-option label="关闭" value="1"> </el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="margin: 0 20px">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
:loading="tableLoading"
@click="selectRoleList"
>搜索</el-button
>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addRole" v-hasPermi="['system:role:add']"
>新增角色</el-button
>
</div>
<Tables
:data="data"
:headerData="tableHeader"
:infoData="tableHeader"
:totalCount="total"
:limitSize="formData.size"
:page="formData.page"
:loading="tableLoading"
height="600"
@currentChange="currentChange"
>
<template>
<el-table-column header-align="center" align="center" label="操作">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="buttonClick(scope, 0)"
>查看</el-button
>
<el-button type="primary" size="mini" @click="buttonClick(scope, 1)" v-hasPermi="['system:role:update']"
>修改</el-button
>
<el-button
:type="scope.row.valid == 1 ? 'warning' : 'primary'"
size="mini"
v-hasPermi="['system:role:openClose']"
@click="roleStatus(scope)"
>{{ scope.row.valid == 1 ? "停用" : "启用" }}</el-button
>
<el-button type="danger" size="mini" @click="removeRole(scope)" v-hasPermi="['system:role:delete']"
>删除角色</el-button
>
</template>
</el-table-column>
</template>
</Tables>
<Drawer
:drawer="drawer"
:drawerTitle="drawerTitle"
:roleFormDisabled="roleFormDisabled"
:roleData="roleData"
@handleClose="handleClose"
></Drawer>
</div>
</template>
<script>
import Drawer from "./drawer.vue";
import { MessageBox } from "element-ui";
import {
getRoleList,
detailRole,
updateRoleStatus,
} from "@/api/system/user.js";
export default {
name:"RoleConfig",
components: {
Drawer,
},
data() {
return {
formData: {
page: 1,
size: 20,
valid: null,
createStart: null,
createEnd: null,
name: null,
}, //查询条件
data: [], //表格数据
tableHeader: [
{
type: "index",
name: "",
value: "",
width: "",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "角色名称",
value: "name",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "角色状态",
value: "valid",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "创建人",
value: "remark",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "创建时间",
value: "createTime",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "修改时间",
value: "updateTime",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "备注",
value: "remark",
width: "400px",
align: "center",
sorTable: false,
disabled:true
},
], //表头数据
roleData: {}, //角色详情
createTime: [],
drawer: false,
drawerTitle: "",
roleFormDisabled: false,
tableLoading: false,
total: 0,
};
},
created() {
this.selectRoleList();
},
methods: {
//角色列表
selectRoleList() {
this.tableLoading = true;
if (this.createTime.length > 0) {
this.formData.createStart = this.createTime[0];
this.formData.createEnd = this.createTime[1];
}
}
getRoleList(this.formData)
.then((res) => {
this.tableLoading = false;
if (res.code === 200) {
this.data = res.data.list;
this.total = res.data.total;
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
this.tableLoading = false;
console.log(err);
});
},
//角色详情
roleDetail(id) {
detailRole(id)
.then((res) => {
if (res.code === 200) {
this.roleData = res.data;
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
console.log(err);
});
},
//新增角色
addRole() {
this.roleData = {};
this.drawer = true;
this.roleFormDisabled = false;
this.drawerTitle = "新增角色";
},
//修改查看角色
buttonClick(row, status) {
this.roleDetail(row.row.id);
this.roleData = row.row;
this.drawer = true;
status == 0
? (this.roleFormDisabled = true)
: (this.roleFormDisabled = false);
this.drawerTitle = "查看/修改角色";
},
//修改角色状态
roleStatus(row) {
let msg = "";
let status = {};
status.id = row.row.id;
row.row.valid == 1
? ((msg = "是否关闭此角色"), (status.valid = 2))
: ((msg = "是否启用此角色"), (status.valid = 1));
MessageBox.confirm(msg, "注意", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
updateRoleStatus(status).then((res) => {
if (res.code === 200) {
this.$message({
message: "操作成功",
type: "success",
});
this.selectRoleList();
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
});
})
.catch(() => []);
},
//删除角色
removeRole(row) {
MessageBox.confirm(
"如删除此角色,角色下所有用户将从中被剔除,可能会对用户操作造成影响!",
"注意",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
updateRoleStatus({
id: row.row.id,
valid: 0,
confirmDel: false,
}).then((res) => {
if (res.code === 200) {
this.$message({
message: "删除成功",
type: "success",
});
this.selectRoleList();
} else if (res.code === 202) {
MessageBox.confirm(res.msg, "注意", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
updateRoleStatus({
id: row.row.id,
valid: 0,
confirmDel: true,
}).then((res) => {
if (res.code === 200) {
this.$message({
message: "操作成功",
type: "success",
});
this.selectRoleList();
}
});
})
.catch(() => {});
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
});
})
.catch(() => []);
},
handleClose(val) {
this.drawer = val;
this.selectRoleList();
},
currentChange(val) {
this.formData.page = val.page;
this.selectRoleList();
},
},
};
</script>
<style>
</style>
\ No newline at end of file
......
<template>
<div class="userDrawer">
<el-drawer
:data="userData"
:title="drawerTitle"
:visible.sync="drawer"
direction="rtl"
size="40%"
:close-on-click-modal="false"
:wrapperClosable="false"
:show-close="false"
>
<el-form
ref="userForm"
:model="userForm"
label-width="auto"
:rules="rules"
style="margin: 10px"
>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="员工号:" prop="loginName">
<el-input
placeholder="请输入员工号"
v-model.trim="userForm.loginName"
v-if="!userFormDisabled"
:disabled="drawerTitle != '新增用户'"
size="mini"
></el-input>
<div v-else>{{ userForm.loginName }}</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户姓名:" prop="username">
<el-input
placeholder="请输入用户姓名"
:disabled="userFormDisabled"
v-model.trim="userForm.username"
v-if="!userFormDisabled"
size="mini"
></el-input>
<div v-else>{{ userForm.username }}</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-alert
title="注意:员工号一但设置就无法更改,请谨慎填写!"
type="warning"
show-icon
size="mini"
:closable="false"
style="width: 400px"
>
</el-alert>
</el-col>
<el-col :span="12">
<el-form-item label="手机号:" prop="phone">
<el-input
placeholder="请输入手机号"
type="phone"
v-model.trim="userForm.phone"
:disabled="userFormDisabled"
v-if="!userFormDisabled"
size="mini"
></el-input>
<div v-else>{{ userForm.phone }}</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电子邮箱:" prop="email">
<el-input
placeholder="请输入电子邮箱"
type="email"
v-model.trim="userForm.email"
:disabled="userFormDisabled"
v-if="!userFormDisabled"
size="mini"
></el-input>
<div v-else>{{ userForm.email }}</div>
</el-form-item>
</el-col>
<!-- <el-col :span="12" v-if="drawerTitle == '新增用户'">
<el-form-item label="密码:">
<el-input
placeholder="请输入密码"
:disabled="userFormDisabled"
type="password"
size="mini"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12" v-if="drawerTitle == '新增用户'">
<el-form-item label="确认密码:">
<el-input
placeholder="请确认密码"
:disabled="userFormDisabled"
type="password"
size="mini"
></el-input>
</el-form-item>
</el-col> -->
<el-col :span="24">
<el-form-item
label="所属口岸:"
prop="portName"
>
<!-- <el-checkbox-group v-model="port" :disabled="userFormDisabled">
<el-checkbox
v-for="item in portNameList"
:label="item.englishName"
:key="item.id"
>{{ item.englishName }}</el-checkbox
>
</el-checkbox-group> -->
<el-select
placeholder="不限"
v-model="port"
:disabled="userFormDisabled"
size="mini"
style="width: 100%"
multiple
clearable
>
<el-option
v-for="item in portNameList"
:label="item.englishName"
:value="item.englishName"
:key="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="所属角色:" prop="roleIds">
<el-checkbox-group
v-model="roleid"
:disabled="userFormDisabled"
@change="change"
>
<el-checkbox
v-for="item in roleList"
:label="item.id"
:key="item.id"
>{{ item.name }}</el-checkbox
>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注:" prop="remark">
<el-input
type="textarea"
v-model="userForm.remark"
placeholder="备注"
:disabled="userFormDisabled"
v-if="!userFormDisabled"
size="mini"
></el-input>
<div v-else>{{ userForm.remark }}</div>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button
type="primary"
size="mini"
v-if="!userFormDisabled"
:loading="loading"
@click="submit"
>提交</el-button
>
<el-button type="primary" size="mini" @click="handleClose"
>取消</el-button
>
</el-form-item>
</el-form>
</el-drawer>
</div>
</template>
<script>
import {
getRoleList,
addOrUpdateUser,
portNameList,
} from "@/api/system/user.js";
export default {
props: {
drawerTitle: {
type: String,
default: "",
},
userFormDisabled: {
type: Boolean,
default: false,
},
drawer: {
type: Boolean,
default: false,
},
userData: {
type: Object,
default: null,
},
},
data() {
return {
userForm: {
roleIds: [],
},
roleList: [],
portNameList: [],
port: [],
roleid: [],
ImageUploadUrl: "",
dialogVisible: false,
loading: false,
rules: {
loginName: [
{
required: true,
message: "角色名不能为空",
trigger: "blur",
},
],
username: [
{
required: true,
message: "角色名不能为空",
trigger: "blur",
},
],
portName: [
{
required: true,
message: "所属口岸不能为空",
trigger: "blur",
},
],
},
};
},
created() {
this.selectRoleList();
},
watch:{
drawer(val,oldVal){
if(val){
this.userForm = this.userData;
if (this.userData.roleIds) {
this.roleid = this.userData.roleIds;
}
if (this.userData.portName) {
this.port = this.userData.portName;
}
}
}
},
methods: {
change(val){
this.roleid = val;
},
selectRoleList() {
//角色列表
getRoleList({ size: null, page: null })
.then((res) => {
if (res.code === 200) {
this.roleList = res.data.list;
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
console.log(err);
});
//获取口岸
// this.portNameList = this.$store.state.user.portNames;
portNameList()
.then((res) => {
if (res.code === 200) {
this.portNameList = res.data;
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
console.log(err);
});
},
//关闭
handleClose() {
this.roleid = [];
this.port = [];
this.userForm = {
roleIds: [],
};
this.$emit("handleClose", false);
},
//提交
submit() {
this.loading = true;
this.userData.isValid ? "" : (this.userForm.isValid = 1);
this.userForm.roleIds = this.roleid;
this.userForm.portName = this.port.join(",");
addOrUpdateUser(this.userForm)
.then((res) => {
this.loading = false;
if (res.code === 200) {
this.$message({
message: "操作成功",
type: "success",
});
this.$emit("handleClose", false);
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
this.loading = false;
console.log(err);
});
},
},
};
</script>
<style>
</style>
\ No newline at end of file
<template>
<div></div>
<div>
<el-form ref="selectionUserForm" label-width="auto" style="margin: 20px">
<el-row :gutter="50">
<el-col :span="6">
<el-form-item label="用户姓名">
<el-input
placeholder="请输入用户名称"
v-model="formData.username"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="手机号码">
<el-input
placeholder="请输入用户名称"
v-model="formData.phone"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态">
<el-select placeholder="用户状态" v-model="formData.isValid">
<el-option label="开启" value="1"> </el-option>
<el-option label="关闭" value="2"> </el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="marginLeft: 20px">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
:loading="loading"
@click="selectUser"
>搜索</el-button
>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addUser" v-hasPermi="['system:user:add']"
>新增用户</el-button
>
</div>
<Tables
:data="data"
:headerData="tableHeader"
:limitSize="formData.size"
:totalCount="total"
:loading="loading"
:page="formData.page"
height="600"
@currentChange="currentChange"
>
<template>
<el-table-column
header-align="center"
align="center"
width="auto"
label="操作"
>
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="buttonClick(scope, 0)"
>查看</el-button
>
<el-button type="primary" size="mini" @click="buttonClick(scope, 1)" v-hasPermi="['system:user:update']"
>修改</el-button
>
<!-- <el-button type="primary" size="mini" @click="passwordShow = !passwordShow"
>修改密码</el-button
> -->
<el-button
:type="scope.row.isValid == 1 ? 'warning' : 'primary'"
size="mini"
v-hasPermi="['system:user:openClose']"
@click="userStatus(scope)"
>{{ scope.row.isValid == 1 ? "停用" : "启用" }}</el-button
>
<el-button type="danger" size="mini" @click="removeUser(scope)" v-hasPermi="['system:user:delete']"
>删除用户</el-button
>
</template>
</el-table-column>
</template>
</Tables>
<Drawer
:drawer="drawer"
:drawerTitle="drawerTitle"
:userFormDisabled="userFormDisabled"
:userData="userData"
@handleClose="handleClose"
></Drawer>
<!-- <el-dialog
title="修改密码"
:visible.sync="passwordShow"
width="30%"
:close-on-click-modal="false"
:append-to-body="true"
>
<el-form label-width="auto">
<el-row :gutter="10">
<el-col :span="24">
<el-form-item label="旧密码:">
<el-input placeholder="请输入旧密码" type="password"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="新密码:">
<el-input placeholder="请输入新密码" type="password"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="确认新密码:">
<el-input placeholder="请确认新密码" type="password"></el-input>
</el-form-item>
</el-col>
</el-row>
<div class="dialogFoot">
<el-button @click="passwordShow = false">取 消</el-button>
<el-button type="primary" @click="passwordShow = false">确 定</el-button>
</div>
</el-form>
</el-dialog> -->
</div>
</template>
<script>
import Drawer from "./drawer.vue";
import { MessageBox } from "element-ui";
import { listUser, detailUser, updateUserStatus } from "@/api/system/user.js";
export default {
name: "UserConfig",
components: {
Drawer,
},
data() {
return {
formData: {
page: 1,
size: 20,
isValid: null,
username: null,
phone: null,
}, //查询条件
tableHeader: [
{
type: "index",
name: "",
value: "",
width: "",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "员工号",
value: "loginName",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "用户姓名",
value: "username",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "所属口岸",
value: "portName",
width: "150px",
align: "center",
sortable: false,
disabled:true
},
{
type: "",
name: "所属角色",
value: "roleNames",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "电子邮箱",
value: "email",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "用户状态",
value: "isValid",
width: "100px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "修改时间",
value: "updateTime",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
{
type: "",
name: "备注",
value: "remark",
width: "150px",
align: "center",
sorTable: false,
disabled:true
},
], //表头数据
userData: {}, //用户详情
data: [], //用户列表
drawer: false,
userFormDisabled: false,
passwordShow: false,
drawerTitle: "",
total: 0,
loading: false,
};
},
created() {
this.selectUser();
},
methods: {
//用户列表
selectUser() {
this.loading = true;
listUser(this.formData)
.then((res) => {
this.loading = false;
if (res.code === 200) {
this.data = res.data.list;
this.total = res.data.total;
this.formData.page = res.data.page;
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
this.loading = false;
console.log(err);
});
},
//用户详情
userDetail(id) {
detailUser(id)
.then((res) => {
if (res.code === 200) {
this.userData = res.data;
this.userData.portName
?this.userData.portName=this.userData.portName.split(",")
: '';
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
})
.catch((err) => {
console.log(err);
});
},
//新增用户
addUser() {
this.userData = {};
this.drawer = true;
this.drawerTitle = "新增用户";
this.userFormDisabled = false;
},
//查询修改用户
buttonClick(row, status) {
this.userDetail(row.row.id);
this.userData = row.row;
this.drawer = true;
this.drawerTitle = "查看/修改用户";
status == 0
? (this.userFormDisabled = true)
: (this.userFormDisabled = false);
},
}
//修改用户状态
userStatus(row) {
let msg = "";
let nowValid = 1;
row.row.isValid == 1
? ((msg = "是否要停用此用户"), (nowValid = 2))
: ((msg = "是否要启用此用户"), (nowValid = 1));
MessageBox.confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
updateUserStatus({ id: row.row.id, isValid: nowValid }).then(
(res) => {
if (res.code === 200) {
this.$message({
message: "操作成功",
type: "success",
});
this.selectUser();
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
}
);
})
.catch((err) => {
console.log(err);
})
.catch(() => []);
},
//删除用户
removeUser(row) {
MessageBox.confirm("是否要删除此用户", "提示", {
confirmButtonText: "确定删除",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
updateUserStatus({ id: row.row.id, isValid: 0 }).then((res) => {
if (res.code === 200) {
this.$message({
message: "操作成功",
type: "success",
});
this.selectUser();
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
});
})
.catch((err) => {
console.log(err);
})
.catch(() => []);
},
handleClose(val) {
this.drawer = val;
this.userData = {};
this.selectUser();
},
currentChange(val) {
this.formData.page = val.page;
this.selectUser();
},
},
};
</script>
<style>
</style>
\ No newline at end of file
......