feat(purchase-order): 优化采购订单审批与产品选择功能

- 在流程实例审批回调中增加公司领导审批处理逻辑
- 移除重复的审批通过处理代码块
- 修复采购订单详情页 purchaserMobile 字段重复显示问题
- 为产品选择组件新增厂商编码参数传递
- 增加当前厂商编码变量并完善相关校验逻辑
- 更新含税金额计算方法,加入税额字段自动计算
- 优化总金额计算方式,确保数据同步更新
- 强化产品选择前的类型与厂商必选校验规则
dev_1.0.0
chenhao 2025-11-28 09:35:09 +08:00
parent b952b9610a
commit c99ba06d89
3 changed files with 33 additions and 20 deletions

View File

@ -76,9 +76,6 @@
<el-form-item label="联系电话" prop="purchaserMobile">
<span>{{ form.purchaserMobile }}</span>
</el-form-item>
</el-col>
<span>{{ form.purchaserMobile }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系邮箱" prop="purchaserEmail">
@ -181,7 +178,7 @@
</el-form>
<select-user :visible.sync="purchaserSelectOpen" @user-selected="handlePurchaserSelect"></select-user>
<select-user :visible.sync="ownerSelectOpen" @user-selected="handleOwnerSelect"></select-user>
<select-product :visible.sync="productSelectOpen" @product-selected="handleProductSelected" :product-type="currentProductType"></select-product>
<select-product :visible.sync="productSelectOpen" @product-selected="handleProductSelected" :vendor-code="currentVendorCode" :product-type="currentProductType"></select-product>
</div>
</template>
@ -210,6 +207,7 @@ export default {
editingProductIndex: -1,
//
currentProductType: null,
currentVendorCode: null,
//
productTypeOptions: [],
//
@ -273,7 +271,8 @@ export default {
computed: {
totalAmountWithTax() {
const total = this.form.omsPurchaseOrderItemList?.reduce((acc, cur) => acc + (cur.amountTotal || 0), 0);
return preciseCurrencyRound(total) || 0;
this.form.totalAmount=preciseCurrencyRound(total) || 0;
return this.form.totalAmount;
},
totalAmountWithoutTax() {
const total = this.form.omsPurchaseOrderItemList?.reduce((acc, cur) => {
@ -344,6 +343,10 @@ export default {
this.$modal.msgWarning("请先选择产品类型");
return;
}
if (!this.currentVendorCode){
this.$modal.msgWarning("请先选择制造商");
return;
}
this.editingProductIndex = index;
this.currentProductType = this.form.omsPurchaseOrderItemList[index].productType;
this.productSelectOpen = true;
@ -389,9 +392,11 @@ export default {
/** 计算含税小计 */
calculateRowTotal(row) {
if (row.quantity != null && row.price != null) {
row.amountTotal = Math.round(row.quantity * row.price * 100) / 100;
row.amountTotal = preciseCurrencyRound(row.quantity * row.price);
row.taxTotal = row.amountTotal - preciseCurrencyRound(row.amountTotal / (1 + row.taxRate));
} else {
row.amountTotal = 0;
row.taxTotal = 0;
}
},
/** 获取厂商列表 */
@ -405,9 +410,11 @@ export default {
if (vendorId) {
this.selectedVendor = this.vendorOptions.find(item => item.vendorId === vendorId) || {};
this.form.warehouseId = this.selectedVendor.warehouseId
this.currentVendorCode=this.selectedVendor.vendorCode;
} else {
this.selectedVendor = {};
this.form.warehouseId = null;
this.currentVendorCode = null;
}
},
/** 处理采购员选择 */

View File

@ -60,6 +60,10 @@ export default {
productType: {
type: String,
default: '',
},
vendorCode: {
type: String,
default: '',
}
},
data() {
@ -76,7 +80,8 @@ export default {
pageSize: 10,
productCode: null,
model: null,
type: this.productType // Pass productType to query params
type: this.productType, // Pass productType to query params
vendorCode:null
},
};
},
@ -92,6 +97,12 @@ export default {
if (this.visible) {
this.getList();
}
},
vendorCode(val) {
this.queryParams.vendorCode = val;
if (this.visible) {
this.getList();
}
}
},
methods: {

View File

@ -343,6 +343,14 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService, To
@Override
public boolean multiInstanceApproveCallback(String activityName, ProcessInstance processInstance) {
String flowBusinessKey = processInstance.getBusinessKey();
String[] split = flowBusinessKey.split("#");
String businessKey = split.length > 1 ? split[1] : split[0];
Map<String, Object> processVariables = processInstance.getProcessVariables();
Integer approveBtn = (Integer) processVariables.get("approveBtn");
if ("公司领导".equals(activityName) && approveBtn == 1) {
handleCompanyLeaderApproval(businessKey);
}
return TodoCommonTemplate.super.multiInstanceApproveCallback(activityName, processInstance);
}
@ -381,19 +389,6 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService, To
// 审批驳回处理
if (approveBtn.equals(0)) {
handleRejectOrder( businessKey);
} else if (approveBtn.equals(1)) {
// 审批通过处理
if ("公司领导".equals(taskName)) {
handleCompanyLeaderApproval(businessKey);
// //黄雪秋处理 流程状态更改
// if (ShiroUtils.getUserId().equals(118L)) {
// handleCompanyLeaderApproval(businessKey);
// }
}
}
return TodoCommonTemplate.super.todoApproveCallback(todo);