diff --git a/src/common/http.api.js b/src/common/http.api.js index 8f5e402..9d2dadd 100644 --- a/src/common/http.api.js +++ b/src/common/http.api.js @@ -80,6 +80,8 @@ const install = (Vue, vm) => { // PDA登录接口 pdaLogin: (params = {}) => vm.$u.postJson('/login', params), pdaLogout: (params = {}) => vm.$u.postJson('/logout', params), + // 修改密码:PUT pda/v1/user/updatePassword(system.UpdateUserPasswordParam: password, user_id) + updatePassword: (params = {}) => vm.$u.putJson('/user/updatePassword', params), // 获取配布单列表 getFpmArrangeOrderList: (params = {}) => vm.$u.get('/product/fpmArrangeOrder/getFpmArrangeOrderList', params), // 获取成品配布单详情 diff --git a/src/common/storeFabricBusinessOut.js b/src/common/storeFabricBusinessOut.js index 186908f..12945d8 100644 --- a/src/common/storeFabricBusinessOut.js +++ b/src/common/storeFabricBusinessOut.js @@ -506,8 +506,8 @@ export function orderToFormFields(order) { export function getFineCodeTableColumns(readonly) { const cols = [...FINE_CODE_TABLE_COLUMNS]; - // 操作列放前面,避免 PDA 小屏横向滚动后才看到删除 - if (!readonly) cols.splice(1, 0, { label: '操作', key: 'action', width: 160 }); + // 非只读:勾选列放前面,支持多选批量删除 + if (!readonly) cols.unshift({ label: '选择', key: 'select', width: 100 }); return cols; } @@ -519,7 +519,7 @@ export function mapFineCodeTableRows(list, readonly) { weight: item.weight != null && item.weight !== '' ? `${item.weight}` : '-', bar_code: item.bar_code || '-', position: item.position || '-', - action: readonly ? '' : '删除', + select: readonly ? '' : 'select', })); } @@ -528,6 +528,81 @@ export function getFineCodeTableWidth(columns) { return `${total}rpx`; } +/** 按 group_key 在汇总表或明细表中定位细码分组 */ +export function findFineCodeGroup(order, groupKey) { + if (!order || !groupKey) return null; + const fromSummary = (order.summary_rows || []).find((row) => row.group_key === groupKey); + if (fromSummary) return fromSummary; + return (order.item_data || []).find( + (row) => row.group_key === groupKey || String(row.id) === String(groupKey), + ) || null; +} + +/** 细码列表合计(条数 / 匹数 / 重量,数值已是展示单位) */ +export function sumFineCodeList(list) { + let roll = 0; + let weight = 0; + const count = (list || []).length; + (list || []).forEach((fc) => { + roll += Number(fc.roll) || 0; + weight += Number(fc.weight) || 0; + }); + return { + count, + roll: Number.isInteger(roll) ? roll : Number(roll.toFixed(2)), + weight: Number(weight.toFixed(2)), + }; +} + +/** 细码明细页入参缓存(避免进页再拉整单详情卡住;必须带 orderId 防串单) */ +export const FINE_CODE_PAGE_CACHE_KEY = 'fabric_out_fine_code_page'; + +export function buildFineCodePagePayload(orderId, row) { + if (!orderId || !row) return null; + return { + order_id: Number(orderId), + group_key: row.group_key || String(row.id || ''), + grey_fabric_code: row.grey_fabric_code || '', + grey_fabric_name: row.grey_fabric_name || '', + yarn_batch: row.yarn_batch || '', + machine_number: row.machine_number || '', + fine_codes: [...(row.fine_codes || [])], + }; +} + +export function saveFineCodePagePayload(orderId, row) { + const payload = buildFineCodePagePayload(orderId, row); + if (!payload) return null; + try { + uni.setStorageSync(FINE_CODE_PAGE_CACHE_KEY, payload); + } catch (e) { + // 存储失败时仍可通过 eventChannel 传参 + } + return payload; +} + +/** 读取并清除缓存;仅当 orderId + groupKey 同时匹配时返回,避免串单 */ +export function takeFineCodePagePayload(orderId, groupKey) { + try { + const payload = uni.getStorageSync(FINE_CODE_PAGE_CACHE_KEY) || null; + uni.removeStorageSync(FINE_CODE_PAGE_CACHE_KEY); + if (!payload) return null; + if (Number(payload.order_id) !== Number(orderId)) return null; + if (String(payload.group_key || '') !== String(groupKey || '')) return null; + return payload; + } catch (e) { + return null; + } +} + +export function clearFineCodePagePayload() { + try { + uni.removeStorageSync(FINE_CODE_PAGE_CACHE_KEY); + } catch (e) { + // ignore + } +} + /** * 确认并执行审核状态变更(新增/编辑/查看页共用) * @param {Vue} vm 页面实例,需有 $u.api 与 showError diff --git a/src/components/storefabric/FineCodePopup.vue b/src/components/storefabric/FineCodePopup.vue index 43de99d..42dfc4d 100644 --- a/src/components/storefabric/FineCodePopup.vue +++ b/src/components/storefabric/FineCodePopup.vue @@ -3,35 +3,60 @@ 细码 暂无细码数据 - - - + @@ -49,6 +74,11 @@ export default { list: { type: Array, default: () => [] }, readonly: { type: Boolean, default: false }, }, + data() { + return { + selectedIndexes: [], + }; + }, computed: { visible: { get() { return this.show; }, @@ -63,11 +93,19 @@ export default { tableWidth() { return getFineCodeTableWidth(this.columns); }, - tableScrollHeight() { - const rowHeight = 56; - const headerHeight = 56; - const total = headerHeight + this.list.length * rowHeight; - return `${Math.min(Math.max(total, 112), 480)}rpx`; + selectedCount() { + return this.selectedIndexes.length; + }, + isAllSelected() { + return this.list.length > 0 && this.selectedIndexes.length === this.list.length; + }, + }, + watch: { + show(val) { + if (!val) this.clearSelection(); + }, + list() { + this.clearSelection(); }, }, methods: { @@ -78,10 +116,38 @@ export default { maxWidth: `${col.width}rpx`, }; }, - onCellTap(key, rowIndex) { - if (this.readonly || key !== 'action') return; - const item = this.list[rowIndex]; - if (item) this.$emit('delete', item); + clearSelection() { + this.selectedIndexes = []; + }, + isRowSelected(rowIndex) { + return this.selectedIndexes.indexOf(rowIndex) !== -1; + }, + toggleRow(rowIndex) { + if (this.readonly) return; + const idx = this.selectedIndexes.indexOf(rowIndex); + if (idx === -1) { + this.selectedIndexes = this.selectedIndexes.concat(rowIndex); + } else { + this.selectedIndexes = this.selectedIndexes.filter((i) => i !== rowIndex); + } + }, + toggleSelectAll() { + if (this.readonly) return; + if (this.isAllSelected) { + this.clearSelection(); + return; + } + this.selectedIndexes = this.list.map((_, index) => index); + }, + emitBatchDelete() { + if (this.readonly || !this.selectedCount) return; + const items = this.selectedIndexes + .slice() + .sort((a, b) => a - b) + .map((index) => this.list[index]) + .filter(Boolean); + if (!items.length) return; + this.$emit('batch-delete', items); }, }, }; @@ -115,6 +181,7 @@ export default { .tableScroll { width: 100%; flex-shrink: 0; + max-height: 52vh; } .fineTable { display: inline-block; @@ -161,25 +228,23 @@ export default { color: #3e3e3e; min-height: 80rpx; } -.actionCell { +.selectCell { padding: 12rpx 8rpx; } -.deleteBtn { - display: inline-flex; +.batchBar { + display: flex; align-items: center; - justify-content: center; - min-width: 120rpx; - min-height: 72rpx; - padding: 0 20rpx; - border-radius: 8rpx; - background: #fff1f0; - border: 1rpx solid #ffa39e; - color: #f5222d; - font-size: $pda-font-action; - line-height: 1.2; + justify-content: space-between; + gap: 20rpx; + margin-top: 24rpx; + flex-shrink: 0; +} +.batchHint { + font-size: $pda-font-popup-sub; + color: #666; } .tableTip { - margin-top: 20rpx; + margin-top: 16rpx; font-size: $pda-font-popup-sub; color: #999; text-align: center; diff --git a/src/manifest.json b/src/manifest.json index 106e14d..2767c51 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,8 +2,8 @@ "name" : "浩拓织厂", "appid" : "__UNI__F79F300", "description" : "周尚-浩拓织厂", - "versionName" : "1.1.26", - "versionCode" : 126, + "versionName" : "1.1.27", + "versionCode" : 127, "transformPx" : false, "app-plus" : { "optimization" : { diff --git a/src/pages.json b/src/pages.json index 0d68aca..a3ce403 100644 --- a/src/pages.json +++ b/src/pages.json @@ -605,6 +605,13 @@ "navigationBarTitleText": "查看坯布出仓单", "enablePullDownRefresh": false } + },{ + "path" : "pages/storefabric/storeFabricBusinessOutFineCode", + "style" : + { + "navigationBarTitleText": "细码明细", + "enablePullDownRefresh": false + } },{ "path" : "pages/storefabric/storeFabricWarehouseGroupList", "style" : diff --git a/src/pages/storefabric/storeFabricBusinessOutAdd.vue b/src/pages/storefabric/storeFabricBusinessOutAdd.vue index 8e19873..d6139b8 100644 --- a/src/pages/storefabric/storeFabricBusinessOutAdd.vue +++ b/src/pages/storefabric/storeFabricBusinessOutAdd.vue @@ -92,14 +92,12 @@ @confirm="selectConfirmFun" /> - + + diff --git a/src/pages/storefabric/storeFabricBusinessOutMixin.js b/src/pages/storefabric/storeFabricBusinessOutMixin.js index 55b186b..8f1efe8 100644 --- a/src/pages/storefabric/storeFabricBusinessOutMixin.js +++ b/src/pages/storefabric/storeFabricBusinessOutMixin.js @@ -16,7 +16,6 @@ import { BUSINESS_UNIT_TYPE_DYEING_FACTORY, normalizeOrder, mapToSelectOptions, - getFineCodeScanCode, canScanAtStatus, isLockedOrderStatus, getFormStatusActionButtons, @@ -32,6 +31,7 @@ import { buildScanUpdateParams, getOrderDisplayWeight, getFineCodeDisplayWeight, + saveFineCodePagePayload, } from '@/common/storeFabricBusinessOut'; export default { @@ -53,10 +53,7 @@ export default { BillDataMessage: '', currentScanItem: null, fabricInfoShow: false, - fineCodeShow: false, currentFabricInfo: {}, - currentFineCodes: [], - currentGroupKey: '', scanDetail: getEmptyScanDetail(), scanGroupKeys: [], lastScanCode: '', @@ -342,8 +339,7 @@ export default { this.BarCodeDelStatus = (e.detail.value || []).length > 0; }, /** 扫码新增/删除细码,统一走 scanUpdate 接口 */ - doScanUpdate(scanCode, scanType, options = {}) { - const { refreshFineCodes = false } = options; + doScanUpdate(scanCode, scanType) { uni.showLoading({ title: scanType === 2 ? '删除中...' : '处理中...' }); return this.$u.api.gfmOtherDeliveryOrder.scanUpdate(buildScanUpdateParams({ id: this.orderId, @@ -359,20 +355,17 @@ export default { this.form.summary_rows = order.summary_rows || []; this.auditStatus = order.audit_status; this.applyScanDetail(scanCode, order, scanType); - if (refreshFineCodes) { - const rows = order.summary_rows || []; - const row = rows.find((i) => i.group_key === this.currentGroupKey); - this.currentFineCodes = row ? [...(row.fine_codes || [])] : []; - } this.BillDataMessage = scanType === 2 ? '删除成功' : '扫码出仓成功'; this.QRBarCode = ''; if (scanType === 2) this.showSuccess('删除成功', '删除成功'); else util.playSpeak('扫码出仓成功'); + return order; }) .catch((e) => { uni.hideLoading(); this.showError(e.message || (scanType === 2 ? '删除失败' : '扫码失败')); this.QRBarCode = ''; + throw e; }); }, openFabricInfo(row) { @@ -380,9 +373,30 @@ export default { this.fabricInfoShow = true; }, openFineCode(row) { - this.currentGroupKey = row.group_key || String(row.id); - this.currentFineCodes = [...(row.fine_codes || [])]; - this.fineCodeShow = true; + if (!this.orderId) { + this.showError('请先提交保存后再查看细码'); + return; + } + const groupKey = row.group_key || String(row.id || ''); + if (!groupKey) { + this.showError('缺少细码分组信息'); + return; + } + const readonly = (this.isReadonly || !this.canScan) ? 1 : 0; + const payload = saveFineCodePagePayload(this.orderId, row); + uni.navigateTo({ + url: `./storeFabricBusinessOutFineCode?id=${this.orderId}&groupKey=${encodeURIComponent(groupKey)}&readonly=${readonly}`, + events: { + fineCodeChanged: () => { + if (this.orderId) this.loadOrder(this.orderId); + }, + }, + success: (res) => { + if (payload && res.eventChannel) { + res.eventChannel.emit('initData', payload); + } + }, + }); }, onSummaryCellClick(event) { const row = event && event.lineData; @@ -393,22 +407,6 @@ export default { } this.openFineCode(row); }, - onDeleteFineCode(fineCode) { - if (this.isReadonly || !this.canScan) return; - const scanCode = getFineCodeScanCode(fineCode); - if (!scanCode) { - this.showError('该细码缺少条码,无法删除'); - return; - } - uni.showModal({ - title: '提示', - content: `确认删除细码 ${scanCode}?`, - success: (res) => { - if (!res.confirm) return; - this.doScanUpdate(scanCode, 2, { refreshFineCodes: true }); - }, - }); - }, handleStatusAction(action) { confirmOrderStatusAction(this, { orderId: this.orderId, diff --git a/src/pages/storefabric/storeFabricBusinessOutView.vue b/src/pages/storefabric/storeFabricBusinessOutView.vue index a437859..224e2ab 100644 --- a/src/pages/storefabric/storeFabricBusinessOutView.vue +++ b/src/pages/storefabric/storeFabricBusinessOutView.vue @@ -36,14 +36,12 @@ -