754 lines
34 KiB
Plaintext
754 lines
34 KiB
Plaintext
|
|
<%@page import="com.sipai.entity.sparepart.SparePartCommString"%>
|
|||
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
|||
|
|
<%request.setAttribute("DEPARTMENT", SparePartCommString.PURCHASE_DEPARTMENT); %>
|
|||
|
|
<%request.setAttribute("START", SparePartCommString.STATUS_START); %>
|
|||
|
|
<%request.setAttribute("DEPT_AUDIT", SparePartCommString.STATUS_DEPT_AUDIT); %>
|
|||
|
|
<%request.setAttribute("PERSONAL_AUDIT", SparePartCommString.STATUS_PERSONAL_AUDIT); %>
|
|||
|
|
|
|||
|
|
<%request.setAttribute("department", SparePartCommString.department); %>
|
|||
|
|
<%request.setAttribute("personal", SparePartCommString.personal); %>
|
|||
|
|
<%request.setAttribute("temporary", SparePartCommString.temporary); %>
|
|||
|
|
<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 = '${subscribe.id}';//业务Id
|
|||
|
|
var tbName_process = 'TB_Process_UploadFile'; //数据表
|
|||
|
|
var nameSpace_process ='ProcessUploadFile';//保存文件夹
|
|||
|
|
var status = 'delete';//有删除权限
|
|||
|
|
var type = "";
|
|||
|
|
function doupdate() {
|
|||
|
|
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/sparepart/subscribe/update.do", $("#subForm").serialize(), function(data) {
|
|||
|
|
if (data.res == 1){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
if(type=='${personal}'){
|
|||
|
|
dosearch('${personal}');
|
|||
|
|
}else{
|
|||
|
|
dosearch('${department}-${temporary}');
|
|||
|
|
}
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function dosubmit(){
|
|||
|
|
if(type=='personal'){
|
|||
|
|
//个人申购
|
|||
|
|
$("#status").val('${PERSONAL_AUDIT}');
|
|||
|
|
}else{
|
|||
|
|
$("#status").val('${DEPT_AUDIT}');
|
|||
|
|
}
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/sparepart/subscribe/startSubscribeProcess.do", $("#subForm").serialize(), function(data) {
|
|||
|
|
if (data.res == 1){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
if(type=='${personal}'){
|
|||
|
|
dosearch('${personal}');
|
|||
|
|
}else{
|
|||
|
|
dosearch('${department}-${temporary}');
|
|||
|
|
}
|
|||
|
|
}else if(data.res == 2){
|
|||
|
|
showAlert('d','未检测到部门申购审核流程,请先部署流程!');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//提交时先验证审核人不能为空,保存时审核人可以为空
|
|||
|
|
function submitFun(){
|
|||
|
|
if(type=='personal'){
|
|||
|
|
//个人申购
|
|||
|
|
}else{
|
|||
|
|
//新增的输入框添加验证
|
|||
|
|
$("#subForm").data('bootstrapValidator').addField('auditMan',{
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '审核人不能为空'
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
if (red == 1 && type != 'personal') {
|
|||
|
|
// showAlert('d', '有申购明细关联物品请关联后刷新页面再次提交!');
|
|||
|
|
$.post(ext.contextPath + '/sparepart/subscribe/sendMessage.do',
|
|||
|
|
function(data) {
|
|||
|
|
$("#sendMessageDiv").html(data);
|
|||
|
|
openModal('sendMessageSubModal');
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
dosubmit();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//关闭模态框时刷新表格数据
|
|||
|
|
function closeModel(){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
if(type=='${personal}'){
|
|||
|
|
dosearch('${personal}');
|
|||
|
|
}else{
|
|||
|
|
dosearch('${department}-${temporary}');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var red = 0;
|
|||
|
|
//新增申购明细
|
|||
|
|
var addSubscribeDetailFun = function() {
|
|||
|
|
//新增申购明细时,验证部门不能为空
|
|||
|
|
$("#subForm").data('bootstrapValidator').validateField('deptId');
|
|||
|
|
if($("#subForm").data('bootstrapValidator').isValidField('deptId')){
|
|||
|
|
var allTableData = $("#table_SubscribeDetail").bootstrapTable('getData');
|
|||
|
|
var goodsIds="";
|
|||
|
|
$.each(allTableData,function(index,item){
|
|||
|
|
if(goodsIds!=""){
|
|||
|
|
goodsIds+=",";
|
|||
|
|
}
|
|||
|
|
if (item.goods != null) {
|
|||
|
|
if (item.goods.id != null) {
|
|||
|
|
goodsIds+=item.goods.id;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
$.post(ext.contextPath + '/sparepart/subscribe/selectGoodsForSubscribeDetail.do', {goodsIds:goodsIds},
|
|||
|
|
function(data) {
|
|||
|
|
$("#Goods4SelectsDiv").html(data);
|
|||
|
|
openModal('subDetailModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
//新增申购明细-历史订单
|
|||
|
|
var addSubscribeHistoryFun = function() {
|
|||
|
|
//新增申购明细时,验证部门不能为空
|
|||
|
|
$("#subForm").data('bootstrapValidator').validateField('deptId');
|
|||
|
|
if($("#subForm").data('bootstrapValidator').isValidField('deptId')){
|
|||
|
|
var allTableData = $("#table_SubscribeDetail").bootstrapTable('getData');
|
|||
|
|
var goodsIds="";
|
|||
|
|
$.each(allTableData,function(index,item){
|
|||
|
|
if(goodsIds!=""){
|
|||
|
|
goodsIds+=",";
|
|||
|
|
}
|
|||
|
|
goodsIds+=item.goods.id;
|
|||
|
|
})
|
|||
|
|
$.post(ext.contextPath + '/sparepart/subscribe/selectGoodsForSubscribeHistory.do', {goodsIds:goodsIds},
|
|||
|
|
function(data) {
|
|||
|
|
$("#Goods4SelectsDiv").html(data);
|
|||
|
|
openModal('subDetailModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//新增申购明细-报废设备
|
|||
|
|
var addScrapFun = function() {
|
|||
|
|
//新增申购明细时,验证部门不能为空
|
|||
|
|
$("#subForm").data('bootstrapValidator').validateField('deptId');
|
|||
|
|
if($("#subForm").data('bootstrapValidator').isValidField('deptId')){
|
|||
|
|
var allTableData = $("#table_SubscribeDetail").bootstrapTable('getData');
|
|||
|
|
var goodsIds="";
|
|||
|
|
$.each(allTableData,function(index,item){
|
|||
|
|
if(goodsIds!=""){
|
|||
|
|
goodsIds+=",";
|
|||
|
|
}
|
|||
|
|
goodsIds+=item.goods.id;
|
|||
|
|
})
|
|||
|
|
$.post(ext.contextPath + '/equipment/equipmentScrapApplyCollect/selectGoodsForScrap.do', {goodsIds:goodsIds},
|
|||
|
|
function(data) {
|
|||
|
|
$("#Goods4SelectsDiv").html(data);
|
|||
|
|
openModal('subDetailModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var doRefreshSubscribeDetail = function() {
|
|||
|
|
$("#table_SubscribeDetail").bootstrapTable('refresh');
|
|||
|
|
};
|
|||
|
|
var doFinishSelectSubscribeDetail = function(data) {
|
|||
|
|
$.post(ext.contextPath + '/sparepart/subscribe/updateSubscribeDetails.do', {subscribeId:'${subscribe.id}',deptId : $("#deptId").val(),
|
|||
|
|
goodsIds:data} , function(data) {
|
|||
|
|
if(data.res){
|
|||
|
|
doRefreshSubscribeDetail();
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
};
|
|||
|
|
var addchannelsId = function() {
|
|||
|
|
var checkedItems = $("#table_SubscribeDetail").bootstrapTable('getSelections');
|
|||
|
|
var datas="";
|
|||
|
|
$.each(checkedItems, function(index, item){
|
|||
|
|
datas+=item.id+",";
|
|||
|
|
});
|
|||
|
|
if(datas==""){
|
|||
|
|
showAlert('d','请先选择记录','alertDiv');
|
|||
|
|
}else{
|
|||
|
|
var channelsid= $("#channelsid").val();
|
|||
|
|
$.post(ext.contextPath + '/sparepart/channels/selectChannelsForSubscribeDetail.do', {channelsid:channelsid},
|
|||
|
|
function(data) {
|
|||
|
|
$("#fault4SelectDiv").html(data);
|
|||
|
|
openModal('fault4SelectModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var addchannelsIdSave = function() {
|
|||
|
|
var checkedItems = $("#table_SubscribeDetail").bootstrapTable('getSelections');
|
|||
|
|
var datas="";
|
|||
|
|
$.each(checkedItems, function(index, item){
|
|||
|
|
datas+=item.id+",";
|
|||
|
|
});
|
|||
|
|
var channelsId= $("#subscribeDetail_channelsId").val();
|
|||
|
|
$.post(ext.contextPath + '/sparepart/subscribe/addSubscribeDetailchannelsId.do', {ids:datas,channelsId:channelsId} , function(data) {
|
|||
|
|
if(data>0){
|
|||
|
|
$("#table_SubscribeDetail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','设置失败','alertDiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
//删除多条申购明细数据
|
|||
|
|
var deletesSubscribeDetailFun = function() {
|
|||
|
|
var checkedItems = $("#table_SubscribeDetail").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/subscribe/deletesSubscribeDetail.do', {ids:datas} , function(data) {
|
|||
|
|
if(data>0){
|
|||
|
|
$("#table_SubscribeDetail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','删除失败','alertDiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
var showUser4SelectsFun = function() {
|
|||
|
|
var userIds= $("#subscribeAuditId").val();
|
|||
|
|
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"subscribeAuditId",textId:"auditMan",userIds:userIds} , function(data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
var companyId = "${subscribe.bizId}";
|
|||
|
|
//初始化申购部门
|
|||
|
|
var refreshSelect = function(companyId) {
|
|||
|
|
$.post(ext.contextPath + "/user/getUnitsByUnitId4Select.do", {id:companyId}, function(data) {
|
|||
|
|
//$("#deptId").empty();
|
|||
|
|
var selelct_ =$("#deptId").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('${subscribe.deptId}').trigger("change");
|
|||
|
|
},'json');
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function paramsMatter(value,row,index) {
|
|||
|
|
var span=document.createElement('span');
|
|||
|
|
var data = '未关联物品!';
|
|||
|
|
if (row.goods != null) {
|
|||
|
|
data = '物品编号:' + row.goods.id
|
|||
|
|
}
|
|||
|
|
span.setAttribute('title', data);
|
|||
|
|
span.innerHTML = '<span>' + row.detailGoodsName + '</span>';
|
|||
|
|
return span.outerHTML
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var supplierRes = [];
|
|||
|
|
|
|||
|
|
var getSupplierFun = function() {
|
|||
|
|
$.post(ext.contextPath + '/sparepart/supplier/getSupplier4Select.do', {} , function(data) {
|
|||
|
|
var json = eval('(' + data + ')');
|
|||
|
|
$.each(json, function (key, value) {
|
|||
|
|
supplierRes.push({ value: value.text, text: value.text });
|
|||
|
|
})
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
var purposeRes = [];
|
|||
|
|
|
|||
|
|
var getPurposeFun = function() {
|
|||
|
|
$.post(ext.contextPath + '/sparepart/purpose/getPurpose4Select.do', {} , function(data) {
|
|||
|
|
var json = eval('(' + data + ')');
|
|||
|
|
$.each(json, function (key, value) {
|
|||
|
|
purposeRes.push({ value: value.text, text: value.text });
|
|||
|
|
})
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
$(function(){
|
|||
|
|
getSupplierFun();
|
|||
|
|
getPurposeFun();
|
|||
|
|
type = $("#type").val();
|
|||
|
|
if(type=='personal'){
|
|||
|
|
//个人申购
|
|||
|
|
$('#audit').hide();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//初始化文件显示
|
|||
|
|
getFileList_process();
|
|||
|
|
var subscribeDetail_Visible = true;
|
|||
|
|
var bizPid = $("#bizPid").val();
|
|||
|
|
if(bizPid=='-1'){
|
|||
|
|
subscribeDetail_Visible = true;
|
|||
|
|
}
|
|||
|
|
$('#table_SubscribeDetail').bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/sparepart/subscribe/getSubscribeDetailList.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:'${subscribe.id}',
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'id', // 要排序的字段
|
|||
|
|
sortOrder: 'desc', // 排序规则
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
checkbox: true, // 显示一个勾选框
|
|||
|
|
},{
|
|||
|
|
field: 'detailGoodsName', // 返回json数据中的name
|
|||
|
|
title: '物品名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
formatter:paramsMatter
|
|||
|
|
},{
|
|||
|
|
field: 'detailGoodsModel', // 返回json数据中的name
|
|||
|
|
title: '规格型号', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'goods.unit', // 返回json数据中的name
|
|||
|
|
title: '单位', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'brand', // 返回json数据中的name
|
|||
|
|
title: '品牌', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
visible: subscribeDetail_Visible,
|
|||
|
|
editable: { //编辑列元素
|
|||
|
|
type: 'text',
|
|||
|
|
title: '品牌',
|
|||
|
|
}
|
|||
|
|
},{
|
|||
|
|
/* field: 'design', // 返回json数据中的name
|
|||
|
|
title: '设计规格', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
visible: subscribeDetail_Visible,
|
|||
|
|
editable: { //编辑列元素
|
|||
|
|
type: 'text',
|
|||
|
|
title: '设计规格',
|
|||
|
|
}
|
|||
|
|
},{ */
|
|||
|
|
field: 'manufacturer', // 返回json数据中的name
|
|||
|
|
title: '生产厂家', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
visible: subscribeDetail_Visible,
|
|||
|
|
editable: { //编辑列元素
|
|||
|
|
type: 'select2',
|
|||
|
|
title: '生产厂家',
|
|||
|
|
select2: {
|
|||
|
|
allowClear: true,
|
|||
|
|
width: '150px',
|
|||
|
|
},
|
|||
|
|
source: function () {
|
|||
|
|
// var result = [];
|
|||
|
|
// $.ajax({
|
|||
|
|
// url: ext.contextPath + "/sparepart/supplier/getSupplier4Select.do",
|
|||
|
|
// type: "post",
|
|||
|
|
// async: false,
|
|||
|
|
// dataType: 'json',
|
|||
|
|
// data: {},
|
|||
|
|
// success: function (data, status) {
|
|||
|
|
// $.each(data, function (key, value) {
|
|||
|
|
// result.push({ value: value.text, text: value.text });
|
|||
|
|
// });
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
return supplierRes;
|
|||
|
|
},
|
|||
|
|
validate: function (v) {
|
|||
|
|
if (!v) return '生产厂家不能为空';
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},{
|
|||
|
|
field: 'number', // 返回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', // 上下居中
|
|||
|
|
visible: subscribeDetail_Visible,
|
|||
|
|
editable: { //编辑列元素
|
|||
|
|
type: 'text',
|
|||
|
|
title: '单价',
|
|||
|
|
validate: function (v) {
|
|||
|
|
if (!v) return '单价不能为空';
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},{
|
|||
|
|
field: 'totalMoney', // 返回json数据中的name
|
|||
|
|
title: '合计/元', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
visible: subscribeDetail_Visible,
|
|||
|
|
},{
|
|||
|
|
field: 'purpose', // 返回json数据中的name
|
|||
|
|
title: '用途', // 表格表头显示文字
|
|||
|
|
width: '20%',
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
editable: { //编辑列元素
|
|||
|
|
type: 'select2',
|
|||
|
|
title: '用途',
|
|||
|
|
select2: {
|
|||
|
|
allowClear: true,
|
|||
|
|
width: '150px',
|
|||
|
|
},
|
|||
|
|
source: function () {
|
|||
|
|
return purposeRes
|
|||
|
|
},
|
|||
|
|
validate: function (v) {
|
|||
|
|
if (!v) return '用途不能为空';
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
//保存列修改后的数据
|
|||
|
|
onEditableSave: function (field, row, oldValue, $el) {
|
|||
|
|
$.post(ext.contextPath + "/sparepart/subscribe/updateSubscribeDetail.do", {id:row.id,price:row.price,number:row.number,purpose:row.purpose,
|
|||
|
|
brand:row.brand,design:row.design,manufacturer:row.manufacturer,planArrivalTime:row.planArrivalTime,planArrivalPlace:row.planArrivalPlace}, function(data) {
|
|||
|
|
if (data.res == 1){
|
|||
|
|
$("#table_SubscribeDetail").bootstrapTable('refresh');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','编辑失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
},
|
|||
|
|
onLoadSuccess: function(){ //加载成功时执行
|
|||
|
|
adjustBootstrapTableView("table_SubscribeDetail");
|
|||
|
|
},
|
|||
|
|
onLoadError: function(){ //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
},
|
|||
|
|
rowStyle:function(row,index){
|
|||
|
|
var style = {};
|
|||
|
|
if(row.goods == null){
|
|||
|
|
style={css:{'background-color':'#FF0000', 'color': 'white'}};
|
|||
|
|
red = 1;
|
|||
|
|
}
|
|||
|
|
return style;
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
//选择厂区
|
|||
|
|
$.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
|
|||
|
|
//选择厂区为一个厂时隐藏选择框
|
|||
|
|
if(data.length == 1){
|
|||
|
|
$("#bizId").css("display", "none");
|
|||
|
|
$("#input_bizId").val(data[0].text);
|
|||
|
|
$("#hidden_bizId").val(data[0].id);
|
|||
|
|
companyId = data[0].id;
|
|||
|
|
refreshSelect(companyId);
|
|||
|
|
}else{
|
|||
|
|
$("#hidden_bizId").attr("disabled","disabled");
|
|||
|
|
$("#input_bizId").css("display", "none");
|
|||
|
|
var selelct =$("#bizId").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('${subscribe.bizId}').trigger("change");
|
|||
|
|
refreshSelect(companyId);
|
|||
|
|
selelct.on("change",function(e){
|
|||
|
|
companyId = $(this).val();
|
|||
|
|
refreshSelect(companyId);
|
|||
|
|
$("#deptId").empty();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
/* //选择采购形式
|
|||
|
|
$.post(ext.contextPath + "/sparepart/purchaseMethods/getPurchaseMethods4Select.do", function(data) {
|
|||
|
|
var selelct = $("#purchaseMethodsId").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('${subscribe.purchasemethodsid}').trigger("change");
|
|||
|
|
},'json');
|
|||
|
|
//选择列资渠道
|
|||
|
|
$.post(ext.contextPath + "/sparepart/channels/getChannels4Select.do",{pid:'-1'}, function(data) {
|
|||
|
|
var selelct = $("#channelsId").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;} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
var select_id = '${subscribe.channelsid}';
|
|||
|
|
var arr = select_id.split(",");
|
|||
|
|
selelct.val(arr).trigger("change");
|
|||
|
|
$('#channelsId').change(function(){
|
|||
|
|
var o=document.getElementById('channelsId').getElementsByTagName('option');
|
|||
|
|
var all="";
|
|||
|
|
for(var i=0;i<o.length;i++){
|
|||
|
|
if(o[i].selected){
|
|||
|
|
all+=o[i].value+",";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
all = all.substr(0, all.length - 1);//去掉末尾的逗号
|
|||
|
|
$("#channelsid").val(all);//赋值给隐藏的文本框
|
|||
|
|
})
|
|||
|
|
},'json'); */
|
|||
|
|
//输入框验证
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
deptId: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '申购部门不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
subscribeDate: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '申购日期不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$("#subscribeDate").datepicker({
|
|||
|
|
language: 'zh-CN',
|
|||
|
|
autoclose: true,
|
|||
|
|
todayHighlight: true,
|
|||
|
|
format:'yyyy-mm-dd',
|
|||
|
|
})
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
//导入明细
|
|||
|
|
function importFun(){
|
|||
|
|
var subscribeId = '${subscribe.id}';
|
|||
|
|
$.post(ext.contextPath + '/sparepart/subscribe/importSubscribeDetail.do', {subscribeId:subscribeId} , function(data) {
|
|||
|
|
$("#importDiv").html(data);
|
|||
|
|
openModal('importModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function importPersonalFun(){
|
|||
|
|
var departmentId = '${subscribe.id}';
|
|||
|
|
$.post(ext.contextPath + '/sparepart/subscribe/subscribeList4personalselect.do', {departmentId:departmentId} , function(data) {
|
|||
|
|
$("#personalDiv").html(data);
|
|||
|
|
openModal('personalModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
</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">
|
|||
|
|
<input id="bizPid" type="hidden" value="${subscribe.company.pid}"/>
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subForm">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input id="status" name="status" type="hidden" value="${subscribe.status}"/>
|
|||
|
|
<input id ="type" name ="type" type="hidden" value="${subscribe.type}" />
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-md-2 col-sm-2 control-label">*所属厂区</label>
|
|||
|
|
<!-- <div class="col-sm-6">
|
|||
|
|
<select class="form-control select2" id="bizId" name ="bizId" style="width: 270px;">
|
|||
|
|
</select>
|
|||
|
|
<input class="form-control" id="input_bizId" style="border: none;background: transparent;">
|
|||
|
|
<input type="hidden" id="hidden_bizId" name ="bizId">
|
|||
|
|
</div> -->
|
|||
|
|
<div class="col-md-4 col-sm-10">
|
|||
|
|
<input name="bizId" type="hidden" value="${subscribe.company.id}"/>
|
|||
|
|
<p class="form-control-static" >${subscribe.company.name}</p>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-md-2 col-sm-2 control-label">*申购单号</label>
|
|||
|
|
<div class="col-md-4 col-sm-10">
|
|||
|
|
<input type="text" class="form-control" id="id" name ="id" placeholder="名称" value="${subscribe.id}" readonly>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-md-2 col-sm-2 control-label">*申购日期</label>
|
|||
|
|
<div class="col-md-4 col-sm-10">
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<div class="input-group-addon">
|
|||
|
|
<i class="fa fa-calendar"></i>
|
|||
|
|
</div>
|
|||
|
|
<input type="text" class="form-control" id="subscribeDate" name="subscribeDate" style="width: 230px;" placeholder="请选择" value="${subscribe.subscribeDate.substring(0,10)}"/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-md-2 col-sm-2 control-label">*申购部门</label>
|
|||
|
|
<div class="col-md-4 col-sm-10">
|
|||
|
|
<select class="form-control" id="deptId" name ="deptId" style="width: 270px;" >
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group" id="audit">
|
|||
|
|
<label class="col-sm-2 control-label">*审核人</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="auditMan" name ="auditMan" placeholder="点击选择" onclick="showUser4SelectsFun();" value="${subscribe.subscribeAuditName}">
|
|||
|
|
<input id="subscribeAuditId" name="subscribeAuditId" type="hidden" value="${subscribe.subscribeAuditId}" />
|
|||
|
|
</div>
|
|||
|
|
<!-- <label class="col-md-2 col-sm-2 control-label">采购形式</label>
|
|||
|
|
<div class="col-md-4 col-sm-10">
|
|||
|
|
<select class="form-control select2" id="purchaseMethodsId" name ="purchasemethodsid" style="width: 270px;"></select>
|
|||
|
|
</div> -->
|
|||
|
|
</div>
|
|||
|
|
<%-- <div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">列资渠道</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<select class="form-control select2" multiple="multiple" id="channelsId" style="width: 100%;"></select>
|
|||
|
|
<input id="channelsid" name ="channelsid" type="hidden" value="${subscribe.channelsid}" />
|
|||
|
|
</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="备注...">${subscribe.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 style="display: inline-block">
|
|||
|
|
<i style="float: left;padding-top: 10px;" class="fa fa-question-circle" aria-hidden="true" title="红色为未绑定物品,请关联物品并刷新后提交!"></i>
|
|||
|
|
</div>
|
|||
|
|
<div class="box-tools pull-right" style="top: 20px">
|
|||
|
|
<c:if test="${subscribe.type!=personal}">
|
|||
|
|
<button type="button" class="btn btn-default btn-sm" onclick="importPersonalFun();" ><i class="fa fa-cloud-upload"></i>导入申购数据</button>
|
|||
|
|
</c:if>
|
|||
|
|
<button type="button" class="btn btn-default btn-sm" onclick="importFun();" ><i class="fa fa-cloud-upload"></i>导入Excel</button>
|
|||
|
|
<a onclick="addSubscribeDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
|||
|
|
<a onclick="deletesSubscribeDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-minus"></i></a>
|
|||
|
|
<!--
|
|||
|
|
<a onclick="addchannelsId()" class="btn btn-default" data-toggle="tooltip" title="设置">设置子项工程</a>
|
|||
|
|
<a onclick="addSubscribeHistoryFun()" class="btn btn-box-tool" data-toggle="tooltip" title="新增">历史订单</a>
|
|||
|
|
<a onclick="addScrapFun()" class="btn btn-box-tool" data-toggle="tooltip" title="新增">报废设备</a> -->
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.box-header -->
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<input id="subscribeDetail_channelsId" type="hidden" value="" />
|
|||
|
|
<table id="table_SubscribeDetail"></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_update">保存</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="submitFun()" id="btn_submit">提交</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|