万材erp项目
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.

1091 lines
39 KiB

2 years ago
<!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: 20% !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-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">订单编号:</label>
<div class="col-sm-8">
<input name="salesOrderCode" class="form-control" type="text" required readonly>
2 years ago
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">订单号码:</label>
<div class="col-sm-8">
<input name="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" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">开单日期时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="billingTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
<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">客户名称:</label>
<div class="col-sm-8">
<!-- <select name="enterpriseName" class="form-control m-b">-->
<!-- <option value="">所有</option>-->
<!-- </select>-->
<input name="enterpriseName" 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="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" 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" 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" 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" 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" 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" 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" 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" 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:checked="${dict.default}">-->
<!-- <label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!-- </div>-->
<input name="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" 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" 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">
<div class="input-group date">
<input name="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')}" readonly>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">审核人:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="auditName" 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">-->
<!-- <div class="input-group date">-->
<!-- <input name="auditTime" class="form-control" placeholder="yyyy-mm-dd hh:ii:ss" type="text" readonly>-->
<!-- <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" readonly></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}"></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" 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" 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"></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">
<div class="file-loading">
<input class="form-control file-upload" id="fileUpload" name="file" type="file">
</div>
</div>
</div>
<div class="division">
<h3>计算</h3>
</div>
<div class="form-group changeWidth">
<label class="col-sm-3 control-label">当前库存数:</label>
<div class="col-sm-8">
<input name="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" 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" 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" 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" 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" 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" 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-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>&nbsp;搜索</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 prefix = ctx + "system/salesOrder"
var customerUseOrNotDatas = [[${@dict.getType('sys_whether')}]];
var accountReconciliationOrNotDatas = [[${@dict.getType('sys_whether')}]];
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
2 years ago
$("#form-salesOrder-add").validate({
focusCleanup: true
});
$(".file-upload").fileinput({
uploadUrl: prefix + '/upload',
maxFileCount: 1,
autoReplace: true,
overwriteInitial: false,
initialPreviewAsData: true,
}).on('fileuploaded', function (event, data, previewId, index) {
// console.log(event.currentTarget.id)
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
var today = new Date();
today.setTime(today.getTime());
var time = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
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()
$.operate.save(prefix + "/add", $('#form-salesOrder-add').serialize());
}
}
$("input[name='orderReceivingTime']").datetimepicker({
format: 'yyyy-mm-dd hh:ii:ss',
autoclose: true,
minView: 0,
minuteStep: 1
});
$("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
});
$("input[name='billingTime']").datetimepicker("setDate", new Date());
$("input[name='orderReceivingTime']").datetimepicker("setDate", new Date());
// 确认
$("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>");
}
} else {
$.modal.msgError(res.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
//获取单号
$.ajax({
url: prefix + "/getId",
type: "post",
dateType: "json",
success: function (resp) {
if (resp.code === 0) {
$("input[name='salesOrderCode']").val(resp.data);
} else {
$.modal.msgError("失败啦");
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
});
2 years ago
$("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){
$.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服务端分页(*)
2 years ago
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: '客户料号'
},
2 years ago
{
field: 'typeMachine',
title: '机种'
},
{
field: 'inventoryUnit',
title: '单位',
},
{
field: 'commonCurrency',
title: '币别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(commonCurrencyDatas, value);
}
2 years ago
},
{
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 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,
2 years ago
typeMachine: data[i].typeMachine,
stockUnitWeight: '0',
processPrice: data[i].processPrice,
versionNumber: '',
commonCurrency: data[i].commonCurrency,
amountMoney:'0',
deliveryTime:'',
line:'',
salesExplain:'',
productQuantity:'0',
customerUseOrNot: customerUseOrNotDatas[0].dictValue,
accountReconciliationOrNot: accountReconciliationOrNotDatas[0].dictValue,
salesOrderCode: salesOrderCode,
salesOrderNumber:salesOrderNumber,
enterpriseCode:enterpriseCode,
enterpriseName:enterpriseName,
}
});
}
$("#FinishbomTable").bootstrapTable("uncheckAll");
// console.log($('#addrowbomTable').bootstrapTable('getData'))
}
// 产品报价表格
$('#addFinishbomTable').bootstrapTable({
// url : ctx + "system/rawmaterial/itemList",
pagination: true,
pageNumber: 1,
pageSize: 10,
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
// singleSelect: true,
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,
// enterpriseCode: data[0].enterpriseCode
};
// console.log(data[0].enterpriseCode)
return curParams
},
columns: [
{
checkbox: true
},
{
field: 'finishProductCode',
title: '成品代码'
},
{
field: 'finishProductName',
title: '成品名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'customerNumber',
title: '客户料号'
},
2 years ago
{
field: 'typeMachine',
title: '机种'
},
{
field: 'inventoryUnit',
title: '单位',
},
{
field: 'stockUnitWeight',
title: '重量',
},
{
field: 'commonCurrency',
title: '币别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(commonCurrencyDatas, value);
}
2 years ago
},
{
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: 'customerUseOrNot',
title: '客户使用否',
formatter: function (value, row, index) {
return customerUseOrNotDatas[0].dictValue;
},
visible: false
},
{
field: 'accountReconciliationOrNot',
title: '对账否',
formatter:function (value, row, index) {
return accountReconciliationOrNotDatas[0].dictValue;
},
visible: false
},
{
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 remove(finishProductCode){
var ids = [];
ids.push(finishProductCode);
$('#addFinishbomTable').bootstrapTable("remove",{
field:'finishProductCode',
values:ids
})
$("#addFinishbomTable").bootstrapTable('refresh');
}
// 添加成品
function confirmFinish() {
$("#addFinishbomTable").bootstrapTable('refresh');
let data = JSON.stringify($('#addFinishbomTable').bootstrapTable('getData', true));
console.log(data)
let dataLength=$('#addFinishbomTable').bootstrapTable('getData', true)
if(dataLength.length>0){
$.ajax({
url: ctx + 'system/salesFinish/add',
type: "POST",
data: {
data: data
},
dataType: "json",
success: function (resp) {
console.log(resp)
},
})
}
}
// 金额计算
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>