一键全选

autofill

目前为 2022-12-11 提交的版本。查看 最新版本

// ==UserScript==
// @name         一键全选
// @namespace    zhaiwei
// @version      0.13.2
// @description  autofill
// @author       zhaiwei
// @match        http://106.120.181.195/*
// @match        http://cpadisc2.cpad.gov.cn/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    // 生成按钮
    var btn = document.createElement('button');
    // 按钮文字
    btn.innerText = '一键全选';
    // 添加按钮的样式类名class值为chooseBtn
    btn.setAttribute('class', 'chooseBtn');
    // 生成style标签
    var style = document.createElement('style');
    // 把样式写进去
    style.innerText = `.chooseBtn{position:fixed;top:300px;right:150px;width:75px;height:55px;padding:3px 5px;border:1px solid #0d6efd;cursor:pointer;color:#0d6efd;font-size:14px;background-color:transparent;border-radius:5px;transition:color .15s ease-in-out,background-color .15s ease-in-out;z-index:9999999999999;}.chooseBtn:hover{background-color:#0d6efd;color:#fff;}`;
    // 在head中添加style标签
    document.head.appendChild(style);
    // 在body中添加button按钮
    document.body.appendChild(btn);
    // 点击按钮去执行一键全选函数 chooseAll
    document.querySelector('.chooseBtn').addEventListener('click', function () {
        chooseAll();
    })
    
    // 生成按钮
    var btnSave = document.createElement('button');
    // 按钮文字
    btnSave.innerText = '保存';
    // 添加按钮的样式类名class值为saveBtn
    btnSave.setAttribute('class', 'saveBtn');
    // 生成style标签
    var styleSave = document.createElement('style');
    // 把样式写进去
    styleSave.innerText = `.saveBtn{position:fixed;top:150px;right:150px;width:75px;height:55px;padding:3px 5px;border:1px solid #008000;cursor:pointer;color:#008000;font-size:14px;background-color:transparent;border-radius:5px;transition:color .15s ease-in-out,background-color .15s ease-in-out;z-index:9999999999999;}.saveBtn:hover{background-color:#008000;color:#fff;}`;
    // 在head中添加style标签
    document.head.appendChild(styleSave);
    // 在body中添加button按钮
    document.body.appendChild(btnSave);
    // 点击按钮去执行一键全选函数 saveAll
    document.querySelector('.saveBtn').addEventListener('click', function () {
        saveAll();
    })

    // 一键全选函数
    function chooseAll() {

    //所在村
    document.querySelectorAll(".ui-grid-row")[4].children[3].childNodes[1].childNodes[2].childNodes[1].childNodes[1].childNodes[12].click();

    document.querySelectorAll(".ui-dropdown-item")[17].click()

    //民族
    document.querySelectorAll(".ui-grid-row")[6].children[3].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[1].click();

    //政治面貌
    document.querySelectorAll(".ui-grid-row")[6].children[5].children[0].children[0].children[0].children[0].children[1].click();
    document.querySelectorAll(".ui-dropdown-item")[4].click();

    //入户道路是否硬化
    document.querySelectorAll(".ui-grid-row")[8].children[1].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //是否通自来水

    document.querySelectorAll(".ui-grid-row")[9].children[1].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //间隔是否低于24小时
    document.querySelectorAll(".ui-grid-row")[9].children[3].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //是否饮水安全
    document.querySelectorAll(".ui-grid-row")[9].children[5].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //是否使用清洁能源
    document.querySelectorAll(".ui-grid-row")[10].children[1].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //使用清洁能源的类型
    document.querySelectorAll(".ui-grid-row")[10].children[3].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-multiselect-item")[4].click();

    //其他备注
    var event = new Event("input");
    document.querySelectorAll(".ui-grid-col-2")[32].children[0].value = "液化气";
    document.querySelectorAll(".ui-grid-col-2")[32].children[0].dispatchEvent(event);

    //是否危房
    document.querySelectorAll(".ui-grid-row")[11].children[1].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[1].click();

    //是否有淋浴设施
    document.querySelectorAll(".ui-grid-row")[11].children[5].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //是否有卫生户厕
    document.querySelectorAll(".ui-grid-row")[12].children[1].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //卫生厕所类型
    document.querySelectorAll(".ui-grid-row")[12].children[3].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[1].click();

    //卫生厕所是否能正常使用
    document.querySelectorAll(".ui-grid-row")[12].children[5].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    //卫生户厕是否入室
    document.querySelectorAll(".ui-grid-row")[13].children[1].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();


    //卫生户厕是否入院
    document.querySelectorAll(".ui-grid-row")[13].children[3].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[1].click();


    //是否进行过庭院美化
    document.querySelectorAll(".ui-grid-row")[14].children[1].children[0].children[0].children[0].children[0].children[2].children[0].click();
    document.querySelectorAll(".ui-dropdown-item")[2].click();

    }
    
    // 保存函数
    function saveAll() {
        if(document.querySelector("#on_save")){
            document.querySelector("#on_save").click();
        }
/*
        else if(document.querySelector(".swal2-confirm")){
            document.querySelector(".swal2-confirm").click();
        }
        */
        setTimeout('document.querySelector(".swal2-confirm").click();',700);
    }
    
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址