411 lines
18 KiB
Plaintext
411 lines
18 KiB
Plaintext
|
|
<%@page import="com.sipai.entity.sparepart.SparePartCommString"%>
|
|||
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<%request.setAttribute("PLAN", SparePartCommString.PURCHASE_PLAN); %>
|
|||
|
|
<%request.setAttribute("START", SparePartCommString.STATUS_START); %>
|
|||
|
|
<%request.setAttribute("COMEIN", SparePartCommString.STATUS_COMEIN); %>
|
|||
|
|
<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 = '${purchaseRecord.id}';//业务Id
|
|||
|
|
var tbName_process = 'TB_Process_UploadFile'; //数据表
|
|||
|
|
var nameSpace_process ='ProcessUploadFile';//保存文件夹
|
|||
|
|
var status = 'delete';//有删除权限
|
|||
|
|
|
|||
|
|
function doupdate() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/sparepart/purchaseRecord/update.do", $("#subForm").serialize(), function(data) {
|
|||
|
|
if (data.res == 1){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var dosubmit = function() {
|
|||
|
|
swal({
|
|||
|
|
text: "提交后无法修改,您确定要提交记录吗?",
|
|||
|
|
dangerMode: true,
|
|||
|
|
buttons: {
|
|||
|
|
cancel: {
|
|||
|
|
text: "取消",
|
|||
|
|
value: null,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-default btn-sm",
|
|||
|
|
closeModal: true,
|
|||
|
|
},
|
|||
|
|
confirm: {
|
|||
|
|
text: "确定",
|
|||
|
|
value: true,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-danger btn-sm",
|
|||
|
|
closeModal: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
.then(function(willDelete) {
|
|||
|
|
if (willDelete) {
|
|||
|
|
$("#status").val("${COMEIN}");
|
|||
|
|
doupdate();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
//输入框验证
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
purchaseDate: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '采购日期不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
purchaseManName: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '采购负责人不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
//添加采购记录明细
|
|||
|
|
var addPurchaseRecordDetailFun = function() {
|
|||
|
|
var allTableData = $("#table_PurchaseRecordDetail").bootstrapTable('getData');
|
|||
|
|
var subscribeDetailIds="";
|
|||
|
|
$.each(allTableData,function(index,item){
|
|||
|
|
if(subscribeDetailIds!=""){
|
|||
|
|
subscribeDetailIds+=",";
|
|||
|
|
}
|
|||
|
|
subscribeDetailIds+=item.subscribeDetailId;
|
|||
|
|
})
|
|||
|
|
$.post(ext.contextPath + '/sparepart/purchaseRecord/selectPurchaseDetails.do', {companyId : '${purchaseRecord.company.id}',
|
|||
|
|
subscribeDetailIds:subscribeDetailIds},
|
|||
|
|
function(data) {
|
|||
|
|
$("#Goods4SelectsDiv").html(data);
|
|||
|
|
openModal('subDetailModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
var doFinishSelects = function(data) {
|
|||
|
|
$.post(ext.contextPath + "/sparepart/purchaseRecord/savePurchaseRecordDetails.do", {ids : data , recordId : '${purchaseRecord.id}' }, function(data) {
|
|||
|
|
if (data.res == 'true'){
|
|||
|
|
$("#table_PurchaseRecordDetail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
};
|
|||
|
|
//删除多条申购明细数据
|
|||
|
|
var deletesPurchaseRecordDetailFun = function() {
|
|||
|
|
var checkedItems = $("#table_PurchaseRecordDetail").bootstrapTable('getSelections');
|
|||
|
|
var datas="";
|
|||
|
|
$.each(checkedItems, function(index, item){
|
|||
|
|
datas+=item.id+",";
|
|||
|
|
});
|
|||
|
|
if(datas==""){
|
|||
|
|
showAlert('d','请先选择记录','alertDiv');
|
|||
|
|
}else{
|
|||
|
|
swal({
|
|||
|
|
text: "您确定要删除此记录?",
|
|||
|
|
dangerMode: true,
|
|||
|
|
buttons: {
|
|||
|
|
cancel: {
|
|||
|
|
text: "取消",
|
|||
|
|
value: null,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-default btn-sm",
|
|||
|
|
closeModal: true,
|
|||
|
|
},
|
|||
|
|
confirm: {
|
|||
|
|
text: "确定",
|
|||
|
|
value: true,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-danger btn-sm",
|
|||
|
|
closeModal: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
.then(function(willDelete) {
|
|||
|
|
if (willDelete) {
|
|||
|
|
$.post(ext.contextPath + '/sparepart/purchaseRecord/deletesPurchaseRecordDetail.do', {ids:datas} , function(data) {
|
|||
|
|
if(data>0){
|
|||
|
|
$("#table_PurchaseRecordDetail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','删除失败','alertDiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
$(function(){
|
|||
|
|
//初始化文件显示
|
|||
|
|
getFileList_process();
|
|||
|
|
$('#table_PurchaseRecordDetail').bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/sparepart/purchaseRecord/getPurchaseRecordDetailList.do', // 获取表格数据的url
|
|||
|
|
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
|||
|
|
striped: true, //表格显示条纹,默认为false
|
|||
|
|
pagination: true, // 在表格底部显示分页组件,默认false
|
|||
|
|
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
|||
|
|
pageSize: 10, // 页面数据条数
|
|||
|
|
pageNumber: 1, // 首页页码
|
|||
|
|
sidePagination: 'server', // 设置为服务器端分页
|
|||
|
|
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
|||
|
|
return {
|
|||
|
|
rows: params.limit, // 每页要显示的数据条数
|
|||
|
|
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
|||
|
|
sort: params.sort, // 要排序的字段
|
|||
|
|
order: params.order,
|
|||
|
|
pid:'${purchaseRecord.id}',
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'id', // 要排序的字段
|
|||
|
|
sortOrder: 'desc', // 排序规则
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
checkbox: true, // 显示一个勾选框
|
|||
|
|
},{
|
|||
|
|
field: 'goods.name', // 返回json数据中的name
|
|||
|
|
title: '物品名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'goods.model', // 返回json数据中的name
|
|||
|
|
title: '规格型号', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'goods.brand', // 返回json数据中的name
|
|||
|
|
title: '品牌', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'goods.unit', // 返回json数据中的name
|
|||
|
|
title: '单位', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'dept.name', // 返回json数据中的name
|
|||
|
|
title: '采购部门', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'number', // 返回json数据中的name
|
|||
|
|
title: '到货数量', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
editable: { //编辑列元素
|
|||
|
|
type: 'text',
|
|||
|
|
title: '到货数量',
|
|||
|
|
validate: function (v) {
|
|||
|
|
if (!v)
|
|||
|
|
return '数量不能为空';
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},{
|
|||
|
|
field: 'subscribeDetail.usableNumber', // 返回json数据中的name
|
|||
|
|
title: '可用数量', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'price', // 返回json数据中的name
|
|||
|
|
title: '单价/元', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
/* editable: { //编辑列元素
|
|||
|
|
type: 'text',
|
|||
|
|
title: '单价',
|
|||
|
|
validate: function (v) {
|
|||
|
|
if (!v) return '单价不能为空';
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
} */
|
|||
|
|
},{
|
|||
|
|
field: 'totalMoney', // 返回json数据中的name
|
|||
|
|
title: '合计/元', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
//保存列修改后的数据
|
|||
|
|
onEditableSave: function (field, row, oldValue, $el) {
|
|||
|
|
$.post(ext.contextPath + "/sparepart/purchaseRecord/updatePurchaseRecordDetail.do", {id:row.id,price:row.price,number:row.number}, function(data) {
|
|||
|
|
if (data.res == 1){
|
|||
|
|
$("#table_PurchaseRecordDetail").bootstrapTable('refresh');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','编辑失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
$("#table_PurchaseRecordDetail").bootstrapTable('refresh');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
},
|
|||
|
|
onLoadSuccess: function(){ //加载成功时执行
|
|||
|
|
adjustBootstrapTableView("table_PurchaseRecordDetail");
|
|||
|
|
},
|
|||
|
|
onLoadError: function(){ //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
//采购时间
|
|||
|
|
$("#purchaseDate").datepicker({
|
|||
|
|
language: 'zh-CN',
|
|||
|
|
autoclose: true,
|
|||
|
|
todayHighlight: true,
|
|||
|
|
format:'yyyy-mm-dd',
|
|||
|
|
})
|
|||
|
|
$("#purchaseDate").datepicker('setDate',new Date());
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
$("#sendMessageType").change(function () {
|
|||
|
|
let sendMessageType = $("#sendMessageType").val();
|
|||
|
|
if (sendMessageType == 1) {
|
|||
|
|
document.getElementById('iDiv').style.display = 'block';
|
|||
|
|
} else {
|
|||
|
|
document.getElementById('iDiv').style.display = 'none';
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//选择采购负责人
|
|||
|
|
var showUser4SelectsFun = function() {
|
|||
|
|
var userIds= $("#purchaseManId").val();
|
|||
|
|
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"purchaseManId",textId:"purchaseManName",userIds:userIds} , function(data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
//选择通知的库管
|
|||
|
|
var showSUser4SelectsFun = function() {
|
|||
|
|
var userIds= $("#sUserId").val();
|
|||
|
|
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"sUserId",textId:"sUserName",userIds:userIds} , function(data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
//关闭模态框时刷新表格数据
|
|||
|
|
function closeModel(){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}
|
|||
|
|
</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 id="status" name="status" type="hidden" value="${purchaseRecord.status}"/>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">所属厂区</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<input name="bizId" type="hidden" value="${purchaseRecord.company.id}"/>
|
|||
|
|
<p class="form-control-static" >${purchaseRecord.company.name}</p>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*记录单号</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input type="text" class="form-control" id="id" name ="id" placeholder="名称" value="${purchaseRecord.id}" readonly>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*采购日期</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<div class="input-group-addon">
|
|||
|
|
<i class="fa fa-calendar"></i>
|
|||
|
|
</div>
|
|||
|
|
<input type="text" class="form-control" id="purchaseDate" name="purchaseDate" value="${purchaseRecord.purchaseDate}" style="width: 230px;" placeholder="请选择"/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*采购负责人</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input type="text" class="form-control" id="purchaseManName" name="purchaseManName" placeholder="点击选择" onclick="showUser4SelectsFun();" value="${purchaseRecord.purchaseManName}" >
|
|||
|
|
<input id="purchaseManId" name="purchaseManId" type="hidden" value="${purchaseRecord.purchaseManId}" />
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">是否通知库管</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select type="text" id="sendMessageType" class="form-control pull-right" name="sendMessageType" >
|
|||
|
|
<option value=1>是</option>
|
|||
|
|
<option value=0 selected>否</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div id="iDiv" style="display: none;">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">库管通知选择</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input type="text" class="form-control" id="sUserName" name="sUserName" placeholder="点击选择" onclick="showSUser4SelectsFun();" value="${purchaseRecord.sUserName}" >
|
|||
|
|
<input id="sUserId" name="sUserId" type="hidden" value="${purchaseRecord.sUserId}" />
|
|||
|
|
</div>
|
|||
|
|
</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="备注...">${purchaseRecord.remark}</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()" id="btn_save"><i class="fa fa-paperclip"></i>上传文件</button>
|
|||
|
|
</div>
|
|||
|
|
<div id="fileArea">
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
<div class="box box-primary" >
|
|||
|
|
<div class="box-header with-border">
|
|||
|
|
<h3 class="box-title">采购记录明细</h3>
|
|||
|
|
<div class="box-tools pull-right">
|
|||
|
|
<a onclick="addPurchaseRecordDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="按采购计划导入明细"><i class="glyphicon glyphicon-plus"></i></a>
|
|||
|
|
<a onclick="deletesPurchaseRecordDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-minus"></i></a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.box-header -->
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<table id="table_PurchaseRecordDetail"></table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default" onclick="closeModel()">关闭</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_save">保存</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="dosubmit()" id="btn_save">提交</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|