Compare commits
2 Commits
c11805aff1
...
2045fd9c43
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2045fd9c43 | ||
|
|
98bd642a2b |
@@ -51,8 +51,9 @@
|
||||
register: false,
|
||||
globalConfig: getApp().globalData.config,
|
||||
loginForm: {
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
// 1. 修改默认值为空
|
||||
username: "",
|
||||
password: "",
|
||||
code: "",
|
||||
uuid: ""
|
||||
}
|
||||
@@ -67,8 +68,43 @@
|
||||
this.$tab.reLaunch('/pages/easycode/easycode')
|
||||
}
|
||||
//#endif
|
||||
|
||||
// 2. 页面加载时读取本地存储的账号密码
|
||||
this.loadLoginInfo()
|
||||
},
|
||||
methods: {
|
||||
// 新增:读取本地存储的登录信息
|
||||
loadLoginInfo() {
|
||||
try {
|
||||
// 从本地存储获取用户名
|
||||
const savedUsername = uni.getStorageSync('login_username')
|
||||
// 从本地存储获取密码
|
||||
const savedPassword = uni.getStorageSync('login_password')
|
||||
|
||||
// 如果有保存的信息,填充到表单
|
||||
if (savedUsername) {
|
||||
this.loginForm.username = savedUsername
|
||||
}
|
||||
if (savedPassword) {
|
||||
this.loginForm.password = savedPassword
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('读取本地登录信息失败:', e)
|
||||
}
|
||||
},
|
||||
|
||||
// 新增:保存登录信息到本地存储
|
||||
saveLoginInfo() {
|
||||
try {
|
||||
// 保存用户名到本地
|
||||
uni.setStorageSync('login_username', this.loginForm.username)
|
||||
// 保存密码到本地
|
||||
uni.setStorageSync('login_password', this.loginForm.password)
|
||||
} catch (e) {
|
||||
console.error('保存登录信息失败:', e)
|
||||
}
|
||||
},
|
||||
|
||||
// 用户注册
|
||||
handleUserRegister() {
|
||||
this.$tab.redirectTo(`/pages/register`)
|
||||
@@ -120,6 +156,9 @@
|
||||
},
|
||||
// 登录成功后,处理函数
|
||||
loginSuccess(result) {
|
||||
// 3. 登录成功后保存账号密码到本地存储
|
||||
this.saveLoginInfo()
|
||||
|
||||
// 设置用户信息
|
||||
this.$store.dispatch('GetInfo').then(res => {
|
||||
this.$tab.reLaunch('/pages/index')
|
||||
@@ -177,7 +216,6 @@
|
||||
text-align: left;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
@@ -207,5 +245,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from '@/utils/L2Request'
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建发送任务
|
||||
export function createSendJob(data) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from '@/utils/L2Request'
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获取发送模板(含明细)
|
||||
export function getSendTemplate(templateCode) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from '@/utils/L2Request'
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获取 DRIVE 设定值(最新成功发送)
|
||||
export function getDriveSetupValue() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from '@/utils/l2-request'
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 按模板编码查询发送模板(含明细)
|
||||
|
||||
@@ -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="editTemplate"
|
||||
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="saveTemplate">
|
||||
保存模板
|
||||
</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 || i.enabled === null)
|
||||
.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: 20px; }
|
||||
.toolbar { margin-bottom: 20px; display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
|
||||
.card-grid-container { min-height: 300px; }
|
||||
.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: 12px; color:#909399; margin-right:16px; }
|
||||
.empty-data { margin-top: 20px; }
|
||||
.addr-inline { margin-top: 6px; }
|
||||
.addr-label { display:inline-block; margin-right:6px; color:#909399; font-size:12px; }
|
||||
.page-title {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.group-list { margin-top: 8px; }
|
||||
.group-section { padding: 10px 0 6px; border-top: 1px solid #ebeef5; }
|
||||
.group-section:first-child { border-top: none; padding-top: 0; }
|
||||
.group-header { display:flex; align-items:baseline; gap:8px; margin: 4px 0 10px; }
|
||||
.group-title { font-weight: 600; }
|
||||
.group-count { color:#909399; font-size: 12px; margin-left: 6px; }
|
||||
.toolbar {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-grid-container {
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.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: 12px;
|
||||
color: #909399;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.empty-data {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.addr-inline {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.addr-label {
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.group-list {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.group-section {
|
||||
padding: 10px 0 6px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.group-section:first-child {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.group-header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
margin: 4px 0 10px;
|
||||
}
|
||||
|
||||
.group-title {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.group-count {
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
/* 字段提示信息 */
|
||||
.field-hint {
|
||||
|
||||
Reference in New Issue
Block a user