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

Loading…
Cancel
Save