ruanqi 1 year ago
parent
commit
072312f751
  1. 18935
      package-lock.json
  2. 9
      src/api/production/production.js
  3. 581
      src/views/modules/product/operatorGroup.vue

18935
package-lock.json
File diff suppressed because it is too large
View File

9
src/api/production/production.js

@ -0,0 +1,9 @@
import { createAPI } from "@/utils/httpRequest.js";
export const getOperatorGroup = data => createAPI(`/operatorGroup/getOperatorGroup`,'Post',data)
export const getOperatorGroupPlanHeader = data => createAPI(`/operatorGroup/getOperatorGroupPlanHeader`,'Post',data)
export const getOperatorGroupPlanDetail = data => createAPI(`/operatorGroup/getOperatorGroupPlanDetail`,'Post',data)
export const getOperatorGroupDefault = data => createAPI(`/operatorGroup/getOperatorGroupDefault`,'Post',data)
export const saveOperatorGroupDetail= data => createAPI(`/operatorGroup/saveOperatorGroupDetail`,'Post',data)

581
src/views/modules/product/operatorGroup.vue

@ -0,0 +1,581 @@
<template>
<div class="mod-config">
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
<el-form-item :label="'操作员组ID'">
<el-input v-model="searchData.operatorID" style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'分组名称'">
<el-input v-model="searchData.operatorName" style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button @click="getData()" type="primary" style="">查询</el-button>
<el-button @click="newDetail()" type="primary" style="">新增班次调度</el-button>
</el-form-item>
</el-form>
<el-table
:height="height"
:data="dataList"
@row-click="changeData"
border
highlight-current-row
ref="mainTable"
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList" :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="20%"
: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-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- width="150"-->
<!-- label="操作">-->
<!-- <template slot-scope="scope">-->
<!-- <a type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</a>-->
<!-- <a type="text" size="small" @click="deleteHandle(scope.row.id)">删除</a>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<div style="float: left;margin-top: 5px" :style="{ width: width + 'px' }">
<label>日期/班次列表</label>
<el-table
:height="height"
:data="dataList2"
@row-click="changeData2"
border
highlight-current-row
ref="headerTable"
v-loading="dataListLoading"
style="width: 98%;">
<el-table-column
v-for="(item,index) in columnList2" :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="20%"
: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
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</a>
<a type="text" size="small" @click="deleteHandle(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
</div>
<div style="float: left;margin-top: 5px" :style="{ width: width + 'px' }">
<label>操作员出勤列表</label>
<el-table
:height="height"
:data="dataList3"
border
highlight-current-row
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList3" :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="20%"
: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-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- width="150"-->
<!-- label="操作">-->
<!-- <template slot-scope="scope">-->
<!-- <a type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</a>-->
<!-- <a type="text" size="small" @click="deleteHandle(scope.row.id)">删除</a>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</div>
<el-dialog
width="800px" v-drag
:title="'分配工作时间'"
:close-on-click-modal="false"
:visible.sync="detailModelFlag">
<el-form :inline="true" label-position="top" label-width="100px" >
<el-form-item :label="'日期'">
<el-date-picker
style="width: 130px"
v-model="detailData.workDate"
type="date"
:disabled="detailData.updateFlag"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
<!-- <el-input v-model="detailData.shiftno" style="width: 130px" :disabled="detailData.updateFlag"></el-input>-->
</el-form-item>
<el-form-item :label="'总工作时间'">
<el-input v-model="detailData.allTime" style="width: 130px" disabled></el-input>
</el-form-item>
<el-form-item :label="'工资时间'">
<el-input v-model="detailData.wagesTime" style="width: 130px" disabled></el-input>
</el-form-item>
</el-form>
<div >
<el-table
height="250"
:data="detailList"
border
ref="toolTable"
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList3" :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">
<div v-if="(item.columnProp !== 'wagesRate')&&(item.columnProp !== 'workTime')">
<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>
</div>
<div v-else-if=" (item.columnProp === 'wagesRate')">
<el-input v-model="scope.row.wagesRate" type="number" @change="changeSum(scope.row)" placeholder="请输入工资系数"
style="width:98%"></el-input>
</div>
<div v-else>
<el-input v-model="scope.row.workTime" type="number" @change="changeSum(scope.row)" placeholder="请输入工资系数"
style="width:98%"></el-input>
</div>
</template>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer" style="height: 40px">
<el-button type="primary" @click="saveDetail()">{{'保存'}}</el-button>
<el-button type="primary" @click="detailModelFlag = false" >{{'取消'}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
getOperatorGroup,getOperatorGroupPlanHeader,getOperatorGroupPlanDetail,
getOperatorGroupDefault,saveOperatorGroupDetail
} from "@/api/production/production.js"
export default {
name: "operatorGroup",
data() {
return {
height: 200,
width:200,
dataList:[],
dataList2:[],
dataList3:[],
dataListLoading: false,
headerData:{},
searchData:{
// site:this.$store.state.user.site,
operatorID:'',
operatorName:'',
},
currentRow:{
site:'',
OperatorGroupId:''
},
currentRow2:{
site:'',
planId:''
},
columnList: [
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table1OperatorID',
tableId: "302001Table1",
tableName: "操作员组清单",
columnProp: 'operatorID',
headerAlign: "center",
align: "left",
columnLabel: '操作组编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table1OperatorName',
tableId: "302001Table1",
tableName: "操作员组清单",
columnProp: 'operatorName',
headerAlign: "center",
align: "left",
columnLabel: '操作组名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table1Department',
tableId: "302001Table1",
tableName: "操作员组清单",
columnProp: 'department',
headerAlign: "center",
align: "left",
columnLabel: '车间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
],
columnList2: [
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table2WorkDate',
tableId: "302001Table2",
tableName: "操作员组清单",
columnProp: 'workDate',
headerAlign: "center",
align: "left",
columnLabel: '日期',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table2Shiftdesc',
tableId: "302001Table2",
tableName: "操作员组清单",
columnProp: 'shiftdesc',
headerAlign: "center",
align: "left",
columnLabel: '班次',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60,
},
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table2Department',
tableId: "302001Table2",
tableName: "操作员组清单",
columnProp: 'allTime',
headerAlign: "center",
align: "right",
columnLabel: '总时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60,
},
// {
// userId: this.$store.state.user.name,
// functionId: 302001,
// serialNumber: '302001Table2WagesTime',
// tableId: "302001Table2",
// tableName: "",
// columnProp: 'wagesTime',
// headerAlign: "center",
// align: "right",
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 60,
// },
],
columnList3: [
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table3OperatorName',
tableId: "302001Table3",
tableName: "操作员组清单",
columnProp: 'operatorName',
headerAlign: "center",
align: "left",
columnLabel: '操作员姓名',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table3QorkTime',
tableId: "302001Table3",
tableName: "操作员组清单",
columnProp: 'workTime',
headerAlign: "center",
align: "right",
columnLabel: '工作时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60,
},
{
userId: this.$store.state.user.name,
functionId: 302001,
serialNumber: '302001Table3WagesRate',
tableId: "302001Table3",
tableName: "操作员组清单",
columnProp: 'wagesRate',
headerAlign: "center",
align: "right",
columnLabel: '工资系数',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60,
},
],
detailModelFlag:false,
detailList:[],
detailData:{
site:'',
updateFlag:false,
id:'',
workDate:'',
operatorGroupId:'',
shiftno:'',
allTime:'',
wagesTime:'',
detailList:'',
}
}
},
mounted() {
this.$nextTick(() => {
this.height = (window.innerHeight - 240)/2;
this.width=(window.innerWidth-260)/2
})
},
methods: {
changeData(row){
this.currentRow.site=row.site
this.currentRow.OperatorGroupId=row.operatorID
this.getGroupPlanHeaderData();
},
getData(){
getOperatorGroup(this.searchData).then(({data}) => {
if (data && data.code === 0) {
this.dataList=data.rows
if(this.dataList.length>0){
this.$refs.mainTable.setCurrentRow(this.dataList[0]);
this.changeData(this.dataList[0])
}else {
this.changeData({
site:'',
operatorID:''
},)
}
}
})
},
getGroupPlanHeaderData(){
getOperatorGroupPlanHeader(this.currentRow).then(({data}) => {
if (data && data.code === 0) {
this.dataList2=data.rows
if(this.dataList2.length>0){
this.$refs.headerTable.setCurrentRow(this.dataList2[0]);
this.changeData2(this.dataList2[0])
}else {
this.changeData2({
site:'',
id:''
},)
}
}
})
},
changeSum(){
let number1=0
let number2=0
for (let i = 0; i < this.detailList.length; i++) {
number1+=this.detailList[i].workTime?this.detailList[i].workTime:0
if(this.detailList[i].workTime!=null&&this.detailList[i].workTime!==0&&this.detailList[i].wagesRate!=null&&this.detailList[i].wagesRate!==0){
number2+=this.detailList[i].workTime*this.detailList[i].wagesRate
}
}
this.detailData.allTime=number1
this.detailData.wagesTime=number2
},
changeData2(row){
this.currentRow2.site=row.site
this.currentRow2.planId=row.id
this.getGroupPlanDetailData();
},
getGroupPlanDetailData(){
getOperatorGroupPlanDetail(this.currentRow2).then(({data}) => {
if (data && data.code === 0) {
this.dataList3=data.rows
}
})
},
addOrUpdateHandle(row){
getOperatorGroupPlanDetail(this.currentRow2).then(({data}) => {
if (data && data.code === 0) {
this.detailList=data.rows
}
})
let data=JSON.parse(JSON.stringify(row))
this. detailData={
updateFlag:true,
id:data.id,
operatorGroupId:this.currentRow.operatorID,
workDate:data.workDate,
shiftno:data.shiftno,
allTime:data.allTime,
wagesTime:data.wagesTime,
detailList:[],
}
this.detailModelFlag=true
},
newDetail(){
if(!this.currentRow){
this.$alert("请先选择操作组", '错误', {
confirmButtonText: '确定'
})
return false;
}
this. detailData={
site:this.currentRow.site,
id:null,
operatorGroupId:this.currentRow.operatorID,
updateFlag:false,
workDate:this.dayjs().format("YYYY-MM-DD"),
shiftno:"",
allTime:0,
wagesTime:0,
detailList:[],
}
this.detailModelFlag=true
getOperatorGroupDefault(this.currentRow).then(({data}) => {
if (data && data.code === 0) {
this.detailList=data.rows
}
})
},
saveDetail(){
if(this.detailData.workDate==""||this.detailData.workDate==null){
this.$alert("请先选择日期", '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.detailData.workDate==""||this.detailData.workDate==null){
this.$alert("请先选择日期", '错误', {
confirmButtonText: '确定'
})
return false;
}
this.detailData.detailList=this.detailList
saveOperatorGroupDetail(this.currentRow).then(({data}) => {
if (data && data.code === 0) {
this.getGroupPlanHeaderData();
this.detailModelFlag=false
this.$message.success('操作成功')
}else {
this.$message.error(data.msg)
}
})
},
},
created() {
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save