【H5】移动端,常见界面布局模板

news2024/11/26 2:00:24

系列文章

【移动设备】iData 50P 技术规格
本文链接:https://blog.csdn.net/youcheng_ge/article/details/130604517

【H5】avalon前端数据双向绑定
本文链接:https://blog.csdn.net/youcheng_ge/article/details/131067187

【H5】安卓自动更新方案(app升级)
本文链接:https://blog.csdn.net/youcheng_ge/article/details/126759498

文章目录

  • 系列文章
  • 前言
  • 一、技术介绍
  • 二、软件开发(源码)
    • 2.1 登录页面
    • 2.2 设置页面
    • 2.3 功能菜单页面
    • 2.4 扫码布局
    • 2.5 表格录入布局
  • 三、效果展示
    • 3.1 登录页面
    • 3.2 设置页面
    • 3.3 功能菜单页面
    • 3.4 扫码布局
    • 3.5 表格录入布局
  • 四、资源链接


前言

本专栏为【底层库】,主要介绍编程过程中 通用函数。我们将这些通用固化的源码,进行重写、封装、拓展,再进行单元测试、集成测试、beta测试,最终形成通用化模板,这里我们称为“底层库”。

作为研发人员的你,并不需要花大量时间,研究“底层库”的含义,及“底层库”的实现方法。你只需要几行调用代码,就可以解决项目上碰到的难题。而底层库使用方法,本专栏均有详细介绍,也有项目应用场景。

底层库已实现功能:MySQL脚本构建器、MySQL数据库访问操作、参数配置文件读写、加解密算法、日志记录、HTTP通信、Socket通信、API前后端交互、邮件发送、文件操作、配置参数存储、Excel导入导出、CSV和DataTable转换、压缩解压、自动编号、Session操作等。

本专栏会持续更新,不断优化【底层库】,大家有任何问题,可以私信我。本专栏之间关联性较强(我会使用到某些底层库,某些文章可能忽略介绍),如果您对本专栏感兴趣,欢迎关注,我将带你用最简洁的代码,实现最复杂的功能。

一、技术介绍

CSV文件和DataTable对象转换帮助类。我们数据库导出文件为“CSV”格式,当你要读取“CSV”文件时,可以使用本类库。

注意:请填写

二、软件开发(源码)

2.1 登录页面

<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport"
			content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<title>APP</title>
		<link rel="stylesheet" type="text/css" href="../css/aui.css" />
		<style type="text/css">
			aui-header {
				overflow: hidden;
				padding: 10px;
			}

			.aui-footer {
				position: absolute;
				bottom: 0px;
				width: 100%;
				z-index: -1;
				clear: both;
			}
		</style>
	</head>
	<body ms-controller="model" style="height:auto">
		<div class="aui-content">
			<p class="aui-padded-10 aui-text-center" style="margin-top: 50px">
				<img style="width:80%;" src="../image/login_top.png" />
			</p>
			<div class="aui-card" style=" margin-left: 30px; margin-right: 30px; margin-top: 20px">
				<div class="aui-form">
					<div class="aui-input-row">
						<i class="aui-input-addon aui-iconfont aui-icon-people"></i>
						<input id="txt_UserNo" type="text" class="aui-input" placeholder="输入账号" onblur="ShowFooter();"
							onfocus="HideFooter();" ms-duplex="UserNo" />
					</div>
					<div class="aui-input-row">
						<i class="aui-input-addon  aui-iconfont aui-icon-lock"></i>
						<input type="password" class="aui-input" placeholder="密码" onblur="ShowFooter();"
							onfocus="HideFooter();" ms-duplex="UserPwd" />
					</div>
				</div>
			</div>
			<div style="margin-left: 30px; margin-right: 30px; margin-top: 0px;">
				<input type="checkbox" class="aui-switch aui-switch-successd aui-pull-right"
					ms-attr-checked="{{model.AutoPwd=='T'? 'checked':''}}" ms-change="Btn_AutoPwd">
				<div class="aui-switch-title">
					记住密码
				</div>
			</div>
			<div style="margin-left: 30px; margin-right: 30px; margin-top: 55px">
				<div class="aui-btn aui-btn-info" style="width:100%;height: 40px;padding-top: 10px;"
					ms-click="checkLogin">
					登录
				</div>
			</div>
		</div>
		<div class="aui-padded-10 aui-text-right aui-iconfont aui-icon-settings" style="margin-right:20px"
			ms-click="doSetting">
			&nbsp;设置
		</div>
		<div class="aui-footer">
			<div class="aui-padded-10 aui-text-center">
				<h5>Copyright &copy; 2022-2025 zhenjiang yuanshi</h5>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/avalon.mobile.js"></script>
	<script type="text/javascript" src="../script/yuanshiApi.js"></script>
	<script type="text/javascript" src="../script/common.js"></script>
	<script type="text/javascript">
		apiready = function() {
			api.parseTapmode();
			SetAPIHost();

			model.Version = api.appVersion;
			model.UserNo = $api.getStorage("user_no");
			model.UserPwd = $api.getStorage("user_pwd");
			model.AutoPwd = $api.getStorage("auto_pwd");
			if (model.AutoPwd == null || model.AutoPwd == "") {
				model.AutoPwd = "T";
			}
		};

		var model = avalon.define({
			$id: "model",
			UserNo: "",
			UserPwd: "",
			AutoPwd: "T",
			Version: "",

			Btn_AutoPwd: function() {
				model.AutoPwd = model.AutoPwd == "T" ? "F" : "T";
			},
			checkLogin: function() {
				model.UserNo = model.UserNo.trim();
				if (model.UserNo.length == 0) {
					ShowToast("请输入账号!");
					return;
				}

				api.showProgress({
					style: 'default',
					animationType: 'fade',
					title: '登录中...',
					text: '',
					modal: true
				});
				api.ajax({
					url: API_HOST,
					method: 'post',
					headers: {
						'Content-Type': 'application/json;charset=utf-8', //必须,否则后端无法识别
						'SN': 0,
						'UserID': model.UserNo
					},
					returnAll: false,
					timeout: 60,
					data: {
						body: JSON.stringify({
							UserNo: model.UserNo,
							UserPwd: model.UserPwd,
							Version: model.Version,
						})
					}
				}, function(ret, err) {
					api.hideProgress();
					if (ret) {
						if (ret.Success && ret.ErrorCode >= 0) { // 登录成功
							$api.clearStorage();
							$api.setStorage('auto_pwd', model.AutoPwd);
							$api.setStorage('user_no', model.UserNo);
							if (model.AutoPwd == "T") {
								$api.setStorage('user_pwd', model.UserPwd);
							}
							$api.setStorage('API_HOST', API_HOST);
							//关闭当前窗口
							api.closeFrame({
								name: ''
							});
						} else { // 登录失败
							ShowToast(ret.ErrorMsg);
						}
					} else {
						api.alert({
							msg: err.msg
						});
					}
				});
			},
			doSetting: function() {
				api.openWin({
					name: "setting",
					url: "setting.html",
					bounces: false,
					delay: 10
				});
			},
		});


		//键盘关闭显示页脚
		function ShowFooter() {
			$api.css($api.dom(".aui-footer"), "display:block;");
		}

		//键盘弹出隐藏页脚
		function HideFooter() {
			$api.css($api.dom(".aui-footer"), "display:none;");
		}
	</script>
