泛微E8升级E9代码修改

      E8升级E9需要修改后台二次开发的代码,总工程量还挺大的。 接下来上代码

E8编程代码如下 wf.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.*,java.util.*" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.TimeUtil" %>
<%@ page import="weaver.hrm.*" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />

<%
    int requestid = Util.getIntValue(request.getParameter("requestid"));
    String reqID = request.getParameter("reqID");
    String devID = request.getParameter("devID");
    String devNO = Util.null2String(request.getParameter("devNO"));
    int filetype = Util.getIntValue(request.getParameter("filetype"));
    String filetypetext = Util.null2String(request.getParameter("filetypetext"));
%>


<script type="text/javascript">

    $(function(){
        // 初始化页面栏位只读
        initPageStyle();
        // CR01跳转进入时自动加载
        autoSetFromCr01();
        // 明细初始化
        initRowsListener();
        addRowListener();
        // 单据提交根据是否管控判断相应完成百分比不能为空。
        checkCustomize = function(){
            var nodeid = $("input[name='nodeid']").val();
            // 申请节点
            if(nodeid == 12797){
                var pgrcontrol = $("#field127083").val();
                var finishpercent = $("#field127084").val();
                if(pgrcontrol == "0"){
                    if(finishpercent == ""){
                        Dialog.alert("进度管控为是,完成百分比必填!");
                        return false;
                    }
                }
            }
            return true;
        }
    });

    // 由CR05新增进入时,自动加载开发建议单及附件类别
    function autoSetFromCr01(){
        var nodeid = $("input[name='nodeid']").val();
        var reqID = '<%=reqID %>'
        var devID = <%=devID %>
        if(nodeid == 12797 && devID != null){
            // 申请节点根据请求ID获取单据信息
            // Dialog.alert("当前页面是由CR05跳转进入.系统自动加载开发建议单以及附件类别!");

            // 开发建议单
            $("#field127556").val(<%=devID%>);
            $("#field27556span").html(<%=devNO%>);
            var counter = 0;
            setInterval(function(){
                if(counter < 1){
                    // 附件类别
                    $("#field27078").val(<%=filetype%>);
                    $("#field27078span").html(<%=filetypetext%>);
                    counter = counter + 1;
                }
            },500);

            if(reqID != null){
                setInterval(function(){
                    if(counter < 2){
                        // 加载委托测试申请列表
                        var reportList = getReportListByRequestID(reqID);
                        loadReportList(reportList);
                        counter = counter + 1;
                    }
                },1000);
            }
        }
    }
    
    // 根据请求编号获取历史委托测试申请记录
    function getReportListByRequestID(reqID){
        var reportList = "";
        $.ajax({
            url : "/CODE/workflow/ajax_4521_getReportListByRequestID.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"reqID="+reqID,
            dataType : "json",
            success: function(msg){
                reportList = msg;
            }
        });
        return reportList;
    }

    // 加载委托测试申请记录
    function loadReportList(reportList){
        for (var i = 0; i < reportList.length; i++) {
            addRow0(0);
            initRowsListener();
            var rowidx = $("#indexnum0").val() - 1;
            $("#field27353_"+rowidx).val(reportList[i].detformno);
            $("#field27353_"+rowidx+"span").html(reportList[i].detformnotxt);
        }
    }

    // 初始化隐藏栏位
    function initPageStyle(){
        // 任务类别、修改次数、预计工时、计划完成时间、是否进度管控
        var fields = ["field27079","field27080","field27081","field27082","field27083"];
        for (var i = 0; i < fields.length; i++) {
            $("#"+fields[i]).hide();
            if(i == 3){
                $("#"+fields[i]+"browser").hide();
            }
            if(i == 4){
                $("#"+fields[i]+"span").html($("#"+fields[i]+" option[value="+$("#"+fields[i]).val()+"]").text());
            }else{
                $("#"+fields[i]+"span").html($("#"+fields[i]).val());
            }
        }

        // 完成百分比
        var pgrcontrol = $("#field27083").val();
        if(pgrcontrol == "0"){
            $("#field27084").show();
        }else{
            $("#field27084").hide();
            $("#field27084span").html($("#field27084").val());
        }
    }

    // 开发建议单监听器
    $("#field27556").bindPropertyChange(function(){
        removeDetaildata(0);
        // 清空附件类别
        $("#field27078").val("");
        $("#field27078span").html("");
    });

    //  附件类别监听器
    $("#field27078").bindPropertyChange(function(){
        removeDetaildata(0);
        // 清空任务信息
        clearFieldByType();
        // 开发建议单、附件类别
        var devNo = $("#field27556").val();
        var fileType = $("#field27078").val();
        if(devNo == "" && fileType != "" ){
            $("#field27078").val("");
            $("#field27078span").html("");
            Dialog.alert("请先选择开发建议单!");
            return false;
        }

        if(fileType != ""){
            // 根据开发建议单+附件类别判断是否存在未归档单据及修改次数
            var returnStr = getUploadCount(devNo,fileType);
            if(returnStr == "hasApply"){
                Dialog.alert("当前开发建议单+附件类别存在未归档单据,不可操作!");
                $("#field27078").val("");
                $("#field27078span").html("");
                return false;
            }else{
                // 上传次数
                $("#field27080").val(returnStr);
                $("#field27080span").html(returnStr);
            }
            // 根据附件类别获取任务信息
            var taskInfo = getTaskInfoByType(fileType);
            loadTask(taskInfo);
        }
    });

    // 根据开发建议单+附加类别获取修改次数
    function getUploadCount(devNo,fileType){
        var returnStr = "";
        var rid = <%=requestid%>
        $.ajax({
            url : "/CODE/workflow/ajax_54521_getUploadCount.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"devNo="+devNo+"&fileType="+fileType+"&rid="+rid,
            dataType : "html",
            success: function(msg){
                returnStr = msg.trim();
            }
        });
        return returnStr;
    }

    // 根据附件类别获取任务信息
    function getTaskInfoByType(fileType){
        var taskInfo = "";
        $.ajax({
            url : "/CODE/workflow/ajax_c1_getTaskInfoByType.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"fileType="+fileType,
            dataType : "json",
            success: function(msg){
                taskInfo = msg;
            }
        });
        return taskInfo;
    }

    // 根据附件类别获取任务信息后加载显示
    function loadTask(taskInfo){
        // 任务类别
        $("#field27079").val(taskInfo.tasktypetext);
        $("#field27079span").html(taskInfo.tasktypetext);
        // 预计工时
        $("#field27081").val(taskInfo.planday);
        $("#field27081span").html(taskInfo.planday);
        // 计划完成时间
        $("#field27082").val(taskInfo.plandate);
        $("#field27082span").html(taskInfo.plandate);
        // 是否进度管控
        $("#field27083").val(taskInfo.pgrcontrol);
        $("#field27083span").html($("#field27083 option[value="+taskInfo.pgrcontrol+"]").text());
        // 完成百分比
        if(taskInfo.pgrcontrol == "0"){
            $("#field27084").show();
            $("#field27084").val(taskInfo.finishpercent);
        }else{
            $("#field27084").hide();
            $("#field27084").val(taskInfo.finishpercent);
            $("#field27084span").html(taskInfo.finishpercent);
        }
    }

    // 根据附件类别清空任务信息
    function clearFieldByType(){
        // 任务类别、修改次数、预计工时、计划完成时间、是否进度管控、完成百分比
        var fields = ["field27079","field27080","field27081","field27082","field27083","field27084"];
        for (var i = 0; i < fields.length; i++) {
            $("#"+fields[i]).val("");
            $("#"+fields[i]+"span").html("");
        }
    }

    // 初始化明细监听
    function initRowsListener(){
        var rownum = $("#indexnum0").val();
        for (var i = 0; i < rownum; i++) {
            itemRowsListener(i);
        }
    }

    // 明细添加监听器
    function addRowListener(){
        $("button[name='addbutton0']").click(function(){
            var rowidx = $("#indexnum0").val() - 1;
            // 初始化明细监听
            itemRowsListener(rowidx);
        });
    }

    // 明细委托测试单据编号监听器
    function itemRowsListener(rowidx){
        var nodeid = $("input[name='nodeid']").val();
        // 申请节点,初始化设置只读
        if(nodeid == 2797){
            // 担当、部门、产品类别、申请日期、完成日期
            setFieldReadOnly("27354_"+rowidx,true,1);

            var readonlyfields = ["field27355_","field27356_","field27357_","field27358_"];
            for (var i = 0; i < readonlyfields.length; i++) {
                $("#"+readonlyfields[i]+rowidx).hide();
                if(i > 1){
                    $("#"+readonlyfields[i]+rowidx+"browser").hide();
                }
                var fieldsVal = $("#"+readonlyfields[i]+rowidx).val();
                $("#"+readonlyfields[i]+rowidx+"span").html(fieldsVal);
            }
        }

        // 委托测试申请单据编号监听器
        $("#field27353_"+rowidx).bindPropertyChange(function(){
            var formNo = $("#field27353_"+rowidx).val();
            if(formNo != ""){
                // 重复项校验
                var rownum = $("#indexnum0").val();
                for (var i = 0; i < rownum; i++) {
                    var idx_formNo = $("#field27353_"+i).val();
                    if(formNo == idx_formNo && rowidx != i){
                        Dialog.alert("单据编号重复,请重新选择!");
                        $("#field27353_"+rowidx).val("");
                        $("#field27353_"+rowidx+"span").html("");
                        return false;
                    }
                }
                var reportInfo = getReportInfoByFormNo(formNo);
                loadSingleReport(reportInfo,rowidx);
            }else{
                clearFieldByFormNo(rowidx);
            }
        });
    }

    // 根据委托测试申请单号获取委托测试信息
    function getReportInfoByFormNo(formNo){
        var reportInfo = "";
        $.ajax({
            url : "/CODE/workflow/ajax_4525_getReportInfoByFormNo.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"formNo="+formNo,
            dataType : "json",
            success: function(msg){
                reportInfo = msg;
            }
        });
        return reportInfo;
    }

    // 加载委托测试单据信息
    function loadSingleReport(reportInfo,rowidx){
        // 担当
        setFieldReadOnly("27354_"+rowidx,false,1);
        $("#field27354_"+rowidx).val(reportInfo.userid);
        setFieldReadOnly("27354_"+rowidx,true,1);
        $("#field27354_"+rowidx+"_readonlytext").html(reportInfo.username);
        // 部门
        $("#field27355_"+rowidx).val(reportInfo.dept);
        $("#field27355_"+rowidx+"span").html(reportInfo.dept);
        // 产品类别
        $("#field27356_"+rowidx).val(reportInfo.producttype);
        $("#field27356_"+rowidx+"span").html(reportInfo.producttype);
        // 申请日期
        $("#field27357_"+rowidx).val(reportInfo.createdate);
        $("#field27357_"+rowidx+"span").html(reportInfo.createdate);
        // 完成日期
        $("#field27358_"+rowidx).val(reportInfo.overdate);
        $("#field27358_"+rowidx+"span").html(reportInfo.overdate);
    }

    // 根据委托测试申请单号清空相应栏位
    function clearFieldByFormNo(rowidx){
        // 担当、部门、产品类别、申请日期、完成日期
        var readonlyfields = ["field27355_","field27356_","field27357_","field27358_"];
        setFieldReadOnly("27354_"+rowidx,false,1);
        $("#field27354_"+rowidx).val("");
        setFieldReadOnly("27354_"+rowidx,true,1);
        $("#field27354_"+rowidx+"_readonlytext").html("");

        for (var i = 0; i < readonlyfields.length; i++) {
            $("#"+readonlyfields[i]+rowidx).val("");
            $("#"+readonlyfields[i]+rowidx+"span").html("");
        }
    }

    // 清空明细表
    function removeDetaildata(tableidx){
        $("table#oTable"+tableidx).find("input[name='check_node_"+tableidx+"']").each(function(){
            $(this).closest("tr").remove();
        });
        $("#nodesnum"+tableidx).val("0");
        $("#indexnum"+tableidx).val("0");
        $("#submitdtlid"+tableidx).val("");

        var rid=<%=requestid%>;
        if(rid != -1)
            deleteDetail(rid);
    }

    // 清空明细表数据
    function deleteDetail(rid){
        $.ajax({
            url : "/code/workflow/ajax_4652_deleteDetail.jsp",
            type : "post",
            async : false,
            processData : false,
            data : "rid="+rid,
            dataType : "html",
            success: function(msg){}
        });
    }
