Browse Source

[fix]

基础资料 员工领料单
修改编辑员工领料单页面关联订单号为文本输入框,取消下拉框初始化方法;
修改编辑员工领料单页面领料单编号输入框为只读;
修改编辑物料子表显示结构、添加编辑列方法;
新增导入表格单元格编辑js;
修改页面提交函数,新增拼接表单数据与子表数据为领料单对象方法;
修改controller保存修改接口,添加注解;
修改去除详情页面表格内编辑功能;
dev
王晓迪 4 months ago
parent
commit
d4dfa555aa
  1. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseEmpRequisiteOrderController.java
  2. 8
      ruoyi-admin/src/main/resources/templates/system/empRequisiteOrder/detail.html
  3. 118
      ruoyi-admin/src/main/resources/templates/system/empRequisiteOrder/edit.html

2
ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseEmpRequisiteOrderController.java

@ -210,7 +210,7 @@ public class BaseEmpRequisiteOrderController extends BaseController
@Log(title = "员工领料单", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(BaseEmpRequisiteOrderVO baseEmpRequisiteOrderVO)
public AjaxResult editSave(@RequestBody BaseEmpRequisiteOrderVO baseEmpRequisiteOrderVO)
{
return toAjax(baseEmpRequisiteOrderService.updateBaseEmpRequisiteOrder(baseEmpRequisiteOrderVO));
}

8
ruoyi-admin/src/main/resources/templates/system/empRequisiteOrder/detail.html

@ -83,19 +83,19 @@
},
{title: '型号',field: 'materialModel',align: 'center'},
{title: '规格',field: 'specification',align: 'center'},
{ title: '描述',field: 'describe',align: 'center'},
{ title: '描述',field: 'describe',align: 'center',visible: false},
{title: '品牌',field: 'brand',align: 'center'},
{ title: '单位',field: 'unit',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sysUnitClassDatas, value);
}
},
{title: '半成品类型',field: 'processMethod',align: 'center',
{title: '半成品类型',field: 'processMethod',align: 'center',visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{title: '物料的数量', field: 'materialNum',align: 'center',editable: true,},
{title: '物料的数量', field: 'materialNum',align: 'center'},
{title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',},
{title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',},
{title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
@ -104,7 +104,7 @@
{title: '录入时间',field: 'createTime',align: 'center',visible: false },
{title: '更新人',field: 'updateBy',align: 'center',visible: false},
{title: '上次更新时间',field: 'updateTime',align: 'center',visible: false},
{title: '备注',field: 'remark',align: 'center',editable: true},
{title: '备注',field: 'remark',align: 'center'},
],
onEditableSave:function(field, row, oldValue, $el){
row.materialNoRmbSum = Number(row.materialNum * Number(row.materialNoRmb)).toFixed(2);

118
ruoyi-admin/src/main/resources/templates/system/empRequisiteOrder/edit.html

@ -2,6 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改员工领料单')" />
<th:block th:include="include :: bootstrap-editable-css"/>
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -10,11 +12,11 @@
<div class="form-group">
<label class="col-sm-3 control-label">领料单编号:</label>
<div class="col-sm-8">
<input name="requisitieCode" th:field="*{requisitieCode}" class="form-control" type="text">
<input name="requisitieCode" th:field="*{requisitieCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联销售订单号:</label>
<label class="col-sm-3 control-label">关联订单号:</label>
<div class="col-sm-8">
<input name="correlationCode" th:field="*{correlationCode}" class="form-control" type="text">
</div>
@ -43,12 +45,14 @@
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-editable-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var prefix = ctx + "system/empRequisiteOrder"
var baseEmpRequisiteOrderDetail = [[${baseEmpRequisiteOrder.baseEmpRequisiteOrderChildList}]]
var prefix = ctx + "system/empRequisiteOrder";
$("#form-empRequisiteOrder-edit").validate({focusCleanup: true});
//获取子表信息
@ -56,6 +60,7 @@
var options = {
id:'bootstrap-sub-table-empRequisitionChild',
pagination: false,
data: baseEmpRequisiteOrderDetail,
sidePagination: "client",
model: "物料报价信息",
columns: [
@ -66,43 +71,64 @@
return columnIndex + $.table.serialNumber(index);
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '物料索引id',field: 'id',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'},
{title: '图片',field: 'photoUrl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{title: '物料名称',field: 'materialName',align: 'center'},
{title: '物料类型',field: 'materialType',align: 'center',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{title: '型号',field: 'materialModel',align: 'center'},
{title: '规格',field: 'specification',align: 'center'},
{ title: '描述',field: 'describe',align: 'center'},
{title: '型号',field: 'materialModel',align: 'center',visible: false},
{title: '规格',field: 'specification',align: 'center',visible: false},
{ title: '描述',field: 'describe',align: 'center',visible: false},
{title: '品牌',field: 'brand',align: 'center'},
{ title: '单位',field: 'unit',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sysUnitClassDatas, value);
}
},
{title: '半成品类型',field: 'processMethod',align: 'center',
{title: '半成品类型',field: 'processMethod',align: 'center',visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{title: '物料的数量', field: 'materialNum',align: 'center',editable: true,},
{title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',},
{title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',},
{title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{title: '不含税单价(RMB)',field: 'materialNoRmb',align: 'center',},
{title: '含税单价(RMB)',field: 'materialRmb',align: 'center',},
{title: '物料的数量', field: 'materialNum',align: 'center',
editable:{
type : 'text',
mode: 'inline',
title : '物料的数量',
validate : function(value) {
if (!value) {
return '用量不能为空';
}
if (isNaN(value)) {
return '用量必须为数字';
}
}
},
},
{title: '不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{title: '含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '录入人',field: 'createBy',align: 'center',visible: false},
{title: '录入时间',field: 'createTime',align: 'center',visible: false },
{title: '更新人',field: 'updateBy',align: 'center',visible: false},
{title: '上次更新时间',field: 'updateTime',align: 'center',visible: false},
{title: '备注',field: 'remark',align: 'center',editable: true},
{title: '备注',field: 'remark',align: 'center',
editable:{
type : 'text',
mode: 'inline',
title : '备注',
},
},
{title: '操作', align: 'center',
formatter: function (value, row, index) {
var actions = [];
@ -126,7 +152,7 @@
$("#bootstrap-sub-table-empRequisitionChild").bootstrapTable('insertRow', {
index:1,
row: {
materialId:rowData.id,
id:rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
@ -136,10 +162,10 @@
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
materialNum: "",
materialRmb: "",
materialNoRmb: "",
materialNoRmbSum: "",
materialRmbSum: "",
materialRmb: 0,
materialNoRmb: 0,
materialNoRmbSum: 0,
materialRmbSum: 0,
remark: ""
}
})
@ -163,7 +189,57 @@
}
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-empRequisiteOrder-edit').serialize());
var baseEmpRequisiteOrderVO = {};
if ($.validate.form()) {
var baseEmpRequisiteOrderChildList = [];
// 获取表单数据
const Data = $("#form-empRequisiteOrder-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
baseEmpRequisiteOrderVO = {
requisiteId: Data.requisiteId,
requisitieCode: Data.requisitieCode,
correlationCode: Data.correlationCode,
remark: Data.remark,
materialAmount: 0,
baseEmpRequisiteOrderChildList: []
}
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var rows = $('#bootstrap-sub-table-empRequisitionChild').bootstrapTable('getData');
// 检查表格数据是否为空
if (rows.length === 0) {
$.modal.alertWarning("请至少添加一条物料信息再保存!");
return;
} else {
baseEmpRequisiteOrderVO.materialAmount = rows.length;
for (var i = 0; i < rows.length; i++) {
var requisiteChild = {
materialId: rows[i].id,
materialCode: rows[i].materialCode,
materialName: rows[i].materialName,
materialType: rows[i].materialType,
describe: rows[i].describe,
brand: rows[i].brand,
unit: rows[i].unit,
processMethod: rows[i].processMethod,
photoUrl: rows[i].photoUrl,
materialModel: rows[i].materialModel,
specification: rows[i].specification,
materialNum: rows[i].materialNum,
materialRmb: rows[i].materialRmb,
materialNoRmb: rows[i].materialNoRmb,
materialNoRmbSum: rows[i].materialNoRmbSum,
materialRmbSum: rows[i].materialRmbSum,
remark: rows[i].remark
};
console.log(requisiteChild);
baseEmpRequisiteOrderVO.baseEmpRequisiteOrderChildList.push(requisiteChild);
}
}
$.operate.saveJson(prefix + "/edit", JSON.stringify(baseEmpRequisiteOrderVO));
// $.operate.save(prefix + "/edit", $('#form-empRequisiteOrder-edit').serialize());
}
}
}
</script>

Loading…
Cancel
Save