Browse Source

2024-05-14 修改该报工为form表单,否则数据不刷新

master_hella_20240701
zhousq 6 months ago
parent
commit
59d135839f
  1. 95
      src/views/mes/workScheduling/components/report.vue

95
src/views/mes/workScheduling/components/report.vue

@ -7,33 +7,33 @@
width="600px"
>
<template #title>{{ dialogTitle }} </template>
<el-form ref="formRef">
<el-form-item label="工序" v-model="processCode">
<el-input v-model="processCode" disabled />
<el-form :model="form">
<el-form-item label="工序">
<el-input v-model="form.processCode" disabled />
</el-form-item>
<el-form-item label="选择人员">
<el-select v-model="personSelected" multiple>
<el-select v-model="form.personSelected" multiple>
<el-option v-for="item in personOption" :key="item.workerCode" :label="item.workerName" :value="item.workerCode" />
</el-select>
</el-form-item>
<el-form-item label="报工数量">
<el-input-number v-model="reportCount" @change="handleCount" :key="count"></el-input-number>
<el-input-number v-model="form.reportCount" @change="handleCount" :key="count"></el-input-number>
</el-form-item>
<el-form-item label="工时">
<el-input-number v-model="workTerm"></el-input-number>
<el-input-number v-model="form.workTerm"></el-input-number>
</el-form-item>
<el-form-item label="是否已质检">
<el-switch v-model="checkFlag" active-value="true"> </el-switch>
<el-switch v-model="form.checkFlag" active-value="true"> </el-switch>
</el-form-item>
<el-form-item label="合格数量" @change="handleCount" :key="qcount">
<el-input-number
v-model="qualified"
:disabled="!checkFlag"
v-model="form.qualified"
:disabled="!form.checkFlag"
@change="handleCount"
></el-input-number>
</el-form-item>
<el-form-item label="不合格数量">
<el-input-number disabled v-model="unqualified"></el-input-number>
<el-input-number disabled v-model="form.unqualified"></el-input-number>
</el-form-item>
</el-form>
@ -54,24 +54,32 @@ const dialogVisible = ref(false)
const dialogTitle = ref()
const formLoading = ref(false)
const personOption=ref([])
const processCode = ref()
const personSelected = ref()
const checkFlag = ref(false)
const unqualified = ref()
const reportCount = ref()
const qualified = ref()
const workTerm = ref()
const saveFlag=ref(false)
const planDayCode=ref()
const formRef=ref()
const form = reactive({
processCode:"",
reportCount:0,
workTerm:0,
checkFlag:"FALSE",
personSelected:[],
qualified:0,
unqualified:0
})
const openDetail = async (row: any, titleName: any,code:string) => {
rowData.value = row
//console.log('row-68',row)
dialogVisible.value = true
dialogTitle.value = titleName
processCode.value=row.nodeCode
form.processCode=row.nodeCode
form.personSelected=[]
form.reportCount=0,
form.workTerm=0,
form.checkFlag="FALSE",
form.personSelected=[],
form.qualified=0,
form.unqualified=0
planDayCode.value=code
getCurrentWorkerList(processCode.value)
getCurrentWorkerList(row.nodeCode)
}
@ -85,54 +93,55 @@ const getCurrentWorkerList = async (val) => {
personOption.value = await workschedulingApi.getCurrentWorkerList(params)
}
const count = ref(0)
const qcount = ref(1)
//
const handleCount = (val) => {
if (reportCount.value> rowData.value.planCount) {
const handleCount = () => {
if (form.reportCount> rowData.value.planCount) {
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】')
reportCount.value =rowData.value.planCount
form.reportCount =rowData.value.planCount
//tableData.value[index].reportCount =rowData.value.planCount
count.value++
//count.value++
return
}
//message.alert(row.checkFlag==true?'1':'2')
if (checkFlag.value) {
if (reportCount.value < qualified.value) {
if (form.checkFlag) {
if (form.reportCount < form.qualified) {
message.alert('合格数不能超出报工数!')
qualified.value=reportCount.value
qcount.value++
form.qualified=form.reportCount
//qcount.value++
return
}
if (qualified.value == undefined || qualified.value == 0) {
qualified.val = reportCount.value
qcount.value++
if (form.qualified == undefined || form.qualified == 0) {
form.qualified= form.reportCount
//qcount.value++
}
unqualified.value= reportCount.value- qualified.value
form.unqualified= form.reportCount- form.qualified
}
}
//
const saveReport = async() => {
let listSub=[{}]
personSelected.value.forEach((item) => {
let listSub=[];
form.personSelected.forEach((item) => {
let data={
reportCount: formRef.value.reportCount,
workTerm: formRef.value.workTerm,
reportPerson: formRef.value.item,
qualified: formRef.value.qualified,
unqualified: formRef.value.unqualified
reportCount: form.reportCount,
workTerm: form.workTerm,
checkFlag: form.checkFlag,
reportPerson: item,
qualified: form.qualified,
unqualified: form.unqualified
}
listSub.push(data)
})
let data = {
reportDate: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
schedulingCode: rowData.value.schedulingCode,
processCode: processCode.value,
processCode: form.processCode,
list: listSub
}
console.log("report-saveReport-137",data)
saveFlag.value = true
try {
await workschedulingApi.reportWorkByProcess(data)

Loading…
Cancel
Save