Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
jml0128
/
xrk-bi
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 794f2e06
authored
Jul 02, 2021
by
jml0128
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
1 parent
98a9e556
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
6 deletions
2.pdf
package-lock.json
package.json
src/packages/bi/src/chart-type/common.js
src/packages/bi/src/components/operate.vue
src/packages/bi/src/project/20-configurable.vue
src/packages/bi/src/project/6-zone.vue
src/packages/bi/src/project/tools.js
2.pdf
View file @
794f2e0
No preview for this file type
package-lock.json
View file @
794f2e0
This diff is collapsed.
Click to expand it.
package.json
View file @
794f2e0
...
...
@@ -27,8 +27,7 @@
"vue-awesome-swiper"
:
"^4.1.1"
,
"vue-echarts"
:
"^6.0.0-rc.5"
,
"vue-photo-preview"
:
"^1.1.3"
,
"vuedraggable"
:
"^2.24.3"
,
"xrk-tools"
:
"^1.0.11"
"vuedraggable"
:
"^2.24.3"
},
"devDependencies"
:
{
"@vue/cli-plugin-eslint"
:
"~4.5.0"
,
...
...
src/packages/bi/src/chart-type/common.js
View file @
794f2e0
...
...
@@ -130,3 +130,61 @@ export const getInterval = axisData => {
}
return
'auto'
;
};
export
const
check
=
{
isFunction
:
fn
=>
{
return
typeof
fn
===
'function'
;
}
};
export
const
base
=
{
numberFormat
:
(
num
,
divisor
=
100
,
decimalPlaces
=
2
,
unit
=
''
)
=>
{
if
(
num
==
0
)
{
return
Number
(
num
).
toFixed
(
decimalPlaces
)
+
unit
;
}
return
(
Number
(
num
)
/
divisor
).
toFixed
(
decimalPlaces
)
+
unit
;
}
};
export
const
date
=
{
dateFormat
:
(
date
=
new
Date
(),
fmt
=
'Y-M-D H:m:s'
,
autoFillZero
=
true
)
=>
{
let
_date
=
new
Date
();
if
(
toString
.
call
(
date
)
===
'[object Number]'
)
{
// 时间戳
_date
=
new
Date
(
Math
.
round
(
Number
(
String
(
date
).
padEnd
(
13
,
'0'
))));
}
else
if
(
toString
.
call
(
date
)
===
'[object Date]'
)
{
// 时间对象
_date
=
date
;
}
else
{
// 错误传参
console
.
warn
(
`入参
${
date
}
不是正确的时间对象或时间戳`
);
return
date
;
}
const
fillZero
=
(
number
,
count
=
2
)
=>
{
return
String
(
number
).
padStart
(
count
,
'0'
);
};
const
_fullYear
=
_date
.
getFullYear
();
const
_month
=
_date
.
getMonth
()
+
1
;
const
_day
=
_date
.
getDate
();
const
_hours
=
_date
.
getHours
();
const
_minutes
=
_date
.
getMinutes
();
const
_seconds
=
_date
.
getSeconds
();
const
fmtMap
=
{
Y
:
_fullYear
,
M
:
autoFillZero
?
fillZero
(
_month
)
:
_month
,
D
:
autoFillZero
?
fillZero
(
_day
)
:
_day
,
H
:
autoFillZero
?
fillZero
(
_hours
)
:
_hours
,
m
:
autoFillZero
?
fillZero
(
_minutes
)
:
_minutes
,
s
:
autoFillZero
?
fillZero
(
_seconds
)
:
_seconds
};
let
_fmt
=
String
(
fmt
);
for
(
const
key
in
fmtMap
)
{
if
(
Object
.
hasOwnProperty
.
call
(
fmtMap
,
key
))
{
_fmt
=
_fmt
.
replace
(
new
RegExp
(
`
${
key
}
`
),
String
(
Reflect
.
get
(
fmtMap
,
key
))
);
}
}
return
_fmt
;
}
};
src/packages/bi/src/components/operate.vue
View file @
794f2e0
...
...
@@ -56,7 +56,7 @@
</
template
>
<
script
>
import
{
check
}
from
'
xrk-tools
'
;
import
{
check
}
from
'
../chart-type/common
'
;
import
mixin
from
'../mixin/index'
;
import
{
Dialog
,
Button
,
Checkbox
,
CheckboxGroup
,
Message
}
from
'element-ui'
;
export
default
{
...
...
src/packages/bi/src/project/20-configurable.vue
View file @
794f2e0
...
...
@@ -71,7 +71,7 @@ import mixin, { printWidth } from '../mixin/index';
import
project
from
'../mixin/project'
;
import
{
chartConfig
}
from
'../mock/index'
;
import
{
date
}
from
'
xrk-tools
'
;
import
{
date
}
from
'
../chart-type/common
'
;
const
ChartConfigFn
=
chartConfig
();
import
{
...
...
src/packages/bi/src/project/6-zone.vue
View file @
794f2e0
...
...
@@ -80,7 +80,7 @@ import project from '../mixin/project';
import
{
chartConfig
}
from
'../mock/index'
;
const
ChartConfigFn
=
chartConfig
();
import
{
date
,
check
}
from
'
xrk-tools
'
;
import
{
date
,
check
}
from
'
../chart-type/common
'
;
import
{
dealAxis
,
dealLegends
,
...
...
src/packages/bi/src/project/tools.js
View file @
794f2e0
...
...
@@ -2,7 +2,7 @@
* @Description:
* @Date: 2021-07-02 10:57:34
*/
import
{
base
}
from
'
xrk-tools
'
;
import
{
base
}
from
'
../chart-type/common
'
;
export
const
dealAxis
=
(
arr
=
[])
=>
{
return
arr
.
map
(
item
=>
({
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment