| | |
| | | <script setup> |
| | | import {computed, nextTick, onMounted, reactive, ref, toRefs} from "vue"; |
| | | import {computed, nextTick, onMounted, onUnmounted, reactive, ref, toRefs} from "vue"; |
| | | import {useRouter,useRoute} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {changeFilterEvent, filterChanged} from "@/hook" |
| | | import domZIndex from 'dom-zindex' |
| | | import {indexOf} from "xe-utils"; |
| | | import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | import userInfo from "@/stores/userInfo" |
| | | import { useI18n } from 'vue-i18n' |
| | | import footSum from "@/hook/footSum" |
| | | import companyInfo from "@/stores/sd/companyInfo" |
| | | domZIndex.setCurrent(3000) |
| | | const company = companyInfo() |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | | let brokenVisible = ref(false) |
| | |
| | | }) |
| | | let detail = ref([]) |
| | | let layer='' |
| | | let technologicalProcess='' |
| | | |
| | | //定义接收加载表头下拉数据 |
| | | const titleSelectJson = ref({ |
| | |
| | | |
| | | }) |
| | | |
| | | |
| | | |
| | | let inputDisabled = ref(false) |
| | | onMounted(() =>{ |
| | | if(route.query.processId !== undefined && route.query.processId!=='' && route.query.processId!=null ){ |
| | |
| | | titleUploadData.value = res.data.reportingWork |
| | | titleSelectJson.value = res.data.basic |
| | | layer= res.data.layer |
| | | |
| | | //添加补片状态列 |
| | | let column = {field: 'patchStatusOther', width: 90,title: res.data.title} |
| | | gridOptions.columns.push(column) |
| | | |
| | | const s01Values = []; |
| | | for (let i = 0; i < res.data.reportingWorkDetails.length; i++) { |
| | | const s01Values = []; |
| | | // 遍历 detailList 数组,提取 S01 值到 s01Values 数组 |
| | | if (res.data.reportingWorkDetails[i].other_columns!=null|| res.data.reportingWorkDetails[i].other_columns!=undefined){ |
| | | res.data.reportingWorkDetails.forEach(element => { |
| | | const otherColumnsObject = JSON.parse(element.other_columns); |
| | | const s01Value = otherColumnsObject.S01; |
| | | s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值 |
| | | }); |
| | | |
| | | // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性 |
| | | res.data.reportingWorkDetails.forEach((detail, index) => { |
| | | detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性 |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //titleUploadData.value.processId=titleUploadData.value.processId+'/'+layer |
| | | xGrid.value.reloadData(res.data.reportingWorkDetails) |
| | | let button = { |
| | | code: 'update', |
| | | name: '修改', |
| | | name: t('basicData.update'), |
| | | status: 'primary', |
| | | } |
| | | if(route.query.reviewStatus === "1"){ |
| | | button.name='审核' |
| | | button.name=t('basicData.review') |
| | | titleUploadData.value.qualityInspector=user.user.userName |
| | | } |
| | | |
| | | |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | } |
| | |
| | | }) |
| | | |
| | | const data = [{id:1,num:2},{id:1,num:3},{id:2,num:2},{id:1,num:2}]; |
| | | |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | |
| | | const optionVal = ref('') |
| | | |
| | | //班次 |
| | | const classesVal = ref('早班') |
| | | const classesVal = ref(t('reportingWorks.early')) |
| | | const classesOption = [ |
| | | { |
| | | value: '早班', |
| | | label: '早班', |
| | | value: t('reportingWorks.early'), |
| | | label: t('reportingWorks.early'), |
| | | }, |
| | | { |
| | | value: '晚班', |
| | | label: '晚班', |
| | | value: t('reportingWorks.nightShift'), |
| | | label: t('reportingWorks.nightShift'), |
| | | }, |
| | | ] |
| | | |
| | |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | id: 'AddReportingWork_1', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | mouseConfig:{selected: true},//鼠标选中 |
| | | keyboardConfig:{ |
| | | isArrow: true, |
| | | isDel: true, |
| | | isEnter: true, |
| | | isTab: true, |
| | | isEdit: true, |
| | | isChecked: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | trigger: 'dblclick', |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | }, |
| | | menuConfig: { |
| | | body: { |
| | | //右键菜单 |
| | | options: [ |
| | | [ |
| | | { |
| | | code: 'copyChecked', |
| | | name: t('basicData.selectSame'), |
| | | prefixIcon: 'vxe-icon-copy', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'copyAll', |
| | | name: t('basicData.sameAfterwards'), |
| | | prefixIcon: 'vxe-icon-feedback', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'clearChecked', |
| | | name: t('basicData.clearSelection'), |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'SecondaryBreakage', |
| | | name: "序号次破相同", |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | { |
| | | code: 'checkedBreakage', |
| | | name: "选中次破相同", |
| | | prefixIcon: 'vxe-icon-indicator', |
| | | visible: true, |
| | | disabled: false |
| | | }, |
| | | ] |
| | | ] |
| | | } |
| | | }, |
| | | //表头参数 |
| | | columns: [ |
| | | // {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | { |
| | | field: 'order_number', |
| | | title: t('order.OrderNum'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 's01Value', |
| | | title: t('reportingWorks.glassNumber'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | |
| | | const brokenNum = |
| | | (row.breakageQuantity === undefined || row.breakageQuantity===null) ? 0 : row.breakageQuantity |
| | | if (row.completedQuantity && !regex.test(row.completedQuantity)) { |
| | | return new Error('请输入整数,并且大于等于0') |
| | | return new Error(t('reportingWorks.enterIntegerGreaterThanEqualTo')) |
| | | }else if((row.completedQuantity*1+brokenNum*1)>row.quantity*1){ |
| | | return new Error((`${row.completedQuantity}+${brokenNum}>${row.quantity}`)) |
| | | } |
| | | if(titleUploadData.value.reportingWorkId!=null && row.completedQuantity<row.minQuantity){ |
| | | return new Error(`请输入大于等于${row.minQuantity}的数字`) |
| | | return new Error(`${t('reportingWorks.pleaseGreaterThanOrEqual1')} |
| | | ${row.minQuantity} |
| | | ${t('reportingWorks.pleaseGreaterThanOrEqual2')}`) |
| | | } |
| | | |
| | | } |
| | |
| | | case 'saveReportingWork': { |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(`校验不通过!`) |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | saveReportingWork(0,'save') |
| | |
| | | case 'saveReportingWorkReview': { |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(`校验不通过!`) |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | saveReportingWork(1,'save') |
| | | break |
| | | } |
| | | case 'update': { |
| | | getQuantity() |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(`校验不通过!`) |
| | | return |
| | | } |
| | | saveReportingWork(0,'update') |
| | | //根据补片状态判断是否能修改 |
| | | // request.post(`/reportingWork/getPatchCondition/${route.query.reportingWorkId}`).then(async (res) => { |
| | | // if (res.code == 200) { |
| | | // if (res.data > 0) { |
| | | // ElMessage.error("该报工包含已补片数据,不可修改!") |
| | | // return |
| | | // } else { |
| | | getQuantity() |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return |
| | | } |
| | | saveReportingWork(0, 'update') |
| | | // } |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // }) |
| | | |
| | | break |
| | | } |
| | | } |
| | |
| | | } |
| | | //brokenGrid.value.reloadData(brokenRow.damageDetail) |
| | | //改变brokenVisible的值触发openedBrokenTable()方法 |
| | | brokenVisible.value = true |
| | | const { rows, column, cell } = params; // 解构获取行、列和单元格信息 |
| | | //点击次破数量时打开明细界面 |
| | | if(column.field=="breakageQuantity"){ |
| | | if (row.patchStatusOther!="已补片"){ |
| | | brokenVisible.value = true |
| | | } |
| | | } |
| | | }, |
| | | menuClick({menu, row, column}) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | case 'copyChecked' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "completedQuantity"){ |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start && index <= result.end) { |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | } |
| | | break |
| | | } |
| | | case 'copyAll' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "completedQuantity" ) { |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start) { |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'clearChecked' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "completedQuantity" ) { |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start && index <= result.end) { |
| | | item[result.cell] = '' |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'SecondaryBreakage' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "breakageQuantity" || result.cell === "completedQuantity"){ |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const seenOrders = {} |
| | | dataList.forEach((item, index) => { |
| | | const list = item.damageDetails |
| | | if (list!== null || list.length > 0){ |
| | | const { order_number, damageDetails, breakageQuantity } = item; |
| | | // 如果 order_number 还没有处理过 |
| | | if (!seenOrders[order_number]) { |
| | | // 记录第一个出现的 damageDetails 和 breakageQuantity |
| | | seenOrders[order_number] = { |
| | | damageDetails, |
| | | breakageQuantity |
| | | }; |
| | | } else { |
| | | // 将后续的 damageDetails 和 breakageQuantity 更新为第一个的 |
| | | item.damageDetails = seenOrders[order_number].damageDetails; |
| | | item.breakageQuantity = seenOrders[order_number].breakageQuantity; |
| | | } |
| | | } |
| | | |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'checkedBreakage' : { |
| | | let result = toolbarButtonClickEvent() |
| | | if (result.cell === "breakageQuantity" || result.cell === "completedQuantity"){ |
| | | if (result) { |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start].damageDetails |
| | | const quantity = dataList[result.start].breakageQuantity |
| | | dataList.forEach((item, index) => { |
| | | if (index >= result.start && index <= result.end) { |
| | | item.damageDetails = val |
| | | item.breakageQuantity = quantity |
| | | if (index!=result.start){ |
| | | item.completedQuantity = item.completedQuantity - quantity |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | |
| | | |
| | |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | id: 'AddReportingWork_2', |
| | | //showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns: [ |
| | | {type: 'checkbox', fixed: "left", title: t('basicData.check'),width: 78}, |
| | | {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 }, |
| | | // { |
| | | // field: 'order_number', |
| | |
| | | }, |
| | | { |
| | | field: 'responsiblePersonnel', |
| | | title: t('reportingWorks.responsiblePersonnel'), |
| | | title: '责任信息', |
| | | editRender: {name: 'input', attrs: {placeholder: ''}} |
| | | |
| | | }, |
| | |
| | | validator ({ cellValue }) { |
| | | const regex = /^[1-9]\d*$/ |
| | | if (!regex.test(cellValue)) { |
| | | return new Error('输入大于0的整数') |
| | | return new Error(t('reportingWorks.enterIntegerGreaterThan')) |
| | | } |
| | | } |
| | | } |
| | |
| | | validator ({ row }) { |
| | | const regex = /^\s*$/i |
| | | if(row.available===true && (regex.test(row.returnProcess)==='' || row.returnProcess===null)){ |
| | | return new Error('可利用已选择,请选择返回工序') |
| | | return new Error(t('reportingWorks.availableOkReturnProcess')) |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | breakageType: [ |
| | | { required: true, message: '请选择次破类型' } |
| | | { required: true, message: t('reportingWorks.selectBreakageType') } |
| | | ], |
| | | breakageReason: [ |
| | | { required: true, message: '请选择次破原因' } |
| | | { required: true, message: t('reportingWorks.selectBreakageReason') } |
| | | ], |
| | | responsibleProcess: [ |
| | | { required: true, message: '请选择责任工序' } |
| | | { required: true, message: t('reportingWorks.selectResponsibleProcess')} |
| | | ], |
| | | responsibleEquipment: [ |
| | | { required: true, message: '请选择责任设备' } |
| | | { required: true, message: t('reportingWorks.selectResponsibleEquipment') } |
| | | ], |
| | | responsibleTeam: [ |
| | | { required: true, message: '责任班组' } |
| | | { required: true, message: t('reportingWorks.selectResponsibleTeam') } |
| | | ], |
| | | }, |
| | | toolbarConfig: {//表头按钮 |
| | |
| | | break |
| | | } |
| | | case 'removeRow': { |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | $grid.remove(result.row) |
| | | const $grid = brokenGrid.value |
| | | const checkedList = $grid.getCheckboxRecords() |
| | | if(checkedList){ |
| | | $grid.remove(checkedList) |
| | | } |
| | | break |
| | | } |
| | |
| | | } |
| | | } |
| | | const openedBrokenTable = () => { |
| | | addListener(brokenGrid.value,brokenGridOptions) |
| | | //addListener(brokenGrid.value,brokenGridOptions) |
| | | let damage =ref(brokenRow.value.damageDetails) |
| | | brokenGrid.value.reloadData(damage.value) |
| | | } |
| | |
| | | } |
| | | const errMap = await brokenGrid.value.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(`校验不通过!`) |
| | | ElMessage.error(t('basicData.msg.checkoutLose')) |
| | | return false |
| | | } |
| | | let breakageQuantityCount = 0 |
| | |
| | | |
| | | let reportingWorkNum = isNaN(brokenRow.value.completedQuantity*1)?0:brokenRow.value.completedQuantity*1 |
| | | if((breakageQuantityCount>brokenRow.value.quantity*1) ){ |
| | | ElMessage.warning(`损耗数:'${breakageQuantityCount}' |
| | | 不能大于${brokenRow.value.quantity*1}`) |
| | | ElMessage.warning(`${t('reportingWorks.lossCount1')}':'${breakageQuantityCount} |
| | | ${t('reportingWorks.lossCount2')}${brokenRow.value.quantity*1}`) |
| | | return false |
| | | } |
| | | brokenRow.value.completedQuantity = brokenRow.value.quantity-breakageQuantityCount |
| | |
| | | return row.order_number === brokenRow.value.order_number |
| | | }) |
| | | const maxQuantity = Math.max(...equalByOrderNum.map(item =>item.breakageQuantity || 0)) |
| | | let process = titleUploadData.value.thisProcess |
| | | equalByOrderNum.forEach((row) =>{ |
| | | row.completedQuantity= brokenRow.value.quantity*1-maxQuantity |
| | | if (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框'){ |
| | | row.completedQuantity= brokenRow.value.quantity*1-maxQuantity |
| | | } |
| | | |
| | | }) |
| | | |
| | | |
| | |
| | | |
| | | |
| | | //第一次加载数据 |
| | | |
| | | request.post(`/reportingWork/selectProcess`).then((res) => { |
| | | let groupChangeProcess = ref(false)//用于本班组显示问题 |
| | | request.post(`/reportingWork/selectProcess/${user.user.userId}`).then((res) => { |
| | | if (res.code == 200) { |
| | | titleSelectJson.value.processType = res.data.process; |
| | | titleSelectJson.value.processType = res.data.process |
| | | if(user.user.address!==null && user.user.address!==''){ |
| | | titleUploadData.value.thisProcess = user.user.address |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | groupChangeProcess.value = true |
| | | if (user.user.address==='技术部多曲' || user.user.address==='夹胶'){ |
| | | groupChangeProcess.value = false |
| | | } |
| | | gridOptions.toolbarConfig.buttons[1].visible=false |
| | | } |
| | | |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | const saveReportingWork = (state,saveType) => { |
| | | |
| | | if(xGrid.value.getTableData().fullData.length===0){ |
| | | ElMessage.warning(`请选择流程卡数据`) |
| | | ElMessage.warning(t('reportingWorks.selectProcessCardData')) |
| | | return |
| | | } |
| | | const device = titleUploadData.value.deviceName |
| | | if(device === null || device === undefined || device === ''){ |
| | | ElMessage.error('请选择报工设备!') |
| | | ElMessage.error(t('reportingWorks.selectWorkReportingEquipment')) |
| | | return |
| | | } |
| | | const teamsGroupsName = titleUploadData.value.teamsGroupsName |
| | | if(teamsGroupsName === null || teamsGroupsName === undefined || teamsGroupsName === ''){ |
| | | ElMessage.error('请选择报工设备!') |
| | | ElMessage.error(t('reportingWorks.selectWorkReportingTeam')) |
| | | return |
| | | } |
| | | |
| | |
| | | const notFinishList = xGrid.value.getTableData().fullData.filter(item =>{ |
| | | return item.saveFlag === 0 |
| | | }) |
| | | |
| | | let process = titleUploadData.value.thisProcess |
| | | for(let item of uniqueByOrderNum){ |
| | | if(!checkSameNumForId(notFinishList,item.order_number)){ |
| | | ElMessage.error(`请检查订单序号: ${item.order_number} 报工数量是否相同!`) |
| | | if(!checkSameNumForId(notFinishList,item.order_number ) && (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框')){ |
| | | ElMessage.error(`${t('reportingWorks.pleaseCheckTheOrderNumber1')}':' |
| | | ${item.order_number} |
| | | ${t('reportingWorks.pleaseCheckTheOrderNumber1')}`) |
| | | return false |
| | | } |
| | | } |
| | | |
| | | |
| | | titleUploadData.value.creator = user.user.userName |
| | | titleUploadData.value.creatorId = user.user.userId |
| | |
| | | const b = (row.breakageQuantity !== undefined && row.breakageQuantity !== null && row.breakageQuantity !== '' && row.breakageQuantity*1!==0) |
| | | return (a || b) |
| | | }) |
| | | if(requestDetailData.length === 0){ |
| | | ElMessage.warning('请填写至少一条损耗数和完工数大于0') |
| | | if(requestDetailData.length === 0 && (route.query.reportingWorkId===undefined)){ |
| | | ElMessage.warning(t('reportingWorks.atLeastOneFinishedAndWornEligible')) |
| | | return false |
| | | } |
| | | |
| | | let status=company.qualityInsStatus |
| | | const requestData = { |
| | | title:titleUploadData.value, |
| | | detail:xGrid.value.getTableData().fullData, |
| | | type:state//审核状态 |
| | | type:state,//审核状态 |
| | | userId:user.user.userId, |
| | | userName:user.user.userName, |
| | | qualityInsStatus:status |
| | | } |
| | | gridOptions.toolbarConfig.buttons[0].disabled=true |
| | | gridOptions.toolbarConfig.buttons[1].disabled=true |
| | |
| | | const saveReportingWorkRequest = (requestData) =>{ |
| | | request.post(`/reportingWork/saveReportingWork`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | ElMessage.success("报工成功") |
| | | ElMessage.success(t('reportingWorks.successfulJobApplication')) |
| | | router.push({path:'/main/reportingWorks/AddReportingWork',query:{processId:titleUploadData.value.processId,random:Math.random()}}) |
| | | }else{ |
| | | const errorObj = JSON.parse(res.msg) |
| | | const msg = "序号:"+errorObj.orderNumber+'\n' |
| | | +'小片顺序:'+errorObj.technologyNumber+'\n' |
| | | +"实际可报工数量:"+errorObj.processNum+'<'+ |
| | | "报工数量:"+errorObj.sumNum+'\n' |
| | | +"请刷新界面重新报工" |
| | | const msg = t('reportingWorks.pleaseNumber1')+":"+errorObj.orderNumber+'\n' |
| | | +t('reportingWorks.pleaseNumber2')+':'+errorObj.technologyNumber+'\n' |
| | | +t('reportingWorks.pleaseNumber3')+':'+errorObj.processNum+'<'+ |
| | | +t('reportingWorks.pleaseNumber4')+':'+errorObj.sumNum+'\n' |
| | | +t('reportingWorks.pleaseNumber5') |
| | | |
| | | ElMessage.error(msg) |
| | | } |
| | | }).catch(err =>{ |
| | | ElMessage.error(err.message) |
| | | ElMessage.error('提交失败,请刷新后重试') |
| | | }).finally(()=>{ |
| | | |
| | | gridOptions.toolbarConfig.buttons[0].disabled=false |
| | |
| | | } |
| | | request.post(`/reportingWork/updateReportingWork/${reviewState}`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | ElMessage.success("报工修改成功") |
| | | ElMessage.success(t('reportingWorks.successfulModificationOfWorkApplication')) |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | |
| | | }) |
| | | // 查询责任班组 |
| | | const computedResponsibleTeam = computed((responsibleProcess) => { |
| | | titleSelectJson.value.historyTeams.push({basic_name: user.user.userName, process: titleUploadData.value.thisProcess, basic_type: 'teamsgroups', basic_category: 179, id: 555}) |
| | | return function (responsibleProcess){ |
| | | return titleSelectJson.value.historyTeams.filter((item) => { |
| | | return item.process === responsibleProcess |
| | |
| | | const reviewReportingWork = () => { |
| | | const processId = titleUploadData.value.processId |
| | | if (processId.indexOf("/") < 0) { |
| | | ElMessage.warning("请输入正确格式流程卡") |
| | | ElMessage.warning(t('reportingWorks.correctFormatProcessCard')) |
| | | return |
| | | } |
| | | let indexOfChar = processId.indexOf("/") |
| | | let leftString = processId.slice(0, indexOfChar) |
| | | if (leftString.length < 14) { |
| | | ElMessage.warning("请输入正确位数的流程卡") |
| | | ElMessage.warning(t('reportingWorks.processCardCorrectNumberDigits')) |
| | | return |
| | | } |
| | | //工序 |
| | | let process = titleUploadData.value.thisProcess |
| | | if (process === "" || process == null) { |
| | | ElMessage.warning("请选择工序") |
| | | ElMessage.warning(t('reportingWorks.selectProcess')) |
| | | return |
| | | } |
| | | if(titleUploadData.value.previousProcess===''){ |
| | | ElMessage.warning("第一道工序不需要审核") |
| | | ElMessage.warning(t('reportingWorks.firstProcessNotReview')) |
| | | return |
| | | } |
| | | //匹配“/”前后字符串 |
| | | const regex = /([^\/]+)\/([^\/]+)/; |
| | | //查找匹配的字符串 |
| | | const result = processId.match(regex); |
| | | //流程卡号 |
| | | let processIdStr = result[1]; |
| | | //层号 |
| | | let technologyStr = result[2]; |
| | | const reportWork = { |
| | | process: titleUploadData.value.previousProcess, |
| | | processId:processId |
| | | processId:processId, |
| | | thisProcess:titleUploadData.value.thisProcess, |
| | | technologyStr:technologyStr, |
| | | userName:user.user.userName |
| | | } |
| | | loadingFlag.value= true |
| | | request.post("/reportingWork/reviewReportingWork",reportWork).then((res) =>{ |
| | | if(res.code === '200'){ |
| | | ElMessage.success("审核成功") |
| | | ElMessage.success(t('basicData.msg.ReviewSuccess')) |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | |
| | | |
| | | let processId = titleUploadData.value.processId |
| | | if (processId == "" || processId == null) { |
| | | ElMessage.warning("流程卡号不能为空") |
| | | ElMessage.warning(t('reportingWorks.theProcessCardNumberCannotBeEmpty')) |
| | | return |
| | | } |
| | | let parts = processId.split('/'); |
| | | |
| | | if (processId.indexOf("/") < 0 ||parts[1].trim() == '') { |
| | | ElMessage.warning("请输入正确格式流程卡") |
| | | ElMessage.warning(t('reportingWorks.correctFormatProcessCard')) |
| | | return |
| | | } |
| | | let indexOfChar = processId.indexOf("/") |
| | | let leftString = processId.slice(0, indexOfChar) |
| | | if (leftString.length < 14) { |
| | | ElMessage.warning("请输入正确位数的流程卡") |
| | | ElMessage.warning(t('reportingWorks.processCardCorrectNumberDigits')) |
| | | return |
| | | } |
| | | //工序 |
| | | let process = titleUploadData.value.thisProcess |
| | | if (process == "" || process == null) { |
| | | ElMessage.warning("请选择工序") |
| | | ElMessage.warning(t('reportingWorks.selectProcess')) |
| | | return |
| | | } |
| | | if (titleSelectJson.value.thisProcessType.length!=0){ |
| | | if (titleSelectJson.value.thisProcessType.indexOf(process) === -1 && process !== t('machine.cutting')) { |
| | | ElMessage.warning(t('reportingWorks.thisProcessNotProcessCard')) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (titleSelectJson.value.thisProcessType.indexOf(process) == -1 && process != "切割" && titleSelectJson.value.thisProcessType != "") { |
| | | ElMessage.warning("此工序不属于该流程卡") |
| | | return |
| | | } |
| | | //匹配“/”前后字符串 |
| | | const regex = /([^\/]+)\/([^\/]+)/; |
| | | //查找匹配的字符串 |
| | |
| | | //流程卡号 |
| | | let processIdStr = result[1]; |
| | | //层号 |
| | | |
| | | let technologyStr = result[2]; |
| | | request.post(`/reportingWork/addSelectLastWork/${processIdStr}/${technologyStr}/${process}`).then((res) => { |
| | | |
| | | let reportType= company.reportType |
| | | request.post(`/reportingWork/addSelectLastWork/${processIdStr}/${technologyStr}/${process}/${reportType}`).then((res) => { |
| | | if (res.code == 200) { |
| | | if(res.data.data==null){ |
| | | ElMessage.error("未查询到此流程卡数据") |
| | | ElMessage.error(t('reportingWorks.noDataThisProcessCard')) |
| | | return |
| | | } |
| | | |
| | | technologicalProcess=res.data.technologicalProcess |
| | | //表头赋值 |
| | | titleUploadData.value = res.data.data |
| | | titleUploadData.value.processId = processId |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | //设备下拉框 |
| | | titleSelectJson.value.deviceType = res.data.device |
| | | //班组下拉框 |
| | |
| | | //判断早晚班 |
| | | titleUploadData.value.classes=t('reportingWorks.early') |
| | | titleUploadData.value.reportingWorkTime = formatCurrentTime() |
| | | |
| | | //处理编号列 |
| | | //定义存放编号数组 |
| | | const s01Values = []; |
| | | for (let i = 0; i < res.data.Detail.length; i++) { |
| | | const s01Values = []; |
| | | // 遍历 detailList 数组,提取 S01 值到 s01Values 数组 |
| | | if (res.data.Detail[i].other_columns!=null|| res.data.Detail[i].other_columns!=undefined){ |
| | | res.data.Detail.forEach(element => { |
| | | const otherColumnsObject = JSON.parse(element.other_columns); |
| | | const s01Value = otherColumnsObject.S01; |
| | | s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值 |
| | | }); |
| | | |
| | | // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性 |
| | | res.data.Detail.forEach((detail, index) => { |
| | | detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性 |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //绑定下方表格 |
| | | detail.value = res.data.Detail |
| | | xGrid.value.reloadData(detail.value) |
| | |
| | | } |
| | | |
| | | if (item.quantity < item.completedQuantity) { |
| | | ElMessage.success("序号" + item.order_number + "的数量不能大于上工序数量") |
| | | ElMessage.success(t('reportingWorks.pleaseNumber6') + item.order_number + t('reportingWorks.pleaseNumber7')) |
| | | |
| | | |
| | | } else if (item.breakageQuantity * 1 + item.completedQuantity * 1 > item.quantity * 1) { |
| | | ElMessage.success("请输入序号" + item.order_number + "正确的完工或次破数量") |
| | | ElMessage.success(t('reportingWorks.pleaseNumber8') + item.order_number + t('reportingWorks.pleaseNumber9')) |
| | | } |
| | | |
| | | sum = item.completedQuantity * 1 + sum * 1 |
| | |
| | | let hours = dateObj.getHours().toString().padStart(2, '0'); // 小时 |
| | | let minutes = dateObj.getMinutes().toString().padStart(2, '0'); // 分钟 |
| | | let seconds = dateObj.getSeconds().toString().padStart(2, '0'); // 秒数 |
| | | if(parseInt(hours)>=17 && parseInt(hours)<8)titleUploadData.value.classes='晚班' |
| | | if(parseInt(hours)>=17 && parseInt(hours)<8)titleUploadData.value.classes=t('reportingWorks.nightShift') |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; // 返回格式化后的时间字符串 |
| | | } |
| | | |
| | | const editClosedEvent = ({ row, column }) => { |
| | | let process = titleUploadData.value.thisProcess |
| | | if (column.property==='completedQuantity') { |
| | | xGrid.value.getTableData().fullData.forEach((item, index) =>{ |
| | | if(item.order_number===row.order_number){ |
| | | if(item.order_number===row.order_number && (process=='夹胶' || process=='中空' || process=='包装' ||process=='打胶和粘框')){ |
| | | item.completedQuantity=row.completedQuantity |
| | | } |
| | | }) |
| | |
| | | const $grid = xGrid.value |
| | | this.$grid.commitProxy('data', yourData) |
| | | } |
| | | onMounted(() => { |
| | | window.addEventListener('keypress', qrcodeScanner); |
| | | addListener(xGrid.value, gridOptions) |
| | | }) |
| | | |
| | | // 在组件卸载时移除键盘事件监听 |
| | | onUnmounted(() => { |
| | | window.removeEventListener('keypress', qrcodeScanner); |
| | | }) |
| | | |
| | | let code = ''; |
| | | let codeArr = []; |
| | | let lastTime,nextTime = '' |
| | | let lastCode,nextCode = '' |
| | | const qrcodeScanner = (e) =>{ |
| | | |
| | | nextCode = e.key; |
| | | |
| | | |
| | | // 当前触发时间 |
| | | nextTime = new Date().getTime(); |
| | | // 第一次获取 |
| | | if(!lastTime && !lastCode && e.key !== 'Enter'){ |
| | | codeArr = [] |
| | | codeArr.push(e.key) |
| | | } |
| | | |
| | | if(lastCode && lastTime && (nextTime - lastTime > 50)){ |
| | | // 相隔时间大于30 说明不是扫码枪扫描的 清空重新 |
| | | codeArr = [] |
| | | // 当扫码前有keypress事件时,防止首字缺失 |
| | | } else if(lastCode && lastTime && e.key !== 'Enter'){ |
| | | codeArr.push(e.key) |
| | | } |
| | | lastCode = nextCode |
| | | lastTime = nextTime |
| | | // 扫描结束 |
| | | if(e.keyCode === 13){ |
| | | // 可进行下一步操作 |
| | | /* 下一步操作 */ |
| | | if(codeArr.length!==0){ |
| | | titleUploadData.value.processId = codeArr.join('') |
| | | } |
| | | if(user.user.address!==null || user.user.address!==''){ |
| | | getWork() |
| | | } |
| | | |
| | | codeArr=[] |
| | | lastTime = '' |
| | | nextTime = '' |
| | | lastCode = '' |
| | | nextCode = '' |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | const cellClassName = ({ row, column }) => { |
| | | if (column.field === 'breakageQuantity') { |
| | | return 'col-red' |
| | | } |
| | | |
| | | } |
| | | const changeRowClass = ({ row, rowIndex, $rowIndex }) => { |
| | | return row?.rowClass |
| | | |
| | | } |
| | | const editConfigDisable = reactive({ |
| | | trigger: 'click', |
| | | mode: 'cell', |
| | | beforeEditMethod ({ row }) { |
| | | if (row.patchStatusOther === '已补片') { |
| | | return false |
| | | } |
| | | return true |
| | | } |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="height: 100%;width: 100%"> |
| | | <div id="head" style="height: 5%;width: 100%;margin-bottom: 5px"> |
| | | <el-input :disabled="inputDisabled" v-if="titleUploadData.reportingWorkId" v-model="titleUploadData.reportingWorkId" placeholder="报工编号" style="width: 200px" /> |
| | | <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" placeholder="流程卡号" style="width: 200px" @keyup.enter.native="getWork();getQuantity()"/> |
| | | <el-input :disabled="inputDisabled" v-if="titleUploadData.reportingWorkId" v-model="titleUploadData.reportingWorkId" :placeholder="$t('reportingWorks.reportingWorkId')" style="width: 200px" /> |
| | | <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" :placeholder="$t('processCard.processId')" style="width: 200px" @keyup.enter.native="getWork();getQuantity()"/> |
| | | |
| | | <el-select :disabled="inputDisabled" v-model="titleUploadData.thisProcess" clearable placeholder="请选择工序" style="width: 120px" |
| | | <el-select :disabled="inputDisabled || groupChangeProcess" |
| | | v-model="titleUploadData.thisProcess" |
| | | clearable |
| | | :placeholder="$t('reportingWorks.selectProcess')" |
| | | style="width: 120px" |
| | | @change="getWork();getQuantity()"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | |
| | | </el-button> |
| | | <!-- <el-button type="primary">审核不通过</el-button>--> |
| | | |
| | | <label>{{$t('reportingWorks.processCardArea')}}:</label> |
| | | <label>{{technologicalProcess}}</label> |
| | | </div> |
| | | <div style="background-color: white;margin-bottom: 5px;height: 17%;width: 100%"> |
| | | <el-row> |
| | |
| | | <el-text class="customClass"></el-text> |
| | | </el-col> |
| | | <el-col :span="2"> |
| | | <el-text>{{$t('order.project')}}:</el-text> |
| | | <el-text >{{$t('order.project')}}:</el-text> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-text wrap-text="false">{{ titleUploadData.order.project }}</el-text> |
| | | <el-input :readonly="true" v-model="titleUploadData.order.project"/> |
| | | <!-- <el-text style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">{{ titleUploadData.order.project }}</el-text>--> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | |
| | | <el-text>{{$t('reportingWorks.teamsType')}}:</el-text> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-select v-model="titleUploadData.teamsGroupsName" clearable :placeholder="$t('reportingWorks.selectTeam')"> |
| | | <el-select :disabled="groupChangeProcess" |
| | | v-model="titleUploadData.teamsGroupsName" |
| | | clearable |
| | | :placeholder="$t('reportingWorks.selectTeam')"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['teamsType']" |
| | | :key="item.id" |
| | |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | :row-class-name="changeRowClass" |
| | | max-height="100%" |
| | | height="400px" |
| | | height="100%" |
| | | size="small" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @edit-closed="editClosedEvent" |
| | | :cell-class-name="cellClassName" |
| | | :edit-config="editConfigDisable" |
| | | |
| | | > |
| | | |
| | |
| | | <!-- 刺破类型breakageType --> |
| | | <template #breakageType="{ row }"> |
| | | <vxe-select v-model="row.breakageType " |
| | | filterable |
| | | clearable |
| | | placeholder=""> |
| | | clearable placeholder=" " allow-create filterable> |
| | | <vxe-option v-for="item in titleSelectJson.breakageType" :key="item.id" :label="item.basic_name" :value="item.basic_name"/> |
| | | </vxe-select> |
| | | </template> |
| | |
| | | <!--次破原因--> |
| | | <template #breakageReason="{ row }"> |
| | | <vxe-select v-model="row.breakageReason " |
| | | filterable |
| | | clearable |
| | | placeholder=""> |
| | | clearable placeholder=" " allow-create filterable> |
| | | <vxe-option v-for="item in titleSelectJson.breakageReason" :key="item.id" :label="item.basic_name" :value="item.basic_name"/> |
| | | </vxe-select> |
| | | </template> |
| | |
| | | user-select: none; |
| | | } |
| | | |
| | | ::v-deep(.mytable-scrollbar .col-red) { |
| | | background-color: rgb(66,159,254); |
| | | color: #fff; |
| | | } |
| | | |
| | | |
| | | ::v-deep(.latter) { |
| | | //display: none; |
| | | } |
| | | </style> |