282 lines
13 KiB
Plaintext
282 lines
13 KiB
Plaintext
<%@page import="com.sipai.entity.sparepart.SparePartCommString"%>
|
||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%request.setAttribute("START", SparePartCommString.STATUS_STOCK_START); %>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single{
|
||
height:34px;
|
||
line-height: 34px;
|
||
}
|
||
.select2-selection__arrow{
|
||
margin-top:3px;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
//流程审核文件上传所需参数
|
||
var masterId_process = '${id}';//业务Id
|
||
var tbName_process = 'TB_Process_UploadFile'; //数据表
|
||
var nameSpace_process ='ProcessUploadFile';//保存文件夹
|
||
var status = 'delete';//有删除权限
|
||
|
||
function dosave() {
|
||
$.post(ext.contextPath + "/sparepart/stockCheck/getCheck.do", {warehouseId: $("#warehouseId").val()}, function(res) {
|
||
if (res.data == 0){
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('instockManName', 'NOT_VALIDATED',null)
|
||
.validateField('instockManName');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/sparepart/inStockRecord/save.do", $("#subForm").serialize(), function(data) {
|
||
if (data.res == 1){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
//editFun('${id}');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
}
|
||
}else{
|
||
showAlert('d',res.res);
|
||
}
|
||
},'json');
|
||
}
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
instockDate: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '入库日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
warehouseId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '所属仓库不能为空'
|
||
}
|
||
}
|
||
},
|
||
instockManName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '入库负责人不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
$(function(){
|
||
//初始化文件显示
|
||
getFileList_process();
|
||
// 初始化显示内容
|
||
viewFun();
|
||
//选择仓库
|
||
$.post(ext.contextPath + "/sparepart/warehouse/getWarehouseForSelectByCompanyId.do", {companyId:"${company.id}"}, function(data) {
|
||
var selelct =$("#warehouseId").select2({
|
||
data: data,
|
||
placeholder:'请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
|
||
});
|
||
selelct.val('').trigger("change");
|
||
},'json');
|
||
//采购时间
|
||
$("#instockDate").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format:'yyyy-mm-dd',
|
||
});
|
||
$("#instockDate").datepicker('setDate',new Date());
|
||
|
||
$.post(ext.contextPath + "/sparepart/contractTaxRate/getContractTaxRate4Selecttext.do", {}, function (data) {
|
||
var selelct = $("#taxrate").select2({
|
||
data: data,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
|
||
});
|
||
selelct.val(data[0].id).trigger("change");
|
||
}, 'json');
|
||
|
||
});
|
||
|
||
function viewFun() {
|
||
$("#fareAdjustment").change(function () {
|
||
let fareAdjustment = $("#fareAdjustment").val();
|
||
// 是否后期补票默认是 不显示
|
||
if (fareAdjustment == 0) {
|
||
document.getElementById('iDiv').style.display = 'block';
|
||
} else {
|
||
document.getElementById('iDiv').style.display = 'none';
|
||
}
|
||
});
|
||
$("#vatInvoice").change(function () {
|
||
let vatInvoice = $("#vatInvoice").val();
|
||
// 是否专票 默认不显示
|
||
if (vatInvoice == 1 && $('#invoiceNumber').val() != '') {
|
||
document.getElementById('tDiv').style.display = 'block';
|
||
} else {
|
||
document.getElementById('tDiv').style.display = 'none';
|
||
}
|
||
});
|
||
}
|
||
|
||
//选择入库负责人
|
||
var showUser4SelectsFun = function() {
|
||
var userIds= $("#instockManId").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"instockManId",textId:"instockManName",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
//选择入库审核人
|
||
var showUser4AuditSelectsFun = function() {
|
||
var userIds= $("#auditManId").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"auditManId",textId:"auditManName",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
|
||
var vDivFun = function () {
|
||
if ($('#invoiceNumber').val() != '' && $("#fareAdjustment").val() == 0) {
|
||
document.getElementById('vDiv').style.display = 'block';
|
||
} else {
|
||
document.getElementById('vDiv').style.display = 'none';
|
||
$("#vatInvoice").val(0).trigger("change");
|
||
}
|
||
}
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-lg">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">新增入库记录</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subForm">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input name="status" type="hidden" value="${START}"/>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">所属厂区</label>
|
||
<div class="col-sm-4">
|
||
<input name="bizId" type="hidden" value="${company.id}"/>
|
||
<p class="form-control-static" >${company.name}</p>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*所属仓库</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="warehouseId" name="warehouseId" style="width: 270px;" ></select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*入库单号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="id" name ="id" placeholder="名称" value="${id}" readonly>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*入库日期</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="instockDate" name="instockDate" style="width: 230px;" placeholder="请选择"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">票据单号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="billNumber" name ="billNumber" placeholder="票据单号" value="">
|
||
</div>
|
||
<label class="col-sm-2 control-label">*入库人</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="instockManName" name="instockManName" placeholder="点击选择" onclick="showUser4SelectsFun();" value="${cu.caption}">
|
||
<input id="instockManId" name="instockManId" type="hidden" value="${cu.id}" />
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">是否后期补票</label>
|
||
<div class="col-sm-4">
|
||
<select type="text" id="fareAdjustment" class="form-control pull-right" name="fareAdjustment" >
|
||
<option value=1 selected >是</option>
|
||
<option value=0>否</option>
|
||
</select>
|
||
</div>
|
||
<div id="iDiv" style="display: none;">
|
||
<label class="col-sm-2 control-label">发票号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="invoiceNumber" name ="invoiceNumber" placeholder="发票号" value="" onchange="vDivFun()">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<div id="vDiv" style="display: none;">
|
||
<label class="col-sm-2 control-label">是否专票</label>
|
||
<div class="col-sm-4">
|
||
<select type="text" id="vatInvoice" class="form-control pull-right" name="vatInvoice" >
|
||
<option value=1>是</option>
|
||
<option value=0 selected >否</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div id="tDiv" style="display: none;">
|
||
<label class="col-sm-2 control-label">税率(%)</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="taxrate"
|
||
name="taxrate"
|
||
style="width: 270px;">
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">审核人</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="auditManName" name="auditManName" placeholder="点击选择" onclick="showUser4AuditSelectsFun();">
|
||
<input id="auditManId" name="auditManId" type="hidden" />
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="2" id ="remark" name ="remark" placeholder="备注..."></textarea>
|
||
</div>
|
||
</div>
|
||
<!-- 文件上传,显示 -->
|
||
<div class="form-group" style="margin:8px">
|
||
<label class="col-sm-2 control-label"></label>
|
||
<button type="button" class="btn btn-default btn-file" onclick="fileinput_process()"><i class="fa fa-paperclip"></i>上传文件</button>
|
||
</div>
|
||
<div id="fileArea">
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="dosave()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|