</script>

 

E9 通过数据库查找ID对应字段 select * from  workflow_billfield where id=666

ECOde 按照标准新建文件夹 (项目名称+流程ID+V1) 

新建 init666.js    并设置前置加载

let enable = true;
let isRun = true;//控制执行次数
let workflowIdPage = 666;

const runScript = () => {
  if (!isRun) return;
  ecodeSDK.load({
    id: '${appId}',
    cb: () => {
    }
  });
  isRun = false; //确保只执行一次
}


/**
 * PC端
 */
ecodeSDK.overwritePropsFnQueueMapSet('WeaReqTop', {
  fn: (newProps, name) => {
    if (!enable) return;
    const { hash } = window.location;
    if (!hash.startsWith("#/main/workflow/req")) return;
    if (!WfForm.getBaseInfo()) return;
    const { workflowid } = WfForm.getBaseInfo();
    if (workflowid !== workflowIdPage) return;
    runScript(); //执行代码块
    return newProps;
  }
});

/**
 * 移动端
 */
ecodeSDK.overwriteMobilePropsFnQueueMapSet('TabPage', {
  fn: (newProps, name) => {
    if (!enable) return;
    const { hash } = window.location;
    if (!hash.startsWith("#/req")) return;
    if (!WfForm.getBaseInfo()) return;
    const { workflowid } = WfForm.getBaseInfo();
    if (workflowid !== workflowIdPage) return;
    runScript(); //执行代码块
    return newProps;
  }
});

