Greasy Fork

Greasy Fork is available in English.

设置快捷键

This script is only for Chinese mainland users. The script function is to help Beijing Construction Research Company set up excel forms with one click

当前为 2021-08-11 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/430373/959235/%E8%AE%BE%E7%BD%AE%E5%BF%AB%E6%8D%B7%E9%94%AE.js

// ==UserScript==
// @name         设置快捷键
// @namespace    coderWyh
// @version      1.0.2
// @description  This script is only for Chinese mainland users. The script function is to help Beijing Construction Research Company set up excel forms with one click
// @author       coderWyh
// @match        http://www.gczl360.com:8084/Admin/ZLKGL/Template*
// @run-at       document-end
// @require      https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js
// ==/UserScript==
// 本代码所有权归作者所有 作者QQ:2471630907 手机号:18990193572  微信同手机号
// 本代码具有知识产权 未经作者授权严禁任何人进行使用、传播、二次开发等一系列损害作者知识产权的操作
// 作者对未经授权的操作保留起诉但不仅限于起诉的维护个人知识产权利益的法律途径
(function() {
    'use strict';
    let valueList = []
    let attrValue ;
    axios.post(BASEURL+'jky/value/getCodeValue/'+ShortcutButtonCode)
        .then(response =>{
        if (response.data.success) {
            valueList = response.data.data.valueList
            let Index = 2;
            attrValue = response.data.data.functionName
            valueList.forEach((item,index,arr) => {
                if(index%2==0){
                    $(".record_box>.slimScrollDiv").append("<div value='"+item.value+"' style='top:"+Index*7+"%;left: 2%' class='"+item.className+"'>"+item.name+"</div>")
                    Index++
                }else {
                    $(".record_box>.slimScrollDiv").append("<div value='"+item.value+"' style='top:"+((Index-1)*7)+"%;left: 40%' class='"+item.className+"'>"+item.name+"</div>")
                }
            })
            $(".easycellset").on('click',function() {
                var value=$(this).attr(attrValue+'');var sheetIndex=spread.getActiveSheetIndex();var sheet=spread.getActiveSheet();var selections=sheet.getSelections();for(var i=0;i<selections.length;i++){var row=selections[i].row;var col=selections[i].col;var rowCount=selections[i].rowCount;var colCount=selections[i].colCount;for(var x=0;x<rowCount;x++){for(var y=0;y<colCount;y++){var rowIndex=row+x;var colIndex=col+y;var span=sheet.getSpan(rowIndex,colIndex);if(span!=null){y+=(span.colCount-1);}for(var b=0;b<attrArray.length;b++){var item=attrArray[b];if(item.sheetIndex==sheetIndex&&item.row==rowIndex&&item.col==colIndex){item.value=value;item.type="";return;}}attrArray.push({sheetIndex:sheetIndex,row:rowIndex,col:colIndex,value:value,type:""});}var row_span=sheet.getSpan(row,col);if(row_span!=null){x+=(row_span.rowCount-1);}}}layer.msg("添加成功",{time:100});
            });
            $(".easycellset_sign").click(function () {
                var value=$(this).attr(attrValue+'');var sheetIndex=spread.getActiveSheetIndex();var sheet=spread.getActiveSheet();var selections=sheet.getSelections();for(var i=0;i<selections.length;i++){var row=selections[i].row;var col=selections[i].col;var rowCount=selections[i].rowCount;var colCount=selections[i].colCount;for(var x=0;x<rowCount;x++){for(var y=0;y<colCount;y++) {var rowIndex=row+x;var colIndex=col+y;var span=sheet.getSpan(rowIndex,colIndex);if(span!=null){y+=(span.colCount-1);}for(var a=0;a<attrArray.length;a++){var item=attrArray[a];if(item.sheetIndex==sheetIndex&&item.row==rowIndex&&item.col==colIndex){item.value=value;item.type="sign";return;}}var sign_attr={sheetIndex:sheetIndex,row:row,col:col,value:value,type:"sign"};attrArray.push(sign_attr);}var row_span=sheet.getSpan(row,col);if(row_span!=null){x+=(row_span.rowCount-1);}}}layer.msg("添加成功",{time: 400});
            });
            $(".autoSet").mydrag();
 
        } else {
            $(".record_box>.slimScrollDiv").append("<div style='position:absolute;top:40%;left:2%;background-color:red;border:1px;text-transform: uppercase;font-size: 14px;padding: 5px 10px;font-weight: 300;color:white' class='tips'>"+response.data.message+ShortcutButtonCode+"</div>")

        }
    })
        .catch(error =>{
        console.log(error);
    })
 
})();