</html>

2.2 设置页面

<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport"
			content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<title>设置</title>
		<link rel="stylesheet" type="text/css" href="../css/aui2.1.css" />
		<style>
			header {
				margin-top: 0.75rem;
			}

			.aui-bar {
				margin: 0;
				padding-top: 25px;
			}

			.aui-searchbar {
				background: transparent;
			}

			.aui-bar-nav .aui-searchbar-input {
				background-color: #ffffff;
			}

			.aui-bar-light .aui-searchbar-input {
				background-color: #f5f5f5;
			}

			.aui-footer {
				padding: 15px;
			}

			p {
				margin-bottom: 0.5rem;
			}
		</style>
	</head>

	<body ms-controller="model">
		<header class="aui-bar aui-bar-nav" id="aui-header">
			<a class="aui-pull-left aui-btn" tapmode onclick="closeWin()">
				<span class="aui-iconfont aui-icon-left"></span>返回
			</a>
			<div class="aui-title">设置</div>
		</header>

		<!-- 网络设置 -->
		<div class="aui-card-list-content-padded">
			<ul class="aui-list aui-form-list">
				<li class="aui-list-header" style="background-color: #ffff7f;height: 34px;">
					网络设置
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							服务器地址
						</div>
						<i class="aui-iconfont aui-icon-gear"></i>
						<div class="aui-list-item-input" style="margin-left:10px;">
							<input type="text" id="txt_addr" placeholder="服务器地址" ms-duplex="data.address">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							端口号
						</div>
						<i class="aui-iconfont aui-icon-gear"></i>
						<div class="aui-list-item-input" style="margin-left:10px;">
							<input type="number" id="txt_port" placeholder="端口号" ms-duplex="data.port">
						</div>
					</div>
				</li>
			</ul>
		</div>

		<!-- 样品区域 -->
		<div class="aui-card-list-content-padded">
			<ul class="aui-list aui-form-list">
				<li class="aui-list-header" style="background-color: #ffff7f;height: 34px;">
					打印机设置
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							钨条标
						</div>
						<div class="aui-list-item-input">
							<input type="text" id='txt_wutiaobiao' placeholder="电脑名称" ms-duplex="data.wutiaobiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							钨条样标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.wutiaoyangbiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							粗丝标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.cusibiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							粗丝样标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.cusiyangbiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							退火下机样标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.tuihuoxiajiyangbiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							调试样标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.tiaoshiyangbiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							下机样标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.xiajiyangbiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							成品标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.chengpingbiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							断口样标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.duankouyangbiao">
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							模具标
						</div>
						<div class="aui-list-item-input">
							<input type="text" placeholder="电脑名称" ms-duplex="data.mujubiao">
						</div>
					</div>
				</li>
			</ul>
		</div>

		<section class="aui-content-padded">
			<ul class="aui-list aui-collapse aui-border">
				<div class="aui-collapse-item">
					<li class="aui-list-item aui-collapse-header" tapmode>
						<div class="aui-list-item-inner">
							<div class="aui-list-item-title">版本说明</div>
							<div class="aui-list-item-right">
								<i class="aui-iconfont aui-icon-down aui-collapse-arrow"></i>
							</div>
						</div>
					</li>
					<div class="aui-collapse-content">
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">设备型号</div>
								<div class="aui-list-item-input">
									<input type="text" ms-duplex="data.shebeixinghao" readonly>
								</div>
							</div>
						</li>
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">当前版本</div>
								<div class="aui-list-item-input">
									<input type="text" ms-duplex="data.dangqianbanben" readonly>
								</div>
							</div>
						</li>
						<li class="aui-list-item">
							<div class="aui-list-item-inner" onclick="checkUpdate(true)">
								<div class="aui-list-item-label">检查新版本</div>
								<div class="aui-list-item-right">
									<i class="aui-iconfont aui-icon-right aui-collapse-arrow"></i>
								</div>
							</div>
						</li>
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">版权所有</div>
								<div class="aui-list-item-input">
									Copyright &copy; 2022-2025 yuanshi
								</div>
							</div>
						</li>
						<li class="aui-list-item">
							<div class="aui-list-item-inner">
								<div class="aui-list-item-label">反馈电话</div>
								<div class="aui-list-item-input">
									123456789
								</div>
								<div class="aui-list-item-right">
									<i class="aui-iconfont aui-icon-right aui-collapse-arrow"
										onclick="openContacts()"></i>
								</div>
							</div>
						</li>
					</div>
				</div>

			</ul>
		</section>

		<!--底部状态栏-->
		<div class="aui-footer">
			<p>
			<div class="aui-btn aui-btn-info" style="width: 100%" ms-click="Btn_SaveClick">
				保存
			</div>
			</p>
			<p>
			<div class="aui-btn aui-btn-danger aui-btn-outlined" style="width: 100%" onclick="closeWin()">
				返回
			</div>
			</p>
		</div>

	</body>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/avalon.mobile.js"></script>
	<script type="text/javascript" src="../script/aui-collapse.js"></script>
	<script type="text/javascript" src="../script/common.js"></script>
	<script type="text/javascript">
		apiready = function() {
			api.parseTapmode();
			$api.byId("txt_addr").focus();
			model.data.dangqianbanben = api.appVersion;
			model.data.shebeixinghao = api.deviceModel;
			// 文本内容的读写操作
			api.readFile({
				path: 'fs://yuanshiApi.dat'
			}, function(ret, err) {
				if (ret.status) {
					var obj = JSON.parse(ret.data);
					model.data.address = obj.address;
					model.data.port = obj.port;
					model.data.wutiaobiao = obj.wutiaobiao;
					model.data.wutiaoyangbiao = obj.wutiaoyangbiao;
					model.data.cusibiao = obj.cusibiao;
					model.data.cusiyangbiao = obj.cusiyangbiao;
					model.data.tuihuoxiajiyangbiao = obj.tuihuoxiajiyangbiao;
					model.data.tiaoshiyangbiao = obj.tiaoshiyangbiao;
					model.data.xiajiyangbiao = obj.xiajiyangbiao;
					model.data.chengpingbiao = obj.chengpingbiao;
					model.data.duankouyangbiao = obj.duankouyangbiao;
					model.data.mujubiao = obj.mujubiao;
				}
			});
		}

		var collapse = new auiCollapse({
			autoHide: true //是否自动隐藏已经展开的容器
		});

		var model = avalon.define({
			$id: "model",
			data: {
				shebeixinghao: "",
				dangqianbanben: "",
				address: "127.0.0.1",
				port: 8080,
				wutiaobiao: "",
				wutiaoyangbiao: "",
				cusibiao: "",
				cusiyangbiao: "",
				tuihuoxiajiyangbiao: "",
				tiaoshiyangbiao: "",
				xiajiyangbiao: "",
				chengpingbiao: "",
				duankouyangbiao: "",
				mujubiao: "",
			},

			Btn_SaveClick: function() {
				model.data.address = model.data.address.trim();
				if (model.data.address.length == 0) {
					ShowToast("请输入服务器地址");
					return;
				}
				if (model.data.port <= 0) {
					ShowToast("请输入端口号");
					return;
				}

				//保存文件地址
				api.writeFile({
					path: 'fs://yuanshiApi.dat',
					data: JSON.stringify({
						address: model.data.address,
						port: model.data.port,
						wutiaobiao: model.data.wutiaobiao,
						wutiaoyangbiao: model.data.wutiaoyangbiao,
						cusibiao: model.data.cusibiao,
						cusiyangbiao: model.data.cusiyangbiao,
						tuihuoxiajiyangbiao: model.data.tuihuoxiajiyangbiao,
						tiaoshiyangbiao: model.data.tiaoshiyangbiao,
						xiajiyangbiao: model.data.xiajiyangbiao,
						chengpingbiao: model.data.chengpingbiao,
						duankouyangbiao: model.data.duankouyangbiao,
						mujubiao: model.data.mujubiao
					})
				}, function(ret, err) {
					if (ret.status) {
						//保存成功,需要更新API全局变量
						API_HOST = "http://" + model.data.address + ":" + model.data.port;
						//执行脚本,登录界面 重新获取服务器地址
						var jsfun = 'SetAPIHost();';
						api.execScript({
							frameName: 'login',
							script: jsfun
						});
						closeWin();
					} else {
						api.alert({
							msg: err.msg
						});
					}
				});
			}
		});

		//拨打电话
		function openContacts() {
			api.openContacts(
				function(ret, err) {
					if (ret.status) {
						var msg = '姓名:' + ret.name + '--电话:' + ret.phone;
						ShowToast(msg);
					} else {
						ShowToast({
							msg: err.msg
						});
					};
				}
			);
		}

		//关闭窗体
		function closeWin() {
			api.closeWin();
		}
	</script>
