zhousq
7 months ago
8 changed files with 321 additions and 14 deletions
@ -0,0 +1,121 @@ |
|||
<template> |
|||
<Dialog |
|||
:title="dialogTitle" |
|||
v-model="dialogVisible" |
|||
:close-on-click-modal="true" |
|||
:vLoading="formLoading" |
|||
> |
|||
<template #title>{{ dialogTitle }}</template> |
|||
<el-form> |
|||
<el-form-item label="当前工序"> |
|||
<el-input v-model="currentProcess" disabled></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="选择人员"> |
|||
<el-select v-model="personSelected"> |
|||
<el-option v-for="item in personData" :key="item.workerCode" :label="item.workerName" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="报工数量"> |
|||
<el-input-number v-model="reportCount" @change="handleCount"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="工时"> |
|||
<el-input-number v-model="workTerm"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="是否已质检"> |
|||
<el-switch v-model="checkFlag" active-value="true"> </el-switch> |
|||
</el-form-item> |
|||
<el-form-item label="合格数量"> |
|||
<el-input-number |
|||
v-model="qualified" |
|||
:disabled="!checkFlag" |
|||
@change="handleCount" |
|||
></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="不合格数量"> |
|||
<el-input-number disabled v-model="unqualified"></el-input-number> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<template #footer |
|||
><el-button @click="dialogVisible = false">关闭</el-button> |
|||
<el-button type="primary" @click="saveReport">保存</el-button></template |
|||
> |
|||
</Dialog> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { Dialog } from '@/components/Dialog' |
|||
import * as workschedulingApi from '@/api/mes/workScheduling' |
|||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|||
import dayjs from 'dayjs' |
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
const { wsCache } = useCache() |
|||
const rowData = ref() |
|||
const dialogVisible = ref(false) |
|||
const dialogTitle = ref() |
|||
const formLoading = ref(false) |
|||
const personSelected = ref() |
|||
const currentProcess = ref() |
|||
const personData = ref([{ value: '', label: '' }]) |
|||
const reportCount = ref() |
|||
const qualified = ref() |
|||
const checkFlag = ref(false) |
|||
const unqualified = ref(0) |
|||
const workTerm = ref() |
|||
const user = wsCache.get(CACHE_KEY.USER) |
|||
const handleCount = () => { |
|||
if (reportCount.value > rowData.value.planCount) { |
|||
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】') |
|||
reportCount.value =rowData.value.planCount |
|||
return |
|||
} |
|||
|
|||
if (checkFlag) { |
|||
if (reportCount.value < qualified.value) { |
|||
message.alert('合格数不能超出报工数!') |
|||
return |
|||
} |
|||
if (qualified.value == undefined || qualified.value == 0) { |
|||
qualified.value = reportCount.value |
|||
} |
|||
unqualified.value = reportCount.value - qualified.value |
|||
} |
|||
} |
|||
const openDetail = (row: any, titleName: any) => { |
|||
//console.log('workscheduling-finishReport-60', user) |
|||
currentProcess.value = row.workingNode |
|||
rowData.value = row |
|||
dialogVisible.value = true |
|||
dialogTitle.value = titleName |
|||
getCurrentWorkerList(row) |
|||
} |
|||
const getCurrentWorkerList = async (row) => { |
|||
let params = { |
|||
planDayCode: row.planMasterCode, |
|||
processCode: row.workingNode |
|||
} |
|||
personData.value = await workschedulingApi.getCurrentWorkerList(params) |
|||
} |
|||
//提交报工 |
|||
const saveReport = () => { |
|||
let data = { |
|||
reportDate: dayjs(new Date()).format('YYYY-MM-DD HH:mm:sss'), |
|||
schedulingCode: rowData.value.schedulingCode, |
|||
processCode: currentProcess.value, |
|||
list: [ |
|||
{ |
|||
reportCount: reportCount.value, |
|||
workTerm: workTerm.value, |
|||
reportPerson: personSelected.value, |
|||
qualified: qualified.value, |
|||
unqualified: unqualified.value |
|||
} |
|||
] |
|||
} |
|||
workschedulingApi.completeHandle(data) |
|||
} |
|||
// 传递给父类 |
|||
const emit = defineEmits(['success', 'close']) |
|||
|
|||
defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗 |
|||
</script> |
@ -0,0 +1,137 @@ |
|||
<template> |
|||
<Dialog |
|||
:title="dialogTitle" |
|||
v-model="dialogVisible" |
|||
:close-on-click-modal="true" |
|||
:vLoading="formLoading" |
|||
> |
|||
<template #title>{{ dialogTitle }}</template> |
|||
<el-form> |
|||
<el-form-item label="选择工序"> |
|||
<el-select v-model="processCodeSelected" @change="processChange" value-key="processCode"> |
|||
<el-option v-for="item in processOption" :key="item.processCode" :label="item.processName" :value="item.processCode" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="选择人员"> |
|||
<el-select v-model="personSelected"> |
|||
<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"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="工时"> |
|||
<el-input-number v-model="workTerm"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="是否已质检"> |
|||
<el-switch v-model="checkFlag" active-value="true"> </el-switch> |
|||
</el-form-item> |
|||
<el-form-item label="合格数量"> |
|||
<el-input-number |
|||
v-model="qualified" |
|||
:disabled="!checkFlag" |
|||
@change="handleCount" |
|||
></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="不合格数量"> |
|||
<el-input-number disabled v-model="unqualified"></el-input-number> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<template #footer> |
|||
<el-button @click="dialogVisible = false">关闭</el-button> |
|||
<el-button type="primary" @click="saveReport">保存</el-button> |
|||
</template> </Dialog |
|||
>+ |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { Dialog } from '@/components/Dialog' |
|||
import * as workschedulingApi from '@/api/mes/workScheduling' |
|||
import dayjs from 'dayjs' |
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
const rowData = ref() |
|||
const openDetail = async (row: any, titleName: any) => { |
|||
rowData.value = row |
|||
dialogVisible.value = true |
|||
dialogTitle.value = titleName |
|||
getProcessList(row) |
|||
} |
|||
const dialogVisible = ref(false) |
|||
const dialogTitle = ref() |
|||
const formLoading = ref(false) |
|||
const processOption = ref([]) |
|||
const personOption=ref([]) |
|||
const processCodeSelected = ref() |
|||
const personSelected = ref() |
|||
const checkFlag = ref(false) |
|||
const unqualified = ref() |
|||
const reportCount = ref() |
|||
const qualified = ref() |
|||
const workTerm = ref() |
|||
//获取工序列表 |
|||
const getProcessList=async(row)=>{ |
|||
let params={ |
|||
planDayCode:row.planMasterCode, |
|||
schedulingCode:row.schedulingCode |
|||
} |
|||
processOption.value=await workschedulingApi.getProcessList(params) |
|||
} |
|||
const processChange=(val:any)=>{ |
|||
console.log("processChange-81",val) |
|||
getCurrentWorkerList(val) |
|||
} |
|||
//获取工序人员 |
|||
const getCurrentWorkerList = async (val) => { |
|||
console.log("personOption-91",val) |
|||
let params = { |
|||
planDayCode: rowData.value.planMasterCode, |
|||
processCode: val |
|||
} |
|||
personOption.value = await workschedulingApi.getCurrentWorkerList(params) |
|||
|
|||
} |
|||
//报工数量处理 |
|||
const handleCount = () => { |
|||
if (reportCount.value > rowData.value.planCount) { |
|||
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】') |
|||
reportCount.value =rowData.value.planCount |
|||
return |
|||
} |
|||
|
|||
if (checkFlag) { |
|||
if (reportCount.value < qualified.value) { |
|||
message.alert('合格数不能超出报工数!') |
|||
return |
|||
} |
|||
if (qualified.value == undefined || qualified.value == 0) { |
|||
qualified.value = reportCount.value |
|||
} |
|||
|
|||
unqualified.value = reportCount.value - qualified.value |
|||
} |
|||
} |
|||
//提交报工 |
|||
const saveReport = () => { |
|||
let data = { |
|||
reportDate: dayjs(new Date()).format('YYYY-MM-DD HH:mm:sss'), |
|||
schedulingCode: rowData.value.schedulingCode, |
|||
processCode: processCodeSelected.value, |
|||
list: [ |
|||
{ |
|||
reportCount: reportCount.value, |
|||
workTerm: workTerm.value, |
|||
reportPerson: personSelected.value, |
|||
qualified: qualified.value, |
|||
unqualified: unqualified.value |
|||
} |
|||
] |
|||
} |
|||
//console.log("report-saveReport-82",data) |
|||
workschedulingApi.reportWorkByProcess(data) |
|||
} |
|||
// 传递给父类 |
|||
const emit = defineEmits(['success', 'close']) |
|||
|
|||
defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗 |
|||
</script> |
Loading…
Reference in new issue