complete-static.js 15.9 KB
//已办点击查看后跳页渲染方法
//already-click页面

//输出元素
var staticElement='';
//标题名字
var titleName = '';
//当字段为超链接时,储存文件名和路径
var Elementname='';
var ElementPath='';
//储存静态元素值,没啥作用(万一以后有呢)
var uploadJson={};
//判断key是否存在于dataInfo中,如果存在则包装渲染,若不存在则不渲染
var flage;
//获取输入框标题
function jsonToCompleteStatic(data){
    var dataInfo = JSON.parse(data);

    if (dataInfo.jzMatintain) {
       dataInfo['maintainername'] = dataInfo.jzMatintain.maintainername;
    }
    delete dataInfo['jzMatintain']
    for (let key in dataInfo ){
        flage = true;
        var staticTempJson={};
        switch (key) {
            case "jzProspectlist":
                Elementname = dataInfo[key].jzProspectlistName
                ElementPath = dataInfo[key].jzProspectlistPath
                staticElement='<a target="_parent"   id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" +ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzProspectlistName,15,true)+'</a>'
                titleName="勘查单";
                break;
            case "jzDesigndrawing":
                Elementname = dataInfo[key].jzDesigndrawingName
                ElementPath = dataInfo[key].jzDesigndrawingPath
                staticElement='<a target="_parent"  id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'"  >'+util.dealWithFormatTextByLen(dataInfo[key].jzDesigndrawingName,15,true)+'</a>'
                titleName="设计图";
                break;
            case "jzElementlist":
                Elementname = dataInfo[key].jzElementlistName
                ElementPath = dataInfo[key].jzElementlistPath
                staticElement='<a target="_parent"  id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzElementlistName,15,true)+'</a>'
                titleName="要素表";
                break;
            case "jzOutboundlist":
                Elementname = dataInfo[key].jzOutboundlistName
                ElementPath = dataInfo[key].jzOutboundlistPath
                staticElement='<a target="_parent"  id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzOutboundlistName,15,true)+'</a>'
                titleName="出库单";
                break;
            case "jzOperatoracceptlist":
                Elementname = dataInfo[key].jzOperatoracceptlistName
                ElementPath = dataInfo[key].jzOperatoracceptlistPath;
                staticElement='<a target="_parent"   id="href_'+key+'"   href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzOperatoracceptlistName,15,true)+'</a>'
                titleName="运营商验收单";
                break;
            case "jzRoutedrawing":
                Elementname = dataInfo[key].jzRoutedrawingName
                ElementPath = dataInfo[key].jzRoutedrawingPath;
                staticElement='<a target="_parent"  id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzRoutedrawingName,15,true)+'</a>'
                titleName="路由图";
                break;
            case "jzCompletedacceptlist":
                Elementname = dataInfo[key].jzCompletedacceptlistName
                ElementPath = dataInfo[key].jzCompletedacceptlistPath
                staticElement='<a target="_parent"  id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzCompletedacceptlistName,15,true)+'</a>'
                titleName="竣工验收单";
                break;
            case "jzBudgetofelectic":
                Elementname = dataInfo[key].jzBudgetofelecticName
                ElementPath = dataInfo[key].jzBudgetofelecticPath
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzBudgetofelecticName,15,true)+'</a>'
                titleName="电力预算清单";
                break;
            case "jzMatterlist":
                Elementname = dataInfo[key].jzMatterlistName
                ElementPath = dataInfo[key].jzMatterlistPath
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzMatterlistName,15,true)+'</a>'
                titleName="立项物资清单";
                break;
            case "jzConstructprocept":
                Elementname = dataInfo[key].jzConstructproceptName
                ElementPath =  dataInfo[key].jzConstructproceptPath;
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzConstructproceptName,15,true)+'</a>'
                titleName="施工组织方案";
                break;
            case "jzOpenrepory":
                Elementname = dataInfo[key].jzOpenreporyName
                ElementPath = dataInfo[key].jzOpenreporyPath;
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzOpenreporyName,15,true)+'</a>'
                titleName="开工报告";
                break;
            case "jzCompletedreport":
                Elementname = dataInfo[key].jzCompletedreportName
                ElementPath = dataInfo[key].jzCompletedreportPath;
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzCompletedreportName,15,true)+'</a>'
                titleName="完工报告";
                break;
            case "jzCompletedphoto":
                Elementname = dataInfo[key].jzCompletedphotoName
                ElementPath = dataInfo[key].jzCompletedphotoPath ;
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzCompletedphotoName,15,true)+'</a>'
                titleName="完工照片";
                break;
            case "jzRentdrawing" :
                Elementname = dataInfo[key].jzRentdrawingName
                ElementPath = dataInfo[key].jzRentdrawingPath;
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzRentdrawingName,15,true)+'</a>'
                titleName="起租截图";
                break;
            // case "jzUppermachineroomname":
            //     staticElement='<input  disabled  value="'+dataInfo[key]+'" id="" class="layui-input" style="color: #D2D2D2!important"/>'
            //     titleName="上联机房名称";
            //     uploadJson[key] =dataInfo[key]
            //     break;
            case "jzUppermachineroomplace":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="上联机房位置";
                break;
            case "jzOpendrawing":
                Elementname = dataInfo[key].jzOpendrawingName
                ElementPath = dataInfo[key].jzOpendrawingPath;
                staticElement='<a target="_parent" id="href_'+key+'"  href="'+util.interfaceUrl+interfacenName.fileDown + "?fileName="+Elementname +"&filePath=" + ElementPath+'" >'+util.dealWithFormatTextByLen(dataInfo[key].jzOpendrawingName,15,true)+'</a>'
                titleName="开通截图";
                break;
            case "jzNeId":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="网元id";
                break;
            case "jzPropertycode":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="资产编码";
                break;
            case "jzIsconnectwithowner":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="是否与业务主交接";
                break;
            case "jzPropertyname":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="接维物业名称";
                break;
            case "jzOwnercontactinfo":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="业主联系方式";
                break;
            case "maintainername":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="交维人员";
                break;
            // case "deptMaintain":
            //     staticElement='<input disabled value="'+dataInfo[key]+'" id="" class="layui-input"style="color: #D2D2D2!important" />'
            //     titleName="建维专员部门";
            //     break;
            case "jzCode":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                uploadJson[key] =dataInfo[key]
                titleName="基站号";
                break;
            case "jzName":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="基站名";
                break;
            case "projectCode":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                uploadJson[key] =dataInfo[key]
                titleName="项目编号";
                break;
            case "jzLatitude":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                uploadJson[key] =dataInfo[key]
                titleName="纬度";
                break;
            case "jzLongitude":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                uploadJson[key] =dataInfo[key]
                titleName="经度";
                break;
            case "jzRequire":
                if(dataInfo[key]==''){
                  return false;
                }
                else{
                    staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                    uploadJson[key] =dataInfo[key]
                    titleName="需求号";
                    break;
                }

            case "businessLine":
                util.ajax({
                    url:util.interfaceUrl+ interfacenName.getDic +'/'+ "JZ_YWX",
                    type:"get",
                    dataType:"json",
                    data:{type:'JZ_YWX'},
                    async:false,
                    success:function (res) {
                        if(res.code==200) {
                            var busdata = res.data;
                            for( m  in busdata){
                                if(dataInfo[key] == busdata[m].value ){
                                    staticElement='<span   id="'+key+'"  >'+util.dealWithFormatTextByLen(busdata[m].name,20,true)+'</span>'
                                    break;
                                }
                            }
                        }
                        else {
                            layer.msg("网络链接错误,获取业务线失败")
                        }
                    },
                    error:function () {
                        layer.msg('网络链接错误,获取业务线失败')
                    }
                });
                titleName="业务线";
                break;
            case "projectAddress":
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                uploadJson[key] =dataInfo[key]
                titleName="基站地址";
                break;
            // case "resourcePoint":
            //     staticElement='<input disabled value="'+dataInfo[key]+'" id="" class="layui-input"/>'
            //     uploadJson[key] =dataInfo[key]
            //     titleName="资源点";
            //     break;
            // case "resourcePointewm":
            //     staticElement='<input disabled value="'+dataInfo[key]+'" id="" class="layui-input"/>'
            //     uploadJson[key] =dataInfo[key]
            //     titleName="资源点标签二维码";
            //     break;

            case "changeSalesmanName":
                // getUserName(dataInfo[key],function(rs){
                //     $("#"+key+"").val(rs)
                // });
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="更换阶段负责人为";
                break;
            case "oldSalesmanName":
                // getUserName(dataInfo[key],function(rs){
                //     $("#"+key+"").val(rs)
                // });
                staticElement='<span  id="'+key+'"  >'+util.dealWithFormatTextByLen(dataInfo[key],20,true)+'</span>'
                titleName="原阶段负责人";
            break;
            default:
                flage = false;
                break;
        }
        if(flage){
        let title = '<label style="white-space: nowrap;min-width: 120px;padding: 16px 15px"class="layui-form-label">' + titleName+ ':</label>';
        let StaticinfoDiv = '<div class="layui-form-item"  style="margin: 0;height: 65px;" id="StaticinfoDiv"><div class="layui-inline controllstyle" style="text-align: start;white-space: nowrap;line-height: 37px;margin-bottom: 0px" >' +
            title + '<div class="layui-input-inline" style="white-space: nowrap;width: 287px;margin-top: 4.6px">' + staticElement + '</div>';
        '</div></div>';
        $('#completeStatic').append(StaticinfoDiv);
        }
    }
    // function getUserName(userId,callback){
    //
    //     util.ajax({
    //         type: "get",
    //         url: util.interfaceUrl+interfacenName.getUserNameById+"/"+userId,
    //         success: (res) => {
    //             if (res.code === 200) {
    //                 var userName = res.data.name;
    //                 callback(userName)
    //                 console.log(userName)
    //             } else {
    //                 error: function err(err) {
    //                     console.log("错误信息:" + err)
    //                 }
    //             }
    //         }
    //     });
    //
    // }

}