| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792 |
- function checkForm() {
- var rs = true;
-
- var reqOffice = $("#reqOffice").val();
- // 查询当前环节附件
- var tache_files = $(".tache_file");
- if(reqOffice == "1" && tache_files.length == 0){
- rs = $.validate({
- name : "file_fileId",
- model : [ {
- type : "require",
- msg : "请上传附件!"
- }]
- }) && rs;
- }
- var pathJudgeType = $("#pathJudgeType").val();
- if (pathJudgeType == "1") {
- rs = $.validate({
- name : "nextTmodelId",
- model : [ {
- type : "require",
- msg : "下一步环节不能为空!"
- } ]
- });
- }
- var usersNames = $("[type='text'][id*='usersName']:visible");
- for ( var i = 0; i < usersNames.length; i++) {
- rs = $.validate({
- name : usersNames[i].id,
- model : [ {
- type : "require",
- msg : "下一步环节操作人不能为空!"
- } ]
- }) && rs;
- }
- if (rs) {
- return true;
- }
- return false;
- }
- function checkCode(){
- var handleValidate = $("#handleValidate").val();
- if(handleValidate=='0'){
- formJs();
- return;
- }
- var validateCode = $("#validateCode").val();
- if(validateCode == null || validateCode==''){
- $("#errorTip").show();
- return;
- }
-
- $.ajax({
- url : "FlowAction.do",
- async : false,
- type : "post",
- data : {
- "task" : "checkCode",
- "insId" : $("#insId").val(),
- "tinsId" : $("#tinsId").val(),
- "user" : $("#userid").val(),
- "code" : $("#validateCode").val()
- },
- success : function(data) {
- //alert(data);
- if (data=="true") {
- $("#errorTip").hide();
- formJs();
- } else {
- $("#errorTip").show();
- }
- },
- error : function() {
- addError("数据处理失败,请检查网络重新登录或联系管理员!");
- }
- });
- }
- function formJs() {
- if (formId == "0") {
- var rs = checkForm();
- $("#formInsId").val("0");
- if (rs) {
- //$('.bsubmit').attr("disabled", "disabled");
- preProcess("FlowAction.do", "#insForm");
- }
- } else {
- var rs = true;
- rs = checkForm() && rs;
- if (rs) {
- var hasGen = $(window.frames["formIns"].document).find(
- "#hasGen").val();
- //$('.bsubmit').attr("disabled", "disabled");
- if(document.frames == undefined){
- window.frames["formIns"].replaceTextarea();
- } else {
- document.frames.formIns.replaceTextarea();
- }
- if (hasGen == 0) {
- $(window.frames["formIns"].document).find("#formIns").attr("action","bpmFormInstanceAction.do?task=updateIns");
- $(window.frames["formIns"].document).find("#formIns").submit();
- } else {
- if(document.frames == undefined){
- window.frames["formIns"].save();
- } else {
- document.frames.formIns.save();
- }
- }
- }
- }
- }
- /**
- * 修改流程标题
- */
- function changeInsName() {
- $("#insNameText").show();
- $("#insNameEnter").show();
- $("#insNameEdit").hide();
- $("#insNameFont").hide();
- }
- /**
- * 确认标题修改
- */
- function confirmInsName() {
- if($.trim($("#insNameText").val()) == ''){
- addError("流程标题不能为空!");
- return;
- }
- if($.trim($("#insNameText").val()).length >100){
- addError("流程标题不能超过100个字!");
- return;
- }
- $("#insNameText").hide();
- $("#insNameEnter").hide();
- $("#insNameEdit").show();
- $("#insNameFont").show();
- $("#insNameFont").text($("#insNameText").val());
- $("#insName").val($("#insNameText").val());
- }
- function returnJs(buttonName){
- if(!confirm("确认" + buttonName + "该流程?")){
- return;
- }
- $('#task').val('return');
- /*if(formId == "0"){
- var rs = true;
- $("#formInsId").val("0");
- if(rs){
- $('.bsubmit').attr("disabled", "disabled");
- saveFlow("FlowAction.do", "#insForm");
- }
- } else {
- var rs = true;
- rs = document.frames.formIns.checkForm();
- //rs = checkForm() && rs;
- if(rs){
- var hasGen = $(window.frames["formIns"].document).find("#hasGen").val();
- $('.bsubmit').attr("disabled", "disabled");
- if(hasGen == 0){
- $(window.frames["formIns"].document).find("#formIns").submit();
- } else {
- document.frames.formIns.save();
- }
- }
- }*/
- var rs = true;
- if(formId == "0"){
- $("#formInsId").val("0");
- }
- if(rs){
- //$('.bsubmit').attr("disabled", "disabled");
- var x = $("#insForm").serializeArray();
- $.each(x, function(i, field) {
- field.value = encodeURI(field.value);
- });
- $.ajax({
- url : "FlowAction.do",
- async : true,
- type : "post",
- data : x,
- success : function(data) {
- //addInfo(data);
- //location="MTFlowAction.do?task=toDealList";
- yrConfirm(data+"是否继续办理下一个流程?",nextdeal);
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- },
- beforeSend : function() {
- }
- });
- }
- }
- function returnToSenderJs(){
- if(!confirm("确认退回至发起人?")){
- return;
- }
- $('#task').val('returnToSender');
-
- var rs = true;
- if(formId == "0"){
- $("#formInsId").val("0");
- }
- if(rs){
- //$('.bsubmit').attr("disabled", "disabled");
- var x = $("#insForm").serializeArray();
- $.each(x, function(i, field) {
- field.value = encodeURI(field.value);
- });
- $.ajax({
- url : "FlowAction.do",
- async : true,
- type : "post",
- data : x,
- success : function(data) {
- //addInfo(data);
- //location="MTFlowAction.do?task=toDealList";
- yrConfirm(data+"是否继续办理下一个流程?",nextdeal);
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- },
- beforeSend : function() {
- }
- });
- }
- }
- var officeDialog = null;
- var nextTacheDialog = null;
- var assistDialog = null;
- function ow(owurl, name) {
- officeDialog = $.ligerDialog.open({
- height : 700,
- width : 1000,
- url : owurl,
- showMax : false,
- showToggle : false,
- showMin : false,
- isResize : false,
- modal : true,
- title : name,
- allowClose : false
- });
- }
- function closeOfficeDialog() {
- officeDialog.close();
- }
- function openOffice() {
- var officeId = $("#officeId").val();
- ow('${pageContext.request.contextPath}/NtkoAction.do?task=edit&fileId='
- + officeId, 'web文档');
- }
- function setValue(fileId, fileName) {
- $("#officeId").val(fileId);
- $("#officeName").val(fileName);
- }
- /**
- * 点击"提交"展示"选择下一环节信息"
- */
- function chooseNextTache(buttonName) {
- if(!confirm("确认" + buttonName + "该流程?")){
- return;
- }
- var rs = true;
- var reqRemark = $("#reqRemark").val();
- if (reqRemark == "1") {
- rs = $.validate({
- name : "remark",
- model : [ {
- type : "require",
- msg : "流程内容不能为空!"
- },{
- type : "len",
- min : 0,
- max : 1000,
- msg : "流程内容长度不能超过1000个字!"
- } ]
- });
- }else{
- rs = $.validate({
- name : "remark",
- model : [ {
- type : "len",
- min : 0,
- max : 1000,
- msg : "流程内容长度不能超过1000个字!"
- } ]
- });
- }
- if (formId != "0") {
- if(document.frames == undefined){
- rs = window.frames["formIns"].checkForm() && rs;
- } else {
- rs = document.frames.formIns.checkForm() && rs;
- }
- }
- if (!rs) {
- return;
- }
- window.scrollTo(0,0);
- //nextTacheDialog.show();
- checkCode();
- }
- /**
- * 关闭"选择下一环节信息"对话框
- */
- function closeNextTache() {
- nextTacheDialog.hidden();
- }
- function closeNextTacheInfo() {
- nextTacheInfoDialog.hidden();
- }
- /**
- * 初始化"选择下一环节信息"对话框
- */
- $(function() {
- nextTacheInfoDialog = $.ligerDialog.open({
- width : 1000,
- target : $("#nextTacheInfo"),
- showMax : false,
- showToggle : false,
- showMin : false,
- show : false,
- isResize : false,
- modal : true,
- top: 260,
- title : "后续环节人员查看及选择",
- allowClose : true,
- containerId : 'insForm'
- });
- nextTacheInfoDialog.hidden();
- assistDialog = $.ligerDialog.open({
- width : 500,
- target : $("#assistDiv"),
- showMax : false,
- showToggle : false,
- showMin : false,
- show : false,
- isResize : false,
- modal : true,
- title : "选择协办人员",
- allowClose : true,
- containerId : 'insForm'
- });
- assistDialog.hidden();
- });
- function preProcess(actionUrl, formName) {
- $("#task").val("preProcess");
- var x = $(formName).serializeArray();
- $.each(x, function(i, field) {
- field.value = encodeURI(field.value);
- });
- $.ajax({
- url : actionUrl,
- async : true,
- type : "post",
- data : x,
- dataType : "json",
- success : function(data) {
- //addInfo(data);
- //closeSelf();
- var resultState = data[0].resultState;
- var submitState = data[0].submitState;
- var resultInfo = data[0].resultInfo;
- if(!submitState){
- $("#sbmbtn").hide();
- $("#clsbtn").show();
- } else {
- $("#sbmbtn").show();
- $("#clsbtn").hide();
- }
- document.body.scrollIntoView();//滚动到页面顶部
- if(resultState){
- var table= $("#nextTacheInfoTd");
- table.html("");
- var nextTacheInstances = data[0].nextTacheInstances;
- for(var i = 0 ; i < nextTacheInstances.length; i++){
- var users = nextTacheInstances[i].users;
- var info = nextTacheInstances[i].info;
- var isCheck = nextTacheInstances[i].isCheck;
- var tacheModel = nextTacheInstances[i].tacheModel;
- var html = "<tr><td>";
- html += "<input type='hidden' id='tmodelId_" +
- tacheModel.tmodelId + "' name='tmodelId_" +
- tacheModel.tmodelId + "' value='" + tacheModel.tmodelId + "'>";
- html += tacheModel.tmodelName;
- html += "</td><td>";
- if(isCheck){
- html += "<input type='hidden' id='isCheck_" + tacheModel.tmodelId
- + "' name='isCheck_" + tacheModel.tmodelId + "' value='1'>";
- } else {
- html += "<input type='hidden' id='isCheck_" + tacheModel.tmodelId
- + "' name='isCheck_" + tacheModel.tmodelId + "' value='0'>";
- }
- if(info != "" && info != null && info != undefined){
- html += "<span style='color:red'>" + info + "</span>";
- } else {
- var lzCount = 0;
- for(var j = 0 ; j < users.length; j++){
- var userState = users[j].state;
- if(userState == "1"){
- html += "<input type='checkbox' id='tmodel_" +
- tacheModel.tmodelId + "' name='tmodel_" + tacheModel.tmodelId +
- "' value='" + users[j].id + "' checked='checked'>";
- html += users[j].userId.username;
- } else {
- lzCount ++;
- }
- // else {
- // html += "<input type='checkbox' id='tmodel_" +
- // tacheModel.tmodelId + "' name='tmodel_" + tacheModel.tmodelId +
- // "' value='" + users[j].id + "' readonly='readonly'>";
- // html += users[j].userId.username;
- // html += "(该用户已离职) ";
- // }
- }
- if(users.length == lzCount){
- html += "<span style='color:red'>下一环节操作人无人在职!</span>";
- }
- }
- html += "</td></tr>";
- table.append(html);
- }
- } else {
- var table= $("#nextTacheInfoTd");
- table.html("");
- var html = "<td style='text-align: center;' colspan='2'>";
- html += "<span style='color: red;'>" + resultInfo + "</span>";
- html += "</td>";
- table.append(html);
- }
- $("#validateTip").hide();
- nextTacheInfoDialog.show();
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- //$("button").removeAttr("disabled");
- },
- beforeSend : function() {
- //$("button").attr("disabled", "disabled");
- }
- });
- }
- function saveFlow() {
- $("#sbmbtn").attr("disabled", "disabled");
- $("#task").val("process");
- var x = $("#insForm").serializeArray();
- $.each(x, function(i, field) {
- field.value = encodeURI(field.value);
- });
- var tmodelIds = $("[name*='tmodelId_']");
- for(var i = 0; i < tmodelIds.length; i++){
- var isCheck = $("#isCheck_" + tmodelIds[i].value).val();
- if(isCheck == '1'){
- var bool = false;
- $("input[name='tmodel_" + tmodelIds[i].value + "']").each(function(){
- if(this.checked){
- bool = true;
- }
- });
- if(!bool){
- $("#validateTip").show();
- $("#sbmbtn").removeAttr("disabled");
- return false;
- }
- }
- }
- var result1 = false;
- $.ajax({
- url : "FlowAction.do",
- async : false,
- type : "post",
- data : x,
- dataType : 'json',
- success : function(data) {
- var resultState = data[0].resultState;
- var resultInfo = data[0].resultInfo;
- if(resultState){
- //addInfo("流程办理成功!");
- // var oldTabid = $("#tabid").val();
- // window.parent.f_reloadTab(oldTabid);
- // window.parent.frames[oldTabid].closeODialog($("#dialogId").val());
- result1 = true;
- //location="MTFlowAction.do?task=toDealList";
- } else {
- addError(resultInfo);
- }
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- $("button").removeAttr("disabled");
- },
- beforeSend : function() {
- //$("button").attr("disabled", "disabled");
- }
- });
- if(!result1){
- $("#sbmbtn").removeAttr("disabled");
- }else{
- yrConfirm("流程办理成功,是否继续办理下一个流程?",nextdeal);
- }
- }
- function nextdeal(r){
- if(r==true){
- $.ajax({
- url : "FlowAction.do",
- async : false,
- type : "post",
- data : {
- "task" : "dealList",
- "p" : "0",
- "pSize" : "1"
- },
- /*dataType : 'json',*/
- success : function(data) {
- var jsondata = eval('(' + data + ')');
- var Total = jsondata.Total;
- if(Total == 0){
- addInfo("没有剩余的待办流程!");
- location="MTFlowAction.do?task=toDealList";
- }else{
- var Rows = jsondata.Rows;
- var tinsId = Rows[0].tinsId;
- var control = Rows[0].modelId.control.value;
- if (control == "1") {
- item("MTFlowAction.do?task=toProcess&tinsId="+tinsId);
- }else{
- item("MTFlowAction.do?task=toCustomProcess&tinsId="+tinsId);
- }
- }
- //closeSelf();
- },
- error : function(data,err) {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- },
- beforeSend : function() {
- }
- });
- }else{
- location="MTFlowAction.do?task=toDealList";
- }
- }
- //表单暂存
- function tempformJs() {
- if(document.frames == undefined){
- window.frames["formIns"].replaceTextarea();
- } else {
- document.frames.formIns.replaceTextarea();
- }
- $(window.frames["formIns"].document).find("#formIns").attr("action","bpmFormInstanceAction.do?task=tempInsForUpdate");
- $(window.frames["formIns"].document).find("#formIns").submit();
- nextTacheInfoDialog.hidden();
- }
- function sendAssist(){
- var rs = false;
- rs = $.validate({
- name : "taskContent",
- model : [ {
- type : "require",
- msg : "内容不为空!"
- } ]
- });
- rs = $.validate({
- name : "assistUsernames",
- model : [ {
- type : "require",
- msg : "对象不为空!"
- } ]
- }) && rs;
- if(!rs){
- return;
- }
- $.ajax({
- url : "bpmTaskAction.do",
- async : true,
- type : "post",
- data : {
- "task" : "createAssist",
- "users" : $("#assistUsers").val(),
- "insId" : $("#insId").val(),
- "tinsId" : $("#tinsId").val(),
- "taskContent" : encodeURI($("#taskContent").val())
- },
- //dataType : 'json',
- success : function(data) {
- if(data == "true"){
- assistDialog.hidden();
- $("#assistUsernames").val("");
- $("#taskContent").val("");
- $("#assistUsers").val("");
- addInfo("派发成功!");
- } else {
- assistDialog.hidden();
- addInfo("派发失败!");
- }
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- },
- beforeSend : function() {
- }
- });
- }
- function sendCode1() {
- $("#errorTip").hide();
- $.ajax({
- url : "FlowAction.do",
- async : false,
- type : "post",
- data : {
- "task" : "sendCode",
- "insId" : $("#insId").val(),
- "tinsId" : $("#tinsId").val(),
- "user" : $("#userid").val()
- },
- success : function(data) {
- //alert(data);
- if (data) {
- $("#sendCode").hide();
- $("#resendCode").hide();
- $("#resendTip").show();
- setTimeout(function() {
- $("#resendTip").hide();
- $("#resendCode").show();
- }, '60000');
- }
- },
- error : function() {
- addError("数据处理失败,请检查网络重新登录或联系管理员!");
- }
- });
- }
- function sendCode2() {
- $("#errorTip").hide();
- //alert(1);
- $.ajax({
- url : "FlowAction.do",
- async : false,
- type : "post",
- data : {
- "task" : "resendCode",
- "insId" : $("#insId").val(),
- "tinsId" : $("#tinsId").val(),
- "user" : $("#userid").val()
- },
- success : function(data) {
- //alert(data);
- if (data) {
- $("#sendCode").hide();
- $("#resendCode").hide();
- $("#resendTip").show();
- setTimeout(function() {
- $("#resendTip").hide();
- $("#resendCode").show();
- }, '60000');
- }
- },
- error : function() {
- addError("数据处理失败,请检查网络重新登录或联系管理员!");
- }
- });
- }
- function delFile(ifileId){
- if(confirm("是否确定删除该附件?")){
- $.ajax({
- url : "FlowAction.do",
- async : true,
- type : "post",
- data : {
- "task" : "delFile",
- "ifileId" : ifileId
- },
- success : function(data) {
- if (data == "10010") {
- addError("删除附件失败!");
- } else if (data == "10011") {
- addInfo("删除附件成功!");
- var datestr = formatDate(new Date());
- var tr = $("#"+ifileId).clone();
- $("#"+ifileId).html("");
- $("#"+ifileId).remove();
- tr.find("#"+ifileId+"_filespan").removeAttr("id");
- tr.find("#"+ifileId+"_span").html("<font color=\"red\">(已删除,删除时间:"+datestr+")</font> ");
- tr.find("#"+ifileId+"_tache").removeClass("tache_file");
- $("#delfiletable").append(tr);
- var delLink = $("#delLink").html();
- if(!delLink){
- $("#delLink").html("(<a id=\"ahide\" href=\"#\" onclick=\"delfileshownhide();\">查看已删除附件</a>)");
- }
- } else {
- addError(data);
- }
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- }
- });
- }
- }
- function delfileshownhide(){
- var delfiles = $('#delfiles').css('display');
- if(delfiles == "none"){
- $("#delfiles").show();
- $("#ahide").html("隐藏已删除附件");
- }else if(delfiles == "block"){
- $("#delfiles").hide();
- $("#ahide").html("查看已删除附件");
- }
- }
- function show(targetId, self){
- $("#" + targetId).show();
- $(self).hide();
- $(self).next().show();
- }
- function hide(targetId, self){
- $("#" + targetId).hide();
- $(self).hide();
- $(self).prev().show();
- }
- function showTaskDetail(id){
- $("#showTaskDetail_" + id).toggle();
- $("#hideTaskDetail_" + id).toggle();
- $(".taskDetail_"+id).toggle();
- }
- function openimg(){
- //是否支持svg
- var bool = Raphael.svg;
- if(bool){
- //$.ligerDialog.open({width : 1000, height : 300, target: $("#flowimg2") });
- locking(2);
- }else{
- //$.ligerDialog.open({width : 1000, height : 300, target: $("#flowimg1") });
- locking(1);
- }
- }
- function delayTache(){
- if(!confirm("确认推迟办理该流程?")){
- return;
- }
- $('#task').val('delayTache');
-
- var rs = true;
- if(formId == "0"){
- $("#formInsId").val("0");
- }
- if(rs){
- var x = $("#insForm").serializeArray();
- $.each(x, function(i, field) {
- field.value = encodeURI(field.value);
- });
- $.ajax({
- url : "FlowAction.do",
- async : true,
- type : "post",
- data : x,
- success : function(data) {
- yrConfirm(data+"是否继续办理下一个流程?",nextdeal);
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- },
- beforeSend : function() {
- }
- });
- }
- }
|