| | |
| | | <template> |
| | | <view class="page"> |
| | | <!-- 根元素增加动态类,弹窗出现时附加 has-overlay,用于控制底层交互与层级 --> |
| | | <view class="page" :class="{'has-overlay': (isShowUserSelect || isShow || barcodeIsShow)}"> |
| | | <view class="status-section"> |
| | | <!-- 报工记录表 --> |
| | | <view class="report-table-wrapper"> |
| | |
| | | <tbody> |
| | | <tr> |
| | | <td>{{ nowTime }}</td> |
| | | <td>{{ staffNo || '-' }}</td> |
| | | <td>{{ staffName || '-' }}</td> |
| | | <td>{{ orderNo || '-' }}</td> |
| | | <td>{{ order.daa003 || '-' }}</td> |
| | | <td>{{ planQtyDisplay }}</td> |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 已移除: 产品编码 / 产品名称 / 产品规格 输入区域 --> |
| | | <!-- 不良数量 --> |
| | | <view class="print-section" style="margin-top:10px;"> |
| | | <view class="barcode-info"> |
| | |
| | | </view> |
| | | |
| | | <!-- 报工人选择 --> |
| | | <!-- 替换原有报工人选择区域 --> |
| | | <view class="current-user-section"> |
| | | <text>当前报工人:</text> |
| | | <text class="current-user-name">{{ staffNo ? staffNo.split(':')[1] : '未选择' }}</text> |
| | | <text class="current-user-name">{{ staffName || '未选择' }}</text> |
| | | <button class="select-user-btn" @click="isShowUserSelect = true">选人</button> |
| | | </view> |
| | | |
| | | <!-- 选人弹窗 --> |
| | | <view v-if="isShowUserSelect" class="overlay"> |
| | | <view class="popup user-select-popup"> |
| | | <!-- 一行三列的选人按钮 --> |
| | | <view class="user-list-grid"> |
| | | <button v-for="(u, index) in users" :key="index" |
| | | class="user-list-btn" |
| | | @click="selectUser(u)"> |
| | | {{ u.split(':')[1] }} |
| | | </button> |
| | | <view class="user-list-scroll"> |
| | | <view class="user-list-grid"> |
| | | <button v-for="(u, index) in users" |
| | | :key="index" |
| | | class="user-list-btn" |
| | | :class="{'selected': u === staffNo}" |
| | | @click="selectUser(u)"> |
| | | {{ u.split(':')[1] }} |
| | | </button> |
| | | </view> |
| | | </view> |
| | | <view style="text-align:center;margin-top:18px;"> |
| | | <view class="user-popup-footer"> |
| | | <button class="clean-btn" style="width: 60%;" @click="isShowUserSelect = false">关闭</button> |
| | | </view> |
| | | </view> |
| | |
| | | calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); }, |
| | | calculatedTotalProduction() { return (this.kgQty || 0) + this.calculatedCurrentCount; }, |
| | | calculatedDefectiveCount() { return this.calculatedTotalProduction - (this.sQuantity || 0); }, |
| | | planQtyDisplay() { return this.order.planQty || this.order.planQuantity || this.order.daa007 || this.order.daa010 || 0; } |
| | | planQtyDisplay() { return this.order.planQty || this.order.planQuantity || this.order.daa007 || this.order.daa010 || 0; }, |
| | | // 新增:解析姓名 |
| | | staffName() { |
| | | if (!this.staffNo) return ''; |
| | | const parts = this.staffNo.split(':'); |
| | | return parts.length > 1 ? parts[1] : this.staffNo; |
| | | } |
| | | }, |
| | | created() { |
| | | this.initializeData(); |
| | |
| | | const d = new Date(), p = n => n.toString().padStart(2, '0'); |
| | | this.nowTime = `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`; |
| | | }, |
| | | // 初始化数据 |
| | | initializeData() { |
| | | this.productionCount = this.printedCount = this.defectiveCount = 0; |
| | | this.icount = 1; this.bqty = 0; this.sQuantity = 0; this.kgQty = 0; |
| | | this.initialValue = 0; this.qqty = 0; |
| | | this.isGeneratingBarcode = false; this.lastGenerateTime = 0; this.generateRequestId = null; |
| | | }, |
| | | // 重置条码生成状态 |
| | | resetGenerateState() { |
| | | this.isGeneratingBarcode = false; this.generateRequestId = null; this.lastGenerateTime = 0; |
| | | this.$showMessage("已重置条码生成状态"); |
| | | }, |
| | | // 刷新数据 |
| | | refresh() { |
| | | this.$sendPostRequest({ |
| | | url: "http://192.168.0.94:9095/Numerical/RefreshDev", |
| | |
| | | contentType: "application/json" |
| | | }).then(r => { r.code == 200 ? this.fetchData(true) : this.$showMessage("同步失败"); }); |
| | | }, |
| | | // 工单切换 |
| | | onDaa003Change(v) { |
| | | let o = this.lineList[this.DAA003List.indexOf(v)]; |
| | | this.orderId = o.id; this.orderNo = o.daa001; |
| | |
| | | uni.setStorageSync('orderNo', this.orderNo); |
| | | this.fetchData(false); |
| | | }, |
| | | // 拉取数据 |
| | | fetchData(flag) { |
| | | if (!this.orderId && !this.orderNo) return; |
| | | this.getOrderById(); |
| | |
| | | }); |
| | | } |
| | | }, |
| | | // 旧弹窗选人 |
| | | toggleUser(u) { |
| | | if (!u) return; |
| | | this.user = this.user === u ? null : u; |
| | | this.staffNo = this.user; |
| | | }, |
| | | // 提交不良数量 |
| | | confirmCustomAmount() { |
| | | if (!this.customAmount || isNaN(Number(this.customAmount))) { |
| | | this.$showMessage('请输入有效的数量'); return; |
| | |
| | | this.customAmount = ''; |
| | | }).catch(() => this.$showMessage('报废数量填写失败,请重试')); |
| | | }, |
| | | // 保存 |
| | | save() { |
| | | if (!this.staffNo) { this.$showMessage('请选择报工人'); return; } |
| | | uni.showToast({ title: '保存成功', icon: 'success' }); |
| | | }, |
| | | // 取消 |
| | | cancel() { uni.showToast({ title: '取消操作', icon: 'none' }); }, |
| | | // 获取工单信息 |
| | | getOrderById() { |
| | | this.$post({ url: "/Womdaa/GetWomdaaById", data: { orderId: this.orderId, orderNo: this.orderNo } }) |
| | | .then(res => { |
| | |
| | | this.productionCount = this.order.todayOutput || 0; |
| | | }); |
| | | }, |
| | | // 获取所有员工 |
| | | getXS0101() { |
| | | this.$post({ url: "/MesStaff/GetAllXS0101" }) |
| | | .then(res => { |
| | |
| | | this.users = this.staff.map(s => s.staffNo + ":" + s.staffName); |
| | | }); |
| | | }, |
| | | // 获取工单打印信息 |
| | | getWomdaaPrintById() { |
| | | this.$post({ url: "/Womdaa/GetWomdaaPrintById", data: { orderId: this.orderId } }) |
| | | .then(res => { |
| | |
| | | if (this.bqty === 0) this.Completed(); |
| | | }).catch(() => { }); |
| | | }, |
| | | // 工单完成 |
| | | Completed() { |
| | | this.$post({ url: "/MesOrderSta/Completed", data: { orderId: this.orderId, orderNo: this.orderNo } }); |
| | | }, |
| | | // 蓝牙初始化 |
| | | init() { |
| | | try { |
| | | const v = this.getAndroidVersion(); |
| | |
| | | } |
| | | } catch (e) { } |
| | | }, |
| | | // 关闭弹窗并重置 |
| | | deleteBarcode() { |
| | | this.isShow = false; |
| | | this.isGeneratingBarcode = false; |
| | |
| | | flex-direction: column; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .page.has-overlay .status-section > :not(.overlay) { |
| | | pointer-events: none; |
| | | } |
| | | |
| | | .page.has-overlay .status-section > .overlay { |
| | | pointer-events: auto; |
| | | } |
| | | |
| | | .report-table-wrapper { |
| | | margin-bottom: 8px; |
| | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-top: 12px; |
| | | position: relative; |
| | | z-index: 10; |
| | | } |
| | | |
| | | .save-btn, .cancel-btn { |
| | |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | z-index: 1000; |
| | | } |
| | | |
| | | .popup { |
| | |
| | | max-height: 80vh; |
| | | overflow-y: auto; |
| | | border-radius: 8px; |
| | | z-index: 1001; |
| | | } |
| | | |
| | | .clean-btn { |
| | |
| | | .user-select-popup { |
| | | width: 480px; |
| | | max-width: 96vw; |
| | | padding: 32px 24px 24px 24px; |
| | | max-height: 80vh; |
| | | padding: 0; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: flex-start; |
| | | } |
| | | |
| | | /* 一行三列的选人按钮 */ |
| | | .user-list-scroll { |
| | | flex: 1 1 auto; |
| | | overflow-y: auto; |
| | | padding: 32px 24px 0 24px; |
| | | } |
| | | |
| | | .user-list-grid { |
| | | display: grid; |
| | | grid-template-columns: repeat(3, 1fr); |
| | | gap: 18px 18px; |
| | | margin-bottom: 8px; |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .user-popup-footer { |
| | | flex-shrink: 0; |
| | | padding: 18px 24px 24px 24px; |
| | | background: #fff; |
| | | text-align: center; |
| | | } |
| | | |
| | | .user-list-btn { |
| | |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .user-list-btn.selected { |
| | | background: #ff9500; |
| | | } |
| | | |
| | | @media (max-width:1400px) { |
| | | input.highlight { |
| | | font-size: 14px; |