diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue index f166c2a..a4519bd 100644 --- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue @@ -5,19 +5,18 @@ - + - - + - - + + @@ -34,8 +33,8 @@ - - + + @@ -80,17 +79,15 @@ - + - + - - @@ -116,41 +113,59 @@ - - - - - + + + + + + + + + + + - - - + - + - + - + - - + + + + + + + + + + + + + + - - - - - + - - + + @@ -164,14 +179,24 @@ {{ scope.row.djzt || '待审核' }} - + + + + @@ -192,6 +217,7 @@ import { previewDataInterface } from '@/api/systemData/dataInterface' import { promptApprovalRemark, postApproveSalesOutbound, postRejectGeneric } from '@/utils/wtRejectApproval' import { formatWtSkzhDisplay } from '@/utils/wtComboSkzhDisplay' + import { dynamicText } from '@/filters' export default { components: { NCCForm, DetailView, ExportBox }, data() { @@ -241,13 +267,29 @@ { prop: 'sy_pch', label: '收银批次' }, { prop: 'zy', label: '摘要' }, { prop: 'djlx', label: '单据类型' }, + { prop: 'thdh', label: '关联退货单号' }, ], cjckOptions : [], rkckOptions : [], skzhOptions : [], } }, - computed: {}, + computed: { + /** + * 操作列宽度:表格列整表同宽,按当前页各行「可见按钮」估算宽度的最大值(与下方 v-if 一致)。 + */ + salesOutboundOperationColWidth() { + const rows = this.list || [] + const minW = 80 + if (!rows.length) return minW + let maxW = minW + for (let i = 0; i < rows.length; i++) { + const w = this.getSalesOutboundRowActionEstimatedWidth(rows[i]) + if (w > maxW) maxW = w + } + return maxW + } + }, created() { this.initData() this.getcjckOptions(); @@ -255,6 +297,14 @@ this.getskzhOptions(); }, methods: { + displayText(val) { + if (val == null || String(val).trim() === '') return '无' + return String(val) + }, + formatCjckDisplay(row) { + if (!row) return '' + return dynamicText(row.cjck, this.cjckOptions) + }, /** 非「后台」来源:不走 ERP 审核(与后端 IsSalesOutboundSkipErpAudit 一致;ly 空视为后台需审) */ isSkipErpAuditSource(row) { if (!row) return false @@ -283,6 +333,26 @@ if (row.djzt === '草稿' || row.djzt === '已审核' || row.djzt === '审核不通过') return false return this.canFirstApprove(row) || this.canSecondApprove(row) }, + /** 列表行 thdh:后端填充的关联销售退货单号(逗号分隔),有值则不可删 */ + hasLinkedSalesReturn(row) { + if (!row) return false + const t = row.thdh + return t != null && String(t).trim() !== '' + }, + canDeleteSalesOutbound(row) { + return !this.hasLinkedSalesReturn(row) + }, + /** 与操作列按钮展示条件一致,估算单行操作区所需宽度(px) */ + getSalesOutboundRowActionEstimatedWidth(row) { + if (!row) return 80 + let w = 44 + if (this.canEditDraft(row)) w += 44 + if (this.canFirstApprove(row)) w += 72 + if (this.canSecondApprove(row)) w += 72 + if (this.canRejectAudit(row)) w += 92 + if (this.canDeleteSalesOutbound(row)) w += 44 + return w + 32 + }, formatLy(ly) { if (ly == null || ly === '') return '无' if (ly === '门店') return '门店(收银台)' @@ -374,16 +444,23 @@ } query.djlx='销售出库单'; - request({ - url: `/api/Extend/WtXsckd`, - method: 'GET', - data: query - }).then(res => { - this.list = res.data.list - this.total = res.data.pagination.total - this.listLoading = false - }) - }, + request({ + url: `/api/Extend/WtXsckd`, + method: 'GET', + data: query + }) + .then(res => { + this.list = res.data.list || [] + this.total = (res.data.pagination && res.data.pagination.total) || 0 + }) + .catch(() => { + this.list = [] + this.total = 0 + }) + .finally(() => { + this.listLoading = false + }) + }, handleDel(id) { this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { type: 'warning' @@ -442,34 +519,52 @@ const res = val.map(item => item.id) this.multipleSelection = res }, - handleBatchRemoveDel() { - if (!this.multipleSelection.length) { - this.$message({ - type: 'error', - message: '请选择一条数据', - duration: 1500, - }) - return - } - const ids = this.multipleSelection - this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', { - type: 'warning' - }).then(() => { - request({ - url: `/api/Extend/WtXsckd/batchRemove`, - method: 'POST', - data: ids , - }).then(res => { - this.$message({ - type: 'success', - message: res.msg, - onClose: () => { - this.initData() - } - }); - }) - }).catch(() => { }) - }, + handleBatchRemoveDel() { + if (!this.multipleSelection.length) { + this.$message({ + type: 'error', + message: '请选择一条数据', + duration: 1500 + }) + return + } + const deletable = this.multipleSelection.filter((id) => { + const row = this.list.find((r) => r.id === id) + return row && this.canDeleteSalesOutbound(row) + }) + if (!deletable.length) { + this.$message({ + type: 'warning', + message: '所选单据均已关联销售退货,无法删除', + duration: 2000 + }) + return + } + const skipped = this.multipleSelection.length - deletable.length + const tip = + skipped > 0 + ? `将删除 ${deletable.length} 条,已跳过 ${skipped} 条(已关联销售退货)。是否继续?` + : '您确定要删除这些数据吗, 是否继续?' + this.$confirm(tip, '提示', { + type: 'warning' + }) + .then(() => { + request({ + url: `/api/Extend/WtXsckd/batchRemove`, + method: 'POST', + data: deletable + }).then((res) => { + this.$message({ + type: 'success', + message: res.msg, + onClose: () => { + this.initData() + } + }) + }) + }) + .catch(() => {}) + }, openDetail(id) { if (!id) return this.detailVisible = true @@ -516,18 +611,19 @@ this.detailVisible = false if (isrRefresh) this.reset() }, - reset() { - for (let key in this.query) { - this.query[key] = undefined - } - this.listQuery = { - currentPage: 1, - pageSize: 20, - sort: "desc", - sidx: "", - } - this.initData() - } + reset() { + for (const key in this.query) { + this.query[key] = undefined + } + this.query.djlx = '销售出库单' + this.listQuery = { + currentPage: 1, + pageSize: 20, + sort: 'desc', + sidx: '' + } + this.initData() + } } } @@ -535,4 +631,22 @@ .cell-nowrap { white-space: nowrap; } + +.wt-xsckd-table { + ::v-deep .el-table .cell { + white-space: nowrap; + } +} + +.wt-xsckd-return-none { + color: #909399; + font-size: 13px; +} + +.wt-xsckd-actions { + display: inline-flex; + flex-wrap: nowrap; + align-items: center; + vertical-align: middle; +} \ No newline at end of file