AHTJ

快速填充

当前为 2024-06-03 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         AHTJ
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  快速填充
// @author       Ck
// @match        http://117.68.0.190:9090/stj-web/index/inspect/report/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 创建一个容器用于放置单选框和按钮
    const container = document.createElement('div');
    container.id = 'radio-container';
    container.style.position = 'fixed';
    container.style.bottom = '225px';
    container.style.left = '10px';
    container.style.backgroundColor = 'white';
    container.style.border = '1px solid black';
    container.style.padding = '10px';
    container.style.zIndex = 10000; // 确保在最上层显示

    // 创建单选框组
    const groups = [
        {
            name: 'group1',
            options: [
                { id: 'g1-option1', label: '无修改单 ', action: () => {
                    document.getElementById('17026367891076a46').lastElementChild.lastElementChild.innerHTML='/'//旁路(1)
        document.getElementById('17026367891070e74').lastElementChild.lastElementChild.innerHTML='/'//旁路(2)
        document.getElementById('1702636789107fe21').lastElementChild.lastElementChild.innerHTML='/'//旁路(3)
        document.getElementById('17026367891075fa7').lastElementChild.lastElementChild.innerHTML='/'//旁路(4)
        document.getElementById('1702637271087a233').lastElementChild.lastElementChild.innerHTML='/'//抱闸反馈
        document.getElementById('1713594974152179e').lastElementChild.lastElementChild.innerHTML='/'//意外移动(1)
        document.getElementById('1713594974152ef0e').lastElementChild.lastElementChild.innerHTML='/'//意外移动(2)
        document.getElementById('1713594974152c607').lastElementChild.lastElementChild.innerHTML='/'//意外移动(3)
        document.getElementById('1713594974152540d').lastElementChild.lastElementChild.innerHTML='/' } },
                { id: 'g1-option2', label: '有修改单', action: () => {
                    document.getElementById('17026367891076a46').lastElementChild.lastElementChild.innerHTML='√'//旁路(1)
        document.getElementById('17026367891070e74').lastElementChild.lastElementChild.innerHTML='√'//旁路(2)
        document.getElementById('1702636789107fe21').lastElementChild.lastElementChild.innerHTML='√'//旁路(3)
        document.getElementById('17026367891075fa7').lastElementChild.lastElementChild.innerHTML='√'//旁路(4)
        document.getElementById('1702637271087a233').lastElementChild.lastElementChild.innerHTML='√'//抱闸反馈
        document.getElementById('1713594974152179e').lastElementChild.lastElementChild.innerHTML='√'//意外移动(1)
        document.getElementById('1713594974152ef0e').lastElementChild.lastElementChild.innerHTML='√'//意外移动(2)
        document.getElementById('1713594974152c607').lastElementChild.lastElementChild.innerHTML='√'//意外移动(3)
        document.getElementById('1713594974152540d').lastElementChild.lastElementChild.innerHTML='√'} }//意外移动(4)
            ]
        },
        {
            name: 'group2',
            options: [
                { id: 'g2-option1', label: '非超15年', action: () => {
//                    document.getElementById('170486608684702b3').lastElementChild.innerHTML='/'//下次检测日期
        document.getElementById('1700887220897d0b').lastElementChild.innerHTML='/'//接地保护
        document.getElementById('1702639220238f5df').lastElementChild.innerHTML='/'//钢丝绳1
        document.getElementById('1700709338998a55').lastElementChild.innerHTML='/'//钢丝绳2
        document.getElementById('1700887671315b62').lastElementChild.innerHTML='/'//端部固定
        document.getElementById('17007072568871c6').lastElementChild.innerHTML='/'//门间隙1
        document.getElementById('1702640903045fe9a').lastElementChild.innerHTML='/' } },
                { id: 'g2-option2', label: '超15年', action: () => {
                    document.getElementById('170486608684702b3').lastElementChild.innerHTML='/'//下次检测日期
        document.getElementById('1700887220897d0b').lastElementChild.innerHTML='√'//接地保护
        document.getElementById('1702639220238f5df').lastElementChild.innerHTML='√'//钢丝绳1
        document.getElementById('1700709338998a55').lastElementChild.innerHTML='√'//钢丝绳2
        document.getElementById('1700887671315b62').lastElementChild.innerHTML='√'//端部固定
        document.getElementById('17007072568871c6').lastElementChild.innerHTML='√'//门间隙1
        document.getElementById('1702640903045fe9a').lastElementChild.innerHTML='√' } }//门间隙2
            ]
        },
        {
            name: 'group3',
            options: [
                { id: 'g3-option1', label: '有机房    ', action: () => {
        document.getElementById('1702637271088688c').lastElementChild.lastElementChild.innerHTML='/'//动态测试
        document.getElementById('17026372710884f0d').lastElementChild.lastElementChild.innerHTML='/'//1m急停
        document.getElementById('1702639100103ce9e').lastElementChild.lastElementChild.innerHTML='√'//盘车(3)
        document.getElementById('17026391001038eb2').lastElementChild.lastElementChild.innerHTML='√'; } },
                { id: 'g3-option2', label: '无机房', action: () => {


        document.getElementById('1702637271088688c').lastElementChild.lastElementChild.innerHTML='√'//动态测试
        document.getElementById('17026372710884f0d').lastElementChild.lastElementChild.innerHTML='√'//1m急停
        document.getElementById('1702639100103ce9e').lastElementChild.lastElementChild.innerHTML='/'//盘车(3)
        document.getElementById('17026391001038eb2').lastElementChild.lastElementChild.innerHTML='/' } }//盘车(4)
            ]
        },
        {
            name: 'group4',
            options: [
                { id: 'g4-option1', label: '耗能   ', action: () => { document.getElementById('170263678910675f3').lastElementChild.lastElementChild.innerHTML='√' } },
                { id: 'g4-option2', label: '蓄能', action: () => { document.getElementById('170263678910675f3').lastElementChild.lastElementChild.innerHTML='/' } }
            ]
        },
        {
            name: 'group5',
            options: [
                { id: 'g5-option1', label: '有紧急电动', action: () => { document.getElementById('17026372710875e45').lastElementChild.lastElementChild.innerHTML='√'
                                                                  document.getElementById('17026372710880e9a').lastElementChild.lastElementChild.innerHTML='√' } },
                { id: 'g5-option2', label: '无紧急电动', action: () => { document.getElementById('17026372710875e45').lastElementChild.lastElementChild.innerHTML='/'
                                                                  document.getElementById('17026372710880e9a').lastElementChild.lastElementChild.innerHTML='/' } }
            ]
        },
        {
            name: 'group6',
            options: [
                { id: 'g6-option1', label: '需要拆解 ', action: () => { document.getElementById('17026372710898779').lastElementChild.lastElementChild.innerHTML='√'} },
                { id: 'g6-option2', label: '不需要拆解', action: () => { document.getElementById('17026372710898779').lastElementChild.lastElementChild.innerHTML='/'} }
            ]
        },
        {
            name: 'group7',
            options: [
                { id: 'g7-option1', label: '有盘车  ', action: () => { document.getElementById('1702639100103ce9e').lastElementChild.lastElementChild.innerHTML='√'
        document.getElementById('17026391001038eb2').lastElementChild.lastElementChild.innerHTML='√' } },
                { id: 'g7-option2', label: '无盘车', action: () => { document.getElementById('1702639100103ce9e').lastElementChild.lastElementChild.innerHTML='/'
        document.getElementById('17026391001038eb2').lastElementChild.lastElementChild.innerHTML='/' } }
            ]
        },
        {
            name: 'group8',
            options: [
                { id: 'g8-option1', label: '无伸长保护', action: () => { document.getElementById('1702640008268dd6e').lastElementChild.lastElementChild.innerHTML='/' } },
                { id: 'g8-option2', label: '有伸长保护', action: () => { document.getElementById('1702640008268dd6e').lastElementChild.lastElementChild.innerHTML='√' } }
            ]
        },
        {
            name: 'group9',
            options: [
                { id: 'g9-option1', label: '金属反绳轮', action: () => {document.getElementById('1702640008268acd4').lastElementChild.lastElementChild.innerHTML='/'
    document.getElementById('1702640008269889c').lastElementChild.lastElementChild.innerHTML='/'} },
                { id: 'g9-option2', label: '非金属反绳轮', action: () => { document.getElementById('1702640008268acd4').lastElementChild.lastElementChild.innerHTML='√'
    document.getElementById('1702640008269889c').lastElementChild.lastElementChild.innerHTML='√'} }
            ]
        },
        {
            name: 'group10',
            options: [
                { id: 'g10-option1', label: '无安全窗 ', action: () => { document.getElementById('17026400082690255').lastElementChild.lastElementChild.innerHTML='/'
              var currentDate = new Date();

    // 格式化日期
    var year = currentDate.getFullYear();
    var month = ('0' + (currentDate.getMonth() + 1)).slice(-2);
    var day = ('0' + currentDate.getDate()).slice(-2);

    // 生成格式化字符串
    var formattedDate = year + '年' + month + '月' + day + '日';

    // 输出格式化日期(可替换为所需的其他操作)
//    console.log(formattedDate);

    // 在页面上显示(可选)
//    var dateElement = document.createElement('div');
//    dateElement.textContent = formattedDate;
//    document.body.appendChild(dateElement);

    document.getElementById('1581261440012c13e').lastElementChild.innerHTML=formattedDate//
//    document.getElementById('1702640008269889c').lastElementChild.lastElementChild.innerHTML='/'//
           document.getElementById('1584177803141c102').lastElementChild.innerHTML=formattedDate//

document.getElementById('17014878067399fe6').lastElementChild.innerHTML='/'
document.getElementById('17041912859544faf').lastElementChild.innerHTML='/'

        document.getElementById('170264247697664b1').lastElementChild.lastElementChild.innerHTML='≥7mm'
                                                                   document.getElementById('17041912859544faf').lastElementChild.innerHTML='已按照安徽省市场监督管理局“皖市监办[2023]757号文”要求查验。'
        ;} },
                { id: 'g10-option2', label: '有安全窗', action: () => { document.getElementById('17026400082690255').lastElementChild.lastElementChild.innerHTML='√'
                                                                  var currentDate = new Date();

    // 格式化日期
    var year = currentDate.getFullYear();
    var month = ('0' + (currentDate.getMonth() + 1)).slice(-2);
    var day = ('0' + currentDate.getDate()).slice(-2);

    // 生成格式化字符串
    var formattedDate = year + '年' + month + '月' + day + '日';

    // 输出格式化日期(可替换为所需的其他操作)
//    console.log(formattedDate);

    // 在页面上显示(可选)
//    var dateElement = document.createElement('div');
//    dateElement.textContent = formattedDate;
//    document.body.appendChild(dateElement);

    document.getElementById('1581261440012c13e').lastElementChild.innerHTML=formattedDate//
//    document.getElementById('1702640008269889c').lastElementChild.lastElementChild.innerHTML='/'//
           document.getElementById('1584177803141c102').lastElementChild.innerHTML=formattedDate//

document.getElementById('17014878067399fe6').lastElementChild.innerHTML='/'
document.getElementById('17041912859544faf').lastElementChild.innerHTML='/'

        document.getElementById('170264247697664b1').lastElementChild.lastElementChild.innerHTML='≥7mm'
     document.getElementById('17041912859544faf').lastElementChild.innerHTML='已按照安徽省市场监督管理局“皖市监办[2023]757号文”要求查验。'} }
            ]
        },
        {
            name: 'group11',
            options: [
                { id: 'g11-option1', label: '重块', action: () => { document.getElementById('1706319611211eddb').lastElementChild.lastElementChild.innerHTML='√' } },
                { id: 'g11-option2', label: '弹簧', action: () => { document.getElementById('1706319611211eddb').lastElementChild.lastElementChild.innerHTML='/' } }
            ]
        }
    ];

    // 插入单选框到容器
    groups.forEach(group => {
        const groupContainer = document.createElement('div');
        groupContainer.style.display = 'flex';
        groupContainer.style.alignItems = 'center';
        groupContainer.style.marginBottom = '10px';

        group.options.forEach((option, index) => {
            const radio = document.createElement('input');
            radio.type = 'radio';
            radio.id = option.id;
            radio.name = group.name;
            radio.value = option.id;
            if (index === 0) {
                radio.checked = true; // 设置第一个选项为默认选项
            }

            const label = document.createElement('label');
            label.htmlFor = option.id;
            label.textContent = option.label;
            label.style.marginRight = '10px';
            label.style.minWidth = '70px'; // 设置一个最小宽度

            const optionContainer = document.createElement('div');
            optionContainer.style.display = 'flex';
            optionContainer.style.alignItems = 'center';
            optionContainer.style.marginRight = '10px';

            optionContainer.appendChild(radio);
            optionContainer.appendChild(label);
            groupContainer.appendChild(optionContainer);
        });

        container.appendChild(groupContainer);
    });

    // 创建并插入按钮
    const button = document.createElement('button');
    button.textContent = '快速填充';
    button.style.display = 'block';
    button.style.marginTop = '10px';

    button.addEventListener('click', () => {
        groups.forEach(group => {
            const selected = document.querySelector(`input[name="${group.name}"]:checked`);
            if (selected) {
                const option = group.options.find(opt => opt.id === selected.value);
                if (option && option.action) {
                    option.action(); // 执行对应的函数
                }
            }
        });
    });
    const newButton = document.createElement('button');
    newButton.textContent = '一键出具复检';
    newButton.style.display = 'inline-block';