</html>

2.3 功能菜单页面

<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport"
			content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>鼎禄MES移动端</title>
		<link rel="stylesheet" type="text/css" href="../css/aui2.1.css" />
		<style>
			body {
				background-color: white;
			}

			.aui-content {
				position: absolute;
				top: 80px;
				left: 0;
				right: 0;
				bottom: 0;
				margin-bottom: 0;
			}

			.aui-col-image {
				position: relative;
				left: 50%;
				top: 50%;
				transform: translate(-50%, -50%)
			}
		</style>
	</head>

	<body ms-controller="model">
		<div id="aui-header" style="position: fixed;z-index:1;">
			<img src="../image/banner.png" style="width:100%;" />
		</div>
		<!-- 功能菜单 -->
		<section class="aui-content aui-margin-b-10">
			<div class="aui-grid" style="margin-top: 25px;">
				<!-- 物理检验 -->
				<div class="aui-row">
					<div class="aui-card-list-header" style="background-color: #ffff7f;">
						物理检验
					</div>
					<div class="aui-col-xs-3" tapmode ms-click="openWin('WuTiaoYang_frm1','WuTiaoYang_frm1.html')">
						<div class="aui-iconfont">
							<img class="aui-col-image" src="../image/yangpin.png" />
						</div>
						<div class="aui-grid-label">钨条样</div>
					</div>
				</div>
				<!-- 粗丝车间 -->
				<div class="aui-row">
					<div class="aui-card-list-header" style="background-color: #ffff7f;">
						粗丝车间
					</div>
					<div class="aui-col-xs-3" ms-repeat="m_List" tapmode ms-click="openWin(el.fun_guid,el.url)">
						<div class="aui-iconfont">
							<img class="aui-col-image" ms-attr-src="{{el.img_src}}" />
						</div>
						<div class="aui-grid-label">{{el.menu_name}}</div>
					</div>
				</div>
			</div>
		</section>
	</body>
