+
新增
@@ -276,8 +281,10 @@
@@ -344,7 +351,27 @@
totalJe() {
return (this.dataForm.wtXsckdMxList || []).reduce((sum, row) => sum + (parseFloat(row.je) || 0), 0)
},
-
+ auditStatusText() {
+ const z = this.dataForm.djzt != null && this.dataForm.djzt !== '' ? String(this.dataForm.djzt).trim() : ''
+ if (z) return z
+ return '—'
+ },
+ isBillLockedForEdit() {
+ const z = this.auditStatusText
+ return z === '待审核' || z === '已审核' || z === '一级已审' || z === '待二级' || z === '一级已审/待二级'
+ },
+ formDisabled() {
+ return !!this.isDetail || this.isBillLockedForEdit
+ },
+ dialogTitle() {
+ if (!this.dataForm.id) return '新建'
+ if (this.isDetail) return '详情'
+ const z = this.auditStatusText
+ if (z === '已审核') return '查看(已审核)'
+ if (z === '待审核' || z === '一级已审' || z === '待二级' || z === '一级已审/待二级') return '查看(待审核)'
+ if (z === '草稿') return '编辑'
+ return '编辑'
+ },
},
watch: {},
created() {
@@ -662,14 +689,21 @@
// 恢复序列号信息
_this.restoreSerialNumbers();
})
- }
- else{
-
+ } else {
+ _this.dataForm.djrq = Date.now()
+ _this.dataForm.djlx = '获赠单'
+ _this.dataForm.djzt = '草稿'
+ if (_this.$store && _this.$store.getters && _this.$store.getters.userInfo) {
+ _this.dataForm.jsr = _this.$store.getters.userInfo.userId || _this.$store.getters.userInfo.id
+ }
+ _this.dataForm.wtXsckdMxList = []
+ _this.addHandleWtXsckdMxEntityList()
}
})
},
// 保存草稿:只做基础表单校验,不做序列号强校验,保存时带isDraft:true字段
async saveDraft() {
+ if (this.formDisabled) return
// 确保单据类型字段赋值
this.dataForm.djlx = '获赠单';
this.$refs['elForm'].validate(async (valid) => {
@@ -708,7 +742,8 @@
}
});
},
- async dataFormSubmit() {
+ async submitForAudit() {
+ if (this.formDisabled) return
const mxCheck = validateMxNoEmptyProductRows(this.dataForm.wtXsckdMxList)
if (!mxCheck.valid) {
this.$message.warning(`第 ${mxCheck.emptyLineNos.join('、')} 行未选择商品,请先删除空白行后再提交`)
@@ -720,7 +755,7 @@
// 确保单据类型字段赋值
this.dataForm.djlx = '获赠单';
// 确保单据状态为待审核
- this.dataForm.djzt = '待审核';
+ this.$set(this.dataForm, 'djzt', '待审核')
// 检查是否有明细数据
if (!this.dataForm.wtXsckdMxList || this.dataForm.wtXsckdMxList.length === 0) {
@@ -839,7 +874,7 @@
this.currentBarcodeRow.sptm = barcodeData.barcode
this.currentBarcodeRow.spmc = barcodeData.productName
this.currentBarcodeRow.spbh = barcodeData.productCode
- // 可根据需要回填其他字段
+ this.handleProductChange(this.currentBarcodeRow)
}
},
@@ -1002,6 +1037,7 @@
// 再次强制更新,确保界面刷新
this.$forceUpdate();
});
+ this.fillAvgCostForRow(row);
} else {
if (response.msg !== '操作成功') {
this.$message.error(response.msg || '获取库存失败');
@@ -1009,6 +1045,7 @@
// 使用$set确保响应式更新
this.$set(row, 'kucun', 0);
console.log('设置库存值为0 (失败)');
+ this.fillAvgCostForRow(row);
}
} catch (error) {
console.error('获取库存失败:', error);
@@ -1017,6 +1054,7 @@
}
row.kucun = 0;
console.log('设置库存值为0 (异常)');
+ this.fillAvgCostForRow(row);
} finally {
row.loadingStock = false;
console.log('=== 库存查询完成 ===');
@@ -1348,24 +1386,23 @@
}
},
- // 按入库仓库的加权平均成本带出成本;无库存/无成本记录则保留为空,让用户手工填写
+ // 获赠单:仅当所选入库仓(及展开子仓)在 wt_sp_cost 上有在库数量时,按 Σ(sl×cbj)/Σ(sl) 带出成本;无在库则清空单价由用户手填(可改)
async fillAvgCostForRow(row) {
try {
if (!row.spbh || !row.rkck) return;
+ // 注意:全局 request 对 GET 会把 config.params 赋成 config.data,不能只用 params,否则查询串为空
+ const url = `/api/Extend/WtXsckd/GetWarehouseWeightedAvgCost?spbh=${encodeURIComponent(String(row.spbh))}&ckOrMdId=${encodeURIComponent(String(row.rkck))}`
const res = await request({
- url: '/api/Extend/WtXsckd/GetOutboundCostPrice',
- method: 'get',
- params: { spbh: row.spbh, ckOrMdId: row.rkck }
+ url,
+ method: 'get'
});
const body = res && res.data ? res.data : res;
if (body && body.success && body.data != null && Number(body.data) > 0) {
this.$set(row, 'dj', Number(body.data));
this.handleAmountChange(row);
} else {
- // 未查询到成本或成本为 0 → 允许手动编辑
- if (row.dj === undefined || row.dj === null || row.dj === '') {
- this.$set(row, 'dj', undefined);
- }
+ this.$set(row, 'dj', undefined);
+ this.handleAmountChange(row);
}
} catch (e) {
console.warn('[fillAvgCostForRow] 查询成本失败:', e);
diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtHzd/index.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtHzd/index.vue
index 0a9aee5..de07085 100644
--- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtHzd/index.vue
+++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtHzd/index.vue
@@ -109,16 +109,25 @@
-
+
+
+ 已审核
+ 草稿
+ {{ scope.row.djzt || '待审核' }}
+
+
-
+
- 编辑
- 删除
+ 查看
+ 编辑
+ 审核
+ 反审
+ 删除
@@ -188,6 +197,54 @@
this.getkhOptions();
},
methods: {
+ isDraftRow(row) {
+ return row && String(row.djzt || '').trim() === '草稿'
+ },
+ isPendingAudit(row) {
+ const z = row && String(row.djzt || '').trim()
+ return z === '待审核' || z === ''
+ },
+ openDetail(id) {
+ this.formVisible = true
+ this.$nextTick(() => {
+ this.$refs.NCCForm.init(id, true)
+ })
+ },
+ handleApprove(id) {
+ this.$confirm('确认审核该获赠单?', '提示', { type: 'warning' }).then(() => {
+ request({
+ url: `/api/Extend/WtXsckd/ApproveGeneric/${id}`,
+ method: 'POST',
+ data: {}
+ }).then(res => {
+ this.$message({ type: 'success', message: res.msg || '审核成功', duration: 1200 })
+ this.initData()
+ })
+ }).catch(() => {})
+ },
+ handleReverse(id) {
+ if (!id) return
+ this.$confirm('反审后单据将恢复为可再次处理状态,是否继续?', '反审确认', { type: 'warning' })
+ .then(() => {
+ return request({
+ url: `/api/Extend/WtXsckd/ReverseApproval/${id}`,
+ method: 'POST',
+ data: {}
+ })
+ })
+ .then((res) => {
+ const d = (res && res.data) || {}
+ const ok = d.success === true || String(res && res.code) === '200'
+ const msg = d.message || res.msg || (ok ? '反审成功' : '操作失败')
+ if (ok) {
+ this.$message.success(msg)
+ this.initData()
+ } else {
+ this.$message.error(msg)
+ }
+ })
+ .catch(() => {})
+ },
getrkckOptions(){
previewDataInterface('681758216954053893').then(res => {
this.rkckOptions = res.data
@@ -321,6 +378,7 @@
for (let key in this.query) {
this.query[key] = undefined
}
+ this.query.djlx = '获赠单'
this.listQuery = {
currentPage: 1,
pageSize: 20,
diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtPl/Form.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtPl/Form.vue
index e6c269f..b0adbd7 100644
--- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtPl/Form.vue
+++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtPl/Form.vue
@@ -22,6 +22,12 @@
+
+
+
+ 数值越小越靠前;留空则排序靠后
+
+