Browse Source

[fix]

委外加工 委外报价
修改添加、编辑委外报价页面表单定义,修改显示效果;
修改添加、编辑报价页面表格定义,修改下拉框初始化方法,新增自定义计价单位的初始化函数和监听函数,修改页面提交函数;
修改委外经理和委外主管审批页面显示效果;
修改编辑保存委外报价controller接口;
修改编辑报价service方法和报价工序信息service方法;
dev
王晓迪 2 months ago
parent
commit
82c17c2369
  1. 7
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java
  2. 32
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java
  3. 4
      ruoyi-admin/src/main/resources/mapper/system/OutsourceQuoteMapper.xml
  4. 141
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html
  5. 256
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/edit.html
  6. 2
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/outsource_quote.html
  7. 6
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/taskWwjlVerify.html
  8. 6
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/taskWwzgVerify.html

7
ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceQuoteController.java

@ -259,12 +259,7 @@ public class OutsourceQuoteController extends BaseController
public AjaxResult editSave(@RequestBody OutsourceQuoteVO outsourceQuoteVO) public AjaxResult editSave(@RequestBody OutsourceQuoteVO outsourceQuoteVO)
{ {
List<OutsourceQuoteChild> children = outsourceQuoteVO.getOutsourceQuoteChildList(); List<OutsourceQuoteChild> children = outsourceQuoteVO.getOutsourceQuoteChildList();
for (OutsourceQuoteChild child:children) {
child.setOutsourceQuoteCode(outsourceQuoteVO.getOutsourceQuoteCode());
child.setSupplierCode(outsourceQuoteVO.getSupplierQuoteCode());
child.setSupplierName(outsourceQuoteVO.getSupplierName());
child.setTaxRate(outsourceQuoteVO.getTaxRate());
}
// System.out.println(children); // System.out.println(children);
return toAjax(outsourceQuoteService.updateOutsourceQuote(outsourceQuoteVO)); return toAjax(outsourceQuoteService.updateOutsourceQuote(outsourceQuoteVO));
} }

32
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceQuoteServiceImpl.java