</html>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/avalon.mobile.js"></script>
<script type="text/javascript" src="../script/yuanshiApi.js"></script>
<script type="text/javascript" src="../script/menu.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">
	apiready = function() {
		api.parseTapmode();
		SetAPIHost();

		$api.css($api.dom(".aui-content"), "display:none;");
		//错误
		api.openFrameGroup({
			name: 'main',
			rect: {
				x: 0,
				y: 0,
				w: 'auto',
				h: 'auto'
			},
			scrollEnabled: false,
			index: 0, //默认显示的页面索引
			preload: 1, //预加载的 frame 个数
			frames: [{
				name: 'login',
				url: 'login.html',
				bounces: false,
				bgColor: 'rgba(0,0,0,0)'
			}]
		}, function(ret, err) {
			$api.css($api.dom(".aui-content"), "display:block;");
		});
		model.user_no = $api.getStorage("user_no");
		model.GetMenu(); //获取菜单
	}

	var model = avalon.define({
		$id: "model",
		user_no: "",
		m_List: [],
		GetMenu: function() {
			model.m_List = GetMenu;
		}
	});

	//打开功能页面
	function openWin(name, url) {
		var delay = 0;
		if (api.systemType != 'ios') {
			delay = 300;
		}
		api.openWin({
			name: name,
			url: url,
			pageParam: {
				user_no: model.user_no //向二级页面传参
			},
			bounces: false,
			delay: delay
		});
	}
</script>

2.4 扫码布局

