$(function () { var Util = $.Util; new Vue({ el: "#app", data: { isInit1: false, // dataSource:'',//数据元 dataArr:'',//数据集 metedata:{}, relation:{}, externalParams:JSON.parse(Util.getUrlQueryString('externalParams')) || {}, }, mounted: function () { this.initData() // $(".resource-info tr").find("td:eq(0),td:eq(2),td:eq(4)").css("background-color", "#E0ECFF"); // $(".resource-info").find("tr:eq(0)").css("background-color", "#E0ECFF"); }, methods: { initData: function () { this.formInit(); var yesterday = new Date(new Date().getTime() - 24 * 3600 * 1000).Format('yyyy-MM-dd'); // $('#start1').val(yesterday); // $('#end1').val(yesterday); $("#select1").val('全部'); $("#select2").val('全部'); this.loadGrid1(); this.bindEvents(); }, formInit: function () { //tab1 var vm = this; var startTime = vm.externalParams.startTime || ""; var endTime = vm.externalParams.endTime || ""; $("#start1").ligerDateEditor({ width: 105,initValue:startTime }); $("#end1").ligerDateEditor({ width: 105,initValue:endTime }); $("#select1").customCombo(commonApi.organizations, { sorts: "-createDate", token:sessionStorage.getItem("accessToken"), }); $("#dataArr").customCombo(questionQuery.adapterDatasetList, { token:httpRequest.asstoken, version:'5a6951bff0bb' },false,false,false,{ valueField: 'stdDatasetCode',//id textField: 'stdDatasetName',//name conditionSearchClick: function(g){ var searchParm = g.rules.length > 0 ? g.rules[0].value : ''; var parms = g.grid.get("parms"); if(searchParm){ parms.filters = "stdDatasetName?"+searchParm+' g1;stdDatasetCode?'+searchParm+' g1;'; }else{ parms.filters = ""; } g.grid.set({ parms: parms, newPage: 1 }); g.grid.reload(); } },{ columns: [ {display : '名称', name :'stdDatasetName',width : 210, align: 'left'} ], }); $("#dataSource").customCombo(questionQuery.adapterMetadataList, { token:httpRequest.asstoken, version:'5a6951bff0bb' },false,false,false,{ valueField: 'stdMetadataCode',//id textField: 'stdMetadataName',//name conditionSearchClick: function(g){ var searchParm = g.rules.length > 0 ? g.rules[0].value : ''; var parms = g.grid.get("parms"); if(searchParm){ parms.filters = "stdMetadataName?"+searchParm+' g1;stdMetadataCode?'+searchParm+' g1;'; }else{ parms.filters = ""; } g.grid.set({ parms: parms, newPage: 1 }); g.grid.reload(); } },{ columns: [ {display : '名称', name :'stdMetadataName',width : 210, align: 'left'} ], }); $("#select2").ligerComboBox({ data: [{ value: "全部", code: null }, { value: "字段值为空", code: "1" }, { value: "值域超出", code: "2" }, { value: "类型错误", code: "3" }, { value: "格式错误", code: "4" }, { value: "资源适配错误", code: "5" }, { value: "字典适配错误", code: "6" }, { value: "转换异常错误", code: "21" }, ] }); //tab2 $("#start2").ligerDateEditor({ width: 105 }); $("#end2").ligerDateEditor({ width: 105 }); }, bindEvents: function () { var vm = this; $("#grid1").on("click", ".see-detail-btn", function () { var code = $(this).data("code"); vm.code1 = code; questionQuery.metadataErrorDetail({id:code}).then(function(res){ var metedata = res && res.obj && res.obj.metedata; var relation = res && res.obj && res.obj.relation; if(metedata){ metedata.qc_error_type = metedata.qc_error_type.toString(); switch(metedata.qc_error_type){ case '0':str='验证正常';break; case '1':str='字段值为空';break; case '2':str='值域超出';break; case '3':str='类型错误';break; case '4':str='格式错误';break; case '5':str='资源适配错误';break; case '6':str='字典适配错误';break; case '21':str='转换异常错误';break; } metedata.qc_error_type =str; } if(relation){ if(relation.event_type || relation.event_type===0){ relation.event_type = relation.event_type.toString(); switch(relation.event_type){ case '0':relation.event_type='门诊';break; case '1':relation.event_type='住院';break; case '2':relation.event_type='体检';break; } } if(relation.card_type){ relation.card_type = relation.card_type.toString(); switch(relation.card_type){ case '1':relation.card_type='社会保障卡';break; case '2':relation.card_type='医保卡';break; case '3':relation.card_type='新农合';break; case '4':relation.card_type='发行正式卡';break; case '5':relation.card_type='发行临时卡';break; case '9':relation.card_type='其他卡类别';break; } } } vm.metedata =metedata; vm.relation = relation; }).catch(function(err){ console.log(err) }) vm.$refs.leftSilder.show(); setTimeout(function () { $(".left-slider-box").css("right", "5px"); }, 1) }) }, backClick: function () { this.$refs.leftSilder.hide() }, getfilter:function(){ var filterstr='',org_code= $("#select1").ligerGetComboBoxManager().getValue(), dataArr=$("#dataArr").ligerGetComboBoxManager().getValue(),dataSource=$("#dataSource").ligerGetComboBoxManager().getValue(); filterstr+='qc_step=3;' if($('#start1').val()){ filterstr +=( 'receive_date>='+ $('#start1').val() +' 00:00:00;') } if($('#end1').val()){ filterstr +=( 'receive_date<='+ $('#end1').val() +' 23:59:59;') } if($('#select2').val()){ var errType=''; switch($('#select2').val()){ case '验证正常':errType=0;break; case '字段值为空':errType=1;break; case '值域超出':errType=2;break; case '类型错误':errType=3;break; case '格式错误':errType=4;break; case '资源适配错误':errType=5;break; case '字典适配错误':errType=6;break; case '转换异常错误':errType=21;break; } if(errType || errType===0){ filterstr +=( 'qc_error_type='+ errType+';') } } if(dataSource){ filterstr +=( 'metadata='+dataSource +';') } if(dataArr){ filterstr +=( 'dataset='+dataArr+';') } if(org_code){ filterstr +="org_code=" + org_code + ";"; } return filterstr // var str = 'filters: receive_date>=2018-04-01 09:50:00;receive_date<=;org_code=;_id=;event_date>=;event_date<=;patient_name=;demographic_id=;analyze_status=;' }, loadGrid1: function (isSearch) { var vm = this; if (vm.isInit1 && !isSearch) return vm.isInit1 = true; var params = { filters:this.getfilter(), token:httpRequest.asstoken, sorts:'-receive_date' } $("#grid1").ligerGrid({ url: questionQuery.metadataErrorList, parms: params, method: 'get', pagesizeParmName: 'size', enabledSort:false, // checkbox: true, columns: [ { display: '上传时间', name: 'create_date', align: 'center', }, { display: '医疗机构', name: 'org_name', align: 'center', }, { display: '数据集', name: 'dataset', }, { display: '数据集名称', name: 'dataset_name', }, { display: '数据元', name: 'metadata', }, { display: '数据元名称', name: 'metadata_name', }, { display: '主键', name: '_id', }, { display: '错误原因', name: 'error_type', render: function (row) { var str =''; row.qc_error_type =row.qc_error_type.toString() switch(row.qc_error_type){ case '0':str='验证正常';break; case '1':str='字段值为空';break; case '2':str='值域超出';break; case '3':str='类型错误';break; case '4':str='格式错误';break; case '5':str='资源适配错误';break; case '6':str='字典适配错误';break; case '21':str='转换异常错误';break; } return str; } }, { display: '操作', name: 'operator', align: 'center', render: function (row) { var html = '查看详情'; return html; } } ] }); }, downClick:function(){ var vm = this; var str = questionQuery.archiveDown + vm.detail.pack_id +'?token='+this.token; window.open(str, '_blank')//档案包下载 }, export1:function(){ if(!$('#start1').val().trim() || !$('#end1').val().trim()){ $.ligerDialog.error('请选择接收时间再导出!'); return } var str = exportApi.exportMetadataErrorList +'?filters='+ this.getfilter()+'&token='+httpRequest.asstoken;; window.open(str) }, } }) })