diff --git a/api/location.js b/api/location.js new file mode 100644 index 0000000..9057a7b --- /dev/null +++ b/api/location.js @@ -0,0 +1,8 @@ +import request from '@/utils/request' +// 获取库位 +export function getLocation(number) { + return request({ + url: '/eam/location/scanCodeByNumber?number='+number, + 'method': 'GET', + }) +} diff --git a/api/repairOrder.js b/api/repairOrder.js index 5c16629..a4f9b8b 100644 --- a/api/repairOrder.js +++ b/api/repairOrder.js @@ -17,7 +17,7 @@ export function repairOrderUpdate(data) { data }) } -// 报修列表 +// 工单列表 export function repairOrderPage(params) { return request({ url: '/eam/device-maintenance-main/getAppPage', diff --git a/api/sparePartsApplicationApprove.js b/api/sparePartsApplicationApprove.js new file mode 100644 index 0000000..4f4a9df --- /dev/null +++ b/api/sparePartsApplicationApprove.js @@ -0,0 +1,24 @@ +import request from '@/utils/request' + +// 备件领用审批列表 +export function sparePartsApplicationApprovePage(params) { + return request({ + url: '/eam/item-apply-main/getAppApprovePage', + 'method': 'GET', + params + }) +} +// 通过申请 +export function sparePartsApplicationAgree(id) { + return request({ + url: '/eam/item-apply-main/agree?id='+id, + 'method': 'GET' + }) +} +// 驳回申请 +export function sparePartsApplicationReject(id) { + return request({ + url: '/eam/item-apply-main/disAgree?id='+id, + 'method': 'GET' + }) +} diff --git a/api/sparePartsServiceWorkOrderList.js b/api/sparePartsServiceWorkOrderList.js index 84578ad..9a5951a 100644 --- a/api/sparePartsServiceWorkOrderList.js +++ b/api/sparePartsServiceWorkOrderList.js @@ -8,3 +8,11 @@ export function sparePartsServiceWorkOrderListCreate(data) { data }) } +// 备件维修列表 +export function sparePartsServiceWorkOrderListPage(params) { + return request({ + url: '/eam/item-maintenance/getAppPage', + 'method': 'GET', + params + }) +} \ No newline at end of file diff --git a/pages.json b/pages.json index 69edb03..c04471e 100644 --- a/pages.json +++ b/pages.json @@ -189,6 +189,13 @@ "navigationBarBackgroundColor": "#409eff", "navigationBarTextStyle": "white" } + },{ + "path": "pages/sparePartsApplication/mySparePartsApplication", + "style": { + "navigationBarTitleText": "我的领用", + "navigationBarBackgroundColor": "#409eff", + "navigationBarTextStyle": "white" + } },{ "path": "pages/sparePartsServiceWorkOrderList/addForm", "style": { @@ -196,6 +203,20 @@ "navigationBarBackgroundColor": "#409eff", "navigationBarTextStyle": "white" } + },{ + "path": "pages/sparePartsServiceWorkOrderList/mySparePartsService", + "style": { + "navigationBarTitleText": "我的备件维修", + "navigationBarBackgroundColor": "#409eff", + "navigationBarTextStyle": "white" + } + },{ + "path": "pages/sparePartsApplicationApprove/index", + "style": { + "navigationBarTitleText": "领用申请审批", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } }], "tabBar": { "color": "#8f9bb3", diff --git a/pages/deviceReport/myDeviceReport.vue b/pages/deviceReport/myDeviceReport.vue index e1b0892..66d4f2f 100644 --- a/pages/deviceReport/myDeviceReport.vue +++ b/pages/deviceReport/myDeviceReport.vue @@ -4,15 +4,13 @@ - - + {{item.describes}} - {{`${$time.formatDate(item.createTime)}`}} @@ -33,10 +31,10 @@ - + diff --git a/pages/index.vue b/pages/index.vue index 63d0d3e..b775629 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -42,69 +42,81 @@ - 设备维护 - - - - - 设备报修 - - - - - - 维修工单 - - - - - - 检修工单 - - - - - - 点检工单 - - - - - - 保养工单 - - - - 模具维护 + + 设备维护 + + + + + 设备报修 + + + + + + 维修工单 + + + + + + 检修工单 + + + + + + 点检工单 + + + + + + 保养工单 + + + + + + + + 模具维护 + + + + + 设备报修 + + + + + + 维修工单 + + + + + + 检修工单 + + + + + + 保养工单 + + + + + 备件管理 - - - - 设备报修 - - - - - - 维修工单 - - - - - - 检修工单 - - - - - - 保养工单 + + + + 领用申请审批 - - 备件管理 - - + 领用申请 @@ -130,14 +142,16 @@ getCounts, getToDoCountsByUser } from '@/api/index' - import { getAccessToken } from '@/utils/auth' + import { + getAccessToken + } from '@/utils/auth' export default { data() { return { bgOpacity: 0, - counts:'', - counts1:'' + counts: '', + counts1: '', } }, @@ -145,38 +159,23 @@ open(url) { this.$tab.navigateTo(url) }, - getInfo() { - getInfo().then(res => { - console.log((res)) - uni.setStorageSync('user', res.data) - }) - }, - getPermissionInfo() { - this.$store.dispatch('GetPermissionInfo').then(res => { - - }) - }, getCounts() { getCounts().then(res => { - console.log((res)) this.counts = res.data }) }, getToDoCountsByUser() { getToDoCountsByUser().then(res => { - console.log((res)) this.counts1 = res.data }) }, }, - onLoad: function() { + onLoad: async function() { if (getAccessToken()) { - this.getInfo() - this.getPermissionInfo() - this.getCounts() - this.getToDoCountsByUser() + this.getCounts() + this.getToDoCountsByUser() } - +console.log( this.$store.state) }, onPageScroll(e) { if (e.scrollTop > 0) { diff --git a/pages/login.vue b/pages/login.vue index 2889360..fc3cfb2 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -90,15 +90,19 @@ async pwdLogin(captchaParams) { this.$modal.loading("登录中,请耐心等待...") // 执行登录 - this.$store.dispatch('Login', this.loginForm).then(() => { + this.$store.dispatch('Login', this.loginForm).then(async () => { this.$modal.closeLoading() - this.$tab.reLaunch('/pages/index') + await this.loginSuccess() + // this.$tab.reLaunch('/pages/index') }) }, // 登录成功后,处理函数 - loginSuccess(result) { + async loginSuccess(result) { // 设置用户信息 - this.$store.dispatch('GetInfo').then(res => { + await this.$store.dispatch('GetPermissionInfo').then(res => { + // this.$tab.reLaunch('/pages/index') + }) + await this.$store.dispatch('GetInfo').then(res => { this.$tab.reLaunch('/pages/index') }) } diff --git a/pages/mine/index.vue b/pages/mine/index.vue index f9667ee..d70e963 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -45,11 +45,15 @@ 巡检点检 - + + + 领用审批 + + 我的领用 - + 备件维修 @@ -68,12 +72,12 @@ 版本更新 --> - + 退出登录 @@ -125,6 +129,15 @@ handleSpotCheckOrder() { this.$tab.navigateTo('/pages/spotCheckOrder/myOrder') }, + handleSparePartsApplication(){ + this.$tab.navigateTo('/pages/sparePartsApplication/mySparePartsApplication?flag=1') + }, + handleSparePartsApplicationApprove(){ + this.$tab.navigateTo('/pages/sparePartsApplication/mySparePartsApplication?flag=2') + }, + handleSparePartsService(){ + this.$tab.navigateTo('/pages/sparePartsServiceWorkOrderList/mySparePartsService') + }, handleLogout() { this.$modal.confirm('确定注销并退出系统吗?').then(() => { this.$store.dispatch('LogOut').then(() => { diff --git a/pages/repairOrder/detail.vue b/pages/repairOrder/detail.vue index 861d927..ee19489 100644 --- a/pages/repairOrder/detail.vue +++ b/pages/repairOrder/detail.vue @@ -112,7 +112,7 @@ - + 添加维修内容 @@ -121,11 +121,11 @@ - 接单 - 完成 - 验证完结 diff --git a/pages/repairOrder/index.vue b/pages/repairOrder/index.vue index b6baa95..82e2606 100644 --- a/pages/repairOrder/index.vue +++ b/pages/repairOrder/index.vue @@ -4,7 +4,7 @@ @@ -45,7 +45,7 @@ {{`${$time.formatDate(item.createTime)}`}} - + 编辑 diff --git a/pages/repairOrder/myOrder.vue b/pages/repairOrder/myOrder.vue index c1d0874..33610dc 100644 --- a/pages/repairOrder/myOrder.vue +++ b/pages/repairOrder/myOrder.vue @@ -10,7 +10,7 @@ - + {{item.describes}} diff --git a/pages/sparePartsApplication/detail.vue b/pages/sparePartsApplication/detail.vue index e683784..4416495 100644 --- a/pages/sparePartsApplication/detail.vue +++ b/pages/sparePartsApplication/detail.vue @@ -36,19 +36,27 @@ + + + + + + + + + \ No newline at end of file diff --git a/pages/sparePartsApplicationApprove/index.vue b/pages/sparePartsApplicationApprove/index.vue new file mode 100644 index 0000000..903456e --- /dev/null +++ b/pages/sparePartsApplicationApprove/index.vue @@ -0,0 +1,192 @@ + + + + + \ No newline at end of file diff --git a/pages/sparePartsServiceWorkOrderList/addForm.vue b/pages/sparePartsServiceWorkOrderList/addForm.vue index cd15b50..119c317 100644 --- a/pages/sparePartsServiceWorkOrderList/addForm.vue +++ b/pages/sparePartsServiceWorkOrderList/addForm.vue @@ -13,7 +13,12 @@ - + + + + 扫描 + + @@ -42,6 +47,7 @@ import * as sparePartsApi from "@/api/spareParts.js" import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js" import * as dictApi from "@/api/dict.js" + import * as locationApi from "@/api/location.js" export default { @@ -54,13 +60,16 @@ qty: '', result: 'YES', reasons: '', + locationNumber:'', + areaNumber:'' }, sparePartsList: [], singleColumnShow: false, singleColumnDefaultValue: [], singleColumnList: [], field: '', - result: [] + result: [], + isShow:false } }, methods: { @@ -71,6 +80,14 @@ this.$modal.showToast('请选择备件') return; } + if (this.isInAccount == 'TRUE') { + this.$modal.showToast('该库位属于帐内库,请选择帐外库') + return; + } + if (this.itemNumber) { + this.$modal.showToast('该库位已绑定过备件') + return; + } if (!this.form.qty) { this.$modal.showToast(`请输入数量`) return; @@ -86,7 +103,8 @@ this.$modal.confirm('是否添加备件维修工单').then(() => { this.$modal.loading('加载中') this.loading = true - sparePartsServiceWorkOrderListApi.sparePartsServiceWorkOrderListCreate(this.form).then((res) => { + sparePartsServiceWorkOrderListApi.sparePartsServiceWorkOrderListCreate(this.form).then(( + res) => { this.$modal.closeLoading() if (res.data) { this.$modal.showToast('添加成功') @@ -137,12 +155,15 @@ }, // 单列模式点击确定之后 chooseSingleColumn(e) { + console.log(this.field) this.form[this.field] = e[0].value - if (this.field == 'deviceNumber') { + if (this.field == 'itemNumber') { this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value) - this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName - this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber - // this.form.deviceNumber = e[0].value + this.form.locationNumber = this.choosesingleColumnItem[0].locationNumber + this.form.areaNumber = this.choosesingleColumnItem[0].areaNumber + if(!this.choosesingleColumnItem[0].locationNumber){ + this.isShow = true + } } this.singleColumnShow = false this.$emit('singleColumn', this.field, this.form[this.field]) @@ -158,6 +179,27 @@ this.sparePartsList = res.data }) }, + // 扫描设备条码 + chickRightButton(field) { + uni.scanCode({ + success: function(res) { + this.form.locationNumber = res.result + this.getLocation() + } + }); + }, + getLocation(){ + locationApi.getLocation(this.form.locationNumber).then(res=>{ + this.form.areaNumber = res.data.areaNumber; + this.isInAccount = res.data.isInAccount + this.itemNumber = res.data.itemNumber + }) + }, + blur() { + if (this.form.locationNumber) { + this.getLocation() + } + }, }, async onLoad(option) { if (option.type) this.type = option.type; diff --git a/pages/sparePartsServiceWorkOrderList/mySparePartsService.vue b/pages/sparePartsServiceWorkOrderList/mySparePartsService.vue new file mode 100644 index 0000000..eda74b6 --- /dev/null +++ b/pages/sparePartsServiceWorkOrderList/mySparePartsService.vue @@ -0,0 +1,169 @@ + + + + + \ No newline at end of file diff --git a/store/modules/user.js b/store/modules/user.js index 37e7054..097fcee 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -1,102 +1,162 @@ import config from '@/config' import storage from '@/utils/storage' import constant from '@/utils/constant' -import { login, logout, getInfo,getPermissionInfo } 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), + // post:storage.get(constant.posts) && storage.get(constant.posts).filter(item => item.code == 'worker' || item.code == + // 'engineer')[0].code, + classType:storage.get(constant.classType), + }, - 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_CLASSTYPE: (state, classType) => { + state.classType = classType + storage.set(constant.classType, classType) + }, + 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 - 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) - }) - }) - }, + 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) + }) + }) + }, - // 获取权限 - 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_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_CLASSTYPE', res.dept.classType) + if (res.posts && res.posts.length > 0) { + commit('SET_POST', res.posts.filter(item => item.code == 'worker' || item.code == 'engineer')[0].code) + } 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 8bef884..7707f83 100644 --- a/utils/constant.js +++ b/utils/constant.js @@ -3,6 +3,9 @@ const constant = { name: 'vuex_name', roles: 'vuex_roles', permissions: 'vuex_permissions', + role: 'vuex_role', + classType: 'vuex_classType', + posts: 'vuex_posts', } export default constant diff --git a/utils/storage.js b/utils/storage.js index dd3f2c6..70ee541 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,constant.user] +let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions, constant.role, constant.classType,constant.posts] // 存储的数据 let storageData = uni.getStorageSync(storageKey) || {}