<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport"
			content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>钨条样</title>
		<link rel="stylesheet" type="text/css" href="../css/aui2.1.css" />
		<style type="text/css">
			body {
				background: #ffffff;
			}

			.aui-bar {
				margin: 0;
				padding-top: 25px;
			}

			.aui-card-list-content {
				margin-top: 20px;
			}

			.aui-list {
				border: none;
			}

			.aui-list-item-input input[type="text"] {
				padding: 5px 10px;
				text-align: left;
				border: 1px solid;
				height: 100%;
			}
		</style>
	</head>
	<body ms-controller="model">
		<!-- 标题栏(固定模板) -->
		<header class="aui-bar aui-bar-nav" id="aui-header">
			<a class="aui-btn aui-pull-left" tapmode onclick="closeWin()">
				<span class="aui-iconfont aui-icon-left"></span>返回
			</a>
			<div class="aui-title">
				钨条样
			</div>
		</header>

		<!-- 内容区域 -->
		<div class="aui-content-padded aui-padded-15">
			<h2 class="aui-text-center" style="font-weight:bold">
				扫描钨条标签(10位编号)
			</h2>
			<div class="aui-card-list-content">
				<ul class="aui-list aui-list-in">
					<li class="aui-list-item">
						<div class="aui-list-item-input">
							<input type="text" id="txt_No" class="aui-input" ms-duplex="labelId"
								ms-keydown="Btn_KeyDown(event)" />
						</div>
						<div class="aui-list-item-right">
							<div class="aui-list-item-label-icon">
								<i class="aui-iconfont aui-icon-camera" onclick="openScanner()"></i>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>

		<div class="aui-card-list-footer">
			<div class="aui-btn aui-btn-info" style="width:100%" ms-click="GetLabelData()">
				确定
			</div>
		</div>

	</body>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/avalon.mobile.js"></script>
	<script type="text/javascript" src="../script/yuanshiApi.js"></script>
	<script type="text/javascript" src="../script/common.js"></script>
	<script type="text/javascript">
		apiready = function() {
			api.parseTapmode();
			SetAPIHost();
			//上页传值
			model.user_no = api.pageParam.user_no;
			model.labelId = "";
			$api.byId("txt_No").focus();
		}

		var model = avalon.define({
			$id: "model",
			user_no: "",
			labelId: "",
			//回车事件
			Btn_KeyDown: function(event) {
				if (event.keyCode == 13) {
					model.GetLabelData();
				}
			},
			GetLabelData: function() {
				model.labelId = model.labelId.trim();
				if (model.labelId.length == 0) {
					ShowToast("请扫描二维码!");
					$api.byId("txt_No").focus();
					return;
				}

				let sqlString = "SELECT * FROM dl_mes.钨条样检验数据表 WHERE 样品编号=" + "'" + model.labelId + "'";

				api.ajax({
					url: API_HOST,
					method: 'post',
					headers: {
						'Content-Type': 'application/json;charset=utf-8', //必须,否则后端无法识别
						'SN': 14, //消息ID
						'UserID': model.user_no //用户编号
					},
					returnAll: false,
					timeout: 60,
					data: {
						body: JSON.stringify({
							"sqlString": sqlString
						})
					}
				}, function(ret, err) {
					if (ret) {
						if (ret.Success && ret.Data.List_TableSend[0].length > 0) { //成功
							var l_tbResult = ret.Data.List_TableSend[0];
							model.labelId = "";
							doNext(l_tbResult);
						} else { // 取数失败
							ShowToast(ret.ErrorMsg);
						}
					} else {
						api.alert({
							msg: err.msg
						});
					}
				});
			}

		});

		//扫码
		function openScanner() {
			api.showProgress({
				style: 'default',
				animationType: 'fade',
				title: '启动相机中,请稍候...',
				text: '',
				modal: true
			});
			var FNScanner = api.require('FNScanner');
			FNScanner.open({
					autorotation: true
				},
				function(ret, err) {
					api.hideProgress();
					if (ret.eventType == "success" || ret.eventType == "selectImage") {
						model.labelId = ret.content;
						model.GetLabelData();
					} else if (ret.eventType == 'cameraError') {
						ShowToast("请开启app访问手机摄像头权限");
						return;
					} else {
						$api.byId('txt_No').innerHTML = JSON.stringify(err);
					}
				});
		}

		//关闭页面
		function closeWin() {
			api.closeWin();
		}

		//跳转下一个页面
		function doNext(a_strData) {
			var delay = 0;
			if (api.systemType != 'ios') {
				delay = 300;
			}
			api.openWin({
				name: "WuTiaoYang_frm2",
				url: "WuTiaoYang_frm2.html",
				pageParam: {
					gongsibianhao: a_strData[0].公司编号,
					yangpingleixing: a_strData[0].样品类型,
					yangpingbianhao: a_strData[0].样品编号,
					guige: a_strData[0].样品来源规格,
				},
				bounces: false,
				delay: delay
			});
		}
	</script>
</html>

