Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gavel-erp-vue
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李苏
gavel-erp-vue
Commits
5729f00a
Commit
5729f00a
authored
Mar 18, 2025
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
c71c03d6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
437 additions
and
35 deletions
+437
-35
AppMain.vue
src/layout/components/AppMain.vue
+1
-0
permission.js
src/permission.js
+1
-2
permission.js
src/store/modules/permission.js
+52
-33
dialog.vue
src/views/iot/RealChartConfigure/dialog.vue
+44
-0
edit.vue
src/views/iot/RealChartConfigure/edit.vue
+95
-0
index.vue
src/views/iot/RealChartConfigure/index.vue
+244
-0
No files found.
src/layout/components/AppMain.vue
View file @
5729f00a
...
...
@@ -18,6 +18,7 @@
name
:
'AppMain'
,
computed
:
{
cachedViews
()
{
console
.
log
(
this
.
$store
.
state
.
tagsView
,
'this.$store.state.tagsView'
)
return
this
.
$store
.
state
.
tagsView
.
cachedViews
},
key
()
{
...
...
src/permission.js
View file @
5729f00a
...
...
@@ -23,8 +23,7 @@ router.beforeEach((to, from, next) => {
if
(
store
.
state
.
app
.
isInit
==
false
)
{
store
.
commit
(
'app/changeInit'
)
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
console
.
log
(
accessRoutes
,
'添加权限accessRoutes'
)
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
router
.
addRoutes
(
accessRoutes
)
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
})
...
...
src/store/modules/permission.js
View file @
5729f00a
...
...
@@ -14,7 +14,10 @@ import views from 'common'
import
vue
from
'vue'
import
commonList
from
"common/src/commonList"
import
erpList
from
"common/src/erpList"
import
iotList
from
"common/src/iotList"
console
.
log
(
iotList
,
'iotList'
)
import
dynamicRouter
from
'common/src/utils/router/dynamic.js'
import
getFinallyRouter
from
'common/src/utils/router/getFinallyRouter.js'
import
{
treeToList
}
from
'common/src/utils/router/dynamic.js'
...
...
@@ -99,7 +102,7 @@ const permission = {
commit
(
'SET_SYSTEMNAME'
,
systemName
)
/* 构建新list放进列表切换*/
localStorage
.
setItem
(
'appName'
,
appName
)
localStorage
.
setItem
(
'appType'
,
res
.
data
.
appType
||
''
)
localStorage
.
setItem
(
'appType'
,
res
.
data
.
appType
||
''
)
/* 存储system id list*/
/* 将可切换系统存入store*/
let
systemInfo
=
res
.
data
.
systemInfo
||
[]
...
...
@@ -141,6 +144,7 @@ const permission = {
let
newPowerRoutes
=
filter
(
powerRoutes
)
let
newCommonList
=
filter
(
commonList
.
list
)
let
newErpList
=
filter
(
erpList
.
list
)
let
newIotList
=
filter
(
iotList
.
list
)
/* 转化菜单格式*/
let
delArr
=
[]
let
newmenus
=
[]
...
...
@@ -150,14 +154,17 @@ const permission = {
newmenus
.
push
(
mi
)
}
})
// res.data=[...
// newCommonList, ...newErpList, ...newPowerRoutes]
res
.
data
=
dynamicRouter
([...
newCommonList
,
...
newErpList
,
...
newPowerRoutes
],
asymenus
)
||
[...
newCommonList
,
...
newErpList
,
...
newPowerRoutes
// res.data=[...
// newCommonList, ...newErpList, ...newPowerRoutes]
res
.
data
=
dynamicRouter
([...
newCommonList
,
...
newErpList
,
...
newIotList
,
...
newPowerRoutes
],
asymenus
)
||
[...
newCommonList
,
...
newErpList
,
...
newIotList
,
...
newPowerRoutes
]
res
.
data
=
getFinallyRouter
(
menus
,
res
.
data
)
/* 重置首页路由*/
// let hompePage = treeToList([...newCommonList,...newErpList,...newPowerRoutes]).filter(item=>item.mkid==localStorage.getItem('homeMkid'))
let
ttlist
=
treeToList
([...
newCommonList
,
...
newErpList
,
...
newPowerRoutes
])
let
ttlist
=
treeToList
([...
newCommonList
,
...
newErpList
,
...
new
IotList
,...
new
PowerRoutes
])
let
homePage
=
ttlist
.
filter
(
item
=>
item
.
mkid
==
localStorage
.
getItem
(
'homeMkid'
))
/* 替换首页*/
...
...
@@ -185,30 +192,30 @@ const permission = {
}
/* 移除默认路由*/
let
newHome
=
{
path
:
''
,
component
:
Layout
,
redirect
:
'index'
,
hidden
:
true
,
children
:
[{
path
:
'index'
,
component
:
homePage
[
0
].
component
,
name
:
'Index'
,
meta
:
{
title
:
'首页'
,
icon
:
'dashboard'
,
affix
:
true
}
}]
}
router
.
addRoutes
([
newHome
])
constantRoutes
.
push
(
newHome
)
}
else
{
let
newHome
=
{
path
:
''
,
path
:
''
,
component
:
Layout
,
redirect
:
'index'
,
hidden
:
true
,
children
:
[{
path
:
'index'
,
component
:
homePage
[
0
].
component
,
name
:
'Index'
,
meta
:
{
title
:
'首页'
,
icon
:
'dashboard'
,
affix
:
true
}
}]
}
router
.
addRoutes
([
newHome
])
constantRoutes
.
push
(
newHome
)
}
else
{
let
newHome
=
{
path
:
''
,
component
:
Layout
,
redirect
:
'index'
,
redirect
:
'index'
,
hidden
:
true
,
children
:
[{
children
:
[{
path
:
'index'
,
component
:
()
=>
import
(
'@/views/index'
),
name
:
'Index'
,
...
...
@@ -216,11 +223,11 @@ const permission = {
title
:
'首页'
,
icon
:
'dashboard'
,
affix
:
true
}
}]
}
router
.
addRoutes
([
newHome
])
constantRoutes
.
push
(
newHome
)
}
}]
}
router
.
addRoutes
([
newHome
])
constantRoutes
.
push
(
newHome
)
}
...
...
@@ -275,6 +282,8 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
}
else
if
(
route
.
erpComponent
)
{
route
.
component
=
loadErpView
(
route
.
component
)
}
else
if
(
route
.
iotComponent
)
{
route
.
component
=
loadIotView
(
route
.
component
)
}
else
{
route
.
component
=
loadView
(
route
.
component
)
}
...
...
@@ -378,6 +387,16 @@ export const loadErpView = (view) => {
return
(
resolve
)
=>
require
([
`common/src/erpViews/
${
view
}
`
],
resolve
)
}
}
export
const
loadIotView
=
(
view
)
=>
{
/* 改为common路由*/
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
return
(
resolve
)
=>
require
([
`common/src/iotViews/
${
view
}
`
],
resolve
)
}
else
{
// 使用 import 实现生产环境的路由懒加载
// return () => import(`@/views/${view}`)
return
(
resolve
)
=>
require
([
`common/src/iotViews/
${
view
}
`
],
resolve
)
}
}
export
default
permission
src/views/iot/RealChartConfigure/dialog.vue
0 → 100644
View file @
5729f00a
<
template
>
<DefaultDialog
:app=
'app'
>
<div
slot=
"form"
style=
"display: flex;height: 70vh;"
>
</div>
<div
slot=
"reFooter"
class=
"refooter"
>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"app.showDialog=false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"save()"
>
保 存
</el-button>
</span>
</div>
</DefaultDialog>
</
template
>
<
script
>
export
default
{
props
:
{
app
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
}
},
async
mounted
()
{
},
data
()
{
return
{
}
},
methods
:
{
}
}
</
script
>
<
style
scoped
>
</
style
>
src/views/iot/RealChartConfigure/edit.vue
0 → 100644
View file @
5729f00a
<!--
* @Description:生成基础baseEdit组件,屏蔽不必要细节
* @Author: lisu lisu@gavelinfo.com
* @Date: 2024-09-19 10:47:46
* @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-09-19 14:24:01
* @FilePath: /easyWork/static/baseEdit.vue
-->
<
template
>
<!-- prop 穿透赋值 -->
<BaseEdit
v-bind=
"$attrs"
:config=
'editConfig'
>
<template
#
dialog=
"ctx"
>
<!-- 嵌入默认页面额外弹框的插槽 ctx.editPage来操作默认页面 -->
</
template
>
<
template
#
toolbar=
"ctx"
>
<!-- 嵌入默认页面从表上方插槽 ctx.editPage来操作默认页面 -->
<!--
<el-button
@
click=
"demo(ctx.editPage)"
size=
'mini'
type=
"primary"
>
示例按钮
</el-button>
-->
<!--
<AuxButton
:dynamic=
'true'
:queryParams=
"
{
sbxxTreeId:that.form.sbxxTreeId,
zt:'N'
}" :component='Qxsj' rename='选择缺陷数据' code='dynamic' @save="saveQxsj" /> -->
</
template
>
</BaseEdit>
</template>
<
script
>
export
default
{
data
()
{
return
{
editConfig
:
{
/* 生成form表单 */
editColItemList
:
[{
label
:
'编码'
,
prop
:
'code'
,
span
:
12
,
type
:
'input'
,
required
:
true
,
},
{
label
:
'名称'
,
prop
:
'name'
,
span
:
12
,
type
:
'input'
,
required
:
true
,
},
{
label
:
'备注'
,
prop
:
'bz'
,
span
:
24
,
type
:
'input'
},
],
/* 生成主从表,为空数组默认不展示 */
editTableTitle
:
[
// {
// title: "序号",
// field: "xh",
// width: 50,
// align: "center"
// },
// {
// title: "点检部位",
// field: "bw",
// width: 180,
// },
// {
// title: "点检项目",
// field: "project",
// width: 160
// },
// {
// title: "点检标准",
// field: "standard",
// width: 140
// },
],
/* 子表名,可选 同editTableTitle一起用*/
detailTable
:
''
}
}
},
methods
:
{
/**
* @description:示例按钮
* @param {*} ctx操作edit实例内容
* @return {*}
* @author: lisu
*/
// demo(ctx){}
}
}
</
script
>
<
style
>
</
style
>
\ No newline at end of file
src/views/iot/RealChartConfigure/index.vue
0 → 100644
View file @
5729f00a
<
template
>
<div
style=
" height: calc(100vh - 84px);width: 100%;"
>
<!-- 上半部分,占整个高度的一半 -->
<div
v-echartResize=
"()=>
{
iotChart.resize();
}" ref="iotChart" style=" background-color: #f0f2f5;height: 50%;width: 100%;">
<!-- 上半部分内容 -->
</div>
<!-- 下半部分,占整个高度的一半 -->
<div
style=
"height: 50%;width: 100%;display: flex;"
>
<!-- 左半部分,占下半部分宽度的70% -->
<div
style=
" background-color: #e6ebf1;width: 100%;height: 100%;"
>
<TablePager
:operateButtons=
'false'
:fePage=
'true'
v-if=
"tp1Loading"
ref=
"tp1"
:app=
'this'
>
</TablePager>
</div>
<!-- 右半部分,占下半部分宽度的30% -->
<!--
<div
style=
"width: 30%;height: 100%; background-color: #f0f2f5;"
>
</div>
-->
</div>
</div>
</
template
>
<
script
>
const
id
=
'2C9577B7912B11DD0191C190E23F64DF'
export
default
{
name
:
'RealChartConfigure'
,
mounted
()
{
// 初始化echarts
this
.
$nextTick
(()
=>
{
this
.
iotChart
=
this
.
$echarts
.
init
(
this
.
$refs
.
iotChart
,
'dark'
)
const
url
=
this
.
$route
.
meta
.
url
this
.
baseUrl
=
this
.
id
=
this
.
matchString
(
url
)[
0
]
this
.
apiGetConfig
()
this
.
timer
=
setInterval
(()
=>
{
this
.
apiGetConfig
()
},
5000
)
})
},
beforeDestroy
()
{
clearInterval
(
this
.
timer
)
this
.
timer
=
null
},
data
()
{
return
{
timer
:
null
,
iotChart
:
null
,
id
:
''
,
tp1Loading
:
false
,
tableTitle
:
[],
// 特殊补充
powerObj
:
{},
queryParams
:
{},
rowKey
:
'timeStamp'
,
baseUrl
:
id
}
},
methods
:
{
matchString
(
str
)
{
const
regex
=
/
\/([^/]
+
)\/
index/g
;
const
matches
=
[];
let
match
;
while
((
match
=
regex
.
exec
(
str
))
!==
null
)
{
matches
.
push
(
match
[
1
]);
}
return
matches
;
},
apiGetConfig
()
{
this
.
$post
(
`realchart/qsztfx/config/
${
this
.
id
}
`
).
then
(
result
=>
{
if
(
result
[
"success"
])
{
var
config
=
result
[
"data"
][
"config"
];
var
option
=
{
title
:
{
text
:
config
.
name
,
left
:
'center'
,
y
:
10
},
tooltip
:
{
trigger
:
'axis'
,
formatter
:
function
(
params
)
{
var
text
=
new
Date
(
params
[
0
][
"value"
][
0
]).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"<br />"
;
$
.
each
(
params
,
function
(
i
,
param
)
{
var
line
=
''
;
line
=
param
[
"seriesName"
]
+
": "
;
line
+=
param
[
"value"
][
1
];
text
+=
line
+
"<br/>"
;
});
return
text
;
}
},
xAxis
:
{
type
:
'time'
,
splitLine
:
{
show
:
false
}
},
yAxis
:
{
type
:
'value'
,
boundaryGap
:
[
0
,
'100%'
],
splitLine
:
{
show
:
false
},
},
series
:
[]
};
this
.
iotChart
.
setOption
(
option
);
/* 渲染图*/
this
.
apiGetSearchdata
()
}
})
},
apiGetSearchdata
()
{
this
.
$post
(
`/realchart/qsztfx/searchdata/
${
this
.
id
}
`
).
then
(
res
=>
{
/* 渲染echarts*/
var
records
=
res
[
'data'
][
'trenddata'
];
var
datas
=
records
[
'datas'
];
var
legend
=
[];
var
series
=
[];
var
list
=
[];
var
timeGroup
=
{};
$
.
each
(
datas
,
function
(
i
,
data
)
{
legend
.
push
(
data
[
"name"
]);
var
points
=
[];
$
.
each
(
data
[
"points"
],
function
(
key
,
value
)
{
points
.
push
([
Number
(
key
),
parseFloat
(
value
||
0
).
toFixed
(
1
)])
})
series
.
push
({
name
:
data
[
"name"
],
type
:
'line'
,
showSymbol
:
false
,
hoverAnimation
:
false
,
data
:
points
});
var
last
=
''
;
for
(
var
i
in
data
[
"points"
])
{
last
=
i
;
}
list
.
push
({
name
:
data
[
"name"
],
value
:
data
[
"points"
][
last
]
});
var
metric
=
data
[
"metric"
];
$
.
each
(
data
[
"points"
],
function
(
key
,
value
)
{
var
obj
=
timeGroup
[
key
]
||
{};
obj
[
"time"
]
=
new
Date
(
Number
(
key
)).
Format
(
"yyyy-MM-dd hh:mm:ss"
);
obj
[
metric
]
=
value
;
timeGroup
[
key
]
=
obj
;
});
});
var
option
=
this
.
iotChart
.
getOption
();
option
.
legend
=
{
orient
:
"vertical"
,
x
:
"right"
,
padding
:
10
,
show
:
true
,
data
:
legend
};
option
.
series
=
series
;
this
.
iotChart
.
setOption
(
option
);
/* */
const
trenddata
=
res
.
data
.
trenddata
const
list02
=
trenddata
.
datas
const
title
=
[{
label
:
'时间'
,
prop
:
'timeStamp'
,
width
:
180
,
// formatter:function(a,b,c) {
// let show =
// return show
// }
}]
list02
.
forEach
(
item
=>
{
/* 首先构建title*/
title
.
push
({
label
:
item
.
name
,
prop
:
item
.
name
,
width
:
180
,
})
})
this
.
tableTitle
=
title
/* 开始构建表格数据*/
const
timeStampObj
=
{}
list02
.
forEach
(
item
=>
{
const
points
=
item
.
points
let
name
=
item
.
name
Object
.
keys
(
points
).
forEach
(
key
=>
{
if
(
timeStampObj
[
key
])
{
timeStampObj
[
key
][
name
]
=
points
[
key
]
}
else
{
timeStampObj
[
key
]
=
{}
timeStampObj
[
key
][
name
]
=
points
[
key
]
}
})
})
const
data
=
Object
.
keys
(
timeStampObj
).
map
(
key
=>
{
timeStampObj
[
key
][
'timeStamp'
]
=
$moment
(
parseInt
(
key
)).
format
(
'YYYY-MM-DD HH:mm:ss'
)
return
timeStampObj
[
key
]
})
data
.
reverse
()
this
.
tp1Loading
=
true
this
.
$nextTick
(()
=>
{
this
.
$refs
.
tp1
.
total
=
data
.
length
this
.
$refs
.
tp1
.
fePageData
=
data
this
.
$refs
.
tp1
.
tableData
=
this
.
$refs
.
tp1
.
fePageDateShow
()
// 禁用刷新
this
.
$refs
.
tp1
.
refresh
=
()
=>
{
return
false
}
})
})
},
}
}
</
script
>
<
style
scoped
>
/* 可以在这里添加样式 */
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment