@@ -7,57 +7,26 @@
< / el-button >
<!-- 编辑模板开关 -- >
< el-switch
v-model = "editTemplate"
active -text = " 编辑模板 "
inactive -text = " 查看模式 "
style = "margin: 0 12px"
/ >
< el-switch v-model = "editTemplate" active-text="编辑模板" inactive-text="查看模式" style="margin: 0 12px" / >
< el-button
v-if = "edit Template"
type = "success"
plain
icon = "el-icon-check"
size = "small"
:loading = "savingTemplate"
@click ="saveTemplate"
>
< el-button v-if = "editTemplate" type="success" plain icon="el-icon-check" size="small" :loading="savingTemplate"
@click ="save Template">
保存模板
< / el -button >
< el-button
v-if = "lastSuccess && lastSuccess.lastSendTime "
type = "primary"
plain
icon = "el-icon-magic-stick"
size = "small"
@click ="applyLastSuccessValues"
>
< el-button v-if = "lastSuccess && lastSuccess.lastSendTime" type="primary" plain icon="el-icon-magic-stick"
size = "small" @click ="applyLastSuccessValues " >
应用上次成功参数
< / el -button >
< el-button
type = "info"
plain
icon = "el-icon-time"
size = "small"
@click ="openHistory"
>
< el-button type = "info" plain icon = "el-icon-time" size = "small" @click ="openHistory" >
历史记录
< / el -button >
< / div >
<!-- 历史浮动面板 -- >
< FloatingPanel
ref = "historyPanel"
title = "炉火下发历史"
storageKey = "FURNACE_SEND_HISTORY_PANEL"
:defaultW = "980"
:defaultH = "520"
:defaultX = "30"
:defaultY = "60"
>
< FloatingPanel ref = "historyPanel" title = "炉火下发历史" storageKey = "FURNACE_SEND_HISTORY_PANEL" :defaultW = "980"
:defaultH = "520" :defaultX = "30" :defaultY = "60" >
< FurnaceHistoryPanel @apply ="applyHistoryValues" / >
< / FloatingPanel >
@@ -71,13 +40,7 @@
< i class = "el-icon-time" > < / i >
上次下发 : { { formatTime ( lastSuccess . lastSendTime ) } }
< / span >
< el-button
type = "primary"
size = "mini"
icon = "el-icon-s-promotion"
@click ="handleSend"
:loading = "sending"
>
< el-button type = "primary" size = "mini" icon = "el-icon-s-promotion" @click ="handleSend" :loading = "sending" >
下发
< / el-button >
< / div >
@@ -86,11 +49,7 @@
<!-- 按模板渲染可编辑表单 -- >
< el-form :model = "form" label -position = " top " size = "mini" >
< div class = "group-list" >
< div
v-for = "group in groupedItems"
:key = "group.groupKey"
class = "group-section"
>
< div v-for = "group in groupedItems" :key="group.groupKey" class="group-section" >
< div class = "group-header" >
< span class = "group-title" > { { group . groupTitle } } < / span >
< span class = "group-count" > ( { { group . items . length } } 项 ) < / span >
@@ -98,17 +57,10 @@
<!-- 每行三个输入框 -- >
< el-row :gutter = "20" >
< el-col
:span = "8"
v-for = "item in group.items"
: key = "item.templateItemId || item.paramCode"
>
< el-col :span = "8" v-for = "item in group.items" :key="item.templateItemId || item.paramCode" >
< el -form -item :label = "item.labelEn" >
< el-input
v-model = "form[item.paramCode]"
:placeholder = "getPlaceholder(item)"
: class = "{ 'is-changed': isChangedFromLast(item) }"
/ >
< el-input v-model = "form[item.paramCode]" :placeholder="getPlaceholder(item)"
: class = "{ 'is-changed': isChangedFromLast(item) }" / >
<!-- 辅助信息 : 上次 / 默认值 ( 常驻 , 不会像 placeholder 一样消失 ) -- >
< div class = "field-hint" >
@@ -176,8 +128,17 @@ export default {
computed : {
templateItems ( ) {
if ( ! this . template || ! Array . isArray ( this . template . items ) ) return [ ]
// 后端 enabled 可能是 1/0、"1"/"0"、true/false, 避免被错误过滤导致页面无字段
return [ ... this . template . items ]
. filter ( i => i . enabled === undefined || i . enabled === 1 )
. filter ( i => {
const en = i && i . enabled
// 未提供 enabled: 默认展示
if ( en === undefined || en === null || en === '' ) return true
// 明确禁用: 0/"0"/false
if ( en === 0 || en === false ) return false
if ( String ( en ) === '0' ) return false
return true
} )
. sort ( ( a , b ) => ( a . itemNo || 0 ) - ( b . itemNo || 0 ) )
} ,
@@ -427,7 +388,7 @@ export default {
type : 'warning'
} ) . then ( ( ) => {
this . doSend ( )
} ) . catch ( ( ) => { } )
} ) . catch ( ( ) => { } )
} ,
async doSend ( ) {
@@ -499,23 +460,88 @@ export default {
< / script >
< style scoped >
. page - title { margin - bottom : 20 px ; }
. toolbar { margin - bottom : 20 px ; display : flex ; flex - wrap : wrap ; gap : 8 px ; align - items : center ; }
. card - grid - container { min - height : 300 px ; }
. parameter - card . card - header { display : flex ; justify - content : space - between ; align - items : center ; }
. card - title { font - weight : 600 ; }
. header - right { display : flex ; align - items : center ; }
. last - send - time { font - size : 12 px ; color : # 909399 ; margin - right : 16 px ; }
. empty - data { margin - top : 20 px ; }
. addr - inline { margin - top : 6 px ; }
. addr - label { display : inline - block ; margin - right : 6 px ; color : # 909399 ; font - size : 12 px ; }
. page - title {
margin - bottom : 20 px ;
}
. group - list { margin - top : 8 px ; }
. group - section { padd ing : 10 px 0 6 px ; border -top : 1 px solid # ebeef5 ; }
. group - section : first - child { border - top : none ; padding - top : 0 ; }
. group - header { display : flex ; align - items : baseline ; gap : 8 px ; margin : 4 px 0 10 px ; }
. group - title { font - weight : 600 ; }
. group - count { color : # 909399 ; font - size : 12 px ; margin - left : 6 px ; }
. toolbar {
marg in - bot tom : 20 px ;
display : flex ;
flex - wrap : wrap ;
gap : 8 px ;
align - items : center ;
}
. card - grid - container {
min - height : 300 px ;
}
. parameter - card . card - header {
display : flex ;
justify - content : space - between ;
align - items : center ;
}
. card - title {
font - weight : 600 ;
}
. header - right {
display : flex ;
align - items : center ;
}
. last - send - time {
font - size : 12 px ;
color : # 909399 ;
margin - right : 16 px ;
}
. empty - data {
margin - top : 20 px ;
}
. addr - inline {
margin - top : 6 px ;
}
. addr - label {
display : inline - block ;
margin - right : 6 px ;
color : # 909399 ;
font - size : 12 px ;
}
. group - list {
margin - top : 8 px ;
}
. group - section {
padding : 10 px 0 6 px ;
border - top : 1 px solid # ebeef5 ;
}
. group - section : first - child {
border - top : none ;
padding - top : 0 ;
}
. group - header {
display : flex ;
align - items : baseline ;
gap : 8 px ;
margin : 4 px 0 10 px ;
}
. group - title {
font - weight : 600 ;
}
. group - count {
color : # 909399 ;
font - size : 12 px ;
margin - left : 6 px ;
}
/* 字段提示信息 */
. field - hint {