2.5 表格录入布局

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport"
			content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<title>钨条检验</title>
		<link rel="stylesheet" type="text/css" href="../css/aui2.1.css" />
		<style type="text/css">
			.aui-bar {
				margin: 0;
				padding-top: 25px;
			}

			.aui-list-item-input input[type="text"],
			.aui-list-item-input input[type="number"] {
				padding: 5px 10px;
				text-align: left;
				border: 1px solid;
				height: 100%;
			}

			.aui-list .aui-list-item-label,
			.aui-list .aui-list-item-label-icon {
				font-weight: 400;
				line-height: 1;
				text-align: left;
				display: table-cell;
				white-space: nowrap;
				vertical-align: middle;
				padding: 5px;
				width: 100%;

				overflow: auto;
				display: -webkit-box;
				color: #212121;
				margin: 0;
				padding: 0;
				padding-right: 0.25rem;
				line-height: 2.2rem;
				position: relative;
				-webkit-box-sizing: border-box;
				box-sizing: border-box;
				display: -webkit-box;
				-webkit-align-items: center;
				align-items: center;
			}

			.aui-footer {
				padding: 15px;
			}
		</style>
	</head>
	<body ms-controller="model">
		<!-- 标题栏 -->
		<header class="aui-bar aui-bar-nav" id="aui-header">
			<a class="aui-btn aui-pull-left" tapmode onclick="closeWin()">
				<span class="aui-iconfont aui-icon-left">返回</span>
			</a>
			<div class="aui-title">
				钨条检验
			</div>
		</header>
		<!-- 内容区域 -->
		<div class="aui-card-list-content-padded">
			<ul class="aui-list aui-list-in">
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							样品编号:
						</div>
						<input type="text" class="aui-input aui-text-danger aui-label-outlined"
							ms-duplex="data.yangpingbianhao" readonly />
					</div>
				</li>

				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							样品类型:
						</div>
						<input type="text" class="aui-input aui-text-primary" ms-duplex="data.yangpingleixing"
							readonly />
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							规格:
						</div>
						<input type="text" class="aui-input aui-text-primary" ms-duplex="data.guige" readonly />
					</div>
				</li>
			</ul>
		</div>

		<!-- 内容区域 -->
		<!-- 头部直径 -->
		<div class="aui-content aui-margin-10">
			<ul class="aui-list aui-list-in">
				<li class="aui-list-header" style="background-color: #ffff7f;height: 34px;">
					检验项目
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							头部直径:
						</div>
						<div class="aui-list-item-input">
							<input type="number" class="aui-input" ms-duplex="data.toubuzhijing" />
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							中部直径:
						</div>
						<div class="aui-list-item-input">
							<input type="number" class="aui-input" ms-duplex="data.zhongbuzhijing" />
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							尾部直径:
						</div>
						<div class="aui-list-item-input">
							<input type="number" class="aui-input" ms-duplex="data.weibuzhijing" />
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							空气中重量:
						</div>
						<div class="aui-list-item-input">
							<input type="number" class="aui-input" ms-duplex="data.kongqizhongzhongliang"
								ms-keyup="CalcMiDu" ms-change="CalcMiDu" />
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							水中重量 :
						</div>
						<div class="aui-list-item-input">
							<input type="number" class="aui-input" ms-duplex="data.shuizhongzhongliang"
								ms-keyup="CalcMiDu" ms-change="CalcMiDu" />
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							密度 :
						</div>
						<input type="number" class="aui-input" ms-duplex="data.midu" readonly />
					</div>
				</li>

			</ul>
		</div>
		<!-- 黄丝参数自动计算 -->
		<div class="aui-content aui-margin-10">
			<ul class="aui-list aui-list-in">
				<li class="aui-list-header" style="background-color: #bfbfbf;height: 34px;">
					结果汇总
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							检验结果:
						</div>
						<div class="aui-list-item-input">
							<select ms-duplex-string="data.jianyanjieguoTotal">
								<option ms-repeat-el="jianyanjieguo_list" ms-attr-value="{{el}}">{{el}}</option>
							</select>
						</div>
					</div>
				</li>
				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							不合格原因:
						</div>
						<div class="aui-list-item-input">
							<select ms-duplex-string="data.buhegeyuanyinTotal">
								<option ms-repeat-el="buhegeyuanyin_list" ms-attr-value="{{el}}">{{el}}</option>
							</select>
						</div>
					</div>
				</li>

				<li class="aui-list-item">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-label">
							备注:
						</div>
						<div class="aui-list-item-input">
							<textarea placeholder="填写备注" class="aui-input" style="border:1px solid;text-align: left"
								ms-duplex="data.beizhuTotal"></textarea>
						</div>
					</div>
				</li>
			</ul>
		</div>

		<!--底部状态栏-->
		<div class="aui-footer">
			<div class="aui-btn aui-btn-info" style="width: 100%" ms-click="Btn_OK">
				确认
			</div>
		</div>
	</body>

	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/avalon.mobile.js"></script>
	<script type="text/javascript" src="../script/yuanshiApi.js"></script>
	<script type="text/javascript" src="../script/common.js"></script>
	<script>
		apiready = function() {
			api.parseTapmode();
			SetAPIHost();
			//上页传值
			var l_data = api.pageParam;
			model.data.gongsibianhao = l_data.gongsibianhao;
			model.data.yangpingleixing = l_data.yangpingleixing;
			model.data.yangpingbianhao = l_data.yangpingbianhao;
			model.data.guige = l_data.guige;
		}


		var model = avalon.define({
			$id: "model",
			jianyanjieguo_list: ["空", "合格", "不合格", "报废"],
			buhegeyuanyin_list: ["空", "米数不足", "强度低", "破断力低", "直径大", "直径小", "椭圆度大", "圈形差", "表面不良"], //不合格原因

			data: {
				gongsibianhao: '',
				yangpingbianhao: '',
				yangpingleixing: '',
				guige: '',

				toubuzhijing: '',
				zhongbuzhijing: '',
				weibuzhijing: '',
				kongqizhongzhongliang: '',
				shuizhongzhongliang: '',
				midu: 0,

				jianyanjieguoTotal: '空', //检验结果
				buhegeyuanyinTotal: '空', //不合格原因
				beizhuTotal: '',
			},

			//计算密度(小数点后三位)
			CalcMiDu: function() {
				if (model.data.kongqizhongzhongliang == 0 || model.data.shuizhongzhongliang == 0) {
					return;
				}

				var l_dTotalNum = Number(model.data.kongqizhongzhongliang) - Number(model.data
					.shuizhongzhongliang);
				l_dTotalNum = Number(model.data.kongqizhongzhongliang) / l_dTotalNum;
				model.data.midu = Number(l_dTotalNum.toFixed(3)); //toFixed得到字符串
			},

			Btn_OK: function() {
				if (model.data.toubuzhijing == "0") {
					ShowToast("头部直径,必须填写!");
					return;
				}

				if (model.data.zhongbuzhijing == "0") {
					ShowToast("中部直径,必须填写!");
					return;
				}

				if (model.data.jianyanjieguoTotal == "空") {
					ShowToast("检验结果,不为【空】!");
					return;
				}

				if (model.data.jianyanjieguoTotal == "不合格" &&
					model.data.buhegeyuanyinTotal == "") {
					ShowToast("检验结果【不合格】,需要填写 不合格原因!");
					return;
				}

				model.MakeData();
			},
			MakeData: function(a_strDetail) {
				var l_detail = [];
				l_detail.push({
					公司编号: model.data.gongsibianhao,
					样品类型: model.data.yangpingleixing,
					样品编号: model.data.yangpingbianhao,
					样品来源编号: model.data.yangpingbianhao,

					头部直径: model.data.toubuzhijing,
					中部直径: model.data.zhongbuzhijing,
					尾部直径: model.data.weibuzhijing,
					空气中重量: model.data.kongqizhongzhongliang,
					水中重量: model.data.shuizhongzhongliang,
					密度: model.data.midu,

					检验结果: model.data.jianyanjieguoTotal,
					不合格原因: model.data.buhegeyuanyinTotal,
					是否放行: "空",
					放行原因: "空",
					备注: model.data.beizhuTotal,
					完成时间: "1000-01-01",
					完成录入时间: "1000-01-01",
					检验操作人编号: "空"
				});
				model.SaveData(l_detail);
			},

			SaveData: function(a_strDetail) {
				alert(JSON.stringify(a_strDetail));
				api.showProgress({
					style: 'default',
					animationType: 'fade',
					title: '数据保存中,请稍候...',
					text: '',
					modal: true
				});

				//保存数据
				api.ajax({
					url: API_HOST,
					method: 'post',
					headers: {
						'Content-Type': 'application/json;charset=utf-8' //必须,否则后端无法识别
					},
					timeout: 180,
					returnAll: false,
					data: {
						body: JSON.stringify(a_strDetail)
					}
				}, function(ret, err) {
					api.hideProgress();
					if (ret) {
						if (ret.Success) { // 保存成功
							api.alert({
								title: '提示',
								msg: '保存成功!',
							}, function(ret, err) {
								backToHome();
							});
						} else { // 保存失败
							ShowToast(ret.ErrorMsg);
						}
					} else {
						ShowToast(err.msg);
					}
				});
			},

			//不合格原因
			CallBuHeGeYuanYinSelector: function() {
				var delay = 0;
				if (api.systemType != 'ios') {
					delay = 300;
				}
				api.openWin({
					name: "BuHeGeYuanYin",
					url: "BuHeGeYuanYin.html",
					pageParam: {
						data: ""
					},
					bounces: false,
					delay: delay
				});
			}
		});

		//四舍五入保留2位小数(若第二位小数为0,则保留一位小数)  
		function keepTwoDecimal(num) {
			var result = parseFloat(num);
			if (isNaN(result)) {
				ShowToast("传递参数错误,请检查!");
				return false;
			}
			result = Math.round(num * 100) / 100;
			return result;
		}

		//不合格原因 回调函数
		function SelectBHGYYCallBack(data) {
			model.buhegeyuanyinTotal = data.buhegeyuanyinTotal;
		}

		//关闭页面
		function closeWin() {
			api.closeWin();
		}

		//关闭返回上一页面
		function backToHome() {
			api.closeToWin({
				name: 'WuTiaoYang_frm1'
			});
		}
	</script>
