516 lines
24 KiB
Plaintext
516 lines
24 KiB
Plaintext
<%@page import="com.sipai.entity.sparepart.SparePartCommString"%>
|
||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%request.setAttribute("AUDIT", SparePartCommString.STATUS_STOCK_AUDIT); %>
|
||
<%request.setAttribute("START", SparePartCommString.STATUS_STOCK_START); %>
|
||
<%request.setAttribute("FINSH", SparePartCommString.STATUS_STOCK_FINISH); %>
|
||
<%request.setAttribute("INSTOCK_OTHER", SparePartCommString.INSTOCK_OTHER); %>
|
||
<%request.setAttribute("INSTOCK_PURCHASE", SparePartCommString.INSTOCK_PURCHASE); %>
|
||
<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 = '${rawMaterial.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/rawMaterial/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');
|
||
}
|
||
}
|
||
function dosubmit(){
|
||
$.post(ext.contextPath + "/sparepart/rawMaterial/submitRawMaterialHandle.do", $("#subUnitForm").serialize(), function(unitdata) {
|
||
if (unitdata.res == 1) {
|
||
closeModal('subModal')
|
||
$("#table").bootstrapTable('refresh');
|
||
}else if(unitdata.res == 0){
|
||
showAlert('d','保存失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
}
|
||
//关闭模态框时刷新表格数据
|
||
function closeModel(){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
}
|
||
//新增药剂登记明细
|
||
var addRawMaterialDetailFun = function() {
|
||
var allTableData = $("#table_rawMaterialDetail").bootstrapTable('getData');
|
||
var PRDetailIds="";//PRDetail是purchaseRecordDetail的简写
|
||
$.each(allTableData,function(index,item){
|
||
if(PRDetailIds!=""){
|
||
PRDetailIds+=",";
|
||
}
|
||
PRDetailIds+=item.purchaseRecordDetailId;
|
||
})
|
||
$.post(ext.contextPath + '/sparepart/rawMaterial/selectPRDetailForRawMaterialDetails.do', {PRDetailIds:PRDetailIds,companyId:'${rawMaterial.bizId}'},
|
||
function(data) {
|
||
$("#PRDetail4SelectsDiv").html(data);
|
||
openModal('subPDetailModal');
|
||
});
|
||
};
|
||
|
||
var doFinishSelects = function(data) {
|
||
$.post(ext.contextPath + '/sparepart/rawMaterial/saveRawMaterialRecordDetails.do', {instockRecordId:'${rawMaterial.id}',
|
||
PRDetailIds:data} , function(data) {
|
||
if(data.res){
|
||
$("#table_rawMaterialDetail").bootstrapTable('refresh');
|
||
}
|
||
},'json');
|
||
};
|
||
//新增其他药剂登记明细
|
||
var addOtherDetailFun = function() {
|
||
var allTableData = $("#table_otherDetail").bootstrapTable('getData');
|
||
var goodsIds="";
|
||
$.each(allTableData,function(index,item){
|
||
if(goodsIds!=""){
|
||
goodsIds+=",";
|
||
}
|
||
goodsIds+=item.goods.id;
|
||
})
|
||
$.post(ext.contextPath + '/sparepart/subscribe/selectGoodsForSubscribeDetail.do', {goodsIds:goodsIds},
|
||
function(data) {
|
||
$("#Goods4SelectsDiv").html(data);
|
||
openModal('subDetailModal');
|
||
});
|
||
};
|
||
var doFinishSelectSubscribeDetail = function(data) {
|
||
$.post(ext.contextPath + '/sparepart/rawMaterial/saveOtherDetails.do', {instockRecordId:'${rawMaterial.id}',goodsIds:data} , function(data) {
|
||
if(data.res){
|
||
$("#table_otherDetail").bootstrapTable('refresh');
|
||
}
|
||
},'json');
|
||
};
|
||
//删除多条申购明细数据
|
||
var deletesRawMaterialDetailFun = function() {
|
||
var checkedItems = $("#table_rawMaterialDetail").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/rawMaterial/deletesRawMaterialDetail.do', {ids:datas} , function(data) {
|
||
if(data>0){
|
||
$("#table_rawMaterialDetail").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','alertDiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
}
|
||
};
|
||
var deletesOtherDetailFun = function() {
|
||
var checkedItems = $("#table_otherDetail").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/rawMaterial/deletesRawMaterialRecordDetail.do', {ids:datas} , function(data) {
|
||
if(data>0){
|
||
$("#table_otherDetail").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','alertDiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
}
|
||
};
|
||
$(function(){
|
||
//初始化文件显示
|
||
getFileList_process();
|
||
//初始化选择框,方法在workflow.js里
|
||
processSelectNodeForHandle("${businessUnitHandle.taskid}");
|
||
$('#table_otherDetail').bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/sparepart/rawMaterial/getRawMaterialDetailList.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:'${rawMaterial.id}',
|
||
type:'${INSTOCK_OTHER}'
|
||
}
|
||
},
|
||
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: 'rawmaterialNumber', // 返回json数据中的name
|
||
title: '药剂登记数量', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
editable: { //编辑列元素
|
||
type: 'text',
|
||
title: '数量',
|
||
validate: function (v) {
|
||
if (!v) return '数量不能为空';
|
||
}
|
||
}
|
||
},{
|
||
field: 'price', // 返回json数据中的name
|
||
title: '单价/元', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
editable: { //编辑列元素
|
||
type: 'text',
|
||
title: '单价',
|
||
validate: function (v) {
|
||
if (!v) return '单价不能为空';
|
||
}
|
||
},
|
||
footerFormatter:"总计",
|
||
},{
|
||
field: 'totalMoney', // 返回json数据中的name
|
||
title: '合计/元', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
editable: { //编辑列元素
|
||
type: 'text',
|
||
title: '合计',
|
||
validate: function (v) {
|
||
if (!v) return '合计不能为空';
|
||
}
|
||
},
|
||
footerFormatter:function(value){
|
||
if(value==""){
|
||
return"";
|
||
}else{
|
||
var count = 0;
|
||
for(var i in value){
|
||
count += value[i].totalMoney;
|
||
}
|
||
return count.toFixed(2);
|
||
}
|
||
},
|
||
formatter:function(value, row, index){
|
||
return value.toFixed(2);
|
||
},
|
||
},{
|
||
field: 'includeTaxratePrice', // 返回json数据中的name
|
||
title: '含税单价/元', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
editable: { //编辑列元素
|
||
type: 'text',
|
||
title: '单价',
|
||
validate: function (v) {
|
||
if (!v) return '单价不能为空';
|
||
}
|
||
},
|
||
footerFormatter:"合计"
|
||
},{
|
||
field: 'includeTaxrateTotalMoney', // 返回json数据中的name
|
||
title: '含税合计/元', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
editable: { //编辑列元素
|
||
type: 'text',
|
||
title: '合计',
|
||
validate: function (v) {
|
||
if (!v) return '合计不能为空';
|
||
}
|
||
} ,
|
||
footerFormatter:function(value){
|
||
if(value==""){
|
||
return"";
|
||
}else{
|
||
var count = 0;
|
||
for(var i in value){
|
||
count += value[i].includeTaxrateTotalMoney;
|
||
}
|
||
return count.toFixed(2);
|
||
}
|
||
},
|
||
formatter:function(value, row, index){
|
||
return value.toFixed(2);
|
||
},
|
||
},
|
||
],
|
||
//保存列修改后的数据
|
||
onEditableSave: function (field, row, oldValue, $el) {
|
||
var url = ext.contextPath + "/sparepart/rawMaterial/updateRawMaterialDetail.do";
|
||
if(field=='includeTaxrateTotalMoney' || field=='totalMoney' ){
|
||
url = ext.contextPath + "/sparepart/rawMaterial/updateRawMaterialDetail_total.do";
|
||
}
|
||
$.post(url, {id:row.id,price:row.price,number:row.rawmaterialNumber,totalMoney:row.totalMoney,
|
||
includeTaxratePrice:row.includeTaxratePrice,includeTaxrateTotalMoney:row.includeTaxrateTotalMoney
|
||
}, function(data) {
|
||
if (data.res == 1){
|
||
$("#table_otherDetail").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','编辑失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
},
|
||
onLoadSuccess: function(){ //加载成功时执行
|
||
adjustBootstrapTableView("table_otherDetail");
|
||
},
|
||
onLoadError: function(){ //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
});
|
||
//显示流程详情
|
||
var id = '${rawMaterial.id}';
|
||
$.post(ext.contextPath + '/sparepart/rawMaterial/showProcessRawMaterialView.do', {id:id,inModal:'inModal'} , function(data) {
|
||
$("#showView").html(data);
|
||
});
|
||
});
|
||
//选择药剂登记负责人
|
||
var showUser4SelectsFun = function() {
|
||
var userIds= $("#registerManId").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"registerManId",textId:"registerManName",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
//选择审核人
|
||
var showUser4AuditSelectsFun = function() {
|
||
var userIds= $("#targetusers").val();
|
||
var jobIds= $("#targetjobs").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByCompany.do', {formId:"subUnitForm",hiddenId:"targetusers",textId:"targetUsersName",userIds:userIds,jobIds:jobIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-xlg">
|
||
<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">
|
||
<div class="row">
|
||
<div class="col-md-7 col-xs-12">
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subForm">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input id="status" name="status" type="hidden" value="${rawMaterial.status}"/>
|
||
<input id="bizId" name="bizId" type="hidden" value="${rawMaterial.bizId}"/>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">药剂登记单号</label>
|
||
<div class="col-sm-4" >
|
||
<p class="form-control-static" >${rawMaterial.id}</p>
|
||
</div>
|
||
<label class="col-sm-3 control-label">药剂登记单名称</label>
|
||
<div class="col-sm-4" >
|
||
<p class="form-control-static" >${rawMaterial.name}</p>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">药剂登记日期</label>
|
||
<div class="col-sm-2">
|
||
<p class="form-control-static" >${rawMaterial.registerDate.substring(0,16)}</p>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">所属厂区</label>
|
||
<div class="col-sm-4" >
|
||
<p class="form-control-static" >${rawMaterial.company.name}</p>
|
||
</div>
|
||
<label class="col-sm-3 control-label">药剂登记人</label>
|
||
<div class="col-sm-2">
|
||
<p class="form-control-static" >${rawMaterial.registerManName}</p>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">计划抽检完成时间</label>
|
||
<div class="col-sm-2">
|
||
<p class="form-control-static" >${rawMaterial.planSpotCheckCompleteTime.substring(0,16)}</p>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">备注</label>
|
||
<div class="col-sm-9">
|
||
<p class="form-control-static" >${rawMaterial.remark}</p>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">验收结果</label>
|
||
<div class="col-sm-9">
|
||
<p class="form-control-static" >${rawMaterial.acceptanceResults}</p>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">取样情况</label>
|
||
<div class="col-sm-9">
|
||
<p class="form-control-static" >${rawMaterial.sampling}</p>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<!--药剂登记审核退回后显示 -->
|
||
<form class="form-horizontal" id="subUnitForm" enctype="multipart/form-data" >
|
||
<input type="hidden" class="form-control" name ="id" value="${businessUnitHandle.id}">
|
||
<input type="hidden" class="form-control" name ="processid" value="${businessUnitHandle.processid}">
|
||
<input type="hidden" class="form-control" name ="taskid" value="${businessUnitHandle.taskid}">
|
||
<input type="hidden" class="form-control" name ="businessid" value="${businessUnitHandle.businessid}">
|
||
<input type="hidden" class="form-control" name ="taskdefinitionkey" value="${businessUnitHandle.taskdefinitionkey}">
|
||
<%-- <input type="hidden" class="form-control" id= "targetusers" name ="targetusers" value="${businessUnitHandle.targetusers}"> --%>
|
||
<input type="hidden" class="form-control" name ="unitid" value="${businessUnitHandle.unitid}">
|
||
<c:if test='${not empty businessUnitAudit.auditopinion }'>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">审核意见:</label>
|
||
<div class="col-sm-9">
|
||
<textarea class="form-control " id="auditopinion" name="auditopinion" rows="2" placeholder="审核意见" >${businessUnitAudit.auditopinion}</textarea>
|
||
</div>
|
||
</div>
|
||
</c:if>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">*下一节点</label>
|
||
<div class="col-sm-6">
|
||
<select class="form-control select2" id="routeNum" name ="routeNum" style="width: 270px;">
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div id = "selectUsers" class="form-group hidden-lg hidden-sm hidden-xs">
|
||
<label class="col-sm-3 control-label">提交至:</label>
|
||
<div class="col-sm-9">
|
||
<input type="text" class="form-control" id="targetUsersName" name ="targetUsersName" placeholder="下一级人员" onclick="showUser4AuditSelectsFun();" >
|
||
<input id="targetusers" name="targetusers" type="hidden" value="${businessUnitHandle.targetusers}"/>
|
||
<input class="form-control" id="targetjobs" name="targetjobs" type="hidden" value=""/>
|
||
</div>
|
||
</div>
|
||
<!-- 文件上传,显示 -->
|
||
<div class="form-group" style="margin:8px">
|
||
<label class="col-sm-3 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>
|
||
<div class="col-md-5 col-xs-12" id="showView"></div>
|
||
</div>
|
||
<div class="box box-primary" >
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">药剂登记明细</h3>
|
||
<div class="box-tools pull-right">
|
||
<%--<a onclick="addOtherDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="新增"><i class="glyphicon glyphicon-plus"></i></a>--%>
|
||
<a onclick="deletesOtherDetailFun()" 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_otherDetail"></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="dosubmit()" id="btn_submit">提交</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|