123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- var g;
- /*var title = "";*/
- var type = "";
- var depts;
- var loadParams = "";
- var role_id =top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var deptsel = "";
- //var statusDate = '0';
- var mycol = [
-
- {display : '一级表头', name : 'TABLE_HEAD_529',align : 'center',width : "25%"},
- /* {display : '报表字段', name : 'TABLE_COLUMN_529',align : 'center',width : "20%"},*/
- {display : '字段描述', name : 'COLUMN_NAME_529',align : 'center', width : "25%"},
- /*{display : '二级表头', name : 'COLUMN_NAME_529',align : 'center', width : "25%"},*/
- {display : '是否在用', name : 'IS_USED_529',align : 'center', width : "25%",render:function (rowdata, rowindex, value, column){
- if(value=="0"){
- return "字段在使用";
- }
- return "备用字段";
- }},
- {display : '是否统计', name : 'IS_COUNT_529',align : 'center', width : "25%",render:function (rowdata, rowindex, value, column){
-
- if(value=="0"){
- return "该字段既统计又要输入数字";
- }else if(value=="1"){
- return "该字段不统计但要输入数字";
- }else{
-
- return "该字段既不统计又不要输入数字";
- }
- }}];
- function initComplete() {
-
- var url = decodeURI(window.location.search);
- var type = url.split("?")[1];
- var table = url.split("?")[2];
- $("#type").val(type);
- $("#tables").val(table);
- loadParams = {
- "listId" : '529',
- "condition" : "is_del =0 and report_type='"+type+"' and TABLE_HEAD is not null and COLUMN_NAME is not null",
- direction : 'desc', // 排序方式
- sort : 'REPORT_NAME_529'
- };
- init(table,loadParams);
-
- }
- function init(data,params){
- var option = {
- columns : [
- {
- display :data ,
- columns : [
- {display : '一级表头', name : 'TABLE_HEAD_529',align : 'center',width : "25%"},
- /*{display : '字段描述', name : 'COLUMN_NAME_529',align : 'center', width : "25%"},*/
- {display : '二级表头', name : 'COLUMN_NAME_529',align : 'center', width : "25%"},
- {display : '是否在用', name : 'IS_USED_529_SHOW',align : 'center', width : "25%"},
- {display : '是否统计', name : 'IS_COUNT_529_SHOW',align : 'center', width : "25%"}
-
- ],
-
- }
- ],
- pageSize : 10,
- rownumbers : true,
- percentWidthMode : true,
- checkbox : true
-
-
-
- };
- //var roleCons = roleButtonArr();
- var toblBars = {
- items :[ {text : '新增',click : 'onAdd',iconClass : 'add1_tem',disabled : false},
- {text : '删除',click : 'onDelete',iconClass : 'delete_tem', disabled : false},
- {text : '修改', click : 'onEdit',iconClass : 'update_tem',disabled : false},
- {text : '预览', click : 'onView',iconClass : 'view_tem',disabled : false},
- {text : '导出', click : 'onReportExport',iconClass : 'export_tem',disabled : false},
- {text : '返回', click : 'goback',iconClass : 'back_tem',disabled : false},
- ],
- // roleCons:roleCons
- };
-
-
- var options={
- url : $.pathname() + '/ws/crud/CRUDService/queryQui',
- params : params,
- width : "100%",
- gridOptions:option,
- paperOpration:{showInput:"true"},
- toolBarOptions:toblBars
- };
- g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options);
-
- }
- //增加
- function onAdd(){
- /*var sel = $("#sel").val();*/
- /*var dept = $("#dept").val();*/
- /*var data = g.getData();*/
- var url = "/nwyj/page/business/am/report/dictionary/Type_Add.html?"+$("#type").val()+"?"+$("#tables").val();
-
- window.parent.document.getElementById("frmright").setAttribute("src", encodeURI(url));
-
-
- }
- //删除
- function onDelete(){
-
- var rows = g.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要删除的记录!");
- return;
- }
-
- var ids = "";
-
- var flag = true;
- for ( var i = 0; i < rowsLength; i++) {
- if(rows[i].IS_USED_529=="1"){
- flag = false;
- top.Dialog.alert("备用字段不能删除");
- return;
- }else{
-
- ids += rows[i].FD_OBJECTID_529 + ";";
- }
-
- }
- if(flag){
-
- top.Dialog.confirm("确定要删除吗?|删除", function() {
- // 删除记录
-
- $.post($.pathname() +"/ws/xianlutingyun/XianlutingyunService/deleteReport", {
- fd_id : ids,type:"rc"
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("删除成功",null,null,null,null);
- // 刷新表格数据
- g.rend();
- } else {
- top.Dialog.alert("删除失败!");
- }
- }, "json");
-
- });
- }
- }
- //修改
- function onEdit(){
- var row = g.getSelectedRows();
-
- if(row.length==0){
- top.Dialog.alert("请选择一条记录修改");
- return;
- }
- if(row.length>1){
- top.Dialog.alert("一次只能修改一条记录");
- return;
- }
- var title = row[0].TABLE_HEAD_529;
- var desc = row[0].COLUMN_NAME_529;
- var name = row[0].TABLE_COLUMN_529;
- var count = row[0].IS_COUNT_529;
- var type = row[0].REPORT_TYPE_529;
- var report_name = row[0].REPORT_NAME_529;
- window.parent.document.getElementById("frmright").setAttribute("src", encodeURI("/nwyj/page/business/am/report/dictionary/Type_Alter.html?"+title+"?"+desc+"?"+name+"?"+count+"?"+type+"?"+report_name));
- }
- //预览
- function onView(){
- window.parent.document.getElementById("frmright").setAttribute("src",encodeURI("/nwyj/page/business/am/report/dictionary/View.html?"+$("#type").val()+"?"+$("#tables").val()));
- }
-
- function onReportExport(){
- var url = decodeURI(window.location.search);
- var type = url.split("?")[1];
- var table = url.split("?")[2];
- var Columns = findColumn(type);
- var columns_sub = Columns.substring(0, Columns.lastIndexOf(","));
- var condition = '1=1';
- //alert(findId(type));
- var sql = {
- "flag":"muban",
- //"listId" :findId(type),
- "condition":condition,
- "id":dept_id,
- "report_type":type
- };
- excelExport(type,sql," 导出"+table,['FD_OBJECTID','REPORT_ID','TEST','COMP_ID',columns_sub],table+"模板","rcreport");
- }
-
-
- function goback(){
- var iframe = parent.document.getElementsByName("frmright")[0];
- iframe.src = "/nwyj/page/business/am/report/dictionary/report_model.jsp";
- }
-
-
-
- //根据选中记录查找classId
- function findId(type){
- var classId="";
- $.ajax({
- url : $.pathname() + "/ws/getReportId/ExportExcelService/getReportClassId",
- type : 'post',
- timeout : 15000,
- async : false,
- data : {
- report_type:type
- },
- dataType : 'json',
- success : function(data) {
- classId = data.rows[0].CLASSID;
- },
- error : function(e) {
- $.messager.alert('获取ID失败!', '访问服务失败!', 'error');
- }
- });
- return classId;
- }
- //过滤没用的列
- function findColumn(type){
- //把首次导入的清除
- var column="";
- $.ajax({
- url : $.pathname() + "/ws/getReportId/ExportExcelService/getColumn",
- type : 'post',
- timeout : 15000,
- async : false,
- data : {
- report_type:type
- },
- dataType : 'json',
- success : function(data) {
- for(var i=0;i<data.rows.length;i++){
- column += data.rows[i].TABLE_COLUMN+",";
- }
- },
-
- error : function(e) {
- $.messager.alert('获取列失败!', '访问服务失败!', 'error');
- }
- });
- return column;
- }
|