@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
@ -154,11 +155,18 @@ public class OutsourceQuoteServiceImpl implements IOutsourceQuoteService
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public int insertOutsourceQuote(OutsourceQuoteVO childVO) public int insertOutsourceQuote(OutsourceQuoteVO childVO)
{ {
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
List<OutsourceQuoteChild> children = childVO.getOutsourceQuoteChildList(); List<OutsourceQuoteChild> children = childVO.getOutsourceQuoteChildList();
for (OutsourceQuoteChild child:children) { for (OutsourceQuoteChild child:children) {
if(child.getChargeUnit()==null){
throw new BusinessException("工序" + child.getOutsourceProcessNo()+"计价单位为空,请检查");
}
if(child.getMaterialRmb()==null || child.getMaterialNormb() ==null){
throw new BusinessException("工序" + child.getOutsourceProcessNo()+"价格为空,请检查");
}
child.setOutsourceQuoteCode(childVO.getOutsourceQuoteCode()); child.setOutsourceQuoteCode(childVO.getOutsourceQuoteCode());
child.setSupplierCode(childVO.getSupplierQuoteCode()); child.setSupplierCode(childVO.getSupplierQuoteCode());
child.setSupplierName(childVO.getSupplierName()); child.setSupplierName(childVO.getSupplierName());
@ -187,9 +195,23 @@ public class OutsourceQuoteServiceImpl implements IOutsourceQuoteService
SysUser user = ShiroUtils.getSysUser(); SysUser user = ShiroUtils.getSysUser();
outsourceQuoteVO.setUpdateTime(DateUtils.getNowDate()); outsourceQuoteVO.setUpdateTime(DateUtils.getNowDate());
outsourceQuoteVO.setUpdateBy(user.getLoginName()); outsourceQuoteVO.setUpdateBy(user.getLoginName());
outsourceQuoteMapper.updateOutsourceQuote(outsourceQuoteVO);
OutsourceQuoteVO quoteVO = outsourceQuoteMapper.selectOutsourceQuoteByOutsourceQuoteId(outsourceQuoteVO.getOutsourceQuoteId());
List<OutsourceQuoteChild> children = outsourceQuoteVO.getOutsourceQuoteChildList();
if(StringUtils.isNotEmpty(children)){
for (OutsourceQuoteChild child:children) {
if (child.getChargeUnit() == null) {
throw new BusinessException("工序" + child.getOutsourceProcessNo() + "计价单位为空,请检查");
}
if (child.getMaterialRmb() == null || child.getMaterialNormb() == null) {
throw new BusinessException("工序" + child.getOutsourceProcessNo() + "价格为空,请检查");
}
}
quoteVO.setOutsourceQuoteChildList(children);
outsourceQuoteMapper.deleteOutsourceQuoteChildByOutsourceQuoteCode(outsourceQuoteVO.getOutsourceQuoteCode()); outsourceQuoteMapper.deleteOutsourceQuoteChildByOutsourceQuoteCode(outsourceQuoteVO.getOutsourceQuoteCode());
insertOutsourceQuoteChild(outsourceQuoteVO); insertOutsourceQuoteChild(quoteVO);
return outsourceQuoteMapper.updateOutsourceQuote(outsourceQuoteVO); }
return 1;
} }
// 更新审核后信息(更新子表审核状态,防止子表信息丢失 // 更新审核后信息(更新子表审核状态,防止子表信息丢失
@ -238,6 +260,12 @@ public class OutsourceQuoteServiceImpl implements IOutsourceQuoteService
for (OutsourceQuoteChild child:outsourceQuoteChildList) { for (OutsourceQuoteChild child:outsourceQuoteChildList) {
child.setOutsourceProcessCode(outsourceQuote.getOutsourceQuoteCode()); child.setOutsourceProcessCode(outsourceQuote.getOutsourceQuoteCode());
child.setAuditStatus(outsourceQuote.getAuditStatus()); child.setAuditStatus(outsourceQuote.getAuditStatus());
child.setOutsourceQuoteCode(outsourceQuote.getOutsourceQuoteCode());
child.setSupplierCode(outsourceQuote.getSupplierQuoteCode());
child.setSupplierName(outsourceQuote.getSupplierName());
child.setTaxRate(outsourceQuote.getTaxRate());
child.setUpdateBy(ShiroUtils.getLoginName());
child.setUpdateTime(DateUtils.getNowDate());
} }
outsourceQuoteMapper.batchOutsourceQuoteChild(outsourceQuoteChildList); outsourceQuoteMapper.batchOutsourceQuoteChild(outsourceQuoteChildList);
} }

4
ruoyi-admin/src/main/resources/mapper/system/OutsourceQuoteMapper.xml

@ -202,9 +202,9 @@
</delete> </delete>
<insert id="batchOutsourceQuoteChild"> <insert id="batchOutsourceQuoteChild">
insert into outsource_quote_child( outsource_quote_child_id, outsource_quote_code, outsource_process_code, charge_unit, outsource_process_no, outsource_process_name, remark, tax_rate, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, audit_status) values insert into outsource_quote_child(outsource_quote_code, outsource_process_code, charge_unit, outsource_process_no, outsource_process_name, remark, tax_rate, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, audit_status) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.outsourceQuoteChildId}, #{item.outsourceQuoteCode}, #{item.outsourceProcessCode},#{item.chargeUnit}, #{item.outsourceProcessNo}, #{item.outsourceProcessName}, #{item.remark}, #{item.taxRate}, #{item.materialRmb}, #{item.materialNormb}, #{item.supplierCode}, #{item.supplierName}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.auditStatus}) ( #{item.outsourceQuoteCode}, #{item.outsourceProcessCode},#{item.chargeUnit}, #{item.outsourceProcessNo}, #{item.outsourceProcessName}, #{item.remark}, #{item.taxRate}, #{item.materialRmb}, #{item.materialNormb}, #{item.supplierCode}, #{item.supplierName}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.auditStatus})
</foreach> </foreach>
</insert> </insert>

141
ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html

@ -3,6 +3,7 @@
<head> <head>
<th:block th:include="include :: header('新增委外报价')" /> <th:block th:include="include :: header('新增委外报价')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css" />
<th:block th:include="include :: select2-css" /> <th:block th:include="include :: select2-css" />
</head> </head>
@ -10,17 +11,15 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-outsource_quote-add"> <form class="form-horizontal m" id="form-outsource_quote-add">
<div class="form-check-inline">
<h4 class="form-header h4">委外报价信息</h4>
</div>
<div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">委外报价单号:</label> <label class="col-sm-3 control-label is-required">委外报价单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="outsourceQuoteCode" readonly="readonly" class="form-control" type="text"> <input name="outsourceQuoteCode" readonly="readonly" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group">
</div> </div>
<div class="form-group"> <div class="form-group">
@ -37,7 +36,6 @@
<input name="supplierName" class="form-control" type="text" required> <input name="supplierName" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="col-xs-12">
<div class="form-group"> <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"> <div class="col-sm-8">
@ -47,8 +45,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-xs-12">
<div class="form-group"> <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"> <div class="col-sm-8">
@ -58,15 +54,17 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-xs-12">
<div class="form-group"> <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"> <div class="col-sm-8">
<input name="remark" class="form-control" type="text"> <textarea name="remark" class="form-control" type="text"></textarea>
</div> </div>
</div> </div>
<div class="form-group">
</div> </div>
<div class="form-check-inline"> <div class="form-check-inline">
<h4 class="form-header h4">委外报价工序信息</h4> <h4 class="form-header h4">委外报价工序信息</h4>
</div> </div>
@ -89,7 +87,8 @@
<th:block th:include="include :: bootstrap-table-editable-js"/> <th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "system/outsource_quote"; var prefix = ctx + "system/outsource_quote";
var chargeUnitDatas = [[${@dict.getType("charge_unit")}]] var chargeUnitDatas = [[${@dict.getType("charge_unit")}]];
var chargeUnitDatas = [[${@dict.getType('outsource_quote_unit')}]];
$("#form-outsource_quote-add").validate({ $("#form-outsource_quote-add").validate({
focusCleanup: true focusCleanup: true
}); });
@ -147,60 +146,23 @@
return; return;
}else{ }else{
outsourceQuote.processAmount = rows.length; outsourceQuote.processAmount = rows.length;
var unit = getUnit();
var noRmb = getNoRmb();
var rmb = getRmb();
for(var i=0;i<rows.length;i++){ for(var i=0;i<rows.length;i++){
var quoteChild = { var quoteChild = {
outsourceProcessCode: rows[i].outsourceProcessCode, outsourceProcessCode: rows[i].outsourceProcessCode,
outsourceProcessNo: rows[i].outsourceProcessNo, outsourceProcessNo: rows[i].outsourceProcessNo,
outsourceProcessName: rows[i].outsourceProcessName, outsourceProcessName: rows[i].outsourceProcessName,
chargeUnit:unit[i], chargeUnit: rows[i].chargeUnit,
materialNormb: noRmb[i], materialNormb: rows[i].materialNormb,
materialRmb: rmb[i], materialRmb: rows[i].materialRmb,
}; };
outsourceQuote.outsourceQuoteChildList.push(quoteChild); outsourceQuote.outsourceQuoteChildList.push(quoteChild);
} }
} }
console.log(JSON.stringify(outsourceQuote)); console.log(outsourceQuote);
$.operate.saveJson(prefix + "/add", JSON.stringify(outsourceQuote)); $.operate.saveJson(prefix + "/add", JSON.stringify(outsourceQuote));
} }
} }
function getUnit(){
var selectElements = $('#bootstrap-table-process').find('select[id="chargeUnit"]');
// 遍历每个下拉框
var unit = [];
selectElements.each(function() {
// 获取当前下拉框的值
var selectedValue = $(this).val();
unit.push(selectedValue);
});
return unit;
}
function getNoRmb(){
var selectElements = $('#bootstrap-table-process').find('input[id="materialNormb"]');
// 遍历每个下拉框
var noRmb = [];
selectElements.each(function() {
// 获取当前下拉框的值
var selectedValue = $(this).val();
noRmb.push(selectedValue);
});
console.log(noRmb);
return noRmb;
};
function getRmb(){
var selectElements = $('#bootstrap-table-process').find('input[id="materialRmb"]');
// 遍历每个输入框
var rmb = [];
selectElements.each(function() {
// 获取当前输入框的值
var selectedValue = $(this).val();
rmb.push(selectedValue);
});
console.log(rmb);
return rmb;
};
$(function() { $(function() {
var options = { var options = {
id: "bootstrap-table-process", id: "bootstrap-table-process",
@ -237,34 +199,48 @@
field: 'chargeUnit', field: 'chargeUnit',
align: 'center', align: 'center',
title: '计价单位', title: '计价单位',
width: 150, formatter:function (value, row, index) {
// overflow: visible, return chargeUnitFormatter(value,row,index);
formatter: function(value, row, index) {
var html = $.common.sprintf("<select class='form-control' id='chargeUnit' data-first-title= '请选择' > " +
"<option value=''>请选择</option>" +
"<option value='0'>按重量计</option>" +
"<option value='1'>按数量计</option>" +
"<option value='2'>按面积计</option>" +
"</select>", index, value);
return html;
} }
}, },
{ {
field: 'materialNormb', field: 'materialNormb',
align: 'center', align: 'center',
title: '不含税单价(RMB) ', title: '不含税单价(RMB) ',
formatter: function(value, row, index) { editable: {
var html = $.common.sprintf("<input class='form-control' type='text' id='materialNormb'>", index, value); type: 'text', // 编辑器类型
return html; validate: function (value) {
value = $.trim(value); // 去除前后空格
if (!value) {
return '价格不能为空';
}
if (isNaN(value)) {
return '请输入有效的数字';
}
if (parseFloat(value) < 0) {
return '价格不能为负数';
}
}
} }
}, },
{ {
field: 'materialRmb', field: 'materialRmb',
align: 'center', align: 'center',
title: '含税单价(RMB)', title: '含税单价(RMB)',
formatter: function(value, row, index) { editable: {
var html = $.common.sprintf("<input class='form-control' type='text' id='materialRmb'>", index, value); type: 'text', // 编辑器类型
return html; validate: function (value) {
value = $.trim(value); // 去除前后空格
if (!value) {
return '价格不能为空';
}
if (isNaN(value)) {
return '请输入有效的数字';
}
if (parseFloat(value) < 0) {
return '价格不能为负数';
}
}
} }
}, },
{ {
@ -343,8 +319,8 @@
outsourceProcessNo: rowData.outsourceProcessNo, outsourceProcessNo: rowData.outsourceProcessNo,
outsourceProcessCode: rowData.outsourceProcessCode, outsourceProcessCode: rowData.outsourceProcessCode,
outsourceProcessName: rowData.outsourceProcessName, outsourceProcessName: rowData.outsourceProcessName,
materialNoRmb: 0.00, materialNormb: '',
materialRmb: 0.00, materialRmb: '',
}; };
// 将新行追加到表格末尾 // 将新行追加到表格末尾
$("#bootstrap-table-process").bootstrapTable('append', newRow); $("#bootstrap-table-process").bootstrapTable('append', newRow);
@ -355,6 +331,27 @@
values: outsourceProcessCode values: outsourceProcessCode
}) })
} }
// 自定义计价单位的初始化函数
function chargeUnitFormatter(value, row, index) {
var selectHtml = `<select class="form-control" onchange="onChargeUnit(this, ${index})">`;
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
chargeUnitDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
// 列中获取计价单位的下拉改变数据
function onChargeUnit(selectElement, rowIndex) {
var unitValue = $(selectElement).val();
var tableData = $("#bootstrap-table-process").bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 更新行数据
newRow.chargeUnit = unitValue;
$("#bootstrap-table-process").bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
</script> </script>
</body> </body>
</html> </html>

256
ruoyi-admin/src/main/resources/templates/system/outsource_quote/edit.html

@ -3,50 +3,42 @@
<head> <head>
<th:block th:include="include :: header('修改委外报价')" /> <th:block th:include="include :: header('修改委外报价')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css" />
<th:block th:include="include :: select2-css" /> <th:block th:include="include :: select2-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-outsource_quote-edit" th:object="${outsourceQuote}"> <form class="form-horizontal m" id="form-outsource_quote-edit" th:object="${outsourceQuote}">
<h4 class="form-header h4">委外报价信息</h4>
<input name="outsourceQuoteId" th:field="*{outsourceQuoteId}" type="hidden"> <input name="outsourceQuoteId" th:field="*{outsourceQuoteId}" type="hidden">
<div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">委外报价单号:</label> <label class="col-sm-3 control-label is-required">委外报价单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="outsourceQuoteCode" th:field="*{outsourceQuoteCode}" class="form-control" type="text" required readonly> <input name="outsourceQuoteCode" th:field="*{outsourceQuoteCode}" class="form-control" type="text" required readonly>
</div> </div>
</div> </div>
<div class="form-group">
</div> </div>
<div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">供应商编号:</label> <label class="col-sm-3 control-label is-required">供应商编号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="selectSupplierQuoteCode" name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control" required> <input id="selectSupplierQuoteCode" name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control" required>
<!-- <select id="selectSupplierQuoteCode" name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control" required>--> <!-- <select id="selectSupplierQuoteCode" name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control" required>-->
<!-- <option value="">请选择供应商</option>--> <!-- <option value="">请选择供应商</option>-->
<!-- </select>--> <!-- </select>-->
</div>
</div> </div>
</div> </div>
<div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">供应商名称:</label> <label class="col-sm-3 control-label is-required">供应商名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="supplierName" th:field="*{supplierName}" class="form-control" type="text"> <input name="supplierName" th:field="*{supplierName}" class="form-control" type="text">
</div> </div>
</div> </div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">工序合计:</label>
<div class="col-sm-8">
<input name="processAmount" th:field="*{processAmount}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group"> <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"> <div class="col-sm-8">
@ -56,8 +48,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-xs-12">
<div class="form-group"> <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"> <div class="col-sm-8">
@ -66,40 +57,44 @@
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> </div>
</div> </div>
<!-- <div class="col-sm-8">-->
<!-- <input name="pricingDate" th:field="*{pricingDate}" class="form-control" type="text">-->
<!-- </div>-->
</div>
</div> </div>
<div class="col-xs-12">
<div class="form-group"> <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"> <div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text"> <textarea name="remark" th:field="*{remark}" class="form-control" type="text"></textarea>
</div> </div>
</div> </div>
<div class="form-group">
</div> </div>
<h4 class="form-header h4">委外报价工序信息</h4> <h4 class="form-header h4">委外报价工序信息</h4>
<div class="row">
<div class="col-sm-12"> <div class="col-xs-12">
<button type="button" class="btn btn-blue btn-sm" onclick="processadd()"><i class="fa fa-plus"> 增加</i></button> <div class="form-group-sm">
<a class="btn btn-success" onclick="processadd()" ><i class="fa fa-plus"></i> 添加</a>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table-process"></table> <table id="bootstrap-table-process"></table>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" /> <th:block th:include="include :: select2-js" />
<!--<th:block th:include="include :: bootstrap-table-editable-js"/>--> <th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "system/outsource_quote"; var prefix = ctx + "system/outsource_quote";
$("#form-outsource_quote-edit").validate({ $("#form-outsource_quote-edit").validate({
focusCleanup: true focusCleanup: true
}); });
var processData = [[${outsourceQuote.outsourceQuoteChildList}]] var processData = [[${outsourceQuote.outsourceQuoteChildList}]];
var chargeUnitDatas = [[${@dict.getType('outsource_quote_unit')}]];
//获取供应商 //获取供应商
// $("#selectSupplierQuoteCode").on("select2:select",function (e) { // $("#selectSupplierQuoteCode").on("select2:select",function (e) {
@ -114,10 +109,6 @@
autoClose: true autoClose: true
}); });
function submitHandler() { function submitHandler() {
var url = prefix + "/edit";
var outsourceQuote = {
};
if ($.validate.form()) { if ($.validate.form()) {
var outsourceQuoteChildList = []; var outsourceQuoteChildList = [];
// 获取表单数据 // 获取表单数据
@ -126,10 +117,10 @@
return obj; return obj;
}, {}); }, {});
console.log(outsourceQuoteData); console.log(outsourceQuoteData);
outsourceQuote = { var outsourceQuote = {
outsourceQuoteId: outsourceQuoteData.outsourceQuoteId, outsourceQuoteId: outsourceQuoteData.outsourceQuoteId,
outsourceQuoteCode: outsourceQuoteData.outsourceQuoteCode, outsourceQuoteCode: outsourceQuoteData.outsourceQuoteCode,
supplierQuoteCode: outsourceQuoteData.supplierCode, supplierQuoteCode: outsourceQuoteData.supplierQuoteCode,
supplierName: outsourceQuoteData.supplierName, supplierName: outsourceQuoteData.supplierName,
pricingDate: outsourceQuoteData.pricingDate, pricingDate: outsourceQuoteData.pricingDate,
taxRate: outsourceQuoteData.taxRate, taxRate: outsourceQuoteData.taxRate,
@ -144,19 +135,15 @@
$.modal.alertWarning("请至少添加一条委外工序再保存!"); $.modal.alertWarning("请至少添加一条委外工序再保存!");
return; return;
}else{ }else{
console.log(rows);
outsourceQuote.processAmount = rows.length; outsourceQuote.processAmount = rows.length;
var unit = getUnit();
var noRmb = getNoRmb();
var rmb = getRmb();
for(var i=0;i<rows.length;i++){ for(var i=0;i<rows.length;i++){
var quoteChild = { var quoteChild = {
outsourceProcessCode: rows[i].outsourceProcessCode, outsourceProcessCode: rows[i].outsourceProcessCode,
outsourceProcessNo: rows[i].outsourceProcessNo, outsourceProcessNo: rows[i].outsourceProcessNo,
outsourceProcessName: rows[i].outsourceProcessName, outsourceProcessName: rows[i].outsourceProcessName,
chargeUnit:unit[i], chargeUnit: rows[i].chargeUnit,
materialNormb: noRmb[i], materialNormb: rows[i].materialNormb,
materialRmb: rmb[i], materialRmb: rows[i].materialRmb,
}; };
outsourceQuote.outsourceQuoteChildList.push(quoteChild); outsourceQuote.outsourceQuoteChildList.push(quoteChild);
} }
@ -181,89 +168,36 @@
// // 这里取到的是多行的 // // 这里取到的是多行的
var rowData = layero.find("iframe")[0].contentWindow.getSelections(); var rowData = layero.find("iframe")[0].contentWindow.getSelections();
//判断是否重复 //判断是否重复
var rows = $("#bootstrap-table-process").bootstrapTable('getData').length; var data = $("#bootstrap-table-process").bootstrapTable('getData');
var rows = data.length;
if(rows>0){ if(rows>0){
for(var i=0;i<rows;i++){ for(var i=0;i<rows;i++){
var data = $("#bootstrap-table-process").bootstrapTable('getData')[i];
for(var j=0;j<rowData.length;j++){ for(var j=0;j<rowData.length;j++){
if(data.outsourceProcessNo==rowData[j].outsourceProcessNo){ if(data[i].outsourceProcessCode===rowData[j].outsourceProcessCode){
$.modal.alertError("不能选择已添加过的相同工序"); $.modal.alertError("不能选择已添加过的相同工序");
return; rowData.split(j,1);
break;
} }
insertTable(rowData[i]);
} }
}; };
}else{ }
for(i=0;i<rowData.length;i++){ for(i=0;i<rowData.length;i++){
insertTable(rowData[i]); insertTable(rowData[i]);
} }
} layer.close(index);
layer.closeAll();
} }
function insertTable(rowData) { function insertTable(rowData) {
$("#bootstrap-table-process").bootstrapTable('insertRow', { var newRow = {
index: 1,
row: {
outsourceProcessNo: rowData.outsourceProcessNo, outsourceProcessNo: rowData.outsourceProcessNo,
outsourceProcessCode: rowData.outsourceProcessCode, outsourceProcessCode: rowData.outsourceProcessCode,
outsourceProcessName: rowData.outsourceProcessName, outsourceProcessName: rowData.outsourceProcessName,
materialNoRmb: 0.00, materialNormb: '',
materialRmb: 0.00, materialRmb: '',
}
});
}
function getUnit(){
var selectElements = $('#bootstrap-table-process').find('select[id^="chargeUnit"]');
// 遍历每个下拉框
var unit = [];
selectElements.each(function() {
// 获取当前下拉框的值
var selectedValue = $(this).val();
unit.push(selectedValue);
});
console.log(unit);
return unit;
}
function getNoRmb(){
var selectElements = $('#bootstrap-table-process').find('input[id^="materialNormb"]');
// 遍历每个下拉框
var noRmb = [];
selectElements.each(function() {
// 获取当前下拉框的值
var selectedValue = $(this).val();
noRmb.push(selectedValue);
});
// console.log(noRmb);
return noRmb;
};
function getRmb(){
var selectElements = $('#bootstrap-table-process').find('input[id^="materialRmb"]');
// 遍历每个输入框
var rmb = [];
selectElements.each(function() {
// 获取当前输入框的值
var selectedValue = $(this).val();
rmb.push(selectedValue);
});
// console.log(rmb);
return rmb;
}; };
// 将新行追加到表格末尾
function initProcessTable(data,index){ $("#bootstrap-table-process").bootstrapTable('append', newRow);
$("#bootstrap-table-process").bootstrapTable('insertRow', {
index:1,
row: {
outsourceProcessNo: data.outsourceProcessNo,
outsourceProcessCode: data.outsourceProcessCode,
outsourceProcessName: data.outsourceProcessName,
} }
});
$('#bootstrap-table-process').find('select[id="chargeUnit'+index+'"]').val(data.chargeUnit);
$('#bootstrap-table-process').find('input[id="materialNormb'+index+'"]').val(data.materialNormb);
$('#bootstrap-table-process').find('input[id="materialRmb'+index+'"]').val(data.materialRmb);
};
$(function() { $(function() {
var options = { var options = {
id: "bootstrap-table-process", id: "bootstrap-table-process",
@ -281,12 +215,16 @@
title: '委外工序主键', title: '委外工序主键',
visible: false, visible: false,
}, },
{
field: 'outsourceProcessCode',
align: 'center',
title: '委外工序ID',
},
{ {
field: 'outsourceProcessNo', field: 'outsourceProcessNo',
align: 'center', align: 'center',
title: '委外工序编号', title: '委外工序编号',
}, },
{ {
field: 'outsourceProcessName', field: 'outsourceProcessName',
align: 'center', align: 'center',
@ -296,34 +234,48 @@
field: 'chargeUnit', field: 'chargeUnit',
align: 'center', align: 'center',
title: '计价单位', title: '计价单位',
width: 120, formatter:function (value, row, index) {
// overflow: visible, return chargeUnitFormatter(value,row,index);
formatter: function(value, row, index) {
var html = $.common.sprintf("<select class='form-control' id='chargeUnit" + index + "' name='outsourceQuoteChildList[%s].chargeUnit' value='%s' data-first-title= '请选择' > " +
"<option value=''>请选择</option>" +
"<option value='0'>按重量计</option>" +
"<option value='1'>按数量计</option>" +
"<option value='2'>按面积计</option>" +
"</select>", index, value);
return html;
} }
}, },
{ {
field: 'materialNormb', field: 'materialNormb',
align: 'center', align: 'center',
title: '工序的不含税单价(RMB) ', title: '不含税单价(RMB) ',
formatter: function(value, row, index) { editable: {
var html = $.common.sprintf("<input class='form-control' type='text' id='materialNormb" + index + "' name='outsourceQuoteChildList[%s].materialNormb' value='%s'>", index, value); type: 'text', // 编辑器类型
return html; validate: function (value) {
value = $.trim(value); // 去除前后空格
if (!value) {
return '价格不能为空';
}
if (isNaN(value)) {
return '请输入有效的数字';
}
if (parseFloat(value) < 0) {
return '价格不能为负数';
}
}
} }
}, },
{ {
field: 'materialRmb', field: 'materialRmb',
align: 'center', align: 'center',
title: '工序的含税单价(RMB)', title: '含税单价(RMB)',
formatter: function(value, row, index) { editable: {
var html = $.common.sprintf("<input class='form-control' type='text' id='materialRmb" + index + "' name='outsourceQuoteChildList[%s].materialRmb' value='%s'>", index, value); type: 'text', // 编辑器类型
return html; validate: function (value) {
value = $.trim(value); // 去除前后空格
if (!value) {
return '价格不能为空';
}
if (isNaN(value)) {
return '请输入有效的数字';
}
if (parseFloat(value) < 0) {
return '价格不能为负数';
}
}
} }
}, },
{ {
@ -331,42 +283,42 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.outsourceProcessCode + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.outsourceProcessNo + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
}] }]
}; };
$.table.init(options); $.table.init(options);
var quoteDetail = options.data;
console.log(quoteDetail);
$.each(quoteDetail, function(index, item) {
// 设置下拉框的值
$('#chargeUnit' + index).val(item.chargeUnit);
$('#materialNormb' + index).val(item.materialNormb);
$('#materialRmb' + index).val(item.materialRmb);
}); });
// 监听刷新事件
$('#bootstrap-table-process').on('refresh.bs.table', function () {
$.each(quoteDetail, function(index, item) {
// 设置下拉框的值
$('#chargeUnit' + index).val(item.chargeUnit);
$('#materialNormb' + index).val(item.materialNormb); function removeRow(outsourceProcessNo){
$('#materialRmb' + index).val(item.materialRmb);
});
});
});
function removeRow(outsourceProcessCode){
$("#bootstrap-table-process").bootstrapTable('remove', { $("#bootstrap-table-process").bootstrapTable('remove', {
field: 'outsourceProcessCode', field: 'outsourceProcessNo',
values: outsourceProcessCode values: outsourceProcessNo
}) })
} }
// 自定义计价单位的初始化函数
function chargeUnitFormatter(value, row, index) {
var selectHtml = `<select class="form-control" onchange="onChargeUnit(this, ${index})">`;
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
chargeUnitDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
// 列中获取计价单位的下拉改变数据
function onChargeUnit(selectElement, rowIndex) {
var unitValue = $(selectElement).val();
var tableData = $("#bootstrap-table-process").bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 更新行数据
newRow.chargeUnit = unitValue;
$("#bootstrap-table-process").bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
</script> </script>
</body> </body>
</html> </html>

2
ruoyi-admin/src/main/resources/templates/system/outsource_quote/outsource_quote.html

@ -268,7 +268,7 @@
}); });
function edit(outsourceQuoteId) { function edit(outsourceQuoteId) {
var url = table.options.updateUrl.replace("{id}", outsourceQuoteId); var url = table.options.updateUrl.replace("{id}", outsourceQuoteId);
$.modal.open("修改委外报价",url,1000,600); $.modal.open("修改委外报价",url);
} }
// 导出 // 导出