新建event666.js  并修改以前的代码 如下

/**
 * @author 作者:
 * @date 创建日期:2022-12-29
 * @workflow: 
 * @version: 1.0
*/
//  获取基本信息 数据库表单信息、页面id信息、操作者人员id、请求id
const baseInfo = WfForm.getBaseInfo();
const formid = baseInfo.formid;
const workflowid = baseInfo.workflowid;
const userid  = baseInfo.f_weaver_belongto_userid;
const requestid = baseInfo.requestid;
const nodeid = baseInfo.nodeid;
//console.log("formid",formid,"workflowid",workflowid,"userid",userid,"requestid",requestid);
//console.log("nodeid"+nodeid);
const pgrcontrol_id= WfForm.convertFieldNameToId('pgrcontrol'); 
const finishpercent_id= WfForm.convertFieldNameToId('finishpercent');
const devno_id= WfForm.convertFieldNameToId('devno'); 
const filetypebrow_id=WfForm.convertFieldNameToId('filetypebrow'); 
const uploadcount_id=WfForm.convertFieldNameToId('uploadcount');

const planday_id=WfForm.convertFieldNameToId('planday');
const tasktype_id=WfForm.convertFieldNameToId('tasktype');
const planfinishdate_id=WfForm.convertFieldNameToId('planfinishdate');

