Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jump_hm_warehouse
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
毛勇泽
jump_hm_warehouse
Commits
912476ba
Commit
912476ba
authored
Jan 18, 2024
by
huangqy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FORM表单
parent
91106633
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
200 行增加
和
15 行删除
+200
-15
oh-package.json5
common/oh-package.json5
+1
-0
General.ets
entry/src/main/ets/pages/sub_systemMaintenance/General.ets
+59
-10
BasicDialog.ets
entry/src/main/ets/view/BasicDialog/BasicDialog.ets
+38
-5
GeneralDialog.ets
entry/src/main/ets/view/GeneralDialog/GeneralDialog.ets
+93
-0
UniInitList.ets
features/SystemMaintenance/src/main/ets/model/UniInitList.ets
+9
-0
没有找到文件。
common/oh-package.json5
View file @
912476ba
...
@@ -8,5 +8,6 @@
...
@@ -8,5 +8,6 @@
"version": "1.0.0",
"version": "1.0.0",
"dependencies": {
"dependencies": {
"reflect-metadata": "^0.1.13",
"reflect-metadata": "^0.1.13",
"@ohos/axios": "^2.1.1"
}
}
}
}
entry/src/main/ets/pages/sub_systemMaintenance/General.ets
View file @
912476ba
import { generalInitList, scanInitList, systemList, UniListItem } from '@ohos/system/src/main/ets/model/UniInitList'
import { generalInitList, scanInitList, systemList, UniListItem } from '@ohos/system/src/main/ets/model/UniInitList'
import { TitleBar } from '../../view/title/TitleBar'
import { TitleBar } from '../../view/title/TitleBar'
import { BasicDialog } from '../../view/BasicDialog/BasicDialog'
import { BasicDialog } from '../../view/BasicDialog/BasicDialog'
import promptAction from '@ohos.promptAction'
@Extend(Button) function CommonButtonStyle() {
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderWidth(2)
...
@@ -12,10 +13,52 @@ import { BasicDialog } from '../../view/BasicDialog/BasicDialog'
...
@@ -12,10 +13,52 @@ import { BasicDialog } from '../../view/BasicDialog/BasicDialog'
.stateEffect(true)
.stateEffect(true)
}
}
// 需要提交的表单
interface FormData {
httpURL: string,
httpPORT: string,
scoketURL: string,
scoketPORT: string,
themeName: string,
themeColor: string,
reconnection_mode: boolean,
push_mode: boolean,
transmission_mode: string,
continue_scan_mode: boolean,
scan_read_mode: string,
scanning_mode: string,
broadcastKey: string,
power: string
}
@Entry
@Entry
@Component
@Component
export struct General {
export struct General {
@State systemTitle: Array<string> = ['直连配置','扫描配置','系统配置'];
@State systemTitle: Array<string> = ['直连配置','扫描配置','系统配置'];
@State clickItem: UniListItem = {
title: '',
showExtraIcon: true,
showArrow: true,
url: ''
};
@State formData: FormData = {
httpURL: '',
httpPORT: "",
scoketURL: "",
scoketPORT: "",
themeName: "",
themeColor: "",
reconnection_mode: true,
push_mode: true,
transmission_mode: "",
continue_scan_mode: false,
scan_read_mode: "",
scanning_mode: "",
broadcastKey: "",
power: ""
}
getListInfo(index:number):UniListItem[]{
getListInfo(index:number):UniListItem[]{
switch (index){
switch (index){
case 0:
case 0:
...
@@ -29,19 +72,17 @@ export struct General {
...
@@ -29,19 +72,17 @@ export struct General {
break;
break;
}
}
}
}
scroller: Scroller = new Scroller()
dialogController: CustomDialogController = new CustomDialogController({
dialogController: CustomDialogController = new CustomDialogController({
builder: BasicDialog({
builder: BasicDialog({
cancel: this.onCancel,
cancel: this.onCancel,
confirm: this.onSubmit,
confirm: this.onSubmit,
title: '2.0业务终端IP'
clickItem: $clickItem,
formData: $formData,
}),
}),
cancel: this.existApp,
autoCancel: true,
autoCancel: true,
alignment: DialogAlignment.Default,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
customStyle: true
gridCount: 4,
customStyle: false
})
})
onCancel() {
onCancel() {
...
@@ -92,7 +133,7 @@ export struct General {
...
@@ -92,7 +133,7 @@ export struct General {
Blank()
Blank()
.layoutWeight(1)
.layoutWeight(1)
Text(
item.targetValue
)
Text(
this.formData[item?.key]
)
.fontSize(16)
.fontSize(16)
.flexGrow(1)
.flexGrow(1)
.align(Alignment.End)
.align(Alignment.End)
...
@@ -105,7 +146,10 @@ export struct General {
...
@@ -105,7 +146,10 @@ export struct General {
}
}
.height(71)
.height(71)
.onClick(() => {
.onClick(() => {
this.clickItem = item
if (this.dialogController != undefined) {
this.dialogController.open()
}
})
})
})
})
}
}
...
@@ -122,7 +166,11 @@ export struct General {
...
@@ -122,7 +166,11 @@ export struct General {
}.height('82%')
}.height('82%')
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {
Button("保存").CommonButtonStyle()
Button("保存").CommonButtonStyle().onClick(() => {
promptAction.showToast({
message: JSON.stringify(this.formData)
})
})
Button("重置").CommonButtonStyle()
Button("重置").CommonButtonStyle()
}
}
.height(70)
.height(70)
...
@@ -137,4 +185,5 @@ export struct General {
...
@@ -137,4 +185,5 @@ export struct General {
})
})
}
}
}
}
entry/src/main/ets/view/BasicDialog/BasicDialog.ets
View file @
912476ba
import { UniListItem } from '@ohos/system/src/main/ets/model/UniInitList';
@Extend(Button) function CommonButtonStyle() {
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderWidth(2)
.borderColor('#0fa983')
.borderColor('#0fa983')
...
@@ -8,10 +9,32 @@
...
@@ -8,10 +9,32 @@
.stateEffect(true)
.stateEffect(true)
}
}
// 需要提交的表单
interface FormData {
httpURL: string,
httpPORT: string,
scoketURL: string,
scoketPORT: string,
themeName: string,
themeColor: string,
reconnection_mode: boolean,
push_mode: boolean,
transmission_mode: string,
continue_scan_mode: boolean,
scan_read_mode: string,
scanning_mode: string,
broadcastKey: string,
power: string
}
@CustomDialog
@CustomDialog
@Component
@Component
export struct BasicDialog {
export struct BasicDialog {
private title: string;
private title: string;
@Link formData: FormData;
@Link clickItem: UniListItem
controller: CustomDialogController
controller: CustomDialogController
cancel: () => void
cancel: () => void
confirm: () => void
confirm: () => void
...
@@ -28,16 +51,22 @@ export struct BasicDialog {
...
@@ -28,16 +51,22 @@ export struct BasicDialog {
.color('#19ac88')
.color('#19ac88')
.opacity(0.6)
.opacity(0.6)
.margin({ left: 8, right: 8 })
.margin({ left: 8, right: 8 })
Text(this.
title
)
Text(this.
clickItem.title).fontSize(20
)
.fontSize(20)
}
}
.padding({ top: 10, bottom: 10 })
.padding({ top: 10, bottom: 10 })
}
}
this.container()
Column() {
TextInput({ placeholder: '', text: this.formData[this.clickItem?.key] }).height(40).width('90%').borderRadius(4)
.onChange((value: string) => {
this.formData[this.clickItem?.key] = value
})
}
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('确认')
Button('确认')
.onClick(() => {
.onClick(() => {
// this.httpURL = this.textValue
this.controller.close()
this.controller.close()
this.confirm()
this.confirm()
}).CommonButtonStyle()
}).CommonButtonStyle()
...
@@ -46,7 +75,10 @@ export struct BasicDialog {
...
@@ -46,7 +75,10 @@ export struct BasicDialog {
this.controller.close()
this.controller.close()
this.cancel()
this.cancel()
}).CommonButtonStyle()
}).CommonButtonStyle()
}.margin({ bottom: 10 })
}.margin({
top: 10,
bottom: 10 })
}
}
.width('86%')
.borderRadius(5)
.backgroundColor('#fff')
}
}
}
}
\ No newline at end of file
entry/src/main/ets/view/GeneralDialog/GeneralDialog.ets
0 → 100644
View file @
912476ba
import { UniListItem } from '@ohos/system/src/main/ets/model/UniInitList';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
.backgroundColor('#fff')
.fontColor('#0fa983')
.borderRadius(10)
.type(ButtonType.Normal)
.stateEffect(true)
}
@Observed
class UniList {
title: string; // 标题
showExtraIcon: boolean; // 是否显示额外的图标
showArrow: boolean; // 右边箭头
extraIcon?: Resource; // 图标本体
url?: string; // 跳转的URL
targetValue?: string; // 右侧的值
description?: string; // 描述
constructor(title, showExtraIcon, showArrow, extraIcon, url, targetValue, description) {
this.title = title;
this.showExtraIcon = showExtraIcon;
this.showArrow = showArrow;
this.extraIcon = extraIcon;
this.url = url;
this.targetValue = targetValue;
this.description = description;
}
}
@CustomDialog
@Component
export struct GeneralDialog {
// @ObjectLink uniList: UniList
controller: CustomDialogController
cancel: () => void
confirm: () => void
@BuilderParam container: () => void
textController: TextInputController = new TextInputController()
build() {
Column() {
Flex({ alignItems: ItemAlign.Start }) {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text('').fontSize(20)
}
.padding({ top: 10, bottom: 10 })
}
Column() {
TextInput({ text: '', controller: this.textController })
.borderRadius(4)
.height(35)
.onChange((value: string) => {
})
}
.padding({ left: 10, right: 10 })
.width('100%')
.height(35)
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('确认')
.onClick(() => {
this.controller.close()
this.confirm()
}).CommonButtonStyle()
Button('取消')
.onClick(() => {
this.controller.close()
this.cancel()
}).CommonButtonStyle()
}.margin({ top: 10, bottom: 10 })
}
.width('86%')
.borderRadius(5)
.backgroundColor('#fff')
}
}
\ No newline at end of file
features/SystemMaintenance/src/main/ets/model/UniInitList.ets
View file @
912476ba
...
@@ -6,8 +6,11 @@ export interface UniListItem {
...
@@ -6,8 +6,11 @@ export interface UniListItem {
url?: string; // 跳转的URL
url?: string; // 跳转的URL
targetValue?: string; // 右侧的值
targetValue?: string; // 右侧的值
description?: string; // 描述
description?: string; // 描述
key?: string; //对应的键值对
}
}
export const uniInitList: UniListItem[] = [
export const uniInitList: UniListItem[] = [
{
{
title: '数据同步',
title: '数据同步',
...
@@ -132,6 +135,7 @@ export const maintenanceList: UniListItem[] = [
...
@@ -132,6 +135,7 @@ export const maintenanceList: UniListItem[] = [
export const generalInitList: UniListItem[] = [
export const generalInitList: UniListItem[] = [
{
{
title: '2.0业务数据服务IP',
title: '2.0业务数据服务IP',
key: 'httpURL',
showExtraIcon: true,
showExtraIcon: true,
showArrow: true,
showArrow: true,
//extraIcon: '',
//extraIcon: '',
...
@@ -140,6 +144,7 @@ export const generalInitList: UniListItem[] = [
...
@@ -140,6 +144,7 @@ export const generalInitList: UniListItem[] = [
},
},
{
{
title: '2.0业务终端IP',
title: '2.0业务终端IP',
key: 'httpPORT',
showExtraIcon: true,
showExtraIcon: true,
showArrow: true,
showArrow: true,
//extraIcon: '',
//extraIcon: '',
...
@@ -148,6 +153,7 @@ export const generalInitList: UniListItem[] = [
...
@@ -148,6 +153,7 @@ export const generalInitList: UniListItem[] = [
},
},
{
{
title: '2.0业务终端通讯端口',
title: '2.0业务终端通讯端口',
key: 'scoketURL',
showExtraIcon: true,
showExtraIcon: true,
showArrow: true,
showArrow: true,
//extraIcon: '',
//extraIcon: '',
...
@@ -156,6 +162,7 @@ export const generalInitList: UniListItem[] = [
...
@@ -156,6 +162,7 @@ export const generalInitList: UniListItem[] = [
},
},
{
{
title: '传输方式',
title: '传输方式',
key: 'transmission_mode',
showExtraIcon: true,
showExtraIcon: true,
showArrow: true,
showArrow: true,
//extraIcon: '',
//extraIcon: '',
...
@@ -164,6 +171,7 @@ export const generalInitList: UniListItem[] = [
...
@@ -164,6 +171,7 @@ export const generalInitList: UniListItem[] = [
},
},
{
{
title: '连接模式',
title: '连接模式',
key: 'reconnection_mode',
showExtraIcon: true,
showExtraIcon: true,
showArrow: true,
showArrow: true,
//extraIcon: '',
//extraIcon: '',
...
@@ -172,6 +180,7 @@ export const generalInitList: UniListItem[] = [
...
@@ -172,6 +180,7 @@ export const generalInitList: UniListItem[] = [
},
},
{
{
title: '推送模式',
title: '推送模式',
key: 'push_mode',
showExtraIcon: true,
showExtraIcon: true,
showArrow: true,
showArrow: true,
//extraIcon: '',
//extraIcon: '',
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论