setFormular.jsp 5.77 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" %> 
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="Generator" content="EditPlus®">
        <meta name="Author" content="">
        <meta name="Keywords" content="">
        <meta name="Description" content="">
        
        <title>Document</title>
        <link type="text/css" rel="stylesheet" href="/fna/exceldesign/css/formular.css"/>
    </head>

    <body>
        <div class="formular_info">
            <div class="formular_name"><span>公式名:</span><input /></div>
            <div class="head">选择函数(N):</div>
            <div class="selectFn">
                <p id="formula_Type_SUM">SUM</p>
                <p id="formula_Type_AVG">AVERAGE</p>                
                <p id="formula_Type_MAX">MAX</p>    
                <p id="formula_Type_MIN">MIN</p> 
                                              
            </div>
            <p class="word_description">描述:</p>
            <div class="description">
                <div>
                    <h6>SUM(number)</h6>
                    <h6>计算单元格区域中所有数值的和</h6>
                </div>
                <div>
                    <h6>AVERAGE</h6>
                    <h6>返回其参数的算术平均数;参数可以是数值或包含数值的名称、数组或引用</h6>
                </div>
                <div>
                    <h6>MAX(number)</h6>
                    <h6>返回一组数值中的最大值,忽略逻辑值及文本</h6>
                </div>
                <div>
                    <h6>MIN(number)</h6>
                    <h6>返回一组数值中的最小值,忽略逻辑值及文本</h6>
                </div>
            </div> 
            
            <div class="formular_info_footer">
                <button id="weaver-fna-formular-footer-sure" onclick="colseModal('sure')">确定</button>
                <button id="weaver-fna-formular-footer-cancel" onclick="colseModal('cancel')">取消</button>
            </div>
        </div>

        <script>
            var _name = '';
            var window_url = getQueryString();
            var parentWin = $('#_DialogFrame_'+window_url,window.top.document)[0].contentWindow;
            const dialogSet = window.top.getDialog(window);
            function getQueryString(){
                var query = window.location.search;
                var r = query.substr(1).split('=')[1];
                if(r!=null) return  r; return null;
            }
          
            for(var i=0 ;i<parentWin.formulaObj_fna_cache.length;i++){
                var _cell = parentWin.formula_fna_params.formular_initCell.row + ',' + parentWin.formula_fna_params.formular_initCell.col;
                if(parentWin.formulaObj_fna_cache[i][3] == _cell){ 
                    _name = parentWin.formulaObj_fna_cache[i][1];
                    $('.formular_name input').val(_name);
                    parentWin.formulaObj_fna_cache.remove(parentWin.formulaObj_fna_cache[i]);
                }
                
            }

            
            // $('.description,.word_description').css({display:'none'})

            var selectFn_p = document.getElementsByClassName('selectFn')[0].getElementsByTagName('p');
            var description_div = document.getElementsByClassName('description')[0].getElementsByTagName('div');

            selectFn_p[0].style.cssText = 'background:#00a0ff;color:#fff;';
            description_div[0].style.display = 'block'
            for(var i=0;i<selectFn_p.length;i++ ){
                selectFn_p[i].index = i;
                selectFn_p[i].onclick = function(){
                    $('.description,.word_description').css({display:'block'})
                    for(var j=0;j<selectFn_p.length;j++ ){
                        selectFn_p[j].style.cssText = 'background:#fff;color:#666;';
                        description_div[j].style.display = 'none'
                    }   
                    this.style.cssText = 'background:#00a0ff;color:#fff;';
                    description_div[this.index].style.display = 'block';
                }
                
            }

            var type = 'SUM';
            var _arr = [];
            var formula_Type_SUM = document.getElementById('formula_Type_SUM');
            var formula_Type_AVERAGE = document.getElementById('formula_Type_AVG');
            var formula_Type_MAX = document.getElementById('formula_Type_MAX');
            var formula_Type_MIN = document.getElementById('formula_Type_MIN');

            // formula_Type_SUM.addEventListener('click',formula_Type('SUM'));
            // formula_Type_AVERAGE.addEventListener('click',formula_Type('AVERAGE'));
            // formula_Type_MAX.addEventListener('click',formula_Type('MAX'));
            // formula_Type_MIN.addEventListener('click',formula_Type('MIN'));
            formula_Type_SUM.addEventListener('click',function(){
                type = 'SUM'
            });
            formula_Type_AVG.addEventListener('click',function(){
                type = 'AVG'
            });
            formula_Type_MAX.addEventListener('click',function(){
                type = 'MAX'
            });
            formula_Type_MIN.addEventListener('click',function(){
                type = 'MIN'
            });

            function colseModal(op){
                if(op == 'sure'){
                    var value = document.getElementsByClassName('formular_name')[0].getElementsByTagName('input')[0].value;
                    _arr.push(type,value)
                    dialogSet.close(_arr);
                }else{
                    dialogSet.close(false);
                }
                
            }


        </script>
    </body>
</html>