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.
882 lines
38 KiB
882 lines
38 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" />
|
|
<th:block th:include="include :: bootstrap-editable-css"/>
|
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
|
<style>
|
|
.other-container {
|
|
width: 90%;
|
|
height: 200px;
|
|
margin: auto;
|
|
}
|
|
.other {
|
|
margin-top: 20px;
|
|
}
|
|
h4 {
|
|
display: inline-block;
|
|
margin-right: 20px;
|
|
}
|
|
.modal-body{
|
|
height: 550px;
|
|
}
|
|
iframe{
|
|
width: 100%;
|
|
height: 500px;
|
|
frameborder: 0;
|
|
border: 0;
|
|
display: inline-block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-purchaseOrder-add">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">订购单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="purchaseOrderNumber" class="form-control" type="text" required readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">供应商代码:</label>
|
|
<div class="col-sm-8">
|
|
<select name="supplierCode" 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="supplierName" 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="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">
|
|
<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="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="purchaseName" 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="billingDate" 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">
|
|
<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">
|
|
<!-- <input name="purchaseCategory" class="form-control" type="text">-->
|
|
<select name="purchaseCategory" class="form-control m-b" th:with="type=${@dict.getType('purchase_category')}">
|
|
<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="purchaseCommander" class="form-control" type="text">-->
|
|
<select name="purchaseCommander" class="form-control m-b" required>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">客户订单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="customerOrderNumber" 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 class="form-control" name="remarkContent" type="text"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-group hidden">
|
|
<label class="col-sm-3 control-label">结案否:</label>
|
|
<div class="col-sm-8">
|
|
<select name="closeCaseNo" 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 hidden">
|
|
<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 hidden">
|
|
<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}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group hidden">
|
|
<label class="col-sm-3 control-label">核准否:</label>
|
|
<div class="col-sm-8">
|
|
<select name="approveNo" 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 hidden">
|
|
<label class="col-sm-3 control-label">对账否:</label>
|
|
<div class="col-sm-8">
|
|
<select name="accountReconciliationFlag" 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">-->
|
|
<!-- <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">
|
|
<br><hr>
|
|
<h4>选择采购信息</h4><a class="btn btn-primary" onclick="showQuotationModal()"><i class="fa fa-plus"></i> 选择信息</a>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="addQuotationTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
<div class="modal inmodal" id="supplierQuotationModal"
|
|
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="modal-body">
|
|
<div class="container-div">
|
|
<div class="row">
|
|
<div class="col-sm-12 search-collapse">
|
|
<form id="quotationFormId">
|
|
<div class="select-list">
|
|
<ul>
|
|
<li>
|
|
<label>报价编码:</label>
|
|
<input type="text" name="quotationCode"/>
|
|
</li>
|
|
<li>
|
|
<label>原辅料代码:</label>
|
|
<input type="text" name="rawSubsidiaryCode"/>
|
|
|
|
</li>
|
|
<li>
|
|
<label>原辅料名称:</label>
|
|
<input type="text" name="rawSubsidiaryName"/>
|
|
</li>
|
|
<!-- <li>-->
|
|
<!-- <label>供应商名称:</label>-->
|
|
<!-- <input type="text" name="supplierName"/>-->
|
|
|
|
<!-- </li>-->
|
|
<li>
|
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('quotationFormId','quotationTable')"><i
|
|
class="fa fa-search"></i> 搜索</a>
|
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('quotationFormId','quotationTable')"><i
|
|
class="fa fa-refresh"></i> 重置</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="quotationTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a class="btn btn-warning btn-rounded" onclick="addQuotationToTable()">确认添加</a>
|
|
<a class="btn btn-primary btn-rounded" onclick="closeQuotationModal()">关闭</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
<th:block th:include="include :: select2-js"/>
|
|
<th:block th:include="include :: bootstrap-table-editable-js"/>
|
|
<script th:inline="javascript">
|
|
|
|
|
|
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
|
|
var purchasingUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
|
var confirmTaxDatas = [[${@dict.getType('sys_whether')}]];
|
|
var materialTypeDatas = [[${@dict.getType('ck_meterialt_type')}]];
|
|
var currentQuoteDatas = [[${@dict.getType('sys_whether')}]];
|
|
var confirmNoDatas = [[${@dict.getType('sys_whether')}]];
|
|
var auditNoDatas = [[${@dict.getType('sys_whether')}]];
|
|
var approveNoDatas = [[${@dict.getType('sys_whether')}]];
|
|
var accountReconciliationFlagDatas = [[${@dict.getType('sys_whether')}]];
|
|
|
|
var prefix = ctx + "purchase/purchaseOrder"
|
|
var prefixSupplierQuotation = ctx + 'system/supplierquotation'
|
|
var prefixPurchaseMaterial = ctx + 'purchase/purchaseMaterial'
|
|
|
|
$("#form-purchaseOrder-add").validate({
|
|
focusCleanup: true
|
|
});
|
|
|
|
function submitHandler() {
|
|
let getData=$('#addQuotationTable').bootstrapTable('getData', true)
|
|
if(getData.length > 0){
|
|
//确认添加选中的物料数据
|
|
confirmQuotation();
|
|
if ($.validate.form()) {
|
|
$.operate.save(prefix + "/add", $('#form-purchaseOrder-add').serialize()); }
|
|
} else {
|
|
$.modal.alertWarning("未选择物料,请选择!")
|
|
}
|
|
}
|
|
|
|
$("input[name='billingDate']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true
|
|
});
|
|
$("input[name='billingDate']").datetimepicker("setDate", new Date())
|
|
|
|
$(function() {
|
|
|
|
//初始化添加材料表
|
|
$('#addQuotationTable').bootstrapTable({
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,//点击行选中
|
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
|
height: 250,
|
|
uniqueId: 'rawSubsidiaryCode',
|
|
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: [
|
|
{
|
|
title: '操作',
|
|
align: 'center',
|
|
formatter: function (value, row, index) {
|
|
var actions = [];
|
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeProductData(\'' + row.rawSubsidiaryCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
|
|
return actions.join('');
|
|
}
|
|
},
|
|
|
|
{
|
|
field: 'purchaseMaterialId',
|
|
title: '采购材料id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'purchaseOrderNumber',
|
|
title: '订购单号',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'supplierCode',
|
|
title: '供应商代码',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'supplierName',
|
|
title: '供应商名称',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'rawSubsidiaryCode',
|
|
title: '原辅料代码'
|
|
},
|
|
{
|
|
field: 'rawSubsidiaryName',
|
|
title: '原辅料名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'materialType',
|
|
title: '物料类别',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(materialTypeDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'commonCurrency',
|
|
title: '币别',
|
|
editable: {
|
|
type: 'select',
|
|
title: '币别',
|
|
emptytext: '币别',
|
|
source: function() {
|
|
let result = [];
|
|
for (let i = 0;i<commonCurrencyDatas.length;i++) {
|
|
result.push({value: commonCurrencyDatas[i].dictValue,text: commonCurrencyDatas[i].dictLabel})
|
|
}
|
|
return result;
|
|
},
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'purchasingUnit',
|
|
title: '采购单位'
|
|
},
|
|
{
|
|
field: 'purchasePrice',
|
|
title: '采购单价'
|
|
},
|
|
{
|
|
field: 'materialQuantity',
|
|
title: '数量',
|
|
editable: {
|
|
type: 'text',
|
|
title: '数量',
|
|
emptytext: '数量',
|
|
validate: function (v) {
|
|
if (isNaN(v)) return '数量必须是数字';
|
|
var ex = /^[1-9]\d*$/;
|
|
if (!ex.test(v)) return '数量必须是正整数';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'amountMoney',
|
|
title: '金额',
|
|
editable: {
|
|
type: 'text',
|
|
title: '金额',
|
|
emptytext: '金额',
|
|
validate: function (value) {
|
|
|
|
}
|
|
},
|
|
formatter:function(value, row, index) {
|
|
let total = row.purchasePrice * row.materialQuantity;
|
|
row.amountMoney = (row.purchasePrice * row.materialQuantity).toFixed(2);
|
|
return total.toFixed(2);
|
|
}
|
|
},
|
|
{
|
|
field: 'deliveryTime',
|
|
title: '交期',
|
|
editable: {
|
|
type: 'date',
|
|
title: '交期',
|
|
emptytext: '交期',
|
|
clear: false,
|
|
placement: 'center',//位置
|
|
// title: '请选择日期:',
|
|
validate: function (value) {
|
|
var now = new Date();
|
|
if (value.getTime() < now.getTime()) {
|
|
return "交期至少是今天!";
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'purchaseExplain',
|
|
title: '说明',
|
|
editable: {
|
|
type: 'text',
|
|
title: '说明',
|
|
emptytext: '说明',
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'accountReconciliationFlag',
|
|
title: '对账否',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(accountReconciliationFlagDatas, value);
|
|
},
|
|
visible: false
|
|
}]
|
|
})
|
|
|
|
});
|
|
|
|
//获取单号
|
|
$.ajax({
|
|
url: prefix + "/getId",
|
|
type: "post",
|
|
dateType: "json",
|
|
success: function (resp) {
|
|
if (resp.code === 0) {
|
|
$("input[name='purchaseOrderNumber']").val(resp.data);
|
|
} else {
|
|
$.modal.msgError("失败啦");
|
|
}
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("后台出错啦!");
|
|
}
|
|
});
|
|
|
|
//默认购方名称为本公司
|
|
$("input[name='purchaseName']").val("淮安科恩仕电子科技有限公司");
|
|
|
|
/*供应商列表*/
|
|
$.ajax({
|
|
url: ctx + 'system/supplier/list',
|
|
type: 'post',
|
|
success: function (res) {
|
|
console.log(res)
|
|
if (res.rows.length > 0) {
|
|
var suppliertData = res.rows;
|
|
//alert(JSON.stringify(data));
|
|
for (let i in suppliertData) {
|
|
// console.log(finishProductData[i].finishProductCode)
|
|
$("#form-purchaseOrder-add select[name='supplierCode']").append("<option value='" + suppliertData[i].supplierCode + "'>" + suppliertData[i].supplierCode + "</option>");
|
|
}
|
|
$("#form-purchaseOrder-add select[name='supplierCode']").change(function () {
|
|
var code = $(this).val();
|
|
for (let i=0;i<suppliertData.length;i++) {
|
|
if (suppliertData[i].supplierCode == code) {
|
|
$("#form-purchaseOrder-add input[name='supplierName']").val(suppliertData[i].supplierName);
|
|
$("#form-purchaseOrder-add input[name='customerContact']").val(suppliertData[i].customerContact);
|
|
$("#form-purchaseOrder-add input[name='contactNumber']").val(suppliertData[i].contactNumber);
|
|
$("#form-purchaseOrder-add input[name='customerFax']").val(suppliertData[i].customerFax);
|
|
$("#form-purchaseOrder-add input[name='paymentTerms']").val(suppliertData[i].paymentTerms);
|
|
$("#form-purchaseOrder-add input[name='taxRate']").val(suppliertData[i].taxRate);
|
|
}
|
|
}
|
|
})
|
|
|
|
} else {
|
|
$.modal.msgError(res.msg);
|
|
}
|
|
}
|
|
})
|
|
/*用户列表*/
|
|
$.ajax({
|
|
url: ctx + 'system/user/list',
|
|
type: 'post',
|
|
success: function (res) {
|
|
console.log(res)
|
|
if (res.rows.length > 0) {
|
|
var usertData = res.rows;
|
|
//alert(JSON.stringify(data));
|
|
for (let i in usertData) {
|
|
// console.log(finishProductData[i].finishProductCode)
|
|
$("#form-purchaseOrder-add select[name='purchaseCommander']").append("<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>");
|
|
}
|
|
let userName = [[${@permission.getPrincipalProperty('userName')}]];
|
|
$("#form-purchaseOrder-add select[name='purchaseCommander']").val(userName).trigger("change")
|
|
|
|
} else {
|
|
$.modal.msgError(res.msg);
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
/*添加报价信息*/
|
|
//点击按钮显示报价信息模态框
|
|
function showQuotationModal() {
|
|
if ($.validate.form()) {
|
|
$("#supplierQuotationModal").modal("show");
|
|
//显示报价信息
|
|
showQuotationData();
|
|
} else {
|
|
$.modal.alertWarning("请填写必填项");
|
|
}
|
|
}
|
|
|
|
//关闭报价信息模态框
|
|
function closeQuotationModal() {
|
|
$("#supplierQuotationModal").modal("hide");
|
|
}
|
|
|
|
//显示报价信息
|
|
function showQuotationData() {
|
|
var supplierCode = $("#form-purchaseOrder-add select[name='supplierCode']").val()
|
|
// console.log(supplierCode)
|
|
// var enterpriseName = $("#form-deliveryGoodsNotice-add input[name='enterpriseName']").val()
|
|
// console.log(enterpriseName)
|
|
$("#quotationTable").bootstrapTable("destroy")
|
|
var options = {
|
|
id: 'quotationTable',
|
|
url: prefixSupplierQuotation + "/list",
|
|
modalName: "供应商报价",
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
showRefresh: false,
|
|
showToggle: false,
|
|
clickToSelect: true,
|
|
queryParams: function (params) {
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
supplierCode: supplierCode
|
|
};
|
|
let json = $.extend(curParams, $.common.formToJSON("quotationFormId"));
|
|
return json;
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'supplierQuotationId',
|
|
title: '供应商报价id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'auditNo',
|
|
title: '审核否',
|
|
formatter: function (value, row, index) {
|
|
// return $.table.selectDictLabel(auditNoDatas, value);
|
|
var actions = [];
|
|
if ($.table.selectDictLabel(auditNoDatas, value) == "<span class=''>是</span>") {
|
|
actions.push('<a class="btn btn-primary btn-xs disabled">已审核</a> ');
|
|
} else {
|
|
actions.push('<a class="btn btn-danger btn-xs disabled">未审核</a> ');
|
|
}
|
|
return actions.join('');
|
|
},
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'confirmNo',
|
|
title: '确认否',
|
|
formatter: function (value, row, index) {
|
|
// return $.table.selectDictLabel(confirmNoDatas, value);
|
|
|
|
var actions = [];
|
|
if ($.table.selectDictLabel(confirmNoDatas, value) == "<span class=''>是</span>") {
|
|
actions.push('<a class="btn btn-primary btn-xs disabled">已确认</a> ');
|
|
} else {
|
|
actions.push('<a class="btn btn-danger btn-xs disabled">未确认</a> ');
|
|
}
|
|
return actions.join('');
|
|
},
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'approveNo',
|
|
title: '核准否',
|
|
formatter: function (value, row, index) {
|
|
// return $.table.selectDictLabel(confirmNoDatas, value);
|
|
|
|
var actions = [];
|
|
if ($.table.selectDictLabel(approveNoDatas, value) == "<span class=''>是</span>") {
|
|
actions.push('<a class="btn btn-primary btn-xs disabled">已核准</a> ');
|
|
} else {
|
|
actions.push('<a class="btn btn-danger btn-xs disabled">未核准</a> ');
|
|
}
|
|
return actions.join('');
|
|
},
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'quotationCode',
|
|
title: '报价编码'
|
|
},
|
|
{
|
|
field: 'rawSubsidiaryCode',
|
|
title: '原辅料代码'
|
|
},
|
|
{
|
|
field: 'rawSubsidiaryName',
|
|
title: '原辅料名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'typeMachine',
|
|
title: '机种'
|
|
},
|
|
{
|
|
field: 'materialType',
|
|
title: '物料类别',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(materialTypeDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '库存单位'
|
|
},
|
|
{
|
|
field: 'commonCurrency',
|
|
title: '币别',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(commonCurrencyDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'inventoryPrice',
|
|
title: '库存单价'
|
|
},
|
|
{
|
|
field: 'purchasingUnit',
|
|
title: '采购单位',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(purchasingUnitDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'purchasePrice',
|
|
title: '采购单价'
|
|
},
|
|
{
|
|
field: 'relationalFormula',
|
|
title: '关系公式'
|
|
},
|
|
{
|
|
field: 'supplierCode',
|
|
title: '供应商编号'
|
|
},
|
|
{
|
|
field: 'supplierName',
|
|
title: '供应商名称'
|
|
},
|
|
{
|
|
field: 'pricingDate',
|
|
title: '定价日期'
|
|
},
|
|
{
|
|
field: 'confirmTax',
|
|
title: '含税否',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(confirmTaxDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'taxRate',
|
|
title: '税率'
|
|
},
|
|
{
|
|
field: 'quotationExplain',
|
|
title: '说明'
|
|
},
|
|
{
|
|
field: 'currentQuote',
|
|
title: '是否为当前报价',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(currentQuoteDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'registrant',
|
|
title: '登记人',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'confirmName',
|
|
title: '确认人',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'confirmTime',
|
|
title: '确认时间',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'auditName',
|
|
title: '审核人',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'auditTime',
|
|
title: '审核时间',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'approveName',
|
|
title: '核准人',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'approveTime',
|
|
title: '核准时间',
|
|
visible: false
|
|
}]
|
|
};
|
|
$.table.init(options);
|
|
}
|
|
|
|
//表中添加选中的物料信息
|
|
function addQuotationToTable() {
|
|
var data = $("#quotationTable").bootstrapTable("getSelections");
|
|
var count = $('#addQuotationTable').bootstrapTable('getData').length;
|
|
var purchaseOrderNumber = $("input[name='purchaseOrderNumber']").val();
|
|
var supplierCode = $("select[name='supplierCode']").val();
|
|
var supplierName = $("input[name='supplierName']").val();
|
|
|
|
//获取当前日期
|
|
let d = new Date();
|
|
let curr_date = d.getDate();
|
|
let curr_month = d.getMonth() + 1;
|
|
let curr_year = d.getFullYear();
|
|
String(curr_month).length < 2 ? (curr_month = "0" + curr_month): curr_month;
|
|
String(curr_date).length < 2 ? (curr_date = "0" + curr_date): curr_date;
|
|
let yyyyMMdd = curr_year + "-" + curr_month +"-"+ curr_date;
|
|
// console.log(yyyyMMdd)
|
|
// console.log(data);
|
|
// console.log(count);
|
|
for (i = 0; i < data.length; i++) {
|
|
let rawSubsidiary = $('#addQuotationTable').bootstrapTable('getRowByUniqueId', data[i].rawSubsidiaryCode);
|
|
console.log(rawSubsidiary)
|
|
console.log(data[i].rawSubsidiaryCode)
|
|
if (rawSubsidiary != null) {
|
|
alert(rawSubsidiary.rawSubsidiaryName + "已存在,不可重复添加!");
|
|
continue;
|
|
}
|
|
$("#addQuotationTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
purchaseOrderNumber: purchaseOrderNumber,
|
|
supplierCode: supplierCode,
|
|
supplierName: supplierName,
|
|
rawSubsidiaryCode: data[i].rawSubsidiaryCode,
|
|
rawSubsidiaryName: data[i].rawSubsidiaryName,
|
|
specificationModel: data[i].specificationModel,
|
|
materialType: data[i].materialType,
|
|
commonCurrency: data[i].commonCurrency,
|
|
purchasingUnit: data[i].purchasingUnit,
|
|
purchasePrice: data[i].purchasePrice,
|
|
materialQuantity: '',
|
|
amountMoney: '',
|
|
deliveryTime: yyyyMMdd,
|
|
purchaseExplain: '',
|
|
accountReconciliationFlag: 0
|
|
}
|
|
});
|
|
}
|
|
$("#quotationTable").bootstrapTable("uncheckAll");
|
|
closeQuotationModal();
|
|
}
|
|
|
|
//确认添加选中的物料数据
|
|
function confirmQuotation() {
|
|
$("#addQuotationTable").bootstrapTable('refresh');
|
|
let data = $('#addQuotationTable').bootstrapTable('getData', true);
|
|
// let getData=$('#addProductTable').bootstrapTable('getData', true)
|
|
// console.log(data)
|
|
$.ajax({
|
|
url: prefixPurchaseMaterial + '/addEditSave',
|
|
type: "POST",
|
|
data: {
|
|
data: JSON.stringify(data)
|
|
},
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
// console.log(data)
|
|
console.log(resp)
|
|
},
|
|
|
|
})
|
|
}
|
|
|
|
//添加表格内删除物料信息
|
|
function removeProductData(rawSubsidiaryCode){
|
|
var ids = [];
|
|
ids.push(rawSubsidiaryCode);
|
|
$('#addQuotationTable').bootstrapTable("remove",{
|
|
field:'rawSubsidiaryCode',
|
|
values:ids
|
|
})
|
|
$("#addQuotationTable").bootstrapTable('refresh');
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|