欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

rule_5

程序员文章站 2022-03-22 10:10:43

<!doctype html>

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    <title>规则</title>
    <style type="text/css">
        /* * {
            font-size: 14px !important;
            font-weight:normal;
        } */
        .navbar{
            width: 100%;
            display: block;
        }
    </style>
        
</head>
<body>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <!-- <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> -->
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
    <div class="all">
        <div class="container" style="max-width:98%; background-color: #fff;border:1px solid transparent;
                                    border-radius:4px;border-color: #ddd; box-sizing: border-box;position: relative;
                                    padding: 0 20px 0 20px; margin-left: 15px; margin-right: 15px;">
            
            <!-- 导航栏 -->
            <div style="margin-top: 35px;margin-bottom: 8px;">
                <div style="width: 5px; background-color: #b582b3; height: 27px;float: left;margin-right: 7px;margin-left: 10px;"></div>
                <span style="font-weight: 800;font-size: 20px !important;">查询条件</span>
            </div>
            <div style="max-width: 100%; background-color: #b582b3; height: 2px;">
                
            </div>
            <!-- 导航栏结束 -->
            <!-- 下拉框 -->
            <div style="margin:40px 10px 55px 10px;font-weight:normal;position: relative;">
                <form id="content_form"> 
                    <!-- 第一行 -->
                    <div class="form-group row">
                        <!-- 1 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">一级部门</label>
                        <select class="form-control col-sm-1" id="firstLevel" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                        </select>
                        <!-- 2 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">二级部门</label>
                        <select class="form-control col-sm-1" id="secondLevel" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                        </select>
                        <!-- 3 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">三级部门</label>
                        <select class="form-control col-sm-1" id="thirdLevel" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                        </select>
                        <!-- 4 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">四级部门</label>
                        <select class="form-control col-sm-1" id="fourLevel" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                        </select>
                        <!-- 5 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">员工名</label>
                        <select class="form-control col-sm-1" id="EmpName" style="padding: 0px 0px 0px 5px;" onchange="initEmpName()">
                            <option disabled selected style='display:none;'></option>
                        </select>
                        <!-- 6 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">项目名称</label>
                        <select class="form-control col-sm-1" id="projectName" style="padding: 0px 0px 0px 5px;" onchange="initProjectName()">
                            <option disabled selected style='display:none;'></option>
                        </select>
                    </div>
                    <!-- 第二行 -->
                    <div class="form-group row">
                        <!-- 1 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">总代码最小量</label>
                        <input  name="zCodeMin" class="form-control col-sm-1" type="text" id="minCode" placeholder="请输入" style="padding: 0px 0px 0px 5px;">
                        <!-- 2 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">总代码最大值</label>
                        <input name="zCodeMax" class="form-control col-sm-1" type="text" id="maxCode" placeholder="请输入" style="padding: 0px 0px 0px 5px;">
                        <!-- <select class="form-control col-sm-1" id="maxCode" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                        </select> -->
                        <!-- 3 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">是否校准</label>
                        <select class="form-control col-sm-1" id="whetherCorrect" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                            <option value="0">是</option>
                            <option value="1">否</option>
                        </select>
                        <!-- 4 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">是否需求</label>
                        <select class="form-control col-sm-1" id="whetherNeed" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                            <option value="0">是</option>
                            <option value="1">否</option>
                        </select>
                        <!-- 5 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">提交ID</label>
                        <select class="form-control col-sm-1" id="submitId" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                        </select>
                        <!-- 6 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">缺陷ID</label>
                        <select class="form-control col-sm-1" id="bugId" style="padding: 0px 0px 0px 5px;">
                            <option disabled selected style='display:none;'></option>
                        </select>
                    </div>
                    <!-- 第三行 -->
                    <div class="form-group row">
                        <!-- 1 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">提交开始日期</label>
                        <input id="input_KS" class="form-control col-sm-1" type="date" name="submitKS" style="padding: 0px 2px 0px 2px;"/>
                        <!-- 2 -->
                        <label class="col-sm-1 text-right" for="inlineFormCustomSelectPref">提交结束日期</label>
                        <input id="input_JS" class="form-control col-sm-1" type="date" name="submitJS" style="padding: 0px 2px 0px 2px;"/>
                        <!-- 按钮 -->
                        <!-- 查询按钮
                        <button type="button" class="btn" onclick="searchTable()" style="background-color: #b582b3;color: #fff;
                                                                position: absolute;right: 20px;width: 95px;">查询</button> -->
                    </div>
                </form>
            </div>
            <!-- 下拉框结束 -->
            <!-- 表格内容 -->
            <div class="table-responsive" style="margin-top: 30px;overflow: auto;height: 390px;">
                <table class="table thead-dark text-nowrap" id="yonghu_tbl">
                    <!-- 查询按钮 -->
                    <button type="button" class="btn" onclick="searchTable()" style="background-color: #b582b3;color: #fff;
                                position: absolute;right: 20px;width: 95px;top:220px">查询</button>
                    <thead>
                        <tr style="background-color: #b582b3; color: #fff;">
                            <th scope="col" class="text-center">一级部门</th>
                            <th scope="col" class="text-center">二级部门</th>
                            <th scope="col" class="text-center">三级部门</th>
                            <th scope="col" class="text-center">四级部门</th>
                            <th scope="col" class="text-center">员工名</th>
                            <th scope="col" class="text-center">日期</th>
                            <th scope="col" class="text-center">提交ID</th>
                            <th scope="col" class="text-center">缺陷ID</th>
                            <th scope="col" class="text-center">项目名称</th>
                            <th scope="col" class="text-center">校准前总代码量</th>
                            <th scope="col" class="text-center">新增代码量</th>
                            <th scope="col" class="text-center">修改代码量</th>
                            <th scope="col" class="text-center">删除代码量</th>
                            <th scope="col" class="text-center">是否需求类(1/0)</th>
                            <th scope="col" class="text-center">配置值</th>
                            <th scope="col" class="text-center">校准后总代码量</th>
                            <th scope="col" class="text-center">是否校准</th>
                            <th scope="col" class="text-center">计算详细</th>
                            <th scope="col" class="text-center">功能</th>
                        </tr>
                    </thead>
                    <tbody> </tbody>
                </table>
                <!-- 分页 -->
                <nav aria-label="Page navigation example">
                    <ul class="pagination justify-content-end">
                        <li class="page-item disabled">
                            <a class="page-link" href="#" tabindex="-1" aria-disabled="true">上一页</a>
                        </li>
                        <li class="page-item"><a onclick="changePage()" class="page-link" href="#">1</a></li>
                        <li class="page-item">
                            <a class="page-link" href="#">下一页</a>
                        </li>
                    </ul>
                </nav>
                <!-- 分页结束 -->
            </div>
            <!-- 表格结束 -->
        </div>
    </div>
    <script>
        var baseUrl = "https://dashboard.unisoc.com";
        // 加载数据
        function reloadData(){
            var url = baseUrl+"/calibration_config/search"
            $.get(url,function(result){
                if(result.status === 200){
                    $("#yonghu_tbl>tbody").empty();
                    // console.log(result.data);
                    result.data.forEach(function(item){
                        // console.log(item)
                        $(`<tr>
                            <td class="text-center">`+item.depID1+`</td>
                            <td class="text-center">`+item.depID2+`</td>
                            <td class="text-center">`+item.depID3+`</td>
                            <td class="text-center">`+item.depID4+`</td>
                            <td class="text-center">`+item.name+`</td>
                            <td class="text-center">`+item.submit_Date+`</td>
                            <td class="text-center">`+item.svn_id+`</td>
                            <td class="text-center">`+item.bug_id+`</td>
                            <td class="text-center">`+item.product+`</td>
                            <td class="text-center">`+item.total_code+`</td>
                            <td class="text-center">`+item.add_code+`</td>
                            <td class="text-center">`+item.modify_code+`</td>
                            <td class="text-center">`+item.delete_code+`</td>
                            <td class="text-center">`+item.is_request+`</td>
                            <td class="text-center">`+item.first_submit_proportion+`</td>
                            <td class="text-center">`+item.first_submit_proportion+`</td>
                            <td class="text-center">`+item.is_calibration+`</td>
                            <td class="text-center">
                                <a target="_blank" href="https://dashboard.unisoc.com/art/selectReportParameters?reportId=205"><button class="btn" style="background-color: #c397c1;color:#fff">查看</button>
                            </td>
                            <td class="text-center">
                                <a href="javascript:void(0)"><button class="btn" style="background-color: #c397c1;color:#fff">提交</button>
                            </td>
                        </tr>`).appendTo(".table tbody");
                        });
                } else {
                    alert("服务接口出错!");
                }
            })
        }
        
        
        
        
        
        
        // 第一个下拉框加载
        function initOneDepartment(){
            // 获取登陆人username
            var element = document.getElementsByClassName("nav navbar-top-links navbar-right");
            var YHname = element[0].innerText;
            // 数据加载
            var url = baseUrl+"/calibration_config/load_dep?username="+"wind.deng";
            $.get(url,function(result){
                if(result.status === 200) {
                    //将栏目信息追加到下拉菜单
                    var arr = [];
                    result.data.forEach(item=>{
                        arr.push(item.dep1)
                    });
                    // 自定义数组去重
                    Array.prototype.myInfo = function(){
                        var newArr = [];
                        for(var i=0;i<arr.length;i++){
                            var a = newArr.indexOf(arr[i]);
                            //console.log(a)
                            if(a==-1){
                                newArr[newArr.length] = arr[i];
                            }
                        }
                        return newArr;
                    }
                    var result = arr.myInfo();
                    result.forEach(function(item){
                        // 判断item不为空之后再追加到select下
                        if(item!=null && item!=""){
                            // 将数组中的每一项放入地址搜索的下拉框select中
                            var newOption = $(`
                            <option value="`+item+`">`+item+`</option>
                            `);
                            $("#firstLevel").append(newOption);
                        }
                    });
                }
            });
        }
        // 第2个下拉框加载
        function initTwoDepartment(){
            // 获取登陆人username
            var element = document.getElementsByClassName("nav navbar-top-links navbar-right");
            var YHname = element[0].innerText;
            // 数据加载
            var url = baseUrl+"/calibration_config/load_dep?username="+"wind.deng";
            $.get(url,function(result){
                if(result.status === 200) {
                    //将栏目信息追加到下拉菜单
                    var arr = [];
                    result.data.forEach(item=>{
                        arr.push(item.dep2)
                    });
                    // 自定义数组去重
                    Array.prototype.myInfo = function(){
                        var newArr = [];
                        for(var i=0;i<arr.length;i++){
                            var a = newArr.indexOf(arr[i]);
                            if(a==-1){
                                newArr[newArr.length] = arr[i];
                            }
                        }
                        return newArr;
                    }
                    var result = arr.myInfo();
                    result.forEach(function(item){
                        // 判断item不为空之后再追加到select下
                        if(item!=null && item!=""){
                            // 将数组中的每一项放入地址搜索的下拉框select中
                            var newOption = $(`
                            <option value="`+item+`">`+item+`</option>
                            `);
                            $("#secondLevel").append(newOption);
                        }
                    });
                }
            });
        }
        // 第3个下拉框加载
        function initThreeDepartment(){
            // 获取登陆人username
            var element = document.getElementsByClassName("nav navbar-top-links navbar-right");
            var YHname = element[0].innerText;
            // 数据加载
            var url = baseUrl+"/calibration_config/load_dep?username="+"wind.deng";
            $.get(url,function(result){
                if(result.status === 200) {
                    //将栏目信息追加到下拉菜单
                    var arr = [];
                    result.data.forEach(item=>{
                        arr.push(item.dep3)
                    });
                    // 自定义数组去重
                    Array.prototype.myInfo = function(){
                        var newArr = [];
                        for(var i=0;i<arr.length;i++){
                            var a = newArr.indexOf(arr[i]);
                            if(a==-1){
                                newArr[newArr.length] = arr[i];
                            }
                        }
                        return newArr;
                    }
                    var result = arr.myInfo();
                    result.forEach(function(item){
                        // 判断item不为空之后再追加到select下
                        if(item!=null && item!=""){
                            // 将数组中的每一项放入地址搜索的下拉框select中
                            var newOption = $(`
                            <option value="`+item+`">`+item+`</option>
                            `);
                            $("#thirdLevel").append(newOption);
                        }
                    });
                }
            });
        }
        // 第4个下拉框加载
        function initFourDepartment(){
            // 获取登陆人username
            var element = document.getElementsByClassName("nav navbar-top-links navbar-right");
            var YHname = element[0].innerText;
            // 数据加载
            var url = baseUrl+"/calibration_config/load_dep?username="+"wind.deng";
            $.get(url,function(result){
                if(result.status === 200) {
                    //将栏目信息追加到下拉菜单
                    var arr = [];
                    result.data.forEach(item=>{
                        arr.push(item.dep4)
                    });
                    // 自定义数组去重
                    Array.prototype.myInfo = function(){
                        var newArr = [];
                        for(var i=0;i<arr.length;i++){
                            var a = newArr.indexOf(arr[i]);
                            if(a==-1){
                                newArr[newArr.length] = arr[i];
                            }
                        }
                        return newArr;
                    }
                    var result = arr.myInfo();
                    result.forEach(function(item){
                        // 判断item不为空之后再追加到select下
                        if(item!=null && item!=""){
                            // 将数组中的每一项放入地址搜索的下拉框select中
                            var newOption = $(`
                                <option value="`+item+`">`+item+`</option>
                            `);
                            $("#fourLevel").append(newOption);
                        }
                    });
                }
            });
        }
        // 获取员工名
        function initEmpName(){
            // 获取登陆人username
            var element = document.getElementsByClassName("nav navbar-top-links navbar-right");
            var YHname = element[0].innerText;
            // 获取1234级部门名字
            var one = $("#firstLevel").val()?$("#firstLevel").val():"";
            var two = $("#secondLevel").val()?$("#secondLevel").val():"";
            var three = $("#thirdLevel").val()?$("#thirdLevel").val():"";
            var four = $("#fourLevel").val()?$("#fourLevel").val():"";
            // $("#EmpName").empty();
            // 数据加载
            var url = baseUrl+"/calibration_config/get_all_username_by_dep?depID1="+one+"&"+"depID2="+two+"&"+"depID3="+three+"&"+"depID4="+four;
            $.get(url,function(result){
                if(result.status === 200) {
                    result.data.forEach(function(item){
                        console.log(item)
                        var newOption = $(`
                            <option value="`+item+`">`+item+`</option>
                        `)
                        $("#EmpName").append(newOption);
                    });
                }
            });
        }
        // 获取项目名称
        function initProjectName(){
            // 获取1234级部门名字
            var one = $("#firstLevel").val()?$("#firstLevel").val():"";
            var two = $("#secondLevel").val()?$("#secondLevel").val():"";
            var three = $("#thirdLevel").val()?$("#thirdLevel").val():"";
            var four = $("#fourLevel").val()?$("#fourLevel").val():"";
            // 数据加载
            var url = baseUrl+"/calibration_config/load_project?depID1="+one+"&"+"depID2="+two+"&"+"depID3="+three+"&"+"depID4="+four;
            $.get(url,function(result){
                if(result.status === 200) {
                    //将栏目信息追加到下拉菜单
                    result.data.forEach(function(item){
                        var newOption = $(`
                            <option value="`+item+`">`+item+`</option>
                        `)
                        $("#projectName").append(newOption);
                    });
                }
            });
        }
        // 获取提交ID

        // 获取缺陷ID


        // 查询
        function searchTable(){
            var one = $("#firstLevel").val()?$("#firstLevel").val():"";
            var two = $("#secondLevel").val()?$("#secondLevel").val():"";
            var three = $("#thirdLevel").val()?$("#thirdLevel").val():"";
            var four = $("#fourLevel").val()?$("#fourLevel").val():"";
            var YGname = $("#EmpName").val()?$("#EmpName").val():"";
            var proName = $("#projectName").val()?$("#projectName").val():"";
            // 总代码输入框val获取
            var minC = $("#content_form input[name=zCodeMin]").val()?$("#content_form input[name=zCodeMin]").val():"";
            var maxC = $("#content_form input[name=zCodeMax]").val()?$("#content_form input[name=zCodeMax]").val():"";
            console.log(minC)
            // 是否获取
            var whetherJZ = $("#whetherCorrect").val()?$("#whetherCorrect").val():"";
            var whetherXQ = $("#whetherNeed").val()?$("#whetherNeed").val():"";
            // id值获取

            // 年月获取
            var TJstart = $("#content_form input[name=submitKS]").val()?$("#content_form input[name=submitKS]").val():"";
            var TJend = $("#content_form input[name=submitJS]").val()?$("#content_form input[name=submitJS]").val():"";

            var url = baseUrl+"/calibration_config/search?depID1="+one+"&"+"depID2="+two+"&"+"depID3="+three+"&"+"depID4="+four;
            $.get(url,function(result){
                if(result.status === 200){
                    $("#yonghu_tbl>tbody").empty();
                    result.data.forEach(function(item){
                        // console.log(item)
                        $(`<tr>
                            <td class="text-center">`+item.depID1+`</td>
                            <td class="text-center">`+item.depID2+`</td>
                            <td class="text-center">`+item.depID3+`</td>
                            <td class="text-center">`+item.depID4+`</td>
                            <td class="text-center">`+item.name+`</td>
                            <td class="text-center">`+item.submit_Date+`</td>
                            <td class="text-center">`+item.svn_id+`</td>
                            <td class="text-center">`+item.bug_id+`</td>
                            <td class="text-center">`+item.product+`</td>
                            <td class="text-center">`+item.total_code+`</td>
                            <td class="text-center">`+item.add_code+`</td>
                            <td class="text-center">`+item.modify_code+`</td>
                            <td class="text-center">`+item.delete_code+`</td>
                            <td class="text-center">`+item.is_request+`</td>
                            <td class="text-center">`+item.first_submit_proportion+`</td>
                            <td class="text-center">`+item.first_submit_proportion+`</td>
                            <td class="text-center">`+item.is_calibration+`</td>
                            <td class="text-center">
                                <a target="_blank" href="https://dashboard.unisoc.com/art/selectReportParameters?reportId=205"><button class="btn" style="background-color: #c397c1;color:#fff">查看</button>
                            </td>
                            <td class="text-center">
                                <a href="javascript:void(0)"><button class="btn" style="background-color: #c397c1;color:#fff">提交</button>
                            </td>
                        </tr>`).appendTo(".table tbody");
                    });
                } else {
                    alert("服务接口出错!");
                }
            })
        }

        $(function(){
            // 重载数据
            reloadData();
            // 下拉框数据加载
            initOneDepartment();
            initTwoDepartment();
            initThreeDepartment();
            initFourDepartment();
            // 员工名
            initEmpName();
            // 项目名称
            // initProjectName();

            // 查询
            // searchTable();


        })
    </script>
</body>

本文地址:https://blog.csdn.net/weixin_45466923/article/details/109242570

相关标签: jQuery js

推荐阅读