diff --git a/src/views/modules/eam/eamFeedBack.vue b/src/views/modules/eam/eamFeedBack.vue index a06a58d..59cdbb0 100644 --- a/src/views/modules/eam/eamFeedBack.vue +++ b/src/views/modules/eam/eamFeedBack.vue @@ -413,7 +413,7 @@ @@ -1856,6 +1856,8 @@ } else { this.operatorData.roleId = '' } + //先清空班次信息 + this.$set(this.operatorData,'classesCode','') //根据bu查询班次信息 this.getClassesList() // 查询人员 diff --git a/src/views/modules/scheduling/scheduling.vue b/src/views/modules/scheduling/scheduling.vue index a551461..05a5285 100644 --- a/src/views/modules/scheduling/scheduling.vue +++ b/src/views/modules/scheduling/scheduling.vue @@ -47,6 +47,7 @@ export default { initFlag: false, schedulingRecordData:{}, peopleList:[], + peopleList2:[], itemList1: [], itemList2: [], roleList: [], @@ -74,6 +75,7 @@ export default { activeName:'detail', userBuList: [], classesList: [], + classesList2: [], dataList: [], dataListHead:[], queryLoading: false, @@ -192,24 +194,6 @@ export default { fixed: '', columnWidth: 80 }, - { - userId: this.$store.state.user.name, - functionId: 200101107, - serialNumber: '200101107Table1createBy', - tableId: '200101107Table1', - tableName: '备品备件采购表', - columnProp: 'site', - headerAlign: 'center', - align: 'left', - columnLabel: '工厂编号', - columnHidden: false, - columnImage: false, - columnSortable: false, - sortLv: 0, - status: true, - fixed: '', - columnWidth: 80 - }, { userId: this.$store.state.user.name, functionId: 200101107, @@ -296,12 +280,39 @@ export default { this.fastAddFlag = true }, // 获取机修人员列表 - getOperatorList () { + async getOperatorList () { this.detailData.bu = '2_01-Label' + //默认查询 角色:机修人员 + let filterList = this.roleList.filter(item => item.roleName === '机修人员') + if (filterList.length > 0) { + this.detailData.roleId = filterList[0].roleId + } // 查询人员 - getOperatorList(this.detailData).then(({data}) => { + await getOperatorList(this.detailData).then(({data}) => { if (data && data.code === 0) { this.itemList1 = data.rows + let arrAdminId = [] + if (this.initFlag){ + this.dataList.forEach(data => { + arrAdminId.push(data.adminId) + }) + } else { + this.peopleList.forEach(data => { + arrAdminId.push(data.adminID) + }) + } + this.itemList1 = this.itemList1.filter(item => + !arrAdminId.includes(item.adminID) + ) + if (this.itemList2.length > 0){ + arrAdminId = [] + this.itemList2.forEach(data => { + arrAdminId.push(data.adminID) + }) + this.itemList1 = this.itemList1.filter(item => + !arrAdminId.includes(item.adminID) + ) + } // this.itemList1.forEach(val => { // // 回显选中的人员 // if (tempDataList.includes(val.adminID)) { @@ -315,6 +326,54 @@ export default { } }) }, + BUChanged(){ + let split = this.queryParams.bu.split('_') + let params; + if (split.length < 2){ + params = { + site: null, + buNo: null + } + }else { + params = { + site: split[0], + buNo: split[1] + } + } + getClassesList(params).then(({data}) => { + if (data.code === 0) { + this.classesList = data.rows + } else { + this.$message.warning(data.msg) + } + }).catch((error)=>{ + this.$message.error(error) + }) + }, + insertBUChanged(){ + let split = this.saveData.bu.split('_') + let params; + if (split.length < 2){ + params = { + site: null, + buNo: null + } + }else { + params = { + site: split[0], + buNo: split[1] + } + } + getClassesList(params).then(({data}) => { + if (data.code === 0) { + this.classesList2 = data.rows + } else { + this.$message.warning(data.msg) + } + }).catch((error)=>{ + this.$message.error(error) + }) + }, getClassesList() { let params = { site: null, @@ -389,14 +448,19 @@ export default { this.$message.warning('请选择可选人员!') return } - if (this.insertSchedulingFlag){ - if (this.itemSelections1.length > 1) { - this.$message.warning('请选择一个人员!') - return - } - this.schedulingRecordData.adminId = this.itemSelections1[0].adminID - this.schedulingRecordData.adminName = this.itemSelections1[0].adminName + let arrAdminId = [] + this.itemSelections1.forEach(data => { + arrAdminId.push(data.adminID) + }) + this.itemList1 = this.itemList1.filter(item => + !arrAdminId.includes(item.adminID) + ); + if (this.insertSchedulingFlag) { + this.peopleList2 = this.itemSelections1 this.itemList2 = this.itemSelections1 + this.peopleList2.forEach(row => { + row.isHoliday = 'N'; // 默认选中第一个选项 + }); } else { this.itemList2 = this.itemSelections1 this.peopleList = this.itemSelections1 @@ -429,12 +493,10 @@ export default { this.$message.warning('请选择已有人员!') return } - if (this.insertSchedulingFlag){ - this.schedulingRecordData.adminId = '' - this.schedulingRecordData.adminName = '' - } + this.itemList1.push(...this.itemSelections2) this.itemList2 = this.itemList2.filter(item => !this.itemSelections2.includes(item)) this.peopleList = this.itemList2 + this.peopleList2 = this.itemList2 }, deletePeopleList(row){ this.peopleList = this.peopleList.filter(item => row.adminID != item.adminID); @@ -442,6 +504,7 @@ export default { saveScheduling(){ this.saveData = {} this.peopleList = [] + this.classesList2 = [] this.saveSchedulingFlag = true; }, async saveHeaderFunction(){ @@ -461,6 +524,10 @@ export default { this.$message.warning("请选择结束日期") return } + if (this.saveData.endDate < this.saveData.startDate){ + this.$message.warning("结束日期不能小于开始日期") + return + } this.queryLoading= true; let tempData = { ...this.saveData, @@ -510,13 +577,28 @@ export default { this.editFlag = true }, editSureCancel(){ - editSaveSchedulingRecord(this.schedulingRecordData).then(({data})=>{ + if (this.schedulingRecordData.adminId == null || this.schedulingRecordData.adminId === ''){ + if (this.peopleList2.length<1){ + this.$message.warning("请选择新增人员") + return + } + } + let params = { + ...this.schedulingRecordData, + peopleList : this.peopleList2 + } + editSaveSchedulingRecord(params).then(({data})=>{ this.$message.success(data.msg) }) this.handleQuery() + this.changeData(this.queryLineRow) this.editFlag = false this.schedulingRecordData = {} }, + deletePeopleList2(row){ + this.peopleList2 = this.peopleList2.filter(item => row.adminID != item.adminID); + this.itemList2 = this.peopleList2 + }, deleteCancel(row){ this.$confirm('确定删除该条记录吗?',{ confirmButtonText: '确定', @@ -552,6 +634,7 @@ export default { isHoliday: 'N', headId: this.queryLineRow.id } + this.peopleList2 = [] this.initFlag = true this.editFlag = true }, @@ -591,7 +674,7 @@ export default { - + - + @@ -880,7 +963,7 @@ export default { - 已有人员: + 选中人员: - + - - 计划维修人员 + 新增 + - + - + - - + + + + + + + + + + + + + - 取消 + 取消 确定