autoSetUp

自动设置

目前为 2021-07-30 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/430111/955759/autoSetUp.js

// ==UserScript==
// @name         autoSetUp
// @namespace    coderWyh
// @version      0.1.1
// @description  自动设置
// @author       coderWyh
// @match        http://www.gczl360.com:8084/Admin/ZLKGL/Template*
// @run-at       document-end
// ==/UserScript==
(function() {
'use strict';
$(".record_box>.slimScrollDiv").append("<div style='top: 5%;left: 2%' class='fixbtn autoSetUp'>自动设置</div>")
$(".autoSetUp").on('click',function () {
attrArray.length =0;
var sheet = spread.getActiveSheet();
var sheetIndex_c = spread.getActiveSheetIndex();
var colCount = sheet.getColumnCount();
const list = [];
const valueMap = [
    {name: '编号:', value: 'bh1'},
    {name: '编号', value: 'bh1'},
    {name: '单位(子单位)工程名称', value: 'p0102'},
    {name: '单位(子单位)工程名称', value: 'p0102'},
    {name: '单位工程名称', value: 'p0102'},
    {name: '施工单位', value: 'p0401'},
    {name: '施工单位名称', value: 'p0401'},
    {name: '项目负责人', value: 'p0404'},
    {name: '项目经理', value: 'p0404'},
    {name: '分包单位', value: 'p0411'},
    {name: '分包单位负责人', value: 'p0412'},
    {name: '分包项目经理', value: 'p0412'},
    {name: '分包单位项目负责人', value: 'p0412'},
    {name: '检验批容量', value: 'JYPRL'},
    {name: '检验批部位', value: 'p0116'},
    {name: '验收部位/区段', value: 'p0116'},
    {name: '检查记录', value: 's201403'},
    {name: '施工单位检查评定结果', value: 's201401'},
    {name: '施工单位检查结果', value: 's201401'},
    {name: '施工(分包)单位检查结果', value: 's201401'},
    {name: '施工(分包)单位检查结果', value: 's201401'},
    {name: '监理(建设)单位验收结论', value: 's201402'},
    {name: '监理(建设)单位验收结论', value: 's201402'},
    {name: '监理单位验收结论', value: 's201402'},
    {name: '施工员:', value: 'p0408'},
    {name: '专业工长:', value: 'p0408'},
    {name: '项目专业质量检查员:', value: 'p0406'},
    {name: '质量员:', value: 'p0406'},
    {name: '质检员:', value: 'p0406'},
    {name: '项目专业质量(技术)负责人:', value: 'p0407'},
    {name: '项目专业质量(技术)负责人:', value: 'p0407'},
    {name: '专业监理工程师:(建设单位项目技术负责人)', value: 'p0304'},
    {name: '专业监理工程师:(建设单位项目技术负责人)', value: 'p0304'},
    {name: '监理工程师(建设单位项目技术负责人):', value: 'p0304'},
    {name: '监理工程师(建设单位项目技术负责人):', value: 'p0304'},
    {name: '专业监理工程师:', value: 'p0304'},
    {name: '年月日', value: '日期'},
    {name: '工程名称', value: 'p0101'},
];
const valueList = [];
const length = valueMap.length;
var spanValue;
var oneValue;
var rowCount = sheet.getRowCount();
for (var i = 0; i < rowCount; i++) {
    for (var j = 0; j < colCount; j++) {
        var span = sheet.getSpans(new GC.Spread.Sheets.Range(i, j, 1, 1));
        if (span.length > 0) {
            if (list.length === 0) {
                spanValue = sheet.getText(i, j).replace(/\ +/g, "").replace(/[\r\n]/g, "");
                //TODO 判断内容
                if (spanValue !== "") {
                     valueMap.map((item,index,arr)=>{
     if (spanValue===item.name) {
         if (spanValue.indexOf(':')>=0&&spanValue.indexOf('编号')<0){
                                attrArray.push({
                                    sheetIndex: sheetIndex_c,
                                    row: span[0].row,
                                    col: span[0].col + span[0].colCount,
                                    value: item.value,
                                    type: 'sign'
                                  });
                                }
                                else {
                                    if (spanValue==='年月日'){
                                        attrArray.push({
                                            sheetIndex: sheetIndex_c,
                                            row: span[0].row,
                                            col: span[0].col,
                                            value: item.value,
                                            type: ''
                                    })
                                    }
                                    else if (spanValue==='检查记录'){
                                        for(let i =1;i<=rowCount;i++) {
                                            attrArray.push({
                                                sheetIndex: sheetIndex_c,
                                                row: span[0].row+i,
                                                col: span[0].col,
                                                value: item.value,
                                                type: ''
                                        })
                                    }
                                    }
                                    else {
                                    attrArray.push({
                                    sheetIndex: sheetIndex_c,
                                    row: span[0].row,
                                    col: span[0].col + span[0].colCount,
                                    value: item.value,
                                    type: ''
                                   })
                                   }
     }
     }
});
                    list.push(span[0])
            }
        } else {
            A:  for (var c = 0; c < list.length; c++) {
                for (var d = 0; d < list.length; d++) {
                    if (list[d] === span[0]) {
                        break A;
                    }
                }
                spanValue = sheet.getText(i, j).replace(/\ +/g, "").replace(/[\r\n]/g, "");
                //TODO 判断内容
                if (spanValue !== "") {
                     valueMap.map((item,index,arr)=>{
     if (spanValue===item.name) {
         if (spanValue.indexOf(':')>=0&&spanValue.indexOf('编号')<0){
                                attrArray.push({
                                    sheetIndex: sheetIndex_c,
                                    row: span[0].row,
                                    col: span[0].col + span[0].colCount,
                                    value: item.value,
                                    type: 'sign'
                                  });
                                }
                                else {
                                    if (spanValue==='年月日'){
                                        attrArray.push({
                                            sheetIndex: sheetIndex_c,
                                            row: span[0].row,
                                            col: span[0].col,
                                            value: item.value,
                                            type: ''
                                    })
                                    }
                                    else if (spanValue==='检查记录'){
                                        for(let i =1;i<=rowCount;i++) {
                                            attrArray.push({
                                                sheetIndex: sheetIndex_c,
                                                row: span[0].row+i,
                                                col: span[0].col,
                                                value: item.value,
                                                type: ''
                                        })
                                    }
                                    }
                                    else {
                                    attrArray.push({
                                    sheetIndex: sheetIndex_c,
                                    row: span[0].row,
                                    col: span[0].col + span[0].colCount,
                                    value: item.value,
                                    type: ''
                                   })
                                   }
     }
     }
});
                }
                list.push(span[0])
            }
        }
    }
else
    {
        oneValue = sheet.getText(i, j).replace(/\ +/g, "").replace(/[\r\n]/g, "");
        //TODO 判断内容
        if (oneValue !== "") {
             valueMap.map((item,index,arr)=>{
     if (spanValue===item.name) {
         if (spanValue.indexOf(':')>=0&&spanValue.indexOf('编号')<0){
                                attrArray.push({
                                    sheetIndex: sheetIndex_c,
                                    row: span[0].row,
                                    col: span[0].col + span[0].colCount,
                                    value: item.value,
                                    type: 'sign'
                                  });
                                }
                                else {
                                    if (spanValue==='年月日'){
                                        attrArray.push({
                                            sheetIndex: sheetIndex_c,
                                            row: span[0].row,
                                            col: span[0].col,
                                            value: item.value,
                                            type: ''
                                    })
                                    }
                                    else if (spanValue==='检查记录'){
                                        for(let i =1;i<=rowCount;i++) {
                                            attrArray.push({
                                                sheetIndex: sheetIndex_c,
                                                row: span[0].row+i,
                                                col: span[0].col,
                                                value: item.value,
                                                type: ''
                                        })
                                    }
                                    }
                                    else {
                                    attrArray.push({
                                    sheetIndex: sheetIndex_c,
                                    row: span[0].row,
                                    col: span[0].col + span[0].colCount,
                                    value: item.value,
                                    type: ''
                                   })
                                   }
     }
     }
});
        }
    }
}
}
}
);
})();

QingJ © 2025

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