Merge branch 'dev-sy-9-24'
This commit is contained in:
commit
3bf7577b09
|
|
@ -7,5 +7,7 @@ VUE_APP_ENV = 'development-nw'
|
|||
# 若依管理系统/开发环境
|
||||
VUE_APP_BASE_API = '/dev-api'
|
||||
|
||||
VUE_APP_BAIDU_MAP_AK = 'cClgLBaLgGUdQDilX9dGvieL'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
|
|
|||
|
|
@ -8,5 +8,7 @@ NODE_ENV = production
|
|||
# 生产环境配置
|
||||
VUE_APP_ENV = 'production-nw'
|
||||
|
||||
VUE_APP_BAIDU_MAP_AK = 'cClgLBaLgGUdQDilX9dGvieL'
|
||||
|
||||
# 若依管理系统/生产环境
|
||||
VUE_APP_BASE_API = '/sgzbgl-api'
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
<title>
|
||||
<%= webpackConfig.name %>
|
||||
</title>
|
||||
<script async src="https://api.map.baidu.com/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
|
||||
<script src="https://api.map.baidu.com/api?type=webgl&v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
|
||||
<!-- <script async src="`https://api.map.baidu.com/api?v=2.0&ak=<%= webpackConfig.AK %>`"></script> -->
|
||||
<!-- <script src="https://api.map.baidu.com/api?type=webgl&v=2.0&ak=<%= webpackConfig.AK %>"></script> -->
|
||||
<script type="text/javascript" src="//api.map.baidu.com/library/TrackAnimation/src/TrackAnimation_min.js"></script>
|
||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,15 @@ export default {
|
|||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const script_1 = document.createElement('script')
|
||||
const script_2 = document.createElement('script')
|
||||
script_1.src = `https://api.map.baidu.com/api?v=2.0&ak=${process.env.VUE_APP_BAIDU_MAP_AK}`
|
||||
script_2.src = `https://api.map.baidu.com/api?type=webgl&v=2.0&ak=${process.env.VUE_APP_BAIDU_MAP_AK}`
|
||||
script_1.async = true
|
||||
document.body.appendChild(script_1)
|
||||
document.body.appendChild(script_2)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
|
|
|||
|
|
@ -1,178 +1,189 @@
|
|||
import request from '@/utils/request'
|
||||
import { parseStrEmpty } from "@/utils/ruoyi";
|
||||
import { parseStrEmpty } from '@/utils/ruoyi'
|
||||
|
||||
// 查询用户列表
|
||||
export function listUser(query) {
|
||||
return request({
|
||||
url: '/system/user/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户详细
|
||||
export function getUser(userId) {
|
||||
return request({
|
||||
url: '/system/user/' + parseStrEmpty(userId),
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/' + parseStrEmpty(userId),
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 新增用户
|
||||
export function addUser(data) {
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export function updateUser(data) {
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'put',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function delUser(userId) {
|
||||
return request({
|
||||
url: '/system/user/' + userId,
|
||||
method: 'delete'
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/' + userId,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
// 用户密码重置
|
||||
export function resetUserPwd(userId, password) {
|
||||
const data = {
|
||||
userId,
|
||||
password
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/resetPwd',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
const data = {
|
||||
userId,
|
||||
password,
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/resetPwd',
|
||||
method: 'put',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
// 用户密码重置 ---- 南网
|
||||
export function resetUserPwdNwApi(userId, password) {
|
||||
const data = {
|
||||
userId,
|
||||
password
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/reset',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
const data = {
|
||||
userId,
|
||||
password,
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/reset',
|
||||
method: 'put',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
// 用户密码重置 ---- 重庆
|
||||
export function resetUserPwdCqApi(userId, password) {
|
||||
const data = {
|
||||
userId,
|
||||
password
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/resetPwd',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
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
|
||||
})
|
||||
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'
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用户个人信息
|
||||
export function updateUserProfile(data) {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'put',
|
||||
data: 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
|
||||
})
|
||||
const data = {
|
||||
oldPassword,
|
||||
newPassword,
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/profile/updatePwd',
|
||||
method: 'put',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
// 用户密码重置 (南网)
|
||||
export function updateUserPwdNw(oldPassword, newPassword) {
|
||||
const data = {
|
||||
actionCode: oldPassword,
|
||||
handleCode: newPassword,
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/profile/update',
|
||||
method: 'put',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 用户头像上传
|
||||
export function uploadAvatar(data) {
|
||||
return request({
|
||||
url: '/system/user/profile/avatar',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/profile/avatar',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询授权角色
|
||||
export function getAuthRole(userId) {
|
||||
return request({
|
||||
url: '/system/user/authRole/' + userId,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/authRole/' + userId,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 保存授权角色
|
||||
export function updateAuthRole(data) {
|
||||
return request({
|
||||
url: '/system/user/authRole',
|
||||
method: 'put',
|
||||
params: data
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/authRole',
|
||||
method: 'put',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询部门下拉树结构
|
||||
export function deptTreeSelect() {
|
||||
return request({
|
||||
url: '/system/user/deptTree',
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/deptTree',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 通过角色查询用户
|
||||
export function getUserByRoleList(data) {
|
||||
return request({
|
||||
url: '/system/user/getUserByRoleList',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
return request({
|
||||
url: '/system/user/getUserByRoleList',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 库管员
|
||||
export function getMaUserList(params) {
|
||||
return request({
|
||||
url: '/material/base/maWarehouseKeeper/getMaUserList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
return request({
|
||||
url: '/material/base/maWarehouseKeeper/getMaUserList',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,52 +8,68 @@ import { isRelogin } from '@/utils/request'
|
|||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/register', '/auth/sendCode', '/qrCode/qrCodePage']
|
||||
const whiteList = [
|
||||
'/login',
|
||||
'/register',
|
||||
'/auth/sendCode',
|
||||
'/qrCode/qrCodePage',
|
||||
'/resetPassword',
|
||||
]
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
||||
/* has token*/
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
NProgress.done()
|
||||
} else {
|
||||
if (store.getters.roles.length === 0) {
|
||||
isRelogin.show = true
|
||||
// 判断当前用户是否已拉取完user_info信息
|
||||
store.dispatch('GetInfo').then(() => {
|
||||
isRelogin.show = false
|
||||
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
||||
// 根据roles权限生成可访问的路由表
|
||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
})
|
||||
}).catch(err => {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
Message.error(err)
|
||||
// next({ path: '/login' })
|
||||
// next({ path: '/gl/login' })
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
||||
/* has token*/
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
NProgress.done()
|
||||
} else {
|
||||
if (store.getters.roles.length === 0) {
|
||||
isRelogin.show = true
|
||||
// 判断当前用户是否已拉取完user_info信息
|
||||
store
|
||||
.dispatch('GetInfo')
|
||||
.then(() => {
|
||||
isRelogin.show = false
|
||||
store
|
||||
.dispatch('GenerateRoutes')
|
||||
.then((accessRoutes) => {
|
||||
// 根据roles权限生成可访问的路由表
|
||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
Message.error(err)
|
||||
// next({ path: '/login' })
|
||||
// next({ path: '/gl/login' })
|
||||
|
||||
next({ path: process.env.VUE_APP_ENV === 'production-nw' ? '/sgzbgl/login' : '/login' })
|
||||
})
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 没有token
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
next({
|
||||
path:
|
||||
process.env.VUE_APP_ENV === 'production-nw'
|
||||
? '/sgzbgl/login'
|
||||
: '/login',
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
|
||||
NProgress.done()
|
||||
// 没有token
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
} else {
|
||||
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
router.afterEach(() => {
|
||||
NProgress.done()
|
||||
NProgress.done()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,178 +1,203 @@
|
|||
import { login, logout, getInfo, refreshToken, checkCode, loginByMall } from '@/api/login'
|
||||
import {
|
||||
login,
|
||||
logout,
|
||||
getInfo,
|
||||
refreshToken,
|
||||
checkCode,
|
||||
loginByMall,
|
||||
} from '@/api/login'
|
||||
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
||||
import { Notification, MessageBox, Message, Loading } from 'element-ui'
|
||||
import { encrypt } from '@/utils/jsencrypt'
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
token: getToken(),
|
||||
id: '',
|
||||
name: '',
|
||||
avatar: '',
|
||||
roles: [],
|
||||
permissions: []
|
||||
},
|
||||
|
||||
mutations: {
|
||||
SET_TOKEN: (state, token) => {
|
||||
state.token = token
|
||||
},
|
||||
SET_EXPIRES_IN: (state, time) => {
|
||||
state.expires_in = time
|
||||
},
|
||||
SET_ID: (state, id) => {
|
||||
state.id = id
|
||||
},
|
||||
SET_NAME: (state, name) => {
|
||||
state.name = name
|
||||
},
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
},
|
||||
SET_PERMISSIONS: (state, permissions) => {
|
||||
state.permissions = permissions
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
// 登录
|
||||
async Login({ commit }, userInfo) {
|
||||
const username = userInfo.username.trim()
|
||||
const password = encrypt(userInfo.password)
|
||||
// const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const textCode = userInfo.textCode
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid, textCode).then(res => {
|
||||
let data = res.data
|
||||
localStorage.setItem('isCode', data.code || '')
|
||||
setToken(data.access_token)
|
||||
commit('SET_TOKEN', data.access_token)
|
||||
localStorage.setItem('token', data.access_token)
|
||||
setExpiresIn(data.expires_in)
|
||||
commit('SET_EXPIRES_IN', data.expires_in)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 短信验证码 登录
|
||||
textLogin({ commit }, userInfo) {
|
||||
console.log(userInfo)
|
||||
let params = {
|
||||
phone: userInfo.phone,
|
||||
code: userInfo.textCode
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
checkCode(params).then(res => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
let data = res.data
|
||||
setToken(data.access_token)
|
||||
commit('SET_TOKEN', data.access_token)
|
||||
localStorage.setItem('token', data.access_token)
|
||||
setExpiresIn(data.expires_in)
|
||||
commit('SET_EXPIRES_IN', data.expires_in)
|
||||
resolve()
|
||||
}
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
//机具租赁平台跳转登录---南网
|
||||
ssoLogin({ commit }, param) {
|
||||
return new Promise((resolve, reject) => {
|
||||
loginByMall(param).then(res => {
|
||||
console.log(res)
|
||||
let data = res.data
|
||||
if (res.code == 200) {
|
||||
// console.log('登录成功1111111')
|
||||
setToken(data.access_token)
|
||||
commit('SET_TOKEN', data.access_token)
|
||||
localStorage.setItem('token', data.access_token)
|
||||
setExpiresIn(data.expires_in)
|
||||
commit('SET_EXPIRES_IN', data.expires_in)
|
||||
} else {
|
||||
// console.log('登录失败22222222')
|
||||
this.$modal.msgError('登录失败');
|
||||
}
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
state: {
|
||||
token: getToken(),
|
||||
id: '',
|
||||
name: '',
|
||||
avatar: '',
|
||||
roles: [],
|
||||
permissions: [],
|
||||
},
|
||||
|
||||
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
/* 存储当前登录用户的userId */
|
||||
sessionStorage.setItem('userId', user.userId)
|
||||
sessionStorage.setItem('deptId', user.deptId)
|
||||
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar;
|
||||
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
||||
commit('SET_ROLES', res.roles)
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
} else {
|
||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||
}
|
||||
commit('SET_ID', user.userId)
|
||||
commit('SET_NAME', user.userName)
|
||||
commit('SET_AVATAR', avatar)
|
||||
resolve(res)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
mutations: {
|
||||
SET_TOKEN: (state, token) => {
|
||||
state.token = token
|
||||
},
|
||||
SET_EXPIRES_IN: (state, time) => {
|
||||
state.expires_in = time
|
||||
},
|
||||
SET_ID: (state, id) => {
|
||||
state.id = id
|
||||
},
|
||||
SET_NAME: (state, name) => {
|
||||
state.name = name
|
||||
},
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
},
|
||||
SET_PERMISSIONS: (state, permissions) => {
|
||||
state.permissions = permissions
|
||||
},
|
||||
},
|
||||
|
||||
// 刷新token
|
||||
RefreshToken({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
refreshToken(state.token).then(res => {
|
||||
setExpiresIn(res.data)
|
||||
commit('SET_EXPIRES_IN', res.data)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
actions: {
|
||||
// 登录
|
||||
async Login({ commit }, userInfo) {
|
||||
const username = userInfo.username.trim()
|
||||
const password = encrypt(userInfo.password)
|
||||
// const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const textCode = userInfo.textCode
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid, textCode)
|
||||
.then((res) => {
|
||||
let data = res.data
|
||||
localStorage.setItem(
|
||||
'isCode',
|
||||
data.login_user.forceChangePwd || '',
|
||||
)
|
||||
setToken(data.access_token)
|
||||
commit('SET_TOKEN', data.access_token)
|
||||
localStorage.setItem('token', data.access_token)
|
||||
setExpiresIn(data.expires_in)
|
||||
commit('SET_EXPIRES_IN', data.expires_in)
|
||||
resolve()
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 短信验证码 登录
|
||||
textLogin({ commit }, userInfo) {
|
||||
console.log(userInfo)
|
||||
let params = {
|
||||
phone: userInfo.phone,
|
||||
code: userInfo.textCode,
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
checkCode(params)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
let data = res.data
|
||||
setToken(data.access_token)
|
||||
commit('SET_TOKEN', data.access_token)
|
||||
localStorage.setItem('token', data.access_token)
|
||||
setExpiresIn(data.expires_in)
|
||||
commit('SET_EXPIRES_IN', data.expires_in)
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
//机具租赁平台跳转登录---南网
|
||||
ssoLogin({ commit }, param) {
|
||||
return new Promise((resolve, reject) => {
|
||||
loginByMall(param)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
let data = res.data
|
||||
if (res.code == 200) {
|
||||
// console.log('登录成功1111111')
|
||||
setToken(data.access_token)
|
||||
commit('SET_TOKEN', data.access_token)
|
||||
localStorage.setItem('token', data.access_token)
|
||||
setExpiresIn(data.expires_in)
|
||||
commit('SET_EXPIRES_IN', data.expires_in)
|
||||
} else {
|
||||
// console.log('登录失败22222222')
|
||||
this.$modal.msgError('登录失败')
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 退出系统
|
||||
LogOut({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(state.token).then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('SET_PERMISSIONS', [])
|
||||
removeToken()
|
||||
localStorage.removeItem('isCode')
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo()
|
||||
.then((res) => {
|
||||
const user = res.user
|
||||
/* 存储当前登录用户的userId */
|
||||
sessionStorage.setItem('userId', user.userId)
|
||||
sessionStorage.setItem('deptId', user.deptId)
|
||||
const avatar =
|
||||
user.avatar == '' || user.avatar == null
|
||||
? require('@/assets/images/profile.jpg')
|
||||
: user.avatar
|
||||
if (res.roles && res.roles.length > 0) {
|
||||
// 验证返回的roles是否是一个非空数组
|
||||
commit('SET_ROLES', res.roles)
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
} else {
|
||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||
}
|
||||
commit('SET_ID', user.userId)
|
||||
commit('SET_NAME', user.userName)
|
||||
commit('SET_AVATAR', avatar)
|
||||
resolve(res)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 前端 登出
|
||||
FedLogOut({ commit }) {
|
||||
return new Promise(resolve => {
|
||||
commit('SET_TOKEN', '')
|
||||
removeToken()
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
}
|
||||
// 刷新token
|
||||
RefreshToken({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
refreshToken(state.token)
|
||||
.then((res) => {
|
||||
setExpiresIn(res.data)
|
||||
commit('SET_EXPIRES_IN', res.data)
|
||||
resolve()
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 退出系统
|
||||
LogOut({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(state.token)
|
||||
.then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('SET_PERMISSIONS', [])
|
||||
removeToken()
|
||||
localStorage.removeItem('isCode')
|
||||
resolve()
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 前端 登出
|
||||
FedLogOut({ commit }) {
|
||||
return new Promise((resolve) => {
|
||||
commit('SET_TOKEN', '')
|
||||
removeToken()
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default user
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// const qrUrl = 'http://192.168.0.14:21624/qrCode/qrCodePage?qrCode='; //测试
|
||||
// const qrUrl = 'http://112.29.103.165:21626/qrCode/qrCodePage?qrCode='; //重庆
|
||||
// const qrUrl = 'http://112.29.103.165:21624/qrCode/qrCodePage?qrCode='; //宁夏
|
||||
|
|
@ -7,20 +6,14 @@
|
|||
// const qrUrl = process.env.NODE_ENV === 'production' ? 'http://192.168.0.14:18866/qrCode/qrCodePage?qrCode=' : 'http://192.168.0.14:21624/qrCode/qrCodePage?qrCode='
|
||||
let qrUrl = ''
|
||||
const origin = window.location.origin
|
||||
if (origin == 'http://112.29.103.165:21626') {
|
||||
qrUrl = 'http://112.29.103.165:21626/qrCode/qrCodePage?qrCode='
|
||||
} else {
|
||||
qrUrl = 'http://192.168.0.14:18866/qrCode/qrCodePage?qrCode='
|
||||
}
|
||||
|
||||
qrUrl = origin + '/qrCode/qrCodePage?qrCode='
|
||||
// if (origin == 'http://112.29.103.165:21626') {
|
||||
// qrUrl = 'http://112.29.103.165:21626/qrCode/qrCodePage?qrCode='
|
||||
// } else {
|
||||
// qrUrl = 'http://192.168.0.14:18866/qrCode/qrCodePage?qrCode='
|
||||
// }
|
||||
|
||||
export default {
|
||||
qrUrl,
|
||||
qrUrl,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -431,14 +431,14 @@ export default {
|
|||
this.$store
|
||||
.dispatch('Login', this.loginForm)
|
||||
.then(() => {
|
||||
// if (localStorage.getItem('isCode') == 1) {
|
||||
// this.$router
|
||||
// .push({ path: '/resetPassword' })
|
||||
// .catch(() => {})
|
||||
// } else {
|
||||
// this.$router.push({ path: '/' }).catch(() => {})
|
||||
// }
|
||||
this.$router.push({ path: '/' }).catch(() => {})
|
||||
if (localStorage.getItem('isCode') == 1) {
|
||||
this.$router
|
||||
.push({ path: '/resetPassword' })
|
||||
.catch(() => {})
|
||||
} else {
|
||||
this.$router.push({ path: '/' }).catch(() => {})
|
||||
}
|
||||
// this.$router.push({ path: '/' }).catch(() => {})
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
|
|
|
|||
|
|
@ -46,192 +46,196 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { updateUserPwd } from '@/api/system/user'
|
||||
import { validPassword } from '@/utils/validate'
|
||||
import { encrypt } from '@/utils/jsencrypt.js'
|
||||
import { updateUserPwd, updateUserPwdNw } from '@/api/system/user'
|
||||
import { validPassword } from '@/utils/validate'
|
||||
import { encrypt } from '@/utils/jsencrypt.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
const passwordRegex = (rule, value, callback) => {
|
||||
if (value.length < 8 || value.length > 20) {
|
||||
callback(new Error('密码长度在 8 到 20 个字符'))
|
||||
} else if (!validPassword(value)) {
|
||||
callback(
|
||||
new Error('密码须包含数字、字母、特殊符号中的两种以上'),
|
||||
)
|
||||
} else if (this.user.oldPassword === value) {
|
||||
callback(new Error('新密码不能与旧密码相同'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
const passwordRegex = (rule, value, callback) => {
|
||||
if (value.length < 8 || value.length > 20) {
|
||||
callback(new Error('密码长度在 8 到 20 个字符'))
|
||||
} else if (!validPassword(value)) {
|
||||
callback(
|
||||
new Error('密码须包含数字、字母、特殊符号中的两种以上'),
|
||||
)
|
||||
} else if (this.user.oldPassword === value) {
|
||||
callback(new Error('新密码不能与旧密码相同'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.user.newPassword !== value) {
|
||||
callback(new Error('两次输入的密码不一致'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.user.newPassword !== value) {
|
||||
callback(new Error('两次输入的密码不一致'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
return {
|
||||
user: {
|
||||
oldPassword: undefined,
|
||||
newPassword: undefined,
|
||||
confirmPassword: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
oldPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '旧密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
newPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '新密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
validator: passwordRegex,
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
confirmPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '确认密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
validator: equalToPassword,
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const oldPassword = encrypt(this.user.oldPassword)
|
||||
const newPassword = encrypt(this.user.newPassword)
|
||||
updateUserPwd(oldPassword, newPassword).then(
|
||||
(response) => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
// 进入首页
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/login'
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
return {
|
||||
user: {
|
||||
oldPassword: undefined,
|
||||
newPassword: undefined,
|
||||
confirmPassword: undefined,
|
||||
},
|
||||
close() {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/login'
|
||||
})
|
||||
// 表单校验
|
||||
rules: {
|
||||
oldPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '旧密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
newPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '新密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
validator: passwordRegex,
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
confirmPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '确认密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
validator: equalToPassword,
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const oldPassword = encrypt(this.user.oldPassword)
|
||||
const newPassword = encrypt(this.user.newPassword)
|
||||
|
||||
const API_FUN =
|
||||
process.env.VUE_APP_ENV === 'development-nw' ||
|
||||
process.env.VUE_APP_ENV === 'production-nw'
|
||||
? updateUserPwdNw
|
||||
: updateUserPwd
|
||||
API_FUN(oldPassword, newPassword).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
// 进入首页
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/login'
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
close() {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/login'
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.login {
|
||||
//display: flex;
|
||||
//justify-content: center;
|
||||
//align-items: center;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
background-image: url('../assets/images/login.png');
|
||||
background-size: 100% 100%;
|
||||
//background: #1891FF;
|
||||
}
|
||||
.login {
|
||||
//display: flex;
|
||||
//justify-content: center;
|
||||
//align-items: center;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
background-image: url('../assets/images/login.png');
|
||||
background-size: 100% 100%;
|
||||
//background: #1891FF;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
//text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
//text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
.login-bar {
|
||||
position: absolute;
|
||||
height: auto;
|
||||
top: 20%;
|
||||
left: 14%;
|
||||
width: auto;
|
||||
height: 500px;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
padding-top: 40px;
|
||||
}
|
||||
.login-bar {
|
||||
position: absolute;
|
||||
height: auto;
|
||||
top: 20%;
|
||||
left: 14%;
|
||||
width: auto;
|
||||
height: 500px;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
.form-bar {
|
||||
//height: 500px;
|
||||
width: 360px;
|
||||
background: #fff;
|
||||
}
|
||||
.form-bar {
|
||||
//height: 500px;
|
||||
width: 360px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
//border-radius: 6px;
|
||||
//height: 100%;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
.login-form {
|
||||
//border-radius: 6px;
|
||||
//height: 100%;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
|
||||
.el-input {
|
||||
height: 45px;
|
||||
.el-input {
|
||||
height: 45px;
|
||||
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.login-code-img {
|
||||
height: 38px;
|
||||
}
|
||||
.login-code-img {
|
||||
height: 38px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { updateUserPwd } from '@/api/system/user'
|
||||
import { updateUserPwd, updateUserPwdNw } from '@/api/system/user'
|
||||
import { validPassword } from '@/utils/validate'
|
||||
import { encrypt } from '@/utils/jsencrypt.js'
|
||||
|
||||
|
|
@ -113,7 +113,13 @@ export default {
|
|||
if (valid) {
|
||||
const oldPassword = encrypt(this.user.oldPassword)
|
||||
const newPassword = encrypt(this.user.newPassword)
|
||||
updateUserPwd(oldPassword, newPassword).then((response) => {
|
||||
|
||||
const API_FUN =
|
||||
process.env.VUE_APP_ENV === 'development-nw' ||
|
||||
process.env.VUE_APP_ENV === 'production-nw'
|
||||
? updateUserPwdNw
|
||||
: updateUserPwd
|
||||
API_FUN(oldPassword, newPassword).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,418 @@
|
|||
<template>
|
||||
<div id="newDevicesCode">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="关键字" prop="keyWord">
|
||||
<el-input
|
||||
v-model="queryParams.keyWord"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
maxlength="50"
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="typeList">
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column
|
||||
label="机具名称"
|
||||
align="center"
|
||||
prop="typeName"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规格型号"
|
||||
align="center"
|
||||
prop="specificationType"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="采购时间"
|
||||
align="center"
|
||||
prop="purchaseTime"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="采购数量"
|
||||
align="center"
|
||||
prop="purchaseNum"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="验收数量"
|
||||
align="center"
|
||||
prop="checkNum"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="绑定数量"
|
||||
align="center"
|
||||
prop="bindNum"
|
||||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.bindNum > 0">{{
|
||||
scope.row.bindNum
|
||||
}}</span>
|
||||
<span v-else>0</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="状态"
|
||||
align="center"
|
||||
prop="status"
|
||||
width="180"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status == 0">待入库</span>
|
||||
<span v-if="scope.row.status == 1">已入库</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
icon="el-icon-view"
|
||||
v-if="scope.row.status == 0 || scope.row.status == 1"
|
||||
@click="handleBindDetails(scope.row)"
|
||||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
v-if="scope.row.bindNum < scope.row.checkNum"
|
||||
@click="handleCode(scope.row)"
|
||||
>
|
||||
绑定编码
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 添加或修改参数配置对话框 -->
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="open"
|
||||
v-if="open"
|
||||
width="90%"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-table v-loading="loading" :data="codeList" max-height="600">
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column
|
||||
width="160"
|
||||
align="center"
|
||||
prop="typeName"
|
||||
label="机具名称"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
width="160"
|
||||
align="center"
|
||||
label="规格型号"
|
||||
show-overflow-tooltip
|
||||
prop="specificationType"
|
||||
/>
|
||||
<el-table-column label="设备编码" align="center" prop="maCode">
|
||||
<template slot-scope="scope">
|
||||
<template v-if="!isDetail">
|
||||
<span>{{ scope.row.specificationType + '-' }}</span>
|
||||
<el-input
|
||||
clearable
|
||||
v-model="scope.row.tempCode"
|
||||
:ref="`inputRef_${scope.$index}`"
|
||||
style="width: 260px; margin: 0 5px"
|
||||
/>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-bottom"
|
||||
v-if="
|
||||
scope.row.tempCode &&
|
||||
scope.$index !== codeList.length - 1
|
||||
"
|
||||
@click="
|
||||
onFillDownwards(
|
||||
scope.$index,
|
||||
scope.row.tempCode,
|
||||
)
|
||||
"
|
||||
></el-button>
|
||||
</template>
|
||||
|
||||
<span v-else>{{ scope.row.maCode }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
width="160"
|
||||
align="center"
|
||||
label="是否为固定资产"
|
||||
show-overflow-tooltip
|
||||
v-if="isDetail"
|
||||
>
|
||||
<template slot-scope="{ row }">
|
||||
<el-tag
|
||||
size="small"
|
||||
type="success"
|
||||
v-if="row.fixCode == 0"
|
||||
>是</el-tag
|
||||
>
|
||||
<el-tag size="small" type="warning" v-else>否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="固定资产编码"
|
||||
align="center"
|
||||
prop="assetsCode"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<template v-if="!isDetail">
|
||||
<el-checkbox
|
||||
v-model="scope.row.fixCode"
|
||||
@change="onChangeCheckBox($event, scope.$index)"
|
||||
>是否为固定资产</el-checkbox
|
||||
>
|
||||
<el-input
|
||||
clearable
|
||||
v-model="scope.row.assetsCode"
|
||||
:disabled="!scope.row.fixCode"
|
||||
:ref="`assetsCode_${scope.$index}`"
|
||||
style="width: 260px; margin-left: 5px"
|
||||
/>
|
||||
</template>
|
||||
<span v-else>{{ scope.row.assetsCode || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div slot="footer" class="dialog-footer" style="text-align: center">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="submitForm"
|
||||
v-if="!isDetail"
|
||||
:loading="codingLoading"
|
||||
>确 定</el-button
|
||||
>
|
||||
<el-button @click="() => (open = false)">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getMacodeList,
|
||||
editPurchaseMacode,
|
||||
getBindCodeDetails,
|
||||
} from '@/api/store/newBuy'
|
||||
|
||||
export default {
|
||||
name: 'NewDevicesCode',
|
||||
props: {
|
||||
codingTaskId: {
|
||||
type: [String, Number],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
taskId: '',
|
||||
// 表格数据
|
||||
typeList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
keyWord: '',
|
||||
typeName: undefined,
|
||||
},
|
||||
isDetail: false,
|
||||
surplusNoBindNum: 0,
|
||||
codingLoading: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.taskId = this.codingTaskId
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
this.loading = true
|
||||
this.queryParams.taskId = this.taskId
|
||||
const { data: res } = await getMacodeList(this.queryParams)
|
||||
this.typeList = res
|
||||
this.loading = false
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/* 编码按钮操作 */
|
||||
handleCode(row) {
|
||||
this.open = true
|
||||
this.title = '编码生成'
|
||||
this.isDetail = false
|
||||
|
||||
const { checkNum, typeName, specificationType, typeId, taskId } =
|
||||
row
|
||||
let codeList = []
|
||||
for (let i = 0; i < checkNum; i++) {
|
||||
const codeItems = {
|
||||
tempCode: '', // 临时编码 (确定提交时再与规格型号合并)
|
||||
maCode: '', // 机具编码
|
||||
assetsCode: '', // 固定资产编码
|
||||
fixCode: false, // 是否为固定资产 0是 1否 (先设置Boolean值,默认为非固定资产,提交时再转)
|
||||
typeId,
|
||||
taskId,
|
||||
typeName,
|
||||
specificationType,
|
||||
}
|
||||
codeList.push(codeItems)
|
||||
}
|
||||
this.codeList = codeList
|
||||
},
|
||||
|
||||
/* 提交按钮 */
|
||||
submitForm() {
|
||||
let isCode = false
|
||||
try {
|
||||
this.codeList.forEach((e, i) => {
|
||||
if (e.tempCode === '') {
|
||||
this.$modal.msgError(
|
||||
`序号为${i + 1}的编码为空,请编码后再确定提交`,
|
||||
)
|
||||
this.$refs[`inputRef_${i}`].focus()
|
||||
isCode = true
|
||||
throw new Error()
|
||||
}
|
||||
this.codeList.forEach((e, i) => {
|
||||
if (e.fixCode && e.assetsCode === '') {
|
||||
this.$modal.msgError(
|
||||
`序号为${
|
||||
i + 1
|
||||
}的编码机具已选为固定资产,固定资产编码不能为空`,
|
||||
)
|
||||
this.$refs[`assetsCode_${i}`].focus()
|
||||
isCode = true
|
||||
throw new Error()
|
||||
}
|
||||
})
|
||||
})
|
||||
} catch (error) {}
|
||||
|
||||
if (isCode) return
|
||||
const codeListParams = JSON.parse(JSON.stringify(this.codeList))
|
||||
codeListParams.forEach((e) => {
|
||||
e.maCode = e.specificationType + e.tempCode
|
||||
e.fixCode ? (e.fixCode = '0') : (e.fixCode = '1')
|
||||
return e
|
||||
})
|
||||
|
||||
this.codingLoading = true
|
||||
|
||||
editPurchaseMacode(codeListParams)
|
||||
.then((res) => {
|
||||
if (res.data && res.data.length > 0) {
|
||||
try {
|
||||
res.data.forEach((e, i) => {
|
||||
if (e.maCode === null) {
|
||||
this.$modal.msgError(
|
||||
`序号为${i + 1}的编码重复,请重新编码`,
|
||||
)
|
||||
this.codeList[i].tempCode = ''
|
||||
this.$refs[`inputRef_${i}`].focus()
|
||||
throw new Error()
|
||||
}
|
||||
})
|
||||
} catch (error) {}
|
||||
} else {
|
||||
this.$modal.msgSuccess('编码绑定成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.codingLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
async handleBindDetails(row) {
|
||||
this.isDetail = true
|
||||
this.title = '编码绑定详情'
|
||||
getBindCodeDetails({
|
||||
taskId: row.taskId,
|
||||
typeId: row.typeId,
|
||||
}).then((res) => {
|
||||
this.codeList = res.data
|
||||
this.open = true
|
||||
})
|
||||
},
|
||||
|
||||
/* 正则处理编码后缀 */
|
||||
extractNumber(str) {
|
||||
const matches = str.match(/\d+/g) // 匹配所有数字
|
||||
return matches ? matches.map(Number) : [] // 转换为数字数组
|
||||
},
|
||||
|
||||
/* 向下填充事件 */
|
||||
onFillDownwards(index, code) {
|
||||
const codeNumList = this.extractNumber(code)
|
||||
let newStr = code
|
||||
codeNumList.forEach((e) => {
|
||||
newStr = newStr.replace(e, e * 1 + 1)
|
||||
})
|
||||
this.codeList[index + 1].tempCode = newStr
|
||||
},
|
||||
|
||||
/* 复选框选择事件 */
|
||||
onChangeCheckBox(val, index) {
|
||||
if (!val) {
|
||||
this.codeList[index].assetsCode = ''
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -29,12 +29,14 @@ import Home from './component/home.vue' // 主列表
|
|||
import AddTools from './component/addTools.vue' // 新增机具 和 修改机具
|
||||
import QueryTools from './component/queryTools.vue' // 查询机具 和 验收机具
|
||||
import CodingTools from './component/codingTools.vue'
|
||||
import CodingToolsCq from './component/codingTools-cq.vue'
|
||||
export default {
|
||||
components: {
|
||||
Home,
|
||||
AddTools,
|
||||
QueryTools,
|
||||
CodingTools,
|
||||
CodingToolsCq,
|
||||
PageHeader,
|
||||
},
|
||||
data() {
|
||||
|
|
@ -86,7 +88,12 @@ export default {
|
|||
codingTools(taskId) {
|
||||
this.pageContent = '编码管理'
|
||||
this.codingTaskId = taskId
|
||||
this.isShowComponent = 'CodingTools'
|
||||
let comStr = ''
|
||||
process.env.VUE_APP_ENV === 'development-nw' ||
|
||||
process.env.VUE_APP_ENV === 'production-nw'
|
||||
? (comStr = 'CodingTools')
|
||||
: (comStr = 'CodingToolsCq')
|
||||
this.isShowComponent = comStr
|
||||
},
|
||||
/* 返回按钮 */
|
||||
goBack() {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ const CompressionPlugin = require('compression-webpack-plugin')
|
|||
|
||||
const name = process.env.VUE_APP_TITLE || '施工装备管理系统' // 网页标题
|
||||
|
||||
const Ak = process.env.VUE_APP_BAIDU_MAP_AK
|
||||
|
||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||
|
||||
// vue.config.js 配置说明
|
||||
|
|
@ -44,10 +46,10 @@ module.exports = {
|
|||
|
||||
target: `http://192.168.2.158:39080`, //超
|
||||
// target: `http://10.40.92.81:8080`, //韩/
|
||||
// target: `http://192.168.2.75:39080`, //旭/
|
||||
// target: `http://192.168.2.74:49080`, //旭/
|
||||
// target: `http://192.168.2.17:39080`, //帅
|
||||
// target: `http://192.168.2.234:49080`, //福
|
||||
// target: `http://192.168.0.56:21627`, //跃
|
||||
// target: `http://192.168.0.37:49080`, //跃
|
||||
|
||||
//******** 注意事项 ********* */
|
||||
//1.全局替换qrUrl二维码扫码提供的网址-发布服务器的地址target;
|
||||
|
|
|
|||
Loading…
Reference in New Issue