AHTJ

快速填充

目前為 2024-05-30 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         AHTJ
// @namespace    http://tampermonkey.net/
// @version      1.00
// @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 = '10px';
    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';

            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', () => {
        alert('还没做好');
        // 这里可以添加你想要执行的其他函数
    });

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