Browse Source

2024-05-14工序报工前端修改该,页面优化,

master_hella_20240701
zhousq 6 months ago
parent
commit
0fc1deae43
  1. 6
      src/api/mes/workScheduling/index.ts
  2. 4
      src/api/mes/workSchedulingDetail/index.ts
  3. 68
      src/views/mes/workScheduling/components/Detail.vue
  4. 166
      src/views/mes/workScheduling/components/report.vue
  5. 185
      src/views/mes/workScheduling/components/reportAll.vue
  6. 25
      src/views/mes/workScheduling/index.vue

6
src/api/mes/workScheduling/index.ts

@ -52,10 +52,14 @@ export const importTemplate = () => {
export const completeHandle = async (data) => {
return await request.post({ url: `/mes/workScheduling/completeHandle`, data })
}
//报工
//工序报工
export const reportWorkByProcess = async (data) => {
return await request.post({ url: `/mes/work-scheduling-detail/reportWorkByProcess`, data })
}
//批量报工
export const reportWorkByTask = async (data) => {
return await request.post({ url: `/mes/workScheduling/reportForAll`, data })
}
//检查当前节点是否可以完工
export const getNodePosition = async (params) => {
return await request.get({ url: `/mes/workScheduling/getNodePosition`, params })

4
src/api/mes/workSchedulingDetail/index.ts

@ -63,3 +63,7 @@ export const exportWorkSchedulingDetail = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/mes/work-scheduling-detail/get-import-template' })
}
//工序报工
export const reportWorkByProcess = async (data) => {
return await request.post({ url: `/mes/work-scheduling-detail/reportWorkByProcess`, data })
}

68
src/views/mes/workScheduling/components/Detail.vue

@ -72,7 +72,7 @@
</template> -->
</Table>
<Table
v-if="!isBasic && fromeWhere != 'countPlan'"
v-if="!isBasic"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
@ -80,23 +80,14 @@
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<template #photos="{ row }">
<div
v-for="(item, index) in row.photos.split(',')"
:key="index"
style="color: #409eff; cursor: pointer"
@click="openImage(item)"
>{{ item }}</div
>
</template>
<template #action="{ row }">
<ButtonBase v-if="row.status == '0'"
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
<el-button type="text" v-if="row.status == '0'" @click="buttonClick('pfinished',row)"> 完工</el-button>
<el-button type="text" v-if="row.status == '2'" @click="buttonClick('reprotProcess',row)"> 报工</el-button>
<el-button type="text" v-if="row.status == '4'" @click="buttonClick('checkProcess',row)"> 质检</el-button>
</template>
</Table>
<DetailTable
<!-- <DetailTable
v-if="!isBasic && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
@ -105,13 +96,14 @@
:key="updateKey"
>
<template #action="{ row }">
<ButtonBase v-if="row.status == '0'"
:Butttondata="buttondata"
<ButtonBase
:Butttondata="buttonDetail"
@button-base-click="buttonTableClick($event, row)"
/>
dddddddddd
</template>
</DetailTable>
</DetailTable> -->
</ContentWrap>
<!-- other附件组件:如质检明细 -->
<div
@ -189,6 +181,7 @@
</el-drawer>
<!-- 表格弹窗 -->
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess1" />
<reportProcess ref="refreport" ></reportProcess>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@ -226,6 +219,7 @@ import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { SearchTable } from '@/components/SearchTable'
import * as WorkSchedulingDetailApi from '@/api/mes/workSchedulingDetail'
import reportProcess from '@/views/mes/workScheduling/components/report.vue'
defineOptions({ name: 'Detail' })
const message = useMessage() //
@ -400,7 +394,7 @@ const props = defineProps({
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
const refreport=ref()
if (props.isBasic == true) {
if (tabsList.value && tabsList.value.length > 0) {
tabsList.value.unshift({
@ -554,7 +548,9 @@ const masterParmas = ref({
//
const HeadButttondata = ref()
// -
const buttondata = ref()
const buttondata = ref(
)
/** 表格弹窗 */
const initModel = (schema: FormSchema[], formModel: Recordable) => {
const model: Recordable = { ...formModel }
@ -585,10 +581,13 @@ const searchTableFormType = ref('') // 表单的类型:create - 新增;updat
const formRef = ref()
const titleNameRef = ref()
const titleValueRef = ref()
const planDayCode=ref()
const count = ref(0)
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
planDayCode.value=row.planMasterCode
remarksData.data = {
tableId: row.id,
tableName: tableName
@ -658,12 +657,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
})
]
}
if(row.status == '1'){
props.buttondataTable[0].hide = false
}else{
props.buttondataTable[0].hide = true
}
//console.log("props.buttondataTable-663",props.buttondataTable);
buttondata.value = [...detailButtonEdit, ...detailButtonDelete, ...props.buttondataTable]
} finally {
detailLoading.value = false
@ -671,7 +665,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
}
}
defineExpose({ openDetail, formRef }) // open
//
const getRemarkList = async () => {
detailLoading.value = true
@ -833,14 +826,23 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'delete') {
//
handleDelete(row.id)
} else if (val == 'pfinished') {
WorkSchedulingDetailApi.processFinished(row.id)
getList()
}else {
} else {
emit('tableFormButton', val, row)
}
}
const buttonClick=(type,row)=>{
if (type == 'pfinished') {
WorkSchedulingDetailApi.processFinished(row.id)
getList()
}else if (type == 'reprotProcess') {
refreport.value.openDetail(row,"工序报工", planDayCode.value)
//
}else if (type == 'checkProcess') {
//WorkSchedulingDetailApi.processFinished(row.id)
}
getList()
}
/** 添加/修改操作 */
const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value)

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

@ -4,71 +4,20 @@
v-model="dialogVisible"
:close-on-click-modal="true"
:vLoading="formLoading"
width="fit-content"
width="600px"
>
<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" />
</el-select>
<el-form ref="formRef">
<el-form-item label="工序" v-model="processCode">
<el-input v-model="processCode" disabled />
</el-form-item>
<el-form-item label="选择人员">
<el-select v-model="personSelected">
<el-select v-model="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"></el-input-number>
<el-input-number v-model="reportCount" @change="handleCount" :key="count"></el-input-number>
</el-form-item>
<el-form-item label="工时">
<el-input-number v-model="workTerm"></el-input-number>
@ -76,7 +25,7 @@
<el-form-item label="是否已质检">
<el-switch v-model="checkFlag" active-value="true"> </el-switch>
</el-form-item>
<el-form-item label="合格数量">
<el-form-item label="合格数量" @change="handleCount" :key="qcount">
<el-input-number
v-model="qualified"
:disabled="!checkFlag"
@ -86,7 +35,7 @@
<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>
@ -101,19 +50,11 @@ 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 processCode = ref()
const personSelected = ref()
const checkFlag = ref(false)
const unqualified = ref()
@ -121,37 +62,24 @@ 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={
planDayCode:row.planMasterCode,
schedulingCode:row.schedulingCode
}
processOption.value=await workschedulingApi.getProcessList(params)
}
const processChange=(val:any)=>{
//console.log("processChange-81",val)
getCurrentWorkerList(val)
const planDayCode=ref()
const formRef=ref()
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
planDayCode.value=code
getCurrentWorkerList(processCode.value)
}
//
const getCurrentWorkerList = async (val) => {
//console.log("personOption-91",val)
let params = {
planDayCode: rowData.value.planMasterCode,
planDayCode: planDayCode.value,
processCode: val
}
personOption.value = await workschedulingApi.getCurrentWorkerList(params)
@ -160,45 +88,53 @@ const getCurrentWorkerList = async (val) => {
const count = ref(0)
const qcount = ref(1)
//
const handleCount = (row) => {
if (row.reportCount > rowData.value.planCount) {
const handleCount = (val) => {
if (reportCount.value> rowData.value.planCount) {
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】')
row.reportCount =rowData.value.planCount
reportCount.value =rowData.value.planCount
//tableData.value[index].reportCount =rowData.value.planCount
count.value++
return
}
//message.alert(row.checkFlag==true?'1':'2')
if (row.checkFlag) {
if (row.reportCount < row.qualified) {
if (checkFlag.value) {
if (reportCount.value < qualified.value) {
message.alert('合格数不能超出报工数!')
row.qualified=row.reportCount
qualified.value=reportCount.value
qcount.value++
return
}
if (row.qualified == undefined || row.qualified == 0) {
row.qualified = row.reportCount
if (qualified.value == undefined || qualified.value == 0) {
qualified.val = reportCount.value
qcount.value++
}
row.unqualified= row.reportCount- row.qualified
unqualified.value= reportCount.value- qualified.value
}
}
//
const saveReport = async() => {
if (count.value > 0) {
message.alert('报工数量不能超出计划数量!')
return
}
let listSub=[{}]
personSelected.value.forEach((item) => {
let data={
reportCount: formRef.value.reportCounte,
workTerm: formRef.value.workTerm,
reportPerson: formRef.value.item,
qualified: formRef.value.qualified,
unqualified: formRef.value.unqualified
}
listSub.push(data)
})
let data = {
reportDate: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
schedulingCode: rowData.value.schedulingCode,
processCode: processCodeSelected.value,
list: [
{
reportCount: reportCount.value,
workTerm: workTerm.value,
reportPerson: personSelected.value,
qualified: qualified.value,
unqualified: unqualified.value
}
]
processCode: processCode.value,
list: listSub
}
saveFlag.value = true
try {
@ -214,6 +150,6 @@ const saveReport = async() => {
}
//
const emit = defineEmits(['success', 'close'])
defineOptions({ name: 'reportProcess' })
defineExpose({ openDetail }) // open
</script>

185
src/views/mes/workScheduling/components/reportAll.vue

@ -0,0 +1,185 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:close-on-click-modal="true"
:vLoading="formLoading"
width="fit-content"
>
<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>
<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'
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 reportCount = ref()
const workTerm = ref()
const saveFlag=ref(false)
const tableData=ref([{}])
const addRow=()=>{
if(tableData.value.length<processOption.value.length){
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})
}else{
message.alert('超出可报工的工序数量,不能再添加!')
}
}
const deleteRow = (index: number) => {
tableData.value.splice(index, 1)
}
//
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 count = ref(0)
const qcount = ref(1)
//
const handleCount = (row) => {
if (row.reportCount > rowData.value.planCount) {
message.alert('报工数量不能超出计划数量!计划数【'+rowData.value.planCount+'】')
row.reportCount =rowData.value.planCount
//tableData.value[index].reportCount =rowData.value.planCount
count.value++
return
}
//message.alert(row.checkFlag==true?'1':'2')
if (row.checkFlag) {
if (row.reportCount < row.qualified) {
message.alert('合格数不能超出报工数!')
row.qualified=row.reportCount
qcount.value++
return
}
if (row.qualified == undefined || row.qualified == 0) {
row.qualified = row.reportCount
qcount.value++
}
row.unqualified= row.reportCount- row.qualified
}
}
//
const saveReport = async() => {
saveFlag.value = true
try {
let data = {
planMasterCode: rowData.value.planMasterCode,
schedulingCode: rowData.value.schedulingCode,
schedulingDetailList: tableData.value
}
//console.log("report-saveReport-170",data)
workschedulingApi.reportWorkByTask(data)
}finally{
saveFlag.value = false
dialogVisible.value = false
emit('close')
}
//console.log("report-saveReport-82",data)
//await workschedulingApi.reportWorkByProcess(data)
}
//
const emit = defineEmits(['success', 'close'])
defineExpose({ openDetail }) // open
</script>

25
src/views/mes/workScheduling/index.vue

@ -68,7 +68,7 @@
@searchTableSuccessDetail="searchTableSuccessDetail"
:key="count"
/>
<Report ref="reportRef" @close="handleClose"></Report>
<ReportAll ref="reportRef" @close="handleClose"></ReportAll>
<Finish ref="reportFinishRef" @close="handleClose"></Finish>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/mes/work-scheduling/import" :importTemplateData="importTemplateData" @success="importSuccess" />
@ -83,7 +83,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from './components/Detail.vue'
import Report from './components/report.vue'
import ReportAll from './components/reportAll.vue'
import Finish from './components/finish.vue'
@ -96,17 +96,7 @@ const route = useRoute() // 路由信息
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(WorkScheduling.allSchemas.tableColumns)
// table
const buttondataTable = ref([{
label: '完工',
name: 'pfinished',
hide: false,
type: 'primary',
icon: '',
color: '',
hasPermi: '',
link: true, //
}])
// Bom
const tableFormButton = async (val , row) => {
getList()
@ -191,8 +181,8 @@ const butttondata=(row) =>{ return [
defaultButtons.mainListHandleBtn({label:"暂停",name:'pause',hide: isShowMainButton(row,['1']),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"恢复",name:'resume',hide: isShowMainButton(row,['3']),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"开工",name:'start',hide: isShowMainButton(row,['-1','0']),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"报工",name:'report',hide: isShowMainButton(row,['4'] ),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"质检",name:'check',hide: isShowMainButton(row,['5'] ),hasPermi:'mes:workScheduling:update'}),
// defaultButtons.mainListHandleBtn({label:"",name:'report',hide: isShowMainButton(row,['3','1'] ),hasPermi:'mes:workScheduling:update'}),
// defaultButtons.mainListHandleBtn({label:"",name:'check',hide: isShowMainButton(row,['5'] ),hasPermi:'mes:workScheduling:update'}),
defaultButtons.mainListHandleBtn({label:"完工",name:'finish',hide: isShowMainButton(row,['1']),hasPermi:'mes:workScheduling:update'}),
//defaultButtons.mainListHandleBtn({label:"",name:'callMaterial',hide: isShowMainButton(row,['1']),hasPermi:'mes:workScheduling:update'}),
@ -228,7 +218,7 @@ const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
//
//
const finishReport=async(row)=>{
let params={
id:row.id,
@ -238,7 +228,8 @@ const finishReport=async(row)=>{
//console.log("workscheduling-finishReport-213",row)
let res=await WorkSchedulingApi.getNodePosition(params)
if(res==='end'){
reportFinishRef.value.openDetail(row,"完工")
//reportFinishRef.value.openDetail(row,"")
WorkSchedulingApi.completeHandle(params)
}else{
message.alert("当前工序不是完工工序,不能进行完工操作!")
}

Loading…
Cancel
Save