| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- <html>
- <head>
- <style>
- .table-container>tr>th{
- width:130px !important;
- }
- /* 把content-box的高度限制 从公共css 抽到具体有需要的页面 by xu 20251215 */
- .form-container .content-box {
- height: calc(100% - 80px) !important;
- padding-top: 40px !important;
- }
- td{
- display: flex;
- align-items: center;
- justify-content: flex-start;
- }
- </style>
- </head>
- <body class="env-input-body">
- <script src="/js/reader/reader-client.js"></script>
- <script type="text/javascript" src="/js/reader/ka-nfc-page.js"></script>
- <div style="position:fixed;top:0px;left:0px;z-index:9999;padding:8px 24px;display:flex;align-items:center;gap:12px;">
- <button id="btnConnect" class="primary" type="button" style="display:none;">连接读卡器</button>
- <span id="readerStatusTag" style="font-size:14px;color:#64748b;">读卡器连接中...</span>
- </div>
- <input id="wsUrlText" type="hidden" value="ws://127.0.0.1:6689"/> <%-- WebSocket。Lin --%>
- <input id="pollingInterval" type="hidden" value="1000" min="100" step="100" /> <%-- 轮询间隔 (毫秒)。Lin --%>
- <input id="dedupeMode" type="hidden" value="session"/> <%-- 去重模式:本次会话去重。Lin --%>
- <%-- ISO14443A 参数。Lin --%>
- <input id="keyTypeInput" type="hidden" value="0"/> <%-- 密钥类型:Key A。1 = Key B。Lin --%>
- <input id="keyInput" type="hidden" value="FFFFFFFFFFFF" maxlength="12"/> <%-- 密钥。Lin --%>
- <input id="blockAddressInput" type="hidden" value="1" min="0" /> <%-- 块地址。Lin --%>
- <input id="numberOfBlocksReadInput" type="hidden" value="1" min="1"/> <%-- 读取块数。Lin --%>
- <%-- --%>
- <%-- ISO15693 参数。Lin --%>
- <input id="readDataTypeInput" type="hidden" value="0"/> <%-- 读取数据类型:block。1 = afi,2 = eas,3 = block and afi,4 = block and eas,5 = afi and eas,6 = block and afi and eas。Lin --%>
- <input id="readSecurityStatusInput" type="hidden" value="0"/> <%-- 读取安全位:不读取。1 = 读取。Lin --%>
- <input id="iso15693BlockAddressInput" type="hidden" value="0" min="0"/> <%-- 块地址。Lin --%>
- <input id="iso15693NumberOfBlocksInput" type="hidden" value="7" min="1"/> <%-- 读取块数。Lin --%>
- <%-- --%>
- <form method="post" id="app" class="form-container">
- <div class="content-box fit-height-content">
- <div class="content-div" ssFith="true">
- <table class='form'>
- <tr>
- <th>部门/亲属</th>
- <td style="display: flex;align-items: center;">
- <objp.ss name="bmid" cb="bm" inp="true" width="200px"/>
- <onoff.ss name="rylbm" mode="edit" rad="false" null="false" val="1100" />
- <input name="rylbm" value="职工亲属" ssVal="1000" />
- </td>
- </tr>
- <%-- 先去掉,接入读卡器时再加。Lin
- <tr>
- <th>卡号</th>
- <td >
- <@input name="kah"/>
- </td>
- </tr>
- --%>
- <tr>
- <th>人员</th>
- <td>
- <input name="czryid" type="hidden" value='${sessionScope.ssUser.ryid}'/> <%-- 操作人员ID。Lin --%>
- <objp.ss name="cyryid" cb="ryByBmOrRylb" inp="true" onChange="selBaseInfoByRyid" filterField="bmid,rylbm" />
- </td>
-
- <th>部门</th>
- <td id='bm'></td>
- </tr>
- <tr>
- <th>姓名</th>
- <td id='xm'></td>
-
- <th>人员号</th>
- <td id='ryh'></td>
- </tr>
- <tr>
- <th>NFC</th>
- <td>
- <input name="kah"/>
- </td>
- </tr>
- </table>
- </div>
-
- </div>
- <div class='bottom-div'>
- <ss-bottom-button
- id="saveAndCommit"
- text="保存并提交"
- onclick='submitGrtfForm();'<%-- 功能说明:个人退费页提交前先校验金额必须为负数 by xu 20260323 --%>
- icon-class="bottom-div-save"
- ></ss-bottom-button>
- <ss-bottom-button
- text="关闭"
- onclick='ss.display.closeDialog();'
- icon-class="bottom-div-close"
- ></ss-bottom-button>
- </div>
- </form>
- </body>
- </html>
- <script>
- function getFormAppVm(){
- var appEl = document.getElementById("app");
- if (!appEl || !appEl.__vue_app__ || !appEl.__vue_app__._instance) {
- return null;
- }
- return appEl.__vue_app__._instance.proxy || null;
- }
- function normalizeRylbmValues(value){
- if (Array.isArray(value)) {
- return value.map(function(item){
- return item == null ? "" : item.toString();
- }).filter(Boolean);
- }
- if (value == null || value === "") {
- return [];
- }
- var cleanValue = value.toString().replace(/^,+/, "");
- if (!cleanValue) {
- return [];
- }
- return cleanValue.split(/[,|]/).filter(Boolean);
- }
- function hasRelativeRylbmValue(value){
- return normalizeRylbmValues(value).indexOf("1000") !== -1;
- }
- function clearRyDisplay(){
- var bmbjEl = document.getElementById('bmbj');
- var xmEl = document.getElementById('xm');
- var ryhEl = document.getElementById('ryh');
- if (bmbjEl) bmbjEl.innerHTML = "";
- if (xmEl) xmEl.innerHTML = "";
- if (ryhEl) ryhEl.innerHTML = "";
- }
- function clearRySelection(vm){
- if (!vm) {
- clearRyDisplay();
- return;
- }
- vm.ryid = "";
- clearRyDisplay();
- }
- function handleRylbmChange(groupValue){
- if (!hasRelativeRylbmValue(groupValue)) {
- return;
- }
- var vm = getFormAppVm();
- if (!vm) {
- clearRyDisplay();
- return;
- }
- vm.bmid = "";
- clearRySelection(vm);
- }
- function handleBjChange(value){
- if (value == null || value === "") {
- return;
- }
- var vm = getFormAppVm();
- if (!vm) {
- clearRyDisplay();
- return;
- }
- if (hasRelativeRylbmValue(vm.rylbm)) {
- vm.rylbm = "1100";
- }
- clearRySelection(vm);
- }
-
- function selBaseInfoByRyid(value){
- $.ajax({
- url:"<serv.ss name='ry_selBaseInfoByRyid'/>",
- type:"post",
- data:{
- ryid:value
- },
- dataType:"json",
- success:function(data){
- if (data.ssCode != 0) {
- alert(data.ssMsg);
- return;
- }
- var d = data.ssData;
- document.getElementById('xm').innerHTML = d.xm;
- document.getElementById('ryh').innerHTML = d.ryh;
- if (d.rylbm != 1100) { // 不是学员。Lin
- if (d.bmmc)
- document.getElementById('bmbj').innerHTML = d.bmmc;
- else
- document.getElementById('bmbj').innerHTML = "(无)";
- } else {
- if (d.bjmc)
- document.getElementById('bmbj').innerHTML = d.bjmc;
- else
- document.getElementById('bmbj').innerHTML = "(无)";
- }
- <%-- 再去掉,不显示。Lin
- document.getElementById('xfye').innerHTML = d.xfye;
- --%>
- }
- });
- }
- function selBaseInfoByKah(value){
- $.ajax({
- url:"<serv.ss name='ry_selBaseInfoByKah'/>",
- type:"post",
- data:{
- kah:value
- },
- dataType:"json",
- success:function(data){
- if (data.ssCode != 0) {
- alert(data.ssMsg);
- return;
- }
- var d = data.ssData;
- document.getElementById('xm').innerHTML = d.xm;
- document.getElementById('ryh').innerHTML = d.ryh;
- if (d.rylbm != 1100) { // 不是学员。Lin
- if (d.bmmc)
- document.getElementById('bmbj').innerHTML = d.bmmc;
- else
- document.getElementById('bmbj').innerHTML = "(无)";
- } else {
- if (d.bjmc)
- document.getElementById('bmbj').innerHTML = d.bjmc;
- else
- document.getElementById('bmbj').innerHTML = "(无)";
- }
- <%-- 再去掉,不显示。Lin
- document.getElementById('xfye').innerHTML = d.xfye;
- --%>
- }
- });
- }
- </script>
- <script type="text/javascript" src="/js/validate/validator-rules.js"></script><%-- 功能说明:个人退费页接入桌面端校验规则,支持 SsInp 红线提示 by xu 20260323 --%>
- <script type="text/javascript" src="/js/validate/validation-manager.js"></script><%-- 功能说明:个人退费页接入桌面端校验管理器,支持 SsInp 红线提示 by xu 20260323 --%>
- <script>
- var GRTF_LABEL_MAP = window.GRTF_LABEL_MAP || {};
- // 功能说明:记录当前退费类别的最新 value/label,避免 onoff 隐藏值切换时机导致金额校验判断失真 by xu 20260323
- var CURRENT_GRTF_CATEGORY_STATE = {
- value: "",
- label: ""
- };
- // 功能说明:退费类别变化后延后一拍重跑金额校验,确保隐藏字段值更新后再清理红线状态 by xu 20260323
- function handleGrczlbmChange(groupValue, value, label){
- CURRENT_GRTF_CATEGORY_STATE.value = groupValue == null ? "" : groupValue.toString();
- CURRENT_GRTF_CATEGORY_STATE.label = label == null ? "" : label.toString();
- setTimeout(function(){
- if (window.ssVm && typeof window.ssVm.validateField === "function") {
- window.ssVm.validateField("je");
- return;
- }
- validateNegativeAmountByCategory(false);
- }, 0);
- }
- // 功能说明:初始化个人退费页金额负数校验规则,整页金额都必须输入负数 by xu 20260323
- function initNegativeAmountValidation(){
- if (!document.querySelector('[name="je"]') || !document.querySelector('[name="grczlbm"]')) {
- return;
- }
- if (!window.ssVm || typeof window.ssVm.add !== "function" || window.ss.dom._grczGrtfNegativeAmountValidationInited) {
- return;
- }
- window.ss.dom._grczGrtfNegativeAmountValidationInited = true;
- window.ssVm.add("ss.commonValidator.custom", ["je"], {
- msgPrfx: "金额",
- relField: "grczlbm",
- validate: function(value, categoryValue){
- var currentLabel = getCurrentGrczlbmLabel(categoryValue);
- if (value == null || value.toString().trim() === "") {
- return true;
- }
- if (isValidNegativeAmountText(value)) {
- return true;
- }
- return {
- valid: false,
- message: (currentLabel || "退费") + "金额只能输入负数"
- };
- }
- }, {
- je: window.ss.dom.formElemConfig.je ? window.ss.dom.formElemConfig.je.val : ""
- });
- }
- // 功能说明:根据当前退费类别值读取显示文案,供联动校验和错误提示复用 by xu 20260323
- function getCurrentGrczlbmLabel(categoryValue){
- var currentValue = categoryValue == null ? getCurrentGrczlbmValue() : categoryValue.toString();
- if (CURRENT_GRTF_CATEGORY_STATE.label && (!currentValue || CURRENT_GRTF_CATEGORY_STATE.value === currentValue)) {
- return CURRENT_GRTF_CATEGORY_STATE.label;
- }
- return GRTF_LABEL_MAP[currentValue] || "";
- }
- // 功能说明:统一判断金额文本是否为合法负数,供提交校验和 ssVm 规则复用 by xu 20260323
- function isValidNegativeAmountText(value){
- var amountText = value == null ? "" : value.toString().trim();
- if (!amountText) {
- return false;
- }
- var amountNumber = Number(amountText);
- return !isNaN(amountNumber) && amountNumber < 0;
- }
- // 功能说明:根据当前退费类别值读取隐藏字段值,供金额校验复用 by xu 20260323
- function getCurrentGrczlbmValue(){
- var vm = getFormAppVm();
- if (vm && vm.grczlbm != null && vm.grczlbm !== "") {
- return vm.grczlbm.toString();
- }
- var categoryElem = document.querySelector('[name="grczlbm"]');
- return categoryElem && categoryElem.value != null ? categoryElem.value.toString() : "";
- }
- // 功能说明:统一校验个人退费金额必须为负数,不再区分具体退费类别 by xu 20260323
- function validateNegativeAmountByCategory(showMsg){
- var currentLabel = getCurrentGrczlbmLabel();
- var jeElem = document.querySelector('[name="je"]');
- if (!jeElem) {
- return true;
- }
- if (isValidNegativeAmountText(jeElem.value)) {
- return true;
- }
- if (showMsg !== false) {
- alert((currentLabel || "退费") + "金额只能输入负数");
- jeElem.focus();
- }
- return false;
- }
- // 功能说明:个人退费页提交前先走 ssVm 全量校验,确保显示 SsInp 左侧红线与底部提示 by xu 20260323
- function submitGrtfForm(){
- /* 去掉,不是 个人退费页 了。Lin
- if (window.ssVm && window.ssVm.validations && window.ssVm.validations.size > 0) {
- var validateResult = window.ssVm.validateAll();
- if (!validateResult.valid) {
- return false;
- }
- } else if (!validateNegativeAmountByCategory(true)) {
- return false;
- }
- */
- var formElem = document.querySelector("form");
- if (!formElem) {
- alert("表单不存在");
- return false;
- }
- formElem.action = "<ss:serv name='ka_lr_tj' dest='addSure' parm='{thisViewObject:\"ka\",dataType:\"update\"}'/>";
- ss.display.resizeComponent(881,361,515,515);
- formElem.submit();
- return true;
- }
- if (window.SS && typeof SS.ready === "function") {
- SS.ready(function(){
- // 功能说明:页面初始化后同步当前退费类别状态,避免首次校验读取不到最新类别文案 by xu 20260323
- CURRENT_GRTF_CATEGORY_STATE.value = getCurrentGrczlbmValue();
- CURRENT_GRTF_CATEGORY_STATE.label = GRTF_LABEL_MAP[CURRENT_GRTF_CATEGORY_STATE.value] || "";
- // 功能说明:页面初始化后注册个人退费金额负数校验规则,保证 SsInp 输入时直接出现红线提示 by xu 20260323
- initNegativeAmountValidation();
- });
- }
- </script>
|