123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- /**
- * 待办发文详细画面用js
- *
- * @author jiangt
- */
- $.namespace("fwgl.dbfw.detail");
- fwgl.dbfw.detail.$popWin = null;
- fwgl.dbfw.detail.$popWin2 = null;
- fwgl.dbfw.detail.$isng = null;
- fwgl.dbfw.detail.$isng = null;
- fwgl.dbfw.detail.$opflag = null;
- fwgl.dbfw.detail.$qm = null;
- /** 页面初始化 附件界面需要*/
- fwgl.dbfw.detail.init = function() {
- fwgl.dbfw.detail.initpage();
- }
- /** 页面初始化*/
- fwgl.dbfw.detail.initpage = function() {
- $("#pagetools button").click(function(){
- fwgl.dbfw.detail.doDel();
- });
- //把form传入,构造翻页控件
- pageinfo($("#fjform"));//见common.js
- }
- /**弹出选择节点界面*/
- fwgl.dbfw.detail.pop = function(flag) {
- var opinion= $("#opinion").val();
- if(!isEmpty(opinion)){
- opinion = opinion.replace(/&/g, "&");
- opinion = opinion.replace(/</g, "<");
- opinion = opinion.replace(/>/g, ">");
- opinion = opinion.replace(/"/g, "\"");
- opinion = opinion.replace(/'/g, "//");
- opinion = opinion.replace(///g, "\\\\");
- }
- if(flag=="th"){
- $.post($.ctx + "/wf/task/isEnd", {
- bussKey:$("#fwid").val()
- }, function(data, status) {
- if (data.success) {
- Xt.showChooseUserBackDialog({
- wfid : 'fw',
- taskId:$("#taskid").val(),
- flag:flag,
- callback : function(status, rows) {
- if (!status) { return; }
- $.post($.ctx + "/dbfw/back", {
- step:rows[0].step,
- usersStr:encodeURI(rows[0].users),
- id:$("#fwid").val(),
- yj:opinion,
- days:rows[0].days
- }, function(data, status) {
- if (data.success) {
- fwgl.dbfw.detail.$popWin.dialog('close');
- location.href=$.ctx+"/dbfw/main";
- } else {
- $.messager.alert("提示", data.message);
- }
- }, "json");
- }
- });
- } else {
- if(isEmpty(data.message)){
- location.href=$.ctx+"/dbfw/main";
- }else{
- $.messager.alert("提示", data.message, "info", function () {
- location.href=$.ctx+"/dbfw/main";
- });
- }
- }
- }, "json");
- }else{
- $.post($.ctx + "/dbfw/isLastStep", {
- wfid : 'fw',
- taskId:$("#taskid").val(),
- id:$("#fwid").val(),
- yj:opinion
- }, function(data, status) {
- if (data.success) {
- //var flag = data.attrs.flag;
- Xt.showChooseUserDialog({
- wfid : 'fw',
- taskId:$("#taskid").val(),
- flag:flag,
- id:$("#fwid").val(),
- callback : function(status, rows) {
- if (!status) { return; }
- $.post($.ctx + "/dbfw/submit", {
- step:rows[0].step,
- usersStr:encodeURI(rows[0].users),
- id:$("#fwid").val(),
- yj:opinion,
- days:rows[0].days
- }, function(data, status) {
- if (data.success) {
- fwgl.dbfw.detail.$popWin.dialog('close');
- location.href=$.ctx+"/dbfw/main";
- } else {
- $.messager.alert("提示", data.message);
- }
- }, "json");
- }
- });
- } else {
- if(isEmpty(data.message)){
- location.href=$.ctx+"/dbfw/main";
- }else{
- $.messager.alert("提示", data.message, "info", function () {
- location.href=$.ctx+"/dbfw/main";
- });
- }
-
- }
- }, "json");
- }
- }
- /**
- * 判断是否为空
- * @param str
- * @returns {Boolean}
- */
- function isEmpty(str){
- if(str!=null&&str!=""&&str.length!=0){
- return false;
- }else{
- return true;
- }
- }
- var isCommitted = false;//表单是否已经提交标识,默认为false
- /**
- * 保存
- */
- fwgl.dbfw.detail.save = function() {
- if(isEmpty($("#title").val())){
- $.messager.alert("提示", "公文标题不能为空");
- return false;
- }else if(isEmpty($("#zsdw").val())){
- $.messager.alert("提示", "主送不能为空");
- return false;
- }else if(isEmpty($("#fs").val())){
- $.messager.alert("提示", "份数不能为空");
- return false;
- }else if(!isEmpty($("#fs").val())&&isNaN(parseInt($("#fs").val()))){
- $.messager.alert("提示", "份数必须是数字");
- return false;
- }else if(isEmpty($("#mj").val())){
- $.messager.alert("提示", "密级不能为空");
- return false;
- }
- if(isCommitted==false){
- isCommitted = true;//提交表单后,将表单是否已经提交标识设置为true
- $("#fs").val(Number($("#fs").val())) ;
- $('#ngform').form('submit', {
- url : $.ctx + '/dbfw/save',
- onSubmit : function() {
-
- },
- success : function(data, status) {
- if (data) {
- data = $.parseJSON(data);
- }
- if (data.success) {
- location.href=$.ctx+"/dbfw/view?id="+data.attrs.eid+"&flag=2";
- }
- else {
- $.messager.showError(data.message);
- }
- }
- });
- return true;//返回true让表单正常提交
- }else{
- setTimeout(function() { isCommitted = false; }, 5000);
- return false;//返回false那么表单将不提交
- }
- }
- /**返回*/
- fwgl.dbfw.detail.back=function(){
- if(fwgl.dbfw.detail.$issy=="sy"){
- location.href=$.ctx+"/syfw/main";
- }else if(fwgl.dbfw.detail.$issy=="all"){
- location.href=$.ctx+"/all/main";
- }else{
- location.href=$.ctx+"/dbfw/main";
- }
- }
- /**
- * 上传
- */
- fwgl.dbfw.detail.upload = function() {
- $('#uploadform').form('submit', {
- url : $.ctx + '/accessory/upload',
- onSubmit : function() {
-
- },
- success : function(data, status) {
- if (data) {
- data = $.parseJSON(data);
- }
- if (data.success) {
- location.href=$.ctx+"/dbfw/fjmain?id="+data.attrs.eid+"&flag=2";
- }
- else {
- $.messager.alert("提示", "文件大小超过最大值20M");
- $("#file").val("");
- }
- }
- });
- }
- /**
- * 全选/全不选
- */
- fwgl.dbfw.detail.all = function(){
- if($("#all").prop("checked")){
- $(".fwgl_table_checkbox").each(function(){
- $(this).prop("checked",true);
- });
- }else{
- $(".fwgl_table_checkbox").each(function(){
- $(this).prop("checked",false);
- });
- }
- }
- /**
- * 获取选中的数据
- * 返回选中数据的id数组
- */
- fwgl.dbfw.detail.getSelectedRecords = function(){
- var ids = new Array();
- $(".fwgl_table_checkbox").each(function(){
- if($(this).prop("checked")){
- ids.push($(this).val());
- }
- });
- return ids;
- }
- /** 删除处理 */
- fwgl.dbfw.detail.doDel = function() {
- var ids = fwgl.dbfw.detail.getSelectedRecords();
- if (ids.length > 0) {
- $.messager.confirm("确认", "确定要删除吗?", function(msg) {
- if (msg) {
- // 确认删除
- $.post($.ctx + "/accessory/delete", {
- ids : ids.join(",")
- }, function(data, status) {
- if (data.success) {
- location.href=$.ctx+"/dbfw/fjmain?id="+$("#fwid").val()+"&flag=2";
- } else {
- $.messager.alert("提示", data.message);
- }
- }, "json");
- }
- ;
- });
- } else {
- $.messager.alert("提示", "请选择要删除的记录!");
- }
- }
- /**
- * 意见弹出框
- */
- fwgl.dbfw.detail.opWin=function(){
- if(fwgl.dbfw.detail.$opflag!=null){
- if(fwgl.dbfw.detail.$opflag=="拟稿"){
- $("#opflag").val("ngyj");
- }
- if(fwgl.dbfw.detail.$opflag=="部门核稿"){
- $("#opflag").val("bmhgyj");
- }
- if(fwgl.dbfw.detail.$opflag=="综合科核稿"){
- $("#opflag").val("pbyj");
- }
- if(fwgl.dbfw.detail.$opflag=="会签"){
- $("#opflag").val("hqyj");
- }
- if(fwgl.dbfw.detail.$opflag=="主要领导签发"||fwgl.dbfw.detail.$opflag=="签发"){
- $("#opflag").val("qfyj");
- }
- if(fwgl.dbfw.detail.$opflag=="清稿校对"){
- $("#opflag").val("jdyj");
- }
- if(fwgl.dbfw.detail.$opflag=="监印"){
- $("#opflag").val("dzgz");
- }
- if(fwgl.dbfw.detail.$opflag=="印制"){
- $("#opflag").val("dyyj");
- }
- if(fwgl.dbfw.detail.$opflag=="编号"){
- $("#opflag").val("bhyj");
- }
- if(fwgl.dbfw.detail.$opflag=="排版"){
- $("#opflag").val("pb");
- }
- if(fwgl.dbfw.detail.$opflag=="分管领导签发"||fwgl.dbfw.detail.$opflag=="分管领导审核"){
- $("#opflag").val("fgldyj");
- }
- if(fwgl.dbfw.detail.$opflag=="归档"){
- $("#opflag").val("gd");
- }
- }
- Xt.showGryjDialog({
- yj:$("#opinion").val(),
- callback : function(status) {
- if (!status) { return; }
- var flag = $("#opflag").val();
- var opinion = $('#opinion1').val();
- opinion = opinion.replace(/&/g, "&");
- opinion = opinion.replace(/</g, "<");
- opinion = opinion.replace(/>/g, ">");
- opinion = opinion.replace(/"/g, """);
- $("#opinion").val(opinion);
- var str = "<span style='color:blue;cursor: pointer;' onclick='fwgl.dbfw.detail.opWin()'>修改</span> "
- + "<span style='color:blue;cursor: pointer;' onclick='fwgl.dbfw.detail.delop()'>删除</span>";
- if(flag=="dzgz"){
- $('#dyyj').html("<div style = 'float:left;width:100%;text-align: left;'> " + opinion
- + "</div><div style = 'float:left;width:100%;text-align: right;'>"+fwgl.dbfw.detail.$qm
- + " </br>"+str
- + "</div>");
- }
- $('#'+flag).html("<div style = 'float:left;width:100%;text-align: left;'> " + opinion
- + "</div><div style = 'float:left;width:100%;text-align: right;'>"+fwgl.dbfw.detail.$qm
- + " </br>"+str
- + "</div>");
- }
- });
- }
- /**
- * 保存意见
- */
- /*fwgl.dbfw.detail.saveOp=function(){
- var opinion = $('#opinion').val();
- if(opinion&&opinion.length>20){
- $.messager.alert("提示", "意见请小于20字。");
- }else{
- $('#op').hide();
- $('#bg').hide();
- $('body').css('overflow', 'auto');
- var flag = $("#opflag").val();
- var str = "<span style='color:blue;cursor: pointer;' onclick='fwgl.dbfw.detail.opWin()'>修改</span> "+
- "<span style='color:blue;cursor: pointer;' onclick='fwgl.dbfw.detail.delop()'>删除</span>";
- $('#'+flag).html("<div style = 'float:left;width:100%;text-align: left;'>"+opinion+"</div><div style = 'float:left;width:100%;text-align: right;'>"+fwgl.dbfw.detail.$qm+"</br>"+str+"</div>");
- }
- }*/
- fwgl.dbfw.detail.delop=function(){
- var flag = $("#opflag").val();
- $('#'+flag).html("");
- $('#opinion').val("");
- }
- /**
- * 保存意见
- */
- /*fwgl.dbfw.detail.selOp=function(data){
- $('#opinion').val("");
- $('#opinion').val(data);
- }
- fwgl.dbfw.detail.closeOp=function(data){
- $('#op').hide();
- $('#bg').hide();
- $('body').css('overflow', 'auto');
- }*/
- fwgl.dbfw.detail.closeMb=function(){
- $('#mb').hide();
- }
- /**
- * 模板弹出框
- */
- fwgl.dbfw.detail.zw=function(data){
-
- $.post($.ctx + "/dbfw/iszwexist", {
- id : data,
- }, function(data, status) {
- if (data.success) {
- if("拟稿"==$("#stepname").val()){
- $.messager.confirm("确认", "是否重新选择发文模板?", function(msg) {
- if (msg) {
- $('#mb').show();
- }else{
- //alert("data.attrs.ismark:"+data.attrs.ismark);
- if(data.attrs.ismark=='1'){
- window.open($.ctx + '/static/iWebOffice/DocumentEdit.jsp?FileName='
- + data.attrs.filename+"&FileType="+data.attrs.suc+"&EditType=2&FileID="+data.attrs.fid
- + "&iszw=1&zwtitle="+data.attrs.title+"©to="+data.attrs.copyto
- + "&zwbh="+data.attrs.bh+"&zsdw="+data.attrs.zsdw+"&username="+data.attrs.username);
- }else{
- window.open($.ctx + '/static/iWebOffice/DocumentEdit.jsp?FileName='
- + data.attrs.filename+"&FileType="+data.attrs.suc+"&EditType=3&FileID="+data.attrs.fid
- + "&iszw=1&zwtitle="+data.attrs.title+"©to="+data.attrs.copyto
- + "&zwbh="+data.attrs.bh+"&zsdw="+data.attrs.zsdw+"&username="+data.attrs.username);
- }
- }
-
- });
- }else{
- if(data.attrs.ismark=='1'){
- window.open($.ctx + '/static/iWebOffice/DocumentEdit.jsp?FileName='
- + data.attrs.filename+"&FileType="+data.attrs.suc+"&EditType=2&FileID="+data.attrs.fid
- + "&iszw=1&zwtitle="+data.attrs.title+"©to="+data.attrs.copyto
- + "&zwbh="+data.attrs.bh+"&zsdw="+data.attrs.zsdw+"&username="+data.attrs.username);
- }else{
- window.open($.ctx + '/static/iWebOffice/DocumentEdit.jsp?FileName='
- + data.attrs.filename+"&FileType="+data.attrs.suc+"&EditType=3&FileID="+data.attrs.fid
- + "&iszw=1&zwtitle="+data.attrs.title+"©to="+data.attrs.copyto
- + "&zwbh="+data.attrs.bh+"&zsdw="+data.attrs.zsdw+"&username="+data.attrs.username);
- }
- }
- } else {
- $('#mb').show();
- }
- }, "json");
- }
- /**
- * 模板选择事件
- */
- fwgl.dbfw.detail.choosezw=function(data,tag){
- $.post($.ctx + "/dbfw/zw", {
- id : data,
- tag:tag
- }, function(data, status) {
- if (data.success) {
- $('#mb').hide();
- window.open($.ctx + '/static/iWebOffice/DocumentEdit.jsp?FileName='
- + data.attrs.filename+"&FileType="+data.attrs.suc+"&EditType=3&FileID="+data.attrs.fid
- + "&iszw=1&zwtitle="+data.attrs.title+"©to="+data.attrs.copyto+"&zwbh="+data.attrs.bh+"&zsdw="+data.attrs.zsdw);
- } else {
- $.messager.alert("提示", data.message);
- }
- }, "json");
- }
- /**
- * 下载
- */
- fwgl.dbfw.detail.download=function(id,name,suffix){
- if(suffix=="doc"||suffix=="docx"||suffix=="DOC"||suffix=="DOCX"){
- window.open($.ctx + '/static/iWebOffice/DocumentEdit.jsp?FileName='+name+"&FileType="+suffix+"&EditType=1&FileID="+id);
- }else if(suffix=="pdf"||suffix=="PDF"){
- $.post($.ctx + "/accessory/viewpdf", {
- id : id,
- }, function(data, status) {
- if (data.success) {
- window.open($.ctx + "/static/temppdf/viewpdf.jsp?filename="+data.attrs.filename+"&width="+(window.screen.width-30)+"&height="+(window.screen.height-65),"newwindow", "height="+window.screen.height+", width="+window.screen.width+", top=0,left=0,toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, status=no");
- } else {
- location.href=$.ctx+"/accessory/download?id="+id;
- }
- }, "json");
- }else{
- location.href=$.ctx+"/accessory/download?id="+id;
- }
- }
- /**
- * 选择单位
- */
- fwgl.dbfw.detail.dw=function(dw){
- fwgl.dbfw.detail.dwchoose({
- callback : function(status, rows) {
- if (!status) { return; }
- var str = $('#'+dw).val();
- $.each(rows,function(n,value){
- if(str!=""){
- if(str.indexOf(value)!=-1){
-
- }else{
- str+=","+value;
- }
- }else{
- str+=value;
- }
- });
- $('#'+dw).val(str);
- }
- });
- }
- /***
- * 弹出单位选择框
- */
- fwgl.dbfw.detail.dwchoose=function(config){
- config = config || {};
- $dialog = fwgl.dbfw.detail.$popWin2.dialog({
- href : $.ctx + '/dbfw/dw',
- title : "选择单位",
- width : 400,
- height : 250,
- onClose : function() {
- $dialog.dialog('destroy');
- },
- buttons : [ {
- text : '完成',
- iconCls : 'icon-xt-ok',
- handler : function() {
- var rows =[];
- $("#stepTable2 tr").each(function(trindex,tritem){
- var checked = $(tritem).find("input[type='checkbox']:checked");
- if(checked.length>0){
- var row =$(tritem).find("input[type='checkbox']:checked").val();
- rows.push(row);
- }
- });
- if (config.callback && typeof config.callback == 'function') {
- config.callback(true,rows);
- }
- $dialog.dialog('close');
- }
- }, {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function() {
- if (config.callback && typeof config.callback == 'function') {
- config.callback(false);
- }
- $dialog.dialog('close');
- }
- } ]
- });
- $dialog.dialog('open');
- }
- /**
- * 打印
- */
- fwgl.dbfw.detail.print=function(id){
- // alert("w");
- var newwin=window.open($.ctx+"/dbfw/print?id="+id,"","top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+(window.screen.availWidth-10)+",height="+(window.screen.availHeight-30));//修改宽度和高度可控制窗口的大小
- newwin.focus();
- }
- /**
- * 打印
- fwgl.dbfw.detail.printUp=function(){
- bdhtml=window.document.body.innerHTML;//获取当前页的html代码
- sprnstr="<!--startprint-->";//设置打印开始区域
- eprnstr="<!--endprint-->";//设置打印结束区域
- prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html
- prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
- window.document.body.innerHTML=prnhtml;
- window.print();
- window.document.body.innerHTML=bdhtml;
- // $("div#print").printArea();
- }
- */
- fwgl.dbfw.detail.gd = function(id) {
- $.post($.ctx + "/dbfw/gd", {
- businesskey : id
- }, function(data, status) {
- if (data.success) {
- $.messager.alert("提示", "success");
- } else {
- $.messager.alert("提示", data.message);
- }
- }, "json");
- }
|