| | |
| | | <scroll-view class="content"> |
| | | <view v-if="currentTab === 7" class="tab-content"> |
| | | <view class="content"> |
| | | <view class="top-right"> |
| | | <!--<view class="top-right"> |
| | | <button class="refresh-btn" @click="refresh">刷新</button> |
| | | </view> |
| | | </view>--> |
| | | <view> |
| | | <h4>一台机台只能选择一条工单(多选默认为最后一条)</h4> |
| | | </view> |
| | | <view class="section top-section"> |
| | | <!--显示当前机台--> |
| | | <view class="form-row"> |
| | | <view> |
| | | <input v-model="machineName" |
| | | disabled="true" |
| | | type="text" |
| | | class="machine-name-box" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="form-row"> |
| | | <view> |
| | | <label style="float: left;font-family: fantasy;font-size: 33px;margin-top: 20px;">第一步选择工单:</label> |
| | | <view class="form-row align-row"> |
| | | <input v-model="machineName" |
| | | disabled="true" |
| | | type="text" |
| | | class="machine-name-box" /> |
| | | <view class="form-group"> |
| | | <label class="order-label">第一步选择工单:</label> |
| | | <button class="print-btn" @click="isShowTab">选择工单</button> |
| | | </view> |
| | | <view class="top-right"> |
| | | <button class="refresh-btn" @click="refresh">刷新</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa008" /><!--派工数量--> |
| | | </uni-td> |
| | | <!--<uni-td align="center"> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa008" />--> |
| | | <!--工单数量--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa008" />--><!--工单数量--> |
| | | <!--</uni-td>--> |
| | | <uni-td align="center"> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa018" /><!--工单状态--> |
| | |
| | | |
| | | <div style="height: 400px; overflow: auto;"> |
| | | <table> |
| | | |
| | | <view class="section card"> |
| | | <uni-table ref="table" |
| | | type="selection" |
| | | border |
| | | stripe |
| | | emptyText="暂无更多数据" |
| | | class="large-selection-table" |
| | | @selection-change="selectionChange"> |
| | | <uni-table ref="table" type="selection" border stripe emptyText="暂无更多数据" |
| | | class="large-selection-table" @selection-change="selectionChange"> |
| | | <uni-tr> |
| | | <uni-th type="selection" align="center" class="th" style="width: 70px;"></uni-th> <!-- 新增选择列 --> |
| | | <uni-th align="center" class="th" style="color: #FFFFFF; width: 170px;">工序</uni-th> |
| | | <uni-th align="center" class="th" style="color: #FFFFFF; width: 490px;">工单号</uni-th> |
| | | <uni-th align="center" class="th" style="color: #FFFFFF; width: 250px;">产品编码</uni-th> |
| | |
| | | <!--<uni-th align="center" class="th" style="color: #FFFFFF; width: 100px;">选择</uni-th>--> |
| | | </uni-tr> |
| | | <uni-tr v-for="(item, index) in tableData" |
| | | :key="item.id || index" <!-- 修改: 优先使用后端 id --> |
| | | :key="index" |
| | | :class="{'row-selected': selectedIndexs.includes(index)}" |
| | | @click="onRowClick(index)" |
| | | style="cursor: pointer;"> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.procName" /><!--工序--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.procName" /><!--工序--> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.daa001" /> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa001" /> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.daa002" /> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa002" /> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.daa003" /><!--产品名称--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa003" /><!--产品名称--> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.daa004" /><!--规格--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa004" /><!--规格--> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.daa011" /><!--已生产数量--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa011" /><!--已生产数量--> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" :value="(item.daa008 || 0) - (item.daa011 || 0)" /><!--未生产数量--> |
| | | <input class="form-input" disabled="true" type="text" :value="(item.daa008 || 0) - (item.daa011 || 0)" /><!--未生产数量--> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.daa008" /><!--派工数量--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa008" /><!--派工数量--> |
| | | </uni-td> |
| | | <!--<uni-td align="center"> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa008" />--><!--工单数量--> |
| | | <!--</uni-td>--> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.daa018" /><!--工单状态--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.daa018" /><!--工单状态--> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input row-input" disabled="true" type="text" v-model="item.staffName" /><!--报工人--> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.staffName" /><!--报工人--> |
| | | </uni-td> |
| | | </uni-tr> |
| | | </uni-table> |
| | |
| | | this.refresh(); |
| | | }, |
| | | methods: { |
| | | onRowClick(index) { // 修改: 整行点击实现单选 |
| | | const row = this.tableData[index]; |
| | | if (!row) return; |
| | | // 单选: 只保留当前索引 |
| | | this.selectedIndexs = [index]; // 保留已有注释逻辑 |
| | | // 如果 uni-table 暴露方法则同步复选框状态 |
| | | if (this.$refs.table) { |
| | | this.$refs.table.clearSelection && this.$refs.table.clearSelection(); |
| | | this.$refs.table.toggleRowSelection && this.$refs.table.toggleRowSelection(row, true); |
| | | } |
| | | onRowClick(index) { |
| | | this.selectedIndexs = [index]; // 单选 |
| | | // 手动触发 selectionChange 以同步复选框 |
| | | this.selectionChange({ detail: { index } }); |
| | | }, |
| | | checkForUpdate() { |
| | | this.$post({ |
| | |
| | | let day = String(date.getDate()).padStart(2, '0'); // 获取日期并补零 |
| | | return `${year}-${month}-${day}`; // 返回格式化后的字符串 |
| | | }, |
| | | selectionChange(e) { // 修改: 使用 selection 数组而不是 index |
| | | // 单选直接赋值(保留原注释) |
| | | const selection = e.detail && e.detail.selection ? e.detail.selection : []; |
| | | if (selection.length === 0) { |
| | | this.selectedIndexs = []; |
| | | return; |
| | | } |
| | | // 多选时只保留最后一个(保留原“多选默认为最后一条”逻辑) |
| | | const last = selection[selection.length - 1]; |
| | | const idx = this.tableData.findIndex(r => (r.id || r.daa001) === (last.id || last.daa001)); |
| | | this.selectedIndexs = idx >= 0 ? [idx] : []; |
| | | // 强制只勾选最后一个(防止多选残留) |
| | | if (selection.length > 1 && this.$refs.table) { |
| | | this.$nextTick(() => { |
| | | this.$refs.table.clearSelection && this.$refs.table.clearSelection(); |
| | | this.$refs.table.toggleRowSelection && this.$refs.table.toggleRowSelection(last, true); |
| | | }); |
| | | } |
| | | }, |
| | | selectionChange(e) { |
| | | // 单选直接赋值 |
| | | this.selectedIndexs = [e.detail.index]; |
| | | }, |
| | | |
| | | selectedItems() { |
| | | return this.selectedIndexs.map(i => this.tableData[i]) |
| | |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | |
| | | /* 追加行内输入不拦截点击 */ |
| | | .row-input { pointer-events: none; } /* 新增: 避免 input 抢占点击 */ |
| | | |
| | | |
| | | :deep(.checkbox), |
| | | :deep(.checkbox__inner) { |
| | |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | background-color: rgba(0, 0, 0, 0.5); |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | .overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | background-color: rgba(0, 0, 0, 0.5); |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | z-index: 2000; // 增加z-index,确保弹窗在刷新按钮之上 |
| | | } |
| | | |
| | | .popup { |
| | | background-color: #fff; |
| | |
| | | } |
| | | |
| | | .machine-name-box { |
| | | border: 2px solid #e53935; /* 红色边框 */ |
| | | border: 2px solid #007aff; /* 蓝色边框 */ |
| | | border-radius: 8px; |
| | | font-family: fantasy; |
| | | font-size: 33px; |
| | | margin-top: 20px; |
| | | padding: 15px 48px; /* 上下20px,左右48px,增加内边距 */ |
| | | width: 500px; /* 更宽,保证内容完整显示 */ |
| | | padding: 15px 28px; /* 上下20px,左右48px,增加内边距 */ |
| | | width: 300px; /* 更宽,保证内容完整显示 */ |
| | | height: 70px; /* 增加高度 */ |
| | | box-sizing: border-box; |
| | | background: #fff; |
| | |
| | | display: block; |
| | | } |
| | | |
| | | .top-section { |
| | | position: relative; |
| | | display: flex; |
| | | flex-direction: column; |
| | | margin-bottom: 20px; |
| | | padding: 20px 10px; |
| | | } |
| | | |
| | | .form-row.align-row { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | position: relative; |
| | | width: 100%; |
| | | } |
| | | |
| | | .machine-name-box { |
| | | flex: 1 1 45%; |
| | | margin-right: 20px; |
| | | } |
| | | |
| | | .form-group { |
| | | display: flex; |
| | | align-items: center; |
| | | flex: 1 1 45%; |
| | | justify-content: flex-start; |
| | | } |
| | | |
| | | .order-label { |
| | | font-family: fantasy; |
| | | font-size: 33px; |
| | | margin-top: 20px; |
| | | margin-right: 10px; |
| | | float: none; |
| | | } |
| | | |
| | | .print-btn { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .top-right { |
| | | position: absolute; |
| | | top: -30px; // 往上移 |
| | | right: 0; |
| | | z-index: 1000; |
| | | } |
| | | |
| | | /* 放大表头和表格内容字体 */ |
| | | .th, |
| | | .uni-th, |