const dt1_taker_id = WfForm.convertFieldNameToId('taker', 'detail_1'); 
const dt1_dept_id = WfForm.convertFieldNameToId('dept', 'detail_1'); 
const dt1_prodtype_id = WfForm.convertFieldNameToId('prodtype', 'detail_1');
const dt1_version_id = WfForm.convertFieldNameToId('version', 'detail_1');
const dt1_applydate_id = WfForm.convertFieldNameToId('applydate', 'detail_1');
const dt1_overdate_id = WfForm.convertFieldNameToId('overdate', 'detail_1');
const dt1_detformno_id = WfForm.convertFieldNameToId('detformno', 'detail_1');

const fun = ecodeSDK.getCom('cus_fun', 'fun');
const reqID = fun.getAddParaValueByName("reqID");
const devID = fun.getAddParaValueByName("devID");
let devNO = fun.getAddParaValueByName("devNO");
const filetype = fun.getAddParaValueByName("filetype");
let filetypetext = fun.getAddParaValueByName("filetypetext");

if(typeof (devNO) != "undefined"){
  devNO = devNO.replace(new RegExp(/'/g), "") 
  filetypetext = filetypetext.replace(new RegExp(/'/g), "") 
}

//console.log("nodeid",nodeid,"devID",devID,"devNO",devNO,"filetype",filetype,"filetypetext",filetypetext)

// 初始化页面栏位只读
        initPageStyle();
        // PDF文档附件上传控制
        //pdfDocValidate();
        // CR01跳转进入时自动加载
        autoSetFromCr01();
    // 明细初始化
        window.setTimeout(function(){     
        initRowsListener();
        }, 2000);
        addRowListener();
        // 单据提交根据是否管控判断相应完成百分比不能为空。
        window.checkCustomize = function(){
            // 申请节点
            if(nodeid == 12797){
        let pgrcontrol = WfForm.getFieldValue(pgrcontrol_id);
              let finishpercent=WfForm.getFieldValue(finishpercent_id);
                if(pgrcontrol == "0"){
                    if(finishpercent == ""){
                    //    Dialog.alert("进度管控为是,完成百分比必填!");
            WfForm.showConfirm("进度管控为是,完成百分比必填!", function(){});
                        return false;
                    }
                }
            }
            return true;
        }




// 由CR05新增进入时,自动加载开发建议单及附件类别
    function autoSetFromCr01(){
        //var nodeid = $("input[name='nodeid']").val();
        //var devID = <%=devID %>
        if(nodeid == 12797 && typeof(devID)!="undefined"){
            // 申请节点根据请求ID获取单据信息
            // Dialog.alert("当前页面是由CR01跳转进入.系统自动加载开发建议单以及附件类别!");

            // 开发建议单
      WfForm.changeFieldValue(devno_id,{value:devID,
    specialobj:[
        {id:devID,name:devNO}
    ]});

            let counter = 0;
            setInterval(function(){
                if(counter < 1){
                    // 附件类别

          WfForm.changeFieldValue(filetypebrow_id,{value:filetype,
        specialobj:[
            {id:filetype,name:filetypetext}
        ]});

                    counter = counter + 1;
                }
            },500);
       
             if(typeof(reqID)!="undefined"){
                setInterval(function(){
                    if(counter < 2){
                        // 加载委托测试申请列表
                        let reportList = getReportListByRequestID(reqID);
                        loadReportList(reportList);
                        counter = counter + 1;
                    }
                },1000);
            }
            
        }
    }

    // 根据请求编号获取历史委托测试申请记录
    function getReportListByRequestID(reqID){
        let reportList = "";
        $.ajax({
            url : "/CODE/workflow/ajax_4572_getReportListByRequestID.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"reqID="+reqID,
            dataType : "json",
            success: function(msg){
                reportList = msg;
            }
        });
        return reportList;
    }

    // 加载委托测试申请记录
    function loadReportList(reportList){
     for (let i = 0; i < reportList.length; i++) {
        let addObj = {};
                addObj[dt1_detformno_id] ={value:reportList[i].detformno,
        specialobj:[
            {id:reportList[i].detformno,name:reportList[i].detformnotxt}
        ]};
            //     addObj[dt1_evaluateprodtype_id] = {value:nameInfo.prodtype};
        WfForm.addDetailRow("detail_1", addObj);
        }
        initRowsListener();
    }

    // 初始化隐藏栏位
    function initPageStyle(){
        // 任务类别、修改次数、预计工时、计划完成时间、是否进度管控
      let fields = ["tasktype","uploadcount","planday","planfinishdate","pgrcontrol"];
        for (let i = 0; i < fields.length; i++) {
            let a_id=WfForm.convertFieldNameToId(fields[i]);
      WfForm.changeFieldAttr(a_id,1);
            
        }

        // 完成百分比
        let pgrcontrol = WfForm.getFieldValue(pgrcontrol_id);
          
        if(pgrcontrol == "0"){
            WfForm.changeFieldAttr(finishpercent_id,2);}else{
            WfForm.changeFieldAttr(finishpercent_id,1);
        }
    }

    // 开发建议单监听器
  WfForm.bindFieldChangeEvent(devno_id,function(obj,id,value){
     WfForm.changeFieldValue(filetypebrow_id,{value:""}); // 清空附件类别
          //if(requestid != -1)
             WfForm.delDetailRow("detail_1", "all");
  }) 


    //  附件类别监听器
    //$("#field25495").bindPropertyChange(function(){
        WfForm.bindFieldChangeEvent(filetypebrow_id,function(obj,id,value){
           // if(requestid != -1)
               WfForm.delDetailRow("detail_1", "all");
        // 清空任务信息
        clearFieldByType();
        // 开发建议单、附件类别
    
    let cDevNo = WfForm.getFieldValue(devno_id);
        let fileType = WfForm.getFieldValue(filetypebrow_id);

        if(cDevNo == "" && fileType != "" ){
            // $("#field25495").val("");
            // $("#field25495span").html("");
            //Dialog.alert("请先选择开发建议单!");
             WfForm.changeFieldValue(filetypebrow_id, {value:""});
       WfForm.showConfirm("请先选择开发建议单!", function(){});
            return false;
        }

        if(fileType != ""){
            // 根据开发建议单+附件类别判断是否存在未归档单据及修改次数
            let returnStr = getUploadCount(cDevNo,fileType);
            if(returnStr == "hasApply"){
                // Dialog.alert("当前开发建议单+附件类别存在未归档单据,不可操作!");
                // $("#field25495").val("");
                // $("#field25495span").html("");
                WfForm.showConfirm("当前开发建议单+附件类别存在未归档单据,不可操作!", function(){});
        WfForm.changeFieldValue(filetypebrow_id, {value:""});

                return false;
            }else{
                // 上传次数
                // $("#field25497").val(returnStr);
                // $("#field25497span").html(returnStr);
                WfForm.changeFieldValue(uploadcount_id, {value:returnStr});
            }
            // 根据附件类别获取任务信息
            let taskInfo = getTaskInfoByType(fileType);
            loadTask(taskInfo);
        }
    });

    // 根据开发建议单+附加类别获取修改次数
    function getUploadCount(cDevNo,fileType){
        let returnStr = "";
        //var rid = <%=requestid%>
        $.ajax({
            url : "/CODE/workflow/ajax_4452_getUploadCount.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"devNo="+cDevNo+"&fileType="+fileType+"&rid="+requestid,
            dataType : "html",
            success: function(msg){
                returnStr = msg.trim();
            }
        });
        return returnStr;
    }

    // 根据附件类别获取任务信息
    function getTaskInfoByType(fileType){
        let taskInfo = "";
        $.ajax({
            url : "/CODE/workflow/ajax_c1_getTaskInfoByType.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"fileType="+fileType,
            dataType : "json",
            success: function(msg){
                taskInfo = msg;
            }
        });
        return taskInfo;
    }

    // 根据附件类别获取任务信息后加载显示
    function loadTask(taskInfo){
        // 任务类别
        // 预计工时
        // 计划完成时间
        // 是否进度管控
        // 完成百分比
         WfForm.changeFieldValue(tasktype_id, {value:taskInfo.tasktypetext});
    WfForm.changeFieldValue(planday_id, {value:taskInfo.planday});
    WfForm.changeFieldValue(planfinishdate_id, {value:taskInfo.plandate});
    WfForm.changeFieldValue(pgrcontrol_id, {value:taskInfo.pgrcontrol});
        if(taskInfo.pgrcontrol == "0"){
          WfForm.changeFieldAttr(finishpercent_id, 2);
       WfForm.changeFieldValue(finishpercent_id, {value:taskInfo.finishpercent});
        }else{WfForm.changeFieldAttr(finishpercent_id, 1);
       WfForm.changeFieldValue(finishpercent_id, {value:taskInfo.finishpercent});
        }
    
    }

    // 根据附件类别清空任务信息
    function clearFieldByType(){
        // 任务类别、修改次数、预计工时、计划完成时间、是否进度管控、完成百分比
        let fields = ["tasktype","uploadcount","planday","planfinishdate","pgrcontrol","finishpercent"];
        for (let i = 0; i < fields.length; i++) {
             let b_id=WfForm.convertFieldNameToId(fields[i]);
       WfForm.changeFieldValue(b_id,{value:""});
        }
    }

    // 初始化明细监听
function initRowsListener(){
  // 申请节点,初始化设置只读
  if(nodeid==2797){
    // 担当、主品号、生产状态、版次、申请日期、完成日期
    let index = WfForm.getDetailAllRowIndexStr("detail_1");
    let indexArr = index.split(",");
   // console.log("indexArr.length*************"+indexArr.length);//异常
    for(let i = 0;i < indexArr.length;i++){
    //  console.log(i);
      WfForm.changeFieldAttr(dt1_taker_id+"_"+indexArr[i], 1);
      WfForm.changeFieldAttr(dt1_dept_id+"_"+indexArr[i], 1);
     // WfForm.changeFieldAttr(dt1_version_id+"_"+indexArr[i], 1);
      WfForm.changeFieldAttr(dt1_prodtype_id+"_"+indexArr[i], 1);
      WfForm.changeFieldAttr(dt1_applydate_id+"_"+indexArr[i], 1);
      WfForm.changeFieldAttr(dt1_overdate_id+"_"+indexArr[i], 1);
    }
  }
  
}

    // 明细添加监听器
    function addRowListener(){

    WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){
                initRowsListener();
});
}

// 委托测试申请单据编号监听器
WfForm.bindDetailFieldChangeEvent(dt1_detformno_id,function(id,rowIndex,value){
  let detformno = WfForm.getFieldValue(dt1_detformno_id+"_"+rowIndex);
  if(detformno != ""){
    let index = WfForm.getDetailAllRowIndexStr("detail_1");
    let indexArr = index.split(",");
    for(let i = 0;i < indexArr.length;i++){
            let idx_formNo= WfForm.getFieldValue(dt1_detformno_id+"_"+indexArr[i]);
      //console.log('detformno',detformno,'idx_formNo',idx_formNo)
      if(detformno==idx_formNo&&rowIndex!==indexArr[i]){
        WfForm.showConfirm("单据编号重复,请重新选择!", function(){});
        window.setTimeout(function(){     
          WfForm.changeFieldValue(dt1_detformno_id+"_"+rowIndex,{value:''});
        }, 10);
        return false;
      }
    }
    let reportInfo = getReportInfoByFormNo(detformno);
                loadSingleReport(reportInfo,rowIndex);
  }
  else{
                clearFieldByFormNo(rowIndex);
            }
});

// 根据委托测试申请单号获取委托测试信息
    function getReportInfoByFormNo(formNo){
        let reportInfo = "";
        $.ajax({
            url : "/CODE/workflow/ajax_4452_getReportInfoByFormNo.jsp",
            type : "post",
            async : false,
            processData : false,
            data :"formNo="+formNo,
            dataType : "json",
            success: function(msg){
                reportInfo = msg;
            }
        });
        return reportInfo;
    }

//  加载委托测试单据信息
    function loadSingleReport(reportInfo,rowidx){
    WfForm.changeFieldAttr(dt1_taker_id+"_"+rowidx, 1);
     // WfForm.changeFieldValue(dt1_taker_id+"_"+rowidx, {value:workcode});  
    
         WfForm.changeFieldValue(dt1_taker_id+"_"+rowidx, {value:reportInfo.userid,specialobj:[
        {id:reportInfo.userid,name:reportInfo.username}
    ]
}); 
     WfForm.changeFieldValue(dt1_dept_id+"_"+rowidx, {value:reportInfo.dept});  
        // WfForm.changeFieldValue(dt1_version_id+"_"+rowidx, {value:reportInfo.version});  
       WfForm.changeFieldValue(dt1_prodtype_id+"_"+rowidx, {value:reportInfo.producttype});  
         WfForm.changeFieldValue(dt1_applydate_id+"_"+rowidx, {value:reportInfo.createdate}); 
         WfForm.changeFieldValue(dt1_overdate_id+"_"+rowidx, {value:reportInfo.overdate}); 

    }

    // 根据委托测试申请单号清空相应栏位
    function clearFieldByFormNo(rowidx){ 
         WfForm.changeFieldAttr(dt1_taker_id+"_"+rowidx, 1);
       WfForm.changeFieldValue(dt1_taker_id+"_"+rowidx, {value:""}); 
     WfForm.changeFieldValue(dt1_dept_id+"_"+rowidx, {value:""});  
        // WfForm.changeFieldValue(dt1_version_id+"_"+rowidx, {value:""});  
       WfForm.changeFieldValue(dt1_prodtype_id+"_"+rowidx, {value:""});  
         WfForm.changeFieldValue(dt1_applydate_id+"_"+rowidx, {value:""}); 
         WfForm.changeFieldValue(dt1_overdate_id+"_"+rowidx, {value:""}); 

    }


    

 只能上传PDF验证事件

WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, function(callback){
    let pdfFlag = true;
    $("#"+pdffile_id).parent().children(".wea-upload-list").eq(0).children(".wea-upload-list-item").each(function(index, obj){
        let fileName = $(obj).find(".wea-upload-list-content").children("div").eq(1).children("a").html();
        if(fileName && fileName.length > 0 && fileName.indexOf(".pdf") == -1 && fileName.indexOf(".PDF") == -1 && fileName.indexOf(".pdf.vfx") == -1 
                && fileName.indexOf(".pdf.VFX") == -1 && fileName.indexOf(".PDF.VFX") == -1 && fileName.indexOf(".PDF.vfx") == -1){
            
            alert("附件PDF档只能传PDF!");    
            pdfFlag = false;               
        }                         
    });  
    if(!pdfFlag){
        return false;
    }    
    callback();
})

  

查询视图出不来处理方式

建模引擎--应用建模--查询--C215--字段定义--基础设置--formno--点击链接路径-- 加上 &ismonitor=1

 

Resin4 中文路径解析不了

修改resin.xml   

<cluster id="app"> 和  <web-app-default>  节点下增加
<character-encoding>UTF-8</character-encoding>

 

posted @ 2021-10-29 18:46  水龙  阅读(1176)  评论(0编辑  收藏  举报