123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- $.namespace("grsw.gggl.main");
- grsw.gggl.main.$popWin = null;
- /** 页面初始化 */
- grsw.gggl.main.init = function() {
- grsw.gggl.main.$popWin = $("#popWin");
- grsw.gggl.main.initpage();
- };
- /** 页面初始化*/
- grsw.gggl.main.initpage = function() {
- $("#pagetools").hide();
- //把form传入,构造翻页控件
- pageinfo($("#ggglform"));//见common.js
- }
- /**新增页面*/
- grsw.gggl.main.add=function(backurl){
- location.href=$.ctx+"/dbgg/add?backurl="+backurl;
- }
- /**
- * 记录编辑处理
- */
- grsw.gggl.main.doEdit = function(id) {
- window.location=$.ctx + '/dbgg/view?flag=0&rflag=0&id='+id+'&backurl='+$.ctx+'/dbgg/main';
- }
- /**
- * 记录查看处理
- */
- grsw.gggl.main.doView = function(id) {
- window.location=$.ctx + '/dbgg/view?flag=1&rflag=3&id='+id+'&backurl='+$.ctx+'/dbgg/main';
- }
- /**
- * 记录置顶处理
- */
- grsw.gggl.main.doTop = function() {
- var ids = grsw.gggl.main.getSelectedRecords();
- var id = $("#"+ids).val();
- var status = $("#"+ids).next().next().next().next().val();
- var istop = $("#"+ids).next().next().next().next().next().val();
- //alert("id:"+id+";istop:"+istop+";status:"+status);
- if (ids.length == 1) {
- if("完成"!=status){
- $.messager.alert("提示", "流程未结束不可置顶!");
- return false;
- }else if("1"==istop){
- $.messager.alert("提示", "该公告已被置顶!");
- return false;
- }else{
- $.post($.ctx + "/ybgg/top", {
- ids : id
- }, function(data, status) {
- if (data.success) {
- location.href=$.ctx+"/ybgg/main";
- }
- else {
- $.messager.showError(data.message);
- }
- }, "json");
- }
- }else if(ids.length<=0){
- $.messager.alert("提示", "请选择要置顶的记录!");
- }else{
- $.messager.alert("提示", "只能选择一条要置顶的记录!");
- }
- }
- /** 删除处理 */
- grsw.gggl.main.doDel = function() {
- var ids = grsw.gggl.main.getSelectedRecords();
- if (ids.length > 0) {
- $.messager.confirm("确认", "确定要删除吗?", function(msg) {
- if (msg) {
- // 确认删除
- $.post($.ctx + "/dbgg/delete", {
- ids : ids.join(",")
- }, function(data, status) {
- if (data.success) {
- location.href=$.ctx+"/dbgg/main";
- }
- else {
- $.messager.showError(data.message);
- }
- }, "json");
- }
- ;
- });
- }
- else {
- $.messager.alert("提示", "请选择记录!");
- }
- }
- /**
- * 全选/全不选
- */
- grsw.gggl.main.all = function(){
- if($("#all").prop("checked")){
- $(".gggl_table_checkbox").each(function(){
- $(this).prop("checked",true);
- });
- }else{
- $(".gggl_table_checkbox").each(function(){
- $(this).prop("checked",false);
- });
- }
- }
- /**
- * 获取选中的数据
- * 返回选中数据的id数组
- */
- grsw.gggl.main.getSelectedRecords = function(){
- var ids = new Array();
- $(".gggl_table_checkbox").each(function(){
- if($(this).prop("checked")){
- ids.push($(this).val());
- }
- });
- return ids;
- }
- grsw.gggl.main.query=function(sortname,order){
- $("#ggglform").submit();
- }
- grsw.gggl.main.doShow = function(a,backurl) {
- window.location=$.ctx + '/dbgg/view?id='+a+'&backurl='+backurl;
- }
- grsw.gggl.main.showWin = function(id){
- $dialog = grsw.gggl.main.$popWin.dialog({
- href : $.ctx + '/wf/task/hisWf?id='+id,
- title : "历史流程",
- width : 800,
- height :400,
- top:$(document).scrollTop() + ($(window).height()-400) * 0.5,
- left:$(document).scrollLeft() + ($(window).width()-600) * 0.5,
- onClose : function() {
- $dialog.dialog('destroy');
- },
- buttons : [ {
- text : '关闭',
- iconCls : 'icon-cancel',
- handler : function() {
-
- $dialog.dialog('close');
- }
- } ]
- });
- $dialog.dialog('open');
- }
- /**
- * 判断是否为空
- * @param str
- * @returns {Boolean}
- */
- function isEmpty(str){
- if(str!=null&&str!=""&&str.length!=0){
- return false;
- }else{
- return true;
- }
- }
- $(document).ready(function() {
- $("#sendgg").click(function(){
- var ids = grsw.gggl.main.getSelectedRecords();
- if (ids.length == 1) {
- var id = $("#"+ids).val();
- var ggr = $("#"+ids).next().val();
- var ggrname = $("#"+ids).next().next().val();
- var sendStatus = $("#"+ids).next().next().next().val();
- var status = $("#"+ids).next().next().next().next().val();
- //alert("ggr:"+ggr+";ggrname:"+ggrname+";id:"+id+";sendStatus:"+sendStatus+";status:"+status);
-
- if("完成"!=status){
- $.messager.alert("提示", "流程未结束不可发布!");
- return false;
- }
- if("1"==sendStatus){
- $.messager.confirm("确认", "确定要重新发布该公告吗?", function(msg) {
- if (msg) {
- $('#userto').tree({
- url : '/gkoa/fyj/showUserTree',
- onExpand: function (node) {
- var ggrs = new Array();
- ggrs = ggr.split(",");
- for(var i=0;i<ggrs.length;i++){
- var ggrnode = $('#userto').tree('find', ggrs[i]);
- $('#userto').tree('check',ggrnode.target);
- }
- }
- });
-
- $("#dialogDiv").show();
- $("#dialogDiv").dialog({
- hide:true,
- autoOpen:false,
- title : "发布公告",
- width : 450,
- height : 380,
- modal:true,
- overlay: {opacity: 0.5, background: "black" ,overflow:'auto'},
- onLoad : function() {
- },
- onClose : function() {
- },
- buttons : [ {
- text : '确定',
- iconCls : 'icon-xt-ok',
- handler : function() {
- var usertos = $("#userto").tree('getChecked');
- var userto = "";
- for(var i=0;i<usertos.length;i++){
- userto+=usertos[i].id+",";
- }
- userto = userto.substring(0,userto.length-1);
- if(isEmpty(userto)){
- $.messager.alert("提示", "请选择发布范围!");
- return false;
- }else{
- var mes = "";
- if(sendStatus==1){
- mes="确定要重新发布该公告吗?";
- }else{
- mes="确定要发布该公告吗?";
- }
- $.messager.confirm("确认", mes, function(msg) {
- if (msg) {
- //确认修改
- $.post($.ctx + "/ybgg/send?userto="+userto, {
- id : id
- }, function(data, status) {
- if (data.success) {
- $("#dialogDiv").dialog('close');
- $.messager.alert("提示", "发布成功!");
- window.location.href=window.location.href;
- } else {
- $.messager.alert("发布失败", data.message);
- }
- }, "json");
- }
- });
- }
- }
-
- }, {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function() {
- $("#dialogDiv").dialog('close');
- $("#dialogDiv").hide();
- }
- }]
- });
- }else{
- return false;
- }
- });
- }else{
-
- $("#dialogDiv").show();
- $("#dialogDiv").dialog({
- hide:true,
- autoOpen:false,
- title : "发布公告",
- width : 450,
- height : 380,
- modal:true,
- overlay: {opacity: 0.5, background: "black" ,overflow:'auto'},
- onLoad : function() {
- },
- onClose : function() {
- },
- buttons : [ {
- text : '确定',
- iconCls : 'icon-xt-ok',
- handler : function() {
- var usertos = $("#userto").tree('getChecked');
- var userto = "";
- for(var i=0;i<usertos.length;i++){
- userto+=usertos[i].id+",";
- }
- userto = userto.substring(0,userto.length-1);
- if(isEmpty(userto)){
- $.messager.alert("提示", "请选择发布范围!");
- return false;
- }else{
- var mes = "";
- if(sendStatus==1){
- mes="确定要重新发布该公告吗?";
- }else{
- mes="确定要发布该公告吗?";
- }
- $.messager.confirm("确认", mes, function(msg) {
- if (msg) {
- //确认修改
- $.post($.ctx + "/ybgg/send?userto="+userto, {
- id : id
- }, function(data, status) {
- if (data.success) {
- $("#dialogDiv").dialog('close');
- $.messager.alert("提示", "发布成功!");
- window.location.href=window.location.href;
- } else {
- $.messager.alert("发布失败", data.message);
- }
- }, "json");
- }
- });
- }
- }
-
- }, {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function() {
- $("#dialogDiv").dialog('close');
- $("#dialogDiv").hide();
- }
- } ]
- });
- }
-
-
- } else if(ids.length<1) {
- $.messager.alert("提示", "请选择要发布的记录!");
- }else{
- $.messager.alert("提示", "只能选择一条记录发布!");
- }
- });
- });
|