</html>

三、效果展示

3.1 登录页面

在这里插入图片描述

3.2 设置页面

在这里插入图片描述

3.3 功能菜单页面

在这里插入图片描述

3.4 扫码布局

在这里插入图片描述

3.5 表格录入布局

在这里插入图片描述

四、资源链接

以上代码开发,由MES PC端,改造成了移动端,测试使用。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/649971.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

数据库入门上篇(数据库基础概念知识)

在这篇文章里&#xff0c;笔者将简单介绍数据库的起源和发展&#xff0c;数据库的分类&#xff0c;读完这篇文章&#xff0c;大家就对数据库有一个大概了解&#xff0c;也就是知道我们该学什么样的东西 为什么需要数据库 在如今的信息时代&#xff0c;各行各业每天都会产生大量…

11. python从入门到精通——异常处理及程序调试

目录 异常概述 异常处理语句主要有四种 程序调试&#xff1a;Python有两种常用调试方法 异常概述 异常&#xff1a;异常就是出现错误并且会中断程序的正常执行 异常处理语句主要有四种 示例库:在输入浮点数或除数为0时会异常 def division():功能&#xff1a;分苹果print…

【JMeter】threadNum:将接口查询结果列表按顺序赋值给各线程

使用JMeter做性能测试会遇到这么一个场景&#xff1a;后面的请求需要根据前面的查询列表结果通过正则表达式提取器取值后赋值&#xff0c;而后面用户的赋值必须是唯一的&#xff0c;此时该如何做&#xff1f; 如果按编程思维来说&#xff0c;这个问题并不难。只需要把前面的结…

他们都开始偷偷学习高性能计算了 | 学习高性能计算需要哪些前置知识?

随着大模型的越演越烈&#xff0c;高性能计算这一领域被越来越多的人所熟知。未来的超算互联网时代&#xff0c;不懂高性能计算更是难以适应未来时代的发展与变化。很多同学都想学习高性能计算&#xff0c;今天作为国内首家专注高性能计算人才培养的专业机构就帮大家梳理一下&a…

接连三预测成真,75%的参与率,华为、阿里、腾讯纷纷介入

Cartner预测&#xff1a;75%参与率 去年&#xff0c;Cartner预测&#xff0c;75%的大型企业将使用至少四种低代码/无代码开发工具&#xff0c;用于IT应用开发&#xff01; 可以感受的到&#xff0c;这几年低代码以突飞猛进的速度在各领域中得到应用。可以预见的是&#xff0c;…

如何 Java 中的大量的 if else 判断?

目录 问题出现&#xff1a; 如何 Java 中的大量的 if else 判断&#xff1f; 解决方案&#xff1a; 1.策略模式 2.工厂模式 3.映射表 4.反射配置文件------极力推荐使用&#xff01;&#xff01;&#xff01;&#xff01;&#xff01; 问题出现&#xff1a; 如何 Java 中的…

STM32F407ZGT6 LQFP144 uart 打印输出