//    newButton.style.marginLeft = '10px';
    newButton.style.marginTop = '10px';

    // 新按钮点击事件
    newButton.addEventListener('click', () => {
        var parentElement = document.getElementById('1581261440012c13e');
var dateElement = parentElement.querySelector('.widget-content[default-date="0"]');
var dateStr = dateElement.innerText.trim();
var dateParts = dateStr.match(/(\d{4})年(\d{2})月(\d{2})日/);
var year0 = parseInt(dateParts[1]) ;
var year1 = parseInt(dateParts[1]) + 1;
var year2 = parseInt(dateParts[1]) + 2;
var month = dateParts[2];         
var newDateStr0 = year0 + "年" + month + "月";      //检验日期   
var newDateStr1 = year1 + "年" + month + "月";      
var newDateStr2 = year2 + "年" + month + "月";                
var DATE1 = newDateStr1;
var DATE2 = newDateStr2;
document.getElementById('17048660889290048').lastElementChild.innerHTML=DATE2;
document.getElementById('170486608684702b3').lastElementChild.innerHTML=DATE1;
var currentDate = new Date();
var year = currentDate.getFullYear();
var month = ('0' + (currentDate.getMonth() + 1)).slice(-2);
var day = ('0' + currentDate.getDate()).slice(-2);
var formattedDate = year + '年' + month + '月' + day + '日';
document.getElementById('1581261440012c13e').lastElementChild.innerHTML=formattedDate;
var Str1 = newDateStr0;
var Str2element = document.getElementById('1555403108834bb43');
var Str2 = Str2element.querySelector('.widget-content').textContent.trim();
var Str3element = document.getElementById('17024767427623ef3');
var Str3 = Str3element.querySelector('.widget-content').textContent.trim();
var Str4element = document.getElementById('17024767480702d68');
var Str4 = Str4element.querySelector('.widget-content').textContent.trim();
console.log('本检验机构于'+Str1+'出具了编号为'+Str2+'的《电梯定期检验报告》。按照TSG T7001—2023的规定,本检验机构对该报告所对应的电梯中序号为'+Str3+Str4+'的项目进行了复检,出具本检验记录');
var StrBeizhu = '本检验机构于'+Str1+'出具了编号为'+Str2+'的《电梯定期检验报告》。按照TSG T7001—2023的规定,本检验机构对该报告所对应的电梯中序号为'+Str3+Str4+'的项目进行了复检,出具本检验记录'
document.getElementById('17041912859544faf').lastElementChild.innerHTML=StrBeizhu
document.getElementById('1702476745708a287').lastElementChild.innerHTML='0';
document.getElementById('17024767427623ef3').lastElementChild.innerHTML='/';
document.getElementById('1702476752677dcfe').lastElementChild.innerHTML='0';
document.getElementById('17024767480702d68').lastElementChild.innerHTML='/';
document.getElementById('1563606498846b3e9').lastElementChild.innerHTML='合格';
function replaceXWithCheck() {
        // Select all elements that might contain the value
        const elements = document.querySelectorAll('input, span, div, td'); // Add more selectors if needed

        elements.forEach((element) => {
            if (element.value === '×') {
                element.value = '√';
            } else if (element.textContent === '×') {
                element.textContent = '√';
            }
        });
    }

    // Run the function
    replaceXWithCheck();

    // Optional: Run the function whenever the DOM changes (e.g., if content is loaded dynamically)
    const observer = new MutationObserver(replaceXWithCheck);
    observer.observe(document.body, { childList: true, subtree: true });

        // 这里可以添加你想要执行的其他函数
    });

    container.appendChild(button);
  container.appendChild(newButton);
    document.body.appendChild(container);
})();