| | |
| | | <block slot="backText">返回</block> |
| | | <block slot="content">报工</block> |
| | | <block slot="right"> |
| | | <view @click="printHandel"> |
| | | <view v-show="isShow" @click="printHandel"> |
| | | <image class="search" src="/static/icon_dayin.png" style="width: 25px; height: 25px;" alt="打印按钮" /> |
| | | </view> |
| | | </block> |
| | | </cu-custom> |
| | | |
| | | |
| | | <!-- 骨架屏 --> |
| | | <view v-if="loading" class="skeleton-container"> |
| | | <view class="skeleton-group"> |
| | |
| | | <view class="skeleton-input"></view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <view class="skeleton-group"> |
| | | <view class="skeleton-divider"></view> |
| | | <view class="skeleton-item"> |
| | |
| | | <view class="skeleton-datetime"></view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <view class="skeleton-button"></view> |
| | | </view> |
| | | |
| | | |
| | | <!-- 实际内容 --> |
| | | <view v-else class="container"> |
| | | <uni-forms |
| | | ref="form" |
| | | :modelValue="formData" |
| | | :rules="rules" |
| | | validate-trigger="bind" |
| | | err-show-type="undertext"> |
| | | <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> |
| | | <uni-group top="1"> |
| | | <view class="divider"><text>工单信息</text></view> |
| | | <uni-forms-item :label-width="100" name="workOrderNumber" label="单据编号:"> |
| | | <uni-easyinput v-model="formData.workOrderNumber" :disabled="true" /> |
| | | <uni-forms-item :label-width="100" name="workOrderNumber" label="报工工单:"> |
| | | <uni-data-select v-model="workOrderNumber" :localdata="productionOrderList" |
| | | @change="changeProductionOrder" placeholder="请选择" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="materialCode" label="物料编码:"> |
| | | <uni-easyinput v-model="formData.materialCode" :disabled="true" /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item :label-width="100" name="materialDescription" label="物料描述:"> |
| | | <uni-easyinput v-model="formData.materialDescription" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="plannedQuantity" label="计划数量:"> |
| | | <uni-easyinput v-model="formData.plannedQuantity" :disabled="true" /> |
| | | </uni-forms-item> |
| | | |
| | | <view class="divider"><text>报工信息</text></view> |
| | | |
| | | <uni-forms-item :label-width="140" required name="inspectionOrderNumber" |
| | | label="报工单号:"> |
| | | <uni-easyinput v-model="formData.inspectionOrderNumber" placeholder="系统生成" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="140" required name="process" label="仓库"> |
| | | <uni-data-select v-model="formData.process" :localdata="SpareList" @change="changeisSpareList" |
| | | <uni-forms-item :label-width="100" name="reportCode" label="生产 订单:"> |
| | | <uni-data-select v-model="reportCode" :localdata="reportCodeList" @change="changeReportCodeList" |
| | | placeholder="请选择" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="140" required name="inspectionQuantity" label="报工数量:"> |
| | | <uni-number-box v-model="formData.inspectionQuantity" /> |
| | | |
| | | <uni-forms-item :label-width="100" name="materialDescription" label="产线:"> |
| | | <uni-easyinput v-model="formData.materialDescription" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="140" required name="inspectionPlan" label="检验人员"> |
| | | <uni-data-select v-model="formData.inspectionPlan" :localdata="SpareList" |
| | | @change="changeisSpareList" placeholder="请选择" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="140" required name="inspectionTime" label="报工时间"> |
| | | <uni-datetime-picker type="datetime" v-model="formData.inspectionTime" /> |
| | | <uni-forms-item :label-width="100" name="plannedQuantity" label="报工数量:"> |
| | | <uni-number-box :min="0" :max="9999" v-model="formData.plannedQuantity" /> |
| | | </uni-forms-item> |
| | | </uni-group> |
| | | </uni-forms> |
| | |
| | | @click.stop="ProductionTask()" hover-class="is-hover">确定</view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <pdaScanVue></pdaScanVue> |
| | | </view> |
| | | </template> |
| | |
| | | <script> |
| | | import pdaScanVue from "@/components/mes/pdaScan.vue"; |
| | | import QRCode from 'qrcode'; |
| | | |
| | | import { |
| | | mapGetters |
| | | } from "vuex"; |
| | | export default { |
| | | components: { |
| | | pdaScanVue |
| | |
| | | return { |
| | | loading: true, |
| | | isShow: false, |
| | | materialNumber: '', |
| | | isSubmitting: false, // 防重复提交 |
| | | SpareList: [{ |
| | | text: "是", |
| | | value: 1 |
| | | }, |
| | | { |
| | | text: "否", |
| | | value: 0 |
| | | } |
| | | ], |
| | | productionOrderList: [], |
| | | reportCodeList: [], |
| | | reportCode: '', |
| | | workOrderNumber: '', |
| | | scrollLeft: 0, |
| | | formData: { |
| | | workOrderNumber: '1111111', |
| | |
| | | produceDate: '', |
| | | workshop: '装配车间3号线' |
| | | }, |
| | | // 表单验证规则 |
| | | rules: { |
| | | process: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请选择工序' |
| | | }] |
| | | }, |
| | | inspectionType: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请选择检验类型' |
| | | }] |
| | | }, |
| | | inspectionPlan: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请选择检验方案' |
| | | }] |
| | | }, |
| | | inspectionTime: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请选择检验时间' |
| | | }] |
| | | }, |
| | | inspectionQuantity: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请输入送检数量' |
| | | }, { |
| | | format: 'number', |
| | | errorMessage: '送检数量必须为数字' |
| | | }] |
| | | } |
| | | }, |
| | | |
| | | NavBarColor: this.NavBarColor, |
| | | url: { |
| | | upload: "/eam/sysFiles/batch_upload", |
| | | stallList: "/eam/eamRepairOrder/queryById", |
| | | getEquipmentList: 'eam/equipment/list', |
| | | approval: '/eam/eamRepairOrder/perform' |
| | | getEquipmentList: 'mes/mesProductionWorkOrder/list', |
| | | approval: '/mes/productionOrder/selectReportWorkOrderList', |
| | | add: 'mes/mesWorkReporting/add' |
| | | }, |
| | | styles: { |
| | | color: '#2979FF', |
| | |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["currentLineName", "username", "currentLineId"]), |
| | | top() { |
| | | return this.CustomBar * 2 + 160 |
| | | }, |
| | |
| | | return style |
| | | }, |
| | | }, |
| | | mounted() { |
| | | /** |
| | | * 上料下料根据物料类型判断(额外信息)---扫码/手动输入 ---(手动输入调用接口返回库存信息) 扫码信息提交后端,在重新赋值 判断物料类型- 显示特殊属性值, 库存信息也要保存 |
| | | */ |
| | | const currentLineType = this.$store.getters.currentLineType; |
| | | console.log('当前产线类型:', currentLineType); |
| | | /** |
| | | * 装配 ASSEMBLE |
| | | * 内法兰INNERFLANGE |
| | | * 外法兰OUTERFLANGE |
| | | * 热处理HEATTREATMENT |
| | | */ |
| | | }, |
| | | created() { |
| | | // 初始化生产日期为当前日期 |
| | | this.formData.produceDate = this.formatDate(new Date()); |
| | | |
| | | // 模拟数据加载 |
| | | setTimeout(() => { |
| | | this.loading = false; |
| | | }, 1000); |
| | | this.formData.materialDescription = this.currentLineName; |
| | | this.getRelatedProdOrder(); |
| | | |
| | | }, |
| | | methods: { |
| | | // 格式化日期 |
| | | formatDate(date) { |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, '0'); |
| | | const day = String(date.getDate()).padStart(2, '0'); |
| | | return `${year}-${month}-${day}`; |
| | | changeReportCodeList(e) { |
| | | this.reportCode = e; |
| | | }, |
| | | |
| | | changeProductionOrder(e) { |
| | | this.workOrderNumber = e; |
| | | // 通过 selectedValue 匹配 productionOrderList 中的项 |
| | | const selectedItem = this.productionOrderList.find( |
| | | item => item.value === this.workOrderNumber |
| | | ); |
| | | if (selectedItem) { |
| | | // 获取 materialNumber |
| | | this.materialNumber = selectedItem.materialNumber; |
| | | console.log('选中项的 materialNumber:', this.materialNumber); |
| | | |
| | | // 获取索引(可选,若需要索引) |
| | | const index = this.productionOrderList.findIndex( |
| | | item => item.value === this.workOrderNumber |
| | | ); |
| | | console.log('选中项的索引:', index); |
| | | } |
| | | |
| | | this.getReportCodeList(this.materialNumber); |
| | | }, |
| | | getReportCodeList(code) { |
| | | this.$http.get(this.url.approval, { |
| | | params: { |
| | | materialNumber: code, |
| | | } |
| | | }).then(res => { |
| | | if (res.data.success) { |
| | | this.loading = false; |
| | | this.reportCodeList = res.data.result |
| | | } else { |
| | | uni.showModal({ |
| | | title: "提示", |
| | | content: res.data.message, |
| | | confirmText: '确定', |
| | | showCancel: false, |
| | | }) |
| | | } |
| | | }).catch(() => { |
| | | this.$tip.loaded(); |
| | | uni.showToast({ |
| | | icon: "error", |
| | | title: res.data.message, |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | |
| | | |
| | | }, |
| | | getRelatedProdOrder() { |
| | | this.$http.get(this.url.getEquipmentList, { |
| | | params: { |
| | | workOrderStatus: "EXECUTING", |
| | | factoryId: this.currentLineId |
| | | |
| | | } |
| | | }).then(res => { |
| | | if (res.data.success) { |
| | | this.loading = false; |
| | | this.productionOrderList = (res.data.result.records || []).map(line => ({ |
| | | value: line.value, |
| | | text: line.text, |
| | | materialNumber: line.materialNumber // 确保映射type字段 |
| | | })); |
| | | console.log(this.productionOrderList) |
| | | |
| | | } else { |
| | | uni.showModal({ |
| | | title: "提示", |
| | | content: res.data.message, |
| | | confirmText: '确定', |
| | | showCancel: false, |
| | | }) |
| | | } |
| | | }).catch(() => { |
| | | this.$tip.loaded(); |
| | | uni.showToast({ |
| | | icon: "error", |
| | | title: res.data.message, |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | |
| | | |
| | | }, |
| | | |
| | | // 点击打印按钮:生成HTML预览并跳转 |
| | | async printHandel() { |
| | | // 1. 验证表单信息 |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | try { |
| | | uni.showLoading({ title: '生成预览中...' }); |
| | | |
| | | uni.showLoading({ |
| | | title: '生成预览中...' |
| | | }); |
| | | |
| | | // 2. 收集打印数据 |
| | | const tagData = this.getReportPrintData(); |
| | | |
| | | |
| | | // 3. 跳转至预览页,并携带打印数据 |
| | | await uni.navigateTo({ |
| | | url: `/pages/finished-product-preview/finished-product-preview?tagData=${encodeURIComponent(JSON.stringify(tagData))}` |
| | | }); |
| | | |
| | | |
| | | uni.hideLoading(); |
| | | } catch (error) { |
| | | uni.hideLoading(); |
| | | console.error('生成预览失败:', error); |
| | | uni.showToast({ title: '预览生成失败', icon: 'none' }); |
| | | uni.showToast({ |
| | | title: '预览生成失败', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 生成成品托标签数据(优化后) |
| | | getReportPrintData() { |
| | | const { formData } = this; |
| | | return { |
| | | |
| | | material: '120034535', |
| | | batch: '25098814', |
| | | model: 'G3-2B259', |
| | | quantity: 216, |
| | | inspectDate: '20250408', |
| | | inspector: '王義/合格', |
| | | date: '2025.08.22' |
| | | |
| | | // batchNo: "25158878", |
| | | // productModel: "三代轮毂轴承单元\\G3-639", |
| | | // palletNo: "11236979", |
| | | // quantity: "107", |
| | | // workshop: "3003", |
| | | // code: "1200143912506070086", |
| | | // planNum:"10016456466565" |
| | | }; |
| | | }, |
| | | getReportPrintData() { |
| | | const { |
| | | formData |
| | | } = this; |
| | | return { |
| | | |
| | | material: '120034535', |
| | | batch: '25098814', |
| | | model: 'G3-2B259', |
| | | quantity: 216, |
| | | inspectDate: '20250408', |
| | | inspector: '王義/合格', |
| | | date: '2025.08.22' |
| | | }; |
| | | }, |
| | | |
| | | changeisSpareList(e) { |
| | | this.formData.isSpare = e; |
| | |
| | | mask: true, |
| | | title: "提交中..." |
| | | }); |
| | | |
| | | try { |
| | | // 表单验证 |
| | | await this.$refs.form.validate(); |
| | | |
| | | this.isSubmitting = true; |
| | | |
| | | // 发送报工请求 |
| | | const response = await this.$http.post(this.url.approval, { |
| | | workOrderNumber: this.formData.workOrderNumber, |
| | | materialCode: this.formData.materialCode, |
| | | materialDescription: this.formData.materialDescription, |
| | | plannedQuantity: this.formData.plannedQuantity, |
| | | inspectionOrderNumber: this.formData.inspectionOrderNumber, |
| | | process: this.formData.process, |
| | | inspectionType: this.formData.inspectionType, |
| | | inspectionQuantity: this.formData.inspectionQuantity, |
| | | inspectionPlan: this.formData.inspectionPlan, |
| | | inspectionTime: this.formData.inspectionTime |
| | | const response = await this.$http.post(this.url.add, { |
| | | factoryId: this.currentLineId, |
| | | orderId: this.reportCode, |
| | | quantity: this.formData.plannedQuantity, |
| | | workOrderId: this.workOrderNumber |
| | | }); |
| | | |
| | | if (response.data.success) { |
| | | this.isShow = true; |
| | | uni.showToast({ |
| | | icon: "success", |
| | | title: '提交成功', |
| | |
| | | margin-top: 45px; |
| | | height: auto; |
| | | } |
| | | |
| | | |
| | | /* 骨架屏样式 */ |
| | | .skeleton-container { |
| | | padding: 20rpx; |
| | | } |
| | | |
| | | |
| | | .skeleton-group { |
| | | margin-bottom: 40rpx; |
| | | } |
| | | |
| | | |
| | | .skeleton-divider { |
| | | height: 40rpx; |
| | | width: 300rpx; |
| | |
| | | animation: skeleton-loading 1.4s ease infinite; |
| | | margin-bottom: 30rpx; |
| | | } |
| | | |
| | | |
| | | .skeleton-item { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 30rpx; |
| | | } |
| | | |
| | | |
| | | .skeleton-label { |
| | | width: 160rpx; |
| | | height: 40rpx; |
| | |
| | | animation: skeleton-loading 1.4s ease infinite; |
| | | margin-right: 20rpx; |
| | | } |
| | | |
| | | |
| | | .skeleton-input { |
| | | flex: 1; |
| | | height: 60rpx; |
| | |
| | | border-radius: 8rpx; |
| | | animation: skeleton-loading 1.4s ease infinite; |
| | | } |
| | | |
| | | |
| | | .skeleton-select { |
| | | flex: 1; |
| | | height: 60rpx; |
| | |
| | | border-radius: 8rpx; |
| | | animation: skeleton-loading 1.4s ease infinite; |
| | | } |
| | | |
| | | |
| | | .skeleton-datetime { |
| | | flex: 1; |
| | | height: 60rpx; |
| | |
| | | border-radius: 8rpx; |
| | | animation: skeleton-loading 1.4s ease infinite; |
| | | } |
| | | |
| | | |
| | | .skeleton-button { |
| | | width: 90%; |
| | | height: 80rpx; |
| | |
| | | animation: skeleton-loading 1.4s ease infinite; |
| | | margin: 40rpx auto; |
| | | } |
| | | |
| | | |
| | | @keyframes skeleton-loading { |
| | | 0% { |
| | | background-position: 100% 50%; |
| | | } |
| | | |
| | | 100% { |
| | | background-position: 0 50%; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |