You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1129 lines
41 KiB
1129 lines
41 KiB
<!DOCTYPE html>
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
<head>
|
|
<th:block th:include="include :: header('修改销售订单')" />
|
|
<th:block th:include="include :: datetimepicker-css" />
|
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
|
<th:block th:include="include :: bootstrap-editable-css"/>
|
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
|
|
|
</head>
|
|
|
|
<style>
|
|
.division {
|
|
width: 90%;
|
|
border-bottom: 1px solid #f1ecec;
|
|
padding: 10px 0 0;
|
|
margin: 0 auto 30px;
|
|
|
|
|
|
}
|
|
|
|
/*.changeWidth {*/
|
|
/* width: 33.3% !important;*/
|
|
|
|
/*}*/
|
|
|
|
.col-sm-3 {
|
|
width: 30%;
|
|
}
|
|
|
|
.select2-container--open {
|
|
z-index: 9999999
|
|
}
|
|
|
|
.other-container {
|
|
width: 85%;
|
|
height: 400px;
|
|
margin: auto;
|
|
}
|
|
|
|
.hiddenDetailInfo {
|
|
display: none;
|
|
}
|
|
|
|
.search-collapse, .select-table {
|
|
box-shadow: none;
|
|
}
|
|
|
|
.btn-group-sm {
|
|
padding: 0 40px;
|
|
}
|
|
|
|
.get-finish-product h4 {
|
|
padding: 0 40px;
|
|
}
|
|
|
|
.table-responsive {
|
|
overflow-x: inherit;
|
|
}
|
|
|
|
.title {
|
|
padding: 10px 30px 0;
|
|
margin: 0 0 -10px 0;
|
|
font-size: 20px;
|
|
}
|
|
</style>
|
|
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-salesOrder-edit" th:object="${sysSalesOrder}">
|
|
<input name="salesOrderId" th:field="*{salesOrderId}" type="hidden">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">订单编号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" required>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">订单号码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="salesOrderNumber" th:field="*{salesOrderNumber}" class="form-control" type="text" required>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">预约单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="appointmentNumber" th:field="*{appointmentNumber}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">开单日期时间:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="billingTime" th:value="*{billingTime}" class="form-control" placeholder="yyyy-mm-dd hh:ii:ss" type="text">
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">客户代码:</label>
|
|
<div class="col-sm-8">
|
|
<select name="enterpriseCode" class="form-control m-b" required>
|
|
<option value="">请选择客户代码</option>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">客户名称:</label>
|
|
<div class="col-sm-8">
|
|
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text" required readonly>
|
|
|
|
<!-- <select name="enterpriseName" class="form-control m-b">-->
|
|
<!-- <option value="">所有</option>-->
|
|
<!-- </select>-->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">联系人:</label>
|
|
<div class="col-sm-8">
|
|
<input name="customerContact" th:field="*{customerContact}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">客户厂区:</label>
|
|
<div class="col-sm-8">
|
|
<select name="customerFactory" class="form-control m-b">
|
|
<option value="">所有</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">联系电话:</label>
|
|
<div class="col-sm-8">
|
|
<input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">业务人员:</label>
|
|
<div class="col-sm-8">
|
|
<input name="businessMembers" th:field="*{businessMembers}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">传真号码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="customerFax" th:field="*{customerFax}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">交货地点:</label>
|
|
<div class="col-sm-8">
|
|
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">付款条件:</label>
|
|
<div class="col-sm-8">
|
|
<input name="paymentTerms" th:field="*{paymentTerms}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">交货条件:</label>
|
|
<div class="col-sm-8">
|
|
<input name="deliveryConditions" th:field="*{deliveryConditions}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">交货方式:</label>
|
|
<div class="col-sm-8">
|
|
<input name="deliveryMethod" th:field="*{deliveryMethod}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">接单方式:</label>
|
|
<div class="col-sm-8">
|
|
<input name="orderReceivingMode" th:field="*{orderReceivingMode}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">是否含税:</label>
|
|
<div class="col-sm-8">
|
|
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('sys_whether')}">-->
|
|
<!-- <input type="radio" th:id="${'confirmTax_' + dict.dictCode}" name="confirmTax" th:value="${dict.dictValue}" th:field="*{confirmTax}">-->
|
|
<!-- <label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
|
|
<!-- </div>-->
|
|
|
|
<input name="confirmTax" th:field="*{confirmTax}" class="form-control" type="text" readonly>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">税率:</label>
|
|
<div class="col-sm-8">
|
|
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">接单日期:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="orderReceivingTime" th:value="*{orderReceivingTime}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">修改日期:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="modificationTime" th:value="*{modificationTime}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group">-->
|
|
<!-- <label class="col-sm-3 control-label">审核否:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <select name="auditNo" class="form-control m-b" th:with="type=${@dict.getType('sys_whether')}">-->
|
|
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{auditNo}"></option>-->
|
|
<!-- </select>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
|
|
<!-- <div class="form-group">-->
|
|
<!-- <label class="col-sm-3 control-label">审核人:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="auditName" th:field="*{auditName}" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
|
|
<!-- <div class="form-group">-->
|
|
<!-- <label class="col-sm-3 control-label">审核时间:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <div class="input-group date">-->
|
|
<!-- <input name="auditTime" th:value="*{auditTime}" class="form-control" placeholder="yyyy-mm-dd hh:ii:ss" type="text">-->
|
|
<!-- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group">-->
|
|
<!-- <label class="col-sm-3 control-label">审核备注:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <textarea name="auditRemarks" class="form-control">[[*{auditRemarks}]]</textarea>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">确认否:</label>
|
|
<div class="col-sm-8">
|
|
<select name="confirmNo" class="form-control m-b" th:with="type=${@dict.getType('sys_whether')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{confirmNo}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">确认日期:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="confirmTime" th:value="*{confirmTime}" class="form-control" placeholder="yyyy-mm-dd hh:ii:ss" type="text">
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">确认人:</label>
|
|
<div class="col-sm-8">
|
|
<input name="confirmName" th:field="*{confirmName}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">备注内容:</label>
|
|
<div class="col-sm-8">
|
|
<textarea name="customerRemarks" class="form-control">[[*{customerRemarks}]]</textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">文件存储:</label>
|
|
<div class="col-sm-8">
|
|
<input type="hidden" name="fileUpload" th:field="*{fileUpload}">
|
|
<div class="file-loading">
|
|
<input class="form-control file-upload" id="fileUpload" name="file" type="file">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="division">
|
|
<h4>计算</h4>
|
|
</div>
|
|
<div class="form-group changeWidth">
|
|
<label class="col-sm-3 control-label">当前库存数:</label>
|
|
<div class="col-sm-8">
|
|
<input name="currentInventory" th:field="*{currentInventory}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group changeWidth">
|
|
<label class="col-sm-3 control-label">信用额度:</label>
|
|
<div class="col-sm-8">
|
|
<input name="creditLimit" th:field="*{creditLimit}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group changeWidth">
|
|
<label class="col-sm-3 control-label">未付款数:</label>
|
|
<div class="col-sm-8">
|
|
<input name="unpaidAmount" th:field="*{unpaidAmount}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group changeWidth">
|
|
<label class="col-sm-3 control-label">可用额度:</label>
|
|
<div class="col-sm-8">
|
|
<input name="availableCredit" th:field="*{availableCredit}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group changeWidth">
|
|
<label class="col-sm-3 control-label">合计金额:</label>
|
|
<div class="col-sm-8">
|
|
<input id="totalAmount" name="totalAmount" th:field="*{totalAmount}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">备用一:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="standbyOne" th:field="*{standbyOne}" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">备用二:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="standbyTwo" th:field="*{standbyTwo}" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
</form>
|
|
</div>
|
|
|
|
|
|
<div class="other-container">
|
|
<div class="other">
|
|
<div class="btn-group-sm" id="toolbar" role="group">
|
|
<a class="btn btn-primary" onclick="addFinish()">
|
|
<i class="fa fa-plus"></i> 添加成品
|
|
</a>
|
|
<a class="btn btn-danger" onclick="removeFinish()">
|
|
<i class="fa fa-remove"></i> 删除成品
|
|
</a>
|
|
<!-- <a class="btn btn-success" onclick="confirmraw()">-->
|
|
<!-- <i class="fa fa-plus"></i> 确认添加-->
|
|
<!-- </a>-->
|
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="addFinishbomTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal inmodal" id="FinishModal"
|
|
role="dilog" aria-hidden="true">
|
|
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
|
|
<div class="modal-content" style="background-color: #FFFFFF">
|
|
<div class="title">成品资料</div>
|
|
<div class="modal-body">
|
|
<div class="search">
|
|
<div class="col-sm-12 search-collapse">
|
|
<form id="formFinishSearch">
|
|
<div class="select-list">
|
|
<ul>
|
|
<li>
|
|
<label>成品代码:</label>
|
|
<input type="text" name="finishProductCode"/>
|
|
</li>
|
|
<li>
|
|
<label>成品名称:</label>
|
|
<input type="text" name="finishProductName"/>
|
|
</li>
|
|
|
|
<li>
|
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="finishSearch()"><i
|
|
class="fa fa-search"></i> 搜索</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table id="FinishbomTable" class="table table-striped table-responsive"
|
|
style="padding-bottom: 50px; white-space:nowrap">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="addFinishconfirm()">
|
|
确定
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: select2-js"/>
|
|
<th:block th:include="include :: bootstrap-table-editable-js"/>
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
|
<script th:inline="javascript">
|
|
|
|
var getData = [[${sysSalesOrder}]];
|
|
var prefix = ctx + "system/salesOrder";
|
|
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
|
|
$("#form-salesOrder-edit").validate({
|
|
focusCleanup: true
|
|
});
|
|
// 时间
|
|
var today = new Date();
|
|
today.setTime(today.getTime());
|
|
var time = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
|
|
$(".file-upload").each(function (i) {
|
|
var val = $("input[name='" + this.id + "']").val()
|
|
$(this).fileinput({
|
|
'uploadUrl': prefix + '/upload',
|
|
initialPreviewAsData: true,
|
|
initialPreview: [val],
|
|
maxFileCount: 1,
|
|
autoReplace: true,
|
|
showPreview: true,
|
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
|
}).on('fileremoved', function (event, id, index) {
|
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
|
})
|
|
$(this).fileinput('_initFileActions');
|
|
});
|
|
Date.prototype.Format = function (fmt) {
|
|
var o = {
|
|
"M+": this.getMonth() + 1, //月份
|
|
"d+": this.getDate(), //日
|
|
"H+": this.getHours(), //小时
|
|
"m+": this.getMinutes(), //分
|
|
"s+": this.getSeconds(), //秒
|
|
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
|
"S": this.getMilliseconds() //毫秒
|
|
};
|
|
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
for (var k in o)
|
|
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
|
return fmt;
|
|
}
|
|
|
|
function submitHandler() {
|
|
if ($.validate.form()) {
|
|
confirmFinish();
|
|
updateFinish();
|
|
$.operate.save(prefix + "/edit", $('#form-salesOrder-edit').serialize());
|
|
}
|
|
}
|
|
|
|
$("input[name='orderReceivingTime']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true
|
|
});
|
|
|
|
$("input[name='billingTime']").datetimepicker({
|
|
format: 'yyyy-mm-dd hh:ii:ss',
|
|
autoclose: true,
|
|
minView: 0,
|
|
minuteStep:1
|
|
});
|
|
|
|
$("input[name='modificationTime']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true
|
|
});
|
|
|
|
$("input[name='confirmTime']").datetimepicker({
|
|
format: 'yyyy-mm-dd hh:ii:ss',
|
|
autoclose: true,
|
|
minView: 0,
|
|
minuteStep:1
|
|
});
|
|
|
|
$("input[name='auditTime']").datetimepicker({
|
|
format: 'yyyy-mm-dd hh:ii:ss',
|
|
autoclose: true,
|
|
minView: 0,
|
|
minuteStep: 1
|
|
});
|
|
|
|
// 确认
|
|
$("select[name='confirmNo']").change(function (){
|
|
console.log($(this).val())
|
|
if($(this).val()==1){
|
|
$("input[name='confirmTime']").datetimepicker("setDate",new Date());
|
|
|
|
}
|
|
else {
|
|
$("input[name='confirmTime']").val('')
|
|
}
|
|
})
|
|
|
|
// 审核
|
|
$("select[name='auditNo']").change(function () {
|
|
console.log($(this).val())
|
|
if ($(this).val() == 1) {
|
|
$("input[name='auditTime']").datetimepicker("setDate", new Date());
|
|
} else {
|
|
$("input[name='auditTime']").val('')
|
|
}
|
|
})
|
|
|
|
//客户信息
|
|
var customerodata = []
|
|
$.ajax({
|
|
url: ctx + "system/customer/list",
|
|
type: "POST",
|
|
success: function (res) {
|
|
// console.log(res)
|
|
if (res.rows.length > 0) {
|
|
customerodata = res.rows;
|
|
//alert(JSON.stringify(data));
|
|
console.log(res.rows)
|
|
for (let i in customerodata) {
|
|
$("select[name='enterpriseCode']").append("<option value='" + customerodata[i].enterpriseCode + "'>" + customerodata[i].enterpriseCode + "</option>");
|
|
// $("select[name='enterpriseName']").append("<option value='" + customerodata[i].enterpriseName + "'>" + customerodata[i].enterpriseName + "</option>");
|
|
}
|
|
$("select[name='enterpriseCode']").val(getData.enterpriseCode).trigger("change");
|
|
} else {
|
|
$.modal.msgError(res.msg);
|
|
}
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("后台出错啦!");
|
|
|
|
}
|
|
|
|
})
|
|
|
|
$("select[name='enterpriseCode']").change(function () {
|
|
var enterpriseCode = $(this).val();
|
|
|
|
for (i = 0; i < customerodata.length; i++) {
|
|
if (customerodata[i].enterpriseCode === enterpriseCode) {
|
|
// console.log(customerodata)
|
|
$("input[name='enterpriseName']").val(customerodata[i].enterpriseName)
|
|
$("input[name='contactNumber']").val(customerodata[i].contactNumber)
|
|
$("input[name='businessMembers']").val(customerodata[i].businessMembers)
|
|
$("input[name='customerFax']").val(customerodata[i].customerFax)
|
|
$("input[name='deliveryAddress']").val(customerodata[i].deliveryAddress)
|
|
$("input[name='customerContact']").val(customerodata[i].customerContact)
|
|
$("input[name='paymentTerms']").val(customerodata[i].paymentTerms)
|
|
|
|
if (customerodata[i].confirmTax == 1) {
|
|
|
|
$("input[name='confirmTax']").val("是")
|
|
|
|
} else {
|
|
$("input[name='confirmTax']").val("否")
|
|
|
|
}
|
|
$("input[name='taxRate']").val(customerodata[i].taxRate)
|
|
|
|
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
|
|
// 添加成品
|
|
|
|
function addFinish() {
|
|
|
|
if($("select[name='enterpriseCode']").val()==''||$("select[name='enterpriseCode']").val()==null){
|
|
// alert("请先选择客户")
|
|
$.modal.alert("请先选择客户");
|
|
|
|
}else {
|
|
$("#FinishModal").modal("show");
|
|
$("#FinishbomTable").bootstrapTable('refresh');
|
|
// 所有产品数据
|
|
//全部itemList
|
|
$('#FinishbomTable').bootstrapTable({
|
|
url: ctx + "system/productquotation/list",
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
pageList: [10, 25, 50, 100],
|
|
showRefresh: false,
|
|
method: "post",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
striped: true, // 是否显示行间隔色
|
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
|
|
clickToSelect: true, // 是否启用点击选中行
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
// singleSelect: true,
|
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
|
height: 250,
|
|
queryParams: function (params) {
|
|
//console.log("123");
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
enterpriseCode: $("select[name='enterpriseCode']").val()
|
|
|
|
};
|
|
// console.log(data[0].enterpriseCode)
|
|
let json = $.extend(curParams, $.common.formToJSON("formFinishSearch"),);
|
|
return json;
|
|
// return curParams
|
|
},
|
|
|
|
columns: [
|
|
{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'productQuotationId',
|
|
title: '产品报价id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'quotationCode',
|
|
title: '报价编码'
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码'
|
|
},
|
|
{
|
|
field: 'finishProductName',
|
|
title: '成品名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'customerNumber',
|
|
title: '客户料号'
|
|
},
|
|
{
|
|
field: 'typeMachine',
|
|
title: '机种'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位',
|
|
|
|
},
|
|
{
|
|
field: 'commonCurrency',
|
|
title: '币别',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(commonCurrencyDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'processPrice',
|
|
title: '单价'
|
|
},
|
|
{
|
|
field: 'enterpriseCode',
|
|
title: '客户编号'
|
|
},
|
|
{
|
|
field: 'enterpriseName',
|
|
title: '客户名称'
|
|
},
|
|
{
|
|
field: 'registrant',
|
|
title: '登记人',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'pricingDate',
|
|
title: '订价日期',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'taxRate',
|
|
title: '税率'
|
|
},
|
|
{
|
|
field: 'priceExcludingTax',
|
|
title: '不含税价',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'priceIncludingTax',
|
|
title: '含税价',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'lastPrice',
|
|
title: '上次价格',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'lastPriceEnd',
|
|
title: '上次价格2',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'costRmb',
|
|
title: '当前材料成本RMB',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'currentExchangeRate',
|
|
title: '当前汇率',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'proportionMaterials',
|
|
title: '材料占比',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'quotationExplain',
|
|
title: '备注说明',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'currentQuote',
|
|
title: '是否为当前报价',
|
|
visible: false
|
|
|
|
|
|
},
|
|
{
|
|
field: 'confirmTax',
|
|
title: '是否含税'
|
|
},
|
|
{
|
|
field: 'confirmNo',
|
|
title: '确认否',
|
|
visible: false
|
|
|
|
|
|
},
|
|
{
|
|
field: 'confirmName',
|
|
title: '确认人',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'confirmTime',
|
|
title: '确认时间',
|
|
visible: false
|
|
|
|
},
|
|
|
|
|
|
]
|
|
});
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 搜索
|
|
function finishSearch(){
|
|
$("#FinishbomTable").bootstrapTable("refresh");
|
|
}
|
|
|
|
// 删除
|
|
function removeFinish(){
|
|
let addFinishbomTable=$("#addFinishbomTable").bootstrapTable("getSelections");
|
|
console.log(addFinishbomTable)
|
|
if(addFinishbomTable.length>0){
|
|
let salesFinishId= addFinishbomTable[0].salesFinishId
|
|
$.ajax({
|
|
url: ctx + "system/salesFinish/remove",
|
|
type: "POST",
|
|
data: {
|
|
ids: salesFinishId
|
|
},
|
|
success: function (res) {
|
|
// console.log(res)
|
|
$.modal.alert("删除成功")
|
|
|
|
$("#addFinishbomTable").bootstrapTable('refreshOptions', {pageNumber: 1}); // pageNumber:1, 指定页码为第1页
|
|
$("#addFinishbomTable").bootstrapTable('refresh');
|
|
}
|
|
})
|
|
} else {
|
|
// alert("请选择需要删除的一条数据")
|
|
$.modal.alert("请选择需要删除的一条数据");
|
|
}
|
|
|
|
|
|
}
|
|
// 添加成品
|
|
function addFinishconfirm(){
|
|
var data = $("#FinishbomTable").bootstrapTable("getSelections");
|
|
var count = $('#addFinishbomTable').bootstrapTable('getData').length;
|
|
|
|
for (i = 0; i < data.length; i++) {
|
|
|
|
let salesOrderCode = $("input[name='salesOrderCode']").val()
|
|
let salesOrderNumber = $("input[name='salesOrderNumber']").val()
|
|
let enterpriseCode = $("select[name='enterpriseCode']").val()
|
|
let enterpriseName = $("input[name='enterpriseName']").val()
|
|
let bootstrapTable = $('#addFinishbomTable').bootstrapTable('getRowByUniqueId', data[i].finishProductCode);
|
|
if (bootstrapTable != null) {
|
|
$.modal.alert(bootstrapTable.finishProductName + "已存在,不可重复添加!");
|
|
continue;
|
|
}
|
|
$("#addFinishbomTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
finishProductCode: data[i].finishProductCode,
|
|
finishProductName: data[i].finishProductName,
|
|
specificationModel: data[i].specificationModel,
|
|
inventoryUnit: data[i].inventoryUnit,
|
|
customerNumber: data[i].customerNumber,
|
|
typeMachine: data[i].typeMachine,
|
|
stockUnitWeight: '0',
|
|
processPrice: data[i].processPrice,
|
|
versionNumber: '',
|
|
commonCurrency: data[i].commonCurrency,
|
|
amountMoney:'0',
|
|
deliveryTime:'',
|
|
line:'',
|
|
salesExplain:'',
|
|
productQuantity:'0',
|
|
salesOrderCode: salesOrderCode,
|
|
salesOrderNumber:salesOrderNumber,
|
|
enterpriseCode:enterpriseCode,
|
|
enterpriseName:enterpriseName,
|
|
}
|
|
});
|
|
}
|
|
$("#FinishbomTable").bootstrapTable("uncheckAll");
|
|
// console.log($('#addrowbomTable').bootstrapTable('getData'))
|
|
|
|
}
|
|
|
|
// 添加成品
|
|
function confirmFinish() {
|
|
let data = $('#addFinishbomTable').bootstrapTable('getData', true);
|
|
console.log(data)
|
|
let dataLength=$('#addFinishbomTable').bootstrapTable('getData', true)
|
|
for (var i=0;i<data.length;i++) {
|
|
data[i].salesOrderCode = $("input[name='salesOrderCode']").val();
|
|
data[i].salesOrderNumber = $("input[name='salesOrderNumber']").val();
|
|
}
|
|
if(dataLength.length>0){
|
|
$.ajax({
|
|
url: ctx + 'system/salesFinish/editAdd',
|
|
type: "POST",
|
|
data: {
|
|
data: JSON.stringify(data)
|
|
},
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
console.log(resp)
|
|
$("#addFinishbomTable").bootstrapTable('refresh');
|
|
},
|
|
|
|
})
|
|
}
|
|
|
|
|
|
}
|
|
|
|
// 更新数据
|
|
|
|
function updateFinish() {
|
|
|
|
$("#FinishbomTable").bootstrapTable('refresh');
|
|
let data = $('#addFinishbomTable').bootstrapTable('getData', true);
|
|
let dataLength = $('#addFinishbomTable').bootstrapTable('getData', true)
|
|
for (var i=0;i<data.length;i++) {
|
|
data[i].salesOrderCode = $("input[name='salesOrderCode']").val();
|
|
data[i].salesOrderNumber = $("input[name='salesOrderNumber']").val();
|
|
}
|
|
if (dataLength.length > 0) {
|
|
$.ajax({
|
|
url: ctx + 'system/salesFinish/updateFinish',
|
|
type: "POST",
|
|
data: {
|
|
data: JSON.stringify(data)
|
|
},
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
console.log(resp)
|
|
},
|
|
|
|
})
|
|
}
|
|
}
|
|
|
|
let salesOrderNumber= $("input[name='salesOrderNumber']").val()
|
|
// 产品报价表格
|
|
$('#addFinishbomTable').bootstrapTable({
|
|
url : ctx + "system/salesFinish/list",
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
pageList: [10, 25, 50, 100],
|
|
showRefresh: false,
|
|
method: "post",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
striped: true, // 是否显示行间隔色
|
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
// sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
|
|
clickToSelect: true, // 是否启用点击选中行
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
singleSelect: false,
|
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
|
height: 250,
|
|
uniqueId: 'finishProductCode',
|
|
onEditableSave:onEditableSave,
|
|
queryParams: function (params) {
|
|
//console.log("123");
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
salesOrderNumber: salesOrderNumber
|
|
};
|
|
return curParams
|
|
},
|
|
columns: [
|
|
|
|
{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码'
|
|
},
|
|
{
|
|
field: 'finishProductName',
|
|
title: '成品名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'customerNumber',
|
|
title: '客户料号'
|
|
},
|
|
{
|
|
field: 'typeMachine',
|
|
title: '机种'
|
|
},
|
|
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位',
|
|
|
|
},
|
|
{
|
|
field: 'stockUnitWeight',
|
|
title: '重量',
|
|
|
|
|
|
},
|
|
{
|
|
field: 'commonCurrency',
|
|
title: '币别',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(commonCurrencyDatas, value);
|
|
}
|
|
|
|
},
|
|
{
|
|
field: 'processPrice',
|
|
title: '单价',
|
|
|
|
},
|
|
{
|
|
field: 'productQuantity',
|
|
title: '数量',
|
|
editable: {
|
|
type: 'text',
|
|
title: '数量',
|
|
validate: function (value) {
|
|
if (isNaN(value)) return '使用量必须是数字';
|
|
var price = parseFloat(value);
|
|
if (price <= 0) return '使用量必须大于0';
|
|
}
|
|
}
|
|
|
|
},
|
|
{
|
|
field: 'amountMoney',
|
|
title: '金额',
|
|
|
|
},
|
|
{
|
|
field: 'deliveryTime',
|
|
title: '交期',
|
|
editable: {
|
|
type: 'date',
|
|
title: '交期',
|
|
emptytext: time,
|
|
validate: function (value) {
|
|
var now = new Date();
|
|
if (value.getTime() < now.getTime()) {
|
|
return "交期至少是今天!";
|
|
}
|
|
}
|
|
}
|
|
|
|
},
|
|
{
|
|
field: 'line',
|
|
title: 'Line#',
|
|
editable: {
|
|
type: 'text',
|
|
title: 'Line',
|
|
emptytext: 'Line',
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
|
|
},
|
|
{
|
|
field: 'versionNumber',
|
|
title: '版本号',
|
|
editable: {
|
|
type: 'text',
|
|
title: '版本号',
|
|
emptytext: '版本号',
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'salesExplain',
|
|
title: '说明',
|
|
editable: {
|
|
type: 'text',
|
|
title: '说明',
|
|
emptytext: '说明',
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
|
|
},
|
|
{
|
|
field: 'standbyOne',
|
|
title: '备用一',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'standbyTwo',
|
|
title: '备用二',
|
|
visible: false
|
|
|
|
},
|
|
// {
|
|
// title: '操作',
|
|
// align: 'center',
|
|
// formatter: function (value, row, index) {
|
|
// var actions = [];
|
|
// actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="remove(\'' + row.finishProductCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
|
|
// return actions.join('');
|
|
// }
|
|
// }
|
|
|
|
]
|
|
|
|
});
|
|
|
|
// 金额计算
|
|
function getTotalAmount(){
|
|
// $("#addFinishbomTable").bootstrapTable('refresh');
|
|
let getData = $('#addFinishbomTable').bootstrapTable('getData', true);
|
|
let totalAmount=0
|
|
for(var i=0;i<getData.length;i++)
|
|
{
|
|
totalAmount=Number(getData[i].amountMoney)+totalAmount
|
|
|
|
}
|
|
console.log(totalAmount)
|
|
$("#totalAmount").val(totalAmount)
|
|
}
|
|
// 结算金额
|
|
function onEditableSave(field, row, oldValue, $el){
|
|
$('#addFinishbomTable').bootstrapTable('updateByUniqueId', {
|
|
id: row.finishProductCode,
|
|
row: {
|
|
amountMoney: row.productQuantity*row.processPrice,
|
|
}
|
|
});
|
|
getTotalAmount()
|
|
}
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|