Browse Source

排班信息功能优化

java8
赵宏斌 6 months ago
parent
commit
07cd96e76d
  1. 4
      src/views/modules/eam/eamFeedBack.vue
  2. 214
      src/views/modules/scheduling/scheduling.vue

4
src/views/modules/eam/eamFeedBack.vue

@ -413,7 +413,7 @@
<el-option
v-for = "i in classesList"
:key = "i.code"
:label = "i.description"
:label = "i.code+' '+i.description"
:value = "i.code">
</el-option>
</el-select>
@ -1856,6 +1856,8 @@
} else {
this.operatorData.roleId = ''
}
//
this.$set(this.operatorData,'classesCode','')
//bu
this.getClassesList()
//

214
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 {
<el-row :gutter="10">
<el-col :span="span">
<el-form-item label="BU" prop="bu" >
<el-select v-model="queryParams.bu" placeholder="请选择" clearable style="width: 221px">
<el-select v-model="queryParams.bu" placeholder="请选择" clearable @change="BUChanged()" style="width: 221px">
<el-option
v-for = "i in userBuList"
:key = "i.buNo"
@ -718,7 +801,7 @@ export default {
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag title="新增班次" :visible.sync="saveSchedulingFlag" width="420px">
<el-form :inline="true" label-position="top">
<el-form-item label="BU" prop="bu" >
<el-select v-model="saveData.bu" placeholder="请选择" style="width: 221px">
<el-select v-model="saveData.bu" placeholder="请选择" @change="insertBUChanged()" style="width: 221px">
<el-option
v-for = "i in userBuList"
:key = "i.buNo"
@ -734,9 +817,9 @@ export default {
<el-form-item label="班次">
<el-select v-model="saveData.classesCode" placeholder="请选择" clearable >
<el-option
v-for = "i in classesList"
v-for = "i in classesList2"
:key = "i.code"
:label = "i.description"
:label = "i.code+' '+i.description"
:value = "i.code">
</el-option>
</el-select>
@ -880,7 +963,7 @@ export default {
</div>
</el-main>
<el-main style="width: 400px;padding: 0px">
<span style="font-size: 12px">已有人员</span>
<span style="font-size: 12px">选中人员</span>
<el-table
height="400px"
:data="itemList2"
@ -919,24 +1002,65 @@ export default {
</el-footer>
</el-dialog>
<el-dialog title="编辑" :close-on-click-modal="false" :close-on-press-escape="false" v-drag :visible.sync="editFlag" width="420px">
<el-dialog :title="initFlag?'新增':'编辑'" :close-on-click-modal="false" :close-on-press-escape="false" v-drag :visible.sync="editFlag" width="420px">
<el-form :inline="true" label-position="top">
<el-form-item label="人员编码" prop="adminID">
<span style="cursor: pointer" v-if="initFlag" slot="label" @click="getPeopleList"><a>计划维修人员</a></span>
<el-button type="primary" v-if="initFlag" @click="getPeopleList">新增</el-button>
<el-form-item label="人员编码" prop="adminID" v-if="!initFlag">
<el-input v-model="schedulingRecordData.adminId" disabled style="width: 221px"></el-input>
</el-form-item>
<el-form-item label="人员名称">
<el-form-item label="人员名称" v-if="!initFlag">
<el-input v-model="schedulingRecordData.adminName" disabled style="width: 221px"></el-input>
</el-form-item>
<el-form-item label="是否请假">
<el-form-item label="是否请假" v-if="!initFlag">
<el-select filterable v-model="schedulingRecordData.isHoliday" style="width: 100px">
<el-option label="Y" value="Y"></el-option>
<el-option label="N" value="N"></el-option>
<el-option label="请假" value="Y"></el-option>
<el-option label="工作" value="N"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-table
v-if="initFlag"
:height="300"
:data="peopleList2"
v-loading="queryLoading"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in column_people" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column label="是否请假" align="center" width="100">
<template slot-scope="scope">
<el-select filterable v-model="scope.row.isHoliday" style="width: 100px">
<el-option label="请假" value="Y"></el-option>
<el-option label="工作" value="N"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="80"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="deletePeopleList2(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="editFlag = false">取消</el-button>
<el-button @click="editFlag = false;initFlag=false">取消</el-button>
<el-button type="primary" @click="editSureCancel()">确定</el-button>
</span>
</el-dialog>

Loading…
Cancel
Save