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.
878 lines
40 KiB
878 lines
40 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"/>
|
|
<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-edit" th:object="${purchaseOrder}">
|
|
<input name="purchaseOrderId" th:field="*{purchaseOrderId}" type="hidden">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">订购单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="purchaseOrderNumber" th:field="*{purchaseOrderNumber}" class="form-control" type="text" 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 disabled>
|
|
<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" th:field="*{supplierName}" class="form-control" type="text" required readonly>
|
|
</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">
|
|
<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="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="purchaseName" th:field="*{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" th:field="*{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" 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">
|
|
<!-- <input name="purchaseCategory" th:field="*{purchaseCategory}" class="form-control" type="text">-->
|
|
<select name="purchaseCategory" th:field="*{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" th:field="*{purchaseCommander}" class="form-control" type="text">-->
|
|
<select name="purchaseCommander" th:field="*{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" th:field="*{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" th:field="*{remarkContent}" 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}" th:field="*{closeCaseNo}"></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}" th:field="*{confirmNo}"></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}" th:field="*{auditNo}"></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}" th:field="*{approveNo}"></option>
|
|
</select>
|
|
</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">
|
|
<br><hr>
|
|
<h4>选择采购信息</h4>
|
|
<a class="btn btn-primary" onclick="showQuotationModal()"><i class="fa fa-plus"></i> 选择材料</a>
|
|
<a class="btn btn-danger" onclick="removeMaterial()" ><i class="fa fa-remove"></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 getData = [[${purchaseOrder}]];
|
|
|
|
|
|
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
|
|
var purchasingUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
|
var materialTypeDatas = [[${@dict.getType('ck_meterialt_type')}]];
|
|
var confirmTaxDatas = [[${@dict.getType('sys_whether')}]];
|
|
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 prefix = ctx + "purchase/purchaseOrder";
|
|
var prefixSupplierQuotation = ctx + 'system/supplierquotation'
|
|
var prefixPurchaseMaterial = ctx + 'purchase/purchaseMaterial'
|
|
|
|
$("#form-purchaseOrder-edit").validate({
|
|
focusCleanup: true
|
|
});
|
|
|
|
function submitHandler() {
|
|
// if ($.validate.form()) {
|
|
// $.operate.save(prefix + "/edit", $('#form-purchaseOrder-edit').serialize());
|
|
// }
|
|
let getData=$('#addQuotationTable').bootstrapTable('getData', true)
|
|
if(getData.length > 0){
|
|
if ($.validate.form()) {
|
|
$.modal.confirm("确认以上修改吗?", function (){
|
|
//确认添加选中的物料数据
|
|
confirmQuotation();
|
|
$.operate.save(prefix + "/edit", $('#form-purchaseOrder-edit').serialize());
|
|
})
|
|
}
|
|
} else {
|
|
$.modal.alertWarning("未选择产品,请选择!")
|
|
}
|
|
}
|
|
|
|
$("input[name='billingDate']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true
|
|
});
|
|
|
|
$(function() {
|
|
|
|
//初始化添加材料表
|
|
$('#addQuotationTable').bootstrapTable({
|
|
url: prefixPurchaseMaterial + '/list',
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
method: "post",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
striped: true, // 是否显示行间隔色
|
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
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,
|
|
purchaseOrderNumber: getData.purchaseOrderNumber,
|
|
supplierCode: getData.supplierCode,
|
|
supplierName: getData.supplierName
|
|
};
|
|
// console.log(data[0].enterpriseCode)
|
|
return curParams
|
|
},
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
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 date = eval('new ' + eval(value).source)
|
|
// return date.format("yyyy-MM-dd");
|
|
}
|
|
}
|
|
},
|
|
{
|
|
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: 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-edit select[name='supplierCode']").append("<option value='" + suppliertData[i].supplierCode + "'>" + suppliertData[i].supplierCode + "</option>");
|
|
}
|
|
$("#form-purchaseOrder-edit select[name='supplierCode']").val(getData.supplierCode).trigger("change")
|
|
$("#form-purchaseOrder-edit select[name='supplierCode']").change(function () {
|
|
var code = $(this).val();
|
|
for (let i=0;i<suppliertData.length;i++) {
|
|
if (suppliertData[i].supplierCode == code) {
|
|
$("#form-purchaseOrder-edit input[name='supplierName']").val(suppliertData[i].supplierName);
|
|
$("#form-purchaseOrder-edit input[name='customerContact']").val(suppliertData[i].customerContact);
|
|
$("#form-purchaseOrder-edit input[name='contactNumber']").val(suppliertData[i].contactNumber);
|
|
$("#form-purchaseOrder-edit input[name='customerFax']").val(suppliertData[i].customerFax);
|
|
$("#form-purchaseOrder-edit input[name='paymentTerms']").val(suppliertData[i].paymentTerms);
|
|
$("#form-purchaseOrder-edit 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-edit select[name='purchaseCommander']").append("<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>");
|
|
}
|
|
$("#form-purchaseOrder-edit select[name='purchaseCommander']").val(getData.purchaseCommander).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-edit 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();
|
|
// console.log(data);
|
|
// console.log(count);
|
|
for (var i = 0; i < data.length; i++) {
|
|
let rawSubsidiary = $('#addQuotationTable').bootstrapTable('getRowByUniqueId', 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: '',
|
|
purchaseExplain: '',
|
|
accountReconciliationFlag: 0
|
|
}
|
|
});
|
|
}
|
|
|
|
$("#quotationTable").bootstrapTable("uncheckAll");
|
|
closeQuotationModal();
|
|
}
|
|
|
|
//确认添加选中的物料数据
|
|
function confirmQuotation() {
|
|
$("#addQuotationTable").bootstrapTable('refresh');
|
|
let data = $('#addQuotationTable').bootstrapTable('getData', true);
|
|
// console.log(data)
|
|
if (data.length > 0) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
data[i].purchaseOrderNumber = $("input[name='purchaseOrderNumber']").val();
|
|
data[i].supplierCode = $("select[name='supplierCode']").val();
|
|
data[i].supplierName = $("input[name='supplierName']").val();
|
|
}
|
|
$.ajax({
|
|
url: prefixPurchaseMaterial + '/addEditSave',
|
|
type: "POST",
|
|
data: {
|
|
data: JSON.stringify(data)
|
|
},
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
// console.log(data)
|
|
console.log(resp)
|
|
},
|
|
|
|
})
|
|
}
|
|
}
|
|
|
|
// 批量删除成品
|
|
function removeMaterial() {
|
|
var addQuotationTableData = $("#addQuotationTable").bootstrapTable("getSelections");
|
|
var ids = [];
|
|
var rawSubsidiaryCodes=[];
|
|
for (let i = 0;i < addQuotationTableData.length;i++) {
|
|
ids.push(addQuotationTableData[i].purchaseMaterialId)
|
|
rawSubsidiaryCodes.push(addQuotationTableData[i].rawSubsidiaryCode)
|
|
}
|
|
// console.log(ids)
|
|
if (addQuotationTableData.length > 0) {
|
|
$.modal.confirm("是否确认要删除选中的产品?", function (){
|
|
$.ajax({
|
|
url: prefixPurchaseMaterial + "/removeMaterial",
|
|
type: "POST",
|
|
data: {
|
|
ids: JSON.stringify(ids)
|
|
},
|
|
success: function (res) {
|
|
// console.log(ids)
|
|
// console.log(res)
|
|
$.modal.msgSuccess("删除成功")
|
|
// $("#addProductTable").bootstrapTable('refreshOptions', {pageNumber: 1}); // pageNumber:1, 指定页码为第1页
|
|
// $("#addProductTable").bootstrapTable('refresh');
|
|
$("#addQuotationTable").bootstrapTable ('remove', { field: 'rawSubsidiaryCode', values: rawSubsidiaryCodes })
|
|
}
|
|
})
|
|
})
|
|
|
|
} else {
|
|
alert("请选择需要删除的数据")
|
|
}
|
|
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|