Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
zhaoxuebing 4 months ago
parent
commit
f0b3189311
  1. 105
      src/views/mes/workScheduling/components/report.vue

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

@ -4,9 +4,59 @@
v-model="dialogVisible"
:close-on-click-modal="true"
:vLoading="formLoading"
width="fit-content"
>
<template #title>{{ dialogTitle }}</template>
<el-form>
<template #title>{{ dialogTitle }} </template>
<el-button type="primary" @click="addRow" style="float:right;;">添加</el-button>
<el-table :data="tableData" style="border: 1px;stripe; width:1300px ;" >
<el-table-column prop="processName" label="工序名称" width="200px">
<template #default="scope">
<el-select v-model="scope.row.processCodeSelected" @change="processChange" value-key="processCode">
<el-option v-for="item in processOption" :key="item.processCode" :label="item.processName" :value="item.processCode" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="reportName" label="报工人" width="200px">
<template #default="scope">
<el-select v-model="scope.row.personSelected" multiple :value-key="workerCode">
<el-option v-for="item in personOption" :key="item.workerCode" :label="item.workerName" :value="item.workerCode" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="reportCount" label="报工数量" width="200px" >
<template #default="scope">
<el-input-number v-model="scope.row.reportCount" @change="handleCount(scope.row)" :key="count"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="workTerm" label="工时" width="200px" >
<template #default="scope">
<el-input-number v-model="scope.row.workTerm"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="checkFlag" label="已质检" width="80px" >
<template #default="scope">
<el-switch inactive-value="false" v-model="scope.row.checkFlag" ></el-switch>
</template>
</el-table-column>
<el-table-column prop="qualified" label="合格数" width="200px" >
<template #default="scope" >
<el-input-number v-model="scope.row.qualified" @change="handleCount(scope.row)" :key="qcount" :disabled="scope.row.checkFlag=='false'" ></el-input-number>
</template>
</el-table-column>
<el-table-column prop="unqualified" label="不合格数" width="100px">
<template #default="scope">
<el-input v-model="scope.row.unqualified" disabled="true">{{scope.row.unqualified= scope.row.reportCount -scope.row.qualified}}</el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="100px">
<template #default="scope">
<el-button type="text" @click="deleteRow(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- <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" />
@ -36,13 +86,13 @@
<el-form-item label="不合格数量">
<el-input-number disabled v-model="unqualified"></el-input-number>
</el-form-item>
</el-form>
</el-form> -->
<template #footer>
<el-button @click="dialogVisible = false">关闭</el-button>
<el-button type="primary" :disabled="saveFlag" @click="saveReport">保存</el-button>
</template> </Dialog
>+
>
</template>
<script lang="ts" setup>
import { Dialog } from '@/components/Dialog'
@ -56,6 +106,7 @@ const openDetail = async (row: any, titleName: any) => {
dialogVisible.value = true
dialogTitle.value = titleName
getProcessList(row)
}
const dialogVisible = ref(false)
const dialogTitle = ref()
@ -70,6 +121,20 @@ const reportCount = ref()
const qualified = ref()
const workTerm = ref()
const saveFlag=ref(false)
const tableData=ref([{}])
const addRow=()=>{
tableData.value.push({
processCode:processCodeSelected.value,
processName:processOption.value?.find(item=>item.processCode==processCodeSelected.value)?.processName,
reportName:personOption.value?.find(item=>item.workerCode==personSelected.value)?.workerName,
reportCount:reportCount.value,
workTerm:workTerm.value,
checkFlag:checkFlag.value})
}
const deleteRow = (index: number) => {
tableData.value.splice(index, 1)
}
//
const getProcessList=async(row)=>{
let params={
@ -79,12 +144,12 @@ const getProcessList=async(row)=>{
processOption.value=await workschedulingApi.getProcessList(params)
}
const processChange=(val:any)=>{
console.log("processChange-81",val)
//console.log("processChange-81",val)
getCurrentWorkerList(val)
}
//
const getCurrentWorkerList = async (val) => {
console.log("personOption-91",val)
//console.log("personOption-91",val)
let params = {
planDayCode: rowData.value.planMasterCode,
processCode: val
@ -92,25 +157,31 @@ console.log("personOption-91",val)
personOption.value = await workschedulingApi.getCurrentWorkerList(params)
}
const count = ref(0)
const qcount = ref(1)
//
const handleCount = () => {
if (reportCount.value > rowData.value.planCount) {
const handleCount = (row) => {
if (row.reportCount > rowData.value.planCount) {
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】')
reportCount.value =rowData.value.planCount
row.reportCount =rowData.value.planCount
//tableData.value[index].reportCount =rowData.value.planCount
count.value++
return
}
if (checkFlag.value) {
if (reportCount.value < qualified.value) {
//message.alert(row.checkFlag==true?'1':'2')
if (row.checkFlag) {
if (row.reportCount < row.qualified) {
message.alert('合格数不能超出报工数!')
qualified.value=0
row.qualified=row.reportCount
qcount.value++
return
}
if (qualified.value == undefined || qualified.value == 0) {
qualified.value = reportCount.value
if (row.qualified == undefined || row.qualified == 0) {
row.qualified = row.reportCount
qcount.value++
}
unqualified.value = reportCount.value - qualified.value
row.unqualified= row.reportCount- row.qualified
}
}
//

Loading…
Cancel
Save