123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
- <%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
- <script>
- /* ************************** 全局变量定义 **************************** */
- var Util = $.Util;
- var schemeVersionList = [];
- /* *************************** 自定义模块 ***************************** */
- var jobLayout = {
- dialog:null,
- grid:null,
- init:function(){
- var me = this;
- $('.m-retrieve-area').show();
- $.ajax({
- url: '${contextRoot}/datacollect/getLayout',
- dataType: "json",
- success: function (data) {
- if(data.successFlg){
- schemeVersionList = data.detailModelList || [];
- }else{
- $.ligerDialog.error(data.message);
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- $.ligerDialog.error("获取适配方案版本列表失败!")
- }
- });
- me.grid = $("#div_grid").ligerGrid({
- url: '${contextRoot}/datacollect/getSchemeVersionList',
- usePager: false,
- columns: [
- { display: 'schemeId', name: 'schemeId', hide:true },
- { display: 'id', name: 'id', hide:true },
- {display:'适配方案',name:'', width: '20%',render: function (row, rowindex, value, column) {
- var select= '<select class="sel-scheme-name form-control" id="schemeNm'+rowindex+'" style="margin-top:3px;font-size:12px;">';
- for(var i=0;i<schemeVersionList.length;i++){
- select+='<option value="'+schemeVersionList[i].schemeId+'">'+schemeVersionList[i].name+'</option>';
- }
- select = $(select+"</select>");
- $('option[value="'+row.schemeId+'"]',select).attr('selected',true);
- return select.prop("outerHTML");
- }},
- {display:'版本',name:'',width: '20%',render: function (row, rowindex, value, column) {
- var select= '<select class="sel-version-name form-control" id="versionNm'+rowindex+'" style="margin-top:3px;font-size:12px;">';
- var versionList = [];
- for(var i=0;i<schemeVersionList.length;i++){
- if(schemeVersionList[i].schemeId == row.schemeId){
- versionList = schemeVersionList[i].versionList;
- for(var j=0;j<versionList.length;j++){
- select+='<option value="'+versionList[j].id+'">'+versionList[j].name+'</option>';
- }
- }
- }
- select = $(select+"</select>");
- $('option[value="'+row.id+'"]',select).attr('selected',true);
- return select.prop("outerHTML");
- }},
- {display:'数据集名称',name:'dataSets', width: '40%',render: function (row, rowindex, value, column) {
- var dataSets = value.toString().substring(0,value.length-1);
- var html = '<input style="margin-top:3px;font-size:12px;" data-rowindex="'+rowindex+'" class="sel-dataset-name form-control" value="'+(dataSets || "")+'" >' +
- '<div style="display: none;" id="datasetId'+rowindex+'"></div>';
- return html;
- }},
- {display:'操作', name: 'operator', width: '20%', render: function (row) {
- var html = '<div class="m-inline-buttons" style="width:55px;">';
- html += '<a href="javascript:void(0)" onclick="javascript:jobLayout.mapping(\''+row.id+'\')">数据映射</a>';
- return html;
- }}
- ],
- onAfterShowData: function (gridData) {//显示完数据事件
- //【适配方案】change事件
- $(".sel-scheme-name").on("change", function() {
- var rowIndex = $(this).attr("id").replace("schemeId","");
- var option = "";
- for(var i=0;i<schemeVersionList.length;i++){
- if(schemeVersionList[i].schemeId == $(this).val()){
- versionList = schemeVersionList[i].versionList;
- for(var j=0;j<versionList.length;j++){
- option+='<option value="'+versionList[j].id+'">'+versionList[j].name+'</option>';
- }
- }
- }
- $("#versionId"+rowIndex).html("");
- $("#versionId"+rowIndex).append(option);
- });
- //【数据集名称】focus事件
- $(".sel-dataset-name").on("focus", function() {
- var rowindex = $(this).attr("data-rowindex");
- jobLayout.grid.select(rowindex);//选中行
- var row = jobLayout.grid.getSelectedRow();
- var params = {schemeId:row.schemeId,version:row.id,schemeNm:$("#schemeNm"+rowindex).find("option:selected").text()};
- me.dialog = $.ligerDialog.open({
- height: 600,
- width: 600,
- title: "数据集选择器",
- url: '${contextRoot}/datacollect/datasetDetail',
- //load: true,
- urlParms: params
- });
- });
- }
- });
- me.bindEvents();
- },
- //绑定按钮事件
- bindEvents: function () {
- var me = this;
- $('#btnAdd').click(function () {
- me.editor();
- });
- $('#btnSave').click(function(){
- //获取选择行
- debugger
- var row = me.grid.getSelectedRow();
- if(row!=null &&row.id!=undefined&&row.id.length>0)
- {
- $.ligerDialog.success("已交由后台运行!");
- var jobId = row.id;
- $.ajax({ //ajax处理
- type: "POST",
- url : "${contextRoot}/datacollect/executeJob",
- dataType : "json",
- data:{jobId:jobId},
- cache:false,
- success :function(data){
- if(!data.successFlg) {
- $.ligerDialog.error(data.message);
- }
- },
- error :function(data){
- $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
- }
- });
- }
- else{
- $.ligerDialog.warn('请选择要执行任务!');
- }
- });
- },
- //编辑弹窗
- editor:function(id){
- var me = this;
- var title = "新增任务";
- var params = null;
- if(id!=undefined&&id!=null)
- {
- title = "编辑任务";
- params = {jobId:id};
- }
- me.dialog = $.ligerDialog.open({
- height: 556,
- width: 700,
- title: title,
- url: '${contextRoot}/datacollect/editorJob',
- //load: true,
- urlParms: params
- });
- },
- //数据映射
- mapping:function(id){
- var me = this;
- var params = {jobId:id};
- me.dialog = $.ligerDialog.open({
- height: 600,
- width: 800,
- title: "数据映射",
- url: '${contextRoot}/datacollect/jobDataMapping',
- //load: true,
- urlParms: params
- });
- },
- //删除任务
- delete:function(id)
- {
- $.ligerDialog.confirm("确定要删除该任务吗?", function (confirm) {
- if (confirm)
- {
- $.ajax({ //ajax处理
- type: "POST",
- url : "${contextRoot}/datacollect/deleteJob",
- dataType : "json",
- data:{jobId:id},
- cache:false,
- success :function(data){
- if(data.successFlg) {
- $.ligerDialog.success(data.message);
- jobLayout.grid.reload();
- }
- else{
- $.ligerDialog.error(data.message);
- }
- },
- error :function(data){
- $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
- }
- });
- }
- });
- },
- //弹窗返回消息
- callbackDialog:function(message){
- $.ligerDialog.success(message);
- this.grid.reload();
- this.dialog.close();
- }
- }
- $(function () {
- jobLayout.init();
- });
- </script>
|