diff --git a/src/api/eam/eam.js b/src/api/eam/eam.js index 1fb50ed..a62e375 100644 --- a/src/api/eam/eam.js +++ b/src/api/eam/eam.js @@ -251,3 +251,5 @@ export const updateFeedMatter = data => createAPI(`/pms/eam/updateFeedMatter`,'p export const deleteFeedMatter = data => createAPI(`/pms/eam/deleteFeedMatter`,'post',data) export const getOperatorListByOrder = data => createAPI(`/pms/eam/getOperatorListByOrder`,'post',data) + +export const checkWorkOrders = data => createAPI(`/pms/eam/checkWorkOrders`,'post',data) diff --git a/src/views/modules/eam/eamWorkOrderForCheck.vue b/src/views/modules/eam/eamWorkOrderForCheck.vue index a3e7d59..e79bd74 100644 --- a/src/views/modules/eam/eamWorkOrderForCheck.vue +++ b/src/views/modules/eam/eamWorkOrderForCheck.vue @@ -23,9 +23,10 @@ + + - - + @@ -63,7 +64,8 @@ - 查询 + 查询 + 批量审核 { - this.height = window.innerHeight - 180 + this.height = window.innerHeight - 212 }) }, @@ -1263,6 +1256,7 @@ // 获取数据列表 getDataList () { + this.searchLoading = true this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex eamWorkOrderSearch(this.searchData).then(({data}) => { @@ -1271,7 +1265,12 @@ this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount + this.searchLoading = false + } else { + this.searchLoading = false } + }).catch(() => { + this.searchLoading = false }) }, @@ -1295,6 +1294,7 @@ // 审核按钮 checkModal () { + let mesUser = this.$store.state.user.name this.submitData.site = this.saveData.site this.submitData.buNo = this.saveData.buNo this.submitData.orderNo = this.saveData.orderNo @@ -1303,11 +1303,7 @@ this.submitData.checker = this.saveData.checker this.submitData.checkerName = this.saveData.checkerName this.submitData.status = this.saveData.status - let tempData = { - site: this.$store.state.user.site, - mesUser: this.$store.state.user.name - } - if (!this.submitData.checker.split(';').includes(tempData.mesUser)) { + if (!this.submitData.checker.split(';').includes(mesUser)) { this.$message.warning('审核人员与计划不符!') return } @@ -1333,7 +1329,6 @@ }) } }) - }).catch(() => { }) } else if (this.submitData.status === '待审核') { this.$confirm(`是否确认审核?`, '提示', { @@ -1357,11 +1352,68 @@ }) } }) - }).catch(() => { }) } }, + // 批量审核按钮 + checkModals () { + let tempData1 = '' // 记录不是待审核的单号 + let tempData2 = '' // 记录审核人员不符的单号 + let mesUser = this.$store.state.user.name + if (this.dataListSelections.length === 0) { + this.$message.warning('请勾选要审核的工单!') + return + } + for (let i = 0; i < this.dataListSelections.length; i++) { + if (this.dataListSelections[i].status !== '待审核') { + tempData1 = tempData1 + this.dataListSelections[i].orderNo + '、' + } + if (!this.dataListSelections[i].checker.split(';').includes(mesUser)) { + tempData2 = tempData2 + this.dataListSelections[i].orderNo + '、' + } + } + if (tempData1 !== '') { + tempData1 = tempData1.substring(0, tempData1.length - 1) + this.$message.warning('工单编码 [' + tempData1 + '] 不是待审核状态!') + return + } + if (tempData2 !== '') { + tempData2 = tempData2.substring(0, tempData2.length - 1) + this.$message.warning('工单编码 [' + tempData2 + '] 审核人员与计划不符!') + return + } + this.$confirm(`是否确认审核?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.checkLoading = true + let tempData = { + informationList: this.dataListSelections + } + checkWorkOrders(tempData).then(({data}) => { + if (data && data.code === 0) { + this.getDataList() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + this.checkLoading = false + } else { + this.checkLoading = false + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }).catch(() => { + this.checkLoading = false + }) + }) + }, + // 确认审核 submitModel () { if (this.submitData.difficultyLevel === ''||this.submitData.difficultyLevel == null) { @@ -1488,12 +1540,12 @@ }) }, - selectFlag (row,index) { - if (row.status !== '未开工') { - return false - }else { + selectFlag (row, index) { + // if (row.status !== '未开工') { + // return false + // } else { return true - } + // } }, changeModel () { diff --git a/src/views/modules/eam/eamWorkOrderForMaintenance.vue b/src/views/modules/eam/eamWorkOrderForMaintenance.vue index cf92c12..bc079fe 100644 --- a/src/views/modules/eam/eamWorkOrderForMaintenance.vue +++ b/src/views/modules/eam/eamWorkOrderForMaintenance.vue @@ -23,9 +23,10 @@ + + - - + @@ -63,8 +64,9 @@ - 查询 - + 查询 + 批量审核 + { - this.height = window.innerHeight - 180 + this.height = window.innerHeight - 212 }) }, @@ -1238,6 +1231,7 @@ // 获取数据列表 getDataList () { + this.searchLoading = true this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex eamWorkOrderSearch(this.searchData).then(({data}) => { @@ -1246,7 +1240,12 @@ this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount + this.searchLoading = false + } else { + this.searchLoading = false } + }).catch(() => { + this.searchLoading = false }) }, @@ -1326,11 +1325,11 @@ }, selectFlag (row,index) { - if (row.status !== '未开工') { - return false - } else { + // if (row.status !== '未开工') { + // return false + // } else { return true - } + // } }, changeModel () { @@ -1411,6 +1410,7 @@ // 审核按钮 checkModal () { + let mesUser = this.$store.state.user.name this.submitData.site = this.saveData.site this.submitData.buNo = this.saveData.buNo this.submitData.orderNo = this.saveData.orderNo @@ -1419,16 +1419,9 @@ this.submitData.checker = this.saveData.checker this.submitData.checkerName = this.saveData.checkerName this.submitData.status = this.saveData.status - let tempData = { - site: this.$store.state.user.site, - mesUser: this.$store.state.user.name - } - if (!this.submitData.checker.split(';').includes(tempData.mesUser)){ - this.$alert('审核人员与计划不符!', '错误', { - confirmButtonText: '确定', - type: 'warning' - }) - return false + if (!this.submitData.checker.split(';').includes(mesUser)){ + this.$message.warning('审核人员与计划不符!') + return } if (this.submitData.status === '已完工') { this.$confirm(`是否取消审核?`, '提示', { @@ -1438,7 +1431,7 @@ }).then(() => { checkWorkOrder(this.submitData).then(({data}) => { if (data && data.code === 0) { - this.getDataList(); + this.getDataList() this.saveData.status = '待审核' this.$message({ message: '操作成功', @@ -1452,7 +1445,6 @@ }) } }) - }).catch(() => { }) } else if (this.submitData.status === '待审核') { this.$confirm(`是否确认审核?`, '提示', { @@ -1477,45 +1469,68 @@ }) } }) - }).catch(() => { }) - // selectNameByMes(tempData).then(({data}) => { - // if (data.rows[0].adminName != this.submitData.checkerName){ - // this.$alert('审核人员与计划不符!', '错误', { - // confirmButtonText: '确定', - // type: 'warning' - // }) - // return false - // }else { - // this.$confirm(`是否确认审核?`, '提示', { - // confirmButtonText: '确定', - // cancelButtonText: '取消', - // type: 'warning' - // }).then(() => { - // checkWorkOrder(this.submitData).then(({data}) => { - // if (data && data.code === 0) { - // this.getDataList(); - // this.detailModelFlag = false; - // this.$message({ - // message: '操作成功', - // type: 'success', - // duration: 1500, - // onClose: () => { - // } - // }) - // } else { - // this.$alert(data.msg, '错误', { - // confirmButtonText: '确定' - // }) - // } - // }) - // }).catch(() => { - // }) - // } - // }) } }, + // 批量审核按钮 + checkModals () { + let tempData1 = '' // 记录不是待审核的单号 + let tempData2 = '' // 记录审核人员不符的单号 + let mesUser = this.$store.state.user.name + if (this.dataListSelections.length === 0) { + this.$message.warning('请勾选要审核的工单!') + return + } + for (let i = 0; i < this.dataListSelections.length; i++) { + if (this.dataListSelections[i].status !== '待审核') { + tempData1 = tempData1 + this.dataListSelections[i].orderNo + '、' + } + if (!this.dataListSelections[i].checker.split(';').includes(mesUser)) { + tempData2 = tempData2 + this.dataListSelections[i].orderNo + '、' + } + } + if (tempData1 !== '') { + tempData1 = tempData1.substring(0, tempData1.length - 1) + this.$message.warning('工单编码 [' + tempData1 + '] 不是待审核状态!') + return + } + if (tempData2 !== '') { + tempData2 = tempData2.substring(0, tempData2.length - 1) + this.$message.warning('工单编码 [' + tempData2 + '] 审核人员与计划不符!') + return + } + this.$confirm(`是否确认审核?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.checkLoading = true + let tempData = { + informationList: this.dataListSelections + } + checkWorkOrders(tempData).then(({data}) => { + if (data && data.code === 0) { + this.getDataList() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + this.checkLoading = false + } else { + this.checkLoading = false + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }).catch(() => { + this.checkLoading = false + }) + }) + }, + // 获取用户角色 getUserRoleList () { getUserRoleList().then(({data}) => {