Index: ssts-web/src/main/webapp/dx-disinfectsystem/js/recyclingApplication/goodsApplicationView.js =================================================================== diff -u -r24723 -r24922 --- ssts-web/src/main/webapp/dx-disinfectsystem/js/recyclingApplication/goodsApplicationView.js (.../goodsApplicationView.js) (revision 24723) +++ ssts-web/src/main/webapp/dx-disinfectsystem/js/recyclingApplication/goodsApplicationView.js (.../goodsApplicationView.js) (revision 24922) @@ -1,476 +1,267 @@ + var disinfectionComboGoodsStore=[]; $(function(){ - var isIE=Tools.BrowserTypeUtils.isIE()==1 ? true:false; - //解决select2 单选框无法输入的问题 - $.fn.modal.Constructor.prototype.enforceFocus = function () {}; + var isIE=Tools.BrowserTypeUtils.isIE()==1 ? true:false;//是否为IE - //搜索栏距离顶部高度 - var searchTopL=$("#contentSearch").offset(); - //搜索栏自身高度 - var searchTopH=$("#contentSearch").height(); - //分页栏高度 - var pagiHeight=$(".fixed-table-pagination").height() || 56;//+37 - //总页面高度 - var documentHeight=$(document).height(); + $.fn.modal.Constructor.prototype.enforceFocus = function () {};//解决select2 单选框无法输入的问题 - var tableHeight=documentHeight-pagiHeight-searchTopL.top-searchTopH; - if( 720 == screenHeight){ - tableHeight = tableHeight + 100 ; - } - var table="
" - $('#main').append(table); + parent.formDate = {};//parent用来父子页面间传递数据 - var topBody = $(top.document.body); - var modal = ''; + parent.setDate = function(data){ + parent.formDate = data; + }; + + parent.getDate = function(){ + return parent.formDate; + }; + - topBody.append(modal); - - //主页面table字段 - var allApplication_columns=[{ - checkbox : true - },{ - field : 'id', - align : 'center', - visible:false - }, - { - field : 'orgUnitCode', - align : 'center', - visible:false - }, -// { -// checkbox:true, -// align:'center', -// valign:"middle", -// width : '3', -// rowspan:3 -// }, - { - title : '流水号', - field : 'serialNumber', - align : 'center', - sortable:true - }, - { - title : '申请科室', - field : 'depart', - align : 'center', - sortable:true - }, - { - title : '申请人', - field : 'applicant', - align : 'center', - sortable:true - }, - { - title : '申请时间', - field : 'applicationTimeStr', - align : 'center', - sortable:true - }, - { - title : '最后修改时间', - field : 'submitTimeStr', - align : 'center', - sortable:true - }, - { - title : '打印时间', - field : 'printTimeStr', - align : 'center', - sortable:true - }, - { - title : '类型', - field : 'type', - align : 'center', - sortable:true - }, - { - title : '已提交', - field : 'committedStatus', - align : 'center', - sortable:true, - formatter:function(value){ - if(value == true){ - return "是"; - }else{ - return "否"; - } - } - }, - { - title : '已打印', - field : 'printed', - align : 'center', - sortable:true, - formatter:function(value){ - if(value == 0){ - return "部分打印"; - }else if(value == 1){ - return "未打印"; - }else if(value == 2){ - return "已打印"; - } - } - }, - { - title : '回收状态', - field : 'recyclingStatus', - align : 'center', - sortable:true - }, - { - title : '发货状态', - field : 'deliverStatus', - align : 'center', - sortable:true - }, - { - title : '归还状态', - field : 'returnStatus', - align : 'center', - sortable:true - }, - { - title : '终止状态', - field : 'endStatus', - align : 'center' - }, - { - title : '备注', - field : 'remark', - align : 'center' - }, - { - title : '操作', - field : 'opera', - align : 'center' - } - ]; +/** slick.grid渲染页面主体表格 begin*/ + var grid; + var columns=[]; + var data = []; + var checkboxSelector = new Slick.CheckboxSelectColumn({ + cssClass: "slick-cell-checkboxsel" + }); -/**【表单--申请器械包/一次性物品/消毒物品 begin】*/ - parent.refreshTable = function(){ - loadAppListTable("allApplication_table","toolbar_table",allApplication_columns); + var formatterToA = function (row,cell,value,columnDef,dataContext){ + return ""+value+""; } -/**【表单--申请器械包/一次性物品/消毒物品 end】*/ + var formatterChangeClass = function (row,cell,value,columnDef,dataContext){ + var rtn={text:value,removeClass:'red green orange'}; + if(value == '器械包申请单'){ + rtn.addClasses = 'green'; + }else if(value == '消毒物品申请单'){ + rtn.addClasses = 'blue'; + }else if(value == '一次性物品申请单'){ + rtn.addClasses = 'gray'; + } + return rtn; + } - -/**【表单--申请外来器械 begin】*/ + var requiredFieldValidator = function (value){ + if(value == null || value == undefined || !value.length){ + return {valid: false, msg: "This is a required field"}; + }else{ + return {valid: true, msg: "This is a required field"}; + } + } + + columns.push(checkboxSelector.getColumnDefinition()); + columns.push({id: 'id',name:'id',field:'id',name:'ID',width: 0, minWidth: 0, maxWidth: 0, cssClass: "reallyHidden", headerCssClass: "reallyHidden"}); + columns.push( {id: 'orgUnitCode',name:'科室编码',cssClass: "cell-title",field:'orgUnitCode',width: 0, minWidth: 0, maxWidth: 0, cssClass: "reallyHidden", headerCssClass: "reallyHidden"}); + columns.push({ id: 'serialNumber',name : '流水号', field : 'serialNumber',formatter:formatterToA}); + columns.push( {id: 'depart',name : '申请科室',field : 'depart'}); + columns.push({id: 'applicant',name : '申请人',field : 'applicant'}); + columns.push({id: "applicationTimeStr",name : '申请时间',field : 'applicationTimeStr'}); + columns.push({id: "submitTimeStr",name : '最后修改时间',field : 'submitTimeStr'}); + columns.push({id: "printTimeStr",name : '打印时间',field : 'printTimeStr'}); + columns.push({id: "type",name : '类型',field : 'type'}); + columns.push({id: "committedStatus",name : '已提交',field : 'committedStatus'}); + columns.push({id: "printed",name : '已打印',field : 'printed'}); + columns.push({id: "recyclingStatus",name : '回收状态',field : 'recyclingStatus'}); + columns.push({id: "deliverStatus",name : '发货状态',field : 'deliverStatus'}); + columns.push({id: "returnStatus",name : '归还状态',field : 'returnStatus'}); + columns.push({id: "endStatus",name : '终止状态',field : 'endStatus'}); + columns.push({id: "remark",name : '备注',field : 'remark'}); + columns.push({id: "opera",name : '操作',field : 'opera'}); + + var options = { + enableCellNavigation: true, + enableColumnReorder: false, + topPanelHeight:'40', + rowHeight:'30', + headerRowHeight:'30', + multiSelect:false, + fullWidthRows:'true', + editable: true, + enableAddRow: false, + enableAddRow: false, + enableCellNavigation: true, + asyncEditorLoading: false, + autoEdit: false + }; + + grid = new Slick.Grid("#main",data,columns,options); + grid.registerPlugin(checkboxSelector); + + var mytranslation = { + pagelabel: "页", + currentpage: "当前页", + refresh: "刷新", + recordstatelabel: "显示", + currentrecords: "显示/隐藏当前记录状态", + perpage: "每页条数", + pageminus: "上一页", + pageplus: "下一页", + resultset_first: "第一页", + resultset_prev: "上一页", + resultset_next: "下一页", + resultset_last: "最后一页" + }; + + var pagercontent =$("#page"); + var url=WWWROOT+'/disinfectSystem/recyclingApplication/recyclingApplicationController/findRecyclingApplicationList.mhtml'; + var search='',searchFields='',order ='desc'; + + function pageIng(remoteUrl,container,datagrid,pagerType,trans,params,order,search,searchFields){ + new Slick.Controls.EnhancementPager({ + container: container, + remoteUrl:remoteUrl, + datagrid: datagrid, + pagerType: pagerType, + trans: trans, //i18n support + params:params, + limt:25, + order:order, + search:search, + searchFields:searchFields, + }); + } + + pageIng(url,pagercontent,grid,'',mytranslation,'',order); + grid.setSelectionModel(new Slick.RowSelectionModel({selectActiveRow: false})); + grid.autosizeColumns(); + + grid.onClick.subscribe(function(e,args){ + var row = args.row; + var da = grid.getDataItem(row) + parent.setDate(da); + if(da.type == Constants.AppType.TYPE_TOUSSE_APPLICATION_FORM + || da.type == Constants.AppType.TYPE_DIPOSABLE_GOODS_APPLICATION_FORM + ||da.type == Constants.AppType.TYPE_DISINFECT_GOODS_APPLICATION_FORM ){ + $("#tousseIframe",parent.document).contents().find("#showForm").click(); + } + }) + + function refreshTable(){ + pageIng(url,pagercontent,grid,'',mytranslation,'',order); + } + + parent.refreshTable = refreshTable; + -//申请外来器械中table字段 -var foreignTousse_columns=[{ - field : 'id', - align : 'center', - visible:false - }, - { - field : 'orgUnitCode', - align : 'center', - visible:false - }, - { - field : 'serialNumber', - align : 'center', - visible:false - }, - { - title : '供应商', - field : 'supplierName', - align : 'center' - }, - { - title : '器械包/材料名称', - field : 'tousseName', - align : 'center' - }, - { - title : '是否植入物', - field : 'p', - align : 'center' - }, - { - title : '数量', - field : 'num', - align : 'center' - },{ - title : '单价', - field : 'price', - align : 'center' - },{ - title : '可拆卸数量', - field : 'allprice1', - align : 'center' - },{ - title : '大小', - field : 'allprice1', - align : 'center' - } - ]; - - - var foreignTousseItems=[]; - /*【申请外来器械--下拉框】*/ - //“申请科室”下拉框 - renderSelect_appDpt('foreignTousse_appDep',1); - //“结算科室”下拉框 - renderSelect_settleDpt('foreignTousse_settleDep',1); - //“处理科室”下拉框 - renderSelect_handlerDpt('foreignTousse_handleDep',1,"器械包",$('#foreignTousse_appDep').val()); - //医生 - renderSelect_doctor("foreignTousse_doctor"); - //供应商数据列表 - renderDepartment_suppler("foreignTousse_suppler1"); - //外来器械物品名 - renderDepartment_foreignTousse("foreignTousse_foreignTousseName1",$("#foreignTousse_suppler1").val()); - - //处理方式 - renderDepartment_foreignTousse("foreignTousse_handleMethod"); - - $("#app_foreignTousse").click(function(){ - $("#foreignTousse_title").text("申请外来器械"); - $("#foreignTousse_modal").modal('show'); - loadTable("foreignTousse_table","",foreignTousse_columns,false,false,'',true); - $("#foreignTousse_table").find("#form-body").css({'padding-bottom':'0'}); - $("#modal-footer").find("#form-body").css({'padding-bottom':'0'}); - $(".table_div").find(".fixed-table-toolbar").remove(); - $(".form-table").find(".th-inner").css({"padding-top":"0","padding-bottom":"0","margin-bottom":"8"}); - }); - - - /*【申请外来器械--“添加”按钮】*/ - $("#foreignTousse_add_tousse").click(function(){ - var foreignTousse_name=$("#foreignTousse_name"); - var foreignTousse_supplier=$("#foreignTousse_supplier"); - var tousseName=foreignTousse_name.text(); - var id=foreignTousse_name.val(); - var supplierVal=foreignTousse_supplier.val(); - var supplierName=foreignTousse_name.text(); - - if(!Tools.StringUtils.isEmpty(tousseName)&&!Tools.StringUtils.isEmpty(supplierName)){ - var appendContent={tousseName:tousseName,supplierName:supplierName}; - $("#foreignTousse_table").bootstrapTable('append',appendContent); - foreignTousse_name.text(''); - foreignTousse_supplier.text(''); - foreignTousseItems.push(appendContent); +/** slick.grid渲染页面主体表格 end*/ + + + +/**鼠标移入进"流水号"单元格,显示申请单申请物品申请发货回收等状态详情 begin*/ + +/* + * 1.器械包申请单、消毒物品申请单 + * 显示”物品名称“,”申请数量“,”回收数量“,”装配数量“,”灭菌数量“,”发货数量“等信息,消毒物品需要显示出材料信息 + * + * 2.一次性物品申请单 + * 显示”物品名称“,”申请数量“,”回收数量“,”发货数量“,”编码“等信息 + * QQQQ什么情况下背景色为红色需要询问? + * + * 3.通用申请单 + * 显示”物品名称“,”申请数量“,”回收数量“,”装配数量“,”灭菌数量“,”发货数量“等信息 + */ + $(".serialNumberCla").on('mouseenter',function(e){ + var $this = $(this); + var thisApplicationId = $($this).attr('id'); + var applicationItems = []; + $.ajax({ + url:WWWROOT+"/disinfectSystem/recyclingApplication/recyclingApplicationController/findApplicationItemVOListByInvoicePlanId.mhtml", + type:"GET", + data:{id:thisApplicationId}, + async:false, + dataType:"json", + success:function(msg){ + applicationItems = msg.rows; } }); + var divEl = ""; + for(var a = 0;a"+applicationItems[a].name+""+applicationItems[a].amount+""+applicationItems[a].recyclingAmount+"" + +applicationItems[a].packedAmount+""+applicationItems[a].sterilizationAmount+""+applicationItems[a].invoiceAmount+""; + } - /*【申请外来器械--“提交”按钮】*/ - $("#foreignTousseSubmit").click(function(){ - $("#foreignTousse_modal").modal('hide'); - }); - - /*【申请外来器械--“提交并打印”按钮】*/ - $("#foreignTousseSubmitPrint").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - /*【申请外来器械--“确认归还”按钮】*/ - $("#foreignTousseReturn").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - /*【申请外来器械--“提前归还”按钮】*/ - $("#foreignTousseEarlyReturn").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - /*【申请外来器械--“取消”按钮】*/ - $("#foreignTousseCancel").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - -/**【表单--申请外来器械 end】*/ - - -/**【借物--按钮】*/ - $("#app_borrowTousse").click(function(){ - $("#borrowTousse_title").text("借物单"); - $("#borrowTousse_modal").modal('show'); - }); + $("#applicationDetailsTableTh").nextAll().remove(); + $("#applicationDetailsTable").append(divEl); + $("#applicationDetails").removeClass("application_details_hide").addClass("application_details_show"); + $("#applicationDetails").css({"top":e.originalEvent.y,"left":e.originalEvent.x+50}); + }); + + //鼠标移除时将悬浮框隐藏 + $(".serialNumberCla").on('mouseleave',function(e){ + $("#applicationDetails").removeClass("application_details_show").addClass("application_details_hide"); + }); + +/**鼠标移入进"流水号"单元格,显示申请单申请物品申请发货回收等状态详情 end*/ -/**【搜索表单--更多查询】*/ - $("#search_more_btn").click(function(){ - $("#search_more_modal_title").text("更多查询"); - $("#search_more_modal").modal('show'); - }); + //科室申领页面所有申请单展示 +// loadAppListTable("allApplication_table","toolbar_table",allApplication_columns); + + +/**不同分辨率下样式调整 begin*/ + var screenWidth = parseInt(window.screen.width,10); + var screenHeight = parseInt(window.screen.height,10); + if( 720 == screenHeight){ + //字体调小 + $("body").css("font-size","7px"); + $(".content-header").css({'line-height':'30px','height':'30px','font-size':'15px'}); + $('.dx-btn-primary').css({'padding':'0 5px','line-height':'20px'}); + $('.dx-btn-lg').css({'height':'30px'}); + $('#contentSearch').find('.form-group').css({'margin-bottom':'0'}); + $('#main').css({'top':'none','bottom':'none'}); + } - - //申请自定义器械包中table字段 - var customizeTousse_columns=[{ - field : 'id', - align : 'center', - visible:false - }, - { - field : 'orgUnitCode', - align : 'center', - visible:false - }, - { - field : 'serialNumber', - align : 'center', - visible:false - }, - { - title : '材料名称', - field : 'materialName', - align : 'center' - }, - { - title : '数量', - field : 'num', - align : 'center' - }, - { - title : '是否植入物', - field : 'price', - align : 'center' - }, - { - title : '操作', - field : 'allprice1', - align : 'center' - } - ]; - - //申请外部代理灭菌单中table字段 - var foreignProxyDisinfection_columns=[{ - field : 'id', - align : 'center', - visible:false - }, - { - field : 'orgUnitCode', - align : 'center', - visible:false - }, - { - field : 'serialNumber', - align : 'center', - visible:false - }, - { - title : '物品', - field : 'tousseName', - align : 'center' - }, - { - title : '数量', - field : 'num', - align : 'center' - }, - { - title : '包装类型', - field : 'packageType', - align : 'center' - }, - { - title : '灭菌程序', - field : 'procedure', - align : 'center' - }, - { - title : '操作', - field : 'allprice1', - align : 'center' - } - ]; - - //借物单中table字段 - var borrowTousse_columns=[{ - field : 'id', - align : 'center', - visible:false - }, - { - field : 'orgUnitCode', - align : 'center', - visible:false - }, - { - field : 'serialNumber', - align : 'center', - visible:false - }, - { - title : '器械包名称', - field : 'tousseName', - align : 'center' - }, - { - title : '类型', - field : 'num1', - align : 'center' - }, - { - title : '数量', - field : 'price', - align : 'center' - }, - { - title : '单价', - field : 'allprice1', - align : 'center' - }, - { - title : '小计', - field : 'allprice1', - align : 'center' - }, - { - title : '时间', - field : 'allprice1', - align : 'center' - }, - { - title : '操作', - field : 'allprice1', - align : 'center' - } - ]; - - + $("#expendToggle").on('click',function(){ + if($(this).hasClass('glyphicon-chevron-down')){ + $("#contentSearch").css("display","none"); + $(this).removeClass('glyphicon-chevron-down'); + $(this).addClass('glyphicon-chevron-up'); + $("#main").removeClass("table-container"); + $("#main").addClass("table-container1"); + grid.invalidate(); + grid.render(); + }else{ + $("#contentSearch").css("display","block"); + $(this).removeClass('glyphicon-chevron-up'); + $(this).addClass('glyphicon-chevron-down'); + $("#main").removeClass("table-container1"); + $("#main").addClass("table-container"); + }; + }) +/**不同分辨率下样式调整 end*/ -/*【申请自定义器械包--下拉框】*/ - //申请科室 - renderDepartment_tousse("customizeTousse_appDpt"); - //结算科室 - renderDepartment_tousse("customizeTousse_settleDpt"); - //紧急度 - renderDepartment_tousse("customizeTousse_urgency"); - //材料名称 - renderDepartment_tousse("customizeTousse_material_name"); +/**向父级页面添加模态框体 begin*/ + var topBody = $(top.document.body); +// var modal = ''; + + var modal = ''; + + topBody.append(modal); +/**向父级页面添加模态框体 end*/ + +/**搜索栏 begin*/ + /**【搜索表单--更多查询】*/ + $("#search_more_btn").click(function(){ + $("#search_more_modal_title").text("更多查询"); + $("#search_more_modal").modal('show'); + }); - -/*【申请借物单--下拉框】*/ - //申请科室 - renderDepartment_tousse("borrowTousse_appDept"); - //结算科室 - renderDepartment_tousse("borrowTousse_settleDept"); - //处理科室 - renderDepartment_tousse("borrowTousse_handleDept"); - //物品名称 - renderDepartment_tousse("borrowTousse_tousse_name"); /*【搜索表单--下拉框】*/ @@ -501,50 +292,51 @@ alert("yes"); } }); + - /*【更多查询表单--下拉框】*/ -// //终止状态 - renderDepartment_tousse("search_more_termination_status"); -// //归还状态 - renderDepartment_tousse("search_more_return_status"); -// //发货状态 - renderDepartment_tousse("search_more_ship_status"); -// //回收状态 - renderDepartment_tousse("search_more_recycling_status"); -// //是否已打印 - renderDepartment_tousse("search_more_isPrinted"); -// //是否已提交 - renderDepartment_tousse("search_more_isCommited"); - -// 按科室分组 - renderDepartment_tousse("search_more_appDpt_group"); - //按物品分组 - renderDepartment_tousse("search_more_tousse_group"); - //器械包类型 - renderDepartment_tousse("search_more_tousse_type"); - //器械包名称 - renderDepartment_tousse("search_more_tousse_name"); - //申请单类型 - renderDepartment_tousse("search_more_appType"); - //申请人 - renderDepartment_tousse("search_more_applicant"); - //申请科室 - renderDepartment_tousse("search_more_appDpt"); - - //打印时间--开始时间 - initSchedulingDate('search_more_printTime_start','yyyy-mm-dd'); - //打印时间--结束时间 - initSchedulingDate('search_more_printTime_end','yyyy-mm-dd'); - //最后修改时间-结束时间 - initSchedulingDate('search_more_lastUpdateTime_end','yyyy-mm-dd'); - //最后修改时间-开始时间 - initSchedulingDate('search_more_lastUpdateTime_start','yyyy-mm-dd'); - //申请时间-结束时间 - initSchedulingDate('search_more_appTime_end','yyyy-mm-dd'); - //申请时间-开始时间 - initSchedulingDate('search_more_appTime_start','yyyy-mm-dd'); - +// +//// //终止状态 +// renderDepartment_tousse("search_more_termination_status"); +//// //归还状态 +// renderDepartment_tousse("search_more_return_status"); +//// //发货状态 +// renderDepartment_tousse("search_more_ship_status"); +//// //回收状态 +// renderDepartment_tousse("search_more_recycling_status"); +//// //是否已打印 +// renderDepartment_tousse("search_more_isPrinted"); +//// //是否已提交 +// renderDepartment_tousse("search_more_isCommited"); +// +//// 按科室分组 +// renderDepartment_tousse("search_more_appDpt_group"); +// //按物品分组 +// renderDepartment_tousse("search_more_tousse_group"); +// //器械包类型 +// renderDepartment_tousse("search_more_tousse_type"); +// //器械包名称 +// renderDepartment_tousse("search_more_tousse_name"); +// //申请单类型 +// renderDepartment_tousse("search_more_appType"); +// //申请人 +// renderDepartment_tousse("search_more_applicant"); +// //申请科室 +// renderDepartment_tousse("search_more_appDpt"); +// +// //打印时间--开始时间 +// initSchedulingDate('search_more_printTime_start','yyyy-mm-dd'); +// //打印时间--结束时间 +// initSchedulingDate('search_more_printTime_end','yyyy-mm-dd'); +// //最后修改时间-结束时间 +// initSchedulingDate('search_more_lastUpdateTime_end','yyyy-mm-dd'); +// //最后修改时间-开始时间 +// initSchedulingDate('search_more_lastUpdateTime_start','yyyy-mm-dd'); +// //申请时间-结束时间 +// initSchedulingDate('search_more_appTime_end','yyyy-mm-dd'); +// //申请时间-开始时间 +// initSchedulingDate('search_more_appTime_start','yyyy-mm-dd'); +// /*【更多查询--查询按钮】*/ /*表单验证*/ $("#search_more_query").click(function(){ @@ -578,238 +370,16 @@ alert("yes"); } }); - +/**搜索栏 end*/ - -/*【表单--申请自定义器械包】*/ - - var customizeTousseItems=[]; - /*【"申请自定义器械包"按钮】*/ - $("#app_customizeTousse").click(function(){ - $("#customizeTousse_title").text("申请自定义器械包"); - $("#customizeTousse_modal").modal('show'); - loadTable("customizeTousse_table","",customizeTousse_columns,false,false,'',false); - $(".table_div").find(".fixed-table-toolbar").remove(); - $(".form-table").find(".th-inner").css({"padding-top":"0","padding-bottom":"0","margin-bottom":"8"}); - }); - - /*【申请自定义器械包--"器械包名称"及“数量”输入完成后执行事件】*/ -// var customizeTousse_tousse_name=$("#customizeTousse_tousse_name"); -// var customizeTousse_tousse_num=$("#customizeTousse_tousse_num"); -// var tousseName=customizeTousse_tousse_name.text(); -// var tousseNum=customizeTousse_tousse_num.val(''); - - /*【申请自定义器械包--“添加”按钮】*/ - $("#customizeTousse_add_tousse").click(function(){ - var customizeTousse_material_name=$("#customizeTousse_material_name"); - var customizeTousse_material_num=$("#customizeTousse_material_num"); - var materialName=customizeTousse_material_name.text(); - var materialNum=customizeTousse_material_num.val(); - - if(!Tools.StringUtils.isEmpty(materialName)&&!Tools.StringUtils.isEmpty(materialNum)){ - var appendMaterialContent={materialName:materialName,num:materialNum}; - $("#customizeTousse_table").bootstrapTable('append',appendMaterialContent); - customizeTousse_material_name.text(''); - customizeTousse_material_num.val(''); - customizeTousseItems.push(appendMaterialContent); - } - }); - - /*【申请自定义器械包--“提交”按钮】*/ - $("#foreignTousseSubmit").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - /*【申请自定义器械包--“提交并打印”按钮】*/ - $("#foreignTousseSubmitPrint").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - /*【申请自定义器械包--“确认归还”按钮】*/ - $("#foreignTousseReturn").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - /*【申请自定义器械包--“提前归还”按钮】*/ - $("#foreignTousseEarlyReturn").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - /*【申请自定义器械包--“取消”按钮】*/ - $("#foreignTousseCancel").click(function(){ - $("#foreignTousse_modal").modal('hide'); - clearForm("foreignTousse_modal",["foreignTousse_table"],foreignTousseItems); - }); - - - - - -/*【表单--申请外部代理灭菌单】*/ - - var foreignProxyDisinfectionItems=[]; - - /*【申请外部代理灭菌单--下拉框】*/ - //申请科室 - renderDepartment_tousse("foreignProxyDisinfection_appDept"); - renderDepartment_tousse("foreignProxyDisinfection_settleDept"); - renderDepartment_tousse("foreignProxyDisinfection_handleDept"); - renderDepartment_tousse("foreignProxyDisinfection_tousse_name",1); - renderDepartment_tousse("foreignProxyDisinfection_package_type",1); - renderDepartment_tousse("foreignProxyDisinfection_procedure",1); - - /*【"申请外部代理灭菌单"按钮】*/ - $("#app_foreignProxyDisinfection").click(function(){ - $("#foreignProxyDisinfection_title").text("外部代理灭菌单"); - $("#foreignProxyDisinfection_modal").modal('show'); - loadTable("foreignProxyDisinfection_table","",foreignProxyDisinfection_columns,false,false,'',false); - $(".table_div").find(".fixed-table-toolbar").remove(); - $(".form-table").find(".th-inner").css({"padding-top":"0","padding-bottom":"0","margin-bottom":"8"}); - }); - - /*【申请外部代理灭菌单--“添加”按钮】*/ - $("#foreignProxyDisinfection_num").keypress(function(e){ - if(event.keyCode == "13"){ - var tousseNameEl=$("#foreignProxyDisinfection_tousse_name"); - var packageTypeEl=$("#foreignProxyDisinfection_package_type"); - var procedureEl=$("#foreignProxyDisinfection_procedure"); - var numEl=$("#foreignProxyDisinfection_num"); - - var tousseName=tousseNameEl.text(); - var packageType=packageTypeEl.text(); - var procedure=procedureEl.text(); - var num=numEl.val(); - - if(!Tools.StringUtils.isEmpty(tousseName)&&!Tools.StringUtils.isEmpty(packageType)){ - var isExist=false; - for(var i=0;i" - +"" - +""+material.name+"" - +""+material.count+"" - +""+material.price+"" - +"" - +""; - } - table=table+""; - - $detail.html(table); - }, - onEditableSave: function (field, row, oldValue, $el) { - var isExist=false; - for(var i=0;i"+value+""+row.depart+""); - - //结算科室 - $("#settleDep_tousse").append(""); - - //处理科室 - $("#handleDep_tousse").append(""); - - //申请时间 - $("#time").val(row.applicationTimeStr); - - //备注 - var remarksEl=$('#remarks') - var remark=remarksEl.val(row.remark); - - //设置表格数据 - appToussesArr=[]; - for(var i=0;i"+row.depart+""); + //结算科室 + $("#settleDep_tousse").append(""); + //处理科室 + $("#handleDep_tousse").append(""); + //申请时间 + $("#time").val(row.applicationTimeStr); + + var remarksEl=$('#remarks');//备注 + var remark=remarksEl.val(row.remark); + + + $("#tousseAppForm").s_validate({ + departApp_tousse:{type:'id',error:"申请科室不能为空"}, + settleDep_tousse:{type:'id',error:"结算科室不能为空"}, + handleDep_tousse:{type:'id',error:"处理科室不能为空"}, + appToussesArr : {type:'array',error:"申请物品不能为空", positionId:'tousseName_tousse_select', value:appToussesArr, validateField:{field:'amount',type:'num',valiType:'notEmpty'} - } - }); - }); + }}); + }); });//$(function()结束 @@ -608,52 +445,10 @@ return result; } - -/** - * 获取下拉框内容并渲染到页面--科室下拉框 - */ -function renderDepartment_tousse(elementId,placeholder,maximumSelectionLength,url,asyns){ - - $("#"+elementId).select2({ - language : 'zh-CN',//转为中文版 - minimumInputLength: 1, - placeholder: placeholder, - maximumSelectionLength:maximumSelectionLength, - ajax: { - url: WWWROOT + url, - dataType: 'json', - contentType:"application/json;charset=utf-8", - asyns:asyns, - type:'POST', - cache: true, - delay: 1000, - data:function (params) { - return JSON.stringify({ - title: params.term, // search term - limit:100, - page: params.page||1, //第几页返回查询 - offset:(params.page||1) * 100 - }); - }, - processResults: function (data,params) {//结果处理 - var result=[]; - var store=data.data.data; - for(var i=0;i" - +"" - +""+material.name+"" - +""+material.count+"" - +""+material.price+"" - +"" - +""; - } - table=table+""; - - $detail.html(table); - }, - onEditableSave: function (field, row, oldValue, $el) { - var isExist=false; - for(var i=0;i/g,">"); + //制造一个占位 + var spacer = ""; + //根据ID获取此行内容的索引值 + var idx = dataView1.getIdxById(dataContext.id); + //如果data中对应的内容不为空,并且此行缩进大于上一行的缩进 + if (loadData[idx + 1] && loadData[idx + 1].indent > loadData[idx].indent) { + if (dataContext._collapsed) { + return spacer + "  " + value; + } else { + return spacer + "  " + value; + } + + }else{ + return spacer + "  " + value; + } + return "  " + value; +// return "  " + value; + +} + + + /** 点击“申请器械包”、“申请一次性物品”、“申请消毒物品”、“申请外来器械”、“申请自定义器械包”、“申请外部代理灭菌包”、“借物”按钮显示申请表单 * var formJson={ * //是否为IE @@ -1456,11 +776,27 @@ var title="申请器械包"; var tousseType=formJson.tousseType; + //加载“申请物品”信息表格 + appTemplate_columns = [ + {id: 'id',name:'name',field : 'id',sortable:true,width: 0, minWidth: 0, maxWidth: 0, cssClass: "reallyHidden", headerCssClass: "reallyHidden"}, + {id: 'tousseDefinitionID',field : 'tousseDefinitionID',minWidth:150,sortable:true,width: 0, minWidth: 0, maxWidth: 0, cssClass: "reallyHidden", headerCssClass: "reallyHidden"}, + {id: 'tousseName',name:'物品名',field : 'tousseName',minWidth:150,width: 0,sortable:true}, + {id: 'amount',name:'申请数量',field : 'amount',minWidth:150,width: 35,sortable:true,editor: Slick.Editors.Text}, + {id: 'price',name:'单价',field : 'price',minWidth:60,sortable:true}, + {id: 'allprice',name:'小计',field : 'allprice',minWidth:60,sortable:true} + ]; + + var datas = []; + if(tousseType == Constants.AppType.TYPE_DIPOSABLE_GOODS_APPLICATION_FORM){ title = "申请一次性物品"; }else if(tousseType == Constants.AppType.TYPE_DISINFECT_GOODS_APPLICATION_FORM){ title = "申请消毒物品"; + appTemplate_columns[2].formatter = iconFormatter; + //初始化表格时转化数据为父子表格式 + transToDisfection(datas,0,tousseType); } + //设置表单申请人为当前登陆用户 $("#applicant").val(formJson.applicant); //为表单设置标题 @@ -1469,14 +805,100 @@ window.top.$("#"+formJson.modalElementId).modal('show'); //渲染“物品名称”下拉框数据 renderSelect_comboGoods(formJson.tousseSelectElementId,formJson.tousseSelectNum,tousseType,$('#'+formJson.departElementId).val() || "",$('#'+formJson.settleDepartElementId).val() || "",$('#'+formJson.handlerDepartElementId).val() || ""); - //加载“申请物品”信息表格 - loadTable(formJson.formTableElementId,"",formJson.columns,false,false,"",formJson.isExpandRow,formJson.appToussesArr); - //调整bootstrap-table 原有的样式,节约空间 - $(".table_div").find(".fixed-table-toolbar").remove(); - $(".form-table").find(".th-inner").css({"padding-top":"0","padding-bottom":"0","margin-bottom":"8"}); + +// if(formJson.){ +// formJson.columns = appTemplate_columns; +// } + var options = { + enableCellNavigation: true, + enableColumnReorder: false, + topPanelHeight:'40', + rowHeight:'30', + headerRowHeight:'30', + multiSelect:false, + fullWidthRows:'true', + editable: true, + enableAddRow: false, + enableCellNavigation: true, + asyncEditorLoading: false, + autoEdit: false + }; + + + + + dataView1 = new Slick.Data.DataView({ inlineFilters: true }); +// dataView1.beginUpdate(); + loadData = []; + dataView1.setItems(loadData); + + dataView1.setFilter(myFilter); + dataView1.endUpdate(); + + grid = new Slick.Grid("#tousse_table",dataView1,appTemplate_columns,options); +// dataView1.addItem({id:'6',tousseDefinitionID:'2222' ,tousseName:'针头',amount:'10',price:'20',allprice:'200'}); + grid.autosizeColumns(); + grid.onClick.subscribe(function (e, args) { + if ($(e.target).hasClass("toggle")) { + var item = dataView1.getItem(args.row); + if (item) { + if (!item._collapsed) { + item._collapsed = true; + } else { + item._collapsed = false; + } + dataView1.updateItem(item.id, item); + } + e.stopImmediatePropagation(); + } + }); + + grid.onCellChange.subscribe(function(e,args){ + //得到编辑完成的数据行 + var item = args.item; + //更改预备提交的物品组 + for(var a = 0;a < appToussesArr.length;a++){ + if(item.tousseDefinitionID === appToussesArr[a].tousseDefinitionID){ + appToussesArr[a].amount = item.amount; + } + } + }) + + + dataView1.onRowCountChanged.subscribe(function (e, args) { + grid.updateRowCount(); + grid.render(); + }); + + dataView1.onRowsChanged.subscribe(function (e, args) { + grid.invalidateRows(args.rows); + grid.render(); + }); + + } +/** 行数据过滤 + * + */ +function myFilter(item) { + + + if (item.parent != null) { + var parent = loadData[item.parent]; + + while (parent) { + if (parent._collapsed) { + return false; + } + parent = loadData[parent.parent]; + } + } + return true; + + } + /** 提交申请单 * var submitJson={ * //“ID”对应的HTML元素ID属性 @@ -1629,9 +1051,86 @@ +/**slick.grid,消毒物品数据格式转换成父子表结构*/ +function transToDisfection(datas,tempId,tousseType){ + + if(tousseType != Constants.AppType.TYPE_DISINFECT_GOODS_APPLICATION_FORM){ + loadData = datas; + return; + } + + var tempId = tempId || 0; + + for(var i=0;i 0) { + //var tipsColor = ""; + // var operateHtml = ""; + for(var j=0; j < materials.length; j++){ + var k = (loadData[tempId] = {}); + k["id"] = tempId+'m' ; + k["indent"] = 1; + k["parent"] = parentId; + k["tousseName"]=materials[j].tousseName; + k["amount"]=materials[j].amount; + k["price"]=materials[j].price; + k["allprice"]=materials[j].allprice; + tempId ++; + } + } + } + +} +/** + * 将消毒物品数据转换成可以显示到slick父子表的显示格式 + * 需要转换的数据形式: + * {"isCleanedEntirely":"是","spelling":"WSCXS","isThereIdentificationCard":"否","displayName":"委松除屑水","type":"消毒物品","borrowPrice":0,"unit":"","expressInvoice":"否", + * "materials":[ + {"name":"骨刀 (小)[24cm刃8mm]","materialDefinitionId":123,"tousseType":"器械","isDiposable":"否","count":1,"countBackup":1,"totalPrice":0,"amount":1,"price":0,"leaf":true}, + {"name":"剥离子 (中)[19cm刃6mm]","materialDefinitionId":13,"tousseType":"器械","isDiposable":"否","count":1,"countBackup":1,"totalPrice":0,"amount":1,"price":0,"leaf":true}], + "price":0,"name":"委松除屑水","id":14899,"tousseType":"消毒物品","isApplyEntireTousse":"否"} + + * 转换后的形式: + * [ + {id:tempId,tousseDefinitionID:'',indent : 0,parent:0,tousseName:'',amount:'',price:'',allprice:''}, + {id:tempId ++,tousseDefinitionID:'',indent : 1,parent:parentId,tousseName:'',amount:'',price:'',allprice:''} + ] + * + */ +function girdShowDatatransform(disinfectItem,tempId){ + var results = []; + var parentId = tempId; + results[0] = {id:parentId,tousseDefinitionID:disinfectItem.id,indent : 0,parent:null,tousseName:disinfectItem.name,amount:0,price:disinfectItem.price,allprice:''}; + for(var r=0;r