forked from fanruan/demo-tabledata-redis
Compare commits
56 Commits
93 changed files with 5441 additions and 1992 deletions
@ -0,0 +1,128 @@
|
||||
|
||||
apply plugin: 'java' |
||||
|
||||
|
||||
ext { |
||||
/** |
||||
* 项目中依赖的jar的路径 |
||||
* 1.如果依赖的jar需要打包到zip中,放置在lib根目录下 |
||||
* 2.如果依赖的jar仅仅是编译时需要,防止在lib下子目录下即可 |
||||
*/ |
||||
libPath = "$projectDir/../webroot/WEB-INF/lib" |
||||
|
||||
/** |
||||
* 是否对插件的class进行加密保护,防止反编译 |
||||
*/ |
||||
guard = false |
||||
|
||||
def pluginInfo = getPluginInfo() |
||||
pluginPre = "fine-plugin" |
||||
pluginName = pluginInfo.id |
||||
pluginVersion = pluginInfo.version |
||||
|
||||
privateLib = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0" |
||||
outputPath = privateLib + "/classes" |
||||
} |
||||
|
||||
group = 'com.fr.plugin' |
||||
version = '10.0' |
||||
sourceCompatibility = '8' |
||||
|
||||
sourceSets { |
||||
main { |
||||
java.outputDir = file(outputPath) |
||||
output.resourcesDir = file(outputPath) |
||||
} |
||||
} |
||||
|
||||
ant.importBuild("encrypt.xml") |
||||
//定义ant变量 |
||||
ant.projectDir = projectDir |
||||
ant.references["compile.classpath"] = ant.path { |
||||
fileset(dir: libPath, includes: '**/*.jar') |
||||
fileset(dir: ".",includes:"**/*.jar" ) |
||||
} |
||||
|
||||
classes.dependsOn('clean') |
||||
|
||||
task copyFiles(type: Copy,dependsOn: 'classes'){ |
||||
from outputPath |
||||
into "$projectDir/classes" |
||||
} |
||||
|
||||
task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ |
||||
from "$projectDir/classes" |
||||
into "$projectDir/transform-classes" |
||||
include "**/*.*" |
||||
} |
||||
jar.dependsOn("preJar") |
||||
|
||||
task makeJar(type: Jar,dependsOn: preJar){ |
||||
from fileTree(dir: "$projectDir/transform-classes") |
||||
baseName pluginPre |
||||
appendix pluginName |
||||
version pluginVersion |
||||
destinationDir = file("$buildDir/libs") |
||||
|
||||
doLast(){ |
||||
delete file("$projectDir/classes") |
||||
delete file("$projectDir/transform-classes") |
||||
} |
||||
} |
||||
|
||||
task copyFile(type: Copy,dependsOn: ["makeJar"]){ |
||||
from "$buildDir/libs" |
||||
from("$projectDir/lib") { |
||||
include "*.jar" |
||||
} |
||||
from "$projectDir/plugin.xml" |
||||
into file("$buildDir/temp/plugin") |
||||
} |
||||
|
||||
task zip(type:Zip,dependsOn:["copyFile"]){ |
||||
from "$buildDir/temp/plugin" |
||||
destinationDir file("$buildDir/install") |
||||
baseName pluginPre |
||||
appendix pluginName |
||||
version pluginVersion |
||||
} |
||||
|
||||
//控制build时包含哪些文件,排除哪些文件 |
||||
processResources { |
||||
// exclude everything |
||||
// 用*.css没效果 |
||||
// exclude '**/*.css' |
||||
// except this file |
||||
// include 'xx.xml' |
||||
} |
||||
|
||||
/*读取plugin.xml中的version*/ |
||||
def getPluginInfo(){ |
||||
def xmlFile = file("plugin.xml") |
||||
if (!xmlFile.exists()) { |
||||
return ["id":"none", "version":"1.0.0"] |
||||
} |
||||
def plugin = new XmlParser().parse(xmlFile) |
||||
def version = plugin.version[0].text() |
||||
def id = plugin.id[0].text() |
||||
return ["id":id,"version":version] |
||||
} |
||||
|
||||
repositories { |
||||
mavenLocal() |
||||
maven { |
||||
url = uri('http://mvn.finedevelop.com/repository/maven-public/') |
||||
} |
||||
} |
||||
|
||||
task prepare(type: Copy) { |
||||
into privateLib |
||||
from configurations.runtimeClasspath |
||||
} |
||||
|
||||
dependencies { |
||||
//使用本地jar |
||||
implementation fileTree(dir: 'lib', include: ['**/*.jar']) |
||||
implementation fileTree(dir: libPath, include: ['**/*.jar']) |
||||
} |
||||
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<project> |
||||
<target name="compile_encrypt_javas" depends="copyFiles"> |
||||
<echo message="加密文件"/> |
||||
<echo message="${projectDir}"/> |
||||
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask"> |
||||
<classpath refid="compile.classpath"/> |
||||
</taskdef> |
||||
<pretreatment baseDir="${projectDir}"/> |
||||
</target> |
||||
<target name="compile_plain_javas" depends="copyFiles"> |
||||
</target> |
||||
</project> |
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
distributionUrl=https\://downloads.gradle-dn.com/distributions/gradle-6.3-bin.zip |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env sh |
||||
|
||||
# |
||||
# Copyright 2015 the original author or authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# https://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
############################################################################## |
||||
## |
||||
## Gradle start up script for UN*X |
||||
## |
||||
############################################################################## |
||||
|
||||
# Attempt to set APP_HOME |
||||
# Resolve links: $0 may be a link |
||||
PRG="$0" |
||||
# Need this for relative symlinks. |
||||
while [ -h "$PRG" ] ; do |
||||
ls=`ls -ld "$PRG"` |
||||
link=`expr "$ls" : '.*-> \(.*\)$'` |
||||
if expr "$link" : '/.*' > /dev/null; then |
||||
PRG="$link" |
||||
else |
||||
PRG=`dirname "$PRG"`"/$link" |
||||
fi |
||||
done |
||||
SAVED="`pwd`" |
||||
cd "`dirname \"$PRG\"`/" >/dev/null |
||||
APP_HOME="`pwd -P`" |
||||
cd "$SAVED" >/dev/null |
||||
|
||||
APP_NAME="Gradle" |
||||
APP_BASE_NAME=`basename "$0"` |
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' |
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value. |
||||
MAX_FD="maximum" |
||||
|
||||
warn () { |
||||
echo "$*" |
||||
} |
||||
|
||||
die () { |
||||
echo |
||||
echo "$*" |
||||
echo |
||||
exit 1 |
||||
} |
||||
|
||||
# OS specific support (must be 'true' or 'false'). |
||||
cygwin=false |
||||
msys=false |
||||
darwin=false |
||||
nonstop=false |
||||
case "`uname`" in |
||||
CYGWIN* ) |
||||
cygwin=true |
||||
;; |
||||
Darwin* ) |
||||
darwin=true |
||||
;; |
||||
MINGW* ) |
||||
msys=true |
||||
;; |
||||
NONSTOP* ) |
||||
nonstop=true |
||||
;; |
||||
esac |
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar |
||||
|
||||
# Determine the Java command to use to start the JVM. |
||||
if [ -n "$JAVA_HOME" ] ; then |
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
||||
# IBM's JDK on AIX uses strange locations for the executables |
||||
JAVACMD="$JAVA_HOME/jre/sh/java" |
||||
else |
||||
JAVACMD="$JAVA_HOME/bin/java" |
||||
fi |
||||
if [ ! -x "$JAVACMD" ] ; then |
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME |
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the |
||||
location of your Java installation." |
||||
fi |
||||
else |
||||
JAVACMD="java" |
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. |
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the |
||||
location of your Java installation." |
||||
fi |
||||
|
||||
# Increase the maximum file descriptors if we can. |
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then |
||||
MAX_FD_LIMIT=`ulimit -H -n` |
||||
if [ $? -eq 0 ] ; then |
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then |
||||
MAX_FD="$MAX_FD_LIMIT" |
||||
fi |
||||
ulimit -n $MAX_FD |
||||
if [ $? -ne 0 ] ; then |
||||
warn "Could not set maximum file descriptor limit: $MAX_FD" |
||||
fi |
||||
else |
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" |
||||
fi |
||||
fi |
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock |
||||
if $darwin; then |
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" |
||||
fi |
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java |
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then |
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"` |
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` |
||||
JAVACMD=`cygpath --unix "$JAVACMD"` |
||||
|
||||
# We build the pattern for arguments to be converted via cygpath |
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` |
||||
SEP="" |
||||
for dir in $ROOTDIRSRAW ; do |
||||
ROOTDIRS="$ROOTDIRS$SEP$dir" |
||||
SEP="|" |
||||
done |
||||
OURCYGPATTERN="(^($ROOTDIRS))" |
||||
# Add a user-defined pattern to the cygpath arguments |
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then |
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" |
||||
fi |
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh |
||||
i=0 |
||||
for arg in "$@" ; do |
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` |
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option |
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition |
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` |
||||
else |
||||
eval `echo args$i`="\"$arg\"" |
||||
fi |
||||
i=`expr $i + 1` |
||||
done |
||||
case $i in |
||||
0) set -- ;; |
||||
1) set -- "$args0" ;; |
||||
2) set -- "$args0" "$args1" ;; |
||||
3) set -- "$args0" "$args1" "$args2" ;; |
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;; |
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; |
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; |
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; |
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; |
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; |
||||
esac |
||||
fi |
||||
|
||||
# Escape application args |
||||
save () { |
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done |
||||
echo " " |
||||
} |
||||
APP_ARGS=`save "$@"` |
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules |
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" |
||||
|
||||
exec "$JAVACMD" "$@" |
@ -0,0 +1,103 @@
|
||||
@rem |
||||
@rem Copyright 2015 the original author or authors. |
||||
@rem |
||||
@rem Licensed under the Apache License, Version 2.0 (the "License"); |
||||
@rem you may not use this file except in compliance with the License. |
||||
@rem You may obtain a copy of the License at |
||||
@rem |
||||
@rem https://www.apache.org/licenses/LICENSE-2.0 |
||||
@rem |
||||
@rem Unless required by applicable law or agreed to in writing, software |
||||
@rem distributed under the License is distributed on an "AS IS" BASIS, |
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
@rem See the License for the specific language governing permissions and |
||||
@rem limitations under the License. |
||||
@rem |
||||
|
||||
@if "%DEBUG%" == "" @echo off |
||||
@rem ########################################################################## |
||||
@rem |
||||
@rem Gradle startup script for Windows |
||||
@rem |
||||
@rem ########################################################################## |
||||
|
||||
@rem Set local scope for the variables with windows NT shell |
||||
if "%OS%"=="Windows_NT" setlocal |
||||
|
||||
set DIRNAME=%~dp0 |
||||
if "%DIRNAME%" == "" set DIRNAME=. |
||||
set APP_BASE_NAME=%~n0 |
||||
set APP_HOME=%DIRNAME% |
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter. |
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi |
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" |
||||
|
||||
@rem Find java.exe |
||||
if defined JAVA_HOME goto findJavaFromJavaHome |
||||
|
||||
set JAVA_EXE=java.exe |
||||
%JAVA_EXE% -version >NUL 2>&1 |
||||
if "%ERRORLEVEL%" == "0" goto init |
||||
|
||||
echo. |
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. |
||||
echo. |
||||
echo Please set the JAVA_HOME variable in your environment to match the |
||||
echo location of your Java installation. |
||||
|
||||
goto fail |
||||
|
||||
:findJavaFromJavaHome |
||||
set JAVA_HOME=%JAVA_HOME:"=% |
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe |
||||
|
||||
if exist "%JAVA_EXE%" goto init |
||||
|
||||
echo. |
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% |
||||
echo. |
||||
echo Please set the JAVA_HOME variable in your environment to match the |
||||
echo location of your Java installation. |
||||
|
||||
goto fail |
||||
|
||||
:init |
||||
@rem Get command-line arguments, handling Windows variants |
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args |
||||
|
||||
:win9xME_args |
||||
@rem Slurp the command line arguments. |
||||
set CMD_LINE_ARGS= |
||||
set _SKIP=2 |
||||
|
||||
:win9xME_args_slurp |
||||
if "x%~1" == "x" goto execute |
||||
|
||||
set CMD_LINE_ARGS=%* |
||||
|
||||
:execute |
||||
@rem Setup the command line |
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar |
||||
|
||||
@rem Execute Gradle |
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% |
||||
|
||||
:end |
||||
@rem End local scope for the variables with windows NT shell |
||||
if "%ERRORLEVEL%"=="0" goto mainEnd |
||||
|
||||
:fail |
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of |
||||
rem the _cmd.exe /c_ return code! |
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 |
||||
exit /b 1 |
||||
|
||||
:mainEnd |
||||
if "%OS%"=="Windows_NT" endlocal |
||||
|
||||
:omega |
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
/* |
||||
* This file was generated by the Gradle 'init' task. |
||||
*/ |
||||
|
||||
rootProject.name = 'demo-tabledata-redis' |
After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,19 @@
|
||||
window.DecCst = { |
||||
Schedule: { |
||||
Parameter: { |
||||
Type: { |
||||
BOOLEAN: "Boolean", |
||||
DATA_SET: "TableColumn", |
||||
DATE: "Date", |
||||
DOUBLE: "Double", |
||||
FORMULA: "Formula", |
||||
INTEGER: "Integer", |
||||
STRING: "String", |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
window.Dec = { |
||||
fineServletURL: '/webroot/decision', |
||||
} |
@ -1,29 +1 @@
|
||||
module.exports = function(api) { |
||||
api.cache(true); |
||||
const presets = [ |
||||
[ |
||||
'@babel/preset-env', |
||||
{ |
||||
targets: { |
||||
ie: 9, |
||||
chrome: 47, |
||||
}, |
||||
}, |
||||
], |
||||
'@babel/preset-typescript', |
||||
]; |
||||
const plugins = [ |
||||
[ |
||||
'@babel/plugin-proposal-decorators', |
||||
{ |
||||
legacy: true, |
||||
}, |
||||
], |
||||
'@babel/plugin-proposal-class-properties', |
||||
]; |
||||
|
||||
return { |
||||
presets, |
||||
plugins, |
||||
}; |
||||
}; |
||||
module.exports = require('@fui/babel-preset-fineui').configs.base; |
||||
|
@ -1,16 +1,32 @@
|
||||
import { RedisShow } from './modules/app.show'; |
||||
import { RedisEdit } from './modules/app.edit'; |
||||
|
||||
const ConstantRedisType = 'dec.constant.database.conf.connect.types'; |
||||
const ConstantRedisShow = 'dec.constant.database.conf.connect.form.Redis.show'; |
||||
const ConstantRedisEdit = 'dec.constant.database.conf.connect.form.Redis.edit'; |
||||
import { RedisDataset } from './modules/app.dataset'; |
||||
import { RedisProgram } from './modules/app.program'; |
||||
|
||||
BI.DOM.ready(() => { |
||||
BI.config(ConstantRedisType, datas => [...datas, { |
||||
text: 'Redis', |
||||
databaseType: 'Redis', |
||||
iconUrl: 'com/fr/plugin/db/redis/images/redis.png', |
||||
}]); |
||||
BI.constant(ConstantRedisShow, RedisShow.xtype); |
||||
BI.constant(ConstantRedisEdit, RedisEdit.xtype); |
||||
BI.config('dec.connection.provider.datebase', provider => { |
||||
provider.registerDatabaseType({ |
||||
text: 'Redis', |
||||
databaseType: 'Redis', |
||||
iconUrl: 'com/fr/plugin/db/redis/images/redis.jpg', |
||||
edit: RedisEdit.xtype, |
||||
show: RedisShow.xtype, |
||||
}); |
||||
}); |
||||
|
||||
BI.config('dec.provider.data.set', provider => { |
||||
provider.registerDataSetType({ |
||||
value: 'Redis', |
||||
text: 'Redis数据集', |
||||
cardType: RedisDataset.xtype, |
||||
}); |
||||
}); |
||||
|
||||
BI.config('dec.provider.data.set', provider => { |
||||
provider.registerDataSetType({ |
||||
value: 'RedisScript', |
||||
text: 'Redis程序数据集', |
||||
cardType: RedisProgram.xtype, |
||||
}); |
||||
}); |
||||
}); |
||||
|
@ -1,2 +1,2 @@
|
||||
@import "../../node_modules/fineui/src/less/image.less"; |
||||
@import "../../node_modules/@fui/core/src/less/image.less"; |
||||
@import "./lib/background.less"; |
||||
|
@ -1,12 +1,13 @@
|
||||
@import "../../node_modules/fineui/src/less/resource/font.less"; |
||||
@import "../../node_modules/@fui/core/src/less/resource/font.less"; |
||||
@import "./lib/font.less"; |
||||
|
||||
.font(refresh-font, @font-refresh); |
||||
.font(redis-refresh-font, @font-redis-refresh); |
||||
.font(input-string-font, @font-input-string); |
||||
.font(input-formula-font, @font-input-formula); |
||||
.font(input-date-font, @font-input-date); |
||||
.font(input-boolean-font, @font-input-boolean); |
||||
.font(input-int-font, @font-input-int); |
||||
.font(input-number-font, @font-input-number); |
||||
.font(site-font, @font-site); |
||||
.font(column-font, @font-column); |
||||
.font(redis-site-font, @font-redis-site); |
||||
.font(redis-column-font, @font-redis-column); |
||||
.font(redis-preview-font, @font-redis-preview); |
@ -1 +1 @@
|
||||
@import '../../node_modules/fineui/src/less/visual.less'; |
||||
@import '../../node_modules/@fui/core/src/less/visual.less'; |
||||
|
@ -0,0 +1,33 @@
|
||||
export const redisParamHeader = [{ |
||||
text: BI.i18nText('Plugin-Redis_Set_Parameter_Name'), |
||||
}, { |
||||
text: BI.i18nText('Plugin-Redis_Set_Parameter_Type'), |
||||
}, { |
||||
text: BI.i18nText('Plugin-Redis_Set_Parameter_Value'), |
||||
}]; |
||||
|
||||
export const redisField = [{ |
||||
text: BI.i18nText('Dec-Basic_String'), |
||||
value: DecCst.Schedule.Parameter.Type.STRING, |
||||
iconCls: 'string-field-font', |
||||
}, { |
||||
text: BI.i18nText('Dec-Basic_Integer'), |
||||
value: DecCst.Schedule.Parameter.Type.INTEGER, |
||||
iconCls: 'number-field-font', |
||||
}, { |
||||
text: BI.i18nText('Dec-Basic_Double'), |
||||
value: DecCst.Schedule.Parameter.Type.DOUBLE, |
||||
iconCls: 'number-field-font', |
||||
}, { |
||||
text: BI.i18nText('Dec-Basic_Date'), |
||||
value: DecCst.Schedule.Parameter.Type.DATE, |
||||
iconCls: 'date-field-font', |
||||
}, { |
||||
text: BI.i18nText('Dec-Basic_Boolean'), |
||||
value: DecCst.Schedule.Parameter.Type.BOOLEAN, |
||||
iconCls: 'string-field-font', |
||||
}, { |
||||
text: BI.i18nText('Dec-Basic_Formula'), |
||||
value: DecCst.Schedule.Parameter.Type.FORMULA, |
||||
iconCls: 'string-field-font', |
||||
}]; |
@ -0,0 +1,7 @@
|
||||
@import '../less/index.less'; |
||||
|
||||
.param-table { |
||||
.dec-dynamic-date-combo .even-row { |
||||
background-color: @background-color-default; |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
import { model, Model } from './core/core'; |
||||
import { redisParamHeader } from './app.constant'; |
||||
@model() |
||||
export class RedisModel extends Model { |
||||
static xtype = 'dec.model.dcm.connection.plugin.redis' |
||||
context = ['dataSetName', 'ableSave'] |
||||
|
||||
state() { |
||||
return { |
||||
parameters: [] as ParameterType[], |
||||
}; |
||||
} |
||||
|
||||
actions = { |
||||
setAbleSave(ableSave: boolean) { |
||||
this.model.ableSave = ableSave; |
||||
}, |
||||
setParameters: (parameters: ParameterType[]) => { |
||||
this.model.parameters = parameters; |
||||
}, |
||||
setParamType: (index: number, type: string) => { |
||||
if (this.model.parameters[index].type !== type) { |
||||
this.model.parameters[index].type = type; |
||||
this.model.parameters[index].value = BI.Services.getService('dec.service.data.set').getDefaultValueByType(type); |
||||
this.model.parameters.splice(0, 0); |
||||
} |
||||
}, |
||||
setParamValue: (index: number, val: string) => { |
||||
this.model.parameters[index].value = val; |
||||
}, |
||||
} |
||||
|
||||
computed = { |
||||
paramHeader: () => redisParamHeader.map(item => BI.extend({ |
||||
textAlign: 'left', |
||||
height: 30, |
||||
hgap: 10, |
||||
}, item)), |
||||
} |
||||
} |
||||
|
||||
|
||||
export interface ParameterType { |
||||
name: string; |
||||
type: string; |
||||
value: string; |
||||
} |
@ -0,0 +1,22 @@
|
||||
import { model, Model } from '../../core/core'; |
||||
|
||||
@model() |
||||
export class DatabaseIndexModel extends Model { |
||||
static xtype = 'plugin.model.report.redis.components.database_index' |
||||
|
||||
state() { |
||||
return { |
||||
inputValue: '' as string | number, |
||||
inputType: 'int', |
||||
}; |
||||
} |
||||
|
||||
actions = { |
||||
setInpueValue: (value: string | number) => { |
||||
this.model.inputValue = value; |
||||
}, |
||||
setInputType: (value: string) => { |
||||
this.model.inputType = value; |
||||
}, |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
import { FormulaOpeartingPanel } from '@fui/materials'; |
||||
import { fetchFormulaConfig } from '../../crud/crud.request'; |
||||
|
||||
/** |
||||
* 打开公式编辑框 |
||||
*/ |
||||
export function openFormulaPopover<T extends {formula: string}>(value: T, inserterType: string = BI.RegularFormulaInserter.xtype): Promise<T> { |
||||
return new Promise((resolve, reject) => { |
||||
const id = BI.UUID(); |
||||
|
||||
let formulaPane: FormulaOpeartingPanel; |
||||
|
||||
BI.Popovers.create(id, { |
||||
type: BI.BarPopover.xtype, |
||||
width: 900, |
||||
height: 600, |
||||
header: BI.i18nText('Plugin-JSON_Function_Definition'), |
||||
body: { |
||||
type: BI.FormulaOpeartingPanel.xtype, |
||||
configLoader: fetchFormulaConfig, |
||||
ref: (_ref: FormulaOpeartingPanel) => { |
||||
formulaPane = _ref; |
||||
}, |
||||
inserterType, |
||||
value, |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Popover.EVENT_CANCEL, |
||||
action: () => { |
||||
reject(); |
||||
|
||||
BI.Popovers.remove(id); |
||||
}, |
||||
}, { |
||||
eventName: BI.Popover.EVENT_CONFIRM, |
||||
action: () => { |
||||
resolve(formulaPane.getValue() as T); |
||||
|
||||
BI.Popovers.remove(id); |
||||
}, |
||||
}], |
||||
}).open(id); |
||||
}); |
||||
} |
@ -0,0 +1,85 @@
|
||||
import { shortcut, store } from '@core/core'; |
||||
import { DatabaseIndexModel } from './database_index.model'; |
||||
import { openFormulaPopover } from './database_index.service'; |
||||
|
||||
@shortcut() |
||||
@store(DatabaseIndexModel) |
||||
export class DatabaseIndex extends BI.Widget { |
||||
static xtype = 'plugin.report.redis.components.database_index' |
||||
|
||||
databaseIndexTab: any; |
||||
textEditor: any; |
||||
formulaPane: any; |
||||
|
||||
model: DatabaseIndexModel['model'] |
||||
store: DatabaseIndexModel['store'] |
||||
|
||||
props = { |
||||
value: '', |
||||
inputType: 'int', |
||||
} |
||||
|
||||
render() { |
||||
const { value, inputType } = this.options; |
||||
this.store.setInpueValue(value); |
||||
this.store.setInputType(inputType); |
||||
|
||||
return { |
||||
type: BI.Tab.xtype, |
||||
single: true, |
||||
showIndex: this.model.inputType, |
||||
ref: (_ref: any) => { |
||||
this.databaseIndexTab = _ref; |
||||
}, |
||||
cardCreator: (index: 'int'|'formula') => { |
||||
if (index === 'int') { |
||||
return { |
||||
type: BI.TextEditor.xtype, |
||||
warningTitle: '', |
||||
value: parseInt(this.model.inputValue as string, 10) || 0, |
||||
validationChecker: (v: string) => this.checkInteger(v), |
||||
errorText: BI.i18nText('Plugin-Redis_Check_Integer'), |
||||
listeners: [{ |
||||
eventName: 'EVENT_CHANGE', |
||||
action: () => { |
||||
this.store.setInpueValue(parseInt(this.textEditor.getValue(), 10)); |
||||
}, |
||||
}], |
||||
ref: (_ref: any) => { |
||||
this.textEditor = _ref; |
||||
}, |
||||
}; |
||||
} |
||||
|
||||
return { |
||||
type: BI.TextEditor.xtype, |
||||
allowBlank: true, |
||||
value: this.model.inputValue, |
||||
ref: (_ref: any) => { |
||||
this.formulaPane = _ref; |
||||
}, |
||||
}; |
||||
}, |
||||
}; |
||||
} |
||||
private checkInteger(value: string) { |
||||
return /^[\d]+$/.test(value); |
||||
} |
||||
|
||||
public setSelect(value: string) { |
||||
this.databaseIndexTab.setSelect(value); |
||||
this.store.setInputType(value); |
||||
if (value === 'formula') { |
||||
openFormulaPopover({ |
||||
formula: this.model.inputValue === 0 ? '' : this.model.inputValue as string, |
||||
}, BI.ComplexFormulaInserter.xtype).then(value => { |
||||
this.store.setInpueValue(value.formula); |
||||
this.formulaPane.setValue(value.formula); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
public getValue() { |
||||
return this.model.inputType === 'int' ? parseInt(`${this.model.inputValue}`, 10) : this.model.inputValue; |
||||
} |
||||
} |
@ -1,40 +0,0 @@
|
||||
import { model, Model } from '../../core/core'; |
||||
import { ParametersType } from './parameter.typings'; |
||||
|
||||
@model() |
||||
export class ParameterModel extends Model { |
||||
static xtype = 'plugin.model.report.json.components.parameter'; |
||||
|
||||
childContext = <const>['selectedId', 'parameters']; |
||||
|
||||
state() { |
||||
return { |
||||
parameters: [] as ParametersType[], |
||||
selectedId: '', |
||||
}; |
||||
} |
||||
|
||||
actions = { |
||||
setParameters: (parameters: ParametersType[]) => { |
||||
this.model.parameters = parameters; |
||||
}, |
||||
removeSelectedParameter: () => { |
||||
this.setParameters(this.model.parameters.filter(item => item.id !== this.model.selectedId)); |
||||
}, |
||||
move: (type: 'up'|'down') => { |
||||
if (this.model.selectedId) { |
||||
const index = this.model.parameters.findIndex(item => item.id === this.model.selectedId); |
||||
if (type === 'up' && index > 0) { |
||||
const oldItem = this.model.parameters.splice(index, 1)[0]; |
||||
this.model.parameters.splice(index - 1, 0, oldItem); |
||||
} |
||||
if (type === 'down' && index < this.model.parameters.length - 1) { |
||||
const oldItem = this.model.parameters.splice(index, 1)[0]; |
||||
this.model.parameters.splice(index + 1, 0, oldItem); |
||||
} |
||||
} |
||||
}, |
||||
} |
||||
} |
||||
|
||||
|
@ -1,172 +0,0 @@
|
||||
import { shortcut, store } from '../../core/core'; |
||||
import { VtapeXtype, LabelXtype, HtapeXtype, LeftRightVerticalAdaptLayoutXtype, IconButtonXtype, ButtonGroupXtype, VerticalXtype } from 'ui'; |
||||
import { ParameterInput } from './parameter_input/parameter_input'; |
||||
import { ParameterModel } from './parameter.model'; |
||||
import { ParametersType } from './parameter.typings'; |
||||
|
||||
@shortcut() |
||||
@store(ParameterModel) |
||||
export class Parameter extends BI.Widget { |
||||
static xtype = 'plugin.report.redis.components.parameter'; |
||||
props = { |
||||
title: '', |
||||
showRefresh: true, |
||||
height: 200, |
||||
value: [] as ParametersType[], |
||||
} |
||||
|
||||
parameterInputs: any; |
||||
|
||||
model: ParameterModel['model'] |
||||
store: ParameterModel['store'] |
||||
|
||||
watch = { |
||||
parameters: () => { |
||||
this.parameterInputs.populate(this.renderParameterInputs()); |
||||
}, |
||||
selectedId: (id: string) => { |
||||
this.parameterInputs.setValue(id); |
||||
}, |
||||
} |
||||
|
||||
render() { |
||||
const { title, showRefresh } = this.options; |
||||
this.setDefalue(); |
||||
|
||||
return { |
||||
type: VtapeXtype, |
||||
items: [{ |
||||
el: { |
||||
type: LeftRightVerticalAdaptLayoutXtype, |
||||
items: { |
||||
left: [{ |
||||
type: LabelXtype, |
||||
lgap: 2, |
||||
text: title, |
||||
textAlign: 'left', |
||||
}], |
||||
right: [{ |
||||
type: IconButtonXtype, |
||||
cls: 'text-add-tip-font', |
||||
width: 25, |
||||
title: BI.i18nText('Plugin-Redis_Parameter_Insert'), |
||||
handler: () => { |
||||
this.store.setParameters([{ |
||||
name: '', |
||||
value: '', |
||||
id: BI.UUID(), |
||||
type: 'string', |
||||
}, ...this.model.parameters]); |
||||
}, |
||||
}, { |
||||
type: IconButtonXtype, |
||||
cls: 'close-font bi-error', |
||||
width: 25, |
||||
title: BI.i18nText('Plugin-Redis_Parameter_Delete'), |
||||
handler: () => { |
||||
if (this.model.selectedId) { |
||||
BI.Msg.confirm(BI.i18nText('BI-Basic_Prompt'), BI.i18nText('Plugin-Redis_Parameter_Delete_Confirm'), (re: boolean) => { |
||||
if (re) { |
||||
this.store.removeSelectedParameter(); |
||||
} |
||||
}); |
||||
} else { |
||||
BI.Msg.alert(BI.i18nText('BI-Basic_Prompt'), BI.i18nText('Plugin-Redis_Parameter_Delete_Alert')); |
||||
} |
||||
}, |
||||
}, { |
||||
type: IconButtonXtype, |
||||
cls: 'add-up-font', |
||||
width: 25, |
||||
title: BI.i18nText('Plugin-Redis_Parameter_Move_Up'), |
||||
handler: () => { |
||||
this.store.move('up'); |
||||
}, |
||||
}, { |
||||
type: IconButtonXtype, |
||||
cls: 'minus-down-font', |
||||
width: 25, |
||||
title: BI.i18nText('Plugin-Redis_Parameter_Move_Down'), |
||||
handler: () => { |
||||
this.store.move('down'); |
||||
}, |
||||
}, showRefresh ? { |
||||
type: IconButtonXtype, |
||||
cls: 'refresh-font', |
||||
width: 25, |
||||
title: BI.i18nText('Plugin-Redis_Parameter_Refresh'), |
||||
handler: () => { |
||||
this.setDefalue(); |
||||
}, |
||||
} : null], |
||||
}, |
||||
|
||||
}, |
||||
height: 25, |
||||
}, { |
||||
el: { |
||||
type: HtapeXtype, |
||||
cls: 'bi-border', |
||||
items: [{ |
||||
el: { |
||||
type: LabelXtype, |
||||
text: BI.i18nText('Plugin-Redis_Dataset_Parameter_Name'), |
||||
}, |
||||
width: 0.5, |
||||
}, { |
||||
el: { |
||||
type: LabelXtype, |
||||
cls: 'bi-border-left', |
||||
text: BI.i18nText('Plugin-Redis_Dataset_Parameter_Value'), |
||||
}, |
||||
width: 0.5, |
||||
}], |
||||
}, |
||||
height: 25, |
||||
}, { |
||||
type: ButtonGroupXtype, |
||||
cls: 'bi-border', |
||||
layouts: [{ |
||||
type: VerticalXtype, |
||||
}], |
||||
items: this.renderParameterInputs(), |
||||
ref: (_ref: any) => { |
||||
this.parameterInputs = _ref; |
||||
}, |
||||
}], |
||||
}; |
||||
} |
||||
|
||||
public getValue() { |
||||
return this.model.parameters.map(item => { |
||||
return { |
||||
name: item.name, |
||||
value: item.value, |
||||
type: item.type, |
||||
}; |
||||
}); |
||||
} |
||||
|
||||
private setDefalue() { |
||||
const { value = [] } = this.options; |
||||
this.store.setParameters(value.map(item => { |
||||
return { |
||||
...item, |
||||
id: BI.UUID(), |
||||
}; |
||||
})); |
||||
} |
||||
|
||||
private renderParameterInputs() { |
||||
return this.model.parameters.map(item => { |
||||
return { |
||||
type: ParameterInput.xtype, |
||||
inputName: item.name, |
||||
inputValue: item.value, |
||||
id: item.id, |
||||
value: item.id, |
||||
selected: item.id === this.model.selectedId, |
||||
}; |
||||
}); |
||||
} |
||||
} |
@ -1,9 +0,0 @@
|
||||
|
||||
export interface ParametersType { |
||||
name: string; |
||||
value: string; |
||||
id?: string; |
||||
type: inputTypes; |
||||
} |
||||
|
||||
export type inputTypes = 'string' | 'int' | 'number' | 'date' | 'boolean' | 'formula' |
@ -1,20 +0,0 @@
|
||||
import { inputTypes } from '../../parameter.typings'; |
||||
|
||||
const inputs: { |
||||
[key: string]: any; |
||||
} = {}; |
||||
|
||||
export function input(key: inputTypes): ClassDecorator { |
||||
return (target: object) => { |
||||
inputs[key] = target; |
||||
}; |
||||
} |
||||
|
||||
export function getInput(type: inputTypes): string { |
||||
const inputWidget = inputs[type]; |
||||
if (BI.isNull(inputWidget)) { |
||||
throw new TypeError(); |
||||
} |
||||
|
||||
return inputWidget.xtype; |
||||
} |
@ -1,6 +0,0 @@
|
||||
import './input_boolean'; |
||||
import './input_date'; |
||||
import './input_int'; |
||||
import './input_number'; |
||||
import './input_string'; |
||||
import './input_formula'; |
@ -1,41 +0,0 @@
|
||||
import { shortcut } from '../../../../core/core'; |
||||
import { MultiSelectItemXtype } from 'ui'; |
||||
import { input } from './input.service'; |
||||
|
||||
@shortcut() |
||||
@input('boolean') |
||||
export class InputBoolean extends BI.Widget { |
||||
static xtype = 'plugin.report.json.components.parameter_input.boolean' |
||||
|
||||
props = { |
||||
value: '', |
||||
} |
||||
|
||||
input: any; |
||||
|
||||
render() { |
||||
const { value } = this.options; |
||||
|
||||
return { |
||||
type: MultiSelectItemXtype, |
||||
width: 80, |
||||
selected: !!value, |
||||
text: 'true', |
||||
ref: (_ref: any) => { |
||||
this.input = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.input.getValue(); |
||||
this.fireEvent('EVENT_CHANGE', value); |
||||
}, |
||||
}, { |
||||
eventName: BI.TextEditor.EVENT_FOCUS, |
||||
action: () => { |
||||
this.fireEvent('EVENT_FOCUS'); |
||||
}, |
||||
}], |
||||
}; |
||||
} |
||||
} |
@ -1,42 +0,0 @@
|
||||
import { shortcut } from '../../../../core/core'; |
||||
import { DynamicDateComboXtype } from 'ui'; |
||||
import { input } from './input.service'; |
||||
|
||||
@shortcut() |
||||
@input('date') |
||||
export class InputDate extends BI.Widget { |
||||
static xtype = 'plugin.report.json.components.parameter_input.date' |
||||
|
||||
props = { |
||||
value: '', |
||||
} |
||||
|
||||
input: any; |
||||
|
||||
render() { |
||||
const { value } = this.options; |
||||
|
||||
return { |
||||
type: DynamicDateComboXtype, |
||||
height: 22, |
||||
allowBlank: true, |
||||
value, |
||||
ref: (_ref: any) => { |
||||
this.input = _ref; |
||||
}, |
||||
validationChecker: (v: string) => BI.isNumeric(v), |
||||
listeners: [{ |
||||
eventName: BI.TextEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.input.getValue(); |
||||
this.fireEvent('EVENT_CHANGE', value); |
||||
}, |
||||
}, { |
||||
eventName: BI.TextEditor.EVENT_FOCUS, |
||||
action: () => { |
||||
this.fireEvent('EVENT_FOCUS'); |
||||
}, |
||||
}], |
||||
}; |
||||
} |
||||
} |
@ -1,45 +0,0 @@
|
||||
import { shortcut } from '../../../../core/core'; |
||||
import { EditorXtype } from 'ui'; |
||||
import { input } from './input.service'; |
||||
|
||||
@shortcut() |
||||
@input('formula') |
||||
export class InputFormula extends BI.Widget { |
||||
static xtype = 'plugin.report.json.components.parameter_input.formula' |
||||
|
||||
props = { |
||||
value: '', |
||||
} |
||||
|
||||
input: any; |
||||
|
||||
mounted() { |
||||
|
||||
} |
||||
|
||||
render() { |
||||
const { value } = this.options; |
||||
|
||||
return { |
||||
type: EditorXtype, |
||||
height: 22, |
||||
allowBlank: true, |
||||
value, |
||||
ref: (_ref: any) => { |
||||
this.input = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.input.getValue(); |
||||
this.fireEvent('EVENT_CHANGE', value); |
||||
}, |
||||
}, { |
||||
eventName: BI.TextEditor.EVENT_FOCUS, |
||||
action: () => { |
||||
this.fireEvent('EVENT_FOCUS'); |
||||
}, |
||||
}], |
||||
}; |
||||
} |
||||
} |
@ -1,42 +0,0 @@
|
||||
import { shortcut } from '../../../../core/core'; |
||||
import { NumberEditorXtype } from 'ui'; |
||||
import { input } from './input.service'; |
||||
|
||||
@shortcut() |
||||
@input('int') |
||||
export class InputInt extends BI.Widget { |
||||
static xtype = 'plugin.report.json.components.parameter_input.int' |
||||
|
||||
props = { |
||||
value: '', |
||||
} |
||||
|
||||
input: any; |
||||
|
||||
render() { |
||||
const { value } = this.options; |
||||
|
||||
return { |
||||
type: NumberEditorXtype, |
||||
height: 22, |
||||
allowBlank: true, |
||||
value, |
||||
ref: (_ref: any) => { |
||||
this.input = _ref; |
||||
}, |
||||
validationChecker: (v: string) => BI.isInteger(v), |
||||
listeners: [{ |
||||
eventName: BI.TextEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.input.getValue(); |
||||
this.fireEvent('EVENT_CHANGE', value); |
||||
}, |
||||
}, { |
||||
eventName: BI.TextEditor.EVENT_FOCUS, |
||||
action: () => { |
||||
this.fireEvent('EVENT_FOCUS'); |
||||
}, |
||||
}], |
||||
}; |
||||
} |
||||
} |
@ -1,42 +0,0 @@
|
||||
import { shortcut } from '../../../../core/core'; |
||||
import { EditorXtype } from 'ui'; |
||||
import { input } from './input.service'; |
||||
|
||||
@shortcut() |
||||
@input('number') |
||||
export class InputNumber extends BI.Widget { |
||||
static xtype = 'plugin.report.json.components.parameter_input.number' |
||||
|
||||
props = { |
||||
value: '', |
||||
} |
||||
|
||||
input: any; |
||||
|
||||
render() { |
||||
const { value } = this.options; |
||||
|
||||
return { |
||||
type: EditorXtype, |
||||
height: 22, |
||||
allowBlank: true, |
||||
value, |
||||
ref: (_ref: any) => { |
||||
this.input = _ref; |
||||
}, |
||||
validationChecker: (v: string) => BI.isNumeric(v), |
||||
listeners: [{ |
||||
eventName: BI.TextEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.input.getValue(); |
||||
this.fireEvent('EVENT_CHANGE', value); |
||||
}, |
||||
}, { |
||||
eventName: BI.TextEditor.EVENT_FOCUS, |
||||
action: () => { |
||||
this.fireEvent('EVENT_FOCUS'); |
||||
}, |
||||
}], |
||||
}; |
||||
} |
||||
} |
@ -1,41 +0,0 @@
|
||||
import { shortcut } from '../../../../core/core'; |
||||
import { EditorXtype } from 'ui'; |
||||
import { input } from './input.service'; |
||||
|
||||
@shortcut() |
||||
@input('string') |
||||
export class InputString extends BI.Widget { |
||||
static xtype = 'plugin.report.json.components.parameter_input.string' |
||||
|
||||
props = { |
||||
value: '', |
||||
} |
||||
|
||||
input: any; |
||||
|
||||
render() { |
||||
const { value } = this.options; |
||||
|
||||
return { |
||||
type: EditorXtype, |
||||
height: 22, |
||||
allowBlank: true, |
||||
value, |
||||
ref: (_ref: any) => { |
||||
this.input = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.input.getValue(); |
||||
this.fireEvent('EVENT_CHANGE', value); |
||||
}, |
||||
}, { |
||||
eventName: BI.TextEditor.EVENT_FOCUS, |
||||
action: () => { |
||||
this.fireEvent('EVENT_FOCUS'); |
||||
}, |
||||
}], |
||||
}; |
||||
} |
||||
} |
@ -1,5 +0,0 @@
|
||||
@import '../../../../less/index.less'; |
||||
|
||||
.plugin-report-json-parameter-input.active{ |
||||
background-color: @color-bi-light-blue-60; |
||||
} |
@ -1,40 +0,0 @@
|
||||
import { model, Model } from '../../../core/core'; |
||||
import { ParameterModel } from '../parameter.model'; |
||||
import { inputTypes } from '../parameter.typings'; |
||||
|
||||
@model() |
||||
export class ParameterInputModel extends Model<{ |
||||
types: { |
||||
selectedId: ParameterModel['TYPE']['selectedId']; |
||||
parameters: ParameterModel['TYPE']['parameters']; |
||||
}, |
||||
context: ParameterInputModel['context']; |
||||
}> { |
||||
static xtype = 'plugin.model.report.json.components.parameter_input'; |
||||
|
||||
context = <const>['selectedId', 'parameters']; |
||||
|
||||
actions = { |
||||
setSelectedId: (id: string) => { |
||||
this.model.selectedId = id; |
||||
}, |
||||
setParameterName: (id: string, name: string) => { |
||||
const thisParameter = this.getParameter(id); |
||||
if (thisParameter) { |
||||
thisParameter.name = name; |
||||
} |
||||
}, |
||||
setParameterValue: (id: string, value: string, type: inputTypes) => { |
||||
const thisParameter = this.getParameter(id); |
||||
if (thisParameter) { |
||||
thisParameter.value = value; |
||||
thisParameter.type = type; |
||||
} |
||||
}, |
||||
} |
||||
private getParameter(id: string) { |
||||
return this.model.parameters.find(item => item.id === id); |
||||
} |
||||
} |
||||
|
||||
|
@ -1,165 +0,0 @@
|
||||
import { shortcut, store } from '../../../core/core'; |
||||
import { HtapeXtype, EditorXtype, TextButtonXtype, TabXtype, IconComboXtype } from 'ui'; |
||||
import { ParameterInputModel } from './parameter_input.model'; |
||||
import { inputTypes } from '../parameter.typings'; |
||||
import { getInput } from './input/input.service'; |
||||
import './input/input'; |
||||
import './parameter_input.less'; |
||||
|
||||
@shortcut() |
||||
@store(ParameterInputModel) |
||||
export class ParameterInput extends BI.BasicButton { |
||||
static xtype = 'plugin.report.json.components.parameter_input' |
||||
|
||||
props = { |
||||
inputName: '', |
||||
inputValue: '', |
||||
height: 22, |
||||
id: '', |
||||
baseCls: 'plugin-report-json-parameter-input', |
||||
} |
||||
|
||||
store: ParameterInputModel['store'] |
||||
model: ParameterInputModel['model'] |
||||
|
||||
tab: any; |
||||
parameterName: any; |
||||
parameterValue: any; |
||||
iconCombo: any; |
||||
|
||||
render() { |
||||
let { inputName, inputValue } = this.options; |
||||
const { id } = this.options; |
||||
|
||||
return { |
||||
type: HtapeXtype, |
||||
cls: 'bi-border', |
||||
items: [{ |
||||
el: { |
||||
type: EditorXtype, |
||||
height: 22, |
||||
allowBlank: true, |
||||
value: inputName, |
||||
ref: (_ref: any) => { |
||||
this.parameterName = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
inputName = this.parameterName.getValue(); |
||||
this.tab.setSelect(inputName ? 'string' : 'tip'); |
||||
inputValue = inputName ? inputValue : ''; |
||||
this.store.setParameterName(id, inputName); |
||||
}, |
||||
}, { |
||||
eventName: BI.TextEditor.EVENT_FOCUS, |
||||
action: () => { |
||||
this.store.setSelectedId(id); |
||||
}, |
||||
}], |
||||
}, |
||||
width: 0.5, |
||||
}, { |
||||
el: { |
||||
type: HtapeXtype, |
||||
items: [{ |
||||
type: TabXtype, |
||||
single: true, |
||||
showIndex: inputName ? 'string' : 'tip', |
||||
ref: (_ref: any) => { |
||||
this.tab = _ref; |
||||
}, |
||||
cardCreator: (index: inputTypes | 'tip') => this.renderInputs(index), |
||||
}], |
||||
}, |
||||
width: 0.5, |
||||
}], |
||||
}; |
||||
} |
||||
|
||||
private renderInputs(type: inputTypes | 'tip') { |
||||
const { inputValue, id } = this.options; |
||||
if (type === 'tip') { |
||||
return { |
||||
type: TextButtonXtype, |
||||
cls: 'bi-error bi-border-left', |
||||
text: BI.i18nText('Plugin-Redis_Parameter_Please_Set_Parameter_Name'), |
||||
handler: () => { |
||||
this.parameterName.focus(); |
||||
}, |
||||
}; |
||||
} |
||||
const xtype = getInput(type); |
||||
|
||||
return { |
||||
type: HtapeXtype, |
||||
items: [{ |
||||
el: { |
||||
type: IconComboXtype, |
||||
cls: 'bi-border-left bi-border-right', |
||||
height: 22, |
||||
width: 25, |
||||
value: type, |
||||
items: this.renderDownList(), |
||||
ref: (_ref: any) => { |
||||
this.iconCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: 'EVENT_CHANGE', |
||||
action: () => { |
||||
this.tab.setSelect('tip'); |
||||
const typeValue = this.iconCombo.getValue()[0]; |
||||
if (typeValue) { |
||||
this.tab.setSelect(typeValue); |
||||
} |
||||
}, |
||||
}], |
||||
}, |
||||
width: 25, |
||||
}, { |
||||
type: xtype, |
||||
value: inputValue, |
||||
listeners: [{ |
||||
eventName: 'EVENT_CHANGE', |
||||
action: (value: string) => { |
||||
const type = this.iconCombo.getValue()[0]; |
||||
this.store.setParameterValue(id, value, type); |
||||
}, |
||||
}, { |
||||
eventName: 'EVENT_FOCUS', |
||||
action: () => { |
||||
this.store.setSelectedId(id); |
||||
}, |
||||
}], |
||||
}], |
||||
}; |
||||
} |
||||
|
||||
private renderDownList() { |
||||
return [{ |
||||
text: BI.i18nText('Plugin-Redis_Parameter_Type_String'), |
||||
value: 'string', |
||||
iconCls: 'input-string-font', |
||||
}, { |
||||
text: BI.i18nText('Plugin-Redis_Parameter_Type_Int'), |
||||
value: 'int', |
||||
iconCls: 'input-int-font', |
||||
}, { |
||||
text: BI.i18nText('Plugin-Redis_Parameter_Type_Number'), |
||||
value: 'number', |
||||
iconCls: 'input-number-font', |
||||
}, { |
||||
text: BI.i18nText('Plugin-Redis_Parameter_Type_Date'), |
||||
value: 'date', |
||||
iconCls: 'input-date-font', |
||||
}, { |
||||
text: BI.i18nText('Plugin-Redis_Parameter_Type_Boolean'), |
||||
value: 'boolean', |
||||
iconCls: 'input-boolean-font', |
||||
}, { |
||||
text: BI.i18nText('Plugin-Redis_Parameter_Type_Formula'), |
||||
value: 'formula', |
||||
iconCls: 'input-formula-font', |
||||
}]; |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
import { model, Model } from '@core/core'; |
||||
@model() |
||||
export class PreviewModel extends Model { |
||||
static xtype = 'plugin.model.report.redis.components.preview'; |
||||
|
||||
childContext = <const>['previewAble', 'previewedDataSet']; |
||||
|
||||
state() { |
||||
return { |
||||
previewAble: true, |
||||
previewedDataSet: {}, |
||||
}; |
||||
} |
||||
|
||||
actions = { |
||||
setPreviewedDataSet: (value: any) => { |
||||
this.model.previewedDataSet = value; |
||||
}, |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
import { shortcut, store } from '@core/core'; |
||||
import { PreviewModel } from './preview.model'; |
||||
|
||||
@shortcut() |
||||
@store(PreviewModel) |
||||
export class Preview extends BI.Widget { |
||||
static xtype = 'plugin.report.redis.components.preview' |
||||
|
||||
store: PreviewModel['store'] |
||||
model: PreviewModel['model'] |
||||
|
||||
previewPane: any |
||||
|
||||
props = { |
||||
previewedDataSet: {}, |
||||
} |
||||
|
||||
render() { |
||||
this.store.setPreviewedDataSet(this.options.previewedDataSet); |
||||
|
||||
return { |
||||
type: 'dec.data.set.preview', |
||||
ref: (_ref: any) => { |
||||
this.previewPane = _ref; |
||||
}, |
||||
}; |
||||
} |
||||
created() { |
||||
this.previewPane.previewData(); |
||||
} |
||||
} |
@ -0,0 +1,4 @@
|
||||
export const fineServletURL = Dec.fineServletURL; |
||||
export const ReqPrefix = `${fineServletURL}/v10/config/connection`; |
||||
export const ImgPrefix = `${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/2x/icon/database/`; |
||||
export const PluginImgPrefix = `${fineServletURL}/resources?path=`; |
@ -0,0 +1,59 @@
|
||||
import { requestGet } from './crud.service'; |
||||
import { formulaData } from './formulaData'; |
||||
export function getConnectionlist(): Promise<{data?: Connection[]}> { |
||||
return requestGet('/v10/config/connection/list'); |
||||
} |
||||
|
||||
export function getTableList(database: string, pattern = '', orderValue: string | number): Promise<string[]> { |
||||
return requestGet('plugin/private/com.fr.solution.plugin.db.redis.v10/redis/keys', { |
||||
database, |
||||
pattern, |
||||
orderValue, |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取公式框基本配置信息 |
||||
*/ |
||||
export function fetchFormulaConfig(): Promise<{ |
||||
vars: { |
||||
text: string; |
||||
value: string; |
||||
type: string; |
||||
def: string; |
||||
}[]; |
||||
JSONs: { |
||||
def: string; |
||||
name: string; |
||||
type: string; |
||||
}[]; |
||||
}> { |
||||
// TODO 后台接口待完成
|
||||
return new Promise(resolve => { |
||||
resolve(formulaData); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 校验公式 |
||||
* @param formulaStr 公式 |
||||
*/ |
||||
export function validateForumula(formulaStr: string): Promise<{ |
||||
validation: boolean; |
||||
}> { |
||||
// TODO 后台接口待完成
|
||||
return new Promise(resolve => { |
||||
resolve({ validation: true }); |
||||
}); |
||||
} |
||||
|
||||
export interface Connection { |
||||
connectionId: string; |
||||
connectionType: string; |
||||
connectionName: string; |
||||
creator?: string; |
||||
privilegeDetailBeanList?: { |
||||
privilegeType: number; |
||||
privilegeValue: number; |
||||
}[] |
||||
} |
@ -0,0 +1,130 @@
|
||||
import 'es6-promise/auto'; |
||||
import axios, { AxiosResponse, AxiosError } from 'axios'; |
||||
import { fineServletURL } from '../constants/env'; |
||||
const defaultHeaders = { |
||||
'Content-Type': 'application/json', |
||||
'X-Requested-With': 'XMLHttpRequest', |
||||
}; |
||||
|
||||
export function paramsSerializer(params: { [key: string]: any }) { |
||||
return Object.keys(params || {}) |
||||
.map(paramKey => { |
||||
const paramValue = params[paramKey]; |
||||
|
||||
let value = ''; |
||||
|
||||
if (BI.isObject(paramValue)) { |
||||
value = encodeURIComponent(JSON.stringify(paramValue)); |
||||
} else { |
||||
value = paramValue; |
||||
} |
||||
|
||||
return BI.isNull(value) ? '' : `${paramKey}=${value}`; |
||||
}) |
||||
.filter(v => v !== '') |
||||
.join('&'); |
||||
} |
||||
function getCookieByName(name: string):string { |
||||
let value = null; |
||||
const regExpName = new RegExp(name); |
||||
document.cookie.split(';').forEach((item: string) => { |
||||
if (item.match(regExpName)) { |
||||
value = item.split(`${name}=`)[1]; |
||||
|
||||
return false; |
||||
} |
||||
}); |
||||
|
||||
return value; |
||||
} |
||||
|
||||
function checkStatus(response: AxiosResponse) { |
||||
const status = response.status; |
||||
|
||||
const resData = status === 200 |
||||
? typeof response.data === 'string' |
||||
? BI.jsonDecode(response.data) |
||||
: response.data |
||||
: {}; |
||||
|
||||
return resData; |
||||
} |
||||
|
||||
export async function request(reqOptions: CrudReqOpts = {}): Promise<any> { |
||||
const { url, type, headers, data, params } = reqOptions; |
||||
|
||||
return axios |
||||
.request({ |
||||
url, |
||||
baseURL: fineServletURL, |
||||
method: type, |
||||
headers: { |
||||
...defaultHeaders, |
||||
...headers, |
||||
Authorization: `Bearer ${getCookieByName('fine_auth_token')}`, |
||||
'Content-Type': 'application/json;charset=UTF-8', |
||||
}, |
||||
params, |
||||
paramsSerializer, |
||||
data, |
||||
}) |
||||
.then(checkStatus) |
||||
.catch((error: AxiosError) => { |
||||
console.log(error); |
||||
}); |
||||
} |
||||
|
||||
export function requestGet(url: string, params: CrudParams = {}) { |
||||
const timeStamp = new Date().getTime(); |
||||
|
||||
return request({ |
||||
url, |
||||
type: 'GET', |
||||
params: { |
||||
...params, |
||||
_: timeStamp, |
||||
}, |
||||
}); |
||||
} |
||||
|
||||
export function requestPost(url: string, data = {}, params: CrudParams = {}) { |
||||
return request({ |
||||
url, |
||||
type: 'POST', |
||||
data, |
||||
params, |
||||
}); |
||||
} |
||||
|
||||
export function requestDelete(url: string, data = {}) { |
||||
return request({ |
||||
url, |
||||
type: 'DELETE', |
||||
data, |
||||
}); |
||||
} |
||||
|
||||
export function requestPut(url: string, data = {}, params: CrudParams = {}) { |
||||
return request({ |
||||
url, |
||||
type: 'PUT', |
||||
data, |
||||
params, |
||||
}); |
||||
} |
||||
|
||||
interface CrudReqOpts { |
||||
url?: string; |
||||
type?: 'GET' | 'POST' | 'DELETE' | 'PUT'; |
||||
data?: any; |
||||
headers?: { |
||||
[key: string]: string; |
||||
}; |
||||
noProgress?: boolean; |
||||
params?: CrudParams; |
||||
} |
||||
|
||||
interface CrudParams { |
||||
[key: string]: string | number | { [key: string]: any }; |
||||
} |
||||
|
@ -0,0 +1,549 @@
|
||||
// 后期统一放置公式数据
|
||||
export const formulaData = { |
||||
vars: [ |
||||
{ |
||||
text: '$$page_number', |
||||
value: '$$page_number', |
||||
type: 'VARS', |
||||
def: '当前的页数。', |
||||
}, |
||||
{ |
||||
text: '$$totalPage_number', |
||||
value: '$$totalPage_number', |
||||
type: 'VARS', |
||||
def: '总页数。', |
||||
}, |
||||
], |
||||
JSONs: [ |
||||
{ |
||||
def: 'ABS(number): 返回指定数字的绝对值。绝对值是指没有正负符号的数值。Number:需要求出绝对值的任意实数。示例:ABS(-1.5)等于1.5。ABS(0)等于0。ABS(2.5)等于2.5。', |
||||
name: 'ABS', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'ABS(number): 返回指定数字的绝对值。绝对值是指没有正负符号的数值。Number:需要求出绝对值的任意实数。示例:ABS(-1.5)等于1.5。ABS(0)等于0。ABS(2.5)等于2.5。', |
||||
name: 'ABS', |
||||
type: 'COMMON', |
||||
}, |
||||
{ |
||||
def: 'acc_sum(x_agg(array),range)根据横纵轴或行列维度添加的字段对指标进行跨行累计的计算。第一个参数为用户计算的指标,该指标必须为聚合函数或聚合指标;第二个参数range为用户设置计算的范围,0为对所有行进行累计,1为对组内所有行进行累计示例:acc_sum(sum_agg(array),0)用户横轴轴拖拽销售日期(年分组),则该指标计算结果为,根据销售日期(年)对销量进行分组汇总,然后根据对所有行从上到下进行累加,获得每年的累计销量', |
||||
name: 'ACC_SUM', |
||||
type: 'TABLE_CAL', |
||||
}, |
||||
{ |
||||
def: 'ACOS(number): 返回指定数值的反余弦值。反余弦值为一个角度,返回角度以弧度形式表示。Number:需要返回角度的余弦值。备注: 函数的参数必须在-1和1之间,包括-1和1。 返回的角度值在0和Pi之间。 如果要把返回的角度用度数来表示,用180/PI()乘返回值即可。示例:ACOS(1)等于0(弧度)。ACOS(0.5)等于1.047197551(Pi/3弧度)。ACOS(0.5)*180/PI()等于60(度)。', |
||||
name: 'ACOS', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'AND(logical1,logical2,…): 当所有参数的值为真时,返回TRUE;当任意参数的值为假时,返回FALSE。Logical1,logical2,…:指1到30个需要检验TRUE或FALSE的条件值。备注: 参数必须是逻辑值,或是含有逻辑值的数组或引用。 如果数组或引用中含有文本或空的单元格,则忽略其值。 如果在指定的单元格区域中没有逻辑值,AND函数将返回错误信息*NAME?。示例:AND(1+7=8,5+7=12)等于TRUE。AND(1+7=8,5+7=11)等于FALSE。如果单元格A1到A4的值分别为TRUE、TRUE、FALSE和TRUE,则:AND(A1:A4)等于FALSE。如果单元格A5的值在0~50之间,则: AND(0<A5,A5<50)等于TRUE。', |
||||
name: 'AND', |
||||
type: 'LOGIC', |
||||
}, |
||||
{ |
||||
def: 'ASIN(number): 返回指定数值的反正弦值。反正弦值为一个角度,返回角度以弧度形式表示。Number:需要返回角度的正弦值。备注: 指定数值必须在-1到1之间(含1与-1)。 返回角度在-pi/2到pi/2之间(含-pi/2与pi/2)。 用角度形式返回数值时,返回数值乘以180/PI()。示例:ASIN(0.5)等于0.523598776(pi/6弧度)。ASIN(1)等于1.570796327(pi/2弧度)。ASIN(0.5)*180/PI()等于30(度)。', |
||||
name: 'ASIN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'ATAN(number): 计算指定数值的反正切值。指定数值是返回角度的正切值,返回角度以弧度形式表示。Number:返回角度的正切。备注: 返回角度在-pi/2到pi/2之间。 如果返回角度等于-pi/2或pi/2,ATAN将返回错误信息*NUM!。 用角度形式返回数值时,返回数值乘以180/PI()。示例:ATAN(-1)等于-0.785398163(-pi/4弧度)。ATAN(0)等于0(弧度)。ATAN(2)*180/PI()等于63.43494882(度)。', |
||||
name: 'ATAN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'ATAN2(x_num,y_num): 返回x、y坐标的反正切值。返回角度为x轴与过(x_num,y_num)与坐标原点(0,0)的一条直线形成的角度。该角度以弧度显示。X_num:指定点的x坐标。Y_num:指定点的y坐标。备注: 正值表示从x轴开始以逆时针方式所得的角度;负值表示从x轴开始以顺时针方式所得的角度。a > 0,b > 0 or a > 0, b < 0时,公式直接成立;a < 0,b > 0, ATAN2(a,b)=PI()-ABS(ATAN(b/a))a < 0,b < 0, ATAN2(a,b)=ABS(ATAN(b/a))-PI() 当x_num与y_num都为0时,ATAN2返回错误信息*DIV/0!。 用角度制显示返回数值时,把返回数值乘以180/PI()。 返回值以弧度表示(返回值大于-pi且小于等于pi)。示例:ATAN2(-2,2)等于2.356194490192345(弧度制的3*pi/4)。ATAN2(2,2)等于0.785398163(弧度制的pi/4)。ATAN2(-2,2)*180/PI()等于135(角度制)。', |
||||
name: 'ATAN2', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'AVG_AGG(array): 根据当前分析维度,动态返回指标字段的汇总平均值,生成结果为一动态数据列,行数与当前分析维度行数一致。\n array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。 \n 示例:用户横轴为维度字段\'日\'时,纵轴的计算字段AVG_AGG(销量)返回的值为每日的平均销量;当用户横轴为维度字段\'月\'时,AVG_AGG(销量)返回的值为每月的平均销量。', |
||||
name: 'AVG_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'CEILING(number): 将参数number沿绝对值增大的方向,舍入为最接近的整数Number:指待舍入的数值。CEILING(-2.5)等于-3。CEILING(0.5)等于1。', |
||||
name: 'CEILING', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'CHAR(number): 根据指定数字返回对应的字符。CHAR函数可将计算机其他类型的数字代码转换为字符。Number:用于指定字符的数字,介于1~65535之间(包括1和65535)。示例:CHAR(88)等于“X”。CHAR(45)等于“-”。', |
||||
name: 'CHAR', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'CODE(text): 计算文本串中第一个字符的数字代码。返回的代码对应于计算机使用的字符集。Text:需要计算第一个字符代码的文本或单元格引用。示例:CODE("S")等于83。CODE("Spreadsheet")等于83。', |
||||
name: 'CODE', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'CONCATENATE(text1,text2,...): 将数个字符串合并成一个字符串。Text1,text2,...:需要合并成单个文本的文本项,可以是字符,数字或是单元格引用。示例:CONCATENATE("Average ","Price")等于“Average Price”。CONCATENATE("1","2")等于12。', |
||||
name: 'CONCATENATE', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'COS(number): 返回一个角度的余弦值。Number:以弧度表示的需要求余弦值的角度。备注: 要把一个角度转换成弧度值,将角度乘于PI()/180。 COS(n*2*PI()+number)=COS(number)(其中n为整数,number从-pi到pi)。示例:COS(0.5)等于0.877582562。COS(30*PI()/180)等于0.866025404。', |
||||
name: 'COS', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'COUNTD_AGG(array): 根据当前分析维度,动态返回某字段的去重计数,生成结果为一动态数据列,行数与当前分析维度行数一致。\n "array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n "示例:用户横轴为维度字段\'日\'时,纵轴的计算字段COUNTD_AGG(销量)返回的值为每日的销量的去重个数;当用户横轴为维度字段\'月\'时,COUNTD_AGG(销量)返回的值为每月的销量的去重个数。"', |
||||
name: 'COUNTD_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'COUNT_AGG(array): 根据当前分析维度,动态返回某字段的计数,生成结果为一动态数据列,行数与当前分析维度行数一致。\n array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n 示例:用户横轴为维度字段\'日\'时,纵轴的计算字段COUNT_AGG(销量)返回的值为每日的销量的个数;当用户横轴为维度字段\'月\'时,COUNT_AGG(销量)返回的值为每月的销量的个数。', |
||||
name: 'COUNT_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'DATE(year,month,day): 返回一个表示某一特定日期的系列数。Year:代表年,可为一到四位数。Month:代表月份。若1 month 12,则函数把参数值作为月。若month>12,则函数从年的一月份开始往上累加。例如: DATE(2000,25,2)等于2002年1月2日的系列数。Day:代表日。若日期小于等于某指定月的天数,则函数将此参数值作为日。若日期大于某指定月的天数,则函数从指定月份的第一天开始往上累加。若日期大于两个或多个月的总天数,则函数把减去两个月或多个月的余数加到第三或第四个月上,依此类推。例如:DATE(2000,3,35)等于2000年4月4日的系列数。备注: 若需要处理公式中日期的一部分,如年或月等,则可用此公式。 若年,月和日是函数而不是函数中的常量,则此公式最能体现其作用。示例:DATE(1978, 9, 19) 等于1978-09-19.DATE(1211, 12, 1) 等于1211-12-01. ', |
||||
name: 'DATE', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DATEDELTA(date, deltadays):返回一个日期date后deltadays的日期。deltaDays可以为正值,负值,零。示例:DATEDELTA("2008-08-08", -10)等于2008-07-29。DATEDELTA("2008-08-08", 10)等于2008-08-18。', |
||||
name: 'DATEDELTA', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DATEDIF(start_date,end_date,unit):返回两个指定日期间的天数、月数或年数。Start_date:代表所指定时间段的初始日期。End_date:代表所指定时间段的终止日期。Unit:函数返回信息的类型。若unit=“Y”,则DATEDIF返回指定时间段的年差数。若unit=“M”,则DATEDIF返回指定时间段的月差数。若unit=“D”,则DATEDIF返回指定时间段的日差数。若unit=“MD”,则DATEDIF忽略年和月,返回指定时间段的日差数。若unit=“YM”,则DATEDIF忽略年和日,返回指定时间段的月差数。若unit=“YD”,则DATEDIF忽略年,返回指定时间段的日差数。示例:DATEDIF("2001/2/28","2004/3/20","Y")等于3,即在2001年2月28日与2004年3月20日之间有3个整年。DATEDIF("2001/2/28","2004/3/20","M")等于37,即在2001年2月28日与2004年3月20日之间有36个整月。DATEDIF("2001/2/28","2004/3/20","D")等于1116,即在2001年2月28日与2004年3月20日之间有1116个整天。DATEDIF("2001/2/28","2004/3/20","MD")等于8,即忽略月和年后,2001年2月28日与2004年3月20日的差为8天。DATEDIF("2001/1/28","2004/3/20","YM")等于2,即忽略日和年后,2001年1月28日与2004年3月20日的差为2个月。DATEDIF("2001/2/28","2004/3/20","YD")等于21,即忽略年后,2001年2月28日与2004年3月20日的差为21天。', |
||||
name: 'DATEDIF', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DATESUBDATE(date1, date2, op):返回两个日期之间的时间差。op表示返回的时间单位:"s",以秒为单位。"m",以分钟为单位。"h",以小时为单位。"d",以天为单位。"w",以周为单位。示例:DATESUBDATE("2008-08-08", "2008-06-06","h")等于1512。', |
||||
name: 'DATESUBDATE', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DATETONUMBER(date):返回自 1970 年 1 月 1 日 00:00:00 GMT 经过的毫秒数。示例:DATETONUMBER("2008-08-08")等于1218124800000。', |
||||
name: 'DATETONUMBER', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DAY:(serial_number)返回日期中的日。DAY是介于1和31之间的一个数。Serial_number:含有所求的年的日期.备注:FineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。示例:DAY("2000/1/1")等于1。DAY("2006/05/05")等于5。DAY("1997/04/20")等于20。DAY("2000-1-1", "yyyy-MM-dd")等于1。DAY("2006-05-05", "yyyy-MM-dd")等于5。DAY("1997-04-20", "yyyy-MM-dd")等于20。DAY(35796)等于1。', |
||||
name: 'DAY', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DAYS360(start_date,end_date,method):按照一年 360 天的算法(每个月以 30 天计,一年共计 12 个月),返回两日期间相差的天数,这在会计计算中将会用到。如果财务系统是基于一年 12 个月,每月 30 天,可用此函数帮助计算支付款项。Start_date 和 end_date :是用于计算期间天数的起止日期。Method : 它指定了在计算中是采用欧洲方法还是美国方法。Method 定义 :FALSE或忽略 美国方法 (NASD)。如果起始日期是一个月的 31 号,则等于同月的 30 号。如果终止日期是一个月的31号,并且起始日期早于 30 号,则终止日期等于下一个月的 1 号,否则,终止日期等于本月的 30 号。TRUE 欧洲方法。无论是起始日期还是终止日期为一个月的 31 号,都将等于本月的 30 号。备注:FineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。示例:DAYS360("1998/1/30", "1998/2/1") 等于 1', |
||||
name: 'DAYS360', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DAYSOFMONTH(date):返回从1900年1月后某年某月包含的天数。示例:DAYSOFMONTH("1900-02-01")等于28。DAYSOFMONTH("2008/04/04")等于30。', |
||||
name: 'DAYSOFMONTH', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DAYSOFQUARTER(date): 返回从1900年1月后某年某季度的天数。示例:DAYSOFQUARTER("2009-02-01")等于90。DAYSOFQUARTER("2009/05/05")等于91。', |
||||
name: 'DAYSOFQUARTER', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DAYSOFYEAR(year):返回某年包含的天数。示例:DAYSOFYEAR(2008)等于365,等价于DAYSOFYEAR("2008-01-01")。', |
||||
name: 'DAYSOFYEAR', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DAYVALUE(date):返回1900年至 date日期所经历的天数。示例:DAYVALUE("2008/08/08")等于39669。', |
||||
name: 'DAYVALUE', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'DEGREES(angle): 将弧度转化为度。angle:待转换的弧度角。示例:DEGREES(PI()/2)等于90。DEGREES(3.1415926)等于179.9999969。', |
||||
name: 'DEGREES', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'ENDWITH(str1,str2):判断字符串str1是否以str2结束。备注: str1和str2都是大小写敏感的。示例:ENDWITH("FineReport","Report")等于true。ENDWITH("FineReport","Fine")等于false。ENDWITH("FineReport","report")等于false。', |
||||
name: 'ENDWITH', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'EXACT(text1,text2): 检测两组文本是否相同。如果完全相同,EXACT函数返回TRUE;否则,返回FALSE。EXACT函数可以区分大小写,但忽略格式的不同。同时也可以利用EXACT函数来检测输入文档的文字。Text1:需要比较的第一组文本。Text2:需要比较的第二组文本。示例:EXACT("Spreadsheet","Spreadsheet")等于TRUE。EXACT("Spreadsheet","S preadsheet")等于FALSE。EXACT("Spreadsheet","spreadsheet")等于FALSE。', |
||||
name: 'EXACT', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'EXP(number): 返回e的n次幂。常数e为自然对数的底数,等于2.71828182845904。Number:为任意实数,作为常数e的指数。备注: 如果要返回其他常数作为底数的幂,可以使用指数运算符(^)。例如: 在4^2中,4是底数,而2是指数。 EXP函数与LN函数互为反函数。示例:EXP(0)等于1。EXP(3)等于20.08553692。EXP(LN(2))等于2。', |
||||
name: 'EXP', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'FACT(number):返回数的阶乘,一个数的阶乘等于 1*2*3*...*该数。number:要计算其阶乘的非负数。如果输入的 number 不是整数,则截尾取整。示例:FACT(1) 等于 1FACT(1.9) 等于 FACT(1) 等于 1FACT(0) 等于 1FACT(5) 等于 1*2*3*4*5 等于 120', |
||||
name: 'FACT', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'FIND(find_text,within_text,start_num):从指定的索引(start_num)处开始,返回第一次出现的指定子字符串(find_text)在此字符串(within_text)中的索引。Find_text:需要查找的文本或包含文本的单元格引用。Within_text:包含需要查找文本的文本或单元格引用。Start_num:指定进行查找字符的索引位置。within_text里的索引从1开始。如果省略start_num,则假设值为1。备注: 如果find_text不在within_text中,FIND函数返回值为0。 如果start_num不大于0,FIND函数返回错误信息*VALUE!。 如果start_num大于within_text的长度,FIND函数返回值为0。 如果find_text是空白文本,FIND函数将在搜索串中匹配第一个字符(即编号为start_num或1的字符)。示例:FIND("I","Information")等于1。FIND("i","Information")等于9。FIND("o","Information",2)等于4。FIND("o","Information",12)等于0。FIND("o","Information",-1)等于*VALUE!。', |
||||
name: 'FIND', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'FLOOR(number): 将参数number沿绝对值减小的方向去尾舍入。Number:待舍入的数值。示例:FLOOR(-2.5)等于-2。FLOOR(2.5)等于2。', |
||||
name: 'FLOOR', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'FORMAT(object,format) : 返回object的format格式。object 需要被格式化对象,可以是String,数字,Object(常用的有Date, Time)。format 格式化的样式。示例FORMAT(1234.5, "#,##0.00") => 1234.50FORMAT(1234.5, "#,##0") => 1234FORMAT(1234.5, "¥#,##0.00") => ¥1234.50FORMAT(1.5, "0%") => 150%FORMAT(1.5, "0.000%") => 150.000%FORMAT(6789, "##0.0E0") => 6.789E3FORMAT(6789, "0.00E00") => 6.79E03FORMAT(date(2007,1,1), "EEEEE, MMMMM dd, yyyy") => 星期一,一月 01,2007FORMAT(date(2007,1,13), "MM/dd/yyyy") => 01/13/2007FORMAT(date(2007,1,13), "M-d-yy") => 1-13-07FORMAT(time(16,23,56), "h:mm:ss a") => 4:23:56 下午', |
||||
name: 'FORMAT', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'HOUR(serial_number):返回某一指定时间的小时数。函数指定HOUR为0(0:00)到23(23:00)之间的一个整数。Serial_number:包含所求小时的时间。示例:HOUR("11:32:40")等于11。HOUR("11:32:40", "HH:mm:ss")等于11。', |
||||
name: 'HOUR', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'IF(boolean,number1/string1,number2/string2):判断函数,boolean为true时返回第二个参数,为false时返回第三个。boolean: 用于判断的布尔值,true或者false。number1/string1: 第一个参数,如果boolean为ture,返回这个值。number2/string2: 第二个参数,如果boolean为false,返回这个值。示例:IF(true,2,8)等于2IF(false,"first","second")等于secondIF(true,"first",7)等于first', |
||||
name: 'IF', |
||||
type: 'LOGIC', |
||||
}, |
||||
{ |
||||
def: 'IF(boolean,number1/string1,number2/string2):判断函数,boolean为true时返回第二个参数,为false时返回第三个。boolean: 用于判断的布尔值,true或者false。number1/string1: 第一个参数,如果boolean为ture,返回这个值。number2/string2: 第二个参数,如果boolean为false,返回这个值。示例:IF(true,2,8)等于2IF(false,"first","second")等于secondIF(true,"first",7)等于first', |
||||
name: 'IF', |
||||
type: 'COMMON', |
||||
}, |
||||
{ |
||||
def: 'INDEXOF(str1,index):返回字符串str1在index位置上的字符。备注: index是从0开始计数的。示例:INDEXOF("FineReport",0)等于\'F\'。INDEXOF("FineReport",2)等于\'n\'。INDEXOF("FineReport",9)等于\'t\'。INDEXOF(array, index):返回数组在index位置上的元素。备注: index是从1开始计数的。示例:String[] array = {"a", "b", "c"}INDEXOF(array, 1)等于"a".', |
||||
name: 'INDEXOF', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'INT(number): 返回数字下舍入(数值减小的方向)后最接近的整数值。Number:需要下舍入为整数的实数。示例:INT(4.8)等于4。INT(-4.8)等于-5。INT(4.3)等于4。INT(-4.3)等于-5。公式INT(A1)将返回A1单元格中的一个正实数的整数数部分。', |
||||
name: 'INT', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'INT(number): 返回数字下舍入(数值减小的方向)后最接近的整数值。Number:需要下舍入为整数的实数。示例:INT(4.8)等于4。INT(-4.8)等于-5。INT(4.3)等于4。INT(-4.3)等于-5。公式INT(A1)将返回A1单元格中的一个正实数的整数数部分。', |
||||
name: 'INT', |
||||
type: 'COMMON', |
||||
}, |
||||
{ |
||||
def: 'ISNULL(object):判断对象中所有的值是否全部都是NULL或者为空字符串。', |
||||
name: 'ISNULL', |
||||
type: 'OTHER', |
||||
}, |
||||
{ |
||||
def: 'LEFT(text,num_chars): 根据指定的字符数返回文本串中的第一个或前几个字符。Text:包含需要选取字符的文本串或单元格引用。Num_chars:指定返回的字符串长度。备注: Num_chars的值必须等于或大于0。 如果num_chars大于整个文本的长度,LEFT函数将返回所有的文本。 如果省略num_chars,则默认值为1。示例:LEFT("Fine software",8)等于“Fine sof”。LEFT("Fine software")等于“F”。如果单元格A3中含有“China”,则LEFT(A3,2)等于“Ch”。', |
||||
name: 'LEFT', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'LEN(args): 返回文本串中的字符数或者数组的长度。需要注意的是:参数args为文本串时,空格也计为字符。参数args为数组时,直接返回数组长度。示例:LEN("Evermore software")等于17。LEN(" ")等于1。LEN([\'a\',\'b\'])等于2。', |
||||
name: 'LEN', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'LN(number):返回一个数的自然对数。自然对数以常数项 e(2.71828182845904)为底。number:是用于计算其自然对数的正实数。示例:LN(86) 等于 4.45437LN(2.7182818) 等于 1LN(EXP(3)) 等于 3EXP(LN(4)) 等于 4', |
||||
name: 'LN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'LOG(number,base): 按指定的任意底数,返回数值的对数。Number:需要求对数的正实数。Base:对数的底数。如果省略底数,默认值为10。示例:LOG(16,2)等于4。LOG(10)等于1。LOG(24,3)等于2.892789261。', |
||||
name: 'LOG', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'LOG10(number):返回以 10 为底的对数。number: 用于常用对数计算的正实数。示例:LOG10(86) 等于 1.934498451LOG10(10) 等于 1LOG10(1E5) 等于 5', |
||||
name: 'LOG10', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'LOWER(text): 将所有的大写字母转化为小写字母。Text:需要转化为小写字母的文本串。LOWER函数不转化文本串中非字母的字符。示例:LOWER("A.M.10:30")等于“a.m.10:30”。LOWER("China")等于“china”。', |
||||
name: 'LOWER', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'LUNAR(year,day,month): 返回当前日期对应的农历时间。year,month,day:分别对应年月日。示例:如果需要查询2011年7月21日对应的农历时间,则只需输入LUNAR(2011,7,21)结果将显示为:辛卯年六月廿一同样,如输入LUNAR(2001,7,21),则显示:辛巳年六月初一 。本公式支持的时间段为1900-2100年。', |
||||
name: 'LUNAR', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'MAX(number1,number2,…): 返回参数列表中的最大值。Number1,number2,…:1到30个需要找出最大值的参数。备注: 参数可以是数字、空白单元格、逻辑值或数字的文本表达式。 如果数组或引用参数中包含可解析文本值,逻辑值,零值或空白单元格,这些值都将参与计算,而不可解析的文本值忽略不计。 如果参数中没有任何数字,MAX将返回0。示例:MAX(0.1,0,1.2)等于1.2。', |
||||
name: 'MAX', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'MAX_AGG(array): 根据当前分析维度,动态返回指标字段的最大值,生成结果为一动态数据列,行数与当前分析维度行数一致。\n "array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n "示例:用户横轴为维度字段\'日\'时,纵轴的计算字段MAX_AGG(销量)返回的值为每日的最大值销量;当用户横轴为维度字段\'月\'时,MAX_AGG(销量)返回的值为每月的最大值销量。', |
||||
name: 'MAX_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'MEDIAN_AGG(array): 根据当前分析维度,动态返回指标字段的中位数,生成结果为一动态数据列,行数与当前分析维度行数一致。\n "array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n "示例:用户横轴为维度字段\'日\'时,纵轴的计算字段MEDIAN_AGG(销量)返回的值为每日的中位数销量;当用户横轴为维度字段\'月\'时,MEDIAN_AGG(销量)返回的值为每月的中位数销量。', |
||||
name: 'MEDIAN_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'MID(text,start_num,num_chars): 返回文本串中从指定位置开始的一定数目的字符,该数目由用户指定。Text:包含要提取字符的文本串。Start_num:文本中需要提取字符的起始位置。文本中第一个字符的start_num为1,依此类推。Num_chars:返回字符的长度。备注: 如果start_num大于文本长度,MID函数返回“”(空文本)。 如果start_num小于文本长度,并且start_num加上num_chars大于文本长度,MID函数将从start_num指定的起始字符直至文本末的所有字符。 如果start_num小于1,MID函数返回错误信息*VALUE!。 如果num_chars是负数,MID函数返回错误信息*VALUE!。示例:MID("Finemore software",10,8)返回“software”。MID("Finemore software",30,5)返回“”(空文本)。MID("Finemore software",0,8)返回*VALUE!。MID("Finemore software",5,-1)返回*VALUE!。', |
||||
name: 'MID', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'MIN(number1,number2,…): 返回参数列表中的最小值。Number1,number2,…:1到30个需要找出最小值的参数。备注: 若参数中没有数字,函数MIN将返回0。 参数应为数字、空白单元格、逻辑值或是表示数值的文本串。如果参数是错误值时,MIN将返回错误信息。 如果数组或引用参数中包含可解析文本值,逻辑值,零值或空白单元格,这些值都将参与计算,而不可解析的文本值忽略不计。示例:如果B1:B4包含3,6,9,12,则:MIN(B1:B4)等于3。MIN(B1:B4,0)等于0。', |
||||
name: 'MIN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'MINUTE(serial_number):返回某一指定时间的分钟数,其值是介于0与59之间的一个整数。serial_number:包含所求分钟数的时间。示例:MINUTE("15:36:25")等于36。MINUTE("15:36:25", "HH:mm:ss")等于36。', |
||||
name: 'MINUTE', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'MIN_AGG(array): 根据当前分析维度,动态返回指标字段的最小值,生成结果为一动态数据列,行数与当前分析维度行数一致。\n "array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n "示例:用户横轴为维度字段\'日\'时,纵轴的计算字段MIN_AGG(销量)返回的值为每日的最小值销量;当用户横轴为维度字段\'月\'时,MIN_AGG(销量)返回的值为每月的最小值销量。', |
||||
name: 'MIN_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'MOD(number,divisor):返回两数相除的余数。结果的正负号与除数相同。number:为被除数。divisor:为除数。示例:MOD(3, 2) 等于 1MOD(-3, 2) 等于 1MOD(3, -2) 等于 -1MOD(-3, -2) 等于 -1', |
||||
name: 'MOD', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'MONTH:(serial_number)返回日期中的月。月是介于1和12之间的一个数。Serial_number:含有所求的月的日期.备注:FineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。示例:MONTH("2000/1/1")等于1。MONTH("2006/05/05")等于5。MONTH("1997/04/20")等于4。MONTH("2000-1-1", "yyyy-MM-dd")等于1。MONTH("2006-05-05", "yyyy-MM-dd")等于5。MONTH("1997-04-20", "yyyy-MM-dd")等于4。MONTH(35796)等于1。', |
||||
name: 'MONTH', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'MONTHDELTA(date,delta):返回指定日期date后delta个月的日期。示例:MONTHDELTA("2008-08-08", 4)等于2008-12-08。', |
||||
name: 'MONTHDELTA', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'NOW():获取当前时间。示例:如果系统时间是2012年5月12日 15点18分38秒则NOW()等于2012-05-12 15:18:36。', |
||||
name: 'NOW', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'NUMTO(number,bool)或NUMTO(number):返回number的中文表示。其中bool用于选择中文表示的方式,当没有bool时采用默认方式显示。示例:NUMTO(2345,true)等于二三四五。示例:NUMTO(2345,false)等于二千三百四十五。示例:NUMTO(2345)等于二千三百四十五。', |
||||
name: 'NUMTO', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'NVL(value1,value2,value3,...):在所有参数中返回第一个不是null的值value1:可以为任意数,也可以为null。value2:可以为任意数,也可以为null。当字符串长度为0时, 返回也为null示例:NVL(12,20)等于12。NVL(null,12)等于12。NVL(null,null)等于null。NVL(20,null)等于20。NVL(null,null,10)等于10。', |
||||
name: 'NVL', |
||||
type: 'OTHER', |
||||
}, |
||||
{ |
||||
def: 'OR(logical1,logical2,…): 当所有参数的值为假时,返回FALSE;当任意参数的值为真时,返回TRUE。Logical1,logical2,…:指1到30个需要检验TRUE或FALSE的条件值。备注: 参数必须是逻辑值,或是含有逻辑值的数组或引用。 如果数组或引用中含有文本或空的单元格,则忽略其值。 如果在指定的单元格区域中没有逻辑值,AND函数将返回错误信息*NAME?。示例:OR(1+7=9,5+7=11)等于FALSE。OR(1+7=8,5+7=11)等于TRUE。', |
||||
name: 'OR', |
||||
type: 'LOGIC', |
||||
}, |
||||
{ |
||||
def: 'period_anls(x_agg(array),datepart)根据横纵轴或行列维度添加的日期字段进行上期末的计算。第一个参数为用于计算的指标,该指标必须为聚合函数或聚合指标;第二个参数用于配置计算的上期末为上年期末或者上月期末。横纵轴拖拽的字段不满足函数的计算要求时,该指标会标红。示例:period_anls(sum_agg(amount),"Y") 用户横纵轴拖拽销售日期(年月日分组),则该指标计算结果为,根据年月日对销量进行分组汇总,然后计算出该日数据上年年末的销量;如果参数2为“M”,则计算结果为该日销量上月月末的销量。', |
||||
name: 'PERIOD_ANLS', |
||||
type: 'TABLE_CAL', |
||||
}, |
||||
{ |
||||
def: 'PI(number): 是一个数学常量函数,当number为空时,函数返回精确到15位的数值3.141592653589793;当参数不为空时,number表示PI的倍数。示例:SIN(PI()/2)等于1。计算圆的面积的公式: S=PI()*(r^2),其中S为圆的面积,R为圆的半径。PI(3)等于9.42477796076938。', |
||||
name: 'PI', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'POWER(number,power): 返回指定数字的乘幂。Number:底数,可以为任意实数。Power:指数。参数number按照该指数次幂乘方。备注: 可以使用符号“^”代替POWER,如: POWER(5,2)等于5^2。示例:POWER(6,2)等于36。POWER(14,5)等于537824。POWER(4,2/3)等于2.519842100。POWER(3,-2.3)等于0.079913677。', |
||||
name: 'POWER', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'previous_period(x_agg(array))根据横纵轴或行列维度添加的日期字段进行环期值的计算。参数为用于计算的指标,该指标必须为聚合函数或聚合指标。横纵轴拖拽的字段不满足函数的计算要求时,该指标会标红。示例:previous_period(sum_agg(amount)) 用户横纵轴拖拽销售日期(年月日分组),则该指标计算结果为,根据年月日对销量进行分组汇总,然后计算出该日数据上一日的销量。', |
||||
name: 'PREVIOUS_PERIOD', |
||||
type: 'TABLE_CAL', |
||||
}, |
||||
{ |
||||
def: 'PROMOTION(value1,value2):返回value2在value1上提升的比例。示例:PROMOTION(12, 14)等于0.166666666,即提升了16.6666666%.PROMOTION(-12, 14)等于2.166666666,即提升了216.6666666%.', |
||||
name: 'PROMOTION', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'PROPER(text): 将文本中的第一个字母和所有非字母字符后的第一个字母转化成大写,其他字母变为小写。Text:需要转化为文本的公式、由双引号引用的文本串或是单元格引用。示例:PROPER("Finemore Integrated Office")等于“Finemore Integrated Office”。PROPER("100 percent")等于“100 Percent”。PROPER("SpreaDSheEt")等于“Spreadsheet”。', |
||||
name: 'PROPER', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'RADIANS(angle): 将角度转换成弧度。Angle:需要转换为弧度的角度。示例:RADIANS(90)等于1.570796327。', |
||||
name: 'RADIANS', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'RAND(): 返回均匀分布的随机数。每计算一次工作表,函数都会返回一个新的随机数值。备注: 要生成一个位于a和b之间的随机数,可以使用以下的公式: C=RAND()*(b-a)+a。 如果要使一个随机产生的数值不随单元格的重计算而改变,可以在编辑框中输入=RAND()并保持编辑状态,然后按F9,将公式永久性地改为随机数。示例:假如需要生成一个大于等于0,小于60的随机数,使用公式: =RAND()*60。假如需要生成一个大于等于0,小于19的随机数,使用公式: =RAND()*19。假如需要生成一个大于等于0,小于50的随机数,使用公式: =RAND()*50。', |
||||
name: 'RAND', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'RANDBETWEEN(value1,value2):返回value1和value2之间的一个随机整数。示例:RANDBETWEEN(12.333, 13.233)只会返回13。RANDBETWEEN(11.2, 13.3)有可能返回12或者13。', |
||||
name: 'RANDBETWEEN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'rank_anls(x_agg(array),range,order)根据横纵轴或行列维度添加的字段对指标进行跨行排名的计算。第一个参数为用户计算的指标,该指标必须为聚合函数或聚合指标;第二个参数range为用户设置计算的范围,0为对所有行进行排名,1为对组内所有行进行排名;第三个参数order为排名的计算规则,"asc"为升序排名,"desc"为降序排名。示例:rank_anls(sum_agg(amount),0,"asc")用户横轴轴拖拽省份,则该指标计算结果为,根据省份对销量进行分组汇总,然后计算每个省份的销量在所有省份中的升序排名情况。', |
||||
name: 'RANK_ANLS', |
||||
type: 'TABLE_CAL', |
||||
}, |
||||
{ |
||||
def: 'REGEXP(str, pattern):字符串str是否与正则表达式pattern相匹配。示例:REGEXP("aaaaac","a*c")等于true。REGEXP("abc","a*c")等于false。REGEXP(str, pattern, intNumber):字符串str是否与具有给定模式 intNumber的正则表达式pattern相匹配。示例:CASE_INSENSITIVE = 0 启用不区分大小写的匹配。 默认情况下,不区分大小写的匹配假定仅匹配 US-ASCII 字符集中的字符。可以通过指 定 UNICODE_CASE 标志连同此标志来启用 Unicode 感知的、不区分大小写的匹配。 MULTILINE = 1 启用多行模式。DOTALL = 2 启用 dotall 模式。在 dotall 模式中,表达式 . 可以匹配任何字符,包括行结束符。默认情况下,此表达式不匹配行 结束符。UNICODE_CASE = 3 启用 Unicode 感知的大小写折叠。指定此标志后,由 CASE_INSENSITIVE 标志启用时,不区分大小写的匹配将以 符合 Unicode Standard 的方式完成。CANON_EQ = 4 启用规范等价。 指定此标志后,当且仅当其完整规范分解匹配时,两个字符才可视为匹配。UNIX_LINES = 5 启用 Unix 行模式。 在此模式中,.、^ 和 $ 的行为中仅识别 \'\n\' 行结束符。LITERAL = 6 启用模式的字面值解析。 指定此标志后,指定模式的输入字符串就会作为字面值字符序列来对待。输入序列中的 元字符或转义序列不具有任何特殊意义。 标志 CASE_INSENSITIVE 和 UNICODE_CASE 在与此标志一起使用时将 对匹配产生影响。其他标志都变得多余了。COMMENTS = 7 模式中允许空白和注释。 此模式将忽略空白和在结束行之前以 # 开头的嵌入式注释。 REGEXP("Aaaaabbbbc","a*b*c", 3)等于true。REGEXP("Aaaaabbbbc","a*b*c", 1)等于false。', |
||||
name: 'REGEXP', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'REPEAT(text,number_times): 根据指定的次数重复显示文本。REPEAT函数可用来显示同一字符串,并对单元格进行填充。Text:需要重复显示的文本或包含文本的单元格引用。Number_times:指定文本重复的次数,且为正数。如果number_times为0,REPEAT函数将返回“”(空文本)。如果number_times不是整数,将被取整。REPEAT函数的最终结果通常不大于32767个字符。备注: 该函数可被用于在工作表中创建简单的直方图。示例:REPEAT("$",4)等于“$$$$”。如果单元格B10的内容为“你好”,REPEAT(B10,3)等于“你好你好你好”。', |
||||
name: 'REPEAT', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'REPLACE(text, texttoreplace, replacetext):根据指定字符串,用其他文本来代替原始文本中的内容。text:需要被替换部分字符的文本或单元格引用。texttoreplace:指定的字符串。replacetext:需要替换部分旧文本的文本。示例:REPLACE("abcd", "a", "re")等于"rebcd"。REPLACE("a**d", "**d", "rose")等于"arose"。REPLACE(old_text,start_num,num_chars,new_text): 根据指定的字符数,用其他文本串来替换某个文本串中的部分内容。Old_text:需要被替换部分字符的文本或单元格引用。Start_num:需要用new_text来替换old_text中字符的起始位置。Num_chars:需要用new_text来替换old_text中字符的个数。New_text:需要替换部分旧文本的文本。示例:REPLACE("0123456789",5,4,"*")等于“0123*89”。REPLACE("1980",3,2,"99")等于“1999”。', |
||||
name: 'REPLACE', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'RIGHT(text,num_chars): 根据指定的字符数从右开始返回文本串中的最后一个或几个字符。Text:包含需要提取字符的文本串或单元格引用。Num_chars:指定RIGHT函数从文本串中提取的字符数。Num_chars不能小于0。如果num_chars大于文本串长度,RIGHT函数将返回整个文本。如果不指定num_chars,则默认值为1。示例:RIGHT("It is interesting",6)等于“esting”。RIGHT("Share Holder")等于“r”。RIGHT("Huge sale",4)等于“sale”。', |
||||
name: 'RIGHT', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'ROUND(number,num_digits):返回某个数字按指定位数舍入后的数字。number:需要进行舍入的数字。num_digits:指定的位数,按此位数进行舍入。如果 num_digits 大于 0,则舍入到指定的小数位。如果 num_digits 等于 0,则舍入到最接近的整数。如果 num_digits 小于 0,则在小数点左侧进行舍入。示例:ROUND(2.15, 1) 等于 2.2ROUND(2.149, 1) 等于 2.1ROUND(-1.475, 2) 等于 -1.48ROUND(21.5, -1) 等于 20因浮点数存在精度计算丢失问题, 导致计算结果里可能带上9999, 0000这些, 因此加入第三个参数来控制是否需要去除9999. true表示需要过滤9999, 0000这些数据.', |
||||
name: 'ROUND', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'ROUND(number,num_digits):返回某个数字按指定位数舍入后的数字。number:需要进行舍入的数字。num_digits:指定的位数,按此位数进行舍入。如果 num_digits 大于 0,则舍入到指定的小数位。如果 num_digits 等于 0,则舍入到最接近的整数。如果 num_digits 小于 0,则在小数点左侧进行舍入。示例:ROUND(2.15, 1) 等于 2.2ROUND(2.149, 1) 等于 2.1ROUND(-1.475, 2) 等于 -1.48ROUND(21.5, -1) 等于 20因浮点数存在精度计算丢失问题, 导致计算结果里可能带上9999, 0000这些, 因此加入第三个参数来控制是否需要去除9999. true表示需要过滤9999, 0000这些数据.', |
||||
name: 'ROUND', |
||||
type: 'COMMON', |
||||
}, |
||||
{ |
||||
def: 'same_period(x_agg(array),datepart)根据横纵轴或行列维度添加的日期字段进行同期值的计算。第一个参数为用于计算的指标,该指标必须为聚合函数或聚合指标;第二个参数用于配置计算同期时计算某日的年同期或者某日的月同期。横纵轴拖拽的字段不满足函数的计算要求时,该指标会标红。示例:same_period(sum_agg(amount),"Y") 用户横纵轴拖拽销售日期(年月日分组),则该指标计算结果为,根据年月日对销量进行分组汇总,然后计算出该日数据上年同日的销量;如果参数2为“M”,则计算结果为该日销量上月同日的销量。', |
||||
name: 'SAME_PERIOD', |
||||
type: 'TABLE_CAL', |
||||
}, |
||||
{ |
||||
def: 'SECOND(serial_number):返回某一指定时间的秒数,其值是介于0与59之间的一个整数。Serial_number:包含所求秒数的时间。示例:SECOND("15:36:25")等于25。SECOND("15:36:25", "HH:mm:ss")等于25。', |
||||
name: 'SECOND', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'SIGN(number):返回数字的符号。当数字为正数时返回 1,为零时返回 0,为负数时返回 -1。Number:为任意实数。示例:SIGN(10) 等于 1SIGN(4-4) 等于 0SIGN(-0.00001) 等于 -1', |
||||
name: 'SIGN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'SIN(number): 计算给定角度的正弦值。Number:待求正弦值的以弧度表示的角度。备注: 如果参数的单位是度,将其乘以PI()/180即可转换成弧度。示例:SIN(10)等于-0.5440211108893698。SIN(45*PI()/180)等于0.707106781。', |
||||
name: 'SIN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'SPLIT(String1,String2):返回由String2分割String1组成的字符串数组。String1:以双引号表示的字符串。String2:以双引号表示的分隔符。例如逗号","示例:SPLIT("hello,world,yes",",") = ["hello","world","yes"]。SPLIT("this is very good"," ") = ["this","is","very","good"]。备注:如果只有一个参数,则返回一个错误。如果有多个参数,则只有前两个起作用。', |
||||
name: 'SPLIT', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'SQRT(number): 返回一个正数的平方根。Number:要求其平方根的任一正数。备注:Number必须是一个正数,否则函数返回错误信息*NUM!。示例:SQRT(64)等于8。SQRT(-64)返回*NUM!。', |
||||
name: 'SQRT', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'STARTWITH(str1,str2):判断字符串str1是否以str2开始。备注: str1和str2都是大小写敏感的。示例:STARTWITH("FineReport","Fine")等于true。STARTWITH("FineReport","Report")等于false。STARTWITH("FineReport","fine")等于false。', |
||||
name: 'STARTWITH', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'STDEV_AGG(array): 根据当前分析维度,动态返回指标字段的标准差,生成结果为一动态数据列,行数与当前分析维度行数一致。\n "array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n "示例:用户横轴为维度字段\'日\'时,纵轴的计算字段STDEV_AGG(销量)返回的值为每日的销量标准差;当用户横轴为维度字段\'月\'时,STDEV_AGG(销量)返回的值为每月的销量标准差。', |
||||
name: 'STDEV_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'SUBSTITUTE(text,old_text,new_text,instance_num): 用new_text替换文本串中的old_text。Text:需要被替换字符的文本,或含有文本的单元格引用。Old_text:需要被替换的部分文本。New_text:用于替换old_text的文本。Instance_num:指定用new_text来替换第几次出现的old_text。如果指定了instance_num,则只有指定位置上的old_text被替换,否则文字串中出现的所有old_text都被new_text替换。备注: 如果需要替换文本串中的指定文本,则使用SUBSTITUTE函数;如果需要替换文本串中指定位置上的任意文本,则使用REPLACE函数。示例:SUBSTITUTE("data base","base","model")等于“data model”。SUBSTITUTE("July 28, 2000","2","1",1)等于“July 18, 2000”。SUBSTITUTE("July 28, 2000","2","1")等于“July 18, 1000”。SUBSTITUTE("July 28, 2000","2","1",2)等于“July 28, 1000”。 ', |
||||
name: 'SUBSTITUTE', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'SUM_AGG(array):根据当前分析维度,动态返回指标字段的汇总求和值,生成结果为一动态数据列,行数与当前分析维度行数一致。\n array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n 示例:用户横轴为维度字段\'日\'时,纵轴的计算字段SUM_AGG(销量)返回的值为每日的汇总销量;当用户横轴为维度字段\'月\'时,SUM_AGG(销量)返回的值为每月的汇总销量。', |
||||
name: 'SUM_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'switch(表达式, 值1, 结果1, 值2, 结果2, ...)如果表达式的结果是值1,整个函数返回结果1如果表达式的结果是值2,整个函数返回结果2如果表达式的结果是值3,整个函数返回结果3等等', |
||||
name: 'SWITCH', |
||||
type: 'LOGIC', |
||||
}, |
||||
{ |
||||
def: 'TAN(number): 返回指定角度的正切值。Number:待求正切值的角度,以弧度表示。如果参数是以度为单位的,乘以Pi()/180后转换为弧度。示例:TAN(0.8)等于1.029638557。TAN(45*Pi()/180)等于1。', |
||||
name: 'TAN', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'TIME(hour,minute,second): 返回代表指定时间的小数。介于0:00:00(12:00:00 A.M.)与23:59:59(11:59:59 P.M.)之间的时间可返回0到0.99999999之间的对应数值。Hour:介于0到23之间的数。Minute:介于0到59之间的数。Second:介于0到59之间的数。示例:TIME(14,40,0)等于2:40 PM。TIME(19,43,24)等于7:43 PM。', |
||||
name: 'TIME', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'TODATE()函数可以将各种日期形式的参数转换为日期类型。它有三种参数的形式:1 参数是一个日期型的参数,那么直接将这个参数返回。示例:TODATE(DATE(2007,12,12))返回2007年12月12日组成的日期。2 参数是以从1970年1月1日0时0分0秒开始的毫秒数,返回对应的时间。示例:TODATE(1023542354746)返回2002年6月8日。3 参数是日期格式的文本,那么返回这个文本对应的日期。示例:TODATE("2007/10/15")返回2007年10月5日组成的日期。TODATE("2007-6-8")返回2007年6月8日组成的日期。4 有两个参数,第一个参数是一个日期格式的文本,第二个参数是用来解析日期的格式。示例:TODATE("1/15/07","mm/dd/yy")返回07年1月15日组成的日期。特别的,"yyyyMMdd"是用来解析形如“20081230”之类的日期格式的。比如TODATE("20110830","yyyyMMdd")返回11年08月30日组成的日期5 有三个参数,第一个参数是一个日期格式的文本,第二个参数是用来解析日期的格式,第三个参数为解析日期的语言,如:zh(中文),en(英文)。示例:TODATE("星期三 1/15/07","EEE mm/dd/yy", "zh")返回07年1月15日组成的日期,使用“zh(中文)”才能够正常解析“星期三”这个字符串。', |
||||
name: 'TODATE', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'TODAY():获取当前日期。示例:如果系统日期是2005年9月10日则TODAY()等于2005-9-10。', |
||||
name: 'TODAY', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'TODOUBLE(text): 将文本转换成Double对象。Text:需要转换的文本。示例:TODOUBLE("123.21")等于 new Double(123.21)。', |
||||
name: 'TODOUBLE', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'TOINTEGER(text): 将文本转换成Integer对象。Text:需要转换的文本。示例:TOINTEGER("123")等于 new Integer(123)。', |
||||
name: 'TOINTEGER', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'total(x_agg(array),range,agg)根据横纵轴或行列维度添加的字段对指标进行跨行汇总的计算。第一个参数为用户计算的指标,该指标必须为聚合函数或聚合指标;第二个参数range为用户设置计算的范围,0为对所有行进行汇总,1为对组内所有行进行汇总;第三个参数agg为汇总的计算规则,"sum"为求和;"avg"为求平均,"max"为求最大值,"min"为求最小值示例:total(sum_agg(array),0,"avg")用户横纵轴拖拽省份,则该指标计算结果为,根据省份对销量进行分组汇总,然后计算平均每个省份的销量', |
||||
name: 'TOTAL', |
||||
type: 'TABLE_CAL', |
||||
}, |
||||
{ |
||||
def: 'TRIM(text): 清除文本中所有空格,单词间的单个空格除外,也可用于带有不规则空格的文本。Text:需要清除空格的文本。示例:TRIM(" Monthly Report")等于Monthly Report。', |
||||
name: 'TRIM', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'TRUNC(number,num_digits):将数字的小数部分截去,返回整数。number:需要截尾取整的数字。num_digits:用于指定取整精度的数字。示例:TRUNC(8.9) 等于 8TRUNC(-8.9) 等于 -8TRUNC(PI()) 等于 3', |
||||
name: 'TRUNC', |
||||
type: 'MATH', |
||||
}, |
||||
{ |
||||
def: 'UPPER(text): 将文本中所有的字符转化为大写。Text:需要转化为大写字符的文本,或是包含文本的单元格引用。示例:UPPER("notes")等于“NOTES”。如果单元格E5的值为“Examples”,则UPPER(E5)等于“EXAMPLES”。', |
||||
name: 'UPPER', |
||||
type: 'TEXT', |
||||
}, |
||||
{ |
||||
def: 'VAR_AGG(array): 根据当前分析维度,动态返回指标字段的方差,生成结果为一动态数据列,行数与当前分析维度行数一致。\n "array必须为非聚合函数公式返回的结果,可以是某指标字段、维度或指标字段与普通公式的计算结果。\n "示例:用户横轴为维度字段\'日\'时,纵轴的计算字段VAR_AGG(销量)返回的值为每日的销量方差;当用户横轴为维度字段\'月\'时,VAR_AGG(销量)返回的值为每月的销量方差。', |
||||
name: 'VAR_AGG', |
||||
type: 'AGG', |
||||
}, |
||||
{ |
||||
def: 'WEEK(serial_num):返回一个代表一年中的第几周的数字。Serial_num:表示输入的日期。备注:FineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。示例:WEEK("2010/1/1")等于52。WEEK("2010/1/6")等于1。WEEK(35796)等于1。', |
||||
name: 'WEEK', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'weekdate(year,month,weekOfMonth,dayOfWeek): 返回指定年月的指定周的周几的具体日期。示例:weekdate(2009,10,2,1)返回的是2009年的10月的第二个周的第一天即星期天的日期,返回的是2009-10-04最后一个参数dayOfWeek为-1时,表示这个周的最后一天示例:weekdate(2009,12,1,-1)返回的是2009年的12月的第一个周的最后一天即星期六的日期,返回的是2009-12-05', |
||||
name: 'WEEKDATE', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'WEEKDAY(Serial_number):获取日期并返回星期数。返回值为介于0到6之间的某一整数,分别代表星期中的某一天(从星期日到星期六)。Serial_number:输入的日期备注:FineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。举例:WEEKDAY("2005/9/10")等于6(星期六)。WEEKDAY("2005/9/11")等于0(星期日)。WEEKDAY(35796)等于4(星期四)。', |
||||
name: 'WEEKDAY', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'YEAR:(serial_number)返回日期中的年。Year是介于1900和9999之间的一个数。Serial_number:含有所求的年的日期.备注:FineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。示例:YEAR("2000/1/1")等于2000。YEAR("2006/05/05")等于2006。YEAR("1997/04/20")等于1997。YEAR("2000-1-1", "yyyy-MM-dd")等于2000。YEAR("2006-05-05", "yyyy-MM-dd")等于2006。YEAR("1997-04-20", "yyyy-MM-dd")等于1997。YEAR(35796)等于1998。', |
||||
name: 'YEAR', |
||||
type: 'DATETIME', |
||||
}, |
||||
{ |
||||
def: 'YEARDELTA(date, delta):返回指定日期后delta年的日期。示例:YEARDELTA("2008-10-10",10)等于2018-10-10。', |
||||
name: 'YEARDELTA', |
||||
type: 'DATETIME', |
||||
}, |
||||
], |
||||
}; |
@ -1,29 +1,38 @@
|
||||
import { shortcut } from '@core/core'; |
||||
import { HtapeXtype, IconLabelXtype, LabelXtype } from 'ui'; |
||||
@shortcut() |
||||
export class ListItem extends BI.BasicButton { |
||||
static xtype = 'dec.dcm.connection.plugin.redis.table_list.list_item' |
||||
props = { |
||||
text: '', |
||||
height: 20, |
||||
showIcon: false, |
||||
baseCls: 'bi-list-item-active', |
||||
} |
||||
render() { |
||||
const { text } = this.options; |
||||
|
||||
return { |
||||
type: HtapeXtype, |
||||
items: [{ |
||||
el: { |
||||
type: IconLabelXtype, |
||||
cls: 'column-font', |
||||
}, |
||||
width: 25, |
||||
}, { |
||||
type: LabelXtype, |
||||
const { text, showIcon } = this.options; |
||||
if(showIcon){ |
||||
return { |
||||
type: BI.HTapeLayout.xtype, |
||||
items: [{ |
||||
el: { |
||||
type: BI.IconLabel.xtype, |
||||
cls: 'redis-column-font', |
||||
}, |
||||
width: 25, |
||||
}, { |
||||
type: BI.Label.xtype, |
||||
textAlign: 'left', |
||||
text, |
||||
}], |
||||
}; |
||||
}else{ |
||||
return { |
||||
type: BI.Label.xtype, |
||||
textAlign: 'left', |
||||
lgap: 5, |
||||
text, |
||||
}], |
||||
}; |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
@ -0,0 +1,40 @@
|
||||
import { model, Model } from '@core/core'; |
||||
import { getConnectionlist, getTableList } from '../crud/crud.request'; |
||||
@model() |
||||
export class TableModelModel extends Model { |
||||
static xtype = 'dec.model.dcm.connection.plugin.redis.table_list'; |
||||
|
||||
state() { |
||||
return { |
||||
connections: [] as string[], |
||||
tables: [] as string[], |
||||
search: '', |
||||
orderValue: '', |
||||
selectedConnection: '', |
||||
}; |
||||
} |
||||
|
||||
actions = { |
||||
initData: () => { |
||||
getConnectionlist().then(re => { |
||||
this.model.connections = re.data.filter(item => item.connectionType === 'Redis').map(item => item.connectionName); |
||||
}); |
||||
}, |
||||
initTableList: () => { |
||||
if (this.model.selectedConnection) { |
||||
getTableList(this.model.selectedConnection, this.model.search, this.model.orderValue).then(re => { |
||||
this.model.tables = re ? re : []; |
||||
}); |
||||
} else { |
||||
this.model.tables = []; |
||||
} |
||||
}, |
||||
setSearch(value: string, orderValue: string | number) { |
||||
this.model.search = value; |
||||
this.model.orderValue = orderValue; |
||||
}, |
||||
setSelectedConnection(name: string) { |
||||
this.model.selectedConnection = name; |
||||
}, |
||||
} |
||||
} |
@ -1,77 +0,0 @@
|
||||
export const IconXtype = 'bi.icon'; |
||||
export const IconTextItemXtype = 'bi.icon_text_item'; |
||||
export const IconTextIconItemXtype = 'bi.icon_text_icon_item'; |
||||
export const IconButtonXtype = 'bi.icon_button'; |
||||
export const IconChangeButtonXtype = 'bi.icon_change_button'; |
||||
export const TextButtonXtype = 'bi.text_button'; |
||||
export const DownListComboXtype = 'bi.down_list_combo'; |
||||
export const LabelXtype = 'bi.label'; |
||||
export const SmallTextEditorXtype = 'bi.small_text_editor'; |
||||
export const MultiFileEditorXtype = 'bi.multifile_editor'; |
||||
export const SignEditorXtype = 'bi.sign_editor'; |
||||
export const ButtonXtype = 'bi.button'; |
||||
export const TextEditorXtype = 'bi.text_editor'; |
||||
export const MultiSelectInsertComboXtype = 'bi.multi_select_insert_combo'; |
||||
export const MultiSelectComboXtype = 'bi.multi_select_combo'; |
||||
export const ButtonGroupXtype = 'bi.button_group'; |
||||
export const AllValueChooserComboXtype = 'bi.all_value_chooser_combo'; |
||||
export const TextAreaEditorXtype = 'bi.textarea_editor'; |
||||
export const MultiSelectItemXtype = 'bi.multi_select_item'; |
||||
export const BarPopOverXtype = 'bi.bar_popover'; |
||||
export const DynamicDateComboXtype = 'bi.dynamic_date_combo'; |
||||
export const DynamicDateTimeComboXtype = 'bi.dynamic_date_time_combo'; |
||||
export const MultiTreeComboXtype = 'bi.multi_tree_combo'; |
||||
export const RichEditorXtype = 'bi.rich_editor'; |
||||
export const NicEditorXtype = 'bi.nic_editor'; |
||||
export const EditorXtype = 'bi.editor'; |
||||
export const MultiTreePopupViewXtype = 'bi.multi_tree_popup_view'; |
||||
export const SingleSelectRadioItemXtype = 'bi.single_select_radio_item'; |
||||
export const SingleSelectInsertComboXtype = 'bi.single_select_insert_combo'; |
||||
export const SingleSelectComboXtype = 'bi.single_select_combo'; |
||||
export const TabXtype = 'bi.tab'; |
||||
export const DynamicYearMonthComboXtype = 'bi.dynamic_year_month_combo'; |
||||
export const TextXtype = 'bi.text'; |
||||
export const ComboXtype = 'bi.combo'; |
||||
export const TimeComboXtype = 'bi.time_combo'; |
||||
export const IFrameXtype = 'bi.iframe'; |
||||
export const MultiTreeInsertComboXtype = 'bi.multi_tree_insert_combo'; |
||||
export const MultiTreeListComboXtype = 'bi.multi_tree_list_combo'; |
||||
export const MultilayerSingleTreeComboXtype = 'bi.multilayer_single_tree_combo'; |
||||
export const MultilayerSelectTreeComboXtype = 'bi.multilayer_select_tree_combo'; |
||||
export const AsyncTreeXtype = 'bi.async_tree'; |
||||
export const ListAsyncTreeXtype = 'bi.list_async_tree'; |
||||
export const MultilayerSingleTreePopupXtype = 'bi.multilayer_single_tree_popup'; |
||||
export const MultilayerSelectTreePopupXtype = 'bi.multilayer_select_tree_popup'; |
||||
export const IconLabelXtype = 'bi.icon_label'; |
||||
export const RadioXtype = 'bi.radio'; |
||||
export const LinearSegmentXtype = 'bi.linear_segment'; |
||||
export const SearchEditorXtype = 'bi.search_editor'; |
||||
export const ImgXtype = 'bi.img'; |
||||
export const BubbleComboXtype = 'bi.bubble_combo'; |
||||
export const TextBubblePopupBarViewXtype = 'bi.text_bubble_bar_popup_view'; |
||||
export const TextValueComboXtype = 'bi.text_value_combo'; |
||||
export const FileXtype = 'bi.file'; |
||||
export const IconComboXtype = 'bi.icon_combo'; |
||||
export const NumberEditorXtype = 'bi.number_editor'; |
||||
export const CodeEditorXtype = 'bi.code_editor'; |
||||
// 布局
|
||||
export const VerticalAdaptXtype = 'bi.vertical_adapt'; |
||||
export const VtapeXtype = 'bi.vtape'; |
||||
export const CenterAdaptXtype = 'bi.center_adapt'; |
||||
export const HtapeXtype = 'bi.htape'; |
||||
export const LayoutXtype = 'bi.layout'; |
||||
export const AbsoluteXtype = 'bi.absolute'; |
||||
export const VerticalXtype = 'bi.vertical'; |
||||
export const LeftXtype = 'bi.left'; |
||||
export const RightXtype = 'bi.right'; |
||||
export const HorizontalAdaptXtype = 'bi.horizontal_adapt'; |
||||
export const AbsoluteCenterAdaptXtype = 'bi.absolute_center_adapt'; |
||||
export const TableAdaptXtype = 'bi.table_adapt'; |
||||
export const RightVerticalAdaptXtype = 'bi.right_vertical_adapt'; |
||||
export const LeftRightVerticalAdaptXtype = 'bi.left_right_vertical_adapt'; |
||||
export const ListViewXtype = 'bi.list_view'; |
||||
export const VirtualGroupXtype = 'bi.virtual_group'; |
||||
export const HorizotalAutoXtype = 'bi.horizontal_auto'; |
||||
export const HorizotalXtype = 'bi.horizontal'; |
||||
export const FloatCenterXtype = 'bi.float_center'; |
||||
export const LeftRightVerticalAdaptLayoutXtype = 'bi.left_right_vertical_adapt'; |
Loading…
Reference in new issue