| | |
| | | <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]; |
| | | this.$nextTick(() => { |
| | | const row = this.tableData[index]; |
| | | if (this.$refs.table && this.$refs.table.toggleRowSelection) { |
| | | this.$refs.table.clearSelection && this.$refs.table.clearSelection(); |
| | | this.$refs.table.toggleRowSelection(row, true); |
| | | } |
| | | }); |
| | | 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) { |