6
ruoyi-admin/src/main/resources/templates/system/outsource_quote/taskWwjlVerify.html

@ -59,7 +59,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required" for="wwjlVerifyApproved">审批意见:</label> <label class="col-sm-3 control-label is-required" for="wwjlVerifyApproved">审批意见:</label>
<div class="col-sm-6"> <div class="col-sm-8">
<select name="p_B_wwjlVerifyApproved" id="wwjlVerifyApproved" class="form-control" required> <select name="p_B_wwjlVerifyApproved" id="wwjlVerifyApproved" class="form-control" required>
<option value=""></option> <option value=""></option>
<option value="true">同意</option> <option value="true">同意</option>
@ -68,8 +68,8 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-6 control-label">批注:</label> <label class="col-sm-3 control-label">批注:</label>
<div class="col-sm-6"> <div class="col-sm-8">
<textarea name="comment" class="form-control"></textarea> <textarea name="comment" class="form-control"></textarea>
</div> </div>
</div> </div>

6
ruoyi-admin/src/main/resources/templates/system/outsource_quote/taskWwzgVerify.html

@ -59,7 +59,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required" for="wwzgVerifyApproved">审批意见:</label> <label class="col-sm-3 control-label is-required" for="wwzgVerifyApproved">审批意见:</label>
<div class="col-sm-6"> <div class="col-sm-8">
<select name="p_B_wwzgVerifyApproved" id="wwzgVerifyApproved" class="form-control" required> <select name="p_B_wwzgVerifyApproved" id="wwzgVerifyApproved" class="form-control" required>
<option value=""></option> <option value=""></option>
<option value="true">同意</option> <option value="true">同意</option>
@ -68,8 +68,8 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-6 control-label">批注:</label> <label class="col-sm-3 control-label">批注:</label>
<div class="col-sm-6"> <div class="col-sm-8">
<textarea name="comment" class="form-control"></textarea> <textarea name="comment" class="form-control"></textarea>
</div> </div>
</div> </div>

Loading…
Cancel
Save