diff --git a/api/inLocation.js b/api/inLocation.js new file mode 100644 index 0000000..d51443e --- /dev/null +++ b/api/inLocation.js @@ -0,0 +1,24 @@ +import request from '@/utils/request' +// 获取采购订单分页列表 +export function getInLocationPage(params) { + return request({ + url: '/eam/item-order-main/getPdaPage', + 'method': 'GET', + params + }) +} +// 获取采购订单分页列表 +export function getInLocationDetail(id) { + return request({ + url: '/eam/item-order-main/getPdaDetailsById?id='+id, + 'method': 'GET', + }) +} +// 入库新增 +export function inLocationCreat(data) { + return request({ + url: '/eam/item-order-main/inOperation', + 'method': 'POST', + data + }) +} \ No newline at end of file diff --git a/api/location.js b/api/location.js new file mode 100644 index 0000000..4e0df48 --- /dev/null +++ b/api/location.js @@ -0,0 +1,16 @@ +import request from '@/utils/request' +// 获取库位 +export function getLocation(number) { + return request({ + url: '/eam/location/scanCodeByNumber?number='+number, + 'method': 'GET', + }) +} +// 出库获取库位 +export function getOutLocation(params) { + return request({ + url: '/eam/location/outScanCodeByNumber', + 'method': 'GET', + params + }) +} diff --git a/api/outLocation.js b/api/outLocation.js new file mode 100644 index 0000000..d656dc9 --- /dev/null +++ b/api/outLocation.js @@ -0,0 +1,25 @@ +import request from '@/utils/request' +// 获取领用出库分页列表 +export function getOutLocationPage(params) { + return request({ + url: '/eam/item-apply-main/getAppOutOperaPage', + 'method': 'GET', + params + }) +} +// 获取领用出库详情 +export function getOutLocationDetail(params) { + return request({ + url: '/eam/item-apply-main/appGetByNumber', + 'method': 'GET', + params + }) +} +// 出库新增 +export function outLocationCreat(data) { + return request({ + url: '/eam/item-apply-main/outOperation', + 'method': 'POST', + data + }) +} \ No newline at end of file diff --git a/api/spareParts.js b/api/spareParts.js new file mode 100644 index 0000000..095edd3 --- /dev/null +++ b/api/spareParts.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 获取备件信息 +export function getSparePartsInfo(params) { + return request({ + url: '/eam/item/inScanCodeByNumber', + 'method': 'GET', + params + }) +} +// 备件归还获取备件信息 +export function getSparePartsReturnInfo(params) { + return request({ + url: '/eam/item/scanCodeByNumber', + 'method': 'GET', + params + }) +} \ No newline at end of file diff --git a/api/sparePartsReturn.js b/api/sparePartsReturn.js new file mode 100644 index 0000000..61f673a --- /dev/null +++ b/api/sparePartsReturn.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' +// 归还 +export function sparePartsReturn(data) { + return request({ + url: '/eam/item-apply-main/inOperation', + 'method': 'POST', + data + }) +} \ No newline at end of file diff --git a/api/system/user.js b/api/system/user.js deleted file mode 100644 index 59e9304..0000000 --- a/api/system/user.js +++ /dev/null @@ -1,42 +0,0 @@ -import upload from '@/utils/upload' -import request from '@/utils/request' - -// 用户密码重置 -export function updateUserPwd(oldPassword, newPassword) { - const data = { - oldPassword, - newPassword - } - return request({ - url: '/system/user/profile/update-password', - method: 'PUT', - params: data - }) -} - -// 查询用户个人信息 -export function getUserProfile() { - return request({ - url: '/system/user/profile/get', - method: 'GET' - }) -} - -// 修改用户个人信息 -export function updateUserProfile(data) { - return request({ - url: '/system/user/profile/update', - method: 'PUT', - data: data - }) -} - -// 用户头像上传 -export function uploadAvatar(data) { - return upload({ - url: '/system/user/profile/update-avatar', - method: 'PUT', - name: data.name, - filePath: data.filePath - }) -} diff --git a/api/user.js b/api/user.js new file mode 100644 index 0000000..ea2bf8f --- /dev/null +++ b/api/user.js @@ -0,0 +1,8 @@ +import request from '@/utils/request' +// 归还人员 +export function getReverterUser(){ + return request({ + url: '/system/user/list-all-simple', + 'method': 'GET' + }) +} diff --git a/config.js b/config.js index 962673a..a734e96 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ // 应用全局配置 module.exports = { - baseUrl: process.env.NODE_ENV === 'development' ? 'http://localhost:12080' : 'http://dev.ccwin-in.com:25200/api', + baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.1.18:12080' : 'http://dev.ccwin-in.com:12080/api', baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api', // 应用信息 appInfo: { diff --git a/manifest.json b/manifest.json index 2970939..d70ff56 100644 --- a/manifest.json +++ b/manifest.json @@ -39,7 +39,8 @@ "dSYMs" : false }, "sdkConfigs" : { - "ad" : {} + "ad" : {}, + "push" : {} } } }, diff --git a/pages.json b/pages.json index 8298c29..4e380bd 100644 --- a/pages.json +++ b/pages.json @@ -2,41 +2,50 @@ "pages": [{ "path": "pages/index", "style": { - "navigationBarTitleText": "首页" + "navigationBarTitleText": "首页", + "navigationStyle": "custom" + } + },{ + "path": "pages/login", + "style": { + "navigationStyle": "custom" + } + },{ + "path": "pages/inLocation/index", + "style": { + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#409eff", + "navigationBarTextStyle": "white" + } + },{ + "path": "pages/inLocation/addForm", + "style": { + "navigationBarTitleText": "入库信息", + "navigationBarBackgroundColor": "#409eff", + "navigationBarTextStyle": "white" + } + },{ + "path": "pages/sparePartsReturn/addForm", + "style": { + "navigationBarTitleText": "备件归还", + "navigationBarBackgroundColor": "#409eff", + "navigationBarTextStyle": "white" + } + },{ + "path": "pages/outLocation/index", + "style": { + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#409eff", + "navigationBarTextStyle": "white" + } + },{ + "path": "pages/outLocation/addForm", + "style": { + "navigationBarTitleText": "出库信息", + "navigationBarBackgroundColor": "#409eff", + "navigationBarTextStyle": "white" } }], - // "tabBar": { - // "color": "#8f9bb3", - // "selectedColor": "#409eff", - // "borderStyle": "white", - // "backgroundColor": "#ffffff", - // "list": [{ - // "pagePath": "pages/index", - // "iconPath": "static/images/tabbar/tab_icon1.png", - // "selectedIconPath": "static/images/tabbar/tab_act_icon1.png", - // "text": "首页" - // }, { - // "pagePath": "pages/device/index", - // "iconPath": "static/images/tabbar/tab_icon2.png", - // "selectedIconPath": "static/images/tabbar/tab_act_icon2.png", - // "text": "设备" - // }, { - // "pagePath": "pages/mold/index", - // "iconPath": "static/images/tabbar/tab_icon3.png", - // "selectedIconPath": "static/images/tabbar/tab_act_icon3.png", - // "text": "模具" - // }, { - // "pagePath": "pages/spareParts/index", - // "iconPath": "static/images/tabbar/tab_icon4.png", - // "selectedIconPath": "static/images/tabbar/tab_act_icon4.png", - // "text": "备件" - // }, { - // "pagePath": "pages/mine/index", - // "iconPath": "static/images/tabbar/tab_icon5.png", - // "selectedIconPath": "static/images/tabbar/tab_act_icon5.png", - // "text": "我的" - // }] - // }, "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "RuoYi", diff --git a/pages/inLocation/addForm.vue b/pages/inLocation/addForm.vue new file mode 100644 index 0000000..14693da --- /dev/null +++ b/pages/inLocation/addForm.vue @@ -0,0 +1,502 @@ + + + + + \ No newline at end of file diff --git a/pages/inLocation/index.vue b/pages/inLocation/index.vue new file mode 100644 index 0000000..34efc8c --- /dev/null +++ b/pages/inLocation/index.vue @@ -0,0 +1,145 @@ + + + + + \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index b775629..9d96c21 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -3,134 +3,68 @@ - - - - - {{counts.allCount || 0}} - 设备总数 + + + + + - - {{counts.breakDownCount || 0}} - 故障中设备 - - - {{counts.repairCount || 0}} - 已报修设备 + + - - - {{counts1.gongdan || 0}} - 待接单 - - - {{counts1.yanzheng || 0}} - 待验证 + + + + + - - {{counts1.shenpi || 0}} - 待审核 + + - - 设备维护 + + 采购入库 - - - 设备报修 - - - - - - 维修工单 - - - - - - 检修工单 + + + 采购入库 - - - 点检工单 - - - - - - 保养工单 + + + 备件归还 + - - 模具维护 + + 出库 - - - 设备报修 - - - - - - 维修工单 - - - - - - 检修工单 - - - - - - 保养工单 + + + 领用出库 - 备件管理 - - - - - 领用申请审批 - - - - - - 领用申请 - - - - - - 维修工单 - - - - + 退出登录 @@ -150,32 +84,35 @@ data() { return { bgOpacity: 0, - counts: '', - counts1: '', + token: '', } }, methods: { open(url) { + if(!this.token){ + this.$tab.navigateTo('/pages/login') + return + } this.$tab.navigateTo(url) }, - getCounts() { - getCounts().then(res => { - this.counts = res.data + handleLogout() { + this.$modal.confirm('确定注销并退出系统吗?').then(() => { + this.$store.dispatch('LogOut').then(() => { + this.$tab.reLaunch('/pages/login') + }) }) }, - getToDoCountsByUser() { - getToDoCountsByUser().then(res => { - this.counts1 = res.data - }) + handleLogin() { + console.log(11) + this.$tab.navigateTo('/pages/login') }, }, onLoad: async function() { - if (getAccessToken()) { - this.getCounts() - this.getToDoCountsByUser() - } -console.log( this.$store.state) + // if (getAccessToken()) { + // } + this.token = getAccessToken() ? getAccessToken() :'' + console.log( this.$store.state) }, onPageScroll(e) { if (e.scrollTop > 0) { @@ -201,86 +138,59 @@ console.log( this.$store.state) position: relative; image { - height: calc(var(--status-bar-height) + 410rpx); + height: calc(var(--status-bar-height) + 310rpx); } } - .top-box { + .info { position: absolute; - width: 100%; - bottom: 0px; - - .number { - padding: 30rpx 80rpx 50rpx; - display: flex; - align-items: center; - justify-content: space-between; - - .number-item { - text-align: center; - - view { - &:nth-child(1) { - color: white; - font-size: 40rpx; - font-weight: bold; - } - - &:nth-child(2) { - color: rgba(255, 255, 255, 0.7); - font-size: 28rpx; - margin-top: 10rpx; - } + top: calc(var(--status-bar-height) + 110rpx); + left: 80rpx; + right: 80rpx; + display: flex; + align-items: center; + .cu-avatar { + border: 4rpx solid #eaeaea; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + + .icon { + font-size: 80rpx; } } - } - - .status { - margin: 0px 40rpx; - padding: 40rpx 0rpx; - background: white; - border-radius: 20rpx 20rpx 0px 0px; - display: flex; - align-items: center; - justify-content: space-between; - - .status-item { - text-align: center; - position: relative; - flex: 1; - - view { - &:nth-child(1) { - color: black; - font-size: 40rpx; - font-weight: bold; - } - - &:nth-child(2) { - color: rgba(0, 0, 0, 0.5); + + .user-info { + margin-left: 30rpx; + + .name { + line-height: 60rpx; + font-size: 36rpx; + font-weight: bold; + line-height: 60rpx; + margin-right: 20rpx; + color: white; + + span { + font-weight: normal; font-size: 28rpx; - margin-top: 10rpx; + padding-left: 20rpx; } } - - &::after { - content: ""; - border-right: 1px solid #dedede; - position: absolute; - height: 60rpx; - right: 0px; - top: 50%; - margin-top: -30rpx; - - } - - &:nth-last-child(1)::after { - border: none; + + .tips { + padding: 10rpx 20rpx; + background: #3952ae; + color: white; + border-radius: 50rpx; + font-size: 24rpx; + display: inline-block; + } } - } + } - + .box { .title { font-size: 32rpx; @@ -306,4 +216,15 @@ console.log( this.$store.state) } } } + .btn { + width: calc(100vw - 60rpx); + margin: 30rpx auto; + background-color: rgb(64, 158, 255); + color: #FFFFFF; + height: 90rpx; + line-height: 90rpx; + text-align: center; + border-radius: 10rpx; + font-size: 32rpx; + } \ No newline at end of file diff --git a/pages/login.vue b/pages/login.vue index fc3cfb2..606a614 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -29,11 +29,11 @@ - + @@ -101,8 +101,10 @@ // 设置用户信息 await this.$store.dispatch('GetPermissionInfo').then(res => { // this.$tab.reLaunch('/pages/index') + console.log(res) }) await this.$store.dispatch('GetInfo').then(res => { + console.log(res) this.$tab.reLaunch('/pages/index') }) } diff --git a/pages/outLocation/addForm.vue b/pages/outLocation/addForm.vue new file mode 100644 index 0000000..d3ecd9f --- /dev/null +++ b/pages/outLocation/addForm.vue @@ -0,0 +1,479 @@ + + + + + \ No newline at end of file diff --git a/pages/outLocation/index.vue b/pages/outLocation/index.vue new file mode 100644 index 0000000..4c4bf9f --- /dev/null +++ b/pages/outLocation/index.vue @@ -0,0 +1,161 @@ + + + + + \ No newline at end of file diff --git a/pages/sparePartsReturn/addForm.vue b/pages/sparePartsReturn/addForm.vue new file mode 100644 index 0000000..4d5818e --- /dev/null +++ b/pages/sparePartsReturn/addForm.vue @@ -0,0 +1,478 @@ + + + + + \ No newline at end of file diff --git a/plugins/index.js b/plugins/index.js index efbae15..8f5d204 100644 --- a/plugins/index.js +++ b/plugins/index.js @@ -1,6 +1,7 @@ import tab from './tab' import auth from './auth' import modal from './modal' +import time from './time' export default { install(Vue) { @@ -10,5 +11,7 @@ export default { Vue.prototype.$auth = auth // 模态框对象 Vue.prototype.$modal = modal + // 时间对象 + Vue.prototype.$time = time } } diff --git a/plugins/time.js b/plugins/time.js new file mode 100644 index 0000000..9f8a11c --- /dev/null +++ b/plugins/time.js @@ -0,0 +1,19 @@ +export default { + formatDate(timestamp){ + // 获取当前时间戳(单位:毫秒) + // var timestamp = Date.now(); // 或者传入特定的时间戳值 + timestamp = timestamp ? timestamp :Date.now() + // 创建Date对象并设置时间戳 + var dateObj = new Date(timestamp); + + // 提取年份、月份、日期等信息 + var year = dateObj.getFullYear(); + var month = (dateObj.getMonth() + 1).toString().padStart(2, '0'); // 注意月份从0开始计数,所以需要加1 + var day = dateObj.getDate().toString().padStart(2, '0'); + var hour = dateObj.getHours().toString().padStart(2, '0'); + var minutes = dateObj.getMinutes().toString().padStart(2, '0'); + var seconds = dateObj.getSeconds().toString().padStart(2, '0'); + + return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}` + } +} diff --git a/static/images/icon1.png b/static/images/icon1.png new file mode 100644 index 0000000..a2ffd47 Binary files /dev/null and b/static/images/icon1.png differ diff --git a/static/images/icon2.png b/static/images/icon2.png new file mode 100644 index 0000000..eedf475 Binary files /dev/null and b/static/images/icon2.png differ diff --git a/static/images/icon3.png b/static/images/icon3.png new file mode 100644 index 0000000..e640911 Binary files /dev/null and b/static/images/icon3.png differ diff --git a/store/modules/user.js b/store/modules/user.js index 7d03c1a..c105cd8 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -1,98 +1,160 @@ import config from '@/config' import storage from '@/utils/storage' import constant from '@/utils/constant' -import { login, logout, getInfo } from '@/api/login' -import { setToken, removeToken } from '@/utils/auth' +import { + login, + logout, + getInfo, + getPermissionInfo +} from '@/api/login' +import { + setToken, + removeToken +} from '@/utils/auth' const baseUrl = config.baseUrl const user = { - state: { - id: 0, // 用户编号 - name: storage.get(constant.name), - avatar: storage.get(constant.avatar), - roles: storage.get(constant.roles), - permissions: storage.get(constant.permissions) - }, + state: { + id: 0, // 用户编号 + name: storage.get(constant.name), + avatar: storage.get(constant.avatar), + roles: storage.get(constant.roles), + permissions: storage.get(constant.permissions), + role:storage.get(constant.role), + post:storage.get(constant.post), + dept:storage.get(constant.dept), + }, - mutations: { - SET_ID: (state, id) => { - state.id = id - }, - SET_NAME: (state, name) => { - state.name = name - storage.set(constant.name, name) - }, - SET_AVATAR: (state, avatar) => { - state.avatar = avatar - storage.set(constant.avatar, avatar) - }, - SET_ROLES: (state, roles) => { - state.roles = roles - storage.set(constant.roles, roles) - }, - SET_PERMISSIONS: (state, permissions) => { - state.permissions = permissions - storage.set(constant.permissions, permissions) - } - }, + mutations: { + SET_ID: (state, id) => { + state.id = id + }, + SET_NAME: (state, name) => { + state.name = name + storage.set(constant.name, name) + }, + SET_AVATAR: (state, avatar) => { + state.avatar = avatar + storage.set(constant.avatar, avatar) + }, + SET_ROLES: (state, roles) => { + state.roles = roles + storage.set(constant.roles, roles) + }, + SET_PERMISSIONS: (state, permissions) => { + state.permissions = permissions + storage.set(constant.permissions, permissions) + }, + SET_ROLE: (state, role) => { + state.role = role + storage.set(constant.role, role) + }, + SET_DEPT: (state, dept) => { + state.dept = dept + storage.set(constant.dept, dept) + }, + SET_POST: (state, post) => { + state.post = post + storage.set(constant.post, post) + } + }, - actions: { - // 登录 - Login({ commit }, userInfo) { - const username = userInfo.username.trim() - const password = userInfo.password - const captchaVerification = userInfo.captchaVerification - return new Promise((resolve, reject) => { - login(username, password, captchaVerification).then(res => { - res = res.data; - // 设置 token - setToken(res) - resolve() - }).catch(error => { - reject(error) - }) - }) - }, + actions: { + // 登录 + Login({ + commit + }, userInfo) { + const username = userInfo.username.trim() + const password = userInfo.password + const captchaVerification = userInfo.captchaVerification + const tenantName = userInfo.tenantName + const rememberMe = userInfo.rememberMe + const code = userInfo.code + const uuid = userInfo.uuid + return new Promise((resolve, reject) => { + login(username, password, captchaVerification, tenantName, rememberMe, code, uuid).then( + res => { + res = res.data; + // 设置 token + setToken(res) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, - // 获取用户信息 - GetInfo({ commit, state }) { - return new Promise((resolve, reject) => { - getInfo().then(res => { - res = res.data; // 读取 data 数据 - const user = res.user - const avatar = (user == null || user.avatar === "" || user.avatar == null) ? require("@/static/images/profile.jpg") : user.avatar - const nickname = (user == null || user.nickname === "" || user.nickname == null) ? "" : user.nickname - if (res.roles && res.roles.length > 0) { - commit('SET_ROLES', res.roles) - commit('SET_PERMISSIONS', res.permissions) - } else { - commit('SET_ROLES', ['ROLE_DEFAULT']) - } - commit('SET_NAME', nickname) - commit('SET_AVATAR', avatar) - resolve(res) - }).catch(error => { - reject(error) - }) - }) - }, - - // 退出系统 - LogOut({ commit, state }) { - return new Promise((resolve, reject) => { - logout(state.token).then(() => { - commit('SET_ROLES', []) - commit('SET_PERMISSIONS', []) - removeToken() - storage.clean() - resolve() - }).catch(error => { - reject(error) - }) - }) - } - } + // 获取权限 + GetPermissionInfo({ + commit, + state + }) { + return new Promise((resolve, reject) => { + getPermissionInfo().then(res => { + res = res.data; // 读取 data 数据 + const user = res.user + const avatar = (user == null || user.avatar === "" || user.avatar == null) ? + require("@/static/images/profile.jpg") : user.avatar + const nickname = (user == null || user.nickname === "" || user.nickname == + null) ? "" : user.nickname + if (res.roles && res.roles.length > 0) { + commit('SET_ROLES', res.roles) + commit('SET_ROLE', res.roles.filter(item => item == 'all_approve' || item == 'normal_approve')[0]) + commit('SET_PERMISSIONS', res.permissions) + } else { + commit('SET_ROLES', ['ROLE_DEFAULT']) + commit('SET_ROLE','') + } + commit('SET_NAME', nickname) + commit('SET_AVATAR', avatar) + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, +// 获取权限 + GetInfo({ + commit, + state + }) { + return new Promise((resolve, reject) => { + getInfo().then(res => { + res = res.data; // 读取 data 数据 + commit('SET_DEPT', res.dept) + if (res.posts && res.posts.length > 0) { + commit('SET_POST', res.posts.filter(item => item.code == 'worker' || item.code == 'engineer')[0]) + } else { + commit('SET_POST','') + } + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + // 退出系统 + LogOut({ + commit, + state + }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_ROLES', []) + commit('SET_PERMISSIONS', []) + commit('SET_POST', '') + commit('SET_CLASSTYPE', '') + commit('SET_ROLE', '') + removeToken() + storage.clean() + resolve() + }).catch(error => { + reject(error) + }) + }) + } + } } -export default user +export default user \ No newline at end of file diff --git a/utils/constant.js b/utils/constant.js index 8becd84..7b877d4 100644 --- a/utils/constant.js +++ b/utils/constant.js @@ -2,7 +2,9 @@ const constant = { avatar: 'vuex_avatar', name: 'vuex_name', roles: 'vuex_roles', - permissions: 'vuex_permissions' + permissions: 'vuex_permissions', + role: 'vuex_role', + dept: 'vuex_dept', + post: 'vuex_post', } - export default constant diff --git a/utils/storage.js b/utils/storage.js index dd5c38b..6965cfb 100644 --- a/utils/storage.js +++ b/utils/storage.js @@ -4,7 +4,7 @@ import constant from './constant' let storageKey = 'storage_data' // 存储节点变量名 -let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions] +let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions, constant.role, constant.dept,constant.post] // 存储的数据 let storageData = uni.getStorageSync(storageKey) || {}