STM32F407ZGT6 AX58100 ETHERCAT芯片软件&#xff0c;需要查看SSC 协议栈运行情况&#xff0c;UART输出状态信息。 STM32F407ZGT6 驱动库使用标准库&#xff0c;虽然老&#xff0c;但是够用。 1.STM32F407ZGT6 芯片情况 STM32F407ZGT6 作为AX58100 的主控 2.板子硬件 STM3…

mysql双主不一致数据修复

参考&#xff1a; pt-table-checksum — Percona Toolkit Documentation pt-table-sync — Percona Toolkit Documentation #对比host1 test库与备库差别 pt-table-checksum hhost1,proot,P3306,uroot -d test --recursion-method processlist --no-check-binlog-format -…

Spring Boot进阶(52):Spring Boot 如何集成Flyway并初始化执行 SQL 脚本?| 超级详细,建议收藏

1. 前言&#x1f525; 在我们的认知中&#xff0c;我们会使用 SVN 或 Git 进行代码的版本管理。但是&#xff0c;我们是否好奇过&#xff0c;数据库也是需要进行版本管理的呢&#xff1f; 在每次发版的时候&#xff0c;我们可能都会对数据库的表结构进行新增和变更&#xff0c;…

微机保护的数据采集系统(1)

一、模拟五输入电路概述 模拟量输入电路是微机保护装置中很重要的电路。保护装置的动作速度和测量精确度等性能都与该电路密切相关。模拟量输入电路的主要作用是隔离、规范输入电压及完成模数变换&#xff0c;以便与CPU接口&#xff0c;完成数据采集任务。因此这部分电路又称数…

iOS —— xcode14兼容 iOS9~iOS10系统

xcode14兼容 iOS9&#xff5e;iOS10系统 在Xcode升级到Xcode14以后&#xff0c;系统的支持版本升级到了iOS11.0。但是我们项目需要支持iOS9&#xff0c;脚本打包错误提示&#xff1a; The iOS deployment target IPHONEOS_DEPLOYMENT_TARGET is set to 9.0, but the range of …

鼠标的移入、移出事件

目录 一、mouseover和mouseenter 二、mouseout和mouseleave 三、重点总结 在原生JS中鼠标移入移出事件有四个&#xff0c;分别为mouseover ,mouseout ,mouseenter,mouseleave&#xff0c;其中mouseover和mouseenter为移入事件&#xff0c;mouseout和mouseleave为移出事件&…

IDEA提交过滤target、idea、iml、vscode、build、iws、imlz、ipr、xls、rebel.xml

一、问题截图&#xff08;IDEA提交过滤target、idea、iml、vscode、build、iws、imlz、ipr、xls、rebel.xml&#xff09; 二、解决 添加.gitignore提交到仓库&#xff0c;就可以了 HELP.md target/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/** #!**/src/test/**### STS …

交换机中光口是如何配置的

在往期的文章中我们有介绍到电口和光口的概念&#xff0c;以及两者之间的区别。本期文章我们来了解一下交换机光口的是如何配置的。 一、交换机光口是如何配置的 1、确认光口类型&#xff1a;首先&#xff0c;确定光口插槽使用的光模块类型&#xff08;如SFP、SFP、QSFP等&am…

掌握5个关键点,搞定语音识别测试!

现在市面上的智能电子产品千千万&#xff0c;为了达到人们使用更加方便的目的&#xff0c;很多智能产品都开发了语音识别功能&#xff0c;用来语音唤醒进行交互&#xff1b; 另外&#xff0c;各大公司也开发出来了各种智能语音机器人&#xff0c;比如小米公司的“小爱”&#…

Redis实战案例2-基于Redis实现共享session短信登录

1. 实现Redis替代session的业务流程 保存用户登录信息采用Hash结构&#xff1b; key要保证唯一&#xff0c;用随机生成的token&#xff08;随机字符串&#xff09;作为key&#xff1b; 并且要保证客户端可以携带key去redis取出value&#xff0c;之前采用session方式是Tomcat自动…

实在智能RPA亮相2023全球人工智能技术博览会,“能对话的数字员工”引领智能自动化新篇章

随着ChatGPT火爆全网&#xff0c;人工智能再次成为学术界和科技领域“新宠”&#xff0c;一场“智能革命”的序幕悄然掀开。 6月13日&#xff0c;“智能驱动 砥砺前行”为主题的2023全球人工智能技术博览会在杭州未来科技城学术交流中心圆满落下帷幕。此次博览会以展示智能科技…

Java开发 - 带你了解集群间的相互调用,你还在等什么?

目录 前言 导读 项目准备 集群准备 父工程引入子项目 服务调用方HelloService准备 pom文件 yml文件 Controller文件 服务提供方HelloWorld准备 pom文件 yml文件 Controller文件 运行此两个工程 hello_world组集群 集群调用测试 RestTemplate换成Dubbo行不行…

web基础与HTTP

文章目录 一.web基础1.域名概述2.DNS解析3.阿里云域名申请流程 二.网页1.网页&#xff08;HTTP/HTTPS)1.1 网页1.2 网站1.3 域名1.4 HTTP/HTTPS1.5 URL1.&#xff16;HTML1.7超链接1.&#xff18;发布 &#xff12;. HTML&#xff12;.&#xff11;HTML超文本标记语言&#xff…

人机交互学习-3 交互设计目标与原则

交互设计目标与原则 交互设计目标可用性目标易用性&#xff08;learnability&#xff09;高效率&#xff08;efficiency&#xff09;易记性&#xff08;memorability&#xff09;少出错&#xff08;errors&#xff09;主观满意度&#xff08;satisfaction&#xff09; 用户体验…